function __vite__mapDeps(indexes) {
  if (!__vite__mapDeps.viteFileDeps) {
    __vite__mapDeps.viteFileDeps = ["assets/react-B_L_SoWM.js","assets/custom-media-element-oIvx3u1j.js","assets/mixin-LgzrpyjZ.js","assets/hls-BVrUXCDN.js","assets/react-Bc3bwpW9.js","assets/index-B2-TlsHd.js","assets/index-y1bl1xYD.js","assets/index-Cal-gvLI.css"]
  }
  return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value2) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value: value2 }) : obj[key] = value2;
var __publicField = (obj, key, value2) => {
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value2);
  return value2;
};
var _a, _b, _c;
function _mergeNamespaces(n2, m2) {
  for (var i2 = 0; i2 < m2.length; i2++) {
    const e2 = m2[i2];
    if (typeof e2 !== "string" && !Array.isArray(e2)) {
      for (const k2 in e2) {
        if (k2 !== "default" && !(k2 in n2)) {
          const d2 = Object.getOwnPropertyDescriptor(e2, k2);
          if (d2) {
            Object.defineProperty(n2, k2, d2.get ? d2 : {
              enumerable: true,
              get: () => e2[k2]
            });
          }
        }
      }
    }
  }
  return Object.freeze(Object.defineProperty(n2, Symbol.toStringTag, { value: "Module" }));
}
(function polyfill() {
  const relList = document.createElement("link").relList;
  if (relList && relList.supports && relList.supports("modulepreload")) {
    return;
  }
  for (const link2 of document.querySelectorAll('link[rel="modulepreload"]')) {
    processPreload(link2);
  }
  new MutationObserver((mutations) => {
    for (const mutation of mutations) {
      if (mutation.type !== "childList") {
        continue;
      }
      for (const node2 of mutation.addedNodes) {
        if (node2.tagName === "LINK" && node2.rel === "modulepreload")
          processPreload(node2);
      }
    }
  }).observe(document, { childList: true, subtree: true });
  function getFetchOpts(link2) {
    const fetchOpts = {};
    if (link2.integrity)
      fetchOpts.integrity = link2.integrity;
    if (link2.referrerPolicy)
      fetchOpts.referrerPolicy = link2.referrerPolicy;
    if (link2.crossOrigin === "use-credentials")
      fetchOpts.credentials = "include";
    else if (link2.crossOrigin === "anonymous")
      fetchOpts.credentials = "omit";
    else
      fetchOpts.credentials = "same-origin";
    return fetchOpts;
  }
  function processPreload(link2) {
    if (link2.ep)
      return;
    link2.ep = true;
    const fetchOpts = getFetchOpts(link2);
    fetch(link2.href, fetchOpts);
  }
})();
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
function getDefaultExportFromCjs(x2) {
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
}
var jsxRuntime = { exports: {} };
var reactJsxRuntime_production_min = {};
var react = { exports: {} };
var 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$a = Symbol.for("react.element"), n$8 = Symbol.for("react.portal"), p$9 = Symbol.for("react.fragment"), q$5 = Symbol.for("react.strict_mode"), r$9 = Symbol.for("react.profiler"), t$9 = Symbol.for("react.provider"), u$7 = Symbol.for("react.context"), v$6 = Symbol.for("react.forward_ref"), w$4 = Symbol.for("react.suspense"), x$7 = Symbol.for("react.memo"), y$6 = Symbol.for("react.lazy"), z$4 = Symbol.iterator;
function A$5(a2) {
  if (null === a2 || "object" !== typeof a2)
    return null;
  a2 = z$4 && a2[z$4] || a2["@@iterator"];
  return "function" === typeof a2 ? a2 : null;
}
var B$4 = { isMounted: function() {
  return false;
}, enqueueForceUpdate: function() {
}, enqueueReplaceState: function() {
}, enqueueSetState: function() {
} }, C$2 = Object.assign, D$3 = {};
function E$4(a2, b2, e2) {
  this.props = a2;
  this.context = b2;
  this.refs = D$3;
  this.updater = e2 || B$4;
}
E$4.prototype.isReactComponent = {};
E$4.prototype.setState = function(a2, b2) {
  if ("object" !== typeof a2 && "function" !== typeof a2 && null != a2)
    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, a2, b2, "setState");
};
E$4.prototype.forceUpdate = function(a2) {
  this.updater.enqueueForceUpdate(this, a2, "forceUpdate");
};
function F$2() {
}
F$2.prototype = E$4.prototype;
function G$3(a2, b2, e2) {
  this.props = a2;
  this.context = b2;
  this.refs = D$3;
  this.updater = e2 || B$4;
}
var H$4 = G$3.prototype = new F$2();
H$4.constructor = G$3;
C$2(H$4, E$4.prototype);
H$4.isPureReactComponent = true;
var I$4 = Array.isArray, J$3 = Object.prototype.hasOwnProperty, K$3 = { current: null }, L$4 = { key: true, ref: true, __self: true, __source: true };
function M$6(a2, b2, e2) {
  var d2, c2 = {}, k2 = null, h3 = null;
  if (null != b2)
    for (d2 in void 0 !== b2.ref && (h3 = b2.ref), void 0 !== b2.key && (k2 = "" + b2.key), b2)
      J$3.call(b2, d2) && !L$4.hasOwnProperty(d2) && (c2[d2] = b2[d2]);
  var g2 = arguments.length - 2;
  if (1 === g2)
    c2.children = e2;
  else if (1 < g2) {
    for (var f2 = Array(g2), m2 = 0; m2 < g2; m2++)
      f2[m2] = arguments[m2 + 2];
    c2.children = f2;
  }
  if (a2 && a2.defaultProps)
    for (d2 in g2 = a2.defaultProps, g2)
      void 0 === c2[d2] && (c2[d2] = g2[d2]);
  return { $$typeof: l$a, type: a2, key: k2, ref: h3, props: c2, _owner: K$3.current };
}
function N$5(a2, b2) {
  return { $$typeof: l$a, type: a2.type, key: b2, ref: a2.ref, props: a2.props, _owner: a2._owner };
}
function O$4(a2) {
  return "object" === typeof a2 && null !== a2 && a2.$$typeof === l$a;
}
function escape$1(a2) {
  var b2 = { "=": "=0", ":": "=2" };
  return "$" + a2.replace(/[=:]/g, function(a3) {
    return b2[a3];
  });
}
var P$5 = /\/+/g;
function Q$4(a2, b2) {
  return "object" === typeof a2 && null !== a2 && null != a2.key ? escape$1("" + a2.key) : b2.toString(36);
}
function R$5(a2, b2, e2, d2, c2) {
  var k2 = typeof a2;
  if ("undefined" === k2 || "boolean" === k2)
    a2 = null;
  var h3 = false;
  if (null === a2)
    h3 = true;
  else
    switch (k2) {
      case "string":
      case "number":
        h3 = true;
        break;
      case "object":
        switch (a2.$$typeof) {
          case l$a:
          case n$8:
            h3 = true;
        }
    }
  if (h3)
    return h3 = a2, c2 = c2(h3), a2 = "" === d2 ? "." + Q$4(h3, 0) : d2, I$4(c2) ? (e2 = "", null != a2 && (e2 = a2.replace(P$5, "$&/") + "/"), R$5(c2, b2, e2, "", function(a3) {
      return a3;
    })) : null != c2 && (O$4(c2) && (c2 = N$5(c2, e2 + (!c2.key || h3 && h3.key === c2.key ? "" : ("" + c2.key).replace(P$5, "$&/") + "/") + a2)), b2.push(c2)), 1;
  h3 = 0;
  d2 = "" === d2 ? "." : d2 + ":";
  if (I$4(a2))
    for (var g2 = 0; g2 < a2.length; g2++) {
      k2 = a2[g2];
      var f2 = d2 + Q$4(k2, g2);
      h3 += R$5(k2, b2, e2, f2, c2);
    }
  else if (f2 = A$5(a2), "function" === typeof f2)
    for (a2 = f2.call(a2), g2 = 0; !(k2 = a2.next()).done; )
      k2 = k2.value, f2 = d2 + Q$4(k2, g2++), h3 += R$5(k2, b2, e2, f2, c2);
  else if ("object" === k2)
    throw b2 = String(a2), Error("Objects are not valid as a React child (found: " + ("[object Object]" === b2 ? "object with keys {" + Object.keys(a2).join(", ") + "}" : b2) + "). If you meant to render a collection of children, use an array instead.");
  return h3;
}
function S$4(a2, b2, e2) {
  if (null == a2)
    return a2;
  var d2 = [], c2 = 0;
  R$5(a2, d2, "", "", function(a3) {
    return b2.call(e2, a3, c2++);
  });
  return d2;
}
function T$3(a2) {
  if (-1 === a2._status) {
    var b2 = a2._result;
    b2 = b2();
    b2.then(function(b3) {
      if (0 === a2._status || -1 === a2._status)
        a2._status = 1, a2._result = b3;
    }, function(b3) {
      if (0 === a2._status || -1 === a2._status)
        a2._status = 2, a2._result = b3;
    });
    -1 === a2._status && (a2._status = 0, a2._result = b2);
  }
  if (1 === a2._status)
    return a2._result.default;
  throw a2._result;
}
var U$5 = { current: null }, V$4 = { transition: null }, W$5 = { ReactCurrentDispatcher: U$5, ReactCurrentBatchConfig: V$4, ReactCurrentOwner: K$3 };
function X$4() {
  throw Error("act(...) is not supported in production builds of React.");
}
react_production_min.Children = { map: S$4, forEach: function(a2, b2, e2) {
  S$4(a2, function() {
    b2.apply(this, arguments);
  }, e2);
}, count: function(a2) {
  var b2 = 0;
  S$4(a2, function() {
    b2++;
  });
  return b2;
}, toArray: function(a2) {
  return S$4(a2, function(a3) {
    return a3;
  }) || [];
}, only: function(a2) {
  if (!O$4(a2))
    throw Error("React.Children.only expected to receive a single React element child.");
  return a2;
} };
react_production_min.Component = E$4;
react_production_min.Fragment = p$9;
react_production_min.Profiler = r$9;
react_production_min.PureComponent = G$3;
react_production_min.StrictMode = q$5;
react_production_min.Suspense = w$4;
react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = W$5;
react_production_min.act = X$4;
react_production_min.cloneElement = function(a2, b2, e2) {
  if (null === a2 || void 0 === a2)
    throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + a2 + ".");
  var d2 = C$2({}, a2.props), c2 = a2.key, k2 = a2.ref, h3 = a2._owner;
  if (null != b2) {
    void 0 !== b2.ref && (k2 = b2.ref, h3 = K$3.current);
    void 0 !== b2.key && (c2 = "" + b2.key);
    if (a2.type && a2.type.defaultProps)
      var g2 = a2.type.defaultProps;
    for (f2 in b2)
      J$3.call(b2, f2) && !L$4.hasOwnProperty(f2) && (d2[f2] = void 0 === b2[f2] && void 0 !== g2 ? g2[f2] : b2[f2]);
  }
  var f2 = arguments.length - 2;
  if (1 === f2)
    d2.children = e2;
  else if (1 < f2) {
    g2 = Array(f2);
    for (var m2 = 0; m2 < f2; m2++)
      g2[m2] = arguments[m2 + 2];
    d2.children = g2;
  }
  return { $$typeof: l$a, type: a2.type, key: c2, ref: k2, props: d2, _owner: h3 };
};
react_production_min.createContext = function(a2) {
  a2 = { $$typeof: u$7, _currentValue: a2, _currentValue2: a2, _threadCount: 0, Provider: null, Consumer: null, _defaultValue: null, _globalName: null };
  a2.Provider = { $$typeof: t$9, _context: a2 };
  return a2.Consumer = a2;
};
react_production_min.createElement = M$6;
react_production_min.createFactory = function(a2) {
  var b2 = M$6.bind(null, a2);
  b2.type = a2;
  return b2;
};
react_production_min.createRef = function() {
  return { current: null };
};
react_production_min.forwardRef = function(a2) {
  return { $$typeof: v$6, render: a2 };
};
react_production_min.isValidElement = O$4;
react_production_min.lazy = function(a2) {
  return { $$typeof: y$6, _payload: { _status: -1, _result: a2 }, _init: T$3 };
};
react_production_min.memo = function(a2, b2) {
  return { $$typeof: x$7, type: a2, compare: void 0 === b2 ? null : b2 };
};
react_production_min.startTransition = function(a2) {
  var b2 = V$4.transition;
  V$4.transition = {};
  try {
    a2();
  } finally {
    V$4.transition = b2;
  }
};
react_production_min.unstable_act = X$4;
react_production_min.useCallback = function(a2, b2) {
  return U$5.current.useCallback(a2, b2);
};
react_production_min.useContext = function(a2) {
  return U$5.current.useContext(a2);
};
react_production_min.useDebugValue = function() {
};
react_production_min.useDeferredValue = function(a2) {
  return U$5.current.useDeferredValue(a2);
};
react_production_min.useEffect = function(a2, b2) {
  return U$5.current.useEffect(a2, b2);
};
react_production_min.useId = function() {
  return U$5.current.useId();
};
react_production_min.useImperativeHandle = function(a2, b2, e2) {
  return U$5.current.useImperativeHandle(a2, b2, e2);
};
react_production_min.useInsertionEffect = function(a2, b2) {
  return U$5.current.useInsertionEffect(a2, b2);
};
react_production_min.useLayoutEffect = function(a2, b2) {
  return U$5.current.useLayoutEffect(a2, b2);
};
react_production_min.useMemo = function(a2, b2) {
  return U$5.current.useMemo(a2, b2);
};
react_production_min.useReducer = function(a2, b2, e2) {
  return U$5.current.useReducer(a2, b2, e2);
};
react_production_min.useRef = function(a2) {
  return U$5.current.useRef(a2);
};
react_production_min.useState = function(a2) {
  return U$5.current.useState(a2);
};
react_production_min.useSyncExternalStore = function(a2, b2, e2) {
  return U$5.current.useSyncExternalStore(a2, b2, e2);
};
react_production_min.useTransition = function() {
  return U$5.current.useTransition();
};
react_production_min.version = "18.3.1";
{
  react.exports = react_production_min;
}
var reactExports = react.exports;
const React$5 = /* @__PURE__ */ getDefaultExportFromCjs(reactExports);
const React$6 = /* @__PURE__ */ _mergeNamespaces({
  __proto__: null,
  default: React$5
}, [reactExports]);
/**
 * @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$5 = reactExports, k$5 = Symbol.for("react.element"), l$9 = Symbol.for("react.fragment"), m$5 = Object.prototype.hasOwnProperty, n$7 = f$5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p$8 = { key: true, ref: true, __self: true, __source: true };
function q$4(c2, a2, g2) {
  var b2, d2 = {}, e2 = null, h3 = null;
  void 0 !== g2 && (e2 = "" + g2);
  void 0 !== a2.key && (e2 = "" + a2.key);
  void 0 !== a2.ref && (h3 = a2.ref);
  for (b2 in a2)
    m$5.call(a2, b2) && !p$8.hasOwnProperty(b2) && (d2[b2] = a2[b2]);
  if (c2 && c2.defaultProps)
    for (b2 in a2 = c2.defaultProps, a2)
      void 0 === d2[b2] && (d2[b2] = a2[b2]);
  return { $$typeof: k$5, type: c2, key: e2, ref: h3, props: d2, _owner: n$7.current };
}
reactJsxRuntime_production_min.Fragment = l$9;
reactJsxRuntime_production_min.jsx = q$4;
reactJsxRuntime_production_min.jsxs = q$4;
{
  jsxRuntime.exports = reactJsxRuntime_production_min;
}
var jsxRuntimeExports = jsxRuntime.exports;
var client = {};
var reactDom = { exports: {} };
var reactDom_production_min = {};
var scheduler = { exports: {} };
var 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(exports2) {
  function f2(a2, b2) {
    var c2 = a2.length;
    a2.push(b2);
    a:
      for (; 0 < c2; ) {
        var d2 = c2 - 1 >>> 1, e2 = a2[d2];
        if (0 < g2(e2, b2))
          a2[d2] = b2, a2[c2] = e2, c2 = d2;
        else
          break a;
      }
  }
  function h3(a2) {
    return 0 === a2.length ? null : a2[0];
  }
  function k2(a2) {
    if (0 === a2.length)
      return null;
    var b2 = a2[0], c2 = a2.pop();
    if (c2 !== b2) {
      a2[0] = c2;
      a:
        for (var d2 = 0, e2 = a2.length, w2 = e2 >>> 1; d2 < w2; ) {
          var m2 = 2 * (d2 + 1) - 1, C2 = a2[m2], n2 = m2 + 1, x2 = a2[n2];
          if (0 > g2(C2, c2))
            n2 < e2 && 0 > g2(x2, C2) ? (a2[d2] = x2, a2[n2] = c2, d2 = n2) : (a2[d2] = C2, a2[m2] = c2, d2 = m2);
          else if (n2 < e2 && 0 > g2(x2, c2))
            a2[d2] = x2, a2[n2] = c2, d2 = n2;
          else
            break a;
        }
    }
    return b2;
  }
  function g2(a2, b2) {
    var c2 = a2.sortIndex - b2.sortIndex;
    return 0 !== c2 ? c2 : a2.id - b2.id;
  }
  if ("object" === typeof performance && "function" === typeof performance.now) {
    var l2 = performance;
    exports2.unstable_now = function() {
      return l2.now();
    };
  } else {
    var p2 = Date, q2 = p2.now();
    exports2.unstable_now = function() {
      return p2.now() - q2;
    };
  }
  var r2 = [], t2 = [], u2 = 1, v2 = null, y2 = 3, z2 = false, A2 = false, B2 = false, D2 = "function" === typeof setTimeout ? setTimeout : null, E2 = "function" === typeof clearTimeout ? clearTimeout : null, F2 = "undefined" !== typeof setImmediate ? setImmediate : null;
  "undefined" !== typeof navigator && void 0 !== navigator.scheduling && void 0 !== navigator.scheduling.isInputPending && navigator.scheduling.isInputPending.bind(navigator.scheduling);
  function G2(a2) {
    for (var b2 = h3(t2); null !== b2; ) {
      if (null === b2.callback)
        k2(t2);
      else if (b2.startTime <= a2)
        k2(t2), b2.sortIndex = b2.expirationTime, f2(r2, b2);
      else
        break;
      b2 = h3(t2);
    }
  }
  function H2(a2) {
    B2 = false;
    G2(a2);
    if (!A2)
      if (null !== h3(r2))
        A2 = true, I2(J2);
      else {
        var b2 = h3(t2);
        null !== b2 && K2(H2, b2.startTime - a2);
      }
  }
  function J2(a2, b2) {
    A2 = false;
    B2 && (B2 = false, E2(L2), L2 = -1);
    z2 = true;
    var c2 = y2;
    try {
      G2(b2);
      for (v2 = h3(r2); null !== v2 && (!(v2.expirationTime > b2) || a2 && !M2()); ) {
        var d2 = v2.callback;
        if ("function" === typeof d2) {
          v2.callback = null;
          y2 = v2.priorityLevel;
          var e2 = d2(v2.expirationTime <= b2);
          b2 = exports2.unstable_now();
          "function" === typeof e2 ? v2.callback = e2 : v2 === h3(r2) && k2(r2);
          G2(b2);
        } else
          k2(r2);
        v2 = h3(r2);
      }
      if (null !== v2)
        var w2 = true;
      else {
        var m2 = h3(t2);
        null !== m2 && K2(H2, m2.startTime - b2);
        w2 = false;
      }
      return w2;
    } finally {
      v2 = null, y2 = c2, z2 = false;
    }
  }
  var N2 = false, O2 = null, L2 = -1, P2 = 5, Q2 = -1;
  function M2() {
    return exports2.unstable_now() - Q2 < P2 ? false : true;
  }
  function R2() {
    if (null !== O2) {
      var a2 = exports2.unstable_now();
      Q2 = a2;
      var b2 = true;
      try {
        b2 = O2(true, a2);
      } finally {
        b2 ? S2() : (N2 = false, O2 = null);
      }
    } else
      N2 = false;
  }
  var S2;
  if ("function" === typeof F2)
    S2 = function() {
      F2(R2);
    };
  else if ("undefined" !== typeof MessageChannel) {
    var T2 = new MessageChannel(), U2 = T2.port2;
    T2.port1.onmessage = R2;
    S2 = function() {
      U2.postMessage(null);
    };
  } else
    S2 = function() {
      D2(R2, 0);
    };
  function I2(a2) {
    O2 = a2;
    N2 || (N2 = true, S2());
  }
  function K2(a2, b2) {
    L2 = D2(function() {
      a2(exports2.unstable_now());
    }, b2);
  }
  exports2.unstable_IdlePriority = 5;
  exports2.unstable_ImmediatePriority = 1;
  exports2.unstable_LowPriority = 4;
  exports2.unstable_NormalPriority = 3;
  exports2.unstable_Profiling = null;
  exports2.unstable_UserBlockingPriority = 2;
  exports2.unstable_cancelCallback = function(a2) {
    a2.callback = null;
  };
  exports2.unstable_continueExecution = function() {
    A2 || z2 || (A2 = true, I2(J2));
  };
  exports2.unstable_forceFrameRate = function(a2) {
    0 > a2 || 125 < a2 ? console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported") : P2 = 0 < a2 ? Math.floor(1e3 / a2) : 5;
  };
  exports2.unstable_getCurrentPriorityLevel = function() {
    return y2;
  };
  exports2.unstable_getFirstCallbackNode = function() {
    return h3(r2);
  };
  exports2.unstable_next = function(a2) {
    switch (y2) {
      case 1:
      case 2:
      case 3:
        var b2 = 3;
        break;
      default:
        b2 = y2;
    }
    var c2 = y2;
    y2 = b2;
    try {
      return a2();
    } finally {
      y2 = c2;
    }
  };
  exports2.unstable_pauseExecution = function() {
  };
  exports2.unstable_requestPaint = function() {
  };
  exports2.unstable_runWithPriority = function(a2, b2) {
    switch (a2) {
      case 1:
      case 2:
      case 3:
      case 4:
      case 5:
        break;
      default:
        a2 = 3;
    }
    var c2 = y2;
    y2 = a2;
    try {
      return b2();
    } finally {
      y2 = c2;
    }
  };
  exports2.unstable_scheduleCallback = function(a2, b2, c2) {
    var d2 = exports2.unstable_now();
    "object" === typeof c2 && null !== c2 ? (c2 = c2.delay, c2 = "number" === typeof c2 && 0 < c2 ? d2 + c2 : d2) : c2 = d2;
    switch (a2) {
      case 1:
        var e2 = -1;
        break;
      case 2:
        e2 = 250;
        break;
      case 5:
        e2 = 1073741823;
        break;
      case 4:
        e2 = 1e4;
        break;
      default:
        e2 = 5e3;
    }
    e2 = c2 + e2;
    a2 = { id: u2++, callback: b2, priorityLevel: a2, startTime: c2, expirationTime: e2, sortIndex: -1 };
    c2 > d2 ? (a2.sortIndex = c2, f2(t2, a2), null === h3(r2) && a2 === h3(t2) && (B2 ? (E2(L2), L2 = -1) : B2 = true, K2(H2, c2 - d2))) : (a2.sortIndex = e2, f2(r2, a2), A2 || z2 || (A2 = true, I2(J2)));
    return a2;
  };
  exports2.unstable_shouldYield = M2;
  exports2.unstable_wrapCallback = function(a2) {
    var b2 = y2;
    return function() {
      var c2 = y2;
      y2 = b2;
      try {
        return a2.apply(this, arguments);
      } finally {
        y2 = c2;
      }
    };
  };
})(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$2 = reactExports, ca$1 = schedulerExports;
function p$7(a2) {
  for (var b2 = "https://reactjs.org/docs/error-decoder.html?invariant=" + a2, c2 = 1; c2 < arguments.length; c2++)
    b2 += "&args[]=" + encodeURIComponent(arguments[c2]);
  return "Minified React error #" + a2 + "; visit " + b2 + " 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$1 = {};
function fa$2(a2, b2) {
  ha$2(a2, b2);
  ha$2(a2 + "Capture", b2);
}
function ha$2(a2, b2) {
  ea$1[a2] = b2;
  for (a2 = 0; a2 < b2.length; a2++)
    da$1.add(b2[a2]);
}
var ia$2 = !("undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement), ja$2 = Object.prototype.hasOwnProperty, ka$2 = /^[: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$2 = {}, ma$1 = {};
function oa$2(a2) {
  if (ja$2.call(ma$1, a2))
    return true;
  if (ja$2.call(la$2, a2))
    return false;
  if (ka$2.test(a2))
    return ma$1[a2] = true;
  la$2[a2] = true;
  return false;
}
function pa$2(a2, b2, c2, d2) {
  if (null !== c2 && 0 === c2.type)
    return false;
  switch (typeof b2) {
    case "function":
    case "symbol":
      return true;
    case "boolean":
      if (d2)
        return false;
      if (null !== c2)
        return !c2.acceptsBooleans;
      a2 = a2.toLowerCase().slice(0, 5);
      return "data-" !== a2 && "aria-" !== a2;
    default:
      return false;
  }
}
function qa$2(a2, b2, c2, d2) {
  if (null === b2 || "undefined" === typeof b2 || pa$2(a2, b2, c2, d2))
    return true;
  if (d2)
    return false;
  if (null !== c2)
    switch (c2.type) {
      case 3:
        return !b2;
      case 4:
        return false === b2;
      case 5:
        return isNaN(b2);
      case 6:
        return isNaN(b2) || 1 > b2;
    }
  return false;
}
function v$5(a2, b2, c2, d2, e2, f2, g2) {
  this.acceptsBooleans = 2 === b2 || 3 === b2 || 4 === b2;
  this.attributeName = d2;
  this.attributeNamespace = e2;
  this.mustUseProperty = c2;
  this.propertyName = a2;
  this.type = b2;
  this.sanitizeURL = f2;
  this.removeEmptyString = g2;
}
var z$3 = {};
"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a2) {
  z$3[a2] = new v$5(a2, 0, false, a2, null, false, false);
});
[["acceptCharset", "accept-charset"], ["className", "class"], ["htmlFor", "for"], ["httpEquiv", "http-equiv"]].forEach(function(a2) {
  var b2 = a2[0];
  z$3[b2] = new v$5(b2, 1, false, a2[1], null, false, false);
});
["contentEditable", "draggable", "spellCheck", "value"].forEach(function(a2) {
  z$3[a2] = new v$5(a2, 2, false, a2.toLowerCase(), null, false, false);
});
["autoReverse", "externalResourcesRequired", "focusable", "preserveAlpha"].forEach(function(a2) {
  z$3[a2] = new v$5(a2, 2, false, a2, null, false, false);
});
"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(a2) {
  z$3[a2] = new v$5(a2, 3, false, a2.toLowerCase(), null, false, false);
});
["checked", "multiple", "muted", "selected"].forEach(function(a2) {
  z$3[a2] = new v$5(a2, 3, true, a2, null, false, false);
});
["capture", "download"].forEach(function(a2) {
  z$3[a2] = new v$5(a2, 4, false, a2, null, false, false);
});
["cols", "rows", "size", "span"].forEach(function(a2) {
  z$3[a2] = new v$5(a2, 6, false, a2, null, false, false);
});
["rowSpan", "start"].forEach(function(a2) {
  z$3[a2] = new v$5(a2, 5, false, a2.toLowerCase(), null, false, false);
});
var ra$2 = /[\-:]([a-z])/g;
function sa$2(a2) {
  return a2[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(a2) {
  var b2 = a2.replace(
    ra$2,
    sa$2
  );
  z$3[b2] = new v$5(b2, 1, false, a2, null, false, false);
});
"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a2) {
  var b2 = a2.replace(ra$2, sa$2);
  z$3[b2] = new v$5(b2, 1, false, a2, "http://www.w3.org/1999/xlink", false, false);
});
["xml:base", "xml:lang", "xml:space"].forEach(function(a2) {
  var b2 = a2.replace(ra$2, sa$2);
  z$3[b2] = new v$5(b2, 1, false, a2, "http://www.w3.org/XML/1998/namespace", false, false);
});
["tabIndex", "crossOrigin"].forEach(function(a2) {
  z$3[a2] = new v$5(a2, 1, false, a2.toLowerCase(), null, false, false);
});
z$3.xlinkHref = new v$5("xlinkHref", 1, false, "xlink:href", "http://www.w3.org/1999/xlink", true, false);
["src", "href", "action", "formAction"].forEach(function(a2) {
  z$3[a2] = new v$5(a2, 1, false, a2.toLowerCase(), null, true, true);
});
function ta$2(a2, b2, c2, d2) {
  var e2 = z$3.hasOwnProperty(b2) ? z$3[b2] : null;
  if (null !== e2 ? 0 !== e2.type : d2 || !(2 < b2.length) || "o" !== b2[0] && "O" !== b2[0] || "n" !== b2[1] && "N" !== b2[1])
    qa$2(b2, c2, e2, d2) && (c2 = null), d2 || null === e2 ? oa$2(b2) && (null === c2 ? a2.removeAttribute(b2) : a2.setAttribute(b2, "" + c2)) : e2.mustUseProperty ? a2[e2.propertyName] = null === c2 ? 3 === e2.type ? false : "" : c2 : (b2 = e2.attributeName, d2 = e2.attributeNamespace, null === c2 ? a2.removeAttribute(b2) : (e2 = e2.type, c2 = 3 === e2 || 4 === e2 && true === c2 ? "" : "" + c2, d2 ? a2.setAttributeNS(d2, b2, c2) : a2.setAttribute(b2, c2)));
}
var ua$2 = aa$2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, va$2 = Symbol.for("react.element"), wa$2 = Symbol.for("react.portal"), ya$2 = Symbol.for("react.fragment"), za$2 = Symbol.for("react.strict_mode"), Aa$2 = Symbol.for("react.profiler"), Ba$2 = Symbol.for("react.provider"), Ca$2 = Symbol.for("react.context"), Da$2 = Symbol.for("react.forward_ref"), Ea$2 = Symbol.for("react.suspense"), Fa$2 = Symbol.for("react.suspense_list"), Ga$2 = Symbol.for("react.memo"), Ha$2 = Symbol.for("react.lazy");
var Ia$2 = Symbol.for("react.offscreen");
var Ja$2 = Symbol.iterator;
function Ka$2(a2) {
  if (null === a2 || "object" !== typeof a2)
    return null;
  a2 = Ja$2 && a2[Ja$2] || a2["@@iterator"];
  return "function" === typeof a2 ? a2 : null;
}
var A$4 = Object.assign, La$2;
function Ma$2(a2) {
  if (void 0 === La$2)
    try {
      throw Error();
    } catch (c2) {
      var b2 = c2.stack.trim().match(/\n( *(at )?)/);
      La$2 = b2 && b2[1] || "";
    }
  return "\n" + La$2 + a2;
}
var Na$2 = false;
function Oa$2(a2, b2) {
  if (!a2 || Na$2)
    return "";
  Na$2 = true;
  var c2 = Error.prepareStackTrace;
  Error.prepareStackTrace = void 0;
  try {
    if (b2)
      if (b2 = function() {
        throw Error();
      }, Object.defineProperty(b2.prototype, "props", { set: function() {
        throw Error();
      } }), "object" === typeof Reflect && Reflect.construct) {
        try {
          Reflect.construct(b2, []);
        } catch (l2) {
          var d2 = l2;
        }
        Reflect.construct(a2, [], b2);
      } else {
        try {
          b2.call();
        } catch (l2) {
          d2 = l2;
        }
        a2.call(b2.prototype);
      }
    else {
      try {
        throw Error();
      } catch (l2) {
        d2 = l2;
      }
      a2();
    }
  } catch (l2) {
    if (l2 && d2 && "string" === typeof l2.stack) {
      for (var e2 = l2.stack.split("\n"), f2 = d2.stack.split("\n"), g2 = e2.length - 1, h3 = f2.length - 1; 1 <= g2 && 0 <= h3 && e2[g2] !== f2[h3]; )
        h3--;
      for (; 1 <= g2 && 0 <= h3; g2--, h3--)
        if (e2[g2] !== f2[h3]) {
          if (1 !== g2 || 1 !== h3) {
            do
              if (g2--, h3--, 0 > h3 || e2[g2] !== f2[h3]) {
                var k2 = "\n" + e2[g2].replace(" at new ", " at ");
                a2.displayName && k2.includes("<anonymous>") && (k2 = k2.replace("<anonymous>", a2.displayName));
                return k2;
              }
            while (1 <= g2 && 0 <= h3);
          }
          break;
        }
    }
  } finally {
    Na$2 = false, Error.prepareStackTrace = c2;
  }
  return (a2 = a2 ? a2.displayName || a2.name : "") ? Ma$2(a2) : "";
}
function Pa$2(a2) {
  switch (a2.tag) {
    case 5:
      return Ma$2(a2.type);
    case 16:
      return Ma$2("Lazy");
    case 13:
      return Ma$2("Suspense");
    case 19:
      return Ma$2("SuspenseList");
    case 0:
    case 2:
    case 15:
      return a2 = Oa$2(a2.type, false), a2;
    case 11:
      return a2 = Oa$2(a2.type.render, false), a2;
    case 1:
      return a2 = Oa$2(a2.type, true), a2;
    default:
      return "";
  }
}
function Qa$2(a2) {
  if (null == a2)
    return null;
  if ("function" === typeof a2)
    return a2.displayName || a2.name || null;
  if ("string" === typeof a2)
    return a2;
  switch (a2) {
    case ya$2:
      return "Fragment";
    case wa$2:
      return "Portal";
    case Aa$2:
      return "Profiler";
    case za$2:
      return "StrictMode";
    case Ea$2:
      return "Suspense";
    case Fa$2:
      return "SuspenseList";
  }
  if ("object" === typeof a2)
    switch (a2.$$typeof) {
      case Ca$2:
        return (a2.displayName || "Context") + ".Consumer";
      case Ba$2:
        return (a2._context.displayName || "Context") + ".Provider";
      case Da$2:
        var b2 = a2.render;
        a2 = a2.displayName;
        a2 || (a2 = b2.displayName || b2.name || "", a2 = "" !== a2 ? "ForwardRef(" + a2 + ")" : "ForwardRef");
        return a2;
      case Ga$2:
        return b2 = a2.displayName || null, null !== b2 ? b2 : Qa$2(a2.type) || "Memo";
      case Ha$2:
        b2 = a2._payload;
        a2 = a2._init;
        try {
          return Qa$2(a2(b2));
        } catch (c2) {
        }
    }
  return null;
}
function Ra$2(a2) {
  var b2 = a2.type;
  switch (a2.tag) {
    case 24:
      return "Cache";
    case 9:
      return (b2.displayName || "Context") + ".Consumer";
    case 10:
      return (b2._context.displayName || "Context") + ".Provider";
    case 18:
      return "DehydratedFragment";
    case 11:
      return a2 = b2.render, a2 = a2.displayName || a2.name || "", b2.displayName || ("" !== a2 ? "ForwardRef(" + a2 + ")" : "ForwardRef");
    case 7:
      return "Fragment";
    case 5:
      return b2;
    case 4:
      return "Portal";
    case 3:
      return "Root";
    case 6:
      return "Text";
    case 16:
      return Qa$2(b2);
    case 8:
      return b2 === za$2 ? "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 ("function" === typeof b2)
        return b2.displayName || b2.name || null;
      if ("string" === typeof b2)
        return b2;
  }
  return null;
}
function Sa$2(a2) {
  switch (typeof a2) {
    case "boolean":
    case "number":
    case "string":
    case "undefined":
      return a2;
    case "object":
      return a2;
    default:
      return "";
  }
}
function Ta$2(a2) {
  var b2 = a2.type;
  return (a2 = a2.nodeName) && "input" === a2.toLowerCase() && ("checkbox" === b2 || "radio" === b2);
}
function Ua$2(a2) {
  var b2 = Ta$2(a2) ? "checked" : "value", c2 = Object.getOwnPropertyDescriptor(a2.constructor.prototype, b2), d2 = "" + a2[b2];
  if (!a2.hasOwnProperty(b2) && "undefined" !== typeof c2 && "function" === typeof c2.get && "function" === typeof c2.set) {
    var e2 = c2.get, f2 = c2.set;
    Object.defineProperty(a2, b2, { configurable: true, get: function() {
      return e2.call(this);
    }, set: function(a3) {
      d2 = "" + a3;
      f2.call(this, a3);
    } });
    Object.defineProperty(a2, b2, { enumerable: c2.enumerable });
    return { getValue: function() {
      return d2;
    }, setValue: function(a3) {
      d2 = "" + a3;
    }, stopTracking: function() {
      a2._valueTracker = null;
      delete a2[b2];
    } };
  }
}
function Va$2(a2) {
  a2._valueTracker || (a2._valueTracker = Ua$2(a2));
}
function Wa$2(a2) {
  if (!a2)
    return false;
  var b2 = a2._valueTracker;
  if (!b2)
    return true;
  var c2 = b2.getValue();
  var d2 = "";
  a2 && (d2 = Ta$2(a2) ? a2.checked ? "true" : "false" : a2.value);
  a2 = d2;
  return a2 !== c2 ? (b2.setValue(a2), true) : false;
}
function Xa$2(a2) {
  a2 = a2 || ("undefined" !== typeof document ? document : void 0);
  if ("undefined" === typeof a2)
    return null;
  try {
    return a2.activeElement || a2.body;
  } catch (b2) {
    return a2.body;
  }
}
function Ya$2(a2, b2) {
  var c2 = b2.checked;
  return A$4({}, b2, { defaultChecked: void 0, defaultValue: void 0, value: void 0, checked: null != c2 ? c2 : a2._wrapperState.initialChecked });
}
function Za$2(a2, b2) {
  var c2 = null == b2.defaultValue ? "" : b2.defaultValue, d2 = null != b2.checked ? b2.checked : b2.defaultChecked;
  c2 = Sa$2(null != b2.value ? b2.value : c2);
  a2._wrapperState = { initialChecked: d2, initialValue: c2, controlled: "checkbox" === b2.type || "radio" === b2.type ? null != b2.checked : null != b2.value };
}
function ab$2(a2, b2) {
  b2 = b2.checked;
  null != b2 && ta$2(a2, "checked", b2, false);
}
function bb$2(a2, b2) {
  ab$2(a2, b2);
  var c2 = Sa$2(b2.value), d2 = b2.type;
  if (null != c2)
    if ("number" === d2) {
      if (0 === c2 && "" === a2.value || a2.value != c2)
        a2.value = "" + c2;
    } else
      a2.value !== "" + c2 && (a2.value = "" + c2);
  else if ("submit" === d2 || "reset" === d2) {
    a2.removeAttribute("value");
    return;
  }
  b2.hasOwnProperty("value") ? cb$2(a2, b2.type, c2) : b2.hasOwnProperty("defaultValue") && cb$2(a2, b2.type, Sa$2(b2.defaultValue));
  null == b2.checked && null != b2.defaultChecked && (a2.defaultChecked = !!b2.defaultChecked);
}
function db$2(a2, b2, c2) {
  if (b2.hasOwnProperty("value") || b2.hasOwnProperty("defaultValue")) {
    var d2 = b2.type;
    if (!("submit" !== d2 && "reset" !== d2 || void 0 !== b2.value && null !== b2.value))
      return;
    b2 = "" + a2._wrapperState.initialValue;
    c2 || b2 === a2.value || (a2.value = b2);
    a2.defaultValue = b2;
  }
  c2 = a2.name;
  "" !== c2 && (a2.name = "");
  a2.defaultChecked = !!a2._wrapperState.initialChecked;
  "" !== c2 && (a2.name = c2);
}
function cb$2(a2, b2, c2) {
  if ("number" !== b2 || Xa$2(a2.ownerDocument) !== a2)
    null == c2 ? a2.defaultValue = "" + a2._wrapperState.initialValue : a2.defaultValue !== "" + c2 && (a2.defaultValue = "" + c2);
}
var eb$2 = Array.isArray;
function fb$2(a2, b2, c2, d2) {
  a2 = a2.options;
  if (b2) {
    b2 = {};
    for (var e2 = 0; e2 < c2.length; e2++)
      b2["$" + c2[e2]] = true;
    for (c2 = 0; c2 < a2.length; c2++)
      e2 = b2.hasOwnProperty("$" + a2[c2].value), a2[c2].selected !== e2 && (a2[c2].selected = e2), e2 && d2 && (a2[c2].defaultSelected = true);
  } else {
    c2 = "" + Sa$2(c2);
    b2 = null;
    for (e2 = 0; e2 < a2.length; e2++) {
      if (a2[e2].value === c2) {
        a2[e2].selected = true;
        d2 && (a2[e2].defaultSelected = true);
        return;
      }
      null !== b2 || a2[e2].disabled || (b2 = a2[e2]);
    }
    null !== b2 && (b2.selected = true);
  }
}
function gb$2(a2, b2) {
  if (null != b2.dangerouslySetInnerHTML)
    throw Error(p$7(91));
  return A$4({}, b2, { value: void 0, defaultValue: void 0, children: "" + a2._wrapperState.initialValue });
}
function hb$2(a2, b2) {
  var c2 = b2.value;
  if (null == c2) {
    c2 = b2.children;
    b2 = b2.defaultValue;
    if (null != c2) {
      if (null != b2)
        throw Error(p$7(92));
      if (eb$2(c2)) {
        if (1 < c2.length)
          throw Error(p$7(93));
        c2 = c2[0];
      }
      b2 = c2;
    }
    null == b2 && (b2 = "");
    c2 = b2;
  }
  a2._wrapperState = { initialValue: Sa$2(c2) };
}
function ib$2(a2, b2) {
  var c2 = Sa$2(b2.value), d2 = Sa$2(b2.defaultValue);
  null != c2 && (c2 = "" + c2, c2 !== a2.value && (a2.value = c2), null == b2.defaultValue && a2.defaultValue !== c2 && (a2.defaultValue = c2));
  null != d2 && (a2.defaultValue = "" + d2);
}
function jb$2(a2) {
  var b2 = a2.textContent;
  b2 === a2._wrapperState.initialValue && "" !== b2 && null !== b2 && (a2.value = b2);
}
function kb$2(a2) {
  switch (a2) {
    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$2(a2, b2) {
  return null == a2 || "http://www.w3.org/1999/xhtml" === a2 ? kb$2(b2) : "http://www.w3.org/2000/svg" === a2 && "foreignObject" === b2 ? "http://www.w3.org/1999/xhtml" : a2;
}
var mb$1, nb$1 = function(a2) {
  return "undefined" !== typeof MSApp && MSApp.execUnsafeLocalFunction ? function(b2, c2, d2, e2) {
    MSApp.execUnsafeLocalFunction(function() {
      return a2(b2, c2, d2, e2);
    });
  } : a2;
}(function(a2, b2) {
  if ("http://www.w3.org/2000/svg" !== a2.namespaceURI || "innerHTML" in a2)
    a2.innerHTML = b2;
  else {
    mb$1 = mb$1 || document.createElement("div");
    mb$1.innerHTML = "<svg>" + b2.valueOf().toString() + "</svg>";
    for (b2 = mb$1.firstChild; a2.firstChild; )
      a2.removeChild(a2.firstChild);
    for (; b2.firstChild; )
      a2.appendChild(b2.firstChild);
  }
});
function ob$2(a2, b2) {
  if (b2) {
    var c2 = a2.firstChild;
    if (c2 && c2 === a2.lastChild && 3 === c2.nodeType) {
      c2.nodeValue = b2;
      return;
    }
  }
  a2.textContent = b2;
}
var pb$2 = {
  animationIterationCount: true,
  aspectRatio: true,
  borderImageOutset: true,
  borderImageSlice: true,
  borderImageWidth: true,
  boxFlex: true,
  boxFlexGroup: true,
  boxOrdinalGroup: true,
  columnCount: true,
  columns: true,
  flex: true,
  flexGrow: true,
  flexPositive: true,
  flexShrink: true,
  flexNegative: true,
  flexOrder: true,
  gridArea: true,
  gridRow: true,
  gridRowEnd: true,
  gridRowSpan: true,
  gridRowStart: true,
  gridColumn: true,
  gridColumnEnd: true,
  gridColumnSpan: true,
  gridColumnStart: true,
  fontWeight: true,
  lineClamp: true,
  lineHeight: true,
  opacity: true,
  order: true,
  orphans: true,
  tabSize: true,
  widows: true,
  zIndex: true,
  zoom: true,
  fillOpacity: true,
  floodOpacity: true,
  stopOpacity: true,
  strokeDasharray: true,
  strokeDashoffset: true,
  strokeMiterlimit: true,
  strokeOpacity: true,
  strokeWidth: true
}, qb$2 = ["Webkit", "ms", "Moz", "O"];
Object.keys(pb$2).forEach(function(a2) {
  qb$2.forEach(function(b2) {
    b2 = b2 + a2.charAt(0).toUpperCase() + a2.substring(1);
    pb$2[b2] = pb$2[a2];
  });
});
function rb$2(a2, b2, c2) {
  return null == b2 || "boolean" === typeof b2 || "" === b2 ? "" : c2 || "number" !== typeof b2 || 0 === b2 || pb$2.hasOwnProperty(a2) && pb$2[a2] ? ("" + b2).trim() : b2 + "px";
}
function sb$2(a2, b2) {
  a2 = a2.style;
  for (var c2 in b2)
    if (b2.hasOwnProperty(c2)) {
      var d2 = 0 === c2.indexOf("--"), e2 = rb$2(c2, b2[c2], d2);
      "float" === c2 && (c2 = "cssFloat");
      d2 ? a2.setProperty(c2, e2) : a2[c2] = e2;
    }
}
var tb$2 = A$4({ menuitem: true }, { area: true, base: true, br: true, col: true, embed: true, hr: true, img: true, input: true, keygen: true, link: true, meta: true, param: true, source: true, track: true, wbr: true });
function ub$2(a2, b2) {
  if (b2) {
    if (tb$2[a2] && (null != b2.children || null != b2.dangerouslySetInnerHTML))
      throw Error(p$7(137, a2));
    if (null != b2.dangerouslySetInnerHTML) {
      if (null != b2.children)
        throw Error(p$7(60));
      if ("object" !== typeof b2.dangerouslySetInnerHTML || !("__html" in b2.dangerouslySetInnerHTML))
        throw Error(p$7(61));
    }
    if (null != b2.style && "object" !== typeof b2.style)
      throw Error(p$7(62));
  }
}
function vb$2(a2, b2) {
  if (-1 === a2.indexOf("-"))
    return "string" === typeof b2.is;
  switch (a2) {
    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 false;
    default:
      return true;
  }
}
var wb$2 = null;
function xb$2(a2) {
  a2 = a2.target || a2.srcElement || window;
  a2.correspondingUseElement && (a2 = a2.correspondingUseElement);
  return 3 === a2.nodeType ? a2.parentNode : a2;
}
var yb$2 = null, zb$2 = null, Ab$2 = null;
function Bb$2(a2) {
  if (a2 = Cb$2(a2)) {
    if ("function" !== typeof yb$2)
      throw Error(p$7(280));
    var b2 = a2.stateNode;
    b2 && (b2 = Db$2(b2), yb$2(a2.stateNode, a2.type, b2));
  }
}
function Eb$2(a2) {
  zb$2 ? Ab$2 ? Ab$2.push(a2) : Ab$2 = [a2] : zb$2 = a2;
}
function Fb$1() {
  if (zb$2) {
    var a2 = zb$2, b2 = Ab$2;
    Ab$2 = zb$2 = null;
    Bb$2(a2);
    if (b2)
      for (a2 = 0; a2 < b2.length; a2++)
        Bb$2(b2[a2]);
  }
}
function Gb$2(a2, b2) {
  return a2(b2);
}
function Hb$2() {
}
var Ib$2 = false;
function Jb$2(a2, b2, c2) {
  if (Ib$2)
    return a2(b2, c2);
  Ib$2 = true;
  try {
    return Gb$2(a2, b2, c2);
  } finally {
    if (Ib$2 = false, null !== zb$2 || null !== Ab$2)
      Hb$2(), Fb$1();
  }
}
function Kb$2(a2, b2) {
  var c2 = a2.stateNode;
  if (null === c2)
    return null;
  var d2 = Db$2(c2);
  if (null === d2)
    return null;
  c2 = d2[b2];
  a:
    switch (b2) {
      case "onClick":
      case "onClickCapture":
      case "onDoubleClick":
      case "onDoubleClickCapture":
      case "onMouseDown":
      case "onMouseDownCapture":
      case "onMouseMove":
      case "onMouseMoveCapture":
      case "onMouseUp":
      case "onMouseUpCapture":
      case "onMouseEnter":
        (d2 = !d2.disabled) || (a2 = a2.type, d2 = !("button" === a2 || "input" === a2 || "select" === a2 || "textarea" === a2));
        a2 = !d2;
        break a;
      default:
        a2 = false;
    }
  if (a2)
    return null;
  if (c2 && "function" !== typeof c2)
    throw Error(p$7(231, b2, typeof c2));
  return c2;
}
var Lb$2 = false;
if (ia$2)
  try {
    var Mb$2 = {};
    Object.defineProperty(Mb$2, "passive", { get: function() {
      Lb$2 = true;
    } });
    window.addEventListener("test", Mb$2, Mb$2);
    window.removeEventListener("test", Mb$2, Mb$2);
  } catch (a2) {
    Lb$2 = false;
  }
function Nb$2(a2, b2, c2, d2, e2, f2, g2, h3, k2) {
  var l2 = Array.prototype.slice.call(arguments, 3);
  try {
    b2.apply(c2, l2);
  } catch (m2) {
    this.onError(m2);
  }
}
var Ob$2 = false, Pb$2 = null, Qb$2 = false, Rb$2 = null, Sb$2 = { onError: function(a2) {
  Ob$2 = true;
  Pb$2 = a2;
} };
function Tb$2(a2, b2, c2, d2, e2, f2, g2, h3, k2) {
  Ob$2 = false;
  Pb$2 = null;
  Nb$2.apply(Sb$2, arguments);
}
function Ub$1(a2, b2, c2, d2, e2, f2, g2, h3, k2) {
  Tb$2.apply(this, arguments);
  if (Ob$2) {
    if (Ob$2) {
      var l2 = Pb$2;
      Ob$2 = false;
      Pb$2 = null;
    } else
      throw Error(p$7(198));
    Qb$2 || (Qb$2 = true, Rb$2 = l2);
  }
}
function Vb$1(a2) {
  var b2 = a2, c2 = a2;
  if (a2.alternate)
    for (; b2.return; )
      b2 = b2.return;
  else {
    a2 = b2;
    do
      b2 = a2, 0 !== (b2.flags & 4098) && (c2 = b2.return), a2 = b2.return;
    while (a2);
  }
  return 3 === b2.tag ? c2 : null;
}
function Wb$1(a2) {
  if (13 === a2.tag) {
    var b2 = a2.memoizedState;
    null === b2 && (a2 = a2.alternate, null !== a2 && (b2 = a2.memoizedState));
    if (null !== b2)
      return b2.dehydrated;
  }
  return null;
}
function Xb$1(a2) {
  if (Vb$1(a2) !== a2)
    throw Error(p$7(188));
}
function Yb$1(a2) {
  var b2 = a2.alternate;
  if (!b2) {
    b2 = Vb$1(a2);
    if (null === b2)
      throw Error(p$7(188));
    return b2 !== a2 ? null : a2;
  }
  for (var c2 = a2, d2 = b2; ; ) {
    var e2 = c2.return;
    if (null === e2)
      break;
    var f2 = e2.alternate;
    if (null === f2) {
      d2 = e2.return;
      if (null !== d2) {
        c2 = d2;
        continue;
      }
      break;
    }
    if (e2.child === f2.child) {
      for (f2 = e2.child; f2; ) {
        if (f2 === c2)
          return Xb$1(e2), a2;
        if (f2 === d2)
          return Xb$1(e2), b2;
        f2 = f2.sibling;
      }
      throw Error(p$7(188));
    }
    if (c2.return !== d2.return)
      c2 = e2, d2 = f2;
    else {
      for (var g2 = false, h3 = e2.child; h3; ) {
        if (h3 === c2) {
          g2 = true;
          c2 = e2;
          d2 = f2;
          break;
        }
        if (h3 === d2) {
          g2 = true;
          d2 = e2;
          c2 = f2;
          break;
        }
        h3 = h3.sibling;
      }
      if (!g2) {
        for (h3 = f2.child; h3; ) {
          if (h3 === c2) {
            g2 = true;
            c2 = f2;
            d2 = e2;
            break;
          }
          if (h3 === d2) {
            g2 = true;
            d2 = f2;
            c2 = e2;
            break;
          }
          h3 = h3.sibling;
        }
        if (!g2)
          throw Error(p$7(189));
      }
    }
    if (c2.alternate !== d2)
      throw Error(p$7(190));
  }
  if (3 !== c2.tag)
    throw Error(p$7(188));
  return c2.stateNode.current === c2 ? a2 : b2;
}
function Zb$1(a2) {
  a2 = Yb$1(a2);
  return null !== a2 ? $b$1(a2) : null;
}
function $b$1(a2) {
  if (5 === a2.tag || 6 === a2.tag)
    return a2;
  for (a2 = a2.child; null !== a2; ) {
    var b2 = $b$1(a2);
    if (null !== b2)
      return b2;
    a2 = a2.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$3 = 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$1(a2) {
  if (lc$1 && "function" === typeof lc$1.onCommitFiberRoot)
    try {
      lc$1.onCommitFiberRoot(kc$1, a2, void 0, 128 === (a2.current.flags & 128));
    } catch (b2) {
    }
}
var oc$1 = Math.clz32 ? Math.clz32 : nc$1, pc$1 = Math.log, qc$1 = Math.LN2;
function nc$1(a2) {
  a2 >>>= 0;
  return 0 === a2 ? 32 : 31 - (pc$1(a2) / qc$1 | 0) | 0;
}
var rc$1 = 64, sc$1 = 4194304;
function tc$1(a2) {
  switch (a2 & -a2) {
    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 a2 & 4194240;
    case 4194304:
    case 8388608:
    case 16777216:
    case 33554432:
    case 67108864:
      return a2 & 130023424;
    case 134217728:
      return 134217728;
    case 268435456:
      return 268435456;
    case 536870912:
      return 536870912;
    case 1073741824:
      return 1073741824;
    default:
      return a2;
  }
}
function uc$1(a2, b2) {
  var c2 = a2.pendingLanes;
  if (0 === c2)
    return 0;
  var d2 = 0, e2 = a2.suspendedLanes, f2 = a2.pingedLanes, g2 = c2 & 268435455;
  if (0 !== g2) {
    var h3 = g2 & ~e2;
    0 !== h3 ? d2 = tc$1(h3) : (f2 &= g2, 0 !== f2 && (d2 = tc$1(f2)));
  } else
    g2 = c2 & ~e2, 0 !== g2 ? d2 = tc$1(g2) : 0 !== f2 && (d2 = tc$1(f2));
  if (0 === d2)
    return 0;
  if (0 !== b2 && b2 !== d2 && 0 === (b2 & e2) && (e2 = d2 & -d2, f2 = b2 & -b2, e2 >= f2 || 16 === e2 && 0 !== (f2 & 4194240)))
    return b2;
  0 !== (d2 & 4) && (d2 |= c2 & 16);
  b2 = a2.entangledLanes;
  if (0 !== b2)
    for (a2 = a2.entanglements, b2 &= d2; 0 < b2; )
      c2 = 31 - oc$1(b2), e2 = 1 << c2, d2 |= a2[c2], b2 &= ~e2;
  return d2;
}
function vc$1(a2, b2) {
  switch (a2) {
    case 1:
    case 2:
    case 4:
      return b2 + 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 b2 + 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(a2, b2) {
  for (var c2 = a2.suspendedLanes, d2 = a2.pingedLanes, e2 = a2.expirationTimes, f2 = a2.pendingLanes; 0 < f2; ) {
    var g2 = 31 - oc$1(f2), h3 = 1 << g2, k2 = e2[g2];
    if (-1 === k2) {
      if (0 === (h3 & c2) || 0 !== (h3 & d2))
        e2[g2] = vc$1(h3, b2);
    } else
      k2 <= b2 && (a2.expiredLanes |= h3);
    f2 &= ~h3;
  }
}
function xc$1(a2) {
  a2 = a2.pendingLanes & -1073741825;
  return 0 !== a2 ? a2 : a2 & 1073741824 ? 1073741824 : 0;
}
function yc$1() {
  var a2 = rc$1;
  rc$1 <<= 1;
  0 === (rc$1 & 4194240) && (rc$1 = 64);
  return a2;
}
function zc$1(a2) {
  for (var b2 = [], c2 = 0; 31 > c2; c2++)
    b2.push(a2);
  return b2;
}
function Ac$1(a2, b2, c2) {
  a2.pendingLanes |= b2;
  536870912 !== b2 && (a2.suspendedLanes = 0, a2.pingedLanes = 0);
  a2 = a2.eventTimes;
  b2 = 31 - oc$1(b2);
  a2[b2] = c2;
}
function Bc$1(a2, b2) {
  var c2 = a2.pendingLanes & ~b2;
  a2.pendingLanes = b2;
  a2.suspendedLanes = 0;
  a2.pingedLanes = 0;
  a2.expiredLanes &= b2;
  a2.mutableReadLanes &= b2;
  a2.entangledLanes &= b2;
  b2 = a2.entanglements;
  var d2 = a2.eventTimes;
  for (a2 = a2.expirationTimes; 0 < c2; ) {
    var e2 = 31 - oc$1(c2), f2 = 1 << e2;
    b2[e2] = 0;
    d2[e2] = -1;
    a2[e2] = -1;
    c2 &= ~f2;
  }
}
function Cc$1(a2, b2) {
  var c2 = a2.entangledLanes |= b2;
  for (a2 = a2.entanglements; c2; ) {
    var d2 = 31 - oc$1(c2), e2 = 1 << d2;
    e2 & b2 | a2[d2] & b2 && (a2[d2] |= b2);
    c2 &= ~e2;
  }
}
var C$1 = 0;
function Dc$1(a2) {
  a2 &= -a2;
  return 1 < a2 ? 4 < a2 ? 0 !== (a2 & 268435455) ? 16 : 536870912 : 4 : 1;
}
var Ec$1, Fc$1, Gc$1, Hc$1, Ic$1, Jc$1 = false, 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(a2, b2) {
  switch (a2) {
    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(b2.pointerId);
      break;
    case "gotpointercapture":
    case "lostpointercapture":
      Pc$1.delete(b2.pointerId);
  }
}
function Tc$1(a2, b2, c2, d2, e2, f2) {
  if (null === a2 || a2.nativeEvent !== f2)
    return a2 = { blockedOn: b2, domEventName: c2, eventSystemFlags: d2, nativeEvent: f2, targetContainers: [e2] }, null !== b2 && (b2 = Cb$2(b2), null !== b2 && Fc$1(b2)), a2;
  a2.eventSystemFlags |= d2;
  b2 = a2.targetContainers;
  null !== e2 && -1 === b2.indexOf(e2) && b2.push(e2);
  return a2;
}
function Uc$1(a2, b2, c2, d2, e2) {
  switch (b2) {
    case "focusin":
      return Lc$1 = Tc$1(Lc$1, a2, b2, c2, d2, e2), true;
    case "dragenter":
      return Mc$1 = Tc$1(Mc$1, a2, b2, c2, d2, e2), true;
    case "mouseover":
      return Nc$1 = Tc$1(Nc$1, a2, b2, c2, d2, e2), true;
    case "pointerover":
      var f2 = e2.pointerId;
      Oc$1.set(f2, Tc$1(Oc$1.get(f2) || null, a2, b2, c2, d2, e2));
      return true;
    case "gotpointercapture":
      return f2 = e2.pointerId, Pc$1.set(f2, Tc$1(Pc$1.get(f2) || null, a2, b2, c2, d2, e2)), true;
  }
  return false;
}
function Vc$1(a2) {
  var b2 = Wc$1(a2.target);
  if (null !== b2) {
    var c2 = Vb$1(b2);
    if (null !== c2) {
      if (b2 = c2.tag, 13 === b2) {
        if (b2 = Wb$1(c2), null !== b2) {
          a2.blockedOn = b2;
          Ic$1(a2.priority, function() {
            Gc$1(c2);
          });
          return;
        }
      } else if (3 === b2 && c2.stateNode.current.memoizedState.isDehydrated) {
        a2.blockedOn = 3 === c2.tag ? c2.stateNode.containerInfo : null;
        return;
      }
    }
  }
  a2.blockedOn = null;
}
function Xc$1(a2) {
  if (null !== a2.blockedOn)
    return false;
  for (var b2 = a2.targetContainers; 0 < b2.length; ) {
    var c2 = Yc$1(a2.domEventName, a2.eventSystemFlags, b2[0], a2.nativeEvent);
    if (null === c2) {
      c2 = a2.nativeEvent;
      var d2 = new c2.constructor(c2.type, c2);
      wb$2 = d2;
      c2.target.dispatchEvent(d2);
      wb$2 = null;
    } else
      return b2 = Cb$2(c2), null !== b2 && Fc$1(b2), a2.blockedOn = c2, false;
    b2.shift();
  }
  return true;
}
function Zc$1(a2, b2, c2) {
  Xc$1(a2) && c2.delete(b2);
}
function $c$1() {
  Jc$1 = false;
  null !== Lc$1 && Xc$1(Lc$1) && (Lc$1 = null);
  null !== Mc$1 && Xc$1(Mc$1) && (Mc$1 = null);
  null !== Nc$1 && Xc$1(Nc$1) && (Nc$1 = null);
  Oc$1.forEach(Zc$1);
  Pc$1.forEach(Zc$1);
}
function ad$1(a2, b2) {
  a2.blockedOn === b2 && (a2.blockedOn = null, Jc$1 || (Jc$1 = true, ca$1.unstable_scheduleCallback(ca$1.unstable_NormalPriority, $c$1)));
}
function bd$1(a2) {
  function b2(b3) {
    return ad$1(b3, a2);
  }
  if (0 < Kc$1.length) {
    ad$1(Kc$1[0], a2);
    for (var c2 = 1; c2 < Kc$1.length; c2++) {
      var d2 = Kc$1[c2];
      d2.blockedOn === a2 && (d2.blockedOn = null);
    }
  }
  null !== Lc$1 && ad$1(Lc$1, a2);
  null !== Mc$1 && ad$1(Mc$1, a2);
  null !== Nc$1 && ad$1(Nc$1, a2);
  Oc$1.forEach(b2);
  Pc$1.forEach(b2);
  for (c2 = 0; c2 < Qc$1.length; c2++)
    d2 = Qc$1[c2], d2.blockedOn === a2 && (d2.blockedOn = null);
  for (; 0 < Qc$1.length && (c2 = Qc$1[0], null === c2.blockedOn); )
    Vc$1(c2), null === c2.blockedOn && Qc$1.shift();
}
var cd$1 = ua$2.ReactCurrentBatchConfig, dd$1 = true;
function ed$1(a2, b2, c2, d2) {
  var e2 = C$1, f2 = cd$1.transition;
  cd$1.transition = null;
  try {
    C$1 = 1, fd$1(a2, b2, c2, d2);
  } finally {
    C$1 = e2, cd$1.transition = f2;
  }
}
function gd$1(a2, b2, c2, d2) {
  var e2 = C$1, f2 = cd$1.transition;
  cd$1.transition = null;
  try {
    C$1 = 4, fd$1(a2, b2, c2, d2);
  } finally {
    C$1 = e2, cd$1.transition = f2;
  }
}
function fd$1(a2, b2, c2, d2) {
  if (dd$1) {
    var e2 = Yc$1(a2, b2, c2, d2);
    if (null === e2)
      hd$1(a2, b2, d2, id$3, c2), Sc$1(a2, d2);
    else if (Uc$1(e2, a2, b2, c2, d2))
      d2.stopPropagation();
    else if (Sc$1(a2, d2), b2 & 4 && -1 < Rc$1.indexOf(a2)) {
      for (; null !== e2; ) {
        var f2 = Cb$2(e2);
        null !== f2 && Ec$1(f2);
        f2 = Yc$1(a2, b2, c2, d2);
        null === f2 && hd$1(a2, b2, d2, id$3, c2);
        if (f2 === e2)
          break;
        e2 = f2;
      }
      null !== e2 && d2.stopPropagation();
    } else
      hd$1(a2, b2, d2, null, c2);
  }
}
var id$3 = null;
function Yc$1(a2, b2, c2, d2) {
  id$3 = null;
  a2 = xb$2(d2);
  a2 = Wc$1(a2);
  if (null !== a2)
    if (b2 = Vb$1(a2), null === b2)
      a2 = null;
    else if (c2 = b2.tag, 13 === c2) {
      a2 = Wb$1(b2);
      if (null !== a2)
        return a2;
      a2 = null;
    } else if (3 === c2) {
      if (b2.stateNode.current.memoizedState.isDehydrated)
        return 3 === b2.tag ? b2.stateNode.containerInfo : null;
      a2 = null;
    } else
      b2 !== a2 && (a2 = null);
  id$3 = a2;
  return null;
}
function jd$1(a2) {
  switch (a2) {
    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 = null;
function nd() {
  if (md)
    return md;
  var a2, b2 = ld$1, c2 = b2.length, d2, e2 = "value" in kd$1 ? kd$1.value : kd$1.textContent, f2 = e2.length;
  for (a2 = 0; a2 < c2 && b2[a2] === e2[a2]; a2++)
    ;
  var g2 = c2 - a2;
  for (d2 = 1; d2 <= g2 && b2[c2 - d2] === e2[f2 - d2]; d2++)
    ;
  return md = e2.slice(a2, 1 < d2 ? 1 - d2 : void 0);
}
function od(a2) {
  var b2 = a2.keyCode;
  "charCode" in a2 ? (a2 = a2.charCode, 0 === a2 && 13 === b2 && (a2 = 13)) : a2 = b2;
  10 === a2 && (a2 = 13);
  return 32 <= a2 || 13 === a2 ? a2 : 0;
}
function pd() {
  return true;
}
function qd() {
  return false;
}
function rd(a2) {
  function b2(b3, d2, e2, f2, g2) {
    this._reactName = b3;
    this._targetInst = e2;
    this.type = d2;
    this.nativeEvent = f2;
    this.target = g2;
    this.currentTarget = null;
    for (var c2 in a2)
      a2.hasOwnProperty(c2) && (b3 = a2[c2], this[c2] = b3 ? b3(f2) : f2[c2]);
    this.isDefaultPrevented = (null != f2.defaultPrevented ? f2.defaultPrevented : false === f2.returnValue) ? pd : qd;
    this.isPropagationStopped = qd;
    return this;
  }
  A$4(b2.prototype, { preventDefault: function() {
    this.defaultPrevented = true;
    var a3 = this.nativeEvent;
    a3 && (a3.preventDefault ? a3.preventDefault() : "unknown" !== typeof a3.returnValue && (a3.returnValue = false), this.isDefaultPrevented = pd);
  }, stopPropagation: function() {
    var a3 = this.nativeEvent;
    a3 && (a3.stopPropagation ? a3.stopPropagation() : "unknown" !== typeof a3.cancelBubble && (a3.cancelBubble = true), this.isPropagationStopped = pd);
  }, persist: function() {
  }, isPersistent: pd });
  return b2;
}
var sd = { eventPhase: 0, bubbles: 0, cancelable: 0, timeStamp: function(a2) {
  return a2.timeStamp || Date.now();
}, defaultPrevented: 0, isTrusted: 0 }, td = rd(sd), ud = A$4({}, sd, { view: 0, detail: 0 }), vd = rd(ud), wd, xd, yd, Ad = A$4({}, ud, { screenX: 0, screenY: 0, clientX: 0, clientY: 0, pageX: 0, pageY: 0, ctrlKey: 0, shiftKey: 0, altKey: 0, metaKey: 0, getModifierState: zd, button: 0, buttons: 0, relatedTarget: function(a2) {
  return void 0 === a2.relatedTarget ? a2.fromElement === a2.srcElement ? a2.toElement : a2.fromElement : a2.relatedTarget;
}, movementX: function(a2) {
  if ("movementX" in a2)
    return a2.movementX;
  a2 !== yd && (yd && "mousemove" === a2.type ? (wd = a2.screenX - yd.screenX, xd = a2.screenY - yd.screenY) : xd = wd = 0, yd = a2);
  return wd;
}, movementY: function(a2) {
  return "movementY" in a2 ? a2.movementY : xd;
} }), Bd = rd(Ad), Cd = A$4({}, Ad, { dataTransfer: 0 }), Dd = rd(Cd), Ed = A$4({}, ud, { relatedTarget: 0 }), Fd = rd(Ed), Gd = A$4({}, sd, { animationName: 0, elapsedTime: 0, pseudoElement: 0 }), Hd = rd(Gd), Id = A$4({}, sd, { clipboardData: function(a2) {
  return "clipboardData" in a2 ? a2.clipboardData : window.clipboardData;
} }), Jd = rd(Id), Kd = A$4({}, sd, { data: 0 }), Ld = rd(Kd), Md = {
  Esc: "Escape",
  Spacebar: " ",
  Left: "ArrowLeft",
  Up: "ArrowUp",
  Right: "ArrowRight",
  Down: "ArrowDown",
  Del: "Delete",
  Win: "OS",
  Menu: "ContextMenu",
  Apps: "ContextMenu",
  Scroll: "ScrollLock",
  MozPrintableKey: "Unidentified"
}, Nd = {
  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 = { Alt: "altKey", Control: "ctrlKey", Meta: "metaKey", Shift: "shiftKey" };
function Pd(a2) {
  var b2 = this.nativeEvent;
  return b2.getModifierState ? b2.getModifierState(a2) : (a2 = Od[a2]) ? !!b2[a2] : false;
}
function zd() {
  return Pd;
}
var Qd = A$4({}, ud, { key: function(a2) {
  if (a2.key) {
    var b2 = Md[a2.key] || a2.key;
    if ("Unidentified" !== b2)
      return b2;
  }
  return "keypress" === a2.type ? (a2 = od(a2), 13 === a2 ? "Enter" : String.fromCharCode(a2)) : "keydown" === a2.type || "keyup" === a2.type ? Nd[a2.keyCode] || "Unidentified" : "";
}, code: 0, location: 0, ctrlKey: 0, shiftKey: 0, altKey: 0, metaKey: 0, repeat: 0, locale: 0, getModifierState: zd, charCode: function(a2) {
  return "keypress" === a2.type ? od(a2) : 0;
}, keyCode: function(a2) {
  return "keydown" === a2.type || "keyup" === a2.type ? a2.keyCode : 0;
}, which: function(a2) {
  return "keypress" === a2.type ? od(a2) : "keydown" === a2.type || "keyup" === a2.type ? a2.keyCode : 0;
} }), Rd = rd(Qd), Sd = A$4({}, Ad, { pointerId: 0, width: 0, height: 0, pressure: 0, tangentialPressure: 0, tiltX: 0, tiltY: 0, twist: 0, pointerType: 0, isPrimary: 0 }), Td = rd(Sd), Ud = A$4({}, ud, { touches: 0, targetTouches: 0, changedTouches: 0, altKey: 0, metaKey: 0, ctrlKey: 0, shiftKey: 0, getModifierState: zd }), Vd = rd(Ud), Wd = A$4({}, sd, { propertyName: 0, elapsedTime: 0, pseudoElement: 0 }), Xd = rd(Wd), Yd = A$4({}, Ad, {
  deltaX: function(a2) {
    return "deltaX" in a2 ? a2.deltaX : "wheelDeltaX" in a2 ? -a2.wheelDeltaX : 0;
  },
  deltaY: function(a2) {
    return "deltaY" in a2 ? a2.deltaY : "wheelDeltaY" in a2 ? -a2.wheelDeltaY : "wheelDelta" in a2 ? -a2.wheelDelta : 0;
  },
  deltaZ: 0,
  deltaMode: 0
}), Zd = rd(Yd), $d = [9, 13, 27, 32], ae = ia$2 && "CompositionEvent" in window, be$1 = null;
ia$2 && "documentMode" in document && (be$1 = document.documentMode);
var ce$1 = ia$2 && "TextEvent" in window && !be$1, de$1 = ia$2 && (!ae || be$1 && 8 < be$1 && 11 >= be$1), ee = String.fromCharCode(32), fe$1 = false;
function ge$1(a2, b2) {
  switch (a2) {
    case "keyup":
      return -1 !== $d.indexOf(b2.keyCode);
    case "keydown":
      return 229 !== b2.keyCode;
    case "keypress":
    case "mousedown":
    case "focusout":
      return true;
    default:
      return false;
  }
}
function he$1(a2) {
  a2 = a2.detail;
  return "object" === typeof a2 && "data" in a2 ? a2.data : null;
}
var ie$1 = false;
function je(a2, b2) {
  switch (a2) {
    case "compositionend":
      return he$1(b2);
    case "keypress":
      if (32 !== b2.which)
        return null;
      fe$1 = true;
      return ee;
    case "textInput":
      return a2 = b2.data, a2 === ee && fe$1 ? null : a2;
    default:
      return null;
  }
}
function ke(a2, b2) {
  if (ie$1)
    return "compositionend" === a2 || !ae && ge$1(a2, b2) ? (a2 = nd(), md = ld$1 = kd$1 = null, ie$1 = false, a2) : null;
  switch (a2) {
    case "paste":
      return null;
    case "keypress":
      if (!(b2.ctrlKey || b2.altKey || b2.metaKey) || b2.ctrlKey && b2.altKey) {
        if (b2.char && 1 < b2.char.length)
          return b2.char;
        if (b2.which)
          return String.fromCharCode(b2.which);
      }
      return null;
    case "compositionend":
      return de$1 && "ko" !== b2.locale ? null : b2.data;
    default:
      return null;
  }
}
var le$1 = { color: true, date: true, datetime: true, "datetime-local": true, email: true, month: true, number: true, password: true, range: true, search: true, tel: true, text: true, time: true, url: true, week: true };
function me(a2) {
  var b2 = a2 && a2.nodeName && a2.nodeName.toLowerCase();
  return "input" === b2 ? !!le$1[a2.type] : "textarea" === b2 ? true : false;
}
function ne$1(a2, b2, c2, d2) {
  Eb$2(d2);
  b2 = oe$1(b2, "onChange");
  0 < b2.length && (c2 = new td("onChange", "change", null, c2, d2), a2.push({ event: c2, listeners: b2 }));
}
var pe$1 = null, qe = null;
function re$2(a2) {
  se$1(a2, 0);
}
function te(a2) {
  var b2 = ue$1(a2);
  if (Wa$2(b2))
    return a2;
}
function ve(a2, b2) {
  if ("change" === a2)
    return b2;
}
var we = false;
if (ia$2) {
  var xe$1;
  if (ia$2) {
    var ye$1 = "oninput" in document;
    if (!ye$1) {
      var ze = document.createElement("div");
      ze.setAttribute("oninput", "return;");
      ye$1 = "function" === typeof ze.oninput;
    }
    xe$1 = ye$1;
  } else
    xe$1 = false;
  we = xe$1 && (!document.documentMode || 9 < document.documentMode);
}
function Ae$1() {
  pe$1 && (pe$1.detachEvent("onpropertychange", Be), qe = pe$1 = null);
}
function Be(a2) {
  if ("value" === a2.propertyName && te(qe)) {
    var b2 = [];
    ne$1(b2, qe, a2, xb$2(a2));
    Jb$2(re$2, b2);
  }
}
function Ce(a2, b2, c2) {
  "focusin" === a2 ? (Ae$1(), pe$1 = b2, qe = c2, pe$1.attachEvent("onpropertychange", Be)) : "focusout" === a2 && Ae$1();
}
function De(a2) {
  if ("selectionchange" === a2 || "keyup" === a2 || "keydown" === a2)
    return te(qe);
}
function Ee(a2, b2) {
  if ("click" === a2)
    return te(b2);
}
function Fe(a2, b2) {
  if ("input" === a2 || "change" === a2)
    return te(b2);
}
function Ge(a2, b2) {
  return a2 === b2 && (0 !== a2 || 1 / a2 === 1 / b2) || a2 !== a2 && b2 !== b2;
}
var He = "function" === typeof Object.is ? Object.is : Ge;
function Ie(a2, b2) {
  if (He(a2, b2))
    return true;
  if ("object" !== typeof a2 || null === a2 || "object" !== typeof b2 || null === b2)
    return false;
  var c2 = Object.keys(a2), d2 = Object.keys(b2);
  if (c2.length !== d2.length)
    return false;
  for (d2 = 0; d2 < c2.length; d2++) {
    var e2 = c2[d2];
    if (!ja$2.call(b2, e2) || !He(a2[e2], b2[e2]))
      return false;
  }
  return true;
}
function Je(a2) {
  for (; a2 && a2.firstChild; )
    a2 = a2.firstChild;
  return a2;
}
function Ke(a2, b2) {
  var c2 = Je(a2);
  a2 = 0;
  for (var d2; c2; ) {
    if (3 === c2.nodeType) {
      d2 = a2 + c2.textContent.length;
      if (a2 <= b2 && d2 >= b2)
        return { node: c2, offset: b2 - a2 };
      a2 = d2;
    }
    a: {
      for (; c2; ) {
        if (c2.nextSibling) {
          c2 = c2.nextSibling;
          break a;
        }
        c2 = c2.parentNode;
      }
      c2 = void 0;
    }
    c2 = Je(c2);
  }
}
function Le(a2, b2) {
  return a2 && b2 ? a2 === b2 ? true : a2 && 3 === a2.nodeType ? false : b2 && 3 === b2.nodeType ? Le(a2, b2.parentNode) : "contains" in a2 ? a2.contains(b2) : a2.compareDocumentPosition ? !!(a2.compareDocumentPosition(b2) & 16) : false : false;
}
function Me() {
  for (var a2 = window, b2 = Xa$2(); b2 instanceof a2.HTMLIFrameElement; ) {
    try {
      var c2 = "string" === typeof b2.contentWindow.location.href;
    } catch (d2) {
      c2 = false;
    }
    if (c2)
      a2 = b2.contentWindow;
    else
      break;
    b2 = Xa$2(a2.document);
  }
  return b2;
}
function Ne(a2) {
  var b2 = a2 && a2.nodeName && a2.nodeName.toLowerCase();
  return b2 && ("input" === b2 && ("text" === a2.type || "search" === a2.type || "tel" === a2.type || "url" === a2.type || "password" === a2.type) || "textarea" === b2 || "true" === a2.contentEditable);
}
function Oe(a2) {
  var b2 = Me(), c2 = a2.focusedElem, d2 = a2.selectionRange;
  if (b2 !== c2 && c2 && c2.ownerDocument && Le(c2.ownerDocument.documentElement, c2)) {
    if (null !== d2 && Ne(c2)) {
      if (b2 = d2.start, a2 = d2.end, void 0 === a2 && (a2 = b2), "selectionStart" in c2)
        c2.selectionStart = b2, c2.selectionEnd = Math.min(a2, c2.value.length);
      else if (a2 = (b2 = c2.ownerDocument || document) && b2.defaultView || window, a2.getSelection) {
        a2 = a2.getSelection();
        var e2 = c2.textContent.length, f2 = Math.min(d2.start, e2);
        d2 = void 0 === d2.end ? f2 : Math.min(d2.end, e2);
        !a2.extend && f2 > d2 && (e2 = d2, d2 = f2, f2 = e2);
        e2 = Ke(c2, f2);
        var g2 = Ke(
          c2,
          d2
        );
        e2 && g2 && (1 !== a2.rangeCount || a2.anchorNode !== e2.node || a2.anchorOffset !== e2.offset || a2.focusNode !== g2.node || a2.focusOffset !== g2.offset) && (b2 = b2.createRange(), b2.setStart(e2.node, e2.offset), a2.removeAllRanges(), f2 > d2 ? (a2.addRange(b2), a2.extend(g2.node, g2.offset)) : (b2.setEnd(g2.node, g2.offset), a2.addRange(b2)));
      }
    }
    b2 = [];
    for (a2 = c2; a2 = a2.parentNode; )
      1 === a2.nodeType && b2.push({ element: a2, left: a2.scrollLeft, top: a2.scrollTop });
    "function" === typeof c2.focus && c2.focus();
    for (c2 = 0; c2 < b2.length; c2++)
      a2 = b2[c2], a2.element.scrollLeft = a2.left, a2.element.scrollTop = a2.top;
  }
}
var Pe = ia$2 && "documentMode" in document && 11 >= document.documentMode, Qe = null, Re = null, Se$1 = null, Te$1 = false;
function Ue(a2, b2, c2) {
  var d2 = c2.window === c2 ? c2.document : 9 === c2.nodeType ? c2 : c2.ownerDocument;
  Te$1 || null == Qe || Qe !== Xa$2(d2) || (d2 = Qe, "selectionStart" in d2 && Ne(d2) ? d2 = { start: d2.selectionStart, end: d2.selectionEnd } : (d2 = (d2.ownerDocument && d2.ownerDocument.defaultView || window).getSelection(), d2 = { anchorNode: d2.anchorNode, anchorOffset: d2.anchorOffset, focusNode: d2.focusNode, focusOffset: d2.focusOffset }), Se$1 && Ie(Se$1, d2) || (Se$1 = d2, d2 = oe$1(Re, "onSelect"), 0 < d2.length && (b2 = new td("onSelect", "select", null, b2, c2), a2.push({ event: b2, listeners: d2 }), b2.target = Qe)));
}
function Ve(a2, b2) {
  var c2 = {};
  c2[a2.toLowerCase()] = b2.toLowerCase();
  c2["Webkit" + a2] = "webkit" + b2;
  c2["Moz" + a2] = "moz" + b2;
  return c2;
}
var We = { animationend: Ve("Animation", "AnimationEnd"), animationiteration: Ve("Animation", "AnimationIteration"), animationstart: Ve("Animation", "AnimationStart"), transitionend: Ve("Transition", "TransitionEnd") }, Xe = {}, Ye = {};
ia$2 && (Ye = document.createElement("div").style, "AnimationEvent" in window || (delete We.animationend.animation, delete We.animationiteration.animation, delete We.animationstart.animation), "TransitionEvent" in window || delete We.transitionend.transition);
function Ze(a2) {
  if (Xe[a2])
    return Xe[a2];
  if (!We[a2])
    return a2;
  var b2 = We[a2], c2;
  for (c2 in b2)
    if (b2.hasOwnProperty(c2) && c2 in Ye)
      return Xe[a2] = b2[c2];
  return a2;
}
var $e = Ze("animationend"), af = Ze("animationiteration"), bf = Ze("animationstart"), cf = Ze("transitionend"), df = /* @__PURE__ */ new Map(), ef = "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(a2, b2) {
  df.set(a2, b2);
  fa$2(b2, [a2]);
}
for (var gf = 0; gf < ef.length; gf++) {
  var hf = ef[gf], jf = hf.toLowerCase(), kf = hf[0].toUpperCase() + hf.slice(1);
  ff(jf, "on" + kf);
}
ff($e, "onAnimationEnd");
ff(af, "onAnimationIteration");
ff(bf, "onAnimationStart");
ff("dblclick", "onDoubleClick");
ff("focusin", "onFocus");
ff("focusout", "onBlur");
ff(cf, "onTransitionEnd");
ha$2("onMouseEnter", ["mouseout", "mouseover"]);
ha$2("onMouseLeave", ["mouseout", "mouseover"]);
ha$2("onPointerEnter", ["pointerout", "pointerover"]);
ha$2("onPointerLeave", ["pointerout", "pointerover"]);
fa$2("onChange", "change click focusin focusout input keydown keyup selectionchange".split(" "));
fa$2("onSelect", "focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));
fa$2("onBeforeInput", ["compositionend", "keypress", "textInput", "paste"]);
fa$2("onCompositionEnd", "compositionend focusout keydown keypress keyup mousedown".split(" "));
fa$2("onCompositionStart", "compositionstart focusout keydown keypress keyup mousedown".split(" "));
fa$2("onCompositionUpdate", "compositionupdate focusout keydown keypress keyup mousedown".split(" "));
var lf = "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 = new Set("cancel close invalid load scroll toggle".split(" ").concat(lf));
function nf(a2, b2, c2) {
  var d2 = a2.type || "unknown-event";
  a2.currentTarget = c2;
  Ub$1(d2, b2, void 0, a2);
  a2.currentTarget = null;
}
function se$1(a2, b2) {
  b2 = 0 !== (b2 & 4);
  for (var c2 = 0; c2 < a2.length; c2++) {
    var d2 = a2[c2], e2 = d2.event;
    d2 = d2.listeners;
    a: {
      var f2 = void 0;
      if (b2)
        for (var g2 = d2.length - 1; 0 <= g2; g2--) {
          var h3 = d2[g2], k2 = h3.instance, l2 = h3.currentTarget;
          h3 = h3.listener;
          if (k2 !== f2 && e2.isPropagationStopped())
            break a;
          nf(e2, h3, l2);
          f2 = k2;
        }
      else
        for (g2 = 0; g2 < d2.length; g2++) {
          h3 = d2[g2];
          k2 = h3.instance;
          l2 = h3.currentTarget;
          h3 = h3.listener;
          if (k2 !== f2 && e2.isPropagationStopped())
            break a;
          nf(e2, h3, l2);
          f2 = k2;
        }
    }
  }
  if (Qb$2)
    throw a2 = Rb$2, Qb$2 = false, Rb$2 = null, a2;
}
function D$2(a2, b2) {
  var c2 = b2[of];
  void 0 === c2 && (c2 = b2[of] = /* @__PURE__ */ new Set());
  var d2 = a2 + "__bubble";
  c2.has(d2) || (pf(b2, a2, 2, false), c2.add(d2));
}
function qf(a2, b2, c2) {
  var d2 = 0;
  b2 && (d2 |= 4);
  pf(c2, a2, d2, b2);
}
var rf = "_reactListening" + Math.random().toString(36).slice(2);
function sf(a2) {
  if (!a2[rf]) {
    a2[rf] = true;
    da$1.forEach(function(b3) {
      "selectionchange" !== b3 && (mf.has(b3) || qf(b3, false, a2), qf(b3, true, a2));
    });
    var b2 = 9 === a2.nodeType ? a2 : a2.ownerDocument;
    null === b2 || b2[rf] || (b2[rf] = true, qf("selectionchange", false, b2));
  }
}
function pf(a2, b2, c2, d2) {
  switch (jd$1(b2)) {
    case 1:
      var e2 = ed$1;
      break;
    case 4:
      e2 = gd$1;
      break;
    default:
      e2 = fd$1;
  }
  c2 = e2.bind(null, b2, c2, a2);
  e2 = void 0;
  !Lb$2 || "touchstart" !== b2 && "touchmove" !== b2 && "wheel" !== b2 || (e2 = true);
  d2 ? void 0 !== e2 ? a2.addEventListener(b2, c2, { capture: true, passive: e2 }) : a2.addEventListener(b2, c2, true) : void 0 !== e2 ? a2.addEventListener(b2, c2, { passive: e2 }) : a2.addEventListener(b2, c2, false);
}
function hd$1(a2, b2, c2, d2, e2) {
  var f2 = d2;
  if (0 === (b2 & 1) && 0 === (b2 & 2) && null !== d2)
    a:
      for (; ; ) {
        if (null === d2)
          return;
        var g2 = d2.tag;
        if (3 === g2 || 4 === g2) {
          var h3 = d2.stateNode.containerInfo;
          if (h3 === e2 || 8 === h3.nodeType && h3.parentNode === e2)
            break;
          if (4 === g2)
            for (g2 = d2.return; null !== g2; ) {
              var k2 = g2.tag;
              if (3 === k2 || 4 === k2) {
                if (k2 = g2.stateNode.containerInfo, k2 === e2 || 8 === k2.nodeType && k2.parentNode === e2)
                  return;
              }
              g2 = g2.return;
            }
          for (; null !== h3; ) {
            g2 = Wc$1(h3);
            if (null === g2)
              return;
            k2 = g2.tag;
            if (5 === k2 || 6 === k2) {
              d2 = f2 = g2;
              continue a;
            }
            h3 = h3.parentNode;
          }
        }
        d2 = d2.return;
      }
  Jb$2(function() {
    var d3 = f2, e3 = xb$2(c2), g3 = [];
    a: {
      var h4 = df.get(a2);
      if (void 0 !== h4) {
        var k3 = td, n2 = a2;
        switch (a2) {
          case "keypress":
            if (0 === od(c2))
              break a;
          case "keydown":
          case "keyup":
            k3 = Rd;
            break;
          case "focusin":
            n2 = "focus";
            k3 = Fd;
            break;
          case "focusout":
            n2 = "blur";
            k3 = Fd;
            break;
          case "beforeblur":
          case "afterblur":
            k3 = Fd;
            break;
          case "click":
            if (2 === c2.button)
              break a;
          case "auxclick":
          case "dblclick":
          case "mousedown":
          case "mousemove":
          case "mouseup":
          case "mouseout":
          case "mouseover":
          case "contextmenu":
            k3 = Bd;
            break;
          case "drag":
          case "dragend":
          case "dragenter":
          case "dragexit":
          case "dragleave":
          case "dragover":
          case "dragstart":
          case "drop":
            k3 = Dd;
            break;
          case "touchcancel":
          case "touchend":
          case "touchmove":
          case "touchstart":
            k3 = Vd;
            break;
          case $e:
          case af:
          case bf:
            k3 = Hd;
            break;
          case cf:
            k3 = Xd;
            break;
          case "scroll":
            k3 = vd;
            break;
          case "wheel":
            k3 = Zd;
            break;
          case "copy":
          case "cut":
          case "paste":
            k3 = Jd;
            break;
          case "gotpointercapture":
          case "lostpointercapture":
          case "pointercancel":
          case "pointerdown":
          case "pointermove":
          case "pointerout":
          case "pointerover":
          case "pointerup":
            k3 = Td;
        }
        var t2 = 0 !== (b2 & 4), J2 = !t2 && "scroll" === a2, x2 = t2 ? null !== h4 ? h4 + "Capture" : null : h4;
        t2 = [];
        for (var w2 = d3, u2; null !== w2; ) {
          u2 = w2;
          var F2 = u2.stateNode;
          5 === u2.tag && null !== F2 && (u2 = F2, null !== x2 && (F2 = Kb$2(w2, x2), null != F2 && t2.push(tf(w2, F2, u2))));
          if (J2)
            break;
          w2 = w2.return;
        }
        0 < t2.length && (h4 = new k3(h4, n2, null, c2, e3), g3.push({ event: h4, listeners: t2 }));
      }
    }
    if (0 === (b2 & 7)) {
      a: {
        h4 = "mouseover" === a2 || "pointerover" === a2;
        k3 = "mouseout" === a2 || "pointerout" === a2;
        if (h4 && c2 !== wb$2 && (n2 = c2.relatedTarget || c2.fromElement) && (Wc$1(n2) || n2[uf]))
          break a;
        if (k3 || h4) {
          h4 = e3.window === e3 ? e3 : (h4 = e3.ownerDocument) ? h4.defaultView || h4.parentWindow : window;
          if (k3) {
            if (n2 = c2.relatedTarget || c2.toElement, k3 = d3, n2 = n2 ? Wc$1(n2) : null, null !== n2 && (J2 = Vb$1(n2), n2 !== J2 || 5 !== n2.tag && 6 !== n2.tag))
              n2 = null;
          } else
            k3 = null, n2 = d3;
          if (k3 !== n2) {
            t2 = Bd;
            F2 = "onMouseLeave";
            x2 = "onMouseEnter";
            w2 = "mouse";
            if ("pointerout" === a2 || "pointerover" === a2)
              t2 = Td, F2 = "onPointerLeave", x2 = "onPointerEnter", w2 = "pointer";
            J2 = null == k3 ? h4 : ue$1(k3);
            u2 = null == n2 ? h4 : ue$1(n2);
            h4 = new t2(F2, w2 + "leave", k3, c2, e3);
            h4.target = J2;
            h4.relatedTarget = u2;
            F2 = null;
            Wc$1(e3) === d3 && (t2 = new t2(x2, w2 + "enter", n2, c2, e3), t2.target = u2, t2.relatedTarget = J2, F2 = t2);
            J2 = F2;
            if (k3 && n2)
              b: {
                t2 = k3;
                x2 = n2;
                w2 = 0;
                for (u2 = t2; u2; u2 = vf(u2))
                  w2++;
                u2 = 0;
                for (F2 = x2; F2; F2 = vf(F2))
                  u2++;
                for (; 0 < w2 - u2; )
                  t2 = vf(t2), w2--;
                for (; 0 < u2 - w2; )
                  x2 = vf(x2), u2--;
                for (; w2--; ) {
                  if (t2 === x2 || null !== x2 && t2 === x2.alternate)
                    break b;
                  t2 = vf(t2);
                  x2 = vf(x2);
                }
                t2 = null;
              }
            else
              t2 = null;
            null !== k3 && wf(g3, h4, k3, t2, false);
            null !== n2 && null !== J2 && wf(g3, J2, n2, t2, true);
          }
        }
      }
      a: {
        h4 = d3 ? ue$1(d3) : window;
        k3 = h4.nodeName && h4.nodeName.toLowerCase();
        if ("select" === k3 || "input" === k3 && "file" === h4.type)
          var na2 = ve;
        else if (me(h4))
          if (we)
            na2 = Fe;
          else {
            na2 = De;
            var xa2 = Ce;
          }
        else
          (k3 = h4.nodeName) && "input" === k3.toLowerCase() && ("checkbox" === h4.type || "radio" === h4.type) && (na2 = Ee);
        if (na2 && (na2 = na2(a2, d3))) {
          ne$1(g3, na2, c2, e3);
          break a;
        }
        xa2 && xa2(a2, h4, d3);
        "focusout" === a2 && (xa2 = h4._wrapperState) && xa2.controlled && "number" === h4.type && cb$2(h4, "number", h4.value);
      }
      xa2 = d3 ? ue$1(d3) : window;
      switch (a2) {
        case "focusin":
          if (me(xa2) || "true" === xa2.contentEditable)
            Qe = xa2, Re = d3, Se$1 = null;
          break;
        case "focusout":
          Se$1 = Re = Qe = null;
          break;
        case "mousedown":
          Te$1 = true;
          break;
        case "contextmenu":
        case "mouseup":
        case "dragend":
          Te$1 = false;
          Ue(g3, c2, e3);
          break;
        case "selectionchange":
          if (Pe)
            break;
        case "keydown":
        case "keyup":
          Ue(g3, c2, e3);
      }
      var $a2;
      if (ae)
        b: {
          switch (a2) {
            case "compositionstart":
              var ba2 = "onCompositionStart";
              break b;
            case "compositionend":
              ba2 = "onCompositionEnd";
              break b;
            case "compositionupdate":
              ba2 = "onCompositionUpdate";
              break b;
          }
          ba2 = void 0;
        }
      else
        ie$1 ? ge$1(a2, c2) && (ba2 = "onCompositionEnd") : "keydown" === a2 && 229 === c2.keyCode && (ba2 = "onCompositionStart");
      ba2 && (de$1 && "ko" !== c2.locale && (ie$1 || "onCompositionStart" !== ba2 ? "onCompositionEnd" === ba2 && ie$1 && ($a2 = nd()) : (kd$1 = e3, ld$1 = "value" in kd$1 ? kd$1.value : kd$1.textContent, ie$1 = true)), xa2 = oe$1(d3, ba2), 0 < xa2.length && (ba2 = new Ld(ba2, a2, null, c2, e3), g3.push({ event: ba2, listeners: xa2 }), $a2 ? ba2.data = $a2 : ($a2 = he$1(c2), null !== $a2 && (ba2.data = $a2))));
      if ($a2 = ce$1 ? je(a2, c2) : ke(a2, c2))
        d3 = oe$1(d3, "onBeforeInput"), 0 < d3.length && (e3 = new Ld("onBeforeInput", "beforeinput", null, c2, e3), g3.push({ event: e3, listeners: d3 }), e3.data = $a2);
    }
    se$1(g3, b2);
  });
}
function tf(a2, b2, c2) {
  return { instance: a2, listener: b2, currentTarget: c2 };
}
function oe$1(a2, b2) {
  for (var c2 = b2 + "Capture", d2 = []; null !== a2; ) {
    var e2 = a2, f2 = e2.stateNode;
    5 === e2.tag && null !== f2 && (e2 = f2, f2 = Kb$2(a2, c2), null != f2 && d2.unshift(tf(a2, f2, e2)), f2 = Kb$2(a2, b2), null != f2 && d2.push(tf(a2, f2, e2)));
    a2 = a2.return;
  }
  return d2;
}
function vf(a2) {
  if (null === a2)
    return null;
  do
    a2 = a2.return;
  while (a2 && 5 !== a2.tag);
  return a2 ? a2 : null;
}
function wf(a2, b2, c2, d2, e2) {
  for (var f2 = b2._reactName, g2 = []; null !== c2 && c2 !== d2; ) {
    var h3 = c2, k2 = h3.alternate, l2 = h3.stateNode;
    if (null !== k2 && k2 === d2)
      break;
    5 === h3.tag && null !== l2 && (h3 = l2, e2 ? (k2 = Kb$2(c2, f2), null != k2 && g2.unshift(tf(c2, k2, h3))) : e2 || (k2 = Kb$2(c2, f2), null != k2 && g2.push(tf(c2, k2, h3))));
    c2 = c2.return;
  }
  0 !== g2.length && a2.push({ event: b2, listeners: g2 });
}
var xf = /\r\n?/g, yf = /\u0000|\uFFFD/g;
function zf(a2) {
  return ("string" === typeof a2 ? a2 : "" + a2).replace(xf, "\n").replace(yf, "");
}
function Af(a2, b2, c2) {
  b2 = zf(b2);
  if (zf(a2) !== b2 && c2)
    throw Error(p$7(425));
}
function Bf() {
}
var Cf = null, Df = null;
function Ef(a2, b2) {
  return "textarea" === a2 || "noscript" === a2 || "string" === typeof b2.children || "number" === typeof b2.children || "object" === typeof b2.dangerouslySetInnerHTML && null !== b2.dangerouslySetInnerHTML && null != b2.dangerouslySetInnerHTML.__html;
}
var Ff = "function" === typeof setTimeout ? setTimeout : void 0, Gf = "function" === typeof clearTimeout ? clearTimeout : void 0, Hf = "function" === typeof Promise ? Promise : void 0, Jf = "function" === typeof queueMicrotask ? queueMicrotask : "undefined" !== typeof Hf ? function(a2) {
  return Hf.resolve(null).then(a2).catch(If);
} : Ff;
function If(a2) {
  setTimeout(function() {
    throw a2;
  });
}
function Kf(a2, b2) {
  var c2 = b2, d2 = 0;
  do {
    var e2 = c2.nextSibling;
    a2.removeChild(c2);
    if (e2 && 8 === e2.nodeType)
      if (c2 = e2.data, "/$" === c2) {
        if (0 === d2) {
          a2.removeChild(e2);
          bd$1(b2);
          return;
        }
        d2--;
      } else
        "$" !== c2 && "$?" !== c2 && "$!" !== c2 || d2++;
    c2 = e2;
  } while (c2);
  bd$1(b2);
}
function Lf(a2) {
  for (; null != a2; a2 = a2.nextSibling) {
    var b2 = a2.nodeType;
    if (1 === b2 || 3 === b2)
      break;
    if (8 === b2) {
      b2 = a2.data;
      if ("$" === b2 || "$!" === b2 || "$?" === b2)
        break;
      if ("/$" === b2)
        return null;
    }
  }
  return a2;
}
function Mf(a2) {
  a2 = a2.previousSibling;
  for (var b2 = 0; a2; ) {
    if (8 === a2.nodeType) {
      var c2 = a2.data;
      if ("$" === c2 || "$!" === c2 || "$?" === c2) {
        if (0 === b2)
          return a2;
        b2--;
      } else
        "/$" === c2 && b2++;
    }
    a2 = a2.previousSibling;
  }
  return null;
}
var Nf = Math.random().toString(36).slice(2), Of = "__reactFiber$" + Nf, Pf = "__reactProps$" + Nf, uf = "__reactContainer$" + Nf, of = "__reactEvents$" + Nf, Qf = "__reactListeners$" + Nf, Rf = "__reactHandles$" + Nf;
function Wc$1(a2) {
  var b2 = a2[Of];
  if (b2)
    return b2;
  for (var c2 = a2.parentNode; c2; ) {
    if (b2 = c2[uf] || c2[Of]) {
      c2 = b2.alternate;
      if (null !== b2.child || null !== c2 && null !== c2.child)
        for (a2 = Mf(a2); null !== a2; ) {
          if (c2 = a2[Of])
            return c2;
          a2 = Mf(a2);
        }
      return b2;
    }
    a2 = c2;
    c2 = a2.parentNode;
  }
  return null;
}
function Cb$2(a2) {
  a2 = a2[Of] || a2[uf];
  return !a2 || 5 !== a2.tag && 6 !== a2.tag && 13 !== a2.tag && 3 !== a2.tag ? null : a2;
}
function ue$1(a2) {
  if (5 === a2.tag || 6 === a2.tag)
    return a2.stateNode;
  throw Error(p$7(33));
}
function Db$2(a2) {
  return a2[Pf] || null;
}
var Sf = [], Tf = -1;
function Uf(a2) {
  return { current: a2 };
}
function E$3(a2) {
  0 > Tf || (a2.current = Sf[Tf], Sf[Tf] = null, Tf--);
}
function G$2(a2, b2) {
  Tf++;
  Sf[Tf] = a2.current;
  a2.current = b2;
}
var Vf = {}, H$3 = Uf(Vf), Wf = Uf(false), Xf = Vf;
function Yf(a2, b2) {
  var c2 = a2.type.contextTypes;
  if (!c2)
    return Vf;
  var d2 = a2.stateNode;
  if (d2 && d2.__reactInternalMemoizedUnmaskedChildContext === b2)
    return d2.__reactInternalMemoizedMaskedChildContext;
  var e2 = {}, f2;
  for (f2 in c2)
    e2[f2] = b2[f2];
  d2 && (a2 = a2.stateNode, a2.__reactInternalMemoizedUnmaskedChildContext = b2, a2.__reactInternalMemoizedMaskedChildContext = e2);
  return e2;
}
function Zf(a2) {
  a2 = a2.childContextTypes;
  return null !== a2 && void 0 !== a2;
}
function $f() {
  E$3(Wf);
  E$3(H$3);
}
function ag(a2, b2, c2) {
  if (H$3.current !== Vf)
    throw Error(p$7(168));
  G$2(H$3, b2);
  G$2(Wf, c2);
}
function bg(a2, b2, c2) {
  var d2 = a2.stateNode;
  b2 = b2.childContextTypes;
  if ("function" !== typeof d2.getChildContext)
    return c2;
  d2 = d2.getChildContext();
  for (var e2 in d2)
    if (!(e2 in b2))
      throw Error(p$7(108, Ra$2(a2) || "Unknown", e2));
  return A$4({}, c2, d2);
}
function cg(a2) {
  a2 = (a2 = a2.stateNode) && a2.__reactInternalMemoizedMergedChildContext || Vf;
  Xf = H$3.current;
  G$2(H$3, a2);
  G$2(Wf, Wf.current);
  return true;
}
function dg(a2, b2, c2) {
  var d2 = a2.stateNode;
  if (!d2)
    throw Error(p$7(169));
  c2 ? (a2 = bg(a2, b2, Xf), d2.__reactInternalMemoizedMergedChildContext = a2, E$3(Wf), E$3(H$3), G$2(H$3, a2)) : E$3(Wf);
  G$2(Wf, c2);
}
var eg = null, fg = false, gg = false;
function hg(a2) {
  null === eg ? eg = [a2] : eg.push(a2);
}
function ig(a2) {
  fg = true;
  hg(a2);
}
function jg() {
  if (!gg && null !== eg) {
    gg = true;
    var a2 = 0, b2 = C$1;
    try {
      var c2 = eg;
      for (C$1 = 1; a2 < c2.length; a2++) {
        var d2 = c2[a2];
        do
          d2 = d2(true);
        while (null !== d2);
      }
      eg = null;
      fg = false;
    } catch (e2) {
      throw null !== eg && (eg = eg.slice(a2 + 1)), ac$1(fc$1, jg), e2;
    } finally {
      C$1 = b2, gg = false;
    }
  }
  return null;
}
var kg = [], lg = 0, mg = null, ng = 0, og = [], pg = 0, qg = null, rg = 1, sg = "";
function tg(a2, b2) {
  kg[lg++] = ng;
  kg[lg++] = mg;
  mg = a2;
  ng = b2;
}
function ug(a2, b2, c2) {
  og[pg++] = rg;
  og[pg++] = sg;
  og[pg++] = qg;
  qg = a2;
  var d2 = rg;
  a2 = sg;
  var e2 = 32 - oc$1(d2) - 1;
  d2 &= ~(1 << e2);
  c2 += 1;
  var f2 = 32 - oc$1(b2) + e2;
  if (30 < f2) {
    var g2 = e2 - e2 % 5;
    f2 = (d2 & (1 << g2) - 1).toString(32);
    d2 >>= g2;
    e2 -= g2;
    rg = 1 << 32 - oc$1(b2) + e2 | c2 << e2 | d2;
    sg = f2 + a2;
  } else
    rg = 1 << f2 | c2 << e2 | d2, sg = a2;
}
function vg(a2) {
  null !== a2.return && (tg(a2, 1), ug(a2, 1, 0));
}
function wg(a2) {
  for (; a2 === mg; )
    mg = kg[--lg], kg[lg] = null, ng = kg[--lg], kg[lg] = null;
  for (; a2 === qg; )
    qg = og[--pg], og[pg] = null, sg = og[--pg], og[pg] = null, rg = og[--pg], og[pg] = null;
}
var xg = null, yg = null, I$3 = false, zg = null;
function Ag(a2, b2) {
  var c2 = Bg(5, null, null, 0);
  c2.elementType = "DELETED";
  c2.stateNode = b2;
  c2.return = a2;
  b2 = a2.deletions;
  null === b2 ? (a2.deletions = [c2], a2.flags |= 16) : b2.push(c2);
}
function Cg(a2, b2) {
  switch (a2.tag) {
    case 5:
      var c2 = a2.type;
      b2 = 1 !== b2.nodeType || c2.toLowerCase() !== b2.nodeName.toLowerCase() ? null : b2;
      return null !== b2 ? (a2.stateNode = b2, xg = a2, yg = Lf(b2.firstChild), true) : false;
    case 6:
      return b2 = "" === a2.pendingProps || 3 !== b2.nodeType ? null : b2, null !== b2 ? (a2.stateNode = b2, xg = a2, yg = null, true) : false;
    case 13:
      return b2 = 8 !== b2.nodeType ? null : b2, null !== b2 ? (c2 = null !== qg ? { id: rg, overflow: sg } : null, a2.memoizedState = { dehydrated: b2, treeContext: c2, retryLane: 1073741824 }, c2 = Bg(18, null, null, 0), c2.stateNode = b2, c2.return = a2, a2.child = c2, xg = a2, yg = null, true) : false;
    default:
      return false;
  }
}
function Dg(a2) {
  return 0 !== (a2.mode & 1) && 0 === (a2.flags & 128);
}
function Eg(a2) {
  if (I$3) {
    var b2 = yg;
    if (b2) {
      var c2 = b2;
      if (!Cg(a2, b2)) {
        if (Dg(a2))
          throw Error(p$7(418));
        b2 = Lf(c2.nextSibling);
        var d2 = xg;
        b2 && Cg(a2, b2) ? Ag(d2, c2) : (a2.flags = a2.flags & -4097 | 2, I$3 = false, xg = a2);
      }
    } else {
      if (Dg(a2))
        throw Error(p$7(418));
      a2.flags = a2.flags & -4097 | 2;
      I$3 = false;
      xg = a2;
    }
  }
}
function Fg(a2) {
  for (a2 = a2.return; null !== a2 && 5 !== a2.tag && 3 !== a2.tag && 13 !== a2.tag; )
    a2 = a2.return;
  xg = a2;
}
function Gg(a2) {
  if (a2 !== xg)
    return false;
  if (!I$3)
    return Fg(a2), I$3 = true, false;
  var b2;
  (b2 = 3 !== a2.tag) && !(b2 = 5 !== a2.tag) && (b2 = a2.type, b2 = "head" !== b2 && "body" !== b2 && !Ef(a2.type, a2.memoizedProps));
  if (b2 && (b2 = yg)) {
    if (Dg(a2))
      throw Hg(), Error(p$7(418));
    for (; b2; )
      Ag(a2, b2), b2 = Lf(b2.nextSibling);
  }
  Fg(a2);
  if (13 === a2.tag) {
    a2 = a2.memoizedState;
    a2 = null !== a2 ? a2.dehydrated : null;
    if (!a2)
      throw Error(p$7(317));
    a: {
      a2 = a2.nextSibling;
      for (b2 = 0; a2; ) {
        if (8 === a2.nodeType) {
          var c2 = a2.data;
          if ("/$" === c2) {
            if (0 === b2) {
              yg = Lf(a2.nextSibling);
              break a;
            }
            b2--;
          } else
            "$" !== c2 && "$!" !== c2 && "$?" !== c2 || b2++;
        }
        a2 = a2.nextSibling;
      }
      yg = null;
    }
  } else
    yg = xg ? Lf(a2.stateNode.nextSibling) : null;
  return true;
}
function Hg() {
  for (var a2 = yg; a2; )
    a2 = Lf(a2.nextSibling);
}
function Ig() {
  yg = xg = null;
  I$3 = false;
}
function Jg(a2) {
  null === zg ? zg = [a2] : zg.push(a2);
}
var Kg = ua$2.ReactCurrentBatchConfig;
function Lg(a2, b2, c2) {
  a2 = c2.ref;
  if (null !== a2 && "function" !== typeof a2 && "object" !== typeof a2) {
    if (c2._owner) {
      c2 = c2._owner;
      if (c2) {
        if (1 !== c2.tag)
          throw Error(p$7(309));
        var d2 = c2.stateNode;
      }
      if (!d2)
        throw Error(p$7(147, a2));
      var e2 = d2, f2 = "" + a2;
      if (null !== b2 && null !== b2.ref && "function" === typeof b2.ref && b2.ref._stringRef === f2)
        return b2.ref;
      b2 = function(a3) {
        var b3 = e2.refs;
        null === a3 ? delete b3[f2] : b3[f2] = a3;
      };
      b2._stringRef = f2;
      return b2;
    }
    if ("string" !== typeof a2)
      throw Error(p$7(284));
    if (!c2._owner)
      throw Error(p$7(290, a2));
  }
  return a2;
}
function Mg(a2, b2) {
  a2 = Object.prototype.toString.call(b2);
  throw Error(p$7(31, "[object Object]" === a2 ? "object with keys {" + Object.keys(b2).join(", ") + "}" : a2));
}
function Ng(a2) {
  var b2 = a2._init;
  return b2(a2._payload);
}
function Og(a2) {
  function b2(b3, c3) {
    if (a2) {
      var d3 = b3.deletions;
      null === d3 ? (b3.deletions = [c3], b3.flags |= 16) : d3.push(c3);
    }
  }
  function c2(c3, d3) {
    if (!a2)
      return null;
    for (; null !== d3; )
      b2(c3, d3), d3 = d3.sibling;
    return null;
  }
  function d2(a3, b3) {
    for (a3 = /* @__PURE__ */ new Map(); null !== b3; )
      null !== b3.key ? a3.set(b3.key, b3) : a3.set(b3.index, b3), b3 = b3.sibling;
    return a3;
  }
  function e2(a3, b3) {
    a3 = Pg(a3, b3);
    a3.index = 0;
    a3.sibling = null;
    return a3;
  }
  function f2(b3, c3, d3) {
    b3.index = d3;
    if (!a2)
      return b3.flags |= 1048576, c3;
    d3 = b3.alternate;
    if (null !== d3)
      return d3 = d3.index, d3 < c3 ? (b3.flags |= 2, c3) : d3;
    b3.flags |= 2;
    return c3;
  }
  function g2(b3) {
    a2 && null === b3.alternate && (b3.flags |= 2);
    return b3;
  }
  function h3(a3, b3, c3, d3) {
    if (null === b3 || 6 !== b3.tag)
      return b3 = Qg(c3, a3.mode, d3), b3.return = a3, b3;
    b3 = e2(b3, c3);
    b3.return = a3;
    return b3;
  }
  function k2(a3, b3, c3, d3) {
    var f3 = c3.type;
    if (f3 === ya$2)
      return m2(a3, b3, c3.props.children, d3, c3.key);
    if (null !== b3 && (b3.elementType === f3 || "object" === typeof f3 && null !== f3 && f3.$$typeof === Ha$2 && Ng(f3) === b3.type))
      return d3 = e2(b3, c3.props), d3.ref = Lg(a3, b3, c3), d3.return = a3, d3;
    d3 = Rg(c3.type, c3.key, c3.props, null, a3.mode, d3);
    d3.ref = Lg(a3, b3, c3);
    d3.return = a3;
    return d3;
  }
  function l2(a3, b3, c3, d3) {
    if (null === b3 || 4 !== b3.tag || b3.stateNode.containerInfo !== c3.containerInfo || b3.stateNode.implementation !== c3.implementation)
      return b3 = Sg(c3, a3.mode, d3), b3.return = a3, b3;
    b3 = e2(b3, c3.children || []);
    b3.return = a3;
    return b3;
  }
  function m2(a3, b3, c3, d3, f3) {
    if (null === b3 || 7 !== b3.tag)
      return b3 = Tg(c3, a3.mode, d3, f3), b3.return = a3, b3;
    b3 = e2(b3, c3);
    b3.return = a3;
    return b3;
  }
  function q2(a3, b3, c3) {
    if ("string" === typeof b3 && "" !== b3 || "number" === typeof b3)
      return b3 = Qg("" + b3, a3.mode, c3), b3.return = a3, b3;
    if ("object" === typeof b3 && null !== b3) {
      switch (b3.$$typeof) {
        case va$2:
          return c3 = Rg(b3.type, b3.key, b3.props, null, a3.mode, c3), c3.ref = Lg(a3, null, b3), c3.return = a3, c3;
        case wa$2:
          return b3 = Sg(b3, a3.mode, c3), b3.return = a3, b3;
        case Ha$2:
          var d3 = b3._init;
          return q2(a3, d3(b3._payload), c3);
      }
      if (eb$2(b3) || Ka$2(b3))
        return b3 = Tg(b3, a3.mode, c3, null), b3.return = a3, b3;
      Mg(a3, b3);
    }
    return null;
  }
  function r2(a3, b3, c3, d3) {
    var e3 = null !== b3 ? b3.key : null;
    if ("string" === typeof c3 && "" !== c3 || "number" === typeof c3)
      return null !== e3 ? null : h3(a3, b3, "" + c3, d3);
    if ("object" === typeof c3 && null !== c3) {
      switch (c3.$$typeof) {
        case va$2:
          return c3.key === e3 ? k2(a3, b3, c3, d3) : null;
        case wa$2:
          return c3.key === e3 ? l2(a3, b3, c3, d3) : null;
        case Ha$2:
          return e3 = c3._init, r2(
            a3,
            b3,
            e3(c3._payload),
            d3
          );
      }
      if (eb$2(c3) || Ka$2(c3))
        return null !== e3 ? null : m2(a3, b3, c3, d3, null);
      Mg(a3, c3);
    }
    return null;
  }
  function y2(a3, b3, c3, d3, e3) {
    if ("string" === typeof d3 && "" !== d3 || "number" === typeof d3)
      return a3 = a3.get(c3) || null, h3(b3, a3, "" + d3, e3);
    if ("object" === typeof d3 && null !== d3) {
      switch (d3.$$typeof) {
        case va$2:
          return a3 = a3.get(null === d3.key ? c3 : d3.key) || null, k2(b3, a3, d3, e3);
        case wa$2:
          return a3 = a3.get(null === d3.key ? c3 : d3.key) || null, l2(b3, a3, d3, e3);
        case Ha$2:
          var f3 = d3._init;
          return y2(a3, b3, c3, f3(d3._payload), e3);
      }
      if (eb$2(d3) || Ka$2(d3))
        return a3 = a3.get(c3) || null, m2(b3, a3, d3, e3, null);
      Mg(b3, d3);
    }
    return null;
  }
  function n2(e3, g3, h4, k3) {
    for (var l3 = null, m3 = null, u2 = g3, w2 = g3 = 0, x2 = null; null !== u2 && w2 < h4.length; w2++) {
      u2.index > w2 ? (x2 = u2, u2 = null) : x2 = u2.sibling;
      var n3 = r2(e3, u2, h4[w2], k3);
      if (null === n3) {
        null === u2 && (u2 = x2);
        break;
      }
      a2 && u2 && null === n3.alternate && b2(e3, u2);
      g3 = f2(n3, g3, w2);
      null === m3 ? l3 = n3 : m3.sibling = n3;
      m3 = n3;
      u2 = x2;
    }
    if (w2 === h4.length)
      return c2(e3, u2), I$3 && tg(e3, w2), l3;
    if (null === u2) {
      for (; w2 < h4.length; w2++)
        u2 = q2(e3, h4[w2], k3), null !== u2 && (g3 = f2(u2, g3, w2), null === m3 ? l3 = u2 : m3.sibling = u2, m3 = u2);
      I$3 && tg(e3, w2);
      return l3;
    }
    for (u2 = d2(e3, u2); w2 < h4.length; w2++)
      x2 = y2(u2, e3, w2, h4[w2], k3), null !== x2 && (a2 && null !== x2.alternate && u2.delete(null === x2.key ? w2 : x2.key), g3 = f2(x2, g3, w2), null === m3 ? l3 = x2 : m3.sibling = x2, m3 = x2);
    a2 && u2.forEach(function(a3) {
      return b2(e3, a3);
    });
    I$3 && tg(e3, w2);
    return l3;
  }
  function t2(e3, g3, h4, k3) {
    var l3 = Ka$2(h4);
    if ("function" !== typeof l3)
      throw Error(p$7(150));
    h4 = l3.call(h4);
    if (null == h4)
      throw Error(p$7(151));
    for (var u2 = l3 = null, m3 = g3, w2 = g3 = 0, x2 = null, n3 = h4.next(); null !== m3 && !n3.done; w2++, n3 = h4.next()) {
      m3.index > w2 ? (x2 = m3, m3 = null) : x2 = m3.sibling;
      var t3 = r2(e3, m3, n3.value, k3);
      if (null === t3) {
        null === m3 && (m3 = x2);
        break;
      }
      a2 && m3 && null === t3.alternate && b2(e3, m3);
      g3 = f2(t3, g3, w2);
      null === u2 ? l3 = t3 : u2.sibling = t3;
      u2 = t3;
      m3 = x2;
    }
    if (n3.done)
      return c2(
        e3,
        m3
      ), I$3 && tg(e3, w2), l3;
    if (null === m3) {
      for (; !n3.done; w2++, n3 = h4.next())
        n3 = q2(e3, n3.value, k3), null !== n3 && (g3 = f2(n3, g3, w2), null === u2 ? l3 = n3 : u2.sibling = n3, u2 = n3);
      I$3 && tg(e3, w2);
      return l3;
    }
    for (m3 = d2(e3, m3); !n3.done; w2++, n3 = h4.next())
      n3 = y2(m3, e3, w2, n3.value, k3), null !== n3 && (a2 && null !== n3.alternate && m3.delete(null === n3.key ? w2 : n3.key), g3 = f2(n3, g3, w2), null === u2 ? l3 = n3 : u2.sibling = n3, u2 = n3);
    a2 && m3.forEach(function(a3) {
      return b2(e3, a3);
    });
    I$3 && tg(e3, w2);
    return l3;
  }
  function J2(a3, d3, f3, h4) {
    "object" === typeof f3 && null !== f3 && f3.type === ya$2 && null === f3.key && (f3 = f3.props.children);
    if ("object" === typeof f3 && null !== f3) {
      switch (f3.$$typeof) {
        case va$2:
          a: {
            for (var k3 = f3.key, l3 = d3; null !== l3; ) {
              if (l3.key === k3) {
                k3 = f3.type;
                if (k3 === ya$2) {
                  if (7 === l3.tag) {
                    c2(a3, l3.sibling);
                    d3 = e2(l3, f3.props.children);
                    d3.return = a3;
                    a3 = d3;
                    break a;
                  }
                } else if (l3.elementType === k3 || "object" === typeof k3 && null !== k3 && k3.$$typeof === Ha$2 && Ng(k3) === l3.type) {
                  c2(a3, l3.sibling);
                  d3 = e2(l3, f3.props);
                  d3.ref = Lg(a3, l3, f3);
                  d3.return = a3;
                  a3 = d3;
                  break a;
                }
                c2(a3, l3);
                break;
              } else
                b2(a3, l3);
              l3 = l3.sibling;
            }
            f3.type === ya$2 ? (d3 = Tg(f3.props.children, a3.mode, h4, f3.key), d3.return = a3, a3 = d3) : (h4 = Rg(f3.type, f3.key, f3.props, null, a3.mode, h4), h4.ref = Lg(a3, d3, f3), h4.return = a3, a3 = h4);
          }
          return g2(a3);
        case wa$2:
          a: {
            for (l3 = f3.key; null !== d3; ) {
              if (d3.key === l3)
                if (4 === d3.tag && d3.stateNode.containerInfo === f3.containerInfo && d3.stateNode.implementation === f3.implementation) {
                  c2(a3, d3.sibling);
                  d3 = e2(d3, f3.children || []);
                  d3.return = a3;
                  a3 = d3;
                  break a;
                } else {
                  c2(a3, d3);
                  break;
                }
              else
                b2(a3, d3);
              d3 = d3.sibling;
            }
            d3 = Sg(f3, a3.mode, h4);
            d3.return = a3;
            a3 = d3;
          }
          return g2(a3);
        case Ha$2:
          return l3 = f3._init, J2(a3, d3, l3(f3._payload), h4);
      }
      if (eb$2(f3))
        return n2(a3, d3, f3, h4);
      if (Ka$2(f3))
        return t2(a3, d3, f3, h4);
      Mg(a3, f3);
    }
    return "string" === typeof f3 && "" !== f3 || "number" === typeof f3 ? (f3 = "" + f3, null !== d3 && 6 === d3.tag ? (c2(a3, d3.sibling), d3 = e2(d3, f3), d3.return = a3, a3 = d3) : (c2(a3, d3), d3 = Qg(f3, a3.mode, h4), d3.return = a3, a3 = d3), g2(a3)) : c2(a3, d3);
  }
  return J2;
}
var Ug = Og(true), Vg = Og(false), Wg = Uf(null), Xg = null, Yg = null, Zg = null;
function $g() {
  Zg = Yg = Xg = null;
}
function ah(a2) {
  var b2 = Wg.current;
  E$3(Wg);
  a2._currentValue = b2;
}
function bh(a2, b2, c2) {
  for (; null !== a2; ) {
    var d2 = a2.alternate;
    (a2.childLanes & b2) !== b2 ? (a2.childLanes |= b2, null !== d2 && (d2.childLanes |= b2)) : null !== d2 && (d2.childLanes & b2) !== b2 && (d2.childLanes |= b2);
    if (a2 === c2)
      break;
    a2 = a2.return;
  }
}
function ch(a2, b2) {
  Xg = a2;
  Zg = Yg = null;
  a2 = a2.dependencies;
  null !== a2 && null !== a2.firstContext && (0 !== (a2.lanes & b2) && (dh = true), a2.firstContext = null);
}
function eh(a2) {
  var b2 = a2._currentValue;
  if (Zg !== a2)
    if (a2 = { context: a2, memoizedValue: b2, next: null }, null === Yg) {
      if (null === Xg)
        throw Error(p$7(308));
      Yg = a2;
      Xg.dependencies = { lanes: 0, firstContext: a2 };
    } else
      Yg = Yg.next = a2;
  return b2;
}
var fh = null;
function gh(a2) {
  null === fh ? fh = [a2] : fh.push(a2);
}
function hh(a2, b2, c2, d2) {
  var e2 = b2.interleaved;
  null === e2 ? (c2.next = c2, gh(b2)) : (c2.next = e2.next, e2.next = c2);
  b2.interleaved = c2;
  return ih(a2, d2);
}
function ih(a2, b2) {
  a2.lanes |= b2;
  var c2 = a2.alternate;
  null !== c2 && (c2.lanes |= b2);
  c2 = a2;
  for (a2 = a2.return; null !== a2; )
    a2.childLanes |= b2, c2 = a2.alternate, null !== c2 && (c2.childLanes |= b2), c2 = a2, a2 = a2.return;
  return 3 === c2.tag ? c2.stateNode : null;
}
var jh = false;
function kh(a2) {
  a2.updateQueue = { baseState: a2.memoizedState, firstBaseUpdate: null, lastBaseUpdate: null, shared: { pending: null, interleaved: null, lanes: 0 }, effects: null };
}
function lh(a2, b2) {
  a2 = a2.updateQueue;
  b2.updateQueue === a2 && (b2.updateQueue = { baseState: a2.baseState, firstBaseUpdate: a2.firstBaseUpdate, lastBaseUpdate: a2.lastBaseUpdate, shared: a2.shared, effects: a2.effects });
}
function mh(a2, b2) {
  return { eventTime: a2, lane: b2, tag: 0, payload: null, callback: null, next: null };
}
function nh(a2, b2, c2) {
  var d2 = a2.updateQueue;
  if (null === d2)
    return null;
  d2 = d2.shared;
  if (0 !== (K$2 & 2)) {
    var e2 = d2.pending;
    null === e2 ? b2.next = b2 : (b2.next = e2.next, e2.next = b2);
    d2.pending = b2;
    return ih(a2, c2);
  }
  e2 = d2.interleaved;
  null === e2 ? (b2.next = b2, gh(d2)) : (b2.next = e2.next, e2.next = b2);
  d2.interleaved = b2;
  return ih(a2, c2);
}
function oh(a2, b2, c2) {
  b2 = b2.updateQueue;
  if (null !== b2 && (b2 = b2.shared, 0 !== (c2 & 4194240))) {
    var d2 = b2.lanes;
    d2 &= a2.pendingLanes;
    c2 |= d2;
    b2.lanes = c2;
    Cc$1(a2, c2);
  }
}
function ph(a2, b2) {
  var c2 = a2.updateQueue, d2 = a2.alternate;
  if (null !== d2 && (d2 = d2.updateQueue, c2 === d2)) {
    var e2 = null, f2 = null;
    c2 = c2.firstBaseUpdate;
    if (null !== c2) {
      do {
        var g2 = { eventTime: c2.eventTime, lane: c2.lane, tag: c2.tag, payload: c2.payload, callback: c2.callback, next: null };
        null === f2 ? e2 = f2 = g2 : f2 = f2.next = g2;
        c2 = c2.next;
      } while (null !== c2);
      null === f2 ? e2 = f2 = b2 : f2 = f2.next = b2;
    } else
      e2 = f2 = b2;
    c2 = { baseState: d2.baseState, firstBaseUpdate: e2, lastBaseUpdate: f2, shared: d2.shared, effects: d2.effects };
    a2.updateQueue = c2;
    return;
  }
  a2 = c2.lastBaseUpdate;
  null === a2 ? c2.firstBaseUpdate = b2 : a2.next = b2;
  c2.lastBaseUpdate = b2;
}
function qh(a2, b2, c2, d2) {
  var e2 = a2.updateQueue;
  jh = false;
  var f2 = e2.firstBaseUpdate, g2 = e2.lastBaseUpdate, h3 = e2.shared.pending;
  if (null !== h3) {
    e2.shared.pending = null;
    var k2 = h3, l2 = k2.next;
    k2.next = null;
    null === g2 ? f2 = l2 : g2.next = l2;
    g2 = k2;
    var m2 = a2.alternate;
    null !== m2 && (m2 = m2.updateQueue, h3 = m2.lastBaseUpdate, h3 !== g2 && (null === h3 ? m2.firstBaseUpdate = l2 : h3.next = l2, m2.lastBaseUpdate = k2));
  }
  if (null !== f2) {
    var q2 = e2.baseState;
    g2 = 0;
    m2 = l2 = k2 = null;
    h3 = f2;
    do {
      var r2 = h3.lane, y2 = h3.eventTime;
      if ((d2 & r2) === r2) {
        null !== m2 && (m2 = m2.next = {
          eventTime: y2,
          lane: 0,
          tag: h3.tag,
          payload: h3.payload,
          callback: h3.callback,
          next: null
        });
        a: {
          var n2 = a2, t2 = h3;
          r2 = b2;
          y2 = c2;
          switch (t2.tag) {
            case 1:
              n2 = t2.payload;
              if ("function" === typeof n2) {
                q2 = n2.call(y2, q2, r2);
                break a;
              }
              q2 = n2;
              break a;
            case 3:
              n2.flags = n2.flags & -65537 | 128;
            case 0:
              n2 = t2.payload;
              r2 = "function" === typeof n2 ? n2.call(y2, q2, r2) : n2;
              if (null === r2 || void 0 === r2)
                break a;
              q2 = A$4({}, q2, r2);
              break a;
            case 2:
              jh = true;
          }
        }
        null !== h3.callback && 0 !== h3.lane && (a2.flags |= 64, r2 = e2.effects, null === r2 ? e2.effects = [h3] : r2.push(h3));
      } else
        y2 = { eventTime: y2, lane: r2, tag: h3.tag, payload: h3.payload, callback: h3.callback, next: null }, null === m2 ? (l2 = m2 = y2, k2 = q2) : m2 = m2.next = y2, g2 |= r2;
      h3 = h3.next;
      if (null === h3)
        if (h3 = e2.shared.pending, null === h3)
          break;
        else
          r2 = h3, h3 = r2.next, r2.next = null, e2.lastBaseUpdate = r2, e2.shared.pending = null;
    } while (1);
    null === m2 && (k2 = q2);
    e2.baseState = k2;
    e2.firstBaseUpdate = l2;
    e2.lastBaseUpdate = m2;
    b2 = e2.shared.interleaved;
    if (null !== b2) {
      e2 = b2;
      do
        g2 |= e2.lane, e2 = e2.next;
      while (e2 !== b2);
    } else
      null === f2 && (e2.shared.lanes = 0);
    rh |= g2;
    a2.lanes = g2;
    a2.memoizedState = q2;
  }
}
function sh(a2, b2, c2) {
  a2 = b2.effects;
  b2.effects = null;
  if (null !== a2)
    for (b2 = 0; b2 < a2.length; b2++) {
      var d2 = a2[b2], e2 = d2.callback;
      if (null !== e2) {
        d2.callback = null;
        d2 = c2;
        if ("function" !== typeof e2)
          throw Error(p$7(191, e2));
        e2.call(d2);
      }
    }
}
var th = {}, uh = Uf(th), vh$1 = Uf(th), wh = Uf(th);
function xh(a2) {
  if (a2 === th)
    throw Error(p$7(174));
  return a2;
}
function yh(a2, b2) {
  G$2(wh, b2);
  G$2(vh$1, a2);
  G$2(uh, th);
  a2 = b2.nodeType;
  switch (a2) {
    case 9:
    case 11:
      b2 = (b2 = b2.documentElement) ? b2.namespaceURI : lb$2(null, "");
      break;
    default:
      a2 = 8 === a2 ? b2.parentNode : b2, b2 = a2.namespaceURI || null, a2 = a2.tagName, b2 = lb$2(b2, a2);
  }
  E$3(uh);
  G$2(uh, b2);
}
function zh() {
  E$3(uh);
  E$3(vh$1);
  E$3(wh);
}
function Ah(a2) {
  xh(wh.current);
  var b2 = xh(uh.current);
  var c2 = lb$2(b2, a2.type);
  b2 !== c2 && (G$2(vh$1, a2), G$2(uh, c2));
}
function Bh(a2) {
  vh$1.current === a2 && (E$3(uh), E$3(vh$1));
}
var L$3 = Uf(0);
function Ch(a2) {
  for (var b2 = a2; null !== b2; ) {
    if (13 === b2.tag) {
      var c2 = b2.memoizedState;
      if (null !== c2 && (c2 = c2.dehydrated, null === c2 || "$?" === c2.data || "$!" === c2.data))
        return b2;
    } else if (19 === b2.tag && void 0 !== b2.memoizedProps.revealOrder) {
      if (0 !== (b2.flags & 128))
        return b2;
    } else if (null !== b2.child) {
      b2.child.return = b2;
      b2 = b2.child;
      continue;
    }
    if (b2 === a2)
      break;
    for (; null === b2.sibling; ) {
      if (null === b2.return || b2.return === a2)
        return null;
      b2 = b2.return;
    }
    b2.sibling.return = b2.return;
    b2 = b2.sibling;
  }
  return null;
}
var Dh = [];
function Eh() {
  for (var a2 = 0; a2 < Dh.length; a2++)
    Dh[a2]._workInProgressVersionPrimary = null;
  Dh.length = 0;
}
var Fh = ua$2.ReactCurrentDispatcher, Gh = ua$2.ReactCurrentBatchConfig, Hh = 0, M$5 = null, N$4 = null, O$3 = null, Ih = false, Jh = false, Kh = 0, Lh = 0;
function P$4() {
  throw Error(p$7(321));
}
function Mh(a2, b2) {
  if (null === b2)
    return false;
  for (var c2 = 0; c2 < b2.length && c2 < a2.length; c2++)
    if (!He(a2[c2], b2[c2]))
      return false;
  return true;
}
function Nh(a2, b2, c2, d2, e2, f2) {
  Hh = f2;
  M$5 = b2;
  b2.memoizedState = null;
  b2.updateQueue = null;
  b2.lanes = 0;
  Fh.current = null === a2 || null === a2.memoizedState ? Oh : Ph;
  a2 = c2(d2, e2);
  if (Jh) {
    f2 = 0;
    do {
      Jh = false;
      Kh = 0;
      if (25 <= f2)
        throw Error(p$7(301));
      f2 += 1;
      O$3 = N$4 = null;
      b2.updateQueue = null;
      Fh.current = Qh;
      a2 = c2(d2, e2);
    } while (Jh);
  }
  Fh.current = Rh;
  b2 = null !== N$4 && null !== N$4.next;
  Hh = 0;
  O$3 = N$4 = M$5 = null;
  Ih = false;
  if (b2)
    throw Error(p$7(300));
  return a2;
}
function Sh() {
  var a2 = 0 !== Kh;
  Kh = 0;
  return a2;
}
function Th() {
  var a2 = { memoizedState: null, baseState: null, baseQueue: null, queue: null, next: null };
  null === O$3 ? M$5.memoizedState = O$3 = a2 : O$3 = O$3.next = a2;
  return O$3;
}
function Uh() {
  if (null === N$4) {
    var a2 = M$5.alternate;
    a2 = null !== a2 ? a2.memoizedState : null;
  } else
    a2 = N$4.next;
  var b2 = null === O$3 ? M$5.memoizedState : O$3.next;
  if (null !== b2)
    O$3 = b2, N$4 = a2;
  else {
    if (null === a2)
      throw Error(p$7(310));
    N$4 = a2;
    a2 = { memoizedState: N$4.memoizedState, baseState: N$4.baseState, baseQueue: N$4.baseQueue, queue: N$4.queue, next: null };
    null === O$3 ? M$5.memoizedState = O$3 = a2 : O$3 = O$3.next = a2;
  }
  return O$3;
}
function Vh(a2, b2) {
  return "function" === typeof b2 ? b2(a2) : b2;
}
function Wh(a2) {
  var b2 = Uh(), c2 = b2.queue;
  if (null === c2)
    throw Error(p$7(311));
  c2.lastRenderedReducer = a2;
  var d2 = N$4, e2 = d2.baseQueue, f2 = c2.pending;
  if (null !== f2) {
    if (null !== e2) {
      var g2 = e2.next;
      e2.next = f2.next;
      f2.next = g2;
    }
    d2.baseQueue = e2 = f2;
    c2.pending = null;
  }
  if (null !== e2) {
    f2 = e2.next;
    d2 = d2.baseState;
    var h3 = g2 = null, k2 = null, l2 = f2;
    do {
      var m2 = l2.lane;
      if ((Hh & m2) === m2)
        null !== k2 && (k2 = k2.next = { lane: 0, action: l2.action, hasEagerState: l2.hasEagerState, eagerState: l2.eagerState, next: null }), d2 = l2.hasEagerState ? l2.eagerState : a2(d2, l2.action);
      else {
        var q2 = {
          lane: m2,
          action: l2.action,
          hasEagerState: l2.hasEagerState,
          eagerState: l2.eagerState,
          next: null
        };
        null === k2 ? (h3 = k2 = q2, g2 = d2) : k2 = k2.next = q2;
        M$5.lanes |= m2;
        rh |= m2;
      }
      l2 = l2.next;
    } while (null !== l2 && l2 !== f2);
    null === k2 ? g2 = d2 : k2.next = h3;
    He(d2, b2.memoizedState) || (dh = true);
    b2.memoizedState = d2;
    b2.baseState = g2;
    b2.baseQueue = k2;
    c2.lastRenderedState = d2;
  }
  a2 = c2.interleaved;
  if (null !== a2) {
    e2 = a2;
    do
      f2 = e2.lane, M$5.lanes |= f2, rh |= f2, e2 = e2.next;
    while (e2 !== a2);
  } else
    null === e2 && (c2.lanes = 0);
  return [b2.memoizedState, c2.dispatch];
}
function Xh(a2) {
  var b2 = Uh(), c2 = b2.queue;
  if (null === c2)
    throw Error(p$7(311));
  c2.lastRenderedReducer = a2;
  var d2 = c2.dispatch, e2 = c2.pending, f2 = b2.memoizedState;
  if (null !== e2) {
    c2.pending = null;
    var g2 = e2 = e2.next;
    do
      f2 = a2(f2, g2.action), g2 = g2.next;
    while (g2 !== e2);
    He(f2, b2.memoizedState) || (dh = true);
    b2.memoizedState = f2;
    null === b2.baseQueue && (b2.baseState = f2);
    c2.lastRenderedState = f2;
  }
  return [f2, d2];
}
function Yh() {
}
function Zh(a2, b2) {
  var c2 = M$5, d2 = Uh(), e2 = b2(), f2 = !He(d2.memoizedState, e2);
  f2 && (d2.memoizedState = e2, dh = true);
  d2 = d2.queue;
  $h(ai.bind(null, c2, d2, a2), [a2]);
  if (d2.getSnapshot !== b2 || f2 || null !== O$3 && O$3.memoizedState.tag & 1) {
    c2.flags |= 2048;
    bi(9, ci.bind(null, c2, d2, e2, b2), void 0, null);
    if (null === Q$3)
      throw Error(p$7(349));
    0 !== (Hh & 30) || di(c2, b2, e2);
  }
  return e2;
}
function di(a2, b2, c2) {
  a2.flags |= 16384;
  a2 = { getSnapshot: b2, value: c2 };
  b2 = M$5.updateQueue;
  null === b2 ? (b2 = { lastEffect: null, stores: null }, M$5.updateQueue = b2, b2.stores = [a2]) : (c2 = b2.stores, null === c2 ? b2.stores = [a2] : c2.push(a2));
}
function ci(a2, b2, c2, d2) {
  b2.value = c2;
  b2.getSnapshot = d2;
  ei(b2) && fi(a2);
}
function ai(a2, b2, c2) {
  return c2(function() {
    ei(b2) && fi(a2);
  });
}
function ei(a2) {
  var b2 = a2.getSnapshot;
  a2 = a2.value;
  try {
    var c2 = b2();
    return !He(a2, c2);
  } catch (d2) {
    return true;
  }
}
function fi(a2) {
  var b2 = ih(a2, 1);
  null !== b2 && gi(b2, a2, 1, -1);
}
function hi(a2) {
  var b2 = Th();
  "function" === typeof a2 && (a2 = a2());
  b2.memoizedState = b2.baseState = a2;
  a2 = { pending: null, interleaved: null, lanes: 0, dispatch: null, lastRenderedReducer: Vh, lastRenderedState: a2 };
  b2.queue = a2;
  a2 = a2.dispatch = ii.bind(null, M$5, a2);
  return [b2.memoizedState, a2];
}
function bi(a2, b2, c2, d2) {
  a2 = { tag: a2, create: b2, destroy: c2, deps: d2, next: null };
  b2 = M$5.updateQueue;
  null === b2 ? (b2 = { lastEffect: null, stores: null }, M$5.updateQueue = b2, b2.lastEffect = a2.next = a2) : (c2 = b2.lastEffect, null === c2 ? b2.lastEffect = a2.next = a2 : (d2 = c2.next, c2.next = a2, a2.next = d2, b2.lastEffect = a2));
  return a2;
}
function ji() {
  return Uh().memoizedState;
}
function ki(a2, b2, c2, d2) {
  var e2 = Th();
  M$5.flags |= a2;
  e2.memoizedState = bi(1 | b2, c2, void 0, void 0 === d2 ? null : d2);
}
function li(a2, b2, c2, d2) {
  var e2 = Uh();
  d2 = void 0 === d2 ? null : d2;
  var f2 = void 0;
  if (null !== N$4) {
    var g2 = N$4.memoizedState;
    f2 = g2.destroy;
    if (null !== d2 && Mh(d2, g2.deps)) {
      e2.memoizedState = bi(b2, c2, f2, d2);
      return;
    }
  }
  M$5.flags |= a2;
  e2.memoizedState = bi(1 | b2, c2, f2, d2);
}
function mi(a2, b2) {
  return ki(8390656, 8, a2, b2);
}
function $h(a2, b2) {
  return li(2048, 8, a2, b2);
}
function ni(a2, b2) {
  return li(4, 2, a2, b2);
}
function oi(a2, b2) {
  return li(4, 4, a2, b2);
}
function pi(a2, b2) {
  if ("function" === typeof b2)
    return a2 = a2(), b2(a2), function() {
      b2(null);
    };
  if (null !== b2 && void 0 !== b2)
    return a2 = a2(), b2.current = a2, function() {
      b2.current = null;
    };
}
function qi(a2, b2, c2) {
  c2 = null !== c2 && void 0 !== c2 ? c2.concat([a2]) : null;
  return li(4, 4, pi.bind(null, b2, a2), c2);
}
function ri() {
}
function si(a2, b2) {
  var c2 = Uh();
  b2 = void 0 === b2 ? null : b2;
  var d2 = c2.memoizedState;
  if (null !== d2 && null !== b2 && Mh(b2, d2[1]))
    return d2[0];
  c2.memoizedState = [a2, b2];
  return a2;
}
function ti(a2, b2) {
  var c2 = Uh();
  b2 = void 0 === b2 ? null : b2;
  var d2 = c2.memoizedState;
  if (null !== d2 && null !== b2 && Mh(b2, d2[1]))
    return d2[0];
  a2 = a2();
  c2.memoizedState = [a2, b2];
  return a2;
}
function ui(a2, b2, c2) {
  if (0 === (Hh & 21))
    return a2.baseState && (a2.baseState = false, dh = true), a2.memoizedState = c2;
  He(c2, b2) || (c2 = yc$1(), M$5.lanes |= c2, rh |= c2, a2.baseState = true);
  return b2;
}
function vi(a2, b2) {
  var c2 = C$1;
  C$1 = 0 !== c2 && 4 > c2 ? c2 : 4;
  a2(true);
  var d2 = Gh.transition;
  Gh.transition = {};
  try {
    a2(false), b2();
  } finally {
    C$1 = c2, Gh.transition = d2;
  }
}
function wi() {
  return Uh().memoizedState;
}
function xi(a2, b2, c2) {
  var d2 = yi(a2);
  c2 = { lane: d2, action: c2, hasEagerState: false, eagerState: null, next: null };
  if (zi(a2))
    Ai(b2, c2);
  else if (c2 = hh(a2, b2, c2, d2), null !== c2) {
    var e2 = R$4();
    gi(c2, a2, d2, e2);
    Bi(c2, b2, d2);
  }
}
function ii(a2, b2, c2) {
  var d2 = yi(a2), e2 = { lane: d2, action: c2, hasEagerState: false, eagerState: null, next: null };
  if (zi(a2))
    Ai(b2, e2);
  else {
    var f2 = a2.alternate;
    if (0 === a2.lanes && (null === f2 || 0 === f2.lanes) && (f2 = b2.lastRenderedReducer, null !== f2))
      try {
        var g2 = b2.lastRenderedState, h3 = f2(g2, c2);
        e2.hasEagerState = true;
        e2.eagerState = h3;
        if (He(h3, g2)) {
          var k2 = b2.interleaved;
          null === k2 ? (e2.next = e2, gh(b2)) : (e2.next = k2.next, k2.next = e2);
          b2.interleaved = e2;
          return;
        }
      } catch (l2) {
      } finally {
      }
    c2 = hh(a2, b2, e2, d2);
    null !== c2 && (e2 = R$4(), gi(c2, a2, d2, e2), Bi(c2, b2, d2));
  }
}
function zi(a2) {
  var b2 = a2.alternate;
  return a2 === M$5 || null !== b2 && b2 === M$5;
}
function Ai(a2, b2) {
  Jh = Ih = true;
  var c2 = a2.pending;
  null === c2 ? b2.next = b2 : (b2.next = c2.next, c2.next = b2);
  a2.pending = b2;
}
function Bi(a2, b2, c2) {
  if (0 !== (c2 & 4194240)) {
    var d2 = b2.lanes;
    d2 &= a2.pendingLanes;
    c2 |= d2;
    b2.lanes = c2;
    Cc$1(a2, c2);
  }
}
var Rh = { readContext: eh, useCallback: P$4, useContext: P$4, useEffect: P$4, useImperativeHandle: P$4, useInsertionEffect: P$4, useLayoutEffect: P$4, useMemo: P$4, useReducer: P$4, useRef: P$4, useState: P$4, useDebugValue: P$4, useDeferredValue: P$4, useTransition: P$4, useMutableSource: P$4, useSyncExternalStore: P$4, useId: P$4, unstable_isNewReconciler: false }, Oh = { readContext: eh, useCallback: function(a2, b2) {
  Th().memoizedState = [a2, void 0 === b2 ? null : b2];
  return a2;
}, useContext: eh, useEffect: mi, useImperativeHandle: function(a2, b2, c2) {
  c2 = null !== c2 && void 0 !== c2 ? c2.concat([a2]) : null;
  return ki(
    4194308,
    4,
    pi.bind(null, b2, a2),
    c2
  );
}, useLayoutEffect: function(a2, b2) {
  return ki(4194308, 4, a2, b2);
}, useInsertionEffect: function(a2, b2) {
  return ki(4, 2, a2, b2);
}, useMemo: function(a2, b2) {
  var c2 = Th();
  b2 = void 0 === b2 ? null : b2;
  a2 = a2();
  c2.memoizedState = [a2, b2];
  return a2;
}, useReducer: function(a2, b2, c2) {
  var d2 = Th();
  b2 = void 0 !== c2 ? c2(b2) : b2;
  d2.memoizedState = d2.baseState = b2;
  a2 = { pending: null, interleaved: null, lanes: 0, dispatch: null, lastRenderedReducer: a2, lastRenderedState: b2 };
  d2.queue = a2;
  a2 = a2.dispatch = xi.bind(null, M$5, a2);
  return [d2.memoizedState, a2];
}, useRef: function(a2) {
  var b2 = Th();
  a2 = { current: a2 };
  return b2.memoizedState = a2;
}, useState: hi, useDebugValue: ri, useDeferredValue: function(a2) {
  return Th().memoizedState = a2;
}, useTransition: function() {
  var a2 = hi(false), b2 = a2[0];
  a2 = vi.bind(null, a2[1]);
  Th().memoizedState = a2;
  return [b2, a2];
}, useMutableSource: function() {
}, useSyncExternalStore: function(a2, b2, c2) {
  var d2 = M$5, e2 = Th();
  if (I$3) {
    if (void 0 === c2)
      throw Error(p$7(407));
    c2 = c2();
  } else {
    c2 = b2();
    if (null === Q$3)
      throw Error(p$7(349));
    0 !== (Hh & 30) || di(d2, b2, c2);
  }
  e2.memoizedState = c2;
  var f2 = { value: c2, getSnapshot: b2 };
  e2.queue = f2;
  mi(ai.bind(
    null,
    d2,
    f2,
    a2
  ), [a2]);
  d2.flags |= 2048;
  bi(9, ci.bind(null, d2, f2, c2, b2), void 0, null);
  return c2;
}, useId: function() {
  var a2 = Th(), b2 = Q$3.identifierPrefix;
  if (I$3) {
    var c2 = sg;
    var d2 = rg;
    c2 = (d2 & ~(1 << 32 - oc$1(d2) - 1)).toString(32) + c2;
    b2 = ":" + b2 + "R" + c2;
    c2 = Kh++;
    0 < c2 && (b2 += "H" + c2.toString(32));
    b2 += ":";
  } else
    c2 = Lh++, b2 = ":" + b2 + "r" + c2.toString(32) + ":";
  return a2.memoizedState = b2;
}, unstable_isNewReconciler: false }, Ph = {
  readContext: eh,
  useCallback: si,
  useContext: eh,
  useEffect: $h,
  useImperativeHandle: qi,
  useInsertionEffect: ni,
  useLayoutEffect: oi,
  useMemo: ti,
  useReducer: Wh,
  useRef: ji,
  useState: function() {
    return Wh(Vh);
  },
  useDebugValue: ri,
  useDeferredValue: function(a2) {
    var b2 = Uh();
    return ui(b2, N$4.memoizedState, a2);
  },
  useTransition: function() {
    var a2 = Wh(Vh)[0], b2 = Uh().memoizedState;
    return [a2, b2];
  },
  useMutableSource: Yh,
  useSyncExternalStore: Zh,
  useId: wi,
  unstable_isNewReconciler: false
}, Qh = { readContext: eh, useCallback: si, useContext: eh, useEffect: $h, useImperativeHandle: qi, useInsertionEffect: ni, useLayoutEffect: oi, useMemo: ti, useReducer: Xh, useRef: ji, useState: function() {
  return Xh(Vh);
}, useDebugValue: ri, useDeferredValue: function(a2) {
  var b2 = Uh();
  return null === N$4 ? b2.memoizedState = a2 : ui(b2, N$4.memoizedState, a2);
}, useTransition: function() {
  var a2 = Xh(Vh)[0], b2 = Uh().memoizedState;
  return [a2, b2];
}, useMutableSource: Yh, useSyncExternalStore: Zh, useId: wi, unstable_isNewReconciler: false };
function Ci(a2, b2) {
  if (a2 && a2.defaultProps) {
    b2 = A$4({}, b2);
    a2 = a2.defaultProps;
    for (var c2 in a2)
      void 0 === b2[c2] && (b2[c2] = a2[c2]);
    return b2;
  }
  return b2;
}
function Di(a2, b2, c2, d2) {
  b2 = a2.memoizedState;
  c2 = c2(d2, b2);
  c2 = null === c2 || void 0 === c2 ? b2 : A$4({}, b2, c2);
  a2.memoizedState = c2;
  0 === a2.lanes && (a2.updateQueue.baseState = c2);
}
var Ei = { isMounted: function(a2) {
  return (a2 = a2._reactInternals) ? Vb$1(a2) === a2 : false;
}, enqueueSetState: function(a2, b2, c2) {
  a2 = a2._reactInternals;
  var d2 = R$4(), e2 = yi(a2), f2 = mh(d2, e2);
  f2.payload = b2;
  void 0 !== c2 && null !== c2 && (f2.callback = c2);
  b2 = nh(a2, f2, e2);
  null !== b2 && (gi(b2, a2, e2, d2), oh(b2, a2, e2));
}, enqueueReplaceState: function(a2, b2, c2) {
  a2 = a2._reactInternals;
  var d2 = R$4(), e2 = yi(a2), f2 = mh(d2, e2);
  f2.tag = 1;
  f2.payload = b2;
  void 0 !== c2 && null !== c2 && (f2.callback = c2);
  b2 = nh(a2, f2, e2);
  null !== b2 && (gi(b2, a2, e2, d2), oh(b2, a2, e2));
}, enqueueForceUpdate: function(a2, b2) {
  a2 = a2._reactInternals;
  var c2 = R$4(), d2 = yi(a2), e2 = mh(c2, d2);
  e2.tag = 2;
  void 0 !== b2 && null !== b2 && (e2.callback = b2);
  b2 = nh(a2, e2, d2);
  null !== b2 && (gi(b2, a2, d2, c2), oh(b2, a2, d2));
} };
function Fi(a2, b2, c2, d2, e2, f2, g2) {
  a2 = a2.stateNode;
  return "function" === typeof a2.shouldComponentUpdate ? a2.shouldComponentUpdate(d2, f2, g2) : b2.prototype && b2.prototype.isPureReactComponent ? !Ie(c2, d2) || !Ie(e2, f2) : true;
}
function Gi(a2, b2, c2) {
  var d2 = false, e2 = Vf;
  var f2 = b2.contextType;
  "object" === typeof f2 && null !== f2 ? f2 = eh(f2) : (e2 = Zf(b2) ? Xf : H$3.current, d2 = b2.contextTypes, f2 = (d2 = null !== d2 && void 0 !== d2) ? Yf(a2, e2) : Vf);
  b2 = new b2(c2, f2);
  a2.memoizedState = null !== b2.state && void 0 !== b2.state ? b2.state : null;
  b2.updater = Ei;
  a2.stateNode = b2;
  b2._reactInternals = a2;
  d2 && (a2 = a2.stateNode, a2.__reactInternalMemoizedUnmaskedChildContext = e2, a2.__reactInternalMemoizedMaskedChildContext = f2);
  return b2;
}
function Hi(a2, b2, c2, d2) {
  a2 = b2.state;
  "function" === typeof b2.componentWillReceiveProps && b2.componentWillReceiveProps(c2, d2);
  "function" === typeof b2.UNSAFE_componentWillReceiveProps && b2.UNSAFE_componentWillReceiveProps(c2, d2);
  b2.state !== a2 && Ei.enqueueReplaceState(b2, b2.state, null);
}
function Ii(a2, b2, c2, d2) {
  var e2 = a2.stateNode;
  e2.props = c2;
  e2.state = a2.memoizedState;
  e2.refs = {};
  kh(a2);
  var f2 = b2.contextType;
  "object" === typeof f2 && null !== f2 ? e2.context = eh(f2) : (f2 = Zf(b2) ? Xf : H$3.current, e2.context = Yf(a2, f2));
  e2.state = a2.memoizedState;
  f2 = b2.getDerivedStateFromProps;
  "function" === typeof f2 && (Di(a2, b2, f2, c2), e2.state = a2.memoizedState);
  "function" === typeof b2.getDerivedStateFromProps || "function" === typeof e2.getSnapshotBeforeUpdate || "function" !== typeof e2.UNSAFE_componentWillMount && "function" !== typeof e2.componentWillMount || (b2 = e2.state, "function" === typeof e2.componentWillMount && e2.componentWillMount(), "function" === typeof e2.UNSAFE_componentWillMount && e2.UNSAFE_componentWillMount(), b2 !== e2.state && Ei.enqueueReplaceState(e2, e2.state, null), qh(a2, c2, e2, d2), e2.state = a2.memoizedState);
  "function" === typeof e2.componentDidMount && (a2.flags |= 4194308);
}
function Ji(a2, b2) {
  try {
    var c2 = "", d2 = b2;
    do
      c2 += Pa$2(d2), d2 = d2.return;
    while (d2);
    var e2 = c2;
  } catch (f2) {
    e2 = "\nError generating stack: " + f2.message + "\n" + f2.stack;
  }
  return { value: a2, source: b2, stack: e2, digest: null };
}
function Ki(a2, b2, c2) {
  return { value: a2, source: null, stack: null != c2 ? c2 : null, digest: null != b2 ? b2 : null };
}
function Li(a2, b2) {
  try {
    console.error(b2.value);
  } catch (c2) {
    setTimeout(function() {
      throw c2;
    });
  }
}
var Mi = "function" === typeof WeakMap ? WeakMap : Map;
function Ni(a2, b2, c2) {
  c2 = mh(-1, c2);
  c2.tag = 3;
  c2.payload = { element: null };
  var d2 = b2.value;
  c2.callback = function() {
    Oi || (Oi = true, Pi = d2);
    Li(a2, b2);
  };
  return c2;
}
function Qi(a2, b2, c2) {
  c2 = mh(-1, c2);
  c2.tag = 3;
  var d2 = a2.type.getDerivedStateFromError;
  if ("function" === typeof d2) {
    var e2 = b2.value;
    c2.payload = function() {
      return d2(e2);
    };
    c2.callback = function() {
      Li(a2, b2);
    };
  }
  var f2 = a2.stateNode;
  null !== f2 && "function" === typeof f2.componentDidCatch && (c2.callback = function() {
    Li(a2, b2);
    "function" !== typeof d2 && (null === Ri ? Ri = /* @__PURE__ */ new Set([this]) : Ri.add(this));
    var c3 = b2.stack;
    this.componentDidCatch(b2.value, { componentStack: null !== c3 ? c3 : "" });
  });
  return c2;
}
function Si(a2, b2, c2) {
  var d2 = a2.pingCache;
  if (null === d2) {
    d2 = a2.pingCache = new Mi();
    var e2 = /* @__PURE__ */ new Set();
    d2.set(b2, e2);
  } else
    e2 = d2.get(b2), void 0 === e2 && (e2 = /* @__PURE__ */ new Set(), d2.set(b2, e2));
  e2.has(c2) || (e2.add(c2), a2 = Ti.bind(null, a2, b2, c2), b2.then(a2, a2));
}
function Ui(a2) {
  do {
    var b2;
    if (b2 = 13 === a2.tag)
      b2 = a2.memoizedState, b2 = null !== b2 ? null !== b2.dehydrated ? true : false : true;
    if (b2)
      return a2;
    a2 = a2.return;
  } while (null !== a2);
  return null;
}
function Vi(a2, b2, c2, d2, e2) {
  if (0 === (a2.mode & 1))
    return a2 === b2 ? a2.flags |= 65536 : (a2.flags |= 128, c2.flags |= 131072, c2.flags &= -52805, 1 === c2.tag && (null === c2.alternate ? c2.tag = 17 : (b2 = mh(-1, 1), b2.tag = 2, nh(c2, b2, 1))), c2.lanes |= 1), a2;
  a2.flags |= 65536;
  a2.lanes = e2;
  return a2;
}
var Wi = ua$2.ReactCurrentOwner, dh = false;
function Xi(a2, b2, c2, d2) {
  b2.child = null === a2 ? Vg(b2, null, c2, d2) : Ug(b2, a2.child, c2, d2);
}
function Yi(a2, b2, c2, d2, e2) {
  c2 = c2.render;
  var f2 = b2.ref;
  ch(b2, e2);
  d2 = Nh(a2, b2, c2, d2, f2, e2);
  c2 = Sh();
  if (null !== a2 && !dh)
    return b2.updateQueue = a2.updateQueue, b2.flags &= -2053, a2.lanes &= ~e2, Zi(a2, b2, e2);
  I$3 && c2 && vg(b2);
  b2.flags |= 1;
  Xi(a2, b2, d2, e2);
  return b2.child;
}
function $i(a2, b2, c2, d2, e2) {
  if (null === a2) {
    var f2 = c2.type;
    if ("function" === typeof f2 && !aj(f2) && void 0 === f2.defaultProps && null === c2.compare && void 0 === c2.defaultProps)
      return b2.tag = 15, b2.type = f2, bj(a2, b2, f2, d2, e2);
    a2 = Rg(c2.type, null, d2, b2, b2.mode, e2);
    a2.ref = b2.ref;
    a2.return = b2;
    return b2.child = a2;
  }
  f2 = a2.child;
  if (0 === (a2.lanes & e2)) {
    var g2 = f2.memoizedProps;
    c2 = c2.compare;
    c2 = null !== c2 ? c2 : Ie;
    if (c2(g2, d2) && a2.ref === b2.ref)
      return Zi(a2, b2, e2);
  }
  b2.flags |= 1;
  a2 = Pg(f2, d2);
  a2.ref = b2.ref;
  a2.return = b2;
  return b2.child = a2;
}
function bj(a2, b2, c2, d2, e2) {
  if (null !== a2) {
    var f2 = a2.memoizedProps;
    if (Ie(f2, d2) && a2.ref === b2.ref)
      if (dh = false, b2.pendingProps = d2 = f2, 0 !== (a2.lanes & e2))
        0 !== (a2.flags & 131072) && (dh = true);
      else
        return b2.lanes = a2.lanes, Zi(a2, b2, e2);
  }
  return cj(a2, b2, c2, d2, e2);
}
function dj(a2, b2, c2) {
  var d2 = b2.pendingProps, e2 = d2.children, f2 = null !== a2 ? a2.memoizedState : null;
  if ("hidden" === d2.mode)
    if (0 === (b2.mode & 1))
      b2.memoizedState = { baseLanes: 0, cachePool: null, transitions: null }, G$2(ej, fj), fj |= c2;
    else {
      if (0 === (c2 & 1073741824))
        return a2 = null !== f2 ? f2.baseLanes | c2 : c2, b2.lanes = b2.childLanes = 1073741824, b2.memoizedState = { baseLanes: a2, cachePool: null, transitions: null }, b2.updateQueue = null, G$2(ej, fj), fj |= a2, null;
      b2.memoizedState = { baseLanes: 0, cachePool: null, transitions: null };
      d2 = null !== f2 ? f2.baseLanes : c2;
      G$2(ej, fj);
      fj |= d2;
    }
  else
    null !== f2 ? (d2 = f2.baseLanes | c2, b2.memoizedState = null) : d2 = c2, G$2(ej, fj), fj |= d2;
  Xi(a2, b2, e2, c2);
  return b2.child;
}
function gj(a2, b2) {
  var c2 = b2.ref;
  if (null === a2 && null !== c2 || null !== a2 && a2.ref !== c2)
    b2.flags |= 512, b2.flags |= 2097152;
}
function cj(a2, b2, c2, d2, e2) {
  var f2 = Zf(c2) ? Xf : H$3.current;
  f2 = Yf(b2, f2);
  ch(b2, e2);
  c2 = Nh(a2, b2, c2, d2, f2, e2);
  d2 = Sh();
  if (null !== a2 && !dh)
    return b2.updateQueue = a2.updateQueue, b2.flags &= -2053, a2.lanes &= ~e2, Zi(a2, b2, e2);
  I$3 && d2 && vg(b2);
  b2.flags |= 1;
  Xi(a2, b2, c2, e2);
  return b2.child;
}
function hj(a2, b2, c2, d2, e2) {
  if (Zf(c2)) {
    var f2 = true;
    cg(b2);
  } else
    f2 = false;
  ch(b2, e2);
  if (null === b2.stateNode)
    ij(a2, b2), Gi(b2, c2, d2), Ii(b2, c2, d2, e2), d2 = true;
  else if (null === a2) {
    var g2 = b2.stateNode, h3 = b2.memoizedProps;
    g2.props = h3;
    var k2 = g2.context, l2 = c2.contextType;
    "object" === typeof l2 && null !== l2 ? l2 = eh(l2) : (l2 = Zf(c2) ? Xf : H$3.current, l2 = Yf(b2, l2));
    var m2 = c2.getDerivedStateFromProps, q2 = "function" === typeof m2 || "function" === typeof g2.getSnapshotBeforeUpdate;
    q2 || "function" !== typeof g2.UNSAFE_componentWillReceiveProps && "function" !== typeof g2.componentWillReceiveProps || (h3 !== d2 || k2 !== l2) && Hi(b2, g2, d2, l2);
    jh = false;
    var r2 = b2.memoizedState;
    g2.state = r2;
    qh(b2, d2, g2, e2);
    k2 = b2.memoizedState;
    h3 !== d2 || r2 !== k2 || Wf.current || jh ? ("function" === typeof m2 && (Di(b2, c2, m2, d2), k2 = b2.memoizedState), (h3 = jh || Fi(b2, c2, h3, d2, r2, k2, l2)) ? (q2 || "function" !== typeof g2.UNSAFE_componentWillMount && "function" !== typeof g2.componentWillMount || ("function" === typeof g2.componentWillMount && g2.componentWillMount(), "function" === typeof g2.UNSAFE_componentWillMount && g2.UNSAFE_componentWillMount()), "function" === typeof g2.componentDidMount && (b2.flags |= 4194308)) : ("function" === typeof g2.componentDidMount && (b2.flags |= 4194308), b2.memoizedProps = d2, b2.memoizedState = k2), g2.props = d2, g2.state = k2, g2.context = l2, d2 = h3) : ("function" === typeof g2.componentDidMount && (b2.flags |= 4194308), d2 = false);
  } else {
    g2 = b2.stateNode;
    lh(a2, b2);
    h3 = b2.memoizedProps;
    l2 = b2.type === b2.elementType ? h3 : Ci(b2.type, h3);
    g2.props = l2;
    q2 = b2.pendingProps;
    r2 = g2.context;
    k2 = c2.contextType;
    "object" === typeof k2 && null !== k2 ? k2 = eh(k2) : (k2 = Zf(c2) ? Xf : H$3.current, k2 = Yf(b2, k2));
    var y2 = c2.getDerivedStateFromProps;
    (m2 = "function" === typeof y2 || "function" === typeof g2.getSnapshotBeforeUpdate) || "function" !== typeof g2.UNSAFE_componentWillReceiveProps && "function" !== typeof g2.componentWillReceiveProps || (h3 !== q2 || r2 !== k2) && Hi(b2, g2, d2, k2);
    jh = false;
    r2 = b2.memoizedState;
    g2.state = r2;
    qh(b2, d2, g2, e2);
    var n2 = b2.memoizedState;
    h3 !== q2 || r2 !== n2 || Wf.current || jh ? ("function" === typeof y2 && (Di(b2, c2, y2, d2), n2 = b2.memoizedState), (l2 = jh || Fi(b2, c2, l2, d2, r2, n2, k2) || false) ? (m2 || "function" !== typeof g2.UNSAFE_componentWillUpdate && "function" !== typeof g2.componentWillUpdate || ("function" === typeof g2.componentWillUpdate && g2.componentWillUpdate(d2, n2, k2), "function" === typeof g2.UNSAFE_componentWillUpdate && g2.UNSAFE_componentWillUpdate(d2, n2, k2)), "function" === typeof g2.componentDidUpdate && (b2.flags |= 4), "function" === typeof g2.getSnapshotBeforeUpdate && (b2.flags |= 1024)) : ("function" !== typeof g2.componentDidUpdate || h3 === a2.memoizedProps && r2 === a2.memoizedState || (b2.flags |= 4), "function" !== typeof g2.getSnapshotBeforeUpdate || h3 === a2.memoizedProps && r2 === a2.memoizedState || (b2.flags |= 1024), b2.memoizedProps = d2, b2.memoizedState = n2), g2.props = d2, g2.state = n2, g2.context = k2, d2 = l2) : ("function" !== typeof g2.componentDidUpdate || h3 === a2.memoizedProps && r2 === a2.memoizedState || (b2.flags |= 4), "function" !== typeof g2.getSnapshotBeforeUpdate || h3 === a2.memoizedProps && r2 === a2.memoizedState || (b2.flags |= 1024), d2 = false);
  }
  return jj(a2, b2, c2, d2, f2, e2);
}
function jj(a2, b2, c2, d2, e2, f2) {
  gj(a2, b2);
  var g2 = 0 !== (b2.flags & 128);
  if (!d2 && !g2)
    return e2 && dg(b2, c2, false), Zi(a2, b2, f2);
  d2 = b2.stateNode;
  Wi.current = b2;
  var h3 = g2 && "function" !== typeof c2.getDerivedStateFromError ? null : d2.render();
  b2.flags |= 1;
  null !== a2 && g2 ? (b2.child = Ug(b2, a2.child, null, f2), b2.child = Ug(b2, null, h3, f2)) : Xi(a2, b2, h3, f2);
  b2.memoizedState = d2.state;
  e2 && dg(b2, c2, true);
  return b2.child;
}
function kj(a2) {
  var b2 = a2.stateNode;
  b2.pendingContext ? ag(a2, b2.pendingContext, b2.pendingContext !== b2.context) : b2.context && ag(a2, b2.context, false);
  yh(a2, b2.containerInfo);
}
function lj(a2, b2, c2, d2, e2) {
  Ig();
  Jg(e2);
  b2.flags |= 256;
  Xi(a2, b2, c2, d2);
  return b2.child;
}
var mj = { dehydrated: null, treeContext: null, retryLane: 0 };
function nj(a2) {
  return { baseLanes: a2, cachePool: null, transitions: null };
}
function oj(a2, b2, c2) {
  var d2 = b2.pendingProps, e2 = L$3.current, f2 = false, g2 = 0 !== (b2.flags & 128), h3;
  (h3 = g2) || (h3 = null !== a2 && null === a2.memoizedState ? false : 0 !== (e2 & 2));
  if (h3)
    f2 = true, b2.flags &= -129;
  else if (null === a2 || null !== a2.memoizedState)
    e2 |= 1;
  G$2(L$3, e2 & 1);
  if (null === a2) {
    Eg(b2);
    a2 = b2.memoizedState;
    if (null !== a2 && (a2 = a2.dehydrated, null !== a2))
      return 0 === (b2.mode & 1) ? b2.lanes = 1 : "$!" === a2.data ? b2.lanes = 8 : b2.lanes = 1073741824, null;
    g2 = d2.children;
    a2 = d2.fallback;
    return f2 ? (d2 = b2.mode, f2 = b2.child, g2 = { mode: "hidden", children: g2 }, 0 === (d2 & 1) && null !== f2 ? (f2.childLanes = 0, f2.pendingProps = g2) : f2 = pj(g2, d2, 0, null), a2 = Tg(a2, d2, c2, null), f2.return = b2, a2.return = b2, f2.sibling = a2, b2.child = f2, b2.child.memoizedState = nj(c2), b2.memoizedState = mj, a2) : qj(b2, g2);
  }
  e2 = a2.memoizedState;
  if (null !== e2 && (h3 = e2.dehydrated, null !== h3))
    return rj(a2, b2, g2, d2, h3, e2, c2);
  if (f2) {
    f2 = d2.fallback;
    g2 = b2.mode;
    e2 = a2.child;
    h3 = e2.sibling;
    var k2 = { mode: "hidden", children: d2.children };
    0 === (g2 & 1) && b2.child !== e2 ? (d2 = b2.child, d2.childLanes = 0, d2.pendingProps = k2, b2.deletions = null) : (d2 = Pg(e2, k2), d2.subtreeFlags = e2.subtreeFlags & 14680064);
    null !== h3 ? f2 = Pg(h3, f2) : (f2 = Tg(f2, g2, c2, null), f2.flags |= 2);
    f2.return = b2;
    d2.return = b2;
    d2.sibling = f2;
    b2.child = d2;
    d2 = f2;
    f2 = b2.child;
    g2 = a2.child.memoizedState;
    g2 = null === g2 ? nj(c2) : { baseLanes: g2.baseLanes | c2, cachePool: null, transitions: g2.transitions };
    f2.memoizedState = g2;
    f2.childLanes = a2.childLanes & ~c2;
    b2.memoizedState = mj;
    return d2;
  }
  f2 = a2.child;
  a2 = f2.sibling;
  d2 = Pg(f2, { mode: "visible", children: d2.children });
  0 === (b2.mode & 1) && (d2.lanes = c2);
  d2.return = b2;
  d2.sibling = null;
  null !== a2 && (c2 = b2.deletions, null === c2 ? (b2.deletions = [a2], b2.flags |= 16) : c2.push(a2));
  b2.child = d2;
  b2.memoizedState = null;
  return d2;
}
function qj(a2, b2) {
  b2 = pj({ mode: "visible", children: b2 }, a2.mode, 0, null);
  b2.return = a2;
  return a2.child = b2;
}
function sj(a2, b2, c2, d2) {
  null !== d2 && Jg(d2);
  Ug(b2, a2.child, null, c2);
  a2 = qj(b2, b2.pendingProps.children);
  a2.flags |= 2;
  b2.memoizedState = null;
  return a2;
}
function rj(a2, b2, c2, d2, e2, f2, g2) {
  if (c2) {
    if (b2.flags & 256)
      return b2.flags &= -257, d2 = Ki(Error(p$7(422))), sj(a2, b2, g2, d2);
    if (null !== b2.memoizedState)
      return b2.child = a2.child, b2.flags |= 128, null;
    f2 = d2.fallback;
    e2 = b2.mode;
    d2 = pj({ mode: "visible", children: d2.children }, e2, 0, null);
    f2 = Tg(f2, e2, g2, null);
    f2.flags |= 2;
    d2.return = b2;
    f2.return = b2;
    d2.sibling = f2;
    b2.child = d2;
    0 !== (b2.mode & 1) && Ug(b2, a2.child, null, g2);
    b2.child.memoizedState = nj(g2);
    b2.memoizedState = mj;
    return f2;
  }
  if (0 === (b2.mode & 1))
    return sj(a2, b2, g2, null);
  if ("$!" === e2.data) {
    d2 = e2.nextSibling && e2.nextSibling.dataset;
    if (d2)
      var h3 = d2.dgst;
    d2 = h3;
    f2 = Error(p$7(419));
    d2 = Ki(f2, d2, void 0);
    return sj(a2, b2, g2, d2);
  }
  h3 = 0 !== (g2 & a2.childLanes);
  if (dh || h3) {
    d2 = Q$3;
    if (null !== d2) {
      switch (g2 & -g2) {
        case 4:
          e2 = 2;
          break;
        case 16:
          e2 = 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:
          e2 = 32;
          break;
        case 536870912:
          e2 = 268435456;
          break;
        default:
          e2 = 0;
      }
      e2 = 0 !== (e2 & (d2.suspendedLanes | g2)) ? 0 : e2;
      0 !== e2 && e2 !== f2.retryLane && (f2.retryLane = e2, ih(a2, e2), gi(d2, a2, e2, -1));
    }
    tj();
    d2 = Ki(Error(p$7(421)));
    return sj(a2, b2, g2, d2);
  }
  if ("$?" === e2.data)
    return b2.flags |= 128, b2.child = a2.child, b2 = uj.bind(null, a2), e2._reactRetry = b2, null;
  a2 = f2.treeContext;
  yg = Lf(e2.nextSibling);
  xg = b2;
  I$3 = true;
  zg = null;
  null !== a2 && (og[pg++] = rg, og[pg++] = sg, og[pg++] = qg, rg = a2.id, sg = a2.overflow, qg = b2);
  b2 = qj(b2, d2.children);
  b2.flags |= 4096;
  return b2;
}
function vj(a2, b2, c2) {
  a2.lanes |= b2;
  var d2 = a2.alternate;
  null !== d2 && (d2.lanes |= b2);
  bh(a2.return, b2, c2);
}
function wj(a2, b2, c2, d2, e2) {
  var f2 = a2.memoizedState;
  null === f2 ? a2.memoizedState = { isBackwards: b2, rendering: null, renderingStartTime: 0, last: d2, tail: c2, tailMode: e2 } : (f2.isBackwards = b2, f2.rendering = null, f2.renderingStartTime = 0, f2.last = d2, f2.tail = c2, f2.tailMode = e2);
}
function xj(a2, b2, c2) {
  var d2 = b2.pendingProps, e2 = d2.revealOrder, f2 = d2.tail;
  Xi(a2, b2, d2.children, c2);
  d2 = L$3.current;
  if (0 !== (d2 & 2))
    d2 = d2 & 1 | 2, b2.flags |= 128;
  else {
    if (null !== a2 && 0 !== (a2.flags & 128))
      a:
        for (a2 = b2.child; null !== a2; ) {
          if (13 === a2.tag)
            null !== a2.memoizedState && vj(a2, c2, b2);
          else if (19 === a2.tag)
            vj(a2, c2, b2);
          else if (null !== a2.child) {
            a2.child.return = a2;
            a2 = a2.child;
            continue;
          }
          if (a2 === b2)
            break a;
          for (; null === a2.sibling; ) {
            if (null === a2.return || a2.return === b2)
              break a;
            a2 = a2.return;
          }
          a2.sibling.return = a2.return;
          a2 = a2.sibling;
        }
    d2 &= 1;
  }
  G$2(L$3, d2);
  if (0 === (b2.mode & 1))
    b2.memoizedState = null;
  else
    switch (e2) {
      case "forwards":
        c2 = b2.child;
        for (e2 = null; null !== c2; )
          a2 = c2.alternate, null !== a2 && null === Ch(a2) && (e2 = c2), c2 = c2.sibling;
        c2 = e2;
        null === c2 ? (e2 = b2.child, b2.child = null) : (e2 = c2.sibling, c2.sibling = null);
        wj(b2, false, e2, c2, f2);
        break;
      case "backwards":
        c2 = null;
        e2 = b2.child;
        for (b2.child = null; null !== e2; ) {
          a2 = e2.alternate;
          if (null !== a2 && null === Ch(a2)) {
            b2.child = e2;
            break;
          }
          a2 = e2.sibling;
          e2.sibling = c2;
          c2 = e2;
          e2 = a2;
        }
        wj(b2, true, c2, null, f2);
        break;
      case "together":
        wj(b2, false, null, null, void 0);
        break;
      default:
        b2.memoizedState = null;
    }
  return b2.child;
}
function ij(a2, b2) {
  0 === (b2.mode & 1) && null !== a2 && (a2.alternate = null, b2.alternate = null, b2.flags |= 2);
}
function Zi(a2, b2, c2) {
  null !== a2 && (b2.dependencies = a2.dependencies);
  rh |= b2.lanes;
  if (0 === (c2 & b2.childLanes))
    return null;
  if (null !== a2 && b2.child !== a2.child)
    throw Error(p$7(153));
  if (null !== b2.child) {
    a2 = b2.child;
    c2 = Pg(a2, a2.pendingProps);
    b2.child = c2;
    for (c2.return = b2; null !== a2.sibling; )
      a2 = a2.sibling, c2 = c2.sibling = Pg(a2, a2.pendingProps), c2.return = b2;
    c2.sibling = null;
  }
  return b2.child;
}
function yj(a2, b2, c2) {
  switch (b2.tag) {
    case 3:
      kj(b2);
      Ig();
      break;
    case 5:
      Ah(b2);
      break;
    case 1:
      Zf(b2.type) && cg(b2);
      break;
    case 4:
      yh(b2, b2.stateNode.containerInfo);
      break;
    case 10:
      var d2 = b2.type._context, e2 = b2.memoizedProps.value;
      G$2(Wg, d2._currentValue);
      d2._currentValue = e2;
      break;
    case 13:
      d2 = b2.memoizedState;
      if (null !== d2) {
        if (null !== d2.dehydrated)
          return G$2(L$3, L$3.current & 1), b2.flags |= 128, null;
        if (0 !== (c2 & b2.child.childLanes))
          return oj(a2, b2, c2);
        G$2(L$3, L$3.current & 1);
        a2 = Zi(a2, b2, c2);
        return null !== a2 ? a2.sibling : null;
      }
      G$2(L$3, L$3.current & 1);
      break;
    case 19:
      d2 = 0 !== (c2 & b2.childLanes);
      if (0 !== (a2.flags & 128)) {
        if (d2)
          return xj(a2, b2, c2);
        b2.flags |= 128;
      }
      e2 = b2.memoizedState;
      null !== e2 && (e2.rendering = null, e2.tail = null, e2.lastEffect = null);
      G$2(L$3, L$3.current);
      if (d2)
        break;
      else
        return null;
    case 22:
    case 23:
      return b2.lanes = 0, dj(a2, b2, c2);
  }
  return Zi(a2, b2, c2);
}
var zj, Aj, Bj, Cj;
zj = function(a2, b2) {
  for (var c2 = b2.child; null !== c2; ) {
    if (5 === c2.tag || 6 === c2.tag)
      a2.appendChild(c2.stateNode);
    else if (4 !== c2.tag && null !== c2.child) {
      c2.child.return = c2;
      c2 = c2.child;
      continue;
    }
    if (c2 === b2)
      break;
    for (; null === c2.sibling; ) {
      if (null === c2.return || c2.return === b2)
        return;
      c2 = c2.return;
    }
    c2.sibling.return = c2.return;
    c2 = c2.sibling;
  }
};
Aj = function() {
};
Bj = function(a2, b2, c2, d2) {
  var e2 = a2.memoizedProps;
  if (e2 !== d2) {
    a2 = b2.stateNode;
    xh(uh.current);
    var f2 = null;
    switch (c2) {
      case "input":
        e2 = Ya$2(a2, e2);
        d2 = Ya$2(a2, d2);
        f2 = [];
        break;
      case "select":
        e2 = A$4({}, e2, { value: void 0 });
        d2 = A$4({}, d2, { value: void 0 });
        f2 = [];
        break;
      case "textarea":
        e2 = gb$2(a2, e2);
        d2 = gb$2(a2, d2);
        f2 = [];
        break;
      default:
        "function" !== typeof e2.onClick && "function" === typeof d2.onClick && (a2.onclick = Bf);
    }
    ub$2(c2, d2);
    var g2;
    c2 = null;
    for (l2 in e2)
      if (!d2.hasOwnProperty(l2) && e2.hasOwnProperty(l2) && null != e2[l2])
        if ("style" === l2) {
          var h3 = e2[l2];
          for (g2 in h3)
            h3.hasOwnProperty(g2) && (c2 || (c2 = {}), c2[g2] = "");
        } else
          "dangerouslySetInnerHTML" !== l2 && "children" !== l2 && "suppressContentEditableWarning" !== l2 && "suppressHydrationWarning" !== l2 && "autoFocus" !== l2 && (ea$1.hasOwnProperty(l2) ? f2 || (f2 = []) : (f2 = f2 || []).push(l2, null));
    for (l2 in d2) {
      var k2 = d2[l2];
      h3 = null != e2 ? e2[l2] : void 0;
      if (d2.hasOwnProperty(l2) && k2 !== h3 && (null != k2 || null != h3))
        if ("style" === l2)
          if (h3) {
            for (g2 in h3)
              !h3.hasOwnProperty(g2) || k2 && k2.hasOwnProperty(g2) || (c2 || (c2 = {}), c2[g2] = "");
            for (g2 in k2)
              k2.hasOwnProperty(g2) && h3[g2] !== k2[g2] && (c2 || (c2 = {}), c2[g2] = k2[g2]);
          } else
            c2 || (f2 || (f2 = []), f2.push(
              l2,
              c2
            )), c2 = k2;
        else
          "dangerouslySetInnerHTML" === l2 ? (k2 = k2 ? k2.__html : void 0, h3 = h3 ? h3.__html : void 0, null != k2 && h3 !== k2 && (f2 = f2 || []).push(l2, k2)) : "children" === l2 ? "string" !== typeof k2 && "number" !== typeof k2 || (f2 = f2 || []).push(l2, "" + k2) : "suppressContentEditableWarning" !== l2 && "suppressHydrationWarning" !== l2 && (ea$1.hasOwnProperty(l2) ? (null != k2 && "onScroll" === l2 && D$2("scroll", a2), f2 || h3 === k2 || (f2 = [])) : (f2 = f2 || []).push(l2, k2));
    }
    c2 && (f2 = f2 || []).push("style", c2);
    var l2 = f2;
    if (b2.updateQueue = l2)
      b2.flags |= 4;
  }
};
Cj = function(a2, b2, c2, d2) {
  c2 !== d2 && (b2.flags |= 4);
};
function Dj(a2, b2) {
  if (!I$3)
    switch (a2.tailMode) {
      case "hidden":
        b2 = a2.tail;
        for (var c2 = null; null !== b2; )
          null !== b2.alternate && (c2 = b2), b2 = b2.sibling;
        null === c2 ? a2.tail = null : c2.sibling = null;
        break;
      case "collapsed":
        c2 = a2.tail;
        for (var d2 = null; null !== c2; )
          null !== c2.alternate && (d2 = c2), c2 = c2.sibling;
        null === d2 ? b2 || null === a2.tail ? a2.tail = null : a2.tail.sibling = null : d2.sibling = null;
    }
}
function S$3(a2) {
  var b2 = null !== a2.alternate && a2.alternate.child === a2.child, c2 = 0, d2 = 0;
  if (b2)
    for (var e2 = a2.child; null !== e2; )
      c2 |= e2.lanes | e2.childLanes, d2 |= e2.subtreeFlags & 14680064, d2 |= e2.flags & 14680064, e2.return = a2, e2 = e2.sibling;
  else
    for (e2 = a2.child; null !== e2; )
      c2 |= e2.lanes | e2.childLanes, d2 |= e2.subtreeFlags, d2 |= e2.flags, e2.return = a2, e2 = e2.sibling;
  a2.subtreeFlags |= d2;
  a2.childLanes = c2;
  return b2;
}
function Ej(a2, b2, c2) {
  var d2 = b2.pendingProps;
  wg(b2);
  switch (b2.tag) {
    case 2:
    case 16:
    case 15:
    case 0:
    case 11:
    case 7:
    case 8:
    case 12:
    case 9:
    case 14:
      return S$3(b2), null;
    case 1:
      return Zf(b2.type) && $f(), S$3(b2), null;
    case 3:
      d2 = b2.stateNode;
      zh();
      E$3(Wf);
      E$3(H$3);
      Eh();
      d2.pendingContext && (d2.context = d2.pendingContext, d2.pendingContext = null);
      if (null === a2 || null === a2.child)
        Gg(b2) ? b2.flags |= 4 : null === a2 || a2.memoizedState.isDehydrated && 0 === (b2.flags & 256) || (b2.flags |= 1024, null !== zg && (Fj(zg), zg = null));
      Aj(a2, b2);
      S$3(b2);
      return null;
    case 5:
      Bh(b2);
      var e2 = xh(wh.current);
      c2 = b2.type;
      if (null !== a2 && null != b2.stateNode)
        Bj(a2, b2, c2, d2, e2), a2.ref !== b2.ref && (b2.flags |= 512, b2.flags |= 2097152);
      else {
        if (!d2) {
          if (null === b2.stateNode)
            throw Error(p$7(166));
          S$3(b2);
          return null;
        }
        a2 = xh(uh.current);
        if (Gg(b2)) {
          d2 = b2.stateNode;
          c2 = b2.type;
          var f2 = b2.memoizedProps;
          d2[Of] = b2;
          d2[Pf] = f2;
          a2 = 0 !== (b2.mode & 1);
          switch (c2) {
            case "dialog":
              D$2("cancel", d2);
              D$2("close", d2);
              break;
            case "iframe":
            case "object":
            case "embed":
              D$2("load", d2);
              break;
            case "video":
            case "audio":
              for (e2 = 0; e2 < lf.length; e2++)
                D$2(lf[e2], d2);
              break;
            case "source":
              D$2("error", d2);
              break;
            case "img":
            case "image":
            case "link":
              D$2(
                "error",
                d2
              );
              D$2("load", d2);
              break;
            case "details":
              D$2("toggle", d2);
              break;
            case "input":
              Za$2(d2, f2);
              D$2("invalid", d2);
              break;
            case "select":
              d2._wrapperState = { wasMultiple: !!f2.multiple };
              D$2("invalid", d2);
              break;
            case "textarea":
              hb$2(d2, f2), D$2("invalid", d2);
          }
          ub$2(c2, f2);
          e2 = null;
          for (var g2 in f2)
            if (f2.hasOwnProperty(g2)) {
              var h3 = f2[g2];
              "children" === g2 ? "string" === typeof h3 ? d2.textContent !== h3 && (true !== f2.suppressHydrationWarning && Af(d2.textContent, h3, a2), e2 = ["children", h3]) : "number" === typeof h3 && d2.textContent !== "" + h3 && (true !== f2.suppressHydrationWarning && Af(
                d2.textContent,
                h3,
                a2
              ), e2 = ["children", "" + h3]) : ea$1.hasOwnProperty(g2) && null != h3 && "onScroll" === g2 && D$2("scroll", d2);
            }
          switch (c2) {
            case "input":
              Va$2(d2);
              db$2(d2, f2, true);
              break;
            case "textarea":
              Va$2(d2);
              jb$2(d2);
              break;
            case "select":
            case "option":
              break;
            default:
              "function" === typeof f2.onClick && (d2.onclick = Bf);
          }
          d2 = e2;
          b2.updateQueue = d2;
          null !== d2 && (b2.flags |= 4);
        } else {
          g2 = 9 === e2.nodeType ? e2 : e2.ownerDocument;
          "http://www.w3.org/1999/xhtml" === a2 && (a2 = kb$2(c2));
          "http://www.w3.org/1999/xhtml" === a2 ? "script" === c2 ? (a2 = g2.createElement("div"), a2.innerHTML = "<script><\/script>", a2 = a2.removeChild(a2.firstChild)) : "string" === typeof d2.is ? a2 = g2.createElement(c2, { is: d2.is }) : (a2 = g2.createElement(c2), "select" === c2 && (g2 = a2, d2.multiple ? g2.multiple = true : d2.size && (g2.size = d2.size))) : a2 = g2.createElementNS(a2, c2);
          a2[Of] = b2;
          a2[Pf] = d2;
          zj(a2, b2, false, false);
          b2.stateNode = a2;
          a: {
            g2 = vb$2(c2, d2);
            switch (c2) {
              case "dialog":
                D$2("cancel", a2);
                D$2("close", a2);
                e2 = d2;
                break;
              case "iframe":
              case "object":
              case "embed":
                D$2("load", a2);
                e2 = d2;
                break;
              case "video":
              case "audio":
                for (e2 = 0; e2 < lf.length; e2++)
                  D$2(lf[e2], a2);
                e2 = d2;
                break;
              case "source":
                D$2("error", a2);
                e2 = d2;
                break;
              case "img":
              case "image":
              case "link":
                D$2(
                  "error",
                  a2
                );
                D$2("load", a2);
                e2 = d2;
                break;
              case "details":
                D$2("toggle", a2);
                e2 = d2;
                break;
              case "input":
                Za$2(a2, d2);
                e2 = Ya$2(a2, d2);
                D$2("invalid", a2);
                break;
              case "option":
                e2 = d2;
                break;
              case "select":
                a2._wrapperState = { wasMultiple: !!d2.multiple };
                e2 = A$4({}, d2, { value: void 0 });
                D$2("invalid", a2);
                break;
              case "textarea":
                hb$2(a2, d2);
                e2 = gb$2(a2, d2);
                D$2("invalid", a2);
                break;
              default:
                e2 = d2;
            }
            ub$2(c2, e2);
            h3 = e2;
            for (f2 in h3)
              if (h3.hasOwnProperty(f2)) {
                var k2 = h3[f2];
                "style" === f2 ? sb$2(a2, k2) : "dangerouslySetInnerHTML" === f2 ? (k2 = k2 ? k2.__html : void 0, null != k2 && nb$1(a2, k2)) : "children" === f2 ? "string" === typeof k2 ? ("textarea" !== c2 || "" !== k2) && ob$2(a2, k2) : "number" === typeof k2 && ob$2(a2, "" + k2) : "suppressContentEditableWarning" !== f2 && "suppressHydrationWarning" !== f2 && "autoFocus" !== f2 && (ea$1.hasOwnProperty(f2) ? null != k2 && "onScroll" === f2 && D$2("scroll", a2) : null != k2 && ta$2(a2, f2, k2, g2));
              }
            switch (c2) {
              case "input":
                Va$2(a2);
                db$2(a2, d2, false);
                break;
              case "textarea":
                Va$2(a2);
                jb$2(a2);
                break;
              case "option":
                null != d2.value && a2.setAttribute("value", "" + Sa$2(d2.value));
                break;
              case "select":
                a2.multiple = !!d2.multiple;
                f2 = d2.value;
                null != f2 ? fb$2(a2, !!d2.multiple, f2, false) : null != d2.defaultValue && fb$2(
                  a2,
                  !!d2.multiple,
                  d2.defaultValue,
                  true
                );
                break;
              default:
                "function" === typeof e2.onClick && (a2.onclick = Bf);
            }
            switch (c2) {
              case "button":
              case "input":
              case "select":
              case "textarea":
                d2 = !!d2.autoFocus;
                break a;
              case "img":
                d2 = true;
                break a;
              default:
                d2 = false;
            }
          }
          d2 && (b2.flags |= 4);
        }
        null !== b2.ref && (b2.flags |= 512, b2.flags |= 2097152);
      }
      S$3(b2);
      return null;
    case 6:
      if (a2 && null != b2.stateNode)
        Cj(a2, b2, a2.memoizedProps, d2);
      else {
        if ("string" !== typeof d2 && null === b2.stateNode)
          throw Error(p$7(166));
        c2 = xh(wh.current);
        xh(uh.current);
        if (Gg(b2)) {
          d2 = b2.stateNode;
          c2 = b2.memoizedProps;
          d2[Of] = b2;
          if (f2 = d2.nodeValue !== c2) {
            if (a2 = xg, null !== a2)
              switch (a2.tag) {
                case 3:
                  Af(d2.nodeValue, c2, 0 !== (a2.mode & 1));
                  break;
                case 5:
                  true !== a2.memoizedProps.suppressHydrationWarning && Af(d2.nodeValue, c2, 0 !== (a2.mode & 1));
              }
          }
          f2 && (b2.flags |= 4);
        } else
          d2 = (9 === c2.nodeType ? c2 : c2.ownerDocument).createTextNode(d2), d2[Of] = b2, b2.stateNode = d2;
      }
      S$3(b2);
      return null;
    case 13:
      E$3(L$3);
      d2 = b2.memoizedState;
      if (null === a2 || null !== a2.memoizedState && null !== a2.memoizedState.dehydrated) {
        if (I$3 && null !== yg && 0 !== (b2.mode & 1) && 0 === (b2.flags & 128))
          Hg(), Ig(), b2.flags |= 98560, f2 = false;
        else if (f2 = Gg(b2), null !== d2 && null !== d2.dehydrated) {
          if (null === a2) {
            if (!f2)
              throw Error(p$7(318));
            f2 = b2.memoizedState;
            f2 = null !== f2 ? f2.dehydrated : null;
            if (!f2)
              throw Error(p$7(317));
            f2[Of] = b2;
          } else
            Ig(), 0 === (b2.flags & 128) && (b2.memoizedState = null), b2.flags |= 4;
          S$3(b2);
          f2 = false;
        } else
          null !== zg && (Fj(zg), zg = null), f2 = true;
        if (!f2)
          return b2.flags & 65536 ? b2 : null;
      }
      if (0 !== (b2.flags & 128))
        return b2.lanes = c2, b2;
      d2 = null !== d2;
      d2 !== (null !== a2 && null !== a2.memoizedState) && d2 && (b2.child.flags |= 8192, 0 !== (b2.mode & 1) && (null === a2 || 0 !== (L$3.current & 1) ? 0 === T$2 && (T$2 = 3) : tj()));
      null !== b2.updateQueue && (b2.flags |= 4);
      S$3(b2);
      return null;
    case 4:
      return zh(), Aj(a2, b2), null === a2 && sf(b2.stateNode.containerInfo), S$3(b2), null;
    case 10:
      return ah(b2.type._context), S$3(b2), null;
    case 17:
      return Zf(b2.type) && $f(), S$3(b2), null;
    case 19:
      E$3(L$3);
      f2 = b2.memoizedState;
      if (null === f2)
        return S$3(b2), null;
      d2 = 0 !== (b2.flags & 128);
      g2 = f2.rendering;
      if (null === g2)
        if (d2)
          Dj(f2, false);
        else {
          if (0 !== T$2 || null !== a2 && 0 !== (a2.flags & 128))
            for (a2 = b2.child; null !== a2; ) {
              g2 = Ch(a2);
              if (null !== g2) {
                b2.flags |= 128;
                Dj(f2, false);
                d2 = g2.updateQueue;
                null !== d2 && (b2.updateQueue = d2, b2.flags |= 4);
                b2.subtreeFlags = 0;
                d2 = c2;
                for (c2 = b2.child; null !== c2; )
                  f2 = c2, a2 = d2, f2.flags &= 14680066, g2 = f2.alternate, null === g2 ? (f2.childLanes = 0, f2.lanes = a2, f2.child = null, f2.subtreeFlags = 0, f2.memoizedProps = null, f2.memoizedState = null, f2.updateQueue = null, f2.dependencies = null, f2.stateNode = null) : (f2.childLanes = g2.childLanes, f2.lanes = g2.lanes, f2.child = g2.child, f2.subtreeFlags = 0, f2.deletions = null, f2.memoizedProps = g2.memoizedProps, f2.memoizedState = g2.memoizedState, f2.updateQueue = g2.updateQueue, f2.type = g2.type, a2 = g2.dependencies, f2.dependencies = null === a2 ? null : { lanes: a2.lanes, firstContext: a2.firstContext }), c2 = c2.sibling;
                G$2(L$3, L$3.current & 1 | 2);
                return b2.child;
              }
              a2 = a2.sibling;
            }
          null !== f2.tail && B$3() > Gj && (b2.flags |= 128, d2 = true, Dj(f2, false), b2.lanes = 4194304);
        }
      else {
        if (!d2)
          if (a2 = Ch(g2), null !== a2) {
            if (b2.flags |= 128, d2 = true, c2 = a2.updateQueue, null !== c2 && (b2.updateQueue = c2, b2.flags |= 4), Dj(f2, true), null === f2.tail && "hidden" === f2.tailMode && !g2.alternate && !I$3)
              return S$3(b2), null;
          } else
            2 * B$3() - f2.renderingStartTime > Gj && 1073741824 !== c2 && (b2.flags |= 128, d2 = true, Dj(f2, false), b2.lanes = 4194304);
        f2.isBackwards ? (g2.sibling = b2.child, b2.child = g2) : (c2 = f2.last, null !== c2 ? c2.sibling = g2 : b2.child = g2, f2.last = g2);
      }
      if (null !== f2.tail)
        return b2 = f2.tail, f2.rendering = b2, f2.tail = b2.sibling, f2.renderingStartTime = B$3(), b2.sibling = null, c2 = L$3.current, G$2(L$3, d2 ? c2 & 1 | 2 : c2 & 1), b2;
      S$3(b2);
      return null;
    case 22:
    case 23:
      return Hj(), d2 = null !== b2.memoizedState, null !== a2 && null !== a2.memoizedState !== d2 && (b2.flags |= 8192), d2 && 0 !== (b2.mode & 1) ? 0 !== (fj & 1073741824) && (S$3(b2), b2.subtreeFlags & 6 && (b2.flags |= 8192)) : S$3(b2), null;
    case 24:
      return null;
    case 25:
      return null;
  }
  throw Error(p$7(156, b2.tag));
}
function Ij(a2, b2) {
  wg(b2);
  switch (b2.tag) {
    case 1:
      return Zf(b2.type) && $f(), a2 = b2.flags, a2 & 65536 ? (b2.flags = a2 & -65537 | 128, b2) : null;
    case 3:
      return zh(), E$3(Wf), E$3(H$3), Eh(), a2 = b2.flags, 0 !== (a2 & 65536) && 0 === (a2 & 128) ? (b2.flags = a2 & -65537 | 128, b2) : null;
    case 5:
      return Bh(b2), null;
    case 13:
      E$3(L$3);
      a2 = b2.memoizedState;
      if (null !== a2 && null !== a2.dehydrated) {
        if (null === b2.alternate)
          throw Error(p$7(340));
        Ig();
      }
      a2 = b2.flags;
      return a2 & 65536 ? (b2.flags = a2 & -65537 | 128, b2) : null;
    case 19:
      return E$3(L$3), null;
    case 4:
      return zh(), null;
    case 10:
      return ah(b2.type._context), null;
    case 22:
    case 23:
      return Hj(), null;
    case 24:
      return null;
    default:
      return null;
  }
}
var Jj = false, U$4 = false, Kj = "function" === typeof WeakSet ? WeakSet : Set, V$3 = null;
function Lj(a2, b2) {
  var c2 = a2.ref;
  if (null !== c2)
    if ("function" === typeof c2)
      try {
        c2(null);
      } catch (d2) {
        W$4(a2, b2, d2);
      }
    else
      c2.current = null;
}
function Mj(a2, b2, c2) {
  try {
    c2();
  } catch (d2) {
    W$4(a2, b2, d2);
  }
}
var Nj = false;
function Oj(a2, b2) {
  Cf = dd$1;
  a2 = Me();
  if (Ne(a2)) {
    if ("selectionStart" in a2)
      var c2 = { start: a2.selectionStart, end: a2.selectionEnd };
    else
      a: {
        c2 = (c2 = a2.ownerDocument) && c2.defaultView || window;
        var d2 = c2.getSelection && c2.getSelection();
        if (d2 && 0 !== d2.rangeCount) {
          c2 = d2.anchorNode;
          var e2 = d2.anchorOffset, f2 = d2.focusNode;
          d2 = d2.focusOffset;
          try {
            c2.nodeType, f2.nodeType;
          } catch (F2) {
            c2 = null;
            break a;
          }
          var g2 = 0, h3 = -1, k2 = -1, l2 = 0, m2 = 0, q2 = a2, r2 = null;
          b:
            for (; ; ) {
              for (var y2; ; ) {
                q2 !== c2 || 0 !== e2 && 3 !== q2.nodeType || (h3 = g2 + e2);
                q2 !== f2 || 0 !== d2 && 3 !== q2.nodeType || (k2 = g2 + d2);
                3 === q2.nodeType && (g2 += q2.nodeValue.length);
                if (null === (y2 = q2.firstChild))
                  break;
                r2 = q2;
                q2 = y2;
              }
              for (; ; ) {
                if (q2 === a2)
                  break b;
                r2 === c2 && ++l2 === e2 && (h3 = g2);
                r2 === f2 && ++m2 === d2 && (k2 = g2);
                if (null !== (y2 = q2.nextSibling))
                  break;
                q2 = r2;
                r2 = q2.parentNode;
              }
              q2 = y2;
            }
          c2 = -1 === h3 || -1 === k2 ? null : { start: h3, end: k2 };
        } else
          c2 = null;
      }
    c2 = c2 || { start: 0, end: 0 };
  } else
    c2 = null;
  Df = { focusedElem: a2, selectionRange: c2 };
  dd$1 = false;
  for (V$3 = b2; null !== V$3; )
    if (b2 = V$3, a2 = b2.child, 0 !== (b2.subtreeFlags & 1028) && null !== a2)
      a2.return = b2, V$3 = a2;
    else
      for (; null !== V$3; ) {
        b2 = V$3;
        try {
          var n2 = b2.alternate;
          if (0 !== (b2.flags & 1024))
            switch (b2.tag) {
              case 0:
              case 11:
              case 15:
                break;
              case 1:
                if (null !== n2) {
                  var t2 = n2.memoizedProps, J2 = n2.memoizedState, x2 = b2.stateNode, w2 = x2.getSnapshotBeforeUpdate(b2.elementType === b2.type ? t2 : Ci(b2.type, t2), J2);
                  x2.__reactInternalSnapshotBeforeUpdate = w2;
                }
                break;
              case 3:
                var u2 = b2.stateNode.containerInfo;
                1 === u2.nodeType ? u2.textContent = "" : 9 === u2.nodeType && u2.documentElement && u2.removeChild(u2.documentElement);
                break;
              case 5:
              case 6:
              case 4:
              case 17:
                break;
              default:
                throw Error(p$7(163));
            }
        } catch (F2) {
          W$4(b2, b2.return, F2);
        }
        a2 = b2.sibling;
        if (null !== a2) {
          a2.return = b2.return;
          V$3 = a2;
          break;
        }
        V$3 = b2.return;
      }
  n2 = Nj;
  Nj = false;
  return n2;
}
function Pj(a2, b2, c2) {
  var d2 = b2.updateQueue;
  d2 = null !== d2 ? d2.lastEffect : null;
  if (null !== d2) {
    var e2 = d2 = d2.next;
    do {
      if ((e2.tag & a2) === a2) {
        var f2 = e2.destroy;
        e2.destroy = void 0;
        void 0 !== f2 && Mj(b2, c2, f2);
      }
      e2 = e2.next;
    } while (e2 !== d2);
  }
}
function Qj(a2, b2) {
  b2 = b2.updateQueue;
  b2 = null !== b2 ? b2.lastEffect : null;
  if (null !== b2) {
    var c2 = b2 = b2.next;
    do {
      if ((c2.tag & a2) === a2) {
        var d2 = c2.create;
        c2.destroy = d2();
      }
      c2 = c2.next;
    } while (c2 !== b2);
  }
}
function Rj(a2) {
  var b2 = a2.ref;
  if (null !== b2) {
    var c2 = a2.stateNode;
    switch (a2.tag) {
      case 5:
        a2 = c2;
        break;
      default:
        a2 = c2;
    }
    "function" === typeof b2 ? b2(a2) : b2.current = a2;
  }
}
function Sj(a2) {
  var b2 = a2.alternate;
  null !== b2 && (a2.alternate = null, Sj(b2));
  a2.child = null;
  a2.deletions = null;
  a2.sibling = null;
  5 === a2.tag && (b2 = a2.stateNode, null !== b2 && (delete b2[Of], delete b2[Pf], delete b2[of], delete b2[Qf], delete b2[Rf]));
  a2.stateNode = null;
  a2.return = null;
  a2.dependencies = null;
  a2.memoizedProps = null;
  a2.memoizedState = null;
  a2.pendingProps = null;
  a2.stateNode = null;
  a2.updateQueue = null;
}
function Tj(a2) {
  return 5 === a2.tag || 3 === a2.tag || 4 === a2.tag;
}
function Uj(a2) {
  a:
    for (; ; ) {
      for (; null === a2.sibling; ) {
        if (null === a2.return || Tj(a2.return))
          return null;
        a2 = a2.return;
      }
      a2.sibling.return = a2.return;
      for (a2 = a2.sibling; 5 !== a2.tag && 6 !== a2.tag && 18 !== a2.tag; ) {
        if (a2.flags & 2)
          continue a;
        if (null === a2.child || 4 === a2.tag)
          continue a;
        else
          a2.child.return = a2, a2 = a2.child;
      }
      if (!(a2.flags & 2))
        return a2.stateNode;
    }
}
function Vj(a2, b2, c2) {
  var d2 = a2.tag;
  if (5 === d2 || 6 === d2)
    a2 = a2.stateNode, b2 ? 8 === c2.nodeType ? c2.parentNode.insertBefore(a2, b2) : c2.insertBefore(a2, b2) : (8 === c2.nodeType ? (b2 = c2.parentNode, b2.insertBefore(a2, c2)) : (b2 = c2, b2.appendChild(a2)), c2 = c2._reactRootContainer, null !== c2 && void 0 !== c2 || null !== b2.onclick || (b2.onclick = Bf));
  else if (4 !== d2 && (a2 = a2.child, null !== a2))
    for (Vj(a2, b2, c2), a2 = a2.sibling; null !== a2; )
      Vj(a2, b2, c2), a2 = a2.sibling;
}
function Wj(a2, b2, c2) {
  var d2 = a2.tag;
  if (5 === d2 || 6 === d2)
    a2 = a2.stateNode, b2 ? c2.insertBefore(a2, b2) : c2.appendChild(a2);
  else if (4 !== d2 && (a2 = a2.child, null !== a2))
    for (Wj(a2, b2, c2), a2 = a2.sibling; null !== a2; )
      Wj(a2, b2, c2), a2 = a2.sibling;
}
var X$3 = null, Xj = false;
function Yj(a2, b2, c2) {
  for (c2 = c2.child; null !== c2; )
    Zj(a2, b2, c2), c2 = c2.sibling;
}
function Zj(a2, b2, c2) {
  if (lc$1 && "function" === typeof lc$1.onCommitFiberUnmount)
    try {
      lc$1.onCommitFiberUnmount(kc$1, c2);
    } catch (h3) {
    }
  switch (c2.tag) {
    case 5:
      U$4 || Lj(c2, b2);
    case 6:
      var d2 = X$3, e2 = Xj;
      X$3 = null;
      Yj(a2, b2, c2);
      X$3 = d2;
      Xj = e2;
      null !== X$3 && (Xj ? (a2 = X$3, c2 = c2.stateNode, 8 === a2.nodeType ? a2.parentNode.removeChild(c2) : a2.removeChild(c2)) : X$3.removeChild(c2.stateNode));
      break;
    case 18:
      null !== X$3 && (Xj ? (a2 = X$3, c2 = c2.stateNode, 8 === a2.nodeType ? Kf(a2.parentNode, c2) : 1 === a2.nodeType && Kf(a2, c2), bd$1(a2)) : Kf(X$3, c2.stateNode));
      break;
    case 4:
      d2 = X$3;
      e2 = Xj;
      X$3 = c2.stateNode.containerInfo;
      Xj = true;
      Yj(a2, b2, c2);
      X$3 = d2;
      Xj = e2;
      break;
    case 0:
    case 11:
    case 14:
    case 15:
      if (!U$4 && (d2 = c2.updateQueue, null !== d2 && (d2 = d2.lastEffect, null !== d2))) {
        e2 = d2 = d2.next;
        do {
          var f2 = e2, g2 = f2.destroy;
          f2 = f2.tag;
          void 0 !== g2 && (0 !== (f2 & 2) ? Mj(c2, b2, g2) : 0 !== (f2 & 4) && Mj(c2, b2, g2));
          e2 = e2.next;
        } while (e2 !== d2);
      }
      Yj(a2, b2, c2);
      break;
    case 1:
      if (!U$4 && (Lj(c2, b2), d2 = c2.stateNode, "function" === typeof d2.componentWillUnmount))
        try {
          d2.props = c2.memoizedProps, d2.state = c2.memoizedState, d2.componentWillUnmount();
        } catch (h3) {
          W$4(c2, b2, h3);
        }
      Yj(a2, b2, c2);
      break;
    case 21:
      Yj(a2, b2, c2);
      break;
    case 22:
      c2.mode & 1 ? (U$4 = (d2 = U$4) || null !== c2.memoizedState, Yj(a2, b2, c2), U$4 = d2) : Yj(a2, b2, c2);
      break;
    default:
      Yj(a2, b2, c2);
  }
}
function ak(a2) {
  var b2 = a2.updateQueue;
  if (null !== b2) {
    a2.updateQueue = null;
    var c2 = a2.stateNode;
    null === c2 && (c2 = a2.stateNode = new Kj());
    b2.forEach(function(b3) {
      var d2 = bk.bind(null, a2, b3);
      c2.has(b3) || (c2.add(b3), b3.then(d2, d2));
    });
  }
}
function ck(a2, b2) {
  var c2 = b2.deletions;
  if (null !== c2)
    for (var d2 = 0; d2 < c2.length; d2++) {
      var e2 = c2[d2];
      try {
        var f2 = a2, g2 = b2, h3 = g2;
        a:
          for (; null !== h3; ) {
            switch (h3.tag) {
              case 5:
                X$3 = h3.stateNode;
                Xj = false;
                break a;
              case 3:
                X$3 = h3.stateNode.containerInfo;
                Xj = true;
                break a;
              case 4:
                X$3 = h3.stateNode.containerInfo;
                Xj = true;
                break a;
            }
            h3 = h3.return;
          }
        if (null === X$3)
          throw Error(p$7(160));
        Zj(f2, g2, e2);
        X$3 = null;
        Xj = false;
        var k2 = e2.alternate;
        null !== k2 && (k2.return = null);
        e2.return = null;
      } catch (l2) {
        W$4(e2, b2, l2);
      }
    }
  if (b2.subtreeFlags & 12854)
    for (b2 = b2.child; null !== b2; )
      dk(b2, a2), b2 = b2.sibling;
}
function dk(a2, b2) {
  var c2 = a2.alternate, d2 = a2.flags;
  switch (a2.tag) {
    case 0:
    case 11:
    case 14:
    case 15:
      ck(b2, a2);
      ek(a2);
      if (d2 & 4) {
        try {
          Pj(3, a2, a2.return), Qj(3, a2);
        } catch (t2) {
          W$4(a2, a2.return, t2);
        }
        try {
          Pj(5, a2, a2.return);
        } catch (t2) {
          W$4(a2, a2.return, t2);
        }
      }
      break;
    case 1:
      ck(b2, a2);
      ek(a2);
      d2 & 512 && null !== c2 && Lj(c2, c2.return);
      break;
    case 5:
      ck(b2, a2);
      ek(a2);
      d2 & 512 && null !== c2 && Lj(c2, c2.return);
      if (a2.flags & 32) {
        var e2 = a2.stateNode;
        try {
          ob$2(e2, "");
        } catch (t2) {
          W$4(a2, a2.return, t2);
        }
      }
      if (d2 & 4 && (e2 = a2.stateNode, null != e2)) {
        var f2 = a2.memoizedProps, g2 = null !== c2 ? c2.memoizedProps : f2, h3 = a2.type, k2 = a2.updateQueue;
        a2.updateQueue = null;
        if (null !== k2)
          try {
            "input" === h3 && "radio" === f2.type && null != f2.name && ab$2(e2, f2);
            vb$2(h3, g2);
            var l2 = vb$2(h3, f2);
            for (g2 = 0; g2 < k2.length; g2 += 2) {
              var m2 = k2[g2], q2 = k2[g2 + 1];
              "style" === m2 ? sb$2(e2, q2) : "dangerouslySetInnerHTML" === m2 ? nb$1(e2, q2) : "children" === m2 ? ob$2(e2, q2) : ta$2(e2, m2, q2, l2);
            }
            switch (h3) {
              case "input":
                bb$2(e2, f2);
                break;
              case "textarea":
                ib$2(e2, f2);
                break;
              case "select":
                var r2 = e2._wrapperState.wasMultiple;
                e2._wrapperState.wasMultiple = !!f2.multiple;
                var y2 = f2.value;
                null != y2 ? fb$2(e2, !!f2.multiple, y2, false) : r2 !== !!f2.multiple && (null != f2.defaultValue ? fb$2(
                  e2,
                  !!f2.multiple,
                  f2.defaultValue,
                  true
                ) : fb$2(e2, !!f2.multiple, f2.multiple ? [] : "", false));
            }
            e2[Pf] = f2;
          } catch (t2) {
            W$4(a2, a2.return, t2);
          }
      }
      break;
    case 6:
      ck(b2, a2);
      ek(a2);
      if (d2 & 4) {
        if (null === a2.stateNode)
          throw Error(p$7(162));
        e2 = a2.stateNode;
        f2 = a2.memoizedProps;
        try {
          e2.nodeValue = f2;
        } catch (t2) {
          W$4(a2, a2.return, t2);
        }
      }
      break;
    case 3:
      ck(b2, a2);
      ek(a2);
      if (d2 & 4 && null !== c2 && c2.memoizedState.isDehydrated)
        try {
          bd$1(b2.containerInfo);
        } catch (t2) {
          W$4(a2, a2.return, t2);
        }
      break;
    case 4:
      ck(b2, a2);
      ek(a2);
      break;
    case 13:
      ck(b2, a2);
      ek(a2);
      e2 = a2.child;
      e2.flags & 8192 && (f2 = null !== e2.memoizedState, e2.stateNode.isHidden = f2, !f2 || null !== e2.alternate && null !== e2.alternate.memoizedState || (fk = B$3()));
      d2 & 4 && ak(a2);
      break;
    case 22:
      m2 = null !== c2 && null !== c2.memoizedState;
      a2.mode & 1 ? (U$4 = (l2 = U$4) || m2, ck(b2, a2), U$4 = l2) : ck(b2, a2);
      ek(a2);
      if (d2 & 8192) {
        l2 = null !== a2.memoizedState;
        if ((a2.stateNode.isHidden = l2) && !m2 && 0 !== (a2.mode & 1))
          for (V$3 = a2, m2 = a2.child; null !== m2; ) {
            for (q2 = V$3 = m2; null !== V$3; ) {
              r2 = V$3;
              y2 = r2.child;
              switch (r2.tag) {
                case 0:
                case 11:
                case 14:
                case 15:
                  Pj(4, r2, r2.return);
                  break;
                case 1:
                  Lj(r2, r2.return);
                  var n2 = r2.stateNode;
                  if ("function" === typeof n2.componentWillUnmount) {
                    d2 = r2;
                    c2 = r2.return;
                    try {
                      b2 = d2, n2.props = b2.memoizedProps, n2.state = b2.memoizedState, n2.componentWillUnmount();
                    } catch (t2) {
                      W$4(d2, c2, t2);
                    }
                  }
                  break;
                case 5:
                  Lj(r2, r2.return);
                  break;
                case 22:
                  if (null !== r2.memoizedState) {
                    gk(q2);
                    continue;
                  }
              }
              null !== y2 ? (y2.return = r2, V$3 = y2) : gk(q2);
            }
            m2 = m2.sibling;
          }
        a:
          for (m2 = null, q2 = a2; ; ) {
            if (5 === q2.tag) {
              if (null === m2) {
                m2 = q2;
                try {
                  e2 = q2.stateNode, l2 ? (f2 = e2.style, "function" === typeof f2.setProperty ? f2.setProperty("display", "none", "important") : f2.display = "none") : (h3 = q2.stateNode, k2 = q2.memoizedProps.style, g2 = void 0 !== k2 && null !== k2 && k2.hasOwnProperty("display") ? k2.display : null, h3.style.display = rb$2("display", g2));
                } catch (t2) {
                  W$4(a2, a2.return, t2);
                }
              }
            } else if (6 === q2.tag) {
              if (null === m2)
                try {
                  q2.stateNode.nodeValue = l2 ? "" : q2.memoizedProps;
                } catch (t2) {
                  W$4(a2, a2.return, t2);
                }
            } else if ((22 !== q2.tag && 23 !== q2.tag || null === q2.memoizedState || q2 === a2) && null !== q2.child) {
              q2.child.return = q2;
              q2 = q2.child;
              continue;
            }
            if (q2 === a2)
              break a;
            for (; null === q2.sibling; ) {
              if (null === q2.return || q2.return === a2)
                break a;
              m2 === q2 && (m2 = null);
              q2 = q2.return;
            }
            m2 === q2 && (m2 = null);
            q2.sibling.return = q2.return;
            q2 = q2.sibling;
          }
      }
      break;
    case 19:
      ck(b2, a2);
      ek(a2);
      d2 & 4 && ak(a2);
      break;
    case 21:
      break;
    default:
      ck(
        b2,
        a2
      ), ek(a2);
  }
}
function ek(a2) {
  var b2 = a2.flags;
  if (b2 & 2) {
    try {
      a: {
        for (var c2 = a2.return; null !== c2; ) {
          if (Tj(c2)) {
            var d2 = c2;
            break a;
          }
          c2 = c2.return;
        }
        throw Error(p$7(160));
      }
      switch (d2.tag) {
        case 5:
          var e2 = d2.stateNode;
          d2.flags & 32 && (ob$2(e2, ""), d2.flags &= -33);
          var f2 = Uj(a2);
          Wj(a2, f2, e2);
          break;
        case 3:
        case 4:
          var g2 = d2.stateNode.containerInfo, h3 = Uj(a2);
          Vj(a2, h3, g2);
          break;
        default:
          throw Error(p$7(161));
      }
    } catch (k2) {
      W$4(a2, a2.return, k2);
    }
    a2.flags &= -3;
  }
  b2 & 4096 && (a2.flags &= -4097);
}
function hk(a2, b2, c2) {
  V$3 = a2;
  ik(a2);
}
function ik(a2, b2, c2) {
  for (var d2 = 0 !== (a2.mode & 1); null !== V$3; ) {
    var e2 = V$3, f2 = e2.child;
    if (22 === e2.tag && d2) {
      var g2 = null !== e2.memoizedState || Jj;
      if (!g2) {
        var h3 = e2.alternate, k2 = null !== h3 && null !== h3.memoizedState || U$4;
        h3 = Jj;
        var l2 = U$4;
        Jj = g2;
        if ((U$4 = k2) && !l2)
          for (V$3 = e2; null !== V$3; )
            g2 = V$3, k2 = g2.child, 22 === g2.tag && null !== g2.memoizedState ? jk(e2) : null !== k2 ? (k2.return = g2, V$3 = k2) : jk(e2);
        for (; null !== f2; )
          V$3 = f2, ik(f2), f2 = f2.sibling;
        V$3 = e2;
        Jj = h3;
        U$4 = l2;
      }
      kk(a2);
    } else
      0 !== (e2.subtreeFlags & 8772) && null !== f2 ? (f2.return = e2, V$3 = f2) : kk(a2);
  }
}
function kk(a2) {
  for (; null !== V$3; ) {
    var b2 = V$3;
    if (0 !== (b2.flags & 8772)) {
      var c2 = b2.alternate;
      try {
        if (0 !== (b2.flags & 8772))
          switch (b2.tag) {
            case 0:
            case 11:
            case 15:
              U$4 || Qj(5, b2);
              break;
            case 1:
              var d2 = b2.stateNode;
              if (b2.flags & 4 && !U$4)
                if (null === c2)
                  d2.componentDidMount();
                else {
                  var e2 = b2.elementType === b2.type ? c2.memoizedProps : Ci(b2.type, c2.memoizedProps);
                  d2.componentDidUpdate(e2, c2.memoizedState, d2.__reactInternalSnapshotBeforeUpdate);
                }
              var f2 = b2.updateQueue;
              null !== f2 && sh(b2, f2, d2);
              break;
            case 3:
              var g2 = b2.updateQueue;
              if (null !== g2) {
                c2 = null;
                if (null !== b2.child)
                  switch (b2.child.tag) {
                    case 5:
                      c2 = b2.child.stateNode;
                      break;
                    case 1:
                      c2 = b2.child.stateNode;
                  }
                sh(b2, g2, c2);
              }
              break;
            case 5:
              var h3 = b2.stateNode;
              if (null === c2 && b2.flags & 4) {
                c2 = h3;
                var k2 = b2.memoizedProps;
                switch (b2.type) {
                  case "button":
                  case "input":
                  case "select":
                  case "textarea":
                    k2.autoFocus && c2.focus();
                    break;
                  case "img":
                    k2.src && (c2.src = k2.src);
                }
              }
              break;
            case 6:
              break;
            case 4:
              break;
            case 12:
              break;
            case 13:
              if (null === b2.memoizedState) {
                var l2 = b2.alternate;
                if (null !== l2) {
                  var m2 = l2.memoizedState;
                  if (null !== m2) {
                    var q2 = m2.dehydrated;
                    null !== q2 && bd$1(q2);
                  }
                }
              }
              break;
            case 19:
            case 17:
            case 21:
            case 22:
            case 23:
            case 25:
              break;
            default:
              throw Error(p$7(163));
          }
        U$4 || b2.flags & 512 && Rj(b2);
      } catch (r2) {
        W$4(b2, b2.return, r2);
      }
    }
    if (b2 === a2) {
      V$3 = null;
      break;
    }
    c2 = b2.sibling;
    if (null !== c2) {
      c2.return = b2.return;
      V$3 = c2;
      break;
    }
    V$3 = b2.return;
  }
}
function gk(a2) {
  for (; null !== V$3; ) {
    var b2 = V$3;
    if (b2 === a2) {
      V$3 = null;
      break;
    }
    var c2 = b2.sibling;
    if (null !== c2) {
      c2.return = b2.return;
      V$3 = c2;
      break;
    }
    V$3 = b2.return;
  }
}
function jk(a2) {
  for (; null !== V$3; ) {
    var b2 = V$3;
    try {
      switch (b2.tag) {
        case 0:
        case 11:
        case 15:
          var c2 = b2.return;
          try {
            Qj(4, b2);
          } catch (k2) {
            W$4(b2, c2, k2);
          }
          break;
        case 1:
          var d2 = b2.stateNode;
          if ("function" === typeof d2.componentDidMount) {
            var e2 = b2.return;
            try {
              d2.componentDidMount();
            } catch (k2) {
              W$4(b2, e2, k2);
            }
          }
          var f2 = b2.return;
          try {
            Rj(b2);
          } catch (k2) {
            W$4(b2, f2, k2);
          }
          break;
        case 5:
          var g2 = b2.return;
          try {
            Rj(b2);
          } catch (k2) {
            W$4(b2, g2, k2);
          }
      }
    } catch (k2) {
      W$4(b2, b2.return, k2);
    }
    if (b2 === a2) {
      V$3 = null;
      break;
    }
    var h3 = b2.sibling;
    if (null !== h3) {
      h3.return = b2.return;
      V$3 = h3;
      break;
    }
    V$3 = b2.return;
  }
}
var lk = Math.ceil, mk = ua$2.ReactCurrentDispatcher, nk = ua$2.ReactCurrentOwner, ok$2 = ua$2.ReactCurrentBatchConfig, K$2 = 0, Q$3 = null, Y$3 = null, Z$3 = 0, fj = 0, ej = Uf(0), T$2 = 0, pk = null, rh = 0, qk = 0, rk = 0, sk = null, tk = null, fk = 0, Gj = Infinity, uk = null, Oi = false, Pi = null, Ri = null, vk = false, wk = null, xk = 0, yk = 0, zk = null, Ak = -1, Bk = 0;
function R$4() {
  return 0 !== (K$2 & 6) ? B$3() : -1 !== Ak ? Ak : Ak = B$3();
}
function yi(a2) {
  if (0 === (a2.mode & 1))
    return 1;
  if (0 !== (K$2 & 2) && 0 !== Z$3)
    return Z$3 & -Z$3;
  if (null !== Kg.transition)
    return 0 === Bk && (Bk = yc$1()), Bk;
  a2 = C$1;
  if (0 !== a2)
    return a2;
  a2 = window.event;
  a2 = void 0 === a2 ? 16 : jd$1(a2.type);
  return a2;
}
function gi(a2, b2, c2, d2) {
  if (50 < yk)
    throw yk = 0, zk = null, Error(p$7(185));
  Ac$1(a2, c2, d2);
  if (0 === (K$2 & 2) || a2 !== Q$3)
    a2 === Q$3 && (0 === (K$2 & 2) && (qk |= c2), 4 === T$2 && Ck(a2, Z$3)), Dk(a2, d2), 1 === c2 && 0 === K$2 && 0 === (b2.mode & 1) && (Gj = B$3() + 500, fg && jg());
}
function Dk(a2, b2) {
  var c2 = a2.callbackNode;
  wc$1(a2, b2);
  var d2 = uc$1(a2, a2 === Q$3 ? Z$3 : 0);
  if (0 === d2)
    null !== c2 && bc$1(c2), a2.callbackNode = null, a2.callbackPriority = 0;
  else if (b2 = d2 & -d2, a2.callbackPriority !== b2) {
    null != c2 && bc$1(c2);
    if (1 === b2)
      0 === a2.tag ? ig(Ek.bind(null, a2)) : hg(Ek.bind(null, a2)), Jf(function() {
        0 === (K$2 & 6) && jg();
      }), c2 = null;
    else {
      switch (Dc$1(d2)) {
        case 1:
          c2 = fc$1;
          break;
        case 4:
          c2 = gc$1;
          break;
        case 16:
          c2 = hc$1;
          break;
        case 536870912:
          c2 = jc$1;
          break;
        default:
          c2 = hc$1;
      }
      c2 = Fk(c2, Gk.bind(null, a2));
    }
    a2.callbackPriority = b2;
    a2.callbackNode = c2;
  }
}
function Gk(a2, b2) {
  Ak = -1;
  Bk = 0;
  if (0 !== (K$2 & 6))
    throw Error(p$7(327));
  var c2 = a2.callbackNode;
  if (Hk() && a2.callbackNode !== c2)
    return null;
  var d2 = uc$1(a2, a2 === Q$3 ? Z$3 : 0);
  if (0 === d2)
    return null;
  if (0 !== (d2 & 30) || 0 !== (d2 & a2.expiredLanes) || b2)
    b2 = Ik(a2, d2);
  else {
    b2 = d2;
    var e2 = K$2;
    K$2 |= 2;
    var f2 = Jk();
    if (Q$3 !== a2 || Z$3 !== b2)
      uk = null, Gj = B$3() + 500, Kk(a2, b2);
    do
      try {
        Lk();
        break;
      } catch (h3) {
        Mk(a2, h3);
      }
    while (1);
    $g();
    mk.current = f2;
    K$2 = e2;
    null !== Y$3 ? b2 = 0 : (Q$3 = null, Z$3 = 0, b2 = T$2);
  }
  if (0 !== b2) {
    2 === b2 && (e2 = xc$1(a2), 0 !== e2 && (d2 = e2, b2 = Nk(a2, e2)));
    if (1 === b2)
      throw c2 = pk, Kk(a2, 0), Ck(a2, d2), Dk(a2, B$3()), c2;
    if (6 === b2)
      Ck(a2, d2);
    else {
      e2 = a2.current.alternate;
      if (0 === (d2 & 30) && !Ok(e2) && (b2 = Ik(a2, d2), 2 === b2 && (f2 = xc$1(a2), 0 !== f2 && (d2 = f2, b2 = Nk(a2, f2))), 1 === b2))
        throw c2 = pk, Kk(a2, 0), Ck(a2, d2), Dk(a2, B$3()), c2;
      a2.finishedWork = e2;
      a2.finishedLanes = d2;
      switch (b2) {
        case 0:
        case 1:
          throw Error(p$7(345));
        case 2:
          Pk(a2, tk, uk);
          break;
        case 3:
          Ck(a2, d2);
          if ((d2 & 130023424) === d2 && (b2 = fk + 500 - B$3(), 10 < b2)) {
            if (0 !== uc$1(a2, 0))
              break;
            e2 = a2.suspendedLanes;
            if ((e2 & d2) !== d2) {
              R$4();
              a2.pingedLanes |= a2.suspendedLanes & e2;
              break;
            }
            a2.timeoutHandle = Ff(Pk.bind(null, a2, tk, uk), b2);
            break;
          }
          Pk(a2, tk, uk);
          break;
        case 4:
          Ck(a2, d2);
          if ((d2 & 4194240) === d2)
            break;
          b2 = a2.eventTimes;
          for (e2 = -1; 0 < d2; ) {
            var g2 = 31 - oc$1(d2);
            f2 = 1 << g2;
            g2 = b2[g2];
            g2 > e2 && (e2 = g2);
            d2 &= ~f2;
          }
          d2 = e2;
          d2 = B$3() - d2;
          d2 = (120 > d2 ? 120 : 480 > d2 ? 480 : 1080 > d2 ? 1080 : 1920 > d2 ? 1920 : 3e3 > d2 ? 3e3 : 4320 > d2 ? 4320 : 1960 * lk(d2 / 1960)) - d2;
          if (10 < d2) {
            a2.timeoutHandle = Ff(Pk.bind(null, a2, tk, uk), d2);
            break;
          }
          Pk(a2, tk, uk);
          break;
        case 5:
          Pk(a2, tk, uk);
          break;
        default:
          throw Error(p$7(329));
      }
    }
  }
  Dk(a2, B$3());
  return a2.callbackNode === c2 ? Gk.bind(null, a2) : null;
}
function Nk(a2, b2) {
  var c2 = sk;
  a2.current.memoizedState.isDehydrated && (Kk(a2, b2).flags |= 256);
  a2 = Ik(a2, b2);
  2 !== a2 && (b2 = tk, tk = c2, null !== b2 && Fj(b2));
  return a2;
}
function Fj(a2) {
  null === tk ? tk = a2 : tk.push.apply(tk, a2);
}
function Ok(a2) {
  for (var b2 = a2; ; ) {
    if (b2.flags & 16384) {
      var c2 = b2.updateQueue;
      if (null !== c2 && (c2 = c2.stores, null !== c2))
        for (var d2 = 0; d2 < c2.length; d2++) {
          var e2 = c2[d2], f2 = e2.getSnapshot;
          e2 = e2.value;
          try {
            if (!He(f2(), e2))
              return false;
          } catch (g2) {
            return false;
          }
        }
    }
    c2 = b2.child;
    if (b2.subtreeFlags & 16384 && null !== c2)
      c2.return = b2, b2 = c2;
    else {
      if (b2 === a2)
        break;
      for (; null === b2.sibling; ) {
        if (null === b2.return || b2.return === a2)
          return true;
        b2 = b2.return;
      }
      b2.sibling.return = b2.return;
      b2 = b2.sibling;
    }
  }
  return true;
}
function Ck(a2, b2) {
  b2 &= ~rk;
  b2 &= ~qk;
  a2.suspendedLanes |= b2;
  a2.pingedLanes &= ~b2;
  for (a2 = a2.expirationTimes; 0 < b2; ) {
    var c2 = 31 - oc$1(b2), d2 = 1 << c2;
    a2[c2] = -1;
    b2 &= ~d2;
  }
}
function Ek(a2) {
  if (0 !== (K$2 & 6))
    throw Error(p$7(327));
  Hk();
  var b2 = uc$1(a2, 0);
  if (0 === (b2 & 1))
    return Dk(a2, B$3()), null;
  var c2 = Ik(a2, b2);
  if (0 !== a2.tag && 2 === c2) {
    var d2 = xc$1(a2);
    0 !== d2 && (b2 = d2, c2 = Nk(a2, d2));
  }
  if (1 === c2)
    throw c2 = pk, Kk(a2, 0), Ck(a2, b2), Dk(a2, B$3()), c2;
  if (6 === c2)
    throw Error(p$7(345));
  a2.finishedWork = a2.current.alternate;
  a2.finishedLanes = b2;
  Pk(a2, tk, uk);
  Dk(a2, B$3());
  return null;
}
function Qk(a2, b2) {
  var c2 = K$2;
  K$2 |= 1;
  try {
    return a2(b2);
  } finally {
    K$2 = c2, 0 === K$2 && (Gj = B$3() + 500, fg && jg());
  }
}
function Rk(a2) {
  null !== wk && 0 === wk.tag && 0 === (K$2 & 6) && Hk();
  var b2 = K$2;
  K$2 |= 1;
  var c2 = ok$2.transition, d2 = C$1;
  try {
    if (ok$2.transition = null, C$1 = 1, a2)
      return a2();
  } finally {
    C$1 = d2, ok$2.transition = c2, K$2 = b2, 0 === (K$2 & 6) && jg();
  }
}
function Hj() {
  fj = ej.current;
  E$3(ej);
}
function Kk(a2, b2) {
  a2.finishedWork = null;
  a2.finishedLanes = 0;
  var c2 = a2.timeoutHandle;
  -1 !== c2 && (a2.timeoutHandle = -1, Gf(c2));
  if (null !== Y$3)
    for (c2 = Y$3.return; null !== c2; ) {
      var d2 = c2;
      wg(d2);
      switch (d2.tag) {
        case 1:
          d2 = d2.type.childContextTypes;
          null !== d2 && void 0 !== d2 && $f();
          break;
        case 3:
          zh();
          E$3(Wf);
          E$3(H$3);
          Eh();
          break;
        case 5:
          Bh(d2);
          break;
        case 4:
          zh();
          break;
        case 13:
          E$3(L$3);
          break;
        case 19:
          E$3(L$3);
          break;
        case 10:
          ah(d2.type._context);
          break;
        case 22:
        case 23:
          Hj();
      }
      c2 = c2.return;
    }
  Q$3 = a2;
  Y$3 = a2 = Pg(a2.current, null);
  Z$3 = fj = b2;
  T$2 = 0;
  pk = null;
  rk = qk = rh = 0;
  tk = sk = null;
  if (null !== fh) {
    for (b2 = 0; b2 < fh.length; b2++)
      if (c2 = fh[b2], d2 = c2.interleaved, null !== d2) {
        c2.interleaved = null;
        var e2 = d2.next, f2 = c2.pending;
        if (null !== f2) {
          var g2 = f2.next;
          f2.next = e2;
          d2.next = g2;
        }
        c2.pending = d2;
      }
    fh = null;
  }
  return a2;
}
function Mk(a2, b2) {
  do {
    var c2 = Y$3;
    try {
      $g();
      Fh.current = Rh;
      if (Ih) {
        for (var d2 = M$5.memoizedState; null !== d2; ) {
          var e2 = d2.queue;
          null !== e2 && (e2.pending = null);
          d2 = d2.next;
        }
        Ih = false;
      }
      Hh = 0;
      O$3 = N$4 = M$5 = null;
      Jh = false;
      Kh = 0;
      nk.current = null;
      if (null === c2 || null === c2.return) {
        T$2 = 1;
        pk = b2;
        Y$3 = null;
        break;
      }
      a: {
        var f2 = a2, g2 = c2.return, h3 = c2, k2 = b2;
        b2 = Z$3;
        h3.flags |= 32768;
        if (null !== k2 && "object" === typeof k2 && "function" === typeof k2.then) {
          var l2 = k2, m2 = h3, q2 = m2.tag;
          if (0 === (m2.mode & 1) && (0 === q2 || 11 === q2 || 15 === q2)) {
            var r2 = m2.alternate;
            r2 ? (m2.updateQueue = r2.updateQueue, m2.memoizedState = r2.memoizedState, m2.lanes = r2.lanes) : (m2.updateQueue = null, m2.memoizedState = null);
          }
          var y2 = Ui(g2);
          if (null !== y2) {
            y2.flags &= -257;
            Vi(y2, g2, h3, f2, b2);
            y2.mode & 1 && Si(f2, l2, b2);
            b2 = y2;
            k2 = l2;
            var n2 = b2.updateQueue;
            if (null === n2) {
              var t2 = /* @__PURE__ */ new Set();
              t2.add(k2);
              b2.updateQueue = t2;
            } else
              n2.add(k2);
            break a;
          } else {
            if (0 === (b2 & 1)) {
              Si(f2, l2, b2);
              tj();
              break a;
            }
            k2 = Error(p$7(426));
          }
        } else if (I$3 && h3.mode & 1) {
          var J2 = Ui(g2);
          if (null !== J2) {
            0 === (J2.flags & 65536) && (J2.flags |= 256);
            Vi(J2, g2, h3, f2, b2);
            Jg(Ji(k2, h3));
            break a;
          }
        }
        f2 = k2 = Ji(k2, h3);
        4 !== T$2 && (T$2 = 2);
        null === sk ? sk = [f2] : sk.push(f2);
        f2 = g2;
        do {
          switch (f2.tag) {
            case 3:
              f2.flags |= 65536;
              b2 &= -b2;
              f2.lanes |= b2;
              var x2 = Ni(f2, k2, b2);
              ph(f2, x2);
              break a;
            case 1:
              h3 = k2;
              var w2 = f2.type, u2 = f2.stateNode;
              if (0 === (f2.flags & 128) && ("function" === typeof w2.getDerivedStateFromError || null !== u2 && "function" === typeof u2.componentDidCatch && (null === Ri || !Ri.has(u2)))) {
                f2.flags |= 65536;
                b2 &= -b2;
                f2.lanes |= b2;
                var F2 = Qi(f2, h3, b2);
                ph(f2, F2);
                break a;
              }
          }
          f2 = f2.return;
        } while (null !== f2);
      }
      Sk(c2);
    } catch (na2) {
      b2 = na2;
      Y$3 === c2 && null !== c2 && (Y$3 = c2 = c2.return);
      continue;
    }
    break;
  } while (1);
}
function Jk() {
  var a2 = mk.current;
  mk.current = Rh;
  return null === a2 ? Rh : a2;
}
function tj() {
  if (0 === T$2 || 3 === T$2 || 2 === T$2)
    T$2 = 4;
  null === Q$3 || 0 === (rh & 268435455) && 0 === (qk & 268435455) || Ck(Q$3, Z$3);
}
function Ik(a2, b2) {
  var c2 = K$2;
  K$2 |= 2;
  var d2 = Jk();
  if (Q$3 !== a2 || Z$3 !== b2)
    uk = null, Kk(a2, b2);
  do
    try {
      Tk();
      break;
    } catch (e2) {
      Mk(a2, e2);
    }
  while (1);
  $g();
  K$2 = c2;
  mk.current = d2;
  if (null !== Y$3)
    throw Error(p$7(261));
  Q$3 = null;
  Z$3 = 0;
  return T$2;
}
function Tk() {
  for (; null !== Y$3; )
    Uk(Y$3);
}
function Lk() {
  for (; null !== Y$3 && !cc$1(); )
    Uk(Y$3);
}
function Uk(a2) {
  var b2 = Vk(a2.alternate, a2, fj);
  a2.memoizedProps = a2.pendingProps;
  null === b2 ? Sk(a2) : Y$3 = b2;
  nk.current = null;
}
function Sk(a2) {
  var b2 = a2;
  do {
    var c2 = b2.alternate;
    a2 = b2.return;
    if (0 === (b2.flags & 32768)) {
      if (c2 = Ej(c2, b2, fj), null !== c2) {
        Y$3 = c2;
        return;
      }
    } else {
      c2 = Ij(c2, b2);
      if (null !== c2) {
        c2.flags &= 32767;
        Y$3 = c2;
        return;
      }
      if (null !== a2)
        a2.flags |= 32768, a2.subtreeFlags = 0, a2.deletions = null;
      else {
        T$2 = 6;
        Y$3 = null;
        return;
      }
    }
    b2 = b2.sibling;
    if (null !== b2) {
      Y$3 = b2;
      return;
    }
    Y$3 = b2 = a2;
  } while (null !== b2);
  0 === T$2 && (T$2 = 5);
}
function Pk(a2, b2, c2) {
  var d2 = C$1, e2 = ok$2.transition;
  try {
    ok$2.transition = null, C$1 = 1, Wk(a2, b2, c2, d2);
  } finally {
    ok$2.transition = e2, C$1 = d2;
  }
  return null;
}
function Wk(a2, b2, c2, d2) {
  do
    Hk();
  while (null !== wk);
  if (0 !== (K$2 & 6))
    throw Error(p$7(327));
  c2 = a2.finishedWork;
  var e2 = a2.finishedLanes;
  if (null === c2)
    return null;
  a2.finishedWork = null;
  a2.finishedLanes = 0;
  if (c2 === a2.current)
    throw Error(p$7(177));
  a2.callbackNode = null;
  a2.callbackPriority = 0;
  var f2 = c2.lanes | c2.childLanes;
  Bc$1(a2, f2);
  a2 === Q$3 && (Y$3 = Q$3 = null, Z$3 = 0);
  0 === (c2.subtreeFlags & 2064) && 0 === (c2.flags & 2064) || vk || (vk = true, Fk(hc$1, function() {
    Hk();
    return null;
  }));
  f2 = 0 !== (c2.flags & 15990);
  if (0 !== (c2.subtreeFlags & 15990) || f2) {
    f2 = ok$2.transition;
    ok$2.transition = null;
    var g2 = C$1;
    C$1 = 1;
    var h3 = K$2;
    K$2 |= 4;
    nk.current = null;
    Oj(a2, c2);
    dk(c2, a2);
    Oe(Df);
    dd$1 = !!Cf;
    Df = Cf = null;
    a2.current = c2;
    hk(c2);
    dc$1();
    K$2 = h3;
    C$1 = g2;
    ok$2.transition = f2;
  } else
    a2.current = c2;
  vk && (vk = false, wk = a2, xk = e2);
  f2 = a2.pendingLanes;
  0 === f2 && (Ri = null);
  mc$1(c2.stateNode);
  Dk(a2, B$3());
  if (null !== b2)
    for (d2 = a2.onRecoverableError, c2 = 0; c2 < b2.length; c2++)
      e2 = b2[c2], d2(e2.value, { componentStack: e2.stack, digest: e2.digest });
  if (Oi)
    throw Oi = false, a2 = Pi, Pi = null, a2;
  0 !== (xk & 1) && 0 !== a2.tag && Hk();
  f2 = a2.pendingLanes;
  0 !== (f2 & 1) ? a2 === zk ? yk++ : (yk = 0, zk = a2) : yk = 0;
  jg();
  return null;
}
function Hk() {
  if (null !== wk) {
    var a2 = Dc$1(xk), b2 = ok$2.transition, c2 = C$1;
    try {
      ok$2.transition = null;
      C$1 = 16 > a2 ? 16 : a2;
      if (null === wk)
        var d2 = false;
      else {
        a2 = wk;
        wk = null;
        xk = 0;
        if (0 !== (K$2 & 6))
          throw Error(p$7(331));
        var e2 = K$2;
        K$2 |= 4;
        for (V$3 = a2.current; null !== V$3; ) {
          var f2 = V$3, g2 = f2.child;
          if (0 !== (V$3.flags & 16)) {
            var h3 = f2.deletions;
            if (null !== h3) {
              for (var k2 = 0; k2 < h3.length; k2++) {
                var l2 = h3[k2];
                for (V$3 = l2; null !== V$3; ) {
                  var m2 = V$3;
                  switch (m2.tag) {
                    case 0:
                    case 11:
                    case 15:
                      Pj(8, m2, f2);
                  }
                  var q2 = m2.child;
                  if (null !== q2)
                    q2.return = m2, V$3 = q2;
                  else
                    for (; null !== V$3; ) {
                      m2 = V$3;
                      var r2 = m2.sibling, y2 = m2.return;
                      Sj(m2);
                      if (m2 === l2) {
                        V$3 = null;
                        break;
                      }
                      if (null !== r2) {
                        r2.return = y2;
                        V$3 = r2;
                        break;
                      }
                      V$3 = y2;
                    }
                }
              }
              var n2 = f2.alternate;
              if (null !== n2) {
                var t2 = n2.child;
                if (null !== t2) {
                  n2.child = null;
                  do {
                    var J2 = t2.sibling;
                    t2.sibling = null;
                    t2 = J2;
                  } while (null !== t2);
                }
              }
              V$3 = f2;
            }
          }
          if (0 !== (f2.subtreeFlags & 2064) && null !== g2)
            g2.return = f2, V$3 = g2;
          else
            b:
              for (; null !== V$3; ) {
                f2 = V$3;
                if (0 !== (f2.flags & 2048))
                  switch (f2.tag) {
                    case 0:
                    case 11:
                    case 15:
                      Pj(9, f2, f2.return);
                  }
                var x2 = f2.sibling;
                if (null !== x2) {
                  x2.return = f2.return;
                  V$3 = x2;
                  break b;
                }
                V$3 = f2.return;
              }
        }
        var w2 = a2.current;
        for (V$3 = w2; null !== V$3; ) {
          g2 = V$3;
          var u2 = g2.child;
          if (0 !== (g2.subtreeFlags & 2064) && null !== u2)
            u2.return = g2, V$3 = u2;
          else
            b:
              for (g2 = w2; null !== V$3; ) {
                h3 = V$3;
                if (0 !== (h3.flags & 2048))
                  try {
                    switch (h3.tag) {
                      case 0:
                      case 11:
                      case 15:
                        Qj(9, h3);
                    }
                  } catch (na2) {
                    W$4(h3, h3.return, na2);
                  }
                if (h3 === g2) {
                  V$3 = null;
                  break b;
                }
                var F2 = h3.sibling;
                if (null !== F2) {
                  F2.return = h3.return;
                  V$3 = F2;
                  break b;
                }
                V$3 = h3.return;
              }
        }
        K$2 = e2;
        jg();
        if (lc$1 && "function" === typeof lc$1.onPostCommitFiberRoot)
          try {
            lc$1.onPostCommitFiberRoot(kc$1, a2);
          } catch (na2) {
          }
        d2 = true;
      }
      return d2;
    } finally {
      C$1 = c2, ok$2.transition = b2;
    }
  }
  return false;
}
function Xk(a2, b2, c2) {
  b2 = Ji(c2, b2);
  b2 = Ni(a2, b2, 1);
  a2 = nh(a2, b2, 1);
  b2 = R$4();
  null !== a2 && (Ac$1(a2, 1, b2), Dk(a2, b2));
}
function W$4(a2, b2, c2) {
  if (3 === a2.tag)
    Xk(a2, a2, c2);
  else
    for (; null !== b2; ) {
      if (3 === b2.tag) {
        Xk(b2, a2, c2);
        break;
      } else if (1 === b2.tag) {
        var d2 = b2.stateNode;
        if ("function" === typeof b2.type.getDerivedStateFromError || "function" === typeof d2.componentDidCatch && (null === Ri || !Ri.has(d2))) {
          a2 = Ji(c2, a2);
          a2 = Qi(b2, a2, 1);
          b2 = nh(b2, a2, 1);
          a2 = R$4();
          null !== b2 && (Ac$1(b2, 1, a2), Dk(b2, a2));
          break;
        }
      }
      b2 = b2.return;
    }
}
function Ti(a2, b2, c2) {
  var d2 = a2.pingCache;
  null !== d2 && d2.delete(b2);
  b2 = R$4();
  a2.pingedLanes |= a2.suspendedLanes & c2;
  Q$3 === a2 && (Z$3 & c2) === c2 && (4 === T$2 || 3 === T$2 && (Z$3 & 130023424) === Z$3 && 500 > B$3() - fk ? Kk(a2, 0) : rk |= c2);
  Dk(a2, b2);
}
function Yk(a2, b2) {
  0 === b2 && (0 === (a2.mode & 1) ? b2 = 1 : (b2 = sc$1, sc$1 <<= 1, 0 === (sc$1 & 130023424) && (sc$1 = 4194304)));
  var c2 = R$4();
  a2 = ih(a2, b2);
  null !== a2 && (Ac$1(a2, b2, c2), Dk(a2, c2));
}
function uj(a2) {
  var b2 = a2.memoizedState, c2 = 0;
  null !== b2 && (c2 = b2.retryLane);
  Yk(a2, c2);
}
function bk(a2, b2) {
  var c2 = 0;
  switch (a2.tag) {
    case 13:
      var d2 = a2.stateNode;
      var e2 = a2.memoizedState;
      null !== e2 && (c2 = e2.retryLane);
      break;
    case 19:
      d2 = a2.stateNode;
      break;
    default:
      throw Error(p$7(314));
  }
  null !== d2 && d2.delete(b2);
  Yk(a2, c2);
}
var Vk;
Vk = function(a2, b2, c2) {
  if (null !== a2)
    if (a2.memoizedProps !== b2.pendingProps || Wf.current)
      dh = true;
    else {
      if (0 === (a2.lanes & c2) && 0 === (b2.flags & 128))
        return dh = false, yj(a2, b2, c2);
      dh = 0 !== (a2.flags & 131072) ? true : false;
    }
  else
    dh = false, I$3 && 0 !== (b2.flags & 1048576) && ug(b2, ng, b2.index);
  b2.lanes = 0;
  switch (b2.tag) {
    case 2:
      var d2 = b2.type;
      ij(a2, b2);
      a2 = b2.pendingProps;
      var e2 = Yf(b2, H$3.current);
      ch(b2, c2);
      e2 = Nh(null, b2, d2, a2, e2, c2);
      var f2 = Sh();
      b2.flags |= 1;
      "object" === typeof e2 && null !== e2 && "function" === typeof e2.render && void 0 === e2.$$typeof ? (b2.tag = 1, b2.memoizedState = null, b2.updateQueue = null, Zf(d2) ? (f2 = true, cg(b2)) : f2 = false, b2.memoizedState = null !== e2.state && void 0 !== e2.state ? e2.state : null, kh(b2), e2.updater = Ei, b2.stateNode = e2, e2._reactInternals = b2, Ii(b2, d2, a2, c2), b2 = jj(null, b2, d2, true, f2, c2)) : (b2.tag = 0, I$3 && f2 && vg(b2), Xi(null, b2, e2, c2), b2 = b2.child);
      return b2;
    case 16:
      d2 = b2.elementType;
      a: {
        ij(a2, b2);
        a2 = b2.pendingProps;
        e2 = d2._init;
        d2 = e2(d2._payload);
        b2.type = d2;
        e2 = b2.tag = Zk(d2);
        a2 = Ci(d2, a2);
        switch (e2) {
          case 0:
            b2 = cj(null, b2, d2, a2, c2);
            break a;
          case 1:
            b2 = hj(null, b2, d2, a2, c2);
            break a;
          case 11:
            b2 = Yi(null, b2, d2, a2, c2);
            break a;
          case 14:
            b2 = $i(null, b2, d2, Ci(d2.type, a2), c2);
            break a;
        }
        throw Error(p$7(
          306,
          d2,
          ""
        ));
      }
      return b2;
    case 0:
      return d2 = b2.type, e2 = b2.pendingProps, e2 = b2.elementType === d2 ? e2 : Ci(d2, e2), cj(a2, b2, d2, e2, c2);
    case 1:
      return d2 = b2.type, e2 = b2.pendingProps, e2 = b2.elementType === d2 ? e2 : Ci(d2, e2), hj(a2, b2, d2, e2, c2);
    case 3:
      a: {
        kj(b2);
        if (null === a2)
          throw Error(p$7(387));
        d2 = b2.pendingProps;
        f2 = b2.memoizedState;
        e2 = f2.element;
        lh(a2, b2);
        qh(b2, d2, null, c2);
        var g2 = b2.memoizedState;
        d2 = g2.element;
        if (f2.isDehydrated)
          if (f2 = { element: d2, isDehydrated: false, cache: g2.cache, pendingSuspenseBoundaries: g2.pendingSuspenseBoundaries, transitions: g2.transitions }, b2.updateQueue.baseState = f2, b2.memoizedState = f2, b2.flags & 256) {
            e2 = Ji(Error(p$7(423)), b2);
            b2 = lj(a2, b2, d2, c2, e2);
            break a;
          } else if (d2 !== e2) {
            e2 = Ji(Error(p$7(424)), b2);
            b2 = lj(a2, b2, d2, c2, e2);
            break a;
          } else
            for (yg = Lf(b2.stateNode.containerInfo.firstChild), xg = b2, I$3 = true, zg = null, c2 = Vg(b2, null, d2, c2), b2.child = c2; c2; )
              c2.flags = c2.flags & -3 | 4096, c2 = c2.sibling;
        else {
          Ig();
          if (d2 === e2) {
            b2 = Zi(a2, b2, c2);
            break a;
          }
          Xi(a2, b2, d2, c2);
        }
        b2 = b2.child;
      }
      return b2;
    case 5:
      return Ah(b2), null === a2 && Eg(b2), d2 = b2.type, e2 = b2.pendingProps, f2 = null !== a2 ? a2.memoizedProps : null, g2 = e2.children, Ef(d2, e2) ? g2 = null : null !== f2 && Ef(d2, f2) && (b2.flags |= 32), gj(a2, b2), Xi(a2, b2, g2, c2), b2.child;
    case 6:
      return null === a2 && Eg(b2), null;
    case 13:
      return oj(a2, b2, c2);
    case 4:
      return yh(b2, b2.stateNode.containerInfo), d2 = b2.pendingProps, null === a2 ? b2.child = Ug(b2, null, d2, c2) : Xi(a2, b2, d2, c2), b2.child;
    case 11:
      return d2 = b2.type, e2 = b2.pendingProps, e2 = b2.elementType === d2 ? e2 : Ci(d2, e2), Yi(a2, b2, d2, e2, c2);
    case 7:
      return Xi(a2, b2, b2.pendingProps, c2), b2.child;
    case 8:
      return Xi(a2, b2, b2.pendingProps.children, c2), b2.child;
    case 12:
      return Xi(a2, b2, b2.pendingProps.children, c2), b2.child;
    case 10:
      a: {
        d2 = b2.type._context;
        e2 = b2.pendingProps;
        f2 = b2.memoizedProps;
        g2 = e2.value;
        G$2(Wg, d2._currentValue);
        d2._currentValue = g2;
        if (null !== f2)
          if (He(f2.value, g2)) {
            if (f2.children === e2.children && !Wf.current) {
              b2 = Zi(a2, b2, c2);
              break a;
            }
          } else
            for (f2 = b2.child, null !== f2 && (f2.return = b2); null !== f2; ) {
              var h3 = f2.dependencies;
              if (null !== h3) {
                g2 = f2.child;
                for (var k2 = h3.firstContext; null !== k2; ) {
                  if (k2.context === d2) {
                    if (1 === f2.tag) {
                      k2 = mh(-1, c2 & -c2);
                      k2.tag = 2;
                      var l2 = f2.updateQueue;
                      if (null !== l2) {
                        l2 = l2.shared;
                        var m2 = l2.pending;
                        null === m2 ? k2.next = k2 : (k2.next = m2.next, m2.next = k2);
                        l2.pending = k2;
                      }
                    }
                    f2.lanes |= c2;
                    k2 = f2.alternate;
                    null !== k2 && (k2.lanes |= c2);
                    bh(
                      f2.return,
                      c2,
                      b2
                    );
                    h3.lanes |= c2;
                    break;
                  }
                  k2 = k2.next;
                }
              } else if (10 === f2.tag)
                g2 = f2.type === b2.type ? null : f2.child;
              else if (18 === f2.tag) {
                g2 = f2.return;
                if (null === g2)
                  throw Error(p$7(341));
                g2.lanes |= c2;
                h3 = g2.alternate;
                null !== h3 && (h3.lanes |= c2);
                bh(g2, c2, b2);
                g2 = f2.sibling;
              } else
                g2 = f2.child;
              if (null !== g2)
                g2.return = f2;
              else
                for (g2 = f2; null !== g2; ) {
                  if (g2 === b2) {
                    g2 = null;
                    break;
                  }
                  f2 = g2.sibling;
                  if (null !== f2) {
                    f2.return = g2.return;
                    g2 = f2;
                    break;
                  }
                  g2 = g2.return;
                }
              f2 = g2;
            }
        Xi(a2, b2, e2.children, c2);
        b2 = b2.child;
      }
      return b2;
    case 9:
      return e2 = b2.type, d2 = b2.pendingProps.children, ch(b2, c2), e2 = eh(e2), d2 = d2(e2), b2.flags |= 1, Xi(a2, b2, d2, c2), b2.child;
    case 14:
      return d2 = b2.type, e2 = Ci(d2, b2.pendingProps), e2 = Ci(d2.type, e2), $i(a2, b2, d2, e2, c2);
    case 15:
      return bj(a2, b2, b2.type, b2.pendingProps, c2);
    case 17:
      return d2 = b2.type, e2 = b2.pendingProps, e2 = b2.elementType === d2 ? e2 : Ci(d2, e2), ij(a2, b2), b2.tag = 1, Zf(d2) ? (a2 = true, cg(b2)) : a2 = false, ch(b2, c2), Gi(b2, d2, e2), Ii(b2, d2, e2, c2), jj(null, b2, d2, true, a2, c2);
    case 19:
      return xj(a2, b2, c2);
    case 22:
      return dj(a2, b2, c2);
  }
  throw Error(p$7(156, b2.tag));
};
function Fk(a2, b2) {
  return ac$1(a2, b2);
}
function $k(a2, b2, c2, d2) {
  this.tag = a2;
  this.key = c2;
  this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null;
  this.index = 0;
  this.ref = null;
  this.pendingProps = b2;
  this.dependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null;
  this.mode = d2;
  this.subtreeFlags = this.flags = 0;
  this.deletions = null;
  this.childLanes = this.lanes = 0;
  this.alternate = null;
}
function Bg(a2, b2, c2, d2) {
  return new $k(a2, b2, c2, d2);
}
function aj(a2) {
  a2 = a2.prototype;
  return !(!a2 || !a2.isReactComponent);
}
function Zk(a2) {
  if ("function" === typeof a2)
    return aj(a2) ? 1 : 0;
  if (void 0 !== a2 && null !== a2) {
    a2 = a2.$$typeof;
    if (a2 === Da$2)
      return 11;
    if (a2 === Ga$2)
      return 14;
  }
  return 2;
}
function Pg(a2, b2) {
  var c2 = a2.alternate;
  null === c2 ? (c2 = Bg(a2.tag, b2, a2.key, a2.mode), c2.elementType = a2.elementType, c2.type = a2.type, c2.stateNode = a2.stateNode, c2.alternate = a2, a2.alternate = c2) : (c2.pendingProps = b2, c2.type = a2.type, c2.flags = 0, c2.subtreeFlags = 0, c2.deletions = null);
  c2.flags = a2.flags & 14680064;
  c2.childLanes = a2.childLanes;
  c2.lanes = a2.lanes;
  c2.child = a2.child;
  c2.memoizedProps = a2.memoizedProps;
  c2.memoizedState = a2.memoizedState;
  c2.updateQueue = a2.updateQueue;
  b2 = a2.dependencies;
  c2.dependencies = null === b2 ? null : { lanes: b2.lanes, firstContext: b2.firstContext };
  c2.sibling = a2.sibling;
  c2.index = a2.index;
  c2.ref = a2.ref;
  return c2;
}
function Rg(a2, b2, c2, d2, e2, f2) {
  var g2 = 2;
  d2 = a2;
  if ("function" === typeof a2)
    aj(a2) && (g2 = 1);
  else if ("string" === typeof a2)
    g2 = 5;
  else
    a:
      switch (a2) {
        case ya$2:
          return Tg(c2.children, e2, f2, b2);
        case za$2:
          g2 = 8;
          e2 |= 8;
          break;
        case Aa$2:
          return a2 = Bg(12, c2, b2, e2 | 2), a2.elementType = Aa$2, a2.lanes = f2, a2;
        case Ea$2:
          return a2 = Bg(13, c2, b2, e2), a2.elementType = Ea$2, a2.lanes = f2, a2;
        case Fa$2:
          return a2 = Bg(19, c2, b2, e2), a2.elementType = Fa$2, a2.lanes = f2, a2;
        case Ia$2:
          return pj(c2, e2, f2, b2);
        default:
          if ("object" === typeof a2 && null !== a2)
            switch (a2.$$typeof) {
              case Ba$2:
                g2 = 10;
                break a;
              case Ca$2:
                g2 = 9;
                break a;
              case Da$2:
                g2 = 11;
                break a;
              case Ga$2:
                g2 = 14;
                break a;
              case Ha$2:
                g2 = 16;
                d2 = null;
                break a;
            }
          throw Error(p$7(130, null == a2 ? a2 : typeof a2, ""));
      }
  b2 = Bg(g2, c2, b2, e2);
  b2.elementType = a2;
  b2.type = d2;
  b2.lanes = f2;
  return b2;
}
function Tg(a2, b2, c2, d2) {
  a2 = Bg(7, a2, d2, b2);
  a2.lanes = c2;
  return a2;
}
function pj(a2, b2, c2, d2) {
  a2 = Bg(22, a2, d2, b2);
  a2.elementType = Ia$2;
  a2.lanes = c2;
  a2.stateNode = { isHidden: false };
  return a2;
}
function Qg(a2, b2, c2) {
  a2 = Bg(6, a2, null, b2);
  a2.lanes = c2;
  return a2;
}
function Sg(a2, b2, c2) {
  b2 = Bg(4, null !== a2.children ? a2.children : [], a2.key, b2);
  b2.lanes = c2;
  b2.stateNode = { containerInfo: a2.containerInfo, pendingChildren: null, implementation: a2.implementation };
  return b2;
}
function al(a2, b2, c2, d2, e2) {
  this.tag = b2;
  this.containerInfo = a2;
  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 = d2;
  this.onRecoverableError = e2;
  this.mutableSourceEagerHydrationData = null;
}
function bl(a2, b2, c2, d2, e2, f2, g2, h3, k2) {
  a2 = new al(a2, b2, c2, h3, k2);
  1 === b2 ? (b2 = 1, true === f2 && (b2 |= 8)) : b2 = 0;
  f2 = Bg(3, null, null, b2);
  a2.current = f2;
  f2.stateNode = a2;
  f2.memoizedState = { element: d2, isDehydrated: c2, cache: null, transitions: null, pendingSuspenseBoundaries: null };
  kh(f2);
  return a2;
}
function cl(a2, b2, c2) {
  var d2 = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null;
  return { $$typeof: wa$2, key: null == d2 ? null : "" + d2, children: a2, containerInfo: b2, implementation: c2 };
}
function dl(a2) {
  if (!a2)
    return Vf;
  a2 = a2._reactInternals;
  a: {
    if (Vb$1(a2) !== a2 || 1 !== a2.tag)
      throw Error(p$7(170));
    var b2 = a2;
    do {
      switch (b2.tag) {
        case 3:
          b2 = b2.stateNode.context;
          break a;
        case 1:
          if (Zf(b2.type)) {
            b2 = b2.stateNode.__reactInternalMemoizedMergedChildContext;
            break a;
          }
      }
      b2 = b2.return;
    } while (null !== b2);
    throw Error(p$7(171));
  }
  if (1 === a2.tag) {
    var c2 = a2.type;
    if (Zf(c2))
      return bg(a2, c2, b2);
  }
  return b2;
}
function el(a2, b2, c2, d2, e2, f2, g2, h3, k2) {
  a2 = bl(c2, d2, true, a2, e2, f2, g2, h3, k2);
  a2.context = dl(null);
  c2 = a2.current;
  d2 = R$4();
  e2 = yi(c2);
  f2 = mh(d2, e2);
  f2.callback = void 0 !== b2 && null !== b2 ? b2 : null;
  nh(c2, f2, e2);
  a2.current.lanes = e2;
  Ac$1(a2, e2, d2);
  Dk(a2, d2);
  return a2;
}
function fl(a2, b2, c2, d2) {
  var e2 = b2.current, f2 = R$4(), g2 = yi(e2);
  c2 = dl(c2);
  null === b2.context ? b2.context = c2 : b2.pendingContext = c2;
  b2 = mh(f2, g2);
  b2.payload = { element: a2 };
  d2 = void 0 === d2 ? null : d2;
  null !== d2 && (b2.callback = d2);
  a2 = nh(e2, b2, g2);
  null !== a2 && (gi(a2, e2, g2, f2), oh(a2, e2, g2));
  return g2;
}
function gl(a2) {
  a2 = a2.current;
  if (!a2.child)
    return null;
  switch (a2.child.tag) {
    case 5:
      return a2.child.stateNode;
    default:
      return a2.child.stateNode;
  }
}
function hl(a2, b2) {
  a2 = a2.memoizedState;
  if (null !== a2 && null !== a2.dehydrated) {
    var c2 = a2.retryLane;
    a2.retryLane = 0 !== c2 && c2 < b2 ? c2 : b2;
  }
}
function il(a2, b2) {
  hl(a2, b2);
  (a2 = a2.alternate) && hl(a2, b2);
}
function jl() {
  return null;
}
var kl = "function" === typeof reportError ? reportError : function(a2) {
  console.error(a2);
};
function ll(a2) {
  this._internalRoot = a2;
}
ml.prototype.render = ll.prototype.render = function(a2) {
  var b2 = this._internalRoot;
  if (null === b2)
    throw Error(p$7(409));
  fl(a2, b2, null, null);
};
ml.prototype.unmount = ll.prototype.unmount = function() {
  var a2 = this._internalRoot;
  if (null !== a2) {
    this._internalRoot = null;
    var b2 = a2.containerInfo;
    Rk(function() {
      fl(null, a2, null, null);
    });
    b2[uf] = null;
  }
};
function ml(a2) {
  this._internalRoot = a2;
}
ml.prototype.unstable_scheduleHydration = function(a2) {
  if (a2) {
    var b2 = Hc$1();
    a2 = { blockedOn: null, target: a2, priority: b2 };
    for (var c2 = 0; c2 < Qc$1.length && 0 !== b2 && b2 < Qc$1[c2].priority; c2++)
      ;
    Qc$1.splice(c2, 0, a2);
    0 === c2 && Vc$1(a2);
  }
};
function nl(a2) {
  return !(!a2 || 1 !== a2.nodeType && 9 !== a2.nodeType && 11 !== a2.nodeType);
}
function ol(a2) {
  return !(!a2 || 1 !== a2.nodeType && 9 !== a2.nodeType && 11 !== a2.nodeType && (8 !== a2.nodeType || " react-mount-point-unstable " !== a2.nodeValue));
}
function pl() {
}
function ql(a2, b2, c2, d2, e2) {
  if (e2) {
    if ("function" === typeof d2) {
      var f2 = d2;
      d2 = function() {
        var a3 = gl(g2);
        f2.call(a3);
      };
    }
    var g2 = el(b2, d2, a2, 0, null, false, false, "", pl);
    a2._reactRootContainer = g2;
    a2[uf] = g2.current;
    sf(8 === a2.nodeType ? a2.parentNode : a2);
    Rk();
    return g2;
  }
  for (; e2 = a2.lastChild; )
    a2.removeChild(e2);
  if ("function" === typeof d2) {
    var h3 = d2;
    d2 = function() {
      var a3 = gl(k2);
      h3.call(a3);
    };
  }
  var k2 = bl(a2, 0, false, null, null, false, false, "", pl);
  a2._reactRootContainer = k2;
  a2[uf] = k2.current;
  sf(8 === a2.nodeType ? a2.parentNode : a2);
  Rk(function() {
    fl(b2, k2, c2, d2);
  });
  return k2;
}
function rl(a2, b2, c2, d2, e2) {
  var f2 = c2._reactRootContainer;
  if (f2) {
    var g2 = f2;
    if ("function" === typeof e2) {
      var h3 = e2;
      e2 = function() {
        var a3 = gl(g2);
        h3.call(a3);
      };
    }
    fl(b2, g2, a2, e2);
  } else
    g2 = ql(c2, b2, a2, e2, d2);
  return gl(g2);
}
Ec$1 = function(a2) {
  switch (a2.tag) {
    case 3:
      var b2 = a2.stateNode;
      if (b2.current.memoizedState.isDehydrated) {
        var c2 = tc$1(b2.pendingLanes);
        0 !== c2 && (Cc$1(b2, c2 | 1), Dk(b2, B$3()), 0 === (K$2 & 6) && (Gj = B$3() + 500, jg()));
      }
      break;
    case 13:
      Rk(function() {
        var b3 = ih(a2, 1);
        if (null !== b3) {
          var c3 = R$4();
          gi(b3, a2, 1, c3);
        }
      }), il(a2, 1);
  }
};
Fc$1 = function(a2) {
  if (13 === a2.tag) {
    var b2 = ih(a2, 134217728);
    if (null !== b2) {
      var c2 = R$4();
      gi(b2, a2, 134217728, c2);
    }
    il(a2, 134217728);
  }
};
Gc$1 = function(a2) {
  if (13 === a2.tag) {
    var b2 = yi(a2), c2 = ih(a2, b2);
    if (null !== c2) {
      var d2 = R$4();
      gi(c2, a2, b2, d2);
    }
    il(a2, b2);
  }
};
Hc$1 = function() {
  return C$1;
};
Ic$1 = function(a2, b2) {
  var c2 = C$1;
  try {
    return C$1 = a2, b2();
  } finally {
    C$1 = c2;
  }
};
yb$2 = function(a2, b2, c2) {
  switch (b2) {
    case "input":
      bb$2(a2, c2);
      b2 = c2.name;
      if ("radio" === c2.type && null != b2) {
        for (c2 = a2; c2.parentNode; )
          c2 = c2.parentNode;
        c2 = c2.querySelectorAll("input[name=" + JSON.stringify("" + b2) + '][type="radio"]');
        for (b2 = 0; b2 < c2.length; b2++) {
          var d2 = c2[b2];
          if (d2 !== a2 && d2.form === a2.form) {
            var e2 = Db$2(d2);
            if (!e2)
              throw Error(p$7(90));
            Wa$2(d2);
            bb$2(d2, e2);
          }
        }
      }
      break;
    case "textarea":
      ib$2(a2, c2);
      break;
    case "select":
      b2 = c2.value, null != b2 && fb$2(a2, !!c2.multiple, b2, false);
  }
};
Gb$2 = Qk;
Hb$2 = Rk;
var sl = { usingClientEntryPoint: false, Events: [Cb$2, ue$1, Db$2, Eb$2, Fb$1, Qk] }, tl = { findFiberByHostInstance: Wc$1, bundleType: 0, version: "18.3.1", rendererPackageName: "react-dom" };
var ul = { bundleType: tl.bundleType, version: tl.version, rendererPackageName: tl.rendererPackageName, rendererConfig: tl.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, overrideProps: null, overridePropsDeletePath: null, overridePropsRenamePath: null, setErrorHandler: null, setSuspenseHandler: null, scheduleUpdate: null, currentDispatcherRef: ua$2.ReactCurrentDispatcher, findHostInstanceByFiber: function(a2) {
  a2 = Zb$1(a2);
  return null === a2 ? null : a2.stateNode;
}, findFiberByHostInstance: tl.findFiberByHostInstance || jl, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, reconcilerVersion: "18.3.1-next-f1338f8080-20240426" };
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
  var vl = __REACT_DEVTOOLS_GLOBAL_HOOK__;
  if (!vl.isDisabled && vl.supportsFiber)
    try {
      kc$1 = vl.inject(ul), lc$1 = vl;
    } catch (a2) {
    }
}
reactDom_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = sl;
reactDom_production_min.createPortal = function(a2, b2) {
  var c2 = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null;
  if (!nl(b2))
    throw Error(p$7(200));
  return cl(a2, b2, null, c2);
};
reactDom_production_min.createRoot = function(a2, b2) {
  if (!nl(a2))
    throw Error(p$7(299));
  var c2 = false, d2 = "", e2 = kl;
  null !== b2 && void 0 !== b2 && (true === b2.unstable_strictMode && (c2 = true), void 0 !== b2.identifierPrefix && (d2 = b2.identifierPrefix), void 0 !== b2.onRecoverableError && (e2 = b2.onRecoverableError));
  b2 = bl(a2, 1, false, null, null, c2, false, d2, e2);
  a2[uf] = b2.current;
  sf(8 === a2.nodeType ? a2.parentNode : a2);
  return new ll(b2);
};
reactDom_production_min.findDOMNode = function(a2) {
  if (null == a2)
    return null;
  if (1 === a2.nodeType)
    return a2;
  var b2 = a2._reactInternals;
  if (void 0 === b2) {
    if ("function" === typeof a2.render)
      throw Error(p$7(188));
    a2 = Object.keys(a2).join(",");
    throw Error(p$7(268, a2));
  }
  a2 = Zb$1(b2);
  a2 = null === a2 ? null : a2.stateNode;
  return a2;
};
reactDom_production_min.flushSync = function(a2) {
  return Rk(a2);
};
reactDom_production_min.hydrate = function(a2, b2, c2) {
  if (!ol(b2))
    throw Error(p$7(200));
  return rl(null, a2, b2, true, c2);
};
reactDom_production_min.hydrateRoot = function(a2, b2, c2) {
  if (!nl(a2))
    throw Error(p$7(405));
  var d2 = null != c2 && c2.hydratedSources || null, e2 = false, f2 = "", g2 = kl;
  null !== c2 && void 0 !== c2 && (true === c2.unstable_strictMode && (e2 = true), void 0 !== c2.identifierPrefix && (f2 = c2.identifierPrefix), void 0 !== c2.onRecoverableError && (g2 = c2.onRecoverableError));
  b2 = el(b2, null, a2, 1, null != c2 ? c2 : null, e2, false, f2, g2);
  a2[uf] = b2.current;
  sf(a2);
  if (d2)
    for (a2 = 0; a2 < d2.length; a2++)
      c2 = d2[a2], e2 = c2._getVersion, e2 = e2(c2._source), null == b2.mutableSourceEagerHydrationData ? b2.mutableSourceEagerHydrationData = [c2, e2] : b2.mutableSourceEagerHydrationData.push(
        c2,
        e2
      );
  return new ml(b2);
};
reactDom_production_min.render = function(a2, b2, c2) {
  if (!ol(b2))
    throw Error(p$7(200));
  return rl(null, a2, b2, false, c2);
};
reactDom_production_min.unmountComponentAtNode = function(a2) {
  if (!ol(a2))
    throw Error(p$7(40));
  return a2._reactRootContainer ? (Rk(function() {
    rl(null, null, a2, false, function() {
      a2._reactRootContainer = null;
      a2[uf] = null;
    });
  }), true) : false;
};
reactDom_production_min.unstable_batchedUpdates = Qk;
reactDom_production_min.unstable_renderSubtreeIntoContainer = function(a2, b2, c2, d2) {
  if (!ol(c2))
    throw Error(p$7(200));
  if (null == a2 || void 0 === a2._reactInternals)
    throw Error(p$7(38));
  return rl(a2, b2, c2, false, d2);
};
reactDom_production_min.version = "18.3.1-next-f1338f8080-20240426";
function checkDCE() {
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === "undefined" || typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== "function") {
    return;
  }
  try {
    __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);
  } catch (err) {
    console.error(err);
  }
}
{
  checkDCE();
  reactDom.exports = reactDom_production_min;
}
var reactDomExports = reactDom.exports;
const ReactDOM = /* @__PURE__ */ getDefaultExportFromCjs(reactDomExports);
var m$4 = reactDomExports;
{
  client.createRoot = m$4.createRoot;
  client.hydrateRoot = m$4.hydrateRoot;
}
/**
 * @remix-run/router v1.16.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * 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$k() {
  _extends$k = Object.assign ? Object.assign.bind() : function(target) {
    for (var i2 = 1; i2 < arguments.length; i2++) {
      var source2 = arguments[i2];
      for (var key in source2) {
        if (Object.prototype.hasOwnProperty.call(source2, key)) {
          target[key] = source2[key];
        }
      }
    }
    return target;
  };
  return _extends$k.apply(this, arguments);
}
var Action$1;
(function(Action2) {
  Action2["Pop"] = "POP";
  Action2["Push"] = "PUSH";
  Action2["Replace"] = "REPLACE";
})(Action$1 || (Action$1 = {}));
const PopStateEventType = "popstate";
function createHashHistory(options) {
  if (options === void 0) {
    options = {};
  }
  function createHashLocation(window2, globalHistory) {
    let {
      pathname = "/",
      search: search2 = "",
      hash = ""
    } = parsePath(window2.location.hash.substr(1));
    if (!pathname.startsWith("/") && !pathname.startsWith(".")) {
      pathname = "/" + pathname;
    }
    return createLocation(
      "",
      {
        pathname,
        search: search2,
        hash
      },
      // state defaults to `null` because `window.history.state` does
      globalHistory.state && globalHistory.state.usr || null,
      globalHistory.state && globalHistory.state.key || "default"
    );
  }
  function createHashHref(window2, to2) {
    let base = window2.document.querySelector("base");
    let href = "";
    if (base && base.getAttribute("href")) {
      let url2 = window2.location.href;
      let hashIndex = url2.indexOf("#");
      href = hashIndex === -1 ? url2 : url2.slice(0, hashIndex);
    }
    return href + "#" + (typeof to2 === "string" ? to2 : createPath(to2));
  }
  function validateHashLocation(location2, to2) {
    warning$4(location2.pathname.charAt(0) === "/", "relative pathnames are not supported in hash history.push(" + JSON.stringify(to2) + ")");
  }
  return getUrlBasedHistory(createHashLocation, createHashHref, validateHashLocation, options);
}
function invariant$3(value2, message) {
  if (value2 === false || value2 === null || typeof value2 === "undefined") {
    throw new Error(message);
  }
}
function warning$4(cond, message) {
  if (!cond) {
    if (typeof console !== "undefined")
      console.warn(message);
    try {
      throw new Error(message);
    } catch (e2) {
    }
  }
}
function createKey() {
  return Math.random().toString(36).substr(2, 8);
}
function getHistoryState(location2, index2) {
  return {
    usr: location2.state,
    key: location2.key,
    idx: index2
  };
}
function createLocation(current, to2, state, key) {
  if (state === void 0) {
    state = null;
  }
  let location2 = _extends$k({
    pathname: typeof current === "string" ? current : current.pathname,
    search: "",
    hash: ""
  }, typeof to2 === "string" ? parsePath(to2) : to2, {
    state,
    // TODO: This could be cleaned up.  push/replace should probably just take
    // full Locations now and avoid the need to run through this flow at all
    // But that's a pretty big refactor to the current test suite so going to
    // keep as is for the time being and just let any incoming keys take precedence
    key: to2 && to2.key || key || createKey()
  });
  return location2;
}
function createPath(_ref) {
  let {
    pathname = "/",
    search: search2 = "",
    hash = ""
  } = _ref;
  if (search2 && search2 !== "?")
    pathname += search2.charAt(0) === "?" ? search2 : "?" + search2;
  if (hash && hash !== "#")
    pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
  return pathname;
}
function parsePath(path) {
  let parsedPath = {};
  if (path) {
    let hashIndex = path.indexOf("#");
    if (hashIndex >= 0) {
      parsedPath.hash = path.substr(hashIndex);
      path = path.substr(0, hashIndex);
    }
    let searchIndex = path.indexOf("?");
    if (searchIndex >= 0) {
      parsedPath.search = path.substr(searchIndex);
      path = path.substr(0, searchIndex);
    }
    if (path) {
      parsedPath.pathname = path;
    }
  }
  return parsedPath;
}
function getUrlBasedHistory(getLocation, createHref, validateLocation, options) {
  if (options === void 0) {
    options = {};
  }
  let {
    window: window2 = document.defaultView,
    v5Compat = false
  } = options;
  let globalHistory = window2.history;
  let action = Action$1.Pop;
  let listener = null;
  let index2 = getIndex();
  if (index2 == null) {
    index2 = 0;
    globalHistory.replaceState(_extends$k({}, globalHistory.state, {
      idx: index2
    }), "");
  }
  function getIndex() {
    let state = globalHistory.state || {
      idx: null
    };
    return state.idx;
  }
  function handlePop() {
    action = Action$1.Pop;
    let nextIndex = getIndex();
    let delta = nextIndex == null ? null : nextIndex - index2;
    index2 = nextIndex;
    if (listener) {
      listener({
        action,
        location: history.location,
        delta
      });
    }
  }
  function push2(to2, state) {
    action = Action$1.Push;
    let location2 = createLocation(history.location, to2, state);
    if (validateLocation)
      validateLocation(location2, to2);
    index2 = getIndex() + 1;
    let historyState = getHistoryState(location2, index2);
    let url2 = history.createHref(location2);
    try {
      globalHistory.pushState(historyState, "", url2);
    } catch (error2) {
      if (error2 instanceof DOMException && error2.name === "DataCloneError") {
        throw error2;
      }
      window2.location.assign(url2);
    }
    if (v5Compat && listener) {
      listener({
        action,
        location: history.location,
        delta: 1
      });
    }
  }
  function replace2(to2, state) {
    action = Action$1.Replace;
    let location2 = createLocation(history.location, to2, state);
    if (validateLocation)
      validateLocation(location2, to2);
    index2 = getIndex();
    let historyState = getHistoryState(location2, index2);
    let url2 = history.createHref(location2);
    globalHistory.replaceState(historyState, "", url2);
    if (v5Compat && listener) {
      listener({
        action,
        location: history.location,
        delta: 0
      });
    }
  }
  function createURL(to2) {
    let base = window2.location.origin !== "null" ? window2.location.origin : window2.location.href;
    let href = typeof to2 === "string" ? to2 : createPath(to2);
    href = href.replace(/ $/, "%20");
    invariant$3(base, "No window.location.(origin|href) available to create URL for href: " + href);
    return new URL(href, base);
  }
  let history = {
    get action() {
      return action;
    },
    get location() {
      return getLocation(window2, globalHistory);
    },
    listen(fn) {
      if (listener) {
        throw new Error("A history only accepts one active listener");
      }
      window2.addEventListener(PopStateEventType, handlePop);
      listener = fn;
      return () => {
        window2.removeEventListener(PopStateEventType, handlePop);
        listener = null;
      };
    },
    createHref(to2) {
      return createHref(window2, to2);
    },
    createURL,
    encodeLocation(to2) {
      let url2 = createURL(to2);
      return {
        pathname: url2.pathname,
        search: url2.search,
        hash: url2.hash
      };
    },
    push: push2,
    replace: replace2,
    go(n2) {
      return globalHistory.go(n2);
    }
  };
  return history;
}
var ResultType;
(function(ResultType2) {
  ResultType2["data"] = "data";
  ResultType2["deferred"] = "deferred";
  ResultType2["redirect"] = "redirect";
  ResultType2["error"] = "error";
})(ResultType || (ResultType = {}));
function matchRoutes(routes, locationArg, basename2) {
  if (basename2 === void 0) {
    basename2 = "/";
  }
  let location2 = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
  let pathname = stripBasename(location2.pathname || "/", basename2);
  if (pathname == null) {
    return null;
  }
  let branches = flattenRoutes$1(routes);
  rankRouteBranches(branches);
  let matches = null;
  for (let i2 = 0; matches == null && i2 < branches.length; ++i2) {
    let decoded = decodePath(pathname);
    matches = matchRouteBranch(branches[i2], decoded);
  }
  return matches;
}
function flattenRoutes$1(routes, branches, parentsMeta, parentPath) {
  if (branches === void 0) {
    branches = [];
  }
  if (parentsMeta === void 0) {
    parentsMeta = [];
  }
  if (parentPath === void 0) {
    parentPath = "";
  }
  let flattenRoute = (route2, index2, relativePath) => {
    let meta = {
      relativePath: relativePath === void 0 ? route2.path || "" : relativePath,
      caseSensitive: route2.caseSensitive === true,
      childrenIndex: index2,
      route: route2
    };
    if (meta.relativePath.startsWith("/")) {
      invariant$3(meta.relativePath.startsWith(parentPath), 'Absolute route path "' + meta.relativePath + '" nested under path ' + ('"' + parentPath + '" is not valid. An absolute child route path ') + "must start with the combined path of all its parent routes.");
      meta.relativePath = meta.relativePath.slice(parentPath.length);
    }
    let path = joinPaths([parentPath, meta.relativePath]);
    let routesMeta = parentsMeta.concat(meta);
    if (route2.children && route2.children.length > 0) {
      invariant$3(
        // Our types know better, but runtime JS may not!
        // @ts-expect-error
        route2.index !== true,
        "Index routes must not have child routes. Please remove " + ('all child routes from route path "' + path + '".')
      );
      flattenRoutes$1(route2.children, branches, routesMeta, path);
    }
    if (route2.path == null && !route2.index) {
      return;
    }
    branches.push({
      path,
      score: computeScore(path, route2.index),
      routesMeta
    });
  };
  routes.forEach((route2, index2) => {
    var _route$path;
    if (route2.path === "" || !((_route$path = route2.path) != null && _route$path.includes("?"))) {
      flattenRoute(route2, index2);
    } else {
      for (let exploded of explodeOptionalSegments(route2.path)) {
        flattenRoute(route2, index2, exploded);
      }
    }
  });
  return branches;
}
function explodeOptionalSegments(path) {
  let segments = path.split("/");
  if (segments.length === 0)
    return [];
  let [first, ...rest] = segments;
  let isOptional = first.endsWith("?");
  let required4 = first.replace(/\?$/, "");
  if (rest.length === 0) {
    return isOptional ? [required4, ""] : [required4];
  }
  let restExploded = explodeOptionalSegments(rest.join("/"));
  let result = [];
  result.push(...restExploded.map((subpath) => subpath === "" ? required4 : [required4, subpath].join("/")));
  if (isOptional) {
    result.push(...restExploded);
  }
  return result.map((exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded);
}
function rankRouteBranches(branches) {
  branches.sort((a2, b2) => a2.score !== b2.score ? b2.score - a2.score : compareIndexes(a2.routesMeta.map((meta) => meta.childrenIndex), b2.routesMeta.map((meta) => meta.childrenIndex)));
}
const paramRe = /^:[\w-]+$/;
const dynamicSegmentValue = 3;
const indexRouteValue = 2;
const emptySegmentValue = 1;
const staticSegmentValue = 10;
const splatPenalty = -2;
const isSplat = (s2) => s2 === "*";
function computeScore(path, index2) {
  let segments = path.split("/");
  let initialScore = segments.length;
  if (segments.some(isSplat)) {
    initialScore += splatPenalty;
  }
  if (index2) {
    initialScore += indexRouteValue;
  }
  return segments.filter((s2) => !isSplat(s2)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue), initialScore);
}
function compareIndexes(a2, b2) {
  let siblings = a2.length === b2.length && a2.slice(0, -1).every((n2, i2) => n2 === b2[i2]);
  return siblings ? (
    // If two routes are siblings, we should try to match the earlier sibling
    // first. This allows people to have fine-grained control over the matching
    // behavior by simply putting routes with identical paths in the order they
    // want them tried.
    a2[a2.length - 1] - b2[b2.length - 1]
  ) : (
    // Otherwise, it doesn't really make sense to rank non-siblings by index,
    // so they sort equally.
    0
  );
}
function matchRouteBranch(branch, pathname) {
  let {
    routesMeta
  } = branch;
  let matchedParams = {};
  let matchedPathname = "/";
  let matches = [];
  for (let i2 = 0; i2 < routesMeta.length; ++i2) {
    let meta = routesMeta[i2];
    let end2 = i2 === routesMeta.length - 1;
    let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
    let match5 = matchPath({
      path: meta.relativePath,
      caseSensitive: meta.caseSensitive,
      end: end2
    }, remainingPathname);
    if (!match5)
      return null;
    Object.assign(matchedParams, match5.params);
    let route2 = meta.route;
    matches.push({
      // TODO: Can this as be avoided?
      params: matchedParams,
      pathname: joinPaths([matchedPathname, match5.pathname]),
      pathnameBase: normalizePathname(joinPaths([matchedPathname, match5.pathnameBase])),
      route: route2
    });
    if (match5.pathnameBase !== "/") {
      matchedPathname = joinPaths([matchedPathname, match5.pathnameBase]);
    }
  }
  return matches;
}
function matchPath(pattern4, pathname) {
  if (typeof pattern4 === "string") {
    pattern4 = {
      path: pattern4,
      caseSensitive: false,
      end: true
    };
  }
  let [matcher, compiledParams] = compilePath(pattern4.path, pattern4.caseSensitive, pattern4.end);
  let match5 = pathname.match(matcher);
  if (!match5)
    return null;
  let matchedPathname = match5[0];
  let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
  let captureGroups = match5.slice(1);
  let params = compiledParams.reduce((memo2, _ref, index2) => {
    let {
      paramName,
      isOptional
    } = _ref;
    if (paramName === "*") {
      let splatValue = captureGroups[index2] || "";
      pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
    }
    const value2 = captureGroups[index2];
    if (isOptional && !value2) {
      memo2[paramName] = void 0;
    } else {
      memo2[paramName] = (value2 || "").replace(/%2F/g, "/");
    }
    return memo2;
  }, {});
  return {
    params,
    pathname: matchedPathname,
    pathnameBase,
    pattern: pattern4
  };
}
function compilePath(path, caseSensitive, end2) {
  if (caseSensitive === void 0) {
    caseSensitive = false;
  }
  if (end2 === void 0) {
    end2 = true;
  }
  warning$4(path === "*" || !path.endsWith("*") || path.endsWith("/*"), 'Route path "' + path + '" will be treated as if it were ' + ('"' + path.replace(/\*$/, "/*") + '" because the `*` character must ') + "always follow a `/` in the pattern. To get rid of this warning, " + ('please change the route path to "' + path.replace(/\*$/, "/*") + '".'));
  let params = [];
  let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(/\/:([\w-]+)(\?)?/g, (_24, paramName, isOptional) => {
    params.push({
      paramName,
      isOptional: isOptional != null
    });
    return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
  });
  if (path.endsWith("*")) {
    params.push({
      paramName: "*"
    });
    regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
  } else if (end2) {
    regexpSource += "\\/*$";
  } else if (path !== "" && path !== "/") {
    regexpSource += "(?:(?=\\/|$))";
  } else
    ;
  let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i");
  return [matcher, params];
}
function decodePath(value2) {
  try {
    return value2.split("/").map((v2) => decodeURIComponent(v2).replace(/\//g, "%2F")).join("/");
  } catch (error2) {
    warning$4(false, 'The URL path "' + value2 + '" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent ' + ("encoding (" + error2 + ")."));
    return value2;
  }
}
function stripBasename(pathname, basename2) {
  if (basename2 === "/")
    return pathname;
  if (!pathname.toLowerCase().startsWith(basename2.toLowerCase())) {
    return null;
  }
  let startIndex = basename2.endsWith("/") ? basename2.length - 1 : basename2.length;
  let nextChar = pathname.charAt(startIndex);
  if (nextChar && nextChar !== "/") {
    return null;
  }
  return pathname.slice(startIndex) || "/";
}
function resolvePath(to2, fromPathname) {
  if (fromPathname === void 0) {
    fromPathname = "/";
  }
  let {
    pathname: toPathname,
    search: search2 = "",
    hash = ""
  } = typeof to2 === "string" ? parsePath(to2) : to2;
  let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;
  return {
    pathname,
    search: normalizeSearch(search2),
    hash: normalizeHash(hash)
  };
}
function resolvePathname(relativePath, fromPathname) {
  let segments = fromPathname.replace(/\/+$/, "").split("/");
  let relativeSegments = relativePath.split("/");
  relativeSegments.forEach((segment) => {
    if (segment === "..") {
      if (segments.length > 1)
        segments.pop();
    } else if (segment !== ".") {
      segments.push(segment);
    }
  });
  return segments.length > 1 ? segments.join("/") : "/";
}
function getInvalidPathError(char2, field, dest, path) {
  return "Cannot include a '" + char2 + "' character in a manually specified " + ("`to." + field + "` field [" + JSON.stringify(path) + "].  Please separate it out to the ") + ("`to." + dest + "` field. Alternatively you may provide the full path as ") + 'a string in <Link to="..."> and the router will parse it for you.';
}
function getPathContributingMatches(matches) {
  return matches.filter((match5, index2) => index2 === 0 || match5.route.path && match5.route.path.length > 0);
}
function getResolveToMatches(matches, v7_relativeSplatPath) {
  let pathMatches = getPathContributingMatches(matches);
  if (v7_relativeSplatPath) {
    return pathMatches.map((match5, idx) => idx === matches.length - 1 ? match5.pathname : match5.pathnameBase);
  }
  return pathMatches.map((match5) => match5.pathnameBase);
}
function resolveTo(toArg, routePathnames, locationPathname, isPathRelative) {
  if (isPathRelative === void 0) {
    isPathRelative = false;
  }
  let to2;
  if (typeof toArg === "string") {
    to2 = parsePath(toArg);
  } else {
    to2 = _extends$k({}, toArg);
    invariant$3(!to2.pathname || !to2.pathname.includes("?"), getInvalidPathError("?", "pathname", "search", to2));
    invariant$3(!to2.pathname || !to2.pathname.includes("#"), getInvalidPathError("#", "pathname", "hash", to2));
    invariant$3(!to2.search || !to2.search.includes("#"), getInvalidPathError("#", "search", "hash", to2));
  }
  let isEmptyPath = toArg === "" || to2.pathname === "";
  let toPathname = isEmptyPath ? "/" : to2.pathname;
  let from2;
  if (toPathname == null) {
    from2 = locationPathname;
  } else {
    let routePathnameIndex = routePathnames.length - 1;
    if (!isPathRelative && toPathname.startsWith("..")) {
      let toSegments = toPathname.split("/");
      while (toSegments[0] === "..") {
        toSegments.shift();
        routePathnameIndex -= 1;
      }
      to2.pathname = toSegments.join("/");
    }
    from2 = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
  }
  let path = resolvePath(to2, from2);
  let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
  let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
  if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
    path.pathname += "/";
  }
  return path;
}
const joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
const normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
const normalizeSearch = (search2) => !search2 || search2 === "?" ? "" : search2.startsWith("?") ? search2 : "?" + search2;
const normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
function isRouteErrorResponse(error2) {
  return error2 != null && typeof error2.status === "number" && typeof error2.statusText === "string" && typeof error2.internal === "boolean" && "data" in error2;
}
const validMutationMethodsArr = ["post", "put", "patch", "delete"];
new Set(validMutationMethodsArr);
const validRequestMethodsArr = ["get", ...validMutationMethodsArr];
new Set(validRequestMethodsArr);
/**
 * React Router v6.23.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * 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$j() {
  _extends$j = Object.assign ? Object.assign.bind() : function(target) {
    for (var i2 = 1; i2 < arguments.length; i2++) {
      var source2 = arguments[i2];
      for (var key in source2) {
        if (Object.prototype.hasOwnProperty.call(source2, key)) {
          target[key] = source2[key];
        }
      }
    }
    return target;
  };
  return _extends$j.apply(this, arguments);
}
const DataRouterContext = /* @__PURE__ */ reactExports.createContext(null);
const DataRouterStateContext = /* @__PURE__ */ reactExports.createContext(null);
const NavigationContext = /* @__PURE__ */ reactExports.createContext(null);
const LocationContext = /* @__PURE__ */ reactExports.createContext(null);
const RouteContext = /* @__PURE__ */ reactExports.createContext({
  outlet: null,
  matches: [],
  isDataRoute: false
});
const RouteErrorContext = /* @__PURE__ */ reactExports.createContext(null);
function useHref(to2, _temp) {
  let {
    relative
  } = _temp === void 0 ? {} : _temp;
  !useInRouterContext() ? invariant$3(false) : void 0;
  let {
    basename: basename2,
    navigator: navigator2
  } = reactExports.useContext(NavigationContext);
  let {
    hash,
    pathname,
    search: search2
  } = useResolvedPath(to2, {
    relative
  });
  let joinedPathname = pathname;
  if (basename2 !== "/") {
    joinedPathname = pathname === "/" ? basename2 : joinPaths([basename2, pathname]);
  }
  return navigator2.createHref({
    pathname: joinedPathname,
    search: search2,
    hash
  });
}
function useInRouterContext() {
  return reactExports.useContext(LocationContext) != null;
}
function useLocation() {
  !useInRouterContext() ? invariant$3(false) : void 0;
  return reactExports.useContext(LocationContext).location;
}
function useIsomorphicLayoutEffect$5(cb2) {
  let isStatic = reactExports.useContext(NavigationContext).static;
  if (!isStatic) {
    reactExports.useLayoutEffect(cb2);
  }
}
function useNavigate() {
  let {
    isDataRoute
  } = reactExports.useContext(RouteContext);
  return isDataRoute ? useNavigateStable() : useNavigateUnstable();
}
function useNavigateUnstable() {
  !useInRouterContext() ? invariant$3(false) : void 0;
  let dataRouterContext = reactExports.useContext(DataRouterContext);
  let {
    basename: basename2,
    future,
    navigator: navigator2
  } = reactExports.useContext(NavigationContext);
  let {
    matches
  } = reactExports.useContext(RouteContext);
  let {
    pathname: locationPathname
  } = useLocation();
  let routePathnamesJson = JSON.stringify(getResolveToMatches(matches, future.v7_relativeSplatPath));
  let activeRef = reactExports.useRef(false);
  useIsomorphicLayoutEffect$5(() => {
    activeRef.current = true;
  });
  let navigate = reactExports.useCallback(function(to2, options) {
    if (options === void 0) {
      options = {};
    }
    if (!activeRef.current)
      return;
    if (typeof to2 === "number") {
      navigator2.go(to2);
      return;
    }
    let path = resolveTo(to2, JSON.parse(routePathnamesJson), locationPathname, options.relative === "path");
    if (dataRouterContext == null && basename2 !== "/") {
      path.pathname = path.pathname === "/" ? basename2 : joinPaths([basename2, path.pathname]);
    }
    (!!options.replace ? navigator2.replace : navigator2.push)(path, options.state, options);
  }, [basename2, navigator2, routePathnamesJson, locationPathname, dataRouterContext]);
  return navigate;
}
function useResolvedPath(to2, _temp2) {
  let {
    relative
  } = _temp2 === void 0 ? {} : _temp2;
  let {
    future
  } = reactExports.useContext(NavigationContext);
  let {
    matches
  } = reactExports.useContext(RouteContext);
  let {
    pathname: locationPathname
  } = useLocation();
  let routePathnamesJson = JSON.stringify(getResolveToMatches(matches, future.v7_relativeSplatPath));
  return reactExports.useMemo(() => resolveTo(to2, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [to2, routePathnamesJson, locationPathname, relative]);
}
function useRoutes(routes, locationArg) {
  return useRoutesImpl(routes);
}
function useRoutesImpl(routes, locationArg, dataRouterState, future) {
  !useInRouterContext() ? invariant$3(false) : void 0;
  let {
    navigator: navigator2
  } = reactExports.useContext(NavigationContext);
  let {
    matches: parentMatches
  } = reactExports.useContext(RouteContext);
  let routeMatch = parentMatches[parentMatches.length - 1];
  let parentParams = routeMatch ? routeMatch.params : {};
  routeMatch ? routeMatch.pathname : "/";
  let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/";
  routeMatch && routeMatch.route;
  let locationFromContext = useLocation();
  let location2;
  {
    location2 = locationFromContext;
  }
  let pathname = location2.pathname || "/";
  let remainingPathname = pathname;
  if (parentPathnameBase !== "/") {
    let parentSegments = parentPathnameBase.replace(/^\//, "").split("/");
    let segments = pathname.replace(/^\//, "").split("/");
    remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
  }
  let matches = matchRoutes(routes, {
    pathname: remainingPathname
  });
  let renderedMatches = _renderMatches(matches && matches.map((match5) => Object.assign({}, match5, {
    params: Object.assign({}, parentParams, match5.params),
    pathname: joinPaths([
      parentPathnameBase,
      // Re-encode pathnames that were decoded inside matchRoutes
      navigator2.encodeLocation ? navigator2.encodeLocation(match5.pathname).pathname : match5.pathname
    ]),
    pathnameBase: match5.pathnameBase === "/" ? parentPathnameBase : joinPaths([
      parentPathnameBase,
      // Re-encode pathnames that were decoded inside matchRoutes
      navigator2.encodeLocation ? navigator2.encodeLocation(match5.pathnameBase).pathname : match5.pathnameBase
    ])
  })), parentMatches, dataRouterState, future);
  return renderedMatches;
}
function DefaultErrorComponent() {
  let error2 = useRouteError();
  let message = isRouteErrorResponse(error2) ? error2.status + " " + error2.statusText : error2 instanceof Error ? error2.message : JSON.stringify(error2);
  let stack = error2 instanceof Error ? error2.stack : null;
  let lightgrey = "rgba(200,200,200, 0.5)";
  let preStyles = {
    padding: "0.5rem",
    backgroundColor: lightgrey
  };
  let devInfo = null;
  return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__PURE__ */ reactExports.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ reactExports.createElement("h3", {
    style: {
      fontStyle: "italic"
    }
  }, message), stack ? /* @__PURE__ */ reactExports.createElement("pre", {
    style: preStyles
  }, stack) : null, devInfo);
}
const defaultErrorElement = /* @__PURE__ */ reactExports.createElement(DefaultErrorComponent, null);
class RenderErrorBoundary extends reactExports.Component {
  constructor(props) {
    super(props);
    this.state = {
      location: props.location,
      revalidation: props.revalidation,
      error: props.error
    };
  }
  static getDerivedStateFromError(error2) {
    return {
      error: error2
    };
  }
  static getDerivedStateFromProps(props, state) {
    if (state.location !== props.location || state.revalidation !== "idle" && props.revalidation === "idle") {
      return {
        error: props.error,
        location: props.location,
        revalidation: props.revalidation
      };
    }
    return {
      error: props.error !== void 0 ? props.error : state.error,
      location: state.location,
      revalidation: props.revalidation || state.revalidation
    };
  }
  componentDidCatch(error2, errorInfo) {
    console.error("React Router caught the following error during render", error2, errorInfo);
  }
  render() {
    return this.state.error !== void 0 ? /* @__PURE__ */ reactExports.createElement(RouteContext.Provider, {
      value: this.props.routeContext
    }, /* @__PURE__ */ reactExports.createElement(RouteErrorContext.Provider, {
      value: this.state.error,
      children: this.props.component
    })) : this.props.children;
  }
}
function RenderedRoute(_ref) {
  let {
    routeContext,
    match: match5,
    children
  } = _ref;
  let dataRouterContext = reactExports.useContext(DataRouterContext);
  if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match5.route.errorElement || match5.route.ErrorBoundary)) {
    dataRouterContext.staticContext._deepestRenderedBoundaryId = match5.route.id;
  }
  return /* @__PURE__ */ reactExports.createElement(RouteContext.Provider, {
    value: routeContext
  }, children);
}
function _renderMatches(matches, parentMatches, dataRouterState, future) {
  var _dataRouterState2;
  if (parentMatches === void 0) {
    parentMatches = [];
  }
  if (dataRouterState === void 0) {
    dataRouterState = null;
  }
  if (future === void 0) {
    future = null;
  }
  if (matches == null) {
    var _dataRouterState;
    if ((_dataRouterState = dataRouterState) != null && _dataRouterState.errors) {
      matches = dataRouterState.matches;
    } else {
      return null;
    }
  }
  let renderedMatches = matches;
  let errors = (_dataRouterState2 = dataRouterState) == null ? void 0 : _dataRouterState2.errors;
  if (errors != null) {
    let errorIndex = renderedMatches.findIndex((m2) => m2.route.id && (errors == null ? void 0 : errors[m2.route.id]) !== void 0);
    !(errorIndex >= 0) ? invariant$3(false) : void 0;
    renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1));
  }
  let renderFallback = false;
  let fallbackIndex = -1;
  if (dataRouterState && future && future.v7_partialHydration) {
    for (let i2 = 0; i2 < renderedMatches.length; i2++) {
      let match5 = renderedMatches[i2];
      if (match5.route.HydrateFallback || match5.route.hydrateFallbackElement) {
        fallbackIndex = i2;
      }
      if (match5.route.id) {
        let {
          loaderData,
          errors: errors2
        } = dataRouterState;
        let needsToRunLoader = match5.route.loader && loaderData[match5.route.id] === void 0 && (!errors2 || errors2[match5.route.id] === void 0);
        if (match5.route.lazy || needsToRunLoader) {
          renderFallback = true;
          if (fallbackIndex >= 0) {
            renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
          } else {
            renderedMatches = [renderedMatches[0]];
          }
          break;
        }
      }
    }
  }
  return renderedMatches.reduceRight((outlet, match5, index2) => {
    let error2;
    let shouldRenderHydrateFallback = false;
    let errorElement = null;
    let hydrateFallbackElement = null;
    if (dataRouterState) {
      error2 = errors && match5.route.id ? errors[match5.route.id] : void 0;
      errorElement = match5.route.errorElement || defaultErrorElement;
      if (renderFallback) {
        if (fallbackIndex < 0 && index2 === 0) {
          warningOnce$1("route-fallback");
          shouldRenderHydrateFallback = true;
          hydrateFallbackElement = null;
        } else if (fallbackIndex === index2) {
          shouldRenderHydrateFallback = true;
          hydrateFallbackElement = match5.route.hydrateFallbackElement || null;
        }
      }
    }
    let matches2 = parentMatches.concat(renderedMatches.slice(0, index2 + 1));
    let getChildren2 = () => {
      let children;
      if (error2) {
        children = errorElement;
      } else if (shouldRenderHydrateFallback) {
        children = hydrateFallbackElement;
      } else if (match5.route.Component) {
        children = /* @__PURE__ */ reactExports.createElement(match5.route.Component, null);
      } else if (match5.route.element) {
        children = match5.route.element;
      } else {
        children = outlet;
      }
      return /* @__PURE__ */ reactExports.createElement(RenderedRoute, {
        match: match5,
        routeContext: {
          outlet,
          matches: matches2,
          isDataRoute: dataRouterState != null
        },
        children
      });
    };
    return dataRouterState && (match5.route.ErrorBoundary || match5.route.errorElement || index2 === 0) ? /* @__PURE__ */ reactExports.createElement(RenderErrorBoundary, {
      location: dataRouterState.location,
      revalidation: dataRouterState.revalidation,
      component: errorElement,
      error: error2,
      children: getChildren2(),
      routeContext: {
        outlet: null,
        matches: matches2,
        isDataRoute: true
      }
    }) : getChildren2();
  }, null);
}
var DataRouterHook$1 = /* @__PURE__ */ function(DataRouterHook2) {
  DataRouterHook2["UseBlocker"] = "useBlocker";
  DataRouterHook2["UseRevalidator"] = "useRevalidator";
  DataRouterHook2["UseNavigateStable"] = "useNavigate";
  return DataRouterHook2;
}(DataRouterHook$1 || {});
var DataRouterStateHook$1 = /* @__PURE__ */ function(DataRouterStateHook2) {
  DataRouterStateHook2["UseBlocker"] = "useBlocker";
  DataRouterStateHook2["UseLoaderData"] = "useLoaderData";
  DataRouterStateHook2["UseActionData"] = "useActionData";
  DataRouterStateHook2["UseRouteError"] = "useRouteError";
  DataRouterStateHook2["UseNavigation"] = "useNavigation";
  DataRouterStateHook2["UseRouteLoaderData"] = "useRouteLoaderData";
  DataRouterStateHook2["UseMatches"] = "useMatches";
  DataRouterStateHook2["UseRevalidator"] = "useRevalidator";
  DataRouterStateHook2["UseNavigateStable"] = "useNavigate";
  DataRouterStateHook2["UseRouteId"] = "useRouteId";
  return DataRouterStateHook2;
}(DataRouterStateHook$1 || {});
function useDataRouterContext(hookName) {
  let ctx = reactExports.useContext(DataRouterContext);
  !ctx ? invariant$3(false) : void 0;
  return ctx;
}
function useDataRouterState(hookName) {
  let state = reactExports.useContext(DataRouterStateContext);
  !state ? invariant$3(false) : void 0;
  return state;
}
function useRouteContext(hookName) {
  let route2 = reactExports.useContext(RouteContext);
  !route2 ? invariant$3(false) : void 0;
  return route2;
}
function useCurrentRouteId(hookName) {
  let route2 = useRouteContext();
  let thisRoute = route2.matches[route2.matches.length - 1];
  !thisRoute.route.id ? invariant$3(false) : void 0;
  return thisRoute.route.id;
}
function useRouteError() {
  var _state$errors;
  let error2 = reactExports.useContext(RouteErrorContext);
  let state = useDataRouterState();
  let routeId = useCurrentRouteId();
  if (error2 !== void 0) {
    return error2;
  }
  return (_state$errors = state.errors) == null ? void 0 : _state$errors[routeId];
}
function useNavigateStable() {
  let {
    router
  } = useDataRouterContext(DataRouterHook$1.UseNavigateStable);
  let id2 = useCurrentRouteId(DataRouterStateHook$1.UseNavigateStable);
  let activeRef = reactExports.useRef(false);
  useIsomorphicLayoutEffect$5(() => {
    activeRef.current = true;
  });
  let navigate = reactExports.useCallback(function(to2, options) {
    if (options === void 0) {
      options = {};
    }
    if (!activeRef.current)
      return;
    if (typeof to2 === "number") {
      router.navigate(to2);
    } else {
      router.navigate(to2, _extends$j({
        fromRouteId: id2
      }, options));
    }
  }, [router, id2]);
  return navigate;
}
const alreadyWarned$1 = {};
function warningOnce$1(key, cond, message) {
  if (!alreadyWarned$1[key]) {
    alreadyWarned$1[key] = true;
  }
}
function Navigate(_ref4) {
  let {
    to: to2,
    replace: replace2,
    state,
    relative
  } = _ref4;
  !useInRouterContext() ? invariant$3(false) : void 0;
  let {
    future,
    static: isStatic
  } = reactExports.useContext(NavigationContext);
  let {
    matches
  } = reactExports.useContext(RouteContext);
  let {
    pathname: locationPathname
  } = useLocation();
  let navigate = useNavigate();
  let path = resolveTo(to2, getResolveToMatches(matches, future.v7_relativeSplatPath), locationPathname, relative === "path");
  let jsonPath = JSON.stringify(path);
  reactExports.useEffect(() => navigate(JSON.parse(jsonPath), {
    replace: replace2,
    state,
    relative
  }), [navigate, jsonPath, relative, replace2, state]);
  return null;
}
function Router(_ref5) {
  let {
    basename: basenameProp = "/",
    children = null,
    location: locationProp,
    navigationType = Action$1.Pop,
    navigator: navigator2,
    static: staticProp = false,
    future
  } = _ref5;
  !!useInRouterContext() ? invariant$3(false) : void 0;
  let basename2 = basenameProp.replace(/^\/*/, "/");
  let navigationContext = reactExports.useMemo(() => ({
    basename: basename2,
    navigator: navigator2,
    static: staticProp,
    future: _extends$j({
      v7_relativeSplatPath: false
    }, future)
  }), [basename2, future, navigator2, staticProp]);
  if (typeof locationProp === "string") {
    locationProp = parsePath(locationProp);
  }
  let {
    pathname = "/",
    search: search2 = "",
    hash = "",
    state = null,
    key = "default"
  } = locationProp;
  let locationContext = reactExports.useMemo(() => {
    let trailingPathname = stripBasename(pathname, basename2);
    if (trailingPathname == null) {
      return null;
    }
    return {
      location: {
        pathname: trailingPathname,
        search: search2,
        hash,
        state,
        key
      },
      navigationType
    };
  }, [basename2, pathname, search2, hash, state, key, navigationType]);
  if (locationContext == null) {
    return null;
  }
  return /* @__PURE__ */ reactExports.createElement(NavigationContext.Provider, {
    value: navigationContext
  }, /* @__PURE__ */ reactExports.createElement(LocationContext.Provider, {
    children,
    value: locationContext
  }));
}
new Promise(() => {
});
/**
 * React Router DOM v6.23.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * 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$i() {
  _extends$i = Object.assign ? Object.assign.bind() : function(target) {
    for (var i2 = 1; i2 < arguments.length; i2++) {
      var source2 = arguments[i2];
      for (var key in source2) {
        if (Object.prototype.hasOwnProperty.call(source2, key)) {
          target[key] = source2[key];
        }
      }
    }
    return target;
  };
  return _extends$i.apply(this, arguments);
}
function _objectWithoutPropertiesLoose$3(source2, excluded) {
  if (source2 == null)
    return {};
  var target = {};
  var sourceKeys = Object.keys(source2);
  var key, i2;
  for (i2 = 0; i2 < sourceKeys.length; i2++) {
    key = sourceKeys[i2];
    if (excluded.indexOf(key) >= 0)
      continue;
    target[key] = source2[key];
  }
  return target;
}
function isModifiedEvent(event) {
  return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
}
function shouldProcessLinkClick(event, target) {
  return event.button === 0 && // Ignore everything but left clicks
  (!target || target === "_self") && // Let browser handle "target=_blank" etc.
  !isModifiedEvent(event);
}
const _excluded$A = ["onClick", "relative", "reloadDocument", "replace", "state", "target", "to", "preventScrollReset", "unstable_viewTransition"];
const REACT_ROUTER_VERSION = "6";
try {
  window.__reactRouterVersion = REACT_ROUTER_VERSION;
} catch (e2) {
}
const START_TRANSITION = "startTransition";
const startTransitionImpl = React$6[START_TRANSITION];
function HashRouter(_ref5) {
  let {
    basename: basename2,
    children,
    future,
    window: window2
  } = _ref5;
  let historyRef = reactExports.useRef();
  if (historyRef.current == null) {
    historyRef.current = createHashHistory({
      window: window2,
      v5Compat: true
    });
  }
  let history = historyRef.current;
  let [state, setStateImpl] = reactExports.useState({
    action: history.action,
    location: history.location
  });
  let {
    v7_startTransition
  } = future || {};
  let setState = reactExports.useCallback((newState) => {
    v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);
  }, [setStateImpl, v7_startTransition]);
  reactExports.useLayoutEffect(() => history.listen(setState), [history, setState]);
  return /* @__PURE__ */ reactExports.createElement(Router, {
    basename: basename2,
    children,
    location: state.location,
    navigationType: state.action,
    navigator: history,
    future
  });
}
const isBrowser$3 = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
const ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
const Link$2 = /* @__PURE__ */ reactExports.forwardRef(function LinkWithRef(_ref7, ref) {
  let {
    onClick,
    relative,
    reloadDocument,
    replace: replace2,
    state,
    target,
    to: to2,
    preventScrollReset,
    unstable_viewTransition
  } = _ref7, rest = _objectWithoutPropertiesLoose$3(_ref7, _excluded$A);
  let {
    basename: basename2
  } = reactExports.useContext(NavigationContext);
  let absoluteHref;
  let isExternal = false;
  if (typeof to2 === "string" && ABSOLUTE_URL_REGEX.test(to2)) {
    absoluteHref = to2;
    if (isBrowser$3) {
      try {
        let currentUrl = new URL(window.location.href);
        let targetUrl = to2.startsWith("//") ? new URL(currentUrl.protocol + to2) : new URL(to2);
        let path = stripBasename(targetUrl.pathname, basename2);
        if (targetUrl.origin === currentUrl.origin && path != null) {
          to2 = path + targetUrl.search + targetUrl.hash;
        } else {
          isExternal = true;
        }
      } catch (e2) {
      }
    }
  }
  let href = useHref(to2, {
    relative
  });
  let internalOnClick = useLinkClickHandler(to2, {
    replace: replace2,
    state,
    target,
    preventScrollReset,
    relative,
    unstable_viewTransition
  });
  function handleClick(event) {
    if (onClick)
      onClick(event);
    if (!event.defaultPrevented) {
      internalOnClick(event);
    }
  }
  return (
    // eslint-disable-next-line jsx-a11y/anchor-has-content
    /* @__PURE__ */ reactExports.createElement("a", _extends$i({}, rest, {
      href: absoluteHref || href,
      onClick: isExternal || reloadDocument ? onClick : handleClick,
      ref,
      target
    }))
  );
});
var DataRouterHook;
(function(DataRouterHook2) {
  DataRouterHook2["UseScrollRestoration"] = "useScrollRestoration";
  DataRouterHook2["UseSubmit"] = "useSubmit";
  DataRouterHook2["UseSubmitFetcher"] = "useSubmitFetcher";
  DataRouterHook2["UseFetcher"] = "useFetcher";
  DataRouterHook2["useViewTransitionState"] = "useViewTransitionState";
})(DataRouterHook || (DataRouterHook = {}));
var DataRouterStateHook;
(function(DataRouterStateHook2) {
  DataRouterStateHook2["UseFetcher"] = "useFetcher";
  DataRouterStateHook2["UseFetchers"] = "useFetchers";
  DataRouterStateHook2["UseScrollRestoration"] = "useScrollRestoration";
})(DataRouterStateHook || (DataRouterStateHook = {}));
function useLinkClickHandler(to2, _temp) {
  let {
    target,
    replace: replaceProp,
    state,
    preventScrollReset,
    relative,
    unstable_viewTransition
  } = _temp === void 0 ? {} : _temp;
  let navigate = useNavigate();
  let location2 = useLocation();
  let path = useResolvedPath(to2, {
    relative
  });
  return reactExports.useCallback((event) => {
    if (shouldProcessLinkClick(event, target)) {
      event.preventDefault();
      let replace2 = replaceProp !== void 0 ? replaceProp : createPath(location2) === createPath(path);
      navigate(to2, {
        replace: replace2,
        state,
        preventScrollReset,
        relative,
        unstable_viewTransition
      });
    }
  }, [location2, navigate, path, replaceProp, state, target, to2, preventScrollReset, relative, unstable_viewTransition]);
}
function createContext2(options = {}) {
  const {
    strict = true,
    errorMessage = "useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",
    name: name2
  } = options;
  const Context2 = reactExports.createContext(void 0);
  Context2.displayName = name2;
  function useContext2() {
    var _a2;
    const context = reactExports.useContext(Context2);
    if (!context && strict) {
      const error2 = new Error(errorMessage);
      error2.name = "ContextError";
      (_a2 = Error.captureStackTrace) == null ? void 0 : _a2.call(Error, error2, useContext2);
      throw error2;
    }
    return context;
  }
  return [Context2.Provider, useContext2, Context2];
}
function createDOMRef(ref) {
  return {
    UNSAFE_getDOMNode() {
      return ref.current;
    }
  };
}
function useDOMRef(ref) {
  const domRef = reactExports.useRef(null);
  reactExports.useImperativeHandle(ref, () => domRef.current);
  return domRef;
}
var getInertValue = (v2) => {
  return v2 ? "" : void 0;
};
function isArray$j(value2) {
  return Array.isArray(value2);
}
function isEmptyArray(value2) {
  return isArray$j(value2) && value2.length === 0;
}
function isObject$d(value2) {
  const type4 = typeof value2;
  return value2 != null && (type4 === "object" || type4 === "function") && !isArray$j(value2);
}
function isEmptyObject$1(value2) {
  return isObject$d(value2) && Object.keys(value2).length === 0;
}
function isEmpty(value2) {
  if (isArray$j(value2))
    return isEmptyArray(value2);
  if (isObject$d(value2))
    return isEmptyObject$1(value2);
  if (value2 == null || value2 === "")
    return true;
  return false;
}
function isFunction$8(value2) {
  return typeof value2 === "function";
}
var dataAttr = (condition) => condition ? "true" : void 0;
function toVal(mix2) {
  var k2, y2, str = "";
  if (typeof mix2 === "string" || typeof mix2 === "number") {
    str += mix2;
  } else if (typeof mix2 === "object") {
    if (Array.isArray(mix2)) {
      for (k2 = 0; k2 < mix2.length; k2++) {
        if (mix2[k2]) {
          if (y2 = toVal(mix2[k2])) {
            str && (str += " ");
            str += y2;
          }
        }
      }
    } else {
      for (k2 in mix2) {
        if (mix2[k2]) {
          str && (str += " ");
          str += k2;
        }
      }
    }
  }
  return str;
}
function clsx$4(...args) {
  var i2 = 0, tmp, x2, str = "";
  while (i2 < args.length) {
    if (tmp = args[i2++]) {
      if (x2 = toVal(tmp)) {
        str && (str += " ");
        str += x2;
      }
    }
  }
  return str;
}
var safeAriaLabel = (...texts) => {
  let ariaLabel = " ";
  for (const text2 of texts) {
    if (typeof text2 === "string" && text2.length > 0) {
      ariaLabel = text2;
      break;
    }
  }
  return ariaLabel;
};
var capitalize$2 = (s2) => {
  return s2 ? s2.charAt(0).toUpperCase() + s2.slice(1).toLowerCase() : "";
};
function callAllHandlers(...fns) {
  return function func(event) {
    fns.some((fn) => {
      fn == null ? void 0 : fn(event);
      return event == null ? void 0 : event.defaultPrevented;
    });
  };
}
function getUniqueID(prefix) {
  return `${prefix}-${Math.floor(Math.random() * 1e6)}`;
}
function removeEvents(input2) {
  for (const key in input2) {
    if (key.startsWith("on")) {
      delete input2[key];
    }
  }
  return input2;
}
function objectToDeps(obj) {
  if (!obj || typeof obj !== "object") {
    return "";
  }
  try {
    return JSON.stringify(obj);
  } catch {
    return "";
  }
}
function debounce$5(func, waitMilliseconds = 0) {
  let timeout;
  return function(...args) {
    const later = () => {
      timeout = void 0;
      func.apply(this, args);
    };
    if (timeout !== void 0) {
      clearTimeout(timeout);
    }
    timeout = setTimeout(later, waitMilliseconds);
  };
}
function range$1(start2, end2) {
  const length2 = end2 - start2 + 1;
  return Array.from({ length: length2 }, (_24, index2) => index2 + start2);
}
function clamp$2(value2, min2, max2) {
  return Math.min(Math.max(value2, min2), max2);
}
function clampPercentage(value2, max2 = 100) {
  return Math.min(Math.max(value2, 0), max2);
}
var warningStack = {};
function warn$2(message, component, ...args) {
  const tag = " ";
  const log3 = `[Hero UI]${tag}: ${message}`;
  if (typeof console === "undefined")
    return;
  if (warningStack[log3])
    return;
  warningStack[log3] = true;
}
function getGregorianYearOffset(identifier2) {
  switch (identifier2) {
    case "buddhist":
      return 543;
    case "ethiopic":
    case "ethioaa":
      return -8;
    case "coptic":
      return -284;
    case "hebrew":
      return 3760;
    case "indian":
      return -78;
    case "islamic-civil":
    case "islamic-tbla":
    case "islamic-umalqura":
      return -579;
    case "persian":
      return -600;
    case "roc":
    case "japanese":
    case "gregory":
    default:
      return 0;
  }
}
function chain(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks) {
      if (typeof callback2 === "function") {
        callback2(...args);
      }
    }
  };
}
var idsUpdaterMap = /* @__PURE__ */ new Map();
function mergeIds(idA, idB) {
  if (idA === idB) {
    return idA;
  }
  let setIdsA = idsUpdaterMap.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = idsUpdaterMap.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function mergeProps$3(...args) {
  let result = { ...args[0] };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90) {
        result[key] = chain(a2, b2);
      } else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string") {
        result[key] = clsx$4(a2, b2);
      } else if (key === "id" && a2 && b2) {
        result.id = mergeIds(a2, b2);
      } else {
        result[key] = b2 !== void 0 ? b2 : a2;
      }
    }
  }
  return result;
}
function mergeRefs$1(...refs) {
  if (refs.length === 1 && refs[0]) {
    return refs[0];
  }
  return (value2) => {
    let hasCleanup = false;
    const cleanups = refs.map((ref) => {
      const cleanup2 = setRef$1(ref, value2);
      hasCleanup || (hasCleanup = typeof cleanup2 == "function");
      return cleanup2;
    });
    if (hasCleanup) {
      return () => {
        cleanups.forEach((cleanup2, i2) => {
          if (typeof cleanup2 === "function") {
            cleanup2 == null ? void 0 : cleanup2();
          } else {
            setRef$1(refs[i2], null);
          }
        });
      };
    }
  };
}
function setRef$1(ref, value2) {
  if (typeof ref === "function") {
    return () => ref(value2);
  } else if (ref != null) {
    if ("current" in ref) {
      ref.current = value2;
    }
  }
}
function assignRef(ref, value2) {
  if (ref == null)
    return;
  if (isFunction$8(ref)) {
    ref(value2);
    return;
  }
  try {
    ref.current = value2;
  } catch {
    throw new Error(`Cannot assign value '${value2}' to ref '${ref}'`);
  }
}
function mergeRefs(...refs) {
  return (node2) => {
    refs.forEach((ref) => assignRef(ref, node2));
  };
}
function useIsHydrated() {
  const subscribe2 = () => () => {
  };
  return reactExports.useSyncExternalStore(
    subscribe2,
    () => true,
    () => false
  );
}
var pickChildren = (children, targetChild) => {
  var _a2;
  let target = [];
  const withoutTargetChildren = (_a2 = reactExports.Children.map(children, (item) => {
    if (!reactExports.isValidElement(item))
      return item;
    if (item.type === targetChild) {
      target.push(item);
      return null;
    }
    return item;
  })) == null ? void 0 : _a2.filter(Boolean);
  const targetChildren = target.length >= 0 ? target : void 0;
  return [withoutTargetChildren, targetChildren];
};
var DOMPropNames = /* @__PURE__ */ new Set([
  "id",
  "type",
  "style",
  "title",
  "role",
  "tabIndex",
  "htmlFor",
  "width",
  "height",
  "abbr",
  "accept",
  "acceptCharset",
  "accessKey",
  "action",
  "allowFullScreen",
  "allowTransparency",
  "alt",
  "async",
  "autoComplete",
  "autoFocus",
  "autoPlay",
  "cellPadding",
  "cellSpacing",
  "challenge",
  "charset",
  "checked",
  "cite",
  "class",
  "className",
  "cols",
  "colSpan",
  "command",
  "content",
  "contentEditable",
  "contextMenu",
  "controls",
  "coords",
  "crossOrigin",
  "data",
  "dateTime",
  "default",
  "defer",
  "dir",
  "disabled",
  "download",
  "draggable",
  "dropzone",
  "encType",
  "enterKeyHint",
  "for",
  "form",
  "formAction",
  "formEncType",
  "formMethod",
  "formNoValidate",
  "formTarget",
  "frameBorder",
  "headers",
  "hidden",
  "high",
  "href",
  "hrefLang",
  "httpEquiv",
  "icon",
  "inputMode",
  "isMap",
  "itemId",
  "itemProp",
  "itemRef",
  "itemScope",
  "itemType",
  "kind",
  "label",
  "lang",
  "list",
  "loop",
  "manifest",
  "max",
  "maxLength",
  "media",
  "mediaGroup",
  "method",
  "min",
  "minLength",
  "multiple",
  "muted",
  "name",
  "noValidate",
  "open",
  "optimum",
  "pattern",
  "ping",
  "placeholder",
  "poster",
  "preload",
  "radioGroup",
  "referrerPolicy",
  "readOnly",
  "rel",
  "required",
  "rows",
  "rowSpan",
  "sandbox",
  "scope",
  "scoped",
  "scrolling",
  "seamless",
  "selected",
  "shape",
  "size",
  "sizes",
  "slot",
  "sortable",
  "span",
  "spellCheck",
  "src",
  "srcDoc",
  "srcSet",
  "start",
  "step",
  "target",
  "translate",
  "typeMustMatch",
  "useMap",
  "value",
  "wmode",
  "wrap"
]);
var DOMEventNames = /* @__PURE__ */ new Set([
  "onCopy",
  "onCut",
  "onPaste",
  "onLoad",
  "onError",
  "onWheel",
  "onScroll",
  "onCompositionEnd",
  "onCompositionStart",
  "onCompositionUpdate",
  "onKeyDown",
  "onKeyPress",
  "onKeyUp",
  "onFocus",
  "onBlur",
  "onChange",
  "onInput",
  "onSubmit",
  "onClick",
  "onContextMenu",
  "onDoubleClick",
  "onDrag",
  "onDragEnd",
  "onDragEnter",
  "onDragExit",
  "onDragLeave",
  "onDragOver",
  "onDragStart",
  "onDrop",
  "onMouseDown",
  "onMouseEnter",
  "onMouseLeave",
  "onMouseMove",
  "onMouseOut",
  "onMouseOver",
  "onMouseUp",
  "onPointerDown",
  "onPointerEnter",
  "onPointerLeave",
  "onPointerUp",
  "onSelect",
  "onTouchCancel",
  "onTouchEnd",
  "onTouchMove",
  "onTouchStart",
  "onAnimationStart",
  "onAnimationEnd",
  "onAnimationIteration",
  "onTransitionEnd"
]);
var propRe = /^(data-.*)$/;
var ariaRe = /^(aria-.*)$/;
var funcRe = /^(on[A-Z].*)$/;
function filterDOMProps(props, opts2 = {}) {
  let {
    labelable = true,
    enabled = true,
    propNames,
    omitPropNames,
    omitEventNames,
    omitDataProps,
    omitEventProps
  } = opts2;
  let filteredProps = {};
  if (!enabled) {
    return props;
  }
  for (const prop in props) {
    if (omitPropNames == null ? void 0 : omitPropNames.has(prop)) {
      continue;
    }
    if ((omitEventNames == null ? void 0 : omitEventNames.has(prop)) && funcRe.test(prop)) {
      continue;
    }
    if (funcRe.test(prop) && !DOMEventNames.has(prop)) {
      continue;
    }
    if (omitDataProps && propRe.test(prop)) {
      continue;
    }
    if (omitEventProps && funcRe.test(prop)) {
      continue;
    }
    if (Object.prototype.hasOwnProperty.call(props, prop) && (DOMPropNames.has(prop) || labelable && ariaRe.test(prop) || (propNames == null ? void 0 : propNames.has(prop)) || propRe.test(prop)) || funcRe.test(prop)) {
      filteredProps[prop] = props[prop];
    }
  }
  return filteredProps;
}
function renderFn({ Component: Component2, props, renderCustom }) {
  if (renderCustom && typeof renderCustom === "function") {
    return renderCustom(props);
  } else {
    return reactExports.createElement(Component2, props);
  }
}
var [ProviderContext, useProviderContext] = createContext2({
  name: "ProviderContext",
  strict: false
});
const $148a7a147e38ea7f$var$RTL_SCRIPTS$a = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS$a = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764$a(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS$a.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS$a.has(lang2);
}
const $b5e257d569688ac6$var$defaultContext$e = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$e = /* @__PURE__ */ React$5.createContext($b5e257d569688ac6$var$defaultContext$e);
const $b5e257d569688ac6$var$IsSSRContext$e = /* @__PURE__ */ React$5.createContext(false);
let $b5e257d569688ac6$var$componentIds$e = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$e(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$e);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$e.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$e.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$e.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$e(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$e);
  let counter = $b5e257d569688ac6$var$useCounter$e(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$e(defaultId) {
  let id2 = React$5.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$e());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$e.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$5["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$e : $b5e257d569688ac6$var$useLegacySSRSafeId$e;
function $b5e257d569688ac6$var$getSnapshot$e() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$e() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$e(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$e() {
  if (typeof React$5["useSyncExternalStore"] === "function")
    return React$5["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$e, $b5e257d569688ac6$var$getSnapshot$e, $b5e257d569688ac6$var$getServerSnapshot$e);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$e);
}
const $1e5a04cdaf7d1af8$var$localeSymbol$a = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$a() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol$a] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764$a(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale$a = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$a();
let $1e5a04cdaf7d1af8$var$listeners$a = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale$a() {
  $1e5a04cdaf7d1af8$var$currentLocale$a = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$a();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners$a)
    listener($1e5a04cdaf7d1af8$var$currentLocale$a);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$a() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$e();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale$a);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners$a.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$a);
    $1e5a04cdaf7d1af8$var$listeners$a.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners$a.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners$a.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$a);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext$a = /* @__PURE__ */ React$5.createContext(null);
function $18f2051aff69b9bf$export$a54013f0d02a8f82(props) {
  let { locale: locale2, children } = props;
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$a();
  let value2 = React$5.useMemo(() => {
    if (!locale2)
      return defaultLocale;
    return {
      locale: locale2,
      direction: $148a7a147e38ea7f$export$702d680b21cbd764$a(locale2) ? "rtl" : "ltr"
    };
  }, [
    defaultLocale,
    locale2
  ]);
  return /* @__PURE__ */ React$5.createElement($18f2051aff69b9bf$var$I18nContext$a.Provider, {
    value: value2
  }, children);
}
const $5b160d28a433310d$var$localeSymbol = Symbol.for("react-aria.i18n.locale");
const $5b160d28a433310d$var$stringsSymbol = Symbol.for("react-aria.i18n.strings");
let $5b160d28a433310d$var$cachedGlobalStrings = void 0;
class $5b160d28a433310d$export$c17fa47878dc55b6 {
  /** Returns a localized string for the given key and locale. */
  getStringForLocale(key, locale2) {
    let strings = this.getStringsForLocale(locale2);
    let string3 = strings[key];
    if (!string3)
      throw new Error(`Could not find intl message ${key} in ${locale2} locale`);
    return string3;
  }
  /** Returns all localized strings for the given locale. */
  getStringsForLocale(locale2) {
    let strings = this.strings[locale2];
    if (!strings) {
      strings = $5b160d28a433310d$var$getStringsForLocale(locale2, this.strings, this.defaultLocale);
      this.strings[locale2] = strings;
    }
    return strings;
  }
  static getGlobalDictionaryForPackage(packageName) {
    if (typeof window === "undefined")
      return null;
    let locale2 = window[$5b160d28a433310d$var$localeSymbol];
    if ($5b160d28a433310d$var$cachedGlobalStrings === void 0) {
      let globalStrings = window[$5b160d28a433310d$var$stringsSymbol];
      if (!globalStrings)
        return null;
      $5b160d28a433310d$var$cachedGlobalStrings = {};
      for (let pkg in globalStrings)
        $5b160d28a433310d$var$cachedGlobalStrings[pkg] = new $5b160d28a433310d$export$c17fa47878dc55b6({
          [locale2]: globalStrings[pkg]
        }, locale2);
    }
    let dictionary = $5b160d28a433310d$var$cachedGlobalStrings === null || $5b160d28a433310d$var$cachedGlobalStrings === void 0 ? void 0 : $5b160d28a433310d$var$cachedGlobalStrings[packageName];
    if (!dictionary)
      throw new Error(`Strings for package "${packageName}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);
    return dictionary;
  }
  constructor(messages2, defaultLocale = "en-US") {
    this.strings = Object.fromEntries(Object.entries(messages2).filter(([, v2]) => v2));
    this.defaultLocale = defaultLocale;
  }
}
function $5b160d28a433310d$var$getStringsForLocale(locale2, strings, defaultLocale = "en-US") {
  if (strings[locale2])
    return strings[locale2];
  let language = $5b160d28a433310d$var$getLanguage(locale2);
  if (strings[language])
    return strings[language];
  for (let key in strings) {
    if (key.startsWith(language + "-"))
      return strings[key];
  }
  return strings[defaultLocale];
}
function $5b160d28a433310d$var$getLanguage(locale2) {
  if (Intl.Locale)
    return new Intl.Locale(locale2).language;
  return locale2.split("-")[0];
}
const $6db58dc88e78b024$var$pluralRulesCache = /* @__PURE__ */ new Map();
const $6db58dc88e78b024$var$numberFormatCache = /* @__PURE__ */ new Map();
class $6db58dc88e78b024$export$2f817fcdc4b89ae0 {
  /** Formats a localized string for the given key with the provided variables. */
  format(key, variables) {
    let message = this.strings.getStringForLocale(key, this.locale);
    return typeof message === "function" ? message(variables, this) : message;
  }
  plural(count, options, type4 = "cardinal") {
    let opt = options["=" + count];
    if (opt)
      return typeof opt === "function" ? opt() : opt;
    let key = this.locale + ":" + type4;
    let pluralRules = $6db58dc88e78b024$var$pluralRulesCache.get(key);
    if (!pluralRules) {
      pluralRules = new Intl.PluralRules(this.locale, {
        type: type4
      });
      $6db58dc88e78b024$var$pluralRulesCache.set(key, pluralRules);
    }
    let selected = pluralRules.select(count);
    opt = options[selected] || options.other;
    return typeof opt === "function" ? opt() : opt;
  }
  number(value2) {
    let numberFormat = $6db58dc88e78b024$var$numberFormatCache.get(this.locale);
    if (!numberFormat) {
      numberFormat = new Intl.NumberFormat(this.locale);
      $6db58dc88e78b024$var$numberFormatCache.set(this.locale, numberFormat);
    }
    return numberFormat.format(value2);
  }
  select(options, value2) {
    let opt = options[value2] || options.other;
    return typeof opt === "function" ? opt() : opt;
  }
  constructor(locale2, strings) {
    this.locale = locale2;
    this.strings = strings;
  }
}
function $2b4dce13dd5a17fa$export$842a2cf37af977e1(amount, numerator) {
  return amount - numerator * Math.floor(amount / numerator);
}
const $3b62074eb05584b2$var$EPOCH = 1721426;
function $3b62074eb05584b2$export$f297eb839006d339(era, year, month, day) {
  year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year);
  let y1 = year - 1;
  let monthOffset = -2;
  if (month <= 2)
    monthOffset = 0;
  else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year))
    monthOffset = -1;
  return $3b62074eb05584b2$var$EPOCH - 1 + 365 * y1 + Math.floor(y1 / 4) - Math.floor(y1 / 100) + Math.floor(y1 / 400) + Math.floor((367 * month - 362) / 12 + monthOffset + day);
}
function $3b62074eb05584b2$export$553d7fa8e3805fc0(year) {
  return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
}
function $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year) {
  return era === "BC" ? 1 - year : year;
}
function $3b62074eb05584b2$export$4475b7e617eb123c(year) {
  let era = "AD";
  if (year <= 0) {
    era = "BC";
    year = 1 - year;
  }
  return [
    era,
    year
  ];
}
const $3b62074eb05584b2$var$daysInMonth = {
  standard: [
    31,
    28,
    31,
    30,
    31,
    30,
    31,
    31,
    30,
    31,
    30,
    31
  ],
  leapyear: [
    31,
    29,
    31,
    30,
    31,
    30,
    31,
    31,
    30,
    31,
    30,
    31
  ]
};
class $3b62074eb05584b2$export$80ee6245ec4f29ec {
  fromJulianDay(jd2) {
    let jd0 = jd2;
    let depoch = jd0 - $3b62074eb05584b2$var$EPOCH;
    let quadricent = Math.floor(depoch / 146097);
    let dqc = $2b4dce13dd5a17fa$export$842a2cf37af977e1(depoch, 146097);
    let cent = Math.floor(dqc / 36524);
    let dcent = $2b4dce13dd5a17fa$export$842a2cf37af977e1(dqc, 36524);
    let quad = Math.floor(dcent / 1461);
    let dquad = $2b4dce13dd5a17fa$export$842a2cf37af977e1(dcent, 1461);
    let yindex = Math.floor(dquad / 365);
    let extendedYear = quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0);
    let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c(extendedYear);
    let yearDay = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, 1, 1);
    let leapAdj = 2;
    if (jd0 < $3b62074eb05584b2$export$f297eb839006d339(era, year, 3, 1))
      leapAdj = 0;
    else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year))
      leapAdj = 1;
    let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);
    let day = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, month, 1) + 1;
    return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(era, year, month, day);
  }
  toJulianDay(date4) {
    return $3b62074eb05584b2$export$f297eb839006d339(date4.era, date4.year, date4.month, date4.day);
  }
  getDaysInMonth(date4) {
    return $3b62074eb05584b2$var$daysInMonth[$3b62074eb05584b2$export$553d7fa8e3805fc0(date4.year) ? "leapyear" : "standard"][date4.month - 1];
  }
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  getMonthsInYear(date4) {
    return 12;
  }
  getDaysInYear(date4) {
    return $3b62074eb05584b2$export$553d7fa8e3805fc0(date4.year) ? 366 : 365;
  }
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  getYearsInEra(date4) {
    return 9999;
  }
  getEras() {
    return [
      "BC",
      "AD"
    ];
  }
  isInverseEra(date4) {
    return date4.era === "BC";
  }
  balanceDate(date4) {
    if (date4.year <= 0) {
      date4.era = date4.era === "BC" ? "AD" : "BC";
      date4.year = 1 - date4.year;
    }
  }
  constructor() {
    this.identifier = "gregory";
  }
}
const $2fe286d2fb449abb$export$7a5acbd77d414bd9 = {
  "001": 1,
  AD: 1,
  AE: 6,
  AF: 6,
  AI: 1,
  AL: 1,
  AM: 1,
  AN: 1,
  AR: 1,
  AT: 1,
  AU: 1,
  AX: 1,
  AZ: 1,
  BA: 1,
  BE: 1,
  BG: 1,
  BH: 6,
  BM: 1,
  BN: 1,
  BY: 1,
  CH: 1,
  CL: 1,
  CM: 1,
  CN: 1,
  CR: 1,
  CY: 1,
  CZ: 1,
  DE: 1,
  DJ: 6,
  DK: 1,
  DZ: 6,
  EC: 1,
  EE: 1,
  EG: 6,
  ES: 1,
  FI: 1,
  FJ: 1,
  FO: 1,
  FR: 1,
  GB: 1,
  GE: 1,
  GF: 1,
  GP: 1,
  GR: 1,
  HR: 1,
  HU: 1,
  IE: 1,
  IQ: 6,
  IR: 6,
  IS: 1,
  IT: 1,
  JO: 6,
  KG: 1,
  KW: 6,
  KZ: 1,
  LB: 1,
  LI: 1,
  LK: 1,
  LT: 1,
  LU: 1,
  LV: 1,
  LY: 6,
  MC: 1,
  MD: 1,
  ME: 1,
  MK: 1,
  MN: 1,
  MQ: 1,
  MV: 5,
  MY: 1,
  NL: 1,
  NO: 1,
  NZ: 1,
  OM: 6,
  PL: 1,
  QA: 6,
  RE: 1,
  RO: 1,
  RS: 1,
  RU: 1,
  SD: 6,
  SE: 1,
  SI: 1,
  SK: 1,
  SM: 1,
  SY: 6,
  TJ: 1,
  TM: 1,
  TR: 1,
  UA: 1,
  UY: 1,
  UZ: 1,
  VA: 1,
  VN: 1,
  XK: 1
};
function $14e0f24ef4ac5c92$export$ea39ec197993aef0(a2, b2) {
  b2 = $11d87f3f76e88657$export$b4a036af3fc0b032(b2, a2.calendar);
  return a2.era === b2.era && a2.year === b2.year && a2.month === b2.month && a2.day === b2.day;
}
function $14e0f24ef4ac5c92$export$a18c89cbd24170ff(a2, b2) {
  b2 = $11d87f3f76e88657$export$b4a036af3fc0b032(b2, a2.calendar);
  a2 = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(a2);
  b2 = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(b2);
  return a2.era === b2.era && a2.year === b2.year && a2.month === b2.month;
}
function $14e0f24ef4ac5c92$export$91b62ebf2ba703ee(a2, b2) {
  return $14e0f24ef4ac5c92$export$dbc69fd56b53d5e(a2.calendar, b2.calendar) && $14e0f24ef4ac5c92$export$ea39ec197993aef0(a2, b2);
}
function $14e0f24ef4ac5c92$export$dbc69fd56b53d5e(a2, b2) {
  var _a_isEqual, _b_isEqual;
  var _a_isEqual1, _ref;
  return (_ref = (_a_isEqual1 = (_a_isEqual = a2.isEqual) === null || _a_isEqual === void 0 ? void 0 : _a_isEqual.call(a2, b2)) !== null && _a_isEqual1 !== void 0 ? _a_isEqual1 : (_b_isEqual = b2.isEqual) === null || _b_isEqual === void 0 ? void 0 : _b_isEqual.call(b2, a2)) !== null && _ref !== void 0 ? _ref : a2.identifier === b2.identifier;
}
function $14e0f24ef4ac5c92$export$629b0a497aa65267(date4, timeZone) {
  return $14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(timeZone));
}
const $14e0f24ef4ac5c92$var$DAY_MAP = {
  sun: 0,
  mon: 1,
  tue: 2,
  wed: 3,
  thu: 4,
  fri: 5,
  sat: 6
};
function $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date4, locale2, firstDayOfWeek) {
  let julian = date4.calendar.toJulianDay(date4);
  let weekStart = firstDayOfWeek ? $14e0f24ef4ac5c92$var$DAY_MAP[firstDayOfWeek] : $14e0f24ef4ac5c92$var$getWeekStart(locale2);
  let dayOfWeek = Math.ceil(julian + 1 - weekStart) % 7;
  if (dayOfWeek < 0)
    dayOfWeek += 7;
  return dayOfWeek;
}
function $14e0f24ef4ac5c92$export$461939dd4422153(timeZone) {
  return $11d87f3f76e88657$export$1b96692a1ba042ac(Date.now(), timeZone);
}
function $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(timeZone) {
  return $11d87f3f76e88657$export$93522d1a439f3617($14e0f24ef4ac5c92$export$461939dd4422153(timeZone));
}
function $14e0f24ef4ac5c92$export$68781ddf31c0090f(a2, b2) {
  return a2.calendar.toJulianDay(a2) - b2.calendar.toJulianDay(b2);
}
function $14e0f24ef4ac5c92$export$c19a80a9721b80f6(a2, b2) {
  return $14e0f24ef4ac5c92$var$timeToMs(a2) - $14e0f24ef4ac5c92$var$timeToMs(b2);
}
function $14e0f24ef4ac5c92$var$timeToMs(a2) {
  return a2.hour * 36e5 + a2.minute * 6e4 + a2.second * 1e3 + a2.millisecond;
}
let $14e0f24ef4ac5c92$var$localTimeZone = null;
function $14e0f24ef4ac5c92$export$aa8b41735afcabd2() {
  if ($14e0f24ef4ac5c92$var$localTimeZone == null)
    $14e0f24ef4ac5c92$var$localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
  return $14e0f24ef4ac5c92$var$localTimeZone;
}
function $14e0f24ef4ac5c92$export$a5a3b454ada2268e(date4) {
  return date4.subtract({
    days: date4.day - 1
  });
}
function $14e0f24ef4ac5c92$export$a2258d9c4118825c(date4) {
  return date4.add({
    days: date4.calendar.getDaysInMonth(date4) - date4.day
  });
}
function $14e0f24ef4ac5c92$export$f91e89d3d0406102(date4) {
  return $14e0f24ef4ac5c92$export$a5a3b454ada2268e(date4.subtract({
    months: date4.month - 1
  }));
}
function $14e0f24ef4ac5c92$export$5412ac11713b72ad(date4) {
  if (date4.calendar.getMinimumMonthInYear)
    return date4.calendar.getMinimumMonthInYear(date4);
  return 1;
}
function $14e0f24ef4ac5c92$export$b2f4953d301981d5(date4) {
  if (date4.calendar.getMinimumDayInMonth)
    return date4.calendar.getMinimumDayInMonth(date4);
  return 1;
}
function $14e0f24ef4ac5c92$export$42c81a444fbfb5d4(date4, locale2, firstDayOfWeek) {
  let dayOfWeek = $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date4, locale2, firstDayOfWeek);
  return date4.subtract({
    days: dayOfWeek
  });
}
function $14e0f24ef4ac5c92$export$ef8b6d9133084f4e(date4, locale2, firstDayOfWeek) {
  return $14e0f24ef4ac5c92$export$42c81a444fbfb5d4(date4, locale2, firstDayOfWeek).add({
    days: 6
  });
}
const $14e0f24ef4ac5c92$var$cachedRegions = /* @__PURE__ */ new Map();
function $14e0f24ef4ac5c92$var$getRegion(locale2) {
  if (Intl.Locale) {
    let region = $14e0f24ef4ac5c92$var$cachedRegions.get(locale2);
    if (!region) {
      region = new Intl.Locale(locale2).maximize().region;
      if (region)
        $14e0f24ef4ac5c92$var$cachedRegions.set(locale2, region);
    }
    return region;
  }
  let part = locale2.split("-")[1];
  return part === "u" ? void 0 : part;
}
function $14e0f24ef4ac5c92$var$getWeekStart(locale2) {
  let region = $14e0f24ef4ac5c92$var$getRegion(locale2);
  return region ? $2fe286d2fb449abb$export$7a5acbd77d414bd9[region] || 0 : 0;
}
function $14e0f24ef4ac5c92$export$ccc1b2479e7dd654(date4, locale2, firstDayOfWeek) {
  let days2 = date4.calendar.getDaysInMonth(date4);
  return Math.ceil(($14e0f24ef4ac5c92$export$2061056d06d7cdf7($14e0f24ef4ac5c92$export$a5a3b454ada2268e(date4), locale2, firstDayOfWeek) + days2) / 7);
}
function $14e0f24ef4ac5c92$export$5c333a116e949cdd(a2, b2) {
  if (a2 && b2)
    return a2.compare(b2) <= 0 ? a2 : b2;
  return a2 || b2;
}
function $14e0f24ef4ac5c92$export$a75f2bff57811055(a2, b2) {
  if (a2 && b2)
    return a2.compare(b2) >= 0 ? a2 : b2;
  return a2 || b2;
}
function $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date4) {
  date4 = $11d87f3f76e88657$export$b4a036af3fc0b032(date4, new $3b62074eb05584b2$export$80ee6245ec4f29ec());
  let year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(date4.era, date4.year);
  return $11d87f3f76e88657$var$epochFromParts(year, date4.month, date4.day, date4.hour, date4.minute, date4.second, date4.millisecond);
}
function $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, millisecond) {
  let date4 = /* @__PURE__ */ new Date();
  date4.setUTCHours(hour, minute, second, millisecond);
  date4.setUTCFullYear(year, month - 1, day);
  return date4.getTime();
}
function $11d87f3f76e88657$export$59c99f3515d3493f(ms, timeZone) {
  if (timeZone === "UTC")
    return 0;
  if (ms > 0 && timeZone === $14e0f24ef4ac5c92$export$aa8b41735afcabd2())
    return new Date(ms).getTimezoneOffset() * -6e4;
  let { year, month, day, hour, minute, second } = $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone);
  let utc = $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, 0);
  return utc - Math.floor(ms / 1e3) * 1e3;
}
const $11d87f3f76e88657$var$formattersByTimeZone = /* @__PURE__ */ new Map();
function $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone) {
  let formatter = $11d87f3f76e88657$var$formattersByTimeZone.get(timeZone);
  if (!formatter) {
    formatter = new Intl.DateTimeFormat("en-US", {
      timeZone,
      hour12: false,
      era: "short",
      year: "numeric",
      month: "numeric",
      day: "numeric",
      hour: "numeric",
      minute: "numeric",
      second: "numeric"
    });
    $11d87f3f76e88657$var$formattersByTimeZone.set(timeZone, formatter);
  }
  let parts = formatter.formatToParts(new Date(ms));
  let namedParts = {};
  for (let part of parts)
    if (part.type !== "literal")
      namedParts[part.type] = part.value;
  return {
    // Firefox returns B instead of BC... https://bugzilla.mozilla.org/show_bug.cgi?id=1752253
    year: namedParts.era === "BC" || namedParts.era === "B" ? -namedParts.year + 1 : +namedParts.year,
    month: +namedParts.month,
    day: +namedParts.day,
    hour: namedParts.hour === "24" ? 0 : +namedParts.hour,
    minute: +namedParts.minute,
    second: +namedParts.second
  };
}
const $11d87f3f76e88657$var$DAYMILLIS = 864e5;
function $11d87f3f76e88657$var$getValidWallTimes(date4, timeZone, earlier, later) {
  let found = earlier === later ? [
    earlier
  ] : [
    earlier,
    later
  ];
  return found.filter((absolute2) => $11d87f3f76e88657$var$isValidWallTime(date4, timeZone, absolute2));
}
function $11d87f3f76e88657$var$isValidWallTime(date4, timeZone, absolute2) {
  let parts = $11d87f3f76e88657$var$getTimeZoneParts(absolute2, timeZone);
  return date4.year === parts.year && date4.month === parts.month && date4.day === parts.day && date4.hour === parts.hour && date4.minute === parts.minute && date4.second === parts.second;
}
function $11d87f3f76e88657$export$5107c82f94518f5c(date4, timeZone, disambiguation = "compatible") {
  let dateTime = $11d87f3f76e88657$export$b21e0b124e224484(date4);
  if (timeZone === "UTC")
    return $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime);
  if (timeZone === $14e0f24ef4ac5c92$export$aa8b41735afcabd2() && disambiguation === "compatible") {
    dateTime = $11d87f3f76e88657$export$b4a036af3fc0b032(dateTime, new $3b62074eb05584b2$export$80ee6245ec4f29ec());
    let date5 = /* @__PURE__ */ new Date();
    let year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(dateTime.era, dateTime.year);
    date5.setFullYear(year, dateTime.month - 1, dateTime.day);
    date5.setHours(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
    return date5.getTime();
  }
  let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime);
  let offsetBefore = $11d87f3f76e88657$export$59c99f3515d3493f(ms - $11d87f3f76e88657$var$DAYMILLIS, timeZone);
  let offsetAfter = $11d87f3f76e88657$export$59c99f3515d3493f(ms + $11d87f3f76e88657$var$DAYMILLIS, timeZone);
  let valid2 = $11d87f3f76e88657$var$getValidWallTimes(dateTime, timeZone, ms - offsetBefore, ms - offsetAfter);
  if (valid2.length === 1)
    return valid2[0];
  if (valid2.length > 1)
    switch (disambiguation) {
      case "compatible":
      case "earlier":
        return valid2[0];
      case "later":
        return valid2[valid2.length - 1];
      case "reject":
        throw new RangeError("Multiple possible absolute times found");
    }
  switch (disambiguation) {
    case "earlier":
      return Math.min(ms - offsetBefore, ms - offsetAfter);
    case "compatible":
    case "later":
      return Math.max(ms - offsetBefore, ms - offsetAfter);
    case "reject":
      throw new RangeError("No such absolute time found");
  }
}
function $11d87f3f76e88657$export$e67a095c620b86fe(dateTime, timeZone, disambiguation = "compatible") {
  return new Date($11d87f3f76e88657$export$5107c82f94518f5c(dateTime, timeZone, disambiguation));
}
function $11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone) {
  let offset2 = $11d87f3f76e88657$export$59c99f3515d3493f(ms, timeZone);
  let date4 = new Date(ms + offset2);
  let year = date4.getUTCFullYear();
  let month = date4.getUTCMonth() + 1;
  let day = date4.getUTCDate();
  let hour = date4.getUTCHours();
  let minute = date4.getUTCMinutes();
  let second = date4.getUTCSeconds();
  let millisecond = date4.getUTCMilliseconds();
  return new $35ea8db9cb2ccb90$export$d3b7288e7994edea(year < 1 ? "BC" : "AD", year < 1 ? -year + 1 : year, month, day, timeZone, offset2, hour, minute, second, millisecond);
}
function $11d87f3f76e88657$export$93522d1a439f3617(dateTime) {
  return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(dateTime.calendar, dateTime.era, dateTime.year, dateTime.month, dateTime.day);
}
function $11d87f3f76e88657$export$b21e0b124e224484(date4, time2) {
  let hour = 0, minute = 0, second = 0, millisecond = 0;
  if ("timeZone" in date4)
    ({ hour, minute, second, millisecond } = date4);
  else if ("hour" in date4 && !time2)
    return date4;
  if (time2)
    ({ hour, minute, second, millisecond } = time2);
  return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(date4.calendar, date4.era, date4.year, date4.month, date4.day, hour, minute, second, millisecond);
}
function $11d87f3f76e88657$export$d33f79e3ffc3dc83(dateTime) {
  return new $35ea8db9cb2ccb90$export$680ea196effce5f(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
}
function $11d87f3f76e88657$export$b4a036af3fc0b032(date4, calendar2) {
  if ($14e0f24ef4ac5c92$export$dbc69fd56b53d5e(date4.calendar, calendar2))
    return date4;
  let calendarDate = calendar2.fromJulianDay(date4.calendar.toJulianDay(date4));
  let copy2 = date4.copy();
  copy2.calendar = calendar2;
  copy2.era = calendarDate.era;
  copy2.year = calendarDate.year;
  copy2.month = calendarDate.month;
  copy2.day = calendarDate.day;
  $735220c2d4774dd3$export$c4e2ecac49351ef2(copy2);
  return copy2;
}
function $11d87f3f76e88657$export$84c95a83c799e074(date4, timeZone, disambiguation) {
  if (date4 instanceof $35ea8db9cb2ccb90$export$d3b7288e7994edea) {
    if (date4.timeZone === timeZone)
      return date4;
    return $11d87f3f76e88657$export$538b00033cc11c75(date4, timeZone);
  }
  let ms = $11d87f3f76e88657$export$5107c82f94518f5c(date4, timeZone, disambiguation);
  return $11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone);
}
function $11d87f3f76e88657$export$83aac07b4c37b25(date4) {
  let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date4) - date4.offset;
  return new Date(ms);
}
function $11d87f3f76e88657$export$538b00033cc11c75(date4, timeZone) {
  let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date4) - date4.offset;
  return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone), date4.calendar);
}
const $735220c2d4774dd3$var$ONE_HOUR = 36e5;
function $735220c2d4774dd3$export$e16d8520af44a096(date4, duration2) {
  let mutableDate = date4.copy();
  let days2 = "hour" in mutableDate ? $735220c2d4774dd3$var$addTimeFields(mutableDate, duration2) : 0;
  $735220c2d4774dd3$var$addYears(mutableDate, duration2.years || 0);
  if (mutableDate.calendar.balanceYearMonth)
    mutableDate.calendar.balanceYearMonth(mutableDate, date4);
  mutableDate.month += duration2.months || 0;
  $735220c2d4774dd3$var$balanceYearMonth(mutableDate);
  $735220c2d4774dd3$var$constrainMonthDay(mutableDate);
  mutableDate.day += (duration2.weeks || 0) * 7;
  mutableDate.day += duration2.days || 0;
  mutableDate.day += days2;
  $735220c2d4774dd3$var$balanceDay(mutableDate);
  if (mutableDate.calendar.balanceDate)
    mutableDate.calendar.balanceDate(mutableDate);
  if (mutableDate.year < 1) {
    mutableDate.year = 1;
    mutableDate.month = 1;
    mutableDate.day = 1;
  }
  let maxYear = mutableDate.calendar.getYearsInEra(mutableDate);
  if (mutableDate.year > maxYear) {
    var _mutableDate_calendar_isInverseEra, _mutableDate_calendar;
    let isInverseEra = (_mutableDate_calendar_isInverseEra = (_mutableDate_calendar = mutableDate.calendar).isInverseEra) === null || _mutableDate_calendar_isInverseEra === void 0 ? void 0 : _mutableDate_calendar_isInverseEra.call(_mutableDate_calendar, mutableDate);
    mutableDate.year = maxYear;
    mutableDate.month = isInverseEra ? 1 : mutableDate.calendar.getMonthsInYear(mutableDate);
    mutableDate.day = isInverseEra ? 1 : mutableDate.calendar.getDaysInMonth(mutableDate);
  }
  if (mutableDate.month < 1) {
    mutableDate.month = 1;
    mutableDate.day = 1;
  }
  let maxMonth = mutableDate.calendar.getMonthsInYear(mutableDate);
  if (mutableDate.month > maxMonth) {
    mutableDate.month = maxMonth;
    mutableDate.day = mutableDate.calendar.getDaysInMonth(mutableDate);
  }
  mutableDate.day = Math.max(1, Math.min(mutableDate.calendar.getDaysInMonth(mutableDate), mutableDate.day));
  return mutableDate;
}
function $735220c2d4774dd3$var$addYears(date4, years2) {
  var _date_calendar_isInverseEra, _date_calendar;
  if ((_date_calendar_isInverseEra = (_date_calendar = date4.calendar).isInverseEra) === null || _date_calendar_isInverseEra === void 0 ? void 0 : _date_calendar_isInverseEra.call(_date_calendar, date4))
    years2 = -years2;
  date4.year += years2;
}
function $735220c2d4774dd3$var$balanceYearMonth(date4) {
  while (date4.month < 1) {
    $735220c2d4774dd3$var$addYears(date4, -1);
    date4.month += date4.calendar.getMonthsInYear(date4);
  }
  let monthsInYear = 0;
  while (date4.month > (monthsInYear = date4.calendar.getMonthsInYear(date4))) {
    date4.month -= monthsInYear;
    $735220c2d4774dd3$var$addYears(date4, 1);
  }
}
function $735220c2d4774dd3$var$balanceDay(date4) {
  while (date4.day < 1) {
    date4.month--;
    $735220c2d4774dd3$var$balanceYearMonth(date4);
    date4.day += date4.calendar.getDaysInMonth(date4);
  }
  while (date4.day > date4.calendar.getDaysInMonth(date4)) {
    date4.day -= date4.calendar.getDaysInMonth(date4);
    date4.month++;
    $735220c2d4774dd3$var$balanceYearMonth(date4);
  }
}
function $735220c2d4774dd3$var$constrainMonthDay(date4) {
  date4.month = Math.max(1, Math.min(date4.calendar.getMonthsInYear(date4), date4.month));
  date4.day = Math.max(1, Math.min(date4.calendar.getDaysInMonth(date4), date4.day));
}
function $735220c2d4774dd3$export$c4e2ecac49351ef2(date4) {
  if (date4.calendar.constrainDate)
    date4.calendar.constrainDate(date4);
  date4.year = Math.max(1, Math.min(date4.calendar.getYearsInEra(date4), date4.year));
  $735220c2d4774dd3$var$constrainMonthDay(date4);
}
function $735220c2d4774dd3$export$3e2544e88a25bff8(duration2) {
  let inverseDuration = {};
  for (let key in duration2)
    if (typeof duration2[key] === "number")
      inverseDuration[key] = -duration2[key];
  return inverseDuration;
}
function $735220c2d4774dd3$export$4e2d2ead65e5f7e3(date4, duration2) {
  return $735220c2d4774dd3$export$e16d8520af44a096(date4, $735220c2d4774dd3$export$3e2544e88a25bff8(duration2));
}
function $735220c2d4774dd3$export$adaa4cf7ef1b65be(date4, fields) {
  let mutableDate = date4.copy();
  if (fields.era != null)
    mutableDate.era = fields.era;
  if (fields.year != null)
    mutableDate.year = fields.year;
  if (fields.month != null)
    mutableDate.month = fields.month;
  if (fields.day != null)
    mutableDate.day = fields.day;
  $735220c2d4774dd3$export$c4e2ecac49351ef2(mutableDate);
  return mutableDate;
}
function $735220c2d4774dd3$export$e5d5e1c1822b6e56(value2, fields) {
  let mutableValue = value2.copy();
  if (fields.hour != null)
    mutableValue.hour = fields.hour;
  if (fields.minute != null)
    mutableValue.minute = fields.minute;
  if (fields.second != null)
    mutableValue.second = fields.second;
  if (fields.millisecond != null)
    mutableValue.millisecond = fields.millisecond;
  $735220c2d4774dd3$export$7555de1e070510cb(mutableValue);
  return mutableValue;
}
function $735220c2d4774dd3$var$balanceTime(time2) {
  time2.second += Math.floor(time2.millisecond / 1e3);
  time2.millisecond = $735220c2d4774dd3$var$nonNegativeMod(time2.millisecond, 1e3);
  time2.minute += Math.floor(time2.second / 60);
  time2.second = $735220c2d4774dd3$var$nonNegativeMod(time2.second, 60);
  time2.hour += Math.floor(time2.minute / 60);
  time2.minute = $735220c2d4774dd3$var$nonNegativeMod(time2.minute, 60);
  let days2 = Math.floor(time2.hour / 24);
  time2.hour = $735220c2d4774dd3$var$nonNegativeMod(time2.hour, 24);
  return days2;
}
function $735220c2d4774dd3$export$7555de1e070510cb(time2) {
  time2.millisecond = Math.max(0, Math.min(time2.millisecond, 1e3));
  time2.second = Math.max(0, Math.min(time2.second, 59));
  time2.minute = Math.max(0, Math.min(time2.minute, 59));
  time2.hour = Math.max(0, Math.min(time2.hour, 23));
}
function $735220c2d4774dd3$var$nonNegativeMod(a2, b2) {
  let result = a2 % b2;
  if (result < 0)
    result += b2;
  return result;
}
function $735220c2d4774dd3$var$addTimeFields(time2, duration2) {
  time2.hour += duration2.hours || 0;
  time2.minute += duration2.minutes || 0;
  time2.second += duration2.seconds || 0;
  time2.millisecond += duration2.milliseconds || 0;
  return $735220c2d4774dd3$var$balanceTime(time2);
}
function $735220c2d4774dd3$export$7ed87b6bc2506470(time2, duration2) {
  let res = time2.copy();
  $735220c2d4774dd3$var$addTimeFields(res, duration2);
  return res;
}
function $735220c2d4774dd3$export$fe34d3a381cd7501(time2, duration2) {
  return $735220c2d4774dd3$export$7ed87b6bc2506470(time2, $735220c2d4774dd3$export$3e2544e88a25bff8(duration2));
}
function $735220c2d4774dd3$export$d52ced6badfb9a4c(value2, field, amount, options) {
  let mutable = value2.copy();
  switch (field) {
    case "era": {
      let eras = value2.calendar.getEras();
      let eraIndex = eras.indexOf(value2.era);
      if (eraIndex < 0)
        throw new Error("Invalid era: " + value2.era);
      eraIndex = $735220c2d4774dd3$var$cycleValue(eraIndex, amount, 0, eras.length - 1, options === null || options === void 0 ? void 0 : options.round);
      mutable.era = eras[eraIndex];
      $735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
      break;
    }
    case "year":
      var _mutable_calendar_isInverseEra, _mutable_calendar;
      if ((_mutable_calendar_isInverseEra = (_mutable_calendar = mutable.calendar).isInverseEra) === null || _mutable_calendar_isInverseEra === void 0 ? void 0 : _mutable_calendar_isInverseEra.call(_mutable_calendar, mutable))
        amount = -amount;
      mutable.year = $735220c2d4774dd3$var$cycleValue(value2.year, amount, -Infinity, 9999, options === null || options === void 0 ? void 0 : options.round);
      if (mutable.year === -Infinity)
        mutable.year = 1;
      if (mutable.calendar.balanceYearMonth)
        mutable.calendar.balanceYearMonth(mutable, value2);
      break;
    case "month":
      mutable.month = $735220c2d4774dd3$var$cycleValue(value2.month, amount, 1, value2.calendar.getMonthsInYear(value2), options === null || options === void 0 ? void 0 : options.round);
      break;
    case "day":
      mutable.day = $735220c2d4774dd3$var$cycleValue(value2.day, amount, 1, value2.calendar.getDaysInMonth(value2), options === null || options === void 0 ? void 0 : options.round);
      break;
    default:
      throw new Error("Unsupported field " + field);
  }
  if (value2.calendar.balanceDate)
    value2.calendar.balanceDate(mutable);
  $735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
  return mutable;
}
function $735220c2d4774dd3$export$dd02b3e0007dfe28(value2, field, amount, options) {
  let mutable = value2.copy();
  switch (field) {
    case "hour": {
      let hours2 = value2.hour;
      let min2 = 0;
      let max2 = 23;
      if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
        let isPM = hours2 >= 12;
        min2 = isPM ? 12 : 0;
        max2 = isPM ? 23 : 11;
      }
      mutable.hour = $735220c2d4774dd3$var$cycleValue(hours2, amount, min2, max2, options === null || options === void 0 ? void 0 : options.round);
      break;
    }
    case "minute":
      mutable.minute = $735220c2d4774dd3$var$cycleValue(value2.minute, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
      break;
    case "second":
      mutable.second = $735220c2d4774dd3$var$cycleValue(value2.second, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
      break;
    case "millisecond":
      mutable.millisecond = $735220c2d4774dd3$var$cycleValue(value2.millisecond, amount, 0, 999, options === null || options === void 0 ? void 0 : options.round);
      break;
    default:
      throw new Error("Unsupported field " + field);
  }
  return mutable;
}
function $735220c2d4774dd3$var$cycleValue(value2, amount, min2, max2, round2 = false) {
  if (round2) {
    value2 += Math.sign(amount);
    if (value2 < min2)
      value2 = max2;
    let div = Math.abs(amount);
    if (amount > 0)
      value2 = Math.ceil(value2 / div) * div;
    else
      value2 = Math.floor(value2 / div) * div;
    if (value2 > max2)
      value2 = min2;
  } else {
    value2 += amount;
    if (value2 < min2)
      value2 = max2 - (min2 - value2 - 1);
    else if (value2 > max2)
      value2 = min2 + (value2 - max2 - 1);
  }
  return value2;
}
function $735220c2d4774dd3$export$96b1d28349274637(dateTime, duration2) {
  let ms;
  if (duration2.years != null && duration2.years !== 0 || duration2.months != null && duration2.months !== 0 || duration2.weeks != null && duration2.weeks !== 0 || duration2.days != null && duration2.days !== 0) {
    let res2 = $735220c2d4774dd3$export$e16d8520af44a096($11d87f3f76e88657$export$b21e0b124e224484(dateTime), {
      years: duration2.years,
      months: duration2.months,
      weeks: duration2.weeks,
      days: duration2.days
    });
    ms = $11d87f3f76e88657$export$5107c82f94518f5c(res2, dateTime.timeZone);
  } else
    ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime) - dateTime.offset;
  ms += duration2.milliseconds || 0;
  ms += (duration2.seconds || 0) * 1e3;
  ms += (duration2.minutes || 0) * 6e4;
  ms += (duration2.hours || 0) * 36e5;
  let res = $11d87f3f76e88657$export$1b96692a1ba042ac(ms, dateTime.timeZone);
  return $11d87f3f76e88657$export$b4a036af3fc0b032(res, dateTime.calendar);
}
function $735220c2d4774dd3$export$6814caac34ca03c7(dateTime, duration2) {
  return $735220c2d4774dd3$export$96b1d28349274637(dateTime, $735220c2d4774dd3$export$3e2544e88a25bff8(duration2));
}
function $735220c2d4774dd3$export$9a297d111fc86b79(dateTime, field, amount, options) {
  switch (field) {
    case "hour": {
      let min2 = 0;
      let max2 = 23;
      if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
        let isPM = dateTime.hour >= 12;
        min2 = isPM ? 12 : 0;
        max2 = isPM ? 23 : 11;
      }
      let plainDateTime = $11d87f3f76e88657$export$b21e0b124e224484(dateTime);
      let minDate = $11d87f3f76e88657$export$b4a036af3fc0b032($735220c2d4774dd3$export$e5d5e1c1822b6e56(plainDateTime, {
        hour: min2
      }), new $3b62074eb05584b2$export$80ee6245ec4f29ec());
      let minAbsolute = [
        $11d87f3f76e88657$export$5107c82f94518f5c(minDate, dateTime.timeZone, "earlier"),
        $11d87f3f76e88657$export$5107c82f94518f5c(minDate, dateTime.timeZone, "later")
      ].filter((ms2) => $11d87f3f76e88657$export$1b96692a1ba042ac(ms2, dateTime.timeZone).day === minDate.day)[0];
      let maxDate = $11d87f3f76e88657$export$b4a036af3fc0b032($735220c2d4774dd3$export$e5d5e1c1822b6e56(plainDateTime, {
        hour: max2
      }), new $3b62074eb05584b2$export$80ee6245ec4f29ec());
      let maxAbsolute = [
        $11d87f3f76e88657$export$5107c82f94518f5c(maxDate, dateTime.timeZone, "earlier"),
        $11d87f3f76e88657$export$5107c82f94518f5c(maxDate, dateTime.timeZone, "later")
      ].filter((ms2) => $11d87f3f76e88657$export$1b96692a1ba042ac(ms2, dateTime.timeZone).day === maxDate.day).pop();
      let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime) - dateTime.offset;
      let hours2 = Math.floor(ms / $735220c2d4774dd3$var$ONE_HOUR);
      let remainder = ms % $735220c2d4774dd3$var$ONE_HOUR;
      ms = $735220c2d4774dd3$var$cycleValue(hours2, amount, Math.floor(minAbsolute / $735220c2d4774dd3$var$ONE_HOUR), Math.floor(maxAbsolute / $735220c2d4774dd3$var$ONE_HOUR), options === null || options === void 0 ? void 0 : options.round) * $735220c2d4774dd3$var$ONE_HOUR + remainder;
      return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, dateTime.timeZone), dateTime.calendar);
    }
    case "minute":
    case "second":
    case "millisecond":
      return $735220c2d4774dd3$export$dd02b3e0007dfe28(dateTime, field, amount, options);
    case "era":
    case "year":
    case "month":
    case "day": {
      let res = $735220c2d4774dd3$export$d52ced6badfb9a4c($11d87f3f76e88657$export$b21e0b124e224484(dateTime), field, amount, options);
      let ms = $11d87f3f76e88657$export$5107c82f94518f5c(res, dateTime.timeZone);
      return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, dateTime.timeZone), dateTime.calendar);
    }
    default:
      throw new Error("Unsupported field " + field);
  }
}
function $735220c2d4774dd3$export$31b5430eb18be4f8(dateTime, fields, disambiguation) {
  let plainDateTime = $11d87f3f76e88657$export$b21e0b124e224484(dateTime);
  let res = $735220c2d4774dd3$export$e5d5e1c1822b6e56($735220c2d4774dd3$export$adaa4cf7ef1b65be(plainDateTime, fields), fields);
  if (res.compare(plainDateTime) === 0)
    return dateTime;
  let ms = $11d87f3f76e88657$export$5107c82f94518f5c(res, dateTime.timeZone, disambiguation);
  return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, dateTime.timeZone), dateTime.calendar);
}
function $fae977aafc393c5c$export$f59dee82248f5ad4(time2) {
  return `${String(time2.hour).padStart(2, "0")}:${String(time2.minute).padStart(2, "0")}:${String(time2.second).padStart(2, "0")}${time2.millisecond ? String(time2.millisecond / 1e3).slice(1) : ""}`;
}
function $fae977aafc393c5c$export$60dfd74aa96791bd(date4) {
  let gregorianDate = $11d87f3f76e88657$export$b4a036af3fc0b032(date4, new $3b62074eb05584b2$export$80ee6245ec4f29ec());
  let year;
  if (gregorianDate.era === "BC")
    year = gregorianDate.year === 1 ? "0000" : "-" + String(Math.abs(1 - gregorianDate.year)).padStart(6, "00");
  else
    year = String(gregorianDate.year).padStart(4, "0");
  return `${year}-${String(gregorianDate.month).padStart(2, "0")}-${String(gregorianDate.day).padStart(2, "0")}`;
}
function $fae977aafc393c5c$export$4223de14708adc63(date4) {
  return `${$fae977aafc393c5c$export$60dfd74aa96791bd(date4)}T${$fae977aafc393c5c$export$f59dee82248f5ad4(date4)}`;
}
function $fae977aafc393c5c$var$offsetToString(offset2) {
  let sign2 = Math.sign(offset2) < 0 ? "-" : "+";
  offset2 = Math.abs(offset2);
  let offsetHours = Math.floor(offset2 / 36e5);
  let offsetMinutes = offset2 % 36e5 / 6e4;
  return `${sign2}${String(offsetHours).padStart(2, "0")}:${String(offsetMinutes).padStart(2, "0")}`;
}
function $fae977aafc393c5c$export$bf79f1ebf4b18792(date4) {
  return `${$fae977aafc393c5c$export$4223de14708adc63(date4)}${$fae977aafc393c5c$var$offsetToString(date4.offset)}[${date4.timeZone}]`;
}
function _check_private_redeclaration(obj, privateCollection) {
  if (privateCollection.has(obj)) {
    throw new TypeError("Cannot initialize the same private elements twice on an object");
  }
}
function _class_private_field_init(obj, privateMap, value2) {
  _check_private_redeclaration(obj, privateMap);
  privateMap.set(obj, value2);
}
function $35ea8db9cb2ccb90$var$shiftArgs(args) {
  let calendar2 = typeof args[0] === "object" ? args.shift() : new $3b62074eb05584b2$export$80ee6245ec4f29ec();
  let era;
  if (typeof args[0] === "string")
    era = args.shift();
  else {
    let eras = calendar2.getEras();
    era = eras[eras.length - 1];
  }
  let year = args.shift();
  let month = args.shift();
  let day = args.shift();
  return [
    calendar2,
    era,
    year,
    month,
    day
  ];
}
var $35ea8db9cb2ccb90$var$_type = /* @__PURE__ */ new WeakMap();
class $35ea8db9cb2ccb90$export$99faa760c7908e4f {
  /** Returns a copy of this date. */
  copy() {
    if (this.era)
      return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.era, this.year, this.month, this.day);
    else
      return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.year, this.month, this.day);
  }
  /** Returns a new `CalendarDate` with the given duration added to it. */
  add(duration2) {
    return $735220c2d4774dd3$export$e16d8520af44a096(this, duration2);
  }
  /** Returns a new `CalendarDate` with the given duration subtracted from it. */
  subtract(duration2) {
    return $735220c2d4774dd3$export$4e2d2ead65e5f7e3(this, duration2);
  }
  /** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */
  set(fields) {
    return $735220c2d4774dd3$export$adaa4cf7ef1b65be(this, fields);
  }
  /**
  * Returns a new `CalendarDate` with the given field adjusted by a specified amount.
  * When the resulting value reaches the limits of the field, it wraps around.
  */
  cycle(field, amount, options) {
    return $735220c2d4774dd3$export$d52ced6badfb9a4c(this, field, amount, options);
  }
  /** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */
  toDate(timeZone) {
    return $11d87f3f76e88657$export$e67a095c620b86fe(this, timeZone);
  }
  /** Converts the date to an ISO 8601 formatted string. */
  toString() {
    return $fae977aafc393c5c$export$60dfd74aa96791bd(this);
  }
  /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
  compare(b2) {
    return $14e0f24ef4ac5c92$export$68781ddf31c0090f(this, b2);
  }
  constructor(...args) {
    _class_private_field_init(this, $35ea8db9cb2ccb90$var$_type, {
      writable: true,
      value: void 0
    });
    let [calendar2, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
    this.calendar = calendar2;
    this.era = era;
    this.year = year;
    this.month = month;
    this.day = day;
    $735220c2d4774dd3$export$c4e2ecac49351ef2(this);
  }
}
var $35ea8db9cb2ccb90$var$_type1 = /* @__PURE__ */ new WeakMap();
class $35ea8db9cb2ccb90$export$680ea196effce5f {
  /** Returns a copy of this time. */
  copy() {
    return new $35ea8db9cb2ccb90$export$680ea196effce5f(this.hour, this.minute, this.second, this.millisecond);
  }
  /** Returns a new `Time` with the given duration added to it. */
  add(duration2) {
    return $735220c2d4774dd3$export$7ed87b6bc2506470(this, duration2);
  }
  /** Returns a new `Time` with the given duration subtracted from it. */
  subtract(duration2) {
    return $735220c2d4774dd3$export$fe34d3a381cd7501(this, duration2);
  }
  /** Returns a new `Time` with the given fields set to the provided values. Other fields will be constrained accordingly. */
  set(fields) {
    return $735220c2d4774dd3$export$e5d5e1c1822b6e56(this, fields);
  }
  /**
  * Returns a new `Time` with the given field adjusted by a specified amount.
  * When the resulting value reaches the limits of the field, it wraps around.
  */
  cycle(field, amount, options) {
    return $735220c2d4774dd3$export$dd02b3e0007dfe28(this, field, amount, options);
  }
  /** Converts the time to an ISO 8601 formatted string. */
  toString() {
    return $fae977aafc393c5c$export$f59dee82248f5ad4(this);
  }
  /** Compares this time with another. A negative result indicates that this time is before the given one, and a positive time indicates that it is after. */
  compare(b2) {
    return $14e0f24ef4ac5c92$export$c19a80a9721b80f6(this, b2);
  }
  constructor(hour = 0, minute = 0, second = 0, millisecond = 0) {
    _class_private_field_init(this, $35ea8db9cb2ccb90$var$_type1, {
      writable: true,
      value: void 0
    });
    this.hour = hour;
    this.minute = minute;
    this.second = second;
    this.millisecond = millisecond;
    $735220c2d4774dd3$export$7555de1e070510cb(this);
  }
}
var $35ea8db9cb2ccb90$var$_type2 = /* @__PURE__ */ new WeakMap();
class $35ea8db9cb2ccb90$export$ca871e8dbb80966f {
  /** Returns a copy of this date. */
  copy() {
    if (this.era)
      return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
    else
      return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
  }
  /** Returns a new `CalendarDateTime` with the given duration added to it. */
  add(duration2) {
    return $735220c2d4774dd3$export$e16d8520af44a096(this, duration2);
  }
  /** Returns a new `CalendarDateTime` with the given duration subtracted from it. */
  subtract(duration2) {
    return $735220c2d4774dd3$export$4e2d2ead65e5f7e3(this, duration2);
  }
  /** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
  set(fields) {
    return $735220c2d4774dd3$export$adaa4cf7ef1b65be($735220c2d4774dd3$export$e5d5e1c1822b6e56(this, fields), fields);
  }
  /**
  * Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.
  * When the resulting value reaches the limits of the field, it wraps around.
  */
  cycle(field, amount, options) {
    switch (field) {
      case "era":
      case "year":
      case "month":
      case "day":
        return $735220c2d4774dd3$export$d52ced6badfb9a4c(this, field, amount, options);
      default:
        return $735220c2d4774dd3$export$dd02b3e0007dfe28(this, field, amount, options);
    }
  }
  /** Converts the date to a native JavaScript Date object in the given time zone. */
  toDate(timeZone, disambiguation) {
    return $11d87f3f76e88657$export$e67a095c620b86fe(this, timeZone, disambiguation);
  }
  /** Converts the date to an ISO 8601 formatted string. */
  toString() {
    return $fae977aafc393c5c$export$4223de14708adc63(this);
  }
  /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
  compare(b2) {
    let res = $14e0f24ef4ac5c92$export$68781ddf31c0090f(this, b2);
    if (res === 0)
      return $14e0f24ef4ac5c92$export$c19a80a9721b80f6(this, $11d87f3f76e88657$export$b21e0b124e224484(b2));
    return res;
  }
  constructor(...args) {
    _class_private_field_init(this, $35ea8db9cb2ccb90$var$_type2, {
      writable: true,
      value: void 0
    });
    let [calendar2, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
    this.calendar = calendar2;
    this.era = era;
    this.year = year;
    this.month = month;
    this.day = day;
    this.hour = args.shift() || 0;
    this.minute = args.shift() || 0;
    this.second = args.shift() || 0;
    this.millisecond = args.shift() || 0;
    $735220c2d4774dd3$export$c4e2ecac49351ef2(this);
  }
}
var $35ea8db9cb2ccb90$var$_type3 = /* @__PURE__ */ new WeakMap();
class $35ea8db9cb2ccb90$export$d3b7288e7994edea {
  /** Returns a copy of this date. */
  copy() {
    if (this.era)
      return new $35ea8db9cb2ccb90$export$d3b7288e7994edea(this.calendar, this.era, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
    else
      return new $35ea8db9cb2ccb90$export$d3b7288e7994edea(this.calendar, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
  }
  /** Returns a new `ZonedDateTime` with the given duration added to it. */
  add(duration2) {
    return $735220c2d4774dd3$export$96b1d28349274637(this, duration2);
  }
  /** Returns a new `ZonedDateTime` with the given duration subtracted from it. */
  subtract(duration2) {
    return $735220c2d4774dd3$export$6814caac34ca03c7(this, duration2);
  }
  /** Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
  set(fields, disambiguation) {
    return $735220c2d4774dd3$export$31b5430eb18be4f8(this, fields, disambiguation);
  }
  /**
  * Returns a new `ZonedDateTime` with the given field adjusted by a specified amount.
  * When the resulting value reaches the limits of the field, it wraps around.
  */
  cycle(field, amount, options) {
    return $735220c2d4774dd3$export$9a297d111fc86b79(this, field, amount, options);
  }
  /** Converts the date to a native JavaScript Date object. */
  toDate() {
    return $11d87f3f76e88657$export$83aac07b4c37b25(this);
  }
  /** Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone identifier. */
  toString() {
    return $fae977aafc393c5c$export$bf79f1ebf4b18792(this);
  }
  /** Converts the date to an ISO 8601 formatted string in UTC. */
  toAbsoluteString() {
    return this.toDate().toISOString();
  }
  /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
  compare(b2) {
    return this.toDate().getTime() - $11d87f3f76e88657$export$84c95a83c799e074(b2, this.timeZone).toDate().getTime();
  }
  constructor(...args) {
    _class_private_field_init(this, $35ea8db9cb2ccb90$var$_type3, {
      writable: true,
      value: void 0
    });
    let [calendar2, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
    let timeZone = args.shift();
    let offset2 = args.shift();
    this.calendar = calendar2;
    this.era = era;
    this.year = year;
    this.month = month;
    this.day = day;
    this.timeZone = timeZone;
    this.offset = offset2;
    this.hour = args.shift() || 0;
    this.minute = args.shift() || 0;
    this.second = args.shift() || 0;
    this.millisecond = args.shift() || 0;
    $735220c2d4774dd3$export$c4e2ecac49351ef2(this);
  }
}
const $62225008020f0a13$var$ERA_START_DATES = [
  [
    1868,
    9,
    8
  ],
  [
    1912,
    7,
    30
  ],
  [
    1926,
    12,
    25
  ],
  [
    1989,
    1,
    8
  ],
  [
    2019,
    5,
    1
  ]
];
const $62225008020f0a13$var$ERA_END_DATES = [
  [
    1912,
    7,
    29
  ],
  [
    1926,
    12,
    24
  ],
  [
    1989,
    1,
    7
  ],
  [
    2019,
    4,
    30
  ]
];
const $62225008020f0a13$var$ERA_ADDENDS = [
  1867,
  1911,
  1925,
  1988,
  2018
];
const $62225008020f0a13$var$ERA_NAMES = [
  "meiji",
  "taisho",
  "showa",
  "heisei",
  "reiwa"
];
function $62225008020f0a13$var$findEraFromGregorianDate(date4) {
  const idx = $62225008020f0a13$var$ERA_START_DATES.findIndex(([year, month, day]) => {
    if (date4.year < year)
      return true;
    if (date4.year === year && date4.month < month)
      return true;
    if (date4.year === year && date4.month === month && date4.day < day)
      return true;
    return false;
  });
  if (idx === -1)
    return $62225008020f0a13$var$ERA_START_DATES.length - 1;
  if (idx === 0)
    return 0;
  return idx - 1;
}
function $62225008020f0a13$var$toGregorian(date4) {
  let eraAddend = $62225008020f0a13$var$ERA_ADDENDS[$62225008020f0a13$var$ERA_NAMES.indexOf(date4.era)];
  if (!eraAddend)
    throw new Error("Unknown era: " + date4.era);
  return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(date4.year + eraAddend, date4.month, date4.day);
}
class $62225008020f0a13$export$b746ab2b60cdffbf extends $3b62074eb05584b2$export$80ee6245ec4f29ec {
  fromJulianDay(jd2) {
    let date4 = super.fromJulianDay(jd2);
    let era = $62225008020f0a13$var$findEraFromGregorianDate(date4);
    return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, $62225008020f0a13$var$ERA_NAMES[era], date4.year - $62225008020f0a13$var$ERA_ADDENDS[era], date4.month, date4.day);
  }
  toJulianDay(date4) {
    return super.toJulianDay($62225008020f0a13$var$toGregorian(date4));
  }
  balanceDate(date4) {
    let gregorianDate = $62225008020f0a13$var$toGregorian(date4);
    let era = $62225008020f0a13$var$findEraFromGregorianDate(gregorianDate);
    if ($62225008020f0a13$var$ERA_NAMES[era] !== date4.era) {
      date4.era = $62225008020f0a13$var$ERA_NAMES[era];
      date4.year = gregorianDate.year - $62225008020f0a13$var$ERA_ADDENDS[era];
    }
    this.constrainDate(date4);
  }
  constrainDate(date4) {
    let idx = $62225008020f0a13$var$ERA_NAMES.indexOf(date4.era);
    let end2 = $62225008020f0a13$var$ERA_END_DATES[idx];
    if (end2 != null) {
      let [endYear, endMonth, endDay] = end2;
      let maxYear = endYear - $62225008020f0a13$var$ERA_ADDENDS[idx];
      date4.year = Math.max(1, Math.min(maxYear, date4.year));
      if (date4.year === maxYear) {
        date4.month = Math.min(endMonth, date4.month);
        if (date4.month === endMonth)
          date4.day = Math.min(endDay, date4.day);
      }
    }
    if (date4.year === 1 && idx >= 0) {
      let [, startMonth, startDay] = $62225008020f0a13$var$ERA_START_DATES[idx];
      date4.month = Math.max(startMonth, date4.month);
      if (date4.month === startMonth)
        date4.day = Math.max(startDay, date4.day);
    }
  }
  getEras() {
    return $62225008020f0a13$var$ERA_NAMES;
  }
  getYearsInEra(date4) {
    let era = $62225008020f0a13$var$ERA_NAMES.indexOf(date4.era);
    let cur = $62225008020f0a13$var$ERA_START_DATES[era];
    let next2 = $62225008020f0a13$var$ERA_START_DATES[era + 1];
    if (next2 == null)
      return 9999 - cur[0] + 1;
    let years2 = next2[0] - cur[0];
    if (date4.month < next2[1] || date4.month === next2[1] && date4.day < next2[2])
      years2++;
    return years2;
  }
  getDaysInMonth(date4) {
    return super.getDaysInMonth($62225008020f0a13$var$toGregorian(date4));
  }
  getMinimumMonthInYear(date4) {
    let start2 = $62225008020f0a13$var$getMinimums(date4);
    return start2 ? start2[1] : 1;
  }
  getMinimumDayInMonth(date4) {
    let start2 = $62225008020f0a13$var$getMinimums(date4);
    return start2 && date4.month === start2[1] ? start2[2] : 1;
  }
  constructor(...args) {
    super(...args), this.identifier = "japanese";
  }
}
function $62225008020f0a13$var$getMinimums(date4) {
  if (date4.year === 1) {
    let idx = $62225008020f0a13$var$ERA_NAMES.indexOf(date4.era);
    return $62225008020f0a13$var$ERA_START_DATES[idx];
  }
}
const $8d73d47422ca7302$var$BUDDHIST_ERA_START = -543;
class $8d73d47422ca7302$export$42d20a78301dee44 extends $3b62074eb05584b2$export$80ee6245ec4f29ec {
  fromJulianDay(jd2) {
    let gregorianDate = super.fromJulianDay(jd2);
    let year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(gregorianDate.era, gregorianDate.year);
    return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, year - $8d73d47422ca7302$var$BUDDHIST_ERA_START, gregorianDate.month, gregorianDate.day);
  }
  toJulianDay(date4) {
    return super.toJulianDay($8d73d47422ca7302$var$toGregorian(date4));
  }
  getEras() {
    return [
      "BE"
    ];
  }
  getDaysInMonth(date4) {
    return super.getDaysInMonth($8d73d47422ca7302$var$toGregorian(date4));
  }
  balanceDate() {
  }
  constructor(...args) {
    super(...args), this.identifier = "buddhist";
  }
}
function $8d73d47422ca7302$var$toGregorian(date4) {
  let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c(date4.year + $8d73d47422ca7302$var$BUDDHIST_ERA_START);
  return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(era, year, date4.month, date4.day);
}
const $5f31bd6f0c8940b2$var$TAIWAN_ERA_START = 1911;
function $5f31bd6f0c8940b2$var$gregorianYear(date4) {
  return date4.era === "minguo" ? date4.year + $5f31bd6f0c8940b2$var$TAIWAN_ERA_START : 1 - date4.year + $5f31bd6f0c8940b2$var$TAIWAN_ERA_START;
}
function $5f31bd6f0c8940b2$var$gregorianToTaiwan(year) {
  let y2 = year - $5f31bd6f0c8940b2$var$TAIWAN_ERA_START;
  if (y2 > 0)
    return [
      "minguo",
      y2
    ];
  else
    return [
      "before_minguo",
      1 - y2
    ];
}
class $5f31bd6f0c8940b2$export$65e01080afcb0799 extends $3b62074eb05584b2$export$80ee6245ec4f29ec {
  fromJulianDay(jd2) {
    let date4 = super.fromJulianDay(jd2);
    let extendedYear = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(date4.era, date4.year);
    let [era, year] = $5f31bd6f0c8940b2$var$gregorianToTaiwan(extendedYear);
    return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, era, year, date4.month, date4.day);
  }
  toJulianDay(date4) {
    return super.toJulianDay($5f31bd6f0c8940b2$var$toGregorian(date4));
  }
  getEras() {
    return [
      "before_minguo",
      "minguo"
    ];
  }
  balanceDate(date4) {
    let [era, year] = $5f31bd6f0c8940b2$var$gregorianToTaiwan($5f31bd6f0c8940b2$var$gregorianYear(date4));
    date4.era = era;
    date4.year = year;
  }
  isInverseEra(date4) {
    return date4.era === "before_minguo";
  }
  getDaysInMonth(date4) {
    return super.getDaysInMonth($5f31bd6f0c8940b2$var$toGregorian(date4));
  }
  getYearsInEra(date4) {
    return date4.era === "before_minguo" ? 9999 : 9999 - $5f31bd6f0c8940b2$var$TAIWAN_ERA_START;
  }
  constructor(...args) {
    super(...args), this.identifier = "roc";
  }
}
function $5f31bd6f0c8940b2$var$toGregorian(date4) {
  let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c($5f31bd6f0c8940b2$var$gregorianYear(date4));
  return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(era, year, date4.month, date4.day);
}
const $f3ed2e4472ae7e25$var$PERSIAN_EPOCH = 1948320;
const $f3ed2e4472ae7e25$var$MONTH_START = [
  0,
  31,
  62,
  93,
  124,
  155,
  186,
  216,
  246,
  276,
  306,
  336
  // Esfand
];
class $f3ed2e4472ae7e25$export$37fccdbfd14c5939 {
  fromJulianDay(jd2) {
    let daysSinceEpoch = jd2 - $f3ed2e4472ae7e25$var$PERSIAN_EPOCH;
    let year = 1 + Math.floor((33 * daysSinceEpoch + 3) / 12053);
    let farvardin1 = 365 * (year - 1) + Math.floor((8 * year + 21) / 33);
    let dayOfYear = daysSinceEpoch - farvardin1;
    let month = dayOfYear < 216 ? Math.floor(dayOfYear / 31) : Math.floor((dayOfYear - 6) / 30);
    let day = dayOfYear - $f3ed2e4472ae7e25$var$MONTH_START[month] + 1;
    return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, year, month + 1, day);
  }
  toJulianDay(date4) {
    let jd2 = $f3ed2e4472ae7e25$var$PERSIAN_EPOCH - 1 + 365 * (date4.year - 1) + Math.floor((8 * date4.year + 21) / 33);
    jd2 += $f3ed2e4472ae7e25$var$MONTH_START[date4.month - 1];
    jd2 += date4.day;
    return jd2;
  }
  getMonthsInYear() {
    return 12;
  }
  getDaysInMonth(date4) {
    if (date4.month <= 6)
      return 31;
    if (date4.month <= 11)
      return 30;
    let isLeapYear2 = $2b4dce13dd5a17fa$export$842a2cf37af977e1(25 * date4.year + 11, 33) < 8;
    return isLeapYear2 ? 30 : 29;
  }
  getEras() {
    return [
      "AP"
    ];
  }
  getYearsInEra() {
    return 9377;
  }
  constructor() {
    this.identifier = "persian";
  }
}
const $82c358003bdda0a8$var$INDIAN_ERA_START = 78;
const $82c358003bdda0a8$var$INDIAN_YEAR_START = 80;
class $82c358003bdda0a8$export$39f31c639fa15726 extends $3b62074eb05584b2$export$80ee6245ec4f29ec {
  fromJulianDay(jd2) {
    let date4 = super.fromJulianDay(jd2);
    let indianYear = date4.year - $82c358003bdda0a8$var$INDIAN_ERA_START;
    let yDay = jd2 - $3b62074eb05584b2$export$f297eb839006d339(date4.era, date4.year, 1, 1);
    let leapMonth;
    if (yDay < $82c358003bdda0a8$var$INDIAN_YEAR_START) {
      indianYear--;
      leapMonth = $3b62074eb05584b2$export$553d7fa8e3805fc0(date4.year - 1) ? 31 : 30;
      yDay += leapMonth + 155 + 90 + 10;
    } else {
      leapMonth = $3b62074eb05584b2$export$553d7fa8e3805fc0(date4.year) ? 31 : 30;
      yDay -= $82c358003bdda0a8$var$INDIAN_YEAR_START;
    }
    let indianMonth;
    let indianDay;
    if (yDay < leapMonth) {
      indianMonth = 1;
      indianDay = yDay + 1;
    } else {
      let mDay = yDay - leapMonth;
      if (mDay < 155) {
        indianMonth = Math.floor(mDay / 31) + 2;
        indianDay = mDay % 31 + 1;
      } else {
        mDay -= 155;
        indianMonth = Math.floor(mDay / 30) + 7;
        indianDay = mDay % 30 + 1;
      }
    }
    return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, indianYear, indianMonth, indianDay);
  }
  toJulianDay(date4) {
    let extendedYear = date4.year + $82c358003bdda0a8$var$INDIAN_ERA_START;
    let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c(extendedYear);
    let leapMonth;
    let jd2;
    if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year)) {
      leapMonth = 31;
      jd2 = $3b62074eb05584b2$export$f297eb839006d339(era, year, 3, 21);
    } else {
      leapMonth = 30;
      jd2 = $3b62074eb05584b2$export$f297eb839006d339(era, year, 3, 22);
    }
    if (date4.month === 1)
      return jd2 + date4.day - 1;
    jd2 += leapMonth + Math.min(date4.month - 2, 5) * 31;
    if (date4.month >= 8)
      jd2 += (date4.month - 7) * 30;
    jd2 += date4.day - 1;
    return jd2;
  }
  getDaysInMonth(date4) {
    if (date4.month === 1 && $3b62074eb05584b2$export$553d7fa8e3805fc0(date4.year + $82c358003bdda0a8$var$INDIAN_ERA_START))
      return 31;
    if (date4.month >= 2 && date4.month <= 6)
      return 31;
    return 30;
  }
  getYearsInEra() {
    return 9919;
  }
  getEras() {
    return [
      "saka"
    ];
  }
  balanceDate() {
  }
  constructor(...args) {
    super(...args), this.identifier = "indian";
  }
}
const $f2f3e0e3a817edbd$var$CIVIL_EPOC = 1948440;
const $f2f3e0e3a817edbd$var$ASTRONOMICAL_EPOC = 1948439;
const $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START = 1300;
const $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END = 1600;
const $f2f3e0e3a817edbd$var$UMALQURA_START_DAYS = 460322;
function $f2f3e0e3a817edbd$var$islamicToJulianDay(epoch, year, month, day) {
  return day + Math.ceil(29.5 * (month - 1)) + (year - 1) * 354 + Math.floor((3 + 11 * year) / 30) + epoch - 1;
}
function $f2f3e0e3a817edbd$var$julianDayToIslamic(calendar2, epoch, jd2) {
  let year = Math.floor((30 * (jd2 - epoch) + 10646) / 10631);
  let month = Math.min(12, Math.ceil((jd2 - (29 + $f2f3e0e3a817edbd$var$islamicToJulianDay(epoch, year, 1, 1))) / 29.5) + 1);
  let day = jd2 - $f2f3e0e3a817edbd$var$islamicToJulianDay(epoch, year, month, 1) + 1;
  return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(calendar2, year, month, day);
}
function $f2f3e0e3a817edbd$var$isLeapYear(year) {
  return (14 + 11 * year) % 30 < 11;
}
class $f2f3e0e3a817edbd$export$2066795aadd37bfc {
  fromJulianDay(jd2) {
    return $f2f3e0e3a817edbd$var$julianDayToIslamic(this, $f2f3e0e3a817edbd$var$CIVIL_EPOC, jd2);
  }
  toJulianDay(date4) {
    return $f2f3e0e3a817edbd$var$islamicToJulianDay($f2f3e0e3a817edbd$var$CIVIL_EPOC, date4.year, date4.month, date4.day);
  }
  getDaysInMonth(date4) {
    let length2 = 29 + date4.month % 2;
    if (date4.month === 12 && $f2f3e0e3a817edbd$var$isLeapYear(date4.year))
      length2++;
    return length2;
  }
  getMonthsInYear() {
    return 12;
  }
  getDaysInYear(date4) {
    return $f2f3e0e3a817edbd$var$isLeapYear(date4.year) ? 355 : 354;
  }
  getYearsInEra() {
    return 9665;
  }
  getEras() {
    return [
      "AH"
    ];
  }
  constructor() {
    this.identifier = "islamic-civil";
  }
}
class $f2f3e0e3a817edbd$export$37f0887f2f9d22f7 extends $f2f3e0e3a817edbd$export$2066795aadd37bfc {
  fromJulianDay(jd2) {
    return $f2f3e0e3a817edbd$var$julianDayToIslamic(this, $f2f3e0e3a817edbd$var$ASTRONOMICAL_EPOC, jd2);
  }
  toJulianDay(date4) {
    return $f2f3e0e3a817edbd$var$islamicToJulianDay($f2f3e0e3a817edbd$var$ASTRONOMICAL_EPOC, date4.year, date4.month, date4.day);
  }
  constructor(...args) {
    super(...args), this.identifier = "islamic-tbla";
  }
}
const $f2f3e0e3a817edbd$var$UMALQURA_DATA = "qgpUDckO1AbqBmwDrQpVBakGkgepC9QF2gpcBS0NlQZKB1QLagutBa4ETwoXBYsGpQbVCtYCWwmdBE0KJg2VDawFtgm6AlsKKwWVCsoG6Qr0AnYJtgJWCcoKpAvSC9kF3AJtCU0FpQpSC6ULtAW2CVcFlwJLBaMGUgdlC2oFqworBZUMSg2lDcoF1gpXCasESwmlClILagt1BXYCtwhbBFUFqQW0BdoJ3QRuAjYJqgpUDbIN1QXaAlsJqwRVCkkLZAtxC7QFtQpVCiUNkg7JDtQG6QprCasEkwpJDaQNsg25CroEWworBZUKKgtVC1wFvQQ9Ah0JlQpKC1oLbQW2AjsJmwRVBqkGVAdqC2wFrQpVBSkLkgupC9QF2gpaBasKlQVJB2QHqgu1BbYCVgpNDiULUgtqC60FrgIvCZcESwalBqwG1gpdBZ0ETQoWDZUNqgW1BdoCWwmtBJUFygbkBuoK9QS2AlYJqgpUC9IL2QXqAm0JrQSVCkoLpQuyBbUJ1gSXCkcFkwZJB1ULagVrCisFiwpGDaMNygXWCtsEawJLCaUKUgtpC3UFdgG3CFsCKwVlBbQF2gntBG0BtgimClINqQ3UBdoKWwmrBFMGKQdiB6kLsgW1ClUFJQuSDckO0gbpCmsFqwRVCikNVA2qDbUJugQ7CpsETQqqCtUK2gJdCV4ELgqaDFUNsga5BroEXQotBZUKUguoC7QLuQXaAloJSgukDdEO6AZqC20FNQWVBkoNqA3UDdoGWwWdAisGFQtKC5ULqgWuCi4JjwwnBZUGqgbWCl0FnQI=";
let $f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH;
let $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE;
function $f2f3e0e3a817edbd$var$umalquraYearStart(year) {
  return $f2f3e0e3a817edbd$var$UMALQURA_START_DAYS + $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE[year - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START];
}
function $f2f3e0e3a817edbd$var$umalquraMonthLength(year, month) {
  let idx = year - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START;
  let mask = 1 << 11 - (month - 1);
  if (($f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH[idx] & mask) === 0)
    return 29;
  else
    return 30;
}
function $f2f3e0e3a817edbd$var$umalquraMonthStart(year, month) {
  let day = $f2f3e0e3a817edbd$var$umalquraYearStart(year);
  for (let i2 = 1; i2 < month; i2++)
    day += $f2f3e0e3a817edbd$var$umalquraMonthLength(year, i2);
  return day;
}
function $f2f3e0e3a817edbd$var$umalquraYearLength(year) {
  return $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE[year + 1 - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START] - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE[year - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START];
}
class $f2f3e0e3a817edbd$export$5baab4758c231076 extends $f2f3e0e3a817edbd$export$2066795aadd37bfc {
  fromJulianDay(jd2) {
    let days2 = jd2 - $f2f3e0e3a817edbd$var$CIVIL_EPOC;
    let startDays = $f2f3e0e3a817edbd$var$umalquraYearStart($f2f3e0e3a817edbd$var$UMALQURA_YEAR_START);
    let endDays = $f2f3e0e3a817edbd$var$umalquraYearStart($f2f3e0e3a817edbd$var$UMALQURA_YEAR_END);
    if (days2 < startDays || days2 > endDays)
      return super.fromJulianDay(jd2);
    else {
      let y2 = $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START - 1;
      let m2 = 1;
      let d2 = 1;
      while (d2 > 0) {
        y2++;
        d2 = days2 - $f2f3e0e3a817edbd$var$umalquraYearStart(y2) + 1;
        let yearLength = $f2f3e0e3a817edbd$var$umalquraYearLength(y2);
        if (d2 === yearLength) {
          m2 = 12;
          break;
        } else if (d2 < yearLength) {
          let monthLength = $f2f3e0e3a817edbd$var$umalquraMonthLength(y2, m2);
          m2 = 1;
          while (d2 > monthLength) {
            d2 -= monthLength;
            m2++;
            monthLength = $f2f3e0e3a817edbd$var$umalquraMonthLength(y2, m2);
          }
          break;
        }
      }
      return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, y2, m2, days2 - $f2f3e0e3a817edbd$var$umalquraMonthStart(y2, m2) + 1);
    }
  }
  toJulianDay(date4) {
    if (date4.year < $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START || date4.year > $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END)
      return super.toJulianDay(date4);
    return $f2f3e0e3a817edbd$var$CIVIL_EPOC + $f2f3e0e3a817edbd$var$umalquraMonthStart(date4.year, date4.month) + (date4.day - 1);
  }
  getDaysInMonth(date4) {
    if (date4.year < $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START || date4.year > $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END)
      return super.getDaysInMonth(date4);
    return $f2f3e0e3a817edbd$var$umalquraMonthLength(date4.year, date4.month);
  }
  getDaysInYear(date4) {
    if (date4.year < $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START || date4.year > $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END)
      return super.getDaysInYear(date4);
    return $f2f3e0e3a817edbd$var$umalquraYearLength(date4.year);
  }
  constructor() {
    super(), this.identifier = "islamic-umalqura";
    if (!$f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH)
      $f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH = new Uint16Array(Uint8Array.from(atob($f2f3e0e3a817edbd$var$UMALQURA_DATA), (c2) => c2.charCodeAt(0)).buffer);
    if (!$f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE) {
      $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE = new Uint32Array($f2f3e0e3a817edbd$var$UMALQURA_YEAR_END - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START + 1);
      let yearStart = 0;
      for (let year = $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START; year <= $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END; year++) {
        $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE[year - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START] = yearStart;
        for (let i2 = 1; i2 <= 12; i2++)
          yearStart += $f2f3e0e3a817edbd$var$umalquraMonthLength(year, i2);
      }
    }
  }
}
const $7c5f6fbf42389787$var$HEBREW_EPOCH = 347997;
const $7c5f6fbf42389787$var$HOUR_PARTS = 1080;
const $7c5f6fbf42389787$var$DAY_PARTS = 24 * $7c5f6fbf42389787$var$HOUR_PARTS;
const $7c5f6fbf42389787$var$MONTH_DAYS = 29;
const $7c5f6fbf42389787$var$MONTH_FRACT = 12 * $7c5f6fbf42389787$var$HOUR_PARTS + 793;
const $7c5f6fbf42389787$var$MONTH_PARTS = $7c5f6fbf42389787$var$MONTH_DAYS * $7c5f6fbf42389787$var$DAY_PARTS + $7c5f6fbf42389787$var$MONTH_FRACT;
function $7c5f6fbf42389787$var$isLeapYear(year) {
  return $2b4dce13dd5a17fa$export$842a2cf37af977e1(year * 7 + 1, 19) < 7;
}
function $7c5f6fbf42389787$var$hebrewDelay1(year) {
  let months2 = Math.floor((235 * year - 234) / 19);
  let parts = 12084 + 13753 * months2;
  let day = months2 * 29 + Math.floor(parts / 25920);
  if ($2b4dce13dd5a17fa$export$842a2cf37af977e1(3 * (day + 1), 7) < 3)
    day += 1;
  return day;
}
function $7c5f6fbf42389787$var$hebrewDelay2(year) {
  let last = $7c5f6fbf42389787$var$hebrewDelay1(year - 1);
  let present = $7c5f6fbf42389787$var$hebrewDelay1(year);
  let next2 = $7c5f6fbf42389787$var$hebrewDelay1(year + 1);
  if (next2 - present === 356)
    return 2;
  if (present - last === 382)
    return 1;
  return 0;
}
function $7c5f6fbf42389787$var$startOfYear(year) {
  return $7c5f6fbf42389787$var$hebrewDelay1(year) + $7c5f6fbf42389787$var$hebrewDelay2(year);
}
function $7c5f6fbf42389787$var$getDaysInYear(year) {
  return $7c5f6fbf42389787$var$startOfYear(year + 1) - $7c5f6fbf42389787$var$startOfYear(year);
}
function $7c5f6fbf42389787$var$getYearType(year) {
  let yearLength = $7c5f6fbf42389787$var$getDaysInYear(year);
  if (yearLength > 380)
    yearLength -= 30;
  switch (yearLength) {
    case 353:
      return 0;
    case 354:
      return 1;
    case 355:
      return 2;
  }
}
function $7c5f6fbf42389787$var$getDaysInMonth(year, month) {
  if (month >= 6 && !$7c5f6fbf42389787$var$isLeapYear(year))
    month++;
  if (month === 4 || month === 7 || month === 9 || month === 11 || month === 13)
    return 29;
  let yearType = $7c5f6fbf42389787$var$getYearType(year);
  if (month === 2)
    return yearType === 2 ? 30 : 29;
  if (month === 3)
    return yearType === 0 ? 29 : 30;
  if (month === 6)
    return $7c5f6fbf42389787$var$isLeapYear(year) ? 30 : 0;
  return 30;
}
class $7c5f6fbf42389787$export$ca405048b8fb5af {
  fromJulianDay(jd2) {
    let d2 = jd2 - $7c5f6fbf42389787$var$HEBREW_EPOCH;
    let m2 = d2 * $7c5f6fbf42389787$var$DAY_PARTS / $7c5f6fbf42389787$var$MONTH_PARTS;
    let year = Math.floor((19 * m2 + 234) / 235) + 1;
    let ys = $7c5f6fbf42389787$var$startOfYear(year);
    let dayOfYear = Math.floor(d2 - ys);
    while (dayOfYear < 1) {
      year--;
      ys = $7c5f6fbf42389787$var$startOfYear(year);
      dayOfYear = Math.floor(d2 - ys);
    }
    let month = 1;
    let monthStart = 0;
    while (monthStart < dayOfYear) {
      monthStart += $7c5f6fbf42389787$var$getDaysInMonth(year, month);
      month++;
    }
    month--;
    monthStart -= $7c5f6fbf42389787$var$getDaysInMonth(year, month);
    let day = dayOfYear - monthStart;
    return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, year, month, day);
  }
  toJulianDay(date4) {
    let jd2 = $7c5f6fbf42389787$var$startOfYear(date4.year);
    for (let month = 1; month < date4.month; month++)
      jd2 += $7c5f6fbf42389787$var$getDaysInMonth(date4.year, month);
    return jd2 + date4.day + $7c5f6fbf42389787$var$HEBREW_EPOCH;
  }
  getDaysInMonth(date4) {
    return $7c5f6fbf42389787$var$getDaysInMonth(date4.year, date4.month);
  }
  getMonthsInYear(date4) {
    return $7c5f6fbf42389787$var$isLeapYear(date4.year) ? 13 : 12;
  }
  getDaysInYear(date4) {
    return $7c5f6fbf42389787$var$getDaysInYear(date4.year);
  }
  getYearsInEra() {
    return 9999;
  }
  getEras() {
    return [
      "AM"
    ];
  }
  balanceYearMonth(date4, previousDate) {
    if (previousDate.year !== date4.year) {
      if ($7c5f6fbf42389787$var$isLeapYear(previousDate.year) && !$7c5f6fbf42389787$var$isLeapYear(date4.year) && previousDate.month > 6)
        date4.month--;
      else if (!$7c5f6fbf42389787$var$isLeapYear(previousDate.year) && $7c5f6fbf42389787$var$isLeapYear(date4.year) && previousDate.month > 6)
        date4.month++;
    }
  }
  constructor() {
    this.identifier = "hebrew";
  }
}
const $b956b2d7a6cf451f$var$ETHIOPIC_EPOCH = 1723856;
const $b956b2d7a6cf451f$var$COPTIC_EPOCH = 1824665;
const $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA = 5500;
function $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, month, day) {
  return epoch + 365 * year + Math.floor(year / 4) + 30 * (month - 1) + day - 1;
}
function $b956b2d7a6cf451f$var$julianDayToCE(epoch, jd2) {
  let year = Math.floor(4 * (jd2 - epoch) / 1461);
  let month = 1 + Math.floor((jd2 - $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, 1, 1)) / 30);
  let day = jd2 + 1 - $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, month, 1);
  return [
    year,
    month,
    day
  ];
}
function $b956b2d7a6cf451f$var$getLeapDay(year) {
  return Math.floor(year % 4 / 3);
}
function $b956b2d7a6cf451f$var$getDaysInMonth(year, month) {
  if (month % 13 !== 0)
    return 30;
  else
    return $b956b2d7a6cf451f$var$getLeapDay(year) + 5;
}
class $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
  fromJulianDay(jd2) {
    let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, jd2);
    let era = "AM";
    if (year <= 0) {
      era = "AA";
      year += $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
    }
    return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, era, year, month, day);
  }
  toJulianDay(date4) {
    let year = date4.year;
    if (date4.era === "AA")
      year -= $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
    return $b956b2d7a6cf451f$var$ceToJulianDay($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, year, date4.month, date4.day);
  }
  getDaysInMonth(date4) {
    return $b956b2d7a6cf451f$var$getDaysInMonth(date4.year, date4.month);
  }
  getMonthsInYear() {
    return 13;
  }
  getDaysInYear(date4) {
    return 365 + $b956b2d7a6cf451f$var$getLeapDay(date4.year);
  }
  getYearsInEra(date4) {
    return date4.era === "AA" ? 9999 : 9991;
  }
  getEras() {
    return [
      "AA",
      "AM"
    ];
  }
  constructor() {
    this.identifier = "ethiopic";
  }
}
class $b956b2d7a6cf451f$export$d72e0c37005a4914 extends $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
  fromJulianDay(jd2) {
    let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, jd2);
    year += $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
    return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, "AA", year, month, day);
  }
  getEras() {
    return [
      "AA"
    ];
  }
  getYearsInEra() {
    return 9999;
  }
  constructor(...args) {
    super(...args), this.identifier = "ethioaa";
  }
}
class $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1 extends $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
  fromJulianDay(jd2) {
    let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$COPTIC_EPOCH, jd2);
    let era = "CE";
    if (year <= 0) {
      era = "BCE";
      year = 1 - year;
    }
    return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, era, year, month, day);
  }
  toJulianDay(date4) {
    let year = date4.year;
    if (date4.era === "BCE")
      year = 1 - year;
    return $b956b2d7a6cf451f$var$ceToJulianDay($b956b2d7a6cf451f$var$COPTIC_EPOCH, year, date4.month, date4.day);
  }
  getDaysInMonth(date4) {
    let year = date4.year;
    if (date4.era === "BCE")
      year = 1 - year;
    return $b956b2d7a6cf451f$var$getDaysInMonth(year, date4.month);
  }
  isInverseEra(date4) {
    return date4.era === "BCE";
  }
  balanceDate(date4) {
    if (date4.year <= 0) {
      date4.era = date4.era === "BCE" ? "CE" : "BCE";
      date4.year = 1 - date4.year;
    }
  }
  getEras() {
    return [
      "BCE",
      "CE"
    ];
  }
  getYearsInEra(date4) {
    return date4.era === "BCE" ? 9999 : 9715;
  }
  constructor(...args) {
    super(...args), this.identifier = "coptic";
  }
}
function $64244302c3013299$export$dd0bbc9b26defe37(name2) {
  switch (name2) {
    case "buddhist":
      return new $8d73d47422ca7302$export$42d20a78301dee44();
    case "ethiopic":
      return new $b956b2d7a6cf451f$export$26ba6eab5e20cd7d();
    case "ethioaa":
      return new $b956b2d7a6cf451f$export$d72e0c37005a4914();
    case "coptic":
      return new $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1();
    case "hebrew":
      return new $7c5f6fbf42389787$export$ca405048b8fb5af();
    case "indian":
      return new $82c358003bdda0a8$export$39f31c639fa15726();
    case "islamic-civil":
      return new $f2f3e0e3a817edbd$export$2066795aadd37bfc();
    case "islamic-tbla":
      return new $f2f3e0e3a817edbd$export$37f0887f2f9d22f7();
    case "islamic-umalqura":
      return new $f2f3e0e3a817edbd$export$5baab4758c231076();
    case "japanese":
      return new $62225008020f0a13$export$b746ab2b60cdffbf();
    case "persian":
      return new $f3ed2e4472ae7e25$export$37fccdbfd14c5939();
    case "roc":
      return new $5f31bd6f0c8940b2$export$65e01080afcb0799();
    case "gregory":
    default:
      return new $3b62074eb05584b2$export$80ee6245ec4f29ec();
  }
}
let $fb18d541ea1ad717$var$formatterCache = /* @__PURE__ */ new Map();
class $fb18d541ea1ad717$export$ad991b66133851cf {
  /** Formats a date as a string according to the locale and format options passed to the constructor. */
  format(value2) {
    return this.formatter.format(value2);
  }
  /** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */
  formatToParts(value2) {
    return this.formatter.formatToParts(value2);
  }
  /** Formats a date range as a string. */
  formatRange(start2, end2) {
    if (typeof this.formatter.formatRange === "function")
      return this.formatter.formatRange(start2, end2);
    if (end2 < start2)
      throw new RangeError("End date must be >= start date");
    return `${this.formatter.format(start2)} – ${this.formatter.format(end2)}`;
  }
  /** Formats a date range as an array of parts. */
  formatRangeToParts(start2, end2) {
    if (typeof this.formatter.formatRangeToParts === "function")
      return this.formatter.formatRangeToParts(start2, end2);
    if (end2 < start2)
      throw new RangeError("End date must be >= start date");
    let startParts = this.formatter.formatToParts(start2);
    let endParts = this.formatter.formatToParts(end2);
    return [
      ...startParts.map((p2) => ({
        ...p2,
        source: "startRange"
      })),
      {
        type: "literal",
        value: " – ",
        source: "shared"
      },
      ...endParts.map((p2) => ({
        ...p2,
        source: "endRange"
      }))
    ];
  }
  /** Returns the resolved formatting options based on the values passed to the constructor. */
  resolvedOptions() {
    let resolvedOptions = this.formatter.resolvedOptions();
    if ($fb18d541ea1ad717$var$hasBuggyResolvedHourCycle()) {
      if (!this.resolvedHourCycle)
        this.resolvedHourCycle = $fb18d541ea1ad717$var$getResolvedHourCycle(resolvedOptions.locale, this.options);
      resolvedOptions.hourCycle = this.resolvedHourCycle;
      resolvedOptions.hour12 = this.resolvedHourCycle === "h11" || this.resolvedHourCycle === "h12";
    }
    if (resolvedOptions.calendar === "ethiopic-amete-alem")
      resolvedOptions.calendar = "ethioaa";
    return resolvedOptions;
  }
  constructor(locale2, options = {}) {
    this.formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale2, options);
    this.options = options;
  }
}
const $fb18d541ea1ad717$var$hour12Preferences = {
  true: {
    // Only Japanese uses the h11 style for 12 hour time. All others use h12.
    ja: "h11"
  },
  false: {}
};
function $fb18d541ea1ad717$var$getCachedDateFormatter(locale2, options = {}) {
  if (typeof options.hour12 === "boolean" && $fb18d541ea1ad717$var$hasBuggyHour12Behavior()) {
    options = {
      ...options
    };
    let pref = $fb18d541ea1ad717$var$hour12Preferences[String(options.hour12)][locale2.split("-")[0]];
    let defaultHourCycle = options.hour12 ? "h12" : "h23";
    options.hourCycle = pref !== null && pref !== void 0 ? pref : defaultHourCycle;
    delete options.hour12;
  }
  let cacheKey = locale2 + (options ? Object.entries(options).sort((a2, b2) => a2[0] < b2[0] ? -1 : 1).join() : "");
  if ($fb18d541ea1ad717$var$formatterCache.has(cacheKey))
    return $fb18d541ea1ad717$var$formatterCache.get(cacheKey);
  let numberFormatter = new Intl.DateTimeFormat(locale2, options);
  $fb18d541ea1ad717$var$formatterCache.set(cacheKey, numberFormatter);
  return numberFormatter;
}
let $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = null;
function $fb18d541ea1ad717$var$hasBuggyHour12Behavior() {
  if ($fb18d541ea1ad717$var$_hasBuggyHour12Behavior == null)
    $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat("en-US", {
      hour: "numeric",
      hour12: false
    }).format(new Date(2020, 2, 3, 0)) === "24";
  return $fb18d541ea1ad717$var$_hasBuggyHour12Behavior;
}
let $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = null;
function $fb18d541ea1ad717$var$hasBuggyResolvedHourCycle() {
  if ($fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle == null)
    $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat("fr", {
      hour: "numeric",
      hour12: false
    }).resolvedOptions().hourCycle === "h12";
  return $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle;
}
function $fb18d541ea1ad717$var$getResolvedHourCycle(locale2, options) {
  if (!options.timeStyle && !options.hour)
    return void 0;
  locale2 = locale2.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, "");
  locale2 += (locale2.includes("-u-") ? "" : "-u") + "-nu-latn";
  let formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale2, {
    ...options,
    timeZone: void 0
    // use local timezone
  });
  let min2 = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find((p2) => p2.type === "hour").value, 10);
  let max2 = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find((p2) => p2.type === "hour").value, 10);
  if (min2 === 0 && max2 === 23)
    return "h23";
  if (min2 === 24 && max2 === 23)
    return "h24";
  if (min2 === 0 && max2 === 11)
    return "h11";
  if (min2 === 12 && max2 === 11)
    return "h12";
  throw new Error("Unexpected hour cycle result");
}
let $f4e2df6bd15f8569$var$_tableNestedRows = false;
let $f4e2df6bd15f8569$var$_shadowDOM = false;
function $f4e2df6bd15f8569$export$1b00cb14a96194e6() {
  return $f4e2df6bd15f8569$var$_tableNestedRows;
}
function $f4e2df6bd15f8569$export$98658e8c59125e6a() {
  return $f4e2df6bd15f8569$var$_shadowDOM;
}
function r$8(e2) {
  var t2, f2, n2 = "";
  if ("string" == typeof e2 || "number" == typeof e2)
    n2 += e2;
  else if ("object" == typeof e2)
    if (Array.isArray(e2)) {
      var o2 = e2.length;
      for (t2 = 0; t2 < o2; t2++)
        e2[t2] && (f2 = r$8(e2[t2])) && (n2 && (n2 += " "), n2 += f2);
    } else
      for (f2 in e2)
        e2[f2] && (n2 && (n2 += " "), n2 += f2);
  return n2;
}
function clsx$3() {
  for (var e2, t2, f2 = 0, n2 = "", o2 = arguments.length; f2 < o2; f2++)
    (e2 = arguments[f2]) && (t2 = r$8(e2)) && (n2 && (n2 += " "), n2 += t2);
  return n2;
}
function $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(value2, defaultValue2, onChange) {
  let [stateValue, setStateValue] = reactExports.useState(value2 || defaultValue2);
  let isControlledRef = reactExports.useRef(value2 !== void 0);
  let isControlled = value2 !== void 0;
  reactExports.useEffect(() => {
    isControlledRef.current;
    isControlledRef.current = isControlled;
  }, [
    isControlled
  ]);
  let currentValue = isControlled ? value2 : stateValue;
  let setValue = reactExports.useCallback((value22, ...args) => {
    let onChangeCaller = (value3, ...onChangeArgs) => {
      if (onChange) {
        if (!Object.is(currentValue, value3))
          onChange(value3, ...onChangeArgs);
      }
      if (!isControlled)
        currentValue = value3;
    };
    if (typeof value22 === "function") {
      let updateFunction = (oldValue, ...functionArgs) => {
        let interceptedValue = value22(isControlled ? currentValue : oldValue, ...functionArgs);
        onChangeCaller(interceptedValue, ...args);
        if (!isControlled)
          return interceptedValue;
        return oldValue;
      };
      setStateValue(updateFunction);
    } else {
      if (!isControlled)
        setStateValue(value22);
      onChangeCaller(value22, ...args);
    }
  }, [
    isControlled,
    currentValue,
    onChange
  ]);
  return [
    currentValue,
    setValue
  ];
}
function $9446cca9a3875146$export$7d15b64cf5a3a4c4(value2, min2 = -Infinity, max2 = Infinity) {
  let newValue = Math.min(Math.max(value2, min2), max2);
  return newValue;
}
function $9446cca9a3875146$export$e1a7b8e69ef6c52f(value2, step) {
  let roundedValue = value2;
  let precision = 0;
  let stepString = step.toString();
  let eIndex = stepString.toLowerCase().indexOf("e-");
  if (eIndex > 0)
    precision = Math.abs(Math.floor(Math.log10(Math.abs(step)))) + eIndex;
  else {
    let pointIndex = stepString.indexOf(".");
    if (pointIndex >= 0)
      precision = stepString.length - pointIndex;
  }
  if (precision > 0) {
    let pow = Math.pow(10, precision);
    roundedValue = Math.round(roundedValue * pow) / pow;
  }
  return roundedValue;
}
function $9446cca9a3875146$export$cb6e0bb50bc19463(value2, min2, max2, step) {
  min2 = Number(min2);
  max2 = Number(max2);
  let remainder = (value2 - (isNaN(min2) ? 0 : min2)) % step;
  let snappedValue = $9446cca9a3875146$export$e1a7b8e69ef6c52f(Math.abs(remainder) * 2 >= step ? value2 + Math.sign(remainder) * (step - Math.abs(remainder)) : value2 - remainder, step);
  if (!isNaN(min2)) {
    if (snappedValue < min2)
      snappedValue = min2;
    else if (!isNaN(max2) && snappedValue > max2)
      snappedValue = min2 + Math.floor($9446cca9a3875146$export$e1a7b8e69ef6c52f((max2 - min2) / step, step)) * step;
  } else if (!isNaN(max2) && snappedValue > max2)
    snappedValue = Math.floor($9446cca9a3875146$export$e1a7b8e69ef6c52f(max2 / step, step)) * step;
  snappedValue = $9446cca9a3875146$export$e1a7b8e69ef6c52f(snappedValue, step);
  return snappedValue;
}
let $488c6ddbf4ef74c2$var$formatterCache = /* @__PURE__ */ new Map();
let $488c6ddbf4ef74c2$var$supportsSignDisplay = false;
try {
  $488c6ddbf4ef74c2$var$supportsSignDisplay = new Intl.NumberFormat("de-DE", {
    signDisplay: "exceptZero"
  }).resolvedOptions().signDisplay === "exceptZero";
} catch {
}
let $488c6ddbf4ef74c2$var$supportsUnit = false;
try {
  $488c6ddbf4ef74c2$var$supportsUnit = new Intl.NumberFormat("de-DE", {
    style: "unit",
    unit: "degree"
  }).resolvedOptions().style === "unit";
} catch {
}
const $488c6ddbf4ef74c2$var$UNITS = {
  degree: {
    narrow: {
      default: "°",
      "ja-JP": " 度",
      "zh-TW": "度",
      "sl-SI": " °"
    }
  }
};
class $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5 {
  /** Formats a number value as a string, according to the locale and options provided to the constructor. */
  format(value2) {
    let res = "";
    if (!$488c6ddbf4ef74c2$var$supportsSignDisplay && this.options.signDisplay != null)
      res = $488c6ddbf4ef74c2$export$711b50b3c525e0f2(this.numberFormatter, this.options.signDisplay, value2);
    else
      res = this.numberFormatter.format(value2);
    if (this.options.style === "unit" && !$488c6ddbf4ef74c2$var$supportsUnit) {
      var _UNITS_unit;
      let { unit: unit2, unitDisplay = "short", locale: locale2 } = this.resolvedOptions();
      if (!unit2)
        return res;
      let values = (_UNITS_unit = $488c6ddbf4ef74c2$var$UNITS[unit2]) === null || _UNITS_unit === void 0 ? void 0 : _UNITS_unit[unitDisplay];
      res += values[locale2] || values.default;
    }
    return res;
  }
  /** Formats a number to an array of parts such as separators, digits, punctuation, and more. */
  formatToParts(value2) {
    return this.numberFormatter.formatToParts(value2);
  }
  /** Formats a number range as a string. */
  formatRange(start2, end2) {
    if (typeof this.numberFormatter.formatRange === "function")
      return this.numberFormatter.formatRange(start2, end2);
    if (end2 < start2)
      throw new RangeError("End date must be >= start date");
    return `${this.format(start2)} – ${this.format(end2)}`;
  }
  /** Formats a number range as an array of parts. */
  formatRangeToParts(start2, end2) {
    if (typeof this.numberFormatter.formatRangeToParts === "function")
      return this.numberFormatter.formatRangeToParts(start2, end2);
    if (end2 < start2)
      throw new RangeError("End date must be >= start date");
    let startParts = this.numberFormatter.formatToParts(start2);
    let endParts = this.numberFormatter.formatToParts(end2);
    return [
      ...startParts.map((p2) => ({
        ...p2,
        source: "startRange"
      })),
      {
        type: "literal",
        value: " – ",
        source: "shared"
      },
      ...endParts.map((p2) => ({
        ...p2,
        source: "endRange"
      }))
    ];
  }
  /** Returns the resolved formatting options based on the values passed to the constructor. */
  resolvedOptions() {
    let options = this.numberFormatter.resolvedOptions();
    if (!$488c6ddbf4ef74c2$var$supportsSignDisplay && this.options.signDisplay != null)
      options = {
        ...options,
        signDisplay: this.options.signDisplay
      };
    if (!$488c6ddbf4ef74c2$var$supportsUnit && this.options.style === "unit")
      options = {
        ...options,
        style: "unit",
        unit: this.options.unit,
        unitDisplay: this.options.unitDisplay
      };
    return options;
  }
  constructor(locale2, options = {}) {
    this.numberFormatter = $488c6ddbf4ef74c2$var$getCachedNumberFormatter(locale2, options);
    this.options = options;
  }
}
function $488c6ddbf4ef74c2$var$getCachedNumberFormatter(locale2, options = {}) {
  let { numberingSystem } = options;
  if (numberingSystem && locale2.includes("-nu-")) {
    if (!locale2.includes("-u-"))
      locale2 += "-u-";
    locale2 += `-nu-${numberingSystem}`;
  }
  if (options.style === "unit" && !$488c6ddbf4ef74c2$var$supportsUnit) {
    var _UNITS_unit;
    let { unit: unit2, unitDisplay = "short" } = options;
    if (!unit2)
      throw new Error('unit option must be provided with style: "unit"');
    if (!((_UNITS_unit = $488c6ddbf4ef74c2$var$UNITS[unit2]) === null || _UNITS_unit === void 0 ? void 0 : _UNITS_unit[unitDisplay]))
      throw new Error(`Unsupported unit ${unit2} with unitDisplay = ${unitDisplay}`);
    options = {
      ...options,
      style: "decimal"
    };
  }
  let cacheKey = locale2 + (options ? Object.entries(options).sort((a2, b2) => a2[0] < b2[0] ? -1 : 1).join() : "");
  if ($488c6ddbf4ef74c2$var$formatterCache.has(cacheKey))
    return $488c6ddbf4ef74c2$var$formatterCache.get(cacheKey);
  let numberFormatter = new Intl.NumberFormat(locale2, options);
  $488c6ddbf4ef74c2$var$formatterCache.set(cacheKey, numberFormatter);
  return numberFormatter;
}
function $488c6ddbf4ef74c2$export$711b50b3c525e0f2(numberFormat, signDisplay, num) {
  if (signDisplay === "auto")
    return numberFormat.format(num);
  else if (signDisplay === "never")
    return numberFormat.format(Math.abs(num));
  else {
    let needsPositiveSign = false;
    if (signDisplay === "always")
      needsPositiveSign = num > 0 || Object.is(num, 0);
    else if (signDisplay === "exceptZero") {
      if (Object.is(num, -0) || Object.is(num, 0))
        num = Math.abs(num);
      else
        needsPositiveSign = num > 0;
    }
    if (needsPositiveSign) {
      let negative = numberFormat.format(-num);
      let noSign = numberFormat.format(num);
      let minus = negative.replace(noSign, "").replace(/\u200e|\u061C/, "");
      if ([
        ...minus
      ].length !== 1)
        console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case");
      let positive = negative.replace(noSign, "!!!").replace(minus, "+").replace("!!!", noSign);
      return positive;
    } else
      return numberFormat.format(num);
  }
}
const $6c7bd7858deea686$var$CURRENCY_SIGN_REGEX = new RegExp("^.*\\(.*\\).*$");
const $6c7bd7858deea686$var$NUMBERING_SYSTEMS = [
  "latn",
  "arab",
  "hanidec",
  "deva",
  "beng",
  "fullwide"
];
class $6c7bd7858deea686$export$cd11ab140839f11d {
  /**
  * Parses the given string to a number. Returns NaN if a valid number could not be parsed.
  */
  parse(value2) {
    return $6c7bd7858deea686$var$getNumberParserImpl(this.locale, this.options, value2).parse(value2);
  }
  /**
  * Returns whether the given string could potentially be a valid number. This should be used to
  * validate user input as the user types. If a `minValue` or `maxValue` is provided, the validity
  * of the minus/plus sign characters can be checked.
  */
  isValidPartialNumber(value2, minValue, maxValue) {
    return $6c7bd7858deea686$var$getNumberParserImpl(this.locale, this.options, value2).isValidPartialNumber(value2, minValue, maxValue);
  }
  /**
  * Returns a numbering system for which the given string is valid in the current locale.
  * If no numbering system could be detected, the default numbering system for the current
  * locale is returned.
  */
  getNumberingSystem(value2) {
    return $6c7bd7858deea686$var$getNumberParserImpl(this.locale, this.options, value2).options.numberingSystem;
  }
  constructor(locale2, options = {}) {
    this.locale = locale2;
    this.options = options;
  }
}
const $6c7bd7858deea686$var$numberParserCache = /* @__PURE__ */ new Map();
function $6c7bd7858deea686$var$getNumberParserImpl(locale2, options, value2) {
  let defaultParser = $6c7bd7858deea686$var$getCachedNumberParser(locale2, options);
  if (!locale2.includes("-nu-") && !defaultParser.isValidPartialNumber(value2)) {
    for (let numberingSystem of $6c7bd7858deea686$var$NUMBERING_SYSTEMS)
      if (numberingSystem !== defaultParser.options.numberingSystem) {
        let parser = $6c7bd7858deea686$var$getCachedNumberParser(locale2 + (locale2.includes("-u-") ? "-nu-" : "-u-nu-") + numberingSystem, options);
        if (parser.isValidPartialNumber(value2))
          return parser;
      }
  }
  return defaultParser;
}
function $6c7bd7858deea686$var$getCachedNumberParser(locale2, options) {
  let cacheKey = locale2 + (options ? Object.entries(options).sort((a2, b2) => a2[0] < b2[0] ? -1 : 1).join() : "");
  let parser = $6c7bd7858deea686$var$numberParserCache.get(cacheKey);
  if (!parser) {
    parser = new $6c7bd7858deea686$var$NumberParserImpl(locale2, options);
    $6c7bd7858deea686$var$numberParserCache.set(cacheKey, parser);
  }
  return parser;
}
class $6c7bd7858deea686$var$NumberParserImpl {
  parse(value2) {
    let fullySanitizedValue = this.sanitize(value2);
    if (this.symbols.group)
      fullySanitizedValue = $6c7bd7858deea686$var$replaceAll(fullySanitizedValue, this.symbols.group, "");
    if (this.symbols.decimal)
      fullySanitizedValue = fullySanitizedValue.replace(this.symbols.decimal, ".");
    if (this.symbols.minusSign)
      fullySanitizedValue = fullySanitizedValue.replace(this.symbols.minusSign, "-");
    fullySanitizedValue = fullySanitizedValue.replace(this.symbols.numeral, this.symbols.index);
    if (this.options.style === "percent") {
      let isNegative = fullySanitizedValue.indexOf("-");
      fullySanitizedValue = fullySanitizedValue.replace("-", "");
      fullySanitizedValue = fullySanitizedValue.replace("+", "");
      let index2 = fullySanitizedValue.indexOf(".");
      if (index2 === -1)
        index2 = fullySanitizedValue.length;
      fullySanitizedValue = fullySanitizedValue.replace(".", "");
      if (index2 - 2 === 0)
        fullySanitizedValue = `0.${fullySanitizedValue}`;
      else if (index2 - 2 === -1)
        fullySanitizedValue = `0.0${fullySanitizedValue}`;
      else if (index2 - 2 === -2)
        fullySanitizedValue = "0.00";
      else
        fullySanitizedValue = `${fullySanitizedValue.slice(0, index2 - 2)}.${fullySanitizedValue.slice(index2 - 2)}`;
      if (isNegative > -1)
        fullySanitizedValue = `-${fullySanitizedValue}`;
    }
    let newValue = fullySanitizedValue ? +fullySanitizedValue : NaN;
    if (isNaN(newValue))
      return NaN;
    if (this.options.style === "percent") {
      var _this_options_minimumFractionDigits, _this_options_maximumFractionDigits;
      let options = {
        ...this.options,
        style: "decimal",
        minimumFractionDigits: Math.min(((_this_options_minimumFractionDigits = this.options.minimumFractionDigits) !== null && _this_options_minimumFractionDigits !== void 0 ? _this_options_minimumFractionDigits : 0) + 2, 20),
        maximumFractionDigits: Math.min(((_this_options_maximumFractionDigits = this.options.maximumFractionDigits) !== null && _this_options_maximumFractionDigits !== void 0 ? _this_options_maximumFractionDigits : 0) + 2, 20)
      };
      return new $6c7bd7858deea686$export$cd11ab140839f11d(this.locale, options).parse(new $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5(this.locale, options).format(newValue));
    }
    if (this.options.currencySign === "accounting" && $6c7bd7858deea686$var$CURRENCY_SIGN_REGEX.test(value2))
      newValue = -1 * newValue;
    return newValue;
  }
  sanitize(value2) {
    value2 = value2.replace(this.symbols.literals, "");
    if (this.symbols.minusSign)
      value2 = value2.replace("-", this.symbols.minusSign);
    if (this.options.numberingSystem === "arab") {
      if (this.symbols.decimal) {
        value2 = value2.replace(",", this.symbols.decimal);
        value2 = value2.replace(String.fromCharCode(1548), this.symbols.decimal);
      }
      if (this.symbols.group)
        value2 = $6c7bd7858deea686$var$replaceAll(value2, ".", this.symbols.group);
    }
    if (this.options.locale === "fr-FR" && this.symbols.group) {
      value2 = $6c7bd7858deea686$var$replaceAll(value2, " ", this.symbols.group);
      value2 = $6c7bd7858deea686$var$replaceAll(value2, /\u00A0/g, this.symbols.group);
    }
    return value2;
  }
  isValidPartialNumber(value2, minValue = -Infinity, maxValue = Infinity) {
    value2 = this.sanitize(value2);
    if (this.symbols.minusSign && value2.startsWith(this.symbols.minusSign) && minValue < 0)
      value2 = value2.slice(this.symbols.minusSign.length);
    else if (this.symbols.plusSign && value2.startsWith(this.symbols.plusSign) && maxValue > 0)
      value2 = value2.slice(this.symbols.plusSign.length);
    if (this.symbols.group && value2.startsWith(this.symbols.group))
      return false;
    if (this.symbols.decimal && value2.indexOf(this.symbols.decimal) > -1 && this.options.maximumFractionDigits === 0)
      return false;
    if (this.symbols.group)
      value2 = $6c7bd7858deea686$var$replaceAll(value2, this.symbols.group, "");
    value2 = value2.replace(this.symbols.numeral, "");
    if (this.symbols.decimal)
      value2 = value2.replace(this.symbols.decimal, "");
    return value2.length === 0;
  }
  constructor(locale2, options = {}) {
    this.locale = locale2;
    if (options.roundingIncrement !== 1 && options.roundingIncrement != null) {
      if (options.maximumFractionDigits == null && options.minimumFractionDigits == null) {
        options.maximumFractionDigits = 0;
        options.minimumFractionDigits = 0;
      } else if (options.maximumFractionDigits == null)
        options.maximumFractionDigits = options.minimumFractionDigits;
      else if (options.minimumFractionDigits == null)
        options.minimumFractionDigits = options.maximumFractionDigits;
    }
    this.formatter = new Intl.NumberFormat(locale2, options);
    this.options = this.formatter.resolvedOptions();
    this.symbols = $6c7bd7858deea686$var$getSymbols(locale2, this.formatter, this.options, options);
    var _this_options_minimumFractionDigits, _this_options_maximumFractionDigits;
    if (this.options.style === "percent" && (((_this_options_minimumFractionDigits = this.options.minimumFractionDigits) !== null && _this_options_minimumFractionDigits !== void 0 ? _this_options_minimumFractionDigits : 0) > 18 || ((_this_options_maximumFractionDigits = this.options.maximumFractionDigits) !== null && _this_options_maximumFractionDigits !== void 0 ? _this_options_maximumFractionDigits : 0) > 18))
      console.warn("NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.");
  }
}
const $6c7bd7858deea686$var$nonLiteralParts = /* @__PURE__ */ new Set([
  "decimal",
  "fraction",
  "integer",
  "minusSign",
  "plusSign",
  "group"
]);
const $6c7bd7858deea686$var$pluralNumbers = [
  0,
  4,
  2,
  1,
  11,
  20,
  3,
  7,
  100,
  21,
  0.1,
  1.1
];
function $6c7bd7858deea686$var$getSymbols(locale2, formatter, intlOptions, originalOptions) {
  var _allParts_find, _posAllParts_find, _decimalParts_find, _allParts_find1;
  let symbolFormatter = new Intl.NumberFormat(locale2, {
    ...intlOptions,
    // Resets so we get the full range of symbols
    minimumSignificantDigits: 1,
    maximumSignificantDigits: 21,
    roundingIncrement: 1,
    roundingPriority: "auto",
    roundingMode: "halfExpand"
  });
  let allParts = symbolFormatter.formatToParts(-10000.111);
  let posAllParts = symbolFormatter.formatToParts(10000.111);
  let pluralParts = $6c7bd7858deea686$var$pluralNumbers.map((n2) => symbolFormatter.formatToParts(n2));
  var _allParts_find_value;
  let minusSign = (_allParts_find_value = (_allParts_find = allParts.find((p2) => p2.type === "minusSign")) === null || _allParts_find === void 0 ? void 0 : _allParts_find.value) !== null && _allParts_find_value !== void 0 ? _allParts_find_value : "-";
  let plusSign = (_posAllParts_find = posAllParts.find((p2) => p2.type === "plusSign")) === null || _posAllParts_find === void 0 ? void 0 : _posAllParts_find.value;
  if (!plusSign && ((originalOptions === null || originalOptions === void 0 ? void 0 : originalOptions.signDisplay) === "exceptZero" || (originalOptions === null || originalOptions === void 0 ? void 0 : originalOptions.signDisplay) === "always"))
    plusSign = "+";
  let decimalParts = new Intl.NumberFormat(locale2, {
    ...intlOptions,
    minimumFractionDigits: 2,
    maximumFractionDigits: 2
  }).formatToParts(1e-3);
  let decimal = (_decimalParts_find = decimalParts.find((p2) => p2.type === "decimal")) === null || _decimalParts_find === void 0 ? void 0 : _decimalParts_find.value;
  let group = (_allParts_find1 = allParts.find((p2) => p2.type === "group")) === null || _allParts_find1 === void 0 ? void 0 : _allParts_find1.value;
  let allPartsLiterals = allParts.filter((p2) => !$6c7bd7858deea686$var$nonLiteralParts.has(p2.type)).map((p2) => $6c7bd7858deea686$var$escapeRegex(p2.value));
  let pluralPartsLiterals = pluralParts.flatMap((p2) => p2.filter((p3) => !$6c7bd7858deea686$var$nonLiteralParts.has(p3.type)).map((p3) => $6c7bd7858deea686$var$escapeRegex(p3.value)));
  let sortedLiterals = [
    .../* @__PURE__ */ new Set([
      ...allPartsLiterals,
      ...pluralPartsLiterals
    ])
  ].sort((a2, b2) => b2.length - a2.length);
  let literals = sortedLiterals.length === 0 ? new RegExp("[\\p{White_Space}]", "gu") : new RegExp(`${sortedLiterals.join("|")}|[\\p{White_Space}]`, "gu");
  let numerals = [
    ...new Intl.NumberFormat(intlOptions.locale, {
      useGrouping: false
    }).format(9876543210)
  ].reverse();
  let indexes = new Map(numerals.map((d2, i2) => [
    d2,
    i2
  ]));
  let numeral = new RegExp(`[${numerals.join("")}]`, "g");
  let index2 = (d2) => String(indexes.get(d2));
  return {
    minusSign,
    plusSign,
    decimal,
    group,
    literals,
    numeral,
    index: index2
  };
}
function $6c7bd7858deea686$var$replaceAll(str, find2, replace2) {
  if (str.replaceAll)
    return str.replaceAll(find2, replace2);
  return str.split(find2).join(replace2);
}
function $6c7bd7858deea686$var$escapeRegex(string3) {
  return string3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
const LayoutGroupContext = reactExports.createContext({});
function useConstant(init2) {
  const ref = reactExports.useRef(null);
  if (ref.current === null) {
    ref.current = init2();
  }
  return ref.current;
}
const PresenceContext = reactExports.createContext(null);
const MotionConfigContext = reactExports.createContext({
  transformPagePoint: (p2) => p2,
  isStatic: false,
  reducedMotion: "never"
});
class PopChildMeasure extends reactExports.Component {
  getSnapshotBeforeUpdate(prevProps) {
    const element2 = this.props.childRef.current;
    if (element2 && prevProps.isPresent && !this.props.isPresent) {
      const size2 = this.props.sizeRef.current;
      size2.height = element2.offsetHeight || 0;
      size2.width = element2.offsetWidth || 0;
      size2.top = element2.offsetTop;
      size2.left = element2.offsetLeft;
    }
    return null;
  }
  /**
   * Required with getSnapshotBeforeUpdate to stop React complaining.
   */
  componentDidUpdate() {
  }
  render() {
    return this.props.children;
  }
}
function PopChild({ children, isPresent: isPresent2 }) {
  const id2 = reactExports.useId();
  const ref = reactExports.useRef(null);
  const size2 = reactExports.useRef({
    width: 0,
    height: 0,
    top: 0,
    left: 0
  });
  const { nonce } = reactExports.useContext(MotionConfigContext);
  reactExports.useInsertionEffect(() => {
    const { width, height, top: top2, left: left2 } = size2.current;
    if (isPresent2 || !ref.current || !width || !height)
      return;
    ref.current.dataset.motionPopId = id2;
    const style2 = document.createElement("style");
    if (nonce)
      style2.nonce = nonce;
    document.head.appendChild(style2);
    if (style2.sheet) {
      style2.sheet.insertRule(`
          [data-motion-pop-id="${id2}"] {
            position: absolute !important;
            width: ${width}px !important;
            height: ${height}px !important;
            top: ${top2}px !important;
            left: ${left2}px !important;
          }
        `);
    }
    return () => {
      document.head.removeChild(style2);
    };
  }, [isPresent2]);
  return jsxRuntimeExports.jsx(PopChildMeasure, { isPresent: isPresent2, childRef: ref, sizeRef: size2, children: reactExports.cloneElement(children, { ref }) });
}
const PresenceChild = ({ children, initial, isPresent: isPresent2, onExitComplete, custom: custom2, presenceAffectsLayout, mode }) => {
  const presenceChildren = useConstant(newChildrenMap);
  const id2 = reactExports.useId();
  const memoizedOnExitComplete = reactExports.useCallback((childId) => {
    presenceChildren.set(childId, true);
    for (const isComplete of presenceChildren.values()) {
      if (!isComplete)
        return;
    }
    onExitComplete && onExitComplete();
  }, [presenceChildren, onExitComplete]);
  const context = reactExports.useMemo(
    () => ({
      id: id2,
      initial,
      isPresent: isPresent2,
      custom: custom2,
      onExitComplete: memoizedOnExitComplete,
      register: (childId) => {
        presenceChildren.set(childId, false);
        return () => presenceChildren.delete(childId);
      }
    }),
    /**
     * If the presence of a child affects the layout of the components around it,
     * we want to make a new context value to ensure they get re-rendered
     * so they can detect that layout change.
     */
    presenceAffectsLayout ? [Math.random(), memoizedOnExitComplete] : [isPresent2, memoizedOnExitComplete]
  );
  reactExports.useMemo(() => {
    presenceChildren.forEach((_24, key) => presenceChildren.set(key, false));
  }, [isPresent2]);
  reactExports.useEffect(() => {
    !isPresent2 && !presenceChildren.size && onExitComplete && onExitComplete();
  }, [isPresent2]);
  if (mode === "popLayout") {
    children = jsxRuntimeExports.jsx(PopChild, { isPresent: isPresent2, children });
  }
  return jsxRuntimeExports.jsx(PresenceContext.Provider, { value: context, children });
};
function newChildrenMap() {
  return /* @__PURE__ */ new Map();
}
function usePresence(subscribe2 = true) {
  const context = reactExports.useContext(PresenceContext);
  if (context === null)
    return [true, null];
  const { isPresent: isPresent2, onExitComplete, register: register2 } = context;
  const id2 = reactExports.useId();
  reactExports.useEffect(() => {
    if (subscribe2)
      register2(id2);
  }, [subscribe2]);
  const safeToRemove = reactExports.useCallback(() => subscribe2 && onExitComplete && onExitComplete(id2), [id2, onExitComplete, subscribe2]);
  return !isPresent2 && onExitComplete ? [false, safeToRemove] : [true];
}
function useIsPresent() {
  return isPresent(reactExports.useContext(PresenceContext));
}
function isPresent(context) {
  return context === null ? true : context.isPresent;
}
const getChildKey = (child) => child.key || "";
function onlyElements(children) {
  const filtered = [];
  reactExports.Children.forEach(children, (child) => {
    if (reactExports.isValidElement(child))
      filtered.push(child);
  });
  return filtered;
}
const isBrowser$2 = typeof window !== "undefined";
const useIsomorphicLayoutEffect$4 = isBrowser$2 ? reactExports.useLayoutEffect : reactExports.useEffect;
const AnimatePresence = ({ children, custom: custom2, initial = true, onExitComplete, presenceAffectsLayout = true, mode = "sync", propagate = false }) => {
  const [isParentPresent, safeToRemove] = usePresence(propagate);
  const presentChildren = reactExports.useMemo(() => onlyElements(children), [children]);
  const presentKeys = propagate && !isParentPresent ? [] : presentChildren.map(getChildKey);
  const isInitialRender = reactExports.useRef(true);
  const pendingPresentChildren = reactExports.useRef(presentChildren);
  const exitComplete = useConstant(() => /* @__PURE__ */ new Map());
  const [diffedChildren, setDiffedChildren] = reactExports.useState(presentChildren);
  const [renderedChildren, setRenderedChildren] = reactExports.useState(presentChildren);
  useIsomorphicLayoutEffect$4(() => {
    isInitialRender.current = false;
    pendingPresentChildren.current = presentChildren;
    for (let i2 = 0; i2 < renderedChildren.length; i2++) {
      const key = getChildKey(renderedChildren[i2]);
      if (!presentKeys.includes(key)) {
        if (exitComplete.get(key) !== true) {
          exitComplete.set(key, false);
        }
      } else {
        exitComplete.delete(key);
      }
    }
  }, [renderedChildren, presentKeys.length, presentKeys.join("-")]);
  const exitingChildren = [];
  if (presentChildren !== diffedChildren) {
    let nextChildren = [...presentChildren];
    for (let i2 = 0; i2 < renderedChildren.length; i2++) {
      const child = renderedChildren[i2];
      const key = getChildKey(child);
      if (!presentKeys.includes(key)) {
        nextChildren.splice(i2, 0, child);
        exitingChildren.push(child);
      }
    }
    if (mode === "wait" && exitingChildren.length) {
      nextChildren = exitingChildren;
    }
    setRenderedChildren(onlyElements(nextChildren));
    setDiffedChildren(presentChildren);
    return;
  }
  const { forceRender } = reactExports.useContext(LayoutGroupContext);
  return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: renderedChildren.map((child) => {
    const key = getChildKey(child);
    const isPresent2 = propagate && !isParentPresent ? false : presentChildren === renderedChildren || presentKeys.includes(key);
    const onExit = () => {
      if (exitComplete.has(key)) {
        exitComplete.set(key, true);
      } else {
        return;
      }
      let isEveryExitComplete = true;
      exitComplete.forEach((isExitComplete) => {
        if (!isExitComplete)
          isEveryExitComplete = false;
      });
      if (isEveryExitComplete) {
        forceRender === null || forceRender === void 0 ? void 0 : forceRender();
        setRenderedChildren(pendingPresentChildren.current);
        propagate && (safeToRemove === null || safeToRemove === void 0 ? void 0 : safeToRemove());
        onExitComplete && onExitComplete();
      }
    };
    return jsxRuntimeExports.jsx(PresenceChild, { isPresent: isPresent2, initial: !isInitialRender.current || initial ? void 0 : false, custom: isPresent2 ? void 0 : custom2, presenceAffectsLayout, mode, onExitComplete: isPresent2 ? void 0 : onExit, children: child }, key);
  }) });
};
const DeprecatedLayoutGroupContext = reactExports.createContext(null);
function useIsMounted$1() {
  const isMounted = reactExports.useRef(false);
  useIsomorphicLayoutEffect$4(() => {
    isMounted.current = true;
    return () => {
      isMounted.current = false;
    };
  }, []);
  return isMounted;
}
const noop$9 = /* @__NO_SIDE_EFFECTS__ */ (any3) => any3;
let warning$3 = noop$9;
let invariant$2 = noop$9;
// @__NO_SIDE_EFFECTS__
function memo$1(callback2) {
  let result;
  return () => {
    if (result === void 0)
      result = callback2();
    return result;
  };
}
const progress$1 = /* @__NO_SIDE_EFFECTS__ */ (from2, to2, value2) => {
  const toFromDifference = to2 - from2;
  return toFromDifference === 0 ? 1 : (value2 - from2) / toFromDifference;
};
const secondsToMilliseconds = /* @__NO_SIDE_EFFECTS__ */ (seconds2) => seconds2 * 1e3;
const millisecondsToSeconds = /* @__NO_SIDE_EFFECTS__ */ (milliseconds2) => milliseconds2 / 1e3;
const MotionGlobalConfig = {
  skipAnimations: false,
  useManualTiming: false
};
function createRenderStep(runNextFrame) {
  let thisFrame = /* @__PURE__ */ new Set();
  let nextFrame = /* @__PURE__ */ new Set();
  let isProcessing = false;
  let flushNextFrame = false;
  const toKeepAlive = /* @__PURE__ */ new WeakSet();
  let latestFrameData = {
    delta: 0,
    timestamp: 0,
    isProcessing: false
  };
  function triggerCallback(callback2) {
    if (toKeepAlive.has(callback2)) {
      step.schedule(callback2);
      runNextFrame();
    }
    callback2(latestFrameData);
  }
  const step = {
    /**
     * Schedule a process to run on the next frame.
     */
    schedule: (callback2, keepAlive = false, immediate = false) => {
      const addToCurrentFrame = immediate && isProcessing;
      const queue = addToCurrentFrame ? thisFrame : nextFrame;
      if (keepAlive)
        toKeepAlive.add(callback2);
      if (!queue.has(callback2))
        queue.add(callback2);
      return callback2;
    },
    /**
     * Cancel the provided callback from running on the next frame.
     */
    cancel: (callback2) => {
      nextFrame.delete(callback2);
      toKeepAlive.delete(callback2);
    },
    /**
     * Execute all schedule callbacks.
     */
    process: (frameData2) => {
      latestFrameData = frameData2;
      if (isProcessing) {
        flushNextFrame = true;
        return;
      }
      isProcessing = true;
      [thisFrame, nextFrame] = [nextFrame, thisFrame];
      thisFrame.forEach(triggerCallback);
      thisFrame.clear();
      isProcessing = false;
      if (flushNextFrame) {
        flushNextFrame = false;
        step.process(frameData2);
      }
    }
  };
  return step;
}
const stepsOrder = [
  "read",
  // Read
  "resolveKeyframes",
  // Write/Read/Write/Read
  "update",
  // Compute
  "preRender",
  // Compute
  "render",
  // Write
  "postRender"
  // Compute
];
const maxElapsed = 40;
function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
  let runNextFrame = false;
  let useDefaultElapsed = true;
  const state = {
    delta: 0,
    timestamp: 0,
    isProcessing: false
  };
  const flagRunNextFrame = () => runNextFrame = true;
  const steps = stepsOrder.reduce((acc, key) => {
    acc[key] = createRenderStep(flagRunNextFrame);
    return acc;
  }, {});
  const { read, resolveKeyframes, update, preRender, render: render3, postRender } = steps;
  const processBatch = () => {
    const timestamp = MotionGlobalConfig.useManualTiming ? state.timestamp : performance.now();
    runNextFrame = false;
    state.delta = useDefaultElapsed ? 1e3 / 60 : Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1);
    state.timestamp = timestamp;
    state.isProcessing = true;
    read.process(state);
    resolveKeyframes.process(state);
    update.process(state);
    preRender.process(state);
    render3.process(state);
    postRender.process(state);
    state.isProcessing = false;
    if (runNextFrame && allowKeepAlive) {
      useDefaultElapsed = false;
      scheduleNextBatch(processBatch);
    }
  };
  const wake = () => {
    runNextFrame = true;
    useDefaultElapsed = true;
    if (!state.isProcessing) {
      scheduleNextBatch(processBatch);
    }
  };
  const schedule = stepsOrder.reduce((acc, key) => {
    const step = steps[key];
    acc[key] = (process2, keepAlive = false, immediate = false) => {
      if (!runNextFrame)
        wake();
      return step.schedule(process2, keepAlive, immediate);
    };
    return acc;
  }, {});
  const cancel2 = (process2) => {
    for (let i2 = 0; i2 < stepsOrder.length; i2++) {
      steps[stepsOrder[i2]].cancel(process2);
    }
  };
  return { schedule, cancel: cancel2, state, steps };
}
const { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps } = createRenderBatcher(typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : noop$9, true);
function useForceUpdate() {
  const isMounted = useIsMounted$1();
  const [forcedRenderCount, setForcedRenderCount] = reactExports.useState(0);
  const forceRender = reactExports.useCallback(() => {
    isMounted.current && setForcedRenderCount(forcedRenderCount + 1);
  }, [forcedRenderCount]);
  const deferredForceRender = reactExports.useCallback(() => frame.postRender(forceRender), [forceRender]);
  return [deferredForceRender, forcedRenderCount];
}
const notify = (node2) => !node2.isLayoutDirty && node2.willUpdate(false);
function nodeGroup() {
  const nodes = /* @__PURE__ */ new Set();
  const subscriptions = /* @__PURE__ */ new WeakMap();
  const dirtyAll = () => nodes.forEach(notify);
  return {
    add: (node2) => {
      nodes.add(node2);
      subscriptions.set(node2, node2.addEventListener("willUpdate", dirtyAll));
    },
    remove: (node2) => {
      nodes.delete(node2);
      const unsubscribe = subscriptions.get(node2);
      if (unsubscribe) {
        unsubscribe();
        subscriptions.delete(node2);
      }
      dirtyAll();
    },
    dirty: dirtyAll
  };
}
const shouldInheritGroup = (inherit) => inherit === true;
const shouldInheritId = (inherit) => shouldInheritGroup(inherit === true) || inherit === "id";
const LayoutGroup = ({ children, id: id2, inherit = true }) => {
  const layoutGroupContext = reactExports.useContext(LayoutGroupContext);
  const deprecatedLayoutGroupContext = reactExports.useContext(DeprecatedLayoutGroupContext);
  const [forceRender, key] = useForceUpdate();
  const context = reactExports.useRef(null);
  const upstreamId = layoutGroupContext.id || deprecatedLayoutGroupContext;
  if (context.current === null) {
    if (shouldInheritId(inherit) && upstreamId) {
      id2 = id2 ? upstreamId + "-" + id2 : upstreamId;
    }
    context.current = {
      id: id2,
      group: shouldInheritGroup(inherit) ? layoutGroupContext.group || nodeGroup() : nodeGroup()
    };
  }
  const memoizedContext = reactExports.useMemo(() => ({ ...context.current, forceRender }), [key]);
  return jsxRuntimeExports.jsx(LayoutGroupContext.Provider, { value: memoizedContext, children });
};
const LazyContext = reactExports.createContext({ strict: false });
const featureProps = {
  animation: [
    "animate",
    "variants",
    "whileHover",
    "whileTap",
    "exit",
    "whileInView",
    "whileFocus",
    "whileDrag"
  ],
  exit: ["exit"],
  drag: ["drag", "dragControls"],
  focus: ["whileFocus"],
  hover: ["whileHover", "onHoverStart", "onHoverEnd"],
  tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"],
  pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
  inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
  layout: ["layout", "layoutId"]
};
const featureDefinitions = {};
for (const key in featureProps) {
  featureDefinitions[key] = {
    isEnabled: (props) => featureProps[key].some((name2) => !!props[name2])
  };
}
function loadFeatures$1(features) {
  for (const key in features) {
    featureDefinitions[key] = {
      ...featureDefinitions[key],
      ...features[key]
    };
  }
}
function LazyMotion({ children, features, strict = false }) {
  const [, setIsLoaded] = reactExports.useState(!isLazyBundle(features));
  const loadedRenderer = reactExports.useRef(void 0);
  if (!isLazyBundle(features)) {
    const { renderer, ...loadedFeatures } = features;
    loadedRenderer.current = renderer;
    loadFeatures$1(loadedFeatures);
  }
  reactExports.useEffect(() => {
    if (isLazyBundle(features)) {
      features().then(({ renderer, ...loadedFeatures }) => {
        loadFeatures$1(loadedFeatures);
        loadedRenderer.current = renderer;
        setIsLoaded(true);
      });
    }
  }, []);
  return jsxRuntimeExports.jsx(LazyContext.Provider, { value: { renderer: loadedRenderer.current, strict }, children });
}
function isLazyBundle(features) {
  return typeof features === "function";
}
const validMotionProps = /* @__PURE__ */ new Set([
  "animate",
  "exit",
  "variants",
  "initial",
  "style",
  "values",
  "variants",
  "transition",
  "transformTemplate",
  "custom",
  "inherit",
  "onBeforeLayoutMeasure",
  "onAnimationStart",
  "onAnimationComplete",
  "onUpdate",
  "onDragStart",
  "onDrag",
  "onDragEnd",
  "onMeasureDragConstraints",
  "onDirectionLock",
  "onDragTransitionEnd",
  "_dragX",
  "_dragY",
  "onHoverStart",
  "onHoverEnd",
  "onViewportEnter",
  "onViewportLeave",
  "globalTapTarget",
  "ignoreStrict",
  "viewport"
]);
function isValidMotionProp(key) {
  return key.startsWith("while") || key.startsWith("drag") && key !== "draggable" || key.startsWith("layout") || key.startsWith("onTap") || key.startsWith("onPan") || key.startsWith("onLayout") || validMotionProps.has(key);
}
let shouldForward = (key) => !isValidMotionProp(key);
function loadExternalIsValidProp(isValidProp) {
  if (!isValidProp)
    return;
  shouldForward = (key) => key.startsWith("on") ? !isValidMotionProp(key) : isValidProp(key);
}
try {
  loadExternalIsValidProp(require("@emotion/is-prop-valid").default);
} catch (_a2) {
}
function filterProps(props, isDom, forwardMotionProps) {
  const filteredProps = {};
  for (const key in props) {
    if (key === "values" && typeof props.values === "object")
      continue;
    if (shouldForward(key) || forwardMotionProps === true && isValidMotionProp(key) || !isDom && !isValidMotionProp(key) || // If trying to use native HTML drag events, forward drag listeners
    props["draggable"] && key.startsWith("onDrag")) {
      filteredProps[key] = props[key];
    }
  }
  return filteredProps;
}
function MotionConfig({ children, isValidProp, ...config2 }) {
  isValidProp && loadExternalIsValidProp(isValidProp);
  config2 = { ...reactExports.useContext(MotionConfigContext), ...config2 };
  config2.isStatic = useConstant(() => config2.isStatic);
  const context = reactExports.useMemo(() => config2, [
    JSON.stringify(config2.transition),
    config2.transformPagePoint,
    config2.reducedMotion
  ]);
  return jsxRuntimeExports.jsx(MotionConfigContext.Provider, { value: context, children });
}
function createDOMMotionComponentProxy(componentFactory) {
  if (typeof Proxy === "undefined") {
    return componentFactory;
  }
  const componentCache = /* @__PURE__ */ new Map();
  const deprecatedFactoryFunction = (...args) => {
    return componentFactory(...args);
  };
  return new Proxy(deprecatedFactoryFunction, {
    /**
     * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.
     * The prop name is passed through as `key` and we can use that to generate a `motion`
     * DOM component with that name.
     */
    get: (_target, key) => {
      if (key === "create")
        return componentFactory;
      if (!componentCache.has(key)) {
        componentCache.set(key, componentFactory(key));
      }
      return componentCache.get(key);
    }
  });
}
const MotionContext = reactExports.createContext({});
function isVariantLabel(v2) {
  return typeof v2 === "string" || Array.isArray(v2);
}
function isAnimationControls(v2) {
  return v2 !== null && typeof v2 === "object" && typeof v2.start === "function";
}
const variantPriorityOrder = [
  "animate",
  "whileInView",
  "whileFocus",
  "whileHover",
  "whileTap",
  "whileDrag",
  "exit"
];
const variantProps = ["initial", ...variantPriorityOrder];
function isControllingVariants(props) {
  return isAnimationControls(props.animate) || variantProps.some((name2) => isVariantLabel(props[name2]));
}
function isVariantNode(props) {
  return Boolean(isControllingVariants(props) || props.variants);
}
function getCurrentTreeVariants(props, context) {
  if (isControllingVariants(props)) {
    const { initial, animate } = props;
    return {
      initial: initial === false || isVariantLabel(initial) ? initial : void 0,
      animate: isVariantLabel(animate) ? animate : void 0
    };
  }
  return props.inherit !== false ? context : {};
}
function useCreateMotionContext(props) {
  const { initial, animate } = getCurrentTreeVariants(props, reactExports.useContext(MotionContext));
  return reactExports.useMemo(() => ({ initial, animate }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]);
}
function variantLabelsAsDependency(prop) {
  return Array.isArray(prop) ? prop.join(" ") : prop;
}
const motionComponentSymbol = Symbol.for("motionComponentSymbol");
function isRefObject(ref) {
  return ref && typeof ref === "object" && Object.prototype.hasOwnProperty.call(ref, "current");
}
function useMotionRef(visualState, visualElement, externalRef) {
  return reactExports.useCallback(
    (instance2) => {
      if (instance2) {
        visualState.onMount && visualState.onMount(instance2);
      }
      if (visualElement) {
        if (instance2) {
          visualElement.mount(instance2);
        } else {
          visualElement.unmount();
        }
      }
      if (externalRef) {
        if (typeof externalRef === "function") {
          externalRef(instance2);
        } else if (isRefObject(externalRef)) {
          externalRef.current = instance2;
        }
      }
    },
    /**
     * Only pass a new ref callback to React if we've received a visual element
     * factory. Otherwise we'll be mounting/remounting every time externalRef
     * or other dependencies change.
     */
    [visualElement]
  );
}
const camelToDash = (str) => str.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase();
const optimizedAppearDataId = "framerAppearId";
const optimizedAppearDataAttribute = "data-" + camelToDash(optimizedAppearDataId);
const { schedule: microtask } = createRenderBatcher(queueMicrotask, false);
const SwitchLayoutGroupContext = reactExports.createContext({});
function useVisualElement(Component2, visualState, props, createVisualElement, ProjectionNodeConstructor) {
  var _a2, _b2;
  const { visualElement: parent } = reactExports.useContext(MotionContext);
  const lazyContext = reactExports.useContext(LazyContext);
  const presenceContext = reactExports.useContext(PresenceContext);
  const reducedMotionConfig = reactExports.useContext(MotionConfigContext).reducedMotion;
  const visualElementRef = reactExports.useRef(null);
  createVisualElement = createVisualElement || lazyContext.renderer;
  if (!visualElementRef.current && createVisualElement) {
    visualElementRef.current = createVisualElement(Component2, {
      visualState,
      parent,
      props,
      presenceContext,
      blockInitialAnimation: presenceContext ? presenceContext.initial === false : false,
      reducedMotionConfig
    });
  }
  const visualElement = visualElementRef.current;
  const initialLayoutGroupConfig = reactExports.useContext(SwitchLayoutGroupContext);
  if (visualElement && !visualElement.projection && ProjectionNodeConstructor && (visualElement.type === "html" || visualElement.type === "svg")) {
    createProjectionNode$1(visualElementRef.current, props, ProjectionNodeConstructor, initialLayoutGroupConfig);
  }
  const isMounted = reactExports.useRef(false);
  reactExports.useInsertionEffect(() => {
    if (visualElement && isMounted.current) {
      visualElement.update(props, presenceContext);
    }
  });
  const optimisedAppearId = props[optimizedAppearDataAttribute];
  const wantsHandoff = reactExports.useRef(Boolean(optimisedAppearId) && !((_a2 = window.MotionHandoffIsComplete) === null || _a2 === void 0 ? void 0 : _a2.call(window, optimisedAppearId)) && ((_b2 = window.MotionHasOptimisedAnimation) === null || _b2 === void 0 ? void 0 : _b2.call(window, optimisedAppearId)));
  useIsomorphicLayoutEffect$4(() => {
    if (!visualElement)
      return;
    isMounted.current = true;
    window.MotionIsMounted = true;
    visualElement.updateFeatures();
    microtask.render(visualElement.render);
    if (wantsHandoff.current && visualElement.animationState) {
      visualElement.animationState.animateChanges();
    }
  });
  reactExports.useEffect(() => {
    if (!visualElement)
      return;
    if (!wantsHandoff.current && visualElement.animationState) {
      visualElement.animationState.animateChanges();
    }
    if (wantsHandoff.current) {
      queueMicrotask(() => {
        var _a3;
        (_a3 = window.MotionHandoffMarkAsComplete) === null || _a3 === void 0 ? void 0 : _a3.call(window, optimisedAppearId);
      });
      wantsHandoff.current = false;
    }
  });
  return visualElement;
}
function createProjectionNode$1(visualElement, props, ProjectionNodeConstructor, initialPromotionConfig) {
  const { layoutId, layout: layout2, drag: drag2, dragConstraints, layoutScroll, layoutRoot } = props;
  visualElement.projection = new ProjectionNodeConstructor(visualElement.latestValues, props["data-framer-portal-id"] ? void 0 : getClosestProjectingNode(visualElement.parent));
  visualElement.projection.setOptions({
    layoutId,
    layout: layout2,
    alwaysMeasureLayout: Boolean(drag2) || dragConstraints && isRefObject(dragConstraints),
    visualElement,
    /**
     * TODO: Update options in an effect. This could be tricky as it'll be too late
     * to update by the time layout animations run.
     * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
     * ensuring it gets called if there's no potential layout animations.
     *
     */
    animationType: typeof layout2 === "string" ? layout2 : "both",
    initialPromotionConfig,
    layoutScroll,
    layoutRoot
  });
}
function getClosestProjectingNode(visualElement) {
  if (!visualElement)
    return void 0;
  return visualElement.options.allowProjection !== false ? visualElement.projection : getClosestProjectingNode(visualElement.parent);
}
function createRendererMotionComponent({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component: Component2 }) {
  var _a2, _b2;
  preloadedFeatures && loadFeatures$1(preloadedFeatures);
  function MotionComponent(props, externalRef) {
    let MeasureLayout2;
    const configAndProps = {
      ...reactExports.useContext(MotionConfigContext),
      ...props,
      layoutId: useLayoutId(props)
    };
    const { isStatic } = configAndProps;
    const context = useCreateMotionContext(props);
    const visualState = useVisualState(props, isStatic);
    if (!isStatic && isBrowser$2) {
      useStrictMode();
      const layoutProjection = getProjectionFunctionality(configAndProps);
      MeasureLayout2 = layoutProjection.MeasureLayout;
      context.visualElement = useVisualElement(Component2, visualState, configAndProps, createVisualElement, layoutProjection.ProjectionNode);
    }
    return jsxRuntimeExports.jsxs(MotionContext.Provider, { value: context, children: [MeasureLayout2 && context.visualElement ? jsxRuntimeExports.jsx(MeasureLayout2, { visualElement: context.visualElement, ...configAndProps }) : null, useRender(Component2, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, context.visualElement)] });
  }
  MotionComponent.displayName = `motion.${typeof Component2 === "string" ? Component2 : `create(${(_b2 = (_a2 = Component2.displayName) !== null && _a2 !== void 0 ? _a2 : Component2.name) !== null && _b2 !== void 0 ? _b2 : ""})`}`;
  const ForwardRefMotionComponent = reactExports.forwardRef(MotionComponent);
  ForwardRefMotionComponent[motionComponentSymbol] = Component2;
  return ForwardRefMotionComponent;
}
function useLayoutId({ layoutId }) {
  const layoutGroupId = reactExports.useContext(LayoutGroupContext).id;
  return layoutGroupId && layoutId !== void 0 ? layoutGroupId + "-" + layoutId : layoutId;
}
function useStrictMode(configAndProps, preloadedFeatures) {
  reactExports.useContext(LazyContext).strict;
}
function getProjectionFunctionality(props) {
  const { drag: drag2, layout: layout2 } = featureDefinitions;
  if (!drag2 && !layout2)
    return {};
  const combined = { ...drag2, ...layout2 };
  return {
    MeasureLayout: (drag2 === null || drag2 === void 0 ? void 0 : drag2.isEnabled(props)) || (layout2 === null || layout2 === void 0 ? void 0 : layout2.isEnabled(props)) ? combined.MeasureLayout : void 0,
    ProjectionNode: combined.ProjectionNode
  };
}
const lowercaseSVGElements = [
  "animate",
  "circle",
  "defs",
  "desc",
  "ellipse",
  "g",
  "image",
  "line",
  "filter",
  "marker",
  "mask",
  "metadata",
  "path",
  "pattern",
  "polygon",
  "polyline",
  "rect",
  "stop",
  "switch",
  "symbol",
  "svg",
  "text",
  "tspan",
  "use",
  "view"
];
function isSVGComponent(Component2) {
  if (
    /**
     * If it's not a string, it's a custom React component. Currently we only support
     * HTML custom React components.
     */
    typeof Component2 !== "string" || /**
     * If it contains a dash, the element is a custom HTML webcomponent.
     */
    Component2.includes("-")
  ) {
    return false;
  } else if (
    /**
     * If it's in our list of lowercase SVG tags, it's an SVG component
     */
    lowercaseSVGElements.indexOf(Component2) > -1 || /**
     * If it contains a capital letter, it's an SVG component
     */
    /[A-Z]/u.test(Component2)
  ) {
    return true;
  }
  return false;
}
function getValueState(visualElement) {
  const state = [{}, {}];
  visualElement === null || visualElement === void 0 ? void 0 : visualElement.values.forEach((value2, key) => {
    state[0][key] = value2.get();
    state[1][key] = value2.getVelocity();
  });
  return state;
}
function resolveVariantFromProps(props, definition2, custom2, visualElement) {
  if (typeof definition2 === "function") {
    const [current, velocity] = getValueState(visualElement);
    definition2 = definition2(custom2 !== void 0 ? custom2 : props.custom, current, velocity);
  }
  if (typeof definition2 === "string") {
    definition2 = props.variants && props.variants[definition2];
  }
  if (typeof definition2 === "function") {
    const [current, velocity] = getValueState(visualElement);
    definition2 = definition2(custom2 !== void 0 ? custom2 : props.custom, current, velocity);
  }
  return definition2;
}
const isKeyframesTarget = (v2) => {
  return Array.isArray(v2);
};
const isCustomValue = (v2) => {
  return Boolean(v2 && typeof v2 === "object" && v2.mix && v2.toValue);
};
const resolveFinalValueInKeyframes = (v2) => {
  return isKeyframesTarget(v2) ? v2[v2.length - 1] || 0 : v2;
};
const isMotionValue = (value2) => Boolean(value2 && value2.getVelocity);
function resolveMotionValue(value2) {
  const unwrappedValue = isMotionValue(value2) ? value2.get() : value2;
  return isCustomValue(unwrappedValue) ? unwrappedValue.toValue() : unwrappedValue;
}
function makeState({ scrapeMotionValuesFromProps: scrapeMotionValuesFromProps2, createRenderState, onUpdate }, props, context, presenceContext) {
  const state = {
    latestValues: makeLatestValues(props, context, presenceContext, scrapeMotionValuesFromProps2),
    renderState: createRenderState()
  };
  if (onUpdate) {
    state.onMount = (instance2) => onUpdate({ props, current: instance2, ...state });
    state.onUpdate = (visualElement) => onUpdate(visualElement);
  }
  return state;
}
const makeUseVisualState = (config2) => (props, isStatic) => {
  const context = reactExports.useContext(MotionContext);
  const presenceContext = reactExports.useContext(PresenceContext);
  const make = () => makeState(config2, props, context, presenceContext);
  return isStatic ? make() : useConstant(make);
};
function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
  const values = {};
  const motionValues = scrapeMotionValues(props, {});
  for (const key in motionValues) {
    values[key] = resolveMotionValue(motionValues[key]);
  }
  let { initial, animate } = props;
  const isControllingVariants$1 = isControllingVariants(props);
  const isVariantNode$1 = isVariantNode(props);
  if (context && isVariantNode$1 && !isControllingVariants$1 && props.inherit !== false) {
    if (initial === void 0)
      initial = context.initial;
    if (animate === void 0)
      animate = context.animate;
  }
  let isInitialAnimationBlocked = presenceContext ? presenceContext.initial === false : false;
  isInitialAnimationBlocked = isInitialAnimationBlocked || initial === false;
  const variantToSet = isInitialAnimationBlocked ? animate : initial;
  if (variantToSet && typeof variantToSet !== "boolean" && !isAnimationControls(variantToSet)) {
    const list2 = Array.isArray(variantToSet) ? variantToSet : [variantToSet];
    for (let i2 = 0; i2 < list2.length; i2++) {
      const resolved = resolveVariantFromProps(props, list2[i2]);
      if (resolved) {
        const { transitionEnd, transition: transition3, ...target } = resolved;
        for (const key in target) {
          let valueTarget = target[key];
          if (Array.isArray(valueTarget)) {
            const index2 = isInitialAnimationBlocked ? valueTarget.length - 1 : 0;
            valueTarget = valueTarget[index2];
          }
          if (valueTarget !== null) {
            values[key] = valueTarget;
          }
        }
        for (const key in transitionEnd) {
          values[key] = transitionEnd[key];
        }
      }
    }
  }
  return values;
}
const transformPropOrder = [
  "transformPerspective",
  "x",
  "y",
  "z",
  "translateX",
  "translateY",
  "translateZ",
  "scale",
  "scaleX",
  "scaleY",
  "rotate",
  "rotateX",
  "rotateY",
  "rotateZ",
  "skew",
  "skewX",
  "skewY"
];
const transformProps = new Set(transformPropOrder);
const checkStringStartsWith = (token2) => (key) => typeof key === "string" && key.startsWith(token2);
const isCSSVariableName = /* @__PURE__ */ checkStringStartsWith("--");
const startsAsVariableToken = /* @__PURE__ */ checkStringStartsWith("var(--");
const isCSSVariableToken = (value2) => {
  const startsWithToken = startsAsVariableToken(value2);
  if (!startsWithToken)
    return false;
  return singleCssVariableRegex.test(value2.split("/*")[0].trim());
};
const singleCssVariableRegex = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;
const getValueAsType = (value2, type4) => {
  return type4 && typeof value2 === "number" ? type4.transform(value2) : value2;
};
const clamp$1 = (min2, max2, v2) => {
  if (v2 > max2)
    return max2;
  if (v2 < min2)
    return min2;
  return v2;
};
const number$2 = {
  test: (v2) => typeof v2 === "number",
  parse: parseFloat,
  transform: (v2) => v2
};
const alpha$1 = {
  ...number$2,
  transform: (v2) => clamp$1(0, 1, v2)
};
const scale = {
  ...number$2,
  default: 1
};
const createUnitType = (unit2) => ({
  test: (v2) => typeof v2 === "string" && v2.endsWith(unit2) && v2.split(" ").length === 1,
  parse: parseFloat,
  transform: (v2) => `${v2}${unit2}`
});
const degrees = /* @__PURE__ */ createUnitType("deg");
const percent = /* @__PURE__ */ createUnitType("%");
const px = /* @__PURE__ */ createUnitType("px");
const vh = /* @__PURE__ */ createUnitType("vh");
const vw = /* @__PURE__ */ createUnitType("vw");
const progressPercentage = {
  ...percent,
  parse: (v2) => percent.parse(v2) / 100,
  transform: (v2) => percent.transform(v2 * 100)
};
const browserNumberValueTypes = {
  // Border props
  borderWidth: px,
  borderTopWidth: px,
  borderRightWidth: px,
  borderBottomWidth: px,
  borderLeftWidth: px,
  borderRadius: px,
  radius: px,
  borderTopLeftRadius: px,
  borderTopRightRadius: px,
  borderBottomRightRadius: px,
  borderBottomLeftRadius: px,
  // Positioning props
  width: px,
  maxWidth: px,
  height: px,
  maxHeight: px,
  top: px,
  right: px,
  bottom: px,
  left: px,
  // Spacing props
  padding: px,
  paddingTop: px,
  paddingRight: px,
  paddingBottom: px,
  paddingLeft: px,
  margin: px,
  marginTop: px,
  marginRight: px,
  marginBottom: px,
  marginLeft: px,
  // Misc
  backgroundPositionX: px,
  backgroundPositionY: px
};
const transformValueTypes = {
  rotate: degrees,
  rotateX: degrees,
  rotateY: degrees,
  rotateZ: degrees,
  scale,
  scaleX: scale,
  scaleY: scale,
  scaleZ: scale,
  skew: degrees,
  skewX: degrees,
  skewY: degrees,
  distance: px,
  translateX: px,
  translateY: px,
  translateZ: px,
  x: px,
  y: px,
  z: px,
  perspective: px,
  transformPerspective: px,
  opacity: alpha$1,
  originX: progressPercentage,
  originY: progressPercentage,
  originZ: px
};
const int = {
  ...number$2,
  transform: Math.round
};
const numberValueTypes = {
  ...browserNumberValueTypes,
  ...transformValueTypes,
  zIndex: int,
  size: px,
  // SVG
  fillOpacity: alpha$1,
  strokeOpacity: alpha$1,
  numOctaves: int
};
const translateAlias = {
  x: "translateX",
  y: "translateY",
  z: "translateZ",
  transformPerspective: "perspective"
};
const numTransforms = transformPropOrder.length;
function buildTransform(latestValues, transform2, transformTemplate) {
  let transformString = "";
  let transformIsDefault = true;
  for (let i2 = 0; i2 < numTransforms; i2++) {
    const key = transformPropOrder[i2];
    const value2 = latestValues[key];
    if (value2 === void 0)
      continue;
    let valueIsDefault = true;
    if (typeof value2 === "number") {
      valueIsDefault = value2 === (key.startsWith("scale") ? 1 : 0);
    } else {
      valueIsDefault = parseFloat(value2) === 0;
    }
    if (!valueIsDefault || transformTemplate) {
      const valueAsType = getValueAsType(value2, numberValueTypes[key]);
      if (!valueIsDefault) {
        transformIsDefault = false;
        const transformName = translateAlias[key] || key;
        transformString += `${transformName}(${valueAsType}) `;
      }
      if (transformTemplate) {
        transform2[key] = valueAsType;
      }
    }
  }
  transformString = transformString.trim();
  if (transformTemplate) {
    transformString = transformTemplate(transform2, transformIsDefault ? "" : transformString);
  } else if (transformIsDefault) {
    transformString = "none";
  }
  return transformString;
}
function buildHTMLStyles(state, latestValues, transformTemplate) {
  const { style: style2, vars, transformOrigin } = state;
  let hasTransform2 = false;
  let hasTransformOrigin = false;
  for (const key in latestValues) {
    const value2 = latestValues[key];
    if (transformProps.has(key)) {
      hasTransform2 = true;
      continue;
    } else if (isCSSVariableName(key)) {
      vars[key] = value2;
      continue;
    } else {
      const valueAsType = getValueAsType(value2, numberValueTypes[key]);
      if (key.startsWith("origin")) {
        hasTransformOrigin = true;
        transformOrigin[key] = valueAsType;
      } else {
        style2[key] = valueAsType;
      }
    }
  }
  if (!latestValues.transform) {
    if (hasTransform2 || transformTemplate) {
      style2.transform = buildTransform(latestValues, state.transform, transformTemplate);
    } else if (style2.transform) {
      style2.transform = "none";
    }
  }
  if (hasTransformOrigin) {
    const { originX = "50%", originY = "50%", originZ = 0 } = transformOrigin;
    style2.transformOrigin = `${originX} ${originY} ${originZ}`;
  }
}
const dashKeys = {
  offset: "stroke-dashoffset",
  array: "stroke-dasharray"
};
const camelKeys = {
  offset: "strokeDashoffset",
  array: "strokeDasharray"
};
function buildSVGPath(attrs, length2, spacing2 = 1, offset2 = 0, useDashCase = true) {
  attrs.pathLength = 1;
  const keys2 = useDashCase ? dashKeys : camelKeys;
  attrs[keys2.offset] = px.transform(-offset2);
  const pathLength = px.transform(length2);
  const pathSpacing = px.transform(spacing2);
  attrs[keys2.array] = `${pathLength} ${pathSpacing}`;
}
function calcOrigin$1(origin2, offset2, size2) {
  return typeof origin2 === "string" ? origin2 : px.transform(offset2 + size2 * origin2);
}
function calcSVGTransformOrigin(dimensions, originX, originY) {
  const pxOriginX = calcOrigin$1(originX, dimensions.x, dimensions.width);
  const pxOriginY = calcOrigin$1(originY, dimensions.y, dimensions.height);
  return `${pxOriginX} ${pxOriginY}`;
}
function buildSVGAttrs(state, {
  attrX,
  attrY,
  attrScale,
  originX,
  originY,
  pathLength,
  pathSpacing = 1,
  pathOffset = 0,
  // This is object creation, which we try to avoid per-frame.
  ...latest
}, isSVGTag2, transformTemplate) {
  buildHTMLStyles(state, latest, transformTemplate);
  if (isSVGTag2) {
    if (state.style.viewBox) {
      state.attrs.viewBox = state.style.viewBox;
    }
    return;
  }
  state.attrs = state.style;
  state.style = {};
  const { attrs, style: style2, dimensions } = state;
  if (attrs.transform) {
    if (dimensions)
      style2.transform = attrs.transform;
    delete attrs.transform;
  }
  if (dimensions && (originX !== void 0 || originY !== void 0 || style2.transform)) {
    style2.transformOrigin = calcSVGTransformOrigin(dimensions, originX !== void 0 ? originX : 0.5, originY !== void 0 ? originY : 0.5);
  }
  if (attrX !== void 0)
    attrs.x = attrX;
  if (attrY !== void 0)
    attrs.y = attrY;
  if (attrScale !== void 0)
    attrs.scale = attrScale;
  if (pathLength !== void 0) {
    buildSVGPath(attrs, pathLength, pathSpacing, pathOffset, false);
  }
}
const createHtmlRenderState = () => ({
  style: {},
  transform: {},
  transformOrigin: {},
  vars: {}
});
const createSvgRenderState = () => ({
  ...createHtmlRenderState(),
  attrs: {}
});
const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg";
function renderHTML(element2, { style: style2, vars }, styleProp, projection) {
  Object.assign(element2.style, style2, projection && projection.getProjectionStyles(styleProp));
  for (const key in vars) {
    element2.style.setProperty(key, vars[key]);
  }
}
const camelCaseAttributes = /* @__PURE__ */ new Set([
  "baseFrequency",
  "diffuseConstant",
  "kernelMatrix",
  "kernelUnitLength",
  "keySplines",
  "keyTimes",
  "limitingConeAngle",
  "markerHeight",
  "markerWidth",
  "numOctaves",
  "targetX",
  "targetY",
  "surfaceScale",
  "specularConstant",
  "specularExponent",
  "stdDeviation",
  "tableValues",
  "viewBox",
  "gradientTransform",
  "pathLength",
  "startOffset",
  "textLength",
  "lengthAdjust"
]);
function renderSVG(element2, renderState, _styleProp, projection) {
  renderHTML(element2, renderState, void 0, projection);
  for (const key in renderState.attrs) {
    element2.setAttribute(!camelCaseAttributes.has(key) ? camelToDash(key) : key, renderState.attrs[key]);
  }
}
const scaleCorrectors = {};
function addScaleCorrector(correctors) {
  Object.assign(scaleCorrectors, correctors);
}
function isForcedMotionValue(key, { layout: layout2, layoutId }) {
  return transformProps.has(key) || key.startsWith("origin") || (layout2 || layoutId !== void 0) && (!!scaleCorrectors[key] || key === "opacity");
}
function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
  var _a2;
  const { style: style2 } = props;
  const newValues = {};
  for (const key in style2) {
    if (isMotionValue(style2[key]) || prevProps.style && isMotionValue(prevProps.style[key]) || isForcedMotionValue(key, props) || ((_a2 = visualElement === null || visualElement === void 0 ? void 0 : visualElement.getValue(key)) === null || _a2 === void 0 ? void 0 : _a2.liveStyle) !== void 0) {
      newValues[key] = style2[key];
    }
  }
  return newValues;
}
function scrapeMotionValuesFromProps(props, prevProps, visualElement) {
  const newValues = scrapeMotionValuesFromProps$1(props, prevProps, visualElement);
  for (const key in props) {
    if (isMotionValue(props[key]) || isMotionValue(prevProps[key])) {
      const targetKey = transformPropOrder.indexOf(key) !== -1 ? "attr" + key.charAt(0).toUpperCase() + key.substring(1) : key;
      newValues[targetKey] = props[key];
    }
  }
  return newValues;
}
function updateSVGDimensions(instance2, renderState) {
  try {
    renderState.dimensions = typeof instance2.getBBox === "function" ? instance2.getBBox() : instance2.getBoundingClientRect();
  } catch (e2) {
    renderState.dimensions = {
      x: 0,
      y: 0,
      width: 0,
      height: 0
    };
  }
}
const layoutProps = ["x", "y", "width", "height", "cx", "cy", "r"];
const svgMotionConfig = {
  useVisualState: makeUseVisualState({
    scrapeMotionValuesFromProps,
    createRenderState: createSvgRenderState,
    onUpdate: ({ props, prevProps, current, renderState, latestValues }) => {
      if (!current)
        return;
      let hasTransform2 = !!props.drag;
      if (!hasTransform2) {
        for (const key in latestValues) {
          if (transformProps.has(key)) {
            hasTransform2 = true;
            break;
          }
        }
      }
      if (!hasTransform2)
        return;
      let needsMeasure = !prevProps;
      if (prevProps) {
        for (let i2 = 0; i2 < layoutProps.length; i2++) {
          const key = layoutProps[i2];
          if (props[key] !== prevProps[key]) {
            needsMeasure = true;
          }
        }
      }
      if (!needsMeasure)
        return;
      frame.read(() => {
        updateSVGDimensions(current, renderState);
        frame.render(() => {
          buildSVGAttrs(renderState, latestValues, isSVGTag(current.tagName), props.transformTemplate);
          renderSVG(current, renderState);
        });
      });
    }
  })
};
const htmlMotionConfig = {
  useVisualState: makeUseVisualState({
    scrapeMotionValuesFromProps: scrapeMotionValuesFromProps$1,
    createRenderState: createHtmlRenderState
  })
};
function copyRawValuesOnly(target, source2, props) {
  for (const key in source2) {
    if (!isMotionValue(source2[key]) && !isForcedMotionValue(key, props)) {
      target[key] = source2[key];
    }
  }
}
function useInitialMotionValues({ transformTemplate }, visualState) {
  return reactExports.useMemo(() => {
    const state = createHtmlRenderState();
    buildHTMLStyles(state, visualState, transformTemplate);
    return Object.assign({}, state.vars, state.style);
  }, [visualState]);
}
function useStyle$5(props, visualState) {
  const styleProp = props.style || {};
  const style2 = {};
  copyRawValuesOnly(style2, styleProp, props);
  Object.assign(style2, useInitialMotionValues(props, visualState));
  return style2;
}
function useHTMLProps(props, visualState) {
  const htmlProps = {};
  const style2 = useStyle$5(props, visualState);
  if (props.drag && props.dragListener !== false) {
    htmlProps.draggable = false;
    style2.userSelect = style2.WebkitUserSelect = style2.WebkitTouchCallout = "none";
    style2.touchAction = props.drag === true ? "none" : `pan-${props.drag === "x" ? "y" : "x"}`;
  }
  if (props.tabIndex === void 0 && (props.onTap || props.onTapStart || props.whileTap)) {
    htmlProps.tabIndex = 0;
  }
  htmlProps.style = style2;
  return htmlProps;
}
function useSVGProps(props, visualState, _isStatic, Component2) {
  const visualProps = reactExports.useMemo(() => {
    const state = createSvgRenderState();
    buildSVGAttrs(state, visualState, isSVGTag(Component2), props.transformTemplate);
    return {
      ...state.attrs,
      style: { ...state.style }
    };
  }, [visualState]);
  if (props.style) {
    const rawStyles = {};
    copyRawValuesOnly(rawStyles, props.style, props);
    visualProps.style = { ...rawStyles, ...visualProps.style };
  }
  return visualProps;
}
function createUseRender(forwardMotionProps = false) {
  const useRender = (Component2, props, ref, { latestValues }, isStatic) => {
    const useVisualProps = isSVGComponent(Component2) ? useSVGProps : useHTMLProps;
    const visualProps = useVisualProps(props, latestValues, isStatic, Component2);
    const filteredProps = filterProps(props, typeof Component2 === "string", forwardMotionProps);
    const elementProps = Component2 !== reactExports.Fragment ? { ...filteredProps, ...visualProps, ref } : {};
    const { children } = props;
    const renderedChildren = reactExports.useMemo(() => isMotionValue(children) ? children.get() : children, [children]);
    return reactExports.createElement(Component2, {
      ...elementProps,
      children: renderedChildren
    });
  };
  return useRender;
}
function createMotionComponentFactory(preloadedFeatures, createVisualElement) {
  return function createMotionComponent(Component2, { forwardMotionProps } = { forwardMotionProps: false }) {
    const baseConfig2 = isSVGComponent(Component2) ? svgMotionConfig : htmlMotionConfig;
    const config2 = {
      ...baseConfig2,
      preloadedFeatures,
      useRender: createUseRender(forwardMotionProps),
      createVisualElement,
      Component: Component2
    };
    return createRendererMotionComponent(config2);
  };
}
const createMinimalMotionComponent = /* @__PURE__ */ createMotionComponentFactory();
const m$3 = /* @__PURE__ */ createDOMMotionComponentProxy(createMinimalMotionComponent);
function shallowCompare(next2, prev2) {
  if (!Array.isArray(prev2))
    return false;
  const prevLength = prev2.length;
  if (prevLength !== next2.length)
    return false;
  for (let i2 = 0; i2 < prevLength; i2++) {
    if (prev2[i2] !== next2[i2])
      return false;
  }
  return true;
}
function resolveVariant(visualElement, definition2, custom2) {
  const props = visualElement.getProps();
  return resolveVariantFromProps(props, definition2, custom2 !== void 0 ? custom2 : props.custom, visualElement);
}
const supportsScrollTimeline = /* @__PURE__ */ memo$1(() => window.ScrollTimeline !== void 0);
class BaseGroupPlaybackControls {
  constructor(animations2) {
    this.stop = () => this.runAll("stop");
    this.animations = animations2.filter(Boolean);
  }
  get finished() {
    return Promise.all(this.animations.map((animation) => "finished" in animation ? animation.finished : animation));
  }
  /**
   * TODO: Filter out cancelled or stopped animations before returning
   */
  getAll(propName) {
    return this.animations[0][propName];
  }
  setAll(propName, newValue) {
    for (let i2 = 0; i2 < this.animations.length; i2++) {
      this.animations[i2][propName] = newValue;
    }
  }
  attachTimeline(timeline, fallback2) {
    const subscriptions = this.animations.map((animation) => {
      if (supportsScrollTimeline() && animation.attachTimeline) {
        return animation.attachTimeline(timeline);
      } else if (typeof fallback2 === "function") {
        return fallback2(animation);
      }
    });
    return () => {
      subscriptions.forEach((cancel2, i2) => {
        cancel2 && cancel2();
        this.animations[i2].stop();
      });
    };
  }
  get time() {
    return this.getAll("time");
  }
  set time(time2) {
    this.setAll("time", time2);
  }
  get speed() {
    return this.getAll("speed");
  }
  set speed(speed) {
    this.setAll("speed", speed);
  }
  get startTime() {
    return this.getAll("startTime");
  }
  get duration() {
    let max2 = 0;
    for (let i2 = 0; i2 < this.animations.length; i2++) {
      max2 = Math.max(max2, this.animations[i2].duration);
    }
    return max2;
  }
  runAll(methodName) {
    this.animations.forEach((controls) => controls[methodName]());
  }
  flatten() {
    this.runAll("flatten");
  }
  play() {
    this.runAll("play");
  }
  pause() {
    this.runAll("pause");
  }
  cancel() {
    this.runAll("cancel");
  }
  complete() {
    this.runAll("complete");
  }
}
class GroupPlaybackControls extends BaseGroupPlaybackControls {
  then(onResolve, onReject) {
    return Promise.all(this.animations).then(onResolve).catch(onReject);
  }
}
function getValueTransition(transition3, key) {
  return transition3 ? transition3[key] || transition3["default"] || transition3 : void 0;
}
const maxGeneratorDuration = 2e4;
function calcGeneratorDuration(generator) {
  let duration2 = 0;
  const timeStep = 50;
  let state = generator.next(duration2);
  while (!state.done && duration2 < maxGeneratorDuration) {
    duration2 += timeStep;
    state = generator.next(duration2);
  }
  return duration2 >= maxGeneratorDuration ? Infinity : duration2;
}
function isGenerator(type4) {
  return typeof type4 === "function";
}
function attachTimeline(animation, timeline) {
  animation.timeline = timeline;
  animation.onfinish = null;
}
const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] === "number";
const supportsFlags = {
  linearEasing: void 0
};
function memoSupports(callback2, supportsFlag) {
  const memoized = /* @__PURE__ */ memo$1(callback2);
  return () => {
    var _a2;
    return (_a2 = supportsFlags[supportsFlag]) !== null && _a2 !== void 0 ? _a2 : memoized();
  };
}
const supportsLinearEasing = /* @__PURE__ */ memoSupports(() => {
  try {
    document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
  } catch (e2) {
    return false;
  }
  return true;
}, "linearEasing");
const generateLinearEasing = (easing, duration2, resolution = 10) => {
  let points = "";
  const numPoints = Math.max(Math.round(duration2 / resolution), 2);
  for (let i2 = 0; i2 < numPoints; i2++) {
    points += easing(/* @__PURE__ */ progress$1(0, numPoints - 1, i2)) + ", ";
  }
  return `linear(${points.substring(0, points.length - 2)})`;
};
function isWaapiSupportedEasing(easing) {
  return Boolean(typeof easing === "function" && supportsLinearEasing() || !easing || typeof easing === "string" && (easing in supportedWaapiEasing || supportsLinearEasing()) || isBezierDefinition(easing) || Array.isArray(easing) && easing.every(isWaapiSupportedEasing));
}
const cubicBezierAsString = ([a2, b2, c2, d2]) => `cubic-bezier(${a2}, ${b2}, ${c2}, ${d2})`;
const supportedWaapiEasing = {
  linear: "linear",
  ease: "ease",
  easeIn: "ease-in",
  easeOut: "ease-out",
  easeInOut: "ease-in-out",
  circIn: /* @__PURE__ */ cubicBezierAsString([0, 0.65, 0.55, 1]),
  circOut: /* @__PURE__ */ cubicBezierAsString([0.55, 0, 1, 0.45]),
  backIn: /* @__PURE__ */ cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),
  backOut: /* @__PURE__ */ cubicBezierAsString([0.33, 1.53, 0.69, 0.99])
};
function mapEasingToNativeEasing(easing, duration2) {
  if (!easing) {
    return void 0;
  } else if (typeof easing === "function" && supportsLinearEasing()) {
    return generateLinearEasing(easing, duration2);
  } else if (isBezierDefinition(easing)) {
    return cubicBezierAsString(easing);
  } else if (Array.isArray(easing)) {
    return easing.map((segmentEasing) => mapEasingToNativeEasing(segmentEasing, duration2) || supportedWaapiEasing.easeOut);
  } else {
    return supportedWaapiEasing[easing];
  }
}
const isDragging = {
  x: false,
  y: false
};
function isDragActive() {
  return isDragging.x || isDragging.y;
}
function resolveElements(elementOrSelector, scope, selectorCache) {
  var _a2;
  if (elementOrSelector instanceof Element) {
    return [elementOrSelector];
  } else if (typeof elementOrSelector === "string") {
    let root2 = document;
    if (scope) {
      root2 = scope.current;
    }
    const elements = (_a2 = selectorCache === null || selectorCache === void 0 ? void 0 : selectorCache[elementOrSelector]) !== null && _a2 !== void 0 ? _a2 : root2.querySelectorAll(elementOrSelector);
    return elements ? Array.from(elements) : [];
  }
  return Array.from(elementOrSelector);
}
function setupGesture(elementOrSelector, options) {
  const elements = resolveElements(elementOrSelector);
  const gestureAbortController = new AbortController();
  const eventOptions = {
    passive: true,
    ...options,
    signal: gestureAbortController.signal
  };
  const cancel2 = () => gestureAbortController.abort();
  return [elements, eventOptions, cancel2];
}
function filterEvents$1(callback2) {
  return (event) => {
    if (event.pointerType === "touch" || isDragActive())
      return;
    callback2(event);
  };
}
function hover$2(elementOrSelector, onHoverStart, options = {}) {
  const [elements, eventOptions, cancel2] = setupGesture(elementOrSelector, options);
  const onPointerEnter = filterEvents$1((enterEvent) => {
    const { target } = enterEvent;
    const onHoverEnd = onHoverStart(enterEvent);
    if (typeof onHoverEnd !== "function" || !target)
      return;
    const onPointerLeave = filterEvents$1((leaveEvent) => {
      onHoverEnd(leaveEvent);
      target.removeEventListener("pointerleave", onPointerLeave);
    });
    target.addEventListener("pointerleave", onPointerLeave, eventOptions);
  });
  elements.forEach((element2) => {
    element2.addEventListener("pointerenter", onPointerEnter, eventOptions);
  });
  return cancel2;
}
const isNodeOrChild = (parent, child) => {
  if (!child) {
    return false;
  } else if (parent === child) {
    return true;
  } else {
    return isNodeOrChild(parent, child.parentElement);
  }
};
const isPrimaryPointer = (event) => {
  if (event.pointerType === "mouse") {
    return typeof event.button !== "number" || event.button <= 0;
  } else {
    return event.isPrimary !== false;
  }
};
const focusableElements = /* @__PURE__ */ new Set([
  "BUTTON",
  "INPUT",
  "SELECT",
  "TEXTAREA",
  "A"
]);
function isElementKeyboardAccessible(element2) {
  return focusableElements.has(element2.tagName) || element2.tabIndex !== -1;
}
const isPressing = /* @__PURE__ */ new WeakSet();
function filterEvents(callback2) {
  return (event) => {
    if (event.key !== "Enter")
      return;
    callback2(event);
  };
}
function firePointerEvent(target, type4) {
  target.dispatchEvent(new PointerEvent("pointer" + type4, { isPrimary: true, bubbles: true }));
}
const enableKeyboardPress = (focusEvent, eventOptions) => {
  const element2 = focusEvent.currentTarget;
  if (!element2)
    return;
  const handleKeydown = filterEvents(() => {
    if (isPressing.has(element2))
      return;
    firePointerEvent(element2, "down");
    const handleKeyup = filterEvents(() => {
      firePointerEvent(element2, "up");
    });
    const handleBlur = () => firePointerEvent(element2, "cancel");
    element2.addEventListener("keyup", handleKeyup, eventOptions);
    element2.addEventListener("blur", handleBlur, eventOptions);
  });
  element2.addEventListener("keydown", handleKeydown, eventOptions);
  element2.addEventListener("blur", () => element2.removeEventListener("keydown", handleKeydown), eventOptions);
};
function isValidPressEvent(event) {
  return isPrimaryPointer(event) && !isDragActive();
}
function press(elementOrSelector, onPressStart, options = {}) {
  const [elements, eventOptions, cancelEvents] = setupGesture(elementOrSelector, options);
  const startPress = (startEvent) => {
    const element2 = startEvent.currentTarget;
    if (!isValidPressEvent(startEvent) || isPressing.has(element2))
      return;
    isPressing.add(element2);
    const onPressEnd = onPressStart(startEvent);
    const onPointerEnd = (endEvent, success) => {
      window.removeEventListener("pointerup", onPointerUp);
      window.removeEventListener("pointercancel", onPointerCancel);
      if (!isValidPressEvent(endEvent) || !isPressing.has(element2)) {
        return;
      }
      isPressing.delete(element2);
      if (typeof onPressEnd === "function") {
        onPressEnd(endEvent, { success });
      }
    };
    const onPointerUp = (upEvent) => {
      onPointerEnd(upEvent, options.useGlobalTarget || isNodeOrChild(element2, upEvent.target));
    };
    const onPointerCancel = (cancelEvent) => {
      onPointerEnd(cancelEvent, false);
    };
    window.addEventListener("pointerup", onPointerUp, eventOptions);
    window.addEventListener("pointercancel", onPointerCancel, eventOptions);
  };
  elements.forEach((element2) => {
    if (!isElementKeyboardAccessible(element2) && element2.getAttribute("tabindex") === null) {
      element2.tabIndex = 0;
    }
    const target = options.useGlobalTarget ? window : element2;
    target.addEventListener("pointerdown", startPress, eventOptions);
    element2.addEventListener("focus", (event) => enableKeyboardPress(event, eventOptions), eventOptions);
  });
  return cancelEvents;
}
function setDragLock(axis) {
  if (axis === "x" || axis === "y") {
    if (isDragging[axis]) {
      return null;
    } else {
      isDragging[axis] = true;
      return () => {
        isDragging[axis] = false;
      };
    }
  } else {
    if (isDragging.x || isDragging.y) {
      return null;
    } else {
      isDragging.x = isDragging.y = true;
      return () => {
        isDragging.x = isDragging.y = false;
      };
    }
  }
}
const positionalKeys = /* @__PURE__ */ new Set([
  "width",
  "height",
  "top",
  "left",
  "right",
  "bottom",
  ...transformPropOrder
]);
let now$2;
function clearTime() {
  now$2 = void 0;
}
const time = {
  now: () => {
    if (now$2 === void 0) {
      time.set(frameData.isProcessing || MotionGlobalConfig.useManualTiming ? frameData.timestamp : performance.now());
    }
    return now$2;
  },
  set: (newTime) => {
    now$2 = newTime;
    queueMicrotask(clearTime);
  }
};
function addUniqueItem(arr, item) {
  if (arr.indexOf(item) === -1)
    arr.push(item);
}
function removeItem(arr, item) {
  const index2 = arr.indexOf(item);
  if (index2 > -1)
    arr.splice(index2, 1);
}
function moveItem([...arr], fromIndex, toIndex) {
  const startIndex = fromIndex < 0 ? arr.length + fromIndex : fromIndex;
  if (startIndex >= 0 && startIndex < arr.length) {
    const endIndex = toIndex < 0 ? arr.length + toIndex : toIndex;
    const [item] = arr.splice(fromIndex, 1);
    arr.splice(endIndex, 0, item);
  }
  return arr;
}
class SubscriptionManager {
  constructor() {
    this.subscriptions = [];
  }
  add(handler) {
    addUniqueItem(this.subscriptions, handler);
    return () => removeItem(this.subscriptions, handler);
  }
  notify(a2, b2, c2) {
    const numSubscriptions = this.subscriptions.length;
    if (!numSubscriptions)
      return;
    if (numSubscriptions === 1) {
      this.subscriptions[0](a2, b2, c2);
    } else {
      for (let i2 = 0; i2 < numSubscriptions; i2++) {
        const handler = this.subscriptions[i2];
        handler && handler(a2, b2, c2);
      }
    }
  }
  getSize() {
    return this.subscriptions.length;
  }
  clear() {
    this.subscriptions.length = 0;
  }
}
function velocityPerSecond(velocity, frameDuration) {
  return frameDuration ? velocity * (1e3 / frameDuration) : 0;
}
const MAX_VELOCITY_DELTA = 30;
const isFloat = (value2) => {
  return !isNaN(parseFloat(value2));
};
const collectMotionValues = {
  current: void 0
};
class MotionValue {
  /**
   * @param init - The initiating value
   * @param config - Optional configuration options
   *
   * -  `transformer`: A function to transform incoming values with.
   *
   * @internal
   */
  constructor(init2, options = {}) {
    this.version = "11.18.2";
    this.canTrackVelocity = null;
    this.events = {};
    this.updateAndNotify = (v2, render3 = true) => {
      const currentTime = time.now();
      if (this.updatedAt !== currentTime) {
        this.setPrevFrameValue();
      }
      this.prev = this.current;
      this.setCurrent(v2);
      if (this.current !== this.prev && this.events.change) {
        this.events.change.notify(this.current);
      }
      if (render3 && this.events.renderRequest) {
        this.events.renderRequest.notify(this.current);
      }
    };
    this.hasAnimated = false;
    this.setCurrent(init2);
    this.owner = options.owner;
  }
  setCurrent(current) {
    this.current = current;
    this.updatedAt = time.now();
    if (this.canTrackVelocity === null && current !== void 0) {
      this.canTrackVelocity = isFloat(this.current);
    }
  }
  setPrevFrameValue(prevFrameValue = this.current) {
    this.prevFrameValue = prevFrameValue;
    this.prevUpdatedAt = this.updatedAt;
  }
  /**
   * Adds a function that will be notified when the `MotionValue` is updated.
   *
   * It returns a function that, when called, will cancel the subscription.
   *
   * When calling `onChange` inside a React component, it should be wrapped with the
   * `useEffect` hook. As it returns an unsubscribe function, this should be returned
   * from the `useEffect` function to ensure you don't add duplicate subscribers..
   *
   * ```jsx
   * export const MyComponent = () => {
   *   const x = useMotionValue(0)
   *   const y = useMotionValue(0)
   *   const opacity = useMotionValue(1)
   *
   *   useEffect(() => {
   *     function updateOpacity() {
   *       const maxXY = Math.max(x.get(), y.get())
   *       const newOpacity = transform(maxXY, [0, 100], [1, 0])
   *       opacity.set(newOpacity)
   *     }
   *
   *     const unsubscribeX = x.on("change", updateOpacity)
   *     const unsubscribeY = y.on("change", updateOpacity)
   *
   *     return () => {
   *       unsubscribeX()
   *       unsubscribeY()
   *     }
   *   }, [])
   *
   *   return <motion.div style={{ x }} />
   * }
   * ```
   *
   * @param subscriber - A function that receives the latest value.
   * @returns A function that, when called, will cancel this subscription.
   *
   * @deprecated
   */
  onChange(subscription) {
    return this.on("change", subscription);
  }
  on(eventName, callback2) {
    if (!this.events[eventName]) {
      this.events[eventName] = new SubscriptionManager();
    }
    const unsubscribe = this.events[eventName].add(callback2);
    if (eventName === "change") {
      return () => {
        unsubscribe();
        frame.read(() => {
          if (!this.events.change.getSize()) {
            this.stop();
          }
        });
      };
    }
    return unsubscribe;
  }
  clearListeners() {
    for (const eventManagers in this.events) {
      this.events[eventManagers].clear();
    }
  }
  /**
   * Attaches a passive effect to the `MotionValue`.
   *
   * @internal
   */
  attach(passiveEffect, stopPassiveEffect) {
    this.passiveEffect = passiveEffect;
    this.stopPassiveEffect = stopPassiveEffect;
  }
  /**
   * Sets the state of the `MotionValue`.
   *
   * @remarks
   *
   * ```jsx
   * const x = useMotionValue(0)
   * x.set(10)
   * ```
   *
   * @param latest - Latest value to set.
   * @param render - Whether to notify render subscribers. Defaults to `true`
   *
   * @public
   */
  set(v2, render3 = true) {
    if (!render3 || !this.passiveEffect) {
      this.updateAndNotify(v2, render3);
    } else {
      this.passiveEffect(v2, this.updateAndNotify);
    }
  }
  setWithVelocity(prev2, current, delta) {
    this.set(current);
    this.prev = void 0;
    this.prevFrameValue = prev2;
    this.prevUpdatedAt = this.updatedAt - delta;
  }
  /**
   * Set the state of the `MotionValue`, stopping any active animations,
   * effects, and resets velocity to `0`.
   */
  jump(v2, endAnimation = true) {
    this.updateAndNotify(v2);
    this.prev = v2;
    this.prevUpdatedAt = this.prevFrameValue = void 0;
    endAnimation && this.stop();
    if (this.stopPassiveEffect)
      this.stopPassiveEffect();
  }
  /**
   * Returns the latest state of `MotionValue`
   *
   * @returns - The latest state of `MotionValue`
   *
   * @public
   */
  get() {
    if (collectMotionValues.current) {
      collectMotionValues.current.push(this);
    }
    return this.current;
  }
  /**
   * @public
   */
  getPrevious() {
    return this.prev;
  }
  /**
   * Returns the latest velocity of `MotionValue`
   *
   * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
   *
   * @public
   */
  getVelocity() {
    const currentTime = time.now();
    if (!this.canTrackVelocity || this.prevFrameValue === void 0 || currentTime - this.updatedAt > MAX_VELOCITY_DELTA) {
      return 0;
    }
    const delta = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA);
    return velocityPerSecond(parseFloat(this.current) - parseFloat(this.prevFrameValue), delta);
  }
  /**
   * Registers a new animation to control this `MotionValue`. Only one
   * animation can drive a `MotionValue` at one time.
   *
   * ```jsx
   * value.start()
   * ```
   *
   * @param animation - A function that starts the provided animation
   *
   * @internal
   */
  start(startAnimation) {
    this.stop();
    return new Promise((resolve2) => {
      this.hasAnimated = true;
      this.animation = startAnimation(resolve2);
      if (this.events.animationStart) {
        this.events.animationStart.notify();
      }
    }).then(() => {
      if (this.events.animationComplete) {
        this.events.animationComplete.notify();
      }
      this.clearAnimation();
    });
  }
  /**
   * Stop the currently active animation.
   *
   * @public
   */
  stop() {
    if (this.animation) {
      this.animation.stop();
      if (this.events.animationCancel) {
        this.events.animationCancel.notify();
      }
    }
    this.clearAnimation();
  }
  /**
   * Returns `true` if this value is currently animating.
   *
   * @public
   */
  isAnimating() {
    return !!this.animation;
  }
  clearAnimation() {
    delete this.animation;
  }
  /**
   * Destroy and clean up subscribers to this `MotionValue`.
   *
   * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
   * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
   * created a `MotionValue` via the `motionValue` function.
   *
   * @public
   */
  destroy() {
    this.clearListeners();
    this.stop();
    if (this.stopPassiveEffect) {
      this.stopPassiveEffect();
    }
  }
}
function motionValue(init2, options) {
  return new MotionValue(init2, options);
}
function setMotionValue(visualElement, key, value2) {
  if (visualElement.hasValue(key)) {
    visualElement.getValue(key).set(value2);
  } else {
    visualElement.addValue(key, motionValue(value2));
  }
}
function setTarget(visualElement, definition2) {
  const resolved = resolveVariant(visualElement, definition2);
  let { transitionEnd = {}, transition: transition3 = {}, ...target } = resolved || {};
  target = { ...target, ...transitionEnd };
  for (const key in target) {
    const value2 = resolveFinalValueInKeyframes(target[key]);
    setMotionValue(visualElement, key, value2);
  }
}
function isWillChangeMotionValue(value2) {
  return Boolean(isMotionValue(value2) && value2.add);
}
function addValueToWillChange(visualElement, key) {
  const willChange = visualElement.getValue("willChange");
  if (isWillChangeMotionValue(willChange)) {
    return willChange.add(key);
  }
}
function getOptimisedAppearId(visualElement) {
  return visualElement.props[optimizedAppearDataAttribute];
}
const instantAnimationState = {
  current: false
};
const calcBezier = (t2, a1, a2) => (((1 - 3 * a2 + 3 * a1) * t2 + (3 * a2 - 6 * a1)) * t2 + 3 * a1) * t2;
const subdivisionPrecision = 1e-7;
const subdivisionMaxIterations = 12;
function binarySubdivide(x2, lowerBound, upperBound, mX1, mX2) {
  let currentX;
  let currentT;
  let i2 = 0;
  do {
    currentT = lowerBound + (upperBound - lowerBound) / 2;
    currentX = calcBezier(currentT, mX1, mX2) - x2;
    if (currentX > 0) {
      upperBound = currentT;
    } else {
      lowerBound = currentT;
    }
  } while (Math.abs(currentX) > subdivisionPrecision && ++i2 < subdivisionMaxIterations);
  return currentT;
}
function cubicBezier(mX1, mY1, mX2, mY2) {
  if (mX1 === mY1 && mX2 === mY2)
    return noop$9;
  const getTForX = (aX) => binarySubdivide(aX, 0, 1, mX1, mX2);
  return (t2) => t2 === 0 || t2 === 1 ? t2 : calcBezier(getTForX(t2), mY1, mY2);
}
const mirrorEasing = (easing) => (p2) => p2 <= 0.5 ? easing(2 * p2) / 2 : (2 - easing(2 * (1 - p2))) / 2;
const reverseEasing = (easing) => (p2) => 1 - easing(1 - p2);
const backOut = /* @__PURE__ */ cubicBezier(0.33, 1.53, 0.69, 0.99);
const backIn = /* @__PURE__ */ reverseEasing(backOut);
const backInOut = /* @__PURE__ */ mirrorEasing(backIn);
const anticipate = (p2) => (p2 *= 2) < 1 ? 0.5 * backIn(p2) : 0.5 * (2 - Math.pow(2, -10 * (p2 - 1)));
const circIn = (p2) => 1 - Math.sin(Math.acos(p2));
const circOut = reverseEasing(circIn);
const circInOut = mirrorEasing(circIn);
const isZeroValueString = (v2) => /^0[^.\s]+$/u.test(v2);
function isNone(value2) {
  if (typeof value2 === "number") {
    return value2 === 0;
  } else if (value2 !== null) {
    return value2 === "none" || value2 === "0" || isZeroValueString(value2);
  } else {
    return true;
  }
}
const sanitize = (v2) => Math.round(v2 * 1e5) / 1e5;
const floatRegex = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
function isNullish(v2) {
  return v2 == null;
}
const singleColorRegex = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;
const isColorString = (type4, testProp) => (v2) => {
  return Boolean(typeof v2 === "string" && singleColorRegex.test(v2) && v2.startsWith(type4) || testProp && !isNullish(v2) && Object.prototype.hasOwnProperty.call(v2, testProp));
};
const splitColor = (aName, bName, cName) => (v2) => {
  if (typeof v2 !== "string")
    return v2;
  const [a2, b2, c2, alpha2] = v2.match(floatRegex);
  return {
    [aName]: parseFloat(a2),
    [bName]: parseFloat(b2),
    [cName]: parseFloat(c2),
    alpha: alpha2 !== void 0 ? parseFloat(alpha2) : 1
  };
};
const clampRgbUnit = (v2) => clamp$1(0, 255, v2);
const rgbUnit = {
  ...number$2,
  transform: (v2) => Math.round(clampRgbUnit(v2))
};
const rgba = {
  test: /* @__PURE__ */ isColorString("rgb", "red"),
  parse: /* @__PURE__ */ splitColor("red", "green", "blue"),
  transform: ({ red: red2, green: green2, blue: blue2, alpha: alpha$1$1 = 1 }) => "rgba(" + rgbUnit.transform(red2) + ", " + rgbUnit.transform(green2) + ", " + rgbUnit.transform(blue2) + ", " + sanitize(alpha$1.transform(alpha$1$1)) + ")"
};
function parseHex(v2) {
  let r2 = "";
  let g2 = "";
  let b2 = "";
  let a2 = "";
  if (v2.length > 5) {
    r2 = v2.substring(1, 3);
    g2 = v2.substring(3, 5);
    b2 = v2.substring(5, 7);
    a2 = v2.substring(7, 9);
  } else {
    r2 = v2.substring(1, 2);
    g2 = v2.substring(2, 3);
    b2 = v2.substring(3, 4);
    a2 = v2.substring(4, 5);
    r2 += r2;
    g2 += g2;
    b2 += b2;
    a2 += a2;
  }
  return {
    red: parseInt(r2, 16),
    green: parseInt(g2, 16),
    blue: parseInt(b2, 16),
    alpha: a2 ? parseInt(a2, 16) / 255 : 1
  };
}
const hex$1 = {
  test: /* @__PURE__ */ isColorString("#"),
  parse: parseHex,
  transform: rgba.transform
};
const hsla = {
  test: /* @__PURE__ */ isColorString("hsl", "hue"),
  parse: /* @__PURE__ */ splitColor("hue", "saturation", "lightness"),
  transform: ({ hue: hue2, saturation, lightness, alpha: alpha$1$1 = 1 }) => {
    return "hsla(" + Math.round(hue2) + ", " + percent.transform(sanitize(saturation)) + ", " + percent.transform(sanitize(lightness)) + ", " + sanitize(alpha$1.transform(alpha$1$1)) + ")";
  }
};
const color$2 = {
  test: (v2) => rgba.test(v2) || hex$1.test(v2) || hsla.test(v2),
  parse: (v2) => {
    if (rgba.test(v2)) {
      return rgba.parse(v2);
    } else if (hsla.test(v2)) {
      return hsla.parse(v2);
    } else {
      return hex$1.parse(v2);
    }
  },
  transform: (v2) => {
    return typeof v2 === "string" ? v2 : v2.hasOwnProperty("red") ? rgba.transform(v2) : hsla.transform(v2);
  }
};
const colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
function test$1(v2) {
  var _a2, _b2;
  return isNaN(v2) && typeof v2 === "string" && (((_a2 = v2.match(floatRegex)) === null || _a2 === void 0 ? void 0 : _a2.length) || 0) + (((_b2 = v2.match(colorRegex)) === null || _b2 === void 0 ? void 0 : _b2.length) || 0) > 0;
}
const NUMBER_TOKEN = "number";
const COLOR_TOKEN = "color";
const VAR_TOKEN = "var";
const VAR_FUNCTION_TOKEN = "var(";
const SPLIT_TOKEN = "${}";
const complexRegex = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;
function analyseComplexValue(value2) {
  const originalValue = value2.toString();
  const values = [];
  const indexes = {
    color: [],
    number: [],
    var: []
  };
  const types2 = [];
  let i2 = 0;
  const tokenised = originalValue.replace(complexRegex, (parsedValue) => {
    if (color$2.test(parsedValue)) {
      indexes.color.push(i2);
      types2.push(COLOR_TOKEN);
      values.push(color$2.parse(parsedValue));
    } else if (parsedValue.startsWith(VAR_FUNCTION_TOKEN)) {
      indexes.var.push(i2);
      types2.push(VAR_TOKEN);
      values.push(parsedValue);
    } else {
      indexes.number.push(i2);
      types2.push(NUMBER_TOKEN);
      values.push(parseFloat(parsedValue));
    }
    ++i2;
    return SPLIT_TOKEN;
  });
  const split2 = tokenised.split(SPLIT_TOKEN);
  return { values, split: split2, indexes, types: types2 };
}
function parseComplexValue(v2) {
  return analyseComplexValue(v2).values;
}
function createTransformer(source2) {
  const { split: split2, types: types2 } = analyseComplexValue(source2);
  const numSections = split2.length;
  return (v2) => {
    let output2 = "";
    for (let i2 = 0; i2 < numSections; i2++) {
      output2 += split2[i2];
      if (v2[i2] !== void 0) {
        const type4 = types2[i2];
        if (type4 === NUMBER_TOKEN) {
          output2 += sanitize(v2[i2]);
        } else if (type4 === COLOR_TOKEN) {
          output2 += color$2.transform(v2[i2]);
        } else {
          output2 += v2[i2];
        }
      }
    }
    return output2;
  };
}
const convertNumbersToZero = (v2) => typeof v2 === "number" ? 0 : v2;
function getAnimatableNone$1(v2) {
  const parsed = parseComplexValue(v2);
  const transformer = createTransformer(v2);
  return transformer(parsed.map(convertNumbersToZero));
}
const complex = {
  test: test$1,
  parse: parseComplexValue,
  createTransformer,
  getAnimatableNone: getAnimatableNone$1
};
const maxDefaults = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
function applyDefaultFilter(v2) {
  const [name2, value2] = v2.slice(0, -1).split("(");
  if (name2 === "drop-shadow")
    return v2;
  const [number4] = value2.match(floatRegex) || [];
  if (!number4)
    return v2;
  const unit2 = value2.replace(number4, "");
  let defaultValue2 = maxDefaults.has(name2) ? 1 : 0;
  if (number4 !== value2)
    defaultValue2 *= 100;
  return name2 + "(" + defaultValue2 + unit2 + ")";
}
const functionRegex = /\b([a-z-]*)\(.*?\)/gu;
const filter = {
  ...complex,
  getAnimatableNone: (v2) => {
    const functions = v2.match(functionRegex);
    return functions ? functions.map(applyDefaultFilter).join(" ") : v2;
  }
};
const defaultValueTypes = {
  ...numberValueTypes,
  // Color props
  color: color$2,
  backgroundColor: color$2,
  outlineColor: color$2,
  fill: color$2,
  stroke: color$2,
  // Border props
  borderColor: color$2,
  borderTopColor: color$2,
  borderRightColor: color$2,
  borderBottomColor: color$2,
  borderLeftColor: color$2,
  filter,
  WebkitFilter: filter
};
const getDefaultValueType = (key) => defaultValueTypes[key];
function getAnimatableNone(key, value2) {
  let defaultValueType = getDefaultValueType(key);
  if (defaultValueType !== filter)
    defaultValueType = complex;
  return defaultValueType.getAnimatableNone ? defaultValueType.getAnimatableNone(value2) : void 0;
}
const invalidTemplates = /* @__PURE__ */ new Set(["auto", "none", "0"]);
function makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name2) {
  let i2 = 0;
  let animatableTemplate = void 0;
  while (i2 < unresolvedKeyframes.length && !animatableTemplate) {
    const keyframe = unresolvedKeyframes[i2];
    if (typeof keyframe === "string" && !invalidTemplates.has(keyframe) && analyseComplexValue(keyframe).values.length) {
      animatableTemplate = unresolvedKeyframes[i2];
    }
    i2++;
  }
  if (animatableTemplate && name2) {
    for (const noneIndex of noneKeyframeIndexes) {
      unresolvedKeyframes[noneIndex] = getAnimatableNone(name2, animatableTemplate);
    }
  }
}
const isNumOrPxType = (v2) => v2 === number$2 || v2 === px;
const getPosFromMatrix = (matrix, pos) => parseFloat(matrix.split(", ")[pos]);
const getTranslateFromMatrix = (pos2, pos3) => (_bbox, { transform: transform2 }) => {
  if (transform2 === "none" || !transform2)
    return 0;
  const matrix3d = transform2.match(/^matrix3d\((.+)\)$/u);
  if (matrix3d) {
    return getPosFromMatrix(matrix3d[1], pos3);
  } else {
    const matrix = transform2.match(/^matrix\((.+)\)$/u);
    if (matrix) {
      return getPosFromMatrix(matrix[1], pos2);
    } else {
      return 0;
    }
  }
};
const transformKeys = /* @__PURE__ */ new Set(["x", "y", "z"]);
const nonTranslationalTransformKeys = transformPropOrder.filter((key) => !transformKeys.has(key));
function removeNonTranslationalTransform(visualElement) {
  const removedTransforms = [];
  nonTranslationalTransformKeys.forEach((key) => {
    const value2 = visualElement.getValue(key);
    if (value2 !== void 0) {
      removedTransforms.push([key, value2.get()]);
      value2.set(key.startsWith("scale") ? 1 : 0);
    }
  });
  return removedTransforms;
}
const positionalValues = {
  // Dimensions
  width: ({ x: x2 }, { paddingLeft = "0", paddingRight = "0" }) => x2.max - x2.min - parseFloat(paddingLeft) - parseFloat(paddingRight),
  height: ({ y: y2 }, { paddingTop = "0", paddingBottom = "0" }) => y2.max - y2.min - parseFloat(paddingTop) - parseFloat(paddingBottom),
  top: (_bbox, { top: top2 }) => parseFloat(top2),
  left: (_bbox, { left: left2 }) => parseFloat(left2),
  bottom: ({ y: y2 }, { top: top2 }) => parseFloat(top2) + (y2.max - y2.min),
  right: ({ x: x2 }, { left: left2 }) => parseFloat(left2) + (x2.max - x2.min),
  // Transform
  x: getTranslateFromMatrix(4, 13),
  y: getTranslateFromMatrix(5, 14)
};
positionalValues.translateX = positionalValues.x;
positionalValues.translateY = positionalValues.y;
const toResolve = /* @__PURE__ */ new Set();
let isScheduled = false;
let anyNeedsMeasurement = false;
function measureAllKeyframes() {
  if (anyNeedsMeasurement) {
    const resolversToMeasure = Array.from(toResolve).filter((resolver2) => resolver2.needsMeasurement);
    const elementsToMeasure = new Set(resolversToMeasure.map((resolver2) => resolver2.element));
    const transformsToRestore = /* @__PURE__ */ new Map();
    elementsToMeasure.forEach((element2) => {
      const removedTransforms = removeNonTranslationalTransform(element2);
      if (!removedTransforms.length)
        return;
      transformsToRestore.set(element2, removedTransforms);
      element2.render();
    });
    resolversToMeasure.forEach((resolver2) => resolver2.measureInitialState());
    elementsToMeasure.forEach((element2) => {
      element2.render();
      const restore = transformsToRestore.get(element2);
      if (restore) {
        restore.forEach(([key, value2]) => {
          var _a2;
          (_a2 = element2.getValue(key)) === null || _a2 === void 0 ? void 0 : _a2.set(value2);
        });
      }
    });
    resolversToMeasure.forEach((resolver2) => resolver2.measureEndState());
    resolversToMeasure.forEach((resolver2) => {
      if (resolver2.suspendedScrollY !== void 0) {
        window.scrollTo(0, resolver2.suspendedScrollY);
      }
    });
  }
  anyNeedsMeasurement = false;
  isScheduled = false;
  toResolve.forEach((resolver2) => resolver2.complete());
  toResolve.clear();
}
function readAllKeyframes() {
  toResolve.forEach((resolver2) => {
    resolver2.readKeyframes();
    if (resolver2.needsMeasurement) {
      anyNeedsMeasurement = true;
    }
  });
}
function flushKeyframeResolvers() {
  readAllKeyframes();
  measureAllKeyframes();
}
class KeyframeResolver {
  constructor(unresolvedKeyframes, onComplete, name2, motionValue2, element2, isAsync = false) {
    this.isComplete = false;
    this.isAsync = false;
    this.needsMeasurement = false;
    this.isScheduled = false;
    this.unresolvedKeyframes = [...unresolvedKeyframes];
    this.onComplete = onComplete;
    this.name = name2;
    this.motionValue = motionValue2;
    this.element = element2;
    this.isAsync = isAsync;
  }
  scheduleResolve() {
    this.isScheduled = true;
    if (this.isAsync) {
      toResolve.add(this);
      if (!isScheduled) {
        isScheduled = true;
        frame.read(readAllKeyframes);
        frame.resolveKeyframes(measureAllKeyframes);
      }
    } else {
      this.readKeyframes();
      this.complete();
    }
  }
  readKeyframes() {
    const { unresolvedKeyframes, name: name2, element: element2, motionValue: motionValue2 } = this;
    for (let i2 = 0; i2 < unresolvedKeyframes.length; i2++) {
      if (unresolvedKeyframes[i2] === null) {
        if (i2 === 0) {
          const currentValue = motionValue2 === null || motionValue2 === void 0 ? void 0 : motionValue2.get();
          const finalKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
          if (currentValue !== void 0) {
            unresolvedKeyframes[0] = currentValue;
          } else if (element2 && name2) {
            const valueAsRead = element2.readValue(name2, finalKeyframe);
            if (valueAsRead !== void 0 && valueAsRead !== null) {
              unresolvedKeyframes[0] = valueAsRead;
            }
          }
          if (unresolvedKeyframes[0] === void 0) {
            unresolvedKeyframes[0] = finalKeyframe;
          }
          if (motionValue2 && currentValue === void 0) {
            motionValue2.set(unresolvedKeyframes[0]);
          }
        } else {
          unresolvedKeyframes[i2] = unresolvedKeyframes[i2 - 1];
        }
      }
    }
  }
  setFinalKeyframe() {
  }
  measureInitialState() {
  }
  renderEndStyles() {
  }
  measureEndState() {
  }
  complete() {
    this.isComplete = true;
    this.onComplete(this.unresolvedKeyframes, this.finalKeyframe);
    toResolve.delete(this);
  }
  cancel() {
    if (!this.isComplete) {
      this.isScheduled = false;
      toResolve.delete(this);
    }
  }
  resume() {
    if (!this.isComplete)
      this.scheduleResolve();
  }
}
const isNumericalString = (v2) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(v2);
const splitCSSVariableRegex = (
  // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
  /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u
);
function parseCSSVariable(current) {
  const match5 = splitCSSVariableRegex.exec(current);
  if (!match5)
    return [,];
  const [, token1, token2, fallback2] = match5;
  return [`--${token1 !== null && token1 !== void 0 ? token1 : token2}`, fallback2];
}
function getVariableValue(current, element2, depth = 1) {
  const [token2, fallback2] = parseCSSVariable(current);
  if (!token2)
    return;
  const resolved = window.getComputedStyle(element2).getPropertyValue(token2);
  if (resolved) {
    const trimmed = resolved.trim();
    return isNumericalString(trimmed) ? parseFloat(trimmed) : trimmed;
  }
  return isCSSVariableToken(fallback2) ? getVariableValue(fallback2, element2, depth + 1) : fallback2;
}
const testValueType = (v2) => (type4) => type4.test(v2);
const auto = {
  test: (v2) => v2 === "auto",
  parse: (v2) => v2
};
const dimensionValueTypes = [number$2, px, percent, degrees, vw, vh, auto];
const findDimensionValueType = (v2) => dimensionValueTypes.find(testValueType(v2));
class DOMKeyframesResolver extends KeyframeResolver {
  constructor(unresolvedKeyframes, onComplete, name2, motionValue2, element2) {
    super(unresolvedKeyframes, onComplete, name2, motionValue2, element2, true);
  }
  readKeyframes() {
    const { unresolvedKeyframes, element: element2, name: name2 } = this;
    if (!element2 || !element2.current)
      return;
    super.readKeyframes();
    for (let i2 = 0; i2 < unresolvedKeyframes.length; i2++) {
      let keyframe = unresolvedKeyframes[i2];
      if (typeof keyframe === "string") {
        keyframe = keyframe.trim();
        if (isCSSVariableToken(keyframe)) {
          const resolved = getVariableValue(keyframe, element2.current);
          if (resolved !== void 0) {
            unresolvedKeyframes[i2] = resolved;
          }
          if (i2 === unresolvedKeyframes.length - 1) {
            this.finalKeyframe = keyframe;
          }
        }
      }
    }
    this.resolveNoneKeyframes();
    if (!positionalKeys.has(name2) || unresolvedKeyframes.length !== 2) {
      return;
    }
    const [origin2, target] = unresolvedKeyframes;
    const originType = findDimensionValueType(origin2);
    const targetType = findDimensionValueType(target);
    if (originType === targetType)
      return;
    if (isNumOrPxType(originType) && isNumOrPxType(targetType)) {
      for (let i2 = 0; i2 < unresolvedKeyframes.length; i2++) {
        const value2 = unresolvedKeyframes[i2];
        if (typeof value2 === "string") {
          unresolvedKeyframes[i2] = parseFloat(value2);
        }
      }
    } else {
      this.needsMeasurement = true;
    }
  }
  resolveNoneKeyframes() {
    const { unresolvedKeyframes, name: name2 } = this;
    const noneKeyframeIndexes = [];
    for (let i2 = 0; i2 < unresolvedKeyframes.length; i2++) {
      if (isNone(unresolvedKeyframes[i2])) {
        noneKeyframeIndexes.push(i2);
      }
    }
    if (noneKeyframeIndexes.length) {
      makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name2);
    }
  }
  measureInitialState() {
    const { element: element2, unresolvedKeyframes, name: name2 } = this;
    if (!element2 || !element2.current)
      return;
    if (name2 === "height") {
      this.suspendedScrollY = window.pageYOffset;
    }
    this.measuredOrigin = positionalValues[name2](element2.measureViewportBox(), window.getComputedStyle(element2.current));
    unresolvedKeyframes[0] = this.measuredOrigin;
    const measureKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
    if (measureKeyframe !== void 0) {
      element2.getValue(name2, measureKeyframe).jump(measureKeyframe, false);
    }
  }
  measureEndState() {
    var _a2;
    const { element: element2, name: name2, unresolvedKeyframes } = this;
    if (!element2 || !element2.current)
      return;
    const value2 = element2.getValue(name2);
    value2 && value2.jump(this.measuredOrigin, false);
    const finalKeyframeIndex = unresolvedKeyframes.length - 1;
    const finalKeyframe = unresolvedKeyframes[finalKeyframeIndex];
    unresolvedKeyframes[finalKeyframeIndex] = positionalValues[name2](element2.measureViewportBox(), window.getComputedStyle(element2.current));
    if (finalKeyframe !== null && this.finalKeyframe === void 0) {
      this.finalKeyframe = finalKeyframe;
    }
    if ((_a2 = this.removedTransforms) === null || _a2 === void 0 ? void 0 : _a2.length) {
      this.removedTransforms.forEach(([unsetTransformName, unsetTransformValue]) => {
        element2.getValue(unsetTransformName).set(unsetTransformValue);
      });
    }
    this.resolveNoneKeyframes();
  }
}
const isAnimatable = (value2, name2) => {
  if (name2 === "zIndex")
    return false;
  if (typeof value2 === "number" || Array.isArray(value2))
    return true;
  if (typeof value2 === "string" && // It's animatable if we have a string
  (complex.test(value2) || value2 === "0") && // And it contains numbers and/or colors
  !value2.startsWith("url(")) {
    return true;
  }
  return false;
};
function hasKeyframesChanged(keyframes2) {
  const current = keyframes2[0];
  if (keyframes2.length === 1)
    return true;
  for (let i2 = 0; i2 < keyframes2.length; i2++) {
    if (keyframes2[i2] !== current)
      return true;
  }
}
function canAnimate(keyframes2, name2, type4, velocity) {
  const originKeyframe = keyframes2[0];
  if (originKeyframe === null)
    return false;
  if (name2 === "display" || name2 === "visibility")
    return true;
  const targetKeyframe = keyframes2[keyframes2.length - 1];
  const isOriginAnimatable = isAnimatable(originKeyframe, name2);
  const isTargetAnimatable = isAnimatable(targetKeyframe, name2);
  if (!isOriginAnimatable || !isTargetAnimatable) {
    return false;
  }
  return hasKeyframesChanged(keyframes2) || (type4 === "spring" || isGenerator(type4)) && velocity;
}
const isNotNull = (value2) => value2 !== null;
function getFinalKeyframe(keyframes2, { repeat, repeatType = "loop" }, finalKeyframe) {
  const resolvedKeyframes = keyframes2.filter(isNotNull);
  const index2 = repeat && repeatType !== "loop" && repeat % 2 === 1 ? 0 : resolvedKeyframes.length - 1;
  return !index2 || finalKeyframe === void 0 ? resolvedKeyframes[index2] : finalKeyframe;
}
const MAX_RESOLVE_DELAY = 40;
class BaseAnimation {
  constructor({ autoplay = true, delay: delay2 = 0, type: type4 = "keyframes", repeat = 0, repeatDelay = 0, repeatType = "loop", ...options }) {
    this.isStopped = false;
    this.hasAttemptedResolve = false;
    this.createdAt = time.now();
    this.options = {
      autoplay,
      delay: delay2,
      type: type4,
      repeat,
      repeatDelay,
      repeatType,
      ...options
    };
    this.updateFinishedPromise();
  }
  /**
   * This method uses the createdAt and resolvedAt to calculate the
   * animation startTime. *Ideally*, we would use the createdAt time as t=0
   * as the following frame would then be the first frame of the animation in
   * progress, which would feel snappier.
   *
   * However, if there's a delay (main thread work) between the creation of
   * the animation and the first commited frame, we prefer to use resolvedAt
   * to avoid a sudden jump into the animation.
   */
  calcStartTime() {
    if (!this.resolvedAt)
      return this.createdAt;
    return this.resolvedAt - this.createdAt > MAX_RESOLVE_DELAY ? this.resolvedAt : this.createdAt;
  }
  /**
   * A getter for resolved data. If keyframes are not yet resolved, accessing
   * this.resolved will synchronously flush all pending keyframe resolvers.
   * This is a deoptimisation, but at its worst still batches read/writes.
   */
  get resolved() {
    if (!this._resolved && !this.hasAttemptedResolve) {
      flushKeyframeResolvers();
    }
    return this._resolved;
  }
  /**
   * A method to be called when the keyframes resolver completes. This method
   * will check if its possible to run the animation and, if not, skip it.
   * Otherwise, it will call initPlayback on the implementing class.
   */
  onKeyframesResolved(keyframes2, finalKeyframe) {
    this.resolvedAt = time.now();
    this.hasAttemptedResolve = true;
    const { name: name2, type: type4, velocity, delay: delay2, onComplete, onUpdate, isGenerator: isGenerator2 } = this.options;
    if (!isGenerator2 && !canAnimate(keyframes2, name2, type4, velocity)) {
      if (instantAnimationState.current || !delay2) {
        onUpdate && onUpdate(getFinalKeyframe(keyframes2, this.options, finalKeyframe));
        onComplete && onComplete();
        this.resolveFinishedPromise();
        return;
      } else {
        this.options.duration = 0;
      }
    }
    const resolvedAnimation = this.initPlayback(keyframes2, finalKeyframe);
    if (resolvedAnimation === false)
      return;
    this._resolved = {
      keyframes: keyframes2,
      finalKeyframe,
      ...resolvedAnimation
    };
    this.onPostResolved();
  }
  onPostResolved() {
  }
  /**
   * Allows the returned animation to be awaited or promise-chained. Currently
   * resolves when the animation finishes at all but in a future update could/should
   * reject if its cancels.
   */
  then(resolve2, reject) {
    return this.currentFinishedPromise.then(resolve2, reject);
  }
  flatten() {
    this.options.type = "keyframes";
    this.options.ease = "linear";
  }
  updateFinishedPromise() {
    this.currentFinishedPromise = new Promise((resolve2) => {
      this.resolveFinishedPromise = resolve2;
    });
  }
}
const mixNumber$1 = (from2, to2, progress2) => {
  return from2 + (to2 - from2) * progress2;
};
function hueToRgb(p2, q2, t2) {
  if (t2 < 0)
    t2 += 1;
  if (t2 > 1)
    t2 -= 1;
  if (t2 < 1 / 6)
    return p2 + (q2 - p2) * 6 * t2;
  if (t2 < 1 / 2)
    return q2;
  if (t2 < 2 / 3)
    return p2 + (q2 - p2) * (2 / 3 - t2) * 6;
  return p2;
}
function hslaToRgba({ hue: hue2, saturation, lightness, alpha: alpha2 }) {
  hue2 /= 360;
  saturation /= 100;
  lightness /= 100;
  let red2 = 0;
  let green2 = 0;
  let blue2 = 0;
  if (!saturation) {
    red2 = green2 = blue2 = lightness;
  } else {
    const q2 = lightness < 0.5 ? lightness * (1 + saturation) : lightness + saturation - lightness * saturation;
    const p2 = 2 * lightness - q2;
    red2 = hueToRgb(p2, q2, hue2 + 1 / 3);
    green2 = hueToRgb(p2, q2, hue2);
    blue2 = hueToRgb(p2, q2, hue2 - 1 / 3);
  }
  return {
    red: Math.round(red2 * 255),
    green: Math.round(green2 * 255),
    blue: Math.round(blue2 * 255),
    alpha: alpha2
  };
}
function mixImmediate(a2, b2) {
  return (p2) => p2 > 0 ? b2 : a2;
}
const mixLinearColor = (from2, to2, v2) => {
  const fromExpo = from2 * from2;
  const expo = v2 * (to2 * to2 - fromExpo) + fromExpo;
  return expo < 0 ? 0 : Math.sqrt(expo);
};
const colorTypes = [hex$1, rgba, hsla];
const getColorType = (v2) => colorTypes.find((type4) => type4.test(v2));
function asRGBA(color2) {
  const type4 = getColorType(color2);
  if (!Boolean(type4))
    return false;
  let model = type4.parse(color2);
  if (type4 === hsla) {
    model = hslaToRgba(model);
  }
  return model;
}
const mixColor = (from2, to2) => {
  const fromRGBA = asRGBA(from2);
  const toRGBA = asRGBA(to2);
  if (!fromRGBA || !toRGBA) {
    return mixImmediate(from2, to2);
  }
  const blended = { ...fromRGBA };
  return (v2) => {
    blended.red = mixLinearColor(fromRGBA.red, toRGBA.red, v2);
    blended.green = mixLinearColor(fromRGBA.green, toRGBA.green, v2);
    blended.blue = mixLinearColor(fromRGBA.blue, toRGBA.blue, v2);
    blended.alpha = mixNumber$1(fromRGBA.alpha, toRGBA.alpha, v2);
    return rgba.transform(blended);
  };
};
const combineFunctions = (a2, b2) => (v2) => b2(a2(v2));
const pipe = (...transformers) => transformers.reduce(combineFunctions);
const invisibleValues = /* @__PURE__ */ new Set(["none", "hidden"]);
function mixVisibility(origin2, target) {
  if (invisibleValues.has(origin2)) {
    return (p2) => p2 <= 0 ? origin2 : target;
  } else {
    return (p2) => p2 >= 1 ? target : origin2;
  }
}
function mixNumber(a2, b2) {
  return (p2) => mixNumber$1(a2, b2, p2);
}
function getMixer(a2) {
  if (typeof a2 === "number") {
    return mixNumber;
  } else if (typeof a2 === "string") {
    return isCSSVariableToken(a2) ? mixImmediate : color$2.test(a2) ? mixColor : mixComplex;
  } else if (Array.isArray(a2)) {
    return mixArray;
  } else if (typeof a2 === "object") {
    return color$2.test(a2) ? mixColor : mixObject;
  }
  return mixImmediate;
}
function mixArray(a2, b2) {
  const output2 = [...a2];
  const numValues = output2.length;
  const blendValue = a2.map((v2, i2) => getMixer(v2)(v2, b2[i2]));
  return (p2) => {
    for (let i2 = 0; i2 < numValues; i2++) {
      output2[i2] = blendValue[i2](p2);
    }
    return output2;
  };
}
function mixObject(a2, b2) {
  const output2 = { ...a2, ...b2 };
  const blendValue = {};
  for (const key in output2) {
    if (a2[key] !== void 0 && b2[key] !== void 0) {
      blendValue[key] = getMixer(a2[key])(a2[key], b2[key]);
    }
  }
  return (v2) => {
    for (const key in blendValue) {
      output2[key] = blendValue[key](v2);
    }
    return output2;
  };
}
function matchOrder(origin2, target) {
  var _a2;
  const orderedOrigin = [];
  const pointers = { color: 0, var: 0, number: 0 };
  for (let i2 = 0; i2 < target.values.length; i2++) {
    const type4 = target.types[i2];
    const originIndex = origin2.indexes[type4][pointers[type4]];
    const originValue = (_a2 = origin2.values[originIndex]) !== null && _a2 !== void 0 ? _a2 : 0;
    orderedOrigin[i2] = originValue;
    pointers[type4]++;
  }
  return orderedOrigin;
}
const mixComplex = (origin2, target) => {
  const template2 = complex.createTransformer(target);
  const originStats = analyseComplexValue(origin2);
  const targetStats = analyseComplexValue(target);
  const canInterpolate = originStats.indexes.var.length === targetStats.indexes.var.length && originStats.indexes.color.length === targetStats.indexes.color.length && originStats.indexes.number.length >= targetStats.indexes.number.length;
  if (canInterpolate) {
    if (invisibleValues.has(origin2) && !targetStats.values.length || invisibleValues.has(target) && !originStats.values.length) {
      return mixVisibility(origin2, target);
    }
    return pipe(mixArray(matchOrder(originStats, targetStats), targetStats.values), template2);
  } else {
    return mixImmediate(origin2, target);
  }
};
function mix(from2, to2, p2) {
  if (typeof from2 === "number" && typeof to2 === "number" && typeof p2 === "number") {
    return mixNumber$1(from2, to2, p2);
  }
  const mixer = getMixer(from2);
  return mixer(from2, to2);
}
const velocitySampleDuration = 5;
function calcGeneratorVelocity(resolveValue, t2, current) {
  const prevT = Math.max(t2 - velocitySampleDuration, 0);
  return velocityPerSecond(current - resolveValue(prevT), t2 - prevT);
}
const springDefaults = {
  // Default spring physics
  stiffness: 100,
  damping: 10,
  mass: 1,
  velocity: 0,
  // Default duration/bounce-based options
  duration: 800,
  // in ms
  bounce: 0.3,
  visualDuration: 0.3,
  // in seconds
  // Rest thresholds
  restSpeed: {
    granular: 0.01,
    default: 2
  },
  restDelta: {
    granular: 5e-3,
    default: 0.5
  },
  // Limits
  minDuration: 0.01,
  // in seconds
  maxDuration: 10,
  // in seconds
  minDamping: 0.05,
  maxDamping: 1
};
const safeMin = 1e-3;
function findSpring({ duration: duration2 = springDefaults.duration, bounce = springDefaults.bounce, velocity = springDefaults.velocity, mass = springDefaults.mass }) {
  let envelope;
  let derivative2;
  let dampingRatio = 1 - bounce;
  dampingRatio = clamp$1(springDefaults.minDamping, springDefaults.maxDamping, dampingRatio);
  duration2 = clamp$1(springDefaults.minDuration, springDefaults.maxDuration, /* @__PURE__ */ millisecondsToSeconds(duration2));
  if (dampingRatio < 1) {
    envelope = (undampedFreq2) => {
      const exponentialDecay = undampedFreq2 * dampingRatio;
      const delta = exponentialDecay * duration2;
      const a2 = exponentialDecay - velocity;
      const b2 = calcAngularFreq(undampedFreq2, dampingRatio);
      const c2 = Math.exp(-delta);
      return safeMin - a2 / b2 * c2;
    };
    derivative2 = (undampedFreq2) => {
      const exponentialDecay = undampedFreq2 * dampingRatio;
      const delta = exponentialDecay * duration2;
      const d2 = delta * velocity + velocity;
      const e2 = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq2, 2) * duration2;
      const f2 = Math.exp(-delta);
      const g2 = calcAngularFreq(Math.pow(undampedFreq2, 2), dampingRatio);
      const factor = -envelope(undampedFreq2) + safeMin > 0 ? -1 : 1;
      return factor * ((d2 - e2) * f2) / g2;
    };
  } else {
    envelope = (undampedFreq2) => {
      const a2 = Math.exp(-undampedFreq2 * duration2);
      const b2 = (undampedFreq2 - velocity) * duration2 + 1;
      return -safeMin + a2 * b2;
    };
    derivative2 = (undampedFreq2) => {
      const a2 = Math.exp(-undampedFreq2 * duration2);
      const b2 = (velocity - undampedFreq2) * (duration2 * duration2);
      return a2 * b2;
    };
  }
  const initialGuess = 5 / duration2;
  const undampedFreq = approximateRoot(envelope, derivative2, initialGuess);
  duration2 = /* @__PURE__ */ secondsToMilliseconds(duration2);
  if (isNaN(undampedFreq)) {
    return {
      stiffness: springDefaults.stiffness,
      damping: springDefaults.damping,
      duration: duration2
    };
  } else {
    const stiffness = Math.pow(undampedFreq, 2) * mass;
    return {
      stiffness,
      damping: dampingRatio * 2 * Math.sqrt(mass * stiffness),
      duration: duration2
    };
  }
}
const rootIterations = 12;
function approximateRoot(envelope, derivative2, initialGuess) {
  let result = initialGuess;
  for (let i2 = 1; i2 < rootIterations; i2++) {
    result = result - envelope(result) / derivative2(result);
  }
  return result;
}
function calcAngularFreq(undampedFreq, dampingRatio) {
  return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
}
const durationKeys = ["duration", "bounce"];
const physicsKeys = ["stiffness", "damping", "mass"];
function isSpringType(options, keys2) {
  return keys2.some((key) => options[key] !== void 0);
}
function getSpringOptions(options) {
  let springOptions = {
    velocity: springDefaults.velocity,
    stiffness: springDefaults.stiffness,
    damping: springDefaults.damping,
    mass: springDefaults.mass,
    isResolvedFromDuration: false,
    ...options
  };
  if (!isSpringType(options, physicsKeys) && isSpringType(options, durationKeys)) {
    if (options.visualDuration) {
      const visualDuration = options.visualDuration;
      const root2 = 2 * Math.PI / (visualDuration * 1.2);
      const stiffness = root2 * root2;
      const damping = 2 * clamp$1(0.05, 1, 1 - (options.bounce || 0)) * Math.sqrt(stiffness);
      springOptions = {
        ...springOptions,
        mass: springDefaults.mass,
        stiffness,
        damping
      };
    } else {
      const derived = findSpring(options);
      springOptions = {
        ...springOptions,
        ...derived,
        mass: springDefaults.mass
      };
      springOptions.isResolvedFromDuration = true;
    }
  }
  return springOptions;
}
function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce = springDefaults.bounce) {
  const options = typeof optionsOrVisualDuration !== "object" ? {
    visualDuration: optionsOrVisualDuration,
    keyframes: [0, 1],
    bounce
  } : optionsOrVisualDuration;
  let { restSpeed, restDelta } = options;
  const origin2 = options.keyframes[0];
  const target = options.keyframes[options.keyframes.length - 1];
  const state = { done: false, value: origin2 };
  const { stiffness, damping, mass, duration: duration2, velocity, isResolvedFromDuration } = getSpringOptions({
    ...options,
    velocity: -/* @__PURE__ */ millisecondsToSeconds(options.velocity || 0)
  });
  const initialVelocity = velocity || 0;
  const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));
  const initialDelta = target - origin2;
  const undampedAngularFreq = /* @__PURE__ */ millisecondsToSeconds(Math.sqrt(stiffness / mass));
  const isGranularScale = Math.abs(initialDelta) < 5;
  restSpeed || (restSpeed = isGranularScale ? springDefaults.restSpeed.granular : springDefaults.restSpeed.default);
  restDelta || (restDelta = isGranularScale ? springDefaults.restDelta.granular : springDefaults.restDelta.default);
  let resolveSpring;
  if (dampingRatio < 1) {
    const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
    resolveSpring = (t2) => {
      const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t2);
      return target - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) / angularFreq * Math.sin(angularFreq * t2) + initialDelta * Math.cos(angularFreq * t2));
    };
  } else if (dampingRatio === 1) {
    resolveSpring = (t2) => target - Math.exp(-undampedAngularFreq * t2) * (initialDelta + (initialVelocity + undampedAngularFreq * initialDelta) * t2);
  } else {
    const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);
    resolveSpring = (t2) => {
      const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t2);
      const freqForT = Math.min(dampedAngularFreq * t2, 300);
      return target - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) * Math.sinh(freqForT) + dampedAngularFreq * initialDelta * Math.cosh(freqForT)) / dampedAngularFreq;
    };
  }
  const generator = {
    calculatedDuration: isResolvedFromDuration ? duration2 || null : null,
    next: (t2) => {
      const current = resolveSpring(t2);
      if (!isResolvedFromDuration) {
        let currentVelocity = 0;
        if (dampingRatio < 1) {
          currentVelocity = t2 === 0 ? /* @__PURE__ */ secondsToMilliseconds(initialVelocity) : calcGeneratorVelocity(resolveSpring, t2, current);
        }
        const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;
        const isBelowDisplacementThreshold = Math.abs(target - current) <= restDelta;
        state.done = isBelowVelocityThreshold && isBelowDisplacementThreshold;
      } else {
        state.done = t2 >= duration2;
      }
      state.value = state.done ? target : current;
      return state;
    },
    toString: () => {
      const calculatedDuration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);
      const easing = generateLinearEasing((progress2) => generator.next(calculatedDuration * progress2).value, calculatedDuration, 30);
      return calculatedDuration + "ms " + easing;
    }
  };
  return generator;
}
function inertia({ keyframes: keyframes2, velocity = 0, power = 0.8, timeConstant = 325, bounceDamping = 10, bounceStiffness = 500, modifyTarget, min: min2, max: max2, restDelta = 0.5, restSpeed }) {
  const origin2 = keyframes2[0];
  const state = {
    done: false,
    value: origin2
  };
  const isOutOfBounds = (v2) => min2 !== void 0 && v2 < min2 || max2 !== void 0 && v2 > max2;
  const nearestBoundary = (v2) => {
    if (min2 === void 0)
      return max2;
    if (max2 === void 0)
      return min2;
    return Math.abs(min2 - v2) < Math.abs(max2 - v2) ? min2 : max2;
  };
  let amplitude = power * velocity;
  const ideal = origin2 + amplitude;
  const target = modifyTarget === void 0 ? ideal : modifyTarget(ideal);
  if (target !== ideal)
    amplitude = target - origin2;
  const calcDelta = (t2) => -amplitude * Math.exp(-t2 / timeConstant);
  const calcLatest = (t2) => target + calcDelta(t2);
  const applyFriction = (t2) => {
    const delta = calcDelta(t2);
    const latest = calcLatest(t2);
    state.done = Math.abs(delta) <= restDelta;
    state.value = state.done ? target : latest;
  };
  let timeReachedBoundary;
  let spring$1;
  const checkCatchBoundary = (t2) => {
    if (!isOutOfBounds(state.value))
      return;
    timeReachedBoundary = t2;
    spring$1 = spring({
      keyframes: [state.value, nearestBoundary(state.value)],
      velocity: calcGeneratorVelocity(calcLatest, t2, state.value),
      // TODO: This should be passing * 1000
      damping: bounceDamping,
      stiffness: bounceStiffness,
      restDelta,
      restSpeed
    });
  };
  checkCatchBoundary(0);
  return {
    calculatedDuration: null,
    next: (t2) => {
      let hasUpdatedFrame = false;
      if (!spring$1 && timeReachedBoundary === void 0) {
        hasUpdatedFrame = true;
        applyFriction(t2);
        checkCatchBoundary(t2);
      }
      if (timeReachedBoundary !== void 0 && t2 >= timeReachedBoundary) {
        return spring$1.next(t2 - timeReachedBoundary);
      } else {
        !hasUpdatedFrame && applyFriction(t2);
        return state;
      }
    }
  };
}
const easeIn = /* @__PURE__ */ cubicBezier(0.42, 0, 1, 1);
const easeOut = /* @__PURE__ */ cubicBezier(0, 0, 0.58, 1);
const easeInOut = /* @__PURE__ */ cubicBezier(0.42, 0, 0.58, 1);
const isEasingArray = (ease2) => {
  return Array.isArray(ease2) && typeof ease2[0] !== "number";
};
const easingLookup = {
  linear: noop$9,
  easeIn,
  easeInOut,
  easeOut,
  circIn,
  circInOut,
  circOut,
  backIn,
  backInOut,
  backOut,
  anticipate
};
const easingDefinitionToFunction = (definition2) => {
  if (isBezierDefinition(definition2)) {
    invariant$2(definition2.length === 4);
    const [x1, y1, x2, y2] = definition2;
    return cubicBezier(x1, y1, x2, y2);
  } else if (typeof definition2 === "string") {
    return easingLookup[definition2];
  }
  return definition2;
};
function createMixers(output2, ease2, customMixer) {
  const mixers = [];
  const mixerFactory = customMixer || mix;
  const numMixers = output2.length - 1;
  for (let i2 = 0; i2 < numMixers; i2++) {
    let mixer = mixerFactory(output2[i2], output2[i2 + 1]);
    if (ease2) {
      const easingFunction = Array.isArray(ease2) ? ease2[i2] || noop$9 : ease2;
      mixer = pipe(easingFunction, mixer);
    }
    mixers.push(mixer);
  }
  return mixers;
}
function interpolate$2(input2, output2, { clamp: isClamp = true, ease: ease2, mixer } = {}) {
  const inputLength = input2.length;
  invariant$2(inputLength === output2.length);
  if (inputLength === 1)
    return () => output2[0];
  if (inputLength === 2 && output2[0] === output2[1])
    return () => output2[1];
  const isZeroDeltaRange = input2[0] === input2[1];
  if (input2[0] > input2[inputLength - 1]) {
    input2 = [...input2].reverse();
    output2 = [...output2].reverse();
  }
  const mixers = createMixers(output2, ease2, mixer);
  const numMixers = mixers.length;
  const interpolator = (v2) => {
    if (isZeroDeltaRange && v2 < input2[0])
      return output2[0];
    let i2 = 0;
    if (numMixers > 1) {
      for (; i2 < input2.length - 2; i2++) {
        if (v2 < input2[i2 + 1])
          break;
      }
    }
    const progressInRange = /* @__PURE__ */ progress$1(input2[i2], input2[i2 + 1], v2);
    return mixers[i2](progressInRange);
  };
  return isClamp ? (v2) => interpolator(clamp$1(input2[0], input2[inputLength - 1], v2)) : interpolator;
}
function fillOffset(offset2, remaining) {
  const min2 = offset2[offset2.length - 1];
  for (let i2 = 1; i2 <= remaining; i2++) {
    const offsetProgress = /* @__PURE__ */ progress$1(0, remaining, i2);
    offset2.push(mixNumber$1(min2, 1, offsetProgress));
  }
}
function defaultOffset(arr) {
  const offset2 = [0];
  fillOffset(offset2, arr.length - 1);
  return offset2;
}
function convertOffsetToTimes(offset2, duration2) {
  return offset2.map((o2) => o2 * duration2);
}
function defaultEasing(values, easing) {
  return values.map(() => easing || easeInOut).splice(0, values.length - 1);
}
function keyframes({ duration: duration2 = 300, keyframes: keyframeValues, times, ease: ease2 = "easeInOut" }) {
  const easingFunctions = isEasingArray(ease2) ? ease2.map(easingDefinitionToFunction) : easingDefinitionToFunction(ease2);
  const state = {
    done: false,
    value: keyframeValues[0]
  };
  const absoluteTimes = convertOffsetToTimes(
    // Only use the provided offsets if they're the correct length
    // TODO Maybe we should warn here if there's a length mismatch
    times && times.length === keyframeValues.length ? times : defaultOffset(keyframeValues),
    duration2
  );
  const mapTimeToKeyframe = interpolate$2(absoluteTimes, keyframeValues, {
    ease: Array.isArray(easingFunctions) ? easingFunctions : defaultEasing(keyframeValues, easingFunctions)
  });
  return {
    calculatedDuration: duration2,
    next: (t2) => {
      state.value = mapTimeToKeyframe(t2);
      state.done = t2 >= duration2;
      return state;
    }
  };
}
const frameloopDriver = (update) => {
  const passTimestamp = ({ timestamp }) => update(timestamp);
  return {
    start: () => frame.update(passTimestamp, true),
    stop: () => cancelFrame(passTimestamp),
    /**
     * If we're processing this frame we can use the
     * framelocked timestamp to keep things in sync.
     */
    now: () => frameData.isProcessing ? frameData.timestamp : time.now()
  };
};
const generators = {
  decay: inertia,
  inertia,
  tween: keyframes,
  keyframes,
  spring
};
const percentToProgress = (percent2) => percent2 / 100;
class MainThreadAnimation extends BaseAnimation {
  constructor(options) {
    super(options);
    this.holdTime = null;
    this.cancelTime = null;
    this.currentTime = 0;
    this.playbackSpeed = 1;
    this.pendingPlayState = "running";
    this.startTime = null;
    this.state = "idle";
    this.stop = () => {
      this.resolver.cancel();
      this.isStopped = true;
      if (this.state === "idle")
        return;
      this.teardown();
      const { onStop } = this.options;
      onStop && onStop();
    };
    const { name: name2, motionValue: motionValue2, element: element2, keyframes: keyframes2 } = this.options;
    const KeyframeResolver$1 = (element2 === null || element2 === void 0 ? void 0 : element2.KeyframeResolver) || KeyframeResolver;
    const onResolved = (resolvedKeyframes, finalKeyframe) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe);
    this.resolver = new KeyframeResolver$1(keyframes2, onResolved, name2, motionValue2, element2);
    this.resolver.scheduleResolve();
  }
  flatten() {
    super.flatten();
    if (this._resolved) {
      Object.assign(this._resolved, this.initPlayback(this._resolved.keyframes));
    }
  }
  initPlayback(keyframes$1) {
    const { type: type4 = "keyframes", repeat = 0, repeatDelay = 0, repeatType, velocity = 0 } = this.options;
    const generatorFactory = isGenerator(type4) ? type4 : generators[type4] || keyframes;
    let mapPercentToKeyframes;
    let mirroredGenerator;
    if (generatorFactory !== keyframes && typeof keyframes$1[0] !== "number") {
      mapPercentToKeyframes = pipe(percentToProgress, mix(keyframes$1[0], keyframes$1[1]));
      keyframes$1 = [0, 100];
    }
    const generator = generatorFactory({ ...this.options, keyframes: keyframes$1 });
    if (repeatType === "mirror") {
      mirroredGenerator = generatorFactory({
        ...this.options,
        keyframes: [...keyframes$1].reverse(),
        velocity: -velocity
      });
    }
    if (generator.calculatedDuration === null) {
      generator.calculatedDuration = calcGeneratorDuration(generator);
    }
    const { calculatedDuration } = generator;
    const resolvedDuration = calculatedDuration + repeatDelay;
    const totalDuration = resolvedDuration * (repeat + 1) - repeatDelay;
    return {
      generator,
      mirroredGenerator,
      mapPercentToKeyframes,
      calculatedDuration,
      resolvedDuration,
      totalDuration
    };
  }
  onPostResolved() {
    const { autoplay = true } = this.options;
    this.play();
    if (this.pendingPlayState === "paused" || !autoplay) {
      this.pause();
    } else {
      this.state = this.pendingPlayState;
    }
  }
  tick(timestamp, sample2 = false) {
    const { resolved } = this;
    if (!resolved) {
      const { keyframes: keyframes3 } = this.options;
      return { done: true, value: keyframes3[keyframes3.length - 1] };
    }
    const { finalKeyframe, generator, mirroredGenerator, mapPercentToKeyframes, keyframes: keyframes2, calculatedDuration, totalDuration, resolvedDuration } = resolved;
    if (this.startTime === null)
      return generator.next(0);
    const { delay: delay2, repeat, repeatType, repeatDelay, onUpdate } = this.options;
    if (this.speed > 0) {
      this.startTime = Math.min(this.startTime, timestamp);
    } else if (this.speed < 0) {
      this.startTime = Math.min(timestamp - totalDuration / this.speed, this.startTime);
    }
    if (sample2) {
      this.currentTime = timestamp;
    } else if (this.holdTime !== null) {
      this.currentTime = this.holdTime;
    } else {
      this.currentTime = Math.round(timestamp - this.startTime) * this.speed;
    }
    const timeWithoutDelay = this.currentTime - delay2 * (this.speed >= 0 ? 1 : -1);
    const isInDelayPhase = this.speed >= 0 ? timeWithoutDelay < 0 : timeWithoutDelay > totalDuration;
    this.currentTime = Math.max(timeWithoutDelay, 0);
    if (this.state === "finished" && this.holdTime === null) {
      this.currentTime = totalDuration;
    }
    let elapsed = this.currentTime;
    let frameGenerator = generator;
    if (repeat) {
      const progress2 = Math.min(this.currentTime, totalDuration) / resolvedDuration;
      let currentIteration = Math.floor(progress2);
      let iterationProgress = progress2 % 1;
      if (!iterationProgress && progress2 >= 1) {
        iterationProgress = 1;
      }
      iterationProgress === 1 && currentIteration--;
      currentIteration = Math.min(currentIteration, repeat + 1);
      const isOddIteration = Boolean(currentIteration % 2);
      if (isOddIteration) {
        if (repeatType === "reverse") {
          iterationProgress = 1 - iterationProgress;
          if (repeatDelay) {
            iterationProgress -= repeatDelay / resolvedDuration;
          }
        } else if (repeatType === "mirror") {
          frameGenerator = mirroredGenerator;
        }
      }
      elapsed = clamp$1(0, 1, iterationProgress) * resolvedDuration;
    }
    const state = isInDelayPhase ? { done: false, value: keyframes2[0] } : frameGenerator.next(elapsed);
    if (mapPercentToKeyframes) {
      state.value = mapPercentToKeyframes(state.value);
    }
    let { done } = state;
    if (!isInDelayPhase && calculatedDuration !== null) {
      done = this.speed >= 0 ? this.currentTime >= totalDuration : this.currentTime <= 0;
    }
    const isAnimationFinished = this.holdTime === null && (this.state === "finished" || this.state === "running" && done);
    if (isAnimationFinished && finalKeyframe !== void 0) {
      state.value = getFinalKeyframe(keyframes2, this.options, finalKeyframe);
    }
    if (onUpdate) {
      onUpdate(state.value);
    }
    if (isAnimationFinished) {
      this.finish();
    }
    return state;
  }
  get duration() {
    const { resolved } = this;
    return resolved ? /* @__PURE__ */ millisecondsToSeconds(resolved.calculatedDuration) : 0;
  }
  get time() {
    return /* @__PURE__ */ millisecondsToSeconds(this.currentTime);
  }
  set time(newTime) {
    newTime = /* @__PURE__ */ secondsToMilliseconds(newTime);
    this.currentTime = newTime;
    if (this.holdTime !== null || this.speed === 0) {
      this.holdTime = newTime;
    } else if (this.driver) {
      this.startTime = this.driver.now() - newTime / this.speed;
    }
  }
  get speed() {
    return this.playbackSpeed;
  }
  set speed(newSpeed) {
    const hasChanged = this.playbackSpeed !== newSpeed;
    this.playbackSpeed = newSpeed;
    if (hasChanged) {
      this.time = /* @__PURE__ */ millisecondsToSeconds(this.currentTime);
    }
  }
  play() {
    if (!this.resolver.isScheduled) {
      this.resolver.resume();
    }
    if (!this._resolved) {
      this.pendingPlayState = "running";
      return;
    }
    if (this.isStopped)
      return;
    const { driver = frameloopDriver, onPlay, startTime } = this.options;
    if (!this.driver) {
      this.driver = driver((timestamp) => this.tick(timestamp));
    }
    onPlay && onPlay();
    const now2 = this.driver.now();
    if (this.holdTime !== null) {
      this.startTime = now2 - this.holdTime;
    } else if (!this.startTime) {
      this.startTime = startTime !== null && startTime !== void 0 ? startTime : this.calcStartTime();
    } else if (this.state === "finished") {
      this.startTime = now2;
    }
    if (this.state === "finished") {
      this.updateFinishedPromise();
    }
    this.cancelTime = this.startTime;
    this.holdTime = null;
    this.state = "running";
    this.driver.start();
  }
  pause() {
    var _a2;
    if (!this._resolved) {
      this.pendingPlayState = "paused";
      return;
    }
    this.state = "paused";
    this.holdTime = (_a2 = this.currentTime) !== null && _a2 !== void 0 ? _a2 : 0;
  }
  complete() {
    if (this.state !== "running") {
      this.play();
    }
    this.pendingPlayState = this.state = "finished";
    this.holdTime = null;
  }
  finish() {
    this.teardown();
    this.state = "finished";
    const { onComplete } = this.options;
    onComplete && onComplete();
  }
  cancel() {
    if (this.cancelTime !== null) {
      this.tick(this.cancelTime);
    }
    this.teardown();
    this.updateFinishedPromise();
  }
  teardown() {
    this.state = "idle";
    this.stopDriver();
    this.resolveFinishedPromise();
    this.updateFinishedPromise();
    this.startTime = this.cancelTime = null;
    this.resolver.cancel();
  }
  stopDriver() {
    if (!this.driver)
      return;
    this.driver.stop();
    this.driver = void 0;
  }
  sample(time2) {
    this.startTime = 0;
    return this.tick(time2, true);
  }
}
function animateValue(options) {
  return new MainThreadAnimation(options);
}
const acceleratedValues = /* @__PURE__ */ new Set([
  "opacity",
  "clipPath",
  "filter",
  "transform"
  // TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
  // or until we implement support for linear() easing.
  // "background-color"
]);
function startWaapiAnimation(element2, valueName, keyframes2, { delay: delay2 = 0, duration: duration2 = 300, repeat = 0, repeatType = "loop", ease: ease2 = "easeInOut", times } = {}) {
  const keyframeOptions = { [valueName]: keyframes2 };
  if (times)
    keyframeOptions.offset = times;
  const easing = mapEasingToNativeEasing(ease2, duration2);
  if (Array.isArray(easing))
    keyframeOptions.easing = easing;
  return element2.animate(keyframeOptions, {
    delay: delay2,
    duration: duration2,
    easing: !Array.isArray(easing) ? easing : "linear",
    fill: "both",
    iterations: repeat + 1,
    direction: repeatType === "reverse" ? "alternate" : "normal"
  });
}
const supportsWaapi = /* @__PURE__ */ memo$1(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
const sampleDelta = 10;
const maxDuration = 2e4;
function requiresPregeneratedKeyframes(options) {
  return isGenerator(options.type) || options.type === "spring" || !isWaapiSupportedEasing(options.ease);
}
function pregenerateKeyframes(keyframes2, options) {
  const sampleAnimation = new MainThreadAnimation({
    ...options,
    keyframes: keyframes2,
    repeat: 0,
    delay: 0,
    isGenerator: true
  });
  let state = { done: false, value: keyframes2[0] };
  const pregeneratedKeyframes = [];
  let t2 = 0;
  while (!state.done && t2 < maxDuration) {
    state = sampleAnimation.sample(t2);
    pregeneratedKeyframes.push(state.value);
    t2 += sampleDelta;
  }
  return {
    times: void 0,
    keyframes: pregeneratedKeyframes,
    duration: t2 - sampleDelta,
    ease: "linear"
  };
}
const unsupportedEasingFunctions = {
  anticipate,
  backInOut,
  circInOut
};
function isUnsupportedEase(key) {
  return key in unsupportedEasingFunctions;
}
class AcceleratedAnimation extends BaseAnimation {
  constructor(options) {
    super(options);
    const { name: name2, motionValue: motionValue2, element: element2, keyframes: keyframes2 } = this.options;
    this.resolver = new DOMKeyframesResolver(keyframes2, (resolvedKeyframes, finalKeyframe) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe), name2, motionValue2, element2);
    this.resolver.scheduleResolve();
  }
  initPlayback(keyframes2, finalKeyframe) {
    let { duration: duration2 = 300, times, ease: ease2, type: type4, motionValue: motionValue2, name: name2, startTime } = this.options;
    if (!motionValue2.owner || !motionValue2.owner.current) {
      return false;
    }
    if (typeof ease2 === "string" && supportsLinearEasing() && isUnsupportedEase(ease2)) {
      ease2 = unsupportedEasingFunctions[ease2];
    }
    if (requiresPregeneratedKeyframes(this.options)) {
      const { onComplete, onUpdate, motionValue: motionValue3, element: element2, ...options } = this.options;
      const pregeneratedAnimation = pregenerateKeyframes(keyframes2, options);
      keyframes2 = pregeneratedAnimation.keyframes;
      if (keyframes2.length === 1) {
        keyframes2[1] = keyframes2[0];
      }
      duration2 = pregeneratedAnimation.duration;
      times = pregeneratedAnimation.times;
      ease2 = pregeneratedAnimation.ease;
      type4 = "keyframes";
    }
    const animation = startWaapiAnimation(motionValue2.owner.current, name2, keyframes2, { ...this.options, duration: duration2, times, ease: ease2 });
    animation.startTime = startTime !== null && startTime !== void 0 ? startTime : this.calcStartTime();
    if (this.pendingTimeline) {
      attachTimeline(animation, this.pendingTimeline);
      this.pendingTimeline = void 0;
    } else {
      animation.onfinish = () => {
        const { onComplete } = this.options;
        motionValue2.set(getFinalKeyframe(keyframes2, this.options, finalKeyframe));
        onComplete && onComplete();
        this.cancel();
        this.resolveFinishedPromise();
      };
    }
    return {
      animation,
      duration: duration2,
      times,
      type: type4,
      ease: ease2,
      keyframes: keyframes2
    };
  }
  get duration() {
    const { resolved } = this;
    if (!resolved)
      return 0;
    const { duration: duration2 } = resolved;
    return /* @__PURE__ */ millisecondsToSeconds(duration2);
  }
  get time() {
    const { resolved } = this;
    if (!resolved)
      return 0;
    const { animation } = resolved;
    return /* @__PURE__ */ millisecondsToSeconds(animation.currentTime || 0);
  }
  set time(newTime) {
    const { resolved } = this;
    if (!resolved)
      return;
    const { animation } = resolved;
    animation.currentTime = /* @__PURE__ */ secondsToMilliseconds(newTime);
  }
  get speed() {
    const { resolved } = this;
    if (!resolved)
      return 1;
    const { animation } = resolved;
    return animation.playbackRate;
  }
  set speed(newSpeed) {
    const { resolved } = this;
    if (!resolved)
      return;
    const { animation } = resolved;
    animation.playbackRate = newSpeed;
  }
  get state() {
    const { resolved } = this;
    if (!resolved)
      return "idle";
    const { animation } = resolved;
    return animation.playState;
  }
  get startTime() {
    const { resolved } = this;
    if (!resolved)
      return null;
    const { animation } = resolved;
    return animation.startTime;
  }
  /**
   * Replace the default DocumentTimeline with another AnimationTimeline.
   * Currently used for scroll animations.
   */
  attachTimeline(timeline) {
    if (!this._resolved) {
      this.pendingTimeline = timeline;
    } else {
      const { resolved } = this;
      if (!resolved)
        return noop$9;
      const { animation } = resolved;
      attachTimeline(animation, timeline);
    }
    return noop$9;
  }
  play() {
    if (this.isStopped)
      return;
    const { resolved } = this;
    if (!resolved)
      return;
    const { animation } = resolved;
    if (animation.playState === "finished") {
      this.updateFinishedPromise();
    }
    animation.play();
  }
  pause() {
    const { resolved } = this;
    if (!resolved)
      return;
    const { animation } = resolved;
    animation.pause();
  }
  stop() {
    this.resolver.cancel();
    this.isStopped = true;
    if (this.state === "idle")
      return;
    this.resolveFinishedPromise();
    this.updateFinishedPromise();
    const { resolved } = this;
    if (!resolved)
      return;
    const { animation, keyframes: keyframes2, duration: duration2, type: type4, ease: ease2, times } = resolved;
    if (animation.playState === "idle" || animation.playState === "finished") {
      return;
    }
    if (this.time) {
      const { motionValue: motionValue2, onUpdate, onComplete, element: element2, ...options } = this.options;
      const sampleAnimation = new MainThreadAnimation({
        ...options,
        keyframes: keyframes2,
        duration: duration2,
        type: type4,
        ease: ease2,
        times,
        isGenerator: true
      });
      const sampleTime = /* @__PURE__ */ secondsToMilliseconds(this.time);
      motionValue2.setWithVelocity(sampleAnimation.sample(sampleTime - sampleDelta).value, sampleAnimation.sample(sampleTime).value, sampleDelta);
    }
    const { onStop } = this.options;
    onStop && onStop();
    this.cancel();
  }
  complete() {
    const { resolved } = this;
    if (!resolved)
      return;
    resolved.animation.finish();
  }
  cancel() {
    const { resolved } = this;
    if (!resolved)
      return;
    resolved.animation.cancel();
  }
  static supports(options) {
    const { motionValue: motionValue2, name: name2, repeatDelay, repeatType, damping, type: type4 } = options;
    if (!motionValue2 || !motionValue2.owner || !(motionValue2.owner.current instanceof HTMLElement)) {
      return false;
    }
    const { onUpdate, transformTemplate } = motionValue2.owner.getProps();
    return supportsWaapi() && name2 && acceleratedValues.has(name2) && /**
     * If we're outputting values to onUpdate then we can't use WAAPI as there's
     * no way to read the value from WAAPI every frame.
     */
    !onUpdate && !transformTemplate && !repeatDelay && repeatType !== "mirror" && damping !== 0 && type4 !== "inertia";
  }
}
const underDampedSpring = {
  type: "spring",
  stiffness: 500,
  damping: 25,
  restSpeed: 10
};
const criticallyDampedSpring = (target) => ({
  type: "spring",
  stiffness: 550,
  damping: target === 0 ? 2 * Math.sqrt(550) : 30,
  restSpeed: 10
});
const keyframesTransition = {
  type: "keyframes",
  duration: 0.8
};
const ease = {
  type: "keyframes",
  ease: [0.25, 0.1, 0.35, 1],
  duration: 0.3
};
const getDefaultTransition = (valueKey, { keyframes: keyframes2 }) => {
  if (keyframes2.length > 2) {
    return keyframesTransition;
  } else if (transformProps.has(valueKey)) {
    return valueKey.startsWith("scale") ? criticallyDampedSpring(keyframes2[1]) : underDampedSpring;
  }
  return ease;
};
function isTransitionDefined({ when, delay: _delay, delayChildren, staggerChildren, staggerDirection, repeat, repeatType, repeatDelay, from: from2, elapsed, ...transition3 }) {
  return !!Object.keys(transition3).length;
}
const animateMotionValue = (name2, value2, target, transition3 = {}, element2, isHandoff) => (onComplete) => {
  const valueTransition = getValueTransition(transition3, name2) || {};
  const delay2 = valueTransition.delay || transition3.delay || 0;
  let { elapsed = 0 } = transition3;
  elapsed = elapsed - /* @__PURE__ */ secondsToMilliseconds(delay2);
  let options = {
    keyframes: Array.isArray(target) ? target : [null, target],
    ease: "easeOut",
    velocity: value2.getVelocity(),
    ...valueTransition,
    delay: -elapsed,
    onUpdate: (v2) => {
      value2.set(v2);
      valueTransition.onUpdate && valueTransition.onUpdate(v2);
    },
    onComplete: () => {
      onComplete();
      valueTransition.onComplete && valueTransition.onComplete();
    },
    name: name2,
    motionValue: value2,
    element: isHandoff ? void 0 : element2
  };
  if (!isTransitionDefined(valueTransition)) {
    options = {
      ...options,
      ...getDefaultTransition(name2, options)
    };
  }
  if (options.duration) {
    options.duration = /* @__PURE__ */ secondsToMilliseconds(options.duration);
  }
  if (options.repeatDelay) {
    options.repeatDelay = /* @__PURE__ */ secondsToMilliseconds(options.repeatDelay);
  }
  if (options.from !== void 0) {
    options.keyframes[0] = options.from;
  }
  let shouldSkip2 = false;
  if (options.type === false || options.duration === 0 && !options.repeatDelay) {
    options.duration = 0;
    if (options.delay === 0) {
      shouldSkip2 = true;
    }
  }
  if (instantAnimationState.current || MotionGlobalConfig.skipAnimations) {
    shouldSkip2 = true;
    options.duration = 0;
    options.delay = 0;
  }
  if (shouldSkip2 && !isHandoff && value2.get() !== void 0) {
    const finalKeyframe = getFinalKeyframe(options.keyframes, valueTransition);
    if (finalKeyframe !== void 0) {
      frame.update(() => {
        options.onUpdate(finalKeyframe);
        options.onComplete();
      });
      return new GroupPlaybackControls([]);
    }
  }
  if (!isHandoff && AcceleratedAnimation.supports(options)) {
    return new AcceleratedAnimation(options);
  } else {
    return new MainThreadAnimation(options);
  }
};
function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {
  const shouldBlock = protectedKeys.hasOwnProperty(key) && needsAnimating[key] !== true;
  needsAnimating[key] = false;
  return shouldBlock;
}
function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0, transitionOverride, type: type4 } = {}) {
  var _a2;
  let { transition: transition3 = visualElement.getDefaultTransition(), transitionEnd, ...target } = targetAndTransition;
  if (transitionOverride)
    transition3 = transitionOverride;
  const animations2 = [];
  const animationTypeState = type4 && visualElement.animationState && visualElement.animationState.getState()[type4];
  for (const key in target) {
    const value2 = visualElement.getValue(key, (_a2 = visualElement.latestValues[key]) !== null && _a2 !== void 0 ? _a2 : null);
    const valueTarget = target[key];
    if (valueTarget === void 0 || animationTypeState && shouldBlockAnimation(animationTypeState, key)) {
      continue;
    }
    const valueTransition = {
      delay: delay2,
      ...getValueTransition(transition3 || {}, key)
    };
    let isHandoff = false;
    if (window.MotionHandoffAnimation) {
      const appearId = getOptimisedAppearId(visualElement);
      if (appearId) {
        const startTime = window.MotionHandoffAnimation(appearId, key, frame);
        if (startTime !== null) {
          valueTransition.startTime = startTime;
          isHandoff = true;
        }
      }
    }
    addValueToWillChange(visualElement, key);
    value2.start(animateMotionValue(key, value2, valueTarget, visualElement.shouldReduceMotion && positionalKeys.has(key) ? { type: false } : valueTransition, visualElement, isHandoff));
    const animation = value2.animation;
    if (animation) {
      animations2.push(animation);
    }
  }
  if (transitionEnd) {
    Promise.all(animations2).then(() => {
      frame.update(() => {
        transitionEnd && setTarget(visualElement, transitionEnd);
      });
    });
  }
  return animations2;
}
function animateVariant(visualElement, variant, options = {}) {
  var _a2;
  const resolved = resolveVariant(visualElement, variant, options.type === "exit" ? (_a2 = visualElement.presenceContext) === null || _a2 === void 0 ? void 0 : _a2.custom : void 0);
  let { transition: transition3 = visualElement.getDefaultTransition() || {} } = resolved || {};
  if (options.transitionOverride) {
    transition3 = options.transitionOverride;
  }
  const getAnimation = resolved ? () => Promise.all(animateTarget(visualElement, resolved, options)) : () => Promise.resolve();
  const getChildAnimations = visualElement.variantChildren && visualElement.variantChildren.size ? (forwardDelay = 0) => {
    const { delayChildren = 0, staggerChildren, staggerDirection } = transition3;
    return animateChildren(visualElement, variant, delayChildren + forwardDelay, staggerChildren, staggerDirection, options);
  } : () => Promise.resolve();
  const { when } = transition3;
  if (when) {
    const [first, last] = when === "beforeChildren" ? [getAnimation, getChildAnimations] : [getChildAnimations, getAnimation];
    return first().then(() => last());
  } else {
    return Promise.all([getAnimation(), getChildAnimations(options.delay)]);
  }
}
function animateChildren(visualElement, variant, delayChildren = 0, staggerChildren = 0, staggerDirection = 1, options) {
  const animations2 = [];
  const maxStaggerDuration = (visualElement.variantChildren.size - 1) * staggerChildren;
  const generateStaggerDuration = staggerDirection === 1 ? (i2 = 0) => i2 * staggerChildren : (i2 = 0) => maxStaggerDuration - i2 * staggerChildren;
  Array.from(visualElement.variantChildren).sort(sortByTreeOrder).forEach((child, i2) => {
    child.notify("AnimationStart", variant);
    animations2.push(animateVariant(child, variant, {
      ...options,
      delay: delayChildren + generateStaggerDuration(i2)
    }).then(() => child.notify("AnimationComplete", variant)));
  });
  return Promise.all(animations2);
}
function sortByTreeOrder(a2, b2) {
  return a2.sortNodePosition(b2);
}
function animateVisualElement(visualElement, definition2, options = {}) {
  visualElement.notify("AnimationStart", definition2);
  let animation;
  if (Array.isArray(definition2)) {
    const animations2 = definition2.map((variant) => animateVariant(visualElement, variant, options));
    animation = Promise.all(animations2);
  } else if (typeof definition2 === "string") {
    animation = animateVariant(visualElement, definition2, options);
  } else {
    const resolvedDefinition = typeof definition2 === "function" ? resolveVariant(visualElement, definition2, options.custom) : definition2;
    animation = Promise.all(animateTarget(visualElement, resolvedDefinition, options));
  }
  return animation.then(() => {
    visualElement.notify("AnimationComplete", definition2);
  });
}
const numVariantProps = variantProps.length;
function getVariantContext(visualElement) {
  if (!visualElement)
    return void 0;
  if (!visualElement.isControllingVariants) {
    const context2 = visualElement.parent ? getVariantContext(visualElement.parent) || {} : {};
    if (visualElement.props.initial !== void 0) {
      context2.initial = visualElement.props.initial;
    }
    return context2;
  }
  const context = {};
  for (let i2 = 0; i2 < numVariantProps; i2++) {
    const name2 = variantProps[i2];
    const prop = visualElement.props[name2];
    if (isVariantLabel(prop) || prop === false) {
      context[name2] = prop;
    }
  }
  return context;
}
const reversePriorityOrder = [...variantPriorityOrder].reverse();
const numAnimationTypes = variantPriorityOrder.length;
function animateList(visualElement) {
  return (animations2) => Promise.all(animations2.map(({ animation, options }) => animateVisualElement(visualElement, animation, options)));
}
function createAnimationState(visualElement) {
  let animate = animateList(visualElement);
  let state = createState$1();
  let isInitialRender = true;
  const buildResolvedTypeValues = (type4) => (acc, definition2) => {
    var _a2;
    const resolved = resolveVariant(visualElement, definition2, type4 === "exit" ? (_a2 = visualElement.presenceContext) === null || _a2 === void 0 ? void 0 : _a2.custom : void 0);
    if (resolved) {
      const { transition: transition3, transitionEnd, ...target } = resolved;
      acc = { ...acc, ...target, ...transitionEnd };
    }
    return acc;
  };
  function setAnimateFunction(makeAnimator) {
    animate = makeAnimator(visualElement);
  }
  function animateChanges(changedActiveType) {
    const { props } = visualElement;
    const context = getVariantContext(visualElement.parent) || {};
    const animations2 = [];
    const removedKeys = /* @__PURE__ */ new Set();
    let encounteredKeys = {};
    let removedVariantIndex = Infinity;
    for (let i2 = 0; i2 < numAnimationTypes; i2++) {
      const type4 = reversePriorityOrder[i2];
      const typeState = state[type4];
      const prop = props[type4] !== void 0 ? props[type4] : context[type4];
      const propIsVariant = isVariantLabel(prop);
      const activeDelta = type4 === changedActiveType ? typeState.isActive : null;
      if (activeDelta === false)
        removedVariantIndex = i2;
      let isInherited = prop === context[type4] && prop !== props[type4] && propIsVariant;
      if (isInherited && isInitialRender && visualElement.manuallyAnimateOnMount) {
        isInherited = false;
      }
      typeState.protectedKeys = { ...encounteredKeys };
      if (
        // If it isn't active and hasn't *just* been set as inactive
        !typeState.isActive && activeDelta === null || // If we didn't and don't have any defined prop for this animation type
        !prop && !typeState.prevProp || // Or if the prop doesn't define an animation
        isAnimationControls(prop) || typeof prop === "boolean"
      ) {
        continue;
      }
      const variantDidChange = checkVariantsDidChange(typeState.prevProp, prop);
      let shouldAnimateType = variantDidChange || // If we're making this variant active, we want to always make it active
      type4 === changedActiveType && typeState.isActive && !isInherited && propIsVariant || // If we removed a higher-priority variant (i is in reverse order)
      i2 > removedVariantIndex && propIsVariant;
      let handledRemovedValues = false;
      const definitionList = Array.isArray(prop) ? prop : [prop];
      let resolvedValues = definitionList.reduce(buildResolvedTypeValues(type4), {});
      if (activeDelta === false)
        resolvedValues = {};
      const { prevResolvedValues = {} } = typeState;
      const allKeys = {
        ...prevResolvedValues,
        ...resolvedValues
      };
      const markToAnimate = (key) => {
        shouldAnimateType = true;
        if (removedKeys.has(key)) {
          handledRemovedValues = true;
          removedKeys.delete(key);
        }
        typeState.needsAnimating[key] = true;
        const motionValue2 = visualElement.getValue(key);
        if (motionValue2)
          motionValue2.liveStyle = false;
      };
      for (const key in allKeys) {
        const next2 = resolvedValues[key];
        const prev2 = prevResolvedValues[key];
        if (encounteredKeys.hasOwnProperty(key))
          continue;
        let valueHasChanged = false;
        if (isKeyframesTarget(next2) && isKeyframesTarget(prev2)) {
          valueHasChanged = !shallowCompare(next2, prev2);
        } else {
          valueHasChanged = next2 !== prev2;
        }
        if (valueHasChanged) {
          if (next2 !== void 0 && next2 !== null) {
            markToAnimate(key);
          } else {
            removedKeys.add(key);
          }
        } else if (next2 !== void 0 && removedKeys.has(key)) {
          markToAnimate(key);
        } else {
          typeState.protectedKeys[key] = true;
        }
      }
      typeState.prevProp = prop;
      typeState.prevResolvedValues = resolvedValues;
      if (typeState.isActive) {
        encounteredKeys = { ...encounteredKeys, ...resolvedValues };
      }
      if (isInitialRender && visualElement.blockInitialAnimation) {
        shouldAnimateType = false;
      }
      const willAnimateViaParent = isInherited && variantDidChange;
      const needsAnimating = !willAnimateViaParent || handledRemovedValues;
      if (shouldAnimateType && needsAnimating) {
        animations2.push(...definitionList.map((animation) => ({
          animation,
          options: { type: type4 }
        })));
      }
    }
    if (removedKeys.size) {
      const fallbackAnimation = {};
      removedKeys.forEach((key) => {
        const fallbackTarget = visualElement.getBaseTarget(key);
        const motionValue2 = visualElement.getValue(key);
        if (motionValue2)
          motionValue2.liveStyle = true;
        fallbackAnimation[key] = fallbackTarget !== null && fallbackTarget !== void 0 ? fallbackTarget : null;
      });
      animations2.push({ animation: fallbackAnimation });
    }
    let shouldAnimate = Boolean(animations2.length);
    if (isInitialRender && (props.initial === false || props.initial === props.animate) && !visualElement.manuallyAnimateOnMount) {
      shouldAnimate = false;
    }
    isInitialRender = false;
    return shouldAnimate ? animate(animations2) : Promise.resolve();
  }
  function setActive(type4, isActive2) {
    var _a2;
    if (state[type4].isActive === isActive2)
      return Promise.resolve();
    (_a2 = visualElement.variantChildren) === null || _a2 === void 0 ? void 0 : _a2.forEach((child) => {
      var _a3;
      return (_a3 = child.animationState) === null || _a3 === void 0 ? void 0 : _a3.setActive(type4, isActive2);
    });
    state[type4].isActive = isActive2;
    const animations2 = animateChanges(type4);
    for (const key in state) {
      state[key].protectedKeys = {};
    }
    return animations2;
  }
  return {
    animateChanges,
    setActive,
    setAnimateFunction,
    getState: () => state,
    reset: () => {
      state = createState$1();
      isInitialRender = true;
    }
  };
}
function checkVariantsDidChange(prev2, next2) {
  if (typeof next2 === "string") {
    return next2 !== prev2;
  } else if (Array.isArray(next2)) {
    return !shallowCompare(next2, prev2);
  }
  return false;
}
function createTypeState(isActive2 = false) {
  return {
    isActive: isActive2,
    protectedKeys: {},
    needsAnimating: {},
    prevResolvedValues: {}
  };
}
function createState$1() {
  return {
    animate: createTypeState(true),
    whileInView: createTypeState(),
    whileHover: createTypeState(),
    whileTap: createTypeState(),
    whileDrag: createTypeState(),
    whileFocus: createTypeState(),
    exit: createTypeState()
  };
}
class Feature {
  constructor(node2) {
    this.isMounted = false;
    this.node = node2;
  }
  update() {
  }
}
class AnimationFeature extends Feature {
  /**
   * We dynamically generate the AnimationState manager as it contains a reference
   * to the underlying animation library. We only want to load that if we load this,
   * so people can optionally code split it out using the `m` component.
   */
  constructor(node2) {
    super(node2);
    node2.animationState || (node2.animationState = createAnimationState(node2));
  }
  updateAnimationControlsSubscription() {
    const { animate } = this.node.getProps();
    if (isAnimationControls(animate)) {
      this.unmountControls = animate.subscribe(this.node);
    }
  }
  /**
   * Subscribe any provided AnimationControls to the component's VisualElement
   */
  mount() {
    this.updateAnimationControlsSubscription();
  }
  update() {
    const { animate } = this.node.getProps();
    const { animate: prevAnimate } = this.node.prevProps || {};
    if (animate !== prevAnimate) {
      this.updateAnimationControlsSubscription();
    }
  }
  unmount() {
    var _a2;
    this.node.animationState.reset();
    (_a2 = this.unmountControls) === null || _a2 === void 0 ? void 0 : _a2.call(this);
  }
}
let id$2 = 0;
class ExitAnimationFeature extends Feature {
  constructor() {
    super(...arguments);
    this.id = id$2++;
  }
  update() {
    if (!this.node.presenceContext)
      return;
    const { isPresent: isPresent2, onExitComplete } = this.node.presenceContext;
    const { isPresent: prevIsPresent } = this.node.prevPresenceContext || {};
    if (!this.node.animationState || isPresent2 === prevIsPresent) {
      return;
    }
    const exitAnimation = this.node.animationState.setActive("exit", !isPresent2);
    if (onExitComplete && !isPresent2) {
      exitAnimation.then(() => onExitComplete(this.id));
    }
  }
  mount() {
    const { register: register2 } = this.node.presenceContext || {};
    if (register2) {
      this.unmount = register2(this.id);
    }
  }
  unmount() {
  }
}
const animations = {
  animation: {
    Feature: AnimationFeature
  },
  exit: {
    Feature: ExitAnimationFeature
  }
};
function addDomEvent(target, eventName, handler, options = { passive: true }) {
  target.addEventListener(eventName, handler, options);
  return () => target.removeEventListener(eventName, handler);
}
function extractEventInfo(event) {
  return {
    point: {
      x: event.pageX,
      y: event.pageY
    }
  };
}
const addPointerInfo = (handler) => {
  return (event) => isPrimaryPointer(event) && handler(event, extractEventInfo(event));
};
function addPointerEvent(target, eventName, handler, options) {
  return addDomEvent(target, eventName, addPointerInfo(handler), options);
}
const distance = (a2, b2) => Math.abs(a2 - b2);
function distance2D(a2, b2) {
  const xDelta = distance(a2.x, b2.x);
  const yDelta = distance(a2.y, b2.y);
  return Math.sqrt(xDelta ** 2 + yDelta ** 2);
}
class PanSession {
  constructor(event, handlers2, { transformPagePoint, contextWindow, dragSnapToOrigin = false } = {}) {
    this.startEvent = null;
    this.lastMoveEvent = null;
    this.lastMoveEventInfo = null;
    this.handlers = {};
    this.contextWindow = window;
    this.updatePoint = () => {
      if (!(this.lastMoveEvent && this.lastMoveEventInfo))
        return;
      const info3 = getPanInfo(this.lastMoveEventInfo, this.history);
      const isPanStarted = this.startEvent !== null;
      const isDistancePastThreshold = distance2D(info3.offset, { x: 0, y: 0 }) >= 3;
      if (!isPanStarted && !isDistancePastThreshold)
        return;
      const { point: point3 } = info3;
      const { timestamp: timestamp2 } = frameData;
      this.history.push({ ...point3, timestamp: timestamp2 });
      const { onStart, onMove } = this.handlers;
      if (!isPanStarted) {
        onStart && onStart(this.lastMoveEvent, info3);
        this.startEvent = this.lastMoveEvent;
      }
      onMove && onMove(this.lastMoveEvent, info3);
    };
    this.handlePointerMove = (event2, info3) => {
      this.lastMoveEvent = event2;
      this.lastMoveEventInfo = transformPoint(info3, this.transformPagePoint);
      frame.update(this.updatePoint, true);
    };
    this.handlePointerUp = (event2, info3) => {
      this.end();
      const { onEnd, onSessionEnd, resumeAnimation } = this.handlers;
      if (this.dragSnapToOrigin)
        resumeAnimation && resumeAnimation();
      if (!(this.lastMoveEvent && this.lastMoveEventInfo))
        return;
      const panInfo = getPanInfo(event2.type === "pointercancel" ? this.lastMoveEventInfo : transformPoint(info3, this.transformPagePoint), this.history);
      if (this.startEvent && onEnd) {
        onEnd(event2, panInfo);
      }
      onSessionEnd && onSessionEnd(event2, panInfo);
    };
    if (!isPrimaryPointer(event))
      return;
    this.dragSnapToOrigin = dragSnapToOrigin;
    this.handlers = handlers2;
    this.transformPagePoint = transformPagePoint;
    this.contextWindow = contextWindow || window;
    const info2 = extractEventInfo(event);
    const initialInfo = transformPoint(info2, this.transformPagePoint);
    const { point: point2 } = initialInfo;
    const { timestamp } = frameData;
    this.history = [{ ...point2, timestamp }];
    const { onSessionStart } = handlers2;
    onSessionStart && onSessionStart(event, getPanInfo(initialInfo, this.history));
    this.removeListeners = pipe(addPointerEvent(this.contextWindow, "pointermove", this.handlePointerMove), addPointerEvent(this.contextWindow, "pointerup", this.handlePointerUp), addPointerEvent(this.contextWindow, "pointercancel", this.handlePointerUp));
  }
  updateHandlers(handlers2) {
    this.handlers = handlers2;
  }
  end() {
    this.removeListeners && this.removeListeners();
    cancelFrame(this.updatePoint);
  }
}
function transformPoint(info2, transformPagePoint) {
  return transformPagePoint ? { point: transformPagePoint(info2.point) } : info2;
}
function subtractPoint(a2, b2) {
  return { x: a2.x - b2.x, y: a2.y - b2.y };
}
function getPanInfo({ point: point2 }, history) {
  return {
    point: point2,
    delta: subtractPoint(point2, lastDevicePoint(history)),
    offset: subtractPoint(point2, startDevicePoint(history)),
    velocity: getVelocity(history, 0.1)
  };
}
function startDevicePoint(history) {
  return history[0];
}
function lastDevicePoint(history) {
  return history[history.length - 1];
}
function getVelocity(history, timeDelta) {
  if (history.length < 2) {
    return { x: 0, y: 0 };
  }
  let i2 = history.length - 1;
  let timestampedPoint = null;
  const lastPoint = lastDevicePoint(history);
  while (i2 >= 0) {
    timestampedPoint = history[i2];
    if (lastPoint.timestamp - timestampedPoint.timestamp > /* @__PURE__ */ secondsToMilliseconds(timeDelta)) {
      break;
    }
    i2--;
  }
  if (!timestampedPoint) {
    return { x: 0, y: 0 };
  }
  const time2 = /* @__PURE__ */ millisecondsToSeconds(lastPoint.timestamp - timestampedPoint.timestamp);
  if (time2 === 0) {
    return { x: 0, y: 0 };
  }
  const currentVelocity = {
    x: (lastPoint.x - timestampedPoint.x) / time2,
    y: (lastPoint.y - timestampedPoint.y) / time2
  };
  if (currentVelocity.x === Infinity) {
    currentVelocity.x = 0;
  }
  if (currentVelocity.y === Infinity) {
    currentVelocity.y = 0;
  }
  return currentVelocity;
}
const SCALE_PRECISION = 1e-4;
const SCALE_MIN = 1 - SCALE_PRECISION;
const SCALE_MAX = 1 + SCALE_PRECISION;
const TRANSLATE_PRECISION = 0.01;
const TRANSLATE_MIN = 0 - TRANSLATE_PRECISION;
const TRANSLATE_MAX = 0 + TRANSLATE_PRECISION;
function calcLength(axis) {
  return axis.max - axis.min;
}
function isNear(value2, target, maxDistance) {
  return Math.abs(value2 - target) <= maxDistance;
}
function calcAxisDelta(delta, source2, target, origin2 = 0.5) {
  delta.origin = origin2;
  delta.originPoint = mixNumber$1(source2.min, source2.max, delta.origin);
  delta.scale = calcLength(target) / calcLength(source2);
  delta.translate = mixNumber$1(target.min, target.max, delta.origin) - delta.originPoint;
  if (delta.scale >= SCALE_MIN && delta.scale <= SCALE_MAX || isNaN(delta.scale)) {
    delta.scale = 1;
  }
  if (delta.translate >= TRANSLATE_MIN && delta.translate <= TRANSLATE_MAX || isNaN(delta.translate)) {
    delta.translate = 0;
  }
}
function calcBoxDelta(delta, source2, target, origin2) {
  calcAxisDelta(delta.x, source2.x, target.x, origin2 ? origin2.originX : void 0);
  calcAxisDelta(delta.y, source2.y, target.y, origin2 ? origin2.originY : void 0);
}
function calcRelativeAxis(target, relative, parent) {
  target.min = parent.min + relative.min;
  target.max = target.min + calcLength(relative);
}
function calcRelativeBox(target, relative, parent) {
  calcRelativeAxis(target.x, relative.x, parent.x);
  calcRelativeAxis(target.y, relative.y, parent.y);
}
function calcRelativeAxisPosition(target, layout2, parent) {
  target.min = layout2.min - parent.min;
  target.max = target.min + calcLength(layout2);
}
function calcRelativePosition(target, layout2, parent) {
  calcRelativeAxisPosition(target.x, layout2.x, parent.x);
  calcRelativeAxisPosition(target.y, layout2.y, parent.y);
}
function applyConstraints(point2, { min: min2, max: max2 }, elastic) {
  if (min2 !== void 0 && point2 < min2) {
    point2 = elastic ? mixNumber$1(min2, point2, elastic.min) : Math.max(point2, min2);
  } else if (max2 !== void 0 && point2 > max2) {
    point2 = elastic ? mixNumber$1(max2, point2, elastic.max) : Math.min(point2, max2);
  }
  return point2;
}
function calcRelativeAxisConstraints(axis, min2, max2) {
  return {
    min: min2 !== void 0 ? axis.min + min2 : void 0,
    max: max2 !== void 0 ? axis.max + max2 - (axis.max - axis.min) : void 0
  };
}
function calcRelativeConstraints(layoutBox, { top: top2, left: left2, bottom: bottom2, right }) {
  return {
    x: calcRelativeAxisConstraints(layoutBox.x, left2, right),
    y: calcRelativeAxisConstraints(layoutBox.y, top2, bottom2)
  };
}
function calcViewportAxisConstraints(layoutAxis, constraintsAxis) {
  let min2 = constraintsAxis.min - layoutAxis.min;
  let max2 = constraintsAxis.max - layoutAxis.max;
  if (constraintsAxis.max - constraintsAxis.min < layoutAxis.max - layoutAxis.min) {
    [min2, max2] = [max2, min2];
  }
  return { min: min2, max: max2 };
}
function calcViewportConstraints(layoutBox, constraintsBox) {
  return {
    x: calcViewportAxisConstraints(layoutBox.x, constraintsBox.x),
    y: calcViewportAxisConstraints(layoutBox.y, constraintsBox.y)
  };
}
function calcOrigin(source2, target) {
  let origin2 = 0.5;
  const sourceLength = calcLength(source2);
  const targetLength = calcLength(target);
  if (targetLength > sourceLength) {
    origin2 = /* @__PURE__ */ progress$1(target.min, target.max - sourceLength, source2.min);
  } else if (sourceLength > targetLength) {
    origin2 = /* @__PURE__ */ progress$1(source2.min, source2.max - targetLength, target.min);
  }
  return clamp$1(0, 1, origin2);
}
function rebaseAxisConstraints(layout2, constraints) {
  const relativeConstraints = {};
  if (constraints.min !== void 0) {
    relativeConstraints.min = constraints.min - layout2.min;
  }
  if (constraints.max !== void 0) {
    relativeConstraints.max = constraints.max - layout2.min;
  }
  return relativeConstraints;
}
const defaultElastic = 0.35;
function resolveDragElastic(dragElastic = defaultElastic) {
  if (dragElastic === false) {
    dragElastic = 0;
  } else if (dragElastic === true) {
    dragElastic = defaultElastic;
  }
  return {
    x: resolveAxisElastic(dragElastic, "left", "right"),
    y: resolveAxisElastic(dragElastic, "top", "bottom")
  };
}
function resolveAxisElastic(dragElastic, minLabel, maxLabel) {
  return {
    min: resolvePointElastic(dragElastic, minLabel),
    max: resolvePointElastic(dragElastic, maxLabel)
  };
}
function resolvePointElastic(dragElastic, label) {
  return typeof dragElastic === "number" ? dragElastic : dragElastic[label] || 0;
}
const createAxisDelta = () => ({
  translate: 0,
  scale: 1,
  origin: 0,
  originPoint: 0
});
const createDelta = () => ({
  x: createAxisDelta(),
  y: createAxisDelta()
});
const createAxis = () => ({ min: 0, max: 0 });
const createBox = () => ({
  x: createAxis(),
  y: createAxis()
});
function eachAxis(callback2) {
  return [callback2("x"), callback2("y")];
}
function convertBoundingBoxToBox({ top: top2, left: left2, right, bottom: bottom2 }) {
  return {
    x: { min: left2, max: right },
    y: { min: top2, max: bottom2 }
  };
}
function convertBoxToBoundingBox({ x: x2, y: y2 }) {
  return { top: y2.min, right: x2.max, bottom: y2.max, left: x2.min };
}
function transformBoxPoints(point2, transformPoint2) {
  if (!transformPoint2)
    return point2;
  const topLeft = transformPoint2({ x: point2.left, y: point2.top });
  const bottomRight = transformPoint2({ x: point2.right, y: point2.bottom });
  return {
    top: topLeft.y,
    left: topLeft.x,
    bottom: bottomRight.y,
    right: bottomRight.x
  };
}
function isIdentityScale(scale2) {
  return scale2 === void 0 || scale2 === 1;
}
function hasScale({ scale: scale2, scaleX, scaleY }) {
  return !isIdentityScale(scale2) || !isIdentityScale(scaleX) || !isIdentityScale(scaleY);
}
function hasTransform(values) {
  return hasScale(values) || has2DTranslate(values) || values.z || values.rotate || values.rotateX || values.rotateY || values.skewX || values.skewY;
}
function has2DTranslate(values) {
  return is2DTranslate(values.x) || is2DTranslate(values.y);
}
function is2DTranslate(value2) {
  return value2 && value2 !== "0%";
}
function scalePoint(point2, scale2, originPoint) {
  const distanceFromOrigin = point2 - originPoint;
  const scaled = scale2 * distanceFromOrigin;
  return originPoint + scaled;
}
function applyPointDelta(point2, translate, scale2, originPoint, boxScale) {
  if (boxScale !== void 0) {
    point2 = scalePoint(point2, boxScale, originPoint);
  }
  return scalePoint(point2, scale2, originPoint) + translate;
}
function applyAxisDelta(axis, translate = 0, scale2 = 1, originPoint, boxScale) {
  axis.min = applyPointDelta(axis.min, translate, scale2, originPoint, boxScale);
  axis.max = applyPointDelta(axis.max, translate, scale2, originPoint, boxScale);
}
function applyBoxDelta(box, { x: x2, y: y2 }) {
  applyAxisDelta(box.x, x2.translate, x2.scale, x2.originPoint);
  applyAxisDelta(box.y, y2.translate, y2.scale, y2.originPoint);
}
const TREE_SCALE_SNAP_MIN = 0.999999999999;
const TREE_SCALE_SNAP_MAX = 1.0000000000001;
function applyTreeDeltas(box, treeScale, treePath, isSharedTransition = false) {
  const treeLength = treePath.length;
  if (!treeLength)
    return;
  treeScale.x = treeScale.y = 1;
  let node2;
  let delta;
  for (let i2 = 0; i2 < treeLength; i2++) {
    node2 = treePath[i2];
    delta = node2.projectionDelta;
    const { visualElement } = node2.options;
    if (visualElement && visualElement.props.style && visualElement.props.style.display === "contents") {
      continue;
    }
    if (isSharedTransition && node2.options.layoutScroll && node2.scroll && node2 !== node2.root) {
      transformBox(box, {
        x: -node2.scroll.offset.x,
        y: -node2.scroll.offset.y
      });
    }
    if (delta) {
      treeScale.x *= delta.x.scale;
      treeScale.y *= delta.y.scale;
      applyBoxDelta(box, delta);
    }
    if (isSharedTransition && hasTransform(node2.latestValues)) {
      transformBox(box, node2.latestValues);
    }
  }
  if (treeScale.x < TREE_SCALE_SNAP_MAX && treeScale.x > TREE_SCALE_SNAP_MIN) {
    treeScale.x = 1;
  }
  if (treeScale.y < TREE_SCALE_SNAP_MAX && treeScale.y > TREE_SCALE_SNAP_MIN) {
    treeScale.y = 1;
  }
}
function translateAxis(axis, distance2) {
  axis.min = axis.min + distance2;
  axis.max = axis.max + distance2;
}
function transformAxis(axis, axisTranslate, axisScale, boxScale, axisOrigin = 0.5) {
  const originPoint = mixNumber$1(axis.min, axis.max, axisOrigin);
  applyAxisDelta(axis, axisTranslate, axisScale, originPoint, boxScale);
}
function transformBox(box, transform2) {
  transformAxis(box.x, transform2.x, transform2.scaleX, transform2.scale, transform2.originX);
  transformAxis(box.y, transform2.y, transform2.scaleY, transform2.scale, transform2.originY);
}
function measureViewportBox(instance2, transformPoint2) {
  return convertBoundingBoxToBox(transformBoxPoints(instance2.getBoundingClientRect(), transformPoint2));
}
function measurePageBox(element2, rootProjectionNode2, transformPagePoint) {
  const viewportBox = measureViewportBox(element2, transformPagePoint);
  const { scroll } = rootProjectionNode2;
  if (scroll) {
    translateAxis(viewportBox.x, scroll.offset.x);
    translateAxis(viewportBox.y, scroll.offset.y);
  }
  return viewportBox;
}
const getContextWindow = ({ current }) => {
  return current ? current.ownerDocument.defaultView : null;
};
const elementDragControls = /* @__PURE__ */ new WeakMap();
class VisualElementDragControls {
  constructor(visualElement) {
    this.openDragLock = null;
    this.isDragging = false;
    this.currentDirection = null;
    this.originPoint = { x: 0, y: 0 };
    this.constraints = false;
    this.hasMutatedConstraints = false;
    this.elastic = createBox();
    this.visualElement = visualElement;
  }
  start(originEvent, { snapToCursor = false } = {}) {
    const { presenceContext } = this.visualElement;
    if (presenceContext && presenceContext.isPresent === false)
      return;
    const onSessionStart = (event) => {
      const { dragSnapToOrigin: dragSnapToOrigin2 } = this.getProps();
      dragSnapToOrigin2 ? this.pauseAnimation() : this.stopAnimation();
      if (snapToCursor) {
        this.snapToCursor(extractEventInfo(event).point);
      }
    };
    const onStart = (event, info2) => {
      const { drag: drag2, dragPropagation, onDragStart } = this.getProps();
      if (drag2 && !dragPropagation) {
        if (this.openDragLock)
          this.openDragLock();
        this.openDragLock = setDragLock(drag2);
        if (!this.openDragLock)
          return;
      }
      this.isDragging = true;
      this.currentDirection = null;
      this.resolveConstraints();
      if (this.visualElement.projection) {
        this.visualElement.projection.isAnimationBlocked = true;
        this.visualElement.projection.target = void 0;
      }
      eachAxis((axis) => {
        let current = this.getAxisMotionValue(axis).get() || 0;
        if (percent.test(current)) {
          const { projection } = this.visualElement;
          if (projection && projection.layout) {
            const measuredAxis = projection.layout.layoutBox[axis];
            if (measuredAxis) {
              const length2 = calcLength(measuredAxis);
              current = length2 * (parseFloat(current) / 100);
            }
          }
        }
        this.originPoint[axis] = current;
      });
      if (onDragStart) {
        frame.postRender(() => onDragStart(event, info2));
      }
      addValueToWillChange(this.visualElement, "transform");
      const { animationState } = this.visualElement;
      animationState && animationState.setActive("whileDrag", true);
    };
    const onMove = (event, info2) => {
      const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag } = this.getProps();
      if (!dragPropagation && !this.openDragLock)
        return;
      const { offset: offset2 } = info2;
      if (dragDirectionLock && this.currentDirection === null) {
        this.currentDirection = getCurrentDirection(offset2);
        if (this.currentDirection !== null) {
          onDirectionLock && onDirectionLock(this.currentDirection);
        }
        return;
      }
      this.updateAxis("x", info2.point, offset2);
      this.updateAxis("y", info2.point, offset2);
      this.visualElement.render();
      onDrag && onDrag(event, info2);
    };
    const onSessionEnd = (event, info2) => this.stop(event, info2);
    const resumeAnimation = () => eachAxis((axis) => {
      var _a2;
      return this.getAnimationState(axis) === "paused" && ((_a2 = this.getAxisMotionValue(axis).animation) === null || _a2 === void 0 ? void 0 : _a2.play());
    });
    const { dragSnapToOrigin } = this.getProps();
    this.panSession = new PanSession(originEvent, {
      onSessionStart,
      onStart,
      onMove,
      onSessionEnd,
      resumeAnimation
    }, {
      transformPagePoint: this.visualElement.getTransformPagePoint(),
      dragSnapToOrigin,
      contextWindow: getContextWindow(this.visualElement)
    });
  }
  stop(event, info2) {
    const isDragging2 = this.isDragging;
    this.cancel();
    if (!isDragging2)
      return;
    const { velocity } = info2;
    this.startAnimation(velocity);
    const { onDragEnd } = this.getProps();
    if (onDragEnd) {
      frame.postRender(() => onDragEnd(event, info2));
    }
  }
  cancel() {
    this.isDragging = false;
    const { projection, animationState } = this.visualElement;
    if (projection) {
      projection.isAnimationBlocked = false;
    }
    this.panSession && this.panSession.end();
    this.panSession = void 0;
    const { dragPropagation } = this.getProps();
    if (!dragPropagation && this.openDragLock) {
      this.openDragLock();
      this.openDragLock = null;
    }
    animationState && animationState.setActive("whileDrag", false);
  }
  updateAxis(axis, _point, offset2) {
    const { drag: drag2 } = this.getProps();
    if (!offset2 || !shouldDrag(axis, drag2, this.currentDirection))
      return;
    const axisValue = this.getAxisMotionValue(axis);
    let next2 = this.originPoint[axis] + offset2[axis];
    if (this.constraints && this.constraints[axis]) {
      next2 = applyConstraints(next2, this.constraints[axis], this.elastic[axis]);
    }
    axisValue.set(next2);
  }
  resolveConstraints() {
    var _a2;
    const { dragConstraints, dragElastic } = this.getProps();
    const layout2 = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(false) : (_a2 = this.visualElement.projection) === null || _a2 === void 0 ? void 0 : _a2.layout;
    const prevConstraints = this.constraints;
    if (dragConstraints && isRefObject(dragConstraints)) {
      if (!this.constraints) {
        this.constraints = this.resolveRefConstraints();
      }
    } else {
      if (dragConstraints && layout2) {
        this.constraints = calcRelativeConstraints(layout2.layoutBox, dragConstraints);
      } else {
        this.constraints = false;
      }
    }
    this.elastic = resolveDragElastic(dragElastic);
    if (prevConstraints !== this.constraints && layout2 && this.constraints && !this.hasMutatedConstraints) {
      eachAxis((axis) => {
        if (this.constraints !== false && this.getAxisMotionValue(axis)) {
          this.constraints[axis] = rebaseAxisConstraints(layout2.layoutBox[axis], this.constraints[axis]);
        }
      });
    }
  }
  resolveRefConstraints() {
    const { dragConstraints: constraints, onMeasureDragConstraints } = this.getProps();
    if (!constraints || !isRefObject(constraints))
      return false;
    const constraintsElement = constraints.current;
    const { projection } = this.visualElement;
    if (!projection || !projection.layout)
      return false;
    const constraintsBox = measurePageBox(constraintsElement, projection.root, this.visualElement.getTransformPagePoint());
    let measuredConstraints = calcViewportConstraints(projection.layout.layoutBox, constraintsBox);
    if (onMeasureDragConstraints) {
      const userConstraints = onMeasureDragConstraints(convertBoxToBoundingBox(measuredConstraints));
      this.hasMutatedConstraints = !!userConstraints;
      if (userConstraints) {
        measuredConstraints = convertBoundingBoxToBox(userConstraints);
      }
    }
    return measuredConstraints;
  }
  startAnimation(velocity) {
    const { drag: drag2, dragMomentum, dragElastic, dragTransition, dragSnapToOrigin, onDragTransitionEnd } = this.getProps();
    const constraints = this.constraints || {};
    const momentumAnimations = eachAxis((axis) => {
      if (!shouldDrag(axis, drag2, this.currentDirection)) {
        return;
      }
      let transition3 = constraints && constraints[axis] || {};
      if (dragSnapToOrigin)
        transition3 = { min: 0, max: 0 };
      const bounceStiffness = dragElastic ? 200 : 1e6;
      const bounceDamping = dragElastic ? 40 : 1e7;
      const inertia2 = {
        type: "inertia",
        velocity: dragMomentum ? velocity[axis] : 0,
        bounceStiffness,
        bounceDamping,
        timeConstant: 750,
        restDelta: 1,
        restSpeed: 10,
        ...dragTransition,
        ...transition3
      };
      return this.startAxisValueAnimation(axis, inertia2);
    });
    return Promise.all(momentumAnimations).then(onDragTransitionEnd);
  }
  startAxisValueAnimation(axis, transition3) {
    const axisValue = this.getAxisMotionValue(axis);
    addValueToWillChange(this.visualElement, axis);
    return axisValue.start(animateMotionValue(axis, axisValue, 0, transition3, this.visualElement, false));
  }
  stopAnimation() {
    eachAxis((axis) => this.getAxisMotionValue(axis).stop());
  }
  pauseAnimation() {
    eachAxis((axis) => {
      var _a2;
      return (_a2 = this.getAxisMotionValue(axis).animation) === null || _a2 === void 0 ? void 0 : _a2.pause();
    });
  }
  getAnimationState(axis) {
    var _a2;
    return (_a2 = this.getAxisMotionValue(axis).animation) === null || _a2 === void 0 ? void 0 : _a2.state;
  }
  /**
   * Drag works differently depending on which props are provided.
   *
   * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
   * - Otherwise, we apply the delta to the x/y motion values.
   */
  getAxisMotionValue(axis) {
    const dragKey = `_drag${axis.toUpperCase()}`;
    const props = this.visualElement.getProps();
    const externalMotionValue = props[dragKey];
    return externalMotionValue ? externalMotionValue : this.visualElement.getValue(axis, (props.initial ? props.initial[axis] : void 0) || 0);
  }
  snapToCursor(point2) {
    eachAxis((axis) => {
      const { drag: drag2 } = this.getProps();
      if (!shouldDrag(axis, drag2, this.currentDirection))
        return;
      const { projection } = this.visualElement;
      const axisValue = this.getAxisMotionValue(axis);
      if (projection && projection.layout) {
        const { min: min2, max: max2 } = projection.layout.layoutBox[axis];
        axisValue.set(point2[axis] - mixNumber$1(min2, max2, 0.5));
      }
    });
  }
  /**
   * When the viewport resizes we want to check if the measured constraints
   * have changed and, if so, reposition the element within those new constraints
   * relative to where it was before the resize.
   */
  scalePositionWithinConstraints() {
    if (!this.visualElement.current)
      return;
    const { drag: drag2, dragConstraints } = this.getProps();
    const { projection } = this.visualElement;
    if (!isRefObject(dragConstraints) || !projection || !this.constraints)
      return;
    this.stopAnimation();
    const boxProgress = { x: 0, y: 0 };
    eachAxis((axis) => {
      const axisValue = this.getAxisMotionValue(axis);
      if (axisValue && this.constraints !== false) {
        const latest = axisValue.get();
        boxProgress[axis] = calcOrigin({ min: latest, max: latest }, this.constraints[axis]);
      }
    });
    const { transformTemplate } = this.visualElement.getProps();
    this.visualElement.current.style.transform = transformTemplate ? transformTemplate({}, "") : "none";
    projection.root && projection.root.updateScroll();
    projection.updateLayout();
    this.resolveConstraints();
    eachAxis((axis) => {
      if (!shouldDrag(axis, drag2, null))
        return;
      const axisValue = this.getAxisMotionValue(axis);
      const { min: min2, max: max2 } = this.constraints[axis];
      axisValue.set(mixNumber$1(min2, max2, boxProgress[axis]));
    });
  }
  addListeners() {
    if (!this.visualElement.current)
      return;
    elementDragControls.set(this.visualElement, this);
    const element2 = this.visualElement.current;
    const stopPointerListener = addPointerEvent(element2, "pointerdown", (event) => {
      const { drag: drag2, dragListener = true } = this.getProps();
      drag2 && dragListener && this.start(event);
    });
    const measureDragConstraints = () => {
      const { dragConstraints } = this.getProps();
      if (isRefObject(dragConstraints) && dragConstraints.current) {
        this.constraints = this.resolveRefConstraints();
      }
    };
    const { projection } = this.visualElement;
    const stopMeasureLayoutListener = projection.addEventListener("measure", measureDragConstraints);
    if (projection && !projection.layout) {
      projection.root && projection.root.updateScroll();
      projection.updateLayout();
    }
    frame.read(measureDragConstraints);
    const stopResizeListener = addDomEvent(window, "resize", () => this.scalePositionWithinConstraints());
    const stopLayoutUpdateListener = projection.addEventListener("didUpdate", ({ delta, hasLayoutChanged }) => {
      if (this.isDragging && hasLayoutChanged) {
        eachAxis((axis) => {
          const motionValue2 = this.getAxisMotionValue(axis);
          if (!motionValue2)
            return;
          this.originPoint[axis] += delta[axis].translate;
          motionValue2.set(motionValue2.get() + delta[axis].translate);
        });
        this.visualElement.render();
      }
    });
    return () => {
      stopResizeListener();
      stopPointerListener();
      stopMeasureLayoutListener();
      stopLayoutUpdateListener && stopLayoutUpdateListener();
    };
  }
  getProps() {
    const props = this.visualElement.getProps();
    const { drag: drag2 = false, dragDirectionLock = false, dragPropagation = false, dragConstraints = false, dragElastic = defaultElastic, dragMomentum = true } = props;
    return {
      ...props,
      drag: drag2,
      dragDirectionLock,
      dragPropagation,
      dragConstraints,
      dragElastic,
      dragMomentum
    };
  }
}
function shouldDrag(direction, drag2, currentDirection) {
  return (drag2 === true || drag2 === direction) && (currentDirection === null || currentDirection === direction);
}
function getCurrentDirection(offset2, lockThreshold = 10) {
  let direction = null;
  if (Math.abs(offset2.y) > lockThreshold) {
    direction = "y";
  } else if (Math.abs(offset2.x) > lockThreshold) {
    direction = "x";
  }
  return direction;
}
class DragGesture extends Feature {
  constructor(node2) {
    super(node2);
    this.removeGroupControls = noop$9;
    this.removeListeners = noop$9;
    this.controls = new VisualElementDragControls(node2);
  }
  mount() {
    const { dragControls } = this.node.getProps();
    if (dragControls) {
      this.removeGroupControls = dragControls.subscribe(this.controls);
    }
    this.removeListeners = this.controls.addListeners() || noop$9;
  }
  unmount() {
    this.removeGroupControls();
    this.removeListeners();
  }
}
const asyncHandler = (handler) => (event, info2) => {
  if (handler) {
    frame.postRender(() => handler(event, info2));
  }
};
class PanGesture extends Feature {
  constructor() {
    super(...arguments);
    this.removePointerDownListener = noop$9;
  }
  onPointerDown(pointerDownEvent) {
    this.session = new PanSession(pointerDownEvent, this.createPanHandlers(), {
      transformPagePoint: this.node.getTransformPagePoint(),
      contextWindow: getContextWindow(this.node)
    });
  }
  createPanHandlers() {
    const { onPanSessionStart, onPanStart, onPan, onPanEnd } = this.node.getProps();
    return {
      onSessionStart: asyncHandler(onPanSessionStart),
      onStart: asyncHandler(onPanStart),
      onMove: onPan,
      onEnd: (event, info2) => {
        delete this.session;
        if (onPanEnd) {
          frame.postRender(() => onPanEnd(event, info2));
        }
      }
    };
  }
  mount() {
    this.removePointerDownListener = addPointerEvent(this.node.current, "pointerdown", (event) => this.onPointerDown(event));
  }
  update() {
    this.session && this.session.updateHandlers(this.createPanHandlers());
  }
  unmount() {
    this.removePointerDownListener();
    this.session && this.session.end();
  }
}
const globalProjectionState = {
  /**
   * Global flag as to whether the tree has animated since the last time
   * we resized the window
   */
  hasAnimatedSinceResize: true,
  /**
   * We set this to true once, on the first update. Any nodes added to the tree beyond that
   * update will be given a `data-projection-id` attribute.
   */
  hasEverUpdated: false
};
function pixelsToPercent(pixels, axis) {
  if (axis.max === axis.min)
    return 0;
  return pixels / (axis.max - axis.min) * 100;
}
const correctBorderRadius = {
  correct: (latest, node2) => {
    if (!node2.target)
      return latest;
    if (typeof latest === "string") {
      if (px.test(latest)) {
        latest = parseFloat(latest);
      } else {
        return latest;
      }
    }
    const x2 = pixelsToPercent(latest, node2.target.x);
    const y2 = pixelsToPercent(latest, node2.target.y);
    return `${x2}% ${y2}%`;
  }
};
const correctBoxShadow = {
  correct: (latest, { treeScale, projectionDelta }) => {
    const original2 = latest;
    const shadow2 = complex.parse(latest);
    if (shadow2.length > 5)
      return original2;
    const template2 = complex.createTransformer(latest);
    const offset2 = typeof shadow2[0] !== "number" ? 1 : 0;
    const xScale = projectionDelta.x.scale * treeScale.x;
    const yScale = projectionDelta.y.scale * treeScale.y;
    shadow2[0 + offset2] /= xScale;
    shadow2[1 + offset2] /= yScale;
    const averageScale = mixNumber$1(xScale, yScale, 0.5);
    if (typeof shadow2[2 + offset2] === "number")
      shadow2[2 + offset2] /= averageScale;
    if (typeof shadow2[3 + offset2] === "number")
      shadow2[3 + offset2] /= averageScale;
    return template2(shadow2);
  }
};
class MeasureLayoutWithContext extends reactExports.Component {
  /**
   * This only mounts projection nodes for components that
   * need measuring, we might want to do it for all components
   * in order to incorporate transforms
   */
  componentDidMount() {
    const { visualElement, layoutGroup, switchLayoutGroup, layoutId } = this.props;
    const { projection } = visualElement;
    addScaleCorrector(defaultScaleCorrectors);
    if (projection) {
      if (layoutGroup.group)
        layoutGroup.group.add(projection);
      if (switchLayoutGroup && switchLayoutGroup.register && layoutId) {
        switchLayoutGroup.register(projection);
      }
      projection.root.didUpdate();
      projection.addEventListener("animationComplete", () => {
        this.safeToRemove();
      });
      projection.setOptions({
        ...projection.options,
        onExitComplete: () => this.safeToRemove()
      });
    }
    globalProjectionState.hasEverUpdated = true;
  }
  getSnapshotBeforeUpdate(prevProps) {
    const { layoutDependency, visualElement, drag: drag2, isPresent: isPresent2 } = this.props;
    const projection = visualElement.projection;
    if (!projection)
      return null;
    projection.isPresent = isPresent2;
    if (drag2 || prevProps.layoutDependency !== layoutDependency || layoutDependency === void 0) {
      projection.willUpdate();
    } else {
      this.safeToRemove();
    }
    if (prevProps.isPresent !== isPresent2) {
      if (isPresent2) {
        projection.promote();
      } else if (!projection.relegate()) {
        frame.postRender(() => {
          const stack = projection.getStack();
          if (!stack || !stack.members.length) {
            this.safeToRemove();
          }
        });
      }
    }
    return null;
  }
  componentDidUpdate() {
    const { projection } = this.props.visualElement;
    if (projection) {
      projection.root.didUpdate();
      microtask.postRender(() => {
        if (!projection.currentAnimation && projection.isLead()) {
          this.safeToRemove();
        }
      });
    }
  }
  componentWillUnmount() {
    const { visualElement, layoutGroup, switchLayoutGroup: promoteContext } = this.props;
    const { projection } = visualElement;
    if (projection) {
      projection.scheduleCheckAfterUnmount();
      if (layoutGroup && layoutGroup.group)
        layoutGroup.group.remove(projection);
      if (promoteContext && promoteContext.deregister)
        promoteContext.deregister(projection);
    }
  }
  safeToRemove() {
    const { safeToRemove } = this.props;
    safeToRemove && safeToRemove();
  }
  render() {
    return null;
  }
}
function MeasureLayout(props) {
  const [isPresent2, safeToRemove] = usePresence();
  const layoutGroup = reactExports.useContext(LayoutGroupContext);
  return jsxRuntimeExports.jsx(MeasureLayoutWithContext, { ...props, layoutGroup, switchLayoutGroup: reactExports.useContext(SwitchLayoutGroupContext), isPresent: isPresent2, safeToRemove });
}
const defaultScaleCorrectors = {
  borderRadius: {
    ...correctBorderRadius,
    applyTo: [
      "borderTopLeftRadius",
      "borderTopRightRadius",
      "borderBottomLeftRadius",
      "borderBottomRightRadius"
    ]
  },
  borderTopLeftRadius: correctBorderRadius,
  borderTopRightRadius: correctBorderRadius,
  borderBottomLeftRadius: correctBorderRadius,
  borderBottomRightRadius: correctBorderRadius,
  boxShadow: correctBoxShadow
};
function animateSingleValue(value2, keyframes2, options) {
  const motionValue$1 = isMotionValue(value2) ? value2 : motionValue(value2);
  motionValue$1.start(animateMotionValue("", motionValue$1, keyframes2, options));
  return motionValue$1.animation;
}
function isSVGElement$1(element2) {
  return element2 instanceof SVGElement && element2.tagName !== "svg";
}
const compareByDepth = (a2, b2) => a2.depth - b2.depth;
class FlatTree {
  constructor() {
    this.children = [];
    this.isDirty = false;
  }
  add(child) {
    addUniqueItem(this.children, child);
    this.isDirty = true;
  }
  remove(child) {
    removeItem(this.children, child);
    this.isDirty = true;
  }
  forEach(callback2) {
    this.isDirty && this.children.sort(compareByDepth);
    this.isDirty = false;
    this.children.forEach(callback2);
  }
}
function delay$1(callback2, timeout) {
  const start2 = time.now();
  const checkElapsed = ({ timestamp }) => {
    const elapsed = timestamp - start2;
    if (elapsed >= timeout) {
      cancelFrame(checkElapsed);
      callback2(elapsed - timeout);
    }
  };
  frame.read(checkElapsed, true);
  return () => cancelFrame(checkElapsed);
}
const borders = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"];
const numBorders = borders.length;
const asNumber = (value2) => typeof value2 === "string" ? parseFloat(value2) : value2;
const isPx = (value2) => typeof value2 === "number" || px.test(value2);
function mixValues(target, follow, lead, progress2, shouldCrossfadeOpacity, isOnlyMember) {
  if (shouldCrossfadeOpacity) {
    target.opacity = mixNumber$1(
      0,
      // TODO Reinstate this if only child
      lead.opacity !== void 0 ? lead.opacity : 1,
      easeCrossfadeIn(progress2)
    );
    target.opacityExit = mixNumber$1(follow.opacity !== void 0 ? follow.opacity : 1, 0, easeCrossfadeOut(progress2));
  } else if (isOnlyMember) {
    target.opacity = mixNumber$1(follow.opacity !== void 0 ? follow.opacity : 1, lead.opacity !== void 0 ? lead.opacity : 1, progress2);
  }
  for (let i2 = 0; i2 < numBorders; i2++) {
    const borderLabel = `border${borders[i2]}Radius`;
    let followRadius = getRadius(follow, borderLabel);
    let leadRadius = getRadius(lead, borderLabel);
    if (followRadius === void 0 && leadRadius === void 0)
      continue;
    followRadius || (followRadius = 0);
    leadRadius || (leadRadius = 0);
    const canMix = followRadius === 0 || leadRadius === 0 || isPx(followRadius) === isPx(leadRadius);
    if (canMix) {
      target[borderLabel] = Math.max(mixNumber$1(asNumber(followRadius), asNumber(leadRadius), progress2), 0);
      if (percent.test(leadRadius) || percent.test(followRadius)) {
        target[borderLabel] += "%";
      }
    } else {
      target[borderLabel] = leadRadius;
    }
  }
  if (follow.rotate || lead.rotate) {
    target.rotate = mixNumber$1(follow.rotate || 0, lead.rotate || 0, progress2);
  }
}
function getRadius(values, radiusName) {
  return values[radiusName] !== void 0 ? values[radiusName] : values.borderRadius;
}
const easeCrossfadeIn = /* @__PURE__ */ compress(0, 0.5, circOut);
const easeCrossfadeOut = /* @__PURE__ */ compress(0.5, 0.95, noop$9);
function compress(min2, max2, easing) {
  return (p2) => {
    if (p2 < min2)
      return 0;
    if (p2 > max2)
      return 1;
    return easing(/* @__PURE__ */ progress$1(min2, max2, p2));
  };
}
function copyAxisInto(axis, originAxis) {
  axis.min = originAxis.min;
  axis.max = originAxis.max;
}
function copyBoxInto(box, originBox) {
  copyAxisInto(box.x, originBox.x);
  copyAxisInto(box.y, originBox.y);
}
function copyAxisDeltaInto(delta, originDelta) {
  delta.translate = originDelta.translate;
  delta.scale = originDelta.scale;
  delta.originPoint = originDelta.originPoint;
  delta.origin = originDelta.origin;
}
function removePointDelta(point2, translate, scale2, originPoint, boxScale) {
  point2 -= translate;
  point2 = scalePoint(point2, 1 / scale2, originPoint);
  if (boxScale !== void 0) {
    point2 = scalePoint(point2, 1 / boxScale, originPoint);
  }
  return point2;
}
function removeAxisDelta(axis, translate = 0, scale2 = 1, origin2 = 0.5, boxScale, originAxis = axis, sourceAxis = axis) {
  if (percent.test(translate)) {
    translate = parseFloat(translate);
    const relativeProgress = mixNumber$1(sourceAxis.min, sourceAxis.max, translate / 100);
    translate = relativeProgress - sourceAxis.min;
  }
  if (typeof translate !== "number")
    return;
  let originPoint = mixNumber$1(originAxis.min, originAxis.max, origin2);
  if (axis === originAxis)
    originPoint -= translate;
  axis.min = removePointDelta(axis.min, translate, scale2, originPoint, boxScale);
  axis.max = removePointDelta(axis.max, translate, scale2, originPoint, boxScale);
}
function removeAxisTransforms(axis, transforms2, [key, scaleKey, originKey], origin2, sourceAxis) {
  removeAxisDelta(axis, transforms2[key], transforms2[scaleKey], transforms2[originKey], transforms2.scale, origin2, sourceAxis);
}
const xKeys = ["x", "scaleX", "originX"];
const yKeys = ["y", "scaleY", "originY"];
function removeBoxTransforms(box, transforms2, originBox, sourceBox) {
  removeAxisTransforms(box.x, transforms2, xKeys, originBox ? originBox.x : void 0, sourceBox ? sourceBox.x : void 0);
  removeAxisTransforms(box.y, transforms2, yKeys, originBox ? originBox.y : void 0, sourceBox ? sourceBox.y : void 0);
}
function isAxisDeltaZero(delta) {
  return delta.translate === 0 && delta.scale === 1;
}
function isDeltaZero(delta) {
  return isAxisDeltaZero(delta.x) && isAxisDeltaZero(delta.y);
}
function axisEquals(a2, b2) {
  return a2.min === b2.min && a2.max === b2.max;
}
function boxEquals(a2, b2) {
  return axisEquals(a2.x, b2.x) && axisEquals(a2.y, b2.y);
}
function axisEqualsRounded(a2, b2) {
  return Math.round(a2.min) === Math.round(b2.min) && Math.round(a2.max) === Math.round(b2.max);
}
function boxEqualsRounded(a2, b2) {
  return axisEqualsRounded(a2.x, b2.x) && axisEqualsRounded(a2.y, b2.y);
}
function aspectRatio(box) {
  return calcLength(box.x) / calcLength(box.y);
}
function axisDeltaEquals(a2, b2) {
  return a2.translate === b2.translate && a2.scale === b2.scale && a2.originPoint === b2.originPoint;
}
class NodeStack {
  constructor() {
    this.members = [];
  }
  add(node2) {
    addUniqueItem(this.members, node2);
    node2.scheduleRender();
  }
  remove(node2) {
    removeItem(this.members, node2);
    if (node2 === this.prevLead) {
      this.prevLead = void 0;
    }
    if (node2 === this.lead) {
      const prevLead = this.members[this.members.length - 1];
      if (prevLead) {
        this.promote(prevLead);
      }
    }
  }
  relegate(node2) {
    const indexOfNode2 = this.members.findIndex((member) => node2 === member);
    if (indexOfNode2 === 0)
      return false;
    let prevLead;
    for (let i2 = indexOfNode2; i2 >= 0; i2--) {
      const member = this.members[i2];
      if (member.isPresent !== false) {
        prevLead = member;
        break;
      }
    }
    if (prevLead) {
      this.promote(prevLead);
      return true;
    } else {
      return false;
    }
  }
  promote(node2, preserveFollowOpacity) {
    const prevLead = this.lead;
    if (node2 === prevLead)
      return;
    this.prevLead = prevLead;
    this.lead = node2;
    node2.show();
    if (prevLead) {
      prevLead.instance && prevLead.scheduleRender();
      node2.scheduleRender();
      node2.resumeFrom = prevLead;
      if (preserveFollowOpacity) {
        node2.resumeFrom.preserveOpacity = true;
      }
      if (prevLead.snapshot) {
        node2.snapshot = prevLead.snapshot;
        node2.snapshot.latestValues = prevLead.animationValues || prevLead.latestValues;
      }
      if (node2.root && node2.root.isUpdating) {
        node2.isLayoutDirty = true;
      }
      const { crossfade } = node2.options;
      if (crossfade === false) {
        prevLead.hide();
      }
    }
  }
  exitAnimationComplete() {
    this.members.forEach((node2) => {
      const { options, resumingFrom } = node2;
      options.onExitComplete && options.onExitComplete();
      if (resumingFrom) {
        resumingFrom.options.onExitComplete && resumingFrom.options.onExitComplete();
      }
    });
  }
  scheduleRender() {
    this.members.forEach((node2) => {
      node2.instance && node2.scheduleRender(false);
    });
  }
  /**
   * Clear any leads that have been removed this render to prevent them from being
   * used in future animations and to prevent memory leaks
   */
  removeLeadSnapshot() {
    if (this.lead && this.lead.snapshot) {
      this.lead.snapshot = void 0;
    }
  }
}
function buildProjectionTransform(delta, treeScale, latestTransform) {
  let transform2 = "";
  const xTranslate = delta.x.translate / treeScale.x;
  const yTranslate = delta.y.translate / treeScale.y;
  const zTranslate = (latestTransform === null || latestTransform === void 0 ? void 0 : latestTransform.z) || 0;
  if (xTranslate || yTranslate || zTranslate) {
    transform2 = `translate3d(${xTranslate}px, ${yTranslate}px, ${zTranslate}px) `;
  }
  if (treeScale.x !== 1 || treeScale.y !== 1) {
    transform2 += `scale(${1 / treeScale.x}, ${1 / treeScale.y}) `;
  }
  if (latestTransform) {
    const { transformPerspective, rotate: rotate2, rotateX, rotateY, skewX, skewY } = latestTransform;
    if (transformPerspective)
      transform2 = `perspective(${transformPerspective}px) ${transform2}`;
    if (rotate2)
      transform2 += `rotate(${rotate2}deg) `;
    if (rotateX)
      transform2 += `rotateX(${rotateX}deg) `;
    if (rotateY)
      transform2 += `rotateY(${rotateY}deg) `;
    if (skewX)
      transform2 += `skewX(${skewX}deg) `;
    if (skewY)
      transform2 += `skewY(${skewY}deg) `;
  }
  const elementScaleX = delta.x.scale * treeScale.x;
  const elementScaleY = delta.y.scale * treeScale.y;
  if (elementScaleX !== 1 || elementScaleY !== 1) {
    transform2 += `scale(${elementScaleX}, ${elementScaleY})`;
  }
  return transform2 || "none";
}
const metrics = {
  type: "projectionFrame",
  totalNodes: 0,
  resolvedTargetDeltas: 0,
  recalculatedProjection: 0
};
const isDebug = typeof window !== "undefined" && window.MotionDebug !== void 0;
const transformAxes = ["", "X", "Y", "Z"];
const hiddenVisibility = { visibility: "hidden" };
const animationTarget = 1e3;
let id$1 = 0;
function resetDistortingTransform(key, visualElement, values, sharedAnimationValues) {
  const { latestValues } = visualElement;
  if (latestValues[key]) {
    values[key] = latestValues[key];
    visualElement.setStaticValue(key, 0);
    if (sharedAnimationValues) {
      sharedAnimationValues[key] = 0;
    }
  }
}
function cancelTreeOptimisedTransformAnimations(projectionNode) {
  projectionNode.hasCheckedOptimisedAppear = true;
  if (projectionNode.root === projectionNode)
    return;
  const { visualElement } = projectionNode.options;
  if (!visualElement)
    return;
  const appearId = getOptimisedAppearId(visualElement);
  if (window.MotionHasOptimisedAnimation(appearId, "transform")) {
    const { layout: layout2, layoutId } = projectionNode.options;
    window.MotionCancelOptimisedAnimation(appearId, "transform", frame, !(layout2 || layoutId));
  }
  const { parent } = projectionNode;
  if (parent && !parent.hasCheckedOptimisedAppear) {
    cancelTreeOptimisedTransformAnimations(parent);
  }
}
function createProjectionNode({ attachResizeListener, defaultParent, measureScroll, checkIsScrollRoot, resetTransform }) {
  return class ProjectionNode {
    constructor(latestValues = {}, parent = defaultParent === null || defaultParent === void 0 ? void 0 : defaultParent()) {
      this.id = id$1++;
      this.animationId = 0;
      this.children = /* @__PURE__ */ new Set();
      this.options = {};
      this.isTreeAnimating = false;
      this.isAnimationBlocked = false;
      this.isLayoutDirty = false;
      this.isProjectionDirty = false;
      this.isSharedProjectionDirty = false;
      this.isTransformDirty = false;
      this.updateManuallyBlocked = false;
      this.updateBlockedByResize = false;
      this.isUpdating = false;
      this.isSVG = false;
      this.needsReset = false;
      this.shouldResetTransform = false;
      this.hasCheckedOptimisedAppear = false;
      this.treeScale = { x: 1, y: 1 };
      this.eventHandlers = /* @__PURE__ */ new Map();
      this.hasTreeAnimated = false;
      this.updateScheduled = false;
      this.scheduleUpdate = () => this.update();
      this.projectionUpdateScheduled = false;
      this.checkUpdateFailed = () => {
        if (this.isUpdating) {
          this.isUpdating = false;
          this.clearAllSnapshots();
        }
      };
      this.updateProjection = () => {
        this.projectionUpdateScheduled = false;
        if (isDebug) {
          metrics.totalNodes = metrics.resolvedTargetDeltas = metrics.recalculatedProjection = 0;
        }
        this.nodes.forEach(propagateDirtyNodes);
        this.nodes.forEach(resolveTargetDelta);
        this.nodes.forEach(calcProjection);
        this.nodes.forEach(cleanDirtyNodes);
        if (isDebug) {
          window.MotionDebug.record(metrics);
        }
      };
      this.resolvedRelativeTargetAt = 0;
      this.hasProjected = false;
      this.isVisible = true;
      this.animationProgress = 0;
      this.sharedNodes = /* @__PURE__ */ new Map();
      this.latestValues = latestValues;
      this.root = parent ? parent.root || parent : this;
      this.path = parent ? [...parent.path, parent] : [];
      this.parent = parent;
      this.depth = parent ? parent.depth + 1 : 0;
      for (let i2 = 0; i2 < this.path.length; i2++) {
        this.path[i2].shouldResetTransform = true;
      }
      if (this.root === this)
        this.nodes = new FlatTree();
    }
    addEventListener(name2, handler) {
      if (!this.eventHandlers.has(name2)) {
        this.eventHandlers.set(name2, new SubscriptionManager());
      }
      return this.eventHandlers.get(name2).add(handler);
    }
    notifyListeners(name2, ...args) {
      const subscriptionManager = this.eventHandlers.get(name2);
      subscriptionManager && subscriptionManager.notify(...args);
    }
    hasListeners(name2) {
      return this.eventHandlers.has(name2);
    }
    /**
     * Lifecycles
     */
    mount(instance2, isLayoutDirty = this.root.hasTreeAnimated) {
      if (this.instance)
        return;
      this.isSVG = isSVGElement$1(instance2);
      this.instance = instance2;
      const { layoutId, layout: layout2, visualElement } = this.options;
      if (visualElement && !visualElement.current) {
        visualElement.mount(instance2);
      }
      this.root.nodes.add(this);
      this.parent && this.parent.children.add(this);
      if (isLayoutDirty && (layout2 || layoutId)) {
        this.isLayoutDirty = true;
      }
      if (attachResizeListener) {
        let cancelDelay;
        const resizeUnblockUpdate = () => this.root.updateBlockedByResize = false;
        attachResizeListener(instance2, () => {
          this.root.updateBlockedByResize = true;
          cancelDelay && cancelDelay();
          cancelDelay = delay$1(resizeUnblockUpdate, 250);
          if (globalProjectionState.hasAnimatedSinceResize) {
            globalProjectionState.hasAnimatedSinceResize = false;
            this.nodes.forEach(finishAnimation);
          }
        });
      }
      if (layoutId) {
        this.root.registerSharedNode(layoutId, this);
      }
      if (this.options.animate !== false && visualElement && (layoutId || layout2)) {
        this.addEventListener("didUpdate", ({ delta, hasLayoutChanged, hasRelativeTargetChanged, layout: newLayout }) => {
          if (this.isTreeAnimationBlocked()) {
            this.target = void 0;
            this.relativeTarget = void 0;
            return;
          }
          const layoutTransition = this.options.transition || visualElement.getDefaultTransition() || defaultLayoutTransition;
          const { onLayoutAnimationStart, onLayoutAnimationComplete } = visualElement.getProps();
          const targetChanged = !this.targetLayout || !boxEqualsRounded(this.targetLayout, newLayout) || hasRelativeTargetChanged;
          const hasOnlyRelativeTargetChanged = !hasLayoutChanged && hasRelativeTargetChanged;
          if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || hasOnlyRelativeTargetChanged || hasLayoutChanged && (targetChanged || !this.currentAnimation)) {
            if (this.resumeFrom) {
              this.resumingFrom = this.resumeFrom;
              this.resumingFrom.resumingFrom = void 0;
            }
            this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);
            const animationOptions = {
              ...getValueTransition(layoutTransition, "layout"),
              onPlay: onLayoutAnimationStart,
              onComplete: onLayoutAnimationComplete
            };
            if (visualElement.shouldReduceMotion || this.options.layoutRoot) {
              animationOptions.delay = 0;
              animationOptions.type = false;
            }
            this.startAnimation(animationOptions);
          } else {
            if (!hasLayoutChanged) {
              finishAnimation(this);
            }
            if (this.isLead() && this.options.onExitComplete) {
              this.options.onExitComplete();
            }
          }
          this.targetLayout = newLayout;
        });
      }
    }
    unmount() {
      this.options.layoutId && this.willUpdate();
      this.root.nodes.remove(this);
      const stack = this.getStack();
      stack && stack.remove(this);
      this.parent && this.parent.children.delete(this);
      this.instance = void 0;
      cancelFrame(this.updateProjection);
    }
    // only on the root
    blockUpdate() {
      this.updateManuallyBlocked = true;
    }
    unblockUpdate() {
      this.updateManuallyBlocked = false;
    }
    isUpdateBlocked() {
      return this.updateManuallyBlocked || this.updateBlockedByResize;
    }
    isTreeAnimationBlocked() {
      return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || false;
    }
    // Note: currently only running on root node
    startUpdate() {
      if (this.isUpdateBlocked())
        return;
      this.isUpdating = true;
      this.nodes && this.nodes.forEach(resetSkewAndRotation);
      this.animationId++;
    }
    getTransformTemplate() {
      const { visualElement } = this.options;
      return visualElement && visualElement.getProps().transformTemplate;
    }
    willUpdate(shouldNotifyListeners = true) {
      this.root.hasTreeAnimated = true;
      if (this.root.isUpdateBlocked()) {
        this.options.onExitComplete && this.options.onExitComplete();
        return;
      }
      if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear) {
        cancelTreeOptimisedTransformAnimations(this);
      }
      !this.root.isUpdating && this.root.startUpdate();
      if (this.isLayoutDirty)
        return;
      this.isLayoutDirty = true;
      for (let i2 = 0; i2 < this.path.length; i2++) {
        const node2 = this.path[i2];
        node2.shouldResetTransform = true;
        node2.updateScroll("snapshot");
        if (node2.options.layoutRoot) {
          node2.willUpdate(false);
        }
      }
      const { layoutId, layout: layout2 } = this.options;
      if (layoutId === void 0 && !layout2)
        return;
      const transformTemplate = this.getTransformTemplate();
      this.prevTransformTemplateValue = transformTemplate ? transformTemplate(this.latestValues, "") : void 0;
      this.updateSnapshot();
      shouldNotifyListeners && this.notifyListeners("willUpdate");
    }
    update() {
      this.updateScheduled = false;
      const updateWasBlocked = this.isUpdateBlocked();
      if (updateWasBlocked) {
        this.unblockUpdate();
        this.clearAllSnapshots();
        this.nodes.forEach(clearMeasurements);
        return;
      }
      if (!this.isUpdating) {
        this.nodes.forEach(clearIsLayoutDirty);
      }
      this.isUpdating = false;
      this.nodes.forEach(resetTransformStyle);
      this.nodes.forEach(updateLayout);
      this.nodes.forEach(notifyLayoutUpdate);
      this.clearAllSnapshots();
      const now2 = time.now();
      frameData.delta = clamp$1(0, 1e3 / 60, now2 - frameData.timestamp);
      frameData.timestamp = now2;
      frameData.isProcessing = true;
      frameSteps.update.process(frameData);
      frameSteps.preRender.process(frameData);
      frameSteps.render.process(frameData);
      frameData.isProcessing = false;
    }
    didUpdate() {
      if (!this.updateScheduled) {
        this.updateScheduled = true;
        microtask.read(this.scheduleUpdate);
      }
    }
    clearAllSnapshots() {
      this.nodes.forEach(clearSnapshot);
      this.sharedNodes.forEach(removeLeadSnapshots);
    }
    scheduleUpdateProjection() {
      if (!this.projectionUpdateScheduled) {
        this.projectionUpdateScheduled = true;
        frame.preRender(this.updateProjection, false, true);
      }
    }
    scheduleCheckAfterUnmount() {
      frame.postRender(() => {
        if (this.isLayoutDirty) {
          this.root.didUpdate();
        } else {
          this.root.checkUpdateFailed();
        }
      });
    }
    /**
     * Update measurements
     */
    updateSnapshot() {
      if (this.snapshot || !this.instance)
        return;
      this.snapshot = this.measure();
    }
    updateLayout() {
      if (!this.instance)
        return;
      this.updateScroll();
      if (!(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty) {
        return;
      }
      if (this.resumeFrom && !this.resumeFrom.instance) {
        for (let i2 = 0; i2 < this.path.length; i2++) {
          const node2 = this.path[i2];
          node2.updateScroll();
        }
      }
      const prevLayout = this.layout;
      this.layout = this.measure(false);
      this.layoutCorrected = createBox();
      this.isLayoutDirty = false;
      this.projectionDelta = void 0;
      this.notifyListeners("measure", this.layout.layoutBox);
      const { visualElement } = this.options;
      visualElement && visualElement.notify("LayoutMeasure", this.layout.layoutBox, prevLayout ? prevLayout.layoutBox : void 0);
    }
    updateScroll(phase = "measure") {
      let needsMeasurement = Boolean(this.options.layoutScroll && this.instance);
      if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === phase) {
        needsMeasurement = false;
      }
      if (needsMeasurement) {
        const isRoot = checkIsScrollRoot(this.instance);
        this.scroll = {
          animationId: this.root.animationId,
          phase,
          isRoot,
          offset: measureScroll(this.instance),
          wasRoot: this.scroll ? this.scroll.isRoot : isRoot
        };
      }
    }
    resetTransform() {
      if (!resetTransform)
        return;
      const isResetRequested = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout;
      const hasProjection = this.projectionDelta && !isDeltaZero(this.projectionDelta);
      const transformTemplate = this.getTransformTemplate();
      const transformTemplateValue = transformTemplate ? transformTemplate(this.latestValues, "") : void 0;
      const transformTemplateHasChanged = transformTemplateValue !== this.prevTransformTemplateValue;
      if (isResetRequested && (hasProjection || hasTransform(this.latestValues) || transformTemplateHasChanged)) {
        resetTransform(this.instance, transformTemplateValue);
        this.shouldResetTransform = false;
        this.scheduleRender();
      }
    }
    measure(removeTransform = true) {
      const pageBox = this.measurePageBox();
      let layoutBox = this.removeElementScroll(pageBox);
      if (removeTransform) {
        layoutBox = this.removeTransform(layoutBox);
      }
      roundBox(layoutBox);
      return {
        animationId: this.root.animationId,
        measuredBox: pageBox,
        layoutBox,
        latestValues: {},
        source: this.id
      };
    }
    measurePageBox() {
      var _a2;
      const { visualElement } = this.options;
      if (!visualElement)
        return createBox();
      const box = visualElement.measureViewportBox();
      const wasInScrollRoot = ((_a2 = this.scroll) === null || _a2 === void 0 ? void 0 : _a2.wasRoot) || this.path.some(checkNodeWasScrollRoot);
      if (!wasInScrollRoot) {
        const { scroll } = this.root;
        if (scroll) {
          translateAxis(box.x, scroll.offset.x);
          translateAxis(box.y, scroll.offset.y);
        }
      }
      return box;
    }
    removeElementScroll(box) {
      var _a2;
      const boxWithoutScroll = createBox();
      copyBoxInto(boxWithoutScroll, box);
      if ((_a2 = this.scroll) === null || _a2 === void 0 ? void 0 : _a2.wasRoot) {
        return boxWithoutScroll;
      }
      for (let i2 = 0; i2 < this.path.length; i2++) {
        const node2 = this.path[i2];
        const { scroll, options } = node2;
        if (node2 !== this.root && scroll && options.layoutScroll) {
          if (scroll.wasRoot) {
            copyBoxInto(boxWithoutScroll, box);
          }
          translateAxis(boxWithoutScroll.x, scroll.offset.x);
          translateAxis(boxWithoutScroll.y, scroll.offset.y);
        }
      }
      return boxWithoutScroll;
    }
    applyTransform(box, transformOnly = false) {
      const withTransforms = createBox();
      copyBoxInto(withTransforms, box);
      for (let i2 = 0; i2 < this.path.length; i2++) {
        const node2 = this.path[i2];
        if (!transformOnly && node2.options.layoutScroll && node2.scroll && node2 !== node2.root) {
          transformBox(withTransforms, {
            x: -node2.scroll.offset.x,
            y: -node2.scroll.offset.y
          });
        }
        if (!hasTransform(node2.latestValues))
          continue;
        transformBox(withTransforms, node2.latestValues);
      }
      if (hasTransform(this.latestValues)) {
        transformBox(withTransforms, this.latestValues);
      }
      return withTransforms;
    }
    removeTransform(box) {
      const boxWithoutTransform = createBox();
      copyBoxInto(boxWithoutTransform, box);
      for (let i2 = 0; i2 < this.path.length; i2++) {
        const node2 = this.path[i2];
        if (!node2.instance)
          continue;
        if (!hasTransform(node2.latestValues))
          continue;
        hasScale(node2.latestValues) && node2.updateSnapshot();
        const sourceBox = createBox();
        const nodeBox = node2.measurePageBox();
        copyBoxInto(sourceBox, nodeBox);
        removeBoxTransforms(boxWithoutTransform, node2.latestValues, node2.snapshot ? node2.snapshot.layoutBox : void 0, sourceBox);
      }
      if (hasTransform(this.latestValues)) {
        removeBoxTransforms(boxWithoutTransform, this.latestValues);
      }
      return boxWithoutTransform;
    }
    setTargetDelta(delta) {
      this.targetDelta = delta;
      this.root.scheduleUpdateProjection();
      this.isProjectionDirty = true;
    }
    setOptions(options) {
      this.options = {
        ...this.options,
        ...options,
        crossfade: options.crossfade !== void 0 ? options.crossfade : true
      };
    }
    clearMeasurements() {
      this.scroll = void 0;
      this.layout = void 0;
      this.snapshot = void 0;
      this.prevTransformTemplateValue = void 0;
      this.targetDelta = void 0;
      this.target = void 0;
      this.isLayoutDirty = false;
    }
    forceRelativeParentToResolveTarget() {
      if (!this.relativeParent)
        return;
      if (this.relativeParent.resolvedRelativeTargetAt !== frameData.timestamp) {
        this.relativeParent.resolveTargetDelta(true);
      }
    }
    resolveTargetDelta(forceRecalculation = false) {
      var _a2;
      const lead = this.getLead();
      this.isProjectionDirty || (this.isProjectionDirty = lead.isProjectionDirty);
      this.isTransformDirty || (this.isTransformDirty = lead.isTransformDirty);
      this.isSharedProjectionDirty || (this.isSharedProjectionDirty = lead.isSharedProjectionDirty);
      const isShared = Boolean(this.resumingFrom) || this !== lead;
      const canSkip = !(forceRecalculation || isShared && this.isSharedProjectionDirty || this.isProjectionDirty || ((_a2 = this.parent) === null || _a2 === void 0 ? void 0 : _a2.isProjectionDirty) || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize);
      if (canSkip)
        return;
      const { layout: layout2, layoutId } = this.options;
      if (!this.layout || !(layout2 || layoutId))
        return;
      this.resolvedRelativeTargetAt = frameData.timestamp;
      if (!this.targetDelta && !this.relativeTarget) {
        const relativeParent = this.getClosestProjectingParent();
        if (relativeParent && relativeParent.layout && this.animationProgress !== 1) {
          this.relativeParent = relativeParent;
          this.forceRelativeParentToResolveTarget();
          this.relativeTarget = createBox();
          this.relativeTargetOrigin = createBox();
          calcRelativePosition(this.relativeTargetOrigin, this.layout.layoutBox, relativeParent.layout.layoutBox);
          copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
        } else {
          this.relativeParent = this.relativeTarget = void 0;
        }
      }
      if (!this.relativeTarget && !this.targetDelta)
        return;
      if (!this.target) {
        this.target = createBox();
        this.targetWithTransforms = createBox();
      }
      if (this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target) {
        this.forceRelativeParentToResolveTarget();
        calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target);
      } else if (this.targetDelta) {
        if (Boolean(this.resumingFrom)) {
          this.target = this.applyTransform(this.layout.layoutBox);
        } else {
          copyBoxInto(this.target, this.layout.layoutBox);
        }
        applyBoxDelta(this.target, this.targetDelta);
      } else {
        copyBoxInto(this.target, this.layout.layoutBox);
      }
      if (this.attemptToResolveRelativeTarget) {
        this.attemptToResolveRelativeTarget = false;
        const relativeParent = this.getClosestProjectingParent();
        if (relativeParent && Boolean(relativeParent.resumingFrom) === Boolean(this.resumingFrom) && !relativeParent.options.layoutScroll && relativeParent.target && this.animationProgress !== 1) {
          this.relativeParent = relativeParent;
          this.forceRelativeParentToResolveTarget();
          this.relativeTarget = createBox();
          this.relativeTargetOrigin = createBox();
          calcRelativePosition(this.relativeTargetOrigin, this.target, relativeParent.target);
          copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
        } else {
          this.relativeParent = this.relativeTarget = void 0;
        }
      }
      if (isDebug) {
        metrics.resolvedTargetDeltas++;
      }
    }
    getClosestProjectingParent() {
      if (!this.parent || hasScale(this.parent.latestValues) || has2DTranslate(this.parent.latestValues)) {
        return void 0;
      }
      if (this.parent.isProjecting()) {
        return this.parent;
      } else {
        return this.parent.getClosestProjectingParent();
      }
    }
    isProjecting() {
      return Boolean((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
    }
    calcProjection() {
      var _a2;
      const lead = this.getLead();
      const isShared = Boolean(this.resumingFrom) || this !== lead;
      let canSkip = true;
      if (this.isProjectionDirty || ((_a2 = this.parent) === null || _a2 === void 0 ? void 0 : _a2.isProjectionDirty)) {
        canSkip = false;
      }
      if (isShared && (this.isSharedProjectionDirty || this.isTransformDirty)) {
        canSkip = false;
      }
      if (this.resolvedRelativeTargetAt === frameData.timestamp) {
        canSkip = false;
      }
      if (canSkip)
        return;
      const { layout: layout2, layoutId } = this.options;
      this.isTreeAnimating = Boolean(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation);
      if (!this.isTreeAnimating) {
        this.targetDelta = this.relativeTarget = void 0;
      }
      if (!this.layout || !(layout2 || layoutId))
        return;
      copyBoxInto(this.layoutCorrected, this.layout.layoutBox);
      const prevTreeScaleX = this.treeScale.x;
      const prevTreeScaleY = this.treeScale.y;
      applyTreeDeltas(this.layoutCorrected, this.treeScale, this.path, isShared);
      if (lead.layout && !lead.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1)) {
        lead.target = lead.layout.layoutBox;
        lead.targetWithTransforms = createBox();
      }
      const { target } = lead;
      if (!target) {
        if (this.prevProjectionDelta) {
          this.createProjectionDeltas();
          this.scheduleRender();
        }
        return;
      }
      if (!this.projectionDelta || !this.prevProjectionDelta) {
        this.createProjectionDeltas();
      } else {
        copyAxisDeltaInto(this.prevProjectionDelta.x, this.projectionDelta.x);
        copyAxisDeltaInto(this.prevProjectionDelta.y, this.projectionDelta.y);
      }
      calcBoxDelta(this.projectionDelta, this.layoutCorrected, target, this.latestValues);
      if (this.treeScale.x !== prevTreeScaleX || this.treeScale.y !== prevTreeScaleY || !axisDeltaEquals(this.projectionDelta.x, this.prevProjectionDelta.x) || !axisDeltaEquals(this.projectionDelta.y, this.prevProjectionDelta.y)) {
        this.hasProjected = true;
        this.scheduleRender();
        this.notifyListeners("projectionUpdate", target);
      }
      if (isDebug) {
        metrics.recalculatedProjection++;
      }
    }
    hide() {
      this.isVisible = false;
    }
    show() {
      this.isVisible = true;
    }
    scheduleRender(notifyAll = true) {
      var _a2;
      (_a2 = this.options.visualElement) === null || _a2 === void 0 ? void 0 : _a2.scheduleRender();
      if (notifyAll) {
        const stack = this.getStack();
        stack && stack.scheduleRender();
      }
      if (this.resumingFrom && !this.resumingFrom.instance) {
        this.resumingFrom = void 0;
      }
    }
    createProjectionDeltas() {
      this.prevProjectionDelta = createDelta();
      this.projectionDelta = createDelta();
      this.projectionDeltaWithTransform = createDelta();
    }
    setAnimationOrigin(delta, hasOnlyRelativeTargetChanged = false) {
      const snapshot = this.snapshot;
      const snapshotLatestValues = snapshot ? snapshot.latestValues : {};
      const mixedValues = { ...this.latestValues };
      const targetDelta = createDelta();
      if (!this.relativeParent || !this.relativeParent.options.layoutRoot) {
        this.relativeTarget = this.relativeTargetOrigin = void 0;
      }
      this.attemptToResolveRelativeTarget = !hasOnlyRelativeTargetChanged;
      const relativeLayout = createBox();
      const snapshotSource = snapshot ? snapshot.source : void 0;
      const layoutSource = this.layout ? this.layout.source : void 0;
      const isSharedLayoutAnimation = snapshotSource !== layoutSource;
      const stack = this.getStack();
      const isOnlyMember = !stack || stack.members.length <= 1;
      const shouldCrossfadeOpacity = Boolean(isSharedLayoutAnimation && !isOnlyMember && this.options.crossfade === true && !this.path.some(hasOpacityCrossfade));
      this.animationProgress = 0;
      let prevRelativeTarget;
      this.mixTargetDelta = (latest) => {
        const progress2 = latest / 1e3;
        mixAxisDelta(targetDelta.x, delta.x, progress2);
        mixAxisDelta(targetDelta.y, delta.y, progress2);
        this.setTargetDelta(targetDelta);
        if (this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout) {
          calcRelativePosition(relativeLayout, this.layout.layoutBox, this.relativeParent.layout.layoutBox);
          mixBox(this.relativeTarget, this.relativeTargetOrigin, relativeLayout, progress2);
          if (prevRelativeTarget && boxEquals(this.relativeTarget, prevRelativeTarget)) {
            this.isProjectionDirty = false;
          }
          if (!prevRelativeTarget)
            prevRelativeTarget = createBox();
          copyBoxInto(prevRelativeTarget, this.relativeTarget);
        }
        if (isSharedLayoutAnimation) {
          this.animationValues = mixedValues;
          mixValues(mixedValues, snapshotLatestValues, this.latestValues, progress2, shouldCrossfadeOpacity, isOnlyMember);
        }
        this.root.scheduleUpdateProjection();
        this.scheduleRender();
        this.animationProgress = progress2;
      };
      this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
    }
    startAnimation(options) {
      this.notifyListeners("animationStart");
      this.currentAnimation && this.currentAnimation.stop();
      if (this.resumingFrom && this.resumingFrom.currentAnimation) {
        this.resumingFrom.currentAnimation.stop();
      }
      if (this.pendingAnimation) {
        cancelFrame(this.pendingAnimation);
        this.pendingAnimation = void 0;
      }
      this.pendingAnimation = frame.update(() => {
        globalProjectionState.hasAnimatedSinceResize = true;
        this.currentAnimation = animateSingleValue(0, animationTarget, {
          ...options,
          onUpdate: (latest) => {
            this.mixTargetDelta(latest);
            options.onUpdate && options.onUpdate(latest);
          },
          onComplete: () => {
            options.onComplete && options.onComplete();
            this.completeAnimation();
          }
        });
        if (this.resumingFrom) {
          this.resumingFrom.currentAnimation = this.currentAnimation;
        }
        this.pendingAnimation = void 0;
      });
    }
    completeAnimation() {
      if (this.resumingFrom) {
        this.resumingFrom.currentAnimation = void 0;
        this.resumingFrom.preserveOpacity = void 0;
      }
      const stack = this.getStack();
      stack && stack.exitAnimationComplete();
      this.resumingFrom = this.currentAnimation = this.animationValues = void 0;
      this.notifyListeners("animationComplete");
    }
    finishAnimation() {
      if (this.currentAnimation) {
        this.mixTargetDelta && this.mixTargetDelta(animationTarget);
        this.currentAnimation.stop();
      }
      this.completeAnimation();
    }
    applyTransformsToTarget() {
      const lead = this.getLead();
      let { targetWithTransforms, target, layout: layout2, latestValues } = lead;
      if (!targetWithTransforms || !target || !layout2)
        return;
      if (this !== lead && this.layout && layout2 && shouldAnimatePositionOnly(this.options.animationType, this.layout.layoutBox, layout2.layoutBox)) {
        target = this.target || createBox();
        const xLength = calcLength(this.layout.layoutBox.x);
        target.x.min = lead.target.x.min;
        target.x.max = target.x.min + xLength;
        const yLength = calcLength(this.layout.layoutBox.y);
        target.y.min = lead.target.y.min;
        target.y.max = target.y.min + yLength;
      }
      copyBoxInto(targetWithTransforms, target);
      transformBox(targetWithTransforms, latestValues);
      calcBoxDelta(this.projectionDeltaWithTransform, this.layoutCorrected, targetWithTransforms, latestValues);
    }
    registerSharedNode(layoutId, node2) {
      if (!this.sharedNodes.has(layoutId)) {
        this.sharedNodes.set(layoutId, new NodeStack());
      }
      const stack = this.sharedNodes.get(layoutId);
      stack.add(node2);
      const config2 = node2.options.initialPromotionConfig;
      node2.promote({
        transition: config2 ? config2.transition : void 0,
        preserveFollowOpacity: config2 && config2.shouldPreserveFollowOpacity ? config2.shouldPreserveFollowOpacity(node2) : void 0
      });
    }
    isLead() {
      const stack = this.getStack();
      return stack ? stack.lead === this : true;
    }
    getLead() {
      var _a2;
      const { layoutId } = this.options;
      return layoutId ? ((_a2 = this.getStack()) === null || _a2 === void 0 ? void 0 : _a2.lead) || this : this;
    }
    getPrevLead() {
      var _a2;
      const { layoutId } = this.options;
      return layoutId ? (_a2 = this.getStack()) === null || _a2 === void 0 ? void 0 : _a2.prevLead : void 0;
    }
    getStack() {
      const { layoutId } = this.options;
      if (layoutId)
        return this.root.sharedNodes.get(layoutId);
    }
    promote({ needsReset, transition: transition3, preserveFollowOpacity } = {}) {
      const stack = this.getStack();
      if (stack)
        stack.promote(this, preserveFollowOpacity);
      if (needsReset) {
        this.projectionDelta = void 0;
        this.needsReset = true;
      }
      if (transition3)
        this.setOptions({ transition: transition3 });
    }
    relegate() {
      const stack = this.getStack();
      if (stack) {
        return stack.relegate(this);
      } else {
        return false;
      }
    }
    resetSkewAndRotation() {
      const { visualElement } = this.options;
      if (!visualElement)
        return;
      let hasDistortingTransform = false;
      const { latestValues } = visualElement;
      if (latestValues.z || latestValues.rotate || latestValues.rotateX || latestValues.rotateY || latestValues.rotateZ || latestValues.skewX || latestValues.skewY) {
        hasDistortingTransform = true;
      }
      if (!hasDistortingTransform)
        return;
      const resetValues = {};
      if (latestValues.z) {
        resetDistortingTransform("z", visualElement, resetValues, this.animationValues);
      }
      for (let i2 = 0; i2 < transformAxes.length; i2++) {
        resetDistortingTransform(`rotate${transformAxes[i2]}`, visualElement, resetValues, this.animationValues);
        resetDistortingTransform(`skew${transformAxes[i2]}`, visualElement, resetValues, this.animationValues);
      }
      visualElement.render();
      for (const key in resetValues) {
        visualElement.setStaticValue(key, resetValues[key]);
        if (this.animationValues) {
          this.animationValues[key] = resetValues[key];
        }
      }
      visualElement.scheduleRender();
    }
    getProjectionStyles(styleProp) {
      var _a2, _b2;
      if (!this.instance || this.isSVG)
        return void 0;
      if (!this.isVisible) {
        return hiddenVisibility;
      }
      const styles2 = {
        visibility: ""
      };
      const transformTemplate = this.getTransformTemplate();
      if (this.needsReset) {
        this.needsReset = false;
        styles2.opacity = "";
        styles2.pointerEvents = resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "";
        styles2.transform = transformTemplate ? transformTemplate(this.latestValues, "") : "none";
        return styles2;
      }
      const lead = this.getLead();
      if (!this.projectionDelta || !this.layout || !lead.target) {
        const emptyStyles = {};
        if (this.options.layoutId) {
          emptyStyles.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1;
          emptyStyles.pointerEvents = resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "";
        }
        if (this.hasProjected && !hasTransform(this.latestValues)) {
          emptyStyles.transform = transformTemplate ? transformTemplate({}, "") : "none";
          this.hasProjected = false;
        }
        return emptyStyles;
      }
      const valuesToRender = lead.animationValues || lead.latestValues;
      this.applyTransformsToTarget();
      styles2.transform = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, valuesToRender);
      if (transformTemplate) {
        styles2.transform = transformTemplate(valuesToRender, styles2.transform);
      }
      const { x: x2, y: y2 } = this.projectionDelta;
      styles2.transformOrigin = `${x2.origin * 100}% ${y2.origin * 100}% 0`;
      if (lead.animationValues) {
        styles2.opacity = lead === this ? (_b2 = (_a2 = valuesToRender.opacity) !== null && _a2 !== void 0 ? _a2 : this.latestValues.opacity) !== null && _b2 !== void 0 ? _b2 : 1 : this.preserveOpacity ? this.latestValues.opacity : valuesToRender.opacityExit;
      } else {
        styles2.opacity = lead === this ? valuesToRender.opacity !== void 0 ? valuesToRender.opacity : "" : valuesToRender.opacityExit !== void 0 ? valuesToRender.opacityExit : 0;
      }
      for (const key in scaleCorrectors) {
        if (valuesToRender[key] === void 0)
          continue;
        const { correct, applyTo } = scaleCorrectors[key];
        const corrected = styles2.transform === "none" ? valuesToRender[key] : correct(valuesToRender[key], lead);
        if (applyTo) {
          const num = applyTo.length;
          for (let i2 = 0; i2 < num; i2++) {
            styles2[applyTo[i2]] = corrected;
          }
        } else {
          styles2[key] = corrected;
        }
      }
      if (this.options.layoutId) {
        styles2.pointerEvents = lead === this ? resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "" : "none";
      }
      return styles2;
    }
    clearSnapshot() {
      this.resumeFrom = this.snapshot = void 0;
    }
    // Only run on root
    resetTree() {
      this.root.nodes.forEach((node2) => {
        var _a2;
        return (_a2 = node2.currentAnimation) === null || _a2 === void 0 ? void 0 : _a2.stop();
      });
      this.root.nodes.forEach(clearMeasurements);
      this.root.sharedNodes.clear();
    }
  };
}
function updateLayout(node2) {
  node2.updateLayout();
}
function notifyLayoutUpdate(node2) {
  var _a2;
  const snapshot = ((_a2 = node2.resumeFrom) === null || _a2 === void 0 ? void 0 : _a2.snapshot) || node2.snapshot;
  if (node2.isLead() && node2.layout && snapshot && node2.hasListeners("didUpdate")) {
    const { layoutBox: layout2, measuredBox: measuredLayout } = node2.layout;
    const { animationType } = node2.options;
    const isShared = snapshot.source !== node2.layout.source;
    if (animationType === "size") {
      eachAxis((axis) => {
        const axisSnapshot = isShared ? snapshot.measuredBox[axis] : snapshot.layoutBox[axis];
        const length2 = calcLength(axisSnapshot);
        axisSnapshot.min = layout2[axis].min;
        axisSnapshot.max = axisSnapshot.min + length2;
      });
    } else if (shouldAnimatePositionOnly(animationType, snapshot.layoutBox, layout2)) {
      eachAxis((axis) => {
        const axisSnapshot = isShared ? snapshot.measuredBox[axis] : snapshot.layoutBox[axis];
        const length2 = calcLength(layout2[axis]);
        axisSnapshot.max = axisSnapshot.min + length2;
        if (node2.relativeTarget && !node2.currentAnimation) {
          node2.isProjectionDirty = true;
          node2.relativeTarget[axis].max = node2.relativeTarget[axis].min + length2;
        }
      });
    }
    const layoutDelta = createDelta();
    calcBoxDelta(layoutDelta, layout2, snapshot.layoutBox);
    const visualDelta = createDelta();
    if (isShared) {
      calcBoxDelta(visualDelta, node2.applyTransform(measuredLayout, true), snapshot.measuredBox);
    } else {
      calcBoxDelta(visualDelta, layout2, snapshot.layoutBox);
    }
    const hasLayoutChanged = !isDeltaZero(layoutDelta);
    let hasRelativeTargetChanged = false;
    if (!node2.resumeFrom) {
      const relativeParent = node2.getClosestProjectingParent();
      if (relativeParent && !relativeParent.resumeFrom) {
        const { snapshot: parentSnapshot, layout: parentLayout } = relativeParent;
        if (parentSnapshot && parentLayout) {
          const relativeSnapshot = createBox();
          calcRelativePosition(relativeSnapshot, snapshot.layoutBox, parentSnapshot.layoutBox);
          const relativeLayout = createBox();
          calcRelativePosition(relativeLayout, layout2, parentLayout.layoutBox);
          if (!boxEqualsRounded(relativeSnapshot, relativeLayout)) {
            hasRelativeTargetChanged = true;
          }
          if (relativeParent.options.layoutRoot) {
            node2.relativeTarget = relativeLayout;
            node2.relativeTargetOrigin = relativeSnapshot;
            node2.relativeParent = relativeParent;
          }
        }
      }
    }
    node2.notifyListeners("didUpdate", {
      layout: layout2,
      snapshot,
      delta: visualDelta,
      layoutDelta,
      hasLayoutChanged,
      hasRelativeTargetChanged
    });
  } else if (node2.isLead()) {
    const { onExitComplete } = node2.options;
    onExitComplete && onExitComplete();
  }
  node2.options.transition = void 0;
}
function propagateDirtyNodes(node2) {
  if (isDebug) {
    metrics.totalNodes++;
  }
  if (!node2.parent)
    return;
  if (!node2.isProjecting()) {
    node2.isProjectionDirty = node2.parent.isProjectionDirty;
  }
  node2.isSharedProjectionDirty || (node2.isSharedProjectionDirty = Boolean(node2.isProjectionDirty || node2.parent.isProjectionDirty || node2.parent.isSharedProjectionDirty));
  node2.isTransformDirty || (node2.isTransformDirty = node2.parent.isTransformDirty);
}
function cleanDirtyNodes(node2) {
  node2.isProjectionDirty = node2.isSharedProjectionDirty = node2.isTransformDirty = false;
}
function clearSnapshot(node2) {
  node2.clearSnapshot();
}
function clearMeasurements(node2) {
  node2.clearMeasurements();
}
function clearIsLayoutDirty(node2) {
  node2.isLayoutDirty = false;
}
function resetTransformStyle(node2) {
  const { visualElement } = node2.options;
  if (visualElement && visualElement.getProps().onBeforeLayoutMeasure) {
    visualElement.notify("BeforeLayoutMeasure");
  }
  node2.resetTransform();
}
function finishAnimation(node2) {
  node2.finishAnimation();
  node2.targetDelta = node2.relativeTarget = node2.target = void 0;
  node2.isProjectionDirty = true;
}
function resolveTargetDelta(node2) {
  node2.resolveTargetDelta();
}
function calcProjection(node2) {
  node2.calcProjection();
}
function resetSkewAndRotation(node2) {
  node2.resetSkewAndRotation();
}
function removeLeadSnapshots(stack) {
  stack.removeLeadSnapshot();
}
function mixAxisDelta(output2, delta, p2) {
  output2.translate = mixNumber$1(delta.translate, 0, p2);
  output2.scale = mixNumber$1(delta.scale, 1, p2);
  output2.origin = delta.origin;
  output2.originPoint = delta.originPoint;
}
function mixAxis(output2, from2, to2, p2) {
  output2.min = mixNumber$1(from2.min, to2.min, p2);
  output2.max = mixNumber$1(from2.max, to2.max, p2);
}
function mixBox(output2, from2, to2, p2) {
  mixAxis(output2.x, from2.x, to2.x, p2);
  mixAxis(output2.y, from2.y, to2.y, p2);
}
function hasOpacityCrossfade(node2) {
  return node2.animationValues && node2.animationValues.opacityExit !== void 0;
}
const defaultLayoutTransition = {
  duration: 0.45,
  ease: [0.4, 0, 0.1, 1]
};
const userAgentContains = (string3) => typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(string3);
const roundPoint = userAgentContains("applewebkit/") && !userAgentContains("chrome/") ? Math.round : noop$9;
function roundAxis(axis) {
  axis.min = roundPoint(axis.min);
  axis.max = roundPoint(axis.max);
}
function roundBox(box) {
  roundAxis(box.x);
  roundAxis(box.y);
}
function shouldAnimatePositionOnly(animationType, snapshot, layout2) {
  return animationType === "position" || animationType === "preserve-aspect" && !isNear(aspectRatio(snapshot), aspectRatio(layout2), 0.2);
}
function checkNodeWasScrollRoot(node2) {
  var _a2;
  return node2 !== node2.root && ((_a2 = node2.scroll) === null || _a2 === void 0 ? void 0 : _a2.wasRoot);
}
const DocumentProjectionNode = createProjectionNode({
  attachResizeListener: (ref, notify2) => addDomEvent(ref, "resize", notify2),
  measureScroll: () => ({
    x: document.documentElement.scrollLeft || document.body.scrollLeft,
    y: document.documentElement.scrollTop || document.body.scrollTop
  }),
  checkIsScrollRoot: () => true
});
const rootProjectionNode = {
  current: void 0
};
const HTMLProjectionNode = createProjectionNode({
  measureScroll: (instance2) => ({
    x: instance2.scrollLeft,
    y: instance2.scrollTop
  }),
  defaultParent: () => {
    if (!rootProjectionNode.current) {
      const documentNode = new DocumentProjectionNode({});
      documentNode.mount(window);
      documentNode.setOptions({ layoutScroll: true });
      rootProjectionNode.current = documentNode;
    }
    return rootProjectionNode.current;
  },
  resetTransform: (instance2, value2) => {
    instance2.style.transform = value2 !== void 0 ? value2 : "none";
  },
  checkIsScrollRoot: (instance2) => Boolean(window.getComputedStyle(instance2).position === "fixed")
});
const drag = {
  pan: {
    Feature: PanGesture
  },
  drag: {
    Feature: DragGesture,
    ProjectionNode: HTMLProjectionNode,
    MeasureLayout
  }
};
function handleHoverEvent(node2, event, lifecycle) {
  const { props } = node2;
  if (node2.animationState && props.whileHover) {
    node2.animationState.setActive("whileHover", lifecycle === "Start");
  }
  const eventName = "onHover" + lifecycle;
  const callback2 = props[eventName];
  if (callback2) {
    frame.postRender(() => callback2(event, extractEventInfo(event)));
  }
}
class HoverGesture extends Feature {
  mount() {
    const { current } = this.node;
    if (!current)
      return;
    this.unmount = hover$2(current, (startEvent) => {
      handleHoverEvent(this.node, startEvent, "Start");
      return (endEvent) => handleHoverEvent(this.node, endEvent, "End");
    });
  }
  unmount() {
  }
}
class FocusGesture extends Feature {
  constructor() {
    super(...arguments);
    this.isActive = false;
  }
  onFocus() {
    let isFocusVisible = false;
    try {
      isFocusVisible = this.node.current.matches(":focus-visible");
    } catch (e2) {
      isFocusVisible = true;
    }
    if (!isFocusVisible || !this.node.animationState)
      return;
    this.node.animationState.setActive("whileFocus", true);
    this.isActive = true;
  }
  onBlur() {
    if (!this.isActive || !this.node.animationState)
      return;
    this.node.animationState.setActive("whileFocus", false);
    this.isActive = false;
  }
  mount() {
    this.unmount = pipe(addDomEvent(this.node.current, "focus", () => this.onFocus()), addDomEvent(this.node.current, "blur", () => this.onBlur()));
  }
  unmount() {
  }
}
function handlePressEvent(node2, event, lifecycle) {
  const { props } = node2;
  if (node2.animationState && props.whileTap) {
    node2.animationState.setActive("whileTap", lifecycle === "Start");
  }
  const eventName = "onTap" + (lifecycle === "End" ? "" : lifecycle);
  const callback2 = props[eventName];
  if (callback2) {
    frame.postRender(() => callback2(event, extractEventInfo(event)));
  }
}
class PressGesture extends Feature {
  mount() {
    const { current } = this.node;
    if (!current)
      return;
    this.unmount = press(current, (startEvent) => {
      handlePressEvent(this.node, startEvent, "Start");
      return (endEvent, { success }) => handlePressEvent(this.node, endEvent, success ? "End" : "Cancel");
    }, { useGlobalTarget: this.node.props.globalTapTarget });
  }
  unmount() {
  }
}
const observerCallbacks = /* @__PURE__ */ new WeakMap();
const observers$1 = /* @__PURE__ */ new WeakMap();
const fireObserverCallback = (entry) => {
  const callback2 = observerCallbacks.get(entry.target);
  callback2 && callback2(entry);
};
const fireAllObserverCallbacks = (entries) => {
  entries.forEach(fireObserverCallback);
};
function initIntersectionObserver({ root: root2, ...options }) {
  const lookupRoot = root2 || document;
  if (!observers$1.has(lookupRoot)) {
    observers$1.set(lookupRoot, {});
  }
  const rootObservers = observers$1.get(lookupRoot);
  const key = JSON.stringify(options);
  if (!rootObservers[key]) {
    rootObservers[key] = new IntersectionObserver(fireAllObserverCallbacks, { root: root2, ...options });
  }
  return rootObservers[key];
}
function observeIntersection(element2, options, callback2) {
  const rootInteresectionObserver = initIntersectionObserver(options);
  observerCallbacks.set(element2, callback2);
  rootInteresectionObserver.observe(element2);
  return () => {
    observerCallbacks.delete(element2);
    rootInteresectionObserver.unobserve(element2);
  };
}
const thresholdNames = {
  some: 0,
  all: 1
};
class InViewFeature extends Feature {
  constructor() {
    super(...arguments);
    this.hasEnteredView = false;
    this.isInView = false;
  }
  startObserver() {
    this.unmount();
    const { viewport = {} } = this.node.getProps();
    const { root: root2, margin: rootMargin, amount = "some", once } = viewport;
    const options = {
      root: root2 ? root2.current : void 0,
      rootMargin,
      threshold: typeof amount === "number" ? amount : thresholdNames[amount]
    };
    const onIntersectionUpdate = (entry) => {
      const { isIntersecting } = entry;
      if (this.isInView === isIntersecting)
        return;
      this.isInView = isIntersecting;
      if (once && !isIntersecting && this.hasEnteredView) {
        return;
      } else if (isIntersecting) {
        this.hasEnteredView = true;
      }
      if (this.node.animationState) {
        this.node.animationState.setActive("whileInView", isIntersecting);
      }
      const { onViewportEnter, onViewportLeave } = this.node.getProps();
      const callback2 = isIntersecting ? onViewportEnter : onViewportLeave;
      callback2 && callback2(entry);
    };
    return observeIntersection(this.node.current, options, onIntersectionUpdate);
  }
  mount() {
    this.startObserver();
  }
  update() {
    if (typeof IntersectionObserver === "undefined")
      return;
    const { props, prevProps } = this.node;
    const hasOptionsChanged = ["amount", "margin", "root"].some(hasViewportOptionChanged(props, prevProps));
    if (hasOptionsChanged) {
      this.startObserver();
    }
  }
  unmount() {
  }
}
function hasViewportOptionChanged({ viewport = {} }, { viewport: prevViewport = {} } = {}) {
  return (name2) => viewport[name2] !== prevViewport[name2];
}
const gestureAnimations = {
  inView: {
    Feature: InViewFeature
  },
  tap: {
    Feature: PressGesture
  },
  focus: {
    Feature: FocusGesture
  },
  hover: {
    Feature: HoverGesture
  }
};
const layout = {
  layout: {
    ProjectionNode: HTMLProjectionNode,
    MeasureLayout
  }
};
const prefersReducedMotion = { current: null };
const hasReducedMotionListener = { current: false };
function initPrefersReducedMotion() {
  hasReducedMotionListener.current = true;
  if (!isBrowser$2)
    return;
  if (window.matchMedia) {
    const motionMediaQuery = window.matchMedia("(prefers-reduced-motion)");
    const setReducedMotionPreferences = () => prefersReducedMotion.current = motionMediaQuery.matches;
    motionMediaQuery.addListener(setReducedMotionPreferences);
    setReducedMotionPreferences();
  } else {
    prefersReducedMotion.current = false;
  }
}
const valueTypes = [...dimensionValueTypes, color$2, complex];
const findValueType = (v2) => valueTypes.find(testValueType(v2));
const visualElementStore = /* @__PURE__ */ new WeakMap();
function updateMotionValuesFromProps(element2, next2, prev2) {
  for (const key in next2) {
    const nextValue = next2[key];
    const prevValue = prev2[key];
    if (isMotionValue(nextValue)) {
      element2.addValue(key, nextValue);
    } else if (isMotionValue(prevValue)) {
      element2.addValue(key, motionValue(nextValue, { owner: element2 }));
    } else if (prevValue !== nextValue) {
      if (element2.hasValue(key)) {
        const existingValue = element2.getValue(key);
        if (existingValue.liveStyle === true) {
          existingValue.jump(nextValue);
        } else if (!existingValue.hasAnimated) {
          existingValue.set(nextValue);
        }
      } else {
        const latestValue = element2.getStaticValue(key);
        element2.addValue(key, motionValue(latestValue !== void 0 ? latestValue : nextValue, { owner: element2 }));
      }
    }
  }
  for (const key in prev2) {
    if (next2[key] === void 0)
      element2.removeValue(key);
  }
  return next2;
}
const propEventHandlers = [
  "AnimationStart",
  "AnimationComplete",
  "Update",
  "BeforeLayoutMeasure",
  "LayoutMeasure",
  "LayoutAnimationStart",
  "LayoutAnimationComplete"
];
class VisualElement {
  /**
   * This method takes React props and returns found MotionValues. For example, HTML
   * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
   *
   * This isn't an abstract method as it needs calling in the constructor, but it is
   * intended to be one.
   */
  scrapeMotionValuesFromProps(_props, _prevProps, _visualElement) {
    return {};
  }
  constructor({ parent, props, presenceContext, reducedMotionConfig, blockInitialAnimation, visualState }, options = {}) {
    this.current = null;
    this.children = /* @__PURE__ */ new Set();
    this.isVariantNode = false;
    this.isControllingVariants = false;
    this.shouldReduceMotion = null;
    this.values = /* @__PURE__ */ new Map();
    this.KeyframeResolver = KeyframeResolver;
    this.features = {};
    this.valueSubscriptions = /* @__PURE__ */ new Map();
    this.prevMotionValues = {};
    this.events = {};
    this.propEventSubscriptions = {};
    this.notifyUpdate = () => this.notify("Update", this.latestValues);
    this.render = () => {
      if (!this.current)
        return;
      this.triggerBuild();
      this.renderInstance(this.current, this.renderState, this.props.style, this.projection);
    };
    this.renderScheduledAt = 0;
    this.scheduleRender = () => {
      const now2 = time.now();
      if (this.renderScheduledAt < now2) {
        this.renderScheduledAt = now2;
        frame.render(this.render, false, true);
      }
    };
    const { latestValues, renderState, onUpdate } = visualState;
    this.onUpdate = onUpdate;
    this.latestValues = latestValues;
    this.baseTarget = { ...latestValues };
    this.initialValues = props.initial ? { ...latestValues } : {};
    this.renderState = renderState;
    this.parent = parent;
    this.props = props;
    this.presenceContext = presenceContext;
    this.depth = parent ? parent.depth + 1 : 0;
    this.reducedMotionConfig = reducedMotionConfig;
    this.options = options;
    this.blockInitialAnimation = Boolean(blockInitialAnimation);
    this.isControllingVariants = isControllingVariants(props);
    this.isVariantNode = isVariantNode(props);
    if (this.isVariantNode) {
      this.variantChildren = /* @__PURE__ */ new Set();
    }
    this.manuallyAnimateOnMount = Boolean(parent && parent.current);
    const { willChange, ...initialMotionValues } = this.scrapeMotionValuesFromProps(props, {}, this);
    for (const key in initialMotionValues) {
      const value2 = initialMotionValues[key];
      if (latestValues[key] !== void 0 && isMotionValue(value2)) {
        value2.set(latestValues[key], false);
      }
    }
  }
  mount(instance2) {
    this.current = instance2;
    visualElementStore.set(instance2, this);
    if (this.projection && !this.projection.instance) {
      this.projection.mount(instance2);
    }
    if (this.parent && this.isVariantNode && !this.isControllingVariants) {
      this.removeFromVariantTree = this.parent.addVariantChild(this);
    }
    this.values.forEach((value2, key) => this.bindToMotionValue(key, value2));
    if (!hasReducedMotionListener.current) {
      initPrefersReducedMotion();
    }
    this.shouldReduceMotion = this.reducedMotionConfig === "never" ? false : this.reducedMotionConfig === "always" ? true : prefersReducedMotion.current;
    if (this.parent)
      this.parent.children.add(this);
    this.update(this.props, this.presenceContext);
  }
  unmount() {
    visualElementStore.delete(this.current);
    this.projection && this.projection.unmount();
    cancelFrame(this.notifyUpdate);
    cancelFrame(this.render);
    this.valueSubscriptions.forEach((remove) => remove());
    this.valueSubscriptions.clear();
    this.removeFromVariantTree && this.removeFromVariantTree();
    this.parent && this.parent.children.delete(this);
    for (const key in this.events) {
      this.events[key].clear();
    }
    for (const key in this.features) {
      const feature = this.features[key];
      if (feature) {
        feature.unmount();
        feature.isMounted = false;
      }
    }
    this.current = null;
  }
  bindToMotionValue(key, value2) {
    if (this.valueSubscriptions.has(key)) {
      this.valueSubscriptions.get(key)();
    }
    const valueIsTransform = transformProps.has(key);
    const removeOnChange = value2.on("change", (latestValue) => {
      this.latestValues[key] = latestValue;
      this.props.onUpdate && frame.preRender(this.notifyUpdate);
      if (valueIsTransform && this.projection) {
        this.projection.isTransformDirty = true;
      }
    });
    const removeOnRenderRequest = value2.on("renderRequest", this.scheduleRender);
    let removeSyncCheck;
    if (window.MotionCheckAppearSync) {
      removeSyncCheck = window.MotionCheckAppearSync(this, key, value2);
    }
    this.valueSubscriptions.set(key, () => {
      removeOnChange();
      removeOnRenderRequest();
      if (removeSyncCheck)
        removeSyncCheck();
      if (value2.owner)
        value2.stop();
    });
  }
  sortNodePosition(other) {
    if (!this.current || !this.sortInstanceNodePosition || this.type !== other.type) {
      return 0;
    }
    return this.sortInstanceNodePosition(this.current, other.current);
  }
  updateFeatures() {
    let key = "animation";
    for (key in featureDefinitions) {
      const featureDefinition = featureDefinitions[key];
      if (!featureDefinition)
        continue;
      const { isEnabled, Feature: FeatureConstructor } = featureDefinition;
      if (!this.features[key] && FeatureConstructor && isEnabled(this.props)) {
        this.features[key] = new FeatureConstructor(this);
      }
      if (this.features[key]) {
        const feature = this.features[key];
        if (feature.isMounted) {
          feature.update();
        } else {
          feature.mount();
          feature.isMounted = true;
        }
      }
    }
  }
  triggerBuild() {
    this.build(this.renderState, this.latestValues, this.props);
  }
  /**
   * Measure the current viewport box with or without transforms.
   * Only measures axis-aligned boxes, rotate and skew must be manually
   * removed with a re-render to work.
   */
  measureViewportBox() {
    return this.current ? this.measureInstanceViewportBox(this.current, this.props) : createBox();
  }
  getStaticValue(key) {
    return this.latestValues[key];
  }
  setStaticValue(key, value2) {
    this.latestValues[key] = value2;
  }
  /**
   * Update the provided props. Ensure any newly-added motion values are
   * added to our map, old ones removed, and listeners updated.
   */
  update(props, presenceContext) {
    if (props.transformTemplate || this.props.transformTemplate) {
      this.scheduleRender();
    }
    this.prevProps = this.props;
    this.props = props;
    this.prevPresenceContext = this.presenceContext;
    this.presenceContext = presenceContext;
    for (let i2 = 0; i2 < propEventHandlers.length; i2++) {
      const key = propEventHandlers[i2];
      if (this.propEventSubscriptions[key]) {
        this.propEventSubscriptions[key]();
        delete this.propEventSubscriptions[key];
      }
      const listenerName = "on" + key;
      const listener = props[listenerName];
      if (listener) {
        this.propEventSubscriptions[key] = this.on(key, listener);
      }
    }
    this.prevMotionValues = updateMotionValuesFromProps(this, this.scrapeMotionValuesFromProps(props, this.prevProps, this), this.prevMotionValues);
    if (this.handleChildMotionValue) {
      this.handleChildMotionValue();
    }
    this.onUpdate && this.onUpdate(this);
  }
  getProps() {
    return this.props;
  }
  /**
   * Returns the variant definition with a given name.
   */
  getVariant(name2) {
    return this.props.variants ? this.props.variants[name2] : void 0;
  }
  /**
   * Returns the defined default transition on this component.
   */
  getDefaultTransition() {
    return this.props.transition;
  }
  getTransformPagePoint() {
    return this.props.transformPagePoint;
  }
  getClosestVariantNode() {
    return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
  }
  /**
   * Add a child visual element to our set of children.
   */
  addVariantChild(child) {
    const closestVariantNode = this.getClosestVariantNode();
    if (closestVariantNode) {
      closestVariantNode.variantChildren && closestVariantNode.variantChildren.add(child);
      return () => closestVariantNode.variantChildren.delete(child);
    }
  }
  /**
   * Add a motion value and bind it to this visual element.
   */
  addValue(key, value2) {
    const existingValue = this.values.get(key);
    if (value2 !== existingValue) {
      if (existingValue)
        this.removeValue(key);
      this.bindToMotionValue(key, value2);
      this.values.set(key, value2);
      this.latestValues[key] = value2.get();
    }
  }
  /**
   * Remove a motion value and unbind any active subscriptions.
   */
  removeValue(key) {
    this.values.delete(key);
    const unsubscribe = this.valueSubscriptions.get(key);
    if (unsubscribe) {
      unsubscribe();
      this.valueSubscriptions.delete(key);
    }
    delete this.latestValues[key];
    this.removeValueFromRenderState(key, this.renderState);
  }
  /**
   * Check whether we have a motion value for this key
   */
  hasValue(key) {
    return this.values.has(key);
  }
  getValue(key, defaultValue2) {
    if (this.props.values && this.props.values[key]) {
      return this.props.values[key];
    }
    let value2 = this.values.get(key);
    if (value2 === void 0 && defaultValue2 !== void 0) {
      value2 = motionValue(defaultValue2 === null ? void 0 : defaultValue2, { owner: this });
      this.addValue(key, value2);
    }
    return value2;
  }
  /**
   * If we're trying to animate to a previously unencountered value,
   * we need to check for it in our state and as a last resort read it
   * directly from the instance (which might have performance implications).
   */
  readValue(key, target) {
    var _a2;
    let value2 = this.latestValues[key] !== void 0 || !this.current ? this.latestValues[key] : (_a2 = this.getBaseTargetFromProps(this.props, key)) !== null && _a2 !== void 0 ? _a2 : this.readValueFromInstance(this.current, key, this.options);
    if (value2 !== void 0 && value2 !== null) {
      if (typeof value2 === "string" && (isNumericalString(value2) || isZeroValueString(value2))) {
        value2 = parseFloat(value2);
      } else if (!findValueType(value2) && complex.test(target)) {
        value2 = getAnimatableNone(key, target);
      }
      this.setBaseTarget(key, isMotionValue(value2) ? value2.get() : value2);
    }
    return isMotionValue(value2) ? value2.get() : value2;
  }
  /**
   * Set the base target to later animate back to. This is currently
   * only hydrated on creation and when we first read a value.
   */
  setBaseTarget(key, value2) {
    this.baseTarget[key] = value2;
  }
  /**
   * Find the base target for a value thats been removed from all animation
   * props.
   */
  getBaseTarget(key) {
    var _a2;
    const { initial } = this.props;
    let valueFromInitial;
    if (typeof initial === "string" || typeof initial === "object") {
      const variant = resolveVariantFromProps(this.props, initial, (_a2 = this.presenceContext) === null || _a2 === void 0 ? void 0 : _a2.custom);
      if (variant) {
        valueFromInitial = variant[key];
      }
    }
    if (initial && valueFromInitial !== void 0) {
      return valueFromInitial;
    }
    const target = this.getBaseTargetFromProps(this.props, key);
    if (target !== void 0 && !isMotionValue(target))
      return target;
    return this.initialValues[key] !== void 0 && valueFromInitial === void 0 ? void 0 : this.baseTarget[key];
  }
  on(eventName, callback2) {
    if (!this.events[eventName]) {
      this.events[eventName] = new SubscriptionManager();
    }
    return this.events[eventName].add(callback2);
  }
  notify(eventName, ...args) {
    if (this.events[eventName]) {
      this.events[eventName].notify(...args);
    }
  }
}
class DOMVisualElement extends VisualElement {
  constructor() {
    super(...arguments);
    this.KeyframeResolver = DOMKeyframesResolver;
  }
  sortInstanceNodePosition(a2, b2) {
    return a2.compareDocumentPosition(b2) & 2 ? 1 : -1;
  }
  getBaseTargetFromProps(props, key) {
    return props.style ? props.style[key] : void 0;
  }
  removeValueFromRenderState(key, { vars, style: style2 }) {
    delete vars[key];
    delete style2[key];
  }
  handleChildMotionValue() {
    if (this.childSubscription) {
      this.childSubscription();
      delete this.childSubscription;
    }
    const { children } = this.props;
    if (isMotionValue(children)) {
      this.childSubscription = children.on("change", (latest) => {
        if (this.current) {
          this.current.textContent = `${latest}`;
        }
      });
    }
  }
}
function getComputedStyle$2(element2) {
  return window.getComputedStyle(element2);
}
class HTMLVisualElement extends DOMVisualElement {
  constructor() {
    super(...arguments);
    this.type = "html";
    this.renderInstance = renderHTML;
  }
  readValueFromInstance(instance2, key) {
    if (transformProps.has(key)) {
      const defaultType = getDefaultValueType(key);
      return defaultType ? defaultType.default || 0 : 0;
    } else {
      const computedStyle = getComputedStyle$2(instance2);
      const value2 = (isCSSVariableName(key) ? computedStyle.getPropertyValue(key) : computedStyle[key]) || 0;
      return typeof value2 === "string" ? value2.trim() : value2;
    }
  }
  measureInstanceViewportBox(instance2, { transformPagePoint }) {
    return measureViewportBox(instance2, transformPagePoint);
  }
  build(renderState, latestValues, props) {
    buildHTMLStyles(renderState, latestValues, props.transformTemplate);
  }
  scrapeMotionValuesFromProps(props, prevProps, visualElement) {
    return scrapeMotionValuesFromProps$1(props, prevProps, visualElement);
  }
}
class SVGVisualElement extends DOMVisualElement {
  constructor() {
    super(...arguments);
    this.type = "svg";
    this.isSVGTag = false;
    this.measureInstanceViewportBox = createBox;
  }
  getBaseTargetFromProps(props, key) {
    return props[key];
  }
  readValueFromInstance(instance2, key) {
    if (transformProps.has(key)) {
      const defaultType = getDefaultValueType(key);
      return defaultType ? defaultType.default || 0 : 0;
    }
    key = !camelCaseAttributes.has(key) ? camelToDash(key) : key;
    return instance2.getAttribute(key);
  }
  scrapeMotionValuesFromProps(props, prevProps, visualElement) {
    return scrapeMotionValuesFromProps(props, prevProps, visualElement);
  }
  build(renderState, latestValues, props) {
    buildSVGAttrs(renderState, latestValues, this.isSVGTag, props.transformTemplate);
  }
  renderInstance(instance2, renderState, styleProp, projection) {
    renderSVG(instance2, renderState, styleProp, projection);
  }
  mount(instance2) {
    this.isSVGTag = isSVGTag(instance2.tagName);
    super.mount(instance2);
  }
}
const createDomVisualElement = (Component2, options) => {
  return isSVGComponent(Component2) ? new SVGVisualElement(options) : new HTMLVisualElement(options, {
    allowProjection: Component2 !== reactExports.Fragment
  });
};
const domAnimation$8 = {
  renderer: createDomVisualElement,
  ...animations,
  ...gestureAnimations
};
const domMax = {
  ...domAnimation$8,
  ...drag,
  ...layout
};
function getWillChangeName(name2) {
  if (transformProps.has(name2)) {
    return "transform";
  } else if (acceleratedValues.has(name2)) {
    return camelToDash(name2);
  }
}
class WillChangeMotionValue extends MotionValue {
  constructor() {
    super(...arguments);
    this.values = [];
  }
  add(name2) {
    const styleName = getWillChangeName(name2);
    if (styleName) {
      addUniqueItem(this.values, styleName);
      this.update();
    }
  }
  update() {
    this.set(this.values.length ? this.values.join(", ") : "auto");
  }
}
function useWillChange() {
  return useConstant(() => new WillChangeMotionValue("auto"));
}
function $7215afc6de606d6b$export$de79e2c695e052f3$6(element2) {
  if ($7215afc6de606d6b$var$supportsPreventScroll$6())
    element2.focus({
      preventScroll: true
    });
  else {
    let scrollableElements = $7215afc6de606d6b$var$getScrollableElements$6(element2);
    element2.focus();
    $7215afc6de606d6b$var$restoreScrollPosition$6(scrollableElements);
  }
}
let $7215afc6de606d6b$var$supportsPreventScrollCached$6 = null;
function $7215afc6de606d6b$var$supportsPreventScroll$6() {
  if ($7215afc6de606d6b$var$supportsPreventScrollCached$6 == null) {
    $7215afc6de606d6b$var$supportsPreventScrollCached$6 = false;
    try {
      let focusElem = document.createElement("div");
      focusElem.focus({
        get preventScroll() {
          $7215afc6de606d6b$var$supportsPreventScrollCached$6 = true;
          return true;
        }
      });
    } catch {
    }
  }
  return $7215afc6de606d6b$var$supportsPreventScrollCached$6;
}
function $7215afc6de606d6b$var$getScrollableElements$6(element2) {
  let parent = element2.parentNode;
  let scrollableElements = [];
  let rootScrollingElement = document.scrollingElement || document.documentElement;
  while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
    if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth)
      scrollableElements.push({
        element: parent,
        scrollTop: parent.scrollTop,
        scrollLeft: parent.scrollLeft
      });
    parent = parent.parentNode;
  }
  if (rootScrollingElement instanceof HTMLElement)
    scrollableElements.push({
      element: rootScrollingElement,
      scrollTop: rootScrollingElement.scrollTop,
      scrollLeft: rootScrollingElement.scrollLeft
    });
  return scrollableElements;
}
function $7215afc6de606d6b$var$restoreScrollPosition$6(scrollableElements) {
  for (let { element: element2, scrollTop, scrollLeft } of scrollableElements) {
    element2.scrollTop = scrollTop;
    element2.scrollLeft = scrollLeft;
  }
}
function $c87311424ea30a05$var$testUserAgent$7(re2) {
  var _window_navigator_userAgentData;
  if (typeof window === "undefined" || window.navigator == null)
    return false;
  return ((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands.some((brand) => re2.test(brand.brand))) || re2.test(window.navigator.userAgent);
}
function $c87311424ea30a05$var$testPlatform$7(re2) {
  var _window_navigator_userAgentData;
  return typeof window !== "undefined" && window.navigator != null ? re2.test(((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
}
function $c87311424ea30a05$var$cached$7(fn) {
  let res = null;
  return () => {
    if (res == null)
      res = fn();
    return res;
  };
}
const $c87311424ea30a05$export$9ac100e40613ea10$7 = $c87311424ea30a05$var$cached$7(function() {
  return $c87311424ea30a05$var$testPlatform$7(/^Mac/i);
});
const $c87311424ea30a05$export$7bef049ce92e4224$6 = $c87311424ea30a05$var$cached$7(function() {
  return $c87311424ea30a05$var$testPlatform$7(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
  $c87311424ea30a05$export$9ac100e40613ea10$7() && navigator.maxTouchPoints > 1;
});
const $c87311424ea30a05$export$78551043582a6a98$6 = $c87311424ea30a05$var$cached$7(function() {
  return $c87311424ea30a05$var$testUserAgent$7(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e$6();
});
const $c87311424ea30a05$export$6446a186d09e379e$6 = $c87311424ea30a05$var$cached$7(function() {
  return $c87311424ea30a05$var$testUserAgent$7(/Chrome/i);
});
const $c87311424ea30a05$export$b7d78993b74f766d$6 = $c87311424ea30a05$var$cached$7(function() {
  return $c87311424ea30a05$var$testUserAgent$7(/Firefox/i);
});
const $ea8dcbcb9ea1b556$var$RouterContext$3 = /* @__PURE__ */ reactExports.createContext({
  isNative: true,
  open: $ea8dcbcb9ea1b556$var$openSyntheticLink$3,
  useHref: (href) => href
});
function $ea8dcbcb9ea1b556$export$323e4fc2fa4753fb(props) {
  let { children, navigate, useHref: useHref2 } = props;
  let ctx = reactExports.useMemo(() => ({
    isNative: false,
    open: (target, modifiers, href, routerOptions) => {
      $ea8dcbcb9ea1b556$var$getSyntheticLink$3(target, (link2) => {
        if ($ea8dcbcb9ea1b556$export$efa8c9099e530235$2(link2, modifiers))
          navigate(href, routerOptions);
        else
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$6(link2, modifiers);
      });
    },
    useHref: useHref2 || ((href) => href)
  }), [
    navigate,
    useHref2
  ]);
  return /* @__PURE__ */ React$5.createElement($ea8dcbcb9ea1b556$var$RouterContext$3.Provider, {
    value: ctx
  }, children);
}
function $ea8dcbcb9ea1b556$export$efa8c9099e530235$2(link2, modifiers) {
  let target = link2.getAttribute("target");
  return (!target || target === "_self") && link2.origin === location.origin && !link2.hasAttribute("download") && !modifiers.metaKey && // open in new tab (mac)
  !modifiers.ctrlKey && // open in new tab (windows)
  !modifiers.altKey && // download
  !modifiers.shiftKey;
}
function $ea8dcbcb9ea1b556$export$95185d699e05d4d7$6(target, modifiers, setOpening = true) {
  var _window_event_type, _window_event;
  let { metaKey, ctrlKey, altKey, shiftKey } = modifiers;
  if ($c87311424ea30a05$export$b7d78993b74f766d$6() && ((_window_event = window.event) === null || _window_event === void 0 ? void 0 : (_window_event_type = _window_event.type) === null || _window_event_type === void 0 ? void 0 : _window_event_type.startsWith("key")) && target.target === "_blank") {
    if ($c87311424ea30a05$export$9ac100e40613ea10$7())
      metaKey = true;
    else
      ctrlKey = true;
  }
  let event = $c87311424ea30a05$export$78551043582a6a98$6() && $c87311424ea30a05$export$9ac100e40613ea10$7() && !$c87311424ea30a05$export$7bef049ce92e4224$6() && true ? new KeyboardEvent("keydown", {
    keyIdentifier: "Enter",
    metaKey,
    ctrlKey,
    altKey,
    shiftKey
  }) : new MouseEvent("click", {
    metaKey,
    ctrlKey,
    altKey,
    shiftKey,
    bubbles: true,
    cancelable: true
  });
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$6.isOpening = setOpening;
  $7215afc6de606d6b$export$de79e2c695e052f3$6(target);
  target.dispatchEvent(event);
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$6.isOpening = false;
}
$ea8dcbcb9ea1b556$export$95185d699e05d4d7$6.isOpening = false;
function $ea8dcbcb9ea1b556$var$getSyntheticLink$3(target, open) {
  if (target instanceof HTMLAnchorElement)
    open(target);
  else if (target.hasAttribute("data-href")) {
    let link2 = document.createElement("a");
    link2.href = target.getAttribute("data-href");
    if (target.hasAttribute("data-target"))
      link2.target = target.getAttribute("data-target");
    if (target.hasAttribute("data-rel"))
      link2.rel = target.getAttribute("data-rel");
    if (target.hasAttribute("data-download"))
      link2.download = target.getAttribute("data-download");
    if (target.hasAttribute("data-ping"))
      link2.ping = target.getAttribute("data-ping");
    if (target.hasAttribute("data-referrer-policy"))
      link2.referrerPolicy = target.getAttribute("data-referrer-policy");
    target.appendChild(link2);
    open(link2);
    target.removeChild(link2);
  }
}
function $ea8dcbcb9ea1b556$var$openSyntheticLink$3(target, modifiers) {
  $ea8dcbcb9ea1b556$var$getSyntheticLink$3(target, (link2) => $ea8dcbcb9ea1b556$export$95185d699e05d4d7$6(link2, modifiers));
}
const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5 = typeof document !== "undefined" ? React$5.useLayoutEffect : () => {
};
var $8ae05eaa5c114e9c$var$_React_useInsertionEffect$4;
const $8ae05eaa5c114e9c$var$useEarlyEffect$4 = ($8ae05eaa5c114e9c$var$_React_useInsertionEffect$4 = React$5["useInsertionEffect"]) !== null && $8ae05eaa5c114e9c$var$_React_useInsertionEffect$4 !== void 0 ? $8ae05eaa5c114e9c$var$_React_useInsertionEffect$4 : $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5;
function $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(fn) {
  const ref = reactExports.useRef(null);
  $8ae05eaa5c114e9c$var$useEarlyEffect$4(() => {
    ref.current = fn;
  }, [
    fn
  ]);
  return reactExports.useCallback((...args) => {
    const f2 = ref.current;
    return f2 === null || f2 === void 0 ? void 0 : f2(...args);
  }, []);
}
function $1dbecbe27a04f9af$export$14d238f342723f25$1(defaultValue2) {
  let [value2, setValue] = reactExports.useState(defaultValue2);
  let effect = reactExports.useRef(null);
  let nextRef = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    if (!effect.current)
      return;
    let newValue = effect.current.next();
    if (newValue.done) {
      effect.current = null;
      return;
    }
    if (value2 === newValue.value)
      nextRef();
    else
      setValue(newValue.value);
  });
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (effect.current)
      nextRef();
  });
  let queue = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((fn) => {
    effect.current = fn(value2);
    nextRef();
  });
  return [
    value2,
    queue
  ];
}
const $b5e257d569688ac6$var$defaultContext$d = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$d = /* @__PURE__ */ React$5.createContext($b5e257d569688ac6$var$defaultContext$d);
const $b5e257d569688ac6$var$IsSSRContext$d = /* @__PURE__ */ React$5.createContext(false);
let $b5e257d569688ac6$var$componentIds$d = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$d(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$d);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$d.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$d.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$d.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$d(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$d);
  let counter = $b5e257d569688ac6$var$useCounter$d(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$d(defaultId) {
  let id2 = React$5.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$d());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$d.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
const $b5e257d569688ac6$export$619500959fc48b26$1 = typeof React$5["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$d : $b5e257d569688ac6$var$useLegacySSRSafeId$d;
function $b5e257d569688ac6$var$getSnapshot$d() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$d() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$d(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$d() {
  if (typeof React$5["useSyncExternalStore"] === "function")
    return React$5["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$d, $b5e257d569688ac6$var$getSnapshot$d, $b5e257d569688ac6$var$getServerSnapshot$d);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$d);
}
let $bdb11010cef70236$var$canUseDOM$2 = Boolean(typeof window !== "undefined" && window.document && window.document.createElement);
let $bdb11010cef70236$export$d41a04c74483c6ef$9 = /* @__PURE__ */ new Map();
let $bdb11010cef70236$var$registry$2;
if (typeof FinalizationRegistry !== "undefined")
  $bdb11010cef70236$var$registry$2 = new FinalizationRegistry((heldValue) => {
    $bdb11010cef70236$export$d41a04c74483c6ef$9.delete(heldValue);
  });
function $bdb11010cef70236$export$f680877a34711e37$2(defaultId) {
  let [value2, setValue] = reactExports.useState(defaultId);
  let nextId = reactExports.useRef(null);
  let res = $b5e257d569688ac6$export$619500959fc48b26$1(value2);
  let cleanupRef = reactExports.useRef(null);
  if ($bdb11010cef70236$var$registry$2)
    $bdb11010cef70236$var$registry$2.register(cleanupRef, res);
  if ($bdb11010cef70236$var$canUseDOM$2) {
    const cacheIdRef = $bdb11010cef70236$export$d41a04c74483c6ef$9.get(res);
    if (cacheIdRef && !cacheIdRef.includes(nextId))
      cacheIdRef.push(nextId);
    else
      $bdb11010cef70236$export$d41a04c74483c6ef$9.set(res, [
        nextId
      ]);
  }
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let r2 = res;
    return () => {
      if ($bdb11010cef70236$var$registry$2)
        $bdb11010cef70236$var$registry$2.unregister(cleanupRef);
      $bdb11010cef70236$export$d41a04c74483c6ef$9.delete(r2);
    };
  }, [
    res
  ]);
  reactExports.useEffect(() => {
    let newId = nextId.current;
    if (newId)
      setValue(newId);
    return () => {
      if (newId)
        nextId.current = null;
    };
  });
  return res;
}
function $bdb11010cef70236$export$cd8c9cb68f842629$9(idA, idB) {
  if (idA === idB)
    return idA;
  let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef$9.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef$9.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function $bdb11010cef70236$export$b4cc09c592e8fdb8$1(depArray = []) {
  let id2 = $bdb11010cef70236$export$f680877a34711e37$2();
  let [resolvedId, setResolvedId] = $1dbecbe27a04f9af$export$14d238f342723f25$1(id2);
  let updateId = reactExports.useCallback(() => {
    setResolvedId(function* () {
      yield id2;
      yield document.getElementById(id2) ? id2 : void 0;
    });
  }, [
    id2,
    setResolvedId
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(updateId, [
    id2,
    updateId,
    ...depArray
  ]);
  return resolvedId;
}
function $ff5963eb1fccf552$export$e08e3b67e392101e$9(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks)
      if (typeof callback2 === "function")
        callback2(...args);
  };
}
const $431fbd86ca7dc216$export$b204af158042fbac$4 = (el2) => {
  var _el_ownerDocument;
  return (_el_ownerDocument = el2 === null || el2 === void 0 ? void 0 : el2.ownerDocument) !== null && _el_ownerDocument !== void 0 ? _el_ownerDocument : document;
};
const $431fbd86ca7dc216$export$f21a1ffae260145a$4 = (el2) => {
  if (el2 && "window" in el2 && el2.window === el2)
    return el2;
  const doc = $431fbd86ca7dc216$export$b204af158042fbac$4(el2);
  return doc.defaultView || window;
};
function $431fbd86ca7dc216$var$isNode$3(value2) {
  return value2 !== null && typeof value2 === "object" && "nodeType" in value2 && typeof value2.nodeType === "number";
}
function $431fbd86ca7dc216$export$af51f0f06c0f328a$3(node2) {
  return $431fbd86ca7dc216$var$isNode$3(node2) && node2.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in node2;
}
function $d4ee10de306f2510$export$4282f70798064fe0$3(node2, otherNode) {
  if (!$f4e2df6bd15f8569$export$98658e8c59125e6a())
    return otherNode && node2 ? node2.contains(otherNode) : false;
  if (!node2 || !otherNode)
    return false;
  let currentNode = otherNode;
  while (currentNode !== null) {
    if (currentNode === node2)
      return true;
    if (currentNode.tagName === "SLOT" && currentNode.assignedSlot)
      currentNode = currentNode.assignedSlot.parentNode;
    else if ($431fbd86ca7dc216$export$af51f0f06c0f328a$3(currentNode))
      currentNode = currentNode.host;
    else
      currentNode = currentNode.parentNode;
  }
  return false;
}
const $d4ee10de306f2510$export$cd4e5573fbe2b576 = (doc = document) => {
  var _activeElement_shadowRoot;
  if (!$f4e2df6bd15f8569$export$98658e8c59125e6a())
    return doc.activeElement;
  let activeElement = doc.activeElement;
  while (activeElement && "shadowRoot" in activeElement && ((_activeElement_shadowRoot = activeElement.shadowRoot) === null || _activeElement_shadowRoot === void 0 ? void 0 : _activeElement_shadowRoot.activeElement))
    activeElement = activeElement.shadowRoot.activeElement;
  return activeElement;
};
function $d4ee10de306f2510$export$e58f029f0fbfdb29$3(event) {
  if ($f4e2df6bd15f8569$export$98658e8c59125e6a() && event.target.shadowRoot) {
    if (event.composedPath)
      return event.composedPath()[0];
  }
  return event.target;
}
class $dfc540311bf7f109$export$63eb3ababa9c55c4 {
  get currentNode() {
    return this._currentNode;
  }
  set currentNode(node2) {
    if (!$d4ee10de306f2510$export$4282f70798064fe0$3(this.root, node2))
      throw new Error("Cannot set currentNode to a node that is not contained by the root node.");
    const walkers = [];
    let curNode = node2;
    let currentWalkerCurrentNode = node2;
    this._currentNode = node2;
    while (curNode && curNode !== this.root)
      if (curNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
        const shadowRoot = curNode;
        const walker2 = this._doc.createTreeWalker(shadowRoot, this.whatToShow, {
          acceptNode: this._acceptNode
        });
        walkers.push(walker2);
        walker2.currentNode = currentWalkerCurrentNode;
        this._currentSetFor.add(walker2);
        curNode = currentWalkerCurrentNode = shadowRoot.host;
      } else
        curNode = curNode.parentNode;
    const walker = this._doc.createTreeWalker(this.root, this.whatToShow, {
      acceptNode: this._acceptNode
    });
    walkers.push(walker);
    walker.currentNode = currentWalkerCurrentNode;
    this._currentSetFor.add(walker);
    this._walkerStack = walkers;
  }
  get doc() {
    return this._doc;
  }
  firstChild() {
    let currentNode = this.currentNode;
    let newNode = this.nextNode();
    if (!$d4ee10de306f2510$export$4282f70798064fe0$3(currentNode, newNode)) {
      this.currentNode = currentNode;
      return null;
    }
    if (newNode)
      this.currentNode = newNode;
    return newNode;
  }
  lastChild() {
    let walker = this._walkerStack[0];
    let newNode = walker.lastChild();
    if (newNode)
      this.currentNode = newNode;
    return newNode;
  }
  nextNode() {
    const nextNode = this._walkerStack[0].nextNode();
    if (nextNode) {
      const shadowRoot = nextNode.shadowRoot;
      if (shadowRoot) {
        var _this_filter;
        let nodeResult;
        if (typeof this.filter === "function")
          nodeResult = this.filter(nextNode);
        else if ((_this_filter = this.filter) === null || _this_filter === void 0 ? void 0 : _this_filter.acceptNode)
          nodeResult = this.filter.acceptNode(nextNode);
        if (nodeResult === NodeFilter.FILTER_ACCEPT) {
          this.currentNode = nextNode;
          return nextNode;
        }
        let newNode = this.nextNode();
        if (newNode)
          this.currentNode = newNode;
        return newNode;
      }
      if (nextNode)
        this.currentNode = nextNode;
      return nextNode;
    } else {
      if (this._walkerStack.length > 1) {
        this._walkerStack.shift();
        let newNode = this.nextNode();
        if (newNode)
          this.currentNode = newNode;
        return newNode;
      } else
        return null;
    }
  }
  previousNode() {
    const currentWalker = this._walkerStack[0];
    if (currentWalker.currentNode === currentWalker.root) {
      if (this._currentSetFor.has(currentWalker)) {
        this._currentSetFor.delete(currentWalker);
        if (this._walkerStack.length > 1) {
          this._walkerStack.shift();
          let newNode = this.previousNode();
          if (newNode)
            this.currentNode = newNode;
          return newNode;
        } else
          return null;
      }
      return null;
    }
    const previousNode = currentWalker.previousNode();
    if (previousNode) {
      const shadowRoot = previousNode.shadowRoot;
      if (shadowRoot) {
        var _this_filter;
        let nodeResult;
        if (typeof this.filter === "function")
          nodeResult = this.filter(previousNode);
        else if ((_this_filter = this.filter) === null || _this_filter === void 0 ? void 0 : _this_filter.acceptNode)
          nodeResult = this.filter.acceptNode(previousNode);
        if (nodeResult === NodeFilter.FILTER_ACCEPT) {
          if (previousNode)
            this.currentNode = previousNode;
          return previousNode;
        }
        let newNode = this.lastChild();
        if (newNode)
          this.currentNode = newNode;
        return newNode;
      }
      if (previousNode)
        this.currentNode = previousNode;
      return previousNode;
    } else {
      if (this._walkerStack.length > 1) {
        this._walkerStack.shift();
        let newNode = this.previousNode();
        if (newNode)
          this.currentNode = newNode;
        return newNode;
      } else
        return null;
    }
  }
  /**
   * @deprecated
   */
  nextSibling() {
    return null;
  }
  /**
   * @deprecated
   */
  previousSibling() {
    return null;
  }
  /**
   * @deprecated
   */
  parentNode() {
    return null;
  }
  constructor(doc, root2, whatToShow, filter3) {
    this._walkerStack = [];
    this._currentSetFor = /* @__PURE__ */ new Set();
    this._acceptNode = (node2) => {
      if (node2.nodeType === Node.ELEMENT_NODE) {
        const shadowRoot2 = node2.shadowRoot;
        if (shadowRoot2) {
          const walker = this._doc.createTreeWalker(shadowRoot2, this.whatToShow, {
            acceptNode: this._acceptNode
          });
          this._walkerStack.unshift(walker);
          return NodeFilter.FILTER_ACCEPT;
        } else {
          var _this_filter;
          if (typeof this.filter === "function")
            return this.filter(node2);
          else if ((_this_filter = this.filter) === null || _this_filter === void 0 ? void 0 : _this_filter.acceptNode)
            return this.filter.acceptNode(node2);
          else if (this.filter === null)
            return NodeFilter.FILTER_ACCEPT;
        }
      }
      return NodeFilter.FILTER_SKIP;
    };
    this._doc = doc;
    this.root = root2;
    this.filter = filter3 !== null && filter3 !== void 0 ? filter3 : null;
    this.whatToShow = whatToShow !== null && whatToShow !== void 0 ? whatToShow : NodeFilter.SHOW_ALL;
    this._currentNode = root2;
    this._walkerStack.unshift(doc.createTreeWalker(root2, whatToShow, this._acceptNode));
    const shadowRoot = root2.shadowRoot;
    if (shadowRoot) {
      const walker = this._doc.createTreeWalker(shadowRoot, this.whatToShow, {
        acceptNode: this._acceptNode
      });
      this._walkerStack.unshift(walker);
    }
  }
}
function $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root2, whatToShow, filter3) {
  if ($f4e2df6bd15f8569$export$98658e8c59125e6a())
    return new $dfc540311bf7f109$export$63eb3ababa9c55c4(doc, root2, whatToShow, filter3);
  return doc.createTreeWalker(root2, whatToShow, filter3);
}
function $3ef42575df84b30b$export$9d1611c77c2fe928$9(...args) {
  let result = {
    ...args[0]
  };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90)
        result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e$9(a2, b2);
      else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string")
        result[key] = clsx$3(a2, b2);
      else if (key === "id" && a2 && b2)
        result.id = $bdb11010cef70236$export$cd8c9cb68f842629$9(a2, b2);
      else
        result[key] = b2 !== void 0 ? b2 : a2;
    }
  }
  return result;
}
const $65484d02dcb7eb3e$var$DOMPropNames$4 = /* @__PURE__ */ new Set([
  "id"
]);
const $65484d02dcb7eb3e$var$labelablePropNames$4 = /* @__PURE__ */ new Set([
  "aria-label",
  "aria-labelledby",
  "aria-describedby",
  "aria-details"
]);
const $65484d02dcb7eb3e$var$linkPropNames$4 = /* @__PURE__ */ new Set([
  "href",
  "hrefLang",
  "target",
  "rel",
  "download",
  "ping",
  "referrerPolicy"
]);
const $65484d02dcb7eb3e$var$globalAttrs = /* @__PURE__ */ new Set([
  "dir",
  "lang",
  "hidden",
  "inert",
  "translate"
]);
const $65484d02dcb7eb3e$var$globalEvents = /* @__PURE__ */ new Set([
  "onClick",
  "onAuxClick",
  "onContextMenu",
  "onDoubleClick",
  "onMouseDown",
  "onMouseEnter",
  "onMouseLeave",
  "onMouseMove",
  "onMouseOut",
  "onMouseOver",
  "onMouseUp",
  "onTouchCancel",
  "onTouchEnd",
  "onTouchMove",
  "onTouchStart",
  "onPointerDown",
  "onPointerMove",
  "onPointerUp",
  "onPointerCancel",
  "onPointerEnter",
  "onPointerLeave",
  "onPointerOver",
  "onPointerOut",
  "onGotPointerCapture",
  "onLostPointerCapture",
  "onScroll",
  "onWheel",
  "onAnimationStart",
  "onAnimationEnd",
  "onAnimationIteration",
  "onTransitionCancel",
  "onTransitionEnd",
  "onTransitionRun",
  "onTransitionStart"
]);
const $65484d02dcb7eb3e$var$propRe$4 = /^(data-.*)$/;
function $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, opts2 = {}) {
  let { labelable, isLink, global: global2, events: events2 = global2, propNames } = opts2;
  let filteredProps = {};
  for (const prop in props)
    if (Object.prototype.hasOwnProperty.call(props, prop) && ($65484d02dcb7eb3e$var$DOMPropNames$4.has(prop) || labelable && $65484d02dcb7eb3e$var$labelablePropNames$4.has(prop) || isLink && $65484d02dcb7eb3e$var$linkPropNames$4.has(prop) || global2 && $65484d02dcb7eb3e$var$globalAttrs.has(prop) || events2 && $65484d02dcb7eb3e$var$globalEvents.has(prop) || prop.endsWith("Capture") && $65484d02dcb7eb3e$var$globalEvents.has(prop.slice(0, -7)) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $65484d02dcb7eb3e$var$propRe$4.test(prop)))
      filteredProps[prop] = props[prop];
  return filteredProps;
}
function $7215afc6de606d6b$export$de79e2c695e052f3$5(element2) {
  if ($7215afc6de606d6b$var$supportsPreventScroll$5())
    element2.focus({
      preventScroll: true
    });
  else {
    let scrollableElements = $7215afc6de606d6b$var$getScrollableElements$5(element2);
    element2.focus();
    $7215afc6de606d6b$var$restoreScrollPosition$5(scrollableElements);
  }
}
let $7215afc6de606d6b$var$supportsPreventScrollCached$5 = null;
function $7215afc6de606d6b$var$supportsPreventScroll$5() {
  if ($7215afc6de606d6b$var$supportsPreventScrollCached$5 == null) {
    $7215afc6de606d6b$var$supportsPreventScrollCached$5 = false;
    try {
      let focusElem = document.createElement("div");
      focusElem.focus({
        get preventScroll() {
          $7215afc6de606d6b$var$supportsPreventScrollCached$5 = true;
          return true;
        }
      });
    } catch {
    }
  }
  return $7215afc6de606d6b$var$supportsPreventScrollCached$5;
}
function $7215afc6de606d6b$var$getScrollableElements$5(element2) {
  let parent = element2.parentNode;
  let scrollableElements = [];
  let rootScrollingElement = document.scrollingElement || document.documentElement;
  while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
    if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth)
      scrollableElements.push({
        element: parent,
        scrollTop: parent.scrollTop,
        scrollLeft: parent.scrollLeft
      });
    parent = parent.parentNode;
  }
  if (rootScrollingElement instanceof HTMLElement)
    scrollableElements.push({
      element: rootScrollingElement,
      scrollTop: rootScrollingElement.scrollTop,
      scrollLeft: rootScrollingElement.scrollLeft
    });
  return scrollableElements;
}
function $7215afc6de606d6b$var$restoreScrollPosition$5(scrollableElements) {
  for (let { element: element2, scrollTop, scrollLeft } of scrollableElements) {
    element2.scrollTop = scrollTop;
    element2.scrollLeft = scrollLeft;
  }
}
function $c87311424ea30a05$var$testUserAgent$6(re2) {
  var _window_navigator_userAgentData;
  if (typeof window === "undefined" || window.navigator == null)
    return false;
  let brands = (_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands;
  return Array.isArray(brands) && brands.some((brand) => re2.test(brand.brand)) || re2.test(window.navigator.userAgent);
}
function $c87311424ea30a05$var$testPlatform$6(re2) {
  var _window_navigator_userAgentData;
  return typeof window !== "undefined" && window.navigator != null ? re2.test(((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
}
function $c87311424ea30a05$var$cached$6(fn) {
  let res = null;
  return () => {
    if (res == null)
      res = fn();
    return res;
  };
}
const $c87311424ea30a05$export$9ac100e40613ea10$6 = $c87311424ea30a05$var$cached$6(function() {
  return $c87311424ea30a05$var$testPlatform$6(/^Mac/i);
});
const $c87311424ea30a05$export$186c6964ca17d99$3 = $c87311424ea30a05$var$cached$6(function() {
  return $c87311424ea30a05$var$testPlatform$6(/^iPhone/i);
});
const $c87311424ea30a05$export$7bef049ce92e4224$5 = $c87311424ea30a05$var$cached$6(function() {
  return $c87311424ea30a05$var$testPlatform$6(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
  $c87311424ea30a05$export$9ac100e40613ea10$6() && navigator.maxTouchPoints > 1;
});
const $c87311424ea30a05$export$fedb369cb70207f1$3 = $c87311424ea30a05$var$cached$6(function() {
  return $c87311424ea30a05$export$186c6964ca17d99$3() || $c87311424ea30a05$export$7bef049ce92e4224$5();
});
const $c87311424ea30a05$export$e1865c3bedcd822b = $c87311424ea30a05$var$cached$6(function() {
  return $c87311424ea30a05$export$9ac100e40613ea10$6() || $c87311424ea30a05$export$fedb369cb70207f1$3();
});
const $c87311424ea30a05$export$78551043582a6a98$5 = $c87311424ea30a05$var$cached$6(function() {
  return $c87311424ea30a05$var$testUserAgent$6(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e$5();
});
const $c87311424ea30a05$export$6446a186d09e379e$5 = $c87311424ea30a05$var$cached$6(function() {
  return $c87311424ea30a05$var$testUserAgent$6(/Chrome/i);
});
const $c87311424ea30a05$export$a11b0059900ceec8$4 = $c87311424ea30a05$var$cached$6(function() {
  return $c87311424ea30a05$var$testUserAgent$6(/Android/i);
});
const $c87311424ea30a05$export$b7d78993b74f766d$5 = $c87311424ea30a05$var$cached$6(function() {
  return $c87311424ea30a05$var$testUserAgent$6(/Firefox/i);
});
const $ea8dcbcb9ea1b556$var$RouterContext$2 = /* @__PURE__ */ reactExports.createContext({
  isNative: true,
  open: $ea8dcbcb9ea1b556$var$openSyntheticLink$2,
  useHref: (href) => href
});
function $ea8dcbcb9ea1b556$export$9a302a45f65d0572$2() {
  return reactExports.useContext($ea8dcbcb9ea1b556$var$RouterContext$2);
}
function $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(target, modifiers, setOpening = true) {
  var _window_event_type, _window_event;
  let { metaKey, ctrlKey, altKey, shiftKey } = modifiers;
  if ($c87311424ea30a05$export$b7d78993b74f766d$5() && ((_window_event = window.event) === null || _window_event === void 0 ? void 0 : (_window_event_type = _window_event.type) === null || _window_event_type === void 0 ? void 0 : _window_event_type.startsWith("key")) && target.target === "_blank") {
    if ($c87311424ea30a05$export$9ac100e40613ea10$6())
      metaKey = true;
    else
      ctrlKey = true;
  }
  let event = $c87311424ea30a05$export$78551043582a6a98$5() && $c87311424ea30a05$export$9ac100e40613ea10$6() && !$c87311424ea30a05$export$7bef049ce92e4224$5() && true ? new KeyboardEvent("keydown", {
    keyIdentifier: "Enter",
    metaKey,
    ctrlKey,
    altKey,
    shiftKey
  }) : new MouseEvent("click", {
    metaKey,
    ctrlKey,
    altKey,
    shiftKey,
    bubbles: true,
    cancelable: true
  });
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening = setOpening;
  $7215afc6de606d6b$export$de79e2c695e052f3$5(target);
  target.dispatchEvent(event);
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening = false;
}
$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening = false;
function $ea8dcbcb9ea1b556$var$getSyntheticLink$2(target, open) {
  if (target instanceof HTMLAnchorElement)
    open(target);
  else if (target.hasAttribute("data-href")) {
    let link2 = document.createElement("a");
    link2.href = target.getAttribute("data-href");
    if (target.hasAttribute("data-target"))
      link2.target = target.getAttribute("data-target");
    if (target.hasAttribute("data-rel"))
      link2.rel = target.getAttribute("data-rel");
    if (target.hasAttribute("data-download"))
      link2.download = target.getAttribute("data-download");
    if (target.hasAttribute("data-ping"))
      link2.ping = target.getAttribute("data-ping");
    if (target.hasAttribute("data-referrer-policy"))
      link2.referrerPolicy = target.getAttribute("data-referrer-policy");
    target.appendChild(link2);
    open(link2);
    target.removeChild(link2);
  }
}
function $ea8dcbcb9ea1b556$var$openSyntheticLink$2(target, modifiers) {
  $ea8dcbcb9ea1b556$var$getSyntheticLink$2(target, (link2) => $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(link2, modifiers));
}
function $ea8dcbcb9ea1b556$export$bdc77b0c0a3a85d6(props) {
  let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572$2();
  var _props_href;
  const href = router.useHref((_props_href = props.href) !== null && _props_href !== void 0 ? _props_href : "");
  return {
    "data-href": props.href ? href : void 0,
    "data-target": props.target,
    "data-rel": props.rel,
    "data-download": props.download,
    "data-ping": props.ping,
    "data-referrer-policy": props.referrerPolicy
  };
}
function $ea8dcbcb9ea1b556$export$7e924b3091a3bd18$1(props) {
  let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572$2();
  var _props_href;
  const href = router.useHref((_props_href = props === null || props === void 0 ? void 0 : props.href) !== null && _props_href !== void 0 ? _props_href : "");
  return {
    href: (props === null || props === void 0 ? void 0 : props.href) ? href : void 0,
    target: props === null || props === void 0 ? void 0 : props.target,
    rel: props === null || props === void 0 ? void 0 : props.rel,
    download: props === null || props === void 0 ? void 0 : props.download,
    ping: props === null || props === void 0 ? void 0 : props.ping,
    referrerPolicy: props === null || props === void 0 ? void 0 : props.referrerPolicy
  };
}
let $bbed8b41f857bcc0$var$transitionsByElement$3 = /* @__PURE__ */ new Map();
let $bbed8b41f857bcc0$var$transitionCallbacks$3 = /* @__PURE__ */ new Set();
function $bbed8b41f857bcc0$var$setupGlobalEvents$3() {
  if (typeof window === "undefined")
    return;
  function isTransitionEvent(event) {
    return "propertyName" in event;
  }
  let onTransitionStart = (e2) => {
    if (!isTransitionEvent(e2) || !e2.target)
      return;
    let transitions = $bbed8b41f857bcc0$var$transitionsByElement$3.get(e2.target);
    if (!transitions) {
      transitions = /* @__PURE__ */ new Set();
      $bbed8b41f857bcc0$var$transitionsByElement$3.set(e2.target, transitions);
      e2.target.addEventListener("transitioncancel", onTransitionEnd, {
        once: true
      });
    }
    transitions.add(e2.propertyName);
  };
  let onTransitionEnd = (e2) => {
    if (!isTransitionEvent(e2) || !e2.target)
      return;
    let properties2 = $bbed8b41f857bcc0$var$transitionsByElement$3.get(e2.target);
    if (!properties2)
      return;
    properties2.delete(e2.propertyName);
    if (properties2.size === 0) {
      e2.target.removeEventListener("transitioncancel", onTransitionEnd);
      $bbed8b41f857bcc0$var$transitionsByElement$3.delete(e2.target);
    }
    if ($bbed8b41f857bcc0$var$transitionsByElement$3.size === 0) {
      for (let cb2 of $bbed8b41f857bcc0$var$transitionCallbacks$3)
        cb2();
      $bbed8b41f857bcc0$var$transitionCallbacks$3.clear();
    }
  };
  document.body.addEventListener("transitionrun", onTransitionStart);
  document.body.addEventListener("transitionend", onTransitionEnd);
}
if (typeof document !== "undefined") {
  if (document.readyState !== "loading")
    $bbed8b41f857bcc0$var$setupGlobalEvents$3();
  else
    document.addEventListener("DOMContentLoaded", $bbed8b41f857bcc0$var$setupGlobalEvents$3);
}
function $bbed8b41f857bcc0$var$cleanupDetachedElements$3() {
  for (const [eventTarget] of $bbed8b41f857bcc0$var$transitionsByElement$3)
    if ("isConnected" in eventTarget && !eventTarget.isConnected)
      $bbed8b41f857bcc0$var$transitionsByElement$3.delete(eventTarget);
}
function $bbed8b41f857bcc0$export$24490316f764c430$3(fn) {
  requestAnimationFrame(() => {
    $bbed8b41f857bcc0$var$cleanupDetachedElements$3();
    if ($bbed8b41f857bcc0$var$transitionsByElement$3.size === 0)
      fn();
    else
      $bbed8b41f857bcc0$var$transitionCallbacks$3.add(fn);
  });
}
function $03deb23ff14920c4$export$4eaf04e54aa8eed6$3() {
  let globalListeners = reactExports.useRef(/* @__PURE__ */ new Map());
  let addGlobalListener = reactExports.useCallback((eventTarget, type4, listener, options) => {
    let fn = (options === null || options === void 0 ? void 0 : options.once) ? (...args) => {
      globalListeners.current.delete(listener);
      listener(...args);
    } : listener;
    globalListeners.current.set(listener, {
      type: type4,
      eventTarget,
      fn,
      options
    });
    eventTarget.addEventListener(type4, fn, options);
  }, []);
  let removeGlobalListener = reactExports.useCallback((eventTarget, type4, listener, options) => {
    var _globalListeners_current_get;
    let fn = ((_globalListeners_current_get = globalListeners.current.get(listener)) === null || _globalListeners_current_get === void 0 ? void 0 : _globalListeners_current_get.fn) || listener;
    eventTarget.removeEventListener(type4, fn, options);
    globalListeners.current.delete(listener);
  }, []);
  let removeAllGlobalListeners = reactExports.useCallback(() => {
    globalListeners.current.forEach((value2, key) => {
      removeGlobalListener(value2.eventTarget, value2.type, key, value2.options);
    });
  }, [
    removeGlobalListener
  ]);
  reactExports.useEffect(() => {
    return removeAllGlobalListeners;
  }, [
    removeAllGlobalListeners
  ]);
  return {
    addGlobalListener,
    removeGlobalListener,
    removeAllGlobalListeners
  };
}
function $313b98861ee5dd6c$export$d6875122194c7b44$1(props, defaultLabel) {
  let { id: id2, "aria-label": label, "aria-labelledby": labelledBy } = props;
  id2 = $bdb11010cef70236$export$f680877a34711e37$2(id2);
  if (labelledBy && label) {
    let ids2 = /* @__PURE__ */ new Set([
      id2,
      ...labelledBy.trim().split(/\s+/)
    ]);
    labelledBy = [
      ...ids2
    ].join(" ");
  } else if (labelledBy)
    labelledBy = labelledBy.trim().split(/\s+/).join(" ");
  if (!label && !labelledBy && defaultLabel)
    label = defaultLabel;
  return {
    id: id2,
    "aria-label": label,
    "aria-labelledby": labelledBy
  };
}
function $4f58c5f72bcf79f7$export$496315a1608d9602(effect, dependencies) {
  const isInitialMount = reactExports.useRef(true);
  const lastDeps = reactExports.useRef(null);
  reactExports.useEffect(() => {
    isInitialMount.current = true;
    return () => {
      isInitialMount.current = false;
    };
  }, []);
  reactExports.useEffect(() => {
    let prevDeps = lastDeps.current;
    if (isInitialMount.current)
      isInitialMount.current = false;
    else if (!prevDeps || dependencies.some((dep, i2) => !Object.is(dep, prevDeps[i2])))
      effect();
    lastDeps.current = dependencies;
  }, dependencies);
}
function $ca9b37712f007381$export$72ef708ab07251f1(effect, dependencies) {
  const isInitialMount = reactExports.useRef(true);
  const lastDeps = reactExports.useRef(null);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    isInitialMount.current = true;
    return () => {
      isInitialMount.current = false;
    };
  }, []);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (isInitialMount.current)
      isInitialMount.current = false;
    else if (!lastDeps.current || dependencies.some((dep, i2) => !Object.is(dep, lastDeps[i2])))
      effect();
    lastDeps.current = dependencies;
  }, dependencies);
}
function $9daab02d461809db$var$hasResizeObserver() {
  return typeof window.ResizeObserver !== "undefined";
}
function $9daab02d461809db$export$683480f191c0e3ea(options) {
  const { ref, box, onResize: onResize4 } = options;
  reactExports.useEffect(() => {
    let element2 = ref === null || ref === void 0 ? void 0 : ref.current;
    if (!element2)
      return;
    if (!$9daab02d461809db$var$hasResizeObserver()) {
      window.addEventListener("resize", onResize4, false);
      return () => {
        window.removeEventListener("resize", onResize4, false);
      };
    } else {
      const resizeObserverInstance = new window.ResizeObserver((entries) => {
        if (!entries.length)
          return;
        onResize4();
      });
      resizeObserverInstance.observe(element2, {
        box
      });
      return () => {
        if (element2)
          resizeObserverInstance.unobserve(element2);
      };
    }
  }, [
    onResize4,
    ref,
    box
  ]);
}
function $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, ref) {
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (context && context.ref && ref) {
      context.ref.current = ref.current;
      return () => {
        if (context.ref)
          context.ref.current = null;
      };
    }
  });
}
function $cc38e7bd3fc7b213$export$2bb74740c4e19def$1(node2, checkForOverflow) {
  if (!node2)
    return false;
  let style2 = window.getComputedStyle(node2);
  let isScrollable2 = /(auto|scroll)/.test(style2.overflow + style2.overflowX + style2.overflowY);
  if (isScrollable2 && checkForOverflow)
    isScrollable2 = node2.scrollHeight !== node2.clientHeight || node2.scrollWidth !== node2.clientWidth;
  return isScrollable2;
}
function $62d8ded9296f3872$export$cfa2225e87938781(node2, checkForOverflow) {
  let scrollableNode = node2;
  if ($cc38e7bd3fc7b213$export$2bb74740c4e19def$1(scrollableNode, checkForOverflow))
    scrollableNode = scrollableNode.parentElement;
  while (scrollableNode && !$cc38e7bd3fc7b213$export$2bb74740c4e19def$1(scrollableNode, checkForOverflow))
    scrollableNode = scrollableNode.parentElement;
  return scrollableNode || document.scrollingElement || document.documentElement;
}
function $a40c673dc9f6d9c7$export$94ed1c92c7beeb22(node2, checkForOverflow) {
  const scrollParents = [];
  while (node2 && node2 !== document.documentElement) {
    if ($cc38e7bd3fc7b213$export$2bb74740c4e19def$1(node2, checkForOverflow))
      scrollParents.push(node2);
    node2 = node2.parentElement;
  }
  return scrollParents;
}
let $ef06256079686ba0$var$descriptionId = 0;
const $ef06256079686ba0$var$descriptionNodes = /* @__PURE__ */ new Map();
function $ef06256079686ba0$export$f8aeda7b10753fa1(description) {
  let [id2, setId] = reactExports.useState();
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (!description)
      return;
    let desc = $ef06256079686ba0$var$descriptionNodes.get(description);
    if (!desc) {
      let id3 = `react-aria-description-${$ef06256079686ba0$var$descriptionId++}`;
      setId(id3);
      let node2 = document.createElement("div");
      node2.id = id3;
      node2.style.display = "none";
      node2.textContent = description;
      document.body.appendChild(node2);
      desc = {
        refCount: 0,
        element: node2
      };
      $ef06256079686ba0$var$descriptionNodes.set(description, desc);
    } else
      setId(desc.element.id);
    desc.refCount++;
    return () => {
      if (desc && --desc.refCount === 0) {
        desc.element.remove();
        $ef06256079686ba0$var$descriptionNodes.delete(description);
      }
    };
  }, [
    description
  ]);
  return {
    "aria-describedby": description ? id2 : void 0
  };
}
function $e9faafb641e167db$export$90fc3a17d93f704c(ref, event, handler, options) {
  let handleEvent = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(handler);
  let isDisabled = handler == null;
  reactExports.useEffect(() => {
    if (isDisabled || !ref.current)
      return;
    let element2 = ref.current;
    element2.addEventListener(event, handleEvent, options);
    return () => {
      element2.removeEventListener(event, handleEvent, options);
    };
  }, [
    ref,
    event,
    options,
    isDisabled,
    handleEvent
  ]);
}
function $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollView, element2) {
  let offsetX = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element2, "left");
  let offsetY = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element2, "top");
  let width = element2.offsetWidth;
  let height = element2.offsetHeight;
  let x2 = scrollView.scrollLeft;
  let y2 = scrollView.scrollTop;
  let { borderTopWidth, borderLeftWidth, scrollPaddingTop, scrollPaddingRight, scrollPaddingBottom, scrollPaddingLeft } = getComputedStyle(scrollView);
  let borderAdjustedX = x2 + parseInt(borderLeftWidth, 10);
  let borderAdjustedY = y2 + parseInt(borderTopWidth, 10);
  let maxX = borderAdjustedX + scrollView.clientWidth;
  let maxY = borderAdjustedY + scrollView.clientHeight;
  let scrollPaddingTopNumber = parseInt(scrollPaddingTop, 10) || 0;
  let scrollPaddingBottomNumber = parseInt(scrollPaddingBottom, 10) || 0;
  let scrollPaddingRightNumber = parseInt(scrollPaddingRight, 10) || 0;
  let scrollPaddingLeftNumber = parseInt(scrollPaddingLeft, 10) || 0;
  if (offsetX <= x2 + scrollPaddingLeftNumber)
    x2 = offsetX - parseInt(borderLeftWidth, 10) - scrollPaddingLeftNumber;
  else if (offsetX + width > maxX - scrollPaddingRightNumber)
    x2 += offsetX + width - maxX + scrollPaddingRightNumber;
  if (offsetY <= borderAdjustedY + scrollPaddingTopNumber)
    y2 = offsetY - parseInt(borderTopWidth, 10) - scrollPaddingTopNumber;
  else if (offsetY + height > maxY - scrollPaddingBottomNumber)
    y2 += offsetY + height - maxY + scrollPaddingBottomNumber;
  scrollView.scrollLeft = x2;
  scrollView.scrollTop = y2;
}
function $2f04cbc44ee30ce0$var$relativeOffset(ancestor, child, axis) {
  const prop = axis === "left" ? "offsetLeft" : "offsetTop";
  let sum = 0;
  while (child.offsetParent) {
    sum += child[prop];
    if (child.offsetParent === ancestor)
      break;
    else if (child.offsetParent.contains(ancestor)) {
      sum -= ancestor[prop];
      break;
    }
    child = child.offsetParent;
  }
  return sum;
}
function $2f04cbc44ee30ce0$export$c826860796309d1b(targetElement, opts2) {
  if (targetElement && document.contains(targetElement)) {
    let root2 = document.scrollingElement || document.documentElement;
    let isScrollPrevented = window.getComputedStyle(root2).overflow === "hidden";
    if (!isScrollPrevented) {
      var _targetElement_scrollIntoView;
      let { left: originalLeft, top: originalTop } = targetElement.getBoundingClientRect();
      targetElement === null || targetElement === void 0 ? void 0 : (_targetElement_scrollIntoView = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView === void 0 ? void 0 : _targetElement_scrollIntoView.call(targetElement, {
        block: "nearest"
      });
      let { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
      if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
        var _opts_containingElement_scrollIntoView, _opts_containingElement, _targetElement_scrollIntoView1;
        opts2 === null || opts2 === void 0 ? void 0 : (_opts_containingElement = opts2.containingElement) === null || _opts_containingElement === void 0 ? void 0 : (_opts_containingElement_scrollIntoView = _opts_containingElement.scrollIntoView) === null || _opts_containingElement_scrollIntoView === void 0 ? void 0 : _opts_containingElement_scrollIntoView.call(_opts_containingElement, {
          block: "center",
          inline: "center"
        });
        (_targetElement_scrollIntoView1 = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView1 === void 0 ? void 0 : _targetElement_scrollIntoView1.call(targetElement, {
          block: "nearest"
        });
      }
    } else {
      let scrollParents = $a40c673dc9f6d9c7$export$94ed1c92c7beeb22(targetElement);
      for (let scrollParent of scrollParents)
        $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollParent, targetElement);
    }
  }
}
function $6a7db85432448f7f$export$60278871457622de$4(event) {
  if (event.mozInputSource === 0 && event.isTrusted)
    return true;
  if ($c87311424ea30a05$export$a11b0059900ceec8$4() && event.pointerType)
    return event.type === "click" && event.buttons === 1;
  return event.detail === 0 && !event.pointerType;
}
function $6a7db85432448f7f$export$29bf1b5f2c56cf63$3(event) {
  return !$c87311424ea30a05$export$a11b0059900ceec8$4() && event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
}
function $5a387cc49350e6db$export$722debc0e56fea39(value2, isEqual2) {
  let lastValue = reactExports.useRef(null);
  if (value2 && lastValue.current && isEqual2(value2, lastValue.current))
    value2 = lastValue.current;
  lastValue.current = value2;
  return value2;
}
function $99facab73266f662$export$5add1d006293d136(ref, initialValue, onReset) {
  let handleReset = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    if (onReset)
      onReset(initialValue);
  });
  reactExports.useEffect(() => {
    var _ref_current;
    let form2 = ref === null || ref === void 0 ? void 0 : (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.form;
    form2 === null || form2 === void 0 ? void 0 : form2.addEventListener("reset", handleReset);
    return () => {
      form2 === null || form2 === void 0 ? void 0 : form2.removeEventListener("reset", handleReset);
    };
  }, [
    ref,
    handleReset
  ]);
}
const $5671b20cf9b562b2$export$447a38995de2c711 = "react-aria-clear-focus";
const $5671b20cf9b562b2$export$831c820ad60f9d12 = "react-aria-focus";
function $21f1aa98acb08317$export$16792effe837dba3(e2) {
  if ($c87311424ea30a05$export$9ac100e40613ea10$6())
    return e2.metaKey;
  return e2.ctrlKey;
}
const $7d2416ea0959daaa$var$supportsCheckVisibility$3 = typeof Element !== "undefined" && "checkVisibility" in Element.prototype;
function $7d2416ea0959daaa$var$isStyleVisible$3(element2) {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  if (!(element2 instanceof windowObject.HTMLElement) && !(element2 instanceof windowObject.SVGElement))
    return false;
  let { display, visibility } = element2.style;
  let isVisible2 = display !== "none" && visibility !== "hidden" && visibility !== "collapse";
  if (isVisible2) {
    const { getComputedStyle: getComputedStyle2 } = element2.ownerDocument.defaultView;
    let { display: computedDisplay, visibility: computedVisibility } = getComputedStyle2(element2);
    isVisible2 = computedDisplay !== "none" && computedVisibility !== "hidden" && computedVisibility !== "collapse";
  }
  return isVisible2;
}
function $7d2416ea0959daaa$var$isAttributeVisible$3(element2, childElement) {
  return !element2.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking.
  !element2.hasAttribute("data-react-aria-prevent-focus") && (element2.nodeName === "DETAILS" && childElement && childElement.nodeName !== "SUMMARY" ? element2.hasAttribute("open") : true);
}
function $7d2416ea0959daaa$export$e989c0fffaa6b27a$3(element2, childElement) {
  if ($7d2416ea0959daaa$var$supportsCheckVisibility$3)
    return element2.checkVisibility();
  return element2.nodeName !== "#comment" && $7d2416ea0959daaa$var$isStyleVisible$3(element2) && $7d2416ea0959daaa$var$isAttributeVisible$3(element2, childElement) && (!element2.parentElement || $7d2416ea0959daaa$export$e989c0fffaa6b27a$3(element2.parentElement, element2));
}
const $b4b717babfbb907b$var$focusableElements$3 = [
  "input:not([disabled]):not([type=hidden])",
  "select:not([disabled])",
  "textarea:not([disabled])",
  "button:not([disabled])",
  "a[href]",
  "area[href]",
  "summary",
  "iframe",
  "object",
  "embed",
  "audio[controls]",
  "video[controls]",
  '[contenteditable]:not([contenteditable^="false"])',
  "permission"
];
const $b4b717babfbb907b$var$FOCUSABLE_ELEMENT_SELECTOR$3 = $b4b717babfbb907b$var$focusableElements$3.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
$b4b717babfbb907b$var$focusableElements$3.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
const $b4b717babfbb907b$var$TABBABLE_ELEMENT_SELECTOR = $b4b717babfbb907b$var$focusableElements$3.join(':not([hidden]):not([tabindex="-1"]),');
function $b4b717babfbb907b$export$4c063cf1350e6fed$3(element2) {
  return element2.matches($b4b717babfbb907b$var$FOCUSABLE_ELEMENT_SELECTOR$3) && $7d2416ea0959daaa$export$e989c0fffaa6b27a$3(element2) && !$b4b717babfbb907b$var$isInert$3(element2);
}
function $b4b717babfbb907b$export$bebd5a1431fec25d(element2) {
  return element2.matches($b4b717babfbb907b$var$TABBABLE_ELEMENT_SELECTOR) && $7d2416ea0959daaa$export$e989c0fffaa6b27a$3(element2) && !$b4b717babfbb907b$var$isInert$3(element2);
}
function $b4b717babfbb907b$var$isInert$3(element2) {
  let node2 = element2;
  while (node2 != null) {
    if (node2 instanceof node2.ownerDocument.defaultView.HTMLElement && node2.inert)
      return true;
    node2 = node2.parentElement;
  }
  return false;
}
const $edcf132a9284368a$var$AXIS = {
  top: "top",
  bottom: "top",
  left: "left",
  right: "left"
};
const $edcf132a9284368a$var$FLIPPED_DIRECTION = {
  top: "bottom",
  bottom: "top",
  left: "right",
  right: "left"
};
const $edcf132a9284368a$var$CROSS_AXIS = {
  top: "left",
  left: "top"
};
const $edcf132a9284368a$var$AXIS_SIZE = {
  top: "height",
  left: "width"
};
const $edcf132a9284368a$var$TOTAL_SIZE = {
  width: "totalWidth",
  height: "totalHeight"
};
const $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE = {};
let $edcf132a9284368a$var$visualViewport = typeof document !== "undefined" ? window.visualViewport : null;
function $edcf132a9284368a$var$getContainerDimensions(containerNode) {
  let width = 0, height = 0, totalWidth = 0, totalHeight = 0, top2 = 0, left2 = 0;
  let scroll = {};
  var _visualViewport_scale;
  let isPinchZoomedIn = ((_visualViewport_scale = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.scale) !== null && _visualViewport_scale !== void 0 ? _visualViewport_scale : 1) > 1;
  if (containerNode.tagName === "BODY") {
    let documentElement = document.documentElement;
    totalWidth = documentElement.clientWidth;
    totalHeight = documentElement.clientHeight;
    var _visualViewport_width;
    width = (_visualViewport_width = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.width) !== null && _visualViewport_width !== void 0 ? _visualViewport_width : totalWidth;
    var _visualViewport_height;
    height = (_visualViewport_height = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.height) !== null && _visualViewport_height !== void 0 ? _visualViewport_height : totalHeight;
    scroll.top = documentElement.scrollTop || containerNode.scrollTop;
    scroll.left = documentElement.scrollLeft || containerNode.scrollLeft;
    if ($edcf132a9284368a$var$visualViewport) {
      top2 = $edcf132a9284368a$var$visualViewport.offsetTop;
      left2 = $edcf132a9284368a$var$visualViewport.offsetLeft;
    }
  } else {
    ({ width, height, top: top2, left: left2 } = $edcf132a9284368a$var$getOffset(containerNode));
    scroll.top = containerNode.scrollTop;
    scroll.left = containerNode.scrollLeft;
    totalWidth = width;
    totalHeight = height;
  }
  if ($c87311424ea30a05$export$78551043582a6a98$5() && (containerNode.tagName === "BODY" || containerNode.tagName === "HTML") && isPinchZoomedIn) {
    scroll.top = 0;
    scroll.left = 0;
    var _visualViewport_pageTop;
    top2 = (_visualViewport_pageTop = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.pageTop) !== null && _visualViewport_pageTop !== void 0 ? _visualViewport_pageTop : 0;
    var _visualViewport_pageLeft;
    left2 = (_visualViewport_pageLeft = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.pageLeft) !== null && _visualViewport_pageLeft !== void 0 ? _visualViewport_pageLeft : 0;
  }
  return {
    width,
    height,
    totalWidth,
    totalHeight,
    scroll,
    top: top2,
    left: left2
  };
}
function $edcf132a9284368a$var$getScroll(node2) {
  return {
    top: node2.scrollTop,
    left: node2.scrollLeft,
    width: node2.scrollWidth,
    height: node2.scrollHeight
  };
}
function $edcf132a9284368a$var$getDelta(axis, offset2, size2, boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary) {
  var _containerDimensions_scroll_axis;
  let containerScroll = (_containerDimensions_scroll_axis = containerDimensions.scroll[axis]) !== null && _containerDimensions_scroll_axis !== void 0 ? _containerDimensions_scroll_axis : 0;
  let boundarySize = boundaryDimensions[$edcf132a9284368a$var$AXIS_SIZE[axis]];
  let boundaryStartEdge = boundaryDimensions.scroll[$edcf132a9284368a$var$AXIS[axis]] + padding;
  let boundaryEndEdge = boundarySize + boundaryDimensions.scroll[$edcf132a9284368a$var$AXIS[axis]] - padding;
  let startEdgeOffset = offset2 - containerScroll + containerOffsetWithBoundary[axis] - boundaryDimensions[$edcf132a9284368a$var$AXIS[axis]];
  let endEdgeOffset = offset2 - containerScroll + size2 + containerOffsetWithBoundary[axis] - boundaryDimensions[$edcf132a9284368a$var$AXIS[axis]];
  if (startEdgeOffset < boundaryStartEdge)
    return boundaryStartEdge - startEdgeOffset;
  else if (endEdgeOffset > boundaryEndEdge)
    return Math.max(boundaryEndEdge - endEdgeOffset, boundaryStartEdge - startEdgeOffset);
  else
    return 0;
}
function $edcf132a9284368a$var$getMargins(node2) {
  let style2 = window.getComputedStyle(node2);
  return {
    top: parseInt(style2.marginTop, 10) || 0,
    bottom: parseInt(style2.marginBottom, 10) || 0,
    left: parseInt(style2.marginLeft, 10) || 0,
    right: parseInt(style2.marginRight, 10) || 0
  };
}
function $edcf132a9284368a$var$parsePlacement(input2) {
  if ($edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input2])
    return $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input2];
  let [placement, crossPlacement] = input2.split(" ");
  let axis = $edcf132a9284368a$var$AXIS[placement] || "right";
  let crossAxis = $edcf132a9284368a$var$CROSS_AXIS[axis];
  if (!$edcf132a9284368a$var$AXIS[crossPlacement])
    crossPlacement = "center";
  let size2 = $edcf132a9284368a$var$AXIS_SIZE[axis];
  let crossSize = $edcf132a9284368a$var$AXIS_SIZE[crossAxis];
  $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input2] = {
    placement,
    crossPlacement,
    axis,
    crossAxis,
    size: size2,
    crossSize
  };
  return $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input2];
}
function $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset2, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset) {
  let { placement, crossPlacement, axis, crossAxis, size: size2, crossSize } = placementInfo;
  let position2 = {};
  var _childOffset_crossAxis;
  position2[crossAxis] = (_childOffset_crossAxis = childOffset[crossAxis]) !== null && _childOffset_crossAxis !== void 0 ? _childOffset_crossAxis : 0;
  var _childOffset_crossSize, _overlaySize_crossSize, _childOffset_crossSize1, _overlaySize_crossSize1;
  if (crossPlacement === "center")
    position2[crossAxis] += (((_childOffset_crossSize = childOffset[crossSize]) !== null && _childOffset_crossSize !== void 0 ? _childOffset_crossSize : 0) - ((_overlaySize_crossSize = overlaySize[crossSize]) !== null && _overlaySize_crossSize !== void 0 ? _overlaySize_crossSize : 0)) / 2;
  else if (crossPlacement !== crossAxis)
    position2[crossAxis] += ((_childOffset_crossSize1 = childOffset[crossSize]) !== null && _childOffset_crossSize1 !== void 0 ? _childOffset_crossSize1 : 0) - ((_overlaySize_crossSize1 = overlaySize[crossSize]) !== null && _overlaySize_crossSize1 !== void 0 ? _overlaySize_crossSize1 : 0);
  position2[crossAxis] += crossOffset;
  const minPosition = childOffset[crossAxis] - overlaySize[crossSize] + arrowSize + arrowBoundaryOffset;
  const maxPosition = childOffset[crossAxis] + childOffset[crossSize] - arrowSize - arrowBoundaryOffset;
  position2[crossAxis] = $9446cca9a3875146$export$7d15b64cf5a3a4c4(position2[crossAxis], minPosition, maxPosition);
  if (placement === axis) {
    const containerHeight = isContainerPositioned ? containerOffsetWithBoundary[size2] : boundaryDimensions[$edcf132a9284368a$var$TOTAL_SIZE[size2]];
    position2[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] = Math.floor(containerHeight - childOffset[axis] + offset2);
  } else
    position2[axis] = Math.floor(childOffset[axis] + childOffset[size2] + offset2);
  return position2;
}
function $edcf132a9284368a$var$getMaxHeight(position2, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlayHeight, heightGrowthDirection) {
  const containerHeight = isContainerPositioned ? containerOffsetWithBoundary.height : boundaryDimensions[$edcf132a9284368a$var$TOTAL_SIZE.height];
  var _position_bottom;
  let overlayTop = position2.top != null ? containerOffsetWithBoundary.top + position2.top : containerOffsetWithBoundary.top + (containerHeight - ((_position_bottom = position2.bottom) !== null && _position_bottom !== void 0 ? _position_bottom : 0) - overlayHeight);
  var _boundaryDimensions_scroll_top, _margins_top, _margins_bottom, _boundaryDimensions_scroll_top1, _margins_top1, _margins_bottom1;
  let maxHeight = heightGrowthDirection !== "top" ? (
    // We want the distance between the top of the overlay to the bottom of the boundary
    Math.max(0, boundaryDimensions.height + boundaryDimensions.top + ((_boundaryDimensions_scroll_top = boundaryDimensions.scroll.top) !== null && _boundaryDimensions_scroll_top !== void 0 ? _boundaryDimensions_scroll_top : 0) - overlayTop - (((_margins_top = margins.top) !== null && _margins_top !== void 0 ? _margins_top : 0) + ((_margins_bottom = margins.bottom) !== null && _margins_bottom !== void 0 ? _margins_bottom : 0) + padding))
  ) : Math.max(0, overlayTop + overlayHeight - (boundaryDimensions.top + ((_boundaryDimensions_scroll_top1 = boundaryDimensions.scroll.top) !== null && _boundaryDimensions_scroll_top1 !== void 0 ? _boundaryDimensions_scroll_top1 : 0)) - (((_margins_top1 = margins.top) !== null && _margins_top1 !== void 0 ? _margins_top1 : 0) + ((_margins_bottom1 = margins.bottom) !== null && _margins_bottom1 !== void 0 ? _margins_bottom1 : 0) + padding));
  return Math.min(boundaryDimensions.height - padding * 2, maxHeight);
}
function $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo) {
  let { placement, axis, size: size2 } = placementInfo;
  var _boundaryDimensions_scroll_axis, _margins_axis;
  if (placement === axis)
    return Math.max(0, childOffset[axis] - boundaryDimensions[axis] - ((_boundaryDimensions_scroll_axis = boundaryDimensions.scroll[axis]) !== null && _boundaryDimensions_scroll_axis !== void 0 ? _boundaryDimensions_scroll_axis : 0) + containerOffsetWithBoundary[axis] - ((_margins_axis = margins[axis]) !== null && _margins_axis !== void 0 ? _margins_axis : 0) - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding);
  var _margins_axis1;
  return Math.max(0, boundaryDimensions[size2] + boundaryDimensions[axis] + boundaryDimensions.scroll[axis] - containerOffsetWithBoundary[axis] - childOffset[axis] - childOffset[size2] - ((_margins_axis1 = margins[axis]) !== null && _margins_axis1 !== void 0 ? _margins_axis1 : 0) - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding);
}
function $edcf132a9284368a$export$6839422d1f33cee9(placementInput, childOffset, overlaySize, scrollSize, margins, padding, flip2, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset2, crossOffset, isContainerPositioned, userSetMaxHeight, arrowSize, arrowBoundaryOffset) {
  let placementInfo = $edcf132a9284368a$var$parsePlacement(placementInput);
  let { size: size2, crossAxis, crossSize, placement, crossPlacement } = placementInfo;
  let position2 = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset2, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
  let normalizedOffset = offset2;
  let space2 = $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset2, placementInfo);
  if (flip2 && scrollSize[size2] > space2) {
    let flippedPlacementInfo = $edcf132a9284368a$var$parsePlacement(`${$edcf132a9284368a$var$FLIPPED_DIRECTION[placement]} ${crossPlacement}`);
    let flippedPosition = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, flippedPlacementInfo, offset2, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
    let flippedSpace = $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset2, flippedPlacementInfo);
    if (flippedSpace > space2) {
      placementInfo = flippedPlacementInfo;
      position2 = flippedPosition;
      normalizedOffset = offset2;
    }
  }
  let heightGrowthDirection = "bottom";
  if (placementInfo.axis === "top") {
    if (placementInfo.placement === "top")
      heightGrowthDirection = "top";
    else if (placementInfo.placement === "bottom")
      heightGrowthDirection = "bottom";
  } else if (placementInfo.crossAxis === "top") {
    if (placementInfo.crossPlacement === "top")
      heightGrowthDirection = "bottom";
    else if (placementInfo.crossPlacement === "bottom")
      heightGrowthDirection = "top";
  }
  let delta = $edcf132a9284368a$var$getDelta(crossAxis, position2[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
  position2[crossAxis] += delta;
  let maxHeight = $edcf132a9284368a$var$getMaxHeight(position2, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlaySize.height, heightGrowthDirection);
  if (userSetMaxHeight && userSetMaxHeight < maxHeight)
    maxHeight = userSetMaxHeight;
  overlaySize.height = Math.min(overlaySize.height, maxHeight);
  position2 = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, normalizedOffset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
  delta = $edcf132a9284368a$var$getDelta(crossAxis, position2[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
  position2[crossAxis] += delta;
  let arrowPosition = {};
  let preferredArrowPosition = childOffset[crossAxis] + 0.5 * childOffset[crossSize] - position2[crossAxis] - margins[$edcf132a9284368a$var$AXIS[crossAxis]];
  const arrowMinPosition = arrowSize / 2 + arrowBoundaryOffset;
  var _margins_left, _margins_right, _margins_top, _margins_bottom;
  const overlayMargin = $edcf132a9284368a$var$AXIS[crossAxis] === "left" ? ((_margins_left = margins.left) !== null && _margins_left !== void 0 ? _margins_left : 0) + ((_margins_right = margins.right) !== null && _margins_right !== void 0 ? _margins_right : 0) : ((_margins_top = margins.top) !== null && _margins_top !== void 0 ? _margins_top : 0) + ((_margins_bottom = margins.bottom) !== null && _margins_bottom !== void 0 ? _margins_bottom : 0);
  const arrowMaxPosition = overlaySize[crossSize] - overlayMargin - arrowSize / 2 - arrowBoundaryOffset;
  const arrowOverlappingChildMinEdge = childOffset[crossAxis] + arrowSize / 2 - (position2[crossAxis] + margins[$edcf132a9284368a$var$AXIS[crossAxis]]);
  const arrowOverlappingChildMaxEdge = childOffset[crossAxis] + childOffset[crossSize] - arrowSize / 2 - (position2[crossAxis] + margins[$edcf132a9284368a$var$AXIS[crossAxis]]);
  const arrowPositionOverlappingChild = $9446cca9a3875146$export$7d15b64cf5a3a4c4(preferredArrowPosition, arrowOverlappingChildMinEdge, arrowOverlappingChildMaxEdge);
  arrowPosition[crossAxis] = $9446cca9a3875146$export$7d15b64cf5a3a4c4(arrowPositionOverlappingChild, arrowMinPosition, arrowMaxPosition);
  return {
    position: position2,
    maxHeight,
    arrowOffsetLeft: arrowPosition.left,
    arrowOffsetTop: arrowPosition.top,
    placement: placementInfo.placement
  };
}
function $edcf132a9284368a$export$b3ceb0cbf1056d98(opts2) {
  let { placement, targetNode, overlayNode, scrollNode, padding, shouldFlip, boundaryElement, offset: offset2, crossOffset, maxHeight, arrowSize = 0, arrowBoundaryOffset = 0 } = opts2;
  let container = overlayNode instanceof HTMLElement ? $edcf132a9284368a$var$getContainingBlock(overlayNode) : document.documentElement;
  let isViewportContainer = container === document.documentElement;
  const containerPositionStyle = window.getComputedStyle(container).position;
  let isContainerPositioned = !!containerPositionStyle && containerPositionStyle !== "static";
  let childOffset = isViewportContainer ? $edcf132a9284368a$var$getOffset(targetNode) : $edcf132a9284368a$var$getPosition(targetNode, container);
  if (!isViewportContainer) {
    let { marginTop, marginLeft } = window.getComputedStyle(targetNode);
    childOffset.top += parseInt(marginTop, 10) || 0;
    childOffset.left += parseInt(marginLeft, 10) || 0;
  }
  let overlaySize = $edcf132a9284368a$var$getOffset(overlayNode);
  let margins = $edcf132a9284368a$var$getMargins(overlayNode);
  var _margins_left, _margins_right;
  overlaySize.width += ((_margins_left = margins.left) !== null && _margins_left !== void 0 ? _margins_left : 0) + ((_margins_right = margins.right) !== null && _margins_right !== void 0 ? _margins_right : 0);
  var _margins_top, _margins_bottom;
  overlaySize.height += ((_margins_top = margins.top) !== null && _margins_top !== void 0 ? _margins_top : 0) + ((_margins_bottom = margins.bottom) !== null && _margins_bottom !== void 0 ? _margins_bottom : 0);
  let scrollSize = $edcf132a9284368a$var$getScroll(scrollNode);
  let boundaryDimensions = $edcf132a9284368a$var$getContainerDimensions(boundaryElement);
  let containerDimensions = $edcf132a9284368a$var$getContainerDimensions(container);
  let containerOffsetWithBoundary = boundaryElement.tagName === "BODY" ? $edcf132a9284368a$var$getOffset(container) : $edcf132a9284368a$var$getPosition(container, boundaryElement);
  if (container.tagName === "HTML" && boundaryElement.tagName === "BODY") {
    containerDimensions.scroll.top = 0;
    containerDimensions.scroll.left = 0;
  }
  return $edcf132a9284368a$export$6839422d1f33cee9(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset2, crossOffset, isContainerPositioned, maxHeight, arrowSize, arrowBoundaryOffset);
}
function $edcf132a9284368a$var$getOffset(node2) {
  let { top: top2, left: left2, width, height } = node2.getBoundingClientRect();
  let { scrollTop, scrollLeft, clientTop, clientLeft } = document.documentElement;
  return {
    top: top2 + scrollTop - clientTop,
    left: left2 + scrollLeft - clientLeft,
    width,
    height
  };
}
function $edcf132a9284368a$var$getPosition(node2, parent) {
  let style2 = window.getComputedStyle(node2);
  let offset2;
  if (style2.position === "fixed") {
    let { top: top2, left: left2, width, height } = node2.getBoundingClientRect();
    offset2 = {
      top: top2,
      left: left2,
      width,
      height
    };
  } else {
    offset2 = $edcf132a9284368a$var$getOffset(node2);
    let parentOffset = $edcf132a9284368a$var$getOffset(parent);
    let parentStyle = window.getComputedStyle(parent);
    parentOffset.top += (parseInt(parentStyle.borderTopWidth, 10) || 0) - parent.scrollTop;
    parentOffset.left += (parseInt(parentStyle.borderLeftWidth, 10) || 0) - parent.scrollLeft;
    offset2.top -= parentOffset.top;
    offset2.left -= parentOffset.left;
  }
  offset2.top -= parseInt(style2.marginTop, 10) || 0;
  offset2.left -= parseInt(style2.marginLeft, 10) || 0;
  return offset2;
}
function $edcf132a9284368a$var$getContainingBlock(node2) {
  let offsetParent = node2.offsetParent;
  if (offsetParent && offsetParent === document.body && window.getComputedStyle(offsetParent).position === "static" && !$edcf132a9284368a$var$isContainingBlock(offsetParent))
    offsetParent = document.documentElement;
  if (offsetParent == null) {
    offsetParent = node2.parentElement;
    while (offsetParent && !$edcf132a9284368a$var$isContainingBlock(offsetParent))
      offsetParent = offsetParent.parentElement;
  }
  return offsetParent || document.documentElement;
}
function $edcf132a9284368a$var$isContainingBlock(node2) {
  let style2 = window.getComputedStyle(node2);
  return style2.transform !== "none" || /transform|perspective/.test(style2.willChange) || style2.filter !== "none" || style2.contain === "paint" || "backdropFilter" in style2 && style2.backdropFilter !== "none" || "WebkitBackdropFilter" in style2 && style2.WebkitBackdropFilter !== "none";
}
const $dd149f63282afbbf$export$f6211563215e3b37$2 = /* @__PURE__ */ new WeakMap();
function $dd149f63282afbbf$export$18fc8428861184da(opts2) {
  let { triggerRef, isOpen, onClose } = opts2;
  reactExports.useEffect(() => {
    if (!isOpen || onClose === null)
      return;
    let onScroll6 = (e2) => {
      let target = e2.target;
      if (!triggerRef.current || target instanceof Node && !target.contains(triggerRef.current))
        return;
      if (e2.target instanceof HTMLInputElement || e2.target instanceof HTMLTextAreaElement)
        return;
      let onCloseHandler = onClose || $dd149f63282afbbf$export$f6211563215e3b37$2.get(triggerRef.current);
      if (onCloseHandler)
        onCloseHandler();
    };
    window.addEventListener("scroll", onScroll6, true);
    return () => {
      window.removeEventListener("scroll", onScroll6, true);
    };
  }, [
    isOpen,
    onClose,
    triggerRef
  ]);
}
const $148a7a147e38ea7f$var$RTL_SCRIPTS$9 = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS$9 = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764$9(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS$9.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS$9.has(lang2);
}
const $b5e257d569688ac6$var$defaultContext$c = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$c = /* @__PURE__ */ React$5.createContext($b5e257d569688ac6$var$defaultContext$c);
const $b5e257d569688ac6$var$IsSSRContext$c = /* @__PURE__ */ React$5.createContext(false);
let $b5e257d569688ac6$var$componentIds$c = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$c(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$c);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$c.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$c.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$c.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$c(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$c);
  let counter = $b5e257d569688ac6$var$useCounter$c(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$c(defaultId) {
  let id2 = React$5.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$c());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$c.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$5["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$c : $b5e257d569688ac6$var$useLegacySSRSafeId$c;
function $b5e257d569688ac6$var$getSnapshot$c() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$c() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$c(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$c() {
  if (typeof React$5["useSyncExternalStore"] === "function")
    return React$5["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$c, $b5e257d569688ac6$var$getSnapshot$c, $b5e257d569688ac6$var$getServerSnapshot$c);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$c);
}
const $1e5a04cdaf7d1af8$var$localeSymbol$9 = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$9() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol$9] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764$9(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale$9 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$9();
let $1e5a04cdaf7d1af8$var$listeners$9 = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale$9() {
  $1e5a04cdaf7d1af8$var$currentLocale$9 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$9();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners$9)
    listener($1e5a04cdaf7d1af8$var$currentLocale$9);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$9() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$c();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale$9);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners$9.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$9);
    $1e5a04cdaf7d1af8$var$listeners$9.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners$9.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners$9.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$9);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext$9 = /* @__PURE__ */ React$5.createContext(null);
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9() {
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$9();
  let context = reactExports.useContext($18f2051aff69b9bf$var$I18nContext$9);
  return context || defaultLocale;
}
const $fca6afa0e843324b$var$cache$1 = /* @__PURE__ */ new WeakMap();
function $fca6afa0e843324b$var$getCachedDictionary$1(strings) {
  let dictionary = $fca6afa0e843324b$var$cache$1.get(strings);
  if (!dictionary) {
    dictionary = new $5b160d28a433310d$export$c17fa47878dc55b6(strings);
    $fca6afa0e843324b$var$cache$1.set(strings, dictionary);
  }
  return dictionary;
}
function $fca6afa0e843324b$export$87b761675e8eaa10$1(strings, packageName) {
  return packageName && $5b160d28a433310d$export$c17fa47878dc55b6.getGlobalDictionaryForPackage(packageName) || $fca6afa0e843324b$var$getCachedDictionary$1(strings);
}
function $fca6afa0e843324b$export$f12b703ca79dfbb1$1(strings, packageName) {
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let dictionary = $fca6afa0e843324b$export$87b761675e8eaa10$1(strings, packageName);
  return reactExports.useMemo(() => new $6db58dc88e78b024$export$2f817fcdc4b89ae0(locale2, dictionary), [
    locale2,
    dictionary
  ]);
}
function $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1(options) {
  options = $5a387cc49350e6db$export$722debc0e56fea39(options !== null && options !== void 0 ? options : {}, $896ba0a80a8f4d36$var$isEqual$1);
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  return reactExports.useMemo(() => new $fb18d541ea1ad717$export$ad991b66133851cf(locale2, options), [
    locale2,
    options
  ]);
}
function $896ba0a80a8f4d36$var$isEqual$1(a2, b2) {
  if (a2 === b2)
    return true;
  let aKeys = Object.keys(a2);
  let bKeys = Object.keys(b2);
  if (aKeys.length !== bKeys.length)
    return false;
  for (let key of aKeys) {
    if (b2[key] !== a2[key])
      return false;
  }
  return true;
}
function $a916eb452884faea$export$b7a616150fdb9f44$1(options = {}) {
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  return reactExports.useMemo(() => new $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5(locale2, options), [
    locale2,
    options
  ]);
}
let $325a3faab7a68acd$var$cache$2 = /* @__PURE__ */ new Map();
function $325a3faab7a68acd$export$a16aca283550c30d$2(options) {
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let cacheKey = locale2 + (options ? Object.entries(options).sort((a2, b2) => a2[0] < b2[0] ? -1 : 1).join() : "");
  if ($325a3faab7a68acd$var$cache$2.has(cacheKey))
    return $325a3faab7a68acd$var$cache$2.get(cacheKey);
  let formatter = new Intl.Collator(locale2, options);
  $325a3faab7a68acd$var$cache$2.set(cacheKey, formatter);
  return formatter;
}
function $bb77f239b46e8c72$export$3274cf84b703fff$1(options) {
  let collator = $325a3faab7a68acd$export$a16aca283550c30d$2({
    usage: "search",
    ...options
  });
  let startsWith = reactExports.useCallback((string3, substring) => {
    if (substring.length === 0)
      return true;
    string3 = string3.normalize("NFC");
    substring = substring.normalize("NFC");
    return collator.compare(string3.slice(0, substring.length), substring) === 0;
  }, [
    collator
  ]);
  let endsWith2 = reactExports.useCallback((string3, substring) => {
    if (substring.length === 0)
      return true;
    string3 = string3.normalize("NFC");
    substring = substring.normalize("NFC");
    return collator.compare(string3.slice(-substring.length), substring) === 0;
  }, [
    collator
  ]);
  let contains2 = reactExports.useCallback((string3, substring) => {
    if (substring.length === 0)
      return true;
    string3 = string3.normalize("NFC");
    substring = substring.normalize("NFC");
    let scan = 0;
    let sliceLen = substring.length;
    for (; scan + sliceLen <= string3.length; scan++) {
      let slice2 = string3.slice(scan, scan + sliceLen);
      if (collator.compare(substring, slice2) === 0)
        return true;
    }
    return false;
  }, [
    collator
  ]);
  return reactExports.useMemo(() => ({
    startsWith,
    endsWith: endsWith2,
    contains: contains2
  }), [
    startsWith,
    endsWith2,
    contains2
  ]);
}
let $2a41e45df1593e64$var$visualViewport = typeof document !== "undefined" ? window.visualViewport : null;
function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let { arrowSize = 0, targetRef, overlayRef, scrollRef = overlayRef, placement = "bottom", containerPadding = 12, shouldFlip = true, boundaryElement = typeof document !== "undefined" ? document.body : null, offset: offset2 = 0, crossOffset = 0, shouldUpdatePosition = true, isOpen = true, onClose, maxHeight, arrowBoundaryOffset = 0 } = props;
  let [position2, setPosition] = reactExports.useState(null);
  let deps = [
    shouldUpdatePosition,
    placement,
    overlayRef.current,
    targetRef.current,
    scrollRef.current,
    containerPadding,
    shouldFlip,
    boundaryElement,
    offset2,
    crossOffset,
    isOpen,
    direction,
    maxHeight,
    arrowBoundaryOffset,
    arrowSize
  ];
  let lastScale = reactExports.useRef($2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.scale);
  reactExports.useEffect(() => {
    if (isOpen)
      lastScale.current = $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.scale;
  }, [
    isOpen
  ]);
  let updatePosition = reactExports.useCallback(() => {
    if (shouldUpdatePosition === false || !isOpen || !overlayRef.current || !targetRef.current || !boundaryElement)
      return;
    if (($2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.scale) !== lastScale.current)
      return;
    let anchor = null;
    if (scrollRef.current && scrollRef.current.contains(document.activeElement)) {
      var _document_activeElement;
      let anchorRect = (_document_activeElement = document.activeElement) === null || _document_activeElement === void 0 ? void 0 : _document_activeElement.getBoundingClientRect();
      let scrollRect = scrollRef.current.getBoundingClientRect();
      var _anchorRect_top;
      anchor = {
        type: "top",
        offset: ((_anchorRect_top = anchorRect === null || anchorRect === void 0 ? void 0 : anchorRect.top) !== null && _anchorRect_top !== void 0 ? _anchorRect_top : 0) - scrollRect.top
      };
      if (anchor.offset > scrollRect.height / 2) {
        anchor.type = "bottom";
        var _anchorRect_bottom;
        anchor.offset = ((_anchorRect_bottom = anchorRect === null || anchorRect === void 0 ? void 0 : anchorRect.bottom) !== null && _anchorRect_bottom !== void 0 ? _anchorRect_bottom : 0) - scrollRect.bottom;
      }
    }
    let overlay = overlayRef.current;
    if (!maxHeight && overlayRef.current) {
      var _window_visualViewport;
      overlay.style.top = "0px";
      overlay.style.bottom = "";
      var _window_visualViewport_height;
      overlay.style.maxHeight = ((_window_visualViewport_height = (_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.height) !== null && _window_visualViewport_height !== void 0 ? _window_visualViewport_height : window.innerHeight) + "px";
    }
    let position3 = $edcf132a9284368a$export$b3ceb0cbf1056d98({
      placement: $2a41e45df1593e64$var$translateRTL(placement, direction),
      overlayNode: overlayRef.current,
      targetNode: targetRef.current,
      scrollNode: scrollRef.current || overlayRef.current,
      padding: containerPadding,
      shouldFlip,
      boundaryElement,
      offset: offset2,
      crossOffset,
      maxHeight,
      arrowSize,
      arrowBoundaryOffset
    });
    if (!position3.position)
      return;
    overlay.style.top = "";
    overlay.style.bottom = "";
    overlay.style.left = "";
    overlay.style.right = "";
    Object.keys(position3.position).forEach((key) => overlay.style[key] = position3.position[key] + "px");
    overlay.style.maxHeight = position3.maxHeight != null ? position3.maxHeight + "px" : "";
    if (anchor && document.activeElement && scrollRef.current) {
      let anchorRect = document.activeElement.getBoundingClientRect();
      let scrollRect = scrollRef.current.getBoundingClientRect();
      let newOffset = anchorRect[anchor.type] - scrollRect[anchor.type];
      scrollRef.current.scrollTop += newOffset - anchor.offset;
    }
    setPosition(position3);
  }, deps);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(updatePosition, deps);
  $2a41e45df1593e64$var$useResize(updatePosition);
  $9daab02d461809db$export$683480f191c0e3ea({
    ref: overlayRef,
    onResize: updatePosition
  });
  $9daab02d461809db$export$683480f191c0e3ea({
    ref: targetRef,
    onResize: updatePosition
  });
  let isResizing = reactExports.useRef(false);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let timeout;
    let onResize4 = () => {
      isResizing.current = true;
      clearTimeout(timeout);
      timeout = setTimeout(() => {
        isResizing.current = false;
      }, 500);
      updatePosition();
    };
    let onScroll6 = () => {
      if (isResizing.current)
        onResize4();
    };
    $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener("resize", onResize4);
    $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener("scroll", onScroll6);
    return () => {
      $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener("resize", onResize4);
      $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener("scroll", onScroll6);
    };
  }, [
    updatePosition
  ]);
  let close = reactExports.useCallback(() => {
    if (!isResizing.current)
      onClose === null || onClose === void 0 ? void 0 : onClose();
  }, [
    onClose,
    isResizing
  ]);
  $dd149f63282afbbf$export$18fc8428861184da({
    triggerRef: targetRef,
    isOpen,
    onClose: onClose && close
  });
  var _position_maxHeight, _position_placement;
  return {
    overlayProps: {
      style: {
        position: "absolute",
        zIndex: 1e5,
        ...position2 === null || position2 === void 0 ? void 0 : position2.position,
        maxHeight: (_position_maxHeight = position2 === null || position2 === void 0 ? void 0 : position2.maxHeight) !== null && _position_maxHeight !== void 0 ? _position_maxHeight : "100vh"
      }
    },
    placement: (_position_placement = position2 === null || position2 === void 0 ? void 0 : position2.placement) !== null && _position_placement !== void 0 ? _position_placement : null,
    arrowProps: {
      "aria-hidden": "true",
      role: "presentation",
      style: {
        left: position2 === null || position2 === void 0 ? void 0 : position2.arrowOffsetLeft,
        top: position2 === null || position2 === void 0 ? void 0 : position2.arrowOffsetTop
      }
    },
    updatePosition
  };
}
function $2a41e45df1593e64$var$useResize(onResize4) {
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    window.addEventListener("resize", onResize4, false);
    return () => {
      window.removeEventListener("resize", onResize4, false);
    };
  }, [
    onResize4
  ]);
}
function $2a41e45df1593e64$var$translateRTL(position2, direction) {
  if (direction === "rtl")
    return position2.replace("start", "right").replace("end", "left");
  return position2.replace("start", "left").replace("end", "right");
}
function $8a9cb279dc87e130$export$525bc4921d56d4a$d(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$c(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$715c682d09d639cc$5(onBlur) {
  let stateRef = reactExports.useRef({
    isFocused: false,
    observer: null
  });
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    const state = stateRef.current;
    return () => {
      if (state.observer) {
        state.observer.disconnect();
        state.observer = null;
      }
    };
  }, []);
  let dispatchBlur = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onBlur === null || onBlur === void 0 ? void 0 : onBlur(e2);
  });
  return reactExports.useCallback((e2) => {
    if (e2.target instanceof HTMLButtonElement || e2.target instanceof HTMLInputElement || e2.target instanceof HTMLTextAreaElement || e2.target instanceof HTMLSelectElement) {
      stateRef.current.isFocused = true;
      let target = e2.target;
      let onBlurHandler = (e3) => {
        stateRef.current.isFocused = false;
        if (target.disabled) {
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a$d(e3);
          dispatchBlur(event);
        }
        if (stateRef.current.observer) {
          stateRef.current.observer.disconnect();
          stateRef.current.observer = null;
        }
      };
      target.addEventListener("focusout", onBlurHandler, {
        once: true
      });
      stateRef.current.observer = new MutationObserver(() => {
        if (stateRef.current.isFocused && target.disabled) {
          var _stateRef_current_observer;
          (_stateRef_current_observer = stateRef.current.observer) === null || _stateRef_current_observer === void 0 ? void 0 : _stateRef_current_observer.disconnect();
          let relatedTargetEl = target === document.activeElement ? null : document.activeElement;
          target.dispatchEvent(new FocusEvent("blur", {
            relatedTarget: relatedTargetEl
          }));
          target.dispatchEvent(new FocusEvent("focusout", {
            bubbles: true,
            relatedTarget: relatedTargetEl
          }));
        }
      });
      stateRef.current.observer.observe(target, {
        attributes: true,
        attributeFilter: [
          "disabled"
        ]
      });
    }
  }, [
    dispatchBlur
  ]);
}
let $8a9cb279dc87e130$export$fda7da73ab5d4c48$5 = false;
function $8a9cb279dc87e130$export$cabe61c495ee3649$b(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$3(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$4(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  $8a9cb279dc87e130$export$fda7da73ab5d4c48$5 = true;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    $8a9cb279dc87e130$export$fda7da73ab5d4c48$5 = false;
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$b = "default";
let $14c0b72509d70225$var$savedUserSelect$b = "";
let $14c0b72509d70225$var$modifiedElementMap$b = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$b(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$b === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
      $14c0b72509d70225$var$savedUserSelect$b = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$b = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$b.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$b(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$b !== "disabled")
      return;
    $14c0b72509d70225$var$state$b = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
        if ($14c0b72509d70225$var$state$b === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$b || "";
          $14c0b72509d70225$var$savedUserSelect$b = "";
          $14c0b72509d70225$var$state$b = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$b.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$b.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$b.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$b = React$5.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$b.displayName = "PressResponderContext";
function _class_apply_descriptor_get(receiver, descriptor) {
  if (descriptor.get)
    return descriptor.get.call(receiver);
  return descriptor.value;
}
function _class_extract_field_descriptor(receiver, privateMap, action) {
  if (!privateMap.has(receiver))
    throw new TypeError("attempted to " + action + " private field on non-instance");
  return privateMap.get(receiver);
}
function _class_private_field_get(receiver, privateMap) {
  var descriptor = _class_extract_field_descriptor(receiver, privateMap, "get");
  return _class_apply_descriptor_get(receiver, descriptor);
}
function _class_apply_descriptor_set(receiver, descriptor, value2) {
  if (descriptor.set)
    descriptor.set.call(receiver, value2);
  else {
    if (!descriptor.writable) {
      throw new TypeError("attempted to set read only private field");
    }
    descriptor.value = value2;
  }
}
function _class_private_field_set(receiver, privateMap, value2) {
  var descriptor = _class_extract_field_descriptor(receiver, privateMap, "set");
  _class_apply_descriptor_set(receiver, descriptor, value2);
  return value2;
}
function $f6c31cce2adf654f$var$usePressResponderContext$b(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$b);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$9(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$b = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$b = class $f6c31cce2adf654f$var$PressEvent {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$b, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$b);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$b, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$b, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$b = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$b = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$b = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$b(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$b(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$b("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$b("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$b("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$b("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$b(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$b(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$c(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$d(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$b(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$b($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$b(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$3(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$b(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$9(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$6())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$4(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$b(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$b(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$b(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$b($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$b(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$b(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$b]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$b] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$3(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$b(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$b(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$b(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$b(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$5(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$b))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$b;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$b}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$b((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$b]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$b(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$b(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$b(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$b(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$b(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$b(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$b(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$b(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$b(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$b(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$b = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$b(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$b.has(target.type);
}
const $b5e257d569688ac6$var$defaultContext$b = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$b = /* @__PURE__ */ React$5.createContext($b5e257d569688ac6$var$defaultContext$b);
const $b5e257d569688ac6$var$IsSSRContext$b = /* @__PURE__ */ React$5.createContext(false);
let $b5e257d569688ac6$var$componentIds$b = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$b(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$b);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$b.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$b.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$b.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$b(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$b);
  let counter = $b5e257d569688ac6$var$useCounter$b(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$b(defaultId) {
  let id2 = React$5.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$b());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$b.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$5["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$b : $b5e257d569688ac6$var$useLegacySSRSafeId$b;
function $b5e257d569688ac6$var$getSnapshot$b() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$b() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$b(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$b() {
  if (typeof React$5["useSyncExternalStore"] === "function")
    return React$5["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$b, $b5e257d569688ac6$var$getSnapshot$b, $b5e257d569688ac6$var$getServerSnapshot$b);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$b);
}
let $507fabe10e71c6fb$var$currentModality$3 = null;
let $507fabe10e71c6fb$var$changeHandlers$5 = /* @__PURE__ */ new Set();
let $507fabe10e71c6fb$export$d90243b58daecda7$5 = /* @__PURE__ */ new Map();
let $507fabe10e71c6fb$var$hasEventBeforeFocus$5 = false;
let $507fabe10e71c6fb$var$hasBlurredWindowRecently$5 = false;
const $507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS$1 = {
  Tab: true,
  Escape: true
};
function $507fabe10e71c6fb$var$triggerChangeHandlers$5(modality, e2) {
  for (let handler of $507fabe10e71c6fb$var$changeHandlers$5)
    handler(modality, e2);
}
function $507fabe10e71c6fb$var$isValidKey$5(e2) {
  return !(e2.metaKey || !$c87311424ea30a05$export$9ac100e40613ea10$6() && e2.altKey || e2.ctrlKey || e2.key === "Control" || e2.key === "Shift" || e2.key === "Meta");
}
function $507fabe10e71c6fb$var$handleKeyboardEvent$5(e2) {
  $507fabe10e71c6fb$var$hasEventBeforeFocus$5 = true;
  if ($507fabe10e71c6fb$var$isValidKey$5(e2)) {
    $507fabe10e71c6fb$var$currentModality$3 = "keyboard";
    $507fabe10e71c6fb$var$triggerChangeHandlers$5("keyboard", e2);
  }
}
function $507fabe10e71c6fb$var$handlePointerEvent$5(e2) {
  $507fabe10e71c6fb$var$currentModality$3 = "pointer";
  if (e2.type === "mousedown" || e2.type === "pointerdown") {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$5 = true;
    $507fabe10e71c6fb$var$triggerChangeHandlers$5("pointer", e2);
  }
}
function $507fabe10e71c6fb$var$handleClickEvent$5(e2) {
  if ($6a7db85432448f7f$export$60278871457622de$4(e2)) {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$5 = true;
    $507fabe10e71c6fb$var$currentModality$3 = "virtual";
  }
}
function $507fabe10e71c6fb$var$handleFocusEvent$5(e2) {
  if (e2.target === window || e2.target === document || $8a9cb279dc87e130$export$fda7da73ab5d4c48$5 || !e2.isTrusted)
    return;
  if (!$507fabe10e71c6fb$var$hasEventBeforeFocus$5 && !$507fabe10e71c6fb$var$hasBlurredWindowRecently$5) {
    $507fabe10e71c6fb$var$currentModality$3 = "virtual";
    $507fabe10e71c6fb$var$triggerChangeHandlers$5("virtual", e2);
  }
  $507fabe10e71c6fb$var$hasEventBeforeFocus$5 = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently$5 = false;
}
function $507fabe10e71c6fb$var$handleWindowBlur$5() {
  if ($8a9cb279dc87e130$export$fda7da73ab5d4c48$5)
    return;
  $507fabe10e71c6fb$var$hasEventBeforeFocus$5 = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently$5 = true;
}
function $507fabe10e71c6fb$var$setupGlobalFocusEvents$5(element2) {
  if (typeof window === "undefined" || typeof document === "undefined" || $507fabe10e71c6fb$export$d90243b58daecda7$5.get($431fbd86ca7dc216$export$f21a1ffae260145a$4(element2)))
    return;
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  let focus = windowObject.HTMLElement.prototype.focus;
  windowObject.HTMLElement.prototype.focus = function() {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$5 = true;
    focus.apply(this, arguments);
  };
  documentObject.addEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent$5, true);
  documentObject.addEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent$5, true);
  documentObject.addEventListener("click", $507fabe10e71c6fb$var$handleClickEvent$5, true);
  windowObject.addEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent$5, true);
  windowObject.addEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur$5, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.addEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent$5, true);
    documentObject.addEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent$5, true);
    documentObject.addEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent$5, true);
  }
  windowObject.addEventListener("beforeunload", () => {
    $507fabe10e71c6fb$var$tearDownWindowFocusTracking$5(element2);
  }, {
    once: true
  });
  $507fabe10e71c6fb$export$d90243b58daecda7$5.set(windowObject, {
    focus
  });
}
const $507fabe10e71c6fb$var$tearDownWindowFocusTracking$5 = (element2, loadListener) => {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  if (loadListener)
    documentObject.removeEventListener("DOMContentLoaded", loadListener);
  if (!$507fabe10e71c6fb$export$d90243b58daecda7$5.has(windowObject))
    return;
  windowObject.HTMLElement.prototype.focus = $507fabe10e71c6fb$export$d90243b58daecda7$5.get(windowObject).focus;
  documentObject.removeEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent$5, true);
  documentObject.removeEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent$5, true);
  documentObject.removeEventListener("click", $507fabe10e71c6fb$var$handleClickEvent$5, true);
  windowObject.removeEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent$5, true);
  windowObject.removeEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur$5, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.removeEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent$5, true);
    documentObject.removeEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent$5, true);
    documentObject.removeEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent$5, true);
  }
  $507fabe10e71c6fb$export$d90243b58daecda7$5.delete(windowObject);
};
function $507fabe10e71c6fb$export$2f1888112f558a7d$5(element2) {
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  let loadListener;
  if (documentObject.readyState !== "loading")
    $507fabe10e71c6fb$var$setupGlobalFocusEvents$5(element2);
  else {
    loadListener = () => {
      $507fabe10e71c6fb$var$setupGlobalFocusEvents$5(element2);
    };
    documentObject.addEventListener("DOMContentLoaded", loadListener);
  }
  return () => $507fabe10e71c6fb$var$tearDownWindowFocusTracking$5(element2, loadListener);
}
if (typeof document !== "undefined")
  $507fabe10e71c6fb$export$2f1888112f558a7d$5();
function $507fabe10e71c6fb$export$b9b3dfddab17db27$2() {
  return $507fabe10e71c6fb$var$currentModality$3 !== "pointer";
}
function $507fabe10e71c6fb$export$630ff653c5ada6a9$2() {
  return $507fabe10e71c6fb$var$currentModality$3;
}
function $507fabe10e71c6fb$export$8397ddfc504fdb9a$2(modality) {
  $507fabe10e71c6fb$var$currentModality$3 = modality;
  $507fabe10e71c6fb$var$triggerChangeHandlers$5(modality, null);
}
function $507fabe10e71c6fb$export$98e20ec92f614cfe() {
  $507fabe10e71c6fb$var$setupGlobalFocusEvents$5();
  let [modality, setModality] = reactExports.useState($507fabe10e71c6fb$var$currentModality$3);
  reactExports.useEffect(() => {
    let handler = () => {
      setModality($507fabe10e71c6fb$var$currentModality$3);
    };
    $507fabe10e71c6fb$var$changeHandlers$5.add(handler);
    return () => {
      $507fabe10e71c6fb$var$changeHandlers$5.delete(handler);
    };
  }, []);
  return $b5e257d569688ac6$export$535bd6ca7f90a273$b() ? null : modality;
}
const $507fabe10e71c6fb$var$nonTextInputTypes$1 = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $507fabe10e71c6fb$var$isKeyboardFocusEvent$1(isTextInput, modality, e2) {
  let document1 = $431fbd86ca7dc216$export$b204af158042fbac$4(e2 === null || e2 === void 0 ? void 0 : e2.target);
  const IHTMLInputElement = typeof window !== "undefined" ? $431fbd86ca7dc216$export$f21a1ffae260145a$4(e2 === null || e2 === void 0 ? void 0 : e2.target).HTMLInputElement : HTMLInputElement;
  const IHTMLTextAreaElement = typeof window !== "undefined" ? $431fbd86ca7dc216$export$f21a1ffae260145a$4(e2 === null || e2 === void 0 ? void 0 : e2.target).HTMLTextAreaElement : HTMLTextAreaElement;
  const IHTMLElement = typeof window !== "undefined" ? $431fbd86ca7dc216$export$f21a1ffae260145a$4(e2 === null || e2 === void 0 ? void 0 : e2.target).HTMLElement : HTMLElement;
  const IKeyboardEvent = typeof window !== "undefined" ? $431fbd86ca7dc216$export$f21a1ffae260145a$4(e2 === null || e2 === void 0 ? void 0 : e2.target).KeyboardEvent : KeyboardEvent;
  isTextInput = isTextInput || document1.activeElement instanceof IHTMLInputElement && !$507fabe10e71c6fb$var$nonTextInputTypes$1.has(document1.activeElement.type) || document1.activeElement instanceof IHTMLTextAreaElement || document1.activeElement instanceof IHTMLElement && document1.activeElement.isContentEditable;
  return !(isTextInput && modality === "keyboard" && e2 instanceof IKeyboardEvent && !$507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS$1[e2.key]);
}
function $507fabe10e71c6fb$export$ec71b4b83ac08ec3$1(fn, deps, opts2) {
  $507fabe10e71c6fb$var$setupGlobalFocusEvents$5();
  reactExports.useEffect(() => {
    let handler = (modality, e2) => {
      if (!$507fabe10e71c6fb$var$isKeyboardFocusEvent$1(!!(opts2 === null || opts2 === void 0 ? void 0 : opts2.isTextInput), modality, e2))
        return;
      fn($507fabe10e71c6fb$export$b9b3dfddab17db27$2());
    };
    $507fabe10e71c6fb$var$changeHandlers$5.add(handler);
    return () => {
      $507fabe10e71c6fb$var$changeHandlers$5.delete(handler);
    };
  }, deps);
}
function $3ad3f6e1647bc98d$export$80f3e147d781571c$2(element2) {
  const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
  if ($507fabe10e71c6fb$export$630ff653c5ada6a9$2() === "virtual") {
    let lastFocusedElement = activeElement;
    $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
      if ($d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument) === lastFocusedElement && element2.isConnected)
        $7215afc6de606d6b$export$de79e2c695e052f3$5(element2);
    });
  } else
    $7215afc6de606d6b$export$de79e2c695e052f3$5(element2);
}
function $a1ea59d68270f0dd$export$f8168d8dd8fd66e6$2(props) {
  let { isDisabled, onFocus: onFocusProp, onBlur: onBlurProp, onFocusChange } = props;
  const onBlur = reactExports.useCallback((e2) => {
    if (e2.target === e2.currentTarget) {
      if (onBlurProp)
        onBlurProp(e2);
      if (onFocusChange)
        onFocusChange(false);
      return true;
    }
  }, [
    onBlurProp,
    onFocusChange
  ]);
  const onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc$5(onBlur);
  const onFocus = reactExports.useCallback((e2) => {
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(e2.target);
    const activeElement = ownerDocument ? $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument) : $d4ee10de306f2510$export$cd4e5573fbe2b576();
    if (e2.target === e2.currentTarget && activeElement === $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) {
      if (onFocusProp)
        onFocusProp(e2);
      if (onFocusChange)
        onFocusChange(true);
      onSyntheticFocus(e2);
    }
  }, [
    onFocusChange,
    onFocusProp,
    onSyntheticFocus
  ]);
  return {
    focusProps: {
      onFocus: !isDisabled && (onFocusProp || onFocusChange || onBlurProp) ? onFocus : void 0,
      onBlur: !isDisabled && (onBlurProp || onFocusChange) ? onBlur : void 0
    }
  };
}
function $93925083ecbb358c$export$48d1ea6320830260$2(handler) {
  if (!handler)
    return void 0;
  let shouldStopPropagation = true;
  return (e2) => {
    let event = {
      ...e2,
      preventDefault() {
        e2.preventDefault();
      },
      isDefaultPrevented() {
        return e2.isDefaultPrevented();
      },
      stopPropagation() {
        shouldStopPropagation = true;
      },
      continuePropagation() {
        shouldStopPropagation = false;
      },
      isPropagationStopped() {
        return shouldStopPropagation;
      }
    };
    handler(event);
    if (shouldStopPropagation)
      e2.stopPropagation();
  };
}
function $46d819fcbaf35654$export$8f71654801c2f7cd$2(props) {
  return {
    keyboardProps: props.isDisabled ? {} : {
      onKeyDown: $93925083ecbb358c$export$48d1ea6320830260$2(props.onKeyDown),
      onKeyUp: $93925083ecbb358c$export$48d1ea6320830260$2(props.onKeyUp)
    }
  };
}
let $f645667febf57a63$export$f9762fab77588ecb$2 = /* @__PURE__ */ React$5.createContext(null);
function $f645667febf57a63$var$useFocusableContext$2(ref) {
  let context = reactExports.useContext($f645667febf57a63$export$f9762fab77588ecb$2) || {};
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, ref);
  let { ref: _24, ...otherProps } = context;
  return otherProps;
}
function $f645667febf57a63$export$4c014de7c8940b4c$2(props, domRef) {
  let { focusProps } = $a1ea59d68270f0dd$export$f8168d8dd8fd66e6$2(props);
  let { keyboardProps } = $46d819fcbaf35654$export$8f71654801c2f7cd$2(props);
  let interactions = $3ef42575df84b30b$export$9d1611c77c2fe928$9(focusProps, keyboardProps);
  let domProps = $f645667febf57a63$var$useFocusableContext$2(domRef);
  let interactionProps = props.isDisabled ? {} : domProps;
  let autoFocusRef = reactExports.useRef(props.autoFocus);
  reactExports.useEffect(() => {
    if (autoFocusRef.current && domRef.current)
      $3ad3f6e1647bc98d$export$80f3e147d781571c$2(domRef.current);
    autoFocusRef.current = false;
  }, [
    domRef
  ]);
  let tabIndex = props.excludeFromTabOrder ? -1 : 0;
  if (props.isDisabled)
    tabIndex = void 0;
  return {
    focusableProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9({
      ...interactions,
      tabIndex
    }, interactionProps)
  };
}
function $f1ab8c75478c6f73$export$cf75428e0b9ed1ea({ children }) {
  let context = reactExports.useMemo(() => ({
    register: () => {
    }
  }), []);
  return /* @__PURE__ */ React$5.createElement($ae1eeba8b9eafd08$export$5165eccb35aaadb5$b.Provider, {
    value: context
  }, children);
}
function $9ab94262bd0047c7$export$420e68273165f4ec$4(props) {
  let { isDisabled, onBlurWithin, onFocusWithin, onFocusWithinChange } = props;
  let state = reactExports.useRef({
    isFocusWithin: false
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let onBlur = reactExports.useCallback((e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    if (state.current.isFocusWithin && !e2.currentTarget.contains(e2.relatedTarget)) {
      state.current.isFocusWithin = false;
      removeAllGlobalListeners();
      if (onBlurWithin)
        onBlurWithin(e2);
      if (onFocusWithinChange)
        onFocusWithinChange(false);
    }
  }, [
    onBlurWithin,
    onFocusWithinChange,
    state,
    removeAllGlobalListeners
  ]);
  let onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc$5(onBlur);
  let onFocus = reactExports.useCallback((e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(e2.target);
    const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
    if (!state.current.isFocusWithin && activeElement === $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) {
      if (onFocusWithin)
        onFocusWithin(e2);
      if (onFocusWithinChange)
        onFocusWithinChange(true);
      state.current.isFocusWithin = true;
      onSyntheticFocus(e2);
      let currentTarget = e2.currentTarget;
      addGlobalListener(ownerDocument, "focus", (e3) => {
        if (state.current.isFocusWithin && !$d4ee10de306f2510$export$4282f70798064fe0$3(currentTarget, e3.target)) {
          let nativeEvent = new ownerDocument.defaultView.FocusEvent("blur", {
            relatedTarget: e3.target
          });
          $8a9cb279dc87e130$export$c2b7abe5d61ec696$c(nativeEvent, currentTarget);
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a$d(nativeEvent);
          onBlur(event);
        }
      }, {
        capture: true
      });
    }
  }, [
    onFocusWithin,
    onFocusWithinChange,
    onSyntheticFocus,
    addGlobalListener,
    onBlur
  ]);
  if (isDisabled)
    return {
      focusWithinProps: {
        // These cannot be null, that would conflict in mergeProps
        onFocus: void 0,
        onBlur: void 0
      }
    };
  return {
    focusWithinProps: {
      onFocus,
      onBlur
    }
  };
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$h = false;
let $6179b936705e76d3$var$hoverCount$h = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$h() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$h = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$h = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$h(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$h();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$h() {
  if (typeof document === "undefined")
    return;
  if ($6179b936705e76d3$var$hoverCount$h === 0) {
    if (typeof PointerEvent !== "undefined")
      document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$h);
  }
  $6179b936705e76d3$var$hoverCount$h++;
  return () => {
    $6179b936705e76d3$var$hoverCount$h--;
    if ($6179b936705e76d3$var$hoverCount$h > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$h);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$h(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$h, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$h && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
  let { onMoveStart, onMove, onMoveEnd } = props;
  let state = reactExports.useRef({
    didMove: false,
    lastPosition: null,
    id: null
  });
  let { addGlobalListener, removeGlobalListener } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let move2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType, deltaX, deltaY) => {
    if (deltaX === 0 && deltaY === 0)
      return;
    if (!state.current.didMove) {
      state.current.didMove = true;
      onMoveStart === null || onMoveStart === void 0 ? void 0 : onMoveStart({
        type: "movestart",
        pointerType,
        shiftKey: originalEvent.shiftKey,
        metaKey: originalEvent.metaKey,
        ctrlKey: originalEvent.ctrlKey,
        altKey: originalEvent.altKey
      });
    }
    onMove === null || onMove === void 0 ? void 0 : onMove({
      type: "move",
      pointerType,
      deltaX,
      deltaY,
      shiftKey: originalEvent.shiftKey,
      metaKey: originalEvent.metaKey,
      ctrlKey: originalEvent.ctrlKey,
      altKey: originalEvent.altKey
    });
  });
  let end2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    $14c0b72509d70225$export$b0d6fa1ab32e3295$b();
    if (state.current.didMove)
      onMoveEnd === null || onMoveEnd === void 0 ? void 0 : onMoveEnd({
        type: "moveend",
        pointerType,
        shiftKey: originalEvent.shiftKey,
        metaKey: originalEvent.metaKey,
        ctrlKey: originalEvent.ctrlKey,
        altKey: originalEvent.altKey
      });
  });
  let moveProps = reactExports.useMemo(() => {
    let moveProps2 = {};
    let start2 = () => {
      $14c0b72509d70225$export$16a4697467175487$b();
      state.current.didMove = false;
    };
    {
      let onPointerMove = (e2) => {
        if (e2.pointerId === state.current.id) {
          var _state_current_lastPosition, _state_current_lastPosition1;
          let pointerType = e2.pointerType || "mouse";
          var _state_current_lastPosition_pageX, _state_current_lastPosition_pageY;
          move2(e2, pointerType, e2.pageX - ((_state_current_lastPosition_pageX = (_state_current_lastPosition = state.current.lastPosition) === null || _state_current_lastPosition === void 0 ? void 0 : _state_current_lastPosition.pageX) !== null && _state_current_lastPosition_pageX !== void 0 ? _state_current_lastPosition_pageX : 0), e2.pageY - ((_state_current_lastPosition_pageY = (_state_current_lastPosition1 = state.current.lastPosition) === null || _state_current_lastPosition1 === void 0 ? void 0 : _state_current_lastPosition1.pageY) !== null && _state_current_lastPosition_pageY !== void 0 ? _state_current_lastPosition_pageY : 0));
          state.current.lastPosition = {
            pageX: e2.pageX,
            pageY: e2.pageY
          };
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.current.id) {
          let pointerType = e2.pointerType || "mouse";
          end2(e2, pointerType);
          state.current.id = null;
          removeGlobalListener(window, "pointermove", onPointerMove, false);
          removeGlobalListener(window, "pointerup", onPointerUp, false);
          removeGlobalListener(window, "pointercancel", onPointerUp, false);
        }
      };
      moveProps2.onPointerDown = (e2) => {
        if (e2.button === 0 && state.current.id == null) {
          start2();
          e2.stopPropagation();
          e2.preventDefault();
          state.current.lastPosition = {
            pageX: e2.pageX,
            pageY: e2.pageY
          };
          state.current.id = e2.pointerId;
          addGlobalListener(window, "pointermove", onPointerMove, false);
          addGlobalListener(window, "pointerup", onPointerUp, false);
          addGlobalListener(window, "pointercancel", onPointerUp, false);
        }
      };
    }
    let triggerKeyboardMove = (e2, deltaX, deltaY) => {
      start2();
      move2(e2, "keyboard", deltaX, deltaY);
      end2(e2, "keyboard");
    };
    moveProps2.onKeyDown = (e2) => {
      switch (e2.key) {
        case "Left":
        case "ArrowLeft":
          e2.preventDefault();
          e2.stopPropagation();
          triggerKeyboardMove(e2, -1, 0);
          break;
        case "Right":
        case "ArrowRight":
          e2.preventDefault();
          e2.stopPropagation();
          triggerKeyboardMove(e2, 1, 0);
          break;
        case "Up":
        case "ArrowUp":
          e2.preventDefault();
          e2.stopPropagation();
          triggerKeyboardMove(e2, 0, -1);
          break;
        case "Down":
        case "ArrowDown":
          e2.preventDefault();
          e2.stopPropagation();
          triggerKeyboardMove(e2, 0, 1);
          break;
      }
    };
    return moveProps2;
  }, [
    state,
    addGlobalListener,
    removeGlobalListener,
    move2,
    end2
  ]);
  return {
    moveProps
  };
}
function $7d0a636d7a4dcefd$export$2123ff2b87c81ca(props, ref) {
  let { onScroll: onScroll6, isDisabled } = props;
  let onScrollHandler = reactExports.useCallback((e2) => {
    if (e2.ctrlKey)
      return;
    e2.preventDefault();
    e2.stopPropagation();
    if (onScroll6)
      onScroll6({
        deltaX: e2.deltaX,
        deltaY: e2.deltaY
      });
  }, [
    onScroll6
  ]);
  $e9faafb641e167db$export$90fc3a17d93f704c(ref, "wheel", isDisabled ? void 0 : onScrollHandler);
}
const $8a26561d2877236e$var$DEFAULT_THRESHOLD = 500;
function $8a26561d2877236e$export$c24ed0104d07eab9(props) {
  let { isDisabled, onLongPressStart, onLongPressEnd, onLongPress, threshold = $8a26561d2877236e$var$DEFAULT_THRESHOLD, accessibilityDescription } = props;
  const timeRef = reactExports.useRef(void 0);
  let { addGlobalListener, removeGlobalListener } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { pressProps } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    isDisabled,
    onPressStart(e2) {
      e2.continuePropagation();
      if (e2.pointerType === "mouse" || e2.pointerType === "touch") {
        if (onLongPressStart)
          onLongPressStart({
            ...e2,
            type: "longpressstart"
          });
        timeRef.current = setTimeout(() => {
          e2.target.dispatchEvent(new PointerEvent("pointercancel", {
            bubbles: true
          }));
          if ($431fbd86ca7dc216$export$b204af158042fbac$4(e2.target).activeElement !== e2.target)
            $7215afc6de606d6b$export$de79e2c695e052f3$5(e2.target);
          if (onLongPress)
            onLongPress({
              ...e2,
              type: "longpress"
            });
          timeRef.current = void 0;
        }, threshold);
        if (e2.pointerType === "touch") {
          let onContextMenu = (e3) => {
            e3.preventDefault();
          };
          addGlobalListener(e2.target, "contextmenu", onContextMenu, {
            once: true
          });
          addGlobalListener(window, "pointerup", () => {
            setTimeout(() => {
              removeGlobalListener(e2.target, "contextmenu", onContextMenu);
            }, 30);
          }, {
            once: true
          });
        }
      }
    },
    onPressEnd(e2) {
      if (timeRef.current)
        clearTimeout(timeRef.current);
      if (onLongPressEnd && (e2.pointerType === "mouse" || e2.pointerType === "touch"))
        onLongPressEnd({
          ...e2,
          type: "longpressend"
        });
    }
  });
  let descriptionProps = $ef06256079686ba0$export$f8aeda7b10753fa1(onLongPress && !isDisabled ? accessibilityDescription : void 0);
  return {
    longPressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(pressProps, descriptionProps)
  };
}
const $9bf71ea28793e738$var$FocusContext$1 = /* @__PURE__ */ React$5.createContext(null);
const $9bf71ea28793e738$var$RESTORE_FOCUS_EVENT$1 = "react-aria-focus-scope-restore";
let $9bf71ea28793e738$var$activeScope$1 = null;
function $9bf71ea28793e738$export$20e40289641fbbb6$1(props) {
  let { children, contain, restoreFocus, autoFocus } = props;
  let startRef = reactExports.useRef(null);
  let endRef = reactExports.useRef(null);
  let scopeRef = reactExports.useRef([]);
  let { parentNode } = reactExports.useContext($9bf71ea28793e738$var$FocusContext$1) || {};
  let node2 = reactExports.useMemo(() => new $9bf71ea28793e738$var$TreeNode$7({
    scopeRef
  }), [
    scopeRef
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let parent = parentNode || $9bf71ea28793e738$export$d06fae2ee68b101e$1.root;
    if ($9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(parent.scopeRef) && $9bf71ea28793e738$var$activeScope$1 && !$9bf71ea28793e738$var$isAncestorScope$1($9bf71ea28793e738$var$activeScope$1, parent.scopeRef)) {
      let activeNode = $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode($9bf71ea28793e738$var$activeScope$1);
      if (activeNode)
        parent = activeNode;
    }
    parent.addChild(node2);
    $9bf71ea28793e738$export$d06fae2ee68b101e$1.addNode(node2);
  }, [
    node2,
    parentNode
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let node3 = $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(scopeRef);
    if (node3)
      node3.contain = !!contain;
  }, [
    contain
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    var _startRef_current;
    let node3 = (_startRef_current = startRef.current) === null || _startRef_current === void 0 ? void 0 : _startRef_current.nextSibling;
    let nodes = [];
    let stopPropagation2 = (e2) => e2.stopPropagation();
    while (node3 && node3 !== endRef.current) {
      nodes.push(node3);
      node3.addEventListener($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT$1, stopPropagation2);
      node3 = node3.nextSibling;
    }
    scopeRef.current = nodes;
    return () => {
      for (let node4 of nodes)
        node4.removeEventListener($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT$1, stopPropagation2);
    };
  }, [
    children
  ]);
  $9bf71ea28793e738$var$useActiveScopeTracker$1(scopeRef, restoreFocus, contain);
  $9bf71ea28793e738$var$useFocusContainment$1(scopeRef, contain);
  $9bf71ea28793e738$var$useRestoreFocus$1(scopeRef, restoreFocus, contain);
  $9bf71ea28793e738$var$useAutoFocus$1(scopeRef, autoFocus);
  reactExports.useEffect(() => {
    const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4(scopeRef.current ? scopeRef.current[0] : void 0));
    let scope = null;
    if ($9bf71ea28793e738$var$isElementInScope$7(activeElement, scopeRef.current)) {
      for (let node3 of $9bf71ea28793e738$export$d06fae2ee68b101e$1.traverse())
        if (node3.scopeRef && $9bf71ea28793e738$var$isElementInScope$7(activeElement, node3.scopeRef.current))
          scope = node3;
      if (scope === $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(scopeRef))
        $9bf71ea28793e738$var$activeScope$1 = scope.scopeRef;
    }
  }, [
    scopeRef
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    return () => {
      var _focusScopeTree_getTreeNode_parent, _focusScopeTree_getTreeNode;
      var _focusScopeTree_getTreeNode_parent_scopeRef;
      let parentScope = (_focusScopeTree_getTreeNode_parent_scopeRef = (_focusScopeTree_getTreeNode = $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(scopeRef)) === null || _focusScopeTree_getTreeNode === void 0 ? void 0 : (_focusScopeTree_getTreeNode_parent = _focusScopeTree_getTreeNode.parent) === null || _focusScopeTree_getTreeNode_parent === void 0 ? void 0 : _focusScopeTree_getTreeNode_parent.scopeRef) !== null && _focusScopeTree_getTreeNode_parent_scopeRef !== void 0 ? _focusScopeTree_getTreeNode_parent_scopeRef : null;
      if ((scopeRef === $9bf71ea28793e738$var$activeScope$1 || $9bf71ea28793e738$var$isAncestorScope$1(scopeRef, $9bf71ea28793e738$var$activeScope$1)) && (!parentScope || $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(parentScope)))
        $9bf71ea28793e738$var$activeScope$1 = parentScope;
      $9bf71ea28793e738$export$d06fae2ee68b101e$1.removeTreeNode(scopeRef);
    };
  }, [
    scopeRef
  ]);
  let focusManager = reactExports.useMemo(() => $9bf71ea28793e738$var$createFocusManagerForScope$1(scopeRef), []);
  let value2 = reactExports.useMemo(() => ({
    focusManager,
    parentNode: node2
  }), [
    node2,
    focusManager
  ]);
  return /* @__PURE__ */ React$5.createElement($9bf71ea28793e738$var$FocusContext$1.Provider, {
    value: value2
  }, /* @__PURE__ */ React$5.createElement("span", {
    "data-focus-scope-start": true,
    hidden: true,
    ref: startRef
  }), children, /* @__PURE__ */ React$5.createElement("span", {
    "data-focus-scope-end": true,
    hidden: true,
    ref: endRef
  }));
}
function $9bf71ea28793e738$var$createFocusManagerForScope$1(scopeRef) {
  return {
    focusNext(opts2 = {}) {
      let scope = scopeRef.current;
      let { from: from2, tabbable, wrap: wrap2, accept } = opts2;
      var _scope_;
      let node2 = from2 || $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4((_scope_ = scope[0]) !== null && _scope_ !== void 0 ? _scope_ : void 0));
      let sentinel = scope[0].previousElementSibling;
      let scopeRoot = $9bf71ea28793e738$var$getScopeRoot$1(scope);
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$7(scopeRoot, {
        tabbable,
        accept
      }, scope);
      walker.currentNode = $9bf71ea28793e738$var$isElementInScope$7(node2, scope) ? node2 : sentinel;
      let nextNode = walker.nextNode();
      if (!nextNode && wrap2) {
        walker.currentNode = sentinel;
        nextNode = walker.nextNode();
      }
      if (nextNode)
        $9bf71ea28793e738$var$focusElement$2(nextNode, true);
      return nextNode;
    },
    focusPrevious(opts2 = {}) {
      let scope = scopeRef.current;
      let { from: from2, tabbable, wrap: wrap2, accept } = opts2;
      var _scope_;
      let node2 = from2 || $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4((_scope_ = scope[0]) !== null && _scope_ !== void 0 ? _scope_ : void 0));
      let sentinel = scope[scope.length - 1].nextElementSibling;
      let scopeRoot = $9bf71ea28793e738$var$getScopeRoot$1(scope);
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$7(scopeRoot, {
        tabbable,
        accept
      }, scope);
      walker.currentNode = $9bf71ea28793e738$var$isElementInScope$7(node2, scope) ? node2 : sentinel;
      let previousNode = walker.previousNode();
      if (!previousNode && wrap2) {
        walker.currentNode = sentinel;
        previousNode = walker.previousNode();
      }
      if (previousNode)
        $9bf71ea28793e738$var$focusElement$2(previousNode, true);
      return previousNode;
    },
    focusFirst(opts2 = {}) {
      let scope = scopeRef.current;
      let { tabbable, accept } = opts2;
      let scopeRoot = $9bf71ea28793e738$var$getScopeRoot$1(scope);
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$7(scopeRoot, {
        tabbable,
        accept
      }, scope);
      walker.currentNode = scope[0].previousElementSibling;
      let nextNode = walker.nextNode();
      if (nextNode)
        $9bf71ea28793e738$var$focusElement$2(nextNode, true);
      return nextNode;
    },
    focusLast(opts2 = {}) {
      let scope = scopeRef.current;
      let { tabbable, accept } = opts2;
      let scopeRoot = $9bf71ea28793e738$var$getScopeRoot$1(scope);
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$7(scopeRoot, {
        tabbable,
        accept
      }, scope);
      walker.currentNode = scope[scope.length - 1].nextElementSibling;
      let previousNode = walker.previousNode();
      if (previousNode)
        $9bf71ea28793e738$var$focusElement$2(previousNode, true);
      return previousNode;
    }
  };
}
function $9bf71ea28793e738$var$getScopeRoot$1(scope) {
  return scope[0].parentElement;
}
function $9bf71ea28793e738$var$shouldContainFocus$1(scopeRef) {
  let scope = $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode($9bf71ea28793e738$var$activeScope$1);
  while (scope && scope.scopeRef !== scopeRef) {
    if (scope.contain)
      return false;
    scope = scope.parent;
  }
  return true;
}
function $9bf71ea28793e738$var$isTabbableRadio$6(element2) {
  if (element2.checked)
    return true;
  let radios = [];
  if (!element2.form)
    radios = [
      ...$431fbd86ca7dc216$export$b204af158042fbac$4(element2).querySelectorAll(`input[type="radio"][name="${CSS.escape(element2.name)}"]`)
    ].filter((radio2) => !radio2.form);
  else {
    var _element_form_elements, _element_form;
    let radioList = (_element_form = element2.form) === null || _element_form === void 0 ? void 0 : (_element_form_elements = _element_form.elements) === null || _element_form_elements === void 0 ? void 0 : _element_form_elements.namedItem(element2.name);
    radios = [
      ...radioList !== null && radioList !== void 0 ? radioList : []
    ];
  }
  if (!radios)
    return false;
  let anyChecked = radios.some((radio2) => radio2.checked);
  return !anyChecked;
}
function $9bf71ea28793e738$var$useFocusContainment$1(scopeRef, contain) {
  let focusedNode = reactExports.useRef(void 0);
  let raf3 = reactExports.useRef(void 0);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let scope = scopeRef.current;
    if (!contain) {
      if (raf3.current) {
        cancelAnimationFrame(raf3.current);
        raf3.current = void 0;
      }
      return;
    }
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scope ? scope[0] : void 0);
    let onKeyDown = (e2) => {
      if (e2.key !== "Tab" || e2.altKey || e2.ctrlKey || e2.metaKey || !$9bf71ea28793e738$var$shouldContainFocus$1(scopeRef) || e2.isComposing)
        return;
      let focusedElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
      let scope2 = scopeRef.current;
      if (!scope2 || !$9bf71ea28793e738$var$isElementInScope$7(focusedElement, scope2))
        return;
      let scopeRoot = $9bf71ea28793e738$var$getScopeRoot$1(scope2);
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$7(scopeRoot, {
        tabbable: true
      }, scope2);
      if (!focusedElement)
        return;
      walker.currentNode = focusedElement;
      let nextElement = e2.shiftKey ? walker.previousNode() : walker.nextNode();
      if (!nextElement) {
        walker.currentNode = e2.shiftKey ? scope2[scope2.length - 1].nextElementSibling : scope2[0].previousElementSibling;
        nextElement = e2.shiftKey ? walker.previousNode() : walker.nextNode();
      }
      e2.preventDefault();
      if (nextElement)
        $9bf71ea28793e738$var$focusElement$2(nextElement, true);
    };
    let onFocus = (e2) => {
      if ((!$9bf71ea28793e738$var$activeScope$1 || $9bf71ea28793e738$var$isAncestorScope$1($9bf71ea28793e738$var$activeScope$1, scopeRef)) && $9bf71ea28793e738$var$isElementInScope$7($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), scopeRef.current)) {
        $9bf71ea28793e738$var$activeScope$1 = scopeRef;
        focusedNode.current = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
      } else if ($9bf71ea28793e738$var$shouldContainFocus$1(scopeRef) && !$9bf71ea28793e738$var$isElementInChildScope$1($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), scopeRef)) {
        if (focusedNode.current)
          focusedNode.current.focus();
        else if ($9bf71ea28793e738$var$activeScope$1 && $9bf71ea28793e738$var$activeScope$1.current)
          $9bf71ea28793e738$var$focusFirstInScope$1($9bf71ea28793e738$var$activeScope$1.current);
      } else if ($9bf71ea28793e738$var$shouldContainFocus$1(scopeRef))
        focusedNode.current = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
    };
    let onBlur = (e2) => {
      if (raf3.current)
        cancelAnimationFrame(raf3.current);
      raf3.current = requestAnimationFrame(() => {
        let modality = $507fabe10e71c6fb$export$630ff653c5ada6a9$2();
        let shouldSkipFocusRestore = (modality === "virtual" || modality === null) && $c87311424ea30a05$export$a11b0059900ceec8$4() && $c87311424ea30a05$export$6446a186d09e379e$5();
        let activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
        if (!shouldSkipFocusRestore && activeElement && $9bf71ea28793e738$var$shouldContainFocus$1(scopeRef) && !$9bf71ea28793e738$var$isElementInChildScope$1(activeElement, scopeRef)) {
          $9bf71ea28793e738$var$activeScope$1 = scopeRef;
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
          if (target && target.isConnected) {
            var _focusedNode_current;
            focusedNode.current = target;
            (_focusedNode_current = focusedNode.current) === null || _focusedNode_current === void 0 ? void 0 : _focusedNode_current.focus();
          } else if ($9bf71ea28793e738$var$activeScope$1.current)
            $9bf71ea28793e738$var$focusFirstInScope$1($9bf71ea28793e738$var$activeScope$1.current);
        }
      });
    };
    ownerDocument.addEventListener("keydown", onKeyDown, false);
    ownerDocument.addEventListener("focusin", onFocus, false);
    scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.addEventListener("focusin", onFocus, false));
    scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.addEventListener("focusout", onBlur, false));
    return () => {
      ownerDocument.removeEventListener("keydown", onKeyDown, false);
      ownerDocument.removeEventListener("focusin", onFocus, false);
      scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.removeEventListener("focusin", onFocus, false));
      scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.removeEventListener("focusout", onBlur, false));
    };
  }, [
    scopeRef,
    contain
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    return () => {
      if (raf3.current)
        cancelAnimationFrame(raf3.current);
    };
  }, [
    raf3
  ]);
}
function $9bf71ea28793e738$var$isElementInAnyScope$1(element2) {
  return $9bf71ea28793e738$var$isElementInChildScope$1(element2);
}
function $9bf71ea28793e738$var$isElementInScope$7(element2, scope) {
  if (!element2)
    return false;
  if (!scope)
    return false;
  return scope.some((node2) => node2.contains(element2));
}
function $9bf71ea28793e738$var$isElementInChildScope$1(element2, scope = null) {
  if (element2 instanceof Element && element2.closest("[data-react-aria-top-layer]"))
    return true;
  for (let { scopeRef: s2 } of $9bf71ea28793e738$export$d06fae2ee68b101e$1.traverse($9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(scope))) {
    if (s2 && $9bf71ea28793e738$var$isElementInScope$7(element2, s2.current))
      return true;
  }
  return false;
}
function $9bf71ea28793e738$var$isAncestorScope$1(ancestor, scope) {
  var _focusScopeTree_getTreeNode;
  let parent = (_focusScopeTree_getTreeNode = $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(scope)) === null || _focusScopeTree_getTreeNode === void 0 ? void 0 : _focusScopeTree_getTreeNode.parent;
  while (parent) {
    if (parent.scopeRef === ancestor)
      return true;
    parent = parent.parent;
  }
  return false;
}
function $9bf71ea28793e738$var$focusElement$2(element2, scroll = false) {
  if (element2 != null && !scroll)
    try {
      (0, $3ad3f6e1647bc98d$export$80f3e147d781571c$2)(element2);
    } catch {
    }
  else if (element2 != null)
    try {
      element2.focus();
    } catch {
    }
}
function $9bf71ea28793e738$var$getFirstInScope$1(scope, tabbable = true) {
  let sentinel = scope[0].previousElementSibling;
  let scopeRoot = $9bf71ea28793e738$var$getScopeRoot$1(scope);
  let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$7(scopeRoot, {
    tabbable
  }, scope);
  walker.currentNode = sentinel;
  let nextNode = walker.nextNode();
  if (tabbable && !nextNode) {
    scopeRoot = $9bf71ea28793e738$var$getScopeRoot$1(scope);
    walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$7(scopeRoot, {
      tabbable: false
    }, scope);
    walker.currentNode = sentinel;
    nextNode = walker.nextNode();
  }
  return nextNode;
}
function $9bf71ea28793e738$var$focusFirstInScope$1(scope, tabbable = true) {
  $9bf71ea28793e738$var$focusElement$2($9bf71ea28793e738$var$getFirstInScope$1(scope, tabbable));
}
function $9bf71ea28793e738$var$useAutoFocus$1(scopeRef, autoFocus) {
  const autoFocusRef = React$5.useRef(autoFocus);
  reactExports.useEffect(() => {
    if (autoFocusRef.current) {
      $9bf71ea28793e738$var$activeScope$1 = scopeRef;
      const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scopeRef.current ? scopeRef.current[0] : void 0);
      if (!$9bf71ea28793e738$var$isElementInScope$7($d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument), $9bf71ea28793e738$var$activeScope$1.current) && scopeRef.current)
        $9bf71ea28793e738$var$focusFirstInScope$1(scopeRef.current);
    }
    autoFocusRef.current = false;
  }, [
    scopeRef
  ]);
}
function $9bf71ea28793e738$var$useActiveScopeTracker$1(scopeRef, restore, contain) {
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (restore || contain)
      return;
    let scope = scopeRef.current;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scope ? scope[0] : void 0);
    let onFocus = (e2) => {
      let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
      if ($9bf71ea28793e738$var$isElementInScope$7(target, scopeRef.current))
        $9bf71ea28793e738$var$activeScope$1 = scopeRef;
      else if (!$9bf71ea28793e738$var$isElementInAnyScope$1(target))
        $9bf71ea28793e738$var$activeScope$1 = null;
    };
    ownerDocument.addEventListener("focusin", onFocus, false);
    scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.addEventListener("focusin", onFocus, false));
    return () => {
      ownerDocument.removeEventListener("focusin", onFocus, false);
      scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.removeEventListener("focusin", onFocus, false));
    };
  }, [
    scopeRef,
    restore,
    contain
  ]);
}
function $9bf71ea28793e738$var$shouldRestoreFocus$1(scopeRef) {
  let scope = $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode($9bf71ea28793e738$var$activeScope$1);
  while (scope && scope.scopeRef !== scopeRef) {
    if (scope.nodeToRestore)
      return false;
    scope = scope.parent;
  }
  return (scope === null || scope === void 0 ? void 0 : scope.scopeRef) === scopeRef;
}
function $9bf71ea28793e738$var$useRestoreFocus$1(scopeRef, restoreFocus, contain) {
  const nodeToRestoreRef = reactExports.useRef(typeof document !== "undefined" ? $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4(scopeRef.current ? scopeRef.current[0] : void 0)) : null);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let scope = scopeRef.current;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scope ? scope[0] : void 0);
    if (!restoreFocus || contain)
      return;
    let onFocus = () => {
      if ((!$9bf71ea28793e738$var$activeScope$1 || $9bf71ea28793e738$var$isAncestorScope$1($9bf71ea28793e738$var$activeScope$1, scopeRef)) && $9bf71ea28793e738$var$isElementInScope$7($d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument), scopeRef.current))
        $9bf71ea28793e738$var$activeScope$1 = scopeRef;
    };
    ownerDocument.addEventListener("focusin", onFocus, false);
    scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.addEventListener("focusin", onFocus, false));
    return () => {
      ownerDocument.removeEventListener("focusin", onFocus, false);
      scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.removeEventListener("focusin", onFocus, false));
    };
  }, [
    scopeRef,
    contain
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scopeRef.current ? scopeRef.current[0] : void 0);
    if (!restoreFocus)
      return;
    let onKeyDown = (e2) => {
      if (e2.key !== "Tab" || e2.altKey || e2.ctrlKey || e2.metaKey || !$9bf71ea28793e738$var$shouldContainFocus$1(scopeRef) || e2.isComposing)
        return;
      let focusedElement = ownerDocument.activeElement;
      if (!$9bf71ea28793e738$var$isElementInChildScope$1(focusedElement, scopeRef) || !$9bf71ea28793e738$var$shouldRestoreFocus$1(scopeRef))
        return;
      let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(scopeRef);
      if (!treeNode)
        return;
      let nodeToRestore = treeNode.nodeToRestore;
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$7(ownerDocument.body, {
        tabbable: true
      });
      walker.currentNode = focusedElement;
      let nextElement = e2.shiftKey ? walker.previousNode() : walker.nextNode();
      if (!nodeToRestore || !nodeToRestore.isConnected || nodeToRestore === ownerDocument.body) {
        nodeToRestore = void 0;
        treeNode.nodeToRestore = void 0;
      }
      if ((!nextElement || !$9bf71ea28793e738$var$isElementInChildScope$1(nextElement, scopeRef)) && nodeToRestore) {
        walker.currentNode = nodeToRestore;
        do
          nextElement = e2.shiftKey ? walker.previousNode() : walker.nextNode();
        while ($9bf71ea28793e738$var$isElementInChildScope$1(nextElement, scopeRef));
        e2.preventDefault();
        e2.stopPropagation();
        if (nextElement)
          $9bf71ea28793e738$var$focusElement$2(nextElement, true);
        else if (!$9bf71ea28793e738$var$isElementInAnyScope$1(nodeToRestore))
          focusedElement.blur();
        else
          $9bf71ea28793e738$var$focusElement$2(nodeToRestore, true);
      }
    };
    if (!contain)
      ownerDocument.addEventListener("keydown", onKeyDown, true);
    return () => {
      if (!contain)
        ownerDocument.removeEventListener("keydown", onKeyDown, true);
    };
  }, [
    scopeRef,
    restoreFocus,
    contain
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scopeRef.current ? scopeRef.current[0] : void 0);
    if (!restoreFocus)
      return;
    let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(scopeRef);
    if (!treeNode)
      return;
    var _nodeToRestoreRef_current;
    treeNode.nodeToRestore = (_nodeToRestoreRef_current = nodeToRestoreRef.current) !== null && _nodeToRestoreRef_current !== void 0 ? _nodeToRestoreRef_current : void 0;
    return () => {
      let treeNode2 = $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(scopeRef);
      if (!treeNode2)
        return;
      let nodeToRestore = treeNode2.nodeToRestore;
      let activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
      if (restoreFocus && nodeToRestore && (activeElement && $9bf71ea28793e738$var$isElementInChildScope$1(activeElement, scopeRef) || activeElement === ownerDocument.body && $9bf71ea28793e738$var$shouldRestoreFocus$1(scopeRef))) {
        let clonedTree = $9bf71ea28793e738$export$d06fae2ee68b101e$1.clone();
        requestAnimationFrame(() => {
          if (ownerDocument.activeElement === ownerDocument.body) {
            let treeNode3 = clonedTree.getTreeNode(scopeRef);
            while (treeNode3) {
              if (treeNode3.nodeToRestore && treeNode3.nodeToRestore.isConnected) {
                $9bf71ea28793e738$var$restoreFocusToElement$1(treeNode3.nodeToRestore);
                return;
              }
              treeNode3 = treeNode3.parent;
            }
            treeNode3 = clonedTree.getTreeNode(scopeRef);
            while (treeNode3) {
              if (treeNode3.scopeRef && treeNode3.scopeRef.current && $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(treeNode3.scopeRef)) {
                let node2 = $9bf71ea28793e738$var$getFirstInScope$1(treeNode3.scopeRef.current, true);
                $9bf71ea28793e738$var$restoreFocusToElement$1(node2);
                return;
              }
              treeNode3 = treeNode3.parent;
            }
          }
        });
      }
    };
  }, [
    scopeRef,
    restoreFocus
  ]);
}
function $9bf71ea28793e738$var$restoreFocusToElement$1(node2) {
  if (node2.dispatchEvent(new CustomEvent($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT$1, {
    bubbles: true,
    cancelable: true
  })))
    $9bf71ea28793e738$var$focusElement$2(node2);
}
function $9bf71ea28793e738$export$2d6ec8fc375ceafa$7(root2, opts2, scope) {
  let filter3 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) ? $b4b717babfbb907b$export$bebd5a1431fec25d : $b4b717babfbb907b$export$4c063cf1350e6fed$3;
  let rootElement = (root2 === null || root2 === void 0 ? void 0 : root2.nodeType) === Node.ELEMENT_NODE ? root2 : null;
  let doc = $431fbd86ca7dc216$export$b204af158042fbac$4(rootElement);
  let walker = $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root2 || doc, NodeFilter.SHOW_ELEMENT, {
    acceptNode(node2) {
      var _opts_from;
      if (opts2 === null || opts2 === void 0 ? void 0 : (_opts_from = opts2.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node2))
        return NodeFilter.FILTER_REJECT;
      if ((opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) && node2.tagName === "INPUT" && node2.getAttribute("type") === "radio") {
        if (!$9bf71ea28793e738$var$isTabbableRadio$6(node2))
          return NodeFilter.FILTER_REJECT;
        if (walker.currentNode.tagName === "INPUT" && walker.currentNode.type === "radio" && walker.currentNode.name === node2.name)
          return NodeFilter.FILTER_REJECT;
      }
      if (filter3(node2) && (!scope || $9bf71ea28793e738$var$isElementInScope$7(node2, scope)) && (!(opts2 === null || opts2 === void 0 ? void 0 : opts2.accept) || opts2.accept(node2)))
        return NodeFilter.FILTER_ACCEPT;
      return NodeFilter.FILTER_SKIP;
    }
  });
  if (opts2 === null || opts2 === void 0 ? void 0 : opts2.from)
    walker.currentNode = opts2.from;
  return walker;
}
let $9bf71ea28793e738$var$Tree$7 = class $9bf71ea28793e738$var$Tree {
  get size() {
    return this.fastMap.size;
  }
  getTreeNode(data) {
    return this.fastMap.get(data);
  }
  addTreeNode(scopeRef, parent, nodeToRestore) {
    let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
    if (!parentNode)
      return;
    let node2 = new $9bf71ea28793e738$var$TreeNode$7({
      scopeRef
    });
    parentNode.addChild(node2);
    node2.parent = parentNode;
    this.fastMap.set(scopeRef, node2);
    if (nodeToRestore)
      node2.nodeToRestore = nodeToRestore;
  }
  addNode(node2) {
    this.fastMap.set(node2.scopeRef, node2);
  }
  removeTreeNode(scopeRef) {
    if (scopeRef === null)
      return;
    let node2 = this.fastMap.get(scopeRef);
    if (!node2)
      return;
    let parentNode = node2.parent;
    for (let current of this.traverse())
      if (current !== node2 && node2.nodeToRestore && current.nodeToRestore && node2.scopeRef && node2.scopeRef.current && $9bf71ea28793e738$var$isElementInScope$7(current.nodeToRestore, node2.scopeRef.current))
        current.nodeToRestore = node2.nodeToRestore;
    let children = node2.children;
    if (parentNode) {
      parentNode.removeChild(node2);
      if (children.size > 0)
        children.forEach((child) => parentNode && parentNode.addChild(child));
    }
    this.fastMap.delete(node2.scopeRef);
  }
  // Pre Order Depth First
  *traverse(node2 = this.root) {
    if (node2.scopeRef != null)
      yield node2;
    if (node2.children.size > 0)
      for (let child of node2.children)
        yield* this.traverse(child);
  }
  clone() {
    var _node_parent;
    let newTree = new $9bf71ea28793e738$var$Tree();
    var _node_parent_scopeRef;
    for (let node2 of this.traverse())
      newTree.addTreeNode(node2.scopeRef, (_node_parent_scopeRef = (_node_parent = node2.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node2.nodeToRestore);
    return newTree;
  }
  constructor() {
    this.fastMap = /* @__PURE__ */ new Map();
    this.root = new $9bf71ea28793e738$var$TreeNode$7({
      scopeRef: null
    });
    this.fastMap.set(null, this.root);
  }
};
let $9bf71ea28793e738$var$TreeNode$7 = class $9bf71ea28793e738$var$TreeNode {
  addChild(node2) {
    this.children.add(node2);
    node2.parent = this;
  }
  removeChild(node2) {
    this.children.delete(node2);
    node2.parent = void 0;
  }
  constructor(props) {
    this.children = /* @__PURE__ */ new Set();
    this.contain = false;
    this.scopeRef = props.scopeRef;
  }
};
let $9bf71ea28793e738$export$d06fae2ee68b101e$1 = new $9bf71ea28793e738$var$Tree$7();
function $628037886ba31236$export$f9d5c8beee7d008d$2(props, state, ref) {
  let { type: type4 } = props;
  let { isOpen } = state;
  reactExports.useEffect(() => {
    if (ref && ref.current)
      $dd149f63282afbbf$export$f6211563215e3b37$2.set(ref.current, state.close);
  });
  let ariaHasPopup = void 0;
  if (type4 === "menu")
    ariaHasPopup = true;
  else if (type4 === "listbox")
    ariaHasPopup = "listbox";
  let overlayId = $bdb11010cef70236$export$f680877a34711e37$2();
  return {
    triggerProps: {
      "aria-haspopup": ariaHasPopup,
      "aria-expanded": isOpen,
      "aria-controls": isOpen ? overlayId : void 0,
      onPress: state.toggle
    },
    overlayProps: {
      id: overlayId
    }
  };
}
const $49c51c25361d4cd2$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
const $49c51c25361d4cd2$var$nonTextInputTypes = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
let $49c51c25361d4cd2$var$preventScrollCount = 0;
let $49c51c25361d4cd2$var$restore;
function $49c51c25361d4cd2$export$ee0f7cc6afcd1c18(options = {}) {
  let { isDisabled } = options;
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (isDisabled)
      return;
    $49c51c25361d4cd2$var$preventScrollCount++;
    if ($49c51c25361d4cd2$var$preventScrollCount === 1) {
      if ($c87311424ea30a05$export$fedb369cb70207f1$3())
        $49c51c25361d4cd2$var$restore = $49c51c25361d4cd2$var$preventScrollMobileSafari();
      else
        $49c51c25361d4cd2$var$restore = $49c51c25361d4cd2$var$preventScrollStandard();
    }
    return () => {
      $49c51c25361d4cd2$var$preventScrollCount--;
      if ($49c51c25361d4cd2$var$preventScrollCount === 0)
        $49c51c25361d4cd2$var$restore();
    };
  }, [
    isDisabled
  ]);
}
function $49c51c25361d4cd2$var$preventScrollStandard() {
  let scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
  return $ff5963eb1fccf552$export$e08e3b67e392101e$9(scrollbarWidth > 0 && // Use scrollbar-gutter when supported because it also works for fixed positioned elements.
  ("scrollbarGutter" in document.documentElement.style ? $49c51c25361d4cd2$var$setStyle(document.documentElement, "scrollbarGutter", "stable") : $49c51c25361d4cd2$var$setStyle(document.documentElement, "paddingRight", `${scrollbarWidth}px`)), $49c51c25361d4cd2$var$setStyle(document.documentElement, "overflow", "hidden"));
}
function $49c51c25361d4cd2$var$preventScrollMobileSafari() {
  let scrollable;
  let restoreScrollableStyles;
  let onTouchStart = (e2) => {
    scrollable = $62d8ded9296f3872$export$cfa2225e87938781(e2.target, true);
    if (scrollable === document.documentElement && scrollable === document.body)
      return;
    if (scrollable instanceof HTMLElement && window.getComputedStyle(scrollable).overscrollBehavior === "auto")
      restoreScrollableStyles = $49c51c25361d4cd2$var$setStyle(scrollable, "overscrollBehavior", "contain");
  };
  let onTouchMove = (e2) => {
    if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {
      e2.preventDefault();
      return;
    }
    if (scrollable.scrollHeight === scrollable.clientHeight && scrollable.scrollWidth === scrollable.clientWidth)
      e2.preventDefault();
  };
  let onTouchEnd = () => {
    if (restoreScrollableStyles)
      restoreScrollableStyles();
  };
  let onFocus = (e2) => {
    let target = e2.target;
    if ($49c51c25361d4cd2$var$willOpenKeyboard(target)) {
      setupStyles();
      target.style.transform = "translateY(-2000px)";
      requestAnimationFrame(() => {
        target.style.transform = "";
        if ($49c51c25361d4cd2$var$visualViewport) {
          if ($49c51c25361d4cd2$var$visualViewport.height < window.innerHeight)
            requestAnimationFrame(() => {
              $49c51c25361d4cd2$var$scrollIntoView(target);
            });
          else
            $49c51c25361d4cd2$var$visualViewport.addEventListener("resize", () => $49c51c25361d4cd2$var$scrollIntoView(target), {
              once: true
            });
        }
      });
    }
  };
  let restoreStyles = null;
  let setupStyles = () => {
    if (restoreStyles)
      return;
    let onWindowScroll = () => {
      window.scrollTo(0, 0);
    };
    let scrollX = window.pageXOffset;
    let scrollY = window.pageYOffset;
    restoreStyles = $ff5963eb1fccf552$export$e08e3b67e392101e$9($49c51c25361d4cd2$var$addEvent(window, "scroll", onWindowScroll), $49c51c25361d4cd2$var$setStyle(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), $49c51c25361d4cd2$var$setStyle(document.documentElement, "overflow", "hidden"), $49c51c25361d4cd2$var$setStyle(document.body, "marginTop", `-${scrollY}px`), () => {
      window.scrollTo(scrollX, scrollY);
    });
    window.scrollTo(0, 0);
  };
  let removeEvents2 = $ff5963eb1fccf552$export$e08e3b67e392101e$9($49c51c25361d4cd2$var$addEvent(document, "touchstart", onTouchStart, {
    passive: false,
    capture: true
  }), $49c51c25361d4cd2$var$addEvent(document, "touchmove", onTouchMove, {
    passive: false,
    capture: true
  }), $49c51c25361d4cd2$var$addEvent(document, "touchend", onTouchEnd, {
    passive: false,
    capture: true
  }), $49c51c25361d4cd2$var$addEvent(document, "focus", onFocus, true));
  return () => {
    restoreScrollableStyles === null || restoreScrollableStyles === void 0 ? void 0 : restoreScrollableStyles();
    restoreStyles === null || restoreStyles === void 0 ? void 0 : restoreStyles();
    removeEvents2();
  };
}
function $49c51c25361d4cd2$var$setStyle(element2, style2, value2) {
  let cur = element2.style[style2];
  element2.style[style2] = value2;
  return () => {
    element2.style[style2] = cur;
  };
}
function $49c51c25361d4cd2$var$addEvent(target, event, handler, options) {
  target.addEventListener(event, handler, options);
  return () => {
    target.removeEventListener(event, handler, options);
  };
}
function $49c51c25361d4cd2$var$scrollIntoView(target) {
  let root2 = document.scrollingElement || document.documentElement;
  let nextTarget = target;
  while (nextTarget && nextTarget !== root2) {
    let scrollable = $62d8ded9296f3872$export$cfa2225e87938781(nextTarget);
    if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== nextTarget) {
      let scrollableTop = scrollable.getBoundingClientRect().top;
      let targetTop = nextTarget.getBoundingClientRect().top;
      if (targetTop > scrollableTop + nextTarget.clientHeight)
        scrollable.scrollTop += targetTop - scrollableTop;
    }
    nextTarget = scrollable.parentElement;
  }
}
function $49c51c25361d4cd2$var$willOpenKeyboard(target) {
  return target instanceof HTMLInputElement && !$49c51c25361d4cd2$var$nonTextInputTypes.has(target.type) || target instanceof HTMLTextAreaElement || target instanceof HTMLElement && target.isContentEditable;
}
const $96b38030c423d352$export$60d741e20e0aa309 = /* @__PURE__ */ reactExports.createContext({});
function $96b38030c423d352$export$9fc1347d4195ccb3() {
  var _useContext;
  return (_useContext = reactExports.useContext($96b38030c423d352$export$60d741e20e0aa309)) !== null && _useContext !== void 0 ? _useContext : {};
}
const $b5e257d569688ac6$var$defaultContext$a = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$a = /* @__PURE__ */ React$5.createContext($b5e257d569688ac6$var$defaultContext$a);
const $b5e257d569688ac6$var$IsSSRContext$a = /* @__PURE__ */ React$5.createContext(false);
let $b5e257d569688ac6$var$componentIds$a = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$a(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$a);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$a.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$a.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$a.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$a(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$a);
  let counter = $b5e257d569688ac6$var$useCounter$a(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$a(defaultId) {
  let id2 = React$5.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$a());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$a.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$5["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$a : $b5e257d569688ac6$var$useLegacySSRSafeId$a;
function $b5e257d569688ac6$var$getSnapshot$a() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$a() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$a(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$a() {
  if (typeof React$5["useSyncExternalStore"] === "function")
    return React$5["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$a, $b5e257d569688ac6$var$getSnapshot$a, $b5e257d569688ac6$var$getServerSnapshot$a);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$a);
}
const $f57aed4a881a3485$var$Context = /* @__PURE__ */ React$5.createContext(null);
function $f57aed4a881a3485$export$178405afcd8c5eb(props) {
  let { children } = props;
  let parent = reactExports.useContext($f57aed4a881a3485$var$Context);
  let [modalCount, setModalCount] = reactExports.useState(0);
  let context = reactExports.useMemo(() => ({
    parent,
    modalCount,
    addModal() {
      setModalCount((count) => count + 1);
      if (parent)
        parent.addModal();
    },
    removeModal() {
      setModalCount((count) => count - 1);
      if (parent)
        parent.removeModal();
    }
  }), [
    parent,
    modalCount
  ]);
  return /* @__PURE__ */ React$5.createElement($f57aed4a881a3485$var$Context.Provider, {
    value: context
  }, children);
}
function $f57aed4a881a3485$export$d9aaed4c3ece1bc0() {
  let context = reactExports.useContext($f57aed4a881a3485$var$Context);
  return {
    modalProviderProps: {
      "aria-hidden": context && context.modalCount > 0 ? true : void 0
    }
  };
}
function $f57aed4a881a3485$var$OverlayContainerDOM(props) {
  let { modalProviderProps } = $f57aed4a881a3485$export$d9aaed4c3ece1bc0();
  return /* @__PURE__ */ React$5.createElement("div", {
    "data-overlay-container": true,
    ...props,
    ...modalProviderProps
  });
}
function $f57aed4a881a3485$export$bf688221f59024e5(props) {
  return /* @__PURE__ */ React$5.createElement($f57aed4a881a3485$export$178405afcd8c5eb, null, /* @__PURE__ */ React$5.createElement($f57aed4a881a3485$var$OverlayContainerDOM, props));
}
function $f57aed4a881a3485$export$b47c3594eab58386(props) {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$a();
  let { portalContainer = isSSR ? null : document.body, ...rest } = props;
  let { getContainer: getContainer2 } = $96b38030c423d352$export$9fc1347d4195ccb3();
  if (!props.portalContainer && getContainer2)
    portalContainer = getContainer2();
  React$5.useEffect(() => {
    if (portalContainer === null || portalContainer === void 0 ? void 0 : portalContainer.closest("[data-overlay-container]"))
      throw new Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.");
  }, [
    portalContainer
  ]);
  if (!portalContainer)
    return null;
  let contents = /* @__PURE__ */ React$5.createElement($f57aed4a881a3485$export$bf688221f59024e5, rest);
  return /* @__PURE__ */ ReactDOM.createPortal(contents, portalContainer);
}
var $773d5888b972f1cf$exports = {};
$773d5888b972f1cf$exports = {
  "dismiss": `تجاهل`
};
var $d11f19852b941573$exports = {};
$d11f19852b941573$exports = {
  "dismiss": `Отхвърляне`
};
var $b983974c2ee1efb3$exports = {};
$b983974c2ee1efb3$exports = {
  "dismiss": `Odstranit`
};
var $5809cc9d4e92de73$exports = {};
$5809cc9d4e92de73$exports = {
  "dismiss": `Luk`
};
var $c68c2e4fc74398d1$exports = {};
$c68c2e4fc74398d1$exports = {
  "dismiss": `Schließen`
};
var $0898b4c153db2b77$exports = {};
$0898b4c153db2b77$exports = {
  "dismiss": `Απόρριψη`
};
var $6d74810286a15183$exports = {};
$6d74810286a15183$exports = {
  "dismiss": `Dismiss`
};
var $309d73dc65f78055$exports = {};
$309d73dc65f78055$exports = {
  "dismiss": `Descartar`
};
var $44ad94f7205cf593$exports = {};
$44ad94f7205cf593$exports = {
  "dismiss": `Lõpeta`
};
var $7c28f5687f0779a9$exports = {};
$7c28f5687f0779a9$exports = {
  "dismiss": `Hylkää`
};
var $e6d75df4b68bd73a$exports = {};
$e6d75df4b68bd73a$exports = {
  "dismiss": `Rejeter`
};
var $87505c9dab186d0f$exports = {};
$87505c9dab186d0f$exports = {
  "dismiss": `התעלם`
};
var $553439c3ffb3e492$exports = {};
$553439c3ffb3e492$exports = {
  "dismiss": `Odbaci`
};
var $74cf411061b983a2$exports = {};
$74cf411061b983a2$exports = {
  "dismiss": `Elutasítás`
};
var $e933f298574dc435$exports = {};
$e933f298574dc435$exports = {
  "dismiss": `Ignora`
};
var $ac91fc9fe02f71f6$exports = {};
$ac91fc9fe02f71f6$exports = {
  "dismiss": `閉じる`
};
var $52b96f86422025af$exports = {};
$52b96f86422025af$exports = {
  "dismiss": `무시`
};
var $c0d724c3e51dafa6$exports = {};
$c0d724c3e51dafa6$exports = {
  "dismiss": `Atmesti`
};
var $c92899672a3fe72e$exports = {};
$c92899672a3fe72e$exports = {
  "dismiss": `Nerādīt`
};
var $9f576b39d8e7a9d6$exports = {};
$9f576b39d8e7a9d6$exports = {
  "dismiss": `Lukk`
};
var $9d025808aeec81a7$exports = {};
$9d025808aeec81a7$exports = {
  "dismiss": `Negeren`
};
var $fce709921e2c0fa6$exports = {};
$fce709921e2c0fa6$exports = {
  "dismiss": `Zignoruj`
};
var $2599cf0c4ab37f59$exports = {};
$2599cf0c4ab37f59$exports = {
  "dismiss": `Descartar`
};
var $3c220ae7ef8a35fd$exports = {};
$3c220ae7ef8a35fd$exports = {
  "dismiss": `Dispensar`
};
var $93562b5094072f54$exports = {};
$93562b5094072f54$exports = {
  "dismiss": `Revocare`
};
var $cd9e2abd0d06c7b4$exports = {};
$cd9e2abd0d06c7b4$exports = {
  "dismiss": `Пропустить`
};
var $45375701f409adf1$exports = {};
$45375701f409adf1$exports = {
  "dismiss": `Zrušiť`
};
var $27fab53a576de9dd$exports = {};
$27fab53a576de9dd$exports = {
  "dismiss": `Opusti`
};
var $4438748d9952e7c7$exports = {};
$4438748d9952e7c7$exports = {
  "dismiss": `Odbaci`
};
var $0936d7347ef4da4c$exports = {};
$0936d7347ef4da4c$exports = {
  "dismiss": `Avvisa`
};
var $29700c92185d38f8$exports = {};
$29700c92185d38f8$exports = {
  "dismiss": `Kapat`
};
var $662ccaf2be4c25b3$exports = {};
$662ccaf2be4c25b3$exports = {
  "dismiss": `Скасувати`
};
var $d80a27deda7cdb3c$exports = {};
$d80a27deda7cdb3c$exports = {
  "dismiss": `取消`
};
var $2b2734393847c884$exports = {};
$2b2734393847c884$exports = {
  "dismiss": `關閉`
};
var $a2f21f5f14f60553$exports = {};
$a2f21f5f14f60553$exports = {
  "ar-AE": $773d5888b972f1cf$exports,
  "bg-BG": $d11f19852b941573$exports,
  "cs-CZ": $b983974c2ee1efb3$exports,
  "da-DK": $5809cc9d4e92de73$exports,
  "de-DE": $c68c2e4fc74398d1$exports,
  "el-GR": $0898b4c153db2b77$exports,
  "en-US": $6d74810286a15183$exports,
  "es-ES": $309d73dc65f78055$exports,
  "et-EE": $44ad94f7205cf593$exports,
  "fi-FI": $7c28f5687f0779a9$exports,
  "fr-FR": $e6d75df4b68bd73a$exports,
  "he-IL": $87505c9dab186d0f$exports,
  "hr-HR": $553439c3ffb3e492$exports,
  "hu-HU": $74cf411061b983a2$exports,
  "it-IT": $e933f298574dc435$exports,
  "ja-JP": $ac91fc9fe02f71f6$exports,
  "ko-KR": $52b96f86422025af$exports,
  "lt-LT": $c0d724c3e51dafa6$exports,
  "lv-LV": $c92899672a3fe72e$exports,
  "nb-NO": $9f576b39d8e7a9d6$exports,
  "nl-NL": $9d025808aeec81a7$exports,
  "pl-PL": $fce709921e2c0fa6$exports,
  "pt-BR": $2599cf0c4ab37f59$exports,
  "pt-PT": $3c220ae7ef8a35fd$exports,
  "ro-RO": $93562b5094072f54$exports,
  "ru-RU": $cd9e2abd0d06c7b4$exports,
  "sk-SK": $45375701f409adf1$exports,
  "sl-SI": $27fab53a576de9dd$exports,
  "sr-SP": $4438748d9952e7c7$exports,
  "sv-SE": $0936d7347ef4da4c$exports,
  "tr-TR": $29700c92185d38f8$exports,
  "uk-UA": $662ccaf2be4c25b3$exports,
  "zh-CN": $d80a27deda7cdb3c$exports,
  "zh-TW": $2b2734393847c884$exports
};
const $5c3e21d68f1c4674$var$styles$1 = {
  border: 0,
  clip: "rect(0 0 0 0)",
  clipPath: "inset(50%)",
  height: "1px",
  margin: "-1px",
  overflow: "hidden",
  padding: 0,
  position: "absolute",
  width: "1px",
  whiteSpace: "nowrap"
};
function $5c3e21d68f1c4674$export$a966af930f325cab$1(props = {}) {
  let { style: style2, isFocusable } = props;
  let [isFocused, setFocused] = reactExports.useState(false);
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$4({
    isDisabled: !isFocusable,
    onFocusWithinChange: (val) => setFocused(val)
  });
  let combinedStyles = reactExports.useMemo(() => {
    if (isFocused)
      return style2;
    else if (style2)
      return {
        ...$5c3e21d68f1c4674$var$styles$1,
        ...style2
      };
    else
      return $5c3e21d68f1c4674$var$styles$1;
  }, [
    isFocused
  ]);
  return {
    visuallyHiddenProps: {
      ...focusWithinProps,
      style: combinedStyles
    }
  };
}
function $5c3e21d68f1c4674$export$439d29a4e110a164$1(props) {
  let { children, elementType: Element2 = "div", isFocusable, style: style2, ...otherProps } = props;
  let { visuallyHiddenProps } = $5c3e21d68f1c4674$export$a966af930f325cab$1(props);
  return /* @__PURE__ */ React$5.createElement(Element2, $3ef42575df84b30b$export$9d1611c77c2fe928$9(otherProps, visuallyHiddenProps), children);
}
function $parcel$interopDefault$k(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $86ea4cb521eb2e37$export$2317d149ed6f78c4(props) {
  let { onDismiss, ...otherProps } = props;
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$k($a2f21f5f14f60553$exports), "@react-aria/overlays");
  let labels = $313b98861ee5dd6c$export$d6875122194c7b44$1(otherProps, stringFormatter.format("dismiss"));
  let onClick = () => {
    if (onDismiss)
      onDismiss();
  };
  return /* @__PURE__ */ React$5.createElement($5c3e21d68f1c4674$export$439d29a4e110a164$1, null, /* @__PURE__ */ React$5.createElement("button", {
    ...labels,
    tabIndex: -1,
    onClick,
    style: {
      width: 1,
      height: 1
    }
  }));
}
let $5e3802645cc19319$var$refCountMap$1 = /* @__PURE__ */ new WeakMap();
let $5e3802645cc19319$var$observerStack$1 = [];
function $5e3802645cc19319$export$1c3ebcada18427bf$1(targets, root2 = document.body) {
  let visibleNodes = new Set(targets);
  let hiddenNodes = /* @__PURE__ */ new Set();
  let walk = (root3) => {
    for (let element2 of root3.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))
      visibleNodes.add(element2);
    let acceptNode = (node2) => {
      if (visibleNodes.has(node2) || node2.parentElement && hiddenNodes.has(node2.parentElement) && node2.parentElement.getAttribute("role") !== "row")
        return NodeFilter.FILTER_REJECT;
      for (let target of visibleNodes) {
        if (node2.contains(target))
          return NodeFilter.FILTER_SKIP;
      }
      return NodeFilter.FILTER_ACCEPT;
    };
    let walker = document.createTreeWalker(root3, NodeFilter.SHOW_ELEMENT, {
      acceptNode
    });
    let acceptRoot = acceptNode(root3);
    if (acceptRoot === NodeFilter.FILTER_ACCEPT)
      hide(root3);
    if (acceptRoot !== NodeFilter.FILTER_REJECT) {
      let node2 = walker.nextNode();
      while (node2 != null) {
        hide(node2);
        node2 = walker.nextNode();
      }
    }
  };
  let hide = (node2) => {
    var _refCountMap_get;
    let refCount = (_refCountMap_get = $5e3802645cc19319$var$refCountMap$1.get(node2)) !== null && _refCountMap_get !== void 0 ? _refCountMap_get : 0;
    if (node2.getAttribute("aria-hidden") === "true" && refCount === 0)
      return;
    if (refCount === 0)
      node2.setAttribute("aria-hidden", "true");
    hiddenNodes.add(node2);
    $5e3802645cc19319$var$refCountMap$1.set(node2, refCount + 1);
  };
  if ($5e3802645cc19319$var$observerStack$1.length)
    $5e3802645cc19319$var$observerStack$1[$5e3802645cc19319$var$observerStack$1.length - 1].disconnect();
  walk(root2);
  let observer = new MutationObserver((changes) => {
    for (let change of changes) {
      if (change.type !== "childList" || change.addedNodes.length === 0)
        continue;
      if (![
        ...visibleNodes,
        ...hiddenNodes
      ].some((node2) => node2.contains(change.target))) {
        for (let node2 of change.removedNodes)
          if (node2 instanceof Element) {
            visibleNodes.delete(node2);
            hiddenNodes.delete(node2);
          }
        for (let node2 of change.addedNodes) {
          if ((node2 instanceof HTMLElement || node2 instanceof SVGElement) && (node2.dataset.liveAnnouncer === "true" || node2.dataset.reactAriaTopLayer === "true"))
            visibleNodes.add(node2);
          else if (node2 instanceof Element)
            walk(node2);
        }
      }
    }
  });
  observer.observe(root2, {
    childList: true,
    subtree: true
  });
  let observerWrapper = {
    visibleNodes,
    hiddenNodes,
    observe() {
      observer.observe(root2, {
        childList: true,
        subtree: true
      });
    },
    disconnect() {
      observer.disconnect();
    }
  };
  $5e3802645cc19319$var$observerStack$1.push(observerWrapper);
  return () => {
    observer.disconnect();
    for (let node2 of hiddenNodes) {
      let count = $5e3802645cc19319$var$refCountMap$1.get(node2);
      if (count == null)
        continue;
      if (count === 1) {
        node2.removeAttribute("aria-hidden");
        $5e3802645cc19319$var$refCountMap$1.delete(node2);
      } else
        $5e3802645cc19319$var$refCountMap$1.set(node2, count - 1);
    }
    if (observerWrapper === $5e3802645cc19319$var$observerStack$1[$5e3802645cc19319$var$observerStack$1.length - 1]) {
      $5e3802645cc19319$var$observerStack$1.pop();
      if ($5e3802645cc19319$var$observerStack$1.length)
        $5e3802645cc19319$var$observerStack$1[$5e3802645cc19319$var$observerStack$1.length - 1].observe();
    } else
      $5e3802645cc19319$var$observerStack$1.splice($5e3802645cc19319$var$observerStack$1.indexOf(observerWrapper), 1);
  };
}
const $337b884510726a0d$export$a2200b96afd16271$1 = /* @__PURE__ */ React$5.createContext(null);
function $337b884510726a0d$export$c6fdb837b070b4ff(props) {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$a();
  let { portalContainer = isSSR ? null : document.body, isExiting } = props;
  let [contain, setContain] = reactExports.useState(false);
  let contextValue = reactExports.useMemo(() => ({
    contain,
    setContain
  }), [
    contain,
    setContain
  ]);
  let { getContainer: getContainer2 } = $96b38030c423d352$export$9fc1347d4195ccb3();
  if (!props.portalContainer && getContainer2)
    portalContainer = getContainer2();
  if (!portalContainer)
    return null;
  let contents = props.children;
  if (!props.disableFocusManagement)
    contents = /* @__PURE__ */ React$5.createElement($9bf71ea28793e738$export$20e40289641fbbb6$1, {
      restoreFocus: true,
      contain: (props.shouldContainFocus || contain) && !isExiting
    }, contents);
  contents = /* @__PURE__ */ React$5.createElement($337b884510726a0d$export$a2200b96afd16271$1.Provider, {
    value: contextValue
  }, /* @__PURE__ */ React$5.createElement($f1ab8c75478c6f73$export$cf75428e0b9ed1ea, null, contents));
  return /* @__PURE__ */ ReactDOM.createPortal(contents, portalContainer);
}
function $337b884510726a0d$export$14c98a7594375490$1() {
  let ctx = reactExports.useContext($337b884510726a0d$export$a2200b96afd16271$1);
  let setContain = ctx === null || ctx === void 0 ? void 0 : ctx.setContain;
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    setContain === null || setContain === void 0 ? void 0 : setContain(true);
  }, [
    setContain
  ]);
}
var HeroUIProvider = ({
  children,
  navigate,
  disableAnimation,
  useHref: useHref2,
  disableRipple = false,
  skipFramerMotionAnimations = disableAnimation,
  reducedMotion = "never",
  validationBehavior,
  locale: locale2 = "en-US",
  labelPlacement,
  // if minDate / maxDate are not specified in `defaultDates`
  // then they will be set in `use-date-input.ts` or `use-calendar-base.ts`
  defaultDates,
  createCalendar,
  spinnerVariant,
  ...otherProps
}) => {
  let contents = children;
  if (navigate) {
    contents = /* @__PURE__ */ jsxRuntimeExports.jsx($ea8dcbcb9ea1b556$export$323e4fc2fa4753fb, { navigate, useHref: useHref2, children: contents });
  }
  const context = reactExports.useMemo(() => {
    if (disableAnimation && skipFramerMotionAnimations) {
      MotionGlobalConfig.skipAnimations = true;
    }
    return {
      createCalendar,
      defaultDates,
      disableAnimation,
      disableRipple,
      validationBehavior,
      labelPlacement,
      spinnerVariant
    };
  }, [
    createCalendar,
    defaultDates == null ? void 0 : defaultDates.maxDate,
    defaultDates == null ? void 0 : defaultDates.minDate,
    disableAnimation,
    disableRipple,
    validationBehavior,
    labelPlacement,
    spinnerVariant
  ]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ProviderContext, { value: context, children: /* @__PURE__ */ jsxRuntimeExports.jsx($18f2051aff69b9bf$export$a54013f0d02a8f82, { locale: locale2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(MotionConfig, { reducedMotion, children: /* @__PURE__ */ jsxRuntimeExports.jsx($f57aed4a881a3485$export$bf688221f59024e5, { ...otherProps, children: contents }) }) }) });
};
function useLabelPlacement(props) {
  const globalContext = useProviderContext();
  const globalLabelPlacement = globalContext == null ? void 0 : globalContext.labelPlacement;
  return reactExports.useMemo(() => {
    var _a2, _b2;
    const labelPlacement = (_b2 = (_a2 = props.labelPlacement) != null ? _a2 : globalLabelPlacement) != null ? _b2 : "inside";
    if (labelPlacement === "inside" && !props.label) {
      return "outside";
    }
    return labelPlacement;
  }, [props.labelPlacement, globalLabelPlacement, props.label]);
}
function useInputLabelPlacement(props) {
  const globalContext = useProviderContext();
  const globalLabelPlacement = globalContext == null ? void 0 : globalContext.labelPlacement;
  return reactExports.useMemo(() => {
    var _a2, _b2;
    const labelPlacement = (_b2 = (_a2 = props.labelPlacement) != null ? _a2 : globalLabelPlacement) != null ? _b2 : "inside";
    if (labelPlacement === "inside" && !props.label) {
      return "outside";
    }
    return labelPlacement;
  }, [props.labelPlacement, globalLabelPlacement, props.label]);
}
function forwardRef(component) {
  return reactExports.forwardRef(component);
}
var mapPropsVariants = (props, variantKeys, removeVariantProps = true) => {
  if (!variantKeys) {
    return [props, {}];
  }
  const picked = variantKeys.reduce((acc, key) => {
    if (key in props) {
      return { ...acc, [key]: props[key] };
    } else {
      return acc;
    }
  }, {});
  if (removeVariantProps) {
    const omitted = Object.keys(props).filter((key) => !variantKeys.includes(key)).reduce((acc, key) => ({ ...acc, [key]: props[key] }), {});
    return [omitted, picked];
  } else {
    return [props, picked];
  }
};
var solid = {
  default: "bg-default text-default-foreground",
  primary: "bg-primary text-primary-foreground",
  secondary: "bg-secondary text-secondary-foreground",
  success: "bg-success text-success-foreground",
  warning: "bg-warning text-warning-foreground",
  danger: "bg-danger text-danger-foreground",
  foreground: "bg-foreground text-background"
};
var shadow = {
  default: "shadow-lg shadow-default/50 bg-default text-default-foreground",
  primary: "shadow-lg shadow-primary/40 bg-primary text-primary-foreground",
  secondary: "shadow-lg shadow-secondary/40 bg-secondary text-secondary-foreground",
  success: "shadow-lg shadow-success/40 bg-success text-success-foreground",
  warning: "shadow-lg shadow-warning/40 bg-warning text-warning-foreground",
  danger: "shadow-lg shadow-danger/40 bg-danger text-danger-foreground"
};
var bordered = {
  default: "bg-transparent border-default text-foreground",
  primary: "bg-transparent border-primary text-primary",
  secondary: "bg-transparent border-secondary text-secondary",
  success: "bg-transparent border-success text-success",
  warning: "bg-transparent border-warning text-warning",
  danger: "bg-transparent border-danger text-danger"
};
var flat = {
  default: "bg-default/40 text-default-700",
  primary: "bg-primary/20 text-primary-600",
  secondary: "bg-secondary/20 text-secondary-600",
  success: "bg-success/20 text-success-700 dark:text-success",
  warning: "bg-warning/20 text-warning-700 dark:text-warning",
  danger: "bg-danger/20 text-danger-600 dark:text-danger-500"
};
var faded = {
  default: "border-default bg-default-100 text-default-foreground",
  primary: "border-default bg-default-100 text-primary",
  secondary: "border-default bg-default-100 text-secondary",
  success: "border-default bg-default-100 text-success",
  warning: "border-default bg-default-100 text-warning",
  danger: "border-default bg-default-100 text-danger"
};
var light = {
  default: "bg-transparent text-default-foreground",
  primary: "bg-transparent text-primary",
  secondary: "bg-transparent text-secondary",
  success: "bg-transparent text-success",
  warning: "bg-transparent text-warning",
  danger: "bg-transparent text-danger"
};
var ghost = {
  default: "border-default text-default-foreground",
  primary: "border-primary text-primary",
  secondary: "border-secondary text-secondary",
  success: "border-success text-success",
  warning: "border-warning text-warning",
  danger: "border-danger text-danger"
};
var colorVariants = {
  solid,
  shadow,
  bordered,
  flat,
  faded,
  light,
  ghost
};
var animation_default = {
  /** Animation Utilities */
  ".spinner-bar-animation": {
    "animation-delay": "calc(-1.2s + (0.1s * var(--bar-index)))",
    transform: "rotate(calc(30deg * var(--bar-index)))translate(140%)"
  },
  ".spinner-dot-animation": {
    "animation-delay": "calc(250ms * var(--dot-index))"
  },
  ".spinner-dot-blink-animation": {
    "animation-delay": "calc(200ms * var(--dot-index))"
  }
};
var custom_default = {
  /**
   * Custom utilities
   */
  ".leading-inherit": {
    "line-height": "inherit"
  },
  ".bg-img-inherit": {
    "background-image": "inherit"
  },
  ".bg-clip-inherit": {
    "background-clip": "inherit"
  },
  ".text-fill-inherit": {
    "-webkit-text-fill-color": "inherit"
  },
  ".tap-highlight-transparent": {
    "-webkit-tap-highlight-color": "transparent"
  },
  ".input-search-cancel-button-none": {
    "&::-webkit-search-cancel-button": {
      "-webkit-appearance": "none"
    }
  }
};
var scrollbar_hide_default = {
  /**
   * Scroll Hide
   */
  ".scrollbar-hide": {
    /* IE and Edge */
    "-ms-overflow-style": "none",
    /* Firefox */
    "scrollbar-width": "none",
    /* Safari and Chrome */
    "&::-webkit-scrollbar": {
      display: "none"
    }
  },
  ".scrollbar-default": {
    /* IE and Edge */
    "-ms-overflow-style": "auto",
    /* Firefox */
    "scrollbar-width": "auto",
    /* Safari and Chrome */
    "&::-webkit-scrollbar": {
      display: "block"
    }
  }
};
var text_default = {
  /**
   * Text utilities
   */
  ".text-tiny": {
    "font-size": "var(--heroui-font-size-tiny)",
    "line-height": "var(--heroui-line-height-tiny)"
  },
  ".text-small": {
    "font-size": "var(--heroui-font-size-small)",
    "line-height": "var(--heroui-line-height-small)"
  },
  ".text-medium": {
    "font-size": "var(--heroui-font-size-medium)",
    "line-height": "var(--heroui-line-height-medium)"
  },
  ".text-large": {
    "font-size": "var(--heroui-font-size-large)",
    "line-height": "var(--heroui-line-height-large)"
  }
};
var DEFAULT_TRANSITION_DURATION = "250ms";
var transition_default = {
  /**
   * Transition utilities
   */
  ".transition-background": {
    "transition-property": "background",
    "transition-timing-function": "ease",
    "transition-duration": DEFAULT_TRANSITION_DURATION
  },
  ".transition-colors-opacity": {
    "transition-property": "color, background-color, border-color, text-decoration-color, fill, stroke, opacity",
    "transition-timing-function": "ease",
    "transition-duration": DEFAULT_TRANSITION_DURATION
  },
  ".transition-width": {
    "transition-property": "width",
    "transition-timing-function": "ease",
    "transition-duration": DEFAULT_TRANSITION_DURATION
  },
  ".transition-height": {
    "transition-property": "height",
    "transition-timing-function": "ease",
    "transition-duration": DEFAULT_TRANSITION_DURATION
  },
  ".transition-size": {
    "transition-property": "width, height",
    "transition-timing-function": "ease",
    "transition-duration": DEFAULT_TRANSITION_DURATION
  },
  ".transition-left": {
    "transition-property": "left",
    "transition-timing-function": "ease",
    "transition-duration": DEFAULT_TRANSITION_DURATION
  },
  ".transition-transform-opacity": {
    "transition-property": "transform, scale, opacity rotate",
    "transition-timing-function": "ease",
    "transition-duration": DEFAULT_TRANSITION_DURATION
  },
  ".transition-transform-background": {
    "transition-property": "transform, scale, background",
    "transition-timing-function": "ease",
    "transition-duration": DEFAULT_TRANSITION_DURATION
  },
  ".transition-transform-colors": {
    "transition-property": "transform, scale, color, background, background-color, border-color, text-decoration-color, fill, stroke",
    "transition-timing-function": "ease",
    "transition-duration": DEFAULT_TRANSITION_DURATION
  },
  ".transition-transform-colors-opacity": {
    "transition-property": "transform, scale, color, background, background-color, border-color, text-decoration-color, fill, stroke, opacity",
    "transition-timing-function": "ease",
    "transition-duration": DEFAULT_TRANSITION_DURATION
  }
};
var utilities$1 = {
  ...custom_default,
  ...transition_default,
  ...scrollbar_hide_default,
  ...text_default,
  ...animation_default
};
var COMMON_UNITS = ["small", "medium", "large"];
var twMergeConfig = {
  theme: {
    spacing: ["divider"],
    radius: COMMON_UNITS
  },
  classGroups: {
    shadow: [{ shadow: COMMON_UNITS }],
    opacity: [{ opacity: ["disabled"] }],
    "font-size": [{ text: ["tiny", ...COMMON_UNITS] }],
    "border-w": [{ border: COMMON_UNITS }],
    "bg-image": [
      "bg-stripe-gradient-default",
      "bg-stripe-gradient-primary",
      "bg-stripe-gradient-secondary",
      "bg-stripe-gradient-success",
      "bg-stripe-gradient-warning",
      "bg-stripe-gradient-danger"
    ],
    transition: Object.keys(utilities$1).filter((key) => key.includes(".transition")).map((key) => key.replace(".", ""))
    // remove the dot from the key, .transition-background -> transition-background
  }
};
var l$8 = (e2) => typeof e2 == "boolean" ? `${e2}` : e2 === 0 ? "0" : e2, u$6 = (e2) => !e2 || typeof e2 != "object" || Object.keys(e2).length === 0, x$6 = (e2, o2) => JSON.stringify(e2) === JSON.stringify(o2);
function i$3(e2, o2) {
  e2.forEach(function(r2) {
    Array.isArray(r2) ? i$3(r2, o2) : o2.push(r2);
  });
}
function y$5(e2) {
  let o2 = [];
  return i$3(e2, o2), o2;
}
var a$3 = (...e2) => y$5(e2).filter(Boolean), p$6 = (e2, o2) => {
  let r2 = {}, c2 = Object.keys(e2), f2 = Object.keys(o2);
  for (let t2 of c2)
    if (f2.includes(t2)) {
      let s2 = e2[t2], n2 = o2[t2];
      Array.isArray(s2) || Array.isArray(n2) ? r2[t2] = a$3(n2, s2) : typeof s2 == "object" && typeof n2 == "object" ? r2[t2] = p$6(s2, n2) : r2[t2] = n2 + " " + s2;
    } else
      r2[t2] = e2[t2];
  for (let t2 of f2)
    c2.includes(t2) || (r2[t2] = o2[t2]);
  return r2;
}, g$4 = (e2) => !e2 || typeof e2 != "string" ? e2 : e2.replace(/\s+/g, " ").trim();
const CLASS_PART_SEPARATOR = "-";
const createClassGroupUtils = (config2) => {
  const classMap = createClassMap(config2);
  const {
    conflictingClassGroups,
    conflictingClassGroupModifiers
  } = config2;
  const getClassGroupId = (className) => {
    const classParts = className.split(CLASS_PART_SEPARATOR);
    if (classParts[0] === "" && classParts.length !== 1) {
      classParts.shift();
    }
    return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className);
  };
  const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
    const conflicts = conflictingClassGroups[classGroupId] || [];
    if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
      return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]];
    }
    return conflicts;
  };
  return {
    getClassGroupId,
    getConflictingClassGroupIds
  };
};
const getGroupRecursive = (classParts, classPartObject) => {
  var _a2;
  if (classParts.length === 0) {
    return classPartObject.classGroupId;
  }
  const currentClassPart = classParts[0];
  const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
  const classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : void 0;
  if (classGroupFromNextClassPart) {
    return classGroupFromNextClassPart;
  }
  if (classPartObject.validators.length === 0) {
    return void 0;
  }
  const classRest = classParts.join(CLASS_PART_SEPARATOR);
  return (_a2 = classPartObject.validators.find(({
    validator: validator2
  }) => validator2(classRest))) == null ? void 0 : _a2.classGroupId;
};
const arbitraryPropertyRegex = /^\[(.+)\]$/;
const getGroupIdForArbitraryProperty = (className) => {
  if (arbitraryPropertyRegex.test(className)) {
    const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
    const property2 = arbitraryPropertyClassName == null ? void 0 : arbitraryPropertyClassName.substring(0, arbitraryPropertyClassName.indexOf(":"));
    if (property2) {
      return "arbitrary.." + property2;
    }
  }
};
const createClassMap = (config2) => {
  const {
    theme: theme2,
    classGroups
  } = config2;
  const classMap = {
    nextPart: /* @__PURE__ */ new Map(),
    validators: []
  };
  for (const classGroupId in classGroups) {
    processClassesRecursively(classGroups[classGroupId], classMap, classGroupId, theme2);
  }
  return classMap;
};
const processClassesRecursively = (classGroup, classPartObject, classGroupId, theme2) => {
  classGroup.forEach((classDefinition) => {
    if (typeof classDefinition === "string") {
      const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
      classPartObjectToEdit.classGroupId = classGroupId;
      return;
    }
    if (typeof classDefinition === "function") {
      if (isThemeGetter(classDefinition)) {
        processClassesRecursively(classDefinition(theme2), classPartObject, classGroupId, theme2);
        return;
      }
      classPartObject.validators.push({
        validator: classDefinition,
        classGroupId
      });
      return;
    }
    Object.entries(classDefinition).forEach(([key, classGroup2]) => {
      processClassesRecursively(classGroup2, getPart(classPartObject, key), classGroupId, theme2);
    });
  });
};
const getPart = (classPartObject, path) => {
  let currentClassPartObject = classPartObject;
  path.split(CLASS_PART_SEPARATOR).forEach((pathPart) => {
    if (!currentClassPartObject.nextPart.has(pathPart)) {
      currentClassPartObject.nextPart.set(pathPart, {
        nextPart: /* @__PURE__ */ new Map(),
        validators: []
      });
    }
    currentClassPartObject = currentClassPartObject.nextPart.get(pathPart);
  });
  return currentClassPartObject;
};
const isThemeGetter = (func) => func.isThemeGetter;
const createLruCache = (maxCacheSize) => {
  if (maxCacheSize < 1) {
    return {
      get: () => void 0,
      set: () => {
      }
    };
  }
  let cacheSize = 0;
  let cache2 = /* @__PURE__ */ new Map();
  let previousCache = /* @__PURE__ */ new Map();
  const update = (key, value2) => {
    cache2.set(key, value2);
    cacheSize++;
    if (cacheSize > maxCacheSize) {
      cacheSize = 0;
      previousCache = cache2;
      cache2 = /* @__PURE__ */ new Map();
    }
  };
  return {
    get(key) {
      let value2 = cache2.get(key);
      if (value2 !== void 0) {
        return value2;
      }
      if ((value2 = previousCache.get(key)) !== void 0) {
        update(key, value2);
        return value2;
      }
    },
    set(key, value2) {
      if (cache2.has(key)) {
        cache2.set(key, value2);
      } else {
        update(key, value2);
      }
    }
  };
};
const IMPORTANT_MODIFIER = "!";
const MODIFIER_SEPARATOR = ":";
const MODIFIER_SEPARATOR_LENGTH = MODIFIER_SEPARATOR.length;
const createParseClassName = (config2) => {
  const {
    prefix,
    experimentalParseClassName
  } = config2;
  let parseClassName = (className) => {
    const modifiers = [];
    let bracketDepth = 0;
    let parenDepth = 0;
    let modifierStart = 0;
    let postfixModifierPosition;
    for (let index2 = 0; index2 < className.length; index2++) {
      let currentCharacter = className[index2];
      if (bracketDepth === 0 && parenDepth === 0) {
        if (currentCharacter === MODIFIER_SEPARATOR) {
          modifiers.push(className.slice(modifierStart, index2));
          modifierStart = index2 + MODIFIER_SEPARATOR_LENGTH;
          continue;
        }
        if (currentCharacter === "/") {
          postfixModifierPosition = index2;
          continue;
        }
      }
      if (currentCharacter === "[") {
        bracketDepth++;
      } else if (currentCharacter === "]") {
        bracketDepth--;
      } else if (currentCharacter === "(") {
        parenDepth++;
      } else if (currentCharacter === ")") {
        parenDepth--;
      }
    }
    const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.substring(modifierStart);
    const baseClassName = stripImportantModifier(baseClassNameWithImportantModifier);
    const hasImportantModifier = baseClassName !== baseClassNameWithImportantModifier;
    const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : void 0;
    return {
      modifiers,
      hasImportantModifier,
      baseClassName,
      maybePostfixModifierPosition
    };
  };
  if (prefix) {
    const fullPrefix = prefix + MODIFIER_SEPARATOR;
    const parseClassNameOriginal = parseClassName;
    parseClassName = (className) => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.substring(fullPrefix.length)) : {
      isExternal: true,
      modifiers: [],
      hasImportantModifier: false,
      baseClassName: className,
      maybePostfixModifierPosition: void 0
    };
  }
  if (experimentalParseClassName) {
    const parseClassNameOriginal = parseClassName;
    parseClassName = (className) => experimentalParseClassName({
      className,
      parseClassName: parseClassNameOriginal
    });
  }
  return parseClassName;
};
const stripImportantModifier = (baseClassName) => {
  if (baseClassName.endsWith(IMPORTANT_MODIFIER)) {
    return baseClassName.substring(0, baseClassName.length - 1);
  }
  if (baseClassName.startsWith(IMPORTANT_MODIFIER)) {
    return baseClassName.substring(1);
  }
  return baseClassName;
};
const createSortModifiers = (config2) => {
  const orderSensitiveModifiers = Object.fromEntries(config2.orderSensitiveModifiers.map((modifier) => [modifier, true]));
  const sortModifiers = (modifiers) => {
    if (modifiers.length <= 1) {
      return modifiers;
    }
    const sortedModifiers = [];
    let unsortedModifiers = [];
    modifiers.forEach((modifier) => {
      const isPositionSensitive = modifier[0] === "[" || orderSensitiveModifiers[modifier];
      if (isPositionSensitive) {
        sortedModifiers.push(...unsortedModifiers.sort(), modifier);
        unsortedModifiers = [];
      } else {
        unsortedModifiers.push(modifier);
      }
    });
    sortedModifiers.push(...unsortedModifiers.sort());
    return sortedModifiers;
  };
  return sortModifiers;
};
const createConfigUtils = (config2) => ({
  cache: createLruCache(config2.cacheSize),
  parseClassName: createParseClassName(config2),
  sortModifiers: createSortModifiers(config2),
  ...createClassGroupUtils(config2)
});
const SPLIT_CLASSES_REGEX = /\s+/;
const mergeClassList = (classList, configUtils) => {
  const {
    parseClassName,
    getClassGroupId,
    getConflictingClassGroupIds,
    sortModifiers
  } = configUtils;
  const classGroupsInConflict = [];
  const classNames2 = classList.trim().split(SPLIT_CLASSES_REGEX);
  let result = "";
  for (let index2 = classNames2.length - 1; index2 >= 0; index2 -= 1) {
    const originalClassName = classNames2[index2];
    const {
      isExternal,
      modifiers,
      hasImportantModifier,
      baseClassName,
      maybePostfixModifierPosition
    } = parseClassName(originalClassName);
    if (isExternal) {
      result = originalClassName + (result.length > 0 ? " " + result : result);
      continue;
    }
    let hasPostfixModifier = !!maybePostfixModifierPosition;
    let classGroupId = getClassGroupId(hasPostfixModifier ? baseClassName.substring(0, maybePostfixModifierPosition) : baseClassName);
    if (!classGroupId) {
      if (!hasPostfixModifier) {
        result = originalClassName + (result.length > 0 ? " " + result : result);
        continue;
      }
      classGroupId = getClassGroupId(baseClassName);
      if (!classGroupId) {
        result = originalClassName + (result.length > 0 ? " " + result : result);
        continue;
      }
      hasPostfixModifier = false;
    }
    const variantModifier = sortModifiers(modifiers).join(":");
    const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
    const classId = modifierId + classGroupId;
    if (classGroupsInConflict.includes(classId)) {
      continue;
    }
    classGroupsInConflict.push(classId);
    const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier);
    for (let i2 = 0; i2 < conflictGroups.length; ++i2) {
      const group = conflictGroups[i2];
      classGroupsInConflict.push(modifierId + group);
    }
    result = originalClassName + (result.length > 0 ? " " + result : result);
  }
  return result;
};
function twJoin() {
  let index2 = 0;
  let argument;
  let resolvedValue;
  let string3 = "";
  while (index2 < arguments.length) {
    if (argument = arguments[index2++]) {
      if (resolvedValue = toValue(argument)) {
        string3 && (string3 += " ");
        string3 += resolvedValue;
      }
    }
  }
  return string3;
}
const toValue = (mix2) => {
  if (typeof mix2 === "string") {
    return mix2;
  }
  let resolvedValue;
  let string3 = "";
  for (let k2 = 0; k2 < mix2.length; k2++) {
    if (mix2[k2]) {
      if (resolvedValue = toValue(mix2[k2])) {
        string3 && (string3 += " ");
        string3 += resolvedValue;
      }
    }
  }
  return string3;
};
function createTailwindMerge(createConfigFirst, ...createConfigRest) {
  let configUtils;
  let cacheGet;
  let cacheSet;
  let functionToCall = initTailwindMerge;
  function initTailwindMerge(classList) {
    const config2 = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst());
    configUtils = createConfigUtils(config2);
    cacheGet = configUtils.cache.get;
    cacheSet = configUtils.cache.set;
    functionToCall = tailwindMerge;
    return tailwindMerge(classList);
  }
  function tailwindMerge(classList) {
    const cachedResult = cacheGet(classList);
    if (cachedResult) {
      return cachedResult;
    }
    const result = mergeClassList(classList, configUtils);
    cacheSet(classList, result);
    return result;
  }
  return function callTailwindMerge() {
    return functionToCall(twJoin.apply(null, arguments));
  };
}
const fromTheme = (key) => {
  const themeGetter = (theme2) => theme2[key] || [];
  themeGetter.isThemeGetter = true;
  return themeGetter;
};
const arbitraryValueRegex = /^\[(?:(\w[\w-]*):)?(.+)\]$/i;
const arbitraryVariableRegex = /^\((?:(\w[\w-]*):)?(.+)\)$/i;
const fractionRegex = /^\d+\/\d+$/;
const tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
const lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
const colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/;
const shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
const imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
const isFraction = (value2) => fractionRegex.test(value2);
const isNumber$3 = (value2) => Boolean(value2) && !Number.isNaN(Number(value2));
const isInteger = (value2) => Boolean(value2) && Number.isInteger(Number(value2));
const isPercent = (value2) => value2.endsWith("%") && isNumber$3(value2.slice(0, -1));
const isTshirtSize = (value2) => tshirtUnitRegex.test(value2);
const isAny = () => true;
const isLengthOnly = (value2) => (
  // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
  // For example, `hsl(0 0% 0%)` would be classified as a length without this check.
  // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
  lengthUnitRegex.test(value2) && !colorFunctionRegex.test(value2)
);
const isNever = () => false;
const isShadow = (value2) => shadowRegex.test(value2);
const isImage = (value2) => imageRegex.test(value2);
const isAnyNonArbitrary = (value2) => !isArbitraryValue(value2) && !isArbitraryVariable(value2);
const isArbitrarySize = (value2) => getIsArbitraryValue(value2, isLabelSize, isNever);
const isArbitraryValue = (value2) => arbitraryValueRegex.test(value2);
const isArbitraryLength = (value2) => getIsArbitraryValue(value2, isLabelLength, isLengthOnly);
const isArbitraryNumber = (value2) => getIsArbitraryValue(value2, isLabelNumber, isNumber$3);
const isArbitraryPosition = (value2) => getIsArbitraryValue(value2, isLabelPosition, isNever);
const isArbitraryImage = (value2) => getIsArbitraryValue(value2, isLabelImage, isImage);
const isArbitraryShadow = (value2) => getIsArbitraryValue(value2, isNever, isShadow);
const isArbitraryVariable = (value2) => arbitraryVariableRegex.test(value2);
const isArbitraryVariableLength = (value2) => getIsArbitraryVariable(value2, isLabelLength);
const isArbitraryVariableFamilyName = (value2) => getIsArbitraryVariable(value2, isLabelFamilyName);
const isArbitraryVariablePosition = (value2) => getIsArbitraryVariable(value2, isLabelPosition);
const isArbitraryVariableSize = (value2) => getIsArbitraryVariable(value2, isLabelSize);
const isArbitraryVariableImage = (value2) => getIsArbitraryVariable(value2, isLabelImage);
const isArbitraryVariableShadow = (value2) => getIsArbitraryVariable(value2, isLabelShadow, true);
const getIsArbitraryValue = (value2, testLabel, testValue) => {
  const result = arbitraryValueRegex.exec(value2);
  if (result) {
    if (result[1]) {
      return testLabel(result[1]);
    }
    return testValue(result[2]);
  }
  return false;
};
const getIsArbitraryVariable = (value2, testLabel, shouldMatchNoLabel = false) => {
  const result = arbitraryVariableRegex.exec(value2);
  if (result) {
    if (result[1]) {
      return testLabel(result[1]);
    }
    return shouldMatchNoLabel;
  }
  return false;
};
const isLabelPosition = (label) => label === "position";
const imageLabels = /* @__PURE__ */ new Set(["image", "url"]);
const isLabelImage = (label) => imageLabels.has(label);
const sizeLabels = /* @__PURE__ */ new Set(["length", "size", "percentage"]);
const isLabelSize = (label) => sizeLabels.has(label);
const isLabelLength = (label) => label === "length";
const isLabelNumber = (label) => label === "number";
const isLabelFamilyName = (label) => label === "family-name";
const isLabelShadow = (label) => label === "shadow";
const getDefaultConfig = () => {
  const themeColor = fromTheme("color");
  const themeFont = fromTheme("font");
  const themeText = fromTheme("text");
  const themeFontWeight = fromTheme("font-weight");
  const themeTracking = fromTheme("tracking");
  const themeLeading = fromTheme("leading");
  const themeBreakpoint = fromTheme("breakpoint");
  const themeContainer = fromTheme("container");
  const themeSpacing = fromTheme("spacing");
  const themeRadius = fromTheme("radius");
  const themeShadow = fromTheme("shadow");
  const themeInsetShadow = fromTheme("inset-shadow");
  const themeDropShadow = fromTheme("drop-shadow");
  const themeBlur = fromTheme("blur");
  const themePerspective = fromTheme("perspective");
  const themeAspect = fromTheme("aspect");
  const themeEase = fromTheme("ease");
  const themeAnimate = fromTheme("animate");
  const scaleBreak = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"];
  const scalePosition = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"];
  const scaleOverflow = () => ["auto", "hidden", "clip", "visible", "scroll"];
  const scaleOverscroll = () => ["auto", "contain", "none"];
  const scaleUnambiguousSpacing = () => [isArbitraryVariable, isArbitraryValue, themeSpacing];
  const scaleInset = () => [isFraction, "full", "auto", ...scaleUnambiguousSpacing()];
  const scaleGridTemplateColsRows = () => [isInteger, "none", "subgrid", isArbitraryVariable, isArbitraryValue];
  const scaleGridColRowStartAndEnd = () => ["auto", {
    span: ["full", isInteger, isArbitraryVariable, isArbitraryValue]
  }, isArbitraryVariable, isArbitraryValue];
  const scaleGridColRowStartOrEnd = () => [isInteger, "auto", isArbitraryVariable, isArbitraryValue];
  const scaleGridAutoColsRows = () => ["auto", "min", "max", "fr", isArbitraryVariable, isArbitraryValue];
  const scaleAlignPrimaryAxis = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline"];
  const scaleAlignSecondaryAxis = () => ["start", "end", "center", "stretch"];
  const scaleMargin = () => ["auto", ...scaleUnambiguousSpacing()];
  const scaleSizing = () => [isFraction, "auto", "full", "dvw", "dvh", "lvw", "lvh", "svw", "svh", "min", "max", "fit", ...scaleUnambiguousSpacing()];
  const scaleColor = () => [themeColor, isArbitraryVariable, isArbitraryValue];
  const scaleGradientStopPosition = () => [isPercent, isArbitraryLength];
  const scaleRadius = () => [
    // Deprecated since Tailwind CSS v4.0.0
    "",
    "none",
    "full",
    themeRadius,
    isArbitraryVariable,
    isArbitraryValue
  ];
  const scaleBorderWidth = () => ["", isNumber$3, isArbitraryVariableLength, isArbitraryLength];
  const scaleLineStyle = () => ["solid", "dashed", "dotted", "double"];
  const scaleBlendMode = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"];
  const scaleBlur = () => [
    // Deprecated since Tailwind CSS v4.0.0
    "",
    "none",
    themeBlur,
    isArbitraryVariable,
    isArbitraryValue
  ];
  const scaleOrigin = () => ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left", isArbitraryVariable, isArbitraryValue];
  const scaleRotate = () => ["none", isNumber$3, isArbitraryVariable, isArbitraryValue];
  const scaleScale = () => ["none", isNumber$3, isArbitraryVariable, isArbitraryValue];
  const scaleSkew = () => [isNumber$3, isArbitraryVariable, isArbitraryValue];
  const scaleTranslate = () => [isFraction, "full", ...scaleUnambiguousSpacing()];
  return {
    cacheSize: 500,
    theme: {
      animate: ["spin", "ping", "pulse", "bounce"],
      aspect: ["video"],
      blur: [isTshirtSize],
      breakpoint: [isTshirtSize],
      color: [isAny],
      container: [isTshirtSize],
      "drop-shadow": [isTshirtSize],
      ease: ["in", "out", "in-out"],
      font: [isAnyNonArbitrary],
      "font-weight": ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black"],
      "inset-shadow": [isTshirtSize],
      leading: ["none", "tight", "snug", "normal", "relaxed", "loose"],
      perspective: ["dramatic", "near", "normal", "midrange", "distant", "none"],
      radius: [isTshirtSize],
      shadow: [isTshirtSize],
      spacing: ["px", isNumber$3],
      text: [isTshirtSize],
      tracking: ["tighter", "tight", "normal", "wide", "wider", "widest"]
    },
    classGroups: {
      // --------------
      // --- Layout ---
      // --------------
      /**
       * Aspect Ratio
       * @see https://tailwindcss.com/docs/aspect-ratio
       */
      aspect: [{
        aspect: ["auto", "square", isFraction, isArbitraryValue, isArbitraryVariable, themeAspect]
      }],
      /**
       * Container
       * @see https://tailwindcss.com/docs/container
       * @deprecated since Tailwind CSS v4.0.0
       */
      container: ["container"],
      /**
       * Columns
       * @see https://tailwindcss.com/docs/columns
       */
      columns: [{
        columns: [isNumber$3, isArbitraryValue, isArbitraryVariable, themeContainer]
      }],
      /**
       * Break After
       * @see https://tailwindcss.com/docs/break-after
       */
      "break-after": [{
        "break-after": scaleBreak()
      }],
      /**
       * Break Before
       * @see https://tailwindcss.com/docs/break-before
       */
      "break-before": [{
        "break-before": scaleBreak()
      }],
      /**
       * Break Inside
       * @see https://tailwindcss.com/docs/break-inside
       */
      "break-inside": [{
        "break-inside": ["auto", "avoid", "avoid-page", "avoid-column"]
      }],
      /**
       * Box Decoration Break
       * @see https://tailwindcss.com/docs/box-decoration-break
       */
      "box-decoration": [{
        "box-decoration": ["slice", "clone"]
      }],
      /**
       * Box Sizing
       * @see https://tailwindcss.com/docs/box-sizing
       */
      box: [{
        box: ["border", "content"]
      }],
      /**
       * Display
       * @see https://tailwindcss.com/docs/display
       */
      display: ["block", "inline-block", "inline", "flex", "inline-flex", "table", "inline-table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row-group", "table-row", "flow-root", "grid", "inline-grid", "contents", "list-item", "hidden"],
      /**
       * Screen Reader Only
       * @see https://tailwindcss.com/docs/display#screen-reader-only
       */
      sr: ["sr-only", "not-sr-only"],
      /**
       * Floats
       * @see https://tailwindcss.com/docs/float
       */
      float: [{
        float: ["right", "left", "none", "start", "end"]
      }],
      /**
       * Clear
       * @see https://tailwindcss.com/docs/clear
       */
      clear: [{
        clear: ["left", "right", "both", "none", "start", "end"]
      }],
      /**
       * Isolation
       * @see https://tailwindcss.com/docs/isolation
       */
      isolation: ["isolate", "isolation-auto"],
      /**
       * Object Fit
       * @see https://tailwindcss.com/docs/object-fit
       */
      "object-fit": [{
        object: ["contain", "cover", "fill", "none", "scale-down"]
      }],
      /**
       * Object Position
       * @see https://tailwindcss.com/docs/object-position
       */
      "object-position": [{
        object: [...scalePosition(), isArbitraryValue, isArbitraryVariable]
      }],
      /**
       * Overflow
       * @see https://tailwindcss.com/docs/overflow
       */
      overflow: [{
        overflow: scaleOverflow()
      }],
      /**
       * Overflow X
       * @see https://tailwindcss.com/docs/overflow
       */
      "overflow-x": [{
        "overflow-x": scaleOverflow()
      }],
      /**
       * Overflow Y
       * @see https://tailwindcss.com/docs/overflow
       */
      "overflow-y": [{
        "overflow-y": scaleOverflow()
      }],
      /**
       * Overscroll Behavior
       * @see https://tailwindcss.com/docs/overscroll-behavior
       */
      overscroll: [{
        overscroll: scaleOverscroll()
      }],
      /**
       * Overscroll Behavior X
       * @see https://tailwindcss.com/docs/overscroll-behavior
       */
      "overscroll-x": [{
        "overscroll-x": scaleOverscroll()
      }],
      /**
       * Overscroll Behavior Y
       * @see https://tailwindcss.com/docs/overscroll-behavior
       */
      "overscroll-y": [{
        "overscroll-y": scaleOverscroll()
      }],
      /**
       * Position
       * @see https://tailwindcss.com/docs/position
       */
      position: ["static", "fixed", "absolute", "relative", "sticky"],
      /**
       * Top / Right / Bottom / Left
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      inset: [{
        inset: scaleInset()
      }],
      /**
       * Right / Left
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      "inset-x": [{
        "inset-x": scaleInset()
      }],
      /**
       * Top / Bottom
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      "inset-y": [{
        "inset-y": scaleInset()
      }],
      /**
       * Start
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      start: [{
        start: scaleInset()
      }],
      /**
       * End
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      end: [{
        end: scaleInset()
      }],
      /**
       * Top
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      top: [{
        top: scaleInset()
      }],
      /**
       * Right
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      right: [{
        right: scaleInset()
      }],
      /**
       * Bottom
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      bottom: [{
        bottom: scaleInset()
      }],
      /**
       * Left
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      left: [{
        left: scaleInset()
      }],
      /**
       * Visibility
       * @see https://tailwindcss.com/docs/visibility
       */
      visibility: ["visible", "invisible", "collapse"],
      /**
       * Z-Index
       * @see https://tailwindcss.com/docs/z-index
       */
      z: [{
        z: [isInteger, "auto", isArbitraryVariable, isArbitraryValue]
      }],
      // ------------------------
      // --- Flexbox and Grid ---
      // ------------------------
      /**
       * Flex Basis
       * @see https://tailwindcss.com/docs/flex-basis
       */
      basis: [{
        basis: [isFraction, "full", "auto", themeContainer, ...scaleUnambiguousSpacing()]
      }],
      /**
       * Flex Direction
       * @see https://tailwindcss.com/docs/flex-direction
       */
      "flex-direction": [{
        flex: ["row", "row-reverse", "col", "col-reverse"]
      }],
      /**
       * Flex Wrap
       * @see https://tailwindcss.com/docs/flex-wrap
       */
      "flex-wrap": [{
        flex: ["nowrap", "wrap", "wrap-reverse"]
      }],
      /**
       * Flex
       * @see https://tailwindcss.com/docs/flex
       */
      flex: [{
        flex: [isNumber$3, isFraction, "auto", "initial", "none", isArbitraryValue]
      }],
      /**
       * Flex Grow
       * @see https://tailwindcss.com/docs/flex-grow
       */
      grow: [{
        grow: ["", isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Flex Shrink
       * @see https://tailwindcss.com/docs/flex-shrink
       */
      shrink: [{
        shrink: ["", isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Order
       * @see https://tailwindcss.com/docs/order
       */
      order: [{
        order: [isInteger, "first", "last", "none", isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Grid Template Columns
       * @see https://tailwindcss.com/docs/grid-template-columns
       */
      "grid-cols": [{
        "grid-cols": scaleGridTemplateColsRows()
      }],
      /**
       * Grid Column Start / End
       * @see https://tailwindcss.com/docs/grid-column
       */
      "col-start-end": [{
        col: scaleGridColRowStartAndEnd()
      }],
      /**
       * Grid Column Start
       * @see https://tailwindcss.com/docs/grid-column
       */
      "col-start": [{
        "col-start": scaleGridColRowStartOrEnd()
      }],
      /**
       * Grid Column End
       * @see https://tailwindcss.com/docs/grid-column
       */
      "col-end": [{
        "col-end": scaleGridColRowStartOrEnd()
      }],
      /**
       * Grid Template Rows
       * @see https://tailwindcss.com/docs/grid-template-rows
       */
      "grid-rows": [{
        "grid-rows": scaleGridTemplateColsRows()
      }],
      /**
       * Grid Row Start / End
       * @see https://tailwindcss.com/docs/grid-row
       */
      "row-start-end": [{
        row: scaleGridColRowStartAndEnd()
      }],
      /**
       * Grid Row Start
       * @see https://tailwindcss.com/docs/grid-row
       */
      "row-start": [{
        "row-start": scaleGridColRowStartOrEnd()
      }],
      /**
       * Grid Row End
       * @see https://tailwindcss.com/docs/grid-row
       */
      "row-end": [{
        "row-end": scaleGridColRowStartOrEnd()
      }],
      /**
       * Grid Auto Flow
       * @see https://tailwindcss.com/docs/grid-auto-flow
       */
      "grid-flow": [{
        "grid-flow": ["row", "col", "dense", "row-dense", "col-dense"]
      }],
      /**
       * Grid Auto Columns
       * @see https://tailwindcss.com/docs/grid-auto-columns
       */
      "auto-cols": [{
        "auto-cols": scaleGridAutoColsRows()
      }],
      /**
       * Grid Auto Rows
       * @see https://tailwindcss.com/docs/grid-auto-rows
       */
      "auto-rows": [{
        "auto-rows": scaleGridAutoColsRows()
      }],
      /**
       * Gap
       * @see https://tailwindcss.com/docs/gap
       */
      gap: [{
        gap: scaleUnambiguousSpacing()
      }],
      /**
       * Gap X
       * @see https://tailwindcss.com/docs/gap
       */
      "gap-x": [{
        "gap-x": scaleUnambiguousSpacing()
      }],
      /**
       * Gap Y
       * @see https://tailwindcss.com/docs/gap
       */
      "gap-y": [{
        "gap-y": scaleUnambiguousSpacing()
      }],
      /**
       * Justify Content
       * @see https://tailwindcss.com/docs/justify-content
       */
      "justify-content": [{
        justify: [...scaleAlignPrimaryAxis(), "normal"]
      }],
      /**
       * Justify Items
       * @see https://tailwindcss.com/docs/justify-items
       */
      "justify-items": [{
        "justify-items": [...scaleAlignSecondaryAxis(), "normal"]
      }],
      /**
       * Justify Self
       * @see https://tailwindcss.com/docs/justify-self
       */
      "justify-self": [{
        "justify-self": ["auto", ...scaleAlignSecondaryAxis()]
      }],
      /**
       * Align Content
       * @see https://tailwindcss.com/docs/align-content
       */
      "align-content": [{
        content: ["normal", ...scaleAlignPrimaryAxis()]
      }],
      /**
       * Align Items
       * @see https://tailwindcss.com/docs/align-items
       */
      "align-items": [{
        items: [...scaleAlignSecondaryAxis(), "baseline"]
      }],
      /**
       * Align Self
       * @see https://tailwindcss.com/docs/align-self
       */
      "align-self": [{
        self: ["auto", ...scaleAlignSecondaryAxis(), "baseline"]
      }],
      /**
       * Place Content
       * @see https://tailwindcss.com/docs/place-content
       */
      "place-content": [{
        "place-content": scaleAlignPrimaryAxis()
      }],
      /**
       * Place Items
       * @see https://tailwindcss.com/docs/place-items
       */
      "place-items": [{
        "place-items": [...scaleAlignSecondaryAxis(), "baseline"]
      }],
      /**
       * Place Self
       * @see https://tailwindcss.com/docs/place-self
       */
      "place-self": [{
        "place-self": ["auto", ...scaleAlignSecondaryAxis()]
      }],
      // Spacing
      /**
       * Padding
       * @see https://tailwindcss.com/docs/padding
       */
      p: [{
        p: scaleUnambiguousSpacing()
      }],
      /**
       * Padding X
       * @see https://tailwindcss.com/docs/padding
       */
      px: [{
        px: scaleUnambiguousSpacing()
      }],
      /**
       * Padding Y
       * @see https://tailwindcss.com/docs/padding
       */
      py: [{
        py: scaleUnambiguousSpacing()
      }],
      /**
       * Padding Start
       * @see https://tailwindcss.com/docs/padding
       */
      ps: [{
        ps: scaleUnambiguousSpacing()
      }],
      /**
       * Padding End
       * @see https://tailwindcss.com/docs/padding
       */
      pe: [{
        pe: scaleUnambiguousSpacing()
      }],
      /**
       * Padding Top
       * @see https://tailwindcss.com/docs/padding
       */
      pt: [{
        pt: scaleUnambiguousSpacing()
      }],
      /**
       * Padding Right
       * @see https://tailwindcss.com/docs/padding
       */
      pr: [{
        pr: scaleUnambiguousSpacing()
      }],
      /**
       * Padding Bottom
       * @see https://tailwindcss.com/docs/padding
       */
      pb: [{
        pb: scaleUnambiguousSpacing()
      }],
      /**
       * Padding Left
       * @see https://tailwindcss.com/docs/padding
       */
      pl: [{
        pl: scaleUnambiguousSpacing()
      }],
      /**
       * Margin
       * @see https://tailwindcss.com/docs/margin
       */
      m: [{
        m: scaleMargin()
      }],
      /**
       * Margin X
       * @see https://tailwindcss.com/docs/margin
       */
      mx: [{
        mx: scaleMargin()
      }],
      /**
       * Margin Y
       * @see https://tailwindcss.com/docs/margin
       */
      my: [{
        my: scaleMargin()
      }],
      /**
       * Margin Start
       * @see https://tailwindcss.com/docs/margin
       */
      ms: [{
        ms: scaleMargin()
      }],
      /**
       * Margin End
       * @see https://tailwindcss.com/docs/margin
       */
      me: [{
        me: scaleMargin()
      }],
      /**
       * Margin Top
       * @see https://tailwindcss.com/docs/margin
       */
      mt: [{
        mt: scaleMargin()
      }],
      /**
       * Margin Right
       * @see https://tailwindcss.com/docs/margin
       */
      mr: [{
        mr: scaleMargin()
      }],
      /**
       * Margin Bottom
       * @see https://tailwindcss.com/docs/margin
       */
      mb: [{
        mb: scaleMargin()
      }],
      /**
       * Margin Left
       * @see https://tailwindcss.com/docs/margin
       */
      ml: [{
        ml: scaleMargin()
      }],
      /**
       * Space Between X
       * @see https://tailwindcss.com/docs/margin#adding-space-between-children
       */
      "space-x": [{
        "space-x": scaleUnambiguousSpacing()
      }],
      /**
       * Space Between X Reverse
       * @see https://tailwindcss.com/docs/margin#adding-space-between-children
       */
      "space-x-reverse": ["space-x-reverse"],
      /**
       * Space Between Y
       * @see https://tailwindcss.com/docs/margin#adding-space-between-children
       */
      "space-y": [{
        "space-y": scaleUnambiguousSpacing()
      }],
      /**
       * Space Between Y Reverse
       * @see https://tailwindcss.com/docs/margin#adding-space-between-children
       */
      "space-y-reverse": ["space-y-reverse"],
      // --------------
      // --- Sizing ---
      // --------------
      /**
       * Size
       * @see https://tailwindcss.com/docs/width#setting-both-width-and-height
       */
      size: [{
        size: scaleSizing()
      }],
      /**
       * Width
       * @see https://tailwindcss.com/docs/width
       */
      w: [{
        w: [themeContainer, "screen", ...scaleSizing()]
      }],
      /**
       * Min-Width
       * @see https://tailwindcss.com/docs/min-width
       */
      "min-w": [{
        "min-w": [
          themeContainer,
          "screen",
          /** Deprecated. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
          "none",
          ...scaleSizing()
        ]
      }],
      /**
       * Max-Width
       * @see https://tailwindcss.com/docs/max-width
       */
      "max-w": [{
        "max-w": [
          themeContainer,
          "screen",
          "none",
          /** Deprecated since Tailwind CSS v4.0.0. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
          "prose",
          /** Deprecated since Tailwind CSS v4.0.0. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
          {
            screen: [themeBreakpoint]
          },
          ...scaleSizing()
        ]
      }],
      /**
       * Height
       * @see https://tailwindcss.com/docs/height
       */
      h: [{
        h: ["screen", ...scaleSizing()]
      }],
      /**
       * Min-Height
       * @see https://tailwindcss.com/docs/min-height
       */
      "min-h": [{
        "min-h": ["screen", "none", ...scaleSizing()]
      }],
      /**
       * Max-Height
       * @see https://tailwindcss.com/docs/max-height
       */
      "max-h": [{
        "max-h": ["screen", ...scaleSizing()]
      }],
      // ------------------
      // --- Typography ---
      // ------------------
      /**
       * Font Size
       * @see https://tailwindcss.com/docs/font-size
       */
      "font-size": [{
        text: ["base", themeText, isArbitraryVariableLength, isArbitraryLength]
      }],
      /**
       * Font Smoothing
       * @see https://tailwindcss.com/docs/font-smoothing
       */
      "font-smoothing": ["antialiased", "subpixel-antialiased"],
      /**
       * Font Style
       * @see https://tailwindcss.com/docs/font-style
       */
      "font-style": ["italic", "not-italic"],
      /**
       * Font Weight
       * @see https://tailwindcss.com/docs/font-weight
       */
      "font-weight": [{
        font: [themeFontWeight, isArbitraryVariable, isArbitraryNumber]
      }],
      /**
       * Font Stretch
       * @see https://tailwindcss.com/docs/font-stretch
       */
      "font-stretch": [{
        "font-stretch": ["ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "normal", "semi-expanded", "expanded", "extra-expanded", "ultra-expanded", isPercent, isArbitraryValue]
      }],
      /**
       * Font Family
       * @see https://tailwindcss.com/docs/font-family
       */
      "font-family": [{
        font: [isArbitraryVariableFamilyName, isArbitraryValue, themeFont]
      }],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-normal": ["normal-nums"],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-ordinal": ["ordinal"],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-slashed-zero": ["slashed-zero"],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-figure": ["lining-nums", "oldstyle-nums"],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-spacing": ["proportional-nums", "tabular-nums"],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-fraction": ["diagonal-fractions", "stacked-fractions"],
      /**
       * Letter Spacing
       * @see https://tailwindcss.com/docs/letter-spacing
       */
      tracking: [{
        tracking: [themeTracking, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Line Clamp
       * @see https://tailwindcss.com/docs/line-clamp
       */
      "line-clamp": [{
        "line-clamp": [isNumber$3, "none", isArbitraryVariable, isArbitraryNumber]
      }],
      /**
       * Line Height
       * @see https://tailwindcss.com/docs/line-height
       */
      leading: [{
        leading: [
          /** Deprecated since Tailwind CSS v4.0.0. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
          themeLeading,
          ...scaleUnambiguousSpacing()
        ]
      }],
      /**
       * List Style Image
       * @see https://tailwindcss.com/docs/list-style-image
       */
      "list-image": [{
        "list-image": ["none", isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * List Style Position
       * @see https://tailwindcss.com/docs/list-style-position
       */
      "list-style-position": [{
        list: ["inside", "outside"]
      }],
      /**
       * List Style Type
       * @see https://tailwindcss.com/docs/list-style-type
       */
      "list-style-type": [{
        list: ["disc", "decimal", "none", isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Text Alignment
       * @see https://tailwindcss.com/docs/text-align
       */
      "text-alignment": [{
        text: ["left", "center", "right", "justify", "start", "end"]
      }],
      /**
       * Placeholder Color
       * @deprecated since Tailwind CSS v3.0.0
       * @see https://v3.tailwindcss.com/docs/placeholder-color
       */
      "placeholder-color": [{
        placeholder: scaleColor()
      }],
      /**
       * Text Color
       * @see https://tailwindcss.com/docs/text-color
       */
      "text-color": [{
        text: scaleColor()
      }],
      /**
       * Text Decoration
       * @see https://tailwindcss.com/docs/text-decoration
       */
      "text-decoration": ["underline", "overline", "line-through", "no-underline"],
      /**
       * Text Decoration Style
       * @see https://tailwindcss.com/docs/text-decoration-style
       */
      "text-decoration-style": [{
        decoration: [...scaleLineStyle(), "wavy"]
      }],
      /**
       * Text Decoration Thickness
       * @see https://tailwindcss.com/docs/text-decoration-thickness
       */
      "text-decoration-thickness": [{
        decoration: [isNumber$3, "from-font", "auto", isArbitraryVariable, isArbitraryLength]
      }],
      /**
       * Text Decoration Color
       * @see https://tailwindcss.com/docs/text-decoration-color
       */
      "text-decoration-color": [{
        decoration: scaleColor()
      }],
      /**
       * Text Underline Offset
       * @see https://tailwindcss.com/docs/text-underline-offset
       */
      "underline-offset": [{
        "underline-offset": [isNumber$3, "auto", isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Text Transform
       * @see https://tailwindcss.com/docs/text-transform
       */
      "text-transform": ["uppercase", "lowercase", "capitalize", "normal-case"],
      /**
       * Text Overflow
       * @see https://tailwindcss.com/docs/text-overflow
       */
      "text-overflow": ["truncate", "text-ellipsis", "text-clip"],
      /**
       * Text Wrap
       * @see https://tailwindcss.com/docs/text-wrap
       */
      "text-wrap": [{
        text: ["wrap", "nowrap", "balance", "pretty"]
      }],
      /**
       * Text Indent
       * @see https://tailwindcss.com/docs/text-indent
       */
      indent: [{
        indent: scaleUnambiguousSpacing()
      }],
      /**
       * Vertical Alignment
       * @see https://tailwindcss.com/docs/vertical-align
       */
      "vertical-align": [{
        align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Whitespace
       * @see https://tailwindcss.com/docs/whitespace
       */
      whitespace: [{
        whitespace: ["normal", "nowrap", "pre", "pre-line", "pre-wrap", "break-spaces"]
      }],
      /**
       * Word Break
       * @see https://tailwindcss.com/docs/word-break
       */
      break: [{
        break: ["normal", "words", "all", "keep"]
      }],
      /**
       * Hyphens
       * @see https://tailwindcss.com/docs/hyphens
       */
      hyphens: [{
        hyphens: ["none", "manual", "auto"]
      }],
      /**
       * Content
       * @see https://tailwindcss.com/docs/content
       */
      content: [{
        content: ["none", isArbitraryVariable, isArbitraryValue]
      }],
      // -------------------
      // --- Backgrounds ---
      // -------------------
      /**
       * Background Attachment
       * @see https://tailwindcss.com/docs/background-attachment
       */
      "bg-attachment": [{
        bg: ["fixed", "local", "scroll"]
      }],
      /**
       * Background Clip
       * @see https://tailwindcss.com/docs/background-clip
       */
      "bg-clip": [{
        "bg-clip": ["border", "padding", "content", "text"]
      }],
      /**
       * Background Origin
       * @see https://tailwindcss.com/docs/background-origin
       */
      "bg-origin": [{
        "bg-origin": ["border", "padding", "content"]
      }],
      /**
       * Background Position
       * @see https://tailwindcss.com/docs/background-position
       */
      "bg-position": [{
        bg: [...scalePosition(), isArbitraryVariablePosition, isArbitraryPosition]
      }],
      /**
       * Background Repeat
       * @see https://tailwindcss.com/docs/background-repeat
       */
      "bg-repeat": [{
        bg: ["no-repeat", {
          repeat: ["", "x", "y", "space", "round"]
        }]
      }],
      /**
       * Background Size
       * @see https://tailwindcss.com/docs/background-size
       */
      "bg-size": [{
        bg: ["auto", "cover", "contain", isArbitraryVariableSize, isArbitrarySize]
      }],
      /**
       * Background Image
       * @see https://tailwindcss.com/docs/background-image
       */
      "bg-image": [{
        bg: ["none", {
          linear: [{
            to: ["t", "tr", "r", "br", "b", "bl", "l", "tl"]
          }, isInteger, isArbitraryVariable, isArbitraryValue],
          radial: ["", isArbitraryVariable, isArbitraryValue],
          conic: [isInteger, isArbitraryVariable, isArbitraryValue]
        }, isArbitraryVariableImage, isArbitraryImage]
      }],
      /**
       * Background Color
       * @see https://tailwindcss.com/docs/background-color
       */
      "bg-color": [{
        bg: scaleColor()
      }],
      /**
       * Gradient Color Stops From Position
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-from-pos": [{
        from: scaleGradientStopPosition()
      }],
      /**
       * Gradient Color Stops Via Position
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-via-pos": [{
        via: scaleGradientStopPosition()
      }],
      /**
       * Gradient Color Stops To Position
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-to-pos": [{
        to: scaleGradientStopPosition()
      }],
      /**
       * Gradient Color Stops From
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-from": [{
        from: scaleColor()
      }],
      /**
       * Gradient Color Stops Via
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-via": [{
        via: scaleColor()
      }],
      /**
       * Gradient Color Stops To
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-to": [{
        to: scaleColor()
      }],
      // ---------------
      // --- Borders ---
      // ---------------
      /**
       * Border Radius
       * @see https://tailwindcss.com/docs/border-radius
       */
      rounded: [{
        rounded: scaleRadius()
      }],
      /**
       * Border Radius Start
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-s": [{
        "rounded-s": scaleRadius()
      }],
      /**
       * Border Radius End
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-e": [{
        "rounded-e": scaleRadius()
      }],
      /**
       * Border Radius Top
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-t": [{
        "rounded-t": scaleRadius()
      }],
      /**
       * Border Radius Right
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-r": [{
        "rounded-r": scaleRadius()
      }],
      /**
       * Border Radius Bottom
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-b": [{
        "rounded-b": scaleRadius()
      }],
      /**
       * Border Radius Left
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-l": [{
        "rounded-l": scaleRadius()
      }],
      /**
       * Border Radius Start Start
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-ss": [{
        "rounded-ss": scaleRadius()
      }],
      /**
       * Border Radius Start End
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-se": [{
        "rounded-se": scaleRadius()
      }],
      /**
       * Border Radius End End
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-ee": [{
        "rounded-ee": scaleRadius()
      }],
      /**
       * Border Radius End Start
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-es": [{
        "rounded-es": scaleRadius()
      }],
      /**
       * Border Radius Top Left
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-tl": [{
        "rounded-tl": scaleRadius()
      }],
      /**
       * Border Radius Top Right
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-tr": [{
        "rounded-tr": scaleRadius()
      }],
      /**
       * Border Radius Bottom Right
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-br": [{
        "rounded-br": scaleRadius()
      }],
      /**
       * Border Radius Bottom Left
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-bl": [{
        "rounded-bl": scaleRadius()
      }],
      /**
       * Border Width
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w": [{
        border: scaleBorderWidth()
      }],
      /**
       * Border Width X
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-x": [{
        "border-x": scaleBorderWidth()
      }],
      /**
       * Border Width Y
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-y": [{
        "border-y": scaleBorderWidth()
      }],
      /**
       * Border Width Start
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-s": [{
        "border-s": scaleBorderWidth()
      }],
      /**
       * Border Width End
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-e": [{
        "border-e": scaleBorderWidth()
      }],
      /**
       * Border Width Top
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-t": [{
        "border-t": scaleBorderWidth()
      }],
      /**
       * Border Width Right
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-r": [{
        "border-r": scaleBorderWidth()
      }],
      /**
       * Border Width Bottom
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-b": [{
        "border-b": scaleBorderWidth()
      }],
      /**
       * Border Width Left
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-l": [{
        "border-l": scaleBorderWidth()
      }],
      /**
       * Divide Width X
       * @see https://tailwindcss.com/docs/border-width#between-children
       */
      "divide-x": [{
        "divide-x": scaleBorderWidth()
      }],
      /**
       * Divide Width X Reverse
       * @see https://tailwindcss.com/docs/border-width#between-children
       */
      "divide-x-reverse": ["divide-x-reverse"],
      /**
       * Divide Width Y
       * @see https://tailwindcss.com/docs/border-width#between-children
       */
      "divide-y": [{
        "divide-y": scaleBorderWidth()
      }],
      /**
       * Divide Width Y Reverse
       * @see https://tailwindcss.com/docs/border-width#between-children
       */
      "divide-y-reverse": ["divide-y-reverse"],
      /**
       * Border Style
       * @see https://tailwindcss.com/docs/border-style
       */
      "border-style": [{
        border: [...scaleLineStyle(), "hidden", "none"]
      }],
      /**
       * Divide Style
       * @see https://tailwindcss.com/docs/border-style#setting-the-divider-style
       */
      "divide-style": [{
        divide: [...scaleLineStyle(), "hidden", "none"]
      }],
      /**
       * Border Color
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color": [{
        border: scaleColor()
      }],
      /**
       * Border Color X
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-x": [{
        "border-x": scaleColor()
      }],
      /**
       * Border Color Y
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-y": [{
        "border-y": scaleColor()
      }],
      /**
       * Border Color S
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-s": [{
        "border-s": scaleColor()
      }],
      /**
       * Border Color E
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-e": [{
        "border-e": scaleColor()
      }],
      /**
       * Border Color Top
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-t": [{
        "border-t": scaleColor()
      }],
      /**
       * Border Color Right
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-r": [{
        "border-r": scaleColor()
      }],
      /**
       * Border Color Bottom
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-b": [{
        "border-b": scaleColor()
      }],
      /**
       * Border Color Left
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-l": [{
        "border-l": scaleColor()
      }],
      /**
       * Divide Color
       * @see https://tailwindcss.com/docs/divide-color
       */
      "divide-color": [{
        divide: scaleColor()
      }],
      /**
       * Outline Style
       * @see https://tailwindcss.com/docs/outline-style
       */
      "outline-style": [{
        outline: [...scaleLineStyle(), "none", "hidden"]
      }],
      /**
       * Outline Offset
       * @see https://tailwindcss.com/docs/outline-offset
       */
      "outline-offset": [{
        "outline-offset": [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Outline Width
       * @see https://tailwindcss.com/docs/outline-width
       */
      "outline-w": [{
        outline: ["", isNumber$3, isArbitraryVariableLength, isArbitraryLength]
      }],
      /**
       * Outline Color
       * @see https://tailwindcss.com/docs/outline-color
       */
      "outline-color": [{
        outline: [themeColor]
      }],
      // ---------------
      // --- Effects ---
      // ---------------
      /**
       * Box Shadow
       * @see https://tailwindcss.com/docs/box-shadow
       */
      shadow: [{
        shadow: [
          // Deprecated since Tailwind CSS v4.0.0
          "",
          "none",
          themeShadow,
          isArbitraryVariableShadow,
          isArbitraryShadow
        ]
      }],
      /**
       * Box Shadow Color
       * @see https://tailwindcss.com/docs/box-shadow#setting-the-shadow-color
       */
      "shadow-color": [{
        shadow: scaleColor()
      }],
      /**
       * Inset Box Shadow
       * @see https://tailwindcss.com/docs/box-shadow#adding-an-inset-shadow
       */
      "inset-shadow": [{
        "inset-shadow": ["none", isArbitraryVariable, isArbitraryValue, themeInsetShadow]
      }],
      /**
       * Inset Box Shadow Color
       * @see https://tailwindcss.com/docs/box-shadow#setting-the-inset-shadow-color
       */
      "inset-shadow-color": [{
        "inset-shadow": scaleColor()
      }],
      /**
       * Ring Width
       * @see https://tailwindcss.com/docs/box-shadow#adding-a-ring
       */
      "ring-w": [{
        ring: scaleBorderWidth()
      }],
      /**
       * Ring Width Inset
       * @see https://v3.tailwindcss.com/docs/ring-width#inset-rings
       * @deprecated since Tailwind CSS v4.0.0
       * @see https://github.com/tailwindlabs/tailwindcss/blob/v4.0.0/packages/tailwindcss/src/utilities.ts#L4158
       */
      "ring-w-inset": ["ring-inset"],
      /**
       * Ring Color
       * @see https://tailwindcss.com/docs/box-shadow#setting-the-ring-color
       */
      "ring-color": [{
        ring: scaleColor()
      }],
      /**
       * Ring Offset Width
       * @see https://v3.tailwindcss.com/docs/ring-offset-width
       * @deprecated since Tailwind CSS v4.0.0
       * @see https://github.com/tailwindlabs/tailwindcss/blob/v4.0.0/packages/tailwindcss/src/utilities.ts#L4158
       */
      "ring-offset-w": [{
        "ring-offset": [isNumber$3, isArbitraryLength]
      }],
      /**
       * Ring Offset Color
       * @see https://v3.tailwindcss.com/docs/ring-offset-color
       * @deprecated since Tailwind CSS v4.0.0
       * @see https://github.com/tailwindlabs/tailwindcss/blob/v4.0.0/packages/tailwindcss/src/utilities.ts#L4158
       */
      "ring-offset-color": [{
        "ring-offset": scaleColor()
      }],
      /**
       * Inset Ring Width
       * @see https://tailwindcss.com/docs/box-shadow#adding-an-inset-ring
       */
      "inset-ring-w": [{
        "inset-ring": scaleBorderWidth()
      }],
      /**
       * Inset Ring Color
       * @see https://tailwindcss.com/docs/box-shadow#setting-the-inset-ring-color
       */
      "inset-ring-color": [{
        "inset-ring": scaleColor()
      }],
      /**
       * Opacity
       * @see https://tailwindcss.com/docs/opacity
       */
      opacity: [{
        opacity: [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Mix Blend Mode
       * @see https://tailwindcss.com/docs/mix-blend-mode
       */
      "mix-blend": [{
        "mix-blend": [...scaleBlendMode(), "plus-darker", "plus-lighter"]
      }],
      /**
       * Background Blend Mode
       * @see https://tailwindcss.com/docs/background-blend-mode
       */
      "bg-blend": [{
        "bg-blend": scaleBlendMode()
      }],
      // ---------------
      // --- Filters ---
      // ---------------
      /**
       * Filter
       * @see https://tailwindcss.com/docs/filter
       */
      filter: [{
        filter: [
          // Deprecated since Tailwind CSS v3.0.0
          "",
          "none",
          isArbitraryVariable,
          isArbitraryValue
        ]
      }],
      /**
       * Blur
       * @see https://tailwindcss.com/docs/blur
       */
      blur: [{
        blur: scaleBlur()
      }],
      /**
       * Brightness
       * @see https://tailwindcss.com/docs/brightness
       */
      brightness: [{
        brightness: [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Contrast
       * @see https://tailwindcss.com/docs/contrast
       */
      contrast: [{
        contrast: [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Drop Shadow
       * @see https://tailwindcss.com/docs/drop-shadow
       */
      "drop-shadow": [{
        "drop-shadow": [
          // Deprecated since Tailwind CSS v4.0.0
          "",
          "none",
          themeDropShadow,
          isArbitraryVariable,
          isArbitraryValue
        ]
      }],
      /**
       * Grayscale
       * @see https://tailwindcss.com/docs/grayscale
       */
      grayscale: [{
        grayscale: ["", isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Hue Rotate
       * @see https://tailwindcss.com/docs/hue-rotate
       */
      "hue-rotate": [{
        "hue-rotate": [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Invert
       * @see https://tailwindcss.com/docs/invert
       */
      invert: [{
        invert: ["", isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Saturate
       * @see https://tailwindcss.com/docs/saturate
       */
      saturate: [{
        saturate: [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Sepia
       * @see https://tailwindcss.com/docs/sepia
       */
      sepia: [{
        sepia: ["", isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Backdrop Filter
       * @see https://tailwindcss.com/docs/backdrop-filter
       */
      "backdrop-filter": [{
        "backdrop-filter": [
          // Deprecated since Tailwind CSS v3.0.0
          "",
          "none",
          isArbitraryVariable,
          isArbitraryValue
        ]
      }],
      /**
       * Backdrop Blur
       * @see https://tailwindcss.com/docs/backdrop-blur
       */
      "backdrop-blur": [{
        "backdrop-blur": scaleBlur()
      }],
      /**
       * Backdrop Brightness
       * @see https://tailwindcss.com/docs/backdrop-brightness
       */
      "backdrop-brightness": [{
        "backdrop-brightness": [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Backdrop Contrast
       * @see https://tailwindcss.com/docs/backdrop-contrast
       */
      "backdrop-contrast": [{
        "backdrop-contrast": [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Backdrop Grayscale
       * @see https://tailwindcss.com/docs/backdrop-grayscale
       */
      "backdrop-grayscale": [{
        "backdrop-grayscale": ["", isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Backdrop Hue Rotate
       * @see https://tailwindcss.com/docs/backdrop-hue-rotate
       */
      "backdrop-hue-rotate": [{
        "backdrop-hue-rotate": [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Backdrop Invert
       * @see https://tailwindcss.com/docs/backdrop-invert
       */
      "backdrop-invert": [{
        "backdrop-invert": ["", isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Backdrop Opacity
       * @see https://tailwindcss.com/docs/backdrop-opacity
       */
      "backdrop-opacity": [{
        "backdrop-opacity": [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Backdrop Saturate
       * @see https://tailwindcss.com/docs/backdrop-saturate
       */
      "backdrop-saturate": [{
        "backdrop-saturate": [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Backdrop Sepia
       * @see https://tailwindcss.com/docs/backdrop-sepia
       */
      "backdrop-sepia": [{
        "backdrop-sepia": ["", isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      // --------------
      // --- Tables ---
      // --------------
      /**
       * Border Collapse
       * @see https://tailwindcss.com/docs/border-collapse
       */
      "border-collapse": [{
        border: ["collapse", "separate"]
      }],
      /**
       * Border Spacing
       * @see https://tailwindcss.com/docs/border-spacing
       */
      "border-spacing": [{
        "border-spacing": scaleUnambiguousSpacing()
      }],
      /**
       * Border Spacing X
       * @see https://tailwindcss.com/docs/border-spacing
       */
      "border-spacing-x": [{
        "border-spacing-x": scaleUnambiguousSpacing()
      }],
      /**
       * Border Spacing Y
       * @see https://tailwindcss.com/docs/border-spacing
       */
      "border-spacing-y": [{
        "border-spacing-y": scaleUnambiguousSpacing()
      }],
      /**
       * Table Layout
       * @see https://tailwindcss.com/docs/table-layout
       */
      "table-layout": [{
        table: ["auto", "fixed"]
      }],
      /**
       * Caption Side
       * @see https://tailwindcss.com/docs/caption-side
       */
      caption: [{
        caption: ["top", "bottom"]
      }],
      // ---------------------------------
      // --- Transitions and Animation ---
      // ---------------------------------
      /**
       * Transition Property
       * @see https://tailwindcss.com/docs/transition-property
       */
      transition: [{
        transition: ["", "all", "colors", "opacity", "shadow", "transform", "none", isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Transition Behavior
       * @see https://tailwindcss.com/docs/transition-behavior
       */
      "transition-behavior": [{
        transition: ["normal", "discrete"]
      }],
      /**
       * Transition Duration
       * @see https://tailwindcss.com/docs/transition-duration
       */
      duration: [{
        duration: [isNumber$3, "initial", isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Transition Timing Function
       * @see https://tailwindcss.com/docs/transition-timing-function
       */
      ease: [{
        ease: ["linear", "initial", themeEase, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Transition Delay
       * @see https://tailwindcss.com/docs/transition-delay
       */
      delay: [{
        delay: [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Animation
       * @see https://tailwindcss.com/docs/animation
       */
      animate: [{
        animate: ["none", themeAnimate, isArbitraryVariable, isArbitraryValue]
      }],
      // ------------------
      // --- Transforms ---
      // ------------------
      /**
       * Backface Visibility
       * @see https://tailwindcss.com/docs/backface-visibility
       */
      backface: [{
        backface: ["hidden", "visible"]
      }],
      /**
       * Perspective
       * @see https://tailwindcss.com/docs/perspective
       */
      perspective: [{
        perspective: [themePerspective, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Perspective Origin
       * @see https://tailwindcss.com/docs/perspective-origin
       */
      "perspective-origin": [{
        "perspective-origin": scaleOrigin()
      }],
      /**
       * Rotate
       * @see https://tailwindcss.com/docs/rotate
       */
      rotate: [{
        rotate: scaleRotate()
      }],
      /**
       * Rotate X
       * @see https://tailwindcss.com/docs/rotate
       */
      "rotate-x": [{
        "rotate-x": scaleRotate()
      }],
      /**
       * Rotate Y
       * @see https://tailwindcss.com/docs/rotate
       */
      "rotate-y": [{
        "rotate-y": scaleRotate()
      }],
      /**
       * Rotate Z
       * @see https://tailwindcss.com/docs/rotate
       */
      "rotate-z": [{
        "rotate-z": scaleRotate()
      }],
      /**
       * Scale
       * @see https://tailwindcss.com/docs/scale
       */
      scale: [{
        scale: scaleScale()
      }],
      /**
       * Scale X
       * @see https://tailwindcss.com/docs/scale
       */
      "scale-x": [{
        "scale-x": scaleScale()
      }],
      /**
       * Scale Y
       * @see https://tailwindcss.com/docs/scale
       */
      "scale-y": [{
        "scale-y": scaleScale()
      }],
      /**
       * Scale Z
       * @see https://tailwindcss.com/docs/scale
       */
      "scale-z": [{
        "scale-z": scaleScale()
      }],
      /**
       * Scale 3D
       * @see https://tailwindcss.com/docs/scale
       */
      "scale-3d": ["scale-3d"],
      /**
       * Skew
       * @see https://tailwindcss.com/docs/skew
       */
      skew: [{
        skew: scaleSkew()
      }],
      /**
       * Skew X
       * @see https://tailwindcss.com/docs/skew
       */
      "skew-x": [{
        "skew-x": scaleSkew()
      }],
      /**
       * Skew Y
       * @see https://tailwindcss.com/docs/skew
       */
      "skew-y": [{
        "skew-y": scaleSkew()
      }],
      /**
       * Transform
       * @see https://tailwindcss.com/docs/transform
       */
      transform: [{
        transform: [isArbitraryVariable, isArbitraryValue, "", "none", "gpu", "cpu"]
      }],
      /**
       * Transform Origin
       * @see https://tailwindcss.com/docs/transform-origin
       */
      "transform-origin": [{
        origin: scaleOrigin()
      }],
      /**
       * Transform Style
       * @see https://tailwindcss.com/docs/transform-style
       */
      "transform-style": [{
        transform: ["3d", "flat"]
      }],
      /**
       * Translate
       * @see https://tailwindcss.com/docs/translate
       */
      translate: [{
        translate: scaleTranslate()
      }],
      /**
       * Translate X
       * @see https://tailwindcss.com/docs/translate
       */
      "translate-x": [{
        "translate-x": scaleTranslate()
      }],
      /**
       * Translate Y
       * @see https://tailwindcss.com/docs/translate
       */
      "translate-y": [{
        "translate-y": scaleTranslate()
      }],
      /**
       * Translate Z
       * @see https://tailwindcss.com/docs/translate
       */
      "translate-z": [{
        "translate-z": scaleTranslate()
      }],
      /**
       * Translate None
       * @see https://tailwindcss.com/docs/translate
       */
      "translate-none": ["translate-none"],
      // ---------------------
      // --- Interactivity ---
      // ---------------------
      /**
       * Accent Color
       * @see https://tailwindcss.com/docs/accent-color
       */
      accent: [{
        accent: scaleColor()
      }],
      /**
       * Appearance
       * @see https://tailwindcss.com/docs/appearance
       */
      appearance: [{
        appearance: ["none", "auto"]
      }],
      /**
       * Caret Color
       * @see https://tailwindcss.com/docs/just-in-time-mode#caret-color-utilities
       */
      "caret-color": [{
        caret: scaleColor()
      }],
      /**
       * Color Scheme
       * @see https://tailwindcss.com/docs/color-scheme
       */
      "color-scheme": [{
        scheme: ["normal", "dark", "light", "light-dark", "only-dark", "only-light"]
      }],
      /**
       * Cursor
       * @see https://tailwindcss.com/docs/cursor
       */
      cursor: [{
        cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out", isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Field Sizing
       * @see https://tailwindcss.com/docs/field-sizing
       */
      "field-sizing": [{
        "field-sizing": ["fixed", "content"]
      }],
      /**
       * Pointer Events
       * @see https://tailwindcss.com/docs/pointer-events
       */
      "pointer-events": [{
        "pointer-events": ["auto", "none"]
      }],
      /**
       * Resize
       * @see https://tailwindcss.com/docs/resize
       */
      resize: [{
        resize: ["none", "", "y", "x"]
      }],
      /**
       * Scroll Behavior
       * @see https://tailwindcss.com/docs/scroll-behavior
       */
      "scroll-behavior": [{
        scroll: ["auto", "smooth"]
      }],
      /**
       * Scroll Margin
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-m": [{
        "scroll-m": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Margin X
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-mx": [{
        "scroll-mx": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Margin Y
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-my": [{
        "scroll-my": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Margin Start
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-ms": [{
        "scroll-ms": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Margin End
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-me": [{
        "scroll-me": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Margin Top
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-mt": [{
        "scroll-mt": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Margin Right
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-mr": [{
        "scroll-mr": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Margin Bottom
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-mb": [{
        "scroll-mb": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Margin Left
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-ml": [{
        "scroll-ml": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Padding
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-p": [{
        "scroll-p": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Padding X
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-px": [{
        "scroll-px": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Padding Y
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-py": [{
        "scroll-py": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Padding Start
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-ps": [{
        "scroll-ps": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Padding End
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pe": [{
        "scroll-pe": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Padding Top
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pt": [{
        "scroll-pt": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Padding Right
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pr": [{
        "scroll-pr": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Padding Bottom
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pb": [{
        "scroll-pb": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Padding Left
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pl": [{
        "scroll-pl": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Snap Align
       * @see https://tailwindcss.com/docs/scroll-snap-align
       */
      "snap-align": [{
        snap: ["start", "end", "center", "align-none"]
      }],
      /**
       * Scroll Snap Stop
       * @see https://tailwindcss.com/docs/scroll-snap-stop
       */
      "snap-stop": [{
        snap: ["normal", "always"]
      }],
      /**
       * Scroll Snap Type
       * @see https://tailwindcss.com/docs/scroll-snap-type
       */
      "snap-type": [{
        snap: ["none", "x", "y", "both"]
      }],
      /**
       * Scroll Snap Type Strictness
       * @see https://tailwindcss.com/docs/scroll-snap-type
       */
      "snap-strictness": [{
        snap: ["mandatory", "proximity"]
      }],
      /**
       * Touch Action
       * @see https://tailwindcss.com/docs/touch-action
       */
      touch: [{
        touch: ["auto", "none", "manipulation"]
      }],
      /**
       * Touch Action X
       * @see https://tailwindcss.com/docs/touch-action
       */
      "touch-x": [{
        "touch-pan": ["x", "left", "right"]
      }],
      /**
       * Touch Action Y
       * @see https://tailwindcss.com/docs/touch-action
       */
      "touch-y": [{
        "touch-pan": ["y", "up", "down"]
      }],
      /**
       * Touch Action Pinch Zoom
       * @see https://tailwindcss.com/docs/touch-action
       */
      "touch-pz": ["touch-pinch-zoom"],
      /**
       * User Select
       * @see https://tailwindcss.com/docs/user-select
       */
      select: [{
        select: ["none", "text", "all", "auto"]
      }],
      /**
       * Will Change
       * @see https://tailwindcss.com/docs/will-change
       */
      "will-change": [{
        "will-change": ["auto", "scroll", "contents", "transform", isArbitraryVariable, isArbitraryValue]
      }],
      // -----------
      // --- SVG ---
      // -----------
      /**
       * Fill
       * @see https://tailwindcss.com/docs/fill
       */
      fill: [{
        fill: ["none", ...scaleColor()]
      }],
      /**
       * Stroke Width
       * @see https://tailwindcss.com/docs/stroke-width
       */
      "stroke-w": [{
        stroke: [isNumber$3, isArbitraryVariableLength, isArbitraryLength, isArbitraryNumber]
      }],
      /**
       * Stroke
       * @see https://tailwindcss.com/docs/stroke
       */
      stroke: [{
        stroke: ["none", ...scaleColor()]
      }],
      // ---------------------
      // --- Accessibility ---
      // ---------------------
      /**
       * Forced Color Adjust
       * @see https://tailwindcss.com/docs/forced-color-adjust
       */
      "forced-color-adjust": [{
        "forced-color-adjust": ["auto", "none"]
      }]
    },
    conflictingClassGroups: {
      overflow: ["overflow-x", "overflow-y"],
      overscroll: ["overscroll-x", "overscroll-y"],
      inset: ["inset-x", "inset-y", "start", "end", "top", "right", "bottom", "left"],
      "inset-x": ["right", "left"],
      "inset-y": ["top", "bottom"],
      flex: ["basis", "grow", "shrink"],
      gap: ["gap-x", "gap-y"],
      p: ["px", "py", "ps", "pe", "pt", "pr", "pb", "pl"],
      px: ["pr", "pl"],
      py: ["pt", "pb"],
      m: ["mx", "my", "ms", "me", "mt", "mr", "mb", "ml"],
      mx: ["mr", "ml"],
      my: ["mt", "mb"],
      size: ["w", "h"],
      "font-size": ["leading"],
      "fvn-normal": ["fvn-ordinal", "fvn-slashed-zero", "fvn-figure", "fvn-spacing", "fvn-fraction"],
      "fvn-ordinal": ["fvn-normal"],
      "fvn-slashed-zero": ["fvn-normal"],
      "fvn-figure": ["fvn-normal"],
      "fvn-spacing": ["fvn-normal"],
      "fvn-fraction": ["fvn-normal"],
      "line-clamp": ["display", "overflow"],
      rounded: ["rounded-s", "rounded-e", "rounded-t", "rounded-r", "rounded-b", "rounded-l", "rounded-ss", "rounded-se", "rounded-ee", "rounded-es", "rounded-tl", "rounded-tr", "rounded-br", "rounded-bl"],
      "rounded-s": ["rounded-ss", "rounded-es"],
      "rounded-e": ["rounded-se", "rounded-ee"],
      "rounded-t": ["rounded-tl", "rounded-tr"],
      "rounded-r": ["rounded-tr", "rounded-br"],
      "rounded-b": ["rounded-br", "rounded-bl"],
      "rounded-l": ["rounded-tl", "rounded-bl"],
      "border-spacing": ["border-spacing-x", "border-spacing-y"],
      "border-w": ["border-w-s", "border-w-e", "border-w-t", "border-w-r", "border-w-b", "border-w-l"],
      "border-w-x": ["border-w-r", "border-w-l"],
      "border-w-y": ["border-w-t", "border-w-b"],
      "border-color": ["border-color-s", "border-color-e", "border-color-t", "border-color-r", "border-color-b", "border-color-l"],
      "border-color-x": ["border-color-r", "border-color-l"],
      "border-color-y": ["border-color-t", "border-color-b"],
      translate: ["translate-x", "translate-y", "translate-none"],
      "translate-none": ["translate", "translate-x", "translate-y", "translate-z"],
      "scroll-m": ["scroll-mx", "scroll-my", "scroll-ms", "scroll-me", "scroll-mt", "scroll-mr", "scroll-mb", "scroll-ml"],
      "scroll-mx": ["scroll-mr", "scroll-ml"],
      "scroll-my": ["scroll-mt", "scroll-mb"],
      "scroll-p": ["scroll-px", "scroll-py", "scroll-ps", "scroll-pe", "scroll-pt", "scroll-pr", "scroll-pb", "scroll-pl"],
      "scroll-px": ["scroll-pr", "scroll-pl"],
      "scroll-py": ["scroll-pt", "scroll-pb"],
      touch: ["touch-x", "touch-y", "touch-pz"],
      "touch-x": ["touch"],
      "touch-y": ["touch"],
      "touch-pz": ["touch"]
    },
    conflictingClassGroupModifiers: {
      "font-size": ["leading"]
    },
    orderSensitiveModifiers: ["before", "after", "placeholder", "file", "marker", "selection", "first-line", "first-letter", "backdrop", "*", "**"]
  };
};
const mergeConfigs$1 = (baseConfig2, {
  cacheSize,
  prefix,
  experimentalParseClassName,
  extend: extend4 = {},
  override = {}
}) => {
  overrideProperty(baseConfig2, "cacheSize", cacheSize);
  overrideProperty(baseConfig2, "prefix", prefix);
  overrideProperty(baseConfig2, "experimentalParseClassName", experimentalParseClassName);
  overrideConfigProperties(baseConfig2.theme, override.theme);
  overrideConfigProperties(baseConfig2.classGroups, override.classGroups);
  overrideConfigProperties(baseConfig2.conflictingClassGroups, override.conflictingClassGroups);
  overrideConfigProperties(baseConfig2.conflictingClassGroupModifiers, override.conflictingClassGroupModifiers);
  overrideProperty(baseConfig2, "orderSensitiveModifiers", override.orderSensitiveModifiers);
  mergeConfigProperties(baseConfig2.theme, extend4.theme);
  mergeConfigProperties(baseConfig2.classGroups, extend4.classGroups);
  mergeConfigProperties(baseConfig2.conflictingClassGroups, extend4.conflictingClassGroups);
  mergeConfigProperties(baseConfig2.conflictingClassGroupModifiers, extend4.conflictingClassGroupModifiers);
  mergeArrayProperties(baseConfig2, extend4, "orderSensitiveModifiers");
  return baseConfig2;
};
const overrideProperty = (baseObject, overrideKey, overrideValue) => {
  if (overrideValue !== void 0) {
    baseObject[overrideKey] = overrideValue;
  }
};
const overrideConfigProperties = (baseObject, overrideObject) => {
  if (overrideObject) {
    for (const key in overrideObject) {
      overrideProperty(baseObject, key, overrideObject[key]);
    }
  }
};
const mergeConfigProperties = (baseObject, mergeObject) => {
  if (mergeObject) {
    for (const key in mergeObject) {
      mergeArrayProperties(baseObject, mergeObject, key);
    }
  }
};
const mergeArrayProperties = (baseObject, mergeObject, key) => {
  const mergeValue = mergeObject[key];
  if (mergeValue !== void 0) {
    baseObject[key] = baseObject[key] ? baseObject[key].concat(mergeValue) : mergeValue;
  }
};
const extendTailwindMerge = (configExtension, ...createConfig) => typeof configExtension === "function" ? createTailwindMerge(getDefaultConfig, configExtension, ...createConfig) : createTailwindMerge(() => mergeConfigs$1(getDefaultConfig(), configExtension), ...createConfig);
const twMerge$1 = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
var ie = { twMerge: true, twMergeConfig: {}, responsiveVariants: false }, x$5 = (s2) => s2 || void 0, N$3 = (...s2) => x$5(y$5(s2).filter(Boolean).join(" ")), R$3 = null, v$4 = {}, q$3 = false, M$4 = (...s2) => (b$12) => b$12.twMerge ? ((!R$3 || q$3) && (q$3 = false, R$3 = u$6(v$4) ? twMerge$1 : extendTailwindMerge({ ...v$4, extend: { theme: v$4.theme, classGroups: v$4.classGroups, conflictingClassGroupModifiers: v$4.conflictingClassGroupModifiers, conflictingClassGroups: v$4.conflictingClassGroups, ...v$4.extend } })), x$5(R$3(N$3(s2)))) : N$3(s2), _$3 = (s2, b2) => {
  for (let e2 in b2)
    s2.hasOwnProperty(e2) ? s2[e2] = N$3(s2[e2], b2[e2]) : s2[e2] = b2[e2];
  return s2;
}, ce = (s2, b$12) => {
  let { extend: e2 = null, slots: O2 = {}, variants: U2 = {}, compoundVariants: W2 = [], compoundSlots: C2 = [], defaultVariants: z2 = {} } = s2, m2 = { ...ie, ...b$12 }, k2 = e2 != null && e2.base ? N$3(e2.base, s2 == null ? void 0 : s2.base) : s2 == null ? void 0 : s2.base, g$12 = e2 != null && e2.variants && !u$6(e2.variants) ? p$6(U2, e2.variants) : U2, w2 = e2 != null && e2.defaultVariants && !u$6(e2.defaultVariants) ? { ...e2.defaultVariants, ...z2 } : z2;
  !u$6(m2.twMergeConfig) && !x$6(m2.twMergeConfig, v$4) && (q$3 = true, v$4 = m2.twMergeConfig);
  let S2 = u$6(e2 == null ? void 0 : e2.slots), T2 = u$6(O2) ? {} : { base: N$3(s2 == null ? void 0 : s2.base, S2 && (e2 == null ? void 0 : e2.base)), ...O2 }, j2 = S2 ? T2 : _$3({ ...e2 == null ? void 0 : e2.slots }, u$6(T2) ? { base: s2 == null ? void 0 : s2.base } : T2), h$12 = u$6(e2 == null ? void 0 : e2.compoundVariants) ? W2 : a$3(e2 == null ? void 0 : e2.compoundVariants, W2), V3 = (l2) => {
    if (u$6(g$12) && u$6(O2) && S2)
      return M$4(k2, l2 == null ? void 0 : l2.class, l2 == null ? void 0 : l2.className)(m2);
    if (h$12 && !Array.isArray(h$12))
      throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof h$12}`);
    if (C2 && !Array.isArray(C2))
      throw new TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof C2}`);
    let P2 = (a2, n2, t2 = [], i2) => {
      let r2 = t2;
      if (typeof n2 == "string")
        r2 = r2.concat(g$4(n2).split(" ").map((o2) => `${a2}:${o2}`));
      else if (Array.isArray(n2))
        r2 = r2.concat(n2.reduce((o2, c2) => o2.concat(`${a2}:${c2}`), []));
      else if (typeof n2 == "object" && typeof i2 == "string") {
        for (let o2 in n2)
          if (n2.hasOwnProperty(o2) && o2 === i2) {
            let c2 = n2[o2];
            if (c2 && typeof c2 == "string") {
              let u2 = g$4(c2);
              r2[i2] ? r2[i2] = r2[i2].concat(u2.split(" ").map((f2) => `${a2}:${f2}`)) : r2[i2] = u2.split(" ").map((f2) => `${a2}:${f2}`);
            } else
              Array.isArray(c2) && c2.length > 0 && (r2[i2] = c2.reduce((u2, f2) => u2.concat(`${a2}:${f2}`), []));
          }
      }
      return r2;
    }, D2 = (a$12, n2 = g$12, t2 = null, i2 = null) => {
      var L2;
      let r2 = n2[a$12];
      if (!r2 || u$6(r2))
        return null;
      let o2 = (L2 = i2 == null ? void 0 : i2[a$12]) != null ? L2 : l2 == null ? void 0 : l2[a$12];
      if (o2 === null)
        return null;
      let c2 = l$8(o2), u2 = Array.isArray(m2.responsiveVariants) && m2.responsiveVariants.length > 0 || m2.responsiveVariants === true, f2 = w2 == null ? void 0 : w2[a$12], d2 = [];
      if (typeof c2 == "object" && u2)
        for (let [E2, Q2] of Object.entries(c2)) {
          let ne2 = r2[Q2];
          if (E2 === "initial") {
            f2 = Q2;
            continue;
          }
          Array.isArray(m2.responsiveVariants) && !m2.responsiveVariants.includes(E2) || (d2 = P2(E2, ne2, d2, t2));
        }
      let $ = c2 != null && typeof c2 != "object" ? c2 : l$8(f2), A2 = r2[$ || "false"];
      return typeof d2 == "object" && typeof t2 == "string" && d2[t2] ? _$3(d2, A2) : d2.length > 0 ? (d2.push(A2), t2 === "base" ? d2.join(" ") : d2) : A2;
    }, p2 = () => g$12 ? Object.keys(g$12).map((a2) => D2(a2, g$12)) : null, ee2 = (a2, n2) => {
      if (!g$12 || typeof g$12 != "object")
        return null;
      let t2 = new Array();
      for (let i2 in g$12) {
        let r2 = D2(i2, g$12, a2, n2), o2 = a2 === "base" && typeof r2 == "string" ? r2 : r2 && r2[a2];
        o2 && (t2[t2.length] = o2);
      }
      return t2;
    }, H2 = {};
    for (let a2 in l2)
      l2[a2] !== void 0 && (H2[a2] = l2[a2]);
    let I2 = (a2, n2) => {
      var i2;
      let t2 = typeof (l2 == null ? void 0 : l2[a2]) == "object" ? { [a2]: (i2 = l2[a2]) == null ? void 0 : i2.initial } : {};
      return { ...w2, ...H2, ...t2, ...n2 };
    }, J2 = (a2 = [], n2) => {
      let t2 = [];
      for (let { class: i2, className: r2, ...o2 } of a2) {
        let c2 = true;
        for (let [u2, f2] of Object.entries(o2)) {
          let d2 = I2(u2, n2)[u2];
          if (Array.isArray(f2)) {
            if (!f2.includes(d2)) {
              c2 = false;
              break;
            }
          } else {
            let $ = (A2) => A2 == null || A2 === false;
            if ($(f2) && $(d2))
              continue;
            if (d2 !== f2) {
              c2 = false;
              break;
            }
          }
        }
        c2 && (i2 && t2.push(i2), r2 && t2.push(r2));
      }
      return t2;
    }, te2 = (a2) => {
      let n2 = J2(h$12, a2);
      if (!Array.isArray(n2))
        return n2;
      let t2 = {};
      for (let i2 of n2)
        if (typeof i2 == "string" && (t2.base = M$4(t2.base, i2)(m2)), typeof i2 == "object")
          for (let [r2, o2] of Object.entries(i2))
            t2[r2] = M$4(t2[r2], o2)(m2);
      return t2;
    }, ae2 = (a2) => {
      if (C2.length < 1)
        return null;
      let n2 = {};
      for (let { slots: t2 = [], class: i2, className: r2, ...o2 } of C2) {
        if (!u$6(o2)) {
          let c2 = true;
          for (let u2 of Object.keys(o2)) {
            let f2 = I2(u2, a2)[u2];
            if (f2 === void 0 || (Array.isArray(o2[u2]) ? !o2[u2].includes(f2) : o2[u2] !== f2)) {
              c2 = false;
              break;
            }
          }
          if (!c2)
            continue;
        }
        for (let c2 of t2)
          n2[c2] = n2[c2] || [], n2[c2].push([i2, r2]);
      }
      return n2;
    };
    if (!u$6(O2) || !S2) {
      let a2 = {};
      if (typeof j2 == "object" && !u$6(j2))
        for (let n2 of Object.keys(j2))
          a2[n2] = (t2) => {
            var i2, r2;
            return M$4(j2[n2], ee2(n2, t2), ((i2 = te2(t2)) != null ? i2 : [])[n2], ((r2 = ae2(t2)) != null ? r2 : [])[n2], t2 == null ? void 0 : t2.class, t2 == null ? void 0 : t2.className)(m2);
          };
      return a2;
    }
    return M$4(k2, p2(), J2(h$12), l2 == null ? void 0 : l2.class, l2 == null ? void 0 : l2.className)(m2);
  }, K2 = () => {
    if (!(!g$12 || typeof g$12 != "object"))
      return Object.keys(g$12);
  };
  return V3.variantKeys = K2(), V3.extend = e2, V3.base = k2, V3.slots = j2, V3.variants = g$12, V3.defaultVariants = w2, V3.compoundSlots = C2, V3.compoundVariants = h$12, V3;
};
var tv = (options, config2) => {
  var _a2, _b2, _c2;
  return ce(options, {
    ...config2,
    twMerge: (_a2 = config2 == null ? void 0 : config2.twMerge) != null ? _a2 : true,
    twMergeConfig: {
      ...config2 == null ? void 0 : config2.twMergeConfig,
      theme: {
        ...(_b2 = config2 == null ? void 0 : config2.twMergeConfig) == null ? void 0 : _b2.theme,
        ...twMergeConfig.theme
      },
      classGroups: {
        ...(_c2 = config2 == null ? void 0 : config2.twMergeConfig) == null ? void 0 : _c2.classGroups,
        ...twMergeConfig.classGroups
      }
    }
  });
};
var snippet = tv({
  slots: {
    base: "inline-flex items-center justify-between h-fit rounded-large gap-2",
    pre: "bg-transparent text-inherit font-mono font-normal inline-block whitespace-nowrap",
    content: "flex flex-col",
    symbol: "select-none",
    copyButton: [
      "group",
      "relative",
      "z-10",
      "text-large",
      "text-inherit",
      "data-[hover=true]:bg-transparent"
    ],
    copyIcon: [
      "absolute text-inherit opacity-100 scale-100 group-data-[copied=true]:opacity-0 group-data-[copied=true]:scale-50"
    ],
    checkIcon: [
      "absolute text-inherit opacity-0 scale-50 group-data-[copied=true]:opacity-100 group-data-[copied=true]:scale-100"
    ]
  },
  variants: {
    variant: {
      flat: "",
      solid: "",
      bordered: "border-medium bg-transparent",
      shadow: ""
    },
    color: {
      default: {},
      primary: {},
      secondary: {},
      success: {},
      warning: {},
      danger: {}
    },
    size: {
      sm: {
        base: "px-1.5 py-0.5 text-tiny rounded-small"
      },
      md: {
        base: "px-3 py-1.5 text-small rounded-medium"
      },
      lg: {
        base: "px-4 py-2 text-medium rounded-large"
      }
    },
    radius: {
      none: {
        base: "rounded-none"
      },
      sm: {
        base: "rounded-small"
      },
      md: {
        base: "rounded-medium"
      },
      lg: {
        base: "rounded-large"
      }
    },
    fullWidth: {
      true: {
        base: "w-full"
      }
    },
    disableAnimation: {
      true: {},
      false: {
        copyIcon: "transition-transform-opacity",
        checkIcon: "transition-transform-opacity"
      }
    }
  },
  defaultVariants: {
    color: "default",
    variant: "flat",
    size: "md",
    fullWidth: false
  },
  compoundVariants: [
    // solid - shadow / color
    {
      variant: ["solid", "shadow"],
      color: "default",
      class: {
        copyButton: "data-[focus-visible]:outline-default-foreground"
      }
    },
    {
      variant: ["solid", "shadow"],
      color: "primary",
      class: {
        copyButton: "data-[focus-visible]:outline-primary-foreground"
      }
    },
    {
      variant: ["solid", "shadow"],
      color: "secondary",
      class: {
        copyButton: "data-[focus-visible]:outline-secondary-foreground"
      }
    },
    {
      variant: ["solid", "shadow"],
      color: "success",
      class: {
        copyButton: "data-[focus-visible]:outline-success-foreground"
      }
    },
    {
      variant: ["solid", "shadow"],
      color: "warning",
      class: {
        copyButton: "data-[focus-visible]:outline-warning-foreground"
      }
    },
    {
      variant: ["solid", "shadow"],
      color: "danger",
      class: {
        copyButton: "data-[focus-visible]:outline-danger-foreground"
      }
    },
    // flat / color
    {
      variant: "flat",
      color: "default",
      class: {
        base: colorVariants.flat.default
      }
    },
    {
      variant: "flat",
      color: "primary",
      class: {
        base: colorVariants.flat.primary
      }
    },
    {
      variant: "flat",
      color: "secondary",
      class: {
        base: colorVariants.flat.secondary
      }
    },
    {
      variant: "flat",
      color: "success",
      class: {
        base: colorVariants.flat.success
      }
    },
    {
      variant: "flat",
      color: "warning",
      class: {
        base: colorVariants.flat.warning
      }
    },
    {
      variant: "flat",
      color: "danger",
      class: {
        base: colorVariants.flat.danger
      }
    },
    // solid / color
    {
      variant: "solid",
      color: "default",
      class: {
        base: colorVariants.solid.default
      }
    },
    {
      variant: "solid",
      color: "primary",
      class: {
        base: colorVariants.solid.primary
      }
    },
    {
      variant: "solid",
      color: "secondary",
      class: {
        base: colorVariants.solid.secondary
      }
    },
    {
      variant: "solid",
      color: "success",
      class: {
        base: colorVariants.solid.success
      }
    },
    {
      variant: "solid",
      color: "warning",
      class: {
        base: colorVariants.solid.warning
      }
    },
    {
      variant: "solid",
      color: "danger",
      class: {
        base: colorVariants.solid.danger
      }
    },
    // shadow / color
    {
      variant: "shadow",
      color: "default",
      class: {
        base: colorVariants.shadow.default
      }
    },
    {
      variant: "shadow",
      color: "primary",
      class: {
        base: colorVariants.shadow.primary
      }
    },
    {
      variant: "shadow",
      color: "secondary",
      class: {
        base: colorVariants.shadow.secondary
      }
    },
    {
      variant: "shadow",
      color: "success",
      class: {
        base: colorVariants.shadow.success
      }
    },
    {
      variant: "shadow",
      color: "warning",
      class: {
        base: colorVariants.shadow.warning
      }
    },
    {
      variant: "shadow",
      color: "danger",
      class: {
        base: colorVariants.shadow.danger
      }
    },
    // bordered / color
    {
      variant: "bordered",
      color: "default",
      class: {
        base: colorVariants.bordered.default
      }
    },
    {
      variant: "bordered",
      color: "primary",
      class: {
        base: colorVariants.bordered.primary
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        base: colorVariants.bordered.secondary
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        base: colorVariants.bordered.success
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        base: colorVariants.bordered.warning
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        base: colorVariants.bordered.danger
      }
    }
  ]
});
var spacer = tv({
  base: "w-px h-px inline-block",
  variants: {
    isInline: {
      true: "inline-block",
      false: "block"
    }
  },
  defaultVariants: {
    isInline: false
  }
});
var spinner = tv({
  slots: {
    base: "relative inline-flex flex-col gap-2 items-center justify-center",
    wrapper: "relative flex",
    label: "text-foreground dark:text-foreground-dark font-regular",
    circle1: "absolute w-full h-full rounded-full",
    circle2: "absolute w-full h-full rounded-full",
    dots: "relative rounded-full mx-auto",
    spinnerBars: [
      "absolute",
      "animate-fade-out",
      "rounded-full",
      "w-[25%]",
      "h-[8%]",
      "left-[calc(37.5%)]",
      "top-[calc(46%)]",
      "spinner-bar-animation"
    ]
  },
  variants: {
    size: {
      sm: {
        wrapper: "w-5 h-5",
        circle1: "border-2",
        circle2: "border-2",
        dots: "size-1",
        label: "text-small"
      },
      md: {
        wrapper: "w-8 h-8",
        circle1: "border-3",
        circle2: "border-3",
        dots: "size-1.5",
        label: "text-medium"
      },
      lg: {
        wrapper: "w-10 h-10",
        circle1: "border-3",
        circle2: "border-3",
        dots: "size-2",
        label: "text-large"
      }
    },
    color: {
      current: {
        circle1: "border-b-current",
        circle2: "border-b-current",
        dots: "bg-current",
        spinnerBars: "bg-current"
      },
      white: {
        circle1: "border-b-white",
        circle2: "border-b-white",
        dots: "bg-white",
        spinnerBars: "bg-white"
      },
      default: {
        circle1: "border-b-default",
        circle2: "border-b-default",
        dots: "bg-default",
        spinnerBars: "bg-default"
      },
      primary: {
        circle1: "border-b-primary",
        circle2: "border-b-primary",
        dots: "bg-primary",
        spinnerBars: "bg-primary"
      },
      secondary: {
        circle1: "border-b-secondary",
        circle2: "border-b-secondary",
        dots: "bg-secondary",
        spinnerBars: "bg-secondary"
      },
      success: {
        circle1: "border-b-success",
        circle2: "border-b-success",
        dots: "bg-success",
        spinnerBars: "bg-success"
      },
      warning: {
        circle1: "border-b-warning",
        circle2: "border-b-warning",
        dots: "bg-warning",
        spinnerBars: "bg-warning"
      },
      danger: {
        circle1: "border-b-danger",
        circle2: "border-b-danger",
        dots: "bg-danger",
        spinnerBars: "bg-danger"
      }
    },
    labelColor: {
      foreground: {
        label: "text-foreground"
      },
      primary: {
        label: "text-primary"
      },
      secondary: {
        label: "text-secondary"
      },
      success: {
        label: "text-success"
      },
      warning: {
        label: "text-warning"
      },
      danger: {
        label: "text-danger"
      }
    },
    variant: {
      default: {
        circle1: [
          "animate-spinner-ease-spin",
          "border-solid",
          "border-t-transparent",
          "border-l-transparent",
          "border-r-transparent"
        ],
        circle2: [
          "opacity-75",
          "animate-spinner-linear-spin",
          "border-dotted",
          "border-t-transparent",
          "border-l-transparent",
          "border-r-transparent"
        ]
      },
      gradient: {
        circle1: [
          "border-0",
          "bg-gradient-to-b",
          "from-transparent",
          "via-transparent",
          "to-primary",
          "animate-spinner-linear-spin",
          "[animation-duration:1s]",
          "[-webkit-mask:radial-gradient(closest-side,rgba(0,0,0,0.0)calc(100%-3px),rgba(0,0,0,1)calc(100%-3px))]"
        ],
        circle2: ["hidden"]
      },
      wave: {
        wrapper: "translate-y-3/4",
        dots: ["animate-sway", "spinner-dot-animation"]
      },
      dots: {
        wrapper: "translate-y-2/4",
        dots: ["animate-blink", "spinner-dot-blink-animation"]
      },
      spinner: {},
      simple: {
        wrapper: "text-foreground h-5 w-5 animate-spin",
        circle1: "opacity-25",
        circle2: "opacity-75"
      }
    }
  },
  defaultVariants: {
    size: "md",
    color: "primary",
    labelColor: "foreground",
    variant: "default"
  },
  compoundVariants: [
    { variant: "gradient", color: "current", class: { circle1: "to-current" } },
    { variant: "gradient", color: "white", class: { circle1: "to-white" } },
    { variant: "gradient", color: "default", class: { circle1: "to-default" } },
    { variant: "gradient", color: "primary", class: { circle1: "to-primary" } },
    { variant: "gradient", color: "secondary", class: { circle1: "to-secondary" } },
    { variant: "gradient", color: "success", class: { circle1: "to-success" } },
    { variant: "gradient", color: "warning", class: { circle1: "to-warning" } },
    { variant: "gradient", color: "danger", class: { circle1: "to-danger" } },
    {
      variant: "wave",
      size: "sm",
      class: {
        wrapper: "w-5 h-5"
      }
    },
    {
      variant: "wave",
      size: "md",
      class: {
        wrapper: "w-8 h-8"
      }
    },
    {
      variant: "wave",
      size: "lg",
      class: {
        wrapper: "w-12 h-12"
      }
    },
    {
      variant: "dots",
      size: "sm",
      class: {
        wrapper: "w-5 h-5"
      }
    },
    {
      variant: "dots",
      size: "md",
      class: {
        wrapper: "w-8 h-8"
      }
    },
    {
      variant: "dots",
      size: "lg",
      class: {
        wrapper: "w-12 h-12"
      }
    },
    // Simple variants
    // Size
    {
      variant: "simple",
      size: "sm",
      class: {
        wrapper: "w-5 h-5"
      }
    },
    {
      variant: "simple",
      size: "md",
      class: {
        wrapper: "w-8 h-8"
      }
    },
    {
      variant: "simple",
      size: "lg",
      class: {
        wrapper: "w-12 h-12"
      }
    },
    // Color
    {
      variant: "simple",
      color: "current",
      class: {
        wrapper: "text-current"
      }
    },
    {
      variant: "simple",
      color: "white",
      class: {
        wrapper: "text-white"
      }
    },
    {
      variant: "simple",
      color: "default",
      class: {
        wrapper: "text-default"
      }
    },
    {
      variant: "simple",
      color: "primary",
      class: {
        wrapper: "text-primary"
      }
    },
    {
      variant: "simple",
      color: "secondary",
      class: {
        wrapper: "text-secondary"
      }
    },
    {
      variant: "simple",
      color: "success",
      class: {
        wrapper: "text-success"
      }
    },
    {
      variant: "simple",
      color: "warning",
      class: {
        wrapper: "text-warning"
      }
    },
    {
      variant: "simple",
      color: "danger",
      class: {
        wrapper: "text-danger"
      }
    }
  ]
});
var dataFocusVisibleClasses = [
  "outline-hidden",
  "data-[focus-visible=true]:z-10",
  "data-[focus-visible=true]:outline-2",
  "data-[focus-visible=true]:outline-focus",
  "data-[focus-visible=true]:outline-offset-2"
];
var groupDataFocusVisibleClasses = [
  "outline-hidden",
  "group-data-[focus-visible=true]:z-10",
  "group-data-[focus-visible=true]:ring-2",
  "group-data-[focus-visible=true]:ring-focus",
  "group-data-[focus-visible=true]:ring-offset-2",
  "group-data-[focus-visible=true]:ring-offset-background"
];
var ringClasses = [
  "outline-hidden",
  "ring-2",
  "ring-focus",
  "ring-offset-2",
  "ring-offset-background"
];
var collapseAdjacentVariantBorders = {
  default: ["[&+.border-medium.border-default]:ms-[calc(var(--heroui-border-width-medium)*-1)]"],
  primary: ["[&+.border-medium.border-primary]:ms-[calc(var(--heroui-border-width-medium)*-1)]"],
  secondary: [
    "[&+.border-medium.border-secondary]:ms-[calc(var(--heroui-border-width-medium)*-1)]"
  ],
  success: ["[&+.border-medium.border-success]:ms-[calc(var(--heroui-border-width-medium)*-1)]"],
  warning: ["[&+.border-medium.border-warning]:ms-[calc(var(--heroui-border-width-medium)*-1)]"],
  danger: ["[&+.border-medium.border-danger]:ms-[calc(var(--heroui-border-width-medium)*-1)]"]
};
var hiddenInputClasses = [
  // Font styles
  "font-inherit",
  "text-[100%]",
  "leading-[1.15]",
  // Reset margins and padding
  "m-0",
  "p-0",
  // Overflow and box-sizing
  "overflow-visible",
  "box-border",
  // Positioning & Hit area
  "absolute",
  "top-0",
  "w-full",
  "h-full",
  // Opacity and z-index
  "opacity-[0.0001]",
  "z-[1]",
  // Cursor
  "cursor-pointer",
  // Disabled state
  "disabled:cursor-default"
];
var table$1 = tv({
  slots: {
    base: "flex flex-col relative gap-4",
    wrapper: [
      "p-4",
      "z-0",
      "flex",
      "flex-col",
      "relative",
      "justify-between",
      "gap-4",
      "shadow-small",
      "bg-content1",
      "overflow-auto"
    ],
    table: "min-w-full h-auto",
    thead: "[&>tr]:first:rounded-lg",
    tbody: "after:block",
    tr: ["group/tr", "outline-hidden", ...dataFocusVisibleClasses],
    th: [
      "group/th",
      "px-3",
      "h-10",
      "text-start",
      "align-middle",
      "bg-default-100",
      "whitespace-nowrap",
      "text-foreground-500",
      "text-tiny",
      "font-semibold",
      "first:rounded-s-lg",
      "last:rounded-e-lg",
      "outline-hidden",
      "data-[sortable=true]:cursor-pointer",
      "data-[hover=true]:text-foreground-400",
      ...dataFocusVisibleClasses
    ],
    td: [
      "py-2",
      "px-3",
      "relative",
      "align-middle",
      "whitespace-normal",
      "text-small",
      "font-normal",
      "outline-hidden",
      "[&>*]:z-1",
      "[&>*]:relative",
      ...dataFocusVisibleClasses,
      // before content for selection
      "before:pointer-events-none",
      "before:content-['']",
      "before:absolute",
      "before:z-0",
      "before:inset-0",
      "before:opacity-0",
      "data-[selected=true]:before:opacity-100",
      // disabled
      "group-data-[disabled=true]/tr:text-foreground-300",
      "group-data-[disabled=true]/tr:cursor-not-allowed"
    ],
    tfoot: "",
    sortIcon: [
      "ms-2",
      "mb-px",
      "opacity-0",
      "text-inherit",
      "inline-block",
      "transition-transform-opacity",
      "data-[visible=true]:opacity-100",
      "group-data-[hover=true]/th:opacity-100",
      "data-[direction=ascending]:rotate-180"
    ],
    emptyWrapper: "text-foreground-400 align-middle text-center h-40",
    loadingWrapper: "absolute inset-0 flex items-center justify-center"
  },
  variants: {
    color: {
      default: {
        td: "before:bg-default/60 data-[selected=true]:text-default-foreground"
      },
      primary: {
        td: "before:bg-primary/20 data-[selected=true]:text-primary"
      },
      secondary: {
        td: "before:bg-secondary/20 data-[selected=true]:text-secondary"
      },
      success: {
        td: "before:bg-success/20 data-[selected=true]:text-success-600 dark:data-[selected=true]:text-success"
      },
      warning: {
        td: "before:bg-warning/20 data-[selected=true]:text-warning-600 dark:data-[selected=true]:text-warning"
      },
      danger: {
        td: "before:bg-danger/20 data-[selected=true]:text-danger dark:data-[selected=true]:text-danger-500"
      }
    },
    layout: {
      auto: {
        table: "table-auto"
      },
      fixed: {
        table: "table-fixed"
      }
    },
    shadow: {
      none: {
        wrapper: "shadow-none"
      },
      sm: {
        wrapper: "shadow-small"
      },
      md: {
        wrapper: "shadow-medium"
      },
      lg: {
        wrapper: "shadow-large"
      }
    },
    hideHeader: {
      true: {
        thead: "hidden"
      }
    },
    isStriped: {
      true: {
        td: [
          "group-data-[odd=true]/tr:before:bg-default-100",
          "group-data-[odd=true]/tr:before:opacity-100",
          "group-data-[odd=true]/tr:before:-z-10"
        ]
      }
    },
    isCompact: {
      true: {
        td: "py-1"
      },
      false: {}
    },
    isHeaderSticky: {
      true: {
        thead: "sticky top-0 z-20 [&>tr]:first:shadow-small"
      }
    },
    isSelectable: {
      true: {
        tr: "cursor-default",
        td: [
          "group-aria-[selected=false]/tr:group-data-[hover=true]/tr:before:bg-default-100",
          "group-aria-[selected=false]/tr:group-data-[hover=true]/tr:before:opacity-70"
        ]
      }
    },
    isMultiSelectable: {
      true: {
        td: [
          // first
          "group-data-[first=true]/tr:first:before:rounded-ss-lg",
          "group-data-[first=true]/tr:last:before:rounded-se-lg",
          // middle
          "group-data-[middle=true]/tr:before:rounded-none",
          // last
          "group-data-[last=true]/tr:first:before:rounded-es-lg",
          "group-data-[last=true]/tr:last:before:rounded-ee-lg"
        ]
      },
      false: {
        td: ["first:before:rounded-s-lg", "last:before:rounded-e-lg"]
      }
    },
    radius: {
      none: {
        wrapper: "rounded-none",
        th: [
          "first:rounded-s-none",
          "first:before:rounded-s-none",
          "last:rounded-e-none",
          "last:before:rounded-e-none"
        ],
        td: [
          "first:before:rounded-s-none",
          "last:before:rounded-e-none",
          "group-data-[first=true]/tr:first:before:rounded-ss-none",
          "group-data-[first=true]/tr:last:before:rounded-se-none",
          "group-data-[last=true]/tr:first:before:rounded-es-none",
          "group-data-[last=true]/tr:last:before:rounded-ee-none"
        ]
      },
      sm: {
        wrapper: "rounded-small"
      },
      md: {
        wrapper: "rounded-medium"
      },
      lg: {
        wrapper: "rounded-large"
      }
    },
    fullWidth: {
      true: {
        base: "w-full",
        wrapper: "w-full",
        table: "w-full"
      }
    },
    align: {
      start: {
        th: "text-start",
        td: "text-start"
      },
      center: {
        th: "text-center",
        td: "text-center"
      },
      end: {
        th: "text-end",
        td: "text-end"
      }
    }
  },
  defaultVariants: {
    layout: "auto",
    shadow: "sm",
    radius: "lg",
    color: "default",
    isCompact: false,
    hideHeader: false,
    isStriped: false,
    fullWidth: true,
    align: "start"
  },
  compoundVariants: [
    {
      isStriped: true,
      color: "default",
      class: {
        td: "group-data-[odd=true]/tr:data-[selected=true]/tr:before:bg-default/60"
      }
    },
    {
      isStriped: true,
      color: "primary",
      class: {
        td: "group-data-[odd=true]/tr:data-[selected=true]/tr:before:bg-primary/20"
      }
    },
    {
      isStriped: true,
      color: "secondary",
      class: {
        td: "group-data-[odd=true]/tr:data-[selected=true]/tr:before:bg-secondary/20"
      }
    },
    {
      isStriped: true,
      color: "success",
      class: {
        td: "group-data-[odd=true]/tr:data-[selected=true]/tr:before:bg-success/20"
      }
    },
    {
      isStriped: true,
      color: "warning",
      class: {
        td: "group-data-[odd=true]/tr:data-[selected=true]/tr:before:bg-warning/20"
      }
    },
    {
      isStriped: true,
      color: "danger",
      class: {
        td: "group-data-[odd=true]/tr:data-[selected=true]/tr:before:bg-danger/20"
      }
    }
  ]
});
var tabs = tv({
  slots: {
    base: "inline-flex",
    tabList: [
      "flex",
      "p-1",
      "h-fit",
      "gap-2",
      "items-center",
      "flex-nowrap",
      "overflow-x-scroll",
      "scrollbar-hide",
      "bg-default-100"
    ],
    tab: [
      "z-0",
      "w-full",
      "px-3",
      "py-1",
      "flex",
      "group",
      "relative",
      "justify-center",
      "items-center",
      "outline-hidden",
      "cursor-pointer",
      "transition-opacity",
      "tap-highlight-transparent",
      "data-[disabled=true]:cursor-not-allowed",
      "data-[disabled=true]:opacity-30",
      "data-[hover-unselected=true]:opacity-disabled",
      // focus ring
      ...dataFocusVisibleClasses
    ],
    tabContent: [
      "relative",
      "z-10",
      "text-inherit",
      "whitespace-nowrap",
      "transition-colors",
      "text-default-500",
      "group-data-[selected=true]:text-foreground"
    ],
    cursor: ["absolute", "z-0", "bg-white"],
    panel: [
      "py-3",
      "px-1",
      "outline-hidden",
      "data-[inert=true]:hidden",
      // focus ring
      ...dataFocusVisibleClasses
    ],
    tabWrapper: []
  },
  variants: {
    variant: {
      solid: {
        cursor: "inset-0"
      },
      light: {
        tabList: "bg-transparent dark:bg-transparent",
        cursor: "inset-0"
      },
      underlined: {
        tabList: "bg-transparent dark:bg-transparent",
        cursor: "h-[2px] w-[80%] bottom-0 shadow-[0_1px_0px_0_rgba(0,0,0,0.05)]"
      },
      bordered: {
        tabList: "bg-transparent dark:bg-transparent border-medium border-default-200 shadow-xs",
        cursor: "inset-0"
      }
    },
    color: {
      default: {},
      primary: {},
      secondary: {},
      success: {},
      warning: {},
      danger: {}
    },
    size: {
      sm: {
        tabList: "rounded-medium",
        tab: "h-7 text-tiny rounded-small",
        cursor: "rounded-small"
      },
      md: {
        tabList: "rounded-medium",
        tab: "h-8 text-small rounded-small",
        cursor: "rounded-small"
      },
      lg: {
        tabList: "rounded-large",
        tab: "h-9 text-medium rounded-medium",
        cursor: "rounded-medium"
      }
    },
    radius: {
      none: {
        tabList: "rounded-none",
        tab: "rounded-none",
        cursor: "rounded-none"
      },
      sm: {
        tabList: "rounded-medium",
        tab: "rounded-small",
        cursor: "rounded-small"
      },
      md: {
        tabList: "rounded-medium",
        tab: "rounded-small",
        cursor: "rounded-small"
      },
      lg: {
        tabList: "rounded-large",
        tab: "rounded-medium",
        cursor: "rounded-medium"
      },
      full: {
        tabList: "rounded-full",
        tab: "rounded-full",
        cursor: "rounded-full"
      }
    },
    fullWidth: {
      true: {
        base: "w-full",
        tabList: "w-full"
      }
    },
    isDisabled: {
      true: {
        tabList: "opacity-disabled pointer-events-none"
      }
    },
    disableAnimation: {
      true: {
        tab: "transition-none",
        tabContent: "transition-none"
      }
    },
    placement: {
      top: {},
      start: {
        tabList: "flex-col",
        panel: "py-0 px-3",
        tabWrapper: "flex"
      },
      end: {
        tabList: "flex-col",
        panel: "py-0 px-3",
        tabWrapper: "flex flex-row-reverse"
      },
      bottom: {
        tabWrapper: "flex flex-col-reverse"
      }
    }
  },
  defaultVariants: {
    color: "default",
    variant: "solid",
    size: "md",
    fullWidth: false,
    isDisabled: false
  },
  compoundVariants: [
    /**
     * Variants & Colors
     */
    // solid + bordered + light && color
    {
      variant: ["solid", "bordered", "light"],
      color: "default",
      class: {
        cursor: ["bg-background", "dark:bg-default", "shadow-small"],
        tabContent: "group-data-[selected=true]:text-default-foreground"
      }
    },
    {
      variant: ["solid", "bordered", "light"],
      color: "primary",
      class: {
        cursor: colorVariants.solid.primary,
        tabContent: "group-data-[selected=true]:text-primary-foreground"
      }
    },
    {
      variant: ["solid", "bordered", "light"],
      color: "secondary",
      class: {
        cursor: colorVariants.solid.secondary,
        tabContent: "group-data-[selected=true]:text-secondary-foreground"
      }
    },
    {
      variant: ["solid", "bordered", "light"],
      color: "success",
      class: {
        cursor: colorVariants.solid.success,
        tabContent: "group-data-[selected=true]:text-success-foreground"
      }
    },
    {
      variant: ["solid", "bordered", "light"],
      color: "warning",
      class: {
        cursor: colorVariants.solid.warning,
        tabContent: "group-data-[selected=true]:text-warning-foreground"
      }
    },
    {
      variant: ["solid", "bordered", "light"],
      color: "danger",
      class: {
        cursor: colorVariants.solid.danger,
        tabContent: "group-data-[selected=true]:text-danger-foreground"
      }
    },
    // underlined && color
    {
      variant: "underlined",
      color: "default",
      class: {
        cursor: "bg-foreground",
        tabContent: "group-data-[selected=true]:text-foreground"
      }
    },
    {
      variant: "underlined",
      color: "primary",
      class: {
        cursor: "bg-primary",
        tabContent: "group-data-[selected=true]:text-primary"
      }
    },
    {
      variant: "underlined",
      color: "secondary",
      class: {
        cursor: "bg-secondary",
        tabContent: "group-data-[selected=true]:text-secondary"
      }
    },
    {
      variant: "underlined",
      color: "success",
      class: {
        cursor: "bg-success",
        tabContent: "group-data-[selected=true]:text-success"
      }
    },
    {
      variant: "underlined",
      color: "warning",
      class: {
        cursor: "bg-warning",
        tabContent: "group-data-[selected=true]:text-warning"
      }
    },
    {
      variant: "underlined",
      color: "danger",
      class: {
        cursor: "bg-danger",
        tabContent: "group-data-[selected=true]:text-danger"
      }
    },
    /**
     * Disable animation & Variants & Colors
     */
    // disabledAnimation && underlined
    {
      disableAnimation: true,
      variant: "underlined",
      class: {
        tab: [
          "after:content-['']",
          "after:absolute",
          "after:bottom-0",
          "after:h-[2px]",
          "after:w-[80%]",
          "after:opacity-0",
          "after:shadow-[0_1px_0px_0_rgba(0,0,0,0.05)]",
          "data-[selected=true]:after:opacity-100"
        ]
      }
    },
    // disableAnimation && color && solid/bordered
    {
      disableAnimation: true,
      color: "default",
      variant: ["solid", "bordered", "light"],
      class: {
        tab: "data-[selected=true]:bg-default data-[selected=true]:text-default-foreground"
      }
    },
    {
      disableAnimation: true,
      color: "primary",
      variant: ["solid", "bordered", "light"],
      class: {
        tab: "data-[selected=true]:bg-primary data-[selected=true]:text-primary-foreground"
      }
    },
    {
      disableAnimation: true,
      color: "secondary",
      variant: ["solid", "bordered", "light"],
      class: {
        tab: "data-[selected=true]:bg-secondary data-[selected=true]:text-secondary-foreground"
      }
    },
    {
      disableAnimation: true,
      color: "success",
      variant: ["solid", "bordered", "light"],
      class: {
        tab: "data-[selected=true]:bg-success data-[selected=true]:text-success-foreground"
      }
    },
    {
      disableAnimation: true,
      color: "warning",
      variant: ["solid", "bordered", "light"],
      class: {
        tab: "data-[selected=true]:bg-warning data-[selected=true]:text-warning-foreground"
      }
    },
    {
      disableAnimation: true,
      color: "danger",
      variant: ["solid", "bordered", "light"],
      class: {
        tab: "data-[selected=true]:bg-danger data-[selected=true]:text-danger-foreground"
      }
    },
    // disableAnimation && color && underlined
    {
      disableAnimation: true,
      color: "default",
      variant: "underlined",
      class: {
        tab: "data-[selected=true]:after:bg-foreground"
      }
    },
    {
      disableAnimation: true,
      color: "primary",
      variant: "underlined",
      class: {
        tab: "data-[selected=true]:after:bg-primary"
      }
    },
    {
      disableAnimation: true,
      color: "secondary",
      variant: "underlined",
      class: {
        tab: "data-[selected=true]:after:bg-secondary"
      }
    },
    {
      disableAnimation: true,
      color: "success",
      variant: "underlined",
      class: {
        tab: "data-[selected=true]:after:bg-success"
      }
    },
    {
      disableAnimation: true,
      color: "warning",
      variant: "underlined",
      class: {
        tab: "data-[selected=true]:after:bg-warning"
      }
    },
    {
      disableAnimation: true,
      color: "danger",
      variant: "underlined",
      class: {
        tab: "data-[selected=true]:after:bg-danger"
      }
    }
  ],
  compoundSlots: [
    {
      variant: "underlined",
      slots: ["tab", "tabList", "cursor"],
      class: ["rounded-none"]
    }
  ]
});
var toastRegion = tv({
  slots: {
    base: "relative z-[100]"
  },
  variants: {
    disableAnimation: {
      false: {
        base: ""
      },
      true: {
        base: [
          "data-[placement=bottom-right]:bottom-0 data-[placement=bottom-right]:right-0 w-full px-2 sm:w-auto sm:px-0 data-[placement=bottom-right]:fixed data-[placement=bottom-right]:flex data-[placement=bottom-right]:flex-col",
          "data-[placement=bottom-left]:bottom-0 data-[placement=bottom-left]:left-0 w-full px-2 sm:w-auto sm:px-0 data-[placement=bottom-left]:fixed data-[placement=bottom-left]:flex data-[placement=bottom-left]:flex-col",
          "data-[placement=bottom-center]:bottom-0 data-[placement=bottom-center]:fixed w-full px-2 sm:w-auto sm:px-0 data-[placement=bottom-center]:flex data-[placement=bottom-center]:flex-col data-[placement=bottom-center]:left-1/2 data-[placement=bottom-center]:-translate-x-1/2",
          "data-[placement=top-right]:top-0 data-[placement=top-right]:right-0 w-full px-2 sm:w-auto sm:px-0 data-[placement=top-right]:fixed data-[placement=top-right]:flex data-[placement=top-right]:flex-col",
          "data-[placement=top-left]:top-0 data-[placement=top-left]:left-0 w-full px-2 sm:w-auto sm:px-0 data-[placement=top-left]:fixed data-[placement=top-left]:flex data-[placement=top-left]:flex-col",
          "data-[placement=top-center]:top-0 data-[placement=top-center]:fixed w-full px-2 sm:w-auto sm:px-0 data-[placement=top-center]:flex data-[placement=top-center]:flex-col data-[placement=top-center]:left-1/2 data-[placement=top-center]:-translate-x-1/2"
        ]
      }
    }
  },
  defaultVariants: {
    disableAnimation: false
  }
});
var toast$1 = tv({
  slots: {
    base: [
      "flex gap-x-4 items-center",
      "group",
      "cursor-pointer",
      "relative",
      "z-50",
      "box-border",
      "outline-hidden",
      "p-3 sm:mx-1",
      "my-1",
      "w-full sm:w-[356px]",
      "min-h-4",
      "before:content-['']",
      "before:absolute",
      "before:left-0",
      "before:right-0",
      "data-[placement=bottom-right]:before:h-[var(--top-extension,16px)]",
      "data-[placement=bottom-left]:before:h-[var(--top-extension,16px)]",
      "data-[placement=bottom-center]:before:h-[var(--top-extension,16px)]",
      "data-[placement=bottom-right]:before:top-[calc(-1*var(--top-extension,16px))]",
      "data-[placement=bottom-left]:before:top-[calc(-1*var(--top-extension,16px))]",
      "data-[placement=bottom-center]:before:top-[calc(-1*var(--top-extension,16px))]",
      "before:z-[-1]",
      "before:pointer-events-auto",
      "before:bg-transparent",
      "after:content-['']",
      "after:absolute",
      "after:left-0",
      "after:right-0",
      "data-[placement=bottom-right]:after:h-[var(--bottom-extension,16px)]",
      "data-[placement=bottom-left]:after:h-[var(--bottom-extension,16px)]",
      "data-[placement=bottom-center]:after:h-[var(--bottom-extension,16px)]",
      "data-[placement=bottom-right]:after:bottom-[calc(-1*var(--bottom-extension,16px))]",
      "data-[placement=bottom-left]:after:bottom-[calc(-1*var(--bottom-extension,16px))]",
      "data-[placement=bottom-center]:after:bottom-[calc(-1*var(--bottom-extension,16px))]",
      "after:z-[-1]",
      "after:pointer-events-auto",
      "after:bg-transparent",
      "transform-gpu",
      "will-change-transform",
      "backface-visibility-hidden"
    ],
    wrapper: ["flex flex-col gap-y-0"],
    title: ["text-sm", "me-4", "font-medium", "text-foreground"],
    description: ["text-sm", "me-4", "text-default-500"],
    icon: ["w-6 h-6 flex-none fill-current"],
    loadingComponent: ["w-6 h-6 flex-none fill-current"],
    content: ["flex flex-grow flex-row gap-x-4 items-center relative"],
    progressTrack: ["absolute inset-0 pointer-events-none bg-transparent overflow-hidden"],
    progressIndicator: ["h-full bg-default-400 opacity-20"],
    motionDiv: [
      "fixed",
      "px-4 sm:px-0",
      "data-[placement=bottom-right]:bottom-0 data-[placement=bottom-right]:right-0 data-[placement=bottom-right]:mx-auto w-full sm:data-[placement=bottom-right]:w-max mb-1 sm:data-[placement=bottom-right]:mr-2",
      "data-[placement=bottom-left]:bottom-0 data-[placement=bottom-left]:left-0 data-[placement=bottom-left]:mx-auto w-full sm:data-[placement=bottom-left]:w-max mb-1 sm:data-[placement=bottom-left]:ml-2",
      "data-[placement=bottom-center]:bottom-0 data-[placement=bottom-center]:left-0 data-[placement=bottom-center]:right-0 w-full sm:data-[placement=bottom-center]:w-max sm:data-[placement=bottom-center]:mx-auto",
      "data-[placement=top-right]:top-0 data-[placement=top-right]:right-0 data-[placement=top-right]:mx-auto w-full sm:data-[placement=top-right]:w-max sm:data-[placement=top-right]:mr-2",
      "data-[placement=top-left]:top-0 data-[placement=top-left]:left-0 data-[placement=top-left]:mx-auto w-full sm:data-[placement=top-left]:w-max sm:data-[placement=top-left]:ml-2",
      "data-[placement=top-center]:top-0 data-[placement=top-center]:left-0 data-[placement=top-center]:right-0 w-full sm:data-[placement=top-center]:w-max sm:data-[placement=top-center]:mx-auto"
    ],
    closeButton: [
      "opacity-0 group-hover:opacity-100",
      "transform-gpu",
      "transition-all duration-200 ease-out",
      "will-change-opacity will-change-transform",
      "p-0 group-hover:pointer-events-auto w-6 h-6 min-w-4 absolute -right-2 -top-2 items-center justify-center bg-transparent text-default-400 hover:text-default-600 border border-3 border-transparent",
      "data-[hidden=true]:hidden"
    ],
    closeIcon: ["rounded-full w-full h-full p-0.5 border border-default-400 bg-default-100"]
  },
  variants: {
    size: {
      sm: {
        icon: "w-5 h-5",
        loadingComponent: "w-5 h-5"
      },
      md: {},
      lg: {}
    },
    variant: {
      flat: "bg-content1 border border-default-100",
      solid: colorVariants.solid.default,
      bordered: "bg-background border border-default-200"
    },
    color: {
      default: "",
      foreground: {
        progressIndicator: "h-full opacity-20 bg-foreground-400"
      },
      primary: {
        progressIndicator: "h-full opacity-20 bg-primary-400"
      },
      secondary: {
        progressIndicator: "h-full opacity-20 bg-secondary-400"
      },
      success: {
        progressIndicator: "h-full opacity-20 bg-success-400"
      },
      warning: {
        progressIndicator: "h-full opacity-20 bg-warning-400"
      },
      danger: {
        progressIndicator: "h-full opacity-20 bg-danger-400"
      }
    },
    radius: {
      none: {
        base: "rounded-none",
        progressTrack: "rounded-none"
      },
      sm: {
        base: "rounded-small",
        progressTrack: "rounded-small"
      },
      md: {
        base: "rounded-medium",
        progressTrack: "rounded-medium"
      },
      lg: {
        base: "rounded-large",
        progressTrack: "rounded-large"
      },
      full: {
        base: "rounded-full",
        closeButton: "-top-px -right-px",
        progressTrack: "rounded-full"
      }
    },
    disableAnimation: {
      true: {
        closeButton: "transition-none",
        base: "data-[animation=exiting]:opacity-0 transition-none"
      },
      false: {
        closeButton: "transition-all ease-out duration-200",
        base: [
          "data-[toast-exiting=true]:transform-gpu",
          "data-[toast-exiting=true]:will-change-transform",
          "data-[toast-exiting=true]:transition-all",
          "data-[toast-exiting=true]:ease-out",
          "data-[toast-exiting=true]:data-[placement=bottom-right]:translate-x-full",
          "data-[toast-exiting=true]:data-[placement=bottom-left]:-translate-x-full",
          "data-[toast-exiting=true]:data-[placement=bottom-center]:translate-y-full",
          "data-[toast-exiting=true]:data-[placement=top-right]:translate-x-full",
          "data-[toast-exiting=true]:data-[placement=top-left]:-translate-x-full",
          "data-[toast-exiting=true]:data-[placement=top-center]:-translate-y-full",
          "data-[toast-exiting=true]:opacity-0",
          "data-[toast-exiting=true]:duration-300",
          "data-[toast-exiting=true]:ease-out"
        ]
      }
    },
    shadow: {
      none: {
        base: "shadow-none"
      },
      sm: {
        base: "shadow-small"
      },
      md: {
        base: "shadow-medium"
      },
      lg: {
        base: "shadow-large"
      }
    }
  },
  defaultVariants: {
    size: "md",
    variant: "flat",
    radius: "md",
    shadow: "sm"
  },
  compoundVariants: [
    // flat and color
    {
      variant: "flat",
      color: "foreground",
      class: {
        base: "bg-foreground text-background",
        closeButton: "text-foreground-400 hover:text-foreground-600",
        closeIcon: "border border-foreground-400 bg-foreground-100",
        title: "text-background-600",
        description: "text-background-500"
      }
    },
    {
      variant: "flat",
      color: "primary",
      class: {
        base: "bg-primary-50 text-primary-600 border-primary-100",
        closeButton: "text-primary-400 hover:text-primary-600",
        closeIcon: "border border-primary-400 bg-primary-100",
        title: "text-primary-600",
        description: "text-primary-500"
      }
    },
    {
      variant: "flat",
      color: "secondary",
      class: {
        base: "bg-secondary-50 text-secondary-600 border-secondary-100",
        closeButton: "text-secondary-400 hover:text-secondary-600",
        closeIcon: "border border-secondary-400 bg-secondary-100",
        title: "text-secondary-600",
        description: "text-secondary-500"
      }
    },
    {
      variant: "flat",
      color: "success",
      class: {
        base: "bg-success-50 text-success-600 border-success-100",
        closeButton: "text-success-400 hover:text-success-600",
        closeIcon: "border border-success-400 bg-success-100",
        title: "text-success-600",
        description: "text-success-500"
      }
    },
    {
      variant: "flat",
      color: "warning",
      class: {
        base: "bg-warning-50 text-warning-600 border-warning-100",
        closeButton: "text-warning-400 hover:text-warning-600",
        closeIcon: "border border-warning-400 bg-warning-100",
        title: "text-warning-600",
        description: "text-warning-500"
      }
    },
    {
      variant: "flat",
      color: "danger",
      class: {
        base: "bg-danger-50 text-danger-600 border-danger-100",
        closeButton: "text-danger-400 hover:text-danger-600",
        closeIcon: "border border-danger-400 bg-danger-100",
        title: "text-danger-600",
        description: "text-danger-500"
      }
    },
    // bordered and color
    {
      variant: "bordered",
      color: "foreground",
      class: {
        base: "bg-foreground border-foreground-400 text-background",
        closeButton: "text-foreground-400 hover:text-foreground-600",
        closeIcon: "border border-foreground-400 bg-foreground-100",
        title: "text-background-600",
        description: "text-background-500"
      }
    },
    {
      variant: "bordered",
      color: "primary",
      class: {
        base: "border-primary-400 text-primary-600",
        closeButton: "text-primary-400 hover:text-primary-600",
        closeIcon: "border border-primary-400 bg-primary-100",
        title: "text-primary-600",
        description: "text-primary-500"
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        base: "border-secondary-400 text-secondary-600",
        closeButton: "text-secondary-400 hover:text-secondary-600",
        closeIcon: "border border-secondary-400 bg-secondary-100",
        title: "text-secondary-600",
        description: "text-secondary-500"
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        base: "border-success-400 text-success-600",
        closeButton: "text-success-400 hover:text-success-600",
        closeIcon: "border border-success-400 bg-success-100",
        title: "text-success-600",
        description: "text-success-500"
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        base: "border-warning-400 text-warning-600",
        closeButton: "text-warning-400 hover:text-warning-600",
        closeIcon: "border border-warning-400 bg-warning-100",
        title: "text-warning-600",
        description: "text-warning-500"
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        base: "border-danger-400 text-danger-600",
        closeButton: "text-danger-400 hover:text-danger-600",
        closeIcon: "border border-danger-400 bg-danger-100",
        title: "text-danger-600",
        description: "text-danger-500"
      }
    },
    // solid and color
    {
      variant: "solid",
      color: "foreground",
      class: {
        base: colorVariants.solid.foreground,
        closeButton: "text-foreground-400 hover:text-foreground-600",
        closeIcon: "border border-foreground-400 bg-foreground-100",
        title: "text-background",
        description: "text-background"
      }
    },
    {
      variant: "solid",
      color: "primary",
      class: {
        base: colorVariants.solid.primary,
        closeButton: "text-primary-400 hover:text-primary-600",
        closeIcon: "border border-primary-400 bg-primary-100",
        title: "text-primary-foreground",
        description: "text-primary-foreground"
      }
    },
    {
      variant: "solid",
      color: "secondary",
      class: {
        base: colorVariants.solid.secondary,
        closeButton: "text-secondary-400 hover:text-secondary-600",
        closeIcon: "border border-secondary-400 bg-secondary-100",
        title: "text-secondary-foreground",
        description: "text-secondary-foreground"
      }
    },
    {
      variant: "solid",
      color: "success",
      class: {
        base: colorVariants.solid.success,
        closeButton: "text-success-400 hover:text-success-600",
        closeIcon: "border border-success-400 bg-success-100",
        title: "text-success-foreground",
        description: "text-success-foreground"
      }
    },
    {
      variant: "solid",
      color: "warning",
      class: {
        base: colorVariants.solid.warning,
        closeButton: "text-warning-400 hover:text-warning-600",
        closeIcon: "border border-warning-400 bg-warning-100",
        title: "text-warning-foreground",
        description: "text-warning-foreground"
      }
    },
    {
      variant: "solid",
      color: "danger",
      class: {
        base: colorVariants.solid.danger,
        closeButton: "text-danger-400 hover:text-danger-600",
        closeIcon: "border border-danger-400 bg-danger-100",
        title: "text-danger-foreground",
        description: "text-danger-foreground"
      }
    }
  ]
});
var toggle = tv({
  slots: {
    base: "group relative max-w-fit inline-flex items-center justify-start cursor-pointer touch-none tap-highlight-transparent select-none",
    wrapper: [
      "px-1",
      "relative",
      "inline-flex",
      "items-center",
      "justify-start",
      "shrink-0",
      "overflow-hidden",
      "bg-default-200",
      "rounded-full",
      // focus ring
      ...groupDataFocusVisibleClasses
    ],
    thumb: [
      "z-10",
      "flex",
      "items-center",
      "justify-center",
      "bg-white",
      "shadow-small",
      "rounded-full",
      "origin-right",
      "pointer-events-none"
    ],
    hiddenInput: hiddenInputClasses,
    startContent: "z-0 absolute start-1.5 text-current",
    endContent: "z-0 absolute end-1.5 text-default-600",
    thumbIcon: "text-black",
    label: "relative text-foreground select-none ms-2"
  },
  variants: {
    color: {
      default: {
        wrapper: [
          "group-data-[selected=true]:bg-default-400",
          "group-data-[selected=true]:text-default-foreground"
        ]
      },
      primary: {
        wrapper: [
          "group-data-[selected=true]:bg-primary",
          "group-data-[selected=true]:text-primary-foreground"
        ]
      },
      secondary: {
        wrapper: [
          "group-data-[selected=true]:bg-secondary",
          "group-data-[selected=true]:text-secondary-foreground"
        ]
      },
      success: {
        wrapper: [
          "group-data-[selected=true]:bg-success",
          "group-data-[selected=true]:text-success-foreground"
        ]
      },
      warning: {
        wrapper: [
          "group-data-[selected=true]:bg-warning",
          "group-data-[selected=true]:text-warning-foreground"
        ]
      },
      danger: {
        wrapper: [
          "group-data-[selected=true]:bg-danger",
          "data-[selected=true]:text-danger-foreground"
        ]
      }
    },
    size: {
      sm: {
        wrapper: "w-10 h-6",
        thumb: [
          "w-4 h-4 text-tiny",
          //selected
          "group-data-[selected=true]:ms-4"
        ],
        endContent: "text-tiny",
        startContent: "text-tiny",
        label: "text-small"
      },
      md: {
        wrapper: "w-12 h-7",
        thumb: [
          "w-5 h-5 text-small",
          //selected
          "group-data-[selected=true]:ms-5"
        ],
        endContent: "text-small",
        startContent: "text-small",
        label: "text-medium"
      },
      lg: {
        wrapper: "w-14 h-8",
        thumb: [
          "w-6 h-6 text-medium",
          //selected
          "group-data-[selected=true]:ms-6"
        ],
        endContent: "text-medium",
        startContent: "text-medium",
        label: "text-large"
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none"
      }
    },
    disableAnimation: {
      true: {
        wrapper: "transition-none",
        thumb: "transition-none"
      },
      false: {
        wrapper: "transition-background",
        thumb: "transition-all",
        startContent: [
          "opacity-0",
          "scale-50",
          "transition-transform-opacity",
          "group-data-[selected=true]:scale-100",
          "group-data-[selected=true]:opacity-100"
        ],
        endContent: [
          "opacity-100",
          "transition-transform-opacity",
          "group-data-[selected=true]:translate-x-3",
          "group-data-[selected=true]:opacity-0"
        ]
      }
    }
  },
  defaultVariants: {
    color: "primary",
    size: "md",
    isDisabled: false
  },
  compoundVariants: [
    {
      disableAnimation: false,
      size: "sm",
      class: {
        thumb: ["group-data-[pressed=true]:w-5", "group-data-[selected]:group-data-[pressed]:ml-3"]
      }
    },
    {
      disableAnimation: false,
      size: "md",
      class: {
        thumb: ["group-data-[pressed=true]:w-6", "group-data-[selected]:group-data-[pressed]:ml-4"]
      }
    },
    {
      disableAnimation: false,
      size: "lg",
      class: {
        thumb: ["group-data-[pressed=true]:w-7", "group-data-[selected]:group-data-[pressed]:ml-5"]
      }
    }
  ]
});
var pagination = tv({
  slots: {
    base: ["p-2.5", "-m-2.5", "overflow-x-scroll", "scrollbar-hide"],
    wrapper: [
      "flex",
      "flex-nowrap",
      "h-fit",
      "max-w-fit",
      "relative",
      "gap-1",
      "items-center",
      "overflow-visible"
    ],
    item: ["tap-highlight-transparent", "select-none", "touch-none"],
    prev: "",
    next: "",
    cursor: [
      "absolute",
      "flex",
      "overflow-visible",
      "items-center",
      "justify-center",
      "origin-center",
      "left-0",
      "select-none",
      "touch-none",
      "pointer-events-none",
      "z-20"
    ],
    forwardIcon: [
      "hidden",
      "group-hover:block",
      "group-data-[focus-visible=true]:block",
      "data-[before=true]:rotate-180"
    ],
    ellipsis: "group-hover:hidden group-data-[focus-visible=true]:hidden",
    chevronNext: "rotate-180"
  },
  variants: {
    variant: {
      bordered: {
        item: [
          "border-medium",
          "border-default",
          "bg-transparent",
          "data-[hover=true]:bg-default-100"
        ]
      },
      light: {
        item: "bg-transparent"
      },
      flat: {},
      faded: {
        item: ["border-medium", "border-default"]
      }
    },
    color: {
      default: {
        cursor: colorVariants.solid.default
      },
      primary: {
        cursor: colorVariants.solid.primary
      },
      secondary: {
        cursor: colorVariants.solid.secondary
      },
      success: {
        cursor: colorVariants.solid.success
      },
      warning: {
        cursor: colorVariants.solid.warning
      },
      danger: {
        cursor: colorVariants.solid.danger
      }
    },
    size: {
      sm: {},
      md: {},
      lg: {}
    },
    radius: {
      none: {},
      sm: {},
      md: {},
      lg: {},
      full: {}
    },
    isCompact: {
      true: {
        wrapper: "gap-0 shadow-xs",
        item: [
          "shadow-none",
          "first-of-type:rounded-e-none",
          "last-of-type:rounded-s-none",
          "[&:not(:first-of-type):not(:last-of-type)]:rounded-none"
        ],
        prev: "!rounded-e-none",
        next: "!rounded-s-none"
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none"
      }
    },
    showShadow: {
      true: {}
    },
    disableCursorAnimation: {
      true: {
        cursor: "hidden"
      }
    },
    disableAnimation: {
      true: {
        item: "transition-none",
        cursor: "transition-none"
      },
      false: {
        item: ["data-[pressed=true]:scale-[0.97]", "transition-transform-background"],
        cursor: [
          "data-[moving=true]:transition-transform",
          "!data-[moving=true]:duration-300",
          // this hides the cursor and only shows it once it has been moved to its initial position
          "opacity-0",
          "data-[moving]:opacity-100"
        ]
      }
    }
  },
  defaultVariants: {
    variant: "flat",
    color: "primary",
    size: "md",
    radius: "md",
    isCompact: false,
    isDisabled: false,
    showShadow: false,
    disableCursorAnimation: false
  },
  compoundVariants: [
    // showShadow / color
    {
      showShadow: true,
      color: "default",
      class: {
        cursor: [colorVariants.shadow.default, "shadow-md"]
      }
    },
    {
      showShadow: true,
      color: "primary",
      class: {
        cursor: [colorVariants.shadow.primary, "shadow-md"]
      }
    },
    {
      showShadow: true,
      color: "secondary",
      class: {
        cursor: [colorVariants.shadow.secondary, "shadow-md"]
      }
    },
    {
      showShadow: true,
      color: "success",
      class: {
        cursor: [colorVariants.shadow.success, "shadow-md"]
      }
    },
    {
      showShadow: true,
      color: "warning",
      class: {
        cursor: [colorVariants.shadow.warning, "shadow-md"]
      }
    },
    {
      showShadow: true,
      color: "danger",
      class: {
        cursor: [colorVariants.shadow.danger, "shadow-md"]
      }
    },
    // isCompact / bordered
    {
      isCompact: true,
      variant: "bordered",
      class: {
        item: "[&:not(:first-of-type)]:ms-[calc(theme(borderWidth.2)*-1)]"
      }
    },
    /**
     * --------------------------------------------------------
     * disableCursorAnimation
     * the classNames will be applied to the active item
     * --------------------------------------------------------
     */
    // disableCursorAnimation / color
    {
      disableCursorAnimation: true,
      color: "default",
      class: {
        item: [
          "data-[active=true]:bg-default-400",
          "data-[active=true]:border-default-400",
          "data-[active=true]:text-default-foreground"
        ]
      }
    },
    {
      disableCursorAnimation: true,
      color: "primary",
      class: {
        item: [
          "data-[active=true]:bg-primary",
          "data-[active=true]:border-primary",
          "data-[active=true]:text-primary-foreground"
        ]
      }
    },
    {
      disableCursorAnimation: true,
      color: "secondary",
      class: {
        item: [
          "data-[active=true]:bg-secondary",
          "data-[active=true]:border-secondary",
          "data-[active=true]:text-secondary-foreground"
        ]
      }
    },
    {
      disableCursorAnimation: true,
      color: "success",
      class: {
        item: [
          "data-[active=true]:bg-success",
          "data-[active=true]:border-success",
          "data-[active=true]:text-success-foreground"
        ]
      }
    },
    {
      disableCursorAnimation: true,
      color: "warning",
      class: {
        item: [
          "data-[active=true]:bg-warning",
          "data-[active=true]:border-warning",
          "data-[active=true]:text-warning-foreground"
        ]
      }
    },
    {
      disableCursorAnimation: true,
      color: "danger",
      class: {
        item: [
          "data-[active=true]:bg-danger",
          "data-[active=true]:border-danger",
          "data-[active=true]:text-danger-foreground"
        ]
      }
    },
    // shadow / color
    {
      disableCursorAnimation: true,
      showShadow: true,
      color: "default",
      class: {
        item: ["data-[active=true]:shadow-md", "data-[active=true]:shadow-default/50"]
      }
    },
    {
      disableCursorAnimation: true,
      showShadow: true,
      color: "primary",
      class: {
        item: ["data-[active=true]:shadow-md", "data-[active=true]:shadow-primary/40"]
      }
    },
    {
      disableCursorAnimation: true,
      showShadow: true,
      color: "secondary",
      class: {
        item: ["data-[active=true]:shadow-md", "data-[active=true]:shadow-secondary/40"]
      }
    },
    {
      disableCursorAnimation: true,
      showShadow: true,
      color: "success",
      class: {
        item: ["data-[active=true]:shadow-md", "data-[active=true]:shadow-success/40"]
      }
    },
    {
      disableCursorAnimation: true,
      showShadow: true,
      color: "warning",
      class: {
        item: ["data-[active=true]:shadow-md", "data-[active=true]:shadow-warning/40"]
      }
    },
    {
      disableCursorAnimation: true,
      showShadow: true,
      color: "danger",
      class: {
        item: ["data-[active=true]:shadow-md", "data-[active=true]:shadow-danger/40"]
      }
    }
  ],
  compoundSlots: [
    // without variant
    {
      slots: ["item", "prev", "next"],
      class: [
        "flex",
        "flex-wrap",
        "truncate",
        "box-border",
        "outline-hidden",
        "items-center",
        "justify-center",
        "text-default-foreground",
        // focus ring
        ...dataFocusVisibleClasses,
        // disabled
        "data-[disabled=true]:text-default-300",
        "data-[disabled=true]:pointer-events-none"
      ]
    },
    {
      slots: ["item", "prev", "next"],
      variant: ["flat", "bordered", "faded"],
      class: ["shadow-xs"]
    },
    {
      slots: ["item", "prev", "next"],
      variant: "flat",
      class: [
        "bg-default-100",
        "[&[data-hover=true]:not([data-active=true])]:bg-default-200",
        "active:bg-default-300"
      ]
    },
    {
      slots: ["item", "prev", "next"],
      variant: "faded",
      class: [
        "bg-default-50",
        "[&[data-hover=true]:not([data-active=true])]:bg-default-100",
        "active:bg-default-200"
      ]
    },
    {
      slots: ["item", "prev", "next"],
      variant: "light",
      class: [
        "[&[data-hover=true]:not([data-active=true])]:bg-default-100",
        "active:bg-default-200"
      ]
    },
    // size
    {
      slots: ["item", "cursor", "prev", "next"],
      size: "sm",
      class: "min-w-8 w-8 h-8 text-tiny"
    },
    {
      slots: ["item", "cursor", "prev", "next"],
      size: "md",
      class: "min-w-9 w-9 h-9 text-small"
    },
    {
      slots: ["item", "cursor", "prev", "next"],
      size: "lg",
      class: "min-w-10 w-10 h-10 text-medium"
    },
    // radius
    {
      slots: ["wrapper", "item", "cursor", "prev", "next"],
      radius: "none",
      class: "rounded-none"
    },
    {
      slots: ["wrapper", "item", "cursor", "prev", "next"],
      radius: "sm",
      class: "rounded-small"
    },
    {
      slots: ["wrapper", "item", "cursor", "prev", "next"],
      radius: "md",
      class: "rounded-medium"
    },
    {
      slots: ["wrapper", "item", "cursor", "prev", "next"],
      radius: "lg",
      class: "rounded-large"
    },
    {
      slots: ["wrapper", "item", "cursor", "prev", "next"],
      radius: "full",
      class: "rounded-full"
    }
  ]
});
var popover = tv({
  slots: {
    base: [
      "z-0",
      "relative",
      "bg-transparent",
      // arrow
      "before:content-['']",
      "before:hidden",
      "before:z-[-1]",
      "before:absolute",
      "before:rotate-45",
      "before:w-2.5",
      "before:h-2.5",
      "before:rounded-sm",
      // visibility
      "data-[arrow=true]:before:block",
      // top
      "data-[placement=top]:before:-bottom-[calc(theme(spacing.5)/4_-_1.5px)]",
      "data-[placement=top]:before:left-1/2",
      "data-[placement=top]:before:-translate-x-1/2",
      "data-[placement=top-start]:before:-bottom-[calc(theme(spacing.5)/4_-_1.5px)]",
      "data-[placement=top-start]:before:left-3",
      "data-[placement=top-end]:before:-bottom-[calc(theme(spacing.5)/4_-_1.5px)]",
      "data-[placement=top-end]:before:right-3",
      // bottom
      "data-[placement=bottom]:before:-top-[calc(theme(spacing.5)/4_-_1.5px)]",
      "data-[placement=bottom]:before:left-1/2",
      "data-[placement=bottom]:before:-translate-x-1/2",
      "data-[placement=bottom-start]:before:-top-[calc(theme(spacing.5)/4_-_1.5px)]",
      "data-[placement=bottom-start]:before:left-3",
      "data-[placement=bottom-end]:before:-top-[calc(theme(spacing.5)/4_-_1.5px)]",
      "data-[placement=bottom-end]:before:right-3",
      // left
      "data-[placement=left]:before:-right-[calc(theme(spacing.5)/4_-_2px)]",
      "data-[placement=left]:before:top-1/2",
      "data-[placement=left]:before:-translate-y-1/2",
      "data-[placement=left-start]:before:-right-[calc(theme(spacing.5)/4_-_3px)]",
      "data-[placement=left-start]:before:top-1/4",
      "data-[placement=left-end]:before:-right-[calc(theme(spacing.5)/4_-_3px)]",
      "data-[placement=left-end]:before:bottom-1/4",
      // right
      "data-[placement=right]:before:-left-[calc(theme(spacing.5)/4_-_2px)]",
      "data-[placement=right]:before:top-1/2",
      "data-[placement=right]:before:-translate-y-1/2",
      "data-[placement=right-start]:before:-left-[calc(theme(spacing.5)/4_-_3px)]",
      "data-[placement=right-start]:before:top-1/4",
      "data-[placement=right-end]:before:-left-[calc(theme(spacing.5)/4_-_3px)]",
      "data-[placement=right-end]:before:bottom-1/4",
      // focus ring
      ...dataFocusVisibleClasses
    ],
    content: [
      "z-10",
      "px-2.5",
      "py-1",
      "w-full",
      "inline-flex",
      "flex-col",
      "items-center",
      "justify-center",
      "box-border",
      "subpixel-antialiased",
      "outline-hidden",
      "box-border"
    ],
    trigger: ["z-10"],
    backdrop: ["hidden"],
    arrow: []
  },
  variants: {
    size: {
      sm: { content: "text-tiny" },
      md: { content: "text-small" },
      lg: { content: "text-medium" }
    },
    color: {
      default: {
        base: "before:bg-content1 before:shadow-small",
        content: "bg-content1"
      },
      foreground: {
        base: "before:bg-foreground",
        content: colorVariants.solid.foreground
      },
      primary: {
        base: "before:bg-primary",
        content: colorVariants.solid.primary
      },
      secondary: {
        base: "before:bg-secondary",
        content: colorVariants.solid.secondary
      },
      success: {
        base: "before:bg-success",
        content: colorVariants.solid.success
      },
      warning: {
        base: "before:bg-warning",
        content: colorVariants.solid.warning
      },
      danger: {
        base: "before:bg-danger",
        content: colorVariants.solid.danger
      }
    },
    radius: {
      none: { content: "rounded-none" },
      sm: { content: "rounded-small" },
      md: { content: "rounded-medium" },
      lg: { content: "rounded-large" },
      full: { content: "rounded-full" }
    },
    shadow: {
      none: {
        content: "shadow-none"
      },
      sm: {
        content: "shadow-small"
      },
      md: {
        content: "shadow-medium"
      },
      lg: {
        content: "shadow-large"
      }
    },
    backdrop: {
      transparent: {},
      opaque: {
        backdrop: "bg-overlay/50 backdrop-opacity-disabled"
      },
      blur: {
        backdrop: "backdrop-blur-sm backdrop-saturate-150 bg-overlay/30"
      }
    },
    triggerScaleOnOpen: {
      true: {
        trigger: ["aria-expanded:scale-[0.97]", "aria-expanded:opacity-70", "subpixel-antialiased"]
      },
      false: {}
    },
    disableAnimation: {
      true: {
        base: "animate-none"
      }
    },
    isTriggerDisabled: {
      true: {
        trigger: "opacity-disabled pointer-events-none"
      },
      false: {}
    }
  },
  defaultVariants: {
    color: "default",
    radius: "lg",
    size: "md",
    shadow: "md",
    backdrop: "transparent",
    triggerScaleOnOpen: true
  },
  compoundVariants: [
    // backdrop (opaque/blur)
    {
      backdrop: ["opaque", "blur"],
      class: {
        backdrop: "block w-full h-full fixed inset-0 -z-30"
      }
    }
  ]
});
var progress = tv(
  {
    slots: {
      base: "flex flex-col gap-2 w-full",
      label: "",
      labelWrapper: "flex justify-between",
      value: "",
      track: "z-0 relative bg-default-300/50 overflow-hidden rtl:rotate-180",
      indicator: "h-full"
    },
    variants: {
      color: {
        default: {
          indicator: "bg-default-400"
        },
        primary: {
          indicator: "bg-primary"
        },
        secondary: {
          indicator: "bg-secondary"
        },
        success: {
          indicator: "bg-success"
        },
        warning: {
          indicator: "bg-warning"
        },
        danger: {
          indicator: "bg-danger"
        }
      },
      size: {
        sm: {
          label: "text-small",
          value: "text-small",
          track: "h-1"
        },
        md: {
          label: "text-medium",
          value: "text-medium",
          track: "h-3"
        },
        lg: {
          label: "text-large",
          value: "text-large",
          track: "h-5"
        }
      },
      radius: {
        none: {
          track: "rounded-none",
          indicator: "rounded-none"
        },
        sm: {
          track: "rounded-small",
          indicator: "rounded-small"
        },
        md: {
          track: "rounded-medium",
          indicator: "rounded-medium"
        },
        lg: {
          track: "rounded-large",
          indicator: "rounded-large"
        },
        full: {
          track: "rounded-full",
          indicator: "rounded-full"
        }
      },
      isStriped: {
        true: {
          indicator: "bg-stripe-gradient-default bg-stripe-size"
        }
      },
      isIndeterminate: {
        true: {
          indicator: ["absolute", "w-full", "origin-left", "animate-indeterminate-bar"]
        }
      },
      isDisabled: {
        true: {
          base: "opacity-disabled cursor-not-allowed"
        }
      },
      disableAnimation: {
        true: {},
        false: {
          indicator: "transition-transform !duration-500"
        }
      }
    },
    defaultVariants: {
      color: "primary",
      size: "md",
      radius: "full",
      isStriped: false,
      isIndeterminate: false,
      isDisabled: false
    },
    compoundVariants: [
      // disableAnimation && !isIndeterminate
      {
        disableAnimation: true,
        isIndeterminate: false,
        class: {
          indicator: "!transition-none motion-reduce:transition-none"
        }
      },
      {
        color: "primary",
        isStriped: true,
        class: {
          indicator: "bg-stripe-gradient-primary bg-stripe-size"
        }
      },
      {
        color: "secondary",
        isStriped: true,
        class: {
          indicator: "bg-stripe-gradient-secondary bg-stripe-size"
        }
      },
      {
        color: "success",
        isStriped: true,
        class: {
          indicator: "bg-stripe-gradient-success bg-stripe-size"
        }
      },
      {
        color: "warning",
        isStriped: true,
        class: {
          indicator: "bg-stripe-gradient-warning bg-stripe-size"
        }
      },
      {
        color: "danger",
        isStriped: true,
        class: {
          indicator: "bg-stripe-gradient-danger bg-stripe-size"
        }
      }
    ]
  },
  {
    twMerge: true
  }
);
var circularProgress = tv({
  slots: {
    base: "flex flex-col justify-center gap-1 max-w-fit items-center",
    label: "",
    svgWrapper: "relative block",
    svg: "z-0 relative overflow-hidden",
    track: "h-full stroke-default-300/50",
    indicator: "h-full stroke-current",
    value: "absolute font-normal inset-0 flex items-center justify-center"
  },
  variants: {
    color: {
      default: {
        svg: "text-default-400"
      },
      primary: {
        svg: "text-primary"
      },
      secondary: {
        svg: "text-secondary"
      },
      success: {
        svg: "text-success"
      },
      warning: {
        svg: "text-warning"
      },
      danger: {
        svg: "text-danger"
      }
    },
    size: {
      sm: {
        svg: "w-8 h-8",
        label: "text-small",
        value: "text-[0.5rem]"
      },
      md: {
        svg: "w-10 h-10",
        label: "text-small",
        value: "text-[0.55rem]"
      },
      lg: {
        svg: "w-12 h-12",
        label: "text-medium",
        value: "text-[0.6rem]"
      }
    },
    isIndeterminate: {
      true: {
        svg: "animate-spinner-ease-spin"
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled cursor-not-allowed"
      }
    },
    disableAnimation: {
      true: {},
      false: {
        indicator: "transition-all !duration-500"
      }
    }
  },
  defaultVariants: {
    color: "primary",
    size: "md",
    isDisabled: false
  },
  compoundVariants: [
    // disableAnimation && !isIndeterminate
    {
      disableAnimation: true,
      isIndeterminate: false,
      class: {
        svg: "!transition-none motion-reduce:transition-none"
      }
    }
  ]
});
var radio = tv({
  slots: {
    base: "group relative max-w-fit inline-flex items-center justify-start cursor-pointer tap-highlight-transparent p-2 -m-2 select-none",
    wrapper: [
      "relative",
      "inline-flex",
      "items-center",
      "justify-center",
      "shrink-0",
      "overflow-hidden",
      "border-solid",
      "border-medium",
      "box-border",
      "border-default",
      "rounded-full",
      "group-data-[hover-unselected=true]:bg-default-100",
      // focus ring
      ...groupDataFocusVisibleClasses
    ],
    hiddenInput: hiddenInputClasses,
    labelWrapper: "flex flex-col ml-1",
    control: [
      "z-10",
      "w-2",
      "h-2",
      "opacity-0",
      "scale-0",
      "origin-center",
      "rounded-full",
      "group-data-[selected=true]:opacity-100",
      "group-data-[selected=true]:scale-100"
    ],
    label: "relative text-foreground select-none",
    description: "relative text-foreground-400"
  },
  variants: {
    color: {
      default: {
        control: "bg-default-500 text-default-foreground",
        wrapper: "group-data-[selected=true]:border-default-500"
      },
      primary: {
        control: "bg-primary text-primary-foreground",
        wrapper: "group-data-[selected=true]:border-primary"
      },
      secondary: {
        control: "bg-secondary text-secondary-foreground",
        wrapper: "group-data-[selected=true]:border-secondary"
      },
      success: {
        control: "bg-success text-success-foreground",
        wrapper: "group-data-[selected=true]:border-success"
      },
      warning: {
        control: "bg-warning text-warning-foreground",
        wrapper: "group-data-[selected=true]:border-warning"
      },
      danger: {
        control: "bg-danger text-danger-foreground",
        wrapper: "group-data-[selected=true]:border-danger"
      }
    },
    size: {
      sm: {
        wrapper: "w-4 h-4",
        control: "w-1.5 h-1.5",
        labelWrapper: "ml-1",
        label: "text-small",
        description: "text-tiny"
      },
      md: {
        wrapper: "w-5 h-5",
        control: "w-2 h-2",
        labelWrapper: "ms-2",
        label: "text-medium",
        description: "text-small"
      },
      lg: {
        wrapper: "w-6 h-6",
        control: "w-2.5 h-2.5",
        labelWrapper: "ms-2",
        label: "text-large",
        description: "text-medium"
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none"
      }
    },
    isInvalid: {
      true: {
        control: "bg-danger text-danger-foreground",
        wrapper: "border-danger group-data-[selected=true]:border-danger",
        label: "text-danger",
        description: "text-danger-300"
      }
    },
    disableAnimation: {
      true: {},
      false: {
        wrapper: [
          "group-data-[pressed=true]:scale-95",
          "transition-transform-colors",
          "motion-reduce:transition-none"
        ],
        control: "transition-transform-opacity motion-reduce:transition-none",
        label: "transition-colors motion-reduce:transition-none",
        description: "transition-colors motion-reduce:transition-none"
      }
    }
  },
  defaultVariants: {
    color: "primary",
    size: "md",
    isDisabled: false,
    isInvalid: false
  }
});
var radioGroup = tv({
  slots: {
    base: "relative flex flex-col gap-2",
    label: "relative text-foreground-500",
    wrapper: "flex flex-col flex-wrap gap-2 data-[orientation=horizontal]:flex-row",
    description: "text-tiny text-foreground-400",
    errorMessage: "text-tiny text-danger"
  },
  variants: {
    isRequired: {
      true: {
        label: "after:content-['*'] after:text-danger after:ml-0.5"
      }
    },
    isInvalid: {
      true: {
        description: "text-danger"
      }
    },
    disableAnimation: {
      true: {},
      false: {
        description: "transition-colors !duration-150 motion-reduce:transition-none"
      }
    }
  },
  defaultVariants: {
    isInvalid: false,
    isRequired: false
  }
});
var verticalShadow = [
  "data-[top-scroll=true]:[mask-image:linear-gradient(0deg,#000_calc(100%_-_var(--scroll-shadow-size)),transparent)]",
  "data-[bottom-scroll=true]:[mask-image:linear-gradient(180deg,#000_calc(100%_-_var(--scroll-shadow-size)),transparent)]",
  "data-[top-bottom-scroll=true]:[mask-image:linear-gradient(#000,#000,transparent_0,#000_var(--scroll-shadow-size),#000_calc(100%_-_var(--scroll-shadow-size)),transparent)]"
];
var horizontalShadow = [
  "data-[left-scroll=true]:[mask-image:linear-gradient(270deg,#000_calc(100%_-_var(--scroll-shadow-size)),transparent)]",
  "data-[right-scroll=true]:[mask-image:linear-gradient(90deg,#000_calc(100%_-_var(--scroll-shadow-size)),transparent)]",
  "data-[left-right-scroll=true]:[mask-image:linear-gradient(to_right,#000,#000,transparent_0,#000_var(--scroll-shadow-size),#000_calc(100%_-_var(--scroll-shadow-size)),transparent)]"
];
var scrollShadow = tv({
  base: [],
  variants: {
    orientation: {
      vertical: ["overflow-y-auto", ...verticalShadow],
      horizontal: ["overflow-x-auto", ...horizontalShadow]
    },
    hideScrollBar: {
      true: "scrollbar-hide",
      false: ""
    }
  },
  defaultVariants: {
    orientation: "vertical",
    hideScrollBar: false
  }
});
var select = tv({
  slots: {
    base: ["group inline-flex flex-col relative"],
    label: [
      "block",
      "absolute",
      "z-10",
      "origin-top-left",
      "flex-shrink-0",
      // Using RTL here as Tailwind CSS doesn't support `start` and `end` logical properties for transforms yet.
      "rtl:origin-top-right",
      "subpixel-antialiased",
      "text-small",
      "text-foreground-500",
      "pointer-events-none",
      "group-data-[has-label-outside=true]:pointer-events-auto"
    ],
    mainWrapper: "w-full flex flex-col",
    trigger: "relative px-3 gap-3 w-full inline-flex flex-row items-center shadow-xs outline-hidden tap-highlight-transparent",
    innerWrapper: "inline-flex h-fit w-[calc(100%_-theme(spacing.6))] min-h-4 items-center gap-1.5 box-border",
    selectorIcon: "absolute end-3 w-4 h-4",
    spinner: "absolute end-3",
    value: ["text-foreground-500", "font-normal", "w-full", "text-start"],
    listboxWrapper: "scroll-py-6 w-full",
    listbox: "",
    popoverContent: "w-full p-1 overflow-hidden",
    clearButton: [
      "w-4",
      "h-4",
      "z-10",
      "mb-4",
      "relative",
      "start-auto",
      "appearance-none",
      "outline-none",
      "select-none",
      "opacity-70",
      "hover:!opacity-100",
      "cursor-pointer",
      "active:!opacity-70",
      "rounded-full",
      // focus ring
      ...dataFocusVisibleClasses
    ],
    helperWrapper: "p-1 flex relative flex-col gap-1.5 group-data-[has-helper=true]:flex",
    description: "text-tiny text-foreground-400",
    errorMessage: "text-tiny text-danger",
    endWrapper: "flex end-18",
    endContent: "mb-4"
  },
  variants: {
    variant: {
      flat: {
        trigger: [
          "bg-default-100",
          "data-[hover=true]:bg-default-200",
          "group-data-[focus=true]:bg-default-200"
        ],
        clearButton: "mb-4"
      },
      faded: {
        trigger: [
          "bg-default-100",
          "border-medium",
          "border-default-200",
          "data-[hover=true]:border-default-400 data-[focus=true]:border-default-400 data-[open=true]:border-default-400"
        ],
        value: "group-data-[has-value=true]:text-default-foreground",
        clearButton: "mb-4"
      },
      bordered: {
        trigger: [
          "border-medium",
          "border-default-200",
          "data-[hover=true]:border-default-400",
          "data-[open=true]:border-default-foreground",
          "data-[focus=true]:border-default-foreground"
        ],
        value: "group-data-[has-value=true]:text-default-foreground",
        clearButton: "mb-4"
      },
      underlined: {
        trigger: [
          "!px-1",
          "!pb-0",
          "!gap-0",
          "relative",
          "box-border",
          "border-b-medium",
          "shadow-[0_1px_0px_0_rgba(0,0,0,0.05)]",
          "border-default-200",
          "!rounded-none",
          "hover:border-default-300",
          "after:content-['']",
          "after:w-0",
          "after:origin-center",
          "after:bg-default-foreground",
          "after:absolute",
          "after:left-1/2",
          "after:-translate-x-1/2",
          "after:-bottom-[2px]",
          "after:h-[2px]",
          "data-[open=true]:after:w-full",
          "data-[focus=true]:after:w-full"
        ],
        value: "group-data-[has-value=true]:text-default-foreground",
        clearButton: "mb-4 me-2"
      }
    },
    color: {
      default: {},
      primary: {
        selectorIcon: "text-primary"
      },
      secondary: {
        selectorIcon: "text-secondary"
      },
      success: {
        selectorIcon: "text-success"
      },
      warning: {
        selectorIcon: "text-warning"
      },
      danger: {
        selectorIcon: "text-danger"
      }
    },
    size: {
      sm: {
        label: "text-tiny",
        trigger: "h-8 min-h-8 px-2 rounded-small",
        value: "text-small",
        clearButton: "text-medium"
      },
      md: {
        trigger: "h-10 min-h-10 rounded-medium",
        value: "text-small",
        clearButton: "text-large"
      },
      lg: {
        trigger: "h-12 min-h-12 rounded-large",
        value: "text-medium",
        clearButton: "mb-5 text-large"
      }
    },
    radius: {
      none: {
        trigger: "rounded-none"
      },
      sm: {
        trigger: "rounded-small"
      },
      md: {
        trigger: "rounded-medium"
      },
      lg: {
        trigger: "rounded-large"
      },
      full: {
        trigger: "rounded-full"
      }
    },
    labelPlacement: {
      outside: {
        base: "flex flex-col",
        clearButton: "mb-0"
      },
      "outside-left": {
        base: "flex-row items-center flex-nowrap data-[has-helper=true]:items-start",
        label: "relative pe-2 text-foreground",
        clearButton: "mb-0"
      },
      inside: {
        label: "text-tiny cursor-pointer",
        trigger: "flex-col items-start justify-center gap-0"
      }
    },
    fullWidth: {
      true: {
        base: "w-full"
      },
      false: {
        base: "min-w-40"
      }
    },
    isClearable: {
      true: {
        clearButton: "peer-data-[filled=true]:opacity-70 peer-data-[filled=true]:block",
        endContent: "ms-3"
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none",
        trigger: "pointer-events-none"
      }
    },
    isInvalid: {
      true: {
        label: "!text-danger",
        value: "!text-danger",
        selectorIcon: "text-danger"
      }
    },
    isRequired: {
      true: {
        label: "after:content-['*'] after:text-danger after:ms-0.5"
      }
    },
    isMultiline: {
      true: {
        label: "relative",
        trigger: "!h-auto"
      },
      false: {
        value: "truncate"
      }
    },
    disableAnimation: {
      true: {
        trigger: "after:transition-none",
        base: "transition-none",
        label: "transition-none",
        selectorIcon: "transition-none"
      },
      false: {
        base: "transition-background motion-reduce:transition-none !duration-150",
        label: [
          "will-change-auto",
          "origin-top-left",
          // Using RTL here as Tailwind CSS doesn't support `start` and `end` logical properties for transforms yet.
          "rtl:origin-top-right",
          "!duration-200",
          "!ease-out",
          "transition-[transform,color,left,opacity,translate,scale]",
          "motion-reduce:transition-none"
        ],
        selectorIcon: "transition-transform duration-150 ease motion-reduce:transition-none",
        clearButton: ["transition-opacity", "motion-reduce:transition-none"]
      }
    },
    disableSelectorIconRotation: {
      true: {},
      false: {
        selectorIcon: "data-[open=true]:rotate-180"
      }
    }
  },
  defaultVariants: {
    variant: "flat",
    color: "default",
    size: "md",
    fullWidth: true,
    isDisabled: false,
    isMultiline: false,
    disableSelectorIconRotation: false
  },
  compoundVariants: [
    // flat & color
    {
      variant: "flat",
      color: "default",
      class: {
        value: "group-data-[has-value=true]:text-default-foreground",
        trigger: ["bg-default-100", "data-[hover=true]:bg-default-200"]
      }
    },
    {
      variant: "flat",
      color: "primary",
      class: {
        trigger: [
          "bg-primary-100",
          "text-primary",
          "data-[hover=true]:bg-primary-50",
          "group-data-[focus=true]:bg-primary-50"
        ],
        value: "text-primary",
        label: "text-primary"
      }
    },
    {
      variant: "flat",
      color: "secondary",
      class: {
        trigger: [
          "bg-secondary-100",
          "text-secondary",
          "data-[hover=true]:bg-secondary-50",
          "group-data-[focus=true]:bg-secondary-50"
        ],
        value: "text-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "flat",
      color: "success",
      class: {
        trigger: [
          "bg-success-100",
          "text-success-600",
          "dark:text-success",
          "data-[hover=true]:bg-success-50",
          "group-data-[focus=true]:bg-success-50"
        ],
        value: "text-success-600 dark:text-success",
        label: "text-success-600 dark:text-success"
      }
    },
    {
      variant: "flat",
      color: "warning",
      class: {
        trigger: [
          "bg-warning-100",
          "text-warning-600",
          "dark:text-warning",
          "data-[hover=true]:bg-warning-50",
          "group-data-[focus=true]:bg-warning-50"
        ],
        value: "text-warning-600 dark:text-warning",
        label: "text-warning-600 dark:text-warning"
      }
    },
    {
      variant: "flat",
      color: "danger",
      class: {
        trigger: [
          "bg-danger-100",
          "text-danger",
          "dark:text-danger-500",
          "data-[hover=true]:bg-danger-50",
          "group-data-[focus=true]:bg-danger-50"
        ],
        value: "text-danger dark:text-danger-500",
        label: "text-danger dark:text-danger-500"
      }
    },
    // faded & color
    {
      variant: "faded",
      color: "primary",
      class: {
        trigger: "data-[hover=true]:border-primary data-[focus=true]:border-primary data-[open=true]:border-primary",
        label: "text-primary"
      }
    },
    {
      variant: "faded",
      color: "secondary",
      class: {
        trigger: "data-[hover=true]:border-secondary data-[focus=true]:border-secondary data-[open=true]:border-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "faded",
      color: "success",
      class: {
        trigger: "data-[hover=true]:border-success data-[focus=true]:border-success data-[open=true]:border-success",
        label: "text-success"
      }
    },
    {
      variant: "faded",
      color: "warning",
      class: {
        trigger: "data-[hover=true]:border-warning data-[focus=true]:border-warning data-[open=true]:border-warning",
        label: "text-warning"
      }
    },
    {
      variant: "faded",
      color: "danger",
      class: {
        trigger: "data-[hover=true]:border-danger data-[focus=true]:border-danger data-[open=true]:border-danger",
        label: "text-danger"
      }
    },
    // underlined & color
    // underlined & color
    {
      variant: "underlined",
      color: "default",
      class: {
        value: "group-data-[has-value=true]:text-foreground"
      }
    },
    {
      variant: "underlined",
      color: "primary",
      class: {
        trigger: "after:bg-primary",
        label: "text-primary"
      }
    },
    {
      variant: "underlined",
      color: "secondary",
      class: {
        trigger: "after:bg-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "underlined",
      color: "success",
      class: {
        trigger: "after:bg-success",
        label: "text-success"
      }
    },
    {
      variant: "underlined",
      color: "warning",
      class: {
        trigger: "after:bg-warning",
        label: "text-warning"
      }
    },
    {
      variant: "underlined",
      color: "danger",
      class: {
        trigger: "after:bg-danger",
        label: "text-danger"
      }
    },
    // bordered & color
    {
      variant: "bordered",
      color: "primary",
      class: {
        trigger: ["data-[open=true]:border-primary", "data-[focus=true]:border-primary"],
        label: "text-primary"
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        trigger: ["data-[open=true]:border-secondary", "data-[focus=true]:border-secondary"],
        label: "text-secondary"
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        trigger: ["data-[open=true]:border-success", "data-[focus=true]:border-success"],
        label: "text-success"
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        trigger: ["data-[open=true]:border-warning", "data-[focus=true]:border-warning"],
        label: "text-warning"
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        trigger: ["data-[open=true]:border-danger", "data-[focus=true]:border-danger"],
        label: "text-danger"
      }
    },
    // labelPlacement=outside & default
    {
      labelPlacement: "inside",
      color: "default",
      class: {
        label: "group-data-[filled=true]:text-default-600"
      }
    },
    // labelPlacement=outside & default
    {
      labelPlacement: "outside",
      color: "default",
      class: {
        label: "group-data-[filled=true]:text-foreground"
      }
    },
    // radius-full & size
    {
      radius: "full",
      size: ["sm"],
      class: {
        trigger: "px-3"
      }
    },
    {
      radius: "full",
      size: "md",
      class: {
        trigger: "px-4"
      }
    },
    {
      radius: "full",
      size: "lg",
      class: {
        trigger: "px-5"
      }
    },
    // !disableAnimation & variant
    {
      disableAnimation: false,
      variant: ["faded", "bordered"],
      class: {
        trigger: "transition-colors motion-reduce:transition-none"
      }
    },
    {
      disableAnimation: false,
      variant: "underlined",
      class: {
        trigger: "after:transition-width motion-reduce:after:transition-none"
      }
    },
    // flat & faded
    {
      variant: ["flat", "faded"],
      class: {
        trigger: [
          // focus ring
          ...dataFocusVisibleClasses
        ]
      }
    },
    // isInvalid & variant
    {
      isInvalid: true,
      variant: "flat",
      class: {
        trigger: [
          "bg-danger-50",
          "data-[hover=true]:bg-danger-100",
          "group-data-[focus=true]:bg-danger-50"
        ]
      }
    },
    {
      isInvalid: true,
      variant: "bordered",
      class: {
        trigger: "!border-danger group-data-[focus=true]:border-danger"
      }
    },
    {
      isInvalid: true,
      variant: "underlined",
      class: {
        trigger: "after:bg-danger"
      }
    },
    // size & labelPlacement
    {
      labelPlacement: "inside",
      size: "sm",
      class: {
        trigger: "h-12 min-h-12 py-1.5 px-3"
      }
    },
    {
      labelPlacement: "inside",
      size: "md",
      class: {
        trigger: "h-14 min-h-14 py-2"
      }
    },
    {
      labelPlacement: "inside",
      size: "lg",
      class: {
        label: "text-medium",
        trigger: "h-16 min-h-16 py-2.5 gap-0"
      }
    },
    {
      labelPlacement: "outside",
      isMultiline: false,
      class: {
        base: "group relative justify-end",
        label: ["pb-0", "z-20", "top-1/2", "-translate-y-1/2", "group-data-[filled=true]:start-0"]
      }
    },
    // labelPlacement=[inside]
    {
      labelPlacement: ["inside"],
      class: {
        label: "group-data-[filled=true]:scale-85"
      }
    },
    // inside & size
    {
      labelPlacement: "inside",
      size: ["sm", "md"],
      class: {
        label: "text-small"
      }
    },
    {
      labelPlacement: "inside",
      isMultiline: false,
      size: "sm",
      class: {
        label: [
          "group-data-[filled=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-tiny)/2_-_8px)]"
        ],
        innerWrapper: "group-data-[has-label=true]:pt-4"
      }
    },
    {
      labelPlacement: "inside",
      isMultiline: false,
      size: "md",
      class: {
        label: [
          "group-data-[filled=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_6px)]"
        ],
        innerWrapper: "group-data-[has-label=true]:pt-4"
      }
    },
    {
      labelPlacement: "inside",
      isMultiline: false,
      size: "lg",
      class: {
        label: [
          "text-medium",
          "group-data-[filled=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_8px)]"
        ],
        innerWrapper: "group-data-[has-label=true]:pt-5"
      }
    },
    // inside & size & [faded, bordered]
    {
      labelPlacement: "inside",
      variant: ["faded", "bordered"],
      isMultiline: false,
      size: "sm",
      class: {
        label: [
          "group-data-[filled=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-tiny)/2_-_8px_-_var(--heroui-border-width-medium))]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: ["faded", "bordered"],
      isMultiline: false,
      size: "md",
      class: {
        label: [
          "group-data-[filled=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_6px_-_var(--heroui-border-width-medium))]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: ["faded", "bordered"],
      isMultiline: false,
      size: "lg",
      class: {
        label: [
          "text-medium",
          "group-data-[filled=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_8px_-_var(--heroui-border-width-medium))]"
        ]
      }
    },
    // inside & size & underlined
    {
      labelPlacement: "inside",
      variant: "underlined",
      isMultiline: false,
      size: "sm",
      class: {
        label: [
          "group-data-[filled=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-tiny)/2_-_5px)]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: "underlined",
      isMultiline: false,
      size: "md",
      class: {
        label: [
          "group-data-[filled=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_3.5px)]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: "underlined",
      isMultiline: false,
      size: "lg",
      class: {
        label: [
          "text-medium",
          "group-data-[filled=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_4px)]"
        ]
      }
    },
    // outside & size
    {
      labelPlacement: "outside",
      size: "sm",
      isMultiline: false,
      class: {
        label: [
          "start-2",
          "text-tiny",
          "group-data-[filled=true]:-translate-y-[calc(100%_+var(--heroui-font-size-tiny)/2_+_16px)]",
          "group-data-[has-helper=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_26px)]"
        ],
        base: "data-[has-label=true]:mt-[calc(var(--heroui-font-size-small)_+_8px)]"
      }
    },
    {
      labelPlacement: "outside",
      isMultiline: false,
      size: "md",
      class: {
        label: [
          "start-3",
          "text-small",
          "group-data-[filled=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_20px)]",
          "group-data-[has-helper=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_30px)]"
        ],
        base: "data-[has-label=true]:mt-[calc(var(--heroui-font-size-small)_+_10px)]"
      }
    },
    {
      labelPlacement: "outside",
      isMultiline: false,
      size: "lg",
      class: {
        label: [
          "start-3",
          "text-medium",
          "group-data-[filled=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_24px)]",
          "group-data-[has-helper=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_34px)]"
        ],
        base: "data-[has-label=true]:mt-[calc(var(--heroui-font-size-small)_+_12px)]"
      }
    },
    // outside-left & size
    {
      labelPlacement: "outside-left",
      size: "sm",
      class: {
        label: "group-data-[has-helper=true]:pt-2"
      }
    },
    {
      labelPlacement: "outside-left",
      size: "md",
      class: {
        label: "group-data-[has-helper=true]:pt-3"
      }
    },
    {
      labelPlacement: "outside-left",
      size: "lg",
      class: {
        label: "group-data-[has-helper=true]:pt-4"
      }
    },
    // isMultiline & labelPlacement="outside"
    {
      labelPlacement: "outside",
      isMultiline: true,
      class: {
        label: "pb-1.5"
      }
    },
    // text truncate labelPlacement=[inside,outside]
    {
      labelPlacement: ["inside", "outside"],
      class: {
        label: ["pe-2", "max-w-full", "text-ellipsis", "overflow-hidden"]
      }
    },
    // isClearable & labelPlacement
    {
      labelPlacement: ["outside", "outside-left"],
      isClearable: true,
      class: {
        endContent: ["mt-4"],
        clearButton: ["group-data-[has-end-content=true]:mt-4"]
      }
    },
    {
      isClearable: false,
      labelPlacement: ["outside", "outside-left"],
      class: {
        endContent: ["mt-4"]
      }
    },
    // isClearable + variant
    {
      isClearable: true,
      variant: ["underlined"],
      class: {
        clearButton: ["relative group-data-[has-end-content=true]:left-2"],
        endContent: ["me-2"]
      }
    },
    {
      isClearable: false,
      variant: ["underlined"],
      class: {
        endContent: ["me-2"]
      }
    },
    // isClearable + size
    {
      isClearable: true,
      size: "sm",
      class: {
        endContent: "ms-2"
      }
    }
  ]
});
var slider = tv({
  slots: {
    base: "flex flex-col w-full gap-1",
    labelWrapper: "w-full flex justify-between items-center",
    label: "",
    value: "",
    step: [
      "h-1.5",
      "w-1.5",
      "absolute",
      "rounded-full",
      "bg-default-300/50",
      "data-[in-range=true]:bg-background/50"
    ],
    mark: [
      "absolute",
      "text-small",
      "cursor-default",
      "opacity-50",
      "data-[in-range=true]:opacity-100"
    ],
    trackWrapper: "relative flex gap-2",
    track: ["flex", "w-full", "relative", "rounded-full", "bg-default-300/50"],
    filler: "h-full absolute",
    thumb: [
      "flex",
      "justify-center",
      "items-center",
      "before:absolute",
      "before:w-11",
      "before:h-11",
      "before:rounded-full",
      "after:shadow-small",
      "after:shadow-small",
      "after:bg-background",
      "data-[focused=true]:z-10",
      dataFocusVisibleClasses
    ],
    startContent: [],
    endContent: []
  },
  variants: {
    size: {
      sm: {
        label: "text-small",
        value: "text-small",
        thumb: "w-5 h-5 after:w-4 after:h-4",
        step: "data-[in-range=false]:bg-default-200"
      },
      md: {
        thumb: "w-6 h-6 after:w-5 after:h-5",
        label: "text-small",
        value: "text-small"
      },
      lg: {
        thumb: "h-7 w-7 after:w-5 after:h-5",
        step: "w-2 h-2",
        label: "text-medium",
        value: "text-medium",
        mark: "mt-2"
      }
    },
    radius: {
      none: {
        thumb: "rounded-none after:rounded-none"
      },
      sm: {
        thumb: "rounded-[calc(var(--heroui-radius-small)/2)] after:rounded-[calc(var(--heroui-radius-small)/3)]"
      },
      md: {
        thumb: "rounded-[calc(var(--heroui-radius-medium)/2)] after:rounded-[calc(var(--heroui-radius-medium)/3)]"
      },
      lg: {
        thumb: "rounded-[calc(var(--heroui-radius-large)/1.5)] after:rounded-[calc(var(--heroui-radius-large)/2)]"
      },
      full: {
        thumb: "rounded-full after:rounded-full"
      }
    },
    color: {
      foreground: {
        filler: "bg-foreground",
        thumb: "bg-foreground"
      },
      primary: {
        filler: "bg-primary",
        thumb: "bg-primary"
      },
      secondary: {
        filler: "bg-secondary",
        thumb: "bg-secondary"
      },
      success: {
        filler: "bg-success",
        thumb: "bg-success"
      },
      warning: {
        filler: "bg-warning",
        thumb: "bg-warning"
      },
      danger: {
        filler: "bg-danger",
        thumb: "bg-danger"
      }
    },
    isVertical: {
      true: {
        base: "w-auto h-full flex-col-reverse items-center",
        trackWrapper: "flex-col h-full justify-center items-center",
        filler: "w-full h-auto",
        thumb: "left-1/2",
        track: "h-full border-y-transparent",
        labelWrapper: "flex-col justify-center items-center",
        step: ["left-1/2", "-translate-x-1/2", "translate-y-1/2"],
        mark: ["left-1/2", "ml-1", "translate-x-1/2", "translate-y-1/2"]
      },
      false: {
        thumb: "top-1/2",
        trackWrapper: "items-center",
        track: "border-x-transparent",
        step: ["top-1/2", "-translate-x-1/2", "-translate-y-1/2"],
        mark: ["top-1/2", "mt-1", "-translate-x-1/2", "translate-y-1/2"]
      }
    },
    isDisabled: {
      false: {
        thumb: ["cursor-grab", "data-[dragging=true]:cursor-grabbing"]
      },
      true: {
        base: "opacity-disabled",
        thumb: "cursor-default"
      }
    },
    hasMarks: {
      true: {
        base: "mb-5",
        mark: "cursor-pointer"
      },
      false: {}
    },
    showOutline: {
      true: {
        thumb: "ring-2 ring-background"
      },
      false: {
        thumb: "ring-transparent border-0"
      }
    },
    hideValue: {
      true: {
        value: "sr-only"
      }
    },
    hideThumb: {
      true: {
        thumb: "sr-only",
        track: "cursor-pointer"
      }
    },
    hasSingleThumb: {
      true: {},
      false: {}
    },
    disableAnimation: {
      true: {
        thumb: "data-[dragging=true]:after:scale-100"
      },
      false: {
        thumb: "after:transition-all motion-reduce:after:transition-none",
        mark: "transition-opacity motion-reduce:transition-none"
      }
    },
    disableThumbScale: {
      true: {},
      false: {
        thumb: "data-[dragging=true]:after:scale-80"
      }
    }
  },
  compoundVariants: [
    // size="sm" || size="md" && showOutline={false}
    {
      size: ["sm", "md"],
      showOutline: false,
      class: {
        thumb: "shadow-small"
      }
    },
    // size && color
    {
      size: "sm",
      color: "foreground",
      class: {
        step: "data-[in-range=true]:bg-foreground"
      }
    },
    {
      size: "sm",
      color: "primary",
      class: {
        step: "data-[in-range=true]:bg-primary"
      }
    },
    {
      size: "sm",
      color: "secondary",
      class: {
        step: "data-[in-range=true]:bg-secondary"
      }
    },
    {
      size: "sm",
      color: "success",
      class: {
        step: "data-[in-range=true]:bg-success"
      }
    },
    {
      size: "sm",
      color: "warning",
      class: {
        step: "data-[in-range=true]:bg-warning"
      }
    },
    {
      size: "sm",
      color: "danger",
      class: {
        step: "data-[in-range=true]:bg-danger"
      }
    },
    // size && !isVertical
    {
      size: "sm",
      isVertical: false,
      class: {
        track: "h-1 my-[calc((theme(spacing.5)-theme(spacing.1))/2)] border-x-[calc(theme(spacing.5)/2)]"
      }
    },
    {
      size: "md",
      isVertical: false,
      class: {
        track: "h-3 my-[calc((theme(spacing.6)-theme(spacing.3))/2)] border-x-[calc(theme(spacing.6)/2)]"
      }
    },
    {
      size: "lg",
      isVertical: false,
      class: {
        track: "h-7 my-[calc((theme(spacing.7)-theme(spacing.5))/2)] border-x-[calc(theme(spacing.7)/2)]"
      }
    },
    // size && isVertical
    {
      size: "sm",
      isVertical: true,
      class: {
        track: "w-1 mx-[calc((theme(spacing.5)-theme(spacing.1))/2)] border-y-[calc(theme(spacing.5)/2)]"
      }
    },
    {
      size: "md",
      isVertical: true,
      class: {
        track: "w-3 mx-[calc((theme(spacing.6)-theme(spacing.3))/2)] border-y-[calc(theme(spacing.6)/2)]"
      }
    },
    {
      size: "lg",
      isVertical: true,
      class: {
        track: "w-7 mx-[calc((theme(spacing.7)-theme(spacing.5))/2)] border-y-[calc(theme(spacing.7)/2)]"
      }
    },
    // color && !isVertical
    {
      color: "foreground",
      isVertical: false,
      class: {
        track: "data-[fill-start=true]:border-s-foreground data-[fill-end=true]:border-e-foreground"
      }
    },
    {
      color: "primary",
      isVertical: false,
      class: {
        track: "data-[fill-start=true]:border-s-primary data-[fill-end=true]:border-e-primary"
      }
    },
    {
      color: "secondary",
      isVertical: false,
      class: {
        track: "data-[fill-start=true]:border-s-secondary data-[fill-end=true]:border-e-secondary"
      }
    },
    {
      color: "success",
      isVertical: false,
      class: {
        track: "data-[fill-start=true]:border-s-success data-[fill-end=true]:border-e-success"
      }
    },
    {
      color: "warning",
      isVertical: false,
      class: {
        track: "data-[fill-start=true]:border-s-warning data-[fill-end=true]:border-e-warning"
      }
    },
    {
      color: "danger",
      isVertical: false,
      class: {
        track: "data-[fill-start=true]:border-s-danger data-[fill-end=true]:border-e-danger"
      }
    },
    // color && isVertical
    {
      color: "foreground",
      isVertical: true,
      class: {
        track: "data-[fill-start=true]:border-b-foreground data-[fill-end=true]:border-t-foreground"
      }
    },
    {
      color: "primary",
      isVertical: true,
      class: {
        track: "data-[fill-start=true]:border-b-primary data-[fill-end=true]:border-t-primary"
      }
    },
    {
      color: "secondary",
      isVertical: true,
      class: {
        track: "data-[fill-start=true]:border-b-secondary data-[fill-end=true]:border-t-secondary"
      }
    },
    {
      color: "success",
      isVertical: true,
      class: {
        track: "data-[fill-start=true]:border-b-success data-[fill-end=true]:border-t-success"
      }
    },
    {
      color: "warning",
      isVertical: true,
      class: {
        track: "data-[fill-start=true]:border-b-warning data-[fill-end=true]:border-t-warning"
      }
    },
    {
      color: "danger",
      isVertical: true,
      class: {
        track: "data-[fill-start=true]:border-b-danger data-[fill-end=true]:border-t-danger"
      }
    }
  ],
  defaultVariants: {
    size: "md",
    color: "primary",
    radius: "full",
    hideValue: false,
    hideThumb: false,
    isDisabled: false,
    disableThumbScale: false,
    showOutline: false
  }
});
var input = tv({
  slots: {
    base: "group flex flex-col data-[hidden=true]:hidden",
    label: [
      "absolute",
      "z-10",
      "pointer-events-none",
      "origin-top-left",
      "shrink-0",
      // Using RTL here as Tailwind CSS doesn't support `start` and `end` logical properties for transforms yet.
      "rtl:origin-top-right",
      "subpixel-antialiased",
      "block",
      "text-small",
      "text-foreground-500"
    ],
    mainWrapper: "h-full",
    inputWrapper: "relative w-full inline-flex tap-highlight-transparent flex-row items-center shadow-xs px-3 gap-3",
    innerWrapper: "inline-flex w-full items-center h-full box-border",
    input: [
      "w-full font-normal bg-transparent !outline-hidden placeholder:text-foreground-500 focus-visible:outline-hidden",
      "data-[has-start-content=true]:ps-1.5",
      "data-[has-end-content=true]:pe-1.5",
      "data-[type=color]:rounded-none",
      "file:cursor-pointer file:bg-transparent file:border-0",
      "autofill:bg-transparent bg-clip-text"
    ],
    clearButton: [
      "p-2",
      "-m-2",
      "z-10",
      "absolute",
      "end-3",
      "start-auto",
      "pointer-events-none",
      "appearance-none",
      "outline-hidden",
      "select-none",
      "opacity-0",
      "cursor-pointer",
      "active:!opacity-70",
      "rounded-full",
      // focus ring
      ...dataFocusVisibleClasses
    ],
    helperWrapper: "hidden group-data-[has-helper=true]:flex p-1 relative flex-col gap-1.5",
    description: "text-tiny text-foreground-400",
    errorMessage: "text-tiny text-danger"
  },
  variants: {
    variant: {
      flat: {
        inputWrapper: [
          "bg-default-100",
          "data-[hover=true]:bg-default-200",
          "group-data-[focus=true]:bg-default-100"
        ]
      },
      faded: {
        inputWrapper: [
          "bg-default-100",
          "border-medium",
          "border-default-200",
          "data-[hover=true]:border-default-400 focus-within:border-default-400"
        ],
        value: "group-data-[has-value=true]:text-default-foreground"
      },
      bordered: {
        inputWrapper: [
          "border-medium",
          "border-default-200",
          "data-[hover=true]:border-default-400",
          "group-data-[focus=true]:border-default-foreground"
        ]
      },
      underlined: {
        inputWrapper: [
          "!px-1",
          "!pb-0",
          "!gap-0",
          "relative",
          "box-border",
          "border-b-medium",
          "shadow-[0_1px_0px_0_rgba(0,0,0,0.05)]",
          "border-default-200",
          "!rounded-none",
          "hover:border-default-300",
          "after:content-['']",
          "after:w-0",
          "after:origin-center",
          "after:bg-default-foreground",
          "after:absolute",
          "after:left-1/2",
          "after:-translate-x-1/2",
          "after:-bottom-[2px]",
          "after:h-[2px]",
          "group-data-[focus=true]:after:w-full"
        ],
        innerWrapper: "pb-1",
        label: "group-data-[filled-within=true]:text-foreground"
      }
    },
    color: {
      default: {},
      primary: {},
      secondary: {},
      success: {},
      warning: {},
      danger: {}
    },
    size: {
      sm: {
        label: "text-tiny",
        inputWrapper: "h-8 min-h-8 px-2 rounded-small",
        input: "text-small",
        clearButton: "text-medium"
      },
      md: {
        inputWrapper: "h-10 min-h-10 rounded-medium",
        input: "text-small",
        clearButton: "text-large hover:!opacity-100"
      },
      lg: {
        label: "text-medium",
        inputWrapper: "h-12 min-h-12 rounded-large",
        input: "text-medium",
        clearButton: "text-large hover:!opacity-100"
      }
    },
    radius: {
      none: {
        inputWrapper: "rounded-none"
      },
      sm: {
        inputWrapper: "rounded-small"
      },
      md: {
        inputWrapper: "rounded-medium"
      },
      lg: {
        inputWrapper: "rounded-large"
      },
      full: {
        inputWrapper: "rounded-full"
      }
    },
    labelPlacement: {
      outside: {
        mainWrapper: "flex flex-col"
      },
      "outside-left": {
        base: "flex-row items-center flex-nowrap data-[has-helper=true]:items-start",
        inputWrapper: "flex-1",
        mainWrapper: "flex flex-col",
        label: "relative text-foreground pe-2 ps-2 pointer-events-auto"
      },
      "outside-top": {
        mainWrapper: "flex flex-col",
        label: "relative text-foreground pb-2 pointer-events-auto"
      },
      inside: {
        label: "cursor-text",
        inputWrapper: "flex-col items-start justify-center gap-0",
        innerWrapper: "group-data-[has-label=true]:items-end"
      }
    },
    fullWidth: {
      true: {
        base: "w-full"
      },
      false: {}
    },
    isClearable: {
      true: {
        input: "peer pe-6 input-search-cancel-button-none",
        clearButton: [
          "peer-data-[filled=true]:pointer-events-auto",
          "peer-data-[filled=true]:opacity-70 peer-data-[filled=true]:block",
          "peer-data-[filled=true]:scale-100"
        ]
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none",
        inputWrapper: "pointer-events-none",
        label: "pointer-events-none"
      }
    },
    isInvalid: {
      true: {
        label: "!text-danger",
        input: "!placeholder:text-danger !text-danger"
      }
    },
    isRequired: {
      true: {
        label: "after:content-['*'] after:text-danger after:ms-0.5"
      }
    },
    isMultiline: {
      true: {
        label: "relative",
        inputWrapper: "!h-auto",
        innerWrapper: "items-start group-data-[has-label=true]:items-start",
        input: "resize-none data-[hide-scroll=true]:scrollbar-hide",
        clearButton: "absolute top-2 right-2 rtl:right-auto rtl:left-2 z-10"
      }
    },
    disableAnimation: {
      true: {
        input: "transition-none",
        inputWrapper: "transition-none",
        label: "transition-none"
      },
      false: {
        inputWrapper: "transition-background motion-reduce:transition-none !duration-150",
        label: [
          "will-change-auto",
          "!duration-200",
          "!ease-out",
          "motion-reduce:transition-none",
          "transition-[transform,color,left,opacity,translate,scale]"
        ],
        clearButton: [
          "scale-90",
          "ease-out",
          "duration-150",
          "transition-[opacity,transform]",
          "motion-reduce:transition-none",
          "motion-reduce:scale-100"
        ]
      }
    }
  },
  defaultVariants: {
    variant: "flat",
    color: "default",
    size: "md",
    fullWidth: true,
    isDisabled: false,
    isMultiline: false
  },
  compoundVariants: [
    // flat & color
    {
      variant: "flat",
      color: "default",
      class: {
        input: "group-data-[has-value=true]:text-default-foreground"
      }
    },
    {
      variant: "flat",
      color: "primary",
      class: {
        inputWrapper: [
          "bg-primary-100",
          "data-[hover=true]:bg-primary-50",
          "text-primary",
          "group-data-[focus=true]:bg-primary-50",
          "placeholder:text-primary"
        ],
        input: "placeholder:text-primary",
        label: "text-primary"
      }
    },
    {
      variant: "flat",
      color: "secondary",
      class: {
        inputWrapper: [
          "bg-secondary-100",
          "text-secondary",
          "data-[hover=true]:bg-secondary-50",
          "group-data-[focus=true]:bg-secondary-50",
          "placeholder:text-secondary"
        ],
        input: "placeholder:text-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "flat",
      color: "success",
      class: {
        inputWrapper: [
          "bg-success-100",
          "text-success-600",
          "dark:text-success",
          "placeholder:text-success-600",
          "dark:placeholder:text-success",
          "data-[hover=true]:bg-success-50",
          "group-data-[focus=true]:bg-success-50"
        ],
        input: "placeholder:text-success-600 dark:placeholder:text-success",
        label: "text-success-600 dark:text-success"
      }
    },
    {
      variant: "flat",
      color: "warning",
      class: {
        inputWrapper: [
          "bg-warning-100",
          "text-warning-600",
          "dark:text-warning",
          "placeholder:text-warning-600",
          "dark:placeholder:text-warning",
          "data-[hover=true]:bg-warning-50",
          "group-data-[focus=true]:bg-warning-50"
        ],
        input: "placeholder:text-warning-600 dark:placeholder:text-warning",
        label: "text-warning-600 dark:text-warning"
      }
    },
    {
      variant: "flat",
      color: "danger",
      class: {
        inputWrapper: [
          "bg-danger-100",
          "text-danger",
          "dark:text-danger-500",
          "placeholder:text-danger",
          "dark:placeholder:text-danger-500",
          "data-[hover=true]:bg-danger-50",
          "group-data-[focus=true]:bg-danger-50"
        ],
        input: "placeholder:text-danger dark:placeholder:text-danger-500",
        label: "text-danger dark:text-danger-500"
      }
    },
    // faded & color
    {
      variant: "faded",
      color: "primary",
      class: {
        label: "text-primary",
        inputWrapper: "data-[hover=true]:border-primary focus-within:border-primary"
      }
    },
    {
      variant: "faded",
      color: "secondary",
      class: {
        label: "text-secondary",
        inputWrapper: "data-[hover=true]:border-secondary focus-within:border-secondary"
      }
    },
    {
      variant: "faded",
      color: "success",
      class: {
        label: "text-success",
        inputWrapper: "data-[hover=true]:border-success focus-within:border-success"
      }
    },
    {
      variant: "faded",
      color: "warning",
      class: {
        label: "text-warning",
        inputWrapper: "data-[hover=true]:border-warning focus-within:border-warning"
      }
    },
    {
      variant: "faded",
      color: "danger",
      class: {
        label: "text-danger",
        inputWrapper: "data-[hover=true]:border-danger focus-within:border-danger"
      }
    },
    // underlined & color
    {
      variant: "underlined",
      color: "default",
      class: {
        input: "group-data-[has-value=true]:text-foreground"
      }
    },
    {
      variant: "underlined",
      color: "primary",
      class: {
        inputWrapper: "after:bg-primary",
        label: "text-primary"
      }
    },
    {
      variant: "underlined",
      color: "secondary",
      class: {
        inputWrapper: "after:bg-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "underlined",
      color: "success",
      class: {
        inputWrapper: "after:bg-success",
        label: "text-success"
      }
    },
    {
      variant: "underlined",
      color: "warning",
      class: {
        inputWrapper: "after:bg-warning",
        label: "text-warning"
      }
    },
    {
      variant: "underlined",
      color: "danger",
      class: {
        inputWrapper: "after:bg-danger",
        label: "text-danger"
      }
    },
    // bordered & color
    {
      variant: "bordered",
      color: "primary",
      class: {
        inputWrapper: "group-data-[focus=true]:border-primary",
        label: "text-primary"
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        inputWrapper: "group-data-[focus=true]:border-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        inputWrapper: "group-data-[focus=true]:border-success",
        label: "text-success"
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        inputWrapper: "group-data-[focus=true]:border-warning",
        label: "text-warning"
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        inputWrapper: "group-data-[focus=true]:border-danger",
        label: "text-danger"
      }
    },
    // labelPlacement=inside & default
    {
      labelPlacement: "inside",
      color: "default",
      class: {
        label: "group-data-[filled-within=true]:text-default-600"
      }
    },
    // labelPlacement=outside & default
    {
      labelPlacement: "outside",
      color: "default",
      class: {
        label: "group-data-[filled-within=true]:text-foreground"
      }
    },
    // radius-full & size
    {
      radius: "full",
      size: ["sm"],
      class: {
        inputWrapper: "px-3"
      }
    },
    {
      radius: "full",
      size: "md",
      class: {
        inputWrapper: "px-4"
      }
    },
    {
      radius: "full",
      size: "lg",
      class: {
        inputWrapper: "px-5"
      }
    },
    // !disableAnimation & variant
    {
      disableAnimation: false,
      variant: ["faded", "bordered"],
      class: {
        inputWrapper: "transition-colors motion-reduce:transition-none"
      }
    },
    {
      disableAnimation: false,
      variant: "underlined",
      class: {
        inputWrapper: "after:transition-width motion-reduce:after:transition-none"
      }
    },
    // flat & faded
    {
      variant: ["flat", "faded"],
      class: {
        inputWrapper: [
          // focus ring
          ...groupDataFocusVisibleClasses
        ]
      }
    },
    // isInvalid & variant
    {
      isInvalid: true,
      variant: "flat",
      class: {
        inputWrapper: [
          "!bg-danger-50",
          "data-[hover=true]:!bg-danger-100",
          "group-data-[focus=true]:!bg-danger-50"
        ]
      }
    },
    {
      isInvalid: true,
      variant: "bordered",
      class: {
        inputWrapper: "!border-danger group-data-[focus=true]:!border-danger"
      }
    },
    {
      isInvalid: true,
      variant: "underlined",
      class: {
        inputWrapper: "after:!bg-danger"
      }
    },
    // size & labelPlacement
    {
      labelPlacement: "inside",
      size: "sm",
      class: {
        inputWrapper: "h-12 py-1.5 px-3"
      }
    },
    {
      labelPlacement: "inside",
      size: "md",
      class: {
        inputWrapper: "h-14 py-2"
      }
    },
    {
      labelPlacement: "inside",
      size: "lg",
      class: {
        inputWrapper: "h-16 py-2.5 gap-0"
      }
    },
    // size & labelPlacement & variant=[faded, bordered]
    {
      labelPlacement: "inside",
      size: "sm",
      variant: ["bordered", "faded"],
      class: {
        inputWrapper: "py-1"
      }
    },
    // labelPlacement=[inside,outside]
    {
      labelPlacement: ["inside", "outside"],
      class: {
        label: ["group-data-[filled-within=true]:pointer-events-auto"]
      }
    },
    // labelPlacement=[outside] & isMultiline
    {
      labelPlacement: "outside",
      isMultiline: false,
      class: {
        base: "relative justify-end",
        label: [
          "pb-0",
          "z-20",
          "top-1/2",
          "-translate-y-1/2",
          "group-data-[filled-within=true]:start-0"
        ]
      }
    },
    // labelPlacement=[inside]
    {
      labelPlacement: ["inside"],
      class: {
        label: ["group-data-[filled-within=true]:scale-85"]
      }
    },
    // labelPlacement=[inside] & variant=flat
    {
      labelPlacement: ["inside"],
      variant: "flat",
      class: {
        innerWrapper: "pb-0.5"
      }
    },
    // variant=underlined & size
    {
      variant: "underlined",
      size: "sm",
      class: {
        innerWrapper: "pb-1"
      }
    },
    {
      variant: "underlined",
      size: ["md", "lg"],
      class: {
        innerWrapper: "pb-1.5"
      }
    },
    // inside & size
    {
      labelPlacement: "inside",
      size: ["sm", "md"],
      class: {
        label: "text-small"
      }
    },
    {
      labelPlacement: "inside",
      isMultiline: false,
      size: "sm",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-tiny)/2_-_8px)]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      isMultiline: false,
      size: "md",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_6px)]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      isMultiline: false,
      size: "lg",
      class: {
        label: [
          "text-medium",
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_8px)]"
        ]
      }
    },
    // inside & size & [faded, bordered]
    {
      labelPlacement: "inside",
      variant: ["faded", "bordered"],
      isMultiline: false,
      size: "sm",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-tiny)/2_-_8px_-_var(--heroui-border-width-medium))]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: ["faded", "bordered"],
      isMultiline: false,
      size: "md",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_6px_-_var(--heroui-border-width-medium))]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: ["faded", "bordered"],
      isMultiline: false,
      size: "lg",
      class: {
        label: [
          "text-medium",
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_8px_-_var(--heroui-border-width-medium))]"
        ]
      }
    },
    // inside & size & underlined
    {
      labelPlacement: "inside",
      variant: "underlined",
      isMultiline: false,
      size: "sm",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-tiny)/2_-_5px)]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: "underlined",
      isMultiline: false,
      size: "md",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_3.5px)]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: "underlined",
      size: "lg",
      isMultiline: false,
      class: {
        label: [
          "text-medium",
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_4px)]"
        ]
      }
    },
    // outside & size
    {
      labelPlacement: "outside",
      size: "sm",
      isMultiline: false,
      class: {
        label: [
          "start-2",
          "text-tiny",
          "group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-tiny)/2_+_16px)]"
        ],
        base: "data-[has-label=true]:mt-[calc(var(--heroui-font-size-small)_+_8px)]"
      }
    },
    {
      labelPlacement: "outside",
      size: "md",
      isMultiline: false,
      class: {
        label: [
          "start-3",
          "end-auto",
          "text-small",
          "group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_20px)]"
        ],
        base: "data-[has-label=true]:mt-[calc(var(--heroui-font-size-small)_+_10px)]"
      }
    },
    {
      labelPlacement: "outside",
      size: "lg",
      isMultiline: false,
      class: {
        label: [
          "start-3",
          "end-auto",
          "text-medium",
          "group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_24px)]"
        ],
        base: "data-[has-label=true]:mt-[calc(var(--heroui-font-size-small)_+_12px)]"
      }
    },
    // outside-left & size & hasHelper
    {
      labelPlacement: "outside-left",
      size: "sm",
      class: {
        label: "group-data-[has-helper=true]:pt-2"
      }
    },
    {
      labelPlacement: "outside-left",
      size: "md",
      class: {
        label: "group-data-[has-helper=true]:pt-3"
      }
    },
    {
      labelPlacement: "outside-left",
      size: "lg",
      class: {
        label: "group-data-[has-helper=true]:pt-4"
      }
    },
    // labelPlacement=[outside, outside-left] & isMultiline
    {
      labelPlacement: ["outside", "outside-left"],
      isMultiline: true,
      class: {
        inputWrapper: "py-2"
      }
    },
    // isMultiline & labelPlacement="outside"
    {
      labelPlacement: "outside",
      isMultiline: true,
      class: {
        label: "pb-1.5"
      }
    },
    // isMultiline & labelPlacement="inside"
    {
      labelPlacement: "inside",
      isMultiline: true,
      class: {
        label: "pb-0.5",
        input: "pt-0"
      }
    },
    // isMultiline & !disableAnimation
    {
      isMultiline: true,
      disableAnimation: false,
      class: {
        input: "transition-height !duration-100 motion-reduce:transition-none"
      }
    },
    // text truncate labelPlacement=[inside,outside]
    {
      labelPlacement: ["inside", "outside"],
      class: {
        label: ["pe-2", "max-w-full", "text-ellipsis", "overflow-hidden"]
      }
    },
    // isMultiline & radius=full
    {
      isMultiline: true,
      radius: "full",
      class: {
        inputWrapper: "data-[has-multiple-rows=true]:rounded-large"
      }
    },
    // isClearable & isMultiline
    {
      isClearable: true,
      isMultiline: true,
      class: {
        clearButton: [
          "group-data-[has-value=true]:opacity-70 group-data-[has-value=true]:block",
          "group-data-[has-value=true]:scale-100",
          "group-data-[has-value=true]:pointer-events-auto"
        ]
      }
    }
  ]
});
var kbd = tv({
  slots: {
    base: [
      "px-1.5",
      "py-0.5",
      "inline-flex",
      "space-x-0.5",
      "rtl:space-x-reverse",
      "items-center",
      "font-sans",
      "font-normal",
      "text-center",
      "text-small",
      "shadow-small",
      "bg-default-100",
      "text-foreground-600",
      "rounded-small"
    ],
    abbr: "no-underline",
    content: ""
  },
  variants: {},
  defaultVariants: {}
});
var link$1 = tv({
  base: [
    "relative inline-flex items-center outline-hidden tap-highlight-transparent",
    // focus ring
    ...dataFocusVisibleClasses
  ],
  variants: {
    size: {
      sm: "text-small",
      md: "text-medium",
      lg: "text-large"
    },
    color: {
      foreground: "text-foreground",
      primary: "text-primary",
      secondary: "text-secondary",
      success: "text-success",
      warning: "text-warning",
      danger: "text-danger"
    },
    underline: {
      none: "no-underline",
      hover: "hover:underline",
      always: "underline",
      active: "active:underline",
      focus: "focus:underline"
    },
    isBlock: {
      true: [
        "px-2",
        "py-1",
        "hover:after:opacity-100",
        "after:content-['']",
        "after:inset-0",
        "after:opacity-0",
        "after:w-full",
        "after:h-full",
        "after:rounded-xl",
        "after:transition-background",
        "after:absolute"
      ],
      false: "hover:opacity-hover active:opacity-disabled transition-opacity"
    },
    isDisabled: {
      true: "opacity-disabled cursor-default pointer-events-none"
    },
    disableAnimation: {
      true: "after:transition-none transition-none"
    }
  },
  compoundVariants: [
    {
      isBlock: true,
      color: "foreground",
      class: "hover:after:bg-foreground/10"
    },
    {
      isBlock: true,
      color: "primary",
      class: "hover:after:bg-primary/20"
    },
    {
      isBlock: true,
      color: "secondary",
      class: "hover:after:bg-secondary/20"
    },
    {
      isBlock: true,
      color: "success",
      class: "hover:after:bg-success/20"
    },
    {
      isBlock: true,
      color: "warning",
      class: "hover:after:bg-warning/20"
    },
    {
      isBlock: true,
      color: "danger",
      class: "hover:after:bg-danger/20"
    },
    {
      underline: ["hover", "always", "active", "focus"],
      class: "underline-offset-4"
    }
  ],
  defaultVariants: {
    color: "primary",
    size: "md",
    isBlock: false,
    underline: "none",
    isDisabled: false
  }
});
var linkAnchorClasses = "flex mx-1 text-current self-center";
var menu$1 = tv({
  slots: {
    base: "w-full relative flex flex-col gap-1 p-1 overflow-clip",
    list: "w-full flex flex-col gap-0.5 outline-hidden",
    emptyContent: [
      "h-10",
      "px-2",
      "py-1.5",
      "w-full",
      "h-full",
      "text-foreground-400",
      "text-start"
    ]
  }
});
var menuItem = tv({
  slots: {
    base: [
      "flex",
      "group",
      "gap-2",
      "items-center",
      "justify-between",
      "relative",
      "px-2",
      "py-1.5",
      "w-full",
      "h-full",
      "box-border",
      "rounded-small",
      "subpixel-antialiased",
      "outline-hidden",
      "cursor-pointer",
      "tap-highlight-transparent",
      // focus ring
      ...dataFocusVisibleClasses,
      "data-[focus-visible=true]:dark:ring-offset-background-content1"
    ],
    wrapper: "w-full flex flex-col items-start justify-center",
    title: "flex-1 text-small font-normal",
    description: ["w-full", "text-tiny", "text-foreground-500", "group-hover:text-current"],
    selectedIcon: ["text-inherit", "w-3", "h-3", "shrink-0"],
    shortcut: [
      "px-1",
      "py-0.5",
      "rounded-sm",
      "font-sans",
      "text-foreground-500",
      "text-tiny",
      "border-small",
      "border-default-300",
      "group-hover:border-current"
    ]
  },
  variants: {
    variant: {
      solid: {
        base: ""
      },
      bordered: {
        base: "border-medium border-transparent bg-transparent"
      },
      light: {
        base: "bg-transparent"
      },
      faded: {
        base: [
          "border-small border-transparent hover:border-default data-[hover=true]:bg-default-100",
          "data-[selectable=true]:focus:border-default data-[selectable=true]:focus:bg-default-100"
        ]
      },
      flat: {
        base: ""
      },
      shadow: {
        base: "data-[hover=true]:shadow-lg"
      }
    },
    color: {
      default: {},
      primary: {},
      secondary: {},
      success: {},
      warning: {},
      danger: {}
    },
    showDivider: {
      true: {
        base: [
          "mb-1.5",
          "after:content-['']",
          "after:absolute",
          "after:-bottom-1",
          "after:left-0",
          "after:right-0",
          "after:h-divider",
          "after:bg-divider"
        ]
      },
      false: {}
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none"
      }
    },
    disableAnimation: {
      true: {},
      false: {
        base: "data-[hover=true]:transition-colors"
      }
    },
    // If the child isn't a string, the truncate such as `overflow, white-space, text-overflow` css won't be extended to the child, so we remove the truncate class here
    hasTitleTextChild: {
      true: {
        title: "truncate"
      }
    },
    hasDescriptionTextChild: {
      true: {
        description: "truncate"
      }
    }
  },
  defaultVariants: {
    variant: "solid",
    color: "default",
    showDivider: false
  },
  compoundVariants: [
    // solid / color
    {
      variant: "solid",
      color: "default",
      class: {
        base: [
          "data-[hover=true]:bg-default",
          "data-[hover=true]:text-default-foreground",
          "data-[selectable=true]:focus:bg-default",
          "data-[selectable=true]:focus:text-default-foreground"
        ]
      }
    },
    {
      variant: "solid",
      color: "primary",
      class: {
        base: [
          "data-[hover=true]:bg-primary data-[hover=true]:text-primary-foreground",
          "data-[selectable=true]:focus:bg-primary data-[selectable=true]:focus:text-primary-foreground"
        ]
      }
    },
    {
      variant: "solid",
      color: "secondary",
      class: {
        base: [
          "data-[hover=true]:bg-secondary data-[hover=true]:text-secondary-foreground",
          "data-[selectable=true]:focus:bg-secondary data-[selectable=true]:focus:text-secondary-foreground"
        ]
      }
    },
    {
      variant: "solid",
      color: "success",
      class: {
        base: [
          "data-[hover=true]:bg-success data-[hover=true]:text-success-foreground",
          "data-[selectable=true]:focus:bg-success data-[selectable=true]:focus:text-success-foreground"
        ]
      }
    },
    {
      variant: "solid",
      color: "warning",
      class: {
        base: [
          "data-[hover=true]:bg-warning data-[hover=true]:text-warning-foreground",
          "data-[selectable=true]:focus:bg-warning data-[selectable=true]:focus:text-warning-foreground"
        ]
      }
    },
    {
      variant: "solid",
      color: "danger",
      class: {
        base: [
          "data-[hover=true]:bg-danger data-[hover=true]:text-danger-foreground",
          "data-[selectable=true]:focus:bg-danger data-[selectable=true]:focus:text-danger-foreground"
        ]
      }
    },
    // shadow / color
    {
      variant: "shadow",
      color: "default",
      class: {
        base: [
          "data-[hover=true]:shadow-default/50 data-[hover=true]:bg-default data-[hover=true]:text-default-foreground",
          "data-[selectable=true]:focus:shadow-default/50 data-[selectable=true]:focus:bg-default data-[selectable=true]:focus:text-default-foreground"
        ]
      }
    },
    {
      variant: "shadow",
      color: "primary",
      class: {
        base: [
          "data-[hover=true]:shadow-primary/30 data-[hover=true]:bg-primary data-[hover=true]:text-primary-foreground",
          "data-[selectable=true]:focus:shadow-primary/30 data-[selectable=true]:focus:bg-primary data-[selectable=true]:focus:text-primary-foreground"
        ]
      }
    },
    {
      variant: "shadow",
      color: "secondary",
      class: {
        base: [
          "data-[hover=true]:shadow-secondary/30 data-[hover=true]:bg-secondary data-[hover=true]:text-secondary-foreground",
          "data-[selectable=true]:focus:shadow-secondary/30 data-[selectable=true]:focus:bg-secondary data-[selectable=true]:focus:text-secondary-foreground"
        ]
      }
    },
    {
      variant: "shadow",
      color: "success",
      class: {
        base: [
          "data-[hover=true]:shadow-success/30 data-[hover=true]:bg-success data-[hover=true]:text-success-foreground",
          "data-[selectable=true]:focus:shadow-success/30 data-[selectable=true]:focus:bg-success data-[selectable=true]:focus:text-success-foreground"
        ]
      }
    },
    {
      variant: "shadow",
      color: "warning",
      class: {
        base: [
          "data-[hover=true]:shadow-warning/30 data-[hover=true]:bg-warning data-[hover=true]:text-warning-foreground",
          "data-[selectable=true]:focus:shadow-warning/30 data-[selectable=true]:focus:bg-warning data-[selectable=true]:focus:text-warning-foreground"
        ]
      }
    },
    {
      variant: "shadow",
      color: "danger",
      class: {
        base: [
          "data-[hover=true]:shadow-danger/30 data-[hover=true]:bg-danger data-[hover=true]:text-danger-foreground",
          "data-[selectable=true]:focus:shadow-danger/30 data-[selectable=true]:focus:bg-danger data-[selectable=true]:focus:text-danger-foreground"
        ]
      }
    },
    // bordered / color
    {
      variant: "bordered",
      color: "default",
      class: {
        base: ["data-[hover=true]:border-default", "data-[selectable=true]:focus:border-default"]
      }
    },
    {
      variant: "bordered",
      color: "primary",
      class: {
        base: [
          "data-[hover=true]:border-primary data-[hover=true]:text-primary",
          "data-[selectable=true]:focus:border-primary data-[selectable=true]:focus:text-primary"
        ]
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        base: [
          "data-[hover=true]:border-secondary data-[hover=true]:text-secondary",
          "data-[selectable=true]:focus:border-secondary data-[selectable=true]:focus:text-secondary"
        ]
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        base: [
          "data-[hover=true]:border-success data-[hover=true]:text-success",
          "data-[selectable=true]:focus:border-success data-[selectable=true]:focus:text-success"
        ]
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        base: [
          "data-[hover=true]:border-warning data-[hover=true]:text-warning",
          "data-[selectable=true]:focus:border-warning data-[selectable=true]:focus:text-warning"
        ]
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        base: [
          "data-[hover=true]:border-danger data-[hover=true]:text-danger",
          "data-[selectable=true]:focus:border-danger data-[selectable=true]:focus:text-danger"
        ]
      }
    },
    // flat / color
    {
      variant: "flat",
      color: "default",
      class: {
        base: [
          "data-[hover=true]:bg-default/40",
          "data-[hover=true]:text-default-foreground",
          "data-[selectable=true]:focus:bg-default/40",
          "data-[selectable=true]:focus:text-default-foreground"
        ]
      }
    },
    {
      variant: "flat",
      color: "primary",
      class: {
        base: [
          "data-[hover=true]:bg-primary/20 data-[hover=true]:text-primary",
          "data-[selectable=true]:focus:bg-primary/20 data-[selectable=true]:focus:text-primary"
        ]
      }
    },
    {
      variant: "flat",
      color: "secondary",
      class: {
        base: [
          "data-[hover=true]:bg-secondary/20 data-[hover=true]:text-secondary",
          "data-[selectable=true]:focus:bg-secondary/20 data-[selectable=true]:focus:text-secondary"
        ]
      }
    },
    {
      variant: "flat",
      color: "success",
      class: {
        base: [
          "data-[hover=true]:bg-success/20 data-[hover=true]:text-success",
          "data-[selectable=true]:focus:bg-success/20 data-[selectable=true]:focus:text-success"
        ]
      }
    },
    {
      variant: "flat",
      color: "warning",
      class: {
        base: [
          "data-[hover=true]:bg-warning/20 data-[hover=true]:text-warning",
          "data-[selectable=true]:focus:bg-warning/20 data-[selectable=true]:focus:text-warning"
        ]
      }
    },
    {
      variant: "flat",
      color: "danger",
      class: {
        base: [
          "data-[hover=true]:bg-danger/20 data-[hover=true]:text-danger",
          "data-[selectable=true]:focus:bg-danger/20 data-[selectable=true]:focus:text-danger"
        ]
      }
    },
    // faded / color
    {
      variant: "faded",
      color: "default",
      class: {
        base: [
          "data-[hover=true]:text-default-foreground",
          "data-[selectable=true]:focus:text-default-foreground"
        ]
      }
    },
    {
      variant: "faded",
      color: "primary",
      class: {
        base: ["data-[hover=true]:text-primary", "data-[selectable=true]:focus:text-primary"]
      }
    },
    {
      variant: "faded",
      color: "secondary",
      class: {
        base: ["data-[hover=true]:text-secondary", "data-[selectable=true]:focus:text-secondary"]
      }
    },
    {
      variant: "faded",
      color: "success",
      class: {
        base: ["data-[hover=true]:text-success", "data-[selectable=true]:focus:text-success"]
      }
    },
    {
      variant: "faded",
      color: "warning",
      class: {
        base: ["data-[hover=true]:text-warning", "data-[selectable=true]:focus:text-warning"]
      }
    },
    {
      variant: "faded",
      color: "danger",
      class: {
        base: ["data-[hover=true]:text-danger", "data-[selectable=true]:focus:text-danger"]
      }
    },
    // light / color
    {
      variant: "light",
      color: "default",
      class: {
        base: [
          "data-[hover=true]:text-default-500",
          "data-[selectable=true]:focus:text-default-500"
        ]
      }
    },
    {
      variant: "light",
      color: "primary",
      class: {
        base: ["data-[hover=true]:text-primary", "data-[selectable=true]:focus:text-primary"]
      }
    },
    {
      variant: "light",
      color: "secondary",
      class: {
        base: ["data-[hover=true]:text-secondary", "data-[selectable=true]:focus:text-secondary"]
      }
    },
    {
      variant: "light",
      color: "success",
      class: {
        base: ["data-[hover=true]:text-success", "data-[selectable=true]:focus:text-success"]
      }
    },
    {
      variant: "light",
      color: "warning",
      class: {
        base: ["data-[hover=true]:text-warning", "data-[selectable=true]:focus:text-warning"]
      }
    },
    {
      variant: "light",
      color: "danger",
      class: {
        base: ["data-[hover=true]:text-danger", "data-[selectable=true]:focus:text-danger"]
      }
    }
  ]
});
var menuSection = tv({
  slots: {
    base: "relative mb-2",
    heading: "pl-1 text-tiny text-foreground-500",
    group: "data-[has-title=true]:pt-1",
    divider: "mt-2"
  }
});
var modal = tv({
  slots: {
    wrapper: [
      "flex",
      "w-screen",
      "h-[100dvh]",
      "fixed",
      "inset-0",
      "z-50",
      "overflow-x-auto",
      "justify-center",
      "h-[--visual-viewport-height]"
    ],
    base: [
      "flex",
      "flex-col",
      "relative",
      "bg-white",
      "z-50",
      "w-full",
      "box-border",
      "bg-content1",
      "outline-hidden",
      "mx-1",
      "my-1",
      "sm:mx-6",
      "sm:my-16"
    ],
    backdrop: "z-50",
    header: "flex py-4 px-6 flex-initial text-large font-semibold",
    body: "flex flex-1 flex-col gap-3 px-6 py-2",
    footer: "flex flex-row gap-2 px-6 py-4 justify-end",
    closeButton: [
      "absolute",
      "appearance-none",
      "outline-hidden",
      "select-none",
      "top-1",
      "end-1",
      "p-2",
      "text-foreground-500",
      "rounded-full",
      "hover:bg-default-100",
      "active:bg-default-200",
      "tap-highlight-transparent",
      // focus ring
      ...dataFocusVisibleClasses
    ]
  },
  variants: {
    size: {
      xs: {
        base: "max-w-xs"
      },
      sm: {
        base: "max-w-sm"
      },
      md: {
        base: "max-w-md"
      },
      lg: {
        base: "max-w-lg"
      },
      xl: {
        base: "max-w-xl"
      },
      "2xl": {
        base: "max-w-2xl"
      },
      "3xl": {
        base: "max-w-3xl"
      },
      "4xl": {
        base: "max-w-4xl"
      },
      "5xl": {
        base: "max-w-5xl"
      },
      full: {
        base: "my-0 mx-0 sm:mx-0 sm:my-0 max-w-full h-[100dvh] min-h-[100dvh] !rounded-none"
      }
    },
    radius: {
      none: { base: "rounded-none" },
      sm: { base: "rounded-small" },
      md: { base: "rounded-medium" },
      lg: { base: "rounded-large" }
    },
    placement: {
      auto: {
        wrapper: "items-end sm:items-center"
      },
      center: {
        wrapper: "items-center sm:items-center"
      },
      top: {
        wrapper: "items-start sm:items-start"
      },
      "top-center": {
        wrapper: "items-start sm:items-center"
      },
      bottom: {
        wrapper: "items-end sm:items-end"
      },
      "bottom-center": {
        wrapper: "items-end sm:items-center"
      }
    },
    shadow: {
      none: {
        base: "shadow-none"
      },
      sm: {
        base: "shadow-small"
      },
      md: {
        base: "shadow-medium"
      },
      lg: {
        base: "shadow-large"
      }
    },
    backdrop: {
      transparent: {
        backdrop: "hidden"
      },
      opaque: {
        backdrop: "bg-overlay/50 backdrop-opacity-disabled"
      },
      blur: {
        backdrop: "backdrop-blur-md backdrop-saturate-150 bg-overlay/30"
      }
    },
    scrollBehavior: {
      normal: {
        base: "overflow-y-hidden"
      },
      inside: {
        base: "max-h-[calc(100%_-_8rem)]",
        body: "overflow-y-auto"
      },
      outside: {
        wrapper: "items-start sm:items-start overflow-y-auto",
        base: "my-16"
      }
    },
    disableAnimation: {
      false: {
        wrapper: [
          //  mobile animation vars
          "[--scale-enter:100%]",
          "[--scale-exit:100%]",
          "[--slide-enter:0px]",
          "[--slide-exit:80px]",
          // tablet/desktop animation vars
          "sm:[--scale-enter:100%]",
          "sm:[--scale-exit:103%]",
          "sm:[--slide-enter:0px]",
          "sm:[--slide-exit:0px]"
        ]
      }
    }
  },
  defaultVariants: {
    size: "md",
    radius: "lg",
    shadow: "sm",
    placement: "auto",
    backdrop: "opaque",
    scrollBehavior: "normal"
  },
  compoundVariants: [
    // backdrop (opaque/blur)
    {
      backdrop: ["opaque", "blur"],
      class: {
        backdrop: "w-screen h-screen fixed inset-0"
      }
    }
  ]
});
var numberInput = tv({
  slots: {
    base: "group flex flex-col data-[hidden=true]:hidden",
    label: [
      "absolute",
      "z-10",
      "pointer-events-none",
      "origin-top-left",
      "flex-shrink-0",
      // Using RTL here as Tailwind CSS doesn't support `start` and `end` logical properties for transforms yet.
      "rtl:origin-top-right",
      "subpixel-antialiased",
      "block",
      "text-small",
      "text-foreground-500"
    ],
    mainWrapper: "h-full",
    inputWrapper: "relative w-full inline-flex tap-highlight-transparent flex-row items-center shadow-sm px-3 gap-3",
    innerWrapper: "inline-flex w-full items-center h-full box-border",
    input: [
      "w-full font-normal bg-transparent !outline-hidden placeholder:text-foreground-500 focus-visible:outline-hidden",
      "data-[has-start-content=true]:ps-1.5",
      "data-[has-end-content=true]:pe-1.5",
      "autofill:bg-transparent bg-clip-text"
    ],
    clearButton: [
      "p-2",
      "-m-2",
      "z-10",
      "end-3",
      "start-auto",
      "pointer-events-none",
      "appearance-none",
      "outline-hidden",
      "select-none",
      "opacity-0",
      "hover:!opacity-100",
      "cursor-pointer",
      "active:!opacity-70",
      "rounded-full",
      // focus ring
      ...dataFocusVisibleClasses
    ],
    stepperButton: [
      "bg-transparent",
      "flex",
      "justify-center",
      "items-center",
      "before:absolute",
      "before:w-8",
      // the max width that won't block clear button
      "before:h-8",
      "before:rounded-full",
      "after:shadow-small",
      "after:bg-background",
      "data-[focused=true]:z-10",
      "min-w-5",
      "w-5",
      "h-5",
      "overflow-visible",
      "transition-opacity",
      "data-[hover=true]:opacity-70",
      "data-[pressed=true]:opacity-disabled"
    ],
    stepperWrapper: ["flex", "flex-col", "ps-1", "h-full", "justify-center"],
    helperWrapper: "hidden group-data-[has-helper=true]:flex p-1 relative flex-col gap-1.5",
    description: "text-tiny text-foreground-400",
    errorMessage: "text-tiny text-danger"
  },
  variants: {
    variant: {
      flat: {
        inputWrapper: [
          "bg-default-100",
          "data-[hover=true]:bg-default-200",
          "group-data-[focus=true]:bg-default-100"
        ]
      },
      faded: {
        inputWrapper: [
          "bg-default-100",
          "border-medium",
          "border-default-200",
          "data-[hover=true]:border-default-400 focus-within:border-default-400"
        ],
        value: "group-data-[has-value=true]:text-default-foreground"
      },
      bordered: {
        inputWrapper: [
          "border-medium",
          "border-default-200",
          "data-[hover=true]:border-default-400",
          "group-data-[focus=true]:border-default-foreground"
        ]
      },
      underlined: {
        inputWrapper: [
          "!px-1",
          "!pb-0",
          "!gap-0",
          "relative",
          "box-border",
          "border-b-medium",
          "shadow-[0_1px_0px_0_rgba(0,0,0,0.05)]",
          "border-default-200",
          "!rounded-none",
          "hover:border-default-300",
          "after:content-['']",
          "after:w-0",
          "after:origin-center",
          "after:bg-default-foreground",
          "after:absolute",
          "after:left-1/2",
          "after:-translate-x-1/2",
          "after:-bottom-[2px]",
          "after:h-[2px]",
          "group-data-[focus=true]:after:w-full"
        ],
        innerWrapper: "pb-1",
        label: "group-data-[filled-within=true]:text-foreground"
      }
    },
    color: {
      default: {},
      primary: {
        stepperButton: "text-primary"
      },
      secondary: {
        stepperButton: "text-secondary"
      },
      success: {
        stepperButton: "text-success"
      },
      warning: {
        stepperButton: "text-warning"
      },
      danger: {
        stepperButton: "text-danger"
      }
    },
    size: {
      sm: {
        label: "text-tiny",
        inputWrapper: "h-8 min-h-8 px-2 rounded-small",
        input: "text-small",
        clearButton: "text-medium"
      },
      md: {
        inputWrapper: "h-10 min-h-10 rounded-medium",
        input: "text-small",
        clearButton: "text-large"
      },
      lg: {
        label: "text-medium",
        inputWrapper: "h-12 min-h-12 rounded-large",
        input: "text-medium",
        clearButton: "text-large"
      }
    },
    radius: {
      none: {
        inputWrapper: "rounded-none"
      },
      sm: {
        inputWrapper: "rounded-small"
      },
      md: {
        inputWrapper: "rounded-medium"
      },
      lg: {
        inputWrapper: "rounded-large"
      },
      full: {
        inputWrapper: "rounded-full"
      }
    },
    labelPlacement: {
      outside: {
        mainWrapper: "flex flex-col",
        stepperButton: "min-w-3 w-3 h-3"
      },
      "outside-left": {
        base: "flex-row items-center flex-nowrap data-[has-helper=true]:items-start",
        inputWrapper: "flex-1",
        mainWrapper: "flex flex-col",
        label: "relative text-foreground pe-2 ps-2 pointer-events-auto",
        stepperButton: "min-w-3 w-3 h-3"
      },
      inside: {
        label: "cursor-text",
        inputWrapper: "flex-col items-start justify-center gap-0",
        innerWrapper: "group-data-[has-label=true]:items-end"
      }
    },
    fullWidth: {
      true: {
        base: "w-full"
      },
      false: {}
    },
    isClearable: {
      true: {
        input: "peer pe-6 input-search-cancel-button-none",
        clearButton: [
          "peer-data-[filled=true]:pointer-events-auto",
          "peer-data-[filled=true]:opacity-70 peer-data-[filled=true]:block",
          "peer-data-[filled=true]:scale-100"
        ]
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none",
        inputWrapper: "pointer-events-none",
        label: "pointer-events-none"
      }
    },
    isInvalid: {
      true: {
        label: "!text-danger",
        input: "!placeholder:text-danger !text-danger"
      }
    },
    isRequired: {
      true: {
        label: "after:content-['*'] after:text-danger after:ms-0.5"
      }
    },
    disableAnimation: {
      true: {
        input: "transition-none",
        inputWrapper: "transition-none",
        label: "transition-none"
      },
      false: {
        inputWrapper: "transition-background motion-reduce:transition-none !duration-150",
        label: [
          "will-change-auto",
          "!duration-200",
          "!ease-out",
          "motion-reduce:transition-none",
          "transition-[transform,color,left,opacity,translate,scale]"
        ],
        clearButton: [
          "scale-90",
          "ease-out",
          "duration-150",
          "transition-[opacity,transform]",
          "motion-reduce:transition-none",
          "motion-reduce:scale-100"
        ]
      }
    }
  },
  defaultVariants: {
    variant: "flat",
    color: "default",
    size: "md",
    fullWidth: true,
    labelPlacement: "inside",
    isDisabled: false
  },
  compoundVariants: [
    // flat & color
    {
      variant: "flat",
      color: "default",
      class: {
        input: "group-data-[has-value=true]:text-default-foreground"
      }
    },
    {
      variant: "flat",
      color: "primary",
      class: {
        inputWrapper: [
          "bg-primary-100",
          "data-[hover=true]:bg-primary-50",
          "text-primary",
          "group-data-[focus=true]:bg-primary-50",
          "placeholder:text-primary"
        ],
        input: "placeholder:text-primary",
        label: "text-primary"
      }
    },
    {
      variant: "flat",
      color: "secondary",
      class: {
        inputWrapper: [
          "bg-secondary-100",
          "text-secondary",
          "data-[hover=true]:bg-secondary-50",
          "group-data-[focus=true]:bg-secondary-50",
          "placeholder:text-secondary"
        ],
        input: "placeholder:text-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "flat",
      color: "success",
      class: {
        inputWrapper: [
          "bg-success-100",
          "text-success-600",
          "dark:text-success",
          "placeholder:text-success-600",
          "dark:placeholder:text-success",
          "data-[hover=true]:bg-success-50",
          "group-data-[focus=true]:bg-success-50"
        ],
        input: "placeholder:text-success-600 dark:placeholder:text-success",
        label: "text-success-600 dark:text-success"
      }
    },
    {
      variant: "flat",
      color: "warning",
      class: {
        inputWrapper: [
          "bg-warning-100",
          "text-warning-600",
          "dark:text-warning",
          "placeholder:text-warning-600",
          "dark:placeholder:text-warning",
          "data-[hover=true]:bg-warning-50",
          "group-data-[focus=true]:bg-warning-50"
        ],
        input: "placeholder:text-warning-600 dark:placeholder:text-warning",
        label: "text-warning-600 dark:text-warning"
      }
    },
    {
      variant: "flat",
      color: "danger",
      class: {
        inputWrapper: [
          "bg-danger-100",
          "text-danger",
          "dark:text-danger-500",
          "placeholder:text-danger",
          "dark:placeholder:text-danger-500",
          "data-[hover=true]:bg-danger-50",
          "group-data-[focus=true]:bg-danger-50"
        ],
        input: "placeholder:text-danger dark:placeholder:text-danger-500",
        label: "text-danger dark:text-danger-500"
      }
    },
    // faded & color
    {
      variant: "faded",
      color: "primary",
      class: {
        label: "text-primary",
        inputWrapper: "data-[hover=true]:border-primary focus-within:border-primary"
      }
    },
    {
      variant: "faded",
      color: "secondary",
      class: {
        label: "text-secondary",
        inputWrapper: "data-[hover=true]:border-secondary focus-within:border-secondary"
      }
    },
    {
      variant: "faded",
      color: "success",
      class: {
        label: "text-success",
        inputWrapper: "data-[hover=true]:border-success focus-within:border-success"
      }
    },
    {
      variant: "faded",
      color: "warning",
      class: {
        label: "text-warning",
        inputWrapper: "data-[hover=true]:border-warning focus-within:border-warning"
      }
    },
    {
      variant: "faded",
      color: "danger",
      class: {
        label: "text-danger",
        inputWrapper: "data-[hover=true]:border-danger focus-within:border-danger"
      }
    },
    // underlined & color
    {
      variant: "underlined",
      color: "default",
      class: {
        input: "group-data-[has-value=true]:text-foreground"
      }
    },
    {
      variant: "underlined",
      color: "primary",
      class: {
        inputWrapper: "after:bg-primary",
        label: "text-primary"
      }
    },
    {
      variant: "underlined",
      color: "secondary",
      class: {
        inputWrapper: "after:bg-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "underlined",
      color: "success",
      class: {
        inputWrapper: "after:bg-success",
        label: "text-success"
      }
    },
    {
      variant: "underlined",
      color: "warning",
      class: {
        inputWrapper: "after:bg-warning",
        label: "text-warning"
      }
    },
    {
      variant: "underlined",
      color: "danger",
      class: {
        inputWrapper: "after:bg-danger",
        label: "text-danger"
      }
    },
    // bordered & color
    {
      variant: "bordered",
      color: "primary",
      class: {
        inputWrapper: "group-data-[focus=true]:border-primary",
        label: "text-primary"
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        inputWrapper: "group-data-[focus=true]:border-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        inputWrapper: "group-data-[focus=true]:border-success",
        label: "text-success"
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        inputWrapper: "group-data-[focus=true]:border-warning",
        label: "text-warning"
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        inputWrapper: "group-data-[focus=true]:border-danger",
        label: "text-danger"
      }
    },
    // labelPlacement=inside & default
    {
      labelPlacement: "inside",
      color: "default",
      class: {
        label: "group-data-[filled-within=true]:text-default-600"
      }
    },
    // labelPlacement=outside & default
    {
      labelPlacement: "outside",
      color: "default",
      class: {
        label: "group-data-[filled-within=true]:text-foreground"
      }
    },
    // radius-full & size
    {
      radius: "full",
      size: ["sm"],
      class: {
        inputWrapper: "px-3"
      }
    },
    {
      radius: "full",
      size: "md",
      class: {
        inputWrapper: "px-4"
      }
    },
    {
      radius: "full",
      size: "lg",
      class: {
        inputWrapper: "px-5"
      }
    },
    // !disableAnimation & variant
    {
      disableAnimation: false,
      variant: ["faded", "bordered"],
      class: {
        inputWrapper: "transition-colors motion-reduce:transition-none"
      }
    },
    {
      disableAnimation: false,
      variant: "underlined",
      class: {
        inputWrapper: "after:transition-width motion-reduce:after:transition-none"
      }
    },
    // flat & faded
    {
      variant: ["flat", "faded"],
      class: {
        inputWrapper: [
          // focus ring
          ...groupDataFocusVisibleClasses
        ]
      }
    },
    // isInvalid & variant
    {
      isInvalid: true,
      variant: "flat",
      class: {
        inputWrapper: [
          "!bg-danger-50",
          "data-[hover=true]:!bg-danger-100",
          "group-data-[focus=true]:!bg-danger-50"
        ]
      }
    },
    {
      isInvalid: true,
      variant: "bordered",
      class: {
        inputWrapper: "!border-danger group-data-[focus=true]:!border-danger"
      }
    },
    {
      isInvalid: true,
      variant: "underlined",
      class: {
        inputWrapper: "after:!bg-danger"
      }
    },
    // size & labelPlacement
    {
      labelPlacement: "inside",
      size: "sm",
      class: {
        inputWrapper: "h-12 py-1.5 px-3"
      }
    },
    {
      labelPlacement: "inside",
      size: "md",
      class: {
        inputWrapper: "h-14 py-2"
      }
    },
    {
      labelPlacement: "inside",
      size: "lg",
      class: {
        inputWrapper: "h-16 py-2.5 gap-0"
      }
    },
    // size & labelPlacement & variant=[faded, bordered]
    {
      labelPlacement: "inside",
      size: "sm",
      variant: ["bordered", "faded"],
      class: {
        inputWrapper: "py-1"
      }
    },
    // labelPlacement=[inside,outside]
    {
      labelPlacement: ["inside", "outside"],
      class: {
        label: ["group-data-[filled-within=true]:pointer-events-auto"]
      }
    },
    // labelPlacement=[outside]
    {
      labelPlacement: "outside",
      class: {
        base: "relative justify-end",
        label: [
          "pb-0",
          "z-20",
          "top-1/2",
          "-translate-y-1/2",
          "group-data-[filled-within=true]:start-0"
        ]
      }
    },
    // labelPlacement=[inside]
    {
      labelPlacement: ["inside"],
      class: {
        label: ["group-data-[filled-within=true]:scale-85"]
      }
    },
    {
      labelPlacement: "inside",
      size: "sm",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-tiny)/2_-_8px)]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      size: "md",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_6px)]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      size: "lg",
      class: {
        label: [
          "text-medium",
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_8px)]"
        ]
      }
    },
    // labelPlacement=[inside] & variant=flat
    {
      labelPlacement: ["inside"],
      variant: "flat",
      class: {
        innerWrapper: "pb-0.5"
      }
    },
    // variant=underlined & size
    {
      variant: "underlined",
      size: "sm",
      class: {
        innerWrapper: "pb-1"
      }
    },
    {
      variant: "underlined",
      size: ["md", "lg"],
      class: {
        innerWrapper: "pb-1.5"
      }
    },
    // inside & size
    {
      labelPlacement: "inside",
      size: ["sm", "md"],
      class: {
        label: "text-small",
        stepperButton: "before:h-6"
      }
    },
    // inside & size & [faded, bordered]
    {
      labelPlacement: "inside",
      variant: ["faded", "bordered"],
      size: "sm",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-tiny)/2_-_8px_-_var(--heroui-border-width-medium))]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: ["faded", "bordered"],
      isMultiline: false,
      size: "md",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_6px_-_var(--heroui-border-width-medium))]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: ["faded", "bordered"],
      size: "lg",
      class: {
        label: [
          "text-medium",
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_8px_-_var(--heroui-border-width-medium))]"
        ]
      }
    },
    // inside & size & underlined
    {
      labelPlacement: "inside",
      variant: "underlined",
      size: "sm",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-tiny)/2_-_5px)]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: "underlined",
      size: "md",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_3.5px)]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: "underlined",
      size: "lg",
      class: {
        label: [
          "text-medium",
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_4px)]"
        ]
      }
    },
    // outside & size
    {
      labelPlacement: "outside",
      size: "sm",
      class: {
        label: [
          "start-2",
          "text-tiny",
          "group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-tiny)/2_+_16px)]"
        ],
        base: "data-[has-label=true]:mt-[calc(var(--heroui-font-size-small)_+_8px)]",
        stepperButton: "before:h-4"
      }
    },
    {
      labelPlacement: "outside",
      size: "md",
      class: {
        label: [
          "start-3",
          "end-auto",
          "text-small",
          "group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_20px)]"
        ],
        base: "data-[has-label=true]:mt-[calc(var(--heroui-font-size-small)_+_10px)]"
      }
    },
    {
      labelPlacement: "outside",
      size: "lg",
      class: {
        label: [
          "start-3",
          "end-auto",
          "text-medium",
          "group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_24px)]"
        ],
        base: "data-[has-label=true]:mt-[calc(var(--heroui-font-size-small)_+_12px)]",
        stepperButton: "min-4 w-4 h-4 before:h-6"
      }
    },
    // outside-left & size & hasHelper
    {
      labelPlacement: "outside-left",
      size: "sm",
      class: {
        label: "group-data-[has-helper=true]:pt-2",
        stepperButton: "before:h-4"
      }
    },
    {
      labelPlacement: "outside-left",
      size: "md",
      class: {
        label: "group-data-[has-helper=true]:pt-3",
        stepperButton: "before:h-4"
      }
    },
    {
      labelPlacement: "outside-left",
      size: "lg",
      class: {
        label: "group-data-[has-helper=true]:pt-4",
        stepperButton: "min-4 w-4 h-4 before:h-6"
      }
    },
    // text truncate labelPlacement=[inside,outside]
    {
      labelPlacement: ["inside", "outside"],
      class: {
        label: ["pe-2", "max-w-full", "text-ellipsis", "overflow-hidden"]
      }
    }
  ]
});
var divider = tv({
  base: "shrink-0 bg-divider border-none",
  variants: {
    orientation: {
      horizontal: "w-full h-divider",
      vertical: "h-full w-divider"
    }
  },
  defaultVariants: {
    orientation: "horizontal"
  }
});
var dropdown = tv({
  base: ["w-full", "p-1", "min-w-[200px]"]
});
tv({
  slots: {
    base: [
      "flex",
      "group",
      "gap-2",
      "items-center",
      "justify-between",
      "relative",
      "px-2",
      "py-1.5",
      "w-full",
      "h-full",
      "box-border",
      "rounded-small",
      "outline-hidden",
      "cursor-pointer",
      "tap-highlight-transparent",
      "data-[pressed=true]:opacity-70",
      // focus ring
      ...dataFocusVisibleClasses,
      "data-[focus-visible=true]:dark:ring-offset-background-content1"
    ],
    wrapper: "w-full flex flex-col items-start justify-center",
    title: "flex-1 text-small font-normal truncate",
    description: ["w-full", "text-tiny", "text-foreground-500", "group-hover:text-current"],
    selectedIcon: ["text-inherit", "w-3", "h-3", "shrink-0"],
    shortcut: [
      "px-1",
      "py-0.5",
      "rounded-sm",
      "font-sans",
      "text-foreground-500",
      "text-tiny",
      "border-small",
      "border-default-300",
      "group-hover:border-current"
    ]
  },
  variants: {
    variant: {
      solid: {
        base: ""
      },
      bordered: {
        base: "border-medium border-transparent bg-transparent"
      },
      light: {
        base: "bg-transparent"
      },
      faded: {
        base: "border-small border-transparent hover:border-default data-[hover=true]:bg-default-100"
      },
      flat: {
        base: ""
      },
      shadow: {
        base: "data-[hover=true]:shadow-lg"
      }
    },
    color: {
      default: {},
      primary: {},
      secondary: {},
      success: {},
      warning: {},
      danger: {}
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none"
      }
    },
    disableAnimation: {
      true: {},
      false: {}
    }
  },
  defaultVariants: {
    variant: "solid",
    color: "default"
  },
  compoundVariants: [
    // solid / color
    {
      variant: "solid",
      color: "default",
      class: {
        base: "data-[hover=true]:bg-default data-[hover=true]:text-default-foreground"
      }
    },
    {
      variant: "solid",
      color: "primary",
      class: {
        base: "data-[hover=true]:bg-primary data-[hover=true]:text-primary-foreground"
      }
    },
    {
      variant: "solid",
      color: "secondary",
      class: {
        base: "data-[hover=true]:bg-secondary data-[hover=true]:text-secondary-foreground"
      }
    },
    {
      variant: "solid",
      color: "success",
      class: {
        base: "data-[hover=true]:bg-success data-[hover=true]:text-success-foreground"
      }
    },
    {
      variant: "solid",
      color: "warning",
      class: {
        base: "data-[hover=true]:bg-warning data-[hover=true]:text-warning-foreground"
      }
    },
    {
      variant: "solid",
      color: "danger",
      class: {
        base: "data-[hover=true]:bg-danger data-[hover=true]:text-danger-foreground"
      }
    },
    // shadow / color
    {
      variant: "shadow",
      color: "default",
      class: {
        base: "data-[hover=true]:shadow-default/50 data-[hover=true]:bg-default data-[hover=true]:text-default-foreground"
      }
    },
    {
      variant: "shadow",
      color: "primary",
      class: {
        base: "data-[hover=true]:shadow-primary/30 data-[hover=true]:bg-primary data-[hover=true]:text-primary-foreground"
      }
    },
    {
      variant: "shadow",
      color: "secondary",
      class: {
        base: "data-[hover=true]:shadow-secondary/30 data-[hover=true]:bg-secondary data-[hover=true]:text-secondary-foreground"
      }
    },
    {
      variant: "shadow",
      color: "success",
      class: {
        base: "data-[hover=true]:shadow-success/30 data-[hover=true]:bg-success data-[hover=true]:text-success-foreground"
      }
    },
    {
      variant: "shadow",
      color: "warning",
      class: {
        base: "data-[hover=true]:shadow-warning/30 data-[hover=true]:bg-warning data-[hover=true]:text-warning-foreground"
      }
    },
    {
      variant: "shadow",
      color: "danger",
      class: {
        base: "data-[hover=true]:shadow-danger/30 data-[hover=true]:bg-danger data-[hover=true]:text-danger-foreground"
      }
    },
    // bordered / color
    {
      variant: "bordered",
      color: "default",
      class: {
        base: "data-[hover=true]:border-default"
      }
    },
    {
      variant: "bordered",
      color: "primary",
      class: {
        base: "data-[hover=true]:border-primary data-[hover=true]:text-primary"
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        base: "data-[hover=true]:border-secondary data-[hover=true]:text-secondary"
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        base: "data-[hover=true]:border-success data-[hover=true]:text-success"
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        base: "data-[hover=true]:border-warning data-[hover=true]:text-warning"
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        base: "data-[hover=true]:border-danger data-[hover=true]:text-danger"
      }
    },
    // flat / color
    {
      variant: "flat",
      color: "default",
      class: {
        base: "data-[hover=true]:bg-default/40 data-[hover=true]:text-default-foreground"
      }
    },
    {
      variant: "flat",
      color: "primary",
      class: {
        base: "data-[hover=true]:bg-primary/20 data-[hover=true]:text-primary"
      }
    },
    {
      variant: "flat",
      color: "secondary",
      class: {
        base: "data-[hover=true]:bg-secondary/20 data-[hover=true]:text-secondary"
      }
    },
    {
      variant: "flat",
      color: "success",
      class: {
        base: "data-[hover=true]:bg-success/20 data-[hover=true]:text-success "
      }
    },
    {
      variant: "flat",
      color: "warning",
      class: {
        base: "data-[hover=true]:bg-warning/20 data-[hover=true]:text-warning"
      }
    },
    {
      variant: "flat",
      color: "danger",
      class: {
        base: "data-[hover=true]:bg-danger/20 data-[hover=true]:text-danger"
      }
    },
    // faded / color
    {
      variant: "faded",
      color: "default",
      class: {
        base: "data-[hover=true]:text-default-foreground"
      }
    },
    {
      variant: "faded",
      color: "primary",
      class: {
        base: "data-[hover=true]:text-primary"
      }
    },
    {
      variant: "faded",
      color: "secondary",
      class: {
        base: "data-[hover=true]:text-secondary"
      }
    },
    {
      variant: "faded",
      color: "success",
      class: {
        base: "data-[hover=true]:text-success"
      }
    },
    {
      variant: "faded",
      color: "warning",
      class: {
        base: "data-[hover=true]:text-warning"
      }
    },
    {
      variant: "faded",
      color: "danger",
      class: {
        base: "data-[hover=true]:text-danger"
      }
    },
    // light / color
    {
      variant: "light",
      color: "default",
      class: {
        base: "data-[hover=true]:text-default-500"
      }
    },
    {
      variant: "light",
      color: "primary",
      class: {
        base: "data-[hover=true]:text-primary"
      }
    },
    {
      variant: "light",
      color: "secondary",
      class: {
        base: "data-[hover=true]:text-secondary"
      }
    },
    {
      variant: "light",
      color: "success",
      class: {
        base: "data-[hover=true]:text-success"
      }
    },
    {
      variant: "light",
      color: "warning",
      class: {
        base: "data-[hover=true]:text-warning"
      }
    },
    {
      variant: "light",
      color: "danger",
      class: {
        base: "data-[hover=true]:text-danger"
      }
    }
  ]
});
tv({
  slots: {
    base: "relative mb-2",
    heading: "pl-1 text-tiny text-foreground-500",
    group: "data-[has-title=true]:pt-1",
    divider: "mt-2"
  }
});
tv({
  base: "w-full flex flex-col gap-0.5 p-1"
});
var form = tv({
  base: "flex flex-col gap-2 items-start"
});
var image$1 = tv({
  slots: {
    wrapper: "relative shadow-black/5",
    zoomedWrapper: "relative overflow-hidden rounded-inherit",
    img: "relative z-10 opacity-0 shadow-black/5 data-[loaded=true]:opacity-100",
    blurredImg: [
      "absolute",
      "z-0",
      "inset-0",
      "w-full",
      "h-full",
      "object-cover",
      "filter",
      "blur-lg",
      "scale-105",
      "saturate-150",
      "opacity-30",
      "translate-y-1"
    ]
  },
  variants: {
    radius: {
      none: {},
      sm: {},
      md: {},
      lg: {},
      full: {}
    },
    shadow: {
      none: {
        wrapper: "shadow-none",
        img: "shadow-none"
      },
      sm: {
        wrapper: "shadow-small",
        img: "shadow-small"
      },
      md: {
        wrapper: "shadow-medium",
        img: "shadow-medium"
      },
      lg: {
        wrapper: "shadow-large",
        img: "shadow-large"
      }
    },
    isZoomed: {
      true: {
        img: ["object-cover", "transform", "hover:scale-125"]
      }
    },
    showSkeleton: {
      true: {
        wrapper: ["group", "relative", "overflow-hidden", "bg-content3 dark:bg-content2"],
        img: "opacity-0"
      }
    },
    disableAnimation: {
      true: {
        img: "transition-none"
      },
      false: {
        img: "transition-transform-opacity motion-reduce:transition-none !duration-300"
      }
    }
  },
  defaultVariants: {
    radius: "lg",
    shadow: "none",
    isZoomed: false,
    isBlurred: false,
    showSkeleton: false
  },
  compoundVariants: [
    {
      showSkeleton: true,
      disableAnimation: false,
      class: {
        wrapper: [
          // before
          "before:opacity-100",
          "before:absolute",
          "before:inset-0",
          "before:-translate-x-full",
          "before:animate-shimmer",
          "before:border-t",
          "before:border-content4/30",
          "before:bg-gradient-to-r",
          "before:from-transparent",
          "before:via-content4",
          "dark:before:via-default-700/10",
          "before:to-transparent",
          //after
          "after:opacity-100",
          "after:absolute",
          "after:inset-0",
          "after:-z-10",
          "after:bg-content3",
          "dark:after:bg-content2"
        ]
      }
    }
  ],
  compoundSlots: [
    {
      slots: ["wrapper", "img", "blurredImg", "zoomedWrapper"],
      radius: "none",
      class: "rounded-none"
    },
    {
      slots: ["wrapper", "img", "blurredImg", "zoomedWrapper"],
      radius: "full",
      class: "rounded-full"
    },
    {
      slots: ["wrapper", "img", "blurredImg", "zoomedWrapper"],
      radius: "sm",
      class: "rounded-small"
    },
    {
      slots: ["wrapper", "img", "blurredImg", "zoomedWrapper"],
      radius: "md",
      class: "rounded-md"
    },
    {
      slots: ["wrapper", "img", "blurredImg", "zoomedWrapper"],
      radius: "lg",
      class: "rounded-large"
    }
  ]
});
var button = tv({
  base: [
    "z-0",
    "group",
    "relative",
    "inline-flex",
    "items-center",
    "justify-center",
    "box-border",
    "appearance-none",
    "outline-hidden",
    "select-none",
    "whitespace-nowrap",
    "min-w-max",
    "font-normal",
    "subpixel-antialiased",
    "overflow-hidden",
    "tap-highlight-transparent",
    "transform-gpu data-[pressed=true]:scale-[0.97]",
    "cursor-pointer",
    // focus ring
    ...dataFocusVisibleClasses
  ],
  variants: {
    variant: {
      solid: "",
      bordered: "border-medium bg-transparent",
      light: "bg-transparent",
      flat: "",
      faded: "border-medium",
      shadow: "",
      ghost: "border-medium bg-transparent"
    },
    size: {
      sm: "px-3 min-w-16 h-8 text-tiny gap-2 rounded-small",
      md: "px-4 min-w-20 h-10 text-small gap-2 rounded-medium",
      lg: "px-6 min-w-24 h-12 text-medium gap-3 rounded-large"
    },
    color: {
      default: "",
      primary: "",
      secondary: "",
      success: "",
      warning: "",
      danger: ""
    },
    radius: {
      none: "rounded-none",
      sm: "rounded-small",
      md: "rounded-medium",
      lg: "rounded-large",
      full: "rounded-full"
    },
    fullWidth: {
      true: "w-full"
    },
    isDisabled: {
      true: "opacity-disabled pointer-events-none"
    },
    isInGroup: {
      true: "[&:not(:first-child):not(:last-child)]:rounded-none"
    },
    isIconOnly: {
      true: "px-0 !gap-0",
      false: "[&>svg]:max-w-[theme(spacing.8)]"
    },
    disableAnimation: {
      true: "!transition-none data-[pressed=true]:scale-100",
      false: "transition-transform-colors-opacity motion-reduce:transition-none"
    }
  },
  defaultVariants: {
    size: "md",
    variant: "solid",
    color: "default",
    fullWidth: false,
    isDisabled: false,
    isInGroup: false
  },
  compoundVariants: [
    // solid / color
    {
      variant: "solid",
      color: "default",
      class: colorVariants.solid.default
    },
    {
      variant: "solid",
      color: "primary",
      class: colorVariants.solid.primary
    },
    {
      variant: "solid",
      color: "secondary",
      class: colorVariants.solid.secondary
    },
    {
      variant: "solid",
      color: "success",
      class: colorVariants.solid.success
    },
    {
      variant: "solid",
      color: "warning",
      class: colorVariants.solid.warning
    },
    {
      variant: "solid",
      color: "danger",
      class: colorVariants.solid.danger
    },
    // shadow / color
    {
      variant: "shadow",
      color: "default",
      class: colorVariants.shadow.default
    },
    {
      variant: "shadow",
      color: "primary",
      class: colorVariants.shadow.primary
    },
    {
      variant: "shadow",
      color: "secondary",
      class: colorVariants.shadow.secondary
    },
    {
      variant: "shadow",
      color: "success",
      class: colorVariants.shadow.success
    },
    {
      variant: "shadow",
      color: "warning",
      class: colorVariants.shadow.warning
    },
    {
      variant: "shadow",
      color: "danger",
      class: colorVariants.shadow.danger
    },
    // bordered / color
    {
      variant: "bordered",
      color: "default",
      class: colorVariants.bordered.default
    },
    {
      variant: "bordered",
      color: "primary",
      class: colorVariants.bordered.primary
    },
    {
      variant: "bordered",
      color: "secondary",
      class: colorVariants.bordered.secondary
    },
    {
      variant: "bordered",
      color: "success",
      class: colorVariants.bordered.success
    },
    {
      variant: "bordered",
      color: "warning",
      class: colorVariants.bordered.warning
    },
    {
      variant: "bordered",
      color: "danger",
      class: colorVariants.bordered.danger
    },
    // flat / color
    {
      variant: "flat",
      color: "default",
      class: colorVariants.flat.default
    },
    {
      variant: "flat",
      color: "primary",
      class: colorVariants.flat.primary
    },
    {
      variant: "flat",
      color: "secondary",
      class: colorVariants.flat.secondary
    },
    {
      variant: "flat",
      color: "success",
      class: colorVariants.flat.success
    },
    {
      variant: "flat",
      color: "warning",
      class: colorVariants.flat.warning
    },
    {
      variant: "flat",
      color: "danger",
      class: colorVariants.flat.danger
    },
    // faded / color
    {
      variant: "faded",
      color: "default",
      class: colorVariants.faded.default
    },
    {
      variant: "faded",
      color: "primary",
      class: colorVariants.faded.primary
    },
    {
      variant: "faded",
      color: "secondary",
      class: colorVariants.faded.secondary
    },
    {
      variant: "faded",
      color: "success",
      class: colorVariants.faded.success
    },
    {
      variant: "faded",
      color: "warning",
      class: colorVariants.faded.warning
    },
    {
      variant: "faded",
      color: "danger",
      class: colorVariants.faded.danger
    },
    // light / color
    {
      variant: "light",
      color: "default",
      class: [colorVariants.light.default, "data-[hover=true]:bg-default/40"]
    },
    {
      variant: "light",
      color: "primary",
      class: [colorVariants.light.primary, "data-[hover=true]:bg-primary/20"]
    },
    {
      variant: "light",
      color: "secondary",
      class: [colorVariants.light.secondary, "data-[hover=true]:bg-secondary/20"]
    },
    {
      variant: "light",
      color: "success",
      class: [colorVariants.light.success, "data-[hover=true]:bg-success/20"]
    },
    {
      variant: "light",
      color: "warning",
      class: [colorVariants.light.warning, "data-[hover=true]:bg-warning/20"]
    },
    {
      variant: "light",
      color: "danger",
      class: [colorVariants.light.danger, "data-[hover=true]:bg-danger/20"]
    },
    // ghost / color
    {
      variant: "ghost",
      color: "default",
      class: [colorVariants.ghost.default, "data-[hover=true]:!bg-default"]
    },
    {
      variant: "ghost",
      color: "primary",
      class: [
        colorVariants.ghost.primary,
        "data-[hover=true]:!bg-primary data-[hover=true]:!text-primary-foreground"
      ]
    },
    {
      variant: "ghost",
      color: "secondary",
      class: [
        colorVariants.ghost.secondary,
        "data-[hover=true]:!bg-secondary data-[hover=true]:!text-secondary-foreground"
      ]
    },
    {
      variant: "ghost",
      color: "success",
      class: [
        colorVariants.ghost.success,
        "data-[hover=true]:!bg-success data-[hover=true]:!text-success-foreground"
      ]
    },
    {
      variant: "ghost",
      color: "warning",
      class: [
        colorVariants.ghost.warning,
        "data-[hover=true]:!bg-warning data-[hover=true]:!text-warning-foreground"
      ]
    },
    {
      variant: "ghost",
      color: "danger",
      class: [
        colorVariants.ghost.danger,
        "data-[hover=true]:!bg-danger data-[hover=true]:!text-danger-foreground"
      ]
    },
    // isInGroup / radius / size <-- radius not provided
    {
      isInGroup: true,
      class: "rounded-none first:rounded-s-medium last:rounded-e-medium"
    },
    {
      isInGroup: true,
      size: "sm",
      class: "rounded-none first:rounded-s-small last:rounded-e-small"
    },
    {
      isInGroup: true,
      size: "md",
      class: "rounded-none first:rounded-s-medium last:rounded-e-medium"
    },
    {
      isInGroup: true,
      size: "lg",
      class: "rounded-none first:rounded-s-large last:rounded-e-large"
    },
    {
      isInGroup: true,
      isRounded: true,
      class: "rounded-none first:rounded-s-full last:rounded-e-full"
    },
    // isInGroup / radius <-- radius provided
    {
      isInGroup: true,
      radius: "none",
      class: "rounded-none first:rounded-s-none last:rounded-e-none"
    },
    {
      isInGroup: true,
      radius: "sm",
      class: "rounded-none first:rounded-s-small last:rounded-e-small"
    },
    {
      isInGroup: true,
      radius: "md",
      class: "rounded-none first:rounded-s-medium last:rounded-e-medium"
    },
    {
      isInGroup: true,
      radius: "lg",
      class: "rounded-none first:rounded-s-large last:rounded-e-large"
    },
    {
      isInGroup: true,
      radius: "full",
      class: "rounded-none first:rounded-s-full last:rounded-e-full"
    },
    // isInGroup / bordered / ghost
    {
      isInGroup: true,
      variant: ["ghost", "bordered"],
      color: "default",
      className: collapseAdjacentVariantBorders.default
    },
    {
      isInGroup: true,
      variant: ["ghost", "bordered"],
      color: "primary",
      className: collapseAdjacentVariantBorders.primary
    },
    {
      isInGroup: true,
      variant: ["ghost", "bordered"],
      color: "secondary",
      className: collapseAdjacentVariantBorders.secondary
    },
    {
      isInGroup: true,
      variant: ["ghost", "bordered"],
      color: "success",
      className: collapseAdjacentVariantBorders.success
    },
    {
      isInGroup: true,
      variant: ["ghost", "bordered"],
      color: "warning",
      className: collapseAdjacentVariantBorders.warning
    },
    {
      isInGroup: true,
      variant: ["ghost", "bordered"],
      color: "danger",
      className: collapseAdjacentVariantBorders.danger
    },
    {
      isIconOnly: true,
      size: "sm",
      class: "min-w-8 w-8 h-8"
    },
    {
      isIconOnly: true,
      size: "md",
      class: "min-w-10 w-10 h-10"
    },
    {
      isIconOnly: true,
      size: "lg",
      class: "min-w-12 w-12 h-12"
    },
    // variant / hover
    {
      variant: ["solid", "faded", "flat", "bordered", "shadow"],
      class: "data-[hover=true]:opacity-hover"
    }
  ]
});
var buttonGroup = tv({
  base: "inline-flex items-center justify-center h-auto",
  variants: {
    fullWidth: {
      true: "w-full"
    }
  },
  defaultVariants: {
    fullWidth: false
  }
});
var calendar$2 = tv({
  slots: {
    base: [
      "relative w-fit max-w-full shadow-small inline-block overflow-y-hidden",
      "rounded-large overflow-x-auto bg-default-50 dark:bg-background",
      "w-[calc(var(--visible-months)_*_var(--calendar-width))]"
    ],
    prevButton: ["order-1"],
    nextButton: ["order-3"],
    headerWrapper: [
      "px-4 py-2 flex items-center justify-between gap-2 bg-content1 overflow-hidden rtl:flex-row-reverse",
      "[&_.chevron-icon]:flex-none",
      // month/year picker wrapper
      "after:content-['']",
      "after:bg-content1 origin-top",
      "after:w-full after:h-0",
      "after:absolute after:top-0 after:left-0"
    ],
    header: "flex w-full items-center justify-center gap-2 z-10 order-2",
    title: "text-default-500 text-small font-medium",
    content: "w-[calc(var(--visible-months)_*_var(--calendar-width))]",
    gridWrapper: "flex max-w-full overflow-hidden pb-2 h-auto relative",
    grid: "w-full border-collapse z-0",
    gridHeader: "bg-content1 shadow-[0px_20px_20px_0px_rgb(0_0_0/0.05)]",
    gridHeaderRow: "px-4 pb-2 flex justify-center text-default-400",
    gridHeaderCell: "flex w-8 justify-center items-center font-medium text-small",
    gridBody: "",
    gridBodyRow: "flex justify-center items-center first:mt-2",
    cell: "py-0.5 px-0",
    cellButton: [
      "w-8 h-8 flex items-center text-foreground justify-center rounded-full",
      "box-border appearance-none select-none whitespace-nowrap font-normal",
      "subpixel-antialiased overflow-hidden tap-highlight-transparent",
      "data-[disabled=true]:text-default-300",
      "data-[disabled=true]:cursor-default",
      "data-[readonly=true]:cursor-default",
      "data-[disabled=true]:transition-none",
      "data-[unavailable=true]:text-default-300",
      "data-[unavailable=true]:cursor-default",
      "data-[unavailable=true]:line-through",
      ...dataFocusVisibleClasses
    ],
    pickerWrapper: "absolute inset-x-0 top-0 flex w-full h-[var(--picker-height)] justify-center opacity-0 pointer-events-none",
    pickerMonthList: "items-start",
    pickerYearList: "items-center",
    pickerHighlight: "h-8 bg-default-200 absolute w-[calc(100%_-_16px)] rounded-medium z-0 top-1/2 -translate-y-1/2 pointer-events-none",
    pickerItem: [
      "w-full flex text-foreground items-center h-8 leading-[32px] min-h-[32px] snap-center text-large z-20",
      "data-[pressed=true]:opacity-50",
      ...dataFocusVisibleClasses
    ],
    helperWrapper: "px-4 pb-2 max-w-[270px] flex justify-start flex-wrap items-center",
    errorMessage: "text-small text-danger break-words max-w-full"
  },
  variants: {
    color: {
      foreground: {},
      primary: {},
      secondary: {},
      success: {},
      warning: {},
      danger: {}
    },
    // @internal
    isRange: {
      true: {
        cellButton: [
          // base
          "relative",
          "overflow-visible",
          // before pseudo element
          "before:content-[''] before:absolute before:inset-0 before:z-[-1] before:rounded-none",
          // hide before pseudo element when the selected cell is outside the month
          "data-[outside-month=true]:before:hidden",
          "data-[selected=true]:data-[range-selection=true]:data-[outside-month=true]:bg-transparent",
          "data-[selected=true]:data-[range-selection=true]:data-[outside-month=true]:text-default-300",
          // middle
          // "data-[selected=true]:data-[range-selection=true]:bg-transparent",
          // start (pseudo)
          "data-[range-start=true]:before:rounded-s-full",
          "data-[selection-start=true]:before:rounded-s-full",
          // end (pseudo)
          "data-[range-end=true]:before:rounded-e-full",
          "data-[selection-end=true]:before:rounded-e-full",
          // start (selected)
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:rounded-full",
          // end (selected)
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:rounded-full"
        ]
      },
      false: {}
    },
    hideDisabledDates: {
      true: {
        cellButton: "data-[disabled=true]:data-[outside-month=true]:opacity-0"
      },
      false: {}
    },
    isHeaderWrapperExpanded: {
      true: {
        headerWrapper: ["[&_.chevron-icon]:rotate-180", "after:h-full", "after:z-0"],
        pickerWrapper: "opacity-100 pointer-events-auto z-10",
        gridWrapper: "h-[var(--picker-height)] overflow-y-hidden",
        grid: "opacity-0 pointer-events-none",
        nextButton: "opacity-0 pointer-events-none",
        prevButton: "opacity-0 pointer-events-none"
      },
      false: {}
    },
    showMonthAndYearPickers: {
      true: {
        base: "[--picker-height:224px]",
        header: "h-8 bg-default-100 rounded-full"
      },
      false: {}
    },
    showShadow: {
      true: {
        cellButton: "data-[selected=true]:shadow-md"
      },
      false: {
        cellButton: "shadow-none data-[selected=true]:shadow-none"
      }
    },
    disableAnimation: {
      true: {
        cellButton: "transition-none"
      },
      false: {
        headerWrapper: ["[&_.chevron-icon]:transition-transform", "after:transition-height"],
        grid: "transition-opacity",
        cellButton: ["origin-center transition-[transform,background-color,color] !duration-150"],
        pickerWrapper: "transition-opacity !duration-250",
        pickerItem: "transition-opacity"
      }
    },
    isRTL: {
      true: {
        nextButton: "order-1",
        prevButton: "order-3"
      },
      false: {}
    }
  },
  defaultVariants: {
    color: "primary",
    showShadow: false,
    hideDisabledDates: false,
    showMonthAndYearPickers: false,
    isRTL: false
  },
  compoundVariants: [
    // !isRange & colors --> Calendar
    {
      isRange: false,
      color: "foreground",
      class: {
        cellButton: [
          "data-[hover=true]:bg-default-200",
          "data-[selected=true]:bg-foreground",
          "data-[selected=true]:text-background",
          "data-[hover=true]:bg-foreground-200",
          "data-[hover=true]:text-foreground-600",
          "data-[selected=true]:data-[hover=true]:bg-foreground",
          "data-[selected=true]:data-[hover=true]:text-background"
        ]
      }
    },
    {
      isRange: false,
      color: "primary",
      class: {
        cellButton: [
          "data-[selected=true]:bg-primary",
          "data-[selected=true]:text-primary-foreground",
          "data-[hover=true]:bg-primary-50",
          "data-[hover=true]:text-primary-400",
          "data-[selected=true]:data-[hover=true]:bg-primary",
          "data-[selected=true]:data-[hover=true]:text-primary-foreground"
        ]
      }
    },
    {
      isRange: false,
      color: "secondary",
      class: {
        cellButton: [
          "data-[selected=true]:bg-secondary",
          "data-[selected=true]:text-secondary-foreground",
          "data-[hover=true]:bg-secondary-50",
          "data-[hover=true]:text-secondary-400",
          "data-[selected=true]:data-[hover=true]:bg-secondary",
          "data-[selected=true]:data-[hover=true]:text-secondary-foreground"
        ]
      }
    },
    {
      isRange: false,
      color: "success",
      class: {
        cellButton: [
          "data-[selected=true]:bg-success",
          "data-[selected=true]:text-success-foreground",
          "data-[hover=true]:bg-success-100",
          "data-[hover=true]:text-success-600",
          "dark:data-[hover=true]:bg-success-50",
          "dark:data-[hover=true]:text-success-500",
          "data-[selected=true]:data-[hover=true]:bg-success",
          "dark:data-[selected=true]:data-[hover=true]:bg-success",
          "dark:data-[selected=true]:data-[hover=true]:text-success-foreground",
          "data-[selected=true]:data-[hover=true]:text-success-foreground"
        ]
      }
    },
    {
      isRange: false,
      color: "warning",
      class: {
        cellButton: [
          "data-[selected=true]:bg-warning",
          "data-[selected=true]:text-warning-foreground",
          "data-[hover=true]:bg-warning-100",
          "data-[hover=true]:text-warning-600",
          "dark:data-[hover=true]:bg-warning-50",
          "dark:data-[hover=true]:text-warning-500",
          "data-[selected=true]:data-[hover=true]:bg-warning",
          "dark:data-[selected=true]:data-[hover=true]:bg-warning",
          "dark:data-[selected=true]:data-[hover=true]:text-warning-foreground",
          "data-[selected=true]:data-[hover=true]:text-warning-foreground"
        ]
      }
    },
    {
      isRange: false,
      color: "danger",
      class: {
        cellButton: [
          "data-[selected=true]:bg-danger",
          "data-[selected=true]:text-danger-foreground",
          "data-[hover=true]:bg-danger-100",
          "data-[hover=true]:text-danger-500",
          "dark:data-[hover=true]:bg-danger-50",
          "dark:data-[hover=true]:text-danger-500",
          "data-[selected=true]:data-[hover=true]:bg-danger",
          "dark:data-[selected=true]:data-[hover=true]:bg-danger",
          "dark:data-[selected=true]:data-[hover=true]:text-danger-foreground",
          "data-[selected=true]:data-[hover=true]:text-danger-foreground"
        ]
      }
    },
    // isRange & colors --> RangeCalendar
    {
      isRange: true,
      color: "foreground",
      class: {
        cellButton: [
          // middle
          "data-[selected=true]:data-[range-selection=true]:before:bg-foreground/10",
          "data-[selected=true]:data-[range-selection=true]:text-foreground",
          // start (selected)
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:bg-foreground",
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:text-background",
          // end (selected)
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:bg-foreground",
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:text-background"
        ]
      }
    },
    {
      isRange: true,
      color: "primary",
      class: {
        cellButton: [
          // middle
          "data-[selected=true]:data-[range-selection=true]:before:bg-primary-50",
          "data-[selected=true]:data-[range-selection=true]:text-primary",
          // start (selected)
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:bg-primary",
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:text-primary-foreground",
          // end (selected)
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:bg-primary",
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:text-primary-foreground"
        ]
      }
    },
    {
      isRange: true,
      color: "secondary",
      class: {
        cellButton: [
          // middle
          "data-[selected=true]:data-[range-selection=true]:before:bg-secondary-50",
          "data-[selected=true]:data-[range-selection=true]:text-secondary",
          // start (selected)
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:bg-secondary",
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:text-secondary-foreground",
          // end (selected)
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:bg-secondary",
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:text-secondary-foreground"
        ]
      }
    },
    {
      isRange: true,
      color: "success",
      class: {
        cellButton: [
          // middle
          "data-[selected=true]:data-[range-selection=true]:before:bg-success-100",
          "data-[selected=true]:data-[range-selection=true]:text-success-600",
          "dark:data-[selected=true]:data-[range-selection=true]:before:bg-success-50",
          "dark:data-[selected=true]:data-[range-selection=true]:text-success-500",
          // start (selected)
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:bg-success",
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:text-success-foreground",
          "dark:data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:text-success-foreground",
          // end (selected)
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:bg-success",
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:text-success-foreground",
          "dark:data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:text-success-foreground"
        ]
      }
    },
    {
      isRange: true,
      color: "warning",
      class: {
        cellButton: [
          // middle
          "data-[selected=true]:data-[range-selection=true]:before:bg-warning-100",
          "dark:data-[selected=true]:data-[range-selection=true]:before:bg-warning-50",
          "data-[selected=true]:data-[range-selection=true]:text-warning-500",
          // start (selected)
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:bg-warning",
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:text-warning-foreground",
          // end (selected)
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:bg-warning",
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:text-warning-foreground"
        ]
      }
    },
    {
      isRange: true,
      color: "danger",
      class: {
        cellButton: [
          // middle
          "data-[selected=true]:data-[range-selection=true]:before:bg-danger-50",
          "data-[selected=true]:data-[range-selection=true]:text-danger-500",
          // start (selected)
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:bg-danger",
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:text-danger-foreground",
          // end (selected)
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:bg-danger",
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:text-danger-foreground"
        ]
      }
    },
    // showShadow & colors
    {
      showShadow: true,
      color: "foreground",
      class: {
        cellButton: "data-[selected=true]:shadow-foreground/40"
      }
    },
    {
      showShadow: true,
      color: "primary",
      class: {
        cellButton: "data-[selected=true]:shadow-primary/40"
      }
    },
    {
      showShadow: true,
      color: "secondary",
      class: {
        cellButton: "data-[selected=true]:shadow-secondary/40"
      }
    },
    {
      showShadow: true,
      color: "success",
      class: {
        cellButton: "data-[selected=true]:shadow-success/40"
      }
    },
    {
      showShadow: true,
      color: "warning",
      class: {
        cellButton: "data-[selected=true]:shadow-warning/40"
      }
    },
    {
      showShadow: true,
      color: "danger",
      class: {
        cellButton: "data-[selected=true]:shadow-danger/40"
      }
    },
    // showShadow & isRange
    {
      showShadow: true,
      isRange: true,
      class: {
        cellButton: [
          // remove shadow from middle
          "data-[selected=true]:shadow-none",
          // add shadow to start (selected)
          "data-[selected=true]:data-[selection-start=true]:shadow-md",
          // add shadow to end (selected)
          "data-[selected=true]:data-[selection-end=true]:shadow-md"
        ]
      }
    }
  ],
  compoundSlots: [
    {
      slots: ["prevButton", "nextButton"],
      class: ["text-medium", "text-default-400"]
    },
    {
      slots: ["pickerMonthList", "pickerYearList"],
      class: [
        // styles
        "flex flex-col px-4 overflow-y-scroll scrollbar-hide snap-y snap-mandatory",
        // scroll shadow
        "[--scroll-shadow-size:100px]",
        "[mask-image:linear-gradient(#000,#000,transparent_0,#000_var(--scroll-shadow-size),#000_calc(100%_-_var(--scroll-shadow-size)),transparent)]"
      ]
    }
  ]
});
var card = tv({
  slots: {
    base: [
      "flex",
      "flex-col",
      "relative",
      "overflow-hidden",
      "h-auto",
      "outline-hidden",
      "text-foreground",
      "box-border",
      "bg-content1",
      // focus ring
      ...dataFocusVisibleClasses
    ],
    header: [
      "flex",
      "p-3",
      "z-10",
      "w-full",
      "justify-start",
      "items-center",
      "shrink-0",
      "overflow-inherit",
      "color-inherit",
      "subpixel-antialiased"
    ],
    body: [
      "relative",
      "flex",
      "flex-1",
      "w-full",
      "p-3",
      "flex-auto",
      "flex-col",
      "place-content-inherit",
      "align-items-inherit",
      "h-auto",
      "break-words",
      "text-left",
      "overflow-y-auto",
      "subpixel-antialiased"
    ],
    footer: [
      "p-3",
      "h-auto",
      "flex",
      "w-full",
      "items-center",
      "overflow-hidden",
      "color-inherit",
      "subpixel-antialiased"
    ]
  },
  variants: {
    shadow: {
      none: {
        base: "shadow-none"
      },
      sm: {
        base: "shadow-small"
      },
      md: {
        base: "shadow-medium"
      },
      lg: {
        base: "shadow-large"
      }
    },
    radius: {
      none: {
        base: "rounded-none",
        header: "rounded-none",
        footer: "rounded-none"
      },
      sm: {
        base: "rounded-small",
        header: "rounded-t-small",
        footer: "rounded-b-small"
      },
      md: {
        base: "rounded-medium",
        header: "rounded-t-medium",
        footer: "rounded-b-medium"
      },
      lg: {
        base: "rounded-large",
        header: "rounded-t-large",
        footer: "rounded-b-large"
      }
    },
    fullWidth: {
      true: {
        base: "w-full"
      }
    },
    isHoverable: {
      true: {
        base: "data-[hover=true]:bg-content2 dark:data-[hover=true]:bg-content2"
      }
    },
    isPressable: {
      true: { base: "cursor-pointer" }
    },
    isBlurred: {
      true: {
        base: [
          "bg-background/80",
          "dark:bg-background/20",
          "backdrop-blur-md",
          "backdrop-saturate-150"
        ]
      }
    },
    isFooterBlurred: {
      true: {
        footer: ["bg-background/10", "backdrop-blur", "backdrop-saturate-150"]
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled cursor-not-allowed"
      }
    },
    disableAnimation: {
      true: "",
      false: { base: "transition-transform-background motion-reduce:transition-none" }
    }
  },
  compoundVariants: [
    {
      isPressable: true,
      class: "data-[pressed=true]:scale-[0.97] tap-highlight-transparent"
    }
  ],
  defaultVariants: {
    radius: "lg",
    shadow: "md",
    fullWidth: false,
    isHoverable: false,
    isPressable: false,
    isDisabled: false,
    isFooterBlurred: false
  }
});
var checkbox = tv({
  slots: {
    base: "group relative max-w-fit inline-flex items-center justify-start cursor-pointer tap-highlight-transparent p-2 -m-2 select-none",
    wrapper: [
      "relative",
      "inline-flex",
      "items-center",
      "justify-center",
      "shrink-0",
      "overflow-hidden",
      // before
      "before:content-['']",
      "before:absolute",
      "before:inset-0",
      "before:border-solid",
      "before:border-2",
      "before:box-border",
      "before:border-default",
      // after
      "after:content-['']",
      "after:absolute",
      "after:inset-0",
      "after:scale-50",
      "after:opacity-0",
      "after:origin-center",
      "group-data-[selected=true]:after:scale-100",
      "group-data-[selected=true]:after:opacity-100",
      // hover
      "group-data-[hover=true]:before:bg-default-100",
      // focus ring
      ...groupDataFocusVisibleClasses
    ],
    hiddenInput: hiddenInputClasses,
    icon: "z-10 w-4 h-3 opacity-0 group-data-[selected=true]:opacity-100 pointer-events-none",
    label: "relative text-foreground select-none"
  },
  variants: {
    color: {
      default: {
        wrapper: "after:bg-default after:text-default-foreground text-default-foreground"
      },
      primary: {
        wrapper: "after:bg-primary after:text-primary-foreground text-primary-foreground"
      },
      secondary: {
        wrapper: "after:bg-secondary after:text-secondary-foreground text-secondary-foreground"
      },
      success: {
        wrapper: "after:bg-success after:text-success-foreground text-success-foreground"
      },
      warning: {
        wrapper: "after:bg-warning after:text-warning-foreground text-warning-foreground"
      },
      danger: {
        wrapper: "after:bg-danger after:text-danger-foreground text-danger-foreground"
      }
    },
    size: {
      sm: {
        wrapper: [
          "w-4 h-4 me-2",
          "rounded-[calc(var(--heroui-radius-medium)*0.5)]",
          "before:rounded-[calc(var(--heroui-radius-medium)*0.5)]",
          "after:rounded-[calc(var(--heroui-radius-medium)*0.5)]"
        ],
        label: "text-small",
        icon: "w-3 h-2"
      },
      md: {
        wrapper: [
          "w-5 h-5 me-2",
          "rounded-[calc(var(--heroui-radius-medium)*0.6)]",
          "before:rounded-[calc(var(--heroui-radius-medium)*0.6)]",
          "after:rounded-[calc(var(--heroui-radius-medium)*0.6)]"
        ],
        label: "text-medium",
        icon: "w-4 h-3"
      },
      lg: {
        wrapper: [
          "w-6 h-6 me-2",
          "rounded-[calc(var(--heroui-radius-medium)*0.7)]",
          "before:rounded-[calc(var(--heroui-radius-medium)*0.7)]",
          "after:rounded-[calc(var(--heroui-radius-medium)*0.7)]"
        ],
        label: "text-large",
        icon: "w-5 h-4"
      }
    },
    radius: {
      none: {
        wrapper: "rounded-none before:rounded-none after:rounded-none"
      },
      sm: {
        wrapper: [
          "rounded-[calc(var(--heroui-radius-medium)*0.5)]",
          "before:rounded-[calc(var(--heroui-radius-medium)*0.5)]",
          "after:rounded-[calc(var(--heroui-radius-medium)*0.5)]"
        ]
      },
      md: {
        wrapper: [
          "rounded-[calc(var(--heroui-radius-medium)*0.6)]",
          "before:rounded-[calc(var(--heroui-radius-medium)*0.6)]",
          "after:rounded-[calc(var(--heroui-radius-medium)*0.6)]"
        ]
      },
      lg: {
        wrapper: [
          "rounded-[calc(var(--heroui-radius-medium)*0.7)]",
          "before:rounded-[calc(var(--heroui-radius-medium)*0.7)]",
          "after:rounded-[calc(var(--heroui-radius-medium)*0.7)]"
        ]
      },
      full: {
        wrapper: "rounded-full before:rounded-full after:rounded-full"
      }
    },
    lineThrough: {
      true: {
        label: [
          "inline-flex",
          "items-center",
          "justify-center",
          "before:content-['']",
          "before:absolute",
          "before:bg-foreground",
          "before:w-0",
          "before:h-0.5",
          "group-data-[selected=true]:opacity-60",
          "group-data-[selected=true]:before:w-full"
        ]
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none"
      }
    },
    isInvalid: {
      true: {
        wrapper: "before:border-danger",
        label: "text-danger"
      }
    },
    disableAnimation: {
      true: {
        wrapper: "transition-none",
        icon: "transition-none",
        label: "transition-none"
      },
      false: {
        wrapper: [
          "before:transition-colors",
          "group-data-[pressed=true]:scale-95",
          "transition-transform",
          "after:transition-transform-opacity",
          "after:!ease-linear",
          "after:!duration-200",
          "motion-reduce:transition-none"
        ],
        icon: "transition-opacity motion-reduce:transition-none",
        label: "transition-colors-opacity before:transition-width motion-reduce:transition-none"
      }
    }
  },
  defaultVariants: {
    color: "primary",
    size: "md",
    isDisabled: false,
    lineThrough: false
  }
});
var checkboxGroup = tv({
  slots: {
    base: "relative flex flex-col gap-2",
    label: "relative text-medium text-foreground-500",
    wrapper: "flex flex-col flex-wrap gap-2 data-[orientation=horizontal]:flex-row",
    description: "text-small text-foreground-400",
    errorMessage: "text-small text-danger"
  },
  variants: {
    isRequired: {
      true: {
        label: "after:content-['*'] after:text-danger after:ml-0.5"
      }
    },
    isInvalid: {
      true: {
        description: "text-danger"
      }
    },
    disableAnimation: {
      true: {},
      false: {
        description: "transition-colors !duration-150 motion-reduce:transition-none"
      }
    }
  },
  defaultVariants: {
    isInvalid: false,
    isRequired: false
  }
});
var chip = tv({
  slots: {
    base: [
      "relative",
      "max-w-fit",
      "min-w-min",
      "inline-flex",
      "items-center",
      "justify-between",
      "box-border",
      "whitespace-nowrap"
    ],
    content: "flex-1 text-inherit font-normal",
    dot: ["w-2", "h-2", "ml-1", "rounded-full"],
    avatar: "shrink-0",
    closeButton: [
      "z-10",
      "appearance-none",
      "outline-hidden",
      "select-none",
      "transition-opacity",
      "opacity-70",
      "hover:opacity-100",
      "cursor-pointer",
      "active:opacity-disabled",
      "tap-highlight-transparent"
    ]
  },
  variants: {
    variant: {
      solid: {},
      bordered: {
        base: "border-medium bg-transparent"
      },
      light: {
        base: "bg-transparent"
      },
      flat: {},
      faded: {
        base: "border-medium"
      },
      shadow: {},
      dot: {
        base: "border-medium border-default text-foreground bg-transparent"
      }
    },
    color: {
      default: {
        dot: "bg-default-400"
      },
      primary: {
        dot: "bg-primary"
      },
      secondary: {
        dot: "bg-secondary"
      },
      success: {
        dot: "bg-success"
      },
      warning: {
        dot: "bg-warning"
      },
      danger: {
        dot: "bg-danger"
      }
    },
    size: {
      sm: {
        base: "px-1 h-6 text-tiny",
        content: "px-1",
        closeButton: "text-medium",
        avatar: "w-4 h-4"
      },
      md: {
        base: "px-1 h-7 text-small",
        content: "px-2",
        closeButton: "text-large",
        avatar: "w-5 h-5"
      },
      lg: {
        base: "px-2 h-8 text-medium",
        content: "px-2",
        closeButton: "text-xl",
        avatar: "w-6 h-6"
      }
    },
    radius: {
      none: {
        base: "rounded-none"
      },
      sm: {
        base: "rounded-small"
      },
      md: {
        base: "rounded-medium"
      },
      lg: {
        base: "rounded-large"
      },
      full: {
        base: "rounded-full"
      }
    },
    isOneChar: {
      true: {},
      false: {}
    },
    isCloseable: {
      true: {},
      false: {}
    },
    hasStartContent: {
      true: {}
    },
    hasEndContent: {
      true: {}
    },
    isDisabled: {
      true: { base: "opacity-disabled pointer-events-none" }
    },
    isCloseButtonFocusVisible: {
      true: {
        closeButton: [...ringClasses, "ring-1", "rounded-full"]
      }
    }
  },
  defaultVariants: {
    variant: "solid",
    color: "default",
    size: "md",
    radius: "full",
    isDisabled: false
  },
  compoundVariants: [
    // solid / color
    {
      variant: "solid",
      color: "default",
      class: {
        base: colorVariants.solid.default
      }
    },
    {
      variant: "solid",
      color: "primary",
      class: {
        base: colorVariants.solid.primary
      }
    },
    {
      variant: "solid",
      color: "secondary",
      class: {
        base: colorVariants.solid.secondary
      }
    },
    {
      variant: "solid",
      color: "success",
      class: {
        base: colorVariants.solid.success
      }
    },
    {
      variant: "solid",
      color: "warning",
      class: {
        base: colorVariants.solid.warning
      }
    },
    {
      variant: "solid",
      color: "danger",
      class: {
        base: colorVariants.solid.danger
      }
    },
    // shadow / color
    {
      variant: "shadow",
      color: "default",
      class: {
        base: colorVariants.shadow.default
      }
    },
    {
      variant: "shadow",
      color: "primary",
      class: {
        base: colorVariants.shadow.primary
      }
    },
    {
      variant: "shadow",
      color: "secondary",
      class: {
        base: colorVariants.shadow.secondary
      }
    },
    {
      variant: "shadow",
      color: "success",
      class: {
        base: colorVariants.shadow.success
      }
    },
    {
      variant: "shadow",
      color: "warning",
      class: {
        base: colorVariants.shadow.warning
      }
    },
    {
      variant: "shadow",
      color: "danger",
      class: {
        base: colorVariants.shadow.danger
      }
    },
    // bordered / color
    {
      variant: "bordered",
      color: "default",
      class: {
        base: colorVariants.bordered.default
      }
    },
    {
      variant: "bordered",
      color: "primary",
      class: {
        base: colorVariants.bordered.primary
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        base: colorVariants.bordered.secondary
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        base: colorVariants.bordered.success
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        base: colorVariants.bordered.warning
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        base: colorVariants.bordered.danger
      }
    },
    // flat / color
    {
      variant: "flat",
      color: "default",
      class: {
        base: colorVariants.flat.default
      }
    },
    {
      variant: "flat",
      color: "primary",
      class: {
        base: colorVariants.flat.primary
      }
    },
    {
      variant: "flat",
      color: "secondary",
      class: {
        base: colorVariants.flat.secondary
      }
    },
    {
      variant: "flat",
      color: "success",
      class: {
        base: colorVariants.flat.success
      }
    },
    {
      variant: "flat",
      color: "warning",
      class: {
        base: colorVariants.flat.warning
      }
    },
    {
      variant: "flat",
      color: "danger",
      class: {
        base: colorVariants.flat.danger
      }
    },
    // faded / color
    {
      variant: "faded",
      color: "default",
      class: {
        base: colorVariants.faded.default
      }
    },
    {
      variant: "faded",
      color: "primary",
      class: {
        base: colorVariants.faded.primary
      }
    },
    {
      variant: "faded",
      color: "secondary",
      class: {
        base: colorVariants.faded.secondary
      }
    },
    {
      variant: "faded",
      color: "success",
      class: {
        base: colorVariants.faded.success
      }
    },
    {
      variant: "faded",
      color: "warning",
      class: {
        base: colorVariants.faded.warning
      }
    },
    {
      variant: "faded",
      color: "danger",
      class: {
        base: colorVariants.faded.danger
      }
    },
    // light / color
    {
      variant: "light",
      color: "default",
      class: {
        base: colorVariants.light.default
      }
    },
    {
      variant: "light",
      color: "primary",
      class: {
        base: colorVariants.light.primary
      }
    },
    {
      variant: "light",
      color: "secondary",
      class: {
        base: colorVariants.light.secondary
      }
    },
    {
      variant: "light",
      color: "success",
      class: {
        base: colorVariants.light.success
      }
    },
    {
      variant: "light",
      color: "warning",
      class: {
        base: colorVariants.light.warning
      }
    },
    {
      variant: "light",
      color: "danger",
      class: {
        base: colorVariants.light.danger
      }
    },
    // isOneChar / size
    {
      isOneChar: true,
      hasStartContent: false,
      hasEndContent: false,
      size: "sm",
      class: {
        base: "w-5 h-5 min-w-5 min-h-5"
      }
    },
    {
      isOneChar: true,
      hasStartContent: false,
      hasEndContent: false,
      size: "md",
      class: {
        base: "w-6 h-6 min-w-6 min-h-6"
      }
    },
    {
      isOneChar: true,
      hasStartContent: false,
      hasEndContent: false,
      size: "lg",
      class: {
        base: "w-7 h-7 min-w-7 min-h-7"
      }
    },
    // isOneChar / isCloseable
    {
      isOneChar: true,
      isCloseable: false,
      hasStartContent: false,
      hasEndContent: false,
      class: {
        base: "px-0 justify-center",
        content: "px-0 flex-none"
      }
    },
    {
      isOneChar: true,
      isCloseable: true,
      hasStartContent: false,
      hasEndContent: false,
      class: {
        base: "w-auto"
      }
    },
    // isOneChar / dot
    {
      isOneChar: true,
      variant: "dot",
      class: {
        base: "w-auto h-7 px-1 items-center",
        content: "px-2"
      }
    },
    // hasStartContent / size
    {
      hasStartContent: true,
      size: "sm",
      class: {
        content: "pl-0.5"
      }
    },
    {
      hasStartContent: true,
      size: ["md", "lg"],
      class: {
        content: "pl-1"
      }
    },
    // hasEndContent / size
    {
      hasEndContent: true,
      size: "sm",
      class: {
        content: "pr-0.5"
      }
    },
    {
      hasEndContent: true,
      size: ["md", "lg"],
      class: {
        content: "pr-1"
      }
    }
  ]
});
var code$1 = tv({
  base: ["px-2", "py-1", "h-fit", "font-mono", "font-normal", "inline-block", "whitespace-nowrap"],
  variants: {
    color: {
      default: colorVariants.flat.default,
      primary: colorVariants.flat.primary,
      secondary: colorVariants.flat.secondary,
      success: colorVariants.flat.success,
      warning: colorVariants.flat.warning,
      danger: colorVariants.flat.danger
    },
    size: {
      sm: "text-small",
      md: "text-medium",
      lg: "text-large"
    },
    radius: {
      none: "rounded-none",
      sm: "rounded-small",
      md: "rounded-medium",
      lg: "rounded-large",
      full: "rounded-full"
    }
  },
  defaultVariants: {
    color: "default",
    size: "sm",
    radius: "sm"
  }
});
var dateInput = tv({
  slots: {
    base: "group flex flex-col",
    label: [
      "block subpixel-antialiased text-small text-default-600",
      // isRequired=true
      "group-data-[required=true]:after:content-['*'] group-data-[required=true]:after:text-danger group-data-[required=true]:after:ml-0.5",
      // isInValid=true
      "group-data-[invalid=true]:text-danger"
    ],
    inputWrapper: [
      "relative px-3 gap-3 w-full inline-flex flex-row items-center",
      "cursor-text tap-highlight-transparent shadow-xs"
    ],
    input: "flex h-full gap-x-0.5 w-full font-normal",
    innerWrapper: [
      "flex items-center text-default-400 w-full gap-x-2 h-6",
      // isInValid=true
      "group-data-[invalid=true]:text-danger"
    ],
    // this wraps the input and the start/end content
    segment: [
      "group first:-ml-0.5 [&:not(:first-child)]:-ml-1 px-0.5 my-auto box-content tabular-nums text-start",
      "inline-block outline-hidden focus:shadow-xs rounded-md",
      "text-foreground-500 data-[editable=true]:text-foreground",
      "data-[editable=true]:data-[placeholder=true]:text-foreground-500",
      // isInvalid=true
      "data-[invalid=true]:text-danger-300 data-[invalid=true]:data-[editable=true]:text-danger",
      "data-[invalid=true]:focus:bg-danger-400/50 dark:data-[invalid=true]:focus:bg-danger-400/20",
      "data-[invalid=true]:data-[editable=true]:focus:text-danger"
    ],
    helperWrapper: "hidden group-data-[has-helper=true]:flex p-1 relative flex-col gap-1.5",
    description: "text-tiny text-foreground-400",
    errorMessage: "text-tiny text-danger"
  },
  variants: {
    variant: {
      flat: {
        inputWrapper: [
          "bg-default-100",
          "hover:bg-default-200",
          "focus-within:hover:bg-default-100",
          // isInvalid=true
          "group-data-[invalid=true]:bg-danger-50",
          "group-data-[invalid=true]:hover:bg-danger-100",
          "group-data-[invalid=true]:focus-within:hover:bg-danger-50"
        ]
      },
      faded: {
        inputWrapper: [
          "bg-default-100",
          "border-medium",
          "border-default-200",
          "hover:border-default-400"
        ]
      },
      bordered: {
        inputWrapper: [
          "border-medium",
          "border-default-200",
          "hover:border-default-400",
          "focus-within:border-default-foreground",
          "focus-within:hover:border-default-foreground",
          // isInvalid=true
          "group-data-[invalid=true]:border-danger",
          "group-data-[invalid=true]:hover:border-danger",
          "group-data-[invalid=true]:focus-within:hover:border-danger"
        ]
      },
      underlined: {
        inputWrapper: [
          "px-1",
          "pb-1",
          "gap-0",
          "relative",
          "box-border",
          "border-b-medium",
          "shadow-[0_1px_0px_0_rgba(0,0,0,0.05)]",
          "border-default-200",
          "!rounded-none",
          "hover:border-default-300",
          "after:content-['']",
          "after:w-0",
          "after:origin-center",
          "after:bg-default-foreground",
          "after:absolute",
          "after:left-1/2",
          "after:-translate-x-1/2",
          "after:-bottom-[2px]",
          "after:h-[2px]",
          "focus-within:after:w-full",
          // isInvalid=true
          "group-data-[invalid=true]:after:bg-danger"
        ]
      }
    },
    color: {
      default: {
        segment: "focus:bg-default-400/50 data-[editable=true]:focus:text-default-foreground"
      },
      primary: {
        segment: "focus:bg-primary-400/50 data-[editable=true]:focus:text-primary"
      },
      secondary: {
        segment: "focus:bg-secondary-400/50 data-[editable=true]:focus:text-secondary"
      },
      success: {
        segment: "focus:bg-success-400/50 dark:focus:bg-success-400/20 data-[editable=true]:focus:text-success"
      },
      warning: {
        segment: "focus:bg-warning-400/50 dark:focus:bg-warning-400/20 data-[editable=true]:focus:text-warning"
      },
      danger: {
        segment: "focus:bg-danger-400/50 dark:focus:bg-danger-400/20 data-[editable=true]:focus:text-danger"
      }
    },
    size: {
      sm: {
        label: "text-tiny",
        input: "text-small",
        inputWrapper: "h-8 min-h-8 px-2 rounded-small"
      },
      md: {
        input: "text-small",
        inputWrapper: "h-10 min-h-10 rounded-medium",
        clearButton: "text-large"
      },
      lg: {
        label: "text-medium",
        input: "text-medium",
        inputWrapper: "h-12 min-h-12 rounded-large"
      }
    },
    radius: {
      none: {
        inputWrapper: "rounded-none"
      },
      sm: {
        inputWrapper: "rounded-small"
      },
      md: {
        inputWrapper: "rounded-medium"
      },
      lg: {
        inputWrapper: "rounded-large"
      },
      full: {
        inputWrapper: "rounded-full"
      }
    },
    labelPlacement: {
      outside: {
        base: "flex flex-col data-[has-helper=true]:pb-[calc(var(--heroui-font-size-tiny)_+8px)] gap-y-1.5",
        label: "w-full text-foreground",
        helperWrapper: "absolute top-[calc(100%_+_2px)] start-0"
      },
      "outside-left": {
        base: "flex-row items-center data-[has-helper=true]:pb-[calc(var(--heroui-font-size-tiny)_+_8px)] gap-x-2 flex-nowrap",
        label: "relative text-foreground",
        inputWrapper: "relative flex-1",
        helperWrapper: "absolute top-[calc(100%_+_2px)] start-0"
      },
      inside: {
        label: "w-full text-tiny cursor-text",
        inputWrapper: "flex-col items-start justify-center gap-0"
      }
    },
    fullWidth: {
      true: {
        base: "w-full",
        inputWrapper: "w-full"
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none",
        inputWrapper: "pointer-events-none",
        label: "pointer-events-none"
      }
    },
    disableAnimation: {
      true: {
        label: "transition-none",
        input: "transition-none",
        inputWrapper: "transition-none"
      },
      false: {
        label: [
          "!ease-out",
          "!duration-200",
          "will-change-auto",
          "motion-reduce:transition-none",
          "transition-[color,opacity]"
        ],
        inputWrapper: "transition-background motion-reduce:transition-none !duration-150",
        segment: "transition-colors motion-reduce:transition-none"
      }
    }
  },
  defaultVariants: {
    variant: "flat",
    color: "default",
    size: "md",
    fullWidth: true,
    isDisabled: false
  },
  compoundVariants: [
    // flat & color
    {
      variant: "flat",
      color: "primary",
      class: {
        innerWrapper: "text-primary",
        inputWrapper: ["bg-primary-100", "hover:bg-primary-50", "focus-within:bg-primary-50"],
        segment: "text-primary-300 data-[editable=true]:data-[placeholder=true]:text-primary-300 data-[editable=true]:text-primary",
        label: "text-primary"
      }
    },
    {
      variant: "flat",
      color: "secondary",
      class: {
        innerWrapper: "text-secondary",
        inputWrapper: ["bg-secondary-100", "hover:bg-secondary-50", "focus-within:bg-secondary-50"],
        segment: "text-secondary-300 data-[editable=true]:data-[placeholder=true]:text-secondary-300 data-[editable=true]:text-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "flat",
      color: "success",
      class: {
        innerWrapper: "text-success-600 dark:text-success",
        inputWrapper: ["bg-success-100", "hover:bg-success-50", "focus-within:bg-success-50"],
        segment: "text-success-400 data-[editable=true]:data-[placeholder=true]:text-success-400 data-[editable=true]:text-success-600 data-[editable=true]:focus:text-success-600",
        label: "text-success-600 dark:text-success"
      }
    },
    {
      variant: "flat",
      color: "warning",
      class: {
        innerWrapper: "text-warning-600 dark:text-warning",
        inputWrapper: ["bg-warning-100", "hover:bg-warning-50", "focus-within:bg-warning-50"],
        segment: "text-warning-400 data-[editable=true]:data-[placeholder=true]:text-warning-400 data-[editable=true]:text-warning-600 data-[editable=true]:focus:text-warning-600",
        label: "text-warning-600 dark:text-warning"
      }
    },
    {
      variant: "flat",
      color: "danger",
      class: {
        innerWrapper: "text-danger",
        inputWrapper: ["bg-danger-100", "hover:bg-danger-50", "focus-within:bg-danger-50"],
        segment: "text-danger-300 data-[editable=true]:data-[placeholder=true]:text-danger-300 data-[editable=true]:text-danger",
        label: "text-danger"
      }
    },
    // faded & color
    {
      variant: "faded",
      color: "primary",
      class: {
        innerWrapper: "text-primary",
        inputWrapper: [
          "hover:border-primary",
          "focus-within:border-primary",
          "focus-within:hover:border-primary"
        ],
        label: "text-primary"
      }
    },
    {
      variant: "faded",
      color: "secondary",
      class: {
        innerWrapper: "text-secondary",
        inputWrapper: [
          "hover:border-secondary",
          "focus-within:border-secondary",
          "focus-within:hover:border-secondary"
        ],
        label: "text-secondary"
      }
    },
    {
      variant: "faded",
      color: "success",
      class: {
        innerWrapper: "text-success",
        inputWrapper: [
          "hover:border-success",
          "focus-within:border-success",
          "focus-within:hover:border-success"
        ],
        label: "text-success"
      }
    },
    {
      variant: "faded",
      color: "warning",
      class: {
        innerWrapper: "text-warning",
        inputWrapper: [
          "hover:border-warning",
          "focus-within:border-warning",
          "focus-within:hover:border-warning"
        ],
        label: "text-warning"
      }
    },
    {
      variant: "faded",
      color: "danger",
      class: {
        innerWrapper: "text-danger",
        inputWrapper: [
          "hover:border-danger",
          "focus-within:border-danger",
          "focus-within:hover:border-danger"
        ],
        label: "text-danger"
      }
    },
    // bordered & color
    {
      variant: "bordered",
      color: "primary",
      class: {
        innerWrapper: "text-primary",
        inputWrapper: ["focus-within:border-primary", "focus-within:hover:border-primary"],
        label: "text-primary"
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        innerWrapper: "text-secondary",
        inputWrapper: ["focus-within:border-secondary", "focus-within:hover:border-secondary"],
        label: "text-secondary"
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        innerWrapper: "text-success",
        inputWrapper: ["focus-within:border-success", "focus-within:hover:border-success"],
        label: "text-success"
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        innerWrapper: "text-warning",
        inputWrapper: ["focus-within:border-warning", "focus-within:hover:border-warning"],
        label: "text-warning"
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        innerWrapper: "text-danger",
        inputWrapper: ["focus-within:border-danger", "focus-within:hover:border-danger"],
        label: "text-danger"
      }
    },
    // underlined & color
    {
      variant: "underlined",
      color: "primary",
      class: {
        innerWrapper: "text-primary",
        inputWrapper: "after:bg-primary",
        label: "text-primary"
      }
    },
    {
      variant: "underlined",
      color: "secondary",
      class: {
        innerWrapper: "text-secondary",
        inputWrapper: "after:bg-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "underlined",
      color: "success",
      class: {
        innerWrapper: "text-success",
        inputWrapper: "after:bg-success",
        label: "text-success"
      }
    },
    {
      variant: "underlined",
      color: "warning",
      class: {
        innerWrapper: "text-warning",
        inputWrapper: "after:bg-warning",
        label: "text-warning"
      }
    },
    {
      variant: "underlined",
      color: "danger",
      class: {
        innerWrapper: "text-danger",
        inputWrapper: "after:bg-danger",
        label: "text-danger"
      }
    },
    // size & labelPlacement
    {
      labelPlacement: "inside",
      size: "sm",
      class: {
        inputWrapper: "h-12 py-1.5 px-3"
      }
    },
    {
      labelPlacement: "inside",
      size: "md",
      class: {
        inputWrapper: "h-14 py-2"
      }
    },
    {
      labelPlacement: "inside",
      size: "lg",
      class: {
        label: "text-medium",
        inputWrapper: "h-16 py-2.5 gap-0"
      }
    },
    // !disableAnimation & variant
    {
      disableAnimation: false,
      variant: ["faded", "bordered"],
      class: {
        inputWrapper: "transition-colors motion-reduce:transition-none"
      }
    },
    {
      disableAnimation: false,
      variant: "underlined",
      class: {
        inputWrapper: "after:transition-width motion-reduce:after:transition-none"
      }
    }
  ]
});
var datePicker = tv({
  slots: {
    base: "group w-full",
    selectorButton: "-mx-2 text-inherit",
    selectorIcon: "text-lg text-inherit pointer-events-none shrink-0",
    popoverContent: "p-0 w-full",
    calendar: "w-[calc(var(--visible-months)_*_var(--calendar-width))] shadow-none",
    calendarContent: "w-[calc(var(--visible-months)_*_var(--calendar-width))]",
    timeInputLabel: "font-medium",
    timeInput: "px-5 pb-4 flex-wrap gap-x-6"
  }
});
var dateRangePicker = tv({
  extend: datePicker,
  slots: {
    calendar: "group",
    bottomContent: "flex flex-col gap-y-2",
    timeInputWrapper: "flex flex-col group-data-[has-multiple-months=true]:flex-row",
    separator: "-mx-1 text-inherit"
  }
});
var accordion = tv({
  base: "px-2",
  variants: {
    variant: {
      light: "",
      shadow: "px-4 shadow-medium rounded-medium bg-content1",
      bordered: "px-4 border-medium border-divider rounded-medium",
      splitted: "flex flex-col gap-2"
    },
    fullWidth: {
      true: "w-full"
    }
  },
  defaultVariants: {
    variant: "light",
    fullWidth: true
  }
});
var accordionItem = tv({
  slots: {
    base: "",
    heading: "",
    trigger: [
      "flex py-4 w-full h-full gap-3 outline-hidden items-center tap-highlight-transparent",
      // focus ring
      ...dataFocusVisibleClasses
    ],
    startContent: "shrink-0",
    indicator: "text-default-400",
    titleWrapper: "flex-1 flex flex-col text-start",
    title: "text-foreground text-medium",
    subtitle: "text-small text-foreground-500 font-normal",
    content: "py-2"
  },
  variants: {
    variant: {
      splitted: {
        base: "px-4 bg-content1 shadow-medium rounded-medium"
      }
    },
    isCompact: {
      true: {
        trigger: "py-2",
        title: "text-medium",
        subtitle: "text-small",
        indicator: "text-medium",
        content: "py-1"
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none"
      }
    },
    hideIndicator: {
      true: {
        indicator: "hidden"
      }
    },
    disableAnimation: {
      true: {
        content: "hidden data-[open=true]:block"
      },
      false: {
        indicator: "transition-transform",
        trigger: "transition-opacity"
      }
    },
    disableIndicatorAnimation: {
      true: {
        indicator: "transition-none"
      },
      false: {
        indicator: "rotate-0 data-[open=true]:-rotate-90 rtl:-rotate-180 rtl:data-[open=true]:-rotate-90"
      }
    }
  },
  defaultVariants: {
    size: "md",
    radius: "lg",
    isDisabled: false,
    hideIndicator: false,
    disableIndicatorAnimation: false
  }
});
var alert = tv({
  slots: {
    base: "flex flex-grow flex-row w-full items-start py-3 px-4 gap-x-1",
    mainWrapper: "h-full flex-grow min-h-10 ms-2 flex flex-col box-border items-start text-inherit justify-center",
    title: "text-small w-full font-medium block text-inherit leading-5",
    description: "pl-[1px] text-small font-normal text-inherit",
    closeButton: "relative text-inherit translate-x-1 -translate-y-1",
    iconWrapper: "flex-none relative w-9 h-9 rounded-full grid place-items-center",
    alertIcon: "fill-current w-6 absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"
  },
  variants: {
    color: {
      default: {},
      primary: {},
      secondary: {},
      success: {},
      warning: {},
      danger: {}
    },
    variant: {
      solid: {},
      flat: {},
      faded: {
        base: "border-small"
      },
      bordered: {
        base: "border-small bg-transparent"
      }
    },
    radius: {
      none: {
        base: "rounded-none"
      },
      sm: {
        base: "rounded-small"
      },
      md: {
        base: "rounded-medium"
      },
      lg: {
        base: "rounded-large"
      },
      full: {
        base: "rounded-full"
      }
    },
    hideIcon: {
      true: {
        iconWrapper: "hidden"
      }
    },
    hideIconWrapper: {
      true: {
        base: "gap-x-0",
        iconWrapper: "!bg-transparent !shadow-none !border-none"
      }
    },
    hasContent: {
      false: {
        base: "items-start",
        mainWrapper: "justify-center items-center"
      }
    }
  },
  defaultVariants: {
    color: "default",
    variant: "flat",
    radius: "md",
    hideIcon: false,
    hideIconWrapper: false
  },
  compoundVariants: [
    // solid / color
    {
      variant: "solid",
      color: "default",
      class: {
        base: colorVariants.solid.default,
        closeButton: "data-[hover]:bg-default-100",
        alertIcon: "text-default-foreground"
      }
    },
    {
      variant: "solid",
      color: "primary",
      class: {
        base: colorVariants.solid.primary
      }
    },
    {
      variant: "solid",
      color: "secondary",
      class: {
        base: colorVariants.solid.secondary
      }
    },
    {
      variant: "solid",
      color: "success",
      class: {
        base: colorVariants.solid.success
      }
    },
    {
      variant: "solid",
      color: "warning",
      class: {
        base: colorVariants.solid.warning
      }
    },
    {
      variant: "solid",
      color: "danger",
      class: {
        base: colorVariants.solid.danger
      }
    },
    // flat & faded / color
    {
      variant: ["flat", "faded"],
      color: "default",
      class: {
        base: [
          colorVariants.flat.default,
          "bg-default-100 dark:bg-default-50/50",
          "text-default-foreground"
        ],
        description: "text-default-600",
        closeButton: "text-default-400",
        iconWrapper: "bg-default-50 dark:bg-default-100 border-default-200"
      }
    },
    {
      variant: ["flat", "faded"],
      color: "primary",
      class: {
        base: [colorVariants.flat.primary, "bg-primary-50 dark:bg-primary-50/50"],
        closeButton: "text-primary-500 data-[hover]:bg-primary-200",
        iconWrapper: "bg-primary-50 dark:bg-primary-100 border-primary-100"
      }
    },
    {
      variant: ["flat", "faded"],
      color: "secondary",
      class: {
        base: [colorVariants.flat.secondary, "bg-secondary-50 dark:bg-secondary-50/50"],
        closeButton: "text-secondary-500 data-[hover]:bg-secondary-200",
        iconWrapper: "bg-secondary-50 dark:bg-secondary-100 border-secondary-100"
      }
    },
    {
      variant: ["flat", "faded"],
      color: "success",
      class: {
        base: [colorVariants.flat.success, "bg-success-50 dark:bg-success-50/50"],
        closeButton: "text-success-500 data-[hover]:bg-success-200",
        iconWrapper: "bg-success-50 dark:bg-success-100 border-success-100"
      }
    },
    {
      variant: ["flat", "faded"],
      color: "warning",
      class: {
        base: [colorVariants.flat.warning, "bg-warning-50 dark:bg-warning-50/50"],
        closeButton: "text-warning-500 data-[hover]:bg-warning-200",
        iconWrapper: "bg-warning-50 dark:bg-warning-100 border-warning-100"
      }
    },
    {
      variant: ["flat", "faded"],
      color: "danger",
      class: {
        base: [colorVariants.flat.danger, "bg-danger-50 dark:bg-danger-50/50"],
        closeButton: "text-danger-500 data-[hover]:bg-danger-200",
        iconWrapper: "bg-danger-50 dark:bg-danger-100 border-danger-100"
      }
    },
    // faded / color
    {
      variant: "faded",
      color: "default",
      class: {
        base: "border-default-300 dark:border-default-200"
      }
    },
    {
      variant: "faded",
      color: "primary",
      class: {
        base: "border-primary-200 dark:border-primary-100"
      }
    },
    {
      variant: "faded",
      color: "secondary",
      class: {
        base: "border-secondary-200"
      }
    },
    {
      variant: "faded",
      color: "success",
      class: {
        base: "border-success-300 dark:border-success-100"
      }
    },
    {
      variant: "faded",
      color: "warning",
      class: {
        base: "border-warning-300 dark:border-warning-100"
      }
    },
    {
      variant: "faded",
      color: "danger",
      class: {
        base: "border-danger-200 dark:border-danger-100"
      }
    },
    // bordered / color
    {
      variant: "bordered",
      color: "default",
      class: {
        base: [colorVariants.bordered.default],
        description: "text-default-600",
        closeButton: "text-default-400"
      }
    },
    {
      variant: "bordered",
      color: "primary",
      class: {
        base: [colorVariants.bordered.primary],
        closeButton: "data-[hover]:bg-primary-50"
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        base: [colorVariants.bordered.secondary],
        closeButton: "data-[hover]:bg-secondary-50"
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        base: [colorVariants.bordered.success],
        closeButton: "data-[hover]:bg-success-50"
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        base: [colorVariants.bordered.warning],
        closeButton: "data-[hover]:bg-warning-100"
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        base: [colorVariants.bordered.danger],
        closeButton: "data-[hover]:bg-danger-50"
      }
    },
    // flat & bordered & faded
    {
      variant: ["flat", "bordered", "faded"],
      class: {
        iconWrapper: "shadow-small"
      }
    },
    // flat & faded
    {
      variant: ["flat", "faded"],
      class: {
        iconWrapper: "shadow-small border-1"
      }
    },
    // bordered & color
    {
      variant: "bordered",
      color: "default",
      class: {
        iconWrapper: "bg-default-200 dark:bg-default-100"
      }
    },
    {
      variant: "bordered",
      color: "primary",
      class: {
        iconWrapper: "bg-primary-100 dark:bg-primary-50"
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        iconWrapper: "bg-secondary-100 dark:bg-secondary-50"
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        iconWrapper: "bg-success-100 dark:bg-success-50"
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        iconWrapper: "bg-warning-100 dark:bg-warning-50"
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        iconWrapper: "bg-danger-100 dark:bg-danger-50"
      }
    }
  ]
});
var autocomplete = tv({
  slots: {
    base: "group inline-flex flex-column w-full",
    listboxWrapper: "scroll-py-6 w-full",
    listbox: "",
    popoverContent: "w-full p-1 overflow-hidden",
    endContentWrapper: "relative flex h-full items-center -mr-2",
    clearButton: [
      "text-medium",
      "translate-x-1",
      "cursor-text",
      "opacity-0",
      "pointer-events-none",
      "text-default-500",
      "group-data-[invalid=true]:text-danger",
      "data-[visible=true]:opacity-100",
      // on mobile is always visible when there is a value
      "data-[visible=true]:pointer-events-auto",
      "data-[visible=true]:cursor-pointer",
      "sm:data-[visible=true]:opacity-0",
      // only visible on hover
      "sm:data-[visible=true]:pointer-events-none",
      "sm:group-data-[hover=true]:data-[visible=true]:opacity-100",
      "sm:group-data-[hover=true]:data-[visible=true]:pointer-events-auto"
    ],
    selectorButton: "text-medium"
  },
  variants: {
    isClearable: {
      true: {},
      false: {
        clearButton: "hidden"
      }
    },
    disableAnimation: {
      true: {
        selectorButton: "transition-none"
      },
      false: {
        selectorButton: "transition-transform duration-150 ease motion-reduce:transition-none"
      }
    },
    disableSelectorIconRotation: {
      true: {},
      false: {
        selectorButton: "data-[open=true]:rotate-180"
      }
    }
  },
  defaultVariants: {
    isClearable: true,
    disableSelectorIconRotation: false
  }
});
var badge = tv({
  slots: {
    base: ["relative", "inline-flex", "shrink-0"],
    badge: [
      "flex",
      "z-10",
      "flex-wrap",
      "absolute",
      "box-border",
      "rounded-full",
      "whitespace-nowrap",
      "place-content-center",
      "origin-center",
      "items-center",
      "text-inherit",
      "select-none",
      "font-regular",
      "scale-100",
      "opacity-100",
      "subpixel-antialiased",
      "data-[invisible=true]:scale-0",
      "data-[invisible=true]:opacity-0"
    ]
  },
  variants: {
    variant: {
      solid: {},
      flat: {},
      faded: {
        badge: "border-medium"
      },
      shadow: {}
    },
    color: {
      default: {},
      primary: {},
      secondary: {},
      success: {},
      warning: {},
      danger: {}
    },
    size: {
      sm: {
        badge: "px-1 text-tiny"
      },
      md: {
        badge: "px-1 text-small"
      },
      lg: {
        badge: "px-1 text-small"
      }
    },
    placement: {
      "top-right": {},
      "top-left": {},
      "bottom-right": {},
      "bottom-left": {}
    },
    shape: {
      circle: {},
      rectangle: {}
    },
    isInvisible: {
      true: {}
    },
    isOneChar: {
      true: {
        badge: "px-0"
      }
    },
    isDot: {
      true: {}
    },
    disableAnimation: {
      true: {
        badge: "transition-none"
      },
      false: {
        badge: "transition-transform-opacity !ease-soft-spring !duration-300"
      }
    },
    showOutline: {
      true: {
        badge: "border-2 border-background"
      },
      false: {
        badge: "border-transparent border-0"
      }
    }
  },
  defaultVariants: {
    variant: "solid",
    color: "default",
    size: "md",
    shape: "rectangle",
    placement: "top-right",
    showOutline: true,
    isInvisible: false
  },
  compoundVariants: [
    // solid / color
    {
      variant: "solid",
      color: "default",
      class: {
        badge: colorVariants.solid.default
      }
    },
    {
      variant: "solid",
      color: "primary",
      class: {
        badge: colorVariants.solid.primary
      }
    },
    {
      variant: "solid",
      color: "secondary",
      class: {
        badge: colorVariants.solid.secondary
      }
    },
    {
      variant: "solid",
      color: "success",
      class: {
        badge: colorVariants.solid.success
      }
    },
    {
      variant: "solid",
      color: "warning",
      class: {
        badge: colorVariants.solid.warning
      }
    },
    {
      variant: "solid",
      color: "danger",
      class: {
        badge: colorVariants.solid.danger
      }
    },
    // shadow / color
    {
      variant: "shadow",
      color: "default",
      class: {
        badge: colorVariants.shadow.default
      }
    },
    {
      variant: "shadow",
      color: "primary",
      class: {
        badge: colorVariants.shadow.primary
      }
    },
    {
      variant: "shadow",
      color: "secondary",
      class: {
        badge: colorVariants.shadow.secondary
      }
    },
    {
      variant: "shadow",
      color: "success",
      class: {
        badge: colorVariants.shadow.success
      }
    },
    {
      variant: "shadow",
      color: "warning",
      class: {
        badge: colorVariants.shadow.warning
      }
    },
    {
      variant: "shadow",
      color: "danger",
      class: {
        badge: colorVariants.shadow.danger
      }
    },
    // flat / color
    {
      variant: "flat",
      color: "default",
      class: {
        badge: colorVariants.flat.default
      }
    },
    {
      variant: "flat",
      color: "primary",
      class: {
        badge: colorVariants.flat.primary
      }
    },
    {
      variant: "flat",
      color: "secondary",
      class: {
        badge: colorVariants.flat.secondary
      }
    },
    {
      variant: "flat",
      color: "success",
      class: {
        badge: colorVariants.flat.success
      }
    },
    {
      variant: "flat",
      color: "warning",
      class: {
        badge: colorVariants.flat.warning
      }
    },
    {
      variant: "flat",
      color: "danger",
      class: {
        badge: colorVariants.flat.danger
      }
    },
    // faded / color
    {
      variant: "faded",
      color: "default",
      class: {
        badge: colorVariants.faded.default
      }
    },
    {
      variant: "faded",
      color: "primary",
      class: {
        badge: colorVariants.faded.primary
      }
    },
    {
      variant: "faded",
      color: "secondary",
      class: {
        badge: colorVariants.faded.secondary
      }
    },
    {
      variant: "faded",
      color: "success",
      class: {
        badge: colorVariants.faded.success
      }
    },
    {
      variant: "faded",
      color: "warning",
      class: {
        badge: colorVariants.faded.warning
      }
    },
    {
      variant: "faded",
      color: "danger",
      class: {
        badge: colorVariants.faded.danger
      }
    },
    // isOneChar / size
    {
      isOneChar: true,
      size: "sm",
      class: {
        badge: "w-4 h-4 min-w-4 min-h-4"
      }
    },
    {
      isOneChar: true,
      size: "md",
      class: {
        badge: "w-5 h-5 min-w-5 min-h-5"
      }
    },
    {
      isOneChar: true,
      size: "lg",
      class: {
        badge: "w-6 h-6 min-w-6 min-h-6"
      }
    },
    // isDot / size
    {
      isDot: true,
      size: "sm",
      class: {
        badge: "w-3 h-3 min-w-3 min-h-3"
      }
    },
    {
      isDot: true,
      size: "md",
      class: {
        badge: "w-3.5 h-3.5 min-w-3.5 min-h-3.5"
      }
    },
    {
      isDot: true,
      size: "lg",
      class: {
        badge: "w-4 h-4 min-w-4 min-h-4"
      }
    },
    // placement / rectangle
    {
      placement: "top-right",
      shape: "rectangle",
      class: {
        badge: "top-[5%] right-[5%] translate-x-1/2 -translate-y-1/2"
      }
    },
    {
      placement: "top-left",
      shape: "rectangle",
      class: {
        badge: "top-[5%] left-[5%] -translate-x-1/2 -translate-y-1/2"
      }
    },
    {
      placement: "bottom-right",
      shape: "rectangle",
      class: {
        badge: "bottom-[5%] right-[5%] translate-x-1/2 translate-y-1/2"
      }
    },
    {
      placement: "bottom-left",
      shape: "rectangle",
      class: {
        badge: "bottom-[5%] left-[5%] -translate-x-1/2 translate-y-1/2"
      }
    },
    // placement / circle
    {
      placement: "top-right",
      shape: "circle",
      class: {
        badge: "top-[10%] right-[10%] translate-x-1/2 -translate-y-1/2"
      }
    },
    {
      placement: "top-left",
      shape: "circle",
      class: {
        badge: "top-[10%] left-[10%] -translate-x-1/2 -translate-y-1/2"
      }
    },
    {
      placement: "bottom-right",
      shape: "circle",
      class: {
        badge: "bottom-[10%] right-[10%] translate-x-1/2 translate-y-1/2"
      }
    },
    {
      placement: "bottom-left",
      shape: "circle",
      class: {
        badge: "bottom-[10%] left-[10%] -translate-x-1/2 translate-y-1/2"
      }
    }
  ]
});
var mergeClasses$2 = (itemClasses, itemPropsClasses) => {
  if (!itemClasses && !itemPropsClasses)
    return {};
  const keys2 = /* @__PURE__ */ new Set([...Object.keys(itemClasses || {}), ...Object.keys(itemPropsClasses || {})]);
  return Array.from(keys2).reduce(
    (acc, key) => ({
      ...acc,
      [key]: clsx$4(itemClasses == null ? void 0 : itemClasses[key], itemPropsClasses == null ? void 0 : itemPropsClasses[key])
    }),
    {}
  );
};
function r$7(e2) {
  var t2, f2, n2 = "";
  if ("string" == typeof e2 || "number" == typeof e2)
    n2 += e2;
  else if ("object" == typeof e2)
    if (Array.isArray(e2))
      for (t2 = 0; t2 < e2.length; t2++)
        e2[t2] && (f2 = r$7(e2[t2])) && (n2 && (n2 += " "), n2 += f2);
    else
      for (t2 in e2)
        e2[t2] && (n2 && (n2 += " "), n2 += t2);
  return n2;
}
function clsx$2() {
  for (var e2, t2, f2 = 0, n2 = ""; f2 < arguments.length; )
    (e2 = arguments[f2++]) && (t2 = r$7(e2)) && (n2 && (n2 += " "), n2 += t2);
  return n2;
}
var twMerge = extendTailwindMerge({ extend: twMergeConfig });
function cn(...inputs) {
  return twMerge(clsx$2(inputs));
}
var colorName;
var hasRequiredColorName;
function requireColorName() {
  if (hasRequiredColorName)
    return colorName;
  hasRequiredColorName = 1;
  colorName = {
    "aliceblue": [240, 248, 255],
    "antiquewhite": [250, 235, 215],
    "aqua": [0, 255, 255],
    "aquamarine": [127, 255, 212],
    "azure": [240, 255, 255],
    "beige": [245, 245, 220],
    "bisque": [255, 228, 196],
    "black": [0, 0, 0],
    "blanchedalmond": [255, 235, 205],
    "blue": [0, 0, 255],
    "blueviolet": [138, 43, 226],
    "brown": [165, 42, 42],
    "burlywood": [222, 184, 135],
    "cadetblue": [95, 158, 160],
    "chartreuse": [127, 255, 0],
    "chocolate": [210, 105, 30],
    "coral": [255, 127, 80],
    "cornflowerblue": [100, 149, 237],
    "cornsilk": [255, 248, 220],
    "crimson": [220, 20, 60],
    "cyan": [0, 255, 255],
    "darkblue": [0, 0, 139],
    "darkcyan": [0, 139, 139],
    "darkgoldenrod": [184, 134, 11],
    "darkgray": [169, 169, 169],
    "darkgreen": [0, 100, 0],
    "darkgrey": [169, 169, 169],
    "darkkhaki": [189, 183, 107],
    "darkmagenta": [139, 0, 139],
    "darkolivegreen": [85, 107, 47],
    "darkorange": [255, 140, 0],
    "darkorchid": [153, 50, 204],
    "darkred": [139, 0, 0],
    "darksalmon": [233, 150, 122],
    "darkseagreen": [143, 188, 143],
    "darkslateblue": [72, 61, 139],
    "darkslategray": [47, 79, 79],
    "darkslategrey": [47, 79, 79],
    "darkturquoise": [0, 206, 209],
    "darkviolet": [148, 0, 211],
    "deeppink": [255, 20, 147],
    "deepskyblue": [0, 191, 255],
    "dimgray": [105, 105, 105],
    "dimgrey": [105, 105, 105],
    "dodgerblue": [30, 144, 255],
    "firebrick": [178, 34, 34],
    "floralwhite": [255, 250, 240],
    "forestgreen": [34, 139, 34],
    "fuchsia": [255, 0, 255],
    "gainsboro": [220, 220, 220],
    "ghostwhite": [248, 248, 255],
    "gold": [255, 215, 0],
    "goldenrod": [218, 165, 32],
    "gray": [128, 128, 128],
    "green": [0, 128, 0],
    "greenyellow": [173, 255, 47],
    "grey": [128, 128, 128],
    "honeydew": [240, 255, 240],
    "hotpink": [255, 105, 180],
    "indianred": [205, 92, 92],
    "indigo": [75, 0, 130],
    "ivory": [255, 255, 240],
    "khaki": [240, 230, 140],
    "lavender": [230, 230, 250],
    "lavenderblush": [255, 240, 245],
    "lawngreen": [124, 252, 0],
    "lemonchiffon": [255, 250, 205],
    "lightblue": [173, 216, 230],
    "lightcoral": [240, 128, 128],
    "lightcyan": [224, 255, 255],
    "lightgoldenrodyellow": [250, 250, 210],
    "lightgray": [211, 211, 211],
    "lightgreen": [144, 238, 144],
    "lightgrey": [211, 211, 211],
    "lightpink": [255, 182, 193],
    "lightsalmon": [255, 160, 122],
    "lightseagreen": [32, 178, 170],
    "lightskyblue": [135, 206, 250],
    "lightslategray": [119, 136, 153],
    "lightslategrey": [119, 136, 153],
    "lightsteelblue": [176, 196, 222],
    "lightyellow": [255, 255, 224],
    "lime": [0, 255, 0],
    "limegreen": [50, 205, 50],
    "linen": [250, 240, 230],
    "magenta": [255, 0, 255],
    "maroon": [128, 0, 0],
    "mediumaquamarine": [102, 205, 170],
    "mediumblue": [0, 0, 205],
    "mediumorchid": [186, 85, 211],
    "mediumpurple": [147, 112, 219],
    "mediumseagreen": [60, 179, 113],
    "mediumslateblue": [123, 104, 238],
    "mediumspringgreen": [0, 250, 154],
    "mediumturquoise": [72, 209, 204],
    "mediumvioletred": [199, 21, 133],
    "midnightblue": [25, 25, 112],
    "mintcream": [245, 255, 250],
    "mistyrose": [255, 228, 225],
    "moccasin": [255, 228, 181],
    "navajowhite": [255, 222, 173],
    "navy": [0, 0, 128],
    "oldlace": [253, 245, 230],
    "olive": [128, 128, 0],
    "olivedrab": [107, 142, 35],
    "orange": [255, 165, 0],
    "orangered": [255, 69, 0],
    "orchid": [218, 112, 214],
    "palegoldenrod": [238, 232, 170],
    "palegreen": [152, 251, 152],
    "paleturquoise": [175, 238, 238],
    "palevioletred": [219, 112, 147],
    "papayawhip": [255, 239, 213],
    "peachpuff": [255, 218, 185],
    "peru": [205, 133, 63],
    "pink": [255, 192, 203],
    "plum": [221, 160, 221],
    "powderblue": [176, 224, 230],
    "purple": [128, 0, 128],
    "rebeccapurple": [102, 51, 153],
    "red": [255, 0, 0],
    "rosybrown": [188, 143, 143],
    "royalblue": [65, 105, 225],
    "saddlebrown": [139, 69, 19],
    "salmon": [250, 128, 114],
    "sandybrown": [244, 164, 96],
    "seagreen": [46, 139, 87],
    "seashell": [255, 245, 238],
    "sienna": [160, 82, 45],
    "silver": [192, 192, 192],
    "skyblue": [135, 206, 235],
    "slateblue": [106, 90, 205],
    "slategray": [112, 128, 144],
    "slategrey": [112, 128, 144],
    "snow": [255, 250, 250],
    "springgreen": [0, 255, 127],
    "steelblue": [70, 130, 180],
    "tan": [210, 180, 140],
    "teal": [0, 128, 128],
    "thistle": [216, 191, 216],
    "tomato": [255, 99, 71],
    "turquoise": [64, 224, 208],
    "violet": [238, 130, 238],
    "wheat": [245, 222, 179],
    "white": [255, 255, 255],
    "whitesmoke": [245, 245, 245],
    "yellow": [255, 255, 0],
    "yellowgreen": [154, 205, 50]
  };
  return colorName;
}
var conversions;
var hasRequiredConversions;
function requireConversions() {
  if (hasRequiredConversions)
    return conversions;
  hasRequiredConversions = 1;
  const cssKeywords = requireColorName();
  const reverseKeywords = {};
  for (const key of Object.keys(cssKeywords)) {
    reverseKeywords[cssKeywords[key]] = key;
  }
  const convert2 = {
    rgb: { channels: 3, labels: "rgb" },
    hsl: { channels: 3, labels: "hsl" },
    hsv: { channels: 3, labels: "hsv" },
    hwb: { channels: 3, labels: "hwb" },
    cmyk: { channels: 4, labels: "cmyk" },
    xyz: { channels: 3, labels: "xyz" },
    lab: { channels: 3, labels: "lab" },
    lch: { channels: 3, labels: "lch" },
    hex: { channels: 1, labels: ["hex"] },
    keyword: { channels: 1, labels: ["keyword"] },
    ansi16: { channels: 1, labels: ["ansi16"] },
    ansi256: { channels: 1, labels: ["ansi256"] },
    hcg: { channels: 3, labels: ["h", "c", "g"] },
    apple: { channels: 3, labels: ["r16", "g16", "b16"] },
    gray: { channels: 1, labels: ["gray"] }
  };
  conversions = convert2;
  for (const model of Object.keys(convert2)) {
    if (!("channels" in convert2[model])) {
      throw new Error("missing channels property: " + model);
    }
    if (!("labels" in convert2[model])) {
      throw new Error("missing channel labels property: " + model);
    }
    if (convert2[model].labels.length !== convert2[model].channels) {
      throw new Error("channel and label counts mismatch: " + model);
    }
    const { channels, labels } = convert2[model];
    delete convert2[model].channels;
    delete convert2[model].labels;
    Object.defineProperty(convert2[model], "channels", { value: channels });
    Object.defineProperty(convert2[model], "labels", { value: labels });
  }
  convert2.rgb.hsl = function(rgb) {
    const r2 = rgb[0] / 255;
    const g2 = rgb[1] / 255;
    const b2 = rgb[2] / 255;
    const min2 = Math.min(r2, g2, b2);
    const max2 = Math.max(r2, g2, b2);
    const delta = max2 - min2;
    let h3;
    let s2;
    if (max2 === min2) {
      h3 = 0;
    } else if (r2 === max2) {
      h3 = (g2 - b2) / delta;
    } else if (g2 === max2) {
      h3 = 2 + (b2 - r2) / delta;
    } else if (b2 === max2) {
      h3 = 4 + (r2 - g2) / delta;
    }
    h3 = Math.min(h3 * 60, 360);
    if (h3 < 0) {
      h3 += 360;
    }
    const l2 = (min2 + max2) / 2;
    if (max2 === min2) {
      s2 = 0;
    } else if (l2 <= 0.5) {
      s2 = delta / (max2 + min2);
    } else {
      s2 = delta / (2 - max2 - min2);
    }
    return [h3, s2 * 100, l2 * 100];
  };
  convert2.rgb.hsv = function(rgb) {
    let rdif;
    let gdif;
    let bdif;
    let h3;
    let s2;
    const r2 = rgb[0] / 255;
    const g2 = rgb[1] / 255;
    const b2 = rgb[2] / 255;
    const v2 = Math.max(r2, g2, b2);
    const diff2 = v2 - Math.min(r2, g2, b2);
    const diffc = function(c2) {
      return (v2 - c2) / 6 / diff2 + 1 / 2;
    };
    if (diff2 === 0) {
      h3 = 0;
      s2 = 0;
    } else {
      s2 = diff2 / v2;
      rdif = diffc(r2);
      gdif = diffc(g2);
      bdif = diffc(b2);
      if (r2 === v2) {
        h3 = bdif - gdif;
      } else if (g2 === v2) {
        h3 = 1 / 3 + rdif - bdif;
      } else if (b2 === v2) {
        h3 = 2 / 3 + gdif - rdif;
      }
      if (h3 < 0) {
        h3 += 1;
      } else if (h3 > 1) {
        h3 -= 1;
      }
    }
    return [
      h3 * 360,
      s2 * 100,
      v2 * 100
    ];
  };
  convert2.rgb.hwb = function(rgb) {
    const r2 = rgb[0];
    const g2 = rgb[1];
    let b2 = rgb[2];
    const h3 = convert2.rgb.hsl(rgb)[0];
    const w2 = 1 / 255 * Math.min(r2, Math.min(g2, b2));
    b2 = 1 - 1 / 255 * Math.max(r2, Math.max(g2, b2));
    return [h3, w2 * 100, b2 * 100];
  };
  convert2.rgb.cmyk = function(rgb) {
    const r2 = rgb[0] / 255;
    const g2 = rgb[1] / 255;
    const b2 = rgb[2] / 255;
    const k2 = Math.min(1 - r2, 1 - g2, 1 - b2);
    const c2 = (1 - r2 - k2) / (1 - k2) || 0;
    const m2 = (1 - g2 - k2) / (1 - k2) || 0;
    const y2 = (1 - b2 - k2) / (1 - k2) || 0;
    return [c2 * 100, m2 * 100, y2 * 100, k2 * 100];
  };
  function comparativeDistance(x2, y2) {
    return (x2[0] - y2[0]) ** 2 + (x2[1] - y2[1]) ** 2 + (x2[2] - y2[2]) ** 2;
  }
  convert2.rgb.keyword = function(rgb) {
    const reversed = reverseKeywords[rgb];
    if (reversed) {
      return reversed;
    }
    let currentClosestDistance = Infinity;
    let currentClosestKeyword;
    for (const keyword of Object.keys(cssKeywords)) {
      const value2 = cssKeywords[keyword];
      const distance2 = comparativeDistance(rgb, value2);
      if (distance2 < currentClosestDistance) {
        currentClosestDistance = distance2;
        currentClosestKeyword = keyword;
      }
    }
    return currentClosestKeyword;
  };
  convert2.keyword.rgb = function(keyword) {
    return cssKeywords[keyword];
  };
  convert2.rgb.xyz = function(rgb) {
    let r2 = rgb[0] / 255;
    let g2 = rgb[1] / 255;
    let b2 = rgb[2] / 255;
    r2 = r2 > 0.04045 ? ((r2 + 0.055) / 1.055) ** 2.4 : r2 / 12.92;
    g2 = g2 > 0.04045 ? ((g2 + 0.055) / 1.055) ** 2.4 : g2 / 12.92;
    b2 = b2 > 0.04045 ? ((b2 + 0.055) / 1.055) ** 2.4 : b2 / 12.92;
    const x2 = r2 * 0.4124 + g2 * 0.3576 + b2 * 0.1805;
    const y2 = r2 * 0.2126 + g2 * 0.7152 + b2 * 0.0722;
    const z2 = r2 * 0.0193 + g2 * 0.1192 + b2 * 0.9505;
    return [x2 * 100, y2 * 100, z2 * 100];
  };
  convert2.rgb.lab = function(rgb) {
    const xyz = convert2.rgb.xyz(rgb);
    let x2 = xyz[0];
    let y2 = xyz[1];
    let z2 = xyz[2];
    x2 /= 95.047;
    y2 /= 100;
    z2 /= 108.883;
    x2 = x2 > 8856e-6 ? x2 ** (1 / 3) : 7.787 * x2 + 16 / 116;
    y2 = y2 > 8856e-6 ? y2 ** (1 / 3) : 7.787 * y2 + 16 / 116;
    z2 = z2 > 8856e-6 ? z2 ** (1 / 3) : 7.787 * z2 + 16 / 116;
    const l2 = 116 * y2 - 16;
    const a2 = 500 * (x2 - y2);
    const b2 = 200 * (y2 - z2);
    return [l2, a2, b2];
  };
  convert2.hsl.rgb = function(hsl) {
    const h3 = hsl[0] / 360;
    const s2 = hsl[1] / 100;
    const l2 = hsl[2] / 100;
    let t2;
    let t3;
    let val;
    if (s2 === 0) {
      val = l2 * 255;
      return [val, val, val];
    }
    if (l2 < 0.5) {
      t2 = l2 * (1 + s2);
    } else {
      t2 = l2 + s2 - l2 * s2;
    }
    const t1 = 2 * l2 - t2;
    const rgb = [0, 0, 0];
    for (let i2 = 0; i2 < 3; i2++) {
      t3 = h3 + 1 / 3 * -(i2 - 1);
      if (t3 < 0) {
        t3++;
      }
      if (t3 > 1) {
        t3--;
      }
      if (6 * t3 < 1) {
        val = t1 + (t2 - t1) * 6 * t3;
      } else if (2 * t3 < 1) {
        val = t2;
      } else if (3 * t3 < 2) {
        val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
      } else {
        val = t1;
      }
      rgb[i2] = val * 255;
    }
    return rgb;
  };
  convert2.hsl.hsv = function(hsl) {
    const h3 = hsl[0];
    let s2 = hsl[1] / 100;
    let l2 = hsl[2] / 100;
    let smin = s2;
    const lmin = Math.max(l2, 0.01);
    l2 *= 2;
    s2 *= l2 <= 1 ? l2 : 2 - l2;
    smin *= lmin <= 1 ? lmin : 2 - lmin;
    const v2 = (l2 + s2) / 2;
    const sv = l2 === 0 ? 2 * smin / (lmin + smin) : 2 * s2 / (l2 + s2);
    return [h3, sv * 100, v2 * 100];
  };
  convert2.hsv.rgb = function(hsv) {
    const h3 = hsv[0] / 60;
    const s2 = hsv[1] / 100;
    let v2 = hsv[2] / 100;
    const hi2 = Math.floor(h3) % 6;
    const f2 = h3 - Math.floor(h3);
    const p2 = 255 * v2 * (1 - s2);
    const q2 = 255 * v2 * (1 - s2 * f2);
    const t2 = 255 * v2 * (1 - s2 * (1 - f2));
    v2 *= 255;
    switch (hi2) {
      case 0:
        return [v2, t2, p2];
      case 1:
        return [q2, v2, p2];
      case 2:
        return [p2, v2, t2];
      case 3:
        return [p2, q2, v2];
      case 4:
        return [t2, p2, v2];
      case 5:
        return [v2, p2, q2];
    }
  };
  convert2.hsv.hsl = function(hsv) {
    const h3 = hsv[0];
    const s2 = hsv[1] / 100;
    const v2 = hsv[2] / 100;
    const vmin = Math.max(v2, 0.01);
    let sl2;
    let l2;
    l2 = (2 - s2) * v2;
    const lmin = (2 - s2) * vmin;
    sl2 = s2 * vmin;
    sl2 /= lmin <= 1 ? lmin : 2 - lmin;
    sl2 = sl2 || 0;
    l2 /= 2;
    return [h3, sl2 * 100, l2 * 100];
  };
  convert2.hwb.rgb = function(hwb) {
    const h3 = hwb[0] / 360;
    let wh2 = hwb[1] / 100;
    let bl2 = hwb[2] / 100;
    const ratio = wh2 + bl2;
    let f2;
    if (ratio > 1) {
      wh2 /= ratio;
      bl2 /= ratio;
    }
    const i2 = Math.floor(6 * h3);
    const v2 = 1 - bl2;
    f2 = 6 * h3 - i2;
    if ((i2 & 1) !== 0) {
      f2 = 1 - f2;
    }
    const n2 = wh2 + f2 * (v2 - wh2);
    let r2;
    let g2;
    let b2;
    switch (i2) {
      default:
      case 6:
      case 0:
        r2 = v2;
        g2 = n2;
        b2 = wh2;
        break;
      case 1:
        r2 = n2;
        g2 = v2;
        b2 = wh2;
        break;
      case 2:
        r2 = wh2;
        g2 = v2;
        b2 = n2;
        break;
      case 3:
        r2 = wh2;
        g2 = n2;
        b2 = v2;
        break;
      case 4:
        r2 = n2;
        g2 = wh2;
        b2 = v2;
        break;
      case 5:
        r2 = v2;
        g2 = wh2;
        b2 = n2;
        break;
    }
    return [r2 * 255, g2 * 255, b2 * 255];
  };
  convert2.cmyk.rgb = function(cmyk) {
    const c2 = cmyk[0] / 100;
    const m2 = cmyk[1] / 100;
    const y2 = cmyk[2] / 100;
    const k2 = cmyk[3] / 100;
    const r2 = 1 - Math.min(1, c2 * (1 - k2) + k2);
    const g2 = 1 - Math.min(1, m2 * (1 - k2) + k2);
    const b2 = 1 - Math.min(1, y2 * (1 - k2) + k2);
    return [r2 * 255, g2 * 255, b2 * 255];
  };
  convert2.xyz.rgb = function(xyz) {
    const x2 = xyz[0] / 100;
    const y2 = xyz[1] / 100;
    const z2 = xyz[2] / 100;
    let r2;
    let g2;
    let b2;
    r2 = x2 * 3.2406 + y2 * -1.5372 + z2 * -0.4986;
    g2 = x2 * -0.9689 + y2 * 1.8758 + z2 * 0.0415;
    b2 = x2 * 0.0557 + y2 * -0.204 + z2 * 1.057;
    r2 = r2 > 31308e-7 ? 1.055 * r2 ** (1 / 2.4) - 0.055 : r2 * 12.92;
    g2 = g2 > 31308e-7 ? 1.055 * g2 ** (1 / 2.4) - 0.055 : g2 * 12.92;
    b2 = b2 > 31308e-7 ? 1.055 * b2 ** (1 / 2.4) - 0.055 : b2 * 12.92;
    r2 = Math.min(Math.max(0, r2), 1);
    g2 = Math.min(Math.max(0, g2), 1);
    b2 = Math.min(Math.max(0, b2), 1);
    return [r2 * 255, g2 * 255, b2 * 255];
  };
  convert2.xyz.lab = function(xyz) {
    let x2 = xyz[0];
    let y2 = xyz[1];
    let z2 = xyz[2];
    x2 /= 95.047;
    y2 /= 100;
    z2 /= 108.883;
    x2 = x2 > 8856e-6 ? x2 ** (1 / 3) : 7.787 * x2 + 16 / 116;
    y2 = y2 > 8856e-6 ? y2 ** (1 / 3) : 7.787 * y2 + 16 / 116;
    z2 = z2 > 8856e-6 ? z2 ** (1 / 3) : 7.787 * z2 + 16 / 116;
    const l2 = 116 * y2 - 16;
    const a2 = 500 * (x2 - y2);
    const b2 = 200 * (y2 - z2);
    return [l2, a2, b2];
  };
  convert2.lab.xyz = function(lab) {
    const l2 = lab[0];
    const a2 = lab[1];
    const b2 = lab[2];
    let x2;
    let y2;
    let z2;
    y2 = (l2 + 16) / 116;
    x2 = a2 / 500 + y2;
    z2 = y2 - b2 / 200;
    const y22 = y2 ** 3;
    const x22 = x2 ** 3;
    const z22 = z2 ** 3;
    y2 = y22 > 8856e-6 ? y22 : (y2 - 16 / 116) / 7.787;
    x2 = x22 > 8856e-6 ? x22 : (x2 - 16 / 116) / 7.787;
    z2 = z22 > 8856e-6 ? z22 : (z2 - 16 / 116) / 7.787;
    x2 *= 95.047;
    y2 *= 100;
    z2 *= 108.883;
    return [x2, y2, z2];
  };
  convert2.lab.lch = function(lab) {
    const l2 = lab[0];
    const a2 = lab[1];
    const b2 = lab[2];
    let h3;
    const hr = Math.atan2(b2, a2);
    h3 = hr * 360 / 2 / Math.PI;
    if (h3 < 0) {
      h3 += 360;
    }
    const c2 = Math.sqrt(a2 * a2 + b2 * b2);
    return [l2, c2, h3];
  };
  convert2.lch.lab = function(lch) {
    const l2 = lch[0];
    const c2 = lch[1];
    const h3 = lch[2];
    const hr = h3 / 360 * 2 * Math.PI;
    const a2 = c2 * Math.cos(hr);
    const b2 = c2 * Math.sin(hr);
    return [l2, a2, b2];
  };
  convert2.rgb.ansi16 = function(args, saturation = null) {
    const [r2, g2, b2] = args;
    let value2 = saturation === null ? convert2.rgb.hsv(args)[2] : saturation;
    value2 = Math.round(value2 / 50);
    if (value2 === 0) {
      return 30;
    }
    let ansi = 30 + (Math.round(b2 / 255) << 2 | Math.round(g2 / 255) << 1 | Math.round(r2 / 255));
    if (value2 === 2) {
      ansi += 60;
    }
    return ansi;
  };
  convert2.hsv.ansi16 = function(args) {
    return convert2.rgb.ansi16(convert2.hsv.rgb(args), args[2]);
  };
  convert2.rgb.ansi256 = function(args) {
    const r2 = args[0];
    const g2 = args[1];
    const b2 = args[2];
    if (r2 === g2 && g2 === b2) {
      if (r2 < 8) {
        return 16;
      }
      if (r2 > 248) {
        return 231;
      }
      return Math.round((r2 - 8) / 247 * 24) + 232;
    }
    const ansi = 16 + 36 * Math.round(r2 / 255 * 5) + 6 * Math.round(g2 / 255 * 5) + Math.round(b2 / 255 * 5);
    return ansi;
  };
  convert2.ansi16.rgb = function(args) {
    let color2 = args % 10;
    if (color2 === 0 || color2 === 7) {
      if (args > 50) {
        color2 += 3.5;
      }
      color2 = color2 / 10.5 * 255;
      return [color2, color2, color2];
    }
    const mult = (~~(args > 50) + 1) * 0.5;
    const r2 = (color2 & 1) * mult * 255;
    const g2 = (color2 >> 1 & 1) * mult * 255;
    const b2 = (color2 >> 2 & 1) * mult * 255;
    return [r2, g2, b2];
  };
  convert2.ansi256.rgb = function(args) {
    if (args >= 232) {
      const c2 = (args - 232) * 10 + 8;
      return [c2, c2, c2];
    }
    args -= 16;
    let rem;
    const r2 = Math.floor(args / 36) / 5 * 255;
    const g2 = Math.floor((rem = args % 36) / 6) / 5 * 255;
    const b2 = rem % 6 / 5 * 255;
    return [r2, g2, b2];
  };
  convert2.rgb.hex = function(args) {
    const integer4 = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
    const string3 = integer4.toString(16).toUpperCase();
    return "000000".substring(string3.length) + string3;
  };
  convert2.hex.rgb = function(args) {
    const match5 = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
    if (!match5) {
      return [0, 0, 0];
    }
    let colorString = match5[0];
    if (match5[0].length === 3) {
      colorString = colorString.split("").map((char2) => {
        return char2 + char2;
      }).join("");
    }
    const integer4 = parseInt(colorString, 16);
    const r2 = integer4 >> 16 & 255;
    const g2 = integer4 >> 8 & 255;
    const b2 = integer4 & 255;
    return [r2, g2, b2];
  };
  convert2.rgb.hcg = function(rgb) {
    const r2 = rgb[0] / 255;
    const g2 = rgb[1] / 255;
    const b2 = rgb[2] / 255;
    const max2 = Math.max(Math.max(r2, g2), b2);
    const min2 = Math.min(Math.min(r2, g2), b2);
    const chroma = max2 - min2;
    let grayscale;
    let hue2;
    if (chroma < 1) {
      grayscale = min2 / (1 - chroma);
    } else {
      grayscale = 0;
    }
    if (chroma <= 0) {
      hue2 = 0;
    } else if (max2 === r2) {
      hue2 = (g2 - b2) / chroma % 6;
    } else if (max2 === g2) {
      hue2 = 2 + (b2 - r2) / chroma;
    } else {
      hue2 = 4 + (r2 - g2) / chroma;
    }
    hue2 /= 6;
    hue2 %= 1;
    return [hue2 * 360, chroma * 100, grayscale * 100];
  };
  convert2.hsl.hcg = function(hsl) {
    const s2 = hsl[1] / 100;
    const l2 = hsl[2] / 100;
    const c2 = l2 < 0.5 ? 2 * s2 * l2 : 2 * s2 * (1 - l2);
    let f2 = 0;
    if (c2 < 1) {
      f2 = (l2 - 0.5 * c2) / (1 - c2);
    }
    return [hsl[0], c2 * 100, f2 * 100];
  };
  convert2.hsv.hcg = function(hsv) {
    const s2 = hsv[1] / 100;
    const v2 = hsv[2] / 100;
    const c2 = s2 * v2;
    let f2 = 0;
    if (c2 < 1) {
      f2 = (v2 - c2) / (1 - c2);
    }
    return [hsv[0], c2 * 100, f2 * 100];
  };
  convert2.hcg.rgb = function(hcg) {
    const h3 = hcg[0] / 360;
    const c2 = hcg[1] / 100;
    const g2 = hcg[2] / 100;
    if (c2 === 0) {
      return [g2 * 255, g2 * 255, g2 * 255];
    }
    const pure = [0, 0, 0];
    const hi2 = h3 % 1 * 6;
    const v2 = hi2 % 1;
    const w2 = 1 - v2;
    let mg2 = 0;
    switch (Math.floor(hi2)) {
      case 0:
        pure[0] = 1;
        pure[1] = v2;
        pure[2] = 0;
        break;
      case 1:
        pure[0] = w2;
        pure[1] = 1;
        pure[2] = 0;
        break;
      case 2:
        pure[0] = 0;
        pure[1] = 1;
        pure[2] = v2;
        break;
      case 3:
        pure[0] = 0;
        pure[1] = w2;
        pure[2] = 1;
        break;
      case 4:
        pure[0] = v2;
        pure[1] = 0;
        pure[2] = 1;
        break;
      default:
        pure[0] = 1;
        pure[1] = 0;
        pure[2] = w2;
    }
    mg2 = (1 - c2) * g2;
    return [
      (c2 * pure[0] + mg2) * 255,
      (c2 * pure[1] + mg2) * 255,
      (c2 * pure[2] + mg2) * 255
    ];
  };
  convert2.hcg.hsv = function(hcg) {
    const c2 = hcg[1] / 100;
    const g2 = hcg[2] / 100;
    const v2 = c2 + g2 * (1 - c2);
    let f2 = 0;
    if (v2 > 0) {
      f2 = c2 / v2;
    }
    return [hcg[0], f2 * 100, v2 * 100];
  };
  convert2.hcg.hsl = function(hcg) {
    const c2 = hcg[1] / 100;
    const g2 = hcg[2] / 100;
    const l2 = g2 * (1 - c2) + 0.5 * c2;
    let s2 = 0;
    if (l2 > 0 && l2 < 0.5) {
      s2 = c2 / (2 * l2);
    } else if (l2 >= 0.5 && l2 < 1) {
      s2 = c2 / (2 * (1 - l2));
    }
    return [hcg[0], s2 * 100, l2 * 100];
  };
  convert2.hcg.hwb = function(hcg) {
    const c2 = hcg[1] / 100;
    const g2 = hcg[2] / 100;
    const v2 = c2 + g2 * (1 - c2);
    return [hcg[0], (v2 - c2) * 100, (1 - v2) * 100];
  };
  convert2.hwb.hcg = function(hwb) {
    const w2 = hwb[1] / 100;
    const b2 = hwb[2] / 100;
    const v2 = 1 - b2;
    const c2 = v2 - w2;
    let g2 = 0;
    if (c2 < 1) {
      g2 = (v2 - c2) / (1 - c2);
    }
    return [hwb[0], c2 * 100, g2 * 100];
  };
  convert2.apple.rgb = function(apple) {
    return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
  };
  convert2.rgb.apple = function(rgb) {
    return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
  };
  convert2.gray.rgb = function(args) {
    return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
  };
  convert2.gray.hsl = function(args) {
    return [0, 0, args[0]];
  };
  convert2.gray.hsv = convert2.gray.hsl;
  convert2.gray.hwb = function(gray) {
    return [0, 100, gray[0]];
  };
  convert2.gray.cmyk = function(gray) {
    return [0, 0, 0, gray[0]];
  };
  convert2.gray.lab = function(gray) {
    return [gray[0], 0, 0];
  };
  convert2.gray.hex = function(gray) {
    const val = Math.round(gray[0] / 100 * 255) & 255;
    const integer4 = (val << 16) + (val << 8) + val;
    const string3 = integer4.toString(16).toUpperCase();
    return "000000".substring(string3.length) + string3;
  };
  convert2.rgb.gray = function(rgb) {
    const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
    return [val / 255 * 100];
  };
  return conversions;
}
var route;
var hasRequiredRoute;
function requireRoute() {
  if (hasRequiredRoute)
    return route;
  hasRequiredRoute = 1;
  const conversions2 = requireConversions();
  function buildGraph() {
    const graph = {};
    const models = Object.keys(conversions2);
    for (let len = models.length, i2 = 0; i2 < len; i2++) {
      graph[models[i2]] = {
        // http://jsperf.com/1-vs-infinity
        // micro-opt, but this is simple.
        distance: -1,
        parent: null
      };
    }
    return graph;
  }
  function deriveBFS(fromModel) {
    const graph = buildGraph();
    const queue = [fromModel];
    graph[fromModel].distance = 0;
    while (queue.length) {
      const current = queue.pop();
      const adjacents = Object.keys(conversions2[current]);
      for (let len = adjacents.length, i2 = 0; i2 < len; i2++) {
        const adjacent = adjacents[i2];
        const node2 = graph[adjacent];
        if (node2.distance === -1) {
          node2.distance = graph[current].distance + 1;
          node2.parent = current;
          queue.unshift(adjacent);
        }
      }
    }
    return graph;
  }
  function link2(from2, to2) {
    return function(args) {
      return to2(from2(args));
    };
  }
  function wrapConversion(toModel, graph) {
    const path = [graph[toModel].parent, toModel];
    let fn = conversions2[graph[toModel].parent][toModel];
    let cur = graph[toModel].parent;
    while (graph[cur].parent) {
      path.unshift(graph[cur].parent);
      fn = link2(conversions2[graph[cur].parent][cur], fn);
      cur = graph[cur].parent;
    }
    fn.conversion = path;
    return fn;
  }
  route = function(fromModel) {
    const graph = deriveBFS(fromModel);
    const conversion = {};
    const models = Object.keys(graph);
    for (let len = models.length, i2 = 0; i2 < len; i2++) {
      const toModel = models[i2];
      const node2 = graph[toModel];
      if (node2.parent === null) {
        continue;
      }
      conversion[toModel] = wrapConversion(toModel, graph);
    }
    return conversion;
  };
  return route;
}
var colorConvert;
var hasRequiredColorConvert;
function requireColorConvert() {
  if (hasRequiredColorConvert)
    return colorConvert;
  hasRequiredColorConvert = 1;
  const conversions2 = requireConversions();
  const route2 = requireRoute();
  const convert2 = {};
  const models = Object.keys(conversions2);
  function wrapRaw(fn) {
    const wrappedFn = function(...args) {
      const arg0 = args[0];
      if (arg0 === void 0 || arg0 === null) {
        return arg0;
      }
      if (arg0.length > 1) {
        args = arg0;
      }
      return fn(args);
    };
    if ("conversion" in fn) {
      wrappedFn.conversion = fn.conversion;
    }
    return wrappedFn;
  }
  function wrapRounded(fn) {
    const wrappedFn = function(...args) {
      const arg0 = args[0];
      if (arg0 === void 0 || arg0 === null) {
        return arg0;
      }
      if (arg0.length > 1) {
        args = arg0;
      }
      const result = fn(args);
      if (typeof result === "object") {
        for (let len = result.length, i2 = 0; i2 < len; i2++) {
          result[i2] = Math.round(result[i2]);
        }
      }
      return result;
    };
    if ("conversion" in fn) {
      wrappedFn.conversion = fn.conversion;
    }
    return wrappedFn;
  }
  models.forEach((fromModel) => {
    convert2[fromModel] = {};
    Object.defineProperty(convert2[fromModel], "channels", { value: conversions2[fromModel].channels });
    Object.defineProperty(convert2[fromModel], "labels", { value: conversions2[fromModel].labels });
    const routes = route2(fromModel);
    const routeModels = Object.keys(routes);
    routeModels.forEach((toModel) => {
      const fn = routes[toModel];
      convert2[fromModel][toModel] = wrapRounded(fn);
      convert2[fromModel][toModel].raw = wrapRaw(fn);
    });
  });
  colorConvert = convert2;
  return colorConvert;
}
const scriptRel = "modulepreload";
const assetsURL = function(dep) {
  return "/" + dep;
};
const seen = {};
const __vitePreload = function preload(baseModule, deps, importerUrl) {
  let promise = Promise.resolve();
  if (deps && deps.length > 0) {
    document.getElementsByTagName("link");
    const cspNonceMeta = document.querySelector("meta[property=csp-nonce]");
    const cspNonce = (cspNonceMeta == null ? void 0 : cspNonceMeta.nonce) || (cspNonceMeta == null ? void 0 : cspNonceMeta.getAttribute("nonce"));
    promise = Promise.all(deps.map((dep) => {
      dep = assetsURL(dep);
      if (dep in seen)
        return;
      seen[dep] = true;
      const isCss = dep.endsWith(".css");
      const cssSelector = isCss ? '[rel="stylesheet"]' : "";
      if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) {
        return;
      }
      const link2 = document.createElement("link");
      link2.rel = isCss ? "stylesheet" : scriptRel;
      if (!isCss) {
        link2.as = "script";
        link2.crossOrigin = "";
      }
      link2.href = dep;
      if (cspNonce) {
        link2.setAttribute("nonce", cspNonce);
      }
      document.head.appendChild(link2);
      if (isCss) {
        return new Promise((res, rej) => {
          link2.addEventListener("load", res);
          link2.addEventListener("error", () => rej(new Error(`Unable to preload CSS for ${dep}`)));
        });
      }
    }));
  }
  return promise.then(() => baseModule()).catch((err) => {
    const e2 = new Event("vite:preloadError", { cancelable: true });
    e2.payload = err;
    window.dispatchEvent(e2);
    if (!e2.defaultPrevented) {
      throw err;
    }
  });
};
function $645f2e67b85a24c9$var$isStyleVisible(element2) {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  if (!(element2 instanceof windowObject.HTMLElement) && !(element2 instanceof windowObject.SVGElement))
    return false;
  let { display, visibility } = element2.style;
  let isVisible2 = display !== "none" && visibility !== "hidden" && visibility !== "collapse";
  if (isVisible2) {
    const { getComputedStyle: getComputedStyle2 } = element2.ownerDocument.defaultView;
    let { display: computedDisplay, visibility: computedVisibility } = getComputedStyle2(element2);
    isVisible2 = computedDisplay !== "none" && computedVisibility !== "hidden" && computedVisibility !== "collapse";
  }
  return isVisible2;
}
function $645f2e67b85a24c9$var$isAttributeVisible(element2, childElement) {
  return !element2.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking.
  !element2.hasAttribute("data-react-aria-prevent-focus") && (element2.nodeName === "DETAILS" && childElement && childElement.nodeName !== "SUMMARY" ? element2.hasAttribute("open") : true);
}
function $645f2e67b85a24c9$export$e989c0fffaa6b27a(element2, childElement) {
  return element2.nodeName !== "#comment" && $645f2e67b85a24c9$var$isStyleVisible(element2) && $645f2e67b85a24c9$var$isAttributeVisible(element2, childElement) && (!element2.parentElement || $645f2e67b85a24c9$export$e989c0fffaa6b27a(element2.parentElement, element2));
}
const $9bf71ea28793e738$var$FocusContext = /* @__PURE__ */ React$5.createContext(null);
const $9bf71ea28793e738$var$RESTORE_FOCUS_EVENT = "react-aria-focus-scope-restore";
let $9bf71ea28793e738$var$activeScope = null;
function $9bf71ea28793e738$export$20e40289641fbbb6(props) {
  let { children, contain, restoreFocus, autoFocus } = props;
  let startRef = reactExports.useRef(null);
  let endRef = reactExports.useRef(null);
  let scopeRef = reactExports.useRef([]);
  let { parentNode } = reactExports.useContext($9bf71ea28793e738$var$FocusContext) || {};
  let node2 = reactExports.useMemo(() => new $9bf71ea28793e738$var$TreeNode$6({
    scopeRef
  }), [
    scopeRef
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let parent = parentNode || $9bf71ea28793e738$export$d06fae2ee68b101e.root;
    if ($9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(parent.scopeRef) && $9bf71ea28793e738$var$activeScope && !$9bf71ea28793e738$var$isAncestorScope($9bf71ea28793e738$var$activeScope, parent.scopeRef)) {
      let activeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode($9bf71ea28793e738$var$activeScope);
      if (activeNode)
        parent = activeNode;
    }
    parent.addChild(node2);
    $9bf71ea28793e738$export$d06fae2ee68b101e.addNode(node2);
  }, [
    node2,
    parentNode
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let node3 = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
    if (node3)
      node3.contain = !!contain;
  }, [
    contain
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    var _startRef_current;
    let node3 = (_startRef_current = startRef.current) === null || _startRef_current === void 0 ? void 0 : _startRef_current.nextSibling;
    let nodes = [];
    let stopPropagation2 = (e2) => e2.stopPropagation();
    while (node3 && node3 !== endRef.current) {
      nodes.push(node3);
      node3.addEventListener($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT, stopPropagation2);
      node3 = node3.nextSibling;
    }
    scopeRef.current = nodes;
    return () => {
      for (let node4 of nodes)
        node4.removeEventListener($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT, stopPropagation2);
    };
  }, [
    children
  ]);
  $9bf71ea28793e738$var$useActiveScopeTracker(scopeRef, restoreFocus, contain);
  $9bf71ea28793e738$var$useFocusContainment(scopeRef, contain);
  $9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain);
  $9bf71ea28793e738$var$useAutoFocus(scopeRef, autoFocus);
  reactExports.useEffect(() => {
    const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4(scopeRef.current ? scopeRef.current[0] : void 0));
    let scope = null;
    if ($9bf71ea28793e738$var$isElementInScope$6(activeElement, scopeRef.current)) {
      for (let node3 of $9bf71ea28793e738$export$d06fae2ee68b101e.traverse())
        if (node3.scopeRef && $9bf71ea28793e738$var$isElementInScope$6(activeElement, node3.scopeRef.current))
          scope = node3;
      if (scope === $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef))
        $9bf71ea28793e738$var$activeScope = scope.scopeRef;
    }
  }, [
    scopeRef
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    return () => {
      var _focusScopeTree_getTreeNode_parent, _focusScopeTree_getTreeNode;
      var _focusScopeTree_getTreeNode_parent_scopeRef;
      let parentScope = (_focusScopeTree_getTreeNode_parent_scopeRef = (_focusScopeTree_getTreeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef)) === null || _focusScopeTree_getTreeNode === void 0 ? void 0 : (_focusScopeTree_getTreeNode_parent = _focusScopeTree_getTreeNode.parent) === null || _focusScopeTree_getTreeNode_parent === void 0 ? void 0 : _focusScopeTree_getTreeNode_parent.scopeRef) !== null && _focusScopeTree_getTreeNode_parent_scopeRef !== void 0 ? _focusScopeTree_getTreeNode_parent_scopeRef : null;
      if ((scopeRef === $9bf71ea28793e738$var$activeScope || $9bf71ea28793e738$var$isAncestorScope(scopeRef, $9bf71ea28793e738$var$activeScope)) && (!parentScope || $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(parentScope)))
        $9bf71ea28793e738$var$activeScope = parentScope;
      $9bf71ea28793e738$export$d06fae2ee68b101e.removeTreeNode(scopeRef);
    };
  }, [
    scopeRef
  ]);
  let focusManager = reactExports.useMemo(() => $9bf71ea28793e738$var$createFocusManagerForScope(scopeRef), []);
  let value2 = reactExports.useMemo(() => ({
    focusManager,
    parentNode: node2
  }), [
    node2,
    focusManager
  ]);
  return /* @__PURE__ */ React$5.createElement($9bf71ea28793e738$var$FocusContext.Provider, {
    value: value2
  }, /* @__PURE__ */ React$5.createElement("span", {
    "data-focus-scope-start": true,
    hidden: true,
    ref: startRef
  }), children, /* @__PURE__ */ React$5.createElement("span", {
    "data-focus-scope-end": true,
    hidden: true,
    ref: endRef
  }));
}
function $9bf71ea28793e738$var$createFocusManagerForScope(scopeRef) {
  return {
    focusNext(opts2 = {}) {
      let scope = scopeRef.current;
      let { from: from2, tabbable, wrap: wrap2, accept } = opts2;
      var _scope_;
      let node2 = from2 || $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4((_scope_ = scope[0]) !== null && _scope_ !== void 0 ? _scope_ : void 0));
      let sentinel = scope[0].previousElementSibling;
      let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$6(scopeRoot, {
        tabbable,
        accept
      }, scope);
      walker.currentNode = $9bf71ea28793e738$var$isElementInScope$6(node2, scope) ? node2 : sentinel;
      let nextNode = walker.nextNode();
      if (!nextNode && wrap2) {
        walker.currentNode = sentinel;
        nextNode = walker.nextNode();
      }
      if (nextNode)
        $9bf71ea28793e738$var$focusElement$1(nextNode, true);
      return nextNode;
    },
    focusPrevious(opts2 = {}) {
      let scope = scopeRef.current;
      let { from: from2, tabbable, wrap: wrap2, accept } = opts2;
      var _scope_;
      let node2 = from2 || $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4((_scope_ = scope[0]) !== null && _scope_ !== void 0 ? _scope_ : void 0));
      let sentinel = scope[scope.length - 1].nextElementSibling;
      let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$6(scopeRoot, {
        tabbable,
        accept
      }, scope);
      walker.currentNode = $9bf71ea28793e738$var$isElementInScope$6(node2, scope) ? node2 : sentinel;
      let previousNode = walker.previousNode();
      if (!previousNode && wrap2) {
        walker.currentNode = sentinel;
        previousNode = walker.previousNode();
      }
      if (previousNode)
        $9bf71ea28793e738$var$focusElement$1(previousNode, true);
      return previousNode;
    },
    focusFirst(opts2 = {}) {
      let scope = scopeRef.current;
      let { tabbable, accept } = opts2;
      let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$6(scopeRoot, {
        tabbable,
        accept
      }, scope);
      walker.currentNode = scope[0].previousElementSibling;
      let nextNode = walker.nextNode();
      if (nextNode)
        $9bf71ea28793e738$var$focusElement$1(nextNode, true);
      return nextNode;
    },
    focusLast(opts2 = {}) {
      let scope = scopeRef.current;
      let { tabbable, accept } = opts2;
      let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$6(scopeRoot, {
        tabbable,
        accept
      }, scope);
      walker.currentNode = scope[scope.length - 1].nextElementSibling;
      let previousNode = walker.previousNode();
      if (previousNode)
        $9bf71ea28793e738$var$focusElement$1(previousNode, true);
      return previousNode;
    }
  };
}
function $9bf71ea28793e738$var$getScopeRoot(scope) {
  return scope[0].parentElement;
}
function $9bf71ea28793e738$var$shouldContainFocus(scopeRef) {
  let scope = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode($9bf71ea28793e738$var$activeScope);
  while (scope && scope.scopeRef !== scopeRef) {
    if (scope.contain)
      return false;
    scope = scope.parent;
  }
  return true;
}
function $9bf71ea28793e738$var$useFocusContainment(scopeRef, contain) {
  let focusedNode = reactExports.useRef(void 0);
  let raf3 = reactExports.useRef(void 0);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let scope = scopeRef.current;
    if (!contain) {
      if (raf3.current) {
        cancelAnimationFrame(raf3.current);
        raf3.current = void 0;
      }
      return;
    }
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scope ? scope[0] : void 0);
    let onKeyDown = (e2) => {
      if (e2.key !== "Tab" || e2.altKey || e2.ctrlKey || e2.metaKey || !$9bf71ea28793e738$var$shouldContainFocus(scopeRef) || e2.isComposing)
        return;
      let focusedElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
      let scope2 = scopeRef.current;
      if (!scope2 || !$9bf71ea28793e738$var$isElementInScope$6(focusedElement, scope2))
        return;
      let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope2);
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$6(scopeRoot, {
        tabbable: true
      }, scope2);
      if (!focusedElement)
        return;
      walker.currentNode = focusedElement;
      let nextElement = e2.shiftKey ? walker.previousNode() : walker.nextNode();
      if (!nextElement) {
        walker.currentNode = e2.shiftKey ? scope2[scope2.length - 1].nextElementSibling : scope2[0].previousElementSibling;
        nextElement = e2.shiftKey ? walker.previousNode() : walker.nextNode();
      }
      e2.preventDefault();
      if (nextElement)
        $9bf71ea28793e738$var$focusElement$1(nextElement, true);
    };
    let onFocus = (e2) => {
      if ((!$9bf71ea28793e738$var$activeScope || $9bf71ea28793e738$var$isAncestorScope($9bf71ea28793e738$var$activeScope, scopeRef)) && $9bf71ea28793e738$var$isElementInScope$6($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), scopeRef.current)) {
        $9bf71ea28793e738$var$activeScope = scopeRef;
        focusedNode.current = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
      } else if ($9bf71ea28793e738$var$shouldContainFocus(scopeRef) && !$9bf71ea28793e738$var$isElementInChildScope($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), scopeRef)) {
        if (focusedNode.current)
          focusedNode.current.focus();
        else if ($9bf71ea28793e738$var$activeScope && $9bf71ea28793e738$var$activeScope.current)
          $9bf71ea28793e738$var$focusFirstInScope($9bf71ea28793e738$var$activeScope.current);
      } else if ($9bf71ea28793e738$var$shouldContainFocus(scopeRef))
        focusedNode.current = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
    };
    let onBlur = (e2) => {
      if (raf3.current)
        cancelAnimationFrame(raf3.current);
      raf3.current = requestAnimationFrame(() => {
        let modality = $507fabe10e71c6fb$export$630ff653c5ada6a9$2();
        let shouldSkipFocusRestore = (modality === "virtual" || modality === null) && $c87311424ea30a05$export$a11b0059900ceec8$4() && $c87311424ea30a05$export$6446a186d09e379e$5();
        let activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
        if (!shouldSkipFocusRestore && activeElement && $9bf71ea28793e738$var$shouldContainFocus(scopeRef) && !$9bf71ea28793e738$var$isElementInChildScope(activeElement, scopeRef)) {
          $9bf71ea28793e738$var$activeScope = scopeRef;
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
          if (target && target.isConnected) {
            var _focusedNode_current;
            focusedNode.current = target;
            (_focusedNode_current = focusedNode.current) === null || _focusedNode_current === void 0 ? void 0 : _focusedNode_current.focus();
          } else if ($9bf71ea28793e738$var$activeScope.current)
            $9bf71ea28793e738$var$focusFirstInScope($9bf71ea28793e738$var$activeScope.current);
        }
      });
    };
    ownerDocument.addEventListener("keydown", onKeyDown, false);
    ownerDocument.addEventListener("focusin", onFocus, false);
    scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.addEventListener("focusin", onFocus, false));
    scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.addEventListener("focusout", onBlur, false));
    return () => {
      ownerDocument.removeEventListener("keydown", onKeyDown, false);
      ownerDocument.removeEventListener("focusin", onFocus, false);
      scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.removeEventListener("focusin", onFocus, false));
      scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.removeEventListener("focusout", onBlur, false));
    };
  }, [
    scopeRef,
    contain
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    return () => {
      if (raf3.current)
        cancelAnimationFrame(raf3.current);
    };
  }, [
    raf3
  ]);
}
function $9bf71ea28793e738$var$isElementInAnyScope(element2) {
  return $9bf71ea28793e738$var$isElementInChildScope(element2);
}
function $9bf71ea28793e738$var$isElementInScope$6(element2, scope) {
  if (!element2)
    return false;
  if (!scope)
    return false;
  return scope.some((node2) => node2.contains(element2));
}
function $9bf71ea28793e738$var$isElementInChildScope(element2, scope = null) {
  if (element2 instanceof Element && element2.closest("[data-react-aria-top-layer]"))
    return true;
  for (let { scopeRef: s2 } of $9bf71ea28793e738$export$d06fae2ee68b101e.traverse($9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scope))) {
    if (s2 && $9bf71ea28793e738$var$isElementInScope$6(element2, s2.current))
      return true;
  }
  return false;
}
function $9bf71ea28793e738$export$1258395f99bf9cbf(element2) {
  return $9bf71ea28793e738$var$isElementInChildScope(element2, $9bf71ea28793e738$var$activeScope);
}
function $9bf71ea28793e738$var$isAncestorScope(ancestor, scope) {
  var _focusScopeTree_getTreeNode;
  let parent = (_focusScopeTree_getTreeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scope)) === null || _focusScopeTree_getTreeNode === void 0 ? void 0 : _focusScopeTree_getTreeNode.parent;
  while (parent) {
    if (parent.scopeRef === ancestor)
      return true;
    parent = parent.parent;
  }
  return false;
}
function $9bf71ea28793e738$var$focusElement$1(element2, scroll = false) {
  if (element2 != null && !scroll)
    try {
      (0, $3ad3f6e1647bc98d$export$80f3e147d781571c$2)(element2);
    } catch {
    }
  else if (element2 != null)
    try {
      element2.focus();
    } catch {
    }
}
function $9bf71ea28793e738$var$getFirstInScope(scope, tabbable = true) {
  let sentinel = scope[0].previousElementSibling;
  let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
  let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$6(scopeRoot, {
    tabbable
  }, scope);
  walker.currentNode = sentinel;
  let nextNode = walker.nextNode();
  if (tabbable && !nextNode) {
    scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
    walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$6(scopeRoot, {
      tabbable: false
    }, scope);
    walker.currentNode = sentinel;
    nextNode = walker.nextNode();
  }
  return nextNode;
}
function $9bf71ea28793e738$var$focusFirstInScope(scope, tabbable = true) {
  $9bf71ea28793e738$var$focusElement$1($9bf71ea28793e738$var$getFirstInScope(scope, tabbable));
}
function $9bf71ea28793e738$var$useAutoFocus(scopeRef, autoFocus) {
  const autoFocusRef = React$5.useRef(autoFocus);
  reactExports.useEffect(() => {
    if (autoFocusRef.current) {
      $9bf71ea28793e738$var$activeScope = scopeRef;
      const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scopeRef.current ? scopeRef.current[0] : void 0);
      if (!$9bf71ea28793e738$var$isElementInScope$6($d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument), $9bf71ea28793e738$var$activeScope.current) && scopeRef.current)
        $9bf71ea28793e738$var$focusFirstInScope(scopeRef.current);
    }
    autoFocusRef.current = false;
  }, [
    scopeRef
  ]);
}
function $9bf71ea28793e738$var$useActiveScopeTracker(scopeRef, restore, contain) {
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (restore || contain)
      return;
    let scope = scopeRef.current;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scope ? scope[0] : void 0);
    let onFocus = (e2) => {
      let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
      if ($9bf71ea28793e738$var$isElementInScope$6(target, scopeRef.current))
        $9bf71ea28793e738$var$activeScope = scopeRef;
      else if (!$9bf71ea28793e738$var$isElementInAnyScope(target))
        $9bf71ea28793e738$var$activeScope = null;
    };
    ownerDocument.addEventListener("focusin", onFocus, false);
    scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.addEventListener("focusin", onFocus, false));
    return () => {
      ownerDocument.removeEventListener("focusin", onFocus, false);
      scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.removeEventListener("focusin", onFocus, false));
    };
  }, [
    scopeRef,
    restore,
    contain
  ]);
}
function $9bf71ea28793e738$var$shouldRestoreFocus(scopeRef) {
  let scope = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode($9bf71ea28793e738$var$activeScope);
  while (scope && scope.scopeRef !== scopeRef) {
    if (scope.nodeToRestore)
      return false;
    scope = scope.parent;
  }
  return (scope === null || scope === void 0 ? void 0 : scope.scopeRef) === scopeRef;
}
function $9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain) {
  const nodeToRestoreRef = reactExports.useRef(typeof document !== "undefined" ? $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4(scopeRef.current ? scopeRef.current[0] : void 0)) : null);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let scope = scopeRef.current;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scope ? scope[0] : void 0);
    if (!restoreFocus || contain)
      return;
    let onFocus = () => {
      if ((!$9bf71ea28793e738$var$activeScope || $9bf71ea28793e738$var$isAncestorScope($9bf71ea28793e738$var$activeScope, scopeRef)) && $9bf71ea28793e738$var$isElementInScope$6($d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument), scopeRef.current))
        $9bf71ea28793e738$var$activeScope = scopeRef;
    };
    ownerDocument.addEventListener("focusin", onFocus, false);
    scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.addEventListener("focusin", onFocus, false));
    return () => {
      ownerDocument.removeEventListener("focusin", onFocus, false);
      scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.removeEventListener("focusin", onFocus, false));
    };
  }, [
    scopeRef,
    contain
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scopeRef.current ? scopeRef.current[0] : void 0);
    if (!restoreFocus)
      return;
    let onKeyDown = (e2) => {
      if (e2.key !== "Tab" || e2.altKey || e2.ctrlKey || e2.metaKey || !$9bf71ea28793e738$var$shouldContainFocus(scopeRef) || e2.isComposing)
        return;
      let focusedElement = ownerDocument.activeElement;
      if (!$9bf71ea28793e738$var$isElementInChildScope(focusedElement, scopeRef) || !$9bf71ea28793e738$var$shouldRestoreFocus(scopeRef))
        return;
      let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
      if (!treeNode)
        return;
      let nodeToRestore = treeNode.nodeToRestore;
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$6(ownerDocument.body, {
        tabbable: true
      });
      walker.currentNode = focusedElement;
      let nextElement = e2.shiftKey ? walker.previousNode() : walker.nextNode();
      if (!nodeToRestore || !nodeToRestore.isConnected || nodeToRestore === ownerDocument.body) {
        nodeToRestore = void 0;
        treeNode.nodeToRestore = void 0;
      }
      if ((!nextElement || !$9bf71ea28793e738$var$isElementInChildScope(nextElement, scopeRef)) && nodeToRestore) {
        walker.currentNode = nodeToRestore;
        do
          nextElement = e2.shiftKey ? walker.previousNode() : walker.nextNode();
        while ($9bf71ea28793e738$var$isElementInChildScope(nextElement, scopeRef));
        e2.preventDefault();
        e2.stopPropagation();
        if (nextElement)
          $9bf71ea28793e738$var$focusElement$1(nextElement, true);
        else if (!$9bf71ea28793e738$var$isElementInAnyScope(nodeToRestore))
          focusedElement.blur();
        else
          $9bf71ea28793e738$var$focusElement$1(nodeToRestore, true);
      }
    };
    if (!contain)
      ownerDocument.addEventListener("keydown", onKeyDown, true);
    return () => {
      if (!contain)
        ownerDocument.removeEventListener("keydown", onKeyDown, true);
    };
  }, [
    scopeRef,
    restoreFocus,
    contain
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scopeRef.current ? scopeRef.current[0] : void 0);
    if (!restoreFocus)
      return;
    let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
    if (!treeNode)
      return;
    var _nodeToRestoreRef_current;
    treeNode.nodeToRestore = (_nodeToRestoreRef_current = nodeToRestoreRef.current) !== null && _nodeToRestoreRef_current !== void 0 ? _nodeToRestoreRef_current : void 0;
    return () => {
      let treeNode2 = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
      if (!treeNode2)
        return;
      let nodeToRestore = treeNode2.nodeToRestore;
      let activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
      if (restoreFocus && nodeToRestore && (activeElement && $9bf71ea28793e738$var$isElementInChildScope(activeElement, scopeRef) || activeElement === ownerDocument.body && $9bf71ea28793e738$var$shouldRestoreFocus(scopeRef))) {
        let clonedTree = $9bf71ea28793e738$export$d06fae2ee68b101e.clone();
        requestAnimationFrame(() => {
          if (ownerDocument.activeElement === ownerDocument.body) {
            let treeNode3 = clonedTree.getTreeNode(scopeRef);
            while (treeNode3) {
              if (treeNode3.nodeToRestore && treeNode3.nodeToRestore.isConnected) {
                $9bf71ea28793e738$var$restoreFocusToElement(treeNode3.nodeToRestore);
                return;
              }
              treeNode3 = treeNode3.parent;
            }
            treeNode3 = clonedTree.getTreeNode(scopeRef);
            while (treeNode3) {
              if (treeNode3.scopeRef && treeNode3.scopeRef.current && $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(treeNode3.scopeRef)) {
                let node2 = $9bf71ea28793e738$var$getFirstInScope(treeNode3.scopeRef.current, true);
                $9bf71ea28793e738$var$restoreFocusToElement(node2);
                return;
              }
              treeNode3 = treeNode3.parent;
            }
          }
        });
      }
    };
  }, [
    scopeRef,
    restoreFocus
  ]);
}
function $9bf71ea28793e738$var$restoreFocusToElement(node2) {
  if (node2.dispatchEvent(new CustomEvent($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT, {
    bubbles: true,
    cancelable: true
  })))
    $9bf71ea28793e738$var$focusElement$1(node2);
}
function $9bf71ea28793e738$export$2d6ec8fc375ceafa$6(root2, opts2, scope) {
  let filter3 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) ? $b4b717babfbb907b$export$bebd5a1431fec25d : $b4b717babfbb907b$export$4c063cf1350e6fed$3;
  let rootElement = (root2 === null || root2 === void 0 ? void 0 : root2.nodeType) === Node.ELEMENT_NODE ? root2 : null;
  let doc = $431fbd86ca7dc216$export$b204af158042fbac$4(rootElement);
  let walker = $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root2 || doc, NodeFilter.SHOW_ELEMENT, {
    acceptNode(node2) {
      var _opts_from;
      if (opts2 === null || opts2 === void 0 ? void 0 : (_opts_from = opts2.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node2))
        return NodeFilter.FILTER_REJECT;
      if (filter3(node2) && $645f2e67b85a24c9$export$e989c0fffaa6b27a(node2) && (!scope || $9bf71ea28793e738$var$isElementInScope$6(node2, scope)) && (!(opts2 === null || opts2 === void 0 ? void 0 : opts2.accept) || opts2.accept(node2)))
        return NodeFilter.FILTER_ACCEPT;
      return NodeFilter.FILTER_SKIP;
    }
  });
  if (opts2 === null || opts2 === void 0 ? void 0 : opts2.from)
    walker.currentNode = opts2.from;
  return walker;
}
let $9bf71ea28793e738$var$Tree$6 = class $9bf71ea28793e738$var$Tree2 {
  get size() {
    return this.fastMap.size;
  }
  getTreeNode(data) {
    return this.fastMap.get(data);
  }
  addTreeNode(scopeRef, parent, nodeToRestore) {
    let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
    if (!parentNode)
      return;
    let node2 = new $9bf71ea28793e738$var$TreeNode$6({
      scopeRef
    });
    parentNode.addChild(node2);
    node2.parent = parentNode;
    this.fastMap.set(scopeRef, node2);
    if (nodeToRestore)
      node2.nodeToRestore = nodeToRestore;
  }
  addNode(node2) {
    this.fastMap.set(node2.scopeRef, node2);
  }
  removeTreeNode(scopeRef) {
    if (scopeRef === null)
      return;
    let node2 = this.fastMap.get(scopeRef);
    if (!node2)
      return;
    let parentNode = node2.parent;
    for (let current of this.traverse())
      if (current !== node2 && node2.nodeToRestore && current.nodeToRestore && node2.scopeRef && node2.scopeRef.current && $9bf71ea28793e738$var$isElementInScope$6(current.nodeToRestore, node2.scopeRef.current))
        current.nodeToRestore = node2.nodeToRestore;
    let children = node2.children;
    if (parentNode) {
      parentNode.removeChild(node2);
      if (children.size > 0)
        children.forEach((child) => parentNode && parentNode.addChild(child));
    }
    this.fastMap.delete(node2.scopeRef);
  }
  // Pre Order Depth First
  *traverse(node2 = this.root) {
    if (node2.scopeRef != null)
      yield node2;
    if (node2.children.size > 0)
      for (let child of node2.children)
        yield* this.traverse(child);
  }
  clone() {
    var _node_parent;
    let newTree = new $9bf71ea28793e738$var$Tree2();
    var _node_parent_scopeRef;
    for (let node2 of this.traverse())
      newTree.addTreeNode(node2.scopeRef, (_node_parent_scopeRef = (_node_parent = node2.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node2.nodeToRestore);
    return newTree;
  }
  constructor() {
    this.fastMap = /* @__PURE__ */ new Map();
    this.root = new $9bf71ea28793e738$var$TreeNode$6({
      scopeRef: null
    });
    this.fastMap.set(null, this.root);
  }
};
let $9bf71ea28793e738$var$TreeNode$6 = class $9bf71ea28793e738$var$TreeNode2 {
  addChild(node2) {
    this.children.add(node2);
    node2.parent = this;
  }
  removeChild(node2) {
    this.children.delete(node2);
    node2.parent = void 0;
  }
  constructor(props) {
    this.children = /* @__PURE__ */ new Set();
    this.contain = false;
    this.scopeRef = props.scopeRef;
  }
};
let $9bf71ea28793e738$export$d06fae2ee68b101e = new $9bf71ea28793e738$var$Tree$6();
function $f7dceffc5ad7768b$export$4e328f61c538687f$1(props = {}) {
  let { autoFocus = false, isTextInput, within } = props;
  let state = reactExports.useRef({
    isFocused: false,
    isFocusVisible: autoFocus || $507fabe10e71c6fb$export$b9b3dfddab17db27$2()
  });
  let [isFocused, setFocused] = reactExports.useState(false);
  let [isFocusVisibleState, setFocusVisible] = reactExports.useState(() => state.current.isFocused && state.current.isFocusVisible);
  let updateState3 = reactExports.useCallback(() => setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);
  let onFocusChange = reactExports.useCallback((isFocused2) => {
    state.current.isFocused = isFocused2;
    setFocused(isFocused2);
    updateState3();
  }, [
    updateState3
  ]);
  $507fabe10e71c6fb$export$ec71b4b83ac08ec3$1((isFocusVisible) => {
    state.current.isFocusVisible = isFocusVisible;
    updateState3();
  }, [], {
    isTextInput
  });
  let { focusProps } = $a1ea59d68270f0dd$export$f8168d8dd8fd66e6$2({
    isDisabled: within,
    onFocusChange
  });
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$4({
    isDisabled: !within,
    onFocusWithinChange: onFocusChange
  });
  return {
    isFocused,
    isFocusVisible: isFocusVisibleState,
    focusProps: within ? focusWithinProps : focusProps
  };
}
function $701a24aa0da5b062$export$ea18c227d4417cc3(props, ref) {
  let { elementType = "button", isDisabled, onPress, onPressStart, onPressEnd, onPressUp, onPressChange, preventFocusOnPress, allowFocusWhenDisabled, onClick, href, target, rel, type: type4 = "button" } = props;
  let additionalProps;
  if (elementType === "button")
    additionalProps = {
      type: type4,
      disabled: isDisabled
    };
  else
    additionalProps = {
      role: "button",
      href: elementType === "a" && !isDisabled ? href : void 0,
      target: elementType === "a" ? target : void 0,
      type: elementType === "input" ? type4 : void 0,
      disabled: elementType === "input" ? isDisabled : void 0,
      "aria-disabled": !isDisabled || elementType === "input" ? void 0 : isDisabled,
      rel: elementType === "a" ? rel : void 0
    };
  let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    onPressStart,
    onPressEnd,
    onPressChange,
    onPress,
    onPressUp,
    onClick,
    isDisabled,
    preventFocusOnPress,
    ref
  });
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2(props, ref);
  if (allowFocusWhenDisabled)
    focusableProps.tabIndex = isDisabled ? -1 : focusableProps.tabIndex;
  let buttonProps = $3ef42575df84b30b$export$9d1611c77c2fe928$9(focusableProps, pressProps, $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  }));
  return {
    isPressed,
    buttonProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(additionalProps, buttonProps, {
      "aria-haspopup": props["aria-haspopup"],
      "aria-expanded": props["aria-expanded"],
      "aria-controls": props["aria-controls"],
      "aria-pressed": props["aria-pressed"],
      "aria-current": props["aria-current"]
    })
  };
}
function useReactAriaAccordionItem(props, state, ref) {
  let { item, isDisabled: isDisabledProp } = props;
  let key = item.key;
  let manager = state.selectionManager;
  let buttonId = reactExports.useId();
  let regionId = reactExports.useId();
  let isDisabled = state.disabledKeys.has(item.key) || isDisabledProp;
  reactExports.useEffect(() => {
    let isFocused = key === state.focusedKey;
    if (isFocused && document.activeElement !== ref.current) {
      ref.current && $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
    }
  }, [ref, key, state.focusedKey]);
  let onSelect = reactExports.useCallback(
    (e2) => {
      if (!manager.canSelectItem(key)) {
        return;
      }
      manager.select(key, e2);
      state.toggleKey(key);
    },
    [key, manager]
  );
  const extendFocusSelection = reactExports.useCallback(
    (toKey2) => {
      if (manager.selectionBehavior === "replace") {
        manager.extendSelection(toKey2);
      }
      manager.setFocusedKey(toKey2);
    },
    [manager]
  );
  const onKeyDown = reactExports.useCallback(
    (event) => {
      const keyMap = {
        ArrowDown: () => {
          const nextKey = state.collection.getKeyAfter(key);
          if (nextKey && state.disabledKeys.has(nextKey)) {
            const nextEnabledKey = state.collection.getKeyAfter(nextKey);
            nextEnabledKey && extendFocusSelection(nextEnabledKey);
          } else {
            nextKey && extendFocusSelection(nextKey);
          }
        },
        ArrowUp: () => {
          const prevKey = state.collection.getKeyBefore(key);
          if (prevKey && state.disabledKeys.has(prevKey)) {
            const prevEnabledKey = state.collection.getKeyBefore(prevKey);
            prevEnabledKey && extendFocusSelection(prevEnabledKey);
          } else {
            prevKey && extendFocusSelection(prevKey);
          }
        },
        Home: () => {
          const firstKey = state.collection.getFirstKey();
          firstKey && extendFocusSelection(firstKey);
        },
        End: () => {
          const lastKey = state.collection.getLastKey();
          lastKey && extendFocusSelection(lastKey);
        }
      };
      const action = keyMap[event.key];
      if (action) {
        event.preventDefault();
        if (manager.canSelectItem(key)) {
          action(event);
        }
      }
    },
    [key, manager]
  );
  let { buttonProps } = $701a24aa0da5b062$export$ea18c227d4417cc3(
    {
      id: buttonId,
      elementType: "button",
      isDisabled,
      onKeyDown,
      onPress: onSelect
    },
    ref
  );
  let isExpanded = state.selectionManager.isSelected(item.key);
  return {
    buttonProps: {
      ...buttonProps,
      "aria-expanded": isExpanded,
      "aria-controls": isExpanded ? regionId : void 0
    },
    regionProps: {
      id: regionId,
      role: "region",
      "aria-labelledby": buttonId
    }
  };
}
function $feb5ffebff200149$export$d3e3bd3e26688c04$1(e2) {
  return $c87311424ea30a05$export$e1865c3bedcd822b() ? e2.altKey : e2.ctrlKey;
}
function $feb5ffebff200149$export$c3d8340acf92597f$2(collectionRef, key) {
  var _collectionRef_current, _collectionRef_current1;
  let selector = `[data-key="${CSS.escape(String(key))}"]`;
  let collection = (_collectionRef_current = collectionRef.current) === null || _collectionRef_current === void 0 ? void 0 : _collectionRef_current.dataset.collection;
  if (collection)
    selector = `[data-collection="${CSS.escape(collection)}"]${selector}`;
  return (_collectionRef_current1 = collectionRef.current) === null || _collectionRef_current1 === void 0 ? void 0 : _collectionRef_current1.querySelector(selector);
}
const $feb5ffebff200149$var$collectionMap$1 = /* @__PURE__ */ new WeakMap();
function $feb5ffebff200149$export$881eb0d9f3605d9d$1(collection) {
  let id2 = $bdb11010cef70236$export$f680877a34711e37$2();
  $feb5ffebff200149$var$collectionMap$1.set(collection, id2);
  return id2;
}
const $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS$2 = 1e3;
function $fb3050f43d946246$export$e32c88dfddc6e1d8$2(options) {
  let { keyboardDelegate, selectionManager, onTypeSelect } = options;
  let state = reactExports.useRef({
    search: "",
    timeout: void 0
  }).current;
  let onKeyDown = (e2) => {
    let character2 = $fb3050f43d946246$var$getStringForKey$2(e2.key);
    if (!character2 || e2.ctrlKey || e2.metaKey || !e2.currentTarget.contains(e2.target))
      return;
    if (character2 === " " && state.search.trim().length > 0) {
      e2.preventDefault();
      if (!("continuePropagation" in e2))
        e2.stopPropagation();
    }
    state.search += character2;
    if (keyboardDelegate.getKeyForSearch != null) {
      let key = keyboardDelegate.getKeyForSearch(state.search, selectionManager.focusedKey);
      if (key == null)
        key = keyboardDelegate.getKeyForSearch(state.search);
      if (key != null) {
        selectionManager.setFocusedKey(key);
        if (onTypeSelect)
          onTypeSelect(key);
      }
    }
    clearTimeout(state.timeout);
    state.timeout = setTimeout(() => {
      state.search = "";
    }, $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS$2);
  };
  return {
    typeSelectProps: {
      // Using a capturing listener to catch the keydown event before
      // other hooks in order to handle the Spacebar event.
      onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDown : void 0
    }
  };
}
function $fb3050f43d946246$var$getStringForKey$2(key) {
  if (key.length === 1 || !/^[A-Z]/i.test(key))
    return key;
  return "";
}
function $9bf71ea28793e738$var$isTabbableRadio$5(element2) {
  if (element2.checked)
    return true;
  let radios = [];
  if (!element2.form)
    radios = [
      ...$431fbd86ca7dc216$export$b204af158042fbac$4(element2).querySelectorAll(`input[type="radio"][name="${CSS.escape(element2.name)}"]`)
    ].filter((radio2) => !radio2.form);
  else {
    var _element_form_elements, _element_form;
    let radioList = (_element_form = element2.form) === null || _element_form === void 0 ? void 0 : (_element_form_elements = _element_form.elements) === null || _element_form_elements === void 0 ? void 0 : _element_form_elements.namedItem(element2.name);
    radios = [
      ...radioList !== null && radioList !== void 0 ? radioList : []
    ];
  }
  if (!radios)
    return false;
  let anyChecked = radios.some((radio2) => radio2.checked);
  return !anyChecked;
}
function $9bf71ea28793e738$var$isElementInScope$5(element2, scope) {
  if (!element2)
    return false;
  if (!scope)
    return false;
  return scope.some((node2) => node2.contains(element2));
}
function $9bf71ea28793e738$export$2d6ec8fc375ceafa$5(root2, opts2, scope) {
  let filter3 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) ? $b4b717babfbb907b$export$bebd5a1431fec25d : $b4b717babfbb907b$export$4c063cf1350e6fed$3;
  let rootElement = (root2 === null || root2 === void 0 ? void 0 : root2.nodeType) === Node.ELEMENT_NODE ? root2 : null;
  let doc = $431fbd86ca7dc216$export$b204af158042fbac$4(rootElement);
  let walker = $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root2 || doc, NodeFilter.SHOW_ELEMENT, {
    acceptNode(node2) {
      var _opts_from;
      if (opts2 === null || opts2 === void 0 ? void 0 : (_opts_from = opts2.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node2))
        return NodeFilter.FILTER_REJECT;
      if ((opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) && node2.tagName === "INPUT" && node2.getAttribute("type") === "radio") {
        if (!$9bf71ea28793e738$var$isTabbableRadio$5(node2))
          return NodeFilter.FILTER_REJECT;
        if (walker.currentNode.tagName === "INPUT" && walker.currentNode.type === "radio" && walker.currentNode.name === node2.name)
          return NodeFilter.FILTER_REJECT;
      }
      if (filter3(node2) && (!scope || $9bf71ea28793e738$var$isElementInScope$5(node2, scope)) && (!(opts2 === null || opts2 === void 0 ? void 0 : opts2.accept) || opts2.accept(node2)))
        return NodeFilter.FILTER_ACCEPT;
      return NodeFilter.FILTER_SKIP;
    }
  });
  if (opts2 === null || opts2 === void 0 ? void 0 : opts2.from)
    walker.currentNode = opts2.from;
  return walker;
}
let $9bf71ea28793e738$var$Tree$5 = class $9bf71ea28793e738$var$Tree3 {
  get size() {
    return this.fastMap.size;
  }
  getTreeNode(data) {
    return this.fastMap.get(data);
  }
  addTreeNode(scopeRef, parent, nodeToRestore) {
    let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
    if (!parentNode)
      return;
    let node2 = new $9bf71ea28793e738$var$TreeNode$5({
      scopeRef
    });
    parentNode.addChild(node2);
    node2.parent = parentNode;
    this.fastMap.set(scopeRef, node2);
    if (nodeToRestore)
      node2.nodeToRestore = nodeToRestore;
  }
  addNode(node2) {
    this.fastMap.set(node2.scopeRef, node2);
  }
  removeTreeNode(scopeRef) {
    if (scopeRef === null)
      return;
    let node2 = this.fastMap.get(scopeRef);
    if (!node2)
      return;
    let parentNode = node2.parent;
    for (let current of this.traverse())
      if (current !== node2 && node2.nodeToRestore && current.nodeToRestore && node2.scopeRef && node2.scopeRef.current && $9bf71ea28793e738$var$isElementInScope$5(current.nodeToRestore, node2.scopeRef.current))
        current.nodeToRestore = node2.nodeToRestore;
    let children = node2.children;
    if (parentNode) {
      parentNode.removeChild(node2);
      if (children.size > 0)
        children.forEach((child) => parentNode && parentNode.addChild(child));
    }
    this.fastMap.delete(node2.scopeRef);
  }
  // Pre Order Depth First
  *traverse(node2 = this.root) {
    if (node2.scopeRef != null)
      yield node2;
    if (node2.children.size > 0)
      for (let child of node2.children)
        yield* this.traverse(child);
  }
  clone() {
    var _node_parent;
    let newTree = new $9bf71ea28793e738$var$Tree3();
    var _node_parent_scopeRef;
    for (let node2 of this.traverse())
      newTree.addTreeNode(node2.scopeRef, (_node_parent_scopeRef = (_node_parent = node2.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node2.nodeToRestore);
    return newTree;
  }
  constructor() {
    this.fastMap = /* @__PURE__ */ new Map();
    this.root = new $9bf71ea28793e738$var$TreeNode$5({
      scopeRef: null
    });
    this.fastMap.set(null, this.root);
  }
};
let $9bf71ea28793e738$var$TreeNode$5 = class $9bf71ea28793e738$var$TreeNode3 {
  addChild(node2) {
    this.children.add(node2);
    node2.parent = this;
  }
  removeChild(node2) {
    this.children.delete(node2);
    node2.parent = void 0;
  }
  constructor(props) {
    this.children = /* @__PURE__ */ new Set();
    this.contain = false;
    this.scopeRef = props.scopeRef;
  }
};
new $9bf71ea28793e738$var$Tree$5();
function $55f9b1ae81f22853$export$76e4e37e5339496d$1(to2) {
  let from2 = $55f9b1ae81f22853$export$759df0d867455a91$1($431fbd86ca7dc216$export$b204af158042fbac$4(to2));
  if (from2 !== to2) {
    if (from2)
      $55f9b1ae81f22853$export$6c5dc7e81d2cc29a$1(from2, to2);
    if (to2)
      $55f9b1ae81f22853$export$2b35b76d2e30e129$2(to2, from2);
  }
}
function $55f9b1ae81f22853$export$6c5dc7e81d2cc29a$1(from2, to2) {
  from2.dispatchEvent(new FocusEvent("blur", {
    relatedTarget: to2
  }));
  from2.dispatchEvent(new FocusEvent("focusout", {
    bubbles: true,
    relatedTarget: to2
  }));
}
function $55f9b1ae81f22853$export$2b35b76d2e30e129$2(to2, from2) {
  to2.dispatchEvent(new FocusEvent("focus", {
    relatedTarget: from2
  }));
  to2.dispatchEvent(new FocusEvent("focusin", {
    bubbles: true,
    relatedTarget: from2
  }));
}
function $55f9b1ae81f22853$export$759df0d867455a91$1(document2) {
  let activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(document2);
  let activeDescendant = activeElement === null || activeElement === void 0 ? void 0 : activeElement.getAttribute("aria-activedescendant");
  if (activeDescendant)
    return document2.getElementById(activeDescendant) || activeElement;
  return activeElement;
}
function $ae20dd8cbca75726$export$d6daf82dcd84e87c$1(options) {
  let { selectionManager: manager, keyboardDelegate: delegate, ref, autoFocus = false, shouldFocusWrap = false, disallowEmptySelection = false, disallowSelectAll = false, escapeKeyBehavior = "clearSelection", selectOnFocus = manager.selectionBehavior === "replace", disallowTypeAhead = false, shouldUseVirtualFocus, allowsTabNavigation = false, isVirtualized, scrollRef = ref, linkBehavior = "action" } = options;
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572$2();
  let onKeyDown = (e2) => {
    var _ref_current;
    if (e2.altKey && e2.key === "Tab")
      e2.preventDefault();
    if (!((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.contains(e2.target)))
      return;
    const navigateToKey = (key, childFocus) => {
      if (key != null) {
        if (manager.isLink(key) && linkBehavior === "selection" && selectOnFocus && !$feb5ffebff200149$export$d3e3bd3e26688c04$1(e2)) {
          reactDomExports.flushSync(() => {
            manager.setFocusedKey(key, childFocus);
          });
          let item = $feb5ffebff200149$export$c3d8340acf92597f$2(ref, key);
          let itemProps = manager.getItemProps(key);
          if (item)
            router.open(item, e2, itemProps.href, itemProps.routerOptions);
          return;
        }
        manager.setFocusedKey(key, childFocus);
        if (manager.isLink(key) && linkBehavior === "override")
          return;
        if (e2.shiftKey && manager.selectionMode === "multiple")
          manager.extendSelection(key);
        else if (selectOnFocus && !$feb5ffebff200149$export$d3e3bd3e26688c04$1(e2))
          manager.replaceSelection(key);
      }
    };
    switch (e2.key) {
      case "ArrowDown":
        if (delegate.getKeyBelow) {
          var _delegate_getKeyBelow, _delegate_getFirstKey, _delegate_getFirstKey1;
          let nextKey = manager.focusedKey != null ? (_delegate_getKeyBelow = delegate.getKeyBelow) === null || _delegate_getKeyBelow === void 0 ? void 0 : _delegate_getKeyBelow.call(delegate, manager.focusedKey) : (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate);
          if (nextKey == null && shouldFocusWrap)
            nextKey = (_delegate_getFirstKey1 = delegate.getFirstKey) === null || _delegate_getFirstKey1 === void 0 ? void 0 : _delegate_getFirstKey1.call(delegate, manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey);
          }
        }
        break;
      case "ArrowUp":
        if (delegate.getKeyAbove) {
          var _delegate_getKeyAbove, _delegate_getLastKey, _delegate_getLastKey1;
          let nextKey = manager.focusedKey != null ? (_delegate_getKeyAbove = delegate.getKeyAbove) === null || _delegate_getKeyAbove === void 0 ? void 0 : _delegate_getKeyAbove.call(delegate, manager.focusedKey) : (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate);
          if (nextKey == null && shouldFocusWrap)
            nextKey = (_delegate_getLastKey1 = delegate.getLastKey) === null || _delegate_getLastKey1 === void 0 ? void 0 : _delegate_getLastKey1.call(delegate, manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey);
          }
        }
        break;
      case "ArrowLeft":
        if (delegate.getKeyLeftOf) {
          var _delegate_getKeyLeftOf, _delegate_getFirstKey2, _delegate_getLastKey2;
          let nextKey = manager.focusedKey != null ? (_delegate_getKeyLeftOf = delegate.getKeyLeftOf) === null || _delegate_getKeyLeftOf === void 0 ? void 0 : _delegate_getKeyLeftOf.call(delegate, manager.focusedKey) : null;
          if (nextKey == null && shouldFocusWrap)
            nextKey = direction === "rtl" ? (_delegate_getFirstKey2 = delegate.getFirstKey) === null || _delegate_getFirstKey2 === void 0 ? void 0 : _delegate_getFirstKey2.call(delegate, manager.focusedKey) : (_delegate_getLastKey2 = delegate.getLastKey) === null || _delegate_getLastKey2 === void 0 ? void 0 : _delegate_getLastKey2.call(delegate, manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey, direction === "rtl" ? "first" : "last");
          }
        }
        break;
      case "ArrowRight":
        if (delegate.getKeyRightOf) {
          var _delegate_getKeyRightOf, _delegate_getLastKey3, _delegate_getFirstKey3;
          let nextKey = manager.focusedKey != null ? (_delegate_getKeyRightOf = delegate.getKeyRightOf) === null || _delegate_getKeyRightOf === void 0 ? void 0 : _delegate_getKeyRightOf.call(delegate, manager.focusedKey) : null;
          if (nextKey == null && shouldFocusWrap)
            nextKey = direction === "rtl" ? (_delegate_getLastKey3 = delegate.getLastKey) === null || _delegate_getLastKey3 === void 0 ? void 0 : _delegate_getLastKey3.call(delegate, manager.focusedKey) : (_delegate_getFirstKey3 = delegate.getFirstKey) === null || _delegate_getFirstKey3 === void 0 ? void 0 : _delegate_getFirstKey3.call(delegate, manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey, direction === "rtl" ? "last" : "first");
          }
        }
        break;
      case "Home":
        if (delegate.getFirstKey) {
          if (manager.focusedKey === null && e2.shiftKey)
            return;
          e2.preventDefault();
          let firstKey = delegate.getFirstKey(manager.focusedKey, $21f1aa98acb08317$export$16792effe837dba3(e2));
          manager.setFocusedKey(firstKey);
          if (firstKey != null) {
            if ($21f1aa98acb08317$export$16792effe837dba3(e2) && e2.shiftKey && manager.selectionMode === "multiple")
              manager.extendSelection(firstKey);
            else if (selectOnFocus)
              manager.replaceSelection(firstKey);
          }
        }
        break;
      case "End":
        if (delegate.getLastKey) {
          if (manager.focusedKey === null && e2.shiftKey)
            return;
          e2.preventDefault();
          let lastKey = delegate.getLastKey(manager.focusedKey, $21f1aa98acb08317$export$16792effe837dba3(e2));
          manager.setFocusedKey(lastKey);
          if (lastKey != null) {
            if ($21f1aa98acb08317$export$16792effe837dba3(e2) && e2.shiftKey && manager.selectionMode === "multiple")
              manager.extendSelection(lastKey);
            else if (selectOnFocus)
              manager.replaceSelection(lastKey);
          }
        }
        break;
      case "PageDown":
        if (delegate.getKeyPageBelow && manager.focusedKey != null) {
          let nextKey = delegate.getKeyPageBelow(manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey);
          }
        }
        break;
      case "PageUp":
        if (delegate.getKeyPageAbove && manager.focusedKey != null) {
          let nextKey = delegate.getKeyPageAbove(manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey);
          }
        }
        break;
      case "a":
        if ($21f1aa98acb08317$export$16792effe837dba3(e2) && manager.selectionMode === "multiple" && disallowSelectAll !== true) {
          e2.preventDefault();
          manager.selectAll();
        }
        break;
      case "Escape":
        if (escapeKeyBehavior === "clearSelection" && !disallowEmptySelection && manager.selectedKeys.size !== 0) {
          e2.stopPropagation();
          e2.preventDefault();
          manager.clearSelection();
        }
        break;
      case "Tab":
        if (!allowsTabNavigation) {
          if (e2.shiftKey)
            ref.current.focus();
          else {
            let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$5(ref.current, {
              tabbable: true
            });
            let next2 = void 0;
            let last;
            do {
              last = walker.lastChild();
              if (last)
                next2 = last;
            } while (last);
            if (next2 && !next2.contains(document.activeElement))
              $7215afc6de606d6b$export$de79e2c695e052f3$5(next2);
          }
          break;
        }
    }
  };
  let scrollPos = reactExports.useRef({
    top: 0,
    left: 0
  });
  $e9faafb641e167db$export$90fc3a17d93f704c(scrollRef, "scroll", isVirtualized ? void 0 : () => {
    var _scrollRef_current, _scrollRef_current1;
    var _scrollRef_current_scrollTop, _scrollRef_current_scrollLeft;
    scrollPos.current = {
      top: (_scrollRef_current_scrollTop = (_scrollRef_current = scrollRef.current) === null || _scrollRef_current === void 0 ? void 0 : _scrollRef_current.scrollTop) !== null && _scrollRef_current_scrollTop !== void 0 ? _scrollRef_current_scrollTop : 0,
      left: (_scrollRef_current_scrollLeft = (_scrollRef_current1 = scrollRef.current) === null || _scrollRef_current1 === void 0 ? void 0 : _scrollRef_current1.scrollLeft) !== null && _scrollRef_current_scrollLeft !== void 0 ? _scrollRef_current_scrollLeft : 0
    };
  });
  let onFocus = (e2) => {
    if (manager.isFocused) {
      if (!e2.currentTarget.contains(e2.target))
        manager.setFocused(false);
      return;
    }
    if (!e2.currentTarget.contains(e2.target))
      return;
    manager.setFocused(true);
    if (manager.focusedKey == null) {
      var _delegate_getLastKey, _delegate_getFirstKey;
      let navigateToKey = (key) => {
        if (key != null) {
          manager.setFocusedKey(key);
          if (selectOnFocus && !manager.isSelected(key))
            manager.replaceSelection(key);
        }
      };
      let relatedTarget = e2.relatedTarget;
      var _manager_lastSelectedKey, _manager_firstSelectedKey;
      if (relatedTarget && e2.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING)
        navigateToKey((_manager_lastSelectedKey = manager.lastSelectedKey) !== null && _manager_lastSelectedKey !== void 0 ? _manager_lastSelectedKey : (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate));
      else
        navigateToKey((_manager_firstSelectedKey = manager.firstSelectedKey) !== null && _manager_firstSelectedKey !== void 0 ? _manager_firstSelectedKey : (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate));
    } else if (!isVirtualized && scrollRef.current) {
      scrollRef.current.scrollTop = scrollPos.current.top;
      scrollRef.current.scrollLeft = scrollPos.current.left;
    }
    if (manager.focusedKey != null && scrollRef.current) {
      let element2 = $feb5ffebff200149$export$c3d8340acf92597f$2(ref, manager.focusedKey);
      if (element2 instanceof HTMLElement) {
        if (!element2.contains(document.activeElement) && !shouldUseVirtualFocus)
          $7215afc6de606d6b$export$de79e2c695e052f3$5(element2);
        let modality = $507fabe10e71c6fb$export$630ff653c5ada6a9$2();
        if (modality === "keyboard")
          $2f04cbc44ee30ce0$export$c826860796309d1b(element2, {
            containingElement: ref.current
          });
      }
    }
  };
  let onBlur = (e2) => {
    if (!e2.currentTarget.contains(e2.relatedTarget))
      manager.setFocused(false);
  };
  let shouldVirtualFocusFirst = reactExports.useRef(false);
  $e9faafb641e167db$export$90fc3a17d93f704c(ref, $5671b20cf9b562b2$export$831c820ad60f9d12, !shouldUseVirtualFocus ? void 0 : (e2) => {
    let { detail } = e2;
    e2.stopPropagation();
    manager.setFocused(true);
    if ((detail === null || detail === void 0 ? void 0 : detail.focusStrategy) === "first")
      shouldVirtualFocusFirst.current = true;
  });
  let updateActiveDescendant = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    var _delegate_getFirstKey;
    var _delegate_getFirstKey1;
    let keyToFocus = (_delegate_getFirstKey1 = (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate)) !== null && _delegate_getFirstKey1 !== void 0 ? _delegate_getFirstKey1 : null;
    if (keyToFocus == null) {
      $55f9b1ae81f22853$export$76e4e37e5339496d$1(ref.current);
      if (manager.collection.size > 0)
        shouldVirtualFocusFirst.current = false;
    } else {
      manager.setFocusedKey(keyToFocus);
      shouldVirtualFocusFirst.current = false;
    }
  });
  $ca9b37712f007381$export$72ef708ab07251f1(() => {
    if (shouldVirtualFocusFirst.current)
      updateActiveDescendant();
  }, [
    manager.collection,
    updateActiveDescendant
  ]);
  let resetFocusFirstFlag = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    if (manager.collection.size > 0)
      shouldVirtualFocusFirst.current = false;
  });
  $ca9b37712f007381$export$72ef708ab07251f1(() => {
    resetFocusFirstFlag();
  }, [
    manager.focusedKey,
    resetFocusFirstFlag
  ]);
  $e9faafb641e167db$export$90fc3a17d93f704c(ref, $5671b20cf9b562b2$export$447a38995de2c711, !shouldUseVirtualFocus ? void 0 : (e2) => {
    var _e_detail;
    e2.stopPropagation();
    manager.setFocused(false);
    if ((_e_detail = e2.detail) === null || _e_detail === void 0 ? void 0 : _e_detail.clearFocusKey)
      manager.setFocusedKey(null);
  });
  const autoFocusRef = reactExports.useRef(autoFocus);
  const didAutoFocusRef = reactExports.useRef(false);
  reactExports.useEffect(() => {
    if (autoFocusRef.current) {
      var _delegate_getFirstKey, _delegate_getLastKey;
      let focusedKey = null;
      var _delegate_getFirstKey1;
      if (autoFocus === "first")
        focusedKey = (_delegate_getFirstKey1 = (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate)) !== null && _delegate_getFirstKey1 !== void 0 ? _delegate_getFirstKey1 : null;
      var _delegate_getLastKey1;
      if (autoFocus === "last")
        focusedKey = (_delegate_getLastKey1 = (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate)) !== null && _delegate_getLastKey1 !== void 0 ? _delegate_getLastKey1 : null;
      let selectedKeys = manager.selectedKeys;
      if (selectedKeys.size) {
        for (let key of selectedKeys)
          if (manager.canSelectItem(key)) {
            focusedKey = key;
            break;
          }
      }
      manager.setFocused(true);
      manager.setFocusedKey(focusedKey);
      if (focusedKey == null && !shouldUseVirtualFocus && ref.current)
        $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
      if (manager.collection.size > 0) {
        autoFocusRef.current = false;
        didAutoFocusRef.current = true;
      }
    }
  });
  let lastFocusedKey = reactExports.useRef(manager.focusedKey);
  let raf3 = reactExports.useRef(null);
  reactExports.useEffect(() => {
    if (manager.isFocused && manager.focusedKey != null && (manager.focusedKey !== lastFocusedKey.current || didAutoFocusRef.current) && scrollRef.current && ref.current) {
      let modality = $507fabe10e71c6fb$export$630ff653c5ada6a9$2();
      let element2 = $feb5ffebff200149$export$c3d8340acf92597f$2(ref, manager.focusedKey);
      if (!(element2 instanceof HTMLElement))
        return;
      if (modality === "keyboard" || didAutoFocusRef.current) {
        if (raf3.current)
          cancelAnimationFrame(raf3.current);
        raf3.current = requestAnimationFrame(() => {
          if (scrollRef.current) {
            $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollRef.current, element2);
            if (modality !== "virtual")
              $2f04cbc44ee30ce0$export$c826860796309d1b(element2, {
                containingElement: ref.current
              });
          }
        });
      }
    }
    if (!shouldUseVirtualFocus && manager.isFocused && manager.focusedKey == null && lastFocusedKey.current != null && ref.current)
      $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
    lastFocusedKey.current = manager.focusedKey;
    didAutoFocusRef.current = false;
  });
  reactExports.useEffect(() => {
    return () => {
      if (raf3.current)
        cancelAnimationFrame(raf3.current);
    };
  }, []);
  $e9faafb641e167db$export$90fc3a17d93f704c(ref, "react-aria-focus-scope-restore", (e2) => {
    e2.preventDefault();
    manager.setFocused(true);
  });
  let handlers2 = {
    onKeyDown,
    onFocus,
    onBlur,
    onMouseDown(e2) {
      if (scrollRef.current === e2.target)
        e2.preventDefault();
    }
  };
  let { typeSelectProps } = $fb3050f43d946246$export$e32c88dfddc6e1d8$2({
    keyboardDelegate: delegate,
    selectionManager: manager
  });
  if (!disallowTypeAhead)
    handlers2 = $3ef42575df84b30b$export$9d1611c77c2fe928$9(typeSelectProps, handlers2);
  let tabIndex = void 0;
  if (!shouldUseVirtualFocus)
    tabIndex = manager.focusedKey == null ? 0 : -1;
  let collectionId = $feb5ffebff200149$export$881eb0d9f3605d9d$1(manager.collection);
  return {
    collectionProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(handlers2, {
      tabIndex,
      "data-collection": collectionId
    })
  };
}
let $657e4dc4a6e88df0$export$8f5ed9ff9f511381$2 = class $657e4dc4a6e88df0$export$8f5ed9ff9f511381 {
  getItemRect(key) {
    let container = this.ref.current;
    if (!container)
      return null;
    let item = key != null ? $feb5ffebff200149$export$c3d8340acf92597f$2(this.ref, key) : null;
    if (!item)
      return null;
    let containerRect = container.getBoundingClientRect();
    let itemRect = item.getBoundingClientRect();
    return {
      x: itemRect.left - containerRect.left + container.scrollLeft,
      y: itemRect.top - containerRect.top + container.scrollTop,
      width: itemRect.width,
      height: itemRect.height
    };
  }
  getContentSize() {
    let container = this.ref.current;
    var _container_scrollWidth, _container_scrollHeight;
    return {
      width: (_container_scrollWidth = container === null || container === void 0 ? void 0 : container.scrollWidth) !== null && _container_scrollWidth !== void 0 ? _container_scrollWidth : 0,
      height: (_container_scrollHeight = container === null || container === void 0 ? void 0 : container.scrollHeight) !== null && _container_scrollHeight !== void 0 ? _container_scrollHeight : 0
    };
  }
  getVisibleRect() {
    let container = this.ref.current;
    var _container_scrollLeft, _container_scrollTop, _container_offsetWidth, _container_offsetHeight;
    return {
      x: (_container_scrollLeft = container === null || container === void 0 ? void 0 : container.scrollLeft) !== null && _container_scrollLeft !== void 0 ? _container_scrollLeft : 0,
      y: (_container_scrollTop = container === null || container === void 0 ? void 0 : container.scrollTop) !== null && _container_scrollTop !== void 0 ? _container_scrollTop : 0,
      width: (_container_offsetWidth = container === null || container === void 0 ? void 0 : container.offsetWidth) !== null && _container_offsetWidth !== void 0 ? _container_offsetWidth : 0,
      height: (_container_offsetHeight = container === null || container === void 0 ? void 0 : container.offsetHeight) !== null && _container_offsetHeight !== void 0 ? _container_offsetHeight : 0
    };
  }
  constructor(ref) {
    this.ref = ref;
  }
};
let $2a25aae57d74318e$export$a05409b8bb224a5a$2 = class $2a25aae57d74318e$export$a05409b8bb224a5a {
  isDisabled(item) {
    var _item_props;
    return this.disabledBehavior === "all" && (((_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.isDisabled) || this.disabledKeys.has(item.key));
  }
  findNextNonDisabled(key, getNext) {
    let nextKey = key;
    while (nextKey != null) {
      let item = this.collection.getItem(nextKey);
      if ((item === null || item === void 0 ? void 0 : item.type) === "item" && !this.isDisabled(item))
        return nextKey;
      nextKey = getNext(nextKey);
    }
    return null;
  }
  getNextKey(key) {
    let nextKey = key;
    nextKey = this.collection.getKeyAfter(nextKey);
    return this.findNextNonDisabled(nextKey, (key2) => this.collection.getKeyAfter(key2));
  }
  getPreviousKey(key) {
    let nextKey = key;
    nextKey = this.collection.getKeyBefore(nextKey);
    return this.findNextNonDisabled(nextKey, (key2) => this.collection.getKeyBefore(key2));
  }
  findKey(key, nextKey, shouldSkip2) {
    let tempKey = key;
    let itemRect = this.layoutDelegate.getItemRect(tempKey);
    if (!itemRect || tempKey == null)
      return null;
    let prevRect = itemRect;
    do {
      tempKey = nextKey(tempKey);
      if (tempKey == null)
        break;
      itemRect = this.layoutDelegate.getItemRect(tempKey);
    } while (itemRect && shouldSkip2(prevRect, itemRect) && tempKey != null);
    return tempKey;
  }
  isSameRow(prevRect, itemRect) {
    return prevRect.y === itemRect.y || prevRect.x !== itemRect.x;
  }
  isSameColumn(prevRect, itemRect) {
    return prevRect.x === itemRect.x || prevRect.y !== itemRect.y;
  }
  getKeyBelow(key) {
    if (this.layout === "grid" && this.orientation === "vertical")
      return this.findKey(key, (key2) => this.getNextKey(key2), this.isSameRow);
    else
      return this.getNextKey(key);
  }
  getKeyAbove(key) {
    if (this.layout === "grid" && this.orientation === "vertical")
      return this.findKey(key, (key2) => this.getPreviousKey(key2), this.isSameRow);
    else
      return this.getPreviousKey(key);
  }
  getNextColumn(key, right) {
    return right ? this.getPreviousKey(key) : this.getNextKey(key);
  }
  getKeyRightOf(key) {
    let layoutDelegateMethod = this.direction === "ltr" ? "getKeyRightOf" : "getKeyLeftOf";
    if (this.layoutDelegate[layoutDelegateMethod]) {
      key = this.layoutDelegate[layoutDelegateMethod](key);
      return this.findNextNonDisabled(key, (key2) => this.layoutDelegate[layoutDelegateMethod](key2));
    }
    if (this.layout === "grid") {
      if (this.orientation === "vertical")
        return this.getNextColumn(key, this.direction === "rtl");
      else
        return this.findKey(key, (key2) => this.getNextColumn(key2, this.direction === "rtl"), this.isSameColumn);
    } else if (this.orientation === "horizontal")
      return this.getNextColumn(key, this.direction === "rtl");
    return null;
  }
  getKeyLeftOf(key) {
    let layoutDelegateMethod = this.direction === "ltr" ? "getKeyLeftOf" : "getKeyRightOf";
    if (this.layoutDelegate[layoutDelegateMethod]) {
      key = this.layoutDelegate[layoutDelegateMethod](key);
      return this.findNextNonDisabled(key, (key2) => this.layoutDelegate[layoutDelegateMethod](key2));
    }
    if (this.layout === "grid") {
      if (this.orientation === "vertical")
        return this.getNextColumn(key, this.direction === "ltr");
      else
        return this.findKey(key, (key2) => this.getNextColumn(key2, this.direction === "ltr"), this.isSameColumn);
    } else if (this.orientation === "horizontal")
      return this.getNextColumn(key, this.direction === "ltr");
    return null;
  }
  getFirstKey() {
    let key = this.collection.getFirstKey();
    return this.findNextNonDisabled(key, (key2) => this.collection.getKeyAfter(key2));
  }
  getLastKey() {
    let key = this.collection.getLastKey();
    return this.findNextNonDisabled(key, (key2) => this.collection.getKeyBefore(key2));
  }
  getKeyPageAbove(key) {
    let menu2 = this.ref.current;
    let itemRect = this.layoutDelegate.getItemRect(key);
    if (!itemRect)
      return null;
    if (menu2 && !$cc38e7bd3fc7b213$export$2bb74740c4e19def$1(menu2))
      return this.getFirstKey();
    let nextKey = key;
    if (this.orientation === "horizontal") {
      let pageX = Math.max(0, itemRect.x + itemRect.width - this.layoutDelegate.getVisibleRect().width);
      while (itemRect && itemRect.x > pageX && nextKey != null) {
        nextKey = this.getKeyAbove(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    } else {
      let pageY = Math.max(0, itemRect.y + itemRect.height - this.layoutDelegate.getVisibleRect().height);
      while (itemRect && itemRect.y > pageY && nextKey != null) {
        nextKey = this.getKeyAbove(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    }
    return nextKey !== null && nextKey !== void 0 ? nextKey : this.getFirstKey();
  }
  getKeyPageBelow(key) {
    let menu2 = this.ref.current;
    let itemRect = this.layoutDelegate.getItemRect(key);
    if (!itemRect)
      return null;
    if (menu2 && !$cc38e7bd3fc7b213$export$2bb74740c4e19def$1(menu2))
      return this.getLastKey();
    let nextKey = key;
    if (this.orientation === "horizontal") {
      let pageX = Math.min(this.layoutDelegate.getContentSize().width, itemRect.y - itemRect.width + this.layoutDelegate.getVisibleRect().width);
      while (itemRect && itemRect.x < pageX && nextKey != null) {
        nextKey = this.getKeyBelow(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    } else {
      let pageY = Math.min(this.layoutDelegate.getContentSize().height, itemRect.y - itemRect.height + this.layoutDelegate.getVisibleRect().height);
      while (itemRect && itemRect.y < pageY && nextKey != null) {
        nextKey = this.getKeyBelow(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    }
    return nextKey !== null && nextKey !== void 0 ? nextKey : this.getLastKey();
  }
  getKeyForSearch(search2, fromKey) {
    if (!this.collator)
      return null;
    let collection = this.collection;
    let key = fromKey || this.getFirstKey();
    while (key != null) {
      let item = collection.getItem(key);
      if (!item)
        return null;
      let substring = item.textValue.slice(0, search2.length);
      if (item.textValue && this.collator.compare(substring, search2) === 0)
        return key;
      key = this.getNextKey(key);
    }
    return null;
  }
  constructor(...args) {
    if (args.length === 1) {
      let opts2 = args[0];
      this.collection = opts2.collection;
      this.ref = opts2.ref;
      this.collator = opts2.collator;
      this.disabledKeys = opts2.disabledKeys || /* @__PURE__ */ new Set();
      this.disabledBehavior = opts2.disabledBehavior || "all";
      this.orientation = opts2.orientation || "vertical";
      this.direction = opts2.direction;
      this.layout = opts2.layout || "stack";
      this.layoutDelegate = opts2.layoutDelegate || new $657e4dc4a6e88df0$export$8f5ed9ff9f511381$2(opts2.ref);
    } else {
      this.collection = args[0];
      this.disabledKeys = args[1];
      this.ref = args[2];
      this.collator = args[3];
      this.layout = "stack";
      this.orientation = "vertical";
      this.disabledBehavior = "all";
      this.layoutDelegate = new $657e4dc4a6e88df0$export$8f5ed9ff9f511381$2(this.ref);
    }
    if (this.layout === "stack" && this.orientation === "vertical") {
      this.getKeyLeftOf = void 0;
      this.getKeyRightOf = void 0;
    }
  }
};
function $982254629710d113$export$b95089534ab7c1fd$1(props) {
  let { selectionManager, collection, disabledKeys, ref, keyboardDelegate, layoutDelegate } = props;
  let collator = $325a3faab7a68acd$export$a16aca283550c30d$2({
    usage: "search",
    sensitivity: "base"
  });
  let disabledBehavior = selectionManager.disabledBehavior;
  let delegate = reactExports.useMemo(() => keyboardDelegate || new $2a25aae57d74318e$export$a05409b8bb224a5a$2({
    collection,
    disabledKeys,
    disabledBehavior,
    ref,
    collator,
    layoutDelegate
  }), [
    keyboardDelegate,
    layoutDelegate,
    collection,
    disabledKeys,
    ref,
    collator,
    disabledBehavior
  ]);
  let { collectionProps } = $ae20dd8cbca75726$export$d6daf82dcd84e87c$1({
    ...props,
    ref,
    selectionManager,
    keyboardDelegate: delegate
  });
  return {
    listProps: collectionProps
  };
}
function useReactAriaAccordion(props, state, ref) {
  let { listProps } = $982254629710d113$export$b95089534ab7c1fd$1({
    ...props,
    ...state,
    allowsTabNavigation: true,
    disallowSelectAll: true,
    ref
  });
  delete listProps.onKeyDownCapture;
  return {
    accordionProps: {
      ...listProps,
      tabIndex: void 0
    }
  };
}
function $8a9cb279dc87e130$export$525bc4921d56d4a$c(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$b(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$cabe61c495ee3649$a(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$3(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$4(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$a = "default";
let $14c0b72509d70225$var$savedUserSelect$a = "";
let $14c0b72509d70225$var$modifiedElementMap$a = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$a(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$a === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
      $14c0b72509d70225$var$savedUserSelect$a = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$a = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$a.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$a(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$a !== "disabled")
      return;
    $14c0b72509d70225$var$state$a = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
        if ($14c0b72509d70225$var$state$a === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$a || "";
          $14c0b72509d70225$var$savedUserSelect$a = "";
          $14c0b72509d70225$var$state$a = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$a.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$a.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$a.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$a = React$5.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$a.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext$a(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$a);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$9(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$a = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$a = class $f6c31cce2adf654f$var$PressEvent2 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$a, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$a);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$a, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$a, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$a = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$a = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$a = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$a(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$a(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$a("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$a("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$a("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$a("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$a(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$a(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$b(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$c(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$a(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$a($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$a(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$3(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$a(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$9(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$6())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$4(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$a(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$a(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$a(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$a($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$a(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$a(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$a]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$a] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$3(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$a(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$a(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$a(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$a(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$5(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$a))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$a;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$a}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$a((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$a]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$a(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$a(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$a(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$a(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$a(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$a(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$a(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$a(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$a(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$a(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$a = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$a(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$a.has(target.type);
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$g = false;
let $6179b936705e76d3$var$hoverCount$g = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$g() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$g = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$g = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$g(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$g();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$g() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$g);
  $6179b936705e76d3$var$hoverCount$g++;
  return () => {
    $6179b936705e76d3$var$hoverCount$g--;
    if ($6179b936705e76d3$var$hoverCount$g > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$g);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$g(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$g, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$g && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
function useAccordionItem(props) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const { ref, as: as2, item, onFocusChange } = props;
  const {
    state,
    className,
    indicator,
    children,
    title,
    subtitle,
    startContent,
    motionProps,
    focusedKey,
    variant,
    isCompact = false,
    classNames: classNamesProp = {},
    isDisabled: isDisabledProp = false,
    hideIndicator = false,
    disableAnimation = (_a2 = globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _a2 : false,
    keepContentMounted = false,
    disableIndicatorAnimation = false,
    HeadingComponent = as2 || "h2",
    onPress,
    onPressStart,
    onPressEnd,
    onPressChange,
    onPressUp,
    onClick,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const isDisabled = state.disabledKeys.has(item.key) || isDisabledProp;
  const isOpen = state.selectionManager.isSelected(item.key);
  const { buttonProps: buttonCompleteProps, regionProps } = useReactAriaAccordionItem(
    { item, isDisabled },
    { ...state, focusedKey },
    domRef
  );
  const { onFocus: onFocusButton, onBlur: onBlurButton, ...buttonProps } = buttonCompleteProps;
  const { isFocused, isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus: (_b2 = item.props) == null ? void 0 : _b2.autoFocus
  });
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$g({ isDisabled });
  const { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$a({
    ref: domRef,
    isDisabled,
    onPress,
    onPressStart,
    onPressEnd,
    onPressChange,
    onPressUp
  });
  const handleFocus3 = reactExports.useCallback(() => {
    onFocusChange == null ? void 0 : onFocusChange(true, item.key);
  }, []);
  const handleBlur = reactExports.useCallback(() => {
    onFocusChange == null ? void 0 : onFocusChange(false, item.key);
  }, []);
  const classNames2 = reactExports.useMemo(
    () => ({
      ...classNamesProp
    }),
    [objectToDeps(classNamesProp)]
  );
  const slots = reactExports.useMemo(
    () => accordionItem({
      isCompact,
      isDisabled,
      hideIndicator,
      disableAnimation,
      disableIndicatorAnimation,
      variant
    }),
    [isCompact, isDisabled, hideIndicator, disableAnimation, disableIndicatorAnimation, variant]
  );
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const getBaseProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "data-open": dataAttr(isOpen),
        "data-disabled": dataAttr(isDisabled),
        "data-slot": "base",
        className: slots.base({ class: baseStyles }),
        ...mergeProps$3(
          filterDOMProps(otherProps, {
            enabled: shouldFilterDOMProps
          }),
          props2
        )
      };
    },
    [baseStyles, shouldFilterDOMProps, otherProps, slots, item.props, isOpen, isDisabled]
  );
  const getButtonProps = (props2 = {}) => {
    var _a22, _b22;
    return {
      ref: domRef,
      "data-open": dataAttr(isOpen),
      "data-focus": dataAttr(isFocused),
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-disabled": dataAttr(isDisabled),
      "data-hover": dataAttr(isHovered),
      "data-pressed": dataAttr(isPressed),
      "data-slot": "trigger",
      className: slots.trigger({ class: classNames2 == null ? void 0 : classNames2.trigger }),
      onFocus: callAllHandlers(
        handleFocus3,
        onFocusButton,
        focusProps.onFocus,
        otherProps.onFocus,
        (_a22 = item.props) == null ? void 0 : _a22.onFocus
      ),
      onBlur: callAllHandlers(
        handleBlur,
        onBlurButton,
        focusProps.onBlur,
        otherProps.onBlur,
        (_b22 = item.props) == null ? void 0 : _b22.onBlur
      ),
      ...mergeProps$3(buttonProps, hoverProps, pressProps, props2, {
        onClick: chain(pressProps.onClick, onClick)
      })
    };
  };
  const getContentProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "data-open": dataAttr(isOpen),
        "data-disabled": dataAttr(isDisabled),
        "data-slot": "content",
        className: slots.content({ class: classNames2 == null ? void 0 : classNames2.content }),
        ...mergeProps$3(regionProps, props2)
      };
    },
    [slots, classNames2, regionProps, isOpen, isDisabled, classNames2 == null ? void 0 : classNames2.content]
  );
  const getIndicatorProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "aria-hidden": dataAttr(true),
        "data-open": dataAttr(isOpen),
        "data-disabled": dataAttr(isDisabled),
        "data-slot": "indicator",
        className: slots.indicator({ class: classNames2 == null ? void 0 : classNames2.indicator }),
        ...props2
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.indicator, isOpen, isDisabled, classNames2 == null ? void 0 : classNames2.indicator]
  );
  const getHeadingProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "data-open": dataAttr(isOpen),
        "data-disabled": dataAttr(isDisabled),
        "data-slot": "heading",
        className: slots.heading({ class: classNames2 == null ? void 0 : classNames2.heading }),
        ...props2
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.heading, isOpen, isDisabled, classNames2 == null ? void 0 : classNames2.heading]
  );
  const getTitleProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "data-open": dataAttr(isOpen),
        "data-disabled": dataAttr(isDisabled),
        "data-slot": "title",
        className: slots.title({ class: classNames2 == null ? void 0 : classNames2.title }),
        ...props2
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.title, isOpen, isDisabled, classNames2 == null ? void 0 : classNames2.title]
  );
  const getSubtitleProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "data-open": dataAttr(isOpen),
        "data-disabled": dataAttr(isDisabled),
        "data-slot": "subtitle",
        className: slots.subtitle({ class: classNames2 == null ? void 0 : classNames2.subtitle }),
        ...props2
      };
    },
    [slots, classNames2, isOpen, isDisabled, classNames2 == null ? void 0 : classNames2.subtitle]
  );
  return {
    Component: Component2,
    HeadingComponent,
    item,
    slots,
    classNames: classNames2,
    domRef,
    indicator,
    children,
    title,
    subtitle,
    startContent,
    isOpen,
    isDisabled,
    hideIndicator,
    keepContentMounted,
    disableAnimation,
    motionProps,
    getBaseProps,
    getHeadingProps,
    getButtonProps,
    getContentProps,
    getIndicatorProps,
    getTitleProps,
    getSubtitleProps
  };
}
var CheckLinearIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    stroke: "currentColor",
    strokeLinecap: "round",
    strokeLinejoin: "round",
    strokeWidth: 2,
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "20 6 9 17 4 12" })
  }
);
var CopyLinearIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    stroke: "currentColor",
    strokeLinecap: "round",
    strokeLinejoin: "round",
    strokeWidth: "1.5",
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M16 17.1c0 3.5-1.4 4.9-4.9 4.9H6.9C3.4 22 2 20.6 2 17.1v-4.2C2 9.4 3.4 8 6.9 8h4.2c3.5 0 4.9 1.4 4.9 4.9Z" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M8 8V6.9C8 3.4 9.4 2 12.9 2h4.2C20.6 2 22 3.4 22 6.9v4.2c0 3.5-1.4 4.9-4.9 4.9H16" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M16 12.9C16 9.4 14.6 8 11.1 8" })
    ]
  }
);
var CalendarBoldIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        "path",
        {
          d: "M7.75 2.5a.75.75 0 0 0-1.5 0v1.58c-1.44.115-2.384.397-3.078 1.092c-.695.694-.977 1.639-1.093 3.078h19.842c-.116-1.44-.398-2.384-1.093-3.078c-.694-.695-1.639-.977-3.078-1.093V2.5a.75.75 0 0 0-1.5 0v1.513C15.585 4 14.839 4 14 4h-4c-.839 0-1.585 0-2.25.013z",
          fill: "currentColor"
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        "path",
        {
          clipRule: "evenodd",
          d: "M2 12c0-.839 0-1.585.013-2.25h19.974C22 10.415 22 11.161 22 12v2c0 3.771 0 5.657-1.172 6.828C19.657 22 17.771 22 14 22h-4c-3.771 0-5.657 0-6.828-1.172C2 19.657 2 17.771 2 14zm15 2a1 1 0 1 0 0-2a1 1 0 0 0 0 2m0 4a1 1 0 1 0 0-2a1 1 0 0 0 0 2m-4-5a1 1 0 1 1-2 0a1 1 0 0 1 2 0m0 4a1 1 0 1 1-2 0a1 1 0 0 1 2 0m-6-3a1 1 0 1 0 0-2a1 1 0 0 0 0 2m0 4a1 1 0 1 0 0-2a1 1 0 0 0 0 2",
          fill: "currentColor",
          fillRule: "evenodd"
        }
      )
    ]
  }
);
var SuccessIcon = (props) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "svg",
    {
      fill: "none",
      height: "24",
      viewBox: "0 0 24 24",
      width: "24",
      xmlns: "http://www.w3.org/2000/svg",
      ...props,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        "path",
        {
          d: "\n          M12 2C6.49 2 2 6.49 2 12C2 17.51 6.49 22 12 22C17.51 22 22 17.51 22 12C22 6.49 17.51 2 12 2Z\n          M16.78 9.7L11.11 15.37C10.97 15.51 10.78 15.59 10.58 15.59C10.38 15.59 10.19 15.51 10.05 15.37L7.22 12.54\n          C6.93 12.25 6.93 11.77 7.22 11.48C7.51 11.19 7.99 11.19 8.28 11.48L10.58 13.78L15.72 8.64\n          C16.01 8.35 16.49 8.35 16.78 8.64C17.07 8.93 17.07 9.4 16.78 9.7Z\n        "
        }
      )
    }
  );
};
var WarningIcon = (props) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "svg",
    {
      className: "fill-current",
      fill: "none",
      height: "24",
      viewBox: "0 0 24 24",
      width: "24",
      xmlns: "http://www.w3.org/2000/svg",
      ...props,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        "path",
        {
          clipRule: "evenodd",
          d: "M3 10.417C3 7.219 3 5.62 3.378 5.082C3.755 4.545 5.258 4.03 8.265 3.001L8.838 2.805C10.405 2.268 11.188 2 12 2C12.812 2 13.595 2.268 15.162 2.805L15.735 3.001C18.742 4.03 20.245 4.545 20.622 5.082C21 5.62 21 7.22 21 10.417V11.991C21 17.629 16.761 20.366 14.101 21.527C13.38 21.842 13.02 22 12 22C10.98 22 10.62 21.842 9.899 21.527C7.239 20.365 3 17.63 3 11.991V10.417ZM12 7.25C12.1989 7.25 12.3897 7.32902 12.5303 7.46967C12.671 7.61032 12.75 7.80109 12.75 8V12C12.75 12.1989 12.671 12.3897 12.5303 12.5303C12.3897 12.671 12.1989 12.75 12 12.75C11.8011 12.75 11.6103 12.671 11.4697 12.5303C11.329 12.3897 11.25 12.1989 11.25 12V8C11.25 7.80109 11.329 7.61032 11.4697 7.46967C11.6103 7.32902 11.8011 7.25 12 7.25ZM12 16C12.2652 16 12.5196 15.8946 12.7071 15.7071C12.8946 15.5196 13 15.2652 13 15C13 14.7348 12.8946 14.4804 12.7071 14.2929C12.5196 14.1054 12.2652 14 12 14C11.7348 14 11.4804 14.1054 11.2929 14.2929C11.1054 14.4804 11 14.7348 11 15C11 15.2652 11.1054 15.5196 11.2929 15.7071C11.4804 15.8946 11.7348 16 12 16Z",
          fill: "currentColor",
          fillRule: "evenodd"
        }
      )
    }
  );
};
var InfoCircleIcon = (props) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "svg",
    {
      fill: "none",
      height: "24",
      viewBox: "0 0 24 24",
      width: "24",
      xmlns: "http://www.w3.org/2000/svg",
      ...props,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M12 22C17.51 22 22 17.51 22 12C22 6.49 17.51 2 12 2C6.49 2 2 6.49 2 12C2 17.51 6.49 22 12 22ZM12.75 16C12.75 16.41 12.41 16.75 12 16.75C11.59 16.75 11.25 16.41 11.25 16L11.25 11C11.25 10.59 11.59 10.25 12 10.25C12.41 10.25 12.75 10.59 12.75 11L12.75 16ZM11.08 7.62C11.13 7.49 11.2 7.39 11.29 7.29C11.39 7.2 11.5 7.13 11.62 7.08C11.74 7.03 11.87 7 12 7C12.13 7 12.26 7.03 12.38 7.08C12.5 7.13 12.61 7.2 12.71 7.29C12.8 7.39 12.87 7.49 12.92 7.62C12.97 7.74 13 7.87 13 8C13 8.13 12.97 8.26 12.92 8.38C12.87 8.5 12.8 8.61 12.71 8.71C12.61 8.8 12.5 8.87 12.38 8.92C12.14 9.02 11.86 9.02 11.62 8.92C11.5 8.87 11.39 8.8 11.29 8.71C11.2 8.61 11.13 8.5 11.08 8.38C11.03 8.26 11 8.13 11 8C11 7.87 11.03 7.74 11.08 7.62Z" })
    }
  );
};
var InfoFilledIcon = (props) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "svg",
    {
      fill: "none",
      height: "24",
      viewBox: "0 0 24 24",
      width: "24",
      xmlns: "http://www.w3.org/2000/svg",
      ...props,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M12 22C17.51 22 22 17.51 22 12C22 6.49 17.51 2 12 2C6.49 2 2 6.49 2 12C2 17.51 6.49 22 12 22ZM12.75 16C12.75 16.41 12.41 16.75 12 16.75C11.59 16.75 11.25 16.41 11.25 16L11.25 11C11.25 10.59 11.59 10.25 12 10.25C12.41 10.25 12.75 10.59 12.75 11L12.75 16ZM11.08 7.62C11.13 7.49 11.2 7.39 11.29 7.29C11.39 7.2 11.5 7.13 11.62 7.08C11.74 7.03 11.87 7 12 7C12.13 7 12.26 7.03 12.38 7.08C12.5 7.13 12.61 7.2 12.71 7.29C12.8 7.39 12.87 7.49 12.92 7.62C12.97 7.74 13 7.87 13 8C13 8.13 12.97 8.26 12.92 8.38C12.87 8.5 12.8 8.61 12.71 8.71C12.61 8.8 12.5 8.87 12.38 8.92C12.14 9.02 11.86 9.02 11.62 8.92C11.5 8.87 11.39 8.8 11.29 8.71C11.2 8.61 11.13 8.5 11.08 8.38C11.03 8.26 11 8.13 11 8C11 7.87 11.03 7.74 11.08 7.62Z" })
    }
  );
};
var LinkIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    shapeRendering: "geometricPrecision",
    stroke: "currentColor",
    strokeLinecap: "round",
    strokeLinejoin: "round",
    strokeWidth: "1.5",
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M15 3h6v6" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M10 14L21 3" })
    ]
  }
);
var EllipsisIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    height: "1em",
    shapeRendering: "geometricPrecision",
    strokeLinecap: "round",
    strokeLinejoin: "round",
    strokeWidth: "1.5",
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "12", cy: "12", fill: "currentColor", r: "1" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "19", cy: "12", fill: "currentColor", r: "1" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "5", cy: "12", fill: "currentColor", r: "1" })
    ]
  }
);
var ForwardIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    shapeRendering: "geometricPrecision",
    stroke: "currentColor",
    strokeLinecap: "round",
    strokeLinejoin: "round",
    strokeWidth: "1.5",
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M13 17l5-5-5-5" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M6 17l5-5-5-5" })
    ]
  }
);
var ChevronUpIcon = ({ strokeWidth = 1.5, ...props }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    stroke: "currentColor",
    strokeLinecap: "round",
    strokeLinejoin: "round",
    strokeWidth,
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "m18 15-6-6-6 6" })
  }
);
var ChevronIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "path",
      {
        d: "M15.5 19l-7-7 7-7",
        stroke: "currentColor",
        strokeLinecap: "round",
        strokeLinejoin: "round",
        strokeWidth: "1.5"
      }
    )
  }
);
var CloseFilledIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
  "svg",
  {
    "aria-hidden": "true",
    focusable: "false",
    height: "1em",
    role: "presentation",
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "path",
      {
        d: "M12 2a10 10 0 1010 10A10.016 10.016 0 0012 2zm3.36 12.3a.754.754 0 010 1.06.748.748 0 01-1.06 0l-2.3-2.3-2.3 2.3a.748.748 0 01-1.06 0 .754.754 0 010-1.06l2.3-2.3-2.3-2.3A.75.75 0 019.7 8.64l2.3 2.3 2.3-2.3a.75.75 0 011.06 1.06l-2.3 2.3z",
        fill: "currentColor"
      }
    )
  }
);
var CloseIcon = (props) => {
  const { isSelected, isIndeterminate, disableAnimation, ...otherProps } = props;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "svg",
    {
      "aria-hidden": "true",
      className: "fill-current",
      fill: "none",
      focusable: "false",
      height: "1em",
      role: "presentation",
      stroke: "currentColor",
      strokeLinecap: "round",
      strokeLinejoin: "round",
      strokeWidth: 2,
      viewBox: "0 0 24 24",
      width: "1em",
      ...otherProps,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M18 6L6 18M6 6l12 12" })
    }
  );
};
var DangerIcon = (props) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "svg",
    {
      className: "fill-current",
      fill: "none",
      height: "20",
      viewBox: "0 0 20 20",
      width: "20",
      xmlns: "http://www.w3.org/2000/svg",
      ...props,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M17.51 3.85L11.57 0.42C10.6 -0.14 9.4 -0.14 8.42 0.42L2.49 3.85C1.52 4.41 0.919998 5.45 0.919998 6.58V13.42C0.919998 14.54 1.52 15.58 2.49 16.15L8.43 19.58C9.4 20.14 10.6 20.14 11.58 19.58L17.52 16.15C18.49 15.59 19.09 14.55 19.09 13.42V6.58C19.08 5.45 18.48 4.42 17.51 3.85ZM9.25 5.75C9.25 5.34 9.59 5 10 5C10.41 5 10.75 5.34 10.75 5.75V11C10.75 11.41 10.41 11.75 10 11.75C9.59 11.75 9.25 11.41 9.25 11V5.75ZM10.92 14.63C10.87 14.75 10.8 14.86 10.71 14.96C10.52 15.15 10.27 15.25 10 15.25C9.87 15.25 9.74 15.22 9.62 15.17C9.49 15.12 9.39 15.05 9.29 14.96C9.2 14.86 9.13 14.75 9.07 14.63C9.02 14.51 9 14.38 9 14.25C9 13.99 9.1 13.73 9.29 13.54C9.39 13.45 9.49 13.38 9.62 13.33C9.99 13.17 10.43 13.26 10.71 13.54C10.8 13.64 10.87 13.74 10.92 13.87C10.97 13.99 11 14.12 11 14.25C11 14.38 10.97 14.51 10.92 14.63Z" })
    }
  );
};
var ChevronDownIcon$1 = ({ strokeWidth = 1.5, ...props }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    stroke: "currentColor",
    strokeLinecap: "round",
    strokeLinejoin: "round",
    strokeWidth,
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "m6 9 6 6 6-6" })
  }
);
function useMeasure$1() {
  const [dimensions, setDimensions] = reactExports.useState({
    width: null,
    height: null
  });
  const previousObserver = reactExports.useRef(null);
  const customRef = reactExports.useCallback((node2) => {
    if (previousObserver.current) {
      previousObserver.current.disconnect();
      previousObserver.current = null;
    }
    if ((node2 == null ? void 0 : node2.nodeType) === Node.ELEMENT_NODE) {
      const observer = new ResizeObserver(([entry]) => {
        if (entry && entry.borderBoxSize) {
          const { inlineSize: width, blockSize: height } = entry.borderBoxSize[0];
          setDimensions({ width, height });
        }
      });
      observer.observe(node2);
      previousObserver.current = observer;
    }
  }, []);
  return [customRef, dimensions];
}
var ResizablePanel = reactExports.forwardRef(
  (originalProps, ref) => {
    const { children, ...props } = originalProps;
    let [measureRef, bounds2] = useMeasure$1();
    return /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$8, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      m$3.div,
      {
        ref,
        animate: {
          width: bounds2.width && (bounds2 == null ? void 0 : bounds2.width) > 0 ? bounds2.width : "auto",
          height: bounds2.height && bounds2.height > 0 ? bounds2.height : "auto"
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: measureRef, ...props, children })
      }
    ) });
  }
);
ResizablePanel.displayName = "HeroUI - ResizablePanel";
var TRANSITION_EASINGS = {
  ease: [0.36, 0.66, 0.4, 1]
};
var TRANSITION_VARIANTS = {
  scaleSpring: {
    enter: {
      transform: "scale(1)",
      opacity: 1,
      transition: {
        type: "spring",
        bounce: 0,
        duration: 0.2
      }
    },
    exit: {
      transform: "scale(0.85)",
      opacity: 0,
      transition: {
        type: "easeOut",
        duration: 0.15
      }
    }
  },
  scaleSpringOpacity: {
    initial: {
      opacity: 0,
      transform: "scale(0.8)"
    },
    enter: {
      opacity: 1,
      transform: "scale(1)",
      transition: {
        type: "spring",
        bounce: 0,
        duration: 0.3
      }
    },
    exit: {
      opacity: 0,
      transform: "scale(0.96)",
      transition: {
        type: "easeOut",
        bounce: 0,
        duration: 0.15
      }
    }
  },
  fade: {
    enter: {
      opacity: 1,
      transition: {
        duration: 0.4,
        ease: TRANSITION_EASINGS.ease
      }
    },
    exit: {
      opacity: 0,
      transition: {
        duration: 0.3,
        ease: TRANSITION_EASINGS.ease
      }
    }
  },
  collapse: {
    enter: {
      opacity: 1,
      height: "auto",
      transition: {
        height: {
          type: "spring",
          bounce: 0,
          duration: 0.3
        },
        opacity: {
          easings: "ease",
          duration: 0.4
        }
      }
    },
    exit: {
      opacity: 0,
      height: 0,
      transition: {
        easings: "ease",
        duration: 0.3
      }
    }
  }
};
var domAnimation$7 = () => __vitePreload(() => import("./index-kYRJvtWR.js"), true ? __vite__mapDeps([]) : void 0).then((res) => res.default);
var AccordionItem = forwardRef((props, ref) => {
  const {
    Component: Component2,
    HeadingComponent,
    classNames: classNames2,
    slots,
    indicator,
    children,
    title,
    subtitle,
    startContent,
    isOpen,
    isDisabled,
    hideIndicator,
    keepContentMounted,
    disableAnimation,
    motionProps,
    getBaseProps,
    getHeadingProps,
    getButtonProps,
    getTitleProps,
    getSubtitleProps,
    getContentProps,
    getIndicatorProps
  } = useAccordionItem({ ...props, ref });
  const willChange = useWillChange();
  const indicatorContent = reactExports.useMemo(() => {
    if (typeof indicator === "function") {
      return indicator({ indicator: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronIcon, {}), isOpen, isDisabled });
    }
    if (indicator)
      return indicator;
    return null;
  }, [indicator, isOpen, isDisabled]);
  const indicatorComponent = indicatorContent || /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronIcon, {});
  const content2 = reactExports.useMemo(() => {
    if (disableAnimation) {
      if (keepContentMounted) {
        return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getContentProps(), children });
      }
      return isOpen && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getContentProps(), children });
    }
    const transitionVariants = {
      exit: { ...TRANSITION_VARIANTS.collapse.exit, overflowY: "hidden" },
      enter: { ...TRANSITION_VARIANTS.collapse.enter, overflowY: "unset" }
    };
    return keepContentMounted ? /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$7, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      m$3.section,
      {
        animate: isOpen ? "enter" : "exit",
        exit: "exit",
        initial: "exit",
        style: { willChange },
        variants: transitionVariants,
        onKeyDown: (e2) => {
          e2.stopPropagation();
        },
        ...motionProps,
        children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getContentProps(), children })
      },
      "accordion-content"
    ) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { initial: false, children: isOpen && /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$7, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      m$3.section,
      {
        animate: "enter",
        exit: "exit",
        initial: "exit",
        style: { willChange },
        variants: transitionVariants,
        onKeyDown: (e2) => {
          e2.stopPropagation();
        },
        ...motionProps,
        children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getContentProps(), children })
      },
      "accordion-content"
    ) }) });
  }, [isOpen, disableAnimation, keepContentMounted, children, motionProps]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getBaseProps(), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(HeadingComponent, { ...getHeadingProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { ...getButtonProps(), children: [
      startContent && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: slots.startContent({ class: classNames2 == null ? void 0 : classNames2.startContent }), children: startContent }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: slots.titleWrapper({ class: classNames2 == null ? void 0 : classNames2.titleWrapper }), children: [
        title && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getTitleProps(), children: title }),
        subtitle && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getSubtitleProps(), children: subtitle })
      ] }),
      !hideIndicator && indicatorComponent && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getIndicatorProps(), children: indicatorComponent })
    ] }) }),
    content2
  ] });
});
AccordionItem.displayName = "HeroUI.AccordionItem";
var accordion_item_default = AccordionItem;
class $05ca4cd7c4a5a999$export$863faf230ee2118a {
  *[Symbol.iterator]() {
    yield* this.iterable;
  }
  get size() {
    return this.keyMap.size;
  }
  getKeys() {
    return this.keyMap.keys();
  }
  getKeyBefore(key) {
    let node2 = this.keyMap.get(key);
    var _node_prevKey;
    return node2 ? (_node_prevKey = node2.prevKey) !== null && _node_prevKey !== void 0 ? _node_prevKey : null : null;
  }
  getKeyAfter(key) {
    let node2 = this.keyMap.get(key);
    var _node_nextKey;
    return node2 ? (_node_nextKey = node2.nextKey) !== null && _node_nextKey !== void 0 ? _node_nextKey : null : null;
  }
  getFirstKey() {
    return this.firstKey;
  }
  getLastKey() {
    return this.lastKey;
  }
  getItem(key) {
    var _this_keyMap_get;
    return (_this_keyMap_get = this.keyMap.get(key)) !== null && _this_keyMap_get !== void 0 ? _this_keyMap_get : null;
  }
  at(idx) {
    const keys2 = [
      ...this.getKeys()
    ];
    return this.getItem(keys2[idx]);
  }
  constructor(nodes, { expandedKeys } = {}) {
    this.keyMap = /* @__PURE__ */ new Map();
    this.firstKey = null;
    this.lastKey = null;
    this.iterable = nodes;
    expandedKeys = expandedKeys || /* @__PURE__ */ new Set();
    let visit2 = (node2) => {
      this.keyMap.set(node2.key, node2);
      if (node2.childNodes && (node2.type === "section" || expandedKeys.has(node2.key)))
        for (let child of node2.childNodes)
          visit2(child);
    };
    for (let node2 of nodes)
      visit2(node2);
    let last = null;
    let index2 = 0;
    for (let [key, node2] of this.keyMap) {
      if (last) {
        last.nextKey = key;
        node2.prevKey = last.key;
      } else {
        this.firstKey = key;
        node2.prevKey = void 0;
      }
      if (node2.type === "item")
        node2.index = index2++;
      last = node2;
      last.nextKey = void 0;
    }
    var _last_key;
    this.lastKey = (_last_key = last === null || last === void 0 ? void 0 : last.key) !== null && _last_key !== void 0 ? _last_key : null;
  }
}
class $e40ea825a81a3709$export$52baac22726c72bf extends Set {
  constructor(keys2, anchorKey, currentKey) {
    super(keys2);
    if (keys2 instanceof $e40ea825a81a3709$export$52baac22726c72bf) {
      this.anchorKey = anchorKey !== null && anchorKey !== void 0 ? anchorKey : keys2.anchorKey;
      this.currentKey = currentKey !== null && currentKey !== void 0 ? currentKey : keys2.currentKey;
    } else {
      this.anchorKey = anchorKey !== null && anchorKey !== void 0 ? anchorKey : null;
      this.currentKey = currentKey !== null && currentKey !== void 0 ? currentKey : null;
    }
  }
}
function $7af3f5b51489e0b5$var$equalSets(setA, setB) {
  if (setA.size !== setB.size)
    return false;
  for (let item of setA) {
    if (!setB.has(item))
      return false;
  }
  return true;
}
function $7af3f5b51489e0b5$export$253fe78d46329472(props) {
  let { selectionMode = "none", disallowEmptySelection = false, allowDuplicateSelectionEvents, selectionBehavior: selectionBehaviorProp = "toggle", disabledBehavior = "all" } = props;
  let isFocusedRef = reactExports.useRef(false);
  let [, setFocused] = reactExports.useState(false);
  let focusedKeyRef = reactExports.useRef(null);
  let childFocusStrategyRef = reactExports.useRef(null);
  let [, setFocusedKey] = reactExports.useState(null);
  let selectedKeysProp = reactExports.useMemo(() => $7af3f5b51489e0b5$var$convertSelection(props.selectedKeys), [
    props.selectedKeys
  ]);
  let defaultSelectedKeys = reactExports.useMemo(() => $7af3f5b51489e0b5$var$convertSelection(props.defaultSelectedKeys, new $e40ea825a81a3709$export$52baac22726c72bf()), [
    props.defaultSelectedKeys
  ]);
  let [selectedKeys, setSelectedKeys] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(selectedKeysProp, defaultSelectedKeys, props.onSelectionChange);
  let disabledKeysProp = reactExports.useMemo(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
    props.disabledKeys
  ]);
  let [selectionBehavior, setSelectionBehavior] = reactExports.useState(selectionBehaviorProp);
  if (selectionBehaviorProp === "replace" && selectionBehavior === "toggle" && typeof selectedKeys === "object" && selectedKeys.size === 0)
    setSelectionBehavior("replace");
  let lastSelectionBehavior = reactExports.useRef(selectionBehaviorProp);
  reactExports.useEffect(() => {
    if (selectionBehaviorProp !== lastSelectionBehavior.current) {
      setSelectionBehavior(selectionBehaviorProp);
      lastSelectionBehavior.current = selectionBehaviorProp;
    }
  }, [
    selectionBehaviorProp
  ]);
  return {
    selectionMode,
    disallowEmptySelection,
    selectionBehavior,
    setSelectionBehavior,
    get isFocused() {
      return isFocusedRef.current;
    },
    setFocused(f2) {
      isFocusedRef.current = f2;
      setFocused(f2);
    },
    get focusedKey() {
      return focusedKeyRef.current;
    },
    get childFocusStrategy() {
      return childFocusStrategyRef.current;
    },
    setFocusedKey(k2, childFocusStrategy = "first") {
      focusedKeyRef.current = k2;
      childFocusStrategyRef.current = childFocusStrategy;
      setFocusedKey(k2);
    },
    selectedKeys,
    setSelectedKeys(keys2) {
      if (allowDuplicateSelectionEvents || !$7af3f5b51489e0b5$var$equalSets(keys2, selectedKeys))
        setSelectedKeys(keys2);
    },
    disabledKeys: disabledKeysProp,
    disabledBehavior
  };
}
function $7af3f5b51489e0b5$var$convertSelection(selection, defaultValue2) {
  if (!selection)
    return defaultValue2;
  return selection === "all" ? "all" : new $e40ea825a81a3709$export$52baac22726c72bf(selection);
}
class $eb2240fc39a57fa5$export$bf788dd355e3a401 {
  build(props, context) {
    this.context = context;
    return $eb2240fc39a57fa5$var$iterable(() => this.iterateCollection(props));
  }
  *iterateCollection(props) {
    let { children, items } = props;
    if (React$5.isValidElement(children) && children.type === React$5.Fragment)
      yield* this.iterateCollection({
        children: children.props.children,
        items
      });
    else if (typeof children === "function") {
      if (!items)
        throw new Error("props.children was a function but props.items is missing");
      let index2 = 0;
      for (let item of items) {
        yield* this.getFullNode({
          value: item,
          index: index2
        }, {
          renderer: children
        });
        index2++;
      }
    } else {
      let items2 = [];
      React$5.Children.forEach(children, (child) => {
        if (child)
          items2.push(child);
      });
      let index2 = 0;
      for (let item of items2) {
        let nodes = this.getFullNode({
          element: item,
          index: index2
        }, {});
        for (let node2 of nodes) {
          index2++;
          yield node2;
        }
      }
    }
  }
  getKey(item, partialNode, state, parentKey) {
    if (item.key != null)
      return item.key;
    if (partialNode.type === "cell" && partialNode.key != null)
      return `${parentKey}${partialNode.key}`;
    let v2 = partialNode.value;
    if (v2 != null) {
      var _v_key;
      let key = (_v_key = v2.key) !== null && _v_key !== void 0 ? _v_key : v2.id;
      if (key == null)
        throw new Error("No key found for item");
      return key;
    }
    return parentKey ? `${parentKey}.${partialNode.index}` : `$.${partialNode.index}`;
  }
  getChildState(state, partialNode) {
    return {
      renderer: partialNode.renderer || state.renderer
    };
  }
  *getFullNode(partialNode, state, parentKey, parentNode) {
    if (React$5.isValidElement(partialNode.element) && partialNode.element.type === React$5.Fragment) {
      let children = [];
      React$5.Children.forEach(partialNode.element.props.children, (child) => {
        children.push(child);
      });
      var _partialNode_index;
      let index2 = (_partialNode_index = partialNode.index) !== null && _partialNode_index !== void 0 ? _partialNode_index : 0;
      for (const child of children)
        yield* this.getFullNode({
          element: child,
          index: index2++
        }, state, parentKey, parentNode);
      return;
    }
    let element2 = partialNode.element;
    if (!element2 && partialNode.value && state && state.renderer) {
      let cached = this.cache.get(partialNode.value);
      if (cached && (!cached.shouldInvalidate || !cached.shouldInvalidate(this.context))) {
        cached.index = partialNode.index;
        cached.parentKey = parentNode ? parentNode.key : null;
        yield cached;
        return;
      }
      element2 = state.renderer(partialNode.value);
    }
    if (React$5.isValidElement(element2)) {
      let type4 = element2.type;
      if (typeof type4 !== "function" && typeof type4.getCollectionNode !== "function") {
        let name2 = element2.type;
        throw new Error(`Unknown element <${name2}> in collection.`);
      }
      let childNodes = type4.getCollectionNode(element2.props, this.context);
      var _partialNode_index1;
      let index2 = (_partialNode_index1 = partialNode.index) !== null && _partialNode_index1 !== void 0 ? _partialNode_index1 : 0;
      let result = childNodes.next();
      while (!result.done && result.value) {
        let childNode = result.value;
        partialNode.index = index2;
        var _childNode_key;
        let nodeKey = (_childNode_key = childNode.key) !== null && _childNode_key !== void 0 ? _childNode_key : null;
        if (nodeKey == null)
          nodeKey = childNode.element ? null : this.getKey(element2, partialNode, state, parentKey);
        let nodes = this.getFullNode({
          ...childNode,
          key: nodeKey,
          index: index2,
          wrapper: $eb2240fc39a57fa5$var$compose(partialNode.wrapper, childNode.wrapper)
        }, this.getChildState(state, childNode), parentKey ? `${parentKey}${element2.key}` : element2.key, parentNode);
        let children = [
          ...nodes
        ];
        for (let node3 of children) {
          var _childNode_value, _ref;
          node3.value = (_ref = (_childNode_value = childNode.value) !== null && _childNode_value !== void 0 ? _childNode_value : partialNode.value) !== null && _ref !== void 0 ? _ref : null;
          if (node3.value)
            this.cache.set(node3.value, node3);
          var _parentNode_type;
          if (partialNode.type && node3.type !== partialNode.type)
            throw new Error(`Unsupported type <${$eb2240fc39a57fa5$var$capitalize(node3.type)}> in <${$eb2240fc39a57fa5$var$capitalize((_parentNode_type = parentNode === null || parentNode === void 0 ? void 0 : parentNode.type) !== null && _parentNode_type !== void 0 ? _parentNode_type : "unknown parent type")}>. Only <${$eb2240fc39a57fa5$var$capitalize(partialNode.type)}> is supported.`);
          index2++;
          yield node3;
        }
        result = childNodes.next(children);
      }
      return;
    }
    if (partialNode.key == null || partialNode.type == null)
      return;
    let builder = this;
    var _partialNode_value, _partialNode_textValue;
    let node2 = {
      type: partialNode.type,
      props: partialNode.props,
      key: partialNode.key,
      parentKey: parentNode ? parentNode.key : null,
      value: (_partialNode_value = partialNode.value) !== null && _partialNode_value !== void 0 ? _partialNode_value : null,
      level: parentNode ? parentNode.level + 1 : 0,
      index: partialNode.index,
      rendered: partialNode.rendered,
      textValue: (_partialNode_textValue = partialNode.textValue) !== null && _partialNode_textValue !== void 0 ? _partialNode_textValue : "",
      "aria-label": partialNode["aria-label"],
      wrapper: partialNode.wrapper,
      shouldInvalidate: partialNode.shouldInvalidate,
      hasChildNodes: partialNode.hasChildNodes || false,
      childNodes: $eb2240fc39a57fa5$var$iterable(function* () {
        if (!partialNode.hasChildNodes || !partialNode.childNodes)
          return;
        let index2 = 0;
        for (let child of partialNode.childNodes()) {
          if (child.key != null)
            child.key = `${node2.key}${child.key}`;
          let nodes = builder.getFullNode({
            ...child,
            index: index2
          }, builder.getChildState(state, child), node2.key, node2);
          for (let node3 of nodes) {
            index2++;
            yield node3;
          }
        }
      })
    };
    yield node2;
  }
  constructor() {
    this.cache = /* @__PURE__ */ new WeakMap();
  }
}
function $eb2240fc39a57fa5$var$iterable(iterator2) {
  let cache2 = [];
  let iterable = null;
  return {
    *[Symbol.iterator]() {
      for (let item of cache2)
        yield item;
      if (!iterable)
        iterable = iterator2();
      for (let item of iterable) {
        cache2.push(item);
        yield item;
      }
    }
  };
}
function $eb2240fc39a57fa5$var$compose(outer, inner) {
  if (outer && inner)
    return (element2) => outer(inner(element2));
  if (outer)
    return outer;
  if (inner)
    return inner;
}
function $eb2240fc39a57fa5$var$capitalize(str) {
  return str[0].toUpperCase() + str.slice(1);
}
function $7613b1592d41b092$export$6cd28814d92fa9c9(props, factory, context) {
  let builder = reactExports.useMemo(() => new $eb2240fc39a57fa5$export$bf788dd355e3a401(), []);
  let { children, items, collection } = props;
  let result = reactExports.useMemo(() => {
    if (collection)
      return collection;
    let nodes = builder.build({
      children,
      items
    }, context);
    return factory(nodes);
  }, [
    builder,
    children,
    items,
    collection,
    context,
    factory
  ]);
  return result;
}
function $c5a24bc478652b5f$export$1005530eda016c13(node2, collection) {
  if (typeof collection.getChildren === "function")
    return collection.getChildren(node2.key);
  return node2.childNodes;
}
function $c5a24bc478652b5f$export$fbdeaa6a76694f71(iterable) {
  return $c5a24bc478652b5f$export$5f3398f8733f90e2(iterable, 0);
}
function $c5a24bc478652b5f$export$5f3398f8733f90e2(iterable, index2) {
  if (index2 < 0)
    return void 0;
  let i2 = 0;
  for (let item of iterable) {
    if (i2 === index2)
      return item;
    i2++;
  }
}
function $c5a24bc478652b5f$export$7475b2c64539e4cf(iterable) {
  let lastItem = void 0;
  for (let value2 of iterable)
    lastItem = value2;
  return lastItem;
}
function $c5a24bc478652b5f$export$8c434b3a7a4dad6(collection, a2, b2) {
  if (a2.parentKey === b2.parentKey)
    return a2.index - b2.index;
  let aAncestors = [
    ...$c5a24bc478652b5f$var$getAncestors(collection, a2),
    a2
  ];
  let bAncestors = [
    ...$c5a24bc478652b5f$var$getAncestors(collection, b2),
    b2
  ];
  let firstNonMatchingAncestor = aAncestors.slice(0, bAncestors.length).findIndex((a3, i2) => a3 !== bAncestors[i2]);
  if (firstNonMatchingAncestor !== -1) {
    a2 = aAncestors[firstNonMatchingAncestor];
    b2 = bAncestors[firstNonMatchingAncestor];
    return a2.index - b2.index;
  }
  if (aAncestors.findIndex((node2) => node2 === b2) >= 0)
    return 1;
  else if (bAncestors.findIndex((node2) => node2 === a2) >= 0)
    return -1;
  return -1;
}
function $c5a24bc478652b5f$var$getAncestors(collection, node2) {
  let parents = [];
  let currNode = node2;
  while ((currNode === null || currNode === void 0 ? void 0 : currNode.parentKey) != null) {
    currNode = collection.getItem(currNode.parentKey);
    if (currNode)
      parents.unshift(currNode);
  }
  return parents;
}
const $453cc9f0df89c0a5$var$cache = /* @__PURE__ */ new WeakMap();
function $453cc9f0df89c0a5$export$77d5aafae4e095b2(collection) {
  let count = $453cc9f0df89c0a5$var$cache.get(collection);
  if (count != null)
    return count;
  let counter = 0;
  let countItems = (items) => {
    for (let item of items) {
      if (item.type === "section")
        countItems($c5a24bc478652b5f$export$1005530eda016c13(item, collection));
      else if (item.type === "item")
        counter++;
    }
  };
  countItems(collection);
  $453cc9f0df89c0a5$var$cache.set(collection, counter);
  return counter;
}
class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
  /**
  * The type of selection that is allowed in the collection.
  */
  get selectionMode() {
    return this.state.selectionMode;
  }
  /**
  * Whether the collection allows empty selection.
  */
  get disallowEmptySelection() {
    return this.state.disallowEmptySelection;
  }
  /**
  * The selection behavior for the collection.
  */
  get selectionBehavior() {
    return this.state.selectionBehavior;
  }
  /**
  * Sets the selection behavior for the collection.
  */
  setSelectionBehavior(selectionBehavior) {
    this.state.setSelectionBehavior(selectionBehavior);
  }
  /**
  * Whether the collection is currently focused.
  */
  get isFocused() {
    return this.state.isFocused;
  }
  /**
  * Sets whether the collection is focused.
  */
  setFocused(isFocused) {
    this.state.setFocused(isFocused);
  }
  /**
  * The current focused key in the collection.
  */
  get focusedKey() {
    return this.state.focusedKey;
  }
  /** Whether the first or last child of the focused key should receive focus. */
  get childFocusStrategy() {
    return this.state.childFocusStrategy;
  }
  /**
  * Sets the focused key.
  */
  setFocusedKey(key, childFocusStrategy) {
    if (key == null || this.collection.getItem(key))
      this.state.setFocusedKey(key, childFocusStrategy);
  }
  /**
  * The currently selected keys in the collection.
  */
  get selectedKeys() {
    return this.state.selectedKeys === "all" ? new Set(this.getSelectAllKeys()) : this.state.selectedKeys;
  }
  /**
  * The raw selection value for the collection.
  * Either 'all' for select all, or a set of keys.
  */
  get rawSelection() {
    return this.state.selectedKeys;
  }
  /**
  * Returns whether a key is selected.
  */
  isSelected(key) {
    if (this.state.selectionMode === "none")
      return false;
    let mappedKey = this.getKey(key);
    if (mappedKey == null)
      return false;
    return this.state.selectedKeys === "all" ? this.canSelectItem(mappedKey) : this.state.selectedKeys.has(mappedKey);
  }
  /**
  * Whether the selection is empty.
  */
  get isEmpty() {
    return this.state.selectedKeys !== "all" && this.state.selectedKeys.size === 0;
  }
  /**
  * Whether all items in the collection are selected.
  */
  get isSelectAll() {
    if (this.isEmpty)
      return false;
    if (this.state.selectedKeys === "all")
      return true;
    if (this._isSelectAll != null)
      return this._isSelectAll;
    let allKeys = this.getSelectAllKeys();
    let selectedKeys = this.state.selectedKeys;
    this._isSelectAll = allKeys.every((k2) => selectedKeys.has(k2));
    return this._isSelectAll;
  }
  get firstSelectedKey() {
    let first = null;
    for (let key of this.state.selectedKeys) {
      let item = this.collection.getItem(key);
      if (!first || item && $c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, item, first) < 0)
        first = item;
    }
    var _first_key;
    return (_first_key = first === null || first === void 0 ? void 0 : first.key) !== null && _first_key !== void 0 ? _first_key : null;
  }
  get lastSelectedKey() {
    let last = null;
    for (let key of this.state.selectedKeys) {
      let item = this.collection.getItem(key);
      if (!last || item && $c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, item, last) > 0)
        last = item;
    }
    var _last_key;
    return (_last_key = last === null || last === void 0 ? void 0 : last.key) !== null && _last_key !== void 0 ? _last_key : null;
  }
  get disabledKeys() {
    return this.state.disabledKeys;
  }
  get disabledBehavior() {
    return this.state.disabledBehavior;
  }
  /**
  * Extends the selection to the given key.
  */
  extendSelection(toKey2) {
    if (this.selectionMode === "none")
      return;
    if (this.selectionMode === "single") {
      this.replaceSelection(toKey2);
      return;
    }
    let mappedToKey = this.getKey(toKey2);
    if (mappedToKey == null)
      return;
    let selection;
    if (this.state.selectedKeys === "all")
      selection = new $e40ea825a81a3709$export$52baac22726c72bf([
        mappedToKey
      ], mappedToKey, mappedToKey);
    else {
      let selectedKeys = this.state.selectedKeys;
      var _selectedKeys_anchorKey;
      let anchorKey = (_selectedKeys_anchorKey = selectedKeys.anchorKey) !== null && _selectedKeys_anchorKey !== void 0 ? _selectedKeys_anchorKey : mappedToKey;
      selection = new $e40ea825a81a3709$export$52baac22726c72bf(selectedKeys, anchorKey, mappedToKey);
      var _selectedKeys_currentKey;
      for (let key of this.getKeyRange(anchorKey, (_selectedKeys_currentKey = selectedKeys.currentKey) !== null && _selectedKeys_currentKey !== void 0 ? _selectedKeys_currentKey : mappedToKey))
        selection.delete(key);
      for (let key of this.getKeyRange(mappedToKey, anchorKey))
        if (this.canSelectItem(key))
          selection.add(key);
    }
    this.state.setSelectedKeys(selection);
  }
  getKeyRange(from2, to2) {
    let fromItem = this.collection.getItem(from2);
    let toItem = this.collection.getItem(to2);
    if (fromItem && toItem) {
      if ($c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, fromItem, toItem) <= 0)
        return this.getKeyRangeInternal(from2, to2);
      return this.getKeyRangeInternal(to2, from2);
    }
    return [];
  }
  getKeyRangeInternal(from2, to2) {
    var _this_layoutDelegate;
    if ((_this_layoutDelegate = this.layoutDelegate) === null || _this_layoutDelegate === void 0 ? void 0 : _this_layoutDelegate.getKeyRange)
      return this.layoutDelegate.getKeyRange(from2, to2);
    let keys2 = [];
    let key = from2;
    while (key != null) {
      let item = this.collection.getItem(key);
      if (item && (item.type === "item" || item.type === "cell" && this.allowsCellSelection))
        keys2.push(key);
      if (key === to2)
        return keys2;
      key = this.collection.getKeyAfter(key);
    }
    return [];
  }
  getKey(key) {
    let item = this.collection.getItem(key);
    if (!item)
      return key;
    if (item.type === "cell" && this.allowsCellSelection)
      return key;
    while (item && item.type !== "item" && item.parentKey != null)
      item = this.collection.getItem(item.parentKey);
    if (!item || item.type !== "item")
      return null;
    return item.key;
  }
  /**
  * Toggles whether the given key is selected.
  */
  toggleSelection(key) {
    if (this.selectionMode === "none")
      return;
    if (this.selectionMode === "single" && !this.isSelected(key)) {
      this.replaceSelection(key);
      return;
    }
    let mappedKey = this.getKey(key);
    if (mappedKey == null)
      return;
    let keys2 = new $e40ea825a81a3709$export$52baac22726c72bf(this.state.selectedKeys === "all" ? this.getSelectAllKeys() : this.state.selectedKeys);
    if (keys2.has(mappedKey))
      keys2.delete(mappedKey);
    else if (this.canSelectItem(mappedKey)) {
      keys2.add(mappedKey);
      keys2.anchorKey = mappedKey;
      keys2.currentKey = mappedKey;
    }
    if (this.disallowEmptySelection && keys2.size === 0)
      return;
    this.state.setSelectedKeys(keys2);
  }
  /**
  * Replaces the selection with only the given key.
  */
  replaceSelection(key) {
    if (this.selectionMode === "none")
      return;
    let mappedKey = this.getKey(key);
    if (mappedKey == null)
      return;
    let selection = this.canSelectItem(mappedKey) ? new $e40ea825a81a3709$export$52baac22726c72bf([
      mappedKey
    ], mappedKey, mappedKey) : new $e40ea825a81a3709$export$52baac22726c72bf();
    this.state.setSelectedKeys(selection);
  }
  /**
  * Replaces the selection with the given keys.
  */
  setSelectedKeys(keys2) {
    if (this.selectionMode === "none")
      return;
    let selection = new $e40ea825a81a3709$export$52baac22726c72bf();
    for (let key of keys2) {
      let mappedKey = this.getKey(key);
      if (mappedKey != null) {
        selection.add(mappedKey);
        if (this.selectionMode === "single")
          break;
      }
    }
    this.state.setSelectedKeys(selection);
  }
  getSelectAllKeys() {
    let keys2 = [];
    let addKeys = (key) => {
      while (key != null) {
        if (this.canSelectItem(key)) {
          var _getFirstItem;
          let item = this.collection.getItem(key);
          if ((item === null || item === void 0 ? void 0 : item.type) === "item")
            keys2.push(key);
          var _getFirstItem_key;
          if ((item === null || item === void 0 ? void 0 : item.hasChildNodes) && (this.allowsCellSelection || item.type !== "item"))
            addKeys((_getFirstItem_key = (_getFirstItem = $c5a24bc478652b5f$export$fbdeaa6a76694f71($c5a24bc478652b5f$export$1005530eda016c13(item, this.collection))) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key) !== null && _getFirstItem_key !== void 0 ? _getFirstItem_key : null);
        }
        key = this.collection.getKeyAfter(key);
      }
    };
    addKeys(this.collection.getFirstKey());
    return keys2;
  }
  /**
  * Selects all items in the collection.
  */
  selectAll() {
    if (!this.isSelectAll && this.selectionMode === "multiple")
      this.state.setSelectedKeys("all");
  }
  /**
  * Removes all keys from the selection.
  */
  clearSelection() {
    if (!this.disallowEmptySelection && (this.state.selectedKeys === "all" || this.state.selectedKeys.size > 0))
      this.state.setSelectedKeys(new $e40ea825a81a3709$export$52baac22726c72bf());
  }
  /**
  * Toggles between select all and an empty selection.
  */
  toggleSelectAll() {
    if (this.isSelectAll)
      this.clearSelection();
    else
      this.selectAll();
  }
  select(key, e2) {
    if (this.selectionMode === "none")
      return;
    if (this.selectionMode === "single") {
      if (this.isSelected(key) && !this.disallowEmptySelection)
        this.toggleSelection(key);
      else
        this.replaceSelection(key);
    } else if (this.selectionBehavior === "toggle" || e2 && (e2.pointerType === "touch" || e2.pointerType === "virtual"))
      this.toggleSelection(key);
    else
      this.replaceSelection(key);
  }
  /**
  * Returns whether the current selection is equal to the given selection.
  */
  isSelectionEqual(selection) {
    if (selection === this.state.selectedKeys)
      return true;
    let selectedKeys = this.selectedKeys;
    if (selection.size !== selectedKeys.size)
      return false;
    for (let key of selection) {
      if (!selectedKeys.has(key))
        return false;
    }
    for (let key of selectedKeys) {
      if (!selection.has(key))
        return false;
    }
    return true;
  }
  canSelectItem(key) {
    var _item_props;
    if (this.state.selectionMode === "none" || this.state.disabledKeys.has(key))
      return false;
    let item = this.collection.getItem(key);
    if (!item || (item === null || item === void 0 ? void 0 : (_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.isDisabled) || item.type === "cell" && !this.allowsCellSelection)
      return false;
    return true;
  }
  isDisabled(key) {
    var _this_collection_getItem_props, _this_collection_getItem;
    return this.state.disabledBehavior === "all" && (this.state.disabledKeys.has(key) || !!((_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : (_this_collection_getItem_props = _this_collection_getItem.props) === null || _this_collection_getItem_props === void 0 ? void 0 : _this_collection_getItem_props.isDisabled));
  }
  isLink(key) {
    var _this_collection_getItem_props, _this_collection_getItem;
    return !!((_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : (_this_collection_getItem_props = _this_collection_getItem.props) === null || _this_collection_getItem_props === void 0 ? void 0 : _this_collection_getItem_props.href);
  }
  getItemProps(key) {
    var _this_collection_getItem;
    return (_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : _this_collection_getItem.props;
  }
  withCollection(collection) {
    return new $d496c0a20b6e58ec$export$6c8a5aaad13c9852(collection, this.state, {
      allowsCellSelection: this.allowsCellSelection,
      layoutDelegate: this.layoutDelegate || void 0
    });
  }
  constructor(collection, state, options) {
    this.collection = collection;
    this.state = state;
    var _options_allowsCellSelection;
    this.allowsCellSelection = (_options_allowsCellSelection = options === null || options === void 0 ? void 0 : options.allowsCellSelection) !== null && _options_allowsCellSelection !== void 0 ? _options_allowsCellSelection : false;
    this._isSelectAll = null;
    this.layoutDelegate = (options === null || options === void 0 ? void 0 : options.layoutDelegate) || null;
  }
}
function $875d6693e12af071$export$728d6ba534403756(props) {
  let { onExpandedChange } = props;
  let [expandedKeys, setExpandedKeys] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.expandedKeys ? new Set(props.expandedKeys) : void 0, props.defaultExpandedKeys ? new Set(props.defaultExpandedKeys) : /* @__PURE__ */ new Set(), onExpandedChange);
  let selectionState = $7af3f5b51489e0b5$export$253fe78d46329472(props);
  let disabledKeys = reactExports.useMemo(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
    props.disabledKeys
  ]);
  let tree = $7613b1592d41b092$export$6cd28814d92fa9c9(props, reactExports.useCallback((nodes) => new $05ca4cd7c4a5a999$export$863faf230ee2118a(nodes, {
    expandedKeys
  }), [
    expandedKeys
  ]), null);
  reactExports.useEffect(() => {
    if (selectionState.focusedKey != null && !tree.getItem(selectionState.focusedKey))
      selectionState.setFocusedKey(null);
  }, [
    tree,
    selectionState.focusedKey
  ]);
  let onToggle = (key) => {
    setExpandedKeys($875d6693e12af071$var$toggleKey(expandedKeys, key));
  };
  return {
    collection: tree,
    expandedKeys,
    disabledKeys,
    toggleKey: onToggle,
    setExpandedKeys,
    selectionManager: new $d496c0a20b6e58ec$export$6c8a5aaad13c9852(tree, selectionState)
  };
}
function $875d6693e12af071$var$toggleKey(set2, key) {
  let res = new Set(set2);
  if (res.has(key))
    res.delete(key);
  else
    res.add(key);
  return res;
}
function useAccordion(props) {
  var _a2;
  const globalContext = useProviderContext();
  const {
    ref,
    as: as2,
    className,
    items,
    variant,
    motionProps,
    expandedKeys,
    disabledKeys,
    selectedKeys,
    children: childrenProp,
    defaultExpandedKeys,
    selectionMode = "single",
    selectionBehavior = "toggle",
    keepContentMounted = false,
    disallowEmptySelection,
    defaultSelectedKeys,
    onExpandedChange,
    onSelectionChange,
    dividerProps = {},
    isCompact = false,
    isDisabled = false,
    showDivider = true,
    hideIndicator = false,
    disableAnimation = (_a2 = globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _a2 : false,
    disableIndicatorAnimation = false,
    itemClasses,
    ...otherProps
  } = props;
  const [focusedKey, setFocusedKey] = reactExports.useState(null);
  const Component2 = as2 || "div";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const classNames2 = reactExports.useMemo(
    () => accordion({
      variant,
      className
    }),
    [variant, className]
  );
  const children = reactExports.useMemo(() => {
    let treeChildren = [];
    React$5.Children.map(childrenProp, (child) => {
      var _a22;
      if (React$5.isValidElement(child) && typeof ((_a22 = child.props) == null ? void 0 : _a22.children) !== "string") {
        const clonedChild = React$5.cloneElement(child, {
          // @ts-ignore
          hasChildItems: false
        });
        treeChildren.push(clonedChild);
      } else {
        treeChildren.push(child);
      }
    });
    return treeChildren;
  }, [childrenProp]);
  const commonProps2 = {
    children,
    items
  };
  const expandableProps = {
    expandedKeys,
    defaultExpandedKeys,
    onExpandedChange
  };
  const treeProps = {
    disabledKeys,
    selectedKeys,
    selectionMode,
    selectionBehavior,
    disallowEmptySelection,
    defaultSelectedKeys: defaultSelectedKeys != null ? defaultSelectedKeys : defaultExpandedKeys,
    onSelectionChange,
    ...commonProps2,
    ...expandableProps
  };
  const state = $875d6693e12af071$export$728d6ba534403756(treeProps);
  state.selectionManager.setFocusedKey = (key) => {
    setFocusedKey(key);
  };
  const { accordionProps } = useReactAriaAccordion(
    {
      ...commonProps2,
      ...expandableProps
    },
    state,
    domRef
  );
  const values = reactExports.useMemo(
    () => ({
      state,
      focusedKey,
      motionProps,
      isCompact,
      isDisabled,
      hideIndicator,
      disableAnimation,
      keepContentMounted,
      disableIndicatorAnimation
    }),
    [
      focusedKey,
      isCompact,
      isDisabled,
      hideIndicator,
      selectedKeys,
      disableAnimation,
      keepContentMounted,
      state == null ? void 0 : state.expandedKeys.values,
      disableIndicatorAnimation,
      state.expandedKeys.size,
      state.disabledKeys.size,
      motionProps
    ]
  );
  const getBaseProps = reactExports.useCallback((props2 = {}) => {
    return {
      ref: domRef,
      className: classNames2,
      "data-orientation": "vertical",
      ...mergeProps$3(
        accordionProps,
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        }),
        props2
      )
    };
  }, []);
  const handleFocusChanged = reactExports.useCallback((isFocused, key) => {
    isFocused && setFocusedKey(key);
  }, []);
  return {
    Component: Component2,
    values,
    state,
    focusedKey,
    getBaseProps,
    isSplitted: variant === "splitted",
    classNames: classNames2,
    showDivider,
    dividerProps,
    disableAnimation,
    handleFocusChanged,
    itemClasses
  };
}
function useSeparator(props) {
  let domProps = filterDOMProps(props, {
    enabled: typeof props.elementType === "string"
  });
  let ariaOrientation;
  if (props.orientation === "vertical") {
    ariaOrientation = "vertical";
  }
  if (props.elementType !== "hr") {
    return {
      separatorProps: {
        ...domProps,
        role: "separator",
        "aria-orientation": ariaOrientation
      }
    };
  }
  return { separatorProps: domProps };
}
function useDivider(props) {
  const { as: as2, className, orientation, ...otherProps } = props;
  let Component2 = as2 || "hr";
  if (Component2 === "hr" && orientation === "vertical") {
    Component2 = "div";
  }
  const { separatorProps } = useSeparator({
    elementType: typeof Component2 === "string" ? Component2 : "hr",
    orientation
  });
  const styles2 = reactExports.useMemo(
    () => divider({
      orientation,
      className
    }),
    [orientation, className]
  );
  const getDividerProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: styles2,
      role: "separator",
      "data-orientation": orientation,
      ...separatorProps,
      ...otherProps,
      ...props2
    }),
    [styles2, orientation, separatorProps, otherProps]
  );
  return { Component: Component2, getDividerProps };
}
var Divider$1 = forwardRef((props, ref) => {
  const { Component: Component2, getDividerProps } = useDivider({ ...props });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ref, ...getDividerProps() });
});
Divider$1.displayName = "HeroUI.Divider";
var divider_default = Divider$1;
var AccordionGroup = forwardRef((props, ref) => {
  const {
    Component: Component2,
    values,
    state,
    isSplitted,
    showDivider,
    getBaseProps,
    disableAnimation,
    handleFocusChanged: handleFocusChangedProps,
    itemClasses,
    dividerProps
  } = useAccordion({
    ...props,
    ref
  });
  const handleFocusChanged = reactExports.useCallback(
    (isFocused, key) => handleFocusChangedProps(isFocused, key),
    [handleFocusChangedProps]
  );
  const content2 = reactExports.useMemo(() => {
    return [...state.collection].map((item, index2) => {
      const classNames2 = { ...itemClasses, ...item.props.classNames || {} };
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(reactExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          accordion_item_default,
          {
            item,
            variant: props.variant,
            onFocusChange: handleFocusChanged,
            ...values,
            ...item.props,
            classNames: classNames2
          }
        ),
        !item.props.hidden && !isSplitted && showDivider && index2 < state.collection.size - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { ...dividerProps })
      ] }, item.key);
    });
  }, [values, itemClasses, handleFocusChanged, isSplitted, showDivider, state.collection]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...getBaseProps(), children: disableAnimation ? content2 : /* @__PURE__ */ jsxRuntimeExports.jsx(LayoutGroup, { children: content2 }) });
});
AccordionGroup.displayName = "HeroUI.Accordion";
var accordion_default = AccordionGroup;
function $c1d7fb2ec91bae71$var$Item(props) {
  return null;
}
$c1d7fb2ec91bae71$var$Item.getCollectionNode = function* getCollectionNode(props, context) {
  let { childItems, title, children } = props;
  let rendered = props.title || props.children;
  let textValue = props.textValue || (typeof rendered === "string" ? rendered : "") || props["aria-label"] || "";
  if (!textValue && !(context === null || context === void 0 ? void 0 : context.suppressTextValueWarning) && false)
    ;
  yield {
    type: "item",
    props,
    rendered,
    textValue,
    "aria-label": props["aria-label"],
    hasChildNodes: $c1d7fb2ec91bae71$var$hasChildItems(props),
    *childNodes() {
      if (childItems)
        for (let child of childItems)
          yield {
            type: "item",
            value: child
          };
      else if (title) {
        let items = [];
        React$5.Children.forEach(children, (child) => {
          items.push({
            type: "item",
            element: child
          });
        });
        yield* items;
      }
    }
  };
};
function $c1d7fb2ec91bae71$var$hasChildItems(props) {
  if (props.hasChildItems != null)
    return props.hasChildItems;
  if (props.childItems)
    return true;
  if (props.title && React$5.Children.count(props.children) > 0)
    return true;
  return false;
}
let $c1d7fb2ec91bae71$export$6d08773d2e66f8f2 = $c1d7fb2ec91bae71$var$Item;
var getTransformOrigins = (placement) => {
  const origins = {
    top: {
      originY: 1
    },
    bottom: {
      originY: 0
    },
    left: {
      originX: 1
    },
    right: {
      originX: 0
    },
    "top-start": {
      originX: 0,
      originY: 1
    },
    "top-end": {
      originX: 1,
      originY: 1
    },
    "bottom-start": {
      originX: 0,
      originY: 0
    },
    "bottom-end": {
      originX: 1,
      originY: 0
    },
    "right-start": {
      originX: 0,
      originY: 0
    },
    "right-end": {
      originX: 0,
      originY: 1
    },
    "left-start": {
      originX: 1,
      originY: 0
    },
    "left-end": {
      originX: 1,
      originY: 1
    }
  };
  return (origins == null ? void 0 : origins[placement]) || {};
};
var toReactAriaPlacement = (placement) => {
  const mapPositions = {
    top: "top",
    bottom: "bottom",
    left: "left",
    right: "right",
    "top-start": "top start",
    "top-end": "top end",
    "bottom-start": "bottom start",
    "bottom-end": "bottom end",
    "left-start": "left top",
    "left-end": "left bottom",
    "right-start": "right top",
    "right-end": "right bottom"
  };
  return mapPositions[placement];
};
var getShouldUseAxisPlacement = (axisPlacement, overlayPlacement) => {
  if (overlayPlacement.includes("-")) {
    const [position2] = overlayPlacement.split("-");
    if (position2.includes(axisPlacement)) {
      return false;
    }
  }
  return true;
};
var getArrowPlacement = (dynamicPlacement, placement) => {
  if (placement.includes("-")) {
    const [, position2] = placement.split("-");
    return `${dynamicPlacement}-${position2}`;
  }
  return dynamicPlacement;
};
var refCountMap = /* @__PURE__ */ new WeakMap();
var observerStack = [];
function ariaHideOutside(targets, root2 = document.body) {
  let visibleNodes = new Set(targets);
  let hiddenNodes = /* @__PURE__ */ new Set();
  let walk = (root22) => {
    for (let element2 of root22.querySelectorAll(
      "[data-live-announcer], [data-react-aria-top-layer]"
    )) {
      visibleNodes.add(element2);
    }
    let acceptNode = (node2) => {
      if (visibleNodes.has(node2) || node2.parentElement && hiddenNodes.has(node2.parentElement) && node2.parentElement.getAttribute("role") !== "row") {
        return NodeFilter.FILTER_REJECT;
      }
      for (let target of visibleNodes) {
        if (node2.contains(target)) {
          return NodeFilter.FILTER_SKIP;
        }
      }
      return NodeFilter.FILTER_ACCEPT;
    };
    let walker = document.createTreeWalker(root22, NodeFilter.SHOW_ELEMENT, { acceptNode });
    let acceptRoot = acceptNode(root22);
    if (acceptRoot === NodeFilter.FILTER_ACCEPT) {
      hide(root22);
    }
    if (acceptRoot !== NodeFilter.FILTER_REJECT) {
      let node2 = walker.nextNode();
      while (node2 != null) {
        hide(node2);
        node2 = walker.nextNode();
      }
    }
  };
  let hide = (node2) => {
    var _a2;
    let refCount = (_a2 = refCountMap.get(node2)) != null ? _a2 : 0;
    if (node2.getAttribute("aria-hidden") === "true" && refCount === 0) {
      return;
    }
    if (refCount === 0) {
      node2.setAttribute("aria-hidden", "true");
    }
    hiddenNodes.add(node2);
    refCountMap.set(node2, refCount + 1);
  };
  if (observerStack.length) {
    observerStack[observerStack.length - 1].disconnect();
  }
  walk(root2);
  let observer = new MutationObserver((changes) => {
    for (let change of changes) {
      if (change.type !== "childList" || change.addedNodes.length === 0) {
        continue;
      }
      if (![...visibleNodes, ...hiddenNodes].some((node2) => node2.contains(change.target))) {
        for (let node2 of change.removedNodes) {
          if (node2 instanceof Element) {
            visibleNodes.delete(node2);
            hiddenNodes.delete(node2);
          }
        }
        for (let node2 of change.addedNodes) {
          if ((node2 instanceof HTMLElement || node2 instanceof SVGElement) && (node2.dataset.liveAnnouncer === "true" || node2.dataset.reactAriaTopLayer === "true")) {
            visibleNodes.add(node2);
          } else if (node2 instanceof Element) {
            walk(node2);
          }
        }
      }
    }
  });
  observer.observe(root2, { childList: true, subtree: true });
  let observerWrapper = {
    visibleNodes,
    hiddenNodes,
    observe() {
      observer.observe(root2, { childList: true, subtree: true });
    },
    disconnect() {
      observer.disconnect();
    }
  };
  observerStack.push(observerWrapper);
  return () => {
    observer.disconnect();
    for (let node2 of hiddenNodes) {
      let count = refCountMap.get(node2);
      if (count == null) {
        continue;
      }
      if (count === 1) {
        node2.removeAttribute("aria-hidden");
        refCountMap.delete(node2);
      } else {
        refCountMap.set(node2, count - 1);
      }
    }
    if (observerWrapper === observerStack[observerStack.length - 1]) {
      observerStack.pop();
      if (observerStack.length) {
        observerStack[observerStack.length - 1].observe();
      }
    } else {
      observerStack.splice(observerStack.indexOf(observerWrapper), 1);
    }
  };
}
function keepVisible(element2) {
  let observer = observerStack[observerStack.length - 1];
  if (observer && !observer.visibleNodes.has(element2)) {
    observer.visibleNodes.add(element2);
    return () => {
      observer.visibleNodes.delete(element2);
    };
  }
}
var AccordionItemBase = $c1d7fb2ec91bae71$export$6d08773d2e66f8f2;
var accordion_item_base_default = AccordionItemBase;
var useSafeLayoutEffect = Boolean(globalThis == null ? void 0 : globalThis.document) ? reactExports.useLayoutEffect : reactExports.useEffect;
function useImage$2(props = {}) {
  const {
    onLoad,
    onError,
    ignoreFallback,
    src,
    crossOrigin,
    srcSet,
    sizes,
    loading,
    shouldBypassImageLoad = false
  } = props;
  const isHydrated = useIsHydrated();
  const imageRef = reactExports.useRef(isHydrated ? new Image() : null);
  const [status, setStatus] = reactExports.useState("pending");
  reactExports.useEffect(() => {
    if (!imageRef.current)
      return;
    imageRef.current.onload = (event) => {
      flush();
      setStatus("loaded");
      onLoad == null ? void 0 : onLoad(event);
    };
    imageRef.current.onerror = (error2) => {
      flush();
      setStatus("failed");
      onError == null ? void 0 : onError(error2);
    };
  }, [imageRef.current]);
  const flush = () => {
    if (imageRef.current) {
      imageRef.current.onload = null;
      imageRef.current.onerror = null;
      imageRef.current = null;
    }
  };
  const load = reactExports.useCallback(() => {
    if (!src)
      return "pending";
    if (ignoreFallback || shouldBypassImageLoad)
      return "loaded";
    const img = new Image();
    img.src = src;
    if (crossOrigin)
      img.crossOrigin = crossOrigin;
    if (srcSet)
      img.srcset = srcSet;
    if (sizes)
      img.sizes = sizes;
    if (loading)
      img.loading = loading;
    imageRef.current = img;
    if (img.complete && img.naturalWidth) {
      return "loaded";
    }
    return "loading";
  }, [src, crossOrigin, srcSet, sizes, onLoad, onError, loading, shouldBypassImageLoad]);
  useSafeLayoutEffect(() => {
    if (isHydrated) {
      setStatus(load());
    }
  }, [isHydrated, load]);
  return ignoreFallback ? "loaded" : status;
}
function useBadge(originalProps) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const disableAnimation = (_b2 = (_a2 = originalProps == null ? void 0 : originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const [props, variantProps2] = mapPropsVariants(originalProps, badge.variantKeys);
  const { as: as2, children, className, content: content2, classNames: classNames2, ...otherProps } = props;
  const Component2 = as2 || "span";
  const isOneChar = reactExports.useMemo(
    () => {
      var _a22;
      return ((_a22 = String(content2)) == null ? void 0 : _a22.length) === 1 || (originalProps == null ? void 0 : originalProps.isOneChar);
    },
    [content2, originalProps == null ? void 0 : originalProps.isOneChar]
  );
  const isDot = reactExports.useMemo(() => {
    var _a22;
    return ((_a22 = String(content2)) == null ? void 0 : _a22.length) === 0;
  }, [content2]);
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.badge, className);
  const slots = reactExports.useMemo(
    () => badge({
      ...variantProps2,
      showOutline: !!(originalProps == null ? void 0 : originalProps.disableOutline) ? !(originalProps == null ? void 0 : originalProps.disableOutline) : originalProps == null ? void 0 : originalProps.showOutline,
      isOneChar,
      isDot
    }),
    [objectToDeps(variantProps2), isOneChar, isDot]
  );
  const getBadgeProps = () => {
    return {
      className: slots.badge({ class: baseStyles }),
      "data-invisible": originalProps.isInvisible,
      ...otherProps
    };
  };
  return {
    Component: Component2,
    children,
    content: content2,
    slots,
    classNames: classNames2,
    disableAnimation,
    isInvisible: originalProps == null ? void 0 : originalProps.isInvisible,
    getBadgeProps
  };
}
var Badge$1 = forwardRef((props, ref) => {
  const { Component: Component2, children, content: content2, slots, classNames: classNames2, getBadgeProps } = useBadge({
    ...props
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: slots.base({ class: classNames2 == null ? void 0 : classNames2.base }), children: [
    children,
    /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ref, ...getBadgeProps(), children: content2 })
  ] });
});
Badge$1.displayName = "HeroUI.Badge";
var badge_default = Badge$1;
function useButtonGroup(originalProps) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, buttonGroup.variantKeys);
  const {
    ref,
    as: as2,
    children,
    color: color2 = "default",
    size: size2 = "md",
    variant = "solid",
    radius,
    isDisabled = false,
    isIconOnly = false,
    disableRipple = (_a2 = globalContext == null ? void 0 : globalContext.disableRipple) != null ? _a2 : false,
    disableAnimation = (_b2 = globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false,
    className,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const classNames2 = reactExports.useMemo(
    () => buttonGroup({
      ...variantProps2,
      className
    }),
    [objectToDeps(variantProps2), className]
  );
  const context = reactExports.useMemo(
    () => ({
      size: size2,
      color: color2,
      variant,
      radius,
      isIconOnly,
      isDisabled,
      disableAnimation,
      disableRipple,
      fullWidth: !!(originalProps == null ? void 0 : originalProps.fullWidth)
    }),
    [
      size2,
      color2,
      variant,
      radius,
      isDisabled,
      isIconOnly,
      disableAnimation,
      disableRipple,
      originalProps == null ? void 0 : originalProps.fullWidth
    ]
  );
  const getButtonGroupProps = reactExports.useCallback(
    () => ({
      role: "group",
      ...otherProps
    }),
    [otherProps]
  );
  return {
    Component: Component2,
    children,
    domRef,
    context,
    classNames: classNames2,
    getButtonGroupProps
  };
}
var [ButtonGroupProvider$1, useButtonGroupContext$1] = createContext2({
  name: "ButtonGroupContext",
  strict: false
});
var ButtonGroup = forwardRef((props, ref) => {
  const { Component: Component2, domRef, context, children, classNames: classNames2, getButtonGroupProps } = useButtonGroup({
    ...props,
    ref
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ButtonGroupProvider$1, { value: context, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ref: domRef, className: classNames2, ...getButtonGroupProps(), children }) });
});
ButtonGroup.displayName = "HeroUI.ButtonGroup";
var button_group_default = ButtonGroup;
let $bdb11010cef70236$export$d41a04c74483c6ef$8 = /* @__PURE__ */ new Map();
if (typeof FinalizationRegistry !== "undefined")
  new FinalizationRegistry((heldValue) => {
    $bdb11010cef70236$export$d41a04c74483c6ef$8.delete(heldValue);
  });
function $bdb11010cef70236$export$cd8c9cb68f842629$8(idA, idB) {
  if (idA === idB)
    return idA;
  let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef$8.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef$8.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function $ff5963eb1fccf552$export$e08e3b67e392101e$8(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks)
      if (typeof callback2 === "function")
        callback2(...args);
  };
}
function $3ef42575df84b30b$export$9d1611c77c2fe928$8(...args) {
  let result = {
    ...args[0]
  };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90)
        result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e$8(a2, b2);
      else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string")
        result[key] = clsx$3(a2, b2);
      else if (key === "id" && a2 && b2)
        result.id = $bdb11010cef70236$export$cd8c9cb68f842629$8(a2, b2);
      else
        result[key] = b2 !== void 0 ? b2 : a2;
    }
  }
  return result;
}
const $65484d02dcb7eb3e$var$DOMPropNames$3 = /* @__PURE__ */ new Set([
  "id"
]);
const $65484d02dcb7eb3e$var$labelablePropNames$3 = /* @__PURE__ */ new Set([
  "aria-label",
  "aria-labelledby",
  "aria-describedby",
  "aria-details"
]);
const $65484d02dcb7eb3e$var$linkPropNames$3 = /* @__PURE__ */ new Set([
  "href",
  "hrefLang",
  "target",
  "rel",
  "download",
  "ping",
  "referrerPolicy"
]);
const $65484d02dcb7eb3e$var$propRe$3 = /^(data-.*)$/;
function $65484d02dcb7eb3e$export$457c3d6518dd4c6f$3(props, opts2 = {}) {
  let { labelable, isLink, propNames } = opts2;
  let filteredProps = {};
  for (const prop in props)
    if (Object.prototype.hasOwnProperty.call(props, prop) && ($65484d02dcb7eb3e$var$DOMPropNames$3.has(prop) || labelable && $65484d02dcb7eb3e$var$labelablePropNames$3.has(prop) || isLink && $65484d02dcb7eb3e$var$linkPropNames$3.has(prop) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $65484d02dcb7eb3e$var$propRe$3.test(prop)))
      filteredProps[prop] = props[prop];
  return filteredProps;
}
const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$4 = typeof document !== "undefined" ? React$5.useLayoutEffect : () => {
};
var $8ae05eaa5c114e9c$var$_React_useInsertionEffect$3;
const $8ae05eaa5c114e9c$var$useEarlyEffect$3 = ($8ae05eaa5c114e9c$var$_React_useInsertionEffect$3 = React$5["useInsertionEffect"]) !== null && $8ae05eaa5c114e9c$var$_React_useInsertionEffect$3 !== void 0 ? $8ae05eaa5c114e9c$var$_React_useInsertionEffect$3 : $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$4;
function $8ae05eaa5c114e9c$export$7f54fc3180508a52$3(fn) {
  const ref = reactExports.useRef(null);
  $8ae05eaa5c114e9c$var$useEarlyEffect$3(() => {
    ref.current = fn;
  }, [
    fn
  ]);
  return reactExports.useCallback((...args) => {
    const f2 = ref.current;
    return f2 === null || f2 === void 0 ? void 0 : f2(...args);
  }, []);
}
let $bdb11010cef70236$export$d41a04c74483c6ef$7 = /* @__PURE__ */ new Map();
if (typeof FinalizationRegistry !== "undefined")
  new FinalizationRegistry((heldValue) => {
    $bdb11010cef70236$export$d41a04c74483c6ef$7.delete(heldValue);
  });
function $bdb11010cef70236$export$cd8c9cb68f842629$7(idA, idB) {
  if (idA === idB)
    return idA;
  let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef$7.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef$7.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function $ff5963eb1fccf552$export$e08e3b67e392101e$7(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks)
      if (typeof callback2 === "function")
        callback2(...args);
  };
}
const $431fbd86ca7dc216$export$b204af158042fbac$3 = (el2) => {
  var _el_ownerDocument;
  return (_el_ownerDocument = el2 === null || el2 === void 0 ? void 0 : el2.ownerDocument) !== null && _el_ownerDocument !== void 0 ? _el_ownerDocument : document;
};
const $431fbd86ca7dc216$export$f21a1ffae260145a$3 = (el2) => {
  if (el2 && "window" in el2 && el2.window === el2)
    return el2;
  const doc = $431fbd86ca7dc216$export$b204af158042fbac$3(el2);
  return doc.defaultView || window;
};
function $431fbd86ca7dc216$var$isNode$2(value2) {
  return value2 !== null && typeof value2 === "object" && "nodeType" in value2 && typeof value2.nodeType === "number";
}
function $431fbd86ca7dc216$export$af51f0f06c0f328a$2(node2) {
  return $431fbd86ca7dc216$var$isNode$2(node2) && node2.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in node2;
}
function $d4ee10de306f2510$export$4282f70798064fe0$2(node2, otherNode) {
  if (!$f4e2df6bd15f8569$export$98658e8c59125e6a())
    return otherNode && node2 ? node2.contains(otherNode) : false;
  if (!node2 || !otherNode)
    return false;
  let currentNode = otherNode;
  while (currentNode !== null) {
    if (currentNode === node2)
      return true;
    if (currentNode.tagName === "SLOT" && currentNode.assignedSlot)
      currentNode = currentNode.assignedSlot.parentNode;
    else if ($431fbd86ca7dc216$export$af51f0f06c0f328a$2(currentNode))
      currentNode = currentNode.host;
    else
      currentNode = currentNode.parentNode;
  }
  return false;
}
function $d4ee10de306f2510$export$e58f029f0fbfdb29$2(event) {
  if ($f4e2df6bd15f8569$export$98658e8c59125e6a() && event.target.shadowRoot) {
    if (event.composedPath)
      return event.composedPath()[0];
  }
  return event.target;
}
function $3ef42575df84b30b$export$9d1611c77c2fe928$7(...args) {
  let result = {
    ...args[0]
  };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90)
        result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e$7(a2, b2);
      else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string")
        result[key] = clsx$3(a2, b2);
      else if (key === "id" && a2 && b2)
        result.id = $bdb11010cef70236$export$cd8c9cb68f842629$7(a2, b2);
      else
        result[key] = b2 !== void 0 ? b2 : a2;
    }
  }
  return result;
}
function $7215afc6de606d6b$export$de79e2c695e052f3$4(element2) {
  if ($7215afc6de606d6b$var$supportsPreventScroll$4())
    element2.focus({
      preventScroll: true
    });
  else {
    let scrollableElements = $7215afc6de606d6b$var$getScrollableElements$4(element2);
    element2.focus();
    $7215afc6de606d6b$var$restoreScrollPosition$4(scrollableElements);
  }
}
let $7215afc6de606d6b$var$supportsPreventScrollCached$4 = null;
function $7215afc6de606d6b$var$supportsPreventScroll$4() {
  if ($7215afc6de606d6b$var$supportsPreventScrollCached$4 == null) {
    $7215afc6de606d6b$var$supportsPreventScrollCached$4 = false;
    try {
      let focusElem = document.createElement("div");
      focusElem.focus({
        get preventScroll() {
          $7215afc6de606d6b$var$supportsPreventScrollCached$4 = true;
          return true;
        }
      });
    } catch {
    }
  }
  return $7215afc6de606d6b$var$supportsPreventScrollCached$4;
}
function $7215afc6de606d6b$var$getScrollableElements$4(element2) {
  let parent = element2.parentNode;
  let scrollableElements = [];
  let rootScrollingElement = document.scrollingElement || document.documentElement;
  while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
    if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth)
      scrollableElements.push({
        element: parent,
        scrollTop: parent.scrollTop,
        scrollLeft: parent.scrollLeft
      });
    parent = parent.parentNode;
  }
  if (rootScrollingElement instanceof HTMLElement)
    scrollableElements.push({
      element: rootScrollingElement,
      scrollTop: rootScrollingElement.scrollTop,
      scrollLeft: rootScrollingElement.scrollLeft
    });
  return scrollableElements;
}
function $7215afc6de606d6b$var$restoreScrollPosition$4(scrollableElements) {
  for (let { element: element2, scrollTop, scrollLeft } of scrollableElements) {
    element2.scrollTop = scrollTop;
    element2.scrollLeft = scrollLeft;
  }
}
function $c87311424ea30a05$var$testUserAgent$5(re2) {
  var _window_navigator_userAgentData;
  if (typeof window === "undefined" || window.navigator == null)
    return false;
  let brands = (_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands;
  return Array.isArray(brands) && brands.some((brand) => re2.test(brand.brand)) || re2.test(window.navigator.userAgent);
}
function $c87311424ea30a05$var$testPlatform$5(re2) {
  var _window_navigator_userAgentData;
  return typeof window !== "undefined" && window.navigator != null ? re2.test(((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
}
function $c87311424ea30a05$var$cached$5(fn) {
  let res = null;
  return () => {
    if (res == null)
      res = fn();
    return res;
  };
}
const $c87311424ea30a05$export$9ac100e40613ea10$5 = $c87311424ea30a05$var$cached$5(function() {
  return $c87311424ea30a05$var$testPlatform$5(/^Mac/i);
});
const $c87311424ea30a05$export$186c6964ca17d99$2 = $c87311424ea30a05$var$cached$5(function() {
  return $c87311424ea30a05$var$testPlatform$5(/^iPhone/i);
});
const $c87311424ea30a05$export$7bef049ce92e4224$4 = $c87311424ea30a05$var$cached$5(function() {
  return $c87311424ea30a05$var$testPlatform$5(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
  $c87311424ea30a05$export$9ac100e40613ea10$5() && navigator.maxTouchPoints > 1;
});
const $c87311424ea30a05$export$fedb369cb70207f1$2 = $c87311424ea30a05$var$cached$5(function() {
  return $c87311424ea30a05$export$186c6964ca17d99$2() || $c87311424ea30a05$export$7bef049ce92e4224$4();
});
const $c87311424ea30a05$export$78551043582a6a98$4 = $c87311424ea30a05$var$cached$5(function() {
  return $c87311424ea30a05$var$testUserAgent$5(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e$4();
});
const $c87311424ea30a05$export$6446a186d09e379e$4 = $c87311424ea30a05$var$cached$5(function() {
  return $c87311424ea30a05$var$testUserAgent$5(/Chrome/i);
});
const $c87311424ea30a05$export$a11b0059900ceec8$3 = $c87311424ea30a05$var$cached$5(function() {
  return $c87311424ea30a05$var$testUserAgent$5(/Android/i);
});
const $c87311424ea30a05$export$b7d78993b74f766d$4 = $c87311424ea30a05$var$cached$5(function() {
  return $c87311424ea30a05$var$testUserAgent$5(/Firefox/i);
});
function $ea8dcbcb9ea1b556$export$95185d699e05d4d7$4(target, modifiers, setOpening = true) {
  var _window_event_type, _window_event;
  let { metaKey, ctrlKey, altKey, shiftKey } = modifiers;
  if ($c87311424ea30a05$export$b7d78993b74f766d$4() && ((_window_event = window.event) === null || _window_event === void 0 ? void 0 : (_window_event_type = _window_event.type) === null || _window_event_type === void 0 ? void 0 : _window_event_type.startsWith("key")) && target.target === "_blank") {
    if ($c87311424ea30a05$export$9ac100e40613ea10$5())
      metaKey = true;
    else
      ctrlKey = true;
  }
  let event = $c87311424ea30a05$export$78551043582a6a98$4() && $c87311424ea30a05$export$9ac100e40613ea10$5() && !$c87311424ea30a05$export$7bef049ce92e4224$4() && true ? new KeyboardEvent("keydown", {
    keyIdentifier: "Enter",
    metaKey,
    ctrlKey,
    altKey,
    shiftKey
  }) : new MouseEvent("click", {
    metaKey,
    ctrlKey,
    altKey,
    shiftKey,
    bubbles: true,
    cancelable: true
  });
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$4.isOpening = setOpening;
  $7215afc6de606d6b$export$de79e2c695e052f3$4(target);
  target.dispatchEvent(event);
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$4.isOpening = false;
}
$ea8dcbcb9ea1b556$export$95185d699e05d4d7$4.isOpening = false;
let $bbed8b41f857bcc0$var$transitionsByElement$2 = /* @__PURE__ */ new Map();
let $bbed8b41f857bcc0$var$transitionCallbacks$2 = /* @__PURE__ */ new Set();
function $bbed8b41f857bcc0$var$setupGlobalEvents$2() {
  if (typeof window === "undefined")
    return;
  function isTransitionEvent(event) {
    return "propertyName" in event;
  }
  let onTransitionStart = (e2) => {
    if (!isTransitionEvent(e2) || !e2.target)
      return;
    let transitions = $bbed8b41f857bcc0$var$transitionsByElement$2.get(e2.target);
    if (!transitions) {
      transitions = /* @__PURE__ */ new Set();
      $bbed8b41f857bcc0$var$transitionsByElement$2.set(e2.target, transitions);
      e2.target.addEventListener("transitioncancel", onTransitionEnd, {
        once: true
      });
    }
    transitions.add(e2.propertyName);
  };
  let onTransitionEnd = (e2) => {
    if (!isTransitionEvent(e2) || !e2.target)
      return;
    let properties2 = $bbed8b41f857bcc0$var$transitionsByElement$2.get(e2.target);
    if (!properties2)
      return;
    properties2.delete(e2.propertyName);
    if (properties2.size === 0) {
      e2.target.removeEventListener("transitioncancel", onTransitionEnd);
      $bbed8b41f857bcc0$var$transitionsByElement$2.delete(e2.target);
    }
    if ($bbed8b41f857bcc0$var$transitionsByElement$2.size === 0) {
      for (let cb2 of $bbed8b41f857bcc0$var$transitionCallbacks$2)
        cb2();
      $bbed8b41f857bcc0$var$transitionCallbacks$2.clear();
    }
  };
  document.body.addEventListener("transitionrun", onTransitionStart);
  document.body.addEventListener("transitionend", onTransitionEnd);
}
if (typeof document !== "undefined") {
  if (document.readyState !== "loading")
    $bbed8b41f857bcc0$var$setupGlobalEvents$2();
  else
    document.addEventListener("DOMContentLoaded", $bbed8b41f857bcc0$var$setupGlobalEvents$2);
}
function $bbed8b41f857bcc0$var$cleanupDetachedElements$2() {
  for (const [eventTarget] of $bbed8b41f857bcc0$var$transitionsByElement$2)
    if ("isConnected" in eventTarget && !eventTarget.isConnected)
      $bbed8b41f857bcc0$var$transitionsByElement$2.delete(eventTarget);
}
function $bbed8b41f857bcc0$export$24490316f764c430$2(fn) {
  requestAnimationFrame(() => {
    $bbed8b41f857bcc0$var$cleanupDetachedElements$2();
    if ($bbed8b41f857bcc0$var$transitionsByElement$2.size === 0)
      fn();
    else
      $bbed8b41f857bcc0$var$transitionCallbacks$2.add(fn);
  });
}
function $03deb23ff14920c4$export$4eaf04e54aa8eed6$2() {
  let globalListeners = reactExports.useRef(/* @__PURE__ */ new Map());
  let addGlobalListener = reactExports.useCallback((eventTarget, type4, listener, options) => {
    let fn = (options === null || options === void 0 ? void 0 : options.once) ? (...args) => {
      globalListeners.current.delete(listener);
      listener(...args);
    } : listener;
    globalListeners.current.set(listener, {
      type: type4,
      eventTarget,
      fn,
      options
    });
    eventTarget.addEventListener(type4, fn, options);
  }, []);
  let removeGlobalListener = reactExports.useCallback((eventTarget, type4, listener, options) => {
    var _globalListeners_current_get;
    let fn = ((_globalListeners_current_get = globalListeners.current.get(listener)) === null || _globalListeners_current_get === void 0 ? void 0 : _globalListeners_current_get.fn) || listener;
    eventTarget.removeEventListener(type4, fn, options);
    globalListeners.current.delete(listener);
  }, []);
  let removeAllGlobalListeners = reactExports.useCallback(() => {
    globalListeners.current.forEach((value2, key) => {
      removeGlobalListener(value2.eventTarget, value2.type, key, value2.options);
    });
  }, [
    removeGlobalListener
  ]);
  reactExports.useEffect(() => {
    return removeAllGlobalListeners;
  }, [
    removeAllGlobalListeners
  ]);
  return {
    addGlobalListener,
    removeGlobalListener,
    removeAllGlobalListeners
  };
}
function $e7801be82b4b2a53$export$4debdb1a3f0fa79e$2(context, ref) {
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$4(() => {
    if (context && context.ref && ref) {
      context.ref.current = ref.current;
      return () => {
        if (context.ref)
          context.ref.current = null;
      };
    }
  });
}
function $6a7db85432448f7f$export$60278871457622de$3(event) {
  if (event.mozInputSource === 0 && event.isTrusted)
    return true;
  if ($c87311424ea30a05$export$a11b0059900ceec8$3() && event.pointerType)
    return event.type === "click" && event.buttons === 1;
  return event.detail === 0 && !event.pointerType;
}
function $6a7db85432448f7f$export$29bf1b5f2c56cf63$2(event) {
  return !$c87311424ea30a05$export$a11b0059900ceec8$3() && event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
}
const $7d2416ea0959daaa$var$supportsCheckVisibility$2 = typeof Element !== "undefined" && "checkVisibility" in Element.prototype;
function $7d2416ea0959daaa$var$isStyleVisible$2(element2) {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$3(element2);
  if (!(element2 instanceof windowObject.HTMLElement) && !(element2 instanceof windowObject.SVGElement))
    return false;
  let { display, visibility } = element2.style;
  let isVisible2 = display !== "none" && visibility !== "hidden" && visibility !== "collapse";
  if (isVisible2) {
    const { getComputedStyle: getComputedStyle2 } = element2.ownerDocument.defaultView;
    let { display: computedDisplay, visibility: computedVisibility } = getComputedStyle2(element2);
    isVisible2 = computedDisplay !== "none" && computedVisibility !== "hidden" && computedVisibility !== "collapse";
  }
  return isVisible2;
}
function $7d2416ea0959daaa$var$isAttributeVisible$2(element2, childElement) {
  return !element2.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking.
  !element2.hasAttribute("data-react-aria-prevent-focus") && (element2.nodeName === "DETAILS" && childElement && childElement.nodeName !== "SUMMARY" ? element2.hasAttribute("open") : true);
}
function $7d2416ea0959daaa$export$e989c0fffaa6b27a$2(element2, childElement) {
  if ($7d2416ea0959daaa$var$supportsCheckVisibility$2)
    return element2.checkVisibility();
  return element2.nodeName !== "#comment" && $7d2416ea0959daaa$var$isStyleVisible$2(element2) && $7d2416ea0959daaa$var$isAttributeVisible$2(element2, childElement) && (!element2.parentElement || $7d2416ea0959daaa$export$e989c0fffaa6b27a$2(element2.parentElement, element2));
}
const $b4b717babfbb907b$var$focusableElements$2 = [
  "input:not([disabled]):not([type=hidden])",
  "select:not([disabled])",
  "textarea:not([disabled])",
  "button:not([disabled])",
  "a[href]",
  "area[href]",
  "summary",
  "iframe",
  "object",
  "embed",
  "audio[controls]",
  "video[controls]",
  '[contenteditable]:not([contenteditable^="false"])',
  "permission"
];
const $b4b717babfbb907b$var$FOCUSABLE_ELEMENT_SELECTOR$2 = $b4b717babfbb907b$var$focusableElements$2.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
$b4b717babfbb907b$var$focusableElements$2.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
function $b4b717babfbb907b$export$4c063cf1350e6fed$2(element2) {
  return element2.matches($b4b717babfbb907b$var$FOCUSABLE_ELEMENT_SELECTOR$2) && $7d2416ea0959daaa$export$e989c0fffaa6b27a$2(element2) && !$b4b717babfbb907b$var$isInert$2(element2);
}
function $b4b717babfbb907b$var$isInert$2(element2) {
  let node2 = element2;
  while (node2 != null) {
    if (node2 instanceof node2.ownerDocument.defaultView.HTMLElement && node2.inert)
      return true;
    node2 = node2.parentElement;
  }
  return false;
}
function $8a9cb279dc87e130$export$525bc4921d56d4a$b(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$a(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$cabe61c495ee3649$9(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$2(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$3(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$4(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$4(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$9 = "default";
let $14c0b72509d70225$var$savedUserSelect$9 = "";
let $14c0b72509d70225$var$modifiedElementMap$9 = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$9(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$2()) {
    if ($14c0b72509d70225$var$state$9 === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$3(target);
      $14c0b72509d70225$var$savedUserSelect$9 = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$9 = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$9.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$9(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$2()) {
    if ($14c0b72509d70225$var$state$9 !== "disabled")
      return;
    $14c0b72509d70225$var$state$9 = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$2(() => {
        if ($14c0b72509d70225$var$state$9 === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$3(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$9 || "";
          $14c0b72509d70225$var$savedUserSelect$9 = "";
          $14c0b72509d70225$var$state$9 = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$9.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$9.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$9.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$9 = React$5.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$9.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext$9(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$9);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$7(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$2(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$9 = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$9 = class $f6c31cce2adf654f$var$PressEvent3 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$9, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$9);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$9, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$9, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$9 = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$9 = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$9 = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$9(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$9(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$2();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$3((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$9("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$3((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$9("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$9("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$3((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$9("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$3((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$9(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$9(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$3((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$3((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$3((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$a(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$b(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$9(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$2(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$9($d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$9(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$2(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$9(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$3(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$7(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$5())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$2(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$4.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$3(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$9(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$9(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$9(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$9($d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$2(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$9(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$9(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$2(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$9]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$9] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$4(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$2(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$2(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$9(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$3(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$3(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$2(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$9(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$2(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$9(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$9(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$2(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$4(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$2(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$3(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$9))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$9;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$9}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$9((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$7(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$9]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$9(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$9(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$3(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$9(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$3(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$9(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$9(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$9(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$9(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$9(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$9(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$9(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$9 = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$9(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$9.has(target.type);
}
function useAriaButton$1(props, ref) {
  let {
    elementType = "button",
    isDisabled,
    onPress,
    onPressStart,
    onPressEnd,
    onPressUp,
    onPressChange,
    // @ts-ignore - undocumented
    preventFocusOnPress,
    // @ts-ignore - undocumented
    allowFocusWhenDisabled,
    onClick,
    href,
    target,
    rel,
    type: type4 = "button",
    allowTextSelectionOnPress
  } = props;
  let additionalProps;
  if (elementType === "button") {
    additionalProps = {
      type: type4,
      disabled: isDisabled
    };
  } else {
    additionalProps = {
      role: "button",
      href: elementType === "a" && !isDisabled ? href : void 0,
      target: elementType === "a" ? target : void 0,
      type: elementType === "input" ? type4 : void 0,
      disabled: elementType === "input" ? isDisabled : void 0,
      "aria-disabled": !isDisabled || elementType === "input" ? void 0 : isDisabled,
      rel: elementType === "a" ? rel : void 0
    };
  }
  let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$9({
    onClick,
    onPressStart,
    onPressEnd,
    onPressUp,
    onPressChange,
    onPress,
    isDisabled,
    preventFocusOnPress,
    allowTextSelectionOnPress,
    ref
  });
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2(props, ref);
  if (allowFocusWhenDisabled) {
    focusableProps.tabIndex = isDisabled ? -1 : focusableProps.tabIndex;
  }
  let buttonProps = $3ef42575df84b30b$export$9d1611c77c2fe928$8(
    focusableProps,
    pressProps,
    $65484d02dcb7eb3e$export$457c3d6518dd4c6f$3(props, { labelable: true })
  );
  return {
    isPressed,
    // Used to indicate press state for visual
    buttonProps: $3ef42575df84b30b$export$9d1611c77c2fe928$8(additionalProps, buttonProps, {
      "aria-haspopup": props["aria-haspopup"],
      "aria-expanded": props["aria-expanded"],
      "aria-controls": props["aria-controls"],
      "aria-pressed": props["aria-pressed"],
      "aria-current": props["aria-current"]
    })
  };
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$f = false;
let $6179b936705e76d3$var$hoverCount$f = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$f() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$f = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$f = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$f(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$f();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$f() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$f);
  $6179b936705e76d3$var$hoverCount$f++;
  return () => {
    $6179b936705e76d3$var$hoverCount$f--;
    if ($6179b936705e76d3$var$hoverCount$f > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$f);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$f(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$f, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$f && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
var domAnimation$6 = () => __vitePreload(() => import("./index-kYRJvtWR.js"), true ? __vite__mapDeps([]) : void 0).then((res) => res.default);
var Ripple$1 = (props) => {
  const { ripples = [], motionProps, color: color2 = "currentColor", style: style2, onClear } = props;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: ripples.map((ripple) => {
    const duration2 = clamp$2(0.01 * ripple.size, 0.2, ripple.size > 100 ? 0.75 : 0.5);
    return /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$6, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { mode: "popLayout", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      m$3.span,
      {
        animate: { transform: "scale(2)", opacity: 0 },
        className: "heroui-ripple",
        exit: { opacity: 0 },
        initial: { transform: "scale(0)", opacity: 0.35 },
        style: {
          position: "absolute",
          backgroundColor: color2,
          borderRadius: "100%",
          transformOrigin: "center",
          pointerEvents: "none",
          overflow: "hidden",
          inset: 0,
          zIndex: 0,
          top: ripple.y,
          left: ripple.x,
          width: `${ripple.size}px`,
          height: `${ripple.size}px`,
          ...style2
        },
        transition: { duration: duration2 },
        onAnimationComplete: () => {
          onClear(ripple.key);
        },
        ...motionProps
      }
    ) }) }, ripple.key);
  }) });
};
Ripple$1.displayName = "HeroUI.Ripple";
var ripple_default$1 = Ripple$1;
function useRipple$1(props = {}) {
  const [ripples, setRipples] = reactExports.useState([]);
  const onPress = reactExports.useCallback((event) => {
    const trigger = event.target;
    const size2 = Math.max(trigger.clientWidth, trigger.clientHeight);
    setRipples((prevRipples) => [
      ...prevRipples,
      {
        key: getUniqueID(prevRipples.length.toString()),
        size: size2,
        x: event.x - size2 / 2,
        y: event.y - size2 / 2
      }
    ]);
  }, []);
  const onClear = reactExports.useCallback((key) => {
    setRipples((prevState) => prevState.filter((ripple) => ripple.key !== key));
  }, []);
  return { ripples, onClear, onPress, ...props };
}
function useButton$1(props) {
  var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i;
  const groupContext = useButtonGroupContext$1();
  const globalContext = useProviderContext();
  const isInGroup = !!groupContext;
  const {
    ref,
    as: as2,
    children,
    startContent: startContentProp,
    endContent: endContentProp,
    autoFocus,
    className,
    spinner: spinner2,
    isLoading = false,
    disableRipple: disableRippleProp = false,
    fullWidth = (_a2 = groupContext == null ? void 0 : groupContext.fullWidth) != null ? _a2 : false,
    radius = groupContext == null ? void 0 : groupContext.radius,
    size: size2 = (_b2 = groupContext == null ? void 0 : groupContext.size) != null ? _b2 : "md",
    color: color2 = (_c2 = groupContext == null ? void 0 : groupContext.color) != null ? _c2 : "default",
    variant = (_d = groupContext == null ? void 0 : groupContext.variant) != null ? _d : "solid",
    disableAnimation = (_f = (_e = groupContext == null ? void 0 : groupContext.disableAnimation) != null ? _e : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _f : false,
    isDisabled: isDisabledProp = (_g = groupContext == null ? void 0 : groupContext.isDisabled) != null ? _g : false,
    isIconOnly = (_h = groupContext == null ? void 0 : groupContext.isIconOnly) != null ? _h : false,
    spinnerPlacement = "start",
    onPress,
    onClick,
    ...otherProps
  } = props;
  const Component2 = as2 || "button";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const disableRipple = (_i = disableRippleProp || (globalContext == null ? void 0 : globalContext.disableRipple)) != null ? _i : disableAnimation;
  const { isFocusVisible, isFocused, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus
  });
  const isDisabled = isDisabledProp || isLoading;
  const styles2 = reactExports.useMemo(
    () => button({
      size: size2,
      color: color2,
      variant,
      radius,
      fullWidth,
      isDisabled,
      isInGroup,
      disableAnimation,
      isIconOnly,
      className
    }),
    [
      size2,
      color2,
      variant,
      radius,
      fullWidth,
      isDisabled,
      isInGroup,
      isIconOnly,
      disableAnimation,
      className
    ]
  );
  const { onPress: onRipplePressHandler, onClear: onClearRipple, ripples } = useRipple$1();
  const handlePress = reactExports.useCallback(
    (e2) => {
      if (disableRipple || isDisabled || disableAnimation)
        return;
      domRef.current && onRipplePressHandler(e2);
    },
    [disableRipple, isDisabled, disableAnimation, domRef, onRipplePressHandler]
  );
  const { buttonProps: ariaButtonProps, isPressed } = useAriaButton$1(
    {
      elementType: as2,
      isDisabled,
      onPress: chain(onPress, handlePress),
      onClick,
      ...otherProps
    },
    domRef
  );
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$f({ isDisabled });
  const getButtonProps = reactExports.useCallback(
    (props2 = {}) => ({
      "data-disabled": dataAttr(isDisabled),
      "data-focus": dataAttr(isFocused),
      "data-pressed": dataAttr(isPressed),
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-hover": dataAttr(isHovered),
      "data-loading": dataAttr(isLoading),
      ...mergeProps$3(
        ariaButtonProps,
        focusProps,
        hoverProps,
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        }),
        filterDOMProps(props2)
      ),
      className: styles2
    }),
    [
      isLoading,
      isDisabled,
      isFocused,
      isPressed,
      shouldFilterDOMProps,
      isFocusVisible,
      isHovered,
      ariaButtonProps,
      focusProps,
      hoverProps,
      otherProps,
      styles2
    ]
  );
  const getIconClone = (icon) => reactExports.isValidElement(icon) ? reactExports.cloneElement(icon, {
    // @ts-ignore
    "aria-hidden": true,
    focusable: false
  }) : null;
  const startContent = getIconClone(startContentProp);
  const endContent = getIconClone(endContentProp);
  const spinnerSize = reactExports.useMemo(() => {
    const buttonSpinnerSizeMap = {
      sm: "sm",
      md: "sm",
      lg: "md"
    };
    return buttonSpinnerSizeMap[size2];
  }, [size2]);
  const getRippleProps = reactExports.useCallback(
    () => ({ ripples, onClear: onClearRipple }),
    [ripples, onClearRipple]
  );
  return {
    Component: Component2,
    children,
    domRef,
    spinner: spinner2,
    styles: styles2,
    startContent,
    endContent,
    isLoading,
    spinnerPlacement,
    spinnerSize,
    disableRipple,
    getButtonProps,
    getRippleProps,
    isIconOnly
  };
}
function useSpinner(originalProps) {
  var _a2, _b2;
  const [props, variantProps2] = mapPropsVariants(originalProps, spinner.variantKeys);
  const globalContext = useProviderContext();
  const variant = (_b2 = (_a2 = originalProps == null ? void 0 : originalProps.variant) != null ? _a2 : globalContext == null ? void 0 : globalContext.spinnerVariant) != null ? _b2 : "default";
  const { children, className, classNames: classNames2, label: labelProp, ...otherProps } = props;
  const slots = reactExports.useMemo(() => spinner({ ...variantProps2 }), [objectToDeps(variantProps2)]);
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const label = labelProp || children;
  const ariaLabel = reactExports.useMemo(() => {
    if (label && typeof label === "string") {
      return label;
    }
    return !otherProps["aria-label"] ? "Loading" : "";
  }, [children, label, otherProps["aria-label"]]);
  const getSpinnerProps = reactExports.useCallback(
    () => ({
      "aria-label": ariaLabel,
      className: slots.base({
        class: baseStyles
      }),
      ...otherProps
    }),
    [ariaLabel, slots, baseStyles, otherProps]
  );
  return { label, slots, classNames: classNames2, variant, getSpinnerProps };
}
var Spinner = forwardRef((props, ref) => {
  const { slots, classNames: classNames2, label, variant, getSpinnerProps } = useSpinner({ ...props });
  if (variant === "wave" || variant === "dots") {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref, ...getSpinnerProps(), children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }), children: [...new Array(3)].map((_24, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
        "i",
        {
          className: slots.dots({ class: classNames2 == null ? void 0 : classNames2.dots }),
          style: {
            "--dot-index": index2
          }
        },
        `dot-${index2}`
      )) }),
      label && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }), children: label })
    ] });
  }
  if (variant === "simple") {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref, ...getSpinnerProps(), children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        "svg",
        {
          className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }),
          fill: "none",
          viewBox: "0 0 24 24",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              "circle",
              {
                className: slots.circle1({ class: classNames2 == null ? void 0 : classNames2.circle1 }),
                cx: "12",
                cy: "12",
                r: "10",
                stroke: "currentColor",
                strokeWidth: "4"
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              "path",
              {
                className: slots.circle2({ class: classNames2 == null ? void 0 : classNames2.circle2 }),
                d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z",
                fill: "currentColor"
              }
            )
          ]
        }
      ),
      label && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }), children: label })
    ] });
  }
  if (variant === "spinner") {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref, ...getSpinnerProps(), children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }), children: [...new Array(12)].map((_24, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
        "i",
        {
          className: slots.spinnerBars({ class: classNames2 == null ? void 0 : classNames2.spinnerBars }),
          style: {
            "--bar-index": index2
          }
        },
        `star-${index2}`
      )) }),
      label && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }), children: label })
    ] });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref, ...getSpinnerProps(), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }), children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("i", { className: slots.circle1({ class: classNames2 == null ? void 0 : classNames2.circle1 }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("i", { className: slots.circle2({ class: classNames2 == null ? void 0 : classNames2.circle2 }) })
    ] }),
    label && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }), children: label })
  ] });
});
Spinner.displayName = "HeroUI.Spinner";
var spinner_default = Spinner;
var Button$2 = forwardRef((props, ref) => {
  const {
    Component: Component2,
    domRef,
    children,
    spinnerSize,
    spinner: spinner2 = /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { color: "current", size: spinnerSize }),
    spinnerPlacement,
    startContent,
    endContent,
    isLoading,
    disableRipple,
    getButtonProps,
    getRippleProps,
    isIconOnly
  } = useButton$1({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ref: domRef, ...getButtonProps(), children: [
    startContent,
    isLoading && spinnerPlacement === "start" && spinner2,
    isLoading && isIconOnly ? null : children,
    isLoading && spinnerPlacement === "end" && spinner2,
    endContent,
    !disableRipple && /* @__PURE__ */ jsxRuntimeExports.jsx(ripple_default$1, { ...getRippleProps() })
  ] });
});
Button$2.displayName = "HeroUI.Button";
var button_default$1 = Button$2;
var [CardProvider, useCardContext] = createContext2({
  name: "CardContext",
  strict: true,
  errorMessage: "useCardContext: `context` is undefined. Seems you forgot to wrap component within <Card />"
});
var CardBody = forwardRef((props, ref) => {
  var _a2;
  const { as: as2, className, children, ...otherProps } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const { slots, classNames: classNames2 } = useCardContext();
  const bodyStyles = clsx$4(classNames2 == null ? void 0 : classNames2.body, className);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ref: domRef, className: (_a2 = slots.body) == null ? void 0 : _a2.call(slots, { class: bodyStyles }), ...otherProps, children });
});
CardBody.displayName = "HeroUI.CardBody";
var card_body_default = CardBody;
var CardHeader = forwardRef((props, ref) => {
  var _a2;
  const { as: as2, className, children, ...otherProps } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const { slots, classNames: classNames2 } = useCardContext();
  const headerStyles = clsx$4(classNames2 == null ? void 0 : classNames2.header, className);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ref: domRef, className: (_a2 = slots.header) == null ? void 0 : _a2.call(slots, { class: headerStyles }), ...otherProps, children });
});
CardHeader.displayName = "HeroUI.CardHeader";
var card_header_default = CardHeader;
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$e = false;
let $6179b936705e76d3$var$hoverCount$e = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$e() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$e = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$e = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$e(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$e();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$e() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$e);
  $6179b936705e76d3$var$hoverCount$e++;
  return () => {
    $6179b936705e76d3$var$hoverCount$e--;
    if ($6179b936705e76d3$var$hoverCount$e > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$e);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$e(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$e, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$e && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
function useCard(originalProps) {
  var _a2, _b2, _c2, _d;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, card.variantKeys);
  const {
    ref,
    as: as2,
    children,
    onClick,
    onPress,
    autoFocus,
    className,
    classNames: classNames2,
    allowTextSelectionOnPress = true,
    ...otherProps
  } = props;
  const domRef = useDOMRef(ref);
  const Component2 = as2 || (originalProps.isPressable ? "button" : "div");
  const shouldFilterDOMProps = typeof Component2 === "string";
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const disableRipple = (_d = (_c2 = originalProps.disableRipple) != null ? _c2 : globalContext == null ? void 0 : globalContext.disableRipple) != null ? _d : false;
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const { onClear: onClearRipple, onPress: onRipplePressHandler, ripples } = useRipple$1();
  const handlePress = reactExports.useCallback(
    (e2) => {
      if (disableRipple || disableAnimation)
        return;
      domRef.current && onRipplePressHandler(e2);
    },
    [disableRipple, disableAnimation, domRef, onRipplePressHandler]
  );
  const { buttonProps, isPressed } = useAriaButton$1(
    {
      onPress: chain(onPress, handlePress),
      elementType: as2,
      isDisabled: !originalProps.isPressable,
      onClick,
      allowTextSelectionOnPress,
      ...otherProps
    },
    domRef
  );
  const { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456$e({
    isDisabled: !originalProps.isHoverable,
    ...otherProps
  });
  const { isFocusVisible, isFocused, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus
  });
  const slots = reactExports.useMemo(
    () => card({
      ...variantProps2,
      disableAnimation
    }),
    [objectToDeps(variantProps2), disableAnimation]
  );
  const context = reactExports.useMemo(
    () => ({
      slots,
      classNames: classNames2,
      disableAnimation,
      isDisabled: originalProps.isDisabled,
      isFooterBlurred: originalProps.isFooterBlurred,
      fullWidth: originalProps.fullWidth
    }),
    [
      slots,
      classNames2,
      originalProps.isDisabled,
      originalProps.isFooterBlurred,
      disableAnimation,
      originalProps.fullWidth
    ]
  );
  const getCardProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ref: domRef,
        className: slots.base({ class: baseStyles }),
        tabIndex: originalProps.isPressable ? 0 : -1,
        "data-hover": dataAttr(isHovered),
        "data-pressed": dataAttr(isPressed),
        "data-focus": dataAttr(isFocused),
        "data-focus-visible": dataAttr(isFocusVisible),
        "data-disabled": dataAttr(originalProps.isDisabled),
        ...mergeProps$3(
          originalProps.isPressable ? { ...buttonProps, ...focusProps, role: "button" } : {},
          originalProps.isHoverable ? hoverProps : {},
          filterDOMProps(otherProps, {
            enabled: shouldFilterDOMProps
          }),
          filterDOMProps(props2)
        )
      };
    },
    [
      domRef,
      slots,
      baseStyles,
      shouldFilterDOMProps,
      originalProps.isPressable,
      originalProps.isHoverable,
      originalProps.isDisabled,
      isHovered,
      isPressed,
      isFocusVisible,
      buttonProps,
      focusProps,
      hoverProps,
      otherProps
    ]
  );
  const getRippleProps = reactExports.useCallback(
    () => ({ ripples, onClear: onClearRipple }),
    [ripples, onClearRipple]
  );
  return {
    context,
    domRef,
    Component: Component2,
    classNames: classNames2,
    children,
    isHovered,
    isPressed,
    disableAnimation,
    isPressable: originalProps.isPressable,
    isHoverable: originalProps.isHoverable,
    disableRipple,
    handlePress,
    isFocusVisible,
    getCardProps,
    getRippleProps
  };
}
var Card = forwardRef((props, ref) => {
  const {
    children,
    context,
    Component: Component2,
    isPressable,
    disableAnimation,
    disableRipple,
    getCardProps,
    getRippleProps
  } = useCard({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getCardProps(), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(CardProvider, { value: context, children }),
    isPressable && !disableAnimation && !disableRipple && /* @__PURE__ */ jsxRuntimeExports.jsx(ripple_default$1, { ...getRippleProps() })
  ] });
});
Card.displayName = "HeroUI.Card";
var card_default = Card;
function $8a9cb279dc87e130$export$525bc4921d56d4a$a(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$9(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$cabe61c495ee3649$8(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$3(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$4(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$8 = "default";
let $14c0b72509d70225$var$savedUserSelect$8 = "";
let $14c0b72509d70225$var$modifiedElementMap$8 = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$8(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$8 === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
      $14c0b72509d70225$var$savedUserSelect$8 = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$8 = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$8.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$8(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$8 !== "disabled")
      return;
    $14c0b72509d70225$var$state$8 = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
        if ($14c0b72509d70225$var$state$8 === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$8 || "";
          $14c0b72509d70225$var$savedUserSelect$8 = "";
          $14c0b72509d70225$var$state$8 = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$8.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$8.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$8.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$8 = React$5.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$8.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext$8(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$8);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$9(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$8 = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$8 = class $f6c31cce2adf654f$var$PressEvent4 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$8, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$8);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$8, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$8, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$8 = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$8 = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$8 = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$8(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$8(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$8("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$8("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$8("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$8("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$8(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$8(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$9(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$a(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$8(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$8($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$8(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$3(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$8(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$9(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$6())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$4(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$8(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$8(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$8(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$8($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$8(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$8(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$8]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$8] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$3(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$8(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$8(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$8(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$8(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$5(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$8))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$8;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$8}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$8((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$8]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$8(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$8(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$8(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$8(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$8(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$8(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$8(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$8(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$8(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$8(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$8 = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$8(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$8.has(target.type);
}
function useChip(originalProps) {
  const [props, variantProps2] = mapPropsVariants(originalProps, chip.variantKeys);
  const {
    ref,
    as: as2,
    children,
    avatar,
    startContent,
    endContent,
    onClose,
    classNames: classNames2,
    className,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const isCloseable = !!onClose;
  const isDotVariant = originalProps.variant === "dot";
  const { focusProps: closeFocusProps, isFocusVisible: isCloseButtonFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const isOneChar = reactExports.useMemo(
    () => typeof children === "string" && (children == null ? void 0 : children.length) === 1,
    [children]
  );
  const hasStartContent = reactExports.useMemo(() => !!avatar || !!startContent, [avatar, startContent]);
  const hasEndContent = reactExports.useMemo(() => !!endContent || isCloseable, [endContent, isCloseable]);
  const slots = reactExports.useMemo(
    () => chip({
      ...variantProps2,
      hasStartContent,
      hasEndContent,
      isOneChar,
      isCloseable,
      isCloseButtonFocusVisible
    }),
    [
      objectToDeps(variantProps2),
      isCloseButtonFocusVisible,
      hasStartContent,
      hasEndContent,
      isOneChar,
      isCloseable
    ]
  );
  const { pressProps: closePressProps } = $f6c31cce2adf654f$export$45712eceda6fad21$8({
    isDisabled: !!(originalProps == null ? void 0 : originalProps.isDisabled),
    onPress: onClose
  });
  const getChipProps = () => {
    return {
      ref: domRef,
      className: slots.base({ class: baseStyles }),
      ...otherProps
    };
  };
  const getCloseButtonProps = () => {
    return {
      role: "button",
      tabIndex: 0,
      className: slots.closeButton({ class: classNames2 == null ? void 0 : classNames2.closeButton }),
      "aria-label": "close chip",
      ...mergeProps$3(closePressProps, closeFocusProps)
    };
  };
  const getAvatarClone = (avatar2) => {
    if (!reactExports.isValidElement(avatar2))
      return null;
    return reactExports.cloneElement(avatar2, {
      // @ts-ignore
      className: slots.avatar({ class: classNames2 == null ? void 0 : classNames2.avatar })
    });
  };
  const getContentClone = (content2) => reactExports.isValidElement(content2) ? reactExports.cloneElement(content2, {
    // @ts-ignore
    className: clsx$4("max-h-[80%]", content2.props.className)
  }) : null;
  return {
    Component: Component2,
    children,
    slots,
    classNames: classNames2,
    isDot: isDotVariant,
    isCloseable,
    startContent: getAvatarClone(avatar) || getContentClone(startContent),
    endContent: getContentClone(endContent),
    getCloseButtonProps,
    getChipProps
  };
}
var Chip$1 = forwardRef((props, ref) => {
  const {
    Component: Component2,
    children,
    slots,
    classNames: classNames2,
    isDot,
    isCloseable,
    startContent,
    endContent,
    getCloseButtonProps,
    getChipProps
  } = useChip({
    ...props,
    ref
  });
  const start2 = reactExports.useMemo(() => {
    if (isDot && !startContent) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.dot({ class: classNames2 == null ? void 0 : classNames2.dot }) });
    }
    return startContent;
  }, [slots, startContent, isDot]);
  const end2 = reactExports.useMemo(() => {
    if (isCloseable) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getCloseButtonProps(), children: endContent || /* @__PURE__ */ jsxRuntimeExports.jsx(CloseFilledIcon, {}) });
    }
    return endContent;
  }, [endContent, isCloseable, getCloseButtonProps]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getChipProps(), children: [
    start2,
    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.content({ class: classNames2 == null ? void 0 : classNames2.content }), children }),
    end2
  ] });
});
Chip$1.displayName = "HeroUI.Chip";
var chip_default = Chip$1;
const $e5be200c675c3b3a$export$aca958c65c314e6c$1 = {
  badInput: false,
  customError: false,
  patternMismatch: false,
  rangeOverflow: false,
  rangeUnderflow: false,
  stepMismatch: false,
  tooLong: false,
  tooShort: false,
  typeMismatch: false,
  valueMissing: false,
  valid: true
};
const $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE$1 = {
  ...$e5be200c675c3b3a$export$aca958c65c314e6c$1,
  customError: true,
  valid: false
};
const $e5be200c675c3b3a$export$dad6ae84456c676a$1 = {
  isInvalid: false,
  validationDetails: $e5be200c675c3b3a$export$aca958c65c314e6c$1,
  validationErrors: []
};
const $e5be200c675c3b3a$export$571b5131b7e65c11$2 = reactExports.createContext({});
const $e5be200c675c3b3a$export$a763b9476acd3eb$1 = "__formValidationState" + Date.now();
function $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1(props) {
  if (props[$e5be200c675c3b3a$export$a763b9476acd3eb$1]) {
    let { realtimeValidation, displayValidation, updateValidation, resetValidation, commitValidation } = props[$e5be200c675c3b3a$export$a763b9476acd3eb$1];
    return {
      realtimeValidation,
      displayValidation,
      updateValidation,
      resetValidation,
      commitValidation
    };
  }
  return $e5be200c675c3b3a$var$useFormValidationStateImpl$1(props);
}
function $e5be200c675c3b3a$var$useFormValidationStateImpl$1(props) {
  let { isInvalid, validationState, name: name2, value: value2, builtinValidation, validate: validate2, validationBehavior = "aria" } = props;
  if (validationState)
    isInvalid || (isInvalid = validationState === "invalid");
  let controlledError = isInvalid !== void 0 ? {
    isInvalid,
    validationErrors: [],
    validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE$1
  } : null;
  let clientError = reactExports.useMemo(() => {
    if (!validate2 || value2 == null)
      return null;
    let validateErrors = $e5be200c675c3b3a$var$runValidate$1(validate2, value2);
    return $e5be200c675c3b3a$var$getValidationResult$1(validateErrors);
  }, [
    validate2,
    value2
  ]);
  if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid)
    builtinValidation = void 0;
  let serverErrors = reactExports.useContext($e5be200c675c3b3a$export$571b5131b7e65c11$2);
  let serverErrorMessages = reactExports.useMemo(() => {
    if (name2)
      return Array.isArray(name2) ? name2.flatMap((name3) => $e5be200c675c3b3a$var$asArray$1(serverErrors[name3])) : $e5be200c675c3b3a$var$asArray$1(serverErrors[name2]);
    return [];
  }, [
    serverErrors,
    name2
  ]);
  let [lastServerErrors, setLastServerErrors] = reactExports.useState(serverErrors);
  let [isServerErrorCleared, setServerErrorCleared] = reactExports.useState(false);
  if (serverErrors !== lastServerErrors) {
    setLastServerErrors(serverErrors);
    setServerErrorCleared(false);
  }
  let serverError = reactExports.useMemo(() => $e5be200c675c3b3a$var$getValidationResult$1(isServerErrorCleared ? [] : serverErrorMessages), [
    isServerErrorCleared,
    serverErrorMessages
  ]);
  let nextValidation = reactExports.useRef($e5be200c675c3b3a$export$dad6ae84456c676a$1);
  let [currentValidity, setCurrentValidity] = reactExports.useState($e5be200c675c3b3a$export$dad6ae84456c676a$1);
  let lastError = reactExports.useRef($e5be200c675c3b3a$export$dad6ae84456c676a$1);
  let commitValidation = () => {
    if (!commitQueued)
      return;
    setCommitQueued(false);
    let error2 = clientError || builtinValidation || nextValidation.current;
    if (!$e5be200c675c3b3a$var$isEqualValidation$1(error2, lastError.current)) {
      lastError.current = error2;
      setCurrentValidity(error2);
    }
  };
  let [commitQueued, setCommitQueued] = reactExports.useState(false);
  reactExports.useEffect(commitValidation);
  let realtimeValidation = controlledError || serverError || clientError || builtinValidation || $e5be200c675c3b3a$export$dad6ae84456c676a$1;
  let displayValidation = validationBehavior === "native" ? controlledError || serverError || currentValidity : controlledError || serverError || clientError || builtinValidation || currentValidity;
  return {
    realtimeValidation,
    displayValidation,
    updateValidation(value3) {
      if (validationBehavior === "aria" && !$e5be200c675c3b3a$var$isEqualValidation$1(currentValidity, value3))
        setCurrentValidity(value3);
      else
        nextValidation.current = value3;
    },
    resetValidation() {
      let error2 = $e5be200c675c3b3a$export$dad6ae84456c676a$1;
      if (!$e5be200c675c3b3a$var$isEqualValidation$1(error2, lastError.current)) {
        lastError.current = error2;
        setCurrentValidity(error2);
      }
      if (validationBehavior === "native")
        setCommitQueued(false);
      setServerErrorCleared(true);
    },
    commitValidation() {
      if (validationBehavior === "native")
        setCommitQueued(true);
      setServerErrorCleared(true);
    }
  };
}
function $e5be200c675c3b3a$var$asArray$1(v2) {
  if (!v2)
    return [];
  return Array.isArray(v2) ? v2 : [
    v2
  ];
}
function $e5be200c675c3b3a$var$runValidate$1(validate2, value2) {
  if (typeof validate2 === "function") {
    let e2 = validate2(value2);
    if (e2 && typeof e2 !== "boolean")
      return $e5be200c675c3b3a$var$asArray$1(e2);
  }
  return [];
}
function $e5be200c675c3b3a$var$getValidationResult$1(errors) {
  return errors.length ? {
    isInvalid: true,
    validationErrors: errors,
    validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE$1
  } : null;
}
function $e5be200c675c3b3a$var$isEqualValidation$1(a2, b2) {
  if (a2 === b2)
    return true;
  return !!a2 && !!b2 && a2.isInvalid === b2.isInvalid && a2.validationErrors.length === b2.validationErrors.length && a2.validationErrors.every((a3, i2) => a3 === b2.validationErrors[i2]) && Object.entries(a2.validationDetails).every(([k2, v2]) => b2.validationDetails[k2] === v2);
}
function $e5be200c675c3b3a$export$75ee7c75d68f5b0e(...results) {
  let errors = /* @__PURE__ */ new Set();
  let isInvalid = false;
  let validationDetails = {
    ...$e5be200c675c3b3a$export$aca958c65c314e6c$1
  };
  for (let v2 of results) {
    var _validationDetails, _key;
    for (let e2 of v2.validationErrors)
      errors.add(e2);
    isInvalid || (isInvalid = v2.isInvalid);
    for (let key in validationDetails)
      (_validationDetails = validationDetails)[_key = key] || (_validationDetails[_key] = v2.validationDetails[key]);
  }
  validationDetails.valid = !isInvalid;
  return {
    isInvalid,
    validationErrors: [
      ...errors
    ],
    validationDetails
  };
}
function $e93e671b31057976$export$b8473d3665f3a75a$1(props, state, ref) {
  let { validationBehavior, focus } = props;
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (validationBehavior === "native" && (ref === null || ref === void 0 ? void 0 : ref.current) && !ref.current.disabled) {
      let errorMessage = state.realtimeValidation.isInvalid ? state.realtimeValidation.validationErrors.join(" ") || "Invalid value." : "";
      ref.current.setCustomValidity(errorMessage);
      if (!ref.current.hasAttribute("title"))
        ref.current.title = "";
      if (!state.realtimeValidation.isInvalid)
        state.updateValidation($e93e671b31057976$var$getNativeValidity$1(ref.current));
    }
  });
  let isIgnoredReset = reactExports.useRef(false);
  let onReset = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    if (!isIgnoredReset.current)
      state.resetValidation();
  });
  let onInvalid = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    var _ref_current;
    if (!state.displayValidation.isInvalid)
      state.commitValidation();
    let form2 = ref === null || ref === void 0 ? void 0 : (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.form;
    if (!e2.defaultPrevented && ref && form2 && $e93e671b31057976$var$getFirstInvalidInput$1(form2) === ref.current) {
      var _ref_current1;
      if (focus)
        focus();
      else
        (_ref_current1 = ref.current) === null || _ref_current1 === void 0 ? void 0 : _ref_current1.focus();
      $507fabe10e71c6fb$export$8397ddfc504fdb9a$2("keyboard");
    }
    e2.preventDefault();
  });
  let onChange = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    state.commitValidation();
  });
  reactExports.useEffect(() => {
    let input2 = ref === null || ref === void 0 ? void 0 : ref.current;
    if (!input2)
      return;
    let form2 = input2.form;
    let reset = form2 === null || form2 === void 0 ? void 0 : form2.reset;
    if (form2)
      form2.reset = () => {
        isIgnoredReset.current = !window.event || window.event.type === "message" && window.event.target instanceof MessagePort;
        reset === null || reset === void 0 ? void 0 : reset.call(form2);
        isIgnoredReset.current = false;
      };
    input2.addEventListener("invalid", onInvalid);
    input2.addEventListener("change", onChange);
    form2 === null || form2 === void 0 ? void 0 : form2.addEventListener("reset", onReset);
    return () => {
      input2.removeEventListener("invalid", onInvalid);
      input2.removeEventListener("change", onChange);
      form2 === null || form2 === void 0 ? void 0 : form2.removeEventListener("reset", onReset);
      if (form2)
        form2.reset = reset;
    };
  }, [
    ref,
    onInvalid,
    onChange,
    onReset,
    validationBehavior
  ]);
}
function $e93e671b31057976$var$getValidity$1(input2) {
  let validity = input2.validity;
  return {
    badInput: validity.badInput,
    customError: validity.customError,
    patternMismatch: validity.patternMismatch,
    rangeOverflow: validity.rangeOverflow,
    rangeUnderflow: validity.rangeUnderflow,
    stepMismatch: validity.stepMismatch,
    tooLong: validity.tooLong,
    tooShort: validity.tooShort,
    typeMismatch: validity.typeMismatch,
    valueMissing: validity.valueMissing,
    valid: validity.valid
  };
}
function $e93e671b31057976$var$getNativeValidity$1(input2) {
  return {
    isInvalid: !input2.validity.valid,
    validationDetails: $e93e671b31057976$var$getValidity$1(input2),
    validationErrors: input2.validationMessage ? [
      input2.validationMessage
    ] : []
  };
}
function $e93e671b31057976$var$getFirstInvalidInput$1(form2) {
  for (let i2 = 0; i2 < form2.elements.length; i2++) {
    let element2 = form2.elements[i2];
    if (!element2.validity.valid)
      return element2;
  }
  return null;
}
function $d2c8e2b0480f3f34$export$cbe85ee05b554577(props, state, ref) {
  let { isDisabled = false, isReadOnly = false, value: value2, name: name2, form: form2, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, validationState = "valid", isInvalid, onPressStart, onPressEnd, onPressChange, onPress, onPressUp, onClick } = props;
  let onChange = (e2) => {
    e2.stopPropagation();
    state.setSelected(e2.target.checked);
  };
  let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    onPressStart,
    onPressEnd,
    onPressChange,
    onPress,
    onPressUp,
    onClick,
    isDisabled
  });
  let { pressProps: labelProps, isPressed: isLabelPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    onPressStart,
    onPressEnd,
    onPressChange,
    onPressUp,
    onClick,
    onPress(e2) {
      var _ref_current;
      onPress === null || onPress === void 0 ? void 0 : onPress(e2);
      state.toggle();
      (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.focus();
    },
    isDisabled: isDisabled || isReadOnly
  });
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2(props, ref);
  let interactions = $3ef42575df84b30b$export$9d1611c77c2fe928$9(pressProps, focusableProps);
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  $99facab73266f662$export$5add1d006293d136(ref, state.defaultSelected, state.setSelected);
  return {
    labelProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(labelProps, {
      onClick: (e2) => e2.preventDefault()
    }),
    inputProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, {
      "aria-invalid": isInvalid || validationState === "invalid" || void 0,
      "aria-errormessage": props["aria-errormessage"],
      "aria-controls": props["aria-controls"],
      "aria-readonly": isReadOnly || void 0,
      onChange,
      disabled: isDisabled,
      ...value2 == null ? {} : {
        value: value2
      },
      name: name2,
      form: form2,
      type: "checkbox",
      ...interactions
    }),
    isSelected: state.isSelected,
    isPressed: isPressed || isLabelPressed,
    isDisabled,
    isReadOnly,
    isInvalid: isInvalid || validationState === "invalid"
  };
}
function $406796ff087fe49b$export$e375f10ce42261c5(props, state, inputRef) {
  let validationState = $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1({
    ...props,
    value: state.isSelected
  });
  let { isInvalid, validationErrors, validationDetails } = validationState.displayValidation;
  let { labelProps, inputProps, isSelected, isPressed, isDisabled, isReadOnly } = $d2c8e2b0480f3f34$export$cbe85ee05b554577({
    ...props,
    isInvalid
  }, state, inputRef);
  $e93e671b31057976$export$b8473d3665f3a75a$1(props, validationState, inputRef);
  let { isIndeterminate, isRequired, validationBehavior = "aria" } = props;
  reactExports.useEffect(() => {
    if (inputRef.current)
      inputRef.current.indeterminate = !!isIndeterminate;
  });
  let { pressProps } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    isDisabled: isDisabled || isReadOnly,
    onPress() {
      let { [$e5be200c675c3b3a$export$a763b9476acd3eb$1]: groupValidationState } = props;
      let { commitValidation } = groupValidationState ? groupValidationState : validationState;
      commitValidation();
    }
  });
  return {
    labelProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(labelProps, pressProps),
    inputProps: {
      ...inputProps,
      checked: isSelected,
      "aria-required": isRequired && validationBehavior === "aria" || void 0,
      required: isRequired && validationBehavior === "native"
    },
    isSelected,
    isPressed,
    isDisabled,
    isReadOnly,
    isInvalid,
    validationErrors,
    validationDetails
  };
}
const $1ae600c947479353$export$ec98120685d4f57d = /* @__PURE__ */ new WeakMap();
function $d191a55c9702f145$export$8467354a121f1b9f$1(props) {
  let { id: id2, label, "aria-labelledby": ariaLabelledby, "aria-label": ariaLabel, labelElementType = "label" } = props;
  id2 = $bdb11010cef70236$export$f680877a34711e37$2(id2);
  let labelId = $bdb11010cef70236$export$f680877a34711e37$2();
  let labelProps = {};
  if (label) {
    ariaLabelledby = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;
    labelProps = {
      id: labelId,
      htmlFor: labelElementType === "label" ? id2 : void 0
    };
  }
  let fieldProps = $313b98861ee5dd6c$export$d6875122194c7b44$1({
    id: id2,
    "aria-label": ariaLabel,
    "aria-labelledby": ariaLabelledby
  });
  return {
    labelProps,
    fieldProps
  };
}
function $2baaea4c71418dea$export$294aa081a6c6f55d$1(props) {
  let { description, errorMessage, isInvalid, validationState } = props;
  let { labelProps, fieldProps } = $d191a55c9702f145$export$8467354a121f1b9f$1(props);
  let descriptionId = $bdb11010cef70236$export$b4cc09c592e8fdb8$1([
    Boolean(description),
    Boolean(errorMessage),
    isInvalid,
    validationState
  ]);
  let errorMessageId = $bdb11010cef70236$export$b4cc09c592e8fdb8$1([
    Boolean(description),
    Boolean(errorMessage),
    isInvalid,
    validationState
  ]);
  fieldProps = $3ef42575df84b30b$export$9d1611c77c2fe928$9(fieldProps, {
    "aria-describedby": [
      descriptionId,
      // Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268
      errorMessageId,
      props["aria-describedby"]
    ].filter(Boolean).join(" ") || void 0
  });
  return {
    labelProps,
    fieldProps,
    descriptionProps: {
      id: descriptionId
    },
    errorMessageProps: {
      id: errorMessageId
    }
  };
}
function $1e9fce0cfacc738b$export$49ff6f28c54f1cbe(props, state) {
  let { isDisabled, name: name2, validationBehavior = "aria" } = props;
  let { isInvalid, validationErrors, validationDetails } = state.displayValidation;
  let { labelProps, fieldProps, descriptionProps, errorMessageProps } = $2baaea4c71418dea$export$294aa081a6c6f55d$1({
    ...props,
    // Checkbox group is not an HTML input element so it
    // shouldn't be labeled by a <label> element.
    labelElementType: "span",
    isInvalid,
    errorMessage: props.errorMessage || validationErrors
  });
  $1ae600c947479353$export$ec98120685d4f57d.set(state, {
    name: name2,
    descriptionId: descriptionProps.id,
    errorMessageId: errorMessageProps.id,
    validationBehavior
  });
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$4({
    onBlurWithin: props.onBlur,
    onFocusWithin: props.onFocus,
    onFocusWithinChange: props.onFocusChange
  });
  return {
    groupProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, {
      role: "group",
      "aria-disabled": isDisabled || void 0,
      ...fieldProps,
      ...focusWithinProps
    }),
    labelProps,
    descriptionProps,
    errorMessageProps,
    isInvalid,
    validationErrors,
    validationDetails
  };
}
function $3017fa7ffdddec74$export$8042c6c013fd5226$2(props = {}) {
  let { isReadOnly } = props;
  let [isSelected, setSelected] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.isSelected, props.defaultSelected || false, props.onChange);
  let [initialValue] = reactExports.useState(isSelected);
  function updateSelected(value2) {
    if (!isReadOnly)
      setSelected(value2);
  }
  function toggleState() {
    if (!isReadOnly)
      setSelected(!isSelected);
  }
  var _props_defaultSelected;
  return {
    isSelected,
    defaultSelected: (_props_defaultSelected = props.defaultSelected) !== null && _props_defaultSelected !== void 0 ? _props_defaultSelected : initialValue,
    setSelected: updateSelected,
    toggle: toggleState
  };
}
function $fba3e38d5ca8983f$export$353b32fc6898d37d(props, state, inputRef) {
  const toggleState = $3017fa7ffdddec74$export$8042c6c013fd5226$2({
    isReadOnly: props.isReadOnly || state.isReadOnly,
    isSelected: state.isSelected(props.value),
    onChange(isSelected) {
      if (isSelected)
        state.addValue(props.value);
      else
        state.removeValue(props.value);
      if (props.onChange)
        props.onChange(isSelected);
    }
  });
  let { name: name2, descriptionId, errorMessageId, validationBehavior } = $1ae600c947479353$export$ec98120685d4f57d.get(state);
  var _props_validationBehavior;
  validationBehavior = (_props_validationBehavior = props.validationBehavior) !== null && _props_validationBehavior !== void 0 ? _props_validationBehavior : validationBehavior;
  let { realtimeValidation } = $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1({
    ...props,
    value: toggleState.isSelected,
    // Server validation is handled at the group level.
    name: void 0,
    validationBehavior: "aria"
  });
  let nativeValidation = reactExports.useRef($e5be200c675c3b3a$export$dad6ae84456c676a$1);
  let updateValidation = () => {
    state.setInvalid(props.value, realtimeValidation.isInvalid ? realtimeValidation : nativeValidation.current);
  };
  reactExports.useEffect(updateValidation);
  let combinedRealtimeValidation = state.realtimeValidation.isInvalid ? state.realtimeValidation : realtimeValidation;
  let displayValidation = validationBehavior === "native" ? state.displayValidation : combinedRealtimeValidation;
  var _props_isRequired;
  let res = $406796ff087fe49b$export$e375f10ce42261c5({
    ...props,
    isReadOnly: props.isReadOnly || state.isReadOnly,
    isDisabled: props.isDisabled || state.isDisabled,
    name: props.name || name2,
    isRequired: (_props_isRequired = props.isRequired) !== null && _props_isRequired !== void 0 ? _props_isRequired : state.isRequired,
    validationBehavior,
    [$e5be200c675c3b3a$export$a763b9476acd3eb$1]: {
      realtimeValidation: combinedRealtimeValidation,
      displayValidation,
      resetValidation: state.resetValidation,
      commitValidation: state.commitValidation,
      updateValidation(v2) {
        nativeValidation.current = v2;
        updateValidation();
      }
    }
  }, toggleState, inputRef);
  return {
    ...res,
    inputProps: {
      ...res.inputProps,
      "aria-describedby": [
        props["aria-describedby"],
        state.isInvalid ? errorMessageId : null,
        descriptionId
      ].filter(Boolean).join(" ") || void 0
    }
  };
}
function $587d3ad58be6d31f$export$daff6da51032a415(props = {}) {
  let [selectedValues, setValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.value, props.defaultValue || [], props.onChange);
  let isRequired = !!props.isRequired && selectedValues.length === 0;
  let invalidValues = reactExports.useRef(/* @__PURE__ */ new Map());
  let validation = $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1({
    ...props,
    value: selectedValues
  });
  let isInvalid = validation.displayValidation.isInvalid;
  var _props_validationState;
  const state = {
    ...validation,
    value: selectedValues,
    setValue(value2) {
      if (props.isReadOnly || props.isDisabled)
        return;
      setValue(value2);
    },
    isDisabled: props.isDisabled || false,
    isReadOnly: props.isReadOnly || false,
    isSelected(value2) {
      return selectedValues.includes(value2);
    },
    addValue(value2) {
      if (props.isReadOnly || props.isDisabled)
        return;
      if (!selectedValues.includes(value2))
        setValue(selectedValues.concat(value2));
    },
    removeValue(value2) {
      if (props.isReadOnly || props.isDisabled)
        return;
      if (selectedValues.includes(value2))
        setValue(selectedValues.filter((existingValue) => existingValue !== value2));
    },
    toggleValue(value2) {
      if (props.isReadOnly || props.isDisabled)
        return;
      if (selectedValues.includes(value2))
        setValue(selectedValues.filter((existingValue) => existingValue !== value2));
      else
        setValue(selectedValues.concat(value2));
    },
    setInvalid(value2, v2) {
      let s2 = new Map(invalidValues.current);
      if (v2.isInvalid)
        s2.set(value2, v2);
      else
        s2.delete(value2);
      invalidValues.current = s2;
      validation.updateValidation($e5be200c675c3b3a$export$75ee7c75d68f5b0e(...s2.values()));
    },
    validationState: (_props_validationState = props.validationState) !== null && _props_validationState !== void 0 ? _props_validationState : isInvalid ? "invalid" : null,
    isInvalid,
    isRequired
  };
  return state;
}
var DEFAULT_SLOT = Symbol("default");
function useObjectRef(ref) {
  const objRef = reactExports.useRef(null);
  const cleanupRef = reactExports.useRef(void 0);
  const refEffect = reactExports.useCallback(
    (instance2) => {
      if (typeof ref === "function") {
        const refCallback = ref;
        const refCleanup = refCallback(instance2);
        return () => {
          if (typeof refCleanup === "function") {
            refCleanup();
          } else {
            refCallback(null);
          }
        };
      } else if (ref) {
        ref.current = instance2;
        return () => {
          ref.current = null;
        };
      }
    },
    [ref]
  );
  return reactExports.useMemo(
    () => ({
      get current() {
        return objRef.current;
      },
      set current(value2) {
        objRef.current = value2;
        if (cleanupRef.current) {
          cleanupRef.current();
          cleanupRef.current = void 0;
        }
        if (value2 != null) {
          cleanupRef.current = refEffect(value2);
        }
      }
    }),
    [refEffect]
  );
}
function useSlottedContext(context, slot) {
  let ctx = reactExports.useContext(context);
  if (slot === null) {
    return null;
  }
  if (ctx && typeof ctx === "object" && "slots" in ctx && ctx.slots) {
    let availableSlots = new Intl.ListFormat().format(Object.keys(ctx.slots).map((p2) => `"${p2}"`));
    if (!slot && !ctx.slots[DEFAULT_SLOT]) {
      throw new Error(`A slot prop is required. Valid slot names are ${availableSlots}.`);
    }
    let slotKey = slot || DEFAULT_SLOT;
    if (!ctx.slots[slotKey]) {
      throw new Error(`Invalid slot "${slot}". Valid slot names are ${availableSlots}.`);
    }
    return ctx.slots[slotKey];
  }
  return ctx;
}
function useContextProps(props, ref, context) {
  let ctx = useSlottedContext(context, props.slot) || {};
  let { ref: contextRef, ...contextProps } = ctx;
  let mergedRef = useObjectRef(reactExports.useMemo(() => mergeRefs$1(ref, contextRef), [ref, contextRef]));
  let mergedProps = mergeProps$3(contextProps, props);
  if ("style" in contextProps && contextProps.style && "style" in props && props.style) {
    if (typeof contextProps.style === "function" || typeof props.style === "function") {
      mergedProps.style = (renderProps) => {
        let contextStyle = typeof contextProps.style === "function" ? contextProps.style(renderProps) : contextProps.style;
        let defaultStyle = { ...renderProps.defaultStyle, ...contextStyle };
        let style2 = typeof props.style === "function" ? props.style({ ...renderProps, defaultStyle }) : props.style;
        return { ...defaultStyle, ...style2 };
      };
    } else {
      mergedProps.style = { ...contextProps.style, ...props.style };
    }
  }
  return [mergedProps, mergedRef];
}
const $e5be200c675c3b3a$export$571b5131b7e65c11$1 = reactExports.createContext({});
var FormContext$1 = reactExports.createContext(null);
reactExports.forwardRef(function Form2(props, ref) {
  [props, ref] = useContextProps(props, ref, FormContext$1);
  let { validationErrors, validationBehavior = "native", children, className, ...domProps } = props;
  const styles2 = reactExports.useMemo(() => form({ className }), [className]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx("form", { noValidate: validationBehavior !== "native", ...domProps, ref, className: styles2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(FormContext$1.Provider, { value: { ...props, validationBehavior }, children: /* @__PURE__ */ jsxRuntimeExports.jsx($e5be200c675c3b3a$export$571b5131b7e65c11$1.Provider, { value: validationErrors != null ? validationErrors : {}, children }) }) });
});
function useCheckboxGroup(props) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext$1) || {};
  const {
    as: as2,
    ref,
    classNames: classNames2,
    children,
    label,
    radius,
    value: value2,
    name: name2,
    defaultValue: defaultValue2,
    isInvalid: isInvalidProp,
    validationState,
    size: size2 = "md",
    color: color2 = "primary",
    orientation = "vertical",
    lineThrough = false,
    isDisabled = false,
    validationBehavior = (_a2 = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _a2 : "native",
    disableAnimation = (_b2 = globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false,
    isReadOnly,
    isRequired,
    onValueChange,
    description,
    errorMessage,
    className,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const checkboxGroupProps = reactExports.useMemo(() => {
    return {
      ...otherProps,
      value: value2,
      name: name2,
      "aria-label": safeAriaLabel(otherProps["aria-label"], label),
      defaultValue: defaultValue2,
      isRequired,
      isReadOnly,
      orientation,
      validationBehavior,
      isInvalid: validationState === "invalid" || isInvalidProp,
      onChange: chain(props.onChange, onValueChange)
    };
  }, [
    value2,
    name2,
    label,
    defaultValue2,
    isRequired,
    isReadOnly,
    orientation,
    onValueChange,
    isInvalidProp,
    validationState,
    validationBehavior,
    otherProps["aria-label"],
    otherProps
  ]);
  const groupState = $587d3ad58be6d31f$export$daff6da51032a415(checkboxGroupProps);
  const {
    labelProps,
    groupProps,
    descriptionProps,
    errorMessageProps,
    validationErrors,
    validationDetails
  } = $1e9fce0cfacc738b$export$49ff6f28c54f1cbe(checkboxGroupProps, groupState);
  const context = reactExports.useMemo(
    () => ({
      size: size2,
      color: color2,
      radius,
      lineThrough,
      isInvalid: groupState.isInvalid,
      isDisabled,
      disableAnimation,
      validationBehavior,
      groupState
    }),
    [
      size2,
      color2,
      radius,
      lineThrough,
      isDisabled,
      disableAnimation,
      validationBehavior,
      groupState.value,
      groupState.isDisabled,
      groupState.isReadOnly,
      groupState.isInvalid,
      groupState.isSelected
    ]
  );
  const slots = reactExports.useMemo(
    () => checkboxGroup({ isRequired, isInvalid: groupState.isInvalid, disableAnimation }),
    [isRequired, groupState.isInvalid, , disableAnimation]
  );
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const getGroupProps = reactExports.useCallback(() => {
    return {
      ref: domRef,
      className: slots.base({ class: baseStyles }),
      ...mergeProps$3(
        groupProps,
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        })
      )
    };
  }, [slots, domRef, baseStyles, groupProps, otherProps]);
  const getLabelProps = reactExports.useCallback(() => {
    return {
      className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }),
      ...labelProps
    };
  }, [slots, labelProps, classNames2 == null ? void 0 : classNames2.label]);
  const getWrapperProps = reactExports.useCallback(() => {
    return {
      className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }),
      role: "presentation",
      "data-orientation": orientation
    };
  }, [slots, orientation, classNames2 == null ? void 0 : classNames2.wrapper]);
  const getDescriptionProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ...descriptionProps,
        className: slots.description({ class: clsx$4(classNames2 == null ? void 0 : classNames2.description, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, descriptionProps, classNames2 == null ? void 0 : classNames2.description]
  );
  const getErrorMessageProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ...errorMessageProps,
        className: slots.errorMessage({ class: clsx$4(classNames2 == null ? void 0 : classNames2.errorMessage, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, errorMessageProps, classNames2 == null ? void 0 : classNames2.errorMessage]
  );
  return {
    Component: Component2,
    children,
    label,
    context,
    description,
    isInvalid: groupState.isInvalid,
    errorMessage: typeof errorMessage === "function" ? errorMessage({ isInvalid: groupState.isInvalid, validationErrors, validationDetails }) : errorMessage || (validationErrors == null ? void 0 : validationErrors.join(" ")),
    getGroupProps,
    getLabelProps,
    getWrapperProps,
    getDescriptionProps,
    getErrorMessageProps
  };
}
var [CheckboxGroupProvider, useCheckboxGroupContext] = createContext2({
  name: "CheckboxGroupContext",
  strict: false
});
var CheckboxGroup = forwardRef((props, ref) => {
  const {
    children,
    context,
    label,
    description,
    isInvalid,
    errorMessage,
    getGroupProps,
    getLabelProps,
    getWrapperProps,
    getDescriptionProps,
    getErrorMessageProps
  } = useCheckboxGroup({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getGroupProps(), children: [
    label && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children: label }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getWrapperProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(CheckboxGroupProvider, { value: context, children }) }),
    isInvalid && errorMessage ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getErrorMessageProps(), children: errorMessage }) : description ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getDescriptionProps(), children: description }) : null
  ] });
});
CheckboxGroup.displayName = "HeroUI.CheckboxGroup";
var checkbox_group_default = CheckboxGroup;
function CheckIcon$1(props) {
  const { isSelected, disableAnimation, ...otherProps } = props;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "svg",
    {
      "aria-hidden": "true",
      fill: "none",
      role: "presentation",
      stroke: "currentColor",
      strokeDasharray: 22,
      strokeDashoffset: isSelected ? 44 : 66,
      strokeLinecap: "round",
      strokeLinejoin: "round",
      strokeWidth: 2,
      style: !disableAnimation && isSelected ? {
        transition: "stroke-dashoffset 250ms linear 0.2s"
      } : {},
      viewBox: "0 0 17 18",
      ...otherProps,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "1 9 7 14 15 4" })
    }
  );
}
function IndeterminateIcon(props) {
  const { isSelected, disableAnimation, ...otherProps } = props;
  return /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { stroke: "currentColor", strokeWidth: 3, viewBox: "0 0 24 24", ...otherProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "21", x2: "3", y1: "12", y2: "12" }) });
}
function CheckboxIcon(props) {
  const { isIndeterminate, ...otherProps } = props;
  const BaseIcon = isIndeterminate ? IndeterminateIcon : CheckIcon$1;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(BaseIcon, { ...otherProps });
}
function $3017fa7ffdddec74$export$8042c6c013fd5226$1(props = {}) {
  let { isReadOnly } = props;
  let [isSelected, setSelected] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.isSelected, props.defaultSelected || false, props.onChange);
  function updateSelected(value2) {
    if (!isReadOnly)
      setSelected(value2);
  }
  function toggleState() {
    if (!isReadOnly)
      setSelected(!isSelected);
  }
  return {
    isSelected,
    setSelected: updateSelected,
    toggle: toggleState
  };
}
function useCallbackRef(fn, deps = []) {
  const ref = reactExports.useRef(fn);
  useSafeLayoutEffect(() => {
    ref.current = fn;
  });
  return reactExports.useCallback((...args) => {
    var _a2;
    return (_a2 = ref.current) == null ? void 0 : _a2.call(ref, ...args);
  }, deps);
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$d = false;
let $6179b936705e76d3$var$hoverCount$d = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$d() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$d = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$d = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$d(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$d();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$d() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$d);
  $6179b936705e76d3$var$hoverCount$d++;
  return () => {
    $6179b936705e76d3$var$hoverCount$d--;
    if ($6179b936705e76d3$var$hoverCount$d > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$d);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$d(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$d, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$d && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
function useCheckbox(props = {}) {
  var _a2, _b2, _c2, _d, _e, _f, _g, _h;
  const globalContext = useProviderContext();
  const groupContext = useCheckboxGroupContext();
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext$1) || {};
  const isInGroup = !!groupContext;
  const {
    as: as2,
    ref,
    value: value2 = "",
    children,
    icon,
    name: name2,
    isRequired,
    isReadOnly: isReadOnlyProp = false,
    autoFocus = false,
    isSelected: isSelectedProp,
    size: size2 = (_a2 = groupContext == null ? void 0 : groupContext.size) != null ? _a2 : "md",
    color: color2 = (_b2 = groupContext == null ? void 0 : groupContext.color) != null ? _b2 : "primary",
    radius = groupContext == null ? void 0 : groupContext.radius,
    lineThrough = (_c2 = groupContext == null ? void 0 : groupContext.lineThrough) != null ? _c2 : false,
    isDisabled: isDisabledProp = (_d = groupContext == null ? void 0 : groupContext.isDisabled) != null ? _d : false,
    disableAnimation = (_f = (_e = groupContext == null ? void 0 : groupContext.disableAnimation) != null ? _e : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _f : false,
    validationState,
    isInvalid: isInvalidProp = validationState ? validationState === "invalid" : (_g = groupContext == null ? void 0 : groupContext.isInvalid) != null ? _g : false,
    isIndeterminate = false,
    validationBehavior = isInGroup ? groupContext.validationBehavior : (_h = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _h : "native",
    defaultSelected,
    classNames: classNames2,
    className,
    onValueChange,
    validate: validate2,
    ...otherProps
  } = props;
  const Component2 = as2 || "label";
  const domRef = reactExports.useRef(null);
  const inputRef = reactExports.useRef(null);
  let onChange = props.onChange;
  if (isInGroup) {
    const dispatch = () => {
      groupContext.groupState.resetValidation();
    };
    onChange = chain(dispatch, onChange);
  }
  const labelId = reactExports.useId();
  const ariaCheckboxProps = reactExports.useMemo(
    () => ({
      name: name2,
      value: value2,
      children,
      autoFocus,
      defaultSelected,
      isIndeterminate,
      isRequired,
      isInvalid: isInvalidProp,
      isSelected: isSelectedProp,
      isDisabled: isDisabledProp,
      isReadOnly: isReadOnlyProp,
      "aria-label": safeAriaLabel(otherProps["aria-label"], children),
      "aria-labelledby": otherProps["aria-labelledby"] || labelId,
      onChange: onValueChange
    }),
    [
      name2,
      value2,
      children,
      autoFocus,
      defaultSelected,
      isIndeterminate,
      isRequired,
      isInvalidProp,
      isSelectedProp,
      isDisabledProp,
      isReadOnlyProp,
      otherProps["aria-label"],
      otherProps["aria-labelledby"],
      labelId,
      onValueChange
    ]
  );
  const toggleState = $3017fa7ffdddec74$export$8042c6c013fd5226$1(ariaCheckboxProps);
  const validationProps = {
    isInvalid: isInvalidProp,
    isRequired,
    validate: validate2,
    validationState,
    validationBehavior
  };
  const {
    inputProps,
    isSelected,
    isDisabled,
    isReadOnly,
    isPressed,
    isInvalid: isAriaInvalid
  } = isInGroup ? (
    // eslint-disable-next-line
    $fba3e38d5ca8983f$export$353b32fc6898d37d(
      { ...ariaCheckboxProps, ...validationProps },
      groupContext.groupState,
      inputRef
    )
  ) : (
    // eslint-disable-next-line
    $406796ff087fe49b$export$e375f10ce42261c5({ ...ariaCheckboxProps, ...validationProps }, toggleState, inputRef)
  );
  const isInteractionDisabled = isDisabled || isReadOnly;
  const isInvalid = validationState === "invalid" || isInvalidProp || isAriaInvalid;
  const pressed = isInteractionDisabled ? false : isPressed;
  const { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456$d({
    isDisabled: inputProps.disabled
  });
  const { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus: inputProps.autoFocus
  });
  const slots = reactExports.useMemo(
    () => checkbox({
      color: color2,
      size: size2,
      radius,
      isInvalid,
      lineThrough,
      isDisabled,
      disableAnimation
    }),
    [color2, size2, radius, isInvalid, lineThrough, isDisabled, disableAnimation]
  );
  useSafeLayoutEffect(() => {
    if (!inputRef.current)
      return;
    const isInputRefChecked = !!inputRef.current.checked;
    toggleState.setSelected(isInputRefChecked);
  }, [inputRef.current]);
  const onChangeProp = useCallbackRef(onChange);
  const handleCheckboxChange = reactExports.useCallback(
    (event) => {
      if (isReadOnly || isDisabled) {
        event.preventDefault();
        return;
      }
      onChangeProp == null ? void 0 : onChangeProp(event);
    },
    [isReadOnly, isDisabled, onChangeProp]
  );
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const getBaseProps = reactExports.useCallback(() => {
    return {
      ref: domRef,
      className: slots.base({ class: baseStyles }),
      "data-disabled": dataAttr(isDisabled),
      "data-selected": dataAttr(isSelected || isIndeterminate),
      "data-invalid": dataAttr(isInvalid),
      "data-hover": dataAttr(isHovered),
      "data-focus": dataAttr(isFocused),
      "data-pressed": dataAttr(pressed),
      "data-readonly": dataAttr(inputProps.readOnly),
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-indeterminate": dataAttr(isIndeterminate),
      ...mergeProps$3(hoverProps, otherProps)
    };
  }, [
    slots,
    baseStyles,
    isDisabled,
    isSelected,
    isIndeterminate,
    isInvalid,
    isHovered,
    isFocused,
    pressed,
    inputProps.readOnly,
    isFocusVisible,
    hoverProps,
    otherProps
  ]);
  const getWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "aria-hidden": true,
        className: clsx$4(slots.wrapper({ class: clsx$4(classNames2 == null ? void 0 : classNames2.wrapper, props2 == null ? void 0 : props2.className) }))
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.wrapper]
  );
  const getInputProps = reactExports.useCallback(() => {
    return {
      ref: mergeRefs(inputRef, ref),
      ...mergeProps$3(inputProps, focusProps),
      className: slots.hiddenInput({ class: classNames2 == null ? void 0 : classNames2.hiddenInput }),
      onChange: chain(inputProps.onChange, handleCheckboxChange)
    };
  }, [inputProps, focusProps, handleCheckboxChange, classNames2 == null ? void 0 : classNames2.hiddenInput]);
  const getLabelProps = reactExports.useCallback(
    () => ({
      id: labelId,
      className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.label, isDisabled, isSelected, isInvalid]
  );
  const getIconProps = reactExports.useCallback(
    () => ({
      isSelected,
      isIndeterminate,
      disableAnimation,
      className: slots.icon({ class: classNames2 == null ? void 0 : classNames2.icon })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.icon, isSelected, isIndeterminate, disableAnimation]
  );
  return {
    Component: Component2,
    icon,
    children,
    isSelected,
    isDisabled,
    isInvalid,
    isFocused,
    isHovered,
    isFocusVisible,
    getBaseProps,
    getWrapperProps,
    getInputProps,
    getLabelProps,
    getIconProps
  };
}
var Checkbox = forwardRef((props, ref) => {
  const {
    Component: Component2,
    children,
    icon = /* @__PURE__ */ jsxRuntimeExports.jsx(CheckboxIcon, {}),
    getBaseProps,
    getWrapperProps,
    getInputProps,
    getIconProps,
    getLabelProps
  } = useCheckbox({ ...props, ref });
  const clonedIcon = typeof icon === "function" ? icon(getIconProps()) : reactExports.cloneElement(icon, getIconProps());
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getBaseProps(), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...getInputProps() }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getWrapperProps(), children: clonedIcon }),
    children && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children })
  ] });
});
Checkbox.displayName = "HeroUI.Checkbox";
var checkbox_default = Checkbox;
function useCode(originalProps) {
  const [props, variantProps2] = mapPropsVariants(originalProps, code$1.variantKeys);
  const { as: as2, children, className, ...otherProps } = props;
  const Component2 = as2 || "code";
  const styles2 = reactExports.useMemo(
    () => code$1({
      ...variantProps2,
      className
    }),
    [objectToDeps(variantProps2), className]
  );
  const getCodeProps = () => {
    return {
      className: styles2,
      ...otherProps
    };
  };
  return { Component: Component2, children, getCodeProps };
}
var Code = forwardRef((props, ref) => {
  const { Component: Component2, children, getCodeProps } = useCode({ ...props });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ref, ...getCodeProps(), children });
});
Code.displayName = "HeroUI.Code";
var code_default = Code;
let $bdb11010cef70236$export$d41a04c74483c6ef$6 = /* @__PURE__ */ new Map();
if (typeof FinalizationRegistry !== "undefined")
  new FinalizationRegistry((heldValue) => {
    $bdb11010cef70236$export$d41a04c74483c6ef$6.delete(heldValue);
  });
function $bdb11010cef70236$export$cd8c9cb68f842629$6(idA, idB) {
  if (idA === idB)
    return idA;
  let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef$6.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef$6.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function $ff5963eb1fccf552$export$e08e3b67e392101e$6(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks)
      if (typeof callback2 === "function")
        callback2(...args);
  };
}
function $3ef42575df84b30b$export$9d1611c77c2fe928$6(...args) {
  let result = {
    ...args[0]
  };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90)
        result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e$6(a2, b2);
      else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string")
        result[key] = clsx$3(a2, b2);
      else if (key === "id" && a2 && b2)
        result.id = $bdb11010cef70236$export$cd8c9cb68f842629$6(a2, b2);
      else
        result[key] = b2 !== void 0 ? b2 : a2;
    }
  }
  return result;
}
const $65484d02dcb7eb3e$var$DOMPropNames$2 = /* @__PURE__ */ new Set([
  "id"
]);
const $65484d02dcb7eb3e$var$labelablePropNames$2 = /* @__PURE__ */ new Set([
  "aria-label",
  "aria-labelledby",
  "aria-describedby",
  "aria-details"
]);
const $65484d02dcb7eb3e$var$linkPropNames$2 = /* @__PURE__ */ new Set([
  "href",
  "hrefLang",
  "target",
  "rel",
  "download",
  "ping",
  "referrerPolicy"
]);
const $65484d02dcb7eb3e$var$propRe$2 = /^(data-.*)$/;
function $65484d02dcb7eb3e$export$457c3d6518dd4c6f$2(props, opts2 = {}) {
  let { labelable, isLink, propNames } = opts2;
  let filteredProps = {};
  for (const prop in props)
    if (Object.prototype.hasOwnProperty.call(props, prop) && ($65484d02dcb7eb3e$var$DOMPropNames$2.has(prop) || labelable && $65484d02dcb7eb3e$var$labelablePropNames$2.has(prop) || isLink && $65484d02dcb7eb3e$var$linkPropNames$2.has(prop) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $65484d02dcb7eb3e$var$propRe$2.test(prop)))
      filteredProps[prop] = props[prop];
  return filteredProps;
}
function $7215afc6de606d6b$export$de79e2c695e052f3$3(element2) {
  if ($7215afc6de606d6b$var$supportsPreventScroll$3())
    element2.focus({
      preventScroll: true
    });
  else {
    let scrollableElements = $7215afc6de606d6b$var$getScrollableElements$3(element2);
    element2.focus();
    $7215afc6de606d6b$var$restoreScrollPosition$3(scrollableElements);
  }
}
let $7215afc6de606d6b$var$supportsPreventScrollCached$3 = null;
function $7215afc6de606d6b$var$supportsPreventScroll$3() {
  if ($7215afc6de606d6b$var$supportsPreventScrollCached$3 == null) {
    $7215afc6de606d6b$var$supportsPreventScrollCached$3 = false;
    try {
      let focusElem = document.createElement("div");
      focusElem.focus({
        get preventScroll() {
          $7215afc6de606d6b$var$supportsPreventScrollCached$3 = true;
          return true;
        }
      });
    } catch {
    }
  }
  return $7215afc6de606d6b$var$supportsPreventScrollCached$3;
}
function $7215afc6de606d6b$var$getScrollableElements$3(element2) {
  let parent = element2.parentNode;
  let scrollableElements = [];
  let rootScrollingElement = document.scrollingElement || document.documentElement;
  while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
    if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth)
      scrollableElements.push({
        element: parent,
        scrollTop: parent.scrollTop,
        scrollLeft: parent.scrollLeft
      });
    parent = parent.parentNode;
  }
  if (rootScrollingElement instanceof HTMLElement)
    scrollableElements.push({
      element: rootScrollingElement,
      scrollTop: rootScrollingElement.scrollTop,
      scrollLeft: rootScrollingElement.scrollLeft
    });
  return scrollableElements;
}
function $7215afc6de606d6b$var$restoreScrollPosition$3(scrollableElements) {
  for (let { element: element2, scrollTop, scrollLeft } of scrollableElements) {
    element2.scrollTop = scrollTop;
    element2.scrollLeft = scrollLeft;
  }
}
function $c87311424ea30a05$var$testUserAgent$4(re2) {
  var _window_navigator_userAgentData;
  if (typeof window === "undefined" || window.navigator == null)
    return false;
  return ((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands.some((brand) => re2.test(brand.brand))) || re2.test(window.navigator.userAgent);
}
function $c87311424ea30a05$var$testPlatform$4(re2) {
  var _window_navigator_userAgentData;
  return typeof window !== "undefined" && window.navigator != null ? re2.test(((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
}
function $c87311424ea30a05$var$cached$4(fn) {
  let res = null;
  return () => {
    if (res == null)
      res = fn();
    return res;
  };
}
const $c87311424ea30a05$export$9ac100e40613ea10$4 = $c87311424ea30a05$var$cached$4(function() {
  return $c87311424ea30a05$var$testPlatform$4(/^Mac/i);
});
const $c87311424ea30a05$export$7bef049ce92e4224$3 = $c87311424ea30a05$var$cached$4(function() {
  return $c87311424ea30a05$var$testPlatform$4(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
  $c87311424ea30a05$export$9ac100e40613ea10$4() && navigator.maxTouchPoints > 1;
});
const $c87311424ea30a05$export$78551043582a6a98$3 = $c87311424ea30a05$var$cached$4(function() {
  return $c87311424ea30a05$var$testUserAgent$4(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e$3();
});
const $c87311424ea30a05$export$6446a186d09e379e$3 = $c87311424ea30a05$var$cached$4(function() {
  return $c87311424ea30a05$var$testUserAgent$4(/Chrome/i);
});
const $c87311424ea30a05$export$b7d78993b74f766d$3 = $c87311424ea30a05$var$cached$4(function() {
  return $c87311424ea30a05$var$testUserAgent$4(/Firefox/i);
});
const $ea8dcbcb9ea1b556$var$RouterContext$1 = /* @__PURE__ */ reactExports.createContext({
  isNative: true,
  open: $ea8dcbcb9ea1b556$var$openSyntheticLink$1,
  useHref: (href) => href
});
function $ea8dcbcb9ea1b556$export$9a302a45f65d0572$1() {
  return reactExports.useContext($ea8dcbcb9ea1b556$var$RouterContext$1);
}
function $ea8dcbcb9ea1b556$export$efa8c9099e530235$1(link2, modifiers) {
  let target = link2.getAttribute("target");
  return (!target || target === "_self") && link2.origin === location.origin && !link2.hasAttribute("download") && !modifiers.metaKey && // open in new tab (mac)
  !modifiers.ctrlKey && // open in new tab (windows)
  !modifiers.altKey && // download
  !modifiers.shiftKey;
}
function $ea8dcbcb9ea1b556$export$95185d699e05d4d7$3(target, modifiers, setOpening = true) {
  var _window_event_type, _window_event;
  let { metaKey, ctrlKey, altKey, shiftKey } = modifiers;
  if ($c87311424ea30a05$export$b7d78993b74f766d$3() && ((_window_event = window.event) === null || _window_event === void 0 ? void 0 : (_window_event_type = _window_event.type) === null || _window_event_type === void 0 ? void 0 : _window_event_type.startsWith("key")) && target.target === "_blank") {
    if ($c87311424ea30a05$export$9ac100e40613ea10$4())
      metaKey = true;
    else
      ctrlKey = true;
  }
  let event = $c87311424ea30a05$export$78551043582a6a98$3() && $c87311424ea30a05$export$9ac100e40613ea10$4() && !$c87311424ea30a05$export$7bef049ce92e4224$3() && true ? new KeyboardEvent("keydown", {
    keyIdentifier: "Enter",
    metaKey,
    ctrlKey,
    altKey,
    shiftKey
  }) : new MouseEvent("click", {
    metaKey,
    ctrlKey,
    altKey,
    shiftKey,
    bubbles: true,
    cancelable: true
  });
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$3.isOpening = setOpening;
  $7215afc6de606d6b$export$de79e2c695e052f3$3(target);
  target.dispatchEvent(event);
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$3.isOpening = false;
}
$ea8dcbcb9ea1b556$export$95185d699e05d4d7$3.isOpening = false;
function $ea8dcbcb9ea1b556$var$getSyntheticLink$1(target, open) {
  if (target instanceof HTMLAnchorElement)
    open(target);
  else if (target.hasAttribute("data-href")) {
    let link2 = document.createElement("a");
    link2.href = target.getAttribute("data-href");
    if (target.hasAttribute("data-target"))
      link2.target = target.getAttribute("data-target");
    if (target.hasAttribute("data-rel"))
      link2.rel = target.getAttribute("data-rel");
    if (target.hasAttribute("data-download"))
      link2.download = target.getAttribute("data-download");
    if (target.hasAttribute("data-ping"))
      link2.ping = target.getAttribute("data-ping");
    if (target.hasAttribute("data-referrer-policy"))
      link2.referrerPolicy = target.getAttribute("data-referrer-policy");
    target.appendChild(link2);
    open(link2);
    target.removeChild(link2);
  }
}
function $ea8dcbcb9ea1b556$var$openSyntheticLink$1(target, modifiers) {
  $ea8dcbcb9ea1b556$var$getSyntheticLink$1(target, (link2) => $ea8dcbcb9ea1b556$export$95185d699e05d4d7$3(link2, modifiers));
}
function $ea8dcbcb9ea1b556$export$7e924b3091a3bd18(props) {
  let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572$1();
  var _props_href;
  const href = router.useHref((_props_href = props === null || props === void 0 ? void 0 : props.href) !== null && _props_href !== void 0 ? _props_href : "");
  return {
    href: (props === null || props === void 0 ? void 0 : props.href) ? href : void 0,
    target: props === null || props === void 0 ? void 0 : props.target,
    rel: props === null || props === void 0 ? void 0 : props.rel,
    download: props === null || props === void 0 ? void 0 : props.download,
    ping: props === null || props === void 0 ? void 0 : props.ping,
    referrerPolicy: props === null || props === void 0 ? void 0 : props.referrerPolicy
  };
}
const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$3 = typeof document !== "undefined" ? React$5.useLayoutEffect : () => {
};
var $8ae05eaa5c114e9c$var$_React_useInsertionEffect$2;
const $8ae05eaa5c114e9c$var$useEarlyEffect$2 = ($8ae05eaa5c114e9c$var$_React_useInsertionEffect$2 = React$5["useInsertionEffect"]) !== null && $8ae05eaa5c114e9c$var$_React_useInsertionEffect$2 !== void 0 ? $8ae05eaa5c114e9c$var$_React_useInsertionEffect$2 : $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$3;
function $8ae05eaa5c114e9c$export$7f54fc3180508a52$2(fn) {
  const ref = reactExports.useRef(null);
  $8ae05eaa5c114e9c$var$useEarlyEffect$2(() => {
    ref.current = fn;
  }, [
    fn
  ]);
  return reactExports.useCallback((...args) => {
    const f2 = ref.current;
    return f2 === null || f2 === void 0 ? void 0 : f2(...args);
  }, []);
}
let $bdb11010cef70236$export$d41a04c74483c6ef$5 = /* @__PURE__ */ new Map();
if (typeof FinalizationRegistry !== "undefined")
  new FinalizationRegistry((heldValue) => {
    $bdb11010cef70236$export$d41a04c74483c6ef$5.delete(heldValue);
  });
function $bdb11010cef70236$export$cd8c9cb68f842629$5(idA, idB) {
  if (idA === idB)
    return idA;
  let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef$5.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef$5.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function $ff5963eb1fccf552$export$e08e3b67e392101e$5(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks)
      if (typeof callback2 === "function")
        callback2(...args);
  };
}
const $431fbd86ca7dc216$export$b204af158042fbac$2 = (el2) => {
  var _el_ownerDocument;
  return (_el_ownerDocument = el2 === null || el2 === void 0 ? void 0 : el2.ownerDocument) !== null && _el_ownerDocument !== void 0 ? _el_ownerDocument : document;
};
const $431fbd86ca7dc216$export$f21a1ffae260145a$2 = (el2) => {
  if (el2 && "window" in el2 && el2.window === el2)
    return el2;
  const doc = $431fbd86ca7dc216$export$b204af158042fbac$2(el2);
  return doc.defaultView || window;
};
function $431fbd86ca7dc216$var$isNode$1(value2) {
  return value2 !== null && typeof value2 === "object" && "nodeType" in value2 && typeof value2.nodeType === "number";
}
function $431fbd86ca7dc216$export$af51f0f06c0f328a$1(node2) {
  return $431fbd86ca7dc216$var$isNode$1(node2) && node2.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in node2;
}
function $d4ee10de306f2510$export$4282f70798064fe0$1(node2, otherNode) {
  if (!$f4e2df6bd15f8569$export$98658e8c59125e6a())
    return otherNode && node2 ? node2.contains(otherNode) : false;
  if (!node2 || !otherNode)
    return false;
  let currentNode = otherNode;
  while (currentNode !== null) {
    if (currentNode === node2)
      return true;
    if (currentNode.tagName === "SLOT" && currentNode.assignedSlot)
      currentNode = currentNode.assignedSlot.parentNode;
    else if ($431fbd86ca7dc216$export$af51f0f06c0f328a$1(currentNode))
      currentNode = currentNode.host;
    else
      currentNode = currentNode.parentNode;
  }
  return false;
}
function $d4ee10de306f2510$export$e58f029f0fbfdb29$1(event) {
  if ($f4e2df6bd15f8569$export$98658e8c59125e6a() && event.target.shadowRoot) {
    if (event.composedPath)
      return event.composedPath()[0];
  }
  return event.target;
}
function $3ef42575df84b30b$export$9d1611c77c2fe928$5(...args) {
  let result = {
    ...args[0]
  };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90)
        result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e$5(a2, b2);
      else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string")
        result[key] = clsx$3(a2, b2);
      else if (key === "id" && a2 && b2)
        result.id = $bdb11010cef70236$export$cd8c9cb68f842629$5(a2, b2);
      else
        result[key] = b2 !== void 0 ? b2 : a2;
    }
  }
  return result;
}
function $7215afc6de606d6b$export$de79e2c695e052f3$2(element2) {
  if ($7215afc6de606d6b$var$supportsPreventScroll$2())
    element2.focus({
      preventScroll: true
    });
  else {
    let scrollableElements = $7215afc6de606d6b$var$getScrollableElements$2(element2);
    element2.focus();
    $7215afc6de606d6b$var$restoreScrollPosition$2(scrollableElements);
  }
}
let $7215afc6de606d6b$var$supportsPreventScrollCached$2 = null;
function $7215afc6de606d6b$var$supportsPreventScroll$2() {
  if ($7215afc6de606d6b$var$supportsPreventScrollCached$2 == null) {
    $7215afc6de606d6b$var$supportsPreventScrollCached$2 = false;
    try {
      let focusElem = document.createElement("div");
      focusElem.focus({
        get preventScroll() {
          $7215afc6de606d6b$var$supportsPreventScrollCached$2 = true;
          return true;
        }
      });
    } catch {
    }
  }
  return $7215afc6de606d6b$var$supportsPreventScrollCached$2;
}
function $7215afc6de606d6b$var$getScrollableElements$2(element2) {
  let parent = element2.parentNode;
  let scrollableElements = [];
  let rootScrollingElement = document.scrollingElement || document.documentElement;
  while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
    if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth)
      scrollableElements.push({
        element: parent,
        scrollTop: parent.scrollTop,
        scrollLeft: parent.scrollLeft
      });
    parent = parent.parentNode;
  }
  if (rootScrollingElement instanceof HTMLElement)
    scrollableElements.push({
      element: rootScrollingElement,
      scrollTop: rootScrollingElement.scrollTop,
      scrollLeft: rootScrollingElement.scrollLeft
    });
  return scrollableElements;
}
function $7215afc6de606d6b$var$restoreScrollPosition$2(scrollableElements) {
  for (let { element: element2, scrollTop, scrollLeft } of scrollableElements) {
    element2.scrollTop = scrollTop;
    element2.scrollLeft = scrollLeft;
  }
}
function $c87311424ea30a05$var$testUserAgent$3(re2) {
  var _window_navigator_userAgentData;
  if (typeof window === "undefined" || window.navigator == null)
    return false;
  let brands = (_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands;
  return Array.isArray(brands) && brands.some((brand) => re2.test(brand.brand)) || re2.test(window.navigator.userAgent);
}
function $c87311424ea30a05$var$testPlatform$3(re2) {
  var _window_navigator_userAgentData;
  return typeof window !== "undefined" && window.navigator != null ? re2.test(((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
}
function $c87311424ea30a05$var$cached$3(fn) {
  let res = null;
  return () => {
    if (res == null)
      res = fn();
    return res;
  };
}
const $c87311424ea30a05$export$9ac100e40613ea10$3 = $c87311424ea30a05$var$cached$3(function() {
  return $c87311424ea30a05$var$testPlatform$3(/^Mac/i);
});
const $c87311424ea30a05$export$186c6964ca17d99$1 = $c87311424ea30a05$var$cached$3(function() {
  return $c87311424ea30a05$var$testPlatform$3(/^iPhone/i);
});
const $c87311424ea30a05$export$7bef049ce92e4224$2 = $c87311424ea30a05$var$cached$3(function() {
  return $c87311424ea30a05$var$testPlatform$3(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
  $c87311424ea30a05$export$9ac100e40613ea10$3() && navigator.maxTouchPoints > 1;
});
const $c87311424ea30a05$export$fedb369cb70207f1$1 = $c87311424ea30a05$var$cached$3(function() {
  return $c87311424ea30a05$export$186c6964ca17d99$1() || $c87311424ea30a05$export$7bef049ce92e4224$2();
});
const $c87311424ea30a05$export$78551043582a6a98$2 = $c87311424ea30a05$var$cached$3(function() {
  return $c87311424ea30a05$var$testUserAgent$3(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e$2();
});
const $c87311424ea30a05$export$6446a186d09e379e$2 = $c87311424ea30a05$var$cached$3(function() {
  return $c87311424ea30a05$var$testUserAgent$3(/Chrome/i);
});
const $c87311424ea30a05$export$a11b0059900ceec8$2 = $c87311424ea30a05$var$cached$3(function() {
  return $c87311424ea30a05$var$testUserAgent$3(/Android/i);
});
const $c87311424ea30a05$export$b7d78993b74f766d$2 = $c87311424ea30a05$var$cached$3(function() {
  return $c87311424ea30a05$var$testUserAgent$3(/Firefox/i);
});
function $ea8dcbcb9ea1b556$export$95185d699e05d4d7$2(target, modifiers, setOpening = true) {
  var _window_event_type, _window_event;
  let { metaKey, ctrlKey, altKey, shiftKey } = modifiers;
  if ($c87311424ea30a05$export$b7d78993b74f766d$2() && ((_window_event = window.event) === null || _window_event === void 0 ? void 0 : (_window_event_type = _window_event.type) === null || _window_event_type === void 0 ? void 0 : _window_event_type.startsWith("key")) && target.target === "_blank") {
    if ($c87311424ea30a05$export$9ac100e40613ea10$3())
      metaKey = true;
    else
      ctrlKey = true;
  }
  let event = $c87311424ea30a05$export$78551043582a6a98$2() && $c87311424ea30a05$export$9ac100e40613ea10$3() && !$c87311424ea30a05$export$7bef049ce92e4224$2() && true ? new KeyboardEvent("keydown", {
    keyIdentifier: "Enter",
    metaKey,
    ctrlKey,
    altKey,
    shiftKey
  }) : new MouseEvent("click", {
    metaKey,
    ctrlKey,
    altKey,
    shiftKey,
    bubbles: true,
    cancelable: true
  });
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$2.isOpening = setOpening;
  $7215afc6de606d6b$export$de79e2c695e052f3$2(target);
  target.dispatchEvent(event);
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$2.isOpening = false;
}
$ea8dcbcb9ea1b556$export$95185d699e05d4d7$2.isOpening = false;
let $bbed8b41f857bcc0$var$transitionsByElement$1 = /* @__PURE__ */ new Map();
let $bbed8b41f857bcc0$var$transitionCallbacks$1 = /* @__PURE__ */ new Set();
function $bbed8b41f857bcc0$var$setupGlobalEvents$1() {
  if (typeof window === "undefined")
    return;
  function isTransitionEvent(event) {
    return "propertyName" in event;
  }
  let onTransitionStart = (e2) => {
    if (!isTransitionEvent(e2) || !e2.target)
      return;
    let transitions = $bbed8b41f857bcc0$var$transitionsByElement$1.get(e2.target);
    if (!transitions) {
      transitions = /* @__PURE__ */ new Set();
      $bbed8b41f857bcc0$var$transitionsByElement$1.set(e2.target, transitions);
      e2.target.addEventListener("transitioncancel", onTransitionEnd, {
        once: true
      });
    }
    transitions.add(e2.propertyName);
  };
  let onTransitionEnd = (e2) => {
    if (!isTransitionEvent(e2) || !e2.target)
      return;
    let properties2 = $bbed8b41f857bcc0$var$transitionsByElement$1.get(e2.target);
    if (!properties2)
      return;
    properties2.delete(e2.propertyName);
    if (properties2.size === 0) {
      e2.target.removeEventListener("transitioncancel", onTransitionEnd);
      $bbed8b41f857bcc0$var$transitionsByElement$1.delete(e2.target);
    }
    if ($bbed8b41f857bcc0$var$transitionsByElement$1.size === 0) {
      for (let cb2 of $bbed8b41f857bcc0$var$transitionCallbacks$1)
        cb2();
      $bbed8b41f857bcc0$var$transitionCallbacks$1.clear();
    }
  };
  document.body.addEventListener("transitionrun", onTransitionStart);
  document.body.addEventListener("transitionend", onTransitionEnd);
}
if (typeof document !== "undefined") {
  if (document.readyState !== "loading")
    $bbed8b41f857bcc0$var$setupGlobalEvents$1();
  else
    document.addEventListener("DOMContentLoaded", $bbed8b41f857bcc0$var$setupGlobalEvents$1);
}
function $bbed8b41f857bcc0$var$cleanupDetachedElements$1() {
  for (const [eventTarget] of $bbed8b41f857bcc0$var$transitionsByElement$1)
    if ("isConnected" in eventTarget && !eventTarget.isConnected)
      $bbed8b41f857bcc0$var$transitionsByElement$1.delete(eventTarget);
}
function $bbed8b41f857bcc0$export$24490316f764c430$1(fn) {
  requestAnimationFrame(() => {
    $bbed8b41f857bcc0$var$cleanupDetachedElements$1();
    if ($bbed8b41f857bcc0$var$transitionsByElement$1.size === 0)
      fn();
    else
      $bbed8b41f857bcc0$var$transitionCallbacks$1.add(fn);
  });
}
function $03deb23ff14920c4$export$4eaf04e54aa8eed6$1() {
  let globalListeners = reactExports.useRef(/* @__PURE__ */ new Map());
  let addGlobalListener = reactExports.useCallback((eventTarget, type4, listener, options) => {
    let fn = (options === null || options === void 0 ? void 0 : options.once) ? (...args) => {
      globalListeners.current.delete(listener);
      listener(...args);
    } : listener;
    globalListeners.current.set(listener, {
      type: type4,
      eventTarget,
      fn,
      options
    });
    eventTarget.addEventListener(type4, fn, options);
  }, []);
  let removeGlobalListener = reactExports.useCallback((eventTarget, type4, listener, options) => {
    var _globalListeners_current_get;
    let fn = ((_globalListeners_current_get = globalListeners.current.get(listener)) === null || _globalListeners_current_get === void 0 ? void 0 : _globalListeners_current_get.fn) || listener;
    eventTarget.removeEventListener(type4, fn, options);
    globalListeners.current.delete(listener);
  }, []);
  let removeAllGlobalListeners = reactExports.useCallback(() => {
    globalListeners.current.forEach((value2, key) => {
      removeGlobalListener(value2.eventTarget, value2.type, key, value2.options);
    });
  }, [
    removeGlobalListener
  ]);
  reactExports.useEffect(() => {
    return removeAllGlobalListeners;
  }, [
    removeAllGlobalListeners
  ]);
  return {
    addGlobalListener,
    removeGlobalListener,
    removeAllGlobalListeners
  };
}
function $e7801be82b4b2a53$export$4debdb1a3f0fa79e$1(context, ref) {
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$3(() => {
    if (context && context.ref && ref) {
      context.ref.current = ref.current;
      return () => {
        if (context.ref)
          context.ref.current = null;
      };
    }
  });
}
function $6a7db85432448f7f$export$60278871457622de$2(event) {
  if (event.mozInputSource === 0 && event.isTrusted)
    return true;
  if ($c87311424ea30a05$export$a11b0059900ceec8$2() && event.pointerType)
    return event.type === "click" && event.buttons === 1;
  return event.detail === 0 && !event.pointerType;
}
function $6a7db85432448f7f$export$29bf1b5f2c56cf63$1(event) {
  return !$c87311424ea30a05$export$a11b0059900ceec8$2() && event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
}
const $7d2416ea0959daaa$var$supportsCheckVisibility$1 = typeof Element !== "undefined" && "checkVisibility" in Element.prototype;
function $7d2416ea0959daaa$var$isStyleVisible$1(element2) {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$2(element2);
  if (!(element2 instanceof windowObject.HTMLElement) && !(element2 instanceof windowObject.SVGElement))
    return false;
  let { display, visibility } = element2.style;
  let isVisible2 = display !== "none" && visibility !== "hidden" && visibility !== "collapse";
  if (isVisible2) {
    const { getComputedStyle: getComputedStyle2 } = element2.ownerDocument.defaultView;
    let { display: computedDisplay, visibility: computedVisibility } = getComputedStyle2(element2);
    isVisible2 = computedDisplay !== "none" && computedVisibility !== "hidden" && computedVisibility !== "collapse";
  }
  return isVisible2;
}
function $7d2416ea0959daaa$var$isAttributeVisible$1(element2, childElement) {
  return !element2.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking.
  !element2.hasAttribute("data-react-aria-prevent-focus") && (element2.nodeName === "DETAILS" && childElement && childElement.nodeName !== "SUMMARY" ? element2.hasAttribute("open") : true);
}
function $7d2416ea0959daaa$export$e989c0fffaa6b27a$1(element2, childElement) {
  if ($7d2416ea0959daaa$var$supportsCheckVisibility$1)
    return element2.checkVisibility();
  return element2.nodeName !== "#comment" && $7d2416ea0959daaa$var$isStyleVisible$1(element2) && $7d2416ea0959daaa$var$isAttributeVisible$1(element2, childElement) && (!element2.parentElement || $7d2416ea0959daaa$export$e989c0fffaa6b27a$1(element2.parentElement, element2));
}
const $b4b717babfbb907b$var$focusableElements$1 = [
  "input:not([disabled]):not([type=hidden])",
  "select:not([disabled])",
  "textarea:not([disabled])",
  "button:not([disabled])",
  "a[href]",
  "area[href]",
  "summary",
  "iframe",
  "object",
  "embed",
  "audio[controls]",
  "video[controls]",
  '[contenteditable]:not([contenteditable^="false"])',
  "permission"
];
const $b4b717babfbb907b$var$FOCUSABLE_ELEMENT_SELECTOR$1 = $b4b717babfbb907b$var$focusableElements$1.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
$b4b717babfbb907b$var$focusableElements$1.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
function $b4b717babfbb907b$export$4c063cf1350e6fed$1(element2) {
  return element2.matches($b4b717babfbb907b$var$FOCUSABLE_ELEMENT_SELECTOR$1) && $7d2416ea0959daaa$export$e989c0fffaa6b27a$1(element2) && !$b4b717babfbb907b$var$isInert$1(element2);
}
function $b4b717babfbb907b$var$isInert$1(element2) {
  let node2 = element2;
  while (node2 != null) {
    if (node2 instanceof node2.ownerDocument.defaultView.HTMLElement && node2.inert)
      return true;
    node2 = node2.parentElement;
  }
  return false;
}
function $8a9cb279dc87e130$export$525bc4921d56d4a$9(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$8(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$cabe61c495ee3649$7(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$1(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$2(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$2(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$2(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$7 = "default";
let $14c0b72509d70225$var$savedUserSelect$7 = "";
let $14c0b72509d70225$var$modifiedElementMap$7 = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$7(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$1()) {
    if ($14c0b72509d70225$var$state$7 === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$2(target);
      $14c0b72509d70225$var$savedUserSelect$7 = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$7 = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$7.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$7(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$1()) {
    if ($14c0b72509d70225$var$state$7 !== "disabled")
      return;
    $14c0b72509d70225$var$state$7 = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$1(() => {
        if ($14c0b72509d70225$var$state$7 === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$2(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$7 || "";
          $14c0b72509d70225$var$savedUserSelect$7 = "";
          $14c0b72509d70225$var$state$7 = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$7.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$7.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$7.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$7 = React$5.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$7.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext$7(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$7);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$5(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$1(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$7 = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$7 = class $f6c31cce2adf654f$var$PressEvent5 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$7, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$7);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$7, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$7, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$7 = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$7 = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$7 = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$7(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$7(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$1();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$2((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$7("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$2((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$7("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$7("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$2((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$7("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$2((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$7(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$7(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$2((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$2((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$2((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$8(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$9(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$7(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$1(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$7($d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$7(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$1(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$7(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$2(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$5(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$3())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$1(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$2.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$2(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$7(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$7(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$7(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$7($d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$1(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$7(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$7(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$1(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$7]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$7] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$2(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$1(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$1(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$7(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$2(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$2(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$1(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$7(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$1(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$7(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$7(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$1(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$2(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$1(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$2(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$7))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$7;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$7}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$7((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$5(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$7]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$7(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$7(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$2(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$7(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$2(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$7(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$7(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$7(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$7(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$7(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$7(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$7(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$7 = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$7(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$7.has(target.type);
}
function useAriaLink(props, ref) {
  let {
    elementType = "a",
    onPress,
    onPressStart,
    onPressEnd,
    onClick,
    isDisabled,
    ...otherProps
  } = props;
  let linkProps = {};
  if (elementType !== "a") {
    linkProps = {
      role: "link",
      tabIndex: !isDisabled ? 0 : void 0
    };
  }
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2(props, ref);
  let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$7({
    onClick,
    onPress,
    onPressStart,
    onPressEnd,
    isDisabled,
    ref
  });
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$2(otherProps, { labelable: true, isLink: elementType === "a" });
  let interactionHandlers = $3ef42575df84b30b$export$9d1611c77c2fe928$6(focusableProps, pressProps);
  let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572$1();
  let routerLinkProps = $ea8dcbcb9ea1b556$export$7e924b3091a3bd18(props);
  return {
    isPressed,
    // Used to indicate press state for visual
    linkProps: $3ef42575df84b30b$export$9d1611c77c2fe928$6(domProps, routerLinkProps, {
      ...interactionHandlers,
      ...linkProps,
      "aria-disabled": isDisabled || void 0,
      "aria-current": props["aria-current"],
      onClick: (e2) => {
        var _a2;
        (_a2 = pressProps.onClick) == null ? void 0 : _a2.call(pressProps, e2);
        if (!router.isNative && e2.currentTarget instanceof HTMLAnchorElement && e2.currentTarget.href && // If props are applied to a router Link component, it may have already prevented default.
        !e2.isDefaultPrevented() && $ea8dcbcb9ea1b556$export$efa8c9099e530235$1(e2.currentTarget, e2) && props.href) {
          e2.preventDefault();
          router.open(e2.currentTarget, e2, props.href, props.routerOptions);
        }
      }
    })
  };
}
function useLink(originalProps) {
  var _a2, _b2, _c2, _d;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, link$1.variantKeys);
  const {
    ref,
    as: as2,
    children,
    anchorIcon,
    isExternal = false,
    showAnchorIcon = false,
    autoFocus = false,
    className,
    onPress,
    onPressStart,
    onPressEnd,
    onClick,
    ...otherProps
  } = props;
  const Component2 = as2 || "a";
  const domRef = useDOMRef(ref);
  const disableAnimation = (_b2 = (_a2 = originalProps == null ? void 0 : originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const { linkProps } = useAriaLink(
    {
      ...otherProps,
      onPress,
      onPressStart,
      onPressEnd,
      // @ts-ignore React Aria Link does accept onClick as a prop but it's not in the types
      onClick,
      isDisabled: originalProps.isDisabled,
      elementType: `${as2}`
    },
    domRef
  );
  const { isFocused, isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus
  });
  if (isExternal) {
    otherProps.rel = (_c2 = otherProps.rel) != null ? _c2 : "noopener noreferrer";
    otherProps.target = (_d = otherProps.target) != null ? _d : "_blank";
  }
  const styles2 = reactExports.useMemo(
    () => link$1({
      ...variantProps2,
      disableAnimation,
      className
    }),
    [objectToDeps(variantProps2), disableAnimation, className]
  );
  const getLinkProps = reactExports.useCallback(() => {
    return {
      ref: domRef,
      className: styles2,
      "data-focus": dataAttr(isFocused),
      "data-disabled": dataAttr(originalProps.isDisabled),
      "data-focus-visible": dataAttr(isFocusVisible),
      ...mergeProps$3(focusProps, linkProps, otherProps)
    };
  }, [styles2, isFocused, isFocusVisible, focusProps, linkProps, otherProps]);
  return { Component: Component2, children, anchorIcon, showAnchorIcon, getLinkProps };
}
var Link$1 = forwardRef((props, ref) => {
  const {
    Component: Component2,
    children,
    showAnchorIcon,
    anchorIcon = /* @__PURE__ */ jsxRuntimeExports.jsx(LinkIcon, { className: linkAnchorClasses }),
    getLinkProps
  } = useLink({
    ref,
    ...props
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...getLinkProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    children,
    showAnchorIcon && anchorIcon
  ] }) });
});
Link$1.displayName = "HeroUI.Link";
var link_default = Link$1;
var PaginationCursor = forwardRef((props, ref) => {
  const { as: as2, activePage, ...otherProps } = props;
  const Component2 = as2 || "span";
  const domRef = useDOMRef(ref);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ref: domRef, "aria-hidden": true, ...otherProps, children: activePage });
});
PaginationCursor.displayName = "HeroUI.PaginationCursor";
var pagination_cursor_default = PaginationCursor;
const $b5e257d569688ac6$var$defaultContext$9 = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$9 = /* @__PURE__ */ React$5.createContext($b5e257d569688ac6$var$defaultContext$9);
const $b5e257d569688ac6$var$IsSSRContext$9 = /* @__PURE__ */ React$5.createContext(false);
let $b5e257d569688ac6$var$componentIds$9 = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$9(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$9);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$9.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$9.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$9.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$9(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$9);
  let counter = $b5e257d569688ac6$var$useCounter$9(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$9(defaultId) {
  let id2 = React$5.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$9());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$9.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$5["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$9 : $b5e257d569688ac6$var$useLegacySSRSafeId$9;
function $b5e257d569688ac6$var$getSnapshot$9() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$9() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$9(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$9() {
  if (typeof React$5["useSyncExternalStore"] === "function")
    return React$5["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$9, $b5e257d569688ac6$var$getSnapshot$9, $b5e257d569688ac6$var$getServerSnapshot$9);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$9);
}
function $7215afc6de606d6b$export$de79e2c695e052f3$1(element2) {
  if ($7215afc6de606d6b$var$supportsPreventScroll$1())
    element2.focus({
      preventScroll: true
    });
  else {
    let scrollableElements = $7215afc6de606d6b$var$getScrollableElements$1(element2);
    element2.focus();
    $7215afc6de606d6b$var$restoreScrollPosition$1(scrollableElements);
  }
}
let $7215afc6de606d6b$var$supportsPreventScrollCached$1 = null;
function $7215afc6de606d6b$var$supportsPreventScroll$1() {
  if ($7215afc6de606d6b$var$supportsPreventScrollCached$1 == null) {
    $7215afc6de606d6b$var$supportsPreventScrollCached$1 = false;
    try {
      let focusElem = document.createElement("div");
      focusElem.focus({
        get preventScroll() {
          $7215afc6de606d6b$var$supportsPreventScrollCached$1 = true;
          return true;
        }
      });
    } catch {
    }
  }
  return $7215afc6de606d6b$var$supportsPreventScrollCached$1;
}
function $7215afc6de606d6b$var$getScrollableElements$1(element2) {
  let parent = element2.parentNode;
  let scrollableElements = [];
  let rootScrollingElement = document.scrollingElement || document.documentElement;
  while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
    if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth)
      scrollableElements.push({
        element: parent,
        scrollTop: parent.scrollTop,
        scrollLeft: parent.scrollLeft
      });
    parent = parent.parentNode;
  }
  if (rootScrollingElement instanceof HTMLElement)
    scrollableElements.push({
      element: rootScrollingElement,
      scrollTop: rootScrollingElement.scrollTop,
      scrollLeft: rootScrollingElement.scrollLeft
    });
  return scrollableElements;
}
function $7215afc6de606d6b$var$restoreScrollPosition$1(scrollableElements) {
  for (let { element: element2, scrollTop, scrollLeft } of scrollableElements) {
    element2.scrollTop = scrollTop;
    element2.scrollLeft = scrollLeft;
  }
}
function $c87311424ea30a05$var$testUserAgent$2(re2) {
  var _window_navigator_userAgentData;
  if (typeof window === "undefined" || window.navigator == null)
    return false;
  return ((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands.some((brand) => re2.test(brand.brand))) || re2.test(window.navigator.userAgent);
}
function $c87311424ea30a05$var$testPlatform$2(re2) {
  var _window_navigator_userAgentData;
  return typeof window !== "undefined" && window.navigator != null ? re2.test(((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
}
function $c87311424ea30a05$var$cached$2(fn) {
  let res = null;
  return () => {
    if (res == null)
      res = fn();
    return res;
  };
}
const $c87311424ea30a05$export$9ac100e40613ea10$2 = $c87311424ea30a05$var$cached$2(function() {
  return $c87311424ea30a05$var$testPlatform$2(/^Mac/i);
});
const $c87311424ea30a05$export$7bef049ce92e4224$1 = $c87311424ea30a05$var$cached$2(function() {
  return $c87311424ea30a05$var$testPlatform$2(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
  $c87311424ea30a05$export$9ac100e40613ea10$2() && navigator.maxTouchPoints > 1;
});
const $c87311424ea30a05$export$78551043582a6a98$1 = $c87311424ea30a05$var$cached$2(function() {
  return $c87311424ea30a05$var$testUserAgent$2(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e$1();
});
const $c87311424ea30a05$export$6446a186d09e379e$1 = $c87311424ea30a05$var$cached$2(function() {
  return $c87311424ea30a05$var$testUserAgent$2(/Chrome/i);
});
const $c87311424ea30a05$export$b7d78993b74f766d$1 = $c87311424ea30a05$var$cached$2(function() {
  return $c87311424ea30a05$var$testUserAgent$2(/Firefox/i);
});
const $ea8dcbcb9ea1b556$var$RouterContext = /* @__PURE__ */ reactExports.createContext({
  isNative: true,
  open: $ea8dcbcb9ea1b556$var$openSyntheticLink,
  useHref: (href) => href
});
function $ea8dcbcb9ea1b556$export$9a302a45f65d0572() {
  return reactExports.useContext($ea8dcbcb9ea1b556$var$RouterContext);
}
function $ea8dcbcb9ea1b556$export$efa8c9099e530235(link2, modifiers) {
  let target = link2.getAttribute("target");
  return (!target || target === "_self") && link2.origin === location.origin && !link2.hasAttribute("download") && !modifiers.metaKey && // open in new tab (mac)
  !modifiers.ctrlKey && // open in new tab (windows)
  !modifiers.altKey && // download
  !modifiers.shiftKey;
}
function $ea8dcbcb9ea1b556$export$95185d699e05d4d7$1(target, modifiers, setOpening = true) {
  var _window_event_type, _window_event;
  let { metaKey, ctrlKey, altKey, shiftKey } = modifiers;
  if ($c87311424ea30a05$export$b7d78993b74f766d$1() && ((_window_event = window.event) === null || _window_event === void 0 ? void 0 : (_window_event_type = _window_event.type) === null || _window_event_type === void 0 ? void 0 : _window_event_type.startsWith("key")) && target.target === "_blank") {
    if ($c87311424ea30a05$export$9ac100e40613ea10$2())
      metaKey = true;
    else
      ctrlKey = true;
  }
  let event = $c87311424ea30a05$export$78551043582a6a98$1() && $c87311424ea30a05$export$9ac100e40613ea10$2() && !$c87311424ea30a05$export$7bef049ce92e4224$1() && true ? new KeyboardEvent("keydown", {
    keyIdentifier: "Enter",
    metaKey,
    ctrlKey,
    altKey,
    shiftKey
  }) : new MouseEvent("click", {
    metaKey,
    ctrlKey,
    altKey,
    shiftKey,
    bubbles: true,
    cancelable: true
  });
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$1.isOpening = setOpening;
  $7215afc6de606d6b$export$de79e2c695e052f3$1(target);
  target.dispatchEvent(event);
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$1.isOpening = false;
}
$ea8dcbcb9ea1b556$export$95185d699e05d4d7$1.isOpening = false;
function $ea8dcbcb9ea1b556$var$getSyntheticLink(target, open) {
  if (target instanceof HTMLAnchorElement)
    open(target);
  else if (target.hasAttribute("data-href")) {
    let link2 = document.createElement("a");
    link2.href = target.getAttribute("data-href");
    if (target.hasAttribute("data-target"))
      link2.target = target.getAttribute("data-target");
    if (target.hasAttribute("data-rel"))
      link2.rel = target.getAttribute("data-rel");
    if (target.hasAttribute("data-download"))
      link2.download = target.getAttribute("data-download");
    if (target.hasAttribute("data-ping"))
      link2.ping = target.getAttribute("data-ping");
    if (target.hasAttribute("data-referrer-policy"))
      link2.referrerPolicy = target.getAttribute("data-referrer-policy");
    target.appendChild(link2);
    open(link2);
    target.removeChild(link2);
  }
}
function $ea8dcbcb9ea1b556$var$openSyntheticLink(target, modifiers) {
  $ea8dcbcb9ea1b556$var$getSyntheticLink(target, (link2) => $ea8dcbcb9ea1b556$export$95185d699e05d4d7$1(link2, modifiers));
}
const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$2 = typeof document !== "undefined" ? React$5.useLayoutEffect : () => {
};
var $8ae05eaa5c114e9c$var$_React_useInsertionEffect$1;
const $8ae05eaa5c114e9c$var$useEarlyEffect$1 = ($8ae05eaa5c114e9c$var$_React_useInsertionEffect$1 = React$5["useInsertionEffect"]) !== null && $8ae05eaa5c114e9c$var$_React_useInsertionEffect$1 !== void 0 ? $8ae05eaa5c114e9c$var$_React_useInsertionEffect$1 : $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$2;
function $8ae05eaa5c114e9c$export$7f54fc3180508a52$1(fn) {
  const ref = reactExports.useRef(null);
  $8ae05eaa5c114e9c$var$useEarlyEffect$1(() => {
    ref.current = fn;
  }, [
    fn
  ]);
  return reactExports.useCallback((...args) => {
    const f2 = ref.current;
    return f2 === null || f2 === void 0 ? void 0 : f2(...args);
  }, []);
}
let $bdb11010cef70236$export$d41a04c74483c6ef$4 = /* @__PURE__ */ new Map();
if (typeof FinalizationRegistry !== "undefined")
  new FinalizationRegistry((heldValue) => {
    $bdb11010cef70236$export$d41a04c74483c6ef$4.delete(heldValue);
  });
function $bdb11010cef70236$export$cd8c9cb68f842629$4(idA, idB) {
  if (idA === idB)
    return idA;
  let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef$4.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef$4.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function $ff5963eb1fccf552$export$e08e3b67e392101e$4(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks)
      if (typeof callback2 === "function")
        callback2(...args);
  };
}
const $431fbd86ca7dc216$export$b204af158042fbac$1 = (el2) => {
  var _el_ownerDocument;
  return (_el_ownerDocument = el2 === null || el2 === void 0 ? void 0 : el2.ownerDocument) !== null && _el_ownerDocument !== void 0 ? _el_ownerDocument : document;
};
const $431fbd86ca7dc216$export$f21a1ffae260145a$1 = (el2) => {
  if (el2 && "window" in el2 && el2.window === el2)
    return el2;
  const doc = $431fbd86ca7dc216$export$b204af158042fbac$1(el2);
  return doc.defaultView || window;
};
function $431fbd86ca7dc216$var$isNode(value2) {
  return value2 !== null && typeof value2 === "object" && "nodeType" in value2 && typeof value2.nodeType === "number";
}
function $431fbd86ca7dc216$export$af51f0f06c0f328a(node2) {
  return $431fbd86ca7dc216$var$isNode(node2) && node2.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in node2;
}
function $d4ee10de306f2510$export$4282f70798064fe0(node2, otherNode) {
  if (!$f4e2df6bd15f8569$export$98658e8c59125e6a())
    return otherNode && node2 ? node2.contains(otherNode) : false;
  if (!node2 || !otherNode)
    return false;
  let currentNode = otherNode;
  while (currentNode !== null) {
    if (currentNode === node2)
      return true;
    if (currentNode.tagName === "SLOT" && currentNode.assignedSlot)
      currentNode = currentNode.assignedSlot.parentNode;
    else if ($431fbd86ca7dc216$export$af51f0f06c0f328a(currentNode))
      currentNode = currentNode.host;
    else
      currentNode = currentNode.parentNode;
  }
  return false;
}
function $d4ee10de306f2510$export$e58f029f0fbfdb29(event) {
  if ($f4e2df6bd15f8569$export$98658e8c59125e6a() && event.target.shadowRoot) {
    if (event.composedPath)
      return event.composedPath()[0];
  }
  return event.target;
}
function $3ef42575df84b30b$export$9d1611c77c2fe928$4(...args) {
  let result = {
    ...args[0]
  };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90)
        result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e$4(a2, b2);
      else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string")
        result[key] = clsx$3(a2, b2);
      else if (key === "id" && a2 && b2)
        result.id = $bdb11010cef70236$export$cd8c9cb68f842629$4(a2, b2);
      else
        result[key] = b2 !== void 0 ? b2 : a2;
    }
  }
  return result;
}
function $7215afc6de606d6b$export$de79e2c695e052f3(element2) {
  if ($7215afc6de606d6b$var$supportsPreventScroll())
    element2.focus({
      preventScroll: true
    });
  else {
    let scrollableElements = $7215afc6de606d6b$var$getScrollableElements(element2);
    element2.focus();
    $7215afc6de606d6b$var$restoreScrollPosition(scrollableElements);
  }
}
let $7215afc6de606d6b$var$supportsPreventScrollCached = null;
function $7215afc6de606d6b$var$supportsPreventScroll() {
  if ($7215afc6de606d6b$var$supportsPreventScrollCached == null) {
    $7215afc6de606d6b$var$supportsPreventScrollCached = false;
    try {
      let focusElem = document.createElement("div");
      focusElem.focus({
        get preventScroll() {
          $7215afc6de606d6b$var$supportsPreventScrollCached = true;
          return true;
        }
      });
    } catch {
    }
  }
  return $7215afc6de606d6b$var$supportsPreventScrollCached;
}
function $7215afc6de606d6b$var$getScrollableElements(element2) {
  let parent = element2.parentNode;
  let scrollableElements = [];
  let rootScrollingElement = document.scrollingElement || document.documentElement;
  while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
    if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth)
      scrollableElements.push({
        element: parent,
        scrollTop: parent.scrollTop,
        scrollLeft: parent.scrollLeft
      });
    parent = parent.parentNode;
  }
  if (rootScrollingElement instanceof HTMLElement)
    scrollableElements.push({
      element: rootScrollingElement,
      scrollTop: rootScrollingElement.scrollTop,
      scrollLeft: rootScrollingElement.scrollLeft
    });
  return scrollableElements;
}
function $7215afc6de606d6b$var$restoreScrollPosition(scrollableElements) {
  for (let { element: element2, scrollTop, scrollLeft } of scrollableElements) {
    element2.scrollTop = scrollTop;
    element2.scrollLeft = scrollLeft;
  }
}
function $c87311424ea30a05$var$testUserAgent$1(re2) {
  var _window_navigator_userAgentData;
  if (typeof window === "undefined" || window.navigator == null)
    return false;
  let brands = (_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands;
  return Array.isArray(brands) && brands.some((brand) => re2.test(brand.brand)) || re2.test(window.navigator.userAgent);
}
function $c87311424ea30a05$var$testPlatform$1(re2) {
  var _window_navigator_userAgentData;
  return typeof window !== "undefined" && window.navigator != null ? re2.test(((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
}
function $c87311424ea30a05$var$cached$1(fn) {
  let res = null;
  return () => {
    if (res == null)
      res = fn();
    return res;
  };
}
const $c87311424ea30a05$export$9ac100e40613ea10$1 = $c87311424ea30a05$var$cached$1(function() {
  return $c87311424ea30a05$var$testPlatform$1(/^Mac/i);
});
const $c87311424ea30a05$export$186c6964ca17d99 = $c87311424ea30a05$var$cached$1(function() {
  return $c87311424ea30a05$var$testPlatform$1(/^iPhone/i);
});
const $c87311424ea30a05$export$7bef049ce92e4224 = $c87311424ea30a05$var$cached$1(function() {
  return $c87311424ea30a05$var$testPlatform$1(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
  $c87311424ea30a05$export$9ac100e40613ea10$1() && navigator.maxTouchPoints > 1;
});
const $c87311424ea30a05$export$fedb369cb70207f1 = $c87311424ea30a05$var$cached$1(function() {
  return $c87311424ea30a05$export$186c6964ca17d99() || $c87311424ea30a05$export$7bef049ce92e4224();
});
const $c87311424ea30a05$export$78551043582a6a98 = $c87311424ea30a05$var$cached$1(function() {
  return $c87311424ea30a05$var$testUserAgent$1(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e();
});
const $c87311424ea30a05$export$6446a186d09e379e = $c87311424ea30a05$var$cached$1(function() {
  return $c87311424ea30a05$var$testUserAgent$1(/Chrome/i);
});
const $c87311424ea30a05$export$a11b0059900ceec8$1 = $c87311424ea30a05$var$cached$1(function() {
  return $c87311424ea30a05$var$testUserAgent$1(/Android/i);
});
const $c87311424ea30a05$export$b7d78993b74f766d = $c87311424ea30a05$var$cached$1(function() {
  return $c87311424ea30a05$var$testUserAgent$1(/Firefox/i);
});
function $ea8dcbcb9ea1b556$export$95185d699e05d4d7(target, modifiers, setOpening = true) {
  var _window_event_type, _window_event;
  let { metaKey, ctrlKey, altKey, shiftKey } = modifiers;
  if ($c87311424ea30a05$export$b7d78993b74f766d() && ((_window_event = window.event) === null || _window_event === void 0 ? void 0 : (_window_event_type = _window_event.type) === null || _window_event_type === void 0 ? void 0 : _window_event_type.startsWith("key")) && target.target === "_blank") {
    if ($c87311424ea30a05$export$9ac100e40613ea10$1())
      metaKey = true;
    else
      ctrlKey = true;
  }
  let event = $c87311424ea30a05$export$78551043582a6a98() && $c87311424ea30a05$export$9ac100e40613ea10$1() && !$c87311424ea30a05$export$7bef049ce92e4224() && true ? new KeyboardEvent("keydown", {
    keyIdentifier: "Enter",
    metaKey,
    ctrlKey,
    altKey,
    shiftKey
  }) : new MouseEvent("click", {
    metaKey,
    ctrlKey,
    altKey,
    shiftKey,
    bubbles: true,
    cancelable: true
  });
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = setOpening;
  $7215afc6de606d6b$export$de79e2c695e052f3(target);
  target.dispatchEvent(event);
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = false;
}
$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = false;
let $bbed8b41f857bcc0$var$transitionsByElement = /* @__PURE__ */ new Map();
let $bbed8b41f857bcc0$var$transitionCallbacks = /* @__PURE__ */ new Set();
function $bbed8b41f857bcc0$var$setupGlobalEvents() {
  if (typeof window === "undefined")
    return;
  function isTransitionEvent(event) {
    return "propertyName" in event;
  }
  let onTransitionStart = (e2) => {
    if (!isTransitionEvent(e2) || !e2.target)
      return;
    let transitions = $bbed8b41f857bcc0$var$transitionsByElement.get(e2.target);
    if (!transitions) {
      transitions = /* @__PURE__ */ new Set();
      $bbed8b41f857bcc0$var$transitionsByElement.set(e2.target, transitions);
      e2.target.addEventListener("transitioncancel", onTransitionEnd, {
        once: true
      });
    }
    transitions.add(e2.propertyName);
  };
  let onTransitionEnd = (e2) => {
    if (!isTransitionEvent(e2) || !e2.target)
      return;
    let properties2 = $bbed8b41f857bcc0$var$transitionsByElement.get(e2.target);
    if (!properties2)
      return;
    properties2.delete(e2.propertyName);
    if (properties2.size === 0) {
      e2.target.removeEventListener("transitioncancel", onTransitionEnd);
      $bbed8b41f857bcc0$var$transitionsByElement.delete(e2.target);
    }
    if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) {
      for (let cb2 of $bbed8b41f857bcc0$var$transitionCallbacks)
        cb2();
      $bbed8b41f857bcc0$var$transitionCallbacks.clear();
    }
  };
  document.body.addEventListener("transitionrun", onTransitionStart);
  document.body.addEventListener("transitionend", onTransitionEnd);
}
if (typeof document !== "undefined") {
  if (document.readyState !== "loading")
    $bbed8b41f857bcc0$var$setupGlobalEvents();
  else
    document.addEventListener("DOMContentLoaded", $bbed8b41f857bcc0$var$setupGlobalEvents);
}
function $bbed8b41f857bcc0$var$cleanupDetachedElements() {
  for (const [eventTarget] of $bbed8b41f857bcc0$var$transitionsByElement)
    if ("isConnected" in eventTarget && !eventTarget.isConnected)
      $bbed8b41f857bcc0$var$transitionsByElement.delete(eventTarget);
}
function $bbed8b41f857bcc0$export$24490316f764c430(fn) {
  requestAnimationFrame(() => {
    $bbed8b41f857bcc0$var$cleanupDetachedElements();
    if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0)
      fn();
    else
      $bbed8b41f857bcc0$var$transitionCallbacks.add(fn);
  });
}
function $03deb23ff14920c4$export$4eaf04e54aa8eed6() {
  let globalListeners = reactExports.useRef(/* @__PURE__ */ new Map());
  let addGlobalListener = reactExports.useCallback((eventTarget, type4, listener, options) => {
    let fn = (options === null || options === void 0 ? void 0 : options.once) ? (...args) => {
      globalListeners.current.delete(listener);
      listener(...args);
    } : listener;
    globalListeners.current.set(listener, {
      type: type4,
      eventTarget,
      fn,
      options
    });
    eventTarget.addEventListener(type4, fn, options);
  }, []);
  let removeGlobalListener = reactExports.useCallback((eventTarget, type4, listener, options) => {
    var _globalListeners_current_get;
    let fn = ((_globalListeners_current_get = globalListeners.current.get(listener)) === null || _globalListeners_current_get === void 0 ? void 0 : _globalListeners_current_get.fn) || listener;
    eventTarget.removeEventListener(type4, fn, options);
    globalListeners.current.delete(listener);
  }, []);
  let removeAllGlobalListeners = reactExports.useCallback(() => {
    globalListeners.current.forEach((value2, key) => {
      removeGlobalListener(value2.eventTarget, value2.type, key, value2.options);
    });
  }, [
    removeGlobalListener
  ]);
  reactExports.useEffect(() => {
    return removeAllGlobalListeners;
  }, [
    removeAllGlobalListeners
  ]);
  return {
    addGlobalListener,
    removeGlobalListener,
    removeAllGlobalListeners
  };
}
function $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, ref) {
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$2(() => {
    if (context && context.ref && ref) {
      context.ref.current = ref.current;
      return () => {
        if (context.ref)
          context.ref.current = null;
      };
    }
  });
}
function $6a7db85432448f7f$export$60278871457622de$1(event) {
  if (event.mozInputSource === 0 && event.isTrusted)
    return true;
  if ($c87311424ea30a05$export$a11b0059900ceec8$1() && event.pointerType)
    return event.type === "click" && event.buttons === 1;
  return event.detail === 0 && !event.pointerType;
}
function $6a7db85432448f7f$export$29bf1b5f2c56cf63(event) {
  return !$c87311424ea30a05$export$a11b0059900ceec8$1() && event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
}
const $7d2416ea0959daaa$var$supportsCheckVisibility = typeof Element !== "undefined" && "checkVisibility" in Element.prototype;
function $7d2416ea0959daaa$var$isStyleVisible(element2) {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$1(element2);
  if (!(element2 instanceof windowObject.HTMLElement) && !(element2 instanceof windowObject.SVGElement))
    return false;
  let { display, visibility } = element2.style;
  let isVisible2 = display !== "none" && visibility !== "hidden" && visibility !== "collapse";
  if (isVisible2) {
    const { getComputedStyle: getComputedStyle2 } = element2.ownerDocument.defaultView;
    let { display: computedDisplay, visibility: computedVisibility } = getComputedStyle2(element2);
    isVisible2 = computedDisplay !== "none" && computedVisibility !== "hidden" && computedVisibility !== "collapse";
  }
  return isVisible2;
}
function $7d2416ea0959daaa$var$isAttributeVisible(element2, childElement) {
  return !element2.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking.
  !element2.hasAttribute("data-react-aria-prevent-focus") && (element2.nodeName === "DETAILS" && childElement && childElement.nodeName !== "SUMMARY" ? element2.hasAttribute("open") : true);
}
function $7d2416ea0959daaa$export$e989c0fffaa6b27a(element2, childElement) {
  if ($7d2416ea0959daaa$var$supportsCheckVisibility)
    return element2.checkVisibility();
  return element2.nodeName !== "#comment" && $7d2416ea0959daaa$var$isStyleVisible(element2) && $7d2416ea0959daaa$var$isAttributeVisible(element2, childElement) && (!element2.parentElement || $7d2416ea0959daaa$export$e989c0fffaa6b27a(element2.parentElement, element2));
}
const $b4b717babfbb907b$var$focusableElements = [
  "input:not([disabled]):not([type=hidden])",
  "select:not([disabled])",
  "textarea:not([disabled])",
  "button:not([disabled])",
  "a[href]",
  "area[href]",
  "summary",
  "iframe",
  "object",
  "embed",
  "audio[controls]",
  "video[controls]",
  '[contenteditable]:not([contenteditable^="false"])',
  "permission"
];
const $b4b717babfbb907b$var$FOCUSABLE_ELEMENT_SELECTOR = $b4b717babfbb907b$var$focusableElements.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
$b4b717babfbb907b$var$focusableElements.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
function $b4b717babfbb907b$export$4c063cf1350e6fed(element2) {
  return element2.matches($b4b717babfbb907b$var$FOCUSABLE_ELEMENT_SELECTOR) && $7d2416ea0959daaa$export$e989c0fffaa6b27a(element2) && !$b4b717babfbb907b$var$isInert(element2);
}
function $b4b717babfbb907b$var$isInert(element2) {
  let node2 = element2;
  while (node2 != null) {
    if (node2 instanceof node2.ownerDocument.defaultView.HTMLElement && node2.inert)
      return true;
    node2 = node2.parentElement;
  }
  return false;
}
function $8a9cb279dc87e130$export$525bc4921d56d4a$8(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$7(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$cabe61c495ee3649$6(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$1(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$6 = "default";
let $14c0b72509d70225$var$savedUserSelect$6 = "";
let $14c0b72509d70225$var$modifiedElementMap$6 = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$6(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1()) {
    if ($14c0b72509d70225$var$state$6 === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$1(target);
      $14c0b72509d70225$var$savedUserSelect$6 = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$6 = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$6.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$6(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1()) {
    if ($14c0b72509d70225$var$state$6 !== "disabled")
      return;
    $14c0b72509d70225$var$state$6 = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430(() => {
        if ($14c0b72509d70225$var$state$6 === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$1(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$6 || "";
          $14c0b72509d70225$var$savedUserSelect$6 = "";
          $14c0b72509d70225$var$state$6 = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$6.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$6.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$6.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$6 = React$5.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$6.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext$6(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$6);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$4(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$6 = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$6 = class $f6c31cce2adf654f$var$PressEvent6 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$6, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$6);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$6, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$6, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$6 = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$6 = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$6 = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$6(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$6(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$1((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$6("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$1((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$6("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$6("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$1((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$6("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$1((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$6(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$6(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$1((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$1((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$1((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$7(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$8(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$6(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$6($d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$6(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$6(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$1(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$4(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$1())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$1(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$6(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$6(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$6(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$6($d4ee10de306f2510$export$e58f029f0fbfdb29(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$6(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$6(state.target) && $d4ee10de306f2510$export$4282f70798064fe0(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$6]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$6] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$6(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$1(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$1(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$6(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$6(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$6(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$1(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$6))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$6;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$6}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$6((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$4(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$6]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$6(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$6(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$1(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$6(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$1(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$6(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$6(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$6(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$6(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$6(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$6(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$6(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$6 = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$6(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$6.has(target.type);
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$c = false;
let $6179b936705e76d3$var$hoverCount$c = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$c() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$c = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$c = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$c(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$c();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$c() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$c);
  $6179b936705e76d3$var$hoverCount$c++;
  return () => {
    $6179b936705e76d3$var$hoverCount$c--;
    if ($6179b936705e76d3$var$hoverCount$c > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$c);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$c(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$c, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$1(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$c && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
function usePaginationItem(props) {
  const {
    as: as2,
    ref,
    value: value2,
    children,
    isActive: isActive2,
    isDisabled,
    onPress,
    onClick,
    getAriaLabel,
    className,
    ...otherProps
  } = props;
  const isLink = !!(props == null ? void 0 : props.href);
  const Component2 = as2 || isLink ? "a" : "li";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572();
  const ariaLabel = reactExports.useMemo(
    () => isActive2 ? `${getAriaLabel == null ? void 0 : getAriaLabel(value2)} active` : getAriaLabel == null ? void 0 : getAriaLabel(value2),
    [value2, isActive2]
  );
  const { isPressed, pressProps } = $f6c31cce2adf654f$export$45712eceda6fad21$6({
    isDisabled,
    onPress
  });
  const { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({});
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$c({ isDisabled });
  const getItemProps = (props2 = {}) => {
    return {
      ref: domRef,
      role: "button",
      tabIndex: isDisabled ? -1 : 0,
      "aria-label": ariaLabel,
      "aria-current": dataAttr(isActive2),
      "aria-disabled": dataAttr(isDisabled),
      "data-disabled": dataAttr(isDisabled),
      "data-active": dataAttr(isActive2),
      "data-focus": dataAttr(isFocused),
      "data-hover": dataAttr(isHovered),
      "data-pressed": dataAttr(isPressed),
      "data-focus-visible": dataAttr(isFocusVisible),
      ...mergeProps$3(
        props2,
        pressProps,
        focusProps,
        hoverProps,
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        })
      ),
      className: clsx$4(className, props2.className),
      onClick: (e2) => {
        chain(pressProps == null ? void 0 : pressProps.onClick, onClick)(e2);
        if (!router.isNative && e2.currentTarget instanceof HTMLAnchorElement && e2.currentTarget.href && // If props are applied to a router Link component, it may have already prevented default.
        !e2.isDefaultPrevented() && $ea8dcbcb9ea1b556$export$efa8c9099e530235(e2.currentTarget, e2) && props2.href) {
          e2.preventDefault();
          router.open(e2.currentTarget, e2, props2.href, props2.routerOptions);
        }
      }
    };
  };
  return {
    Component: Component2,
    children,
    ariaLabel,
    isFocused,
    isFocusVisible,
    getItemProps
  };
}
var PaginationItem = forwardRef((props, ref) => {
  const { Component: Component2, children, getItemProps } = usePaginationItem({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...getItemProps(), children });
});
PaginationItem.displayName = "HeroUI.PaginationItem";
var pagination_item_default = PaginationItem;
const $148a7a147e38ea7f$var$RTL_SCRIPTS$8 = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS$8 = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764$8(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS$8.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS$8.has(lang2);
}
const $b5e257d569688ac6$var$defaultContext$8 = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$8 = /* @__PURE__ */ React$5.createContext($b5e257d569688ac6$var$defaultContext$8);
const $b5e257d569688ac6$var$IsSSRContext$8 = /* @__PURE__ */ React$5.createContext(false);
let $b5e257d569688ac6$var$componentIds$8 = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$8(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$8);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$8.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$8.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$8.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$8(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$8);
  let counter = $b5e257d569688ac6$var$useCounter$8(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$8(defaultId) {
  let id2 = React$5.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$8());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$8.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$5["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$8 : $b5e257d569688ac6$var$useLegacySSRSafeId$8;
function $b5e257d569688ac6$var$getSnapshot$8() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$8() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$8(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$8() {
  if (typeof React$5["useSyncExternalStore"] === "function")
    return React$5["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$8, $b5e257d569688ac6$var$getSnapshot$8, $b5e257d569688ac6$var$getServerSnapshot$8);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$8);
}
const $1e5a04cdaf7d1af8$var$localeSymbol$8 = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$8() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol$8] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764$8(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale$8 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$8();
let $1e5a04cdaf7d1af8$var$listeners$8 = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale$8() {
  $1e5a04cdaf7d1af8$var$currentLocale$8 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$8();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners$8)
    listener($1e5a04cdaf7d1af8$var$currentLocale$8);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$8() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$8();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale$8);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners$8.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$8);
    $1e5a04cdaf7d1af8$var$listeners$8.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners$8.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners$8.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$8);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext$8 = /* @__PURE__ */ React$5.createContext(null);
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$8() {
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$8();
  let context = reactExports.useContext($18f2051aff69b9bf$var$I18nContext$8);
  return context || defaultLocale;
}
var PaginationItemType = /* @__PURE__ */ ((PaginationItemType2) => {
  PaginationItemType2["DOTS"] = "dots";
  PaginationItemType2["PREV"] = "prev";
  PaginationItemType2["NEXT"] = "next";
  return PaginationItemType2;
})(PaginationItemType || {});
function usePagination$1(props) {
  const {
    page,
    total,
    siblings = 1,
    boundaries = 1,
    initialPage = 1,
    showControls = false,
    onChange
  } = props;
  const [activePage, setActivePage] = reactExports.useState(page || initialPage);
  const { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$8();
  const isRTL = direction === "rtl";
  const onChangeActivePage = (newPage) => {
    setActivePage(newPage);
    onChange && onChange(newPage);
  };
  reactExports.useEffect(() => {
    if (page && page !== activePage) {
      setActivePage(page);
    }
  }, [page]);
  const setPage = reactExports.useCallback(
    (pageNumber) => {
      if (pageNumber <= 0) {
        onChangeActivePage(1);
      } else if (pageNumber > total) {
        onChangeActivePage(total);
      } else {
        onChangeActivePage(pageNumber);
      }
    },
    [total, activePage, onChangeActivePage]
  );
  const next2 = () => setPage(activePage + 1);
  const previous2 = () => setPage(activePage - 1);
  const first = () => setPage(1);
  const last = () => setPage(total);
  const formatRange = reactExports.useCallback(
    (range22) => {
      if (showControls) {
        return [
          "prev",
          ...range22,
          "next"
          /* NEXT */
        ];
      }
      return range22;
    },
    [isRTL, showControls]
  );
  const paginationRange = reactExports.useMemo(() => {
    const totalPageNumbers = siblings * 2 + 3 + boundaries * 2;
    if (totalPageNumbers >= total) {
      return formatRange(range$1(1, total));
    }
    const leftSiblingIndex = Math.max(activePage - siblings, boundaries);
    const rightSiblingIndex = Math.min(activePage + siblings, total - boundaries);
    const shouldShowLeftDots = leftSiblingIndex > boundaries + 2;
    const shouldShowRightDots = rightSiblingIndex < total - (boundaries + 1);
    if (!shouldShowLeftDots && shouldShowRightDots) {
      const leftItemCount = siblings * 2 + boundaries + 2;
      return formatRange([
        ...range$1(1, leftItemCount),
        "dots",
        ...range$1(total - (boundaries - 1), total)
      ]);
    }
    if (shouldShowLeftDots && !shouldShowRightDots) {
      const rightItemCount = boundaries + 1 + 2 * siblings;
      return formatRange([
        ...range$1(1, boundaries),
        "dots",
        ...range$1(total - rightItemCount, total)
      ]);
    }
    return formatRange([
      ...range$1(1, boundaries),
      "dots",
      ...range$1(leftSiblingIndex, rightSiblingIndex),
      "dots",
      ...range$1(total - boundaries + 1, total)
    ]);
  }, [total, activePage, siblings, boundaries, formatRange]);
  return {
    range: paginationRange,
    activePage,
    setPage,
    next: next2,
    previous: previous2,
    first,
    last
  };
}
const t$8 = (t2) => "object" == typeof t2 && null != t2 && 1 === t2.nodeType, e$4 = (t2, e2) => (!e2 || "hidden" !== t2) && ("visible" !== t2 && "clip" !== t2), n$6 = (t2, n2) => {
  if (t2.clientHeight < t2.scrollHeight || t2.clientWidth < t2.scrollWidth) {
    const o2 = getComputedStyle(t2, null);
    return e$4(o2.overflowY, n2) || e$4(o2.overflowX, n2) || ((t3) => {
      const e2 = ((t4) => {
        if (!t4.ownerDocument || !t4.ownerDocument.defaultView)
          return null;
        try {
          return t4.ownerDocument.defaultView.frameElement;
        } catch (t5) {
          return null;
        }
      })(t3);
      return !!e2 && (e2.clientHeight < t3.scrollHeight || e2.clientWidth < t3.scrollWidth);
    })(t2);
  }
  return false;
}, o$3 = (t2, e2, n2, o2, l2, r2, i2, s2) => r2 < t2 && i2 > e2 || r2 > t2 && i2 < e2 ? 0 : r2 <= t2 && s2 <= n2 || i2 >= e2 && s2 >= n2 ? r2 - t2 - o2 : i2 > e2 && s2 < n2 || r2 < t2 && s2 > n2 ? i2 - e2 + l2 : 0, l$7 = (t2) => {
  const e2 = t2.parentElement;
  return null == e2 ? t2.getRootNode().host || null : e2;
}, r$6 = (e2, r2) => {
  var i2, s2, d2, h3;
  if ("undefined" == typeof document)
    return [];
  const { scrollMode: c2, block: f2, inline: u2, boundary: a2, skipOverflowHiddenElements: g2 } = r2, p2 = "function" == typeof a2 ? a2 : (t2) => t2 !== a2;
  if (!t$8(e2))
    throw new TypeError("Invalid target");
  const m2 = document.scrollingElement || document.documentElement, w2 = [];
  let W2 = e2;
  for (; t$8(W2) && p2(W2); ) {
    if (W2 = l$7(W2), W2 === m2) {
      w2.push(W2);
      break;
    }
    null != W2 && W2 === document.body && n$6(W2) && !n$6(document.documentElement) || null != W2 && n$6(W2, g2) && w2.push(W2);
  }
  const b2 = null != (s2 = null == (i2 = window.visualViewport) ? void 0 : i2.width) ? s2 : innerWidth, H2 = null != (h3 = null == (d2 = window.visualViewport) ? void 0 : d2.height) ? h3 : innerHeight, { scrollX: y2, scrollY: M2 } = window, { height: v2, width: E2, top: x2, right: C2, bottom: I2, left: R2 } = e2.getBoundingClientRect(), { top: T2, right: B2, bottom: F2, left: V3 } = ((t2) => {
    const e3 = window.getComputedStyle(t2);
    return { top: parseFloat(e3.scrollMarginTop) || 0, right: parseFloat(e3.scrollMarginRight) || 0, bottom: parseFloat(e3.scrollMarginBottom) || 0, left: parseFloat(e3.scrollMarginLeft) || 0 };
  })(e2);
  let k2 = "start" === f2 || "nearest" === f2 ? x2 - T2 : "end" === f2 ? I2 + F2 : x2 + v2 / 2 - T2 + F2, D2 = "center" === u2 ? R2 + E2 / 2 - V3 + B2 : "end" === u2 ? C2 + B2 : R2 - V3;
  const L2 = [];
  for (let t2 = 0; t2 < w2.length; t2++) {
    const e3 = w2[t2], { height: l2, width: r3, top: i3, right: s3, bottom: d3, left: h4 } = e3.getBoundingClientRect();
    if ("if-needed" === c2 && x2 >= 0 && R2 >= 0 && I2 <= H2 && C2 <= b2 && (e3 === m2 && !n$6(e3) || x2 >= i3 && I2 <= d3 && R2 >= h4 && C2 <= s3))
      return L2;
    const a3 = getComputedStyle(e3), g3 = parseInt(a3.borderLeftWidth, 10), p3 = parseInt(a3.borderTopWidth, 10), W3 = parseInt(a3.borderRightWidth, 10), T3 = parseInt(a3.borderBottomWidth, 10);
    let B3 = 0, F3 = 0;
    const V4 = "offsetWidth" in e3 ? e3.offsetWidth - e3.clientWidth - g3 - W3 : 0, S2 = "offsetHeight" in e3 ? e3.offsetHeight - e3.clientHeight - p3 - T3 : 0, X2 = "offsetWidth" in e3 ? 0 === e3.offsetWidth ? 0 : r3 / e3.offsetWidth : 0, Y2 = "offsetHeight" in e3 ? 0 === e3.offsetHeight ? 0 : l2 / e3.offsetHeight : 0;
    if (m2 === e3)
      B3 = "start" === f2 ? k2 : "end" === f2 ? k2 - H2 : "nearest" === f2 ? o$3(M2, M2 + H2, H2, p3, T3, M2 + k2, M2 + k2 + v2, v2) : k2 - H2 / 2, F3 = "start" === u2 ? D2 : "center" === u2 ? D2 - b2 / 2 : "end" === u2 ? D2 - b2 : o$3(y2, y2 + b2, b2, g3, W3, y2 + D2, y2 + D2 + E2, E2), B3 = Math.max(0, B3 + M2), F3 = Math.max(0, F3 + y2);
    else {
      B3 = "start" === f2 ? k2 - i3 - p3 : "end" === f2 ? k2 - d3 + T3 + S2 : "nearest" === f2 ? o$3(i3, d3, l2, p3, T3 + S2, k2, k2 + v2, v2) : k2 - (i3 + l2 / 2) + S2 / 2, F3 = "start" === u2 ? D2 - h4 - g3 : "center" === u2 ? D2 - (h4 + r3 / 2) + V4 / 2 : "end" === u2 ? D2 - s3 + W3 + V4 : o$3(h4, s3, r3, g3, W3 + V4, D2, D2 + E2, E2);
      const { scrollLeft: t3, scrollTop: n2 } = e3;
      B3 = 0 === Y2 ? 0 : Math.max(0, Math.min(n2 + B3 / Y2, e3.scrollHeight - l2 / Y2 + S2)), F3 = 0 === X2 ? 0 : Math.max(0, Math.min(t3 + F3 / X2, e3.scrollWidth - r3 / X2 + V4)), k2 += n2 - B3, D2 += t3 - F3;
    }
    L2.push({ el: e3, top: B3, left: F3 });
  }
  return L2;
};
const o$2 = (e2) => false === e2 ? { block: "end", inline: "nearest" } : ((e3) => e3 === Object(e3) && 0 !== Object.keys(e3).length)(e2) ? e2 : { block: "start", inline: "nearest" };
function t$7(t2, n2) {
  if (!t2.isConnected || !((e2) => {
    let o2 = e2;
    for (; o2 && o2.parentNode; ) {
      if (o2.parentNode === document)
        return true;
      o2 = o2.parentNode instanceof ShadowRoot ? o2.parentNode.host : o2.parentNode;
    }
    return false;
  })(t2))
    return;
  if (((e2) => "object" == typeof e2 && "function" == typeof e2.behavior)(n2))
    return n2.behavior(r$6(t2, n2));
  const r2 = "boolean" == typeof n2 || null == n2 ? void 0 : n2.behavior;
  for (const { el: i2, top: a2, left: l2 } of r$6(t2, o$2(n2)))
    i2.scroll({ top: a2, left: l2, behavior: r2 });
}
function useIntersectionObserver({
  threshold = 0,
  root: root2 = null,
  rootMargin = "0%",
  isEnabled = true,
  freezeOnceVisible = false,
  initialIsIntersecting = false,
  onChange
} = {}) {
  var _a2;
  const [ref, setRef2] = reactExports.useState(null);
  const [state, setState] = reactExports.useState(() => ({
    isIntersecting: initialIsIntersecting,
    entry: void 0
  }));
  const callbackRef = reactExports.useRef();
  callbackRef.current = onChange;
  const frozen = ((_a2 = state.entry) == null ? void 0 : _a2.isIntersecting) && freezeOnceVisible;
  reactExports.useEffect(() => {
    if (!isEnabled)
      return;
    if (!ref)
      return;
    if (!("IntersectionObserver" in window))
      return;
    if (frozen)
      return;
    const observer = new IntersectionObserver(
      (entries) => {
        const thresholds2 = Array.isArray(observer.thresholds) ? observer.thresholds : [observer.thresholds];
        entries.forEach((entry) => {
          const isIntersecting = entry.isIntersecting && thresholds2.some((threshold2) => entry.intersectionRatio >= threshold2);
          setState({ isIntersecting, entry });
          if (callbackRef.current) {
            callbackRef.current(isIntersecting, entry);
          }
        });
      },
      { threshold, root: root2, rootMargin }
    );
    observer.observe(ref);
    return () => {
      observer.disconnect();
    };
  }, [ref, isEnabled, JSON.stringify(threshold), root2, rootMargin, frozen, freezeOnceVisible]);
  const prevRef = reactExports.useRef(null);
  reactExports.useEffect(() => {
    var _a22;
    if (!ref && ((_a22 = state.entry) == null ? void 0 : _a22.target) && !freezeOnceVisible && !frozen && prevRef.current !== state.entry.target) {
      prevRef.current = state.entry.target;
      setState({ isIntersecting: initialIsIntersecting, entry: void 0 });
    }
  }, [ref, state.entry, freezeOnceVisible, frozen, initialIsIntersecting]);
  const result = [setRef2, !!state.isIntersecting, state.entry];
  result.ref = result[0];
  result.isIntersecting = result[1];
  result.entry = result[2];
  return result;
}
var CURSOR_TRANSITION_TIMEOUT = 300;
function usePagination(originalProps) {
  var _a2, _b2, _c2, _d;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, pagination.variantKeys);
  const {
    as: as2,
    ref,
    classNames: classNames2,
    dotsJump = 5,
    loop: loop2 = false,
    showControls = false,
    total = 1,
    initialPage = 1,
    page,
    siblings,
    boundaries,
    onChange,
    className,
    renderItem: renderItem2,
    getItemAriaLabel: getItemAriaLabelProp,
    ...otherProps
  } = props;
  const Component2 = as2 || "nav";
  const domRef = useDOMRef(ref);
  const cursorRef = reactExports.useRef(null);
  const itemsRef = reactExports.useRef();
  const cursorTimer = reactExports.useRef();
  const disableAnimation = (_b2 = (_a2 = originalProps == null ? void 0 : originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const disableCursorAnimation = (_d = (_c2 = originalProps == null ? void 0 : originalProps.disableCursorAnimation) != null ? _c2 : disableAnimation) != null ? _d : false;
  function getItemsRefMap() {
    if (!itemsRef.current) {
      itemsRef.current = /* @__PURE__ */ new Map();
    }
    return itemsRef.current;
  }
  function getItemRef(node2, value2) {
    const map2 = getItemsRefMap();
    if (node2) {
      map2.set(value2, node2);
    } else {
      map2.delete(value2);
    }
  }
  function scrollTo(value2, skipAnimation) {
    const map2 = getItemsRefMap();
    const node2 = map2.get(value2);
    if (!node2 || !cursorRef.current)
      return;
    cursorTimer.current && clearTimeout(cursorTimer.current);
    t$7(node2, {
      scrollMode: "always",
      behavior: "smooth",
      block: "start",
      inline: "start",
      boundary: domRef.current
    });
    const { offsetLeft } = node2;
    if (skipAnimation) {
      cursorRef.current.setAttribute("data-moving", "false");
      cursorRef.current.style.transform = `translateX(${offsetLeft}px) scale(1)`;
      return;
    }
    cursorRef.current.setAttribute("data-moving", "true");
    cursorRef.current.style.transform = `translateX(${offsetLeft}px) scale(1.1)`;
    cursorTimer.current = setTimeout(() => {
      if (cursorRef.current) {
        cursorRef.current.style.transform = `translateX(${offsetLeft}px) scale(1)`;
      }
      cursorTimer.current = setTimeout(() => {
        var _a22;
        (_a22 = cursorRef.current) == null ? void 0 : _a22.setAttribute("data-moving", "false");
        cursorTimer.current && clearTimeout(cursorTimer.current);
      }, CURSOR_TRANSITION_TIMEOUT);
    }, CURSOR_TRANSITION_TIMEOUT);
  }
  const { range: range3, activePage, setPage, previous: previous2, next: next2, first, last } = usePagination$1({
    page,
    total,
    initialPage,
    siblings,
    boundaries,
    showControls,
    onChange
  });
  const [setRef2, isVisible2] = useIntersectionObserver();
  reactExports.useEffect(() => {
    if (domRef.current) {
      setRef2(domRef.current);
    }
  }, [domRef.current]);
  const activePageRef = reactExports.useRef(activePage);
  reactExports.useEffect(() => {
    if (activePage && !disableAnimation && isVisible2) {
      scrollTo(activePage, activePage === activePageRef.current);
    }
    activePageRef.current = activePage;
  }, [
    page,
    activePage,
    disableAnimation,
    disableCursorAnimation,
    isVisible2,
    originalProps.dotsJump,
    originalProps.isCompact,
    originalProps.showControls
  ]);
  const slots = reactExports.useMemo(
    () => pagination({
      ...variantProps2,
      disableAnimation,
      disableCursorAnimation
    }),
    [objectToDeps(variantProps2), disableCursorAnimation, disableAnimation]
  );
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const onNext = () => {
    if (loop2 && activePage === total) {
      return first();
    }
    return next2();
  };
  const onPrevious = () => {
    if (loop2 && activePage === 1) {
      return last();
    }
    return previous2();
  };
  const getBaseProps = (props2 = {}) => {
    return {
      ...props2,
      ref: domRef,
      role: "navigation",
      "aria-label": props2["aria-label"] || "pagination navigation",
      "data-slot": "base",
      "data-controls": dataAttr(showControls),
      "data-loop": dataAttr(loop2),
      "data-dots-jump": dotsJump,
      "data-total": total,
      "data-active-page": activePage,
      className: slots.base({ class: clsx$4(baseStyles, props2 == null ? void 0 : props2.className) }),
      ...otherProps
    };
  };
  const getWrapperProps = (props2 = {}) => {
    return {
      ...props2,
      "data-slot": "wrapper",
      className: slots.wrapper({ class: clsx$4(classNames2 == null ? void 0 : classNames2.wrapper, props2 == null ? void 0 : props2.className) })
    };
  };
  const getItemAriaLabel = (page2) => {
    if (!page2)
      return;
    if (getItemAriaLabelProp) {
      return getItemAriaLabelProp(page2);
    }
    switch (page2) {
      case PaginationItemType.DOTS:
        return "dots element";
      case PaginationItemType.PREV:
        return "previous page button";
      case PaginationItemType.NEXT:
        return "next page button";
      case "first":
        return "first page button";
      case "last":
        return "last page button";
      default:
        return `pagination item ${page2}`;
    }
  };
  const getItemProps = (props2 = {}) => {
    return {
      ...props2,
      ref: (node2) => getItemRef(node2, props2.value),
      "data-slot": "item",
      isActive: props2.value === activePage,
      className: slots.item({ class: clsx$4(classNames2 == null ? void 0 : classNames2.item, props2 == null ? void 0 : props2.className) }),
      onPress: () => {
        if (props2.value !== activePage) {
          setPage(props2.value);
        }
      }
    };
  };
  const getCursorProps = (props2 = {}) => {
    return {
      ...props2,
      ref: cursorRef,
      activePage,
      "data-slot": "cursor",
      className: slots.cursor({ class: clsx$4(classNames2 == null ? void 0 : classNames2.cursor, props2 == null ? void 0 : props2.className) })
    };
  };
  return {
    Component: Component2,
    showControls,
    dotsJump,
    slots,
    classNames: classNames2,
    loop: loop2,
    total,
    range: range3,
    activePage,
    getItemRef,
    disableAnimation,
    disableCursorAnimation,
    setPage,
    onPrevious,
    onNext,
    renderItem: renderItem2,
    getBaseProps,
    getWrapperProps,
    getItemProps,
    getCursorProps,
    getItemAriaLabel
  };
}
const $148a7a147e38ea7f$var$RTL_SCRIPTS$7 = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS$7 = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764$7(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS$7.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS$7.has(lang2);
}
const $1e5a04cdaf7d1af8$var$localeSymbol$7 = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$7() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol$7] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764$7(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale$7 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$7();
let $1e5a04cdaf7d1af8$var$listeners$7 = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale$7() {
  $1e5a04cdaf7d1af8$var$currentLocale$7 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$7();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners$7)
    listener($1e5a04cdaf7d1af8$var$currentLocale$7);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$7() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$9();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale$7);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners$7.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$7);
    $1e5a04cdaf7d1af8$var$listeners$7.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners$7.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners$7.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$7);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext$7 = /* @__PURE__ */ React$5.createContext(null);
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$7() {
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$7();
  let context = reactExports.useContext($18f2051aff69b9bf$var$I18nContext$7);
  return context || defaultLocale;
}
var Pagination = forwardRef((props, ref) => {
  const {
    Component: Component2,
    dotsJump,
    slots,
    classNames: classNames2,
    total,
    range: range3,
    loop: loop2,
    activePage,
    disableCursorAnimation,
    disableAnimation,
    renderItem: renderItemProp,
    onNext,
    onPrevious,
    setPage,
    getItemAriaLabel,
    getItemRef,
    getBaseProps,
    getWrapperProps,
    getItemProps,
    getCursorProps
  } = usePagination({ ...props, ref });
  const { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$7();
  const isRTL = direction === "rtl";
  const renderChevronIcon = reactExports.useCallback(
    (key) => {
      if (key === PaginationItemType.PREV && !isRTL || key === PaginationItemType.NEXT && isRTL) {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronIcon, {});
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        ChevronIcon,
        {
          className: slots.chevronNext({
            class: classNames2 == null ? void 0 : classNames2.chevronNext
          })
        }
      );
    },
    [slots, isRTL]
  );
  const renderPrevItem = reactExports.useCallback(
    (value2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        pagination_item_default,
        {
          className: slots.prev({
            class: classNames2 == null ? void 0 : classNames2.prev
          }),
          "data-slot": "prev",
          getAriaLabel: getItemAriaLabel,
          isDisabled: !loop2 && activePage === 1,
          value: value2,
          onPress: onPrevious,
          children: renderChevronIcon(PaginationItemType.PREV)
        },
        PaginationItemType.PREV
      );
    },
    [slots, classNames2, loop2, activePage, isRTL, total, getItemAriaLabel, onPrevious]
  );
  const renderNextItem = reactExports.useCallback(
    (value2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        pagination_item_default,
        {
          className: slots.next({
            class: clsx$4(classNames2 == null ? void 0 : classNames2.next)
          }),
          "data-slot": "next",
          getAriaLabel: getItemAriaLabel,
          isDisabled: !loop2 && activePage === total,
          value: value2,
          onPress: onNext,
          children: renderChevronIcon(PaginationItemType.NEXT)
        },
        PaginationItemType.NEXT
      );
    },
    [slots, classNames2, loop2, activePage, isRTL, total, getItemAriaLabel, onNext]
  );
  const renderItem2 = reactExports.useCallback(
    (value2, index2) => {
      const isBefore2 = index2 < range3.indexOf(activePage);
      if (renderItemProp && typeof renderItemProp === "function") {
        let page = typeof value2 == "number" ? value2 : index2;
        if (value2 === PaginationItemType.NEXT) {
          page = activePage + 1;
        }
        if (value2 === PaginationItemType.PREV) {
          page = activePage - 1;
        }
        if (value2 === PaginationItemType.DOTS) {
          page = isBefore2 ? activePage - dotsJump >= 1 ? activePage - dotsJump : 1 : activePage + dotsJump <= total ? activePage + dotsJump : total;
        }
        const itemChildren = {
          [PaginationItemType.PREV]: renderChevronIcon(PaginationItemType.PREV),
          [PaginationItemType.NEXT]: renderChevronIcon(PaginationItemType.NEXT),
          [PaginationItemType.DOTS]: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(EllipsisIcon, { className: slots == null ? void 0 : slots.ellipsis({ class: classNames2 == null ? void 0 : classNames2.ellipsis }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              ForwardIcon,
              {
                className: slots == null ? void 0 : slots.forwardIcon({ class: classNames2 == null ? void 0 : classNames2.forwardIcon }),
                "data-before": dataAttr(isBefore2)
              }
            )
          ] })
        };
        return renderItemProp({
          value: value2,
          index: index2,
          key: `${value2}-${index2}`,
          page,
          total,
          children: typeof value2 === "number" ? value2 : itemChildren[value2],
          activePage,
          dotsJump,
          isBefore: isBefore2,
          isActive: value2 === activePage,
          isPrevious: value2 === activePage - 1,
          isNext: value2 === activePage + 1,
          isFirst: value2 === 1,
          isLast: value2 === total,
          onNext,
          onPrevious,
          setPage,
          onPress: () => setPage(page),
          ref: typeof value2 === "number" ? (node2) => getItemRef(node2, value2) : void 0,
          className: slots.item({ class: classNames2 == null ? void 0 : classNames2.item }),
          getAriaLabel: getItemAriaLabel
        });
      }
      if (value2 === PaginationItemType.PREV) {
        return renderPrevItem(value2);
      }
      if (value2 === PaginationItemType.NEXT) {
        return renderNextItem(value2);
      }
      if (value2 === PaginationItemType.DOTS) {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(
          pagination_item_default,
          {
            className: slots.item({
              class: clsx$4(classNames2 == null ? void 0 : classNames2.item, "group")
            }),
            "data-slot": "item",
            getAriaLabel: getItemAriaLabel,
            value: value2,
            onPress: () => isBefore2 ? setPage(activePage - dotsJump >= 1 ? activePage - dotsJump : 1) : setPage(activePage + dotsJump <= total ? activePage + dotsJump : total),
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(EllipsisIcon, { className: slots == null ? void 0 : slots.ellipsis({ class: classNames2 == null ? void 0 : classNames2.ellipsis }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                ForwardIcon,
                {
                  className: slots == null ? void 0 : slots.forwardIcon({ class: classNames2 == null ? void 0 : classNames2.forwardIcon }),
                  "data-before": dataAttr(isRTL ? !isBefore2 : isBefore2)
                }
              )
            ]
          },
          PaginationItemType.DOTS + isBefore2
        );
      }
      return /* @__PURE__ */ reactExports.createElement(pagination_item_default, { ...getItemProps({ value: value2 }), key: value2, getAriaLabel: getItemAriaLabel }, value2);
    },
    [
      isRTL,
      activePage,
      dotsJump,
      getItemProps,
      loop2,
      range3,
      renderItemProp,
      slots,
      classNames2,
      total,
      getItemAriaLabel,
      onNext,
      onPrevious,
      setPage,
      renderPrevItem,
      renderNextItem
    ]
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...getBaseProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { ...getWrapperProps(), children: [
    !disableCursorAnimation && !disableAnimation && /* @__PURE__ */ jsxRuntimeExports.jsx(pagination_cursor_default, { ...getCursorProps() }),
    range3.map(renderItem2)
  ] }) });
});
Pagination.displayName = "HeroUI.Pagination";
var pagination_default = Pagination;
let $a54cdc5c1942b639$var$instance = Math.round(Math.random() * 1e10);
let $a54cdc5c1942b639$var$i = 0;
function $a54cdc5c1942b639$export$bca9d026f8e704eb(props) {
  let name2 = reactExports.useMemo(() => props.name || `radio-group-${$a54cdc5c1942b639$var$instance}-${++$a54cdc5c1942b639$var$i}`, [
    props.name
  ]);
  var _props_defaultValue;
  let [selectedValue, setSelected] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : null, props.onChange);
  let [lastFocusedValue, setLastFocusedValue] = reactExports.useState(null);
  let validation = $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1({
    ...props,
    value: selectedValue
  });
  let setSelectedValue = (value2) => {
    if (!props.isReadOnly && !props.isDisabled) {
      setSelected(value2);
      validation.commitValidation();
    }
  };
  let isInvalid = validation.displayValidation.isInvalid;
  return {
    ...validation,
    name: name2,
    selectedValue,
    setSelectedValue,
    lastFocusedValue,
    setLastFocusedValue,
    isDisabled: props.isDisabled || false,
    isReadOnly: props.isReadOnly || false,
    isRequired: props.isRequired || false,
    validationState: props.validationState || (isInvalid ? "invalid" : null),
    isInvalid
  };
}
const $884aeceb3d67f00f$export$37b65e5b5444d35c = /* @__PURE__ */ new WeakMap();
function $0d5c49892c1215da$export$37b0961d2f4751e2(props, state, ref) {
  let { value: value2, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby } = props;
  const isDisabled = props.isDisabled || state.isDisabled;
  let checked = state.selectedValue === value2;
  let onChange = (e2) => {
    e2.stopPropagation();
    state.setSelectedValue(value2);
  };
  let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    isDisabled
  });
  let { pressProps: labelProps, isPressed: isLabelPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    isDisabled,
    onPress() {
      var _ref_current;
      state.setSelectedValue(value2);
      (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.focus();
    }
  });
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2($3ef42575df84b30b$export$9d1611c77c2fe928$9(props, {
    onFocus: () => state.setLastFocusedValue(value2)
  }), ref);
  let interactions = $3ef42575df84b30b$export$9d1611c77c2fe928$9(pressProps, focusableProps);
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  let tabIndex = -1;
  if (state.selectedValue != null) {
    if (state.selectedValue === value2)
      tabIndex = 0;
  } else if (state.lastFocusedValue === value2 || state.lastFocusedValue == null)
    tabIndex = 0;
  if (isDisabled)
    tabIndex = void 0;
  let { name: name2, descriptionId, errorMessageId, validationBehavior } = $884aeceb3d67f00f$export$37b65e5b5444d35c.get(state);
  $99facab73266f662$export$5add1d006293d136(ref, state.selectedValue, state.setSelectedValue);
  $e93e671b31057976$export$b8473d3665f3a75a$1({
    validationBehavior
  }, state, ref);
  return {
    labelProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(labelProps, {
      onClick: (e2) => e2.preventDefault()
    }),
    inputProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, {
      ...interactions,
      type: "radio",
      name: name2,
      tabIndex,
      disabled: isDisabled,
      required: state.isRequired && validationBehavior === "native",
      checked,
      value: value2,
      onChange,
      "aria-describedby": [
        props["aria-describedby"],
        state.isInvalid ? errorMessageId : null,
        descriptionId
      ].filter(Boolean).join(" ") || void 0
    }),
    isDisabled,
    isSelected: checked,
    isPressed: isPressed || isLabelPressed
  };
}
function $9bf71ea28793e738$var$isTabbableRadio$4(element2) {
  if (element2.checked)
    return true;
  let radios = [];
  if (!element2.form)
    radios = [
      ...$431fbd86ca7dc216$export$b204af158042fbac$4(element2).querySelectorAll(`input[type="radio"][name="${CSS.escape(element2.name)}"]`)
    ].filter((radio2) => !radio2.form);
  else {
    var _element_form_elements, _element_form;
    let radioList = (_element_form = element2.form) === null || _element_form === void 0 ? void 0 : (_element_form_elements = _element_form.elements) === null || _element_form_elements === void 0 ? void 0 : _element_form_elements.namedItem(element2.name);
    radios = [
      ...radioList !== null && radioList !== void 0 ? radioList : []
    ];
  }
  if (!radios)
    return false;
  let anyChecked = radios.some((radio2) => radio2.checked);
  return !anyChecked;
}
function $9bf71ea28793e738$var$isElementInScope$4(element2, scope) {
  if (!element2)
    return false;
  if (!scope)
    return false;
  return scope.some((node2) => node2.contains(element2));
}
function $9bf71ea28793e738$export$2d6ec8fc375ceafa$4(root2, opts2, scope) {
  let filter3 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) ? $b4b717babfbb907b$export$bebd5a1431fec25d : $b4b717babfbb907b$export$4c063cf1350e6fed$3;
  let rootElement = (root2 === null || root2 === void 0 ? void 0 : root2.nodeType) === Node.ELEMENT_NODE ? root2 : null;
  let doc = $431fbd86ca7dc216$export$b204af158042fbac$4(rootElement);
  let walker = $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root2 || doc, NodeFilter.SHOW_ELEMENT, {
    acceptNode(node2) {
      var _opts_from;
      if (opts2 === null || opts2 === void 0 ? void 0 : (_opts_from = opts2.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node2))
        return NodeFilter.FILTER_REJECT;
      if ((opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) && node2.tagName === "INPUT" && node2.getAttribute("type") === "radio") {
        if (!$9bf71ea28793e738$var$isTabbableRadio$4(node2))
          return NodeFilter.FILTER_REJECT;
        if (walker.currentNode.tagName === "INPUT" && walker.currentNode.type === "radio" && walker.currentNode.name === node2.name)
          return NodeFilter.FILTER_REJECT;
      }
      if (filter3(node2) && (!scope || $9bf71ea28793e738$var$isElementInScope$4(node2, scope)) && (!(opts2 === null || opts2 === void 0 ? void 0 : opts2.accept) || opts2.accept(node2)))
        return NodeFilter.FILTER_ACCEPT;
      return NodeFilter.FILTER_SKIP;
    }
  });
  if (opts2 === null || opts2 === void 0 ? void 0 : opts2.from)
    walker.currentNode = opts2.from;
  return walker;
}
let $9bf71ea28793e738$var$Tree$4 = class $9bf71ea28793e738$var$Tree4 {
  get size() {
    return this.fastMap.size;
  }
  getTreeNode(data) {
    return this.fastMap.get(data);
  }
  addTreeNode(scopeRef, parent, nodeToRestore) {
    let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
    if (!parentNode)
      return;
    let node2 = new $9bf71ea28793e738$var$TreeNode$4({
      scopeRef
    });
    parentNode.addChild(node2);
    node2.parent = parentNode;
    this.fastMap.set(scopeRef, node2);
    if (nodeToRestore)
      node2.nodeToRestore = nodeToRestore;
  }
  addNode(node2) {
    this.fastMap.set(node2.scopeRef, node2);
  }
  removeTreeNode(scopeRef) {
    if (scopeRef === null)
      return;
    let node2 = this.fastMap.get(scopeRef);
    if (!node2)
      return;
    let parentNode = node2.parent;
    for (let current of this.traverse())
      if (current !== node2 && node2.nodeToRestore && current.nodeToRestore && node2.scopeRef && node2.scopeRef.current && $9bf71ea28793e738$var$isElementInScope$4(current.nodeToRestore, node2.scopeRef.current))
        current.nodeToRestore = node2.nodeToRestore;
    let children = node2.children;
    if (parentNode) {
      parentNode.removeChild(node2);
      if (children.size > 0)
        children.forEach((child) => parentNode && parentNode.addChild(child));
    }
    this.fastMap.delete(node2.scopeRef);
  }
  // Pre Order Depth First
  *traverse(node2 = this.root) {
    if (node2.scopeRef != null)
      yield node2;
    if (node2.children.size > 0)
      for (let child of node2.children)
        yield* this.traverse(child);
  }
  clone() {
    var _node_parent;
    let newTree = new $9bf71ea28793e738$var$Tree4();
    var _node_parent_scopeRef;
    for (let node2 of this.traverse())
      newTree.addTreeNode(node2.scopeRef, (_node_parent_scopeRef = (_node_parent = node2.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node2.nodeToRestore);
    return newTree;
  }
  constructor() {
    this.fastMap = /* @__PURE__ */ new Map();
    this.root = new $9bf71ea28793e738$var$TreeNode$4({
      scopeRef: null
    });
    this.fastMap.set(null, this.root);
  }
};
let $9bf71ea28793e738$var$TreeNode$4 = class $9bf71ea28793e738$var$TreeNode4 {
  addChild(node2) {
    this.children.add(node2);
    node2.parent = this;
  }
  removeChild(node2) {
    this.children.delete(node2);
    node2.parent = void 0;
  }
  constructor(props) {
    this.children = /* @__PURE__ */ new Set();
    this.contain = false;
    this.scopeRef = props.scopeRef;
  }
};
new $9bf71ea28793e738$var$Tree$4();
function $430f30ed08ec25fa$export$62b9571f283ff5c2(props, state) {
  let { name: name2, isReadOnly, isRequired, isDisabled, orientation = "vertical", validationBehavior = "aria" } = props;
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let { isInvalid, validationErrors, validationDetails } = state.displayValidation;
  let { labelProps, fieldProps, descriptionProps, errorMessageProps } = $2baaea4c71418dea$export$294aa081a6c6f55d$1({
    ...props,
    // Radio group is not an HTML input element so it
    // shouldn't be labeled by a <label> element.
    labelElementType: "span",
    isInvalid: state.isInvalid,
    errorMessage: props.errorMessage || validationErrors
  });
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$4({
    onBlurWithin(e2) {
      var _props_onBlur;
      (_props_onBlur = props.onBlur) === null || _props_onBlur === void 0 ? void 0 : _props_onBlur.call(props, e2);
      if (!state.selectedValue)
        state.setLastFocusedValue(null);
    },
    onFocusWithin: props.onFocus,
    onFocusWithinChange: props.onFocusChange
  });
  let onKeyDown = (e2) => {
    let nextDir;
    switch (e2.key) {
      case "ArrowRight":
        if (direction === "rtl" && orientation !== "vertical")
          nextDir = "prev";
        else
          nextDir = "next";
        break;
      case "ArrowLeft":
        if (direction === "rtl" && orientation !== "vertical")
          nextDir = "next";
        else
          nextDir = "prev";
        break;
      case "ArrowDown":
        nextDir = "next";
        break;
      case "ArrowUp":
        nextDir = "prev";
        break;
      default:
        return;
    }
    e2.preventDefault();
    let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$4(e2.currentTarget, {
      from: e2.target
    });
    let nextElem;
    if (nextDir === "next") {
      nextElem = walker.nextNode();
      if (!nextElem) {
        walker.currentNode = e2.currentTarget;
        nextElem = walker.firstChild();
      }
    } else {
      nextElem = walker.previousNode();
      if (!nextElem) {
        walker.currentNode = e2.currentTarget;
        nextElem = walker.lastChild();
      }
    }
    if (nextElem) {
      nextElem.focus();
      state.setSelectedValue(nextElem.value);
    }
  };
  let groupName = $bdb11010cef70236$export$f680877a34711e37$2(name2);
  $884aeceb3d67f00f$export$37b65e5b5444d35c.set(state, {
    name: groupName,
    descriptionId: descriptionProps.id,
    errorMessageId: errorMessageProps.id,
    validationBehavior
  });
  return {
    radioGroupProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, {
      // https://www.w3.org/TR/wai-aria-1.2/#radiogroup
      role: "radiogroup",
      onKeyDown,
      "aria-invalid": state.isInvalid || void 0,
      "aria-errormessage": props["aria-errormessage"],
      "aria-readonly": isReadOnly || void 0,
      "aria-required": isRequired || void 0,
      "aria-disabled": isDisabled || void 0,
      "aria-orientation": orientation,
      ...fieldProps,
      ...focusWithinProps
    }),
    labelProps,
    descriptionProps,
    errorMessageProps,
    isInvalid,
    validationErrors,
    validationDetails
  };
}
function useRadioGroup(props) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext$1) || {};
  const {
    as: as2,
    ref,
    classNames: classNames2,
    children,
    label,
    value: value2,
    name: name2,
    isInvalid: isInvalidProp,
    validationState,
    validationBehavior = (_a2 = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _a2 : "native",
    size: size2 = "md",
    color: color2 = "primary",
    isDisabled = false,
    disableAnimation = (_b2 = globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false,
    orientation = "vertical",
    isRequired = false,
    isReadOnly,
    errorMessage,
    description,
    className,
    onChange,
    onValueChange,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const otherPropsWithOrientation = reactExports.useMemo(() => {
    return {
      ...otherProps,
      value: value2,
      name: name2,
      "aria-label": safeAriaLabel(otherProps["aria-label"], label),
      isRequired,
      isReadOnly,
      isInvalid: validationState === "invalid" || isInvalidProp,
      orientation,
      validationBehavior,
      onChange: onValueChange
    };
  }, [
    otherProps,
    value2,
    name2,
    label,
    isRequired,
    isReadOnly,
    isInvalidProp,
    validationState,
    validationBehavior,
    orientation,
    onValueChange
  ]);
  const groupState = $a54cdc5c1942b639$export$bca9d026f8e704eb(otherPropsWithOrientation);
  const {
    labelProps,
    radioGroupProps: groupProps,
    errorMessageProps,
    descriptionProps,
    isInvalid: isAriaInvalid,
    validationErrors,
    validationDetails
  } = $430f30ed08ec25fa$export$62b9571f283ff5c2(otherPropsWithOrientation, groupState);
  const isInvalid = otherPropsWithOrientation.isInvalid || isAriaInvalid || groupState.isInvalid;
  const context = reactExports.useMemo(
    () => ({
      size: size2,
      color: color2,
      groupState,
      isRequired,
      isInvalid,
      isDisabled,
      disableAnimation,
      onChange
    }),
    [
      size2,
      color2,
      isRequired,
      isDisabled,
      isInvalid,
      onChange,
      disableAnimation,
      groupState.name,
      groupState.isDisabled,
      groupState.isReadOnly,
      groupState.isRequired,
      groupState.selectedValue,
      groupState.lastFocusedValue
    ]
  );
  const slots = reactExports.useMemo(
    () => radioGroup({ isRequired, isInvalid, disableAnimation }),
    [isInvalid, isRequired, disableAnimation]
  );
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const getGroupProps = reactExports.useCallback(() => {
    return {
      ref: domRef,
      className: slots.base({ class: baseStyles }),
      ...mergeProps$3(
        groupProps,
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        })
      )
    };
  }, [domRef, slots, baseStyles, groupProps, otherProps]);
  const getLabelProps = reactExports.useCallback(() => {
    return {
      className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }),
      ...labelProps
    };
  }, [slots, classNames2 == null ? void 0 : classNames2.label, labelProps, classNames2 == null ? void 0 : classNames2.label]);
  const getWrapperProps = reactExports.useCallback(() => {
    return {
      className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }),
      role: "presentation",
      "data-orientation": orientation
    };
  }, [slots, classNames2 == null ? void 0 : classNames2.wrapper, orientation, slots.wrapper]);
  const getDescriptionProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ...descriptionProps,
        className: slots.description({ class: clsx$4(classNames2 == null ? void 0 : classNames2.description, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.description, descriptionProps, slots.description]
  );
  const getErrorMessageProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ...errorMessageProps,
        className: slots.errorMessage({ class: clsx$4(classNames2 == null ? void 0 : classNames2.errorMessage, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.errorMessage, errorMessageProps]
  );
  return {
    Component: Component2,
    children,
    label,
    context,
    description,
    isInvalid,
    errorMessage: typeof errorMessage === "function" ? errorMessage({ isInvalid, validationErrors, validationDetails }) : errorMessage || (validationErrors == null ? void 0 : validationErrors.join(" ")),
    getGroupProps,
    getLabelProps,
    getWrapperProps,
    getDescriptionProps,
    getErrorMessageProps
  };
}
var [RadioGroupProvider, useRadioGroupContext] = createContext2({
  name: "RadioGroupContext",
  strict: false
});
var RadioGroup = forwardRef((props, ref) => {
  const {
    Component: Component2,
    children,
    label,
    context,
    description,
    isInvalid,
    errorMessage,
    getGroupProps,
    getLabelProps,
    getWrapperProps,
    getDescriptionProps,
    getErrorMessageProps
  } = useRadioGroup({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getGroupProps(), children: [
    label && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children: label }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getWrapperProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(RadioGroupProvider, { value: context, children }) }),
    isInvalid && errorMessage ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getErrorMessageProps(), children: errorMessage }) : description ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getDescriptionProps(), children: description }) : null
  ] });
});
RadioGroup.displayName = "HeroUI.RadioGroup";
var radio_group_default = RadioGroup;
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$b = false;
let $6179b936705e76d3$var$hoverCount$b = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$b() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$b = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$b = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$b(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$b();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$b() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$b);
  $6179b936705e76d3$var$hoverCount$b++;
  return () => {
    $6179b936705e76d3$var$hoverCount$b--;
    if ($6179b936705e76d3$var$hoverCount$b > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$b);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$b(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$b, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$b && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
function useRadio(props) {
  var _a2, _b2, _c2, _d, _e;
  const globalContext = useProviderContext();
  const groupContext = useRadioGroupContext();
  const {
    as: as2,
    ref,
    classNames: classNames2,
    id: id2,
    value: value2,
    children,
    description,
    size: size2 = (_a2 = groupContext == null ? void 0 : groupContext.size) != null ? _a2 : "md",
    color: color2 = (_b2 = groupContext == null ? void 0 : groupContext.color) != null ? _b2 : "primary",
    isDisabled: isDisabledProp = (_c2 = groupContext == null ? void 0 : groupContext.isDisabled) != null ? _c2 : false,
    disableAnimation = (_e = (_d = groupContext == null ? void 0 : groupContext.disableAnimation) != null ? _d : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _e : false,
    onChange = groupContext == null ? void 0 : groupContext.onChange,
    autoFocus = false,
    className,
    ...otherProps
  } = props;
  const Component2 = as2 || "label";
  const domRef = useDOMRef(ref);
  const inputRef = reactExports.useRef(null);
  const labelId = reactExports.useId();
  const descriptionId = reactExports.useId();
  const isRequired = reactExports.useMemo(() => {
    var _a22;
    return (_a22 = groupContext.isRequired) != null ? _a22 : false;
  }, [groupContext.isRequired]);
  const isInvalid = groupContext.isInvalid;
  const ariaRadioProps = reactExports.useMemo(() => {
    const ariaDescribedBy = [otherProps["aria-describedby"], descriptionId].filter(Boolean).join(" ") || void 0;
    return {
      id: id2,
      isRequired,
      isDisabled: isDisabledProp,
      "aria-label": otherProps["aria-label"],
      "aria-labelledby": otherProps["aria-labelledby"] || labelId,
      "aria-describedby": ariaDescribedBy
    };
  }, [
    id2,
    isDisabledProp,
    isRequired,
    description,
    otherProps["aria-label"],
    otherProps["aria-labelledby"],
    otherProps["aria-describedby"],
    descriptionId
  ]);
  const { inputProps, isDisabled, isSelected, isPressed } = $0d5c49892c1215da$export$37b0961d2f4751e2(
    {
      value: value2,
      children: typeof children === "function" ? true : children,
      ...ariaRadioProps
    },
    groupContext.groupState,
    inputRef
  );
  const { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus
  });
  const interactionDisabled = isDisabled || inputProps.readOnly;
  const { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456$b({
    isDisabled: interactionDisabled
  });
  const pressed = interactionDisabled ? false : isPressed;
  const slots = reactExports.useMemo(
    () => radio({
      color: color2,
      size: size2,
      isInvalid,
      isDisabled,
      disableAnimation
    }),
    [color2, size2, isDisabled, isInvalid, disableAnimation]
  );
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const getBaseProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ref: domRef,
        className: slots.base({ class: baseStyles }),
        "data-disabled": dataAttr(isDisabled),
        "data-focus": dataAttr(isFocused),
        "data-focus-visible": dataAttr(isFocusVisible),
        "data-selected": dataAttr(isSelected),
        "data-invalid": dataAttr(isInvalid),
        "data-hover": dataAttr(isHovered),
        "data-pressed": dataAttr(pressed),
        "data-hover-unselected": dataAttr(isHovered && !isSelected),
        "data-readonly": dataAttr(inputProps.readOnly),
        "aria-required": dataAttr(isRequired),
        ...mergeProps$3(hoverProps, otherProps)
      };
    },
    [
      slots,
      baseStyles,
      domRef,
      isDisabled,
      isFocused,
      isFocusVisible,
      isSelected,
      isInvalid,
      isHovered,
      pressed,
      inputProps.readOnly,
      isRequired,
      otherProps
    ]
  );
  const getWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "aria-hidden": true,
        className: clsx$4(slots.wrapper({ class: clsx$4(classNames2 == null ? void 0 : classNames2.wrapper, props2.className) }))
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.wrapper]
  );
  const getInputProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ref: inputRef,
        ...mergeProps$3(props2, inputProps, focusProps),
        className: slots.hiddenInput({ class: classNames2 == null ? void 0 : classNames2.hiddenInput }),
        onChange: chain(inputProps.onChange, onChange)
      };
    },
    [inputProps, focusProps, onChange]
  );
  const getLabelProps = reactExports.useCallback(
    (props2 = {}) => ({
      ...props2,
      id: labelId,
      className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.label, isDisabled, isSelected, isInvalid]
  );
  const getLabelWrapperProps = reactExports.useCallback(
    (props2 = {}) => ({
      ...props2,
      className: slots.labelWrapper({ class: classNames2 == null ? void 0 : classNames2.labelWrapper })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.labelWrapper]
  );
  const getControlProps = reactExports.useCallback(
    (props2 = {}) => ({
      ...props2,
      className: slots.control({ class: classNames2 == null ? void 0 : classNames2.control })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.control]
  );
  const getDescriptionProps = reactExports.useCallback(
    (props2 = {}) => ({
      ...props2,
      id: descriptionId,
      className: slots.description({ class: classNames2 == null ? void 0 : classNames2.description })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.description]
  );
  return {
    Component: Component2,
    children,
    isSelected,
    isDisabled,
    isInvalid,
    isFocusVisible,
    description,
    getBaseProps,
    getWrapperProps,
    getInputProps,
    getLabelProps,
    getLabelWrapperProps,
    getControlProps,
    getDescriptionProps
  };
}
var Radio = forwardRef((props, ref) => {
  const {
    Component: Component2,
    children,
    description,
    getBaseProps,
    getWrapperProps,
    getInputProps,
    getLabelProps,
    getLabelWrapperProps,
    getControlProps,
    getDescriptionProps
  } = useRadio({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getBaseProps(), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...getInputProps() }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getWrapperProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getControlProps() }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getLabelWrapperProps(), children: [
      children && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children }),
      description && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getDescriptionProps(), children: description })
    ] })
  ] });
});
Radio.displayName = "HeroUI.Radio";
var radio_default = Radio;
var transformValue = (text2) => {
  return text2.replace(/[\u00A0]/g, " ");
};
function useClipboard({ timeout = 2e3 } = {}) {
  const [error2, setError] = reactExports.useState(null);
  const [copied, setCopied] = reactExports.useState(false);
  const [copyTimeout, setCopyTimeout] = reactExports.useState(null);
  const onClearTimeout = reactExports.useCallback(() => {
    if (copyTimeout) {
      clearTimeout(copyTimeout);
    }
  }, [copyTimeout]);
  const handleCopyResult = reactExports.useCallback(
    (value2) => {
      onClearTimeout();
      setCopyTimeout(setTimeout(() => setCopied(false), timeout));
      setCopied(value2);
    },
    [onClearTimeout, timeout]
  );
  const copy2 = reactExports.useCallback(
    (valueToCopy) => {
      if ("clipboard" in navigator) {
        const transformedValue = typeof valueToCopy === "string" ? transformValue(valueToCopy) : valueToCopy;
        navigator.clipboard.writeText(transformedValue).then(() => handleCopyResult(true)).catch((err) => setError(err));
      } else {
        setError(new Error("useClipboard: navigator.clipboard is not supported"));
      }
    },
    [handleCopyResult]
  );
  const reset = reactExports.useCallback(() => {
    setCopied(false);
    setError(null);
    onClearTimeout();
  }, [onClearTimeout]);
  return { copy: copy2, reset, error: error2, copied };
}
function useSnippet(originalProps) {
  var _a2, _b2, _c2, _d;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, snippet.variantKeys);
  const {
    ref,
    as: as2,
    children,
    symbol = "$",
    classNames: classNames2,
    timeout,
    copyIcon,
    checkIcon,
    codeString,
    disableCopy = false,
    disableTooltip = false,
    hideCopyButton = false,
    autoFocus = false,
    hideSymbol = false,
    onCopy: onCopyProp,
    tooltipProps: userTooltipProps = {},
    copyButtonProps: userButtonProps = {},
    className,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const disableAnimation = (_b2 = (_a2 = originalProps == null ? void 0 : originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const tooltipProps = {
    offset: 15,
    delay: 1e3,
    content: "Copy to clipboard",
    color: (_d = originalProps == null ? void 0 : originalProps.color) != null ? _d : (_c2 = snippet.defaultVariants) == null ? void 0 : _c2.color,
    isDisabled: props.disableCopy,
    ...userTooltipProps
  };
  const domRef = useDOMRef(ref);
  const preRef = reactExports.useRef(null);
  const { copy: copy2, copied } = useClipboard({ timeout });
  const isMultiLine = children && Array.isArray(children);
  const { isFocusVisible, isFocused, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus
  });
  const slots = reactExports.useMemo(
    () => snippet({
      ...variantProps2,
      disableAnimation
    }),
    [objectToDeps(variantProps2), disableAnimation]
  );
  const symbolBefore = reactExports.useMemo(() => {
    if (!symbol || typeof symbol !== "string")
      return symbol;
    const str = symbol.trim();
    return str ? `${str} ` : "";
  }, [symbol]);
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const getSnippetProps = reactExports.useCallback(
    () => ({
      className: slots.base({
        class: baseStyles
      }),
      ...filterDOMProps(otherProps, {
        enabled: shouldFilterDOMProps
      })
    }),
    [slots, baseStyles, isMultiLine, otherProps]
  );
  const onCopy = reactExports.useCallback(() => {
    var _a22;
    if (disableCopy) {
      return;
    }
    let stringValue = "";
    if (typeof children === "string") {
      stringValue = children;
    } else if (Array.isArray(children)) {
      children.forEach((child) => {
        var _a3, _b22;
        const childString = typeof child === "string" ? child : (_b22 = (_a3 = child == null ? void 0 : child.props) == null ? void 0 : _a3.children) == null ? void 0 : _b22.toString();
        if (childString) {
          stringValue += childString + "\n";
        }
      });
    }
    const valueToCopy = codeString || stringValue || ((_a22 = preRef.current) == null ? void 0 : _a22.textContent) || "";
    copy2(valueToCopy);
    onCopyProp == null ? void 0 : onCopyProp(valueToCopy);
  }, [copy2, codeString, disableCopy, onCopyProp, children]);
  const copyButtonProps = {
    "aria-label": typeof tooltipProps.content === "string" ? tooltipProps.content : "Copy to clipboard",
    size: "sm",
    variant: "light",
    isDisabled: disableCopy,
    onPress: onCopy,
    isIconOnly: true,
    ...userButtonProps
  };
  const getCopyButtonProps = reactExports.useCallback(
    () => ({
      ...copyButtonProps,
      "data-copied": dataAttr(copied),
      className: slots.copyButton({
        class: clsx$4(classNames2 == null ? void 0 : classNames2.copyButton)
      })
    }),
    [
      slots,
      isFocusVisible,
      isFocused,
      disableCopy,
      classNames2 == null ? void 0 : classNames2.copyButton,
      copyButtonProps,
      focusProps
    ]
  );
  return {
    Component: Component2,
    as: as2,
    domRef,
    preRef,
    children,
    slots,
    classNames: classNames2,
    copied,
    onCopy,
    copyIcon,
    checkIcon,
    symbolBefore,
    isMultiLine,
    isFocusVisible,
    hideCopyButton,
    disableCopy,
    disableTooltip,
    hideSymbol,
    tooltipProps,
    getSnippetProps,
    getCopyButtonProps
  };
}
function $fc909762b330b746$export$61c6a8c84e605fb6$2(props) {
  let [isOpen, setOpen] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.isOpen, props.defaultOpen || false, props.onOpenChange);
  const open = reactExports.useCallback(() => {
    setOpen(true);
  }, [
    setOpen
  ]);
  const close = reactExports.useCallback(() => {
    setOpen(false);
  }, [
    setOpen
  ]);
  const toggle2 = reactExports.useCallback(() => {
    setOpen(!isOpen);
  }, [
    setOpen,
    isOpen
  ]);
  return {
    isOpen,
    setOpen,
    open,
    close,
    toggle: toggle2
  };
}
const $8796f90736e175cb$var$TOOLTIP_DELAY = 1500;
const $8796f90736e175cb$var$TOOLTIP_COOLDOWN = 500;
let $8796f90736e175cb$var$tooltips = {};
let $8796f90736e175cb$var$tooltipId = 0;
let $8796f90736e175cb$var$globalWarmedUp = false;
let $8796f90736e175cb$var$globalWarmUpTimeout = null;
let $8796f90736e175cb$var$globalCooldownTimeout = null;
function $8796f90736e175cb$export$4d40659c25ecb50b(props = {}) {
  let { delay: delay2 = $8796f90736e175cb$var$TOOLTIP_DELAY, closeDelay = $8796f90736e175cb$var$TOOLTIP_COOLDOWN } = props;
  let { isOpen, open, close } = $fc909762b330b746$export$61c6a8c84e605fb6$2(props);
  let id2 = reactExports.useMemo(() => `${++$8796f90736e175cb$var$tooltipId}`, []);
  let closeTimeout = reactExports.useRef(null);
  let closeCallback = reactExports.useRef(close);
  let ensureTooltipEntry = () => {
    $8796f90736e175cb$var$tooltips[id2] = hideTooltip;
  };
  let closeOpenTooltips = () => {
    for (let hideTooltipId in $8796f90736e175cb$var$tooltips)
      if (hideTooltipId !== id2) {
        $8796f90736e175cb$var$tooltips[hideTooltipId](true);
        delete $8796f90736e175cb$var$tooltips[hideTooltipId];
      }
  };
  let showTooltip = () => {
    if (closeTimeout.current)
      clearTimeout(closeTimeout.current);
    closeTimeout.current = null;
    closeOpenTooltips();
    ensureTooltipEntry();
    $8796f90736e175cb$var$globalWarmedUp = true;
    open();
    if ($8796f90736e175cb$var$globalWarmUpTimeout) {
      clearTimeout($8796f90736e175cb$var$globalWarmUpTimeout);
      $8796f90736e175cb$var$globalWarmUpTimeout = null;
    }
    if ($8796f90736e175cb$var$globalCooldownTimeout) {
      clearTimeout($8796f90736e175cb$var$globalCooldownTimeout);
      $8796f90736e175cb$var$globalCooldownTimeout = null;
    }
  };
  let hideTooltip = (immediate) => {
    if (immediate || closeDelay <= 0) {
      if (closeTimeout.current)
        clearTimeout(closeTimeout.current);
      closeTimeout.current = null;
      closeCallback.current();
    } else if (!closeTimeout.current)
      closeTimeout.current = setTimeout(() => {
        closeTimeout.current = null;
        closeCallback.current();
      }, closeDelay);
    if ($8796f90736e175cb$var$globalWarmUpTimeout) {
      clearTimeout($8796f90736e175cb$var$globalWarmUpTimeout);
      $8796f90736e175cb$var$globalWarmUpTimeout = null;
    }
    if ($8796f90736e175cb$var$globalWarmedUp) {
      if ($8796f90736e175cb$var$globalCooldownTimeout)
        clearTimeout($8796f90736e175cb$var$globalCooldownTimeout);
      $8796f90736e175cb$var$globalCooldownTimeout = setTimeout(() => {
        delete $8796f90736e175cb$var$tooltips[id2];
        $8796f90736e175cb$var$globalCooldownTimeout = null;
        $8796f90736e175cb$var$globalWarmedUp = false;
      }, Math.max($8796f90736e175cb$var$TOOLTIP_COOLDOWN, closeDelay));
    }
  };
  let warmupTooltip = () => {
    closeOpenTooltips();
    ensureTooltipEntry();
    if (!isOpen && !$8796f90736e175cb$var$globalWarmUpTimeout && !$8796f90736e175cb$var$globalWarmedUp)
      $8796f90736e175cb$var$globalWarmUpTimeout = setTimeout(() => {
        $8796f90736e175cb$var$globalWarmUpTimeout = null;
        $8796f90736e175cb$var$globalWarmedUp = true;
        showTooltip();
      }, delay2);
    else if (!isOpen)
      showTooltip();
  };
  reactExports.useEffect(() => {
    closeCallback.current = close;
  }, [
    close
  ]);
  reactExports.useEffect(() => {
    return () => {
      if (closeTimeout.current)
        clearTimeout(closeTimeout.current);
      let tooltip = $8796f90736e175cb$var$tooltips[id2];
      if (tooltip)
        delete $8796f90736e175cb$var$tooltips[id2];
    };
  }, [
    id2
  ]);
  return {
    isOpen,
    open: (immediate) => {
      if (!immediate && delay2 > 0 && !closeTimeout.current)
        warmupTooltip();
      else
        showTooltip();
    },
    close: hideTooltip
  };
}
function $326e436e94273fe1$export$1c4b08e0eca38426(props, state) {
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  let { hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$h({
    onHoverStart: () => state === null || state === void 0 ? void 0 : state.open(true),
    onHoverEnd: () => state === null || state === void 0 ? void 0 : state.close()
  });
  return {
    tooltipProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, hoverProps, {
      role: "tooltip"
    })
  };
}
function $4e1b34546679e357$export$a6da6c504e4bba8b(props, state, ref) {
  let { isDisabled, trigger } = props;
  let tooltipId = $bdb11010cef70236$export$f680877a34711e37$2();
  let isHovered = reactExports.useRef(false);
  let isFocused = reactExports.useRef(false);
  let handleShow = () => {
    if (isHovered.current || isFocused.current)
      state.open(isFocused.current);
  };
  let handleHide = (immediate) => {
    if (!isHovered.current && !isFocused.current)
      state.close(immediate);
  };
  reactExports.useEffect(() => {
    let onKeyDown = (e2) => {
      if (ref && ref.current) {
        if (e2.key === "Escape") {
          e2.stopPropagation();
          state.close(true);
        }
      }
    };
    if (state.isOpen) {
      document.addEventListener("keydown", onKeyDown, true);
      return () => {
        document.removeEventListener("keydown", onKeyDown, true);
      };
    }
  }, [
    ref,
    state
  ]);
  let onHoverStart = () => {
    if (trigger === "focus")
      return;
    if ($507fabe10e71c6fb$export$630ff653c5ada6a9$2() === "pointer")
      isHovered.current = true;
    else
      isHovered.current = false;
    handleShow();
  };
  let onHoverEnd = () => {
    if (trigger === "focus")
      return;
    isFocused.current = false;
    isHovered.current = false;
    handleHide();
  };
  let onPressStart = () => {
    isFocused.current = false;
    isHovered.current = false;
    handleHide(true);
  };
  let onFocus = () => {
    let isVisible2 = $507fabe10e71c6fb$export$b9b3dfddab17db27$2();
    if (isVisible2) {
      isFocused.current = true;
      handleShow();
    }
  };
  let onBlur = () => {
    isFocused.current = false;
    isHovered.current = false;
    handleHide(true);
  };
  let { hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$h({
    isDisabled,
    onHoverStart,
    onHoverEnd
  });
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2({
    isDisabled,
    onFocus,
    onBlur
  }, ref);
  return {
    triggerProps: {
      "aria-describedby": state.isOpen ? tooltipId : void 0,
      ...$3ef42575df84b30b$export$9d1611c77c2fe928$9(focusableProps, hoverProps, {
        onPointerDown: onPressStart,
        onKeyDown: onPressStart,
        tabIndex: void 0
      })
    },
    tooltipProps: {
      id: tooltipId
    }
  };
}
function $8a9cb279dc87e130$export$525bc4921d56d4a$7(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$6(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$715c682d09d639cc$4(onBlur) {
  let stateRef = reactExports.useRef({
    isFocused: false,
    observer: null
  });
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    const state = stateRef.current;
    return () => {
      if (state.observer) {
        state.observer.disconnect();
        state.observer = null;
      }
    };
  }, []);
  let dispatchBlur = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onBlur === null || onBlur === void 0 ? void 0 : onBlur(e2);
  });
  return reactExports.useCallback((e2) => {
    if (e2.target instanceof HTMLButtonElement || e2.target instanceof HTMLInputElement || e2.target instanceof HTMLTextAreaElement || e2.target instanceof HTMLSelectElement) {
      stateRef.current.isFocused = true;
      let target = e2.target;
      let onBlurHandler = (e3) => {
        stateRef.current.isFocused = false;
        if (target.disabled) {
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a$7(e3);
          dispatchBlur(event);
        }
        if (stateRef.current.observer) {
          stateRef.current.observer.disconnect();
          stateRef.current.observer = null;
        }
      };
      target.addEventListener("focusout", onBlurHandler, {
        once: true
      });
      stateRef.current.observer = new MutationObserver(() => {
        if (stateRef.current.isFocused && target.disabled) {
          var _stateRef_current_observer;
          (_stateRef_current_observer = stateRef.current.observer) === null || _stateRef_current_observer === void 0 ? void 0 : _stateRef_current_observer.disconnect();
          let relatedTargetEl = target === document.activeElement ? null : document.activeElement;
          target.dispatchEvent(new FocusEvent("blur", {
            relatedTarget: relatedTargetEl
          }));
          target.dispatchEvent(new FocusEvent("focusout", {
            bubbles: true,
            relatedTarget: relatedTargetEl
          }));
        }
      });
      stateRef.current.observer.observe(target, {
        attributes: true,
        attributeFilter: [
          "disabled"
        ]
      });
    }
  }, [
    dispatchBlur
  ]);
}
function $9ab94262bd0047c7$export$420e68273165f4ec$3(props) {
  let { isDisabled, onBlurWithin, onFocusWithin, onFocusWithinChange } = props;
  let state = reactExports.useRef({
    isFocusWithin: false
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let onBlur = reactExports.useCallback((e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    if (state.current.isFocusWithin && !e2.currentTarget.contains(e2.relatedTarget)) {
      state.current.isFocusWithin = false;
      removeAllGlobalListeners();
      if (onBlurWithin)
        onBlurWithin(e2);
      if (onFocusWithinChange)
        onFocusWithinChange(false);
    }
  }, [
    onBlurWithin,
    onFocusWithinChange,
    state,
    removeAllGlobalListeners
  ]);
  let onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc$4(onBlur);
  let onFocus = reactExports.useCallback((e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(e2.target);
    const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
    if (!state.current.isFocusWithin && activeElement === $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) {
      if (onFocusWithin)
        onFocusWithin(e2);
      if (onFocusWithinChange)
        onFocusWithinChange(true);
      state.current.isFocusWithin = true;
      onSyntheticFocus(e2);
      let currentTarget = e2.currentTarget;
      addGlobalListener(ownerDocument, "focus", (e3) => {
        if (state.current.isFocusWithin && !$d4ee10de306f2510$export$4282f70798064fe0$3(currentTarget, e3.target)) {
          let nativeEvent = new ownerDocument.defaultView.FocusEvent("blur", {
            relatedTarget: e3.target
          });
          $8a9cb279dc87e130$export$c2b7abe5d61ec696$6(nativeEvent, currentTarget);
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a$7(nativeEvent);
          onBlur(event);
        }
      }, {
        capture: true
      });
    }
  }, [
    onFocusWithin,
    onFocusWithinChange,
    onSyntheticFocus,
    addGlobalListener,
    onBlur
  ]);
  if (isDisabled)
    return {
      focusWithinProps: {
        // These cannot be null, that would conflict in mergeProps
        onFocus: void 0,
        onBlur: void 0
      }
    };
  return {
    focusWithinProps: {
      onFocus,
      onBlur
    }
  };
}
function $e0b6e0b68ec7f50f$export$872b660ac5a1ff98(props) {
  let { ref, onInteractOutside, isDisabled, onInteractOutsideStart } = props;
  let stateRef = reactExports.useRef({
    isPointerDown: false,
    ignoreEmulatedMouseEvents: false
  });
  let onPointerDown = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (onInteractOutside && $e0b6e0b68ec7f50f$var$isValidEvent(e2, ref)) {
      if (onInteractOutsideStart)
        onInteractOutsideStart(e2);
      stateRef.current.isPointerDown = true;
    }
  });
  let triggerInteractOutside = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (onInteractOutside)
      onInteractOutside(e2);
  });
  reactExports.useEffect(() => {
    let state = stateRef.current;
    if (isDisabled)
      return;
    const element2 = ref.current;
    const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
    if (typeof PointerEvent !== "undefined") {
      let onClick = (e2) => {
        if (state.isPointerDown && $e0b6e0b68ec7f50f$var$isValidEvent(e2, ref))
          triggerInteractOutside(e2);
        state.isPointerDown = false;
      };
      documentObject.addEventListener("pointerdown", onPointerDown, true);
      documentObject.addEventListener("click", onClick, true);
      return () => {
        documentObject.removeEventListener("pointerdown", onPointerDown, true);
        documentObject.removeEventListener("click", onClick, true);
      };
    }
  }, [
    ref,
    isDisabled,
    onPointerDown,
    triggerInteractOutside
  ]);
}
function $e0b6e0b68ec7f50f$var$isValidEvent(event, ref) {
  if (event.button > 0)
    return false;
  if (event.target) {
    const ownerDocument = event.target.ownerDocument;
    if (!ownerDocument || !ownerDocument.documentElement.contains(event.target))
      return false;
    if (event.target.closest("[data-react-aria-top-layer]"))
      return false;
  }
  if (!ref.current)
    return false;
  return !event.composedPath().includes(ref.current);
}
var visibleOverlays = [];
function useAriaOverlay(props, ref) {
  const {
    disableOutsideEvents = true,
    isDismissable = false,
    isKeyboardDismissDisabled = false,
    isOpen,
    onClose,
    shouldCloseOnBlur,
    shouldCloseOnInteractOutside
  } = props;
  reactExports.useEffect(() => {
    if (isOpen) {
      visibleOverlays.push(ref);
    }
    return () => {
      const index2 = visibleOverlays.indexOf(ref);
      if (index2 >= 0) {
        visibleOverlays.splice(index2, 1);
      }
    };
  }, [isOpen, ref]);
  const onHide = () => {
    if (visibleOverlays[visibleOverlays.length - 1] === ref && onClose) {
      onClose();
    }
  };
  const onInteractOutsideStart = (e2) => {
    if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e2.target)) {
      if (visibleOverlays[visibleOverlays.length - 1] === ref) {
        if (disableOutsideEvents) {
          e2.stopPropagation();
          e2.preventDefault();
        }
      }
      if (e2.pointerType !== "touch") {
        onHide();
      }
    }
  };
  const onInteractOutside = (e2) => {
    if (e2.pointerType !== "touch") {
      return;
    }
    if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e2.target)) {
      if (visibleOverlays[visibleOverlays.length - 1] === ref) {
        if (disableOutsideEvents) {
          e2.stopPropagation();
          e2.preventDefault();
        }
      }
      onHide();
    }
  };
  const onKeyDown = (e2) => {
    if (e2.key === "Escape" && !isKeyboardDismissDisabled && !e2.nativeEvent.isComposing) {
      e2.stopPropagation();
      e2.preventDefault();
      onHide();
    }
  };
  $e0b6e0b68ec7f50f$export$872b660ac5a1ff98({
    isDisabled: !(isDismissable && isOpen),
    onInteractOutside: isDismissable && isOpen ? onInteractOutside : void 0,
    onInteractOutsideStart,
    ref
  });
  const { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$3({
    isDisabled: !shouldCloseOnBlur,
    onBlurWithin: (e2) => {
      if (!e2.relatedTarget || $9bf71ea28793e738$export$1258395f99bf9cbf(e2.relatedTarget)) {
        return;
      }
      if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e2.relatedTarget)) {
        onHide();
      }
    }
  });
  const onPointerDownUnderlay = (e2) => {
    if (e2.target === e2.currentTarget) {
      e2.preventDefault();
    }
  };
  return {
    overlayProps: {
      onKeyDown,
      ...focusWithinProps
    },
    underlayProps: {
      onPointerDown: onPointerDownUnderlay
    }
  };
}
function useTooltip(originalProps) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, popover.variantKeys);
  const {
    ref,
    as: as2,
    isOpen: isOpenProp,
    content: content2,
    children,
    defaultOpen,
    onOpenChange,
    isDisabled,
    trigger: triggerAction,
    shouldFlip = true,
    containerPadding = 12,
    placement: placementProp = "top",
    delay: delay2 = 0,
    closeDelay = 500,
    showArrow = false,
    offset: offset2 = 7,
    crossOffset = 0,
    isDismissable,
    shouldCloseOnBlur = true,
    portalContainer,
    isKeyboardDismissDisabled = false,
    updatePositionDeps = [],
    shouldCloseOnInteractOutside,
    className,
    onClose,
    motionProps,
    classNames: classNames2,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const disableAnimation = (_b2 = (_a2 = originalProps == null ? void 0 : originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const state = $8796f90736e175cb$export$4d40659c25ecb50b({
    delay: delay2,
    closeDelay,
    isDisabled,
    defaultOpen,
    isOpen: isOpenProp,
    onOpenChange: (isOpen2) => {
      onOpenChange == null ? void 0 : onOpenChange(isOpen2);
      if (!isOpen2) {
        onClose == null ? void 0 : onClose();
      }
    }
  });
  const triggerRef = reactExports.useRef(null);
  const overlayRef = reactExports.useRef(null);
  const tooltipId = reactExports.useId();
  const isOpen = state.isOpen && !isDisabled;
  reactExports.useImperativeHandle(
    ref,
    () => (
      // @ts-ignore
      createDOMRef(overlayRef)
    )
  );
  const { triggerProps, tooltipProps: triggerTooltipProps } = $4e1b34546679e357$export$a6da6c504e4bba8b(
    {
      isDisabled,
      trigger: triggerAction
    },
    state,
    triggerRef
  );
  const { tooltipProps } = $326e436e94273fe1$export$1c4b08e0eca38426(
    {
      isOpen,
      ...mergeProps$3(props, triggerTooltipProps)
    },
    state
  );
  const {
    overlayProps: positionProps,
    placement,
    updatePosition
  } = $2a41e45df1593e64$export$d39e1813b3bdd0e1({
    isOpen,
    targetRef: triggerRef,
    placement: toReactAriaPlacement(placementProp),
    overlayRef,
    offset: showArrow ? offset2 + 3 : offset2,
    crossOffset,
    shouldFlip,
    containerPadding
  });
  useSafeLayoutEffect(() => {
    if (!updatePositionDeps.length)
      return;
    updatePosition();
  }, updatePositionDeps);
  const { overlayProps } = useAriaOverlay(
    {
      isOpen,
      onClose: state.close,
      isDismissable,
      shouldCloseOnBlur,
      isKeyboardDismissDisabled,
      shouldCloseOnInteractOutside
    },
    overlayRef
  );
  const slots = reactExports.useMemo(
    () => {
      var _a22, _b22, _c2;
      return popover({
        ...variantProps2,
        disableAnimation,
        radius: (_a22 = originalProps == null ? void 0 : originalProps.radius) != null ? _a22 : "md",
        size: (_b22 = originalProps == null ? void 0 : originalProps.size) != null ? _b22 : "md",
        shadow: (_c2 = originalProps == null ? void 0 : originalProps.shadow) != null ? _c2 : "sm"
      });
    },
    [
      objectToDeps(variantProps2),
      disableAnimation,
      originalProps == null ? void 0 : originalProps.radius,
      originalProps == null ? void 0 : originalProps.size,
      originalProps == null ? void 0 : originalProps.shadow
    ]
  );
  const getTriggerProps = reactExports.useCallback(
    (props2 = {}, _ref = null) => ({
      ...mergeProps$3(triggerProps, props2),
      ref: mergeRefs(_ref, triggerRef),
      "aria-describedby": isOpen ? tooltipId : void 0
    }),
    [triggerProps, isOpen, tooltipId, state]
  );
  const getTooltipProps = reactExports.useCallback(
    () => ({
      ref: overlayRef,
      "data-slot": "base",
      "data-open": dataAttr(isOpen),
      "data-arrow": dataAttr(showArrow),
      "data-disabled": dataAttr(isDisabled),
      "data-placement": getArrowPlacement(placement || "top", placementProp),
      ...mergeProps$3(tooltipProps, overlayProps, otherProps),
      style: mergeProps$3(positionProps.style, otherProps.style, props.style),
      className: slots.base({ class: classNames2 == null ? void 0 : classNames2.base }),
      id: tooltipId
    }),
    [
      slots,
      isOpen,
      showArrow,
      isDisabled,
      placement,
      placementProp,
      tooltipProps,
      overlayProps,
      otherProps,
      positionProps,
      props,
      tooltipId
    ]
  );
  const getTooltipContentProps = reactExports.useCallback(
    () => ({
      "data-slot": "content",
      "data-open": dataAttr(isOpen),
      "data-arrow": dataAttr(showArrow),
      "data-disabled": dataAttr(isDisabled),
      "data-placement": getArrowPlacement(placement || "top", placementProp),
      className: slots.content({ class: clsx$4(classNames2 == null ? void 0 : classNames2.content, className) })
    }),
    [slots, isOpen, showArrow, isDisabled, placement, placementProp, classNames2]
  );
  return {
    Component: Component2,
    content: content2,
    children,
    isOpen,
    triggerRef,
    showArrow,
    portalContainer,
    placement: placementProp,
    disableAnimation,
    isDisabled,
    motionProps,
    getTooltipContentProps,
    getTriggerProps,
    getTooltipProps
  };
}
var domAnimation$5 = () => __vitePreload(() => import("./index-kYRJvtWR.js"), true ? __vite__mapDeps([]) : void 0).then((res) => res.default);
var Tooltip$5 = forwardRef((props, ref) => {
  var _a2;
  const {
    Component: Component2,
    children,
    content: content2,
    isOpen,
    portalContainer,
    placement,
    disableAnimation,
    motionProps,
    getTriggerProps,
    getTooltipProps,
    getTooltipContentProps
  } = useTooltip({
    ...props,
    ref
  });
  let trigger;
  try {
    const childrenNum = reactExports.Children.count(children);
    if (childrenNum !== 1)
      throw new Error();
    if (!reactExports.isValidElement(children)) {
      trigger = /* @__PURE__ */ jsxRuntimeExports.jsx("p", { ...getTriggerProps(), children });
    } else {
      const child = children;
      const childRef = (_a2 = child.props.ref) != null ? _a2 : child.ref;
      trigger = reactExports.cloneElement(child, getTriggerProps(child.props, childRef));
    }
  } catch {
    trigger = /* @__PURE__ */ jsxRuntimeExports.jsx("span", {});
    warn$2("Tooltip must have only one child node. Please, check your code.");
  }
  const { ref: tooltipRef, id: id2, style: style2, ...otherTooltipProps } = getTooltipProps();
  const animatedContent = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: tooltipRef, id: id2, style: style2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    m$3.div,
    {
      animate: "enter",
      exit: "exit",
      initial: "exit",
      variants: TRANSITION_VARIANTS.scaleSpring,
      ...mergeProps$3(motionProps, otherTooltipProps),
      style: {
        ...getTransformOrigins(placement)
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...getTooltipContentProps(), children: content2 })
    },
    `${id2}-tooltip-inner`
  ) }, `${id2}-tooltip-content`);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    trigger,
    disableAnimation ? isOpen && /* @__PURE__ */ jsxRuntimeExports.jsx($f57aed4a881a3485$export$b47c3594eab58386, { portalContainer, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: tooltipRef, id: id2, style: style2, ...otherTooltipProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...getTooltipContentProps(), children: content2 }) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$5, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { children: isOpen && /* @__PURE__ */ jsxRuntimeExports.jsx($f57aed4a881a3485$export$b47c3594eab58386, { portalContainer, children: animatedContent }) }) })
  ] });
});
Tooltip$5.displayName = "HeroUI.Tooltip";
var tooltip_default = Tooltip$5;
var Snippet = forwardRef((props, ref) => {
  const {
    Component: Component2,
    domRef,
    preRef,
    children,
    slots,
    classNames: classNames2,
    copied,
    copyIcon = /* @__PURE__ */ jsxRuntimeExports.jsx(CopyLinearIcon, {}),
    checkIcon = /* @__PURE__ */ jsxRuntimeExports.jsx(CheckLinearIcon, {}),
    symbolBefore,
    disableCopy,
    disableTooltip,
    hideSymbol,
    hideCopyButton,
    tooltipProps,
    isMultiLine,
    onCopy,
    getSnippetProps,
    getCopyButtonProps
  } = useSnippet({ ...props, ref });
  const TooltipContent = reactExports.useCallback(
    ({ children: children2 }) => /* @__PURE__ */ jsxRuntimeExports.jsx(tooltip_default, { ...tooltipProps, isDisabled: copied || tooltipProps.isDisabled, children: children2 }),
    [objectToDeps(tooltipProps)]
  );
  const contents = reactExports.useMemo(() => {
    if (hideCopyButton) {
      return null;
    }
    const clonedCheckIcon = checkIcon && reactExports.cloneElement(checkIcon, { className: slots.checkIcon() });
    const clonedCopyIcon = copyIcon && reactExports.cloneElement(copyIcon, { className: slots.copyIcon() });
    const copyButton = /* @__PURE__ */ jsxRuntimeExports.jsxs(button_default$1, { ...getCopyButtonProps(), children: [
      clonedCheckIcon,
      clonedCopyIcon
    ] });
    if (disableTooltip) {
      return copyButton;
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: copyButton });
  }, [
    slots,
    classNames2 == null ? void 0 : classNames2.copyButton,
    copied,
    checkIcon,
    copyIcon,
    onCopy,
    TooltipContent,
    disableCopy,
    disableTooltip,
    hideCopyButton
  ]);
  const preContent = reactExports.useMemo(() => {
    if (isMultiLine && children && Array.isArray(children)) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: slots.content({ class: classNames2 == null ? void 0 : classNames2.content }), children: children.map((t2, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("pre", { className: slots.pre({ class: classNames2 == null ? void 0 : classNames2.pre }), children: [
        !hideSymbol && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.symbol({ class: classNames2 == null ? void 0 : classNames2.symbol }), children: symbolBefore }),
        t2
      ] }, `${index2}-${t2}`)) });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("pre", { ref: preRef, className: slots.pre({ class: classNames2 == null ? void 0 : classNames2.pre }), children: [
      !hideSymbol && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.symbol({ class: classNames2 == null ? void 0 : classNames2.symbol }), children: symbolBefore }),
      children
    ] });
  }, [children, hideSymbol, isMultiLine, symbolBefore, classNames2 == null ? void 0 : classNames2.pre, slots]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ref: domRef, ...getSnippetProps(), children: [
    preContent,
    contents
  ] });
});
Snippet.displayName = "HeroUI.Snippet";
var snippet_default = Snippet;
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$a = false;
let $6179b936705e76d3$var$hoverCount$a = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$a() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$a = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$a = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$a(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$a();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$a() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$a);
  $6179b936705e76d3$var$hoverCount$a++;
  return () => {
    $6179b936705e76d3$var$hoverCount$a--;
    if ($6179b936705e76d3$var$hoverCount$a > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$a);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$a(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$a, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$a && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
function $b418ec0c85c52f27$export$d853f7095ae95f88(props, state, ref) {
  let { labelProps, inputProps, isSelected, isPressed, isDisabled, isReadOnly } = $d2c8e2b0480f3f34$export$cbe85ee05b554577(props, state, ref);
  return {
    labelProps,
    inputProps: {
      ...inputProps,
      role: "switch",
      checked: isSelected
    },
    isSelected,
    isPressed,
    isDisabled,
    isReadOnly
  };
}
function $3017fa7ffdddec74$export$8042c6c013fd5226(props = {}) {
  let { isReadOnly } = props;
  let [isSelected, setSelected] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.isSelected, props.defaultSelected || false, props.onChange);
  function updateSelected(value2) {
    if (!isReadOnly)
      setSelected(value2);
  }
  function toggleState() {
    if (!isReadOnly)
      setSelected(!isSelected);
  }
  return {
    isSelected,
    setSelected: updateSelected,
    toggle: toggleState
  };
}
function useSwitch(originalProps = {}) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, toggle.variantKeys);
  const {
    ref,
    as: as2,
    name: name2,
    value: value2 = "",
    isReadOnly: isReadOnlyProp = false,
    autoFocus = false,
    startContent,
    endContent,
    defaultSelected,
    isSelected: isSelectedProp,
    children,
    thumbIcon,
    className,
    classNames: classNames2,
    onChange,
    onValueChange,
    ...otherProps
  } = props;
  const Component2 = as2 || "label";
  const domRef = reactExports.useRef(null);
  const inputRef = reactExports.useRef(null);
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const labelId = reactExports.useId();
  const ariaSwitchProps = reactExports.useMemo(() => {
    const ariaLabel = otherProps["aria-label"] || typeof children === "string" ? children : void 0;
    return {
      name: name2,
      value: value2,
      children,
      autoFocus,
      defaultSelected,
      isSelected: isSelectedProp,
      isDisabled: !!originalProps.isDisabled,
      isReadOnly: isReadOnlyProp,
      "aria-label": ariaLabel,
      "aria-labelledby": otherProps["aria-labelledby"] || labelId,
      onChange: onValueChange
    };
  }, [
    value2,
    name2,
    labelId,
    children,
    autoFocus,
    isReadOnlyProp,
    isSelectedProp,
    defaultSelected,
    originalProps.isDisabled,
    otherProps["aria-label"],
    otherProps["aria-labelledby"],
    onValueChange
  ]);
  const state = $3017fa7ffdddec74$export$8042c6c013fd5226(ariaSwitchProps);
  useSafeLayoutEffect(() => {
    if (!inputRef.current)
      return;
    const isInputRefChecked = !!inputRef.current.checked;
    state.setSelected(isInputRefChecked);
  }, [inputRef.current]);
  const { inputProps, isPressed, isReadOnly } = $b418ec0c85c52f27$export$d853f7095ae95f88(ariaSwitchProps, state, inputRef);
  const { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({ autoFocus: inputProps.autoFocus });
  const { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456$a({
    isDisabled: inputProps.disabled
  });
  const isInteractionDisabled = ariaSwitchProps.isDisabled || isReadOnly;
  const pressed = isInteractionDisabled ? false : isPressed;
  const isSelected = inputProps.checked;
  const isDisabled = inputProps.disabled;
  const slots = reactExports.useMemo(
    () => toggle({
      ...variantProps2,
      disableAnimation
    }),
    [objectToDeps(variantProps2), disableAnimation]
  );
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const getBaseProps = (props2) => {
    return {
      ...mergeProps$3(hoverProps, otherProps, props2),
      ref: domRef,
      className: slots.base({ class: clsx$4(baseStyles, props2 == null ? void 0 : props2.className) }),
      "data-disabled": dataAttr(isDisabled),
      "data-selected": dataAttr(isSelected),
      "data-readonly": dataAttr(isReadOnly),
      "data-focus": dataAttr(isFocused),
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-hover": dataAttr(isHovered),
      "data-pressed": dataAttr(pressed)
    };
  };
  const getWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "aria-hidden": true,
        className: clsx$4(slots.wrapper({ class: clsx$4(classNames2 == null ? void 0 : classNames2.wrapper, props2 == null ? void 0 : props2.className) }))
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.wrapper]
  );
  const getInputProps = (props2 = {}) => {
    return {
      ...mergeProps$3(inputProps, focusProps, props2),
      ref: mergeRefs(inputRef, ref),
      id: inputProps.id,
      className: slots.hiddenInput({ class: classNames2 == null ? void 0 : classNames2.hiddenInput }),
      onChange: chain(onChange, inputProps.onChange)
    };
  };
  const getThumbProps = reactExports.useCallback(
    (props2 = {}) => ({
      ...props2,
      className: slots.thumb({ class: clsx$4(classNames2 == null ? void 0 : classNames2.thumb, props2 == null ? void 0 : props2.className) })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.thumb]
  );
  const getLabelProps = reactExports.useCallback(
    (props2 = {}) => ({
      ...props2,
      id: labelId,
      className: slots.label({ class: clsx$4(classNames2 == null ? void 0 : classNames2.label, props2 == null ? void 0 : props2.className) })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.label, isDisabled, isSelected]
  );
  const getThumbIconProps = reactExports.useCallback(
    (props2 = {
      includeStateProps: false
    }) => mergeProps$3(
      {
        width: "1em",
        height: "1em",
        className: slots.thumbIcon({ class: clsx$4(classNames2 == null ? void 0 : classNames2.thumbIcon) })
      },
      props2.includeStateProps ? {
        isSelected
      } : {}
    ),
    [slots, classNames2 == null ? void 0 : classNames2.thumbIcon, isSelected]
  );
  const getStartContentProps = reactExports.useCallback(
    (props2 = {}) => ({
      width: "1em",
      height: "1em",
      ...props2,
      className: slots.startContent({ class: clsx$4(classNames2 == null ? void 0 : classNames2.startContent, props2 == null ? void 0 : props2.className) })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.startContent, isSelected]
  );
  const getEndContentProps = reactExports.useCallback(
    (props2 = {}) => ({
      width: "1em",
      height: "1em",
      ...props2,
      className: slots.endContent({ class: clsx$4(classNames2 == null ? void 0 : classNames2.endContent, props2 == null ? void 0 : props2.className) })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.endContent, isSelected]
  );
  return {
    Component: Component2,
    slots,
    classNames: classNames2,
    domRef,
    children,
    thumbIcon,
    startContent,
    endContent,
    isHovered,
    isSelected,
    isPressed: pressed,
    isFocused,
    isFocusVisible,
    isDisabled,
    getBaseProps,
    getWrapperProps,
    getInputProps,
    getLabelProps,
    getThumbProps,
    getThumbIconProps,
    getStartContentProps,
    getEndContentProps
  };
}
var Switch = forwardRef((props, ref) => {
  const {
    Component: Component2,
    children,
    startContent,
    endContent,
    thumbIcon,
    getBaseProps,
    getInputProps,
    getWrapperProps,
    getThumbProps,
    getThumbIconProps,
    getLabelProps,
    getStartContentProps,
    getEndContentProps
  } = useSwitch({ ...props, ref });
  const clonedThumbIcon = typeof thumbIcon === "function" ? thumbIcon(getThumbIconProps({ includeStateProps: true })) : thumbIcon && reactExports.cloneElement(thumbIcon, getThumbIconProps());
  const clonedStartContent = startContent && reactExports.cloneElement(startContent, getStartContentProps());
  const clonedEndContent = endContent && reactExports.cloneElement(endContent, getEndContentProps());
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getBaseProps(), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...getInputProps() }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { ...getWrapperProps(), children: [
      startContent && clonedStartContent,
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getThumbProps(), children: thumbIcon && clonedThumbIcon }),
      endContent && clonedEndContent
    ] }),
    children && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children })
  ] });
});
Switch.displayName = "HeroUI.Switch";
var switch_default = Switch;
function useIsMounted(props = {}) {
  const { rerender = false, delay: delay2 = 0 } = props;
  const isMountedRef = reactExports.useRef(false);
  const [isMounted, setIsMounted] = reactExports.useState(false);
  reactExports.useEffect(() => {
    isMountedRef.current = true;
    let timer = null;
    if (rerender) {
      if (delay2 > 0) {
        timer = setTimeout(() => {
          setIsMounted(true);
        }, delay2);
      } else {
        setIsMounted(true);
      }
    }
    return () => {
      isMountedRef.current = false;
      if (rerender) {
        setIsMounted(false);
      }
      if (timer) {
        clearTimeout(timer);
      }
    };
  }, [rerender]);
  return [reactExports.useCallback(() => isMountedRef.current, []), isMounted];
}
function $204d9ebcedfb8806$export$ed5abd763a836edc(props) {
  let { value: value2 = 0, minValue = 0, maxValue = 100, valueLabel, isIndeterminate, formatOptions = {
    style: "percent"
  } } = props;
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  let { labelProps, fieldProps } = $d191a55c9702f145$export$8467354a121f1b9f$1({
    ...props,
    // Progress bar is not an HTML input element so it
    // shouldn't be labeled by a <label> element.
    labelElementType: "span"
  });
  value2 = $9446cca9a3875146$export$7d15b64cf5a3a4c4(value2, minValue, maxValue);
  let percentage = (value2 - minValue) / (maxValue - minValue);
  let formatter = $a916eb452884faea$export$b7a616150fdb9f44$1(formatOptions);
  if (!isIndeterminate && !valueLabel) {
    let valueToFormat = formatOptions.style === "percent" ? percentage : value2;
    valueLabel = formatter.format(valueToFormat);
  }
  return {
    progressBarProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, {
      ...fieldProps,
      "aria-valuenow": isIndeterminate ? void 0 : value2,
      "aria-valuemin": minValue,
      "aria-valuemax": maxValue,
      "aria-valuetext": isIndeterminate ? void 0 : valueLabel,
      role: "progressbar"
    }),
    labelProps
  };
}
function useCircularProgress(originalProps) {
  var _a2, _b2, _c2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, circularProgress.variantKeys);
  const {
    ref,
    as: as2,
    id: id2,
    className,
    classNames: classNames2,
    label,
    valueLabel,
    value: value2 = void 0,
    minValue = 0,
    maxValue = 100,
    strokeWidth: strokeWidthProp,
    showValueLabel = false,
    formatOptions = {
      style: "percent"
    },
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const [, isMounted] = useIsMounted({
    rerender: true,
    delay: 100
  });
  const isIndeterminate = ((_a2 = originalProps.isIndeterminate) != null ? _a2 : true) && value2 === void 0;
  const disableAnimation = (_c2 = (_b2 = originalProps.disableAnimation) != null ? _b2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _c2 : false;
  const { progressBarProps, labelProps } = $204d9ebcedfb8806$export$ed5abd763a836edc({
    id: id2,
    label,
    value: value2,
    minValue,
    maxValue,
    valueLabel,
    formatOptions,
    isIndeterminate,
    "aria-labelledby": originalProps["aria-labelledby"],
    "aria-label": originalProps["aria-label"]
  });
  const slots = reactExports.useMemo(
    () => circularProgress({
      ...variantProps2,
      disableAnimation,
      isIndeterminate
    }),
    [objectToDeps(variantProps2), disableAnimation, isIndeterminate]
  );
  const selfMounted = disableAnimation ? true : isMounted;
  const center = 16;
  const strokeWidth = strokeWidthProp || (originalProps.size === "sm" ? 2 : 3);
  const radius = 16 - strokeWidth;
  const circumference = 2 * radius * Math.PI;
  const percentage = reactExports.useMemo(() => {
    if (!selfMounted) {
      return 0;
    }
    if (isIndeterminate) {
      return 0.25;
    }
    return value2 ? clampPercentage((value2 - minValue) / (maxValue - minValue), 1) : 0;
  }, [selfMounted, value2, minValue, maxValue, isIndeterminate]);
  const offset2 = circumference - percentage * circumference;
  const getProgressBarProps = reactExports.useCallback(
    (props2 = {}) => ({
      ref: domRef,
      "data-indeterminate": dataAttr(isIndeterminate),
      "data-disabled": dataAttr(originalProps.isDisabled),
      className: slots.base({ class: baseStyles }),
      ...mergeProps$3(progressBarProps, otherProps, props2)
    }),
    [
      domRef,
      slots,
      isIndeterminate,
      originalProps.isDisabled,
      baseStyles,
      progressBarProps,
      otherProps
    ]
  );
  const getLabelProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }),
      ...mergeProps$3(labelProps, props2)
    }),
    [slots, classNames2, labelProps]
  );
  const getSvgProps = reactExports.useCallback(
    (props2 = {}) => ({
      viewBox: "0 0 32 32",
      fill: "none",
      strokeWidth,
      className: slots.svg({ class: classNames2 == null ? void 0 : classNames2.svg }),
      ...props2
    }),
    [strokeWidth, slots, classNames2]
  );
  const getIndicatorProps = reactExports.useCallback(
    (props2 = {}) => ({
      cx: center,
      cy: center,
      r: radius,
      role: "presentation",
      strokeDasharray: `${circumference} ${circumference}`,
      strokeDashoffset: offset2,
      transform: "rotate(-90 16 16)",
      strokeLinecap: "round",
      className: slots.indicator({ class: classNames2 == null ? void 0 : classNames2.indicator }),
      ...props2
    }),
    [slots, classNames2, offset2, circumference, radius]
  );
  const getTrackProps = reactExports.useCallback(
    (props2 = {}) => ({
      cx: center,
      cy: center,
      r: radius,
      role: "presentation",
      strokeDasharray: `${circumference} ${circumference}`,
      strokeDashoffset: 0,
      transform: "rotate(-90 16 16)",
      strokeLinecap: "round",
      className: slots.track({ class: classNames2 == null ? void 0 : classNames2.track }),
      ...props2
    }),
    [slots, classNames2, circumference, radius]
  );
  return {
    Component: Component2,
    domRef,
    slots,
    classNames: classNames2,
    label,
    showValueLabel,
    getProgressBarProps,
    getLabelProps,
    getSvgProps,
    getIndicatorProps,
    getTrackProps
  };
}
var CircularProgress = forwardRef((props, ref) => {
  const {
    Component: Component2,
    slots,
    classNames: classNames2,
    label,
    showValueLabel,
    getProgressBarProps,
    getLabelProps,
    getSvgProps,
    getIndicatorProps,
    getTrackProps
  } = useCircularProgress({ ref, ...props });
  const progressBarProps = getProgressBarProps();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...progressBarProps, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: slots.svgWrapper({ class: classNames2 == null ? void 0 : classNames2.svgWrapper }), children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { ...getSvgProps(), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("circle", { ...getTrackProps() }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("circle", { ...getIndicatorProps() })
      ] }),
      showValueLabel && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.value({ class: classNames2 == null ? void 0 : classNames2.value }), children: progressBarProps["aria-valuetext"] })
    ] }),
    label && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children: label })
  ] });
});
CircularProgress.displayName = "HeroUI.CircularProgress";
var circular_progress_default = CircularProgress;
function useProgress(originalProps) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, progress.variantKeys);
  const {
    ref,
    as: as2,
    id: id2,
    className,
    classNames: classNames2,
    label,
    valueLabel,
    value: value2 = 0,
    minValue = 0,
    maxValue = 100,
    showValueLabel = false,
    formatOptions = {
      style: "percent"
    },
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const [, isMounted] = useIsMounted({
    rerender: true,
    delay: 100
  });
  const isIndeterminate = originalProps.isIndeterminate;
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const { progressBarProps, labelProps } = $204d9ebcedfb8806$export$ed5abd763a836edc({
    id: id2,
    label,
    value: value2,
    minValue,
    maxValue,
    valueLabel,
    formatOptions,
    isIndeterminate,
    "aria-labelledby": originalProps["aria-labelledby"],
    "aria-label": originalProps["aria-label"]
  });
  const slots = reactExports.useMemo(
    () => progress({
      ...variantProps2,
      disableAnimation
    }),
    [objectToDeps(variantProps2), disableAnimation]
  );
  const selfMounted = disableAnimation ? true : isMounted;
  const percentage = reactExports.useMemo(
    () => isIndeterminate || !selfMounted ? void 0 : clampPercentage((value2 - minValue) / (maxValue - minValue) * 100),
    [selfMounted, isIndeterminate, value2, minValue, maxValue]
  );
  const getProgressBarProps = reactExports.useCallback(
    (props2 = {}) => ({
      ref: domRef,
      "data-indeterminate": dataAttr(isIndeterminate),
      "data-disabled": dataAttr(originalProps.isDisabled),
      className: slots.base({ class: baseStyles }),
      ...mergeProps$3(progressBarProps, otherProps, props2)
    }),
    [
      domRef,
      slots,
      isIndeterminate,
      originalProps.isDisabled,
      baseStyles,
      progressBarProps,
      otherProps
    ]
  );
  const getLabelProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }),
      ...mergeProps$3(labelProps, props2)
    }),
    [slots, classNames2, labelProps]
  );
  return {
    Component: Component2,
    domRef,
    slots,
    classNames: classNames2,
    label,
    percentage,
    showValueLabel,
    getProgressBarProps,
    getLabelProps
  };
}
var Progress$1 = forwardRef((props, ref) => {
  const {
    Component: Component2,
    slots,
    classNames: classNames2,
    label,
    percentage,
    showValueLabel,
    getProgressBarProps,
    getLabelProps
  } = useProgress({ ...props, ref });
  const progressBarProps = getProgressBarProps();
  const shouldShowLabelWrapper = label || showValueLabel;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...progressBarProps, children: [
    shouldShowLabelWrapper ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: slots.labelWrapper({ class: classNames2 == null ? void 0 : classNames2.labelWrapper }), children: [
      label && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children: label }),
      showValueLabel && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.value({ class: classNames2 == null ? void 0 : classNames2.value }), children: progressBarProps["aria-valuetext"] })
    ] }) : null,
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: slots.track({ class: classNames2 == null ? void 0 : classNames2.track }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        className: slots.indicator({ class: classNames2 == null ? void 0 : classNames2.indicator }),
        style: {
          transform: `translateX(-${100 - (percentage || 0)}%)`
        }
      }
    ) })
  ] });
});
Progress$1.displayName = "HeroUI.Progress";
var progress_default = Progress$1;
function $8a9cb279dc87e130$export$525bc4921d56d4a$6(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$5(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$715c682d09d639cc$3(onBlur) {
  let stateRef = reactExports.useRef({
    isFocused: false,
    observer: null
  });
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    const state = stateRef.current;
    return () => {
      if (state.observer) {
        state.observer.disconnect();
        state.observer = null;
      }
    };
  }, []);
  let dispatchBlur = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onBlur === null || onBlur === void 0 ? void 0 : onBlur(e2);
  });
  return reactExports.useCallback((e2) => {
    if (e2.target instanceof HTMLButtonElement || e2.target instanceof HTMLInputElement || e2.target instanceof HTMLTextAreaElement || e2.target instanceof HTMLSelectElement) {
      stateRef.current.isFocused = true;
      let target = e2.target;
      let onBlurHandler = (e3) => {
        stateRef.current.isFocused = false;
        if (target.disabled) {
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a$6(e3);
          dispatchBlur(event);
        }
        if (stateRef.current.observer) {
          stateRef.current.observer.disconnect();
          stateRef.current.observer = null;
        }
      };
      target.addEventListener("focusout", onBlurHandler, {
        once: true
      });
      stateRef.current.observer = new MutationObserver(() => {
        if (stateRef.current.isFocused && target.disabled) {
          var _stateRef_current_observer;
          (_stateRef_current_observer = stateRef.current.observer) === null || _stateRef_current_observer === void 0 ? void 0 : _stateRef_current_observer.disconnect();
          let relatedTargetEl = target === document.activeElement ? null : document.activeElement;
          target.dispatchEvent(new FocusEvent("blur", {
            relatedTarget: relatedTargetEl
          }));
          target.dispatchEvent(new FocusEvent("focusout", {
            bubbles: true,
            relatedTarget: relatedTargetEl
          }));
        }
      });
      stateRef.current.observer.observe(target, {
        attributes: true,
        attributeFilter: [
          "disabled"
        ]
      });
    }
  }, [
    dispatchBlur
  ]);
}
function $8a9cb279dc87e130$export$cabe61c495ee3649$5(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$3(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$4(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$5 = "default";
let $14c0b72509d70225$var$savedUserSelect$5 = "";
let $14c0b72509d70225$var$modifiedElementMap$5 = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$5(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$5 === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
      $14c0b72509d70225$var$savedUserSelect$5 = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$5 = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$5.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$5(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$5 !== "disabled")
      return;
    $14c0b72509d70225$var$state$5 = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
        if ($14c0b72509d70225$var$state$5 === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$5 || "";
          $14c0b72509d70225$var$savedUserSelect$5 = "";
          $14c0b72509d70225$var$state$5 = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$5.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$5.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$5.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$5 = React$5.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$5.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext$5(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$5);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$9(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$5 = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$5 = class $f6c31cce2adf654f$var$PressEvent7 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$5, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$5);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$5, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$5, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$5 = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$5 = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$5 = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$5(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$5(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$5("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$5("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$5("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$5("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$5(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$5(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$5(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$6(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$5(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$5($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$5(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$3(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$5(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$9(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$6())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$4(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$5(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$5(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$5(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$5($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$5(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$5(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$5]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$5] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$3(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$5(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$5(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$5(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$5(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$5(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$5))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$5;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$5}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$5((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$5]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$5(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$5(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$5(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$5(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$5(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$5(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$5(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$5(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$5(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$5(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$5 = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$5(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$5.has(target.type);
}
function $9ab94262bd0047c7$export$420e68273165f4ec$2(props) {
  let { isDisabled, onBlurWithin, onFocusWithin, onFocusWithinChange } = props;
  let state = reactExports.useRef({
    isFocusWithin: false
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let onBlur = reactExports.useCallback((e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    if (state.current.isFocusWithin && !e2.currentTarget.contains(e2.relatedTarget)) {
      state.current.isFocusWithin = false;
      removeAllGlobalListeners();
      if (onBlurWithin)
        onBlurWithin(e2);
      if (onFocusWithinChange)
        onFocusWithinChange(false);
    }
  }, [
    onBlurWithin,
    onFocusWithinChange,
    state,
    removeAllGlobalListeners
  ]);
  let onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc$3(onBlur);
  let onFocus = reactExports.useCallback((e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(e2.target);
    const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
    if (!state.current.isFocusWithin && activeElement === $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) {
      if (onFocusWithin)
        onFocusWithin(e2);
      if (onFocusWithinChange)
        onFocusWithinChange(true);
      state.current.isFocusWithin = true;
      onSyntheticFocus(e2);
      let currentTarget = e2.currentTarget;
      addGlobalListener(ownerDocument, "focus", (e3) => {
        if (state.current.isFocusWithin && !$d4ee10de306f2510$export$4282f70798064fe0$3(currentTarget, e3.target)) {
          let nativeEvent = new ownerDocument.defaultView.FocusEvent("blur", {
            relatedTarget: e3.target
          });
          $8a9cb279dc87e130$export$c2b7abe5d61ec696$5(nativeEvent, currentTarget);
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a$6(nativeEvent);
          onBlur(event);
        }
      }, {
        capture: true
      });
    }
  }, [
    onFocusWithin,
    onFocusWithinChange,
    onSyntheticFocus,
    addGlobalListener,
    onBlur
  ]);
  if (isDisabled)
    return {
      focusWithinProps: {
        // These cannot be null, that would conflict in mergeProps
        onFocus: void 0,
        onBlur: void 0
      }
    };
  return {
    focusWithinProps: {
      onFocus,
      onBlur
    }
  };
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$9 = false;
let $6179b936705e76d3$var$hoverCount$9 = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$9() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$9 = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$9 = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$9(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$9();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$9() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$9);
  $6179b936705e76d3$var$hoverCount$9++;
  return () => {
    $6179b936705e76d3$var$hoverCount$9--;
    if ($6179b936705e76d3$var$hoverCount$9 > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$9);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$9(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$9, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$9 && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
function $458b0a5536c1a7cf$export$40bfa8c7b0832715$5(value2, defaultValue2, onChange) {
  let [stateValue, setStateValue] = reactExports.useState(value2 || defaultValue2);
  let isControlledRef = reactExports.useRef(value2 !== void 0);
  let isControlled = value2 !== void 0;
  reactExports.useEffect(() => {
    isControlledRef.current;
    isControlledRef.current = isControlled;
  }, [
    isControlled
  ]);
  let currentValue = isControlled ? value2 : stateValue;
  let setValue = reactExports.useCallback((value22, ...args) => {
    let onChangeCaller = (value3, ...onChangeArgs) => {
      if (onChange) {
        if (!Object.is(currentValue, value3))
          onChange(value3, ...onChangeArgs);
      }
      if (!isControlled)
        currentValue = value3;
    };
    if (typeof value22 === "function") {
      let updateFunction = (oldValue, ...functionArgs) => {
        let interceptedValue = value22(isControlled ? currentValue : oldValue, ...functionArgs);
        onChangeCaller(interceptedValue, ...args);
        if (!isControlled)
          return interceptedValue;
        return oldValue;
      };
      setStateValue(updateFunction);
    } else {
      if (!isControlled)
        setStateValue(value22);
      onChangeCaller(value22, ...args);
    }
  }, [
    isControlled,
    currentValue,
    onChange
  ]);
  return [
    currentValue,
    setValue
  ];
}
function $458b0a5536c1a7cf$export$40bfa8c7b0832715$4(value2, defaultValue2, onChange) {
  let [stateValue, setStateValue] = reactExports.useState(value2 || defaultValue2);
  let isControlledRef = reactExports.useRef(value2 !== void 0);
  let isControlled = value2 !== void 0;
  reactExports.useEffect(() => {
    isControlledRef.current;
    isControlledRef.current = isControlled;
  }, [
    isControlled
  ]);
  let currentValue = isControlled ? value2 : stateValue;
  let setValue = reactExports.useCallback((value22, ...args) => {
    let onChangeCaller = (value3, ...onChangeArgs) => {
      if (onChange) {
        if (!Object.is(currentValue, value3))
          onChange(value3, ...onChangeArgs);
      }
      if (!isControlled)
        currentValue = value3;
    };
    if (typeof value22 === "function") {
      let updateFunction = (oldValue, ...functionArgs) => {
        let interceptedValue = value22(isControlled ? currentValue : oldValue, ...functionArgs);
        onChangeCaller(interceptedValue, ...args);
        if (!isControlled)
          return interceptedValue;
        return oldValue;
      };
      setStateValue(updateFunction);
    } else {
      if (!isControlled)
        setStateValue(value22);
      onChangeCaller(value22, ...args);
    }
  }, [
    isControlled,
    currentValue,
    onChange
  ]);
  return [
    currentValue,
    setValue
  ];
}
function $8a9cb279dc87e130$export$525bc4921d56d4a$5(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$715c682d09d639cc$2(onBlur) {
  let stateRef = reactExports.useRef({
    isFocused: false,
    observer: null
  });
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    const state = stateRef.current;
    return () => {
      if (state.observer) {
        state.observer.disconnect();
        state.observer = null;
      }
    };
  }, []);
  let dispatchBlur = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onBlur === null || onBlur === void 0 ? void 0 : onBlur(e2);
  });
  return reactExports.useCallback((e2) => {
    if (e2.target instanceof HTMLButtonElement || e2.target instanceof HTMLInputElement || e2.target instanceof HTMLTextAreaElement || e2.target instanceof HTMLSelectElement) {
      stateRef.current.isFocused = true;
      let target = e2.target;
      let onBlurHandler = (e3) => {
        stateRef.current.isFocused = false;
        if (target.disabled) {
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a$5(e3);
          dispatchBlur(event);
        }
        if (stateRef.current.observer) {
          stateRef.current.observer.disconnect();
          stateRef.current.observer = null;
        }
      };
      target.addEventListener("focusout", onBlurHandler, {
        once: true
      });
      stateRef.current.observer = new MutationObserver(() => {
        if (stateRef.current.isFocused && target.disabled) {
          var _stateRef_current_observer;
          (_stateRef_current_observer = stateRef.current.observer) === null || _stateRef_current_observer === void 0 ? void 0 : _stateRef_current_observer.disconnect();
          let relatedTargetEl = target === document.activeElement ? null : document.activeElement;
          target.dispatchEvent(new FocusEvent("blur", {
            relatedTarget: relatedTargetEl
          }));
          target.dispatchEvent(new FocusEvent("focusout", {
            bubbles: true,
            relatedTarget: relatedTargetEl
          }));
        }
      });
      stateRef.current.observer.observe(target, {
        attributes: true,
        attributeFilter: [
          "disabled"
        ]
      });
    }
  }, [
    dispatchBlur
  ]);
}
let $8a9cb279dc87e130$export$fda7da73ab5d4c48$4 = false;
let $507fabe10e71c6fb$var$currentModality$2 = null;
let $507fabe10e71c6fb$var$changeHandlers$4 = /* @__PURE__ */ new Set();
let $507fabe10e71c6fb$export$d90243b58daecda7$4 = /* @__PURE__ */ new Map();
let $507fabe10e71c6fb$var$hasEventBeforeFocus$4 = false;
let $507fabe10e71c6fb$var$hasBlurredWindowRecently$4 = false;
function $507fabe10e71c6fb$var$triggerChangeHandlers$4(modality, e2) {
  for (let handler of $507fabe10e71c6fb$var$changeHandlers$4)
    handler(modality, e2);
}
function $507fabe10e71c6fb$var$isValidKey$4(e2) {
  return !(e2.metaKey || !$c87311424ea30a05$export$9ac100e40613ea10$6() && e2.altKey || e2.ctrlKey || e2.key === "Control" || e2.key === "Shift" || e2.key === "Meta");
}
function $507fabe10e71c6fb$var$handleKeyboardEvent$4(e2) {
  $507fabe10e71c6fb$var$hasEventBeforeFocus$4 = true;
  if ($507fabe10e71c6fb$var$isValidKey$4(e2)) {
    $507fabe10e71c6fb$var$currentModality$2 = "keyboard";
    $507fabe10e71c6fb$var$triggerChangeHandlers$4("keyboard", e2);
  }
}
function $507fabe10e71c6fb$var$handlePointerEvent$4(e2) {
  $507fabe10e71c6fb$var$currentModality$2 = "pointer";
  if (e2.type === "mousedown" || e2.type === "pointerdown") {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$4 = true;
    $507fabe10e71c6fb$var$triggerChangeHandlers$4("pointer", e2);
  }
}
function $507fabe10e71c6fb$var$handleClickEvent$4(e2) {
  if ($6a7db85432448f7f$export$60278871457622de$4(e2)) {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$4 = true;
    $507fabe10e71c6fb$var$currentModality$2 = "virtual";
  }
}
function $507fabe10e71c6fb$var$handleFocusEvent$4(e2) {
  if (e2.target === window || e2.target === document || $8a9cb279dc87e130$export$fda7da73ab5d4c48$4 || !e2.isTrusted)
    return;
  if (!$507fabe10e71c6fb$var$hasEventBeforeFocus$4 && !$507fabe10e71c6fb$var$hasBlurredWindowRecently$4) {
    $507fabe10e71c6fb$var$currentModality$2 = "virtual";
    $507fabe10e71c6fb$var$triggerChangeHandlers$4("virtual", e2);
  }
  $507fabe10e71c6fb$var$hasEventBeforeFocus$4 = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently$4 = false;
}
function $507fabe10e71c6fb$var$handleWindowBlur$4() {
  $507fabe10e71c6fb$var$hasEventBeforeFocus$4 = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently$4 = true;
}
function $507fabe10e71c6fb$var$setupGlobalFocusEvents$4(element2) {
  if (typeof window === "undefined" || typeof document === "undefined" || $507fabe10e71c6fb$export$d90243b58daecda7$4.get($431fbd86ca7dc216$export$f21a1ffae260145a$4(element2)))
    return;
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  let focus = windowObject.HTMLElement.prototype.focus;
  windowObject.HTMLElement.prototype.focus = function() {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$4 = true;
    focus.apply(this, arguments);
  };
  documentObject.addEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent$4, true);
  documentObject.addEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent$4, true);
  documentObject.addEventListener("click", $507fabe10e71c6fb$var$handleClickEvent$4, true);
  windowObject.addEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent$4, true);
  windowObject.addEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur$4, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.addEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent$4, true);
    documentObject.addEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent$4, true);
    documentObject.addEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent$4, true);
  }
  windowObject.addEventListener("beforeunload", () => {
    $507fabe10e71c6fb$var$tearDownWindowFocusTracking$4(element2);
  }, {
    once: true
  });
  $507fabe10e71c6fb$export$d90243b58daecda7$4.set(windowObject, {
    focus
  });
}
const $507fabe10e71c6fb$var$tearDownWindowFocusTracking$4 = (element2, loadListener) => {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  if (loadListener)
    documentObject.removeEventListener("DOMContentLoaded", loadListener);
  if (!$507fabe10e71c6fb$export$d90243b58daecda7$4.has(windowObject))
    return;
  windowObject.HTMLElement.prototype.focus = $507fabe10e71c6fb$export$d90243b58daecda7$4.get(windowObject).focus;
  documentObject.removeEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent$4, true);
  documentObject.removeEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent$4, true);
  documentObject.removeEventListener("click", $507fabe10e71c6fb$var$handleClickEvent$4, true);
  windowObject.removeEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent$4, true);
  windowObject.removeEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur$4, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.removeEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent$4, true);
    documentObject.removeEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent$4, true);
    documentObject.removeEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent$4, true);
  }
  $507fabe10e71c6fb$export$d90243b58daecda7$4.delete(windowObject);
};
function $507fabe10e71c6fb$export$2f1888112f558a7d$4(element2) {
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  let loadListener;
  if (documentObject.readyState !== "loading")
    $507fabe10e71c6fb$var$setupGlobalFocusEvents$4(element2);
  else {
    loadListener = () => {
      $507fabe10e71c6fb$var$setupGlobalFocusEvents$4(element2);
    };
    documentObject.addEventListener("DOMContentLoaded", loadListener);
  }
  return () => $507fabe10e71c6fb$var$tearDownWindowFocusTracking$4(element2, loadListener);
}
if (typeof document !== "undefined")
  $507fabe10e71c6fb$export$2f1888112f558a7d$4();
function $507fabe10e71c6fb$export$630ff653c5ada6a9$1() {
  return $507fabe10e71c6fb$var$currentModality$2;
}
function $3ad3f6e1647bc98d$export$80f3e147d781571c$1(element2) {
  const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
  if ($507fabe10e71c6fb$export$630ff653c5ada6a9$1() === "virtual") {
    let lastFocusedElement = activeElement;
    $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
      if ($d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument) === lastFocusedElement && element2.isConnected)
        $7215afc6de606d6b$export$de79e2c695e052f3$5(element2);
    });
  } else
    $7215afc6de606d6b$export$de79e2c695e052f3$5(element2);
}
function $a1ea59d68270f0dd$export$f8168d8dd8fd66e6$1(props) {
  let { isDisabled, onFocus: onFocusProp, onBlur: onBlurProp, onFocusChange } = props;
  const onBlur = reactExports.useCallback((e2) => {
    if (e2.target === e2.currentTarget) {
      if (onBlurProp)
        onBlurProp(e2);
      if (onFocusChange)
        onFocusChange(false);
      return true;
    }
  }, [
    onBlurProp,
    onFocusChange
  ]);
  const onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc$2(onBlur);
  const onFocus = reactExports.useCallback((e2) => {
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(e2.target);
    const activeElement = ownerDocument ? $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument) : $d4ee10de306f2510$export$cd4e5573fbe2b576();
    if (e2.target === e2.currentTarget && activeElement === $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) {
      if (onFocusProp)
        onFocusProp(e2);
      if (onFocusChange)
        onFocusChange(true);
      onSyntheticFocus(e2);
    }
  }, [
    onFocusChange,
    onFocusProp,
    onSyntheticFocus
  ]);
  return {
    focusProps: {
      onFocus: !isDisabled && (onFocusProp || onFocusChange || onBlurProp) ? onFocus : void 0,
      onBlur: !isDisabled && (onBlurProp || onFocusChange) ? onBlur : void 0
    }
  };
}
function $93925083ecbb358c$export$48d1ea6320830260$1(handler) {
  if (!handler)
    return void 0;
  let shouldStopPropagation = true;
  return (e2) => {
    let event = {
      ...e2,
      preventDefault() {
        e2.preventDefault();
      },
      isDefaultPrevented() {
        return e2.isDefaultPrevented();
      },
      stopPropagation() {
        shouldStopPropagation = true;
      },
      continuePropagation() {
        shouldStopPropagation = false;
      },
      isPropagationStopped() {
        return shouldStopPropagation;
      }
    };
    handler(event);
    if (shouldStopPropagation)
      e2.stopPropagation();
  };
}
function $46d819fcbaf35654$export$8f71654801c2f7cd$1(props) {
  return {
    keyboardProps: props.isDisabled ? {} : {
      onKeyDown: $93925083ecbb358c$export$48d1ea6320830260$1(props.onKeyDown),
      onKeyUp: $93925083ecbb358c$export$48d1ea6320830260$1(props.onKeyUp)
    }
  };
}
let $f645667febf57a63$export$f9762fab77588ecb$1 = /* @__PURE__ */ React$5.createContext(null);
function $f645667febf57a63$var$useFocusableContext$1(ref) {
  let context = reactExports.useContext($f645667febf57a63$export$f9762fab77588ecb$1) || {};
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, ref);
  let { ref: _24, ...otherProps } = context;
  return otherProps;
}
function $f645667febf57a63$export$4c014de7c8940b4c$1(props, domRef) {
  let { focusProps } = $a1ea59d68270f0dd$export$f8168d8dd8fd66e6$1(props);
  let { keyboardProps } = $46d819fcbaf35654$export$8f71654801c2f7cd$1(props);
  let interactions = $3ef42575df84b30b$export$9d1611c77c2fe928$9(focusProps, keyboardProps);
  let domProps = $f645667febf57a63$var$useFocusableContext$1(domRef);
  let interactionProps = props.isDisabled ? {} : domProps;
  let autoFocusRef = reactExports.useRef(props.autoFocus);
  reactExports.useEffect(() => {
    if (autoFocusRef.current && domRef.current)
      $3ad3f6e1647bc98d$export$80f3e147d781571c$1(domRef.current);
    autoFocusRef.current = false;
  }, [
    domRef
  ]);
  let tabIndex = props.excludeFromTabOrder ? -1 : 0;
  if (props.isDisabled)
    tabIndex = void 0;
  return {
    focusableProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9({
      ...interactions,
      tabIndex
    }, interactionProps)
  };
}
function $2d73ec29415bd339$export$712718f7aec83d5$1(props, ref) {
  let { inputElementType = "input", isDisabled = false, isRequired = false, isReadOnly = false, type: type4 = "text", validationBehavior = "aria" } = props;
  let [value2, setValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$4(props.value, props.defaultValue || "", props.onChange);
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$1(props, ref);
  let validationState = $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1({
    ...props,
    value: value2
  });
  let { isInvalid, validationErrors, validationDetails } = validationState.displayValidation;
  let { labelProps, fieldProps, descriptionProps, errorMessageProps } = $2baaea4c71418dea$export$294aa081a6c6f55d$1({
    ...props,
    isInvalid,
    errorMessage: props.errorMessage || validationErrors
  });
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  const inputOnlyProps = {
    type: type4,
    pattern: props.pattern
  };
  $99facab73266f662$export$5add1d006293d136(ref, value2, setValue);
  $e93e671b31057976$export$b8473d3665f3a75a$1(props, validationState, ref);
  reactExports.useEffect(() => {
    if (ref.current instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(ref.current).HTMLTextAreaElement) {
      let input2 = ref.current;
      Object.defineProperty(input2, "defaultValue", {
        get: () => input2.value,
        set: () => {
        },
        configurable: true
      });
    }
  }, [
    ref
  ]);
  return {
    labelProps,
    inputProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, inputElementType === "input" ? inputOnlyProps : void 0, {
      disabled: isDisabled,
      readOnly: isReadOnly,
      required: isRequired && validationBehavior === "native",
      "aria-required": isRequired && validationBehavior === "aria" || void 0,
      "aria-invalid": isInvalid || void 0,
      "aria-errormessage": props["aria-errormessage"],
      "aria-activedescendant": props["aria-activedescendant"],
      "aria-autocomplete": props["aria-autocomplete"],
      "aria-haspopup": props["aria-haspopup"],
      "aria-controls": props["aria-controls"],
      value: value2,
      onChange: (e2) => setValue(e2.target.value),
      autoComplete: props.autoComplete,
      autoCapitalize: props.autoCapitalize,
      maxLength: props.maxLength,
      minLength: props.minLength,
      name: props.name,
      placeholder: props.placeholder,
      inputMode: props.inputMode,
      autoCorrect: props.autoCorrect,
      spellCheck: props.spellCheck,
      [parseInt(React$5.version, 10) >= 17 ? "enterKeyHint" : "enterkeyhint"]: props.enterKeyHint,
      // Clipboard events
      onCopy: props.onCopy,
      onCut: props.onCut,
      onPaste: props.onPaste,
      // Composition events
      onCompositionEnd: props.onCompositionEnd,
      onCompositionStart: props.onCompositionStart,
      onCompositionUpdate: props.onCompositionUpdate,
      // Selection events
      onSelect: props.onSelect,
      // Input events
      onBeforeInput: props.onBeforeInput,
      onInput: props.onInput,
      ...focusableProps,
      ...fieldProps
    }),
    descriptionProps,
    errorMessageProps,
    isInvalid,
    validationErrors,
    validationDetails
  };
}
function useInput(originalProps) {
  var _a2, _b2, _c2, _d, _e, _f, _g;
  const globalContext = useProviderContext();
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext$1) || {};
  const [props, variantProps2] = mapPropsVariants(originalProps, input.variantKeys);
  const {
    ref,
    as: as2,
    type: type4,
    label,
    baseRef,
    wrapperRef,
    description,
    className,
    classNames: classNames2,
    autoFocus,
    startContent,
    endContent,
    onClear,
    onChange,
    validationState,
    validationBehavior = (_a2 = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _a2 : "native",
    innerWrapperRef: innerWrapperRefProp,
    onValueChange = () => {
    },
    ...otherProps
  } = props;
  const handleValueChange = reactExports.useCallback(
    (value2) => {
      onValueChange(value2 != null ? value2 : "");
    },
    [onValueChange]
  );
  const [isFocusWithin, setFocusWithin] = reactExports.useState(false);
  const Component2 = as2 || "div";
  const disableAnimation = (_c2 = (_b2 = originalProps.disableAnimation) != null ? _b2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _c2 : false;
  const domRef = useDOMRef(ref);
  const baseDomRef = useDOMRef(baseRef);
  const inputWrapperRef = useDOMRef(wrapperRef);
  const innerWrapperRef = useDOMRef(innerWrapperRefProp);
  const [inputValue, setInputValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$5(
    props.value,
    (_d = props.defaultValue) != null ? _d : "",
    handleValueChange
  );
  const isFileTypeInput = type4 === "file";
  const hasUploadedFiles = ((_g = (_f = (_e = domRef == null ? void 0 : domRef.current) == null ? void 0 : _e.files) == null ? void 0 : _f.length) != null ? _g : 0) > 0;
  const isFilledByDefault = ["date", "time", "month", "week", "range"].includes(type4);
  const isFilled = !isEmpty(inputValue) || isFilledByDefault || hasUploadedFiles;
  const isFilledWithin = isFilled || isFocusWithin;
  const isHiddenType = type4 === "hidden";
  const isMultiline = originalProps.isMultiline;
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className, isFilled ? "is-filled" : "");
  const handleClear = reactExports.useCallback(() => {
    var _a22;
    if (isFileTypeInput) {
      domRef.current.value = "";
    } else {
      setInputValue("");
    }
    onClear == null ? void 0 : onClear();
    (_a22 = domRef.current) == null ? void 0 : _a22.focus();
  }, [setInputValue, onClear, isFileTypeInput]);
  useSafeLayoutEffect(() => {
    if (!domRef.current)
      return;
    setInputValue(domRef.current.value);
  }, [domRef.current]);
  const {
    labelProps,
    inputProps,
    isInvalid: isAriaInvalid,
    validationErrors,
    validationDetails,
    descriptionProps,
    errorMessageProps
  } = $2d73ec29415bd339$export$712718f7aec83d5$1(
    {
      ...originalProps,
      validationBehavior,
      autoCapitalize: originalProps.autoCapitalize,
      value: inputValue,
      "aria-label": originalProps.label ? originalProps["aria-label"] : safeAriaLabel(originalProps["aria-label"], originalProps.placeholder),
      inputElementType: isMultiline ? "textarea" : "input",
      onChange: setInputValue
    },
    domRef
  );
  if (isFileTypeInput) {
    delete inputProps.value;
    delete inputProps.onChange;
  }
  const { isFocusVisible, isFocused, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus,
    isTextInput: true
  });
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$9({ isDisabled: !!(originalProps == null ? void 0 : originalProps.isDisabled) });
  const { isHovered: isLabelHovered, hoverProps: labelHoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$9({
    isDisabled: !!(originalProps == null ? void 0 : originalProps.isDisabled)
  });
  const { focusProps: clearFocusProps, isFocusVisible: isClearButtonFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$2({
    onFocusWithinChange: setFocusWithin
  });
  const { pressProps: clearPressProps } = $f6c31cce2adf654f$export$45712eceda6fad21$5({
    isDisabled: !!(originalProps == null ? void 0 : originalProps.isDisabled) || !!(originalProps == null ? void 0 : originalProps.isReadOnly),
    onPress: handleClear
  });
  const isInvalid = validationState === "invalid" || isAriaInvalid;
  const labelPlacement = useInputLabelPlacement({
    labelPlacement: originalProps.labelPlacement,
    label
  });
  const errorMessage = typeof props.errorMessage === "function" ? props.errorMessage({ isInvalid, validationErrors, validationDetails }) : props.errorMessage || (validationErrors == null ? void 0 : validationErrors.join(" "));
  const isClearable = !!onClear || originalProps.isClearable;
  const hasElements = !!label || !!description || !!errorMessage;
  const hasPlaceholder = !!props.placeholder;
  const hasLabel = !!label;
  const hasHelper = !!description || !!errorMessage;
  const isOutsideLeft = labelPlacement === "outside-left";
  const isOutsideTop = labelPlacement === "outside-top";
  const shouldLabelBeOutside = (
    // label is outside only when some placeholder is there
    labelPlacement === "outside" || // label is outside regardless of placeholder
    isOutsideLeft || isOutsideTop
  );
  const shouldLabelBeInside = labelPlacement === "inside";
  const isPlaceholderShown = domRef.current ? (!domRef.current.value || domRef.current.value === "" || !inputValue || inputValue === "") && hasPlaceholder : false;
  const hasStartContent = !!startContent;
  const isLabelOutside = shouldLabelBeOutside ? isOutsideLeft || isOutsideTop || hasPlaceholder || labelPlacement === "outside" && hasStartContent : false;
  const isLabelOutsideAsPlaceholder = labelPlacement === "outside" && !hasPlaceholder && !hasStartContent;
  const slots = reactExports.useMemo(
    () => input({
      ...variantProps2,
      isInvalid,
      labelPlacement,
      isClearable,
      disableAnimation
    }),
    [
      objectToDeps(variantProps2),
      isInvalid,
      labelPlacement,
      isClearable,
      hasStartContent,
      disableAnimation
    ]
  );
  const getBaseProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ref: baseDomRef,
        className: slots.base({ class: baseStyles }),
        "data-slot": "base",
        "data-filled": dataAttr(
          isFilled || hasPlaceholder || hasStartContent || isPlaceholderShown || isFileTypeInput
        ),
        "data-filled-within": dataAttr(
          isFilledWithin || hasPlaceholder || hasStartContent || isPlaceholderShown || isFileTypeInput
        ),
        "data-focus-within": dataAttr(isFocusWithin),
        "data-focus-visible": dataAttr(isFocusVisible),
        "data-readonly": dataAttr(originalProps.isReadOnly),
        "data-focus": dataAttr(isFocused),
        "data-hover": dataAttr(isHovered || isLabelHovered),
        "data-required": dataAttr(originalProps.isRequired),
        "data-invalid": dataAttr(isInvalid),
        "data-disabled": dataAttr(originalProps.isDisabled),
        "data-has-elements": dataAttr(hasElements),
        "data-has-helper": dataAttr(hasHelper),
        "data-has-label": dataAttr(hasLabel),
        "data-has-value": dataAttr(!isPlaceholderShown),
        "data-hidden": dataAttr(isHiddenType),
        ...focusWithinProps,
        ...props2
      };
    },
    [
      slots,
      baseStyles,
      isFilled,
      isFocused,
      isHovered,
      isLabelHovered,
      isInvalid,
      hasHelper,
      hasLabel,
      hasElements,
      isPlaceholderShown,
      hasStartContent,
      isFocusWithin,
      isFocusVisible,
      isFilledWithin,
      hasPlaceholder,
      focusWithinProps,
      isHiddenType,
      originalProps.isReadOnly,
      originalProps.isRequired,
      originalProps.isDisabled
    ]
  );
  const getLabelProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "data-slot": "label",
        className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }),
        ...mergeProps$3(labelProps, labelHoverProps, props2)
      };
    },
    [slots, isLabelHovered, labelProps, classNames2 == null ? void 0 : classNames2.label]
  );
  const handleKeyDown = reactExports.useCallback(
    (e2) => {
      if (e2.key === "Escape" && inputValue && (isClearable || onClear) && !originalProps.isReadOnly) {
        setInputValue("");
        onClear == null ? void 0 : onClear();
      }
    },
    [inputValue, setInputValue, onClear, isClearable, originalProps.isReadOnly]
  );
  const getInputProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "data-slot": "input",
        "data-filled": dataAttr(isFilled),
        "data-filled-within": dataAttr(isFilledWithin),
        "data-has-start-content": dataAttr(hasStartContent),
        "data-has-end-content": dataAttr(!!endContent),
        "data-type": type4,
        className: slots.input({
          class: clsx$4(
            classNames2 == null ? void 0 : classNames2.input,
            isFilled ? "is-filled" : "",
            isMultiline ? "pe-0" : "",
            type4 === "password" ? "[&::-ms-reveal]:hidden" : ""
          )
        }),
        ...mergeProps$3(
          focusProps,
          inputProps,
          filterDOMProps(otherProps, {
            enabled: true,
            labelable: true,
            omitEventNames: new Set(Object.keys(inputProps))
          }),
          props2
        ),
        "aria-readonly": dataAttr(originalProps.isReadOnly),
        onChange: chain(inputProps.onChange, onChange),
        onKeyDown: chain(inputProps.onKeyDown, props2.onKeyDown, handleKeyDown),
        ref: domRef
      };
    },
    [
      slots,
      inputValue,
      focusProps,
      inputProps,
      otherProps,
      isFilled,
      isFilledWithin,
      hasStartContent,
      endContent,
      classNames2 == null ? void 0 : classNames2.input,
      originalProps.isReadOnly,
      originalProps.isRequired,
      onChange,
      handleKeyDown
    ]
  );
  const getInputWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ref: inputWrapperRef,
        "data-slot": "input-wrapper",
        "data-hover": dataAttr(isHovered || isLabelHovered),
        "data-focus-visible": dataAttr(isFocusVisible),
        "data-focus": dataAttr(isFocused),
        className: slots.inputWrapper({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.inputWrapper, isFilled ? "is-filled" : "")
        }),
        ...mergeProps$3(props2, hoverProps),
        onClick: (e2) => {
          if (domRef.current && e2.currentTarget === e2.target) {
            domRef.current.focus();
          }
        },
        style: {
          cursor: "text",
          ...props2.style
        }
      };
    },
    [
      slots,
      isHovered,
      isLabelHovered,
      isFocusVisible,
      isFocused,
      inputValue,
      classNames2 == null ? void 0 : classNames2.inputWrapper
    ]
  );
  const getInnerWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ref: innerWrapperRef,
        "data-slot": "inner-wrapper",
        onClick: (e2) => {
          if (domRef.current && e2.currentTarget === e2.target) {
            domRef.current.focus();
          }
        },
        className: slots.innerWrapper({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.innerWrapper, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.innerWrapper]
  );
  const getMainWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "data-slot": "main-wrapper",
        className: slots.mainWrapper({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.mainWrapper, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.mainWrapper]
  );
  const getHelperWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "data-slot": "helper-wrapper",
        className: slots.helperWrapper({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.helperWrapper, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.helperWrapper]
  );
  const getDescriptionProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ...descriptionProps,
        "data-slot": "description",
        className: slots.description({ class: clsx$4(classNames2 == null ? void 0 : classNames2.description, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.description]
  );
  const getErrorMessageProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ...errorMessageProps,
        "data-slot": "error-message",
        className: slots.errorMessage({ class: clsx$4(classNames2 == null ? void 0 : classNames2.errorMessage, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, errorMessageProps, classNames2 == null ? void 0 : classNames2.errorMessage]
  );
  const getClearButtonProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        type: "button",
        tabIndex: -1,
        disabled: originalProps.isDisabled,
        "aria-label": "clear input",
        "data-slot": "clear-button",
        "data-focus-visible": dataAttr(isClearButtonFocusVisible),
        className: slots.clearButton({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.clearButton, props2 == null ? void 0 : props2.className)
        }),
        ...mergeProps$3(clearPressProps, clearFocusProps)
      };
    },
    [slots, isClearButtonFocusVisible, clearPressProps, clearFocusProps, classNames2 == null ? void 0 : classNames2.clearButton]
  );
  return {
    Component: Component2,
    classNames: classNames2,
    domRef,
    label,
    description,
    startContent,
    endContent,
    labelPlacement,
    isClearable,
    hasHelper,
    hasStartContent,
    isLabelOutside,
    isOutsideLeft,
    isOutsideTop,
    isLabelOutsideAsPlaceholder,
    shouldLabelBeOutside,
    shouldLabelBeInside,
    hasPlaceholder,
    isInvalid,
    errorMessage,
    getBaseProps,
    getLabelProps,
    getInputProps,
    getMainWrapperProps,
    getInputWrapperProps,
    getInnerWrapperProps,
    getHelperWrapperProps,
    getDescriptionProps,
    getErrorMessageProps,
    getClearButtonProps
  };
}
var Input = forwardRef((props, ref) => {
  const {
    Component: Component2,
    label,
    description,
    isClearable,
    startContent,
    endContent,
    labelPlacement,
    hasHelper,
    isOutsideLeft,
    isOutsideTop,
    shouldLabelBeOutside,
    errorMessage,
    isInvalid,
    getBaseProps,
    getLabelProps,
    getInputProps,
    getInnerWrapperProps,
    getInputWrapperProps,
    getMainWrapperProps,
    getHelperWrapperProps,
    getDescriptionProps,
    getErrorMessageProps,
    getClearButtonProps
  } = useInput({ ...props, ref });
  const labelContent = label ? /* @__PURE__ */ jsxRuntimeExports.jsx("label", { ...getLabelProps(), children: label }) : null;
  const end2 = reactExports.useMemo(() => {
    if (isClearable) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("button", { ...getClearButtonProps(), children: endContent || /* @__PURE__ */ jsxRuntimeExports.jsx(CloseFilledIcon, {}) });
    }
    return endContent;
  }, [isClearable, getClearButtonProps]);
  const helperWrapper = reactExports.useMemo(() => {
    const shouldShowError = isInvalid && errorMessage;
    const hasContent = shouldShowError || description;
    if (!hasHelper || !hasContent)
      return null;
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getHelperWrapperProps(), children: shouldShowError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getErrorMessageProps(), children: errorMessage }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getDescriptionProps(), children: description }) });
  }, [
    hasHelper,
    isInvalid,
    errorMessage,
    description,
    getHelperWrapperProps,
    getErrorMessageProps,
    getDescriptionProps
  ]);
  const innerWrapper = reactExports.useMemo(() => {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getInnerWrapperProps(), children: [
      startContent,
      /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...getInputProps() }),
      end2
    ] });
  }, [startContent, end2, getInputProps, getInnerWrapperProps]);
  const mainWrapper = reactExports.useMemo(() => {
    if (shouldLabelBeOutside) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getMainWrapperProps(), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getInputWrapperProps(), children: [
          !isOutsideLeft && !isOutsideTop ? labelContent : null,
          innerWrapper
        ] }),
        helperWrapper
      ] });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getInputWrapperProps(), children: [
        labelContent,
        innerWrapper
      ] }),
      helperWrapper
    ] });
  }, [
    labelPlacement,
    helperWrapper,
    shouldLabelBeOutside,
    labelContent,
    innerWrapper,
    errorMessage,
    description,
    getMainWrapperProps,
    getInputWrapperProps,
    getErrorMessageProps,
    getDescriptionProps
  ]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getBaseProps(), children: [
    isOutsideLeft || isOutsideTop ? labelContent : null,
    mainWrapper
  ] });
});
Input.displayName = "HeroUI.Input";
var input_default = Input;
function _extends$h() {
  return _extends$h = Object.assign ? Object.assign.bind() : function(n2) {
    for (var e2 = 1; e2 < arguments.length; e2++) {
      var t2 = arguments[e2];
      for (var r2 in t2)
        ({}).hasOwnProperty.call(t2, r2) && (n2[r2] = t2[r2]);
    }
    return n2;
  }, _extends$h.apply(null, arguments);
}
function _objectWithoutPropertiesLoose$2(r2, e2) {
  if (null == r2)
    return {};
  var t2 = {};
  for (var n2 in r2)
    if ({}.hasOwnProperty.call(r2, n2)) {
      if (-1 !== e2.indexOf(n2))
        continue;
      t2[n2] = r2[n2];
    }
  return t2;
}
var index$3 = reactExports.useLayoutEffect;
var useLatest = function useLatest2(value2) {
  var ref = React$5.useRef(value2);
  index$3(function() {
    ref.current = value2;
  });
  return ref;
};
var updateRef = function updateRef2(ref, value2) {
  if (typeof ref === "function") {
    ref(value2);
    return;
  }
  ref.current = value2;
};
var useComposedRef = function useComposedRef2(libRef, userRef) {
  var prevUserRef = React$5.useRef();
  return React$5.useCallback(function(instance2) {
    libRef.current = instance2;
    if (prevUserRef.current) {
      updateRef(prevUserRef.current, null);
    }
    prevUserRef.current = userRef;
    if (!userRef) {
      return;
    }
    updateRef(userRef, instance2);
  }, [userRef]);
};
var HIDDEN_TEXTAREA_STYLE = {
  "min-height": "0",
  "max-height": "none",
  height: "0",
  visibility: "hidden",
  overflow: "hidden",
  position: "absolute",
  "z-index": "-1000",
  top: "0",
  right: "0",
  display: "block"
};
var forceHiddenStyles = function forceHiddenStyles2(node2) {
  Object.keys(HIDDEN_TEXTAREA_STYLE).forEach(function(key) {
    node2.style.setProperty(key, HIDDEN_TEXTAREA_STYLE[key], "important");
  });
};
var forceHiddenStyles$1 = forceHiddenStyles;
var hiddenTextarea = null;
var getHeight$1 = function getHeight(node2, sizingData) {
  var height = node2.scrollHeight;
  if (sizingData.sizingStyle.boxSizing === "border-box") {
    return height + sizingData.borderSize;
  }
  return height - sizingData.paddingSize;
};
function calculateNodeHeight(sizingData, value2, minRows, maxRows) {
  if (minRows === void 0) {
    minRows = 1;
  }
  if (maxRows === void 0) {
    maxRows = Infinity;
  }
  if (!hiddenTextarea) {
    hiddenTextarea = document.createElement("textarea");
    hiddenTextarea.setAttribute("tabindex", "-1");
    hiddenTextarea.setAttribute("aria-hidden", "true");
    forceHiddenStyles$1(hiddenTextarea);
  }
  if (hiddenTextarea.parentNode === null) {
    document.body.appendChild(hiddenTextarea);
  }
  var paddingSize = sizingData.paddingSize, borderSize = sizingData.borderSize, sizingStyle = sizingData.sizingStyle;
  var boxSizing = sizingStyle.boxSizing;
  Object.keys(sizingStyle).forEach(function(_key) {
    var key = _key;
    hiddenTextarea.style[key] = sizingStyle[key];
  });
  forceHiddenStyles$1(hiddenTextarea);
  hiddenTextarea.value = value2;
  var height = getHeight$1(hiddenTextarea, sizingData);
  hiddenTextarea.value = value2;
  height = getHeight$1(hiddenTextarea, sizingData);
  hiddenTextarea.value = "x";
  var rowHeight = hiddenTextarea.scrollHeight - paddingSize;
  var minHeight = rowHeight * minRows;
  if (boxSizing === "border-box") {
    minHeight = minHeight + paddingSize + borderSize;
  }
  height = Math.max(minHeight, height);
  var maxHeight = rowHeight * maxRows;
  if (boxSizing === "border-box") {
    maxHeight = maxHeight + paddingSize + borderSize;
  }
  height = Math.min(maxHeight, height);
  return [height, rowHeight];
}
var noop$8 = function noop() {
};
var pick = function pick2(props, obj) {
  return props.reduce(function(acc, prop) {
    acc[prop] = obj[prop];
    return acc;
  }, {});
};
var 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",
  "wordSpacing",
  "scrollbarGutter"
];
var isIE = !!document.documentElement.currentStyle;
var getSizingData = function getSizingData2(node2) {
  var style2 = window.getComputedStyle(node2);
  if (style2 === null) {
    return null;
  }
  var sizingStyle = pick(SIZING_STYLE, style2);
  var boxSizing = sizingStyle.boxSizing;
  if (boxSizing === "") {
    return null;
  }
  if (isIE && boxSizing === "border-box") {
    sizingStyle.width = parseFloat(sizingStyle.width) + parseFloat(sizingStyle.borderRightWidth) + parseFloat(sizingStyle.borderLeftWidth) + parseFloat(sizingStyle.paddingRight) + parseFloat(sizingStyle.paddingLeft) + "px";
  }
  var paddingSize = parseFloat(sizingStyle.paddingBottom) + parseFloat(sizingStyle.paddingTop);
  var borderSize = parseFloat(sizingStyle.borderBottomWidth) + parseFloat(sizingStyle.borderTopWidth);
  return {
    sizingStyle,
    paddingSize,
    borderSize
  };
};
var getSizingData$1 = getSizingData;
function useListener(target, type4, listener) {
  var latestListener = useLatest(listener);
  reactExports.useLayoutEffect(function() {
    var handler = function handler2(ev) {
      return latestListener.current(ev);
    };
    if (!target) {
      return;
    }
    target.addEventListener(type4, handler);
    return function() {
      return target.removeEventListener(type4, handler);
    };
  }, []);
}
var useFormResetListener = function useFormResetListener2(libRef, listener) {
  useListener(document.body, "reset", function(ev) {
    if (libRef.current.form === ev.target) {
      listener(ev);
    }
  });
};
var useWindowResizeListener = function useWindowResizeListener2(listener) {
  useListener(window, "resize", listener);
};
var useFontsLoadedListener = function useFontsLoadedListener2(listener) {
  useListener(document.fonts, "loadingdone", listener);
};
var _excluded$z = ["cacheMeasurements", "maxRows", "minRows", "onChange", "onHeightChange"];
var TextareaAutosize = function TextareaAutosize2(_ref, userRef) {
  var cacheMeasurements = _ref.cacheMeasurements, maxRows = _ref.maxRows, minRows = _ref.minRows, _ref$onChange = _ref.onChange, onChange = _ref$onChange === void 0 ? noop$8 : _ref$onChange, _ref$onHeightChange = _ref.onHeightChange, onHeightChange = _ref$onHeightChange === void 0 ? noop$8 : _ref$onHeightChange, props = _objectWithoutPropertiesLoose$2(_ref, _excluded$z);
  var isControlled = props.value !== void 0;
  var libRef = reactExports.useRef(null);
  var ref = useComposedRef(libRef, userRef);
  var heightRef = reactExports.useRef(0);
  var measurementsCacheRef = reactExports.useRef();
  var resizeTextarea = function resizeTextarea2() {
    var node2 = libRef.current;
    var nodeSizingData = cacheMeasurements && measurementsCacheRef.current ? measurementsCacheRef.current : getSizingData$1(node2);
    if (!nodeSizingData) {
      return;
    }
    measurementsCacheRef.current = nodeSizingData;
    var _calculateNodeHeight = calculateNodeHeight(nodeSizingData, node2.value || node2.placeholder || "x", minRows, maxRows), height = _calculateNodeHeight[0], rowHeight = _calculateNodeHeight[1];
    if (heightRef.current !== height) {
      heightRef.current = height;
      node2.style.setProperty("height", height + "px", "important");
      onHeightChange(height, {
        rowHeight
      });
    }
  };
  var handleChange = function handleChange2(event) {
    if (!isControlled) {
      resizeTextarea();
    }
    onChange(event);
  };
  {
    reactExports.useLayoutEffect(resizeTextarea);
    useFormResetListener(libRef, function() {
      if (!isControlled) {
        var currentValue = libRef.current.value;
        requestAnimationFrame(function() {
          var node2 = libRef.current;
          if (node2 && currentValue !== node2.value) {
            resizeTextarea();
          }
        });
      }
    });
    useWindowResizeListener(resizeTextarea);
    useFontsLoadedListener(resizeTextarea);
    return /* @__PURE__ */ reactExports.createElement("textarea", _extends$h({}, props, {
      onChange: handleChange,
      ref
    }));
  }
};
var index$2 = /* @__PURE__ */ reactExports.forwardRef(TextareaAutosize);
var Textarea = forwardRef(
  ({
    style: style2,
    minRows = 3,
    maxRows = 8,
    cacheMeasurements = false,
    disableAutosize = false,
    onHeightChange,
    ...otherProps
  }, ref) => {
    const {
      Component: Component2,
      label,
      description,
      startContent,
      endContent,
      hasHelper,
      shouldLabelBeOutside,
      shouldLabelBeInside,
      isInvalid,
      errorMessage,
      getBaseProps,
      getLabelProps,
      getInputProps,
      getInnerWrapperProps,
      getInputWrapperProps,
      getHelperWrapperProps,
      getDescriptionProps,
      getErrorMessageProps,
      isClearable,
      getClearButtonProps
    } = useInput({ ...otherProps, ref, isMultiline: true });
    const [hasMultipleRows, setIsHasMultipleRows] = reactExports.useState(minRows > 1);
    const [isLimitReached, setIsLimitReached] = reactExports.useState(false);
    const labelContent = label ? /* @__PURE__ */ jsxRuntimeExports.jsx("label", { ...getLabelProps(), children: label }) : null;
    const inputProps = getInputProps();
    const handleHeightChange = (height, meta) => {
      if (minRows === 1) {
        setIsHasMultipleRows(height >= meta.rowHeight * 2);
      }
      if (maxRows > minRows) {
        const limitReached = height >= maxRows * meta.rowHeight;
        setIsLimitReached(limitReached);
      }
      onHeightChange == null ? void 0 : onHeightChange(height, meta);
    };
    const content2 = disableAutosize ? /* @__PURE__ */ jsxRuntimeExports.jsx("textarea", { ...inputProps, style: mergeProps$3(inputProps.style, style2 != null ? style2 : {}) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
      index$2,
      {
        ...inputProps,
        cacheMeasurements,
        "data-hide-scroll": dataAttr(!isLimitReached),
        maxRows,
        minRows,
        style: mergeProps$3(inputProps.style, style2 != null ? style2 : {}),
        onHeightChange: handleHeightChange
      }
    );
    const clearButtonContent = reactExports.useMemo(() => {
      return isClearable ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { ...getClearButtonProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(CloseFilledIcon, {}) }) : null;
    }, [isClearable, getClearButtonProps]);
    const innerWrapper = reactExports.useMemo(() => {
      if (startContent || endContent) {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getInnerWrapperProps(), children: [
          startContent,
          content2,
          endContent
        ] });
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getInnerWrapperProps(), children: content2 });
    }, [startContent, inputProps, endContent, getInnerWrapperProps]);
    const shouldShowError = isInvalid && errorMessage;
    const hasHelperContent = shouldShowError || description;
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getBaseProps(), children: [
      shouldLabelBeOutside ? labelContent : null,
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getInputWrapperProps(), "data-has-multiple-rows": dataAttr(hasMultipleRows), children: [
        shouldLabelBeInside ? labelContent : null,
        innerWrapper,
        clearButtonContent
      ] }),
      hasHelper && hasHelperContent ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getHelperWrapperProps(), children: shouldShowError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getErrorMessageProps(), children: errorMessage }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getDescriptionProps(), children: description }) }) : null
    ] });
  }
);
Textarea.displayName = "HeroUI.Textarea";
var textarea_default = Textarea;
function useReactAriaPopover(props, state) {
  const {
    groupRef,
    triggerRef,
    popoverRef,
    showArrow,
    offset: offset2 = 7,
    crossOffset = 0,
    scrollRef,
    shouldFlip,
    boundaryElement,
    isDismissable = true,
    shouldCloseOnBlur = true,
    shouldCloseOnScroll = true,
    placement: placementProp = "top",
    containerPadding,
    shouldCloseOnInteractOutside,
    isNonModal: isNonModalProp,
    isKeyboardDismissDisabled,
    updatePositionDeps = [],
    ...otherProps
  } = props;
  const isNonModal = isNonModalProp != null ? isNonModalProp : true;
  const isSubmenu = otherProps["trigger"] === "SubmenuTrigger";
  const { overlayProps, underlayProps } = useAriaOverlay(
    {
      isOpen: state.isOpen,
      onClose: state.close,
      shouldCloseOnBlur,
      isDismissable: isDismissable || isSubmenu,
      isKeyboardDismissDisabled,
      shouldCloseOnInteractOutside: shouldCloseOnInteractOutside || ((el2) => {
        var _a2;
        return !((_a2 = triggerRef.current) == null ? void 0 : _a2.contains(el2));
      }),
      disableOutsideEvents: !isNonModal
    },
    popoverRef
  );
  const {
    overlayProps: positionProps,
    arrowProps,
    placement,
    updatePosition
  } = $2a41e45df1593e64$export$d39e1813b3bdd0e1({
    ...otherProps,
    shouldFlip,
    crossOffset,
    targetRef: triggerRef,
    overlayRef: popoverRef,
    isOpen: state.isOpen,
    scrollRef,
    boundaryElement,
    containerPadding,
    placement: toReactAriaPlacement(placementProp),
    offset: showArrow ? offset2 + 3 : offset2,
    onClose: isNonModal && !isSubmenu && shouldCloseOnScroll ? state.close : () => {
    }
  });
  useSafeLayoutEffect(() => {
    if (!updatePositionDeps.length)
      return;
    updatePosition();
  }, updatePositionDeps);
  reactExports.useEffect(() => {
    var _a2, _b2;
    if (state.isOpen && popoverRef.current) {
      if (isNonModal) {
        return keepVisible((_a2 = groupRef == null ? void 0 : groupRef.current) != null ? _a2 : popoverRef.current);
      } else {
        return ariaHideOutside([(_b2 = groupRef == null ? void 0 : groupRef.current) != null ? _b2 : popoverRef.current]);
      }
    }
  }, [isNonModal, state.isOpen, popoverRef, groupRef]);
  return {
    popoverProps: mergeProps$3(overlayProps, positionProps),
    arrowProps,
    underlayProps,
    placement
  };
}
function $fc909762b330b746$export$61c6a8c84e605fb6$1(props) {
  let [isOpen, setOpen] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.isOpen, props.defaultOpen || false, props.onOpenChange);
  const open = reactExports.useCallback(() => {
    setOpen(true);
  }, [
    setOpen
  ]);
  const close = reactExports.useCallback(() => {
    setOpen(false);
  }, [
    setOpen
  ]);
  const toggle2 = reactExports.useCallback(() => {
    setOpen(!isOpen);
  }, [
    setOpen,
    isOpen
  ]);
  return {
    isOpen,
    setOpen,
    open,
    close,
    toggle: toggle2
  };
}
var DEFAULT_PLACEMENT = "top";
function usePopover(originalProps) {
  var _a2, _b2, _c2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, popover.variantKeys);
  const {
    as: as2,
    ref,
    children,
    state: stateProp,
    triggerRef: triggerRefProp,
    scrollRef,
    defaultOpen,
    onOpenChange,
    isOpen: isOpenProp,
    isNonModal = true,
    shouldFlip = true,
    containerPadding = 12,
    shouldBlockScroll = false,
    isDismissable = true,
    shouldCloseOnBlur,
    portalContainer,
    updatePositionDeps,
    dialogProps: dialogPropsProp,
    placement: placementProp = DEFAULT_PLACEMENT,
    triggerType = "dialog",
    showArrow = false,
    offset: offset2 = 7,
    crossOffset = 0,
    boundaryElement,
    isKeyboardDismissDisabled,
    shouldCloseOnInteractOutside,
    shouldCloseOnScroll,
    motionProps,
    className,
    classNames: classNames2,
    onClose,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const domTriggerRef = reactExports.useRef(null);
  const wasTriggerPressedRef = reactExports.useRef(false);
  const triggerRef = triggerRefProp || domTriggerRef;
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const innerState = $fc909762b330b746$export$61c6a8c84e605fb6$1({
    isOpen: isOpenProp,
    defaultOpen,
    onOpenChange: (isOpen) => {
      onOpenChange == null ? void 0 : onOpenChange(isOpen);
      if (!isOpen) {
        onClose == null ? void 0 : onClose();
      }
    }
  });
  const state = stateProp || innerState;
  const {
    popoverProps,
    underlayProps,
    placement: ariaPlacement
  } = useReactAriaPopover(
    {
      triggerRef,
      isNonModal,
      popoverRef: domRef,
      placement: placementProp,
      offset: offset2,
      scrollRef,
      isDismissable,
      shouldCloseOnBlur,
      boundaryElement,
      crossOffset,
      shouldFlip,
      containerPadding,
      updatePositionDeps,
      isKeyboardDismissDisabled,
      shouldCloseOnScroll,
      shouldCloseOnInteractOutside
    },
    state
  );
  const placement = reactExports.useMemo(() => {
    if (!ariaPlacement) {
      return null;
    }
    return getShouldUseAxisPlacement(ariaPlacement, placementProp) ? ariaPlacement : placementProp;
  }, [ariaPlacement, placementProp]);
  const { triggerProps } = $628037886ba31236$export$f9d5c8beee7d008d$2({ type: triggerType }, state, triggerRef);
  const { isFocusVisible, isFocused, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const slots = reactExports.useMemo(
    () => popover({
      ...variantProps2
    }),
    [objectToDeps(variantProps2)]
  );
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  $49c51c25361d4cd2$export$ee0f7cc6afcd1c18({
    isDisabled: !(shouldBlockScroll && state.isOpen)
  });
  const getPopoverProps = (props2 = {}) => ({
    ref: domRef,
    ...mergeProps$3(popoverProps, otherProps, props2),
    style: mergeProps$3(popoverProps.style, otherProps.style, props2.style)
  });
  const getDialogProps = (props2 = {}) => ({
    // `ref` and `dialogProps` from `useDialog` are passed from props
    // if we use `useDialog` here, dialogRef won't be focused on mount
    "data-slot": "base",
    "data-open": dataAttr(state.isOpen),
    "data-focus": dataAttr(isFocused),
    "data-arrow": dataAttr(showArrow),
    "data-focus-visible": dataAttr(isFocusVisible),
    "data-placement": ariaPlacement ? getArrowPlacement(ariaPlacement, placementProp) : void 0,
    ...mergeProps$3(focusProps, dialogPropsProp, props2),
    className: slots.base({ class: clsx$4(baseStyles) }),
    style: {
      // this prevent the dialog to have a default outline
      outline: "none"
    }
  });
  const getContentProps = reactExports.useCallback(
    (props2 = {}) => ({
      "data-slot": "content",
      "data-open": dataAttr(state.isOpen),
      "data-arrow": dataAttr(showArrow),
      "data-placement": ariaPlacement ? getArrowPlacement(ariaPlacement, placementProp) : void 0,
      className: slots.content({ class: clsx$4(classNames2 == null ? void 0 : classNames2.content, props2.className) })
    }),
    [slots, state.isOpen, showArrow, placement, placementProp, classNames2, ariaPlacement]
  );
  const onPress = reactExports.useCallback(
    (e2) => {
      var _a22;
      let pressTimer;
      if (e2.pointerType === "touch" && ((originalProps == null ? void 0 : originalProps.backdrop) === "blur" || (originalProps == null ? void 0 : originalProps.backdrop) === "opaque")) {
        pressTimer = setTimeout(() => {
          wasTriggerPressedRef.current = true;
        }, 100);
      } else {
        wasTriggerPressedRef.current = true;
      }
      (_a22 = triggerProps.onPress) == null ? void 0 : _a22.call(triggerProps, e2);
      return () => {
        clearTimeout(pressTimer);
      };
    },
    [triggerProps == null ? void 0 : triggerProps.onPress]
  );
  const getTriggerProps = reactExports.useCallback(
    (props2 = {}, _ref = null) => {
      const { isDisabled, ...otherProps2 } = props2;
      return {
        "data-slot": "trigger",
        ...mergeProps$3({ "aria-haspopup": "dialog" }, triggerProps, otherProps2),
        onPress,
        isDisabled,
        className: slots.trigger({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.trigger, props2.className),
          // apply isDisabled class names to make the trigger child disabled
          // e.g. for elements like div or HeroUI elements that don't have `isDisabled` prop
          isTriggerDisabled: isDisabled
        }),
        ref: mergeRefs$1(_ref, triggerRef)
      };
    },
    [state, triggerProps, onPress, triggerRef]
  );
  const getBackdropProps = reactExports.useCallback(
    (props2 = {}) => ({
      "data-slot": "backdrop",
      className: slots.backdrop({ class: classNames2 == null ? void 0 : classNames2.backdrop }),
      onClick: (e2) => {
        if (!wasTriggerPressedRef.current) {
          e2.preventDefault();
          return;
        }
        state.close();
        wasTriggerPressedRef.current = false;
      },
      ...underlayProps,
      ...props2
    }),
    [slots, state.isOpen, classNames2, underlayProps]
  );
  return {
    state,
    Component: Component2,
    children,
    classNames: classNames2,
    showArrow,
    triggerRef,
    placement,
    isNonModal,
    popoverRef: domRef,
    portalContainer,
    isOpen: state.isOpen,
    onClose: state.close,
    disableAnimation,
    shouldBlockScroll,
    backdrop: (_c2 = originalProps.backdrop) != null ? _c2 : "transparent",
    motionProps,
    getBackdropProps,
    getPopoverProps,
    getTriggerProps,
    getDialogProps,
    getContentProps
  };
}
const $337b884510726a0d$export$a2200b96afd16271 = /* @__PURE__ */ React$5.createContext(null);
function $337b884510726a0d$export$14c98a7594375490() {
  let ctx = reactExports.useContext($337b884510726a0d$export$a2200b96afd16271);
  let setContain = ctx === null || ctx === void 0 ? void 0 : ctx.setContain;
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    setContain === null || setContain === void 0 ? void 0 : setContain(true);
  }, [
    setContain
  ]);
}
function $40df3f8667284809$export$d55e7ee900f34e93(props, ref) {
  let { role = "dialog" } = props;
  let titleId = $bdb11010cef70236$export$b4cc09c592e8fdb8$1();
  titleId = props["aria-label"] ? void 0 : titleId;
  let isRefocusing = reactExports.useRef(false);
  reactExports.useEffect(() => {
    if (ref.current && !ref.current.contains(document.activeElement)) {
      $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
      let timeout = setTimeout(() => {
        if (document.activeElement === ref.current) {
          isRefocusing.current = true;
          if (ref.current) {
            ref.current.blur();
            $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
          }
          isRefocusing.current = false;
        }
      }, 500);
      return () => {
        clearTimeout(timeout);
      };
    }
  }, [
    ref
  ]);
  $337b884510726a0d$export$14c98a7594375490();
  return {
    dialogProps: {
      ...$65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
        labelable: true
      }),
      role,
      tabIndex: -1,
      "aria-labelledby": props["aria-labelledby"] || titleId,
      // Prevent blur events from reaching useOverlay, which may cause
      // popovers to close. Since focus is contained within the dialog,
      // we don't want this to occur due to the above useEffect.
      onBlur: (e2) => {
        if (isRefocusing.current)
          e2.stopPropagation();
      }
    },
    titleProps: {
      id: titleId
    }
  };
}
var domAnimation$4 = () => __vitePreload(() => import("./index-kYRJvtWR.js"), true ? __vite__mapDeps([]) : void 0).then((res) => res.default);
var FreeSoloPopoverWrapper = forwardRef(
  ({
    children,
    motionProps,
    placement,
    disableAnimation,
    style: styleProp = {},
    transformOrigin = {},
    ...otherProps
  }, ref) => {
    let style2 = styleProp;
    if (transformOrigin.originX !== void 0 || transformOrigin.originY !== void 0) {
      style2 = {
        ...style2,
        // @ts-ignore
        transformOrigin
      };
    } else if (placement) {
      style2 = {
        ...style2,
        ...getTransformOrigins(placement === "center" ? "top" : placement)
      };
    }
    return disableAnimation ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...otherProps, ref, children }) : /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$4, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      m$3.div,
      {
        ref,
        animate: "enter",
        exit: "exit",
        initial: "initial",
        style: style2,
        variants: TRANSITION_VARIANTS.scaleSpringOpacity,
        ...mergeProps$3(otherProps, motionProps),
        children
      }
    ) });
  }
);
FreeSoloPopoverWrapper.displayName = "HeroUI.FreeSoloPopoverWrapper";
var FreeSoloPopover = forwardRef(
  ({ children, transformOrigin, disableDialogFocus = false, ...props }, ref) => {
    const {
      Component: Component2,
      state,
      placement,
      backdrop,
      portalContainer,
      disableAnimation,
      motionProps,
      isNonModal,
      getPopoverProps,
      getBackdropProps,
      getDialogProps,
      getContentProps
    } = usePopover({
      ...props,
      ref
    });
    const dialogRef = reactExports.useRef(null);
    const { dialogProps: ariaDialogProps, titleProps } = $40df3f8667284809$export$d55e7ee900f34e93({}, dialogRef);
    const dialogProps = getDialogProps({
      // by default, focus is moved into the dialog on mount
      // we can use `disableDialogFocus` to disable this behaviour
      // e.g. in autocomplete, the focus should be moved to the input (handled in autocomplete hook) instead of the dialog first
      ...!disableDialogFocus && { ref: dialogRef },
      ...ariaDialogProps
    });
    const backdropContent = reactExports.useMemo(() => {
      if (backdrop === "transparent") {
        return null;
      }
      if (disableAnimation) {
        return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getBackdropProps() });
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$4, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        m$3.div,
        {
          animate: "enter",
          exit: "exit",
          initial: "exit",
          variants: TRANSITION_VARIANTS.fade,
          ...getBackdropProps()
        }
      ) });
    }, [backdrop, disableAnimation, getBackdropProps]);
    return /* @__PURE__ */ jsxRuntimeExports.jsxs($337b884510726a0d$export$c6fdb837b070b4ff, { portalContainer, children: [
      !isNonModal && backdropContent,
      /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...getPopoverProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        FreeSoloPopoverWrapper,
        {
          disableAnimation,
          motionProps,
          placement,
          tabIndex: -1,
          transformOrigin,
          ...dialogProps,
          children: [
            !isNonModal && /* @__PURE__ */ jsxRuntimeExports.jsx($86ea4cb521eb2e37$export$2317d149ed6f78c4, { onDismiss: state.close }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getContentProps(), children: typeof children === "function" ? children(titleProps) : children }),
            /* @__PURE__ */ jsxRuntimeExports.jsx($86ea4cb521eb2e37$export$2317d149ed6f78c4, { onDismiss: state.close })
          ]
        }
      ) })
    ] });
  }
);
FreeSoloPopover.displayName = "HeroUI.FreeSoloPopover";
var free_solo_popover_default = FreeSoloPopover;
var [PopoverProvider, usePopoverContext] = createContext2({
  name: "PopoverContext",
  errorMessage: "usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within `<Popover />`"
});
var domAnimation$3 = () => __vitePreload(() => import("./index-kYRJvtWR.js"), true ? __vite__mapDeps([]) : void 0).then((res) => res.default);
var PopoverContent$1 = (props) => {
  const { as: as2, children, className, ...otherProps } = props;
  const {
    Component: OverlayComponent,
    placement,
    backdrop,
    motionProps,
    disableAnimation,
    getPopoverProps,
    getDialogProps,
    getBackdropProps,
    getContentProps,
    isNonModal,
    onClose
  } = usePopoverContext();
  const dialogRef = reactExports.useRef(null);
  const { dialogProps: ariaDialogProps, titleProps } = $40df3f8667284809$export$d55e7ee900f34e93({}, dialogRef);
  const dialogProps = getDialogProps({
    ref: dialogRef,
    ...ariaDialogProps,
    ...otherProps
  });
  const Component2 = as2 || OverlayComponent || "div";
  const content2 = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    !isNonModal && /* @__PURE__ */ jsxRuntimeExports.jsx($86ea4cb521eb2e37$export$2317d149ed6f78c4, { onDismiss: onClose }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...dialogProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getContentProps({ className }), children: typeof children === "function" ? children(titleProps) : children }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx($86ea4cb521eb2e37$export$2317d149ed6f78c4, { onDismiss: onClose })
  ] });
  const backdropContent = reactExports.useMemo(() => {
    if (backdrop === "transparent") {
      return null;
    }
    if (disableAnimation) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getBackdropProps() });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$3, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      m$3.div,
      {
        animate: "enter",
        exit: "exit",
        initial: "exit",
        variants: TRANSITION_VARIANTS.fade,
        ...getBackdropProps()
      }
    ) });
  }, [backdrop, disableAnimation, getBackdropProps]);
  const style2 = placement ? getTransformOrigins(placement === "center" ? "top" : placement) : void 0;
  const contents = /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: disableAnimation ? content2 : /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$3, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    m$3.div,
    {
      animate: "enter",
      exit: "exit",
      initial: "initial",
      style: style2,
      variants: TRANSITION_VARIANTS.scaleSpringOpacity,
      ...motionProps,
      children: content2
    }
  ) }) });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getPopoverProps(), children: [
    backdropContent,
    contents
  ] });
};
PopoverContent$1.displayName = "HeroUI.PopoverContent";
var popover_content_default = PopoverContent$1;
var PopoverTrigger = (props) => {
  var _a2;
  const { triggerRef, getTriggerProps } = usePopoverContext();
  const { children, ...otherProps } = props;
  const child = reactExports.useMemo(() => {
    if (typeof children === "string")
      return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children });
    return reactExports.Children.only(children);
  }, [children]);
  const childRef = (_a2 = child.props.ref) != null ? _a2 : child.ref;
  const { onPress, isDisabled, ...restProps } = reactExports.useMemo(() => {
    return getTriggerProps(mergeProps$3(otherProps, child.props), childRef);
  }, [getTriggerProps, child.props, otherProps, childRef]);
  const [, triggerChildren] = pickChildren(children, button_default$1);
  const { buttonProps } = useAriaButton$1({ onPress, isDisabled }, triggerRef);
  const hasHeroUIButton = reactExports.useMemo(() => {
    return (triggerChildren == null ? void 0 : triggerChildren[0]) !== void 0;
  }, [triggerChildren]);
  if (!hasHeroUIButton) {
    delete restProps["preventFocusOnPress"];
  }
  return reactExports.cloneElement(
    child,
    mergeProps$3(restProps, hasHeroUIButton ? { onPress, isDisabled } : buttonProps)
  );
};
PopoverTrigger.displayName = "HeroUI.PopoverTrigger";
var popover_trigger_default = PopoverTrigger;
var Popover$1 = forwardRef((props, ref) => {
  const { children, ...otherProps } = props;
  const context = usePopover({ ...otherProps, ref });
  const [trigger, content2] = reactExports.Children.toArray(children);
  const overlay = /* @__PURE__ */ jsxRuntimeExports.jsx($337b884510726a0d$export$c6fdb837b070b4ff, { portalContainer: context.portalContainer, children: content2 });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(PopoverProvider, { value: context, children: [
    trigger,
    context.disableAnimation && context.isOpen ? overlay : /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { children: context.isOpen ? overlay : null })
  ] });
});
Popover$1.displayName = "HeroUI.Popover";
var popover_default = Popover$1;
var [DropdownProvider, useDropdownContext] = createContext2({
  name: "DropdownContext",
  errorMessage: "useDropdownContext: `context` is undefined. Seems you forgot to wrap all popover components within `<Dropdown />`"
});
function MenuSelectedIcon(props) {
  const { isSelected, disableAnimation, ...otherProps } = props;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "svg",
    {
      "aria-hidden": "true",
      "data-selected": isSelected,
      role: "presentation",
      viewBox: "0 0 17 18",
      ...otherProps,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        "polyline",
        {
          fill: "none",
          points: "1 9 7 14 15 4",
          stroke: "currentColor",
          strokeDasharray: 22,
          strokeDashoffset: isSelected ? 44 : 66,
          strokeLinecap: "round",
          strokeLinejoin: "round",
          strokeWidth: 1.5,
          style: !disableAnimation ? {
            transition: "stroke-dashoffset 200ms ease"
          } : {}
        }
      )
    }
  );
}
var $c0398ad35c3639b7$exports$1 = {};
$c0398ad35c3639b7$exports$1 = {
  "longPressMessage": `اضغط مطولاً أو اضغط على Alt + السهم لأسفل لفتح القائمة`
};
var $7af657c4165927c3$exports$1 = {};
$7af657c4165927c3$exports$1 = {
  "longPressMessage": `Натиснете продължително или натиснете Alt+ стрелка надолу, за да отворите менюто`
};
var $d95d4da6d531ab81$exports$1 = {};
$d95d4da6d531ab81$exports$1 = {
  "longPressMessage": `Dlouhým stiskem nebo stisknutím kláves Alt + šipka dolů otevřete nabídku`
};
var $24ebda9c775dca17$exports$1 = {};
$24ebda9c775dca17$exports$1 = {
  "longPressMessage": `Langt tryk eller tryk på Alt + pil ned for at åbne menuen`
};
var $743e0dfca6cab1e9$exports$1 = {};
$743e0dfca6cab1e9$exports$1 = {
  "longPressMessage": `Drücken Sie lange oder drücken Sie Alt + Nach-unten, um das Menü zu öffnen`
};
var $a2f41026e05f1c84$exports$1 = {};
$a2f41026e05f1c84$exports$1 = {
  "longPressMessage": `Πιέστε παρατεταμένα ή πατήστε Alt + κάτω βέλος για να ανοίξετε το μενού`
};
var $43b800e97c901737$exports$1 = {};
$43b800e97c901737$exports$1 = {
  "longPressMessage": `Long press or press Alt + ArrowDown to open menu`
};
var $442f5f6ac211e29f$exports$1 = {};
$442f5f6ac211e29f$exports$1 = {
  "longPressMessage": `Mantenga pulsado o pulse Alt + flecha abajo para abrir el menú`
};
var $dff280acfeb2d8ac$exports$1 = {};
$dff280acfeb2d8ac$exports$1 = {
  "longPressMessage": `Menüü avamiseks vajutage pikalt või vajutage klahve Alt + allanool`
};
var $51608325613944d7$exports$1 = {};
$51608325613944d7$exports$1 = {
  "longPressMessage": `Avaa valikko painamalla pohjassa tai näppäinyhdistelmällä Alt + Alanuoli`
};
var $c4a1b1eabeaa87be$exports$1 = {};
$c4a1b1eabeaa87be$exports$1 = {
  "longPressMessage": `Appuyez de manière prolongée ou appuyez sur Alt + Flèche vers le bas pour ouvrir le menu.`
};
var $8c74815cdee18d1b$exports$1 = {};
$8c74815cdee18d1b$exports$1 = {
  "longPressMessage": `לחץ לחיצה ארוכה או הקש Alt + ArrowDown כדי לפתוח את התפריט`
};
var $fd0e9ef6a7fe0ec9$exports$1 = {};
$fd0e9ef6a7fe0ec9$exports$1 = {
  "longPressMessage": `Dugo pritisnite ili pritisnite Alt + strelicu prema dolje za otvaranje izbornika`
};
var $a89a74a39eba465a$exports$1 = {};
$a89a74a39eba465a$exports$1 = {
  "longPressMessage": `Nyomja meg hosszan, vagy nyomja meg az Alt + lefele nyíl gombot a menü megnyitásához`
};
var $edc7c66594a0ae8a$exports$1 = {};
$edc7c66594a0ae8a$exports$1 = {
  "longPressMessage": `Premere a lungo o premere Alt + Freccia giù per aprire il menu`
};
var $f1ab51510712db52$exports$1 = {};
$f1ab51510712db52$exports$1 = {
  "longPressMessage": `長押しまたは Alt+下矢印キーでメニューを開く`
};
var $f9b672d9b82fa3d6$exports$1 = {};
$f9b672d9b82fa3d6$exports$1 = {
  "longPressMessage": `길게 누르거나 Alt + 아래쪽 화살표를 눌러 메뉴 열기`
};
var $a385f3910feda499$exports$1 = {};
$a385f3910feda499$exports$1 = {
  "longPressMessage": `Norėdami atidaryti meniu, nuspaudę palaikykite arba paspauskite „Alt + ArrowDown“.`
};
var $4f1bde932c441789$exports$1 = {};
$4f1bde932c441789$exports$1 = {
  "longPressMessage": `Lai atvērtu izvēlni, turiet nospiestu vai nospiediet taustiņu kombināciju Alt + lejupvērstā bultiņa`
};
var $914a51a8a594d5be$exports$1 = {};
$914a51a8a594d5be$exports$1 = {
  "longPressMessage": `Langt trykk eller trykk Alt + PilNed for å åpne menyen`
};
var $89aaf803103bb500$exports$1 = {};
$89aaf803103bb500$exports$1 = {
  "longPressMessage": `Druk lang op Alt + pijl-omlaag of druk op Alt om het menu te openen`
};
var $c685891476dbaaca$exports$1 = {};
$c685891476dbaaca$exports$1 = {
  "longPressMessage": `Naciśnij i przytrzymaj lub naciśnij klawisze Alt + Strzałka w dół, aby otworzyć menu`
};
var $885879b9b10c2959$exports$1 = {};
$885879b9b10c2959$exports$1 = {
  "longPressMessage": `Pressione e segure ou pressione Alt + Seta para baixo para abrir o menu`
};
var $6b39616688a51692$exports$1 = {};
$6b39616688a51692$exports$1 = {
  "longPressMessage": `Prima continuamente ou prima Alt + Seta Para Baixo para abrir o menu`
};
var $f26362aed63f47e2$exports$1 = {};
$f26362aed63f47e2$exports$1 = {
  "longPressMessage": `Apăsați lung sau apăsați pe Alt + săgeată în jos pentru a deschide meniul`
};
var $06cbade644558bf0$exports$1 = {};
$06cbade644558bf0$exports$1 = {
  "longPressMessage": `Нажмите и удерживайте или нажмите Alt + Стрелка вниз, чтобы открыть меню`
};
var $0a391ff68f9d59b1$exports$1 = {};
$0a391ff68f9d59b1$exports$1 = {
  "longPressMessage": `Ponuku otvoríte dlhým stlačením alebo stlačením klávesu Alt + klávesu so šípkou nadol`
};
var $8193cf0e649c7928$exports$1 = {};
$8193cf0e649c7928$exports$1 = {
  "longPressMessage": `Za odprtje menija pritisnite in držite gumb ali pritisnite Alt+puščica navzdol`
};
var $f398debcce5a5c55$exports$1 = {};
$f398debcce5a5c55$exports$1 = {
  "longPressMessage": `Dugo pritisnite ili pritisnite Alt + strelicu prema dole da otvorite meni`
};
var $9e9fef000aa4c013$exports$1 = {};
$9e9fef000aa4c013$exports$1 = {
  "longPressMessage": `Håll nedtryckt eller tryck på Alt + pil nedåt för att öppna menyn`
};
var $c016c8183bbe3d68$exports$1 = {};
$c016c8183bbe3d68$exports$1 = {
  "longPressMessage": `Menüyü açmak için uzun basın veya Alt + Aşağı Ok tuşuna basın`
};
var $ca4f6c8462244e62$exports$1 = {};
$ca4f6c8462244e62$exports$1 = {
  "longPressMessage": `Довго або звичайно натисніть комбінацію клавіш Alt і стрілка вниз, щоб відкрити меню`
};
var $2d9960c02ccac927$exports$1 = {};
$2d9960c02ccac927$exports$1 = {
  "longPressMessage": `长按或按 Alt + 向下方向键以打开菜单`
};
var $f1b682a4c8c5631c$exports$1 = {};
$f1b682a4c8c5631c$exports$1 = {
  "longPressMessage": `長按或按 Alt+向下鍵以開啟功能表`
};
var $2cbb7ca666678a14$exports$1 = {};
$2cbb7ca666678a14$exports$1 = {
  "ar-AE": $c0398ad35c3639b7$exports$1,
  "bg-BG": $7af657c4165927c3$exports$1,
  "cs-CZ": $d95d4da6d531ab81$exports$1,
  "da-DK": $24ebda9c775dca17$exports$1,
  "de-DE": $743e0dfca6cab1e9$exports$1,
  "el-GR": $a2f41026e05f1c84$exports$1,
  "en-US": $43b800e97c901737$exports$1,
  "es-ES": $442f5f6ac211e29f$exports$1,
  "et-EE": $dff280acfeb2d8ac$exports$1,
  "fi-FI": $51608325613944d7$exports$1,
  "fr-FR": $c4a1b1eabeaa87be$exports$1,
  "he-IL": $8c74815cdee18d1b$exports$1,
  "hr-HR": $fd0e9ef6a7fe0ec9$exports$1,
  "hu-HU": $a89a74a39eba465a$exports$1,
  "it-IT": $edc7c66594a0ae8a$exports$1,
  "ja-JP": $f1ab51510712db52$exports$1,
  "ko-KR": $f9b672d9b82fa3d6$exports$1,
  "lt-LT": $a385f3910feda499$exports$1,
  "lv-LV": $4f1bde932c441789$exports$1,
  "nb-NO": $914a51a8a594d5be$exports$1,
  "nl-NL": $89aaf803103bb500$exports$1,
  "pl-PL": $c685891476dbaaca$exports$1,
  "pt-BR": $885879b9b10c2959$exports$1,
  "pt-PT": $6b39616688a51692$exports$1,
  "ro-RO": $f26362aed63f47e2$exports$1,
  "ru-RU": $06cbade644558bf0$exports$1,
  "sk-SK": $0a391ff68f9d59b1$exports$1,
  "sl-SI": $8193cf0e649c7928$exports$1,
  "sr-SP": $f398debcce5a5c55$exports$1,
  "sv-SE": $9e9fef000aa4c013$exports$1,
  "tr-TR": $c016c8183bbe3d68$exports$1,
  "uk-UA": $ca4f6c8462244e62$exports$1,
  "zh-CN": $2d9960c02ccac927$exports$1,
  "zh-TW": $f1b682a4c8c5631c$exports$1
};
const $dd149f63282afbbf$export$f6211563215e3b37$1 = /* @__PURE__ */ new WeakMap();
function $628037886ba31236$export$f9d5c8beee7d008d$1(props, state, ref) {
  let { type: type4 } = props;
  let { isOpen } = state;
  reactExports.useEffect(() => {
    if (ref && ref.current)
      $dd149f63282afbbf$export$f6211563215e3b37$1.set(ref.current, state.close);
  });
  let ariaHasPopup = void 0;
  if (type4 === "menu")
    ariaHasPopup = true;
  else if (type4 === "listbox")
    ariaHasPopup = "listbox";
  let overlayId = $bdb11010cef70236$export$f680877a34711e37$2();
  return {
    triggerProps: {
      "aria-haspopup": ariaHasPopup,
      "aria-expanded": isOpen,
      "aria-controls": isOpen ? overlayId : void 0,
      onPress: state.toggle
    },
    overlayProps: {
      id: overlayId
    }
  };
}
function $parcel$interopDefault$j(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $168583247155ddda$export$dc9c12ed27dd1b49$1(props, state, ref) {
  let { type: type4 = "menu", isDisabled, trigger = "press" } = props;
  let menuTriggerId = $bdb11010cef70236$export$f680877a34711e37$2();
  let { triggerProps, overlayProps } = $628037886ba31236$export$f9d5c8beee7d008d$1({
    type: type4
  }, state, ref);
  let onKeyDown = (e2) => {
    if (isDisabled)
      return;
    if (trigger === "longPress" && !e2.altKey)
      return;
    if (ref && ref.current)
      switch (e2.key) {
        case "Enter":
        case " ":
          if (trigger === "longPress")
            return;
        case "ArrowDown":
          if (!("continuePropagation" in e2))
            e2.stopPropagation();
          e2.preventDefault();
          state.toggle("first");
          break;
        case "ArrowUp":
          if (!("continuePropagation" in e2))
            e2.stopPropagation();
          e2.preventDefault();
          state.toggle("last");
          break;
        default:
          if ("continuePropagation" in e2)
            e2.continuePropagation();
      }
  };
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$j($2cbb7ca666678a14$exports$1), "@react-aria/menu");
  let { longPressProps } = $8a26561d2877236e$export$c24ed0104d07eab9({
    isDisabled: isDisabled || trigger !== "longPress",
    accessibilityDescription: stringFormatter.format("longPressMessage"),
    onLongPressStart() {
      state.close();
    },
    onLongPress() {
      state.open("first");
    }
  });
  let pressProps = {
    preventFocusOnPress: true,
    onPressStart(e2) {
      if (e2.pointerType !== "touch" && e2.pointerType !== "keyboard" && !isDisabled) {
        $7215afc6de606d6b$export$de79e2c695e052f3$5(e2.target);
        state.open(e2.pointerType === "virtual" ? "first" : null);
      }
    },
    onPress(e2) {
      if (e2.pointerType === "touch" && !isDisabled) {
        $7215afc6de606d6b$export$de79e2c695e052f3$5(e2.target);
        state.toggle();
      }
    }
  };
  delete triggerProps.onPress;
  return {
    // @ts-ignore - TODO we pass out both DOMAttributes AND AriaButtonProps, but useButton will discard the longPress event handlers, it's only through PressResponder magic that this works for RSP and RAC. it does not work in aria examples
    menuTriggerProps: {
      ...triggerProps,
      ...trigger === "press" ? pressProps : longPressProps,
      id: menuTriggerId,
      onKeyDown
    },
    menuProps: {
      ...overlayProps,
      "aria-labelledby": menuTriggerId,
      autoFocus: state.focusStrategy || true,
      onClose: state.close
    }
  };
}
const $fc79756100351201$export$6f49b4016bfc8d56 = /* @__PURE__ */ new WeakMap();
function $feb5ffebff200149$export$d3e3bd3e26688c04(e2) {
  return $c87311424ea30a05$export$e1865c3bedcd822b() ? e2.altKey : e2.ctrlKey;
}
function $feb5ffebff200149$export$c3d8340acf92597f$1(collectionRef, key) {
  var _collectionRef_current, _collectionRef_current1;
  let selector = `[data-key="${CSS.escape(String(key))}"]`;
  let collection = (_collectionRef_current = collectionRef.current) === null || _collectionRef_current === void 0 ? void 0 : _collectionRef_current.dataset.collection;
  if (collection)
    selector = `[data-collection="${CSS.escape(collection)}"]${selector}`;
  return (_collectionRef_current1 = collectionRef.current) === null || _collectionRef_current1 === void 0 ? void 0 : _collectionRef_current1.querySelector(selector);
}
const $feb5ffebff200149$var$collectionMap = /* @__PURE__ */ new WeakMap();
function $feb5ffebff200149$export$881eb0d9f3605d9d(collection) {
  let id2 = $bdb11010cef70236$export$f680877a34711e37$2();
  $feb5ffebff200149$var$collectionMap.set(collection, id2);
  return id2;
}
function $feb5ffebff200149$export$6aeb1680a0ae8741(collection) {
  return $feb5ffebff200149$var$collectionMap.get(collection);
}
const $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS$1 = 1e3;
function $fb3050f43d946246$export$e32c88dfddc6e1d8$1(options) {
  let { keyboardDelegate, selectionManager, onTypeSelect } = options;
  let state = reactExports.useRef({
    search: "",
    timeout: void 0
  }).current;
  let onKeyDown = (e2) => {
    let character2 = $fb3050f43d946246$var$getStringForKey$1(e2.key);
    if (!character2 || e2.ctrlKey || e2.metaKey || !e2.currentTarget.contains(e2.target) || state.search.length === 0 && character2 === " ")
      return;
    if (character2 === " " && state.search.trim().length > 0) {
      e2.preventDefault();
      if (!("continuePropagation" in e2))
        e2.stopPropagation();
    }
    state.search += character2;
    if (keyboardDelegate.getKeyForSearch != null) {
      let key = keyboardDelegate.getKeyForSearch(state.search, selectionManager.focusedKey);
      if (key == null)
        key = keyboardDelegate.getKeyForSearch(state.search);
      if (key != null) {
        selectionManager.setFocusedKey(key);
        if (onTypeSelect)
          onTypeSelect(key);
      }
    }
    clearTimeout(state.timeout);
    state.timeout = setTimeout(() => {
      state.search = "";
    }, $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS$1);
  };
  return {
    typeSelectProps: {
      // Using a capturing listener to catch the keydown event before
      // other hooks in order to handle the Spacebar event.
      onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDown : void 0
    }
  };
}
function $fb3050f43d946246$var$getStringForKey$1(key) {
  if (key.length === 1 || !/^[A-Z]/i.test(key))
    return key;
  return "";
}
function $9bf71ea28793e738$var$isTabbableRadio$3(element2) {
  if (element2.checked)
    return true;
  let radios = [];
  if (!element2.form)
    radios = [
      ...$431fbd86ca7dc216$export$b204af158042fbac$4(element2).querySelectorAll(`input[type="radio"][name="${CSS.escape(element2.name)}"]`)
    ].filter((radio2) => !radio2.form);
  else {
    var _element_form_elements, _element_form;
    let radioList = (_element_form = element2.form) === null || _element_form === void 0 ? void 0 : (_element_form_elements = _element_form.elements) === null || _element_form_elements === void 0 ? void 0 : _element_form_elements.namedItem(element2.name);
    radios = [
      ...radioList !== null && radioList !== void 0 ? radioList : []
    ];
  }
  if (!radios)
    return false;
  let anyChecked = radios.some((radio2) => radio2.checked);
  return !anyChecked;
}
function $9bf71ea28793e738$var$isElementInScope$3(element2, scope) {
  if (!element2)
    return false;
  if (!scope)
    return false;
  return scope.some((node2) => node2.contains(element2));
}
function $9bf71ea28793e738$export$2d6ec8fc375ceafa$3(root2, opts2, scope) {
  let filter3 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) ? $b4b717babfbb907b$export$bebd5a1431fec25d : $b4b717babfbb907b$export$4c063cf1350e6fed$3;
  let rootElement = (root2 === null || root2 === void 0 ? void 0 : root2.nodeType) === Node.ELEMENT_NODE ? root2 : null;
  let doc = $431fbd86ca7dc216$export$b204af158042fbac$4(rootElement);
  let walker = $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root2 || doc, NodeFilter.SHOW_ELEMENT, {
    acceptNode(node2) {
      var _opts_from;
      if (opts2 === null || opts2 === void 0 ? void 0 : (_opts_from = opts2.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node2))
        return NodeFilter.FILTER_REJECT;
      if ((opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) && node2.tagName === "INPUT" && node2.getAttribute("type") === "radio") {
        if (!$9bf71ea28793e738$var$isTabbableRadio$3(node2))
          return NodeFilter.FILTER_REJECT;
        if (walker.currentNode.tagName === "INPUT" && walker.currentNode.type === "radio" && walker.currentNode.name === node2.name)
          return NodeFilter.FILTER_REJECT;
      }
      if (filter3(node2) && (!scope || $9bf71ea28793e738$var$isElementInScope$3(node2, scope)) && (!(opts2 === null || opts2 === void 0 ? void 0 : opts2.accept) || opts2.accept(node2)))
        return NodeFilter.FILTER_ACCEPT;
      return NodeFilter.FILTER_SKIP;
    }
  });
  if (opts2 === null || opts2 === void 0 ? void 0 : opts2.from)
    walker.currentNode = opts2.from;
  return walker;
}
let $9bf71ea28793e738$var$Tree$3 = class $9bf71ea28793e738$var$Tree5 {
  get size() {
    return this.fastMap.size;
  }
  getTreeNode(data) {
    return this.fastMap.get(data);
  }
  addTreeNode(scopeRef, parent, nodeToRestore) {
    let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
    if (!parentNode)
      return;
    let node2 = new $9bf71ea28793e738$var$TreeNode$3({
      scopeRef
    });
    parentNode.addChild(node2);
    node2.parent = parentNode;
    this.fastMap.set(scopeRef, node2);
    if (nodeToRestore)
      node2.nodeToRestore = nodeToRestore;
  }
  addNode(node2) {
    this.fastMap.set(node2.scopeRef, node2);
  }
  removeTreeNode(scopeRef) {
    if (scopeRef === null)
      return;
    let node2 = this.fastMap.get(scopeRef);
    if (!node2)
      return;
    let parentNode = node2.parent;
    for (let current of this.traverse())
      if (current !== node2 && node2.nodeToRestore && current.nodeToRestore && node2.scopeRef && node2.scopeRef.current && $9bf71ea28793e738$var$isElementInScope$3(current.nodeToRestore, node2.scopeRef.current))
        current.nodeToRestore = node2.nodeToRestore;
    let children = node2.children;
    if (parentNode) {
      parentNode.removeChild(node2);
      if (children.size > 0)
        children.forEach((child) => parentNode && parentNode.addChild(child));
    }
    this.fastMap.delete(node2.scopeRef);
  }
  // Pre Order Depth First
  *traverse(node2 = this.root) {
    if (node2.scopeRef != null)
      yield node2;
    if (node2.children.size > 0)
      for (let child of node2.children)
        yield* this.traverse(child);
  }
  clone() {
    var _node_parent;
    let newTree = new $9bf71ea28793e738$var$Tree5();
    var _node_parent_scopeRef;
    for (let node2 of this.traverse())
      newTree.addTreeNode(node2.scopeRef, (_node_parent_scopeRef = (_node_parent = node2.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node2.nodeToRestore);
    return newTree;
  }
  constructor() {
    this.fastMap = /* @__PURE__ */ new Map();
    this.root = new $9bf71ea28793e738$var$TreeNode$3({
      scopeRef: null
    });
    this.fastMap.set(null, this.root);
  }
};
let $9bf71ea28793e738$var$TreeNode$3 = class $9bf71ea28793e738$var$TreeNode5 {
  addChild(node2) {
    this.children.add(node2);
    node2.parent = this;
  }
  removeChild(node2) {
    this.children.delete(node2);
    node2.parent = void 0;
  }
  constructor(props) {
    this.children = /* @__PURE__ */ new Set();
    this.contain = false;
    this.scopeRef = props.scopeRef;
  }
};
new $9bf71ea28793e738$var$Tree$3();
function $55f9b1ae81f22853$export$76e4e37e5339496d(to2) {
  let from2 = $55f9b1ae81f22853$export$759df0d867455a91($431fbd86ca7dc216$export$b204af158042fbac$4(to2));
  if (from2 !== to2) {
    if (from2)
      $55f9b1ae81f22853$export$6c5dc7e81d2cc29a(from2, to2);
    if (to2)
      $55f9b1ae81f22853$export$2b35b76d2e30e129$1(to2, from2);
  }
}
function $55f9b1ae81f22853$export$6c5dc7e81d2cc29a(from2, to2) {
  from2.dispatchEvent(new FocusEvent("blur", {
    relatedTarget: to2
  }));
  from2.dispatchEvent(new FocusEvent("focusout", {
    bubbles: true,
    relatedTarget: to2
  }));
}
function $55f9b1ae81f22853$export$2b35b76d2e30e129$1(to2, from2) {
  to2.dispatchEvent(new FocusEvent("focus", {
    relatedTarget: from2
  }));
  to2.dispatchEvent(new FocusEvent("focusin", {
    bubbles: true,
    relatedTarget: from2
  }));
}
function $55f9b1ae81f22853$export$759df0d867455a91(document2) {
  let activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(document2);
  let activeDescendant = activeElement === null || activeElement === void 0 ? void 0 : activeElement.getAttribute("aria-activedescendant");
  if (activeDescendant)
    return document2.getElementById(activeDescendant) || activeElement;
  return activeElement;
}
function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
  let { selectionManager: manager, keyboardDelegate: delegate, ref, autoFocus = false, shouldFocusWrap = false, disallowEmptySelection = false, disallowSelectAll = false, escapeKeyBehavior = "clearSelection", selectOnFocus = manager.selectionBehavior === "replace", disallowTypeAhead = false, shouldUseVirtualFocus, allowsTabNavigation = false, isVirtualized, scrollRef = ref, linkBehavior = "action" } = options;
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572$2();
  let onKeyDown = (e2) => {
    var _ref_current;
    if (e2.altKey && e2.key === "Tab")
      e2.preventDefault();
    if (!((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.contains(e2.target)))
      return;
    const navigateToKey = (key, childFocus) => {
      if (key != null) {
        if (manager.isLink(key) && linkBehavior === "selection" && selectOnFocus && !$feb5ffebff200149$export$d3e3bd3e26688c04(e2)) {
          reactDomExports.flushSync(() => {
            manager.setFocusedKey(key, childFocus);
          });
          let item = $feb5ffebff200149$export$c3d8340acf92597f$1(ref, key);
          let itemProps = manager.getItemProps(key);
          if (item)
            router.open(item, e2, itemProps.href, itemProps.routerOptions);
          return;
        }
        manager.setFocusedKey(key, childFocus);
        if (manager.isLink(key) && linkBehavior === "override")
          return;
        if (e2.shiftKey && manager.selectionMode === "multiple")
          manager.extendSelection(key);
        else if (selectOnFocus && !$feb5ffebff200149$export$d3e3bd3e26688c04(e2))
          manager.replaceSelection(key);
      }
    };
    switch (e2.key) {
      case "ArrowDown":
        if (delegate.getKeyBelow) {
          var _delegate_getKeyBelow, _delegate_getFirstKey, _delegate_getFirstKey1;
          let nextKey = manager.focusedKey != null ? (_delegate_getKeyBelow = delegate.getKeyBelow) === null || _delegate_getKeyBelow === void 0 ? void 0 : _delegate_getKeyBelow.call(delegate, manager.focusedKey) : (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate);
          if (nextKey == null && shouldFocusWrap)
            nextKey = (_delegate_getFirstKey1 = delegate.getFirstKey) === null || _delegate_getFirstKey1 === void 0 ? void 0 : _delegate_getFirstKey1.call(delegate, manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey);
          }
        }
        break;
      case "ArrowUp":
        if (delegate.getKeyAbove) {
          var _delegate_getKeyAbove, _delegate_getLastKey, _delegate_getLastKey1;
          let nextKey = manager.focusedKey != null ? (_delegate_getKeyAbove = delegate.getKeyAbove) === null || _delegate_getKeyAbove === void 0 ? void 0 : _delegate_getKeyAbove.call(delegate, manager.focusedKey) : (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate);
          if (nextKey == null && shouldFocusWrap)
            nextKey = (_delegate_getLastKey1 = delegate.getLastKey) === null || _delegate_getLastKey1 === void 0 ? void 0 : _delegate_getLastKey1.call(delegate, manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey);
          }
        }
        break;
      case "ArrowLeft":
        if (delegate.getKeyLeftOf) {
          var _delegate_getKeyLeftOf, _delegate_getFirstKey2, _delegate_getLastKey2;
          let nextKey = manager.focusedKey != null ? (_delegate_getKeyLeftOf = delegate.getKeyLeftOf) === null || _delegate_getKeyLeftOf === void 0 ? void 0 : _delegate_getKeyLeftOf.call(delegate, manager.focusedKey) : null;
          if (nextKey == null && shouldFocusWrap)
            nextKey = direction === "rtl" ? (_delegate_getFirstKey2 = delegate.getFirstKey) === null || _delegate_getFirstKey2 === void 0 ? void 0 : _delegate_getFirstKey2.call(delegate, manager.focusedKey) : (_delegate_getLastKey2 = delegate.getLastKey) === null || _delegate_getLastKey2 === void 0 ? void 0 : _delegate_getLastKey2.call(delegate, manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey, direction === "rtl" ? "first" : "last");
          }
        }
        break;
      case "ArrowRight":
        if (delegate.getKeyRightOf) {
          var _delegate_getKeyRightOf, _delegate_getLastKey3, _delegate_getFirstKey3;
          let nextKey = manager.focusedKey != null ? (_delegate_getKeyRightOf = delegate.getKeyRightOf) === null || _delegate_getKeyRightOf === void 0 ? void 0 : _delegate_getKeyRightOf.call(delegate, manager.focusedKey) : null;
          if (nextKey == null && shouldFocusWrap)
            nextKey = direction === "rtl" ? (_delegate_getLastKey3 = delegate.getLastKey) === null || _delegate_getLastKey3 === void 0 ? void 0 : _delegate_getLastKey3.call(delegate, manager.focusedKey) : (_delegate_getFirstKey3 = delegate.getFirstKey) === null || _delegate_getFirstKey3 === void 0 ? void 0 : _delegate_getFirstKey3.call(delegate, manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey, direction === "rtl" ? "last" : "first");
          }
        }
        break;
      case "Home":
        if (delegate.getFirstKey) {
          if (manager.focusedKey === null && e2.shiftKey)
            return;
          e2.preventDefault();
          let firstKey = delegate.getFirstKey(manager.focusedKey, $21f1aa98acb08317$export$16792effe837dba3(e2));
          manager.setFocusedKey(firstKey);
          if (firstKey != null) {
            if ($21f1aa98acb08317$export$16792effe837dba3(e2) && e2.shiftKey && manager.selectionMode === "multiple")
              manager.extendSelection(firstKey);
            else if (selectOnFocus)
              manager.replaceSelection(firstKey);
          }
        }
        break;
      case "End":
        if (delegate.getLastKey) {
          if (manager.focusedKey === null && e2.shiftKey)
            return;
          e2.preventDefault();
          let lastKey = delegate.getLastKey(manager.focusedKey, $21f1aa98acb08317$export$16792effe837dba3(e2));
          manager.setFocusedKey(lastKey);
          if (lastKey != null) {
            if ($21f1aa98acb08317$export$16792effe837dba3(e2) && e2.shiftKey && manager.selectionMode === "multiple")
              manager.extendSelection(lastKey);
            else if (selectOnFocus)
              manager.replaceSelection(lastKey);
          }
        }
        break;
      case "PageDown":
        if (delegate.getKeyPageBelow && manager.focusedKey != null) {
          let nextKey = delegate.getKeyPageBelow(manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey);
          }
        }
        break;
      case "PageUp":
        if (delegate.getKeyPageAbove && manager.focusedKey != null) {
          let nextKey = delegate.getKeyPageAbove(manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey);
          }
        }
        break;
      case "a":
        if ($21f1aa98acb08317$export$16792effe837dba3(e2) && manager.selectionMode === "multiple" && disallowSelectAll !== true) {
          e2.preventDefault();
          manager.selectAll();
        }
        break;
      case "Escape":
        if (escapeKeyBehavior === "clearSelection" && !disallowEmptySelection && manager.selectedKeys.size !== 0) {
          e2.stopPropagation();
          e2.preventDefault();
          manager.clearSelection();
        }
        break;
      case "Tab":
        if (!allowsTabNavigation) {
          if (e2.shiftKey)
            ref.current.focus();
          else {
            let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$3(ref.current, {
              tabbable: true
            });
            let next2 = void 0;
            let last;
            do {
              last = walker.lastChild();
              if (last)
                next2 = last;
            } while (last);
            if (next2 && !next2.contains(document.activeElement))
              $7215afc6de606d6b$export$de79e2c695e052f3$5(next2);
          }
          break;
        }
    }
  };
  let scrollPos = reactExports.useRef({
    top: 0,
    left: 0
  });
  $e9faafb641e167db$export$90fc3a17d93f704c(scrollRef, "scroll", isVirtualized ? void 0 : () => {
    var _scrollRef_current, _scrollRef_current1;
    var _scrollRef_current_scrollTop, _scrollRef_current_scrollLeft;
    scrollPos.current = {
      top: (_scrollRef_current_scrollTop = (_scrollRef_current = scrollRef.current) === null || _scrollRef_current === void 0 ? void 0 : _scrollRef_current.scrollTop) !== null && _scrollRef_current_scrollTop !== void 0 ? _scrollRef_current_scrollTop : 0,
      left: (_scrollRef_current_scrollLeft = (_scrollRef_current1 = scrollRef.current) === null || _scrollRef_current1 === void 0 ? void 0 : _scrollRef_current1.scrollLeft) !== null && _scrollRef_current_scrollLeft !== void 0 ? _scrollRef_current_scrollLeft : 0
    };
  });
  let onFocus = (e2) => {
    if (manager.isFocused) {
      if (!e2.currentTarget.contains(e2.target))
        manager.setFocused(false);
      return;
    }
    if (!e2.currentTarget.contains(e2.target))
      return;
    manager.setFocused(true);
    if (manager.focusedKey == null) {
      var _delegate_getLastKey, _delegate_getFirstKey;
      let navigateToKey = (key) => {
        if (key != null) {
          manager.setFocusedKey(key);
          if (selectOnFocus && !manager.isSelected(key))
            manager.replaceSelection(key);
        }
      };
      let relatedTarget = e2.relatedTarget;
      var _manager_lastSelectedKey, _manager_firstSelectedKey;
      if (relatedTarget && e2.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING)
        navigateToKey((_manager_lastSelectedKey = manager.lastSelectedKey) !== null && _manager_lastSelectedKey !== void 0 ? _manager_lastSelectedKey : (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate));
      else
        navigateToKey((_manager_firstSelectedKey = manager.firstSelectedKey) !== null && _manager_firstSelectedKey !== void 0 ? _manager_firstSelectedKey : (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate));
    } else if (!isVirtualized && scrollRef.current) {
      scrollRef.current.scrollTop = scrollPos.current.top;
      scrollRef.current.scrollLeft = scrollPos.current.left;
    }
    if (manager.focusedKey != null && scrollRef.current) {
      let element2 = $feb5ffebff200149$export$c3d8340acf92597f$1(ref, manager.focusedKey);
      if (element2 instanceof HTMLElement) {
        if (!element2.contains(document.activeElement) && !shouldUseVirtualFocus)
          $7215afc6de606d6b$export$de79e2c695e052f3$5(element2);
        let modality = $507fabe10e71c6fb$export$630ff653c5ada6a9$2();
        if (modality === "keyboard")
          $2f04cbc44ee30ce0$export$c826860796309d1b(element2, {
            containingElement: ref.current
          });
      }
    }
  };
  let onBlur = (e2) => {
    if (!e2.currentTarget.contains(e2.relatedTarget))
      manager.setFocused(false);
  };
  let shouldVirtualFocusFirst = reactExports.useRef(false);
  $e9faafb641e167db$export$90fc3a17d93f704c(ref, $5671b20cf9b562b2$export$831c820ad60f9d12, !shouldUseVirtualFocus ? void 0 : (e2) => {
    let { detail } = e2;
    e2.stopPropagation();
    manager.setFocused(true);
    if ((detail === null || detail === void 0 ? void 0 : detail.focusStrategy) === "first")
      shouldVirtualFocusFirst.current = true;
  });
  let updateActiveDescendant = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    var _delegate_getFirstKey;
    var _delegate_getFirstKey1;
    let keyToFocus = (_delegate_getFirstKey1 = (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate)) !== null && _delegate_getFirstKey1 !== void 0 ? _delegate_getFirstKey1 : null;
    if (keyToFocus == null) {
      let previousActiveElement = $d4ee10de306f2510$export$cd4e5573fbe2b576();
      $55f9b1ae81f22853$export$76e4e37e5339496d(ref.current);
      $55f9b1ae81f22853$export$2b35b76d2e30e129$1(previousActiveElement, null);
      if (manager.collection.size > 0)
        shouldVirtualFocusFirst.current = false;
    } else {
      manager.setFocusedKey(keyToFocus);
      shouldVirtualFocusFirst.current = false;
    }
  });
  $ca9b37712f007381$export$72ef708ab07251f1(() => {
    if (shouldVirtualFocusFirst.current)
      updateActiveDescendant();
  }, [
    manager.collection,
    updateActiveDescendant
  ]);
  let resetFocusFirstFlag = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    if (manager.collection.size > 0)
      shouldVirtualFocusFirst.current = false;
  });
  $ca9b37712f007381$export$72ef708ab07251f1(() => {
    resetFocusFirstFlag();
  }, [
    manager.focusedKey,
    resetFocusFirstFlag
  ]);
  $e9faafb641e167db$export$90fc3a17d93f704c(ref, $5671b20cf9b562b2$export$447a38995de2c711, !shouldUseVirtualFocus ? void 0 : (e2) => {
    var _e_detail;
    e2.stopPropagation();
    manager.setFocused(false);
    if ((_e_detail = e2.detail) === null || _e_detail === void 0 ? void 0 : _e_detail.clearFocusKey)
      manager.setFocusedKey(null);
  });
  const autoFocusRef = reactExports.useRef(autoFocus);
  const didAutoFocusRef = reactExports.useRef(false);
  reactExports.useEffect(() => {
    if (autoFocusRef.current) {
      var _delegate_getFirstKey, _delegate_getLastKey;
      let focusedKey = null;
      var _delegate_getFirstKey1;
      if (autoFocus === "first")
        focusedKey = (_delegate_getFirstKey1 = (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate)) !== null && _delegate_getFirstKey1 !== void 0 ? _delegate_getFirstKey1 : null;
      var _delegate_getLastKey1;
      if (autoFocus === "last")
        focusedKey = (_delegate_getLastKey1 = (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate)) !== null && _delegate_getLastKey1 !== void 0 ? _delegate_getLastKey1 : null;
      let selectedKeys = manager.selectedKeys;
      if (selectedKeys.size) {
        for (let key of selectedKeys)
          if (manager.canSelectItem(key)) {
            focusedKey = key;
            break;
          }
      }
      manager.setFocused(true);
      manager.setFocusedKey(focusedKey);
      if (focusedKey == null && !shouldUseVirtualFocus && ref.current)
        $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
      if (manager.collection.size > 0) {
        autoFocusRef.current = false;
        didAutoFocusRef.current = true;
      }
    }
  });
  let lastFocusedKey = reactExports.useRef(manager.focusedKey);
  let raf3 = reactExports.useRef(null);
  reactExports.useEffect(() => {
    if (manager.isFocused && manager.focusedKey != null && (manager.focusedKey !== lastFocusedKey.current || didAutoFocusRef.current) && scrollRef.current && ref.current) {
      let modality = $507fabe10e71c6fb$export$630ff653c5ada6a9$2();
      let element2 = $feb5ffebff200149$export$c3d8340acf92597f$1(ref, manager.focusedKey);
      if (!(element2 instanceof HTMLElement))
        return;
      if (modality === "keyboard" || didAutoFocusRef.current) {
        if (raf3.current)
          cancelAnimationFrame(raf3.current);
        raf3.current = requestAnimationFrame(() => {
          if (scrollRef.current) {
            $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollRef.current, element2);
            if (modality !== "virtual")
              $2f04cbc44ee30ce0$export$c826860796309d1b(element2, {
                containingElement: ref.current
              });
          }
        });
      }
    }
    if (!shouldUseVirtualFocus && manager.isFocused && manager.focusedKey == null && lastFocusedKey.current != null && ref.current)
      $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
    lastFocusedKey.current = manager.focusedKey;
    didAutoFocusRef.current = false;
  });
  reactExports.useEffect(() => {
    return () => {
      if (raf3.current)
        cancelAnimationFrame(raf3.current);
    };
  }, []);
  $e9faafb641e167db$export$90fc3a17d93f704c(ref, "react-aria-focus-scope-restore", (e2) => {
    e2.preventDefault();
    manager.setFocused(true);
  });
  let handlers2 = {
    onKeyDown,
    onFocus,
    onBlur,
    onMouseDown(e2) {
      if (scrollRef.current === e2.target)
        e2.preventDefault();
    }
  };
  let { typeSelectProps } = $fb3050f43d946246$export$e32c88dfddc6e1d8$1({
    keyboardDelegate: delegate,
    selectionManager: manager
  });
  if (!disallowTypeAhead)
    handlers2 = $3ef42575df84b30b$export$9d1611c77c2fe928$9(typeSelectProps, handlers2);
  let tabIndex = void 0;
  if (!shouldUseVirtualFocus)
    tabIndex = manager.focusedKey == null ? 0 : -1;
  let collectionId = $feb5ffebff200149$export$881eb0d9f3605d9d(manager.collection);
  return {
    collectionProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(handlers2, {
      tabIndex,
      "data-collection": collectionId
    })
  };
}
function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
  let { id: id2, selectionManager: manager, key, ref, shouldSelectOnPressUp, shouldUseVirtualFocus, focus, isDisabled, onAction, allowsDifferentPressOrigin, linkBehavior = "action" } = options;
  let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572$2();
  id2 = $bdb11010cef70236$export$f680877a34711e37$2(id2);
  let onSelect = (e2) => {
    if (e2.pointerType === "keyboard" && $feb5ffebff200149$export$d3e3bd3e26688c04(e2))
      manager.toggleSelection(key);
    else {
      if (manager.selectionMode === "none")
        return;
      if (manager.isLink(key)) {
        if (linkBehavior === "selection" && ref.current) {
          let itemProps2 = manager.getItemProps(key);
          router.open(ref.current, e2, itemProps2.href, itemProps2.routerOptions);
          manager.setSelectedKeys(manager.selectedKeys);
          return;
        } else if (linkBehavior === "override" || linkBehavior === "none")
          return;
      }
      if (manager.selectionMode === "single") {
        if (manager.isSelected(key) && !manager.disallowEmptySelection)
          manager.toggleSelection(key);
        else
          manager.replaceSelection(key);
      } else if (e2 && e2.shiftKey)
        manager.extendSelection(key);
      else if (manager.selectionBehavior === "toggle" || e2 && ($21f1aa98acb08317$export$16792effe837dba3(e2) || e2.pointerType === "touch" || e2.pointerType === "virtual"))
        manager.toggleSelection(key);
      else
        manager.replaceSelection(key);
    }
  };
  reactExports.useEffect(() => {
    let isFocused = key === manager.focusedKey;
    if (isFocused && manager.isFocused) {
      if (!shouldUseVirtualFocus) {
        if (focus)
          focus();
        else if (document.activeElement !== ref.current && ref.current)
          $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
      } else
        $55f9b1ae81f22853$export$76e4e37e5339496d(ref.current);
    }
  }, [
    ref,
    key,
    manager.focusedKey,
    manager.childFocusStrategy,
    manager.isFocused,
    shouldUseVirtualFocus
  ]);
  isDisabled = isDisabled || manager.isDisabled(key);
  let itemProps = {};
  if (!shouldUseVirtualFocus && !isDisabled)
    itemProps = {
      tabIndex: key === manager.focusedKey ? 0 : -1,
      onFocus(e2) {
        if (e2.target === ref.current)
          manager.setFocusedKey(key);
      }
    };
  else if (isDisabled)
    itemProps.onMouseDown = (e2) => {
      e2.preventDefault();
    };
  let isLinkOverride = manager.isLink(key) && linkBehavior === "override";
  let hasLinkAction = manager.isLink(key) && linkBehavior !== "selection" && linkBehavior !== "none";
  let allowsSelection = !isDisabled && manager.canSelectItem(key) && !isLinkOverride;
  let allowsActions = (onAction || hasLinkAction) && !isDisabled;
  let hasPrimaryAction = allowsActions && (manager.selectionBehavior === "replace" ? !allowsSelection : !allowsSelection || manager.isEmpty);
  let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior === "replace";
  let hasAction = hasPrimaryAction || hasSecondaryAction;
  let modality = reactExports.useRef(null);
  let longPressEnabled = hasAction && allowsSelection;
  let longPressEnabledOnPressStart = reactExports.useRef(false);
  let hadPrimaryActionOnPressStart = reactExports.useRef(false);
  let collectionItemProps = manager.getItemProps(key);
  let performAction = (e2) => {
    if (onAction)
      onAction();
    if (hasLinkAction && ref.current)
      router.open(ref.current, e2, collectionItemProps.href, collectionItemProps.routerOptions);
  };
  let itemPressProps = {
    ref
  };
  if (shouldSelectOnPressUp) {
    itemPressProps.onPressStart = (e2) => {
      modality.current = e2.pointerType;
      longPressEnabledOnPressStart.current = longPressEnabled;
      if (e2.pointerType === "keyboard" && (!hasAction || $880e95eb8b93ba9a$var$isSelectionKey()))
        onSelect(e2);
    };
    if (!allowsDifferentPressOrigin)
      itemPressProps.onPress = (e2) => {
        if (hasPrimaryAction || hasSecondaryAction && e2.pointerType !== "mouse") {
          if (e2.pointerType === "keyboard" && !$880e95eb8b93ba9a$var$isActionKey())
            return;
          performAction(e2);
        } else if (e2.pointerType !== "keyboard" && allowsSelection)
          onSelect(e2);
      };
    else {
      itemPressProps.onPressUp = hasPrimaryAction ? void 0 : (e2) => {
        if (e2.pointerType === "mouse" && allowsSelection)
          onSelect(e2);
      };
      itemPressProps.onPress = hasPrimaryAction ? performAction : (e2) => {
        if (e2.pointerType !== "keyboard" && e2.pointerType !== "mouse" && allowsSelection)
          onSelect(e2);
      };
    }
  } else {
    itemPressProps.onPressStart = (e2) => {
      modality.current = e2.pointerType;
      longPressEnabledOnPressStart.current = longPressEnabled;
      hadPrimaryActionOnPressStart.current = hasPrimaryAction;
      if (allowsSelection && (e2.pointerType === "mouse" && !hasPrimaryAction || e2.pointerType === "keyboard" && (!allowsActions || $880e95eb8b93ba9a$var$isSelectionKey())))
        onSelect(e2);
    };
    itemPressProps.onPress = (e2) => {
      if (e2.pointerType === "touch" || e2.pointerType === "pen" || e2.pointerType === "virtual" || e2.pointerType === "keyboard" && hasAction && $880e95eb8b93ba9a$var$isActionKey() || e2.pointerType === "mouse" && hadPrimaryActionOnPressStart.current) {
        if (hasAction)
          performAction(e2);
        else if (allowsSelection)
          onSelect(e2);
      }
    };
  }
  itemProps["data-collection"] = $feb5ffebff200149$export$6aeb1680a0ae8741(manager.collection);
  itemProps["data-key"] = key;
  itemPressProps.preventFocusOnPress = shouldUseVirtualFocus;
  if (shouldUseVirtualFocus)
    itemPressProps = $3ef42575df84b30b$export$9d1611c77c2fe928$9(itemPressProps, {
      onPressStart(e2) {
        if (e2.pointerType !== "touch") {
          manager.setFocused(true);
          manager.setFocusedKey(key);
        }
      },
      onPress(e2) {
        if (e2.pointerType === "touch") {
          manager.setFocused(true);
          manager.setFocusedKey(key);
        }
      }
    });
  if (collectionItemProps) {
    for (let key2 of [
      "onPressStart",
      "onPressEnd",
      "onPressChange",
      "onPress",
      "onPressUp",
      "onClick"
    ])
      if (collectionItemProps[key2])
        itemPressProps[key2] = $ff5963eb1fccf552$export$e08e3b67e392101e$9(itemPressProps[key2], collectionItemProps[key2]);
  }
  let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$b(itemPressProps);
  let onDoubleClick = hasSecondaryAction ? (e2) => {
    if (modality.current === "mouse") {
      e2.stopPropagation();
      e2.preventDefault();
      performAction(e2);
    }
  } : void 0;
  let { longPressProps } = $8a26561d2877236e$export$c24ed0104d07eab9({
    isDisabled: !longPressEnabled,
    onLongPress(e2) {
      if (e2.pointerType === "touch") {
        onSelect(e2);
        manager.setSelectionBehavior("toggle");
      }
    }
  });
  let onDragStartCapture = (e2) => {
    if (modality.current === "touch" && longPressEnabledOnPressStart.current)
      e2.preventDefault();
  };
  let onClick = linkBehavior !== "none" && manager.isLink(key) ? (e2) => {
    if (!$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening)
      e2.preventDefault();
  } : void 0;
  return {
    itemProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(
      itemProps,
      allowsSelection || hasPrimaryAction || shouldUseVirtualFocus && !isDisabled ? pressProps : {},
      longPressEnabled ? longPressProps : {},
      {
        onDoubleClick,
        onDragStartCapture,
        onClick,
        id: id2
      },
      // Prevent DOM focus from moving on mouse down when using virtual focus
      shouldUseVirtualFocus ? {
        onMouseDown: (e2) => e2.preventDefault()
      } : void 0
    ),
    isPressed,
    isSelected: manager.isSelected(key),
    isFocused: manager.isFocused && manager.focusedKey === key,
    isDisabled,
    allowsSelection,
    hasAction
  };
}
function $880e95eb8b93ba9a$var$isActionKey() {
  let event = window.event;
  return (event === null || event === void 0 ? void 0 : event.key) === "Enter";
}
function $880e95eb8b93ba9a$var$isSelectionKey() {
  let event = window.event;
  return (event === null || event === void 0 ? void 0 : event.key) === " " || (event === null || event === void 0 ? void 0 : event.code) === "Space";
}
let $657e4dc4a6e88df0$export$8f5ed9ff9f511381$1 = class $657e4dc4a6e88df0$export$8f5ed9ff9f5113812 {
  getItemRect(key) {
    let container = this.ref.current;
    if (!container)
      return null;
    let item = key != null ? $feb5ffebff200149$export$c3d8340acf92597f$1(this.ref, key) : null;
    if (!item)
      return null;
    let containerRect = container.getBoundingClientRect();
    let itemRect = item.getBoundingClientRect();
    return {
      x: itemRect.left - containerRect.left + container.scrollLeft,
      y: itemRect.top - containerRect.top + container.scrollTop,
      width: itemRect.width,
      height: itemRect.height
    };
  }
  getContentSize() {
    let container = this.ref.current;
    var _container_scrollWidth, _container_scrollHeight;
    return {
      width: (_container_scrollWidth = container === null || container === void 0 ? void 0 : container.scrollWidth) !== null && _container_scrollWidth !== void 0 ? _container_scrollWidth : 0,
      height: (_container_scrollHeight = container === null || container === void 0 ? void 0 : container.scrollHeight) !== null && _container_scrollHeight !== void 0 ? _container_scrollHeight : 0
    };
  }
  getVisibleRect() {
    let container = this.ref.current;
    var _container_scrollLeft, _container_scrollTop, _container_offsetWidth, _container_offsetHeight;
    return {
      x: (_container_scrollLeft = container === null || container === void 0 ? void 0 : container.scrollLeft) !== null && _container_scrollLeft !== void 0 ? _container_scrollLeft : 0,
      y: (_container_scrollTop = container === null || container === void 0 ? void 0 : container.scrollTop) !== null && _container_scrollTop !== void 0 ? _container_scrollTop : 0,
      width: (_container_offsetWidth = container === null || container === void 0 ? void 0 : container.offsetWidth) !== null && _container_offsetWidth !== void 0 ? _container_offsetWidth : 0,
      height: (_container_offsetHeight = container === null || container === void 0 ? void 0 : container.offsetHeight) !== null && _container_offsetHeight !== void 0 ? _container_offsetHeight : 0
    };
  }
  constructor(ref) {
    this.ref = ref;
  }
};
let $2a25aae57d74318e$export$a05409b8bb224a5a$1 = class $2a25aae57d74318e$export$a05409b8bb224a5a2 {
  isDisabled(item) {
    var _item_props;
    return this.disabledBehavior === "all" && (((_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.isDisabled) || this.disabledKeys.has(item.key));
  }
  findNextNonDisabled(key, getNext) {
    let nextKey = key;
    while (nextKey != null) {
      let item = this.collection.getItem(nextKey);
      if ((item === null || item === void 0 ? void 0 : item.type) === "item" && !this.isDisabled(item))
        return nextKey;
      nextKey = getNext(nextKey);
    }
    return null;
  }
  getNextKey(key) {
    let nextKey = key;
    nextKey = this.collection.getKeyAfter(nextKey);
    return this.findNextNonDisabled(nextKey, (key2) => this.collection.getKeyAfter(key2));
  }
  getPreviousKey(key) {
    let nextKey = key;
    nextKey = this.collection.getKeyBefore(nextKey);
    return this.findNextNonDisabled(nextKey, (key2) => this.collection.getKeyBefore(key2));
  }
  findKey(key, nextKey, shouldSkip2) {
    let tempKey = key;
    let itemRect = this.layoutDelegate.getItemRect(tempKey);
    if (!itemRect || tempKey == null)
      return null;
    let prevRect = itemRect;
    do {
      tempKey = nextKey(tempKey);
      if (tempKey == null)
        break;
      itemRect = this.layoutDelegate.getItemRect(tempKey);
    } while (itemRect && shouldSkip2(prevRect, itemRect) && tempKey != null);
    return tempKey;
  }
  isSameRow(prevRect, itemRect) {
    return prevRect.y === itemRect.y || prevRect.x !== itemRect.x;
  }
  isSameColumn(prevRect, itemRect) {
    return prevRect.x === itemRect.x || prevRect.y !== itemRect.y;
  }
  getKeyBelow(key) {
    if (this.layout === "grid" && this.orientation === "vertical")
      return this.findKey(key, (key2) => this.getNextKey(key2), this.isSameRow);
    else
      return this.getNextKey(key);
  }
  getKeyAbove(key) {
    if (this.layout === "grid" && this.orientation === "vertical")
      return this.findKey(key, (key2) => this.getPreviousKey(key2), this.isSameRow);
    else
      return this.getPreviousKey(key);
  }
  getNextColumn(key, right) {
    return right ? this.getPreviousKey(key) : this.getNextKey(key);
  }
  getKeyRightOf(key) {
    let layoutDelegateMethod = this.direction === "ltr" ? "getKeyRightOf" : "getKeyLeftOf";
    if (this.layoutDelegate[layoutDelegateMethod]) {
      key = this.layoutDelegate[layoutDelegateMethod](key);
      return this.findNextNonDisabled(key, (key2) => this.layoutDelegate[layoutDelegateMethod](key2));
    }
    if (this.layout === "grid") {
      if (this.orientation === "vertical")
        return this.getNextColumn(key, this.direction === "rtl");
      else
        return this.findKey(key, (key2) => this.getNextColumn(key2, this.direction === "rtl"), this.isSameColumn);
    } else if (this.orientation === "horizontal")
      return this.getNextColumn(key, this.direction === "rtl");
    return null;
  }
  getKeyLeftOf(key) {
    let layoutDelegateMethod = this.direction === "ltr" ? "getKeyLeftOf" : "getKeyRightOf";
    if (this.layoutDelegate[layoutDelegateMethod]) {
      key = this.layoutDelegate[layoutDelegateMethod](key);
      return this.findNextNonDisabled(key, (key2) => this.layoutDelegate[layoutDelegateMethod](key2));
    }
    if (this.layout === "grid") {
      if (this.orientation === "vertical")
        return this.getNextColumn(key, this.direction === "ltr");
      else
        return this.findKey(key, (key2) => this.getNextColumn(key2, this.direction === "ltr"), this.isSameColumn);
    } else if (this.orientation === "horizontal")
      return this.getNextColumn(key, this.direction === "ltr");
    return null;
  }
  getFirstKey() {
    let key = this.collection.getFirstKey();
    return this.findNextNonDisabled(key, (key2) => this.collection.getKeyAfter(key2));
  }
  getLastKey() {
    let key = this.collection.getLastKey();
    return this.findNextNonDisabled(key, (key2) => this.collection.getKeyBefore(key2));
  }
  getKeyPageAbove(key) {
    let menu2 = this.ref.current;
    let itemRect = this.layoutDelegate.getItemRect(key);
    if (!itemRect)
      return null;
    if (menu2 && !$cc38e7bd3fc7b213$export$2bb74740c4e19def$1(menu2))
      return this.getFirstKey();
    let nextKey = key;
    if (this.orientation === "horizontal") {
      let pageX = Math.max(0, itemRect.x + itemRect.width - this.layoutDelegate.getVisibleRect().width);
      while (itemRect && itemRect.x > pageX && nextKey != null) {
        nextKey = this.getKeyAbove(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    } else {
      let pageY = Math.max(0, itemRect.y + itemRect.height - this.layoutDelegate.getVisibleRect().height);
      while (itemRect && itemRect.y > pageY && nextKey != null) {
        nextKey = this.getKeyAbove(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    }
    return nextKey !== null && nextKey !== void 0 ? nextKey : this.getFirstKey();
  }
  getKeyPageBelow(key) {
    let menu2 = this.ref.current;
    let itemRect = this.layoutDelegate.getItemRect(key);
    if (!itemRect)
      return null;
    if (menu2 && !$cc38e7bd3fc7b213$export$2bb74740c4e19def$1(menu2))
      return this.getLastKey();
    let nextKey = key;
    if (this.orientation === "horizontal") {
      let pageX = Math.min(this.layoutDelegate.getContentSize().width, itemRect.y - itemRect.width + this.layoutDelegate.getVisibleRect().width);
      while (itemRect && itemRect.x < pageX && nextKey != null) {
        nextKey = this.getKeyBelow(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    } else {
      let pageY = Math.min(this.layoutDelegate.getContentSize().height, itemRect.y - itemRect.height + this.layoutDelegate.getVisibleRect().height);
      while (itemRect && itemRect.y < pageY && nextKey != null) {
        nextKey = this.getKeyBelow(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    }
    return nextKey !== null && nextKey !== void 0 ? nextKey : this.getLastKey();
  }
  getKeyForSearch(search2, fromKey) {
    if (!this.collator)
      return null;
    let collection = this.collection;
    let key = fromKey || this.getFirstKey();
    while (key != null) {
      let item = collection.getItem(key);
      if (!item)
        return null;
      let substring = item.textValue.slice(0, search2.length);
      if (item.textValue && this.collator.compare(substring, search2) === 0)
        return key;
      key = this.getNextKey(key);
    }
    return null;
  }
  constructor(...args) {
    if (args.length === 1) {
      let opts2 = args[0];
      this.collection = opts2.collection;
      this.ref = opts2.ref;
      this.collator = opts2.collator;
      this.disabledKeys = opts2.disabledKeys || /* @__PURE__ */ new Set();
      this.disabledBehavior = opts2.disabledBehavior || "all";
      this.orientation = opts2.orientation || "vertical";
      this.direction = opts2.direction;
      this.layout = opts2.layout || "stack";
      this.layoutDelegate = opts2.layoutDelegate || new $657e4dc4a6e88df0$export$8f5ed9ff9f511381$1(opts2.ref);
    } else {
      this.collection = args[0];
      this.disabledKeys = args[1];
      this.ref = args[2];
      this.collator = args[3];
      this.layout = "stack";
      this.orientation = "vertical";
      this.disabledBehavior = "all";
      this.layoutDelegate = new $657e4dc4a6e88df0$export$8f5ed9ff9f511381$1(this.ref);
    }
    if (this.layout === "stack" && this.orientation === "vertical") {
      this.getKeyLeftOf = void 0;
      this.getKeyRightOf = void 0;
    }
  }
};
function $982254629710d113$export$b95089534ab7c1fd(props) {
  let { selectionManager, collection, disabledKeys, ref, keyboardDelegate, layoutDelegate } = props;
  let collator = $325a3faab7a68acd$export$a16aca283550c30d$2({
    usage: "search",
    sensitivity: "base"
  });
  let disabledBehavior = selectionManager.disabledBehavior;
  let delegate = reactExports.useMemo(() => keyboardDelegate || new $2a25aae57d74318e$export$a05409b8bb224a5a$1({
    collection,
    disabledKeys,
    disabledBehavior,
    ref,
    collator,
    layoutDelegate
  }), [
    keyboardDelegate,
    layoutDelegate,
    collection,
    disabledKeys,
    ref,
    collator,
    disabledBehavior
  ]);
  let { collectionProps } = $ae20dd8cbca75726$export$d6daf82dcd84e87c({
    ...props,
    ref,
    selectionManager,
    keyboardDelegate: delegate
  });
  return {
    listProps: collectionProps
  };
}
function $d5336fe17ce95402$export$38eaa17faae8f579(props, state, ref) {
  let { shouldFocusWrap = true, onKeyDown, onKeyUp, ...otherProps } = props;
  if (!props["aria-label"] && !props["aria-labelledby"] && false)
    ;
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  let { listProps } = $982254629710d113$export$b95089534ab7c1fd({
    ...otherProps,
    ref,
    selectionManager: state.selectionManager,
    collection: state.collection,
    disabledKeys: state.disabledKeys,
    shouldFocusWrap,
    linkBehavior: "override"
  });
  $fc79756100351201$export$6f49b4016bfc8d56.set(state, {
    onClose: props.onClose,
    onAction: props.onAction,
    shouldUseVirtualFocus: props.shouldUseVirtualFocus
  });
  return {
    menuProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, {
      onKeyDown,
      onKeyUp
    }, {
      role: "menu",
      ...listProps,
      onKeyDown: (e2) => {
        var _listProps_onKeyDown;
        if (e2.key !== "Escape" || props.shouldUseVirtualFocus)
          (_listProps_onKeyDown = listProps.onKeyDown) === null || _listProps_onKeyDown === void 0 ? void 0 : _listProps_onKeyDown.call(listProps, e2);
      }
    })
  };
}
function $a2e5df62f93c7633$export$9d32628fc2aea7da(props, state, ref) {
  let { id: id2, key, closeOnSelect, isVirtualized, "aria-haspopup": hasPopup, onPressStart: pressStartProp, onPressUp: pressUpProp, onPress: pressProp, onPressChange, onPressEnd, onHoverStart: hoverStartProp, onHoverChange, onHoverEnd, onKeyDown, onKeyUp, onFocus, onFocusChange, onBlur, selectionManager = state.selectionManager } = props;
  let isTrigger = !!hasPopup;
  let isTriggerExpanded = isTrigger && props["aria-expanded"] === "true";
  var _props_isDisabled;
  let isDisabled = (_props_isDisabled = props.isDisabled) !== null && _props_isDisabled !== void 0 ? _props_isDisabled : selectionManager.isDisabled(key);
  var _props_isSelected;
  let isSelected = (_props_isSelected = props.isSelected) !== null && _props_isSelected !== void 0 ? _props_isSelected : selectionManager.isSelected(key);
  let data = $fc79756100351201$export$6f49b4016bfc8d56.get(state);
  let item = state.collection.getItem(key);
  let onClose = props.onClose || data.onClose;
  let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572$2();
  let performAction = (e2) => {
    var _item_props;
    if (isTrigger)
      return;
    if (item === null || item === void 0 ? void 0 : (_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.onAction)
      item.props.onAction();
    else if (props.onAction)
      props.onAction(key);
    if (data.onAction) {
      let onAction = data.onAction;
      onAction(key);
    }
    if (e2.target instanceof HTMLAnchorElement && item)
      router.open(e2.target, e2, item.props.href, item.props.routerOptions);
  };
  let role = "menuitem";
  if (!isTrigger) {
    if (selectionManager.selectionMode === "single")
      role = "menuitemradio";
    else if (selectionManager.selectionMode === "multiple")
      role = "menuitemcheckbox";
  }
  let labelId = $bdb11010cef70236$export$b4cc09c592e8fdb8$1();
  let descriptionId = $bdb11010cef70236$export$b4cc09c592e8fdb8$1();
  let keyboardId = $bdb11010cef70236$export$b4cc09c592e8fdb8$1();
  let ariaProps = {
    id: id2,
    "aria-disabled": isDisabled || void 0,
    role,
    "aria-label": props["aria-label"],
    "aria-labelledby": labelId,
    "aria-describedby": [
      descriptionId,
      keyboardId
    ].filter(Boolean).join(" ") || void 0,
    "aria-controls": props["aria-controls"],
    "aria-haspopup": hasPopup,
    "aria-expanded": props["aria-expanded"]
  };
  if (selectionManager.selectionMode !== "none" && !isTrigger)
    ariaProps["aria-checked"] = isSelected;
  if (isVirtualized) {
    ariaProps["aria-posinset"] = item === null || item === void 0 ? void 0 : item.index;
    ariaProps["aria-setsize"] = $453cc9f0df89c0a5$export$77d5aafae4e095b2(state.collection);
  }
  let onPressStart = (e2) => {
    if (e2.pointerType === "keyboard")
      performAction(e2);
    pressStartProp === null || pressStartProp === void 0 ? void 0 : pressStartProp(e2);
  };
  let maybeClose = () => {
    if (!isTrigger && onClose && (closeOnSelect !== null && closeOnSelect !== void 0 ? closeOnSelect : selectionManager.selectionMode !== "multiple" || selectionManager.isLink(key)))
      onClose();
  };
  let onPressUp = (e2) => {
    if (e2.pointerType === "mouse") {
      performAction(e2);
      maybeClose();
    }
    pressUpProp === null || pressUpProp === void 0 ? void 0 : pressUpProp(e2);
  };
  let onPress = (e2) => {
    if (e2.pointerType !== "keyboard" && e2.pointerType !== "mouse") {
      performAction(e2);
      maybeClose();
    }
    pressProp === null || pressProp === void 0 ? void 0 : pressProp(e2);
  };
  let { itemProps, isFocused } = $880e95eb8b93ba9a$export$ecf600387e221c37({
    id: id2,
    selectionManager,
    key,
    ref,
    shouldSelectOnPressUp: true,
    allowsDifferentPressOrigin: true,
    // Disable all handling of links in useSelectable item
    // because we handle it ourselves. The behavior of menus
    // is slightly different from other collections because
    // actions are performed on key down rather than key up.
    linkBehavior: "none",
    shouldUseVirtualFocus: data.shouldUseVirtualFocus
  });
  let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    onPressStart,
    onPress,
    onPressUp,
    onPressChange,
    onPressEnd,
    isDisabled
  });
  let { hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$h({
    isDisabled,
    onHoverStart(e2) {
      if (!$507fabe10e71c6fb$export$b9b3dfddab17db27$2() && !(isTriggerExpanded && hasPopup)) {
        selectionManager.setFocused(true);
        selectionManager.setFocusedKey(key);
      }
      hoverStartProp === null || hoverStartProp === void 0 ? void 0 : hoverStartProp(e2);
    },
    onHoverChange,
    onHoverEnd
  });
  let { keyboardProps } = $46d819fcbaf35654$export$8f71654801c2f7cd$2({
    onKeyDown: (e2) => {
      if (e2.repeat) {
        e2.continuePropagation();
        return;
      }
      switch (e2.key) {
        case " ":
          if (!isDisabled && selectionManager.selectionMode === "none" && !isTrigger && closeOnSelect !== false && onClose)
            onClose();
          break;
        case "Enter":
          if (!isDisabled && closeOnSelect !== false && !isTrigger && onClose)
            onClose();
          break;
        default:
          if (!isTrigger)
            e2.continuePropagation();
          onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e2);
          break;
      }
    },
    onKeyUp
  });
  let { focusProps } = $a1ea59d68270f0dd$export$f8168d8dd8fd66e6$2({
    onBlur,
    onFocus,
    onFocusChange
  });
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(item === null || item === void 0 ? void 0 : item.props);
  delete domProps.id;
  let linkProps = $ea8dcbcb9ea1b556$export$7e924b3091a3bd18$1(item === null || item === void 0 ? void 0 : item.props);
  return {
    menuItemProps: {
      ...ariaProps,
      ...$3ef42575df84b30b$export$9d1611c77c2fe928$9(
        domProps,
        linkProps,
        isTrigger ? {
          onFocus: itemProps.onFocus,
          "data-collection": itemProps["data-collection"],
          "data-key": itemProps["data-key"]
        } : itemProps,
        pressProps,
        hoverProps,
        keyboardProps,
        focusProps,
        // Prevent DOM focus from moving on mouse down when using virtual focus or this is a submenu/subdialog trigger.
        data.shouldUseVirtualFocus || isTrigger ? {
          onMouseDown: (e2) => e2.preventDefault()
        } : void 0
      ),
      // If a submenu is expanded, set the tabIndex to -1 so that shift tabbing goes out of the menu instead of the parent menu item.
      tabIndex: itemProps.tabIndex != null && isTriggerExpanded && !data.shouldUseVirtualFocus ? -1 : itemProps.tabIndex
    },
    labelProps: {
      id: labelId
    },
    descriptionProps: {
      id: descriptionId
    },
    keyboardShortcutProps: {
      id: keyboardId
    },
    isFocused,
    isFocusVisible: isFocused && selectionManager.isFocused && $507fabe10e71c6fb$export$b9b3dfddab17db27$2() && !isTriggerExpanded,
    isSelected,
    isPressed,
    isDisabled
  };
}
function $3e5eb2498db5b506$export$73f7a44322579622(props) {
  let { heading: heading2, "aria-label": ariaLabel } = props;
  let headingId = $bdb11010cef70236$export$f680877a34711e37$2();
  return {
    itemProps: {
      role: "presentation"
    },
    headingProps: heading2 ? {
      // Techincally, menus cannot contain headings according to ARIA.
      // We hide the heading from assistive technology, using role="presentation",
      // and only use it as a label for the nested group.
      id: headingId,
      role: "presentation"
    } : {},
    groupProps: {
      role: "group",
      "aria-label": ariaLabel,
      "aria-labelledby": heading2 ? headingId : void 0
    }
  };
}
let $8a9cb279dc87e130$export$fda7da73ab5d4c48$3 = false;
let $507fabe10e71c6fb$var$currentModality$1 = null;
let $507fabe10e71c6fb$var$changeHandlers$3 = /* @__PURE__ */ new Set();
let $507fabe10e71c6fb$export$d90243b58daecda7$3 = /* @__PURE__ */ new Map();
let $507fabe10e71c6fb$var$hasEventBeforeFocus$3 = false;
let $507fabe10e71c6fb$var$hasBlurredWindowRecently$3 = false;
function $507fabe10e71c6fb$var$triggerChangeHandlers$3(modality, e2) {
  for (let handler of $507fabe10e71c6fb$var$changeHandlers$3)
    handler(modality, e2);
}
function $507fabe10e71c6fb$var$isValidKey$3(e2) {
  return !(e2.metaKey || !$c87311424ea30a05$export$9ac100e40613ea10$6() && e2.altKey || e2.ctrlKey || e2.key === "Control" || e2.key === "Shift" || e2.key === "Meta");
}
function $507fabe10e71c6fb$var$handleKeyboardEvent$3(e2) {
  $507fabe10e71c6fb$var$hasEventBeforeFocus$3 = true;
  if ($507fabe10e71c6fb$var$isValidKey$3(e2)) {
    $507fabe10e71c6fb$var$currentModality$1 = "keyboard";
    $507fabe10e71c6fb$var$triggerChangeHandlers$3("keyboard", e2);
  }
}
function $507fabe10e71c6fb$var$handlePointerEvent$3(e2) {
  $507fabe10e71c6fb$var$currentModality$1 = "pointer";
  if (e2.type === "mousedown" || e2.type === "pointerdown") {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$3 = true;
    $507fabe10e71c6fb$var$triggerChangeHandlers$3("pointer", e2);
  }
}
function $507fabe10e71c6fb$var$handleClickEvent$3(e2) {
  if ($6a7db85432448f7f$export$60278871457622de$4(e2)) {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$3 = true;
    $507fabe10e71c6fb$var$currentModality$1 = "virtual";
  }
}
function $507fabe10e71c6fb$var$handleFocusEvent$3(e2) {
  if (e2.target === window || e2.target === document || $8a9cb279dc87e130$export$fda7da73ab5d4c48$3 || !e2.isTrusted)
    return;
  if (!$507fabe10e71c6fb$var$hasEventBeforeFocus$3 && !$507fabe10e71c6fb$var$hasBlurredWindowRecently$3) {
    $507fabe10e71c6fb$var$currentModality$1 = "virtual";
    $507fabe10e71c6fb$var$triggerChangeHandlers$3("virtual", e2);
  }
  $507fabe10e71c6fb$var$hasEventBeforeFocus$3 = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently$3 = false;
}
function $507fabe10e71c6fb$var$handleWindowBlur$3() {
  $507fabe10e71c6fb$var$hasEventBeforeFocus$3 = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently$3 = true;
}
function $507fabe10e71c6fb$var$setupGlobalFocusEvents$3(element2) {
  if (typeof window === "undefined" || typeof document === "undefined" || $507fabe10e71c6fb$export$d90243b58daecda7$3.get($431fbd86ca7dc216$export$f21a1ffae260145a$4(element2)))
    return;
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  let focus = windowObject.HTMLElement.prototype.focus;
  windowObject.HTMLElement.prototype.focus = function() {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$3 = true;
    focus.apply(this, arguments);
  };
  documentObject.addEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent$3, true);
  documentObject.addEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent$3, true);
  documentObject.addEventListener("click", $507fabe10e71c6fb$var$handleClickEvent$3, true);
  windowObject.addEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent$3, true);
  windowObject.addEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur$3, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.addEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent$3, true);
    documentObject.addEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent$3, true);
    documentObject.addEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent$3, true);
  }
  windowObject.addEventListener("beforeunload", () => {
    $507fabe10e71c6fb$var$tearDownWindowFocusTracking$3(element2);
  }, {
    once: true
  });
  $507fabe10e71c6fb$export$d90243b58daecda7$3.set(windowObject, {
    focus
  });
}
const $507fabe10e71c6fb$var$tearDownWindowFocusTracking$3 = (element2, loadListener) => {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  if (loadListener)
    documentObject.removeEventListener("DOMContentLoaded", loadListener);
  if (!$507fabe10e71c6fb$export$d90243b58daecda7$3.has(windowObject))
    return;
  windowObject.HTMLElement.prototype.focus = $507fabe10e71c6fb$export$d90243b58daecda7$3.get(windowObject).focus;
  documentObject.removeEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent$3, true);
  documentObject.removeEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent$3, true);
  documentObject.removeEventListener("click", $507fabe10e71c6fb$var$handleClickEvent$3, true);
  windowObject.removeEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent$3, true);
  windowObject.removeEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur$3, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.removeEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent$3, true);
    documentObject.removeEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent$3, true);
    documentObject.removeEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent$3, true);
  }
  $507fabe10e71c6fb$export$d90243b58daecda7$3.delete(windowObject);
};
function $507fabe10e71c6fb$export$2f1888112f558a7d$3(element2) {
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  let loadListener;
  if (documentObject.readyState !== "loading")
    $507fabe10e71c6fb$var$setupGlobalFocusEvents$3(element2);
  else {
    loadListener = () => {
      $507fabe10e71c6fb$var$setupGlobalFocusEvents$3(element2);
    };
    documentObject.addEventListener("DOMContentLoaded", loadListener);
  }
  return () => $507fabe10e71c6fb$var$tearDownWindowFocusTracking$3(element2, loadListener);
}
if (typeof document !== "undefined")
  $507fabe10e71c6fb$export$2f1888112f558a7d$3();
function $507fabe10e71c6fb$export$b9b3dfddab17db27$1() {
  return $507fabe10e71c6fb$var$currentModality$1 !== "pointer";
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$8 = false;
let $6179b936705e76d3$var$hoverCount$8 = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$8() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$8 = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$8 = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$8(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$8();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$8() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$8);
  $6179b936705e76d3$var$hoverCount$8++;
  return () => {
    $6179b936705e76d3$var$hoverCount$8--;
    if ($6179b936705e76d3$var$hoverCount$8 > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$8);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$8(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$8, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$8 && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
const $b5e257d569688ac6$var$defaultContext$7 = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$7 = /* @__PURE__ */ React$5.createContext($b5e257d569688ac6$var$defaultContext$7);
const $b5e257d569688ac6$var$IsSSRContext$7 = /* @__PURE__ */ React$5.createContext(false);
let $b5e257d569688ac6$var$componentIds$7 = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$7(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$7);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$7.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$7.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$7.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$7(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$7);
  let counter = $b5e257d569688ac6$var$useCounter$7(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$7(defaultId) {
  let id2 = React$5.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$7());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$7.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$5["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$7 : $b5e257d569688ac6$var$useLegacySSRSafeId$7;
function $b5e257d569688ac6$var$getSnapshot$7() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$7() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$7(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$7() {
  if (typeof React$5["useSyncExternalStore"] === "function")
    return React$5["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$7, $b5e257d569688ac6$var$getSnapshot$7, $b5e257d569688ac6$var$getServerSnapshot$7);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$7);
}
var MOBILE_SCREEN_WIDTH = 700;
function useIsMobile() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$7();
  if (isSSR || typeof window === "undefined") {
    return false;
  }
  return window.screen.width <= MOBILE_SCREEN_WIDTH;
}
function useMenuItem(originalProps) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, menuItem.variantKeys);
  const {
    as: as2,
    item,
    state,
    shortcut,
    description,
    startContent,
    endContent,
    isVirtualized,
    selectedIcon,
    className,
    classNames: classNames2,
    onAction,
    autoFocus,
    onPress,
    onPressStart,
    onPressUp,
    onPressEnd,
    onPressChange,
    onHoverStart: hoverStartProp,
    onHoverChange,
    onHoverEnd,
    hideSelectedIcon = false,
    isReadOnly = false,
    closeOnSelect,
    onClose,
    onClick,
    ...otherProps
  } = props;
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const domRef = reactExports.useRef(null);
  const Component2 = as2 || ((otherProps == null ? void 0 : otherProps.href) ? "a" : "li");
  const shouldFilterDOMProps = typeof Component2 === "string";
  const { rendered, key } = item;
  const isDisabledProp = state.disabledKeys.has(key) || originalProps.isDisabled;
  const isSelectable = state.selectionManager.selectionMode !== "none";
  const isMobile2 = useIsMobile();
  const { isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus
  });
  const handlePress = reactExports.useCallback(
    (e2) => {
      onClick == null ? void 0 : onClick(e2);
      onPress == null ? void 0 : onPress(e2);
    },
    [onClick, onPress]
  );
  const {
    isPressed,
    isFocused,
    isSelected,
    isDisabled,
    menuItemProps,
    labelProps,
    descriptionProps,
    keyboardShortcutProps
  } = $a2e5df62f93c7633$export$9d32628fc2aea7da(
    {
      key,
      onClose,
      isDisabled: isDisabledProp,
      onPress: handlePress,
      onPressStart,
      onPressUp,
      onPressEnd,
      onPressChange,
      "aria-label": props["aria-label"],
      closeOnSelect,
      isVirtualized,
      onAction
    },
    state,
    domRef
  );
  let { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456$8({
    isDisabled,
    onHoverStart(e2) {
      if (!$507fabe10e71c6fb$export$b9b3dfddab17db27$1()) {
        state.selectionManager.setFocused(true);
        state.selectionManager.setFocusedKey(key);
      }
      hoverStartProp == null ? void 0 : hoverStartProp(e2);
    },
    onHoverChange,
    onHoverEnd
  });
  let itemProps = menuItemProps;
  const slots = reactExports.useMemo(
    () => menuItem({
      ...variantProps2,
      isDisabled,
      disableAnimation,
      hasTitleTextChild: typeof rendered === "string",
      hasDescriptionTextChild: typeof description === "string"
    }),
    [objectToDeps(variantProps2), isDisabled, disableAnimation, rendered, description]
  );
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  if (isReadOnly) {
    itemProps = removeEvents(itemProps);
  }
  const getItemProps = (props2 = {}) => ({
    ref: domRef,
    ...mergeProps$3(
      isReadOnly ? {} : focusProps,
      filterDOMProps(otherProps, {
        enabled: shouldFilterDOMProps
      }),
      itemProps,
      hoverProps,
      props2
    ),
    "data-focus": dataAttr(isFocused),
    "data-selectable": dataAttr(isSelectable),
    "data-hover": dataAttr(isMobile2 ? isHovered || isPressed : isHovered),
    "data-disabled": dataAttr(isDisabled),
    "data-selected": dataAttr(isSelected),
    "data-pressed": dataAttr(isPressed),
    "data-focus-visible": dataAttr(isFocusVisible),
    className: slots.base({ class: clsx$4(baseStyles, props2.className) })
  });
  const getLabelProps = (props2 = {}) => ({
    ...mergeProps$3(labelProps, props2),
    className: slots.title({ class: classNames2 == null ? void 0 : classNames2.title })
  });
  const getDescriptionProps = (props2 = {}) => ({
    ...mergeProps$3(descriptionProps, props2),
    className: slots.description({ class: classNames2 == null ? void 0 : classNames2.description })
  });
  const getKeyboardShortcutProps = (props2 = {}) => ({
    ...mergeProps$3(keyboardShortcutProps, props2),
    className: slots.shortcut({ class: classNames2 == null ? void 0 : classNames2.shortcut })
  });
  const getSelectedIconProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "aria-hidden": dataAttr(true),
        "data-disabled": dataAttr(isDisabled),
        className: slots.selectedIcon({ class: classNames2 == null ? void 0 : classNames2.selectedIcon }),
        ...props2
      };
    },
    [isDisabled, slots, classNames2]
  );
  return {
    Component: Component2,
    domRef,
    slots,
    classNames: classNames2,
    isSelectable,
    isSelected,
    isDisabled,
    rendered,
    shortcut,
    description,
    startContent,
    endContent,
    selectedIcon,
    disableAnimation,
    getItemProps,
    getLabelProps,
    hideSelectedIcon,
    getDescriptionProps,
    getKeyboardShortcutProps,
    getSelectedIconProps
  };
}
var MenuItem$4 = (props) => {
  const {
    Component: Component2,
    slots,
    classNames: classNames2,
    rendered,
    shortcut,
    description,
    isSelectable,
    isSelected,
    isDisabled,
    selectedIcon,
    startContent,
    endContent,
    disableAnimation,
    hideSelectedIcon,
    getItemProps,
    getLabelProps,
    getDescriptionProps,
    getKeyboardShortcutProps,
    getSelectedIconProps
  } = useMenuItem(props);
  const selectedContent = reactExports.useMemo(() => {
    const defaultIcon = /* @__PURE__ */ jsxRuntimeExports.jsx(MenuSelectedIcon, { disableAnimation, isSelected });
    if (typeof selectedIcon === "function") {
      return selectedIcon({ icon: defaultIcon, isSelected, isDisabled });
    }
    if (selectedIcon)
      return selectedIcon;
    return defaultIcon;
  }, [selectedIcon, isSelected, isDisabled, disableAnimation]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getItemProps(), children: [
    startContent,
    description ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }), children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children: rendered }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getDescriptionProps(), children: description })
    ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children: rendered }),
    shortcut && /* @__PURE__ */ jsxRuntimeExports.jsx("kbd", { ...getKeyboardShortcutProps(), children: shortcut }),
    isSelectable && !hideSelectedIcon && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getSelectedIconProps(), children: selectedContent }),
    endContent
  ] });
};
MenuItem$4.displayName = "HeroUI.MenuItem";
var menu_item_default = MenuItem$4;
var MenuSection = forwardRef(
  ({
    item,
    state,
    as: as2,
    variant,
    color: color2,
    disableAnimation,
    onAction,
    closeOnSelect,
    className,
    classNames: classNames2,
    showDivider = false,
    hideSelectedIcon,
    dividerProps = {},
    itemClasses,
    // removed title from props to avoid browsers showing a tooltip on hover
    // the title props is already inside the rendered prop
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    title,
    ...otherProps
  }, _24) => {
    const Component2 = as2 || "li";
    const slots = reactExports.useMemo(() => menuSection(), []);
    const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
    const dividerStyles = clsx$4(classNames2 == null ? void 0 : classNames2.divider, dividerProps == null ? void 0 : dividerProps.className);
    const { itemProps, headingProps, groupProps } = $3e5eb2498db5b506$export$73f7a44322579622({
      heading: item.rendered,
      "aria-label": item["aria-label"]
    });
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Component2,
      {
        "data-slot": "base",
        ...mergeProps$3(itemProps, otherProps),
        className: slots.base({ class: baseStyles }),
        children: [
          item.rendered && /* @__PURE__ */ jsxRuntimeExports.jsx(
            "span",
            {
              ...headingProps,
              className: slots.heading({ class: classNames2 == null ? void 0 : classNames2.heading }),
              "data-slot": "heading",
              children: item.rendered
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            "ul",
            {
              ...groupProps,
              className: slots.group({ class: classNames2 == null ? void 0 : classNames2.group }),
              "data-has-title": !!item.rendered,
              "data-slot": "group",
              children: [
                [...item.childNodes].map((node2) => {
                  const { key: nodeKey, props: nodeProps } = node2;
                  let menuItem2 = /* @__PURE__ */ jsxRuntimeExports.jsx(
                    menu_item_default,
                    {
                      classNames: itemClasses,
                      closeOnSelect,
                      color: color2,
                      disableAnimation,
                      hideSelectedIcon,
                      item: node2,
                      state,
                      variant,
                      onAction,
                      ...nodeProps
                    },
                    nodeKey
                  );
                  if (node2.wrapper) {
                    menuItem2 = node2.wrapper(menuItem2);
                  }
                  return menuItem2;
                }),
                showDivider && /* @__PURE__ */ jsxRuntimeExports.jsx(
                  divider_default,
                  {
                    as: "li",
                    className: slots.divider({
                      class: dividerStyles
                    }),
                    ...dividerProps
                  }
                )
              ]
            }
          )
        ]
      }
    );
  }
);
MenuSection.displayName = "HeroUI.MenuSection";
var menu_section_default = MenuSection;
function useMenu(props) {
  var _a2;
  const globalContext = useProviderContext();
  const {
    as: as2,
    ref,
    variant,
    color: color2,
    children,
    disableAnimation = (_a2 = globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _a2 : false,
    onAction,
    closeOnSelect,
    itemClasses,
    className,
    state: propState,
    topContent,
    bottomContent,
    hideEmptyContent = false,
    hideSelectedIcon = false,
    emptyContent = "No items.",
    menuProps: userMenuProps,
    onClose,
    classNames: classNames2,
    ...otherProps
  } = props;
  const Component2 = as2 || "ul";
  const domRef = useDOMRef(ref);
  const shouldFilterDOMProps = typeof Component2 === "string";
  const innerState = $875d6693e12af071$export$728d6ba534403756({ ...otherProps, ...userMenuProps, children });
  const state = propState || innerState;
  const { menuProps } = $d5336fe17ce95402$export$38eaa17faae8f579({ ...otherProps, ...userMenuProps, onAction }, state, domRef);
  const slots = reactExports.useMemo(() => menu$1({ className }), [className]);
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const getBaseProps = (props2 = {}) => {
    return {
      ref: domRef,
      "data-slot": "base",
      className: slots.base({ class: baseStyles }),
      ...filterDOMProps(otherProps, {
        enabled: shouldFilterDOMProps
      }),
      ...props2
    };
  };
  const getListProps = (props2 = {}) => {
    return {
      "data-slot": "list",
      className: slots.list({ class: classNames2 == null ? void 0 : classNames2.list }),
      ...menuProps,
      ...props2
    };
  };
  const getEmptyContentProps = (props2 = {}) => {
    return {
      children: emptyContent,
      className: slots.emptyContent({ class: classNames2 == null ? void 0 : classNames2.emptyContent }),
      ...props2
    };
  };
  return {
    Component: Component2,
    state,
    variant,
    color: color2,
    disableAnimation,
    onClose,
    topContent,
    bottomContent,
    closeOnSelect,
    className,
    itemClasses,
    getBaseProps,
    getListProps,
    hideEmptyContent,
    hideSelectedIcon,
    getEmptyContentProps
  };
}
var Menu$2 = forwardRef(function Menu2(props, ref) {
  const {
    Component: Component2,
    state,
    closeOnSelect,
    color: color2,
    disableAnimation,
    hideSelectedIcon,
    hideEmptyContent,
    variant,
    onClose,
    topContent,
    bottomContent,
    itemClasses,
    getBaseProps,
    getListProps,
    getEmptyContentProps
  } = useMenu({ ...props, ref });
  const content2 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getListProps(), children: [
    !state.collection.size && !hideEmptyContent && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getEmptyContentProps() }) }),
    [...state.collection].map((item) => {
      const itemProps = {
        closeOnSelect,
        color: color2,
        disableAnimation,
        item,
        state,
        variant,
        onClose,
        hideSelectedIcon,
        ...item.props
      };
      const mergedItemClasses = mergeClasses$2(itemClasses, itemProps == null ? void 0 : itemProps.classNames);
      if (item.type === "section") {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(menu_section_default, { ...itemProps, itemClasses: mergedItemClasses }, item.key);
      }
      let menuItem2 = /* @__PURE__ */ jsxRuntimeExports.jsx(menu_item_default, { ...itemProps, classNames: mergedItemClasses }, item.key);
      if (item.wrapper) {
        menuItem2 = item.wrapper(menuItem2);
      }
      return menuItem2;
    })
  ] });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getBaseProps(), children: [
    topContent,
    content2,
    bottomContent
  ] });
});
var menu_default = Menu$2;
var MenuItemBase = $c1d7fb2ec91bae71$export$6d08773d2e66f8f2;
var menu_item_base_default = MenuItemBase;
var DropdownMenu = forwardRef(function DropdownMenu2(props, ref) {
  const { getMenuProps } = useDropdownContext();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(popover_content_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx($9bf71ea28793e738$export$20e40289641fbbb6, { contain: true, restoreFocus: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(menu_default, { ...getMenuProps(props, ref) }) }) });
});
var dropdown_menu_default = DropdownMenu;
var DropdownTrigger = (props) => {
  const { getMenuTriggerProps } = useDropdownContext();
  const { children, ...otherProps } = props;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(popover_trigger_default, { ...getMenuTriggerProps(otherProps), children });
};
DropdownTrigger.displayName = "HeroUI.DropdownTrigger";
var dropdown_trigger_default = DropdownTrigger;
function $a28c903ee9ad8dc5$export$79fefeb1c2091ac3$1(props) {
  let overlayTriggerState = $fc909762b330b746$export$61c6a8c84e605fb6$2(props);
  let [focusStrategy, setFocusStrategy] = reactExports.useState(null);
  let [expandedKeysStack, setExpandedKeysStack] = reactExports.useState([]);
  let closeAll = () => {
    setExpandedKeysStack([]);
    overlayTriggerState.close();
  };
  let openSubmenu = (triggerKey, level) => {
    setExpandedKeysStack((oldStack) => {
      if (level > oldStack.length)
        return oldStack;
      return [
        ...oldStack.slice(0, level),
        triggerKey
      ];
    });
  };
  let closeSubmenu = (triggerKey, level) => {
    setExpandedKeysStack((oldStack) => {
      let key = oldStack[level];
      if (key === triggerKey)
        return oldStack.slice(0, level);
      else
        return oldStack;
    });
  };
  return {
    focusStrategy,
    ...overlayTriggerState,
    open(focusStrategy2 = null) {
      setFocusStrategy(focusStrategy2);
      overlayTriggerState.open();
    },
    toggle(focusStrategy2 = null) {
      setFocusStrategy(focusStrategy2);
      overlayTriggerState.toggle();
    },
    close() {
      closeAll();
    },
    expandedKeysStack,
    openSubmenu,
    closeSubmenu
  };
}
var getMenuItem = (props, key) => {
  if (props) {
    const mergedChildren = Array.isArray(props.children) ? props.children : [...(props == null ? void 0 : props.items) || []];
    if (mergedChildren && mergedChildren.length) {
      const item = mergedChildren.find((item2) => {
        if (item2 && item2.key === key) {
          return item2;
        }
      }) || {};
      return item;
    }
  }
  return null;
};
var getCloseOnSelect = (props, key, item) => {
  const mergedItem = item || getMenuItem(props, key);
  if (mergedItem && mergedItem.props && "closeOnSelect" in mergedItem.props) {
    return mergedItem.props.closeOnSelect;
  }
  return props == null ? void 0 : props.closeOnSelect;
};
function useDropdown(props) {
  var _a2;
  const globalContext = useProviderContext();
  const {
    as: as2,
    triggerRef: triggerRefProp,
    isOpen,
    defaultOpen,
    onOpenChange,
    isDisabled,
    type: type4 = "menu",
    trigger = "press",
    placement = "bottom",
    closeOnSelect = true,
    shouldBlockScroll = true,
    classNames: classNamesProp,
    disableAnimation = (_a2 = globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _a2 : false,
    onClose,
    className,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const triggerRef = reactExports.useRef(null);
  const menuTriggerRef = triggerRefProp || triggerRef;
  const menuRef = reactExports.useRef(null);
  const popoverRef = reactExports.useRef(null);
  const state = $a28c903ee9ad8dc5$export$79fefeb1c2091ac3$1({
    trigger,
    isOpen,
    defaultOpen,
    onOpenChange: (isOpen2) => {
      onOpenChange == null ? void 0 : onOpenChange(isOpen2);
      if (!isOpen2) {
        onClose == null ? void 0 : onClose();
      }
    }
  });
  const { menuTriggerProps, menuProps } = $168583247155ddda$export$dc9c12ed27dd1b49$1(
    { type: type4, trigger, isDisabled },
    state,
    menuTriggerRef
  );
  const styles2 = reactExports.useMemo(
    () => dropdown({
      className
    }),
    [className]
  );
  const onMenuAction = (menuCloseOnSelect) => {
    if (menuCloseOnSelect !== void 0 && !menuCloseOnSelect) {
      return;
    }
    if (closeOnSelect) {
      state.close();
    }
  };
  const getPopoverProps = (props2 = {}) => {
    const popoverProps = mergeProps$3(otherProps, props2);
    return {
      state,
      placement,
      ref: popoverRef,
      disableAnimation,
      shouldBlockScroll,
      scrollRef: menuRef,
      triggerRef: menuTriggerRef,
      ...popoverProps,
      classNames: {
        ...classNamesProp,
        ...props2.classNames,
        content: clsx$4(styles2, classNamesProp == null ? void 0 : classNamesProp.content, props2.className)
      }
    };
  };
  const getMenuTriggerProps = (originalProps = {}) => {
    const { onPress, onPressStart, ...otherMenuTriggerProps } = menuTriggerProps;
    return mergeProps$3(otherMenuTriggerProps, { isDisabled }, originalProps);
  };
  const getMenuProps = (props2, _ref = null) => {
    return {
      ref: mergeRefs(_ref, menuRef),
      menuProps,
      closeOnSelect,
      ...mergeProps$3(props2, {
        onAction: (key, item) => {
          const closeOnSelect2 = getCloseOnSelect(props2, key, item);
          onMenuAction(closeOnSelect2);
        },
        onClose: state.close
      })
    };
  };
  return {
    Component: Component2,
    menuRef,
    menuProps,
    closeOnSelect,
    onClose: state.close,
    autoFocus: state.focusStrategy || true,
    disableAnimation,
    getPopoverProps,
    getMenuProps,
    getMenuTriggerProps
  };
}
var Dropdown = (props) => {
  const { children, ...otherProps } = props;
  const context = useDropdown(otherProps);
  const [menuTrigger, menu2] = React$5.Children.toArray(children);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownProvider, { value: context, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(popover_default, { ...context.getPopoverProps(), children: [
    menuTrigger,
    menu2
  ] }) });
};
Dropdown.displayName = "HeroUI.Dropdown";
var dropdown_default = Dropdown;
function useImage$1(originalProps) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, image$1.variantKeys);
  const {
    ref,
    as: as2,
    src,
    className,
    classNames: classNames2,
    loading,
    isBlurred,
    fallbackSrc,
    isLoading: isLoadingProp,
    disableSkeleton = !!fallbackSrc,
    removeWrapper = false,
    onError,
    onLoad,
    srcSet,
    sizes,
    crossOrigin,
    ...otherProps
  } = props;
  const imageStatus = useImage$2({
    src,
    loading,
    onError,
    onLoad,
    ignoreFallback: false,
    srcSet,
    sizes,
    crossOrigin,
    shouldBypassImageLoad: as2 !== void 0
  });
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const isImgLoaded = imageStatus === "loaded" && !isLoadingProp;
  const isLoading = imageStatus === "loading" || isLoadingProp;
  const isZoomed = originalProps.isZoomed;
  const Component2 = as2 || "img";
  const domRef = useDOMRef(ref);
  const { w: w2, h: h3 } = reactExports.useMemo(() => {
    return {
      w: props.width ? typeof props.width === "number" ? `${props.width}px` : props.width : "fit-content",
      h: props.height ? typeof props.height === "number" ? `${props.height}px` : props.height : "auto"
    };
  }, [props == null ? void 0 : props.width, props == null ? void 0 : props.height]);
  const showFallback = (!src || !isImgLoaded) && !!fallbackSrc;
  const showSkeleton = isLoading && !disableSkeleton;
  const slots = reactExports.useMemo(
    () => image$1({
      ...variantProps2,
      disableAnimation,
      showSkeleton
    }),
    [objectToDeps(variantProps2), disableAnimation, showSkeleton]
  );
  const baseStyles = clsx$4(className, classNames2 == null ? void 0 : classNames2.img);
  const getImgProps = (props2 = {}) => {
    const imgStyles = clsx$4(baseStyles, props2 == null ? void 0 : props2.className);
    return {
      src,
      ref: domRef,
      "data-loaded": dataAttr(isImgLoaded),
      className: slots.img({ class: imgStyles }),
      loading,
      srcSet,
      sizes,
      crossOrigin,
      ...otherProps,
      style: {
        // img has `height: auto` by default
        // passing the custom height here to override if it is specified
        ...(otherProps == null ? void 0 : otherProps.height) && { height: h3 },
        ...props2.style,
        ...otherProps.style
      }
    };
  };
  const getWrapperProps = reactExports.useCallback(() => {
    const fallbackStyle = showFallback ? {
      backgroundImage: `url(${fallbackSrc})`
    } : {};
    return {
      className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }),
      style: {
        ...fallbackStyle,
        maxWidth: w2
      }
    };
  }, [slots, showFallback, fallbackSrc, classNames2 == null ? void 0 : classNames2.wrapper, w2]);
  const getBlurredImgProps = reactExports.useCallback(() => {
    return {
      src,
      "aria-hidden": dataAttr(true),
      className: slots.blurredImg({ class: classNames2 == null ? void 0 : classNames2.blurredImg })
    };
  }, [slots, src, classNames2 == null ? void 0 : classNames2.blurredImg]);
  return {
    Component: Component2,
    domRef,
    slots,
    classNames: classNames2,
    isBlurred,
    disableSkeleton,
    fallbackSrc,
    removeWrapper,
    isZoomed,
    isLoading,
    getImgProps,
    getWrapperProps,
    getBlurredImgProps
  };
}
var Image$2 = forwardRef((props, ref) => {
  const {
    Component: Component2,
    domRef,
    slots,
    classNames: classNames2,
    isBlurred,
    isZoomed,
    fallbackSrc,
    removeWrapper,
    disableSkeleton,
    getImgProps,
    getWrapperProps,
    getBlurredImgProps
  } = useImage$1({
    ...props,
    ref
  });
  const img = /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ref: domRef, ...getImgProps() });
  if (removeWrapper) {
    return img;
  }
  const zoomed = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: slots.zoomedWrapper({ class: classNames2 == null ? void 0 : classNames2.zoomedWrapper }), children: img });
  if (isBlurred) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getWrapperProps(), children: [
      isZoomed ? zoomed : img,
      reactExports.cloneElement(img, getBlurredImgProps())
    ] });
  }
  if (isZoomed || !disableSkeleton || fallbackSrc) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getWrapperProps(), children: [
      " ",
      isZoomed ? zoomed : img
    ] });
  }
  return img;
});
Image$2.displayName = "HeroUI.Image";
var image_default = Image$2;
var [ModalProvider, useModalContext] = createContext2({
  name: "ModalContext",
  errorMessage: "useModalContext: `context` is undefined. Seems you forgot to wrap all popover components within `<Modal />`"
});
var ModalBody = forwardRef((props, ref) => {
  const { as: as2, children, className, ...otherProps } = props;
  const { slots, classNames: classNames2, bodyId, setBodyMounted } = useModalContext();
  const domRef = useDOMRef(ref);
  const Component2 = as2 || "div";
  reactExports.useEffect(() => {
    setBodyMounted(true);
    return () => setBodyMounted(false);
  }, [setBodyMounted]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Component2,
    {
      ref: domRef,
      className: slots.body({ class: clsx$4(classNames2 == null ? void 0 : classNames2.body, className) }),
      id: bodyId,
      ...otherProps,
      children
    }
  );
});
ModalBody.displayName = "HeroUI.ModalBody";
var modal_body_default = ModalBody;
var scaleInOut = {
  enter: {
    scale: "var(--scale-enter)",
    y: "var(--slide-enter)",
    opacity: 1,
    willChange: "auto",
    transition: {
      scale: {
        duration: 0.4,
        ease: TRANSITION_EASINGS.ease
      },
      opacity: {
        duration: 0.4,
        ease: TRANSITION_EASINGS.ease
      },
      y: {
        type: "spring",
        bounce: 0,
        duration: 0.6
      }
    }
  },
  exit: {
    scale: "var(--scale-exit)",
    y: "var(--slide-exit)",
    opacity: 0,
    willChange: "transform",
    transition: {
      duration: 0.3,
      ease: TRANSITION_EASINGS.ease
    }
  }
};
var visualViewport = typeof document !== "undefined" && window.visualViewport;
var IsSSRContext = React$5.createContext(false);
function getSnapshot() {
  return false;
}
function getServerSnapshot() {
  return true;
}
function subscribe(onStoreChange) {
  return () => {
  };
}
function useIsSSR() {
  if (typeof React$5["useSyncExternalStore"] === "function") {
    return React$5["useSyncExternalStore"](subscribe, getSnapshot, getServerSnapshot);
  }
  return reactExports.useContext(IsSSRContext);
}
function useViewportSize() {
  let isSSR = useIsSSR();
  let [size2, setSize] = reactExports.useState(() => isSSR ? { width: 0, height: 0 } : getViewportSize());
  reactExports.useEffect(() => {
    let onResize4 = () => {
      setSize((size22) => {
        let newSize = getViewportSize();
        if (newSize.width === size22.width && newSize.height === size22.height) {
          return size22;
        }
        return newSize;
      });
    };
    if (!visualViewport) {
      window.addEventListener("resize", onResize4);
    } else {
      visualViewport.addEventListener("resize", onResize4);
    }
    return () => {
      if (!visualViewport) {
        window.removeEventListener("resize", onResize4);
      } else {
        visualViewport.removeEventListener("resize", onResize4);
      }
    };
  }, []);
  return size2;
}
function getViewportSize() {
  return {
    width: visualViewport && (visualViewport == null ? void 0 : visualViewport.width) || window.innerWidth,
    height: visualViewport && (visualViewport == null ? void 0 : visualViewport.height) || window.innerHeight
  };
}
var domAnimation$2 = () => __vitePreload(() => import("./index-kYRJvtWR.js"), true ? __vite__mapDeps([]) : void 0).then((res) => res.default);
var ModalContent$1 = (props) => {
  const { as: as2, children, role = "dialog", ...otherProps } = props;
  const {
    Component: DialogComponent,
    domRef,
    slots,
    classNames: classNames2,
    motionProps,
    backdrop,
    closeButton,
    hideCloseButton,
    disableAnimation,
    getDialogProps,
    getBackdropProps,
    getCloseButtonProps,
    onClose
  } = useModalContext();
  const Component2 = as2 || DialogComponent || "div";
  const viewport = useViewportSize();
  const { dialogProps } = $40df3f8667284809$export$d55e7ee900f34e93(
    {
      role
    },
    domRef
  );
  const closeButtonContent = reactExports.isValidElement(closeButton) ? reactExports.cloneElement(closeButton, getCloseButtonProps()) : /* @__PURE__ */ jsxRuntimeExports.jsx("button", { ...getCloseButtonProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(CloseIcon, {}) });
  const onKeyDown = reactExports.useCallback((e2) => {
    if (e2.key === "Tab" && e2.nativeEvent.isComposing) {
      e2.stopPropagation();
      e2.preventDefault();
    }
  }, []);
  const contentProps = getDialogProps(mergeProps$3(dialogProps, otherProps));
  const content2 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...contentProps, onKeyDown: chain(contentProps.onKeyDown, onKeyDown), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx($86ea4cb521eb2e37$export$2317d149ed6f78c4, { onDismiss: onClose }),
    !hideCloseButton && closeButtonContent,
    typeof children === "function" ? children(onClose) : children,
    /* @__PURE__ */ jsxRuntimeExports.jsx($86ea4cb521eb2e37$export$2317d149ed6f78c4, { onDismiss: onClose })
  ] });
  const backdropContent = reactExports.useMemo(() => {
    if (backdrop === "transparent") {
      return null;
    }
    if (disableAnimation) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getBackdropProps() });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      m$3.div,
      {
        animate: "enter",
        exit: "exit",
        initial: "exit",
        variants: TRANSITION_VARIANTS.fade,
        ...getBackdropProps()
      }
    ) });
  }, [backdrop, disableAnimation, getBackdropProps]);
  const viewportStyle = {
    "--visual-viewport-height": viewport.height + "px"
  };
  const contents = disableAnimation ? /* @__PURE__ */ jsxRuntimeExports.jsx(
    "div",
    {
      className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }),
      "data-slot": "wrapper",
      style: viewportStyle,
      children: content2
    }
  ) : /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    m$3.div,
    {
      animate: "enter",
      className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }),
      "data-slot": "wrapper",
      exit: "exit",
      initial: "exit",
      variants: scaleInOut,
      ...motionProps,
      style: viewportStyle,
      children: content2
    }
  ) });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { tabIndex: -1, children: [
    backdropContent,
    contents
  ] });
};
ModalContent$1.displayName = "HeroUI.ModalContent";
var modal_content_default = ModalContent$1;
var ModalFooter = forwardRef((props, ref) => {
  const { as: as2, children, className, ...otherProps } = props;
  const { slots, classNames: classNames2 } = useModalContext();
  const domRef = useDOMRef(ref);
  const Component2 = as2 || "footer";
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Component2,
    {
      ref: domRef,
      className: slots.footer({ class: clsx$4(classNames2 == null ? void 0 : classNames2.footer, className) }),
      ...otherProps,
      children
    }
  );
});
ModalFooter.displayName = "HeroUI.ModalFooter";
var modal_footer_default = ModalFooter;
var ModalHeader = forwardRef((props, ref) => {
  const { as: as2, children, className, ...otherProps } = props;
  const { slots, classNames: classNames2, headerId, setHeaderMounted } = useModalContext();
  const domRef = useDOMRef(ref);
  const Component2 = as2 || "header";
  reactExports.useEffect(() => {
    setHeaderMounted(true);
    return () => setHeaderMounted(false);
  }, [setHeaderMounted]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Component2,
    {
      ref: domRef,
      className: slots.header({ class: clsx$4(classNames2 == null ? void 0 : classNames2.header, className) }),
      id: headerId,
      ...otherProps,
      children
    }
  );
});
ModalHeader.displayName = "HeroUI.ModalHeader";
var modal_header_default = ModalHeader;
let $bdb11010cef70236$export$d41a04c74483c6ef$3 = /* @__PURE__ */ new Map();
if (typeof FinalizationRegistry !== "undefined")
  new FinalizationRegistry((heldValue) => {
    $bdb11010cef70236$export$d41a04c74483c6ef$3.delete(heldValue);
  });
function $bdb11010cef70236$export$cd8c9cb68f842629$3(idA, idB) {
  if (idA === idB)
    return idA;
  let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef$3.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef$3.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function $ff5963eb1fccf552$export$e08e3b67e392101e$3(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks)
      if (typeof callback2 === "function")
        callback2(...args);
  };
}
function $3ef42575df84b30b$export$9d1611c77c2fe928$3(...args) {
  let result = {
    ...args[0]
  };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90)
        result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e$3(a2, b2);
      else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string")
        result[key] = clsx$3(a2, b2);
      else if (key === "id" && a2 && b2)
        result.id = $bdb11010cef70236$export$cd8c9cb68f842629$3(a2, b2);
      else
        result[key] = b2 !== void 0 ? b2 : a2;
    }
  }
  return result;
}
function useAriaModalOverlay(props = {
  shouldBlockScroll: true
}, state, ref) {
  let { overlayProps, underlayProps } = useAriaOverlay(
    {
      ...props,
      isOpen: state.isOpen,
      onClose: state.close
    },
    ref
  );
  $49c51c25361d4cd2$export$ee0f7cc6afcd1c18({
    isDisabled: !state.isOpen || !props.shouldBlockScroll
  });
  $337b884510726a0d$export$14c98a7594375490$1();
  reactExports.useEffect(() => {
    if (state.isOpen && ref.current) {
      return $5e3802645cc19319$export$1c3ebcada18427bf$1([ref.current]);
    }
  }, [state.isOpen, ref]);
  return {
    modalProps: $3ef42575df84b30b$export$9d1611c77c2fe928$3(overlayProps),
    underlayProps
  };
}
function $fc909762b330b746$export$61c6a8c84e605fb6(props) {
  let [isOpen, setOpen] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.isOpen, props.defaultOpen || false, props.onOpenChange);
  const open = reactExports.useCallback(() => {
    setOpen(true);
  }, [
    setOpen
  ]);
  const close = reactExports.useCallback(() => {
    setOpen(false);
  }, [
    setOpen
  ]);
  const toggle2 = reactExports.useCallback(() => {
    setOpen(!isOpen);
  }, [
    setOpen,
    isOpen
  ]);
  return {
    isOpen,
    setOpen,
    open,
    close,
    toggle: toggle2
  };
}
function useModal(originalProps) {
  var _a2, _b2, _c2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, modal.variantKeys);
  const {
    ref,
    as: as2,
    className,
    classNames: classNames2,
    isOpen,
    defaultOpen,
    onOpenChange,
    motionProps,
    closeButton,
    isDismissable = true,
    hideCloseButton = false,
    shouldBlockScroll = true,
    portalContainer,
    isKeyboardDismissDisabled = false,
    onClose,
    ...otherProps
  } = props;
  const Component2 = as2 || "section";
  const domRef = useDOMRef(ref);
  const closeButtonRef = reactExports.useRef(null);
  const [headerMounted, setHeaderMounted] = reactExports.useState(false);
  const [bodyMounted, setBodyMounted] = reactExports.useState(false);
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const dialogId = reactExports.useId();
  const headerId = reactExports.useId();
  const bodyId = reactExports.useId();
  const state = $fc909762b330b746$export$61c6a8c84e605fb6({
    isOpen,
    defaultOpen,
    onOpenChange: (isOpen2) => {
      onOpenChange == null ? void 0 : onOpenChange(isOpen2);
      if (!isOpen2) {
        onClose == null ? void 0 : onClose();
      }
    }
  });
  const { modalProps, underlayProps } = useAriaModalOverlay(
    {
      isDismissable,
      shouldBlockScroll,
      isKeyboardDismissDisabled
    },
    state,
    domRef
  );
  const { buttonProps: closeButtonProps } = useAriaButton$1({ onPress: state.close }, closeButtonRef);
  const { isFocusVisible: isCloseButtonFocusVisible, focusProps: closeButtonFocusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const slots = reactExports.useMemo(
    () => modal({
      ...variantProps2,
      disableAnimation
    }),
    [objectToDeps(variantProps2), disableAnimation]
  );
  const getDialogProps = (props2 = {}, ref2 = null) => {
    var _a22;
    return {
      ref: mergeRefs$1(ref2, domRef),
      ...mergeProps$3(modalProps, otherProps, props2),
      className: slots.base({ class: clsx$4(baseStyles, props2.className) }),
      id: dialogId,
      "data-open": dataAttr(state.isOpen),
      "data-dismissable": dataAttr(isDismissable),
      "aria-modal": dataAttr(true),
      "data-placement": (_a22 = originalProps == null ? void 0 : originalProps.placement) != null ? _a22 : "right",
      "aria-labelledby": headerMounted ? headerId : void 0,
      "aria-describedby": bodyMounted ? bodyId : void 0
    };
  };
  const getBackdropProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: slots.backdrop({ class: classNames2 == null ? void 0 : classNames2.backdrop }),
      ...underlayProps,
      ...props2
    }),
    [slots, classNames2, underlayProps]
  );
  const getCloseButtonProps = () => {
    return {
      role: "button",
      tabIndex: 0,
      "aria-label": "Close",
      "data-focus-visible": dataAttr(isCloseButtonFocusVisible),
      className: slots.closeButton({ class: classNames2 == null ? void 0 : classNames2.closeButton }),
      ...mergeProps$3(closeButtonProps, closeButtonFocusProps)
    };
  };
  return {
    Component: Component2,
    slots,
    domRef,
    headerId,
    bodyId,
    motionProps,
    classNames: classNames2,
    isDismissable,
    closeButton,
    hideCloseButton,
    portalContainer,
    shouldBlockScroll,
    backdrop: (_c2 = originalProps.backdrop) != null ? _c2 : "opaque",
    isOpen: state.isOpen,
    onClose: state.close,
    disableAnimation,
    setBodyMounted,
    setHeaderMounted,
    getDialogProps,
    getBackdropProps,
    getCloseButtonProps
  };
}
var Modal$1 = forwardRef((props, ref) => {
  const { children, ...otherProps } = props;
  const context = useModal({ ...otherProps, ref });
  const overlay = /* @__PURE__ */ jsxRuntimeExports.jsx($337b884510726a0d$export$c6fdb837b070b4ff, { portalContainer: context.portalContainer, children });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ModalProvider, { value: context, children: context.disableAnimation && context.isOpen ? overlay : /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { children: context.isOpen ? overlay : null }) });
});
Modal$1.displayName = "HeroUI.Modal";
var modal_default = Modal$1;
const $2140fb2337097f2d$export$552312adfd451dab = /* @__PURE__ */ new WeakMap();
function $2140fb2337097f2d$var$normalizeKey(key) {
  if (typeof key === "string")
    return key.replace(/\s*/g, "");
  return "" + key;
}
function $2140fb2337097f2d$export$37cd4213f2ad742e(state, columnKey) {
  let gridId = $2140fb2337097f2d$export$552312adfd451dab.get(state);
  if (!gridId)
    throw new Error("Unknown grid");
  return `${gridId}-${$2140fb2337097f2d$var$normalizeKey(columnKey)}`;
}
function $2140fb2337097f2d$export$19baff3266315d44(state, rowKey, columnKey) {
  let gridId = $2140fb2337097f2d$export$552312adfd451dab.get(state);
  if (!gridId)
    throw new Error("Unknown grid");
  return `${gridId}-${$2140fb2337097f2d$var$normalizeKey(rowKey)}-${$2140fb2337097f2d$var$normalizeKey(columnKey)}`;
}
function $2140fb2337097f2d$export$85069b70317f543(state, rowKey) {
  return [
    ...state.collection.rowHeaderColumnKeys
  ].map((columnKey) => $2140fb2337097f2d$export$19baff3266315d44(state, rowKey, columnKey)).join(" ");
}
var $ce3de3ff2fd66848$exports = {};
$ce3de3ff2fd66848$exports = {
  "ascending": `تصاعدي`,
  "ascendingSort": (args) => `ترتيب حسب العمود ${args.columnName} بترتيب تصاعدي`,
  "columnSize": (args) => `${args.value} بالبكسل`,
  "descending": `تنازلي`,
  "descendingSort": (args) => `ترتيب حسب العمود ${args.columnName} بترتيب تنازلي`,
  "resizerDescription": `اضغط على مفتاح Enter لبدء تغيير الحجم`,
  "select": `تحديد`,
  "selectAll": `تحديد الكل`,
  "sortable": `عمود قابل للترتيب`
};
var $cb80dcce530985b9$exports = {};
$cb80dcce530985b9$exports = {
  "ascending": `възходящ`,
  "ascendingSort": (args) => `сортирано по колона ${args.columnName} във възходящ ред`,
  "columnSize": (args) => `${args.value} пиксела`,
  "descending": `низходящ`,
  "descendingSort": (args) => `сортирано по колона ${args.columnName} в низходящ ред`,
  "resizerDescription": `Натиснете „Enter“, за да започнете да преоразмерявате`,
  "select": `Изберете`,
  "selectAll": `Изберете всичко`,
  "sortable": `сортираща колона`
};
var $68ac86749db4c0fb$exports = {};
$68ac86749db4c0fb$exports = {
  "ascending": `vzestupně`,
  "ascendingSort": (args) => `řazeno vzestupně podle sloupce ${args.columnName}`,
  "columnSize": (args) => `${args.value} pixelů`,
  "descending": `sestupně`,
  "descendingSort": (args) => `řazeno sestupně podle sloupce ${args.columnName}`,
  "resizerDescription": `Stisknutím klávesy Enter začnete měnit velikost`,
  "select": `Vybrat`,
  "selectAll": `Vybrat vše`,
  "sortable": `sloupec s možností řazení`
};
var $9a6cbac08487e661$exports = {};
$9a6cbac08487e661$exports = {
  "ascending": `stigende`,
  "ascendingSort": (args) => `sorteret efter kolonne ${args.columnName} i stigende rækkefølge`,
  "columnSize": (args) => `${args.value} pixels`,
  "descending": `faldende`,
  "descendingSort": (args) => `sorteret efter kolonne ${args.columnName} i faldende rækkefølge`,
  "resizerDescription": `Tryk på Enter for at ændre størrelse`,
  "select": `Vælg`,
  "selectAll": `Vælg alle`,
  "sortable": `sorterbar kolonne`
};
var $c963661d89486e72$exports = {};
$c963661d89486e72$exports = {
  "ascending": `aufsteigend`,
  "ascendingSort": (args) => `sortiert nach Spalte ${args.columnName} in aufsteigender Reihenfolge`,
  "columnSize": (args) => `${args.value} Pixel`,
  "descending": `absteigend`,
  "descendingSort": (args) => `sortiert nach Spalte ${args.columnName} in absteigender Reihenfolge`,
  "resizerDescription": `Eingabetaste zum Starten der Größenänderung drücken`,
  "select": `Auswählen`,
  "selectAll": `Alles auswählen`,
  "sortable": `sortierbare Spalte`
};
var $ac03861c6e8605f4$exports = {};
$ac03861c6e8605f4$exports = {
  "ascending": `αύξουσα`,
  "ascendingSort": (args) => `διαλογή ανά στήλη ${args.columnName} σε αύξουσα σειρά`,
  "columnSize": (args) => `${args.value} pixel`,
  "descending": `φθίνουσα`,
  "descendingSort": (args) => `διαλογή ανά στήλη ${args.columnName} σε φθίνουσα σειρά`,
  "resizerDescription": `Πατήστε Enter για έναρξη της αλλαγής μεγέθους`,
  "select": `Επιλογή`,
  "selectAll": `Επιλογή όλων`,
  "sortable": `Στήλη διαλογής`
};
var $09e6b82e0d6e466a$exports = {};
$09e6b82e0d6e466a$exports = {
  "select": `Select`,
  "selectAll": `Select All`,
  "sortable": `sortable column`,
  "ascending": `ascending`,
  "descending": `descending`,
  "ascendingSort": (args) => `sorted by column ${args.columnName} in ascending order`,
  "descendingSort": (args) => `sorted by column ${args.columnName} in descending order`,
  "columnSize": (args) => `${args.value} pixels`,
  "resizerDescription": `Press Enter to start resizing`
};
var $8cc39eb66c2bf220$exports = {};
$8cc39eb66c2bf220$exports = {
  "ascending": `ascendente`,
  "ascendingSort": (args) => `ordenado por columna ${args.columnName} en sentido ascendente`,
  "columnSize": (args) => `${args.value} píxeles`,
  "descending": `descendente`,
  "descendingSort": (args) => `ordenado por columna ${args.columnName} en orden descendente`,
  "resizerDescription": `Pulse Intro para empezar a redimensionar`,
  "select": `Seleccionar`,
  "selectAll": `Seleccionar todos`,
  "sortable": `columna ordenable`
};
var $4e11db3c25a38112$exports = {};
$4e11db3c25a38112$exports = {
  "ascending": `tõusev järjestus`,
  "ascendingSort": (args) => `sorditud veeru järgi ${args.columnName} tõusvas järjestuses`,
  "columnSize": (args) => `${args.value} pikslit`,
  "descending": `laskuv järjestus`,
  "descendingSort": (args) => `sorditud veeru järgi ${args.columnName} laskuvas järjestuses`,
  "resizerDescription": `Suuruse muutmise alustamiseks vajutage klahvi Enter`,
  "select": `Vali`,
  "selectAll": `Vali kõik`,
  "sortable": `sorditav veerg`
};
var $da1e751a92575e02$exports = {};
$da1e751a92575e02$exports = {
  "ascending": `nouseva`,
  "ascendingSort": (args) => `lajiteltu sarakkeen ${args.columnName} mukaan nousevassa järjestyksessä`,
  "columnSize": (args) => `${args.value} pikseliä`,
  "descending": `laskeva`,
  "descendingSort": (args) => `lajiteltu sarakkeen ${args.columnName} mukaan laskevassa järjestyksessä`,
  "resizerDescription": `Aloita koon muutos painamalla Enter-näppäintä`,
  "select": `Valitse`,
  "selectAll": `Valitse kaikki`,
  "sortable": `lajiteltava sarake`
};
var $1b5d6c6c47d55106$exports = {};
$1b5d6c6c47d55106$exports = {
  "ascending": `croissant`,
  "ascendingSort": (args) => `trié en fonction de la colonne ${args.columnName} par ordre croissant`,
  "columnSize": (args) => `${args.value} pixels`,
  "descending": `décroissant`,
  "descendingSort": (args) => `trié en fonction de la colonne ${args.columnName} par ordre décroissant`,
  "resizerDescription": `Appuyez sur Entrée pour commencer le redimensionnement.`,
  "select": `Sélectionner`,
  "selectAll": `Sélectionner tout`,
  "sortable": `colonne triable`
};
var $7c18ba27b86d3308$exports = {};
$7c18ba27b86d3308$exports = {
  "ascending": `עולה`,
  "ascendingSort": (args) => `מוין לפי עמודה ${args.columnName} בסדר עולה`,
  "columnSize": (args) => `${args.value} פיקסלים`,
  "descending": `יורד`,
  "descendingSort": (args) => `מוין לפי עמודה ${args.columnName} בסדר יורד`,
  "resizerDescription": `הקש Enter כדי לשנות את הגודל`,
  "select": `בחר`,
  "selectAll": `בחר הכול`,
  "sortable": `עמודה שניתן למיין`
};
var $2cb40998e20e8a46$exports = {};
$2cb40998e20e8a46$exports = {
  "ascending": `rastući`,
  "ascendingSort": (args) => `razvrstano po stupcima ${args.columnName} rastućem redoslijedom`,
  "columnSize": (args) => `${args.value} piksela`,
  "descending": `padajući`,
  "descendingSort": (args) => `razvrstano po stupcima ${args.columnName} padajućim redoslijedom`,
  "resizerDescription": `Pritisnite Enter da biste započeli promenu veličine`,
  "select": `Odaberite`,
  "selectAll": `Odaberite sve`,
  "sortable": `stupac koji se može razvrstati`
};
var $189e23eec1d6aa3a$exports = {};
$189e23eec1d6aa3a$exports = {
  "ascending": `növekvő`,
  "ascendingSort": (args) => `rendezve a(z) ${args.columnName} oszlop szerint, növekvő sorrendben`,
  "columnSize": (args) => `${args.value} képpont`,
  "descending": `csökkenő`,
  "descendingSort": (args) => `rendezve a(z) ${args.columnName} oszlop szerint, csökkenő sorrendben`,
  "resizerDescription": `Nyomja le az Enter billentyűt az átméretezés megkezdéséhez`,
  "select": `Kijelölés`,
  "selectAll": `Összes kijelölése`,
  "sortable": `rendezendő oszlop`
};
var $3c5ec8e4f015dfd0$exports = {};
$3c5ec8e4f015dfd0$exports = {
  "ascending": `crescente`,
  "ascendingSort": (args) => `in ordine crescente in base alla colonna ${args.columnName}`,
  "columnSize": (args) => `${args.value} pixel`,
  "descending": `decrescente`,
  "descendingSort": (args) => `in ordine decrescente in base alla colonna ${args.columnName}`,
  "resizerDescription": `Premi Invio per iniziare a ridimensionare`,
  "select": `Seleziona`,
  "selectAll": `Seleziona tutto`,
  "sortable": `colonna ordinabile`
};
var $d021d50e6b315ebb$exports = {};
$d021d50e6b315ebb$exports = {
  "ascending": `昇順`,
  "ascendingSort": (args) => `列 ${args.columnName} を昇順で並べ替え`,
  "columnSize": (args) => `${args.value} ピクセル`,
  "descending": `降順`,
  "descendingSort": (args) => `列 ${args.columnName} を降順で並べ替え`,
  "resizerDescription": `Enter キーを押してサイズ変更を開始`,
  "select": `選択`,
  "selectAll": `すべて選択`,
  "sortable": `並べ替え可能な列`
};
var $52535c35c24ec937$exports = {};
$52535c35c24ec937$exports = {
  "ascending": `오름차순`,
  "ascendingSort": (args) => `${args.columnName} 열을 기준으로 오름차순으로 정렬됨`,
  "columnSize": (args) => `${args.value} 픽셀`,
  "descending": `내림차순`,
  "descendingSort": (args) => `${args.columnName} 열을 기준으로 내림차순으로 정렬됨`,
  "resizerDescription": `크기 조정을 시작하려면 Enter를 누르세요.`,
  "select": `선택`,
  "selectAll": `모두 선택`,
  "sortable": `정렬 가능한 열`
};
var $b37ee03672edfd1d$exports = {};
$b37ee03672edfd1d$exports = {
  "ascending": `didėjančia tvarka`,
  "ascendingSort": (args) => `surikiuota pagal stulpelį ${args.columnName} didėjančia tvarka`,
  "columnSize": (args) => `${args.value} piks.`,
  "descending": `mažėjančia tvarka`,
  "descendingSort": (args) => `surikiuota pagal stulpelį ${args.columnName} mažėjančia tvarka`,
  "resizerDescription": `Paspauskite „Enter“, kad pradėtumėte keisti dydį`,
  "select": `Pasirinkti`,
  "selectAll": `Pasirinkti viską`,
  "sortable": `rikiuojamas stulpelis`
};
var $c7df6686b4189d56$exports = {};
$c7df6686b4189d56$exports = {
  "ascending": `augošā secībā`,
  "ascendingSort": (args) => `kārtots pēc kolonnas ${args.columnName} augošā secībā`,
  "columnSize": (args) => `${args.value} pikseļi`,
  "descending": `dilstošā secībā`,
  "descendingSort": (args) => `kārtots pēc kolonnas ${args.columnName} dilstošā secībā`,
  "resizerDescription": `Nospiediet Enter, lai sāktu izmēru mainīšanu`,
  "select": `Atlasīt`,
  "selectAll": `Atlasīt visu`,
  "sortable": `kārtojamā kolonna`
};
var $da07fe8ec87e6b68$exports = {};
$da07fe8ec87e6b68$exports = {
  "ascending": `stigende`,
  "ascendingSort": (args) => `sortert etter kolonne ${args.columnName} i stigende rekkefølge`,
  "columnSize": (args) => `${args.value} piksler`,
  "descending": `synkende`,
  "descendingSort": (args) => `sortert etter kolonne ${args.columnName} i synkende rekkefølge`,
  "resizerDescription": `Trykk på Enter for å starte størrelsesendring`,
  "select": `Velg`,
  "selectAll": `Velg alle`,
  "sortable": `kolonne som kan sorteres`
};
var $64b7e390f5791490$exports = {};
$64b7e390f5791490$exports = {
  "ascending": `oplopend`,
  "ascendingSort": (args) => `gesorteerd in oplopende volgorde in kolom ${args.columnName}`,
  "columnSize": (args) => `${args.value} pixels`,
  "descending": `aflopend`,
  "descendingSort": (args) => `gesorteerd in aflopende volgorde in kolom ${args.columnName}`,
  "resizerDescription": `Druk op Enter om het formaat te wijzigen`,
  "select": `Selecteren`,
  "selectAll": `Alles selecteren`,
  "sortable": `sorteerbare kolom`
};
var $2a03621e773f1678$exports = {};
$2a03621e773f1678$exports = {
  "ascending": `rosnąco`,
  "ascendingSort": (args) => `posortowano według kolumny ${args.columnName} w porządku rosnącym`,
  "columnSize": (args) => `Liczba pikseli: ${args.value}`,
  "descending": `malejąco`,
  "descendingSort": (args) => `posortowano według kolumny ${args.columnName} w porządku malejącym`,
  "resizerDescription": `Naciśnij Enter, aby rozpocząć zmienianie rozmiaru`,
  "select": `Zaznacz`,
  "selectAll": `Zaznacz wszystko`,
  "sortable": `kolumna z możliwością sortowania`
};
var $0a79c0aba9e5ecc6$exports = {};
$0a79c0aba9e5ecc6$exports = {
  "ascending": `crescente`,
  "ascendingSort": (args) => `classificado pela coluna ${args.columnName} em ordem crescente`,
  "columnSize": (args) => `${args.value} pixels`,
  "descending": `decrescente`,
  "descendingSort": (args) => `classificado pela coluna ${args.columnName} em ordem decrescente`,
  "resizerDescription": `Pressione Enter para começar a redimensionar`,
  "select": `Selecionar`,
  "selectAll": `Selecionar tudo`,
  "sortable": `coluna classificável`
};
var $de7b4d0f7dc86fc8$exports = {};
$de7b4d0f7dc86fc8$exports = {
  "ascending": `ascendente`,
  "ascendingSort": (args) => `Ordenar por coluna ${args.columnName} em ordem ascendente`,
  "columnSize": (args) => `${args.value} pixels`,
  "descending": `descendente`,
  "descendingSort": (args) => `Ordenar por coluna ${args.columnName} em ordem descendente`,
  "resizerDescription": `Prima Enter para iniciar o redimensionamento`,
  "select": `Selecionar`,
  "selectAll": `Selecionar tudo`,
  "sortable": `Coluna ordenável`
};
var $28ea7e849d77bd1c$exports = {};
$28ea7e849d77bd1c$exports = {
  "ascending": `crescătoare`,
  "ascendingSort": (args) => `sortate după coloana ${args.columnName} în ordine crescătoare`,
  "columnSize": (args) => `${args.value} pixeli`,
  "descending": `descrescătoare`,
  "descendingSort": (args) => `sortate după coloana ${args.columnName} în ordine descrescătoare`,
  "resizerDescription": `Apăsați pe Enter pentru a începe redimensionarea`,
  "select": `Selectare`,
  "selectAll": `Selectare totală`,
  "sortable": `coloană sortabilă`
};
var $9a09321cf046b187$exports = {};
$9a09321cf046b187$exports = {
  "ascending": `возрастание`,
  "ascendingSort": (args) => `сортировать столбец ${args.columnName} в порядке возрастания`,
  "columnSize": (args) => `${args.value} пикс.`,
  "descending": `убывание`,
  "descendingSort": (args) => `сортировать столбец ${args.columnName} в порядке убывания`,
  "resizerDescription": `Нажмите клавишу Enter для начала изменения размеров`,
  "select": `Выбрать`,
  "selectAll": `Выбрать все`,
  "sortable": `сортируемый столбец`
};
var $5afe469a63fcac7b$exports = {};
$5afe469a63fcac7b$exports = {
  "ascending": `vzostupne`,
  "ascendingSort": (args) => `zoradené zostupne podľa stĺpca ${args.columnName}`,
  "columnSize": (args) => `Počet pixelov: ${args.value}`,
  "descending": `zostupne`,
  "descendingSort": (args) => `zoradené zostupne podľa stĺpca ${args.columnName}`,
  "resizerDescription": `Stlačením klávesu Enter začnete zmenu veľkosti`,
  "select": `Vybrať`,
  "selectAll": `Vybrať všetko`,
  "sortable": `zoraditeľný stĺpec`
};
var $2956757ac31a7ce2$exports = {};
$2956757ac31a7ce2$exports = {
  "ascending": `naraščajoče`,
  "ascendingSort": (args) => `razvrščeno po stolpcu ${args.columnName} v naraščajočem vrstnem redu`,
  "columnSize": (args) => `${args.value} slikovnih pik`,
  "descending": `padajoče`,
  "descendingSort": (args) => `razvrščeno po stolpcu ${args.columnName} v padajočem vrstnem redu`,
  "resizerDescription": `Pritisnite tipko Enter da začnete spreminjati velikost`,
  "select": `Izberite`,
  "selectAll": `Izberite vse`,
  "sortable": `razvrstljivi stolpec`
};
var $cedee0e66b175529$exports = {};
$cedee0e66b175529$exports = {
  "ascending": `rastući`,
  "ascendingSort": (args) => `sortirano po kolonama ${args.columnName} rastućim redosledom`,
  "columnSize": (args) => `${args.value} piksela`,
  "descending": `padajući`,
  "descendingSort": (args) => `sortirano po kolonama ${args.columnName} padajućim redosledom`,
  "resizerDescription": `Pritisnite Enter da biste započeli promenu veličine`,
  "select": `Izaberite`,
  "selectAll": `Izaberite sve`,
  "sortable": `kolona koja se može sortirati`
};
var $6db19998ba4427da$exports = {};
$6db19998ba4427da$exports = {
  "ascending": `stigande`,
  "ascendingSort": (args) => `sorterat på kolumn ${args.columnName} i stigande ordning`,
  "columnSize": (args) => `${args.value} pixlar`,
  "descending": `fallande`,
  "descendingSort": (args) => `sorterat på kolumn ${args.columnName} i fallande ordning`,
  "resizerDescription": `Tryck på Retur för att börja ändra storlek`,
  "select": `Markera`,
  "selectAll": `Markera allt`,
  "sortable": `sorterbar kolumn`
};
var $166b7c9cc1adb1a1$exports = {};
$166b7c9cc1adb1a1$exports = {
  "ascending": `artan sırada`,
  "ascendingSort": (args) => `${args.columnName} sütuna göre artan düzende sırala`,
  "columnSize": (args) => `${args.value} piksel`,
  "descending": `azalan sırada`,
  "descendingSort": (args) => `${args.columnName} sütuna göre azalan düzende sırala`,
  "resizerDescription": `Yeniden boyutlandırmak için Enter'a basın`,
  "select": `Seç`,
  "selectAll": `Tümünü Seç`,
  "sortable": `Sıralanabilir sütun`
};
var $c7ab180b401e49ff$exports = {};
$c7ab180b401e49ff$exports = {
  "ascending": `висхідний`,
  "ascendingSort": (args) => `відсортовано за стовпцем ${args.columnName} у висхідному порядку`,
  "columnSize": (args) => `${args.value} пікс.`,
  "descending": `низхідний`,
  "descendingSort": (args) => `відсортовано за стовпцем ${args.columnName} у низхідному порядку`,
  "resizerDescription": `Натисніть Enter, щоб почати зміну розміру`,
  "select": `Вибрати`,
  "selectAll": `Вибрати все`,
  "sortable": `сортувальний стовпець`
};
var $1648ec00941567f3$exports = {};
$1648ec00941567f3$exports = {
  "ascending": `升序`,
  "ascendingSort": (args) => `按列 ${args.columnName} 升序排序`,
  "columnSize": (args) => `${args.value} 像素`,
  "descending": `降序`,
  "descendingSort": (args) => `按列 ${args.columnName} 降序排序`,
  "resizerDescription": `按“输入”键开始调整大小。`,
  "select": `选择`,
  "selectAll": `全选`,
  "sortable": `可排序的列`
};
var $b26f22384b3c1526$exports = {};
$b26f22384b3c1526$exports = {
  "ascending": `遞增`,
  "ascendingSort": (args) => `已依據「${args.columnName}」欄遞增排序`,
  "columnSize": (args) => `${args.value} 像素`,
  "descending": `遞減`,
  "descendingSort": (args) => `已依據「${args.columnName}」欄遞減排序`,
  "resizerDescription": `按 Enter 鍵以開始調整大小`,
  "select": `選取`,
  "selectAll": `全選`,
  "sortable": `可排序的欄`
};
var $7476b46781682bf5$exports = {};
$7476b46781682bf5$exports = {
  "ar-AE": $ce3de3ff2fd66848$exports,
  "bg-BG": $cb80dcce530985b9$exports,
  "cs-CZ": $68ac86749db4c0fb$exports,
  "da-DK": $9a6cbac08487e661$exports,
  "de-DE": $c963661d89486e72$exports,
  "el-GR": $ac03861c6e8605f4$exports,
  "en-US": $09e6b82e0d6e466a$exports,
  "es-ES": $8cc39eb66c2bf220$exports,
  "et-EE": $4e11db3c25a38112$exports,
  "fi-FI": $da1e751a92575e02$exports,
  "fr-FR": $1b5d6c6c47d55106$exports,
  "he-IL": $7c18ba27b86d3308$exports,
  "hr-HR": $2cb40998e20e8a46$exports,
  "hu-HU": $189e23eec1d6aa3a$exports,
  "it-IT": $3c5ec8e4f015dfd0$exports,
  "ja-JP": $d021d50e6b315ebb$exports,
  "ko-KR": $52535c35c24ec937$exports,
  "lt-LT": $b37ee03672edfd1d$exports,
  "lv-LV": $c7df6686b4189d56$exports,
  "nb-NO": $da07fe8ec87e6b68$exports,
  "nl-NL": $64b7e390f5791490$exports,
  "pl-PL": $2a03621e773f1678$exports,
  "pt-BR": $0a79c0aba9e5ecc6$exports,
  "pt-PT": $de7b4d0f7dc86fc8$exports,
  "ro-RO": $28ea7e849d77bd1c$exports,
  "ru-RU": $9a09321cf046b187$exports,
  "sk-SK": $5afe469a63fcac7b$exports,
  "sl-SI": $2956757ac31a7ce2$exports,
  "sr-SP": $cedee0e66b175529$exports,
  "sv-SE": $6db19998ba4427da$exports,
  "tr-TR": $166b7c9cc1adb1a1$exports,
  "uk-UA": $c7ab180b401e49ff$exports,
  "zh-CN": $1648ec00941567f3$exports,
  "zh-TW": $b26f22384b3c1526$exports
};
class $d1c300d9c497e402$export$de9feff04fda126e {
  isCell(node2) {
    return node2.type === "cell";
  }
  isRow(node2) {
    return node2.type === "row" || node2.type === "item";
  }
  isDisabled(item) {
    var _item_props;
    return this.disabledBehavior === "all" && (((_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.isDisabled) || this.disabledKeys.has(item.key));
  }
  findPreviousKey(fromKey, pred) {
    let key = fromKey != null ? this.collection.getKeyBefore(fromKey) : this.collection.getLastKey();
    while (key != null) {
      let item = this.collection.getItem(key);
      if (!item)
        return null;
      if (!this.isDisabled(item) && (!pred || pred(item)))
        return key;
      key = this.collection.getKeyBefore(key);
    }
    return null;
  }
  findNextKey(fromKey, pred) {
    let key = fromKey != null ? this.collection.getKeyAfter(fromKey) : this.collection.getFirstKey();
    while (key != null) {
      let item = this.collection.getItem(key);
      if (!item)
        return null;
      if (!this.isDisabled(item) && (!pred || pred(item)))
        return key;
      key = this.collection.getKeyAfter(key);
      if (key == null)
        return null;
    }
    return null;
  }
  getKeyForItemInRowByIndex(key, index2 = 0) {
    if (index2 < 0)
      return null;
    let item = this.collection.getItem(key);
    if (!item)
      return null;
    let i2 = 0;
    for (let child of $c5a24bc478652b5f$export$1005530eda016c13(item, this.collection)) {
      var _child_key;
      if (child.colSpan && child.colSpan + i2 > index2)
        return (_child_key = child.key) !== null && _child_key !== void 0 ? _child_key : null;
      if (child.colSpan)
        i2 = i2 + child.colSpan - 1;
      var _child_key1;
      if (i2 === index2)
        return (_child_key1 = child.key) !== null && _child_key1 !== void 0 ? _child_key1 : null;
      i2++;
    }
    return null;
  }
  getKeyBelow(fromKey) {
    let key = fromKey;
    let startItem = this.collection.getItem(key);
    if (!startItem)
      return null;
    var _startItem_parentKey;
    if (this.isCell(startItem))
      key = (_startItem_parentKey = startItem.parentKey) !== null && _startItem_parentKey !== void 0 ? _startItem_parentKey : null;
    if (key == null)
      return null;
    key = this.findNextKey(key, (item) => item.type === "item");
    if (key != null) {
      if (this.isCell(startItem)) {
        let startIndex = startItem.colIndex ? startItem.colIndex : startItem.index;
        return this.getKeyForItemInRowByIndex(key, startIndex);
      }
      if (this.focusMode === "row")
        return key;
    }
    return null;
  }
  getKeyAbove(fromKey) {
    let key = fromKey;
    let startItem = this.collection.getItem(key);
    if (!startItem)
      return null;
    var _startItem_parentKey;
    if (this.isCell(startItem))
      key = (_startItem_parentKey = startItem.parentKey) !== null && _startItem_parentKey !== void 0 ? _startItem_parentKey : null;
    if (key == null)
      return null;
    key = this.findPreviousKey(key, (item) => item.type === "item");
    if (key != null) {
      if (this.isCell(startItem)) {
        let startIndex = startItem.colIndex ? startItem.colIndex : startItem.index;
        return this.getKeyForItemInRowByIndex(key, startIndex);
      }
      if (this.focusMode === "row")
        return key;
    }
    return null;
  }
  getKeyRightOf(key) {
    let item = this.collection.getItem(key);
    if (!item)
      return null;
    if (this.isRow(item)) {
      var _getLastItem, _getFirstItem;
      let children = $c5a24bc478652b5f$export$1005530eda016c13(item, this.collection);
      var _ref;
      return (_ref = this.direction === "rtl" ? (_getLastItem = $c5a24bc478652b5f$export$7475b2c64539e4cf(children)) === null || _getLastItem === void 0 ? void 0 : _getLastItem.key : (_getFirstItem = $c5a24bc478652b5f$export$fbdeaa6a76694f71(children)) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key) !== null && _ref !== void 0 ? _ref : null;
    }
    if (this.isCell(item) && item.parentKey != null) {
      let parent = this.collection.getItem(item.parentKey);
      if (!parent)
        return null;
      let children = $c5a24bc478652b5f$export$1005530eda016c13(parent, this.collection);
      var _ref1;
      let next2 = (_ref1 = this.direction === "rtl" ? $c5a24bc478652b5f$export$5f3398f8733f90e2(children, item.index - 1) : $c5a24bc478652b5f$export$5f3398f8733f90e2(children, item.index + 1)) !== null && _ref1 !== void 0 ? _ref1 : null;
      var _next_key;
      if (next2)
        return (_next_key = next2.key) !== null && _next_key !== void 0 ? _next_key : null;
      var _item_parentKey;
      if (this.focusMode === "row")
        return (_item_parentKey = item.parentKey) !== null && _item_parentKey !== void 0 ? _item_parentKey : null;
      var _ref2;
      return (_ref2 = this.direction === "rtl" ? this.getFirstKey(key) : this.getLastKey(key)) !== null && _ref2 !== void 0 ? _ref2 : null;
    }
    return null;
  }
  getKeyLeftOf(key) {
    let item = this.collection.getItem(key);
    if (!item)
      return null;
    if (this.isRow(item)) {
      var _getFirstItem, _getLastItem;
      let children = $c5a24bc478652b5f$export$1005530eda016c13(item, this.collection);
      var _ref;
      return (_ref = this.direction === "rtl" ? (_getFirstItem = $c5a24bc478652b5f$export$fbdeaa6a76694f71(children)) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key : (_getLastItem = $c5a24bc478652b5f$export$7475b2c64539e4cf(children)) === null || _getLastItem === void 0 ? void 0 : _getLastItem.key) !== null && _ref !== void 0 ? _ref : null;
    }
    if (this.isCell(item) && item.parentKey != null) {
      let parent = this.collection.getItem(item.parentKey);
      if (!parent)
        return null;
      let children = $c5a24bc478652b5f$export$1005530eda016c13(parent, this.collection);
      var _ref1;
      let prev2 = (_ref1 = this.direction === "rtl" ? $c5a24bc478652b5f$export$5f3398f8733f90e2(children, item.index + 1) : $c5a24bc478652b5f$export$5f3398f8733f90e2(children, item.index - 1)) !== null && _ref1 !== void 0 ? _ref1 : null;
      var _prev_key;
      if (prev2)
        return (_prev_key = prev2.key) !== null && _prev_key !== void 0 ? _prev_key : null;
      var _item_parentKey;
      if (this.focusMode === "row")
        return (_item_parentKey = item.parentKey) !== null && _item_parentKey !== void 0 ? _item_parentKey : null;
      var _ref2;
      return (_ref2 = this.direction === "rtl" ? this.getLastKey(key) : this.getFirstKey(key)) !== null && _ref2 !== void 0 ? _ref2 : null;
    }
    return null;
  }
  getFirstKey(fromKey, global2) {
    let key = fromKey !== null && fromKey !== void 0 ? fromKey : null;
    let item;
    if (key != null) {
      item = this.collection.getItem(key);
      if (!item)
        return null;
      if (this.isCell(item) && !global2 && item.parentKey != null) {
        var _getFirstItem;
        let parent = this.collection.getItem(item.parentKey);
        if (!parent)
          return null;
        var _getFirstItem_key;
        return (_getFirstItem_key = (_getFirstItem = $c5a24bc478652b5f$export$fbdeaa6a76694f71($c5a24bc478652b5f$export$1005530eda016c13(parent, this.collection))) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key) !== null && _getFirstItem_key !== void 0 ? _getFirstItem_key : null;
      }
    }
    key = this.findNextKey(void 0, (item2) => item2.type === "item");
    if (key != null && (item && this.isCell(item) && global2 || this.focusMode === "cell")) {
      var _getFirstItem1;
      let item2 = this.collection.getItem(key);
      if (!item2)
        return null;
      var _getFirstItem_key1;
      key = (_getFirstItem_key1 = (_getFirstItem1 = $c5a24bc478652b5f$export$fbdeaa6a76694f71($c5a24bc478652b5f$export$1005530eda016c13(item2, this.collection))) === null || _getFirstItem1 === void 0 ? void 0 : _getFirstItem1.key) !== null && _getFirstItem_key1 !== void 0 ? _getFirstItem_key1 : null;
    }
    return key;
  }
  getLastKey(fromKey, global2) {
    let key = fromKey !== null && fromKey !== void 0 ? fromKey : null;
    let item;
    if (key != null) {
      item = this.collection.getItem(key);
      if (!item)
        return null;
      if (this.isCell(item) && !global2 && item.parentKey != null) {
        var _getLastItem;
        let parent = this.collection.getItem(item.parentKey);
        if (!parent)
          return null;
        let children = $c5a24bc478652b5f$export$1005530eda016c13(parent, this.collection);
        var _getLastItem_key;
        return (_getLastItem_key = (_getLastItem = $c5a24bc478652b5f$export$7475b2c64539e4cf(children)) === null || _getLastItem === void 0 ? void 0 : _getLastItem.key) !== null && _getLastItem_key !== void 0 ? _getLastItem_key : null;
      }
    }
    key = this.findPreviousKey(void 0, (item2) => item2.type === "item");
    if (key != null && (item && this.isCell(item) && global2 || this.focusMode === "cell")) {
      var _getLastItem1;
      let item2 = this.collection.getItem(key);
      if (!item2)
        return null;
      let children = $c5a24bc478652b5f$export$1005530eda016c13(item2, this.collection);
      var _getLastItem_key1;
      key = (_getLastItem_key1 = (_getLastItem1 = $c5a24bc478652b5f$export$7475b2c64539e4cf(children)) === null || _getLastItem1 === void 0 ? void 0 : _getLastItem1.key) !== null && _getLastItem_key1 !== void 0 ? _getLastItem_key1 : null;
    }
    return key;
  }
  getKeyPageAbove(fromKey) {
    let key = fromKey;
    let itemRect = this.layoutDelegate.getItemRect(key);
    if (!itemRect)
      return null;
    let pageY = Math.max(0, itemRect.y + itemRect.height - this.layoutDelegate.getVisibleRect().height);
    while (itemRect && itemRect.y > pageY && key != null) {
      var _this_getKeyAbove;
      key = (_this_getKeyAbove = this.getKeyAbove(key)) !== null && _this_getKeyAbove !== void 0 ? _this_getKeyAbove : null;
      if (key == null)
        break;
      itemRect = this.layoutDelegate.getItemRect(key);
    }
    return key;
  }
  getKeyPageBelow(fromKey) {
    let key = fromKey;
    let itemRect = this.layoutDelegate.getItemRect(key);
    if (!itemRect)
      return null;
    let pageHeight = this.layoutDelegate.getVisibleRect().height;
    let pageY = Math.min(this.layoutDelegate.getContentSize().height, itemRect.y + pageHeight);
    while (itemRect && itemRect.y + itemRect.height < pageY) {
      let nextKey = this.getKeyBelow(key);
      if (nextKey == null)
        break;
      itemRect = this.layoutDelegate.getItemRect(nextKey);
      key = nextKey;
    }
    return key;
  }
  getKeyForSearch(search2, fromKey) {
    let key = fromKey !== null && fromKey !== void 0 ? fromKey : null;
    if (!this.collator)
      return null;
    let collection = this.collection;
    key = fromKey !== null && fromKey !== void 0 ? fromKey : this.getFirstKey();
    if (key == null)
      return null;
    let startItem = collection.getItem(key);
    if (!startItem)
      return null;
    var _startItem_parentKey;
    if (startItem.type === "cell")
      key = (_startItem_parentKey = startItem.parentKey) !== null && _startItem_parentKey !== void 0 ? _startItem_parentKey : null;
    let hasWrapped = false;
    while (key != null) {
      let item = collection.getItem(key);
      if (!item)
        return null;
      if (item.textValue) {
        let substring = item.textValue.slice(0, search2.length);
        if (this.collator.compare(substring, search2) === 0) {
          var _getFirstItem;
          var _getFirstItem_key;
          if (this.isRow(item) && this.focusMode === "cell")
            return (_getFirstItem_key = (_getFirstItem = $c5a24bc478652b5f$export$fbdeaa6a76694f71($c5a24bc478652b5f$export$1005530eda016c13(item, this.collection))) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key) !== null && _getFirstItem_key !== void 0 ? _getFirstItem_key : null;
          return item.key;
        }
      }
      key = this.findNextKey(key, (item2) => item2.type === "item");
      if (key == null && !hasWrapped) {
        key = this.getFirstKey();
        hasWrapped = true;
      }
    }
    return null;
  }
  constructor(options) {
    this.collection = options.collection;
    this.disabledKeys = options.disabledKeys;
    this.disabledBehavior = options.disabledBehavior || "all";
    this.direction = options.direction;
    this.collator = options.collator;
    if (!options.layout && !options.ref)
      throw new Error("Either a layout or a ref must be specified.");
    this.layoutDelegate = options.layoutDelegate || (options.layout ? new $d1c300d9c497e402$var$DeprecatedLayoutDelegate(options.layout) : new $657e4dc4a6e88df0$export$8f5ed9ff9f511381$1(options.ref));
    var _options_focusMode;
    this.focusMode = (_options_focusMode = options.focusMode) !== null && _options_focusMode !== void 0 ? _options_focusMode : "row";
  }
}
class $d1c300d9c497e402$var$DeprecatedLayoutDelegate {
  getContentSize() {
    return this.layout.getContentSize();
  }
  getItemRect(key) {
    var _this_layout_getLayoutInfo;
    return ((_this_layout_getLayoutInfo = this.layout.getLayoutInfo(key)) === null || _this_layout_getLayoutInfo === void 0 ? void 0 : _this_layout_getLayoutInfo.rect) || null;
  }
  getVisibleRect() {
    return this.layout.virtualizer.visibleRect;
  }
  constructor(layout2) {
    this.layout = layout2;
  }
}
const $1af922eb41e03c8f$export$e6235c0d09b995d0 = /* @__PURE__ */ new WeakMap();
var $682989befd4f478d$exports = {};
$682989befd4f478d$exports = {
  "deselectedItem": (args) => `${args.item} غير المحدد`,
  "longPressToSelect": `اضغط مطولًا للدخول إلى وضع التحديد.`,
  "select": `تحديد`,
  "selectedAll": `جميع العناصر المحددة.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `لم يتم تحديد عناصر`,
    one: () => `${formatter.number(args.count)} عنصر محدد`,
    other: () => `${formatter.number(args.count)} عنصر محدد`
  })}.`,
  "selectedItem": (args) => `${args.item} المحدد`
};
var $f7fca02019afd941$exports = {};
$f7fca02019afd941$exports = {
  "deselectedItem": (args) => `${args.item} не е избран.`,
  "longPressToSelect": `Натиснете и задръжте за да влезете в избирателен режим.`,
  "select": `Изберете`,
  "selectedAll": `Всички елементи са избрани.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Няма избрани елементи`,
    one: () => `${formatter.number(args.count)} избран елемент`,
    other: () => `${formatter.number(args.count)} избрани елементи`
  })}.`,
  "selectedItem": (args) => `${args.item} избран.`
};
var $8f86f40be75387f1$exports = {};
$8f86f40be75387f1$exports = {
  "deselectedItem": (args) => `Položka ${args.item} není vybrána.`,
  "longPressToSelect": `Dlouhým stisknutím přejdete do režimu výběru.`,
  "select": `Vybrat`,
  "selectedAll": `Vybrány všechny položky.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Nevybrány žádné položky`,
    one: () => `Vybrána ${formatter.number(args.count)} položka`,
    other: () => `Vybráno ${formatter.number(args.count)} položek`
  })}.`,
  "selectedItem": (args) => `Vybrána položka ${args.item}.`
};
var $db24ba43c8d652ee$exports = {};
$db24ba43c8d652ee$exports = {
  "deselectedItem": (args) => `${args.item} ikke valgt.`,
  "longPressToSelect": `Lav et langt tryk for at aktivere valgtilstand.`,
  "select": `Vælg`,
  "selectedAll": `Alle elementer valgt.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Ingen elementer valgt`,
    one: () => `${formatter.number(args.count)} element valgt`,
    other: () => `${formatter.number(args.count)} elementer valgt`
  })}.`,
  "selectedItem": (args) => `${args.item} valgt.`
};
var $f8f1e72c8b5447d6$exports = {};
$f8f1e72c8b5447d6$exports = {
  "deselectedItem": (args) => `${args.item} nicht ausgewählt.`,
  "longPressToSelect": `Gedrückt halten, um Auswahlmodus zu öffnen.`,
  "select": `Auswählen`,
  "selectedAll": `Alle Elemente ausgewählt.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Keine Elemente ausgewählt`,
    one: () => `${formatter.number(args.count)} Element ausgewählt`,
    other: () => `${formatter.number(args.count)} Elemente ausgewählt`
  })}.`,
  "selectedItem": (args) => `${args.item} ausgewählt.`
};
var $9a73ed2983c3ab0b$exports = {};
$9a73ed2983c3ab0b$exports = {
  "deselectedItem": (args) => `Δεν επιλέχθηκε το στοιχείο ${args.item}.`,
  "longPressToSelect": `Πατήστε παρατεταμένα για να μπείτε σε λειτουργία επιλογής.`,
  "select": `Επιλογή`,
  "selectedAll": `Επιλέχθηκαν όλα τα στοιχεία.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Δεν επιλέχθηκαν στοιχεία`,
    one: () => `Επιλέχθηκε ${formatter.number(args.count)} στοιχείο`,
    other: () => `Επιλέχθηκαν ${formatter.number(args.count)} στοιχεία`
  })}.`,
  "selectedItem": (args) => `Επιλέχθηκε το στοιχείο ${args.item}.`
};
var $583de0b3587601b9$exports = {};
$583de0b3587601b9$exports = {
  "deselectedItem": (args) => `${args.item} not selected.`,
  "select": `Select`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `No items selected`,
    one: () => `${formatter.number(args.count)} item selected`,
    other: () => `${formatter.number(args.count)} items selected`
  })}.`,
  "selectedAll": `All items selected.`,
  "selectedItem": (args) => `${args.item} selected.`,
  "longPressToSelect": `Long press to enter selection mode.`
};
var $147159c978043442$exports = {};
$147159c978043442$exports = {
  "deselectedItem": (args) => `${args.item} no seleccionado.`,
  "longPressToSelect": `Mantenga pulsado para abrir el modo de selección.`,
  "select": `Seleccionar`,
  "selectedAll": `Todos los elementos seleccionados.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Ningún elemento seleccionado`,
    one: () => `${formatter.number(args.count)} elemento seleccionado`,
    other: () => `${formatter.number(args.count)} elementos seleccionados`
  })}.`,
  "selectedItem": (args) => `${args.item} seleccionado.`
};
var $5cbb62c8a19173ac$exports = {};
$5cbb62c8a19173ac$exports = {
  "deselectedItem": (args) => `${args.item} pole valitud.`,
  "longPressToSelect": `Valikurežiimi sisenemiseks vajutage pikalt.`,
  "select": `Vali`,
  "selectedAll": `Kõik üksused valitud.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Üksusi pole valitud`,
    one: () => `${formatter.number(args.count)} üksus valitud`,
    other: () => `${formatter.number(args.count)} üksust valitud`
  })}.`,
  "selectedItem": (args) => `${args.item} valitud.`
};
var $a33d71dc804cc59e$exports = {};
$a33d71dc804cc59e$exports = {
  "deselectedItem": (args) => `Kohdetta ${args.item} ei valittu.`,
  "longPressToSelect": `Siirry valintatilaan painamalla pitkään.`,
  "select": `Valitse`,
  "selectedAll": `Kaikki kohteet valittu.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Ei yhtään kohdetta valittu`,
    one: () => `${formatter.number(args.count)} kohde valittu`,
    other: () => `${formatter.number(args.count)} kohdetta valittu`
  })}.`,
  "selectedItem": (args) => `${args.item} valittu.`
};
var $92d800447793d084$exports = {};
$92d800447793d084$exports = {
  "deselectedItem": (args) => `${args.item} non sélectionné.`,
  "longPressToSelect": `Appuyez de manière prolongée pour passer en mode de sélection.`,
  "select": `Sélectionner`,
  "selectedAll": `Tous les éléments sélectionnés.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Aucun élément sélectionné`,
    one: () => `${formatter.number(args.count)} élément sélectionné`,
    other: () => `${formatter.number(args.count)} éléments sélectionnés`
  })}.`,
  "selectedItem": (args) => `${args.item} sélectionné.`
};
var $fe732cdb32124ea8$exports = {};
$fe732cdb32124ea8$exports = {
  "deselectedItem": (args) => `${args.item} לא נבחר.`,
  "longPressToSelect": `הקשה ארוכה לכניסה למצב בחירה.`,
  "select": `בחר`,
  "selectedAll": `כל הפריטים נבחרו.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `לא נבחרו פריטים`,
    one: () => `פריט ${formatter.number(args.count)} נבחר`,
    other: () => `${formatter.number(args.count)} פריטים נבחרו`
  })}.`,
  "selectedItem": (args) => `${args.item} נבחר.`
};
var $e41234e934efb4f5$exports = {};
$e41234e934efb4f5$exports = {
  "deselectedItem": (args) => `Stavka ${args.item} nije odabrana.`,
  "longPressToSelect": `Dugo pritisnite za ulazak u način odabira.`,
  "select": `Odaberite`,
  "selectedAll": `Odabrane su sve stavke.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Nije odabrana nijedna stavka`,
    one: () => `Odabrana je ${formatter.number(args.count)} stavka`,
    other: () => `Odabrano je ${formatter.number(args.count)} stavki`
  })}.`,
  "selectedItem": (args) => `Stavka ${args.item} je odabrana.`
};
var $1b0393182473bf9e$exports = {};
$1b0393182473bf9e$exports = {
  "deselectedItem": (args) => `${args.item} nincs kijelölve.`,
  "longPressToSelect": `Nyomja hosszan a kijelöléshez.`,
  "select": `Kijelölés`,
  "selectedAll": `Az összes elem kijelölve.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Egy elem sincs kijelölve`,
    one: () => `${formatter.number(args.count)} elem kijelölve`,
    other: () => `${formatter.number(args.count)} elem kijelölve`
  })}.`,
  "selectedItem": (args) => `${args.item} kijelölve.`
};
var $2eed782c1c110ce7$exports = {};
$2eed782c1c110ce7$exports = {
  "deselectedItem": (args) => `${args.item} non selezionato.`,
  "longPressToSelect": `Premi a lungo per passare alla modalità di selezione.`,
  "select": `Seleziona`,
  "selectedAll": `Tutti gli elementi selezionati.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Nessun elemento selezionato`,
    one: () => `${formatter.number(args.count)} elemento selezionato`,
    other: () => `${formatter.number(args.count)} elementi selezionati`
  })}.`,
  "selectedItem": (args) => `${args.item} selezionato.`
};
var $8b5d459f86e9b23c$exports = {};
$8b5d459f86e9b23c$exports = {
  "deselectedItem": (args) => `${args.item} が選択されていません。`,
  "longPressToSelect": `長押しして選択モードを開きます。`,
  "select": `選択`,
  "selectedAll": `すべての項目を選択しました。`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `項目が選択されていません`,
    one: () => `${formatter.number(args.count)} 項目を選択しました`,
    other: () => `${formatter.number(args.count)} 項目を選択しました`
  })}。`,
  "selectedItem": (args) => `${args.item} を選択しました。`
};
var $1949c3ad17295fd4$exports = {};
$1949c3ad17295fd4$exports = {
  "deselectedItem": (args) => `${args.item}이(가) 선택되지 않았습니다.`,
  "longPressToSelect": `선택 모드로 들어가려면 길게 누르십시오.`,
  "select": `선택`,
  "selectedAll": `모든 항목이 선택되었습니다.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `선택된 항목이 없습니다`,
    one: () => `${formatter.number(args.count)}개 항목이 선택되었습니다`,
    other: () => `${formatter.number(args.count)}개 항목이 선택되었습니다`
  })}.`,
  "selectedItem": (args) => `${args.item}이(가) 선택되었습니다.`
};
var $f5e3df4dc8aa7b54$exports = {};
$f5e3df4dc8aa7b54$exports = {
  "deselectedItem": (args) => `${args.item} nepasirinkta.`,
  "longPressToSelect": `Norėdami įjungti pasirinkimo režimą, paspauskite ir palaikykite.`,
  "select": `Pasirinkti`,
  "selectedAll": `Pasirinkti visi elementai.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Nepasirinktas nė vienas elementas`,
    one: () => `Pasirinktas ${formatter.number(args.count)} elementas`,
    other: () => `Pasirinkta elementų: ${formatter.number(args.count)}`
  })}.`,
  "selectedItem": (args) => `Pasirinkta: ${args.item}.`
};
var $9dd86690a5c2b2c5$exports = {};
$9dd86690a5c2b2c5$exports = {
  "deselectedItem": (args) => `Vienums ${args.item} nav atlasīts.`,
  "longPressToSelect": `Ilgi turiet nospiestu. lai ieslēgtu atlases režīmu.`,
  "select": `Atlasīt`,
  "selectedAll": `Atlasīti visi vienumi.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Nav atlasīts neviens vienums`,
    one: () => `Atlasīto vienumu skaits: ${formatter.number(args.count)}`,
    other: () => `Atlasīto vienumu skaits: ${formatter.number(args.count)}`
  })}.`,
  "selectedItem": (args) => `Atlasīts vienums ${args.item}.`
};
var $843964c3bf9a7d24$exports = {};
$843964c3bf9a7d24$exports = {
  "deselectedItem": (args) => `${args.item} er ikke valgt.`,
  "longPressToSelect": `Bruk et langt trykk for å gå inn i valgmodus.`,
  "select": `Velg`,
  "selectedAll": `Alle elementer er valgt.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Ingen elementer er valgt`,
    one: () => `${formatter.number(args.count)} element er valgt`,
    other: () => `${formatter.number(args.count)} elementer er valgt`
  })}.`,
  "selectedItem": (args) => `${args.item} er valgt.`
};
var $73f50e845f9ef3b4$exports = {};
$73f50e845f9ef3b4$exports = {
  "deselectedItem": (args) => `${args.item} niet geselecteerd.`,
  "longPressToSelect": `Druk lang om de selectiemodus te openen.`,
  "select": `Selecteren`,
  "selectedAll": `Alle items geselecteerd.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Geen items geselecteerd`,
    one: () => `${formatter.number(args.count)} item geselecteerd`,
    other: () => `${formatter.number(args.count)} items geselecteerd`
  })}.`,
  "selectedItem": (args) => `${args.item} geselecteerd.`
};
var $87f92a7e077514b2$exports = {};
$87f92a7e077514b2$exports = {
  "deselectedItem": (args) => `Nie zaznaczono ${args.item}.`,
  "longPressToSelect": `Naciśnij i przytrzymaj, aby wejść do trybu wyboru.`,
  "select": `Zaznacz`,
  "selectedAll": `Wszystkie zaznaczone elementy.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Nie zaznaczono żadnych elementów`,
    one: () => `${formatter.number(args.count)} zaznaczony element`,
    other: () => `${formatter.number(args.count)} zaznaczonych elementów`
  })}.`,
  "selectedItem": (args) => `Zaznaczono ${args.item}.`
};
var $c28c98d58ee9ff6f$exports = {};
$c28c98d58ee9ff6f$exports = {
  "deselectedItem": (args) => `${args.item} não selecionado.`,
  "longPressToSelect": `Mantenha pressionado para entrar no modo de seleção.`,
  "select": `Selecionar`,
  "selectedAll": `Todos os itens selecionados.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Nenhum item selecionado`,
    one: () => `${formatter.number(args.count)} item selecionado`,
    other: () => `${formatter.number(args.count)} itens selecionados`
  })}.`,
  "selectedItem": (args) => `${args.item} selecionado.`
};
var $b6b1503b17b2254d$exports = {};
$b6b1503b17b2254d$exports = {
  "deselectedItem": (args) => `${args.item} não selecionado.`,
  "longPressToSelect": `Prima continuamente para entrar no modo de seleção.`,
  "select": `Selecionar`,
  "selectedAll": `Todos os itens selecionados.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Nenhum item selecionado`,
    one: () => `${formatter.number(args.count)} item selecionado`,
    other: () => `${formatter.number(args.count)} itens selecionados`
  })}.`,
  "selectedItem": (args) => `${args.item} selecionado.`
};
var $8bdaeb71e50c3e1a$exports = {};
$8bdaeb71e50c3e1a$exports = {
  "deselectedItem": (args) => `${args.item} neselectat.`,
  "longPressToSelect": `Apăsați lung pentru a intra în modul de selectare.`,
  "select": `Selectare`,
  "selectedAll": `Toate elementele selectate.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Niciun element selectat`,
    one: () => `${formatter.number(args.count)} element selectat`,
    other: () => `${formatter.number(args.count)} elemente selectate`
  })}.`,
  "selectedItem": (args) => `${args.item} selectat.`
};
var $ec2b852dd7c3d1f2$exports = {};
$ec2b852dd7c3d1f2$exports = {
  "deselectedItem": (args) => `${args.item} не выбрано.`,
  "longPressToSelect": `Нажмите и удерживайте для входа в режим выбора.`,
  "select": `Выбрать`,
  "selectedAll": `Выбраны все элементы.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Нет выбранных элементов`,
    one: () => `${formatter.number(args.count)} элемент выбран`,
    other: () => `${formatter.number(args.count)} элементов выбрано`
  })}.`,
  "selectedItem": (args) => `${args.item} выбрано.`
};
var $79e6d900d6a4f82d$exports = {};
$79e6d900d6a4f82d$exports = {
  "deselectedItem": (args) => `Nevybraté položky: ${args.item}.`,
  "longPressToSelect": `Dlhším stlačením prejdite do režimu výberu.`,
  "select": `Vybrať`,
  "selectedAll": `Všetky vybraté položky.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Žiadne vybraté položky`,
    one: () => `${formatter.number(args.count)} vybratá položka`,
    other: () => `Počet vybratých položiek:${formatter.number(args.count)}`
  })}.`,
  "selectedItem": (args) => `Vybraté položky: ${args.item}.`
};
var $f4c1f0d5d4d03d80$exports = {};
$f4c1f0d5d4d03d80$exports = {
  "deselectedItem": (args) => `Element ${args.item} ni izbran.`,
  "longPressToSelect": `Za izbirni način pritisnite in dlje časa držite.`,
  "select": `Izberite`,
  "selectedAll": `Vsi elementi so izbrani.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Noben element ni izbran`,
    one: () => `${formatter.number(args.count)} element je izbran`,
    other: () => `${formatter.number(args.count)} elementov je izbranih`
  })}.`,
  "selectedItem": (args) => `Element ${args.item} je izbran.`
};
var $46252cd87269b10b$exports = {};
$46252cd87269b10b$exports = {
  "deselectedItem": (args) => `${args.item} nije izabrano.`,
  "longPressToSelect": `Dugo pritisnite za ulazak u režim biranja.`,
  "select": `Izaberite`,
  "selectedAll": `Izabrane su sve stavke.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Nije izabrana nijedna stavka`,
    one: () => `Izabrana je ${formatter.number(args.count)} stavka`,
    other: () => `Izabrano je ${formatter.number(args.count)} stavki`
  })}.`,
  "selectedItem": (args) => `${args.item} je izabrano.`
};
var $d4d5d8dab362555c$exports = {};
$d4d5d8dab362555c$exports = {
  "deselectedItem": (args) => `${args.item} ej markerat.`,
  "longPressToSelect": `Tryck länge när du vill öppna väljarläge.`,
  "select": `Markera`,
  "selectedAll": `Alla markerade objekt.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Inga markerade objekt`,
    one: () => `${formatter.number(args.count)} markerat objekt`,
    other: () => `${formatter.number(args.count)} markerade objekt`
  })}.`,
  "selectedItem": (args) => `${args.item} markerat.`
};
var $3d55d1f97c377e83$exports = {};
$3d55d1f97c377e83$exports = {
  "deselectedItem": (args) => `${args.item} seçilmedi.`,
  "longPressToSelect": `Seçim moduna girmek için uzun basın.`,
  "select": `Seç`,
  "selectedAll": `Tüm ögeler seçildi.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Hiçbir öge seçilmedi`,
    one: () => `${formatter.number(args.count)} öge seçildi`,
    other: () => `${formatter.number(args.count)} öge seçildi`
  })}.`,
  "selectedItem": (args) => `${args.item} seçildi.`
};
var $5368512f1c703a3f$exports = {};
$5368512f1c703a3f$exports = {
  "deselectedItem": (args) => `${args.item} не вибрано.`,
  "longPressToSelect": `Виконайте довге натиснення, щоб перейти в режим вибору.`,
  "select": `Вибрати`,
  "selectedAll": `Усі елементи вибрано.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Жодних елементів не вибрано`,
    one: () => `${formatter.number(args.count)} елемент вибрано`,
    other: () => `Вибрано елементів: ${formatter.number(args.count)}`
  })}.`,
  "selectedItem": (args) => `${args.item} вибрано.`
};
var $f1316b1074463583$exports = {};
$f1316b1074463583$exports = {
  "deselectedItem": (args) => `未选择 ${args.item}。`,
  "longPressToSelect": `长按以进入选择模式。`,
  "select": `选择`,
  "selectedAll": `已选择所有项目。`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `未选择项目`,
    one: () => `已选择 ${formatter.number(args.count)} 个项目`,
    other: () => `已选择 ${formatter.number(args.count)} 个项目`
  })}。`,
  "selectedItem": (args) => `已选择 ${args.item}。`
};
var $7e60654723031b6f$exports = {};
$7e60654723031b6f$exports = {
  "deselectedItem": (args) => `未選取「${args.item}」。`,
  "longPressToSelect": `長按以進入選擇模式。`,
  "select": `選取`,
  "selectedAll": `已選取所有項目。`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `未選取任何項目`,
    one: () => `已選取 ${formatter.number(args.count)} 個項目`,
    other: () => `已選取 ${formatter.number(args.count)} 個項目`
  })}。`,
  "selectedItem": (args) => `已選取「${args.item}」。`
};
var $835c96616a7cb4f9$exports = {};
$835c96616a7cb4f9$exports = {
  "ar-AE": $682989befd4f478d$exports,
  "bg-BG": $f7fca02019afd941$exports,
  "cs-CZ": $8f86f40be75387f1$exports,
  "da-DK": $db24ba43c8d652ee$exports,
  "de-DE": $f8f1e72c8b5447d6$exports,
  "el-GR": $9a73ed2983c3ab0b$exports,
  "en-US": $583de0b3587601b9$exports,
  "es-ES": $147159c978043442$exports,
  "et-EE": $5cbb62c8a19173ac$exports,
  "fi-FI": $a33d71dc804cc59e$exports,
  "fr-FR": $92d800447793d084$exports,
  "he-IL": $fe732cdb32124ea8$exports,
  "hr-HR": $e41234e934efb4f5$exports,
  "hu-HU": $1b0393182473bf9e$exports,
  "it-IT": $2eed782c1c110ce7$exports,
  "ja-JP": $8b5d459f86e9b23c$exports,
  "ko-KR": $1949c3ad17295fd4$exports,
  "lt-LT": $f5e3df4dc8aa7b54$exports,
  "lv-LV": $9dd86690a5c2b2c5$exports,
  "nb-NO": $843964c3bf9a7d24$exports,
  "nl-NL": $73f50e845f9ef3b4$exports,
  "pl-PL": $87f92a7e077514b2$exports,
  "pt-BR": $c28c98d58ee9ff6f$exports,
  "pt-PT": $b6b1503b17b2254d$exports,
  "ro-RO": $8bdaeb71e50c3e1a$exports,
  "ru-RU": $ec2b852dd7c3d1f2$exports,
  "sk-SK": $79e6d900d6a4f82d$exports,
  "sl-SI": $f4c1f0d5d4d03d80$exports,
  "sr-SP": $46252cd87269b10b$exports,
  "sv-SE": $d4d5d8dab362555c$exports,
  "tr-TR": $3d55d1f97c377e83$exports,
  "uk-UA": $5368512f1c703a3f$exports,
  "zh-CN": $f1316b1074463583$exports,
  "zh-TW": $7e60654723031b6f$exports
};
const $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY = 7e3;
let $319e236875307eab$var$liveAnnouncer = null;
function $319e236875307eab$export$a9b970dcc4ae71a9(message, assertiveness = "assertive", timeout = $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY) {
  if (!$319e236875307eab$var$liveAnnouncer) {
    $319e236875307eab$var$liveAnnouncer = new $319e236875307eab$var$LiveAnnouncer();
    if (!(typeof IS_REACT_ACT_ENVIRONMENT === "boolean" ? IS_REACT_ACT_ENVIRONMENT : typeof jest !== "undefined"))
      setTimeout(() => {
        if ($319e236875307eab$var$liveAnnouncer === null || $319e236875307eab$var$liveAnnouncer === void 0 ? void 0 : $319e236875307eab$var$liveAnnouncer.isAttached())
          $319e236875307eab$var$liveAnnouncer === null || $319e236875307eab$var$liveAnnouncer === void 0 ? void 0 : $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
      }, 100);
    else
      $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
  } else
    $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
}
function $319e236875307eab$export$d10ae4f68404609a(assertiveness) {
  if ($319e236875307eab$var$liveAnnouncer)
    $319e236875307eab$var$liveAnnouncer.clear(assertiveness);
}
class $319e236875307eab$var$LiveAnnouncer {
  isAttached() {
    var _this_node;
    return (_this_node = this.node) === null || _this_node === void 0 ? void 0 : _this_node.isConnected;
  }
  createLog(ariaLive) {
    let node2 = document.createElement("div");
    node2.setAttribute("role", "log");
    node2.setAttribute("aria-live", ariaLive);
    node2.setAttribute("aria-relevant", "additions");
    return node2;
  }
  destroy() {
    if (!this.node)
      return;
    document.body.removeChild(this.node);
    this.node = null;
  }
  announce(message, assertiveness = "assertive", timeout = $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY) {
    var _this_assertiveLog, _this_politeLog;
    if (!this.node)
      return;
    let node2 = document.createElement("div");
    if (typeof message === "object") {
      node2.setAttribute("role", "img");
      node2.setAttribute("aria-labelledby", message["aria-labelledby"]);
    } else
      node2.textContent = message;
    if (assertiveness === "assertive")
      (_this_assertiveLog = this.assertiveLog) === null || _this_assertiveLog === void 0 ? void 0 : _this_assertiveLog.appendChild(node2);
    else
      (_this_politeLog = this.politeLog) === null || _this_politeLog === void 0 ? void 0 : _this_politeLog.appendChild(node2);
    if (message !== "")
      setTimeout(() => {
        node2.remove();
      }, timeout);
  }
  clear(assertiveness) {
    if (!this.node)
      return;
    if ((!assertiveness || assertiveness === "assertive") && this.assertiveLog)
      this.assertiveLog.innerHTML = "";
    if ((!assertiveness || assertiveness === "polite") && this.politeLog)
      this.politeLog.innerHTML = "";
  }
  constructor() {
    this.node = null;
    this.assertiveLog = null;
    this.politeLog = null;
    if (typeof document !== "undefined") {
      this.node = document.createElement("div");
      this.node.dataset.liveAnnouncer = "true";
      Object.assign(this.node.style, {
        border: 0,
        clip: "rect(0 0 0 0)",
        clipPath: "inset(50%)",
        height: "1px",
        margin: "-1px",
        overflow: "hidden",
        padding: 0,
        position: "absolute",
        width: "1px",
        whiteSpace: "nowrap"
      });
      this.assertiveLog = this.createLog("assertive");
      this.node.appendChild(this.assertiveLog);
      this.politeLog = this.createLog("polite");
      this.node.appendChild(this.politeLog);
      document.body.prepend(this.node);
    }
  }
}
function $parcel$interopDefault$i(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $92599c3fd427b763$export$137e594ef3218a10(props, state) {
  let { getRowText = (key) => {
    var _state_collection_getTextValue, _state_collection, _state_collection_getItem;
    var _state_collection_getTextValue1;
    return (_state_collection_getTextValue1 = (_state_collection_getTextValue = (_state_collection = state.collection).getTextValue) === null || _state_collection_getTextValue === void 0 ? void 0 : _state_collection_getTextValue.call(_state_collection, key)) !== null && _state_collection_getTextValue1 !== void 0 ? _state_collection_getTextValue1 : (_state_collection_getItem = state.collection.getItem(key)) === null || _state_collection_getItem === void 0 ? void 0 : _state_collection_getItem.textValue;
  } } = props;
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$i($835c96616a7cb4f9$exports), "@react-aria/grid");
  let selection = state.selectionManager.rawSelection;
  let lastSelection = reactExports.useRef(selection);
  let announceSelectionChange = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    var _lastSelection_current;
    if (!state.selectionManager.isFocused || selection === lastSelection.current) {
      lastSelection.current = selection;
      return;
    }
    let addedKeys = $92599c3fd427b763$var$diffSelection(selection, lastSelection.current);
    let removedKeys = $92599c3fd427b763$var$diffSelection(lastSelection.current, selection);
    let isReplace = state.selectionManager.selectionBehavior === "replace";
    let messages2 = [];
    if (state.selectionManager.selectedKeys.size === 1 && isReplace) {
      let firstKey = state.selectionManager.selectedKeys.keys().next().value;
      if (firstKey != null && state.collection.getItem(firstKey)) {
        let currentSelectionText = getRowText(firstKey);
        if (currentSelectionText)
          messages2.push(stringFormatter.format("selectedItem", {
            item: currentSelectionText
          }));
      }
    } else if (addedKeys.size === 1 && removedKeys.size === 0) {
      let firstKey = addedKeys.keys().next().value;
      if (firstKey != null) {
        let addedText = getRowText(firstKey);
        if (addedText)
          messages2.push(stringFormatter.format("selectedItem", {
            item: addedText
          }));
      }
    } else if (removedKeys.size === 1 && addedKeys.size === 0) {
      let firstKey = removedKeys.keys().next().value;
      if (firstKey != null && state.collection.getItem(firstKey)) {
        let removedText = getRowText(firstKey);
        if (removedText)
          messages2.push(stringFormatter.format("deselectedItem", {
            item: removedText
          }));
      }
    }
    if (state.selectionManager.selectionMode === "multiple") {
      if (messages2.length === 0 || selection === "all" || selection.size > 1 || lastSelection.current === "all" || ((_lastSelection_current = lastSelection.current) === null || _lastSelection_current === void 0 ? void 0 : _lastSelection_current.size) > 1)
        messages2.push(selection === "all" ? stringFormatter.format("selectedAll") : stringFormatter.format("selectedCount", {
          count: selection.size
        }));
    }
    if (messages2.length > 0)
      $319e236875307eab$export$a9b970dcc4ae71a9(messages2.join(" "));
    lastSelection.current = selection;
  });
  $4f58c5f72bcf79f7$export$496315a1608d9602(() => {
    if (state.selectionManager.isFocused)
      announceSelectionChange();
    else {
      let raf3 = requestAnimationFrame(announceSelectionChange);
      return () => cancelAnimationFrame(raf3);
    }
  }, [
    selection,
    state.selectionManager.isFocused
  ]);
}
function $92599c3fd427b763$var$diffSelection(a2, b2) {
  let res = /* @__PURE__ */ new Set();
  if (a2 === "all" || b2 === "all")
    return res;
  for (let key of a2.keys())
    if (!b2.has(key))
      res.add(key);
  return res;
}
function $parcel$interopDefault$h(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $5b9b5b5723db6ae1$export$be42ebdab07ae4c2(props) {
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$h($835c96616a7cb4f9$exports), "@react-aria/grid");
  let modality = $507fabe10e71c6fb$export$98e20ec92f614cfe();
  let shouldLongPress = (modality === "pointer" || modality === "virtual" || modality == null) && typeof window !== "undefined" && "ontouchstart" in window;
  let interactionDescription = reactExports.useMemo(() => {
    let selectionMode = props.selectionManager.selectionMode;
    let selectionBehavior = props.selectionManager.selectionBehavior;
    let message;
    if (shouldLongPress)
      message = stringFormatter.format("longPressToSelect");
    return selectionBehavior === "replace" && selectionMode !== "none" && props.hasItemActions ? message : void 0;
  }, [
    props.selectionManager.selectionMode,
    props.selectionManager.selectionBehavior,
    props.hasItemActions,
    stringFormatter,
    shouldLongPress
  ]);
  let descriptionProps = $ef06256079686ba0$export$f8aeda7b10753fa1(interactionDescription);
  return descriptionProps;
}
function $9bf71ea28793e738$var$isTabbableRadio$2(element2) {
  if (element2.checked)
    return true;
  let radios = [];
  if (!element2.form)
    radios = [
      ...$431fbd86ca7dc216$export$b204af158042fbac$4(element2).querySelectorAll(`input[type="radio"][name="${CSS.escape(element2.name)}"]`)
    ].filter((radio2) => !radio2.form);
  else {
    var _element_form_elements, _element_form;
    let radioList = (_element_form = element2.form) === null || _element_form === void 0 ? void 0 : (_element_form_elements = _element_form.elements) === null || _element_form_elements === void 0 ? void 0 : _element_form_elements.namedItem(element2.name);
    radios = [
      ...radioList !== null && radioList !== void 0 ? radioList : []
    ];
  }
  if (!radios)
    return false;
  let anyChecked = radios.some((radio2) => radio2.checked);
  return !anyChecked;
}
function $9bf71ea28793e738$var$isElementInScope$2(element2, scope) {
  if (!element2)
    return false;
  if (!scope)
    return false;
  return scope.some((node2) => node2.contains(element2));
}
function $9bf71ea28793e738$export$2d6ec8fc375ceafa$2(root2, opts2, scope) {
  let filter3 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) ? $b4b717babfbb907b$export$bebd5a1431fec25d : $b4b717babfbb907b$export$4c063cf1350e6fed$3;
  let rootElement = (root2 === null || root2 === void 0 ? void 0 : root2.nodeType) === Node.ELEMENT_NODE ? root2 : null;
  let doc = $431fbd86ca7dc216$export$b204af158042fbac$4(rootElement);
  let walker = $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root2 || doc, NodeFilter.SHOW_ELEMENT, {
    acceptNode(node2) {
      var _opts_from;
      if (opts2 === null || opts2 === void 0 ? void 0 : (_opts_from = opts2.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node2))
        return NodeFilter.FILTER_REJECT;
      if ((opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) && node2.tagName === "INPUT" && node2.getAttribute("type") === "radio") {
        if (!$9bf71ea28793e738$var$isTabbableRadio$2(node2))
          return NodeFilter.FILTER_REJECT;
        if (walker.currentNode.tagName === "INPUT" && walker.currentNode.type === "radio" && walker.currentNode.name === node2.name)
          return NodeFilter.FILTER_REJECT;
      }
      if (filter3(node2) && (!scope || $9bf71ea28793e738$var$isElementInScope$2(node2, scope)) && (!(opts2 === null || opts2 === void 0 ? void 0 : opts2.accept) || opts2.accept(node2)))
        return NodeFilter.FILTER_ACCEPT;
      return NodeFilter.FILTER_SKIP;
    }
  });
  if (opts2 === null || opts2 === void 0 ? void 0 : opts2.from)
    walker.currentNode = opts2.from;
  return walker;
}
let $9bf71ea28793e738$var$Tree$2 = class $9bf71ea28793e738$var$Tree6 {
  get size() {
    return this.fastMap.size;
  }
  getTreeNode(data) {
    return this.fastMap.get(data);
  }
  addTreeNode(scopeRef, parent, nodeToRestore) {
    let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
    if (!parentNode)
      return;
    let node2 = new $9bf71ea28793e738$var$TreeNode$2({
      scopeRef
    });
    parentNode.addChild(node2);
    node2.parent = parentNode;
    this.fastMap.set(scopeRef, node2);
    if (nodeToRestore)
      node2.nodeToRestore = nodeToRestore;
  }
  addNode(node2) {
    this.fastMap.set(node2.scopeRef, node2);
  }
  removeTreeNode(scopeRef) {
    if (scopeRef === null)
      return;
    let node2 = this.fastMap.get(scopeRef);
    if (!node2)
      return;
    let parentNode = node2.parent;
    for (let current of this.traverse())
      if (current !== node2 && node2.nodeToRestore && current.nodeToRestore && node2.scopeRef && node2.scopeRef.current && $9bf71ea28793e738$var$isElementInScope$2(current.nodeToRestore, node2.scopeRef.current))
        current.nodeToRestore = node2.nodeToRestore;
    let children = node2.children;
    if (parentNode) {
      parentNode.removeChild(node2);
      if (children.size > 0)
        children.forEach((child) => parentNode && parentNode.addChild(child));
    }
    this.fastMap.delete(node2.scopeRef);
  }
  // Pre Order Depth First
  *traverse(node2 = this.root) {
    if (node2.scopeRef != null)
      yield node2;
    if (node2.children.size > 0)
      for (let child of node2.children)
        yield* this.traverse(child);
  }
  clone() {
    var _node_parent;
    let newTree = new $9bf71ea28793e738$var$Tree6();
    var _node_parent_scopeRef;
    for (let node2 of this.traverse())
      newTree.addTreeNode(node2.scopeRef, (_node_parent_scopeRef = (_node_parent = node2.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node2.nodeToRestore);
    return newTree;
  }
  constructor() {
    this.fastMap = /* @__PURE__ */ new Map();
    this.root = new $9bf71ea28793e738$var$TreeNode$2({
      scopeRef: null
    });
    this.fastMap.set(null, this.root);
  }
};
let $9bf71ea28793e738$var$TreeNode$2 = class $9bf71ea28793e738$var$TreeNode6 {
  addChild(node2) {
    this.children.add(node2);
    node2.parent = this;
  }
  removeChild(node2) {
    this.children.delete(node2);
    node2.parent = void 0;
  }
  constructor(props) {
    this.children = /* @__PURE__ */ new Set();
    this.contain = false;
    this.scopeRef = props.scopeRef;
  }
};
new $9bf71ea28793e738$var$Tree$2();
function $83013635b024ae3d$export$eac1895992b9f3d6$1(ref, options) {
  let isDisabled = options === null || options === void 0 ? void 0 : options.isDisabled;
  let [hasTabbableChild, setHasTabbableChild] = reactExports.useState(false);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if ((ref === null || ref === void 0 ? void 0 : ref.current) && !isDisabled) {
      let update = () => {
        if (ref.current) {
          let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$2(ref.current, {
            tabbable: true
          });
          setHasTabbableChild(!!walker.nextNode());
        }
      };
      update();
      let observer = new MutationObserver(update);
      observer.observe(ref.current, {
        subtree: true,
        childList: true,
        attributes: true,
        attributeFilter: [
          "tabIndex",
          "disabled"
        ]
      });
      return () => {
        observer.disconnect();
      };
    }
  });
  return isDisabled ? false : hasTabbableChild;
}
function $83c6e2eafa584c67$export$f6b86a04e5d66d90(props, state, ref) {
  let { isVirtualized, disallowTypeAhead, keyboardDelegate, focusMode, scrollRef, getRowText, onRowAction, onCellAction, escapeKeyBehavior = "clearSelection", shouldSelectOnPressUp } = props;
  let { selectionManager: manager } = state;
  if (!props["aria-label"] && !props["aria-labelledby"])
    console.warn("An aria-label or aria-labelledby prop is required for accessibility.");
  let collator = $325a3faab7a68acd$export$a16aca283550c30d$2({
    usage: "search",
    sensitivity: "base"
  });
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let disabledBehavior = state.selectionManager.disabledBehavior;
  let delegate = reactExports.useMemo(() => keyboardDelegate || new $d1c300d9c497e402$export$de9feff04fda126e({
    collection: state.collection,
    disabledKeys: state.disabledKeys,
    disabledBehavior,
    ref,
    direction,
    collator,
    focusMode
  }), [
    keyboardDelegate,
    state.collection,
    state.disabledKeys,
    disabledBehavior,
    ref,
    direction,
    collator,
    focusMode
  ]);
  let { collectionProps } = $ae20dd8cbca75726$export$d6daf82dcd84e87c({
    ref,
    selectionManager: manager,
    keyboardDelegate: delegate,
    isVirtualized,
    scrollRef,
    disallowTypeAhead,
    escapeKeyBehavior
  });
  let id2 = $bdb11010cef70236$export$f680877a34711e37$2(props.id);
  $1af922eb41e03c8f$export$e6235c0d09b995d0.set(state, {
    keyboardDelegate: delegate,
    actions: {
      onRowAction,
      onCellAction
    },
    shouldSelectOnPressUp
  });
  let descriptionProps = $5b9b5b5723db6ae1$export$be42ebdab07ae4c2({
    selectionManager: manager,
    hasItemActions: !!(onRowAction || onCellAction)
  });
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  let onFocus = reactExports.useCallback((e2) => {
    if (manager.isFocused) {
      if (!e2.currentTarget.contains(e2.target))
        manager.setFocused(false);
      return;
    }
    if (!e2.currentTarget.contains(e2.target))
      return;
    manager.setFocused(true);
  }, [
    manager
  ]);
  let navDisabledHandlers = reactExports.useMemo(() => ({
    onBlur: collectionProps.onBlur,
    onFocus
  }), [
    onFocus,
    collectionProps.onBlur
  ]);
  let hasTabbableChild = $83013635b024ae3d$export$eac1895992b9f3d6$1(ref, {
    isDisabled: state.collection.size !== 0
  });
  let gridProps = $3ef42575df84b30b$export$9d1611c77c2fe928$9(
    domProps,
    {
      role: "grid",
      id: id2,
      "aria-multiselectable": manager.selectionMode === "multiple" ? "true" : void 0
    },
    state.isKeyboardNavigationDisabled ? navDisabledHandlers : collectionProps,
    // If collection is empty, make sure the grid is tabbable unless there is a child tabbable element.
    state.collection.size === 0 && {
      tabIndex: hasTabbableChild ? -1 : 0
    } || void 0,
    descriptionProps
  );
  if (isVirtualized) {
    gridProps["aria-rowcount"] = state.collection.size;
    gridProps["aria-colcount"] = state.collection.columnCount;
  }
  $92599c3fd427b763$export$137e594ef3218a10({
    getRowText
  }, state);
  return {
    gridProps
  };
}
function $e45487f8ba1cbdbf$export$d3037f5d3f3e51bf() {
  return {
    rowGroupProps: {
      role: "rowgroup"
    }
  };
}
function $4159a7a9cbb0cc18$export$96357d5a73f686fa(props, state, ref) {
  var _node_props, _node_props1;
  let { node: node2, isVirtualized, shouldSelectOnPressUp, onAction } = props;
  let { actions, shouldSelectOnPressUp: gridShouldSelectOnPressUp } = $1af922eb41e03c8f$export$e6235c0d09b995d0.get(state);
  let onRowAction = actions.onRowAction ? () => {
    var _actions_onRowAction;
    return (_actions_onRowAction = actions.onRowAction) === null || _actions_onRowAction === void 0 ? void 0 : _actions_onRowAction.call(actions, node2.key);
  } : onAction;
  let { itemProps, ...states } = $880e95eb8b93ba9a$export$ecf600387e221c37({
    selectionManager: state.selectionManager,
    key: node2.key,
    ref,
    isVirtualized,
    shouldSelectOnPressUp: gridShouldSelectOnPressUp || shouldSelectOnPressUp,
    onAction: onRowAction || (node2 === null || node2 === void 0 ? void 0 : (_node_props = node2.props) === null || _node_props === void 0 ? void 0 : _node_props.onAction) ? $ff5963eb1fccf552$export$e08e3b67e392101e$9(node2 === null || node2 === void 0 ? void 0 : (_node_props1 = node2.props) === null || _node_props1 === void 0 ? void 0 : _node_props1.onAction, onRowAction) : void 0,
    isDisabled: state.collection.size === 0
  });
  let isSelected = state.selectionManager.isSelected(node2.key);
  let rowProps = {
    role: "row",
    "aria-selected": state.selectionManager.selectionMode !== "none" ? isSelected : void 0,
    "aria-disabled": states.isDisabled || void 0,
    ...itemProps
  };
  if (isVirtualized)
    rowProps["aria-rowindex"] = node2.index + 1;
  return {
    rowProps,
    ...states
  };
}
function $ab90dcbc1b5466d0$export$c7e10bfc0c59f67c(props, state, ref) {
  let { node: node2, isVirtualized, focusMode = "child", shouldSelectOnPressUp, onAction } = props;
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let { keyboardDelegate, actions: { onCellAction } } = $1af922eb41e03c8f$export$e6235c0d09b995d0.get(state);
  let keyWhenFocused = reactExports.useRef(null);
  let focus = () => {
    if (ref.current) {
      let treeWalker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$2(ref.current);
      if (focusMode === "child") {
        if (ref.current.contains(document.activeElement) && ref.current !== document.activeElement)
          return;
        let focusable2 = state.selectionManager.childFocusStrategy === "last" ? $ab90dcbc1b5466d0$var$last(treeWalker) : treeWalker.firstChild();
        if (focusable2) {
          $3ad3f6e1647bc98d$export$80f3e147d781571c$2(focusable2);
          return;
        }
      }
      if (keyWhenFocused.current != null && node2.key !== keyWhenFocused.current || !ref.current.contains(document.activeElement))
        $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
    }
  };
  let { itemProps, isPressed } = $880e95eb8b93ba9a$export$ecf600387e221c37({
    selectionManager: state.selectionManager,
    key: node2.key,
    ref,
    isVirtualized,
    focus,
    shouldSelectOnPressUp,
    onAction: onCellAction ? () => onCellAction(node2.key) : onAction,
    isDisabled: state.collection.size === 0
  });
  let onKeyDownCapture = (e2) => {
    if (!e2.currentTarget.contains(e2.target) || state.isKeyboardNavigationDisabled || !ref.current || !document.activeElement)
      return;
    let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$2(ref.current);
    walker.currentNode = document.activeElement;
    switch (e2.key) {
      case "ArrowLeft": {
        let focusable2 = direction === "rtl" ? walker.nextNode() : walker.previousNode();
        if (focusMode === "child" && focusable2 === ref.current)
          focusable2 = null;
        e2.preventDefault();
        e2.stopPropagation();
        if (focusable2) {
          $3ad3f6e1647bc98d$export$80f3e147d781571c$2(focusable2);
          $2f04cbc44ee30ce0$export$c826860796309d1b(focusable2, {
            containingElement: $62d8ded9296f3872$export$cfa2225e87938781(ref.current)
          });
        } else {
          var _keyboardDelegate_getKeyLeftOf;
          let prev2 = (_keyboardDelegate_getKeyLeftOf = keyboardDelegate.getKeyLeftOf) === null || _keyboardDelegate_getKeyLeftOf === void 0 ? void 0 : _keyboardDelegate_getKeyLeftOf.call(keyboardDelegate, node2.key);
          if (prev2 !== node2.key) {
            var _ref_current_parentElement;
            (_ref_current_parentElement = ref.current.parentElement) === null || _ref_current_parentElement === void 0 ? void 0 : _ref_current_parentElement.dispatchEvent(new KeyboardEvent(e2.nativeEvent.type, e2.nativeEvent));
            break;
          }
          if (focusMode === "cell" && direction === "rtl") {
            $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
            $2f04cbc44ee30ce0$export$c826860796309d1b(ref.current, {
              containingElement: $62d8ded9296f3872$export$cfa2225e87938781(ref.current)
            });
          } else {
            walker.currentNode = ref.current;
            focusable2 = direction === "rtl" ? walker.firstChild() : $ab90dcbc1b5466d0$var$last(walker);
            if (focusable2) {
              $3ad3f6e1647bc98d$export$80f3e147d781571c$2(focusable2);
              $2f04cbc44ee30ce0$export$c826860796309d1b(focusable2, {
                containingElement: $62d8ded9296f3872$export$cfa2225e87938781(ref.current)
              });
            }
          }
        }
        break;
      }
      case "ArrowRight": {
        let focusable2 = direction === "rtl" ? walker.previousNode() : walker.nextNode();
        if (focusMode === "child" && focusable2 === ref.current)
          focusable2 = null;
        e2.preventDefault();
        e2.stopPropagation();
        if (focusable2) {
          $3ad3f6e1647bc98d$export$80f3e147d781571c$2(focusable2);
          $2f04cbc44ee30ce0$export$c826860796309d1b(focusable2, {
            containingElement: $62d8ded9296f3872$export$cfa2225e87938781(ref.current)
          });
        } else {
          var _keyboardDelegate_getKeyRightOf;
          let next2 = (_keyboardDelegate_getKeyRightOf = keyboardDelegate.getKeyRightOf) === null || _keyboardDelegate_getKeyRightOf === void 0 ? void 0 : _keyboardDelegate_getKeyRightOf.call(keyboardDelegate, node2.key);
          if (next2 !== node2.key) {
            var _ref_current_parentElement1;
            (_ref_current_parentElement1 = ref.current.parentElement) === null || _ref_current_parentElement1 === void 0 ? void 0 : _ref_current_parentElement1.dispatchEvent(new KeyboardEvent(e2.nativeEvent.type, e2.nativeEvent));
            break;
          }
          if (focusMode === "cell" && direction === "ltr") {
            $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
            $2f04cbc44ee30ce0$export$c826860796309d1b(ref.current, {
              containingElement: $62d8ded9296f3872$export$cfa2225e87938781(ref.current)
            });
          } else {
            walker.currentNode = ref.current;
            focusable2 = direction === "rtl" ? $ab90dcbc1b5466d0$var$last(walker) : walker.firstChild();
            if (focusable2) {
              $3ad3f6e1647bc98d$export$80f3e147d781571c$2(focusable2);
              $2f04cbc44ee30ce0$export$c826860796309d1b(focusable2, {
                containingElement: $62d8ded9296f3872$export$cfa2225e87938781(ref.current)
              });
            }
          }
        }
        break;
      }
      case "ArrowUp":
      case "ArrowDown":
        if (!e2.altKey && ref.current.contains(e2.target)) {
          var _ref_current_parentElement2;
          e2.stopPropagation();
          e2.preventDefault();
          (_ref_current_parentElement2 = ref.current.parentElement) === null || _ref_current_parentElement2 === void 0 ? void 0 : _ref_current_parentElement2.dispatchEvent(new KeyboardEvent(e2.nativeEvent.type, e2.nativeEvent));
        }
        break;
    }
  };
  let onFocus = (e2) => {
    keyWhenFocused.current = node2.key;
    if (e2.target !== ref.current) {
      if (!$507fabe10e71c6fb$export$b9b3dfddab17db27$2())
        state.selectionManager.setFocusedKey(node2.key);
      return;
    }
    requestAnimationFrame(() => {
      if (focusMode === "child" && document.activeElement === ref.current)
        focus();
    });
  };
  let gridCellProps = $3ef42575df84b30b$export$9d1611c77c2fe928$9(itemProps, {
    role: "gridcell",
    onKeyDownCapture,
    "aria-colspan": node2.colSpan,
    "aria-colindex": node2.colIndex != null ? node2.colIndex + 1 : void 0,
    colSpan: isVirtualized ? void 0 : node2.colSpan,
    onFocus
  });
  var _node_colIndex;
  if (isVirtualized)
    gridCellProps["aria-colindex"] = ((_node_colIndex = node2.colIndex) !== null && _node_colIndex !== void 0 ? _node_colIndex : node2.index) + 1;
  if (shouldSelectOnPressUp && gridCellProps.tabIndex != null && gridCellProps.onPointerDown == null)
    gridCellProps.onPointerDown = (e2) => {
      let el2 = e2.currentTarget;
      let tabindex = el2.getAttribute("tabindex");
      el2.removeAttribute("tabindex");
      requestAnimationFrame(() => {
        if (tabindex != null)
          el2.setAttribute("tabindex", tabindex);
      });
    };
  return {
    gridCellProps,
    isPressed
  };
}
function $ab90dcbc1b5466d0$var$last(walker) {
  let next2 = null;
  let last = null;
  do {
    last = walker.lastChild();
    if (last)
      next2 = last;
  } while (last);
  return next2;
}
function $parcel$interopDefault$g(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $7cb39d07f245a780$export$70e2eed1a92976ad(props, state) {
  let { key } = props;
  let manager = state.selectionManager;
  let checkboxId = $bdb11010cef70236$export$f680877a34711e37$2();
  let isDisabled = !state.selectionManager.canSelectItem(key);
  let isSelected = state.selectionManager.isSelected(key);
  let onChange = () => manager.toggleSelection(key);
  const stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$g($835c96616a7cb4f9$exports), "@react-aria/grid");
  return {
    checkboxProps: {
      id: checkboxId,
      "aria-label": stringFormatter.format("select"),
      isSelected,
      isDisabled,
      onChange
    }
  };
}
class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends $d1c300d9c497e402$export$de9feff04fda126e {
  isCell(node2) {
    return node2.type === "cell" || node2.type === "rowheader" || node2.type === "column";
  }
  getKeyBelow(key) {
    let startItem = this.collection.getItem(key);
    if (!startItem)
      return null;
    if (startItem.type === "column") {
      let child = $c5a24bc478652b5f$export$fbdeaa6a76694f71($c5a24bc478652b5f$export$1005530eda016c13(startItem, this.collection));
      if (child)
        return child.key;
      let firstKey = this.getFirstKey();
      if (firstKey == null)
        return null;
      let firstItem = this.collection.getItem(firstKey);
      if (!firstItem)
        return null;
      return super.getKeyForItemInRowByIndex(firstKey, startItem.index);
    }
    return super.getKeyBelow(key);
  }
  getKeyAbove(key) {
    let startItem = this.collection.getItem(key);
    if (!startItem)
      return null;
    if (startItem.type === "column") {
      let parent = startItem.parentKey != null ? this.collection.getItem(startItem.parentKey) : null;
      if (parent && parent.type === "column")
        return parent.key;
      return null;
    }
    let superKey = super.getKeyAbove(key);
    let superItem = superKey != null ? this.collection.getItem(superKey) : null;
    if (superItem && superItem.type !== "headerrow")
      return superKey;
    if (this.isCell(startItem))
      return this.collection.columns[startItem.index].key;
    return this.collection.columns[0].key;
  }
  findNextColumnKey(column2) {
    let key = this.findNextKey(column2.key, (item) => item.type === "column");
    if (key != null)
      return key;
    let row = this.collection.headerRows[column2.level];
    for (let item of $c5a24bc478652b5f$export$1005530eda016c13(row, this.collection)) {
      if (item.type === "column")
        return item.key;
    }
    return null;
  }
  findPreviousColumnKey(column2) {
    let key = this.findPreviousKey(column2.key, (item) => item.type === "column");
    if (key != null)
      return key;
    let row = this.collection.headerRows[column2.level];
    let childNodes = [
      ...$c5a24bc478652b5f$export$1005530eda016c13(row, this.collection)
    ];
    for (let i2 = childNodes.length - 1; i2 >= 0; i2--) {
      let item = childNodes[i2];
      if (item.type === "column")
        return item.key;
    }
    return null;
  }
  getKeyRightOf(key) {
    let item = this.collection.getItem(key);
    if (!item)
      return null;
    if (item.type === "column")
      return this.direction === "rtl" ? this.findPreviousColumnKey(item) : this.findNextColumnKey(item);
    return super.getKeyRightOf(key);
  }
  getKeyLeftOf(key) {
    let item = this.collection.getItem(key);
    if (!item)
      return null;
    if (item.type === "column")
      return this.direction === "rtl" ? this.findNextColumnKey(item) : this.findPreviousColumnKey(item);
    return super.getKeyLeftOf(key);
  }
  getKeyForSearch(search2, fromKey) {
    if (!this.collator)
      return null;
    let collection = this.collection;
    let key = fromKey !== null && fromKey !== void 0 ? fromKey : this.getFirstKey();
    if (key == null)
      return null;
    let startItem = collection.getItem(key);
    var _startItem_parentKey;
    if ((startItem === null || startItem === void 0 ? void 0 : startItem.type) === "cell")
      key = (_startItem_parentKey = startItem.parentKey) !== null && _startItem_parentKey !== void 0 ? _startItem_parentKey : null;
    let hasWrapped = false;
    while (key != null) {
      let item = collection.getItem(key);
      if (!item)
        return null;
      if (item.textValue) {
        let substring = item.textValue.slice(0, search2.length);
        if (this.collator.compare(substring, search2) === 0)
          return item.key;
      }
      for (let cell of $c5a24bc478652b5f$export$1005530eda016c13(item, this.collection)) {
        let column2 = collection.columns[cell.index];
        if (collection.rowHeaderColumnKeys.has(column2.key) && cell.textValue) {
          let substring = cell.textValue.slice(0, search2.length);
          if (this.collator.compare(substring, search2) === 0) {
            let fromItem = fromKey != null ? collection.getItem(fromKey) : startItem;
            return (fromItem === null || fromItem === void 0 ? void 0 : fromItem.type) === "cell" ? cell.key : item.key;
          }
        }
      }
      key = this.getKeyBelow(key);
      if (key == null && !hasWrapped) {
        key = this.getFirstKey();
        hasWrapped = true;
      }
    }
    return null;
  }
}
function $parcel$interopDefault$f(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $6e31608fbba75bab$export$25bceaac3c7e4dc7(props, state, ref) {
  let { keyboardDelegate, isVirtualized, layoutDelegate, layout: layout2 } = props;
  let collator = $325a3faab7a68acd$export$a16aca283550c30d$2({
    usage: "search",
    sensitivity: "base"
  });
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let disabledBehavior = state.selectionManager.disabledBehavior;
  let delegate = reactExports.useMemo(() => keyboardDelegate || new $0ba3c81c7f1caedd$export$da43f8f5cb04028d({
    collection: state.collection,
    disabledKeys: state.disabledKeys,
    disabledBehavior,
    ref,
    direction,
    collator,
    layoutDelegate,
    layout: layout2
  }), [
    keyboardDelegate,
    state.collection,
    state.disabledKeys,
    disabledBehavior,
    ref,
    direction,
    collator,
    layoutDelegate,
    layout2
  ]);
  let id2 = $bdb11010cef70236$export$f680877a34711e37$2(props.id);
  $2140fb2337097f2d$export$552312adfd451dab.set(state, id2);
  let { gridProps } = $83c6e2eafa584c67$export$f6b86a04e5d66d90({
    ...props,
    id: id2,
    keyboardDelegate: delegate
  }, state, ref);
  if (isVirtualized)
    gridProps["aria-rowcount"] = state.collection.size + state.collection.headerRows.length;
  if ($f4e2df6bd15f8569$export$1b00cb14a96194e6() && "expandedKeys" in state)
    gridProps.role = "treegrid";
  let { column: column2, direction: sortDirection } = state.sortDescriptor || {};
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$f($7476b46781682bf5$exports), "@react-aria/table");
  let sortDescription = reactExports.useMemo(() => {
    var _state_collection_columns_find;
    var _state_collection_columns_find_textValue;
    let columnName = (_state_collection_columns_find_textValue = (_state_collection_columns_find = state.collection.columns.find((c2) => c2.key === column2)) === null || _state_collection_columns_find === void 0 ? void 0 : _state_collection_columns_find.textValue) !== null && _state_collection_columns_find_textValue !== void 0 ? _state_collection_columns_find_textValue : "";
    return sortDirection && column2 ? stringFormatter.format(`${sortDirection}Sort`, {
      columnName
    }) : void 0;
  }, [
    sortDirection,
    column2,
    state.collection.columns
  ]);
  let descriptionProps = $ef06256079686ba0$export$f8aeda7b10753fa1(sortDescription);
  $4f58c5f72bcf79f7$export$496315a1608d9602(() => {
    if (sortDescription)
      $319e236875307eab$export$a9b970dcc4ae71a9(sortDescription, "assertive", 500);
  }, [
    sortDescription
  ]);
  return {
    gridProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(gridProps, descriptionProps, {
      // merge sort description with long press information
      "aria-describedby": [
        descriptionProps["aria-describedby"],
        gridProps["aria-describedby"]
      ].filter(Boolean).join(" ")
    })
  };
}
function $parcel$interopDefault$e(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $f329116d8ad0aba0$export$9514819a8c81e960(props, state, ref) {
  var _state_sortDescriptor, _state_sortDescriptor1;
  let { node: node2 } = props;
  let allowsSorting = node2.props.allowsSorting;
  let { gridCellProps } = $ab90dcbc1b5466d0$export$c7e10bfc0c59f67c({
    ...props,
    focusMode: "child"
  }, state, ref);
  let isSelectionCellDisabled = node2.props.isSelectionCell && state.selectionManager.selectionMode === "single";
  let { pressProps } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    isDisabled: !allowsSorting || isSelectionCellDisabled,
    onPress() {
      state.sort(node2.key);
    },
    ref
  });
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2({}, ref);
  let ariaSort = void 0;
  let isSortedColumn = ((_state_sortDescriptor = state.sortDescriptor) === null || _state_sortDescriptor === void 0 ? void 0 : _state_sortDescriptor.column) === node2.key;
  let sortDirection = (_state_sortDescriptor1 = state.sortDescriptor) === null || _state_sortDescriptor1 === void 0 ? void 0 : _state_sortDescriptor1.direction;
  if (node2.props.allowsSorting && !$c87311424ea30a05$export$a11b0059900ceec8$4())
    ariaSort = isSortedColumn ? sortDirection : "none";
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$e($7476b46781682bf5$exports), "@react-aria/table");
  let sortDescription;
  if (allowsSorting) {
    sortDescription = `${stringFormatter.format("sortable")}`;
    if (isSortedColumn && sortDirection && $c87311424ea30a05$export$a11b0059900ceec8$4())
      sortDescription = `${sortDescription}, ${stringFormatter.format(sortDirection)}`;
  }
  let descriptionProps = $ef06256079686ba0$export$f8aeda7b10753fa1(sortDescription);
  let shouldDisableFocus = state.collection.size === 0;
  reactExports.useEffect(() => {
    if (shouldDisableFocus && state.selectionManager.focusedKey === node2.key)
      state.selectionManager.setFocusedKey(null);
  }, [
    shouldDisableFocus,
    state.selectionManager,
    node2.key
  ]);
  return {
    columnHeaderProps: {
      ...$3ef42575df84b30b$export$9d1611c77c2fe928$9(
        focusableProps,
        gridCellProps,
        pressProps,
        descriptionProps,
        // If the table is empty, make all column headers untabbable
        shouldDisableFocus ? {
          tabIndex: -1
        } : null
      ),
      role: "columnheader",
      id: $2140fb2337097f2d$export$37cd4213f2ad742e(state, node2.key),
      "aria-colspan": node2.colSpan && node2.colSpan > 1 ? node2.colSpan : void 0,
      "aria-sort": ariaSort
    }
  };
}
const $b2db214c022798eb$var$EXPANSION_KEYS = {
  expand: {
    ltr: "ArrowRight",
    rtl: "ArrowLeft"
  },
  "collapse": {
    ltr: "ArrowLeft",
    rtl: "ArrowRight"
  }
};
function $b2db214c022798eb$export$7f2f6ae19e707aa5(props, state, ref) {
  let { node: node2, isVirtualized } = props;
  let { rowProps, ...states } = $4159a7a9cbb0cc18$export$96357d5a73f686fa(props, state, ref);
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  if (isVirtualized && !($f4e2df6bd15f8569$export$1b00cb14a96194e6() && "expandedKeys" in state))
    rowProps["aria-rowindex"] = node2.index + 1 + state.collection.headerRows.length;
  else
    delete rowProps["aria-rowindex"];
  let treeGridRowProps = {};
  if ($f4e2df6bd15f8569$export$1b00cb14a96194e6() && "expandedKeys" in state) {
    let treeNode = state.keyMap.get(node2.key);
    if (treeNode != null) {
      var _treeNode_props, _treeNode_props_children, _treeNode_props1, _getLastItem, _state_keyMap_get, _getLastItem1;
      let hasChildRows = ((_treeNode_props = treeNode.props) === null || _treeNode_props === void 0 ? void 0 : _treeNode_props.UNSTABLE_childItems) || ((_treeNode_props1 = treeNode.props) === null || _treeNode_props1 === void 0 ? void 0 : (_treeNode_props_children = _treeNode_props1.children) === null || _treeNode_props_children === void 0 ? void 0 : _treeNode_props_children.length) > state.userColumnCount;
      var _treeNode_indexOfType, _state_keyMap_get_childNodes, _getLastItem_indexOfType, _getLastItem_indexOfType1;
      treeGridRowProps = {
        onKeyDown: (e2) => {
          if (e2.key === $b2db214c022798eb$var$EXPANSION_KEYS["expand"][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && state.expandedKeys !== "all" && !state.expandedKeys.has(treeNode.key)) {
            state.toggleKey(treeNode.key);
            e2.stopPropagation();
          } else if (e2.key === $b2db214c022798eb$var$EXPANSION_KEYS["collapse"][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && (state.expandedKeys === "all" || state.expandedKeys.has(treeNode.key))) {
            state.toggleKey(treeNode.key);
            e2.stopPropagation();
          }
        },
        "aria-expanded": hasChildRows ? state.expandedKeys === "all" || state.expandedKeys.has(node2.key) : void 0,
        "aria-level": treeNode.level,
        "aria-posinset": ((_treeNode_indexOfType = treeNode.indexOfType) !== null && _treeNode_indexOfType !== void 0 ? _treeNode_indexOfType : 0) + 1,
        "aria-setsize": treeNode.level > 1 ? ((_getLastItem_indexOfType = (_getLastItem = $c5a24bc478652b5f$export$7475b2c64539e4cf((_state_keyMap_get_childNodes = (_state_keyMap_get = state.keyMap.get(treeNode.parentKey)) === null || _state_keyMap_get === void 0 ? void 0 : _state_keyMap_get.childNodes) !== null && _state_keyMap_get_childNodes !== void 0 ? _state_keyMap_get_childNodes : [])) === null || _getLastItem === void 0 ? void 0 : _getLastItem.indexOfType) !== null && _getLastItem_indexOfType !== void 0 ? _getLastItem_indexOfType : 0) + 1 : ((_getLastItem_indexOfType1 = (_getLastItem1 = $c5a24bc478652b5f$export$7475b2c64539e4cf(state.collection.body.childNodes)) === null || _getLastItem1 === void 0 ? void 0 : _getLastItem1.indexOfType) !== null && _getLastItem_indexOfType1 !== void 0 ? _getLastItem_indexOfType1 : 0) + 1
      };
    }
  }
  let syntheticLinkProps = $ea8dcbcb9ea1b556$export$bdc77b0c0a3a85d6(node2.props);
  let linkProps = states.hasAction ? syntheticLinkProps : {};
  return {
    rowProps: {
      ...$3ef42575df84b30b$export$9d1611c77c2fe928$9(rowProps, treeGridRowProps, linkProps),
      "aria-labelledby": $2140fb2337097f2d$export$85069b70317f543(state, node2.key)
    },
    ...states
  };
}
function $f917ee10f4c32dab$export$1b95a7d2d517b841(props, state, ref) {
  let { node: node2, isVirtualized } = props;
  let rowProps = {
    role: "row"
  };
  if (isVirtualized && !($f4e2df6bd15f8569$export$1b00cb14a96194e6() && "expandedKeys" in state))
    rowProps["aria-rowindex"] = node2.index + 1;
  return {
    rowProps
  };
}
function $7713593715703b24$export$49571c903d73624c(props, state, ref) {
  var _props_node_column;
  let { gridCellProps, isPressed } = $ab90dcbc1b5466d0$export$c7e10bfc0c59f67c(props, state, ref);
  let columnKey = (_props_node_column = props.node.column) === null || _props_node_column === void 0 ? void 0 : _props_node_column.key;
  if (columnKey != null && state.collection.rowHeaderColumnKeys.has(columnKey)) {
    gridCellProps.role = "rowheader";
    gridCellProps.id = $2140fb2337097f2d$export$19baff3266315d44(state, props.node.parentKey, columnKey);
  }
  return {
    gridCellProps,
    isPressed
  };
}
function $parcel$interopDefault$d(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $2a795c53a101c542$export$16ea7f650bd7c1bb(props, state) {
  let { key } = props;
  const { checkboxProps } = $7cb39d07f245a780$export$70e2eed1a92976ad(props, state);
  return {
    checkboxProps: {
      ...checkboxProps,
      "aria-labelledby": `${checkboxProps.id} ${$2140fb2337097f2d$export$85069b70317f543(state, key)}`
    }
  };
}
function $2a795c53a101c542$export$1003db6a7e384b99(state) {
  let { isEmpty: isEmpty2, isSelectAll, selectionMode } = state.selectionManager;
  const stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$d($7476b46781682bf5$exports), "@react-aria/table");
  return {
    checkboxProps: {
      "aria-label": stringFormatter.format(selectionMode === "single" ? "select" : "selectAll"),
      isSelected: isSelectAll,
      isDisabled: selectionMode !== "multiple" || state.collection.size === 0 || state.collection.rows.length === 1 && state.collection.rows[0].type === "loader",
      isIndeterminate: !isEmpty2 && !isSelectAll,
      onChange: () => state.selectionManager.toggleSelectAll()
    }
  };
}
function $0047e6c294ea075f$export$6fb1613bd7b28198() {
  return $e45487f8ba1cbdbf$export$d3037f5d3f3e51bf();
}
const $5c3e21d68f1c4674$var$styles = {
  border: 0,
  clip: "rect(0 0 0 0)",
  clipPath: "inset(50%)",
  height: "1px",
  margin: "-1px",
  overflow: "hidden",
  padding: 0,
  position: "absolute",
  width: "1px",
  whiteSpace: "nowrap"
};
function $5c3e21d68f1c4674$export$a966af930f325cab(props = {}) {
  let { style: style2, isFocusable } = props;
  let [isFocused, setFocused] = reactExports.useState(false);
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$4({
    isDisabled: !isFocusable,
    onFocusWithinChange: (val) => setFocused(val)
  });
  let combinedStyles = reactExports.useMemo(() => {
    if (isFocused)
      return style2;
    else if (style2)
      return {
        ...$5c3e21d68f1c4674$var$styles,
        ...style2
      };
    else
      return $5c3e21d68f1c4674$var$styles;
  }, [
    isFocused
  ]);
  return {
    visuallyHiddenProps: {
      ...focusWithinProps,
      style: combinedStyles
    }
  };
}
function $5c3e21d68f1c4674$export$439d29a4e110a164(props) {
  let { children, elementType: Element2 = "div", isFocusable, style: style2, ...otherProps } = props;
  let { visuallyHiddenProps } = $5c3e21d68f1c4674$export$a966af930f325cab(props);
  return /* @__PURE__ */ React$5.createElement(Element2, $3ef42575df84b30b$export$9d1611c77c2fe928$9(otherProps, visuallyHiddenProps), children);
}
var TableSelectAllCheckbox = forwardRef((props, ref) => {
  var _a2, _b2;
  const {
    as: as2,
    className,
    node: node2,
    slots,
    state,
    selectionMode,
    color: color2,
    checkboxesProps,
    disableAnimation,
    classNames: classNames2,
    ...otherProps
  } = props;
  const Component2 = as2 || "th";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const { columnHeaderProps } = $f329116d8ad0aba0$export$9514819a8c81e960({ node: node2 }, state, domRef);
  const { isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const { checkboxProps } = $2a795c53a101c542$export$1003db6a7e384b99(state);
  const thStyles = clsx$4(classNames2 == null ? void 0 : classNames2.th, className, (_a2 = node2.props) == null ? void 0 : _a2.className);
  const isSingleSelectionMode = selectionMode === "single";
  const { onChange, ...otherCheckboxProps } = checkboxProps;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Component2,
    {
      ref: domRef,
      "data-focus-visible": dataAttr(isFocusVisible),
      ...mergeProps$3(
        columnHeaderProps,
        focusProps,
        filterDOMProps(node2.props, {
          enabled: shouldFilterDOMProps
        }),
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        })
      ),
      className: (_b2 = slots.th) == null ? void 0 : _b2.call(slots, { class: thStyles }),
      children: isSingleSelectionMode ? /* @__PURE__ */ jsxRuntimeExports.jsx($5c3e21d68f1c4674$export$439d29a4e110a164, { children: checkboxProps["aria-label"] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
        checkbox_default,
        {
          color: color2,
          disableAnimation,
          onValueChange: onChange,
          ...mergeProps$3(checkboxesProps, otherCheckboxProps)
        }
      )
    }
  );
});
TableSelectAllCheckbox.displayName = "HeroUI.TableSelectAllCheckbox";
var table_select_all_checkbox_default = TableSelectAllCheckbox;
function $62967d126f3aa823$export$4007ac09ff9c68ed(props) {
  let { collection, focusMode } = props;
  let selectionState = props.UNSAFE_selectionState || $7af3f5b51489e0b5$export$253fe78d46329472(props);
  let disabledKeys = reactExports.useMemo(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
    props.disabledKeys
  ]);
  let setFocusedKey = selectionState.setFocusedKey;
  selectionState.setFocusedKey = (key, child) => {
    if (focusMode === "cell" && key != null) {
      let item = collection.getItem(key);
      if ((item === null || item === void 0 ? void 0 : item.type) === "item") {
        var _getLastItem, _getFirstItem;
        let children = $c5a24bc478652b5f$export$1005530eda016c13(item, collection);
        var _getLastItem_key, _getFirstItem_key;
        if (child === "last")
          key = (_getLastItem_key = (_getLastItem = $c5a24bc478652b5f$export$7475b2c64539e4cf(children)) === null || _getLastItem === void 0 ? void 0 : _getLastItem.key) !== null && _getLastItem_key !== void 0 ? _getLastItem_key : null;
        else
          key = (_getFirstItem_key = (_getFirstItem = $c5a24bc478652b5f$export$fbdeaa6a76694f71(children)) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key) !== null && _getFirstItem_key !== void 0 ? _getFirstItem_key : null;
      }
    }
    setFocusedKey(key, child);
  };
  let selectionManager = reactExports.useMemo(() => new $d496c0a20b6e58ec$export$6c8a5aaad13c9852(collection, selectionState), [
    collection,
    selectionState
  ]);
  const cachedCollection = reactExports.useRef(null);
  reactExports.useEffect(() => {
    if (selectionState.focusedKey != null && cachedCollection.current && !collection.getItem(selectionState.focusedKey)) {
      const node2 = cachedCollection.current.getItem(selectionState.focusedKey);
      const parentNode = (node2 === null || node2 === void 0 ? void 0 : node2.parentKey) != null && (node2.type === "cell" || node2.type === "rowheader" || node2.type === "column") ? cachedCollection.current.getItem(node2.parentKey) : node2;
      if (!parentNode) {
        selectionState.setFocusedKey(null);
        return;
      }
      const cachedRows = cachedCollection.current.rows;
      const rows = collection.rows;
      const diff2 = cachedRows.length - rows.length;
      let index2 = Math.min(diff2 > 1 ? Math.max(parentNode.index - diff2 + 1, 0) : parentNode.index, rows.length - 1);
      let newRow = null;
      while (index2 >= 0) {
        if (!selectionManager.isDisabled(rows[index2].key) && rows[index2].type !== "headerrow") {
          newRow = rows[index2];
          break;
        }
        if (index2 < rows.length - 1)
          index2++;
        else {
          if (index2 > parentNode.index)
            index2 = parentNode.index;
          index2--;
        }
      }
      if (newRow) {
        const childNodes = newRow.hasChildNodes ? [
          ...$c5a24bc478652b5f$export$1005530eda016c13(newRow, collection)
        ] : [];
        const keyToFocus = newRow.hasChildNodes && parentNode !== node2 && node2 && node2.index < childNodes.length ? childNodes[node2.index].key : newRow.key;
        selectionState.setFocusedKey(keyToFocus);
      } else
        selectionState.setFocusedKey(null);
    }
    cachedCollection.current = collection;
  }, [
    collection,
    selectionManager,
    selectionState,
    selectionState.focusedKey
  ]);
  return {
    collection,
    disabledKeys,
    isKeyboardNavigationDisabled: false,
    selectionManager
  };
}
class $16805b1b18093c5f$export$de3fdf6493c353d {
  *[Symbol.iterator]() {
    yield* [
      ...this.rows
    ];
  }
  get size() {
    return [
      ...this.rows
    ].length;
  }
  getKeys() {
    return this.keyMap.keys();
  }
  getKeyBefore(key) {
    let node2 = this.keyMap.get(key);
    var _node_prevKey;
    return node2 ? (_node_prevKey = node2.prevKey) !== null && _node_prevKey !== void 0 ? _node_prevKey : null : null;
  }
  getKeyAfter(key) {
    let node2 = this.keyMap.get(key);
    var _node_nextKey;
    return node2 ? (_node_nextKey = node2.nextKey) !== null && _node_nextKey !== void 0 ? _node_nextKey : null : null;
  }
  getFirstKey() {
    var _24;
    return (_24 = [
      ...this.rows
    ][0]) === null || _24 === void 0 ? void 0 : _24.key;
  }
  getLastKey() {
    var _rows_;
    let rows = [
      ...this.rows
    ];
    return (_rows_ = rows[rows.length - 1]) === null || _rows_ === void 0 ? void 0 : _rows_.key;
  }
  getItem(key) {
    var _this_keyMap_get;
    return (_this_keyMap_get = this.keyMap.get(key)) !== null && _this_keyMap_get !== void 0 ? _this_keyMap_get : null;
  }
  at(idx) {
    const keys2 = [
      ...this.getKeys()
    ];
    return this.getItem(keys2[idx]);
  }
  getChildren(key) {
    let node2 = this.keyMap.get(key);
    return (node2 === null || node2 === void 0 ? void 0 : node2.childNodes) || [];
  }
  constructor(opts2) {
    this.keyMap = /* @__PURE__ */ new Map();
    this.keyMap = /* @__PURE__ */ new Map();
    this.columnCount = opts2 === null || opts2 === void 0 ? void 0 : opts2.columnCount;
    this.rows = [];
    let visit2 = (node2) => {
      let prevNode = this.keyMap.get(node2.key);
      if (opts2.visitNode)
        node2 = opts2.visitNode(node2);
      this.keyMap.set(node2.key, node2);
      let childKeys = /* @__PURE__ */ new Set();
      let last2 = null;
      let rowHasCellWithColSpan = false;
      if (node2.type === "item") {
        var _child_props;
        for (let child of node2.childNodes)
          if (((_child_props = child.props) === null || _child_props === void 0 ? void 0 : _child_props.colSpan) !== void 0) {
            rowHasCellWithColSpan = true;
            break;
          }
      }
      for (let child of node2.childNodes) {
        if (child.type === "cell" && rowHasCellWithColSpan) {
          var _child_props1, _child_props2;
          child.colspan = (_child_props1 = child.props) === null || _child_props1 === void 0 ? void 0 : _child_props1.colSpan;
          child.colSpan = (_child_props2 = child.props) === null || _child_props2 === void 0 ? void 0 : _child_props2.colSpan;
          var _last_colIndex, _last_colSpan;
          child.colIndex = !last2 ? child.index : ((_last_colIndex = last2.colIndex) !== null && _last_colIndex !== void 0 ? _last_colIndex : last2.index) + ((_last_colSpan = last2.colSpan) !== null && _last_colSpan !== void 0 ? _last_colSpan : 1);
        }
        if (child.type === "cell" && child.parentKey == null)
          child.parentKey = node2.key;
        childKeys.add(child.key);
        if (last2) {
          last2.nextKey = child.key;
          child.prevKey = last2.key;
        } else
          child.prevKey = null;
        visit2(child);
        last2 = child;
      }
      if (last2)
        last2.nextKey = null;
      if (prevNode) {
        for (let child of prevNode.childNodes)
          if (!childKeys.has(child.key))
            remove(child);
      }
    };
    let remove = (node2) => {
      this.keyMap.delete(node2.key);
      for (let child of node2.childNodes)
        if (this.keyMap.get(child.key) === child)
          remove(child);
    };
    let last = null;
    for (let [i2, node2] of opts2.items.entries()) {
      var _node_level, _node_key, _node_type, _node_value, _node_textValue, _node_index;
      let rowNode = {
        ...node2,
        level: (_node_level = node2.level) !== null && _node_level !== void 0 ? _node_level : 0,
        key: (_node_key = node2.key) !== null && _node_key !== void 0 ? _node_key : "row-" + i2,
        type: (_node_type = node2.type) !== null && _node_type !== void 0 ? _node_type : "row",
        value: (_node_value = node2.value) !== null && _node_value !== void 0 ? _node_value : null,
        hasChildNodes: true,
        childNodes: [
          ...node2.childNodes
        ],
        rendered: node2.rendered,
        textValue: (_node_textValue = node2.textValue) !== null && _node_textValue !== void 0 ? _node_textValue : "",
        index: (_node_index = node2.index) !== null && _node_index !== void 0 ? _node_index : i2
      };
      if (last) {
        last.nextKey = rowNode.key;
        rowNode.prevKey = last.key;
      } else
        rowNode.prevKey = null;
      this.rows.push(rowNode);
      visit2(rowNode);
      last = rowNode;
    }
    if (last)
      last.nextKey = null;
  }
}
const $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY = "row-header-column-" + Math.random().toString(36).slice(2);
let $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY_DRAG = "row-header-column-" + Math.random().toString(36).slice(2);
while ($788781baa30117fa$var$ROW_HEADER_COLUMN_KEY === $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY_DRAG)
  $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY_DRAG = "row-header-column-" + Math.random().toString(36).slice(2);
function $788781baa30117fa$export$7c127db850d4e81e(keyMap, columnNodes) {
  if (columnNodes.length === 0)
    return [];
  let columns = [];
  let seen2 = /* @__PURE__ */ new Map();
  for (let column2 of columnNodes) {
    let parentKey = column2.parentKey;
    let col = [
      column2
    ];
    while (parentKey) {
      let parent = keyMap.get(parentKey);
      if (!parent)
        break;
      if (seen2.has(parent)) {
        var _parent;
        var _colSpan;
        (_colSpan = (_parent = parent).colSpan) !== null && _colSpan !== void 0 ? _colSpan : _parent.colSpan = 0;
        parent.colSpan++;
        parent.colspan = parent.colSpan;
        let { column: column3, index: index2 } = seen2.get(parent);
        if (index2 > col.length)
          break;
        for (let i3 = index2; i3 < col.length; i3++)
          column3.splice(i3, 0, null);
        for (let i3 = col.length; i3 < column3.length; i3++)
          if (column3[i3] && seen2.has(column3[i3]))
            seen2.get(column3[i3]).index = i3;
      } else {
        parent.colSpan = 1;
        parent.colspan = 1;
        col.push(parent);
        seen2.set(parent, {
          column: col,
          index: col.length - 1
        });
      }
      parentKey = parent.parentKey;
    }
    columns.push(col);
    column2.index = columns.length - 1;
  }
  let maxLength = Math.max(...columns.map((c2) => c2.length));
  let headerRows = Array(maxLength).fill(0).map(() => []);
  let colIndex = 0;
  for (let column2 of columns) {
    let i3 = maxLength - 1;
    for (let item of column2) {
      if (item) {
        let row = headerRows[i3];
        let rowLength = row.reduce((p2, c2) => {
          var _c_colSpan;
          return p2 + ((_c_colSpan = c2.colSpan) !== null && _c_colSpan !== void 0 ? _c_colSpan : 1);
        }, 0);
        if (rowLength < colIndex) {
          let placeholder = {
            type: "placeholder",
            key: "placeholder-" + item.key,
            colspan: colIndex - rowLength,
            colSpan: colIndex - rowLength,
            index: rowLength,
            value: null,
            rendered: null,
            level: i3,
            hasChildNodes: false,
            childNodes: [],
            textValue: ""
          };
          if (row.length > 0) {
            row[row.length - 1].nextKey = placeholder.key;
            placeholder.prevKey = row[row.length - 1].key;
          }
          row.push(placeholder);
        }
        if (row.length > 0) {
          row[row.length - 1].nextKey = item.key;
          item.prevKey = row[row.length - 1].key;
        }
        item.level = i3;
        item.colIndex = colIndex;
        row.push(item);
      }
      i3--;
    }
    colIndex++;
  }
  let i2 = 0;
  for (let row of headerRows) {
    let rowLength = row.reduce((p2, c2) => {
      var _c_colSpan;
      return p2 + ((_c_colSpan = c2.colSpan) !== null && _c_colSpan !== void 0 ? _c_colSpan : 1);
    }, 0);
    if (rowLength < columnNodes.length) {
      let placeholder = {
        type: "placeholder",
        key: "placeholder-" + row[row.length - 1].key,
        colSpan: columnNodes.length - rowLength,
        colspan: columnNodes.length - rowLength,
        index: rowLength,
        value: null,
        rendered: null,
        level: i2,
        hasChildNodes: false,
        childNodes: [],
        textValue: "",
        prevKey: row[row.length - 1].key
      };
      row.push(placeholder);
    }
    i2++;
  }
  return headerRows.map((childNodes, index2) => {
    let row = {
      type: "headerrow",
      key: "headerrow-" + index2,
      index: index2,
      value: null,
      rendered: null,
      level: 0,
      hasChildNodes: true,
      childNodes,
      textValue: ""
    };
    return row;
  });
}
class $788781baa30117fa$export$596e1b2e2cf93690 extends $16805b1b18093c5f$export$de3fdf6493c353d {
  *[Symbol.iterator]() {
    yield* this.body.childNodes;
  }
  get size() {
    return this._size;
  }
  getKeys() {
    return this.keyMap.keys();
  }
  getKeyBefore(key) {
    let node2 = this.keyMap.get(key);
    var _node_prevKey;
    return (_node_prevKey = node2 === null || node2 === void 0 ? void 0 : node2.prevKey) !== null && _node_prevKey !== void 0 ? _node_prevKey : null;
  }
  getKeyAfter(key) {
    let node2 = this.keyMap.get(key);
    var _node_nextKey;
    return (_node_nextKey = node2 === null || node2 === void 0 ? void 0 : node2.nextKey) !== null && _node_nextKey !== void 0 ? _node_nextKey : null;
  }
  getFirstKey() {
    var _getFirstItem;
    var _getFirstItem_key;
    return (_getFirstItem_key = (_getFirstItem = $c5a24bc478652b5f$export$fbdeaa6a76694f71(this.body.childNodes)) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key) !== null && _getFirstItem_key !== void 0 ? _getFirstItem_key : null;
  }
  getLastKey() {
    var _getLastItem;
    var _getLastItem_key;
    return (_getLastItem_key = (_getLastItem = $c5a24bc478652b5f$export$7475b2c64539e4cf(this.body.childNodes)) === null || _getLastItem === void 0 ? void 0 : _getLastItem.key) !== null && _getLastItem_key !== void 0 ? _getLastItem_key : null;
  }
  getItem(key) {
    var _this_keyMap_get;
    return (_this_keyMap_get = this.keyMap.get(key)) !== null && _this_keyMap_get !== void 0 ? _this_keyMap_get : null;
  }
  at(idx) {
    const keys2 = [
      ...this.getKeys()
    ];
    return this.getItem(keys2[idx]);
  }
  getChildren(key) {
    if (key === this.body.key)
      return this.body.childNodes;
    return super.getChildren(key);
  }
  getTextValue(key) {
    let row = this.getItem(key);
    if (!row)
      return "";
    if (row.textValue)
      return row.textValue;
    let rowHeaderColumnKeys = this.rowHeaderColumnKeys;
    if (rowHeaderColumnKeys) {
      let text2 = [];
      for (let cell of row.childNodes) {
        let column2 = this.columns[cell.index];
        if (rowHeaderColumnKeys.has(column2.key) && cell.textValue)
          text2.push(cell.textValue);
        if (text2.length === rowHeaderColumnKeys.size)
          break;
      }
      return text2.join(" ");
    }
    return "";
  }
  constructor(nodes, prev2, opts2) {
    let rowHeaderColumnKeys = /* @__PURE__ */ new Set();
    let body = null;
    let columns = [];
    if (opts2 === null || opts2 === void 0 ? void 0 : opts2.showSelectionCheckboxes) {
      let rowHeaderColumn = {
        type: "column",
        key: $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY,
        value: null,
        textValue: "",
        level: 0,
        index: (opts2 === null || opts2 === void 0 ? void 0 : opts2.showDragButtons) ? 1 : 0,
        hasChildNodes: false,
        rendered: null,
        childNodes: [],
        props: {
          isSelectionCell: true
        }
      };
      columns.unshift(rowHeaderColumn);
    }
    if (opts2 === null || opts2 === void 0 ? void 0 : opts2.showDragButtons) {
      let rowHeaderColumn = {
        type: "column",
        key: $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY_DRAG,
        value: null,
        textValue: "",
        level: 0,
        index: 0,
        hasChildNodes: false,
        rendered: null,
        childNodes: [],
        props: {
          isDragButtonCell: true
        }
      };
      columns.unshift(rowHeaderColumn);
    }
    let rows = [];
    let columnKeyMap = /* @__PURE__ */ new Map();
    let visit2 = (node2) => {
      switch (node2.type) {
        case "body":
          body = node2;
          break;
        case "column":
          columnKeyMap.set(node2.key, node2);
          if (!node2.hasChildNodes) {
            columns.push(node2);
            if (node2.props.isRowHeader)
              rowHeaderColumnKeys.add(node2.key);
          }
          break;
        case "item":
          rows.push(node2);
          return;
      }
      for (let child of node2.childNodes)
        visit2(child);
    };
    for (let node2 of nodes)
      visit2(node2);
    let headerRows = $788781baa30117fa$export$7c127db850d4e81e(columnKeyMap, columns);
    headerRows.forEach((row, i2) => rows.splice(i2, 0, row));
    super({
      columnCount: columns.length,
      items: rows,
      visitNode: (node2) => {
        node2.column = columns[node2.index];
        return node2;
      }
    }), this._size = 0;
    this.columns = columns;
    this.rowHeaderColumnKeys = rowHeaderColumnKeys;
    this.body = body;
    this.headerRows = headerRows;
    this._size = [
      ...body.childNodes
    ].length;
    if (this.rowHeaderColumnKeys.size === 0) {
      let col = this.columns.find((column2) => {
        var _column_props, _column_props1;
        return !((_column_props = column2.props) === null || _column_props === void 0 ? void 0 : _column_props.isDragButtonCell) && !((_column_props1 = column2.props) === null || _column_props1 === void 0 ? void 0 : _column_props1.isSelectionCell);
      });
      if (col)
        this.rowHeaderColumnKeys.add(col.key);
    }
  }
}
const $4a0dd036d492cee4$var$OPPOSITE_SORT_DIRECTION = {
  ascending: "descending",
  descending: "ascending"
};
function $4a0dd036d492cee4$export$907bcc6c48325fd6(props) {
  let [isKeyboardNavigationDisabled, setKeyboardNavigationDisabled] = reactExports.useState(false);
  let { selectionMode = "none", showSelectionCheckboxes, showDragButtons } = props;
  let context = reactExports.useMemo(() => ({
    showSelectionCheckboxes: showSelectionCheckboxes && selectionMode !== "none",
    showDragButtons,
    selectionMode,
    columns: []
  }), [
    props.children,
    showSelectionCheckboxes,
    selectionMode,
    showDragButtons
  ]);
  let collection = $7613b1592d41b092$export$6cd28814d92fa9c9(props, reactExports.useCallback((nodes) => new $788781baa30117fa$export$596e1b2e2cf93690(nodes, null, context), [
    context
  ]), context);
  let { disabledKeys, selectionManager } = $62967d126f3aa823$export$4007ac09ff9c68ed({
    ...props,
    collection,
    disabledBehavior: props.disabledBehavior || "selection"
  });
  var _props_sortDescriptor;
  return {
    collection,
    disabledKeys,
    selectionManager,
    showSelectionCheckboxes: props.showSelectionCheckboxes || false,
    sortDescriptor: (_props_sortDescriptor = props.sortDescriptor) !== null && _props_sortDescriptor !== void 0 ? _props_sortDescriptor : null,
    isKeyboardNavigationDisabled: collection.size === 0 || isKeyboardNavigationDisabled,
    setKeyboardNavigationDisabled,
    sort(columnKey, direction) {
      var _props_sortDescriptor2, _props_onSortChange;
      (_props_onSortChange = props.onSortChange) === null || _props_onSortChange === void 0 ? void 0 : _props_onSortChange.call(props, {
        column: columnKey,
        direction: direction !== null && direction !== void 0 ? direction : ((_props_sortDescriptor2 = props.sortDescriptor) === null || _props_sortDescriptor2 === void 0 ? void 0 : _props_sortDescriptor2.column) === columnKey ? $4a0dd036d492cee4$var$OPPOSITE_SORT_DIRECTION[props.sortDescriptor.direction] : "ascending"
      });
    }
  };
}
function $312ae3b56a94a86e$var$TableHeader(props) {
  return null;
}
$312ae3b56a94a86e$var$TableHeader.getCollectionNode = function* getCollectionNode2(props, context) {
  let { children, columns } = props;
  context.columns = [];
  if (typeof children === "function") {
    if (!columns)
      throw new Error("props.children was a function but props.columns is missing");
    for (let column2 of columns)
      yield {
        type: "column",
        value: column2,
        renderer: children
      };
  } else {
    let columns2 = [];
    React$5.Children.forEach(children, (column2) => {
      columns2.push({
        type: "column",
        element: column2
      });
    });
    yield* columns2;
  }
};
let $312ae3b56a94a86e$export$f850895b287ef28e = $312ae3b56a94a86e$var$TableHeader;
function $4ae5314bf50db1a3$var$TableBody(props) {
  return null;
}
$4ae5314bf50db1a3$var$TableBody.getCollectionNode = function* getCollectionNode3(props) {
  let { children, items } = props;
  yield {
    type: "body",
    hasChildNodes: true,
    props,
    *childNodes() {
      if (typeof children === "function") {
        if (!items)
          throw new Error("props.children was a function but props.items is missing");
        for (let item of items)
          yield {
            type: "item",
            value: item,
            renderer: children
          };
      } else {
        let items2 = [];
        React$5.Children.forEach(children, (item) => {
          items2.push({
            type: "item",
            element: item
          });
        });
        yield* items2;
      }
    }
  };
};
let $4ae5314bf50db1a3$export$76ccd210b9029917 = $4ae5314bf50db1a3$var$TableBody;
function $1cd244557c2f97d5$var$Column(props) {
  return null;
}
$1cd244557c2f97d5$var$Column.getCollectionNode = function* getCollectionNode4(props, context) {
  let { title, children, childColumns } = props;
  let rendered = title || children;
  let textValue = props.textValue || (typeof rendered === "string" ? rendered : "") || props["aria-label"];
  let fullNodes = yield {
    type: "column",
    hasChildNodes: !!childColumns || !!title && React$5.Children.count(children) > 0,
    rendered,
    textValue,
    props,
    *childNodes() {
      if (childColumns)
        for (let child of childColumns)
          yield {
            type: "column",
            value: child
          };
      else if (title) {
        let childColumns2 = [];
        React$5.Children.forEach(children, (child) => {
          childColumns2.push({
            type: "column",
            element: child
          });
        });
        yield* childColumns2;
      }
    },
    shouldInvalidate(newContext) {
      updateContext(newContext);
      return false;
    }
  };
  let updateContext = (context2) => {
    for (let node2 of fullNodes)
      if (!node2.hasChildNodes)
        context2.columns.push(node2);
  };
  updateContext(context);
};
let $1cd244557c2f97d5$export$816b5d811295e6bc = $1cd244557c2f97d5$var$Column;
function $70d70eb16ea48428$var$Row(props) {
  return null;
}
$70d70eb16ea48428$var$Row.getCollectionNode = function* getCollectionNode5(props, context) {
  let { children, textValue, UNSTABLE_childItems } = props;
  yield {
    type: "item",
    props,
    textValue,
    "aria-label": props["aria-label"],
    hasChildNodes: true,
    *childNodes() {
      if (context.showDragButtons)
        yield {
          type: "cell",
          key: "header-drag",
          props: {
            isDragButtonCell: true
          }
        };
      if (context.showSelectionCheckboxes && context.selectionMode !== "none")
        yield {
          type: "cell",
          key: "header",
          props: {
            isSelectionCell: true
          }
        };
      if (typeof children === "function") {
        for (let column2 of context.columns)
          yield {
            type: "cell",
            element: children(column2.key),
            key: column2.key
            // this is combined with the row key by CollectionBuilder
          };
        if (UNSTABLE_childItems)
          for (let child of UNSTABLE_childItems)
            yield {
              type: "item",
              value: child
            };
      } else {
        let cells = [];
        let childRows = [];
        let columnCount = 0;
        React$5.Children.forEach(children, (node2) => {
          if (node2.type === $70d70eb16ea48428$var$Row) {
            if (cells.length < context.columns.length)
              throw new Error("All of a Row's child Cells must be positioned before any child Rows.");
            childRows.push({
              type: "item",
              element: node2
            });
          } else {
            cells.push({
              type: "cell",
              element: node2
            });
            var _node_props_colSpan;
            columnCount += (_node_props_colSpan = node2.props.colSpan) !== null && _node_props_colSpan !== void 0 ? _node_props_colSpan : 1;
          }
        });
        if (columnCount !== context.columns.length)
          throw new Error(`Cell count must match column count. Found ${columnCount} cells and ${context.columns.length} columns.`);
        yield* cells;
        yield* childRows;
      }
    },
    shouldInvalidate(newContext) {
      return newContext.columns.length !== context.columns.length || newContext.columns.some((c2, i2) => c2.key !== context.columns[i2].key) || newContext.showSelectionCheckboxes !== context.showSelectionCheckboxes || newContext.showDragButtons !== context.showDragButtons || newContext.selectionMode !== context.selectionMode;
    }
  };
};
let $70d70eb16ea48428$export$b59bdbef9ce70de2 = $70d70eb16ea48428$var$Row;
function $941d1d9a6a28982a$var$Cell(props) {
  return null;
}
$941d1d9a6a28982a$var$Cell.getCollectionNode = function* getCollectionNode6(props) {
  let { children } = props;
  let textValue = props.textValue || (typeof children === "string" ? children : "") || props["aria-label"] || "";
  yield {
    type: "cell",
    props,
    rendered: children,
    textValue,
    "aria-label": props["aria-label"],
    hasChildNodes: false
  };
};
let $941d1d9a6a28982a$export$f6f0c3fe4ec306ea = $941d1d9a6a28982a$var$Cell;
function useTable(originalProps) {
  var _a2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, table$1.variantKeys);
  const {
    ref,
    as: as2,
    baseRef,
    children,
    className,
    classNames: classNames2,
    removeWrapper = false,
    disableAnimation = (_a2 = globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _a2 : false,
    isKeyboardNavigationDisabled = false,
    selectionMode = "none",
    topContentPlacement = "inside",
    bottomContentPlacement = "inside",
    selectionBehavior = selectionMode === "none" ? null : "toggle",
    disabledBehavior = "selection",
    showSelectionCheckboxes = selectionMode === "multiple" && selectionBehavior !== "replace",
    BaseComponent = "div",
    checkboxesProps,
    topContent,
    bottomContent,
    sortIcon,
    onRowAction,
    onCellAction,
    ...otherProps
  } = props;
  const Component2 = as2 || "table";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const domBaseRef = useDOMRef(baseRef);
  const state = $4a0dd036d492cee4$export$907bcc6c48325fd6({
    ...originalProps,
    children,
    showSelectionCheckboxes
  });
  if (isKeyboardNavigationDisabled && !state.isKeyboardNavigationDisabled) {
    state.setKeyboardNavigationDisabled(true);
  }
  const { collection } = state;
  const { layout: layout2, ...otherOriginalProps } = originalProps;
  const { gridProps } = $6e31608fbba75bab$export$25bceaac3c7e4dc7({ ...otherOriginalProps }, state, domRef);
  const isSelectable = selectionMode !== "none";
  const isMultiSelectable = selectionMode === "multiple";
  const slots = reactExports.useMemo(
    () => table$1({
      ...variantProps2,
      isSelectable,
      isMultiSelectable
    }),
    [objectToDeps(variantProps2), isSelectable, isMultiSelectable]
  );
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const values = reactExports.useMemo(
    () => {
      var _a22;
      return {
        state,
        slots,
        isSelectable,
        collection,
        classNames: classNames2,
        color: originalProps == null ? void 0 : originalProps.color,
        disableAnimation,
        checkboxesProps,
        isHeaderSticky: (_a22 = originalProps == null ? void 0 : originalProps.isHeaderSticky) != null ? _a22 : false,
        selectionMode,
        selectionBehavior,
        disabledBehavior,
        showSelectionCheckboxes,
        onRowAction,
        onCellAction
      };
    },
    [
      slots,
      state,
      collection,
      isSelectable,
      classNames2,
      selectionMode,
      selectionBehavior,
      checkboxesProps,
      disabledBehavior,
      disableAnimation,
      showSelectionCheckboxes,
      originalProps == null ? void 0 : originalProps.color,
      originalProps == null ? void 0 : originalProps.isHeaderSticky,
      onRowAction,
      onCellAction
    ]
  );
  const getBaseProps = reactExports.useCallback(
    (props2) => ({
      ...props2,
      ref: domBaseRef,
      className: slots.base({ class: clsx$4(baseStyles, props2 == null ? void 0 : props2.className) })
    }),
    [baseStyles, slots]
  );
  const getWrapperProps = reactExports.useCallback(
    (props2) => ({
      ...props2,
      ref: domBaseRef,
      className: slots.wrapper({ class: clsx$4(classNames2 == null ? void 0 : classNames2.wrapper, props2 == null ? void 0 : props2.className) })
    }),
    [classNames2 == null ? void 0 : classNames2.wrapper, slots]
  );
  const getTableProps = reactExports.useCallback(
    (props2) => ({
      ...mergeProps$3(
        gridProps,
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        }),
        props2
      ),
      // avoid typeahead debounce wait for input / textarea
      // so that typing with space won't be blocked
      onKeyDownCapture: void 0,
      ref: domRef,
      className: slots.table({ class: clsx$4(classNames2 == null ? void 0 : classNames2.table, props2 == null ? void 0 : props2.className) })
    }),
    [classNames2 == null ? void 0 : classNames2.table, shouldFilterDOMProps, slots, gridProps, otherProps]
  );
  return {
    BaseComponent,
    Component: Component2,
    children,
    state,
    collection,
    values,
    topContent,
    bottomContent,
    removeWrapper,
    topContentPlacement,
    bottomContentPlacement,
    sortIcon,
    getBaseProps,
    getWrapperProps,
    getTableProps
  };
}
var TableCell$1 = forwardRef((props, ref) => {
  var _a2, _b2, _c2;
  const { as: as2, className, node: node2, rowKey, slots, state, classNames: classNames2, ...otherProps } = props;
  const Component2 = as2 || "td";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const { gridCellProps } = $7713593715703b24$export$49571c903d73624c({ node: node2 }, state, domRef);
  const tdStyles = clsx$4(classNames2 == null ? void 0 : classNames2.td, className, (_a2 = node2.props) == null ? void 0 : _a2.className);
  const { isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const isRowSelected = state.selectionManager.isSelected(rowKey);
  const cell = reactExports.useMemo(() => {
    const cellType = typeof node2.rendered;
    return cellType !== "object" && cellType !== "function" ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: node2.rendered }) : node2.rendered;
  }, [node2.rendered]);
  const columnProps = ((_b2 = node2.column) == null ? void 0 : _b2.props) || {};
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Component2,
    {
      ref: domRef,
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-selected": dataAttr(isRowSelected),
      ...mergeProps$3(
        gridCellProps,
        focusProps,
        filterDOMProps(node2.props, {
          enabled: shouldFilterDOMProps
        }),
        otherProps
      ),
      className: (_c2 = slots.td) == null ? void 0 : _c2.call(slots, { align: columnProps.align, class: tdStyles }),
      children: cell
    }
  );
});
TableCell$1.displayName = "HeroUI.TableCell";
var table_cell_default$1 = TableCell$1;
var TableCheckboxCell = forwardRef((props, ref) => {
  var _a2, _b2;
  const {
    as: as2,
    className,
    node: node2,
    rowKey,
    slots,
    state,
    color: color2,
    disableAnimation,
    checkboxesProps,
    selectionMode,
    classNames: classNames2,
    ...otherProps
  } = props;
  const Component2 = as2 || "td";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const { gridCellProps } = $7713593715703b24$export$49571c903d73624c({ node: node2 }, state, domRef);
  const { isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const { checkboxProps } = $2a795c53a101c542$export$16ea7f650bd7c1bb({ key: (node2 == null ? void 0 : node2.parentKey) || node2.key }, state);
  const tdStyles = clsx$4(classNames2 == null ? void 0 : classNames2.td, className, (_a2 = node2.props) == null ? void 0 : _a2.className);
  const isSingleSelectionMode = selectionMode === "single";
  const { onChange, ...otherCheckboxProps } = checkboxProps;
  const isRowSelected = state.selectionManager.isSelected(rowKey);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Component2,
    {
      ref: domRef,
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-selected": dataAttr(isRowSelected),
      ...mergeProps$3(
        gridCellProps,
        focusProps,
        filterDOMProps(node2.props, {
          enabled: shouldFilterDOMProps
        }),
        otherProps
      ),
      className: (_b2 = slots.td) == null ? void 0 : _b2.call(slots, { class: tdStyles }),
      children: isSingleSelectionMode ? /* @__PURE__ */ jsxRuntimeExports.jsx($5c3e21d68f1c4674$export$439d29a4e110a164, { children: checkboxProps["aria-label"] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
        checkbox_default,
        {
          color: color2,
          disableAnimation,
          onValueChange: onChange,
          ...mergeProps$3(checkboxesProps, otherCheckboxProps)
        }
      )
    }
  );
});
TableCheckboxCell.displayName = "HeroUI.TableCheckboxCell";
var table_checkbox_cell_default = TableCheckboxCell;
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$7 = false;
let $6179b936705e76d3$var$hoverCount$7 = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$7() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$7 = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$7 = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$7(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$7();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$7() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$7);
  $6179b936705e76d3$var$hoverCount$7++;
  return () => {
    $6179b936705e76d3$var$hoverCount$7--;
    if ($6179b936705e76d3$var$hoverCount$7 > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$7);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$7(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$7, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$7 && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
var TableRow$1 = forwardRef((props, ref) => {
  var _a2, _b2;
  const { as: as2, className, children, node: node2, slots, state, isSelectable, classNames: classNames2, ...otherProps } = props;
  const Component2 = as2 || ((props == null ? void 0 : props.href) ? "a" : "tr");
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const { rowProps } = $b2db214c022798eb$export$7f2f6ae19e707aa5({ node: node2 }, state, domRef);
  const trStyles = clsx$4(classNames2 == null ? void 0 : classNames2.tr, className, (_a2 = node2.props) == null ? void 0 : _a2.className);
  const { isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const isDisabled = state.disabledKeys.has(node2.key);
  const isSelected = state.selectionManager.isSelected(node2.key);
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$7({ isDisabled });
  const { isFirst, isLast, isMiddle, isOdd } = reactExports.useMemo(() => {
    const isFirst2 = node2.key === state.collection.getFirstKey();
    const isLast2 = node2.key === state.collection.getLastKey();
    const isMiddle2 = !isFirst2 && !isLast2;
    const isOdd2 = (node2 == null ? void 0 : node2.index) ? (node2.index + 1) % 2 === 0 : false;
    return {
      isFirst: isFirst2,
      isLast: isLast2,
      isMiddle: isMiddle2,
      isOdd: isOdd2
    };
  }, [node2, state.collection]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Component2,
    {
      ref: domRef,
      "data-disabled": dataAttr(isDisabled),
      "data-first": dataAttr(isFirst),
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-hover": dataAttr(isHovered),
      "data-last": dataAttr(isLast),
      "data-middle": dataAttr(isMiddle),
      "data-odd": dataAttr(isOdd),
      "data-selected": dataAttr(isSelected),
      ...mergeProps$3(
        rowProps,
        focusProps,
        isSelectable ? hoverProps : {},
        filterDOMProps(node2.props, {
          enabled: shouldFilterDOMProps
        }),
        otherProps
      ),
      className: (_b2 = slots.tr) == null ? void 0 : _b2.call(slots, { class: trStyles }),
      children
    }
  );
});
TableRow$1.displayName = "HeroUI.TableRow";
var table_row_default$1 = TableRow$1;
var VirtualizedTableBody = forwardRef((props, ref) => {
  var _a2;
  const {
    as: as2,
    className,
    slots,
    state,
    collection,
    isSelectable,
    color: color2,
    disableAnimation,
    checkboxesProps,
    selectionMode,
    classNames: classNames2,
    rowVirtualizer,
    ...otherProps
  } = props;
  const Component2 = as2 || "tbody";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const { rowGroupProps } = $0047e6c294ea075f$export$6fb1613bd7b28198();
  const tbodyStyles = clsx$4(classNames2 == null ? void 0 : classNames2.tbody, className);
  const bodyProps = collection == null ? void 0 : collection.body.props;
  const isLoading = (bodyProps == null ? void 0 : bodyProps.isLoading) || (bodyProps == null ? void 0 : bodyProps.loadingState) === "loading" || (bodyProps == null ? void 0 : bodyProps.loadingState) === "loadingMore";
  const items = [...collection.body.childNodes];
  const virtualItems = rowVirtualizer.getVirtualItems();
  let emptyContent;
  let loadingContent;
  if (collection.size === 0 && bodyProps.emptyContent) {
    emptyContent = /* @__PURE__ */ jsxRuntimeExports.jsx("tr", { role: "row", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "td",
      {
        className: slots == null ? void 0 : slots.emptyWrapper({ class: classNames2 == null ? void 0 : classNames2.emptyWrapper }),
        colSpan: collection.columnCount,
        role: "gridcell",
        children: !isLoading && bodyProps.emptyContent
      }
    ) });
  }
  if (isLoading && bodyProps.loadingContent) {
    loadingContent = /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { role: "row", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        "td",
        {
          className: slots == null ? void 0 : slots.loadingWrapper({ class: classNames2 == null ? void 0 : classNames2.loadingWrapper }),
          colSpan: collection.columnCount,
          role: "gridcell",
          children: bodyProps.loadingContent
        }
      ),
      !emptyContent && collection.size === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: slots == null ? void 0 : slots.emptyWrapper({ class: classNames2 == null ? void 0 : classNames2.emptyWrapper }) }) : null
    ] });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Component2,
    {
      ref: domRef,
      ...mergeProps$3(
        rowGroupProps,
        filterDOMProps(bodyProps, {
          enabled: shouldFilterDOMProps
        }),
        otherProps
      ),
      className: (_a2 = slots.tbody) == null ? void 0 : _a2.call(slots, { class: tbodyStyles }),
      "data-empty": dataAttr(collection.size === 0),
      "data-loading": dataAttr(isLoading),
      children: [
        virtualItems.map((virtualRow, index2) => {
          const row = items[virtualRow.index];
          if (!row) {
            return null;
          }
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            table_row_default$1,
            {
              classNames: classNames2,
              isSelectable,
              node: row,
              slots,
              state,
              style: {
                transform: `translateY(${virtualRow.start - index2 * virtualRow.size}px)`,
                height: `${virtualRow.size}px`
              },
              children: [...row.childNodes].map(
                (cell) => cell.props.isSelectionCell ? /* @__PURE__ */ jsxRuntimeExports.jsx(
                  table_checkbox_cell_default,
                  {
                    checkboxesProps,
                    classNames: classNames2,
                    color: color2,
                    disableAnimation,
                    node: cell,
                    rowKey: row.key,
                    selectionMode,
                    slots,
                    state
                  },
                  String(cell.key)
                ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
                  table_cell_default$1,
                  {
                    classNames: classNames2,
                    node: cell,
                    rowKey: row.key,
                    slots,
                    state
                  },
                  String(cell.key)
                )
              )
            },
            String(row.key)
          );
        }),
        loadingContent,
        emptyContent
      ]
    }
  );
});
VirtualizedTableBody.displayName = "HeroUI.VirtualizedTableBody";
var virtualized_table_body_default = VirtualizedTableBody;
var TableColumnHeader = forwardRef((props, ref) => {
  var _a2, _b2, _c2, _d, _e;
  const { as: as2, className, state, node: node2, slots, classNames: classNames2, sortIcon, ...otherProps } = props;
  const Component2 = as2 || "th";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const { columnHeaderProps } = $f329116d8ad0aba0$export$9514819a8c81e960({ node: node2 }, state, domRef);
  const thStyles = clsx$4(classNames2 == null ? void 0 : classNames2.th, className, (_a2 = node2.props) == null ? void 0 : _a2.className);
  const { isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$7({});
  const { hideHeader, align, ...columnProps } = node2.props;
  const allowsSorting = columnProps.allowsSorting;
  const sortIconProps = {
    "aria-hidden": true,
    "data-direction": (_b2 = state.sortDescriptor) == null ? void 0 : _b2.direction,
    "data-visible": dataAttr(((_c2 = state.sortDescriptor) == null ? void 0 : _c2.column) === node2.key),
    className: (_d = slots.sortIcon) == null ? void 0 : _d.call(slots, { class: classNames2 == null ? void 0 : classNames2.sortIcon })
  };
  const customSortIcon = typeof sortIcon === "function" ? sortIcon(sortIconProps) : reactExports.isValidElement(sortIcon) && reactExports.cloneElement(sortIcon, sortIconProps);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Component2,
    {
      ref: domRef,
      colSpan: node2.colspan,
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-hover": dataAttr(isHovered),
      "data-sortable": dataAttr(allowsSorting),
      ...mergeProps$3(
        columnHeaderProps,
        focusProps,
        filterDOMProps(columnProps, {
          enabled: shouldFilterDOMProps
        }),
        allowsSorting ? hoverProps : {},
        otherProps
      ),
      className: (_e = slots.th) == null ? void 0 : _e.call(slots, { align, class: thStyles }),
      children: [
        hideHeader ? /* @__PURE__ */ jsxRuntimeExports.jsx($5c3e21d68f1c4674$export$439d29a4e110a164, { children: node2.rendered }) : node2.rendered,
        allowsSorting && (customSortIcon || /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDownIcon$1, { strokeWidth: 3, ...sortIconProps }))
      ]
    }
  );
});
TableColumnHeader.displayName = "HeroUI.TableColumnHeader";
var table_column_header_default = TableColumnHeader;
var TableHeaderRow = forwardRef((props, ref) => {
  var _a2, _b2;
  const { as: as2, className, children, node: node2, slots, classNames: classNames2, state, ...otherProps } = props;
  const Component2 = as2 || "tr";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const { rowProps } = $f917ee10f4c32dab$export$1b95a7d2d517b841({ node: node2 }, state);
  const trStyles = clsx$4(classNames2 == null ? void 0 : classNames2.tr, className, (_a2 = node2.props) == null ? void 0 : _a2.className);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Component2,
    {
      ref: domRef,
      ...mergeProps$3(
        rowProps,
        filterDOMProps(node2.props, {
          enabled: shouldFilterDOMProps
        }),
        otherProps
      ),
      className: (_b2 = slots.tr) == null ? void 0 : _b2.call(slots, { class: trStyles }),
      children
    }
  );
});
TableHeaderRow.displayName = "HeroUI.TableHeaderRow";
var table_header_row_default = TableHeaderRow;
var TableRowGroup = reactExports.forwardRef((props, ref) => {
  var _a2;
  const { as: as2, className, children, slots, classNames: classNames2, ...otherProps } = props;
  const Component2 = as2 || "thead";
  const domRef = useDOMRef(ref);
  const { rowGroupProps } = $0047e6c294ea075f$export$6fb1613bd7b28198();
  const theadStyles = clsx$4(classNames2 == null ? void 0 : classNames2.thead, className);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Component2,
    {
      ref: domRef,
      className: (_a2 = slots.thead) == null ? void 0 : _a2.call(slots, { class: theadStyles }),
      ...mergeProps$3(rowGroupProps, otherProps),
      children
    }
  );
});
TableRowGroup.displayName = "HeroUI.TableRowGroup";
var table_row_group_default = TableRowGroup;
var spacing = {
  px: "1px",
  0: "0px",
  0.5: "0.125rem",
  1: "0.25rem",
  1.5: "0.375rem",
  2: "0.5rem",
  2.5: "0.625rem",
  3: "0.75rem",
  3.5: "0.875rem",
  4: "1rem",
  5: "1.25rem",
  6: "1.5rem",
  7: "1.75rem",
  8: "2rem",
  9: "2.25rem",
  10: "2.5rem",
  11: "2.75rem",
  12: "3rem",
  14: "3.5rem",
  16: "4rem",
  20: "5rem",
  24: "6rem",
  28: "7rem",
  32: "8rem",
  36: "9rem",
  40: "10rem",
  44: "11rem",
  48: "12rem",
  52: "13rem",
  56: "14rem",
  60: "15rem",
  64: "16rem",
  72: "18rem",
  80: "20rem",
  96: "24rem"
};
var getMargin = (value2) => {
  var _a2;
  return (_a2 = spacing[value2]) != null ? _a2 : value2;
};
function useSpacer(originalProps) {
  const [props, variantProps2] = mapPropsVariants(originalProps, spacer.variantKeys);
  const { as: as2, className, x: x2 = 1, y: y2 = 1, ...otherProps } = props;
  const Component2 = as2 || "span";
  const styles2 = reactExports.useMemo(
    () => spacer({
      ...variantProps2,
      className
    }),
    [objectToDeps(variantProps2), className]
  );
  const marginLeft = getMargin(x2);
  const marginTop = getMargin(y2);
  const getSpacerProps = (props2 = {}) => ({
    ...props2,
    ...otherProps,
    "aria-hidden": dataAttr(true),
    className: clsx$4(styles2, props2.className),
    style: {
      ...props2.style,
      ...otherProps.style,
      marginLeft,
      marginTop
    }
  });
  return { Component: Component2, getSpacerProps };
}
var Spacer = forwardRef((props, ref) => {
  const { Component: Component2, getSpacerProps } = useSpacer({ ...props });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ref, ...getSpacerProps() });
});
Spacer.displayName = "HeroUI.Spacer";
var spacer_default = Spacer;
function memo(getDeps, fn, opts2) {
  let deps = opts2.initialDeps ?? [];
  let result;
  return () => {
    var _a2, _b2, _c2, _d;
    let depTime;
    if (opts2.key && ((_a2 = opts2.debug) == null ? void 0 : _a2.call(opts2)))
      depTime = Date.now();
    const newDeps = getDeps();
    const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index2) => deps[index2] !== dep);
    if (!depsChanged) {
      return result;
    }
    deps = newDeps;
    let resultTime;
    if (opts2.key && ((_b2 = opts2.debug) == null ? void 0 : _b2.call(opts2)))
      resultTime = Date.now();
    result = fn(...newDeps);
    if (opts2.key && ((_c2 = opts2.debug) == null ? void 0 : _c2.call(opts2))) {
      const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
      const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
      const resultFpsPercentage = resultEndTime / 16;
      const pad = (str, num) => {
        str = String(str);
        while (str.length < num) {
          str = " " + str;
        }
        return str;
      };
      console.info(
        `%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,
        `
            font-size: .6rem;
            font-weight: bold;
            color: hsl(${Math.max(
          0,
          Math.min(120 - 120 * resultFpsPercentage, 120)
        )}deg 100% 31%);`,
        opts2 == null ? void 0 : opts2.key
      );
    }
    (_d = opts2 == null ? void 0 : opts2.onChange) == null ? void 0 : _d.call(opts2, result);
    return result;
  };
}
function notUndefined(value2, msg) {
  if (value2 === void 0) {
    throw new Error(`Unexpected undefined${""}`);
  } else {
    return value2;
  }
}
const approxEqual = (a2, b2) => Math.abs(a2 - b2) < 1;
const debounce$4 = (targetWindow, fn, ms) => {
  let timeoutId;
  return function(...args) {
    targetWindow.clearTimeout(timeoutId);
    timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms);
  };
};
const defaultKeyExtractor = (index2) => index2;
const defaultRangeExtractor = (range3) => {
  const start2 = Math.max(range3.startIndex - range3.overscan, 0);
  const end2 = Math.min(range3.endIndex + range3.overscan, range3.count - 1);
  const arr = [];
  for (let i2 = start2; i2 <= end2; i2++) {
    arr.push(i2);
  }
  return arr;
};
const observeElementRect = (instance2, cb2) => {
  const element2 = instance2.scrollElement;
  if (!element2) {
    return;
  }
  const targetWindow = instance2.targetWindow;
  if (!targetWindow) {
    return;
  }
  const handler = (rect) => {
    const { width, height } = rect;
    cb2({ width: Math.round(width), height: Math.round(height) });
  };
  handler(element2.getBoundingClientRect());
  if (!targetWindow.ResizeObserver) {
    return () => {
    };
  }
  const observer = new targetWindow.ResizeObserver((entries) => {
    const entry = entries[0];
    if (entry == null ? void 0 : entry.borderBoxSize) {
      const box = entry.borderBoxSize[0];
      if (box) {
        handler({ width: box.inlineSize, height: box.blockSize });
        return;
      }
    }
    handler(element2.getBoundingClientRect());
  });
  observer.observe(element2, { box: "border-box" });
  return () => {
    observer.unobserve(element2);
  };
};
const addEventListenerOptions = {
  passive: true
};
const supportsScrollend = typeof window == "undefined" ? true : "onscrollend" in window;
const observeElementOffset = (instance2, cb2) => {
  const element2 = instance2.scrollElement;
  if (!element2) {
    return;
  }
  const targetWindow = instance2.targetWindow;
  if (!targetWindow) {
    return;
  }
  let offset2 = 0;
  const fallback2 = instance2.options.useScrollendEvent && supportsScrollend ? () => void 0 : debounce$4(
    targetWindow,
    () => {
      cb2(offset2, false);
    },
    instance2.options.isScrollingResetDelay
  );
  const createHandler = (isScrolling) => () => {
    const { horizontal, isRtl } = instance2.options;
    offset2 = horizontal ? element2["scrollLeft"] * (isRtl && -1 || 1) : element2["scrollTop"];
    fallback2();
    cb2(offset2, isScrolling);
  };
  const handler = createHandler(true);
  const endHandler = createHandler(false);
  endHandler();
  element2.addEventListener("scroll", handler, addEventListenerOptions);
  element2.addEventListener("scrollend", endHandler, addEventListenerOptions);
  return () => {
    element2.removeEventListener("scroll", handler);
    element2.removeEventListener("scrollend", endHandler);
  };
};
const measureElement = (element2, entry, instance2) => {
  if (entry == null ? void 0 : entry.borderBoxSize) {
    const box = entry.borderBoxSize[0];
    if (box) {
      const size2 = Math.round(
        box[instance2.options.horizontal ? "inlineSize" : "blockSize"]
      );
      return size2;
    }
  }
  return Math.round(
    element2.getBoundingClientRect()[instance2.options.horizontal ? "width" : "height"]
  );
};
const elementScroll = (offset2, {
  adjustments = 0,
  behavior
}, instance2) => {
  var _a2, _b2;
  const toOffset = offset2 + adjustments;
  (_b2 = (_a2 = instance2.scrollElement) == null ? void 0 : _a2.scrollTo) == null ? void 0 : _b2.call(_a2, {
    [instance2.options.horizontal ? "left" : "top"]: toOffset,
    behavior
  });
};
class Virtualizer {
  constructor(opts2) {
    this.unsubs = [];
    this.scrollElement = null;
    this.targetWindow = null;
    this.isScrolling = false;
    this.scrollToIndexTimeoutId = null;
    this.measurementsCache = [];
    this.itemSizeCache = /* @__PURE__ */ new Map();
    this.pendingMeasuredCacheIndexes = [];
    this.scrollRect = null;
    this.scrollOffset = null;
    this.scrollDirection = null;
    this.scrollAdjustments = 0;
    this.elementsCache = /* @__PURE__ */ new Map();
    this.observer = /* @__PURE__ */ (() => {
      let _ro = null;
      const get5 = () => {
        if (_ro) {
          return _ro;
        }
        if (!this.targetWindow || !this.targetWindow.ResizeObserver) {
          return null;
        }
        return _ro = new this.targetWindow.ResizeObserver((entries) => {
          entries.forEach((entry) => {
            this._measureElement(entry.target, entry);
          });
        });
      };
      return {
        disconnect: () => {
          var _a2;
          (_a2 = get5()) == null ? void 0 : _a2.disconnect();
          _ro = null;
        },
        observe: (target) => {
          var _a2;
          return (_a2 = get5()) == null ? void 0 : _a2.observe(target, { box: "border-box" });
        },
        unobserve: (target) => {
          var _a2;
          return (_a2 = get5()) == null ? void 0 : _a2.unobserve(target);
        }
      };
    })();
    this.range = null;
    this.setOptions = (opts22) => {
      Object.entries(opts22).forEach(([key, value2]) => {
        if (typeof value2 === "undefined")
          delete opts22[key];
      });
      this.options = {
        debug: false,
        initialOffset: 0,
        overscan: 1,
        paddingStart: 0,
        paddingEnd: 0,
        scrollPaddingStart: 0,
        scrollPaddingEnd: 0,
        horizontal: false,
        getItemKey: defaultKeyExtractor,
        rangeExtractor: defaultRangeExtractor,
        onChange: () => {
        },
        measureElement,
        initialRect: { width: 0, height: 0 },
        scrollMargin: 0,
        gap: 0,
        indexAttribute: "data-index",
        initialMeasurementsCache: [],
        lanes: 1,
        isScrollingResetDelay: 150,
        enabled: true,
        isRtl: false,
        useScrollendEvent: true,
        ...opts22
      };
    };
    this.notify = (sync) => {
      var _a2, _b2;
      (_b2 = (_a2 = this.options).onChange) == null ? void 0 : _b2.call(_a2, this, sync);
    };
    this.maybeNotify = memo(
      () => {
        this.calculateRange();
        return [
          this.isScrolling,
          this.range ? this.range.startIndex : null,
          this.range ? this.range.endIndex : null
        ];
      },
      (isScrolling) => {
        this.notify(isScrolling);
      },
      {
        key: false,
        debug: () => this.options.debug,
        initialDeps: [
          this.isScrolling,
          this.range ? this.range.startIndex : null,
          this.range ? this.range.endIndex : null
        ]
      }
    );
    this.cleanup = () => {
      this.unsubs.filter(Boolean).forEach((d2) => d2());
      this.unsubs = [];
      this.observer.disconnect();
      this.scrollElement = null;
      this.targetWindow = null;
    };
    this._didMount = () => {
      return () => {
        this.cleanup();
      };
    };
    this._willUpdate = () => {
      var _a2;
      const scrollElement = this.options.enabled ? this.options.getScrollElement() : null;
      if (this.scrollElement !== scrollElement) {
        this.cleanup();
        if (!scrollElement) {
          this.maybeNotify();
          return;
        }
        this.scrollElement = scrollElement;
        if (this.scrollElement && "ownerDocument" in this.scrollElement) {
          this.targetWindow = this.scrollElement.ownerDocument.defaultView;
        } else {
          this.targetWindow = ((_a2 = this.scrollElement) == null ? void 0 : _a2.window) ?? null;
        }
        this.elementsCache.forEach((cached) => {
          this.observer.observe(cached);
        });
        this._scrollToOffset(this.getScrollOffset(), {
          adjustments: void 0,
          behavior: void 0
        });
        this.unsubs.push(
          this.options.observeElementRect(this, (rect) => {
            this.scrollRect = rect;
            this.maybeNotify();
          })
        );
        this.unsubs.push(
          this.options.observeElementOffset(this, (offset2, isScrolling) => {
            this.scrollAdjustments = 0;
            this.scrollDirection = isScrolling ? this.getScrollOffset() < offset2 ? "forward" : "backward" : null;
            this.scrollOffset = offset2;
            this.isScrolling = isScrolling;
            this.maybeNotify();
          })
        );
      }
    };
    this.getSize = () => {
      if (!this.options.enabled) {
        this.scrollRect = null;
        return 0;
      }
      this.scrollRect = this.scrollRect ?? this.options.initialRect;
      return this.scrollRect[this.options.horizontal ? "width" : "height"];
    };
    this.getScrollOffset = () => {
      if (!this.options.enabled) {
        this.scrollOffset = null;
        return 0;
      }
      this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset === "function" ? this.options.initialOffset() : this.options.initialOffset);
      return this.scrollOffset;
    };
    this.getFurthestMeasurement = (measurements, index2) => {
      const furthestMeasurementsFound = /* @__PURE__ */ new Map();
      const furthestMeasurements = /* @__PURE__ */ new Map();
      for (let m2 = index2 - 1; m2 >= 0; m2--) {
        const measurement = measurements[m2];
        if (furthestMeasurementsFound.has(measurement.lane)) {
          continue;
        }
        const previousFurthestMeasurement = furthestMeasurements.get(
          measurement.lane
        );
        if (previousFurthestMeasurement == null || measurement.end > previousFurthestMeasurement.end) {
          furthestMeasurements.set(measurement.lane, measurement);
        } else if (measurement.end < previousFurthestMeasurement.end) {
          furthestMeasurementsFound.set(measurement.lane, true);
        }
        if (furthestMeasurementsFound.size === this.options.lanes) {
          break;
        }
      }
      return furthestMeasurements.size === this.options.lanes ? Array.from(furthestMeasurements.values()).sort((a2, b2) => {
        if (a2.end === b2.end) {
          return a2.index - b2.index;
        }
        return a2.end - b2.end;
      })[0] : void 0;
    };
    this.getMeasurementOptions = memo(
      () => [
        this.options.count,
        this.options.paddingStart,
        this.options.scrollMargin,
        this.options.getItemKey,
        this.options.enabled
      ],
      (count, paddingStart, scrollMargin, getItemKey, enabled) => {
        this.pendingMeasuredCacheIndexes = [];
        return {
          count,
          paddingStart,
          scrollMargin,
          getItemKey,
          enabled
        };
      },
      {
        key: false
      }
    );
    this.getMeasurements = memo(
      () => [this.getMeasurementOptions(), this.itemSizeCache],
      ({ count, paddingStart, scrollMargin, getItemKey, enabled }, itemSizeCache) => {
        if (!enabled) {
          this.measurementsCache = [];
          this.itemSizeCache.clear();
          return [];
        }
        if (this.measurementsCache.length === 0) {
          this.measurementsCache = this.options.initialMeasurementsCache;
          this.measurementsCache.forEach((item) => {
            this.itemSizeCache.set(item.key, item.size);
          });
        }
        const min2 = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
        this.pendingMeasuredCacheIndexes = [];
        const measurements = this.measurementsCache.slice(0, min2);
        for (let i2 = min2; i2 < count; i2++) {
          const key = getItemKey(i2);
          const furthestMeasurement = this.options.lanes === 1 ? measurements[i2 - 1] : this.getFurthestMeasurement(measurements, i2);
          const start2 = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
          const measuredSize = itemSizeCache.get(key);
          const size2 = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i2);
          const end2 = start2 + size2;
          const lane = furthestMeasurement ? furthestMeasurement.lane : i2 % this.options.lanes;
          measurements[i2] = {
            index: i2,
            start: start2,
            size: size2,
            end: end2,
            key,
            lane
          };
        }
        this.measurementsCache = measurements;
        return measurements;
      },
      {
        key: false,
        debug: () => this.options.debug
      }
    );
    this.calculateRange = memo(
      () => [this.getMeasurements(), this.getSize(), this.getScrollOffset()],
      (measurements, outerSize, scrollOffset) => {
        return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({
          measurements,
          outerSize,
          scrollOffset
        }) : null;
      },
      {
        key: false,
        debug: () => this.options.debug
      }
    );
    this.getIndexes = memo(
      () => {
        let startIndex = null;
        let endIndex = null;
        const range3 = this.calculateRange();
        if (range3) {
          startIndex = range3.startIndex;
          endIndex = range3.endIndex;
        }
        return [
          this.options.rangeExtractor,
          this.options.overscan,
          this.options.count,
          startIndex,
          endIndex
        ];
      },
      (rangeExtractor, overscan, count, startIndex, endIndex) => {
        return startIndex === null || endIndex === null ? [] : rangeExtractor({
          startIndex,
          endIndex,
          overscan,
          count
        });
      },
      {
        key: false,
        debug: () => this.options.debug
      }
    );
    this.indexFromElement = (node2) => {
      const attributeName = this.options.indexAttribute;
      const indexStr = node2.getAttribute(attributeName);
      if (!indexStr) {
        console.warn(
          `Missing attribute name '${attributeName}={index}' on measured element.`
        );
        return -1;
      }
      return parseInt(indexStr, 10);
    };
    this._measureElement = (node2, entry) => {
      const index2 = this.indexFromElement(node2);
      const item = this.measurementsCache[index2];
      if (!item) {
        return;
      }
      const key = item.key;
      const prevNode = this.elementsCache.get(key);
      if (prevNode !== node2) {
        if (prevNode) {
          this.observer.unobserve(prevNode);
        }
        this.observer.observe(node2);
        this.elementsCache.set(key, node2);
      }
      if (node2.isConnected) {
        this.resizeItem(index2, this.options.measureElement(node2, entry, this));
      }
    };
    this.resizeItem = (index2, size2) => {
      const item = this.measurementsCache[index2];
      if (!item) {
        return;
      }
      const itemSize = this.itemSizeCache.get(item.key) ?? item.size;
      const delta = size2 - itemSize;
      if (delta !== 0) {
        if (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(item, delta, this) : item.start < this.getScrollOffset() + this.scrollAdjustments) {
          this._scrollToOffset(this.getScrollOffset(), {
            adjustments: this.scrollAdjustments += delta,
            behavior: void 0
          });
        }
        this.pendingMeasuredCacheIndexes.push(item.index);
        this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size2));
        this.notify(false);
      }
    };
    this.measureElement = (node2) => {
      if (!node2) {
        this.elementsCache.forEach((cached, key) => {
          if (!cached.isConnected) {
            this.observer.unobserve(cached);
            this.elementsCache.delete(key);
          }
        });
        return;
      }
      this._measureElement(node2, void 0);
    };
    this.getVirtualItems = memo(
      () => [this.getIndexes(), this.getMeasurements()],
      (indexes, measurements) => {
        const virtualItems = [];
        for (let k2 = 0, len = indexes.length; k2 < len; k2++) {
          const i2 = indexes[k2];
          const measurement = measurements[i2];
          virtualItems.push(measurement);
        }
        return virtualItems;
      },
      {
        key: false,
        debug: () => this.options.debug
      }
    );
    this.getVirtualItemForOffset = (offset2) => {
      const measurements = this.getMeasurements();
      if (measurements.length === 0) {
        return void 0;
      }
      return notUndefined(
        measurements[findNearestBinarySearch(
          0,
          measurements.length - 1,
          (index2) => notUndefined(measurements[index2]).start,
          offset2
        )]
      );
    };
    this.getOffsetForAlignment = (toOffset, align) => {
      const size2 = this.getSize();
      const scrollOffset = this.getScrollOffset();
      if (align === "auto") {
        if (toOffset >= scrollOffset + size2) {
          align = "end";
        }
      }
      if (align === "end") {
        toOffset -= size2;
      }
      const scrollSizeProp = this.options.horizontal ? "scrollWidth" : "scrollHeight";
      const scrollSize = this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[scrollSizeProp] : this.scrollElement[scrollSizeProp] : 0;
      const maxOffset = scrollSize - size2;
      return Math.max(Math.min(maxOffset, toOffset), 0);
    };
    this.getOffsetForIndex = (index2, align = "auto") => {
      index2 = Math.max(0, Math.min(index2, this.options.count - 1));
      const item = this.measurementsCache[index2];
      if (!item) {
        return void 0;
      }
      const size2 = this.getSize();
      const scrollOffset = this.getScrollOffset();
      if (align === "auto") {
        if (item.end >= scrollOffset + size2 - this.options.scrollPaddingEnd) {
          align = "end";
        } else if (item.start <= scrollOffset + this.options.scrollPaddingStart) {
          align = "start";
        } else {
          return [scrollOffset, align];
        }
      }
      const centerOffset = item.start - this.options.scrollPaddingStart + (item.size - size2) / 2;
      switch (align) {
        case "center":
          return [this.getOffsetForAlignment(centerOffset, align), align];
        case "end":
          return [
            this.getOffsetForAlignment(
              item.end + this.options.scrollPaddingEnd,
              align
            ),
            align
          ];
        default:
          return [
            this.getOffsetForAlignment(
              item.start - this.options.scrollPaddingStart,
              align
            ),
            align
          ];
      }
    };
    this.isDynamicMode = () => this.elementsCache.size > 0;
    this.cancelScrollToIndex = () => {
      if (this.scrollToIndexTimeoutId !== null && this.targetWindow) {
        this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId);
        this.scrollToIndexTimeoutId = null;
      }
    };
    this.scrollToOffset = (toOffset, { align = "start", behavior } = {}) => {
      this.cancelScrollToIndex();
      if (behavior === "smooth" && this.isDynamicMode()) {
        console.warn(
          "The `smooth` scroll behavior is not fully supported with dynamic size."
        );
      }
      this._scrollToOffset(this.getOffsetForAlignment(toOffset, align), {
        adjustments: void 0,
        behavior
      });
    };
    this.scrollToIndex = (index2, { align: initialAlign = "auto", behavior } = {}) => {
      index2 = Math.max(0, Math.min(index2, this.options.count - 1));
      this.cancelScrollToIndex();
      if (behavior === "smooth" && this.isDynamicMode()) {
        console.warn(
          "The `smooth` scroll behavior is not fully supported with dynamic size."
        );
      }
      const offsetAndAlign = this.getOffsetForIndex(index2, initialAlign);
      if (!offsetAndAlign)
        return;
      const [offset2, align] = offsetAndAlign;
      this._scrollToOffset(offset2, { adjustments: void 0, behavior });
      if (behavior !== "smooth" && this.isDynamicMode() && this.targetWindow) {
        this.scrollToIndexTimeoutId = this.targetWindow.setTimeout(() => {
          this.scrollToIndexTimeoutId = null;
          const elementInDOM = this.elementsCache.has(
            this.options.getItemKey(index2)
          );
          if (elementInDOM) {
            const [latestOffset] = notUndefined(
              this.getOffsetForIndex(index2, align)
            );
            if (!approxEqual(latestOffset, this.getScrollOffset())) {
              this.scrollToIndex(index2, { align, behavior });
            }
          } else {
            this.scrollToIndex(index2, { align, behavior });
          }
        });
      }
    };
    this.scrollBy = (delta, { behavior } = {}) => {
      this.cancelScrollToIndex();
      if (behavior === "smooth" && this.isDynamicMode()) {
        console.warn(
          "The `smooth` scroll behavior is not fully supported with dynamic size."
        );
      }
      this._scrollToOffset(this.getScrollOffset() + delta, {
        adjustments: void 0,
        behavior
      });
    };
    this.getTotalSize = () => {
      var _a2;
      const measurements = this.getMeasurements();
      let end2;
      if (measurements.length === 0) {
        end2 = this.options.paddingStart;
      } else {
        end2 = this.options.lanes === 1 ? ((_a2 = measurements[measurements.length - 1]) == null ? void 0 : _a2.end) ?? 0 : Math.max(
          ...measurements.slice(-this.options.lanes).map((m2) => m2.end)
        );
      }
      return Math.max(
        end2 - this.options.scrollMargin + this.options.paddingEnd,
        0
      );
    };
    this._scrollToOffset = (offset2, {
      adjustments,
      behavior
    }) => {
      this.options.scrollToFn(offset2, { behavior, adjustments }, this);
    };
    this.measure = () => {
      this.itemSizeCache = /* @__PURE__ */ new Map();
      this.notify(false);
    };
    this.setOptions(opts2);
  }
}
const findNearestBinarySearch = (low, high, getCurrentValue, value2) => {
  while (low <= high) {
    const middle = (low + high) / 2 | 0;
    const currentValue = getCurrentValue(middle);
    if (currentValue < value2) {
      low = middle + 1;
    } else if (currentValue > value2) {
      high = middle - 1;
    } else {
      return middle;
    }
  }
  if (low > 0) {
    return low - 1;
  } else {
    return 0;
  }
};
function calculateRange({
  measurements,
  outerSize,
  scrollOffset
}) {
  const count = measurements.length - 1;
  const getOffset2 = (index2) => measurements[index2].start;
  const startIndex = findNearestBinarySearch(0, count, getOffset2, scrollOffset);
  let endIndex = startIndex;
  while (endIndex < count && measurements[endIndex].end < scrollOffset + outerSize) {
    endIndex++;
  }
  return { startIndex, endIndex };
}
const useIsomorphicLayoutEffect$3 = typeof document !== "undefined" ? reactExports.useLayoutEffect : reactExports.useEffect;
function useVirtualizerBase(options) {
  const rerender = reactExports.useReducer(() => ({}), {})[1];
  const resolvedOptions = {
    ...options,
    onChange: (instance22, sync) => {
      var _a2;
      if (sync) {
        reactDomExports.flushSync(rerender);
      } else {
        rerender();
      }
      (_a2 = options.onChange) == null ? void 0 : _a2.call(options, instance22, sync);
    }
  };
  const [instance2] = reactExports.useState(
    () => new Virtualizer(resolvedOptions)
  );
  instance2.setOptions(resolvedOptions);
  useIsomorphicLayoutEffect$3(() => {
    return instance2._didMount();
  }, []);
  useIsomorphicLayoutEffect$3(() => {
    return instance2._willUpdate();
  });
  return instance2;
}
function useVirtualizer(options) {
  return useVirtualizerBase({
    observeElementRect,
    observeElementOffset,
    scrollToFn: elementScroll,
    ...options
  });
}
var VirtualizedTable = forwardRef((props, ref) => {
  const {
    BaseComponent,
    Component: Component2,
    collection,
    values,
    topContent,
    topContentPlacement,
    bottomContentPlacement,
    bottomContent,
    getBaseProps,
    getWrapperProps,
    getTableProps
  } = useTable({
    ...props,
    ref
  });
  const { rowHeight = 40, maxTableHeight = 600 } = props;
  const Wrapper2 = reactExports.useCallback(
    ({ children }) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        BaseComponent,
        {
          ...getWrapperProps(),
          ref: parentRef,
          style: { height: maxTableHeight, display: "block" },
          children
        }
      );
    },
    [getWrapperProps, maxTableHeight]
  );
  const items = [...collection.body.childNodes];
  const count = items.length;
  const parentRef = reactExports.useRef(null);
  const [headerHeight, setHeaderHeight] = reactExports.useState(0);
  const headerRef = reactExports.useRef(null);
  reactExports.useLayoutEffect(() => {
    if (headerRef.current) {
      setHeaderHeight(headerRef.current.getBoundingClientRect().height);
    }
  }, [headerRef]);
  const rowVirtualizer = useVirtualizer({
    count,
    getScrollElement: () => parentRef.current,
    estimateSize: () => rowHeight,
    overscan: 5
  });
  const tableProps = getTableProps();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getBaseProps(), children: [
    topContentPlacement === "outside" && topContent,
    /* @__PURE__ */ jsxRuntimeExports.jsx(Wrapper2, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      topContentPlacement === "inside" && topContent,
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Component2,
        {
          ...tableProps,
          style: {
            height: `calc(${rowVirtualizer.getTotalSize() + headerHeight}px)`,
            ...tableProps.style
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_group_default, { ref: headerRef, classNames: values.classNames, slots: values.slots, children: [
              collection.headerRows.map((headerRow) => /* @__PURE__ */ jsxRuntimeExports.jsx(
                table_header_row_default,
                {
                  classNames: values.classNames,
                  node: headerRow,
                  slots: values.slots,
                  state: values.state,
                  children: [...headerRow.childNodes].map(
                    (column2) => {
                      var _a2;
                      return ((_a2 = column2 == null ? void 0 : column2.props) == null ? void 0 : _a2.isSelectionCell) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
                        table_select_all_checkbox_default,
                        {
                          checkboxesProps: values.checkboxesProps,
                          classNames: values.classNames,
                          color: values.color,
                          disableAnimation: values.disableAnimation,
                          node: column2,
                          selectionMode: values.selectionMode,
                          slots: values.slots,
                          state: values.state
                        },
                        column2 == null ? void 0 : column2.key
                      ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
                        table_column_header_default,
                        {
                          classNames: values.classNames,
                          node: column2,
                          slots: values.slots,
                          state: values.state
                        },
                        column2 == null ? void 0 : column2.key
                      );
                    }
                  )
                },
                headerRow == null ? void 0 : headerRow.key
              )),
              /* @__PURE__ */ jsxRuntimeExports.jsx(spacer_default, { as: "tr", tabIndex: -1, y: 1 })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              virtualized_table_body_default,
              {
                checkboxesProps: values.checkboxesProps,
                classNames: values.classNames,
                collection: values.collection,
                color: values.color,
                disableAnimation: values.disableAnimation,
                isSelectable: values.isSelectable,
                rowVirtualizer,
                selectionMode: values.selectionMode,
                slots: values.slots,
                state: values.state
              }
            )
          ]
        }
      ),
      bottomContentPlacement === "inside" && bottomContent
    ] }) }),
    bottomContentPlacement === "outside" && bottomContent
  ] });
});
VirtualizedTable.displayName = "HeroUI.VirtualizedTable";
var virtualized_table_default = VirtualizedTable;
var TableBody$1 = forwardRef((props, ref) => {
  var _a2;
  const {
    as: as2,
    className,
    slots,
    state,
    collection,
    isSelectable,
    color: color2,
    disableAnimation,
    checkboxesProps,
    selectionMode,
    classNames: classNames2,
    ...otherProps
  } = props;
  const Component2 = as2 || "tbody";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const { rowGroupProps } = $0047e6c294ea075f$export$6fb1613bd7b28198();
  const tbodyStyles = clsx$4(classNames2 == null ? void 0 : classNames2.tbody, className);
  const bodyProps = collection == null ? void 0 : collection.body.props;
  const isLoading = (bodyProps == null ? void 0 : bodyProps.isLoading) || (bodyProps == null ? void 0 : bodyProps.loadingState) === "loading" || (bodyProps == null ? void 0 : bodyProps.loadingState) === "loadingMore";
  const renderRows = reactExports.useMemo(() => {
    return [...collection.body.childNodes].map((row) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      table_row_default$1,
      {
        classNames: classNames2,
        isSelectable,
        node: row,
        slots,
        state,
        children: [...row.childNodes].map(
          (cell) => cell.props.isSelectionCell ? /* @__PURE__ */ jsxRuntimeExports.jsx(
            table_checkbox_cell_default,
            {
              checkboxesProps,
              classNames: classNames2,
              color: color2,
              disableAnimation,
              node: cell,
              rowKey: row.key,
              selectionMode,
              slots,
              state
            },
            cell.key
          ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
            table_cell_default$1,
            {
              classNames: classNames2,
              node: cell,
              rowKey: row.key,
              slots,
              state
            },
            cell.key
          )
        )
      },
      row.key
    ));
  }, [collection.body.childNodes, classNames2, isSelectable, slots, state]);
  let emptyContent;
  let loadingContent;
  if (collection.size === 0 && bodyProps.emptyContent) {
    emptyContent = /* @__PURE__ */ jsxRuntimeExports.jsx("tr", { role: "row", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "td",
      {
        className: slots == null ? void 0 : slots.emptyWrapper({ class: classNames2 == null ? void 0 : classNames2.emptyWrapper }),
        colSpan: collection.columnCount,
        role: "gridcell",
        children: !isLoading && bodyProps.emptyContent
      }
    ) });
  }
  if (isLoading && bodyProps.loadingContent) {
    loadingContent = /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { role: "row", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        "td",
        {
          className: slots == null ? void 0 : slots.loadingWrapper({ class: classNames2 == null ? void 0 : classNames2.loadingWrapper }),
          colSpan: collection.columnCount,
          role: "gridcell",
          children: bodyProps.loadingContent
        }
      ),
      !emptyContent && collection.size === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: slots == null ? void 0 : slots.emptyWrapper({ class: classNames2 == null ? void 0 : classNames2.emptyWrapper }) }) : null
    ] });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Component2,
    {
      ref: domRef,
      ...mergeProps$3(
        rowGroupProps,
        filterDOMProps(bodyProps, {
          enabled: shouldFilterDOMProps
        }),
        otherProps
      ),
      className: (_a2 = slots.tbody) == null ? void 0 : _a2.call(slots, { class: tbodyStyles }),
      "data-empty": dataAttr(collection.size === 0),
      "data-loading": dataAttr(isLoading),
      children: [
        renderRows,
        loadingContent,
        emptyContent
      ]
    }
  );
});
TableBody$1.displayName = "HeroUI.TableBody";
var table_body_default$1 = TableBody$1;
var Table$1 = forwardRef((props, ref) => {
  const {
    BaseComponent,
    Component: Component2,
    collection,
    values,
    topContent,
    topContentPlacement,
    bottomContentPlacement,
    bottomContent,
    removeWrapper,
    sortIcon,
    getBaseProps,
    getWrapperProps,
    getTableProps
  } = useTable({
    ...props,
    ref
  });
  const { isVirtualized, rowHeight = 40, maxTableHeight = 600 } = props;
  const shouldVirtualize = isVirtualized;
  const Wrapper2 = reactExports.useCallback(
    ({ children }) => {
      if (removeWrapper) {
        return children;
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsx(BaseComponent, { ...getWrapperProps(), children });
    },
    [removeWrapper, getWrapperProps]
  );
  if (shouldVirtualize) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      virtualized_table_default,
      {
        ...props,
        ref,
        maxTableHeight,
        rowHeight
      }
    );
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getBaseProps(), children: [
    topContentPlacement === "outside" && topContent,
    /* @__PURE__ */ jsxRuntimeExports.jsx(Wrapper2, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      topContentPlacement === "inside" && topContent,
      /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getTableProps(), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_group_default, { classNames: values.classNames, slots: values.slots, children: [
          collection.headerRows.map((headerRow) => /* @__PURE__ */ jsxRuntimeExports.jsx(
            table_header_row_default,
            {
              classNames: values.classNames,
              node: headerRow,
              slots: values.slots,
              state: values.state,
              children: [...headerRow.childNodes].map(
                (column2) => {
                  var _a2;
                  return ((_a2 = column2 == null ? void 0 : column2.props) == null ? void 0 : _a2.isSelectionCell) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
                    table_select_all_checkbox_default,
                    {
                      checkboxesProps: values.checkboxesProps,
                      classNames: values.classNames,
                      color: values.color,
                      disableAnimation: values.disableAnimation,
                      node: column2,
                      selectionMode: values.selectionMode,
                      slots: values.slots,
                      state: values.state
                    },
                    column2 == null ? void 0 : column2.key
                  ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
                    table_column_header_default,
                    {
                      classNames: values.classNames,
                      node: column2,
                      slots: values.slots,
                      sortIcon,
                      state: values.state
                    },
                    column2 == null ? void 0 : column2.key
                  );
                }
              )
            },
            headerRow == null ? void 0 : headerRow.key
          )),
          /* @__PURE__ */ jsxRuntimeExports.jsx(spacer_default, { as: "tr", tabIndex: -1, y: 1 })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          table_body_default$1,
          {
            checkboxesProps: values.checkboxesProps,
            classNames: values.classNames,
            collection: values.collection,
            color: values.color,
            disableAnimation: values.disableAnimation,
            isSelectable: values.isSelectable,
            selectionMode: values.selectionMode,
            slots: values.slots,
            state: values.state
          }
        )
      ] }),
      bottomContentPlacement === "inside" && bottomContent
    ] }) }),
    bottomContentPlacement === "outside" && bottomContent
  ] });
});
Table$1.displayName = "HeroUI.Table";
var table_default = Table$1;
var TableColumn = $1cd244557c2f97d5$export$816b5d811295e6bc;
var table_column_default = TableColumn;
var TableHeader = $312ae3b56a94a86e$export$f850895b287ef28e;
var table_header_default = TableHeader;
var TableRow = $70d70eb16ea48428$export$b59bdbef9ce70de2;
var table_row_default = TableRow;
var TableBody = $4ae5314bf50db1a3$export$76ccd210b9029917;
var table_body_default = TableBody;
var TableCell = $941d1d9a6a28982a$export$f6f0c3fe4ec306ea;
var table_cell_default = TableCell;
function useKbd(originalProps) {
  const [props, variantProps2] = mapPropsVariants(originalProps, kbd.variantKeys);
  const { as: as2, children, className, keys: keys2, title, classNames: classNames2, ...otherProps } = props;
  const Component2 = as2 || "kbd";
  const slots = reactExports.useMemo(
    () => kbd({
      ...variantProps2
    }),
    [objectToDeps(variantProps2)]
  );
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const keysToRender = typeof keys2 === "string" ? [keys2] : Array.isArray(keys2) ? keys2 : [];
  const getKbdProps = (props2 = {}) => ({
    ...otherProps,
    ...props2,
    className: clsx$4(slots.base({ class: clsx$4(baseStyles, props2.className) }))
  });
  return { Component: Component2, slots, classNames: classNames2, title, children, keysToRender, getKbdProps };
}
var kbdKeysMap = {
  command: "⌘",
  shift: "⇧",
  ctrl: "⌃",
  option: "⌥",
  enter: "↵",
  delete: "⌫",
  escape: "⎋",
  tab: "⇥",
  capslock: "⇪",
  up: "↑",
  right: "→",
  down: "↓",
  left: "←",
  pageup: "⇞",
  pagedown: "⇟",
  home: "↖",
  end: "↘",
  help: "?",
  space: "␣",
  fn: "Fn",
  win: "⌘",
  alt: "⌥"
};
var kbdKeysLabelMap = {
  command: "Command",
  shift: "Shift",
  ctrl: "Control",
  option: "Option",
  enter: "Enter",
  delete: "Delete",
  escape: "Escape",
  tab: "Tab",
  capslock: "Caps Lock",
  up: "Up",
  right: "Right",
  down: "Down",
  left: "Left",
  pageup: "Page Up",
  pagedown: "Page Down",
  home: "Home",
  end: "End",
  help: "Help",
  space: "Space",
  fn: "Fn",
  win: "Win",
  alt: "Alt"
};
var Kbd = forwardRef((props, ref) => {
  const { Component: Component2, children, slots, classNames: classNames2, keysToRender, getKbdProps } = useKbd({
    ...props
  });
  const keysContent = reactExports.useMemo(() => {
    return keysToRender.map((key) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      "abbr",
      {
        className: slots.abbr({ class: classNames2 == null ? void 0 : classNames2.abbr }),
        title: kbdKeysLabelMap[key],
        children: kbdKeysMap[key]
      },
      key
    ));
  }, [keysToRender]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ref, ...getKbdProps(), children: [
    keysContent,
    children && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.content({ class: classNames2 == null ? void 0 : classNames2.content }), children })
  ] });
});
Kbd.displayName = "HeroUI.Kbd";
var kbd_default = Kbd;
const $99b62ae3ff97ec45$export$c5f62239608282b6 = /* @__PURE__ */ new WeakMap();
function $99b62ae3ff97ec45$export$567fc7097e064344(state, key, role) {
  if (!state)
    return "";
  if (typeof key === "string")
    key = key.replace(/\s+/g, "");
  let baseId = $99b62ae3ff97ec45$export$c5f62239608282b6.get(state);
  return `${baseId}-${role}-${key}`;
}
function $9bf71ea28793e738$var$isTabbableRadio$1(element2) {
  if (element2.checked)
    return true;
  let radios = [];
  if (!element2.form)
    radios = [
      ...$431fbd86ca7dc216$export$b204af158042fbac$4(element2).querySelectorAll(`input[type="radio"][name="${CSS.escape(element2.name)}"]`)
    ].filter((radio2) => !radio2.form);
  else {
    var _element_form_elements, _element_form;
    let radioList = (_element_form = element2.form) === null || _element_form === void 0 ? void 0 : (_element_form_elements = _element_form.elements) === null || _element_form_elements === void 0 ? void 0 : _element_form_elements.namedItem(element2.name);
    radios = [
      ...radioList !== null && radioList !== void 0 ? radioList : []
    ];
  }
  if (!radios)
    return false;
  let anyChecked = radios.some((radio2) => radio2.checked);
  return !anyChecked;
}
function $9bf71ea28793e738$var$isElementInScope$1(element2, scope) {
  if (!element2)
    return false;
  if (!scope)
    return false;
  return scope.some((node2) => node2.contains(element2));
}
function $9bf71ea28793e738$export$2d6ec8fc375ceafa$1(root2, opts2, scope) {
  let filter3 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) ? $b4b717babfbb907b$export$bebd5a1431fec25d : $b4b717babfbb907b$export$4c063cf1350e6fed$3;
  let rootElement = (root2 === null || root2 === void 0 ? void 0 : root2.nodeType) === Node.ELEMENT_NODE ? root2 : null;
  let doc = $431fbd86ca7dc216$export$b204af158042fbac$4(rootElement);
  let walker = $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root2 || doc, NodeFilter.SHOW_ELEMENT, {
    acceptNode(node2) {
      var _opts_from;
      if (opts2 === null || opts2 === void 0 ? void 0 : (_opts_from = opts2.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node2))
        return NodeFilter.FILTER_REJECT;
      if ((opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) && node2.tagName === "INPUT" && node2.getAttribute("type") === "radio") {
        if (!$9bf71ea28793e738$var$isTabbableRadio$1(node2))
          return NodeFilter.FILTER_REJECT;
        if (walker.currentNode.tagName === "INPUT" && walker.currentNode.type === "radio" && walker.currentNode.name === node2.name)
          return NodeFilter.FILTER_REJECT;
      }
      if (filter3(node2) && (!scope || $9bf71ea28793e738$var$isElementInScope$1(node2, scope)) && (!(opts2 === null || opts2 === void 0 ? void 0 : opts2.accept) || opts2.accept(node2)))
        return NodeFilter.FILTER_ACCEPT;
      return NodeFilter.FILTER_SKIP;
    }
  });
  if (opts2 === null || opts2 === void 0 ? void 0 : opts2.from)
    walker.currentNode = opts2.from;
  return walker;
}
let $9bf71ea28793e738$var$Tree$1 = class $9bf71ea28793e738$var$Tree7 {
  get size() {
    return this.fastMap.size;
  }
  getTreeNode(data) {
    return this.fastMap.get(data);
  }
  addTreeNode(scopeRef, parent, nodeToRestore) {
    let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
    if (!parentNode)
      return;
    let node2 = new $9bf71ea28793e738$var$TreeNode$1({
      scopeRef
    });
    parentNode.addChild(node2);
    node2.parent = parentNode;
    this.fastMap.set(scopeRef, node2);
    if (nodeToRestore)
      node2.nodeToRestore = nodeToRestore;
  }
  addNode(node2) {
    this.fastMap.set(node2.scopeRef, node2);
  }
  removeTreeNode(scopeRef) {
    if (scopeRef === null)
      return;
    let node2 = this.fastMap.get(scopeRef);
    if (!node2)
      return;
    let parentNode = node2.parent;
    for (let current of this.traverse())
      if (current !== node2 && node2.nodeToRestore && current.nodeToRestore && node2.scopeRef && node2.scopeRef.current && $9bf71ea28793e738$var$isElementInScope$1(current.nodeToRestore, node2.scopeRef.current))
        current.nodeToRestore = node2.nodeToRestore;
    let children = node2.children;
    if (parentNode) {
      parentNode.removeChild(node2);
      if (children.size > 0)
        children.forEach((child) => parentNode && parentNode.addChild(child));
    }
    this.fastMap.delete(node2.scopeRef);
  }
  // Pre Order Depth First
  *traverse(node2 = this.root) {
    if (node2.scopeRef != null)
      yield node2;
    if (node2.children.size > 0)
      for (let child of node2.children)
        yield* this.traverse(child);
  }
  clone() {
    var _node_parent;
    let newTree = new $9bf71ea28793e738$var$Tree7();
    var _node_parent_scopeRef;
    for (let node2 of this.traverse())
      newTree.addTreeNode(node2.scopeRef, (_node_parent_scopeRef = (_node_parent = node2.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node2.nodeToRestore);
    return newTree;
  }
  constructor() {
    this.fastMap = /* @__PURE__ */ new Map();
    this.root = new $9bf71ea28793e738$var$TreeNode$1({
      scopeRef: null
    });
    this.fastMap.set(null, this.root);
  }
};
let $9bf71ea28793e738$var$TreeNode$1 = class $9bf71ea28793e738$var$TreeNode7 {
  addChild(node2) {
    this.children.add(node2);
    node2.parent = this;
  }
  removeChild(node2) {
    this.children.delete(node2);
    node2.parent = void 0;
  }
  constructor(props) {
    this.children = /* @__PURE__ */ new Set();
    this.contain = false;
    this.scopeRef = props.scopeRef;
  }
};
new $9bf71ea28793e738$var$Tree$1();
function $83013635b024ae3d$export$eac1895992b9f3d6(ref, options) {
  let isDisabled = options === null || options === void 0 ? void 0 : options.isDisabled;
  let [hasTabbableChild, setHasTabbableChild] = reactExports.useState(false);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if ((ref === null || ref === void 0 ? void 0 : ref.current) && !isDisabled) {
      let update = () => {
        if (ref.current) {
          let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$1(ref.current, {
            tabbable: true
          });
          setHasTabbableChild(!!walker.nextNode());
        }
      };
      update();
      let observer = new MutationObserver(update);
      observer.observe(ref.current, {
        subtree: true,
        childList: true,
        attributes: true,
        attributeFilter: [
          "tabIndex",
          "disabled"
        ]
      });
      return () => {
        observer.disconnect();
      };
    }
  });
  return isDisabled ? false : hasTabbableChild;
}
function $0175d55c2a017ebc$export$fdf4756d5b8ef90a(props, state, ref) {
  let { key, isDisabled: propsDisabled, shouldSelectOnPressUp } = props;
  let { selectionManager: manager, selectedKey } = state;
  let isSelected = key === selectedKey;
  let isDisabled = propsDisabled || state.isDisabled || state.selectionManager.isDisabled(key);
  let { itemProps, isPressed } = $880e95eb8b93ba9a$export$ecf600387e221c37({
    selectionManager: manager,
    key,
    ref,
    isDisabled,
    shouldSelectOnPressUp,
    linkBehavior: "selection"
  });
  let tabId = $99b62ae3ff97ec45$export$567fc7097e064344(state, key, "tab");
  let tabPanelId = $99b62ae3ff97ec45$export$567fc7097e064344(state, key, "tabpanel");
  let { tabIndex } = itemProps;
  let item = state.collection.getItem(key);
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(item === null || item === void 0 ? void 0 : item.props, {
    labelable: true
  });
  delete domProps.id;
  let linkProps = $ea8dcbcb9ea1b556$export$7e924b3091a3bd18$1(item === null || item === void 0 ? void 0 : item.props);
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2({
    isDisabled
  }, ref);
  return {
    tabProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, focusableProps, linkProps, itemProps, {
      id: tabId,
      "aria-selected": isSelected,
      "aria-disabled": isDisabled || void 0,
      "aria-controls": isSelected ? tabPanelId : void 0,
      tabIndex: isDisabled ? void 0 : tabIndex,
      role: "tab"
    }),
    isSelected,
    isDisabled,
    isPressed
  };
}
function $34bce698202e07cb$export$fae0121b5afe572d(props, state, ref) {
  let tabIndex = $83013635b024ae3d$export$eac1895992b9f3d6(ref) ? void 0 : 0;
  var _props_id;
  const id2 = $99b62ae3ff97ec45$export$567fc7097e064344(state, (_props_id = props.id) !== null && _props_id !== void 0 ? _props_id : state === null || state === void 0 ? void 0 : state.selectedKey, "tabpanel");
  const tabPanelProps = $313b98861ee5dd6c$export$d6875122194c7b44$1({
    ...props,
    id: id2,
    "aria-labelledby": $99b62ae3ff97ec45$export$567fc7097e064344(state, state === null || state === void 0 ? void 0 : state.selectedKey, "tab")
  });
  return {
    tabPanelProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(tabPanelProps, {
      tabIndex,
      role: "tabpanel",
      "aria-describedby": props["aria-describedby"],
      "aria-details": props["aria-details"]
    })
  };
}
class $bfc6f2d60b8a4c40$export$15010ca3c1abe90b {
  getKeyLeftOf(key) {
    if (this.flipDirection)
      return this.getNextKey(key);
    return this.getPreviousKey(key);
  }
  getKeyRightOf(key) {
    if (this.flipDirection)
      return this.getPreviousKey(key);
    return this.getNextKey(key);
  }
  isDisabled(key) {
    var _this_collection_getItem_props, _this_collection_getItem;
    return this.disabledKeys.has(key) || !!((_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : (_this_collection_getItem_props = _this_collection_getItem.props) === null || _this_collection_getItem_props === void 0 ? void 0 : _this_collection_getItem_props.isDisabled);
  }
  getFirstKey() {
    let key = this.collection.getFirstKey();
    if (key != null && this.isDisabled(key))
      key = this.getNextKey(key);
    return key;
  }
  getLastKey() {
    let key = this.collection.getLastKey();
    if (key != null && this.isDisabled(key))
      key = this.getPreviousKey(key);
    return key;
  }
  getKeyAbove(key) {
    if (this.tabDirection)
      return null;
    return this.getPreviousKey(key);
  }
  getKeyBelow(key) {
    if (this.tabDirection)
      return null;
    return this.getNextKey(key);
  }
  getNextKey(startKey) {
    let key = startKey;
    do {
      key = this.collection.getKeyAfter(key);
      if (key == null)
        key = this.collection.getFirstKey();
    } while (key != null && this.isDisabled(key));
    return key;
  }
  getPreviousKey(startKey) {
    let key = startKey;
    do {
      key = this.collection.getKeyBefore(key);
      if (key == null)
        key = this.collection.getLastKey();
    } while (key != null && this.isDisabled(key));
    return key;
  }
  constructor(collection, direction, orientation, disabledKeys = /* @__PURE__ */ new Set()) {
    this.collection = collection;
    this.flipDirection = direction === "rtl" && orientation === "horizontal";
    this.disabledKeys = disabledKeys;
    this.tabDirection = orientation === "horizontal";
  }
}
function $58d314389b21fa3f$export$773e389e644c5874(props, state, ref) {
  let { orientation = "horizontal", keyboardActivation = "automatic" } = props;
  let { collection, selectionManager: manager, disabledKeys } = state;
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let delegate = reactExports.useMemo(() => new $bfc6f2d60b8a4c40$export$15010ca3c1abe90b(collection, direction, orientation, disabledKeys), [
    collection,
    disabledKeys,
    orientation,
    direction
  ]);
  let { collectionProps } = $ae20dd8cbca75726$export$d6daf82dcd84e87c({
    ref,
    selectionManager: manager,
    keyboardDelegate: delegate,
    selectOnFocus: keyboardActivation === "automatic",
    disallowEmptySelection: true,
    scrollRef: ref,
    linkBehavior: "selection"
  });
  let tabsId = $bdb11010cef70236$export$f680877a34711e37$2();
  $99b62ae3ff97ec45$export$c5f62239608282b6.set(state, tabsId);
  let tabListLabelProps = $313b98861ee5dd6c$export$d6875122194c7b44$1({
    ...props,
    id: tabsId
  });
  return {
    tabListProps: {
      ...$3ef42575df84b30b$export$9d1611c77c2fe928$9(collectionProps, tabListLabelProps),
      role: "tablist",
      "aria-orientation": orientation,
      tabIndex: void 0
    }
  };
}
var TabPanel = forwardRef((props, ref) => {
  var _a2, _b2;
  const { as: as2, tabKey, destroyInactiveTabPanel, state, className, slots, classNames: classNames2, ...otherProps } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const { tabPanelProps } = $34bce698202e07cb$export$fae0121b5afe572d({ ...props, id: String(tabKey) }, state, domRef);
  const { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const selectedItem = state.selectedItem;
  const content2 = state.collection.getItem(tabKey).props.children;
  const tabPanelStyles = clsx$4(classNames2 == null ? void 0 : classNames2.panel, className, (_a2 = selectedItem == null ? void 0 : selectedItem.props) == null ? void 0 : _a2.className);
  const isSelected = tabKey === (selectedItem == null ? void 0 : selectedItem.key);
  if (!content2 || !isSelected && destroyInactiveTabPanel) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Component2,
    {
      ref: domRef,
      "data-focus": isFocused,
      "data-focus-visible": isFocusVisible,
      "data-inert": !isSelected ? "true" : void 0,
      inert: getInertValue(!isSelected),
      ...isSelected && mergeProps$3(tabPanelProps, focusProps, otherProps),
      className: (_b2 = slots.panel) == null ? void 0 : _b2.call(slots, { class: tabPanelStyles }),
      "data-slot": "panel",
      children: content2
    }
  );
});
TabPanel.displayName = "HeroUI.TabPanel";
var tab_panel_default = TabPanel;
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$6 = false;
let $6179b936705e76d3$var$hoverCount$6 = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$6() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$6 = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$6 = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$6(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$6();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$6() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$6);
  $6179b936705e76d3$var$hoverCount$6++;
  return () => {
    $6179b936705e76d3$var$hoverCount$6--;
    if ($6179b936705e76d3$var$hoverCount$6 > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$6);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$6(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$6, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$6 && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
var Tab$1 = forwardRef((props, ref) => {
  var _a2;
  const {
    className,
    as: as2,
    item,
    state,
    classNames: classNames2,
    isDisabled: isDisabledProp,
    listRef,
    slots,
    motionProps,
    disableAnimation,
    disableCursorAnimation,
    shouldSelectOnPressUp,
    onClick,
    tabRef,
    ...otherProps
  } = props;
  const { key } = item;
  const domRef = useDOMRef(ref);
  const Component2 = as2 || (props.href ? "a" : "button");
  const shouldFilterDOMProps = typeof Component2 === "string";
  const {
    tabProps,
    isSelected,
    isDisabled: isDisabledItem,
    isPressed
  } = $0175d55c2a017ebc$export$fdf4756d5b8ef90a({ key, isDisabled: isDisabledProp, shouldSelectOnPressUp }, state, domRef);
  if (props.children == null) {
    delete tabProps["aria-controls"];
  }
  const isDisabled = isDisabledProp || isDisabledItem;
  const { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456$6({
    isDisabled
  });
  const tabStyles = clsx$4(classNames2 == null ? void 0 : classNames2.tab, className);
  const [, isMounted] = useIsMounted({
    rerender: true
  });
  const handleClick = () => {
    if (!(domRef == null ? void 0 : domRef.current) || !(listRef == null ? void 0 : listRef.current))
      return;
    t$7(domRef.current, {
      scrollMode: "if-needed",
      behavior: "smooth",
      block: "end",
      inline: "end",
      boundary: listRef == null ? void 0 : listRef.current
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Component2,
    {
      ref: mergeRefs(domRef, tabRef),
      "data-disabled": dataAttr(isDisabledItem),
      "data-focus": dataAttr(isFocused),
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-hover": dataAttr(isHovered),
      "data-hover-unselected": dataAttr((isHovered || isPressed) && !isSelected),
      "data-pressed": dataAttr(isPressed),
      "data-selected": dataAttr(isSelected),
      "data-slot": "tab",
      ...mergeProps$3(
        tabProps,
        !isDisabled ? {
          ...focusProps,
          ...hoverProps
        } : {},
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps,
          omitPropNames: /* @__PURE__ */ new Set(["title"])
        }),
        { onClick: chain(handleClick, onClick, tabProps.onClick) }
      ),
      className: (_a2 = slots.tab) == null ? void 0 : _a2.call(slots, { class: tabStyles }),
      title: otherProps == null ? void 0 : otherProps.titleValue,
      type: Component2 === "button" ? "button" : void 0,
      children: [
        isSelected && !disableAnimation && !disableCursorAnimation && isMounted ? (
          // use synchronous loading for domMax here
          // since lazy loading produces different behaviour
          /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domMax, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            m$3.span,
            {
              className: slots.cursor({ class: classNames2 == null ? void 0 : classNames2.cursor }),
              "data-slot": "cursor",
              layoutDependency: false,
              layoutId: "cursor",
              transition: {
                type: "spring",
                bounce: 0.15,
                duration: 0.5
              },
              ...motionProps
            }
          ) })
        ) : null,
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: slots.tabContent({
              class: classNames2 == null ? void 0 : classNames2.tabContent
            }),
            "data-slot": "tabContent",
            children: item.rendered
          }
        )
      ]
    }
  );
});
Tab$1.displayName = "HeroUI.Tab";
var tab_default = Tab$1;
let $a02d57049d202695$export$d085fb9e920b5ca7$2 = class $a02d57049d202695$export$d085fb9e920b5ca7 {
  *[Symbol.iterator]() {
    yield* this.iterable;
  }
  get size() {
    return this.keyMap.size;
  }
  getKeys() {
    return this.keyMap.keys();
  }
  getKeyBefore(key) {
    let node2 = this.keyMap.get(key);
    var _node_prevKey;
    return node2 ? (_node_prevKey = node2.prevKey) !== null && _node_prevKey !== void 0 ? _node_prevKey : null : null;
  }
  getKeyAfter(key) {
    let node2 = this.keyMap.get(key);
    var _node_nextKey;
    return node2 ? (_node_nextKey = node2.nextKey) !== null && _node_nextKey !== void 0 ? _node_nextKey : null : null;
  }
  getFirstKey() {
    return this.firstKey;
  }
  getLastKey() {
    return this.lastKey;
  }
  getItem(key) {
    var _this_keyMap_get;
    return (_this_keyMap_get = this.keyMap.get(key)) !== null && _this_keyMap_get !== void 0 ? _this_keyMap_get : null;
  }
  at(idx) {
    const keys2 = [
      ...this.getKeys()
    ];
    return this.getItem(keys2[idx]);
  }
  getChildren(key) {
    let node2 = this.keyMap.get(key);
    return (node2 === null || node2 === void 0 ? void 0 : node2.childNodes) || [];
  }
  constructor(nodes) {
    this.keyMap = /* @__PURE__ */ new Map();
    this.firstKey = null;
    this.lastKey = null;
    this.iterable = nodes;
    let visit2 = (node2) => {
      this.keyMap.set(node2.key, node2);
      if (node2.childNodes && node2.type === "section")
        for (let child of node2.childNodes)
          visit2(child);
    };
    for (let node2 of nodes)
      visit2(node2);
    let last = null;
    let index2 = 0;
    for (let [key, node2] of this.keyMap) {
      if (last) {
        last.nextKey = key;
        node2.prevKey = last.key;
      } else {
        this.firstKey = key;
        node2.prevKey = void 0;
      }
      if (node2.type === "item")
        node2.index = index2++;
      last = node2;
      last.nextKey = void 0;
    }
    var _last_key;
    this.lastKey = (_last_key = last === null || last === void 0 ? void 0 : last.key) !== null && _last_key !== void 0 ? _last_key : null;
  }
};
function $e72dd72e1c76a225$export$2f645645f7bca764$2(props) {
  let { filter: filter3, layoutDelegate } = props;
  let selectionState = $7af3f5b51489e0b5$export$253fe78d46329472(props);
  let disabledKeys = reactExports.useMemo(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
    props.disabledKeys
  ]);
  let factory = reactExports.useCallback((nodes) => filter3 ? new $a02d57049d202695$export$d085fb9e920b5ca7$2(filter3(nodes)) : new $a02d57049d202695$export$d085fb9e920b5ca7$2(nodes), [
    filter3
  ]);
  let context = reactExports.useMemo(() => ({
    suppressTextValueWarning: props.suppressTextValueWarning
  }), [
    props.suppressTextValueWarning
  ]);
  let collection = $7613b1592d41b092$export$6cd28814d92fa9c9(props, factory, context);
  let selectionManager = reactExports.useMemo(() => new $d496c0a20b6e58ec$export$6c8a5aaad13c9852(collection, selectionState, {
    layoutDelegate
  }), [
    collection,
    selectionState,
    layoutDelegate
  ]);
  $e72dd72e1c76a225$var$useFocusedKeyReset$2(collection, selectionManager);
  return {
    collection,
    disabledKeys,
    selectionManager
  };
}
function $e72dd72e1c76a225$var$useFocusedKeyReset$2(collection, selectionManager) {
  const cachedCollection = reactExports.useRef(null);
  reactExports.useEffect(() => {
    if (selectionManager.focusedKey != null && !collection.getItem(selectionManager.focusedKey) && cachedCollection.current) {
      const startItem = cachedCollection.current.getItem(selectionManager.focusedKey);
      const cachedItemNodes = [
        ...cachedCollection.current.getKeys()
      ].map((key) => {
        const itemNode = cachedCollection.current.getItem(key);
        return (itemNode === null || itemNode === void 0 ? void 0 : itemNode.type) === "item" ? itemNode : null;
      }).filter((node2) => node2 !== null);
      const itemNodes = [
        ...collection.getKeys()
      ].map((key) => {
        const itemNode = collection.getItem(key);
        return (itemNode === null || itemNode === void 0 ? void 0 : itemNode.type) === "item" ? itemNode : null;
      }).filter((node2) => node2 !== null);
      var _cachedItemNodes_length, _itemNodes_length;
      const diff2 = ((_cachedItemNodes_length = cachedItemNodes === null || cachedItemNodes === void 0 ? void 0 : cachedItemNodes.length) !== null && _cachedItemNodes_length !== void 0 ? _cachedItemNodes_length : 0) - ((_itemNodes_length = itemNodes === null || itemNodes === void 0 ? void 0 : itemNodes.length) !== null && _itemNodes_length !== void 0 ? _itemNodes_length : 0);
      var _startItem_index, _startItem_index1, _itemNodes_length1;
      let index2 = Math.min(diff2 > 1 ? Math.max(((_startItem_index = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index !== void 0 ? _startItem_index : 0) - diff2 + 1, 0) : (_startItem_index1 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index1 !== void 0 ? _startItem_index1 : 0, ((_itemNodes_length1 = itemNodes === null || itemNodes === void 0 ? void 0 : itemNodes.length) !== null && _itemNodes_length1 !== void 0 ? _itemNodes_length1 : 0) - 1);
      let newNode = null;
      let isReverseSearching = false;
      while (index2 >= 0) {
        if (!selectionManager.isDisabled(itemNodes[index2].key)) {
          newNode = itemNodes[index2];
          break;
        }
        if (index2 < itemNodes.length - 1 && !isReverseSearching)
          index2++;
        else {
          isReverseSearching = true;
          var _startItem_index2, _startItem_index3;
          if (index2 > ((_startItem_index2 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index2 !== void 0 ? _startItem_index2 : 0))
            index2 = (_startItem_index3 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index3 !== void 0 ? _startItem_index3 : 0;
          index2--;
        }
      }
      selectionManager.setFocusedKey(newNode ? newNode.key : null);
    }
    cachedCollection.current = collection;
  }, [
    collection,
    selectionManager
  ]);
}
function $a0d645289fe9b86b$export$e7f05e985daf4b5f(props) {
  var _props_defaultSelectedKey;
  let [selectedKey, setSelectedKey] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.selectedKey, (_props_defaultSelectedKey = props.defaultSelectedKey) !== null && _props_defaultSelectedKey !== void 0 ? _props_defaultSelectedKey : null, props.onSelectionChange);
  let selectedKeys = reactExports.useMemo(() => selectedKey != null ? [
    selectedKey
  ] : [], [
    selectedKey
  ]);
  let { collection, disabledKeys, selectionManager } = $e72dd72e1c76a225$export$2f645645f7bca764$2({
    ...props,
    selectionMode: "single",
    disallowEmptySelection: true,
    allowDuplicateSelectionEvents: true,
    selectedKeys,
    onSelectionChange: (keys2) => {
      if (keys2 === "all")
        return;
      var _keys_values_next_value;
      let key = (_keys_values_next_value = keys2.values().next().value) !== null && _keys_values_next_value !== void 0 ? _keys_values_next_value : null;
      if (key === selectedKey && props.onSelectionChange)
        props.onSelectionChange(key);
      setSelectedKey(key);
    }
  });
  let selectedItem = selectedKey != null ? collection.getItem(selectedKey) : null;
  return {
    collection,
    disabledKeys,
    selectionManager,
    selectedKey,
    setSelectedKey,
    selectedItem
  };
}
function $76f919a04c5a7d14$export$4ba071daf4e486(props) {
  var _props_defaultSelectedKey, _ref;
  let state = $a0d645289fe9b86b$export$e7f05e985daf4b5f({
    ...props,
    onSelectionChange: props.onSelectionChange ? (key) => {
      var _props_onSelectionChange;
      if (key != null)
        (_props_onSelectionChange = props.onSelectionChange) === null || _props_onSelectionChange === void 0 ? void 0 : _props_onSelectionChange.call(props, key);
    } : void 0,
    suppressTextValueWarning: true,
    defaultSelectedKey: (_ref = (_props_defaultSelectedKey = props.defaultSelectedKey) !== null && _props_defaultSelectedKey !== void 0 ? _props_defaultSelectedKey : $76f919a04c5a7d14$var$findDefaultSelectedKey(props.collection, props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set())) !== null && _ref !== void 0 ? _ref : void 0
  });
  let { selectionManager, collection, selectedKey: currentSelectedKey } = state;
  let lastSelectedKey = reactExports.useRef(currentSelectedKey);
  reactExports.useEffect(() => {
    let selectedKey = currentSelectedKey;
    if (props.selectedKey == null && (selectionManager.isEmpty || selectedKey == null || !collection.getItem(selectedKey))) {
      selectedKey = $76f919a04c5a7d14$var$findDefaultSelectedKey(collection, state.disabledKeys);
      if (selectedKey != null)
        selectionManager.setSelectedKeys([
          selectedKey
        ]);
    }
    if (selectedKey != null && selectionManager.focusedKey == null || !selectionManager.isFocused && selectedKey !== lastSelectedKey.current)
      selectionManager.setFocusedKey(selectedKey);
    lastSelectedKey.current = selectedKey;
  });
  return {
    ...state,
    isDisabled: props.isDisabled || false
  };
}
function $76f919a04c5a7d14$var$findDefaultSelectedKey(collection, disabledKeys) {
  let selectedKey = null;
  if (collection) {
    var _collection_getItem_props, _collection_getItem, _collection_getItem_props1, _collection_getItem1;
    selectedKey = collection.getFirstKey();
    while (selectedKey != null && (disabledKeys.has(selectedKey) || ((_collection_getItem = collection.getItem(selectedKey)) === null || _collection_getItem === void 0 ? void 0 : (_collection_getItem_props = _collection_getItem.props) === null || _collection_getItem_props === void 0 ? void 0 : _collection_getItem_props.isDisabled)) && selectedKey !== collection.getLastKey())
      selectedKey = collection.getKeyAfter(selectedKey);
    if (selectedKey != null && (disabledKeys.has(selectedKey) || ((_collection_getItem1 = collection.getItem(selectedKey)) === null || _collection_getItem1 === void 0 ? void 0 : (_collection_getItem_props1 = _collection_getItem1.props) === null || _collection_getItem_props1 === void 0 ? void 0 : _collection_getItem_props1.isDisabled)) && selectedKey === collection.getLastKey())
      selectedKey = collection.getFirstKey();
  }
  return selectedKey;
}
function useTabs(originalProps) {
  var _a2, _b2, _c2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, tabs.variantKeys);
  const {
    ref,
    as: as2,
    className,
    classNames: classNames2,
    children,
    disableCursorAnimation,
    motionProps,
    isVertical = false,
    shouldSelectOnPressUp = true,
    destroyInactiveTabPanel = true,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const disableAnimation = (_b2 = (_a2 = originalProps == null ? void 0 : originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const state = $76f919a04c5a7d14$export$4ba071daf4e486({
    children,
    ...otherProps
  });
  const { tabListProps } = $58d314389b21fa3f$export$773e389e644c5874(otherProps, state, domRef);
  const slots = reactExports.useMemo(
    () => tabs({
      ...variantProps2,
      disableAnimation,
      ...isVertical ? { placement: "start" } : {}
    }),
    [objectToDeps(variantProps2), disableAnimation, isVertical]
  );
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const values = reactExports.useMemo(
    () => ({
      state,
      slots,
      classNames: classNames2,
      motionProps,
      disableAnimation,
      listRef: domRef,
      shouldSelectOnPressUp,
      disableCursorAnimation,
      isDisabled: originalProps == null ? void 0 : originalProps.isDisabled
    }),
    [
      state,
      slots,
      domRef,
      motionProps,
      disableAnimation,
      disableCursorAnimation,
      shouldSelectOnPressUp,
      originalProps == null ? void 0 : originalProps.isDisabled,
      classNames2
    ]
  );
  const getBaseProps = reactExports.useCallback(
    (props2) => ({
      "data-slot": "base",
      className: slots.base({ class: clsx$4(baseStyles, props2 == null ? void 0 : props2.className) }),
      ...mergeProps$3(
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        }),
        props2
      )
    }),
    [baseStyles, otherProps, slots]
  );
  const placement = (_c2 = variantProps2.placement) != null ? _c2 : isVertical ? "start" : "top";
  const getWrapperProps = reactExports.useCallback(
    (props2) => ({
      "data-slot": "tabWrapper",
      className: slots.tabWrapper({ class: clsx$4(classNames2 == null ? void 0 : classNames2.tabWrapper, props2 == null ? void 0 : props2.className) }),
      "data-placement": placement,
      "data-vertical": isVertical || placement === "start" || placement === "end" ? "vertical" : "horizontal"
    }),
    [classNames2, slots, placement, isVertical]
  );
  const getTabListProps = reactExports.useCallback(
    (props2) => ({
      ref: domRef,
      "data-slot": "tabList",
      className: slots.tabList({ class: clsx$4(classNames2 == null ? void 0 : classNames2.tabList, props2 == null ? void 0 : props2.className) }),
      ...mergeProps$3(tabListProps, props2)
    }),
    [domRef, tabListProps, classNames2, slots]
  );
  return {
    Component: Component2,
    domRef,
    state,
    values,
    destroyInactiveTabPanel,
    getBaseProps,
    getTabListProps,
    getWrapperProps
  };
}
var Tabs$1 = forwardRef(function Tabs2(props, ref) {
  const {
    Component: Component2,
    values,
    state,
    destroyInactiveTabPanel,
    getBaseProps,
    getTabListProps,
    getWrapperProps
  } = useTabs({
    ...props,
    ref
  });
  const layoutId = reactExports.useId();
  const layoutGroupEnabled = !props.disableAnimation && !props.disableCursorAnimation;
  const tabsProps = {
    state,
    listRef: values.listRef,
    slots: values.slots,
    classNames: values.classNames,
    isDisabled: values.isDisabled,
    motionProps: values.motionProps,
    disableAnimation: values.disableAnimation,
    shouldSelectOnPressUp: values.shouldSelectOnPressUp,
    disableCursorAnimation: values.disableCursorAnimation
  };
  const tabs2 = [...state.collection].map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(tab_default, { item, ...tabsProps, ...item.props }, item.key));
  const renderTabs = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getBaseProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...getTabListProps(), children: layoutGroupEnabled ? /* @__PURE__ */ jsxRuntimeExports.jsx(LayoutGroup, { id: layoutId, children: tabs2 }) : tabs2 }) }),
    [...state.collection].map((item) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        tab_panel_default,
        {
          classNames: values.classNames,
          destroyInactiveTabPanel,
          slots: values.slots,
          state: values.state,
          tabKey: item.key
        },
        item.key
      );
    })
  ] });
  if ("placement" in props || "isVertical" in props) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getWrapperProps(), children: renderTabs });
  }
  return renderTabs;
});
var tabs_default = Tabs$1;
var TabItemBase = $c1d7fb2ec91bae71$export$6d08773d2e66f8f2;
var tab_item_base_default = TabItemBase;
function useDataScrollOverflow$1(props = {}) {
  const {
    domRef,
    isEnabled = true,
    overflowCheck = "vertical",
    visibility = "auto",
    offset: offset2 = 0,
    onVisibilityChange,
    updateDeps = []
  } = props;
  const visibleRef = reactExports.useRef(visibility);
  reactExports.useEffect(() => {
    const el2 = domRef == null ? void 0 : domRef.current;
    if (!el2 || !isEnabled)
      return;
    const setAttributes = (direction, hasBefore, hasAfter, prefix, suffix) => {
      if (visibility === "auto") {
        const both = `${prefix}${capitalize$2(suffix)}Scroll`;
        if (hasBefore && hasAfter) {
          el2.dataset[both] = "true";
          el2.removeAttribute(`data-${prefix}-scroll`);
          el2.removeAttribute(`data-${suffix}-scroll`);
        } else {
          el2.dataset[`${prefix}Scroll`] = hasBefore.toString();
          el2.dataset[`${suffix}Scroll`] = hasAfter.toString();
          el2.removeAttribute(`data-${prefix}-${suffix}-scroll`);
        }
      } else {
        const next2 = hasBefore && hasAfter ? "both" : hasBefore ? prefix : hasAfter ? suffix : "none";
        if (next2 !== visibleRef.current) {
          onVisibilityChange == null ? void 0 : onVisibilityChange(next2);
          visibleRef.current = next2;
        }
      }
    };
    const checkOverflow2 = () => {
      var _a2, _b2;
      const directions2 = [
        { type: "vertical", prefix: "top", suffix: "bottom" },
        { type: "horizontal", prefix: "left", suffix: "right" }
      ];
      const listbox = el2.querySelector('ul[data-slot="list"]');
      const scrollHeight = +((_a2 = listbox == null ? void 0 : listbox.getAttribute("data-virtual-scroll-height")) != null ? _a2 : el2.scrollHeight);
      const scrollTop = +((_b2 = listbox == null ? void 0 : listbox.getAttribute("data-virtual-scroll-top")) != null ? _b2 : el2.scrollTop);
      for (const { type: type4, prefix, suffix } of directions2) {
        if (overflowCheck === type4 || overflowCheck === "both") {
          const hasBefore = type4 === "vertical" ? scrollTop > offset2 : el2.scrollLeft > offset2;
          const hasAfter = type4 === "vertical" ? scrollTop + el2.clientHeight + offset2 < scrollHeight : el2.scrollLeft + el2.clientWidth + offset2 < el2.scrollWidth;
          setAttributes(type4, hasBefore, hasAfter, prefix, suffix);
        }
      }
    };
    const clearOverflow = () => {
      ["top", "bottom", "top-bottom", "left", "right", "left-right"].forEach((attr) => {
        el2.removeAttribute(`data-${attr}-scroll`);
      });
    };
    checkOverflow2();
    el2.addEventListener("scroll", checkOverflow2, true);
    if (visibility !== "auto") {
      clearOverflow();
      if (visibility === "both") {
        el2.dataset.topBottomScroll = String(overflowCheck === "vertical");
        el2.dataset.leftRightScroll = String(overflowCheck === "horizontal");
      } else {
        el2.dataset.topBottomScroll = "false";
        el2.dataset.leftRightScroll = "false";
        ["top", "bottom", "left", "right"].forEach((attr) => {
          el2.dataset[`${attr}Scroll`] = String(visibility === attr);
        });
      }
    }
    return () => {
      el2.removeEventListener("scroll", checkOverflow2, true);
      clearOverflow();
    };
  }, [...updateDeps, isEnabled, visibility, overflowCheck, onVisibilityChange, domRef]);
}
function useScrollShadow$1(originalProps) {
  var _a2;
  const [props, variantProps2] = mapPropsVariants(originalProps, scrollShadow.variantKeys);
  const {
    ref,
    as: as2,
    children,
    className,
    style: style2,
    size: size2 = 40,
    offset: offset2 = 0,
    visibility = "auto",
    isEnabled = true,
    onVisibilityChange,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  useDataScrollOverflow$1({
    domRef,
    offset: offset2,
    visibility,
    isEnabled,
    onVisibilityChange,
    updateDeps: [children],
    overflowCheck: (_a2 = originalProps.orientation) != null ? _a2 : "vertical"
  });
  const styles2 = reactExports.useMemo(
    () => scrollShadow({
      ...variantProps2,
      className
    }),
    [objectToDeps(variantProps2), className]
  );
  const getBaseProps = (props2 = {}) => {
    var _a22;
    return {
      ref: domRef,
      className: styles2,
      "data-orientation": (_a22 = originalProps.orientation) != null ? _a22 : "vertical",
      style: {
        "--scroll-shadow-size": `${size2}px`,
        ...style2,
        ...props2.style
      },
      ...otherProps,
      ...props2
    };
  };
  return { Component: Component2, styles: styles2, domRef, children, getBaseProps };
}
var ScrollShadow = forwardRef((props, ref) => {
  const { Component: Component2, children, getBaseProps } = useScrollShadow$1({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...getBaseProps(), children });
});
ScrollShadow.displayName = "HeroUI.ScrollShadow";
var scroll_shadow_default = ScrollShadow;
function $8a9cb279dc87e130$export$525bc4921d56d4a$4(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$4(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$cabe61c495ee3649$4(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$3(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$4(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$4 = "default";
let $14c0b72509d70225$var$savedUserSelect$4 = "";
let $14c0b72509d70225$var$modifiedElementMap$4 = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$4(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$4 === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
      $14c0b72509d70225$var$savedUserSelect$4 = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$4 = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$4.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$4(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$4 !== "disabled")
      return;
    $14c0b72509d70225$var$state$4 = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
        if ($14c0b72509d70225$var$state$4 === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$4 || "";
          $14c0b72509d70225$var$savedUserSelect$4 = "";
          $14c0b72509d70225$var$state$4 = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$4.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$4.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$4.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$4 = React$5.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$4.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext$4(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$4);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$9(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$4 = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$4 = class $f6c31cce2adf654f$var$PressEvent8 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$4, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$4);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$4, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$4, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$4 = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$4 = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$4 = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$4(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$4(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$4("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$4("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$4("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$4("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$4(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$4(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$4(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$4(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$4(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$4($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$4(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$3(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$4(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$9(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$6())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$4(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$4(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$4(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$4(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$4($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$4(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$4(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$4]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$4] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$3(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$4(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$4(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$4(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$4(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$5(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$4))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$4;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$4}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$4((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$4]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$4(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$4(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$4(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$4(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$4(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$4(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$4(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$4(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$4(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$4(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$4 = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$4(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$4.has(target.type);
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$5 = false;
let $6179b936705e76d3$var$hoverCount$5 = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$5() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$5 = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$5 = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$5(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$5();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$5() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$5);
  $6179b936705e76d3$var$hoverCount$5++;
  return () => {
    $6179b936705e76d3$var$hoverCount$5--;
    if ($6179b936705e76d3$var$hoverCount$5 > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$5);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$5(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$5, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$5 && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
let $a02d57049d202695$export$d085fb9e920b5ca7$1 = class $a02d57049d202695$export$d085fb9e920b5ca72 {
  *[Symbol.iterator]() {
    yield* this.iterable;
  }
  get size() {
    return this.keyMap.size;
  }
  getKeys() {
    return this.keyMap.keys();
  }
  getKeyBefore(key) {
    let node2 = this.keyMap.get(key);
    var _node_prevKey;
    return node2 ? (_node_prevKey = node2.prevKey) !== null && _node_prevKey !== void 0 ? _node_prevKey : null : null;
  }
  getKeyAfter(key) {
    let node2 = this.keyMap.get(key);
    var _node_nextKey;
    return node2 ? (_node_nextKey = node2.nextKey) !== null && _node_nextKey !== void 0 ? _node_nextKey : null : null;
  }
  getFirstKey() {
    return this.firstKey;
  }
  getLastKey() {
    return this.lastKey;
  }
  getItem(key) {
    var _this_keyMap_get;
    return (_this_keyMap_get = this.keyMap.get(key)) !== null && _this_keyMap_get !== void 0 ? _this_keyMap_get : null;
  }
  at(idx) {
    const keys2 = [
      ...this.getKeys()
    ];
    return this.getItem(keys2[idx]);
  }
  getChildren(key) {
    let node2 = this.keyMap.get(key);
    return (node2 === null || node2 === void 0 ? void 0 : node2.childNodes) || [];
  }
  constructor(nodes) {
    this.keyMap = /* @__PURE__ */ new Map();
    this.firstKey = null;
    this.lastKey = null;
    this.iterable = nodes;
    let visit2 = (node2) => {
      this.keyMap.set(node2.key, node2);
      if (node2.childNodes && node2.type === "section")
        for (let child of node2.childNodes)
          visit2(child);
    };
    for (let node2 of nodes)
      visit2(node2);
    let last = null;
    let index2 = 0;
    for (let [key, node2] of this.keyMap) {
      if (last) {
        last.nextKey = key;
        node2.prevKey = last.key;
      } else {
        this.firstKey = key;
        node2.prevKey = void 0;
      }
      if (node2.type === "item")
        node2.index = index2++;
      last = node2;
      last.nextKey = void 0;
    }
    var _last_key;
    this.lastKey = (_last_key = last === null || last === void 0 ? void 0 : last.key) !== null && _last_key !== void 0 ? _last_key : null;
  }
};
function $e72dd72e1c76a225$export$2f645645f7bca764$1(props) {
  let { filter: filter3, layoutDelegate } = props;
  let selectionState = $7af3f5b51489e0b5$export$253fe78d46329472(props);
  let disabledKeys = reactExports.useMemo(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
    props.disabledKeys
  ]);
  let factory = reactExports.useCallback((nodes) => filter3 ? new $a02d57049d202695$export$d085fb9e920b5ca7$1(filter3(nodes)) : new $a02d57049d202695$export$d085fb9e920b5ca7$1(nodes), [
    filter3
  ]);
  let context = reactExports.useMemo(() => ({
    suppressTextValueWarning: props.suppressTextValueWarning
  }), [
    props.suppressTextValueWarning
  ]);
  let collection = $7613b1592d41b092$export$6cd28814d92fa9c9(props, factory, context);
  let selectionManager = reactExports.useMemo(() => new $d496c0a20b6e58ec$export$6c8a5aaad13c9852(collection, selectionState, {
    layoutDelegate
  }), [
    collection,
    selectionState,
    layoutDelegate
  ]);
  $e72dd72e1c76a225$var$useFocusedKeyReset$1(collection, selectionManager);
  return {
    collection,
    disabledKeys,
    selectionManager
  };
}
function $e72dd72e1c76a225$var$useFocusedKeyReset$1(collection, selectionManager) {
  const cachedCollection = reactExports.useRef(null);
  reactExports.useEffect(() => {
    if (selectionManager.focusedKey != null && !collection.getItem(selectionManager.focusedKey) && cachedCollection.current) {
      const startItem = cachedCollection.current.getItem(selectionManager.focusedKey);
      const cachedItemNodes = [
        ...cachedCollection.current.getKeys()
      ].map((key) => {
        const itemNode = cachedCollection.current.getItem(key);
        return (itemNode === null || itemNode === void 0 ? void 0 : itemNode.type) === "item" ? itemNode : null;
      }).filter((node2) => node2 !== null);
      const itemNodes = [
        ...collection.getKeys()
      ].map((key) => {
        const itemNode = collection.getItem(key);
        return (itemNode === null || itemNode === void 0 ? void 0 : itemNode.type) === "item" ? itemNode : null;
      }).filter((node2) => node2 !== null);
      var _cachedItemNodes_length, _itemNodes_length;
      const diff2 = ((_cachedItemNodes_length = cachedItemNodes === null || cachedItemNodes === void 0 ? void 0 : cachedItemNodes.length) !== null && _cachedItemNodes_length !== void 0 ? _cachedItemNodes_length : 0) - ((_itemNodes_length = itemNodes === null || itemNodes === void 0 ? void 0 : itemNodes.length) !== null && _itemNodes_length !== void 0 ? _itemNodes_length : 0);
      var _startItem_index, _startItem_index1, _itemNodes_length1;
      let index2 = Math.min(diff2 > 1 ? Math.max(((_startItem_index = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index !== void 0 ? _startItem_index : 0) - diff2 + 1, 0) : (_startItem_index1 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index1 !== void 0 ? _startItem_index1 : 0, ((_itemNodes_length1 = itemNodes === null || itemNodes === void 0 ? void 0 : itemNodes.length) !== null && _itemNodes_length1 !== void 0 ? _itemNodes_length1 : 0) - 1);
      let newNode = null;
      let isReverseSearching = false;
      while (index2 >= 0) {
        if (!selectionManager.isDisabled(itemNodes[index2].key)) {
          newNode = itemNodes[index2];
          break;
        }
        if (index2 < itemNodes.length - 1 && !isReverseSearching)
          index2++;
        else {
          isReverseSearching = true;
          var _startItem_index2, _startItem_index3;
          if (index2 > ((_startItem_index2 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index2 !== void 0 ? _startItem_index2 : 0))
            index2 = (_startItem_index3 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index3 !== void 0 ? _startItem_index3 : 0;
          index2--;
        }
      }
      selectionManager.setFocusedKey(newNode ? newNode.key : null);
    }
    cachedCollection.current = collection;
  }, [
    collection,
    selectionManager
  ]);
}
function useMultiSelectListState(props) {
  const {
    collection,
    disabledKeys,
    selectionManager,
    selectionManager: { setSelectedKeys, selectedKeys, selectionMode }
  } = $e72dd72e1c76a225$export$2f645645f7bca764$1(props);
  const missingKeys = reactExports.useMemo(() => {
    if (!props.isLoading && selectedKeys.size !== 0) {
      return Array.from(selectedKeys).filter(Boolean).filter((key) => !collection.getItem(key));
    }
    return [];
  }, [selectedKeys, collection]);
  const selectedItems = selectedKeys.size !== 0 ? Array.from(selectedKeys).map((key) => {
    return collection.getItem(key);
  }).filter(Boolean) : null;
  if (missingKeys.length) {
    console.warn(
      `Select: Keys "${missingKeys.join(
        ", "
      )}" passed to "selectedKeys" are not present in the collection.`
    );
  }
  return {
    collection,
    disabledKeys,
    selectionManager,
    selectionMode,
    selectedKeys,
    setSelectedKeys: setSelectedKeys.bind(selectionManager),
    selectedItems
  };
}
function $a28c903ee9ad8dc5$export$79fefeb1c2091ac3(props) {
  let overlayTriggerState = $fc909762b330b746$export$61c6a8c84e605fb6$2(props);
  let [focusStrategy, setFocusStrategy] = reactExports.useState(null);
  let [expandedKeysStack, setExpandedKeysStack] = reactExports.useState([]);
  let closeAll = () => {
    setExpandedKeysStack([]);
    overlayTriggerState.close();
  };
  let openSubmenu = (triggerKey, level) => {
    setExpandedKeysStack((oldStack) => {
      if (level > oldStack.length)
        return oldStack;
      return [
        ...oldStack.slice(0, level),
        triggerKey
      ];
    });
  };
  let closeSubmenu = (triggerKey, level) => {
    setExpandedKeysStack((oldStack) => {
      let key = oldStack[level];
      if (key === triggerKey)
        return oldStack.slice(0, level);
      else
        return oldStack;
    });
  };
  return {
    focusStrategy,
    ...overlayTriggerState,
    open(focusStrategy2 = null) {
      setFocusStrategy(focusStrategy2);
      overlayTriggerState.open();
    },
    toggle(focusStrategy2 = null) {
      setFocusStrategy(focusStrategy2);
      overlayTriggerState.toggle();
    },
    close() {
      closeAll();
    },
    expandedKeysStack,
    openSubmenu,
    closeSubmenu
  };
}
const $e5be200c675c3b3a$export$aca958c65c314e6c = {
  badInput: false,
  customError: false,
  patternMismatch: false,
  rangeOverflow: false,
  rangeUnderflow: false,
  stepMismatch: false,
  tooLong: false,
  tooShort: false,
  typeMismatch: false,
  valueMissing: false,
  valid: true
};
const $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE = {
  ...$e5be200c675c3b3a$export$aca958c65c314e6c,
  customError: true,
  valid: false
};
const $e5be200c675c3b3a$export$dad6ae84456c676a = {
  isInvalid: false,
  validationDetails: $e5be200c675c3b3a$export$aca958c65c314e6c,
  validationErrors: []
};
const $e5be200c675c3b3a$export$571b5131b7e65c11 = reactExports.createContext({});
const $e5be200c675c3b3a$export$a763b9476acd3eb = "__formValidationState" + Date.now();
function $e5be200c675c3b3a$export$fc1a364ae1f3ff10(props) {
  if (props[$e5be200c675c3b3a$export$a763b9476acd3eb]) {
    let { realtimeValidation, displayValidation, updateValidation, resetValidation, commitValidation } = props[$e5be200c675c3b3a$export$a763b9476acd3eb];
    return {
      realtimeValidation,
      displayValidation,
      updateValidation,
      resetValidation,
      commitValidation
    };
  }
  return $e5be200c675c3b3a$var$useFormValidationStateImpl(props);
}
function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
  let { isInvalid, validationState, name: name2, value: value2, builtinValidation, validate: validate2, validationBehavior = "aria" } = props;
  if (validationState)
    isInvalid || (isInvalid = validationState === "invalid");
  let controlledError = isInvalid !== void 0 ? {
    isInvalid,
    validationErrors: [],
    validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
  } : null;
  let clientError = reactExports.useMemo(() => {
    if (!validate2 || value2 == null)
      return null;
    let validateErrors = $e5be200c675c3b3a$var$runValidate(validate2, value2);
    return $e5be200c675c3b3a$var$getValidationResult(validateErrors);
  }, [
    validate2,
    value2
  ]);
  if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid)
    builtinValidation = void 0;
  let serverErrors = reactExports.useContext($e5be200c675c3b3a$export$571b5131b7e65c11);
  let serverErrorMessages = reactExports.useMemo(() => {
    if (name2)
      return Array.isArray(name2) ? name2.flatMap((name3) => $e5be200c675c3b3a$var$asArray(serverErrors[name3])) : $e5be200c675c3b3a$var$asArray(serverErrors[name2]);
    return [];
  }, [
    serverErrors,
    name2
  ]);
  let [lastServerErrors, setLastServerErrors] = reactExports.useState(serverErrors);
  let [isServerErrorCleared, setServerErrorCleared] = reactExports.useState(false);
  if (serverErrors !== lastServerErrors) {
    setLastServerErrors(serverErrors);
    setServerErrorCleared(false);
  }
  let serverError = reactExports.useMemo(() => $e5be200c675c3b3a$var$getValidationResult(isServerErrorCleared ? [] : serverErrorMessages), [
    isServerErrorCleared,
    serverErrorMessages
  ]);
  let nextValidation = reactExports.useRef($e5be200c675c3b3a$export$dad6ae84456c676a);
  let [currentValidity, setCurrentValidity] = reactExports.useState($e5be200c675c3b3a$export$dad6ae84456c676a);
  let lastError = reactExports.useRef($e5be200c675c3b3a$export$dad6ae84456c676a);
  let commitValidation = () => {
    if (!commitQueued)
      return;
    setCommitQueued(false);
    let error2 = clientError || builtinValidation || nextValidation.current;
    if (!$e5be200c675c3b3a$var$isEqualValidation(error2, lastError.current)) {
      lastError.current = error2;
      setCurrentValidity(error2);
    }
  };
  let [commitQueued, setCommitQueued] = reactExports.useState(false);
  reactExports.useEffect(commitValidation);
  let realtimeValidation = controlledError || serverError || clientError || builtinValidation || $e5be200c675c3b3a$export$dad6ae84456c676a;
  let displayValidation = validationBehavior === "native" ? controlledError || serverError || currentValidity : controlledError || serverError || clientError || builtinValidation || currentValidity;
  return {
    realtimeValidation,
    displayValidation,
    updateValidation(value3) {
      if (validationBehavior === "aria" && !$e5be200c675c3b3a$var$isEqualValidation(currentValidity, value3))
        setCurrentValidity(value3);
      else
        nextValidation.current = value3;
    },
    resetValidation() {
      let error2 = $e5be200c675c3b3a$export$dad6ae84456c676a;
      if (!$e5be200c675c3b3a$var$isEqualValidation(error2, lastError.current)) {
        lastError.current = error2;
        setCurrentValidity(error2);
      }
      if (validationBehavior === "native")
        setCommitQueued(false);
      setServerErrorCleared(true);
    },
    commitValidation() {
      if (validationBehavior === "native")
        setCommitQueued(true);
      setServerErrorCleared(true);
    }
  };
}
function $e5be200c675c3b3a$var$asArray(v2) {
  if (!v2)
    return [];
  return Array.isArray(v2) ? v2 : [
    v2
  ];
}
function $e5be200c675c3b3a$var$runValidate(validate2, value2) {
  if (typeof validate2 === "function") {
    let e2 = validate2(value2);
    if (e2 && typeof e2 !== "boolean")
      return $e5be200c675c3b3a$var$asArray(e2);
  }
  return [];
}
function $e5be200c675c3b3a$var$getValidationResult(errors) {
  return errors.length ? {
    isInvalid: true,
    validationErrors: errors,
    validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
  } : null;
}
function $e5be200c675c3b3a$var$isEqualValidation(a2, b2) {
  if (a2 === b2)
    return true;
  return !!a2 && !!b2 && a2.isInvalid === b2.isInvalid && a2.validationErrors.length === b2.validationErrors.length && a2.validationErrors.every((a3, i2) => a3 === b2.validationErrors[i2]) && Object.entries(a2.validationDetails).every(([k2, v2]) => b2.validationDetails[k2] === v2);
}
function useMultiSelectState({
  validate: validate2,
  validationBehavior,
  ...props
}) {
  const [isFocused, setFocused] = reactExports.useState(false);
  const [focusStrategy, setFocusStrategy] = reactExports.useState(null);
  const triggerState = $a28c903ee9ad8dc5$export$79fefeb1c2091ac3(props);
  const listState = useMultiSelectListState({
    ...props,
    onSelectionChange: (keys2) => {
      if (props.onSelectionChange != null) {
        if (keys2 === "all") {
          props.onSelectionChange(new Set(listState.collection.getKeys()));
        } else {
          props.onSelectionChange(keys2);
        }
      }
      if (props.selectionMode === "single") {
        triggerState.close();
      }
    }
  });
  const validationState = $e5be200c675c3b3a$export$fc1a364ae1f3ff10({
    ...props,
    validationBehavior,
    validate: (value2) => {
      if (!validate2)
        return;
      const keys2 = Array.from(value2);
      return validate2(props.selectionMode === "single" ? keys2[0] : keys2);
    },
    // @ts-ignore
    value: listState.selectedKeys
  });
  const shouldHideContent = listState.collection.size === 0 && props.hideEmptyContent;
  return {
    ...validationState,
    ...listState,
    ...triggerState,
    focusStrategy,
    close() {
      triggerState.close();
    },
    open(focusStrategy2 = null) {
      if (shouldHideContent)
        return;
      setFocusStrategy(focusStrategy2);
      triggerState.open();
    },
    toggle(focusStrategy2 = null) {
      if (shouldHideContent)
        return;
      setFocusStrategy(focusStrategy2);
      triggerState.toggle();
    },
    isFocused,
    setFocused
  };
}
const $148a7a147e38ea7f$var$RTL_SCRIPTS$6 = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS$6 = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764$6(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS$6.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS$6.has(lang2);
}
const $b5e257d569688ac6$var$defaultContext$6 = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$6 = /* @__PURE__ */ React$5.createContext($b5e257d569688ac6$var$defaultContext$6);
const $b5e257d569688ac6$var$IsSSRContext$6 = /* @__PURE__ */ React$5.createContext(false);
let $b5e257d569688ac6$var$componentIds$6 = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$6(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$6);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$6.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$6.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$6.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$6(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$6);
  let counter = $b5e257d569688ac6$var$useCounter$6(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$6(defaultId) {
  let id2 = React$5.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$6());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$6.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
const $b5e257d569688ac6$export$619500959fc48b26 = typeof React$5["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$6 : $b5e257d569688ac6$var$useLegacySSRSafeId$6;
function $b5e257d569688ac6$var$getSnapshot$6() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$6() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$6(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$6() {
  if (typeof React$5["useSyncExternalStore"] === "function")
    return React$5["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$6, $b5e257d569688ac6$var$getSnapshot$6, $b5e257d569688ac6$var$getServerSnapshot$6);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$6);
}
const $1e5a04cdaf7d1af8$var$localeSymbol$6 = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$6() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol$6] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764$6(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale$6 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$6();
let $1e5a04cdaf7d1af8$var$listeners$6 = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale$6() {
  $1e5a04cdaf7d1af8$var$currentLocale$6 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$6();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners$6)
    listener($1e5a04cdaf7d1af8$var$currentLocale$6);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$6() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$6();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale$6);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners$6.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$6);
    $1e5a04cdaf7d1af8$var$listeners$6.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners$6.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners$6.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$6);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext$6 = /* @__PURE__ */ React$5.createContext(null);
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$6() {
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$6();
  let context = reactExports.useContext($18f2051aff69b9bf$var$I18nContext$6);
  return context || defaultLocale;
}
let $325a3faab7a68acd$var$cache$1 = /* @__PURE__ */ new Map();
function $325a3faab7a68acd$export$a16aca283550c30d$1(options) {
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$6();
  let cacheKey = locale2 + (options ? Object.entries(options).sort((a2, b2) => a2[0] < b2[0] ? -1 : 1).join() : "");
  if ($325a3faab7a68acd$var$cache$1.has(cacheKey))
    return $325a3faab7a68acd$var$cache$1.get(cacheKey);
  let formatter = new Intl.Collator(locale2, options);
  $325a3faab7a68acd$var$cache$1.set(cacheKey, formatter);
  return formatter;
}
const $431fbd86ca7dc216$export$b204af158042fbac = (el2) => {
  var _el_ownerDocument;
  return (_el_ownerDocument = el2 === null || el2 === void 0 ? void 0 : el2.ownerDocument) !== null && _el_ownerDocument !== void 0 ? _el_ownerDocument : document;
};
const $431fbd86ca7dc216$export$f21a1ffae260145a = (el2) => {
  if (el2 && "window" in el2 && el2.window === el2)
    return el2;
  const doc = $431fbd86ca7dc216$export$b204af158042fbac(el2);
  return doc.defaultView || window;
};
function $c87311424ea30a05$var$testUserAgent(re2) {
  var _window_navigator_userAgentData;
  if (typeof window === "undefined" || window.navigator == null)
    return false;
  let brands = (_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands;
  return Array.isArray(brands) && brands.some((brand) => re2.test(brand.brand)) || re2.test(window.navigator.userAgent);
}
function $c87311424ea30a05$var$testPlatform(re2) {
  var _window_navigator_userAgentData;
  return typeof window !== "undefined" && window.navigator != null ? re2.test(((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
}
function $c87311424ea30a05$var$cached(fn) {
  let res = null;
  return () => {
    if (res == null)
      res = fn();
    return res;
  };
}
const $c87311424ea30a05$export$9ac100e40613ea10 = $c87311424ea30a05$var$cached(function() {
  return $c87311424ea30a05$var$testPlatform(/^Mac/i);
});
const $c87311424ea30a05$export$a11b0059900ceec8 = $c87311424ea30a05$var$cached(function() {
  return $c87311424ea30a05$var$testUserAgent(/Android/i);
});
function $6a7db85432448f7f$export$60278871457622de(event) {
  if (event.mozInputSource === 0 && event.isTrusted)
    return true;
  if ($c87311424ea30a05$export$a11b0059900ceec8() && event.pointerType)
    return event.type === "click" && event.buttons === 1;
  return event.detail === 0 && !event.pointerType;
}
let $8a9cb279dc87e130$export$fda7da73ab5d4c48$2 = false;
let $507fabe10e71c6fb$var$changeHandlers$2 = /* @__PURE__ */ new Set();
let $507fabe10e71c6fb$export$d90243b58daecda7$2 = /* @__PURE__ */ new Map();
let $507fabe10e71c6fb$var$hasEventBeforeFocus$2 = false;
let $507fabe10e71c6fb$var$hasBlurredWindowRecently$2 = false;
function $507fabe10e71c6fb$var$triggerChangeHandlers$2(modality, e2) {
  for (let handler of $507fabe10e71c6fb$var$changeHandlers$2)
    handler(modality, e2);
}
function $507fabe10e71c6fb$var$isValidKey$2(e2) {
  return !(e2.metaKey || !$c87311424ea30a05$export$9ac100e40613ea10() && e2.altKey || e2.ctrlKey || e2.key === "Control" || e2.key === "Shift" || e2.key === "Meta");
}
function $507fabe10e71c6fb$var$handleKeyboardEvent$2(e2) {
  $507fabe10e71c6fb$var$hasEventBeforeFocus$2 = true;
  if ($507fabe10e71c6fb$var$isValidKey$2(e2)) {
    $507fabe10e71c6fb$var$triggerChangeHandlers$2("keyboard", e2);
  }
}
function $507fabe10e71c6fb$var$handlePointerEvent$2(e2) {
  if (e2.type === "mousedown" || e2.type === "pointerdown") {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$2 = true;
    $507fabe10e71c6fb$var$triggerChangeHandlers$2("pointer", e2);
  }
}
function $507fabe10e71c6fb$var$handleClickEvent$2(e2) {
  if ($6a7db85432448f7f$export$60278871457622de(e2)) {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$2 = true;
  }
}
function $507fabe10e71c6fb$var$handleFocusEvent$2(e2) {
  if (e2.target === window || e2.target === document || $8a9cb279dc87e130$export$fda7da73ab5d4c48$2 || !e2.isTrusted)
    return;
  if (!$507fabe10e71c6fb$var$hasEventBeforeFocus$2 && !$507fabe10e71c6fb$var$hasBlurredWindowRecently$2) {
    $507fabe10e71c6fb$var$triggerChangeHandlers$2("virtual", e2);
  }
  $507fabe10e71c6fb$var$hasEventBeforeFocus$2 = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently$2 = false;
}
function $507fabe10e71c6fb$var$handleWindowBlur$2() {
  $507fabe10e71c6fb$var$hasEventBeforeFocus$2 = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently$2 = true;
}
function $507fabe10e71c6fb$var$setupGlobalFocusEvents$2(element2) {
  if (typeof window === "undefined" || typeof document === "undefined" || $507fabe10e71c6fb$export$d90243b58daecda7$2.get($431fbd86ca7dc216$export$f21a1ffae260145a(element2)))
    return;
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac(element2);
  let focus = windowObject.HTMLElement.prototype.focus;
  windowObject.HTMLElement.prototype.focus = function() {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$2 = true;
    focus.apply(this, arguments);
  };
  documentObject.addEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent$2, true);
  documentObject.addEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent$2, true);
  documentObject.addEventListener("click", $507fabe10e71c6fb$var$handleClickEvent$2, true);
  windowObject.addEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent$2, true);
  windowObject.addEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur$2, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.addEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent$2, true);
    documentObject.addEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent$2, true);
    documentObject.addEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent$2, true);
  }
  windowObject.addEventListener("beforeunload", () => {
    $507fabe10e71c6fb$var$tearDownWindowFocusTracking$2(element2);
  }, {
    once: true
  });
  $507fabe10e71c6fb$export$d90243b58daecda7$2.set(windowObject, {
    focus
  });
}
const $507fabe10e71c6fb$var$tearDownWindowFocusTracking$2 = (element2, loadListener) => {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac(element2);
  if (loadListener)
    documentObject.removeEventListener("DOMContentLoaded", loadListener);
  if (!$507fabe10e71c6fb$export$d90243b58daecda7$2.has(windowObject))
    return;
  windowObject.HTMLElement.prototype.focus = $507fabe10e71c6fb$export$d90243b58daecda7$2.get(windowObject).focus;
  documentObject.removeEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent$2, true);
  documentObject.removeEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent$2, true);
  documentObject.removeEventListener("click", $507fabe10e71c6fb$var$handleClickEvent$2, true);
  windowObject.removeEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent$2, true);
  windowObject.removeEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur$2, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.removeEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent$2, true);
    documentObject.removeEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent$2, true);
    documentObject.removeEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent$2, true);
  }
  $507fabe10e71c6fb$export$d90243b58daecda7$2.delete(windowObject);
};
function $507fabe10e71c6fb$export$2f1888112f558a7d$2(element2) {
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac(element2);
  let loadListener;
  if (documentObject.readyState !== "loading")
    $507fabe10e71c6fb$var$setupGlobalFocusEvents$2(element2);
  else {
    loadListener = () => {
      $507fabe10e71c6fb$var$setupGlobalFocusEvents$2(element2);
    };
    documentObject.addEventListener("DOMContentLoaded", loadListener);
  }
  return () => $507fabe10e71c6fb$var$tearDownWindowFocusTracking$2(element2, loadListener);
}
if (typeof document !== "undefined")
  $507fabe10e71c6fb$export$2f1888112f558a7d$2();
function $507fabe10e71c6fb$export$8397ddfc504fdb9a$1(modality) {
  $507fabe10e71c6fb$var$triggerChangeHandlers$2(modality, null);
}
const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$1 = typeof document !== "undefined" ? React$5.useLayoutEffect : () => {
};
var $8ae05eaa5c114e9c$var$_React_useInsertionEffect;
const $8ae05eaa5c114e9c$var$useEarlyEffect = ($8ae05eaa5c114e9c$var$_React_useInsertionEffect = React$5["useInsertionEffect"]) !== null && $8ae05eaa5c114e9c$var$_React_useInsertionEffect !== void 0 ? $8ae05eaa5c114e9c$var$_React_useInsertionEffect : $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$1;
function $8ae05eaa5c114e9c$export$7f54fc3180508a52(fn) {
  const ref = reactExports.useRef(null);
  $8ae05eaa5c114e9c$var$useEarlyEffect(() => {
    ref.current = fn;
  }, [
    fn
  ]);
  return reactExports.useCallback((...args) => {
    const f2 = ref.current;
    return f2 === null || f2 === void 0 ? void 0 : f2(...args);
  }, []);
}
function $1dbecbe27a04f9af$export$14d238f342723f25(defaultValue2) {
  let [value2, setValue] = reactExports.useState(defaultValue2);
  let effect = reactExports.useRef(null);
  let nextRef = $8ae05eaa5c114e9c$export$7f54fc3180508a52(() => {
    if (!effect.current)
      return;
    let newValue = effect.current.next();
    if (newValue.done) {
      effect.current = null;
      return;
    }
    if (value2 === newValue.value)
      nextRef();
    else
      setValue(newValue.value);
  });
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$1(() => {
    if (effect.current)
      nextRef();
  });
  let queue = $8ae05eaa5c114e9c$export$7f54fc3180508a52((fn) => {
    effect.current = fn(value2);
    nextRef();
  });
  return [
    value2,
    queue
  ];
}
let $bdb11010cef70236$var$canUseDOM$1 = Boolean(typeof window !== "undefined" && window.document && window.document.createElement);
let $bdb11010cef70236$export$d41a04c74483c6ef$2 = /* @__PURE__ */ new Map();
let $bdb11010cef70236$var$registry$1;
if (typeof FinalizationRegistry !== "undefined")
  $bdb11010cef70236$var$registry$1 = new FinalizationRegistry((heldValue) => {
    $bdb11010cef70236$export$d41a04c74483c6ef$2.delete(heldValue);
  });
function $bdb11010cef70236$export$f680877a34711e37$1(defaultId) {
  let [value2, setValue] = reactExports.useState(defaultId);
  let nextId = reactExports.useRef(null);
  let res = $b5e257d569688ac6$export$619500959fc48b26(value2);
  let cleanupRef = reactExports.useRef(null);
  if ($bdb11010cef70236$var$registry$1)
    $bdb11010cef70236$var$registry$1.register(cleanupRef, res);
  if ($bdb11010cef70236$var$canUseDOM$1) {
    const cacheIdRef = $bdb11010cef70236$export$d41a04c74483c6ef$2.get(res);
    if (cacheIdRef && !cacheIdRef.includes(nextId))
      cacheIdRef.push(nextId);
    else
      $bdb11010cef70236$export$d41a04c74483c6ef$2.set(res, [
        nextId
      ]);
  }
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$1(() => {
    let r2 = res;
    return () => {
      if ($bdb11010cef70236$var$registry$1)
        $bdb11010cef70236$var$registry$1.unregister(cleanupRef);
      $bdb11010cef70236$export$d41a04c74483c6ef$2.delete(r2);
    };
  }, [
    res
  ]);
  reactExports.useEffect(() => {
    let newId = nextId.current;
    if (newId)
      setValue(newId);
    return () => {
      if (newId)
        nextId.current = null;
    };
  });
  return res;
}
function $bdb11010cef70236$export$cd8c9cb68f842629$2(idA, idB) {
  if (idA === idB)
    return idA;
  let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef$2.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef$2.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function $bdb11010cef70236$export$b4cc09c592e8fdb8(depArray = []) {
  let id2 = $bdb11010cef70236$export$f680877a34711e37$1();
  let [resolvedId, setResolvedId] = $1dbecbe27a04f9af$export$14d238f342723f25(id2);
  let updateId = reactExports.useCallback(() => {
    setResolvedId(function* () {
      yield id2;
      yield document.getElementById(id2) ? id2 : void 0;
    });
  }, [
    id2,
    setResolvedId
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$1(updateId, [
    id2,
    updateId,
    ...depArray
  ]);
  return resolvedId;
}
function $ff5963eb1fccf552$export$e08e3b67e392101e$2(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks)
      if (typeof callback2 === "function")
        callback2(...args);
  };
}
function $3ef42575df84b30b$export$9d1611c77c2fe928$2(...args) {
  let result = {
    ...args[0]
  };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90)
        result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e$2(a2, b2);
      else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string")
        result[key] = clsx$3(a2, b2);
      else if (key === "id" && a2 && b2)
        result.id = $bdb11010cef70236$export$cd8c9cb68f842629$2(a2, b2);
      else
        result[key] = b2 !== void 0 ? b2 : a2;
    }
  }
  return result;
}
function $313b98861ee5dd6c$export$d6875122194c7b44(props, defaultLabel) {
  let { id: id2, "aria-label": label, "aria-labelledby": labelledBy } = props;
  id2 = $bdb11010cef70236$export$f680877a34711e37$1(id2);
  if (labelledBy && label) {
    let ids2 = /* @__PURE__ */ new Set([
      id2,
      ...labelledBy.trim().split(/\s+/)
    ]);
    labelledBy = [
      ...ids2
    ].join(" ");
  } else if (labelledBy)
    labelledBy = labelledBy.trim().split(/\s+/).join(" ");
  if (!label && !labelledBy && defaultLabel)
    label = defaultLabel;
  return {
    id: id2,
    "aria-label": label,
    "aria-labelledby": labelledBy
  };
}
function $d191a55c9702f145$export$8467354a121f1b9f(props) {
  let { id: id2, label, "aria-labelledby": ariaLabelledby, "aria-label": ariaLabel, labelElementType = "label" } = props;
  id2 = $bdb11010cef70236$export$f680877a34711e37$1(id2);
  let labelId = $bdb11010cef70236$export$f680877a34711e37$1();
  let labelProps = {};
  if (label) {
    ariaLabelledby = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;
    labelProps = {
      id: labelId,
      htmlFor: labelElementType === "label" ? id2 : void 0
    };
  }
  let fieldProps = $313b98861ee5dd6c$export$d6875122194c7b44({
    id: id2,
    "aria-label": ariaLabel,
    "aria-labelledby": ariaLabelledby
  });
  return {
    labelProps,
    fieldProps
  };
}
function $2baaea4c71418dea$export$294aa081a6c6f55d(props) {
  let { description, errorMessage, isInvalid, validationState } = props;
  let { labelProps, fieldProps } = $d191a55c9702f145$export$8467354a121f1b9f(props);
  let descriptionId = $bdb11010cef70236$export$b4cc09c592e8fdb8([
    Boolean(description),
    Boolean(errorMessage),
    isInvalid,
    validationState
  ]);
  let errorMessageId = $bdb11010cef70236$export$b4cc09c592e8fdb8([
    Boolean(description),
    Boolean(errorMessage),
    isInvalid,
    validationState
  ]);
  fieldProps = $3ef42575df84b30b$export$9d1611c77c2fe928$2(fieldProps, {
    "aria-describedby": [
      descriptionId,
      // Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268
      errorMessageId,
      props["aria-describedby"]
    ].filter(Boolean).join(" ") || void 0
  });
  return {
    labelProps,
    fieldProps,
    descriptionProps: {
      id: descriptionId
    },
    errorMessageProps: {
      id: errorMessageId
    }
  };
}
function $cc38e7bd3fc7b213$export$2bb74740c4e19def(node2, checkForOverflow) {
  if (!node2)
    return false;
  let style2 = window.getComputedStyle(node2);
  let isScrollable2 = /(auto|scroll)/.test(style2.overflow + style2.overflowX + style2.overflowY);
  if (isScrollable2 && checkForOverflow)
    isScrollable2 = node2.scrollHeight !== node2.clientHeight || node2.scrollWidth !== node2.clientWidth;
  return isScrollable2;
}
function $feb5ffebff200149$export$c3d8340acf92597f(collectionRef, key) {
  var _collectionRef_current, _collectionRef_current1;
  let selector = `[data-key="${CSS.escape(String(key))}"]`;
  let collection = (_collectionRef_current = collectionRef.current) === null || _collectionRef_current === void 0 ? void 0 : _collectionRef_current.dataset.collection;
  if (collection)
    selector = `[data-collection="${CSS.escape(collection)}"]${selector}`;
  return (_collectionRef_current1 = collectionRef.current) === null || _collectionRef_current1 === void 0 ? void 0 : _collectionRef_current1.querySelector(selector);
}
const $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS = 1e3;
function $fb3050f43d946246$export$e32c88dfddc6e1d8(options) {
  let { keyboardDelegate, selectionManager, onTypeSelect } = options;
  let state = reactExports.useRef({
    search: "",
    timeout: void 0
  }).current;
  let onKeyDown = (e2) => {
    let character2 = $fb3050f43d946246$var$getStringForKey(e2.key);
    if (!character2 || e2.ctrlKey || e2.metaKey || !e2.currentTarget.contains(e2.target))
      return;
    if (character2 === " " && state.search.trim().length > 0) {
      e2.preventDefault();
      if (!("continuePropagation" in e2))
        e2.stopPropagation();
    }
    state.search += character2;
    if (keyboardDelegate.getKeyForSearch != null) {
      let key = keyboardDelegate.getKeyForSearch(state.search, selectionManager.focusedKey);
      if (key == null)
        key = keyboardDelegate.getKeyForSearch(state.search);
      if (key != null) {
        selectionManager.setFocusedKey(key);
        if (onTypeSelect)
          onTypeSelect(key);
      }
    }
    clearTimeout(state.timeout);
    state.timeout = setTimeout(() => {
      state.search = "";
    }, $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS);
  };
  return {
    typeSelectProps: {
      // Using a capturing listener to catch the keydown event before
      // other hooks in order to handle the Spacebar event.
      onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDown : void 0
    }
  };
}
function $fb3050f43d946246$var$getStringForKey(key) {
  if (key.length === 1 || !/^[A-Z]/i.test(key))
    return key;
  return "";
}
class $657e4dc4a6e88df0$export$8f5ed9ff9f5113813 {
  getItemRect(key) {
    let container = this.ref.current;
    if (!container)
      return null;
    let item = key != null ? $feb5ffebff200149$export$c3d8340acf92597f(this.ref, key) : null;
    if (!item)
      return null;
    let containerRect = container.getBoundingClientRect();
    let itemRect = item.getBoundingClientRect();
    return {
      x: itemRect.left - containerRect.left + container.scrollLeft,
      y: itemRect.top - containerRect.top + container.scrollTop,
      width: itemRect.width,
      height: itemRect.height
    };
  }
  getContentSize() {
    let container = this.ref.current;
    var _container_scrollWidth, _container_scrollHeight;
    return {
      width: (_container_scrollWidth = container === null || container === void 0 ? void 0 : container.scrollWidth) !== null && _container_scrollWidth !== void 0 ? _container_scrollWidth : 0,
      height: (_container_scrollHeight = container === null || container === void 0 ? void 0 : container.scrollHeight) !== null && _container_scrollHeight !== void 0 ? _container_scrollHeight : 0
    };
  }
  getVisibleRect() {
    let container = this.ref.current;
    var _container_scrollLeft, _container_scrollTop, _container_offsetWidth, _container_offsetHeight;
    return {
      x: (_container_scrollLeft = container === null || container === void 0 ? void 0 : container.scrollLeft) !== null && _container_scrollLeft !== void 0 ? _container_scrollLeft : 0,
      y: (_container_scrollTop = container === null || container === void 0 ? void 0 : container.scrollTop) !== null && _container_scrollTop !== void 0 ? _container_scrollTop : 0,
      width: (_container_offsetWidth = container === null || container === void 0 ? void 0 : container.offsetWidth) !== null && _container_offsetWidth !== void 0 ? _container_offsetWidth : 0,
      height: (_container_offsetHeight = container === null || container === void 0 ? void 0 : container.offsetHeight) !== null && _container_offsetHeight !== void 0 ? _container_offsetHeight : 0
    };
  }
  constructor(ref) {
    this.ref = ref;
  }
}
class $2a25aae57d74318e$export$a05409b8bb224a5a3 {
  isDisabled(item) {
    var _item_props;
    return this.disabledBehavior === "all" && (((_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.isDisabled) || this.disabledKeys.has(item.key));
  }
  findNextNonDisabled(key, getNext) {
    let nextKey = key;
    while (nextKey != null) {
      let item = this.collection.getItem(nextKey);
      if ((item === null || item === void 0 ? void 0 : item.type) === "item" && !this.isDisabled(item))
        return nextKey;
      nextKey = getNext(nextKey);
    }
    return null;
  }
  getNextKey(key) {
    let nextKey = key;
    nextKey = this.collection.getKeyAfter(nextKey);
    return this.findNextNonDisabled(nextKey, (key2) => this.collection.getKeyAfter(key2));
  }
  getPreviousKey(key) {
    let nextKey = key;
    nextKey = this.collection.getKeyBefore(nextKey);
    return this.findNextNonDisabled(nextKey, (key2) => this.collection.getKeyBefore(key2));
  }
  findKey(key, nextKey, shouldSkip2) {
    let tempKey = key;
    let itemRect = this.layoutDelegate.getItemRect(tempKey);
    if (!itemRect || tempKey == null)
      return null;
    let prevRect = itemRect;
    do {
      tempKey = nextKey(tempKey);
      if (tempKey == null)
        break;
      itemRect = this.layoutDelegate.getItemRect(tempKey);
    } while (itemRect && shouldSkip2(prevRect, itemRect) && tempKey != null);
    return tempKey;
  }
  isSameRow(prevRect, itemRect) {
    return prevRect.y === itemRect.y || prevRect.x !== itemRect.x;
  }
  isSameColumn(prevRect, itemRect) {
    return prevRect.x === itemRect.x || prevRect.y !== itemRect.y;
  }
  getKeyBelow(key) {
    if (this.layout === "grid" && this.orientation === "vertical")
      return this.findKey(key, (key2) => this.getNextKey(key2), this.isSameRow);
    else
      return this.getNextKey(key);
  }
  getKeyAbove(key) {
    if (this.layout === "grid" && this.orientation === "vertical")
      return this.findKey(key, (key2) => this.getPreviousKey(key2), this.isSameRow);
    else
      return this.getPreviousKey(key);
  }
  getNextColumn(key, right) {
    return right ? this.getPreviousKey(key) : this.getNextKey(key);
  }
  getKeyRightOf(key) {
    let layoutDelegateMethod = this.direction === "ltr" ? "getKeyRightOf" : "getKeyLeftOf";
    if (this.layoutDelegate[layoutDelegateMethod]) {
      key = this.layoutDelegate[layoutDelegateMethod](key);
      return this.findNextNonDisabled(key, (key2) => this.layoutDelegate[layoutDelegateMethod](key2));
    }
    if (this.layout === "grid") {
      if (this.orientation === "vertical")
        return this.getNextColumn(key, this.direction === "rtl");
      else
        return this.findKey(key, (key2) => this.getNextColumn(key2, this.direction === "rtl"), this.isSameColumn);
    } else if (this.orientation === "horizontal")
      return this.getNextColumn(key, this.direction === "rtl");
    return null;
  }
  getKeyLeftOf(key) {
    let layoutDelegateMethod = this.direction === "ltr" ? "getKeyLeftOf" : "getKeyRightOf";
    if (this.layoutDelegate[layoutDelegateMethod]) {
      key = this.layoutDelegate[layoutDelegateMethod](key);
      return this.findNextNonDisabled(key, (key2) => this.layoutDelegate[layoutDelegateMethod](key2));
    }
    if (this.layout === "grid") {
      if (this.orientation === "vertical")
        return this.getNextColumn(key, this.direction === "ltr");
      else
        return this.findKey(key, (key2) => this.getNextColumn(key2, this.direction === "ltr"), this.isSameColumn);
    } else if (this.orientation === "horizontal")
      return this.getNextColumn(key, this.direction === "ltr");
    return null;
  }
  getFirstKey() {
    let key = this.collection.getFirstKey();
    return this.findNextNonDisabled(key, (key2) => this.collection.getKeyAfter(key2));
  }
  getLastKey() {
    let key = this.collection.getLastKey();
    return this.findNextNonDisabled(key, (key2) => this.collection.getKeyBefore(key2));
  }
  getKeyPageAbove(key) {
    let menu2 = this.ref.current;
    let itemRect = this.layoutDelegate.getItemRect(key);
    if (!itemRect)
      return null;
    if (menu2 && !$cc38e7bd3fc7b213$export$2bb74740c4e19def(menu2))
      return this.getFirstKey();
    let nextKey = key;
    if (this.orientation === "horizontal") {
      let pageX = Math.max(0, itemRect.x + itemRect.width - this.layoutDelegate.getVisibleRect().width);
      while (itemRect && itemRect.x > pageX && nextKey != null) {
        nextKey = this.getKeyAbove(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    } else {
      let pageY = Math.max(0, itemRect.y + itemRect.height - this.layoutDelegate.getVisibleRect().height);
      while (itemRect && itemRect.y > pageY && nextKey != null) {
        nextKey = this.getKeyAbove(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    }
    return nextKey !== null && nextKey !== void 0 ? nextKey : this.getFirstKey();
  }
  getKeyPageBelow(key) {
    let menu2 = this.ref.current;
    let itemRect = this.layoutDelegate.getItemRect(key);
    if (!itemRect)
      return null;
    if (menu2 && !$cc38e7bd3fc7b213$export$2bb74740c4e19def(menu2))
      return this.getLastKey();
    let nextKey = key;
    if (this.orientation === "horizontal") {
      let pageX = Math.min(this.layoutDelegate.getContentSize().width, itemRect.y - itemRect.width + this.layoutDelegate.getVisibleRect().width);
      while (itemRect && itemRect.x < pageX && nextKey != null) {
        nextKey = this.getKeyBelow(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    } else {
      let pageY = Math.min(this.layoutDelegate.getContentSize().height, itemRect.y - itemRect.height + this.layoutDelegate.getVisibleRect().height);
      while (itemRect && itemRect.y < pageY && nextKey != null) {
        nextKey = this.getKeyBelow(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    }
    return nextKey !== null && nextKey !== void 0 ? nextKey : this.getLastKey();
  }
  getKeyForSearch(search2, fromKey) {
    if (!this.collator)
      return null;
    let collection = this.collection;
    let key = fromKey || this.getFirstKey();
    while (key != null) {
      let item = collection.getItem(key);
      if (!item)
        return null;
      let substring = item.textValue.slice(0, search2.length);
      if (item.textValue && this.collator.compare(substring, search2) === 0)
        return key;
      key = this.getNextKey(key);
    }
    return null;
  }
  constructor(...args) {
    if (args.length === 1) {
      let opts2 = args[0];
      this.collection = opts2.collection;
      this.ref = opts2.ref;
      this.collator = opts2.collator;
      this.disabledKeys = opts2.disabledKeys || /* @__PURE__ */ new Set();
      this.disabledBehavior = opts2.disabledBehavior || "all";
      this.orientation = opts2.orientation || "vertical";
      this.direction = opts2.direction;
      this.layout = opts2.layout || "stack";
      this.layoutDelegate = opts2.layoutDelegate || new $657e4dc4a6e88df0$export$8f5ed9ff9f5113813(opts2.ref);
    } else {
      this.collection = args[0];
      this.disabledKeys = args[1];
      this.ref = args[2];
      this.collator = args[3];
      this.layout = "stack";
      this.orientation = "vertical";
      this.disabledBehavior = "all";
      this.layoutDelegate = new $657e4dc4a6e88df0$export$8f5ed9ff9f5113813(this.ref);
    }
    if (this.layout === "stack" && this.orientation === "vertical") {
      this.getKeyLeftOf = void 0;
      this.getKeyRightOf = void 0;
    }
  }
}
const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c = typeof document !== "undefined" ? React$5.useLayoutEffect : () => {
};
let $bdb11010cef70236$var$canUseDOM = Boolean(typeof window !== "undefined" && window.document && window.document.createElement);
let $bdb11010cef70236$export$d41a04c74483c6ef$1 = /* @__PURE__ */ new Map();
let $bdb11010cef70236$var$registry;
if (typeof FinalizationRegistry !== "undefined")
  $bdb11010cef70236$var$registry = new FinalizationRegistry((heldValue) => {
    $bdb11010cef70236$export$d41a04c74483c6ef$1.delete(heldValue);
  });
function $bdb11010cef70236$export$f680877a34711e37(defaultId) {
  let [value2, setValue] = reactExports.useState(defaultId);
  let nextId = reactExports.useRef(null);
  let res = $b5e257d569688ac6$export$619500959fc48b26(value2);
  let cleanupRef = reactExports.useRef(null);
  if ($bdb11010cef70236$var$registry)
    $bdb11010cef70236$var$registry.register(cleanupRef, res);
  if ($bdb11010cef70236$var$canUseDOM) {
    const cacheIdRef = $bdb11010cef70236$export$d41a04c74483c6ef$1.get(res);
    if (cacheIdRef && !cacheIdRef.includes(nextId))
      cacheIdRef.push(nextId);
    else
      $bdb11010cef70236$export$d41a04c74483c6ef$1.set(res, [
        nextId
      ]);
  }
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
    let r2 = res;
    return () => {
      if ($bdb11010cef70236$var$registry)
        $bdb11010cef70236$var$registry.unregister(cleanupRef);
      $bdb11010cef70236$export$d41a04c74483c6ef$1.delete(r2);
    };
  }, [
    res
  ]);
  reactExports.useEffect(() => {
    let newId = nextId.current;
    if (newId)
      setValue(newId);
    return () => {
      if (newId)
        nextId.current = null;
    };
  });
  return res;
}
function $bdb11010cef70236$export$cd8c9cb68f842629$1(idA, idB) {
  if (idA === idB)
    return idA;
  let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef$1.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef$1.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function $ff5963eb1fccf552$export$e08e3b67e392101e$1(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks)
      if (typeof callback2 === "function")
        callback2(...args);
  };
}
function $3ef42575df84b30b$export$9d1611c77c2fe928$1(...args) {
  let result = {
    ...args[0]
  };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90)
        result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e$1(a2, b2);
      else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string")
        result[key] = clsx$3(a2, b2);
      else if (key === "id" && a2 && b2)
        result.id = $bdb11010cef70236$export$cd8c9cb68f842629$1(a2, b2);
      else
        result[key] = b2 !== void 0 ? b2 : a2;
    }
  }
  return result;
}
const $65484d02dcb7eb3e$var$DOMPropNames$1 = /* @__PURE__ */ new Set([
  "id"
]);
const $65484d02dcb7eb3e$var$labelablePropNames$1 = /* @__PURE__ */ new Set([
  "aria-label",
  "aria-labelledby",
  "aria-describedby",
  "aria-details"
]);
const $65484d02dcb7eb3e$var$linkPropNames$1 = /* @__PURE__ */ new Set([
  "href",
  "hrefLang",
  "target",
  "rel",
  "download",
  "ping",
  "referrerPolicy"
]);
const $65484d02dcb7eb3e$var$propRe$1 = /^(data-.*)$/;
function $65484d02dcb7eb3e$export$457c3d6518dd4c6f$1(props, opts2 = {}) {
  let { labelable, isLink, propNames } = opts2;
  let filteredProps = {};
  for (const prop in props)
    if (Object.prototype.hasOwnProperty.call(props, prop) && ($65484d02dcb7eb3e$var$DOMPropNames$1.has(prop) || labelable && $65484d02dcb7eb3e$var$labelablePropNames$1.has(prop) || isLink && $65484d02dcb7eb3e$var$linkPropNames$1.has(prop) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $65484d02dcb7eb3e$var$propRe$1.test(prop)))
      filteredProps[prop] = props[prop];
  return filteredProps;
}
function useMultiSelect(props, state, ref) {
  const { disallowEmptySelection, isDisabled } = props;
  const collator = $325a3faab7a68acd$export$a16aca283550c30d$1({ usage: "search", sensitivity: "base" });
  const delegate = reactExports.useMemo(
    () => new $2a25aae57d74318e$export$a05409b8bb224a5a3(state.collection, state.disabledKeys, null, collator),
    [state.collection, state.disabledKeys, collator]
  );
  const { menuTriggerProps, menuProps } = $168583247155ddda$export$dc9c12ed27dd1b49$1(
    {
      isDisabled,
      type: "listbox"
    },
    state,
    ref
  );
  const triggerOnKeyDown = (e2) => {
    if (state.selectionMode === "single") {
      switch (e2.key) {
        case "ArrowLeft": {
          e2.preventDefault();
          const key = state.selectedKeys.size > 0 ? delegate.getKeyAbove(state.selectedKeys.values().next().value) : delegate.getFirstKey();
          if (key) {
            state.setSelectedKeys([key]);
          }
          break;
        }
        case "ArrowRight": {
          e2.preventDefault();
          const key = state.selectedKeys.size > 0 ? delegate.getKeyBelow(state.selectedKeys.values().next().value) : delegate.getFirstKey();
          if (key) {
            state.setSelectedKeys([key]);
          }
          break;
        }
      }
    }
  };
  const { typeSelectProps } = $fb3050f43d946246$export$e32c88dfddc6e1d8({
    keyboardDelegate: delegate,
    selectionManager: state.selectionManager,
    onTypeSelect(key) {
      state.setSelectedKeys([key]);
    }
  });
  const { isInvalid, validationErrors, validationDetails } = state.displayValidation;
  const { labelProps, fieldProps, descriptionProps, errorMessageProps } = $2baaea4c71418dea$export$294aa081a6c6f55d({
    ...props,
    labelElementType: "span",
    isInvalid,
    errorMessage: props.errorMessage || validationErrors
  });
  typeSelectProps.onKeyDown = typeSelectProps.onKeyDownCapture;
  delete typeSelectProps.onKeyDownCapture;
  menuTriggerProps.onPressStart = (e2) => {
    if (e2.pointerType !== "touch" && e2.pointerType !== "keyboard" && !isDisabled) {
      state.toggle(e2.pointerType === "virtual" ? "first" : null);
    }
  };
  const domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$1(props, { labelable: true });
  const triggerProps = $3ef42575df84b30b$export$9d1611c77c2fe928$1(typeSelectProps, menuTriggerProps, fieldProps);
  const valueId = $bdb11010cef70236$export$f680877a34711e37();
  return {
    labelProps: {
      ...labelProps,
      onClick: () => {
        var _a2;
        if (!props.isDisabled) {
          (_a2 = ref.current) == null ? void 0 : _a2.focus();
          $507fabe10e71c6fb$export$8397ddfc504fdb9a$1("keyboard");
        }
      }
    },
    triggerProps: $3ef42575df84b30b$export$9d1611c77c2fe928$1(domProps, {
      ...triggerProps,
      onKeyDown: $ff5963eb1fccf552$export$e08e3b67e392101e$1(triggerProps.onKeyDown, triggerOnKeyDown, props.onKeyDown),
      onKeyUp: props.onKeyUp,
      "aria-labelledby": [
        valueId,
        triggerProps["aria-labelledby"],
        triggerProps["aria-label"] && !triggerProps["aria-labelledby"] ? triggerProps.id : null
      ].join(","),
      onFocus(e2) {
        if (state.isFocused) {
          return;
        }
        if (props.onFocus) {
          props.onFocus(e2);
        }
        state.setFocused(true);
      },
      onBlur(e2) {
        if (state.isOpen) {
          return;
        }
        if (props.onBlur) {
          props.onBlur(e2);
        }
        state.setFocused(false);
      }
    }),
    valueProps: {
      id: valueId
    },
    menuProps: {
      ...menuProps,
      disallowEmptySelection,
      autoFocus: state.focusStrategy || true,
      shouldSelectOnPressUp: true,
      shouldFocusOnHover: true,
      onBlur: (e2) => {
        if (e2.currentTarget.contains(e2.relatedTarget)) {
          return;
        }
        if (props.onBlur) {
          props.onBlur(e2);
        }
        state.setFocused(false);
      },
      // @ts-ignore
      onFocus: menuProps == null ? void 0 : menuProps.onFocus,
      "aria-labelledby": [
        fieldProps["aria-labelledby"],
        triggerProps["aria-label"] && !fieldProps["aria-labelledby"] ? triggerProps.id : null
      ].filter(Boolean).join(" ")
    },
    descriptionProps,
    errorMessageProps,
    isInvalid,
    validationErrors,
    validationDetails
  };
}
var selectData = /* @__PURE__ */ new WeakMap();
function useSelect(originalProps) {
  var _a2, _b2, _c2, _d, _e, _f;
  const globalContext = useProviderContext();
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext$1) || {};
  const [props, variantProps2] = mapPropsVariants(originalProps, select.variantKeys);
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const {
    ref,
    as: as2,
    label,
    name: name2,
    isLoading,
    selectorIcon,
    isOpen,
    defaultOpen,
    onOpenChange,
    startContent,
    endContent,
    description,
    renderValue,
    onSelectionChange,
    placeholder,
    isVirtualized,
    itemHeight = 36,
    maxListboxHeight = 256,
    children,
    disallowEmptySelection = false,
    selectionMode = "single",
    spinnerRef,
    scrollRef: scrollRefProp,
    popoverProps = {},
    scrollShadowProps = {},
    listboxProps = {},
    spinnerProps = {},
    validationState,
    onChange,
    onClose,
    className,
    classNames: classNames2,
    validationBehavior = (_c2 = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _c2 : "native",
    hideEmptyContent = false,
    onClear,
    ...otherProps
  } = props;
  const scrollShadowRef = useDOMRef(scrollRefProp);
  const slotsProps = {
    popoverProps: mergeProps$3(
      {
        placement: "bottom",
        triggerScaleOnOpen: false,
        offset: 5,
        disableAnimation
      },
      popoverProps
    ),
    scrollShadowProps: mergeProps$3(
      {
        ref: scrollShadowRef,
        isEnabled: (_d = originalProps.showScrollIndicators) != null ? _d : true,
        hideScrollBar: true,
        offset: 15
      },
      scrollShadowProps
    ),
    listboxProps: mergeProps$3(
      {
        disableAnimation
      },
      listboxProps
    )
  };
  const Component2 = as2 || "button";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const triggerRef = reactExports.useRef(null);
  const listBoxRef = reactExports.useRef(null);
  const popoverRef = reactExports.useRef(null);
  let state = useMultiSelectState({
    ...props,
    isOpen,
    selectionMode,
    disallowEmptySelection,
    validationBehavior,
    children,
    isRequired: originalProps.isRequired,
    isDisabled: originalProps.isDisabled,
    isInvalid: originalProps.isInvalid,
    defaultOpen,
    hideEmptyContent,
    onOpenChange: (open) => {
      onOpenChange == null ? void 0 : onOpenChange(open);
      if (!open) {
        onClose == null ? void 0 : onClose();
      }
    },
    onSelectionChange: (keys2) => {
      onSelectionChange == null ? void 0 : onSelectionChange(keys2);
      if (onChange && typeof onChange === "function") {
        onChange({
          target: {
            ...domRef.current && {
              ...domRef.current,
              name: domRef.current.name
            },
            value: Array.from(keys2).join(",")
          }
        });
      }
      state.commitValidation();
    }
  });
  state = {
    ...state,
    ...originalProps.isDisabled && {
      disabledKeys: /* @__PURE__ */ new Set([...state.collection.getKeys()])
    }
  };
  useSafeLayoutEffect(() => {
    var _a22;
    if (!((_a22 = domRef.current) == null ? void 0 : _a22.value))
      return;
    state.setSelectedKeys(/* @__PURE__ */ new Set([...state.selectedKeys, domRef.current.value]));
  }, [domRef.current]);
  const {
    labelProps,
    triggerProps,
    valueProps,
    menuProps,
    descriptionProps,
    errorMessageProps,
    isInvalid: isAriaInvalid,
    validationErrors,
    validationDetails
  } = useMultiSelect(
    { ...props, disallowEmptySelection, isDisabled: originalProps.isDisabled },
    state,
    triggerRef
  );
  const handleClear = reactExports.useCallback(() => {
    var _a22;
    state.setSelectedKeys(/* @__PURE__ */ new Set([]));
    onClear == null ? void 0 : onClear();
    (_a22 = triggerRef.current) == null ? void 0 : _a22.focus();
  }, [onClear, state]);
  const { pressProps: clearPressProps } = $f6c31cce2adf654f$export$45712eceda6fad21$4({
    isDisabled: !!(originalProps == null ? void 0 : originalProps.isDisabled),
    onPress: handleClear
  });
  const isInvalid = originalProps.isInvalid || validationState === "invalid" || isAriaInvalid;
  const { isPressed, buttonProps } = useAriaButton$1(triggerProps, triggerRef);
  const { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const { focusProps: clearFocusProps, isFocusVisible: isClearButtonFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$5({ isDisabled: originalProps.isDisabled });
  const labelPlacement = useLabelPlacement({
    labelPlacement: originalProps.labelPlacement,
    label
  });
  const hasPlaceholder = !!placeholder;
  const shouldLabelBeOutside = labelPlacement === "outside-left" || labelPlacement === "outside";
  const shouldLabelBeInside = labelPlacement === "inside";
  const isOutsideLeft = labelPlacement === "outside-left";
  const isClearable = originalProps.isClearable;
  const isFilled = state.isOpen || hasPlaceholder || !!((_e = state.selectedItems) == null ? void 0 : _e.length) || !!startContent || !!endContent || !!originalProps.isMultiline;
  const hasValue2 = !!((_f = state.selectedItems) == null ? void 0 : _f.length);
  const hasLabel = !!label;
  const hasLabelOutside = hasLabel && (isOutsideLeft || shouldLabelBeOutside && hasPlaceholder);
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const slots = reactExports.useMemo(
    () => select({
      ...variantProps2,
      isInvalid,
      isClearable,
      labelPlacement,
      disableAnimation
    }),
    [objectToDeps(variantProps2), isInvalid, labelPlacement, disableAnimation]
  );
  $49c51c25361d4cd2$export$ee0f7cc6afcd1c18({
    isDisabled: !state.isOpen
  });
  const errorMessage = typeof props.errorMessage === "function" ? props.errorMessage({ isInvalid, validationErrors, validationDetails }) : props.errorMessage || (validationErrors == null ? void 0 : validationErrors.join(" "));
  const hasHelper = !!description || !!errorMessage;
  const hasEndContent = !!endContent;
  reactExports.useEffect(() => {
    if (state.isOpen && popoverRef.current && triggerRef.current) {
      let selectRect = triggerRef.current.getBoundingClientRect();
      let popover2 = popoverRef.current;
      popover2.style.width = selectRect.width + "px";
    }
  }, [state.isOpen]);
  const getBaseProps = reactExports.useCallback(
    (props2 = {}) => ({
      "data-slot": "base",
      "data-filled": dataAttr(isFilled),
      "data-has-value": dataAttr(hasValue2),
      "data-has-label": dataAttr(hasLabel),
      "data-has-helper": dataAttr(hasHelper),
      "data-has-end-content": dataAttr(hasEndContent),
      "data-invalid": dataAttr(isInvalid),
      "data-has-label-outside": dataAttr(hasLabelOutside),
      className: slots.base({
        class: clsx$4(baseStyles, props2.className)
      }),
      ...props2
    }),
    [slots, hasHelper, hasValue2, hasLabel, hasLabelOutside, isFilled, baseStyles]
  );
  const getTriggerProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ref: triggerRef,
        "data-slot": "trigger",
        "data-open": dataAttr(state.isOpen),
        "data-disabled": dataAttr(originalProps == null ? void 0 : originalProps.isDisabled),
        "data-focus": dataAttr(isFocused),
        "data-pressed": dataAttr(isPressed),
        "data-focus-visible": dataAttr(isFocusVisible),
        "data-hover": dataAttr(isHovered),
        className: slots.trigger({ class: classNames2 == null ? void 0 : classNames2.trigger }),
        ...mergeProps$3(
          buttonProps,
          focusProps,
          hoverProps,
          filterDOMProps(otherProps, {
            enabled: shouldFilterDOMProps
          }),
          filterDOMProps(props2)
        )
      };
    },
    [
      slots,
      triggerRef,
      state.isOpen,
      classNames2 == null ? void 0 : classNames2.trigger,
      originalProps == null ? void 0 : originalProps.isDisabled,
      isFocused,
      isPressed,
      isFocusVisible,
      isHovered,
      buttonProps,
      focusProps,
      hoverProps,
      otherProps,
      shouldFilterDOMProps
    ]
  );
  const getHiddenSelectProps = reactExports.useCallback(
    (props2 = {}) => ({
      state,
      triggerRef,
      selectRef: domRef,
      selectionMode,
      label: originalProps == null ? void 0 : originalProps.label,
      name: originalProps == null ? void 0 : originalProps.name,
      isRequired: originalProps == null ? void 0 : originalProps.isRequired,
      autoComplete: originalProps == null ? void 0 : originalProps.autoComplete,
      isDisabled: originalProps == null ? void 0 : originalProps.isDisabled,
      form: originalProps == null ? void 0 : originalProps.form,
      onChange,
      ...props2
    }),
    [
      state,
      selectionMode,
      originalProps == null ? void 0 : originalProps.label,
      originalProps == null ? void 0 : originalProps.autoComplete,
      originalProps == null ? void 0 : originalProps.name,
      originalProps == null ? void 0 : originalProps.isDisabled,
      triggerRef
    ]
  );
  const getLabelProps = reactExports.useCallback(
    (props2 = {}) => ({
      "data-slot": "label",
      className: slots.label({
        class: clsx$4(classNames2 == null ? void 0 : classNames2.label, props2.className)
      }),
      ...labelProps,
      ...props2
    }),
    [slots, classNames2 == null ? void 0 : classNames2.label, labelProps]
  );
  const getValueProps = reactExports.useCallback(
    (props2 = {}) => ({
      "data-slot": "value",
      className: slots.value({
        class: clsx$4(classNames2 == null ? void 0 : classNames2.value, props2.className)
      }),
      ...valueProps,
      ...props2
    }),
    [slots, classNames2 == null ? void 0 : classNames2.value, valueProps]
  );
  const getListboxWrapperProps = reactExports.useCallback(
    (props2 = {}) => ({
      "data-slot": "listboxWrapper",
      className: slots.listboxWrapper({
        class: clsx$4(classNames2 == null ? void 0 : classNames2.listboxWrapper, props2 == null ? void 0 : props2.className)
      }),
      style: {
        maxHeight: maxListboxHeight != null ? maxListboxHeight : 256,
        ...props2.style
      },
      ...mergeProps$3(slotsProps.scrollShadowProps, props2)
    }),
    [
      slots.listboxWrapper,
      classNames2 == null ? void 0 : classNames2.listboxWrapper,
      slotsProps.scrollShadowProps,
      maxListboxHeight
    ]
  );
  const getListboxProps = (props2 = {}) => {
    const shouldVirtualize = isVirtualized != null ? isVirtualized : state.collection.size > 50;
    return {
      state,
      ref: listBoxRef,
      isVirtualized: shouldVirtualize,
      virtualization: shouldVirtualize ? {
        maxListboxHeight,
        itemHeight
      } : void 0,
      "data-slot": "listbox",
      className: slots.listbox({
        class: clsx$4(classNames2 == null ? void 0 : classNames2.listbox, props2 == null ? void 0 : props2.className)
      }),
      scrollShadowProps: slotsProps.scrollShadowProps,
      ...mergeProps$3(slotsProps.listboxProps, props2, menuProps)
    };
  };
  const getPopoverProps = reactExports.useCallback(
    (props2 = {}) => {
      var _a22, _b22;
      const popoverProps2 = mergeProps$3(slotsProps.popoverProps, props2);
      return {
        state,
        triggerRef,
        ref: popoverRef,
        "data-slot": "popover",
        scrollRef: listBoxRef,
        triggerType: "listbox",
        classNames: {
          content: slots.popoverContent({
            class: clsx$4(classNames2 == null ? void 0 : classNames2.popoverContent, props2.className)
          })
        },
        ...popoverProps2,
        offset: state.selectedItems && state.selectedItems.length > 0 ? (
          // forces the popover to update its position when the selected items change
          state.selectedItems.length * 1e-8 + (((_a22 = slotsProps.popoverProps) == null ? void 0 : _a22.offset) || 0)
        ) : (_b22 = slotsProps.popoverProps) == null ? void 0 : _b22.offset
      };
    },
    [
      slots,
      classNames2 == null ? void 0 : classNames2.popoverContent,
      slotsProps.popoverProps,
      triggerRef,
      state,
      state.selectedItems
    ]
  );
  const getSelectorIconProps = reactExports.useCallback(
    () => ({
      "data-slot": "selectorIcon",
      "aria-hidden": dataAttr(true),
      "data-open": dataAttr(state.isOpen),
      className: slots.selectorIcon({ class: classNames2 == null ? void 0 : classNames2.selectorIcon })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.selectorIcon, state.isOpen]
  );
  const getInnerWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "data-slot": "innerWrapper",
        className: slots.innerWrapper({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.innerWrapper, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.innerWrapper]
  );
  const getHelperWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "data-slot": "helperWrapper",
        className: slots.helperWrapper({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.helperWrapper, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.helperWrapper]
  );
  const getDescriptionProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ...descriptionProps,
        "data-slot": "description",
        className: slots.description({ class: clsx$4(classNames2 == null ? void 0 : classNames2.description, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.description]
  );
  const getMainWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "data-slot": "mainWrapper",
        className: slots.mainWrapper({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.mainWrapper, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.mainWrapper]
  );
  const getEndWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "data-slot": "end-wrapper",
        className: slots.endWrapper({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.endWrapper, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.endWrapper]
  );
  const getEndContentProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "data-slot": "end-content",
        className: slots.endContent({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.endContent, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.endContent]
  );
  const getErrorMessageProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ...errorMessageProps,
        "data-slot": "error-message",
        className: slots.errorMessage({ class: clsx$4(classNames2 == null ? void 0 : classNames2.errorMessage, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, errorMessageProps, classNames2 == null ? void 0 : classNames2.errorMessage]
  );
  const getSpinnerProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "aria-hidden": dataAttr(true),
        "data-slot": "spinner",
        color: "current",
        size: "sm",
        ...spinnerProps,
        ...props2,
        ref: spinnerRef,
        className: slots.spinner({ class: clsx$4(classNames2 == null ? void 0 : classNames2.spinner, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, spinnerRef, spinnerProps, classNames2 == null ? void 0 : classNames2.spinner]
  );
  const getClearButtonProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        type: "button",
        tabIndex: -1,
        "aria-label": "clear selection",
        "data-slot": "clear-button",
        "data-focus-visible": dataAttr(isClearButtonFocusVisible),
        className: slots.clearButton({ class: clsx$4(classNames2 == null ? void 0 : classNames2.clearButton, props2 == null ? void 0 : props2.className) }),
        ...mergeProps$3(clearPressProps, clearFocusProps)
      };
    },
    [slots, isClearButtonFocusVisible, clearPressProps, clearFocusProps, classNames2 == null ? void 0 : classNames2.clearButton]
  );
  selectData.set(state, {
    isDisabled: originalProps == null ? void 0 : originalProps.isDisabled,
    isRequired: originalProps == null ? void 0 : originalProps.isRequired,
    name: originalProps == null ? void 0 : originalProps.name,
    isInvalid,
    validationBehavior
  });
  return {
    Component: Component2,
    domRef,
    state,
    label,
    name: name2,
    triggerRef,
    isLoading,
    placeholder,
    startContent,
    endContent,
    description,
    selectorIcon,
    hasHelper,
    labelPlacement,
    hasPlaceholder,
    renderValue,
    selectionMode,
    disableAnimation,
    isOutsideLeft,
    shouldLabelBeOutside,
    shouldLabelBeInside,
    isInvalid,
    errorMessage,
    isClearable,
    getClearButtonProps,
    getBaseProps,
    getTriggerProps,
    getLabelProps,
    getValueProps,
    getListboxProps,
    getPopoverProps,
    getSpinnerProps,
    getMainWrapperProps,
    getListboxWrapperProps,
    getHiddenSelectProps,
    getInnerWrapperProps,
    getHelperWrapperProps,
    getDescriptionProps,
    getErrorMessageProps,
    getSelectorIconProps,
    getEndWrapperProps,
    getEndContentProps
  };
}
var useLayoutEffect$2 = typeof document !== "undefined" ? React$5.useLayoutEffect : () => {
};
function useEffectEvent(fn) {
  const ref = reactExports.useRef(null);
  useLayoutEffect$2(() => {
    ref.current = fn;
  }, [fn]);
  return reactExports.useCallback((...args) => {
    const f2 = ref.current;
    return f2 == null ? void 0 : f2(...args);
  }, []);
}
function useFormReset(ref, initialValue, onReset) {
  let resetValue = reactExports.useRef(initialValue);
  let handleReset = useEffectEvent(() => {
    if (onReset) {
      onReset(resetValue.current);
    }
  });
  reactExports.useEffect(() => {
    var _a2;
    let form2 = (_a2 = ref == null ? void 0 : ref.current) == null ? void 0 : _a2.form;
    form2 == null ? void 0 : form2.addEventListener("reset", handleReset);
    return () => {
      form2 == null ? void 0 : form2.removeEventListener("reset", handleReset);
    };
  }, [ref, handleReset]);
}
let $8a9cb279dc87e130$export$fda7da73ab5d4c48$1 = false;
let $507fabe10e71c6fb$var$changeHandlers$1 = /* @__PURE__ */ new Set();
let $507fabe10e71c6fb$export$d90243b58daecda7$1 = /* @__PURE__ */ new Map();
let $507fabe10e71c6fb$var$hasEventBeforeFocus$1 = false;
let $507fabe10e71c6fb$var$hasBlurredWindowRecently$1 = false;
function $507fabe10e71c6fb$var$triggerChangeHandlers$1(modality, e2) {
  for (let handler of $507fabe10e71c6fb$var$changeHandlers$1)
    handler(modality, e2);
}
function $507fabe10e71c6fb$var$isValidKey$1(e2) {
  return !(e2.metaKey || !$c87311424ea30a05$export$9ac100e40613ea10$6() && e2.altKey || e2.ctrlKey || e2.key === "Control" || e2.key === "Shift" || e2.key === "Meta");
}
function $507fabe10e71c6fb$var$handleKeyboardEvent$1(e2) {
  $507fabe10e71c6fb$var$hasEventBeforeFocus$1 = true;
  if ($507fabe10e71c6fb$var$isValidKey$1(e2)) {
    $507fabe10e71c6fb$var$triggerChangeHandlers$1("keyboard", e2);
  }
}
function $507fabe10e71c6fb$var$handlePointerEvent$1(e2) {
  if (e2.type === "mousedown" || e2.type === "pointerdown") {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$1 = true;
    $507fabe10e71c6fb$var$triggerChangeHandlers$1("pointer", e2);
  }
}
function $507fabe10e71c6fb$var$handleClickEvent$1(e2) {
  if ($6a7db85432448f7f$export$60278871457622de$4(e2)) {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$1 = true;
  }
}
function $507fabe10e71c6fb$var$handleFocusEvent$1(e2) {
  if (e2.target === window || e2.target === document || $8a9cb279dc87e130$export$fda7da73ab5d4c48$1 || !e2.isTrusted)
    return;
  if (!$507fabe10e71c6fb$var$hasEventBeforeFocus$1 && !$507fabe10e71c6fb$var$hasBlurredWindowRecently$1) {
    $507fabe10e71c6fb$var$triggerChangeHandlers$1("virtual", e2);
  }
  $507fabe10e71c6fb$var$hasEventBeforeFocus$1 = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently$1 = false;
}
function $507fabe10e71c6fb$var$handleWindowBlur$1() {
  $507fabe10e71c6fb$var$hasEventBeforeFocus$1 = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently$1 = true;
}
function $507fabe10e71c6fb$var$setupGlobalFocusEvents$1(element2) {
  if (typeof window === "undefined" || typeof document === "undefined" || $507fabe10e71c6fb$export$d90243b58daecda7$1.get($431fbd86ca7dc216$export$f21a1ffae260145a$4(element2)))
    return;
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  let focus = windowObject.HTMLElement.prototype.focus;
  windowObject.HTMLElement.prototype.focus = function() {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$1 = true;
    focus.apply(this, arguments);
  };
  documentObject.addEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent$1, true);
  documentObject.addEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent$1, true);
  documentObject.addEventListener("click", $507fabe10e71c6fb$var$handleClickEvent$1, true);
  windowObject.addEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent$1, true);
  windowObject.addEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur$1, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.addEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent$1, true);
    documentObject.addEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent$1, true);
    documentObject.addEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent$1, true);
  }
  windowObject.addEventListener("beforeunload", () => {
    $507fabe10e71c6fb$var$tearDownWindowFocusTracking$1(element2);
  }, {
    once: true
  });
  $507fabe10e71c6fb$export$d90243b58daecda7$1.set(windowObject, {
    focus
  });
}
const $507fabe10e71c6fb$var$tearDownWindowFocusTracking$1 = (element2, loadListener) => {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  if (loadListener)
    documentObject.removeEventListener("DOMContentLoaded", loadListener);
  if (!$507fabe10e71c6fb$export$d90243b58daecda7$1.has(windowObject))
    return;
  windowObject.HTMLElement.prototype.focus = $507fabe10e71c6fb$export$d90243b58daecda7$1.get(windowObject).focus;
  documentObject.removeEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent$1, true);
  documentObject.removeEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent$1, true);
  documentObject.removeEventListener("click", $507fabe10e71c6fb$var$handleClickEvent$1, true);
  windowObject.removeEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent$1, true);
  windowObject.removeEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur$1, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.removeEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent$1, true);
    documentObject.removeEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent$1, true);
    documentObject.removeEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent$1, true);
  }
  $507fabe10e71c6fb$export$d90243b58daecda7$1.delete(windowObject);
};
function $507fabe10e71c6fb$export$2f1888112f558a7d$1(element2) {
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  let loadListener;
  if (documentObject.readyState !== "loading")
    $507fabe10e71c6fb$var$setupGlobalFocusEvents$1(element2);
  else {
    loadListener = () => {
      $507fabe10e71c6fb$var$setupGlobalFocusEvents$1(element2);
    };
    documentObject.addEventListener("DOMContentLoaded", loadListener);
  }
  return () => $507fabe10e71c6fb$var$tearDownWindowFocusTracking$1(element2, loadListener);
}
if (typeof document !== "undefined")
  $507fabe10e71c6fb$export$2f1888112f558a7d$1();
function $507fabe10e71c6fb$export$8397ddfc504fdb9a(modality) {
  $507fabe10e71c6fb$var$triggerChangeHandlers$1(modality, null);
}
function $e93e671b31057976$export$b8473d3665f3a75a(props, state, ref) {
  let { validationBehavior, focus } = props;
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (validationBehavior === "native" && (ref === null || ref === void 0 ? void 0 : ref.current) && !ref.current.disabled) {
      let errorMessage = state.realtimeValidation.isInvalid ? state.realtimeValidation.validationErrors.join(" ") || "Invalid value." : "";
      ref.current.setCustomValidity(errorMessage);
      if (!ref.current.hasAttribute("title"))
        ref.current.title = "";
      if (!state.realtimeValidation.isInvalid)
        state.updateValidation($e93e671b31057976$var$getNativeValidity(ref.current));
    }
  });
  let onReset = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    state.resetValidation();
  });
  let onInvalid = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    var _ref_current;
    if (!state.displayValidation.isInvalid)
      state.commitValidation();
    let form2 = ref === null || ref === void 0 ? void 0 : (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.form;
    if (!e2.defaultPrevented && ref && form2 && $e93e671b31057976$var$getFirstInvalidInput(form2) === ref.current) {
      var _ref_current1;
      if (focus)
        focus();
      else
        (_ref_current1 = ref.current) === null || _ref_current1 === void 0 ? void 0 : _ref_current1.focus();
      $507fabe10e71c6fb$export$8397ddfc504fdb9a("keyboard");
    }
    e2.preventDefault();
  });
  let onChange = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    state.commitValidation();
  });
  reactExports.useEffect(() => {
    let input2 = ref === null || ref === void 0 ? void 0 : ref.current;
    if (!input2)
      return;
    let form2 = input2.form;
    input2.addEventListener("invalid", onInvalid);
    input2.addEventListener("change", onChange);
    form2 === null || form2 === void 0 ? void 0 : form2.addEventListener("reset", onReset);
    return () => {
      input2.removeEventListener("invalid", onInvalid);
      input2.removeEventListener("change", onChange);
      form2 === null || form2 === void 0 ? void 0 : form2.removeEventListener("reset", onReset);
    };
  }, [
    ref,
    onInvalid,
    onChange,
    onReset,
    validationBehavior
  ]);
}
function $e93e671b31057976$var$getValidity(input2) {
  let validity = input2.validity;
  return {
    badInput: validity.badInput,
    customError: validity.customError,
    patternMismatch: validity.patternMismatch,
    rangeOverflow: validity.rangeOverflow,
    rangeUnderflow: validity.rangeUnderflow,
    stepMismatch: validity.stepMismatch,
    tooLong: validity.tooLong,
    tooShort: validity.tooShort,
    typeMismatch: validity.typeMismatch,
    valueMissing: validity.valueMissing,
    valid: validity.valid
  };
}
function $e93e671b31057976$var$getNativeValidity(input2) {
  return {
    isInvalid: !input2.validity.valid,
    validationDetails: $e93e671b31057976$var$getValidity(input2),
    validationErrors: input2.validationMessage ? [
      input2.validationMessage
    ] : []
  };
}
function $e93e671b31057976$var$getFirstInvalidInput(form2) {
  for (let i2 = 0; i2 < form2.elements.length; i2++) {
    let element2 = form2.elements[i2];
    if (!element2.validity.valid)
      return element2;
  }
  return null;
}
function useHiddenSelect(props, state, triggerRef) {
  var _a2;
  let data = selectData.get(state) || {};
  let {
    autoComplete,
    name: name2 = data.name,
    isDisabled = data.isDisabled,
    selectionMode,
    onChange,
    form: form2
  } = props;
  let { validationBehavior, isRequired, isInvalid } = data;
  let { visuallyHiddenProps } = $5c3e21d68f1c4674$export$a966af930f325cab();
  useFormReset(props.selectRef, state.selectedKeys, state.setSelectedKeys);
  $e93e671b31057976$export$b8473d3665f3a75a(
    {
      validationBehavior,
      focus: () => {
        var _a22;
        return (_a22 = triggerRef.current) == null ? void 0 : _a22.focus();
      }
    },
    state,
    props.selectRef
  );
  return {
    containerProps: {
      ...visuallyHiddenProps,
      "aria-hidden": true,
      ["data-a11y-ignore"]: "aria-hidden-focus"
    },
    inputProps: {
      style: { display: "none" }
    },
    selectProps: {
      form: form2,
      autoComplete,
      disabled: isDisabled,
      "aria-invalid": isInvalid || void 0,
      "aria-required": isRequired && validationBehavior === "aria" || void 0,
      required: isRequired && validationBehavior === "native",
      name: name2,
      tabIndex: -1,
      value: selectionMode === "multiple" ? [...state.selectedKeys].map((k2) => String(k2)) : (_a2 = [...state.selectedKeys][0]) != null ? _a2 : "",
      multiple: selectionMode === "multiple",
      onChange: (e2) => {
        state.setSelectedKeys(e2.target.value);
        onChange == null ? void 0 : onChange(e2);
      }
    }
  };
}
function HiddenSelect(props) {
  var _a2;
  let { state, triggerRef, selectRef, label, name: name2, isDisabled, form: form2 } = props;
  let { containerProps, selectProps } = useHiddenSelect({ ...props, selectRef }, state, triggerRef);
  if (state.collection.size <= 300) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...containerProps, "data-testid": "hidden-select-container", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { children: [
      label,
      /* @__PURE__ */ jsxRuntimeExports.jsxs("select", { ...selectProps, ref: selectRef, children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("option", {}),
        [...state.collection.getKeys()].map((key) => {
          let item = state.collection.getItem(key);
          if ((item == null ? void 0 : item.type) === "item") {
            return /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: item.key, children: item.textValue }, item.key);
          }
        })
      ] })
    ] }) });
  } else if (name2) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      "input",
      {
        autoComplete: selectProps.autoComplete,
        disabled: isDisabled,
        form: form2,
        name: name2,
        type: "hidden",
        value: (_a2 = [...state.selectedKeys].join(",")) != null ? _a2 : ""
      }
    );
  }
  return null;
}
var ListboxItemBase = $c1d7fb2ec91bae71$export$6d08773d2e66f8f2;
var listbox_item_base_default = ListboxItemBase;
const $b1f0cad8af73213b$export$3585ede4d035bf14$1 = /* @__PURE__ */ new WeakMap();
function $b1f0cad8af73213b$var$normalizeKey$1(key) {
  if (typeof key === "string")
    return key.replace(/\s*/g, "");
  return "" + key;
}
function $b1f0cad8af73213b$export$9145995848b05025$1(state, itemKey2) {
  let data = $b1f0cad8af73213b$export$3585ede4d035bf14$1.get(state);
  if (!data)
    throw new Error("Unknown list");
  return `${data.id}-option-${$b1f0cad8af73213b$var$normalizeKey$1(itemKey2)}`;
}
function $c132121280ec012d$export$50eacbbf140a3141(props, state, ref) {
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  let selectionBehavior = props.selectionBehavior || "toggle";
  let linkBehavior = props.linkBehavior || (selectionBehavior === "replace" ? "action" : "override");
  if (selectionBehavior === "toggle" && linkBehavior === "action")
    linkBehavior = "override";
  let { listProps } = $982254629710d113$export$b95089534ab7c1fd({
    ...props,
    ref,
    selectionManager: state.selectionManager,
    collection: state.collection,
    disabledKeys: state.disabledKeys,
    linkBehavior
  });
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$4({
    onFocusWithin: props.onFocus,
    onBlurWithin: props.onBlur,
    onFocusWithinChange: props.onFocusChange
  });
  let id2 = $bdb11010cef70236$export$f680877a34711e37$2(props.id);
  $b1f0cad8af73213b$export$3585ede4d035bf14$1.set(state, {
    id: id2,
    shouldUseVirtualFocus: props.shouldUseVirtualFocus,
    shouldSelectOnPressUp: props.shouldSelectOnPressUp,
    shouldFocusOnHover: props.shouldFocusOnHover,
    isVirtualized: props.isVirtualized,
    onAction: props.onAction,
    linkBehavior
  });
  let { labelProps, fieldProps } = $d191a55c9702f145$export$8467354a121f1b9f$1({
    ...props,
    id: id2,
    // listbox is not an HTML input element so it
    // shouldn't be labeled by a <label> element.
    labelElementType: "span"
  });
  return {
    labelProps,
    listBoxProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, focusWithinProps, state.selectionManager.selectionMode === "multiple" ? {
      "aria-multiselectable": "true"
    } : {}, {
      role: "listbox",
      ...$3ef42575df84b30b$export$9d1611c77c2fe928$9(fieldProps, listProps)
    })
  };
}
function $293f70390ea03370$export$497855f14858aa34(props, state, ref) {
  var _item_props, _item_props1;
  let { key } = props;
  let data = $b1f0cad8af73213b$export$3585ede4d035bf14$1.get(state);
  var _props_isDisabled;
  let isDisabled = (_props_isDisabled = props.isDisabled) !== null && _props_isDisabled !== void 0 ? _props_isDisabled : state.selectionManager.isDisabled(key);
  var _props_isSelected;
  let isSelected = (_props_isSelected = props.isSelected) !== null && _props_isSelected !== void 0 ? _props_isSelected : state.selectionManager.isSelected(key);
  var _props_shouldSelectOnPressUp;
  let shouldSelectOnPressUp = (_props_shouldSelectOnPressUp = props.shouldSelectOnPressUp) !== null && _props_shouldSelectOnPressUp !== void 0 ? _props_shouldSelectOnPressUp : data === null || data === void 0 ? void 0 : data.shouldSelectOnPressUp;
  var _props_shouldFocusOnHover;
  let shouldFocusOnHover = (_props_shouldFocusOnHover = props.shouldFocusOnHover) !== null && _props_shouldFocusOnHover !== void 0 ? _props_shouldFocusOnHover : data === null || data === void 0 ? void 0 : data.shouldFocusOnHover;
  var _props_shouldUseVirtualFocus;
  let shouldUseVirtualFocus = (_props_shouldUseVirtualFocus = props.shouldUseVirtualFocus) !== null && _props_shouldUseVirtualFocus !== void 0 ? _props_shouldUseVirtualFocus : data === null || data === void 0 ? void 0 : data.shouldUseVirtualFocus;
  var _props_isVirtualized;
  let isVirtualized = (_props_isVirtualized = props.isVirtualized) !== null && _props_isVirtualized !== void 0 ? _props_isVirtualized : data === null || data === void 0 ? void 0 : data.isVirtualized;
  let labelId = $bdb11010cef70236$export$b4cc09c592e8fdb8$1();
  let descriptionId = $bdb11010cef70236$export$b4cc09c592e8fdb8$1();
  let optionProps = {
    role: "option",
    "aria-disabled": isDisabled || void 0,
    "aria-selected": state.selectionManager.selectionMode !== "none" ? isSelected : void 0
  };
  if (!($c87311424ea30a05$export$9ac100e40613ea10$6() && $c87311424ea30a05$export$78551043582a6a98$5())) {
    optionProps["aria-label"] = props["aria-label"];
    optionProps["aria-labelledby"] = labelId;
    optionProps["aria-describedby"] = descriptionId;
  }
  let item = state.collection.getItem(key);
  if (isVirtualized) {
    let index2 = Number(item === null || item === void 0 ? void 0 : item.index);
    optionProps["aria-posinset"] = Number.isNaN(index2) ? void 0 : index2 + 1;
    optionProps["aria-setsize"] = $453cc9f0df89c0a5$export$77d5aafae4e095b2(state.collection);
  }
  let onAction = (data === null || data === void 0 ? void 0 : data.onAction) ? () => {
    var _data_onAction;
    return data === null || data === void 0 ? void 0 : (_data_onAction = data.onAction) === null || _data_onAction === void 0 ? void 0 : _data_onAction.call(data, key);
  } : void 0;
  let id2 = $b1f0cad8af73213b$export$9145995848b05025$1(state, key);
  let { itemProps, isPressed, isFocused, hasAction, allowsSelection } = $880e95eb8b93ba9a$export$ecf600387e221c37({
    selectionManager: state.selectionManager,
    key,
    ref,
    shouldSelectOnPressUp,
    allowsDifferentPressOrigin: shouldSelectOnPressUp && shouldFocusOnHover,
    isVirtualized,
    shouldUseVirtualFocus,
    isDisabled,
    onAction: onAction || (item === null || item === void 0 ? void 0 : (_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.onAction) ? $ff5963eb1fccf552$export$e08e3b67e392101e$9(item === null || item === void 0 ? void 0 : (_item_props1 = item.props) === null || _item_props1 === void 0 ? void 0 : _item_props1.onAction, onAction) : void 0,
    linkBehavior: data === null || data === void 0 ? void 0 : data.linkBehavior,
    id: id2
  });
  let { hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$h({
    isDisabled: isDisabled || !shouldFocusOnHover,
    onHoverStart() {
      if (!$507fabe10e71c6fb$export$b9b3dfddab17db27$2()) {
        state.selectionManager.setFocused(true);
        state.selectionManager.setFocusedKey(key);
      }
    }
  });
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(item === null || item === void 0 ? void 0 : item.props);
  delete domProps.id;
  let linkProps = $ea8dcbcb9ea1b556$export$7e924b3091a3bd18$1(item === null || item === void 0 ? void 0 : item.props);
  return {
    optionProps: {
      ...optionProps,
      ...$3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, itemProps, hoverProps, linkProps),
      id: id2
    },
    labelProps: {
      id: labelId
    },
    descriptionProps: {
      id: descriptionId
    },
    isFocused,
    isFocusVisible: isFocused && state.selectionManager.isFocused && $507fabe10e71c6fb$export$b9b3dfddab17db27$2(),
    isSelected,
    isDisabled,
    isPressed,
    allowsSelection,
    hasAction
  };
}
function $af383d3bef1cfdc9$export$c3f9f39876e4bc7(props) {
  let { heading: heading2, "aria-label": ariaLabel } = props;
  let headingId = $bdb11010cef70236$export$f680877a34711e37$2();
  return {
    itemProps: {
      role: "presentation"
    },
    headingProps: heading2 ? {
      // Techincally, listbox cannot contain headings according to ARIA.
      // We hide the heading from assistive technology, using role="presentation",
      // and only use it as a visual label for the nested group.
      id: headingId,
      role: "presentation"
    } : {},
    groupProps: {
      role: "group",
      "aria-label": ariaLabel,
      "aria-labelledby": heading2 ? headingId : void 0
    }
  };
}
class $a02d57049d202695$export$d085fb9e920b5ca73 {
  *[Symbol.iterator]() {
    yield* this.iterable;
  }
  get size() {
    return this.keyMap.size;
  }
  getKeys() {
    return this.keyMap.keys();
  }
  getKeyBefore(key) {
    let node2 = this.keyMap.get(key);
    var _node_prevKey;
    return node2 ? (_node_prevKey = node2.prevKey) !== null && _node_prevKey !== void 0 ? _node_prevKey : null : null;
  }
  getKeyAfter(key) {
    let node2 = this.keyMap.get(key);
    var _node_nextKey;
    return node2 ? (_node_nextKey = node2.nextKey) !== null && _node_nextKey !== void 0 ? _node_nextKey : null : null;
  }
  getFirstKey() {
    return this.firstKey;
  }
  getLastKey() {
    return this.lastKey;
  }
  getItem(key) {
    var _this_keyMap_get;
    return (_this_keyMap_get = this.keyMap.get(key)) !== null && _this_keyMap_get !== void 0 ? _this_keyMap_get : null;
  }
  at(idx) {
    const keys2 = [
      ...this.getKeys()
    ];
    return this.getItem(keys2[idx]);
  }
  getChildren(key) {
    let node2 = this.keyMap.get(key);
    return (node2 === null || node2 === void 0 ? void 0 : node2.childNodes) || [];
  }
  constructor(nodes) {
    this.keyMap = /* @__PURE__ */ new Map();
    this.firstKey = null;
    this.lastKey = null;
    this.iterable = nodes;
    let visit2 = (node2) => {
      this.keyMap.set(node2.key, node2);
      if (node2.childNodes && node2.type === "section")
        for (let child of node2.childNodes)
          visit2(child);
    };
    for (let node2 of nodes)
      visit2(node2);
    let last = null;
    let index2 = 0;
    for (let [key, node2] of this.keyMap) {
      if (last) {
        last.nextKey = key;
        node2.prevKey = last.key;
      } else {
        this.firstKey = key;
        node2.prevKey = void 0;
      }
      if (node2.type === "item")
        node2.index = index2++;
      last = node2;
      last.nextKey = void 0;
    }
    var _last_key;
    this.lastKey = (_last_key = last === null || last === void 0 ? void 0 : last.key) !== null && _last_key !== void 0 ? _last_key : null;
  }
}
function $e72dd72e1c76a225$export$2f645645f7bca764(props) {
  let { filter: filter3, layoutDelegate } = props;
  let selectionState = $7af3f5b51489e0b5$export$253fe78d46329472(props);
  let disabledKeys = reactExports.useMemo(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
    props.disabledKeys
  ]);
  let factory = reactExports.useCallback((nodes) => filter3 ? new $a02d57049d202695$export$d085fb9e920b5ca73(filter3(nodes)) : new $a02d57049d202695$export$d085fb9e920b5ca73(nodes), [
    filter3
  ]);
  let context = reactExports.useMemo(() => ({
    suppressTextValueWarning: props.suppressTextValueWarning
  }), [
    props.suppressTextValueWarning
  ]);
  let collection = $7613b1592d41b092$export$6cd28814d92fa9c9(props, factory, context);
  let selectionManager = reactExports.useMemo(() => new $d496c0a20b6e58ec$export$6c8a5aaad13c9852(collection, selectionState, {
    layoutDelegate
  }), [
    collection,
    selectionState,
    layoutDelegate
  ]);
  $e72dd72e1c76a225$var$useFocusedKeyReset(collection, selectionManager);
  return {
    collection,
    disabledKeys,
    selectionManager
  };
}
function $e72dd72e1c76a225$var$useFocusedKeyReset(collection, selectionManager) {
  const cachedCollection = reactExports.useRef(null);
  reactExports.useEffect(() => {
    if (selectionManager.focusedKey != null && !collection.getItem(selectionManager.focusedKey) && cachedCollection.current) {
      const startItem = cachedCollection.current.getItem(selectionManager.focusedKey);
      const cachedItemNodes = [
        ...cachedCollection.current.getKeys()
      ].map((key) => {
        const itemNode = cachedCollection.current.getItem(key);
        return (itemNode === null || itemNode === void 0 ? void 0 : itemNode.type) === "item" ? itemNode : null;
      }).filter((node2) => node2 !== null);
      const itemNodes = [
        ...collection.getKeys()
      ].map((key) => {
        const itemNode = collection.getItem(key);
        return (itemNode === null || itemNode === void 0 ? void 0 : itemNode.type) === "item" ? itemNode : null;
      }).filter((node2) => node2 !== null);
      var _cachedItemNodes_length, _itemNodes_length;
      const diff2 = ((_cachedItemNodes_length = cachedItemNodes === null || cachedItemNodes === void 0 ? void 0 : cachedItemNodes.length) !== null && _cachedItemNodes_length !== void 0 ? _cachedItemNodes_length : 0) - ((_itemNodes_length = itemNodes === null || itemNodes === void 0 ? void 0 : itemNodes.length) !== null && _itemNodes_length !== void 0 ? _itemNodes_length : 0);
      var _startItem_index, _startItem_index1, _itemNodes_length1;
      let index2 = Math.min(diff2 > 1 ? Math.max(((_startItem_index = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index !== void 0 ? _startItem_index : 0) - diff2 + 1, 0) : (_startItem_index1 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index1 !== void 0 ? _startItem_index1 : 0, ((_itemNodes_length1 = itemNodes === null || itemNodes === void 0 ? void 0 : itemNodes.length) !== null && _itemNodes_length1 !== void 0 ? _itemNodes_length1 : 0) - 1);
      let newNode = null;
      let isReverseSearching = false;
      while (index2 >= 0) {
        if (!selectionManager.isDisabled(itemNodes[index2].key)) {
          newNode = itemNodes[index2];
          break;
        }
        if (index2 < itemNodes.length - 1 && !isReverseSearching)
          index2++;
        else {
          isReverseSearching = true;
          var _startItem_index2, _startItem_index3;
          if (index2 > ((_startItem_index2 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index2 !== void 0 ? _startItem_index2 : 0))
            index2 = (_startItem_index3 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index3 !== void 0 ? _startItem_index3 : 0;
          index2--;
        }
      }
      selectionManager.setFocusedKey(newNode ? newNode.key : null);
    }
    cachedCollection.current = collection;
  }, [
    collection,
    selectionManager
  ]);
}
function useListbox(props) {
  var _a2;
  const globalContext = useProviderContext();
  const {
    ref,
    as: as2,
    state: propState,
    variant,
    color: color2,
    onAction,
    children,
    onSelectionChange,
    disableAnimation = (_a2 = globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _a2 : false,
    itemClasses,
    className,
    topContent,
    bottomContent,
    emptyContent = "No items.",
    hideSelectedIcon = false,
    hideEmptyContent = false,
    shouldHighlightOnFocus = false,
    classNames: classNames2,
    ...otherProps
  } = props;
  const Component2 = as2 || "ul";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const innerState = $e72dd72e1c76a225$export$2f645645f7bca764({ ...props, children, onSelectionChange });
  const state = propState || innerState;
  const { listBoxProps } = $c132121280ec012d$export$50eacbbf140a3141({ ...props, onAction }, state, domRef);
  const slots = reactExports.useMemo(() => menu$1(), []);
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const getBaseProps = (props2 = {}) => {
    return {
      ref: domRef,
      "data-slot": "base",
      className: slots.base({ class: baseStyles }),
      ...filterDOMProps(otherProps, {
        enabled: shouldFilterDOMProps
      }),
      ...props2
    };
  };
  const getListProps = (props2 = {}) => {
    return {
      "data-slot": "list",
      className: slots.list({ class: classNames2 == null ? void 0 : classNames2.list }),
      ...listBoxProps,
      ...props2
    };
  };
  const getEmptyContentProps = (props2 = {}) => {
    return {
      "data-slot": "empty-content",
      children: emptyContent,
      className: slots.emptyContent({ class: classNames2 == null ? void 0 : classNames2.emptyContent }),
      ...props2
    };
  };
  return {
    Component: Component2,
    state,
    variant,
    color: color2,
    slots,
    classNames: classNames2,
    topContent,
    bottomContent,
    emptyContent,
    hideEmptyContent,
    shouldHighlightOnFocus,
    hideSelectedIcon,
    disableAnimation,
    className,
    itemClasses,
    getBaseProps,
    getListProps,
    getEmptyContentProps
  };
}
function ListboxSelectedIcon(props) {
  const { isSelected, disableAnimation, ...otherProps } = props;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "svg",
    {
      "aria-hidden": "true",
      "data-selected": isSelected,
      role: "presentation",
      viewBox: "0 0 17 18",
      ...otherProps,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        "polyline",
        {
          fill: "none",
          points: "1 9 7 14 15 4",
          stroke: "currentColor",
          strokeDasharray: 22,
          strokeDashoffset: isSelected ? 44 : 66,
          strokeLinecap: "round",
          strokeLinejoin: "round",
          strokeWidth: 1.5,
          style: !disableAnimation ? {
            transition: "stroke-dashoffset 200ms ease"
          } : {}
        }
      )
    }
  );
}
function $8a9cb279dc87e130$export$525bc4921d56d4a$3(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$3(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$cabe61c495ee3649$3(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$3(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$4(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$3 = "default";
let $14c0b72509d70225$var$savedUserSelect$3 = "";
let $14c0b72509d70225$var$modifiedElementMap$3 = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$3(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$3 === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
      $14c0b72509d70225$var$savedUserSelect$3 = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$3 = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$3.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$3(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$3 !== "disabled")
      return;
    $14c0b72509d70225$var$state$3 = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
        if ($14c0b72509d70225$var$state$3 === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$3 || "";
          $14c0b72509d70225$var$savedUserSelect$3 = "";
          $14c0b72509d70225$var$state$3 = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$3.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$3.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$3.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$3 = React$5.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$3.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext$3(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$3);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$9(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$3 = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$3 = class $f6c31cce2adf654f$var$PressEvent9 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$3, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$3);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$3, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$3, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$3 = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$3 = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$3 = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$3(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$3(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$3("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$3("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$3("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$3("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$3(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$3(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$3(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$3(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$3(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$3($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$3(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$3(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$3(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$9(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$6())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$4(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$3(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$3(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$3(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$3($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$3(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$3(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$3]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$3] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$3(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$3(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$3(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$3(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$3(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$5(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$3))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$3;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$3}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$3((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$3]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$3(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$3(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$3(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$3(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$3(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$3(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$3(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$3(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$3(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$3(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$3 = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$3(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$3.has(target.type);
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$4 = false;
let $6179b936705e76d3$var$hoverCount$4 = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$4() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$4 = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$4 = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$4(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$4();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$4() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$4);
  $6179b936705e76d3$var$hoverCount$4++;
  return () => {
    $6179b936705e76d3$var$hoverCount$4--;
    if ($6179b936705e76d3$var$hoverCount$4 > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$4);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$4(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$4, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$4 && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
function useListboxItem(originalProps) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, menuItem.variantKeys);
  const {
    as: as2,
    item,
    state,
    description,
    startContent,
    endContent,
    isVirtualized,
    selectedIcon,
    className,
    classNames: classNames2,
    autoFocus,
    onPress,
    onPressUp,
    onPressStart,
    onPressEnd,
    onPressChange,
    onClick,
    shouldHighlightOnFocus,
    hideSelectedIcon = false,
    isReadOnly = false,
    ...otherProps
  } = props;
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const domRef = reactExports.useRef(null);
  const Component2 = as2 || (originalProps.href ? "a" : "li");
  const shouldFilterDOMProps = typeof Component2 === "string";
  const { rendered, key } = item;
  const isDisabled = state.disabledKeys.has(key) || originalProps.isDisabled;
  const isSelectable = state.selectionManager.selectionMode !== "none";
  const isMobile2 = useIsMobile();
  const { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$3({
    ref: domRef,
    isDisabled,
    onClick,
    onPress,
    onPressUp,
    onPressStart,
    onPressEnd,
    onPressChange
  });
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$4({
    isDisabled
  });
  const { isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus
  });
  const { isFocused, isSelected, optionProps, labelProps, descriptionProps } = $293f70390ea03370$export$497855f14858aa34(
    {
      key,
      isDisabled,
      "aria-label": props["aria-label"],
      isVirtualized
    },
    state,
    domRef
  );
  let itemProps = optionProps;
  const slots = reactExports.useMemo(
    () => menuItem({
      ...variantProps2,
      isDisabled,
      disableAnimation,
      hasTitleTextChild: typeof rendered === "string",
      hasDescriptionTextChild: typeof description === "string"
    }),
    [objectToDeps(variantProps2), isDisabled, disableAnimation, rendered, description]
  );
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  if (isReadOnly) {
    itemProps = removeEvents(itemProps);
  }
  const isHighlighted = shouldHighlightOnFocus && isFocused || (isMobile2 ? isHovered || isPressed : isHovered || isFocused && !isFocusVisible);
  const getItemProps = (props2 = {}) => ({
    ref: domRef,
    ...mergeProps$3(
      itemProps,
      isReadOnly ? {} : mergeProps$3(focusProps, pressProps),
      hoverProps,
      filterDOMProps(otherProps, {
        enabled: shouldFilterDOMProps
      }),
      props2
    ),
    "data-selectable": dataAttr(isSelectable),
    "data-focus": dataAttr(isFocused),
    "data-hover": dataAttr(isHighlighted),
    "data-disabled": dataAttr(isDisabled),
    "data-selected": dataAttr(isSelected),
    "data-pressed": dataAttr(isPressed),
    "data-focus-visible": dataAttr(isFocusVisible),
    className: slots.base({ class: clsx$4(baseStyles, props2.className) })
  });
  const getLabelProps = (props2 = {}) => ({
    ...mergeProps$3(labelProps, props2),
    "data-label": dataAttr(true),
    className: slots.title({ class: classNames2 == null ? void 0 : classNames2.title })
  });
  const getDescriptionProps = (props2 = {}) => ({
    ...mergeProps$3(descriptionProps, props2),
    className: slots.description({ class: classNames2 == null ? void 0 : classNames2.description })
  });
  const getWrapperProps = (props2 = {}) => ({
    ...mergeProps$3(props2),
    className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper })
  });
  const getSelectedIconProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "aria-hidden": dataAttr(true),
        "data-disabled": dataAttr(isDisabled),
        className: slots.selectedIcon({ class: classNames2 == null ? void 0 : classNames2.selectedIcon }),
        ...props2
      };
    },
    [isDisabled, slots, classNames2]
  );
  return {
    Component: Component2,
    domRef,
    slots,
    classNames: classNames2,
    isSelectable,
    isSelected,
    isDisabled,
    rendered,
    description,
    startContent,
    endContent,
    selectedIcon,
    hideSelectedIcon,
    disableAnimation,
    getItemProps,
    getLabelProps,
    getWrapperProps,
    getDescriptionProps,
    getSelectedIconProps
  };
}
var ListboxItem = (props) => {
  const {
    Component: Component2,
    rendered,
    description,
    isSelectable,
    isSelected,
    isDisabled,
    selectedIcon,
    startContent,
    endContent,
    hideSelectedIcon,
    disableAnimation,
    getItemProps,
    getLabelProps,
    getWrapperProps,
    getDescriptionProps,
    getSelectedIconProps
  } = useListboxItem(props);
  const selectedContent = reactExports.useMemo(() => {
    const defaultIcon = /* @__PURE__ */ jsxRuntimeExports.jsx(ListboxSelectedIcon, { disableAnimation, isSelected });
    if (typeof selectedIcon === "function") {
      return selectedIcon({ icon: defaultIcon, isSelected, isDisabled });
    }
    if (selectedIcon)
      return selectedIcon;
    return defaultIcon;
  }, [selectedIcon, isSelected, isDisabled, disableAnimation]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getItemProps(), children: [
    startContent,
    description ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getWrapperProps(), children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children: rendered }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getDescriptionProps(), children: description })
    ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children: rendered }),
    isSelectable && !hideSelectedIcon && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getSelectedIconProps(), children: selectedContent }),
    endContent
  ] });
};
ListboxItem.displayName = "HeroUI.ListboxItem";
var listbox_item_default = ListboxItem;
var ListboxSection = forwardRef(
  ({
    item,
    state,
    as: as2,
    variant,
    color: color2,
    disableAnimation,
    className,
    classNames: classNames2,
    hideSelectedIcon,
    showDivider = false,
    dividerProps = {},
    itemClasses,
    // removed title from props to avoid browsers showing a tooltip on hover
    // the title props is already inside the rendered prop
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    title,
    // removed items from props to avoid show in html element
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    items,
    ...otherProps
  }, _24) => {
    const Component2 = as2 || "li";
    const slots = reactExports.useMemo(() => menuSection(), []);
    const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
    const dividerStyles = clsx$4(classNames2 == null ? void 0 : classNames2.divider, dividerProps == null ? void 0 : dividerProps.className);
    const { itemProps, headingProps, groupProps } = $af383d3bef1cfdc9$export$c3f9f39876e4bc7({
      heading: item.rendered,
      "aria-label": item["aria-label"]
    });
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Component2,
      {
        "data-slot": "base",
        ...mergeProps$3(itemProps, otherProps),
        className: slots.base({ class: baseStyles }),
        children: [
          item.rendered && /* @__PURE__ */ jsxRuntimeExports.jsx(
            "span",
            {
              ...headingProps,
              className: slots.heading({ class: classNames2 == null ? void 0 : classNames2.heading }),
              "data-slot": "heading",
              children: item.rendered
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            "ul",
            {
              ...groupProps,
              className: slots.group({ class: classNames2 == null ? void 0 : classNames2.group }),
              "data-has-title": !!item.rendered,
              "data-slot": "group",
              children: [
                [...item.childNodes].map((node2) => {
                  const { key: nodeKey, props: nodeProps } = node2;
                  let listboxItem = /* @__PURE__ */ jsxRuntimeExports.jsx(
                    listbox_item_default,
                    {
                      classNames: itemClasses,
                      color: color2,
                      disableAnimation,
                      hideSelectedIcon,
                      item: node2,
                      state,
                      variant,
                      ...nodeProps
                    },
                    nodeKey
                  );
                  if (node2.wrapper) {
                    listboxItem = node2.wrapper(listboxItem);
                  }
                  return listboxItem;
                }),
                showDivider && /* @__PURE__ */ jsxRuntimeExports.jsx(
                  divider_default,
                  {
                    as: "li",
                    className: slots.divider({
                      class: dividerStyles
                    }),
                    ...dividerProps
                  }
                )
              ]
            }
          )
        ]
      },
      item.key
    );
  }
);
ListboxSection.displayName = "HeroUI.ListboxSection";
var listbox_section_default = ListboxSection;
function useDataScrollOverflow(props = {}) {
  const {
    domRef,
    isEnabled = true,
    overflowCheck = "vertical",
    visibility = "auto",
    offset: offset2 = 0,
    onVisibilityChange,
    updateDeps = []
  } = props;
  const visibleRef = reactExports.useRef(visibility);
  reactExports.useEffect(() => {
    const el2 = domRef == null ? void 0 : domRef.current;
    if (!el2 || !isEnabled)
      return;
    const setAttributes = (direction, hasBefore, hasAfter, prefix, suffix) => {
      if (visibility === "auto") {
        const both = `${prefix}${capitalize$2(suffix)}Scroll`;
        if (hasBefore && hasAfter) {
          el2.dataset[both] = "true";
          el2.removeAttribute(`data-${prefix}-scroll`);
          el2.removeAttribute(`data-${suffix}-scroll`);
        } else {
          el2.dataset[`${prefix}Scroll`] = hasBefore.toString();
          el2.dataset[`${suffix}Scroll`] = hasAfter.toString();
          el2.removeAttribute(`data-${prefix}-${suffix}-scroll`);
        }
      } else {
        const next2 = hasBefore && hasAfter ? "both" : hasBefore ? prefix : hasAfter ? suffix : "none";
        if (next2 !== visibleRef.current) {
          onVisibilityChange == null ? void 0 : onVisibilityChange(next2);
          visibleRef.current = next2;
        }
      }
    };
    const checkOverflow2 = () => {
      var _a2, _b2;
      const directions2 = [
        { type: "vertical", prefix: "top", suffix: "bottom" },
        { type: "horizontal", prefix: "left", suffix: "right" }
      ];
      const listbox = el2.querySelector('ul[data-slot="list"]');
      const scrollHeight = +((_a2 = listbox == null ? void 0 : listbox.getAttribute("data-virtual-scroll-height")) != null ? _a2 : el2.scrollHeight);
      const scrollTop = +((_b2 = listbox == null ? void 0 : listbox.getAttribute("data-virtual-scroll-top")) != null ? _b2 : el2.scrollTop);
      for (const { type: type4, prefix, suffix } of directions2) {
        if (overflowCheck === type4 || overflowCheck === "both") {
          const hasBefore = type4 === "vertical" ? scrollTop > offset2 : el2.scrollLeft > offset2;
          const hasAfter = type4 === "vertical" ? scrollTop + el2.clientHeight + offset2 < scrollHeight : el2.scrollLeft + el2.clientWidth + offset2 < el2.scrollWidth;
          setAttributes(type4, hasBefore, hasAfter, prefix, suffix);
        }
      }
    };
    const clearOverflow = () => {
      ["top", "bottom", "top-bottom", "left", "right", "left-right"].forEach((attr) => {
        el2.removeAttribute(`data-${attr}-scroll`);
      });
    };
    checkOverflow2();
    el2.addEventListener("scroll", checkOverflow2, true);
    if (visibility !== "auto") {
      clearOverflow();
      if (visibility === "both") {
        el2.dataset.topBottomScroll = String(overflowCheck === "vertical");
        el2.dataset.leftRightScroll = String(overflowCheck === "horizontal");
      } else {
        el2.dataset.topBottomScroll = "false";
        el2.dataset.leftRightScroll = "false";
        ["top", "bottom", "left", "right"].forEach((attr) => {
          el2.dataset[`${attr}Scroll`] = String(visibility === attr);
        });
      }
    }
    return () => {
      el2.removeEventListener("scroll", checkOverflow2, true);
      clearOverflow();
    };
  }, [...updateDeps, isEnabled, visibility, overflowCheck, onVisibilityChange, domRef]);
}
function useScrollShadow(originalProps) {
  var _a2;
  const [props, variantProps2] = mapPropsVariants(originalProps, scrollShadow.variantKeys);
  const {
    ref,
    as: as2,
    children,
    className,
    style: style2,
    size: size2 = 40,
    offset: offset2 = 0,
    visibility = "auto",
    isEnabled = true,
    onVisibilityChange,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  useDataScrollOverflow({
    domRef,
    offset: offset2,
    visibility,
    isEnabled,
    onVisibilityChange,
    updateDeps: [children],
    overflowCheck: (_a2 = originalProps.orientation) != null ? _a2 : "vertical"
  });
  const styles2 = reactExports.useMemo(
    () => scrollShadow({
      ...variantProps2,
      className
    }),
    [objectToDeps(variantProps2), className]
  );
  const getBaseProps = (props2 = {}) => {
    var _a22;
    return {
      ref: domRef,
      className: styles2,
      "data-orientation": (_a22 = originalProps.orientation) != null ? _a22 : "vertical",
      style: {
        "--scroll-shadow-size": `${size2}px`,
        ...style2,
        ...props2.style
      },
      ...otherProps,
      ...props2
    };
  };
  return { Component: Component2, styles: styles2, domRef, children, getBaseProps };
}
var getItemSizesForCollection = (collection, itemHeight) => {
  const sizes = [];
  for (const item of collection) {
    if (item.type === "section") {
      sizes.push(([...item.childNodes].length + 1) * itemHeight);
    } else {
      sizes.push(itemHeight);
    }
  }
  return sizes;
};
var getScrollState = (element2) => {
  if (!element2 || element2.scrollTop === void 0 || element2.clientHeight === void 0 || element2.scrollHeight === void 0) {
    return {
      isTop: false,
      isBottom: false,
      isMiddle: false
    };
  }
  const isAtTop = element2.scrollTop === 0;
  const isAtBottom = Math.ceil(element2.scrollTop + element2.clientHeight) >= element2.scrollHeight;
  const isInMiddle = !isAtTop && !isAtBottom;
  return {
    isTop: isAtTop,
    isBottom: isAtBottom,
    isMiddle: isInMiddle
  };
};
var VirtualizedListbox = (props) => {
  var _a2;
  const {
    Component: Component2,
    state,
    color: color2,
    variant,
    itemClasses,
    getBaseProps,
    topContent,
    bottomContent,
    hideEmptyContent,
    hideSelectedIcon,
    shouldHighlightOnFocus,
    disableAnimation,
    getEmptyContentProps,
    getListProps,
    scrollShadowProps
  } = props;
  const { virtualization } = props;
  if (!virtualization || !isEmpty(virtualization) && !virtualization.maxListboxHeight && !virtualization.itemHeight) {
    throw new Error(
      "You are using a virtualized listbox. VirtualizedListbox requires 'virtualization' props with 'maxListboxHeight' and 'itemHeight' properties. This error might have originated from autocomplete components that use VirtualizedListbox. Please provide these props to use the virtualized listbox."
    );
  }
  const { maxListboxHeight, itemHeight } = virtualization;
  const listHeight = Math.min(maxListboxHeight, itemHeight * state.collection.size);
  const parentRef = reactExports.useRef(null);
  const itemSizes = reactExports.useMemo(
    () => getItemSizesForCollection([...state.collection], itemHeight),
    [state.collection, itemHeight]
  );
  const rowVirtualizer = useVirtualizer({
    count: [...state.collection].length,
    getScrollElement: () => parentRef.current,
    estimateSize: (i2) => itemSizes[i2]
  });
  const virtualItems = rowVirtualizer.getVirtualItems();
  const virtualScrollHeight = rowVirtualizer.getTotalSize();
  const { getBaseProps: getBasePropsScrollShadow } = useScrollShadow({ ...scrollShadowProps });
  const renderRow = (virtualItem) => {
    var _a22;
    const item = [...state.collection][virtualItem.index];
    if (!item) {
      return null;
    }
    const itemProps = {
      color: color2,
      item,
      state,
      variant,
      disableAnimation,
      hideSelectedIcon,
      ...item.props
    };
    const virtualizerStyle = {
      position: "absolute",
      top: 0,
      left: 0,
      width: "100%",
      height: `${virtualItem.size}px`,
      transform: `translateY(${virtualItem.start}px)`
    };
    if (item.type === "section") {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        listbox_section_default,
        {
          ...itemProps,
          itemClasses,
          style: { ...virtualizerStyle, ...itemProps.style }
        },
        item.key
      );
    }
    let listboxItem = /* @__PURE__ */ jsxRuntimeExports.jsx(
      listbox_item_default,
      {
        ...itemProps,
        classNames: mergeProps$3(itemClasses, (_a22 = item.props) == null ? void 0 : _a22.classNames),
        shouldHighlightOnFocus,
        style: { ...virtualizerStyle, ...itemProps.style }
      },
      item.key
    );
    if (item.wrapper) {
      listboxItem = item.wrapper(listboxItem);
    }
    return listboxItem;
  };
  const [scrollState, setScrollState] = reactExports.useState({
    isTop: false,
    isBottom: true,
    isMiddle: false
  });
  const content2 = /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Component2,
    {
      ...getListProps(),
      "data-virtual-scroll-height": virtualScrollHeight,
      "data-virtual-scroll-top": (_a2 = parentRef == null ? void 0 : parentRef.current) == null ? void 0 : _a2.scrollTop,
      children: [
        !state.collection.size && !hideEmptyContent && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getEmptyContentProps() }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            ...filterDOMProps(getBasePropsScrollShadow()),
            ref: parentRef,
            style: {
              height: maxListboxHeight,
              overflow: "auto"
            },
            onScroll: (e2) => {
              setScrollState(getScrollState(e2.target));
            },
            children: listHeight > 0 && itemHeight > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
              "div",
              {
                style: {
                  height: `${virtualScrollHeight}px`,
                  width: "100%",
                  position: "relative"
                },
                children: virtualItems.map((virtualItem) => renderRow(virtualItem))
              }
            )
          }
        )
      ]
    }
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getBaseProps(), children: [
    topContent,
    content2,
    bottomContent
  ] });
};
var virtualized_listbox_default = VirtualizedListbox;
var Listbox = forwardRef(function Listbox2(props, ref) {
  const { isVirtualized, ...restProps } = props;
  const useListboxProps = useListbox({ ...restProps, ref });
  const {
    Component: Component2,
    state,
    color: color2,
    variant,
    itemClasses,
    getBaseProps,
    topContent,
    bottomContent,
    hideEmptyContent,
    hideSelectedIcon,
    shouldHighlightOnFocus,
    disableAnimation,
    getEmptyContentProps,
    getListProps
  } = useListboxProps;
  if (isVirtualized) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(virtualized_listbox_default, { ...props, ...useListboxProps });
  }
  const content2 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getListProps(), children: [
    !state.collection.size && !hideEmptyContent && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getEmptyContentProps() }) }),
    [...state.collection].map((item) => {
      var _a2;
      const itemProps = {
        color: color2,
        item,
        state,
        variant,
        disableAnimation,
        hideSelectedIcon,
        ...item.props
      };
      if (item.type === "section") {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(listbox_section_default, { ...itemProps, itemClasses }, item.key);
      }
      let listboxItem = /* @__PURE__ */ jsxRuntimeExports.jsx(
        listbox_item_default,
        {
          ...itemProps,
          classNames: mergeProps$3(itemClasses, (_a2 = item.props) == null ? void 0 : _a2.classNames),
          shouldHighlightOnFocus
        },
        item.key
      );
      if (item.wrapper) {
        listboxItem = item.wrapper(listboxItem);
      }
      return listboxItem;
    })
  ] });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getBaseProps(), children: [
    topContent,
    content2,
    bottomContent
  ] });
});
var listbox_default = Listbox;
var Select$1 = forwardRef(function Select2(props, ref) {
  var _a2;
  const {
    Component: Component2,
    state,
    label,
    hasHelper,
    isLoading,
    triggerRef,
    selectorIcon = /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDownIcon$1, {}),
    description,
    errorMessage,
    isInvalid,
    startContent,
    endContent,
    placeholder,
    renderValue,
    shouldLabelBeOutside,
    disableAnimation,
    getBaseProps,
    getLabelProps,
    getTriggerProps,
    getValueProps,
    getListboxProps,
    getPopoverProps,
    getSpinnerProps,
    getMainWrapperProps,
    getInnerWrapperProps,
    getHiddenSelectProps,
    getHelperWrapperProps,
    getListboxWrapperProps,
    getDescriptionProps,
    getErrorMessageProps,
    getSelectorIconProps,
    isClearable,
    getClearButtonProps,
    getEndWrapperProps,
    getEndContentProps
  } = useSelect({ ...props, ref });
  const labelContent = label ? /* @__PURE__ */ jsxRuntimeExports.jsx("label", { ...getLabelProps(), children: label }) : null;
  const clonedIcon = reactExports.cloneElement(selectorIcon, getSelectorIconProps());
  const clearButton = reactExports.useMemo(() => {
    var _a22;
    if (isClearable && ((_a22 = state.selectedItems) == null ? void 0 : _a22.length)) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getClearButtonProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(CloseFilledIcon, {}) });
    }
    return null;
  }, [isClearable, getClearButtonProps, (_a2 = state.selectedItems) == null ? void 0 : _a2.length]);
  const end2 = reactExports.useMemo(() => {
    if (clearButton) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getEndWrapperProps(), children: [
        clearButton,
        endContent && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getEndContentProps(), children: endContent })
      ] });
    }
    return endContent && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getEndContentProps(), children: endContent });
  }, [clearButton, endContent, getEndWrapperProps, getEndContentProps]);
  const helperWrapper = reactExports.useMemo(() => {
    const shouldShowError = isInvalid && errorMessage;
    const hasContent = shouldShowError || description;
    if (!hasHelper || !hasContent)
      return null;
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getHelperWrapperProps(), children: shouldShowError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getErrorMessageProps(), children: errorMessage }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getDescriptionProps(), children: description }) });
  }, [
    hasHelper,
    isInvalid,
    errorMessage,
    description,
    getHelperWrapperProps,
    getErrorMessageProps,
    getDescriptionProps
  ]);
  const renderSelectedItem = reactExports.useMemo(() => {
    var _a22;
    if (!((_a22 = state.selectedItems) == null ? void 0 : _a22.length))
      return placeholder;
    if (renderValue && typeof renderValue === "function") {
      const mappedItems = [...state.selectedItems].map((item) => ({
        key: item.key,
        data: item.value,
        type: item.type,
        props: item.props,
        textValue: item.textValue,
        rendered: item.rendered,
        "aria-label": item["aria-label"]
      }));
      return renderValue(mappedItems);
    }
    return state.selectedItems.map((item) => item.textValue).join(", ");
  }, [state.selectedItems, renderValue, placeholder]);
  const renderIndicator = reactExports.useMemo(() => {
    if (isLoading) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { ...getSpinnerProps() });
    }
    return clonedIcon;
  }, [isLoading, clonedIcon, getSpinnerProps]);
  const popoverContent = reactExports.useMemo(
    () => state.isOpen ? /* @__PURE__ */ jsxRuntimeExports.jsx(free_solo_popover_default, { ...getPopoverProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(scroll_shadow_default, { ...getListboxWrapperProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(listbox_default, { ...getListboxProps() }) }) }) : null,
    [state.isOpen, getPopoverProps, state, triggerRef, getListboxWrapperProps, getListboxProps]
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getBaseProps(), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(HiddenSelect, { ...getHiddenSelectProps() }),
    shouldLabelBeOutside ? labelContent : null,
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getMainWrapperProps(), children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getTriggerProps(), children: [
        !shouldLabelBeOutside ? labelContent : null,
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getInnerWrapperProps(), children: [
          startContent,
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getValueProps(), children: renderSelectedItem }),
          endContent && state.selectedItems && /* @__PURE__ */ jsxRuntimeExports.jsx($5c3e21d68f1c4674$export$439d29a4e110a164, { elementType: "span", children: "," }),
          end2
        ] }),
        renderIndicator
      ] }),
      helperWrapper
    ] }),
    disableAnimation ? popoverContent : /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { children: popoverContent })
  ] });
});
var select_default = Select$1;
const $aa519ee6cf463259$export$d6c8d9636a3dc49c = /* @__PURE__ */ new WeakMap();
function $aa519ee6cf463259$export$68e648cbec363a18(state, index2) {
  let data = $aa519ee6cf463259$export$d6c8d9636a3dc49c.get(state);
  if (!data)
    throw new Error("Unknown slider state");
  return `${data.id}-${index2}`;
}
function $bcca50147b47f54d$export$56b2c08e277f365(props, state, trackRef) {
  let { labelProps, fieldProps } = $d191a55c9702f145$export$8467354a121f1b9f$1(props);
  let isVertical = props.orientation === "vertical";
  var _labelProps_id;
  $aa519ee6cf463259$export$d6c8d9636a3dc49c.set(state, {
    id: (_labelProps_id = labelProps.id) !== null && _labelProps_id !== void 0 ? _labelProps_id : fieldProps.id,
    "aria-describedby": props["aria-describedby"],
    "aria-details": props["aria-details"]
  });
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let { addGlobalListener, removeGlobalListener } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  const realTimeTrackDraggingIndex = reactExports.useRef(null);
  const reverseX = direction === "rtl";
  const currentPosition = reactExports.useRef(null);
  const { moveProps } = $e8a7022cf87cba2a$export$36da96379f79f245({
    onMoveStart() {
      currentPosition.current = null;
    },
    onMove({ deltaX, deltaY }) {
      if (!trackRef.current)
        return;
      let { height, width } = trackRef.current.getBoundingClientRect();
      let size2 = isVertical ? height : width;
      if (currentPosition.current == null && realTimeTrackDraggingIndex.current != null)
        currentPosition.current = state.getThumbPercent(realTimeTrackDraggingIndex.current) * size2;
      let delta = isVertical ? deltaY : deltaX;
      if (isVertical || reverseX)
        delta = -delta;
      currentPosition.current += delta;
      if (realTimeTrackDraggingIndex.current != null && trackRef.current) {
        const percent2 = $9446cca9a3875146$export$7d15b64cf5a3a4c4(currentPosition.current / size2, 0, 1);
        state.setThumbPercent(realTimeTrackDraggingIndex.current, percent2);
      }
    },
    onMoveEnd() {
      if (realTimeTrackDraggingIndex.current != null) {
        state.setThumbDragging(realTimeTrackDraggingIndex.current, false);
        realTimeTrackDraggingIndex.current = null;
      }
    }
  });
  let currentPointer = reactExports.useRef(void 0);
  let onDownTrack = (e2, id2, clientX, clientY) => {
    if (trackRef.current && !props.isDisabled && state.values.every((_24, i2) => !state.isThumbDragging(i2))) {
      let { height, width, top: top2, left: left2 } = trackRef.current.getBoundingClientRect();
      let size2 = isVertical ? height : width;
      const trackPosition = isVertical ? top2 : left2;
      const clickPosition = isVertical ? clientY : clientX;
      const offset2 = clickPosition - trackPosition;
      let percent2 = offset2 / size2;
      if (direction === "rtl" || isVertical)
        percent2 = 1 - percent2;
      let value2 = state.getPercentValue(percent2);
      let closestThumb;
      let split2 = state.values.findIndex((v2) => value2 - v2 < 0);
      if (split2 === 0)
        closestThumb = split2;
      else if (split2 === -1)
        closestThumb = state.values.length - 1;
      else {
        let lastLeft = state.values[split2 - 1];
        let firstRight = state.values[split2];
        if (Math.abs(lastLeft - value2) < Math.abs(firstRight - value2))
          closestThumb = split2 - 1;
        else
          closestThumb = split2;
      }
      if (closestThumb >= 0 && state.isThumbEditable(closestThumb)) {
        e2.preventDefault();
        realTimeTrackDraggingIndex.current = closestThumb;
        state.setFocusedThumb(closestThumb);
        currentPointer.current = id2;
        state.setThumbDragging(realTimeTrackDraggingIndex.current, true);
        state.setThumbValue(closestThumb, value2);
        addGlobalListener(window, "mouseup", onUpTrack, false);
        addGlobalListener(window, "touchend", onUpTrack, false);
        addGlobalListener(window, "pointerup", onUpTrack, false);
      } else
        realTimeTrackDraggingIndex.current = null;
    }
  };
  let onUpTrack = (e2) => {
    var _e_changedTouches;
    var _e_pointerId;
    let id2 = (_e_pointerId = e2.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : (_e_changedTouches = e2.changedTouches) === null || _e_changedTouches === void 0 ? void 0 : _e_changedTouches[0].identifier;
    if (id2 === currentPointer.current) {
      if (realTimeTrackDraggingIndex.current != null) {
        state.setThumbDragging(realTimeTrackDraggingIndex.current, false);
        realTimeTrackDraggingIndex.current = null;
      }
      removeGlobalListener(window, "mouseup", onUpTrack, false);
      removeGlobalListener(window, "touchend", onUpTrack, false);
      removeGlobalListener(window, "pointerup", onUpTrack, false);
    }
  };
  if ("htmlFor" in labelProps && labelProps.htmlFor) {
    delete labelProps.htmlFor;
    labelProps.onClick = () => {
      var _document_getElementById;
      (_document_getElementById = document.getElementById($aa519ee6cf463259$export$68e648cbec363a18(state, 0))) === null || _document_getElementById === void 0 ? void 0 : _document_getElementById.focus();
      $507fabe10e71c6fb$export$8397ddfc504fdb9a$2("keyboard");
    };
  }
  return {
    labelProps,
    // The root element of the Slider will have role="group" to group together
    // all the thumb inputs in the Slider.  The label of the Slider will
    // be used to label the group.
    groupProps: {
      role: "group",
      ...fieldProps
    },
    trackProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9({
      onMouseDown(e2) {
        if (e2.button !== 0 || e2.altKey || e2.ctrlKey || e2.metaKey)
          return;
        onDownTrack(e2, void 0, e2.clientX, e2.clientY);
      },
      onPointerDown(e2) {
        if (e2.pointerType === "mouse" && (e2.button !== 0 || e2.altKey || e2.ctrlKey || e2.metaKey))
          return;
        onDownTrack(e2, e2.pointerId, e2.clientX, e2.clientY);
      },
      onTouchStart(e2) {
        onDownTrack(e2, e2.changedTouches[0].identifier, e2.changedTouches[0].clientX, e2.changedTouches[0].clientY);
      },
      style: {
        position: "relative",
        touchAction: "none"
      }
    }, moveProps),
    outputProps: {
      htmlFor: state.values.map((_24, index2) => $aa519ee6cf463259$export$68e648cbec363a18(state, index2)).join(" "),
      "aria-live": "off"
    }
  };
}
function $47b897dc8cdb026b$export$8d15029008292ae(opts2, state) {
  let { index: index2 = 0, isRequired, validationState, isInvalid, trackRef, inputRef, orientation = state.orientation, name: name2 } = opts2;
  let isDisabled = opts2.isDisabled || state.isDisabled;
  let isVertical = orientation === "vertical";
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let { addGlobalListener, removeGlobalListener } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let data = $aa519ee6cf463259$export$d6c8d9636a3dc49c.get(state);
  var _opts_arialabelledby;
  const { labelProps, fieldProps } = $d191a55c9702f145$export$8467354a121f1b9f$1({
    ...opts2,
    id: $aa519ee6cf463259$export$68e648cbec363a18(state, index2),
    "aria-labelledby": `${data.id} ${(_opts_arialabelledby = opts2["aria-labelledby"]) !== null && _opts_arialabelledby !== void 0 ? _opts_arialabelledby : ""}`.trim()
  });
  const value2 = state.values[index2];
  const focusInput = reactExports.useCallback(() => {
    if (inputRef.current)
      $7215afc6de606d6b$export$de79e2c695e052f3$5(inputRef.current);
  }, [
    inputRef
  ]);
  const isFocused = state.focusedThumb === index2;
  reactExports.useEffect(() => {
    if (isFocused)
      focusInput();
  }, [
    isFocused,
    focusInput
  ]);
  let reverseX = direction === "rtl";
  let currentPosition = reactExports.useRef(null);
  let { keyboardProps } = $46d819fcbaf35654$export$8f71654801c2f7cd$2({
    onKeyDown(e2) {
      let { getThumbMaxValue, getThumbMinValue, decrementThumb, incrementThumb, setThumbValue, setThumbDragging, pageSize: pageSize2 } = state;
      if (!/^(PageUp|PageDown|Home|End)$/.test(e2.key)) {
        e2.continuePropagation();
        return;
      }
      e2.preventDefault();
      setThumbDragging(index2, true);
      switch (e2.key) {
        case "PageUp":
          incrementThumb(index2, pageSize2);
          break;
        case "PageDown":
          decrementThumb(index2, pageSize2);
          break;
        case "Home":
          setThumbValue(index2, getThumbMinValue(index2));
          break;
        case "End":
          setThumbValue(index2, getThumbMaxValue(index2));
          break;
      }
      setThumbDragging(index2, false);
    }
  });
  let { moveProps } = $e8a7022cf87cba2a$export$36da96379f79f245({
    onMoveStart() {
      currentPosition.current = null;
      state.setThumbDragging(index2, true);
    },
    onMove({ deltaX, deltaY, pointerType, shiftKey }) {
      const { getThumbPercent, setThumbPercent, decrementThumb, incrementThumb, step, pageSize: pageSize2 } = state;
      if (!trackRef.current)
        return;
      let { width, height } = trackRef.current.getBoundingClientRect();
      let size2 = isVertical ? height : width;
      if (currentPosition.current == null)
        currentPosition.current = getThumbPercent(index2) * size2;
      if (pointerType === "keyboard") {
        if (deltaX > 0 && reverseX || deltaX < 0 && !reverseX || deltaY > 0)
          decrementThumb(index2, shiftKey ? pageSize2 : step);
        else
          incrementThumb(index2, shiftKey ? pageSize2 : step);
      } else {
        let delta = isVertical ? deltaY : deltaX;
        if (isVertical || reverseX)
          delta = -delta;
        currentPosition.current += delta;
        setThumbPercent(index2, $9446cca9a3875146$export$7d15b64cf5a3a4c4(currentPosition.current / size2, 0, 1));
      }
    },
    onMoveEnd() {
      state.setThumbDragging(index2, false);
    }
  });
  state.setThumbEditable(index2, !isDisabled);
  const { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2($3ef42575df84b30b$export$9d1611c77c2fe928$9(opts2, {
    onFocus: () => state.setFocusedThumb(index2),
    onBlur: () => state.setFocusedThumb(void 0)
  }), inputRef);
  let currentPointer = reactExports.useRef(void 0);
  let onDown = (id2) => {
    focusInput();
    currentPointer.current = id2;
    state.setThumbDragging(index2, true);
    addGlobalListener(window, "mouseup", onUp, false);
    addGlobalListener(window, "touchend", onUp, false);
    addGlobalListener(window, "pointerup", onUp, false);
  };
  let onUp = (e2) => {
    var _e_changedTouches;
    var _e_pointerId;
    let id2 = (_e_pointerId = e2.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : (_e_changedTouches = e2.changedTouches) === null || _e_changedTouches === void 0 ? void 0 : _e_changedTouches[0].identifier;
    if (id2 === currentPointer.current) {
      focusInput();
      state.setThumbDragging(index2, false);
      removeGlobalListener(window, "mouseup", onUp, false);
      removeGlobalListener(window, "touchend", onUp, false);
      removeGlobalListener(window, "pointerup", onUp, false);
    }
  };
  let thumbPosition = state.getThumbPercent(index2);
  if (isVertical || direction === "rtl")
    thumbPosition = 1 - thumbPosition;
  let interactions = !isDisabled ? $3ef42575df84b30b$export$9d1611c77c2fe928$9(keyboardProps, moveProps, {
    onMouseDown: (e2) => {
      if (e2.button !== 0 || e2.altKey || e2.ctrlKey || e2.metaKey)
        return;
      onDown();
    },
    onPointerDown: (e2) => {
      if (e2.button !== 0 || e2.altKey || e2.ctrlKey || e2.metaKey)
        return;
      onDown(e2.pointerId);
    },
    onTouchStart: (e2) => {
      onDown(e2.changedTouches[0].identifier);
    }
  }) : {};
  $99facab73266f662$export$5add1d006293d136(inputRef, value2, (v2) => {
    state.setThumbValue(index2, v2);
  });
  return {
    inputProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(focusableProps, fieldProps, {
      type: "range",
      tabIndex: !isDisabled ? 0 : void 0,
      min: state.getThumbMinValue(index2),
      max: state.getThumbMaxValue(index2),
      step: state.step,
      value: value2,
      name: name2,
      disabled: isDisabled,
      "aria-orientation": orientation,
      "aria-valuetext": state.getThumbValueLabel(index2),
      "aria-required": isRequired || void 0,
      "aria-invalid": isInvalid || validationState === "invalid" || void 0,
      "aria-errormessage": opts2["aria-errormessage"],
      "aria-describedby": [
        data["aria-describedby"],
        opts2["aria-describedby"]
      ].filter(Boolean).join(" "),
      "aria-details": [
        data["aria-details"],
        opts2["aria-details"]
      ].filter(Boolean).join(" "),
      onChange: (e2) => {
        state.setThumbValue(index2, parseFloat(e2.target.value));
      }
    }),
    thumbProps: {
      ...interactions,
      style: {
        position: "absolute",
        [isVertical ? "top" : "left"]: `${thumbPosition * 100}%`,
        transform: "translate(-50%, -50%)",
        touchAction: "none"
      }
    },
    labelProps,
    isDragging: state.isThumbDragging(index2),
    isDisabled,
    isFocused
  };
}
function $8a9cb279dc87e130$export$525bc4921d56d4a$2(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$2(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$cabe61c495ee3649$2(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$3(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$4(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$2 = "default";
let $14c0b72509d70225$var$savedUserSelect$2 = "";
let $14c0b72509d70225$var$modifiedElementMap$2 = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$2(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$2 === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
      $14c0b72509d70225$var$savedUserSelect$2 = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$2 = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$2.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$2(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$2 !== "disabled")
      return;
    $14c0b72509d70225$var$state$2 = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
        if ($14c0b72509d70225$var$state$2 === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$2 || "";
          $14c0b72509d70225$var$savedUserSelect$2 = "";
          $14c0b72509d70225$var$state$2 = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$2.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$2.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$2.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$2 = React$5.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$2.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext$2(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$2);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$9(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$2 = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$2 = class $f6c31cce2adf654f$var$PressEvent10 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$2, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$2);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$2, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$2, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$2 = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$2 = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$2 = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$2(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$2(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$2("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$2("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$2("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$2("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$2(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$2(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$2(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$2(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$2(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$2($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$2(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$3(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$2(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$9(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$6())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$4(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$2(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$2(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$2(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$2($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$2(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$2(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$2]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$2] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$3(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$2(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$2(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$2(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$2(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$5(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$2))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$2;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$2}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$2((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$2]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$2(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$2(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$2(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$2(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$2(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$2(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$2(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$2(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$2(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$2(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$2 = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$2(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$2.has(target.type);
}
const $b5e257d569688ac6$var$defaultContext$5 = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$5 = /* @__PURE__ */ React$5.createContext($b5e257d569688ac6$var$defaultContext$5);
const $b5e257d569688ac6$var$IsSSRContext$5 = /* @__PURE__ */ React$5.createContext(false);
let $b5e257d569688ac6$var$componentIds$5 = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$5(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$5);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$5.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$5.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$5.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$5(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$5);
  let counter = $b5e257d569688ac6$var$useCounter$5(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$5(defaultId) {
  let id2 = React$5.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$5());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$5.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$5["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$5 : $b5e257d569688ac6$var$useLegacySSRSafeId$5;
function $b5e257d569688ac6$var$getSnapshot$5() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$5() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$5(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$5() {
  if (typeof React$5["useSyncExternalStore"] === "function")
    return React$5["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$5, $b5e257d569688ac6$var$getSnapshot$5, $b5e257d569688ac6$var$getServerSnapshot$5);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$5);
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$3 = false;
let $6179b936705e76d3$var$hoverCount$3 = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$3() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$3 = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$3 = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$3(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$3();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$3() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$3);
  $6179b936705e76d3$var$hoverCount$3++;
  return () => {
    $6179b936705e76d3$var$hoverCount$3--;
    if ($6179b936705e76d3$var$hoverCount$3 > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$3);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$3(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$3, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$3 && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
const $148a7a147e38ea7f$var$RTL_SCRIPTS$5 = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS$5 = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764$5(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS$5.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS$5.has(lang2);
}
const $1e5a04cdaf7d1af8$var$localeSymbol$5 = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$5() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol$5] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764$5(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale$5 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$5();
let $1e5a04cdaf7d1af8$var$listeners$5 = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale$5() {
  $1e5a04cdaf7d1af8$var$currentLocale$5 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$5();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners$5)
    listener($1e5a04cdaf7d1af8$var$currentLocale$5);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$5() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$5();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale$5);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners$5.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$5);
    $1e5a04cdaf7d1af8$var$listeners$5.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners$5.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners$5.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$5);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext$5 = /* @__PURE__ */ React$5.createContext(null);
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$5() {
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$5();
  let context = reactExports.useContext($18f2051aff69b9bf$var$I18nContext$5);
  return context || defaultLocale;
}
function $a916eb452884faea$export$b7a616150fdb9f44(options = {}) {
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$5();
  return reactExports.useMemo(() => new $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5(locale2, options), [
    locale2,
    options
  ]);
}
function useSliderThumb(props) {
  const {
    ref,
    as: as2,
    state,
    index: index2,
    name: name2,
    trackRef,
    className,
    tooltipProps,
    isVertical,
    showTooltip,
    getTooltipValue,
    formatOptions,
    renderThumb,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const inputRef = reactExports.useRef(null);
  const numberFormatter = $a916eb452884faea$export$b7a616150fdb9f44(formatOptions);
  const { thumbProps, inputProps, isDragging: isDragging2, isFocused } = $47b897dc8cdb026b$export$8d15029008292ae(
    {
      index: index2,
      trackRef,
      inputRef,
      name: name2,
      ...otherProps
    },
    state
  );
  const { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456$3({
    isDisabled: state.isDisabled
  });
  const { focusProps, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$2({
    isDisabled: state.isDisabled
  });
  const getThumbProps = (props2 = {}) => {
    return {
      ref: domRef,
      "data-slot": "thumb",
      "data-hover": dataAttr(isHovered),
      "data-pressed": dataAttr(isPressed),
      "data-dragging": dataAttr(isDragging2),
      "data-focused": dataAttr(isFocused),
      "data-focus-visible": dataAttr(isFocusVisible),
      "aria-label": props2["aria-label"] || `Slider thumb ${index2 !== void 0 ? `${index2 + 1}` : ""}`,
      ...mergeProps$3(thumbProps, pressProps, hoverProps, otherProps),
      className,
      ...props2
    };
  };
  const getTooltipProps = () => {
    const stateValue = (tooltipProps == null ? void 0 : tooltipProps.content) ? tooltipProps.content : getTooltipValue ? state.values.length === 1 ? getTooltipValue(state.values[index2 != null ? index2 : 0]) : getTooltipValue(state.values, index2 != null ? index2 : 0) : state.values[index2 != null ? index2 : 0];
    const value2 = numberFormatter && typeof stateValue === "number" ? numberFormatter.format(stateValue) : stateValue;
    return {
      ...tooltipProps,
      placement: (tooltipProps == null ? void 0 : tooltipProps.placement) ? tooltipProps == null ? void 0 : tooltipProps.placement : isVertical ? "right" : "top",
      content: (tooltipProps == null ? void 0 : tooltipProps.content) ? tooltipProps == null ? void 0 : tooltipProps.content : value2,
      updatePositionDeps: [isDragging2, isHovered, isFocused, isFocusVisible, value2],
      isOpen: (tooltipProps == null ? void 0 : tooltipProps.isOpen) !== void 0 ? tooltipProps == null ? void 0 : tooltipProps.isOpen : isHovered || isDragging2 || isFocused || isFocusVisible,
      role: "tooltip",
      "aria-label": `Current value: ${value2}`
    };
  };
  const getInputProps = (props2 = {}) => {
    return {
      ref: inputRef,
      ...mergeProps$3(inputProps, focusProps),
      ...props2
    };
  };
  return {
    Component: Component2,
    index: index2,
    showTooltip,
    renderThumb,
    getThumbProps,
    getTooltipProps,
    getInputProps
  };
}
var SliderThumb = forwardRef((props, ref) => {
  const {
    Component: Component2,
    index: index2,
    renderThumb,
    showTooltip,
    getTooltipProps,
    getThumbProps,
    getInputProps
  } = useSliderThumb({
    ...props,
    ref
  });
  const thumbProps = {
    ...getThumbProps(),
    index: index2,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx($5c3e21d68f1c4674$export$439d29a4e110a164, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...getInputProps() }) })
  };
  const content2 = renderFn({
    Component: Component2,
    props: thumbProps,
    renderCustom: renderThumb
  });
  return showTooltip ? /* @__PURE__ */ jsxRuntimeExports.jsx(tooltip_default, { ...getTooltipProps(), children: content2 }) : content2;
});
SliderThumb.displayName = "HeroUI.SliderThumb";
var slider_thumb_default = SliderThumb;
const $28f99e3e86e6ec45$var$DEFAULT_MIN_VALUE = 0;
const $28f99e3e86e6ec45$var$DEFAULT_MAX_VALUE = 100;
const $28f99e3e86e6ec45$var$DEFAULT_STEP_VALUE = 1;
function $28f99e3e86e6ec45$export$e5fda3247f5d67f9(props) {
  const { isDisabled = false, minValue = $28f99e3e86e6ec45$var$DEFAULT_MIN_VALUE, maxValue = $28f99e3e86e6ec45$var$DEFAULT_MAX_VALUE, numberFormatter: formatter, step = $28f99e3e86e6ec45$var$DEFAULT_STEP_VALUE, orientation = "horizontal" } = props;
  let pageSize2 = reactExports.useMemo(() => {
    let calcPageSize = (maxValue - minValue) / 10;
    calcPageSize = $9446cca9a3875146$export$cb6e0bb50bc19463(calcPageSize, 0, calcPageSize + step, step);
    return Math.max(calcPageSize, step);
  }, [
    step,
    maxValue,
    minValue
  ]);
  let restrictValues = reactExports.useCallback((values2) => values2 === null || values2 === void 0 ? void 0 : values2.map((val, idx) => {
    let min2 = idx === 0 ? minValue : values2[idx - 1];
    let max2 = idx === values2.length - 1 ? maxValue : values2[idx + 1];
    return $9446cca9a3875146$export$cb6e0bb50bc19463(val, min2, max2, step);
  }), [
    minValue,
    maxValue,
    step
  ]);
  let value2 = reactExports.useMemo(() => restrictValues($28f99e3e86e6ec45$var$convertValue(props.value)), [
    props.value
  ]);
  let defaultValue2 = reactExports.useMemo(() => {
    var _convertValue;
    return restrictValues((_convertValue = $28f99e3e86e6ec45$var$convertValue(props.defaultValue)) !== null && _convertValue !== void 0 ? _convertValue : [
      minValue
    ]);
  }, [
    props.defaultValue,
    minValue
  ]);
  let onChange = $28f99e3e86e6ec45$var$createOnChange(props.value, props.defaultValue, props.onChange);
  let onChangeEnd = $28f99e3e86e6ec45$var$createOnChange(props.value, props.defaultValue, props.onChangeEnd);
  const [values, setValuesState] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(value2, defaultValue2, onChange);
  const [isDraggings, setDraggingsState] = reactExports.useState(new Array(values.length).fill(false));
  const isEditablesRef = reactExports.useRef(new Array(values.length).fill(true));
  const [focusedIndex, setFocusedIndex] = reactExports.useState(void 0);
  const valuesRef = reactExports.useRef(values);
  const isDraggingsRef = reactExports.useRef(isDraggings);
  let setValues = (values2) => {
    valuesRef.current = values2;
    setValuesState(values2);
  };
  let setDraggings = (draggings) => {
    isDraggingsRef.current = draggings;
    setDraggingsState(draggings);
  };
  function getValuePercent(value3) {
    return (value3 - minValue) / (maxValue - minValue);
  }
  function getThumbMinValue(index2) {
    return index2 === 0 ? minValue : values[index2 - 1];
  }
  function getThumbMaxValue(index2) {
    return index2 === values.length - 1 ? maxValue : values[index2 + 1];
  }
  function isThumbEditable(index2) {
    return isEditablesRef.current[index2];
  }
  function setThumbEditable(index2, editable) {
    isEditablesRef.current[index2] = editable;
  }
  function updateValue(index2, value3) {
    if (isDisabled || !isThumbEditable(index2))
      return;
    const thisMin = getThumbMinValue(index2);
    const thisMax = getThumbMaxValue(index2);
    value3 = $9446cca9a3875146$export$cb6e0bb50bc19463(value3, thisMin, thisMax, step);
    let newValues = $28f99e3e86e6ec45$var$replaceIndex(valuesRef.current, index2, value3);
    setValues(newValues);
  }
  function updateDragging(index2, dragging) {
    if (isDisabled || !isThumbEditable(index2))
      return;
    if (dragging)
      valuesRef.current = values;
    const wasDragging = isDraggingsRef.current[index2];
    isDraggingsRef.current = $28f99e3e86e6ec45$var$replaceIndex(isDraggingsRef.current, index2, dragging);
    setDraggings(isDraggingsRef.current);
    if (onChangeEnd && wasDragging && !isDraggingsRef.current.some(Boolean))
      onChangeEnd(valuesRef.current);
  }
  function getFormattedValue(value3) {
    return formatter.format(value3);
  }
  function setThumbPercent(index2, percent2) {
    updateValue(index2, getPercentValue(percent2));
  }
  function getRoundedValue(value3) {
    return Math.round((value3 - minValue) / step) * step + minValue;
  }
  function getPercentValue(percent2) {
    const val = percent2 * (maxValue - minValue) + minValue;
    return $9446cca9a3875146$export$7d15b64cf5a3a4c4(getRoundedValue(val), minValue, maxValue);
  }
  function incrementThumb(index2, stepSize = 1) {
    let s2 = Math.max(stepSize, step);
    updateValue(index2, $9446cca9a3875146$export$cb6e0bb50bc19463(values[index2] + s2, minValue, maxValue, step));
  }
  function decrementThumb(index2, stepSize = 1) {
    let s2 = Math.max(stepSize, step);
    updateValue(index2, $9446cca9a3875146$export$cb6e0bb50bc19463(values[index2] - s2, minValue, maxValue, step));
  }
  return {
    values,
    getThumbValue: (index2) => values[index2],
    setThumbValue: updateValue,
    setThumbPercent,
    isThumbDragging: (index2) => isDraggings[index2],
    setThumbDragging: updateDragging,
    focusedThumb: focusedIndex,
    setFocusedThumb: setFocusedIndex,
    getThumbPercent: (index2) => getValuePercent(values[index2]),
    getValuePercent,
    getThumbValueLabel: (index2) => getFormattedValue(values[index2]),
    getFormattedValue,
    getThumbMinValue,
    getThumbMaxValue,
    getPercentValue,
    isThumbEditable,
    setThumbEditable,
    incrementThumb,
    decrementThumb,
    step,
    pageSize: pageSize2,
    orientation,
    isDisabled
  };
}
function $28f99e3e86e6ec45$var$replaceIndex(array4, index2, value2) {
  if (array4[index2] === value2)
    return array4;
  return [
    ...array4.slice(0, index2),
    value2,
    ...array4.slice(index2 + 1)
  ];
}
function $28f99e3e86e6ec45$var$convertValue(value2) {
  if (value2 == null)
    return void 0;
  return Array.isArray(value2) ? value2 : [
    value2
  ];
}
function $28f99e3e86e6ec45$var$createOnChange(value2, defaultValue2, onChange) {
  return (newValue) => {
    if (typeof value2 === "number" || typeof defaultValue2 === "number")
      onChange === null || onChange === void 0 ? void 0 : onChange(newValue[0]);
    else
      onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
  };
}
function useSlider(originalProps) {
  var _a2, _b2, _c2, _d;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, slider.variantKeys);
  const {
    ref,
    as: as2,
    name: name2,
    label,
    formatOptions,
    value: valueProp,
    maxValue = 100,
    minValue = 0,
    step = 1,
    showSteps = false,
    showTooltip = false,
    orientation = "horizontal",
    marks = [],
    startContent,
    endContent,
    fillOffset: fillOffset2,
    className,
    classNames: classNames2,
    renderThumb,
    renderLabel,
    renderValue,
    onChange,
    onChangeEnd,
    getValue: getValue2,
    getTooltipValue,
    tooltipValueFormatOptions = formatOptions,
    tooltipProps: userTooltipProps = {},
    ...otherProps
  } = props;
  const isFixedValue = minValue === maxValue;
  if (isFixedValue) {
    warn$2("Min and max values should not be the same. This may cause unexpected behavior.");
  }
  const Component2 = as2 || "div";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const disableAnimation = (_b2 = (_a2 = originalProps == null ? void 0 : originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const domRef = useDOMRef(ref);
  const trackRef = reactExports.useRef(null);
  const numberFormatter = $a916eb452884faea$export$b7a616150fdb9f44(formatOptions);
  const { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$5();
  const clampValue = reactExports.useCallback(
    (valueToClamp) => {
      return Math.min(Math.max(valueToClamp, minValue), maxValue);
    },
    [minValue, maxValue]
  );
  const validatedValue = reactExports.useMemo(() => {
    if (isFixedValue)
      return minValue;
    if (valueProp === void 0)
      return void 0;
    if (Array.isArray(valueProp)) {
      return valueProp.map(clampValue);
    }
    return clampValue(valueProp);
  }, [valueProp, clampValue, isFixedValue, minValue]);
  const state = $28f99e3e86e6ec45$export$e5fda3247f5d67f9({
    ...otherProps,
    value: validatedValue,
    isDisabled: (_c2 = originalProps == null ? void 0 : originalProps.isDisabled) != null ? _c2 : false,
    orientation,
    step,
    minValue,
    maxValue,
    numberFormatter,
    onChange,
    onChangeEnd
  });
  const tooltipProps = {
    offset: 5,
    delay: 0,
    size: "sm",
    showArrow: true,
    color: (originalProps == null ? void 0 : originalProps.color) ? originalProps == null ? void 0 : originalProps.color : (_d = slider.defaultVariants) == null ? void 0 : _d.color,
    isDisabled: originalProps.isDisabled,
    ...userTooltipProps
  };
  const { groupProps, trackProps, labelProps, outputProps } = $bcca50147b47f54d$export$56b2c08e277f365(
    originalProps,
    state,
    trackRef
  );
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$3({ isDisabled: originalProps.isDisabled });
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const isVertical = orientation === "vertical";
  const hasMarks = (marks == null ? void 0 : marks.length) > 0;
  const hasSingleThumb = fillOffset2 === void 0 ? state.values.length === 1 : false;
  const slots = reactExports.useMemo(
    () => slider({
      ...variantProps2,
      hasMarks,
      disableAnimation,
      hasSingleThumb,
      isVertical
    }),
    [objectToDeps(variantProps2), isVertical, disableAnimation, hasSingleThumb, hasMarks]
  );
  const [startOffset, endOffset] = [
    state.values.length > 1 ? state.getThumbPercent(0) : fillOffset2 !== void 0 ? state.getValuePercent(fillOffset2) : 0,
    state.getThumbPercent(state.values.length - 1)
  ].sort();
  const value2 = state.values.length === 1 ? numberFormatter.format(state.values[0]) : numberFormatter.formatRange(state.values[0], state.values[state.values.length - 1]);
  const steps = showSteps ? Math.floor((maxValue - minValue) / step) + 1 : 0;
  const getBaseProps = (props2 = {}) => {
    return {
      ref: domRef,
      "data-orientation": state.orientation,
      "data-slot": "base",
      "data-hover": isHovered,
      className: slots.base({ class: baseStyles }),
      ...mergeProps$3(
        groupProps,
        hoverProps,
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        }),
        filterDOMProps(props2)
      )
    };
  };
  const getLabelWrapperProps = (props2 = {}) => {
    return {
      className: slots.labelWrapper({ class: classNames2 == null ? void 0 : classNames2.labelWrapper }),
      "data-slot": "labelWrapper",
      ...props2
    };
  };
  const getLabelProps = (props2 = {}) => {
    return {
      "data-slot": "label",
      className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }),
      children: label,
      ...labelProps,
      ...props2
    };
  };
  const getValueProps = (props2 = {}) => {
    return {
      "data-slot": "value",
      className: slots.value({ class: classNames2 == null ? void 0 : classNames2.value }),
      children: getValue2 && typeof getValue2 === "function" ? getValue2(state.values) : value2,
      ...outputProps,
      ...props2
    };
  };
  const getTrackProps = (props2 = {}) => {
    const fillWidth = (endOffset - startOffset) * 100;
    return {
      ref: trackRef,
      "data-slot": "track",
      "data-thumb-hidden": !!(originalProps == null ? void 0 : originalProps.hideThumb),
      "data-vertical": isVertical,
      ...hasSingleThumb ? {
        "data-fill-start": fillWidth > 0,
        "data-fill-end": fillWidth == 100
      } : {
        "data-fill-start": startOffset == 0,
        "data-fill-end": startOffset * 100 + fillWidth == 100
      },
      className: slots.track({ class: classNames2 == null ? void 0 : classNames2.track }),
      ...trackProps,
      ...props2
    };
  };
  const getTrackWrapperProps = (props2 = {}) => {
    return {
      "data-slot": "track-wrapper",
      className: slots.trackWrapper({ class: classNames2 == null ? void 0 : classNames2.trackWrapper }),
      ...props2
    };
  };
  const getFillerProps = (props2 = {}) => {
    return {
      "data-slot": "filler",
      className: slots.filler({ class: classNames2 == null ? void 0 : classNames2.filler }),
      ...props2,
      style: {
        ...props2.style,
        [isVertical ? "bottom" : direction === "rtl" ? "right" : "left"]: `${startOffset * 100}%`,
        ...isVertical ? {
          height: `${(endOffset - startOffset) * 100}%`
        } : {
          width: `${(endOffset - startOffset) * 100}%`
        }
      }
    };
  };
  const getThumbProps = (index2) => {
    return {
      name: name2,
      index: index2,
      state,
      trackRef,
      orientation,
      isVertical,
      tooltipProps,
      getTooltipValue,
      showTooltip,
      renderThumb,
      formatOptions: tooltipValueFormatOptions,
      className: slots.thumb({ class: classNames2 == null ? void 0 : classNames2.thumb })
    };
  };
  const getStepProps = (index2) => {
    const percent2 = state.getValuePercent(index2 * step + minValue);
    return {
      className: slots.step({ class: classNames2 == null ? void 0 : classNames2.step }),
      "data-slot": "step",
      "data-in-range": percent2 <= endOffset && percent2 >= startOffset,
      style: {
        [isVertical ? "bottom" : direction === "rtl" ? "right" : "left"]: `${percent2 * 100}%`
      }
    };
  };
  const getMarkProps = (mark2) => {
    const percent2 = state.getValuePercent(mark2.value);
    return {
      className: slots.mark({ class: classNames2 == null ? void 0 : classNames2.mark }),
      "data-slot": "mark",
      "data-in-range": percent2 <= endOffset && percent2 >= startOffset,
      style: {
        [isVertical ? "bottom" : direction === "rtl" ? "right" : "left"]: `${percent2 * 100}%`
      },
      // avoid `onDownTrack` is being called since when you click the mark,
      // `onDownTrack` will calculate the percent based on the position you click
      // the calculated value will be set instead of the actual value defined in `marks`
      onMouseDown: (e2) => e2.stopPropagation(),
      onPointerDown: (e2) => e2.stopPropagation(),
      onClick: (e2) => {
        e2.stopPropagation();
        if (isFixedValue)
          return;
        if (state.values.length === 1) {
          state.setThumbPercent(0, percent2);
        } else {
          const leftThumbVal = state.values[0];
          const rightThumbVal = state.values[1];
          if (mark2.value < leftThumbVal) {
            state.setThumbPercent(0, percent2);
          } else if (mark2.value > rightThumbVal) {
            state.setThumbPercent(1, percent2);
          } else if (Math.abs(mark2.value - leftThumbVal) < Math.abs(mark2.value - rightThumbVal)) {
            state.setThumbPercent(0, percent2);
          } else {
            state.setThumbPercent(1, percent2);
          }
        }
      }
    };
  };
  const getStartContentProps = (props2 = {}) => ({
    "data-slot": "startContent",
    className: slots.startContent({ class: classNames2 == null ? void 0 : classNames2.startContent }),
    ...props2
  });
  const getEndContentProps = (props2 = {}) => ({
    "data-slot": "endContent",
    className: slots.endContent({ class: classNames2 == null ? void 0 : classNames2.endContent }),
    ...props2
  });
  return {
    Component: Component2,
    state,
    value: value2,
    domRef,
    label,
    steps,
    marks,
    startContent,
    endContent,
    getStepProps,
    getBaseProps,
    getValue: getValue2,
    renderLabel,
    renderValue,
    getTrackWrapperProps,
    getLabelWrapperProps,
    getLabelProps,
    getValueProps,
    getTrackProps,
    getFillerProps,
    getThumbProps,
    getMarkProps,
    getStartContentProps,
    getEndContentProps
  };
}
var Slider$2 = forwardRef((props, ref) => {
  const {
    Component: Component2,
    state,
    label,
    steps,
    marks,
    startContent,
    endContent,
    getStepProps,
    getBaseProps,
    renderValue,
    renderLabel,
    getTrackWrapperProps,
    getLabelWrapperProps,
    getLabelProps,
    getValueProps,
    getTrackProps,
    getFillerProps,
    getThumbProps,
    getMarkProps,
    getStartContentProps,
    getEndContentProps
  } = useSlider({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getBaseProps(), children: [
    label && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getLabelWrapperProps(), children: [
      renderFn({
        Component: "label",
        props: getLabelProps(),
        renderCustom: renderLabel
      }),
      renderFn({
        Component: "output",
        props: getValueProps(),
        renderCustom: renderValue
      })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getTrackWrapperProps(), children: [
      startContent && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getStartContentProps(), children: startContent }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getTrackProps(), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getFillerProps() }),
        Number.isFinite(steps) && Array.from({ length: steps }, (_24, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getStepProps(index2) }, index2)),
        state.values.map((_24, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(slider_thumb_default, { ...getThumbProps(index2) }, index2)),
        (marks == null ? void 0 : marks.length) > 0 && marks.map((mark2, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getMarkProps(mark2), children: mark2.label }, index2))
      ] }),
      endContent && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getEndContentProps(), children: endContent })
    ] })
  ] });
});
Slider$2.displayName = "HeroUI.Slider";
var slider_default = Slider$2;
function $a9e7382a7d111cb5$export$b453a3bfd4a5fa9e(props) {
  var _collection_getItem;
  let { defaultFilter, menuTrigger = "input", allowsEmptyCollection = false, allowsCustomValue, shouldCloseOnBlur = true } = props;
  let [showAllItems, setShowAllItems] = reactExports.useState(false);
  let [isFocused, setFocusedState] = reactExports.useState(false);
  let [focusStrategy, setFocusStrategy] = reactExports.useState(null);
  let onSelectionChange = (key) => {
    if (props.onSelectionChange)
      props.onSelectionChange(key);
    if (key === selectedKey) {
      resetInputValue();
      closeMenu();
    }
  };
  var _props_items;
  let { collection, selectionManager, selectedKey, setSelectedKey, selectedItem, disabledKeys } = $a0d645289fe9b86b$export$e7f05e985daf4b5f({
    ...props,
    onSelectionChange,
    items: (_props_items = props.items) !== null && _props_items !== void 0 ? _props_items : props.defaultItems
  });
  let defaultInputValue = props.defaultInputValue;
  if (defaultInputValue == null) {
    var _collection_getItem1;
    var _collection_getItem_textValue;
    if (selectedKey == null)
      defaultInputValue = "";
    else
      defaultInputValue = (_collection_getItem_textValue = (_collection_getItem1 = collection.getItem(selectedKey)) === null || _collection_getItem1 === void 0 ? void 0 : _collection_getItem1.textValue) !== null && _collection_getItem_textValue !== void 0 ? _collection_getItem_textValue : "";
  }
  let [inputValue, setInputValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.inputValue, defaultInputValue, props.onInputChange);
  let originalCollection = collection;
  let filteredCollection = reactExports.useMemo(() => (
    // No default filter if items are controlled.
    props.items != null || !defaultFilter ? collection : $a9e7382a7d111cb5$var$filterCollection(collection, inputValue, defaultFilter)
  ), [
    collection,
    inputValue,
    defaultFilter,
    props.items
  ]);
  let [lastCollection, setLastCollection] = reactExports.useState(filteredCollection);
  let menuOpenTrigger = reactExports.useRef("focus");
  let onOpenChange = (open2) => {
    if (props.onOpenChange)
      props.onOpenChange(open2, open2 ? menuOpenTrigger.current : void 0);
    selectionManager.setFocused(open2);
    if (!open2)
      selectionManager.setFocusedKey(null);
  };
  let triggerState = $fc909762b330b746$export$61c6a8c84e605fb6$2({
    ...props,
    onOpenChange,
    isOpen: void 0,
    defaultOpen: void 0
  });
  let open = (focusStrategy2 = null, trigger) => {
    let displayAllItems = trigger === "manual" || trigger === "focus" && menuTrigger === "focus";
    if (allowsEmptyCollection || filteredCollection.size > 0 || displayAllItems && originalCollection.size > 0 || props.items) {
      if (displayAllItems && !triggerState.isOpen && props.items === void 0)
        setShowAllItems(true);
      menuOpenTrigger.current = trigger;
      setFocusStrategy(focusStrategy2);
      triggerState.open();
    }
  };
  let toggle2 = (focusStrategy2 = null, trigger) => {
    let displayAllItems = trigger === "manual" || trigger === "focus" && menuTrigger === "focus";
    if (!(allowsEmptyCollection || filteredCollection.size > 0 || displayAllItems && originalCollection.size > 0 || props.items) && !triggerState.isOpen)
      return;
    if (displayAllItems && !triggerState.isOpen && props.items === void 0)
      setShowAllItems(true);
    if (!triggerState.isOpen)
      menuOpenTrigger.current = trigger;
    toggleMenu(focusStrategy2);
  };
  let updateLastCollection = reactExports.useCallback(() => {
    setLastCollection(showAllItems ? originalCollection : filteredCollection);
  }, [
    showAllItems,
    originalCollection,
    filteredCollection
  ]);
  let toggleMenu = reactExports.useCallback((focusStrategy2 = null) => {
    if (triggerState.isOpen)
      updateLastCollection();
    setFocusStrategy(focusStrategy2);
    triggerState.toggle();
  }, [
    triggerState,
    updateLastCollection
  ]);
  let closeMenu = reactExports.useCallback(() => {
    if (triggerState.isOpen) {
      updateLastCollection();
      triggerState.close();
    }
  }, [
    triggerState,
    updateLastCollection
  ]);
  let [lastValue, setLastValue] = reactExports.useState(inputValue);
  let resetInputValue = () => {
    var _collection_getItem2;
    var _collection_getItem_textValue2;
    let itemText = selectedKey != null ? (_collection_getItem_textValue2 = (_collection_getItem2 = collection.getItem(selectedKey)) === null || _collection_getItem2 === void 0 ? void 0 : _collection_getItem2.textValue) !== null && _collection_getItem_textValue2 !== void 0 ? _collection_getItem_textValue2 : "" : "";
    setLastValue(itemText);
    setInputValue(itemText);
  };
  var _props_selectedKey, _ref;
  let lastSelectedKey = reactExports.useRef((_ref = (_props_selectedKey = props.selectedKey) !== null && _props_selectedKey !== void 0 ? _props_selectedKey : props.defaultSelectedKey) !== null && _ref !== void 0 ? _ref : null);
  var _collection_getItem_textValue1;
  let lastSelectedKeyText = reactExports.useRef(selectedKey != null ? (_collection_getItem_textValue1 = (_collection_getItem = collection.getItem(selectedKey)) === null || _collection_getItem === void 0 ? void 0 : _collection_getItem.textValue) !== null && _collection_getItem_textValue1 !== void 0 ? _collection_getItem_textValue1 : "" : "");
  reactExports.useEffect(() => {
    var _collection_getItem2;
    if (isFocused && (filteredCollection.size > 0 || allowsEmptyCollection) && !triggerState.isOpen && inputValue !== lastValue && menuTrigger !== "manual")
      open(null, "input");
    if (!showAllItems && !allowsEmptyCollection && triggerState.isOpen && filteredCollection.size === 0)
      closeMenu();
    if (selectedKey != null && selectedKey !== lastSelectedKey.current)
      closeMenu();
    if (inputValue !== lastValue) {
      selectionManager.setFocusedKey(null);
      setShowAllItems(false);
      if (inputValue === "" && (props.inputValue === void 0 || props.selectedKey === void 0))
        setSelectedKey(null);
    }
    if (selectedKey !== lastSelectedKey.current && (props.inputValue === void 0 || props.selectedKey === void 0))
      resetInputValue();
    else if (lastValue !== inputValue)
      setLastValue(inputValue);
    var _collection_getItem_textValue2;
    let selectedItemText = selectedKey != null ? (_collection_getItem_textValue2 = (_collection_getItem2 = collection.getItem(selectedKey)) === null || _collection_getItem2 === void 0 ? void 0 : _collection_getItem2.textValue) !== null && _collection_getItem_textValue2 !== void 0 ? _collection_getItem_textValue2 : "" : "";
    if (!isFocused && selectedKey != null && props.inputValue === void 0 && selectedKey === lastSelectedKey.current) {
      if (lastSelectedKeyText.current !== selectedItemText) {
        setLastValue(selectedItemText);
        setInputValue(selectedItemText);
      }
    }
    lastSelectedKey.current = selectedKey;
    lastSelectedKeyText.current = selectedItemText;
  });
  let validation = $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1({
    ...props,
    value: reactExports.useMemo(() => ({
      inputValue,
      selectedKey
    }), [
      inputValue,
      selectedKey
    ])
  });
  let revert2 = () => {
    if (allowsCustomValue && selectedKey == null)
      commitCustomValue();
    else
      commitSelection();
  };
  let commitCustomValue = () => {
    lastSelectedKey.current = null;
    setSelectedKey(null);
    closeMenu();
  };
  let commitSelection = () => {
    if (props.selectedKey !== void 0 && props.inputValue !== void 0) {
      var _props_onSelectionChange, _collection_getItem2;
      (_props_onSelectionChange = props.onSelectionChange) === null || _props_onSelectionChange === void 0 ? void 0 : _props_onSelectionChange.call(props, selectedKey);
      var _collection_getItem_textValue2;
      let itemText = selectedKey != null ? (_collection_getItem_textValue2 = (_collection_getItem2 = collection.getItem(selectedKey)) === null || _collection_getItem2 === void 0 ? void 0 : _collection_getItem2.textValue) !== null && _collection_getItem_textValue2 !== void 0 ? _collection_getItem_textValue2 : "" : "";
      setLastValue(itemText);
      closeMenu();
    } else {
      resetInputValue();
      closeMenu();
    }
  };
  const commitValue = () => {
    if (allowsCustomValue) {
      var _collection_getItem2;
      var _collection_getItem_textValue2;
      const itemText = selectedKey != null ? (_collection_getItem_textValue2 = (_collection_getItem2 = collection.getItem(selectedKey)) === null || _collection_getItem2 === void 0 ? void 0 : _collection_getItem2.textValue) !== null && _collection_getItem_textValue2 !== void 0 ? _collection_getItem_textValue2 : "" : "";
      inputValue === itemText ? commitSelection() : commitCustomValue();
    } else
      commitSelection();
  };
  let commit = () => {
    if (triggerState.isOpen && selectionManager.focusedKey != null) {
      if (selectedKey === selectionManager.focusedKey)
        commitSelection();
      else
        setSelectedKey(selectionManager.focusedKey);
    } else
      commitValue();
  };
  let valueOnFocus = reactExports.useRef(inputValue);
  let setFocused = (isFocused2) => {
    if (isFocused2) {
      valueOnFocus.current = inputValue;
      if (menuTrigger === "focus" && !props.isReadOnly)
        open(null, "focus");
    } else {
      if (shouldCloseOnBlur)
        commitValue();
      if (inputValue !== valueOnFocus.current)
        validation.commitValidation();
    }
    setFocusedState(isFocused2);
  };
  let displayedCollection = reactExports.useMemo(() => {
    if (triggerState.isOpen) {
      if (showAllItems)
        return originalCollection;
      else
        return filteredCollection;
    } else
      return lastCollection;
  }, [
    triggerState.isOpen,
    originalCollection,
    filteredCollection,
    showAllItems,
    lastCollection
  ]);
  return {
    ...validation,
    ...triggerState,
    focusStrategy,
    toggle: toggle2,
    open,
    close: commitValue,
    selectionManager,
    selectedKey,
    setSelectedKey,
    disabledKeys,
    isFocused,
    setFocused,
    selectedItem,
    collection: displayedCollection,
    inputValue,
    setInputValue,
    commit,
    revert: revert2
  };
}
function $a9e7382a7d111cb5$var$filterCollection(collection, inputValue, filter3) {
  return new $a02d57049d202695$export$d085fb9e920b5ca7$2($a9e7382a7d111cb5$var$filterNodes(collection, collection, inputValue, filter3));
}
function $a9e7382a7d111cb5$var$filterNodes(collection, nodes, inputValue, filter3) {
  let filteredNode = [];
  for (let node2 of nodes) {
    if (node2.type === "section" && node2.hasChildNodes) {
      let filtered = $a9e7382a7d111cb5$var$filterNodes(collection, $c5a24bc478652b5f$export$1005530eda016c13(node2, collection), inputValue, filter3);
      if ([
        ...filtered
      ].some((node3) => node3.type === "item"))
        filteredNode.push({
          ...node2,
          childNodes: filtered
        });
    } else if (node2.type === "item" && filter3(node2.textValue, inputValue))
      filteredNode.push({
        ...node2
      });
    else if (node2.type !== "item")
      filteredNode.push({
        ...node2
      });
  }
  return filteredNode;
}
const $148a7a147e38ea7f$var$RTL_SCRIPTS$4 = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS$4 = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764$4(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS$4.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS$4.has(lang2);
}
const $b5e257d569688ac6$var$defaultContext$4 = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$4 = /* @__PURE__ */ React$5.createContext($b5e257d569688ac6$var$defaultContext$4);
const $b5e257d569688ac6$var$IsSSRContext$4 = /* @__PURE__ */ React$5.createContext(false);
let $b5e257d569688ac6$var$componentIds$4 = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$4(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$4);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$4.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$4.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$4.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$4(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$4);
  let counter = $b5e257d569688ac6$var$useCounter$4(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$4(defaultId) {
  let id2 = React$5.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$4());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$4.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$5["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$4 : $b5e257d569688ac6$var$useLegacySSRSafeId$4;
function $b5e257d569688ac6$var$getSnapshot$4() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$4() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$4(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$4() {
  if (typeof React$5["useSyncExternalStore"] === "function")
    return React$5["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$4, $b5e257d569688ac6$var$getSnapshot$4, $b5e257d569688ac6$var$getServerSnapshot$4);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$4);
}
const $1e5a04cdaf7d1af8$var$localeSymbol$4 = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$4() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol$4] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764$4(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale$4 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$4();
let $1e5a04cdaf7d1af8$var$listeners$4 = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale$4() {
  $1e5a04cdaf7d1af8$var$currentLocale$4 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$4();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners$4)
    listener($1e5a04cdaf7d1af8$var$currentLocale$4);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$4() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$4();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale$4);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners$4.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$4);
    $1e5a04cdaf7d1af8$var$listeners$4.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners$4.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners$4.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$4);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext$4 = /* @__PURE__ */ React$5.createContext(null);
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$4() {
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$4();
  let context = reactExports.useContext($18f2051aff69b9bf$var$I18nContext$4);
  return context || defaultLocale;
}
let $325a3faab7a68acd$var$cache = /* @__PURE__ */ new Map();
function $325a3faab7a68acd$export$a16aca283550c30d(options) {
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$4();
  let cacheKey = locale2 + (options ? Object.entries(options).sort((a2, b2) => a2[0] < b2[0] ? -1 : 1).join() : "");
  if ($325a3faab7a68acd$var$cache.has(cacheKey))
    return $325a3faab7a68acd$var$cache.get(cacheKey);
  let formatter = new Intl.Collator(locale2, options);
  $325a3faab7a68acd$var$cache.set(cacheKey, formatter);
  return formatter;
}
function $bb77f239b46e8c72$export$3274cf84b703fff(options) {
  let collator = $325a3faab7a68acd$export$a16aca283550c30d({
    usage: "search",
    ...options
  });
  let startsWith = reactExports.useCallback((string3, substring) => {
    if (substring.length === 0)
      return true;
    string3 = string3.normalize("NFC");
    substring = substring.normalize("NFC");
    return collator.compare(string3.slice(0, substring.length), substring) === 0;
  }, [
    collator
  ]);
  let endsWith2 = reactExports.useCallback((string3, substring) => {
    if (substring.length === 0)
      return true;
    string3 = string3.normalize("NFC");
    substring = substring.normalize("NFC");
    return collator.compare(string3.slice(-substring.length), substring) === 0;
  }, [
    collator
  ]);
  let contains2 = reactExports.useCallback((string3, substring) => {
    if (substring.length === 0)
      return true;
    string3 = string3.normalize("NFC");
    substring = substring.normalize("NFC");
    let scan = 0;
    let sliceLen = substring.length;
    for (; scan + sliceLen <= string3.length; scan++) {
      let slice2 = string3.slice(scan, scan + sliceLen);
      if (collator.compare(substring, slice2) === 0)
        return true;
    }
    return false;
  }, [
    collator
  ]);
  return reactExports.useMemo(() => ({
    startsWith,
    endsWith: endsWith2,
    contains: contains2
  }), [
    startsWith,
    endsWith2,
    contains2
  ]);
}
var $02cb4c75c506befe$exports = {};
$02cb4c75c506befe$exports = {
  "buttonLabel": `عرض المقترحات`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} خيار`,
    other: () => `${formatter.number(args.optionCount)} خيارات`
  })} متاحة.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `المجموعة المدخلة ${args.groupTitle}, مع ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} خيار`,
      other: () => `${formatter.number(args.groupCount)} خيارات`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, محدد`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `مقترحات`,
  "selectedAnnouncement": (args) => `${args.optionText}، محدد`
};
var $568b8163f1e56faf$exports = {};
$568b8163f1e56faf$exports = {
  "buttonLabel": `Покажи предложения`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} опция`,
    other: () => `${formatter.number(args.optionCount)} опции`
  })} на разположение.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Въведена група ${args.groupTitle}, с ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} опция`,
      other: () => `${formatter.number(args.groupCount)} опции`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, избрани`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Предложения`,
  "selectedAnnouncement": (args) => `${args.optionText}, избрани`
};
var $87581c0202d106b8$exports = {};
$87581c0202d106b8$exports = {
  "buttonLabel": `Zobrazit doporučení`,
  "countAnnouncement": (args, formatter) => `K dispozici ${formatter.plural(args.optionCount, {
    one: () => `je ${formatter.number(args.optionCount)} možnost`,
    other: () => `jsou/je ${formatter.number(args.optionCount)} možnosti/-í`
  })}.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Zadaná skupina „${args.groupTitle}“ ${formatter.plural(args.groupCount, {
      one: () => `s ${formatter.number(args.groupCount)} možností`,
      other: () => `se ${formatter.number(args.groupCount)} možnostmi`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: ` (vybráno)`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Návrhy`,
  "selectedAnnouncement": (args) => `${args.optionText}, vybráno`
};
var $a10a0369f5433ed1$exports = {};
$a10a0369f5433ed1$exports = {
  "buttonLabel": `Vis forslag`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} mulighed tilgængelig`,
    other: () => `${formatter.number(args.optionCount)} muligheder tilgængelige`
  })}.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Angivet gruppe ${args.groupTitle}, med ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} mulighed`,
      other: () => `${formatter.number(args.groupCount)} muligheder`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, valgt`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Forslag`,
  "selectedAnnouncement": (args) => `${args.optionText}, valgt`
};
var $bfd288727d5cb166$exports = {};
$bfd288727d5cb166$exports = {
  "buttonLabel": `Empfehlungen anzeigen`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} Option`,
    other: () => `${formatter.number(args.optionCount)} Optionen`
  })} verfügbar.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Eingetretene Gruppe ${args.groupTitle}, mit ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} Option`,
      other: () => `${formatter.number(args.groupCount)} Optionen`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, ausgewählt`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Empfehlungen`,
  "selectedAnnouncement": (args) => `${args.optionText}, ausgewählt`
};
var $ca177778f9a74e3c$exports = {};
$ca177778f9a74e3c$exports = {
  "buttonLabel": `Προβολή προτάσεων`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} επιλογή`,
    other: () => `${formatter.number(args.optionCount)} επιλογές `
  })} διαθέσιμες.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Εισαγμένη ομάδα ${args.groupTitle}, με ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} επιλογή`,
      other: () => `${formatter.number(args.groupCount)} επιλογές`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, επιλεγμένο`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Προτάσεις`,
  "selectedAnnouncement": (args) => `${args.optionText}, επιλέχθηκε`
};
var $9b5aa79ef84beb6c$exports = {};
$9b5aa79ef84beb6c$exports = {
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Entered group ${args.groupTitle}, with ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} option`,
      other: () => `${formatter.number(args.groupCount)} options`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, selected`,
    other: ``
  }, args.isSelected)}`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} option`,
    other: () => `${formatter.number(args.optionCount)} options`
  })} available.`,
  "selectedAnnouncement": (args) => `${args.optionText}, selected`,
  "buttonLabel": `Show suggestions`,
  "listboxLabel": `Suggestions`
};
var $57968e8209de2557$exports = {};
$57968e8209de2557$exports = {
  "buttonLabel": `Mostrar sugerencias`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} opción`,
    other: () => `${formatter.number(args.optionCount)} opciones`
  })} disponible(s).`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Se ha unido al grupo ${args.groupTitle}, con ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} opción`,
      other: () => `${formatter.number(args.groupCount)} opciones`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, seleccionado`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Sugerencias`,
  "selectedAnnouncement": (args) => `${args.optionText}, seleccionado`
};
var $60690790bf4c1c6a$exports = {};
$60690790bf4c1c6a$exports = {
  "buttonLabel": `Kuva soovitused`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} valik`,
    other: () => `${formatter.number(args.optionCount)} valikud`
  })} saadaval.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Sisestatud rühm ${args.groupTitle}, valikuga ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} valik`,
      other: () => `${formatter.number(args.groupCount)} valikud`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, valitud`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Soovitused`,
  "selectedAnnouncement": (args) => `${args.optionText}, valitud`
};
var $1101246e8c7d9357$exports = {};
$1101246e8c7d9357$exports = {
  "buttonLabel": `Näytä ehdotukset`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} vaihtoehto`,
    other: () => `${formatter.number(args.optionCount)} vaihtoehdot`
  })} saatavilla.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Mentiin ryhmään ${args.groupTitle}, ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} vaihtoehdon`,
      other: () => `${formatter.number(args.groupCount)} vaihtoehdon`
    })} kanssa.`,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, valittu`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Ehdotukset`,
  "selectedAnnouncement": (args) => `${args.optionText}, valittu`
};
var $6404b5cb5b241730$exports = {};
$6404b5cb5b241730$exports = {
  "buttonLabel": `Afficher les suggestions`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} option`,
    other: () => `${formatter.number(args.optionCount)} options`
  })} disponible(s).`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Groupe ${args.groupTitle} rejoint, avec ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} option`,
      other: () => `${formatter.number(args.groupCount)} options`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, sélectionné(s)`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Suggestions`,
  "selectedAnnouncement": (args) => `${args.optionText}, sélectionné`
};
var $dfeafa702e92e31f$exports = {};
$dfeafa702e92e31f$exports = {
  "buttonLabel": `הצג הצעות`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `אפשרות ${formatter.number(args.optionCount)}`,
    other: () => `${formatter.number(args.optionCount)} אפשרויות`
  })} במצב זמין.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `נכנס לקבוצה ${args.groupTitle}, עם ${formatter.plural(args.groupCount, {
      one: () => `אפשרות ${formatter.number(args.groupCount)}`,
      other: () => `${formatter.number(args.groupCount)} אפשרויות`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, נבחר`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `הצעות`,
  "selectedAnnouncement": (args) => `${args.optionText}, נבחר`
};
var $2d125e0b34676352$exports = {};
$2d125e0b34676352$exports = {
  "buttonLabel": `Prikaži prijedloge`,
  "countAnnouncement": (args, formatter) => `Dostupno još: ${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} opcija`,
    other: () => `${formatter.number(args.optionCount)} opcije/a`
  })}.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Unesena skupina ${args.groupTitle}, s ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} opcijom`,
      other: () => `${formatter.number(args.groupCount)} opcije/a`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, odabranih`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Prijedlozi`,
  "selectedAnnouncement": (args) => `${args.optionText}, odabrano`
};
var $ea029611d7634059$exports = {};
$ea029611d7634059$exports = {
  "buttonLabel": `Javaslatok megjelenítése`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} lehetőség`,
    other: () => `${formatter.number(args.optionCount)} lehetőség`
  })} áll rendelkezésre.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Belépett a(z) ${args.groupTitle} csoportba, amely ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} lehetőséget`,
      other: () => `${formatter.number(args.groupCount)} lehetőséget`
    })} tartalmaz. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, kijelölve`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Javaslatok`,
  "selectedAnnouncement": (args) => `${args.optionText}, kijelölve`
};
var $77f075bb86ad7091$exports = {};
$77f075bb86ad7091$exports = {
  "buttonLabel": `Mostra suggerimenti`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} opzione disponibile`,
    other: () => `${formatter.number(args.optionCount)} opzioni disponibili`
  })}.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Ingresso nel gruppo ${args.groupTitle}, con ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} opzione`,
      other: () => `${formatter.number(args.groupCount)} opzioni`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, selezionato`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Suggerimenti`,
  "selectedAnnouncement": (args) => `${args.optionText}, selezionato`
};
var $6e87462e84907983$exports = {};
$6e87462e84907983$exports = {
  "buttonLabel": `候補を表示`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} 個のオプション`,
    other: () => `${formatter.number(args.optionCount)} 個のオプション`
  })}を利用できます。`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `入力されたグループ ${args.groupTitle}、${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} 個のオプション`,
      other: () => `${formatter.number(args.groupCount)} 個のオプション`
    })}を含む。`,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `、選択済み`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `候補`,
  "selectedAnnouncement": (args) => `${args.optionText}、選択済み`
};
var $9246f2c6edc6b232$exports = {};
$9246f2c6edc6b232$exports = {
  "buttonLabel": `제안 사항 표시`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)}개 옵션`,
    other: () => `${formatter.number(args.optionCount)}개 옵션`
  })}을 사용할 수 있습니다.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `입력한 그룹 ${args.groupTitle}, ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)}개 옵션`,
      other: () => `${formatter.number(args.groupCount)}개 옵션`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, 선택됨`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `제안`,
  "selectedAnnouncement": (args) => `${args.optionText}, 선택됨`
};
var $e587accc6c0a434c$exports = {};
$e587accc6c0a434c$exports = {
  "buttonLabel": `Rodyti pasiūlymus`,
  "countAnnouncement": (args, formatter) => `Yra ${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} parinktis`,
    other: () => `${formatter.number(args.optionCount)} parinktys (-ių)`
  })}.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Įvesta grupė ${args.groupTitle}, su ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} parinktimi`,
      other: () => `${formatter.number(args.groupCount)} parinktimis (-ių)`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, pasirinkta`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Pasiūlymai`,
  "selectedAnnouncement": (args) => `${args.optionText}, pasirinkta`
};
var $03a1900e7400b5ab$exports = {};
$03a1900e7400b5ab$exports = {
  "buttonLabel": `Rādīt ieteikumus`,
  "countAnnouncement": (args, formatter) => `Pieejamo opciju skaits: ${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} opcija`,
    other: () => `${formatter.number(args.optionCount)} opcijas`
  })}.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Ievadīta grupa ${args.groupTitle}, ar ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} opciju`,
      other: () => `${formatter.number(args.groupCount)} opcijām`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, atlasīta`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Ieteikumi`,
  "selectedAnnouncement": (args) => `${args.optionText}, atlasīta`
};
var $1387676441be6cf6$exports = {};
$1387676441be6cf6$exports = {
  "buttonLabel": `Vis forslag`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} alternativ`,
    other: () => `${formatter.number(args.optionCount)} alternativer`
  })} finnes.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Angitt gruppe ${args.groupTitle}, med ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} alternativ`,
      other: () => `${formatter.number(args.groupCount)} alternativer`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, valgt`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Forslag`,
  "selectedAnnouncement": (args) => `${args.optionText}, valgt`
};
var $17e82ebf0f8ab91f$exports = {};
$17e82ebf0f8ab91f$exports = {
  "buttonLabel": `Suggesties weergeven`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} optie`,
    other: () => `${formatter.number(args.optionCount)} opties`
  })} beschikbaar.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Groep ${args.groupTitle} ingevoerd met ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} optie`,
      other: () => `${formatter.number(args.groupCount)} opties`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, geselecteerd`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Suggesties`,
  "selectedAnnouncement": (args) => `${args.optionText}, geselecteerd`
};
var $2f5377d3471630e5$exports = {};
$2f5377d3471630e5$exports = {
  "buttonLabel": `Wyświetlaj sugestie`,
  "countAnnouncement": (args, formatter) => `dostępna/dostępne(-nych) ${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} opcja`,
    other: () => `${formatter.number(args.optionCount)} opcje(-i)`
  })}.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Dołączono do grupy ${args.groupTitle}, z ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} opcją`,
      other: () => `${formatter.number(args.groupCount)} opcjami`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, wybrano`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Sugestie`,
  "selectedAnnouncement": (args) => `${args.optionText}, wybrano`
};
var $dee9868b6fa95ffe$exports = {};
$dee9868b6fa95ffe$exports = {
  "buttonLabel": `Mostrar sugestões`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} opção`,
    other: () => `${formatter.number(args.optionCount)} opções`
  })} disponível.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Grupo inserido ${args.groupTitle}, com ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} opção`,
      other: () => `${formatter.number(args.groupCount)} opções`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, selecionado`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Sugestões`,
  "selectedAnnouncement": (args) => `${args.optionText}, selecionado`
};
var $f8b2e63637cbb5a6$exports = {};
$f8b2e63637cbb5a6$exports = {
  "buttonLabel": `Apresentar sugestões`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} opção`,
    other: () => `${formatter.number(args.optionCount)} opções`
  })} disponível.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Grupo introduzido ${args.groupTitle}, com ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} opção`,
      other: () => `${formatter.number(args.groupCount)} opções`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, selecionado`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Sugestões`,
  "selectedAnnouncement": (args) => `${args.optionText}, selecionado`
};
var $46a885db3b44ea95$exports = {};
$46a885db3b44ea95$exports = {
  "buttonLabel": `Afișare sugestii`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} opțiune`,
    other: () => `${formatter.number(args.optionCount)} opțiuni`
  })} disponibile.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Grup ${args.groupTitle} introdus, cu ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} opțiune`,
      other: () => `${formatter.number(args.groupCount)} opțiuni`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, selectat`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Sugestii`,
  "selectedAnnouncement": (args) => `${args.optionText}, selectat`
};
var $50d8a8f0afa9dee5$exports = {};
$50d8a8f0afa9dee5$exports = {
  "buttonLabel": `Показать предложения`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} параметр`,
    other: () => `${formatter.number(args.optionCount)} параметров`
  })} доступно.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Введенная группа ${args.groupTitle}, с ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} параметром`,
      other: () => `${formatter.number(args.groupCount)} параметрами`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, выбранными`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Предложения`,
  "selectedAnnouncement": (args) => `${args.optionText}, выбрано`
};
var $2867ee6173245507$exports = {};
$2867ee6173245507$exports = {
  "buttonLabel": `Zobraziť návrhy`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} možnosť`,
    other: () => `${formatter.number(args.optionCount)} možnosti/-í`
  })} k dispozícii.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Zadaná skupina ${args.groupTitle}, s ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} možnosťou`,
      other: () => `${formatter.number(args.groupCount)} možnosťami`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, vybraté`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Návrhy`,
  "selectedAnnouncement": (args) => `${args.optionText}, vybraté`
};
var $0631b65beeb09b50$exports = {};
$0631b65beeb09b50$exports = {
  "buttonLabel": `Prikaži predloge`,
  "countAnnouncement": (args, formatter) => `Na voljo je ${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} opcija`,
    other: () => `${formatter.number(args.optionCount)} opcije`
  })}.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Vnesena skupina ${args.groupTitle}, z ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} opcija`,
      other: () => `${formatter.number(args.groupCount)} opcije`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, izbrano`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Predlogi`,
  "selectedAnnouncement": (args) => `${args.optionText}, izbrano`
};
var $65fc749265dcd686$exports = {};
$65fc749265dcd686$exports = {
  "buttonLabel": `Prikaži predloge`,
  "countAnnouncement": (args, formatter) => `Dostupno još: ${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} opcija`,
    other: () => `${formatter.number(args.optionCount)} opcije/a`
  })}.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Unesena grupa ${args.groupTitle}, s ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} opcijom`,
      other: () => `${formatter.number(args.groupCount)} optione/a`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, izabranih`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Predlozi`,
  "selectedAnnouncement": (args) => `${args.optionText}, izabrano`
};
var $69ba655c7853c08e$exports = {};
$69ba655c7853c08e$exports = {
  "buttonLabel": `Visa förslag`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} alternativ`,
    other: () => `${formatter.number(args.optionCount)} alternativ`
  })} tillgängliga.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Ingick i gruppen ${args.groupTitle} med ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} alternativ`,
      other: () => `${formatter.number(args.groupCount)} alternativ`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, valda`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Förslag`,
  "selectedAnnouncement": (args) => `${args.optionText}, valda`
};
var $a79794784d61577c$exports = {};
$a79794784d61577c$exports = {
  "buttonLabel": `Önerileri göster`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} seçenek`,
    other: () => `${formatter.number(args.optionCount)} seçenekler`
  })} kullanılabilir.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Girilen grup ${args.groupTitle}, ile ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} seçenek`,
      other: () => `${formatter.number(args.groupCount)} seçenekler`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, seçildi`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Öneriler`,
  "selectedAnnouncement": (args) => `${args.optionText}, seçildi`
};
var $c2845791417ebaf4$exports = {};
$c2845791417ebaf4$exports = {
  "buttonLabel": `Показати пропозиції`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} параметр`,
    other: () => `${formatter.number(args.optionCount)} параметри(-ів)`
  })} доступно.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Введена група ${args.groupTitle}, з ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} параметр`,
      other: () => `${formatter.number(args.groupCount)} параметри(-ів)`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, вибрано`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Пропозиції`,
  "selectedAnnouncement": (args) => `${args.optionText}, вибрано`
};
var $29b642d0025cc7a4$exports = {};
$29b642d0025cc7a4$exports = {
  "buttonLabel": `显示建议`,
  "countAnnouncement": (args, formatter) => `有 ${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} 个选项`,
    other: () => `${formatter.number(args.optionCount)} 个选项`
  })}可用。`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `进入了 ${args.groupTitle} 组，其中有 ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} 个选项`,
      other: () => `${formatter.number(args.groupCount)} 个选项`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, 已选择`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `建议`,
  "selectedAnnouncement": (args) => `${args.optionText}, 已选择`
};
var $cd36dd33f9d46936$exports = {};
$cd36dd33f9d46936$exports = {
  "buttonLabel": `顯示建議`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} 選項`,
    other: () => `${formatter.number(args.optionCount)} 選項`
  })} 可用。`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `輸入的群組 ${args.groupTitle}, 有 ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} 選項`,
      other: () => `${formatter.number(args.groupCount)} 選項`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, 已選取`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `建議`,
  "selectedAnnouncement": (args) => `${args.optionText}, 已選取`
};
var $de5926a92e8ebc5b$exports = {};
$de5926a92e8ebc5b$exports = {
  "ar-AE": $02cb4c75c506befe$exports,
  "bg-BG": $568b8163f1e56faf$exports,
  "cs-CZ": $87581c0202d106b8$exports,
  "da-DK": $a10a0369f5433ed1$exports,
  "de-DE": $bfd288727d5cb166$exports,
  "el-GR": $ca177778f9a74e3c$exports,
  "en-US": $9b5aa79ef84beb6c$exports,
  "es-ES": $57968e8209de2557$exports,
  "et-EE": $60690790bf4c1c6a$exports,
  "fi-FI": $1101246e8c7d9357$exports,
  "fr-FR": $6404b5cb5b241730$exports,
  "he-IL": $dfeafa702e92e31f$exports,
  "hr-HR": $2d125e0b34676352$exports,
  "hu-HU": $ea029611d7634059$exports,
  "it-IT": $77f075bb86ad7091$exports,
  "ja-JP": $6e87462e84907983$exports,
  "ko-KR": $9246f2c6edc6b232$exports,
  "lt-LT": $e587accc6c0a434c$exports,
  "lv-LV": $03a1900e7400b5ab$exports,
  "nb-NO": $1387676441be6cf6$exports,
  "nl-NL": $17e82ebf0f8ab91f$exports,
  "pl-PL": $2f5377d3471630e5$exports,
  "pt-BR": $dee9868b6fa95ffe$exports,
  "pt-PT": $f8b2e63637cbb5a6$exports,
  "ro-RO": $46a885db3b44ea95$exports,
  "ru-RU": $50d8a8f0afa9dee5$exports,
  "sk-SK": $2867ee6173245507$exports,
  "sl-SI": $0631b65beeb09b50$exports,
  "sr-SP": $65fc749265dcd686$exports,
  "sv-SE": $69ba655c7853c08e$exports,
  "tr-TR": $a79794784d61577c$exports,
  "uk-UA": $c2845791417ebaf4$exports,
  "zh-CN": $29b642d0025cc7a4$exports,
  "zh-TW": $cd36dd33f9d46936$exports
};
const $dd149f63282afbbf$export$f6211563215e3b37 = /* @__PURE__ */ new WeakMap();
function $55f9b1ae81f22853$export$2b35b76d2e30e129(to2, from2) {
  to2.dispatchEvent(new FocusEvent("focus", {
    relatedTarget: from2
  }));
  to2.dispatchEvent(new FocusEvent("focusin", {
    bubbles: true,
    relatedTarget: from2
  }));
}
function $628037886ba31236$export$f9d5c8beee7d008d(props, state, ref) {
  let { type: type4 } = props;
  let { isOpen } = state;
  reactExports.useEffect(() => {
    if (ref && ref.current)
      $dd149f63282afbbf$export$f6211563215e3b37.set(ref.current, state.close);
  });
  let ariaHasPopup = void 0;
  if (type4 === "menu")
    ariaHasPopup = true;
  else if (type4 === "listbox")
    ariaHasPopup = "listbox";
  let overlayId = $bdb11010cef70236$export$f680877a34711e37$2();
  return {
    triggerProps: {
      "aria-haspopup": ariaHasPopup,
      "aria-expanded": isOpen,
      "aria-controls": isOpen ? overlayId : void 0,
      onPress: state.toggle
    },
    overlayProps: {
      id: overlayId
    }
  };
}
const $5e3802645cc19319$var$supportsInert = typeof HTMLElement !== "undefined" && "inert" in HTMLElement.prototype;
let $5e3802645cc19319$var$refCountMap = /* @__PURE__ */ new WeakMap();
let $5e3802645cc19319$var$observerStack = [];
function $5e3802645cc19319$export$1c3ebcada18427bf(targets, options) {
  let windowObj = $431fbd86ca7dc216$export$f21a1ffae260145a$4(targets === null || targets === void 0 ? void 0 : targets[0]);
  let opts2 = options instanceof windowObj.Element ? {
    root: options
  } : options;
  var _opts_root;
  let root2 = (_opts_root = opts2 === null || opts2 === void 0 ? void 0 : opts2.root) !== null && _opts_root !== void 0 ? _opts_root : document.body;
  let shouldUseInert = (opts2 === null || opts2 === void 0 ? void 0 : opts2.shouldUseInert) && $5e3802645cc19319$var$supportsInert;
  let visibleNodes = new Set(targets);
  let hiddenNodes = /* @__PURE__ */ new Set();
  let getHidden = (element2) => {
    return shouldUseInert && element2 instanceof windowObj.HTMLElement ? element2.inert : element2.getAttribute("aria-hidden") === "true";
  };
  let setHidden = (element2, hidden) => {
    if (shouldUseInert && element2 instanceof windowObj.HTMLElement)
      element2.inert = hidden;
    else if (hidden)
      element2.setAttribute("aria-hidden", "true");
    else
      element2.removeAttribute("aria-hidden");
  };
  let walk = (root3) => {
    for (let element2 of root3.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))
      visibleNodes.add(element2);
    let acceptNode = (node2) => {
      if (hiddenNodes.has(node2) || visibleNodes.has(node2) || node2.parentElement && hiddenNodes.has(node2.parentElement) && node2.parentElement.getAttribute("role") !== "row")
        return NodeFilter.FILTER_REJECT;
      for (let target of visibleNodes) {
        if (node2.contains(target))
          return NodeFilter.FILTER_SKIP;
      }
      return NodeFilter.FILTER_ACCEPT;
    };
    let walker = document.createTreeWalker(root3, NodeFilter.SHOW_ELEMENT, {
      acceptNode
    });
    let acceptRoot = acceptNode(root3);
    if (acceptRoot === NodeFilter.FILTER_ACCEPT)
      hide(root3);
    if (acceptRoot !== NodeFilter.FILTER_REJECT) {
      let node2 = walker.nextNode();
      while (node2 != null) {
        hide(node2);
        node2 = walker.nextNode();
      }
    }
  };
  let hide = (node2) => {
    var _refCountMap_get;
    let refCount = (_refCountMap_get = $5e3802645cc19319$var$refCountMap.get(node2)) !== null && _refCountMap_get !== void 0 ? _refCountMap_get : 0;
    if (getHidden(node2) && refCount === 0)
      return;
    if (refCount === 0)
      setHidden(node2, true);
    hiddenNodes.add(node2);
    $5e3802645cc19319$var$refCountMap.set(node2, refCount + 1);
  };
  if ($5e3802645cc19319$var$observerStack.length)
    $5e3802645cc19319$var$observerStack[$5e3802645cc19319$var$observerStack.length - 1].disconnect();
  walk(root2);
  let observer = new MutationObserver((changes) => {
    for (let change of changes) {
      if (change.type !== "childList")
        continue;
      if (![
        ...visibleNodes,
        ...hiddenNodes
      ].some((node2) => node2.contains(change.target)))
        for (let node2 of change.addedNodes) {
          if ((node2 instanceof HTMLElement || node2 instanceof SVGElement) && (node2.dataset.liveAnnouncer === "true" || node2.dataset.reactAriaTopLayer === "true"))
            visibleNodes.add(node2);
          else if (node2 instanceof Element)
            walk(node2);
        }
    }
  });
  observer.observe(root2, {
    childList: true,
    subtree: true
  });
  let observerWrapper = {
    visibleNodes,
    hiddenNodes,
    observe() {
      observer.observe(root2, {
        childList: true,
        subtree: true
      });
    },
    disconnect() {
      observer.disconnect();
    }
  };
  $5e3802645cc19319$var$observerStack.push(observerWrapper);
  return () => {
    observer.disconnect();
    for (let node2 of hiddenNodes) {
      let count = $5e3802645cc19319$var$refCountMap.get(node2);
      if (count == null)
        continue;
      if (count === 1) {
        setHidden(node2, false);
        $5e3802645cc19319$var$refCountMap.delete(node2);
      } else
        $5e3802645cc19319$var$refCountMap.set(node2, count - 1);
    }
    if (observerWrapper === $5e3802645cc19319$var$observerStack[$5e3802645cc19319$var$observerStack.length - 1]) {
      $5e3802645cc19319$var$observerStack.pop();
      if ($5e3802645cc19319$var$observerStack.length)
        $5e3802645cc19319$var$observerStack[$5e3802645cc19319$var$observerStack.length - 1].observe();
    } else
      $5e3802645cc19319$var$observerStack.splice($5e3802645cc19319$var$observerStack.indexOf(observerWrapper), 1);
  };
}
const $b1f0cad8af73213b$export$3585ede4d035bf14 = /* @__PURE__ */ new WeakMap();
function $b1f0cad8af73213b$var$normalizeKey(key) {
  if (typeof key === "string")
    return key.replace(/\s*/g, "");
  return "" + key;
}
function $b1f0cad8af73213b$export$9145995848b05025(state, itemKey2) {
  let data = $b1f0cad8af73213b$export$3585ede4d035bf14.get(state);
  if (!data)
    throw new Error("Unknown list");
  return `${data.id}-option-${$b1f0cad8af73213b$var$normalizeKey(itemKey2)}`;
}
var $c0398ad35c3639b7$exports = {};
$c0398ad35c3639b7$exports = {
  "longPressMessage": `اضغط مطولاً أو اضغط على Alt + السهم لأسفل لفتح القائمة`
};
var $7af657c4165927c3$exports = {};
$7af657c4165927c3$exports = {
  "longPressMessage": `Натиснете продължително или натиснете Alt+ стрелка надолу, за да отворите менюто`
};
var $d95d4da6d531ab81$exports = {};
$d95d4da6d531ab81$exports = {
  "longPressMessage": `Dlouhým stiskem nebo stisknutím kláves Alt + šipka dolů otevřete nabídku`
};
var $24ebda9c775dca17$exports = {};
$24ebda9c775dca17$exports = {
  "longPressMessage": `Langt tryk eller tryk på Alt + pil ned for at åbne menuen`
};
var $743e0dfca6cab1e9$exports = {};
$743e0dfca6cab1e9$exports = {
  "longPressMessage": `Drücken Sie lange oder drücken Sie Alt + Nach-unten, um das Menü zu öffnen`
};
var $a2f41026e05f1c84$exports = {};
$a2f41026e05f1c84$exports = {
  "longPressMessage": `Πιέστε παρατεταμένα ή πατήστε Alt + κάτω βέλος για να ανοίξετε το μενού`
};
var $43b800e97c901737$exports = {};
$43b800e97c901737$exports = {
  "longPressMessage": `Long press or press Alt + ArrowDown to open menu`
};
var $442f5f6ac211e29f$exports = {};
$442f5f6ac211e29f$exports = {
  "longPressMessage": `Mantenga pulsado o pulse Alt + flecha abajo para abrir el menú`
};
var $dff280acfeb2d8ac$exports = {};
$dff280acfeb2d8ac$exports = {
  "longPressMessage": `Menüü avamiseks vajutage pikalt või vajutage klahve Alt + allanool`
};
var $51608325613944d7$exports = {};
$51608325613944d7$exports = {
  "longPressMessage": `Avaa valikko painamalla pohjassa tai näppäinyhdistelmällä Alt + Alanuoli`
};
var $c4a1b1eabeaa87be$exports = {};
$c4a1b1eabeaa87be$exports = {
  "longPressMessage": `Appuyez de manière prolongée ou appuyez sur Alt + Flèche vers le bas pour ouvrir le menu.`
};
var $8c74815cdee18d1b$exports = {};
$8c74815cdee18d1b$exports = {
  "longPressMessage": `לחץ לחיצה ארוכה או הקש Alt + ArrowDown כדי לפתוח את התפריט`
};
var $fd0e9ef6a7fe0ec9$exports = {};
$fd0e9ef6a7fe0ec9$exports = {
  "longPressMessage": `Dugo pritisnite ili pritisnite Alt + strelicu prema dolje za otvaranje izbornika`
};
var $a89a74a39eba465a$exports = {};
$a89a74a39eba465a$exports = {
  "longPressMessage": `Nyomja meg hosszan, vagy nyomja meg az Alt + lefele nyíl gombot a menü megnyitásához`
};
var $edc7c66594a0ae8a$exports = {};
$edc7c66594a0ae8a$exports = {
  "longPressMessage": `Premere a lungo o premere Alt + Freccia giù per aprire il menu`
};
var $f1ab51510712db52$exports = {};
$f1ab51510712db52$exports = {
  "longPressMessage": `長押しまたは Alt+下矢印キーでメニューを開く`
};
var $f9b672d9b82fa3d6$exports = {};
$f9b672d9b82fa3d6$exports = {
  "longPressMessage": `길게 누르거나 Alt + 아래쪽 화살표를 눌러 메뉴 열기`
};
var $a385f3910feda499$exports = {};
$a385f3910feda499$exports = {
  "longPressMessage": `Norėdami atidaryti meniu, nuspaudę palaikykite arba paspauskite „Alt + ArrowDown“.`
};
var $4f1bde932c441789$exports = {};
$4f1bde932c441789$exports = {
  "longPressMessage": `Lai atvērtu izvēlni, turiet nospiestu vai nospiediet taustiņu kombināciju Alt + lejupvērstā bultiņa`
};
var $914a51a8a594d5be$exports = {};
$914a51a8a594d5be$exports = {
  "longPressMessage": `Langt trykk eller trykk Alt + PilNed for å åpne menyen`
};
var $89aaf803103bb500$exports = {};
$89aaf803103bb500$exports = {
  "longPressMessage": `Druk lang op Alt + pijl-omlaag of druk op Alt om het menu te openen`
};
var $c685891476dbaaca$exports = {};
$c685891476dbaaca$exports = {
  "longPressMessage": `Naciśnij i przytrzymaj lub naciśnij klawisze Alt + Strzałka w dół, aby otworzyć menu`
};
var $885879b9b10c2959$exports = {};
$885879b9b10c2959$exports = {
  "longPressMessage": `Pressione e segure ou pressione Alt + Seta para baixo para abrir o menu`
};
var $6b39616688a51692$exports = {};
$6b39616688a51692$exports = {
  "longPressMessage": `Prima continuamente ou prima Alt + Seta Para Baixo para abrir o menu`
};
var $f26362aed63f47e2$exports = {};
$f26362aed63f47e2$exports = {
  "longPressMessage": `Apăsați lung sau apăsați pe Alt + săgeată în jos pentru a deschide meniul`
};
var $06cbade644558bf0$exports = {};
$06cbade644558bf0$exports = {
  "longPressMessage": `Нажмите и удерживайте или нажмите Alt + Стрелка вниз, чтобы открыть меню`
};
var $0a391ff68f9d59b1$exports = {};
$0a391ff68f9d59b1$exports = {
  "longPressMessage": `Ponuku otvoríte dlhým stlačením alebo stlačením klávesu Alt + klávesu so šípkou nadol`
};
var $8193cf0e649c7928$exports = {};
$8193cf0e649c7928$exports = {
  "longPressMessage": `Za odprtje menija pritisnite in držite gumb ali pritisnite Alt+puščica navzdol`
};
var $f398debcce5a5c55$exports = {};
$f398debcce5a5c55$exports = {
  "longPressMessage": `Dugo pritisnite ili pritisnite Alt + strelicu prema dole da otvorite meni`
};
var $9e9fef000aa4c013$exports = {};
$9e9fef000aa4c013$exports = {
  "longPressMessage": `Håll nedtryckt eller tryck på Alt + pil nedåt för att öppna menyn`
};
var $c016c8183bbe3d68$exports = {};
$c016c8183bbe3d68$exports = {
  "longPressMessage": `Menüyü açmak için uzun basın veya Alt + Aşağı Ok tuşuna basın`
};
var $ca4f6c8462244e62$exports = {};
$ca4f6c8462244e62$exports = {
  "longPressMessage": `Довго або звичайно натисніть комбінацію клавіш Alt і стрілка вниз, щоб відкрити меню`
};
var $2d9960c02ccac927$exports = {};
$2d9960c02ccac927$exports = {
  "longPressMessage": `长按或按 Alt + 向下方向键以打开菜单`
};
var $f1b682a4c8c5631c$exports = {};
$f1b682a4c8c5631c$exports = {
  "longPressMessage": `長按或按 Alt+向下鍵以開啟功能表`
};
var $2cbb7ca666678a14$exports = {};
$2cbb7ca666678a14$exports = {
  "ar-AE": $c0398ad35c3639b7$exports,
  "bg-BG": $7af657c4165927c3$exports,
  "cs-CZ": $d95d4da6d531ab81$exports,
  "da-DK": $24ebda9c775dca17$exports,
  "de-DE": $743e0dfca6cab1e9$exports,
  "el-GR": $a2f41026e05f1c84$exports,
  "en-US": $43b800e97c901737$exports,
  "es-ES": $442f5f6ac211e29f$exports,
  "et-EE": $dff280acfeb2d8ac$exports,
  "fi-FI": $51608325613944d7$exports,
  "fr-FR": $c4a1b1eabeaa87be$exports,
  "he-IL": $8c74815cdee18d1b$exports,
  "hr-HR": $fd0e9ef6a7fe0ec9$exports,
  "hu-HU": $a89a74a39eba465a$exports,
  "it-IT": $edc7c66594a0ae8a$exports,
  "ja-JP": $f1ab51510712db52$exports,
  "ko-KR": $f9b672d9b82fa3d6$exports,
  "lt-LT": $a385f3910feda499$exports,
  "lv-LV": $4f1bde932c441789$exports,
  "nb-NO": $914a51a8a594d5be$exports,
  "nl-NL": $89aaf803103bb500$exports,
  "pl-PL": $c685891476dbaaca$exports,
  "pt-BR": $885879b9b10c2959$exports,
  "pt-PT": $6b39616688a51692$exports,
  "ro-RO": $f26362aed63f47e2$exports,
  "ru-RU": $06cbade644558bf0$exports,
  "sk-SK": $0a391ff68f9d59b1$exports,
  "sl-SI": $8193cf0e649c7928$exports,
  "sr-SP": $f398debcce5a5c55$exports,
  "sv-SE": $9e9fef000aa4c013$exports,
  "tr-TR": $c016c8183bbe3d68$exports,
  "uk-UA": $ca4f6c8462244e62$exports,
  "zh-CN": $2d9960c02ccac927$exports,
  "zh-TW": $f1b682a4c8c5631c$exports
};
function $parcel$interopDefault$c(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $168583247155ddda$export$dc9c12ed27dd1b49(props, state, ref) {
  let { type: type4 = "menu", isDisabled, trigger = "press" } = props;
  let menuTriggerId = $bdb11010cef70236$export$f680877a34711e37$2();
  let { triggerProps, overlayProps } = $628037886ba31236$export$f9d5c8beee7d008d({
    type: type4
  }, state, ref);
  let onKeyDown = (e2) => {
    if (isDisabled)
      return;
    if (trigger === "longPress" && !e2.altKey)
      return;
    if (ref && ref.current)
      switch (e2.key) {
        case "Enter":
        case " ":
          if (trigger === "longPress" || e2.isDefaultPrevented())
            return;
        case "ArrowDown":
          if (!("continuePropagation" in e2))
            e2.stopPropagation();
          e2.preventDefault();
          state.toggle("first");
          break;
        case "ArrowUp":
          if (!("continuePropagation" in e2))
            e2.stopPropagation();
          e2.preventDefault();
          state.toggle("last");
          break;
        default:
          if ("continuePropagation" in e2)
            e2.continuePropagation();
      }
  };
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$c($2cbb7ca666678a14$exports), "@react-aria/menu");
  let { longPressProps } = $8a26561d2877236e$export$c24ed0104d07eab9({
    isDisabled: isDisabled || trigger !== "longPress",
    accessibilityDescription: stringFormatter.format("longPressMessage"),
    onLongPressStart() {
      state.close();
    },
    onLongPress() {
      state.open("first");
    }
  });
  let pressProps = {
    preventFocusOnPress: true,
    onPressStart(e2) {
      if (e2.pointerType !== "touch" && e2.pointerType !== "keyboard" && !isDisabled) {
        $7215afc6de606d6b$export$de79e2c695e052f3$5(e2.target);
        state.open(e2.pointerType === "virtual" ? "first" : null);
      }
    },
    onPress(e2) {
      if (e2.pointerType === "touch" && !isDisabled) {
        $7215afc6de606d6b$export$de79e2c695e052f3$5(e2.target);
        state.toggle();
      }
    }
  };
  delete triggerProps.onPress;
  return {
    // @ts-ignore - TODO we pass out both DOMAttributes AND AriaButtonProps, but useButton will discard the longPress event handlers, it's only through PressResponder magic that this works for RSP and RAC. it does not work in aria examples
    menuTriggerProps: {
      ...triggerProps,
      ...trigger === "press" ? pressProps : longPressProps,
      id: menuTriggerId,
      onKeyDown
    },
    menuProps: {
      ...overlayProps,
      "aria-labelledby": menuTriggerId,
      autoFocus: state.focusStrategy || true,
      onClose: state.close
    }
  };
}
function $2d73ec29415bd339$export$712718f7aec83d5(props, ref) {
  let { inputElementType = "input", isDisabled = false, isRequired = false, isReadOnly = false, type: type4 = "text", validationBehavior = "aria" } = props;
  let [value2, setValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.value, props.defaultValue || "", props.onChange);
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2(props, ref);
  let validationState = $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1({
    ...props,
    value: value2
  });
  let { isInvalid, validationErrors, validationDetails } = validationState.displayValidation;
  let { labelProps, fieldProps, descriptionProps, errorMessageProps } = $2baaea4c71418dea$export$294aa081a6c6f55d$1({
    ...props,
    isInvalid,
    errorMessage: props.errorMessage || validationErrors
  });
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  const inputOnlyProps = {
    type: type4,
    pattern: props.pattern
  };
  let [initialValue] = reactExports.useState(value2);
  var _props_defaultValue;
  $99facab73266f662$export$5add1d006293d136(ref, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : initialValue, setValue);
  $e93e671b31057976$export$b8473d3665f3a75a$1(props, validationState, ref);
  reactExports.useEffect(() => {
    if (ref.current instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(ref.current).HTMLTextAreaElement) {
      let input2 = ref.current;
      Object.defineProperty(input2, "defaultValue", {
        get: () => input2.value,
        set: () => {
        },
        configurable: true
      });
    }
  }, [
    ref
  ]);
  return {
    labelProps,
    inputProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, inputElementType === "input" ? inputOnlyProps : void 0, {
      disabled: isDisabled,
      readOnly: isReadOnly,
      required: isRequired && validationBehavior === "native",
      "aria-required": isRequired && validationBehavior === "aria" || void 0,
      "aria-invalid": isInvalid || void 0,
      "aria-errormessage": props["aria-errormessage"],
      "aria-activedescendant": props["aria-activedescendant"],
      "aria-autocomplete": props["aria-autocomplete"],
      "aria-haspopup": props["aria-haspopup"],
      "aria-controls": props["aria-controls"],
      value: value2,
      onChange: (e2) => setValue(e2.target.value),
      autoComplete: props.autoComplete,
      autoCapitalize: props.autoCapitalize,
      maxLength: props.maxLength,
      minLength: props.minLength,
      name: props.name,
      form: props.form,
      placeholder: props.placeholder,
      inputMode: props.inputMode,
      autoCorrect: props.autoCorrect,
      spellCheck: props.spellCheck,
      [parseInt(React$5.version, 10) >= 17 ? "enterKeyHint" : "enterkeyhint"]: props.enterKeyHint,
      // Clipboard events
      onCopy: props.onCopy,
      onCut: props.onCut,
      onPaste: props.onPaste,
      // Composition events
      onCompositionEnd: props.onCompositionEnd,
      onCompositionStart: props.onCompositionStart,
      onCompositionUpdate: props.onCompositionUpdate,
      // Selection events
      onSelect: props.onSelect,
      // Input events
      onBeforeInput: props.onBeforeInput,
      onInput: props.onInput,
      ...focusableProps,
      ...fieldProps
    }),
    descriptionProps,
    errorMessageProps,
    isInvalid,
    validationErrors,
    validationDetails
  };
}
function $d841c8010a73d545$var$supportsNativeBeforeInputEvent() {
  return typeof window !== "undefined" && window.InputEvent && typeof InputEvent.prototype.getTargetRanges === "function";
}
function $d841c8010a73d545$export$4f384c9210e583c3(props, state, inputRef) {
  let onBeforeInputFallback = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    let input2 = inputRef.current;
    if (!input2)
      return;
    let nextValue = null;
    switch (e2.inputType) {
      case "historyUndo":
      case "historyRedo":
        return;
      case "insertLineBreak":
        return;
      case "deleteContent":
      case "deleteByCut":
      case "deleteByDrag":
        nextValue = input2.value.slice(0, input2.selectionStart) + input2.value.slice(input2.selectionEnd);
        break;
      case "deleteContentForward":
        nextValue = input2.selectionEnd === input2.selectionStart ? input2.value.slice(0, input2.selectionStart) + input2.value.slice(input2.selectionEnd + 1) : input2.value.slice(0, input2.selectionStart) + input2.value.slice(input2.selectionEnd);
        break;
      case "deleteContentBackward":
        nextValue = input2.selectionEnd === input2.selectionStart ? input2.value.slice(0, input2.selectionStart - 1) + input2.value.slice(input2.selectionStart) : input2.value.slice(0, input2.selectionStart) + input2.value.slice(input2.selectionEnd);
        break;
      case "deleteSoftLineBackward":
      case "deleteHardLineBackward":
        nextValue = input2.value.slice(input2.selectionStart);
        break;
      default:
        if (e2.data != null)
          nextValue = input2.value.slice(0, input2.selectionStart) + e2.data + input2.value.slice(input2.selectionEnd);
        break;
    }
    if (nextValue == null || !state.validate(nextValue))
      e2.preventDefault();
  });
  reactExports.useEffect(() => {
    if (!$d841c8010a73d545$var$supportsNativeBeforeInputEvent() || !inputRef.current)
      return;
    let input2 = inputRef.current;
    input2.addEventListener("beforeinput", onBeforeInputFallback, false);
    return () => {
      input2.removeEventListener("beforeinput", onBeforeInputFallback, false);
    };
  }, [
    inputRef,
    onBeforeInputFallback
  ]);
  let onBeforeInput = !$d841c8010a73d545$var$supportsNativeBeforeInputEvent() ? (e2) => {
    let nextValue = e2.target.value.slice(0, e2.target.selectionStart) + e2.data + e2.target.value.slice(e2.target.selectionEnd);
    if (!state.validate(nextValue))
      e2.preventDefault();
  } : null;
  let { labelProps, inputProps: textFieldProps, descriptionProps, errorMessageProps, ...validation } = $2d73ec29415bd339$export$712718f7aec83d5(props, inputRef);
  let compositionStartState = reactExports.useRef(null);
  return {
    inputProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(textFieldProps, {
      onBeforeInput,
      onCompositionStart() {
        let { value: value2, selectionStart, selectionEnd } = inputRef.current;
        compositionStartState.current = {
          value: value2,
          selectionStart,
          selectionEnd
        };
      },
      onCompositionEnd() {
        if (inputRef.current && !state.validate(inputRef.current.value)) {
          let { value: value2, selectionStart, selectionEnd } = compositionStartState.current;
          inputRef.current.value = value2;
          inputRef.current.setSelectionRange(selectionStart, selectionEnd);
          state.setInputValue(value2);
        }
      }
    }),
    labelProps,
    descriptionProps,
    errorMessageProps,
    ...validation
  };
}
function $parcel$interopDefault$b(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $c350ade66beef0af$export$8c18d1b4f7232bbf(props, state) {
  let { buttonRef, popoverRef, inputRef, listBoxRef, keyboardDelegate, layoutDelegate, shouldFocusWrap, isReadOnly, isDisabled } = props;
  let backupBtnRef = reactExports.useRef(null);
  buttonRef = buttonRef !== null && buttonRef !== void 0 ? buttonRef : backupBtnRef;
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$b($de5926a92e8ebc5b$exports), "@react-aria/combobox");
  let { menuTriggerProps, menuProps } = $168583247155ddda$export$dc9c12ed27dd1b49({
    type: "listbox",
    isDisabled: isDisabled || isReadOnly
  }, state, buttonRef);
  $b1f0cad8af73213b$export$3585ede4d035bf14.set(state, {
    id: menuProps.id
  });
  let { collection } = state;
  let { disabledKeys } = state.selectionManager;
  let delegate = reactExports.useMemo(() => keyboardDelegate || new $2a25aae57d74318e$export$a05409b8bb224a5a$1({
    collection,
    disabledKeys,
    ref: listBoxRef,
    layoutDelegate
  }), [
    keyboardDelegate,
    layoutDelegate,
    collection,
    disabledKeys,
    listBoxRef
  ]);
  let { collectionProps } = $ae20dd8cbca75726$export$d6daf82dcd84e87c({
    selectionManager: state.selectionManager,
    keyboardDelegate: delegate,
    disallowTypeAhead: true,
    disallowEmptySelection: true,
    shouldFocusWrap,
    ref: inputRef,
    // Prevent item scroll behavior from being applied here, should be handled in the user's Popover + ListBox component
    isVirtualized: true
  });
  let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572$2();
  let onKeyDown = (e2) => {
    if (e2.nativeEvent.isComposing)
      return;
    switch (e2.key) {
      case "Enter":
      case "Tab":
        if (state.isOpen && e2.key === "Enter")
          e2.preventDefault();
        if (state.isOpen && listBoxRef.current && state.selectionManager.focusedKey != null && state.selectionManager.isLink(state.selectionManager.focusedKey)) {
          let item = listBoxRef.current.querySelector(`[data-key="${CSS.escape(state.selectionManager.focusedKey.toString())}"]`);
          if (e2.key === "Enter" && item instanceof HTMLAnchorElement) {
            let collectionItem = state.collection.getItem(state.selectionManager.focusedKey);
            if (collectionItem)
              router.open(item, e2, collectionItem.props.href, collectionItem.props.routerOptions);
          }
          state.close();
        } else
          state.commit();
        break;
      case "Escape":
        if (state.selectedKey !== null || state.inputValue === "" || props.allowsCustomValue)
          e2.continuePropagation();
        state.revert();
        break;
      case "ArrowDown":
        state.open("first", "manual");
        break;
      case "ArrowUp":
        state.open("last", "manual");
        break;
      case "ArrowLeft":
      case "ArrowRight":
        state.selectionManager.setFocusedKey(null);
        break;
    }
  };
  let onBlur = (e2) => {
    var _popoverRef_current;
    let blurFromButton = (buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current) && buttonRef.current === e2.relatedTarget;
    let blurIntoPopover = (_popoverRef_current = popoverRef.current) === null || _popoverRef_current === void 0 ? void 0 : _popoverRef_current.contains(e2.relatedTarget);
    if (blurFromButton || blurIntoPopover)
      return;
    if (props.onBlur)
      props.onBlur(e2);
    state.setFocused(false);
  };
  let onFocus = (e2) => {
    if (state.isFocused)
      return;
    if (props.onFocus)
      props.onFocus(e2);
    state.setFocused(true);
  };
  let { isInvalid, validationErrors, validationDetails } = state.displayValidation;
  let { labelProps, inputProps, descriptionProps, errorMessageProps } = $2d73ec29415bd339$export$712718f7aec83d5({
    ...props,
    onChange: state.setInputValue,
    onKeyDown: !isReadOnly ? $ff5963eb1fccf552$export$e08e3b67e392101e$9(state.isOpen && collectionProps.onKeyDown, onKeyDown, props.onKeyDown) : props.onKeyDown,
    onBlur,
    value: state.inputValue,
    onFocus,
    autoComplete: "off",
    validate: void 0,
    [$e5be200c675c3b3a$export$a763b9476acd3eb$1]: state
  }, inputRef);
  let onPress = (e2) => {
    if (e2.pointerType === "touch") {
      var _inputRef_current;
      (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
      state.toggle(null, "manual");
    }
  };
  let onPressStart = (e2) => {
    if (e2.pointerType !== "touch") {
      var _inputRef_current;
      (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
      state.toggle(e2.pointerType === "keyboard" || e2.pointerType === "virtual" ? "first" : null, "manual");
    }
  };
  let triggerLabelProps = $313b98861ee5dd6c$export$d6875122194c7b44$1({
    id: menuTriggerProps.id,
    "aria-label": stringFormatter.format("buttonLabel"),
    "aria-labelledby": props["aria-labelledby"] || labelProps.id
  });
  let listBoxProps = $313b98861ee5dd6c$export$d6875122194c7b44$1({
    id: menuProps.id,
    "aria-label": stringFormatter.format("listboxLabel"),
    "aria-labelledby": props["aria-labelledby"] || labelProps.id
  });
  let lastEventTime = reactExports.useRef(0);
  let onTouchEnd = (e2) => {
    if (isDisabled || isReadOnly)
      return;
    if (e2.timeStamp - lastEventTime.current < 500) {
      var _inputRef_current;
      e2.preventDefault();
      (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
      return;
    }
    let rect = e2.target.getBoundingClientRect();
    let touch = e2.changedTouches[0];
    let centerX = Math.ceil(rect.left + 0.5 * rect.width);
    let centerY = Math.ceil(rect.top + 0.5 * rect.height);
    if (touch.clientX === centerX && touch.clientY === centerY) {
      var _inputRef_current1;
      e2.preventDefault();
      (_inputRef_current1 = inputRef.current) === null || _inputRef_current1 === void 0 ? void 0 : _inputRef_current1.focus();
      state.toggle(null, "manual");
      lastEventTime.current = e2.timeStamp;
    }
  };
  let focusedItem = state.selectionManager.focusedKey != null && state.isOpen ? state.collection.getItem(state.selectionManager.focusedKey) : void 0;
  var _focusedItem_parentKey;
  let sectionKey = (_focusedItem_parentKey = focusedItem === null || focusedItem === void 0 ? void 0 : focusedItem.parentKey) !== null && _focusedItem_parentKey !== void 0 ? _focusedItem_parentKey : null;
  var _state_selectionManager_focusedKey;
  let itemKey2 = (_state_selectionManager_focusedKey = state.selectionManager.focusedKey) !== null && _state_selectionManager_focusedKey !== void 0 ? _state_selectionManager_focusedKey : null;
  let lastSection = reactExports.useRef(sectionKey);
  let lastItem = reactExports.useRef(itemKey2);
  reactExports.useEffect(() => {
    if ($c87311424ea30a05$export$e1865c3bedcd822b() && focusedItem != null && itemKey2 != null && itemKey2 !== lastItem.current) {
      let isSelected = state.selectionManager.isSelected(itemKey2);
      let section = sectionKey != null ? state.collection.getItem(sectionKey) : null;
      let sectionTitle = (section === null || section === void 0 ? void 0 : section["aria-label"]) || (typeof (section === null || section === void 0 ? void 0 : section.rendered) === "string" ? section.rendered : "") || "";
      var _ref;
      let announcement = stringFormatter.format("focusAnnouncement", {
        isGroupChange: (_ref = section && sectionKey !== lastSection.current) !== null && _ref !== void 0 ? _ref : false,
        groupTitle: sectionTitle,
        groupCount: section ? [
          ...$c5a24bc478652b5f$export$1005530eda016c13(section, state.collection)
        ].length : 0,
        optionText: focusedItem["aria-label"] || focusedItem.textValue || "",
        isSelected
      });
      $319e236875307eab$export$a9b970dcc4ae71a9(announcement);
    }
    lastSection.current = sectionKey;
    lastItem.current = itemKey2;
  });
  let optionCount = $453cc9f0df89c0a5$export$77d5aafae4e095b2(state.collection);
  let lastSize = reactExports.useRef(optionCount);
  let lastOpen = reactExports.useRef(state.isOpen);
  reactExports.useEffect(() => {
    let didOpenWithoutFocusedItem = state.isOpen !== lastOpen.current && (state.selectionManager.focusedKey == null || $c87311424ea30a05$export$e1865c3bedcd822b());
    if (state.isOpen && (didOpenWithoutFocusedItem || optionCount !== lastSize.current)) {
      let announcement = stringFormatter.format("countAnnouncement", {
        optionCount
      });
      $319e236875307eab$export$a9b970dcc4ae71a9(announcement);
    }
    lastSize.current = optionCount;
    lastOpen.current = state.isOpen;
  });
  let lastSelectedKey = reactExports.useRef(state.selectedKey);
  reactExports.useEffect(() => {
    if ($c87311424ea30a05$export$e1865c3bedcd822b() && state.isFocused && state.selectedItem && state.selectedKey !== lastSelectedKey.current) {
      let optionText = state.selectedItem["aria-label"] || state.selectedItem.textValue || "";
      let announcement = stringFormatter.format("selectedAnnouncement", {
        optionText
      });
      $319e236875307eab$export$a9b970dcc4ae71a9(announcement);
    }
    lastSelectedKey.current = state.selectedKey;
  });
  reactExports.useEffect(() => {
    if (state.isOpen)
      return $5e3802645cc19319$export$1c3ebcada18427bf([
        inputRef.current,
        popoverRef.current
      ].filter((element2) => element2 != null));
  }, [
    state.isOpen,
    inputRef,
    popoverRef
  ]);
  $4f58c5f72bcf79f7$export$496315a1608d9602(() => {
    if (!focusedItem && inputRef.current && $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4(inputRef.current)) === inputRef.current)
      $55f9b1ae81f22853$export$2b35b76d2e30e129(inputRef.current, null);
  }, [
    focusedItem
  ]);
  return {
    labelProps,
    buttonProps: {
      ...menuTriggerProps,
      ...triggerLabelProps,
      excludeFromTabOrder: true,
      preventFocusOnPress: true,
      onPress,
      onPressStart,
      isDisabled: isDisabled || isReadOnly
    },
    inputProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(inputProps, {
      role: "combobox",
      "aria-expanded": menuTriggerProps["aria-expanded"],
      "aria-controls": state.isOpen ? menuProps.id : void 0,
      // TODO: readd proper logic for completionMode = complete (aria-autocomplete: both)
      "aria-autocomplete": "list",
      "aria-activedescendant": focusedItem ? $b1f0cad8af73213b$export$9145995848b05025(state, focusedItem.key) : void 0,
      onTouchEnd,
      // This disable's iOS's autocorrect suggestions, since the combo box provides its own suggestions.
      autoCorrect: "off",
      // This disable's the macOS Safari spell check auto corrections.
      spellCheck: "false"
    }),
    listBoxProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(menuProps, listBoxProps, {
      autoFocus: state.focusStrategy || true,
      shouldUseVirtualFocus: true,
      shouldSelectOnPressUp: true,
      shouldFocusOnHover: true,
      linkBehavior: "selection"
    }),
    descriptionProps,
    errorMessageProps,
    isInvalid,
    validationErrors,
    validationDetails
  };
}
function useAutocomplete(originalProps) {
  var _a2, _b2, _c2, _d, _e;
  const globalContext = useProviderContext();
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext$1) || {};
  const [props, variantProps2] = mapPropsVariants(originalProps, autocomplete.variantKeys);
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const isClearable = originalProps.disableClearable !== void 0 ? !originalProps.disableClearable : originalProps.isReadOnly ? false : originalProps.isClearable;
  const {
    ref,
    as: as2,
    label,
    isLoading,
    menuTrigger = "focus",
    filterOptions = {
      sensitivity: "base"
    },
    children,
    selectorIcon,
    clearIcon,
    scrollRef: scrollRefProp,
    defaultFilter,
    endContent,
    allowsEmptyCollection = true,
    shouldCloseOnBlur = true,
    popoverProps = {},
    inputProps: userInputProps = {},
    scrollShadowProps = {},
    listboxProps = {},
    selectorButtonProps = {},
    clearButtonProps = {},
    showScrollIndicators = true,
    allowsCustomValue = false,
    isVirtualized,
    maxListboxHeight = 256,
    itemHeight = 32,
    validationBehavior = (_c2 = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _c2 : "native",
    className,
    classNames: classNames2,
    errorMessage,
    onOpenChange,
    onClose,
    onClear,
    isReadOnly = false,
    ...otherProps
  } = props;
  const { contains: contains2 } = $bb77f239b46e8c72$export$3274cf84b703fff(filterOptions);
  let state = $a9e7382a7d111cb5$export$b453a3bfd4a5fa9e({
    ...originalProps,
    children,
    menuTrigger,
    validationBehavior,
    shouldCloseOnBlur,
    allowsEmptyCollection,
    defaultFilter: defaultFilter && typeof defaultFilter === "function" ? defaultFilter : contains2,
    onOpenChange: (open, menuTrigger2) => {
      onOpenChange == null ? void 0 : onOpenChange(open, menuTrigger2);
      if (!open) {
        onClose == null ? void 0 : onClose();
      }
    }
  });
  state = {
    ...state,
    ...isReadOnly && {
      disabledKeys: /* @__PURE__ */ new Set([...state.collection.getKeys()])
    }
  };
  const buttonRef = reactExports.useRef(null);
  const inputWrapperRef = reactExports.useRef(null);
  const listBoxRef = reactExports.useRef(null);
  const popoverRef = reactExports.useRef(null);
  const inputRef = useDOMRef(ref);
  const scrollShadowRef = useDOMRef(scrollRefProp);
  const {
    buttonProps,
    inputProps,
    listBoxProps,
    isInvalid: isAriaInvalid,
    validationDetails,
    validationErrors
  } = $c350ade66beef0af$export$8c18d1b4f7232bbf(
    {
      validationBehavior,
      ...originalProps,
      inputRef,
      buttonRef,
      listBoxRef,
      popoverRef
    },
    state
  );
  const isInvalid = originalProps.isInvalid || isAriaInvalid;
  const slotsProps = {
    inputProps: mergeProps$3(
      {
        label,
        ref: inputRef,
        wrapperRef: inputWrapperRef,
        onClick: () => {
          if (!state.isOpen && !!state.selectedItem) {
            state.open();
          }
        },
        isClearable: false,
        disableAnimation
      },
      userInputProps
    ),
    popoverProps: mergeProps$3(
      {
        offset: 5,
        placement: "bottom",
        triggerScaleOnOpen: false,
        disableAnimation
      },
      popoverProps
    ),
    scrollShadowProps: mergeProps$3(
      {
        ref: scrollShadowRef,
        isEnabled: (_d = showScrollIndicators && state.collection.size > 5) != null ? _d : true,
        hideScrollBar: true,
        offset: 15
      },
      scrollShadowProps
    ),
    listboxProps: mergeProps$3(
      {
        hideEmptyContent: allowsCustomValue,
        emptyContent: "No results found.",
        disableAnimation
      },
      listboxProps
    ),
    selectorButtonProps: mergeProps$3(
      {
        isLoading,
        size: "sm",
        variant: "light",
        radius: "full",
        color: isInvalid ? "danger" : originalProps == null ? void 0 : originalProps.color,
        isIconOnly: true,
        disableAnimation
      },
      selectorButtonProps
    ),
    clearButtonProps: mergeProps$3(
      {
        size: "sm",
        variant: "light",
        radius: "full",
        color: isInvalid ? "danger" : originalProps == null ? void 0 : originalProps.color,
        isIconOnly: true,
        disableAnimation
      },
      clearButtonProps
    )
  };
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const isOpen = ((_e = slotsProps.listboxProps) == null ? void 0 : _e.hideEmptyContent) ? state.isOpen && !!state.collection.size : state.isOpen;
  useSafeLayoutEffect(() => {
    if (!inputRef.current)
      return;
    const key = inputRef.current.value;
    const item = state.collection.getItem(key);
    if (item && state.inputValue !== item.textValue) {
      state.setSelectedKey(key);
      state.setInputValue(item.textValue);
    }
  }, [inputRef.current]);
  reactExports.useEffect(() => {
    let keyToFocus;
    if (state.selectedKey !== null && state.collection.getItem(state.selectedKey) && !state.disabledKeys.has(state.selectedKey)) {
      keyToFocus = state.selectedKey;
    } else {
      let firstAvailableKey = state.collection.getFirstKey();
      while (firstAvailableKey && state.disabledKeys.has(firstAvailableKey)) {
        firstAvailableKey = state.collection.getKeyAfter(firstAvailableKey);
      }
      keyToFocus = firstAvailableKey;
    }
    state.selectionManager.setFocusedKey(keyToFocus);
  }, [state.collection, state.disabledKeys, state.selectedKey]);
  reactExports.useEffect(() => {
    if (state.isOpen && popoverRef.current && listBoxRef.current) {
      let selectedItem = listBoxRef.current.querySelector("[aria-selected=true] [data-label=true]");
      let scrollShadow2 = scrollShadowRef.current;
      if (selectedItem && scrollShadow2 && selectedItem.parentElement) {
        let scrollShadowRect = scrollShadow2 == null ? void 0 : scrollShadow2.getBoundingClientRect();
        let scrollShadowHeight = scrollShadowRect.height;
        scrollShadow2.scrollTop = selectedItem.parentElement.offsetTop - scrollShadowHeight / 2 + selectedItem.parentElement.clientHeight / 2;
        state.selectionManager.setFocusedKey(state.selectedKey);
      }
    }
  }, [state.isOpen, disableAnimation]);
  reactExports.useEffect(() => {
    if (isOpen) {
      if (popoverRef.current && inputWrapperRef.current) {
        let rect = inputWrapperRef.current.getBoundingClientRect();
        let popover2 = popoverRef.current;
        popover2.style.width = rect.width + "px";
      }
    }
  }, [isOpen]);
  if (inputProps.onKeyDown) {
    const originalOnKeyDown = inputProps.onKeyDown;
    inputProps.onKeyDown = (e2) => {
      if ("continuePropagation" in e2) {
        e2.stopPropagation = () => {
        };
      }
      return originalOnKeyDown(e2);
    };
  }
  const Component2 = as2 || "div";
  const slots = reactExports.useMemo(
    () => autocomplete({
      ...variantProps2,
      isClearable,
      disableAnimation
    }),
    [objectToDeps(variantProps2), isClearable, disableAnimation]
  );
  const getBaseProps = () => ({
    "data-invalid": dataAttr(isInvalid),
    "data-open": dataAttr(state.isOpen),
    className: slots.base({ class: baseStyles })
  });
  const getSelectorButtonProps = () => {
    var _a22;
    return {
      ref: buttonRef,
      ...mergeProps$3(buttonProps, slotsProps.selectorButtonProps),
      "data-open": dataAttr(state.isOpen),
      className: slots.selectorButton({
        class: clsx$4(classNames2 == null ? void 0 : classNames2.selectorButton, (_a22 = slotsProps.selectorButtonProps) == null ? void 0 : _a22.className)
      })
    };
  };
  const getClearButtonProps = () => {
    var _a22, _b22;
    return {
      ...mergeProps$3(buttonProps, slotsProps.clearButtonProps),
      // disable original focus and state toggle from react aria
      onPressStart: () => {
        var _a3;
        (_a3 = inputRef.current) == null ? void 0 : _a3.focus();
      },
      onPress: (e2) => {
        var _a3, _b3;
        (_b3 = (_a3 = slotsProps.clearButtonProps) == null ? void 0 : _a3.onPress) == null ? void 0 : _b3.call(_a3, e2);
        if (state.selectedItem) {
          state.setSelectedKey(null);
        }
        state.setInputValue("");
        state.open();
        onClear == null ? void 0 : onClear();
      },
      "data-visible": !!state.selectedItem || ((_a22 = state.inputValue) == null ? void 0 : _a22.length) > 0,
      className: slots.clearButton({
        class: clsx$4(classNames2 == null ? void 0 : classNames2.clearButton, (_b22 = slotsProps.clearButtonProps) == null ? void 0 : _b22.className)
      })
    };
  };
  const hasUncommittedValidation = validationBehavior === "native" && state.displayValidation.isInvalid === false && state.realtimeValidation.isInvalid === true;
  const getInputProps = () => ({
    ...otherProps,
    ...inputProps,
    ...slotsProps.inputProps,
    isInvalid: hasUncommittedValidation ? void 0 : isInvalid,
    validationBehavior,
    errorMessage: typeof errorMessage === "function" ? errorMessage({ isInvalid, validationErrors, validationDetails }) : errorMessage || (validationErrors == null ? void 0 : validationErrors.join(" ")),
    onClick: chain(slotsProps.inputProps.onClick, otherProps.onClick)
  });
  const getListBoxProps = () => {
    const shouldVirtualize = isVirtualized != null ? isVirtualized : state.collection.size > 50;
    return {
      state,
      ref: listBoxRef,
      isVirtualized: shouldVirtualize,
      virtualization: shouldVirtualize ? {
        maxListboxHeight,
        itemHeight
      } : void 0,
      scrollShadowProps: slotsProps.scrollShadowProps,
      ...mergeProps$3(slotsProps.listboxProps, listBoxProps, {
        shouldHighlightOnFocus: true
      })
    };
  };
  const getPopoverProps = (props2 = {}) => {
    var _a22, _b22, _c22;
    const popoverProps2 = mergeProps$3(slotsProps.popoverProps, props2);
    return {
      state,
      ref: popoverRef,
      triggerRef: inputWrapperRef,
      scrollRef: listBoxRef,
      triggerType: "listbox",
      ...popoverProps2,
      classNames: {
        ...(_a22 = slotsProps.popoverProps) == null ? void 0 : _a22.classNames,
        content: slots.popoverContent({
          class: clsx$4(
            classNames2 == null ? void 0 : classNames2.popoverContent,
            (_c22 = (_b22 = slotsProps.popoverProps) == null ? void 0 : _b22.classNames) == null ? void 0 : _c22["content"],
            props2.className
          )
        })
      },
      // when the popover is open, the focus should be on input instead of dialog
      // therefore, we skip dialog focus here
      disableDialogFocus: true
    };
  };
  const getEmptyPopoverProps = () => {
    return {
      ref: popoverRef,
      className: "hidden"
    };
  };
  const getListBoxWrapperProps = (props2 = {}) => {
    var _a22, _b22;
    return {
      ...mergeProps$3(slotsProps.scrollShadowProps, props2),
      className: slots.listboxWrapper({
        class: clsx$4(
          classNames2 == null ? void 0 : classNames2.listboxWrapper,
          (_a22 = slotsProps.scrollShadowProps) == null ? void 0 : _a22.className,
          props2 == null ? void 0 : props2.className
        )
      }),
      style: {
        maxHeight: (_b22 = originalProps.maxListboxHeight) != null ? _b22 : 256
      }
    };
  };
  const getEndContentWrapperProps = (props2 = {}) => ({
    className: slots.endContentWrapper({
      class: clsx$4(classNames2 == null ? void 0 : classNames2.endContentWrapper, props2 == null ? void 0 : props2.className)
    }),
    onPointerDown: chain(props2.onPointerDown, (e2) => {
      var _a22;
      if (e2.button === 0 && e2.currentTarget === e2.target) {
        (_a22 = inputRef.current) == null ? void 0 : _a22.focus();
      }
    }),
    onMouseDown: chain(props2.onMouseDown, (e2) => {
      if (e2.button === 0 && e2.currentTarget === e2.target) {
        e2.preventDefault();
      }
    })
  });
  return {
    Component: Component2,
    inputRef,
    label,
    state,
    slots,
    classNames: classNames2,
    isLoading,
    clearIcon,
    isOpen,
    endContent,
    isClearable,
    disableAnimation,
    allowsCustomValue,
    selectorIcon,
    getBaseProps,
    getInputProps,
    getListBoxProps,
    getPopoverProps,
    getEmptyPopoverProps,
    getClearButtonProps,
    getSelectorButtonProps,
    getListBoxWrapperProps,
    getEndContentWrapperProps
  };
}
var Autocomplete = forwardRef(function Autocomplete2(props, ref) {
  var _a2;
  const {
    Component: Component2,
    isOpen,
    disableAnimation,
    selectorIcon = /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDownIcon$1, {}),
    clearIcon = /* @__PURE__ */ jsxRuntimeExports.jsx(CloseIcon, {}),
    endContent,
    getBaseProps,
    getSelectorButtonProps,
    getInputProps,
    getListBoxProps,
    getPopoverProps,
    getEmptyPopoverProps,
    getClearButtonProps,
    getListBoxWrapperProps,
    getEndContentWrapperProps
  } = useAutocomplete({ ...props, ref });
  const listboxProps = getListBoxProps();
  const popoverContent = isOpen ? /* @__PURE__ */ jsxRuntimeExports.jsx(free_solo_popover_default, { ...getPopoverProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(scroll_shadow_default, { ...getListBoxWrapperProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(listbox_default, { ...listboxProps }) }) }) : ((_a2 = listboxProps.state) == null ? void 0 : _a2.collection.size) === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getEmptyPopoverProps() }) : null;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getBaseProps(), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        ...getInputProps(),
        endContent: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getEndContentWrapperProps(), children: [
          endContent || /* @__PURE__ */ jsxRuntimeExports.jsx(button_default$1, { ...getClearButtonProps(), children: clearIcon }),
          selectorIcon && /* @__PURE__ */ jsxRuntimeExports.jsx(button_default$1, { ...getSelectorButtonProps(), children: selectorIcon })
        ] })
      }
    ),
    disableAnimation ? popoverContent : /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { children: popoverContent })
  ] });
});
var autocomplete_default = Autocomplete;
function $458b0a5536c1a7cf$export$40bfa8c7b0832715$3(value2, defaultValue2, onChange) {
  let [stateValue, setStateValue] = reactExports.useState(value2 || defaultValue2);
  let isControlledRef = reactExports.useRef(value2 !== void 0);
  let isControlled = value2 !== void 0;
  reactExports.useEffect(() => {
    isControlledRef.current;
    isControlledRef.current = isControlled;
  }, [
    isControlled
  ]);
  let currentValue = isControlled ? value2 : stateValue;
  let setValue = reactExports.useCallback((value22, ...args) => {
    let onChangeCaller = (value3, ...onChangeArgs) => {
      if (onChange) {
        if (!Object.is(currentValue, value3))
          onChange(value3, ...onChangeArgs);
      }
      if (!isControlled)
        currentValue = value3;
    };
    if (typeof value22 === "function") {
      let updateFunction = (oldValue, ...functionArgs) => {
        let interceptedValue = value22(isControlled ? currentValue : oldValue, ...functionArgs);
        onChangeCaller(interceptedValue, ...args);
        if (!isControlled)
          return interceptedValue;
        return oldValue;
      };
      setStateValue(updateFunction);
    } else {
      if (!isControlled)
        setStateValue(value22);
      onChangeCaller(value22, ...args);
    }
  }, [
    isControlled,
    currentValue,
    onChange
  ]);
  return [
    currentValue,
    setValue
  ];
}
const $148a7a147e38ea7f$var$RTL_SCRIPTS$3 = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS$3 = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764$3(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS$3.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS$3.has(lang2);
}
const $b5e257d569688ac6$var$defaultContext$3 = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$3 = /* @__PURE__ */ React$5.createContext($b5e257d569688ac6$var$defaultContext$3);
const $b5e257d569688ac6$var$IsSSRContext$3 = /* @__PURE__ */ React$5.createContext(false);
let $b5e257d569688ac6$var$componentIds$3 = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$3(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$3);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$3.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$3.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$3.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$3(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$3);
  let counter = $b5e257d569688ac6$var$useCounter$3(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$3(defaultId) {
  let id2 = React$5.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$3());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$3.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$5["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$3 : $b5e257d569688ac6$var$useLegacySSRSafeId$3;
function $b5e257d569688ac6$var$getSnapshot$3() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$3() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$3(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$3() {
  if (typeof React$5["useSyncExternalStore"] === "function")
    return React$5["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$3, $b5e257d569688ac6$var$getSnapshot$3, $b5e257d569688ac6$var$getServerSnapshot$3);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$3);
}
const $1e5a04cdaf7d1af8$var$localeSymbol$3 = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$3() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol$3] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764$3(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale$3 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$3();
let $1e5a04cdaf7d1af8$var$listeners$3 = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale$3() {
  $1e5a04cdaf7d1af8$var$currentLocale$3 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$3();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners$3)
    listener($1e5a04cdaf7d1af8$var$currentLocale$3);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$3() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$3();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale$3);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners$3.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$3);
    $1e5a04cdaf7d1af8$var$listeners$3.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners$3.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners$3.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$3);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext$3 = /* @__PURE__ */ React$5.createContext(null);
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$3() {
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$3();
  let context = reactExports.useContext($18f2051aff69b9bf$var$I18nContext$3);
  return context || defaultLocale;
}
function $896ba0a80a8f4d36$export$85fd5fdf27bacc79(options) {
  options = $5a387cc49350e6db$export$722debc0e56fea39(options !== null && options !== void 0 ? options : {}, $896ba0a80a8f4d36$var$isEqual);
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$3();
  return reactExports.useMemo(() => new $fb18d541ea1ad717$export$ad991b66133851cf(locale2, options), [
    locale2,
    options
  ]);
}
function $896ba0a80a8f4d36$var$isEqual(a2, b2) {
  if (a2 === b2)
    return true;
  let aKeys = Object.keys(a2);
  let bKeys = Object.keys(b2);
  if (aKeys.length !== bKeys.length)
    return false;
  for (let key of aKeys) {
    if (b2[key] !== a2[key])
      return false;
  }
  return true;
}
function useCalendarBase(originalProps) {
  var _a2, _b2, _c2, _d, _e, _f, _g;
  const [props, variantProps2] = mapPropsVariants(originalProps, calendar$2.variantKeys);
  const globalContext = useProviderContext();
  const { locale: locale2, direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$3();
  const isRTL = direction === "rtl";
  const calendarProp = $64244302c3013299$export$dd0bbc9b26defe37(
    new $fb18d541ea1ad717$export$ad991b66133851cf(locale2).resolvedOptions().calendar
  );
  const gregorianYearOffset = getGregorianYearOffset(calendarProp.identifier);
  const {
    ref,
    as: as2,
    children,
    className,
    topContent,
    bottomContent,
    showHelper = true,
    firstDayOfWeek,
    calendarWidth = 256,
    visibleMonths: visibleMonthsProp = 1,
    weekdayStyle = "narrow",
    navButtonProps = {},
    isHeaderExpanded: isHeaderExpandedProp,
    isHeaderDefaultExpanded,
    onHeaderExpandedChange = () => {
    },
    createCalendar: createCalendarProp = (_a2 = globalContext == null ? void 0 : globalContext.createCalendar) != null ? _a2 : null,
    minValue = (_c2 = (_b2 = globalContext == null ? void 0 : globalContext.defaultDates) == null ? void 0 : _b2.minDate) != null ? _c2 : new $35ea8db9cb2ccb90$export$99faa760c7908e4f(calendarProp, 1900 + gregorianYearOffset, 1, 1),
    maxValue = (_e = (_d = globalContext == null ? void 0 : globalContext.defaultDates) == null ? void 0 : _d.maxDate) != null ? _e : new $35ea8db9cb2ccb90$export$99faa760c7908e4f(calendarProp, 2099 + gregorianYearOffset, 12, 31),
    prevButtonProps: prevButtonPropsProp,
    nextButtonProps: nextButtonPropsProp,
    errorMessage,
    classNames: classNames2,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const visibleMonths = clamp$2(visibleMonthsProp, 1, 3);
  const showMonthAndYearPickers = originalProps.showMonthAndYearPickers && visibleMonths === 1;
  const domRef = useDOMRef(ref);
  const handleHeaderExpandedChange = reactExports.useCallback(
    (isExpanded) => {
      onHeaderExpandedChange(isExpanded || false);
    },
    [onHeaderExpandedChange]
  );
  const [isHeaderExpanded, setIsHeaderExpanded] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$3(
    isHeaderExpandedProp,
    isHeaderDefaultExpanded != null ? isHeaderDefaultExpanded : false,
    handleHeaderExpandedChange
  );
  const visibleDuration = reactExports.useMemo(() => ({ months: visibleMonths }), [visibleMonths]);
  const hasMultipleMonths = visibleMonths > 1;
  const shouldFilterDOMProps = typeof Component2 === "string";
  const slots = reactExports.useMemo(
    () => calendar$2({
      ...variantProps2,
      showMonthAndYearPickers,
      isRange: !!originalProps.isRange,
      isHeaderWrapperExpanded: isHeaderExpanded,
      className,
      isRTL
    }),
    [objectToDeps(variantProps2), showMonthAndYearPickers, isHeaderExpanded, className]
  );
  const disableAnimation = (_g = (_f = originalProps.disableAnimation) != null ? _f : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _g : false;
  const commonButtonProps = {
    size: "sm",
    variant: "light",
    radius: "full",
    isIconOnly: true,
    disableAnimation,
    ...navButtonProps
  };
  const baseProps = {
    "data-slot": "base",
    "data-has-multiple-months": dataAttr(hasMultipleMonths),
    style: {
      // @ts-ignore
      "--visible-months": typeof visibleMonths === "number" ? `${visibleMonths}` : visibleMonths,
      "--calendar-width": typeof calendarWidth === "number" ? `${calendarWidth}px` : calendarWidth
    }
  };
  const getPrevButtonProps = (props2 = {}) => {
    return {
      "data-slot": "prev-button",
      tabIndex: isHeaderExpanded ? -1 : 0,
      className: slots.prevButton({ class: classNames2 == null ? void 0 : classNames2.prevButton }),
      ...mergeProps$3(commonButtonProps, prevButtonPropsProp, props2)
    };
  };
  const getNextButtonProps = (props2 = {}) => {
    return {
      "data-slot": "next-button",
      tabIndex: isHeaderExpanded ? -1 : 0,
      className: slots.nextButton({ class: classNames2 == null ? void 0 : classNames2.nextButton }),
      ...mergeProps$3(commonButtonProps, nextButtonPropsProp, props2)
    };
  };
  const getErrorMessageProps = (props2 = {}) => {
    return {
      "data-slot": "error-message",
      className: slots.errorMessage({ class: classNames2 == null ? void 0 : classNames2.errorMessage }),
      ...props2
    };
  };
  return {
    Component: Component2,
    children,
    domRef,
    slots,
    locale: locale2,
    minValue,
    maxValue,
    baseProps,
    showHelper,
    firstDayOfWeek,
    weekdayStyle,
    visibleMonths,
    visibleDuration,
    shouldFilterDOMProps,
    isHeaderExpanded,
    showMonthAndYearPickers,
    disableAnimation,
    createCalendar: createCalendarProp,
    getPrevButtonProps,
    getNextButtonProps,
    getErrorMessageProps,
    setIsHeaderExpanded,
    topContent,
    bottomContent,
    errorMessage,
    classNames: classNames2,
    otherProps
  };
}
var $39324ace0d945f59$exports = {};
$39324ace0d945f59$exports = {
  "dateRange": (args) => `${args.startDate} إلى ${args.endDate}`,
  "dateSelected": (args) => `${args.date} المحدد`,
  "finishRangeSelectionPrompt": `انقر لإنهاء عملية تحديد نطاق التاريخ`,
  "maximumDate": `آخر تاريخ متاح`,
  "minimumDate": `أول تاريخ متاح`,
  "next": `التالي`,
  "previous": `السابق`,
  "selectedDateDescription": (args) => `تاريخ محدد: ${args.date}`,
  "selectedRangeDescription": (args) => `المدى الزمني المحدد: ${args.dateRange}`,
  "startRangeSelectionPrompt": `انقر لبدء عملية تحديد نطاق التاريخ`,
  "todayDate": (args) => `اليوم، ${args.date}`,
  "todayDateSelected": (args) => `اليوم، ${args.date} محدد`
};
var $1830a539e98c7baf$exports = {};
$1830a539e98c7baf$exports = {
  "dateRange": (args) => `${args.startDate} до ${args.endDate}`,
  "dateSelected": (args) => `Избрано е ${args.date}`,
  "finishRangeSelectionPrompt": `Натиснете, за да довършите избора на времеви интервал`,
  "maximumDate": `Последна налична дата`,
  "minimumDate": `Първа налична дата`,
  "next": `Напред`,
  "previous": `Назад`,
  "selectedDateDescription": (args) => `Избрана дата: ${args.date}`,
  "selectedRangeDescription": (args) => `Избран диапазон: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Натиснете, за да пристъпите към избора на времеви интервал`,
  "todayDate": (args) => `Днес, ${args.date}`,
  "todayDateSelected": (args) => `Днес, ${args.date} са избрани`
};
var $f4b92528965aab97$exports = {};
$f4b92528965aab97$exports = {
  "dateRange": (args) => `${args.startDate} až ${args.endDate}`,
  "dateSelected": (args) => `Vybráno ${args.date}`,
  "finishRangeSelectionPrompt": `Kliknutím dokončíte výběr rozsahu dat`,
  "maximumDate": `Poslední dostupné datum`,
  "minimumDate": `První dostupné datum`,
  "next": `Další`,
  "previous": `Předchozí`,
  "selectedDateDescription": (args) => `Vybrané datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Vybrané období: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Kliknutím zahájíte výběr rozsahu dat`,
  "todayDate": (args) => `Dnes, ${args.date}`,
  "todayDateSelected": (args) => `Dnes, vybráno ${args.date}`
};
var $1cd578ef0547c8f1$exports = {};
$1cd578ef0547c8f1$exports = {
  "dateRange": (args) => `${args.startDate} til ${args.endDate}`,
  "dateSelected": (args) => `${args.date} valgt`,
  "finishRangeSelectionPrompt": `Klik for at fuldføre valg af datoområde`,
  "maximumDate": `Sidste ledige dato`,
  "minimumDate": `Første ledige dato`,
  "next": `Næste`,
  "previous": `Forrige`,
  "selectedDateDescription": (args) => `Valgt dato: ${args.date}`,
  "selectedRangeDescription": (args) => `Valgt interval: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Klik for at starte valg af datoområde`,
  "todayDate": (args) => `I dag, ${args.date}`,
  "todayDateSelected": (args) => `I dag, ${args.date} valgt`
};
var $db55a8973925d619$exports = {};
$db55a8973925d619$exports = {
  "dateRange": (args) => `${args.startDate} bis ${args.endDate}`,
  "dateSelected": (args) => `${args.date} ausgewählt`,
  "finishRangeSelectionPrompt": `Klicken, um die Auswahl des Datumsbereichs zu beenden`,
  "maximumDate": `Letztes verfügbares Datum`,
  "minimumDate": `Erstes verfügbares Datum`,
  "next": `Weiter`,
  "previous": `Zurück`,
  "selectedDateDescription": (args) => `Ausgewähltes Datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Ausgewählter Bereich: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Klicken, um die Auswahl des Datumsbereichs zu beginnen`,
  "todayDate": (args) => `Heute, ${args.date}`,
  "todayDateSelected": (args) => `Heute, ${args.date} ausgewählt`
};
var $ec6937d58566d443$exports = {};
$ec6937d58566d443$exports = {
  "dateRange": (args) => `${args.startDate} έως ${args.endDate}`,
  "dateSelected": (args) => `Επιλέχθηκε ${args.date}`,
  "finishRangeSelectionPrompt": `Κάντε κλικ για να ολοκληρώσετε την επιλογή εύρους ημερομηνιών`,
  "maximumDate": `Τελευταία διαθέσιμη ημερομηνία`,
  "minimumDate": `Πρώτη διαθέσιμη ημερομηνία`,
  "next": `Επόμενο`,
  "previous": `Προηγούμενο`,
  "selectedDateDescription": (args) => `Επιλεγμένη ημερομηνία: ${args.date}`,
  "selectedRangeDescription": (args) => `Επιλεγμένο εύρος: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Κάντε κλικ για να ξεκινήσετε την επιλογή εύρους ημερομηνιών`,
  "todayDate": (args) => `Σήμερα, ${args.date}`,
  "todayDateSelected": (args) => `Σήμερα, επιλέχτηκε ${args.date}`
};
var $1f5cea0742dc284a$exports = {};
$1f5cea0742dc284a$exports = {
  "previous": `Previous`,
  "next": `Next`,
  "selectedDateDescription": (args) => `Selected Date: ${args.date}`,
  "selectedRangeDescription": (args) => `Selected Range: ${args.dateRange}`,
  "todayDate": (args) => `Today, ${args.date}`,
  "todayDateSelected": (args) => `Today, ${args.date} selected`,
  "dateSelected": (args) => `${args.date} selected`,
  "startRangeSelectionPrompt": `Click to start selecting date range`,
  "finishRangeSelectionPrompt": `Click to finish selecting date range`,
  "minimumDate": `First available date`,
  "maximumDate": `Last available date`,
  "dateRange": (args) => `${args.startDate} to ${args.endDate}`
};
var $2ca7ea366384817b$exports = {};
$2ca7ea366384817b$exports = {
  "dateRange": (args) => `${args.startDate} a ${args.endDate}`,
  "dateSelected": (args) => `${args.date} seleccionado`,
  "finishRangeSelectionPrompt": `Haga clic para terminar de seleccionar rango de fechas`,
  "maximumDate": `Última fecha disponible`,
  "minimumDate": `Primera fecha disponible`,
  "next": `Siguiente`,
  "previous": `Anterior`,
  "selectedDateDescription": (args) => `Fecha seleccionada: ${args.date}`,
  "selectedRangeDescription": (args) => `Intervalo seleccionado: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Haga clic para comenzar a seleccionar un rango de fechas`,
  "todayDate": (args) => `Hoy, ${args.date}`,
  "todayDateSelected": (args) => `Hoy, ${args.date} seleccionado`
};
var $97874a7fe9cd091f$exports = {};
$97874a7fe9cd091f$exports = {
  "dateRange": (args) => `${args.startDate} kuni ${args.endDate}`,
  "dateSelected": (args) => `${args.date} valitud`,
  "finishRangeSelectionPrompt": `Klõpsake kuupäevavahemiku valimise lõpetamiseks`,
  "maximumDate": `Viimane saadaolev kuupäev`,
  "minimumDate": `Esimene saadaolev kuupäev`,
  "next": `Järgmine`,
  "previous": `Eelmine`,
  "selectedDateDescription": (args) => `Valitud kuupäev: ${args.date}`,
  "selectedRangeDescription": (args) => `Valitud vahemik: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Klõpsake kuupäevavahemiku valimiseks`,
  "todayDate": (args) => `Täna, ${args.date}`,
  "todayDateSelected": (args) => `Täna, ${args.date} valitud`
};
var $5d376b7fce1a45b2$exports = {};
$5d376b7fce1a45b2$exports = {
  "dateRange": (args) => `${args.startDate} – ${args.endDate}`,
  "dateSelected": (args) => `${args.date} valittu`,
  "finishRangeSelectionPrompt": `Lopeta päivämääräalueen valinta napsauttamalla tätä.`,
  "maximumDate": `Viimeinen varattavissa oleva päivämäärä`,
  "minimumDate": `Ensimmäinen varattavissa oleva päivämäärä`,
  "next": `Seuraava`,
  "previous": `Edellinen`,
  "selectedDateDescription": (args) => `Valittu päivämäärä: ${args.date}`,
  "selectedRangeDescription": (args) => `Valittu aikaväli: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Aloita päivämääräalueen valinta napsauttamalla tätä.`,
  "todayDate": (args) => `Tänään, ${args.date}`,
  "todayDateSelected": (args) => `Tänään, ${args.date} valittu`
};
var $3bf722b362aaf54d$exports = {};
$3bf722b362aaf54d$exports = {
  "dateRange": (args) => `${args.startDate} à ${args.endDate}`,
  "dateSelected": (args) => `${args.date} sélectionné`,
  "finishRangeSelectionPrompt": `Cliquer pour finir de sélectionner la plage de dates`,
  "maximumDate": `Dernière date disponible`,
  "minimumDate": `Première date disponible`,
  "next": `Suivant`,
  "previous": `Précédent`,
  "selectedDateDescription": (args) => `Date sélectionnée : ${args.date}`,
  "selectedRangeDescription": (args) => `Plage sélectionnée : ${args.dateRange}`,
  "startRangeSelectionPrompt": `Cliquer pour commencer à sélectionner la plage de dates`,
  "todayDate": (args) => `Aujourd'hui, ${args.date}`,
  "todayDateSelected": (args) => `Aujourd’hui, ${args.date} sélectionné`
};
var $38c43f8322316031$exports = {};
$38c43f8322316031$exports = {
  "dateRange": (args) => `${args.startDate} עד ${args.endDate}`,
  "dateSelected": (args) => `${args.date} נבחר`,
  "finishRangeSelectionPrompt": `חץ כדי לסיים את בחירת טווח התאריכים`,
  "maximumDate": `תאריך פנוי אחרון`,
  "minimumDate": `תאריך פנוי ראשון`,
  "next": `הבא`,
  "previous": `הקודם`,
  "selectedDateDescription": (args) => `תאריך נבחר: ${args.date}`,
  "selectedRangeDescription": (args) => `טווח נבחר: ${args.dateRange}`,
  "startRangeSelectionPrompt": `לחץ כדי להתחיל בבחירת טווח התאריכים`,
  "todayDate": (args) => `היום, ${args.date}`,
  "todayDateSelected": (args) => `היום, ${args.date} נבחר`
};
var $c90e0f32b44630bf$exports = {};
$c90e0f32b44630bf$exports = {
  "dateRange": (args) => `${args.startDate} do ${args.endDate}`,
  "dateSelected": (args) => `${args.date} odabran`,
  "finishRangeSelectionPrompt": `Kliknite da dovršite raspon odabranih datuma`,
  "maximumDate": `Posljednji raspoloživi datum`,
  "minimumDate": `Prvi raspoloživi datum`,
  "next": `Sljedeći`,
  "previous": `Prethodni`,
  "selectedDateDescription": (args) => `Odabrani datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Odabrani raspon: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Kliknite da započnete raspon odabranih datuma`,
  "todayDate": (args) => `Danas, ${args.date}`,
  "todayDateSelected": (args) => `Danas, odabran ${args.date}`
};
var $715875e6e7a338f4$exports = {};
$715875e6e7a338f4$exports = {
  "dateRange": (args) => `${args.startDate}–${args.endDate}`,
  "dateSelected": (args) => `${args.date} kiválasztva`,
  "finishRangeSelectionPrompt": `Kattintson a dátumtartomány kijelölésének befejezéséhez`,
  "maximumDate": `Utolsó elérhető dátum`,
  "minimumDate": `Az első elérhető dátum`,
  "next": `Következő`,
  "previous": `Előző`,
  "selectedDateDescription": (args) => `Kijelölt dátum: ${args.date}`,
  "selectedRangeDescription": (args) => `Kijelölt tartomány: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Kattintson a dátumtartomány kijelölésének indításához`,
  "todayDate": (args) => `Ma, ${args.date}`,
  "todayDateSelected": (args) => `Ma, ${args.date} kijelölve`
};
var $37d77c66e34daccf$exports = {};
$37d77c66e34daccf$exports = {
  "dateRange": (args) => `Da ${args.startDate} a ${args.endDate}`,
  "dateSelected": (args) => `${args.date} selezionata`,
  "finishRangeSelectionPrompt": `Fai clic per completare la selezione dell’intervallo di date`,
  "maximumDate": `Ultima data disponibile`,
  "minimumDate": `Prima data disponibile`,
  "next": `Successivo`,
  "previous": `Precedente`,
  "selectedDateDescription": (args) => `Data selezionata: ${args.date}`,
  "selectedRangeDescription": (args) => `Intervallo selezionato: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Fai clic per selezionare l’intervallo di date`,
  "todayDate": (args) => `Oggi, ${args.date}`,
  "todayDateSelected": (args) => `Oggi, ${args.date} selezionata`
};
var $542f39aee29303c3$exports = {};
$542f39aee29303c3$exports = {
  "dateRange": (args) => `${args.startDate} から ${args.endDate}`,
  "dateSelected": (args) => `${args.date} を選択`,
  "finishRangeSelectionPrompt": `クリックして日付範囲の選択を終了`,
  "maximumDate": `最終利用可能日`,
  "minimumDate": `最初の利用可能日`,
  "next": `次へ`,
  "previous": `前へ`,
  "selectedDateDescription": (args) => `選択した日付 : ${args.date}`,
  "selectedRangeDescription": (args) => `選択範囲 : ${args.dateRange}`,
  "startRangeSelectionPrompt": `クリックして日付範囲の選択を開始`,
  "todayDate": (args) => `本日、${args.date}`,
  "todayDateSelected": (args) => `本日、${args.date} を選択`
};
var $22a5f0623ea73e4f$exports = {};
$22a5f0623ea73e4f$exports = {
  "dateRange": (args) => `${args.startDate} ~ ${args.endDate}`,
  "dateSelected": (args) => `${args.date} 선택됨`,
  "finishRangeSelectionPrompt": `날짜 범위 선택을 완료하려면 클릭하십시오.`,
  "maximumDate": `마지막으로 사용 가능한 일자`,
  "minimumDate": `처음으로 사용 가능한 일자`,
  "next": `다음`,
  "previous": `이전`,
  "selectedDateDescription": (args) => `선택 일자: ${args.date}`,
  "selectedRangeDescription": (args) => `선택 범위: ${args.dateRange}`,
  "startRangeSelectionPrompt": `날짜 범위 선택을 시작하려면 클릭하십시오.`,
  "todayDate": (args) => `오늘, ${args.date}`,
  "todayDateSelected": (args) => `오늘, ${args.date} 선택됨`
};
var $522380d13d62cba0$exports = {};
$522380d13d62cba0$exports = {
  "dateRange": (args) => `Nuo ${args.startDate} iki ${args.endDate}`,
  "dateSelected": (args) => `Pasirinkta ${args.date}`,
  "finishRangeSelectionPrompt": `Spustelėkite, kad baigtumėte pasirinkti datų intervalą`,
  "maximumDate": `Paskutinė galima data`,
  "minimumDate": `Pirmoji galima data`,
  "next": `Paskesnis`,
  "previous": `Ankstesnis`,
  "selectedDateDescription": (args) => `Pasirinkta data: ${args.date}`,
  "selectedRangeDescription": (args) => `Pasirinktas intervalas: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Spustelėkite, kad pradėtumėte pasirinkti datų intervalą`,
  "todayDate": (args) => `Šiandien, ${args.date}`,
  "todayDateSelected": (args) => `Šiandien, pasirinkta ${args.date}`
};
var $8a7bc830b2fe6485$exports = {};
$8a7bc830b2fe6485$exports = {
  "dateRange": (args) => `No ${args.startDate} līdz ${args.endDate}`,
  "dateSelected": (args) => `Atlasīts: ${args.date}`,
  "finishRangeSelectionPrompt": `Noklikšķiniet, lai pabeigtu datumu diapazona atlasi`,
  "maximumDate": `Pēdējais pieejamais datums`,
  "minimumDate": `Pirmais pieejamais datums`,
  "next": `Tālāk`,
  "previous": `Atpakaļ`,
  "selectedDateDescription": (args) => `Atlasītais datums: ${args.date}`,
  "selectedRangeDescription": (args) => `Atlasītais diapazons: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Noklikšķiniet, lai sāktu datumu diapazona atlasi`,
  "todayDate": (args) => `Šodien, ${args.date}`,
  "todayDateSelected": (args) => `Atlasīta šodiena, ${args.date}`
};
var $9fac9c044470683b$exports = {};
$9fac9c044470683b$exports = {
  "dateRange": (args) => `${args.startDate} til ${args.endDate}`,
  "dateSelected": (args) => `${args.date} valgt`,
  "finishRangeSelectionPrompt": `Klikk for å fullføre valg av datoområde`,
  "maximumDate": `Siste tilgjengelige dato`,
  "minimumDate": `Første tilgjengelige dato`,
  "next": `Neste`,
  "previous": `Forrige`,
  "selectedDateDescription": (args) => `Valgt dato: ${args.date}`,
  "selectedRangeDescription": (args) => `Valgt område: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Klikk for å starte valg av datoområde`,
  "todayDate": (args) => `I dag, ${args.date}`,
  "todayDateSelected": (args) => `I dag, ${args.date} valgt`
};
var $b127d3569efb1449$exports = {};
$b127d3569efb1449$exports = {
  "dateRange": (args) => `${args.startDate} tot ${args.endDate}`,
  "dateSelected": (args) => `${args.date} geselecteerd`,
  "finishRangeSelectionPrompt": `Klik om de selectie van het datumbereik te voltooien`,
  "maximumDate": `Laatste beschikbare datum`,
  "minimumDate": `Eerste beschikbare datum`,
  "next": `Volgende`,
  "previous": `Vorige`,
  "selectedDateDescription": (args) => `Geselecteerde datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Geselecteerd bereik: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Klik om het datumbereik te selecteren`,
  "todayDate": (args) => `Vandaag, ${args.date}`,
  "todayDateSelected": (args) => `Vandaag, ${args.date} geselecteerd`
};
var $51404a4090633490$exports = {};
$51404a4090633490$exports = {
  "dateRange": (args) => `${args.startDate} do ${args.endDate}`,
  "dateSelected": (args) => `Wybrano ${args.date}`,
  "finishRangeSelectionPrompt": `Kliknij, aby zakończyć wybór zakresu dat`,
  "maximumDate": `Ostatnia dostępna data`,
  "minimumDate": `Pierwsza dostępna data`,
  "next": `Dalej`,
  "previous": `Wstecz`,
  "selectedDateDescription": (args) => `Wybrana data: ${args.date}`,
  "selectedRangeDescription": (args) => `Wybrany zakres: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Kliknij, aby rozpocząć wybór zakresu dat`,
  "todayDate": (args) => `Dzisiaj, ${args.date}`,
  "todayDateSelected": (args) => `Dzisiaj wybrano ${args.date}`
};
var $e5e6a3fe3b4527df$exports = {};
$e5e6a3fe3b4527df$exports = {
  "dateRange": (args) => `${args.startDate} a ${args.endDate}`,
  "dateSelected": (args) => `${args.date} selecionado`,
  "finishRangeSelectionPrompt": `Clique para concluir a seleção do intervalo de datas`,
  "maximumDate": `Última data disponível`,
  "minimumDate": `Primeira data disponível`,
  "next": `Próximo`,
  "previous": `Anterior`,
  "selectedDateDescription": (args) => `Data selecionada: ${args.date}`,
  "selectedRangeDescription": (args) => `Intervalo selecionado: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Clique para iniciar a seleção do intervalo de datas`,
  "todayDate": (args) => `Hoje, ${args.date}`,
  "todayDateSelected": (args) => `Hoje, ${args.date} selecionado`
};
var $c519dcadcbb1ee47$exports = {};
$c519dcadcbb1ee47$exports = {
  "dateRange": (args) => `${args.startDate} a ${args.endDate}`,
  "dateSelected": (args) => `${args.date} selecionado`,
  "finishRangeSelectionPrompt": `Clique para terminar de selecionar o intervalo de datas`,
  "maximumDate": `Última data disponível`,
  "minimumDate": `Primeira data disponível`,
  "next": `Próximo`,
  "previous": `Anterior`,
  "selectedDateDescription": (args) => `Data selecionada: ${args.date}`,
  "selectedRangeDescription": (args) => `Intervalo selecionado: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Clique para começar a selecionar o intervalo de datas`,
  "todayDate": (args) => `Hoje, ${args.date}`,
  "todayDateSelected": (args) => `Hoje, ${args.date} selecionado`
};
var $e5aa0186ca7889c6$exports = {};
$e5aa0186ca7889c6$exports = {
  "dateRange": (args) => `De la ${args.startDate} până la ${args.endDate}`,
  "dateSelected": (args) => `${args.date} selectată`,
  "finishRangeSelectionPrompt": `Apăsaţi pentru a finaliza selecţia razei pentru dată`,
  "maximumDate": `Ultima dată disponibilă`,
  "minimumDate": `Prima dată disponibilă`,
  "next": `Următorul`,
  "previous": `Înainte`,
  "selectedDateDescription": (args) => `Dată selectată: ${args.date}`,
  "selectedRangeDescription": (args) => `Interval selectat: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Apăsaţi pentru a începe selecţia razei pentru dată`,
  "todayDate": (args) => `Astăzi, ${args.date}`,
  "todayDateSelected": (args) => `Azi, ${args.date} selectată`
};
var $5b907f5fa3eee652$exports = {};
$5b907f5fa3eee652$exports = {
  "dateRange": (args) => `С ${args.startDate} по ${args.endDate}`,
  "dateSelected": (args) => `Выбрано ${args.date}`,
  "finishRangeSelectionPrompt": `Щелкните, чтобы завершить выбор диапазона дат`,
  "maximumDate": `Последняя доступная дата`,
  "minimumDate": `Первая доступная дата`,
  "next": `Далее`,
  "previous": `Назад`,
  "selectedDateDescription": (args) => `Выбранная дата: ${args.date}`,
  "selectedRangeDescription": (args) => `Выбранный диапазон: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Щелкните, чтобы начать выбор диапазона дат`,
  "todayDate": (args) => `Сегодня, ${args.date}`,
  "todayDateSelected": (args) => `Сегодня, выбрано ${args.date}`
};
var $1b4c51359c99cf79$exports = {};
$1b4c51359c99cf79$exports = {
  "dateRange": (args) => `Od ${args.startDate} do ${args.endDate}`,
  "dateSelected": (args) => `Vybratý dátum ${args.date}`,
  "finishRangeSelectionPrompt": `Kliknutím dokončíte výber rozsahu dátumov`,
  "maximumDate": `Posledný dostupný dátum`,
  "minimumDate": `Prvý dostupný dátum`,
  "next": `Nasledujúce`,
  "previous": `Predchádzajúce`,
  "selectedDateDescription": (args) => `Vybratý dátum: ${args.date}`,
  "selectedRangeDescription": (args) => `Vybratý rozsah: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Kliknutím spustíte výber rozsahu dátumov`,
  "todayDate": (args) => `Dnes ${args.date}`,
  "todayDateSelected": (args) => `Vybratý dnešný dátum ${args.date}`
};
var $02e4e6a4608cc6f3$exports = {};
$02e4e6a4608cc6f3$exports = {
  "dateRange": (args) => `${args.startDate} do ${args.endDate}`,
  "dateSelected": (args) => `${args.date} izbrano`,
  "finishRangeSelectionPrompt": `Kliknite za dokončanje izbire datumskega obsega`,
  "maximumDate": `Zadnji razpoložljivi datum`,
  "minimumDate": `Prvi razpoložljivi datum`,
  "next": `Naprej`,
  "previous": `Nazaj`,
  "selectedDateDescription": (args) => `Izbrani datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Izbrano območje: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Kliknite za začetek izbire datumskega obsega`,
  "todayDate": (args) => `Danes, ${args.date}`,
  "todayDateSelected": (args) => `Danes, ${args.date} izbrano`
};
var $6dd2fbaad93b6878$exports = {};
$6dd2fbaad93b6878$exports = {
  "dateRange": (args) => `${args.startDate} do ${args.endDate}`,
  "dateSelected": (args) => `${args.date} izabran`,
  "finishRangeSelectionPrompt": `Kliknite da dovršite opseg izabranih datuma`,
  "maximumDate": `Zadnji raspoloživi datum`,
  "minimumDate": `Prvi raspoloživi datum`,
  "next": `Sledeći`,
  "previous": `Prethodni`,
  "selectedDateDescription": (args) => `Izabrani datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Izabrani period: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Kliknite da započnete opseg izabranih datuma`,
  "todayDate": (args) => `Danas, ${args.date}`,
  "todayDateSelected": (args) => `Danas, izabran ${args.date}`
};
var $33ea59bfe6e804e0$exports = {};
$33ea59bfe6e804e0$exports = {
  "dateRange": (args) => `${args.startDate} till ${args.endDate}`,
  "dateSelected": (args) => `${args.date} har valts`,
  "finishRangeSelectionPrompt": `Klicka för att avsluta val av datumintervall`,
  "maximumDate": `Sista tillgängliga datum`,
  "minimumDate": `Första tillgängliga datum`,
  "next": `Nästa`,
  "previous": `Föregående`,
  "selectedDateDescription": (args) => `Valt datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Valt intervall: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Klicka för att välja datumintervall`,
  "todayDate": (args) => `Idag, ${args.date}`,
  "todayDateSelected": (args) => `Idag, ${args.date} har valts`
};
var $4603b0d0246969b2$exports = {};
$4603b0d0246969b2$exports = {
  "dateRange": (args) => `${args.startDate} - ${args.endDate}`,
  "dateSelected": (args) => `${args.date} seçildi`,
  "finishRangeSelectionPrompt": `Tarih aralığı seçimini tamamlamak için tıklayın`,
  "maximumDate": `Son müsait tarih`,
  "minimumDate": `İlk müsait tarih`,
  "next": `Sonraki`,
  "previous": `Önceki`,
  "selectedDateDescription": (args) => `Seçilen Tarih: ${args.date}`,
  "selectedRangeDescription": (args) => `Seçilen Aralık: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Tarih aralığı seçimini başlatmak için tıklayın`,
  "todayDate": (args) => `Bugün, ${args.date}`,
  "todayDateSelected": (args) => `Bugün, ${args.date} seçildi`
};
var $82649816f530bb1b$exports = {};
$82649816f530bb1b$exports = {
  "dateRange": (args) => `${args.startDate} — ${args.endDate}`,
  "dateSelected": (args) => `Вибрано ${args.date}`,
  "finishRangeSelectionPrompt": `Натисніть, щоб завершити вибір діапазону дат`,
  "maximumDate": `Остання доступна дата`,
  "minimumDate": `Перша доступна дата`,
  "next": `Наступний`,
  "previous": `Попередній`,
  "selectedDateDescription": (args) => `Вибрана дата: ${args.date}`,
  "selectedRangeDescription": (args) => `Вибраний діапазон: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Натисніть, щоб почати вибір діапазону дат`,
  "todayDate": (args) => `Сьогодні, ${args.date}`,
  "todayDateSelected": (args) => `Сьогодні, вибрано ${args.date}`
};
var $628e140a43dfb330$exports = {};
$628e140a43dfb330$exports = {
  "dateRange": (args) => `${args.startDate} 至 ${args.endDate}`,
  "dateSelected": (args) => `已选择 ${args.date}`,
  "finishRangeSelectionPrompt": `单击以完成选择日期范围`,
  "maximumDate": `最后一个可用日期`,
  "minimumDate": `第一个可用日期`,
  "next": `下一页`,
  "previous": `上一页`,
  "selectedDateDescription": (args) => `选定的日期：${args.date}`,
  "selectedRangeDescription": (args) => `选定的范围：${args.dateRange}`,
  "startRangeSelectionPrompt": `单击以开始选择日期范围`,
  "todayDate": (args) => `今天，即 ${args.date}`,
  "todayDateSelected": (args) => `已选择今天，即 ${args.date}`
};
var $745937250cd4679c$exports = {};
$745937250cd4679c$exports = {
  "dateRange": (args) => `${args.startDate} 至 ${args.endDate}`,
  "dateSelected": (args) => `已選取 ${args.date}`,
  "finishRangeSelectionPrompt": `按一下以完成選取日期範圍`,
  "maximumDate": `最後一個可用日期`,
  "minimumDate": `第一個可用日期`,
  "next": `下一頁`,
  "previous": `上一頁`,
  "selectedDateDescription": (args) => `選定的日期：${args.date}`,
  "selectedRangeDescription": (args) => `選定的範圍：${args.dateRange}`,
  "startRangeSelectionPrompt": `按一下以開始選取日期範圍`,
  "todayDate": (args) => `今天，${args.date}`,
  "todayDateSelected": (args) => `已選取今天，${args.date}`
};
var $3904726b442bd9b2$exports = {};
$3904726b442bd9b2$exports = {
  "ar-AE": $39324ace0d945f59$exports,
  "bg-BG": $1830a539e98c7baf$exports,
  "cs-CZ": $f4b92528965aab97$exports,
  "da-DK": $1cd578ef0547c8f1$exports,
  "de-DE": $db55a8973925d619$exports,
  "el-GR": $ec6937d58566d443$exports,
  "en-US": $1f5cea0742dc284a$exports,
  "es-ES": $2ca7ea366384817b$exports,
  "et-EE": $97874a7fe9cd091f$exports,
  "fi-FI": $5d376b7fce1a45b2$exports,
  "fr-FR": $3bf722b362aaf54d$exports,
  "he-IL": $38c43f8322316031$exports,
  "hr-HR": $c90e0f32b44630bf$exports,
  "hu-HU": $715875e6e7a338f4$exports,
  "it-IT": $37d77c66e34daccf$exports,
  "ja-JP": $542f39aee29303c3$exports,
  "ko-KR": $22a5f0623ea73e4f$exports,
  "lt-LT": $522380d13d62cba0$exports,
  "lv-LV": $8a7bc830b2fe6485$exports,
  "nb-NO": $9fac9c044470683b$exports,
  "nl-NL": $b127d3569efb1449$exports,
  "pl-PL": $51404a4090633490$exports,
  "pt-BR": $e5e6a3fe3b4527df$exports,
  "pt-PT": $c519dcadcbb1ee47$exports,
  "ro-RO": $e5aa0186ca7889c6$exports,
  "ru-RU": $5b907f5fa3eee652$exports,
  "sk-SK": $1b4c51359c99cf79$exports,
  "sl-SI": $02e4e6a4608cc6f3$exports,
  "sr-SP": $6dd2fbaad93b6878$exports,
  "sv-SE": $33ea59bfe6e804e0$exports,
  "tr-TR": $4603b0d0246969b2$exports,
  "uk-UA": $82649816f530bb1b$exports,
  "zh-CN": $628e140a43dfb330$exports,
  "zh-TW": $745937250cd4679c$exports
};
function $parcel$interopDefault$a(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
const $a074e1e2d0f0a665$export$653eddfc964b0f8a = /* @__PURE__ */ new WeakMap();
function $a074e1e2d0f0a665$export$134cbb7fb09a9522(date4) {
  return (date4 === null || date4 === void 0 ? void 0 : date4.calendar.identifier) === "gregory" && date4.era === "BC" ? "short" : void 0;
}
function $a074e1e2d0f0a665$export$b6df97c887c38e1a(state) {
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$a($3904726b442bd9b2$exports), "@react-aria/calendar");
  let start2, end2;
  var _state_value;
  if ("highlightedRange" in state)
    ({ start: start2, end: end2 } = state.highlightedRange || {});
  else
    start2 = end2 = (_state_value = state.value) !== null && _state_value !== void 0 ? _state_value : void 0;
  let dateFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1({
    weekday: "long",
    month: "long",
    year: "numeric",
    day: "numeric",
    era: $a074e1e2d0f0a665$export$134cbb7fb09a9522(start2) || $a074e1e2d0f0a665$export$134cbb7fb09a9522(end2),
    timeZone: state.timeZone
  });
  let anchorDate = "anchorDate" in state ? state.anchorDate : null;
  return reactExports.useMemo(() => {
    if (!anchorDate && start2 && end2) {
      if ($14e0f24ef4ac5c92$export$ea39ec197993aef0(start2, end2)) {
        let date4 = dateFormatter.format(start2.toDate(state.timeZone));
        return stringFormatter.format("selectedDateDescription", {
          date: date4
        });
      } else {
        let dateRange = $a074e1e2d0f0a665$var$formatRange(dateFormatter, stringFormatter, start2, end2, state.timeZone);
        return stringFormatter.format("selectedRangeDescription", {
          dateRange
        });
      }
    }
    return "";
  }, [
    start2,
    end2,
    anchorDate,
    state.timeZone,
    stringFormatter,
    dateFormatter
  ]);
}
function $a074e1e2d0f0a665$export$31afe65d91ef6e8(startDate, endDate, timeZone, isAria) {
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$a($3904726b442bd9b2$exports), "@react-aria/calendar");
  let era = $a074e1e2d0f0a665$export$134cbb7fb09a9522(startDate) || $a074e1e2d0f0a665$export$134cbb7fb09a9522(endDate);
  let monthFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1({
    month: "long",
    year: "numeric",
    era,
    calendar: startDate.calendar.identifier,
    timeZone
  });
  let dateFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1({
    month: "long",
    year: "numeric",
    day: "numeric",
    era,
    calendar: startDate.calendar.identifier,
    timeZone
  });
  return reactExports.useMemo(() => {
    if ($14e0f24ef4ac5c92$export$ea39ec197993aef0(startDate, $14e0f24ef4ac5c92$export$a5a3b454ada2268e(startDate))) {
      let startMonth = startDate;
      let endMonth = endDate;
      if (startDate.calendar.getFormattableMonth)
        startMonth = startDate.calendar.getFormattableMonth(startDate);
      if (endDate.calendar.getFormattableMonth)
        endMonth = endDate.calendar.getFormattableMonth(endDate);
      if ($14e0f24ef4ac5c92$export$ea39ec197993aef0(endDate, $14e0f24ef4ac5c92$export$a2258d9c4118825c(startDate)))
        return monthFormatter.format(startMonth.toDate(timeZone));
      else if ($14e0f24ef4ac5c92$export$ea39ec197993aef0(endDate, $14e0f24ef4ac5c92$export$a2258d9c4118825c(endDate)))
        return isAria ? $a074e1e2d0f0a665$var$formatRange(monthFormatter, stringFormatter, startMonth, endMonth, timeZone) : monthFormatter.formatRange(startMonth.toDate(timeZone), endMonth.toDate(timeZone));
    }
    return isAria ? $a074e1e2d0f0a665$var$formatRange(dateFormatter, stringFormatter, startDate, endDate, timeZone) : dateFormatter.formatRange(startDate.toDate(timeZone), endDate.toDate(timeZone));
  }, [
    startDate,
    endDate,
    monthFormatter,
    dateFormatter,
    stringFormatter,
    timeZone,
    isAria
  ]);
}
function $a074e1e2d0f0a665$var$formatRange(dateFormatter, stringFormatter, start2, end2, timeZone) {
  let parts = dateFormatter.formatRangeToParts(start2.toDate(timeZone), end2.toDate(timeZone));
  let separatorIndex = -1;
  for (let i2 = 0; i2 < parts.length; i2++) {
    let part = parts[i2];
    if (part.source === "shared" && part.type === "literal")
      separatorIndex = i2;
    else if (part.source === "endRange")
      break;
  }
  let startValue = "";
  let endValue = "";
  for (let i2 = 0; i2 < parts.length; i2++) {
    if (i2 < separatorIndex)
      startValue += parts[i2].value;
    else if (i2 > separatorIndex)
      endValue += parts[i2].value;
  }
  return stringFormatter.format("dateRange", {
    startDate: startValue,
    endDate: endValue
  });
}
function $parcel$interopDefault$9(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $c4acc1de3ab169cf$export$d652b3ea2d672d5b(props, state) {
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$9($3904726b442bd9b2$exports), "@react-aria/calendar");
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props);
  let title = $a074e1e2d0f0a665$export$31afe65d91ef6e8(state.visibleRange.start, state.visibleRange.end, state.timeZone, false);
  let visibleRangeDescription = $a074e1e2d0f0a665$export$31afe65d91ef6e8(state.visibleRange.start, state.visibleRange.end, state.timeZone, true);
  $4f58c5f72bcf79f7$export$496315a1608d9602(() => {
    if (!state.isFocused)
      $319e236875307eab$export$a9b970dcc4ae71a9(visibleRangeDescription);
  }, [
    visibleRangeDescription
  ]);
  let selectedDateDescription = $a074e1e2d0f0a665$export$b6df97c887c38e1a(state);
  $4f58c5f72bcf79f7$export$496315a1608d9602(() => {
    if (selectedDateDescription)
      $319e236875307eab$export$a9b970dcc4ae71a9(selectedDateDescription, "polite", 4e3);
  }, [
    selectedDateDescription
  ]);
  let errorMessageId = $bdb11010cef70236$export$b4cc09c592e8fdb8$1([
    Boolean(props.errorMessage),
    props.isInvalid,
    props.validationState
  ]);
  $a074e1e2d0f0a665$export$653eddfc964b0f8a.set(state, {
    ariaLabel: props["aria-label"],
    ariaLabelledBy: props["aria-labelledby"],
    errorMessageId,
    selectedDateDescription
  });
  let [nextFocused, setNextFocused] = reactExports.useState(false);
  let nextDisabled = props.isDisabled || state.isNextVisibleRangeInvalid();
  if (nextDisabled && nextFocused) {
    setNextFocused(false);
    state.setFocused(true);
  }
  let [previousFocused, setPreviousFocused] = reactExports.useState(false);
  let previousDisabled = props.isDisabled || state.isPreviousVisibleRangeInvalid();
  if (previousDisabled && previousFocused) {
    setPreviousFocused(false);
    state.setFocused(true);
  }
  let labelProps = $313b98861ee5dd6c$export$d6875122194c7b44$1({
    id: props["id"],
    "aria-label": [
      props["aria-label"],
      visibleRangeDescription
    ].filter(Boolean).join(", "),
    "aria-labelledby": props["aria-labelledby"]
  });
  return {
    calendarProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, labelProps, {
      role: "application",
      "aria-details": props["aria-details"] || void 0,
      "aria-describedby": props["aria-describedby"] || void 0
    }),
    nextButtonProps: {
      onPress: () => state.focusNextPage(),
      "aria-label": stringFormatter.format("next"),
      isDisabled: nextDisabled,
      onFocusChange: setNextFocused
    },
    prevButtonProps: {
      onPress: () => state.focusPreviousPage(),
      "aria-label": stringFormatter.format("previous"),
      isDisabled: previousDisabled,
      onFocusChange: setPreviousFocused
    },
    errorMessageProps: {
      id: errorMessageId
    },
    title
  };
}
function $46a4342aab3d8076$export$87e0539f600c24e5(props, state, ref) {
  let res = $c4acc1de3ab169cf$export$d652b3ea2d672d5b(props, state);
  let isVirtualClick = reactExports.useRef(false);
  let windowRef = reactExports.useRef(typeof window !== "undefined" ? window : null);
  $e9faafb641e167db$export$90fc3a17d93f704c(windowRef, "pointerdown", (e2) => {
    isVirtualClick.current = e2.width === 0 && e2.height === 0;
  });
  let endDragging = (e2) => {
    if (isVirtualClick.current) {
      isVirtualClick.current = false;
      return;
    }
    state.setDragging(false);
    if (!state.anchorDate)
      return;
    let target = e2.target;
    if (ref.current && ref.current.contains(document.activeElement) && (!ref.current.contains(target) || !target.closest('button, [role="button"]')))
      state.selectFocusedDate();
  };
  $e9faafb641e167db$export$90fc3a17d93f704c(windowRef, "pointerup", endDragging);
  res.calendarProps.onBlur = (e2) => {
    if (!ref.current)
      return;
    if ((!e2.relatedTarget || !ref.current.contains(e2.relatedTarget)) && state.anchorDate)
      state.selectFocusedDate();
  };
  $e9faafb641e167db$export$90fc3a17d93f704c(ref, "touchmove", (e2) => {
    if (state.isDragging)
      e2.preventDefault();
  }, {
    passive: false,
    capture: true
  });
  return res;
}
function $e3031d1f8c9d64eb$export$cb95147730a423f5(props, state) {
  let { startDate = state.visibleRange.start, endDate = state.visibleRange.end, firstDayOfWeek } = props;
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let onKeyDown = (e2) => {
    switch (e2.key) {
      case "Enter":
      case " ":
        e2.preventDefault();
        state.selectFocusedDate();
        break;
      case "PageUp":
        e2.preventDefault();
        e2.stopPropagation();
        state.focusPreviousSection(e2.shiftKey);
        break;
      case "PageDown":
        e2.preventDefault();
        e2.stopPropagation();
        state.focusNextSection(e2.shiftKey);
        break;
      case "End":
        e2.preventDefault();
        e2.stopPropagation();
        state.focusSectionEnd();
        break;
      case "Home":
        e2.preventDefault();
        e2.stopPropagation();
        state.focusSectionStart();
        break;
      case "ArrowLeft":
        e2.preventDefault();
        e2.stopPropagation();
        if (direction === "rtl")
          state.focusNextDay();
        else
          state.focusPreviousDay();
        break;
      case "ArrowUp":
        e2.preventDefault();
        e2.stopPropagation();
        state.focusPreviousRow();
        break;
      case "ArrowRight":
        e2.preventDefault();
        e2.stopPropagation();
        if (direction === "rtl")
          state.focusPreviousDay();
        else
          state.focusNextDay();
        break;
      case "ArrowDown":
        e2.preventDefault();
        e2.stopPropagation();
        state.focusNextRow();
        break;
      case "Escape":
        if ("setAnchorDate" in state) {
          e2.preventDefault();
          state.setAnchorDate(null);
        }
        break;
    }
  };
  let visibleRangeDescription = $a074e1e2d0f0a665$export$31afe65d91ef6e8(startDate, endDate, state.timeZone, true);
  let { ariaLabel, ariaLabelledBy } = $a074e1e2d0f0a665$export$653eddfc964b0f8a.get(state);
  let labelProps = $313b98861ee5dd6c$export$d6875122194c7b44$1({
    "aria-label": [
      ariaLabel,
      visibleRangeDescription
    ].filter(Boolean).join(", "),
    "aria-labelledby": ariaLabelledBy
  });
  let dayFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1({
    weekday: props.weekdayStyle || "narrow",
    timeZone: state.timeZone
  });
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let weekDays = reactExports.useMemo(() => {
    let weekStart = $14e0f24ef4ac5c92$export$42c81a444fbfb5d4($14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(state.timeZone), locale2, firstDayOfWeek);
    return [
      ...new Array(7).keys()
    ].map((index2) => {
      let date4 = weekStart.add({
        days: index2
      });
      let dateDay = date4.toDate(state.timeZone);
      return dayFormatter.format(dateDay);
    });
  }, [
    locale2,
    state.timeZone,
    dayFormatter,
    firstDayOfWeek
  ]);
  let weeksInMonth = $14e0f24ef4ac5c92$export$ccc1b2479e7dd654(startDate, locale2, firstDayOfWeek);
  return {
    gridProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(labelProps, {
      role: "grid",
      "aria-readonly": state.isReadOnly || void 0,
      "aria-disabled": state.isDisabled || void 0,
      "aria-multiselectable": "highlightedRange" in state || void 0,
      onKeyDown,
      onFocus: () => state.setFocused(true),
      onBlur: () => state.setFocused(false)
    }),
    headerProps: {
      // Column headers are hidden to screen readers to make navigating with a touch screen reader easier.
      // The day names are already included in the label of each cell, so there's no need to announce them twice.
      "aria-hidden": true
    },
    weekDays,
    weeksInMonth
  };
}
function $parcel$interopDefault$8(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
  let { date: date4, isDisabled } = props;
  let { errorMessageId, selectedDateDescription } = $a074e1e2d0f0a665$export$653eddfc964b0f8a.get(state);
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$8($3904726b442bd9b2$exports), "@react-aria/calendar");
  let dateFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1({
    weekday: "long",
    day: "numeric",
    month: "long",
    year: "numeric",
    era: $a074e1e2d0f0a665$export$134cbb7fb09a9522(date4),
    timeZone: state.timeZone
  });
  let isSelected = state.isSelected(date4);
  let isFocused = state.isCellFocused(date4);
  isDisabled = isDisabled || state.isCellDisabled(date4);
  let isUnavailable = state.isCellUnavailable(date4);
  let isSelectable = !isDisabled && !isUnavailable;
  let isInvalid = state.isValueInvalid && Boolean("highlightedRange" in state ? !state.anchorDate && state.highlightedRange && date4.compare(state.highlightedRange.start) >= 0 && date4.compare(state.highlightedRange.end) <= 0 : state.value && $14e0f24ef4ac5c92$export$ea39ec197993aef0(state.value, date4));
  if (isInvalid)
    isSelected = true;
  date4 = $5a387cc49350e6db$export$722debc0e56fea39(date4, $14e0f24ef4ac5c92$export$91b62ebf2ba703ee);
  let nativeDate = reactExports.useMemo(() => date4.toDate(state.timeZone), [
    date4,
    state.timeZone
  ]);
  let isDateToday = $14e0f24ef4ac5c92$export$629b0a497aa65267(date4, state.timeZone);
  let label = reactExports.useMemo(() => {
    let label2 = "";
    if ("highlightedRange" in state && state.value && !state.anchorDate && ($14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, state.value.start) || $14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, state.value.end)))
      label2 = selectedDateDescription + ", ";
    label2 += dateFormatter.format(nativeDate);
    if (isDateToday)
      label2 = stringFormatter.format(isSelected ? "todayDateSelected" : "todayDate", {
        date: label2
      });
    else if (isSelected)
      label2 = stringFormatter.format("dateSelected", {
        date: label2
      });
    if (state.minValue && $14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, state.minValue))
      label2 += ", " + stringFormatter.format("minimumDate");
    else if (state.maxValue && $14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, state.maxValue))
      label2 += ", " + stringFormatter.format("maximumDate");
    return label2;
  }, [
    dateFormatter,
    nativeDate,
    stringFormatter,
    isSelected,
    isDateToday,
    date4,
    state,
    selectedDateDescription
  ]);
  let rangeSelectionPrompt = "";
  if ("anchorDate" in state && isFocused && !state.isReadOnly && isSelectable) {
    if (state.anchorDate)
      rangeSelectionPrompt = stringFormatter.format("finishRangeSelectionPrompt");
    else
      rangeSelectionPrompt = stringFormatter.format("startRangeSelectionPrompt");
  }
  let descriptionProps = $ef06256079686ba0$export$f8aeda7b10753fa1(rangeSelectionPrompt);
  let isAnchorPressed = reactExports.useRef(false);
  let isRangeBoundaryPressed = reactExports.useRef(false);
  let touchDragTimerRef = reactExports.useRef(void 0);
  let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    // When dragging to select a range, we don't want dragging over the original anchor
    // again to trigger onPressStart. Cancel presses immediately when the pointer exits.
    shouldCancelOnPointerExit: "anchorDate" in state && !!state.anchorDate,
    preventFocusOnPress: true,
    isDisabled: !isSelectable || state.isReadOnly,
    onPressStart(e2) {
      if (state.isReadOnly) {
        state.setFocusedDate(date4);
        return;
      }
      if ("highlightedRange" in state && !state.anchorDate && (e2.pointerType === "mouse" || e2.pointerType === "touch")) {
        if (state.highlightedRange && !isInvalid) {
          if ($14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, state.highlightedRange.start)) {
            state.setAnchorDate(state.highlightedRange.end);
            state.setFocusedDate(date4);
            state.setDragging(true);
            isRangeBoundaryPressed.current = true;
            return;
          } else if ($14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, state.highlightedRange.end)) {
            state.setAnchorDate(state.highlightedRange.start);
            state.setFocusedDate(date4);
            state.setDragging(true);
            isRangeBoundaryPressed.current = true;
            return;
          }
        }
        let startDragging = () => {
          state.setDragging(true);
          touchDragTimerRef.current = void 0;
          state.selectDate(date4);
          state.setFocusedDate(date4);
          isAnchorPressed.current = true;
        };
        if (e2.pointerType === "touch")
          touchDragTimerRef.current = setTimeout(startDragging, 200);
        else
          startDragging();
      }
    },
    onPressEnd() {
      isRangeBoundaryPressed.current = false;
      isAnchorPressed.current = false;
      clearTimeout(touchDragTimerRef.current);
      touchDragTimerRef.current = void 0;
    },
    onPress() {
      if (!("anchorDate" in state) && !state.isReadOnly) {
        state.selectDate(date4);
        state.setFocusedDate(date4);
      }
    },
    onPressUp(e2) {
      if (state.isReadOnly)
        return;
      if ("anchorDate" in state && touchDragTimerRef.current) {
        state.selectDate(date4);
        state.setFocusedDate(date4);
      }
      if ("anchorDate" in state) {
        if (isRangeBoundaryPressed.current)
          state.setAnchorDate(date4);
        else if (state.anchorDate && !isAnchorPressed.current) {
          state.selectDate(date4);
          state.setFocusedDate(date4);
        } else if (e2.pointerType === "keyboard" && !state.anchorDate) {
          state.selectDate(date4);
          let nextDay = date4.add({
            days: 1
          });
          if (state.isInvalid(nextDay))
            nextDay = date4.subtract({
              days: 1
            });
          if (!state.isInvalid(nextDay))
            state.setFocusedDate(nextDay);
        } else if (e2.pointerType === "virtual") {
          state.selectDate(date4);
          state.setFocusedDate(date4);
        }
      }
    }
  });
  let tabIndex = void 0;
  if (!isDisabled)
    tabIndex = $14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, state.focusedDate) ? 0 : -1;
  reactExports.useEffect(() => {
    if (isFocused && ref.current) {
      $7215afc6de606d6b$export$de79e2c695e052f3$5(ref.current);
      if ($507fabe10e71c6fb$export$630ff653c5ada6a9$2() !== "pointer" && document.activeElement === ref.current)
        $2f04cbc44ee30ce0$export$c826860796309d1b(ref.current, {
          containingElement: $62d8ded9296f3872$export$cfa2225e87938781(ref.current)
        });
    }
  }, [
    isFocused,
    ref
  ]);
  let cellDateFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1({
    day: "numeric",
    timeZone: state.timeZone,
    calendar: date4.calendar.identifier
  });
  let formattedDate = reactExports.useMemo(() => cellDateFormatter.formatToParts(nativeDate).find((part) => part.type === "day").value, [
    cellDateFormatter,
    nativeDate
  ]);
  return {
    cellProps: {
      role: "gridcell",
      "aria-disabled": !isSelectable || void 0,
      "aria-selected": isSelected || void 0,
      "aria-invalid": isInvalid || void 0
    },
    buttonProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(pressProps, {
      onFocus() {
        if (!isDisabled)
          state.setFocusedDate(date4);
      },
      tabIndex,
      role: "button",
      "aria-disabled": !isSelectable || void 0,
      "aria-label": label,
      "aria-invalid": isInvalid || void 0,
      "aria-describedby": [
        isInvalid ? errorMessageId : void 0,
        descriptionProps["aria-describedby"]
      ].filter(Boolean).join(" ") || void 0,
      onPointerEnter(e2) {
        if ("highlightDate" in state && (e2.pointerType !== "touch" || state.isDragging) && isSelectable)
          state.highlightDate(date4);
      },
      onPointerDown(e2) {
        if ("releasePointerCapture" in e2.target)
          e2.target.releasePointerCapture(e2.pointerId);
      },
      onContextMenu(e2) {
        e2.preventDefault();
      }
    }),
    isPressed,
    isFocused,
    isSelected,
    isDisabled,
    isUnavailable,
    isOutsideVisibleRange: date4.compare(state.visibleRange.start) < 0 || date4.compare(state.visibleRange.end) > 0,
    isInvalid,
    formattedDate
  };
}
function $f62d864046160412$export$eac50920cf2fd59a(date4, minValue, maxValue) {
  return minValue != null && date4.compare(minValue) < 0 || maxValue != null && date4.compare(maxValue) > 0;
}
function $f62d864046160412$export$f4a51ff076cc9a09(date4, duration2, locale2, minValue, maxValue) {
  let halfDuration = {};
  for (let key in duration2) {
    halfDuration[key] = Math.floor(duration2[key] / 2);
    if (halfDuration[key] > 0 && duration2[key] % 2 === 0)
      halfDuration[key]--;
  }
  let aligned = $f62d864046160412$export$144a00ba6044eb9(date4, duration2, locale2).subtract(halfDuration);
  return $f62d864046160412$export$5bb865b12696a77d(date4, aligned, duration2, locale2, minValue, maxValue);
}
function $f62d864046160412$export$144a00ba6044eb9(date4, duration2, locale2, minValue, maxValue) {
  let aligned = date4;
  if (duration2.years)
    aligned = $14e0f24ef4ac5c92$export$f91e89d3d0406102(date4);
  else if (duration2.months)
    aligned = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(date4);
  else if (duration2.weeks)
    aligned = $14e0f24ef4ac5c92$export$42c81a444fbfb5d4(date4, locale2);
  return $f62d864046160412$export$5bb865b12696a77d(date4, aligned, duration2, locale2, minValue, maxValue);
}
function $f62d864046160412$export$530edbfc915b2b04(date4, duration2, locale2, minValue, maxValue) {
  let d2 = {
    ...duration2
  };
  if (d2.days)
    d2.days--;
  else if (d2.weeks)
    d2.weeks--;
  else if (d2.months)
    d2.months--;
  else if (d2.years)
    d2.years--;
  let aligned = $f62d864046160412$export$144a00ba6044eb9(date4, duration2, locale2).subtract(d2);
  return $f62d864046160412$export$5bb865b12696a77d(date4, aligned, duration2, locale2, minValue, maxValue);
}
function $f62d864046160412$export$5bb865b12696a77d(date4, aligned, duration2, locale2, minValue, maxValue) {
  if (minValue && date4.compare(minValue) >= 0) {
    let newDate = $14e0f24ef4ac5c92$export$a75f2bff57811055(aligned, $f62d864046160412$export$144a00ba6044eb9($11d87f3f76e88657$export$93522d1a439f3617(minValue), duration2, locale2));
    if (newDate)
      aligned = newDate;
  }
  if (maxValue && date4.compare(maxValue) <= 0) {
    let newDate = $14e0f24ef4ac5c92$export$5c333a116e949cdd(aligned, $f62d864046160412$export$530edbfc915b2b04($11d87f3f76e88657$export$93522d1a439f3617(maxValue), duration2, locale2));
    if (newDate)
      aligned = newDate;
  }
  return aligned;
}
function $f62d864046160412$export$4f5203c0d889109e(date4, minValue, maxValue) {
  if (minValue) {
    let newDate = $14e0f24ef4ac5c92$export$a75f2bff57811055(date4, $11d87f3f76e88657$export$93522d1a439f3617(minValue));
    if (newDate)
      date4 = newDate;
  }
  if (maxValue) {
    let newDate = $14e0f24ef4ac5c92$export$5c333a116e949cdd(date4, $11d87f3f76e88657$export$93522d1a439f3617(maxValue));
    if (newDate)
      date4 = newDate;
  }
  return date4;
}
function $f62d864046160412$export$a1d3911297b952d7(date4, minValue, isDateUnavailable) {
  if (!isDateUnavailable)
    return date4;
  while (date4.compare(minValue) >= 0 && isDateUnavailable(date4))
    date4 = date4.subtract({
      days: 1
    });
  if (date4.compare(minValue) >= 0)
    return date4;
  return null;
}
function $458b0a5536c1a7cf$export$40bfa8c7b0832715$2(value2, defaultValue2, onChange) {
  let [stateValue, setStateValue] = reactExports.useState(value2 || defaultValue2);
  let isControlledRef = reactExports.useRef(value2 !== void 0);
  let isControlled = value2 !== void 0;
  reactExports.useEffect(() => {
    isControlledRef.current;
    isControlledRef.current = isControlled;
  }, [
    isControlled
  ]);
  let currentValue = isControlled ? value2 : stateValue;
  let setValue = reactExports.useCallback((value22, ...args) => {
    let onChangeCaller = (value3, ...onChangeArgs) => {
      if (onChange) {
        if (!Object.is(currentValue, value3))
          onChange(value3, ...onChangeArgs);
      }
      if (!isControlled)
        currentValue = value3;
    };
    if (typeof value22 === "function") {
      let updateFunction = (oldValue, ...functionArgs) => {
        let interceptedValue = value22(isControlled ? currentValue : oldValue, ...functionArgs);
        onChangeCaller(interceptedValue, ...args);
        if (!isControlled)
          return interceptedValue;
        return oldValue;
      };
      setStateValue(updateFunction);
    } else {
      if (!isControlled)
        setStateValue(value22);
      onChangeCaller(value22, ...args);
    }
  }, [
    isControlled,
    currentValue,
    onChange
  ]);
  return [
    currentValue,
    setValue
  ];
}
function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
  let defaultFormatter = reactExports.useMemo(() => new $fb18d541ea1ad717$export$ad991b66133851cf(props.locale), [
    props.locale
  ]);
  let resolvedOptions = reactExports.useMemo(() => defaultFormatter.resolvedOptions(), [
    defaultFormatter
  ]);
  let { locale: locale2, createCalendar, visibleDuration = {
    months: 1
  }, minValue, maxValue, selectionAlignment, isDateUnavailable, pageBehavior = "visible", firstDayOfWeek } = props;
  let calendar2 = reactExports.useMemo(() => createCalendar(resolvedOptions.calendar), [
    createCalendar,
    resolvedOptions.calendar
  ]);
  var _props_defaultValue;
  let [value2, setControlledValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$2(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : null, props.onChange);
  let calendarDateValue = reactExports.useMemo(() => value2 ? $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$93522d1a439f3617(value2), calendar2) : null, [
    value2,
    calendar2
  ]);
  let timeZone = reactExports.useMemo(() => value2 && "timeZone" in value2 ? value2.timeZone : resolvedOptions.timeZone, [
    value2,
    resolvedOptions.timeZone
  ]);
  let focusedCalendarDate = reactExports.useMemo(() => props.focusedValue ? $f62d864046160412$export$4f5203c0d889109e($11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$93522d1a439f3617(props.focusedValue), calendar2), minValue, maxValue) : void 0, [
    props.focusedValue,
    calendar2,
    minValue,
    maxValue
  ]);
  let defaultFocusedCalendarDate = reactExports.useMemo(() => $f62d864046160412$export$4f5203c0d889109e(props.defaultFocusedValue ? $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$93522d1a439f3617(props.defaultFocusedValue), calendar2) : calendarDateValue || $11d87f3f76e88657$export$b4a036af3fc0b032($14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(timeZone), calendar2), minValue, maxValue), [
    props.defaultFocusedValue,
    calendarDateValue,
    timeZone,
    calendar2,
    minValue,
    maxValue
  ]);
  let [focusedDate, setFocusedDate] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$2(focusedCalendarDate, defaultFocusedCalendarDate, props.onFocusChange);
  let [startDate, setStartDate] = reactExports.useState(() => {
    switch (selectionAlignment) {
      case "start":
        return $f62d864046160412$export$144a00ba6044eb9(focusedDate, visibleDuration, locale2, minValue, maxValue);
      case "end":
        return $f62d864046160412$export$530edbfc915b2b04(focusedDate, visibleDuration, locale2, minValue, maxValue);
      case "center":
      default:
        return $f62d864046160412$export$f4a51ff076cc9a09(focusedDate, visibleDuration, locale2, minValue, maxValue);
    }
  });
  let [isFocused, setFocused] = reactExports.useState(props.autoFocus || false);
  let endDate = reactExports.useMemo(() => {
    let duration2 = {
      ...visibleDuration
    };
    if (duration2.days)
      duration2.days--;
    else
      duration2.days = -1;
    return startDate.add(duration2);
  }, [
    startDate,
    visibleDuration
  ]);
  let [lastCalendar, setLastCalendar] = reactExports.useState(calendar2);
  if (!$14e0f24ef4ac5c92$export$dbc69fd56b53d5e(calendar2, lastCalendar)) {
    let newFocusedDate = $11d87f3f76e88657$export$b4a036af3fc0b032(focusedDate, calendar2);
    setStartDate($f62d864046160412$export$f4a51ff076cc9a09(newFocusedDate, visibleDuration, locale2, minValue, maxValue));
    setFocusedDate(newFocusedDate);
    setLastCalendar(calendar2);
  }
  if ($f62d864046160412$export$eac50920cf2fd59a(focusedDate, minValue, maxValue))
    setFocusedDate($f62d864046160412$export$4f5203c0d889109e(focusedDate, minValue, maxValue));
  else if (focusedDate.compare(startDate) < 0)
    setStartDate($f62d864046160412$export$530edbfc915b2b04(focusedDate, visibleDuration, locale2, minValue, maxValue));
  else if (focusedDate.compare(endDate) > 0)
    setStartDate($f62d864046160412$export$144a00ba6044eb9(focusedDate, visibleDuration, locale2, minValue, maxValue));
  function focusCell(date4) {
    date4 = $f62d864046160412$export$4f5203c0d889109e(date4, minValue, maxValue);
    setFocusedDate(date4);
  }
  function setValue(newValue) {
    if (!props.isDisabled && !props.isReadOnly) {
      let localValue = newValue;
      if (localValue === null) {
        setControlledValue(null);
        return;
      }
      localValue = $f62d864046160412$export$4f5203c0d889109e(localValue, minValue, maxValue);
      localValue = $f62d864046160412$export$a1d3911297b952d7(localValue, startDate, isDateUnavailable);
      if (!localValue)
        return;
      localValue = $11d87f3f76e88657$export$b4a036af3fc0b032(localValue, (value2 === null || value2 === void 0 ? void 0 : value2.calendar) || new $3b62074eb05584b2$export$80ee6245ec4f29ec());
      if (value2 && "hour" in value2)
        setControlledValue(value2.set(localValue));
      else
        setControlledValue(localValue);
    }
  }
  let isUnavailable = reactExports.useMemo(() => {
    if (!calendarDateValue)
      return false;
    if (isDateUnavailable && isDateUnavailable(calendarDateValue))
      return true;
    return $f62d864046160412$export$eac50920cf2fd59a(calendarDateValue, minValue, maxValue);
  }, [
    calendarDateValue,
    isDateUnavailable,
    minValue,
    maxValue
  ]);
  let isValueInvalid = props.isInvalid || props.validationState === "invalid" || isUnavailable;
  let validationState = isValueInvalid ? "invalid" : null;
  let pageDuration = reactExports.useMemo(() => {
    if (pageBehavior === "visible")
      return visibleDuration;
    return $131cf43a05231e1e$var$unitDuration(visibleDuration);
  }, [
    pageBehavior,
    visibleDuration
  ]);
  var _props_isDisabled, _props_isReadOnly;
  return {
    isDisabled: (_props_isDisabled = props.isDisabled) !== null && _props_isDisabled !== void 0 ? _props_isDisabled : false,
    isReadOnly: (_props_isReadOnly = props.isReadOnly) !== null && _props_isReadOnly !== void 0 ? _props_isReadOnly : false,
    value: calendarDateValue,
    setValue,
    visibleRange: {
      start: startDate,
      end: endDate
    },
    minValue,
    maxValue,
    focusedDate,
    timeZone,
    validationState,
    isValueInvalid,
    setFocusedDate(date4) {
      focusCell(date4);
      setFocused(true);
    },
    focusNextDay() {
      focusCell(focusedDate.add({
        days: 1
      }));
    },
    focusPreviousDay() {
      focusCell(focusedDate.subtract({
        days: 1
      }));
    },
    focusNextRow() {
      if (visibleDuration.days)
        this.focusNextPage();
      else if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years)
        focusCell(focusedDate.add({
          weeks: 1
        }));
    },
    focusPreviousRow() {
      if (visibleDuration.days)
        this.focusPreviousPage();
      else if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years)
        focusCell(focusedDate.subtract({
          weeks: 1
        }));
    },
    focusNextPage() {
      let start2 = startDate.add(pageDuration);
      setFocusedDate($f62d864046160412$export$4f5203c0d889109e(focusedDate.add(pageDuration), minValue, maxValue));
      setStartDate($f62d864046160412$export$144a00ba6044eb9($f62d864046160412$export$5bb865b12696a77d(focusedDate, start2, pageDuration, locale2, minValue, maxValue), pageDuration, locale2));
    },
    focusPreviousPage() {
      let start2 = startDate.subtract(pageDuration);
      setFocusedDate($f62d864046160412$export$4f5203c0d889109e(focusedDate.subtract(pageDuration), minValue, maxValue));
      setStartDate($f62d864046160412$export$144a00ba6044eb9($f62d864046160412$export$5bb865b12696a77d(focusedDate, start2, pageDuration, locale2, minValue, maxValue), pageDuration, locale2));
    },
    focusSectionStart() {
      if (visibleDuration.days)
        focusCell(startDate);
      else if (visibleDuration.weeks)
        focusCell($14e0f24ef4ac5c92$export$42c81a444fbfb5d4(focusedDate, locale2));
      else if (visibleDuration.months || visibleDuration.years)
        focusCell($14e0f24ef4ac5c92$export$a5a3b454ada2268e(focusedDate));
    },
    focusSectionEnd() {
      if (visibleDuration.days)
        focusCell(endDate);
      else if (visibleDuration.weeks)
        focusCell($14e0f24ef4ac5c92$export$ef8b6d9133084f4e(focusedDate, locale2));
      else if (visibleDuration.months || visibleDuration.years)
        focusCell($14e0f24ef4ac5c92$export$a2258d9c4118825c(focusedDate));
    },
    focusNextSection(larger) {
      if (!larger && !visibleDuration.days) {
        focusCell(focusedDate.add($131cf43a05231e1e$var$unitDuration(visibleDuration)));
        return;
      }
      if (visibleDuration.days)
        this.focusNextPage();
      else if (visibleDuration.weeks)
        focusCell(focusedDate.add({
          months: 1
        }));
      else if (visibleDuration.months || visibleDuration.years)
        focusCell(focusedDate.add({
          years: 1
        }));
    },
    focusPreviousSection(larger) {
      if (!larger && !visibleDuration.days) {
        focusCell(focusedDate.subtract($131cf43a05231e1e$var$unitDuration(visibleDuration)));
        return;
      }
      if (visibleDuration.days)
        this.focusPreviousPage();
      else if (visibleDuration.weeks)
        focusCell(focusedDate.subtract({
          months: 1
        }));
      else if (visibleDuration.months || visibleDuration.years)
        focusCell(focusedDate.subtract({
          years: 1
        }));
    },
    selectFocusedDate() {
      if (!(isDateUnavailable && isDateUnavailable(focusedDate)))
        setValue(focusedDate);
    },
    selectDate(date4) {
      setValue(date4);
    },
    isFocused,
    setFocused,
    isInvalid(date4) {
      return $f62d864046160412$export$eac50920cf2fd59a(date4, minValue, maxValue);
    },
    isSelected(date4) {
      return calendarDateValue != null && $14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, calendarDateValue) && !this.isCellDisabled(date4) && !this.isCellUnavailable(date4);
    },
    isCellFocused(date4) {
      return isFocused && focusedDate && $14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, focusedDate);
    },
    isCellDisabled(date4) {
      return props.isDisabled || date4.compare(startDate) < 0 || date4.compare(endDate) > 0 || this.isInvalid(date4);
    },
    isCellUnavailable(date4) {
      return props.isDateUnavailable ? props.isDateUnavailable(date4) : false;
    },
    isPreviousVisibleRangeInvalid() {
      let prev2 = startDate.subtract({
        days: 1
      });
      return $14e0f24ef4ac5c92$export$ea39ec197993aef0(prev2, startDate) || this.isInvalid(prev2);
    },
    isNextVisibleRangeInvalid() {
      let next2 = endDate.add({
        days: 1
      });
      return $14e0f24ef4ac5c92$export$ea39ec197993aef0(next2, endDate) || this.isInvalid(next2);
    },
    getDatesInWeek(weekIndex, from2 = startDate) {
      let date4 = from2.add({
        weeks: weekIndex
      });
      let dates = [];
      date4 = $14e0f24ef4ac5c92$export$42c81a444fbfb5d4(date4, locale2, firstDayOfWeek);
      let dayOfWeek = $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date4, locale2, firstDayOfWeek);
      for (let i2 = 0; i2 < dayOfWeek; i2++)
        dates.push(null);
      while (dates.length < 7) {
        dates.push(date4);
        let nextDate = date4.add({
          days: 1
        });
        if ($14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, nextDate))
          break;
        date4 = nextDate;
      }
      while (dates.length < 7)
        dates.push(null);
      return dates;
    }
  };
}
function $131cf43a05231e1e$var$unitDuration(duration2) {
  let unit2 = {
    ...duration2
  };
  for (let key in duration2)
    unit2[key] = 1;
  return unit2;
}
function $9a36b6ba2fb1a7c5$export$9a987164d97ecc90(props) {
  let { value: valueProp, defaultValue: defaultValue2, onChange, createCalendar, locale: locale2, visibleDuration = {
    months: 1
  }, minValue, maxValue, ...calendarProps } = props;
  let [value2, setValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$2(valueProp, defaultValue2 || null, onChange);
  let [anchorDate, setAnchorDateState] = reactExports.useState(null);
  let alignment = "center";
  if (value2 && value2.start && value2.end) {
    let start2 = $f62d864046160412$export$f4a51ff076cc9a09($11d87f3f76e88657$export$93522d1a439f3617(value2.start), visibleDuration, locale2, minValue, maxValue);
    let end2 = start2.add(visibleDuration).subtract({
      days: 1
    });
    if (value2.end.compare(end2) > 0)
      alignment = "start";
  }
  let availableRangeRef = reactExports.useRef(null);
  let [availableRange, setAvailableRange] = reactExports.useState(null);
  let min2 = reactExports.useMemo(() => $14e0f24ef4ac5c92$export$a75f2bff57811055(minValue, availableRange === null || availableRange === void 0 ? void 0 : availableRange.start), [
    minValue,
    availableRange
  ]);
  let max2 = reactExports.useMemo(() => $14e0f24ef4ac5c92$export$5c333a116e949cdd(maxValue, availableRange === null || availableRange === void 0 ? void 0 : availableRange.end), [
    maxValue,
    availableRange
  ]);
  let calendar2 = $131cf43a05231e1e$export$6d095e787d2b5e1f({
    ...calendarProps,
    value: value2 && value2.start,
    createCalendar,
    locale: locale2,
    visibleDuration,
    minValue: min2,
    maxValue: max2,
    selectionAlignment: alignment
  });
  let updateAvailableRange = (date4) => {
    if (date4 && props.isDateUnavailable && !props.allowsNonContiguousRanges) {
      const nextAvailableStartDate = $9a36b6ba2fb1a7c5$var$nextUnavailableDate(date4, calendar2, -1);
      const nextAvailableEndDate = $9a36b6ba2fb1a7c5$var$nextUnavailableDate(date4, calendar2, 1);
      availableRangeRef.current = {
        start: nextAvailableStartDate,
        end: nextAvailableEndDate
      };
      setAvailableRange(availableRangeRef.current);
    } else {
      availableRangeRef.current = null;
      setAvailableRange(null);
    }
  };
  let [lastVisibleRange, setLastVisibleRange] = reactExports.useState(calendar2.visibleRange);
  if (!$14e0f24ef4ac5c92$export$91b62ebf2ba703ee(calendar2.visibleRange.start, lastVisibleRange.start) || !$14e0f24ef4ac5c92$export$91b62ebf2ba703ee(calendar2.visibleRange.end, lastVisibleRange.end)) {
    updateAvailableRange(anchorDate);
    setLastVisibleRange(calendar2.visibleRange);
  }
  let setAnchorDate = (date4) => {
    if (date4) {
      setAnchorDateState(date4);
      updateAvailableRange(date4);
    } else {
      setAnchorDateState(null);
      updateAvailableRange(null);
    }
  };
  let highlightedRange = anchorDate ? $9a36b6ba2fb1a7c5$var$makeRange(anchorDate, calendar2.focusedDate) : value2 && $9a36b6ba2fb1a7c5$var$makeRange(value2.start, value2.end);
  let selectDate = (date4) => {
    if (props.isReadOnly)
      return;
    const constrainedDate = $f62d864046160412$export$4f5203c0d889109e(date4, min2, max2);
    const previousAvailableConstrainedDate = $f62d864046160412$export$a1d3911297b952d7(constrainedDate, calendar2.visibleRange.start, props.isDateUnavailable);
    if (!previousAvailableConstrainedDate)
      return;
    if (!anchorDate)
      setAnchorDate(previousAvailableConstrainedDate);
    else {
      let range3 = $9a36b6ba2fb1a7c5$var$makeRange(anchorDate, previousAvailableConstrainedDate);
      if (range3)
        setValue({
          start: $9a36b6ba2fb1a7c5$var$convertValue(range3.start, value2 === null || value2 === void 0 ? void 0 : value2.start),
          end: $9a36b6ba2fb1a7c5$var$convertValue(range3.end, value2 === null || value2 === void 0 ? void 0 : value2.end)
        });
      setAnchorDate(null);
    }
  };
  let [isDragging2, setDragging] = reactExports.useState(false);
  let { isDateUnavailable } = props;
  let isInvalidSelection = reactExports.useMemo(() => {
    if (!value2 || anchorDate)
      return false;
    if (isDateUnavailable && (isDateUnavailable(value2.start) || isDateUnavailable(value2.end)))
      return true;
    return $f62d864046160412$export$eac50920cf2fd59a(value2.start, minValue, maxValue) || $f62d864046160412$export$eac50920cf2fd59a(value2.end, minValue, maxValue);
  }, [
    isDateUnavailable,
    value2,
    anchorDate,
    minValue,
    maxValue
  ]);
  let isValueInvalid = props.isInvalid || props.validationState === "invalid" || isInvalidSelection;
  let validationState = isValueInvalid ? "invalid" : null;
  return {
    ...calendar2,
    value: value2,
    setValue,
    anchorDate,
    setAnchorDate,
    highlightedRange,
    validationState,
    isValueInvalid,
    selectFocusedDate() {
      selectDate(calendar2.focusedDate);
    },
    selectDate,
    highlightDate(date4) {
      if (anchorDate)
        calendar2.setFocusedDate(date4);
    },
    isSelected(date4) {
      return Boolean(highlightedRange && date4.compare(highlightedRange.start) >= 0 && date4.compare(highlightedRange.end) <= 0 && !calendar2.isCellDisabled(date4) && !calendar2.isCellUnavailable(date4));
    },
    isInvalid(date4) {
      var _availableRangeRef_current, _availableRangeRef_current1;
      return calendar2.isInvalid(date4) || $f62d864046160412$export$eac50920cf2fd59a(date4, (_availableRangeRef_current = availableRangeRef.current) === null || _availableRangeRef_current === void 0 ? void 0 : _availableRangeRef_current.start, (_availableRangeRef_current1 = availableRangeRef.current) === null || _availableRangeRef_current1 === void 0 ? void 0 : _availableRangeRef_current1.end);
    },
    isDragging: isDragging2,
    setDragging
  };
}
function $9a36b6ba2fb1a7c5$var$makeRange(start2, end2) {
  if (!start2 || !end2)
    return null;
  if (end2.compare(start2) < 0)
    [start2, end2] = [
      end2,
      start2
    ];
  return {
    start: $11d87f3f76e88657$export$93522d1a439f3617(start2),
    end: $11d87f3f76e88657$export$93522d1a439f3617(end2)
  };
}
function $9a36b6ba2fb1a7c5$var$convertValue(newValue, oldValue) {
  newValue = $11d87f3f76e88657$export$b4a036af3fc0b032(newValue, (oldValue === null || oldValue === void 0 ? void 0 : oldValue.calendar) || new $3b62074eb05584b2$export$80ee6245ec4f29ec());
  if (oldValue && "hour" in oldValue)
    return oldValue.set(newValue);
  return newValue;
}
function $9a36b6ba2fb1a7c5$var$nextUnavailableDate(anchorDate, state, dir) {
  let nextDate = anchorDate.add({
    days: dir
  });
  while ((dir < 0 ? nextDate.compare(state.visibleRange.start) >= 0 : nextDate.compare(state.visibleRange.end) <= 0) && !state.isCellUnavailable(nextDate))
    nextDate = nextDate.add({
      days: dir
    });
  if (state.isCellUnavailable(nextDate))
    return nextDate.add({
      days: -dir
    });
}
var ChevronLeftIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    viewBox: "0 0 16 16",
    width: "1em",
    ...props,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "path",
      {
        d: "M10 3.33334L6 8.00001L10 12.6667",
        stroke: "currentColor",
        strokeLinecap: "round",
        strokeLinejoin: "round",
        strokeWidth: "1.5"
      }
    )
  }
);
var ChevronRightIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    viewBox: "0 0 16 16",
    width: "1em",
    ...props,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "path",
      {
        d: "M6 3.33334L10 8.00001L6 12.6667",
        stroke: "currentColor",
        strokeLinecap: "round",
        strokeLinejoin: "round",
        strokeWidth: "1.5"
      }
    )
  }
);
var ChevronDownIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "path",
      {
        d: "M19 9L12 15L5 9",
        stroke: "currentColor",
        strokeLinecap: "round",
        strokeLinejoin: "round",
        strokeWidth: "1.5"
      }
    )
  }
);
var [CalendarProvider, useCalendarContext] = createContext2({
  name: "CalendarContext",
  strict: true,
  errorMessage: "useContext: `context` is undefined. Seems you forgot to wrap component within the CalendarProvider"
});
var transition = {
  type: "spring",
  bounce: 0,
  duration: 0.3
};
var slideVariants = {
  enter: (direction) => ({
    x: `${direction * 100}%`
  }),
  center: {
    x: "0%"
  },
  exit: (direction) => ({
    x: `${direction * -100}%`
  })
};
function CalendarHeader(props) {
  const { direction, date: date4, currentMonth, buttonPickerProps } = props;
  const {
    state,
    slots,
    headerRef,
    showMonthAndYearPickers,
    isHeaderExpanded,
    setIsHeaderExpanded,
    disableAnimation,
    classNames: classNames2
  } = useCalendarContext();
  const monthAndYearDateFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79({
    month: "long",
    era: currentMonth.calendar.identifier === "gregory" && currentMonth.era === "BC" ? "short" : void 0,
    calendar: currentMonth.calendar.identifier,
    timeZone: state.timeZone,
    year: "numeric"
  });
  const monthDateContent = monthAndYearDateFormatter.format(date4.toDate(state.timeZone));
  const headerTitle = /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: disableAnimation ? /* @__PURE__ */ jsxRuntimeExports.jsx(
    "span",
    {
      "aria-hidden": true,
      className: slots == null ? void 0 : slots.title({ class: classNames2 == null ? void 0 : classNames2.title }),
      "data-slot": "title",
      children: monthDateContent
    },
    currentMonth.month
  ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
    m$3.span,
    {
      animate: "center",
      "aria-hidden": true,
      className: slots == null ? void 0 : slots.title({ class: classNames2 == null ? void 0 : classNames2.title }),
      custom: direction,
      "data-slot": "title",
      exit: "exit",
      initial: "enter",
      variants: isHeaderExpanded ? {} : slideVariants,
      children: monthDateContent
    },
    currentMonth.month
  ) });
  const headerProps = {
    ref: headerRef,
    className: slots == null ? void 0 : slots.header({ class: classNames2 == null ? void 0 : classNames2.header }),
    "data-slot": "header"
  };
  const handleKeyDown = reactExports.useCallback(
    (e2) => {
      if (e2.key === "Escape") {
        e2.preventDefault();
        e2.stopPropagation();
        setIsHeaderExpanded == null ? void 0 : setIsHeaderExpanded(false);
      }
    },
    [setIsHeaderExpanded]
  );
  return showMonthAndYearPickers ? /* @__PURE__ */ jsxRuntimeExports.jsx(
    button_default$1,
    {
      ...headerProps,
      "aria-label": "switch to year and month view",
      disableAnimation,
      endContent: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDownIcon, { className: "chevron-icon" }),
      onKeyDown: handleKeyDown,
      ...buttonPickerProps,
      children: headerTitle
    }
  ) : /* @__PURE__ */ jsxRuntimeExports.jsx("header", { ...headerProps, children: headerTitle });
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$2 = false;
let $6179b936705e76d3$var$hoverCount$2 = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$2() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$2 = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$2 = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$2(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$2();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$2() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$2);
  $6179b936705e76d3$var$hoverCount$2++;
  return () => {
    $6179b936705e76d3$var$hoverCount$2--;
    if ($6179b936705e76d3$var$hoverCount$2 > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$2);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$2(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$2, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$2 && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
function CalendarCell(originalProps) {
  const { state, slots, isPickerVisible, currentMonth, classNames: classNames2, firstDayOfWeek, ...props } = originalProps;
  const ref = reactExports.useRef(null);
  const {
    cellProps,
    buttonProps,
    isPressed,
    isSelected,
    isDisabled,
    isFocused,
    isInvalid,
    formattedDate
  } = $36a0ac60f04457c5$export$136073280381448e(
    {
      ...props,
      isDisabled: !$14e0f24ef4ac5c92$export$a18c89cbd24170ff(props.date, currentMonth) || isPickerVisible
    },
    state,
    ref
  );
  const isUnavailable = state.isCellUnavailable(props.date);
  const isLastSelectedBeforeDisabled = !isDisabled && !isInvalid && state.isCellUnavailable(props.date.add({ days: 1 }));
  const isFirstSelectedAfterDisabled = !isDisabled && !isInvalid && state.isCellUnavailable(props.date.subtract({ days: 1 }));
  const highlightedRange = "highlightedRange" in state && state.highlightedRange;
  const isSelectionStart = isSelected && highlightedRange ? $14e0f24ef4ac5c92$export$ea39ec197993aef0(props.date, highlightedRange.start) : false;
  const isSelectionEnd = isSelected && highlightedRange ? $14e0f24ef4ac5c92$export$ea39ec197993aef0(props.date, highlightedRange.end) : false;
  const { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$3();
  const dayOfWeek = $14e0f24ef4ac5c92$export$2061056d06d7cdf7(props.date, locale2, firstDayOfWeek);
  const isRangeStart = isSelected && (isFirstSelectedAfterDisabled || dayOfWeek === 0 || props.date.day === 1);
  const isRangeEnd = isSelected && (isLastSelectedBeforeDisabled || dayOfWeek === 6 || props.date.day === currentMonth.calendar.getDaysInMonth(currentMonth));
  const { focusProps, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456$2({
    isDisabled: isDisabled || isUnavailable || state.isReadOnly
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: slots == null ? void 0 : slots.cell({ class: classNames2 == null ? void 0 : classNames2.cell }), "data-slot": "cell", ...cellProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    "span",
    {
      ...mergeProps$3(buttonProps, hoverProps, focusProps),
      ref,
      className: slots == null ? void 0 : slots.cellButton({ class: classNames2 == null ? void 0 : classNames2.cellButton }),
      "data-disabled": dataAttr(isDisabled && !isInvalid),
      "data-focus-visible": dataAttr(isFocused && isFocusVisible),
      "data-hover": dataAttr(isHovered),
      "data-invalid": dataAttr(isInvalid),
      "data-outside-month": dataAttr(!$14e0f24ef4ac5c92$export$a18c89cbd24170ff(props.date, currentMonth)),
      "data-pressed": dataAttr(isPressed && !state.isReadOnly),
      "data-range-end": dataAttr(isRangeEnd),
      "data-range-selection": dataAttr(isSelected && "highlightedRange" in state),
      "data-range-start": dataAttr(isRangeStart),
      "data-readonly": dataAttr(state.isReadOnly),
      "data-selected": dataAttr(isSelected),
      "data-selection-end": dataAttr(isSelectionEnd),
      "data-selection-start": dataAttr(isSelectionStart),
      "data-today": dataAttr($14e0f24ef4ac5c92$export$629b0a497aa65267(props.date, state.timeZone)),
      "data-unavailable": dataAttr(isUnavailable),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: formattedDate })
    }
  ) });
}
function CalendarMonth(props) {
  const { startDate, direction, currentMonth, firstDayOfWeek } = props;
  const { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$3();
  const weeksInMonth = $14e0f24ef4ac5c92$export$ccc1b2479e7dd654(startDate, locale2, firstDayOfWeek);
  const { state, slots, weekdayStyle, isHeaderExpanded, disableAnimation, classNames: classNames2 } = useCalendarContext();
  const { gridProps, headerProps, weekDays } = $e3031d1f8c9d64eb$export$cb95147730a423f5(
    {
      ...props,
      weekdayStyle,
      endDate: $14e0f24ef4ac5c92$export$a2258d9c4118825c(startDate),
      firstDayOfWeek
    },
    state
  );
  const bodyContent = [...new Array(weeksInMonth).keys()].map((weekIndex) => /* @__PURE__ */ jsxRuntimeExports.jsx(
    "tr",
    {
      className: slots == null ? void 0 : slots.gridBodyRow({ class: classNames2 == null ? void 0 : classNames2.gridBodyRow }),
      "data-slot": "grid-body-row",
      inert: getInertValue(!!isHeaderExpanded),
      children: state.getDatesInWeek(weekIndex, startDate).map(
        (date4, i2) => date4 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
          CalendarCell,
          {
            classNames: classNames2,
            currentMonth: startDate,
            date: date4,
            firstDayOfWeek,
            isPickerVisible: isHeaderExpanded,
            slots,
            state
          },
          i2
        ) : /* @__PURE__ */ jsxRuntimeExports.jsx("td", {}, i2)
      )
    },
    weekIndex
  ));
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "table",
    {
      ...gridProps,
      "aria-hidden": dataAttr(isHeaderExpanded),
      className: slots == null ? void 0 : slots.grid({ class: classNames2 == null ? void 0 : classNames2.grid }),
      "data-slot": "grid",
      tabIndex: -1,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "thead",
          {
            ...headerProps,
            className: slots == null ? void 0 : slots.gridHeader({ class: classNames2 == null ? void 0 : classNames2.gridHeader }),
            "data-slot": "grid-header",
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              "tr",
              {
                className: slots == null ? void 0 : slots.gridHeaderRow({ class: classNames2 == null ? void 0 : classNames2.gridHeaderRow }),
                "data-slot": "grid-header-row",
                children: weekDays.map((day, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
                  "th",
                  {
                    className: slots == null ? void 0 : slots.gridHeaderCell({ class: classNames2 == null ? void 0 : classNames2.gridHeaderCell }),
                    "data-slot": "grid-header-cell",
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: day })
                  },
                  index2
                ))
              }
            )
          }
        ),
        disableAnimation ? /* @__PURE__ */ jsxRuntimeExports.jsx(
          "tbody",
          {
            className: slots == null ? void 0 : slots.gridBody({ class: classNames2 == null ? void 0 : classNames2.gridBody }),
            "data-slot": "grid-body",
            tabIndex: isHeaderExpanded ? -1 : 0,
            children: bodyContent
          },
          currentMonth
        ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
          m$3.tbody,
          {
            animate: "center",
            className: slots == null ? void 0 : slots.gridBody({ class: classNames2 == null ? void 0 : classNames2.gridBody }),
            custom: direction,
            "data-slot": "grid-body",
            exit: "exit",
            initial: "enter",
            variants: slideVariants,
            children: bodyContent
          },
          currentMonth
        )
      ]
    }
  );
}
function getYearRange(start2, end2) {
  const years2 = [];
  if (!start2 || !end2) {
    return years2;
  }
  let current = $14e0f24ef4ac5c92$export$f91e89d3d0406102(start2);
  while (current.compare(end2) <= 0) {
    years2.push(current);
    current = $14e0f24ef4ac5c92$export$f91e89d3d0406102(current.add({ years: 1 }));
  }
  return years2;
}
function addMonths(date4, months2) {
  return date4.add({ months: months2 });
}
function getMonthsInYear(year) {
  const firstMonth = $14e0f24ef4ac5c92$export$f91e89d3d0406102(year);
  const months2 = [firstMonth];
  while (months2.length < 12) {
    const prevMonth = months2[months2.length - 1];
    months2.push(addMonths(prevMonth, 1));
  }
  return months2;
}
var SCROLL_DEBOUNCE_TIME = 200;
function useCalendarPicker(props) {
  var _a2;
  const { date: date4, currentMonth } = props;
  const { slots, state, headerRef, isHeaderExpanded, setIsHeaderExpanded, classNames: classNames2 } = useCalendarContext();
  const highlightRef = reactExports.useRef(null);
  const yearsListRef = reactExports.useRef(null);
  const monthsListRef = reactExports.useRef(null);
  const monthsItemsRef = reactExports.useRef();
  const yearsItemsRef = reactExports.useRef();
  const focusedDateRef = reactExports.useRef(state.focusedDate);
  const monthDateFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79({
    month: "long",
    era: currentMonth.calendar.identifier === "gregory" && currentMonth.era === "BC" ? "short" : void 0,
    calendar: currentMonth.calendar.identifier,
    timeZone: state.timeZone
  });
  const yearDateFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79({
    year: "numeric",
    timeZone: state.timeZone
  });
  const years2 = (_a2 = getYearRange(state.minValue, state.maxValue)) == null ? void 0 : _a2.map((y2) => ({
    value: y2.year,
    label: yearDateFormatter.format(y2.toDate(state.timeZone))
  }));
  const months2 = getMonthsInYear(date4).map((m2) => ({
    value: m2.month,
    label: monthDateFormatter.format(m2.toDate(state.timeZone))
  }));
  function getItemsRefMap(itemsRef) {
    if (!itemsRef.current) {
      itemsRef.current = /* @__PURE__ */ new Map();
    }
    return itemsRef.current;
  }
  function getItemRef(node2, value2, list2) {
    const map2 = getItemsRefMap(list2 === "months" ? monthsItemsRef : yearsItemsRef);
    if (node2) {
      map2.set(value2, node2);
    } else {
      map2.delete(value2);
    }
  }
  const handleListScroll = reactExports.useCallback(
    (e2, highlightEl, list2) => {
      if (!(e2.target instanceof HTMLElement) || !highlightEl)
        return;
      const map2 = getItemsRefMap(list2 === "months" ? monthsItemsRef : yearsItemsRef);
      const items = Array.from(map2.entries());
      const highlightRect = highlightEl.getBoundingClientRect();
      const highlightCenter = {
        x: highlightRect.left + highlightRect.width / 2,
        y: highlightRect.top + highlightRect.height / 2
      };
      let closestItem = null;
      let minDistance = Infinity;
      for (const [value2, itemEl] of items) {
        const itemRect = itemEl.getBoundingClientRect();
        const itemCenter = {
          x: itemRect.left + itemRect.width / 2,
          y: itemRect.top + itemRect.height / 2
        };
        const distance2 = Math.sqrt(
          Math.pow(highlightCenter.x - itemCenter.x, 2) + Math.pow(highlightCenter.y - itemCenter.y, 2)
        );
        if (distance2 < minDistance) {
          minDistance = distance2;
          closestItem = [value2, itemEl];
        }
      }
      if (!closestItem)
        return;
      const [itemValue] = closestItem;
      const updatedDate = focusedDateRef.current.set(
        list2 === "months" ? { month: itemValue } : { year: itemValue }
      );
      state.setFocusedDate(updatedDate);
    },
    [isHeaderExpanded]
  );
  reactExports.useEffect(() => {
    focusedDateRef.current = state.focusedDate;
  }, [state.focusedDate]);
  reactExports.useEffect(() => {
    if (!isHeaderExpanded)
      return;
    scrollTo(date4.month, "months", false);
    scrollTo(date4.year, "years", false);
  }, [isHeaderExpanded]);
  reactExports.useEffect(() => {
    const monthsList = monthsListRef.current;
    const yearsList = yearsListRef.current;
    const highlightEl = highlightRef.current;
    if (!highlightEl)
      return;
    const debouncedHandleMonthsScroll = debounce$5(
      (e2) => handleListScroll(e2, highlightEl, "months"),
      SCROLL_DEBOUNCE_TIME
    );
    const debouncedHandleYearsScroll = debounce$5(
      (e2) => handleListScroll(e2, highlightEl, "years"),
      SCROLL_DEBOUNCE_TIME
    );
    monthsList == null ? void 0 : monthsList.addEventListener("scroll", debouncedHandleMonthsScroll);
    yearsList == null ? void 0 : yearsList.addEventListener("scroll", debouncedHandleYearsScroll);
    return () => {
      if (debouncedHandleMonthsScroll) {
        monthsList == null ? void 0 : monthsList.removeEventListener("scroll", debouncedHandleMonthsScroll);
      }
      if (debouncedHandleYearsScroll) {
        yearsList == null ? void 0 : yearsList.removeEventListener("scroll", debouncedHandleYearsScroll);
      }
    };
  }, [handleListScroll]);
  function scrollTo(value2, list2, smooth = true) {
    const mapListRef = list2 === "months" ? monthsItemsRef : yearsItemsRef;
    const listRef = list2 === "months" ? monthsListRef : yearsListRef;
    const map2 = getItemsRefMap(mapListRef);
    const node2 = map2.get(value2);
    if (!node2)
      return;
    t$7(node2, {
      scrollMode: "always",
      behavior: smooth ? "smooth" : "auto",
      boundary: listRef.current
    });
  }
  const onPickerItemPressed = reactExports.useCallback(
    (e2, list2) => {
      const target = e2.target;
      const value2 = Number(target.getAttribute("data-value"));
      if (!value2)
        return;
      scrollTo(value2, list2);
    },
    [state]
  );
  const onPickerItemKeyDown = reactExports.useCallback(
    (e2, value2, list2) => {
      var _a22;
      const map2 = getItemsRefMap(list2 === "months" ? monthsItemsRef : yearsItemsRef);
      const node2 = map2.get(value2);
      if (!node2)
        return;
      let nextValue = value2;
      switch (e2.key) {
        case "ArrowDown":
          nextValue = value2 + 1;
          break;
        case "ArrowUp":
          nextValue = value2 - 1;
          break;
        case "Home":
          nextValue = 0;
          break;
        case "End":
          nextValue = months2.length - 1;
          break;
        case "PageUp":
          nextValue = value2 - 3;
          break;
        case "PageDown":
          nextValue = value2 + 3;
          break;
        case "Escape":
        case "Enter":
        case " ":
          setIsHeaderExpanded == null ? void 0 : setIsHeaderExpanded(false);
          (_a22 = headerRef == null ? void 0 : headerRef.current) == null ? void 0 : _a22.focus();
          return;
      }
      const nextItem = map2.get(nextValue);
      nextItem == null ? void 0 : nextItem.focus();
    },
    [state]
  );
  return {
    state,
    slots,
    classNames: classNames2,
    years: years2,
    months: months2,
    highlightRef,
    monthsListRef,
    yearsListRef,
    getItemRef,
    isHeaderExpanded,
    onPickerItemPressed,
    onPickerItemKeyDown
  };
}
var CalendarPickerItem = reactExports.forwardRef(({ children, autoFocus, isDisabled, onKeyDown, ...otherProps }, ref) => {
  const domRef = useDOMRef(ref);
  const { buttonProps: ariaButtonProps, isPressed } = useAriaButton$1(
    {
      elementType: "button",
      isDisabled,
      onKeyDown,
      ...otherProps
    },
    domRef
  );
  const { isFocusVisible, isFocused, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus
  });
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$2({ isDisabled });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "button",
    {
      ref: domRef,
      "data-disabled": dataAttr(isDisabled),
      "data-focus": dataAttr(isFocused),
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-hover": dataAttr(isHovered),
      "data-pressed": dataAttr(isPressed),
      "data-slot": "picker-item",
      ...mergeProps$3(
        focusProps,
        hoverProps,
        ariaButtonProps,
        filterDOMProps(otherProps, { enabled: true })
      ),
      children
    }
  );
});
CalendarPickerItem.displayName = "CalendarPickerItem";
var EMPTY_ITEMS_OFFSET = 3;
function CalendarPicker(props) {
  const {
    state,
    slots,
    months: months2,
    years: years2,
    highlightRef,
    monthsListRef,
    yearsListRef,
    classNames: classNames2,
    getItemRef,
    isHeaderExpanded,
    onPickerItemPressed,
    onPickerItemKeyDown
  } = useCalendarPicker(props);
  const EmptyItem = reactExports.useCallback(
    (props2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        "aria-hidden": "true",
        className: slots == null ? void 0 : slots.pickerItem({ class: classNames2 == null ? void 0 : classNames2.pickerItem }),
        "data-slot": "picker-item-empty",
        tabIndex: -1,
        ...props2,
        children: " "
      }
    ),
    [slots, classNames2 == null ? void 0 : classNames2.pickerItem]
  );
  const PickerItemWrapper = reactExports.useCallback(
    ({ children }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      Array.from({ length: EMPTY_ITEMS_OFFSET }, (_24, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(EmptyItem, {}, i2)),
      children,
      Array.from({ length: EMPTY_ITEMS_OFFSET }, (_24, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(EmptyItem, {}, i2))
    ] }),
    [EmptyItem]
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: slots == null ? void 0 : slots.pickerWrapper({
        class: classNames2 == null ? void 0 : classNames2.pickerWrapper
      }),
      "data-slot": "picker-wrapper",
      inert: getInertValue(!isHeaderExpanded),
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            ref: highlightRef,
            className: slots == null ? void 0 : slots.pickerHighlight({ class: classNames2 == null ? void 0 : classNames2.pickerHighlight }),
            "data-slot": "picker-highlight"
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            ref: monthsListRef,
            className: slots == null ? void 0 : slots.pickerMonthList({ class: classNames2 == null ? void 0 : classNames2.pickerMonthList }),
            "data-slot": "picker-month-list",
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(PickerItemWrapper, { children: months2.map((month) => {
              var _a2;
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                CalendarPickerItem,
                {
                  ref: (node2) => getItemRef(node2, month.value, "months"),
                  className: slots == null ? void 0 : slots.pickerItem({ class: classNames2 == null ? void 0 : classNames2.pickerItem }),
                  "data-value": month.value,
                  tabIndex: !isHeaderExpanded || ((_a2 = state.focusedDate) == null ? void 0 : _a2.month) !== month.value ? -1 : 0,
                  onKeyDown: (e2) => onPickerItemKeyDown(e2, month.value, "months"),
                  onPress: (e2) => onPickerItemPressed(e2, "months"),
                  children: month.label
                },
                `picker-month-${month.value}`
              );
            }) })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            ref: yearsListRef,
            className: slots == null ? void 0 : slots.pickerYearList({ class: classNames2 == null ? void 0 : classNames2.pickerYearList }),
            "data-slot": "picker-year-list",
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(PickerItemWrapper, { children: years2.map((year) => {
              var _a2;
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                CalendarPickerItem,
                {
                  ref: (node2) => getItemRef(node2, year.value, "years"),
                  className: slots == null ? void 0 : slots.pickerItem({ class: classNames2 == null ? void 0 : classNames2.pickerItem }),
                  "data-value": year.value,
                  tabIndex: !isHeaderExpanded || ((_a2 = state.focusedDate) == null ? void 0 : _a2.year) !== year.value ? -1 : 0,
                  onKeyDown: (e2) => onPickerItemKeyDown(e2, year.value, "years"),
                  onPress: (e2) => onPickerItemPressed(e2, "years"),
                  children: year.label
                },
                `picker-year-${year.value}`
              );
            }) })
          }
        )
      ]
    }
  );
}
var domAnimation$1 = () => __vitePreload(() => import("./index-kYRJvtWR.js"), true ? __vite__mapDeps([]) : void 0).then((res) => res.default);
var PopLayoutWrapper = reactExports.forwardRef(
  (props, ref) => {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref, ...props });
  }
);
PopLayoutWrapper.displayName = "HeroUI - PopLayoutWrapper";
function CalendarBase(props) {
  const {
    Component: Component2 = "div",
    showHelper,
    topContent,
    bottomContent,
    calendarProps,
    nextButtonProps,
    prevButtonProps,
    buttonPickerProps,
    errorMessageProps,
    calendarRef: ref,
    errorMessage,
    firstDayOfWeek,
    ...otherProps
  } = props;
  const { state, slots, visibleMonths, showMonthAndYearPickers, disableAnimation, classNames: classNames2 } = useCalendarContext();
  const [direction, setDirection] = reactExports.useState(0);
  const { direction: localeDirection } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$3();
  const currentMonth = state.visibleRange.start;
  const headers = [];
  const calendars = [];
  const isRTL = localeDirection === "rtl";
  for (let i2 = 0; i2 < visibleMonths; i2++) {
    let d2 = currentMonth.add({ months: i2 });
    headers.push(
      /* @__PURE__ */ jsxRuntimeExports.jsxs(reactExports.Fragment, { children: [
        i2 === 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
          button_default$1,
          {
            ...isRTL ? nextButtonProps : prevButtonProps,
            onPress: chain(
              isRTL ? nextButtonProps.onPress : prevButtonProps.onPress,
              () => setDirection(-1)
            ),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronLeftIcon, {})
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          CalendarHeader,
          {
            buttonPickerProps,
            currentMonth,
            date: d2,
            direction
          }
        ),
        i2 === visibleMonths - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(
          button_default$1,
          {
            ...isRTL ? prevButtonProps : nextButtonProps,
            onPress: chain(
              isRTL ? prevButtonProps.onPress : nextButtonProps.onPress,
              () => setDirection(1)
            ),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRightIcon, {})
          }
        )
      ] }, `calendar-header-${i2}`)
    );
    const calendarMonthContent = /* @__PURE__ */ reactExports.createElement(
      CalendarMonth,
      {
        ...props,
        key: `calendar-month-${i2}`,
        currentMonth: currentMonth.month,
        direction,
        firstDayOfWeek,
        startDate: d2
      }
    );
    calendars.push(
      showMonthAndYearPickers ? /* @__PURE__ */ jsxRuntimeExports.jsxs(reactExports.Fragment, { children: [
        calendarMonthContent,
        /* @__PURE__ */ jsxRuntimeExports.jsx(CalendarPicker, { currentMonth, date: d2 })
      ] }, `calendar-month-with-pickers-${i2}`) : calendarMonthContent
    );
  }
  const calendarContent = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        className: slots == null ? void 0 : slots.headerWrapper({ class: classNames2 == null ? void 0 : classNames2.headerWrapper }),
        "data-slot": "header-wrapper",
        children: headers
      },
      "header-wrapper"
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        className: slots == null ? void 0 : slots.gridWrapper({ class: classNames2 == null ? void 0 : classNames2.gridWrapper }),
        "data-slot": "grid-wrapper",
        children: calendars
      },
      "grid-wrapper"
    )
  ] });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...mergeProps$3(calendarProps, otherProps), ref, children: [
    topContent,
    /* @__PURE__ */ jsxRuntimeExports.jsx($5c3e21d68f1c4674$export$439d29a4e110a164, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { children: calendarProps["aria-label"] }) }),
    disableAnimation ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: slots == null ? void 0 : slots.content({ class: classNames2 == null ? void 0 : classNames2.content }), "data-slot": "content", children: calendarContent }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
      ResizablePanel,
      {
        className: slots == null ? void 0 : slots.content({ class: classNames2 == null ? void 0 : classNames2.content }),
        "data-slot": "content",
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { custom: direction, initial: false, mode: "popLayout", children: /* @__PURE__ */ jsxRuntimeExports.jsx(PopLayoutWrapper, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(MotionConfig, { transition, children: /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$1, children: calendarContent }) }) }) })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx($5c3e21d68f1c4674$export$439d29a4e110a164, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "button",
      {
        "aria-label": nextButtonProps["aria-label"],
        disabled: nextButtonProps.isDisabled,
        tabIndex: -1,
        onClick: () => state.focusNextPage()
      }
    ) }),
    state.isValueInvalid && showHelper && /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        className: slots == null ? void 0 : slots.helperWrapper({ class: classNames2 == null ? void 0 : classNames2.helperWrapper }),
        "data-slot": "helper-wrapper",
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          "span",
          {
            ...errorMessageProps,
            className: slots == null ? void 0 : slots.errorMessage({ class: classNames2 == null ? void 0 : classNames2.errorMessage }),
            "data-slot": "error-message",
            children: errorMessage || "Selected date unavailable."
          }
        )
      }
    ),
    bottomContent
  ] });
}
function useRangeCalendar({
  buttonPickerProps: buttonPickerPropsProp,
  className,
  ...originalProps
}) {
  const {
    Component: Component2,
    slots,
    children,
    domRef,
    locale: locale2,
    showHelper,
    firstDayOfWeek,
    minValue,
    maxValue,
    weekdayStyle,
    visibleDuration,
    shouldFilterDOMProps,
    isHeaderExpanded,
    visibleMonths,
    disableAnimation,
    createCalendar: createCalendarProp,
    showMonthAndYearPickers,
    baseProps,
    getPrevButtonProps,
    getNextButtonProps,
    getErrorMessageProps,
    setIsHeaderExpanded,
    topContent,
    bottomContent,
    errorMessage,
    classNames: classNames2,
    otherProps
  } = useCalendarBase({ ...originalProps, isRange: true });
  const headerRef = reactExports.useRef(null);
  const state = $9a36b6ba2fb1a7c5$export$9a987164d97ecc90({
    ...originalProps,
    locale: locale2,
    minValue,
    maxValue,
    visibleDuration,
    createCalendar: !createCalendarProp || typeof createCalendarProp !== "function" ? $64244302c3013299$export$dd0bbc9b26defe37 : createCalendarProp
  });
  const { title, calendarProps, prevButtonProps, nextButtonProps, errorMessageProps } = $46a4342aab3d8076$export$87e0539f600c24e5(originalProps, state, domRef);
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const buttonPickerProps = {
    ...buttonPickerPropsProp,
    onPress: chain(buttonPickerPropsProp == null ? void 0 : buttonPickerPropsProp.onPress, () => setIsHeaderExpanded(!isHeaderExpanded))
  };
  const getBaseCalendarProps = (props = {}) => {
    return {
      ...baseProps,
      Component: Component2,
      showHelper,
      firstDayOfWeek,
      topContent,
      bottomContent,
      buttonPickerProps,
      calendarRef: domRef,
      calendarProps,
      prevButtonProps: getPrevButtonProps(prevButtonProps),
      nextButtonProps: getNextButtonProps(nextButtonProps),
      errorMessageProps: getErrorMessageProps(errorMessageProps),
      className: slots.base({ class: baseStyles }),
      errorMessage,
      ...filterDOMProps(otherProps, {
        enabled: shouldFilterDOMProps
      }),
      ...props
    };
  };
  const context = reactExports.useMemo(
    () => ({
      state,
      slots,
      headerRef,
      weekdayStyle,
      isHeaderExpanded,
      setIsHeaderExpanded,
      visibleMonths,
      showMonthAndYearPickers,
      classNames: classNames2,
      disableAnimation
    }),
    [
      state,
      slots,
      classNames2,
      weekdayStyle,
      isHeaderExpanded,
      setIsHeaderExpanded,
      visibleMonths,
      disableAnimation,
      showMonthAndYearPickers
    ]
  );
  return {
    Component: Component2,
    children,
    domRef,
    context,
    state,
    slots,
    title,
    classNames: classNames2,
    getBaseCalendarProps
  };
}
var RangeCalendar = forwardRef(function RangeCalendar2(props, ref) {
  const { context, getBaseCalendarProps } = useRangeCalendar({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(CalendarProvider, { value: context, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CalendarBase, { ...getBaseCalendarProps() }) });
});
var range_calendar_default = RangeCalendar;
var $f23889fffbde9058$exports = {};
$f23889fffbde9058$exports = {
  "calendar": `التقويم`,
  "day": `يوم`,
  "dayPeriod": `ص/م`,
  "endDate": `تاريخ الانتهاء`,
  "era": `العصر`,
  "hour": `الساعات`,
  "minute": `الدقائق`,
  "month": `الشهر`,
  "second": `الثواني`,
  "selectedDateDescription": (args) => `تاريخ محدد: ${args.date}`,
  "selectedRangeDescription": (args) => `المدى الزمني المحدد: ${args.startDate} إلى ${args.endDate}`,
  "selectedTimeDescription": (args) => `الوقت المحدد: ${args.time}`,
  "startDate": `تاريخ البدء`,
  "timeZoneName": `التوقيت`,
  "weekday": `اليوم`,
  "year": `السنة`
};
var $09d9badaa8903929$exports = {};
$09d9badaa8903929$exports = {
  "calendar": `Календар`,
  "day": `ден`,
  "dayPeriod": `пр.об./сл.об.`,
  "endDate": `Крайна дата`,
  "era": `ера`,
  "hour": `час`,
  "minute": `минута`,
  "month": `месец`,
  "second": `секунда`,
  "selectedDateDescription": (args) => `Избрана дата: ${args.date}`,
  "selectedRangeDescription": (args) => `Избран диапазон: ${args.startDate} до ${args.endDate}`,
  "selectedTimeDescription": (args) => `Избрано време: ${args.time}`,
  "startDate": `Начална дата`,
  "timeZoneName": `часова зона`,
  "weekday": `ден от седмицата`,
  "year": `година`
};
var $151b77e0fd711730$exports = {};
$151b77e0fd711730$exports = {
  "calendar": `Kalendář`,
  "day": `den`,
  "dayPeriod": `část dne`,
  "endDate": `Konečné datum`,
  "era": `letopočet`,
  "hour": `hodina`,
  "minute": `minuta`,
  "month": `měsíc`,
  "second": `sekunda`,
  "selectedDateDescription": (args) => `Vybrané datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Vybrané období: ${args.startDate} až ${args.endDate}`,
  "selectedTimeDescription": (args) => `Vybraný čas: ${args.time}`,
  "startDate": `Počáteční datum`,
  "timeZoneName": `časové pásmo`,
  "weekday": `den v týdnu`,
  "year": `rok`
};
var $61915aa8630b90a2$exports = {};
$61915aa8630b90a2$exports = {
  "calendar": `Kalender`,
  "day": `dag`,
  "dayPeriod": `AM/PM`,
  "endDate": `Slutdato`,
  "era": `æra`,
  "hour": `time`,
  "minute": `minut`,
  "month": `måned`,
  "second": `sekund`,
  "selectedDateDescription": (args) => `Valgt dato: ${args.date}`,
  "selectedRangeDescription": (args) => `Valgt interval: ${args.startDate} til ${args.endDate}`,
  "selectedTimeDescription": (args) => `Valgt tidspunkt: ${args.time}`,
  "startDate": `Startdato`,
  "timeZoneName": `tidszone`,
  "weekday": `ugedag`,
  "year": `år`
};
var $35cea00159787840$exports = {};
$35cea00159787840$exports = {
  "calendar": `Kalender`,
  "day": `Tag`,
  "dayPeriod": `Tageshälfte`,
  "endDate": `Enddatum`,
  "era": `Epoche`,
  "hour": `Stunde`,
  "minute": `Minute`,
  "month": `Monat`,
  "second": `Sekunde`,
  "selectedDateDescription": (args) => `Ausgewähltes Datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Ausgewählter Bereich: ${args.startDate} bis ${args.endDate}`,
  "selectedTimeDescription": (args) => `Ausgewählte Zeit: ${args.time}`,
  "startDate": `Anfangsdatum`,
  "timeZoneName": `Zeitzone`,
  "weekday": `Wochentag`,
  "year": `Jahr`
};
var $518b4e82b9eacafd$exports = {};
$518b4e82b9eacafd$exports = {
  "calendar": `Ημερολόγιο`,
  "day": `ημέρα`,
  "dayPeriod": `π.μ./μ.μ.`,
  "endDate": `Ημερομηνία λήξης`,
  "era": `περίοδος`,
  "hour": `ώρα`,
  "minute": `λεπτό`,
  "month": `μήνας`,
  "second": `δευτερόλεπτο`,
  "selectedDateDescription": (args) => `Επιλεγμένη ημερομηνία: ${args.date}`,
  "selectedRangeDescription": (args) => `Επιλεγμένο εύρος: ${args.startDate} έως ${args.endDate}`,
  "selectedTimeDescription": (args) => `Επιλεγμένη ώρα: ${args.time}`,
  "startDate": `Ημερομηνία έναρξης`,
  "timeZoneName": `ζώνη ώρας`,
  "weekday": `καθημερινή`,
  "year": `έτος`
};
var $1c2b297f7e2cf474$exports = {};
$1c2b297f7e2cf474$exports = {
  "era": `era`,
  "year": `year`,
  "month": `month`,
  "day": `day`,
  "hour": `hour`,
  "minute": `minute`,
  "second": `second`,
  "dayPeriod": `AM/PM`,
  "calendar": `Calendar`,
  "startDate": `Start Date`,
  "endDate": `End Date`,
  "weekday": `day of the week`,
  "timeZoneName": `time zone`,
  "selectedDateDescription": (args) => `Selected Date: ${args.date}`,
  "selectedRangeDescription": (args) => `Selected Range: ${args.startDate} to ${args.endDate}`,
  "selectedTimeDescription": (args) => `Selected Time: ${args.time}`
};
var $07f628a707cf9b18$exports = {};
$07f628a707cf9b18$exports = {
  "calendar": `Calendario`,
  "day": `día`,
  "dayPeriod": `a. m./p. m.`,
  "endDate": `Fecha final`,
  "era": `era`,
  "hour": `hora`,
  "minute": `minuto`,
  "month": `mes`,
  "second": `segundo`,
  "selectedDateDescription": (args) => `Fecha seleccionada: ${args.date}`,
  "selectedRangeDescription": (args) => `Rango seleccionado: ${args.startDate} a ${args.endDate}`,
  "selectedTimeDescription": (args) => `Hora seleccionada: ${args.time}`,
  "startDate": `Fecha de inicio`,
  "timeZoneName": `zona horaria`,
  "weekday": `día de la semana`,
  "year": `año`
};
var $db553ffe17c7f4db$exports = {};
$db553ffe17c7f4db$exports = {
  "calendar": `Kalender`,
  "day": `päev`,
  "dayPeriod": `enne/pärast lõunat`,
  "endDate": `Lõppkuupäev`,
  "era": `ajastu`,
  "hour": `tund`,
  "minute": `minut`,
  "month": `kuu`,
  "second": `sekund`,
  "selectedDateDescription": (args) => `Valitud kuupäev: ${args.date}`,
  "selectedRangeDescription": (args) => `Valitud vahemik: ${args.startDate} kuni ${args.endDate}`,
  "selectedTimeDescription": (args) => `Valitud aeg: ${args.time}`,
  "startDate": `Alguskuupäev`,
  "timeZoneName": `ajavöönd`,
  "weekday": `nädalapäev`,
  "year": `aasta`
};
var $4afcfe00cd703f83$exports = {};
$4afcfe00cd703f83$exports = {
  "calendar": `Kalenteri`,
  "day": `päivä`,
  "dayPeriod": `vuorokaudenaika`,
  "endDate": `Päättymispäivä`,
  "era": `aikakausi`,
  "hour": `tunti`,
  "minute": `minuutti`,
  "month": `kuukausi`,
  "second": `sekunti`,
  "selectedDateDescription": (args) => `Valittu päivämäärä: ${args.date}`,
  "selectedRangeDescription": (args) => `Valittu aikaväli: ${args.startDate} – ${args.endDate}`,
  "selectedTimeDescription": (args) => `Valittu aika: ${args.time}`,
  "startDate": `Alkamispäivä`,
  "timeZoneName": `aikavyöhyke`,
  "weekday": `viikonpäivä`,
  "year": `vuosi`
};
var $1d2645d18d4c5be0$exports = {};
$1d2645d18d4c5be0$exports = {
  "calendar": `Calendrier`,
  "day": `jour`,
  "dayPeriod": `cadran`,
  "endDate": `Date de fin`,
  "era": `ère`,
  "hour": `heure`,
  "minute": `minute`,
  "month": `mois`,
  "second": `seconde`,
  "selectedDateDescription": (args) => `Date sélectionnée : ${args.date}`,
  "selectedRangeDescription": (args) => `Plage sélectionnée : ${args.startDate} au ${args.endDate}`,
  "selectedTimeDescription": (args) => `Heure choisie : ${args.time}`,
  "startDate": `Date de début`,
  "timeZoneName": `fuseau horaire`,
  "weekday": `jour de la semaine`,
  "year": `année`
};
var $64cb6a9be1f6fa48$exports = {};
$64cb6a9be1f6fa48$exports = {
  "calendar": `לוח שנה`,
  "day": `יום`,
  "dayPeriod": `לפנה״צ/אחה״צ`,
  "endDate": `תאריך סיום`,
  "era": `תקופה`,
  "hour": `שעה`,
  "minute": `דקה`,
  "month": `חודש`,
  "second": `שנייה`,
  "selectedDateDescription": (args) => `תאריך נבחר: ${args.date}`,
  "selectedRangeDescription": (args) => `טווח נבחר: ${args.startDate} עד ${args.endDate}`,
  "selectedTimeDescription": (args) => `זמן נבחר: ${args.time}`,
  "startDate": `תאריך התחלה`,
  "timeZoneName": `אזור זמן`,
  "weekday": `יום בשבוע`,
  "year": `שנה`
};
var $2a1ef2e8050be27a$exports = {};
$2a1ef2e8050be27a$exports = {
  "calendar": `Kalendar`,
  "day": `dan`,
  "dayPeriod": `AM/PM`,
  "endDate": `Datum završetka`,
  "era": `era`,
  "hour": `sat`,
  "minute": `minuta`,
  "month": `mjesec`,
  "second": `sekunda`,
  "selectedDateDescription": (args) => `Odabrani datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Odabrani raspon: ${args.startDate} do ${args.endDate}`,
  "selectedTimeDescription": (args) => `Odabrano vrijeme: ${args.time}`,
  "startDate": `Datum početka`,
  "timeZoneName": `vremenska zona`,
  "weekday": `dan u tjednu`,
  "year": `godina`
};
var $ad429dca102acd0e$exports = {};
$ad429dca102acd0e$exports = {
  "calendar": `Naptár`,
  "day": `nap`,
  "dayPeriod": `napszak`,
  "endDate": `Befejező dátum`,
  "era": `éra`,
  "hour": `óra`,
  "minute": `perc`,
  "month": `hónap`,
  "second": `másodperc`,
  "selectedDateDescription": (args) => `Kijelölt dátum: ${args.date}`,
  "selectedRangeDescription": (args) => `Kijelölt tartomány: ${args.startDate}–${args.endDate}`,
  "selectedTimeDescription": (args) => `Kijelölt idő: ${args.time}`,
  "startDate": `Kezdő dátum`,
  "timeZoneName": `időzóna`,
  "weekday": `hét napja`,
  "year": `év`
};
var $6e68cb5d1cb97bd2$exports = {};
$6e68cb5d1cb97bd2$exports = {
  "calendar": `Calendario`,
  "day": `giorno`,
  "dayPeriod": `AM/PM`,
  "endDate": `Data finale`,
  "era": `era`,
  "hour": `ora`,
  "minute": `minuto`,
  "month": `mese`,
  "second": `secondo`,
  "selectedDateDescription": (args) => `Data selezionata: ${args.date}`,
  "selectedRangeDescription": (args) => `Intervallo selezionato: da ${args.startDate} a ${args.endDate}`,
  "selectedTimeDescription": (args) => `Ora selezionata: ${args.time}`,
  "startDate": `Data iniziale`,
  "timeZoneName": `fuso orario`,
  "weekday": `giorno della settimana`,
  "year": `anno`
};
var $a82ee9af063ee069$exports = {};
$a82ee9af063ee069$exports = {
  "calendar": `カレンダー`,
  "day": `日`,
  "dayPeriod": `午前/午後`,
  "endDate": `終了日`,
  "era": `時代`,
  "hour": `時`,
  "minute": `分`,
  "month": `月`,
  "second": `秒`,
  "selectedDateDescription": (args) => `選択した日付 : ${args.date}`,
  "selectedRangeDescription": (args) => `選択範囲 : ${args.startDate} から ${args.endDate}`,
  "selectedTimeDescription": (args) => `選択した時間 : ${args.time}`,
  "startDate": `開始日`,
  "timeZoneName": `タイムゾーン`,
  "weekday": `曜日`,
  "year": `年`
};
var $67e9091dbf37d4eb$exports = {};
$67e9091dbf37d4eb$exports = {
  "calendar": `달력`,
  "day": `일`,
  "dayPeriod": `오전/오후`,
  "endDate": `종료일`,
  "era": `연호`,
  "hour": `시`,
  "minute": `분`,
  "month": `월`,
  "second": `초`,
  "selectedDateDescription": (args) => `선택 일자: ${args.date}`,
  "selectedRangeDescription": (args) => `선택 범위: ${args.startDate} ~ ${args.endDate}`,
  "selectedTimeDescription": (args) => `선택 시간: ${args.time}`,
  "startDate": `시작일`,
  "timeZoneName": `시간대`,
  "weekday": `요일`,
  "year": `년`
};
var $75834f9729f653d1$exports = {};
$75834f9729f653d1$exports = {
  "calendar": `Kalendorius`,
  "day": `diena`,
  "dayPeriod": `iki pietų / po pietų`,
  "endDate": `Pabaigos data`,
  "era": `era`,
  "hour": `valanda`,
  "minute": `minutė`,
  "month": `mėnuo`,
  "second": `sekundė`,
  "selectedDateDescription": (args) => `Pasirinkta data: ${args.date}`,
  "selectedRangeDescription": (args) => `Pasirinktas intervalas: nuo ${args.startDate} iki ${args.endDate}`,
  "selectedTimeDescription": (args) => `Pasirinktas laikas: ${args.time}`,
  "startDate": `Pradžios data`,
  "timeZoneName": `laiko juosta`,
  "weekday": `savaitės diena`,
  "year": `metai`
};
var $a2df2c2520b4a7f0$exports = {};
$a2df2c2520b4a7f0$exports = {
  "calendar": `Kalendārs`,
  "day": `diena`,
  "dayPeriod": `priekšpusdienā/pēcpusdienā`,
  "endDate": `Beigu datums`,
  "era": `ēra`,
  "hour": `stundas`,
  "minute": `minūtes`,
  "month": `mēnesis`,
  "second": `sekundes`,
  "selectedDateDescription": (args) => `Atlasītais datums: ${args.date}`,
  "selectedRangeDescription": (args) => `Atlasītais diapazons: no ${args.startDate} līdz ${args.endDate}`,
  "selectedTimeDescription": (args) => `Atlasītais laiks: ${args.time}`,
  "startDate": `Sākuma datums`,
  "timeZoneName": `laika josla`,
  "weekday": `nedēļas diena`,
  "year": `gads`
};
var $aedcd71db4933ed5$exports = {};
$aedcd71db4933ed5$exports = {
  "calendar": `Kalender`,
  "day": `dag`,
  "dayPeriod": `a.m./p.m.`,
  "endDate": `Sluttdato`,
  "era": `tidsalder`,
  "hour": `time`,
  "minute": `minutt`,
  "month": `måned`,
  "second": `sekund`,
  "selectedDateDescription": (args) => `Valgt dato: ${args.date}`,
  "selectedRangeDescription": (args) => `Valgt område: ${args.startDate} til ${args.endDate}`,
  "selectedTimeDescription": (args) => `Valgt tid: ${args.time}`,
  "startDate": `Startdato`,
  "timeZoneName": `tidssone`,
  "weekday": `ukedag`,
  "year": `år`
};
var $3b2df9e54353046c$exports = {};
$3b2df9e54353046c$exports = {
  "calendar": `Kalender`,
  "day": `dag`,
  "dayPeriod": `a.m./p.m.`,
  "endDate": `Einddatum`,
  "era": `tijdperk`,
  "hour": `uur`,
  "minute": `minuut`,
  "month": `maand`,
  "second": `seconde`,
  "selectedDateDescription": (args) => `Geselecteerde datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Geselecteerd bereik: ${args.startDate} tot ${args.endDate}`,
  "selectedTimeDescription": (args) => `Geselecteerde tijd: ${args.time}`,
  "startDate": `Startdatum`,
  "timeZoneName": `tijdzone`,
  "weekday": `dag van de week`,
  "year": `jaar`
};
var $c03fe977fcfafe93$exports = {};
$c03fe977fcfafe93$exports = {
  "calendar": `Kalendarz`,
  "day": `dzień`,
  "dayPeriod": `rano / po południu / wieczorem`,
  "endDate": `Data końcowa`,
  "era": `era`,
  "hour": `godzina`,
  "minute": `minuta`,
  "month": `miesiąc`,
  "second": `sekunda`,
  "selectedDateDescription": (args) => `Wybrana data: ${args.date}`,
  "selectedRangeDescription": (args) => `Wybrany zakres: ${args.startDate} do ${args.endDate}`,
  "selectedTimeDescription": (args) => `Wybrany czas: ${args.time}`,
  "startDate": `Data początkowa`,
  "timeZoneName": `strefa czasowa`,
  "weekday": `dzień tygodnia`,
  "year": `rok`
};
var $569f006fc292345f$exports = {};
$569f006fc292345f$exports = {
  "calendar": `Calendário`,
  "day": `dia`,
  "dayPeriod": `AM/PM`,
  "endDate": `Data final`,
  "era": `era`,
  "hour": `hora`,
  "minute": `minuto`,
  "month": `mês`,
  "second": `segundo`,
  "selectedDateDescription": (args) => `Data selecionada: ${args.date}`,
  "selectedRangeDescription": (args) => `Intervalo selecionado: ${args.startDate} a ${args.endDate}`,
  "selectedTimeDescription": (args) => `Hora selecionada: ${args.time}`,
  "startDate": `Data inicial`,
  "timeZoneName": `fuso horário`,
  "weekday": `dia da semana`,
  "year": `ano`
};
var $7c2494e14452f2dd$exports = {};
$7c2494e14452f2dd$exports = {
  "calendar": `Calendário`,
  "day": `dia`,
  "dayPeriod": `am/pm`,
  "endDate": `Data de Término`,
  "era": `era`,
  "hour": `hora`,
  "minute": `minuto`,
  "month": `mês`,
  "second": `segundo`,
  "selectedDateDescription": (args) => `Data selecionada: ${args.date}`,
  "selectedRangeDescription": (args) => `Intervalo selecionado: ${args.startDate} a ${args.endDate}`,
  "selectedTimeDescription": (args) => `Hora selecionada: ${args.time}`,
  "startDate": `Data de Início`,
  "timeZoneName": `fuso horário`,
  "weekday": `dia da semana`,
  "year": `ano`
};
var $eb82ef981b5592bf$exports = {};
$eb82ef981b5592bf$exports = {
  "calendar": `Calendar`,
  "day": `zi`,
  "dayPeriod": `a.m/p.m.`,
  "endDate": `Dată final`,
  "era": `eră`,
  "hour": `oră`,
  "minute": `minut`,
  "month": `lună`,
  "second": `secundă`,
  "selectedDateDescription": (args) => `Dată selectată: ${args.date}`,
  "selectedRangeDescription": (args) => `Interval selectat: de la ${args.startDate} până la ${args.endDate}`,
  "selectedTimeDescription": (args) => `Ora selectată: ${args.time}`,
  "startDate": `Dată început`,
  "timeZoneName": `fus orar`,
  "weekday": `ziua din săptămână`,
  "year": `an`
};
var $6efa0e119f396950$exports = {};
$6efa0e119f396950$exports = {
  "calendar": `Календарь`,
  "day": `день`,
  "dayPeriod": `AM/PM`,
  "endDate": `Дата окончания`,
  "era": `эра`,
  "hour": `час`,
  "minute": `минута`,
  "month": `месяц`,
  "second": `секунда`,
  "selectedDateDescription": (args) => `Выбранная дата: ${args.date}`,
  "selectedRangeDescription": (args) => `Выбранный диапазон: с ${args.startDate} по ${args.endDate}`,
  "selectedTimeDescription": (args) => `Выбранное время: ${args.time}`,
  "startDate": `Дата начала`,
  "timeZoneName": `часовой пояс`,
  "weekday": `день недели`,
  "year": `год`
};
var $7f5e57085d7f5049$exports = {};
$7f5e57085d7f5049$exports = {
  "calendar": `Kalendár`,
  "day": `deň`,
  "dayPeriod": `AM/PM`,
  "endDate": `Dátum ukončenia`,
  "era": `letopočet`,
  "hour": `hodina`,
  "minute": `minúta`,
  "month": `mesiac`,
  "second": `sekunda`,
  "selectedDateDescription": (args) => `Vybratý dátum: ${args.date}`,
  "selectedRangeDescription": (args) => `Vybratý rozsah: od ${args.startDate} do ${args.endDate}`,
  "selectedTimeDescription": (args) => `Vybratý čas: ${args.time}`,
  "startDate": `Dátum začatia`,
  "timeZoneName": `časové pásmo`,
  "weekday": `deň týždňa`,
  "year": `rok`
};
var $578ee7c11dcdde7a$exports = {};
$578ee7c11dcdde7a$exports = {
  "calendar": `Koledar`,
  "day": `dan`,
  "dayPeriod": `dop/pop`,
  "endDate": `Datum konca`,
  "era": `doba`,
  "hour": `ura`,
  "minute": `minuta`,
  "month": `mesec`,
  "second": `sekunda`,
  "selectedDateDescription": (args) => `Izbrani datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Izbrano območje: ${args.startDate} do ${args.endDate}`,
  "selectedTimeDescription": (args) => `Izbrani čas: ${args.time}`,
  "startDate": `Datum začetka`,
  "timeZoneName": `časovni pas`,
  "weekday": `dan v tednu`,
  "year": `leto`
};
var $bbc3fd6cd0bc9d50$exports = {};
$bbc3fd6cd0bc9d50$exports = {
  "calendar": `Kalendar`,
  "day": `дан`,
  "dayPeriod": `пре подне/по подне`,
  "endDate": `Datum završetka`,
  "era": `ера`,
  "hour": `сат`,
  "minute": `минут`,
  "month": `месец`,
  "second": `секунд`,
  "selectedDateDescription": (args) => `Izabrani datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Izabrani opseg: od ${args.startDate} do ${args.endDate}`,
  "selectedTimeDescription": (args) => `Izabrano vreme: ${args.time}`,
  "startDate": `Datum početka`,
  "timeZoneName": `временска зона`,
  "weekday": `дан у недељи`,
  "year": `година`
};
var $0b04512118591d2a$exports = {};
$0b04512118591d2a$exports = {
  "calendar": `Kalender`,
  "day": `dag`,
  "dayPeriod": `fm/em`,
  "endDate": `Slutdatum`,
  "era": `era`,
  "hour": `timme`,
  "minute": `minut`,
  "month": `månad`,
  "second": `sekund`,
  "selectedDateDescription": (args) => `Valt datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Valt intervall: ${args.startDate} till ${args.endDate}`,
  "selectedTimeDescription": (args) => `Vald tid: ${args.time}`,
  "startDate": `Startdatum`,
  "timeZoneName": `tidszon`,
  "weekday": `veckodag`,
  "year": `år`
};
var $3a49d121fe4c9e1d$exports = {};
$3a49d121fe4c9e1d$exports = {
  "calendar": `Takvim`,
  "day": `gün`,
  "dayPeriod": `ÖÖ/ÖS`,
  "endDate": `Bitiş Tarihi`,
  "era": `çağ`,
  "hour": `saat`,
  "minute": `dakika`,
  "month": `ay`,
  "second": `saniye`,
  "selectedDateDescription": (args) => `Seçilen Tarih: ${args.date}`,
  "selectedRangeDescription": (args) => `Seçilen Aralık: ${args.startDate} - ${args.endDate}`,
  "selectedTimeDescription": (args) => `Seçilen Zaman: ${args.time}`,
  "startDate": `Başlangıç Tarihi`,
  "timeZoneName": `saat dilimi`,
  "weekday": `haftanın günü`,
  "year": `yıl`
};
var $5ba21dbb8914919d$exports = {};
$5ba21dbb8914919d$exports = {
  "calendar": `Календар`,
  "day": `день`,
  "dayPeriod": `дп/пп`,
  "endDate": `Дата завершення`,
  "era": `ера`,
  "hour": `година`,
  "minute": `хвилина`,
  "month": `місяць`,
  "second": `секунда`,
  "selectedDateDescription": (args) => `Вибрана дата: ${args.date}`,
  "selectedRangeDescription": (args) => `Вибраний діапазон: ${args.startDate} — ${args.endDate}`,
  "selectedTimeDescription": (args) => `Вибраний час: ${args.time}`,
  "startDate": `Дата початку`,
  "timeZoneName": `часовий пояс`,
  "weekday": `день тижня`,
  "year": `рік`
};
var $51078838e1b16cd7$exports = {};
$51078838e1b16cd7$exports = {
  "calendar": `日历`,
  "day": `日`,
  "dayPeriod": `上午/下午`,
  "endDate": `结束日期`,
  "era": `纪元`,
  "hour": `小时`,
  "minute": `分钟`,
  "month": `月`,
  "second": `秒`,
  "selectedDateDescription": (args) => `选定的日期：${args.date}`,
  "selectedRangeDescription": (args) => `选定的范围：${args.startDate} 至 ${args.endDate}`,
  "selectedTimeDescription": (args) => `选定的时间：${args.time}`,
  "startDate": `开始日期`,
  "timeZoneName": `时区`,
  "weekday": `工作日`,
  "year": `年`
};
var $33fab8219207655a$exports = {};
$33fab8219207655a$exports = {
  "calendar": `日曆`,
  "day": `日`,
  "dayPeriod": `上午/下午`,
  "endDate": `結束日期`,
  "era": `纪元`,
  "hour": `小时`,
  "minute": `分钟`,
  "month": `月`,
  "second": `秒`,
  "selectedDateDescription": (args) => `選定的日期：${args.date}`,
  "selectedRangeDescription": (args) => `選定的範圍：${args.startDate} 至 ${args.endDate}`,
  "selectedTimeDescription": (args) => `選定的時間：${args.time}`,
  "startDate": `開始日期`,
  "timeZoneName": `时区`,
  "weekday": `工作日`,
  "year": `年`
};
var $dfb4eba373ed9493$exports = {};
$dfb4eba373ed9493$exports = {
  "ar-AE": $f23889fffbde9058$exports,
  "bg-BG": $09d9badaa8903929$exports,
  "cs-CZ": $151b77e0fd711730$exports,
  "da-DK": $61915aa8630b90a2$exports,
  "de-DE": $35cea00159787840$exports,
  "el-GR": $518b4e82b9eacafd$exports,
  "en-US": $1c2b297f7e2cf474$exports,
  "es-ES": $07f628a707cf9b18$exports,
  "et-EE": $db553ffe17c7f4db$exports,
  "fi-FI": $4afcfe00cd703f83$exports,
  "fr-FR": $1d2645d18d4c5be0$exports,
  "he-IL": $64cb6a9be1f6fa48$exports,
  "hr-HR": $2a1ef2e8050be27a$exports,
  "hu-HU": $ad429dca102acd0e$exports,
  "it-IT": $6e68cb5d1cb97bd2$exports,
  "ja-JP": $a82ee9af063ee069$exports,
  "ko-KR": $67e9091dbf37d4eb$exports,
  "lt-LT": $75834f9729f653d1$exports,
  "lv-LV": $a2df2c2520b4a7f0$exports,
  "nb-NO": $aedcd71db4933ed5$exports,
  "nl-NL": $3b2df9e54353046c$exports,
  "pl-PL": $c03fe977fcfafe93$exports,
  "pt-BR": $569f006fc292345f$exports,
  "pt-PT": $7c2494e14452f2dd$exports,
  "ro-RO": $eb82ef981b5592bf$exports,
  "ru-RU": $6efa0e119f396950$exports,
  "sk-SK": $7f5e57085d7f5049$exports,
  "sl-SI": $578ee7c11dcdde7a$exports,
  "sr-SP": $bbc3fd6cd0bc9d50$exports,
  "sv-SE": $0b04512118591d2a$exports,
  "tr-TR": $3a49d121fe4c9e1d$exports,
  "uk-UA": $5ba21dbb8914919d$exports,
  "zh-CN": $51078838e1b16cd7$exports,
  "zh-TW": $33fab8219207655a$exports
};
function $9bf71ea28793e738$var$isTabbableRadio(element2) {
  if (element2.checked)
    return true;
  let radios = [];
  if (!element2.form)
    radios = [
      ...$431fbd86ca7dc216$export$b204af158042fbac$4(element2).querySelectorAll(`input[type="radio"][name="${CSS.escape(element2.name)}"]`)
    ].filter((radio2) => !radio2.form);
  else {
    var _element_form_elements, _element_form;
    let radioList = (_element_form = element2.form) === null || _element_form === void 0 ? void 0 : (_element_form_elements = _element_form.elements) === null || _element_form_elements === void 0 ? void 0 : _element_form_elements.namedItem(element2.name);
    radios = [
      ...radioList !== null && radioList !== void 0 ? radioList : []
    ];
  }
  if (!radios)
    return false;
  let anyChecked = radios.some((radio2) => radio2.checked);
  return !anyChecked;
}
function $9bf71ea28793e738$var$isElementInScope(element2, scope) {
  if (!element2)
    return false;
  if (!scope)
    return false;
  return scope.some((node2) => node2.contains(element2));
}
function $9bf71ea28793e738$var$focusElement(element2, scroll = false) {
  if (element2 != null && !scroll)
    try {
      (0, $3ad3f6e1647bc98d$export$80f3e147d781571c$2)(element2);
    } catch {
    }
  else if (element2 != null)
    try {
      element2.focus();
    } catch {
    }
}
function $9bf71ea28793e738$export$2d6ec8fc375ceafa(root2, opts2, scope) {
  let filter3 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) ? $b4b717babfbb907b$export$bebd5a1431fec25d : $b4b717babfbb907b$export$4c063cf1350e6fed$3;
  let rootElement = (root2 === null || root2 === void 0 ? void 0 : root2.nodeType) === Node.ELEMENT_NODE ? root2 : null;
  let doc = $431fbd86ca7dc216$export$b204af158042fbac$4(rootElement);
  let walker = $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root2 || doc, NodeFilter.SHOW_ELEMENT, {
    acceptNode(node2) {
      var _opts_from;
      if (opts2 === null || opts2 === void 0 ? void 0 : (_opts_from = opts2.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node2))
        return NodeFilter.FILTER_REJECT;
      if ((opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) && node2.tagName === "INPUT" && node2.getAttribute("type") === "radio") {
        if (!$9bf71ea28793e738$var$isTabbableRadio(node2))
          return NodeFilter.FILTER_REJECT;
        if (walker.currentNode.tagName === "INPUT" && walker.currentNode.type === "radio" && walker.currentNode.name === node2.name)
          return NodeFilter.FILTER_REJECT;
      }
      if (filter3(node2) && (!scope || $9bf71ea28793e738$var$isElementInScope(node2, scope)) && (!(opts2 === null || opts2 === void 0 ? void 0 : opts2.accept) || opts2.accept(node2)))
        return NodeFilter.FILTER_ACCEPT;
      return NodeFilter.FILTER_SKIP;
    }
  });
  if (opts2 === null || opts2 === void 0 ? void 0 : opts2.from)
    walker.currentNode = opts2.from;
  return walker;
}
function $9bf71ea28793e738$export$c5251b9e124bf29(ref, defaultOptions2 = {}) {
  return {
    focusNext(opts2 = {}) {
      let root2 = ref.current;
      if (!root2)
        return null;
      let { from: from2, tabbable = defaultOptions2.tabbable, wrap: wrap2 = defaultOptions2.wrap, accept = defaultOptions2.accept } = opts2;
      let node2 = from2 || $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4(root2));
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root2, {
        tabbable,
        accept
      });
      if (root2.contains(node2))
        walker.currentNode = node2;
      let nextNode = walker.nextNode();
      if (!nextNode && wrap2) {
        walker.currentNode = root2;
        nextNode = walker.nextNode();
      }
      if (nextNode)
        $9bf71ea28793e738$var$focusElement(nextNode, true);
      return nextNode;
    },
    focusPrevious(opts2 = defaultOptions2) {
      let root2 = ref.current;
      if (!root2)
        return null;
      let { from: from2, tabbable = defaultOptions2.tabbable, wrap: wrap2 = defaultOptions2.wrap, accept = defaultOptions2.accept } = opts2;
      let node2 = from2 || $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4(root2));
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root2, {
        tabbable,
        accept
      });
      if (root2.contains(node2))
        walker.currentNode = node2;
      else {
        let next2 = $9bf71ea28793e738$var$last(walker);
        if (next2)
          $9bf71ea28793e738$var$focusElement(next2, true);
        return next2 !== null && next2 !== void 0 ? next2 : null;
      }
      let previousNode = walker.previousNode();
      if (!previousNode && wrap2) {
        walker.currentNode = root2;
        let lastNode = $9bf71ea28793e738$var$last(walker);
        if (!lastNode)
          return null;
        previousNode = lastNode;
      }
      if (previousNode)
        $9bf71ea28793e738$var$focusElement(previousNode, true);
      return previousNode !== null && previousNode !== void 0 ? previousNode : null;
    },
    focusFirst(opts2 = defaultOptions2) {
      let root2 = ref.current;
      if (!root2)
        return null;
      let { tabbable = defaultOptions2.tabbable, accept = defaultOptions2.accept } = opts2;
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root2, {
        tabbable,
        accept
      });
      let nextNode = walker.nextNode();
      if (nextNode)
        $9bf71ea28793e738$var$focusElement(nextNode, true);
      return nextNode;
    },
    focusLast(opts2 = defaultOptions2) {
      let root2 = ref.current;
      if (!root2)
        return null;
      let { tabbable = defaultOptions2.tabbable, accept = defaultOptions2.accept } = opts2;
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root2, {
        tabbable,
        accept
      });
      let next2 = $9bf71ea28793e738$var$last(walker);
      if (next2)
        $9bf71ea28793e738$var$focusElement(next2, true);
      return next2 !== null && next2 !== void 0 ? next2 : null;
    }
  };
}
function $9bf71ea28793e738$var$last(walker) {
  let next2 = void 0;
  let last;
  do {
    last = walker.lastChild();
    if (last)
      next2 = last;
  } while (last);
  return next2;
}
class $9bf71ea28793e738$var$Tree8 {
  get size() {
    return this.fastMap.size;
  }
  getTreeNode(data) {
    return this.fastMap.get(data);
  }
  addTreeNode(scopeRef, parent, nodeToRestore) {
    let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
    if (!parentNode)
      return;
    let node2 = new $9bf71ea28793e738$var$TreeNode8({
      scopeRef
    });
    parentNode.addChild(node2);
    node2.parent = parentNode;
    this.fastMap.set(scopeRef, node2);
    if (nodeToRestore)
      node2.nodeToRestore = nodeToRestore;
  }
  addNode(node2) {
    this.fastMap.set(node2.scopeRef, node2);
  }
  removeTreeNode(scopeRef) {
    if (scopeRef === null)
      return;
    let node2 = this.fastMap.get(scopeRef);
    if (!node2)
      return;
    let parentNode = node2.parent;
    for (let current of this.traverse())
      if (current !== node2 && node2.nodeToRestore && current.nodeToRestore && node2.scopeRef && node2.scopeRef.current && $9bf71ea28793e738$var$isElementInScope(current.nodeToRestore, node2.scopeRef.current))
        current.nodeToRestore = node2.nodeToRestore;
    let children = node2.children;
    if (parentNode) {
      parentNode.removeChild(node2);
      if (children.size > 0)
        children.forEach((child) => parentNode && parentNode.addChild(child));
    }
    this.fastMap.delete(node2.scopeRef);
  }
  // Pre Order Depth First
  *traverse(node2 = this.root) {
    if (node2.scopeRef != null)
      yield node2;
    if (node2.children.size > 0)
      for (let child of node2.children)
        yield* this.traverse(child);
  }
  clone() {
    var _node_parent;
    let newTree = new $9bf71ea28793e738$var$Tree8();
    var _node_parent_scopeRef;
    for (let node2 of this.traverse())
      newTree.addTreeNode(node2.scopeRef, (_node_parent_scopeRef = (_node_parent = node2.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node2.nodeToRestore);
    return newTree;
  }
  constructor() {
    this.fastMap = /* @__PURE__ */ new Map();
    this.root = new $9bf71ea28793e738$var$TreeNode8({
      scopeRef: null
    });
    this.fastMap.set(null, this.root);
  }
}
class $9bf71ea28793e738$var$TreeNode8 {
  addChild(node2) {
    this.children.add(node2);
    node2.parent = this;
  }
  removeChild(node2) {
    this.children.delete(node2);
    node2.parent = void 0;
  }
  constructor(props) {
    this.children = /* @__PURE__ */ new Set();
    this.contain = false;
    this.scopeRef = props.scopeRef;
  }
}
new $9bf71ea28793e738$var$Tree8();
function $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref, disableArrowNavigation) {
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let focusManager = reactExports.useMemo(() => $9bf71ea28793e738$export$c5251b9e124bf29(ref), [
    ref
  ]);
  let onKeyDown = (e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    if (e2.altKey && (e2.key === "ArrowDown" || e2.key === "ArrowUp") && "setOpen" in state) {
      e2.preventDefault();
      e2.stopPropagation();
      state.setOpen(true);
    }
    if (disableArrowNavigation)
      return;
    switch (e2.key) {
      case "ArrowLeft":
        e2.preventDefault();
        e2.stopPropagation();
        if (direction === "rtl") {
          if (ref.current) {
            let target = e2.target;
            let prev2 = $3dfb0f96be0d6a08$var$findNextSegment(ref.current, target.getBoundingClientRect().left, -1);
            if (prev2)
              prev2.focus();
          }
        } else
          focusManager.focusPrevious();
        break;
      case "ArrowRight":
        e2.preventDefault();
        e2.stopPropagation();
        if (direction === "rtl") {
          if (ref.current) {
            let target = e2.target;
            let next2 = $3dfb0f96be0d6a08$var$findNextSegment(ref.current, target.getBoundingClientRect().left, 1);
            if (next2)
              next2.focus();
          }
        } else
          focusManager.focusNext();
        break;
    }
  };
  let focusLast = () => {
    var _window_event;
    if (!ref.current)
      return;
    let target = (_window_event = window.event) === null || _window_event === void 0 ? void 0 : _window_event.target;
    let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(ref.current, {
      tabbable: true
    });
    if (target) {
      walker.currentNode = target;
      target = walker.previousNode();
    }
    if (!target) {
      let last;
      do {
        last = walker.lastChild();
        if (last)
          target = last;
      } while (last);
    }
    while (target === null || target === void 0 ? void 0 : target.hasAttribute("data-placeholder")) {
      let prev2 = walker.previousNode();
      if (prev2 && prev2.hasAttribute("data-placeholder"))
        target = prev2;
      else
        break;
    }
    if (target)
      target.focus();
  };
  let { pressProps } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    preventFocusOnPress: true,
    allowTextSelectionOnPress: true,
    onPressStart(e2) {
      if (e2.pointerType === "mouse")
        focusLast();
    },
    onPress(e2) {
      if (e2.pointerType === "touch" || e2.pointerType === "pen")
        focusLast();
    }
  });
  return $3ef42575df84b30b$export$9d1611c77c2fe928$9(pressProps, {
    onKeyDown
  });
}
function $3dfb0f96be0d6a08$var$findNextSegment(group, fromX, direction) {
  let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(group, {
    tabbable: true
  });
  let node2 = walker.nextNode();
  let closest2 = null;
  let closestDistance = Infinity;
  while (node2) {
    let x2 = node2.getBoundingClientRect().left;
    let distance2 = x2 - fromX;
    let absoluteDistance = Math.abs(distance2);
    if (Math.sign(distance2) === direction && absoluteDistance < closestDistance) {
      closest2 = node2;
      closestDistance = absoluteDistance;
    }
    node2 = walker.nextNode();
  }
  return closest2;
}
function $parcel$interopDefault$7(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
const $16f0b7bb276bc17e$export$653eddfc964b0f8a = /* @__PURE__ */ new WeakMap();
const $16f0b7bb276bc17e$export$300019f83c56d282 = "__role_" + Date.now();
const $16f0b7bb276bc17e$export$7b3062cd49e80452 = "__focusManager_" + Date.now();
function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
  var _state_value;
  let { isInvalid, validationErrors, validationDetails } = state.displayValidation;
  let { labelProps, fieldProps, descriptionProps, errorMessageProps } = $2baaea4c71418dea$export$294aa081a6c6f55d$1({
    ...props,
    labelElementType: "span",
    isInvalid,
    errorMessage: props.errorMessage || validationErrors
  });
  let valueOnFocus = reactExports.useRef(null);
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$4({
    ...props,
    onFocusWithin(e2) {
      var _props_onFocus;
      valueOnFocus.current = state.value;
      (_props_onFocus = props.onFocus) === null || _props_onFocus === void 0 ? void 0 : _props_onFocus.call(props, e2);
    },
    onBlurWithin: (e2) => {
      var _props_onBlur;
      state.confirmPlaceholder();
      if (state.value !== valueOnFocus.current)
        state.commitValidation();
      (_props_onBlur = props.onBlur) === null || _props_onBlur === void 0 ? void 0 : _props_onBlur.call(props, e2);
    },
    onFocusWithinChange: props.onFocusChange
  });
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$7($dfb4eba373ed9493$exports), "@react-aria/datepicker");
  let message = state.maxGranularity === "hour" ? "selectedTimeDescription" : "selectedDateDescription";
  let field = state.maxGranularity === "hour" ? "time" : "date";
  let description = state.value ? stringFormatter.format(message, {
    [field]: state.formatValue({
      month: "long"
    })
  }) : "";
  let descProps = $ef06256079686ba0$export$f8aeda7b10753fa1(description);
  let describedBy = props[$16f0b7bb276bc17e$export$300019f83c56d282] === "presentation" ? fieldProps["aria-describedby"] : [
    descProps["aria-describedby"],
    fieldProps["aria-describedby"]
  ].filter(Boolean).join(" ") || void 0;
  let propsFocusManager = props[$16f0b7bb276bc17e$export$7b3062cd49e80452];
  let focusManager = reactExports.useMemo(() => propsFocusManager || $9bf71ea28793e738$export$c5251b9e124bf29(ref), [
    propsFocusManager,
    ref
  ]);
  let groupProps = $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref, props[$16f0b7bb276bc17e$export$300019f83c56d282] === "presentation");
  $16f0b7bb276bc17e$export$653eddfc964b0f8a.set(state, {
    ariaLabel: props["aria-label"],
    ariaLabelledBy: [
      labelProps.id,
      props["aria-labelledby"]
    ].filter(Boolean).join(" ") || void 0,
    ariaDescribedBy: describedBy,
    focusManager
  });
  let autoFocusRef = reactExports.useRef(props.autoFocus);
  let fieldDOMProps;
  if (props[$16f0b7bb276bc17e$export$300019f83c56d282] === "presentation")
    fieldDOMProps = {
      role: "presentation"
    };
  else
    fieldDOMProps = $3ef42575df84b30b$export$9d1611c77c2fe928$9(fieldProps, {
      role: "group",
      "aria-disabled": props.isDisabled || void 0,
      "aria-describedby": describedBy
    });
  reactExports.useEffect(() => {
    if (autoFocusRef.current)
      focusManager.focusFirst();
    autoFocusRef.current = false;
  }, [
    focusManager
  ]);
  $99facab73266f662$export$5add1d006293d136(props.inputRef, state.value, state.setValue);
  $e93e671b31057976$export$b8473d3665f3a75a$1({
    ...props,
    focus() {
      focusManager.focusFirst();
    }
  }, state, props.inputRef);
  let inputProps = {
    type: "hidden",
    name: props.name,
    value: ((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.toString()) || "",
    disabled: props.isDisabled
  };
  if (props.validationBehavior === "native") {
    inputProps.type = "text";
    inputProps.hidden = true;
    inputProps.required = props.isRequired;
    inputProps.onChange = () => {
    };
  }
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props);
  return {
    labelProps: {
      ...labelProps,
      onClick: () => {
        focusManager.focusFirst();
      }
    },
    fieldProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, fieldDOMProps, groupProps, focusWithinProps, {
      onKeyDown(e2) {
        if (props.onKeyDown)
          props.onKeyDown(e2);
      },
      onKeyUp(e2) {
        if (props.onKeyUp)
          props.onKeyUp(e2);
      },
      style: {
        unicodeBidi: "isolate"
      }
    }),
    inputProps,
    descriptionProps,
    errorMessageProps,
    isInvalid,
    validationErrors,
    validationDetails
  };
}
function $16f0b7bb276bc17e$export$4c842f6a241dc825(props, state, ref) {
  var _state_timeValue;
  let res = $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref);
  res.inputProps.value = ((_state_timeValue = state.timeValue) === null || _state_timeValue === void 0 ? void 0 : _state_timeValue.toString()) || "";
  return res;
}
function $parcel$interopDefault$6(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $3aeceb3a64eb8358$export$d42c60378c8168f8() {
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let dictionary = $fca6afa0e843324b$export$87b761675e8eaa10$1($parcel$interopDefault$6($dfb4eba373ed9493$exports), "@react-aria/datepicker");
  return reactExports.useMemo(() => {
    try {
      return new Intl.DisplayNames(locale2, {
        type: "dateTimeField"
      });
    } catch {
      return new $3aeceb3a64eb8358$var$DisplayNamesPolyfill(locale2, dictionary);
    }
  }, [
    locale2,
    dictionary
  ]);
}
class $3aeceb3a64eb8358$var$DisplayNamesPolyfill {
  of(field) {
    return this.dictionary.getStringForLocale(field, this.locale);
  }
  constructor(locale2, dictionary) {
    this.locale = locale2;
    this.dictionary = dictionary;
  }
}
var $ed6aae4e5f766f1e$exports = {};
$ed6aae4e5f766f1e$exports = {
  "Empty": `فارغ`
};
var $38854e2b175151fa$exports = {};
$38854e2b175151fa$exports = {
  "Empty": `Изпразни`
};
var $15b25ab20f3945b2$exports = {};
$15b25ab20f3945b2$exports = {
  "Empty": `Prázdné`
};
var $692a4298b6b649a2$exports = {};
$692a4298b6b649a2$exports = {
  "Empty": `Tom`
};
var $1c6e1539193f1243$exports = {};
$1c6e1539193f1243$exports = {
  "Empty": `Leer`
};
var $1e8678632c464b6d$exports = {};
$1e8678632c464b6d$exports = {
  "Empty": `Άδειο`
};
var $4adc85d9bf5b9eed$exports = {};
$4adc85d9bf5b9eed$exports = {
  "Empty": `Empty`
};
var $41c4b2bb61dafbca$exports = {};
$41c4b2bb61dafbca$exports = {
  "Empty": `Vacío`
};
var $405f8b24f5dd2a60$exports = {};
$405f8b24f5dd2a60$exports = {
  "Empty": `Tühjenda`
};
var $7efe3ed02b9b9dd4$exports = {};
$7efe3ed02b9b9dd4$exports = {
  "Empty": `Tyhjä`
};
var $99fc4c101d92daf3$exports = {};
$99fc4c101d92daf3$exports = {
  "Empty": `Vide`
};
var $f9e155e6e8cacaa2$exports = {};
$f9e155e6e8cacaa2$exports = {
  "Empty": `ריק`
};
var $c31b5e8e9a249fd5$exports = {};
$c31b5e8e9a249fd5$exports = {
  "Empty": `Prazno`
};
var $9c5435bc17499bd9$exports = {};
$9c5435bc17499bd9$exports = {
  "Empty": `Üres`
};
var $6d1fc8e84d8165e1$exports = {};
$6d1fc8e84d8165e1$exports = {
  "Empty": `Vuoto`
};
var $46ea6b3641b83e71$exports = {};
$46ea6b3641b83e71$exports = {
  "Empty": `空`
};
var $0e3cc9a288289dc5$exports = {};
$0e3cc9a288289dc5$exports = {
  "Empty": `비어 있음`
};
var $4ff2bb25c0089ffb$exports = {};
$4ff2bb25c0089ffb$exports = {
  "Empty": `Tuščias`
};
var $6cf33cd4c010a2fb$exports = {};
$6cf33cd4c010a2fb$exports = {
  "Empty": `Tukšs`
};
var $5a9f8486f8b8837e$exports = {};
$5a9f8486f8b8837e$exports = {
  "Empty": `Tom`
};
var $583f94d807f6ecea$exports = {};
$583f94d807f6ecea$exports = {
  "Empty": `Leeg`
};
var $cc4dcfeea2b4050d$exports = {};
$cc4dcfeea2b4050d$exports = {
  "Empty": `Pusty`
};
var $68ac2954d56e12b4$exports = {};
$68ac2954d56e12b4$exports = {
  "Empty": `Vazio`
};
var $fdb0616f309780b0$exports = {};
$fdb0616f309780b0$exports = {
  "Empty": `Vazio`
};
var $fe1eccf4ee1d6f52$exports = {};
$fe1eccf4ee1d6f52$exports = {
  "Empty": `Gol`
};
var $a38b6c4e18725976$exports = {};
$a38b6c4e18725976$exports = {
  "Empty": `Не заполнено`
};
var $6c14ae2b766b652c$exports = {};
$6c14ae2b766b652c$exports = {
  "Empty": `Prázdne`
};
var $8f1c9692e16dc5eb$exports = {};
$8f1c9692e16dc5eb$exports = {
  "Empty": `Prazen`
};
var $d2aa7abea627cafa$exports = {};
$d2aa7abea627cafa$exports = {
  "Empty": `Prazno`
};
var $676b82e4b56408e6$exports = {};
$676b82e4b56408e6$exports = {
  "Empty": `Tomt`
};
var $14c9042552d7ce08$exports = {};
$14c9042552d7ce08$exports = {
  "Empty": `Boş`
};
var $393254ebcb66c9f5$exports = {};
$393254ebcb66c9f5$exports = {
  "Empty": `Пусто`
};
var $d49d621f310cf6ce$exports = {};
$d49d621f310cf6ce$exports = {
  "Empty": `空`
};
var $94b60c866ca5dfe6$exports = {};
$94b60c866ca5dfe6$exports = {
  "Empty": `空白`
};
var $a99895ee3dc79e61$exports = {};
$a99895ee3dc79e61$exports = {
  "ar-AE": $ed6aae4e5f766f1e$exports,
  "bg-BG": $38854e2b175151fa$exports,
  "cs-CZ": $15b25ab20f3945b2$exports,
  "da-DK": $692a4298b6b649a2$exports,
  "de-DE": $1c6e1539193f1243$exports,
  "el-GR": $1e8678632c464b6d$exports,
  "en-US": $4adc85d9bf5b9eed$exports,
  "es-ES": $41c4b2bb61dafbca$exports,
  "et-EE": $405f8b24f5dd2a60$exports,
  "fi-FI": $7efe3ed02b9b9dd4$exports,
  "fr-FR": $99fc4c101d92daf3$exports,
  "he-IL": $f9e155e6e8cacaa2$exports,
  "hr-HR": $c31b5e8e9a249fd5$exports,
  "hu-HU": $9c5435bc17499bd9$exports,
  "it-IT": $6d1fc8e84d8165e1$exports,
  "ja-JP": $46ea6b3641b83e71$exports,
  "ko-KR": $0e3cc9a288289dc5$exports,
  "lt-LT": $4ff2bb25c0089ffb$exports,
  "lv-LV": $6cf33cd4c010a2fb$exports,
  "nb-NO": $5a9f8486f8b8837e$exports,
  "nl-NL": $583f94d807f6ecea$exports,
  "pl-PL": $cc4dcfeea2b4050d$exports,
  "pt-BR": $68ac2954d56e12b4$exports,
  "pt-PT": $fdb0616f309780b0$exports,
  "ro-RO": $fe1eccf4ee1d6f52$exports,
  "ru-RU": $a38b6c4e18725976$exports,
  "sk-SK": $6c14ae2b766b652c$exports,
  "sl-SI": $8f1c9692e16dc5eb$exports,
  "sr-SP": $d2aa7abea627cafa$exports,
  "sv-SE": $676b82e4b56408e6$exports,
  "tr-TR": $14c9042552d7ce08$exports,
  "uk-UA": $393254ebcb66c9f5$exports,
  "zh-CN": $d49d621f310cf6ce$exports,
  "zh-TW": $94b60c866ca5dfe6$exports
};
function $parcel$interopDefault$5(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $d2e8511e6f209edf$export$e908e06f4b8e3402(props) {
  const _async = reactExports.useRef(void 0);
  let { value: value2, textValue, minValue, maxValue, isDisabled, isReadOnly, isRequired, onIncrement, onIncrementPage, onDecrement, onDecrementPage, onDecrementToMin, onIncrementToMax } = props;
  const stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$5($a99895ee3dc79e61$exports), "@react-aria/spinbutton");
  const clearAsync = () => clearTimeout(_async.current);
  reactExports.useEffect(() => {
    return () => clearAsync();
  }, []);
  let onKeyDown = (e2) => {
    if (e2.ctrlKey || e2.metaKey || e2.shiftKey || e2.altKey || isReadOnly || e2.nativeEvent.isComposing)
      return;
    switch (e2.key) {
      case "PageUp":
        if (onIncrementPage) {
          e2.preventDefault();
          onIncrementPage === null || onIncrementPage === void 0 ? void 0 : onIncrementPage();
          break;
        }
      case "ArrowUp":
      case "Up":
        if (onIncrement) {
          e2.preventDefault();
          onIncrement === null || onIncrement === void 0 ? void 0 : onIncrement();
        }
        break;
      case "PageDown":
        if (onDecrementPage) {
          e2.preventDefault();
          onDecrementPage === null || onDecrementPage === void 0 ? void 0 : onDecrementPage();
          break;
        }
      case "ArrowDown":
      case "Down":
        if (onDecrement) {
          e2.preventDefault();
          onDecrement === null || onDecrement === void 0 ? void 0 : onDecrement();
        }
        break;
      case "Home":
        if (onDecrementToMin) {
          e2.preventDefault();
          onDecrementToMin === null || onDecrementToMin === void 0 ? void 0 : onDecrementToMin();
        }
        break;
      case "End":
        if (onIncrementToMax) {
          e2.preventDefault();
          onIncrementToMax === null || onIncrementToMax === void 0 ? void 0 : onIncrementToMax();
        }
        break;
    }
  };
  let isFocused = reactExports.useRef(false);
  let onFocus = () => {
    isFocused.current = true;
  };
  let onBlur = () => {
    isFocused.current = false;
  };
  let ariaTextValue = textValue === "" ? stringFormatter.format("Empty") : (textValue || `${value2}`).replace("-", "−");
  reactExports.useEffect(() => {
    if (isFocused.current) {
      $319e236875307eab$export$d10ae4f68404609a("assertive");
      $319e236875307eab$export$a9b970dcc4ae71a9(ariaTextValue, "assertive");
    }
  }, [
    ariaTextValue
  ]);
  const onIncrementPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((initialStepDelay) => {
    clearAsync();
    onIncrement === null || onIncrement === void 0 ? void 0 : onIncrement();
    _async.current = window.setTimeout(() => {
      if (maxValue === void 0 || isNaN(maxValue) || value2 === void 0 || isNaN(value2) || value2 < maxValue)
        onIncrementPressStart(60);
    }, initialStepDelay);
  });
  const onDecrementPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((initialStepDelay) => {
    clearAsync();
    onDecrement === null || onDecrement === void 0 ? void 0 : onDecrement();
    _async.current = window.setTimeout(() => {
      if (minValue === void 0 || isNaN(minValue) || value2 === void 0 || isNaN(value2) || value2 > minValue)
        onDecrementPressStart(60);
    }, initialStepDelay);
  });
  let cancelContextMenu = (e2) => {
    e2.preventDefault();
  };
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  return {
    spinButtonProps: {
      role: "spinbutton",
      "aria-valuenow": value2 !== void 0 && !isNaN(value2) ? value2 : void 0,
      "aria-valuetext": ariaTextValue,
      "aria-valuemin": minValue,
      "aria-valuemax": maxValue,
      "aria-disabled": isDisabled || void 0,
      "aria-readonly": isReadOnly || void 0,
      "aria-required": isRequired || void 0,
      onKeyDown,
      onFocus,
      onBlur
    },
    incrementButtonProps: {
      onPressStart: () => {
        onIncrementPressStart(400);
        addGlobalListener(window, "contextmenu", cancelContextMenu);
      },
      onPressEnd: () => {
        clearAsync();
        removeAllGlobalListeners();
      },
      onFocus,
      onBlur
    },
    decrementButtonProps: {
      onPressStart: () => {
        onDecrementPressStart(400);
        addGlobalListener(window, "contextmenu", cancelContextMenu);
      },
      onPressEnd: () => {
        clearAsync();
        removeAllGlobalListeners();
      },
      onFocus,
      onBlur
    }
  };
}
function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
  let enteredKeys = reactExports.useRef("");
  let { locale: locale2, direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let displayNames = $3aeceb3a64eb8358$export$d42c60378c8168f8();
  let { ariaLabel, ariaLabelledBy, ariaDescribedBy, focusManager } = $16f0b7bb276bc17e$export$653eddfc964b0f8a.get(state);
  let textValue = segment.isPlaceholder ? "" : segment.text;
  let options = reactExports.useMemo(() => state.dateFormatter.resolvedOptions(), [
    state.dateFormatter
  ]);
  let monthDateFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1({
    month: "long",
    timeZone: options.timeZone
  });
  let hourDateFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1({
    hour: "numeric",
    hour12: options.hour12,
    timeZone: options.timeZone
  });
  if (segment.type === "month" && !segment.isPlaceholder) {
    let monthTextValue = monthDateFormatter.format(state.dateValue);
    textValue = monthTextValue !== textValue ? `${textValue} – ${monthTextValue}` : monthTextValue;
  } else if (segment.type === "hour" && !segment.isPlaceholder)
    textValue = hourDateFormatter.format(state.dateValue);
  let { spinButtonProps } = $d2e8511e6f209edf$export$e908e06f4b8e3402({
    // The ARIA spec says aria-valuenow is optional if there's no value, but aXe seems to require it.
    // This doesn't seem to have any negative effects with real AT since we also use aria-valuetext.
    // https://github.com/dequelabs/axe-core/issues/3505
    value: segment.value,
    textValue,
    minValue: segment.minValue,
    maxValue: segment.maxValue,
    isDisabled: state.isDisabled,
    isReadOnly: state.isReadOnly || !segment.isEditable,
    isRequired: state.isRequired,
    onIncrement: () => {
      enteredKeys.current = "";
      state.increment(segment.type);
    },
    onDecrement: () => {
      enteredKeys.current = "";
      state.decrement(segment.type);
    },
    onIncrementPage: () => {
      enteredKeys.current = "";
      state.incrementPage(segment.type);
    },
    onDecrementPage: () => {
      enteredKeys.current = "";
      state.decrementPage(segment.type);
    },
    onIncrementToMax: () => {
      enteredKeys.current = "";
      if (segment.maxValue !== void 0)
        state.setSegment(segment.type, segment.maxValue);
    },
    onDecrementToMin: () => {
      enteredKeys.current = "";
      if (segment.minValue !== void 0)
        state.setSegment(segment.type, segment.minValue);
    }
  });
  let parser = reactExports.useMemo(() => new $6c7bd7858deea686$export$cd11ab140839f11d(locale2, {
    maximumFractionDigits: 0
  }), [
    locale2
  ]);
  let backspace = () => {
    if (segment.text === segment.placeholder)
      focusManager.focusPrevious();
    if (parser.isValidPartialNumber(segment.text) && !state.isReadOnly && !segment.isPlaceholder) {
      let newValue = segment.text.slice(0, -1);
      let parsed = parser.parse(newValue);
      newValue = parsed === 0 ? "" : newValue;
      if (newValue.length === 0 || parsed === 0)
        state.clearSegment(segment.type);
      else
        state.setSegment(segment.type, parsed);
      enteredKeys.current = newValue;
    } else if (segment.type === "dayPeriod")
      state.clearSegment(segment.type);
  };
  let onKeyDown = (e2) => {
    if (e2.key === "a" && ($c87311424ea30a05$export$9ac100e40613ea10$6() ? e2.metaKey : e2.ctrlKey))
      e2.preventDefault();
    if (e2.ctrlKey || e2.metaKey || e2.shiftKey || e2.altKey)
      return;
    switch (e2.key) {
      case "Backspace":
      case "Delete":
        e2.preventDefault();
        e2.stopPropagation();
        backspace();
        break;
    }
  };
  let { startsWith } = $bb77f239b46e8c72$export$3274cf84b703fff$1({
    sensitivity: "base"
  });
  let amPmFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1({
    hour: "numeric",
    hour12: true
  });
  let am = reactExports.useMemo(() => {
    let date4 = /* @__PURE__ */ new Date();
    date4.setHours(0);
    return amPmFormatter.formatToParts(date4).find((part) => part.type === "dayPeriod").value;
  }, [
    amPmFormatter
  ]);
  let pm = reactExports.useMemo(() => {
    let date4 = /* @__PURE__ */ new Date();
    date4.setHours(12);
    return amPmFormatter.formatToParts(date4).find((part) => part.type === "dayPeriod").value;
  }, [
    amPmFormatter
  ]);
  let eraFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1({
    year: "numeric",
    era: "narrow",
    timeZone: "UTC"
  });
  let eras = reactExports.useMemo(() => {
    if (segment.type !== "era")
      return [];
    let date4 = $11d87f3f76e88657$export$b4a036af3fc0b032(new $35ea8db9cb2ccb90$export$99faa760c7908e4f(1, 1, 1), state.calendar);
    let eras2 = state.calendar.getEras().map((era) => {
      let eraDate = date4.set({
        year: 1,
        month: 1,
        day: 1,
        era
      }).toDate("UTC");
      let parts = eraFormatter.formatToParts(eraDate);
      let formatted = parts.find((p2) => p2.type === "era").value;
      return {
        era,
        formatted
      };
    });
    let prefixLength = $32489daedd52963e$var$commonPrefixLength(eras2.map((era) => era.formatted));
    if (prefixLength)
      for (let era of eras2)
        era.formatted = era.formatted.slice(prefixLength);
    return eras2;
  }, [
    eraFormatter,
    state.calendar,
    segment.type
  ]);
  let onInput = (key) => {
    if (state.isDisabled || state.isReadOnly)
      return;
    let newValue = enteredKeys.current + key;
    switch (segment.type) {
      case "dayPeriod":
        if (startsWith(am, key))
          state.setSegment("dayPeriod", 0);
        else if (startsWith(pm, key))
          state.setSegment("dayPeriod", 12);
        else
          break;
        focusManager.focusNext();
        break;
      case "era": {
        let matched = eras.find((e2) => startsWith(e2.formatted, key));
        if (matched) {
          state.setSegment("era", matched.era);
          focusManager.focusNext();
        }
        break;
      }
      case "day":
      case "hour":
      case "minute":
      case "second":
      case "month":
      case "year": {
        if (!parser.isValidPartialNumber(newValue))
          return;
        let numberValue = parser.parse(newValue);
        let segmentValue = numberValue;
        let allowsZero = segment.minValue === 0;
        if (segment.type === "hour" && state.dateFormatter.resolvedOptions().hour12) {
          switch (state.dateFormatter.resolvedOptions().hourCycle) {
            case "h11":
              if (numberValue > 11)
                segmentValue = parser.parse(key);
              break;
            case "h12":
              allowsZero = false;
              if (numberValue > 12)
                segmentValue = parser.parse(key);
              break;
          }
          if (segment.value !== void 0 && segment.value >= 12 && numberValue > 1)
            numberValue += 12;
        } else if (segment.maxValue !== void 0 && numberValue > segment.maxValue)
          segmentValue = parser.parse(key);
        if (isNaN(numberValue))
          return;
        let shouldSetValue = segmentValue !== 0 || allowsZero;
        if (shouldSetValue)
          state.setSegment(segment.type, segmentValue);
        if (segment.maxValue !== void 0 && (Number(numberValue + "0") > segment.maxValue || newValue.length >= String(segment.maxValue).length)) {
          enteredKeys.current = "";
          if (shouldSetValue)
            focusManager.focusNext();
        } else
          enteredKeys.current = newValue;
        break;
      }
    }
  };
  let onFocus = () => {
    enteredKeys.current = "";
    if (ref.current)
      $2f04cbc44ee30ce0$export$c826860796309d1b(ref.current, {
        containingElement: $62d8ded9296f3872$export$cfa2225e87938781(ref.current)
      });
    let selection = window.getSelection();
    selection === null || selection === void 0 ? void 0 : selection.collapse(ref.current);
  };
  let documentRef = reactExports.useRef(typeof document !== "undefined" ? document : null);
  $e9faafb641e167db$export$90fc3a17d93f704c(documentRef, "selectionchange", () => {
    var _ref_current;
    let selection = window.getSelection();
    if ((selection === null || selection === void 0 ? void 0 : selection.anchorNode) && ((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.contains(selection === null || selection === void 0 ? void 0 : selection.anchorNode)))
      selection.collapse(ref.current);
  });
  let compositionRef = reactExports.useRef("");
  $e9faafb641e167db$export$90fc3a17d93f704c(ref, "beforeinput", (e2) => {
    if (!ref.current)
      return;
    e2.preventDefault();
    switch (e2.inputType) {
      case "deleteContentBackward":
      case "deleteContentForward":
        if (parser.isValidPartialNumber(segment.text) && !state.isReadOnly)
          backspace();
        break;
      case "insertCompositionText":
        compositionRef.current = ref.current.textContent;
        ref.current.textContent = ref.current.textContent;
        break;
      default:
        if (e2.data != null)
          onInput(e2.data);
        break;
    }
  });
  $e9faafb641e167db$export$90fc3a17d93f704c(ref, "input", (e2) => {
    let { inputType, data } = e2;
    switch (inputType) {
      case "insertCompositionText":
        if (ref.current)
          ref.current.textContent = compositionRef.current;
        if (data != null && (startsWith(am, data) || startsWith(pm, data)))
          onInput(data);
        break;
    }
  });
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let element2 = ref.current;
    return () => {
      if (document.activeElement === element2) {
        let prev2 = focusManager.focusPrevious();
        if (!prev2)
          focusManager.focusNext();
      }
    };
  }, [
    ref,
    focusManager
  ]);
  let touchPropOverrides = $c87311424ea30a05$export$fedb369cb70207f1$3() || segment.type === "timeZoneName" ? {
    role: "textbox",
    "aria-valuemax": null,
    "aria-valuemin": null,
    "aria-valuetext": null,
    "aria-valuenow": null
  } : {};
  let firstSegment = reactExports.useMemo(() => state.segments.find((s2) => s2.isEditable), [
    state.segments
  ]);
  if (segment !== firstSegment && !state.isInvalid)
    ariaDescribedBy = void 0;
  let id2 = $bdb11010cef70236$export$f680877a34711e37$2();
  let isEditable = !state.isDisabled && !state.isReadOnly && segment.isEditable;
  let name2 = segment.type === "literal" ? "" : displayNames.of(segment.type);
  let labelProps = $313b98861ee5dd6c$export$d6875122194c7b44$1({
    "aria-label": `${name2}${ariaLabel ? `, ${ariaLabel}` : ""}${ariaLabelledBy ? ", " : ""}`,
    "aria-labelledby": ariaLabelledBy
  });
  if (segment.type === "literal")
    return {
      segmentProps: {
        "aria-hidden": true
      }
    };
  let segmentStyle = {
    caretColor: "transparent"
  };
  if (direction === "rtl") {
    segmentStyle.unicodeBidi = "embed";
    let format2 = options[segment.type];
    if (format2 === "numeric" || format2 === "2-digit")
      segmentStyle.direction = "ltr";
  }
  return {
    segmentProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(spinButtonProps, labelProps, {
      id: id2,
      ...touchPropOverrides,
      "aria-invalid": state.isInvalid ? "true" : void 0,
      "aria-describedby": ariaDescribedBy,
      "aria-readonly": state.isReadOnly || !segment.isEditable ? "true" : void 0,
      "data-placeholder": segment.isPlaceholder || void 0,
      contentEditable: isEditable,
      suppressContentEditableWarning: isEditable,
      spellCheck: isEditable ? "false" : void 0,
      autoCorrect: isEditable ? "off" : void 0,
      // Capitalization was changed in React 17...
      [parseInt(React$5.version, 10) >= 17 ? "enterKeyHint" : "enterkeyhint"]: isEditable ? "next" : void 0,
      inputMode: state.isDisabled || segment.type === "dayPeriod" || segment.type === "era" || !isEditable ? void 0 : "numeric",
      tabIndex: state.isDisabled ? void 0 : 0,
      onKeyDown,
      onFocus,
      style: segmentStyle,
      // Prevent pointer events from reaching useDatePickerGroup, and allow native browser behavior to focus the segment.
      onPointerDown(e2) {
        e2.stopPropagation();
      },
      onMouseDown(e2) {
        e2.stopPropagation();
      }
    })
  };
}
function $32489daedd52963e$var$commonPrefixLength(strings) {
  strings.sort();
  let first = strings[0];
  let last = strings[strings.length - 1];
  for (let i2 = 0; i2 < first.length; i2++) {
    if (first[i2] !== last[i2])
      return i2;
  }
  return 0;
}
function $parcel$interopDefault$4(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
  var _state_value, _state_value1, _state_dateRange;
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$4($dfb4eba373ed9493$exports), "@react-aria/datepicker");
  let { isInvalid, validationErrors, validationDetails } = state.displayValidation;
  let { labelProps, fieldProps, descriptionProps, errorMessageProps } = $2baaea4c71418dea$export$294aa081a6c6f55d$1({
    ...props,
    labelElementType: "span",
    isInvalid,
    errorMessage: props.errorMessage || validationErrors
  });
  let labelledBy = fieldProps["aria-labelledby"] || fieldProps.id;
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let range3 = state.formatValue(locale2, {
    month: "long"
  });
  let description = range3 ? stringFormatter.format("selectedRangeDescription", {
    startDate: range3.start,
    endDate: range3.end
  }) : "";
  let descProps = $ef06256079686ba0$export$f8aeda7b10753fa1(description);
  let startFieldProps = {
    "aria-label": stringFormatter.format("startDate"),
    "aria-labelledby": labelledBy
  };
  let endFieldProps = {
    "aria-label": stringFormatter.format("endDate"),
    "aria-labelledby": labelledBy
  };
  let buttonId = $bdb11010cef70236$export$f680877a34711e37$2();
  let dialogId = $bdb11010cef70236$export$f680877a34711e37$2();
  let groupProps = $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref);
  let ariaDescribedBy = [
    descProps["aria-describedby"],
    fieldProps["aria-describedby"]
  ].filter(Boolean).join(" ") || void 0;
  let focusManager = reactExports.useMemo(() => $9bf71ea28793e738$export$c5251b9e124bf29(ref, {
    // Exclude the button from the focus manager.
    accept: (element2) => element2.id !== buttonId
  }), [
    ref,
    buttonId
  ]);
  let commonFieldProps = {
    [$16f0b7bb276bc17e$export$7b3062cd49e80452]: focusManager,
    [$16f0b7bb276bc17e$export$300019f83c56d282]: "presentation",
    "aria-describedby": ariaDescribedBy,
    placeholderValue: props.placeholderValue,
    hideTimeZone: props.hideTimeZone,
    hourCycle: props.hourCycle,
    granularity: props.granularity,
    shouldForceLeadingZeros: props.shouldForceLeadingZeros,
    isDisabled: props.isDisabled,
    isReadOnly: props.isReadOnly,
    isRequired: props.isRequired,
    validationBehavior: props.validationBehavior
  };
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props);
  let isFocused = reactExports.useRef(false);
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$4({
    ...props,
    isDisabled: state.isOpen,
    onBlurWithin: (e2) => {
      let dialog = document.getElementById(dialogId);
      if (!(dialog === null || dialog === void 0 ? void 0 : dialog.contains(e2.relatedTarget))) {
        var _props_onBlur, _props_onFocusChange;
        isFocused.current = false;
        (_props_onBlur = props.onBlur) === null || _props_onBlur === void 0 ? void 0 : _props_onBlur.call(props, e2);
        (_props_onFocusChange = props.onFocusChange) === null || _props_onFocusChange === void 0 ? void 0 : _props_onFocusChange.call(props, false);
      }
    },
    onFocusWithin: (e2) => {
      if (!isFocused.current) {
        var _props_onFocus, _props_onFocusChange;
        isFocused.current = true;
        (_props_onFocus = props.onFocus) === null || _props_onFocus === void 0 ? void 0 : _props_onFocus.call(props, e2);
        (_props_onFocusChange = props.onFocusChange) === null || _props_onFocusChange === void 0 ? void 0 : _props_onFocusChange.call(props, true);
      }
    }
  });
  let startFieldValidation = reactExports.useRef($e5be200c675c3b3a$export$dad6ae84456c676a$1);
  let endFieldValidation = reactExports.useRef($e5be200c675c3b3a$export$dad6ae84456c676a$1);
  var _state_value_start, _state_value_end;
  return {
    groupProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, groupProps, fieldProps, descProps, focusWithinProps, {
      role: "group",
      "aria-disabled": props.isDisabled || null,
      "aria-describedby": ariaDescribedBy,
      onKeyDown(e2) {
        if (state.isOpen)
          return;
        if (props.onKeyDown)
          props.onKeyDown(e2);
      },
      onKeyUp(e2) {
        if (state.isOpen)
          return;
        if (props.onKeyUp)
          props.onKeyUp(e2);
      }
    }),
    labelProps: {
      ...labelProps,
      onClick: () => {
        focusManager.focusFirst();
      }
    },
    buttonProps: {
      ...descProps,
      id: buttonId,
      "aria-haspopup": "dialog",
      "aria-label": stringFormatter.format("calendar"),
      "aria-labelledby": `${buttonId} ${labelledBy}`,
      "aria-describedby": ariaDescribedBy,
      "aria-expanded": state.isOpen,
      isDisabled: props.isDisabled || props.isReadOnly,
      onPress: () => state.setOpen(true)
    },
    dialogProps: {
      id: dialogId,
      "aria-labelledby": `${buttonId} ${labelledBy}`
    },
    startFieldProps: {
      ...startFieldProps,
      ...commonFieldProps,
      value: (_state_value_start = (_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.start) !== null && _state_value_start !== void 0 ? _state_value_start : null,
      onChange: (start2) => state.setDateTime("start", start2),
      autoFocus: props.autoFocus,
      name: props.startName,
      [$e5be200c675c3b3a$export$a763b9476acd3eb$1]: {
        realtimeValidation: state.realtimeValidation,
        displayValidation: state.displayValidation,
        updateValidation(e2) {
          startFieldValidation.current = e2;
          state.updateValidation($e5be200c675c3b3a$export$75ee7c75d68f5b0e(e2, endFieldValidation.current));
        },
        resetValidation: state.resetValidation,
        commitValidation: state.commitValidation
      }
    },
    endFieldProps: {
      ...endFieldProps,
      ...commonFieldProps,
      value: (_state_value_end = (_state_value1 = state.value) === null || _state_value1 === void 0 ? void 0 : _state_value1.end) !== null && _state_value_end !== void 0 ? _state_value_end : null,
      onChange: (end2) => state.setDateTime("end", end2),
      name: props.endName,
      [$e5be200c675c3b3a$export$a763b9476acd3eb$1]: {
        realtimeValidation: state.realtimeValidation,
        displayValidation: state.displayValidation,
        updateValidation(e2) {
          endFieldValidation.current = e2;
          state.updateValidation($e5be200c675c3b3a$export$75ee7c75d68f5b0e(startFieldValidation.current, e2));
        },
        resetValidation: state.resetValidation,
        commitValidation: state.commitValidation
      }
    },
    descriptionProps,
    errorMessageProps,
    calendarProps: {
      autoFocus: true,
      value: ((_state_dateRange = state.dateRange) === null || _state_dateRange === void 0 ? void 0 : _state_dateRange.start) && state.dateRange.end ? state.dateRange : null,
      onChange: state.setDateRange,
      minValue: props.minValue,
      maxValue: props.maxValue,
      isDisabled: props.isDisabled,
      isReadOnly: props.isReadOnly,
      isDateUnavailable: props.isDateUnavailable,
      allowsNonContiguousRanges: props.allowsNonContiguousRanges,
      defaultFocusedValue: state.dateRange ? void 0 : props.placeholderValue,
      isInvalid: state.isInvalid,
      errorMessage: typeof props.errorMessage === "function" ? props.errorMessage(state.displayValidation) : props.errorMessage || state.displayValidation.validationErrors.join(" ")
    },
    isInvalid,
    validationErrors,
    validationDetails
  };
}
var DateInputSegment = ({
  state,
  segment,
  slots,
  classNames: classNames2,
  ...otherProps
}) => {
  const ref = reactExports.useRef(null);
  let { segmentProps } = $32489daedd52963e$export$1315d136e6f7581(segment, state, ref);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "div",
    {
      ...mergeProps$3(segmentProps, otherProps),
      ref,
      className: slots.segment({
        class: classNames2 == null ? void 0 : classNames2.segment
      }),
      "data-editable": dataAttr(segment.isEditable),
      "data-invalid": dataAttr(state.isInvalid),
      "data-placeholder": dataAttr(segment.isPlaceholder),
      "data-slot": "segment",
      "data-type": segment.type,
      style: {
        ...segmentProps.style
      },
      children: segment.text
    }
  );
};
var DateInputField = reactExports.forwardRef((props, ref) => {
  const { as: as2, state, slots, inputProps, classNames: classNames2, ...otherProps } = props;
  const Component2 = as2 || "div";
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...otherProps, ref, children: [
    state.segments.map((segment, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      DateInputSegment,
      {
        classNames: classNames2,
        segment,
        slots,
        state
      },
      i2
    )),
    /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...inputProps })
  ] });
});
DateInputField.displayName = "HeroUI.DateInputField";
var DateInputGroup = forwardRef((props, ref) => {
  const {
    as: as2,
    label,
    children,
    description,
    startContent,
    endContent,
    errorMessage: errorMessageProp,
    shouldLabelBeOutside,
    isInvalid,
    groupProps,
    labelProps,
    wrapperProps,
    helperWrapperProps,
    errorMessageProps,
    descriptionProps,
    validationErrors,
    validationDetails,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const labelContent = label ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...labelProps, children: label }) : null;
  const errorMessage = typeof errorMessageProp === "function" ? errorMessageProp({
    isInvalid,
    validationErrors,
    validationDetails
  }) : errorMessageProp || (validationErrors == null ? void 0 : validationErrors.join(" "));
  const hasHelper = !!description || !!errorMessage;
  const helperWrapper = reactExports.useMemo(() => {
    if (!hasHelper)
      return null;
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...helperWrapperProps, children: isInvalid && errorMessage ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...errorMessageProps, children: errorMessage }) : description ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...descriptionProps, children: description }) : null });
  }, [
    hasHelper,
    errorMessage,
    description,
    helperWrapperProps,
    errorMessageProps,
    descriptionProps
  ]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...otherProps, ref, "data-has-helper": dataAttr(hasHelper), children: [
    shouldLabelBeOutside ? labelContent : null,
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...groupProps, children: [
      !shouldLabelBeOutside ? labelContent : null,
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...wrapperProps, children: [
        startContent,
        children,
        endContent
      ] }),
      shouldLabelBeOutside ? helperWrapper : null
    ] }),
    !shouldLabelBeOutside ? helperWrapper : null
  ] });
});
DateInputGroup.displayName = "HeroUI.DateInputGroup";
const $148a7a147e38ea7f$var$RTL_SCRIPTS$2 = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS$2 = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764$2(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS$2.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS$2.has(lang2);
}
const $b5e257d569688ac6$var$defaultContext$2 = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$2 = /* @__PURE__ */ React$5.createContext($b5e257d569688ac6$var$defaultContext$2);
const $b5e257d569688ac6$var$IsSSRContext$2 = /* @__PURE__ */ React$5.createContext(false);
let $b5e257d569688ac6$var$componentIds$2 = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$2(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$2);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$2.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$2.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$2.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$2(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$2);
  let counter = $b5e257d569688ac6$var$useCounter$2(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$2(defaultId) {
  let id2 = React$5.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$2());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$2.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$5["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$2 : $b5e257d569688ac6$var$useLegacySSRSafeId$2;
function $b5e257d569688ac6$var$getSnapshot$2() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$2() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$2(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$2() {
  if (typeof React$5["useSyncExternalStore"] === "function")
    return React$5["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$2, $b5e257d569688ac6$var$getSnapshot$2, $b5e257d569688ac6$var$getServerSnapshot$2);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$2);
}
const $1e5a04cdaf7d1af8$var$localeSymbol$2 = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$2() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol$2] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764$2(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale$2 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$2();
let $1e5a04cdaf7d1af8$var$listeners$2 = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale$2() {
  $1e5a04cdaf7d1af8$var$currentLocale$2 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$2();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners$2)
    listener($1e5a04cdaf7d1af8$var$currentLocale$2);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$2() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$2();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale$2);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners$2.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$2);
    $1e5a04cdaf7d1af8$var$listeners$2.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners$2.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners$2.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$2);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext$2 = /* @__PURE__ */ React$5.createContext(null);
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$2() {
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$2();
  let context = reactExports.useContext($18f2051aff69b9bf$var$I18nContext$2);
  return context || defaultLocale;
}
var $b3427c06585c22a0$exports = {};
$b3427c06585c22a0$exports = {
  "rangeOverflow": (args) => `يجب أن تكون القيمة ${args.maxValue} أو قبل ذلك.`,
  "rangeReversed": `تاريخ البدء يجب أن يكون قبل تاريخ الانتهاء.`,
  "rangeUnderflow": (args) => `يجب أن تكون القيمة ${args.minValue} أو بعد ذلك.`,
  "unavailableDate": `البيانات المحددة غير متاحة.`
};
var $d282528f459122b9$exports = {};
$d282528f459122b9$exports = {
  "rangeOverflow": (args) => `Стойността трябва да е ${args.maxValue} или по-ранна.`,
  "rangeReversed": `Началната дата трябва да е преди крайната.`,
  "rangeUnderflow": (args) => `Стойността трябва да е ${args.minValue} или по-късно.`,
  "unavailableDate": `Избраната дата не е налична.`
};
var $2d5eecd634a9ca45$exports = {};
$2d5eecd634a9ca45$exports = {
  "rangeOverflow": (args) => `Hodnota musí být ${args.maxValue} nebo dřívější.`,
  "rangeReversed": `Datum zahájení musí předcházet datu ukončení.`,
  "rangeUnderflow": (args) => `Hodnota musí být ${args.minValue} nebo pozdější.`,
  "unavailableDate": `Vybrané datum není k dispozici.`
};
var $c8e2288226c24a67$exports = {};
$c8e2288226c24a67$exports = {
  "rangeOverflow": (args) => `Værdien skal være ${args.maxValue} eller tidligere.`,
  "rangeReversed": `Startdatoen skal være før slutdatoen.`,
  "rangeUnderflow": (args) => `Værdien skal være ${args.minValue} eller nyere.`,
  "unavailableDate": `Den valgte dato er ikke tilgængelig.`
};
var $6f5745e389c346d7$exports = {};
$6f5745e389c346d7$exports = {
  "rangeOverflow": (args) => `Der Wert muss ${args.maxValue} oder früher sein.`,
  "rangeReversed": `Das Anfangsdatum muss vor dem Enddatum liegen.`,
  "rangeUnderflow": (args) => `Der Wert muss ${args.minValue} oder später sein.`,
  "unavailableDate": `Das ausgewählte Datum ist nicht verfügbar.`
};
var $8c882ccf4300d1da$exports = {};
$8c882ccf4300d1da$exports = {
  "rangeOverflow": (args) => `Η τιμή πρέπει να είναι ${args.maxValue} ή παλαιότερη.`,
  "rangeReversed": `Η ημερομηνία έναρξης πρέπει να είναι πριν από την ημερομηνία λήξης.`,
  "rangeUnderflow": (args) => `Η τιμή πρέπει να είναι ${args.minValue} ή μεταγενέστερη.`,
  "unavailableDate": `Η επιλεγμένη ημερομηνία δεν είναι διαθέσιμη.`
};
var $22195056771860be$exports = {};
$22195056771860be$exports = {
  "rangeUnderflow": (args) => `Value must be ${args.minValue} or later.`,
  "rangeOverflow": (args) => `Value must be ${args.maxValue} or earlier.`,
  "rangeReversed": `Start date must be before end date.`,
  "unavailableDate": `Selected date unavailable.`
};
var $cedfa43b4e2a5906$exports = {};
$cedfa43b4e2a5906$exports = {
  "rangeOverflow": (args) => `El valor debe ser ${args.maxValue} o anterior.`,
  "rangeReversed": `La fecha de inicio debe ser anterior a la fecha de finalización.`,
  "rangeUnderflow": (args) => `El valor debe ser ${args.minValue} o posterior.`,
  "unavailableDate": `Fecha seleccionada no disponible.`
};
var $eeeaa8daee3601c7$exports = {};
$eeeaa8daee3601c7$exports = {
  "rangeOverflow": (args) => `Väärtus peab olema ${args.maxValue} või varasem.`,
  "rangeReversed": `Alguskuupäev peab olema enne lõppkuupäeva.`,
  "rangeUnderflow": (args) => `Väärtus peab olema ${args.minValue} või hilisem.`,
  "unavailableDate": `Valitud kuupäev pole saadaval.`
};
var $35e0614a49b3bb40$exports = {};
$35e0614a49b3bb40$exports = {
  "rangeOverflow": (args) => `Arvon on oltava ${args.maxValue} tai sitä aikaisempi.`,
  "rangeReversed": `Aloituspäivän on oltava ennen lopetuspäivää.`,
  "rangeUnderflow": (args) => `Arvon on oltava ${args.minValue} tai sitä myöhäisempi.`,
  "unavailableDate": `Valittu päivämäärä ei ole käytettävissä.`
};
var $929bc63f7705a78f$exports = {};
$929bc63f7705a78f$exports = {
  "rangeOverflow": (args) => `La valeur doit être ${args.maxValue} ou antérieure.`,
  "rangeReversed": `La date de début doit être antérieure à la date de fin.`,
  "rangeUnderflow": (args) => `La valeur doit être ${args.minValue} ou ultérieure.`,
  "unavailableDate": `La date sélectionnée n’est pas disponible.`
};
var $9a28d073b034d183$exports = {};
$9a28d073b034d183$exports = {
  "rangeOverflow": (args) => `הערך חייב להיות ${args.maxValue} או מוקדם יותר.`,
  "rangeReversed": `תאריך ההתחלה חייב להיות לפני תאריך הסיום.`,
  "rangeUnderflow": (args) => `הערך חייב להיות ${args.minValue} או מאוחר יותר.`,
  "unavailableDate": `התאריך הנבחר אינו זמין.`
};
var $7743e79780ebcca3$exports = {};
$7743e79780ebcca3$exports = {
  "rangeOverflow": (args) => `Vrijednost mora biti ${args.maxValue} ili ranije.`,
  "rangeReversed": `Datum početka mora biti prije datuma završetka.`,
  "rangeUnderflow": (args) => `Vrijednost mora biti ${args.minValue} ili kasnije.`,
  "unavailableDate": `Odabrani datum nije dostupan.`
};
var $3351817a04898858$exports = {};
$3351817a04898858$exports = {
  "rangeOverflow": (args) => `Az értéknek ${args.maxValue} vagy korábbinak kell lennie.`,
  "rangeReversed": `A kezdő dátumnak a befejező dátumnál korábbinak kell lennie.`,
  "rangeUnderflow": (args) => `Az értéknek ${args.minValue} vagy későbbinek kell lennie.`,
  "unavailableDate": `A kiválasztott dátum nem érhető el.`
};
var $4120bdb1d03484db$exports = {};
$4120bdb1d03484db$exports = {
  "rangeOverflow": (args) => `Il valore deve essere ${args.maxValue} o precedente.`,
  "rangeReversed": `La data di inizio deve essere antecedente alla data di fine.`,
  "rangeUnderflow": (args) => `Il valore deve essere ${args.minValue} o successivo.`,
  "unavailableDate": `Data selezionata non disponibile.`
};
var $65e5e1569f34ea4f$exports = {};
$65e5e1569f34ea4f$exports = {
  "rangeOverflow": (args) => `値は ${args.maxValue} 以下にする必要があります。`,
  "rangeReversed": `開始日は終了日より前にする必要があります。`,
  "rangeUnderflow": (args) => `値は ${args.minValue} 以上にする必要があります。`,
  "unavailableDate": `選択した日付は使用できません。`
};
var $d34552a7550967e7$exports = {};
$d34552a7550967e7$exports = {
  "rangeOverflow": (args) => `값은 ${args.maxValue} 이전이어야 합니다.`,
  "rangeReversed": `시작일은 종료일 이전이어야 합니다.`,
  "rangeUnderflow": (args) => `값은 ${args.minValue} 이상이어야 합니다.`,
  "unavailableDate": `선택한 날짜를 사용할 수 없습니다.`
};
var $8f855bffe63f6eca$exports = {};
$8f855bffe63f6eca$exports = {
  "rangeOverflow": (args) => `Reikšmė turi būti ${args.maxValue} arba ankstesnė.`,
  "rangeReversed": `Pradžios data turi būti ankstesnė nei pabaigos data.`,
  "rangeUnderflow": (args) => `Reikšmė turi būti ${args.minValue} arba naujesnė.`,
  "unavailableDate": `Pasirinkta data nepasiekiama.`
};
var $ce40f46d09034645$exports = {};
$ce40f46d09034645$exports = {
  "rangeOverflow": (args) => `Vērtībai ir jābūt ${args.maxValue} vai agrākai.`,
  "rangeReversed": `Sākuma datumam ir jābūt pirms beigu datuma.`,
  "rangeUnderflow": (args) => `Vērtībai ir jābūt ${args.minValue} vai vēlākai.`,
  "unavailableDate": `Atlasītais datums nav pieejams.`
};
var $dd1a9a73340c793e$exports = {};
$dd1a9a73340c793e$exports = {
  "rangeOverflow": (args) => `Verdien må være ${args.maxValue} eller tidligere.`,
  "rangeReversed": `Startdatoen må være før sluttdatoen.`,
  "rangeUnderflow": (args) => `Verdien må være ${args.minValue} eller senere.`,
  "unavailableDate": `Valgt dato utilgjengelig.`
};
var $4ee1fb3f0cbe6f59$exports = {};
$4ee1fb3f0cbe6f59$exports = {
  "rangeOverflow": (args) => `Waarde moet ${args.maxValue} of eerder zijn.`,
  "rangeReversed": `De startdatum moet voor de einddatum liggen.`,
  "rangeUnderflow": (args) => `Waarde moet ${args.minValue} of later zijn.`,
  "unavailableDate": `Geselecteerde datum niet beschikbaar.`
};
var $c85829aebb0bc94b$exports = {};
$c85829aebb0bc94b$exports = {
  "rangeOverflow": (args) => `Wartość musi mieć wartość ${args.maxValue} lub wcześniejszą.`,
  "rangeReversed": `Data rozpoczęcia musi być wcześniejsza niż data zakończenia.`,
  "rangeUnderflow": (args) => `Wartość musi mieć wartość ${args.minValue} lub późniejszą.`,
  "unavailableDate": `Wybrana data jest niedostępna.`
};
var $27f5cd2291ca8a02$exports = {};
$27f5cd2291ca8a02$exports = {
  "rangeOverflow": (args) => `O valor deve ser ${args.maxValue} ou anterior.`,
  "rangeReversed": `A data inicial deve ser anterior à data final.`,
  "rangeUnderflow": (args) => `O valor deve ser ${args.minValue} ou posterior.`,
  "unavailableDate": `Data selecionada indisponível.`
};
var $e046fdccd69bea8e$exports = {};
$e046fdccd69bea8e$exports = {
  "rangeOverflow": (args) => `O valor tem de ser ${args.maxValue} ou anterior.`,
  "rangeReversed": `A data de início deve ser anterior à data de fim.`,
  "rangeUnderflow": (args) => `O valor tem de ser ${args.minValue} ou posterior.`,
  "unavailableDate": `Data selecionada indisponível.`
};
var $fa5f88e804986547$exports = {};
$fa5f88e804986547$exports = {
  "rangeOverflow": (args) => `Valoarea trebuie să fie ${args.maxValue} sau anterioară.`,
  "rangeReversed": `Data de început trebuie să fie anterioară datei de sfârșit.`,
  "rangeUnderflow": (args) => `Valoarea trebuie să fie ${args.minValue} sau ulterioară.`,
  "unavailableDate": `Data selectată nu este disponibilă.`
};
var $28e4714602d1b568$exports = {};
$28e4714602d1b568$exports = {
  "rangeOverflow": (args) => `Значение должно быть не позже ${args.maxValue}.`,
  "rangeReversed": `Дата начала должна предшествовать дате окончания.`,
  "rangeUnderflow": (args) => `Значение должно быть не раньше ${args.minValue}.`,
  "unavailableDate": `Выбранная дата недоступна.`
};
var $4e3bc8cf783ad569$exports = {};
$4e3bc8cf783ad569$exports = {
  "rangeOverflow": (args) => `Hodnota musí byť ${args.maxValue} alebo skoršia.`,
  "rangeReversed": `Dátum začiatku musí byť skorší ako dátum konca.`,
  "rangeUnderflow": (args) => `Hodnota musí byť ${args.minValue} alebo neskoršia.`,
  "unavailableDate": `Vybratý dátum je nedostupný.`
};
var $bee07513333bdc15$exports = {};
$bee07513333bdc15$exports = {
  "rangeOverflow": (args) => `Vrednost mora biti ${args.maxValue} ali starejša.`,
  "rangeReversed": `Začetni datum mora biti pred končnim datumom.`,
  "rangeUnderflow": (args) => `Vrednost mora biti ${args.minValue} ali novejša.`,
  "unavailableDate": `Izbrani datum ni na voljo.`
};
var $7ed9c6fad16a15ec$exports = {};
$7ed9c6fad16a15ec$exports = {
  "rangeOverflow": (args) => `Vrednost mora da bude ${args.maxValue} ili starija.`,
  "rangeReversed": `Datum početka mora biti pre datuma završetka.`,
  "rangeUnderflow": (args) => `Vrednost mora da bude ${args.minValue} ili novija.`,
  "unavailableDate": `Izabrani datum nije dostupan.`
};
var $8bef6d5a236de86c$exports = {};
$8bef6d5a236de86c$exports = {
  "rangeOverflow": (args) => `Värdet måste vara ${args.maxValue} eller tidigare.`,
  "rangeReversed": `Startdatumet måste vara före slutdatumet.`,
  "rangeUnderflow": (args) => `Värdet måste vara ${args.minValue} eller senare.`,
  "unavailableDate": `Det valda datumet är inte tillgängligt.`
};
var $098b9a2d2340cfc5$exports = {};
$098b9a2d2340cfc5$exports = {
  "rangeOverflow": (args) => `Değer, ${args.maxValue} veya öncesi olmalıdır.`,
  "rangeReversed": `Başlangıç tarihi bitiş tarihinden önce olmalıdır.`,
  "rangeUnderflow": (args) => `Değer, ${args.minValue} veya sonrası olmalıdır.`,
  "unavailableDate": `Seçilen tarih kullanılamıyor.`
};
var $54a862ea7fad7419$exports = {};
$54a862ea7fad7419$exports = {
  "rangeOverflow": (args) => `Значення має бути не пізніше ${args.maxValue}.`,
  "rangeReversed": `Дата початку має передувати даті завершення.`,
  "rangeUnderflow": (args) => `Значення має бути не раніше ${args.minValue}.`,
  "unavailableDate": `Вибрана дата недоступна.`
};
var $e6cc491d590dfda5$exports = {};
$e6cc491d590dfda5$exports = {
  "rangeOverflow": (args) => `值必须是 ${args.maxValue} 或更早日期。`,
  "rangeReversed": `开始日期必须早于结束日期。`,
  "rangeUnderflow": (args) => `值必须是 ${args.minValue} 或更晚日期。`,
  "unavailableDate": `所选日期不可用。`
};
var $9aebf53181a474bd$exports = {};
$9aebf53181a474bd$exports = {
  "rangeOverflow": (args) => `值必須是 ${args.maxValue} 或更早。`,
  "rangeReversed": `開始日期必須在結束日期之前。`,
  "rangeUnderflow": (args) => `值必須是 ${args.minValue} 或更晚。`,
  "unavailableDate": `所選日期無法使用。`
};
var $452ac34de8c2444e$exports = {};
$452ac34de8c2444e$exports = {
  "ar-AE": $b3427c06585c22a0$exports,
  "bg-BG": $d282528f459122b9$exports,
  "cs-CZ": $2d5eecd634a9ca45$exports,
  "da-DK": $c8e2288226c24a67$exports,
  "de-DE": $6f5745e389c346d7$exports,
  "el-GR": $8c882ccf4300d1da$exports,
  "en-US": $22195056771860be$exports,
  "es-ES": $cedfa43b4e2a5906$exports,
  "et-EE": $eeeaa8daee3601c7$exports,
  "fi-FI": $35e0614a49b3bb40$exports,
  "fr-FR": $929bc63f7705a78f$exports,
  "he-IL": $9a28d073b034d183$exports,
  "hr-HR": $7743e79780ebcca3$exports,
  "hu-HU": $3351817a04898858$exports,
  "it-IT": $4120bdb1d03484db$exports,
  "ja-JP": $65e5e1569f34ea4f$exports,
  "ko-KR": $d34552a7550967e7$exports,
  "lt-LT": $8f855bffe63f6eca$exports,
  "lv-LV": $ce40f46d09034645$exports,
  "nb-NO": $dd1a9a73340c793e$exports,
  "nl-NL": $4ee1fb3f0cbe6f59$exports,
  "pl-PL": $c85829aebb0bc94b$exports,
  "pt-BR": $27f5cd2291ca8a02$exports,
  "pt-PT": $e046fdccd69bea8e$exports,
  "ro-RO": $fa5f88e804986547$exports,
  "ru-RU": $28e4714602d1b568$exports,
  "sk-SK": $4e3bc8cf783ad569$exports,
  "sl-SI": $bee07513333bdc15$exports,
  "sr-SP": $7ed9c6fad16a15ec$exports,
  "sv-SE": $8bef6d5a236de86c$exports,
  "tr-TR": $098b9a2d2340cfc5$exports,
  "uk-UA": $54a862ea7fad7419$exports,
  "zh-CN": $e6cc491d590dfda5$exports,
  "zh-TW": $9aebf53181a474bd$exports
};
function $parcel$interopDefault$3(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
const $35a22f14a1f04b11$var$dictionary = new $5b160d28a433310d$export$c17fa47878dc55b6($parcel$interopDefault$3($452ac34de8c2444e$exports));
function $35a22f14a1f04b11$var$getLocale() {
  return typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
}
function $35a22f14a1f04b11$export$f18627323ab57ac0(value2, minValue, maxValue, isDateUnavailable, options) {
  let rangeOverflow = value2 != null && maxValue != null && value2.compare(maxValue) > 0;
  let rangeUnderflow = value2 != null && minValue != null && value2.compare(minValue) < 0;
  let isUnavailable = value2 != null && (isDateUnavailable === null || isDateUnavailable === void 0 ? void 0 : isDateUnavailable(value2)) || false;
  let isInvalid = rangeOverflow || rangeUnderflow || isUnavailable;
  let errors = [];
  if (isInvalid) {
    let locale2 = $35a22f14a1f04b11$var$getLocale();
    let strings = $5b160d28a433310d$export$c17fa47878dc55b6.getGlobalDictionaryForPackage("@react-stately/datepicker") || $35a22f14a1f04b11$var$dictionary;
    let formatter = new $6db58dc88e78b024$export$2f817fcdc4b89ae0(locale2, strings);
    let dateFormatter = new $fb18d541ea1ad717$export$ad991b66133851cf(locale2, $35a22f14a1f04b11$export$7e319ea407e63bc0({}, options));
    let timeZone = dateFormatter.resolvedOptions().timeZone;
    if (rangeUnderflow && minValue != null)
      errors.push(formatter.format("rangeUnderflow", {
        minValue: dateFormatter.format(minValue.toDate(timeZone))
      }));
    if (rangeOverflow && maxValue != null)
      errors.push(formatter.format("rangeOverflow", {
        maxValue: dateFormatter.format(maxValue.toDate(timeZone))
      }));
    if (isUnavailable)
      errors.push(formatter.format("unavailableDate"));
  }
  return {
    isInvalid,
    validationErrors: errors,
    validationDetails: {
      badInput: isUnavailable,
      customError: false,
      patternMismatch: false,
      rangeOverflow,
      rangeUnderflow,
      stepMismatch: false,
      tooLong: false,
      tooShort: false,
      typeMismatch: false,
      valueMissing: false,
      valid: !isInvalid
    }
  };
}
function $35a22f14a1f04b11$export$80ff8fc0ae339c13(value2, minValue, maxValue, isDateUnavailable, options) {
  var _value_start;
  let startValidation = $35a22f14a1f04b11$export$f18627323ab57ac0((_value_start = value2 === null || value2 === void 0 ? void 0 : value2.start) !== null && _value_start !== void 0 ? _value_start : null, minValue, maxValue, isDateUnavailable, options);
  var _value_end;
  let endValidation = $35a22f14a1f04b11$export$f18627323ab57ac0((_value_end = value2 === null || value2 === void 0 ? void 0 : value2.end) !== null && _value_end !== void 0 ? _value_end : null, minValue, maxValue, isDateUnavailable, options);
  let result = $e5be200c675c3b3a$export$75ee7c75d68f5b0e(startValidation, endValidation);
  if ((value2 === null || value2 === void 0 ? void 0 : value2.end) != null && value2.start != null && value2.end.compare(value2.start) < 0) {
    let strings = $5b160d28a433310d$export$c17fa47878dc55b6.getGlobalDictionaryForPackage("@react-stately/datepicker") || $35a22f14a1f04b11$var$dictionary;
    result = $e5be200c675c3b3a$export$75ee7c75d68f5b0e(result, {
      isInvalid: true,
      validationErrors: [
        strings.getStringForLocale("rangeReversed", $35a22f14a1f04b11$var$getLocale())
      ],
      validationDetails: {
        ...$e5be200c675c3b3a$export$aca958c65c314e6c$1,
        rangeUnderflow: true,
        rangeOverflow: true,
        valid: false
      }
    });
  }
  return result;
}
const $35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS = {
  year: "numeric",
  month: "numeric",
  day: "numeric",
  hour: "numeric",
  minute: "2-digit",
  second: "2-digit"
};
const $35a22f14a1f04b11$var$TWO_DIGIT_FIELD_OPTIONS = {
  year: "numeric",
  month: "2-digit",
  day: "2-digit",
  hour: "2-digit",
  minute: "2-digit",
  second: "2-digit"
};
function $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, options) {
  let defaultFieldOptions = options.shouldForceLeadingZeros ? $35a22f14a1f04b11$var$TWO_DIGIT_FIELD_OPTIONS : $35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS;
  fieldOptions = {
    ...defaultFieldOptions,
    ...fieldOptions
  };
  let granularity = options.granularity || "minute";
  let keys2 = Object.keys(fieldOptions);
  var _options_maxGranularity;
  let startIdx = keys2.indexOf((_options_maxGranularity = options.maxGranularity) !== null && _options_maxGranularity !== void 0 ? _options_maxGranularity : "year");
  if (startIdx < 0)
    startIdx = 0;
  let endIdx = keys2.indexOf(granularity);
  if (endIdx < 0)
    endIdx = 2;
  if (startIdx > endIdx)
    throw new Error("maxGranularity must be greater than granularity");
  let opts2 = keys2.slice(startIdx, endIdx + 1).reduce((opts3, key) => {
    opts3[key] = fieldOptions[key];
    return opts3;
  }, {});
  if (options.hourCycle != null)
    opts2.hour12 = options.hourCycle === 12;
  opts2.timeZone = options.timeZone || "UTC";
  let hasTime = granularity === "hour" || granularity === "minute" || granularity === "second";
  if (hasTime && options.timeZone && !options.hideTimeZone)
    opts2.timeZoneName = "short";
  if (options.showEra && startIdx === 0)
    opts2.era = "short";
  return opts2;
}
function $35a22f14a1f04b11$export$c5221a78ef73c5e9(placeholderValue) {
  if (placeholderValue && "hour" in placeholderValue)
    return placeholderValue;
  return new $35ea8db9cb2ccb90$export$680ea196effce5f();
}
function $35a22f14a1f04b11$export$61a490a80c552550(value2, calendar2) {
  if (value2 === null)
    return null;
  if (!value2)
    return void 0;
  return $11d87f3f76e88657$export$b4a036af3fc0b032(value2, calendar2);
}
function $35a22f14a1f04b11$export$66aa2b09de4b1ea5(placeholderValue, granularity, calendar2, timeZone) {
  if (placeholderValue)
    return $35a22f14a1f04b11$export$61a490a80c552550(placeholderValue, calendar2);
  let date4 = $11d87f3f76e88657$export$b4a036af3fc0b032($14e0f24ef4ac5c92$export$461939dd4422153(timeZone !== null && timeZone !== void 0 ? timeZone : $14e0f24ef4ac5c92$export$aa8b41735afcabd2()).set({
    hour: 0,
    minute: 0,
    second: 0,
    millisecond: 0
  }), calendar2);
  if (granularity === "year" || granularity === "month" || granularity === "day")
    return $11d87f3f76e88657$export$93522d1a439f3617(date4);
  if (!timeZone)
    return $11d87f3f76e88657$export$b21e0b124e224484(date4);
  return date4;
}
function $35a22f14a1f04b11$export$2440da353cedad43(v2, granularity) {
  let defaultTimeZone = v2 && "timeZone" in v2 ? v2.timeZone : void 0;
  let defaultGranularity = v2 && "minute" in v2 ? "minute" : "day";
  if (v2 && granularity && !(granularity in v2))
    throw new Error("Invalid granularity " + granularity + " for value " + v2.toString());
  let [lastValue, setLastValue] = reactExports.useState([
    defaultGranularity,
    defaultTimeZone
  ]);
  if (v2 && (lastValue[0] !== defaultGranularity || lastValue[1] !== defaultTimeZone))
    setLastValue([
      defaultGranularity,
      defaultTimeZone
    ]);
  if (!granularity)
    granularity = v2 ? defaultGranularity : lastValue[0];
  let timeZone = v2 ? defaultTimeZone : lastValue[1];
  return [
    granularity,
    timeZone
  ];
}
const $3e3ed55ab2966714$var$placeholders = new $5b160d28a433310d$export$c17fa47878dc55b6({
  ach: {
    year: "mwaka",
    month: "dwe",
    day: "nino"
  },
  af: {
    year: "jjjj",
    month: "mm",
    day: "dd"
  },
  am: {
    year: "ዓዓዓዓ",
    month: "ሚሜ",
    day: "ቀቀ"
  },
  an: {
    year: "aaaa",
    month: "mm",
    day: "dd"
  },
  ar: {
    year: "سنة",
    month: "شهر",
    day: "يوم"
  },
  ast: {
    year: "aaaa",
    month: "mm",
    day: "dd"
  },
  az: {
    year: "iiii",
    month: "aa",
    day: "gg"
  },
  be: {
    year: "гггг",
    month: "мм",
    day: "дд"
  },
  bg: {
    year: "гггг",
    month: "мм",
    day: "дд"
  },
  bn: {
    year: "yyyy",
    month: "মিমি",
    day: "dd"
  },
  br: {
    year: "bbbb",
    month: "mm",
    day: "dd"
  },
  bs: {
    year: "gggg",
    month: "mm",
    day: "dd"
  },
  ca: {
    year: "aaaa",
    month: "mm",
    day: "dd"
  },
  cak: {
    year: "jjjj",
    month: "ii",
    day: "q'q'"
  },
  ckb: {
    year: "ساڵ",
    month: "مانگ",
    day: "ڕۆژ"
  },
  cs: {
    year: "rrrr",
    month: "mm",
    day: "dd"
  },
  cy: {
    year: "bbbb",
    month: "mm",
    day: "dd"
  },
  da: {
    year: "åååå",
    month: "mm",
    day: "dd"
  },
  de: {
    year: "jjjj",
    month: "mm",
    day: "tt"
  },
  dsb: {
    year: "llll",
    month: "mm",
    day: "źź"
  },
  el: {
    year: "εεεε",
    month: "μμ",
    day: "ηη"
  },
  en: {
    year: "yyyy",
    month: "mm",
    day: "dd"
  },
  eo: {
    year: "jjjj",
    month: "mm",
    day: "tt"
  },
  es: {
    year: "aaaa",
    month: "mm",
    day: "dd"
  },
  et: {
    year: "aaaa",
    month: "kk",
    day: "pp"
  },
  eu: {
    year: "uuuu",
    month: "hh",
    day: "ee"
  },
  fa: {
    year: "سال",
    month: "ماه",
    day: "روز"
  },
  ff: {
    year: "hhhh",
    month: "ll",
    day: "ññ"
  },
  fi: {
    year: "vvvv",
    month: "kk",
    day: "pp"
  },
  fr: {
    year: "aaaa",
    month: "mm",
    day: "jj"
  },
  fy: {
    year: "jjjj",
    month: "mm",
    day: "dd"
  },
  ga: {
    year: "bbbb",
    month: "mm",
    day: "ll"
  },
  gd: {
    year: "bbbb",
    month: "mm",
    day: "ll"
  },
  gl: {
    year: "aaaa",
    month: "mm",
    day: "dd"
  },
  he: {
    year: "שנה",
    month: "חודש",
    day: "יום"
  },
  hr: {
    year: "gggg",
    month: "mm",
    day: "dd"
  },
  hsb: {
    year: "llll",
    month: "mm",
    day: "dd"
  },
  hu: {
    year: "éééé",
    month: "hh",
    day: "nn"
  },
  ia: {
    year: "aaaa",
    month: "mm",
    day: "dd"
  },
  id: {
    year: "tttt",
    month: "bb",
    day: "hh"
  },
  it: {
    year: "aaaa",
    month: "mm",
    day: "gg"
  },
  ja: {
    year: "年",
    month: "月",
    day: "日"
  },
  ka: {
    year: "წწწწ",
    month: "თთ",
    day: "რრ"
  },
  kk: {
    year: "жжжж",
    month: "аа",
    day: "кк"
  },
  kn: {
    year: "ವವವವ",
    month: "ಮಿಮೀ",
    day: "ದಿದಿ"
  },
  ko: {
    year: "연도",
    month: "월",
    day: "일"
  },
  lb: {
    year: "jjjj",
    month: "mm",
    day: "dd"
  },
  lo: {
    year: "ປປປປ",
    month: "ດດ",
    day: "ວວ"
  },
  lt: {
    year: "mmmm",
    month: "mm",
    day: "dd"
  },
  lv: {
    year: "gggg",
    month: "mm",
    day: "dd"
  },
  meh: {
    year: "aaaa",
    month: "mm",
    day: "dd"
  },
  ml: {
    year: "വർഷം",
    month: "മാസം",
    day: "തീയതി"
  },
  ms: {
    year: "tttt",
    month: "mm",
    day: "hh"
  },
  nl: {
    year: "jjjj",
    month: "mm",
    day: "dd"
  },
  nn: {
    year: "åååå",
    month: "mm",
    day: "dd"
  },
  no: {
    year: "åååå",
    month: "mm",
    day: "dd"
  },
  oc: {
    year: "aaaa",
    month: "mm",
    day: "jj"
  },
  pl: {
    year: "rrrr",
    month: "mm",
    day: "dd"
  },
  pt: {
    year: "aaaa",
    month: "mm",
    day: "dd"
  },
  rm: {
    year: "oooo",
    month: "mm",
    day: "dd"
  },
  ro: {
    year: "aaaa",
    month: "ll",
    day: "zz"
  },
  ru: {
    year: "гггг",
    month: "мм",
    day: "дд"
  },
  sc: {
    year: "aaaa",
    month: "mm",
    day: "dd"
  },
  scn: {
    year: "aaaa",
    month: "mm",
    day: "jj"
  },
  sk: {
    year: "rrrr",
    month: "mm",
    day: "dd"
  },
  sl: {
    year: "llll",
    month: "mm",
    day: "dd"
  },
  sr: {
    year: "гггг",
    month: "мм",
    day: "дд"
  },
  sv: {
    year: "åååå",
    month: "mm",
    day: "dd"
  },
  szl: {
    year: "rrrr",
    month: "mm",
    day: "dd"
  },
  tg: {
    year: "сссс",
    month: "мм",
    day: "рр"
  },
  th: {
    year: "ปปปป",
    month: "ดด",
    day: "วว"
  },
  tr: {
    year: "yyyy",
    month: "aa",
    day: "gg"
  },
  uk: {
    year: "рррр",
    month: "мм",
    day: "дд"
  },
  "zh-CN": {
    year: "年",
    month: "月",
    day: "日"
  },
  "zh-TW": {
    year: "年",
    month: "月",
    day: "日"
  }
}, "en");
function $3e3ed55ab2966714$export$d3f5c5e0a5023fa0(field, value2, locale2) {
  if (field === "era" || field === "dayPeriod")
    return value2;
  if (field === "year" || field === "month" || field === "day")
    return $3e3ed55ab2966714$var$placeholders.getStringForLocale(field, locale2);
  return "––";
}
const $3c0fc76039f1c516$var$EDITABLE_SEGMENTS = {
  year: true,
  month: true,
  day: true,
  hour: true,
  minute: true,
  second: true,
  dayPeriod: true,
  era: true
};
const $3c0fc76039f1c516$var$PAGE_STEP = {
  year: 5,
  month: 2,
  day: 7,
  hour: 2,
  minute: 15,
  second: 15
};
const $3c0fc76039f1c516$var$TYPE_MAPPING = {
  // Node seems to convert everything to lowercase...
  dayperiod: "dayPeriod",
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts#named_years
  relatedYear: "year",
  yearName: "literal",
  unknown: "literal"
};
function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
  let { locale: locale2, createCalendar, hideTimeZone, isDisabled = false, isReadOnly = false, isRequired = false, minValue, maxValue, isDateUnavailable } = props;
  let v2 = props.value || props.defaultValue || props.placeholderValue || null;
  let [granularity, defaultTimeZone] = $35a22f14a1f04b11$export$2440da353cedad43(v2, props.granularity);
  let timeZone = defaultTimeZone || "UTC";
  if (v2 && !(granularity in v2))
    throw new Error("Invalid granularity " + granularity + " for value " + v2.toString());
  let defaultFormatter = reactExports.useMemo(() => new $fb18d541ea1ad717$export$ad991b66133851cf(locale2), [
    locale2
  ]);
  let calendar2 = reactExports.useMemo(() => createCalendar(defaultFormatter.resolvedOptions().calendar), [
    createCalendar,
    defaultFormatter
  ]);
  var _props_defaultValue;
  let [value2, setDate] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : null, props.onChange);
  let calendarValue = reactExports.useMemo(() => {
    var _convertValue;
    return (_convertValue = $35a22f14a1f04b11$export$61a490a80c552550(value2, calendar2)) !== null && _convertValue !== void 0 ? _convertValue : null;
  }, [
    value2,
    calendar2
  ]);
  let [placeholderDate, setPlaceholderDate] = reactExports.useState(() => $35a22f14a1f04b11$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar2, defaultTimeZone));
  let val = calendarValue || placeholderDate;
  let showEra = calendar2.identifier === "gregory" && val.era === "BC";
  let formatOpts = reactExports.useMemo(() => {
    var _props_maxGranularity2;
    return {
      granularity,
      maxGranularity: (_props_maxGranularity2 = props.maxGranularity) !== null && _props_maxGranularity2 !== void 0 ? _props_maxGranularity2 : "year",
      timeZone: defaultTimeZone,
      hideTimeZone,
      hourCycle: props.hourCycle,
      showEra,
      shouldForceLeadingZeros: props.shouldForceLeadingZeros
    };
  }, [
    props.maxGranularity,
    granularity,
    props.hourCycle,
    props.shouldForceLeadingZeros,
    defaultTimeZone,
    hideTimeZone,
    showEra
  ]);
  let opts2 = reactExports.useMemo(() => $35a22f14a1f04b11$export$7e319ea407e63bc0({}, formatOpts), [
    formatOpts
  ]);
  let dateFormatter = reactExports.useMemo(() => new $fb18d541ea1ad717$export$ad991b66133851cf(locale2, opts2), [
    locale2,
    opts2
  ]);
  let resolvedOptions = reactExports.useMemo(() => dateFormatter.resolvedOptions(), [
    dateFormatter
  ]);
  let allSegments = reactExports.useMemo(() => dateFormatter.formatToParts(/* @__PURE__ */ new Date()).filter((seg) => $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[seg.type]).reduce((p2, seg) => (p2[$3c0fc76039f1c516$var$TYPE_MAPPING[seg.type] || seg.type] = true, p2), {}), [
    dateFormatter
  ]);
  let [validSegments, setValidSegments] = reactExports.useState(() => props.value || props.defaultValue ? {
    ...allSegments
  } : {});
  let clearedSegment = reactExports.useRef(null);
  let lastCalendar = reactExports.useRef(calendar2);
  reactExports.useEffect(() => {
    if (!$14e0f24ef4ac5c92$export$dbc69fd56b53d5e(calendar2, lastCalendar.current)) {
      lastCalendar.current = calendar2;
      setPlaceholderDate((placeholder) => Object.keys(validSegments).length > 0 ? $11d87f3f76e88657$export$b4a036af3fc0b032(placeholder, calendar2) : $35a22f14a1f04b11$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar2, defaultTimeZone));
    }
  }, [
    calendar2,
    granularity,
    validSegments,
    defaultTimeZone,
    props.placeholderValue
  ]);
  if (value2 && Object.keys(validSegments).length < Object.keys(allSegments).length) {
    validSegments = {
      ...allSegments
    };
    setValidSegments(validSegments);
  }
  if (value2 == null && Object.keys(validSegments).length === Object.keys(allSegments).length) {
    validSegments = {};
    setValidSegments(validSegments);
    setPlaceholderDate($35a22f14a1f04b11$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar2, defaultTimeZone));
  }
  let displayValue = calendarValue && Object.keys(validSegments).length >= Object.keys(allSegments).length ? calendarValue : placeholderDate;
  let setValue = (newValue) => {
    if (props.isDisabled || props.isReadOnly)
      return;
    let validKeys = Object.keys(validSegments);
    let allKeys = Object.keys(allSegments);
    if (newValue == null) {
      setDate(null);
      setPlaceholderDate($35a22f14a1f04b11$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar2, defaultTimeZone));
      setValidSegments({});
    } else if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod && clearedSegment.current !== "dayPeriod") {
      newValue = $11d87f3f76e88657$export$b4a036af3fc0b032(newValue, (v2 === null || v2 === void 0 ? void 0 : v2.calendar) || new $3b62074eb05584b2$export$80ee6245ec4f29ec());
      setDate(newValue);
    } else
      setPlaceholderDate(newValue);
    clearedSegment.current = null;
  };
  let dateValue = reactExports.useMemo(() => displayValue.toDate(timeZone), [
    displayValue,
    timeZone
  ]);
  let segments = reactExports.useMemo(() => $3c0fc76039f1c516$var$processSegments(dateValue, validSegments, dateFormatter, resolvedOptions, displayValue, calendar2, locale2, granularity), [
    dateValue,
    validSegments,
    dateFormatter,
    resolvedOptions,
    displayValue,
    calendar2,
    locale2,
    granularity
  ]);
  if (allSegments.era && validSegments.year && !validSegments.era) {
    validSegments.era = true;
    setValidSegments({
      ...validSegments
    });
  } else if (!allSegments.era && validSegments.era) {
    delete validSegments.era;
    setValidSegments({
      ...validSegments
    });
  }
  let markValid = (part) => {
    validSegments[part] = true;
    if (part === "year" && allSegments.era)
      validSegments.era = true;
    setValidSegments({
      ...validSegments
    });
  };
  let adjustSegment = (type4, amount) => {
    if (!validSegments[type4]) {
      markValid(type4);
      let validKeys = Object.keys(validSegments);
      let allKeys = Object.keys(allSegments);
      if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod)
        setValue(displayValue);
    } else
      setValue($3c0fc76039f1c516$var$addSegment(displayValue, type4, amount, resolvedOptions));
  };
  let builtinValidation = reactExports.useMemo(() => $35a22f14a1f04b11$export$f18627323ab57ac0(value2, minValue, maxValue, isDateUnavailable, formatOpts), [
    value2,
    minValue,
    maxValue,
    isDateUnavailable,
    formatOpts
  ]);
  let validation = $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1({
    ...props,
    value: value2,
    builtinValidation
  });
  let isValueInvalid = validation.displayValidation.isInvalid;
  let validationState = props.validationState || (isValueInvalid ? "invalid" : null);
  var _props_maxGranularity;
  return {
    ...validation,
    value: calendarValue,
    dateValue,
    calendar: calendar2,
    setValue,
    segments,
    dateFormatter,
    validationState,
    isInvalid: isValueInvalid,
    granularity,
    maxGranularity: (_props_maxGranularity = props.maxGranularity) !== null && _props_maxGranularity !== void 0 ? _props_maxGranularity : "year",
    isDisabled,
    isReadOnly,
    isRequired,
    increment(part) {
      adjustSegment(part, 1);
    },
    decrement(part) {
      adjustSegment(part, -1);
    },
    incrementPage(part) {
      adjustSegment(part, $3c0fc76039f1c516$var$PAGE_STEP[part] || 1);
    },
    decrementPage(part) {
      adjustSegment(part, -($3c0fc76039f1c516$var$PAGE_STEP[part] || 1));
    },
    setSegment(part, v3) {
      markValid(part);
      setValue($3c0fc76039f1c516$var$setSegment(displayValue, part, v3, resolvedOptions));
    },
    confirmPlaceholder() {
      if (props.isDisabled || props.isReadOnly)
        return;
      let validKeys = Object.keys(validSegments);
      let allKeys = Object.keys(allSegments);
      if (validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod) {
        validSegments = {
          ...allSegments
        };
        setValidSegments(validSegments);
        setValue(displayValue.copy());
      }
    },
    clearSegment(part) {
      delete validSegments[part];
      clearedSegment.current = part;
      setValidSegments({
        ...validSegments
      });
      let placeholder = $35a22f14a1f04b11$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar2, defaultTimeZone);
      let value3 = displayValue;
      if (part === "dayPeriod" && "hour" in displayValue && "hour" in placeholder) {
        let isPM = displayValue.hour >= 12;
        let shouldBePM = placeholder.hour >= 12;
        if (isPM && !shouldBePM)
          value3 = displayValue.set({
            hour: displayValue.hour - 12
          });
        else if (!isPM && shouldBePM)
          value3 = displayValue.set({
            hour: displayValue.hour + 12
          });
      } else if (part === "hour" && "hour" in displayValue && displayValue.hour >= 12 && validSegments.dayPeriod)
        value3 = displayValue.set({
          hour: placeholder["hour"] + 12
        });
      else if (part in displayValue)
        value3 = displayValue.set({
          [part]: placeholder[part]
        });
      setDate(null);
      setValue(value3);
    },
    formatValue(fieldOptions) {
      if (!calendarValue)
        return "";
      let formatOptions = $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, formatOpts);
      let formatter = new $fb18d541ea1ad717$export$ad991b66133851cf(locale2, formatOptions);
      return formatter.format(dateValue);
    },
    getDateFormatter(locale3, formatOptions) {
      let newOptions = {
        ...formatOpts,
        ...formatOptions
      };
      let newFormatOptions = $35a22f14a1f04b11$export$7e319ea407e63bc0({}, newOptions);
      return new $fb18d541ea1ad717$export$ad991b66133851cf(locale3, newFormatOptions);
    }
  };
}
function $3c0fc76039f1c516$var$processSegments(dateValue, validSegments, dateFormatter, resolvedOptions, displayValue, calendar2, locale2, granularity) {
  let timeValue = [
    "hour",
    "minute",
    "second"
  ];
  let segments = dateFormatter.formatToParts(dateValue);
  let processedSegments = [];
  for (let segment of segments) {
    let type4 = $3c0fc76039f1c516$var$TYPE_MAPPING[segment.type] || segment.type;
    let isEditable = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[type4];
    if (type4 === "era" && calendar2.getEras().length === 1)
      isEditable = false;
    let isPlaceholder = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[type4] && !validSegments[type4];
    let placeholder = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[type4] ? $3e3ed55ab2966714$export$d3f5c5e0a5023fa0(type4, segment.value, locale2) : null;
    let dateSegment = {
      type: type4,
      text: isPlaceholder ? placeholder : segment.value,
      ...$3c0fc76039f1c516$var$getSegmentLimits(displayValue, type4, resolvedOptions),
      isPlaceholder,
      placeholder,
      isEditable
    };
    if (type4 === "hour") {
      processedSegments.push({
        type: "literal",
        text: "⁦",
        ...$3c0fc76039f1c516$var$getSegmentLimits(displayValue, "literal", resolvedOptions),
        isPlaceholder: false,
        placeholder: "",
        isEditable: false
      });
      processedSegments.push(dateSegment);
      if (type4 === granularity)
        processedSegments.push({
          type: "literal",
          text: "⁩",
          ...$3c0fc76039f1c516$var$getSegmentLimits(displayValue, "literal", resolvedOptions),
          isPlaceholder: false,
          placeholder: "",
          isEditable: false
        });
    } else if (timeValue.includes(type4) && type4 === granularity) {
      processedSegments.push(dateSegment);
      processedSegments.push({
        type: "literal",
        text: "⁩",
        ...$3c0fc76039f1c516$var$getSegmentLimits(displayValue, "literal", resolvedOptions),
        isPlaceholder: false,
        placeholder: "",
        isEditable: false
      });
    } else
      processedSegments.push(dateSegment);
  }
  return processedSegments;
}
function $3c0fc76039f1c516$var$getSegmentLimits(date4, type4, options) {
  switch (type4) {
    case "era": {
      let eras = date4.calendar.getEras();
      return {
        value: eras.indexOf(date4.era),
        minValue: 0,
        maxValue: eras.length - 1
      };
    }
    case "year":
      return {
        value: date4.year,
        minValue: 1,
        maxValue: date4.calendar.getYearsInEra(date4)
      };
    case "month":
      return {
        value: date4.month,
        minValue: $14e0f24ef4ac5c92$export$5412ac11713b72ad(date4),
        maxValue: date4.calendar.getMonthsInYear(date4)
      };
    case "day":
      return {
        value: date4.day,
        minValue: $14e0f24ef4ac5c92$export$b2f4953d301981d5(date4),
        maxValue: date4.calendar.getDaysInMonth(date4)
      };
  }
  if ("hour" in date4)
    switch (type4) {
      case "dayPeriod":
        return {
          value: date4.hour >= 12 ? 12 : 0,
          minValue: 0,
          maxValue: 12
        };
      case "hour":
        if (options.hour12) {
          let isPM = date4.hour >= 12;
          return {
            value: date4.hour,
            minValue: isPM ? 12 : 0,
            maxValue: isPM ? 23 : 11
          };
        }
        return {
          value: date4.hour,
          minValue: 0,
          maxValue: 23
        };
      case "minute":
        return {
          value: date4.minute,
          minValue: 0,
          maxValue: 59
        };
      case "second":
        return {
          value: date4.second,
          minValue: 0,
          maxValue: 59
        };
    }
  return {};
}
function $3c0fc76039f1c516$var$addSegment(value2, part, amount, options) {
  switch (part) {
    case "era":
    case "year":
    case "month":
    case "day":
      return value2.cycle(part, amount, {
        round: part === "year"
      });
  }
  if ("hour" in value2)
    switch (part) {
      case "dayPeriod": {
        let hours2 = value2.hour;
        let isPM = hours2 >= 12;
        return value2.set({
          hour: isPM ? hours2 - 12 : hours2 + 12
        });
      }
      case "hour":
      case "minute":
      case "second":
        return value2.cycle(part, amount, {
          round: part !== "hour",
          hourCycle: options.hour12 ? 12 : 24
        });
    }
  throw new Error("Unknown segment: " + part);
}
function $3c0fc76039f1c516$var$setSegment(value2, part, segmentValue, options) {
  switch (part) {
    case "day":
    case "month":
    case "year":
    case "era":
      return value2.set({
        [part]: segmentValue
      });
  }
  if ("hour" in value2 && typeof segmentValue === "number")
    switch (part) {
      case "dayPeriod": {
        let hours2 = value2.hour;
        let wasPM = hours2 >= 12;
        let isPM = segmentValue >= 12;
        if (isPM === wasPM)
          return value2;
        return value2.set({
          hour: wasPM ? hours2 - 12 : hours2 + 12
        });
      }
      case "hour":
        if (options.hour12) {
          let hours2 = value2.hour;
          let wasPM = hours2 >= 12;
          if (!wasPM && segmentValue === 12)
            segmentValue = 0;
          if (wasPM && segmentValue < 12)
            segmentValue += 12;
        }
      case "minute":
      case "second":
        return value2.set({
          [part]: segmentValue
        });
    }
  throw new Error("Unknown segment: " + part);
}
function $93c38a5e28be6249$export$e50a61c1de9f574(props) {
  var _value_start, _value_end;
  let overlayState = $fc909762b330b746$export$61c6a8c84e605fb6$2(props);
  let [controlledValue, setControlledValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.value, props.defaultValue || null, props.onChange);
  let [placeholderValue, setPlaceholderValue] = reactExports.useState(() => controlledValue || {
    start: null,
    end: null
  });
  if (controlledValue == null && placeholderValue.start && placeholderValue.end) {
    placeholderValue = {
      start: null,
      end: null
    };
    setPlaceholderValue(placeholderValue);
  }
  let value2 = controlledValue || placeholderValue;
  let setValue = (value3) => {
    setPlaceholderValue(value3 || {
      start: null,
      end: null
    });
    if ($93c38a5e28be6249$var$isCompleteRange(value3))
      setControlledValue(value3);
    else
      setControlledValue(null);
  };
  let v2 = (value2 === null || value2 === void 0 ? void 0 : value2.start) || (value2 === null || value2 === void 0 ? void 0 : value2.end) || props.placeholderValue || null;
  let [granularity, defaultTimeZone] = $35a22f14a1f04b11$export$2440da353cedad43(v2, props.granularity);
  let hasTime = granularity === "hour" || granularity === "minute" || granularity === "second";
  var _props_shouldCloseOnSelect;
  let shouldCloseOnSelect = (_props_shouldCloseOnSelect = props.shouldCloseOnSelect) !== null && _props_shouldCloseOnSelect !== void 0 ? _props_shouldCloseOnSelect : true;
  let [dateRange, setSelectedDateRange] = reactExports.useState(null);
  let [timeRange, setSelectedTimeRange] = reactExports.useState(null);
  if (value2 && $93c38a5e28be6249$var$isCompleteRange(value2)) {
    dateRange = value2;
    if ("hour" in value2.start)
      timeRange = value2;
  }
  let commitValue = (dateRange2, timeRange2) => {
    setValue({
      start: "timeZone" in timeRange2.start ? timeRange2.start.set($11d87f3f76e88657$export$93522d1a439f3617(dateRange2.start)) : $11d87f3f76e88657$export$b21e0b124e224484(dateRange2.start, timeRange2.start),
      end: "timeZone" in timeRange2.end ? timeRange2.end.set($11d87f3f76e88657$export$93522d1a439f3617(dateRange2.end)) : $11d87f3f76e88657$export$b21e0b124e224484(dateRange2.end, timeRange2.end)
    });
    setSelectedDateRange(null);
    setSelectedTimeRange(null);
    validation.commitValidation();
  };
  let setDateRange = (range3) => {
    let shouldClose = typeof shouldCloseOnSelect === "function" ? shouldCloseOnSelect() : shouldCloseOnSelect;
    if (hasTime) {
      if ($93c38a5e28be6249$var$isCompleteRange(range3) && (shouldClose || (timeRange === null || timeRange === void 0 ? void 0 : timeRange.start) && (timeRange === null || timeRange === void 0 ? void 0 : timeRange.end)))
        commitValue(range3, {
          start: (timeRange === null || timeRange === void 0 ? void 0 : timeRange.start) || $35a22f14a1f04b11$export$c5221a78ef73c5e9(props.placeholderValue),
          end: (timeRange === null || timeRange === void 0 ? void 0 : timeRange.end) || $35a22f14a1f04b11$export$c5221a78ef73c5e9(props.placeholderValue)
        });
      else
        setSelectedDateRange(range3);
    } else if ($93c38a5e28be6249$var$isCompleteRange(range3)) {
      setValue(range3);
      validation.commitValidation();
    } else
      setSelectedDateRange(range3);
    if (shouldClose)
      overlayState.setOpen(false);
  };
  let setTimeRange = (range3) => {
    if ($93c38a5e28be6249$var$isCompleteRange(dateRange) && $93c38a5e28be6249$var$isCompleteRange(range3))
      commitValue(dateRange, range3);
    else
      setSelectedTimeRange(range3);
  };
  let showEra = (value2 === null || value2 === void 0 ? void 0 : (_value_start = value2.start) === null || _value_start === void 0 ? void 0 : _value_start.calendar.identifier) === "gregory" && value2.start.era === "BC" || (value2 === null || value2 === void 0 ? void 0 : (_value_end = value2.end) === null || _value_end === void 0 ? void 0 : _value_end.calendar.identifier) === "gregory" && value2.end.era === "BC";
  let formatOpts = reactExports.useMemo(() => ({
    granularity,
    timeZone: defaultTimeZone,
    hideTimeZone: props.hideTimeZone,
    hourCycle: props.hourCycle,
    shouldForceLeadingZeros: props.shouldForceLeadingZeros,
    showEra
  }), [
    granularity,
    props.hourCycle,
    props.shouldForceLeadingZeros,
    defaultTimeZone,
    props.hideTimeZone,
    showEra
  ]);
  let { minValue, maxValue, isDateUnavailable } = props;
  let builtinValidation = reactExports.useMemo(() => $35a22f14a1f04b11$export$80ff8fc0ae339c13(value2, minValue, maxValue, isDateUnavailable, formatOpts), [
    value2,
    minValue,
    maxValue,
    isDateUnavailable,
    formatOpts
  ]);
  let validation = $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1({
    ...props,
    value: controlledValue,
    name: reactExports.useMemo(() => [
      props.startName,
      props.endName
    ].filter((n2) => n2 != null), [
      props.startName,
      props.endName
    ]),
    builtinValidation
  });
  let isValueInvalid = validation.displayValidation.isInvalid;
  let validationState = props.validationState || (isValueInvalid ? "invalid" : null);
  return {
    ...validation,
    value: value2,
    setValue,
    dateRange,
    timeRange,
    granularity,
    hasTime,
    setDate(part, date4) {
      var _dateRange_end, _dateRange_start;
      if (part === "start")
        setDateRange({
          start: date4,
          end: (_dateRange_end = dateRange === null || dateRange === void 0 ? void 0 : dateRange.end) !== null && _dateRange_end !== void 0 ? _dateRange_end : null
        });
      else
        setDateRange({
          start: (_dateRange_start = dateRange === null || dateRange === void 0 ? void 0 : dateRange.start) !== null && _dateRange_start !== void 0 ? _dateRange_start : null,
          end: date4
        });
    },
    setTime(part, time2) {
      var _timeRange_end, _timeRange_start;
      if (part === "start")
        setTimeRange({
          start: time2,
          end: (_timeRange_end = timeRange === null || timeRange === void 0 ? void 0 : timeRange.end) !== null && _timeRange_end !== void 0 ? _timeRange_end : null
        });
      else
        setTimeRange({
          start: (_timeRange_start = timeRange === null || timeRange === void 0 ? void 0 : timeRange.start) !== null && _timeRange_start !== void 0 ? _timeRange_start : null,
          end: time2
        });
    },
    setDateTime(part, dateTime) {
      var _value_end2, _value_start2;
      if (part === "start")
        setValue({
          start: dateTime,
          end: (_value_end2 = value2 === null || value2 === void 0 ? void 0 : value2.end) !== null && _value_end2 !== void 0 ? _value_end2 : null
        });
      else
        setValue({
          start: (_value_start2 = value2 === null || value2 === void 0 ? void 0 : value2.start) !== null && _value_start2 !== void 0 ? _value_start2 : null,
          end: dateTime
        });
    },
    setDateRange,
    setTimeRange,
    ...overlayState,
    setOpen(isOpen) {
      if (!isOpen && !((value2 === null || value2 === void 0 ? void 0 : value2.start) && (value2 === null || value2 === void 0 ? void 0 : value2.end)) && $93c38a5e28be6249$var$isCompleteRange(dateRange) && hasTime)
        commitValue(dateRange, {
          start: (timeRange === null || timeRange === void 0 ? void 0 : timeRange.start) || $35a22f14a1f04b11$export$c5221a78ef73c5e9(props.placeholderValue),
          end: (timeRange === null || timeRange === void 0 ? void 0 : timeRange.end) || $35a22f14a1f04b11$export$c5221a78ef73c5e9(props.placeholderValue)
        });
      overlayState.setOpen(isOpen);
    },
    validationState,
    isInvalid: isValueInvalid,
    formatValue(locale2, fieldOptions) {
      if (!value2 || !value2.start || !value2.end)
        return null;
      let startTimeZone = "timeZone" in value2.start ? value2.start.timeZone : void 0;
      let startGranularity = props.granularity || (value2.start && "minute" in value2.start ? "minute" : "day");
      let endTimeZone = "timeZone" in value2.end ? value2.end.timeZone : void 0;
      let endGranularity = props.granularity || (value2.end && "minute" in value2.end ? "minute" : "day");
      let startOptions = $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, {
        granularity: startGranularity,
        timeZone: startTimeZone,
        hideTimeZone: props.hideTimeZone,
        hourCycle: props.hourCycle,
        showEra: value2.start.calendar.identifier === "gregory" && value2.start.era === "BC" || value2.end.calendar.identifier === "gregory" && value2.end.era === "BC"
      });
      let startDate = value2.start.toDate(startTimeZone || "UTC");
      let endDate = value2.end.toDate(endTimeZone || "UTC");
      let startFormatter = new $fb18d541ea1ad717$export$ad991b66133851cf(locale2, startOptions);
      let endFormatter;
      if (startTimeZone === endTimeZone && startGranularity === endGranularity && value2.start.compare(value2.end) !== 0) {
        try {
          let parts = startFormatter.formatRangeToParts(startDate, endDate);
          let separatorIndex = -1;
          for (let i2 = 0; i2 < parts.length; i2++) {
            let part = parts[i2];
            if (part.source === "shared" && part.type === "literal")
              separatorIndex = i2;
            else if (part.source === "endRange")
              break;
          }
          let start2 = "";
          let end2 = "";
          for (let i2 = 0; i2 < parts.length; i2++) {
            if (i2 < separatorIndex)
              start2 += parts[i2].value;
            else if (i2 > separatorIndex)
              end2 += parts[i2].value;
          }
          return {
            start: start2,
            end: end2
          };
        } catch {
        }
        endFormatter = startFormatter;
      } else {
        let endOptions = $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, {
          granularity: endGranularity,
          timeZone: endTimeZone,
          hideTimeZone: props.hideTimeZone,
          hourCycle: props.hourCycle
        });
        endFormatter = new $fb18d541ea1ad717$export$ad991b66133851cf(locale2, endOptions);
      }
      return {
        start: startFormatter.format(startDate),
        end: endFormatter.format(endDate)
      };
    },
    getDateFormatter(locale2, formatOptions) {
      let newOptions = {
        ...formatOpts,
        ...formatOptions
      };
      let newFormatOptions = $35a22f14a1f04b11$export$7e319ea407e63bc0({}, newOptions);
      return new $fb18d541ea1ad717$export$ad991b66133851cf(locale2, newFormatOptions);
    }
  };
}
function $93c38a5e28be6249$var$isCompleteRange(value2) {
  return (value2 === null || value2 === void 0 ? void 0 : value2.start) != null && value2.end != null;
}
function $eff5d8ee529ac4bb$export$fd53cef0cc796101(props) {
  let { placeholderValue = new $35ea8db9cb2ccb90$export$680ea196effce5f(), minValue, maxValue, granularity, validate: validate2 } = props;
  var _props_defaultValue;
  let [value2, setValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : null, props.onChange);
  let v2 = value2 || placeholderValue;
  let day = v2 && "day" in v2 ? v2 : void 0;
  let defaultValueTimeZone = props.defaultValue && "timeZone" in props.defaultValue ? props.defaultValue.timeZone : void 0;
  let placeholderDate = reactExports.useMemo(() => {
    let valueTimeZone = v2 && "timeZone" in v2 ? v2.timeZone : void 0;
    return (valueTimeZone || defaultValueTimeZone) && placeholderValue ? $11d87f3f76e88657$export$84c95a83c799e074($eff5d8ee529ac4bb$var$convertValue(placeholderValue), valueTimeZone || defaultValueTimeZone) : $eff5d8ee529ac4bb$var$convertValue(placeholderValue);
  }, [
    placeholderValue,
    v2,
    defaultValueTimeZone
  ]);
  let minDate = reactExports.useMemo(() => $eff5d8ee529ac4bb$var$convertValue(minValue, day), [
    minValue,
    day
  ]);
  let maxDate = reactExports.useMemo(() => $eff5d8ee529ac4bb$var$convertValue(maxValue, day), [
    maxValue,
    day
  ]);
  let timeValue = reactExports.useMemo(() => value2 && "day" in value2 ? $11d87f3f76e88657$export$d33f79e3ffc3dc83(value2) : value2, [
    value2
  ]);
  let dateTime = reactExports.useMemo(() => value2 == null ? null : $eff5d8ee529ac4bb$var$convertValue(value2), [
    value2
  ]);
  let onChange = (newValue) => {
    setValue(day || defaultValueTimeZone ? newValue : newValue && $11d87f3f76e88657$export$d33f79e3ffc3dc83(newValue));
  };
  let state = $3c0fc76039f1c516$export$60e84778edff6d26({
    ...props,
    value: dateTime,
    defaultValue: void 0,
    minValue: minDate,
    maxValue: maxDate,
    onChange,
    granularity: granularity || "minute",
    maxGranularity: "hour",
    placeholderValue: placeholderDate !== null && placeholderDate !== void 0 ? placeholderDate : void 0,
    // Calendar should not matter for time fields.
    createCalendar: () => new $3b62074eb05584b2$export$80ee6245ec4f29ec(),
    validate: reactExports.useCallback(() => validate2 === null || validate2 === void 0 ? void 0 : validate2(value2), [
      validate2,
      value2
    ])
  });
  return {
    ...state,
    timeValue
  };
}
function $eff5d8ee529ac4bb$var$convertValue(value2, date4 = $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2())) {
  if (!value2)
    return null;
  if ("day" in value2)
    return value2;
  return $11d87f3f76e88657$export$b21e0b124e224484(date4, value2);
}
function useDateInput(originalProps) {
  var _a2, _b2, _c2, _d, _e, _f, _g;
  const globalContext = useProviderContext();
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext$1) || {};
  const [props, variantProps2] = mapPropsVariants(originalProps, dateInput.variantKeys);
  const { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$2();
  const calendarProp = $64244302c3013299$export$dd0bbc9b26defe37(
    new $fb18d541ea1ad717$export$ad991b66133851cf(locale2).resolvedOptions().calendar
  );
  const gregorianYearOffset = getGregorianYearOffset(calendarProp.identifier);
  const {
    ref,
    as: as2,
    label,
    inputRef: inputRefProp,
    description,
    startContent,
    endContent,
    className,
    classNames: classNames2,
    validationState,
    groupProps = {},
    labelProps: labelPropsProp,
    fieldProps: fieldPropsProp,
    innerWrapperProps: innerWrapperPropsProp,
    errorMessageProps: errorMessagePropsProp,
    descriptionProps: descriptionPropsProp,
    validationBehavior = (_a2 = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _a2 : "native",
    shouldForceLeadingZeros = true,
    minValue = (_c2 = (_b2 = globalContext == null ? void 0 : globalContext.defaultDates) == null ? void 0 : _b2.minDate) != null ? _c2 : new $35ea8db9cb2ccb90$export$99faa760c7908e4f(calendarProp, 1900 + gregorianYearOffset, 1, 1),
    maxValue = (_e = (_d = globalContext == null ? void 0 : globalContext.defaultDates) == null ? void 0 : _d.maxDate) != null ? _e : new $35ea8db9cb2ccb90$export$99faa760c7908e4f(calendarProp, 2099 + gregorianYearOffset, 12, 31),
    createCalendar: createCalendarProp = (_f = globalContext == null ? void 0 : globalContext.createCalendar) != null ? _f : null,
    isInvalid: isInvalidProp = validationState ? validationState === "invalid" : false,
    errorMessage
  } = props;
  const domRef = useDOMRef(ref);
  const inputRef = useDOMRef(inputRefProp);
  const disableAnimation = (_g = originalProps.disableAnimation) != null ? _g : globalContext == null ? void 0 : globalContext.disableAnimation;
  const state = $3c0fc76039f1c516$export$60e84778edff6d26({
    ...originalProps,
    label,
    locale: locale2,
    minValue,
    maxValue,
    validationBehavior,
    shouldForceLeadingZeros,
    createCalendar: !createCalendarProp || typeof createCalendarProp !== "function" ? $64244302c3013299$export$dd0bbc9b26defe37 : createCalendarProp
  });
  const {
    labelProps,
    fieldProps,
    inputProps,
    validationErrors,
    validationDetails,
    descriptionProps,
    errorMessageProps,
    isInvalid: ariaIsInvalid
  } = $16f0b7bb276bc17e$export$5591b0b878c1a989({ ...originalProps, label, validationBehavior, inputRef }, state, domRef);
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const isInvalid = isInvalidProp || ariaIsInvalid;
  const labelPlacement = useLabelPlacement({
    labelPlacement: originalProps.labelPlacement,
    label
  });
  const shouldLabelBeOutside = labelPlacement === "outside" || labelPlacement === "outside-left";
  const slots = reactExports.useMemo(
    () => dateInput({
      ...variantProps2,
      disableAnimation,
      labelPlacement
    }),
    [objectToDeps(variantProps2), disableAnimation, labelPlacement]
  );
  const getLabelProps = (props2) => {
    return {
      ...mergeProps$3(labelProps, labelPropsProp, props2),
      "data-slot": "label",
      className: slots.label({
        class: clsx$4(classNames2 == null ? void 0 : classNames2.label, void 0)
      })
    };
  };
  const getInputProps = (props2) => {
    return {
      ...props2,
      ...inputProps,
      ref: inputRef
    };
  };
  const getFieldProps = (props2 = {}) => {
    return {
      ref: domRef,
      "data-slot": "input-field",
      ...mergeProps$3(fieldProps, fieldPropsProp, props2),
      className: slots.input({
        class: clsx$4(classNames2 == null ? void 0 : classNames2.input, props2 == null ? void 0 : props2.className)
      })
    };
  };
  const getInputWrapperProps = (props2 = {}) => {
    return {
      ...props2,
      ...groupProps,
      "data-slot": "input-wrapper",
      className: slots.inputWrapper({
        class: classNames2 == null ? void 0 : classNames2.inputWrapper
      }),
      onClick: fieldProps.onClick
    };
  };
  const getInnerWrapperProps = (props2) => {
    const innerWrapperProps = mergeProps$3(innerWrapperPropsProp, props2);
    return {
      ...innerWrapperProps,
      "data-slot": "inner-wrapper",
      className: slots.innerWrapper({
        class: cn(classNames2 == null ? void 0 : classNames2.innerWrapper, innerWrapperProps == null ? void 0 : innerWrapperProps.className)
      })
    };
  };
  const getHelperWrapperProps = (props2) => {
    return {
      ...props2,
      "data-slot": "helper-wrapper",
      className: slots.helperWrapper({
        class: clsx$4(classNames2 == null ? void 0 : classNames2.helperWrapper, void 0)
      })
    };
  };
  const getErrorMessageProps = (props2 = {}) => {
    return {
      ...mergeProps$3(errorMessageProps, errorMessagePropsProp, props2),
      "data-slot": "error-message",
      className: slots.errorMessage({ class: clsx$4(classNames2 == null ? void 0 : classNames2.errorMessage, props2 == null ? void 0 : props2.className) })
    };
  };
  const getDescriptionProps = (props2 = {}) => {
    return {
      ...mergeProps$3(descriptionProps, descriptionPropsProp, props2),
      "data-slot": "description",
      className: slots.description({ class: clsx$4(classNames2 == null ? void 0 : classNames2.description, props2 == null ? void 0 : props2.className) })
    };
  };
  const getBaseGroupProps = () => {
    return {
      as: as2,
      label,
      description,
      endContent,
      errorMessage,
      isInvalid,
      startContent,
      validationDetails,
      validationErrors,
      shouldLabelBeOutside,
      "data-slot": "base",
      "data-required": dataAttr(originalProps.isRequired),
      "data-disabled": dataAttr(originalProps.isDisabled),
      "data-readonly": dataAttr(originalProps.isReadOnly),
      "data-invalid": dataAttr(isInvalid),
      "data-has-start-content": dataAttr(!!startContent),
      "data-has-end-content": dataAttr(!!endContent),
      descriptionProps: getDescriptionProps(),
      errorMessageProps: getErrorMessageProps(),
      groupProps: getInputWrapperProps(),
      helperWrapperProps: getHelperWrapperProps(),
      labelProps: getLabelProps(),
      wrapperProps: getInnerWrapperProps(),
      className: slots.base({ class: baseStyles })
    };
  };
  return {
    state,
    domRef,
    slots,
    classNames: classNames2,
    labelPlacement,
    getBaseGroupProps,
    getFieldProps,
    getInputProps
  };
}
var DateInput$1 = forwardRef(function DateInput2(props, ref) {
  const { state, slots, classNames: classNames2, getBaseGroupProps, getInputProps, getFieldProps } = useDateInput({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(DateInputGroup, { ...getBaseGroupProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    DateInputField,
    {
      classNames: classNames2,
      inputProps: getInputProps(),
      slots,
      state,
      ...getFieldProps()
    }
  ) });
});
var date_input_default = DateInput$1;
function useTimeInput(originalProps) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext$1) || {};
  const [props, variantProps2] = mapPropsVariants(originalProps, dateInput.variantKeys);
  const {
    ref,
    as: as2,
    label,
    inputRef: inputRefProp,
    description,
    startContent,
    endContent,
    className,
    classNames: classNames2,
    groupProps = {},
    labelProps: labelPropsProp,
    fieldProps: fieldPropsProp,
    errorMessageProps: errorMessagePropsProp,
    descriptionProps: descriptionPropsProp,
    validationBehavior = (_a2 = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _a2 : "native",
    shouldForceLeadingZeros = true,
    minValue,
    maxValue,
    isInvalid: isInvalidProp,
    errorMessage
  } = props;
  const domRef = useDOMRef(ref);
  const inputRef = useDOMRef(inputRefProp);
  const { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$2();
  const disableAnimation = (_b2 = originalProps.disableAnimation) != null ? _b2 : globalContext == null ? void 0 : globalContext.disableAnimation;
  const state = $eff5d8ee529ac4bb$export$fd53cef0cc796101({
    ...originalProps,
    label,
    locale: locale2,
    minValue,
    maxValue,
    validationBehavior,
    isInvalid: isInvalidProp,
    shouldForceLeadingZeros
  });
  const {
    labelProps,
    fieldProps,
    inputProps,
    validationErrors,
    validationDetails,
    descriptionProps,
    errorMessageProps,
    isInvalid
  } = $16f0b7bb276bc17e$export$4c842f6a241dc825({ ...originalProps, label, validationBehavior, inputRef }, state, domRef);
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const labelPlacement = useLabelPlacement({
    labelPlacement: originalProps.labelPlacement,
    label
  });
  const shouldLabelBeOutside = labelPlacement === "outside" || labelPlacement === "outside-left";
  const slots = reactExports.useMemo(
    () => dateInput({
      ...variantProps2,
      disableAnimation,
      labelPlacement
    }),
    [objectToDeps(variantProps2), labelPlacement, disableAnimation]
  );
  const getLabelProps = (props2) => {
    return {
      ...mergeProps$3(labelProps, labelPropsProp, props2),
      "data-slot": "label",
      className: slots.label({
        class: clsx$4(classNames2 == null ? void 0 : classNames2.label, void 0)
      })
    };
  };
  const getInputProps = (props2) => {
    return {
      ...props2,
      ...inputProps,
      ref: inputRef
    };
  };
  const getFieldProps = (props2 = {}) => {
    return {
      ref: domRef,
      "data-slot": "input",
      ...mergeProps$3(fieldProps, fieldPropsProp, props2),
      className: slots.input({
        class: clsx$4(classNames2 == null ? void 0 : classNames2.input, props2 == null ? void 0 : props2.className)
      })
    };
  };
  const getInputWrapperProps = (props2 = {}) => {
    return {
      ...props2,
      ...groupProps,
      "data-slot": "input-wrapper",
      className: slots.inputWrapper({
        class: classNames2 == null ? void 0 : classNames2.inputWrapper
      }),
      onClick: fieldProps.onClick
    };
  };
  const getInnerWrapperProps = (props2) => {
    return {
      ...props2,
      "data-slot": "inner-wrapper",
      className: slots.innerWrapper({
        class: classNames2 == null ? void 0 : classNames2.innerWrapper
      })
    };
  };
  const getHelperWrapperProps = (props2) => {
    return {
      ...props2,
      "data-slot": "helper-wrapper",
      className: slots.helperWrapper({
        class: clsx$4(classNames2 == null ? void 0 : classNames2.helperWrapper, void 0)
      })
    };
  };
  const getErrorMessageProps = (props2 = {}) => {
    return {
      ...mergeProps$3(errorMessageProps, errorMessagePropsProp, props2),
      "data-slot": "error-message",
      className: slots.errorMessage({ class: clsx$4(classNames2 == null ? void 0 : classNames2.errorMessage, props2 == null ? void 0 : props2.className) })
    };
  };
  const getDescriptionProps = (props2 = {}) => {
    return {
      ...mergeProps$3(descriptionProps, descriptionPropsProp, props2),
      "data-slot": "description",
      className: slots.description({ class: clsx$4(classNames2 == null ? void 0 : classNames2.description, props2 == null ? void 0 : props2.className) })
    };
  };
  const getBaseGroupProps = () => {
    return {
      as: as2,
      label,
      description,
      endContent,
      errorMessage,
      isInvalid,
      startContent,
      validationDetails,
      validationErrors,
      shouldLabelBeOutside,
      "data-slot": "base",
      "data-required": dataAttr(originalProps.isRequired),
      "data-disabled": dataAttr(originalProps.isDisabled),
      "data-readonly": dataAttr(originalProps.isReadOnly),
      "data-invalid": dataAttr(isInvalid),
      "data-has-start-content": dataAttr(!!startContent),
      "data-has-end-content": dataAttr(!!endContent),
      descriptionProps: getDescriptionProps(),
      errorMessageProps: getErrorMessageProps(),
      groupProps: getInputWrapperProps(),
      helperWrapperProps: getHelperWrapperProps(),
      labelProps: getLabelProps(),
      wrapperProps: getInnerWrapperProps(),
      className: slots.base({ class: baseStyles })
    };
  };
  return {
    state,
    domRef,
    slots,
    classNames: classNames2,
    labelPlacement,
    getBaseGroupProps,
    getFieldProps,
    getInputProps
  };
}
var TimeInput$1 = forwardRef(function TimeInput2(props, ref) {
  const { state, slots, classNames: classNames2, getBaseGroupProps, getInputProps, getFieldProps } = useTimeInput({
    ...props,
    ref
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(DateInputGroup, { ...getBaseGroupProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    DateInputField,
    {
      classNames: classNames2,
      inputProps: getInputProps(),
      slots,
      state,
      ...getFieldProps()
    }
  ) });
});
var time_input_default = TimeInput$1;
const $148a7a147e38ea7f$var$RTL_SCRIPTS$1 = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS$1 = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764$1(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS$1.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS$1.has(lang2);
}
const $b5e257d569688ac6$var$defaultContext$1 = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$1 = /* @__PURE__ */ React$5.createContext($b5e257d569688ac6$var$defaultContext$1);
const $b5e257d569688ac6$var$IsSSRContext$1 = /* @__PURE__ */ React$5.createContext(false);
let $b5e257d569688ac6$var$componentIds$1 = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$1(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$1);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$1.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$1.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$1.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$1(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$1);
  let counter = $b5e257d569688ac6$var$useCounter$1(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$1(defaultId) {
  let id2 = React$5.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$1());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$1.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$5["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$1 : $b5e257d569688ac6$var$useLegacySSRSafeId$1;
function $b5e257d569688ac6$var$getSnapshot$1() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$1() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$1(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$1() {
  if (typeof React$5["useSyncExternalStore"] === "function")
    return React$5["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$1, $b5e257d569688ac6$var$getSnapshot$1, $b5e257d569688ac6$var$getServerSnapshot$1);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$1);
}
const $1e5a04cdaf7d1af8$var$localeSymbol$1 = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$1() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol$1] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764$1(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale$1 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$1();
let $1e5a04cdaf7d1af8$var$listeners$1 = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale$1() {
  $1e5a04cdaf7d1af8$var$currentLocale$1 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$1();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners$1)
    listener($1e5a04cdaf7d1af8$var$currentLocale$1);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$1() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$1();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale$1);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners$1.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$1);
    $1e5a04cdaf7d1af8$var$listeners$1.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners$1.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners$1.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$1);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext$1 = /* @__PURE__ */ React$5.createContext(null);
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$1() {
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$1();
  let context = reactExports.useContext($18f2051aff69b9bf$var$I18nContext$1);
  return context || defaultLocale;
}
const $fca6afa0e843324b$var$cache = /* @__PURE__ */ new WeakMap();
function $fca6afa0e843324b$var$getCachedDictionary(strings) {
  let dictionary = $fca6afa0e843324b$var$cache.get(strings);
  if (!dictionary) {
    dictionary = new $5b160d28a433310d$export$c17fa47878dc55b6(strings);
    $fca6afa0e843324b$var$cache.set(strings, dictionary);
  }
  return dictionary;
}
function $fca6afa0e843324b$export$87b761675e8eaa10(strings, packageName) {
  return $fca6afa0e843324b$var$getCachedDictionary(strings);
}
function $fca6afa0e843324b$export$f12b703ca79dfbb1(strings, packageName) {
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$1();
  let dictionary = $fca6afa0e843324b$export$87b761675e8eaa10(strings);
  return reactExports.useMemo(() => new $6db58dc88e78b024$export$2f817fcdc4b89ae0(locale2, dictionary), [
    locale2,
    dictionary
  ]);
}
function $458b0a5536c1a7cf$export$40bfa8c7b0832715$1(value2, defaultValue2, onChange) {
  let [stateValue, setStateValue] = reactExports.useState(value2 || defaultValue2);
  let isControlledRef = reactExports.useRef(value2 !== void 0);
  let isControlled = value2 !== void 0;
  reactExports.useEffect(() => {
    isControlledRef.current;
    isControlledRef.current = isControlled;
  }, [
    isControlled
  ]);
  let currentValue = isControlled ? value2 : stateValue;
  let setValue = reactExports.useCallback((value22, ...args) => {
    let onChangeCaller = (value3, ...onChangeArgs) => {
      if (onChange) {
        if (!Object.is(currentValue, value3))
          onChange(value3, ...onChangeArgs);
      }
      if (!isControlled)
        currentValue = value3;
    };
    if (typeof value22 === "function") {
      let updateFunction = (oldValue, ...functionArgs) => {
        let interceptedValue = value22(isControlled ? currentValue : oldValue, ...functionArgs);
        onChangeCaller(interceptedValue, ...args);
        if (!isControlled)
          return interceptedValue;
        return oldValue;
      };
      setStateValue(updateFunction);
    } else {
      if (!isControlled)
        setStateValue(value22);
      onChangeCaller(value22, ...args);
    }
  }, [
    isControlled,
    currentValue,
    onChange
  ]);
  return [
    currentValue,
    setValue
  ];
}
var messages_default = {
  "ar-AE": {
    endTime: "وقت الانتهاء",
    startTime: "وقت البدء",
    time: "الوقت"
  },
  "bg-BG": {
    endTime: "Краен час",
    startTime: "Начален час",
    time: "Време"
  },
  "cs-CZ": {
    endTime: "Konečný čas",
    startTime: "Počáteční čas",
    time: "Čas"
  },
  "da-DK": {
    endTime: "Sluttidspunkt",
    startTime: "Starttidspunkt",
    time: "Klokkeslæt"
  },
  "de-DE": {
    endTime: "Endzeit",
    startTime: "Startzeit",
    time: "Uhrzeit"
  },
  "el-GR": {
    endTime: "Χρόνος λήξης",
    startTime: "Ώρα έναρξης",
    time: "Χρόνος"
  },
  "en-US": {
    time: "Time",
    startTime: "Start time",
    endTime: "End time"
  },
  "es-ES": {
    endTime: "Hora de finalización",
    startTime: "Hora de inicio",
    time: "Hora"
  },
  "et-EE": {
    endTime: "Lõpuaeg",
    startTime: "Algusaeg",
    time: "Aeg"
  },
  "fi-FI": {
    endTime: "Päättymisaika",
    startTime: "Alkamisaika",
    time: "Aika"
  },
  "fr-FR": {
    endTime: "Heure de fin",
    startTime: "Heure de début",
    time: "Heure"
  },
  "he-IL": {
    endTime: "שעת סיום",
    startTime: "שעת התחלה",
    time: "זמן"
  },
  "hr-HR": {
    endTime: "Vrijeme završetka",
    startTime: "Vrijeme početka",
    time: "Vrijeme"
  },
  "hu-HU": {
    endTime: "Befejezés ideje",
    startTime: "Kezdés ideje",
    time: "Idő"
  },
  "it-IT": {
    endTime: "Ora di fine",
    startTime: "Ora di inizio",
    time: "Ora"
  },
  "ja-JP": {
    endTime: "終了時刻",
    startTime: "開始時刻",
    time: "時刻"
  },
  "ko-KR": {
    endTime: "종료 시간",
    startTime: "시작 시간",
    time: "시간"
  },
  "it-LT": {
    endTime: "Pabaigos laikas",
    startTime: "Pradžios laikas",
    time: "Laikas"
  },
  "lv-LV": {
    endTime: "Beigu laiks",
    startTime: "Sākuma laiks",
    time: "Laiks"
  },
  "nb-NO": {
    endTime: "Sluttid",
    startTime: "Starttid",
    time: "Tid"
  },
  "nl-NL": {
    endTime: "Eindtijd",
    startTime: "Starttijd",
    time: "Tijd"
  },
  "pl-PL": {
    endTime: "Godzina końcowa",
    startTime: "Godzina początkowa",
    time: "Godzina"
  },
  "pt-BR": {
    endTime: "Hora final",
    startTime: "Hora inicial",
    time: "Hora"
  },
  "pt-PT": {
    endTime: "Terminar tempo",
    startTime: "Iniciar tempo",
    time: "Tempo"
  },
  "ro-RO": {
    endTime: "Ora de sfârșit",
    startTime: "Ora de început",
    time: "Ora"
  },
  "ru-RU": {
    endTime: "Время окончания",
    startTime: "Время начала",
    time: "Время"
  },
  "sk-SK": {
    endTime: "Čas ukončenia",
    startTime: "Čas začiatku",
    time: "Čas"
  },
  "sl-SI": {
    endTime: "Končni čas",
    startTime: "Začetni čas",
    time: "Čas"
  },
  "sr-SP": {
    endTime: "Završno vreme",
    startTime: "Početno vreme",
    time: "Vreme"
  },
  "sv-SE": {
    endTime: "Sluttid",
    startTime: "Starttid",
    time: "Tid"
  },
  "tr-TR": {
    endTime: "Bitiş saati",
    startTime: "Başlangıç saati",
    time: "Saat"
  },
  "uk-UA": {
    endTime: "Час завершення",
    startTime: "Час початку",
    time: "Час"
  },
  "zh-CN": {
    endTime: "结束时间",
    startTime: "开始时间",
    time: "时间"
  },
  "zh-TW": {
    endTime: "結束時間",
    startTime: "開始時間",
    time: "時間"
  }
};
function useDatePickerBase(originalProps) {
  var _a2, _b2, _c2, _d;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, dateInput.variantKeys);
  const {
    as: as2,
    ref,
    label,
    endContent,
    selectorIcon,
    inputRef,
    isInvalid,
    errorMessage,
    description,
    startContent,
    validationState,
    validationBehavior,
    visibleMonths = 1,
    firstDayOfWeek,
    pageBehavior = "visible",
    calendarWidth = 256,
    isDateUnavailable,
    shouldForceLeadingZeros,
    showMonthAndYearPickers = false,
    selectorButtonProps: userSelectorButtonProps = {},
    popoverProps: userPopoverProps = {},
    timeInputProps: userTimeInputProps = {},
    calendarProps: userCalendarProps = {},
    CalendarTopContent,
    CalendarBottomContent,
    createCalendar
  } = props;
  const {
    isHeaderExpanded,
    isHeaderDefaultExpanded,
    onHeaderExpandedChange,
    ...restUserCalendarProps
  } = userCalendarProps;
  const handleHeaderExpandedChange = reactExports.useCallback(
    (isExpanded) => {
      onHeaderExpandedChange == null ? void 0 : onHeaderExpandedChange(isExpanded || false);
    },
    [onHeaderExpandedChange]
  );
  const [isCalendarHeaderExpanded, setIsCalendarHeaderExpanded] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$1(isHeaderExpanded, isHeaderDefaultExpanded != null ? isHeaderDefaultExpanded : false, handleHeaderExpandedChange);
  const domRef = useDOMRef(ref);
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1(messages_default);
  const isDefaultColor = originalProps.color === "default" || !originalProps.color;
  const hasMultipleMonths = visibleMonths > 1;
  const placeholder = originalProps == null ? void 0 : originalProps.placeholderValue;
  const timePlaceholder = placeholder && "hour" in placeholder ? placeholder : null;
  const timeMinValue = originalProps.minValue && "hour" in originalProps.minValue ? originalProps.minValue : null;
  const timeMaxValue = originalProps.maxValue && "hour" in originalProps.maxValue ? originalProps.maxValue : null;
  const slotsProps = {
    popoverProps: mergeProps$3(
      {
        offset: 13,
        placement: "bottom",
        triggerScaleOnOpen: false,
        disableAnimation
      },
      userPopoverProps
    ),
    selectorButtonProps: mergeProps$3(
      {
        isIconOnly: true,
        radius: "full",
        size: "sm",
        variant: "light",
        disableAnimation
      },
      userSelectorButtonProps
    ),
    calendarProps: mergeProps$3(
      {
        showHelper: false,
        visibleMonths,
        pageBehavior,
        isDateUnavailable,
        showMonthAndYearPickers,
        isHeaderExpanded: isCalendarHeaderExpanded,
        onHeaderExpandedChange: setIsCalendarHeaderExpanded,
        color: isDefaultColor ? "primary" : originalProps.color,
        disableAnimation,
        firstDayOfWeek
      },
      restUserCalendarProps
    )
  };
  const dateInputProps = {
    as: as2,
    label,
    ref: domRef,
    inputRef,
    description,
    validationState,
    shouldForceLeadingZeros,
    isInvalid,
    errorMessage,
    validationBehavior,
    "data-invalid": dataAttr(originalProps == null ? void 0 : originalProps.isInvalid)
  };
  const timeInputProps = {
    ...userTimeInputProps,
    size: "sm",
    labelPlacement: "outside-left",
    label: (userTimeInputProps == null ? void 0 : userTimeInputProps.label) || stringFormatter.format("time"),
    placeholderValue: timePlaceholder,
    hourCycle: props.hourCycle,
    hideTimeZone: props.hideTimeZone,
    validationBehavior
  };
  const popoverProps = {
    ...slotsProps.popoverProps,
    children: (_d = (_c2 = slotsProps.popoverProps) == null ? void 0 : _c2.children) != null ? _d : [],
    triggerRef: domRef
  };
  const calendarProps = {
    ...slotsProps.calendarProps,
    calendarWidth,
    "data-slot": "calendar"
  };
  const selectorButtonProps = {
    ...slotsProps.selectorButtonProps,
    "data-slot": "selector-button"
  };
  const selectorIconProps = {
    "data-slot": "selector-icon"
  };
  const onClose = () => {
    if (isHeaderExpanded === void 0) {
      setIsCalendarHeaderExpanded(false);
    }
  };
  return {
    domRef,
    startContent,
    endContent,
    selectorIcon,
    createCalendar,
    stringFormatter,
    hasMultipleMonths,
    slotsProps,
    timeMinValue,
    timeMaxValue,
    visibleMonths,
    isCalendarHeaderExpanded,
    disableAnimation,
    CalendarTopContent,
    CalendarBottomContent,
    variantProps: variantProps2,
    dateInputProps,
    timeInputProps,
    popoverProps,
    calendarProps,
    userTimeInputProps,
    selectorButtonProps,
    selectorIconProps,
    onClose
  };
}
var DateRangePickerField = reactExports.forwardRef(function DateRangePickerField2(props, ref) {
  const { as: as2, slots, createCalendar: createCalendarProp, classNames: classNames2, ...otherProps } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$1();
  let state = $3c0fc76039f1c516$export$60e84778edff6d26({
    ...otherProps,
    locale: locale2,
    createCalendar: !createCalendarProp || typeof createCalendarProp !== "function" ? $64244302c3013299$export$dd0bbc9b26defe37 : createCalendarProp
  });
  const inputRef = reactExports.useRef(null);
  const {
    fieldProps,
    inputProps,
    isInvalid: ariaIsInvalid
  } = $16f0b7bb276bc17e$export$5591b0b878c1a989({ ...otherProps, inputRef }, state, domRef);
  const isInvalid = props.isInvalid || ariaIsInvalid;
  state.isInvalid = isInvalid;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...mergeProps$3(fieldProps, filterDOMProps(otherProps)), ref: domRef, children: [
    state.segments.map((segment, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      DateInputSegment,
      {
        classNames: classNames2,
        segment,
        slots,
        state
      },
      i2
    )),
    /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...inputProps, ref: inputRef })
  ] });
});
var date_range_picker_field_default = DateRangePickerField;
function useDateRangePicker({
  as: as2,
  label,
  isInvalid: isInvalidProp,
  description,
  startContent,
  endContent,
  selectorIcon,
  errorMessage,
  className,
  classNames: classNames2,
  ...originalProps
}) {
  var _a2, _b2, _c2;
  const globalContext = useProviderContext();
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext$1) || {};
  const validationBehavior = (_c2 = (_b2 = (_a2 = originalProps.validationBehavior) != null ? _a2 : formValidationBehavior) != null ? _b2 : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _c2 : "native";
  const {
    domRef,
    slotsProps,
    createCalendar,
    stringFormatter,
    timeMinValue,
    timeMaxValue,
    isCalendarHeaderExpanded,
    disableAnimation,
    CalendarTopContent,
    CalendarBottomContent,
    timeInputProps,
    popoverProps,
    calendarProps,
    variantProps: variantProps2,
    userTimeInputProps,
    hasMultipleMonths,
    selectorButtonProps,
    selectorIconProps
  } = useDatePickerBase({ ...originalProps, validationBehavior });
  let state = $93c38a5e28be6249$export$e50a61c1de9f574({
    ...originalProps,
    validationBehavior,
    shouldCloseOnSelect: () => !state.hasTime
  });
  const popoverTriggerRef = reactExports.useRef(null);
  let {
    groupProps,
    labelProps,
    startFieldProps,
    endFieldProps,
    buttonProps,
    dialogProps,
    calendarProps: ariaCalendarProps,
    validationDetails,
    validationErrors,
    descriptionProps,
    errorMessageProps,
    isInvalid: isAriaInvalid
  } = $887cac91b7cc8801$export$12fd5f0e9f4bb192({ ...originalProps, validationBehavior }, state, domRef);
  reactExports.useEffect(() => {
    state.commitValidation();
  }, [state.value, state.commitValidation]);
  const isInvalid = isInvalidProp || isAriaInvalid;
  const slots = reactExports.useMemo(
    () => dateRangePicker({
      ...variantProps2,
      className
    }),
    [objectToDeps(variantProps2), className]
  );
  const timeGranularity = state.granularity === "hour" || state.granularity === "minute" || state.granularity === "second" ? state.granularity : null;
  const showTimeField = !!timeGranularity;
  const labelPlacement = useLabelPlacement({
    labelPlacement: originalProps.labelPlacement,
    label
  });
  const shouldLabelBeOutside = labelPlacement === "outside" || labelPlacement === "outside-left";
  const getStartTimeInputProps = () => {
    var _a22, _b22, _c22;
    if (!showTimeField)
      return {};
    return {
      ...timeInputProps,
      label: stringFormatter.format("startTime"),
      value: ((_a22 = state.timeRange) == null ? void 0 : _a22.start) || null,
      onChange: (v2) => state.setTime("start", v2),
      granularity: timeGranularity,
      minValue: timeMinValue,
      maxValue: timeMaxValue,
      classNames: {
        base: slots.timeInput({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.timeInput, (_b22 = userTimeInputProps == null ? void 0 : userTimeInputProps.classNames) == null ? void 0 : _b22.base)
        }),
        label: slots.timeInputLabel({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.timeInputLabel, (_c22 = userTimeInputProps == null ? void 0 : userTimeInputProps.classNames) == null ? void 0 : _c22.label)
        })
      }
    };
  };
  const getEndTimeInputProps = () => {
    var _a22, _b22, _c22;
    if (!showTimeField)
      return {};
    return {
      ...timeInputProps,
      label: stringFormatter.format("endTime"),
      value: ((_a22 = state.timeRange) == null ? void 0 : _a22.end) || null,
      onChange: (v2) => state.setTime("end", v2),
      granularity: timeGranularity,
      minValue: timeMinValue,
      maxValue: timeMaxValue,
      classNames: {
        base: slots.timeInput({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.timeInput, (_b22 = userTimeInputProps == null ? void 0 : userTimeInputProps.classNames) == null ? void 0 : _b22.base)
        }),
        label: slots.timeInputLabel({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.timeInputLabel, (_c22 = userTimeInputProps == null ? void 0 : userTimeInputProps.classNames) == null ? void 0 : _c22.label)
        })
      }
    };
  };
  const getPopoverProps = (props = {}) => {
    var _a22, _b22;
    return {
      state,
      dialogProps,
      ...props,
      ...popoverProps,
      triggerRef: popoverTriggerRef,
      classNames: {
        content: slots.popoverContent({
          class: clsx$4(
            classNames2 == null ? void 0 : classNames2.popoverContent,
            (_b22 = (_a22 = slotsProps.popoverProps) == null ? void 0 : _a22.classNames) == null ? void 0 : _b22["content"],
            props.className
          )
        })
      }
    };
  };
  const getCalendarProps = () => {
    var _a22, _b22;
    return {
      ...ariaCalendarProps,
      ...calendarProps,
      classNames: {
        ...calendarProps.classNames,
        base: slots.calendar({ class: cn((_a22 = calendarProps == null ? void 0 : calendarProps.classNames) == null ? void 0 : _a22.base, classNames2 == null ? void 0 : classNames2.calendar) }),
        content: slots.calendarContent({
          class: cn((_b22 = calendarProps == null ? void 0 : calendarProps.classNames) == null ? void 0 : _b22.content, classNames2 == null ? void 0 : classNames2.calendarContent)
        })
      }
    };
  };
  const getSelectorButtonProps = () => {
    return {
      ...buttonProps,
      ...selectorButtonProps,
      onPress: state.toggle,
      className: slots.selectorButton({ class: classNames2 == null ? void 0 : classNames2.selectorButton })
    };
  };
  const getSeparatorProps = () => {
    return {
      "data-slot": "separator",
      className: slots.separator({ class: classNames2 == null ? void 0 : classNames2.separator })
    };
  };
  const getSelectorIconProps = () => {
    return {
      ...selectorIconProps,
      className: slots.selectorIcon({ class: classNames2 == null ? void 0 : classNames2.selectorIcon })
    };
  };
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const dateInputSlots = reactExports.useMemo(
    () => dateInput({
      ...variantProps2,
      labelPlacement
    }),
    [objectToDeps(variantProps2)]
  );
  const getStartDateInputProps = (props = {}) => {
    return {
      ...startFieldProps,
      isInvalid,
      "data-slot": "start-input",
      slots: dateInputSlots,
      createCalendar,
      ...mergeProps$3(variantProps2, startFieldProps, {
        fullWidth: true,
        disableAnimation
      }),
      "data-open": dataAttr(state.isOpen),
      classNames: classNames2,
      style: {
        ...props.style,
        maxWidth: "fit-content"
      },
      className: dateInputSlots.input({
        class: clsx$4(classNames2 == null ? void 0 : classNames2.input, props == null ? void 0 : props.className)
      })
    };
  };
  const getEndDateInputProps = (props = {}) => {
    return {
      ...endFieldProps,
      isInvalid,
      "data-slot": "end-input",
      slots: dateInputSlots,
      createCalendar,
      ...mergeProps$3(variantProps2, endFieldProps, {
        fullWidth: true,
        disableAnimation
      }),
      "data-open": dataAttr(state.isOpen),
      classNames: classNames2,
      className: dateInputSlots.input({
        class: clsx$4(classNames2 == null ? void 0 : classNames2.input, props == null ? void 0 : props.className)
      })
    };
  };
  const getLabelProps = (props) => {
    return {
      ...props,
      ...labelProps,
      "data-slot": "label",
      className: dateInputSlots.label({
        class: clsx$4(classNames2 == null ? void 0 : classNames2.label, void 0)
      })
    };
  };
  const getInputWrapperProps = (props = {}) => {
    return {
      ref: domRef,
      ...props,
      ...groupProps,
      "data-slot": "input-wrapper",
      className: dateInputSlots.inputWrapper({
        class: classNames2 == null ? void 0 : classNames2.inputWrapper
      }),
      onClick: labelProps.onClick
    };
  };
  const getInnerWrapperProps = (props) => {
    return {
      ...props,
      ref: popoverTriggerRef,
      "data-slot": "inner-wrapper",
      className: dateInputSlots.innerWrapper({
        class: classNames2 == null ? void 0 : classNames2.innerWrapper
      })
    };
  };
  const getHelperWrapperProps = (props) => {
    return {
      ...props,
      "data-slot": "helper-wrapper",
      className: dateInputSlots.helperWrapper({
        class: clsx$4(classNames2 == null ? void 0 : classNames2.helperWrapper, void 0)
      })
    };
  };
  const getErrorMessageProps = (props = {}) => {
    return {
      ...props,
      ...errorMessageProps,
      "data-slot": "error-message",
      className: dateInputSlots.errorMessage({
        class: clsx$4(classNames2 == null ? void 0 : classNames2.errorMessage, props == null ? void 0 : props.className)
      })
    };
  };
  const getDescriptionProps = (props = {}) => {
    return {
      ...props,
      ...descriptionProps,
      "data-slot": "description",
      className: dateInputSlots.description({
        class: clsx$4(classNames2 == null ? void 0 : classNames2.description, props == null ? void 0 : props.className)
      })
    };
  };
  const getDateInputGroupProps = () => {
    return {
      as: as2,
      label,
      description,
      endContent,
      errorMessage,
      isInvalid,
      validationDetails,
      validationErrors,
      shouldLabelBeOutside,
      "data-slot": "base",
      "data-required": dataAttr(originalProps.isRequired),
      "data-disabled": dataAttr(originalProps.isDisabled),
      "data-readonly": dataAttr(originalProps.isReadOnly),
      "data-invalid": dataAttr(isInvalid),
      "data-has-start-content": dataAttr(!!startContent),
      "data-has-multiple-months": dataAttr(hasMultipleMonths),
      "data-has-end-content": dataAttr(!!endContent),
      descriptionProps: getDescriptionProps(),
      errorMessageProps: getErrorMessageProps(),
      groupProps: getInputWrapperProps(),
      helperWrapperProps: getHelperWrapperProps(),
      labelProps: getLabelProps(),
      wrapperProps: getInnerWrapperProps(),
      className: dateInputSlots.base({ class: baseStyles })
    };
  };
  return {
    state,
    label,
    slots,
    classNames: classNames2,
    startContent,
    endContent,
    selectorIcon,
    showTimeField,
    isCalendarHeaderExpanded,
    disableAnimation,
    CalendarTopContent,
    CalendarBottomContent,
    getStartDateInputProps,
    getEndDateInputProps,
    getStartTimeInputProps,
    getEndTimeInputProps,
    getPopoverProps,
    getSelectorButtonProps,
    getCalendarProps,
    getSeparatorProps,
    getSelectorIconProps,
    getDateInputGroupProps
  };
}
var DateRangePicker = forwardRef(function DateRangePicker2(props, ref) {
  const { selectorButtonPlacement = "end", ...otherProps } = props;
  const {
    state,
    slots,
    startContent,
    endContent,
    selectorIcon,
    showTimeField,
    classNames: classNames2,
    disableAnimation,
    isCalendarHeaderExpanded,
    getDateInputGroupProps,
    getStartDateInputProps,
    getEndDateInputProps,
    getPopoverProps,
    getSeparatorProps,
    getStartTimeInputProps,
    getEndTimeInputProps,
    getSelectorButtonProps,
    getSelectorIconProps,
    getCalendarProps,
    CalendarTopContent,
    CalendarBottomContent
  } = useDateRangePicker({ ...otherProps, ref });
  const selectorContent = reactExports.isValidElement(selectorIcon) ? reactExports.cloneElement(selectorIcon, getSelectorIconProps()) : /* @__PURE__ */ jsxRuntimeExports.jsx(CalendarBoldIcon, { ...getSelectorIconProps() });
  const calendarBottomContent = reactExports.useMemo(() => {
    if (isCalendarHeaderExpanded)
      return null;
    return showTimeField ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: slots == null ? void 0 : slots.bottomContent({ class: classNames2 == null ? void 0 : classNames2.bottomContent }), children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: slots == null ? void 0 : slots.timeInputWrapper({ class: classNames2 == null ? void 0 : classNames2.timeInputWrapper }), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(time_input_default, { ...getStartTimeInputProps() }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(time_input_default, { ...getEndTimeInputProps() })
      ] }),
      CalendarBottomContent
    ] }) : CalendarBottomContent;
  }, [state, showTimeField, CalendarBottomContent, isCalendarHeaderExpanded]);
  const calendarTopContent = reactExports.useMemo(() => {
    if (isCalendarHeaderExpanded)
      return null;
    return CalendarTopContent;
  }, [showTimeField, CalendarTopContent, isCalendarHeaderExpanded]);
  const popoverContent = state.isOpen ? /* @__PURE__ */ jsxRuntimeExports.jsx(free_solo_popover_default, { ...getPopoverProps(), offset: 20, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    range_calendar_default,
    {
      ...getCalendarProps(),
      bottomContent: calendarBottomContent,
      topContent: calendarTopContent
    }
  ) }) : null;
  const dateInputGroupProps = {
    ...getDateInputGroupProps(),
    endContent: selectorButtonPlacement === "end" ? /* @__PURE__ */ jsxRuntimeExports.jsx(button_default$1, { ...getSelectorButtonProps(), children: endContent || selectorContent }) : endContent,
    startContent: selectorButtonPlacement === "start" ? /* @__PURE__ */ jsxRuntimeExports.jsx(button_default$1, { ...getSelectorButtonProps(), children: startContent || selectorContent }) : startContent
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(DateInputGroup, { ...dateInputGroupProps, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(date_range_picker_field_default, { ...getStartDateInputProps() }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getSeparatorProps(), "aria-hidden": "true", role: "separator", children: "-" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(date_range_picker_field_default, { ...getEndDateInputProps() })
    ] }),
    disableAnimation ? popoverContent : /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { children: popoverContent })
  ] });
});
var date_range_picker_default = DateRangePicker;
function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value2, defaultValue2, onChange) {
  let [stateValue, setStateValue] = reactExports.useState(value2 || defaultValue2);
  let isControlledRef = reactExports.useRef(value2 !== void 0);
  let isControlled = value2 !== void 0;
  reactExports.useEffect(() => {
    isControlledRef.current;
    isControlledRef.current = isControlled;
  }, [
    isControlled
  ]);
  let currentValue = isControlled ? value2 : stateValue;
  let setValue = reactExports.useCallback((value22, ...args) => {
    let onChangeCaller = (value3, ...onChangeArgs) => {
      if (onChange) {
        if (!Object.is(currentValue, value3))
          onChange(value3, ...onChangeArgs);
      }
      if (!isControlled)
        currentValue = value3;
    };
    if (typeof value22 === "function") {
      let updateFunction = (oldValue, ...functionArgs) => {
        let interceptedValue = value22(isControlled ? currentValue : oldValue, ...functionArgs);
        onChangeCaller(interceptedValue, ...args);
        if (!isControlled)
          return interceptedValue;
        return oldValue;
      };
      setStateValue(updateFunction);
    } else {
      if (!isControlled)
        setStateValue(value22);
      onChangeCaller(value22, ...args);
    }
  }, [
    isControlled,
    currentValue,
    onChange
  ]);
  return [
    currentValue,
    setValue
  ];
}
function useAlert(originalProps) {
  const [props, variantProps2] = mapPropsVariants(originalProps, alert.variantKeys);
  const {
    as: as2,
    title,
    children,
    description,
    onClose,
    isClosable,
    ref,
    icon,
    startContent,
    endContent,
    isVisible: isVisibleProp,
    isDefaultVisible,
    onVisibleChange,
    closeButtonProps = {
      size: "sm"
    },
    className,
    classNames: classNames2,
    ...otherProps
  } = props;
  const [isVisible2, setIsVisible] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(
    isVisibleProp,
    isDefaultVisible != null ? isDefaultVisible : true,
    onVisibleChange
  );
  const Component2 = as2 || "div";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const handleClose = reactExports.useCallback(() => {
    setIsVisible(false);
    onClose == null ? void 0 : onClose();
  }, [setIsVisible, onClose]);
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  const slots = reactExports.useMemo(
    () => alert({ hasContent: !isEmpty(description) || !isEmpty(children), ...variantProps2 }),
    [description, objectToDeps(variantProps2)]
  );
  const getBaseProps = reactExports.useCallback(() => {
    return {
      "data-visible": dataAttr(isVisible2),
      "data-closeable": dataAttr(isClosable),
      "data-has-title": dataAttr(!isEmpty(title)),
      "data-has-description": dataAttr(!isEmpty(description)),
      ...mergeProps$3(
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        }),
        filterDOMProps(props)
      ),
      className: slots.base({ class: baseStyles })
    };
  }, [slots, baseStyles]);
  const getMainWrapperProps = reactExports.useCallback(() => {
    return {
      className: slots.mainWrapper({ class: classNames2 == null ? void 0 : classNames2.mainWrapper })
    };
  }, [slots, classNames2 == null ? void 0 : classNames2.mainWrapper]);
  const getDescriptionProps = reactExports.useCallback(() => {
    return {
      className: slots.description({ class: classNames2 == null ? void 0 : classNames2.description })
    };
  }, [slots, classNames2 == null ? void 0 : classNames2.description]);
  const getTitleProps = reactExports.useCallback(() => {
    return {
      className: slots.title({ class: classNames2 == null ? void 0 : classNames2.title })
    };
  }, [slots, classNames2 == null ? void 0 : classNames2.title]);
  const getCloseButtonProps = reactExports.useCallback(
    () => ({
      ...closeButtonProps,
      className: slots.closeButton({ class: classNames2 == null ? void 0 : classNames2.closeButton })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.closeButton]
  );
  const getAlertIconProps = reactExports.useCallback(
    () => ({
      className: slots.alertIcon({ class: classNames2 == null ? void 0 : classNames2.alertIcon })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.alertIcon]
  );
  const getIconWrapperProps = reactExports.useCallback(
    () => ({
      className: slots.iconWrapper({ class: classNames2 == null ? void 0 : classNames2.iconWrapper })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.iconWrapper]
  );
  return {
    title,
    icon,
    children,
    description,
    isClosable,
    domRef,
    endContent,
    startContent,
    getBaseProps,
    getMainWrapperProps,
    getDescriptionProps,
    getTitleProps,
    color: variantProps2["color"],
    getCloseButtonProps,
    handleClose,
    isVisible: isVisible2,
    onClose,
    getAlertIconProps,
    getIconWrapperProps
  };
}
var iconMap$1 = {
  primary: InfoCircleIcon,
  secondary: InfoCircleIcon,
  success: SuccessIcon,
  warning: WarningIcon,
  danger: DangerIcon
};
var Alert = forwardRef((props, ref) => {
  const {
    title,
    icon,
    children,
    description,
    endContent,
    startContent,
    isClosable,
    domRef,
    handleClose,
    getBaseProps,
    getMainWrapperProps,
    getDescriptionProps,
    getTitleProps,
    getCloseButtonProps,
    color: color2,
    isVisible: isVisible2,
    onClose,
    getAlertIconProps,
    getIconWrapperProps
  } = useAlert({ ...props, ref });
  if (!isVisible2)
    return null;
  const customIcon = icon && reactExports.isValidElement(icon) ? reactExports.cloneElement(icon, getAlertIconProps()) : null;
  const IconComponent = iconMap$1[color2] || iconMap$1.primary;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: domRef, role: "alert", ...getBaseProps(), children: [
    startContent,
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getIconWrapperProps(), children: customIcon || /* @__PURE__ */ jsxRuntimeExports.jsx(IconComponent, { ...getAlertIconProps() }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getMainWrapperProps(), children: [
      !isEmpty(title) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getTitleProps(), children: title }),
      !isEmpty(description) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getDescriptionProps(), children: description }),
      children
    ] }),
    endContent,
    (isClosable || onClose) && /* @__PURE__ */ jsxRuntimeExports.jsx(
      button_default$1,
      {
        isIconOnly: true,
        "aria-label": "Close",
        radius: "full",
        variant: "light",
        onPress: handleClose,
        ...getCloseButtonProps(),
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(CloseIcon, { height: 20, width: 20 })
      }
    )
  ] });
});
Alert.displayName = "HeroUI.Alert";
var alert_default = Alert;
var NumberInputStepper = ({ direction, ...otherProps }) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(button_default$1, { disableRipple: true, isIconOnly: true, ...otherProps, children: direction == "up" ? /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronUpIcon, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDownIcon$1, {}) });
};
NumberInputStepper.displayName = "HeroUI.NumberInputStepper";
var number_input_stepper_default = NumberInputStepper;
function $8a9cb279dc87e130$export$525bc4921d56d4a$1(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$1(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$715c682d09d639cc$1(onBlur) {
  let stateRef = reactExports.useRef({
    isFocused: false,
    observer: null
  });
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    const state = stateRef.current;
    return () => {
      if (state.observer) {
        state.observer.disconnect();
        state.observer = null;
      }
    };
  }, []);
  let dispatchBlur = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onBlur === null || onBlur === void 0 ? void 0 : onBlur(e2);
  });
  return reactExports.useCallback((e2) => {
    if (e2.target instanceof HTMLButtonElement || e2.target instanceof HTMLInputElement || e2.target instanceof HTMLTextAreaElement || e2.target instanceof HTMLSelectElement) {
      stateRef.current.isFocused = true;
      let target = e2.target;
      let onBlurHandler = (e3) => {
        stateRef.current.isFocused = false;
        if (target.disabled) {
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a$1(e3);
          dispatchBlur(event);
        }
        if (stateRef.current.observer) {
          stateRef.current.observer.disconnect();
          stateRef.current.observer = null;
        }
      };
      target.addEventListener("focusout", onBlurHandler, {
        once: true
      });
      stateRef.current.observer = new MutationObserver(() => {
        if (stateRef.current.isFocused && target.disabled) {
          var _stateRef_current_observer;
          (_stateRef_current_observer = stateRef.current.observer) === null || _stateRef_current_observer === void 0 ? void 0 : _stateRef_current_observer.disconnect();
          let relatedTargetEl = target === document.activeElement ? null : document.activeElement;
          target.dispatchEvent(new FocusEvent("blur", {
            relatedTarget: relatedTargetEl
          }));
          target.dispatchEvent(new FocusEvent("focusout", {
            bubbles: true,
            relatedTarget: relatedTargetEl
          }));
        }
      });
      stateRef.current.observer.observe(target, {
        attributes: true,
        attributeFilter: [
          "disabled"
        ]
      });
    }
  }, [
    dispatchBlur
  ]);
}
function $8a9cb279dc87e130$export$cabe61c495ee3649$1(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$3(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$4(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$1 = "default";
let $14c0b72509d70225$var$savedUserSelect$1 = "";
let $14c0b72509d70225$var$modifiedElementMap$1 = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$1(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$1 === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
      $14c0b72509d70225$var$savedUserSelect$1 = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$1 = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$1.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$1(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$1 !== "disabled")
      return;
    $14c0b72509d70225$var$state$1 = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
        if ($14c0b72509d70225$var$state$1 === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$1 || "";
          $14c0b72509d70225$var$savedUserSelect$1 = "";
          $14c0b72509d70225$var$state$1 = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$1.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$1.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$1.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$1 = React$5.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$1.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext$1(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$1);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$9(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$1 = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$1 = class $f6c31cce2adf654f$var$PressEvent11 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$1, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$1);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$1, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$1, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$1 = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$1 = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$1 = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$1(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$1(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$1("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$1("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$1("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$1("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$1(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$1(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$1(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$1(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$1(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$1($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$1(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$3(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$1(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$9(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$6())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$4(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$1(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$1(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$1(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$1($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$1(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$1(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$1]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$1] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$3(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$1(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$1(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$1(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$1(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$5(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$1))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$1;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$1}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$1((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$1]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$1(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$1(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$1(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$1(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$1(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$1(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$1(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$1(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$1(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$1(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$1 = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$1(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$1.has(target.type);
}
const $b5e257d569688ac6$var$defaultContext = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext = /* @__PURE__ */ React$5.createContext($b5e257d569688ac6$var$defaultContext);
const $b5e257d569688ac6$var$IsSSRContext = /* @__PURE__ */ React$5.createContext(false);
let $b5e257d569688ac6$var$componentIds = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext);
  let counter = $b5e257d569688ac6$var$useCounter(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId(defaultId) {
  let id2 = React$5.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$5["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId : $b5e257d569688ac6$var$useLegacySSRSafeId;
function $b5e257d569688ac6$var$getSnapshot() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot() {
  return true;
}
function $b5e257d569688ac6$var$subscribe(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273() {
  if (typeof React$5["useSyncExternalStore"] === "function")
    return React$5["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe, $b5e257d569688ac6$var$getSnapshot, $b5e257d569688ac6$var$getServerSnapshot);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext);
}
function $9ab94262bd0047c7$export$420e68273165f4ec$1(props) {
  let { isDisabled, onBlurWithin, onFocusWithin, onFocusWithinChange } = props;
  let state = reactExports.useRef({
    isFocusWithin: false
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let onBlur = reactExports.useCallback((e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    if (state.current.isFocusWithin && !e2.currentTarget.contains(e2.relatedTarget)) {
      state.current.isFocusWithin = false;
      removeAllGlobalListeners();
      if (onBlurWithin)
        onBlurWithin(e2);
      if (onFocusWithinChange)
        onFocusWithinChange(false);
    }
  }, [
    onBlurWithin,
    onFocusWithinChange,
    state,
    removeAllGlobalListeners
  ]);
  let onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc$1(onBlur);
  let onFocus = reactExports.useCallback((e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(e2.target);
    const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
    if (!state.current.isFocusWithin && activeElement === $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) {
      if (onFocusWithin)
        onFocusWithin(e2);
      if (onFocusWithinChange)
        onFocusWithinChange(true);
      state.current.isFocusWithin = true;
      onSyntheticFocus(e2);
      let currentTarget = e2.currentTarget;
      addGlobalListener(ownerDocument, "focus", (e3) => {
        if (state.current.isFocusWithin && !$d4ee10de306f2510$export$4282f70798064fe0$3(currentTarget, e3.target)) {
          let nativeEvent = new ownerDocument.defaultView.FocusEvent("blur", {
            relatedTarget: e3.target
          });
          $8a9cb279dc87e130$export$c2b7abe5d61ec696$1(nativeEvent, currentTarget);
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a$1(nativeEvent);
          onBlur(event);
        }
      }, {
        capture: true
      });
    }
  }, [
    onFocusWithin,
    onFocusWithinChange,
    onSyntheticFocus,
    addGlobalListener,
    onBlur
  ]);
  if (isDisabled)
    return {
      focusWithinProps: {
        // These cannot be null, that would conflict in mergeProps
        onFocus: void 0,
        onBlur: void 0
      }
    };
  return {
    focusWithinProps: {
      onFocus,
      onBlur
    }
  };
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$1 = false;
let $6179b936705e76d3$var$hoverCount$1 = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$1() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$1 = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$1 = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$1(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$1();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$1() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$1);
  $6179b936705e76d3$var$hoverCount$1++;
  return () => {
    $6179b936705e76d3$var$hoverCount$1--;
    if ($6179b936705e76d3$var$hoverCount$1 > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$1);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$1(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$1, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$1 && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
const $148a7a147e38ea7f$var$RTL_SCRIPTS = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS.has(lang2);
}
const $1e5a04cdaf7d1af8$var$localeSymbol = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();
let $1e5a04cdaf7d1af8$var$listeners = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale() {
  $1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners)
    listener($1e5a04cdaf7d1af8$var$currentLocale);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale);
    $1e5a04cdaf7d1af8$var$listeners.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext = /* @__PURE__ */ React$5.createContext(null);
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7() {
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a();
  let context = reactExports.useContext($18f2051aff69b9bf$var$I18nContext);
  return context || defaultLocale;
}
function $de67e98908f0c6ee$export$7f629e9dc1ecf37c(props) {
  let { minValue, maxValue, step, formatOptions, value: value2, defaultValue: defaultValue2 = NaN, onChange, locale: locale2, isDisabled, isReadOnly } = props;
  if (value2 === null)
    value2 = NaN;
  if (value2 !== void 0 && !isNaN(value2)) {
    if (step !== void 0 && !isNaN(step))
      value2 = $9446cca9a3875146$export$cb6e0bb50bc19463(value2, minValue, maxValue, step);
    else
      value2 = $9446cca9a3875146$export$7d15b64cf5a3a4c4(value2, minValue, maxValue);
  }
  if (!isNaN(defaultValue2)) {
    if (step !== void 0 && !isNaN(step))
      defaultValue2 = $9446cca9a3875146$export$cb6e0bb50bc19463(defaultValue2, minValue, maxValue, step);
    else
      defaultValue2 = $9446cca9a3875146$export$7d15b64cf5a3a4c4(defaultValue2, minValue, maxValue);
  }
  let [numberValue, setNumberValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(value2, isNaN(defaultValue2) ? NaN : defaultValue2, onChange);
  let [inputValue, setInputValue] = reactExports.useState(() => isNaN(numberValue) ? "" : new $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5(locale2, formatOptions).format(numberValue));
  let numberParser = reactExports.useMemo(() => new $6c7bd7858deea686$export$cd11ab140839f11d(locale2, formatOptions), [
    locale2,
    formatOptions
  ]);
  let numberingSystem = reactExports.useMemo(() => numberParser.getNumberingSystem(inputValue), [
    numberParser,
    inputValue
  ]);
  let formatter = reactExports.useMemo(() => new $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5(locale2, {
    ...formatOptions,
    numberingSystem
  }), [
    locale2,
    formatOptions,
    numberingSystem
  ]);
  let intlOptions = reactExports.useMemo(() => formatter.resolvedOptions(), [
    formatter
  ]);
  let format2 = reactExports.useCallback((value3) => isNaN(value3) || value3 === null ? "" : formatter.format(value3), [
    formatter
  ]);
  let validation = $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1({
    ...props,
    value: numberValue
  });
  let clampStep = step !== void 0 && !isNaN(step) ? step : 1;
  if (intlOptions.style === "percent" && (step === void 0 || isNaN(step)))
    clampStep = 0.01;
  let [prevValue, setPrevValue] = reactExports.useState(numberValue);
  let [prevLocale, setPrevLocale] = reactExports.useState(locale2);
  let [prevFormatOptions, setPrevFormatOptions] = reactExports.useState(formatOptions);
  if (!Object.is(numberValue, prevValue) || locale2 !== prevLocale || formatOptions !== prevFormatOptions) {
    setInputValue(format2(numberValue));
    setPrevValue(numberValue);
    setPrevLocale(locale2);
    setPrevFormatOptions(formatOptions);
  }
  let parsedValue = reactExports.useMemo(() => numberParser.parse(inputValue), [
    numberParser,
    inputValue
  ]);
  let commit = () => {
    if (!inputValue.length) {
      setNumberValue(NaN);
      setInputValue(value2 === void 0 ? "" : format2(numberValue));
      return;
    }
    if (isNaN(parsedValue)) {
      setInputValue(format2(numberValue));
      return;
    }
    let clampedValue;
    if (step === void 0 || isNaN(step))
      clampedValue = $9446cca9a3875146$export$7d15b64cf5a3a4c4(parsedValue, minValue, maxValue);
    else
      clampedValue = $9446cca9a3875146$export$cb6e0bb50bc19463(parsedValue, minValue, maxValue, step);
    clampedValue = numberParser.parse(format2(clampedValue));
    setNumberValue(clampedValue);
    setInputValue(format2(value2 === void 0 ? clampedValue : numberValue));
  };
  let safeNextStep = (operation, minMax = 0) => {
    let prev2 = parsedValue;
    if (isNaN(prev2)) {
      let newValue = isNaN(minMax) ? 0 : minMax;
      return $9446cca9a3875146$export$cb6e0bb50bc19463(newValue, minValue, maxValue, clampStep);
    } else {
      let newValue = $9446cca9a3875146$export$cb6e0bb50bc19463(prev2, minValue, maxValue, clampStep);
      if (operation === "+" && newValue > prev2 || operation === "-" && newValue < prev2)
        return newValue;
      return $9446cca9a3875146$export$cb6e0bb50bc19463($de67e98908f0c6ee$var$handleDecimalOperation(operation, prev2, clampStep), minValue, maxValue, clampStep);
    }
  };
  let increment2 = () => {
    let newValue = safeNextStep("+", minValue);
    if (newValue === numberValue)
      setInputValue(format2(newValue));
    setNumberValue(newValue);
    validation.commitValidation();
  };
  let decrement = () => {
    let newValue = safeNextStep("-", maxValue);
    if (newValue === numberValue)
      setInputValue(format2(newValue));
    setNumberValue(newValue);
    validation.commitValidation();
  };
  let incrementToMax = () => {
    if (maxValue != null) {
      setNumberValue($9446cca9a3875146$export$cb6e0bb50bc19463(maxValue, minValue, maxValue, clampStep));
      validation.commitValidation();
    }
  };
  let decrementToMin = () => {
    if (minValue != null) {
      setNumberValue(minValue);
      validation.commitValidation();
    }
  };
  let canIncrement = reactExports.useMemo(() => !isDisabled && !isReadOnly && (isNaN(parsedValue) || maxValue === void 0 || isNaN(maxValue) || $9446cca9a3875146$export$cb6e0bb50bc19463(parsedValue, minValue, maxValue, clampStep) > parsedValue || $de67e98908f0c6ee$var$handleDecimalOperation("+", parsedValue, clampStep) <= maxValue), [
    isDisabled,
    isReadOnly,
    minValue,
    maxValue,
    clampStep,
    parsedValue
  ]);
  let canDecrement = reactExports.useMemo(() => !isDisabled && !isReadOnly && (isNaN(parsedValue) || minValue === void 0 || isNaN(minValue) || $9446cca9a3875146$export$cb6e0bb50bc19463(parsedValue, minValue, maxValue, clampStep) < parsedValue || $de67e98908f0c6ee$var$handleDecimalOperation("-", parsedValue, clampStep) >= minValue), [
    isDisabled,
    isReadOnly,
    minValue,
    maxValue,
    clampStep,
    parsedValue
  ]);
  let validate2 = (value3) => numberParser.isValidPartialNumber(value3, minValue, maxValue);
  return {
    ...validation,
    validate: validate2,
    increment: increment2,
    incrementToMax,
    decrement,
    decrementToMin,
    canIncrement,
    canDecrement,
    minValue,
    maxValue,
    numberValue: parsedValue,
    setNumberValue,
    setInputValue,
    inputValue,
    commit
  };
}
function $de67e98908f0c6ee$var$handleDecimalOperation(operator, value1, value2) {
  let result = operator === "+" ? value1 + value2 : value1 - value2;
  if (value1 % 1 !== 0 || value2 % 1 !== 0) {
    const value1Decimal = value1.toString().split(".");
    const value2Decimal = value2.toString().split(".");
    const value1DecimalLength = value1Decimal[1] && value1Decimal[1].length || 0;
    const value2DecimalLength = value2Decimal[1] && value2Decimal[1].length || 0;
    const multiplier = Math.pow(10, Math.max(value1DecimalLength, value2DecimalLength));
    value1 = Math.round(value1 * multiplier);
    value2 = Math.round(value2 * multiplier);
    result = operator === "+" ? value1 + value2 : value1 - value2;
    result /= multiplier;
  }
  return result;
}
var $fb78e0f6ab6349ed$exports = {};
$fb78e0f6ab6349ed$exports = {
  "decrease": (args) => `خفض ${args.fieldLabel}`,
  "increase": (args) => `زيادة ${args.fieldLabel}`,
  "numberField": `حقل رقمي`
};
var $2776acdd9959a647$exports = {};
$2776acdd9959a647$exports = {
  "decrease": (args) => `Намаляване ${args.fieldLabel}`,
  "increase": (args) => `Усилване ${args.fieldLabel}`,
  "numberField": `Номер на полето`
};
var $741954410a365ad3$exports = {};
$741954410a365ad3$exports = {
  "decrease": (args) => `Snížit ${args.fieldLabel}`,
  "increase": (args) => `Zvýšit ${args.fieldLabel}`,
  "numberField": `Číselné pole`
};
var $8321ed0f8ab642f0$exports = {};
$8321ed0f8ab642f0$exports = {
  "decrease": (args) => `Reducer ${args.fieldLabel}`,
  "increase": (args) => `Øg ${args.fieldLabel}`,
  "numberField": `Talfelt`
};
var $92978e0c4ecafa32$exports = {};
$92978e0c4ecafa32$exports = {
  "decrease": (args) => `${args.fieldLabel} verringern`,
  "increase": (args) => `${args.fieldLabel} erhöhen`,
  "numberField": `Nummernfeld`
};
var $ac5ff71962864a84$exports = {};
$ac5ff71962864a84$exports = {
  "decrease": (args) => `Μείωση ${args.fieldLabel}`,
  "increase": (args) => `Αύξηση ${args.fieldLabel}`,
  "numberField": `Πεδίο αριθμού`
};
var $efe4685e2440d8be$exports = {};
$efe4685e2440d8be$exports = {
  "decrease": (args) => `Decrease ${args.fieldLabel}`,
  "increase": (args) => `Increase ${args.fieldLabel}`,
  "numberField": `Number field`
};
var $e50a9a48739b90e1$exports = {};
$e50a9a48739b90e1$exports = {
  "decrease": (args) => `Reducir ${args.fieldLabel}`,
  "increase": (args) => `Aumentar ${args.fieldLabel}`,
  "numberField": `Campo de número`
};
var $6e0d5294ecbb8ab6$exports = {};
$6e0d5294ecbb8ab6$exports = {
  "decrease": (args) => `Vähenda ${args.fieldLabel}`,
  "increase": (args) => `Suurenda ${args.fieldLabel}`,
  "numberField": `Numbri väli`
};
var $e7129d65f607f77f$exports = {};
$e7129d65f607f77f$exports = {
  "decrease": (args) => `Vähennä ${args.fieldLabel}`,
  "increase": (args) => `Lisää ${args.fieldLabel}`,
  "numberField": `Numerokenttä`
};
var $d72adf5b20573e34$exports = {};
$d72adf5b20573e34$exports = {
  "decrease": (args) => `Diminuer ${args.fieldLabel}`,
  "increase": (args) => `Augmenter ${args.fieldLabel}`,
  "numberField": `Champ de nombre`
};
var $a25c707e88b844a7$exports = {};
$a25c707e88b844a7$exports = {
  "decrease": (args) => `הקטן ${args.fieldLabel}`,
  "increase": (args) => `הגדל ${args.fieldLabel}`,
  "numberField": `שדה מספר`
};
var $69b41140b9a4ca54$exports = {};
$69b41140b9a4ca54$exports = {
  "decrease": (args) => `Smanji ${args.fieldLabel}`,
  "increase": (args) => `Povećaj ${args.fieldLabel}`,
  "numberField": `Polje broja`
};
var $81dab28f37f59d1a$exports = {};
$81dab28f37f59d1a$exports = {
  "decrease": (args) => `${args.fieldLabel} csökkentése`,
  "increase": (args) => `${args.fieldLabel} növelése`,
  "numberField": `Számmező`
};
var $866555b31f2d7711$exports = {};
$866555b31f2d7711$exports = {
  "decrease": (args) => `Riduci ${args.fieldLabel}`,
  "increase": (args) => `Aumenta ${args.fieldLabel}`,
  "numberField": `Campo numero`
};
var $dafcd55d52b9d371$exports = {};
$dafcd55d52b9d371$exports = {
  "decrease": (args) => `${args.fieldLabel}を縮小`,
  "increase": (args) => `${args.fieldLabel}を拡大`,
  "numberField": `数値フィールド`
};
var $f090c1f8c5da0145$exports = {};
$f090c1f8c5da0145$exports = {
  "decrease": (args) => `${args.fieldLabel} 감소`,
  "increase": (args) => `${args.fieldLabel} 증가`,
  "numberField": `번호 필드`
};
var $6f10f3a13360a75c$exports = {};
$6f10f3a13360a75c$exports = {
  "decrease": (args) => `Sumažinti ${args.fieldLabel}`,
  "increase": (args) => `Padidinti ${args.fieldLabel}`,
  "numberField": `Numerio laukas`
};
var $47432cefd4b7bd1b$exports = {};
$47432cefd4b7bd1b$exports = {
  "decrease": (args) => `Samazināšana ${args.fieldLabel}`,
  "increase": (args) => `Palielināšana ${args.fieldLabel}`,
  "numberField": `Skaitļu lauks`
};
var $dc578a950a2bf23d$exports = {};
$dc578a950a2bf23d$exports = {
  "decrease": (args) => `Reduser ${args.fieldLabel}`,
  "increase": (args) => `Øk ${args.fieldLabel}`,
  "numberField": `Tallfelt`
};
var $353f1bfca4dc395a$exports = {};
$353f1bfca4dc395a$exports = {
  "decrease": (args) => `${args.fieldLabel} verlagen`,
  "increase": (args) => `${args.fieldLabel} verhogen`,
  "numberField": `Getalveld`
};
var $241bc0bbd870e982$exports = {};
$241bc0bbd870e982$exports = {
  "decrease": (args) => `Zmniejsz ${args.fieldLabel}`,
  "increase": (args) => `Zwiększ ${args.fieldLabel}`,
  "numberField": `Pole numeru`
};
var $da3005c7bd72b0a8$exports = {};
$da3005c7bd72b0a8$exports = {
  "decrease": (args) => `Diminuir ${args.fieldLabel}`,
  "increase": (args) => `Aumentar ${args.fieldLabel}`,
  "numberField": `Campo de número`
};
var $cf48bfc540882310$exports = {};
$cf48bfc540882310$exports = {
  "decrease": (args) => `Diminuir ${args.fieldLabel}`,
  "increase": (args) => `Aumentar ${args.fieldLabel}`,
  "numberField": `Campo numérico`
};
var $b63a28c481ab9ee3$exports = {};
$b63a28c481ab9ee3$exports = {
  "decrease": (args) => `Scădere ${args.fieldLabel}`,
  "increase": (args) => `Creștere ${args.fieldLabel}`,
  "numberField": `Câmp numeric`
};
var $19f9df95c2464ab6$exports = {};
$19f9df95c2464ab6$exports = {
  "decrease": (args) => `Уменьшение ${args.fieldLabel}`,
  "increase": (args) => `Увеличение ${args.fieldLabel}`,
  "numberField": `Числовое поле`
};
var $b272932a685e8482$exports = {};
$b272932a685e8482$exports = {
  "decrease": (args) => `Znížiť ${args.fieldLabel}`,
  "increase": (args) => `Zvýšiť ${args.fieldLabel}`,
  "numberField": `Číselné pole`
};
var $cbaf8b5b61f9e544$exports = {};
$cbaf8b5b61f9e544$exports = {
  "decrease": (args) => `Upadati ${args.fieldLabel}`,
  "increase": (args) => `Povečajte ${args.fieldLabel}`,
  "numberField": `Številčno polje`
};
var $e0a3af6ac1449b2f$exports = {};
$e0a3af6ac1449b2f$exports = {
  "decrease": (args) => `Smanji ${args.fieldLabel}`,
  "increase": (args) => `Povećaj ${args.fieldLabel}`,
  "numberField": `Polje broja`
};
var $71e167d2458a6019$exports = {};
$71e167d2458a6019$exports = {
  "decrease": (args) => `Minska ${args.fieldLabel}`,
  "increase": (args) => `Öka ${args.fieldLabel}`,
  "numberField": `Nummerfält`
};
var $3719245abc082946$exports = {};
$3719245abc082946$exports = {
  "decrease": (args) => `${args.fieldLabel} azalt`,
  "increase": (args) => `${args.fieldLabel} arttır`,
  "numberField": `Sayı alanı`
};
var $2ccc589e2f51824d$exports = {};
$2ccc589e2f51824d$exports = {
  "decrease": (args) => `Зменшити ${args.fieldLabel}`,
  "increase": (args) => `Збільшити ${args.fieldLabel}`,
  "numberField": `Поле номера`
};
var $e1103cb9b4c13942$exports = {};
$e1103cb9b4c13942$exports = {
  "decrease": (args) => `降低 ${args.fieldLabel}`,
  "increase": (args) => `提高 ${args.fieldLabel}`,
  "numberField": `数字字段`
};
var $448607634f80dccb$exports = {};
$448607634f80dccb$exports = {
  "decrease": (args) => `縮小 ${args.fieldLabel}`,
  "increase": (args) => `放大 ${args.fieldLabel}`,
  "numberField": `數字欄位`
};
var $280a227d7cb94b92$exports = {};
$280a227d7cb94b92$exports = {
  "ar-AE": $fb78e0f6ab6349ed$exports,
  "bg-BG": $2776acdd9959a647$exports,
  "cs-CZ": $741954410a365ad3$exports,
  "da-DK": $8321ed0f8ab642f0$exports,
  "de-DE": $92978e0c4ecafa32$exports,
  "el-GR": $ac5ff71962864a84$exports,
  "en-US": $efe4685e2440d8be$exports,
  "es-ES": $e50a9a48739b90e1$exports,
  "et-EE": $6e0d5294ecbb8ab6$exports,
  "fi-FI": $e7129d65f607f77f$exports,
  "fr-FR": $d72adf5b20573e34$exports,
  "he-IL": $a25c707e88b844a7$exports,
  "hr-HR": $69b41140b9a4ca54$exports,
  "hu-HU": $81dab28f37f59d1a$exports,
  "it-IT": $866555b31f2d7711$exports,
  "ja-JP": $dafcd55d52b9d371$exports,
  "ko-KR": $f090c1f8c5da0145$exports,
  "lt-LT": $6f10f3a13360a75c$exports,
  "lv-LV": $47432cefd4b7bd1b$exports,
  "nb-NO": $dc578a950a2bf23d$exports,
  "nl-NL": $353f1bfca4dc395a$exports,
  "pl-PL": $241bc0bbd870e982$exports,
  "pt-BR": $da3005c7bd72b0a8$exports,
  "pt-PT": $cf48bfc540882310$exports,
  "ro-RO": $b63a28c481ab9ee3$exports,
  "ru-RU": $19f9df95c2464ab6$exports,
  "sk-SK": $b272932a685e8482$exports,
  "sl-SI": $cbaf8b5b61f9e544$exports,
  "sr-SP": $e0a3af6ac1449b2f$exports,
  "sv-SE": $71e167d2458a6019$exports,
  "tr-TR": $3719245abc082946$exports,
  "uk-UA": $2ccc589e2f51824d$exports,
  "zh-CN": $e1103cb9b4c13942$exports,
  "zh-TW": $448607634f80dccb$exports
};
function $parcel$interopDefault$2(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $81397a9303501bda$export$23f548e970bdf099(props, state, inputRef) {
  let { id: id2, decrementAriaLabel, incrementAriaLabel, isDisabled, isReadOnly, isRequired, minValue, maxValue, autoFocus, label, formatOptions, onBlur = () => {
  }, onFocus, onFocusChange, onKeyDown, onKeyUp, description, errorMessage, isWheelDisabled, ...otherProps } = props;
  let { increment: increment2, incrementToMax, decrement, decrementToMin, numberValue, inputValue, commit, commitValidation } = state;
  const stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$2($280a227d7cb94b92$exports), "@react-aria/numberfield");
  let inputId = $bdb11010cef70236$export$f680877a34711e37$2(id2);
  let { focusProps } = $a1ea59d68270f0dd$export$f8168d8dd8fd66e6$2({
    onBlur() {
      commit();
    }
  });
  let numberFormatter = $a916eb452884faea$export$b7a616150fdb9f44$1(formatOptions);
  let intlOptions = reactExports.useMemo(() => numberFormatter.resolvedOptions(), [
    numberFormatter
  ]);
  let textValueFormatter = $a916eb452884faea$export$b7a616150fdb9f44$1({
    ...formatOptions,
    currencySign: void 0
  });
  let textValue = reactExports.useMemo(() => isNaN(numberValue) ? "" : textValueFormatter.format(numberValue), [
    textValueFormatter,
    numberValue
  ]);
  let { spinButtonProps, incrementButtonProps: incButtonProps, decrementButtonProps: decButtonProps } = $d2e8511e6f209edf$export$e908e06f4b8e3402({
    isDisabled,
    isReadOnly,
    isRequired,
    maxValue,
    minValue,
    onIncrement: increment2,
    onIncrementToMax: incrementToMax,
    onDecrement: decrement,
    onDecrementToMin: decrementToMin,
    value: numberValue,
    textValue
  });
  let [focusWithin, setFocusWithin] = reactExports.useState(false);
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$4({
    isDisabled,
    onFocusWithinChange: setFocusWithin
  });
  let onWheel = reactExports.useCallback((e2) => {
    if (Math.abs(e2.deltaY) <= Math.abs(e2.deltaX))
      return;
    if (e2.deltaY > 0)
      increment2();
    else if (e2.deltaY < 0)
      decrement();
  }, [
    decrement,
    increment2
  ]);
  let scrollingDisabled = isWheelDisabled || isDisabled || isReadOnly || !focusWithin;
  $7d0a636d7a4dcefd$export$2123ff2b87c81ca({
    onScroll: onWheel,
    isDisabled: scrollingDisabled
  }, inputRef);
  var _intlOptions_maximumFractionDigits;
  let hasDecimals = ((_intlOptions_maximumFractionDigits = intlOptions.maximumFractionDigits) !== null && _intlOptions_maximumFractionDigits !== void 0 ? _intlOptions_maximumFractionDigits : 0) > 0;
  let hasNegative = state.minValue === void 0 || isNaN(state.minValue) || state.minValue < 0;
  let inputMode = "numeric";
  if ($c87311424ea30a05$export$186c6964ca17d99$3()) {
    if (hasNegative)
      inputMode = "text";
    else if (hasDecimals)
      inputMode = "decimal";
  } else if ($c87311424ea30a05$export$a11b0059900ceec8$4()) {
    if (hasNegative)
      inputMode = "numeric";
    else if (hasDecimals)
      inputMode = "decimal";
  }
  let onChange = (value2) => {
    if (state.validate(value2))
      state.setInputValue(value2);
  };
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props);
  let onKeyDownEnter = reactExports.useCallback((e2) => {
    if (e2.key === "Enter") {
      commit();
      commitValidation();
    } else
      e2.continuePropagation();
  }, [
    commit,
    commitValidation
  ]);
  let { isInvalid, validationErrors, validationDetails } = state.displayValidation;
  let { labelProps, inputProps: textFieldProps, descriptionProps, errorMessageProps } = $d841c8010a73d545$export$4f384c9210e583c3({
    ...otherProps,
    ...domProps,
    name: void 0,
    label,
    autoFocus,
    isDisabled,
    isReadOnly,
    isRequired,
    validate: void 0,
    [$e5be200c675c3b3a$export$a763b9476acd3eb$1]: state,
    value: inputValue,
    defaultValue: void 0,
    autoComplete: "off",
    "aria-label": props["aria-label"] || void 0,
    "aria-labelledby": props["aria-labelledby"] || void 0,
    id: inputId,
    type: "text",
    inputMode,
    onChange,
    onBlur,
    onFocus,
    onFocusChange,
    onKeyDown: reactExports.useMemo(() => $ff5963eb1fccf552$export$e08e3b67e392101e$9(onKeyDownEnter, onKeyDown), [
      onKeyDownEnter,
      onKeyDown
    ]),
    onKeyUp,
    description,
    errorMessage
  }, state, inputRef);
  $99facab73266f662$export$5add1d006293d136(inputRef, state.numberValue, state.setNumberValue);
  let inputProps = $3ef42575df84b30b$export$9d1611c77c2fe928$9(spinButtonProps, focusProps, textFieldProps, {
    // override the spinbutton role, we can't focus a spin button with VO
    role: null,
    // ignore aria-roledescription on iOS so that required state will announce when it is present
    "aria-roledescription": !$c87311424ea30a05$export$fedb369cb70207f1$3() ? stringFormatter.format("numberField") : null,
    "aria-valuemax": null,
    "aria-valuemin": null,
    "aria-valuenow": null,
    "aria-valuetext": null,
    autoCorrect: "off",
    spellCheck: "false"
  });
  if (props.validationBehavior === "native")
    inputProps["aria-required"] = void 0;
  let onButtonPressStart = (e2) => {
    var _inputRef_current;
    if (document.activeElement === inputRef.current)
      return;
    if (e2.pointerType === "mouse")
      (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
    else
      e2.target.focus();
  };
  let fieldLabel = props["aria-label"] || (typeof props.label === "string" ? props.label : "");
  let ariaLabelledby;
  if (!fieldLabel)
    ariaLabelledby = props.label != null ? labelProps.id : props["aria-labelledby"];
  let incrementId = $bdb11010cef70236$export$f680877a34711e37$2();
  let decrementId = $bdb11010cef70236$export$f680877a34711e37$2();
  let incrementButtonProps = $3ef42575df84b30b$export$9d1611c77c2fe928$9(incButtonProps, {
    "aria-label": incrementAriaLabel || stringFormatter.format("increase", {
      fieldLabel
    }).trim(),
    id: ariaLabelledby && !incrementAriaLabel ? incrementId : null,
    "aria-labelledby": ariaLabelledby && !incrementAriaLabel ? `${incrementId} ${ariaLabelledby}` : null,
    "aria-controls": inputId,
    excludeFromTabOrder: true,
    preventFocusOnPress: true,
    allowFocusWhenDisabled: true,
    isDisabled: !state.canIncrement,
    onPressStart: onButtonPressStart
  });
  let decrementButtonProps = $3ef42575df84b30b$export$9d1611c77c2fe928$9(decButtonProps, {
    "aria-label": decrementAriaLabel || stringFormatter.format("decrease", {
      fieldLabel
    }).trim(),
    id: ariaLabelledby && !decrementAriaLabel ? decrementId : null,
    "aria-labelledby": ariaLabelledby && !decrementAriaLabel ? `${decrementId} ${ariaLabelledby}` : null,
    "aria-controls": inputId,
    excludeFromTabOrder: true,
    preventFocusOnPress: true,
    allowFocusWhenDisabled: true,
    isDisabled: !state.canDecrement,
    onPressStart: onButtonPressStart
  });
  return {
    groupProps: {
      ...focusWithinProps,
      role: "group",
      "aria-disabled": isDisabled,
      "aria-invalid": isInvalid ? "true" : void 0
    },
    labelProps,
    inputProps,
    incrementButtonProps,
    decrementButtonProps,
    errorMessageProps,
    descriptionProps,
    isInvalid,
    validationErrors,
    validationDetails
  };
}
function useNumberInput(originalProps) {
  var _a2, _b2, _c2;
  const globalContext = useProviderContext();
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext$1) || {};
  const [props, variantProps2] = mapPropsVariants(originalProps, numberInput.variantKeys);
  const {
    ref,
    as: as2,
    type: type4,
    label,
    baseRef,
    wrapperRef,
    description,
    className,
    classNames: classNames2,
    autoFocus,
    startContent,
    endContent,
    onClear,
    onChange,
    validationBehavior = (_a2 = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _a2 : "native",
    innerWrapperRef: innerWrapperRefProp,
    onValueChange,
    hideStepper,
    ...otherProps
  } = props;
  const [isFocusWithin, setFocusWithin] = reactExports.useState(false);
  const Component2 = as2 || "div";
  const disableAnimation = (_c2 = (_b2 = originalProps.disableAnimation) != null ? _b2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _c2 : false;
  const domRef = useDOMRef(ref);
  const baseDomRef = useDOMRef(baseRef);
  const inputWrapperRef = useDOMRef(wrapperRef);
  const innerWrapperRef = useDOMRef(innerWrapperRefProp);
  const { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
  const state = $de67e98908f0c6ee$export$7f629e9dc1ecf37c({
    ...originalProps,
    validationBehavior,
    locale: locale2,
    onChange: chain(onValueChange, onChange)
  });
  const {
    groupProps,
    labelProps,
    inputProps,
    incrementButtonProps,
    decrementButtonProps,
    descriptionProps,
    errorMessageProps,
    isInvalid,
    validationErrors,
    validationDetails
  } = $81397a9303501bda$export$23f548e970bdf099({ ...originalProps, validationBehavior }, state, domRef);
  const inputValue = isNaN(state.numberValue) ? "" : state.numberValue;
  const isFilled = !isEmpty(inputValue);
  const isFilledWithin = isFilled || isFocusWithin;
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className, isFilled ? "is-filled" : "");
  const handleClear = reactExports.useCallback(() => {
    var _a22;
    state.setInputValue("");
    onClear == null ? void 0 : onClear();
    (_a22 = domRef.current) == null ? void 0 : _a22.focus();
  }, [state.setInputValue, onClear]);
  useSafeLayoutEffect(() => {
    if (!domRef.current)
      return;
    state.setInputValue(domRef.current.value);
  }, [domRef.current]);
  const { isFocusVisible, isFocused, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus,
    isTextInput: true
  });
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$1({ isDisabled: !!(originalProps == null ? void 0 : originalProps.isDisabled) });
  const { isHovered: isLabelHovered, hoverProps: labelHoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$1({
    isDisabled: !!(originalProps == null ? void 0 : originalProps.isDisabled)
  });
  const { focusProps: clearFocusProps, isFocusVisible: isClearButtonFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$1({
    onFocusWithinChange: setFocusWithin
  });
  const { pressProps: clearPressProps } = $f6c31cce2adf654f$export$45712eceda6fad21$1({
    isDisabled: !!(originalProps == null ? void 0 : originalProps.isDisabled) || !!(originalProps == null ? void 0 : originalProps.isReadOnly),
    onPress: handleClear
  });
  const labelPlacement = useLabelPlacement({
    labelPlacement: originalProps.labelPlacement,
    label
  });
  const errorMessage = typeof props.errorMessage === "function" ? props.errorMessage({ isInvalid, validationErrors, validationDetails }) : props.errorMessage || (validationErrors == null ? void 0 : validationErrors.join(" "));
  const isClearable = !!onClear || originalProps.isClearable;
  const hasElements = !!label || !!description || !!errorMessage;
  const hasPlaceholder = !!props.placeholder;
  const hasLabel = !!label;
  const hasHelper = !!description || !!errorMessage;
  const shouldLabelBeOutside = labelPlacement === "outside" || labelPlacement === "outside-left";
  const shouldLabelBeInside = labelPlacement === "inside";
  const isPlaceholderShown = domRef.current ? (!domRef.current.value || domRef.current.value === "" || !inputValue) && hasPlaceholder : false;
  const isOutsideLeft = labelPlacement === "outside-left";
  const hasStartContent = !!startContent;
  const isLabelOutside = shouldLabelBeOutside ? labelPlacement === "outside-left" || hasPlaceholder || labelPlacement === "outside" && hasStartContent : false;
  const isLabelOutsideAsPlaceholder = labelPlacement === "outside" && !hasPlaceholder && !hasStartContent;
  const slots = reactExports.useMemo(
    () => numberInput({
      ...variantProps2,
      isInvalid,
      isClearable,
      disableAnimation
    }),
    [objectToDeps(variantProps2), isInvalid, isClearable, hasStartContent, disableAnimation]
  );
  const handleKeyDown = reactExports.useCallback(
    (e2) => {
      if (e2.key === "Escape" && inputValue && (isClearable || onClear) && !originalProps.isReadOnly) {
        state.setInputValue("");
        onClear == null ? void 0 : onClear();
      }
    },
    [inputValue, state.setInputValue, onClear, isClearable, originalProps.isReadOnly]
  );
  const getBaseProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ref: baseDomRef,
        className: slots.base({ class: baseStyles }),
        "data-slot": "base",
        "data-filled": dataAttr(
          isFilled || hasPlaceholder || hasStartContent || isPlaceholderShown
        ),
        "data-filled-within": dataAttr(
          isFilledWithin || hasPlaceholder || hasStartContent || isPlaceholderShown
        ),
        "data-focus-within": dataAttr(isFocusWithin),
        "data-focus-visible": dataAttr(isFocusVisible),
        "data-readonly": dataAttr(originalProps.isReadOnly),
        "data-focus": dataAttr(isFocused),
        "data-hover": dataAttr(isHovered || isLabelHovered),
        "data-required": dataAttr(originalProps.isRequired),
        "data-invalid": dataAttr(isInvalid),
        "data-disabled": dataAttr(originalProps.isDisabled),
        "data-has-elements": dataAttr(hasElements),
        "data-has-helper": dataAttr(hasHelper),
        "data-has-label": dataAttr(hasLabel),
        "data-has-value": dataAttr(!isPlaceholderShown),
        ...focusWithinProps,
        ...props2
      };
    },
    [
      slots,
      baseStyles,
      isFilled,
      isFocused,
      isHovered,
      isLabelHovered,
      isInvalid,
      hasHelper,
      hasLabel,
      hasElements,
      isPlaceholderShown,
      hasStartContent,
      isFocusWithin,
      isFocusVisible,
      hasPlaceholder,
      focusWithinProps,
      originalProps.isReadOnly,
      originalProps.isRequired,
      originalProps.isDisabled
    ]
  );
  const getLabelProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "data-slot": "label",
        className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }),
        ...mergeProps$3(labelProps, labelHoverProps, props2)
      };
    },
    [slots, isLabelHovered, labelProps, classNames2 == null ? void 0 : classNames2.label]
  );
  const getNumberInputProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "data-slot": "input",
        "data-filled": dataAttr(isFilled),
        "data-has-start-content": dataAttr(hasStartContent),
        "data-has-end-content": dataAttr(!!endContent),
        className: slots.input({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.input, isFilled ? "is-filled" : "")
        }),
        ...mergeProps$3(
          focusProps,
          inputProps,
          filterDOMProps(otherProps, {
            enabled: true,
            labelable: true,
            omitEventNames: new Set(Object.keys(inputProps)),
            omitPropNames: /* @__PURE__ */ new Set(["value"])
          }),
          props2
        ),
        "aria-readonly": dataAttr(originalProps.isReadOnly),
        onChange: chain(inputProps.onChange, onChange),
        onKeyDown: chain(inputProps.onKeyDown, props2.onKeyDown, handleKeyDown),
        ref: domRef
      };
    },
    [
      slots,
      focusProps,
      inputProps,
      otherProps,
      isFilled,
      hasStartContent,
      endContent,
      classNames2 == null ? void 0 : classNames2.input,
      originalProps.isReadOnly,
      originalProps.isRequired,
      onChange,
      handleKeyDown
    ]
  );
  const getHiddenNumberInputProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        name: originalProps.name,
        value: inputValue,
        "data-slot": "hidden-input",
        type: "hidden",
        ...props2
      };
    },
    [inputValue, originalProps.name]
  );
  const getInputWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ref: inputWrapperRef,
        "data-slot": "input-wrapper",
        "data-hover": dataAttr(isHovered || isLabelHovered),
        "data-focus-visible": dataAttr(isFocusVisible),
        "data-focus": dataAttr(isFocused),
        className: slots.inputWrapper({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.inputWrapper, isFilled ? "is-filled" : "")
        }),
        ...mergeProps$3(props2, hoverProps),
        onClick: (e2) => {
          if (domRef.current && e2.currentTarget === e2.target) {
            domRef.current.focus();
          }
        },
        style: {
          cursor: "text",
          ...props2.style
        }
      };
    },
    [
      slots,
      isHovered,
      isLabelHovered,
      isFocusVisible,
      isFocused,
      inputValue,
      classNames2 == null ? void 0 : classNames2.inputWrapper
    ]
  );
  const getInnerWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ref: innerWrapperRef,
        "data-slot": "inner-wrapper",
        onClick: (e2) => {
          if (domRef.current && e2.currentTarget === e2.target) {
            domRef.current.focus();
          }
        },
        className: slots.innerWrapper({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.innerWrapper, props2 == null ? void 0 : props2.className)
        }),
        ...mergeProps$3(groupProps, props2)
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.innerWrapper]
  );
  const getMainWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "data-slot": "main-wrapper",
        className: slots.mainWrapper({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.mainWrapper, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.mainWrapper]
  );
  const getHelperWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "data-slot": "helper-wrapper",
        className: slots.helperWrapper({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.helperWrapper, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.helperWrapper]
  );
  const getDescriptionProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ...descriptionProps,
        "data-slot": "description",
        className: slots.description({ class: clsx$4(classNames2 == null ? void 0 : classNames2.label, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.description]
  );
  const getErrorMessageProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ...errorMessageProps,
        "data-slot": "error-message",
        className: slots.errorMessage({ class: clsx$4(classNames2 == null ? void 0 : classNames2.errorMessage, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, errorMessageProps, classNames2 == null ? void 0 : classNames2.errorMessage]
  );
  const getClearButtonProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        type: "button",
        tabIndex: -1,
        disabled: originalProps.isDisabled,
        "aria-label": "clear input",
        "data-slot": "clear-button",
        "data-focus-visible": dataAttr(isClearButtonFocusVisible),
        className: slots.clearButton({ class: clsx$4(classNames2 == null ? void 0 : classNames2.clearButton, props2 == null ? void 0 : props2.className) }),
        ...mergeProps$3(clearPressProps, clearFocusProps)
      };
    },
    [slots, isClearButtonFocusVisible, clearPressProps, clearFocusProps, classNames2 == null ? void 0 : classNames2.clearButton]
  );
  const getStepperWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "data-slot": "stepper-wrapper",
        className: slots.stepperWrapper({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.stepperWrapper, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots]
  );
  const getStepperIncreaseButtonProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        type: "button",
        disabled: originalProps.isDisabled,
        "data-slot": "increase-button",
        className: slots.stepperButton({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.stepperButton, props2 == null ? void 0 : props2.className)
        }),
        ...mergeProps$3(incrementButtonProps, props2)
      };
    },
    [slots, incrementButtonProps, classNames2 == null ? void 0 : classNames2.stepperButton]
  );
  const getStepperDecreaseButtonProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        type: "button",
        disabled: originalProps.isDisabled,
        "data-slot": "decrease-button",
        className: slots.stepperButton({
          class: clsx$4(classNames2 == null ? void 0 : classNames2.stepperButton, props2 == null ? void 0 : props2.className)
        }),
        ...mergeProps$3(decrementButtonProps, props2)
      };
    },
    [slots, decrementButtonProps, classNames2 == null ? void 0 : classNames2.stepperButton]
  );
  return {
    Component: Component2,
    classNames: classNames2,
    type: type4,
    domRef,
    label,
    description,
    startContent,
    endContent,
    labelPlacement,
    isClearable,
    hasHelper,
    hasStartContent,
    isLabelOutside,
    isOutsideLeft,
    isLabelOutsideAsPlaceholder,
    shouldLabelBeOutside,
    shouldLabelBeInside,
    hasPlaceholder,
    isInvalid,
    errorMessage,
    hideStepper,
    incrementButtonProps,
    decrementButtonProps,
    getBaseProps,
    getLabelProps,
    getNumberInputProps,
    getHiddenNumberInputProps,
    getMainWrapperProps,
    getInputWrapperProps,
    getInnerWrapperProps,
    getHelperWrapperProps,
    getDescriptionProps,
    getErrorMessageProps,
    getClearButtonProps,
    getStepperIncreaseButtonProps,
    getStepperDecreaseButtonProps,
    getStepperWrapperProps
  };
}
var NumberInput = forwardRef((props, ref) => {
  const {
    Component: Component2,
    label,
    description,
    isClearable,
    startContent,
    endContent,
    labelPlacement,
    hasHelper,
    isOutsideLeft,
    shouldLabelBeOutside,
    errorMessage,
    isInvalid,
    hideStepper,
    getBaseProps,
    getLabelProps,
    getNumberInputProps,
    getHiddenNumberInputProps,
    getInnerWrapperProps,
    getInputWrapperProps,
    getMainWrapperProps,
    getHelperWrapperProps,
    getDescriptionProps,
    getErrorMessageProps,
    getClearButtonProps,
    getStepperIncreaseButtonProps,
    getStepperDecreaseButtonProps,
    getStepperWrapperProps
  } = useNumberInput({ ...props, ref });
  const labelContent = label ? /* @__PURE__ */ jsxRuntimeExports.jsx("label", { ...getLabelProps(), children: label }) : null;
  const end2 = reactExports.useMemo(() => {
    if (isClearable) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("button", { ...getClearButtonProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(CloseFilledIcon, {}) }),
        endContent
      ] });
    }
    return endContent;
  }, [isClearable, getClearButtonProps]);
  const helperWrapper = reactExports.useMemo(() => {
    const shouldShowError = isInvalid && errorMessage;
    const hasContent = shouldShowError || description;
    if (!hasHelper || !hasContent)
      return null;
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getHelperWrapperProps(), children: shouldShowError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getErrorMessageProps(), children: errorMessage }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getDescriptionProps(), children: description }) });
  }, [
    hasHelper,
    isInvalid,
    errorMessage,
    description,
    getHelperWrapperProps,
    getErrorMessageProps,
    getDescriptionProps
  ]);
  const innerWrapper = reactExports.useMemo(() => {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getInnerWrapperProps(), children: [
      startContent,
      /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...getNumberInputProps() }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...getHiddenNumberInputProps() }),
      end2,
      !hideStepper && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getStepperWrapperProps(), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(number_input_stepper_default, { ...getStepperIncreaseButtonProps(), direction: "up" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(number_input_stepper_default, { ...getStepperDecreaseButtonProps(), direction: "down" })
      ] })
    ] });
  }, [startContent, end2, getNumberInputProps, getInnerWrapperProps]);
  const mainWrapper = reactExports.useMemo(() => {
    if (shouldLabelBeOutside) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getMainWrapperProps(), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getInputWrapperProps(), children: [
          !isOutsideLeft ? labelContent : null,
          innerWrapper
        ] }),
        helperWrapper
      ] });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getInputWrapperProps(), children: [
        labelContent,
        innerWrapper
      ] }),
      helperWrapper
    ] });
  }, [
    labelPlacement,
    helperWrapper,
    shouldLabelBeOutside,
    labelContent,
    innerWrapper,
    errorMessage,
    description,
    getMainWrapperProps,
    getInputWrapperProps,
    getErrorMessageProps,
    getDescriptionProps
  ]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getBaseProps(), children: [
    isOutsideLeft ? labelContent : null,
    mainWrapper
  ] });
});
NumberInput.displayName = "HeroUI.NumberInput";
var number_input_default = NumberInput;
var $ff9177efc58547ad$exports = {};
$ff9177efc58547ad$exports = {
  "close": `إغلاق`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} إشعار`,
    other: () => `${formatter.number(args.count)} إشعارات`
  })}.`
};
var $25eb7c0c0c45e544$exports = {};
$25eb7c0c0c45e544$exports = {
  "close": `Затвори`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} известие`,
    other: () => `${formatter.number(args.count)} известия`
  })}.`
};
var $28feffc3d61a8691$exports = {};
$28feffc3d61a8691$exports = {
  "close": `Zavřít`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} oznámení`,
    other: () => `${formatter.number(args.count)} oznámení`
  })}.`
};
var $390d441203d25ff4$exports = {};
$390d441203d25ff4$exports = {
  "close": `Luk`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} besked`,
    other: () => `${formatter.number(args.count)} beskeder`
  })}.`
};
var $7063c2d0f14f979a$exports = {};
$7063c2d0f14f979a$exports = {
  "close": `Schließen`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} Benachrichtigung`,
    other: () => `${formatter.number(args.count)} Benachrichtigungen`
  })}.`
};
var $2dfc1dbb6590af88$exports = {};
$2dfc1dbb6590af88$exports = {
  "close": `Κλείσιμο`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} ειδοποίηση`,
    other: () => `${formatter.number(args.count)} ειδοποιήσεις`
  })}.`
};
var $9a12ff1caae5a7a5$exports = {};
$9a12ff1caae5a7a5$exports = {
  "close": `Close`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} notification`,
    other: () => `${formatter.number(args.count)} notifications`
  })}.`
};
var $f4095fb5a72adbe6$exports = {};
$f4095fb5a72adbe6$exports = {
  "close": `Cerrar`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} notificación`,
    other: () => `${formatter.number(args.count)} notificaciones`
  })}.`
};
var $75bc5191b9d7826a$exports = {};
$75bc5191b9d7826a$exports = {
  "close": `Sule`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} teatis`,
    other: () => `${formatter.number(args.count)} teatist`
  })}.`
};
var $e4b9aef18b0db8dc$exports = {};
$e4b9aef18b0db8dc$exports = {
  "close": `Sulje`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} ilmoitus`,
    other: () => `${formatter.number(args.count)} ilmoitusta`
  })}.`
};
var $888756784d832bd7$exports = {};
$888756784d832bd7$exports = {
  "close": `Fermer`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} notification`,
    other: () => `${formatter.number(args.count)} notifications`
  })}.`
};
var $6835949b68a1fabf$exports = {};
$6835949b68a1fabf$exports = {
  "close": `סגור`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} התראה`,
    other: () => `${formatter.number(args.count)} התראות`
  })}.`
};
var $87ffcbc0b651e40b$exports = {};
$87ffcbc0b651e40b$exports = {
  "close": `Zatvori`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} obavijest`,
    other: () => `${formatter.number(args.count)} obavijesti`
  })}.`
};
var $dc6e3b2813600d69$exports = {};
$dc6e3b2813600d69$exports = {
  "close": `Bezárás`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} értesítés`,
    other: () => `${formatter.number(args.count)} értesítés`
  })}.`
};
var $fe136bcbacfcfa14$exports = {};
$fe136bcbacfcfa14$exports = {
  "close": `Chiudi`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} notifica`,
    other: () => `${formatter.number(args.count)} notifiche`
  })}.`
};
var $8fb53a929b46df83$exports = {};
$8fb53a929b46df83$exports = {
  "close": `閉じる`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} 個の通知`,
    other: () => `${formatter.number(args.count)} 個の通知`
  })}。`
};
var $2c38dbfaf041a865$exports = {};
$2c38dbfaf041a865$exports = {
  "close": `닫기`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)}개 알림`,
    other: () => `${formatter.number(args.count)}개 알림`
  })}.`
};
var $48f3f33a29908d4c$exports = {};
$48f3f33a29908d4c$exports = {
  "close": `Uždaryti`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} pranešimas`,
    other: () => `${formatter.number(args.count)} pranešimai`
  })}.`
};
var $9867160d996455a0$exports = {};
$9867160d996455a0$exports = {
  "close": `Aizvērt`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} paziņojums`,
    other: () => `${formatter.number(args.count)} paziņojumi`
  })}.`
};
var $196258ea25c96487$exports = {};
$196258ea25c96487$exports = {
  "close": `Lukk`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} varsling`,
    other: () => `${formatter.number(args.count)} varsler`
  })}.`
};
var $949061cb954e8000$exports = {};
$949061cb954e8000$exports = {
  "close": `Sluiten`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} melding`,
    other: () => `${formatter.number(args.count)} meldingen`
  })}.`
};
var $8189bed27add1ad3$exports = {};
$8189bed27add1ad3$exports = {
  "close": `Zamknij`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} powiadomienie`,
    few: () => `${formatter.number(args.count)} powiadomienia`,
    many: () => `${formatter.number(args.count)} powiadomień`,
    other: () => `${formatter.number(args.count)} powiadomienia`
  })}.`
};
var $a361756a93b6e28c$exports = {};
$a361756a93b6e28c$exports = {
  "close": `Fechar`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} notificação`,
    other: () => `${formatter.number(args.count)} notificações`
  })}.`
};
var $034c7393857c8db0$exports = {};
$034c7393857c8db0$exports = {
  "close": `Fechar`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} notificação`,
    other: () => `${formatter.number(args.count)} notificações`
  })}.`
};
var $e33d3b3868478b04$exports = {};
$e33d3b3868478b04$exports = {
  "close": `Închideţi`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} notificare`,
    other: () => `${formatter.number(args.count)} notificări`
  })}.`
};
var $9a7dcb914b29cd9f$exports = {};
$9a7dcb914b29cd9f$exports = {
  "close": `Закрыть`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} уведомление`,
    other: () => `${formatter.number(args.count)} уведомления`
  })}.`
};
var $e43d964a0c7f1266$exports = {};
$e43d964a0c7f1266$exports = {
  "close": `Zatvoriť`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} oznámenie`,
    few: () => `${formatter.number(args.count)} oznámenia`,
    other: () => `${formatter.number(args.count)} oznámení`
  })}.`
};
var $0bc56cee3275bcaa$exports = {};
$0bc56cee3275bcaa$exports = {
  "close": `Zapri`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} obvestilo`,
    two: () => `${formatter.number(args.count)} obvestili`,
    few: () => `${formatter.number(args.count)} obvestila`,
    other: () => `${formatter.number(args.count)} obvestil`
  })}.`
};
var $7dbdd7289c10d2ba$exports = {};
$7dbdd7289c10d2ba$exports = {
  "close": `Zatvori`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} obaveštenje`,
    other: () => `${formatter.number(args.count)} obaveštenja`
  })}.`
};
var $ccbe6066c10b1e53$exports = {};
$ccbe6066c10b1e53$exports = {
  "close": `Stäng`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} meddelande`,
    other: () => `${formatter.number(args.count)} meddelanden`
  })}.`
};
var $9d503476b9d858b7$exports = {};
$9d503476b9d858b7$exports = {
  "close": `Kapat`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} bildirim`,
    other: () => `${formatter.number(args.count)} bildirim`
  })}.`
};
var $32ee419c7b9b7a83$exports = {};
$32ee419c7b9b7a83$exports = {
  "close": `Закрити`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} сповіщення`,
    other: () => `${formatter.number(args.count)} сповіщення`
  })}.`
};
var $122525af1cb737c7$exports = {};
$122525af1cb737c7$exports = {
  "close": `关闭`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} 个通知`,
    other: () => `${formatter.number(args.count)} 个通知`
  })}。`
};
var $52e8b1b00094e5a3$exports = {};
$52e8b1b00094e5a3$exports = {
  "close": `關閉`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} 個通知`,
    other: () => `${formatter.number(args.count)} 個通知`
  })}。`
};
var $7853651519a70071$exports = {};
$7853651519a70071$exports = {
  "ar-AE": $ff9177efc58547ad$exports,
  "bg-BG": $25eb7c0c0c45e544$exports,
  "cs-CZ": $28feffc3d61a8691$exports,
  "da-DK": $390d441203d25ff4$exports,
  "de-DE": $7063c2d0f14f979a$exports,
  "el-GR": $2dfc1dbb6590af88$exports,
  "en-US": $9a12ff1caae5a7a5$exports,
  "es-ES": $f4095fb5a72adbe6$exports,
  "et-EE": $75bc5191b9d7826a$exports,
  "fi-FI": $e4b9aef18b0db8dc$exports,
  "fr-FR": $888756784d832bd7$exports,
  "he-IL": $6835949b68a1fabf$exports,
  "hr-HR": $87ffcbc0b651e40b$exports,
  "hu-HU": $dc6e3b2813600d69$exports,
  "it-IT": $fe136bcbacfcfa14$exports,
  "ja-JP": $8fb53a929b46df83$exports,
  "ko-KR": $2c38dbfaf041a865$exports,
  "lt-LT": $48f3f33a29908d4c$exports,
  "lv-LV": $9867160d996455a0$exports,
  "nb-NO": $196258ea25c96487$exports,
  "nl-NL": $949061cb954e8000$exports,
  "pl-PL": $8189bed27add1ad3$exports,
  "pt-BR": $a361756a93b6e28c$exports,
  "pt-PT": $034c7393857c8db0$exports,
  "ro-RO": $e33d3b3868478b04$exports,
  "ru-RU": $9a7dcb914b29cd9f$exports,
  "sk-SK": $e43d964a0c7f1266$exports,
  "sl-SI": $0bc56cee3275bcaa$exports,
  "sr-SP": $7dbdd7289c10d2ba$exports,
  "sv-SE": $ccbe6066c10b1e53$exports,
  "tr-TR": $9d503476b9d858b7$exports,
  "uk-UA": $32ee419c7b9b7a83$exports,
  "zh-CN": $122525af1cb737c7$exports,
  "zh-TW": $52e8b1b00094e5a3$exports
};
function $parcel$interopDefault$1(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $d6542812f0669241$export$a407b657d3044108(props, state, ref) {
  let { key, timer, timeout } = props.toast;
  reactExports.useEffect(() => {
    if (timer == null || timeout == null)
      return;
    timer.reset(timeout);
    return () => {
      timer.pause();
    };
  }, [
    timer,
    timeout
  ]);
  let titleId = $bdb11010cef70236$export$f680877a34711e37$2();
  let descriptionId = $bdb11010cef70236$export$b4cc09c592e8fdb8$1();
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$1($7853651519a70071$exports), "@react-aria/toast");
  let [isVisible2, setIsVisible] = reactExports.useState(false);
  reactExports.useEffect(() => {
    setIsVisible(true);
  }, []);
  let toastProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  return {
    toastProps: {
      ...toastProps,
      role: "alertdialog",
      "aria-modal": "false",
      "aria-labelledby": props["aria-labelledby"] || titleId,
      "aria-describedby": props["aria-describedby"] || descriptionId,
      tabIndex: 0
    },
    contentProps: {
      role: "alert",
      "aria-atomic": "true",
      "aria-hidden": isVisible2 ? void 0 : "true"
    },
    titleProps: {
      id: titleId
    },
    descriptionProps: {
      id: descriptionId
    },
    closeButtonProps: {
      "aria-label": stringFormatter.format("close"),
      onPress: () => state.close(key)
    }
  };
}
var shim$1 = { exports: {} };
var useSyncExternalStoreShim_production = {};
/**
 * @license React
 * use-sync-external-store-shim.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var React$4 = reactExports;
function is(x2, y2) {
  return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
}
var objectIs = "function" === typeof Object.is ? Object.is : is, useState = React$4.useState, useEffect = React$4.useEffect, useLayoutEffect$1 = React$4.useLayoutEffect, useDebugValue = React$4.useDebugValue;
function useSyncExternalStore$2(subscribe2, getSnapshot2) {
  var value2 = getSnapshot2(), _useState = useState({ inst: { value: value2, getSnapshot: getSnapshot2 } }), inst = _useState[0].inst, forceUpdate = _useState[1];
  useLayoutEffect$1(
    function() {
      inst.value = value2;
      inst.getSnapshot = getSnapshot2;
      checkIfSnapshotChanged(inst) && forceUpdate({ inst });
    },
    [subscribe2, value2, getSnapshot2]
  );
  useEffect(
    function() {
      checkIfSnapshotChanged(inst) && forceUpdate({ inst });
      return subscribe2(function() {
        checkIfSnapshotChanged(inst) && forceUpdate({ inst });
      });
    },
    [subscribe2]
  );
  useDebugValue(value2);
  return value2;
}
function checkIfSnapshotChanged(inst) {
  var latestGetSnapshot = inst.getSnapshot;
  inst = inst.value;
  try {
    var nextValue = latestGetSnapshot();
    return !objectIs(inst, nextValue);
  } catch (error2) {
    return true;
  }
}
function useSyncExternalStore$1(subscribe2, getSnapshot2) {
  return getSnapshot2();
}
var shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
useSyncExternalStoreShim_production.useSyncExternalStore = void 0 !== React$4.useSyncExternalStore ? React$4.useSyncExternalStore : shim;
{
  shim$1.exports = useSyncExternalStoreShim_production;
}
var shimExports = shim$1.exports;
const $a86207c5d7f7e1fb$var$LANDMARK_API_VERSION = 1;
const $a86207c5d7f7e1fb$var$landmarkSymbol = Symbol.for("react-aria-landmark-manager");
function $a86207c5d7f7e1fb$var$subscribe(fn) {
  document.addEventListener("react-aria-landmark-manager-change", fn);
  return () => document.removeEventListener("react-aria-landmark-manager-change", fn);
}
function $a86207c5d7f7e1fb$var$getLandmarkManager() {
  if (typeof document === "undefined")
    return null;
  let instance2 = document[$a86207c5d7f7e1fb$var$landmarkSymbol];
  if (instance2 && instance2.version >= $a86207c5d7f7e1fb$var$LANDMARK_API_VERSION)
    return instance2;
  document[$a86207c5d7f7e1fb$var$landmarkSymbol] = new $a86207c5d7f7e1fb$var$LandmarkManager();
  document.dispatchEvent(new CustomEvent("react-aria-landmark-manager-change"));
  return document[$a86207c5d7f7e1fb$var$landmarkSymbol];
}
function $a86207c5d7f7e1fb$var$useLandmarkManager() {
  return shimExports.useSyncExternalStore($a86207c5d7f7e1fb$var$subscribe, $a86207c5d7f7e1fb$var$getLandmarkManager, $a86207c5d7f7e1fb$var$getLandmarkManager);
}
class $a86207c5d7f7e1fb$var$LandmarkManager {
  setupIfNeeded() {
    if (this.isListening)
      return;
    document.addEventListener("keydown", this.f6Handler, {
      capture: true
    });
    document.addEventListener("focusin", this.focusinHandler, {
      capture: true
    });
    document.addEventListener("focusout", this.focusoutHandler, {
      capture: true
    });
    this.isListening = true;
  }
  teardownIfNeeded() {
    if (!this.isListening || this.landmarks.length > 0 || this.refCount > 0)
      return;
    document.removeEventListener("keydown", this.f6Handler, {
      capture: true
    });
    document.removeEventListener("focusin", this.focusinHandler, {
      capture: true
    });
    document.removeEventListener("focusout", this.focusoutHandler, {
      capture: true
    });
    this.isListening = false;
  }
  focusLandmark(landmark, direction) {
    var _this_landmarks_find_focus, _this_landmarks_find;
    (_this_landmarks_find = this.landmarks.find((l2) => l2.ref.current === landmark)) === null || _this_landmarks_find === void 0 ? void 0 : (_this_landmarks_find_focus = _this_landmarks_find.focus) === null || _this_landmarks_find_focus === void 0 ? void 0 : _this_landmarks_find_focus.call(_this_landmarks_find, direction);
  }
  /**
  * Return set of landmarks with a specific role.
  */
  getLandmarksByRole(role) {
    return new Set(this.landmarks.filter((l2) => l2.role === role));
  }
  /**
  * Return first landmark with a specific role.
  */
  getLandmarkByRole(role) {
    return this.landmarks.find((l2) => l2.role === role);
  }
  addLandmark(newLandmark) {
    this.setupIfNeeded();
    if (this.landmarks.find((landmark) => landmark.ref === newLandmark.ref) || !newLandmark.ref.current)
      return;
    if (this.landmarks.filter((landmark) => landmark.role === "main").length > 1 && false)
      ;
    if (this.landmarks.length === 0) {
      this.landmarks = [
        newLandmark
      ];
      this.checkLabels(newLandmark.role);
      return;
    }
    let start2 = 0;
    let end2 = this.landmarks.length - 1;
    while (start2 <= end2) {
      let mid = Math.floor((start2 + end2) / 2);
      let comparedPosition = newLandmark.ref.current.compareDocumentPosition(this.landmarks[mid].ref.current);
      let isNewAfterExisting = Boolean(comparedPosition & Node.DOCUMENT_POSITION_PRECEDING || comparedPosition & Node.DOCUMENT_POSITION_CONTAINS);
      if (isNewAfterExisting)
        start2 = mid + 1;
      else
        end2 = mid - 1;
    }
    this.landmarks.splice(start2, 0, newLandmark);
    this.checkLabels(newLandmark.role);
  }
  updateLandmark(landmark) {
    let index2 = this.landmarks.findIndex((l2) => l2.ref === landmark.ref);
    if (index2 >= 0) {
      this.landmarks[index2] = {
        ...this.landmarks[index2],
        ...landmark
      };
      this.checkLabels(this.landmarks[index2].role);
    }
  }
  removeLandmark(ref) {
    this.landmarks = this.landmarks.filter((landmark) => landmark.ref !== ref);
    this.teardownIfNeeded();
  }
  /**
  * Warn if there are 2+ landmarks with the same role but no label.
  * Labels for landmarks with the same role must also be unique.
  *
  * See https://www.w3.org/WAI/ARIA/apg/practices/landmark-regions/.
  */
  checkLabels(role) {
    let landmarksWithRole = this.getLandmarksByRole(role);
    if (landmarksWithRole.size > 1) {
      [
        ...landmarksWithRole
      ].filter((landmark) => !landmark.label);
    }
  }
  /**
  * Get the landmark that is the closest parent in the DOM.
  * Returns undefined if no parent is a landmark.
  */
  closestLandmark(element2) {
    let landmarkMap = new Map(this.landmarks.map((l2) => [
      l2.ref.current,
      l2
    ]));
    let currentElement = element2;
    while (currentElement && !landmarkMap.has(currentElement) && currentElement !== document.body && currentElement.parentElement)
      currentElement = currentElement.parentElement;
    return landmarkMap.get(currentElement);
  }
  /**
  * Gets the next landmark, in DOM focus order, or previous if backwards is specified.
  * If last landmark, next should be the first landmark.
  * If not inside a landmark, will return first landmark.
  * Returns undefined if there are no landmarks.
  */
  getNextLandmark(element2, { backward }) {
    var _this_landmarks_nextLandmarkIndex_ref_current;
    let currentLandmark = this.closestLandmark(element2);
    let nextLandmarkIndex = backward ? this.landmarks.length - 1 : 0;
    if (currentLandmark)
      nextLandmarkIndex = this.landmarks.indexOf(currentLandmark) + (backward ? -1 : 1);
    let wrapIfNeeded = () => {
      if (nextLandmarkIndex < 0) {
        if (!element2.dispatchEvent(new CustomEvent("react-aria-landmark-navigation", {
          detail: {
            direction: "backward"
          },
          bubbles: true,
          cancelable: true
        })))
          return true;
        nextLandmarkIndex = this.landmarks.length - 1;
      } else if (nextLandmarkIndex >= this.landmarks.length) {
        if (!element2.dispatchEvent(new CustomEvent("react-aria-landmark-navigation", {
          detail: {
            direction: "forward"
          },
          bubbles: true,
          cancelable: true
        })))
          return true;
        nextLandmarkIndex = 0;
      }
      if (nextLandmarkIndex < 0 || nextLandmarkIndex >= this.landmarks.length)
        return true;
      return false;
    };
    if (wrapIfNeeded())
      return void 0;
    let i2 = nextLandmarkIndex;
    while ((_this_landmarks_nextLandmarkIndex_ref_current = this.landmarks[nextLandmarkIndex].ref.current) === null || _this_landmarks_nextLandmarkIndex_ref_current === void 0 ? void 0 : _this_landmarks_nextLandmarkIndex_ref_current.closest("[aria-hidden=true]")) {
      nextLandmarkIndex += backward ? -1 : 1;
      if (wrapIfNeeded())
        return void 0;
      if (nextLandmarkIndex === i2)
        break;
    }
    return this.landmarks[nextLandmarkIndex];
  }
  /**
  * Look at next landmark. If an element was previously focused inside, restore focus there.
  * If not, focus the landmark itself.
  * If no landmarks at all, or none with focusable elements, don't move focus.
  */
  f6Handler(e2) {
    if (e2.key === "F6") {
      let handled = e2.altKey ? this.focusMain() : this.navigate(e2.target, e2.shiftKey);
      if (handled) {
        e2.preventDefault();
        e2.stopPropagation();
      }
    }
  }
  focusMain() {
    let main2 = this.getLandmarkByRole("main");
    if (main2 && main2.ref.current && document.contains(main2.ref.current)) {
      this.focusLandmark(main2.ref.current, "forward");
      return true;
    }
    return false;
  }
  navigate(from2, backward) {
    let nextLandmark = this.getNextLandmark(from2, {
      backward
    });
    if (!nextLandmark)
      return false;
    if (nextLandmark.lastFocused) {
      let lastFocused = nextLandmark.lastFocused;
      if (document.body.contains(lastFocused)) {
        lastFocused.focus();
        return true;
      }
    }
    if (nextLandmark.ref.current && document.contains(nextLandmark.ref.current)) {
      this.focusLandmark(nextLandmark.ref.current, backward ? "backward" : "forward");
      return true;
    }
    return false;
  }
  /**
  * Sets lastFocused for a landmark, if focus is moved within that landmark.
  * Lets the last focused landmark know it was blurred if something else is focused.
  */
  focusinHandler(e2) {
    let currentLandmark = this.closestLandmark(e2.target);
    if (currentLandmark && currentLandmark.ref.current !== e2.target)
      this.updateLandmark({
        ref: currentLandmark.ref,
        lastFocused: e2.target
      });
    let previousFocusedElement = e2.relatedTarget;
    if (previousFocusedElement) {
      let closestPreviousLandmark = this.closestLandmark(previousFocusedElement);
      if (closestPreviousLandmark && closestPreviousLandmark.ref.current === previousFocusedElement)
        closestPreviousLandmark.blur();
    }
  }
  /**
  * Track if the focus is lost to the body. If it is, do cleanup on the landmark that last had focus.
  */
  focusoutHandler(e2) {
    let previousFocusedElement = e2.target;
    let nextFocusedElement = e2.relatedTarget;
    if (!nextFocusedElement || nextFocusedElement === document) {
      let closestPreviousLandmark = this.closestLandmark(previousFocusedElement);
      if (closestPreviousLandmark && closestPreviousLandmark.ref.current === previousFocusedElement)
        closestPreviousLandmark.blur();
    }
  }
  createLandmarkController() {
    let instance2 = this;
    instance2.refCount++;
    instance2.setupIfNeeded();
    return {
      navigate(direction, opts2) {
        let element2 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.from) || document.activeElement;
        return instance2.navigate(element2, direction === "backward");
      },
      focusNext(opts2) {
        let element2 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.from) || document.activeElement;
        return instance2.navigate(element2, false);
      },
      focusPrevious(opts2) {
        let element2 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.from) || document.activeElement;
        return instance2.navigate(element2, true);
      },
      focusMain() {
        return instance2.focusMain();
      },
      dispose() {
        if (instance2) {
          instance2.refCount--;
          instance2.teardownIfNeeded();
          instance2 = null;
        }
      }
    };
  }
  registerLandmark(landmark) {
    if (this.landmarks.find((l2) => l2.ref === landmark.ref))
      this.updateLandmark(landmark);
    else
      this.addLandmark(landmark);
    return () => this.removeLandmark(landmark.ref);
  }
  constructor() {
    this.landmarks = [];
    this.isListening = false;
    this.refCount = 0;
    this.version = $a86207c5d7f7e1fb$var$LANDMARK_API_VERSION;
    this.f6Handler = this.f6Handler.bind(this);
    this.focusinHandler = this.focusinHandler.bind(this);
    this.focusoutHandler = this.focusoutHandler.bind(this);
  }
}
function $a86207c5d7f7e1fb$export$4cc632584fd87fae(props, ref) {
  const { role, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, focus } = props;
  let manager = $a86207c5d7f7e1fb$var$useLandmarkManager();
  let label = ariaLabel || ariaLabelledby;
  let [isLandmarkFocused, setIsLandmarkFocused] = reactExports.useState(false);
  let defaultFocus = reactExports.useCallback(() => {
    setIsLandmarkFocused(true);
  }, [
    setIsLandmarkFocused
  ]);
  let blur = reactExports.useCallback(() => {
    setIsLandmarkFocused(false);
  }, [
    setIsLandmarkFocused
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (manager)
      return manager.registerLandmark({
        ref,
        label,
        role,
        focus: focus || defaultFocus,
        blur
      });
  }, [
    manager,
    label,
    ref,
    role,
    focus,
    defaultFocus,
    blur
  ]);
  reactExports.useEffect(() => {
    var _ref_current;
    if (isLandmarkFocused)
      (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.focus();
  }, [
    isLandmarkFocused,
    ref
  ]);
  return {
    landmarkProps: {
      role,
      tabIndex: isLandmarkFocused ? -1 : void 0,
      "aria-label": ariaLabel,
      "aria-labelledby": ariaLabelledby
    }
  };
}
function $parcel$interopDefault(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $6cc546b19ee7130a$export$b8cbbb20a51697de(props, state, ref) {
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault($7853651519a70071$exports), "@react-aria/toast");
  let { landmarkProps } = $a86207c5d7f7e1fb$export$4cc632584fd87fae({
    role: "region",
    "aria-label": props["aria-label"] || stringFormatter.format("notifications", {
      count: state.visibleToasts.length
    })
  }, ref);
  let isHovered = reactExports.useRef(false);
  let isFocused = reactExports.useRef(false);
  let updateTimers = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    if (isHovered.current || isFocused.current)
      state.pauseAll();
    else
      state.resumeAll();
  });
  let { hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$h({
    onHoverStart: () => {
      isHovered.current = true;
      updateTimers();
    },
    onHoverEnd: () => {
      isHovered.current = false;
      updateTimers();
    }
  });
  let toasts = reactExports.useRef([]);
  let prevVisibleToasts = reactExports.useRef(state.visibleToasts);
  let focusedToast = reactExports.useRef(null);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (focusedToast.current === -1 || state.visibleToasts.length === 0 || !ref.current) {
      toasts.current = [];
      prevVisibleToasts.current = state.visibleToasts;
      return;
    }
    toasts.current = [
      ...ref.current.querySelectorAll('[role="alertdialog"]')
    ];
    if (prevVisibleToasts.current.length === state.visibleToasts.length && state.visibleToasts.every((t2, i2) => t2.key === prevVisibleToasts.current[i2].key)) {
      prevVisibleToasts.current = state.visibleToasts;
      return;
    }
    let allToasts = prevVisibleToasts.current.map((t2, i2) => ({
      ...t2,
      i: i2,
      isRemoved: !state.visibleToasts.some((t22) => t2.key === t22.key)
    }));
    let removedFocusedToastIndex = allToasts.findIndex((t2) => t2.i === focusedToast.current && t2.isRemoved);
    if (removedFocusedToastIndex > -1) {
      var _lastFocused_current;
      if ($507fabe10e71c6fb$export$630ff653c5ada6a9$2() === "pointer" && ((_lastFocused_current = lastFocused.current) === null || _lastFocused_current === void 0 ? void 0 : _lastFocused_current.isConnected))
        $7215afc6de606d6b$export$de79e2c695e052f3$5(lastFocused.current);
      else {
        let i2 = 0;
        let nextToast;
        let prevToast;
        while (i2 <= removedFocusedToastIndex) {
          if (!allToasts[i2].isRemoved)
            prevToast = Math.max(0, i2 - 1);
          i2++;
        }
        while (i2 < allToasts.length) {
          if (!allToasts[i2].isRemoved) {
            nextToast = i2 - 1;
            break;
          }
          i2++;
        }
        if (prevToast === void 0 && nextToast === void 0)
          prevToast = 0;
        if (prevToast >= 0 && prevToast < toasts.current.length)
          $7215afc6de606d6b$export$de79e2c695e052f3$5(toasts.current[prevToast]);
        else if (nextToast >= 0 && nextToast < toasts.current.length)
          $7215afc6de606d6b$export$de79e2c695e052f3$5(toasts.current[nextToast]);
      }
    }
    prevVisibleToasts.current = state.visibleToasts;
  }, [
    state.visibleToasts,
    ref,
    updateTimers
  ]);
  let lastFocused = reactExports.useRef(null);
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$4({
    onFocusWithin: (e2) => {
      isFocused.current = true;
      lastFocused.current = e2.relatedTarget;
      updateTimers();
    },
    onBlurWithin: () => {
      isFocused.current = false;
      lastFocused.current = null;
      updateTimers();
    }
  });
  reactExports.useEffect(() => {
    var _lastFocused_current;
    if (state.visibleToasts.length === 0 && ((_lastFocused_current = lastFocused.current) === null || _lastFocused_current === void 0 ? void 0 : _lastFocused_current.isConnected)) {
      if ($507fabe10e71c6fb$export$630ff653c5ada6a9$2() === "pointer")
        $7215afc6de606d6b$export$de79e2c695e052f3$5(lastFocused.current);
      else
        lastFocused.current.focus();
      lastFocused.current = null;
    }
  }, [
    ref,
    state.visibleToasts.length
  ]);
  reactExports.useEffect(() => {
    return () => {
      var _lastFocused_current;
      if ((_lastFocused_current = lastFocused.current) === null || _lastFocused_current === void 0 ? void 0 : _lastFocused_current.isConnected) {
        if ($507fabe10e71c6fb$export$630ff653c5ada6a9$2() === "pointer")
          $7215afc6de606d6b$export$de79e2c695e052f3$5(lastFocused.current);
        else
          lastFocused.current.focus();
        lastFocused.current = null;
      }
    };
  }, [
    ref
  ]);
  return {
    regionProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(landmarkProps, hoverProps, focusWithinProps, {
      tabIndex: -1,
      // Mark the toast region as a "top layer", so that it:
      //   - is not aria-hidden when opening an overlay
      //   - allows focus even outside a containing focus scope
      //   - doesn’t dismiss overlays when clicking on it, even though it is outside
      // @ts-ignore
      "data-react-aria-top-layer": true,
      // listen to focus events separate from focuswithin because that will only fire once
      // and we need to follow all focus changes
      onFocus: (e2) => {
        let target = e2.target.closest('[role="alertdialog"]');
        focusedToast.current = toasts.current.findIndex((t2) => t2 === target);
      },
      onBlur: () => {
        focusedToast.current = -1;
      }
    })
  };
}
function $8a9cb279dc87e130$export$525bc4921d56d4a(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$715c682d09d639cc(onBlur) {
  let stateRef = reactExports.useRef({
    isFocused: false,
    observer: null
  });
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    const state = stateRef.current;
    return () => {
      if (state.observer) {
        state.observer.disconnect();
        state.observer = null;
      }
    };
  }, []);
  let dispatchBlur = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onBlur === null || onBlur === void 0 ? void 0 : onBlur(e2);
  });
  return reactExports.useCallback((e2) => {
    if (e2.target instanceof HTMLButtonElement || e2.target instanceof HTMLInputElement || e2.target instanceof HTMLTextAreaElement || e2.target instanceof HTMLSelectElement) {
      stateRef.current.isFocused = true;
      let target = e2.target;
      let onBlurHandler = (e3) => {
        stateRef.current.isFocused = false;
        if (target.disabled) {
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a(e3);
          dispatchBlur(event);
        }
        if (stateRef.current.observer) {
          stateRef.current.observer.disconnect();
          stateRef.current.observer = null;
        }
      };
      target.addEventListener("focusout", onBlurHandler, {
        once: true
      });
      stateRef.current.observer = new MutationObserver(() => {
        if (stateRef.current.isFocused && target.disabled) {
          var _stateRef_current_observer;
          (_stateRef_current_observer = stateRef.current.observer) === null || _stateRef_current_observer === void 0 ? void 0 : _stateRef_current_observer.disconnect();
          let relatedTargetEl = target === document.activeElement ? null : document.activeElement;
          target.dispatchEvent(new FocusEvent("blur", {
            relatedTarget: relatedTargetEl
          }));
          target.dispatchEvent(new FocusEvent("focusout", {
            bubbles: true,
            relatedTarget: relatedTargetEl
          }));
        }
      });
      stateRef.current.observer.observe(target, {
        attributes: true,
        attributeFilter: [
          "disabled"
        ]
      });
    }
  }, [
    dispatchBlur
  ]);
}
let $8a9cb279dc87e130$export$fda7da73ab5d4c48 = false;
function $8a9cb279dc87e130$export$cabe61c495ee3649(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$3(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$4(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  $8a9cb279dc87e130$export$fda7da73ab5d4c48 = true;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    $8a9cb279dc87e130$export$fda7da73ab5d4c48 = false;
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state = "default";
let $14c0b72509d70225$var$savedUserSelect = "";
let $14c0b72509d70225$var$modifiedElementMap = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
      $14c0b72509d70225$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state !== "disabled")
      return;
    $14c0b72509d70225$var$state = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
        if ($14c0b72509d70225$var$state === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect || "";
          $14c0b72509d70225$var$savedUserSelect = "";
          $14c0b72509d70225$var$state = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5 = React$5.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$9(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation = /* @__PURE__ */ new WeakMap();
class $f6c31cce2adf654f$var$PressEvent12 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
}
const $f6c31cce2adf654f$var$LINK_CLICKED = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent12("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent12("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent12("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent12("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$3(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$9(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$6())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$4(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$3(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$5(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes.has(target.type);
}
let $507fabe10e71c6fb$var$currentModality = null;
let $507fabe10e71c6fb$var$changeHandlers = /* @__PURE__ */ new Set();
let $507fabe10e71c6fb$export$d90243b58daecda7 = /* @__PURE__ */ new Map();
let $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
let $507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
const $507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS = {
  Tab: true,
  Escape: true
};
function $507fabe10e71c6fb$var$triggerChangeHandlers(modality, e2) {
  for (let handler of $507fabe10e71c6fb$var$changeHandlers)
    handler(modality, e2);
}
function $507fabe10e71c6fb$var$isValidKey(e2) {
  return !(e2.metaKey || !$c87311424ea30a05$export$9ac100e40613ea10$6() && e2.altKey || e2.ctrlKey || e2.key === "Control" || e2.key === "Shift" || e2.key === "Meta");
}
function $507fabe10e71c6fb$var$handleKeyboardEvent(e2) {
  $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
  if ($507fabe10e71c6fb$var$isValidKey(e2)) {
    $507fabe10e71c6fb$var$currentModality = "keyboard";
    $507fabe10e71c6fb$var$triggerChangeHandlers("keyboard", e2);
  }
}
function $507fabe10e71c6fb$var$handlePointerEvent(e2) {
  $507fabe10e71c6fb$var$currentModality = "pointer";
  if (e2.type === "mousedown" || e2.type === "pointerdown") {
    $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
    $507fabe10e71c6fb$var$triggerChangeHandlers("pointer", e2);
  }
}
function $507fabe10e71c6fb$var$handleClickEvent(e2) {
  if ($6a7db85432448f7f$export$60278871457622de$4(e2)) {
    $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
    $507fabe10e71c6fb$var$currentModality = "virtual";
  }
}
function $507fabe10e71c6fb$var$handleFocusEvent(e2) {
  if (e2.target === window || e2.target === document || $8a9cb279dc87e130$export$fda7da73ab5d4c48 || !e2.isTrusted)
    return;
  if (!$507fabe10e71c6fb$var$hasEventBeforeFocus && !$507fabe10e71c6fb$var$hasBlurredWindowRecently) {
    $507fabe10e71c6fb$var$currentModality = "virtual";
    $507fabe10e71c6fb$var$triggerChangeHandlers("virtual", e2);
  }
  $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
}
function $507fabe10e71c6fb$var$handleWindowBlur() {
  if ($8a9cb279dc87e130$export$fda7da73ab5d4c48)
    return;
  $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently = true;
}
function $507fabe10e71c6fb$var$setupGlobalFocusEvents(element2) {
  if (typeof window === "undefined" || typeof document === "undefined" || $507fabe10e71c6fb$export$d90243b58daecda7.get($431fbd86ca7dc216$export$f21a1ffae260145a$4(element2)))
    return;
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  let focus = windowObject.HTMLElement.prototype.focus;
  windowObject.HTMLElement.prototype.focus = function() {
    $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
    focus.apply(this, arguments);
  };
  documentObject.addEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
  documentObject.addEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
  documentObject.addEventListener("click", $507fabe10e71c6fb$var$handleClickEvent, true);
  windowObject.addEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent, true);
  windowObject.addEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.addEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent, true);
    documentObject.addEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent, true);
    documentObject.addEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent, true);
  }
  windowObject.addEventListener("beforeunload", () => {
    $507fabe10e71c6fb$var$tearDownWindowFocusTracking(element2);
  }, {
    once: true
  });
  $507fabe10e71c6fb$export$d90243b58daecda7.set(windowObject, {
    focus
  });
}
const $507fabe10e71c6fb$var$tearDownWindowFocusTracking = (element2, loadListener) => {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  if (loadListener)
    documentObject.removeEventListener("DOMContentLoaded", loadListener);
  if (!$507fabe10e71c6fb$export$d90243b58daecda7.has(windowObject))
    return;
  windowObject.HTMLElement.prototype.focus = $507fabe10e71c6fb$export$d90243b58daecda7.get(windowObject).focus;
  documentObject.removeEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
  documentObject.removeEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
  documentObject.removeEventListener("click", $507fabe10e71c6fb$var$handleClickEvent, true);
  windowObject.removeEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent, true);
  windowObject.removeEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.removeEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent, true);
    documentObject.removeEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent, true);
    documentObject.removeEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent, true);
  }
  $507fabe10e71c6fb$export$d90243b58daecda7.delete(windowObject);
};
function $507fabe10e71c6fb$export$2f1888112f558a7d(element2) {
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  let loadListener;
  if (documentObject.readyState !== "loading")
    $507fabe10e71c6fb$var$setupGlobalFocusEvents(element2);
  else {
    loadListener = () => {
      $507fabe10e71c6fb$var$setupGlobalFocusEvents(element2);
    };
    documentObject.addEventListener("DOMContentLoaded", loadListener);
  }
  return () => $507fabe10e71c6fb$var$tearDownWindowFocusTracking(element2, loadListener);
}
if (typeof document !== "undefined")
  $507fabe10e71c6fb$export$2f1888112f558a7d();
function $507fabe10e71c6fb$export$b9b3dfddab17db27() {
  return $507fabe10e71c6fb$var$currentModality !== "pointer";
}
function $507fabe10e71c6fb$export$630ff653c5ada6a9() {
  return $507fabe10e71c6fb$var$currentModality;
}
const $507fabe10e71c6fb$var$nonTextInputTypes = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $507fabe10e71c6fb$var$isKeyboardFocusEvent(isTextInput, modality, e2) {
  let document1 = $431fbd86ca7dc216$export$b204af158042fbac$4(e2 === null || e2 === void 0 ? void 0 : e2.target);
  const IHTMLInputElement = typeof window !== "undefined" ? $431fbd86ca7dc216$export$f21a1ffae260145a$4(e2 === null || e2 === void 0 ? void 0 : e2.target).HTMLInputElement : HTMLInputElement;
  const IHTMLTextAreaElement = typeof window !== "undefined" ? $431fbd86ca7dc216$export$f21a1ffae260145a$4(e2 === null || e2 === void 0 ? void 0 : e2.target).HTMLTextAreaElement : HTMLTextAreaElement;
  const IHTMLElement = typeof window !== "undefined" ? $431fbd86ca7dc216$export$f21a1ffae260145a$4(e2 === null || e2 === void 0 ? void 0 : e2.target).HTMLElement : HTMLElement;
  const IKeyboardEvent = typeof window !== "undefined" ? $431fbd86ca7dc216$export$f21a1ffae260145a$4(e2 === null || e2 === void 0 ? void 0 : e2.target).KeyboardEvent : KeyboardEvent;
  isTextInput = isTextInput || document1.activeElement instanceof IHTMLInputElement && !$507fabe10e71c6fb$var$nonTextInputTypes.has(document1.activeElement.type) || document1.activeElement instanceof IHTMLTextAreaElement || document1.activeElement instanceof IHTMLElement && document1.activeElement.isContentEditable;
  return !(isTextInput && modality === "keyboard" && e2 instanceof IKeyboardEvent && !$507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS[e2.key]);
}
function $507fabe10e71c6fb$export$ec71b4b83ac08ec3(fn, deps, opts2) {
  $507fabe10e71c6fb$var$setupGlobalFocusEvents();
  reactExports.useEffect(() => {
    let handler = (modality, e2) => {
      if (!$507fabe10e71c6fb$var$isKeyboardFocusEvent(!!(opts2 === null || opts2 === void 0 ? void 0 : opts2.isTextInput), modality, e2))
        return;
      fn($507fabe10e71c6fb$export$b9b3dfddab17db27());
    };
    $507fabe10e71c6fb$var$changeHandlers.add(handler);
    return () => {
      $507fabe10e71c6fb$var$changeHandlers.delete(handler);
    };
  }, deps);
}
function $3ad3f6e1647bc98d$export$80f3e147d781571c(element2) {
  const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
  if ($507fabe10e71c6fb$export$630ff653c5ada6a9() === "virtual") {
    let lastFocusedElement = activeElement;
    $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
      if ($d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument) === lastFocusedElement && element2.isConnected)
        $7215afc6de606d6b$export$de79e2c695e052f3$5(element2);
    });
  } else
    $7215afc6de606d6b$export$de79e2c695e052f3$5(element2);
}
function $a1ea59d68270f0dd$export$f8168d8dd8fd66e6(props) {
  let { isDisabled, onFocus: onFocusProp, onBlur: onBlurProp, onFocusChange } = props;
  const onBlur = reactExports.useCallback((e2) => {
    if (e2.target === e2.currentTarget) {
      if (onBlurProp)
        onBlurProp(e2);
      if (onFocusChange)
        onFocusChange(false);
      return true;
    }
  }, [
    onBlurProp,
    onFocusChange
  ]);
  const onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc(onBlur);
  const onFocus = reactExports.useCallback((e2) => {
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(e2.target);
    const activeElement = ownerDocument ? $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument) : $d4ee10de306f2510$export$cd4e5573fbe2b576();
    if (e2.target === e2.currentTarget && activeElement === $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) {
      if (onFocusProp)
        onFocusProp(e2);
      if (onFocusChange)
        onFocusChange(true);
      onSyntheticFocus(e2);
    }
  }, [
    onFocusChange,
    onFocusProp,
    onSyntheticFocus
  ]);
  return {
    focusProps: {
      onFocus: !isDisabled && (onFocusProp || onFocusChange || onBlurProp) ? onFocus : void 0,
      onBlur: !isDisabled && (onBlurProp || onFocusChange) ? onBlur : void 0
    }
  };
}
function $93925083ecbb358c$export$48d1ea6320830260(handler) {
  if (!handler)
    return void 0;
  let shouldStopPropagation = true;
  return (e2) => {
    let event = {
      ...e2,
      preventDefault() {
        e2.preventDefault();
      },
      isDefaultPrevented() {
        return e2.isDefaultPrevented();
      },
      stopPropagation() {
        shouldStopPropagation = true;
      },
      continuePropagation() {
        shouldStopPropagation = false;
      },
      isPropagationStopped() {
        return shouldStopPropagation;
      }
    };
    handler(event);
    if (shouldStopPropagation)
      e2.stopPropagation();
  };
}
function $46d819fcbaf35654$export$8f71654801c2f7cd(props) {
  return {
    keyboardProps: props.isDisabled ? {} : {
      onKeyDown: $93925083ecbb358c$export$48d1ea6320830260(props.onKeyDown),
      onKeyUp: $93925083ecbb358c$export$48d1ea6320830260(props.onKeyUp)
    }
  };
}
let $f645667febf57a63$export$f9762fab77588ecb = /* @__PURE__ */ React$5.createContext(null);
function $f645667febf57a63$var$useFocusableContext(ref) {
  let context = reactExports.useContext($f645667febf57a63$export$f9762fab77588ecb) || {};
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, ref);
  let { ref: _24, ...otherProps } = context;
  return otherProps;
}
function $f645667febf57a63$export$4c014de7c8940b4c(props, domRef) {
  let { focusProps } = $a1ea59d68270f0dd$export$f8168d8dd8fd66e6(props);
  let { keyboardProps } = $46d819fcbaf35654$export$8f71654801c2f7cd(props);
  let interactions = $3ef42575df84b30b$export$9d1611c77c2fe928$9(focusProps, keyboardProps);
  let domProps = $f645667febf57a63$var$useFocusableContext(domRef);
  let interactionProps = props.isDisabled ? {} : domProps;
  let autoFocusRef = reactExports.useRef(props.autoFocus);
  reactExports.useEffect(() => {
    if (autoFocusRef.current && domRef.current)
      $3ad3f6e1647bc98d$export$80f3e147d781571c(domRef.current);
    autoFocusRef.current = false;
  }, [
    domRef
  ]);
  let tabIndex = props.excludeFromTabOrder ? -1 : 0;
  if (props.isDisabled)
    tabIndex = void 0;
  return {
    focusableProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9({
      ...interactions,
      tabIndex
    }, interactionProps)
  };
}
function $9ab94262bd0047c7$export$420e68273165f4ec(props) {
  let { isDisabled, onBlurWithin, onFocusWithin, onFocusWithinChange } = props;
  let state = reactExports.useRef({
    isFocusWithin: false
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let onBlur = reactExports.useCallback((e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    if (state.current.isFocusWithin && !e2.currentTarget.contains(e2.relatedTarget)) {
      state.current.isFocusWithin = false;
      removeAllGlobalListeners();
      if (onBlurWithin)
        onBlurWithin(e2);
      if (onFocusWithinChange)
        onFocusWithinChange(false);
    }
  }, [
    onBlurWithin,
    onFocusWithinChange,
    state,
    removeAllGlobalListeners
  ]);
  let onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc(onBlur);
  let onFocus = reactExports.useCallback((e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(e2.target);
    const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
    if (!state.current.isFocusWithin && activeElement === $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) {
      if (onFocusWithin)
        onFocusWithin(e2);
      if (onFocusWithinChange)
        onFocusWithinChange(true);
      state.current.isFocusWithin = true;
      onSyntheticFocus(e2);
      let currentTarget = e2.currentTarget;
      addGlobalListener(ownerDocument, "focus", (e3) => {
        if (state.current.isFocusWithin && !$d4ee10de306f2510$export$4282f70798064fe0$3(currentTarget, e3.target)) {
          let nativeEvent = new ownerDocument.defaultView.FocusEvent("blur", {
            relatedTarget: e3.target
          });
          $8a9cb279dc87e130$export$c2b7abe5d61ec696(nativeEvent, currentTarget);
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a(nativeEvent);
          onBlur(event);
        }
      }, {
        capture: true
      });
    }
  }, [
    onFocusWithin,
    onFocusWithinChange,
    onSyntheticFocus,
    addGlobalListener,
    onBlur
  ]);
  if (isDisabled)
    return {
      focusWithinProps: {
        // These cannot be null, that would conflict in mergeProps
        onFocus: void 0,
        onBlur: void 0
      }
    };
  return {
    focusWithinProps: {
      onFocus,
      onBlur
    }
  };
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = false;
let $6179b936705e76d3$var$hoverCount = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent);
  $6179b936705e76d3$var$hoverCount++;
  return () => {
    $6179b936705e76d3$var$hoverCount--;
    if ($6179b936705e76d3$var$hoverCount > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
var SWIPE_THRESHOLD_X = 100;
var SWIPE_THRESHOLD_Y = 20;
function useToast(originalProps) {
  var _a2, _b2;
  const [props, variantProps2] = mapPropsVariants(originalProps, toast$1.variantKeys);
  const {
    ref,
    as: as2,
    title,
    description,
    className,
    classNames: classNames2,
    toast: toast2,
    endContent,
    closeIcon,
    hideIcon = false,
    placement: placementProp = "bottom-right",
    isRegionExpanded,
    hideCloseButton = false,
    state,
    total = 1,
    index: index2 = 0,
    heights,
    promise: promiseProp,
    setHeights,
    toastOffset = 0,
    motionProps,
    timeout = 6e3,
    shouldShowTimeoutProgress = false,
    icon,
    onClose,
    severity,
    maxVisibleToasts,
    loadingComponent,
    ...otherProps
  } = props;
  const { isHovered: isToastHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456({
    isDisabled: false
  });
  const globalContext = useProviderContext();
  const disableAnimation = (_b2 = (_a2 = originalProps == null ? void 0 : originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const isMobile2 = useIsMobile();
  let placement = placementProp;
  if (isMobile2) {
    if (placementProp.includes("top")) {
      placement = "top-center";
    } else {
      placement = "bottom-center";
    }
  }
  const animationRef = reactExports.useRef(null);
  const startTime = reactExports.useRef(null);
  const progressRef = reactExports.useRef(0);
  const progressBarRef = reactExports.useRef(null);
  const pausedTime = reactExports.useRef(0);
  const timeElapsed = reactExports.useRef(0);
  reactExports.useEffect(() => {
    if (progressBarRef.current) {
      progressBarRef.current.style.width = "0%";
    }
  }, []);
  const [isLoading, setIsLoading] = reactExports.useState(!!promiseProp);
  const [isToastExiting, setIsToastExiting] = reactExports.useState(false);
  reactExports.useEffect(() => {
    if (!promiseProp)
      return;
    promiseProp.finally(() => {
      setIsLoading(false);
    });
  }, [promiseProp]);
  reactExports.useEffect(() => {
    const updateProgress = (timestamp) => {
      if (!timeout || isLoading) {
        return;
      }
      if (startTime.current === null) {
        startTime.current = timestamp;
      }
      if (isToastHovered || isRegionExpanded) {
        pausedTime.current += timestamp - startTime.current;
        startTime.current = null;
        animationRef.current = requestAnimationFrame(updateProgress);
        return;
      }
      const elapsed = timestamp - startTime.current + pausedTime.current;
      timeElapsed.current = elapsed;
      if (timeElapsed.current >= timeout) {
        setIsToastExiting(true);
      }
      progressRef.current = Math.min(elapsed / timeout * 100, 100);
      if (progressBarRef.current) {
        progressBarRef.current.style.width = `${shouldShowTimeoutProgress ? progressRef.current : 0}%`;
      }
      if (progressRef.current < 100) {
        animationRef.current = requestAnimationFrame(updateProgress);
      }
    };
    animationRef.current = requestAnimationFrame(updateProgress);
    return () => {
      if (animationRef.current !== null) {
        cancelAnimationFrame(animationRef.current);
      }
    };
  }, [
    timeout,
    shouldShowTimeoutProgress,
    state,
    isToastHovered,
    index2,
    total,
    isRegionExpanded,
    isLoading,
    setIsToastExiting
  ]);
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const baseStyles = clsx$4(className, classNames2 == null ? void 0 : classNames2.base);
  const { toastProps, contentProps, titleProps, descriptionProps } = $d6542812f0669241$export$a407b657d3044108(
    props,
    state
  );
  const [mounted, setMounted] = reactExports.useState(false);
  reactExports.useEffect(() => {
    setMounted(true);
  }, []);
  const [initialHeight, setInitialHeight] = reactExports.useState(0);
  reactExports.useLayoutEffect(() => {
    if (!domRef.current || !mounted || isToastExiting) {
      return;
    }
    const toastNode = domRef.current;
    const originalHeight = toastNode.style.height;
    toastNode.style.height = "auto";
    const computedStyle = getComputedStyle(toastNode);
    const marginTop = parseFloat(computedStyle.marginTop);
    const marginBottom = parseFloat(computedStyle.marginBottom);
    const newHeight = toastNode.getBoundingClientRect().height + marginTop + marginBottom;
    toastNode.style.height = originalHeight;
    setInitialHeight((prevHeight) => prevHeight !== newHeight ? newHeight : prevHeight);
    const updatedHeights = [...heights];
    if (updatedHeights.length > index2) {
      updatedHeights[index2] = newHeight;
    } else {
      updatedHeights.push(newHeight);
    }
    setHeights(updatedHeights);
  }, [mounted, total, setHeights, index2, isToastExiting]);
  let liftHeight = 4;
  for (let idx = index2 + 1; idx < total; idx++) {
    liftHeight += heights[idx];
  }
  const frontHeight = heights[heights.length - 1];
  const slots = reactExports.useMemo(
    () => toast$1({
      ...variantProps2,
      disableAnimation
    }),
    [objectToDeps(variantProps2)]
  );
  const multiplier = placement.includes("top") ? 1 : -1;
  const toastVariants = {
    hidden: { opacity: 0, y: -50 * multiplier },
    visible: { opacity: 1, y: 0 },
    exit: { opacity: 0, y: -50 * multiplier }
  };
  const [drag2, setDrag] = reactExports.useState(false);
  const [dragValue, setDragValue] = reactExports.useState(0);
  const shouldCloseToast = (offsetX, offsetY) => {
    const isRight = placement.includes("right");
    const isLeft = placement.includes("left");
    const isCenterTop = placement === "top-center";
    const isCenterBottom = placement === "bottom-center";
    if (isRight && offsetX >= SWIPE_THRESHOLD_X || isLeft && offsetX <= -SWIPE_THRESHOLD_X || isCenterTop && offsetY <= -SWIPE_THRESHOLD_Y || isCenterBottom && offsetY >= SWIPE_THRESHOLD_Y) {
      return true;
    }
  };
  const getDragElasticConstraints = (placement2) => {
    const elasticConstraint = { top: 0, bottom: 0, right: 0, left: 0 };
    if (placement2 === "bottom-center") {
      elasticConstraint.bottom = 1;
      return elasticConstraint;
    }
    if (placement2 === "top-center") {
      elasticConstraint.top = 1;
      return elasticConstraint;
    }
    if (placement2.includes("right")) {
      elasticConstraint.right = 1;
      return elasticConstraint;
    }
    if (placement2.includes("left")) {
      elasticConstraint.left = 1;
      return elasticConstraint;
    }
    elasticConstraint.left = 1;
    elasticConstraint.right = 1;
    return elasticConstraint;
  };
  let opacityValue = void 0;
  if (drag2 && placement === "bottom-center" || placement === "top-center") {
    opacityValue = Math.max(0, 1 - dragValue / (SWIPE_THRESHOLD_Y + 5));
  } else if (drag2) {
    opacityValue = Math.max(0, 1 - dragValue / (SWIPE_THRESHOLD_X + 20));
  }
  const getToastProps = reactExports.useCallback(
    (props2 = {}) => {
      const topExtension = 16;
      const bottomExtension = 16;
      const pseudoElementStyles = {
        "--top-extension": `${topExtension}px`,
        "--bottom-extension": `${bottomExtension}px`
      };
      return {
        ref: domRef,
        className: slots.base({ class: clsx$4(baseStyles, classNames2 == null ? void 0 : classNames2.base) }),
        "data-has-title": dataAttr(!isEmpty(title)),
        "data-has-description": dataAttr(!isEmpty(description)),
        "data-placement": placement,
        "data-drag-value": dragValue,
        "data-toast": true,
        "aria-label": "toast",
        "data-toast-exiting": dataAttr(isToastExiting),
        onTransitionEnd: () => {
          if (isToastExiting) {
            const updatedHeights = heights;
            updatedHeights.splice(index2, 1);
            setHeights([...updatedHeights]);
            state.close(toast2.key);
          }
        },
        style: {
          opacity: opacityValue,
          ...pseudoElementStyles
        },
        ...mergeProps$3(props2, otherProps, toastProps, hoverProps)
      };
    },
    [
      slots,
      classNames2,
      toastProps,
      hoverProps,
      toast2,
      toast2.key,
      opacityValue,
      isToastExiting,
      state,
      toast2.key
    ]
  );
  const getWrapperProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }),
      ...props2
    }),
    []
  );
  const getIconProps = reactExports.useCallback(
    (props2 = {}) => ({
      "aria-label": "descriptionIcon",
      className: slots.icon({ class: classNames2 == null ? void 0 : classNames2.icon }),
      ...props2
    }),
    []
  );
  const getLoadingComponentProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: slots.loadingComponent({ class: classNames2 == null ? void 0 : classNames2.loadingComponent }),
      "aria-label": "loadingIcon",
      color: "current",
      ...props2
    }),
    []
  );
  const getSpinnerComponentProps = reactExports.useCallback(
    (props2 = {}) => ({
      classNames: { wrapper: slots.loadingComponent({ class: classNames2 == null ? void 0 : classNames2.loadingComponent }) },
      "aria-label": "loadingIcon",
      color: "current",
      ...props2
    }),
    []
  );
  const getContentProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: slots.content({ class: classNames2 == null ? void 0 : classNames2.content }),
      ...mergeProps$3(props2, otherProps, contentProps)
    }),
    [contentProps]
  );
  const getTitleProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: slots.title({ class: classNames2 == null ? void 0 : classNames2.title }),
      ...mergeProps$3(props2, otherProps, titleProps)
    }),
    [titleProps]
  );
  const getDescriptionProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: slots.description({ class: classNames2 == null ? void 0 : classNames2.description }),
      ...mergeProps$3(props2, otherProps, descriptionProps)
    }),
    [descriptionProps]
  );
  const getCloseButtonProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: slots.closeButton({ class: classNames2 == null ? void 0 : classNames2.closeButton }),
      "aria-label": "closeButton",
      "data-hidden": dataAttr(hideCloseButton),
      ...mergeProps$3(props2, {
        onPress: chain(() => {
          setIsToastExiting(true);
          setTimeout(() => document.body.focus(), 0);
        }, onClose)
      })
    }),
    [setIsToastExiting, onClose, state, toast2]
  );
  const getCloseIconProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: slots.closeIcon({ class: classNames2 == null ? void 0 : classNames2.closeIcon }),
      "aria-label": "closeIcon",
      ...props2
    }),
    []
  );
  const getMotionDivProps = reactExports.useCallback(
    (props2 = {}) => {
      const comparingValue = isRegionExpanded ? maxVisibleToasts - 1 : Math.min(2, maxVisibleToasts - 1);
      const isCloseToEnd = total - index2 - 1 <= comparingValue;
      const dragDirection = placement === "bottom-center" || placement === "top-center" ? "y" : "x";
      const dragConstraints = { left: 0, right: 0, top: 0, bottom: 0 };
      const dragElastic = getDragElasticConstraints(placement);
      const animateProps = (() => {
        if (placement.includes("top")) {
          return {
            top: isRegionExpanded || drag2 ? liftHeight + toastOffset : (total - 1 - index2) * 8 + toastOffset,
            bottom: "auto"
          };
        } else if (placement.includes("bottom")) {
          return {
            bottom: isRegionExpanded || drag2 ? liftHeight + toastOffset : (total - 1 - index2) * 8 + toastOffset,
            top: "auto"
          };
        }
        return {};
      })();
      return {
        animate: {
          opacity: isCloseToEnd ? 1 : 0,
          pointerEvents: isCloseToEnd ? "all" : "none",
          scaleX: isRegionExpanded || drag2 ? 1 : 1 - (total - 1 - index2) * 0.1,
          height: isRegionExpanded || drag2 ? initialHeight : frontHeight,
          y: 0,
          ...animateProps
        },
        drag: dragDirection,
        dragConstraints,
        exit: { opacity: 0 },
        initial: { opacity: 0, scale: 1, y: -40 * multiplier },
        transition: { duration: 0.3, ease: "easeOut" },
        variants: toastVariants,
        dragElastic,
        onDragEnd: (_24, info2) => {
          const { x: offsetX, y: offsetY } = info2.offset;
          setDrag(false);
          if (shouldCloseToast(offsetX, offsetY)) {
            const updatedHeights = heights;
            updatedHeights.splice(index2, 1);
            setHeights([...updatedHeights]);
            state.close(toast2.key);
            return;
          }
          setDragValue(0);
        },
        onDrag: (_24, info2) => {
          let updatedDragValue = 0;
          if (placement === "top-center") {
            updatedDragValue = -info2.offset.y;
          } else if (placement === "bottom-center") {
            updatedDragValue = info2.offset.y;
          } else if (placement.includes("right")) {
            updatedDragValue = info2.offset.x;
          } else if (placement.includes("left")) {
            updatedDragValue = -info2.offset.x;
          }
          if (updatedDragValue >= 0) {
            setDragValue(updatedDragValue);
          }
        },
        onDragStart: () => {
          setDrag(true);
        },
        "data-drag": dataAttr(drag2),
        "data-placement": placement,
        "data-drag-value": dragValue,
        className: slots.motionDiv({ class: classNames2 == null ? void 0 : classNames2.motionDiv }),
        ...props2,
        ...motionProps
      };
    },
    [
      total,
      index2,
      placement,
      isRegionExpanded,
      isToastExiting,
      liftHeight,
      multiplier,
      initialHeight,
      frontHeight,
      toastVariants,
      classNames2,
      drag2,
      dataAttr,
      setDrag,
      shouldCloseToast,
      slots,
      toastOffset,
      maxVisibleToasts
    ]
  );
  return {
    Component: Component2,
    title,
    description,
    icon,
    loadingComponent,
    domRef,
    severity,
    closeIcon,
    classNames: classNames2,
    color: variantProps2["color"],
    hideIcon,
    placement,
    state,
    toast: toast2,
    disableAnimation,
    isProgressBarVisible: !!timeout,
    total,
    index: index2,
    getWrapperProps,
    getToastProps,
    getTitleProps,
    getContentProps,
    getDescriptionProps,
    getCloseButtonProps,
    getIconProps,
    getMotionDivProps,
    getCloseIconProps,
    getLoadingComponentProps,
    getSpinnerComponentProps,
    progressBarRef,
    endContent,
    slots,
    isRegionExpanded,
    liftHeight,
    frontHeight,
    initialHeight,
    isLoading
  };
}
var domAnimation = () => __vitePreload(() => import("./src-UW24ZMRV-Dwva6otQ.js"), true ? __vite__mapDeps([]) : void 0).then((res) => res.default);
var Ripple = (props) => {
  const { ripples = [], motionProps, color: color2 = "currentColor", style: style2, onClear } = props;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: ripples.map((ripple) => {
    const duration2 = clamp$2(0.01 * ripple.size, 0.2, ripple.size > 100 ? 0.75 : 0.5);
    return /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { mode: "popLayout", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      m$3.span,
      {
        animate: { transform: "scale(2)", opacity: 0 },
        className: "heroui-ripple",
        exit: { opacity: 0 },
        initial: { transform: "scale(0)", opacity: 0.35 },
        style: {
          position: "absolute",
          backgroundColor: color2,
          borderRadius: "100%",
          transformOrigin: "center",
          pointerEvents: "none",
          overflow: "hidden",
          inset: 0,
          zIndex: 0,
          top: ripple.y,
          left: ripple.x,
          width: `${ripple.size}px`,
          height: `${ripple.size}px`,
          ...style2
        },
        transition: { duration: duration2 },
        onAnimationComplete: () => {
          onClear(ripple.key);
        },
        ...motionProps
      }
    ) }) }, ripple.key);
  }) });
};
Ripple.displayName = "HeroUI.Ripple";
var ripple_default = Ripple;
function useRipple(props = {}) {
  const [ripples, setRipples] = reactExports.useState([]);
  const onPress = reactExports.useCallback((event) => {
    const trigger = event.target;
    const size2 = Math.max(trigger.clientWidth, trigger.clientHeight);
    setRipples((prevRipples) => [
      ...prevRipples,
      {
        key: getUniqueID(prevRipples.length.toString()),
        size: size2,
        x: event.x - size2 / 2,
        y: event.y - size2 / 2
      }
    ]);
  }, []);
  const onClear = reactExports.useCallback((key) => {
    setRipples((prevState) => prevState.filter((ripple) => ripple.key !== key));
  }, []);
  return { ripples, onClear, onPress, ...props };
}
var $bdb11010cef70236$export$d41a04c74483c6ef = /* @__PURE__ */ new Map();
if (typeof FinalizationRegistry !== "undefined")
  new FinalizationRegistry((heldValue) => {
    $bdb11010cef70236$export$d41a04c74483c6ef.delete(heldValue);
  });
function $bdb11010cef70236$export$cd8c9cb68f842629(idA, idB) {
  if (idA === idB)
    return idA;
  let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function $ff5963eb1fccf552$export$e08e3b67e392101e(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks)
      if (typeof callback2 === "function")
        callback2(...args);
  };
}
function r$5(e2) {
  var t2, f2, n2 = "";
  if ("string" == typeof e2 || "number" == typeof e2)
    n2 += e2;
  else if ("object" == typeof e2)
    if (Array.isArray(e2)) {
      var o2 = e2.length;
      for (t2 = 0; t2 < o2; t2++)
        e2[t2] && (f2 = r$5(e2[t2])) && (n2 && (n2 += " "), n2 += f2);
    } else
      for (f2 in e2)
        e2[f2] && (n2 && (n2 += " "), n2 += f2);
  return n2;
}
function clsx$1() {
  for (var e2, t2, f2 = 0, n2 = "", o2 = arguments.length; f2 < o2; f2++)
    (e2 = arguments[f2]) && (t2 = r$5(e2)) && (n2 && (n2 += " "), n2 += t2);
  return n2;
}
var clsx_default = clsx$1;
function $3ef42575df84b30b$export$9d1611c77c2fe928(...args) {
  let result = {
    ...args[0]
  };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90)
        result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e(a2, b2);
      else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string")
        result[key] = clsx_default(a2, b2);
      else if (key === "id" && a2 && b2)
        result.id = $bdb11010cef70236$export$cd8c9cb68f842629(a2, b2);
      else
        result[key] = b2 !== void 0 ? b2 : a2;
    }
  }
  return result;
}
var $65484d02dcb7eb3e$var$DOMPropNames = /* @__PURE__ */ new Set([
  "id"
]);
var $65484d02dcb7eb3e$var$labelablePropNames = /* @__PURE__ */ new Set([
  "aria-label",
  "aria-labelledby",
  "aria-describedby",
  "aria-details"
]);
var $65484d02dcb7eb3e$var$linkPropNames = /* @__PURE__ */ new Set([
  "href",
  "hrefLang",
  "target",
  "rel",
  "download",
  "ping",
  "referrerPolicy"
]);
var $65484d02dcb7eb3e$var$propRe = /^(data-.*)$/;
function $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, opts2 = {}) {
  let { labelable, isLink, propNames } = opts2;
  let filteredProps = {};
  for (const prop in props)
    if (Object.prototype.hasOwnProperty.call(props, prop) && ($65484d02dcb7eb3e$var$DOMPropNames.has(prop) || labelable && $65484d02dcb7eb3e$var$labelablePropNames.has(prop) || isLink && $65484d02dcb7eb3e$var$linkPropNames.has(prop) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $65484d02dcb7eb3e$var$propRe.test(prop)))
      filteredProps[prop] = props[prop];
  return filteredProps;
}
function $f7dceffc5ad7768b$export$4e328f61c538687f(props = {}) {
  let { autoFocus = false, isTextInput, within } = props;
  let state = reactExports.useRef({
    isFocused: false,
    isFocusVisible: autoFocus || $507fabe10e71c6fb$export$b9b3dfddab17db27()
  });
  let [isFocused, setFocused] = reactExports.useState(false);
  let [isFocusVisibleState, setFocusVisible] = reactExports.useState(() => state.current.isFocused && state.current.isFocusVisible);
  let updateState3 = reactExports.useCallback(() => setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);
  let onFocusChange = reactExports.useCallback((isFocused2) => {
    state.current.isFocused = isFocused2;
    setFocused(isFocused2);
    updateState3();
  }, [
    updateState3
  ]);
  $507fabe10e71c6fb$export$ec71b4b83ac08ec3((isFocusVisible) => {
    state.current.isFocusVisible = isFocusVisible;
    updateState3();
  }, [], {
    isTextInput
  });
  let { focusProps } = $a1ea59d68270f0dd$export$f8168d8dd8fd66e6({
    isDisabled: within,
    onFocusChange
  });
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec({
    isDisabled: !within,
    onFocusWithinChange: onFocusChange
  });
  return {
    isFocused,
    isFocusVisible: isFocusVisibleState,
    focusProps: within ? focusWithinProps : focusProps
  };
}
function useAriaButton(props, ref) {
  let {
    elementType = "button",
    isDisabled,
    onPress,
    onPressStart,
    onPressEnd,
    onPressUp,
    onPressChange,
    // @ts-ignore - undocumented
    preventFocusOnPress,
    // @ts-ignore - undocumented
    allowFocusWhenDisabled,
    onClick,
    href,
    target,
    rel,
    type: type4 = "button",
    allowTextSelectionOnPress
  } = props;
  let additionalProps;
  if (elementType === "button") {
    additionalProps = {
      type: type4,
      disabled: isDisabled
    };
  } else {
    additionalProps = {
      role: "button",
      href: elementType === "a" && !isDisabled ? href : void 0,
      target: elementType === "a" ? target : void 0,
      type: elementType === "input" ? type4 : void 0,
      disabled: elementType === "input" ? isDisabled : void 0,
      "aria-disabled": !isDisabled || elementType === "input" ? void 0 : isDisabled,
      rel: elementType === "a" ? rel : void 0
    };
  }
  let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21({
    onClick,
    onPressStart,
    onPressEnd,
    onPressUp,
    onPressChange,
    onPress,
    isDisabled,
    preventFocusOnPress,
    allowTextSelectionOnPress,
    ref
  });
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c(props, ref);
  if (allowFocusWhenDisabled) {
    focusableProps.tabIndex = isDisabled ? -1 : focusableProps.tabIndex;
  }
  let buttonProps = $3ef42575df84b30b$export$9d1611c77c2fe928(
    focusableProps,
    pressProps,
    $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, { labelable: true })
  );
  return {
    isPressed,
    // Used to indicate press state for visual
    buttonProps: $3ef42575df84b30b$export$9d1611c77c2fe928(additionalProps, buttonProps, {
      "aria-haspopup": props["aria-haspopup"],
      "aria-expanded": props["aria-expanded"],
      "aria-controls": props["aria-controls"],
      "aria-pressed": props["aria-pressed"],
      "aria-current": props["aria-current"]
    })
  };
}
var [ButtonGroupProvider, useButtonGroupContext] = createContext2({
  name: "ButtonGroupContext",
  strict: false
});
function useButton(props) {
  var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i;
  const groupContext = useButtonGroupContext();
  const globalContext = useProviderContext();
  const isInGroup = !!groupContext;
  const {
    ref,
    as: as2,
    children,
    startContent: startContentProp,
    endContent: endContentProp,
    autoFocus,
    className,
    spinner: spinner2,
    isLoading = false,
    disableRipple: disableRippleProp = false,
    fullWidth = (_a2 = groupContext == null ? void 0 : groupContext.fullWidth) != null ? _a2 : false,
    radius = groupContext == null ? void 0 : groupContext.radius,
    size: size2 = (_b2 = groupContext == null ? void 0 : groupContext.size) != null ? _b2 : "md",
    color: color2 = (_c2 = groupContext == null ? void 0 : groupContext.color) != null ? _c2 : "default",
    variant = (_d = groupContext == null ? void 0 : groupContext.variant) != null ? _d : "solid",
    disableAnimation = (_f = (_e = groupContext == null ? void 0 : groupContext.disableAnimation) != null ? _e : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _f : false,
    isDisabled: isDisabledProp = (_g = groupContext == null ? void 0 : groupContext.isDisabled) != null ? _g : false,
    isIconOnly = (_h = groupContext == null ? void 0 : groupContext.isIconOnly) != null ? _h : false,
    spinnerPlacement = "start",
    onPress,
    onClick,
    ...otherProps
  } = props;
  const Component2 = as2 || "button";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const disableRipple = (_i = disableRippleProp || (globalContext == null ? void 0 : globalContext.disableRipple)) != null ? _i : disableAnimation;
  const { isFocusVisible, isFocused, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f({
    autoFocus
  });
  const isDisabled = isDisabledProp || isLoading;
  const styles2 = reactExports.useMemo(
    () => button({
      size: size2,
      color: color2,
      variant,
      radius,
      fullWidth,
      isDisabled,
      isInGroup,
      disableAnimation,
      isIconOnly,
      className
    }),
    [
      size2,
      color2,
      variant,
      radius,
      fullWidth,
      isDisabled,
      isInGroup,
      isIconOnly,
      disableAnimation,
      className
    ]
  );
  const { onPress: onRipplePressHandler, onClear: onClearRipple, ripples } = useRipple();
  const handlePress = reactExports.useCallback(
    (e2) => {
      if (disableRipple || isDisabled || disableAnimation)
        return;
      domRef.current && onRipplePressHandler(e2);
    },
    [disableRipple, isDisabled, disableAnimation, domRef, onRipplePressHandler]
  );
  const { buttonProps: ariaButtonProps, isPressed } = useAriaButton(
    {
      elementType: as2,
      isDisabled,
      onPress: chain(onPress, handlePress),
      onClick,
      ...otherProps
    },
    domRef
  );
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456({ isDisabled });
  const getButtonProps = reactExports.useCallback(
    (props2 = {}) => ({
      "data-disabled": dataAttr(isDisabled),
      "data-focus": dataAttr(isFocused),
      "data-pressed": dataAttr(isPressed),
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-hover": dataAttr(isHovered),
      "data-loading": dataAttr(isLoading),
      ...mergeProps$3(
        ariaButtonProps,
        focusProps,
        hoverProps,
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        }),
        filterDOMProps(props2)
      ),
      className: styles2
    }),
    [
      isLoading,
      isDisabled,
      isFocused,
      isPressed,
      shouldFilterDOMProps,
      isFocusVisible,
      isHovered,
      ariaButtonProps,
      focusProps,
      hoverProps,
      otherProps,
      styles2
    ]
  );
  const getIconClone = (icon) => reactExports.isValidElement(icon) ? reactExports.cloneElement(icon, {
    // @ts-ignore
    "aria-hidden": true,
    focusable: false
  }) : null;
  const startContent = getIconClone(startContentProp);
  const endContent = getIconClone(endContentProp);
  const spinnerSize = reactExports.useMemo(() => {
    const buttonSpinnerSizeMap = {
      sm: "sm",
      md: "sm",
      lg: "md"
    };
    return buttonSpinnerSizeMap[size2];
  }, [size2]);
  const getRippleProps = reactExports.useCallback(
    () => ({ ripples, onClear: onClearRipple }),
    [ripples, onClearRipple]
  );
  return {
    Component: Component2,
    children,
    domRef,
    spinner: spinner2,
    styles: styles2,
    startContent,
    endContent,
    isLoading,
    spinnerPlacement,
    spinnerSize,
    disableRipple,
    getButtonProps,
    getRippleProps,
    isIconOnly
  };
}
var Button$1 = forwardRef((props, ref) => {
  const {
    Component: Component2,
    domRef,
    children,
    spinnerSize,
    spinner: spinner2 = /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { color: "current", size: spinnerSize }),
    spinnerPlacement,
    startContent,
    endContent,
    isLoading,
    disableRipple,
    getButtonProps,
    getRippleProps,
    isIconOnly
  } = useButton({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ref: domRef, ...getButtonProps(), children: [
    startContent,
    isLoading && spinnerPlacement === "start" && spinner2,
    isLoading && isIconOnly ? null : children,
    isLoading && spinnerPlacement === "end" && spinner2,
    endContent,
    !disableRipple && /* @__PURE__ */ jsxRuntimeExports.jsx(ripple_default, { ...getRippleProps() })
  ] });
});
Button$1.displayName = "HeroUI.Button";
var button_default = Button$1;
var iconMap = {
  default: InfoFilledIcon,
  primary: InfoFilledIcon,
  secondary: InfoFilledIcon,
  success: SuccessIcon,
  warning: WarningIcon,
  danger: DangerIcon
};
var Toast = forwardRef((props, ref) => {
  const {
    severity,
    Component: Component2,
    icon,
    loadingComponent,
    domRef,
    endContent,
    color: color2,
    hideIcon,
    closeIcon,
    disableAnimation,
    progressBarRef,
    classNames: classNames2,
    slots,
    getWrapperProps,
    isProgressBarVisible,
    getToastProps,
    getContentProps,
    getTitleProps,
    getDescriptionProps,
    getCloseButtonProps,
    getIconProps,
    getMotionDivProps,
    getCloseIconProps,
    getLoadingComponentProps,
    getSpinnerComponentProps,
    isLoading
  } = useToast({
    ...props,
    ref
  });
  const customIcon = typeof icon === "function" ? icon(getIconProps()) : reactExports.isValidElement(icon) && reactExports.cloneElement(icon, getIconProps());
  const IconComponent = severity ? iconMap[severity] : iconMap[color2] || iconMap.default;
  const customLoadingComponent = loadingComponent && reactExports.isValidElement(loadingComponent) ? reactExports.cloneElement(loadingComponent, getLoadingComponentProps()) : null;
  const loadingIconComponent = isLoading ? customLoadingComponent || /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { ...getSpinnerComponentProps() }) : null;
  const customCloseIcon = typeof closeIcon === "function" ? closeIcon({}) : reactExports.isValidElement(closeIcon) && reactExports.cloneElement(closeIcon, {});
  const toastContent = /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ref: domRef, ...getToastProps(), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getContentProps(), children: [
      hideIcon && !isLoading ? null : loadingIconComponent || customIcon || /* @__PURE__ */ jsxRuntimeExports.jsx(IconComponent, { ...getIconProps() }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getWrapperProps(), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getTitleProps(), children: props.toast.content.title }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getDescriptionProps(), children: props.toast.content.description })
      ] })
    ] }),
    isProgressBarVisible && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: slots.progressTrack({ class: classNames2 == null ? void 0 : classNames2.progressTrack }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        ref: progressBarRef,
        className: slots.progressIndicator({ class: classNames2 == null ? void 0 : classNames2.progressIndicator })
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(button_default, { isIconOnly: true, ...getCloseButtonProps(), children: customCloseIcon || /* @__PURE__ */ jsxRuntimeExports.jsx(CloseIcon, { ...getCloseIconProps() }) }),
    endContent
  ] });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: disableAnimation ? toastContent : /* @__PURE__ */ jsxRuntimeExports.jsx(m$3.div, { ...getMotionDivProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    m$3.div,
    {
      animate: { opacity: 1 },
      exit: { opacity: 0 },
      initial: { opacity: 0 },
      transition: { duration: 0.25, ease: "easeOut", delay: 0.1 },
      children: toastContent
    },
    "inner-div"
  ) }) });
});
Toast.displayName = "HeroUI.Toast";
var toast_default = Toast;
function ToastRegion({
  toastQueue,
  placement,
  disableAnimation,
  maxVisibleToasts,
  toastOffset,
  toastProps = {},
  className,
  classNames: classNames2,
  ...props
}) {
  var _a2, _b2;
  const ref = reactExports.useRef(null);
  const { regionProps } = $6cc546b19ee7130a$export$b8cbbb20a51697de(props, toastQueue, ref);
  const { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456({
    isDisabled: false
  });
  const [isTouched, setIsTouched] = reactExports.useState(false);
  const slots = reactExports.useMemo(
    () => toastRegion({
      disableAnimation
    }),
    [disableAnimation]
  );
  const baseStyles = clsx$4(classNames2 == null ? void 0 : classNames2.base, className);
  reactExports.useEffect(() => {
    function handleTouchOutside(event) {
      if (ref.current && !ref.current.contains(event.target)) {
        setIsTouched(false);
      }
    }
    document.addEventListener("touchstart", handleTouchOutside);
    return () => {
      document.removeEventListener("touchstart", handleTouchOutside);
    };
  }, []);
  const [heights, setHeights] = reactExports.useState([]);
  const total = (_b2 = (_a2 = toastQueue.visibleToasts) == null ? void 0 : _a2.length) != null ? _b2 : 0;
  const handleTouchStart = reactExports.useCallback(() => {
    setIsTouched(true);
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "div",
    {
      ...mergeProps$3(regionProps, hoverProps),
      ref,
      className: slots.base({ class: baseStyles }),
      "data-placement": placement,
      onTouchStart: handleTouchStart,
      children: [...toastQueue.visibleToasts].reverse().map((toast2, index2) => {
        if (disableAnimation && total - index2 > maxVisibleToasts) {
          return null;
        }
        if (disableAnimation || total - index2 <= 4 || isHovered && total - index2 <= maxVisibleToasts + 1) {
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            toast_default,
            {
              state: toastQueue,
              toast: toast2,
              ...mergeProps$3(toastProps, toast2.content),
              disableAnimation,
              heights,
              index: index2,
              isRegionExpanded: isHovered || isTouched,
              maxVisibleToasts,
              placement,
              setHeights,
              toastOffset,
              total
            },
            toast2.key
          );
        }
        return null;
      })
    }
  );
}
function $77b352cf12efcf73$export$84726ef35ca2129a(queue) {
  let subscribe2 = reactExports.useCallback((fn) => queue.subscribe(fn), [
    queue
  ]);
  let getSnapshot2 = reactExports.useCallback(() => queue.visibleToasts, [
    queue
  ]);
  let visibleToasts = shimExports.useSyncExternalStore(subscribe2, getSnapshot2, getSnapshot2);
  return {
    visibleToasts,
    add: (content2, options) => queue.add(content2, options),
    close: (key) => queue.close(key),
    pauseAll: () => queue.pauseAll(),
    resumeAll: () => queue.resumeAll()
  };
}
class $77b352cf12efcf73$export$f1f8569633bbbec4 {
  runWithWrapUpdate(fn, action) {
    if (this.wrapUpdate)
      this.wrapUpdate(fn, action);
    else
      fn();
  }
  /** Subscribes to updates to the visible toasts. */
  subscribe(fn) {
    this.subscriptions.add(fn);
    return () => this.subscriptions.delete(fn);
  }
  /** Adds a new toast to the queue. */
  add(content2, options = {}) {
    let toastKey = "_" + Math.random().toString(36).slice(2);
    let toast2 = {
      ...options,
      content: content2,
      key: toastKey,
      timer: options.timeout ? new $77b352cf12efcf73$var$Timer(() => this.close(toastKey), options.timeout) : void 0
    };
    this.queue.unshift(toast2);
    this.updateVisibleToasts("add");
    return toastKey;
  }
  /**
  * Closes a toast.
  */
  close(key) {
    let index2 = this.queue.findIndex((t2) => t2.key === key);
    if (index2 >= 0) {
      var _this_queue_index_onClose, _this_queue_index;
      (_this_queue_index_onClose = (_this_queue_index = this.queue[index2]).onClose) === null || _this_queue_index_onClose === void 0 ? void 0 : _this_queue_index_onClose.call(_this_queue_index);
      this.queue.splice(index2, 1);
    }
    this.updateVisibleToasts("remove");
  }
  updateVisibleToasts(action) {
    this.visibleToasts = this.queue.slice(0, this.maxVisibleToasts);
    this.runWithWrapUpdate(() => {
      for (let fn of this.subscriptions)
        fn();
    }, action);
  }
  /** Pauses the timers for all visible toasts. */
  pauseAll() {
    for (let toast2 of this.visibleToasts)
      if (toast2.timer)
        toast2.timer.pause();
  }
  /** Resumes the timers for all visible toasts. */
  resumeAll() {
    for (let toast2 of this.visibleToasts)
      if (toast2.timer)
        toast2.timer.resume();
  }
  clear() {
    this.queue = [];
    this.updateVisibleToasts("clear");
  }
  constructor(options) {
    this.queue = [];
    this.subscriptions = /* @__PURE__ */ new Set();
    this.visibleToasts = [];
    var _options_maxVisibleToasts;
    this.maxVisibleToasts = (_options_maxVisibleToasts = options === null || options === void 0 ? void 0 : options.maxVisibleToasts) !== null && _options_maxVisibleToasts !== void 0 ? _options_maxVisibleToasts : Infinity;
    this.wrapUpdate = options === null || options === void 0 ? void 0 : options.wrapUpdate;
  }
}
class $77b352cf12efcf73$var$Timer {
  reset(delay2) {
    this.remaining = delay2;
    this.resume();
  }
  pause() {
    if (this.timerId == null)
      return;
    clearTimeout(this.timerId);
    this.timerId = null;
    this.remaining -= Date.now() - this.startTime;
  }
  resume() {
    if (this.remaining <= 0)
      return;
    this.startTime = Date.now();
    this.timerId = setTimeout(() => {
      this.timerId = null;
      this.remaining = 0;
      this.callback();
    }, this.remaining);
  }
  constructor(callback2, delay2) {
    this.startTime = null;
    this.remaining = delay2;
    this.callback = callback2;
  }
}
var loadFeatures = () => __vitePreload(() => import("./index-D7z6Vw4U.js"), true ? __vite__mapDeps([]) : void 0).then((res) => res.domMax);
var globalToastQueue = null;
var getToastQueue = () => {
  if (!globalToastQueue) {
    globalToastQueue = new $77b352cf12efcf73$export$f1f8569633bbbec4({
      maxVisibleToasts: Infinity
    });
  }
  return globalToastQueue;
};
var ToastProvider = ({
  placement = "bottom-right",
  disableAnimation: disableAnimationProp = false,
  maxVisibleToasts = 3,
  toastOffset = 0,
  toastProps = {},
  regionProps
}) => {
  var _a2;
  const toastQueue = $77b352cf12efcf73$export$84726ef35ca2129a(getToastQueue());
  const globalContext = useProviderContext();
  const disableAnimation = (_a2 = disableAnimationProp != null ? disableAnimationProp : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _a2 : false;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: loadFeatures, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { children: toastQueue.visibleToasts.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
    ToastRegion,
    {
      disableAnimation,
      maxVisibleToasts,
      placement,
      toastOffset,
      toastProps,
      toastQueue,
      ...regionProps
    }
  ) : null }) });
};
var addToast = ({ ...props }) => {
  if (!globalToastQueue) {
    return null;
  }
  return globalToastQueue.add(props);
};
function injectScript(projectId) {
  try {
    (function(c2, l2, a2, r2, i2, t2, y2) {
      if (l2.getElementById("clarity-script")) {
        return;
      }
      c2[a2] = c2[a2] || function() {
        (c2[a2].q = c2[a2].q || []).push(arguments);
      };
      t2 = l2.createElement(r2);
      t2.async = 1;
      t2.src = "https://www.clarity.ms/tag/" + i2 + "?ref=npm";
      t2.id = "clarity-script";
      y2 = l2.getElementsByTagName(r2)[0];
      y2.parentNode.insertBefore(t2, y2);
    })(window, document, "clarity", "script", projectId);
    return;
  } catch (error2) {
    return;
  }
}
const Clarity = {
  init(projectId) {
    injectScript(projectId);
  },
  setTag(key, value2) {
    window.clarity("set", key, value2);
  },
  identify(customerId, customSessionId, customPageId, friendlyName) {
    window.clarity("identify", customerId, customSessionId, customPageId, friendlyName);
  },
  consent(consent = true) {
    window.clarity("consent", consent);
  },
  upgrade(reason) {
    window.clarity("upgrade", reason);
  },
  event(eventName) {
    window.clarity("event", eventName);
  }
};
var classnames = { exports: {} };
/*!
	Copyright (c) 2018 Jed Watson.
	Licensed under the MIT License (MIT), see
	http://jedwatson.github.io/classnames
*/
(function(module2) {
  (function() {
    var hasOwn2 = {}.hasOwnProperty;
    function classNames2() {
      var classes = "";
      for (var i2 = 0; i2 < arguments.length; i2++) {
        var arg = arguments[i2];
        if (arg) {
          classes = appendClass(classes, parseValue2(arg));
        }
      }
      return classes;
    }
    function parseValue2(arg) {
      if (typeof arg === "string" || typeof arg === "number") {
        return arg;
      }
      if (typeof arg !== "object") {
        return "";
      }
      if (Array.isArray(arg)) {
        return classNames2.apply(null, arg);
      }
      if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
        return arg.toString();
      }
      var classes = "";
      for (var key in arg) {
        if (hasOwn2.call(arg, key) && arg[key]) {
          classes = appendClass(classes, key);
        }
      }
      return classes;
    }
    function appendClass(value2, newClass) {
      if (!newClass) {
        return value2;
      }
      if (value2) {
        return value2 + " " + newClass;
      }
      return value2 + newClass;
    }
    if (module2.exports) {
      classNames2.default = classNames2;
      module2.exports = classNames2;
    } else {
      window.classNames = classNames2;
    }
  })();
})(classnames);
var classnamesExports = classnames.exports;
const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
function _typeof$1(o2) {
  "@babel/helpers - typeof";
  return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) {
    return typeof o3;
  } : function(o3) {
    return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3;
  }, _typeof$1(o2);
}
var REACT_ELEMENT_TYPE_18 = Symbol.for("react.element");
var REACT_ELEMENT_TYPE_19 = Symbol.for("react.transitional.element");
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
function isFragment$1(object4) {
  return (
    // Base object type
    object4 && _typeof$1(object4) === "object" && // React Element type
    (object4.$$typeof === REACT_ELEMENT_TYPE_18 || object4.$$typeof === REACT_ELEMENT_TYPE_19) && // React Fragment type
    object4.type === REACT_FRAGMENT_TYPE
  );
}
function toArray$4(children) {
  var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
  var ret = [];
  React$5.Children.forEach(children, function(child) {
    if ((child === void 0 || child === null) && !option.keepEmpty) {
      return;
    }
    if (Array.isArray(child)) {
      ret = ret.concat(toArray$4(child));
    } else if (isFragment$1(child) && child.props) {
      ret = ret.concat(toArray$4(child.props.children, option));
    } else {
      ret.push(child);
    }
  });
  return ret;
}
var warned = {};
var preMessage = function preMessage2(fn) {
};
function warning$2(valid2, message) {
}
function note(valid2, message) {
}
function resetWarned() {
  warned = {};
}
function call(method4, valid2, message) {
  if (!valid2 && !warned[message]) {
    method4(false, message);
    warned[message] = true;
  }
}
function warningOnce(valid2, message) {
  call(warning$2, valid2, message);
}
function noteOnce(valid2, message) {
  call(note, valid2, message);
}
warningOnce.preMessage = preMessage;
warningOnce.resetWarned = resetWarned;
warningOnce.noteOnce = noteOnce;
function toPrimitive(t2, r2) {
  if ("object" != _typeof$1(t2) || !t2)
    return t2;
  var e2 = t2[Symbol.toPrimitive];
  if (void 0 !== e2) {
    var i2 = e2.call(t2, r2);
    if ("object" != _typeof$1(i2))
      return i2;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r2 ? String : Number)(t2);
}
function toPropertyKey(t2) {
  var i2 = toPrimitive(t2, "string");
  return "symbol" == _typeof$1(i2) ? i2 : i2 + "";
}
function _defineProperty$3(e2, r2, t2) {
  return (r2 = toPropertyKey(r2)) in e2 ? Object.defineProperty(e2, r2, {
    value: t2,
    enumerable: true,
    configurable: true,
    writable: true
  }) : e2[r2] = t2, e2;
}
function ownKeys$f(e2, r2) {
  var t2 = Object.keys(e2);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e2);
    r2 && (o2 = o2.filter(function(r3) {
      return Object.getOwnPropertyDescriptor(e2, r3).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread2(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys$f(Object(t2), true).forEach(function(r3) {
      _defineProperty$3(e2, r3, t2[r3]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$f(Object(t2)).forEach(function(r3) {
      Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3));
    });
  }
  return e2;
}
function isDOM(node2) {
  return node2 instanceof HTMLElement || node2 instanceof SVGElement;
}
function getDOM(node2) {
  if (node2 && _typeof$1(node2) === "object" && isDOM(node2.nativeElement)) {
    return node2.nativeElement;
  }
  if (isDOM(node2)) {
    return node2;
  }
  return null;
}
function findDOMNode(node2) {
  var domNode = getDOM(node2);
  if (domNode) {
    return domNode;
  }
  if (node2 instanceof React$5.Component) {
    var _ReactDOM$findDOMNode;
    return (_ReactDOM$findDOMNode = ReactDOM.findDOMNode) === null || _ReactDOM$findDOMNode === void 0 ? void 0 : _ReactDOM$findDOMNode.call(ReactDOM, node2);
  }
  return null;
}
var reactIs$2 = { exports: {} };
var 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$2 = Symbol.for("react.element"), c$5 = Symbol.for("react.portal"), d$3 = Symbol.for("react.fragment"), e$3 = Symbol.for("react.strict_mode"), f$4 = Symbol.for("react.profiler"), g$3 = Symbol.for("react.provider"), h$3 = Symbol.for("react.context"), k$4 = Symbol.for("react.server_context"), l$6 = Symbol.for("react.forward_ref"), m$2 = Symbol.for("react.suspense"), n$5 = Symbol.for("react.suspense_list"), p$5 = Symbol.for("react.memo"), q$2 = Symbol.for("react.lazy"), t$6 = Symbol.for("react.offscreen"), u$5;
u$5 = Symbol.for("react.module.reference");
function v$3(a2) {
  if ("object" === typeof a2 && null !== a2) {
    var r2 = a2.$$typeof;
    switch (r2) {
      case b$2:
        switch (a2 = a2.type, a2) {
          case d$3:
          case f$4:
          case e$3:
          case m$2:
          case n$5:
            return a2;
          default:
            switch (a2 = a2 && a2.$$typeof, a2) {
              case k$4:
              case h$3:
              case l$6:
              case q$2:
              case p$5:
              case g$3:
                return a2;
              default:
                return r2;
            }
        }
      case c$5:
        return r2;
    }
  }
}
reactIs_production_min$1.ContextConsumer = h$3;
reactIs_production_min$1.ContextProvider = g$3;
reactIs_production_min$1.Element = b$2;
reactIs_production_min$1.ForwardRef = l$6;
reactIs_production_min$1.Fragment = d$3;
reactIs_production_min$1.Lazy = q$2;
reactIs_production_min$1.Memo = p$5;
reactIs_production_min$1.Portal = c$5;
reactIs_production_min$1.Profiler = f$4;
reactIs_production_min$1.StrictMode = e$3;
reactIs_production_min$1.Suspense = m$2;
reactIs_production_min$1.SuspenseList = n$5;
reactIs_production_min$1.isAsyncMode = function() {
  return false;
};
reactIs_production_min$1.isConcurrentMode = function() {
  return false;
};
reactIs_production_min$1.isContextConsumer = function(a2) {
  return v$3(a2) === h$3;
};
reactIs_production_min$1.isContextProvider = function(a2) {
  return v$3(a2) === g$3;
};
reactIs_production_min$1.isElement = function(a2) {
  return "object" === typeof a2 && null !== a2 && a2.$$typeof === b$2;
};
reactIs_production_min$1.isForwardRef = function(a2) {
  return v$3(a2) === l$6;
};
reactIs_production_min$1.isFragment = function(a2) {
  return v$3(a2) === d$3;
};
reactIs_production_min$1.isLazy = function(a2) {
  return v$3(a2) === q$2;
};
reactIs_production_min$1.isMemo = function(a2) {
  return v$3(a2) === p$5;
};
reactIs_production_min$1.isPortal = function(a2) {
  return v$3(a2) === c$5;
};
reactIs_production_min$1.isProfiler = function(a2) {
  return v$3(a2) === f$4;
};
reactIs_production_min$1.isStrictMode = function(a2) {
  return v$3(a2) === e$3;
};
reactIs_production_min$1.isSuspense = function(a2) {
  return v$3(a2) === m$2;
};
reactIs_production_min$1.isSuspenseList = function(a2) {
  return v$3(a2) === n$5;
};
reactIs_production_min$1.isValidElementType = function(a2) {
  return "string" === typeof a2 || "function" === typeof a2 || a2 === d$3 || a2 === f$4 || a2 === e$3 || a2 === m$2 || a2 === n$5 || a2 === t$6 || "object" === typeof a2 && null !== a2 && (a2.$$typeof === q$2 || a2.$$typeof === p$5 || a2.$$typeof === g$3 || a2.$$typeof === h$3 || a2.$$typeof === l$6 || a2.$$typeof === u$5 || void 0 !== a2.getModuleId) ? true : false;
};
reactIs_production_min$1.typeOf = v$3;
{
  reactIs$2.exports = reactIs_production_min$1;
}
var reactIsExports$1 = reactIs$2.exports;
function useMemo(getValue2, condition, shouldUpdate) {
  var cacheRef = reactExports.useRef({});
  if (!("value" in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {
    cacheRef.current.value = getValue2();
    cacheRef.current.condition = condition;
  }
  return cacheRef.current.value;
}
var ReactMajorVersion = Number(reactExports.version.split(".")[0]);
var fillRef = function fillRef2(ref, node2) {
  if (typeof ref === "function") {
    ref(node2);
  } else if (_typeof$1(ref) === "object" && ref && "current" in ref) {
    ref.current = node2;
  }
};
var composeRef = function composeRef2() {
  for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
    refs[_key] = arguments[_key];
  }
  var refList = refs.filter(Boolean);
  if (refList.length <= 1) {
    return refList[0];
  }
  return function(node2) {
    refs.forEach(function(ref) {
      fillRef(ref, node2);
    });
  };
};
var useComposeRef = function useComposeRef2() {
  for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
    refs[_key2] = arguments[_key2];
  }
  return useMemo(function() {
    return composeRef.apply(void 0, refs);
  }, refs, function(prev2, next2) {
    return prev2.length !== next2.length || prev2.every(function(ref, i2) {
      return ref !== next2[i2];
    });
  });
};
var supportRef = function supportRef2(nodeOrComponent) {
  var _type$prototype, _nodeOrComponent$prot;
  if (!nodeOrComponent) {
    return false;
  }
  if (isReactElement(nodeOrComponent) && ReactMajorVersion >= 19) {
    return true;
  }
  var type4 = reactIsExports$1.isMemo(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type;
  if (typeof type4 === "function" && !((_type$prototype = type4.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render) && type4.$$typeof !== reactIsExports$1.ForwardRef) {
    return false;
  }
  if (typeof nodeOrComponent === "function" && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render) && nodeOrComponent.$$typeof !== reactIsExports$1.ForwardRef) {
    return false;
  }
  return true;
};
function isReactElement(node2) {
  return /* @__PURE__ */ reactExports.isValidElement(node2) && !isFragment$1(node2);
}
var getNodeRef = function getNodeRef2(node2) {
  if (node2 && isReactElement(node2)) {
    var ele = node2;
    return ele.props.propertyIsEnumerable("ref") ? ele.props.ref : ele.ref;
  }
  return null;
};
var CollectionContext = /* @__PURE__ */ reactExports.createContext(null);
function Collection$2(_ref) {
  var children = _ref.children, onBatchResize = _ref.onBatchResize;
  var resizeIdRef = reactExports.useRef(0);
  var resizeInfosRef = reactExports.useRef([]);
  var onCollectionResize = reactExports.useContext(CollectionContext);
  var onResize4 = reactExports.useCallback(function(size2, element2, data) {
    resizeIdRef.current += 1;
    var currentId = resizeIdRef.current;
    resizeInfosRef.current.push({
      size: size2,
      element: element2,
      data
    });
    Promise.resolve().then(function() {
      if (currentId === resizeIdRef.current) {
        onBatchResize === null || onBatchResize === void 0 || onBatchResize(resizeInfosRef.current);
        resizeInfosRef.current = [];
      }
    });
    onCollectionResize === null || onCollectionResize === void 0 || onCollectionResize(size2, element2, data);
  }, [onBatchResize, onCollectionResize]);
  return /* @__PURE__ */ reactExports.createElement(CollectionContext.Provider, {
    value: onResize4
  }, children);
}
var MapShim = function() {
  if (typeof Map !== "undefined") {
    return Map;
  }
  function getIndex(arr, key) {
    var result = -1;
    arr.some(function(entry, index2) {
      if (entry[0] === key) {
        result = index2;
        return true;
      }
      return false;
    });
    return result;
  }
  return (
    /** @class */
    function() {
      function class_1() {
        this.__entries__ = [];
      }
      Object.defineProperty(class_1.prototype, "size", {
        /**
         * @returns {boolean}
         */
        get: function() {
          return this.__entries__.length;
        },
        enumerable: true,
        configurable: true
      });
      class_1.prototype.get = function(key) {
        var index2 = getIndex(this.__entries__, key);
        var entry = this.__entries__[index2];
        return entry && entry[1];
      };
      class_1.prototype.set = function(key, value2) {
        var index2 = getIndex(this.__entries__, key);
        if (~index2) {
          this.__entries__[index2][1] = value2;
        } else {
          this.__entries__.push([key, value2]);
        }
      };
      class_1.prototype.delete = function(key) {
        var entries = this.__entries__;
        var index2 = getIndex(entries, key);
        if (~index2) {
          entries.splice(index2, 1);
        }
      };
      class_1.prototype.has = function(key) {
        return !!~getIndex(this.__entries__, key);
      };
      class_1.prototype.clear = function() {
        this.__entries__.splice(0);
      };
      class_1.prototype.forEach = function(callback2, ctx) {
        if (ctx === void 0) {
          ctx = null;
        }
        for (var _i = 0, _a2 = this.__entries__; _i < _a2.length; _i++) {
          var entry = _a2[_i];
          callback2.call(ctx, entry[1], entry[0]);
        }
      };
      return class_1;
    }()
  );
}();
var isBrowser$1 = typeof window !== "undefined" && typeof document !== "undefined" && window.document === document;
var global$1 = function() {
  if (typeof global !== "undefined" && global.Math === Math) {
    return global;
  }
  if (typeof self !== "undefined" && self.Math === Math) {
    return self;
  }
  if (typeof window !== "undefined" && window.Math === Math) {
    return window;
  }
  return Function("return this")();
}();
var requestAnimationFrame$1 = function() {
  if (typeof requestAnimationFrame === "function") {
    return requestAnimationFrame.bind(global$1);
  }
  return function(callback2) {
    return setTimeout(function() {
      return callback2(Date.now());
    }, 1e3 / 60);
  };
}();
var trailingTimeout = 2;
function throttle$3(callback2, delay2) {
  var leadingCall = false, trailingCall = false, lastCallTime = 0;
  function resolvePending() {
    if (leadingCall) {
      leadingCall = false;
      callback2();
    }
    if (trailingCall) {
      proxy();
    }
  }
  function timeoutCallback() {
    requestAnimationFrame$1(resolvePending);
  }
  function proxy() {
    var timeStamp = Date.now();
    if (leadingCall) {
      if (timeStamp - lastCallTime < trailingTimeout) {
        return;
      }
      trailingCall = true;
    } else {
      leadingCall = true;
      trailingCall = false;
      setTimeout(timeoutCallback, delay2);
    }
    lastCallTime = timeStamp;
  }
  return proxy;
}
var REFRESH_DELAY = 20;
var transitionKeys = ["top", "right", "bottom", "left", "width", "height", "size", "weight"];
var mutationObserverSupported = typeof MutationObserver !== "undefined";
var ResizeObserverController = (
  /** @class */
  function() {
    function ResizeObserverController2() {
      this.connected_ = false;
      this.mutationEventsAdded_ = false;
      this.mutationsObserver_ = null;
      this.observers_ = [];
      this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
      this.refresh = throttle$3(this.refresh.bind(this), REFRESH_DELAY);
    }
    ResizeObserverController2.prototype.addObserver = function(observer) {
      if (!~this.observers_.indexOf(observer)) {
        this.observers_.push(observer);
      }
      if (!this.connected_) {
        this.connect_();
      }
    };
    ResizeObserverController2.prototype.removeObserver = function(observer) {
      var observers2 = this.observers_;
      var index2 = observers2.indexOf(observer);
      if (~index2) {
        observers2.splice(index2, 1);
      }
      if (!observers2.length && this.connected_) {
        this.disconnect_();
      }
    };
    ResizeObserverController2.prototype.refresh = function() {
      var changesDetected = this.updateObservers_();
      if (changesDetected) {
        this.refresh();
      }
    };
    ResizeObserverController2.prototype.updateObservers_ = function() {
      var activeObservers = this.observers_.filter(function(observer) {
        return observer.gatherActive(), observer.hasActive();
      });
      activeObservers.forEach(function(observer) {
        return observer.broadcastActive();
      });
      return activeObservers.length > 0;
    };
    ResizeObserverController2.prototype.connect_ = function() {
      if (!isBrowser$1 || this.connected_) {
        return;
      }
      document.addEventListener("transitionend", this.onTransitionEnd_);
      window.addEventListener("resize", this.refresh);
      if (mutationObserverSupported) {
        this.mutationsObserver_ = new MutationObserver(this.refresh);
        this.mutationsObserver_.observe(document, {
          attributes: true,
          childList: true,
          characterData: true,
          subtree: true
        });
      } else {
        document.addEventListener("DOMSubtreeModified", this.refresh);
        this.mutationEventsAdded_ = true;
      }
      this.connected_ = true;
    };
    ResizeObserverController2.prototype.disconnect_ = function() {
      if (!isBrowser$1 || !this.connected_) {
        return;
      }
      document.removeEventListener("transitionend", this.onTransitionEnd_);
      window.removeEventListener("resize", this.refresh);
      if (this.mutationsObserver_) {
        this.mutationsObserver_.disconnect();
      }
      if (this.mutationEventsAdded_) {
        document.removeEventListener("DOMSubtreeModified", this.refresh);
      }
      this.mutationsObserver_ = null;
      this.mutationEventsAdded_ = false;
      this.connected_ = false;
    };
    ResizeObserverController2.prototype.onTransitionEnd_ = function(_a2) {
      var _b2 = _a2.propertyName, propertyName = _b2 === void 0 ? "" : _b2;
      var isReflowProperty = transitionKeys.some(function(key) {
        return !!~propertyName.indexOf(key);
      });
      if (isReflowProperty) {
        this.refresh();
      }
    };
    ResizeObserverController2.getInstance = function() {
      if (!this.instance_) {
        this.instance_ = new ResizeObserverController2();
      }
      return this.instance_;
    };
    ResizeObserverController2.instance_ = null;
    return ResizeObserverController2;
  }()
);
var defineConfigurable = function(target, props) {
  for (var _i = 0, _a2 = Object.keys(props); _i < _a2.length; _i++) {
    var key = _a2[_i];
    Object.defineProperty(target, key, {
      value: props[key],
      enumerable: false,
      writable: false,
      configurable: true
    });
  }
  return target;
};
var getWindowOf = function(target) {
  var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;
  return ownerGlobal || global$1;
};
var emptyRect = createRectInit(0, 0, 0, 0);
function toFloat(value2) {
  return parseFloat(value2) || 0;
}
function getBordersSize(styles2) {
  var positions2 = [];
  for (var _i = 1; _i < arguments.length; _i++) {
    positions2[_i - 1] = arguments[_i];
  }
  return positions2.reduce(function(size2, position2) {
    var value2 = styles2["border-" + position2 + "-width"];
    return size2 + toFloat(value2);
  }, 0);
}
function getPaddings(styles2) {
  var positions2 = ["top", "right", "bottom", "left"];
  var paddings = {};
  for (var _i = 0, positions_1 = positions2; _i < positions_1.length; _i++) {
    var position2 = positions_1[_i];
    var value2 = styles2["padding-" + position2];
    paddings[position2] = toFloat(value2);
  }
  return paddings;
}
function getSVGContentRect(target) {
  var bbox = target.getBBox();
  return createRectInit(0, 0, bbox.width, bbox.height);
}
function getHTMLElementContentRect(target) {
  var clientWidth = target.clientWidth, clientHeight = target.clientHeight;
  if (!clientWidth && !clientHeight) {
    return emptyRect;
  }
  var styles2 = getWindowOf(target).getComputedStyle(target);
  var paddings = getPaddings(styles2);
  var horizPad = paddings.left + paddings.right;
  var vertPad = paddings.top + paddings.bottom;
  var width = toFloat(styles2.width), height = toFloat(styles2.height);
  if (styles2.boxSizing === "border-box") {
    if (Math.round(width + horizPad) !== clientWidth) {
      width -= getBordersSize(styles2, "left", "right") + horizPad;
    }
    if (Math.round(height + vertPad) !== clientHeight) {
      height -= getBordersSize(styles2, "top", "bottom") + vertPad;
    }
  }
  if (!isDocumentElement(target)) {
    var vertScrollbar = Math.round(width + horizPad) - clientWidth;
    var horizScrollbar = Math.round(height + vertPad) - clientHeight;
    if (Math.abs(vertScrollbar) !== 1) {
      width -= vertScrollbar;
    }
    if (Math.abs(horizScrollbar) !== 1) {
      height -= horizScrollbar;
    }
  }
  return createRectInit(paddings.left, paddings.top, width, height);
}
var isSVGGraphicsElement = function() {
  if (typeof SVGGraphicsElement !== "undefined") {
    return function(target) {
      return target instanceof getWindowOf(target).SVGGraphicsElement;
    };
  }
  return function(target) {
    return target instanceof getWindowOf(target).SVGElement && typeof target.getBBox === "function";
  };
}();
function isDocumentElement(target) {
  return target === getWindowOf(target).document.documentElement;
}
function getContentRect(target) {
  if (!isBrowser$1) {
    return emptyRect;
  }
  if (isSVGGraphicsElement(target)) {
    return getSVGContentRect(target);
  }
  return getHTMLElementContentRect(target);
}
function createReadOnlyRect(_a2) {
  var x2 = _a2.x, y2 = _a2.y, width = _a2.width, height = _a2.height;
  var Constr = typeof DOMRectReadOnly !== "undefined" ? DOMRectReadOnly : Object;
  var rect = Object.create(Constr.prototype);
  defineConfigurable(rect, {
    x: x2,
    y: y2,
    width,
    height,
    top: y2,
    right: x2 + width,
    bottom: height + y2,
    left: x2
  });
  return rect;
}
function createRectInit(x2, y2, width, height) {
  return { x: x2, y: y2, width, height };
}
var ResizeObservation = (
  /** @class */
  function() {
    function ResizeObservation2(target) {
      this.broadcastWidth = 0;
      this.broadcastHeight = 0;
      this.contentRect_ = createRectInit(0, 0, 0, 0);
      this.target = target;
    }
    ResizeObservation2.prototype.isActive = function() {
      var rect = getContentRect(this.target);
      this.contentRect_ = rect;
      return rect.width !== this.broadcastWidth || rect.height !== this.broadcastHeight;
    };
    ResizeObservation2.prototype.broadcastRect = function() {
      var rect = this.contentRect_;
      this.broadcastWidth = rect.width;
      this.broadcastHeight = rect.height;
      return rect;
    };
    return ResizeObservation2;
  }()
);
var ResizeObserverEntry = (
  /** @class */
  /* @__PURE__ */ function() {
    function ResizeObserverEntry2(target, rectInit) {
      var contentRect = createReadOnlyRect(rectInit);
      defineConfigurable(this, { target, contentRect });
    }
    return ResizeObserverEntry2;
  }()
);
var ResizeObserverSPI = (
  /** @class */
  function() {
    function ResizeObserverSPI2(callback2, controller, callbackCtx) {
      this.activeObservations_ = [];
      this.observations_ = new MapShim();
      if (typeof callback2 !== "function") {
        throw new TypeError("The callback provided as parameter 1 is not a function.");
      }
      this.callback_ = callback2;
      this.controller_ = controller;
      this.callbackCtx_ = callbackCtx;
    }
    ResizeObserverSPI2.prototype.observe = function(target) {
      if (!arguments.length) {
        throw new TypeError("1 argument required, but only 0 present.");
      }
      if (typeof Element === "undefined" || !(Element instanceof Object)) {
        return;
      }
      if (!(target instanceof getWindowOf(target).Element)) {
        throw new TypeError('parameter 1 is not of type "Element".');
      }
      var observations = this.observations_;
      if (observations.has(target)) {
        return;
      }
      observations.set(target, new ResizeObservation(target));
      this.controller_.addObserver(this);
      this.controller_.refresh();
    };
    ResizeObserverSPI2.prototype.unobserve = function(target) {
      if (!arguments.length) {
        throw new TypeError("1 argument required, but only 0 present.");
      }
      if (typeof Element === "undefined" || !(Element instanceof Object)) {
        return;
      }
      if (!(target instanceof getWindowOf(target).Element)) {
        throw new TypeError('parameter 1 is not of type "Element".');
      }
      var observations = this.observations_;
      if (!observations.has(target)) {
        return;
      }
      observations.delete(target);
      if (!observations.size) {
        this.controller_.removeObserver(this);
      }
    };
    ResizeObserverSPI2.prototype.disconnect = function() {
      this.clearActive();
      this.observations_.clear();
      this.controller_.removeObserver(this);
    };
    ResizeObserverSPI2.prototype.gatherActive = function() {
      var _this = this;
      this.clearActive();
      this.observations_.forEach(function(observation) {
        if (observation.isActive()) {
          _this.activeObservations_.push(observation);
        }
      });
    };
    ResizeObserverSPI2.prototype.broadcastActive = function() {
      if (!this.hasActive()) {
        return;
      }
      var ctx = this.callbackCtx_;
      var entries = this.activeObservations_.map(function(observation) {
        return new ResizeObserverEntry(observation.target, observation.broadcastRect());
      });
      this.callback_.call(ctx, entries, ctx);
      this.clearActive();
    };
    ResizeObserverSPI2.prototype.clearActive = function() {
      this.activeObservations_.splice(0);
    };
    ResizeObserverSPI2.prototype.hasActive = function() {
      return this.activeObservations_.length > 0;
    };
    return ResizeObserverSPI2;
  }()
);
var observers = typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : new MapShim();
var ResizeObserver$2 = (
  /** @class */
  /* @__PURE__ */ function() {
    function ResizeObserver2(callback2) {
      if (!(this instanceof ResizeObserver2)) {
        throw new TypeError("Cannot call a class as a function.");
      }
      if (!arguments.length) {
        throw new TypeError("1 argument required, but only 0 present.");
      }
      var controller = ResizeObserverController.getInstance();
      var observer = new ResizeObserverSPI(callback2, controller, this);
      observers.set(this, observer);
    }
    return ResizeObserver2;
  }()
);
[
  "observe",
  "unobserve",
  "disconnect"
].forEach(function(method4) {
  ResizeObserver$2.prototype[method4] = function() {
    var _a2;
    return (_a2 = observers.get(this))[method4].apply(_a2, arguments);
  };
});
var index$1 = function() {
  if (typeof global$1.ResizeObserver !== "undefined") {
    return global$1.ResizeObserver;
  }
  return ResizeObserver$2;
}();
var elementListeners = /* @__PURE__ */ new Map();
function onResize(entities) {
  entities.forEach(function(entity) {
    var _elementListeners$get;
    var target = entity.target;
    (_elementListeners$get = elementListeners.get(target)) === null || _elementListeners$get === void 0 || _elementListeners$get.forEach(function(listener) {
      return listener(target);
    });
  });
}
var resizeObserver = new index$1(onResize);
function observe(element2, callback2) {
  if (!elementListeners.has(element2)) {
    elementListeners.set(element2, /* @__PURE__ */ new Set());
    resizeObserver.observe(element2);
  }
  elementListeners.get(element2).add(callback2);
}
function unobserve(element2, callback2) {
  if (elementListeners.has(element2)) {
    elementListeners.get(element2).delete(callback2);
    if (!elementListeners.get(element2).size) {
      resizeObserver.unobserve(element2);
      elementListeners.delete(element2);
    }
  }
}
function _classCallCheck$a(a2, n2) {
  if (!(a2 instanceof n2))
    throw new TypeError("Cannot call a class as a function");
}
function _defineProperties(e2, r2) {
  for (var t2 = 0; t2 < r2.length; t2++) {
    var o2 = r2[t2];
    o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e2, toPropertyKey(o2.key), o2);
  }
}
function _createClass$8(e2, r2, t2) {
  return r2 && _defineProperties(e2.prototype, r2), t2 && _defineProperties(e2, t2), Object.defineProperty(e2, "prototype", {
    writable: false
  }), e2;
}
function _setPrototypeOf(t2, e2) {
  return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t3, e3) {
    return t3.__proto__ = e3, t3;
  }, _setPrototypeOf(t2, e2);
}
function _inherits$a(t2, e2) {
  if ("function" != typeof e2 && null !== e2)
    throw new TypeError("Super expression must either be null or a function");
  t2.prototype = Object.create(e2 && e2.prototype, {
    constructor: {
      value: t2,
      writable: true,
      configurable: true
    }
  }), Object.defineProperty(t2, "prototype", {
    writable: false
  }), e2 && _setPrototypeOf(t2, e2);
}
function _getPrototypeOf(t2) {
  return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t3) {
    return t3.__proto__ || Object.getPrototypeOf(t3);
  }, _getPrototypeOf(t2);
}
function _isNativeReflectConstruct$g() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t3) {
  }
  return (_isNativeReflectConstruct$g = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
function _assertThisInitialized(e2) {
  if (void 0 === e2)
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  return e2;
}
function _possibleConstructorReturn$a(t2, e2) {
  if (e2 && ("object" == _typeof$1(e2) || "function" == typeof e2))
    return e2;
  if (void 0 !== e2)
    throw new TypeError("Derived constructors may only return object or undefined");
  return _assertThisInitialized(t2);
}
function _createSuper$4(t2) {
  var r2 = _isNativeReflectConstruct$g();
  return function() {
    var e2, o2 = _getPrototypeOf(t2);
    if (r2) {
      var s2 = _getPrototypeOf(this).constructor;
      e2 = Reflect.construct(o2, arguments, s2);
    } else
      e2 = o2.apply(this, arguments);
    return _possibleConstructorReturn$a(this, e2);
  };
}
var DomWrapper$1 = /* @__PURE__ */ function(_React$Component) {
  _inherits$a(DomWrapper2, _React$Component);
  var _super = _createSuper$4(DomWrapper2);
  function DomWrapper2() {
    _classCallCheck$a(this, DomWrapper2);
    return _super.apply(this, arguments);
  }
  _createClass$8(DomWrapper2, [{
    key: "render",
    value: function render3() {
      return this.props.children;
    }
  }]);
  return DomWrapper2;
}(reactExports.Component);
function SingleObserver(props, ref) {
  var children = props.children, disabled = props.disabled;
  var elementRef = reactExports.useRef(null);
  var wrapperRef = reactExports.useRef(null);
  var onCollectionResize = reactExports.useContext(CollectionContext);
  var isRenderProps = typeof children === "function";
  var mergedChildren = isRenderProps ? children(elementRef) : children;
  var sizeRef = reactExports.useRef({
    width: -1,
    height: -1,
    offsetWidth: -1,
    offsetHeight: -1
  });
  var canRef = !isRenderProps && /* @__PURE__ */ reactExports.isValidElement(mergedChildren) && supportRef(mergedChildren);
  var originRef = canRef ? getNodeRef(mergedChildren) : null;
  var mergedRef = useComposeRef(originRef, elementRef);
  var getDom = function getDom2() {
    var _elementRef$current;
    return findDOMNode(elementRef.current) || // Support `nativeElement` format
    (elementRef.current && _typeof$1(elementRef.current) === "object" ? findDOMNode((_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 ? void 0 : _elementRef$current.nativeElement) : null) || findDOMNode(wrapperRef.current);
  };
  reactExports.useImperativeHandle(ref, function() {
    return getDom();
  });
  var propsRef = reactExports.useRef(props);
  propsRef.current = props;
  var onInternalResize = reactExports.useCallback(function(target) {
    var _propsRef$current = propsRef.current, onResize4 = _propsRef$current.onResize, data = _propsRef$current.data;
    var _target$getBoundingCl = target.getBoundingClientRect(), width = _target$getBoundingCl.width, height = _target$getBoundingCl.height;
    var offsetWidth = target.offsetWidth, offsetHeight = target.offsetHeight;
    var fixedWidth = Math.floor(width);
    var fixedHeight = Math.floor(height);
    if (sizeRef.current.width !== fixedWidth || sizeRef.current.height !== fixedHeight || sizeRef.current.offsetWidth !== offsetWidth || sizeRef.current.offsetHeight !== offsetHeight) {
      var size2 = {
        width: fixedWidth,
        height: fixedHeight,
        offsetWidth,
        offsetHeight
      };
      sizeRef.current = size2;
      var mergedOffsetWidth = offsetWidth === Math.round(width) ? width : offsetWidth;
      var mergedOffsetHeight = offsetHeight === Math.round(height) ? height : offsetHeight;
      var sizeInfo = _objectSpread2(_objectSpread2({}, size2), {}, {
        offsetWidth: mergedOffsetWidth,
        offsetHeight: mergedOffsetHeight
      });
      onCollectionResize === null || onCollectionResize === void 0 || onCollectionResize(sizeInfo, target, data);
      if (onResize4) {
        Promise.resolve().then(function() {
          onResize4(sizeInfo, target);
        });
      }
    }
  }, []);
  reactExports.useEffect(function() {
    var currentElement = getDom();
    if (currentElement && !disabled) {
      observe(currentElement, onInternalResize);
    }
    return function() {
      return unobserve(currentElement, onInternalResize);
    };
  }, [elementRef.current, disabled]);
  return /* @__PURE__ */ reactExports.createElement(DomWrapper$1, {
    ref: wrapperRef
  }, canRef ? /* @__PURE__ */ reactExports.cloneElement(mergedChildren, {
    ref: mergedRef
  }) : mergedChildren);
}
var RefSingleObserver = /* @__PURE__ */ reactExports.forwardRef(SingleObserver);
var INTERNAL_PREFIX_KEY = "rc-observer-key";
function ResizeObserver$1(props, ref) {
  var children = props.children;
  var childNodes = typeof children === "function" ? [children] : toArray$4(children);
  return childNodes.map(function(child, index2) {
    var key = (child === null || child === void 0 ? void 0 : child.key) || "".concat(INTERNAL_PREFIX_KEY, "-").concat(index2);
    return /* @__PURE__ */ reactExports.createElement(RefSingleObserver, _extends$h({}, props, {
      key,
      ref: index2 === 0 ? ref : void 0
    }), child);
  });
}
var RefResizeObserver = /* @__PURE__ */ reactExports.forwardRef(ResizeObserver$1);
RefResizeObserver.Collection = Collection$2;
function _arrayLikeToArray(r2, a2) {
  (null == a2 || a2 > r2.length) && (a2 = r2.length);
  for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++)
    n2[e2] = r2[e2];
  return n2;
}
function _arrayWithoutHoles(r2) {
  if (Array.isArray(r2))
    return _arrayLikeToArray(r2);
}
function _iterableToArray(r2) {
  if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"])
    return Array.from(r2);
}
function _unsupportedIterableToArray(r2, a2) {
  if (r2) {
    if ("string" == typeof r2)
      return _arrayLikeToArray(r2, a2);
    var t2 = {}.toString.call(r2).slice(8, -1);
    return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray(r2, a2) : void 0;
  }
}
function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _toConsumableArray(r2) {
  return _arrayWithoutHoles(r2) || _iterableToArray(r2) || _unsupportedIterableToArray(r2) || _nonIterableSpread();
}
var raf$1 = function raf2(callback2) {
  return +setTimeout(callback2, 16);
};
var caf$1 = function caf2(num) {
  return clearTimeout(num);
};
if (typeof window !== "undefined" && "requestAnimationFrame" in window) {
  raf$1 = function raf3(callback2) {
    return window.requestAnimationFrame(callback2);
  };
  caf$1 = function caf3(handle2) {
    return window.cancelAnimationFrame(handle2);
  };
}
var rafUUID = 0;
var rafIds = /* @__PURE__ */ new Map();
function cleanup(id2) {
  rafIds.delete(id2);
}
var wrapperRaf = function wrapperRaf2(callback2) {
  var times = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
  rafUUID += 1;
  var id2 = rafUUID;
  function callRef(leftTimes) {
    if (leftTimes === 0) {
      cleanup(id2);
      callback2();
    } else {
      var realId = raf$1(function() {
        callRef(leftTimes - 1);
      });
      rafIds.set(id2, realId);
    }
  }
  callRef(times);
  return id2;
};
wrapperRaf.cancel = function(id2) {
  var realId = rafIds.get(id2);
  cleanup(id2);
  return caf$1(realId);
};
function _arrayWithHoles(r2) {
  if (Array.isArray(r2))
    return r2;
}
function _iterableToArrayLimit(r2, l2) {
  var t2 = null == r2 ? null : "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"];
  if (null != t2) {
    var e2, n2, i2, u2, a2 = [], f2 = true, o2 = false;
    try {
      if (i2 = (t2 = t2.call(r2)).next, 0 === l2) {
        if (Object(t2) !== t2)
          return;
        f2 = false;
      } else
        for (; !(f2 = (e2 = i2.call(t2)).done) && (a2.push(e2.value), a2.length !== l2); f2 = true)
          ;
    } catch (r3) {
      o2 = true, n2 = r3;
    } finally {
      try {
        if (!f2 && null != t2["return"] && (u2 = t2["return"](), Object(u2) !== u2))
          return;
      } finally {
        if (o2)
          throw n2;
      }
    }
    return a2;
  }
}
function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _slicedToArray(r2, e2) {
  return _arrayWithHoles(r2) || _iterableToArrayLimit(r2, e2) || _unsupportedIterableToArray(r2, e2) || _nonIterableRest();
}
function murmur2(str) {
  var h3 = 0;
  var k2, i2 = 0, len = str.length;
  for (; len >= 4; ++i2, len -= 4) {
    k2 = str.charCodeAt(i2) & 255 | (str.charCodeAt(++i2) & 255) << 8 | (str.charCodeAt(++i2) & 255) << 16 | (str.charCodeAt(++i2) & 255) << 24;
    k2 = /* Math.imul(k, m): */
    (k2 & 65535) * 1540483477 + ((k2 >>> 16) * 59797 << 16);
    k2 ^= /* k >>> r: */
    k2 >>> 24;
    h3 = /* Math.imul(k, m): */
    (k2 & 65535) * 1540483477 + ((k2 >>> 16) * 59797 << 16) ^ /* Math.imul(h, m): */
    (h3 & 65535) * 1540483477 + ((h3 >>> 16) * 59797 << 16);
  }
  switch (len) {
    case 3:
      h3 ^= (str.charCodeAt(i2 + 2) & 255) << 16;
    case 2:
      h3 ^= (str.charCodeAt(i2 + 1) & 255) << 8;
    case 1:
      h3 ^= str.charCodeAt(i2) & 255;
      h3 = /* Math.imul(h, m): */
      (h3 & 65535) * 1540483477 + ((h3 >>> 16) * 59797 << 16);
  }
  h3 ^= h3 >>> 13;
  h3 = /* Math.imul(h, m): */
  (h3 & 65535) * 1540483477 + ((h3 >>> 16) * 59797 << 16);
  return ((h3 ^ h3 >>> 15) >>> 0).toString(36);
}
function canUseDom() {
  return !!(typeof window !== "undefined" && window.document && window.document.createElement);
}
function contains(root2, n2) {
  if (!root2) {
    return false;
  }
  if (root2.contains) {
    return root2.contains(n2);
  }
  var node2 = n2;
  while (node2) {
    if (node2 === root2) {
      return true;
    }
    node2 = node2.parentNode;
  }
  return false;
}
var APPEND_ORDER = "data-rc-order";
var APPEND_PRIORITY = "data-rc-priority";
var MARK_KEY = "rc-util-key";
var containerCache = /* @__PURE__ */ new Map();
function getMark() {
  var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, mark2 = _ref.mark;
  if (mark2) {
    return mark2.startsWith("data-") ? mark2 : "data-".concat(mark2);
  }
  return MARK_KEY;
}
function getContainer(option) {
  if (option.attachTo) {
    return option.attachTo;
  }
  var head = document.querySelector("head");
  return head || document.body;
}
function getOrder(prepend) {
  if (prepend === "queue") {
    return "prependQueue";
  }
  return prepend ? "prepend" : "append";
}
function findStyles(container) {
  return Array.from((containerCache.get(container) || container).children).filter(function(node2) {
    return node2.tagName === "STYLE";
  });
}
function injectCSS(css) {
  var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
  if (!canUseDom()) {
    return null;
  }
  var csp = option.csp, prepend = option.prepend, _option$priority = option.priority, priority = _option$priority === void 0 ? 0 : _option$priority;
  var mergedOrder = getOrder(prepend);
  var isPrependQueue = mergedOrder === "prependQueue";
  var styleNode = document.createElement("style");
  styleNode.setAttribute(APPEND_ORDER, mergedOrder);
  if (isPrependQueue && priority) {
    styleNode.setAttribute(APPEND_PRIORITY, "".concat(priority));
  }
  if (csp !== null && csp !== void 0 && csp.nonce) {
    styleNode.nonce = csp === null || csp === void 0 ? void 0 : csp.nonce;
  }
  styleNode.innerHTML = css;
  var container = getContainer(option);
  var firstChild = container.firstChild;
  if (prepend) {
    if (isPrependQueue) {
      var existStyle = (option.styles || findStyles(container)).filter(function(node2) {
        if (!["prepend", "prependQueue"].includes(node2.getAttribute(APPEND_ORDER))) {
          return false;
        }
        var nodePriority = Number(node2.getAttribute(APPEND_PRIORITY) || 0);
        return priority >= nodePriority;
      });
      if (existStyle.length) {
        container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);
        return styleNode;
      }
    }
    container.insertBefore(styleNode, firstChild);
  } else {
    container.appendChild(styleNode);
  }
  return styleNode;
}
function findExistNode(key) {
  var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
  var container = getContainer(option);
  return (option.styles || findStyles(container)).find(function(node2) {
    return node2.getAttribute(getMark(option)) === key;
  });
}
function removeCSS(key) {
  var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
  var existNode = findExistNode(key, option);
  if (existNode) {
    var container = getContainer(option);
    container.removeChild(existNode);
  }
}
function syncRealContainer(container, option) {
  var cachedRealContainer = containerCache.get(container);
  if (!cachedRealContainer || !contains(document, cachedRealContainer)) {
    var placeholderStyle = injectCSS("", option);
    var parentNode = placeholderStyle.parentNode;
    containerCache.set(container, parentNode);
    container.removeChild(placeholderStyle);
  }
}
function updateCSS(css, key) {
  var originOption = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
  var container = getContainer(originOption);
  var styles2 = findStyles(container);
  var option = _objectSpread2(_objectSpread2({}, originOption), {}, {
    styles: styles2
  });
  syncRealContainer(container, option);
  var existNode = findExistNode(key, option);
  if (existNode) {
    var _option$csp, _option$csp2;
    if ((_option$csp = option.csp) !== null && _option$csp !== void 0 && _option$csp.nonce && existNode.nonce !== ((_option$csp2 = option.csp) === null || _option$csp2 === void 0 ? void 0 : _option$csp2.nonce)) {
      var _option$csp3;
      existNode.nonce = (_option$csp3 = option.csp) === null || _option$csp3 === void 0 ? void 0 : _option$csp3.nonce;
    }
    if (existNode.innerHTML !== css) {
      existNode.innerHTML = css;
    }
    return existNode;
  }
  var newNode = injectCSS(css, option);
  newNode.setAttribute(getMark(option), key);
  return newNode;
}
function _objectWithoutProperties$3(e2, t2) {
  if (null == e2)
    return {};
  var o2, r2, i2 = _objectWithoutPropertiesLoose$2(e2, t2);
  if (Object.getOwnPropertySymbols) {
    var n2 = Object.getOwnPropertySymbols(e2);
    for (r2 = 0; r2 < n2.length; r2++)
      o2 = n2[r2], -1 === t2.indexOf(o2) && {}.propertyIsEnumerable.call(e2, o2) && (i2[o2] = e2[o2]);
  }
  return i2;
}
function isEqual$2(obj1, obj2) {
  var shallow = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
  var refSet = /* @__PURE__ */ new Set();
  function deepEqual(a2, b2) {
    var level = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
    var circular = refSet.has(a2);
    warningOnce(!circular, "Warning: There may be circular references");
    if (circular) {
      return false;
    }
    if (a2 === b2) {
      return true;
    }
    if (shallow && level > 1) {
      return false;
    }
    refSet.add(a2);
    var newLevel = level + 1;
    if (Array.isArray(a2)) {
      if (!Array.isArray(b2) || a2.length !== b2.length) {
        return false;
      }
      for (var i2 = 0; i2 < a2.length; i2++) {
        if (!deepEqual(a2[i2], b2[i2], newLevel)) {
          return false;
        }
      }
      return true;
    }
    if (a2 && b2 && _typeof$1(a2) === "object" && _typeof$1(b2) === "object") {
      var keys2 = Object.keys(a2);
      if (keys2.length !== Object.keys(b2).length) {
        return false;
      }
      return keys2.every(function(key) {
        return deepEqual(a2[key], b2[key], newLevel);
      });
    }
    return false;
  }
  return deepEqual(obj1, obj2);
}
var SPLIT$1 = "%";
function pathKey(keys2) {
  return keys2.join(SPLIT$1);
}
var Entity = /* @__PURE__ */ function() {
  function Entity2(instanceId) {
    _classCallCheck$a(this, Entity2);
    _defineProperty$3(this, "instanceId", void 0);
    _defineProperty$3(this, "cache", /* @__PURE__ */ new Map());
    _defineProperty$3(this, "extracted", /* @__PURE__ */ new Set());
    this.instanceId = instanceId;
  }
  _createClass$8(Entity2, [{
    key: "get",
    value: function get5(keys2) {
      return this.opGet(pathKey(keys2));
    }
    /** A fast get cache with `get` concat. */
  }, {
    key: "opGet",
    value: function opGet(keyPathStr) {
      return this.cache.get(keyPathStr) || null;
    }
  }, {
    key: "update",
    value: function update(keys2, valueFn) {
      return this.opUpdate(pathKey(keys2), valueFn);
    }
    /** A fast get cache with `get` concat. */
  }, {
    key: "opUpdate",
    value: function opUpdate(keyPathStr, valueFn) {
      var prevValue = this.cache.get(keyPathStr);
      var nextValue = valueFn(prevValue);
      if (nextValue === null) {
        this.cache.delete(keyPathStr);
      } else {
        this.cache.set(keyPathStr, nextValue);
      }
    }
  }]);
  return Entity2;
}();
var ATTR_TOKEN = "data-token-hash";
var ATTR_MARK = "data-css-hash";
var CSS_IN_JS_INSTANCE = "__cssinjs_instance__";
function createCache() {
  var cssinjsInstanceId = Math.random().toString(12).slice(2);
  if (typeof document !== "undefined" && document.head && document.body) {
    var styles2 = document.body.querySelectorAll("style[".concat(ATTR_MARK, "]")) || [];
    var firstChild = document.head.firstChild;
    Array.from(styles2).forEach(function(style2) {
      style2[CSS_IN_JS_INSTANCE] = style2[CSS_IN_JS_INSTANCE] || cssinjsInstanceId;
      if (style2[CSS_IN_JS_INSTANCE] === cssinjsInstanceId) {
        document.head.insertBefore(style2, firstChild);
      }
    });
    var styleHash = {};
    Array.from(document.querySelectorAll("style[".concat(ATTR_MARK, "]"))).forEach(function(style2) {
      var hash = style2.getAttribute(ATTR_MARK);
      if (styleHash[hash]) {
        if (style2[CSS_IN_JS_INSTANCE] === cssinjsInstanceId) {
          var _style$parentNode;
          (_style$parentNode = style2.parentNode) === null || _style$parentNode === void 0 || _style$parentNode.removeChild(style2);
        }
      } else {
        styleHash[hash] = true;
      }
    });
  }
  return new Entity(cssinjsInstanceId);
}
var StyleContext = /* @__PURE__ */ reactExports.createContext({
  hashPriority: "low",
  cache: createCache(),
  defaultCache: true
});
function sameDerivativeOption(left2, right) {
  if (left2.length !== right.length) {
    return false;
  }
  for (var i2 = 0; i2 < left2.length; i2++) {
    if (left2[i2] !== right[i2]) {
      return false;
    }
  }
  return true;
}
var ThemeCache = /* @__PURE__ */ function() {
  function ThemeCache2() {
    _classCallCheck$a(this, ThemeCache2);
    _defineProperty$3(this, "cache", void 0);
    _defineProperty$3(this, "keys", void 0);
    _defineProperty$3(this, "cacheCallTimes", void 0);
    this.cache = /* @__PURE__ */ new Map();
    this.keys = [];
    this.cacheCallTimes = 0;
  }
  _createClass$8(ThemeCache2, [{
    key: "size",
    value: function size2() {
      return this.keys.length;
    }
  }, {
    key: "internalGet",
    value: function internalGet(derivativeOption) {
      var _cache2, _cache3;
      var updateCallTimes = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
      var cache2 = {
        map: this.cache
      };
      derivativeOption.forEach(function(derivative2) {
        if (!cache2) {
          cache2 = void 0;
        } else {
          var _cache;
          cache2 = (_cache = cache2) === null || _cache === void 0 || (_cache = _cache.map) === null || _cache === void 0 ? void 0 : _cache.get(derivative2);
        }
      });
      if ((_cache2 = cache2) !== null && _cache2 !== void 0 && _cache2.value && updateCallTimes) {
        cache2.value[1] = this.cacheCallTimes++;
      }
      return (_cache3 = cache2) === null || _cache3 === void 0 ? void 0 : _cache3.value;
    }
  }, {
    key: "get",
    value: function get5(derivativeOption) {
      var _this$internalGet;
      return (_this$internalGet = this.internalGet(derivativeOption, true)) === null || _this$internalGet === void 0 ? void 0 : _this$internalGet[0];
    }
  }, {
    key: "has",
    value: function has2(derivativeOption) {
      return !!this.internalGet(derivativeOption);
    }
  }, {
    key: "set",
    value: function set2(derivativeOption, value2) {
      var _this = this;
      if (!this.has(derivativeOption)) {
        if (this.size() + 1 > ThemeCache2.MAX_CACHE_SIZE + ThemeCache2.MAX_CACHE_OFFSET) {
          var _this$keys$reduce = this.keys.reduce(function(result, key) {
            var _result = _slicedToArray(result, 2), callTimes = _result[1];
            if (_this.internalGet(key)[1] < callTimes) {
              return [key, _this.internalGet(key)[1]];
            }
            return result;
          }, [this.keys[0], this.cacheCallTimes]), _this$keys$reduce2 = _slicedToArray(_this$keys$reduce, 1), targetKey = _this$keys$reduce2[0];
          this.delete(targetKey);
        }
        this.keys.push(derivativeOption);
      }
      var cache2 = this.cache;
      derivativeOption.forEach(function(derivative2, index2) {
        if (index2 === derivativeOption.length - 1) {
          cache2.set(derivative2, {
            value: [value2, _this.cacheCallTimes++]
          });
        } else {
          var cacheValue = cache2.get(derivative2);
          if (!cacheValue) {
            cache2.set(derivative2, {
              map: /* @__PURE__ */ new Map()
            });
          } else if (!cacheValue.map) {
            cacheValue.map = /* @__PURE__ */ new Map();
          }
          cache2 = cache2.get(derivative2).map;
        }
      });
    }
  }, {
    key: "deleteByPath",
    value: function deleteByPath(currentCache, derivatives) {
      var cache2 = currentCache.get(derivatives[0]);
      if (derivatives.length === 1) {
        var _cache$value;
        if (!cache2.map) {
          currentCache.delete(derivatives[0]);
        } else {
          currentCache.set(derivatives[0], {
            map: cache2.map
          });
        }
        return (_cache$value = cache2.value) === null || _cache$value === void 0 ? void 0 : _cache$value[0];
      }
      var result = this.deleteByPath(cache2.map, derivatives.slice(1));
      if ((!cache2.map || cache2.map.size === 0) && !cache2.value) {
        currentCache.delete(derivatives[0]);
      }
      return result;
    }
  }, {
    key: "delete",
    value: function _delete(derivativeOption) {
      if (this.has(derivativeOption)) {
        this.keys = this.keys.filter(function(item) {
          return !sameDerivativeOption(item, derivativeOption);
        });
        return this.deleteByPath(this.cache, derivativeOption);
      }
      return void 0;
    }
  }]);
  return ThemeCache2;
}();
_defineProperty$3(ThemeCache, "MAX_CACHE_SIZE", 20);
_defineProperty$3(ThemeCache, "MAX_CACHE_OFFSET", 5);
var uuid$2 = 0;
var Theme = /* @__PURE__ */ function() {
  function Theme2(derivatives) {
    _classCallCheck$a(this, Theme2);
    _defineProperty$3(this, "derivatives", void 0);
    _defineProperty$3(this, "id", void 0);
    this.derivatives = Array.isArray(derivatives) ? derivatives : [derivatives];
    this.id = uuid$2;
    if (derivatives.length === 0) {
      warning$2(derivatives.length > 0);
    }
    uuid$2 += 1;
  }
  _createClass$8(Theme2, [{
    key: "getDerivativeToken",
    value: function getDerivativeToken(token2) {
      return this.derivatives.reduce(function(result, derivative2) {
        return derivative2(token2, result);
      }, void 0);
    }
  }]);
  return Theme2;
}();
var cacheThemes = new ThemeCache();
function createTheme(derivatives) {
  var derivativeArr = Array.isArray(derivatives) ? derivatives : [derivatives];
  if (!cacheThemes.has(derivativeArr)) {
    cacheThemes.set(derivativeArr, new Theme(derivativeArr));
  }
  return cacheThemes.get(derivativeArr);
}
var resultCache = /* @__PURE__ */ new WeakMap();
var RESULT_VALUE = {};
function memoResult(callback2, deps) {
  var current = resultCache;
  for (var i2 = 0; i2 < deps.length; i2 += 1) {
    var dep = deps[i2];
    if (!current.has(dep)) {
      current.set(dep, /* @__PURE__ */ new WeakMap());
    }
    current = current.get(dep);
  }
  if (!current.has(RESULT_VALUE)) {
    current.set(RESULT_VALUE, callback2());
  }
  return current.get(RESULT_VALUE);
}
var flattenTokenCache = /* @__PURE__ */ new WeakMap();
function flattenToken(token2) {
  var str = flattenTokenCache.get(token2) || "";
  if (!str) {
    Object.keys(token2).forEach(function(key) {
      var value2 = token2[key];
      str += key;
      if (value2 instanceof Theme) {
        str += value2.id;
      } else if (value2 && _typeof$1(value2) === "object") {
        str += flattenToken(value2);
      } else {
        str += value2;
      }
    });
    str = murmur2(str);
    flattenTokenCache.set(token2, str);
  }
  return str;
}
function token2key(token2, salt) {
  return murmur2("".concat(salt, "_").concat(flattenToken(token2)));
}
var isClientSide = canUseDom();
function unit$1(num) {
  if (typeof num === "number") {
    return "".concat(num, "px");
  }
  return num;
}
function toStyleStr(style2, tokenKey, styleId) {
  var customizeAttrs = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
  var plain = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false;
  if (plain) {
    return style2;
  }
  var attrs = _objectSpread2(_objectSpread2({}, customizeAttrs), {}, _defineProperty$3(_defineProperty$3({}, ATTR_TOKEN, tokenKey), ATTR_MARK, styleId));
  var attrStr = Object.keys(attrs).map(function(attr) {
    var val = attrs[attr];
    return val ? "".concat(attr, '="').concat(val, '"') : null;
  }).filter(function(v2) {
    return v2;
  }).join(" ");
  return "<style ".concat(attrStr, ">").concat(style2, "</style>");
}
var token2CSSVar = function token2CSSVar2(token2) {
  var prefix = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
  return "--".concat(prefix ? "".concat(prefix, "-") : "").concat(token2).replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z]+)([A-Z][a-z0-9]+)/g, "$1-$2").replace(/([a-z])([A-Z0-9])/g, "$1-$2").toLowerCase();
};
var serializeCSSVar = function serializeCSSVar2(cssVars, hashId, options) {
  if (!Object.keys(cssVars).length) {
    return "";
  }
  return ".".concat(hashId).concat(options !== null && options !== void 0 && options.scope ? ".".concat(options.scope) : "", "{").concat(Object.entries(cssVars).map(function(_ref) {
    var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value2 = _ref2[1];
    return "".concat(key, ":").concat(value2, ";");
  }).join(""), "}");
};
var transformToken = function transformToken2(token2, themeKey, config2) {
  var cssVars = {};
  var result = {};
  Object.entries(token2).forEach(function(_ref3) {
    var _config$preserve, _config$ignore;
    var _ref4 = _slicedToArray(_ref3, 2), key = _ref4[0], value2 = _ref4[1];
    if (config2 !== null && config2 !== void 0 && (_config$preserve = config2.preserve) !== null && _config$preserve !== void 0 && _config$preserve[key]) {
      result[key] = value2;
    } else if ((typeof value2 === "string" || typeof value2 === "number") && !(config2 !== null && config2 !== void 0 && (_config$ignore = config2.ignore) !== null && _config$ignore !== void 0 && _config$ignore[key])) {
      var _config$unitless;
      var cssVar = token2CSSVar(key, config2 === null || config2 === void 0 ? void 0 : config2.prefix);
      cssVars[cssVar] = typeof value2 === "number" && !(config2 !== null && config2 !== void 0 && (_config$unitless = config2.unitless) !== null && _config$unitless !== void 0 && _config$unitless[key]) ? "".concat(value2, "px") : String(value2);
      result[key] = "var(".concat(cssVar, ")");
    }
  });
  return [result, serializeCSSVar(cssVars, themeKey, {
    scope: config2 === null || config2 === void 0 ? void 0 : config2.scope
  })];
};
var useInternalLayoutEffect = canUseDom() ? reactExports.useLayoutEffect : reactExports.useEffect;
var useLayoutEffect = function useLayoutEffect2(callback2, deps) {
  var firstMountRef = reactExports.useRef(true);
  useInternalLayoutEffect(function() {
    return callback2(firstMountRef.current);
  }, deps);
  useInternalLayoutEffect(function() {
    firstMountRef.current = false;
    return function() {
      firstMountRef.current = true;
    };
  }, []);
};
var useLayoutUpdateEffect = function useLayoutUpdateEffect2(callback2, deps) {
  useLayoutEffect(function(firstMount) {
    if (!firstMount) {
      return callback2();
    }
  }, deps);
};
var fullClone$2 = _objectSpread2({}, React$6);
var useInsertionEffect$1 = fullClone$2.useInsertionEffect;
var useInsertionEffectPolyfill = function useInsertionEffectPolyfill2(renderEffect, effect, deps) {
  reactExports.useMemo(renderEffect, deps);
  useLayoutEffect(function() {
    return effect(true);
  }, deps);
};
var useCompatibleInsertionEffect = useInsertionEffect$1 ? function(renderEffect, effect, deps) {
  return useInsertionEffect$1(function() {
    renderEffect();
    return effect();
  }, deps);
} : useInsertionEffectPolyfill;
var fullClone$1 = _objectSpread2({}, React$6);
var useInsertionEffect = fullClone$1.useInsertionEffect;
var useCleanupRegister = function useCleanupRegister2(deps) {
  var effectCleanups = [];
  var cleanupFlag = false;
  function register2(fn) {
    if (cleanupFlag) {
      return;
    }
    effectCleanups.push(fn);
  }
  reactExports.useEffect(function() {
    cleanupFlag = false;
    return function() {
      cleanupFlag = true;
      if (effectCleanups.length) {
        effectCleanups.forEach(function(fn) {
          return fn();
        });
      }
    };
  }, deps);
  return register2;
};
var useRun = function useRun2() {
  return function(fn) {
    fn();
  };
};
var useEffectCleanupRegister = typeof useInsertionEffect !== "undefined" ? useCleanupRegister : useRun;
function useGlobalCache(prefix, keyPath, cacheFn, onCacheRemove, onCacheEffect) {
  var _React$useContext = reactExports.useContext(StyleContext), globalCache = _React$useContext.cache;
  var fullPath = [prefix].concat(_toConsumableArray(keyPath));
  var fullPathStr = pathKey(fullPath);
  var register2 = useEffectCleanupRegister([fullPathStr]);
  var buildCache = function buildCache2(updater) {
    globalCache.opUpdate(fullPathStr, function(prevCache) {
      var _ref = prevCache || [void 0, void 0], _ref2 = _slicedToArray(_ref, 2), _ref2$ = _ref2[0], times = _ref2$ === void 0 ? 0 : _ref2$, cache2 = _ref2[1];
      var tmpCache = cache2;
      var mergedCache = tmpCache || cacheFn();
      var data = [times, mergedCache];
      return updater ? updater(data) : data;
    });
  };
  reactExports.useMemo(
    function() {
      buildCache();
    },
    /* eslint-disable react-hooks/exhaustive-deps */
    [fullPathStr]
    /* eslint-enable */
  );
  var cacheEntity = globalCache.opGet(fullPathStr);
  var cacheContent = cacheEntity[1];
  useCompatibleInsertionEffect(function() {
    onCacheEffect === null || onCacheEffect === void 0 || onCacheEffect(cacheContent);
  }, function(polyfill3) {
    buildCache(function(_ref3) {
      var _ref4 = _slicedToArray(_ref3, 2), times = _ref4[0], cache2 = _ref4[1];
      if (polyfill3 && times === 0) {
        onCacheEffect === null || onCacheEffect === void 0 || onCacheEffect(cacheContent);
      }
      return [times + 1, cache2];
    });
    return function() {
      globalCache.opUpdate(fullPathStr, function(prevCache) {
        var _ref5 = prevCache || [], _ref6 = _slicedToArray(_ref5, 2), _ref6$ = _ref6[0], times = _ref6$ === void 0 ? 0 : _ref6$, cache2 = _ref6[1];
        var nextCount = times - 1;
        if (nextCount === 0) {
          register2(function() {
            if (polyfill3 || !globalCache.opGet(fullPathStr)) {
              onCacheRemove === null || onCacheRemove === void 0 || onCacheRemove(cache2, false);
            }
          });
          return null;
        }
        return [times - 1, cache2];
      });
    };
  }, [fullPathStr]);
  return cacheContent;
}
var EMPTY_OVERRIDE = {};
var hashPrefix = "css";
var tokenKeys = /* @__PURE__ */ new Map();
function recordCleanToken(tokenKey) {
  tokenKeys.set(tokenKey, (tokenKeys.get(tokenKey) || 0) + 1);
}
function removeStyleTags(key, instanceId) {
  if (typeof document !== "undefined") {
    var styles2 = document.querySelectorAll("style[".concat(ATTR_TOKEN, '="').concat(key, '"]'));
    styles2.forEach(function(style2) {
      if (style2[CSS_IN_JS_INSTANCE] === instanceId) {
        var _style$parentNode;
        (_style$parentNode = style2.parentNode) === null || _style$parentNode === void 0 || _style$parentNode.removeChild(style2);
      }
    });
  }
}
var TOKEN_THRESHOLD = 0;
function cleanTokenStyle(tokenKey, instanceId) {
  tokenKeys.set(tokenKey, (tokenKeys.get(tokenKey) || 0) - 1);
  var cleanableKeyList = /* @__PURE__ */ new Set();
  tokenKeys.forEach(function(value2, key) {
    if (value2 <= 0)
      cleanableKeyList.add(key);
  });
  if (tokenKeys.size - cleanableKeyList.size > TOKEN_THRESHOLD) {
    cleanableKeyList.forEach(function(key) {
      removeStyleTags(key, instanceId);
      tokenKeys.delete(key);
    });
  }
}
var getComputedToken$1 = function getComputedToken2(originToken, overrideToken, theme2, format2) {
  var derivativeToken = theme2.getDerivativeToken(originToken);
  var mergedDerivativeToken = _objectSpread2(_objectSpread2({}, derivativeToken), overrideToken);
  if (format2) {
    mergedDerivativeToken = format2(mergedDerivativeToken);
  }
  return mergedDerivativeToken;
};
var TOKEN_PREFIX = "token";
function useCacheToken(theme2, tokens2) {
  var option = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
  var _useContext = reactExports.useContext(StyleContext), instanceId = _useContext.cache.instanceId, container = _useContext.container;
  var _option$salt = option.salt, salt = _option$salt === void 0 ? "" : _option$salt, _option$override = option.override, override = _option$override === void 0 ? EMPTY_OVERRIDE : _option$override, formatToken2 = option.formatToken, compute = option.getComputedToken, cssVar = option.cssVar;
  var mergedToken = memoResult(function() {
    return Object.assign.apply(Object, [{}].concat(_toConsumableArray(tokens2)));
  }, tokens2);
  var tokenStr = flattenToken(mergedToken);
  var overrideTokenStr = flattenToken(override);
  var cssVarStr = cssVar ? flattenToken(cssVar) : "";
  var cachedToken = useGlobalCache(TOKEN_PREFIX, [salt, theme2.id, tokenStr, overrideTokenStr, cssVarStr], function() {
    var _cssVar$key;
    var mergedDerivativeToken = compute ? compute(mergedToken, override, theme2) : getComputedToken$1(mergedToken, override, theme2, formatToken2);
    var actualToken = _objectSpread2({}, mergedDerivativeToken);
    var cssVarsStr = "";
    if (!!cssVar) {
      var _transformToken = transformToken(mergedDerivativeToken, cssVar.key, {
        prefix: cssVar.prefix,
        ignore: cssVar.ignore,
        unitless: cssVar.unitless,
        preserve: cssVar.preserve
      });
      var _transformToken2 = _slicedToArray(_transformToken, 2);
      mergedDerivativeToken = _transformToken2[0];
      cssVarsStr = _transformToken2[1];
    }
    var tokenKey = token2key(mergedDerivativeToken, salt);
    mergedDerivativeToken._tokenKey = tokenKey;
    actualToken._tokenKey = token2key(actualToken, salt);
    var themeKey = (_cssVar$key = cssVar === null || cssVar === void 0 ? void 0 : cssVar.key) !== null && _cssVar$key !== void 0 ? _cssVar$key : tokenKey;
    mergedDerivativeToken._themeKey = themeKey;
    recordCleanToken(themeKey);
    var hashId = "".concat(hashPrefix, "-").concat(murmur2(tokenKey));
    mergedDerivativeToken._hashId = hashId;
    return [mergedDerivativeToken, hashId, actualToken, cssVarsStr, (cssVar === null || cssVar === void 0 ? void 0 : cssVar.key) || ""];
  }, function(cache2) {
    cleanTokenStyle(cache2[0]._themeKey, instanceId);
  }, function(_ref) {
    var _ref2 = _slicedToArray(_ref, 4), token2 = _ref2[0], cssVarsStr = _ref2[3];
    if (cssVar && cssVarsStr) {
      var style2 = updateCSS(cssVarsStr, murmur2("css-variables-".concat(token2._themeKey)), {
        mark: ATTR_MARK,
        prepend: "queue",
        attachTo: container,
        priority: -999
      });
      style2[CSS_IN_JS_INSTANCE] = instanceId;
      style2.setAttribute(ATTR_TOKEN, token2._themeKey);
    }
  });
  return cachedToken;
}
var extract$2 = function extract2(cache2, effectStyles, options) {
  var _cache = _slicedToArray(cache2, 5), realToken = _cache[2], styleStr = _cache[3], cssVarKey = _cache[4];
  var _ref3 = options || {}, plain = _ref3.plain;
  if (!styleStr) {
    return null;
  }
  var styleId = realToken._tokenKey;
  var order2 = -999;
  var sharedAttrs = {
    "data-rc-order": "prependQueue",
    "data-rc-priority": "".concat(order2)
  };
  var styleText = toStyleStr(styleStr, cssVarKey, styleId, sharedAttrs, plain);
  return [order2, styleId, styleText];
};
var unitlessKeys = {
  animationIterationCount: 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
};
var COMMENT = "comm";
var RULESET = "rule";
var DECLARATION = "decl";
var IMPORT = "@import";
var NAMESPACE = "@namespace";
var KEYFRAMES = "@keyframes";
var LAYER = "@layer";
var abs$2 = Math.abs;
var from$2 = String.fromCharCode;
function trim$2(value2) {
  return value2.trim();
}
function replace(value2, pattern4, replacement) {
  return value2.replace(pattern4, replacement);
}
function indexof(value2, search2, position2) {
  return value2.indexOf(search2, position2);
}
function charat(value2, index2) {
  return value2.charCodeAt(index2) | 0;
}
function substr(value2, begin, end2) {
  return value2.slice(begin, end2);
}
function strlen(value2) {
  return value2.length;
}
function sizeof(value2) {
  return value2.length;
}
function append(value2, array4) {
  return array4.push(value2), value2;
}
var line = 1;
var column = 1;
var length = 0;
var position$2 = 0;
var character = 0;
var characters = "";
function node$1(value2, root2, parent, type4, props, children, length2, siblings) {
  return { value: value2, root: root2, parent, type: type4, props, children, line, column, length: length2, return: "", siblings };
}
function char() {
  return character;
}
function prev() {
  character = position$2 > 0 ? charat(characters, --position$2) : 0;
  if (column--, character === 10)
    column = 1, line--;
  return character;
}
function next() {
  character = position$2 < length ? charat(characters, position$2++) : 0;
  if (column++, character === 10)
    column = 1, line++;
  return character;
}
function peek() {
  return charat(characters, position$2);
}
function caret() {
  return position$2;
}
function slice(begin, end2) {
  return substr(characters, begin, end2);
}
function token$1(type4) {
  switch (type4) {
    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(value2) {
  return line = column = 1, length = strlen(characters = value2), position$2 = 0, [];
}
function dealloc(value2) {
  return characters = "", value2;
}
function delimit(type4) {
  return trim$2(slice(position$2 - 1, delimiter(type4 === 91 ? type4 + 2 : type4 === 40 ? type4 + 1 : type4)));
}
function whitespace$2(type4) {
  while (character = peek())
    if (character < 33)
      next();
    else
      break;
  return token$1(type4) > 2 || token$1(character) > 3 ? "" : " ";
}
function escaping(index2, count) {
  while (--count && next())
    if (character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97)
      break;
  return slice(index2, caret() + (count < 6 && peek() == 32 && next() == 32));
}
function delimiter(type4) {
  while (next())
    switch (character) {
      case type4:
        return position$2;
      case 34:
      case 39:
        if (type4 !== 34 && type4 !== 39)
          delimiter(character);
        break;
      case 40:
        if (type4 === 41)
          delimiter(type4);
        break;
      case 92:
        next();
        break;
    }
  return position$2;
}
function commenter(type4, index2) {
  while (next())
    if (type4 + character === 47 + 10)
      break;
    else if (type4 + character === 42 + 42 && peek() === 47)
      break;
  return "/*" + slice(index2, position$2 - 1) + "*" + from$2(type4 === 47 ? type4 : next());
}
function identifier(index2) {
  while (!token$1(peek()))
    next();
  return slice(index2, position$2);
}
function compile(value2) {
  return dealloc(parse$2("", null, null, null, [""], value2 = alloc(value2), 0, [0], value2));
}
function parse$2(value2, root2, parent, rule, rules2, rulesets, pseudo, points, declarations) {
  var index2 = 0;
  var offset2 = 0;
  var length2 = pseudo;
  var atrule = 0;
  var property2 = 0;
  var previous2 = 0;
  var variable = 1;
  var scanning = 1;
  var ampersand = 1;
  var character2 = 0;
  var type4 = "";
  var props = rules2;
  var children = rulesets;
  var reference = rule;
  var characters2 = type4;
  while (scanning)
    switch (previous2 = character2, character2 = next()) {
      case 40:
        if (previous2 != 108 && charat(characters2, length2 - 1) == 58) {
          if (indexof(characters2 += replace(delimit(character2), "&", "&\f"), "&\f", abs$2(index2 ? points[index2 - 1] : 0)) != -1)
            ampersand = -1;
          break;
        }
      case 34:
      case 39:
      case 91:
        characters2 += delimit(character2);
        break;
      case 9:
      case 10:
      case 13:
      case 32:
        characters2 += whitespace$2(previous2);
        break;
      case 92:
        characters2 += escaping(caret() - 1, 7);
        continue;
      case 47:
        switch (peek()) {
          case 42:
          case 47:
            append(comment(commenter(next(), caret()), root2, parent, declarations), declarations);
            if ((token$1(previous2 || 1) == 5 || token$1(peek() || 1) == 5) && strlen(characters2) && substr(characters2, -1, void 0) !== " ")
              characters2 += " ";
            break;
          default:
            characters2 += "/";
        }
        break;
      case 123 * variable:
        points[index2++] = strlen(characters2) * ampersand;
      case 125 * variable:
      case 59:
      case 0:
        switch (character2) {
          case 0:
          case 125:
            scanning = 0;
          case 59 + offset2:
            if (ampersand == -1)
              characters2 = replace(characters2, /\f/g, "");
            if (property2 > 0 && (strlen(characters2) - length2 || variable === 0 && previous2 === 47))
              append(property2 > 32 ? declaration(characters2 + ";", rule, parent, length2 - 1, declarations) : declaration(replace(characters2, " ", "") + ";", rule, parent, length2 - 2, declarations), declarations);
            break;
          case 59:
            characters2 += ";";
          default:
            append(reference = ruleset(characters2, root2, parent, index2, offset2, rules2, points, type4, props = [], children = [], length2, rulesets), rulesets);
            if (character2 === 123)
              if (offset2 === 0)
                parse$2(characters2, root2, reference, reference, props, rulesets, length2, points, children);
              else {
                switch (atrule) {
                  case 99:
                    if (charat(characters2, 3) === 110)
                      break;
                  case 108:
                    if (charat(characters2, 2) === 97)
                      break;
                  default:
                    offset2 = 0;
                  case 100:
                  case 109:
                  case 115:
                }
                if (offset2)
                  parse$2(value2, reference, reference, rule && append(ruleset(value2, reference, reference, 0, 0, rules2, points, type4, rules2, props = [], length2, children), children), rules2, children, length2, points, rule ? props : children);
                else
                  parse$2(characters2, reference, reference, reference, [""], children, 0, points, children);
              }
        }
        index2 = offset2 = property2 = 0, variable = ampersand = 1, type4 = characters2 = "", length2 = pseudo;
        break;
      case 58:
        length2 = 1 + strlen(characters2), property2 = previous2;
      default:
        if (variable < 1) {
          if (character2 == 123)
            --variable;
          else if (character2 == 125 && variable++ == 0 && prev() == 125)
            continue;
        }
        switch (characters2 += from$2(character2), character2 * variable) {
          case 38:
            ampersand = offset2 > 0 ? 1 : (characters2 += "\f", -1);
            break;
          case 44:
            points[index2++] = (strlen(characters2) - 1) * ampersand, ampersand = 1;
            break;
          case 64:
            if (peek() === 45)
              characters2 += delimit(next());
            atrule = peek(), offset2 = length2 = strlen(type4 = characters2 += identifier(caret())), character2++;
            break;
          case 45:
            if (previous2 === 45 && strlen(characters2) == 2)
              variable = 0;
        }
    }
  return rulesets;
}
function ruleset(value2, root2, parent, index2, offset2, rules2, points, type4, props, children, length2, siblings) {
  var post2 = offset2 - 1;
  var rule = offset2 === 0 ? rules2 : [""];
  var size2 = sizeof(rule);
  for (var i2 = 0, j2 = 0, k2 = 0; i2 < index2; ++i2)
    for (var x2 = 0, y2 = substr(value2, post2 + 1, post2 = abs$2(j2 = points[i2])), z2 = value2; x2 < size2; ++x2)
      if (z2 = trim$2(j2 > 0 ? rule[x2] + " " + y2 : replace(y2, /&\f/g, rule[x2])))
        props[k2++] = z2;
  return node$1(value2, root2, parent, offset2 === 0 ? RULESET : type4, props, children, length2, siblings);
}
function comment(value2, root2, parent, siblings) {
  return node$1(value2, root2, parent, COMMENT, from$2(char()), substr(value2, 2, -2), 0, siblings);
}
function declaration(value2, root2, parent, length2, siblings) {
  return node$1(value2, root2, parent, DECLARATION, substr(value2, 0, length2), substr(value2, length2 + 1, -1), length2, siblings);
}
function serialize$1(children, callback2) {
  var output2 = "";
  for (var i2 = 0; i2 < children.length; i2++)
    output2 += callback2(children[i2], i2, children, callback2) || "";
  return output2;
}
function stringify$3(element2, index2, children, callback2) {
  switch (element2.type) {
    case LAYER:
      if (element2.children.length)
        break;
    case IMPORT:
    case NAMESPACE:
    case DECLARATION:
      return element2.return = element2.return || element2.value;
    case COMMENT:
      return "";
    case KEYFRAMES:
      return element2.return = element2.value + "{" + serialize$1(element2.children, callback2) + "}";
    case RULESET:
      if (!strlen(element2.value = element2.props.join(",")))
        return "";
  }
  return strlen(children = serialize$1(element2.children, callback2)) ? element2.return = element2.value + "{" + children + "}" : "";
}
var ATTR_CACHE_MAP = "data-ant-cssinjs-cache-path";
var CSS_FILE_STYLE = "_FILE_STYLE__";
var cachePathMap;
var fromCSSFile = true;
function prepare() {
  if (!cachePathMap) {
    cachePathMap = {};
    if (canUseDom()) {
      var div = document.createElement("div");
      div.className = ATTR_CACHE_MAP;
      div.style.position = "fixed";
      div.style.visibility = "hidden";
      div.style.top = "-9999px";
      document.body.appendChild(div);
      var content2 = getComputedStyle(div).content || "";
      content2 = content2.replace(/^"/, "").replace(/"$/, "");
      content2.split(";").forEach(function(item) {
        var _item$split = item.split(":"), _item$split2 = _slicedToArray(_item$split, 2), path = _item$split2[0], hash = _item$split2[1];
        cachePathMap[path] = hash;
      });
      var inlineMapStyle = document.querySelector("style[".concat(ATTR_CACHE_MAP, "]"));
      if (inlineMapStyle) {
        var _inlineMapStyle$paren;
        fromCSSFile = false;
        (_inlineMapStyle$paren = inlineMapStyle.parentNode) === null || _inlineMapStyle$paren === void 0 || _inlineMapStyle$paren.removeChild(inlineMapStyle);
      }
      document.body.removeChild(div);
    }
  }
}
function existPath(path) {
  prepare();
  return !!cachePathMap[path];
}
function getStyleAndHash(path) {
  var hash = cachePathMap[path];
  var styleStr = null;
  if (hash && canUseDom()) {
    if (fromCSSFile) {
      styleStr = CSS_FILE_STYLE;
    } else {
      var _style = document.querySelector("style[".concat(ATTR_MARK, '="').concat(cachePathMap[path], '"]'));
      if (_style) {
        styleStr = _style.innerHTML;
      } else {
        delete cachePathMap[path];
      }
    }
  }
  return [styleStr, hash];
}
var SKIP_CHECK = "_skip_check_";
var MULTI_VALUE = "_multi_value_";
function normalizeStyle(styleStr) {
  var serialized = serialize$1(compile(styleStr), stringify$3);
  return serialized.replace(/\{%%%\:[^;];}/g, ";");
}
function isCompoundCSSProperty(value2) {
  return _typeof$1(value2) === "object" && value2 && (SKIP_CHECK in value2 || MULTI_VALUE in value2);
}
function injectSelectorHash(key, hashId, hashPriority) {
  if (!hashId) {
    return key;
  }
  var hashClassName = ".".concat(hashId);
  var hashSelector = hashPriority === "low" ? ":where(".concat(hashClassName, ")") : hashClassName;
  var keys2 = key.split(",").map(function(k2) {
    var _firstPath$match;
    var fullPath = k2.trim().split(/\s+/);
    var firstPath = fullPath[0] || "";
    var htmlElement = ((_firstPath$match = firstPath.match(/^\w+/)) === null || _firstPath$match === void 0 ? void 0 : _firstPath$match[0]) || "";
    firstPath = "".concat(htmlElement).concat(hashSelector).concat(firstPath.slice(htmlElement.length));
    return [firstPath].concat(_toConsumableArray(fullPath.slice(1))).join(" ");
  });
  return keys2.join(",");
}
var parseStyle$1 = function parseStyle2(interpolation) {
  var config2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
  var _ref = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
    root: true,
    parentSelectors: []
  }, root2 = _ref.root, injectHash = _ref.injectHash, parentSelectors = _ref.parentSelectors;
  var hashId = config2.hashId, layer2 = config2.layer;
  config2.path;
  var hashPriority = config2.hashPriority, _config$transformers = config2.transformers, transformers = _config$transformers === void 0 ? [] : _config$transformers;
  config2.linters;
  var styleStr = "";
  var effectStyle = {};
  function parseKeyframes(keyframes2) {
    var animationName = keyframes2.getName(hashId);
    if (!effectStyle[animationName]) {
      var _parseStyle = parseStyle2(keyframes2.style, config2, {
        root: false,
        parentSelectors
      }), _parseStyle2 = _slicedToArray(_parseStyle, 1), _parsedStr = _parseStyle2[0];
      effectStyle[animationName] = "@keyframes ".concat(keyframes2.getName(hashId)).concat(_parsedStr);
    }
  }
  function flattenList(list2) {
    var fullList = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
    list2.forEach(function(item) {
      if (Array.isArray(item)) {
        flattenList(item, fullList);
      } else if (item) {
        fullList.push(item);
      }
    });
    return fullList;
  }
  var flattenStyleList = flattenList(Array.isArray(interpolation) ? interpolation : [interpolation]);
  flattenStyleList.forEach(function(originStyle) {
    var style2 = typeof originStyle === "string" && !root2 ? {} : originStyle;
    if (typeof style2 === "string") {
      styleStr += "".concat(style2, "\n");
    } else if (style2._keyframe) {
      parseKeyframes(style2);
    } else {
      var mergedStyle = transformers.reduce(function(prev2, trans) {
        var _trans$visit;
        return (trans === null || trans === void 0 || (_trans$visit = trans.visit) === null || _trans$visit === void 0 ? void 0 : _trans$visit.call(trans, prev2)) || prev2;
      }, style2);
      Object.keys(mergedStyle).forEach(function(key) {
        var value2 = mergedStyle[key];
        if (_typeof$1(value2) === "object" && value2 && (key !== "animationName" || !value2._keyframe) && !isCompoundCSSProperty(value2)) {
          var subInjectHash = false;
          var mergedKey = key.trim();
          var nextRoot = false;
          if ((root2 || injectHash) && hashId) {
            if (mergedKey.startsWith("@")) {
              subInjectHash = true;
            } else if (mergedKey === "&") {
              mergedKey = injectSelectorHash("", hashId, hashPriority);
            } else {
              mergedKey = injectSelectorHash(key, hashId, hashPriority);
            }
          } else if (root2 && !hashId && (mergedKey === "&" || mergedKey === "")) {
            mergedKey = "";
            nextRoot = true;
          }
          var _parseStyle3 = parseStyle2(value2, config2, {
            root: nextRoot,
            injectHash: subInjectHash,
            parentSelectors: [].concat(_toConsumableArray(parentSelectors), [mergedKey])
          }), _parseStyle4 = _slicedToArray(_parseStyle3, 2), _parsedStr2 = _parseStyle4[0], childEffectStyle = _parseStyle4[1];
          effectStyle = _objectSpread2(_objectSpread2({}, effectStyle), childEffectStyle);
          styleStr += "".concat(mergedKey).concat(_parsedStr2);
        } else {
          let appendStyle = function(cssKey, cssValue) {
            var styleName = cssKey.replace(/[A-Z]/g, function(match5) {
              return "-".concat(match5.toLowerCase());
            });
            var formatValue = cssValue;
            if (!unitlessKeys[cssKey] && typeof formatValue === "number" && formatValue !== 0) {
              formatValue = "".concat(formatValue, "px");
            }
            if (cssKey === "animationName" && cssValue !== null && cssValue !== void 0 && cssValue._keyframe) {
              parseKeyframes(cssValue);
              formatValue = cssValue.getName(hashId);
            }
            styleStr += "".concat(styleName, ":").concat(formatValue, ";");
          };
          var _value;
          var actualValue = (_value = value2 === null || value2 === void 0 ? void 0 : value2.value) !== null && _value !== void 0 ? _value : value2;
          if (_typeof$1(value2) === "object" && value2 !== null && value2 !== void 0 && value2[MULTI_VALUE] && Array.isArray(actualValue)) {
            actualValue.forEach(function(item) {
              appendStyle(key, item);
            });
          } else {
            appendStyle(key, actualValue);
          }
        }
      });
    }
  });
  if (!root2) {
    styleStr = "{".concat(styleStr, "}");
  } else if (layer2) {
    if (styleStr) {
      styleStr = "@layer ".concat(layer2.name, " {").concat(styleStr, "}");
    }
    if (layer2.dependencies) {
      effectStyle["@layer ".concat(layer2.name)] = layer2.dependencies.map(function(deps) {
        return "@layer ".concat(deps, ", ").concat(layer2.name, ";");
      }).join("\n");
    }
  }
  return [styleStr, effectStyle];
};
function uniqueHash(path, styleStr) {
  return murmur2("".concat(path.join("%")).concat(styleStr));
}
function Empty() {
  return null;
}
var STYLE_PREFIX = "style";
function useStyleRegister(info2, styleFn) {
  var token2 = info2.token, path = info2.path, hashId = info2.hashId, layer2 = info2.layer, nonce = info2.nonce, clientOnly = info2.clientOnly, _info$order = info2.order, order2 = _info$order === void 0 ? 0 : _info$order;
  var _React$useContext = reactExports.useContext(StyleContext), autoClear = _React$useContext.autoClear;
  _React$useContext.mock;
  var defaultCache = _React$useContext.defaultCache, hashPriority = _React$useContext.hashPriority, container = _React$useContext.container, ssrInline = _React$useContext.ssrInline, transformers = _React$useContext.transformers, linters = _React$useContext.linters, cache2 = _React$useContext.cache, enableLayer = _React$useContext.layer;
  var tokenKey = token2._tokenKey;
  var fullPath = [tokenKey];
  if (enableLayer) {
    fullPath.push("layer");
  }
  fullPath.push.apply(fullPath, _toConsumableArray(path));
  var isMergedClientSide = isClientSide;
  var _useGlobalCache = useGlobalCache(
    STYLE_PREFIX,
    fullPath,
    // Create cache if needed
    function() {
      var cachePath = fullPath.join("|");
      if (existPath(cachePath)) {
        var _getStyleAndHash = getStyleAndHash(cachePath), _getStyleAndHash2 = _slicedToArray(_getStyleAndHash, 2), inlineCacheStyleStr = _getStyleAndHash2[0], styleHash = _getStyleAndHash2[1];
        if (inlineCacheStyleStr) {
          return [inlineCacheStyleStr, tokenKey, styleHash, {}, clientOnly, order2];
        }
      }
      var styleObj = styleFn();
      var _parseStyle5 = parseStyle$1(styleObj, {
        hashId,
        hashPriority,
        layer: enableLayer ? layer2 : void 0,
        path: path.join("-"),
        transformers,
        linters
      }), _parseStyle6 = _slicedToArray(_parseStyle5, 2), parsedStyle = _parseStyle6[0], effectStyle = _parseStyle6[1];
      var styleStr = normalizeStyle(parsedStyle);
      var styleId = uniqueHash(fullPath, styleStr);
      return [styleStr, tokenKey, styleId, effectStyle, clientOnly, order2];
    },
    // Remove cache if no need
    function(_ref2, fromHMR) {
      var _ref3 = _slicedToArray(_ref2, 3), styleId = _ref3[2];
      if ((fromHMR || autoClear) && isClientSide) {
        removeCSS(styleId, {
          mark: ATTR_MARK,
          attachTo: container
        });
      }
    },
    // Effect: Inject style here
    function(_ref4) {
      var _ref5 = _slicedToArray(_ref4, 4), styleStr = _ref5[0];
      _ref5[1];
      var styleId = _ref5[2], effectStyle = _ref5[3];
      if (isMergedClientSide && styleStr !== CSS_FILE_STYLE) {
        var mergedCSSConfig = {
          mark: ATTR_MARK,
          prepend: enableLayer ? false : "queue",
          attachTo: container,
          priority: order2
        };
        var nonceStr = typeof nonce === "function" ? nonce() : nonce;
        if (nonceStr) {
          mergedCSSConfig.csp = {
            nonce: nonceStr
          };
        }
        var effectLayerKeys = [];
        var effectRestKeys = [];
        Object.keys(effectStyle).forEach(function(key) {
          if (key.startsWith("@layer")) {
            effectLayerKeys.push(key);
          } else {
            effectRestKeys.push(key);
          }
        });
        effectLayerKeys.forEach(function(effectKey) {
          updateCSS(normalizeStyle(effectStyle[effectKey]), "_layer-".concat(effectKey), _objectSpread2(_objectSpread2({}, mergedCSSConfig), {}, {
            prepend: true
          }));
        });
        var style2 = updateCSS(styleStr, styleId, mergedCSSConfig);
        style2[CSS_IN_JS_INSTANCE] = cache2.instanceId;
        style2.setAttribute(ATTR_TOKEN, tokenKey);
        effectRestKeys.forEach(function(effectKey) {
          updateCSS(normalizeStyle(effectStyle[effectKey]), "_effect-".concat(effectKey), mergedCSSConfig);
        });
      }
    }
  ), _useGlobalCache2 = _slicedToArray(_useGlobalCache, 3), cachedStyleStr = _useGlobalCache2[0], cachedTokenKey = _useGlobalCache2[1], cachedStyleId = _useGlobalCache2[2];
  return function(node2) {
    var styleNode;
    if (!ssrInline || isMergedClientSide || !defaultCache) {
      styleNode = /* @__PURE__ */ reactExports.createElement(Empty, null);
    } else {
      styleNode = /* @__PURE__ */ reactExports.createElement("style", _extends$h({}, _defineProperty$3(_defineProperty$3({}, ATTR_TOKEN, cachedTokenKey), ATTR_MARK, cachedStyleId), {
        dangerouslySetInnerHTML: {
          __html: cachedStyleStr
        }
      }));
    }
    return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, styleNode, node2);
  };
}
var extract$1 = function extract22(cache2, effectStyles, options) {
  var _cache = _slicedToArray(cache2, 6), styleStr = _cache[0], tokenKey = _cache[1], styleId = _cache[2], effectStyle = _cache[3], clientOnly = _cache[4], order2 = _cache[5];
  var _ref7 = options || {}, plain = _ref7.plain;
  if (clientOnly) {
    return null;
  }
  var keyStyleText = styleStr;
  var sharedAttrs = {
    "data-rc-order": "prependQueue",
    "data-rc-priority": "".concat(order2)
  };
  keyStyleText = toStyleStr(styleStr, tokenKey, styleId, sharedAttrs, plain);
  if (effectStyle) {
    Object.keys(effectStyle).forEach(function(effectKey) {
      if (!effectStyles[effectKey]) {
        effectStyles[effectKey] = true;
        var effectStyleStr = normalizeStyle(effectStyle[effectKey]);
        var effectStyleHTML = toStyleStr(effectStyleStr, tokenKey, "_effect-".concat(effectKey), sharedAttrs, plain);
        if (effectKey.startsWith("@layer")) {
          keyStyleText = effectStyleHTML + keyStyleText;
        } else {
          keyStyleText += effectStyleHTML;
        }
      }
    });
  }
  return [order2, styleId, keyStyleText];
};
var CSS_VAR_PREFIX = "cssVar";
var useCSSVarRegister = function useCSSVarRegister2(config2, fn) {
  var key = config2.key, prefix = config2.prefix, unitless2 = config2.unitless, ignore2 = config2.ignore, token2 = config2.token, _config$scope = config2.scope, scope = _config$scope === void 0 ? "" : _config$scope;
  var _useContext = reactExports.useContext(StyleContext), instanceId = _useContext.cache.instanceId, container = _useContext.container;
  var tokenKey = token2._tokenKey;
  var stylePath = [].concat(_toConsumableArray(config2.path), [key, scope, tokenKey]);
  var cache2 = useGlobalCache(CSS_VAR_PREFIX, stylePath, function() {
    var originToken = fn();
    var _transformToken = transformToken(originToken, key, {
      prefix,
      unitless: unitless2,
      ignore: ignore2,
      scope
    }), _transformToken2 = _slicedToArray(_transformToken, 2), mergedToken = _transformToken2[0], cssVarsStr = _transformToken2[1];
    var styleId = uniqueHash(stylePath, cssVarsStr);
    return [mergedToken, cssVarsStr, styleId, key];
  }, function(_ref) {
    var _ref2 = _slicedToArray(_ref, 3), styleId = _ref2[2];
    if (isClientSide) {
      removeCSS(styleId, {
        mark: ATTR_MARK,
        attachTo: container
      });
    }
  }, function(_ref3) {
    var _ref4 = _slicedToArray(_ref3, 3), cssVarsStr = _ref4[1], styleId = _ref4[2];
    if (!cssVarsStr) {
      return;
    }
    var style2 = updateCSS(cssVarsStr, styleId, {
      mark: ATTR_MARK,
      prepend: "queue",
      attachTo: container,
      priority: -999
    });
    style2[CSS_IN_JS_INSTANCE] = instanceId;
    style2.setAttribute(ATTR_TOKEN, key);
  });
  return cache2;
};
var extract = function extract3(cache2, effectStyles, options) {
  var _cache = _slicedToArray(cache2, 4), styleStr = _cache[1], styleId = _cache[2], cssVarKey = _cache[3];
  var _ref5 = options || {}, plain = _ref5.plain;
  if (!styleStr) {
    return null;
  }
  var order2 = -999;
  var sharedAttrs = {
    "data-rc-order": "prependQueue",
    "data-rc-priority": "".concat(order2)
  };
  var styleText = toStyleStr(styleStr, cssVarKey, styleId, sharedAttrs, plain);
  return [order2, styleId, styleText];
};
_defineProperty$3(_defineProperty$3(_defineProperty$3({}, STYLE_PREFIX, extract$1), TOKEN_PREFIX, extract$2), CSS_VAR_PREFIX, extract);
var Keyframe = /* @__PURE__ */ function() {
  function Keyframe2(name2, style2) {
    _classCallCheck$a(this, Keyframe2);
    _defineProperty$3(this, "name", void 0);
    _defineProperty$3(this, "style", void 0);
    _defineProperty$3(this, "_keyframe", true);
    this.name = name2;
    this.style = style2;
  }
  _createClass$8(Keyframe2, [{
    key: "getName",
    value: function getName() {
      var hashId = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
      return hashId ? "".concat(hashId, "-").concat(this.name) : this.name;
    }
  }]);
  return Keyframe2;
}();
function noSplit(list2) {
  list2.notSplit = true;
  return list2;
}
({
  // Border
  borderBlock: noSplit(["borderTop", "borderBottom"]),
  borderBlockStart: noSplit(["borderTop"]),
  borderBlockEnd: noSplit(["borderBottom"]),
  borderInline: noSplit(["borderLeft", "borderRight"]),
  borderInlineStart: noSplit(["borderLeft"]),
  borderInlineEnd: noSplit(["borderRight"])
});
var IconContext$1 = /* @__PURE__ */ reactExports.createContext({});
function _toArray(r2) {
  return _arrayWithHoles(r2) || _iterableToArray(r2) || _unsupportedIterableToArray(r2) || _nonIterableRest();
}
function get$a(entity, path) {
  var current = entity;
  for (var i2 = 0; i2 < path.length; i2 += 1) {
    if (current === null || current === void 0) {
      return void 0;
    }
    current = current[path[i2]];
  }
  return current;
}
function internalSet(entity, paths, value2, removeIfUndefined) {
  if (!paths.length) {
    return value2;
  }
  var _paths = _toArray(paths), path = _paths[0], restPath = _paths.slice(1);
  var clone3;
  if (!entity && typeof path === "number") {
    clone3 = [];
  } else if (Array.isArray(entity)) {
    clone3 = _toConsumableArray(entity);
  } else {
    clone3 = _objectSpread2({}, entity);
  }
  if (removeIfUndefined && value2 === void 0 && restPath.length === 1) {
    delete clone3[path][restPath[0]];
  } else {
    clone3[path] = internalSet(clone3[path], restPath, value2, removeIfUndefined);
  }
  return clone3;
}
function set$3(entity, paths, value2) {
  var removeIfUndefined = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
  if (paths.length && removeIfUndefined && value2 === void 0 && !get$a(entity, paths.slice(0, -1))) {
    return entity;
  }
  return internalSet(entity, paths, value2, removeIfUndefined);
}
function isObject$c(obj) {
  return _typeof$1(obj) === "object" && obj !== null && Object.getPrototypeOf(obj) === Object.prototype;
}
function createEmpty(source2) {
  return Array.isArray(source2) ? [] : {};
}
var keys$9 = typeof Reflect === "undefined" ? Object.keys : Reflect.ownKeys;
function merge$5() {
  for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) {
    sources[_key] = arguments[_key];
  }
  var clone3 = createEmpty(sources[0]);
  sources.forEach(function(src) {
    function internalMerge(path, parentLoopSet) {
      var loopSet = new Set(parentLoopSet);
      var value2 = get$a(src, path);
      var isArr = Array.isArray(value2);
      if (isArr || isObject$c(value2)) {
        if (!loopSet.has(value2)) {
          loopSet.add(value2);
          var originValue = get$a(clone3, path);
          if (isArr) {
            clone3 = set$3(clone3, path, []);
          } else if (!originValue || _typeof$1(originValue) !== "object") {
            clone3 = set$3(clone3, path, createEmpty(value2));
          }
          keys$9(value2).forEach(function(key) {
            internalMerge([].concat(_toConsumableArray(path), [key]), loopSet);
          });
        }
      } else {
        clone3 = set$3(clone3, path, value2);
      }
    }
    internalMerge([]);
  });
  return clone3;
}
function noop$7() {
}
const WarningContext = /* @__PURE__ */ reactExports.createContext({});
const devUseWarning = () => {
  const noopWarning = () => {
  };
  noopWarning.deprecated = noop$7;
  return noopWarning;
};
const ValidateMessagesContext = /* @__PURE__ */ reactExports.createContext(void 0);
const typeTemplate$1 = "${label} is not a valid ${type}";
const localeValues = {
  Modal: {
    okText: "OK",
    cancelText: "Cancel",
    justOkText: "OK"
  },
  Form: {
    optional: "(optional)",
    defaultValidateMessages: {
      default: "Field validation error for ${label}",
      required: "Please enter ${label}",
      enum: "${label} must be one of [${enum}]",
      whitespace: "${label} cannot be a blank character",
      date: {
        format: "${label} date format is invalid",
        parse: "${label} cannot be converted to a date",
        invalid: "${label} is an invalid date"
      },
      types: {
        string: typeTemplate$1,
        method: typeTemplate$1,
        array: typeTemplate$1,
        object: typeTemplate$1,
        number: typeTemplate$1,
        date: typeTemplate$1,
        boolean: typeTemplate$1,
        integer: typeTemplate$1,
        float: typeTemplate$1,
        regexp: typeTemplate$1,
        email: typeTemplate$1,
        url: typeTemplate$1,
        hex: typeTemplate$1
      },
      string: {
        len: "${label} must be ${len} characters",
        min: "${label} must be at least ${min} characters",
        max: "${label} must be up to ${max} characters",
        range: "${label} must be between ${min}-${max} characters"
      },
      number: {
        len: "${label} must be equal to ${len}",
        min: "${label} must be minimum ${min}",
        max: "${label} must be maximum ${max}",
        range: "${label} must be between ${min}-${max}"
      },
      array: {
        len: "Must be ${len} ${label}",
        min: "At least ${min} ${label}",
        max: "At most ${max} ${label}",
        range: "The amount of ${label} must be between ${min}-${max}"
      },
      pattern: {
        mismatch: "${label} does not match the pattern ${pattern}"
      }
    }
  }
};
Object.assign({}, localeValues.Modal);
let localeList = [];
const generateLocale = () => localeList.reduce((merged, locale2) => Object.assign(Object.assign({}, merged), locale2), localeValues.Modal);
function changeConfirmLocale(newLocale) {
  if (newLocale) {
    const cloneLocale = Object.assign({}, newLocale);
    localeList.push(cloneLocale);
    generateLocale();
    return () => {
      localeList = localeList.filter((locale2) => locale2 !== cloneLocale);
      generateLocale();
    };
  }
  Object.assign({}, localeValues.Modal);
}
const LocaleContext = /* @__PURE__ */ reactExports.createContext(void 0);
const ANT_MARK = "internalMark";
const LocaleProvider = (props) => {
  const {
    locale: locale2 = {},
    children,
    _ANT_MARK__
  } = props;
  reactExports.useEffect(() => {
    const clearLocale = changeConfirmLocale(locale2 === null || locale2 === void 0 ? void 0 : locale2.Modal);
    return clearLocale;
  }, [locale2]);
  const getMemoizedContextValue = reactExports.useMemo(() => Object.assign(Object.assign({}, locale2), {
    exist: true
  }), [locale2]);
  return /* @__PURE__ */ reactExports.createElement(LocaleContext.Provider, {
    value: getMemoizedContextValue
  }, children);
};
const defaultPresetColors = {
  blue: "#1677FF",
  purple: "#722ED1",
  cyan: "#13C2C2",
  green: "#52C41A",
  magenta: "#EB2F96",
  /**
   * @deprecated Use magenta instead
   */
  pink: "#EB2F96",
  red: "#F5222D",
  orange: "#FA8C16",
  yellow: "#FADB14",
  volcano: "#FA541C",
  geekblue: "#2F54EB",
  gold: "#FAAD14",
  lime: "#A0D911"
};
const seedToken = Object.assign(Object.assign({}, defaultPresetColors), {
  // Color
  colorPrimary: "#1677ff",
  colorSuccess: "#52c41a",
  colorWarning: "#faad14",
  colorError: "#ff4d4f",
  colorInfo: "#1677ff",
  colorLink: "",
  colorTextBase: "",
  colorBgBase: "",
  // Font
  fontFamily: `-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji'`,
  fontFamilyCode: `'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace`,
  fontSize: 14,
  // Line
  lineWidth: 1,
  lineType: "solid",
  // Motion
  motionUnit: 0.1,
  motionBase: 0,
  motionEaseOutCirc: "cubic-bezier(0.08, 0.82, 0.17, 1)",
  motionEaseInOutCirc: "cubic-bezier(0.78, 0.14, 0.15, 0.86)",
  motionEaseOut: "cubic-bezier(0.215, 0.61, 0.355, 1)",
  motionEaseInOut: "cubic-bezier(0.645, 0.045, 0.355, 1)",
  motionEaseOutBack: "cubic-bezier(0.12, 0.4, 0.29, 1.46)",
  motionEaseInBack: "cubic-bezier(0.71, -0.46, 0.88, 0.6)",
  motionEaseInQuint: "cubic-bezier(0.755, 0.05, 0.855, 0.06)",
  motionEaseOutQuint: "cubic-bezier(0.23, 1, 0.32, 1)",
  // Radius
  borderRadius: 6,
  // Size
  sizeUnit: 4,
  sizeStep: 4,
  sizePopupArrow: 16,
  // Control Base
  controlHeight: 32,
  // zIndex
  zIndexBase: 0,
  zIndexPopupBase: 1e3,
  // Image
  opacityImage: 1,
  // Wireframe
  wireframe: false,
  // Motion
  motion: true
});
const round$2 = Math.round;
function splitColorStr(str, parseNum) {
  const match5 = str.replace(/^[^(]*\((.*)/, "$1").replace(/\).*/, "").match(/\d*\.?\d+%?/g) || [];
  const numList = match5.map((item) => parseFloat(item));
  for (let i2 = 0; i2 < 3; i2 += 1) {
    numList[i2] = parseNum(numList[i2] || 0, match5[i2] || "", i2);
  }
  if (match5[3]) {
    numList[3] = match5[3].includes("%") ? numList[3] / 100 : numList[3];
  } else {
    numList[3] = 1;
  }
  return numList;
}
const parseHSVorHSL = (num, _24, index2) => index2 === 0 ? num : num / 100;
function limitRange(value2, max2) {
  const mergedMax = max2 || 255;
  if (value2 > mergedMax) {
    return mergedMax;
  }
  if (value2 < 0) {
    return 0;
  }
  return value2;
}
class FastColor {
  constructor(input2) {
    _defineProperty$3(this, "isValid", true);
    _defineProperty$3(this, "r", 0);
    _defineProperty$3(this, "g", 0);
    _defineProperty$3(this, "b", 0);
    _defineProperty$3(this, "a", 1);
    _defineProperty$3(this, "_h", void 0);
    _defineProperty$3(this, "_s", void 0);
    _defineProperty$3(this, "_l", void 0);
    _defineProperty$3(this, "_v", void 0);
    _defineProperty$3(this, "_max", void 0);
    _defineProperty$3(this, "_min", void 0);
    _defineProperty$3(this, "_brightness", void 0);
    function matchFormat(str) {
      return str[0] in input2 && str[1] in input2 && str[2] in input2;
    }
    if (!input2)
      ;
    else if (typeof input2 === "string") {
      let matchPrefix = function(prefix) {
        return trimStr.startsWith(prefix);
      };
      const trimStr = input2.trim();
      if (/^#?[A-F\d]{3,8}$/i.test(trimStr)) {
        this.fromHexString(trimStr);
      } else if (matchPrefix("rgb")) {
        this.fromRgbString(trimStr);
      } else if (matchPrefix("hsl")) {
        this.fromHslString(trimStr);
      } else if (matchPrefix("hsv") || matchPrefix("hsb")) {
        this.fromHsvString(trimStr);
      }
    } else if (input2 instanceof FastColor) {
      this.r = input2.r;
      this.g = input2.g;
      this.b = input2.b;
      this.a = input2.a;
      this._h = input2._h;
      this._s = input2._s;
      this._l = input2._l;
      this._v = input2._v;
    } else if (matchFormat("rgb")) {
      this.r = limitRange(input2.r);
      this.g = limitRange(input2.g);
      this.b = limitRange(input2.b);
      this.a = typeof input2.a === "number" ? limitRange(input2.a, 1) : 1;
    } else if (matchFormat("hsl")) {
      this.fromHsl(input2);
    } else if (matchFormat("hsv")) {
      this.fromHsv(input2);
    } else {
      throw new Error("@ant-design/fast-color: unsupported input " + JSON.stringify(input2));
    }
  }
  // ======================= Setter =======================
  setR(value2) {
    return this._sc("r", value2);
  }
  setG(value2) {
    return this._sc("g", value2);
  }
  setB(value2) {
    return this._sc("b", value2);
  }
  setA(value2) {
    return this._sc("a", value2, 1);
  }
  setHue(value2) {
    const hsv = this.toHsv();
    hsv.h = value2;
    return this._c(hsv);
  }
  // ======================= Getter =======================
  /**
   * Returns the perceived luminance of a color, from 0-1.
   * @see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
   */
  getLuminance() {
    function adjustGamma(raw) {
      const val = raw / 255;
      return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);
    }
    const R2 = adjustGamma(this.r);
    const G2 = adjustGamma(this.g);
    const B2 = adjustGamma(this.b);
    return 0.2126 * R2 + 0.7152 * G2 + 0.0722 * B2;
  }
  getHue() {
    if (typeof this._h === "undefined") {
      const delta = this.getMax() - this.getMin();
      if (delta === 0) {
        this._h = 0;
      } else {
        this._h = round$2(60 * (this.r === this.getMax() ? (this.g - this.b) / delta + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / delta + 2 : (this.r - this.g) / delta + 4));
      }
    }
    return this._h;
  }
  getSaturation() {
    if (typeof this._s === "undefined") {
      const delta = this.getMax() - this.getMin();
      if (delta === 0) {
        this._s = 0;
      } else {
        this._s = delta / this.getMax();
      }
    }
    return this._s;
  }
  getLightness() {
    if (typeof this._l === "undefined") {
      this._l = (this.getMax() + this.getMin()) / 510;
    }
    return this._l;
  }
  getValue() {
    if (typeof this._v === "undefined") {
      this._v = this.getMax() / 255;
    }
    return this._v;
  }
  /**
   * Returns the perceived brightness of the color, from 0-255.
   * Note: this is not the b of HSB
   * @see http://www.w3.org/TR/AERT#color-contrast
   */
  getBrightness() {
    if (typeof this._brightness === "undefined") {
      this._brightness = (this.r * 299 + this.g * 587 + this.b * 114) / 1e3;
    }
    return this._brightness;
  }
  // ======================== Func ========================
  darken(amount = 10) {
    const h3 = this.getHue();
    const s2 = this.getSaturation();
    let l2 = this.getLightness() - amount / 100;
    if (l2 < 0) {
      l2 = 0;
    }
    return this._c({
      h: h3,
      s: s2,
      l: l2,
      a: this.a
    });
  }
  lighten(amount = 10) {
    const h3 = this.getHue();
    const s2 = this.getSaturation();
    let l2 = this.getLightness() + amount / 100;
    if (l2 > 1) {
      l2 = 1;
    }
    return this._c({
      h: h3,
      s: s2,
      l: l2,
      a: this.a
    });
  }
  /**
   * Mix the current color a given amount with another color, from 0 to 100.
   * 0 means no mixing (return current color).
   */
  mix(input2, amount = 50) {
    const color2 = this._c(input2);
    const p2 = amount / 100;
    const calc = (key) => (color2[key] - this[key]) * p2 + this[key];
    const rgba2 = {
      r: round$2(calc("r")),
      g: round$2(calc("g")),
      b: round$2(calc("b")),
      a: round$2(calc("a") * 100) / 100
    };
    return this._c(rgba2);
  }
  /**
   * Mix the color with pure white, from 0 to 100.
   * Providing 0 will do nothing, providing 100 will always return white.
   */
  tint(amount = 10) {
    return this.mix({
      r: 255,
      g: 255,
      b: 255,
      a: 1
    }, amount);
  }
  /**
   * Mix the color with pure black, from 0 to 100.
   * Providing 0 will do nothing, providing 100 will always return black.
   */
  shade(amount = 10) {
    return this.mix({
      r: 0,
      g: 0,
      b: 0,
      a: 1
    }, amount);
  }
  onBackground(background) {
    const bg2 = this._c(background);
    const alpha2 = this.a + bg2.a * (1 - this.a);
    const calc = (key) => {
      return round$2((this[key] * this.a + bg2[key] * bg2.a * (1 - this.a)) / alpha2);
    };
    return this._c({
      r: calc("r"),
      g: calc("g"),
      b: calc("b"),
      a: alpha2
    });
  }
  // ======================= Status =======================
  isDark() {
    return this.getBrightness() < 128;
  }
  isLight() {
    return this.getBrightness() >= 128;
  }
  // ======================== MISC ========================
  equals(other) {
    return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
  }
  clone() {
    return this._c(this);
  }
  // ======================= Format =======================
  toHexString() {
    let hex3 = "#";
    const rHex = (this.r || 0).toString(16);
    hex3 += rHex.length === 2 ? rHex : "0" + rHex;
    const gHex = (this.g || 0).toString(16);
    hex3 += gHex.length === 2 ? gHex : "0" + gHex;
    const bHex = (this.b || 0).toString(16);
    hex3 += bHex.length === 2 ? bHex : "0" + bHex;
    if (typeof this.a === "number" && this.a >= 0 && this.a < 1) {
      const aHex = round$2(this.a * 255).toString(16);
      hex3 += aHex.length === 2 ? aHex : "0" + aHex;
    }
    return hex3;
  }
  /** CSS support color pattern */
  toHsl() {
    return {
      h: this.getHue(),
      s: this.getSaturation(),
      l: this.getLightness(),
      a: this.a
    };
  }
  /** CSS support color pattern */
  toHslString() {
    const h3 = this.getHue();
    const s2 = round$2(this.getSaturation() * 100);
    const l2 = round$2(this.getLightness() * 100);
    return this.a !== 1 ? `hsla(${h3},${s2}%,${l2}%,${this.a})` : `hsl(${h3},${s2}%,${l2}%)`;
  }
  /** Same as toHsb */
  toHsv() {
    return {
      h: this.getHue(),
      s: this.getSaturation(),
      v: this.getValue(),
      a: this.a
    };
  }
  toRgb() {
    return {
      r: this.r,
      g: this.g,
      b: this.b,
      a: this.a
    };
  }
  toRgbString() {
    return this.a !== 1 ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`;
  }
  toString() {
    return this.toRgbString();
  }
  // ====================== Privates ======================
  /** Return a new FastColor object with one channel changed */
  _sc(rgb, value2, max2) {
    const clone3 = this.clone();
    clone3[rgb] = limitRange(value2, max2);
    return clone3;
  }
  _c(input2) {
    return new this.constructor(input2);
  }
  getMax() {
    if (typeof this._max === "undefined") {
      this._max = Math.max(this.r, this.g, this.b);
    }
    return this._max;
  }
  getMin() {
    if (typeof this._min === "undefined") {
      this._min = Math.min(this.r, this.g, this.b);
    }
    return this._min;
  }
  fromHexString(trimStr) {
    const withoutPrefix = trimStr.replace("#", "");
    function connectNum(index1, index2) {
      return parseInt(withoutPrefix[index1] + withoutPrefix[index2 || index1], 16);
    }
    if (withoutPrefix.length < 6) {
      this.r = connectNum(0);
      this.g = connectNum(1);
      this.b = connectNum(2);
      this.a = withoutPrefix[3] ? connectNum(3) / 255 : 1;
    } else {
      this.r = connectNum(0, 1);
      this.g = connectNum(2, 3);
      this.b = connectNum(4, 5);
      this.a = withoutPrefix[6] ? connectNum(6, 7) / 255 : 1;
    }
  }
  fromHsl({
    h: h3,
    s: s2,
    l: l2,
    a: a2
  }) {
    this._h = h3 % 360;
    this._s = s2;
    this._l = l2;
    this.a = typeof a2 === "number" ? a2 : 1;
    if (s2 <= 0) {
      const rgb = round$2(l2 * 255);
      this.r = rgb;
      this.g = rgb;
      this.b = rgb;
    }
    let r2 = 0, g2 = 0, b2 = 0;
    const huePrime = h3 / 60;
    const chroma = (1 - Math.abs(2 * l2 - 1)) * s2;
    const secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
    if (huePrime >= 0 && huePrime < 1) {
      r2 = chroma;
      g2 = secondComponent;
    } else if (huePrime >= 1 && huePrime < 2) {
      r2 = secondComponent;
      g2 = chroma;
    } else if (huePrime >= 2 && huePrime < 3) {
      g2 = chroma;
      b2 = secondComponent;
    } else if (huePrime >= 3 && huePrime < 4) {
      g2 = secondComponent;
      b2 = chroma;
    } else if (huePrime >= 4 && huePrime < 5) {
      r2 = secondComponent;
      b2 = chroma;
    } else if (huePrime >= 5 && huePrime < 6) {
      r2 = chroma;
      b2 = secondComponent;
    }
    const lightnessModification = l2 - chroma / 2;
    this.r = round$2((r2 + lightnessModification) * 255);
    this.g = round$2((g2 + lightnessModification) * 255);
    this.b = round$2((b2 + lightnessModification) * 255);
  }
  fromHsv({
    h: h3,
    s: s2,
    v: v2,
    a: a2
  }) {
    this._h = h3 % 360;
    this._s = s2;
    this._v = v2;
    this.a = typeof a2 === "number" ? a2 : 1;
    const vv = round$2(v2 * 255);
    this.r = vv;
    this.g = vv;
    this.b = vv;
    if (s2 <= 0) {
      return;
    }
    const hh2 = h3 / 60;
    const i2 = Math.floor(hh2);
    const ff2 = hh2 - i2;
    const p2 = round$2(v2 * (1 - s2) * 255);
    const q2 = round$2(v2 * (1 - s2 * ff2) * 255);
    const t2 = round$2(v2 * (1 - s2 * (1 - ff2)) * 255);
    switch (i2) {
      case 0:
        this.g = t2;
        this.b = p2;
        break;
      case 1:
        this.r = q2;
        this.b = p2;
        break;
      case 2:
        this.r = p2;
        this.b = t2;
        break;
      case 3:
        this.r = p2;
        this.g = q2;
        break;
      case 4:
        this.r = t2;
        this.g = p2;
        break;
      case 5:
      default:
        this.g = p2;
        this.b = q2;
        break;
    }
  }
  fromHsvString(trimStr) {
    const cells = splitColorStr(trimStr, parseHSVorHSL);
    this.fromHsv({
      h: cells[0],
      s: cells[1],
      v: cells[2],
      a: cells[3]
    });
  }
  fromHslString(trimStr) {
    const cells = splitColorStr(trimStr, parseHSVorHSL);
    this.fromHsl({
      h: cells[0],
      s: cells[1],
      l: cells[2],
      a: cells[3]
    });
  }
  fromRgbString(trimStr) {
    const cells = splitColorStr(trimStr, (num, txt) => (
      // Convert percentage to number. e.g. 50% -> 128
      txt.includes("%") ? round$2(num / 100 * 255) : num
    ));
    this.r = cells[0];
    this.g = cells[1];
    this.b = cells[2];
    this.a = cells[3];
  }
}
var hueStep = 2;
var saturationStep = 0.16;
var saturationStep2 = 0.05;
var brightnessStep1 = 0.05;
var brightnessStep2 = 0.15;
var lightColorCount = 5;
var darkColorCount = 4;
var darkColorMap = [{
  index: 7,
  amount: 15
}, {
  index: 6,
  amount: 25
}, {
  index: 5,
  amount: 30
}, {
  index: 5,
  amount: 45
}, {
  index: 5,
  amount: 65
}, {
  index: 5,
  amount: 85
}, {
  index: 4,
  amount: 90
}, {
  index: 3,
  amount: 95
}, {
  index: 2,
  amount: 97
}, {
  index: 1,
  amount: 98
}];
function getHue(hsv, i2, light2) {
  var hue2;
  if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
    hue2 = light2 ? Math.round(hsv.h) - hueStep * i2 : Math.round(hsv.h) + hueStep * i2;
  } else {
    hue2 = light2 ? Math.round(hsv.h) + hueStep * i2 : Math.round(hsv.h) - hueStep * i2;
  }
  if (hue2 < 0) {
    hue2 += 360;
  } else if (hue2 >= 360) {
    hue2 -= 360;
  }
  return hue2;
}
function getSaturation(hsv, i2, light2) {
  if (hsv.h === 0 && hsv.s === 0) {
    return hsv.s;
  }
  var saturation;
  if (light2) {
    saturation = hsv.s - saturationStep * i2;
  } else if (i2 === darkColorCount) {
    saturation = hsv.s + saturationStep;
  } else {
    saturation = hsv.s + saturationStep2 * i2;
  }
  if (saturation > 1) {
    saturation = 1;
  }
  if (light2 && i2 === lightColorCount && saturation > 0.1) {
    saturation = 0.1;
  }
  if (saturation < 0.06) {
    saturation = 0.06;
  }
  return Math.round(saturation * 100) / 100;
}
function getValue$5(hsv, i2, light2) {
  var value2;
  if (light2) {
    value2 = hsv.v + brightnessStep1 * i2;
  } else {
    value2 = hsv.v - brightnessStep2 * i2;
  }
  value2 = Math.max(0, Math.min(1, value2));
  return Math.round(value2 * 100) / 100;
}
function generate$1(color2) {
  var opts2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
  var patterns = [];
  var pColor = new FastColor(color2);
  var hsv = pColor.toHsv();
  for (var i2 = lightColorCount; i2 > 0; i2 -= 1) {
    var c2 = new FastColor({
      h: getHue(hsv, i2, true),
      s: getSaturation(hsv, i2, true),
      v: getValue$5(hsv, i2, true)
    });
    patterns.push(c2);
  }
  patterns.push(pColor);
  for (var _i = 1; _i <= darkColorCount; _i += 1) {
    var _c2 = new FastColor({
      h: getHue(hsv, _i),
      s: getSaturation(hsv, _i),
      v: getValue$5(hsv, _i)
    });
    patterns.push(_c2);
  }
  if (opts2.theme === "dark") {
    return darkColorMap.map(function(_ref) {
      var index2 = _ref.index, amount = _ref.amount;
      return new FastColor(opts2.backgroundColor || "#141414").mix(patterns[index2], amount).toHexString();
    });
  }
  return patterns.map(function(c3) {
    return c3.toHexString();
  });
}
var presetPrimaryColors = {
  "red": "#F5222D",
  "volcano": "#FA541C",
  "orange": "#FA8C16",
  "gold": "#FAAD14",
  "yellow": "#FADB14",
  "lime": "#A0D911",
  "green": "#52C41A",
  "cyan": "#13C2C2",
  "blue": "#1677FF",
  "geekblue": "#2F54EB",
  "purple": "#722ED1",
  "magenta": "#EB2F96",
  "grey": "#666666"
};
var red$1 = ["#fff1f0", "#ffccc7", "#ffa39e", "#ff7875", "#ff4d4f", "#f5222d", "#cf1322", "#a8071a", "#820014", "#5c0011"];
red$1.primary = red$1[5];
var volcano = ["#fff2e8", "#ffd8bf", "#ffbb96", "#ff9c6e", "#ff7a45", "#fa541c", "#d4380d", "#ad2102", "#871400", "#610b00"];
volcano.primary = volcano[5];
var orange$1 = ["#fff7e6", "#ffe7ba", "#ffd591", "#ffc069", "#ffa940", "#fa8c16", "#d46b08", "#ad4e00", "#873800", "#612500"];
orange$1.primary = orange$1[5];
var gold = ["#fffbe6", "#fff1b8", "#ffe58f", "#ffd666", "#ffc53d", "#faad14", "#d48806", "#ad6800", "#874d00", "#613400"];
gold.primary = gold[5];
var yellow$1 = ["#feffe6", "#ffffb8", "#fffb8f", "#fff566", "#ffec3d", "#fadb14", "#d4b106", "#ad8b00", "#876800", "#614700"];
yellow$1.primary = yellow$1[5];
var lime$1 = ["#fcffe6", "#f4ffb8", "#eaff8f", "#d3f261", "#bae637", "#a0d911", "#7cb305", "#5b8c00", "#3f6600", "#254000"];
lime$1.primary = lime$1[5];
var green$1 = ["#f6ffed", "#d9f7be", "#b7eb8f", "#95de64", "#73d13d", "#52c41a", "#389e0d", "#237804", "#135200", "#092b00"];
green$1.primary = green$1[5];
var cyan$1 = ["#e6fffb", "#b5f5ec", "#87e8de", "#5cdbd3", "#36cfc9", "#13c2c2", "#08979c", "#006d75", "#00474f", "#002329"];
cyan$1.primary = cyan$1[5];
var blue$1 = ["#e6f4ff", "#bae0ff", "#91caff", "#69b1ff", "#4096ff", "#1677ff", "#0958d9", "#003eb3", "#002c8c", "#001d66"];
blue$1.primary = blue$1[5];
var geekblue = ["#f0f5ff", "#d6e4ff", "#adc6ff", "#85a5ff", "#597ef7", "#2f54eb", "#1d39c4", "#10239e", "#061178", "#030852"];
geekblue.primary = geekblue[5];
var purple$1 = ["#f9f0ff", "#efdbff", "#d3adf7", "#b37feb", "#9254de", "#722ed1", "#531dab", "#391085", "#22075e", "#120338"];
purple$1.primary = purple$1[5];
var magenta = ["#fff0f6", "#ffd6e7", "#ffadd2", "#ff85c0", "#f759ab", "#eb2f96", "#c41d7f", "#9e1068", "#780650", "#520339"];
magenta.primary = magenta[5];
var grey = ["#a6a6a6", "#999999", "#8c8c8c", "#808080", "#737373", "#666666", "#404040", "#1a1a1a", "#000000", "#000000"];
grey.primary = grey[5];
var presetPalettes = {
  red: red$1,
  volcano,
  orange: orange$1,
  gold,
  yellow: yellow$1,
  lime: lime$1,
  green: green$1,
  cyan: cyan$1,
  blue: blue$1,
  geekblue,
  purple: purple$1,
  magenta,
  grey
};
function genColorMapToken(seed, {
  generateColorPalettes: generateColorPalettes2,
  generateNeutralColorPalettes: generateNeutralColorPalettes2
}) {
  const {
    colorSuccess: colorSuccessBase,
    colorWarning: colorWarningBase,
    colorError: colorErrorBase,
    colorInfo: colorInfoBase,
    colorPrimary: colorPrimaryBase,
    colorBgBase,
    colorTextBase
  } = seed;
  const primaryColors = generateColorPalettes2(colorPrimaryBase);
  const successColors = generateColorPalettes2(colorSuccessBase);
  const warningColors = generateColorPalettes2(colorWarningBase);
  const errorColors = generateColorPalettes2(colorErrorBase);
  const infoColors = generateColorPalettes2(colorInfoBase);
  const neutralColors = generateNeutralColorPalettes2(colorBgBase, colorTextBase);
  const colorLink = seed.colorLink || seed.colorInfo;
  const linkColors = generateColorPalettes2(colorLink);
  const colorErrorBgFilledHover = new FastColor(errorColors[1]).mix(new FastColor(errorColors[3]), 50).toHexString();
  return Object.assign(Object.assign({}, neutralColors), {
    colorPrimaryBg: primaryColors[1],
    colorPrimaryBgHover: primaryColors[2],
    colorPrimaryBorder: primaryColors[3],
    colorPrimaryBorderHover: primaryColors[4],
    colorPrimaryHover: primaryColors[5],
    colorPrimary: primaryColors[6],
    colorPrimaryActive: primaryColors[7],
    colorPrimaryTextHover: primaryColors[8],
    colorPrimaryText: primaryColors[9],
    colorPrimaryTextActive: primaryColors[10],
    colorSuccessBg: successColors[1],
    colorSuccessBgHover: successColors[2],
    colorSuccessBorder: successColors[3],
    colorSuccessBorderHover: successColors[4],
    colorSuccessHover: successColors[4],
    colorSuccess: successColors[6],
    colorSuccessActive: successColors[7],
    colorSuccessTextHover: successColors[8],
    colorSuccessText: successColors[9],
    colorSuccessTextActive: successColors[10],
    colorErrorBg: errorColors[1],
    colorErrorBgHover: errorColors[2],
    colorErrorBgFilledHover,
    colorErrorBgActive: errorColors[3],
    colorErrorBorder: errorColors[3],
    colorErrorBorderHover: errorColors[4],
    colorErrorHover: errorColors[5],
    colorError: errorColors[6],
    colorErrorActive: errorColors[7],
    colorErrorTextHover: errorColors[8],
    colorErrorText: errorColors[9],
    colorErrorTextActive: errorColors[10],
    colorWarningBg: warningColors[1],
    colorWarningBgHover: warningColors[2],
    colorWarningBorder: warningColors[3],
    colorWarningBorderHover: warningColors[4],
    colorWarningHover: warningColors[4],
    colorWarning: warningColors[6],
    colorWarningActive: warningColors[7],
    colorWarningTextHover: warningColors[8],
    colorWarningText: warningColors[9],
    colorWarningTextActive: warningColors[10],
    colorInfoBg: infoColors[1],
    colorInfoBgHover: infoColors[2],
    colorInfoBorder: infoColors[3],
    colorInfoBorderHover: infoColors[4],
    colorInfoHover: infoColors[4],
    colorInfo: infoColors[6],
    colorInfoActive: infoColors[7],
    colorInfoTextHover: infoColors[8],
    colorInfoText: infoColors[9],
    colorInfoTextActive: infoColors[10],
    colorLinkHover: linkColors[4],
    colorLink: linkColors[6],
    colorLinkActive: linkColors[7],
    colorBgMask: new FastColor("#000").setA(0.45).toRgbString(),
    colorWhite: "#fff"
  });
}
const genRadius = (radiusBase) => {
  let radiusLG = radiusBase;
  let radiusSM = radiusBase;
  let radiusXS = radiusBase;
  let radiusOuter = radiusBase;
  if (radiusBase < 6 && radiusBase >= 5) {
    radiusLG = radiusBase + 1;
  } else if (radiusBase < 16 && radiusBase >= 6) {
    radiusLG = radiusBase + 2;
  } else if (radiusBase >= 16) {
    radiusLG = 16;
  }
  if (radiusBase < 7 && radiusBase >= 5) {
    radiusSM = 4;
  } else if (radiusBase < 8 && radiusBase >= 7) {
    radiusSM = 5;
  } else if (radiusBase < 14 && radiusBase >= 8) {
    radiusSM = 6;
  } else if (radiusBase < 16 && radiusBase >= 14) {
    radiusSM = 7;
  } else if (radiusBase >= 16) {
    radiusSM = 8;
  }
  if (radiusBase < 6 && radiusBase >= 2) {
    radiusXS = 1;
  } else if (radiusBase >= 6) {
    radiusXS = 2;
  }
  if (radiusBase > 4 && radiusBase < 8) {
    radiusOuter = 4;
  } else if (radiusBase >= 8) {
    radiusOuter = 6;
  }
  return {
    borderRadius: radiusBase,
    borderRadiusXS: radiusXS,
    borderRadiusSM: radiusSM,
    borderRadiusLG: radiusLG,
    borderRadiusOuter: radiusOuter
  };
};
function genCommonMapToken(token2) {
  const {
    motionUnit,
    motionBase,
    borderRadius: borderRadius2,
    lineWidth
  } = token2;
  return Object.assign({
    // motion
    motionDurationFast: `${(motionBase + motionUnit).toFixed(1)}s`,
    motionDurationMid: `${(motionBase + motionUnit * 2).toFixed(1)}s`,
    motionDurationSlow: `${(motionBase + motionUnit * 3).toFixed(1)}s`,
    // line
    lineWidthBold: lineWidth + 1
  }, genRadius(borderRadius2));
}
const genControlHeight = (token2) => {
  const {
    controlHeight
  } = token2;
  return {
    controlHeightSM: controlHeight * 0.75,
    controlHeightXS: controlHeight * 0.5,
    controlHeightLG: controlHeight * 1.25
  };
};
function getLineHeight(fontSize) {
  return (fontSize + 8) / fontSize;
}
function getFontSizes(base) {
  const fontSizes = Array.from({
    length: 10
  }).map((_24, index2) => {
    const i2 = index2 - 1;
    const baseSize = base * Math.pow(Math.E, i2 / 5);
    const intSize = index2 > 1 ? Math.floor(baseSize) : Math.ceil(baseSize);
    return Math.floor(intSize / 2) * 2;
  });
  fontSizes[1] = base;
  return fontSizes.map((size2) => ({
    size: size2,
    lineHeight: getLineHeight(size2)
  }));
}
const genFontMapToken = (fontSize) => {
  const fontSizePairs = getFontSizes(fontSize);
  const fontSizes = fontSizePairs.map((pair) => pair.size);
  const lineHeights = fontSizePairs.map((pair) => pair.lineHeight);
  const fontSizeMD = fontSizes[1];
  const fontSizeSM = fontSizes[0];
  const fontSizeLG = fontSizes[2];
  const lineHeight2 = lineHeights[1];
  const lineHeightSM = lineHeights[0];
  const lineHeightLG = lineHeights[2];
  return {
    fontSizeSM,
    fontSize: fontSizeMD,
    fontSizeLG,
    fontSizeXL: fontSizes[3],
    fontSizeHeading1: fontSizes[6],
    fontSizeHeading2: fontSizes[5],
    fontSizeHeading3: fontSizes[4],
    fontSizeHeading4: fontSizes[3],
    fontSizeHeading5: fontSizes[2],
    lineHeight: lineHeight2,
    lineHeightLG,
    lineHeightSM,
    fontHeight: Math.round(lineHeight2 * fontSizeMD),
    fontHeightLG: Math.round(lineHeightLG * fontSizeLG),
    fontHeightSM: Math.round(lineHeightSM * fontSizeSM),
    lineHeightHeading1: lineHeights[6],
    lineHeightHeading2: lineHeights[5],
    lineHeightHeading3: lineHeights[4],
    lineHeightHeading4: lineHeights[3],
    lineHeightHeading5: lineHeights[2]
  };
};
function genSizeMapToken(token2) {
  const {
    sizeUnit,
    sizeStep
  } = token2;
  return {
    sizeXXL: sizeUnit * (sizeStep + 8),
    // 48
    sizeXL: sizeUnit * (sizeStep + 4),
    // 32
    sizeLG: sizeUnit * (sizeStep + 2),
    // 24
    sizeMD: sizeUnit * (sizeStep + 1),
    // 20
    sizeMS: sizeUnit * sizeStep,
    // 16
    size: sizeUnit * sizeStep,
    // 16
    sizeSM: sizeUnit * (sizeStep - 1),
    // 12
    sizeXS: sizeUnit * (sizeStep - 2),
    // 8
    sizeXXS: sizeUnit * (sizeStep - 3)
    // 4
  };
}
const getAlphaColor$2 = (baseColor, alpha2) => new FastColor(baseColor).setA(alpha2).toRgbString();
const getSolidColor$1 = (baseColor, brightness) => {
  const instance2 = new FastColor(baseColor);
  return instance2.darken(brightness).toHexString();
};
const generateColorPalettes$1 = (baseColor) => {
  const colors2 = generate$1(baseColor);
  return {
    1: colors2[0],
    2: colors2[1],
    3: colors2[2],
    4: colors2[3],
    5: colors2[4],
    6: colors2[5],
    7: colors2[6],
    8: colors2[4],
    9: colors2[5],
    10: colors2[6]
    // 8: colors[7],
    // 9: colors[8],
    // 10: colors[9],
  };
};
const generateNeutralColorPalettes$1 = (bgBaseColor, textBaseColor) => {
  const colorBgBase = bgBaseColor || "#fff";
  const colorTextBase = textBaseColor || "#000";
  return {
    colorBgBase,
    colorTextBase,
    colorText: getAlphaColor$2(colorTextBase, 0.88),
    colorTextSecondary: getAlphaColor$2(colorTextBase, 0.65),
    colorTextTertiary: getAlphaColor$2(colorTextBase, 0.45),
    colorTextQuaternary: getAlphaColor$2(colorTextBase, 0.25),
    colorFill: getAlphaColor$2(colorTextBase, 0.15),
    colorFillSecondary: getAlphaColor$2(colorTextBase, 0.06),
    colorFillTertiary: getAlphaColor$2(colorTextBase, 0.04),
    colorFillQuaternary: getAlphaColor$2(colorTextBase, 0.02),
    colorBgSolid: getAlphaColor$2(colorTextBase, 1),
    colorBgSolidHover: getAlphaColor$2(colorTextBase, 0.75),
    colorBgSolidActive: getAlphaColor$2(colorTextBase, 0.95),
    colorBgLayout: getSolidColor$1(colorBgBase, 4),
    colorBgContainer: getSolidColor$1(colorBgBase, 0),
    colorBgElevated: getSolidColor$1(colorBgBase, 0),
    colorBgSpotlight: getAlphaColor$2(colorTextBase, 0.85),
    colorBgBlur: "transparent",
    colorBorder: getSolidColor$1(colorBgBase, 15),
    colorBorderSecondary: getSolidColor$1(colorBgBase, 6)
  };
};
function derivative$1(token2) {
  presetPrimaryColors.pink = presetPrimaryColors.magenta;
  presetPalettes.pink = presetPalettes.magenta;
  const colorPalettes = Object.keys(defaultPresetColors).map((colorKey) => {
    const colors2 = token2[colorKey] === presetPrimaryColors[colorKey] ? presetPalettes[colorKey] : generate$1(token2[colorKey]);
    return Array.from({
      length: 10
    }, () => 1).reduce((prev2, _24, i2) => {
      prev2[`${colorKey}-${i2 + 1}`] = colors2[i2];
      prev2[`${colorKey}${i2 + 1}`] = colors2[i2];
      return prev2;
    }, {});
  }).reduce((prev2, cur) => {
    prev2 = Object.assign(Object.assign({}, prev2), cur);
    return prev2;
  }, {});
  return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, token2), colorPalettes), genColorMapToken(token2, {
    generateColorPalettes: generateColorPalettes$1,
    generateNeutralColorPalettes: generateNeutralColorPalettes$1
  })), genFontMapToken(token2.fontSize)), genSizeMapToken(token2)), genControlHeight(token2)), genCommonMapToken(token2));
}
const defaultTheme = createTheme(derivative$1);
const defaultConfig = {
  token: seedToken,
  override: {
    override: seedToken
  },
  hashed: true
};
const DesignTokenContext = /* @__PURE__ */ React$5.createContext(defaultConfig);
const defaultPrefixCls = "ant";
const defaultIconPrefixCls = "anticon";
const defaultGetPrefixCls = (suffixCls, customizePrefixCls) => {
  if (customizePrefixCls) {
    return customizePrefixCls;
  }
  return suffixCls ? `${defaultPrefixCls}-${suffixCls}` : defaultPrefixCls;
};
const ConfigContext = /* @__PURE__ */ reactExports.createContext({
  // We provide a default function for Context without provider
  getPrefixCls: defaultGetPrefixCls,
  iconPrefixCls: defaultIconPrefixCls
});
const {
  Consumer: ConfigConsumer
} = ConfigContext;
const EMPTY_OBJECT = {};
function useComponentConfig(propName) {
  const context = reactExports.useContext(ConfigContext);
  const {
    getPrefixCls,
    direction,
    getPopupContainer
  } = context;
  const propValue = context[propName];
  return Object.assign(Object.assign({
    classNames: EMPTY_OBJECT,
    styles: EMPTY_OBJECT
  }, propValue), {
    getPrefixCls,
    direction,
    getPopupContainer
  });
}
const dynamicStyleMark = `-ant-${Date.now()}-${Math.random()}`;
function getStyle$2(globalPrefixCls2, theme2) {
  const variables = {};
  const formatColor = (color2, updater) => {
    let clone3 = color2.clone();
    clone3 = (updater === null || updater === void 0 ? void 0 : updater(clone3)) || clone3;
    return clone3.toRgbString();
  };
  const fillColor = (colorVal, type4) => {
    const baseColor = new FastColor(colorVal);
    const colorPalettes = generate$1(baseColor.toRgbString());
    variables[`${type4}-color`] = formatColor(baseColor);
    variables[`${type4}-color-disabled`] = colorPalettes[1];
    variables[`${type4}-color-hover`] = colorPalettes[4];
    variables[`${type4}-color-active`] = colorPalettes[6];
    variables[`${type4}-color-outline`] = baseColor.clone().setA(0.2).toRgbString();
    variables[`${type4}-color-deprecated-bg`] = colorPalettes[0];
    variables[`${type4}-color-deprecated-border`] = colorPalettes[2];
  };
  if (theme2.primaryColor) {
    fillColor(theme2.primaryColor, "primary");
    const primaryColor = new FastColor(theme2.primaryColor);
    const primaryColors = generate$1(primaryColor.toRgbString());
    primaryColors.forEach((color2, index2) => {
      variables[`primary-${index2 + 1}`] = color2;
    });
    variables["primary-color-deprecated-l-35"] = formatColor(primaryColor, (c2) => c2.lighten(35));
    variables["primary-color-deprecated-l-20"] = formatColor(primaryColor, (c2) => c2.lighten(20));
    variables["primary-color-deprecated-t-20"] = formatColor(primaryColor, (c2) => c2.tint(20));
    variables["primary-color-deprecated-t-50"] = formatColor(primaryColor, (c2) => c2.tint(50));
    variables["primary-color-deprecated-f-12"] = formatColor(primaryColor, (c2) => c2.setA(c2.a * 0.12));
    const primaryActiveColor = new FastColor(primaryColors[0]);
    variables["primary-color-active-deprecated-f-30"] = formatColor(primaryActiveColor, (c2) => c2.setA(c2.a * 0.3));
    variables["primary-color-active-deprecated-d-02"] = formatColor(primaryActiveColor, (c2) => c2.darken(2));
  }
  if (theme2.successColor) {
    fillColor(theme2.successColor, "success");
  }
  if (theme2.warningColor) {
    fillColor(theme2.warningColor, "warning");
  }
  if (theme2.errorColor) {
    fillColor(theme2.errorColor, "error");
  }
  if (theme2.infoColor) {
    fillColor(theme2.infoColor, "info");
  }
  const cssList = Object.keys(variables).map((key) => `--${globalPrefixCls2}-${key}: ${variables[key]};`);
  return `
  :root {
    ${cssList.join("\n")}
  }
  `.trim();
}
function registerTheme(globalPrefixCls2, theme2) {
  const style2 = getStyle$2(globalPrefixCls2, theme2);
  if (canUseDom()) {
    updateCSS(style2, `${dynamicStyleMark}-dynamic-theme`);
  }
}
const DisabledContext = /* @__PURE__ */ reactExports.createContext(false);
const DisabledContextProvider = ({
  children,
  disabled
}) => {
  const originDisabled = reactExports.useContext(DisabledContext);
  return /* @__PURE__ */ reactExports.createElement(DisabledContext.Provider, {
    value: disabled !== null && disabled !== void 0 ? disabled : originDisabled
  }, children);
};
const SizeContext = /* @__PURE__ */ reactExports.createContext(void 0);
const SizeContextProvider = ({
  children,
  size: size2
}) => {
  const originSize = reactExports.useContext(SizeContext);
  return /* @__PURE__ */ reactExports.createElement(SizeContext.Provider, {
    value: size2 || originSize
  }, children);
};
function useConfig() {
  const componentDisabled = reactExports.useContext(DisabledContext);
  const componentSize = reactExports.useContext(SizeContext);
  return {
    componentDisabled,
    componentSize
  };
}
var AbstractCalculator = /* @__PURE__ */ _createClass$8(function AbstractCalculator2() {
  _classCallCheck$a(this, AbstractCalculator2);
});
var CALC_UNIT = "CALC_UNIT";
var regexp$1 = new RegExp(CALC_UNIT, "g");
function unit(value2) {
  if (typeof value2 === "number") {
    return "".concat(value2).concat(CALC_UNIT);
  }
  return value2;
}
var CSSCalculator = /* @__PURE__ */ function(_AbstractCalculator) {
  _inherits$a(CSSCalculator2, _AbstractCalculator);
  var _super = _createSuper$4(CSSCalculator2);
  function CSSCalculator2(num, unitlessCssVar) {
    var _this;
    _classCallCheck$a(this, CSSCalculator2);
    _this = _super.call(this);
    _defineProperty$3(_assertThisInitialized(_this), "result", "");
    _defineProperty$3(_assertThisInitialized(_this), "unitlessCssVar", void 0);
    _defineProperty$3(_assertThisInitialized(_this), "lowPriority", void 0);
    var numType = _typeof$1(num);
    _this.unitlessCssVar = unitlessCssVar;
    if (num instanceof CSSCalculator2) {
      _this.result = "(".concat(num.result, ")");
    } else if (numType === "number") {
      _this.result = unit(num);
    } else if (numType === "string") {
      _this.result = num;
    }
    return _this;
  }
  _createClass$8(CSSCalculator2, [{
    key: "add",
    value: function add2(num) {
      if (num instanceof CSSCalculator2) {
        this.result = "".concat(this.result, " + ").concat(num.getResult());
      } else if (typeof num === "number" || typeof num === "string") {
        this.result = "".concat(this.result, " + ").concat(unit(num));
      }
      this.lowPriority = true;
      return this;
    }
  }, {
    key: "sub",
    value: function sub(num) {
      if (num instanceof CSSCalculator2) {
        this.result = "".concat(this.result, " - ").concat(num.getResult());
      } else if (typeof num === "number" || typeof num === "string") {
        this.result = "".concat(this.result, " - ").concat(unit(num));
      }
      this.lowPriority = true;
      return this;
    }
  }, {
    key: "mul",
    value: function mul(num) {
      if (this.lowPriority) {
        this.result = "(".concat(this.result, ")");
      }
      if (num instanceof CSSCalculator2) {
        this.result = "".concat(this.result, " * ").concat(num.getResult(true));
      } else if (typeof num === "number" || typeof num === "string") {
        this.result = "".concat(this.result, " * ").concat(num);
      }
      this.lowPriority = false;
      return this;
    }
  }, {
    key: "div",
    value: function div(num) {
      if (this.lowPriority) {
        this.result = "(".concat(this.result, ")");
      }
      if (num instanceof CSSCalculator2) {
        this.result = "".concat(this.result, " / ").concat(num.getResult(true));
      } else if (typeof num === "number" || typeof num === "string") {
        this.result = "".concat(this.result, " / ").concat(num);
      }
      this.lowPriority = false;
      return this;
    }
  }, {
    key: "getResult",
    value: function getResult(force) {
      return this.lowPriority || force ? "(".concat(this.result, ")") : this.result;
    }
  }, {
    key: "equal",
    value: function equal2(options) {
      var _this2 = this;
      var _ref = options || {}, cssUnit = _ref.unit;
      var mergedUnit = true;
      if (typeof cssUnit === "boolean") {
        mergedUnit = cssUnit;
      } else if (Array.from(this.unitlessCssVar).some(function(cssVar) {
        return _this2.result.includes(cssVar);
      })) {
        mergedUnit = false;
      }
      this.result = this.result.replace(regexp$1, mergedUnit ? "px" : "");
      if (typeof this.lowPriority !== "undefined") {
        return "calc(".concat(this.result, ")");
      }
      return this.result;
    }
  }]);
  return CSSCalculator2;
}(AbstractCalculator);
var NumCalculator = /* @__PURE__ */ function(_AbstractCalculator) {
  _inherits$a(NumCalculator2, _AbstractCalculator);
  var _super = _createSuper$4(NumCalculator2);
  function NumCalculator2(num) {
    var _this;
    _classCallCheck$a(this, NumCalculator2);
    _this = _super.call(this);
    _defineProperty$3(_assertThisInitialized(_this), "result", 0);
    if (num instanceof NumCalculator2) {
      _this.result = num.result;
    } else if (typeof num === "number") {
      _this.result = num;
    }
    return _this;
  }
  _createClass$8(NumCalculator2, [{
    key: "add",
    value: function add2(num) {
      if (num instanceof NumCalculator2) {
        this.result += num.result;
      } else if (typeof num === "number") {
        this.result += num;
      }
      return this;
    }
  }, {
    key: "sub",
    value: function sub(num) {
      if (num instanceof NumCalculator2) {
        this.result -= num.result;
      } else if (typeof num === "number") {
        this.result -= num;
      }
      return this;
    }
  }, {
    key: "mul",
    value: function mul(num) {
      if (num instanceof NumCalculator2) {
        this.result *= num.result;
      } else if (typeof num === "number") {
        this.result *= num;
      }
      return this;
    }
  }, {
    key: "div",
    value: function div(num) {
      if (num instanceof NumCalculator2) {
        this.result /= num.result;
      } else if (typeof num === "number") {
        this.result /= num;
      }
      return this;
    }
  }, {
    key: "equal",
    value: function equal2() {
      return this.result;
    }
  }]);
  return NumCalculator2;
}(AbstractCalculator);
var genCalc = function genCalc2(type4, unitlessCssVar) {
  var Calculator = type4 === "css" ? CSSCalculator : NumCalculator;
  return function(num) {
    return new Calculator(num, unitlessCssVar);
  };
};
var getCompVarPrefix = function getCompVarPrefix2(component, prefix) {
  return "".concat([prefix, component.replace(/([A-Z]+)([A-Z][a-z]+)/g, "$1-$2").replace(/([a-z])([A-Z])/g, "$1-$2")].filter(Boolean).join("-"));
};
function useEvent$1(callback2) {
  var fnRef = reactExports.useRef();
  fnRef.current = callback2;
  var memoFn = reactExports.useCallback(function() {
    var _fnRef$current;
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    return (_fnRef$current = fnRef.current) === null || _fnRef$current === void 0 ? void 0 : _fnRef$current.call.apply(_fnRef$current, [fnRef].concat(args));
  }, []);
  return memoFn;
}
function useSafeState(defaultValue2) {
  var destroyRef = reactExports.useRef(false);
  var _React$useState = reactExports.useState(defaultValue2), _React$useState2 = _slicedToArray(_React$useState, 2), value2 = _React$useState2[0], setValue = _React$useState2[1];
  reactExports.useEffect(function() {
    destroyRef.current = false;
    return function() {
      destroyRef.current = true;
    };
  }, []);
  function safeSetState(updater, ignoreDestroy) {
    if (ignoreDestroy && destroyRef.current) {
      return;
    }
    setValue(updater);
  }
  return [value2, safeSetState];
}
function hasValue(value2) {
  return value2 !== void 0;
}
function useMergedState(defaultStateValue, option) {
  var _ref = option || {}, defaultValue2 = _ref.defaultValue, value2 = _ref.value, onChange = _ref.onChange, postState = _ref.postState;
  var _useState = useSafeState(function() {
    if (hasValue(value2)) {
      return value2;
    } else if (hasValue(defaultValue2)) {
      return typeof defaultValue2 === "function" ? defaultValue2() : defaultValue2;
    } else {
      return typeof defaultStateValue === "function" ? defaultStateValue() : defaultStateValue;
    }
  }), _useState2 = _slicedToArray(_useState, 2), innerValue = _useState2[0], setInnerValue = _useState2[1];
  var mergedValue = value2 !== void 0 ? value2 : innerValue;
  var postMergedValue = postState ? postState(mergedValue) : mergedValue;
  var onChangeFn = useEvent$1(onChange);
  var _useState3 = useSafeState([mergedValue]), _useState4 = _slicedToArray(_useState3, 2), prevValue = _useState4[0], setPrevValue = _useState4[1];
  useLayoutUpdateEffect(function() {
    var prev2 = prevValue[0];
    if (innerValue !== prev2) {
      onChangeFn(innerValue, prev2);
    }
  }, [prevValue]);
  useLayoutUpdateEffect(function() {
    if (!hasValue(value2)) {
      setInnerValue(value2);
    }
  }, [value2]);
  var triggerChange = useEvent$1(function(updater, ignoreDestroy) {
    setInnerValue(updater, ignoreDestroy);
    setPrevValue([mergedValue], ignoreDestroy);
  });
  return [postMergedValue, triggerChange];
}
function getComponentToken(component, token2, defaultToken, options) {
  var customToken = _objectSpread2({}, token2[component]);
  if (options !== null && options !== void 0 && options.deprecatedTokens) {
    var deprecatedTokens = options.deprecatedTokens;
    deprecatedTokens.forEach(function(_ref) {
      var _ref2 = _slicedToArray(_ref, 2), oldTokenKey = _ref2[0], newTokenKey = _ref2[1];
      if (customToken !== null && customToken !== void 0 && customToken[oldTokenKey] || customToken !== null && customToken !== void 0 && customToken[newTokenKey]) {
        var _customToken$newToken;
        (_customToken$newToken = customToken[newTokenKey]) !== null && _customToken$newToken !== void 0 ? _customToken$newToken : customToken[newTokenKey] = customToken === null || customToken === void 0 ? void 0 : customToken[oldTokenKey];
      }
    });
  }
  var mergedToken = _objectSpread2(_objectSpread2({}, defaultToken), customToken);
  Object.keys(mergedToken).forEach(function(key) {
    if (mergedToken[key] === token2[key]) {
      delete mergedToken[key];
    }
  });
  return mergedToken;
}
var enableStatistic = typeof CSSINJS_STATISTIC !== "undefined";
var recording = true;
function merge$4() {
  for (var _len = arguments.length, objs = new Array(_len), _key = 0; _key < _len; _key++) {
    objs[_key] = arguments[_key];
  }
  if (!enableStatistic) {
    return Object.assign.apply(Object, [{}].concat(objs));
  }
  recording = false;
  var ret = {};
  objs.forEach(function(obj) {
    if (_typeof$1(obj) !== "object") {
      return;
    }
    var keys2 = Object.keys(obj);
    keys2.forEach(function(key) {
      Object.defineProperty(ret, key, {
        configurable: true,
        enumerable: true,
        get: function get5() {
          return obj[key];
        }
      });
    });
  });
  recording = true;
  return ret;
}
var statistic = {};
function noop$6() {
}
var statisticToken = function statisticToken2(token2) {
  var tokenKeys2;
  var proxy = token2;
  var flush = noop$6;
  if (enableStatistic && typeof Proxy !== "undefined") {
    tokenKeys2 = /* @__PURE__ */ new Set();
    proxy = new Proxy(token2, {
      get: function get5(obj, prop) {
        if (recording) {
          var _tokenKeys;
          (_tokenKeys = tokenKeys2) === null || _tokenKeys === void 0 || _tokenKeys.add(prop);
        }
        return obj[prop];
      }
    });
    flush = function flush2(componentName, componentToken) {
      var _statistic$componentN;
      statistic[componentName] = {
        global: Array.from(tokenKeys2),
        component: _objectSpread2(_objectSpread2({}, (_statistic$componentN = statistic[componentName]) === null || _statistic$componentN === void 0 ? void 0 : _statistic$componentN.component), componentToken)
      };
    };
  }
  return {
    token: proxy,
    keys: tokenKeys2,
    flush
  };
};
function getDefaultComponentToken(component, token2, getDefaultToken) {
  if (typeof getDefaultToken === "function") {
    var _token$component;
    return getDefaultToken(merge$4(token2, (_token$component = token2[component]) !== null && _token$component !== void 0 ? _token$component : {}));
  }
  return getDefaultToken !== null && getDefaultToken !== void 0 ? getDefaultToken : {};
}
function genMaxMin(type4) {
  if (type4 === "js") {
    return {
      max: Math.max,
      min: Math.min
    };
  }
  return {
    max: function max2() {
      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
      return "max(".concat(args.map(function(value2) {
        return unit$1(value2);
      }).join(","), ")");
    },
    min: function min2() {
      for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
        args[_key2] = arguments[_key2];
      }
      return "min(".concat(args.map(function(value2) {
        return unit$1(value2);
      }).join(","), ")");
    }
  };
}
var BEAT_LIMIT = 1e3 * 60 * 10;
var ArrayKeyMap = /* @__PURE__ */ function() {
  function ArrayKeyMap2() {
    _classCallCheck$a(this, ArrayKeyMap2);
    _defineProperty$3(this, "map", /* @__PURE__ */ new Map());
    _defineProperty$3(this, "objectIDMap", /* @__PURE__ */ new WeakMap());
    _defineProperty$3(this, "nextID", 0);
    _defineProperty$3(this, "lastAccessBeat", /* @__PURE__ */ new Map());
    _defineProperty$3(this, "accessBeat", 0);
  }
  _createClass$8(ArrayKeyMap2, [{
    key: "set",
    value: function set2(keys2, value2) {
      this.clear();
      var compositeKey = this.getCompositeKey(keys2);
      this.map.set(compositeKey, value2);
      this.lastAccessBeat.set(compositeKey, Date.now());
    }
  }, {
    key: "get",
    value: function get5(keys2) {
      var compositeKey = this.getCompositeKey(keys2);
      var cache2 = this.map.get(compositeKey);
      this.lastAccessBeat.set(compositeKey, Date.now());
      this.accessBeat += 1;
      return cache2;
    }
  }, {
    key: "getCompositeKey",
    value: function getCompositeKey(keys2) {
      var _this = this;
      var ids2 = keys2.map(function(key) {
        if (key && _typeof$1(key) === "object") {
          return "obj_".concat(_this.getObjectID(key));
        }
        return "".concat(_typeof$1(key), "_").concat(key);
      });
      return ids2.join("|");
    }
  }, {
    key: "getObjectID",
    value: function getObjectID(obj) {
      if (this.objectIDMap.has(obj)) {
        return this.objectIDMap.get(obj);
      }
      var id2 = this.nextID;
      this.objectIDMap.set(obj, id2);
      this.nextID += 1;
      return id2;
    }
  }, {
    key: "clear",
    value: function clear() {
      var _this2 = this;
      if (this.accessBeat > 1e4) {
        var now2 = Date.now();
        this.lastAccessBeat.forEach(function(beat, key) {
          if (now2 - beat > BEAT_LIMIT) {
            _this2.map.delete(key);
            _this2.lastAccessBeat.delete(key);
          }
        });
        this.accessBeat = 0;
      }
    }
  }]);
  return ArrayKeyMap2;
}();
var uniqueMap = new ArrayKeyMap();
function useUniqueMemo(memoFn, deps) {
  return React$5.useMemo(function() {
    var cachedValue = uniqueMap.get(deps);
    if (cachedValue) {
      return cachedValue;
    }
    var newValue = memoFn();
    uniqueMap.set(deps, newValue);
    return newValue;
  }, deps);
}
var useDefaultCSP = function useDefaultCSP2() {
  return {};
};
function genStyleUtils(config2) {
  var _config$useCSP = config2.useCSP, useCSP = _config$useCSP === void 0 ? useDefaultCSP : _config$useCSP, useToken2 = config2.useToken, usePrefix = config2.usePrefix, getResetStyles = config2.getResetStyles, getCommonStyle = config2.getCommonStyle, getCompUnitless = config2.getCompUnitless;
  function genStyleHooks2(component, styleFn, getDefaultToken, options) {
    var componentName = Array.isArray(component) ? component[0] : component;
    function prefixToken(key) {
      return "".concat(String(componentName)).concat(key.slice(0, 1).toUpperCase()).concat(key.slice(1));
    }
    var originUnitless = (options === null || options === void 0 ? void 0 : options.unitless) || {};
    var originCompUnitless = typeof getCompUnitless === "function" ? getCompUnitless(component) : {};
    var compUnitless = _objectSpread2(_objectSpread2({}, originCompUnitless), {}, _defineProperty$3({}, prefixToken("zIndexPopup"), true));
    Object.keys(originUnitless).forEach(function(key) {
      compUnitless[prefixToken(key)] = originUnitless[key];
    });
    var mergedOptions = _objectSpread2(_objectSpread2({}, options), {}, {
      unitless: compUnitless,
      prefixToken
    });
    var useStyle2 = genComponentStyleHook(component, styleFn, getDefaultToken, mergedOptions);
    var useCSSVar = genCSSVarRegister(componentName, getDefaultToken, mergedOptions);
    return function(prefixCls) {
      var rootCls = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : prefixCls;
      var _useStyle = useStyle2(prefixCls, rootCls), _useStyle2 = _slicedToArray(_useStyle, 2), hashId = _useStyle2[1];
      var _useCSSVar = useCSSVar(rootCls), _useCSSVar2 = _slicedToArray(_useCSSVar, 2), wrapCSSVar = _useCSSVar2[0], cssVarCls = _useCSSVar2[1];
      return [wrapCSSVar, hashId, cssVarCls];
    };
  }
  function genCSSVarRegister(component, getDefaultToken, options) {
    var compUnitless = options.unitless, _options$injectStyle = options.injectStyle, injectStyle = _options$injectStyle === void 0 ? true : _options$injectStyle, prefixToken = options.prefixToken, ignore2 = options.ignore;
    var CSSVarRegister = function CSSVarRegister2(_ref) {
      var rootCls = _ref.rootCls, _ref$cssVar = _ref.cssVar, cssVar = _ref$cssVar === void 0 ? {} : _ref$cssVar;
      var _useToken = useToken2(), realToken = _useToken.realToken;
      useCSSVarRegister({
        path: [component],
        prefix: cssVar.prefix,
        key: cssVar.key,
        unitless: compUnitless,
        ignore: ignore2,
        token: realToken,
        scope: rootCls
      }, function() {
        var defaultToken = getDefaultComponentToken(component, realToken, getDefaultToken);
        var componentToken = getComponentToken(component, realToken, defaultToken, {
          deprecatedTokens: options === null || options === void 0 ? void 0 : options.deprecatedTokens
        });
        Object.keys(defaultToken).forEach(function(key) {
          componentToken[prefixToken(key)] = componentToken[key];
          delete componentToken[key];
        });
        return componentToken;
      });
      return null;
    };
    var useCSSVar = function useCSSVar2(rootCls) {
      var _useToken2 = useToken2(), cssVar = _useToken2.cssVar;
      return [function(node2) {
        return injectStyle && cssVar ? /* @__PURE__ */ React$5.createElement(React$5.Fragment, null, /* @__PURE__ */ React$5.createElement(CSSVarRegister, {
          rootCls,
          cssVar,
          component
        }), node2) : node2;
      }, cssVar === null || cssVar === void 0 ? void 0 : cssVar.key];
    };
    return useCSSVar;
  }
  function genComponentStyleHook(componentName, styleFn, getDefaultToken) {
    var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
    var cells = Array.isArray(componentName) ? componentName : [componentName, componentName];
    var _cells = _slicedToArray(cells, 1), component = _cells[0];
    var concatComponent = cells.join("-");
    var mergedLayer = config2.layer || {
      name: "antd"
    };
    return function(prefixCls) {
      var rootCls = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : prefixCls;
      var _useToken3 = useToken2(), theme2 = _useToken3.theme, realToken = _useToken3.realToken, hashId = _useToken3.hashId, token2 = _useToken3.token, cssVar = _useToken3.cssVar;
      var _usePrefix = usePrefix(), rootPrefixCls = _usePrefix.rootPrefixCls, iconPrefixCls = _usePrefix.iconPrefixCls;
      var csp = useCSP();
      var type4 = cssVar ? "css" : "js";
      var calc = useUniqueMemo(function() {
        var unitlessCssVar = /* @__PURE__ */ new Set();
        if (cssVar) {
          Object.keys(options.unitless || {}).forEach(function(key) {
            unitlessCssVar.add(token2CSSVar(key, cssVar.prefix));
            unitlessCssVar.add(token2CSSVar(key, getCompVarPrefix(component, cssVar.prefix)));
          });
        }
        return genCalc(type4, unitlessCssVar);
      }, [type4, component, cssVar === null || cssVar === void 0 ? void 0 : cssVar.prefix]);
      var _genMaxMin = genMaxMin(type4), max2 = _genMaxMin.max, min2 = _genMaxMin.min;
      var sharedConfig = {
        theme: theme2,
        token: token2,
        hashId,
        nonce: function nonce() {
          return csp.nonce;
        },
        clientOnly: options.clientOnly,
        layer: mergedLayer,
        // antd is always at top of styles
        order: options.order || -999
      };
      if (typeof getResetStyles === "function") {
        useStyleRegister(_objectSpread2(_objectSpread2({}, sharedConfig), {}, {
          clientOnly: false,
          path: ["Shared", rootPrefixCls]
        }), function() {
          return getResetStyles(token2, {
            prefix: {
              rootPrefixCls,
              iconPrefixCls
            },
            csp
          });
        });
      }
      var wrapSSR = useStyleRegister(_objectSpread2(_objectSpread2({}, sharedConfig), {}, {
        path: [concatComponent, prefixCls, iconPrefixCls]
      }), function() {
        if (options.injectStyle === false) {
          return [];
        }
        var _statisticToken = statisticToken(token2), proxyToken = _statisticToken.token, flush = _statisticToken.flush;
        var defaultComponentToken = getDefaultComponentToken(component, realToken, getDefaultToken);
        var componentCls = ".".concat(prefixCls);
        var componentToken = getComponentToken(component, realToken, defaultComponentToken, {
          deprecatedTokens: options.deprecatedTokens
        });
        if (cssVar && defaultComponentToken && _typeof$1(defaultComponentToken) === "object") {
          Object.keys(defaultComponentToken).forEach(function(key) {
            defaultComponentToken[key] = "var(".concat(token2CSSVar(key, getCompVarPrefix(component, cssVar.prefix)), ")");
          });
        }
        var mergedToken = merge$4(proxyToken, {
          componentCls,
          prefixCls,
          iconCls: ".".concat(iconPrefixCls),
          antCls: ".".concat(rootPrefixCls),
          calc,
          // @ts-ignore
          max: max2,
          // @ts-ignore
          min: min2
        }, cssVar ? defaultComponentToken : componentToken);
        var styleInterpolation = styleFn(mergedToken, {
          hashId,
          prefixCls,
          rootPrefixCls,
          iconPrefixCls
        });
        flush(component, componentToken);
        var commonStyle = typeof getCommonStyle === "function" ? getCommonStyle(mergedToken, prefixCls, rootCls, options.resetFont) : null;
        return [options.resetStyle === false ? null : commonStyle, styleInterpolation];
      });
      return [wrapSSR, hashId];
    };
  }
  function genSubStyleComponent(componentName, styleFn, getDefaultToken) {
    var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
    var useStyle2 = genComponentStyleHook(componentName, styleFn, getDefaultToken, _objectSpread2({
      resetStyle: false,
      // Sub Style should default after root one
      order: -998
    }, options));
    var StyledComponent = function StyledComponent2(_ref2) {
      var prefixCls = _ref2.prefixCls, _ref2$rootCls = _ref2.rootCls, rootCls = _ref2$rootCls === void 0 ? prefixCls : _ref2$rootCls;
      useStyle2(prefixCls, rootCls);
      return null;
    };
    return StyledComponent;
  }
  return {
    genStyleHooks: genStyleHooks2,
    genSubStyleComponent,
    genComponentStyleHook
  };
}
const PresetColors = ["blue", "purple", "cyan", "green", "magenta", "pink", "red", "orange", "yellow", "volcano", "geekblue", "lime", "gold"];
const version$1 = "5.26.6";
function isStableColor(color2) {
  return color2 >= 0 && color2 <= 255;
}
function getAlphaColor$1(frontColor, backgroundColor) {
  const {
    r: fR,
    g: fG,
    b: fB,
    a: originAlpha
  } = new FastColor(frontColor).toRgb();
  if (originAlpha < 1) {
    return frontColor;
  }
  const {
    r: bR,
    g: bG,
    b: bB
  } = new FastColor(backgroundColor).toRgb();
  for (let fA = 0.01; fA <= 1; fA += 0.01) {
    const r2 = Math.round((fR - bR * (1 - fA)) / fA);
    const g2 = Math.round((fG - bG * (1 - fA)) / fA);
    const b2 = Math.round((fB - bB * (1 - fA)) / fA);
    if (isStableColor(r2) && isStableColor(g2) && isStableColor(b2)) {
      return new FastColor({
        r: r2,
        g: g2,
        b: b2,
        a: Math.round(fA * 100) / 100
      }).toRgbString();
    }
  }
  return new FastColor({
    r: fR,
    g: fG,
    b: fB,
    a: 1
  }).toRgbString();
}
var __rest$9 = function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
};
function formatToken(derivativeToken) {
  const {
    override
  } = derivativeToken, restToken = __rest$9(derivativeToken, ["override"]);
  const overrideTokens = Object.assign({}, override);
  Object.keys(seedToken).forEach((token2) => {
    delete overrideTokens[token2];
  });
  const mergedToken = Object.assign(Object.assign({}, restToken), overrideTokens);
  const screenXS = 480;
  const screenSM = 576;
  const screenMD = 768;
  const screenLG = 992;
  const screenXL = 1200;
  const screenXXL = 1600;
  if (mergedToken.motion === false) {
    const fastDuration = "0s";
    mergedToken.motionDurationFast = fastDuration;
    mergedToken.motionDurationMid = fastDuration;
    mergedToken.motionDurationSlow = fastDuration;
  }
  const aliasToken = Object.assign(Object.assign(Object.assign({}, mergedToken), {
    // ============== Background ============== //
    colorFillContent: mergedToken.colorFillSecondary,
    colorFillContentHover: mergedToken.colorFill,
    colorFillAlter: mergedToken.colorFillQuaternary,
    colorBgContainerDisabled: mergedToken.colorFillTertiary,
    // ============== Split ============== //
    colorBorderBg: mergedToken.colorBgContainer,
    colorSplit: getAlphaColor$1(mergedToken.colorBorderSecondary, mergedToken.colorBgContainer),
    // ============== Text ============== //
    colorTextPlaceholder: mergedToken.colorTextQuaternary,
    colorTextDisabled: mergedToken.colorTextQuaternary,
    colorTextHeading: mergedToken.colorText,
    colorTextLabel: mergedToken.colorTextSecondary,
    colorTextDescription: mergedToken.colorTextTertiary,
    colorTextLightSolid: mergedToken.colorWhite,
    colorHighlight: mergedToken.colorError,
    colorBgTextHover: mergedToken.colorFillSecondary,
    colorBgTextActive: mergedToken.colorFill,
    colorIcon: mergedToken.colorTextTertiary,
    colorIconHover: mergedToken.colorText,
    colorErrorOutline: getAlphaColor$1(mergedToken.colorErrorBg, mergedToken.colorBgContainer),
    colorWarningOutline: getAlphaColor$1(mergedToken.colorWarningBg, mergedToken.colorBgContainer),
    // Font
    fontSizeIcon: mergedToken.fontSizeSM,
    // Line
    lineWidthFocus: mergedToken.lineWidth * 3,
    // Control
    lineWidth: mergedToken.lineWidth,
    controlOutlineWidth: mergedToken.lineWidth * 2,
    // Checkbox size and expand icon size
    controlInteractiveSize: mergedToken.controlHeight / 2,
    controlItemBgHover: mergedToken.colorFillTertiary,
    controlItemBgActive: mergedToken.colorPrimaryBg,
    controlItemBgActiveHover: mergedToken.colorPrimaryBgHover,
    controlItemBgActiveDisabled: mergedToken.colorFill,
    controlTmpOutline: mergedToken.colorFillQuaternary,
    controlOutline: getAlphaColor$1(mergedToken.colorPrimaryBg, mergedToken.colorBgContainer),
    lineType: mergedToken.lineType,
    borderRadius: mergedToken.borderRadius,
    borderRadiusXS: mergedToken.borderRadiusXS,
    borderRadiusSM: mergedToken.borderRadiusSM,
    borderRadiusLG: mergedToken.borderRadiusLG,
    fontWeightStrong: 600,
    opacityLoading: 0.65,
    linkDecoration: "none",
    linkHoverDecoration: "none",
    linkFocusDecoration: "none",
    controlPaddingHorizontal: 12,
    controlPaddingHorizontalSM: 8,
    paddingXXS: mergedToken.sizeXXS,
    paddingXS: mergedToken.sizeXS,
    paddingSM: mergedToken.sizeSM,
    padding: mergedToken.size,
    paddingMD: mergedToken.sizeMD,
    paddingLG: mergedToken.sizeLG,
    paddingXL: mergedToken.sizeXL,
    paddingContentHorizontalLG: mergedToken.sizeLG,
    paddingContentVerticalLG: mergedToken.sizeMS,
    paddingContentHorizontal: mergedToken.sizeMS,
    paddingContentVertical: mergedToken.sizeSM,
    paddingContentHorizontalSM: mergedToken.size,
    paddingContentVerticalSM: mergedToken.sizeXS,
    marginXXS: mergedToken.sizeXXS,
    marginXS: mergedToken.sizeXS,
    marginSM: mergedToken.sizeSM,
    margin: mergedToken.size,
    marginMD: mergedToken.sizeMD,
    marginLG: mergedToken.sizeLG,
    marginXL: mergedToken.sizeXL,
    marginXXL: mergedToken.sizeXXL,
    boxShadow: `
      0 6px 16px 0 rgba(0, 0, 0, 0.08),
      0 3px 6px -4px rgba(0, 0, 0, 0.12),
      0 9px 28px 8px rgba(0, 0, 0, 0.05)
    `,
    boxShadowSecondary: `
      0 6px 16px 0 rgba(0, 0, 0, 0.08),
      0 3px 6px -4px rgba(0, 0, 0, 0.12),
      0 9px 28px 8px rgba(0, 0, 0, 0.05)
    `,
    boxShadowTertiary: `
      0 1px 2px 0 rgba(0, 0, 0, 0.03),
      0 1px 6px -1px rgba(0, 0, 0, 0.02),
      0 2px 4px 0 rgba(0, 0, 0, 0.02)
    `,
    screenXS,
    screenXSMin: screenXS,
    screenXSMax: screenSM - 1,
    screenSM,
    screenSMMin: screenSM,
    screenSMMax: screenMD - 1,
    screenMD,
    screenMDMin: screenMD,
    screenMDMax: screenLG - 1,
    screenLG,
    screenLGMin: screenLG,
    screenLGMax: screenXL - 1,
    screenXL,
    screenXLMin: screenXL,
    screenXLMax: screenXXL - 1,
    screenXXL,
    screenXXLMin: screenXXL,
    boxShadowPopoverArrow: "2px 2px 5px rgba(0, 0, 0, 0.05)",
    boxShadowCard: `
      0 1px 2px -2px ${new FastColor("rgba(0, 0, 0, 0.16)").toRgbString()},
      0 3px 6px 0 ${new FastColor("rgba(0, 0, 0, 0.12)").toRgbString()},
      0 5px 12px 4px ${new FastColor("rgba(0, 0, 0, 0.09)").toRgbString()}
    `,
    boxShadowDrawerRight: `
      -6px 0 16px 0 rgba(0, 0, 0, 0.08),
      -3px 0 6px -4px rgba(0, 0, 0, 0.12),
      -9px 0 28px 8px rgba(0, 0, 0, 0.05)
    `,
    boxShadowDrawerLeft: `
      6px 0 16px 0 rgba(0, 0, 0, 0.08),
      3px 0 6px -4px rgba(0, 0, 0, 0.12),
      9px 0 28px 8px rgba(0, 0, 0, 0.05)
    `,
    boxShadowDrawerUp: `
      0 6px 16px 0 rgba(0, 0, 0, 0.08),
      0 3px 6px -4px rgba(0, 0, 0, 0.12),
      0 9px 28px 8px rgba(0, 0, 0, 0.05)
    `,
    boxShadowDrawerDown: `
      0 -6px 16px 0 rgba(0, 0, 0, 0.08),
      0 -3px 6px -4px rgba(0, 0, 0, 0.12),
      0 -9px 28px 8px rgba(0, 0, 0, 0.05)
    `,
    boxShadowTabsOverflowLeft: "inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)",
    boxShadowTabsOverflowRight: "inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)",
    boxShadowTabsOverflowTop: "inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)",
    boxShadowTabsOverflowBottom: "inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)"
  }), overrideTokens);
  return aliasToken;
}
var __rest$8 = function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
};
const unitless = {
  lineHeight: true,
  lineHeightSM: true,
  lineHeightLG: true,
  lineHeightHeading1: true,
  lineHeightHeading2: true,
  lineHeightHeading3: true,
  lineHeightHeading4: true,
  lineHeightHeading5: true,
  opacityLoading: true,
  fontWeightStrong: true,
  zIndexPopupBase: true,
  zIndexBase: true,
  opacityImage: true
};
const ignore$1 = {
  size: true,
  sizeSM: true,
  sizeLG: true,
  sizeMD: true,
  sizeXS: true,
  sizeXXS: true,
  sizeMS: true,
  sizeXL: true,
  sizeXXL: true,
  sizeUnit: true,
  sizeStep: true,
  motionBase: true,
  motionUnit: true
};
const preserve = {
  screenXS: true,
  screenXSMin: true,
  screenXSMax: true,
  screenSM: true,
  screenSMMin: true,
  screenSMMax: true,
  screenMD: true,
  screenMDMin: true,
  screenMDMax: true,
  screenLG: true,
  screenLGMin: true,
  screenLGMax: true,
  screenXL: true,
  screenXLMin: true,
  screenXLMax: true,
  screenXXL: true,
  screenXXLMin: true
};
const getComputedToken = (originToken, overrideToken, theme2) => {
  const derivativeToken = theme2.getDerivativeToken(originToken);
  const {
    override
  } = overrideToken, components2 = __rest$8(overrideToken, ["override"]);
  let mergedDerivativeToken = Object.assign(Object.assign({}, derivativeToken), {
    override
  });
  mergedDerivativeToken = formatToken(mergedDerivativeToken);
  if (components2) {
    Object.entries(components2).forEach(([key, value2]) => {
      const {
        theme: componentTheme
      } = value2, componentTokens = __rest$8(value2, ["theme"]);
      let mergedComponentToken = componentTokens;
      if (componentTheme) {
        mergedComponentToken = getComputedToken(Object.assign(Object.assign({}, mergedDerivativeToken), componentTokens), {
          override: componentTokens
        }, componentTheme);
      }
      mergedDerivativeToken[key] = mergedComponentToken;
    });
  }
  return mergedDerivativeToken;
};
function useToken() {
  const {
    token: rootDesignToken,
    hashed,
    theme: theme2,
    override,
    cssVar
  } = React$5.useContext(DesignTokenContext);
  const salt = `${version$1}-${hashed || ""}`;
  const mergedTheme = theme2 || defaultTheme;
  const [token2, hashId, realToken] = useCacheToken(mergedTheme, [seedToken, rootDesignToken], {
    salt,
    override,
    getComputedToken,
    // formatToken will not be consumed after 1.15.0 with getComputedToken.
    // But token will break if @ant-design/cssinjs is under 1.15.0 without it
    formatToken,
    cssVar: cssVar && {
      prefix: cssVar.prefix,
      key: cssVar.key,
      unitless,
      ignore: ignore$1,
      preserve
    }
  });
  return [mergedTheme, realToken, hashed ? hashId : "", token2, cssVar];
}
const textEllipsis = {
  overflow: "hidden",
  whiteSpace: "nowrap",
  textOverflow: "ellipsis"
};
const resetComponent = (token2, needInheritFontFamily = false) => ({
  boxSizing: "border-box",
  margin: 0,
  padding: 0,
  color: token2.colorText,
  fontSize: token2.fontSize,
  // font-variant: @font-variant-base;
  lineHeight: token2.lineHeight,
  listStyle: "none",
  // font-feature-settings: @font-feature-settings-base;
  fontFamily: needInheritFontFamily ? "inherit" : token2.fontFamily
});
const resetIcon = () => ({
  display: "inline-flex",
  alignItems: "center",
  color: "inherit",
  fontStyle: "normal",
  lineHeight: 0,
  textAlign: "center",
  textTransform: "none",
  // for SVG icon, see https://blog.prototypr.io/align-svg-icons-to-text-and-say-goodbye-to-font-icons-d44b3d7b26b4
  verticalAlign: "-0.125em",
  textRendering: "optimizeLegibility",
  "-webkit-font-smoothing": "antialiased",
  "-moz-osx-font-smoothing": "grayscale",
  "> *": {
    lineHeight: 1
  },
  svg: {
    display: "inline-block"
  }
});
const clearFix = () => ({
  // https://github.com/ant-design/ant-design/issues/21301#issuecomment-583955229
  "&::before": {
    display: "table",
    content: '""'
  },
  "&::after": {
    // https://github.com/ant-design/ant-design/issues/21864
    display: "table",
    clear: "both",
    content: '""'
  }
});
const genLinkStyle = (token2) => ({
  a: {
    color: token2.colorLink,
    textDecoration: token2.linkDecoration,
    backgroundColor: "transparent",
    // remove the gray background on active links in IE 10.
    outline: "none",
    cursor: "pointer",
    transition: `color ${token2.motionDurationSlow}`,
    "-webkit-text-decoration-skip": "objects",
    // remove gaps in links underline in iOS 8+ and Safari 8+.
    "&:hover": {
      color: token2.colorLinkHover
    },
    "&:active": {
      color: token2.colorLinkActive
    },
    "&:active, &:hover": {
      textDecoration: token2.linkHoverDecoration,
      outline: 0
    },
    // https://github.com/ant-design/ant-design/issues/22503
    "&:focus": {
      textDecoration: token2.linkFocusDecoration,
      outline: 0
    },
    "&[disabled]": {
      color: token2.colorTextDisabled,
      cursor: "not-allowed"
    }
  }
});
const genCommonStyle = (token2, componentPrefixCls, rootCls, resetFont) => {
  const prefixSelector = `[class^="${componentPrefixCls}"], [class*=" ${componentPrefixCls}"]`;
  const rootPrefixSelector = rootCls ? `.${rootCls}` : prefixSelector;
  const resetStyle = {
    boxSizing: "border-box",
    "&::before, &::after": {
      boxSizing: "border-box"
    }
  };
  let resetFontStyle = {};
  if (resetFont !== false) {
    resetFontStyle = {
      fontFamily: token2.fontFamily,
      fontSize: token2.fontSize
    };
  }
  return {
    [rootPrefixSelector]: Object.assign(Object.assign(Object.assign({}, resetFontStyle), resetStyle), {
      [prefixSelector]: resetStyle
    })
  };
};
const genFocusOutline = (token2, offset2) => ({
  outline: `${unit$1(token2.lineWidthFocus)} solid ${token2.colorPrimaryBorder}`,
  outlineOffset: offset2 !== null && offset2 !== void 0 ? offset2 : 1,
  transition: "outline-offset 0s, outline 0s"
});
const genIconStyle = (iconPrefixCls) => ({
  [`.${iconPrefixCls}`]: Object.assign(Object.assign({}, resetIcon()), {
    [`.${iconPrefixCls} .${iconPrefixCls}-icon`]: {
      display: "block"
    }
  })
});
const {
  genStyleHooks
} = genStyleUtils({
  usePrefix: () => {
    const {
      getPrefixCls,
      iconPrefixCls
    } = reactExports.useContext(ConfigContext);
    const rootPrefixCls = getPrefixCls();
    return {
      rootPrefixCls,
      iconPrefixCls
    };
  },
  useToken: () => {
    const [theme2, realToken, hashId, token2, cssVar] = useToken();
    return {
      theme: theme2,
      realToken,
      hashId,
      token: token2,
      cssVar
    };
  },
  useCSP: () => {
    const {
      csp
    } = reactExports.useContext(ConfigContext);
    return csp !== null && csp !== void 0 ? csp : {};
  },
  getResetStyles: (token2, config2) => {
    var _a2;
    const linkStyle = genLinkStyle(token2);
    return [linkStyle, {
      "&": linkStyle
    }, genIconStyle((_a2 = config2 === null || config2 === void 0 ? void 0 : config2.prefix.iconPrefixCls) !== null && _a2 !== void 0 ? _a2 : defaultIconPrefixCls)];
  },
  getCommonStyle: genCommonStyle,
  getCompUnitless: () => unitless
});
function genPresetColor(token2, genCss) {
  return PresetColors.reduce((prev2, colorKey) => {
    const lightColor = token2[`${colorKey}1`];
    const lightBorderColor = token2[`${colorKey}3`];
    const darkColor = token2[`${colorKey}6`];
    const textColor = token2[`${colorKey}7`];
    return Object.assign(Object.assign({}, prev2), genCss(colorKey, {
      lightColor,
      lightBorderColor,
      darkColor,
      textColor
    }));
  }, {});
}
const useResetIconStyle = (iconPrefixCls, csp) => {
  const [theme2, token2] = useToken();
  return useStyleRegister({
    token: token2,
    hashId: "",
    path: ["ant-design-icons", iconPrefixCls],
    nonce: () => csp === null || csp === void 0 ? void 0 : csp.nonce,
    layer: {
      name: "antd"
    }
  }, () => [genIconStyle(iconPrefixCls)]);
};
const fullClone = Object.assign({}, React$6);
const {
  useId: useId$1
} = fullClone;
const useEmptyId = () => "";
const useThemeKey = typeof useId$1 === "undefined" ? useEmptyId : useId$1;
function useTheme(theme2, parentTheme, config2) {
  var _a2;
  devUseWarning();
  const themeConfig = theme2 || {};
  const parentThemeConfig = themeConfig.inherit === false || !parentTheme ? Object.assign(Object.assign({}, defaultConfig), {
    hashed: (_a2 = parentTheme === null || parentTheme === void 0 ? void 0 : parentTheme.hashed) !== null && _a2 !== void 0 ? _a2 : defaultConfig.hashed,
    cssVar: parentTheme === null || parentTheme === void 0 ? void 0 : parentTheme.cssVar
  }) : parentTheme;
  const themeKey = useThemeKey();
  return useMemo(() => {
    var _a22, _b2;
    if (!theme2) {
      return parentTheme;
    }
    const mergedComponents = Object.assign({}, parentThemeConfig.components);
    Object.keys(theme2.components || {}).forEach((componentName) => {
      mergedComponents[componentName] = Object.assign(Object.assign({}, mergedComponents[componentName]), theme2.components[componentName]);
    });
    const cssVarKey = `css-var-${themeKey.replace(/:/g, "")}`;
    const mergedCssVar = ((_a22 = themeConfig.cssVar) !== null && _a22 !== void 0 ? _a22 : parentThemeConfig.cssVar) && Object.assign(Object.assign(Object.assign({
      prefix: config2 === null || config2 === void 0 ? void 0 : config2.prefixCls
    }, typeof parentThemeConfig.cssVar === "object" ? parentThemeConfig.cssVar : {}), typeof themeConfig.cssVar === "object" ? themeConfig.cssVar : {}), {
      key: typeof themeConfig.cssVar === "object" && ((_b2 = themeConfig.cssVar) === null || _b2 === void 0 ? void 0 : _b2.key) || cssVarKey
    });
    return Object.assign(Object.assign(Object.assign({}, parentThemeConfig), themeConfig), {
      token: Object.assign(Object.assign({}, parentThemeConfig.token), themeConfig.token),
      components: mergedComponents,
      cssVar: mergedCssVar
    });
  }, [themeConfig, parentThemeConfig], (prev2, next2) => prev2.some((prevTheme, index2) => {
    const nextTheme = next2[index2];
    return !isEqual$2(prevTheme, nextTheme, true);
  }));
}
var _excluded$y = ["children"];
var Context$2 = /* @__PURE__ */ reactExports.createContext({});
function MotionProvider(_ref) {
  var children = _ref.children, props = _objectWithoutProperties$3(_ref, _excluded$y);
  return /* @__PURE__ */ reactExports.createElement(Context$2.Provider, {
    value: props
  }, children);
}
var DomWrapper = /* @__PURE__ */ function(_React$Component) {
  _inherits$a(DomWrapper2, _React$Component);
  var _super = _createSuper$4(DomWrapper2);
  function DomWrapper2() {
    _classCallCheck$a(this, DomWrapper2);
    return _super.apply(this, arguments);
  }
  _createClass$8(DomWrapper2, [{
    key: "render",
    value: function render3() {
      return this.props.children;
    }
  }]);
  return DomWrapper2;
}(reactExports.Component);
function useSyncState(defaultValue2) {
  var _React$useReducer = reactExports.useReducer(function(x2) {
    return x2 + 1;
  }, 0), _React$useReducer2 = _slicedToArray(_React$useReducer, 2), forceUpdate = _React$useReducer2[1];
  var currentValueRef = reactExports.useRef(defaultValue2);
  var getValue2 = useEvent$1(function() {
    return currentValueRef.current;
  });
  var setValue = useEvent$1(function(updater) {
    currentValueRef.current = typeof updater === "function" ? updater(currentValueRef.current) : updater;
    forceUpdate();
  });
  return [getValue2, setValue];
}
var STATUS_NONE = "none";
var STATUS_APPEAR = "appear";
var STATUS_ENTER = "enter";
var STATUS_LEAVE = "leave";
var STEP_NONE = "none";
var STEP_PREPARE = "prepare";
var STEP_START = "start";
var STEP_ACTIVE = "active";
var STEP_ACTIVATED = "end";
var STEP_PREPARED = "prepared";
function makePrefixMap(styleProp, eventName) {
  var prefixes = {};
  prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
  prefixes["Webkit".concat(styleProp)] = "webkit".concat(eventName);
  prefixes["Moz".concat(styleProp)] = "moz".concat(eventName);
  prefixes["ms".concat(styleProp)] = "MS".concat(eventName);
  prefixes["O".concat(styleProp)] = "o".concat(eventName.toLowerCase());
  return prefixes;
}
function getVendorPrefixes(domSupport, win2) {
  var prefixes = {
    animationend: makePrefixMap("Animation", "AnimationEnd"),
    transitionend: makePrefixMap("Transition", "TransitionEnd")
  };
  if (domSupport) {
    if (!("AnimationEvent" in win2)) {
      delete prefixes.animationend.animation;
    }
    if (!("TransitionEvent" in win2)) {
      delete prefixes.transitionend.transition;
    }
  }
  return prefixes;
}
var vendorPrefixes = getVendorPrefixes(canUseDom(), typeof window !== "undefined" ? window : {});
var style = {};
if (canUseDom()) {
  var _document$createEleme = document.createElement("div");
  style = _document$createEleme.style;
}
var prefixedEventNames = {};
function getVendorPrefixedEventName(eventName) {
  if (prefixedEventNames[eventName]) {
    return prefixedEventNames[eventName];
  }
  var prefixMap = vendorPrefixes[eventName];
  if (prefixMap) {
    var stylePropList = Object.keys(prefixMap);
    var len = stylePropList.length;
    for (var i2 = 0; i2 < len; i2 += 1) {
      var styleProp = stylePropList[i2];
      if (Object.prototype.hasOwnProperty.call(prefixMap, styleProp) && styleProp in style) {
        prefixedEventNames[eventName] = prefixMap[styleProp];
        return prefixedEventNames[eventName];
      }
    }
  }
  return "";
}
var internalAnimationEndName = getVendorPrefixedEventName("animationend");
var internalTransitionEndName = getVendorPrefixedEventName("transitionend");
var supportTransition = !!(internalAnimationEndName && internalTransitionEndName);
var animationEndName = internalAnimationEndName || "animationend";
var transitionEndName = internalTransitionEndName || "transitionend";
function getTransitionName$1(transitionName, transitionType) {
  if (!transitionName)
    return null;
  if (_typeof$1(transitionName) === "object") {
    var type4 = transitionType.replace(/-\w/g, function(match5) {
      return match5[1].toUpperCase();
    });
    return transitionName[type4];
  }
  return "".concat(transitionName, "-").concat(transitionType);
}
const useDomMotionEvents = function(onInternalMotionEnd) {
  var cacheElementRef = reactExports.useRef();
  function removeMotionEvents(element2) {
    if (element2) {
      element2.removeEventListener(transitionEndName, onInternalMotionEnd);
      element2.removeEventListener(animationEndName, onInternalMotionEnd);
    }
  }
  function patchMotionEvents(element2) {
    if (cacheElementRef.current && cacheElementRef.current !== element2) {
      removeMotionEvents(cacheElementRef.current);
    }
    if (element2 && element2 !== cacheElementRef.current) {
      element2.addEventListener(transitionEndName, onInternalMotionEnd);
      element2.addEventListener(animationEndName, onInternalMotionEnd);
      cacheElementRef.current = element2;
    }
  }
  reactExports.useEffect(function() {
    return function() {
      removeMotionEvents(cacheElementRef.current);
    };
  }, []);
  return [patchMotionEvents, removeMotionEvents];
};
var useIsomorphicLayoutEffect$2 = canUseDom() ? reactExports.useLayoutEffect : reactExports.useEffect;
const useNextFrame = function() {
  var nextFrameRef = reactExports.useRef(null);
  function cancelNextFrame() {
    wrapperRaf.cancel(nextFrameRef.current);
  }
  function nextFrame(callback2) {
    var delay2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 2;
    cancelNextFrame();
    var nextFrameId = wrapperRaf(function() {
      if (delay2 <= 1) {
        callback2({
          isCanceled: function isCanceled() {
            return nextFrameId !== nextFrameRef.current;
          }
        });
      } else {
        nextFrame(callback2, delay2 - 1);
      }
    });
    nextFrameRef.current = nextFrameId;
  }
  reactExports.useEffect(function() {
    return function() {
      cancelNextFrame();
    };
  }, []);
  return [nextFrame, cancelNextFrame];
};
var FULL_STEP_QUEUE = [STEP_PREPARE, STEP_START, STEP_ACTIVE, STEP_ACTIVATED];
var SIMPLE_STEP_QUEUE = [STEP_PREPARE, STEP_PREPARED];
var SkipStep = false;
var DoStep = true;
function isActive(step) {
  return step === STEP_ACTIVE || step === STEP_ACTIVATED;
}
const useStepQueue = function(status, prepareOnly, callback2) {
  var _useState = useSafeState(STEP_NONE), _useState2 = _slicedToArray(_useState, 2), step = _useState2[0], setStep = _useState2[1];
  var _useNextFrame = useNextFrame(), _useNextFrame2 = _slicedToArray(_useNextFrame, 2), nextFrame = _useNextFrame2[0], cancelNextFrame = _useNextFrame2[1];
  function startQueue() {
    setStep(STEP_PREPARE, true);
  }
  var STEP_QUEUE = prepareOnly ? SIMPLE_STEP_QUEUE : FULL_STEP_QUEUE;
  useIsomorphicLayoutEffect$2(function() {
    if (step !== STEP_NONE && step !== STEP_ACTIVATED) {
      var index2 = STEP_QUEUE.indexOf(step);
      var nextStep = STEP_QUEUE[index2 + 1];
      var result = callback2(step);
      if (result === SkipStep) {
        setStep(nextStep, true);
      } else if (nextStep) {
        nextFrame(function(info2) {
          function doNext() {
            if (info2.isCanceled())
              return;
            setStep(nextStep, true);
          }
          if (result === true) {
            doNext();
          } else {
            Promise.resolve(result).then(doNext);
          }
        });
      }
    }
  }, [status, step]);
  reactExports.useEffect(function() {
    return function() {
      cancelNextFrame();
    };
  }, []);
  return [startQueue, step];
};
function useStatus(supportMotion, visible, getElement, _ref) {
  var _ref$motionEnter = _ref.motionEnter, motionEnter = _ref$motionEnter === void 0 ? true : _ref$motionEnter, _ref$motionAppear = _ref.motionAppear, motionAppear = _ref$motionAppear === void 0 ? true : _ref$motionAppear, _ref$motionLeave = _ref.motionLeave, motionLeave = _ref$motionLeave === void 0 ? true : _ref$motionLeave, motionDeadline = _ref.motionDeadline, motionLeaveImmediately = _ref.motionLeaveImmediately, onAppearPrepare = _ref.onAppearPrepare, onEnterPrepare = _ref.onEnterPrepare, onLeavePrepare = _ref.onLeavePrepare, onAppearStart = _ref.onAppearStart, onEnterStart = _ref.onEnterStart, onLeaveStart = _ref.onLeaveStart, onAppearActive = _ref.onAppearActive, onEnterActive = _ref.onEnterActive, onLeaveActive = _ref.onLeaveActive, onAppearEnd = _ref.onAppearEnd, onEnterEnd = _ref.onEnterEnd, onLeaveEnd = _ref.onLeaveEnd, onVisibleChanged = _ref.onVisibleChanged;
  var _useState = useSafeState(), _useState2 = _slicedToArray(_useState, 2), asyncVisible = _useState2[0], setAsyncVisible = _useState2[1];
  var _useSyncState = useSyncState(STATUS_NONE), _useSyncState2 = _slicedToArray(_useSyncState, 2), getStatus = _useSyncState2[0], setStatus = _useSyncState2[1];
  var _useState3 = useSafeState(null), _useState4 = _slicedToArray(_useState3, 2), style2 = _useState4[0], setStyle2 = _useState4[1];
  var currentStatus = getStatus();
  var mountedRef = reactExports.useRef(false);
  var deadlineRef = reactExports.useRef(null);
  function getDomElement() {
    return getElement();
  }
  var activeRef = reactExports.useRef(false);
  function updateMotionEndStatus() {
    setStatus(STATUS_NONE);
    setStyle2(null, true);
  }
  var onInternalMotionEnd = useEvent$1(function(event) {
    var status = getStatus();
    if (status === STATUS_NONE) {
      return;
    }
    var element2 = getDomElement();
    if (event && !event.deadline && event.target !== element2) {
      return;
    }
    var currentActive = activeRef.current;
    var canEnd;
    if (status === STATUS_APPEAR && currentActive) {
      canEnd = onAppearEnd === null || onAppearEnd === void 0 ? void 0 : onAppearEnd(element2, event);
    } else if (status === STATUS_ENTER && currentActive) {
      canEnd = onEnterEnd === null || onEnterEnd === void 0 ? void 0 : onEnterEnd(element2, event);
    } else if (status === STATUS_LEAVE && currentActive) {
      canEnd = onLeaveEnd === null || onLeaveEnd === void 0 ? void 0 : onLeaveEnd(element2, event);
    }
    if (currentActive && canEnd !== false) {
      updateMotionEndStatus();
    }
  });
  var _useDomMotionEvents = useDomMotionEvents(onInternalMotionEnd), _useDomMotionEvents2 = _slicedToArray(_useDomMotionEvents, 1), patchMotionEvents = _useDomMotionEvents2[0];
  var getEventHandlers = function getEventHandlers2(targetStatus) {
    switch (targetStatus) {
      case STATUS_APPEAR:
        return _defineProperty$3(_defineProperty$3(_defineProperty$3({}, STEP_PREPARE, onAppearPrepare), STEP_START, onAppearStart), STEP_ACTIVE, onAppearActive);
      case STATUS_ENTER:
        return _defineProperty$3(_defineProperty$3(_defineProperty$3({}, STEP_PREPARE, onEnterPrepare), STEP_START, onEnterStart), STEP_ACTIVE, onEnterActive);
      case STATUS_LEAVE:
        return _defineProperty$3(_defineProperty$3(_defineProperty$3({}, STEP_PREPARE, onLeavePrepare), STEP_START, onLeaveStart), STEP_ACTIVE, onLeaveActive);
      default:
        return {};
    }
  };
  var eventHandlers = reactExports.useMemo(function() {
    return getEventHandlers(currentStatus);
  }, [currentStatus]);
  var _useStepQueue = useStepQueue(currentStatus, !supportMotion, function(newStep) {
    if (newStep === STEP_PREPARE) {
      var onPrepare = eventHandlers[STEP_PREPARE];
      if (!onPrepare) {
        return SkipStep;
      }
      return onPrepare(getDomElement());
    }
    if (step in eventHandlers) {
      var _eventHandlers$step;
      setStyle2(((_eventHandlers$step = eventHandlers[step]) === null || _eventHandlers$step === void 0 ? void 0 : _eventHandlers$step.call(eventHandlers, getDomElement(), null)) || null);
    }
    if (step === STEP_ACTIVE && currentStatus !== STATUS_NONE) {
      patchMotionEvents(getDomElement());
      if (motionDeadline > 0) {
        clearTimeout(deadlineRef.current);
        deadlineRef.current = setTimeout(function() {
          onInternalMotionEnd({
            deadline: true
          });
        }, motionDeadline);
      }
    }
    if (step === STEP_PREPARED) {
      updateMotionEndStatus();
    }
    return DoStep;
  }), _useStepQueue2 = _slicedToArray(_useStepQueue, 2), startStep = _useStepQueue2[0], step = _useStepQueue2[1];
  var active3 = isActive(step);
  activeRef.current = active3;
  var visibleRef = reactExports.useRef(null);
  useIsomorphicLayoutEffect$2(function() {
    if (mountedRef.current && visibleRef.current === visible) {
      return;
    }
    setAsyncVisible(visible);
    var isMounted = mountedRef.current;
    mountedRef.current = true;
    var nextStatus;
    if (!isMounted && visible && motionAppear) {
      nextStatus = STATUS_APPEAR;
    }
    if (isMounted && visible && motionEnter) {
      nextStatus = STATUS_ENTER;
    }
    if (isMounted && !visible && motionLeave || !isMounted && motionLeaveImmediately && !visible && motionLeave) {
      nextStatus = STATUS_LEAVE;
    }
    var nextEventHandlers = getEventHandlers(nextStatus);
    if (nextStatus && (supportMotion || nextEventHandlers[STEP_PREPARE])) {
      setStatus(nextStatus);
      startStep();
    } else {
      setStatus(STATUS_NONE);
    }
    visibleRef.current = visible;
  }, [visible]);
  reactExports.useEffect(function() {
    if (
      // Cancel appear
      currentStatus === STATUS_APPEAR && !motionAppear || // Cancel enter
      currentStatus === STATUS_ENTER && !motionEnter || // Cancel leave
      currentStatus === STATUS_LEAVE && !motionLeave
    ) {
      setStatus(STATUS_NONE);
    }
  }, [motionAppear, motionEnter, motionLeave]);
  reactExports.useEffect(function() {
    return function() {
      mountedRef.current = false;
      clearTimeout(deadlineRef.current);
    };
  }, []);
  var firstMountChangeRef = reactExports.useRef(false);
  reactExports.useEffect(function() {
    if (asyncVisible) {
      firstMountChangeRef.current = true;
    }
    if (asyncVisible !== void 0 && currentStatus === STATUS_NONE) {
      if (firstMountChangeRef.current || asyncVisible) {
        onVisibleChanged === null || onVisibleChanged === void 0 || onVisibleChanged(asyncVisible);
      }
      firstMountChangeRef.current = true;
    }
  }, [asyncVisible, currentStatus]);
  var mergedStyle = style2;
  if (eventHandlers[STEP_PREPARE] && step === STEP_START) {
    mergedStyle = _objectSpread2({
      transition: "none"
    }, mergedStyle);
  }
  return [currentStatus, step, mergedStyle, asyncVisible !== null && asyncVisible !== void 0 ? asyncVisible : visible];
}
function genCSSMotion(config2) {
  var transitionSupport = config2;
  if (_typeof$1(config2) === "object") {
    transitionSupport = config2.transitionSupport;
  }
  function isSupportTransition(props, contextMotion) {
    return !!(props.motionName && transitionSupport && contextMotion !== false);
  }
  var CSSMotion2 = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
    var _props$visible = props.visible, visible = _props$visible === void 0 ? true : _props$visible, _props$removeOnLeave = props.removeOnLeave, removeOnLeave = _props$removeOnLeave === void 0 ? true : _props$removeOnLeave, forceRender = props.forceRender, children = props.children, motionName = props.motionName, leavedClassName = props.leavedClassName, eventProps = props.eventProps;
    var _React$useContext = reactExports.useContext(Context$2), contextMotion = _React$useContext.motion;
    var supportMotion = isSupportTransition(props, contextMotion);
    var nodeRef = reactExports.useRef();
    var wrapperNodeRef = reactExports.useRef();
    function getDomElement() {
      try {
        return nodeRef.current instanceof HTMLElement ? nodeRef.current : findDOMNode(wrapperNodeRef.current);
      } catch (e2) {
        return null;
      }
    }
    var _useStatus = useStatus(supportMotion, visible, getDomElement, props), _useStatus2 = _slicedToArray(_useStatus, 4), status = _useStatus2[0], statusStep = _useStatus2[1], statusStyle = _useStatus2[2], mergedVisible = _useStatus2[3];
    var renderedRef = reactExports.useRef(mergedVisible);
    if (mergedVisible) {
      renderedRef.current = true;
    }
    var setNodeRef = reactExports.useCallback(function(node2) {
      nodeRef.current = node2;
      fillRef(ref, node2);
    }, [ref]);
    var motionChildren;
    var mergedProps = _objectSpread2(_objectSpread2({}, eventProps), {}, {
      visible
    });
    if (!children) {
      motionChildren = null;
    } else if (status === STATUS_NONE) {
      if (mergedVisible) {
        motionChildren = children(_objectSpread2({}, mergedProps), setNodeRef);
      } else if (!removeOnLeave && renderedRef.current && leavedClassName) {
        motionChildren = children(_objectSpread2(_objectSpread2({}, mergedProps), {}, {
          className: leavedClassName
        }), setNodeRef);
      } else if (forceRender || !removeOnLeave && !leavedClassName) {
        motionChildren = children(_objectSpread2(_objectSpread2({}, mergedProps), {}, {
          style: {
            display: "none"
          }
        }), setNodeRef);
      } else {
        motionChildren = null;
      }
    } else {
      var statusSuffix;
      if (statusStep === STEP_PREPARE) {
        statusSuffix = "prepare";
      } else if (isActive(statusStep)) {
        statusSuffix = "active";
      } else if (statusStep === STEP_START) {
        statusSuffix = "start";
      }
      var motionCls = getTransitionName$1(motionName, "".concat(status, "-").concat(statusSuffix));
      motionChildren = children(_objectSpread2(_objectSpread2({}, mergedProps), {}, {
        className: classNames(getTransitionName$1(motionName, status), _defineProperty$3(_defineProperty$3({}, motionCls, motionCls && statusSuffix), motionName, typeof motionName === "string")),
        style: statusStyle
      }), setNodeRef);
    }
    if (/* @__PURE__ */ reactExports.isValidElement(motionChildren) && supportRef(motionChildren)) {
      var originNodeRef = getNodeRef(motionChildren);
      if (!originNodeRef) {
        motionChildren = /* @__PURE__ */ reactExports.cloneElement(motionChildren, {
          ref: setNodeRef
        });
      }
    }
    return /* @__PURE__ */ reactExports.createElement(DomWrapper, {
      ref: wrapperNodeRef
    }, motionChildren);
  });
  CSSMotion2.displayName = "CSSMotion";
  return CSSMotion2;
}
const CSSMotion = genCSSMotion(supportTransition);
var STATUS_ADD = "add";
var STATUS_KEEP = "keep";
var STATUS_REMOVE = "remove";
var STATUS_REMOVED = "removed";
function wrapKeyToObject(key) {
  var keyObj;
  if (key && _typeof$1(key) === "object" && "key" in key) {
    keyObj = key;
  } else {
    keyObj = {
      key
    };
  }
  return _objectSpread2(_objectSpread2({}, keyObj), {}, {
    key: String(keyObj.key)
  });
}
function parseKeys() {
  var keys2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
  return keys2.map(wrapKeyToObject);
}
function diffKeys() {
  var prevKeys = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
  var currentKeys = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
  var list2 = [];
  var currentIndex = 0;
  var currentLen = currentKeys.length;
  var prevKeyObjects = parseKeys(prevKeys);
  var currentKeyObjects = parseKeys(currentKeys);
  prevKeyObjects.forEach(function(keyObj) {
    var hit = false;
    for (var i2 = currentIndex; i2 < currentLen; i2 += 1) {
      var currentKeyObj = currentKeyObjects[i2];
      if (currentKeyObj.key === keyObj.key) {
        if (currentIndex < i2) {
          list2 = list2.concat(currentKeyObjects.slice(currentIndex, i2).map(function(obj) {
            return _objectSpread2(_objectSpread2({}, obj), {}, {
              status: STATUS_ADD
            });
          }));
          currentIndex = i2;
        }
        list2.push(_objectSpread2(_objectSpread2({}, currentKeyObj), {}, {
          status: STATUS_KEEP
        }));
        currentIndex += 1;
        hit = true;
        break;
      }
    }
    if (!hit) {
      list2.push(_objectSpread2(_objectSpread2({}, keyObj), {}, {
        status: STATUS_REMOVE
      }));
    }
  });
  if (currentIndex < currentLen) {
    list2 = list2.concat(currentKeyObjects.slice(currentIndex).map(function(obj) {
      return _objectSpread2(_objectSpread2({}, obj), {}, {
        status: STATUS_ADD
      });
    }));
  }
  var keys2 = {};
  list2.forEach(function(_ref) {
    var key = _ref.key;
    keys2[key] = (keys2[key] || 0) + 1;
  });
  var duplicatedKeys = Object.keys(keys2).filter(function(key) {
    return keys2[key] > 1;
  });
  duplicatedKeys.forEach(function(matchKey) {
    list2 = list2.filter(function(_ref2) {
      var key = _ref2.key, status = _ref2.status;
      return key !== matchKey || status !== STATUS_REMOVE;
    });
    list2.forEach(function(node2) {
      if (node2.key === matchKey) {
        node2.status = STATUS_KEEP;
      }
    });
  });
  return list2;
}
var _excluded$x = ["component", "children", "onVisibleChanged", "onAllRemoved"], _excluded2$6 = ["status"];
var MOTION_PROP_NAMES = ["eventProps", "visible", "children", "motionName", "motionAppear", "motionEnter", "motionLeave", "motionLeaveImmediately", "motionDeadline", "removeOnLeave", "leavedClassName", "onAppearPrepare", "onAppearStart", "onAppearActive", "onAppearEnd", "onEnterStart", "onEnterActive", "onEnterEnd", "onLeaveStart", "onLeaveActive", "onLeaveEnd"];
function genCSSMotionList(transitionSupport) {
  var CSSMotion$1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : CSSMotion;
  var CSSMotionList = /* @__PURE__ */ function(_React$Component) {
    _inherits$a(CSSMotionList2, _React$Component);
    var _super = _createSuper$4(CSSMotionList2);
    function CSSMotionList2() {
      var _this;
      _classCallCheck$a(this, CSSMotionList2);
      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
      _this = _super.call.apply(_super, [this].concat(args));
      _defineProperty$3(_assertThisInitialized(_this), "state", {
        keyEntities: []
      });
      _defineProperty$3(_assertThisInitialized(_this), "removeKey", function(removeKey) {
        _this.setState(function(prevState) {
          var nextKeyEntities = prevState.keyEntities.map(function(entity) {
            if (entity.key !== removeKey)
              return entity;
            return _objectSpread2(_objectSpread2({}, entity), {}, {
              status: STATUS_REMOVED
            });
          });
          return {
            keyEntities: nextKeyEntities
          };
        }, function() {
          var keyEntities = _this.state.keyEntities;
          var restKeysCount = keyEntities.filter(function(_ref) {
            var status = _ref.status;
            return status !== STATUS_REMOVED;
          }).length;
          if (restKeysCount === 0 && _this.props.onAllRemoved) {
            _this.props.onAllRemoved();
          }
        });
      });
      return _this;
    }
    _createClass$8(CSSMotionList2, [{
      key: "render",
      value: function render3() {
        var _this2 = this;
        var keyEntities = this.state.keyEntities;
        var _this$props = this.props, component = _this$props.component, children = _this$props.children, _onVisibleChanged = _this$props.onVisibleChanged;
        _this$props.onAllRemoved;
        var restProps = _objectWithoutProperties$3(_this$props, _excluded$x);
        var Component2 = component || reactExports.Fragment;
        var motionProps = {};
        MOTION_PROP_NAMES.forEach(function(prop) {
          motionProps[prop] = restProps[prop];
          delete restProps[prop];
        });
        delete restProps.keys;
        return /* @__PURE__ */ reactExports.createElement(Component2, restProps, keyEntities.map(function(_ref2, index2) {
          var status = _ref2.status, eventProps = _objectWithoutProperties$3(_ref2, _excluded2$6);
          var visible = status === STATUS_ADD || status === STATUS_KEEP;
          return /* @__PURE__ */ reactExports.createElement(CSSMotion$1, _extends$h({}, motionProps, {
            key: eventProps.key,
            visible,
            eventProps,
            onVisibleChanged: function onVisibleChanged(changedVisible) {
              _onVisibleChanged === null || _onVisibleChanged === void 0 || _onVisibleChanged(changedVisible, {
                key: eventProps.key
              });
              if (!changedVisible) {
                _this2.removeKey(eventProps.key);
              }
            }
          }), function(props, ref) {
            return children(_objectSpread2(_objectSpread2({}, props), {}, {
              index: index2
            }), ref);
          });
        }));
      }
    }], [{
      key: "getDerivedStateFromProps",
      value: function getDerivedStateFromProps(_ref3, _ref4) {
        var keys2 = _ref3.keys;
        var keyEntities = _ref4.keyEntities;
        var parsedKeyObjects = parseKeys(keys2);
        var mixedKeyEntities = diffKeys(keyEntities, parsedKeyObjects);
        return {
          keyEntities: mixedKeyEntities.filter(function(entity) {
            var prevEntity = keyEntities.find(function(_ref5) {
              var key = _ref5.key;
              return entity.key === key;
            });
            if (prevEntity && prevEntity.status === STATUS_REMOVED && entity.status === STATUS_REMOVE) {
              return false;
            }
            return true;
          })
        };
      }
    }]);
    return CSSMotionList2;
  }(reactExports.Component);
  _defineProperty$3(CSSMotionList, "defaultProps", {
    component: "div"
  });
  return CSSMotionList;
}
genCSSMotionList(supportTransition);
const MotionCacheContext = /* @__PURE__ */ reactExports.createContext(true);
function MotionWrapper(props) {
  const parentMotion = reactExports.useContext(MotionCacheContext);
  const {
    children
  } = props;
  const [, token2] = useToken();
  const {
    motion
  } = token2;
  const needWrapMotionProviderRef = reactExports.useRef(false);
  needWrapMotionProviderRef.current || (needWrapMotionProviderRef.current = parentMotion !== motion);
  if (needWrapMotionProviderRef.current) {
    return /* @__PURE__ */ reactExports.createElement(MotionCacheContext.Provider, {
      value: motion
    }, /* @__PURE__ */ reactExports.createElement(MotionProvider, {
      motion
    }, children));
  }
  return children;
}
const PropWarning = () => null;
var __rest$7 = function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
};
const PASSED_PROPS = ["getTargetContainer", "getPopupContainer", "renderEmpty", "input", "pagination", "form", "select", "button"];
let globalPrefixCls;
function getGlobalPrefixCls() {
  return globalPrefixCls || defaultPrefixCls;
}
function isLegacyTheme(theme2) {
  return Object.keys(theme2).some((key) => key.endsWith("Color"));
}
const setGlobalConfig = (props) => {
  const {
    prefixCls,
    iconPrefixCls,
    theme: theme2,
    holderRender
  } = props;
  if (prefixCls !== void 0) {
    globalPrefixCls = prefixCls;
  }
  if (theme2) {
    if (isLegacyTheme(theme2)) {
      registerTheme(getGlobalPrefixCls(), theme2);
    }
  }
};
const ProviderChildren = (props) => {
  const {
    children,
    csp: customCsp,
    autoInsertSpaceInButton,
    alert: alert2,
    anchor,
    form: form2,
    locale: locale2,
    componentSize,
    direction,
    space: space2,
    splitter,
    virtual,
    dropdownMatchSelectWidth,
    popupMatchSelectWidth,
    popupOverflow,
    legacyLocale,
    parentContext,
    iconPrefixCls: customIconPrefixCls,
    theme: theme2,
    componentDisabled,
    segmented,
    statistic: statistic2,
    spin: spin2,
    calendar: calendar2,
    carousel,
    cascader,
    collapse,
    typography,
    checkbox: checkbox2,
    descriptions,
    divider: divider2,
    drawer,
    skeleton,
    steps,
    image: image2,
    layout: layout2,
    list: list2,
    mentions,
    modal: modal2,
    progress: progress2,
    result,
    slider: slider2,
    breadcrumb,
    menu: menu2,
    pagination: pagination2,
    input: input2,
    textArea,
    empty: empty2,
    badge: badge2,
    radio: radio2,
    rate,
    switch: SWITCH,
    transfer,
    avatar,
    message,
    tag,
    table: table2,
    card: card2,
    tabs: tabs2,
    timeline,
    timePicker,
    upload,
    notification,
    tree,
    colorPicker,
    datePicker: datePicker2,
    rangePicker,
    flex: flex2,
    wave,
    dropdown: dropdown2,
    warning: warningConfig,
    tour,
    tooltip,
    popover: popover2,
    popconfirm,
    floatButtonGroup,
    variant,
    inputNumber,
    treeSelect
  } = props;
  const getPrefixCls = reactExports.useCallback((suffixCls, customizePrefixCls) => {
    const {
      prefixCls
    } = props;
    if (customizePrefixCls) {
      return customizePrefixCls;
    }
    const mergedPrefixCls = prefixCls || parentContext.getPrefixCls("");
    return suffixCls ? `${mergedPrefixCls}-${suffixCls}` : mergedPrefixCls;
  }, [parentContext.getPrefixCls, props.prefixCls]);
  const iconPrefixCls = customIconPrefixCls || parentContext.iconPrefixCls || defaultIconPrefixCls;
  const csp = customCsp || parentContext.csp;
  useResetIconStyle(iconPrefixCls, csp);
  const mergedTheme = useTheme(theme2, parentContext.theme, {
    prefixCls: getPrefixCls("")
  });
  const baseConfig2 = {
    csp,
    autoInsertSpaceInButton,
    alert: alert2,
    anchor,
    locale: locale2 || legacyLocale,
    direction,
    space: space2,
    splitter,
    virtual,
    popupMatchSelectWidth: popupMatchSelectWidth !== null && popupMatchSelectWidth !== void 0 ? popupMatchSelectWidth : dropdownMatchSelectWidth,
    popupOverflow,
    getPrefixCls,
    iconPrefixCls,
    theme: mergedTheme,
    segmented,
    statistic: statistic2,
    spin: spin2,
    calendar: calendar2,
    carousel,
    cascader,
    collapse,
    typography,
    checkbox: checkbox2,
    descriptions,
    divider: divider2,
    drawer,
    skeleton,
    steps,
    image: image2,
    input: input2,
    textArea,
    layout: layout2,
    list: list2,
    mentions,
    modal: modal2,
    progress: progress2,
    result,
    slider: slider2,
    breadcrumb,
    menu: menu2,
    pagination: pagination2,
    empty: empty2,
    badge: badge2,
    radio: radio2,
    rate,
    switch: SWITCH,
    transfer,
    avatar,
    message,
    tag,
    table: table2,
    card: card2,
    tabs: tabs2,
    timeline,
    timePicker,
    upload,
    notification,
    tree,
    colorPicker,
    datePicker: datePicker2,
    rangePicker,
    flex: flex2,
    wave,
    dropdown: dropdown2,
    warning: warningConfig,
    tour,
    tooltip,
    popover: popover2,
    popconfirm,
    floatButtonGroup,
    variant,
    inputNumber,
    treeSelect
  };
  const config2 = Object.assign({}, parentContext);
  Object.keys(baseConfig2).forEach((key) => {
    if (baseConfig2[key] !== void 0) {
      config2[key] = baseConfig2[key];
    }
  });
  PASSED_PROPS.forEach((propName) => {
    const propValue = props[propName];
    if (propValue) {
      config2[propName] = propValue;
    }
  });
  if (typeof autoInsertSpaceInButton !== "undefined") {
    config2.button = Object.assign({
      autoInsertSpace: autoInsertSpaceInButton
    }, config2.button);
  }
  const memoedConfig = useMemo(() => config2, config2, (prevConfig, currentConfig) => {
    const prevKeys = Object.keys(prevConfig);
    const currentKeys = Object.keys(currentConfig);
    return prevKeys.length !== currentKeys.length || prevKeys.some((key) => prevConfig[key] !== currentConfig[key]);
  });
  const {
    layer: layer2
  } = reactExports.useContext(StyleContext);
  const memoIconContextValue = reactExports.useMemo(() => ({
    prefixCls: iconPrefixCls,
    csp,
    layer: layer2 ? "antd" : void 0
  }), [iconPrefixCls, csp, layer2]);
  let childNode = /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__PURE__ */ reactExports.createElement(PropWarning, {
    dropdownMatchSelectWidth
  }), children);
  const validateMessages = reactExports.useMemo(() => {
    var _a2, _b2, _c2, _d;
    return merge$5(((_a2 = localeValues.Form) === null || _a2 === void 0 ? void 0 : _a2.defaultValidateMessages) || {}, ((_c2 = (_b2 = memoedConfig.locale) === null || _b2 === void 0 ? void 0 : _b2.Form) === null || _c2 === void 0 ? void 0 : _c2.defaultValidateMessages) || {}, ((_d = memoedConfig.form) === null || _d === void 0 ? void 0 : _d.validateMessages) || {}, (form2 === null || form2 === void 0 ? void 0 : form2.validateMessages) || {});
  }, [memoedConfig, form2 === null || form2 === void 0 ? void 0 : form2.validateMessages]);
  if (Object.keys(validateMessages).length > 0) {
    childNode = /* @__PURE__ */ reactExports.createElement(ValidateMessagesContext.Provider, {
      value: validateMessages
    }, childNode);
  }
  if (locale2) {
    childNode = /* @__PURE__ */ reactExports.createElement(LocaleProvider, {
      locale: locale2,
      _ANT_MARK__: ANT_MARK
    }, childNode);
  }
  {
    childNode = /* @__PURE__ */ reactExports.createElement(IconContext$1.Provider, {
      value: memoIconContextValue
    }, childNode);
  }
  if (componentSize) {
    childNode = /* @__PURE__ */ reactExports.createElement(SizeContextProvider, {
      size: componentSize
    }, childNode);
  }
  childNode = /* @__PURE__ */ reactExports.createElement(MotionWrapper, null, childNode);
  const memoTheme = reactExports.useMemo(() => {
    const _a2 = mergedTheme || {}, {
      algorithm,
      token: token2,
      components: components2,
      cssVar
    } = _a2, rest = __rest$7(_a2, ["algorithm", "token", "components", "cssVar"]);
    const themeObj = algorithm && (!Array.isArray(algorithm) || algorithm.length > 0) ? createTheme(algorithm) : defaultTheme;
    const parsedComponents = {};
    Object.entries(components2 || {}).forEach(([componentName, componentToken]) => {
      const parsedToken = Object.assign({}, componentToken);
      if ("algorithm" in parsedToken) {
        if (parsedToken.algorithm === true) {
          parsedToken.theme = themeObj;
        } else if (Array.isArray(parsedToken.algorithm) || typeof parsedToken.algorithm === "function") {
          parsedToken.theme = createTheme(parsedToken.algorithm);
        }
        delete parsedToken.algorithm;
      }
      parsedComponents[componentName] = parsedToken;
    });
    const mergedToken = Object.assign(Object.assign({}, seedToken), token2);
    return Object.assign(Object.assign({}, rest), {
      theme: themeObj,
      token: mergedToken,
      components: parsedComponents,
      override: Object.assign({
        override: mergedToken
      }, parsedComponents),
      cssVar
    });
  }, [mergedTheme]);
  if (theme2) {
    childNode = /* @__PURE__ */ reactExports.createElement(DesignTokenContext.Provider, {
      value: memoTheme
    }, childNode);
  }
  if (memoedConfig.warning) {
    childNode = /* @__PURE__ */ reactExports.createElement(WarningContext.Provider, {
      value: memoedConfig.warning
    }, childNode);
  }
  if (componentDisabled !== void 0) {
    childNode = /* @__PURE__ */ reactExports.createElement(DisabledContextProvider, {
      disabled: componentDisabled
    }, childNode);
  }
  return /* @__PURE__ */ reactExports.createElement(ConfigContext.Provider, {
    value: memoedConfig
  }, childNode);
};
const ConfigProvider = (props) => {
  const context = reactExports.useContext(ConfigContext);
  const antLocale = reactExports.useContext(LocaleContext);
  return /* @__PURE__ */ reactExports.createElement(ProviderChildren, Object.assign({
    parentContext: context,
    legacyLocale: antLocale
  }, props));
};
ConfigProvider.ConfigContext = ConfigContext;
ConfigProvider.SizeContext = SizeContext;
ConfigProvider.config = setGlobalConfig;
ConfigProvider.useConfig = useConfig;
Object.defineProperty(ConfigProvider, "SizeContext", {
  get: () => {
    return SizeContext;
  }
});
function getRoot(ele) {
  var _ele$getRootNode;
  return ele === null || ele === void 0 || (_ele$getRootNode = ele.getRootNode) === null || _ele$getRootNode === void 0 ? void 0 : _ele$getRootNode.call(ele);
}
function inShadow(ele) {
  return getRoot(ele) instanceof ShadowRoot;
}
function getShadowRoot(ele) {
  return inShadow(ele) ? getRoot(ele) : null;
}
function camelCase$1(input2) {
  return input2.replace(/-(.)/g, function(match5, g2) {
    return g2.toUpperCase();
  });
}
function warning$1(valid2, message) {
  warningOnce(valid2, "[@ant-design/icons] ".concat(message));
}
function isIconDefinition(target) {
  return _typeof$1(target) === "object" && typeof target.name === "string" && typeof target.theme === "string" && (_typeof$1(target.icon) === "object" || typeof target.icon === "function");
}
function normalizeAttrs() {
  var attrs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
  return Object.keys(attrs).reduce(function(acc, key) {
    var val = attrs[key];
    switch (key) {
      case "class":
        acc.className = val;
        delete acc.class;
        break;
      default:
        delete acc[key];
        acc[camelCase$1(key)] = val;
    }
    return acc;
  }, {});
}
function generate(node2, key, rootProps) {
  if (!rootProps) {
    return /* @__PURE__ */ React$5.createElement(node2.tag, _objectSpread2({
      key
    }, normalizeAttrs(node2.attrs)), (node2.children || []).map(function(child, index2) {
      return generate(child, "".concat(key, "-").concat(node2.tag, "-").concat(index2));
    }));
  }
  return /* @__PURE__ */ React$5.createElement(node2.tag, _objectSpread2(_objectSpread2({
    key
  }, normalizeAttrs(node2.attrs)), rootProps), (node2.children || []).map(function(child, index2) {
    return generate(child, "".concat(key, "-").concat(node2.tag, "-").concat(index2));
  }));
}
function getSecondaryColor(primaryColor) {
  return generate$1(primaryColor)[0];
}
function normalizeTwoToneColors(twoToneColor) {
  if (!twoToneColor) {
    return [];
  }
  return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor];
}
var iconStyles = "\n.anticon {\n  display: inline-flex;\n  align-items: center;\n  color: inherit;\n  font-style: normal;\n  line-height: 0;\n  text-align: center;\n  text-transform: none;\n  vertical-align: -0.125em;\n  text-rendering: optimizeLegibility;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n  line-height: 1;\n}\n\n.anticon svg {\n  display: inline-block;\n}\n\n.anticon::before {\n  display: none;\n}\n\n.anticon .anticon-icon {\n  display: block;\n}\n\n.anticon[tabindex] {\n  cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n  display: inline-block;\n  -webkit-animation: loadingCircle 1s infinite linear;\n  animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n  100% {\n    -webkit-transform: rotate(360deg);\n    transform: rotate(360deg);\n  }\n}\n\n@keyframes loadingCircle {\n  100% {\n    -webkit-transform: rotate(360deg);\n    transform: rotate(360deg);\n  }\n}\n";
var useInsertStyles = function useInsertStyles2(eleRef) {
  var _useContext = reactExports.useContext(IconContext$1), csp = _useContext.csp, prefixCls = _useContext.prefixCls, layer2 = _useContext.layer;
  var mergedStyleStr = iconStyles;
  if (prefixCls) {
    mergedStyleStr = mergedStyleStr.replace(/anticon/g, prefixCls);
  }
  if (layer2) {
    mergedStyleStr = "@layer ".concat(layer2, " {\n").concat(mergedStyleStr, "\n}");
  }
  reactExports.useEffect(function() {
    var ele = eleRef.current;
    var shadowRoot = getShadowRoot(ele);
    updateCSS(mergedStyleStr, "@ant-design-icons", {
      prepend: !layer2,
      csp,
      attachTo: shadowRoot
    });
  }, []);
};
var _excluded$w = ["icon", "className", "onClick", "style", "primaryColor", "secondaryColor"];
var twoToneColorPalette = {
  primaryColor: "#333",
  secondaryColor: "#E6E6E6",
  calculated: false
};
function setTwoToneColors(_ref) {
  var primaryColor = _ref.primaryColor, secondaryColor = _ref.secondaryColor;
  twoToneColorPalette.primaryColor = primaryColor;
  twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor);
  twoToneColorPalette.calculated = !!secondaryColor;
}
function getTwoToneColors() {
  return _objectSpread2({}, twoToneColorPalette);
}
var IconBase$1 = function IconBase(props) {
  var icon = props.icon, className = props.className, onClick = props.onClick, style2 = props.style, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, restProps = _objectWithoutProperties$3(props, _excluded$w);
  var svgRef = reactExports.useRef();
  var colors2 = twoToneColorPalette;
  if (primaryColor) {
    colors2 = {
      primaryColor,
      secondaryColor: secondaryColor || getSecondaryColor(primaryColor)
    };
  }
  useInsertStyles(svgRef);
  warning$1(isIconDefinition(icon), "icon should be icon definiton, but got ".concat(icon));
  if (!isIconDefinition(icon)) {
    return null;
  }
  var target = icon;
  if (target && typeof target.icon === "function") {
    target = _objectSpread2(_objectSpread2({}, target), {}, {
      icon: target.icon(colors2.primaryColor, colors2.secondaryColor)
    });
  }
  return generate(target.icon, "svg-".concat(target.name), _objectSpread2(_objectSpread2({
    className,
    onClick,
    style: style2,
    "data-icon": target.name,
    width: "1em",
    height: "1em",
    fill: "currentColor",
    "aria-hidden": "true"
  }, restProps), {}, {
    ref: svgRef
  }));
};
IconBase$1.displayName = "IconReact";
IconBase$1.getTwoToneColors = getTwoToneColors;
IconBase$1.setTwoToneColors = setTwoToneColors;
function setTwoToneColor(twoToneColor) {
  var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor), _normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2), primaryColor = _normalizeTwoToneColo2[0], secondaryColor = _normalizeTwoToneColo2[1];
  return IconBase$1.setTwoToneColors({
    primaryColor,
    secondaryColor
  });
}
function getTwoToneColor() {
  var colors2 = IconBase$1.getTwoToneColors();
  if (!colors2.calculated) {
    return colors2.primaryColor;
  }
  return [colors2.primaryColor, colors2.secondaryColor];
}
var _excluded$v = ["className", "icon", "spin", "rotate", "tabIndex", "onClick", "twoToneColor"];
setTwoToneColor(blue$1.primary);
var Icon$3 = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var className = props.className, icon = props.icon, spin2 = props.spin, rotate2 = props.rotate, tabIndex = props.tabIndex, onClick = props.onClick, twoToneColor = props.twoToneColor, restProps = _objectWithoutProperties$3(props, _excluded$v);
  var _React$useContext = reactExports.useContext(IconContext$1), _React$useContext$pre = _React$useContext.prefixCls, prefixCls = _React$useContext$pre === void 0 ? "anticon" : _React$useContext$pre, rootClassName = _React$useContext.rootClassName;
  var classString = classNames(rootClassName, prefixCls, _defineProperty$3(_defineProperty$3({}, "".concat(prefixCls, "-").concat(icon.name), !!icon.name), "".concat(prefixCls, "-spin"), !!spin2 || icon.name === "loading"), className);
  var iconTabIndex = tabIndex;
  if (iconTabIndex === void 0 && onClick) {
    iconTabIndex = -1;
  }
  var svgStyle = rotate2 ? {
    msTransform: "rotate(".concat(rotate2, "deg)"),
    transform: "rotate(".concat(rotate2, "deg)")
  } : void 0;
  var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor), _normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2), primaryColor = _normalizeTwoToneColo2[0], secondaryColor = _normalizeTwoToneColo2[1];
  return /* @__PURE__ */ reactExports.createElement("span", _extends$h({
    role: "img",
    "aria-label": icon.name
  }, restProps, {
    ref,
    tabIndex: iconTabIndex,
    onClick,
    className: classString
  }), /* @__PURE__ */ reactExports.createElement(IconBase$1, {
    icon,
    primaryColor,
    secondaryColor,
    style: svgStyle
  }));
});
Icon$3.displayName = "AntdIcon";
Icon$3.getTwoToneColor = getTwoToneColor;
Icon$3.setTwoToneColor = setTwoToneColor;
var CloseOutlined$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z" } }] }, "name": "close", "theme": "outlined" };
var CloseOutlined = function CloseOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: CloseOutlined$1
  }));
};
var RefIcon$1j = /* @__PURE__ */ reactExports.forwardRef(CloseOutlined);
var attributes = "accept acceptCharset accessKey action allowFullScreen allowTransparency\n    alt async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge\n    charSet checked classID className colSpan cols content contentEditable contextMenu\n    controls coords crossOrigin data dateTime default defer dir disabled download draggable\n    encType form formAction formEncType formMethod formNoValidate formTarget frameBorder\n    headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode integrity\n    is keyParams keyType kind label lang list loop low manifest marginHeight marginWidth max maxLength media\n    mediaGroup method min minLength multiple muted name noValidate nonce open\n    optimum pattern placeholder poster preload radioGroup readOnly rel required\n    reversed role rowSpan rows sandbox scope scoped scrolling seamless selected\n    shape size sizes span spellCheck src srcDoc srcLang srcSet start step style\n    summary tabIndex target title type useMap value width wmode wrap";
var eventsName = "onCopy onCut onPaste onCompositionEnd onCompositionStart onCompositionUpdate onKeyDown\n    onKeyPress onKeyUp onFocus onBlur onChange onInput onSubmit onClick onContextMenu onDoubleClick\n    onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown\n    onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel\n    onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough\n    onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata\n    onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError";
var propList = "".concat(attributes, " ").concat(eventsName).split(/[\s\n]+/);
var ariaPrefix = "aria-";
var dataPrefix = "data-";
function match(key, prefix) {
  return key.indexOf(prefix) === 0;
}
function pickAttrs(props) {
  var ariaOnly = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
  var mergedConfig;
  if (ariaOnly === false) {
    mergedConfig = {
      aria: true,
      data: true,
      attr: true
    };
  } else if (ariaOnly === true) {
    mergedConfig = {
      aria: true
    };
  } else {
    mergedConfig = _objectSpread2({}, ariaOnly);
  }
  var attrs = {};
  Object.keys(props).forEach(function(key) {
    if (
      // Aria
      mergedConfig.aria && (key === "role" || match(key, ariaPrefix)) || // Data
      mergedConfig.data && match(key, dataPrefix) || // Attr
      mergedConfig.attr && propList.includes(key)
    ) {
      attrs[key] = props[key];
    }
  });
  return attrs;
}
function isFragment(child) {
  return child && /* @__PURE__ */ React$5.isValidElement(child) && child.type === React$5.Fragment;
}
const replaceElement = (element2, replacement, props) => {
  if (!/* @__PURE__ */ React$5.isValidElement(element2)) {
    return replacement;
  }
  return /* @__PURE__ */ React$5.cloneElement(element2, typeof props === "function" ? props(element2.props || {}) : props);
};
function cloneElement(element2, props) {
  return replaceElement(element2, element2, props);
}
const useCSSVarCls = (prefixCls) => {
  const [, , , , cssVar] = useToken();
  return cssVar ? `${prefixCls}-css-var` : "";
};
var KeyCode = {
  // NUMLOCK on FF/Safari Mac
  /**
   * ENTER
   */
  ENTER: 13,
  /**
   * ESC
   */
  ESC: 27,
  /**
   * SPACE
   */
  SPACE: 32,
  // also NUM_SOUTH_EAST
  /**
   * END
   */
  END: 35,
  // also NUM_SOUTH_WEST
  /**
   * HOME
   */
  HOME: 36,
  // also NUM_NORTH_WEST
  /**
   * LEFT
   */
  LEFT: 37,
  // also NUM_WEST
  /**
   * UP
   */
  UP: 38,
  // also NUM_NORTH
  /**
   * RIGHT
   */
  RIGHT: 39,
  // also NUM_EAST
  /**
   * DOWN
   */
  DOWN: 40
};
var LoadingOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" } }] }, "name": "loading", "theme": "outlined" };
var LoadingOutlined = function LoadingOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: LoadingOutlined$1
  }));
};
var RefIcon$1i = /* @__PURE__ */ reactExports.forwardRef(LoadingOutlined);
const zIndexContext = /* @__PURE__ */ React$5.createContext(void 0);
const CONTAINER_OFFSET = 100;
const containerBaseZIndexOffset = {
  Modal: CONTAINER_OFFSET,
  Drawer: CONTAINER_OFFSET,
  Popover: CONTAINER_OFFSET,
  Popconfirm: CONTAINER_OFFSET,
  Tooltip: CONTAINER_OFFSET,
  Tour: CONTAINER_OFFSET,
  FloatButton: CONTAINER_OFFSET
};
const consumerBaseZIndexOffset = {
  SelectLike: 50,
  Dropdown: 50,
  DatePicker: 50,
  Menu: 50,
  ImagePreview: 1
};
function isContainerType(type4) {
  return type4 in containerBaseZIndexOffset;
}
const useZIndex = (componentType, customZIndex) => {
  const [, token2] = useToken();
  const parentZIndex = React$5.useContext(zIndexContext);
  const isContainer = isContainerType(componentType);
  let result;
  if (customZIndex !== void 0) {
    result = [customZIndex, customZIndex];
  } else {
    let zIndex = parentZIndex !== null && parentZIndex !== void 0 ? parentZIndex : 0;
    if (isContainer) {
      zIndex += // Use preset token zIndex by default but not stack when has parent container
      (parentZIndex ? 0 : token2.zIndexPopupBase) + // Container offset
      containerBaseZIndexOffset[componentType];
    } else {
      zIndex += consumerBaseZIndexOffset[componentType];
    }
    result = [parentZIndex === void 0 ? customZIndex : zIndex, zIndex];
  }
  return result;
};
function _OverloadYield(e2, d2) {
  this.v = e2, this.k = d2;
}
function _regeneratorDefine(e2, r2, n2, t2) {
  var i2 = Object.defineProperty;
  try {
    i2({}, "", {});
  } catch (e3) {
    i2 = 0;
  }
  _regeneratorDefine = function regeneratorDefine(e3, r3, n3, t3) {
    if (r3)
      i2 ? i2(e3, r3, {
        value: n3,
        enumerable: !t3,
        configurable: !t3,
        writable: !t3
      }) : e3[r3] = n3;
    else {
      var o2 = function o3(r4, n4) {
        _regeneratorDefine(e3, r4, function(e4) {
          return this._invoke(r4, n4, e4);
        });
      };
      o2("next", 0), o2("throw", 1), o2("return", 2);
    }
  }, _regeneratorDefine(e2, r2, n2, t2);
}
function _regenerator() {
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
  var e2, t2, r2 = "function" == typeof Symbol ? Symbol : {}, n2 = r2.iterator || "@@iterator", o2 = r2.toStringTag || "@@toStringTag";
  function i2(r3, n3, o3, i3) {
    var c3 = n3 && n3.prototype instanceof Generator ? n3 : Generator, u3 = Object.create(c3.prototype);
    return _regeneratorDefine(u3, "_invoke", function(r4, n4, o4) {
      var i4, c4, u4, f3 = 0, p2 = o4 || [], y2 = false, G2 = {
        p: 0,
        n: 0,
        v: e2,
        a: d2,
        f: d2.bind(e2, 4),
        d: function d3(t3, r5) {
          return i4 = t3, c4 = 0, u4 = e2, G2.n = r5, a2;
        }
      };
      function d2(r5, n5) {
        for (c4 = r5, u4 = n5, t2 = 0; !y2 && f3 && !o5 && t2 < p2.length; t2++) {
          var o5, i5 = p2[t2], d3 = G2.p, l2 = i5[2];
          r5 > 3 ? (o5 = l2 === n5) && (u4 = i5[(c4 = i5[4]) ? 5 : (c4 = 3, 3)], i5[4] = i5[5] = e2) : i5[0] <= d3 && ((o5 = r5 < 2 && d3 < i5[1]) ? (c4 = 0, G2.v = n5, G2.n = i5[1]) : d3 < l2 && (o5 = r5 < 3 || i5[0] > n5 || n5 > l2) && (i5[4] = r5, i5[5] = n5, G2.n = l2, c4 = 0));
        }
        if (o5 || r5 > 1)
          return a2;
        throw y2 = true, n5;
      }
      return function(o5, p3, l2) {
        if (f3 > 1)
          throw TypeError("Generator is already running");
        for (y2 && 1 === p3 && d2(p3, l2), c4 = p3, u4 = l2; (t2 = c4 < 2 ? e2 : u4) || !y2; ) {
          i4 || (c4 ? c4 < 3 ? (c4 > 1 && (G2.n = -1), d2(c4, u4)) : G2.n = u4 : G2.v = u4);
          try {
            if (f3 = 2, i4) {
              if (c4 || (o5 = "next"), t2 = i4[o5]) {
                if (!(t2 = t2.call(i4, u4)))
                  throw TypeError("iterator result is not an object");
                if (!t2.done)
                  return t2;
                u4 = t2.value, c4 < 2 && (c4 = 0);
              } else
                1 === c4 && (t2 = i4["return"]) && t2.call(i4), c4 < 2 && (u4 = TypeError("The iterator does not provide a '" + o5 + "' method"), c4 = 1);
              i4 = e2;
            } else if ((t2 = (y2 = G2.n < 0) ? u4 : r4.call(n4, G2)) !== a2)
              break;
          } catch (t3) {
            i4 = e2, c4 = 1, u4 = t3;
          } finally {
            f3 = 1;
          }
        }
        return {
          value: t2,
          done: y2
        };
      };
    }(r3, o3, i3), true), u3;
  }
  var a2 = {};
  function Generator() {
  }
  function GeneratorFunction() {
  }
  function GeneratorFunctionPrototype() {
  }
  t2 = Object.getPrototypeOf;
  var c2 = [][n2] ? t2(t2([][n2]())) : (_regeneratorDefine(t2 = {}, n2, function() {
    return this;
  }), t2), u2 = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c2);
  function f2(e3) {
    return Object.setPrototypeOf ? Object.setPrototypeOf(e3, GeneratorFunctionPrototype) : (e3.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e3, o2, "GeneratorFunction")), e3.prototype = Object.create(u2), e3;
  }
  return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u2, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o2, "GeneratorFunction"), _regeneratorDefine(u2), _regeneratorDefine(u2, o2, "Generator"), _regeneratorDefine(u2, n2, function() {
    return this;
  }), _regeneratorDefine(u2, "toString", function() {
    return "[object Generator]";
  }), (_regenerator = function _regenerator2() {
    return {
      w: i2,
      m: f2
    };
  })();
}
function AsyncIterator(t2, e2) {
  function n2(r3, o2, i2, f2) {
    try {
      var c2 = t2[r3](o2), u2 = c2.value;
      return u2 instanceof _OverloadYield ? e2.resolve(u2.v).then(function(t3) {
        n2("next", t3, i2, f2);
      }, function(t3) {
        n2("throw", t3, i2, f2);
      }) : e2.resolve(u2).then(function(t3) {
        c2.value = t3, i2(c2);
      }, function(t3) {
        return n2("throw", t3, i2, f2);
      });
    } catch (t3) {
      f2(t3);
    }
  }
  var r2;
  this.next || (_regeneratorDefine(AsyncIterator.prototype), _regeneratorDefine(AsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function() {
    return this;
  })), _regeneratorDefine(this, "_invoke", function(t3, o2, i2) {
    function f2() {
      return new e2(function(e3, r3) {
        n2(t3, i2, e3, r3);
      });
    }
    return r2 = r2 ? r2.then(f2, f2) : f2();
  }, true);
}
function _regeneratorAsyncGen(r2, e2, t2, o2, n2) {
  return new AsyncIterator(_regenerator().w(r2, e2, t2, o2), n2 || Promise);
}
function _regeneratorAsync(n2, e2, r2, t2, o2) {
  var a2 = _regeneratorAsyncGen(n2, e2, r2, t2, o2);
  return a2.next().then(function(n3) {
    return n3.done ? n3.value : a2.next();
  });
}
function _regeneratorKeys(e2) {
  var n2 = Object(e2), r2 = [];
  for (var t2 in n2)
    r2.unshift(t2);
  return function e3() {
    for (; r2.length; )
      if ((t2 = r2.pop()) in n2)
        return e3.value = t2, e3.done = false, e3;
    return e3.done = true, e3;
  };
}
function _regeneratorValues(e2) {
  if (null != e2) {
    var t2 = e2["function" == typeof Symbol && Symbol.iterator || "@@iterator"], r2 = 0;
    if (t2)
      return t2.call(e2);
    if ("function" == typeof e2.next)
      return e2;
    if (!isNaN(e2.length))
      return {
        next: function next2() {
          return e2 && r2 >= e2.length && (e2 = void 0), {
            value: e2 && e2[r2++],
            done: !e2
          };
        }
      };
  }
  throw new TypeError(_typeof$1(e2) + " is not iterable");
}
function _regeneratorRuntime() {
  var r2 = _regenerator(), e2 = r2.m(_regeneratorRuntime), t2 = (Object.getPrototypeOf ? Object.getPrototypeOf(e2) : e2.__proto__).constructor;
  function n2(r3) {
    var e3 = "function" == typeof r3 && r3.constructor;
    return !!e3 && (e3 === t2 || "GeneratorFunction" === (e3.displayName || e3.name));
  }
  var o2 = {
    "throw": 1,
    "return": 2,
    "break": 3,
    "continue": 3
  };
  function a2(r3) {
    var e3, t3;
    return function(n3) {
      e3 || (e3 = {
        stop: function stop() {
          return t3(n3.a, 2);
        },
        "catch": function _catch() {
          return n3.v;
        },
        abrupt: function abrupt(r4, e4) {
          return t3(n3.a, o2[r4], e4);
        },
        delegateYield: function delegateYield(r4, o3, a3) {
          return e3.resultName = o3, t3(n3.d, _regeneratorValues(r4), a3);
        },
        finish: function finish(r4) {
          return t3(n3.f, r4);
        }
      }, t3 = function t4(r4, _t, o3) {
        n3.p = e3.prev, n3.n = e3.next;
        try {
          return r4(_t, o3);
        } finally {
          e3.next = n3.n;
        }
      }), e3.resultName && (e3[e3.resultName] = n3.v, e3.resultName = void 0), e3.sent = n3.v, e3.next = n3.n;
      try {
        return r3.call(this, e3);
      } finally {
        n3.p = e3.prev, n3.n = e3.next;
      }
    };
  }
  return (_regeneratorRuntime = function _regeneratorRuntime2() {
    return {
      wrap: function wrap2(e3, t3, n3, o3) {
        return r2.w(a2(e3), t3, n3, o3 && o3.reverse());
      },
      isGeneratorFunction: n2,
      mark: r2.m,
      awrap: function awrap(r3, e3) {
        return new _OverloadYield(r3, e3);
      },
      AsyncIterator,
      async: function async(r3, e3, t3, o3, u2) {
        return (n2(e3) ? _regeneratorAsyncGen : _regeneratorAsync)(a2(r3), e3, t3, o3, u2);
      },
      keys: _regeneratorKeys,
      values: _regeneratorValues
    };
  })();
}
function asyncGeneratorStep(n2, t2, e2, r2, o2, a2, c2) {
  try {
    var i2 = n2[a2](c2), u2 = i2.value;
  } catch (n3) {
    return void e2(n3);
  }
  i2.done ? t2(u2) : Promise.resolve(u2).then(r2, o2);
}
function _asyncToGenerator(n2) {
  return function() {
    var t2 = this, e2 = arguments;
    return new Promise(function(r2, o2) {
      var a2 = n2.apply(t2, e2);
      function _next(n3) {
        asyncGeneratorStep(a2, r2, o2, _next, _throw, "next", n3);
      }
      function _throw(n3) {
        asyncGeneratorStep(a2, r2, o2, _next, _throw, "throw", n3);
      }
      _next(void 0);
    });
  };
}
const getCollapsedHeight = () => ({
  height: 0,
  opacity: 0
});
const getRealHeight = (node2) => {
  const {
    scrollHeight
  } = node2;
  return {
    height: scrollHeight,
    opacity: 1
  };
};
const getCurrentHeight = (node2) => ({
  height: node2 ? node2.offsetHeight : 0
});
const skipOpacityTransition = (_24, event) => (event === null || event === void 0 ? void 0 : event.deadline) === true || event.propertyName === "height";
const initCollapseMotion = (rootCls = defaultPrefixCls) => ({
  motionName: `${rootCls}-motion-collapse`,
  onAppearStart: getCollapsedHeight,
  onEnterStart: getCollapsedHeight,
  onAppearActive: getRealHeight,
  onEnterActive: getRealHeight,
  onLeaveStart: getCurrentHeight,
  onLeaveActive: getCollapsedHeight,
  onAppearEnd: skipOpacityTransition,
  onEnterEnd: skipOpacityTransition,
  onLeaveEnd: skipOpacityTransition,
  motionDeadline: 500
});
const getTransitionName = (rootPrefixCls, motion, transitionName) => {
  if (transitionName !== void 0) {
    return transitionName;
  }
  return `${rootPrefixCls}-${motion}`;
};
function omit$1(obj, fields) {
  var clone3 = Object.assign({}, obj);
  if (Array.isArray(fields)) {
    fields.forEach(function(key) {
      delete clone3[key];
    });
  }
  return clone3;
}
const isVisible = function(element2) {
  if (!element2) {
    return false;
  }
  if (element2 instanceof Element) {
    if (element2.offsetParent) {
      return true;
    }
    if (element2.getBBox) {
      var _getBBox = element2.getBBox(), width = _getBBox.width, height = _getBBox.height;
      if (width || height) {
        return true;
      }
    }
    if (element2.getBoundingClientRect) {
      var _element$getBoundingC = element2.getBoundingClientRect(), _width = _element$getBoundingC.width, _height = _element$getBoundingC.height;
      if (_width || _height) {
        return true;
      }
    }
  }
  return false;
};
(function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
});
const SpaceCompactItemContext = /* @__PURE__ */ reactExports.createContext(null);
const NoCompactStyle = (props) => {
  const {
    children
  } = props;
  return /* @__PURE__ */ reactExports.createElement(SpaceCompactItemContext.Provider, {
    value: null
  }, children);
};
const genCollapseMotion = (token2) => ({
  [token2.componentCls]: {
    // For common/openAnimation
    [`${token2.antCls}-motion-collapse-legacy`]: {
      overflow: "hidden",
      "&-active": {
        transition: `height ${token2.motionDurationMid} ${token2.motionEaseInOut},
        opacity ${token2.motionDurationMid} ${token2.motionEaseInOut} !important`
      }
    },
    [`${token2.antCls}-motion-collapse`]: {
      overflow: "hidden",
      transition: `height ${token2.motionDurationMid} ${token2.motionEaseInOut},
        opacity ${token2.motionDurationMid} ${token2.motionEaseInOut} !important`
    }
  }
});
const initMotionCommon = (duration2) => ({
  animationDuration: duration2,
  animationFillMode: "both"
});
const initMotionCommonLeave = (duration2) => ({
  animationDuration: duration2,
  animationFillMode: "both"
});
const initMotion = (motionCls, inKeyframes, outKeyframes, duration2, sameLevel = false) => {
  const sameLevelPrefix = sameLevel ? "&" : "";
  return {
    [`
      ${sameLevelPrefix}${motionCls}-enter,
      ${sameLevelPrefix}${motionCls}-appear
    `]: Object.assign(Object.assign({}, initMotionCommon(duration2)), {
      animationPlayState: "paused"
    }),
    [`${sameLevelPrefix}${motionCls}-leave`]: Object.assign(Object.assign({}, initMotionCommonLeave(duration2)), {
      animationPlayState: "paused"
    }),
    [`
      ${sameLevelPrefix}${motionCls}-enter${motionCls}-enter-active,
      ${sameLevelPrefix}${motionCls}-appear${motionCls}-appear-active
    `]: {
      animationName: inKeyframes,
      animationPlayState: "running"
    },
    [`${sameLevelPrefix}${motionCls}-leave${motionCls}-leave-active`]: {
      animationName: outKeyframes,
      animationPlayState: "running",
      pointerEvents: "none"
    }
  };
};
const slideUpIn = new Keyframe("antSlideUpIn", {
  "0%": {
    transform: "scaleY(0.8)",
    transformOrigin: "0% 0%",
    opacity: 0
  },
  "100%": {
    transform: "scaleY(1)",
    transformOrigin: "0% 0%",
    opacity: 1
  }
});
const slideUpOut = new Keyframe("antSlideUpOut", {
  "0%": {
    transform: "scaleY(1)",
    transformOrigin: "0% 0%",
    opacity: 1
  },
  "100%": {
    transform: "scaleY(0.8)",
    transformOrigin: "0% 0%",
    opacity: 0
  }
});
const slideDownIn = new Keyframe("antSlideDownIn", {
  "0%": {
    transform: "scaleY(0.8)",
    transformOrigin: "100% 100%",
    opacity: 0
  },
  "100%": {
    transform: "scaleY(1)",
    transformOrigin: "100% 100%",
    opacity: 1
  }
});
const slideDownOut = new Keyframe("antSlideDownOut", {
  "0%": {
    transform: "scaleY(1)",
    transformOrigin: "100% 100%",
    opacity: 1
  },
  "100%": {
    transform: "scaleY(0.8)",
    transformOrigin: "100% 100%",
    opacity: 0
  }
});
const slideLeftIn = new Keyframe("antSlideLeftIn", {
  "0%": {
    transform: "scaleX(0.8)",
    transformOrigin: "0% 0%",
    opacity: 0
  },
  "100%": {
    transform: "scaleX(1)",
    transformOrigin: "0% 0%",
    opacity: 1
  }
});
const slideLeftOut = new Keyframe("antSlideLeftOut", {
  "0%": {
    transform: "scaleX(1)",
    transformOrigin: "0% 0%",
    opacity: 1
  },
  "100%": {
    transform: "scaleX(0.8)",
    transformOrigin: "0% 0%",
    opacity: 0
  }
});
const slideRightIn = new Keyframe("antSlideRightIn", {
  "0%": {
    transform: "scaleX(0.8)",
    transformOrigin: "100% 0%",
    opacity: 0
  },
  "100%": {
    transform: "scaleX(1)",
    transformOrigin: "100% 0%",
    opacity: 1
  }
});
const slideRightOut = new Keyframe("antSlideRightOut", {
  "0%": {
    transform: "scaleX(1)",
    transformOrigin: "100% 0%",
    opacity: 1
  },
  "100%": {
    transform: "scaleX(0.8)",
    transformOrigin: "100% 0%",
    opacity: 0
  }
});
const slideMotion = {
  "slide-up": {
    inKeyframes: slideUpIn,
    outKeyframes: slideUpOut
  },
  "slide-down": {
    inKeyframes: slideDownIn,
    outKeyframes: slideDownOut
  },
  "slide-left": {
    inKeyframes: slideLeftIn,
    outKeyframes: slideLeftOut
  },
  "slide-right": {
    inKeyframes: slideRightIn,
    outKeyframes: slideRightOut
  }
};
const initSlideMotion = (token2, motionName) => {
  const {
    antCls
  } = token2;
  const motionCls = `${antCls}-${motionName}`;
  const {
    inKeyframes,
    outKeyframes
  } = slideMotion[motionName];
  return [initMotion(motionCls, inKeyframes, outKeyframes, token2.motionDurationMid), {
    [`
      ${motionCls}-enter,
      ${motionCls}-appear
    `]: {
      transform: "scale(0)",
      transformOrigin: "0% 0%",
      opacity: 0,
      animationTimingFunction: token2.motionEaseOutQuint,
      "&-prepare": {
        transform: "scale(1)"
      }
    },
    [`${motionCls}-leave`]: {
      animationTimingFunction: token2.motionEaseInQuint
    }
  }];
};
const zoomIn = new Keyframe("antZoomIn", {
  "0%": {
    transform: "scale(0.2)",
    opacity: 0
  },
  "100%": {
    transform: "scale(1)",
    opacity: 1
  }
});
const zoomOut = new Keyframe("antZoomOut", {
  "0%": {
    transform: "scale(1)"
  },
  "100%": {
    transform: "scale(0.2)",
    opacity: 0
  }
});
const zoomBigIn = new Keyframe("antZoomBigIn", {
  "0%": {
    transform: "scale(0.8)",
    opacity: 0
  },
  "100%": {
    transform: "scale(1)",
    opacity: 1
  }
});
const zoomBigOut = new Keyframe("antZoomBigOut", {
  "0%": {
    transform: "scale(1)"
  },
  "100%": {
    transform: "scale(0.8)",
    opacity: 0
  }
});
const zoomUpIn = new Keyframe("antZoomUpIn", {
  "0%": {
    transform: "scale(0.8)",
    transformOrigin: "50% 0%",
    opacity: 0
  },
  "100%": {
    transform: "scale(1)",
    transformOrigin: "50% 0%"
  }
});
const zoomUpOut = new Keyframe("antZoomUpOut", {
  "0%": {
    transform: "scale(1)",
    transformOrigin: "50% 0%"
  },
  "100%": {
    transform: "scale(0.8)",
    transformOrigin: "50% 0%",
    opacity: 0
  }
});
const zoomLeftIn = new Keyframe("antZoomLeftIn", {
  "0%": {
    transform: "scale(0.8)",
    transformOrigin: "0% 50%",
    opacity: 0
  },
  "100%": {
    transform: "scale(1)",
    transformOrigin: "0% 50%"
  }
});
const zoomLeftOut = new Keyframe("antZoomLeftOut", {
  "0%": {
    transform: "scale(1)",
    transformOrigin: "0% 50%"
  },
  "100%": {
    transform: "scale(0.8)",
    transformOrigin: "0% 50%",
    opacity: 0
  }
});
const zoomRightIn = new Keyframe("antZoomRightIn", {
  "0%": {
    transform: "scale(0.8)",
    transformOrigin: "100% 50%",
    opacity: 0
  },
  "100%": {
    transform: "scale(1)",
    transformOrigin: "100% 50%"
  }
});
const zoomRightOut = new Keyframe("antZoomRightOut", {
  "0%": {
    transform: "scale(1)",
    transformOrigin: "100% 50%"
  },
  "100%": {
    transform: "scale(0.8)",
    transformOrigin: "100% 50%",
    opacity: 0
  }
});
const zoomDownIn = new Keyframe("antZoomDownIn", {
  "0%": {
    transform: "scale(0.8)",
    transformOrigin: "50% 100%",
    opacity: 0
  },
  "100%": {
    transform: "scale(1)",
    transformOrigin: "50% 100%"
  }
});
const zoomDownOut = new Keyframe("antZoomDownOut", {
  "0%": {
    transform: "scale(1)",
    transformOrigin: "50% 100%"
  },
  "100%": {
    transform: "scale(0.8)",
    transformOrigin: "50% 100%",
    opacity: 0
  }
});
const zoomMotion = {
  zoom: {
    inKeyframes: zoomIn,
    outKeyframes: zoomOut
  },
  "zoom-big": {
    inKeyframes: zoomBigIn,
    outKeyframes: zoomBigOut
  },
  "zoom-big-fast": {
    inKeyframes: zoomBigIn,
    outKeyframes: zoomBigOut
  },
  "zoom-left": {
    inKeyframes: zoomLeftIn,
    outKeyframes: zoomLeftOut
  },
  "zoom-right": {
    inKeyframes: zoomRightIn,
    outKeyframes: zoomRightOut
  },
  "zoom-up": {
    inKeyframes: zoomUpIn,
    outKeyframes: zoomUpOut
  },
  "zoom-down": {
    inKeyframes: zoomDownIn,
    outKeyframes: zoomDownOut
  }
};
const initZoomMotion = (token2, motionName) => {
  const {
    antCls
  } = token2;
  const motionCls = `${antCls}-${motionName}`;
  const {
    inKeyframes,
    outKeyframes
  } = zoomMotion[motionName];
  return [initMotion(motionCls, inKeyframes, outKeyframes, motionName === "zoom-big-fast" ? token2.motionDurationFast : token2.motionDurationMid), {
    [`
        ${motionCls}-enter,
        ${motionCls}-appear
      `]: {
      transform: "scale(0)",
      opacity: 0,
      animationTimingFunction: token2.motionEaseOutCirc,
      "&-prepare": {
        transform: "none"
      }
    },
    [`${motionCls}-leave`]: {
      animationTimingFunction: token2.motionEaseInOutCirc
    }
  }];
};
var OrderContext = /* @__PURE__ */ reactExports.createContext(null);
var EMPTY_LIST$1 = [];
function useDom(render3, debug) {
  var _React$useState = reactExports.useState(function() {
    if (!canUseDom()) {
      return null;
    }
    var defaultEle = document.createElement("div");
    return defaultEle;
  }), _React$useState2 = _slicedToArray(_React$useState, 1), ele = _React$useState2[0];
  var appendedRef = reactExports.useRef(false);
  var queueCreate = reactExports.useContext(OrderContext);
  var _React$useState3 = reactExports.useState(EMPTY_LIST$1), _React$useState4 = _slicedToArray(_React$useState3, 2), queue = _React$useState4[0], setQueue = _React$useState4[1];
  var mergedQueueCreate = queueCreate || (appendedRef.current ? void 0 : function(appendFn) {
    setQueue(function(origin2) {
      var newQueue = [appendFn].concat(_toConsumableArray(origin2));
      return newQueue;
    });
  });
  function append3() {
    if (!ele.parentElement) {
      document.body.appendChild(ele);
    }
    appendedRef.current = true;
  }
  function cleanup2() {
    var _ele$parentElement;
    (_ele$parentElement = ele.parentElement) === null || _ele$parentElement === void 0 ? void 0 : _ele$parentElement.removeChild(ele);
    appendedRef.current = false;
  }
  useLayoutEffect(function() {
    if (render3) {
      if (queueCreate) {
        queueCreate(append3);
      } else {
        append3();
      }
    } else {
      cleanup2();
    }
    return cleanup2;
  }, [render3]);
  useLayoutEffect(function() {
    if (queue.length) {
      queue.forEach(function(appendFn) {
        return appendFn();
      });
      setQueue(EMPTY_LIST$1);
    }
  }, [queue]);
  return [ele, mergedQueueCreate];
}
function measureScrollbarSize(ele) {
  var randomId = "rc-scrollbar-measure-".concat(Math.random().toString(36).substring(7));
  var measureEle = document.createElement("div");
  measureEle.id = randomId;
  var measureStyle = measureEle.style;
  measureStyle.position = "absolute";
  measureStyle.left = "0";
  measureStyle.top = "0";
  measureStyle.width = "100px";
  measureStyle.height = "100px";
  measureStyle.overflow = "scroll";
  var fallbackWidth;
  var fallbackHeight;
  if (ele) {
    var targetStyle = getComputedStyle(ele);
    measureStyle.scrollbarColor = targetStyle.scrollbarColor;
    measureStyle.scrollbarWidth = targetStyle.scrollbarWidth;
    var webkitScrollbarStyle = getComputedStyle(ele, "::-webkit-scrollbar");
    var width = parseInt(webkitScrollbarStyle.width, 10);
    var height = parseInt(webkitScrollbarStyle.height, 10);
    try {
      var widthStyle = width ? "width: ".concat(webkitScrollbarStyle.width, ";") : "";
      var heightStyle = height ? "height: ".concat(webkitScrollbarStyle.height, ";") : "";
      updateCSS("\n#".concat(randomId, "::-webkit-scrollbar {\n").concat(widthStyle, "\n").concat(heightStyle, "\n}"), randomId);
    } catch (e2) {
      console.error(e2);
      fallbackWidth = width;
      fallbackHeight = height;
    }
  }
  document.body.appendChild(measureEle);
  var scrollWidth = ele && fallbackWidth && !isNaN(fallbackWidth) ? fallbackWidth : measureEle.offsetWidth - measureEle.clientWidth;
  var scrollHeight = ele && fallbackHeight && !isNaN(fallbackHeight) ? fallbackHeight : measureEle.offsetHeight - measureEle.clientHeight;
  document.body.removeChild(measureEle);
  removeCSS(randomId);
  return {
    width: scrollWidth,
    height: scrollHeight
  };
}
function getTargetScrollBarSize(target) {
  if (typeof document === "undefined" || !target || !(target instanceof Element)) {
    return {
      width: 0,
      height: 0
    };
  }
  return measureScrollbarSize(target);
}
function isBodyOverflowing() {
  return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) && window.innerWidth > document.body.offsetWidth;
}
var UNIQUE_ID = "rc-util-locker-".concat(Date.now());
var uuid$1 = 0;
function useScrollLocker(lock) {
  var mergedLock = !!lock;
  var _React$useState = reactExports.useState(function() {
    uuid$1 += 1;
    return "".concat(UNIQUE_ID, "_").concat(uuid$1);
  }), _React$useState2 = _slicedToArray(_React$useState, 1), id2 = _React$useState2[0];
  useLayoutEffect(function() {
    if (mergedLock) {
      var scrollbarSize2 = getTargetScrollBarSize(document.body).width;
      var isOverflow = isBodyOverflowing();
      updateCSS("\nhtml body {\n  overflow-y: hidden;\n  ".concat(isOverflow ? "width: calc(100% - ".concat(scrollbarSize2, "px);") : "", "\n}"), id2);
    } else {
      removeCSS(id2);
    }
    return function() {
      removeCSS(id2);
    };
  }, [mergedLock, id2]);
}
var inline = false;
function inlineMock(nextInline) {
  return inline;
}
var getPortalContainer = function getPortalContainer2(getContainer2) {
  if (getContainer2 === false) {
    return false;
  }
  if (!canUseDom() || !getContainer2) {
    return null;
  }
  if (typeof getContainer2 === "string") {
    return document.querySelector(getContainer2);
  }
  if (typeof getContainer2 === "function") {
    return getContainer2();
  }
  return getContainer2;
};
var Portal = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var open = props.open, autoLock = props.autoLock, getContainer2 = props.getContainer;
  props.debug;
  var _props$autoDestroy = props.autoDestroy, autoDestroy = _props$autoDestroy === void 0 ? true : _props$autoDestroy, children = props.children;
  var _React$useState = reactExports.useState(open), _React$useState2 = _slicedToArray(_React$useState, 2), shouldRender = _React$useState2[0], setShouldRender = _React$useState2[1];
  var mergedRender = shouldRender || open;
  reactExports.useEffect(function() {
    if (autoDestroy || open) {
      setShouldRender(open);
    }
  }, [open, autoDestroy]);
  var _React$useState3 = reactExports.useState(function() {
    return getPortalContainer(getContainer2);
  }), _React$useState4 = _slicedToArray(_React$useState3, 2), innerContainer = _React$useState4[0], setInnerContainer = _React$useState4[1];
  reactExports.useEffect(function() {
    var customizeContainer = getPortalContainer(getContainer2);
    setInnerContainer(customizeContainer !== null && customizeContainer !== void 0 ? customizeContainer : null);
  });
  var _useDom = useDom(mergedRender && !innerContainer), _useDom2 = _slicedToArray(_useDom, 2), defaultContainer = _useDom2[0], queueCreate = _useDom2[1];
  var mergedContainer = innerContainer !== null && innerContainer !== void 0 ? innerContainer : defaultContainer;
  useScrollLocker(autoLock && open && canUseDom() && (mergedContainer === defaultContainer || mergedContainer === document.body));
  var childRef = null;
  if (children && supportRef(children) && ref) {
    var _ref = children;
    childRef = _ref.ref;
  }
  var mergedRef = useComposeRef(childRef, ref);
  if (!mergedRender || !canUseDom() || innerContainer === void 0) {
    return null;
  }
  var renderInline = mergedContainer === false || inlineMock();
  var reffedChildren = children;
  if (ref) {
    reffedChildren = /* @__PURE__ */ reactExports.cloneElement(children, {
      ref: mergedRef
    });
  }
  return /* @__PURE__ */ reactExports.createElement(OrderContext.Provider, {
    value: queueCreate
  }, renderInline ? reffedChildren : /* @__PURE__ */ reactDomExports.createPortal(reffedChildren, mergedContainer));
});
function getUseId() {
  var fullClone2 = _objectSpread2({}, React$6);
  return fullClone2.useId;
}
var uuid = 0;
var useOriginId = getUseId();
const useId = useOriginId ? (
  // Use React `useId`
  function useId2(id2) {
    var reactId = useOriginId();
    if (id2) {
      return id2;
    }
    return reactId;
  }
) : (
  // Use compatible of `useId`
  function useCompatId(id2) {
    var _React$useState = reactExports.useState("ssr-id"), _React$useState2 = _slicedToArray(_React$useState, 2), innerId = _React$useState2[0], setInnerId = _React$useState2[1];
    reactExports.useEffect(function() {
      var nextId = uuid;
      uuid += 1;
      setInnerId("rc_unique_".concat(nextId));
    }, []);
    if (id2) {
      return id2;
    }
    return innerId;
  }
);
var HOOK_MARK = "RC_FORM_INTERNAL_HOOKS";
var warningFunc = function warningFunc2() {
  warningOnce(false, "Can not find FormContext. Please make sure you wrap Field under Form.");
};
var Context$1 = /* @__PURE__ */ reactExports.createContext({
  getFieldValue: warningFunc,
  getFieldsValue: warningFunc,
  getFieldError: warningFunc,
  getFieldWarning: warningFunc,
  getFieldsError: warningFunc,
  isFieldsTouched: warningFunc,
  isFieldTouched: warningFunc,
  isFieldValidating: warningFunc,
  isFieldsValidating: warningFunc,
  resetFields: warningFunc,
  setFields: warningFunc,
  setFieldValue: warningFunc,
  setFieldsValue: warningFunc,
  validateFields: warningFunc,
  submit: warningFunc,
  getInternalHooks: function getInternalHooks() {
    warningFunc();
    return {
      dispatch: warningFunc,
      initEntityValue: warningFunc,
      registerField: warningFunc,
      useSubscribe: warningFunc,
      setInitialValues: warningFunc,
      destroyForm: warningFunc,
      setCallbacks: warningFunc,
      registerWatch: warningFunc,
      getFields: warningFunc,
      setValidateMessages: warningFunc,
      setPreserve: warningFunc,
      getInitialValue: warningFunc
    };
  }
});
var ListContext = /* @__PURE__ */ reactExports.createContext(null);
function toArray$3(value2) {
  if (value2 === void 0 || value2 === null) {
    return [];
  }
  return Array.isArray(value2) ? value2 : [value2];
}
function isFormInstance(form2) {
  return form2 && !!form2._init;
}
function newMessages() {
  return {
    default: "Validation error on field %s",
    required: "%s is required",
    enum: "%s must be one of %s",
    whitespace: "%s cannot be empty",
    date: {
      format: "%s date %s is invalid for format %s",
      parse: "%s date could not be parsed, %s is invalid ",
      invalid: "%s date %s is invalid"
    },
    types: {
      string: "%s is not a %s",
      method: "%s is not a %s (function)",
      array: "%s is not an %s",
      object: "%s is not an %s",
      number: "%s is not a %s",
      date: "%s is not a %s",
      boolean: "%s is not a %s",
      integer: "%s is not an %s",
      float: "%s is not a %s",
      regexp: "%s is not a valid %s",
      email: "%s is not a valid %s",
      url: "%s is not a valid %s",
      hex: "%s is not a valid %s"
    },
    string: {
      len: "%s must be exactly %s characters",
      min: "%s must be at least %s characters",
      max: "%s cannot be longer than %s characters",
      range: "%s must be between %s and %s characters"
    },
    number: {
      len: "%s must equal %s",
      min: "%s cannot be less than %s",
      max: "%s cannot be greater than %s",
      range: "%s must be between %s and %s"
    },
    array: {
      len: "%s must be exactly %s in length",
      min: "%s cannot be less than %s in length",
      max: "%s cannot be greater than %s in length",
      range: "%s must be between %s and %s in length"
    },
    pattern: {
      mismatch: "%s value %s does not match pattern %s"
    },
    clone: function clone3() {
      var cloned = JSON.parse(JSON.stringify(this));
      cloned.clone = this.clone;
      return cloned;
    }
  };
}
var messages = newMessages();
function _isNativeFunction(t2) {
  try {
    return -1 !== Function.toString.call(t2).indexOf("[native code]");
  } catch (n2) {
    return "function" == typeof t2;
  }
}
function _construct(t2, e2, r2) {
  if (_isNativeReflectConstruct$g())
    return Reflect.construct.apply(null, arguments);
  var o2 = [null];
  o2.push.apply(o2, e2);
  var p2 = new (t2.bind.apply(t2, o2))();
  return r2 && _setPrototypeOf(p2, r2.prototype), p2;
}
function _wrapNativeSuper(t2) {
  var r2 = "function" == typeof Map ? /* @__PURE__ */ new Map() : void 0;
  return _wrapNativeSuper = function _wrapNativeSuper2(t3) {
    if (null === t3 || !_isNativeFunction(t3))
      return t3;
    if ("function" != typeof t3)
      throw new TypeError("Super expression must either be null or a function");
    if (void 0 !== r2) {
      if (r2.has(t3))
        return r2.get(t3);
      r2.set(t3, Wrapper2);
    }
    function Wrapper2() {
      return _construct(t3, arguments, _getPrototypeOf(this).constructor);
    }
    return Wrapper2.prototype = Object.create(t3.prototype, {
      constructor: {
        value: Wrapper2,
        enumerable: false,
        writable: true,
        configurable: true
      }
    }), _setPrototypeOf(Wrapper2, t3);
  }, _wrapNativeSuper(t2);
}
var formatRegExp = /%[sdj%]/g;
var warning = function warning2() {
};
function convertFieldsError(errors) {
  if (!errors || !errors.length)
    return null;
  var fields = {};
  errors.forEach(function(error2) {
    var field = error2.field;
    fields[field] = fields[field] || [];
    fields[field].push(error2);
  });
  return fields;
}
function format$1(template2) {
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    args[_key - 1] = arguments[_key];
  }
  var i2 = 0;
  var len = args.length;
  if (typeof template2 === "function") {
    return template2.apply(null, args);
  }
  if (typeof template2 === "string") {
    var str = template2.replace(formatRegExp, function(x2) {
      if (x2 === "%%") {
        return "%";
      }
      if (i2 >= len) {
        return x2;
      }
      switch (x2) {
        case "%s":
          return String(args[i2++]);
        case "%d":
          return Number(args[i2++]);
        case "%j":
          try {
            return JSON.stringify(args[i2++]);
          } catch (_24) {
            return "[Circular]";
          }
          break;
        default:
          return x2;
      }
    });
    return str;
  }
  return template2;
}
function isNativeStringType(type4) {
  return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
}
function isEmptyValue(value2, type4) {
  if (value2 === void 0 || value2 === null) {
    return true;
  }
  if (type4 === "array" && Array.isArray(value2) && !value2.length) {
    return true;
  }
  if (isNativeStringType(type4) && typeof value2 === "string" && !value2) {
    return true;
  }
  return false;
}
function asyncParallelArray(arr, func, callback2) {
  var results = [];
  var total = 0;
  var arrLength = arr.length;
  function count(errors) {
    results.push.apply(results, _toConsumableArray(errors || []));
    total++;
    if (total === arrLength) {
      callback2(results);
    }
  }
  arr.forEach(function(a2) {
    func(a2, count);
  });
}
function asyncSerialArray(arr, func, callback2) {
  var index2 = 0;
  var arrLength = arr.length;
  function next2(errors) {
    if (errors && errors.length) {
      callback2(errors);
      return;
    }
    var original2 = index2;
    index2 = index2 + 1;
    if (original2 < arrLength) {
      func(arr[original2], next2);
    } else {
      callback2([]);
    }
  }
  next2([]);
}
function flattenObjArr(objArr) {
  var ret = [];
  Object.keys(objArr).forEach(function(k2) {
    ret.push.apply(ret, _toConsumableArray(objArr[k2] || []));
  });
  return ret;
}
var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  _inherits$a(AsyncValidationError2, _Error);
  var _super = _createSuper$4(AsyncValidationError2);
  function AsyncValidationError2(errors, fields) {
    var _this;
    _classCallCheck$a(this, AsyncValidationError2);
    _this = _super.call(this, "Async Validation Error");
    _defineProperty$3(_assertThisInitialized(_this), "errors", void 0);
    _defineProperty$3(_assertThisInitialized(_this), "fields", void 0);
    _this.errors = errors;
    _this.fields = fields;
    return _this;
  }
  return _createClass$8(AsyncValidationError2);
}(/* @__PURE__ */ _wrapNativeSuper(Error));
function asyncMap(objArr, option, func, callback2, source2) {
  if (option.first) {
    var _pending = new Promise(function(resolve2, reject) {
      var next2 = function next22(errors) {
        callback2(errors);
        return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve2(source2);
      };
      var flattenArr = flattenObjArr(objArr);
      asyncSerialArray(flattenArr, func, next2);
    });
    _pending.catch(function(e2) {
      return e2;
    });
    return _pending;
  }
  var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  var objArrKeys = Object.keys(objArr);
  var objArrLength = objArrKeys.length;
  var total = 0;
  var results = [];
  var pending = new Promise(function(resolve2, reject) {
    var next2 = function next22(errors) {
      results.push.apply(results, errors);
      total++;
      if (total === objArrLength) {
        callback2(results);
        return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve2(source2);
      }
    };
    if (!objArrKeys.length) {
      callback2(results);
      resolve2(source2);
    }
    objArrKeys.forEach(function(key) {
      var arr = objArr[key];
      if (firstFields.indexOf(key) !== -1) {
        asyncSerialArray(arr, func, next2);
      } else {
        asyncParallelArray(arr, func, next2);
      }
    });
  });
  pending.catch(function(e2) {
    return e2;
  });
  return pending;
}
function isErrorObj(obj) {
  return !!(obj && obj.message !== void 0);
}
function getValue$4(value2, path) {
  var v2 = value2;
  for (var i2 = 0; i2 < path.length; i2++) {
    if (v2 == void 0) {
      return v2;
    }
    v2 = v2[path[i2]];
  }
  return v2;
}
function complementError(rule, source2) {
  return function(oe2) {
    var fieldValue;
    if (rule.fullFields) {
      fieldValue = getValue$4(source2, rule.fullFields);
    } else {
      fieldValue = source2[oe2.field || rule.fullField];
    }
    if (isErrorObj(oe2)) {
      oe2.field = oe2.field || rule.fullField;
      oe2.fieldValue = fieldValue;
      return oe2;
    }
    return {
      message: typeof oe2 === "function" ? oe2() : oe2,
      fieldValue,
      field: oe2.field || rule.fullField
    };
  };
}
function deepMerge(target, source2) {
  if (source2) {
    for (var s2 in source2) {
      if (source2.hasOwnProperty(s2)) {
        var value2 = source2[s2];
        if (_typeof$1(value2) === "object" && _typeof$1(target[s2]) === "object") {
          target[s2] = _objectSpread2(_objectSpread2({}, target[s2]), value2);
        } else {
          target[s2] = value2;
        }
      }
    }
  }
  return target;
}
var ENUM$1 = "enum";
var enumerable$1 = function enumerable(rule, value2, source2, errors, options) {
  rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  if (rule[ENUM$1].indexOf(value2) === -1) {
    errors.push(format$1(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  }
};
var pattern$2 = function pattern(rule, value2, source2, errors, options) {
  if (rule.pattern) {
    if (rule.pattern instanceof RegExp) {
      rule.pattern.lastIndex = 0;
      if (!rule.pattern.test(value2)) {
        errors.push(format$1(options.messages.pattern.mismatch, rule.fullField, value2, rule.pattern));
      }
    } else if (typeof rule.pattern === "string") {
      var _pattern = new RegExp(rule.pattern);
      if (!_pattern.test(value2)) {
        errors.push(format$1(options.messages.pattern.mismatch, rule.fullField, value2, rule.pattern));
      }
    }
  }
};
var range = function range2(rule, value2, source2, errors, options) {
  var len = typeof rule.len === "number";
  var min2 = typeof rule.min === "number";
  var max2 = typeof rule.max === "number";
  var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  var val = value2;
  var key = null;
  var num = typeof value2 === "number";
  var str = typeof value2 === "string";
  var arr = Array.isArray(value2);
  if (num) {
    key = "number";
  } else if (str) {
    key = "string";
  } else if (arr) {
    key = "array";
  }
  if (!key) {
    return false;
  }
  if (arr) {
    val = value2.length;
  }
  if (str) {
    val = value2.replace(spRegexp, "_").length;
  }
  if (len) {
    if (val !== rule.len) {
      errors.push(format$1(options.messages[key].len, rule.fullField, rule.len));
    }
  } else if (min2 && !max2 && val < rule.min) {
    errors.push(format$1(options.messages[key].min, rule.fullField, rule.min));
  } else if (max2 && !min2 && val > rule.max) {
    errors.push(format$1(options.messages[key].max, rule.fullField, rule.max));
  } else if (min2 && max2 && (val < rule.min || val > rule.max)) {
    errors.push(format$1(options.messages[key].range, rule.fullField, rule.min, rule.max));
  }
};
var required$1 = function required(rule, value2, source2, errors, options, type4) {
  if (rule.required && (!source2.hasOwnProperty(rule.field) || isEmptyValue(value2, type4 || rule.type))) {
    errors.push(format$1(options.messages.required, rule.fullField));
  }
};
var urlReg;
const getUrlRegex = function() {
  if (urlReg) {
    return urlReg;
  }
  var word = "[a-fA-F\\d:]";
  var b2 = function b3(options) {
    return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=".concat(word, ")|(?<=").concat(word, ")(?=\\s|$))") : "";
  };
  var v42 = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}";
  var v6seg = "[a-fA-F\\d]{1,4}";
  var v6List = [
    "(?:".concat(v6seg, ":){7}(?:").concat(v6seg, "|:)"),
    // 1:2:3:4:5:6:7::  1:2:3:4:5:6:7:8
    "(?:".concat(v6seg, ":){6}(?:").concat(v42, "|:").concat(v6seg, "|:)"),
    // 1:2:3:4:5:6::    1:2:3:4:5:6::8   1:2:3:4:5:6::8  1:2:3:4:5:6::
    "(?:".concat(v6seg, ":){5}(?::").concat(v42, "|(?::").concat(v6seg, "){1,2}|:)"),
    // 1:2:3:4:5::      1:2:3:4:5::7:8   1:2:3:4:5::8    1:2:3:4:5::
    "(?:".concat(v6seg, ":){4}(?:(?::").concat(v6seg, "){0,1}:").concat(v42, "|(?::").concat(v6seg, "){1,3}|:)"),
    // 1:2:3:4::        1:2:3:4::6:7:8   1:2:3:4::8      1:2:3:4::
    "(?:".concat(v6seg, ":){3}(?:(?::").concat(v6seg, "){0,2}:").concat(v42, "|(?::").concat(v6seg, "){1,4}|:)"),
    // 1:2:3::          1:2:3::5:6:7:8   1:2:3::8        1:2:3::
    "(?:".concat(v6seg, ":){2}(?:(?::").concat(v6seg, "){0,3}:").concat(v42, "|(?::").concat(v6seg, "){1,5}|:)"),
    // 1:2::            1:2::4:5:6:7:8   1:2::8          1:2::
    "(?:".concat(v6seg, ":){1}(?:(?::").concat(v6seg, "){0,4}:").concat(v42, "|(?::").concat(v6seg, "){1,6}|:)"),
    // 1::              1::3:4:5:6:7:8   1::8            1::
    "(?::(?:(?::".concat(v6seg, "){0,5}:").concat(v42, "|(?::").concat(v6seg, "){1,7}|:))")
    // ::2:3:4:5:6:7:8  ::2:3:4:5:6:7:8  ::8             ::
  ];
  var v6Eth0 = "(?:%[0-9a-zA-Z]{1,})?";
  var v6 = "(?:".concat(v6List.join("|"), ")").concat(v6Eth0);
  var v46Exact = new RegExp("(?:^".concat(v42, "$)|(?:^").concat(v6, "$)"));
  var v4exact = new RegExp("^".concat(v42, "$"));
  var v6exact = new RegExp("^".concat(v6, "$"));
  var ip = function ip2(options) {
    return options && options.exact ? v46Exact : new RegExp("(?:".concat(b2(options)).concat(v42).concat(b2(options), ")|(?:").concat(b2(options)).concat(v6).concat(b2(options), ")"), "g");
  };
  ip.v4 = function(options) {
    return options && options.exact ? v4exact : new RegExp("".concat(b2(options)).concat(v42).concat(b2(options)), "g");
  };
  ip.v6 = function(options) {
    return options && options.exact ? v6exact : new RegExp("".concat(b2(options)).concat(v6).concat(b2(options)), "g");
  };
  var protocol = "(?:(?:[a-z]+:)?//)";
  var auth = "(?:\\S+(?::\\S*)?@)?";
  var ipv4 = ip.v4().source;
  var ipv6 = ip.v6().source;
  var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
  var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
  var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
  var port = "(?::\\d{2,5})?";
  var path = '(?:[/?#][^\\s"]*)?';
  var regex2 = "(?:".concat(protocol, "|www\\.)").concat(auth, "(?:localhost|").concat(ipv4, "|").concat(ipv6, "|").concat(host).concat(domain).concat(tld, ")").concat(port).concat(path);
  urlReg = new RegExp("(?:^".concat(regex2, "$)"), "i");
  return urlReg;
};
var pattern$1 = {
  // http://emailregex.com/
  email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
  // url: new RegExp(
  //   '^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$',
  //   'i',
  // ),
  hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
};
var types$1 = {
  integer: function integer(value2) {
    return types$1.number(value2) && parseInt(value2, 10) === value2;
  },
  float: function float(value2) {
    return types$1.number(value2) && !types$1.integer(value2);
  },
  array: function array(value2) {
    return Array.isArray(value2);
  },
  regexp: function regexp(value2) {
    if (value2 instanceof RegExp) {
      return true;
    }
    try {
      return !!new RegExp(value2);
    } catch (e2) {
      return false;
    }
  },
  date: function date(value2) {
    return typeof value2.getTime === "function" && typeof value2.getMonth === "function" && typeof value2.getYear === "function" && !isNaN(value2.getTime());
  },
  number: function number(value2) {
    if (isNaN(value2)) {
      return false;
    }
    return typeof value2 === "number";
  },
  object: function object(value2) {
    return _typeof$1(value2) === "object" && !types$1.array(value2);
  },
  method: function method(value2) {
    return typeof value2 === "function";
  },
  email: function email(value2) {
    return typeof value2 === "string" && value2.length <= 320 && !!value2.match(pattern$1.email);
  },
  url: function url(value2) {
    return typeof value2 === "string" && value2.length <= 2048 && !!value2.match(getUrlRegex());
  },
  hex: function hex(value2) {
    return typeof value2 === "string" && !!value2.match(pattern$1.hex);
  }
};
var type$2 = function type(rule, value2, source2, errors, options) {
  if (rule.required && value2 === void 0) {
    required$1(rule, value2, source2, errors, options);
    return;
  }
  var custom2 = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
  var ruleType = rule.type;
  if (custom2.indexOf(ruleType) > -1) {
    if (!types$1[ruleType](value2)) {
      errors.push(format$1(options.messages.types[ruleType], rule.fullField, rule.type));
    }
  } else if (ruleType && _typeof$1(value2) !== rule.type) {
    errors.push(format$1(options.messages.types[ruleType], rule.fullField, rule.type));
  }
};
var whitespace$1 = function whitespace(rule, value2, source2, errors, options) {
  if (/^\s+$/.test(value2) || value2 === "") {
    errors.push(format$1(options.messages.whitespace, rule.fullField));
  }
};
const rules = {
  required: required$1,
  whitespace: whitespace$1,
  type: type$2,
  range,
  enum: enumerable$1,
  pattern: pattern$2
};
var any = function any2(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
  }
  callback2(errors);
};
var array2 = function array3(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if ((value2 === void 0 || value2 === null) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options, "array");
    if (value2 !== void 0 && value2 !== null) {
      rules.type(rule, value2, source2, errors, options);
      rules.range(rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
var boolean$1 = function boolean(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
    if (value2 !== void 0) {
      rules.type(rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
var date2 = function date3(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2, "date") && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
    if (!isEmptyValue(value2, "date")) {
      var dateObject;
      if (value2 instanceof Date) {
        dateObject = value2;
      } else {
        dateObject = new Date(value2);
      }
      rules.type(rule, dateObject, source2, errors, options);
      if (dateObject) {
        rules.range(rule, dateObject.getTime(), source2, errors, options);
      }
    }
  }
  callback2(errors);
};
var ENUM = "enum";
var enumerable2 = function enumerable3(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
    if (value2 !== void 0) {
      rules[ENUM](rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
var floatFn = function floatFn2(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
    if (value2 !== void 0) {
      rules.type(rule, value2, source2, errors, options);
      rules.range(rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
var integer2 = function integer3(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
    if (value2 !== void 0) {
      rules.type(rule, value2, source2, errors, options);
      rules.range(rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
var method2 = function method3(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
    if (value2 !== void 0) {
      rules.type(rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
var number$1 = function number2(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (value2 === "") {
      value2 = void 0;
    }
    if (isEmptyValue(value2) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
    if (value2 !== void 0) {
      rules.type(rule, value2, source2, errors, options);
      rules.range(rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
var object2 = function object3(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
    if (value2 !== void 0) {
      rules.type(rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
var pattern2 = function pattern3(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2, "string") && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
    if (!isEmptyValue(value2, "string")) {
      rules.pattern(rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
var regexp2 = function regexp3(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
    if (!isEmptyValue(value2)) {
      rules.type(rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
var required2 = function required3(rule, value2, callback2, source2, options) {
  var errors = [];
  var type4 = Array.isArray(value2) ? "array" : _typeof$1(value2);
  rules.required(rule, value2, source2, errors, options, type4);
  callback2(errors);
};
var string$2 = function string(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2, "string") && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options, "string");
    if (!isEmptyValue(value2, "string")) {
      rules.type(rule, value2, source2, errors, options);
      rules.range(rule, value2, source2, errors, options);
      rules.pattern(rule, value2, source2, errors, options);
      if (rule.whitespace === true) {
        rules.whitespace(rule, value2, source2, errors, options);
      }
    }
  }
  callback2(errors);
};
var type$1 = function type2(rule, value2, callback2, source2, options) {
  var ruleType = rule.type;
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2, ruleType) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options, ruleType);
    if (!isEmptyValue(value2, ruleType)) {
      rules.type(rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
const validators$2 = {
  string: string$2,
  method: method2,
  number: number$1,
  boolean: boolean$1,
  regexp: regexp2,
  integer: integer2,
  float: floatFn,
  array: array2,
  object: object2,
  enum: enumerable2,
  pattern: pattern2,
  date: date2,
  url: type$1,
  hex: type$1,
  email: type$1,
  required: required2,
  any
};
var Schema$1 = /* @__PURE__ */ function() {
  function Schema2(descriptor) {
    _classCallCheck$a(this, Schema2);
    _defineProperty$3(this, "rules", null);
    _defineProperty$3(this, "_messages", messages);
    this.define(descriptor);
  }
  _createClass$8(Schema2, [{
    key: "define",
    value: function define(rules2) {
      var _this = this;
      if (!rules2) {
        throw new Error("Cannot configure a schema with no rules");
      }
      if (_typeof$1(rules2) !== "object" || Array.isArray(rules2)) {
        throw new Error("Rules must be an object");
      }
      this.rules = {};
      Object.keys(rules2).forEach(function(name2) {
        var item = rules2[name2];
        _this.rules[name2] = Array.isArray(item) ? item : [item];
      });
    }
  }, {
    key: "messages",
    value: function messages2(_messages) {
      if (_messages) {
        this._messages = deepMerge(newMessages(), _messages);
      }
      return this._messages;
    }
  }, {
    key: "validate",
    value: function validate2(source_) {
      var _this2 = this;
      var o2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
      var oc2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : function() {
      };
      var source2 = source_;
      var options = o2;
      var callback2 = oc2;
      if (typeof options === "function") {
        callback2 = options;
        options = {};
      }
      if (!this.rules || Object.keys(this.rules).length === 0) {
        if (callback2) {
          callback2(null, source2);
        }
        return Promise.resolve(source2);
      }
      function complete(results) {
        var errors = [];
        var fields = {};
        function add2(e2) {
          if (Array.isArray(e2)) {
            var _errors;
            errors = (_errors = errors).concat.apply(_errors, _toConsumableArray(e2));
          } else {
            errors.push(e2);
          }
        }
        for (var i2 = 0; i2 < results.length; i2++) {
          add2(results[i2]);
        }
        if (!errors.length) {
          callback2(null, source2);
        } else {
          fields = convertFieldsError(errors);
          callback2(errors, fields);
        }
      }
      if (options.messages) {
        var messages$1 = this.messages();
        if (messages$1 === messages) {
          messages$1 = newMessages();
        }
        deepMerge(messages$1, options.messages);
        options.messages = messages$1;
      } else {
        options.messages = this.messages();
      }
      var series = {};
      var keys2 = options.keys || Object.keys(this.rules);
      keys2.forEach(function(z2) {
        var arr = _this2.rules[z2];
        var value2 = source2[z2];
        arr.forEach(function(r2) {
          var rule = r2;
          if (typeof rule.transform === "function") {
            if (source2 === source_) {
              source2 = _objectSpread2({}, source2);
            }
            value2 = source2[z2] = rule.transform(value2);
            if (value2 !== void 0 && value2 !== null) {
              rule.type = rule.type || (Array.isArray(value2) ? "array" : _typeof$1(value2));
            }
          }
          if (typeof rule === "function") {
            rule = {
              validator: rule
            };
          } else {
            rule = _objectSpread2({}, rule);
          }
          rule.validator = _this2.getValidationMethod(rule);
          if (!rule.validator) {
            return;
          }
          rule.field = z2;
          rule.fullField = rule.fullField || z2;
          rule.type = _this2.getType(rule);
          series[z2] = series[z2] || [];
          series[z2].push({
            rule,
            value: value2,
            source: source2,
            field: z2
          });
        });
      });
      var errorFields = {};
      return asyncMap(series, options, function(data, doIt) {
        var rule = data.rule;
        var deep = (rule.type === "object" || rule.type === "array") && (_typeof$1(rule.fields) === "object" || _typeof$1(rule.defaultField) === "object");
        deep = deep && (rule.required || !rule.required && data.value);
        rule.field = data.field;
        function addFullField(key, schema) {
          return _objectSpread2(_objectSpread2({}, schema), {}, {
            fullField: "".concat(rule.fullField, ".").concat(key),
            fullFields: rule.fullFields ? [].concat(_toConsumableArray(rule.fullFields), [key]) : [key]
          });
        }
        function cb2() {
          var e2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
          var errorList = Array.isArray(e2) ? e2 : [e2];
          if (!options.suppressWarning && errorList.length) {
            Schema2.warning("async-validator:", errorList);
          }
          if (errorList.length && rule.message !== void 0) {
            errorList = [].concat(rule.message);
          }
          var filledErrors = errorList.map(complementError(rule, source2));
          if (options.first && filledErrors.length) {
            errorFields[rule.field] = 1;
            return doIt(filledErrors);
          }
          if (!deep) {
            doIt(filledErrors);
          } else {
            if (rule.required && !data.value) {
              if (rule.message !== void 0) {
                filledErrors = [].concat(rule.message).map(complementError(rule, source2));
              } else if (options.error) {
                filledErrors = [options.error(rule, format$1(options.messages.required, rule.field))];
              }
              return doIt(filledErrors);
            }
            var fieldsSchema = {};
            if (rule.defaultField) {
              Object.keys(data.value).map(function(key) {
                fieldsSchema[key] = rule.defaultField;
              });
            }
            fieldsSchema = _objectSpread2(_objectSpread2({}, fieldsSchema), data.rule.fields);
            var paredFieldsSchema = {};
            Object.keys(fieldsSchema).forEach(function(field) {
              var fieldSchema = fieldsSchema[field];
              var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
              paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
            });
            var schema = new Schema2(paredFieldsSchema);
            schema.messages(options.messages);
            if (data.rule.options) {
              data.rule.options.messages = options.messages;
              data.rule.options.error = options.error;
            }
            schema.validate(data.value, data.rule.options || options, function(errs) {
              var finalErrors = [];
              if (filledErrors && filledErrors.length) {
                finalErrors.push.apply(finalErrors, _toConsumableArray(filledErrors));
              }
              if (errs && errs.length) {
                finalErrors.push.apply(finalErrors, _toConsumableArray(errs));
              }
              doIt(finalErrors.length ? finalErrors : null);
            });
          }
        }
        var res;
        if (rule.asyncValidator) {
          res = rule.asyncValidator(rule, data.value, cb2, data.source, options);
        } else if (rule.validator) {
          try {
            res = rule.validator(rule, data.value, cb2, data.source, options);
          } catch (error2) {
            var _console$error, _console;
            (_console$error = (_console = console).error) === null || _console$error === void 0 || _console$error.call(_console, error2);
            if (!options.suppressValidatorError) {
              setTimeout(function() {
                throw error2;
              }, 0);
            }
            cb2(error2.message);
          }
          if (res === true) {
            cb2();
          } else if (res === false) {
            cb2(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || "".concat(rule.fullField || rule.field, " fails"));
          } else if (res instanceof Array) {
            cb2(res);
          } else if (res instanceof Error) {
            cb2(res.message);
          }
        }
        if (res && res.then) {
          res.then(function() {
            return cb2();
          }, function(e2) {
            return cb2(e2);
          });
        }
      }, function(results) {
        complete(results);
      }, source2);
    }
  }, {
    key: "getType",
    value: function getType(rule) {
      if (rule.type === void 0 && rule.pattern instanceof RegExp) {
        rule.type = "pattern";
      }
      if (typeof rule.validator !== "function" && rule.type && !validators$2.hasOwnProperty(rule.type)) {
        throw new Error(format$1("Unknown rule type %s", rule.type));
      }
      return rule.type || "string";
    }
  }, {
    key: "getValidationMethod",
    value: function getValidationMethod(rule) {
      if (typeof rule.validator === "function") {
        return rule.validator;
      }
      var keys2 = Object.keys(rule);
      var messageIndex = keys2.indexOf("message");
      if (messageIndex !== -1) {
        keys2.splice(messageIndex, 1);
      }
      if (keys2.length === 1 && keys2[0] === "required") {
        return validators$2.required;
      }
      return validators$2[this.getType(rule)] || void 0;
    }
  }]);
  return Schema2;
}();
_defineProperty$3(Schema$1, "register", function register(type4, validator2) {
  if (typeof validator2 !== "function") {
    throw new Error("Cannot register a validator by type, validator is not a function");
  }
  validators$2[type4] = validator2;
});
_defineProperty$3(Schema$1, "warning", warning);
_defineProperty$3(Schema$1, "messages", messages);
_defineProperty$3(Schema$1, "validators", validators$2);
var typeTemplate = "'${name}' is not a valid ${type}";
var defaultValidateMessages = {
  default: "Validation error on field '${name}'",
  required: "'${name}' is required",
  enum: "'${name}' must be one of [${enum}]",
  whitespace: "'${name}' cannot be empty",
  date: {
    format: "'${name}' is invalid for format date",
    parse: "'${name}' could not be parsed as date",
    invalid: "'${name}' is invalid date"
  },
  types: {
    string: typeTemplate,
    method: typeTemplate,
    array: typeTemplate,
    object: typeTemplate,
    number: typeTemplate,
    date: typeTemplate,
    boolean: typeTemplate,
    integer: typeTemplate,
    float: typeTemplate,
    regexp: typeTemplate,
    email: typeTemplate,
    url: typeTemplate,
    hex: typeTemplate
  },
  string: {
    len: "'${name}' must be exactly ${len} characters",
    min: "'${name}' must be at least ${min} characters",
    max: "'${name}' cannot be longer than ${max} characters",
    range: "'${name}' must be between ${min} and ${max} characters"
  },
  number: {
    len: "'${name}' must equal ${len}",
    min: "'${name}' cannot be less than ${min}",
    max: "'${name}' cannot be greater than ${max}",
    range: "'${name}' must be between ${min} and ${max}"
  },
  array: {
    len: "'${name}' must be exactly ${len} in length",
    min: "'${name}' cannot be less than ${min} in length",
    max: "'${name}' cannot be greater than ${max} in length",
    range: "'${name}' must be between ${min} and ${max} in length"
  },
  pattern: {
    mismatch: "'${name}' does not match pattern ${pattern}"
  }
};
var AsyncValidator = Schema$1;
function replaceMessage(template2, kv) {
  return template2.replace(/\\?\$\{\w+\}/g, function(str) {
    if (str.startsWith("\\")) {
      return str.slice(1);
    }
    var key = str.slice(2, -1);
    return kv[key];
  });
}
var CODE_LOGIC_ERROR = "CODE_LOGIC_ERROR";
function validateRule(_x, _x2, _x3, _x4, _x5) {
  return _validateRule.apply(this, arguments);
}
function _validateRule() {
  _validateRule = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee2(name2, value2, rule, options, messageVariables) {
    var cloneRule, originValidator, subRuleField, validator2, messages2, result, subResults, kv, fillVariableResult;
    return _regeneratorRuntime().wrap(function _callee2$(_context2) {
      while (1)
        switch (_context2.prev = _context2.next) {
          case 0:
            cloneRule = _objectSpread2({}, rule);
            delete cloneRule.ruleIndex;
            AsyncValidator.warning = function() {
              return void 0;
            };
            if (cloneRule.validator) {
              originValidator = cloneRule.validator;
              cloneRule.validator = function() {
                try {
                  return originValidator.apply(void 0, arguments);
                } catch (error2) {
                  console.error(error2);
                  return Promise.reject(CODE_LOGIC_ERROR);
                }
              };
            }
            subRuleField = null;
            if (cloneRule && cloneRule.type === "array" && cloneRule.defaultField) {
              subRuleField = cloneRule.defaultField;
              delete cloneRule.defaultField;
            }
            validator2 = new AsyncValidator(_defineProperty$3({}, name2, [cloneRule]));
            messages2 = merge$5(defaultValidateMessages, options.validateMessages);
            validator2.messages(messages2);
            result = [];
            _context2.prev = 10;
            _context2.next = 13;
            return Promise.resolve(validator2.validate(_defineProperty$3({}, name2, value2), _objectSpread2({}, options)));
          case 13:
            _context2.next = 18;
            break;
          case 15:
            _context2.prev = 15;
            _context2.t0 = _context2["catch"](10);
            if (_context2.t0.errors) {
              result = _context2.t0.errors.map(function(_ref4, index2) {
                var message = _ref4.message;
                var mergedMessage = message === CODE_LOGIC_ERROR ? messages2.default : message;
                return /* @__PURE__ */ reactExports.isValidElement(mergedMessage) ? (
                  // Wrap ReactNode with `key`
                  /* @__PURE__ */ reactExports.cloneElement(mergedMessage, {
                    key: "error_".concat(index2)
                  })
                ) : mergedMessage;
              });
            }
          case 18:
            if (!(!result.length && subRuleField)) {
              _context2.next = 23;
              break;
            }
            _context2.next = 21;
            return Promise.all(value2.map(function(subValue, i2) {
              return validateRule("".concat(name2, ".").concat(i2), subValue, subRuleField, options, messageVariables);
            }));
          case 21:
            subResults = _context2.sent;
            return _context2.abrupt("return", subResults.reduce(function(prev2, errors) {
              return [].concat(_toConsumableArray(prev2), _toConsumableArray(errors));
            }, []));
          case 23:
            kv = _objectSpread2(_objectSpread2({}, rule), {}, {
              name: name2,
              enum: (rule.enum || []).join(", ")
            }, messageVariables);
            fillVariableResult = result.map(function(error2) {
              if (typeof error2 === "string") {
                return replaceMessage(error2, kv);
              }
              return error2;
            });
            return _context2.abrupt("return", fillVariableResult);
          case 26:
          case "end":
            return _context2.stop();
        }
    }, _callee2, null, [[10, 15]]);
  }));
  return _validateRule.apply(this, arguments);
}
function validateRules(namePath, value2, rules2, options, validateFirst, messageVariables) {
  var name2 = namePath.join(".");
  var filledRules = rules2.map(function(currentRule, ruleIndex) {
    var originValidatorFunc = currentRule.validator;
    var cloneRule = _objectSpread2(_objectSpread2({}, currentRule), {}, {
      ruleIndex
    });
    if (originValidatorFunc) {
      cloneRule.validator = function(rule, val, callback2) {
        var hasPromise = false;
        var wrappedCallback = function wrappedCallback2() {
          for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
            args[_key] = arguments[_key];
          }
          Promise.resolve().then(function() {
            warningOnce(!hasPromise, "Your validator function has already return a promise. `callback` will be ignored.");
            if (!hasPromise) {
              callback2.apply(void 0, args);
            }
          });
        };
        var promise = originValidatorFunc(rule, val, wrappedCallback);
        hasPromise = promise && typeof promise.then === "function" && typeof promise.catch === "function";
        warningOnce(hasPromise, "`callback` is deprecated. Please return a promise instead.");
        if (hasPromise) {
          promise.then(function() {
            callback2();
          }).catch(function(err) {
            callback2(err || " ");
          });
        }
      };
    }
    return cloneRule;
  }).sort(function(_ref, _ref2) {
    var w1 = _ref.warningOnly, i1 = _ref.ruleIndex;
    var w2 = _ref2.warningOnly, i2 = _ref2.ruleIndex;
    if (!!w1 === !!w2) {
      return i1 - i2;
    }
    if (w1) {
      return 1;
    }
    return -1;
  });
  var summaryPromise;
  if (validateFirst === true) {
    summaryPromise = new Promise(/* @__PURE__ */ function() {
      var _ref3 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(resolve2, reject) {
        var i2, rule, errors;
        return _regeneratorRuntime().wrap(function _callee$(_context) {
          while (1)
            switch (_context.prev = _context.next) {
              case 0:
                i2 = 0;
              case 1:
                if (!(i2 < filledRules.length)) {
                  _context.next = 12;
                  break;
                }
                rule = filledRules[i2];
                _context.next = 5;
                return validateRule(name2, value2, rule, options, messageVariables);
              case 5:
                errors = _context.sent;
                if (!errors.length) {
                  _context.next = 9;
                  break;
                }
                reject([{
                  errors,
                  rule
                }]);
                return _context.abrupt("return");
              case 9:
                i2 += 1;
                _context.next = 1;
                break;
              case 12:
                resolve2([]);
              case 13:
              case "end":
                return _context.stop();
            }
        }, _callee);
      }));
      return function(_x6, _x7) {
        return _ref3.apply(this, arguments);
      };
    }());
  } else {
    var rulePromises = filledRules.map(function(rule) {
      return validateRule(name2, value2, rule, options, messageVariables).then(function(errors) {
        return {
          errors,
          rule
        };
      });
    });
    summaryPromise = (validateFirst ? finishOnFirstFailed(rulePromises) : finishOnAllFailed(rulePromises)).then(function(errors) {
      return Promise.reject(errors);
    });
  }
  summaryPromise.catch(function(e2) {
    return e2;
  });
  return summaryPromise;
}
function finishOnAllFailed(_x8) {
  return _finishOnAllFailed.apply(this, arguments);
}
function _finishOnAllFailed() {
  _finishOnAllFailed = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee3(rulePromises) {
    return _regeneratorRuntime().wrap(function _callee3$(_context3) {
      while (1)
        switch (_context3.prev = _context3.next) {
          case 0:
            return _context3.abrupt("return", Promise.all(rulePromises).then(function(errorsList) {
              var _ref5;
              var errors = (_ref5 = []).concat.apply(_ref5, _toConsumableArray(errorsList));
              return errors;
            }));
          case 1:
          case "end":
            return _context3.stop();
        }
    }, _callee3);
  }));
  return _finishOnAllFailed.apply(this, arguments);
}
function finishOnFirstFailed(_x9) {
  return _finishOnFirstFailed.apply(this, arguments);
}
function _finishOnFirstFailed() {
  _finishOnFirstFailed = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee4(rulePromises) {
    var count;
    return _regeneratorRuntime().wrap(function _callee4$(_context4) {
      while (1)
        switch (_context4.prev = _context4.next) {
          case 0:
            count = 0;
            return _context4.abrupt("return", new Promise(function(resolve2) {
              rulePromises.forEach(function(promise) {
                promise.then(function(ruleError) {
                  if (ruleError.errors.length) {
                    resolve2([ruleError]);
                  }
                  count += 1;
                  if (count === rulePromises.length) {
                    resolve2([]);
                  }
                });
              });
            }));
          case 2:
          case "end":
            return _context4.stop();
        }
    }, _callee4);
  }));
  return _finishOnFirstFailed.apply(this, arguments);
}
function getNamePath(path) {
  return toArray$3(path);
}
function cloneByNamePathList(store, namePathList) {
  var newStore = {};
  namePathList.forEach(function(namePath) {
    var value2 = get$a(store, namePath);
    newStore = set$3(newStore, namePath, value2);
  });
  return newStore;
}
function containsNamePath(namePathList, namePath) {
  var partialMatch = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
  return namePathList && namePathList.some(function(path) {
    return matchNamePath(namePath, path, partialMatch);
  });
}
function matchNamePath(namePath, subNamePath) {
  var partialMatch = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
  if (!namePath || !subNamePath) {
    return false;
  }
  if (!partialMatch && namePath.length !== subNamePath.length) {
    return false;
  }
  return subNamePath.every(function(nameUnit, i2) {
    return namePath[i2] === nameUnit;
  });
}
function isSimilar(source2, target) {
  if (source2 === target) {
    return true;
  }
  if (!source2 && target || source2 && !target) {
    return false;
  }
  if (!source2 || !target || _typeof$1(source2) !== "object" || _typeof$1(target) !== "object") {
    return false;
  }
  var sourceKeys = Object.keys(source2);
  var targetKeys = Object.keys(target);
  var keys2 = new Set([].concat(sourceKeys, targetKeys));
  return _toConsumableArray(keys2).every(function(key) {
    var sourceValue = source2[key];
    var targetValue = target[key];
    if (typeof sourceValue === "function" && typeof targetValue === "function") {
      return true;
    }
    return sourceValue === targetValue;
  });
}
function defaultGetValueFromEvent(valuePropName) {
  var event = arguments.length <= 1 ? void 0 : arguments[1];
  if (event && event.target && _typeof$1(event.target) === "object" && valuePropName in event.target) {
    return event.target[valuePropName];
  }
  return event;
}
function move(array4, moveIndex, toIndex) {
  var length2 = array4.length;
  if (moveIndex < 0 || moveIndex >= length2 || toIndex < 0 || toIndex >= length2) {
    return array4;
  }
  var item = array4[moveIndex];
  var diff2 = moveIndex - toIndex;
  if (diff2 > 0) {
    return [].concat(_toConsumableArray(array4.slice(0, toIndex)), [item], _toConsumableArray(array4.slice(toIndex, moveIndex)), _toConsumableArray(array4.slice(moveIndex + 1, length2)));
  }
  if (diff2 < 0) {
    return [].concat(_toConsumableArray(array4.slice(0, moveIndex)), _toConsumableArray(array4.slice(moveIndex + 1, toIndex + 1)), [item], _toConsumableArray(array4.slice(toIndex + 1, length2)));
  }
  return array4;
}
var _excluded$u = ["name"];
var EMPTY_ERRORS = [];
function requireUpdate(shouldUpdate, prev2, next2, prevValue, nextValue, info2) {
  if (typeof shouldUpdate === "function") {
    return shouldUpdate(prev2, next2, "source" in info2 ? {
      source: info2.source
    } : {});
  }
  return prevValue !== nextValue;
}
var Field = /* @__PURE__ */ function(_React$Component) {
  _inherits$a(Field2, _React$Component);
  var _super = _createSuper$4(Field2);
  function Field2(props) {
    var _this;
    _classCallCheck$a(this, Field2);
    _this = _super.call(this, props);
    _defineProperty$3(_assertThisInitialized(_this), "state", {
      resetCount: 0
    });
    _defineProperty$3(_assertThisInitialized(_this), "cancelRegisterFunc", null);
    _defineProperty$3(_assertThisInitialized(_this), "mounted", false);
    _defineProperty$3(_assertThisInitialized(_this), "touched", false);
    _defineProperty$3(_assertThisInitialized(_this), "dirty", false);
    _defineProperty$3(_assertThisInitialized(_this), "validatePromise", void 0);
    _defineProperty$3(_assertThisInitialized(_this), "prevValidating", void 0);
    _defineProperty$3(_assertThisInitialized(_this), "errors", EMPTY_ERRORS);
    _defineProperty$3(_assertThisInitialized(_this), "warnings", EMPTY_ERRORS);
    _defineProperty$3(_assertThisInitialized(_this), "cancelRegister", function() {
      var _this$props = _this.props, preserve2 = _this$props.preserve, isListField = _this$props.isListField, name2 = _this$props.name;
      if (_this.cancelRegisterFunc) {
        _this.cancelRegisterFunc(isListField, preserve2, getNamePath(name2));
      }
      _this.cancelRegisterFunc = null;
    });
    _defineProperty$3(_assertThisInitialized(_this), "getNamePath", function() {
      var _this$props2 = _this.props, name2 = _this$props2.name, fieldContext = _this$props2.fieldContext;
      var _fieldContext$prefixN = fieldContext.prefixName, prefixName = _fieldContext$prefixN === void 0 ? [] : _fieldContext$prefixN;
      return name2 !== void 0 ? [].concat(_toConsumableArray(prefixName), _toConsumableArray(name2)) : [];
    });
    _defineProperty$3(_assertThisInitialized(_this), "getRules", function() {
      var _this$props3 = _this.props, _this$props3$rules = _this$props3.rules, rules2 = _this$props3$rules === void 0 ? [] : _this$props3$rules, fieldContext = _this$props3.fieldContext;
      return rules2.map(function(rule) {
        if (typeof rule === "function") {
          return rule(fieldContext);
        }
        return rule;
      });
    });
    _defineProperty$3(_assertThisInitialized(_this), "refresh", function() {
      if (!_this.mounted)
        return;
      _this.setState(function(_ref) {
        var resetCount = _ref.resetCount;
        return {
          resetCount: resetCount + 1
        };
      });
    });
    _defineProperty$3(_assertThisInitialized(_this), "metaCache", null);
    _defineProperty$3(_assertThisInitialized(_this), "triggerMetaEvent", function(destroy) {
      var onMetaChange = _this.props.onMetaChange;
      if (onMetaChange) {
        var _meta = _objectSpread2(_objectSpread2({}, _this.getMeta()), {}, {
          destroy
        });
        if (!isEqual$2(_this.metaCache, _meta)) {
          onMetaChange(_meta);
        }
        _this.metaCache = _meta;
      } else {
        _this.metaCache = null;
      }
    });
    _defineProperty$3(_assertThisInitialized(_this), "onStoreChange", function(prevStore, namePathList, info2) {
      var _this$props4 = _this.props, shouldUpdate = _this$props4.shouldUpdate, _this$props4$dependen = _this$props4.dependencies, dependencies = _this$props4$dependen === void 0 ? [] : _this$props4$dependen, onReset = _this$props4.onReset;
      var store = info2.store;
      var namePath = _this.getNamePath();
      var prevValue = _this.getValue(prevStore);
      var curValue = _this.getValue(store);
      var namePathMatch = namePathList && containsNamePath(namePathList, namePath);
      if (info2.type === "valueUpdate" && info2.source === "external" && !isEqual$2(prevValue, curValue)) {
        _this.touched = true;
        _this.dirty = true;
        _this.validatePromise = null;
        _this.errors = EMPTY_ERRORS;
        _this.warnings = EMPTY_ERRORS;
        _this.triggerMetaEvent();
      }
      switch (info2.type) {
        case "reset":
          if (!namePathList || namePathMatch) {
            _this.touched = false;
            _this.dirty = false;
            _this.validatePromise = void 0;
            _this.errors = EMPTY_ERRORS;
            _this.warnings = EMPTY_ERRORS;
            _this.triggerMetaEvent();
            onReset === null || onReset === void 0 || onReset();
            _this.refresh();
            return;
          }
          break;
        case "remove": {
          if (shouldUpdate && requireUpdate(shouldUpdate, prevStore, store, prevValue, curValue, info2)) {
            _this.reRender();
            return;
          }
          break;
        }
        case "setField": {
          var data = info2.data;
          if (namePathMatch) {
            if ("touched" in data) {
              _this.touched = data.touched;
            }
            if ("validating" in data && !("originRCField" in data)) {
              _this.validatePromise = data.validating ? Promise.resolve([]) : null;
            }
            if ("errors" in data) {
              _this.errors = data.errors || EMPTY_ERRORS;
            }
            if ("warnings" in data) {
              _this.warnings = data.warnings || EMPTY_ERRORS;
            }
            _this.dirty = true;
            _this.triggerMetaEvent();
            _this.reRender();
            return;
          } else if ("value" in data && containsNamePath(namePathList, namePath, true)) {
            _this.reRender();
            return;
          }
          if (shouldUpdate && !namePath.length && requireUpdate(shouldUpdate, prevStore, store, prevValue, curValue, info2)) {
            _this.reRender();
            return;
          }
          break;
        }
        case "dependenciesUpdate": {
          var dependencyList = dependencies.map(getNamePath);
          if (dependencyList.some(function(dependency) {
            return containsNamePath(info2.relatedFields, dependency);
          })) {
            _this.reRender();
            return;
          }
          break;
        }
        default:
          if (namePathMatch || (!dependencies.length || namePath.length || shouldUpdate) && requireUpdate(shouldUpdate, prevStore, store, prevValue, curValue, info2)) {
            _this.reRender();
            return;
          }
          break;
      }
      if (shouldUpdate === true) {
        _this.reRender();
      }
    });
    _defineProperty$3(_assertThisInitialized(_this), "validateRules", function(options) {
      var namePath = _this.getNamePath();
      var currentValue = _this.getValue();
      var _ref2 = options || {}, triggerName = _ref2.triggerName, _ref2$validateOnly = _ref2.validateOnly, validateOnly = _ref2$validateOnly === void 0 ? false : _ref2$validateOnly;
      var rootPromise = Promise.resolve().then(/* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee() {
        var _this$props5, _this$props5$validate, validateFirst, messageVariables, validateDebounce, filteredRules, promise;
        return _regeneratorRuntime().wrap(function _callee$(_context) {
          while (1)
            switch (_context.prev = _context.next) {
              case 0:
                if (_this.mounted) {
                  _context.next = 2;
                  break;
                }
                return _context.abrupt("return", []);
              case 2:
                _this$props5 = _this.props, _this$props5$validate = _this$props5.validateFirst, validateFirst = _this$props5$validate === void 0 ? false : _this$props5$validate, messageVariables = _this$props5.messageVariables, validateDebounce = _this$props5.validateDebounce;
                filteredRules = _this.getRules();
                if (triggerName) {
                  filteredRules = filteredRules.filter(function(rule) {
                    return rule;
                  }).filter(function(rule) {
                    var validateTrigger = rule.validateTrigger;
                    if (!validateTrigger) {
                      return true;
                    }
                    var triggerList = toArray$3(validateTrigger);
                    return triggerList.includes(triggerName);
                  });
                }
                if (!(validateDebounce && triggerName)) {
                  _context.next = 10;
                  break;
                }
                _context.next = 8;
                return new Promise(function(resolve2) {
                  setTimeout(resolve2, validateDebounce);
                });
              case 8:
                if (!(_this.validatePromise !== rootPromise)) {
                  _context.next = 10;
                  break;
                }
                return _context.abrupt("return", []);
              case 10:
                promise = validateRules(namePath, currentValue, filteredRules, options, validateFirst, messageVariables);
                promise.catch(function(e2) {
                  return e2;
                }).then(function() {
                  var ruleErrors = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : EMPTY_ERRORS;
                  if (_this.validatePromise === rootPromise) {
                    var _ruleErrors$forEach;
                    _this.validatePromise = null;
                    var nextErrors = [];
                    var nextWarnings = [];
                    (_ruleErrors$forEach = ruleErrors.forEach) === null || _ruleErrors$forEach === void 0 || _ruleErrors$forEach.call(ruleErrors, function(_ref4) {
                      var warningOnly = _ref4.rule.warningOnly, _ref4$errors = _ref4.errors, errors = _ref4$errors === void 0 ? EMPTY_ERRORS : _ref4$errors;
                      if (warningOnly) {
                        nextWarnings.push.apply(nextWarnings, _toConsumableArray(errors));
                      } else {
                        nextErrors.push.apply(nextErrors, _toConsumableArray(errors));
                      }
                    });
                    _this.errors = nextErrors;
                    _this.warnings = nextWarnings;
                    _this.triggerMetaEvent();
                    _this.reRender();
                  }
                });
                return _context.abrupt("return", promise);
              case 13:
              case "end":
                return _context.stop();
            }
        }, _callee);
      })));
      if (validateOnly) {
        return rootPromise;
      }
      _this.validatePromise = rootPromise;
      _this.dirty = true;
      _this.errors = EMPTY_ERRORS;
      _this.warnings = EMPTY_ERRORS;
      _this.triggerMetaEvent();
      _this.reRender();
      return rootPromise;
    });
    _defineProperty$3(_assertThisInitialized(_this), "isFieldValidating", function() {
      return !!_this.validatePromise;
    });
    _defineProperty$3(_assertThisInitialized(_this), "isFieldTouched", function() {
      return _this.touched;
    });
    _defineProperty$3(_assertThisInitialized(_this), "isFieldDirty", function() {
      if (_this.dirty || _this.props.initialValue !== void 0) {
        return true;
      }
      var fieldContext = _this.props.fieldContext;
      var _fieldContext$getInte = fieldContext.getInternalHooks(HOOK_MARK), getInitialValue = _fieldContext$getInte.getInitialValue;
      if (getInitialValue(_this.getNamePath()) !== void 0) {
        return true;
      }
      return false;
    });
    _defineProperty$3(_assertThisInitialized(_this), "getErrors", function() {
      return _this.errors;
    });
    _defineProperty$3(_assertThisInitialized(_this), "getWarnings", function() {
      return _this.warnings;
    });
    _defineProperty$3(_assertThisInitialized(_this), "isListField", function() {
      return _this.props.isListField;
    });
    _defineProperty$3(_assertThisInitialized(_this), "isList", function() {
      return _this.props.isList;
    });
    _defineProperty$3(_assertThisInitialized(_this), "isPreserve", function() {
      return _this.props.preserve;
    });
    _defineProperty$3(_assertThisInitialized(_this), "getMeta", function() {
      _this.prevValidating = _this.isFieldValidating();
      var meta = {
        touched: _this.isFieldTouched(),
        validating: _this.prevValidating,
        errors: _this.errors,
        warnings: _this.warnings,
        name: _this.getNamePath(),
        validated: _this.validatePromise === null
      };
      return meta;
    });
    _defineProperty$3(_assertThisInitialized(_this), "getOnlyChild", function(children) {
      if (typeof children === "function") {
        var _meta2 = _this.getMeta();
        return _objectSpread2(_objectSpread2({}, _this.getOnlyChild(children(_this.getControlled(), _meta2, _this.props.fieldContext))), {}, {
          isFunction: true
        });
      }
      var childList = toArray$4(children);
      if (childList.length !== 1 || !/* @__PURE__ */ reactExports.isValidElement(childList[0])) {
        return {
          child: childList,
          isFunction: false
        };
      }
      return {
        child: childList[0],
        isFunction: false
      };
    });
    _defineProperty$3(_assertThisInitialized(_this), "getValue", function(store) {
      var getFieldsValue = _this.props.fieldContext.getFieldsValue;
      var namePath = _this.getNamePath();
      return get$a(store || getFieldsValue(true), namePath);
    });
    _defineProperty$3(_assertThisInitialized(_this), "getControlled", function() {
      var childProps = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
      var _this$props6 = _this.props, name2 = _this$props6.name, trigger = _this$props6.trigger, validateTrigger = _this$props6.validateTrigger, getValueFromEvent = _this$props6.getValueFromEvent, normalize2 = _this$props6.normalize, valuePropName = _this$props6.valuePropName, getValueProps = _this$props6.getValueProps, fieldContext = _this$props6.fieldContext;
      var mergedValidateTrigger = validateTrigger !== void 0 ? validateTrigger : fieldContext.validateTrigger;
      var namePath = _this.getNamePath();
      var getInternalHooks22 = fieldContext.getInternalHooks, getFieldsValue = fieldContext.getFieldsValue;
      var _getInternalHooks = getInternalHooks22(HOOK_MARK), dispatch = _getInternalHooks.dispatch;
      var value2 = _this.getValue();
      var mergedGetValueProps = getValueProps || function(val) {
        return _defineProperty$3({}, valuePropName, val);
      };
      var originTriggerFunc = childProps[trigger];
      var valueProps = name2 !== void 0 ? mergedGetValueProps(value2) : {};
      var control = _objectSpread2(_objectSpread2({}, childProps), valueProps);
      control[trigger] = function() {
        _this.touched = true;
        _this.dirty = true;
        _this.triggerMetaEvent();
        var newValue;
        for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
          args[_key] = arguments[_key];
        }
        if (getValueFromEvent) {
          newValue = getValueFromEvent.apply(void 0, args);
        } else {
          newValue = defaultGetValueFromEvent.apply(void 0, [valuePropName].concat(args));
        }
        if (normalize2) {
          newValue = normalize2(newValue, value2, getFieldsValue(true));
        }
        if (newValue !== value2) {
          dispatch({
            type: "updateValue",
            namePath,
            value: newValue
          });
        }
        if (originTriggerFunc) {
          originTriggerFunc.apply(void 0, args);
        }
      };
      var validateTriggerList = toArray$3(mergedValidateTrigger || []);
      validateTriggerList.forEach(function(triggerName) {
        var originTrigger = control[triggerName];
        control[triggerName] = function() {
          if (originTrigger) {
            originTrigger.apply(void 0, arguments);
          }
          var rules2 = _this.props.rules;
          if (rules2 && rules2.length) {
            dispatch({
              type: "validateField",
              namePath,
              triggerName
            });
          }
        };
      });
      return control;
    });
    if (props.fieldContext) {
      var getInternalHooks2 = props.fieldContext.getInternalHooks;
      var _getInternalHooks2 = getInternalHooks2(HOOK_MARK), initEntityValue = _getInternalHooks2.initEntityValue;
      initEntityValue(_assertThisInitialized(_this));
    }
    return _this;
  }
  _createClass$8(Field2, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      var _this$props7 = this.props, shouldUpdate = _this$props7.shouldUpdate, fieldContext = _this$props7.fieldContext;
      this.mounted = true;
      if (fieldContext) {
        var getInternalHooks2 = fieldContext.getInternalHooks;
        var _getInternalHooks3 = getInternalHooks2(HOOK_MARK), registerField = _getInternalHooks3.registerField;
        this.cancelRegisterFunc = registerField(this);
      }
      if (shouldUpdate === true) {
        this.reRender();
      }
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      this.cancelRegister();
      this.triggerMetaEvent(true);
      this.mounted = false;
    }
  }, {
    key: "reRender",
    value: function reRender() {
      if (!this.mounted)
        return;
      this.forceUpdate();
    }
  }, {
    key: "render",
    value: function render3() {
      var resetCount = this.state.resetCount;
      var children = this.props.children;
      var _this$getOnlyChild = this.getOnlyChild(children), child = _this$getOnlyChild.child, isFunction2 = _this$getOnlyChild.isFunction;
      var returnChildNode;
      if (isFunction2) {
        returnChildNode = child;
      } else if (/* @__PURE__ */ reactExports.isValidElement(child)) {
        returnChildNode = /* @__PURE__ */ reactExports.cloneElement(child, this.getControlled(child.props));
      } else {
        warningOnce(!child, "`children` of Field is not validate ReactElement.");
        returnChildNode = child;
      }
      return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, {
        key: resetCount
      }, returnChildNode);
    }
  }]);
  return Field2;
}(reactExports.Component);
_defineProperty$3(Field, "contextType", Context$1);
_defineProperty$3(Field, "defaultProps", {
  trigger: "onChange",
  valuePropName: "value"
});
function WrapperField(_ref6) {
  var _restProps$isListFiel;
  var name2 = _ref6.name, restProps = _objectWithoutProperties$3(_ref6, _excluded$u);
  var fieldContext = reactExports.useContext(Context$1);
  var listContext = reactExports.useContext(ListContext);
  var namePath = name2 !== void 0 ? getNamePath(name2) : void 0;
  var isMergedListField = (_restProps$isListFiel = restProps.isListField) !== null && _restProps$isListFiel !== void 0 ? _restProps$isListFiel : !!listContext;
  var key = "keep";
  if (!isMergedListField) {
    key = "_".concat((namePath || []).join("_"));
  }
  return /* @__PURE__ */ reactExports.createElement(Field, _extends$h({
    key,
    name: namePath,
    isListField: isMergedListField
  }, restProps, {
    fieldContext
  }));
}
function List$3(_ref) {
  var name2 = _ref.name, initialValue = _ref.initialValue, children = _ref.children, rules2 = _ref.rules, validateTrigger = _ref.validateTrigger, isListField = _ref.isListField;
  var context = reactExports.useContext(Context$1);
  var wrapperListContext = reactExports.useContext(ListContext);
  var keyRef = reactExports.useRef({
    keys: [],
    id: 0
  });
  var keyManager = keyRef.current;
  var prefixName = reactExports.useMemo(function() {
    var parentPrefixName = getNamePath(context.prefixName) || [];
    return [].concat(_toConsumableArray(parentPrefixName), _toConsumableArray(getNamePath(name2)));
  }, [context.prefixName, name2]);
  var fieldContext = reactExports.useMemo(function() {
    return _objectSpread2(_objectSpread2({}, context), {}, {
      prefixName
    });
  }, [context, prefixName]);
  var listContext = reactExports.useMemo(function() {
    return {
      getKey: function getKey3(namePath) {
        var len = prefixName.length;
        var pathName = namePath[len];
        return [keyManager.keys[pathName], namePath.slice(len + 1)];
      }
    };
  }, [prefixName]);
  if (typeof children !== "function") {
    warningOnce(false, "Form.List only accepts function as children.");
    return null;
  }
  var shouldUpdate = function shouldUpdate2(prevValue, nextValue, _ref2) {
    var source2 = _ref2.source;
    if (source2 === "internal") {
      return false;
    }
    return prevValue !== nextValue;
  };
  return /* @__PURE__ */ reactExports.createElement(ListContext.Provider, {
    value: listContext
  }, /* @__PURE__ */ reactExports.createElement(Context$1.Provider, {
    value: fieldContext
  }, /* @__PURE__ */ reactExports.createElement(WrapperField, {
    name: [],
    shouldUpdate,
    rules: rules2,
    validateTrigger,
    initialValue,
    isList: true,
    isListField: isListField !== null && isListField !== void 0 ? isListField : !!wrapperListContext
  }, function(_ref3, meta) {
    var _ref3$value = _ref3.value, value2 = _ref3$value === void 0 ? [] : _ref3$value, onChange = _ref3.onChange;
    var getFieldValue = context.getFieldValue;
    var getNewValue = function getNewValue2() {
      var values = getFieldValue(prefixName || []);
      return values || [];
    };
    var operations = {
      add: function add2(defaultValue2, index2) {
        var newValue = getNewValue();
        if (index2 >= 0 && index2 <= newValue.length) {
          keyManager.keys = [].concat(_toConsumableArray(keyManager.keys.slice(0, index2)), [keyManager.id], _toConsumableArray(keyManager.keys.slice(index2)));
          onChange([].concat(_toConsumableArray(newValue.slice(0, index2)), [defaultValue2], _toConsumableArray(newValue.slice(index2))));
        } else {
          keyManager.keys = [].concat(_toConsumableArray(keyManager.keys), [keyManager.id]);
          onChange([].concat(_toConsumableArray(newValue), [defaultValue2]));
        }
        keyManager.id += 1;
      },
      remove: function remove(index2) {
        var newValue = getNewValue();
        var indexSet = new Set(Array.isArray(index2) ? index2 : [index2]);
        if (indexSet.size <= 0) {
          return;
        }
        keyManager.keys = keyManager.keys.filter(function(_24, keysIndex) {
          return !indexSet.has(keysIndex);
        });
        onChange(newValue.filter(function(_24, valueIndex) {
          return !indexSet.has(valueIndex);
        }));
      },
      move: function move$1(from2, to2) {
        if (from2 === to2) {
          return;
        }
        var newValue = getNewValue();
        if (from2 < 0 || from2 >= newValue.length || to2 < 0 || to2 >= newValue.length) {
          return;
        }
        keyManager.keys = move(keyManager.keys, from2, to2);
        onChange(move(newValue, from2, to2));
      }
    };
    var listValue = value2 || [];
    if (!Array.isArray(listValue)) {
      listValue = [];
    }
    return children(listValue.map(function(__, index2) {
      var key = keyManager.keys[index2];
      if (key === void 0) {
        keyManager.keys[index2] = keyManager.id;
        key = keyManager.keys[index2];
        keyManager.id += 1;
      }
      return {
        name: index2,
        key,
        isListField: true
      };
    }), operations, meta);
  })));
}
function allPromiseFinish(promiseList) {
  var hasError = false;
  var count = promiseList.length;
  var results = [];
  if (!promiseList.length) {
    return Promise.resolve([]);
  }
  return new Promise(function(resolve2, reject) {
    promiseList.forEach(function(promise, index2) {
      promise.catch(function(e2) {
        hasError = true;
        return e2;
      }).then(function(result) {
        count -= 1;
        results[index2] = result;
        if (count > 0) {
          return;
        }
        if (hasError) {
          reject(results);
        }
        resolve2(results);
      });
    });
  });
}
var SPLIT = "__@field_split__";
function normalize$2(namePath) {
  return namePath.map(function(cell) {
    return "".concat(_typeof$1(cell), ":").concat(cell);
  }).join(SPLIT);
}
var NameMap = /* @__PURE__ */ function() {
  function NameMap2() {
    _classCallCheck$a(this, NameMap2);
    _defineProperty$3(this, "kvs", /* @__PURE__ */ new Map());
  }
  _createClass$8(NameMap2, [{
    key: "set",
    value: function set2(key, value2) {
      this.kvs.set(normalize$2(key), value2);
    }
  }, {
    key: "get",
    value: function get5(key) {
      return this.kvs.get(normalize$2(key));
    }
  }, {
    key: "update",
    value: function update(key, updater) {
      var origin2 = this.get(key);
      var next2 = updater(origin2);
      if (!next2) {
        this.delete(key);
      } else {
        this.set(key, next2);
      }
    }
  }, {
    key: "delete",
    value: function _delete(key) {
      this.kvs.delete(normalize$2(key));
    }
    // Since we only use this in test, let simply realize this
  }, {
    key: "map",
    value: function map2(callback2) {
      return _toConsumableArray(this.kvs.entries()).map(function(_ref) {
        var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value2 = _ref2[1];
        var cells = key.split(SPLIT);
        return callback2({
          key: cells.map(function(cell) {
            var _cell$match = cell.match(/^([^:]*):(.*)$/), _cell$match2 = _slicedToArray(_cell$match, 3), type4 = _cell$match2[1], unit2 = _cell$match2[2];
            return type4 === "number" ? Number(unit2) : unit2;
          }),
          value: value2
        });
      });
    }
  }, {
    key: "toJSON",
    value: function toJSON3() {
      var json = {};
      this.map(function(_ref3) {
        var key = _ref3.key, value2 = _ref3.value;
        json[key.join(".")] = value2;
        return null;
      });
      return json;
    }
  }]);
  return NameMap2;
}();
var _excluded$t = ["name"];
var FormStore = /* @__PURE__ */ _createClass$8(function FormStore2(forceRootUpdate) {
  var _this = this;
  _classCallCheck$a(this, FormStore2);
  _defineProperty$3(this, "formHooked", false);
  _defineProperty$3(this, "forceRootUpdate", void 0);
  _defineProperty$3(this, "subscribable", true);
  _defineProperty$3(this, "store", {});
  _defineProperty$3(this, "fieldEntities", []);
  _defineProperty$3(this, "initialValues", {});
  _defineProperty$3(this, "callbacks", {});
  _defineProperty$3(this, "validateMessages", null);
  _defineProperty$3(this, "preserve", null);
  _defineProperty$3(this, "lastValidatePromise", null);
  _defineProperty$3(this, "getForm", function() {
    return {
      getFieldValue: _this.getFieldValue,
      getFieldsValue: _this.getFieldsValue,
      getFieldError: _this.getFieldError,
      getFieldWarning: _this.getFieldWarning,
      getFieldsError: _this.getFieldsError,
      isFieldsTouched: _this.isFieldsTouched,
      isFieldTouched: _this.isFieldTouched,
      isFieldValidating: _this.isFieldValidating,
      isFieldsValidating: _this.isFieldsValidating,
      resetFields: _this.resetFields,
      setFields: _this.setFields,
      setFieldValue: _this.setFieldValue,
      setFieldsValue: _this.setFieldsValue,
      validateFields: _this.validateFields,
      submit: _this.submit,
      _init: true,
      getInternalHooks: _this.getInternalHooks
    };
  });
  _defineProperty$3(this, "getInternalHooks", function(key) {
    if (key === HOOK_MARK) {
      _this.formHooked = true;
      return {
        dispatch: _this.dispatch,
        initEntityValue: _this.initEntityValue,
        registerField: _this.registerField,
        useSubscribe: _this.useSubscribe,
        setInitialValues: _this.setInitialValues,
        destroyForm: _this.destroyForm,
        setCallbacks: _this.setCallbacks,
        setValidateMessages: _this.setValidateMessages,
        getFields: _this.getFields,
        setPreserve: _this.setPreserve,
        getInitialValue: _this.getInitialValue,
        registerWatch: _this.registerWatch
      };
    }
    warningOnce(false, "`getInternalHooks` is internal usage. Should not call directly.");
    return null;
  });
  _defineProperty$3(this, "useSubscribe", function(subscribable) {
    _this.subscribable = subscribable;
  });
  _defineProperty$3(this, "prevWithoutPreserves", null);
  _defineProperty$3(this, "setInitialValues", function(initialValues, init2) {
    _this.initialValues = initialValues || {};
    if (init2) {
      var _this$prevWithoutPres;
      var nextStore = merge$5(initialValues, _this.store);
      (_this$prevWithoutPres = _this.prevWithoutPreserves) === null || _this$prevWithoutPres === void 0 || _this$prevWithoutPres.map(function(_ref) {
        var namePath = _ref.key;
        nextStore = set$3(nextStore, namePath, get$a(initialValues, namePath));
      });
      _this.prevWithoutPreserves = null;
      _this.updateStore(nextStore);
    }
  });
  _defineProperty$3(this, "destroyForm", function(clearOnDestroy) {
    if (clearOnDestroy) {
      _this.updateStore({});
    } else {
      var prevWithoutPreserves = new NameMap();
      _this.getFieldEntities(true).forEach(function(entity) {
        if (!_this.isMergedPreserve(entity.isPreserve())) {
          prevWithoutPreserves.set(entity.getNamePath(), true);
        }
      });
      _this.prevWithoutPreserves = prevWithoutPreserves;
    }
  });
  _defineProperty$3(this, "getInitialValue", function(namePath) {
    var initValue = get$a(_this.initialValues, namePath);
    return namePath.length ? merge$5(initValue) : initValue;
  });
  _defineProperty$3(this, "setCallbacks", function(callbacks) {
    _this.callbacks = callbacks;
  });
  _defineProperty$3(this, "setValidateMessages", function(validateMessages) {
    _this.validateMessages = validateMessages;
  });
  _defineProperty$3(this, "setPreserve", function(preserve2) {
    _this.preserve = preserve2;
  });
  _defineProperty$3(this, "watchList", []);
  _defineProperty$3(this, "registerWatch", function(callback2) {
    _this.watchList.push(callback2);
    return function() {
      _this.watchList = _this.watchList.filter(function(fn) {
        return fn !== callback2;
      });
    };
  });
  _defineProperty$3(this, "notifyWatch", function() {
    var namePath = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
    if (_this.watchList.length) {
      var values = _this.getFieldsValue();
      var allValues = _this.getFieldsValue(true);
      _this.watchList.forEach(function(callback2) {
        callback2(values, allValues, namePath);
      });
    }
  });
  _defineProperty$3(this, "timeoutId", null);
  _defineProperty$3(this, "warningUnhooked", function() {
  });
  _defineProperty$3(this, "updateStore", function(nextStore) {
    _this.store = nextStore;
  });
  _defineProperty$3(this, "getFieldEntities", function() {
    var pure = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
    if (!pure) {
      return _this.fieldEntities;
    }
    return _this.fieldEntities.filter(function(field) {
      return field.getNamePath().length;
    });
  });
  _defineProperty$3(this, "getFieldsMap", function() {
    var pure = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
    var cache2 = new NameMap();
    _this.getFieldEntities(pure).forEach(function(field) {
      var namePath = field.getNamePath();
      cache2.set(namePath, field);
    });
    return cache2;
  });
  _defineProperty$3(this, "getFieldEntitiesForNamePathList", function(nameList) {
    if (!nameList) {
      return _this.getFieldEntities(true);
    }
    var cache2 = _this.getFieldsMap(true);
    return nameList.map(function(name2) {
      var namePath = getNamePath(name2);
      return cache2.get(namePath) || {
        INVALIDATE_NAME_PATH: getNamePath(name2)
      };
    });
  });
  _defineProperty$3(this, "getFieldsValue", function(nameList, filterFunc) {
    _this.warningUnhooked();
    var mergedNameList;
    var mergedFilterFunc;
    var mergedStrict;
    if (nameList === true || Array.isArray(nameList)) {
      mergedNameList = nameList;
      mergedFilterFunc = filterFunc;
    } else if (nameList && _typeof$1(nameList) === "object") {
      mergedStrict = nameList.strict;
      mergedFilterFunc = nameList.filter;
    }
    if (mergedNameList === true && !mergedFilterFunc) {
      return _this.store;
    }
    var fieldEntities = _this.getFieldEntitiesForNamePathList(Array.isArray(mergedNameList) ? mergedNameList : null);
    var filteredNameList = [];
    fieldEntities.forEach(function(entity) {
      var _isListField, _ref3;
      var namePath = "INVALIDATE_NAME_PATH" in entity ? entity.INVALIDATE_NAME_PATH : entity.getNamePath();
      if (mergedStrict) {
        var _isList, _ref2;
        if ((_isList = (_ref2 = entity).isList) !== null && _isList !== void 0 && _isList.call(_ref2)) {
          return;
        }
      } else if (!mergedNameList && (_isListField = (_ref3 = entity).isListField) !== null && _isListField !== void 0 && _isListField.call(_ref3)) {
        return;
      }
      if (!mergedFilterFunc) {
        filteredNameList.push(namePath);
      } else {
        var meta = "getMeta" in entity ? entity.getMeta() : null;
        if (mergedFilterFunc(meta)) {
          filteredNameList.push(namePath);
        }
      }
    });
    return cloneByNamePathList(_this.store, filteredNameList.map(getNamePath));
  });
  _defineProperty$3(this, "getFieldValue", function(name2) {
    _this.warningUnhooked();
    var namePath = getNamePath(name2);
    return get$a(_this.store, namePath);
  });
  _defineProperty$3(this, "getFieldsError", function(nameList) {
    _this.warningUnhooked();
    var fieldEntities = _this.getFieldEntitiesForNamePathList(nameList);
    return fieldEntities.map(function(entity, index2) {
      if (entity && !("INVALIDATE_NAME_PATH" in entity)) {
        return {
          name: entity.getNamePath(),
          errors: entity.getErrors(),
          warnings: entity.getWarnings()
        };
      }
      return {
        name: getNamePath(nameList[index2]),
        errors: [],
        warnings: []
      };
    });
  });
  _defineProperty$3(this, "getFieldError", function(name2) {
    _this.warningUnhooked();
    var namePath = getNamePath(name2);
    var fieldError = _this.getFieldsError([namePath])[0];
    return fieldError.errors;
  });
  _defineProperty$3(this, "getFieldWarning", function(name2) {
    _this.warningUnhooked();
    var namePath = getNamePath(name2);
    var fieldError = _this.getFieldsError([namePath])[0];
    return fieldError.warnings;
  });
  _defineProperty$3(this, "isFieldsTouched", function() {
    _this.warningUnhooked();
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    var arg0 = args[0], arg1 = args[1];
    var namePathList;
    var isAllFieldsTouched = false;
    if (args.length === 0) {
      namePathList = null;
    } else if (args.length === 1) {
      if (Array.isArray(arg0)) {
        namePathList = arg0.map(getNamePath);
        isAllFieldsTouched = false;
      } else {
        namePathList = null;
        isAllFieldsTouched = arg0;
      }
    } else {
      namePathList = arg0.map(getNamePath);
      isAllFieldsTouched = arg1;
    }
    var fieldEntities = _this.getFieldEntities(true);
    var isFieldTouched = function isFieldTouched2(field) {
      return field.isFieldTouched();
    };
    if (!namePathList) {
      return isAllFieldsTouched ? fieldEntities.every(function(entity) {
        return isFieldTouched(entity) || entity.isList();
      }) : fieldEntities.some(isFieldTouched);
    }
    var map2 = new NameMap();
    namePathList.forEach(function(shortNamePath) {
      map2.set(shortNamePath, []);
    });
    fieldEntities.forEach(function(field) {
      var fieldNamePath = field.getNamePath();
      namePathList.forEach(function(shortNamePath) {
        if (shortNamePath.every(function(nameUnit, i2) {
          return fieldNamePath[i2] === nameUnit;
        })) {
          map2.update(shortNamePath, function(list2) {
            return [].concat(_toConsumableArray(list2), [field]);
          });
        }
      });
    });
    var isNamePathListTouched = function isNamePathListTouched2(entities) {
      return entities.some(isFieldTouched);
    };
    var namePathListEntities = map2.map(function(_ref4) {
      var value2 = _ref4.value;
      return value2;
    });
    return isAllFieldsTouched ? namePathListEntities.every(isNamePathListTouched) : namePathListEntities.some(isNamePathListTouched);
  });
  _defineProperty$3(this, "isFieldTouched", function(name2) {
    _this.warningUnhooked();
    return _this.isFieldsTouched([name2]);
  });
  _defineProperty$3(this, "isFieldsValidating", function(nameList) {
    _this.warningUnhooked();
    var fieldEntities = _this.getFieldEntities();
    if (!nameList) {
      return fieldEntities.some(function(testField) {
        return testField.isFieldValidating();
      });
    }
    var namePathList = nameList.map(getNamePath);
    return fieldEntities.some(function(testField) {
      var fieldNamePath = testField.getNamePath();
      return containsNamePath(namePathList, fieldNamePath) && testField.isFieldValidating();
    });
  });
  _defineProperty$3(this, "isFieldValidating", function(name2) {
    _this.warningUnhooked();
    return _this.isFieldsValidating([name2]);
  });
  _defineProperty$3(this, "resetWithFieldInitialValue", function() {
    var info2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    var cache2 = new NameMap();
    var fieldEntities = _this.getFieldEntities(true);
    fieldEntities.forEach(function(field) {
      var initialValue = field.props.initialValue;
      var namePath = field.getNamePath();
      if (initialValue !== void 0) {
        var records = cache2.get(namePath) || /* @__PURE__ */ new Set();
        records.add({
          entity: field,
          value: initialValue
        });
        cache2.set(namePath, records);
      }
    });
    var resetWithFields = function resetWithFields2(entities) {
      entities.forEach(function(field) {
        var initialValue = field.props.initialValue;
        if (initialValue !== void 0) {
          var namePath = field.getNamePath();
          var formInitialValue = _this.getInitialValue(namePath);
          if (formInitialValue !== void 0) {
            warningOnce(false, "Form already set 'initialValues' with path '".concat(namePath.join("."), "'. Field can not overwrite it."));
          } else {
            var records = cache2.get(namePath);
            if (records && records.size > 1) {
              warningOnce(false, "Multiple Field with path '".concat(namePath.join("."), "' set 'initialValue'. Can not decide which one to pick."));
            } else if (records) {
              var originValue = _this.getFieldValue(namePath);
              var isListField = field.isListField();
              if (!isListField && (!info2.skipExist || originValue === void 0)) {
                _this.updateStore(set$3(_this.store, namePath, _toConsumableArray(records)[0].value));
              }
            }
          }
        }
      });
    };
    var requiredFieldEntities;
    if (info2.entities) {
      requiredFieldEntities = info2.entities;
    } else if (info2.namePathList) {
      requiredFieldEntities = [];
      info2.namePathList.forEach(function(namePath) {
        var records = cache2.get(namePath);
        if (records) {
          var _requiredFieldEntitie;
          (_requiredFieldEntitie = requiredFieldEntities).push.apply(_requiredFieldEntitie, _toConsumableArray(_toConsumableArray(records).map(function(r2) {
            return r2.entity;
          })));
        }
      });
    } else {
      requiredFieldEntities = fieldEntities;
    }
    resetWithFields(requiredFieldEntities);
  });
  _defineProperty$3(this, "resetFields", function(nameList) {
    _this.warningUnhooked();
    var prevStore = _this.store;
    if (!nameList) {
      _this.updateStore(merge$5(_this.initialValues));
      _this.resetWithFieldInitialValue();
      _this.notifyObservers(prevStore, null, {
        type: "reset"
      });
      _this.notifyWatch();
      return;
    }
    var namePathList = nameList.map(getNamePath);
    namePathList.forEach(function(namePath) {
      var initialValue = _this.getInitialValue(namePath);
      _this.updateStore(set$3(_this.store, namePath, initialValue));
    });
    _this.resetWithFieldInitialValue({
      namePathList
    });
    _this.notifyObservers(prevStore, namePathList, {
      type: "reset"
    });
    _this.notifyWatch(namePathList);
  });
  _defineProperty$3(this, "setFields", function(fields) {
    _this.warningUnhooked();
    var prevStore = _this.store;
    var namePathList = [];
    fields.forEach(function(fieldData) {
      var name2 = fieldData.name, data = _objectWithoutProperties$3(fieldData, _excluded$t);
      var namePath = getNamePath(name2);
      namePathList.push(namePath);
      if ("value" in data) {
        _this.updateStore(set$3(_this.store, namePath, data.value));
      }
      _this.notifyObservers(prevStore, [namePath], {
        type: "setField",
        data: fieldData
      });
    });
    _this.notifyWatch(namePathList);
  });
  _defineProperty$3(this, "getFields", function() {
    var entities = _this.getFieldEntities(true);
    var fields = entities.map(function(field) {
      var namePath = field.getNamePath();
      var meta = field.getMeta();
      var fieldData = _objectSpread2(_objectSpread2({}, meta), {}, {
        name: namePath,
        value: _this.getFieldValue(namePath)
      });
      Object.defineProperty(fieldData, "originRCField", {
        value: true
      });
      return fieldData;
    });
    return fields;
  });
  _defineProperty$3(this, "initEntityValue", function(entity) {
    var initialValue = entity.props.initialValue;
    if (initialValue !== void 0) {
      var namePath = entity.getNamePath();
      var prevValue = get$a(_this.store, namePath);
      if (prevValue === void 0) {
        _this.updateStore(set$3(_this.store, namePath, initialValue));
      }
    }
  });
  _defineProperty$3(this, "isMergedPreserve", function(fieldPreserve) {
    var mergedPreserve = fieldPreserve !== void 0 ? fieldPreserve : _this.preserve;
    return mergedPreserve !== null && mergedPreserve !== void 0 ? mergedPreserve : true;
  });
  _defineProperty$3(this, "registerField", function(entity) {
    _this.fieldEntities.push(entity);
    var namePath = entity.getNamePath();
    _this.notifyWatch([namePath]);
    if (entity.props.initialValue !== void 0) {
      var prevStore = _this.store;
      _this.resetWithFieldInitialValue({
        entities: [entity],
        skipExist: true
      });
      _this.notifyObservers(prevStore, [entity.getNamePath()], {
        type: "valueUpdate",
        source: "internal"
      });
    }
    return function(isListField, preserve2) {
      var subNamePath = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
      _this.fieldEntities = _this.fieldEntities.filter(function(item) {
        return item !== entity;
      });
      if (!_this.isMergedPreserve(preserve2) && (!isListField || subNamePath.length > 1)) {
        var defaultValue2 = isListField ? void 0 : _this.getInitialValue(namePath);
        if (namePath.length && _this.getFieldValue(namePath) !== defaultValue2 && _this.fieldEntities.every(function(field) {
          return (
            // Only reset when no namePath exist
            !matchNamePath(field.getNamePath(), namePath)
          );
        })) {
          var _prevStore = _this.store;
          _this.updateStore(set$3(_prevStore, namePath, defaultValue2, true));
          _this.notifyObservers(_prevStore, [namePath], {
            type: "remove"
          });
          _this.triggerDependenciesUpdate(_prevStore, namePath);
        }
      }
      _this.notifyWatch([namePath]);
    };
  });
  _defineProperty$3(this, "dispatch", function(action) {
    switch (action.type) {
      case "updateValue": {
        var namePath = action.namePath, value2 = action.value;
        _this.updateValue(namePath, value2);
        break;
      }
      case "validateField": {
        var _namePath = action.namePath, triggerName = action.triggerName;
        _this.validateFields([_namePath], {
          triggerName
        });
        break;
      }
    }
  });
  _defineProperty$3(this, "notifyObservers", function(prevStore, namePathList, info2) {
    if (_this.subscribable) {
      var mergedInfo = _objectSpread2(_objectSpread2({}, info2), {}, {
        store: _this.getFieldsValue(true)
      });
      _this.getFieldEntities().forEach(function(_ref5) {
        var onStoreChange = _ref5.onStoreChange;
        onStoreChange(prevStore, namePathList, mergedInfo);
      });
    } else {
      _this.forceRootUpdate();
    }
  });
  _defineProperty$3(this, "triggerDependenciesUpdate", function(prevStore, namePath) {
    var childrenFields = _this.getDependencyChildrenFields(namePath);
    if (childrenFields.length) {
      _this.validateFields(childrenFields);
    }
    _this.notifyObservers(prevStore, childrenFields, {
      type: "dependenciesUpdate",
      relatedFields: [namePath].concat(_toConsumableArray(childrenFields))
    });
    return childrenFields;
  });
  _defineProperty$3(this, "updateValue", function(name2, value2) {
    var namePath = getNamePath(name2);
    var prevStore = _this.store;
    _this.updateStore(set$3(_this.store, namePath, value2));
    _this.notifyObservers(prevStore, [namePath], {
      type: "valueUpdate",
      source: "internal"
    });
    _this.notifyWatch([namePath]);
    var childrenFields = _this.triggerDependenciesUpdate(prevStore, namePath);
    var onValuesChange = _this.callbacks.onValuesChange;
    if (onValuesChange) {
      var changedValues = cloneByNamePathList(_this.store, [namePath]);
      onValuesChange(changedValues, _this.getFieldsValue());
    }
    _this.triggerOnFieldsChange([namePath].concat(_toConsumableArray(childrenFields)));
  });
  _defineProperty$3(this, "setFieldsValue", function(store) {
    _this.warningUnhooked();
    var prevStore = _this.store;
    if (store) {
      var nextStore = merge$5(_this.store, store);
      _this.updateStore(nextStore);
    }
    _this.notifyObservers(prevStore, null, {
      type: "valueUpdate",
      source: "external"
    });
    _this.notifyWatch();
  });
  _defineProperty$3(this, "setFieldValue", function(name2, value2) {
    _this.setFields([{
      name: name2,
      value: value2,
      errors: [],
      warnings: []
    }]);
  });
  _defineProperty$3(this, "getDependencyChildrenFields", function(rootNamePath) {
    var children = /* @__PURE__ */ new Set();
    var childrenFields = [];
    var dependencies2fields = new NameMap();
    _this.getFieldEntities().forEach(function(field) {
      var dependencies = field.props.dependencies;
      (dependencies || []).forEach(function(dependency) {
        var dependencyNamePath = getNamePath(dependency);
        dependencies2fields.update(dependencyNamePath, function() {
          var fields = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : /* @__PURE__ */ new Set();
          fields.add(field);
          return fields;
        });
      });
    });
    var fillChildren = function fillChildren2(namePath) {
      var fields = dependencies2fields.get(namePath) || /* @__PURE__ */ new Set();
      fields.forEach(function(field) {
        if (!children.has(field)) {
          children.add(field);
          var fieldNamePath = field.getNamePath();
          if (field.isFieldDirty() && fieldNamePath.length) {
            childrenFields.push(fieldNamePath);
            fillChildren2(fieldNamePath);
          }
        }
      });
    };
    fillChildren(rootNamePath);
    return childrenFields;
  });
  _defineProperty$3(this, "triggerOnFieldsChange", function(namePathList, filedErrors) {
    var onFieldsChange = _this.callbacks.onFieldsChange;
    if (onFieldsChange) {
      var fields = _this.getFields();
      if (filedErrors) {
        var cache2 = new NameMap();
        filedErrors.forEach(function(_ref6) {
          var name2 = _ref6.name, errors = _ref6.errors;
          cache2.set(name2, errors);
        });
        fields.forEach(function(field) {
          field.errors = cache2.get(field.name) || field.errors;
        });
      }
      var changedFields = fields.filter(function(_ref7) {
        var fieldName = _ref7.name;
        return containsNamePath(namePathList, fieldName);
      });
      if (changedFields.length) {
        onFieldsChange(changedFields, fields);
      }
    }
  });
  _defineProperty$3(this, "validateFields", function(arg1, arg2) {
    _this.warningUnhooked();
    var nameList;
    var options;
    if (Array.isArray(arg1) || typeof arg1 === "string" || typeof arg2 === "string") {
      nameList = arg1;
      options = arg2;
    } else {
      options = arg1;
    }
    var provideNameList = !!nameList;
    var namePathList = provideNameList ? nameList.map(getNamePath) : [];
    var promiseList = [];
    var TMP_SPLIT = String(Date.now());
    var validateNamePathList = /* @__PURE__ */ new Set();
    var _ref8 = options || {}, recursive = _ref8.recursive, dirty = _ref8.dirty;
    _this.getFieldEntities(true).forEach(function(field) {
      if (!provideNameList) {
        namePathList.push(field.getNamePath());
      }
      if (!field.props.rules || !field.props.rules.length) {
        return;
      }
      if (dirty && !field.isFieldDirty()) {
        return;
      }
      var fieldNamePath = field.getNamePath();
      validateNamePathList.add(fieldNamePath.join(TMP_SPLIT));
      if (!provideNameList || containsNamePath(namePathList, fieldNamePath, recursive)) {
        var promise = field.validateRules(_objectSpread2({
          validateMessages: _objectSpread2(_objectSpread2({}, defaultValidateMessages), _this.validateMessages)
        }, options));
        promiseList.push(promise.then(function() {
          return {
            name: fieldNamePath,
            errors: [],
            warnings: []
          };
        }).catch(function(ruleErrors) {
          var _ruleErrors$forEach;
          var mergedErrors = [];
          var mergedWarnings = [];
          (_ruleErrors$forEach = ruleErrors.forEach) === null || _ruleErrors$forEach === void 0 || _ruleErrors$forEach.call(ruleErrors, function(_ref9) {
            var warningOnly = _ref9.rule.warningOnly, errors = _ref9.errors;
            if (warningOnly) {
              mergedWarnings.push.apply(mergedWarnings, _toConsumableArray(errors));
            } else {
              mergedErrors.push.apply(mergedErrors, _toConsumableArray(errors));
            }
          });
          if (mergedErrors.length) {
            return Promise.reject({
              name: fieldNamePath,
              errors: mergedErrors,
              warnings: mergedWarnings
            });
          }
          return {
            name: fieldNamePath,
            errors: mergedErrors,
            warnings: mergedWarnings
          };
        }));
      }
    });
    var summaryPromise = allPromiseFinish(promiseList);
    _this.lastValidatePromise = summaryPromise;
    summaryPromise.catch(function(results) {
      return results;
    }).then(function(results) {
      var resultNamePathList = results.map(function(_ref10) {
        var name2 = _ref10.name;
        return name2;
      });
      _this.notifyObservers(_this.store, resultNamePathList, {
        type: "validateFinish"
      });
      _this.triggerOnFieldsChange(resultNamePathList, results);
    });
    var returnPromise = summaryPromise.then(function() {
      if (_this.lastValidatePromise === summaryPromise) {
        return Promise.resolve(_this.getFieldsValue(namePathList));
      }
      return Promise.reject([]);
    }).catch(function(results) {
      var errorList = results.filter(function(result) {
        return result && result.errors.length;
      });
      return Promise.reject({
        values: _this.getFieldsValue(namePathList),
        errorFields: errorList,
        outOfDate: _this.lastValidatePromise !== summaryPromise
      });
    });
    returnPromise.catch(function(e2) {
      return e2;
    });
    var triggerNamePathList = namePathList.filter(function(namePath) {
      return validateNamePathList.has(namePath.join(TMP_SPLIT));
    });
    _this.triggerOnFieldsChange(triggerNamePathList);
    return returnPromise;
  });
  _defineProperty$3(this, "submit", function() {
    _this.warningUnhooked();
    _this.validateFields().then(function(values) {
      var onFinish = _this.callbacks.onFinish;
      if (onFinish) {
        try {
          onFinish(values);
        } catch (err) {
          console.error(err);
        }
      }
    }).catch(function(e2) {
      var onFinishFailed = _this.callbacks.onFinishFailed;
      if (onFinishFailed) {
        onFinishFailed(e2);
      }
    });
  });
  this.forceRootUpdate = forceRootUpdate;
});
function useForm(form2) {
  var formRef = reactExports.useRef();
  var _React$useState = reactExports.useState({}), _React$useState2 = _slicedToArray(_React$useState, 2), forceUpdate = _React$useState2[1];
  if (!formRef.current) {
    if (form2) {
      formRef.current = form2;
    } else {
      var forceReRender = function forceReRender2() {
        forceUpdate({});
      };
      var formStore = new FormStore(forceReRender);
      formRef.current = formStore.getForm();
    }
  }
  return [formRef.current];
}
var FormContext = /* @__PURE__ */ reactExports.createContext({
  triggerFormChange: function triggerFormChange() {
  },
  triggerFormFinish: function triggerFormFinish() {
  },
  registerForm: function registerForm() {
  },
  unregisterForm: function unregisterForm() {
  }
});
var FormProvider = function FormProvider2(_ref) {
  var validateMessages = _ref.validateMessages, onFormChange = _ref.onFormChange, onFormFinish = _ref.onFormFinish, children = _ref.children;
  var formContext = reactExports.useContext(FormContext);
  var formsRef = reactExports.useRef({});
  return /* @__PURE__ */ reactExports.createElement(FormContext.Provider, {
    value: _objectSpread2(_objectSpread2({}, formContext), {}, {
      validateMessages: _objectSpread2(_objectSpread2({}, formContext.validateMessages), validateMessages),
      // =========================================================
      // =                  Global Form Control                  =
      // =========================================================
      triggerFormChange: function triggerFormChange2(name2, changedFields) {
        if (onFormChange) {
          onFormChange(name2, {
            changedFields,
            forms: formsRef.current
          });
        }
        formContext.triggerFormChange(name2, changedFields);
      },
      triggerFormFinish: function triggerFormFinish2(name2, values) {
        if (onFormFinish) {
          onFormFinish(name2, {
            values,
            forms: formsRef.current
          });
        }
        formContext.triggerFormFinish(name2, values);
      },
      registerForm: function registerForm2(name2, form2) {
        if (name2) {
          formsRef.current = _objectSpread2(_objectSpread2({}, formsRef.current), {}, _defineProperty$3({}, name2, form2));
        }
        formContext.registerForm(name2, form2);
      },
      unregisterForm: function unregisterForm2(name2) {
        var newForms = _objectSpread2({}, formsRef.current);
        delete newForms[name2];
        formsRef.current = newForms;
        formContext.unregisterForm(name2);
      }
    })
  }, children);
};
var _excluded$s = ["name", "initialValues", "fields", "form", "preserve", "children", "component", "validateMessages", "validateTrigger", "onValuesChange", "onFieldsChange", "onFinish", "onFinishFailed", "clearOnDestroy"];
var Form = function Form3(_ref, ref) {
  var name2 = _ref.name, initialValues = _ref.initialValues, fields = _ref.fields, form2 = _ref.form, preserve2 = _ref.preserve, children = _ref.children, _ref$component = _ref.component, Component2 = _ref$component === void 0 ? "form" : _ref$component, validateMessages = _ref.validateMessages, _ref$validateTrigger = _ref.validateTrigger, validateTrigger = _ref$validateTrigger === void 0 ? "onChange" : _ref$validateTrigger, onValuesChange = _ref.onValuesChange, _onFieldsChange = _ref.onFieldsChange, _onFinish = _ref.onFinish, onFinishFailed = _ref.onFinishFailed, clearOnDestroy = _ref.clearOnDestroy, restProps = _objectWithoutProperties$3(_ref, _excluded$s);
  var nativeElementRef = reactExports.useRef(null);
  var formContext = reactExports.useContext(FormContext);
  var _useForm = useForm(form2), _useForm2 = _slicedToArray(_useForm, 1), formInstance = _useForm2[0];
  var _getInternalHooks = formInstance.getInternalHooks(HOOK_MARK), useSubscribe = _getInternalHooks.useSubscribe, setInitialValues = _getInternalHooks.setInitialValues, setCallbacks = _getInternalHooks.setCallbacks, setValidateMessages = _getInternalHooks.setValidateMessages, setPreserve = _getInternalHooks.setPreserve, destroyForm = _getInternalHooks.destroyForm;
  reactExports.useImperativeHandle(ref, function() {
    return _objectSpread2(_objectSpread2({}, formInstance), {}, {
      nativeElement: nativeElementRef.current
    });
  });
  reactExports.useEffect(function() {
    formContext.registerForm(name2, formInstance);
    return function() {
      formContext.unregisterForm(name2);
    };
  }, [formContext, formInstance, name2]);
  setValidateMessages(_objectSpread2(_objectSpread2({}, formContext.validateMessages), validateMessages));
  setCallbacks({
    onValuesChange,
    onFieldsChange: function onFieldsChange(changedFields) {
      formContext.triggerFormChange(name2, changedFields);
      if (_onFieldsChange) {
        for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
          rest[_key - 1] = arguments[_key];
        }
        _onFieldsChange.apply(void 0, [changedFields].concat(rest));
      }
    },
    onFinish: function onFinish(values) {
      formContext.triggerFormFinish(name2, values);
      if (_onFinish) {
        _onFinish(values);
      }
    },
    onFinishFailed
  });
  setPreserve(preserve2);
  var mountRef = reactExports.useRef(null);
  setInitialValues(initialValues, !mountRef.current);
  if (!mountRef.current) {
    mountRef.current = true;
  }
  reactExports.useEffect(
    function() {
      return function() {
        return destroyForm(clearOnDestroy);
      };
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    []
  );
  var childrenNode;
  var childrenRenderProps = typeof children === "function";
  if (childrenRenderProps) {
    var _values = formInstance.getFieldsValue(true);
    childrenNode = children(_values, formInstance);
  } else {
    childrenNode = children;
  }
  useSubscribe(!childrenRenderProps);
  var prevFieldsRef = reactExports.useRef();
  reactExports.useEffect(function() {
    if (!isSimilar(prevFieldsRef.current || [], fields || [])) {
      formInstance.setFields(fields || []);
    }
    prevFieldsRef.current = fields;
  }, [fields, formInstance]);
  var formContextValue = reactExports.useMemo(function() {
    return _objectSpread2(_objectSpread2({}, formInstance), {}, {
      validateTrigger
    });
  }, [formInstance, validateTrigger]);
  var wrapperNode = /* @__PURE__ */ reactExports.createElement(ListContext.Provider, {
    value: null
  }, /* @__PURE__ */ reactExports.createElement(Context$1.Provider, {
    value: formContextValue
  }, childrenNode));
  if (Component2 === false) {
    return wrapperNode;
  }
  return /* @__PURE__ */ reactExports.createElement(Component2, _extends$h({}, restProps, {
    ref: nativeElementRef,
    onSubmit: function onSubmit(event) {
      event.preventDefault();
      event.stopPropagation();
      formInstance.submit();
    },
    onReset: function onReset(event) {
      var _restProps$onReset;
      event.preventDefault();
      formInstance.resetFields();
      (_restProps$onReset = restProps.onReset) === null || _restProps$onReset === void 0 || _restProps$onReset.call(restProps, event);
    }
  }), wrapperNode);
};
function stringify$2(value2) {
  try {
    return JSON.stringify(value2);
  } catch (err) {
    return Math.random();
  }
}
function useWatch$1() {
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
    args[_key] = arguments[_key];
  }
  var dependencies = args[0], _args$ = args[1], _form = _args$ === void 0 ? {} : _args$;
  var options = isFormInstance(_form) ? {
    form: _form
  } : _form;
  var form2 = options.form;
  var _useState = reactExports.useState(), _useState2 = _slicedToArray(_useState, 2), value2 = _useState2[0], setValue = _useState2[1];
  var valueStr = reactExports.useMemo(function() {
    return stringify$2(value2);
  }, [value2]);
  var valueStrRef = reactExports.useRef(valueStr);
  valueStrRef.current = valueStr;
  var fieldContext = reactExports.useContext(Context$1);
  var formInstance = form2 || fieldContext;
  var isValidForm = formInstance && formInstance._init;
  var namePath = getNamePath(dependencies);
  var namePathRef = reactExports.useRef(namePath);
  namePathRef.current = namePath;
  reactExports.useEffect(
    function() {
      if (!isValidForm) {
        return;
      }
      var getFieldsValue = formInstance.getFieldsValue, getInternalHooks2 = formInstance.getInternalHooks;
      var _getInternalHooks = getInternalHooks2(HOOK_MARK), registerWatch = _getInternalHooks.registerWatch;
      var getWatchValue = function getWatchValue2(values, allValues) {
        var watchValue = options.preserve ? allValues : values;
        return typeof dependencies === "function" ? dependencies(watchValue) : get$a(watchValue, namePathRef.current);
      };
      var cancelRegister = registerWatch(function(values, allValues) {
        var newValue = getWatchValue(values, allValues);
        var nextValueStr = stringify$2(newValue);
        if (valueStrRef.current !== nextValueStr) {
          valueStrRef.current = nextValueStr;
          setValue(newValue);
        }
      });
      var initialValue = getWatchValue(getFieldsValue(), getFieldsValue(true));
      if (value2 !== initialValue) {
        setValue(initialValue);
      }
      return cancelRegister;
    },
    // We do not need re-register since namePath content is the same
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [isValidForm]
  );
  return value2;
}
var InternalForm = /* @__PURE__ */ reactExports.forwardRef(Form);
var RefForm = InternalForm;
RefForm.FormProvider = FormProvider;
RefForm.Field = WrapperField;
RefForm.List = List$3;
RefForm.useForm = useForm;
RefForm.useWatch = useWatch$1;
const FormItemInputContext = /* @__PURE__ */ reactExports.createContext({});
const NoFormStyle = ({
  children,
  status,
  override
}) => {
  const formItemInputContext = reactExports.useContext(FormItemInputContext);
  const newFormItemInputContext = reactExports.useMemo(() => {
    const newContext = Object.assign({}, formItemInputContext);
    if (override) {
      delete newContext.isFormItemInput;
    }
    if (status) {
      delete newContext.status;
      delete newContext.hasFeedback;
      delete newContext.feedbackIcon;
    }
    return newContext;
  }, [status, override, formItemInputContext]);
  return /* @__PURE__ */ reactExports.createElement(FormItemInputContext.Provider, {
    value: newFormItemInputContext
  }, children);
};
const ContextIsolator = (props) => {
  const {
    space: space2,
    form: form2,
    children
  } = props;
  if (children === void 0 || children === null) {
    return null;
  }
  let result = children;
  if (form2) {
    result = /* @__PURE__ */ React$5.createElement(NoFormStyle, {
      override: true,
      status: true
    }, result);
  }
  if (space2) {
    result = /* @__PURE__ */ React$5.createElement(NoCompactStyle, null, result);
  }
  return result;
};
const isMobile = function() {
  if (typeof navigator === "undefined" || typeof window === "undefined") {
    return false;
  }
  var agent = navigator.userAgent || navigator.vendor || window.opera;
  return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(agent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(agent === null || agent === void 0 ? void 0 : agent.substr(0, 4));
};
var _excluded$r = ["prefixCls", "invalidate", "item", "renderItem", "responsive", "responsiveDisabled", "registerSize", "itemKey", "className", "style", "children", "display", "order", "component"];
var UNDEFINED = void 0;
function InternalItem(props, ref) {
  var prefixCls = props.prefixCls, invalidate = props.invalidate, item = props.item, renderItem2 = props.renderItem, responsive = props.responsive, responsiveDisabled = props.responsiveDisabled, registerSize = props.registerSize, itemKey2 = props.itemKey, className = props.className, style2 = props.style, children = props.children, display = props.display, order2 = props.order, _props$component = props.component, Component2 = _props$component === void 0 ? "div" : _props$component, restProps = _objectWithoutProperties$3(props, _excluded$r);
  var mergedHidden = responsive && !display;
  function internalRegisterSize(width) {
    registerSize(itemKey2, width);
  }
  reactExports.useEffect(function() {
    return function() {
      internalRegisterSize(null);
    };
  }, []);
  var childNode = renderItem2 && item !== UNDEFINED ? renderItem2(item, {
    index: order2
  }) : children;
  var overflowStyle;
  if (!invalidate) {
    overflowStyle = {
      opacity: mergedHidden ? 0 : 1,
      height: mergedHidden ? 0 : UNDEFINED,
      overflowY: mergedHidden ? "hidden" : UNDEFINED,
      order: responsive ? order2 : UNDEFINED,
      pointerEvents: mergedHidden ? "none" : UNDEFINED,
      position: mergedHidden ? "absolute" : UNDEFINED
    };
  }
  var overflowProps = {};
  if (mergedHidden) {
    overflowProps["aria-hidden"] = true;
  }
  var itemNode = /* @__PURE__ */ reactExports.createElement(Component2, _extends$h({
    className: classNames(!invalidate && prefixCls, className),
    style: _objectSpread2(_objectSpread2({}, overflowStyle), style2)
  }, overflowProps, restProps, {
    ref
  }), childNode);
  if (responsive) {
    itemNode = /* @__PURE__ */ reactExports.createElement(RefResizeObserver, {
      onResize: function onResize4(_ref) {
        var offsetWidth = _ref.offsetWidth;
        internalRegisterSize(offsetWidth);
      },
      disabled: responsiveDisabled
    }, itemNode);
  }
  return itemNode;
}
var Item$2 = /* @__PURE__ */ reactExports.forwardRef(InternalItem);
Item$2.displayName = "Item";
function channelUpdate(callback2) {
  if (typeof MessageChannel === "undefined") {
    wrapperRaf(callback2);
  } else {
    var channel = new MessageChannel();
    channel.port1.onmessage = function() {
      return callback2();
    };
    channel.port2.postMessage(void 0);
  }
}
function useBatcher() {
  var updateFuncRef = reactExports.useRef(null);
  var notifyEffectUpdate = function notifyEffectUpdate2(callback2) {
    if (!updateFuncRef.current) {
      updateFuncRef.current = [];
      channelUpdate(function() {
        reactDomExports.unstable_batchedUpdates(function() {
          updateFuncRef.current.forEach(function(fn) {
            fn();
          });
          updateFuncRef.current = null;
        });
      });
    }
    updateFuncRef.current.push(callback2);
  };
  return notifyEffectUpdate;
}
function useEffectState(notifyEffectUpdate, defaultValue2) {
  var _React$useState = reactExports.useState(defaultValue2), _React$useState2 = _slicedToArray(_React$useState, 2), stateValue = _React$useState2[0], setStateValue = _React$useState2[1];
  var setEffectVal = useEvent$1(function(nextValue) {
    notifyEffectUpdate(function() {
      setStateValue(nextValue);
    });
  });
  return [stateValue, setEffectVal];
}
var OverflowContext = /* @__PURE__ */ React$5.createContext(null);
var _excluded$q = ["component"], _excluded2$5 = ["className"], _excluded3$2 = ["className"];
var InternalRawItem = function InternalRawItem2(props, ref) {
  var context = reactExports.useContext(OverflowContext);
  if (!context) {
    var _props$component = props.component, Component2 = _props$component === void 0 ? "div" : _props$component, _restProps = _objectWithoutProperties$3(props, _excluded$q);
    return /* @__PURE__ */ reactExports.createElement(Component2, _extends$h({}, _restProps, {
      ref
    }));
  }
  var contextClassName = context.className, restContext = _objectWithoutProperties$3(context, _excluded2$5);
  var className = props.className, restProps = _objectWithoutProperties$3(props, _excluded3$2);
  return /* @__PURE__ */ reactExports.createElement(OverflowContext.Provider, {
    value: null
  }, /* @__PURE__ */ reactExports.createElement(Item$2, _extends$h({
    ref,
    className: classNames(contextClassName, className)
  }, restContext, restProps)));
};
var RawItem = /* @__PURE__ */ reactExports.forwardRef(InternalRawItem);
RawItem.displayName = "RawItem";
var _excluded$p = ["prefixCls", "data", "renderItem", "renderRawItem", "itemKey", "itemWidth", "ssr", "style", "className", "maxCount", "renderRest", "renderRawRest", "suffix", "component", "itemComponent", "onVisibleChange"];
var RESPONSIVE = "responsive";
var INVALIDATE = "invalidate";
function defaultRenderRest(omittedItems) {
  return "+ ".concat(omittedItems.length, " ...");
}
function Overflow(props, ref) {
  var _props$prefixCls = props.prefixCls, prefixCls = _props$prefixCls === void 0 ? "rc-overflow" : _props$prefixCls, _props$data = props.data, data = _props$data === void 0 ? [] : _props$data, renderItem2 = props.renderItem, renderRawItem = props.renderRawItem, itemKey2 = props.itemKey, _props$itemWidth = props.itemWidth, itemWidth = _props$itemWidth === void 0 ? 10 : _props$itemWidth, ssr = props.ssr, style2 = props.style, className = props.className, maxCount = props.maxCount, renderRest = props.renderRest, renderRawRest = props.renderRawRest, suffix = props.suffix, _props$component = props.component, Component2 = _props$component === void 0 ? "div" : _props$component, itemComponent = props.itemComponent, onVisibleChange = props.onVisibleChange, restProps = _objectWithoutProperties$3(props, _excluded$p);
  var fullySSR = ssr === "full";
  var notifyEffectUpdate = useBatcher();
  var _useEffectState = useEffectState(notifyEffectUpdate, null), _useEffectState2 = _slicedToArray(_useEffectState, 2), containerWidth = _useEffectState2[0], setContainerWidth = _useEffectState2[1];
  var mergedContainerWidth = containerWidth || 0;
  var _useEffectState3 = useEffectState(notifyEffectUpdate, /* @__PURE__ */ new Map()), _useEffectState4 = _slicedToArray(_useEffectState3, 2), itemWidths = _useEffectState4[0], setItemWidths = _useEffectState4[1];
  var _useEffectState5 = useEffectState(notifyEffectUpdate, 0), _useEffectState6 = _slicedToArray(_useEffectState5, 2), prevRestWidth = _useEffectState6[0], setPrevRestWidth = _useEffectState6[1];
  var _useEffectState7 = useEffectState(notifyEffectUpdate, 0), _useEffectState8 = _slicedToArray(_useEffectState7, 2), restWidth = _useEffectState8[0], setRestWidth = _useEffectState8[1];
  var _useEffectState9 = useEffectState(notifyEffectUpdate, 0), _useEffectState10 = _slicedToArray(_useEffectState9, 2), suffixWidth = _useEffectState10[0], setSuffixWidth = _useEffectState10[1];
  var _useState = reactExports.useState(null), _useState2 = _slicedToArray(_useState, 2), suffixFixedStart = _useState2[0], setSuffixFixedStart = _useState2[1];
  var _useState3 = reactExports.useState(null), _useState4 = _slicedToArray(_useState3, 2), displayCount = _useState4[0], setDisplayCount = _useState4[1];
  var mergedDisplayCount = reactExports.useMemo(function() {
    if (displayCount === null && fullySSR) {
      return Number.MAX_SAFE_INTEGER;
    }
    return displayCount || 0;
  }, [displayCount, containerWidth]);
  var _useState5 = reactExports.useState(false), _useState6 = _slicedToArray(_useState5, 2), restReady = _useState6[0], setRestReady = _useState6[1];
  var itemPrefixCls = "".concat(prefixCls, "-item");
  var mergedRestWidth = Math.max(prevRestWidth, restWidth);
  var isResponsive = maxCount === RESPONSIVE;
  var shouldResponsive = data.length && isResponsive;
  var invalidate = maxCount === INVALIDATE;
  var showRest = shouldResponsive || typeof maxCount === "number" && data.length > maxCount;
  var mergedData = reactExports.useMemo(function() {
    var items = data;
    if (shouldResponsive) {
      if (containerWidth === null && fullySSR) {
        items = data;
      } else {
        items = data.slice(0, Math.min(data.length, mergedContainerWidth / itemWidth));
      }
    } else if (typeof maxCount === "number") {
      items = data.slice(0, maxCount);
    }
    return items;
  }, [data, itemWidth, containerWidth, maxCount, shouldResponsive]);
  var omittedItems = reactExports.useMemo(function() {
    if (shouldResponsive) {
      return data.slice(mergedDisplayCount + 1);
    }
    return data.slice(mergedData.length);
  }, [data, mergedData, shouldResponsive, mergedDisplayCount]);
  var getKey3 = reactExports.useCallback(function(item, index2) {
    var _ref;
    if (typeof itemKey2 === "function") {
      return itemKey2(item);
    }
    return (_ref = itemKey2 && (item === null || item === void 0 ? void 0 : item[itemKey2])) !== null && _ref !== void 0 ? _ref : index2;
  }, [itemKey2]);
  var mergedRenderItem = reactExports.useCallback(renderItem2 || function(item) {
    return item;
  }, [renderItem2]);
  function updateDisplayCount(count, suffixFixedStartVal, notReady) {
    if (displayCount === count && (suffixFixedStartVal === void 0 || suffixFixedStartVal === suffixFixedStart)) {
      return;
    }
    setDisplayCount(count);
    if (!notReady) {
      setRestReady(count < data.length - 1);
      onVisibleChange === null || onVisibleChange === void 0 || onVisibleChange(count);
    }
    if (suffixFixedStartVal !== void 0) {
      setSuffixFixedStart(suffixFixedStartVal);
    }
  }
  function onOverflowResize(_24, element2) {
    setContainerWidth(element2.clientWidth);
  }
  function registerSize(key, width) {
    setItemWidths(function(origin2) {
      var clone3 = new Map(origin2);
      if (width === null) {
        clone3.delete(key);
      } else {
        clone3.set(key, width);
      }
      return clone3;
    });
  }
  function registerOverflowSize(_24, width) {
    setRestWidth(width);
    setPrevRestWidth(restWidth);
  }
  function registerSuffixSize(_24, width) {
    setSuffixWidth(width);
  }
  function getItemWidth(index2) {
    return itemWidths.get(getKey3(mergedData[index2], index2));
  }
  useLayoutEffect(function() {
    if (mergedContainerWidth && typeof mergedRestWidth === "number" && mergedData) {
      var totalWidth = suffixWidth;
      var len = mergedData.length;
      var lastIndex = len - 1;
      if (!len) {
        updateDisplayCount(0, null);
        return;
      }
      for (var i2 = 0; i2 < len; i2 += 1) {
        var currentItemWidth = getItemWidth(i2);
        if (fullySSR) {
          currentItemWidth = currentItemWidth || 0;
        }
        if (currentItemWidth === void 0) {
          updateDisplayCount(i2 - 1, void 0, true);
          break;
        }
        totalWidth += currentItemWidth;
        if (
          // Only one means `totalWidth` is the final width
          lastIndex === 0 && totalWidth <= mergedContainerWidth || // Last two width will be the final width
          i2 === lastIndex - 1 && totalWidth + getItemWidth(lastIndex) <= mergedContainerWidth
        ) {
          updateDisplayCount(lastIndex, null);
          break;
        } else if (totalWidth + mergedRestWidth > mergedContainerWidth) {
          updateDisplayCount(i2 - 1, totalWidth - currentItemWidth - suffixWidth + restWidth);
          break;
        }
      }
      if (suffix && getItemWidth(0) + suffixWidth > mergedContainerWidth) {
        setSuffixFixedStart(null);
      }
    }
  }, [mergedContainerWidth, itemWidths, restWidth, suffixWidth, getKey3, mergedData]);
  var displayRest = restReady && !!omittedItems.length;
  var suffixStyle = {};
  if (suffixFixedStart !== null && shouldResponsive) {
    suffixStyle = {
      position: "absolute",
      left: suffixFixedStart,
      top: 0
    };
  }
  var itemSharedProps = {
    prefixCls: itemPrefixCls,
    responsive: shouldResponsive,
    component: itemComponent,
    invalidate
  };
  var internalRenderItemNode = renderRawItem ? function(item, index2) {
    var key = getKey3(item, index2);
    return /* @__PURE__ */ reactExports.createElement(OverflowContext.Provider, {
      key,
      value: _objectSpread2(_objectSpread2({}, itemSharedProps), {}, {
        order: index2,
        item,
        itemKey: key,
        registerSize,
        display: index2 <= mergedDisplayCount
      })
    }, renderRawItem(item, index2));
  } : function(item, index2) {
    var key = getKey3(item, index2);
    return /* @__PURE__ */ reactExports.createElement(Item$2, _extends$h({}, itemSharedProps, {
      order: index2,
      key,
      item,
      renderItem: mergedRenderItem,
      itemKey: key,
      registerSize,
      display: index2 <= mergedDisplayCount
    }));
  };
  var restContextProps = {
    order: displayRest ? mergedDisplayCount : Number.MAX_SAFE_INTEGER,
    className: "".concat(itemPrefixCls, "-rest"),
    registerSize: registerOverflowSize,
    display: displayRest
  };
  var mergedRenderRest = renderRest || defaultRenderRest;
  var restNode = renderRawRest ? /* @__PURE__ */ reactExports.createElement(OverflowContext.Provider, {
    value: _objectSpread2(_objectSpread2({}, itemSharedProps), restContextProps)
  }, renderRawRest(omittedItems)) : /* @__PURE__ */ reactExports.createElement(Item$2, _extends$h({}, itemSharedProps, restContextProps), typeof mergedRenderRest === "function" ? mergedRenderRest(omittedItems) : mergedRenderRest);
  var overflowNode = /* @__PURE__ */ reactExports.createElement(Component2, _extends$h({
    className: classNames(!invalidate && prefixCls, className),
    style: style2,
    ref
  }, restProps), mergedData.map(internalRenderItemNode), showRest ? restNode : null, suffix && /* @__PURE__ */ reactExports.createElement(Item$2, _extends$h({}, itemSharedProps, {
    responsive: isResponsive,
    responsiveDisabled: !shouldResponsive,
    order: mergedDisplayCount,
    className: "".concat(itemPrefixCls, "-suffix"),
    registerSize: registerSuffixSize,
    display: true,
    style: suffixStyle
  }), suffix));
  return isResponsive ? /* @__PURE__ */ reactExports.createElement(RefResizeObserver, {
    onResize: onOverflowResize,
    disabled: !shouldResponsive
  }, overflowNode) : overflowNode;
}
var ForwardOverflow = /* @__PURE__ */ reactExports.forwardRef(Overflow);
ForwardOverflow.displayName = "Overflow";
ForwardOverflow.Item = RawItem;
ForwardOverflow.RESPONSIVE = RESPONSIVE;
ForwardOverflow.INVALIDATE = INVALIDATE;
function Arrow(props) {
  var prefixCls = props.prefixCls, align = props.align, arrow = props.arrow, arrowPos = props.arrowPos;
  var _ref = arrow || {}, className = _ref.className, content2 = _ref.content;
  var _arrowPos$x = arrowPos.x, x2 = _arrowPos$x === void 0 ? 0 : _arrowPos$x, _arrowPos$y = arrowPos.y, y2 = _arrowPos$y === void 0 ? 0 : _arrowPos$y;
  var arrowRef = reactExports.useRef();
  if (!align || !align.points) {
    return null;
  }
  var alignStyle = {
    position: "absolute"
  };
  if (align.autoArrow !== false) {
    var popupPoints = align.points[0];
    var targetPoints = align.points[1];
    var popupTB = popupPoints[0];
    var popupLR = popupPoints[1];
    var targetTB = targetPoints[0];
    var targetLR = targetPoints[1];
    if (popupTB === targetTB || !["t", "b"].includes(popupTB)) {
      alignStyle.top = y2;
    } else if (popupTB === "t") {
      alignStyle.top = 0;
    } else {
      alignStyle.bottom = 0;
    }
    if (popupLR === targetLR || !["l", "r"].includes(popupLR)) {
      alignStyle.left = x2;
    } else if (popupLR === "l") {
      alignStyle.left = 0;
    } else {
      alignStyle.right = 0;
    }
  }
  return /* @__PURE__ */ reactExports.createElement("div", {
    ref: arrowRef,
    className: classNames("".concat(prefixCls, "-arrow"), className),
    style: alignStyle
  }, content2);
}
function Mask$1(props) {
  var prefixCls = props.prefixCls, open = props.open, zIndex = props.zIndex, mask = props.mask, motion = props.motion;
  if (!mask) {
    return null;
  }
  return /* @__PURE__ */ reactExports.createElement(CSSMotion, _extends$h({}, motion, {
    motionAppear: true,
    visible: open,
    removeOnLeave: true
  }), function(_ref) {
    var className = _ref.className;
    return /* @__PURE__ */ reactExports.createElement("div", {
      style: {
        zIndex
      },
      className: classNames("".concat(prefixCls, "-mask"), className)
    });
  });
}
var PopupContent = /* @__PURE__ */ reactExports.memo(function(_ref) {
  var children = _ref.children;
  return children;
}, function(_24, next2) {
  return next2.cache;
});
var Popup$1 = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var popup = props.popup, className = props.className, prefixCls = props.prefixCls, style2 = props.style, target = props.target, _onVisibleChanged = props.onVisibleChanged, open = props.open, keepDom = props.keepDom, fresh = props.fresh, onClick = props.onClick, mask = props.mask, arrow = props.arrow, arrowPos = props.arrowPos, align = props.align, motion = props.motion, maskMotion = props.maskMotion, forceRender = props.forceRender, getPopupContainer = props.getPopupContainer, autoDestroy = props.autoDestroy, Portal2 = props.portal, zIndex = props.zIndex, onMouseEnter = props.onMouseEnter, onMouseLeave = props.onMouseLeave, onPointerEnter = props.onPointerEnter, onPointerDownCapture = props.onPointerDownCapture, ready = props.ready, offsetX = props.offsetX, offsetY = props.offsetY, offsetR = props.offsetR, offsetB = props.offsetB, onAlign = props.onAlign, onPrepare = props.onPrepare, stretch = props.stretch, targetWidth = props.targetWidth, targetHeight = props.targetHeight;
  var childNode = typeof popup === "function" ? popup() : popup;
  var isNodeVisible = open || keepDom;
  var getPopupContainerNeedParams = (getPopupContainer === null || getPopupContainer === void 0 ? void 0 : getPopupContainer.length) > 0;
  var _React$useState = reactExports.useState(!getPopupContainer || !getPopupContainerNeedParams), _React$useState2 = _slicedToArray(_React$useState, 2), show = _React$useState2[0], setShow = _React$useState2[1];
  useLayoutEffect(function() {
    if (!show && getPopupContainerNeedParams && target) {
      setShow(true);
    }
  }, [show, getPopupContainerNeedParams, target]);
  if (!show) {
    return null;
  }
  var AUTO = "auto";
  var offsetStyle = {
    left: "-1000vw",
    top: "-1000vh",
    right: AUTO,
    bottom: AUTO
  };
  if (ready || !open) {
    var _experimental;
    var points = align.points;
    var dynamicInset = align.dynamicInset || ((_experimental = align._experimental) === null || _experimental === void 0 ? void 0 : _experimental.dynamicInset);
    var alignRight = dynamicInset && points[0][1] === "r";
    var alignBottom = dynamicInset && points[0][0] === "b";
    if (alignRight) {
      offsetStyle.right = offsetR;
      offsetStyle.left = AUTO;
    } else {
      offsetStyle.left = offsetX;
      offsetStyle.right = AUTO;
    }
    if (alignBottom) {
      offsetStyle.bottom = offsetB;
      offsetStyle.top = AUTO;
    } else {
      offsetStyle.top = offsetY;
      offsetStyle.bottom = AUTO;
    }
  }
  var miscStyle = {};
  if (stretch) {
    if (stretch.includes("height") && targetHeight) {
      miscStyle.height = targetHeight;
    } else if (stretch.includes("minHeight") && targetHeight) {
      miscStyle.minHeight = targetHeight;
    }
    if (stretch.includes("width") && targetWidth) {
      miscStyle.width = targetWidth;
    } else if (stretch.includes("minWidth") && targetWidth) {
      miscStyle.minWidth = targetWidth;
    }
  }
  if (!open) {
    miscStyle.pointerEvents = "none";
  }
  return /* @__PURE__ */ reactExports.createElement(Portal2, {
    open: forceRender || isNodeVisible,
    getContainer: getPopupContainer && function() {
      return getPopupContainer(target);
    },
    autoDestroy
  }, /* @__PURE__ */ reactExports.createElement(Mask$1, {
    prefixCls,
    open,
    zIndex,
    mask,
    motion: maskMotion
  }), /* @__PURE__ */ reactExports.createElement(RefResizeObserver, {
    onResize: onAlign,
    disabled: !open
  }, function(resizeObserverRef) {
    return /* @__PURE__ */ reactExports.createElement(CSSMotion, _extends$h({
      motionAppear: true,
      motionEnter: true,
      motionLeave: true,
      removeOnLeave: false,
      forceRender,
      leavedClassName: "".concat(prefixCls, "-hidden")
    }, motion, {
      onAppearPrepare: onPrepare,
      onEnterPrepare: onPrepare,
      visible: open,
      onVisibleChanged: function onVisibleChanged(nextVisible) {
        var _motion$onVisibleChan;
        motion === null || motion === void 0 || (_motion$onVisibleChan = motion.onVisibleChanged) === null || _motion$onVisibleChan === void 0 || _motion$onVisibleChan.call(motion, nextVisible);
        _onVisibleChanged(nextVisible);
      }
    }), function(_ref, motionRef) {
      var motionClassName = _ref.className, motionStyle = _ref.style;
      var cls = classNames(prefixCls, motionClassName, className);
      return /* @__PURE__ */ reactExports.createElement("div", {
        ref: composeRef(resizeObserverRef, ref, motionRef),
        className: cls,
        style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
          "--arrow-x": "".concat(arrowPos.x || 0, "px"),
          "--arrow-y": "".concat(arrowPos.y || 0, "px")
        }, offsetStyle), miscStyle), motionStyle), {}, {
          boxSizing: "border-box",
          zIndex
        }, style2),
        onMouseEnter,
        onMouseLeave,
        onPointerEnter,
        onClick,
        onPointerDownCapture
      }, arrow && /* @__PURE__ */ reactExports.createElement(Arrow, {
        prefixCls,
        arrow,
        arrowPos,
        align
      }), /* @__PURE__ */ reactExports.createElement(PopupContent, {
        cache: !open && !fresh
      }, childNode));
    });
  }));
});
var TriggerWrapper = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var children = props.children, getTriggerDOMNode = props.getTriggerDOMNode;
  var canUseRef = supportRef(children);
  var setRef2 = reactExports.useCallback(function(node2) {
    fillRef(ref, getTriggerDOMNode ? getTriggerDOMNode(node2) : node2);
  }, [getTriggerDOMNode]);
  var mergedRef = useComposeRef(setRef2, getNodeRef(children));
  return canUseRef ? /* @__PURE__ */ reactExports.cloneElement(children, {
    ref: mergedRef
  }) : children;
});
var TriggerContext = /* @__PURE__ */ reactExports.createContext(null);
function toArray$2(val) {
  return val ? Array.isArray(val) ? val : [val] : [];
}
function useAction(mobile, action, showAction, hideAction) {
  return reactExports.useMemo(function() {
    var mergedShowAction = toArray$2(showAction !== null && showAction !== void 0 ? showAction : action);
    var mergedHideAction = toArray$2(hideAction !== null && hideAction !== void 0 ? hideAction : action);
    var showActionSet = new Set(mergedShowAction);
    var hideActionSet = new Set(mergedHideAction);
    if (mobile) {
      if (showActionSet.has("hover")) {
        showActionSet.delete("hover");
        showActionSet.add("click");
      }
      if (hideActionSet.has("hover")) {
        hideActionSet.delete("hover");
        hideActionSet.add("click");
      }
    }
    return [showActionSet, hideActionSet];
  }, [mobile, action, showAction, hideAction]);
}
function isPointsEq() {
  var a1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
  var a2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
  var isAlignPoint = arguments.length > 2 ? arguments[2] : void 0;
  if (isAlignPoint) {
    return a1[0] === a2[0];
  }
  return a1[0] === a2[0] && a1[1] === a2[1];
}
function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) {
  var points = align.points;
  var placements2 = Object.keys(builtinPlacements);
  for (var i2 = 0; i2 < placements2.length; i2 += 1) {
    var _builtinPlacements$pl;
    var placement = placements2[i2];
    if (isPointsEq((_builtinPlacements$pl = builtinPlacements[placement]) === null || _builtinPlacements$pl === void 0 ? void 0 : _builtinPlacements$pl.points, points, isAlignPoint)) {
      return "".concat(prefixCls, "-placement-").concat(placement);
    }
  }
  return "";
}
function getMotion$1(prefixCls, motion, animation, transitionName) {
  if (motion) {
    return motion;
  }
  if (animation) {
    return {
      motionName: "".concat(prefixCls, "-").concat(animation)
    };
  }
  if (transitionName) {
    return {
      motionName: transitionName
    };
  }
  return null;
}
function getWin(ele) {
  return ele.ownerDocument.defaultView;
}
function collectScroller(ele) {
  var scrollerList = [];
  var current = ele === null || ele === void 0 ? void 0 : ele.parentElement;
  var scrollStyle = ["hidden", "scroll", "clip", "auto"];
  while (current) {
    var _getWin$getComputedSt = getWin(current).getComputedStyle(current), overflowX = _getWin$getComputedSt.overflowX, overflowY = _getWin$getComputedSt.overflowY, overflow = _getWin$getComputedSt.overflow;
    if ([overflowX, overflowY, overflow].some(function(o2) {
      return scrollStyle.includes(o2);
    })) {
      scrollerList.push(current);
    }
    current = current.parentElement;
  }
  return scrollerList;
}
function toNum(num) {
  var defaultValue2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
  return Number.isNaN(num) ? defaultValue2 : num;
}
function getPxValue(val) {
  return toNum(parseFloat(val), 0);
}
function getVisibleArea(initArea, scrollerList) {
  var visibleArea = _objectSpread2({}, initArea);
  (scrollerList || []).forEach(function(ele) {
    if (ele instanceof HTMLBodyElement || ele instanceof HTMLHtmlElement) {
      return;
    }
    var _getWin$getComputedSt2 = getWin(ele).getComputedStyle(ele), overflow = _getWin$getComputedSt2.overflow, overflowClipMargin = _getWin$getComputedSt2.overflowClipMargin, borderTopWidth = _getWin$getComputedSt2.borderTopWidth, borderBottomWidth = _getWin$getComputedSt2.borderBottomWidth, borderLeftWidth = _getWin$getComputedSt2.borderLeftWidth, borderRightWidth = _getWin$getComputedSt2.borderRightWidth;
    var eleRect = ele.getBoundingClientRect();
    var eleOutHeight = ele.offsetHeight, eleInnerHeight = ele.clientHeight, eleOutWidth = ele.offsetWidth, eleInnerWidth = ele.clientWidth;
    var borderTopNum = getPxValue(borderTopWidth);
    var borderBottomNum = getPxValue(borderBottomWidth);
    var borderLeftNum = getPxValue(borderLeftWidth);
    var borderRightNum = getPxValue(borderRightWidth);
    var scaleX = toNum(Math.round(eleRect.width / eleOutWidth * 1e3) / 1e3);
    var scaleY = toNum(Math.round(eleRect.height / eleOutHeight * 1e3) / 1e3);
    var eleScrollWidth = (eleOutWidth - eleInnerWidth - borderLeftNum - borderRightNum) * scaleX;
    var eleScrollHeight = (eleOutHeight - eleInnerHeight - borderTopNum - borderBottomNum) * scaleY;
    var scaledBorderTopWidth = borderTopNum * scaleY;
    var scaledBorderBottomWidth = borderBottomNum * scaleY;
    var scaledBorderLeftWidth = borderLeftNum * scaleX;
    var scaledBorderRightWidth = borderRightNum * scaleX;
    var clipMarginWidth = 0;
    var clipMarginHeight = 0;
    if (overflow === "clip") {
      var clipNum = getPxValue(overflowClipMargin);
      clipMarginWidth = clipNum * scaleX;
      clipMarginHeight = clipNum * scaleY;
    }
    var eleLeft = eleRect.x + scaledBorderLeftWidth - clipMarginWidth;
    var eleTop = eleRect.y + scaledBorderTopWidth - clipMarginHeight;
    var eleRight = eleLeft + eleRect.width + 2 * clipMarginWidth - scaledBorderLeftWidth - scaledBorderRightWidth - eleScrollWidth;
    var eleBottom = eleTop + eleRect.height + 2 * clipMarginHeight - scaledBorderTopWidth - scaledBorderBottomWidth - eleScrollHeight;
    visibleArea.left = Math.max(visibleArea.left, eleLeft);
    visibleArea.top = Math.max(visibleArea.top, eleTop);
    visibleArea.right = Math.min(visibleArea.right, eleRight);
    visibleArea.bottom = Math.min(visibleArea.bottom, eleBottom);
  });
  return visibleArea;
}
function getUnitOffset(size2) {
  var offset2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
  var offsetStr = "".concat(offset2);
  var cells = offsetStr.match(/^(.*)\%$/);
  if (cells) {
    return size2 * (parseFloat(cells[1]) / 100);
  }
  return parseFloat(offsetStr);
}
function getNumberOffset(rect, offset2) {
  var _ref = offset2 || [], _ref2 = _slicedToArray(_ref, 2), offsetX = _ref2[0], offsetY = _ref2[1];
  return [getUnitOffset(rect.width, offsetX), getUnitOffset(rect.height, offsetY)];
}
function splitPoints() {
  var points = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
  return [points[0], points[1]];
}
function getAlignPoint(rect, points) {
  var topBottom = points[0];
  var leftRight = points[1];
  var x2;
  var y2;
  if (topBottom === "t") {
    y2 = rect.y;
  } else if (topBottom === "b") {
    y2 = rect.y + rect.height;
  } else {
    y2 = rect.y + rect.height / 2;
  }
  if (leftRight === "l") {
    x2 = rect.x;
  } else if (leftRight === "r") {
    x2 = rect.x + rect.width;
  } else {
    x2 = rect.x + rect.width / 2;
  }
  return {
    x: x2,
    y: y2
  };
}
function reversePoints(points, index2) {
  var reverseMap = {
    t: "b",
    b: "t",
    l: "r",
    r: "l"
  };
  return points.map(function(point2, i2) {
    if (i2 === index2) {
      return reverseMap[point2] || "c";
    }
    return point2;
  }).join("");
}
function useAlign(open, popupEle, target, placement, builtinPlacements, popupAlign, onPopupAlign) {
  var _React$useState = reactExports.useState({
    ready: false,
    offsetX: 0,
    offsetY: 0,
    offsetR: 0,
    offsetB: 0,
    arrowX: 0,
    arrowY: 0,
    scaleX: 1,
    scaleY: 1,
    align: builtinPlacements[placement] || {}
  }), _React$useState2 = _slicedToArray(_React$useState, 2), offsetInfo = _React$useState2[0], setOffsetInfo = _React$useState2[1];
  var alignCountRef = reactExports.useRef(0);
  var scrollerList = reactExports.useMemo(function() {
    if (!popupEle) {
      return [];
    }
    return collectScroller(popupEle);
  }, [popupEle]);
  var prevFlipRef = reactExports.useRef({});
  var resetFlipCache = function resetFlipCache2() {
    prevFlipRef.current = {};
  };
  if (!open) {
    resetFlipCache();
  }
  var onAlign = useEvent$1(function() {
    if (popupEle && target && open) {
      let getIntersectionVisibleArea = function(offsetX, offsetY) {
        var area = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : visibleArea;
        var l2 = popupRect.x + offsetX;
        var t2 = popupRect.y + offsetY;
        var r2 = l2 + popupWidth;
        var b2 = t2 + popupHeight;
        var visibleL = Math.max(l2, area.left);
        var visibleT = Math.max(t2, area.top);
        var visibleR = Math.min(r2, area.right);
        var visibleB = Math.min(b2, area.bottom);
        return Math.max(0, (visibleR - visibleL) * (visibleB - visibleT));
      }, syncNextPopupPosition = function() {
        nextPopupY = popupRect.y + nextOffsetY;
        nextPopupBottom = nextPopupY + popupHeight;
        nextPopupX = popupRect.x + nextOffsetX;
        nextPopupRight = nextPopupX + popupWidth;
      };
      var _popupElement$parentE, _popupRect$x, _popupRect$y, _popupElement$parentE2;
      var popupElement = popupEle;
      var doc = popupElement.ownerDocument;
      var win2 = getWin(popupElement);
      var _win$getComputedStyle = win2.getComputedStyle(popupElement), popupPosition = _win$getComputedStyle.position;
      var originLeft = popupElement.style.left;
      var originTop = popupElement.style.top;
      var originRight = popupElement.style.right;
      var originBottom = popupElement.style.bottom;
      var originOverflow = popupElement.style.overflow;
      var placementInfo = _objectSpread2(_objectSpread2({}, builtinPlacements[placement]), popupAlign);
      var placeholderElement = doc.createElement("div");
      (_popupElement$parentE = popupElement.parentElement) === null || _popupElement$parentE === void 0 || _popupElement$parentE.appendChild(placeholderElement);
      placeholderElement.style.left = "".concat(popupElement.offsetLeft, "px");
      placeholderElement.style.top = "".concat(popupElement.offsetTop, "px");
      placeholderElement.style.position = popupPosition;
      placeholderElement.style.height = "".concat(popupElement.offsetHeight, "px");
      placeholderElement.style.width = "".concat(popupElement.offsetWidth, "px");
      popupElement.style.left = "0";
      popupElement.style.top = "0";
      popupElement.style.right = "auto";
      popupElement.style.bottom = "auto";
      popupElement.style.overflow = "hidden";
      var targetRect;
      if (Array.isArray(target)) {
        targetRect = {
          x: target[0],
          y: target[1],
          width: 0,
          height: 0
        };
      } else {
        var _rect$x, _rect$y;
        var rect = target.getBoundingClientRect();
        rect.x = (_rect$x = rect.x) !== null && _rect$x !== void 0 ? _rect$x : rect.left;
        rect.y = (_rect$y = rect.y) !== null && _rect$y !== void 0 ? _rect$y : rect.top;
        targetRect = {
          x: rect.x,
          y: rect.y,
          width: rect.width,
          height: rect.height
        };
      }
      var popupRect = popupElement.getBoundingClientRect();
      var _win$getComputedStyle2 = win2.getComputedStyle(popupElement), height = _win$getComputedStyle2.height, width = _win$getComputedStyle2.width;
      popupRect.x = (_popupRect$x = popupRect.x) !== null && _popupRect$x !== void 0 ? _popupRect$x : popupRect.left;
      popupRect.y = (_popupRect$y = popupRect.y) !== null && _popupRect$y !== void 0 ? _popupRect$y : popupRect.top;
      var _doc$documentElement = doc.documentElement, clientWidth = _doc$documentElement.clientWidth, clientHeight = _doc$documentElement.clientHeight, scrollWidth = _doc$documentElement.scrollWidth, scrollHeight = _doc$documentElement.scrollHeight, scrollTop = _doc$documentElement.scrollTop, scrollLeft = _doc$documentElement.scrollLeft;
      var popupHeight = popupRect.height;
      var popupWidth = popupRect.width;
      var targetHeight = targetRect.height;
      var targetWidth = targetRect.width;
      var visibleRegion = {
        left: 0,
        top: 0,
        right: clientWidth,
        bottom: clientHeight
      };
      var scrollRegion = {
        left: -scrollLeft,
        top: -scrollTop,
        right: scrollWidth - scrollLeft,
        bottom: scrollHeight - scrollTop
      };
      var htmlRegion = placementInfo.htmlRegion;
      var VISIBLE = "visible";
      var VISIBLE_FIRST = "visibleFirst";
      if (htmlRegion !== "scroll" && htmlRegion !== VISIBLE_FIRST) {
        htmlRegion = VISIBLE;
      }
      var isVisibleFirst = htmlRegion === VISIBLE_FIRST;
      var scrollRegionArea = getVisibleArea(scrollRegion, scrollerList);
      var visibleRegionArea = getVisibleArea(visibleRegion, scrollerList);
      var visibleArea = htmlRegion === VISIBLE ? visibleRegionArea : scrollRegionArea;
      var adjustCheckVisibleArea = isVisibleFirst ? visibleRegionArea : visibleArea;
      popupElement.style.left = "auto";
      popupElement.style.top = "auto";
      popupElement.style.right = "0";
      popupElement.style.bottom = "0";
      var popupMirrorRect = popupElement.getBoundingClientRect();
      popupElement.style.left = originLeft;
      popupElement.style.top = originTop;
      popupElement.style.right = originRight;
      popupElement.style.bottom = originBottom;
      popupElement.style.overflow = originOverflow;
      (_popupElement$parentE2 = popupElement.parentElement) === null || _popupElement$parentE2 === void 0 || _popupElement$parentE2.removeChild(placeholderElement);
      var _scaleX = toNum(Math.round(popupWidth / parseFloat(width) * 1e3) / 1e3);
      var _scaleY = toNum(Math.round(popupHeight / parseFloat(height) * 1e3) / 1e3);
      if (_scaleX === 0 || _scaleY === 0 || isDOM(target) && !isVisible(target)) {
        return;
      }
      var offset2 = placementInfo.offset, targetOffset2 = placementInfo.targetOffset;
      var _getNumberOffset = getNumberOffset(popupRect, offset2), _getNumberOffset2 = _slicedToArray(_getNumberOffset, 2), popupOffsetX = _getNumberOffset2[0], popupOffsetY = _getNumberOffset2[1];
      var _getNumberOffset3 = getNumberOffset(targetRect, targetOffset2), _getNumberOffset4 = _slicedToArray(_getNumberOffset3, 2), targetOffsetX = _getNumberOffset4[0], targetOffsetY = _getNumberOffset4[1];
      targetRect.x -= targetOffsetX;
      targetRect.y -= targetOffsetY;
      var _ref3 = placementInfo.points || [], _ref4 = _slicedToArray(_ref3, 2), popupPoint = _ref4[0], targetPoint = _ref4[1];
      var targetPoints = splitPoints(targetPoint);
      var popupPoints = splitPoints(popupPoint);
      var targetAlignPoint = getAlignPoint(targetRect, targetPoints);
      var popupAlignPoint = getAlignPoint(popupRect, popupPoints);
      var nextAlignInfo = _objectSpread2({}, placementInfo);
      var nextOffsetX = targetAlignPoint.x - popupAlignPoint.x + popupOffsetX;
      var nextOffsetY = targetAlignPoint.y - popupAlignPoint.y + popupOffsetY;
      var originIntersectionVisibleArea = getIntersectionVisibleArea(nextOffsetX, nextOffsetY);
      var originIntersectionRecommendArea = getIntersectionVisibleArea(nextOffsetX, nextOffsetY, visibleRegionArea);
      var targetAlignPointTL = getAlignPoint(targetRect, ["t", "l"]);
      var popupAlignPointTL = getAlignPoint(popupRect, ["t", "l"]);
      var targetAlignPointBR = getAlignPoint(targetRect, ["b", "r"]);
      var popupAlignPointBR = getAlignPoint(popupRect, ["b", "r"]);
      var overflow = placementInfo.overflow || {};
      var adjustX = overflow.adjustX, adjustY = overflow.adjustY, shiftX = overflow.shiftX, shiftY = overflow.shiftY;
      var supportAdjust = function supportAdjust2(val) {
        if (typeof val === "boolean") {
          return val;
        }
        return val >= 0;
      };
      var nextPopupY;
      var nextPopupBottom;
      var nextPopupX;
      var nextPopupRight;
      syncNextPopupPosition();
      var needAdjustY = supportAdjust(adjustY);
      var sameTB = popupPoints[0] === targetPoints[0];
      if (needAdjustY && popupPoints[0] === "t" && (nextPopupBottom > adjustCheckVisibleArea.bottom || prevFlipRef.current.bt)) {
        var tmpNextOffsetY = nextOffsetY;
        if (sameTB) {
          tmpNextOffsetY -= popupHeight - targetHeight;
        } else {
          tmpNextOffsetY = targetAlignPointTL.y - popupAlignPointBR.y - popupOffsetY;
        }
        var newVisibleArea = getIntersectionVisibleArea(nextOffsetX, tmpNextOffsetY);
        var newVisibleRecommendArea = getIntersectionVisibleArea(nextOffsetX, tmpNextOffsetY, visibleRegionArea);
        if (
          // Of course use larger one
          newVisibleArea > originIntersectionVisibleArea || newVisibleArea === originIntersectionVisibleArea && (!isVisibleFirst || // Choose recommend one
          newVisibleRecommendArea >= originIntersectionRecommendArea)
        ) {
          prevFlipRef.current.bt = true;
          nextOffsetY = tmpNextOffsetY;
          popupOffsetY = -popupOffsetY;
          nextAlignInfo.points = [reversePoints(popupPoints, 0), reversePoints(targetPoints, 0)];
        } else {
          prevFlipRef.current.bt = false;
        }
      }
      if (needAdjustY && popupPoints[0] === "b" && (nextPopupY < adjustCheckVisibleArea.top || prevFlipRef.current.tb)) {
        var _tmpNextOffsetY = nextOffsetY;
        if (sameTB) {
          _tmpNextOffsetY += popupHeight - targetHeight;
        } else {
          _tmpNextOffsetY = targetAlignPointBR.y - popupAlignPointTL.y - popupOffsetY;
        }
        var _newVisibleArea = getIntersectionVisibleArea(nextOffsetX, _tmpNextOffsetY);
        var _newVisibleRecommendArea = getIntersectionVisibleArea(nextOffsetX, _tmpNextOffsetY, visibleRegionArea);
        if (
          // Of course use larger one
          _newVisibleArea > originIntersectionVisibleArea || _newVisibleArea === originIntersectionVisibleArea && (!isVisibleFirst || // Choose recommend one
          _newVisibleRecommendArea >= originIntersectionRecommendArea)
        ) {
          prevFlipRef.current.tb = true;
          nextOffsetY = _tmpNextOffsetY;
          popupOffsetY = -popupOffsetY;
          nextAlignInfo.points = [reversePoints(popupPoints, 0), reversePoints(targetPoints, 0)];
        } else {
          prevFlipRef.current.tb = false;
        }
      }
      var needAdjustX = supportAdjust(adjustX);
      var sameLR = popupPoints[1] === targetPoints[1];
      if (needAdjustX && popupPoints[1] === "l" && (nextPopupRight > adjustCheckVisibleArea.right || prevFlipRef.current.rl)) {
        var tmpNextOffsetX = nextOffsetX;
        if (sameLR) {
          tmpNextOffsetX -= popupWidth - targetWidth;
        } else {
          tmpNextOffsetX = targetAlignPointTL.x - popupAlignPointBR.x - popupOffsetX;
        }
        var _newVisibleArea2 = getIntersectionVisibleArea(tmpNextOffsetX, nextOffsetY);
        var _newVisibleRecommendArea2 = getIntersectionVisibleArea(tmpNextOffsetX, nextOffsetY, visibleRegionArea);
        if (
          // Of course use larger one
          _newVisibleArea2 > originIntersectionVisibleArea || _newVisibleArea2 === originIntersectionVisibleArea && (!isVisibleFirst || // Choose recommend one
          _newVisibleRecommendArea2 >= originIntersectionRecommendArea)
        ) {
          prevFlipRef.current.rl = true;
          nextOffsetX = tmpNextOffsetX;
          popupOffsetX = -popupOffsetX;
          nextAlignInfo.points = [reversePoints(popupPoints, 1), reversePoints(targetPoints, 1)];
        } else {
          prevFlipRef.current.rl = false;
        }
      }
      if (needAdjustX && popupPoints[1] === "r" && (nextPopupX < adjustCheckVisibleArea.left || prevFlipRef.current.lr)) {
        var _tmpNextOffsetX = nextOffsetX;
        if (sameLR) {
          _tmpNextOffsetX += popupWidth - targetWidth;
        } else {
          _tmpNextOffsetX = targetAlignPointBR.x - popupAlignPointTL.x - popupOffsetX;
        }
        var _newVisibleArea3 = getIntersectionVisibleArea(_tmpNextOffsetX, nextOffsetY);
        var _newVisibleRecommendArea3 = getIntersectionVisibleArea(_tmpNextOffsetX, nextOffsetY, visibleRegionArea);
        if (
          // Of course use larger one
          _newVisibleArea3 > originIntersectionVisibleArea || _newVisibleArea3 === originIntersectionVisibleArea && (!isVisibleFirst || // Choose recommend one
          _newVisibleRecommendArea3 >= originIntersectionRecommendArea)
        ) {
          prevFlipRef.current.lr = true;
          nextOffsetX = _tmpNextOffsetX;
          popupOffsetX = -popupOffsetX;
          nextAlignInfo.points = [reversePoints(popupPoints, 1), reversePoints(targetPoints, 1)];
        } else {
          prevFlipRef.current.lr = false;
        }
      }
      syncNextPopupPosition();
      var numShiftX = shiftX === true ? 0 : shiftX;
      if (typeof numShiftX === "number") {
        if (nextPopupX < visibleRegionArea.left) {
          nextOffsetX -= nextPopupX - visibleRegionArea.left - popupOffsetX;
          if (targetRect.x + targetWidth < visibleRegionArea.left + numShiftX) {
            nextOffsetX += targetRect.x - visibleRegionArea.left + targetWidth - numShiftX;
          }
        }
        if (nextPopupRight > visibleRegionArea.right) {
          nextOffsetX -= nextPopupRight - visibleRegionArea.right - popupOffsetX;
          if (targetRect.x > visibleRegionArea.right - numShiftX) {
            nextOffsetX += targetRect.x - visibleRegionArea.right + numShiftX;
          }
        }
      }
      var numShiftY = shiftY === true ? 0 : shiftY;
      if (typeof numShiftY === "number") {
        if (nextPopupY < visibleRegionArea.top) {
          nextOffsetY -= nextPopupY - visibleRegionArea.top - popupOffsetY;
          if (targetRect.y + targetHeight < visibleRegionArea.top + numShiftY) {
            nextOffsetY += targetRect.y - visibleRegionArea.top + targetHeight - numShiftY;
          }
        }
        if (nextPopupBottom > visibleRegionArea.bottom) {
          nextOffsetY -= nextPopupBottom - visibleRegionArea.bottom - popupOffsetY;
          if (targetRect.y > visibleRegionArea.bottom - numShiftY) {
            nextOffsetY += targetRect.y - visibleRegionArea.bottom + numShiftY;
          }
        }
      }
      var popupLeft = popupRect.x + nextOffsetX;
      var popupRight = popupLeft + popupWidth;
      var popupTop = popupRect.y + nextOffsetY;
      var popupBottom = popupTop + popupHeight;
      var targetLeft = targetRect.x;
      var targetRight = targetLeft + targetWidth;
      var targetTop = targetRect.y;
      var targetBottom = targetTop + targetHeight;
      var maxLeft = Math.max(popupLeft, targetLeft);
      var minRight = Math.min(popupRight, targetRight);
      var xCenter = (maxLeft + minRight) / 2;
      var nextArrowX = xCenter - popupLeft;
      var maxTop = Math.max(popupTop, targetTop);
      var minBottom = Math.min(popupBottom, targetBottom);
      var yCenter = (maxTop + minBottom) / 2;
      var nextArrowY = yCenter - popupTop;
      onPopupAlign === null || onPopupAlign === void 0 || onPopupAlign(popupEle, nextAlignInfo);
      var offsetX4Right = popupMirrorRect.right - popupRect.x - (nextOffsetX + popupRect.width);
      var offsetY4Bottom = popupMirrorRect.bottom - popupRect.y - (nextOffsetY + popupRect.height);
      if (_scaleX === 1) {
        nextOffsetX = Math.round(nextOffsetX);
        offsetX4Right = Math.round(offsetX4Right);
      }
      if (_scaleY === 1) {
        nextOffsetY = Math.round(nextOffsetY);
        offsetY4Bottom = Math.round(offsetY4Bottom);
      }
      var nextOffsetInfo = {
        ready: true,
        offsetX: nextOffsetX / _scaleX,
        offsetY: nextOffsetY / _scaleY,
        offsetR: offsetX4Right / _scaleX,
        offsetB: offsetY4Bottom / _scaleY,
        arrowX: nextArrowX / _scaleX,
        arrowY: nextArrowY / _scaleY,
        scaleX: _scaleX,
        scaleY: _scaleY,
        align: nextAlignInfo
      };
      setOffsetInfo(nextOffsetInfo);
    }
  });
  var triggerAlign = function triggerAlign2() {
    alignCountRef.current += 1;
    var id2 = alignCountRef.current;
    Promise.resolve().then(function() {
      if (alignCountRef.current === id2) {
        onAlign();
      }
    });
  };
  var resetReady = function resetReady2() {
    setOffsetInfo(function(ori) {
      return _objectSpread2(_objectSpread2({}, ori), {}, {
        ready: false
      });
    });
  };
  useLayoutEffect(resetReady, [placement]);
  useLayoutEffect(function() {
    if (!open) {
      resetReady();
    }
  }, [open]);
  return [offsetInfo.ready, offsetInfo.offsetX, offsetInfo.offsetY, offsetInfo.offsetR, offsetInfo.offsetB, offsetInfo.arrowX, offsetInfo.arrowY, offsetInfo.scaleX, offsetInfo.scaleY, offsetInfo.align, triggerAlign];
}
function useWatch(open, target, popup, onAlign, onScroll6) {
  useLayoutEffect(function() {
    if (open && target && popup) {
      let notifyScroll = function() {
        onAlign();
        onScroll6();
      };
      var targetElement = target;
      var popupElement = popup;
      var targetScrollList = collectScroller(targetElement);
      var popupScrollList = collectScroller(popupElement);
      var win2 = getWin(popupElement);
      var mergedList = new Set([win2].concat(_toConsumableArray(targetScrollList), _toConsumableArray(popupScrollList)));
      mergedList.forEach(function(scroller) {
        scroller.addEventListener("scroll", notifyScroll, {
          passive: true
        });
      });
      win2.addEventListener("resize", notifyScroll, {
        passive: true
      });
      onAlign();
      return function() {
        mergedList.forEach(function(scroller) {
          scroller.removeEventListener("scroll", notifyScroll);
          win2.removeEventListener("resize", notifyScroll);
        });
      };
    }
  }, [open, target, popup]);
}
function useWinClick(open, clickToHide, targetEle, popupEle, mask, maskClosable, inPopupOrChild, triggerOpen) {
  var openRef = reactExports.useRef(open);
  openRef.current = open;
  var popupPointerDownRef = reactExports.useRef(false);
  reactExports.useEffect(function() {
    if (clickToHide && popupEle && (!mask || maskClosable)) {
      var onPointerDown = function onPointerDown2() {
        popupPointerDownRef.current = false;
      };
      var onTriggerClose = function onTriggerClose2(e2) {
        var _e$composedPath;
        if (openRef.current && !inPopupOrChild(((_e$composedPath = e2.composedPath) === null || _e$composedPath === void 0 || (_e$composedPath = _e$composedPath.call(e2)) === null || _e$composedPath === void 0 ? void 0 : _e$composedPath[0]) || e2.target) && !popupPointerDownRef.current) {
          triggerOpen(false);
        }
      };
      var win2 = getWin(popupEle);
      win2.addEventListener("pointerdown", onPointerDown, true);
      win2.addEventListener("mousedown", onTriggerClose, true);
      win2.addEventListener("contextmenu", onTriggerClose, true);
      var targetShadowRoot = getShadowRoot(targetEle);
      if (targetShadowRoot) {
        targetShadowRoot.addEventListener("mousedown", onTriggerClose, true);
        targetShadowRoot.addEventListener("contextmenu", onTriggerClose, true);
      }
      return function() {
        win2.removeEventListener("pointerdown", onPointerDown, true);
        win2.removeEventListener("mousedown", onTriggerClose, true);
        win2.removeEventListener("contextmenu", onTriggerClose, true);
        if (targetShadowRoot) {
          targetShadowRoot.removeEventListener("mousedown", onTriggerClose, true);
          targetShadowRoot.removeEventListener("contextmenu", onTriggerClose, true);
        }
      };
    }
  }, [clickToHide, targetEle, popupEle, mask, maskClosable]);
  function onPopupPointerDown() {
    popupPointerDownRef.current = true;
  }
  return onPopupPointerDown;
}
var _excluded$o = ["prefixCls", "children", "action", "showAction", "hideAction", "popupVisible", "defaultPopupVisible", "onPopupVisibleChange", "afterPopupVisibleChange", "mouseEnterDelay", "mouseLeaveDelay", "focusDelay", "blurDelay", "mask", "maskClosable", "getPopupContainer", "forceRender", "autoDestroy", "destroyPopupOnHide", "popup", "popupClassName", "popupStyle", "popupPlacement", "builtinPlacements", "popupAlign", "zIndex", "stretch", "getPopupClassNameFromAlign", "fresh", "alignPoint", "onPopupClick", "onPopupAlign", "arrow", "popupMotion", "maskMotion", "popupTransitionName", "popupAnimation", "maskTransitionName", "maskAnimation", "className", "getTriggerDOMNode"];
function generateTrigger() {
  var PortalComponent = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Portal;
  var Trigger2 = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
    var _props$prefixCls = props.prefixCls, prefixCls = _props$prefixCls === void 0 ? "rc-trigger-popup" : _props$prefixCls, children = props.children, _props$action = props.action, action = _props$action === void 0 ? "hover" : _props$action, showAction = props.showAction, hideAction = props.hideAction, popupVisible = props.popupVisible, defaultPopupVisible = props.defaultPopupVisible, onPopupVisibleChange = props.onPopupVisibleChange, afterPopupVisibleChange = props.afterPopupVisibleChange, mouseEnterDelay = props.mouseEnterDelay, _props$mouseLeaveDela = props.mouseLeaveDelay, mouseLeaveDelay = _props$mouseLeaveDela === void 0 ? 0.1 : _props$mouseLeaveDela, focusDelay = props.focusDelay, blurDelay = props.blurDelay, mask = props.mask, _props$maskClosable = props.maskClosable, maskClosable = _props$maskClosable === void 0 ? true : _props$maskClosable, getPopupContainer = props.getPopupContainer, forceRender = props.forceRender, autoDestroy = props.autoDestroy, destroyPopupOnHide = props.destroyPopupOnHide, popup = props.popup, popupClassName = props.popupClassName, popupStyle = props.popupStyle, popupPlacement = props.popupPlacement, _props$builtinPlaceme = props.builtinPlacements, builtinPlacements = _props$builtinPlaceme === void 0 ? {} : _props$builtinPlaceme, popupAlign = props.popupAlign, zIndex = props.zIndex, stretch = props.stretch, getPopupClassNameFromAlign = props.getPopupClassNameFromAlign, fresh = props.fresh, alignPoint = props.alignPoint, onPopupClick = props.onPopupClick, onPopupAlign = props.onPopupAlign, arrow = props.arrow, popupMotion = props.popupMotion, maskMotion = props.maskMotion, popupTransitionName = props.popupTransitionName, popupAnimation = props.popupAnimation, maskTransitionName = props.maskTransitionName, maskAnimation = props.maskAnimation, className = props.className, getTriggerDOMNode = props.getTriggerDOMNode, restProps = _objectWithoutProperties$3(props, _excluded$o);
    var mergedAutoDestroy = autoDestroy || destroyPopupOnHide || false;
    var _React$useState = reactExports.useState(false), _React$useState2 = _slicedToArray(_React$useState, 2), mobile = _React$useState2[0], setMobile = _React$useState2[1];
    useLayoutEffect(function() {
      setMobile(isMobile());
    }, []);
    var subPopupElements = reactExports.useRef({});
    var parentContext = reactExports.useContext(TriggerContext);
    var context = reactExports.useMemo(function() {
      return {
        registerSubPopup: function registerSubPopup(id22, subPopupEle) {
          subPopupElements.current[id22] = subPopupEle;
          parentContext === null || parentContext === void 0 || parentContext.registerSubPopup(id22, subPopupEle);
        }
      };
    }, [parentContext]);
    var id2 = useId();
    var _React$useState3 = reactExports.useState(null), _React$useState4 = _slicedToArray(_React$useState3, 2), popupEle = _React$useState4[0], setPopupEle = _React$useState4[1];
    var externalPopupRef = reactExports.useRef(null);
    var setPopupRef = useEvent$1(function(node2) {
      externalPopupRef.current = node2;
      if (isDOM(node2) && popupEle !== node2) {
        setPopupEle(node2);
      }
      parentContext === null || parentContext === void 0 || parentContext.registerSubPopup(id2, node2);
    });
    var _React$useState5 = reactExports.useState(null), _React$useState6 = _slicedToArray(_React$useState5, 2), targetEle = _React$useState6[0], setTargetEle = _React$useState6[1];
    var externalForwardRef = reactExports.useRef(null);
    var setTargetRef = useEvent$1(function(node2) {
      if (isDOM(node2) && targetEle !== node2) {
        setTargetEle(node2);
        externalForwardRef.current = node2;
      }
    });
    var child = reactExports.Children.only(children);
    var originChildProps = (child === null || child === void 0 ? void 0 : child.props) || {};
    var cloneProps = {};
    var inPopupOrChild = useEvent$1(function(ele) {
      var _getShadowRoot, _getShadowRoot2;
      var childDOM = targetEle;
      return (childDOM === null || childDOM === void 0 ? void 0 : childDOM.contains(ele)) || ((_getShadowRoot = getShadowRoot(childDOM)) === null || _getShadowRoot === void 0 ? void 0 : _getShadowRoot.host) === ele || ele === childDOM || (popupEle === null || popupEle === void 0 ? void 0 : popupEle.contains(ele)) || ((_getShadowRoot2 = getShadowRoot(popupEle)) === null || _getShadowRoot2 === void 0 ? void 0 : _getShadowRoot2.host) === ele || ele === popupEle || Object.values(subPopupElements.current).some(function(subPopupEle) {
        return (subPopupEle === null || subPopupEle === void 0 ? void 0 : subPopupEle.contains(ele)) || ele === subPopupEle;
      });
    });
    var mergePopupMotion = getMotion$1(prefixCls, popupMotion, popupAnimation, popupTransitionName);
    var mergeMaskMotion = getMotion$1(prefixCls, maskMotion, maskAnimation, maskTransitionName);
    var _React$useState7 = reactExports.useState(defaultPopupVisible || false), _React$useState8 = _slicedToArray(_React$useState7, 2), internalOpen = _React$useState8[0], setInternalOpen = _React$useState8[1];
    var mergedOpen = popupVisible !== null && popupVisible !== void 0 ? popupVisible : internalOpen;
    var setMergedOpen = useEvent$1(function(nextOpen) {
      if (popupVisible === void 0) {
        setInternalOpen(nextOpen);
      }
    });
    useLayoutEffect(function() {
      setInternalOpen(popupVisible || false);
    }, [popupVisible]);
    var openRef = reactExports.useRef(mergedOpen);
    openRef.current = mergedOpen;
    var lastTriggerRef = reactExports.useRef([]);
    lastTriggerRef.current = [];
    var internalTriggerOpen = useEvent$1(function(nextOpen) {
      var _lastTriggerRef$curre;
      setMergedOpen(nextOpen);
      if (((_lastTriggerRef$curre = lastTriggerRef.current[lastTriggerRef.current.length - 1]) !== null && _lastTriggerRef$curre !== void 0 ? _lastTriggerRef$curre : mergedOpen) !== nextOpen) {
        lastTriggerRef.current.push(nextOpen);
        onPopupVisibleChange === null || onPopupVisibleChange === void 0 || onPopupVisibleChange(nextOpen);
      }
    });
    var delayRef = reactExports.useRef();
    var clearDelay = function clearDelay2() {
      clearTimeout(delayRef.current);
    };
    var triggerOpen = function triggerOpen2(nextOpen) {
      var delay2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      clearDelay();
      if (delay2 === 0) {
        internalTriggerOpen(nextOpen);
      } else {
        delayRef.current = setTimeout(function() {
          internalTriggerOpen(nextOpen);
        }, delay2 * 1e3);
      }
    };
    reactExports.useEffect(function() {
      return clearDelay;
    }, []);
    var _React$useState9 = reactExports.useState(false), _React$useState10 = _slicedToArray(_React$useState9, 2), inMotion = _React$useState10[0], setInMotion = _React$useState10[1];
    useLayoutEffect(function(firstMount) {
      if (!firstMount || mergedOpen) {
        setInMotion(true);
      }
    }, [mergedOpen]);
    var _React$useState11 = reactExports.useState(null), _React$useState12 = _slicedToArray(_React$useState11, 2), motionPrepareResolve = _React$useState12[0], setMotionPrepareResolve = _React$useState12[1];
    var _React$useState13 = reactExports.useState(null), _React$useState14 = _slicedToArray(_React$useState13, 2), mousePos = _React$useState14[0], setMousePos = _React$useState14[1];
    var setMousePosByEvent = function setMousePosByEvent2(event) {
      setMousePos([event.clientX, event.clientY]);
    };
    var _useAlign = useAlign(mergedOpen, popupEle, alignPoint && mousePos !== null ? mousePos : targetEle, popupPlacement, builtinPlacements, popupAlign, onPopupAlign), _useAlign2 = _slicedToArray(_useAlign, 11), ready = _useAlign2[0], offsetX = _useAlign2[1], offsetY = _useAlign2[2], offsetR = _useAlign2[3], offsetB = _useAlign2[4], arrowX = _useAlign2[5], arrowY = _useAlign2[6], scaleX = _useAlign2[7], scaleY = _useAlign2[8], alignInfo = _useAlign2[9], onAlign = _useAlign2[10];
    var _useAction = useAction(mobile, action, showAction, hideAction), _useAction2 = _slicedToArray(_useAction, 2), showActions = _useAction2[0], hideActions = _useAction2[1];
    var clickToShow = showActions.has("click");
    var clickToHide = hideActions.has("click") || hideActions.has("contextMenu");
    var triggerAlign = useEvent$1(function() {
      if (!inMotion) {
        onAlign();
      }
    });
    var onScroll6 = function onScroll22() {
      if (openRef.current && alignPoint && clickToHide) {
        triggerOpen(false);
      }
    };
    useWatch(mergedOpen, targetEle, popupEle, triggerAlign, onScroll6);
    useLayoutEffect(function() {
      triggerAlign();
    }, [mousePos, popupPlacement]);
    useLayoutEffect(function() {
      if (mergedOpen && !(builtinPlacements !== null && builtinPlacements !== void 0 && builtinPlacements[popupPlacement])) {
        triggerAlign();
      }
    }, [JSON.stringify(popupAlign)]);
    var alignedClassName = reactExports.useMemo(function() {
      var baseClassName = getAlignPopupClassName(builtinPlacements, prefixCls, alignInfo, alignPoint);
      return classNames(baseClassName, getPopupClassNameFromAlign === null || getPopupClassNameFromAlign === void 0 ? void 0 : getPopupClassNameFromAlign(alignInfo));
    }, [alignInfo, getPopupClassNameFromAlign, builtinPlacements, prefixCls, alignPoint]);
    reactExports.useImperativeHandle(ref, function() {
      return {
        nativeElement: externalForwardRef.current,
        popupElement: externalPopupRef.current,
        forceAlign: triggerAlign
      };
    });
    var _React$useState15 = reactExports.useState(0), _React$useState16 = _slicedToArray(_React$useState15, 2), targetWidth = _React$useState16[0], setTargetWidth = _React$useState16[1];
    var _React$useState17 = reactExports.useState(0), _React$useState18 = _slicedToArray(_React$useState17, 2), targetHeight = _React$useState18[0], setTargetHeight = _React$useState18[1];
    var syncTargetSize = function syncTargetSize2() {
      if (stretch && targetEle) {
        var rect = targetEle.getBoundingClientRect();
        setTargetWidth(rect.width);
        setTargetHeight(rect.height);
      }
    };
    var onTargetResize = function onTargetResize2() {
      syncTargetSize();
      triggerAlign();
    };
    var onVisibleChanged = function onVisibleChanged2(visible) {
      setInMotion(false);
      onAlign();
      afterPopupVisibleChange === null || afterPopupVisibleChange === void 0 || afterPopupVisibleChange(visible);
    };
    var onPrepare = function onPrepare2() {
      return new Promise(function(resolve2) {
        syncTargetSize();
        setMotionPrepareResolve(function() {
          return resolve2;
        });
      });
    };
    useLayoutEffect(function() {
      if (motionPrepareResolve) {
        onAlign();
        motionPrepareResolve();
        setMotionPrepareResolve(null);
      }
    }, [motionPrepareResolve]);
    function wrapperAction(eventName, nextOpen, delay2, preEvent) {
      cloneProps[eventName] = function(event) {
        var _originChildProps$eve;
        preEvent === null || preEvent === void 0 || preEvent(event);
        triggerOpen(nextOpen, delay2);
        for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
          args[_key - 1] = arguments[_key];
        }
        (_originChildProps$eve = originChildProps[eventName]) === null || _originChildProps$eve === void 0 || _originChildProps$eve.call.apply(_originChildProps$eve, [originChildProps, event].concat(args));
      };
    }
    if (clickToShow || clickToHide) {
      cloneProps.onClick = function(event) {
        var _originChildProps$onC;
        if (openRef.current && clickToHide) {
          triggerOpen(false);
        } else if (!openRef.current && clickToShow) {
          setMousePosByEvent(event);
          triggerOpen(true);
        }
        for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
          args[_key2 - 1] = arguments[_key2];
        }
        (_originChildProps$onC = originChildProps.onClick) === null || _originChildProps$onC === void 0 || _originChildProps$onC.call.apply(_originChildProps$onC, [originChildProps, event].concat(args));
      };
    }
    var onPopupPointerDown = useWinClick(mergedOpen, clickToHide, targetEle, popupEle, mask, maskClosable, inPopupOrChild, triggerOpen);
    var hoverToShow = showActions.has("hover");
    var hoverToHide = hideActions.has("hover");
    var onPopupMouseEnter;
    var onPopupMouseLeave;
    if (hoverToShow) {
      wrapperAction("onMouseEnter", true, mouseEnterDelay, function(event) {
        setMousePosByEvent(event);
      });
      wrapperAction("onPointerEnter", true, mouseEnterDelay, function(event) {
        setMousePosByEvent(event);
      });
      onPopupMouseEnter = function onPopupMouseEnter2(event) {
        if ((mergedOpen || inMotion) && popupEle !== null && popupEle !== void 0 && popupEle.contains(event.target)) {
          triggerOpen(true, mouseEnterDelay);
        }
      };
      if (alignPoint) {
        cloneProps.onMouseMove = function(event) {
          var _originChildProps$onM;
          (_originChildProps$onM = originChildProps.onMouseMove) === null || _originChildProps$onM === void 0 || _originChildProps$onM.call(originChildProps, event);
        };
      }
    }
    if (hoverToHide) {
      wrapperAction("onMouseLeave", false, mouseLeaveDelay);
      wrapperAction("onPointerLeave", false, mouseLeaveDelay);
      onPopupMouseLeave = function onPopupMouseLeave2() {
        triggerOpen(false, mouseLeaveDelay);
      };
    }
    if (showActions.has("focus")) {
      wrapperAction("onFocus", true, focusDelay);
    }
    if (hideActions.has("focus")) {
      wrapperAction("onBlur", false, blurDelay);
    }
    if (showActions.has("contextMenu")) {
      cloneProps.onContextMenu = function(event) {
        var _originChildProps$onC2;
        if (openRef.current && hideActions.has("contextMenu")) {
          triggerOpen(false);
        } else {
          setMousePosByEvent(event);
          triggerOpen(true);
        }
        event.preventDefault();
        for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
          args[_key3 - 1] = arguments[_key3];
        }
        (_originChildProps$onC2 = originChildProps.onContextMenu) === null || _originChildProps$onC2 === void 0 || _originChildProps$onC2.call.apply(_originChildProps$onC2, [originChildProps, event].concat(args));
      };
    }
    if (className) {
      cloneProps.className = classNames(originChildProps.className, className);
    }
    var renderedRef = reactExports.useRef(false);
    renderedRef.current || (renderedRef.current = forceRender || mergedOpen || inMotion);
    var mergedChildrenProps = _objectSpread2(_objectSpread2({}, originChildProps), cloneProps);
    var passedProps = {};
    var passedEventList = ["onContextMenu", "onClick", "onMouseDown", "onTouchStart", "onMouseEnter", "onMouseLeave", "onFocus", "onBlur"];
    passedEventList.forEach(function(eventName) {
      if (restProps[eventName]) {
        passedProps[eventName] = function() {
          var _mergedChildrenProps$;
          for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
            args[_key4] = arguments[_key4];
          }
          (_mergedChildrenProps$ = mergedChildrenProps[eventName]) === null || _mergedChildrenProps$ === void 0 || _mergedChildrenProps$.call.apply(_mergedChildrenProps$, [mergedChildrenProps].concat(args));
          restProps[eventName].apply(restProps, args);
        };
      }
    });
    var triggerNode = /* @__PURE__ */ reactExports.cloneElement(child, _objectSpread2(_objectSpread2({}, mergedChildrenProps), passedProps));
    var arrowPos = {
      x: arrowX,
      y: arrowY
    };
    var innerArrow = arrow ? _objectSpread2({}, arrow !== true ? arrow : {}) : null;
    return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__PURE__ */ reactExports.createElement(RefResizeObserver, {
      disabled: !mergedOpen,
      ref: setTargetRef,
      onResize: onTargetResize
    }, /* @__PURE__ */ reactExports.createElement(TriggerWrapper, {
      getTriggerDOMNode
    }, triggerNode)), renderedRef.current && /* @__PURE__ */ reactExports.createElement(TriggerContext.Provider, {
      value: context
    }, /* @__PURE__ */ reactExports.createElement(Popup$1, {
      portal: PortalComponent,
      ref: setPopupRef,
      prefixCls,
      popup,
      className: classNames(popupClassName, alignedClassName),
      style: popupStyle,
      target: targetEle,
      onMouseEnter: onPopupMouseEnter,
      onMouseLeave: onPopupMouseLeave,
      onPointerEnter: onPopupMouseEnter,
      zIndex,
      open: mergedOpen,
      keepDom: inMotion,
      fresh,
      onClick: onPopupClick,
      onPointerDownCapture: onPopupPointerDown,
      mask,
      motion: mergePopupMotion,
      maskMotion: mergeMaskMotion,
      onVisibleChanged,
      onPrepare,
      forceRender,
      autoDestroy: mergedAutoDestroy,
      getPopupContainer,
      align: alignInfo,
      arrow: innerArrow,
      arrowPos,
      ready,
      offsetX,
      offsetY,
      offsetR,
      offsetB,
      onAlign: triggerAlign,
      stretch,
      targetWidth: targetWidth / scaleX,
      targetHeight: targetHeight / scaleY
    })));
  });
  return Trigger2;
}
const Trigger = generateTrigger(Portal);
var Filler = /* @__PURE__ */ reactExports.forwardRef(function(_ref, ref) {
  var height = _ref.height, offsetY = _ref.offsetY, offsetX = _ref.offsetX, children = _ref.children, prefixCls = _ref.prefixCls, onInnerResize = _ref.onInnerResize, innerProps = _ref.innerProps, rtl = _ref.rtl, extra = _ref.extra;
  var outerStyle = {};
  var innerStyle = {
    display: "flex",
    flexDirection: "column"
  };
  if (offsetY !== void 0) {
    outerStyle = {
      height,
      position: "relative",
      overflow: "hidden"
    };
    innerStyle = _objectSpread2(_objectSpread2({}, innerStyle), {}, _defineProperty$3(_defineProperty$3(_defineProperty$3(_defineProperty$3(_defineProperty$3({
      transform: "translateY(".concat(offsetY, "px)")
    }, rtl ? "marginRight" : "marginLeft", -offsetX), "position", "absolute"), "left", 0), "right", 0), "top", 0));
  }
  return /* @__PURE__ */ reactExports.createElement("div", {
    style: outerStyle
  }, /* @__PURE__ */ reactExports.createElement(RefResizeObserver, {
    onResize: function onResize4(_ref2) {
      var offsetHeight = _ref2.offsetHeight;
      if (offsetHeight && onInnerResize) {
        onInnerResize();
      }
    }
  }, /* @__PURE__ */ reactExports.createElement("div", _extends$h({
    style: innerStyle,
    className: classNames(_defineProperty$3({}, "".concat(prefixCls, "-holder-inner"), prefixCls)),
    ref
  }, innerProps), children, extra)));
});
Filler.displayName = "Filler";
function Item$1(_ref) {
  var children = _ref.children, setRef2 = _ref.setRef;
  var refFunc = reactExports.useCallback(function(node2) {
    setRef2(node2);
  }, []);
  return /* @__PURE__ */ reactExports.cloneElement(children, {
    ref: refFunc
  });
}
function useChildren(list2, startIndex, endIndex, scrollWidth, offsetX, setNodeRef, renderFunc, _ref) {
  var getKey3 = _ref.getKey;
  return list2.slice(startIndex, endIndex + 1).map(function(item, index2) {
    var eleIndex = startIndex + index2;
    var node2 = renderFunc(item, eleIndex, {
      style: {
        width: scrollWidth
      },
      offsetX
    });
    var key = getKey3(item);
    return /* @__PURE__ */ reactExports.createElement(Item$1, {
      key,
      setRef: function setRef2(ele) {
        return setNodeRef(item, ele);
      }
    }, node2);
  });
}
function findListDiffIndex(originList, targetList, getKey3) {
  var originLen = originList.length;
  var targetLen = targetList.length;
  var shortList;
  var longList;
  if (originLen === 0 && targetLen === 0) {
    return null;
  }
  if (originLen < targetLen) {
    shortList = originList;
    longList = targetList;
  } else {
    shortList = targetList;
    longList = originList;
  }
  var notExistKey = {
    __EMPTY_ITEM__: true
  };
  function getItemKey(item) {
    if (item !== void 0) {
      return getKey3(item);
    }
    return notExistKey;
  }
  var diffIndex = null;
  var multiple = Math.abs(originLen - targetLen) !== 1;
  for (var i2 = 0; i2 < longList.length; i2 += 1) {
    var shortKey = getItemKey(shortList[i2]);
    var longKey = getItemKey(longList[i2]);
    if (shortKey !== longKey) {
      diffIndex = i2;
      multiple = multiple || shortKey !== getItemKey(longList[i2 + 1]);
      break;
    }
  }
  return diffIndex === null ? null : {
    index: diffIndex,
    multiple
  };
}
function useDiffItem(data, getKey3, onDiff) {
  var _React$useState = reactExports.useState(data), _React$useState2 = _slicedToArray(_React$useState, 2), prevData = _React$useState2[0], setPrevData = _React$useState2[1];
  var _React$useState3 = reactExports.useState(null), _React$useState4 = _slicedToArray(_React$useState3, 2), diffItem = _React$useState4[0], setDiffItem = _React$useState4[1];
  reactExports.useEffect(function() {
    var diff2 = findListDiffIndex(prevData || [], data || [], getKey3);
    if ((diff2 === null || diff2 === void 0 ? void 0 : diff2.index) !== void 0) {
      setDiffItem(data[diff2.index]);
    }
    setPrevData(data);
  }, [data]);
  return [diffItem];
}
var isFF = (typeof navigator === "undefined" ? "undefined" : _typeof$1(navigator)) === "object" && /Firefox/i.test(navigator.userAgent);
const useOriginScroll = function(isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight) {
  var lockRef = reactExports.useRef(false);
  var lockTimeoutRef = reactExports.useRef(null);
  function lockScroll() {
    clearTimeout(lockTimeoutRef.current);
    lockRef.current = true;
    lockTimeoutRef.current = setTimeout(function() {
      lockRef.current = false;
    }, 50);
  }
  var scrollPingRef = reactExports.useRef({
    top: isScrollAtTop,
    bottom: isScrollAtBottom,
    left: isScrollAtLeft,
    right: isScrollAtRight
  });
  scrollPingRef.current.top = isScrollAtTop;
  scrollPingRef.current.bottom = isScrollAtBottom;
  scrollPingRef.current.left = isScrollAtLeft;
  scrollPingRef.current.right = isScrollAtRight;
  return function(isHorizontal, delta) {
    var smoothOffset = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
    var originScroll = isHorizontal ? (
      // Pass origin wheel when on the left
      delta < 0 && scrollPingRef.current.left || // Pass origin wheel when on the right
      delta > 0 && scrollPingRef.current.right
    ) : delta < 0 && scrollPingRef.current.top || // Pass origin wheel when on the bottom
    delta > 0 && scrollPingRef.current.bottom;
    if (smoothOffset && originScroll) {
      clearTimeout(lockTimeoutRef.current);
      lockRef.current = false;
    } else if (!originScroll || lockRef.current) {
      lockScroll();
    }
    return !lockRef.current && originScroll;
  };
};
function useFrameWheel(inVirtual, isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight, horizontalScroll, onWheelDelta) {
  var offsetRef = reactExports.useRef(0);
  var nextFrameRef = reactExports.useRef(null);
  var wheelValueRef = reactExports.useRef(null);
  var isMouseScrollRef = reactExports.useRef(false);
  var originScroll = useOriginScroll(isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight);
  function onWheelY(e2, deltaY) {
    wrapperRaf.cancel(nextFrameRef.current);
    if (originScroll(false, deltaY))
      return;
    var event = e2;
    if (!event._virtualHandled) {
      event._virtualHandled = true;
    } else {
      return;
    }
    offsetRef.current += deltaY;
    wheelValueRef.current = deltaY;
    if (!isFF) {
      event.preventDefault();
    }
    nextFrameRef.current = wrapperRaf(function() {
      var patchMultiple = isMouseScrollRef.current ? 10 : 1;
      onWheelDelta(offsetRef.current * patchMultiple, false);
      offsetRef.current = 0;
    });
  }
  function onWheelX(event, deltaX) {
    onWheelDelta(deltaX, true);
    if (!isFF) {
      event.preventDefault();
    }
  }
  var wheelDirectionRef = reactExports.useRef(null);
  var wheelDirectionCleanRef = reactExports.useRef(null);
  function onWheel(event) {
    if (!inVirtual)
      return;
    wrapperRaf.cancel(wheelDirectionCleanRef.current);
    wheelDirectionCleanRef.current = wrapperRaf(function() {
      wheelDirectionRef.current = null;
    }, 2);
    var deltaX = event.deltaX, deltaY = event.deltaY, shiftKey = event.shiftKey;
    var mergedDeltaX = deltaX;
    var mergedDeltaY = deltaY;
    if (wheelDirectionRef.current === "sx" || !wheelDirectionRef.current && (shiftKey || false) && deltaY && !deltaX) {
      mergedDeltaX = deltaY;
      mergedDeltaY = 0;
      wheelDirectionRef.current = "sx";
    }
    var absX = Math.abs(mergedDeltaX);
    var absY = Math.abs(mergedDeltaY);
    if (wheelDirectionRef.current === null) {
      wheelDirectionRef.current = horizontalScroll && absX > absY ? "x" : "y";
    }
    if (wheelDirectionRef.current === "y") {
      onWheelY(event, mergedDeltaY);
    } else {
      onWheelX(event, mergedDeltaX);
    }
  }
  function onFireFoxScroll(event) {
    if (!inVirtual)
      return;
    isMouseScrollRef.current = event.detail === wheelValueRef.current;
  }
  return [onWheel, onFireFoxScroll];
}
function useGetSize(mergedData, getKey3, heights, itemHeight) {
  var _React$useMemo = reactExports.useMemo(function() {
    return [/* @__PURE__ */ new Map(), []];
  }, [mergedData, heights.id, itemHeight]), _React$useMemo2 = _slicedToArray(_React$useMemo, 2), key2Index = _React$useMemo2[0], bottomList = _React$useMemo2[1];
  var getSize = function getSize2(startKey) {
    var endKey = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : startKey;
    var startIndex = key2Index.get(startKey);
    var endIndex = key2Index.get(endKey);
    if (startIndex === void 0 || endIndex === void 0) {
      var dataLen = mergedData.length;
      for (var i2 = bottomList.length; i2 < dataLen; i2 += 1) {
        var _heights$get;
        var item = mergedData[i2];
        var key = getKey3(item);
        key2Index.set(key, i2);
        var cacheHeight = (_heights$get = heights.get(key)) !== null && _heights$get !== void 0 ? _heights$get : itemHeight;
        bottomList[i2] = (bottomList[i2 - 1] || 0) + cacheHeight;
        if (key === startKey) {
          startIndex = i2;
        }
        if (key === endKey) {
          endIndex = i2;
        }
        if (startIndex !== void 0 && endIndex !== void 0) {
          break;
        }
      }
    }
    return {
      top: bottomList[startIndex - 1] || 0,
      bottom: bottomList[endIndex]
    };
  };
  return getSize;
}
var CacheMap = /* @__PURE__ */ function() {
  function CacheMap2() {
    _classCallCheck$a(this, CacheMap2);
    _defineProperty$3(this, "maps", void 0);
    _defineProperty$3(this, "id", 0);
    _defineProperty$3(this, "diffRecords", /* @__PURE__ */ new Map());
    this.maps = /* @__PURE__ */ Object.create(null);
  }
  _createClass$8(CacheMap2, [{
    key: "set",
    value: function set2(key, value2) {
      this.diffRecords.set(key, this.maps[key]);
      this.maps[key] = value2;
      this.id += 1;
    }
  }, {
    key: "get",
    value: function get5(key) {
      return this.maps[key];
    }
    /**
     * CacheMap will record the key changed.
     * To help to know what's update in the next render.
     */
  }, {
    key: "resetRecord",
    value: function resetRecord() {
      this.diffRecords.clear();
    }
  }, {
    key: "getRecord",
    value: function getRecord() {
      return this.diffRecords;
    }
  }]);
  return CacheMap2;
}();
function parseNumber(value2) {
  var num = parseFloat(value2);
  return isNaN(num) ? 0 : num;
}
function useHeights(getKey3, onItemAdd, onItemRemove) {
  var _React$useState = reactExports.useState(0), _React$useState2 = _slicedToArray(_React$useState, 2), updatedMark = _React$useState2[0], setUpdatedMark = _React$useState2[1];
  var instanceRef = reactExports.useRef(/* @__PURE__ */ new Map());
  var heightsRef = reactExports.useRef(new CacheMap());
  var promiseIdRef = reactExports.useRef(0);
  function cancelRaf() {
    promiseIdRef.current += 1;
  }
  function collectHeight() {
    var sync = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
    cancelRaf();
    var doCollect = function doCollect2() {
      var changed = false;
      instanceRef.current.forEach(function(element2, key) {
        if (element2 && element2.offsetParent) {
          var offsetHeight = element2.offsetHeight;
          var _getComputedStyle = getComputedStyle(element2), marginTop = _getComputedStyle.marginTop, marginBottom = _getComputedStyle.marginBottom;
          var marginTopNum = parseNumber(marginTop);
          var marginBottomNum = parseNumber(marginBottom);
          var totalHeight = offsetHeight + marginTopNum + marginBottomNum;
          if (heightsRef.current.get(key) !== totalHeight) {
            heightsRef.current.set(key, totalHeight);
            changed = true;
          }
        }
      });
      if (changed) {
        setUpdatedMark(function(c2) {
          return c2 + 1;
        });
      }
    };
    if (sync) {
      doCollect();
    } else {
      promiseIdRef.current += 1;
      var id2 = promiseIdRef.current;
      Promise.resolve().then(function() {
        if (id2 === promiseIdRef.current) {
          doCollect();
        }
      });
    }
  }
  function setInstanceRef(item, instance2) {
    var key = getKey3(item);
    instanceRef.current.get(key);
    if (instance2) {
      instanceRef.current.set(key, instance2);
      collectHeight();
    } else {
      instanceRef.current.delete(key);
    }
  }
  reactExports.useEffect(function() {
    return cancelRaf;
  }, []);
  return [setInstanceRef, collectHeight, heightsRef.current, updatedMark];
}
var SMOOTH_PTG = 14 / 15;
function useMobileTouchMove(inVirtual, listRef, callback2) {
  var touchedRef = reactExports.useRef(false);
  var touchXRef = reactExports.useRef(0);
  var touchYRef = reactExports.useRef(0);
  var elementRef = reactExports.useRef(null);
  var intervalRef = reactExports.useRef(null);
  var cleanUpEvents;
  var onTouchMove = function onTouchMove2(e2) {
    if (touchedRef.current) {
      var currentX = Math.ceil(e2.touches[0].pageX);
      var currentY = Math.ceil(e2.touches[0].pageY);
      var offsetX = touchXRef.current - currentX;
      var offsetY = touchYRef.current - currentY;
      var _isHorizontal = Math.abs(offsetX) > Math.abs(offsetY);
      if (_isHorizontal) {
        touchXRef.current = currentX;
      } else {
        touchYRef.current = currentY;
      }
      var scrollHandled = callback2(_isHorizontal, _isHorizontal ? offsetX : offsetY, false, e2);
      if (scrollHandled) {
        e2.preventDefault();
      }
      clearInterval(intervalRef.current);
      if (scrollHandled) {
        intervalRef.current = setInterval(function() {
          if (_isHorizontal) {
            offsetX *= SMOOTH_PTG;
          } else {
            offsetY *= SMOOTH_PTG;
          }
          var offset2 = Math.floor(_isHorizontal ? offsetX : offsetY);
          if (!callback2(_isHorizontal, offset2, true) || Math.abs(offset2) <= 0.1) {
            clearInterval(intervalRef.current);
          }
        }, 16);
      }
    }
  };
  var onTouchEnd = function onTouchEnd2() {
    touchedRef.current = false;
    cleanUpEvents();
  };
  var onTouchStart = function onTouchStart2(e2) {
    cleanUpEvents();
    if (e2.touches.length === 1 && !touchedRef.current) {
      touchedRef.current = true;
      touchXRef.current = Math.ceil(e2.touches[0].pageX);
      touchYRef.current = Math.ceil(e2.touches[0].pageY);
      elementRef.current = e2.target;
      elementRef.current.addEventListener("touchmove", onTouchMove, {
        passive: false
      });
      elementRef.current.addEventListener("touchend", onTouchEnd, {
        passive: true
      });
    }
  };
  cleanUpEvents = function cleanUpEvents2() {
    if (elementRef.current) {
      elementRef.current.removeEventListener("touchmove", onTouchMove);
      elementRef.current.removeEventListener("touchend", onTouchEnd);
    }
  };
  useLayoutEffect(function() {
    if (inVirtual) {
      listRef.current.addEventListener("touchstart", onTouchStart, {
        passive: true
      });
    }
    return function() {
      var _listRef$current;
      (_listRef$current = listRef.current) === null || _listRef$current === void 0 || _listRef$current.removeEventListener("touchstart", onTouchStart);
      cleanUpEvents();
      clearInterval(intervalRef.current);
    };
  }, [inVirtual]);
}
function smoothScrollOffset(offset2) {
  return Math.floor(Math.pow(offset2, 0.5));
}
function getPageXY(e2, horizontal) {
  var obj = "touches" in e2 ? e2.touches[0] : e2;
  return obj[horizontal ? "pageX" : "pageY"] - window[horizontal ? "scrollX" : "scrollY"];
}
function useScrollDrag(inVirtual, componentRef, onScrollOffset) {
  reactExports.useEffect(function() {
    var ele = componentRef.current;
    if (inVirtual && ele) {
      var mouseDownLock = false;
      var rafId;
      var _offset;
      var stopScroll = function stopScroll2() {
        wrapperRaf.cancel(rafId);
      };
      var continueScroll = function continueScroll2() {
        stopScroll();
        rafId = wrapperRaf(function() {
          onScrollOffset(_offset);
          continueScroll2();
        });
      };
      var onMouseDown = function onMouseDown2(e2) {
        if (e2.target.draggable || e2.button !== 0) {
          return;
        }
        var event = e2;
        if (!event._virtualHandled) {
          event._virtualHandled = true;
          mouseDownLock = true;
        }
      };
      var onMouseUp = function onMouseUp2() {
        mouseDownLock = false;
        stopScroll();
      };
      var onMouseMove = function onMouseMove2(e2) {
        if (mouseDownLock) {
          var mouseY = getPageXY(e2, false);
          var _ele$getBoundingClien = ele.getBoundingClientRect(), top2 = _ele$getBoundingClien.top, bottom2 = _ele$getBoundingClien.bottom;
          if (mouseY <= top2) {
            var diff2 = top2 - mouseY;
            _offset = -smoothScrollOffset(diff2);
            continueScroll();
          } else if (mouseY >= bottom2) {
            var _diff = mouseY - bottom2;
            _offset = smoothScrollOffset(_diff);
            continueScroll();
          } else {
            stopScroll();
          }
        }
      };
      ele.addEventListener("mousedown", onMouseDown);
      ele.ownerDocument.addEventListener("mouseup", onMouseUp);
      ele.ownerDocument.addEventListener("mousemove", onMouseMove);
      return function() {
        ele.removeEventListener("mousedown", onMouseDown);
        ele.ownerDocument.removeEventListener("mouseup", onMouseUp);
        ele.ownerDocument.removeEventListener("mousemove", onMouseMove);
        stopScroll();
      };
    }
  }, [inVirtual]);
}
var MAX_TIMES = 10;
function useScrollTo(containerRef, data, heights, itemHeight, getKey3, collectHeight, syncScrollTop, triggerFlash) {
  var scrollRef = reactExports.useRef();
  var _React$useState = reactExports.useState(null), _React$useState2 = _slicedToArray(_React$useState, 2), syncState = _React$useState2[0], setSyncState = _React$useState2[1];
  useLayoutEffect(function() {
    if (syncState && syncState.times < MAX_TIMES) {
      if (!containerRef.current) {
        setSyncState(function(ori) {
          return _objectSpread2({}, ori);
        });
        return;
      }
      collectHeight();
      var targetAlign = syncState.targetAlign, originAlign = syncState.originAlign, index2 = syncState.index, offset2 = syncState.offset;
      var height = containerRef.current.clientHeight;
      var needCollectHeight = false;
      var newTargetAlign = targetAlign;
      var targetTop = null;
      if (height) {
        var mergedAlign = targetAlign || originAlign;
        var stackTop = 0;
        var itemTop = 0;
        var itemBottom = 0;
        var maxLen = Math.min(data.length - 1, index2);
        for (var i2 = 0; i2 <= maxLen; i2 += 1) {
          var key = getKey3(data[i2]);
          itemTop = stackTop;
          var cacheHeight = heights.get(key);
          itemBottom = itemTop + (cacheHeight === void 0 ? itemHeight : cacheHeight);
          stackTop = itemBottom;
        }
        var leftHeight = mergedAlign === "top" ? offset2 : height - offset2;
        for (var _i = maxLen; _i >= 0; _i -= 1) {
          var _key = getKey3(data[_i]);
          var _cacheHeight = heights.get(_key);
          if (_cacheHeight === void 0) {
            needCollectHeight = true;
            break;
          }
          leftHeight -= _cacheHeight;
          if (leftHeight <= 0) {
            break;
          }
        }
        switch (mergedAlign) {
          case "top":
            targetTop = itemTop - offset2;
            break;
          case "bottom":
            targetTop = itemBottom - height + offset2;
            break;
          default: {
            var scrollTop = containerRef.current.scrollTop;
            var scrollBottom = scrollTop + height;
            if (itemTop < scrollTop) {
              newTargetAlign = "top";
            } else if (itemBottom > scrollBottom) {
              newTargetAlign = "bottom";
            }
          }
        }
        if (targetTop !== null) {
          syncScrollTop(targetTop);
        }
        if (targetTop !== syncState.lastTop) {
          needCollectHeight = true;
        }
      }
      if (needCollectHeight) {
        setSyncState(_objectSpread2(_objectSpread2({}, syncState), {}, {
          times: syncState.times + 1,
          targetAlign: newTargetAlign,
          lastTop: targetTop
        }));
      }
    }
  }, [syncState, containerRef.current]);
  return function(arg) {
    if (arg === null || arg === void 0) {
      triggerFlash();
      return;
    }
    wrapperRaf.cancel(scrollRef.current);
    if (typeof arg === "number") {
      syncScrollTop(arg);
    } else if (arg && _typeof$1(arg) === "object") {
      var index2;
      var align = arg.align;
      if ("index" in arg) {
        index2 = arg.index;
      } else {
        index2 = data.findIndex(function(item) {
          return getKey3(item) === arg.key;
        });
      }
      var _arg$offset = arg.offset, offset2 = _arg$offset === void 0 ? 0 : _arg$offset;
      setSyncState({
        times: 0,
        index: index2,
        offset: offset2,
        originAlign: align
      });
    }
  };
}
var ScrollBar = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var prefixCls = props.prefixCls, rtl = props.rtl, scrollOffset = props.scrollOffset, scrollRange = props.scrollRange, onStartMove = props.onStartMove, onStopMove = props.onStopMove, onScroll6 = props.onScroll, horizontal = props.horizontal, spinSize = props.spinSize, containerSize = props.containerSize, style2 = props.style, propsThumbStyle = props.thumbStyle, showScrollBar = props.showScrollBar;
  var _React$useState = reactExports.useState(false), _React$useState2 = _slicedToArray(_React$useState, 2), dragging = _React$useState2[0], setDragging = _React$useState2[1];
  var _React$useState3 = reactExports.useState(null), _React$useState4 = _slicedToArray(_React$useState3, 2), pageXY = _React$useState4[0], setPageXY = _React$useState4[1];
  var _React$useState5 = reactExports.useState(null), _React$useState6 = _slicedToArray(_React$useState5, 2), startTop = _React$useState6[0], setStartTop = _React$useState6[1];
  var isLTR = !rtl;
  var scrollbarRef = reactExports.useRef();
  var thumbRef = reactExports.useRef();
  var _React$useState7 = reactExports.useState(showScrollBar), _React$useState8 = _slicedToArray(_React$useState7, 2), visible = _React$useState8[0], setVisible = _React$useState8[1];
  var visibleTimeoutRef = reactExports.useRef();
  var delayHidden = function delayHidden2() {
    if (showScrollBar === true || showScrollBar === false)
      return;
    clearTimeout(visibleTimeoutRef.current);
    setVisible(true);
    visibleTimeoutRef.current = setTimeout(function() {
      setVisible(false);
    }, 3e3);
  };
  var enableScrollRange = scrollRange - containerSize || 0;
  var enableOffsetRange = containerSize - spinSize || 0;
  var top2 = reactExports.useMemo(function() {
    if (scrollOffset === 0 || enableScrollRange === 0) {
      return 0;
    }
    var ptg = scrollOffset / enableScrollRange;
    return ptg * enableOffsetRange;
  }, [scrollOffset, enableScrollRange, enableOffsetRange]);
  var onContainerMouseDown = function onContainerMouseDown2(e2) {
    e2.stopPropagation();
    e2.preventDefault();
  };
  var stateRef = reactExports.useRef({
    top: top2,
    dragging,
    pageY: pageXY,
    startTop
  });
  stateRef.current = {
    top: top2,
    dragging,
    pageY: pageXY,
    startTop
  };
  var onThumbMouseDown = function onThumbMouseDown2(e2) {
    setDragging(true);
    setPageXY(getPageXY(e2, horizontal));
    setStartTop(stateRef.current.top);
    onStartMove();
    e2.stopPropagation();
    e2.preventDefault();
  };
  reactExports.useEffect(function() {
    var onScrollbarTouchStart = function onScrollbarTouchStart2(e2) {
      e2.preventDefault();
    };
    var scrollbarEle = scrollbarRef.current;
    var thumbEle = thumbRef.current;
    scrollbarEle.addEventListener("touchstart", onScrollbarTouchStart, {
      passive: false
    });
    thumbEle.addEventListener("touchstart", onThumbMouseDown, {
      passive: false
    });
    return function() {
      scrollbarEle.removeEventListener("touchstart", onScrollbarTouchStart);
      thumbEle.removeEventListener("touchstart", onThumbMouseDown);
    };
  }, []);
  var enableScrollRangeRef = reactExports.useRef();
  enableScrollRangeRef.current = enableScrollRange;
  var enableOffsetRangeRef = reactExports.useRef();
  enableOffsetRangeRef.current = enableOffsetRange;
  reactExports.useEffect(function() {
    if (dragging) {
      var moveRafId;
      var onMouseMove = function onMouseMove2(e2) {
        var _stateRef$current = stateRef.current, stateDragging = _stateRef$current.dragging, statePageY = _stateRef$current.pageY, stateStartTop = _stateRef$current.startTop;
        wrapperRaf.cancel(moveRafId);
        var rect = scrollbarRef.current.getBoundingClientRect();
        var scale2 = containerSize / (horizontal ? rect.width : rect.height);
        if (stateDragging) {
          var offset2 = (getPageXY(e2, horizontal) - statePageY) * scale2;
          var newTop = stateStartTop;
          if (!isLTR && horizontal) {
            newTop -= offset2;
          } else {
            newTop += offset2;
          }
          var tmpEnableScrollRange = enableScrollRangeRef.current;
          var tmpEnableOffsetRange = enableOffsetRangeRef.current;
          var ptg = tmpEnableOffsetRange ? newTop / tmpEnableOffsetRange : 0;
          var newScrollTop = Math.ceil(ptg * tmpEnableScrollRange);
          newScrollTop = Math.max(newScrollTop, 0);
          newScrollTop = Math.min(newScrollTop, tmpEnableScrollRange);
          moveRafId = wrapperRaf(function() {
            onScroll6(newScrollTop, horizontal);
          });
        }
      };
      var onMouseUp = function onMouseUp2() {
        setDragging(false);
        onStopMove();
      };
      window.addEventListener("mousemove", onMouseMove, {
        passive: true
      });
      window.addEventListener("touchmove", onMouseMove, {
        passive: true
      });
      window.addEventListener("mouseup", onMouseUp, {
        passive: true
      });
      window.addEventListener("touchend", onMouseUp, {
        passive: true
      });
      return function() {
        window.removeEventListener("mousemove", onMouseMove);
        window.removeEventListener("touchmove", onMouseMove);
        window.removeEventListener("mouseup", onMouseUp);
        window.removeEventListener("touchend", onMouseUp);
        wrapperRaf.cancel(moveRafId);
      };
    }
  }, [dragging]);
  reactExports.useEffect(function() {
    delayHidden();
    return function() {
      clearTimeout(visibleTimeoutRef.current);
    };
  }, [scrollOffset]);
  reactExports.useImperativeHandle(ref, function() {
    return {
      delayHidden
    };
  });
  var scrollbarPrefixCls = "".concat(prefixCls, "-scrollbar");
  var containerStyle = {
    position: "absolute",
    visibility: visible ? null : "hidden"
  };
  var thumbStyle = {
    position: "absolute",
    borderRadius: 99,
    background: "var(--rc-virtual-list-scrollbar-bg, rgba(0, 0, 0, 0.5))",
    cursor: "pointer",
    userSelect: "none"
  };
  if (horizontal) {
    Object.assign(containerStyle, {
      height: 8,
      left: 0,
      right: 0,
      bottom: 0
    });
    Object.assign(thumbStyle, _defineProperty$3({
      height: "100%",
      width: spinSize
    }, isLTR ? "left" : "right", top2));
  } else {
    Object.assign(containerStyle, _defineProperty$3({
      width: 8,
      top: 0,
      bottom: 0
    }, isLTR ? "right" : "left", 0));
    Object.assign(thumbStyle, {
      width: "100%",
      height: spinSize,
      top: top2
    });
  }
  return /* @__PURE__ */ reactExports.createElement("div", {
    ref: scrollbarRef,
    className: classNames(scrollbarPrefixCls, _defineProperty$3(_defineProperty$3(_defineProperty$3({}, "".concat(scrollbarPrefixCls, "-horizontal"), horizontal), "".concat(scrollbarPrefixCls, "-vertical"), !horizontal), "".concat(scrollbarPrefixCls, "-visible"), visible)),
    style: _objectSpread2(_objectSpread2({}, containerStyle), style2),
    onMouseDown: onContainerMouseDown,
    onMouseMove: delayHidden
  }, /* @__PURE__ */ reactExports.createElement("div", {
    ref: thumbRef,
    className: classNames("".concat(scrollbarPrefixCls, "-thumb"), _defineProperty$3({}, "".concat(scrollbarPrefixCls, "-thumb-moving"), dragging)),
    style: _objectSpread2(_objectSpread2({}, thumbStyle), propsThumbStyle),
    onMouseDown: onThumbMouseDown
  }));
});
var MIN_SIZE = 20;
function getSpinSize() {
  var containerSize = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
  var scrollRange = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
  var baseSize = containerSize / scrollRange * containerSize;
  if (isNaN(baseSize)) {
    baseSize = 0;
  }
  baseSize = Math.max(baseSize, MIN_SIZE);
  return Math.floor(baseSize);
}
var _excluded$n = ["prefixCls", "className", "height", "itemHeight", "fullHeight", "style", "data", "children", "itemKey", "virtual", "direction", "scrollWidth", "component", "onScroll", "onVirtualScroll", "onVisibleChange", "innerProps", "extraRender", "styles", "showScrollBar"];
var EMPTY_DATA = [];
var ScrollStyle = {
  overflowY: "auto",
  overflowAnchor: "none"
};
function RawList(props, ref) {
  var _props$prefixCls = props.prefixCls, prefixCls = _props$prefixCls === void 0 ? "rc-virtual-list" : _props$prefixCls, className = props.className, height = props.height, itemHeight = props.itemHeight, _props$fullHeight = props.fullHeight, fullHeight = _props$fullHeight === void 0 ? true : _props$fullHeight, style2 = props.style, data = props.data, children = props.children, itemKey2 = props.itemKey, virtual = props.virtual, direction = props.direction, scrollWidth = props.scrollWidth, _props$component = props.component, Component2 = _props$component === void 0 ? "div" : _props$component, onScroll6 = props.onScroll, onVirtualScroll = props.onVirtualScroll, onVisibleChange = props.onVisibleChange, innerProps = props.innerProps, extraRender = props.extraRender, styles2 = props.styles, _props$showScrollBar = props.showScrollBar, showScrollBar = _props$showScrollBar === void 0 ? "optional" : _props$showScrollBar, restProps = _objectWithoutProperties$3(props, _excluded$n);
  var getKey3 = reactExports.useCallback(function(item) {
    if (typeof itemKey2 === "function") {
      return itemKey2(item);
    }
    return item === null || item === void 0 ? void 0 : item[itemKey2];
  }, [itemKey2]);
  var _useHeights = useHeights(getKey3), _useHeights2 = _slicedToArray(_useHeights, 4), setInstanceRef = _useHeights2[0], collectHeight = _useHeights2[1], heights = _useHeights2[2], heightUpdatedMark = _useHeights2[3];
  var useVirtual = !!(virtual !== false && height && itemHeight);
  var containerHeight = reactExports.useMemo(function() {
    return Object.values(heights.maps).reduce(function(total, curr) {
      return total + curr;
    }, 0);
  }, [heights.id, heights.maps]);
  var inVirtual = useVirtual && data && (Math.max(itemHeight * data.length, containerHeight) > height || !!scrollWidth);
  var isRTL = direction === "rtl";
  var mergedClassName = classNames(prefixCls, _defineProperty$3({}, "".concat(prefixCls, "-rtl"), isRTL), className);
  var mergedData = data || EMPTY_DATA;
  var componentRef = reactExports.useRef();
  var fillerInnerRef = reactExports.useRef();
  var containerRef = reactExports.useRef();
  var _useState = reactExports.useState(0), _useState2 = _slicedToArray(_useState, 2), offsetTop = _useState2[0], setOffsetTop = _useState2[1];
  var _useState3 = reactExports.useState(0), _useState4 = _slicedToArray(_useState3, 2), offsetLeft = _useState4[0], setOffsetLeft = _useState4[1];
  var _useState5 = reactExports.useState(false), _useState6 = _slicedToArray(_useState5, 2), scrollMoving = _useState6[0], setScrollMoving = _useState6[1];
  var onScrollbarStartMove = function onScrollbarStartMove2() {
    setScrollMoving(true);
  };
  var onScrollbarStopMove = function onScrollbarStopMove2() {
    setScrollMoving(false);
  };
  var sharedConfig = {
    getKey: getKey3
  };
  function syncScrollTop(newTop) {
    setOffsetTop(function(origin2) {
      var value2;
      if (typeof newTop === "function") {
        value2 = newTop(origin2);
      } else {
        value2 = newTop;
      }
      var alignedTop = keepInRange(value2);
      componentRef.current.scrollTop = alignedTop;
      return alignedTop;
    });
  }
  var rangeRef = reactExports.useRef({
    start: 0,
    end: mergedData.length
  });
  var diffItemRef = reactExports.useRef();
  var _useDiffItem = useDiffItem(mergedData, getKey3), _useDiffItem2 = _slicedToArray(_useDiffItem, 1), diffItem = _useDiffItem2[0];
  diffItemRef.current = diffItem;
  var _React$useMemo = reactExports.useMemo(function() {
    if (!useVirtual) {
      return {
        scrollHeight: void 0,
        start: 0,
        end: mergedData.length - 1,
        offset: void 0
      };
    }
    if (!inVirtual) {
      var _fillerInnerRef$curre;
      return {
        scrollHeight: ((_fillerInnerRef$curre = fillerInnerRef.current) === null || _fillerInnerRef$curre === void 0 ? void 0 : _fillerInnerRef$curre.offsetHeight) || 0,
        start: 0,
        end: mergedData.length - 1,
        offset: void 0
      };
    }
    var itemTop = 0;
    var startIndex;
    var startOffset;
    var endIndex;
    var dataLen = mergedData.length;
    for (var i2 = 0; i2 < dataLen; i2 += 1) {
      var _item = mergedData[i2];
      var key = getKey3(_item);
      var cacheHeight = heights.get(key);
      var currentItemBottom = itemTop + (cacheHeight === void 0 ? itemHeight : cacheHeight);
      if (currentItemBottom >= offsetTop && startIndex === void 0) {
        startIndex = i2;
        startOffset = itemTop;
      }
      if (currentItemBottom > offsetTop + height && endIndex === void 0) {
        endIndex = i2;
      }
      itemTop = currentItemBottom;
    }
    if (startIndex === void 0) {
      startIndex = 0;
      startOffset = 0;
      endIndex = Math.ceil(height / itemHeight);
    }
    if (endIndex === void 0) {
      endIndex = mergedData.length - 1;
    }
    endIndex = Math.min(endIndex + 1, mergedData.length - 1);
    return {
      scrollHeight: itemTop,
      start: startIndex,
      end: endIndex,
      offset: startOffset
    };
  }, [inVirtual, useVirtual, offsetTop, mergedData, heightUpdatedMark, height]), scrollHeight = _React$useMemo.scrollHeight, start2 = _React$useMemo.start, end2 = _React$useMemo.end, fillerOffset = _React$useMemo.offset;
  rangeRef.current.start = start2;
  rangeRef.current.end = end2;
  reactExports.useLayoutEffect(function() {
    var changedRecord = heights.getRecord();
    if (changedRecord.size === 1) {
      var recordKey = Array.from(changedRecord.keys())[0];
      var prevCacheHeight = changedRecord.get(recordKey);
      var startItem = mergedData[start2];
      if (startItem && prevCacheHeight === void 0) {
        var startIndexKey = getKey3(startItem);
        if (startIndexKey === recordKey) {
          var realStartHeight = heights.get(recordKey);
          var diffHeight = realStartHeight - itemHeight;
          syncScrollTop(function(ori) {
            return ori + diffHeight;
          });
        }
      }
    }
    heights.resetRecord();
  }, [scrollHeight]);
  var _React$useState = reactExports.useState({
    width: 0,
    height
  }), _React$useState2 = _slicedToArray(_React$useState, 2), size2 = _React$useState2[0], setSize = _React$useState2[1];
  var onHolderResize = function onHolderResize2(sizeInfo) {
    setSize({
      width: sizeInfo.offsetWidth,
      height: sizeInfo.offsetHeight
    });
  };
  var verticalScrollBarRef = reactExports.useRef();
  var horizontalScrollBarRef = reactExports.useRef();
  var horizontalScrollBarSpinSize = reactExports.useMemo(function() {
    return getSpinSize(size2.width, scrollWidth);
  }, [size2.width, scrollWidth]);
  var verticalScrollBarSpinSize = reactExports.useMemo(function() {
    return getSpinSize(size2.height, scrollHeight);
  }, [size2.height, scrollHeight]);
  var maxScrollHeight = scrollHeight - height;
  var maxScrollHeightRef = reactExports.useRef(maxScrollHeight);
  maxScrollHeightRef.current = maxScrollHeight;
  function keepInRange(newScrollTop) {
    var newTop = newScrollTop;
    if (!Number.isNaN(maxScrollHeightRef.current)) {
      newTop = Math.min(newTop, maxScrollHeightRef.current);
    }
    newTop = Math.max(newTop, 0);
    return newTop;
  }
  var isScrollAtTop = offsetTop <= 0;
  var isScrollAtBottom = offsetTop >= maxScrollHeight;
  var isScrollAtLeft = offsetLeft <= 0;
  var isScrollAtRight = offsetLeft >= scrollWidth;
  var originScroll = useOriginScroll(isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight);
  var getVirtualScrollInfo = function getVirtualScrollInfo2() {
    return {
      x: isRTL ? -offsetLeft : offsetLeft,
      y: offsetTop
    };
  };
  var lastVirtualScrollInfoRef = reactExports.useRef(getVirtualScrollInfo());
  var triggerScroll = useEvent$1(function(params) {
    if (onVirtualScroll) {
      var nextInfo = _objectSpread2(_objectSpread2({}, getVirtualScrollInfo()), params);
      if (lastVirtualScrollInfoRef.current.x !== nextInfo.x || lastVirtualScrollInfoRef.current.y !== nextInfo.y) {
        onVirtualScroll(nextInfo);
        lastVirtualScrollInfoRef.current = nextInfo;
      }
    }
  });
  function onScrollBar(newScrollOffset, horizontal) {
    var newOffset = newScrollOffset;
    if (horizontal) {
      reactDomExports.flushSync(function() {
        setOffsetLeft(newOffset);
      });
      triggerScroll();
    } else {
      syncScrollTop(newOffset);
    }
  }
  function onFallbackScroll(e2) {
    var newScrollTop = e2.currentTarget.scrollTop;
    if (newScrollTop !== offsetTop) {
      syncScrollTop(newScrollTop);
    }
    onScroll6 === null || onScroll6 === void 0 || onScroll6(e2);
    triggerScroll();
  }
  var keepInHorizontalRange = function keepInHorizontalRange2(nextOffsetLeft) {
    var tmpOffsetLeft = nextOffsetLeft;
    var max2 = !!scrollWidth ? scrollWidth - size2.width : 0;
    tmpOffsetLeft = Math.max(tmpOffsetLeft, 0);
    tmpOffsetLeft = Math.min(tmpOffsetLeft, max2);
    return tmpOffsetLeft;
  };
  var onWheelDelta = useEvent$1(function(offsetXY, fromHorizontal) {
    if (fromHorizontal) {
      reactDomExports.flushSync(function() {
        setOffsetLeft(function(left2) {
          var nextOffsetLeft = left2 + (isRTL ? -offsetXY : offsetXY);
          return keepInHorizontalRange(nextOffsetLeft);
        });
      });
      triggerScroll();
    } else {
      syncScrollTop(function(top2) {
        var newTop = top2 + offsetXY;
        return newTop;
      });
    }
  });
  var _useFrameWheel = useFrameWheel(useVirtual, isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight, !!scrollWidth, onWheelDelta), _useFrameWheel2 = _slicedToArray(_useFrameWheel, 2), onRawWheel = _useFrameWheel2[0], onFireFoxScroll = _useFrameWheel2[1];
  useMobileTouchMove(useVirtual, componentRef, function(isHorizontal, delta, smoothOffset, e2) {
    var event = e2;
    if (originScroll(isHorizontal, delta, smoothOffset)) {
      return false;
    }
    if (!event || !event._virtualHandled) {
      if (event) {
        event._virtualHandled = true;
      }
      onRawWheel({
        preventDefault: function preventDefault2() {
        },
        deltaX: isHorizontal ? delta : 0,
        deltaY: isHorizontal ? 0 : delta
      });
      return true;
    }
    return false;
  });
  useScrollDrag(inVirtual, componentRef, function(offset2) {
    syncScrollTop(function(top2) {
      return top2 + offset2;
    });
  });
  useLayoutEffect(function() {
    function onMozMousePixelScroll(e2) {
      var scrollingUpAtTop = isScrollAtTop && e2.detail < 0;
      var scrollingDownAtBottom = isScrollAtBottom && e2.detail > 0;
      if (useVirtual && !scrollingUpAtTop && !scrollingDownAtBottom) {
        e2.preventDefault();
      }
    }
    var componentEle = componentRef.current;
    componentEle.addEventListener("wheel", onRawWheel, {
      passive: false
    });
    componentEle.addEventListener("DOMMouseScroll", onFireFoxScroll, {
      passive: true
    });
    componentEle.addEventListener("MozMousePixelScroll", onMozMousePixelScroll, {
      passive: false
    });
    return function() {
      componentEle.removeEventListener("wheel", onRawWheel);
      componentEle.removeEventListener("DOMMouseScroll", onFireFoxScroll);
      componentEle.removeEventListener("MozMousePixelScroll", onMozMousePixelScroll);
    };
  }, [useVirtual, isScrollAtTop, isScrollAtBottom]);
  useLayoutEffect(function() {
    if (scrollWidth) {
      var newOffsetLeft = keepInHorizontalRange(offsetLeft);
      setOffsetLeft(newOffsetLeft);
      triggerScroll({
        x: newOffsetLeft
      });
    }
  }, [size2.width, scrollWidth]);
  var delayHideScrollBar = function delayHideScrollBar2() {
    var _verticalScrollBarRef, _horizontalScrollBarR;
    (_verticalScrollBarRef = verticalScrollBarRef.current) === null || _verticalScrollBarRef === void 0 || _verticalScrollBarRef.delayHidden();
    (_horizontalScrollBarR = horizontalScrollBarRef.current) === null || _horizontalScrollBarR === void 0 || _horizontalScrollBarR.delayHidden();
  };
  var _scrollTo = useScrollTo(componentRef, mergedData, heights, itemHeight, getKey3, function() {
    return collectHeight(true);
  }, syncScrollTop, delayHideScrollBar);
  reactExports.useImperativeHandle(ref, function() {
    return {
      nativeElement: containerRef.current,
      getScrollInfo: getVirtualScrollInfo,
      scrollTo: function scrollTo(config2) {
        function isPosScroll(arg) {
          return arg && _typeof$1(arg) === "object" && ("left" in arg || "top" in arg);
        }
        if (isPosScroll(config2)) {
          if (config2.left !== void 0) {
            setOffsetLeft(keepInHorizontalRange(config2.left));
          }
          _scrollTo(config2.top);
        } else {
          _scrollTo(config2);
        }
      }
    };
  });
  useLayoutEffect(function() {
    if (onVisibleChange) {
      var renderList = mergedData.slice(start2, end2 + 1);
      onVisibleChange(renderList, mergedData);
    }
  }, [start2, end2, mergedData]);
  var getSize = useGetSize(mergedData, getKey3, heights, itemHeight);
  var extraContent = extraRender === null || extraRender === void 0 ? void 0 : extraRender({
    start: start2,
    end: end2,
    virtual: inVirtual,
    offsetX: offsetLeft,
    offsetY: fillerOffset,
    rtl: isRTL,
    getSize
  });
  var listChildren = useChildren(mergedData, start2, end2, scrollWidth, offsetLeft, setInstanceRef, children, sharedConfig);
  var componentStyle = null;
  if (height) {
    componentStyle = _objectSpread2(_defineProperty$3({}, fullHeight ? "height" : "maxHeight", height), ScrollStyle);
    if (useVirtual) {
      componentStyle.overflowY = "hidden";
      if (scrollWidth) {
        componentStyle.overflowX = "hidden";
      }
      if (scrollMoving) {
        componentStyle.pointerEvents = "none";
      }
    }
  }
  var containerProps = {};
  if (isRTL) {
    containerProps.dir = "rtl";
  }
  return /* @__PURE__ */ reactExports.createElement("div", _extends$h({
    ref: containerRef,
    style: _objectSpread2(_objectSpread2({}, style2), {}, {
      position: "relative"
    }),
    className: mergedClassName
  }, containerProps, restProps), /* @__PURE__ */ reactExports.createElement(RefResizeObserver, {
    onResize: onHolderResize
  }, /* @__PURE__ */ reactExports.createElement(Component2, {
    className: "".concat(prefixCls, "-holder"),
    style: componentStyle,
    ref: componentRef,
    onScroll: onFallbackScroll,
    onMouseEnter: delayHideScrollBar
  }, /* @__PURE__ */ reactExports.createElement(Filler, {
    prefixCls,
    height: scrollHeight,
    offsetX: offsetLeft,
    offsetY: fillerOffset,
    scrollWidth,
    onInnerResize: collectHeight,
    ref: fillerInnerRef,
    innerProps,
    rtl: isRTL,
    extra: extraContent
  }, listChildren))), inVirtual && scrollHeight > height && /* @__PURE__ */ reactExports.createElement(ScrollBar, {
    ref: verticalScrollBarRef,
    prefixCls,
    scrollOffset: offsetTop,
    scrollRange: scrollHeight,
    rtl: isRTL,
    onScroll: onScrollBar,
    onStartMove: onScrollbarStartMove,
    onStopMove: onScrollbarStopMove,
    spinSize: verticalScrollBarSpinSize,
    containerSize: size2.height,
    style: styles2 === null || styles2 === void 0 ? void 0 : styles2.verticalScrollBar,
    thumbStyle: styles2 === null || styles2 === void 0 ? void 0 : styles2.verticalScrollBarThumb,
    showScrollBar
  }), inVirtual && scrollWidth > size2.width && /* @__PURE__ */ reactExports.createElement(ScrollBar, {
    ref: horizontalScrollBarRef,
    prefixCls,
    scrollOffset: offsetLeft,
    scrollRange: scrollWidth,
    rtl: isRTL,
    onScroll: onScrollBar,
    onStartMove: onScrollbarStartMove,
    onStopMove: onScrollbarStopMove,
    spinSize: horizontalScrollBarSpinSize,
    containerSize: size2.width,
    horizontal: true,
    style: styles2 === null || styles2 === void 0 ? void 0 : styles2.horizontalScrollBar,
    thumbStyle: styles2 === null || styles2 === void 0 ? void 0 : styles2.horizontalScrollBarThumb,
    showScrollBar
  }));
}
var List$2 = /* @__PURE__ */ reactExports.forwardRef(RawList);
List$2.displayName = "List";
var SearchOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z" } }] }, "name": "search", "theme": "outlined" };
var SearchOutlined = function SearchOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: SearchOutlined$1
  }));
};
var RefIcon$1h = /* @__PURE__ */ reactExports.forwardRef(SearchOutlined);
function Popup(props) {
  var children = props.children, prefixCls = props.prefixCls, id2 = props.id, innerStyle = props.overlayInnerStyle, bodyClassName = props.bodyClassName, className = props.className, style2 = props.style;
  return /* @__PURE__ */ reactExports.createElement("div", {
    className: classNames("".concat(prefixCls, "-content"), className),
    style: style2
  }, /* @__PURE__ */ reactExports.createElement("div", {
    className: classNames("".concat(prefixCls, "-inner"), bodyClassName),
    id: id2,
    role: "tooltip",
    style: innerStyle
  }, typeof children === "function" ? children() : children));
}
var autoAdjustOverflowTopBottom = {
  shiftX: 64,
  adjustY: 1
};
var autoAdjustOverflowLeftRight = {
  adjustX: 1,
  shiftY: true
};
var targetOffset = [0, 0];
var placements$1 = {
  left: {
    points: ["cr", "cl"],
    overflow: autoAdjustOverflowLeftRight,
    offset: [-4, 0],
    targetOffset
  },
  right: {
    points: ["cl", "cr"],
    overflow: autoAdjustOverflowLeftRight,
    offset: [4, 0],
    targetOffset
  },
  top: {
    points: ["bc", "tc"],
    overflow: autoAdjustOverflowTopBottom,
    offset: [0, -4],
    targetOffset
  },
  bottom: {
    points: ["tc", "bc"],
    overflow: autoAdjustOverflowTopBottom,
    offset: [0, 4],
    targetOffset
  },
  topLeft: {
    points: ["bl", "tl"],
    overflow: autoAdjustOverflowTopBottom,
    offset: [0, -4],
    targetOffset
  },
  leftTop: {
    points: ["tr", "tl"],
    overflow: autoAdjustOverflowLeftRight,
    offset: [-4, 0],
    targetOffset
  },
  topRight: {
    points: ["br", "tr"],
    overflow: autoAdjustOverflowTopBottom,
    offset: [0, -4],
    targetOffset
  },
  rightTop: {
    points: ["tl", "tr"],
    overflow: autoAdjustOverflowLeftRight,
    offset: [4, 0],
    targetOffset
  },
  bottomRight: {
    points: ["tr", "br"],
    overflow: autoAdjustOverflowTopBottom,
    offset: [0, 4],
    targetOffset
  },
  rightBottom: {
    points: ["bl", "br"],
    overflow: autoAdjustOverflowLeftRight,
    offset: [4, 0],
    targetOffset
  },
  bottomLeft: {
    points: ["tl", "bl"],
    overflow: autoAdjustOverflowTopBottom,
    offset: [0, 4],
    targetOffset
  },
  leftBottom: {
    points: ["br", "bl"],
    overflow: autoAdjustOverflowLeftRight,
    offset: [-4, 0],
    targetOffset
  }
};
var _excluded$m = ["overlayClassName", "trigger", "mouseEnterDelay", "mouseLeaveDelay", "overlayStyle", "prefixCls", "children", "onVisibleChange", "afterVisibleChange", "transitionName", "animation", "motion", "placement", "align", "destroyTooltipOnHide", "defaultVisible", "getTooltipContainer", "overlayInnerStyle", "arrowContent", "overlay", "id", "showArrow", "classNames", "styles"];
var Tooltip$3 = function Tooltip(props, ref) {
  var overlayClassName = props.overlayClassName, _props$trigger = props.trigger, trigger = _props$trigger === void 0 ? ["hover"] : _props$trigger, _props$mouseEnterDela = props.mouseEnterDelay, mouseEnterDelay = _props$mouseEnterDela === void 0 ? 0 : _props$mouseEnterDela, _props$mouseLeaveDela = props.mouseLeaveDelay, mouseLeaveDelay = _props$mouseLeaveDela === void 0 ? 0.1 : _props$mouseLeaveDela, overlayStyle = props.overlayStyle, _props$prefixCls = props.prefixCls, prefixCls = _props$prefixCls === void 0 ? "rc-tooltip" : _props$prefixCls, children = props.children, onVisibleChange = props.onVisibleChange, afterVisibleChange = props.afterVisibleChange, transitionName = props.transitionName, animation = props.animation, motion = props.motion, _props$placement = props.placement, placement = _props$placement === void 0 ? "right" : _props$placement, _props$align = props.align, align = _props$align === void 0 ? {} : _props$align, _props$destroyTooltip = props.destroyTooltipOnHide, destroyTooltipOnHide = _props$destroyTooltip === void 0 ? false : _props$destroyTooltip, defaultVisible = props.defaultVisible, getTooltipContainer = props.getTooltipContainer, overlayInnerStyle = props.overlayInnerStyle;
  props.arrowContent;
  var overlay = props.overlay, id2 = props.id, _props$showArrow = props.showArrow, showArrow = _props$showArrow === void 0 ? true : _props$showArrow, tooltipClassNames = props.classNames, tooltipStyles = props.styles, restProps = _objectWithoutProperties$3(props, _excluded$m);
  var mergedId = useId(id2);
  var triggerRef = reactExports.useRef(null);
  reactExports.useImperativeHandle(ref, function() {
    return triggerRef.current;
  });
  var extraProps = _objectSpread2({}, restProps);
  if ("visible" in props) {
    extraProps.popupVisible = props.visible;
  }
  var getPopupElement = function getPopupElement2() {
    return /* @__PURE__ */ reactExports.createElement(Popup, {
      key: "content",
      prefixCls,
      id: mergedId,
      bodyClassName: tooltipClassNames === null || tooltipClassNames === void 0 ? void 0 : tooltipClassNames.body,
      overlayInnerStyle: _objectSpread2(_objectSpread2({}, overlayInnerStyle), tooltipStyles === null || tooltipStyles === void 0 ? void 0 : tooltipStyles.body)
    }, overlay);
  };
  var getChildren2 = function getChildren3() {
    var child = reactExports.Children.only(children);
    var originalProps = (child === null || child === void 0 ? void 0 : child.props) || {};
    var childProps = _objectSpread2(_objectSpread2({}, originalProps), {}, {
      "aria-describedby": overlay ? mergedId : null
    });
    return /* @__PURE__ */ reactExports.cloneElement(children, childProps);
  };
  return /* @__PURE__ */ reactExports.createElement(Trigger, _extends$h({
    popupClassName: classNames(overlayClassName, tooltipClassNames === null || tooltipClassNames === void 0 ? void 0 : tooltipClassNames.root),
    prefixCls,
    popup: getPopupElement,
    action: trigger,
    builtinPlacements: placements$1,
    popupPlacement: placement,
    ref: triggerRef,
    popupAlign: align,
    getPopupContainer: getTooltipContainer,
    onPopupVisibleChange: onVisibleChange,
    afterPopupVisibleChange: afterVisibleChange,
    popupTransitionName: transitionName,
    popupAnimation: animation,
    popupMotion: motion,
    defaultPopupVisible: defaultVisible,
    autoDestroy: destroyTooltipOnHide,
    mouseLeaveDelay,
    popupStyle: _objectSpread2(_objectSpread2({}, overlayStyle), tooltipStyles === null || tooltipStyles === void 0 ? void 0 : tooltipStyles.root),
    mouseEnterDelay,
    arrow: showArrow
  }, extraProps), getChildren2());
};
const Tooltip$4 = /* @__PURE__ */ reactExports.forwardRef(Tooltip$3);
function getArrowToken(token2) {
  const {
    sizePopupArrow,
    borderRadiusXS,
    borderRadiusOuter
  } = token2;
  const unitWidth = sizePopupArrow / 2;
  const ax = 0;
  const ay = unitWidth;
  const bx = borderRadiusOuter * 1 / Math.sqrt(2);
  const by = unitWidth - borderRadiusOuter * (1 - 1 / Math.sqrt(2));
  const cx = unitWidth - borderRadiusXS * (1 / Math.sqrt(2));
  const cy = borderRadiusOuter * (Math.sqrt(2) - 1) + borderRadiusXS * (1 / Math.sqrt(2));
  const dx = 2 * unitWidth - cx;
  const dy = cy;
  const ex = 2 * unitWidth - bx;
  const ey = by;
  const fx = 2 * unitWidth - ax;
  const fy = ay;
  const shadowWidth = unitWidth * Math.sqrt(2) + borderRadiusOuter * (Math.sqrt(2) - 2);
  const polygonOffset = borderRadiusOuter * (Math.sqrt(2) - 1);
  const arrowPolygon = `polygon(${polygonOffset}px 100%, 50% ${polygonOffset}px, ${2 * unitWidth - polygonOffset}px 100%, ${polygonOffset}px 100%)`;
  const arrowPath = `path('M ${ax} ${ay} A ${borderRadiusOuter} ${borderRadiusOuter} 0 0 0 ${bx} ${by} L ${cx} ${cy} A ${borderRadiusXS} ${borderRadiusXS} 0 0 1 ${dx} ${dy} L ${ex} ${ey} A ${borderRadiusOuter} ${borderRadiusOuter} 0 0 0 ${fx} ${fy} Z')`;
  return {
    arrowShadowWidth: shadowWidth,
    arrowPath,
    arrowPolygon
  };
}
const genRoundedArrow = (token2, bgColor, boxShadow2) => {
  const {
    sizePopupArrow,
    arrowPolygon,
    arrowPath,
    arrowShadowWidth,
    borderRadiusXS,
    calc
  } = token2;
  return {
    pointerEvents: "none",
    width: sizePopupArrow,
    height: sizePopupArrow,
    overflow: "hidden",
    "&::before": {
      position: "absolute",
      bottom: 0,
      insetInlineStart: 0,
      width: sizePopupArrow,
      height: calc(sizePopupArrow).div(2).equal(),
      background: bgColor,
      clipPath: {
        _multi_value_: true,
        value: [arrowPolygon, arrowPath]
      },
      content: '""'
    },
    "&::after": {
      content: '""',
      position: "absolute",
      width: arrowShadowWidth,
      height: arrowShadowWidth,
      bottom: 0,
      insetInline: 0,
      margin: "auto",
      borderRadius: {
        _skip_check_: true,
        value: `0 0 ${unit$1(borderRadiusXS)} 0`
      },
      transform: "translateY(50%) rotate(-135deg)",
      boxShadow: boxShadow2,
      zIndex: 0,
      background: "transparent"
    }
  };
};
const MAX_VERTICAL_CONTENT_RADIUS = 8;
function getArrowOffsetToken(options) {
  const {
    contentRadius,
    limitVerticalRadius
  } = options;
  const arrowOffset = contentRadius > 12 ? contentRadius + 2 : 12;
  const arrowOffsetVertical = limitVerticalRadius ? MAX_VERTICAL_CONTENT_RADIUS : arrowOffset;
  return {
    arrowOffsetHorizontal: arrowOffset,
    arrowOffsetVertical
  };
}
function isInject(valid2, code2) {
  if (!valid2) {
    return {};
  }
  return code2;
}
function getArrowStyle(token2, colorBg, options) {
  const {
    componentCls,
    boxShadowPopoverArrow,
    arrowOffsetVertical,
    arrowOffsetHorizontal
  } = token2;
  const {
    arrowDistance = 0,
    arrowPlacement = {
      left: true,
      right: true,
      top: true,
      bottom: true
    }
  } = {};
  return {
    [componentCls]: Object.assign(Object.assign(Object.assign(Object.assign({
      // ============================ Basic ============================
      [`${componentCls}-arrow`]: [Object.assign(Object.assign({
        position: "absolute",
        zIndex: 1,
        display: "block"
      }, genRoundedArrow(token2, colorBg, boxShadowPopoverArrow)), {
        "&:before": {
          background: colorBg
        }
      })]
    }, isInject(!!arrowPlacement.top, {
      [[`&-placement-top > ${componentCls}-arrow`, `&-placement-topLeft > ${componentCls}-arrow`, `&-placement-topRight > ${componentCls}-arrow`].join(",")]: {
        bottom: arrowDistance,
        transform: "translateY(100%) rotate(180deg)"
      },
      [`&-placement-top > ${componentCls}-arrow`]: {
        left: {
          _skip_check_: true,
          value: "50%"
        },
        transform: "translateX(-50%) translateY(100%) rotate(180deg)"
      },
      "&-placement-topLeft": {
        "--arrow-offset-horizontal": arrowOffsetHorizontal,
        [`> ${componentCls}-arrow`]: {
          left: {
            _skip_check_: true,
            value: arrowOffsetHorizontal
          }
        }
      },
      "&-placement-topRight": {
        "--arrow-offset-horizontal": `calc(100% - ${unit$1(arrowOffsetHorizontal)})`,
        [`> ${componentCls}-arrow`]: {
          right: {
            _skip_check_: true,
            value: arrowOffsetHorizontal
          }
        }
      }
    })), isInject(!!arrowPlacement.bottom, {
      [[`&-placement-bottom > ${componentCls}-arrow`, `&-placement-bottomLeft > ${componentCls}-arrow`, `&-placement-bottomRight > ${componentCls}-arrow`].join(",")]: {
        top: arrowDistance,
        transform: `translateY(-100%)`
      },
      [`&-placement-bottom > ${componentCls}-arrow`]: {
        left: {
          _skip_check_: true,
          value: "50%"
        },
        transform: `translateX(-50%) translateY(-100%)`
      },
      "&-placement-bottomLeft": {
        "--arrow-offset-horizontal": arrowOffsetHorizontal,
        [`> ${componentCls}-arrow`]: {
          left: {
            _skip_check_: true,
            value: arrowOffsetHorizontal
          }
        }
      },
      "&-placement-bottomRight": {
        "--arrow-offset-horizontal": `calc(100% - ${unit$1(arrowOffsetHorizontal)})`,
        [`> ${componentCls}-arrow`]: {
          right: {
            _skip_check_: true,
            value: arrowOffsetHorizontal
          }
        }
      }
    })), isInject(!!arrowPlacement.left, {
      [[`&-placement-left > ${componentCls}-arrow`, `&-placement-leftTop > ${componentCls}-arrow`, `&-placement-leftBottom > ${componentCls}-arrow`].join(",")]: {
        right: {
          _skip_check_: true,
          value: arrowDistance
        },
        transform: "translateX(100%) rotate(90deg)"
      },
      [`&-placement-left > ${componentCls}-arrow`]: {
        top: {
          _skip_check_: true,
          value: "50%"
        },
        transform: "translateY(-50%) translateX(100%) rotate(90deg)"
      },
      [`&-placement-leftTop > ${componentCls}-arrow`]: {
        top: arrowOffsetVertical
      },
      [`&-placement-leftBottom > ${componentCls}-arrow`]: {
        bottom: arrowOffsetVertical
      }
    })), isInject(!!arrowPlacement.right, {
      [[`&-placement-right > ${componentCls}-arrow`, `&-placement-rightTop > ${componentCls}-arrow`, `&-placement-rightBottom > ${componentCls}-arrow`].join(",")]: {
        left: {
          _skip_check_: true,
          value: arrowDistance
        },
        transform: "translateX(-100%) rotate(-90deg)"
      },
      [`&-placement-right > ${componentCls}-arrow`]: {
        top: {
          _skip_check_: true,
          value: "50%"
        },
        transform: "translateY(-50%) translateX(-100%) rotate(-90deg)"
      },
      [`&-placement-rightTop > ${componentCls}-arrow`]: {
        top: arrowOffsetVertical
      },
      [`&-placement-rightBottom > ${componentCls}-arrow`]: {
        bottom: arrowOffsetVertical
      }
    }))
  };
}
function getOverflowOptions(placement, arrowOffset, arrowWidth, autoAdjustOverflow2) {
  if (autoAdjustOverflow2 === false) {
    return {
      adjustX: false,
      adjustY: false
    };
  }
  const overflow = autoAdjustOverflow2 && typeof autoAdjustOverflow2 === "object" ? autoAdjustOverflow2 : {};
  const baseOverflow = {};
  switch (placement) {
    case "top":
    case "bottom":
      baseOverflow.shiftX = arrowOffset.arrowOffsetHorizontal * 2 + arrowWidth;
      baseOverflow.shiftY = true;
      baseOverflow.adjustY = true;
      break;
    case "left":
    case "right":
      baseOverflow.shiftY = arrowOffset.arrowOffsetVertical * 2 + arrowWidth;
      baseOverflow.shiftX = true;
      baseOverflow.adjustX = true;
      break;
  }
  const mergedOverflow = Object.assign(Object.assign({}, baseOverflow), overflow);
  if (!mergedOverflow.shiftX) {
    mergedOverflow.adjustX = true;
  }
  if (!mergedOverflow.shiftY) {
    mergedOverflow.adjustY = true;
  }
  return mergedOverflow;
}
const PlacementAlignMap = {
  left: {
    points: ["cr", "cl"]
  },
  right: {
    points: ["cl", "cr"]
  },
  top: {
    points: ["bc", "tc"]
  },
  bottom: {
    points: ["tc", "bc"]
  },
  topLeft: {
    points: ["bl", "tl"]
  },
  leftTop: {
    points: ["tr", "tl"]
  },
  topRight: {
    points: ["br", "tr"]
  },
  rightTop: {
    points: ["tl", "tr"]
  },
  bottomRight: {
    points: ["tr", "br"]
  },
  rightBottom: {
    points: ["bl", "br"]
  },
  bottomLeft: {
    points: ["tl", "bl"]
  },
  leftBottom: {
    points: ["br", "bl"]
  }
};
const ArrowCenterPlacementAlignMap = {
  topLeft: {
    points: ["bl", "tc"]
  },
  leftTop: {
    points: ["tr", "cl"]
  },
  topRight: {
    points: ["br", "tc"]
  },
  rightTop: {
    points: ["tl", "cr"]
  },
  bottomRight: {
    points: ["tr", "bc"]
  },
  rightBottom: {
    points: ["bl", "cr"]
  },
  bottomLeft: {
    points: ["tl", "bc"]
  },
  leftBottom: {
    points: ["br", "cl"]
  }
};
const DisableAutoArrowList = /* @__PURE__ */ new Set(["topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]);
function getPlacements(config2) {
  const {
    arrowWidth,
    autoAdjustOverflow: autoAdjustOverflow2,
    arrowPointAtCenter,
    offset: offset2,
    borderRadius: borderRadius2
  } = config2;
  const halfArrowWidth = arrowWidth / 2;
  const placementMap = {};
  Object.keys(PlacementAlignMap).forEach((key) => {
    const template2 = arrowPointAtCenter && ArrowCenterPlacementAlignMap[key] || PlacementAlignMap[key];
    const placementInfo = Object.assign(Object.assign({}, template2), {
      offset: [0, 0],
      dynamicInset: true
    });
    placementMap[key] = placementInfo;
    if (DisableAutoArrowList.has(key)) {
      placementInfo.autoArrow = false;
    }
    switch (key) {
      case "top":
      case "topLeft":
      case "topRight":
        placementInfo.offset[1] = -halfArrowWidth - offset2;
        break;
      case "bottom":
      case "bottomLeft":
      case "bottomRight":
        placementInfo.offset[1] = halfArrowWidth + offset2;
        break;
      case "left":
      case "leftTop":
      case "leftBottom":
        placementInfo.offset[0] = -halfArrowWidth - offset2;
        break;
      case "right":
      case "rightTop":
      case "rightBottom":
        placementInfo.offset[0] = halfArrowWidth + offset2;
        break;
    }
    const arrowOffset = getArrowOffsetToken({
      contentRadius: borderRadius2,
      limitVerticalRadius: true
    });
    if (arrowPointAtCenter) {
      switch (key) {
        case "topLeft":
        case "bottomLeft":
          placementInfo.offset[0] = -arrowOffset.arrowOffsetHorizontal - halfArrowWidth;
          break;
        case "topRight":
        case "bottomRight":
          placementInfo.offset[0] = arrowOffset.arrowOffsetHorizontal + halfArrowWidth;
          break;
        case "leftTop":
        case "rightTop":
          placementInfo.offset[1] = -arrowOffset.arrowOffsetHorizontal * 2 + halfArrowWidth;
          break;
        case "leftBottom":
        case "rightBottom":
          placementInfo.offset[1] = arrowOffset.arrowOffsetHorizontal * 2 - halfArrowWidth;
          break;
      }
    }
    placementInfo.overflow = getOverflowOptions(key, arrowOffset, arrowWidth, autoAdjustOverflow2);
    {
      placementInfo.htmlRegion = "visibleFirst";
    }
  });
  return placementMap;
}
const genTooltipStyle = (token2) => {
  const {
    calc,
    componentCls,
    // ant-tooltip
    tooltipMaxWidth,
    tooltipColor,
    tooltipBg,
    tooltipBorderRadius,
    zIndexPopup,
    controlHeight,
    boxShadowSecondary,
    paddingSM,
    paddingXS,
    arrowOffsetHorizontal,
    sizePopupArrow
  } = token2;
  const edgeAlignMinWidth = calc(tooltipBorderRadius).add(sizePopupArrow).add(arrowOffsetHorizontal).equal();
  const centerAlignMinWidth = calc(tooltipBorderRadius).mul(2).add(sizePopupArrow).equal();
  return [
    {
      [componentCls]: Object.assign(Object.assign(Object.assign(Object.assign({}, resetComponent(token2)), {
        position: "absolute",
        zIndex: zIndexPopup,
        display: "block",
        width: "max-content",
        maxWidth: tooltipMaxWidth,
        visibility: "visible",
        // When use `autoArrow`, origin will follow the arrow position
        "--valid-offset-x": "var(--arrow-offset-horizontal, var(--arrow-x))",
        transformOrigin: [`var(--valid-offset-x, 50%)`, `var(--arrow-y, 50%)`].join(" "),
        "&-hidden": {
          display: "none"
        },
        "--antd-arrow-background-color": tooltipBg,
        // Wrapper for the tooltip content
        [`${componentCls}-inner`]: {
          minWidth: centerAlignMinWidth,
          minHeight: controlHeight,
          padding: `${unit$1(token2.calc(paddingSM).div(2).equal())} ${unit$1(paddingXS)}`,
          color: tooltipColor,
          textAlign: "start",
          textDecoration: "none",
          wordWrap: "break-word",
          backgroundColor: tooltipBg,
          borderRadius: tooltipBorderRadius,
          boxShadow: boxShadowSecondary,
          boxSizing: "border-box"
        },
        // Align placement should have another min width
        [[`&-placement-topLeft`, `&-placement-topRight`, `&-placement-bottomLeft`, `&-placement-bottomRight`].join(",")]: {
          minWidth: edgeAlignMinWidth
        },
        // Limit left and right placement radius
        [[`&-placement-left`, `&-placement-leftTop`, `&-placement-leftBottom`, `&-placement-right`, `&-placement-rightTop`, `&-placement-rightBottom`].join(",")]: {
          [`${componentCls}-inner`]: {
            borderRadius: token2.min(tooltipBorderRadius, MAX_VERTICAL_CONTENT_RADIUS)
          }
        },
        [`${componentCls}-content`]: {
          position: "relative"
        }
      }), genPresetColor(token2, (colorKey, {
        darkColor
      }) => ({
        [`&${componentCls}-${colorKey}`]: {
          [`${componentCls}-inner`]: {
            backgroundColor: darkColor
          },
          [`${componentCls}-arrow`]: {
            "--antd-arrow-background-color": darkColor
          }
        }
      }))), {
        // RTL
        "&-rtl": {
          direction: "rtl"
        }
      })
    },
    // Arrow Style
    getArrowStyle(token2, "var(--antd-arrow-background-color)"),
    // Pure Render
    {
      [`${componentCls}-pure`]: {
        position: "relative",
        maxWidth: "none",
        margin: token2.sizePopupArrow
      }
    }
  ];
};
const prepareComponentToken$4 = (token2) => Object.assign(Object.assign({
  zIndexPopup: token2.zIndexPopupBase + 70
}, getArrowOffsetToken({
  contentRadius: token2.borderRadius,
  limitVerticalRadius: true
})), getArrowToken(merge$4(token2, {
  borderRadiusOuter: Math.min(token2.borderRadiusOuter, 4)
})));
const useStyle$4 = (prefixCls, injectStyle = true) => {
  const useStyle2 = genStyleHooks("Tooltip", (token2) => {
    const {
      borderRadius: borderRadius2,
      colorTextLightSolid,
      colorBgSpotlight
    } = token2;
    const TooltipToken = merge$4(token2, {
      // default variables
      tooltipMaxWidth: 250,
      tooltipColor: colorTextLightSolid,
      tooltipBorderRadius: borderRadius2,
      tooltipBg: colorBgSpotlight
    });
    return [genTooltipStyle(TooltipToken), initZoomMotion(token2, "zoom-big-fast")];
  }, prepareComponentToken$4, {
    resetStyle: false,
    // Popover use Tooltip as internal component. We do not need to handle this.
    injectStyle
  });
  return useStyle2(prefixCls);
};
const inverseColors = PresetColors.map((color2) => `${color2}-inverse`);
function isPresetColor(color2, includeInverse = true) {
  if (includeInverse) {
    return [].concat(_toConsumableArray(inverseColors), _toConsumableArray(PresetColors)).includes(color2);
  }
  return PresetColors.includes(color2);
}
function parseColor(prefixCls, color2) {
  const isInternalColor = isPresetColor(color2);
  const className = classNames({
    [`${prefixCls}-${color2}`]: color2 && isInternalColor
  });
  const overlayStyle = {};
  const arrowStyle = {};
  if (color2 && !isInternalColor) {
    overlayStyle.background = color2;
    arrowStyle["--antd-arrow-background-color"] = color2;
  }
  return {
    className,
    overlayStyle,
    arrowStyle
  };
}
const PurePanel = (props) => {
  const {
    prefixCls: customizePrefixCls,
    className,
    placement = "top",
    title,
    color: color2,
    overlayInnerStyle
  } = props;
  const {
    getPrefixCls
  } = reactExports.useContext(ConfigContext);
  const prefixCls = getPrefixCls("tooltip", customizePrefixCls);
  const [wrapCSSVar, hashId, cssVarCls] = useStyle$4(prefixCls);
  const colorInfo = parseColor(prefixCls, color2);
  const arrowContentStyle = colorInfo.arrowStyle;
  const formattedOverlayInnerStyle = Object.assign(Object.assign({}, overlayInnerStyle), colorInfo.overlayStyle);
  const cls = classNames(hashId, cssVarCls, prefixCls, `${prefixCls}-pure`, `${prefixCls}-placement-${placement}`, className, colorInfo.className);
  return wrapCSSVar(/* @__PURE__ */ reactExports.createElement("div", {
    className: cls,
    style: arrowContentStyle
  }, /* @__PURE__ */ reactExports.createElement("div", {
    className: `${prefixCls}-arrow`
  }), /* @__PURE__ */ reactExports.createElement(Popup, Object.assign({}, props, {
    className: hashId,
    prefixCls,
    overlayInnerStyle: formattedOverlayInnerStyle
  }), title)));
};
var __rest$6 = function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
};
const InternalTooltip = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
  var _a2, _b2;
  const {
    prefixCls: customizePrefixCls,
    openClassName,
    getTooltipContainer,
    color: color2,
    overlayInnerStyle,
    children,
    afterOpenChange,
    afterVisibleChange,
    destroyTooltipOnHide,
    destroyOnHidden,
    arrow = true,
    title,
    overlay,
    builtinPlacements,
    arrowPointAtCenter = false,
    autoAdjustOverflow: autoAdjustOverflow2 = true,
    motion,
    getPopupContainer,
    placement = "top",
    mouseEnterDelay = 0.1,
    mouseLeaveDelay = 0.1,
    overlayStyle,
    rootClassName,
    overlayClassName,
    styles: styles2,
    classNames: tooltipClassNames
  } = props, restProps = __rest$6(props, ["prefixCls", "openClassName", "getTooltipContainer", "color", "overlayInnerStyle", "children", "afterOpenChange", "afterVisibleChange", "destroyTooltipOnHide", "destroyOnHidden", "arrow", "title", "overlay", "builtinPlacements", "arrowPointAtCenter", "autoAdjustOverflow", "motion", "getPopupContainer", "placement", "mouseEnterDelay", "mouseLeaveDelay", "overlayStyle", "rootClassName", "overlayClassName", "styles", "classNames"]);
  const mergedShowArrow = !!arrow;
  const [, token2] = useToken();
  const {
    getPopupContainer: getContextPopupContainer,
    getPrefixCls,
    direction,
    className: contextClassName,
    style: contextStyle,
    classNames: contextClassNames,
    styles: contextStyles
  } = useComponentConfig("tooltip");
  const warning3 = devUseWarning();
  const tooltipRef = reactExports.useRef(null);
  const forceAlign = () => {
    var _a22;
    (_a22 = tooltipRef.current) === null || _a22 === void 0 ? void 0 : _a22.forceAlign();
  };
  reactExports.useImperativeHandle(ref, () => {
    var _a22, _b22;
    return {
      forceAlign,
      forcePopupAlign: () => {
        warning3.deprecated(false, "forcePopupAlign", "forceAlign");
        forceAlign();
      },
      nativeElement: (_a22 = tooltipRef.current) === null || _a22 === void 0 ? void 0 : _a22.nativeElement,
      popupElement: (_b22 = tooltipRef.current) === null || _b22 === void 0 ? void 0 : _b22.popupElement
    };
  });
  const [open, setOpen] = useMergedState(false, {
    value: (_a2 = props.open) !== null && _a2 !== void 0 ? _a2 : props.visible,
    defaultValue: (_b2 = props.defaultOpen) !== null && _b2 !== void 0 ? _b2 : props.defaultVisible
  });
  const noTitle = !title && !overlay && title !== 0;
  const onOpenChange = (vis) => {
    var _a22, _b22;
    setOpen(noTitle ? false : vis);
    if (!noTitle) {
      (_a22 = props.onOpenChange) === null || _a22 === void 0 ? void 0 : _a22.call(props, vis);
      (_b22 = props.onVisibleChange) === null || _b22 === void 0 ? void 0 : _b22.call(props, vis);
    }
  };
  const tooltipPlacements = reactExports.useMemo(() => {
    var _a22, _b22;
    let mergedArrowPointAtCenter = arrowPointAtCenter;
    if (typeof arrow === "object") {
      mergedArrowPointAtCenter = (_b22 = (_a22 = arrow.pointAtCenter) !== null && _a22 !== void 0 ? _a22 : arrow.arrowPointAtCenter) !== null && _b22 !== void 0 ? _b22 : arrowPointAtCenter;
    }
    return builtinPlacements || getPlacements({
      arrowPointAtCenter: mergedArrowPointAtCenter,
      autoAdjustOverflow: autoAdjustOverflow2,
      arrowWidth: mergedShowArrow ? token2.sizePopupArrow : 0,
      borderRadius: token2.borderRadius,
      offset: token2.marginXXS
    });
  }, [arrowPointAtCenter, arrow, builtinPlacements, token2]);
  const memoOverlay = reactExports.useMemo(() => {
    if (title === 0) {
      return title;
    }
    return overlay || title || "";
  }, [overlay, title]);
  const memoOverlayWrapper = /* @__PURE__ */ reactExports.createElement(ContextIsolator, {
    space: true
  }, typeof memoOverlay === "function" ? memoOverlay() : memoOverlay);
  const prefixCls = getPrefixCls("tooltip", customizePrefixCls);
  const rootPrefixCls = getPrefixCls();
  const injectFromPopover = props["data-popover-inject"];
  let tempOpen = open;
  if (!("open" in props) && !("visible" in props) && noTitle) {
    tempOpen = false;
  }
  const child = /* @__PURE__ */ reactExports.isValidElement(children) && !isFragment(children) ? children : /* @__PURE__ */ reactExports.createElement("span", null, children);
  const childProps = child.props;
  const childCls = !childProps.className || typeof childProps.className === "string" ? classNames(childProps.className, openClassName || `${prefixCls}-open`) : childProps.className;
  const [wrapCSSVar, hashId, cssVarCls] = useStyle$4(prefixCls, !injectFromPopover);
  const colorInfo = parseColor(prefixCls, color2);
  const arrowContentStyle = colorInfo.arrowStyle;
  const rootClassNames = classNames(overlayClassName, {
    [`${prefixCls}-rtl`]: direction === "rtl"
  }, colorInfo.className, rootClassName, hashId, cssVarCls, contextClassName, contextClassNames.root, tooltipClassNames === null || tooltipClassNames === void 0 ? void 0 : tooltipClassNames.root);
  const bodyClassNames = classNames(contextClassNames.body, tooltipClassNames === null || tooltipClassNames === void 0 ? void 0 : tooltipClassNames.body);
  const [zIndex, contextZIndex] = useZIndex("Tooltip", restProps.zIndex);
  const content2 = /* @__PURE__ */ reactExports.createElement(Tooltip$4, Object.assign({}, restProps, {
    zIndex,
    showArrow: mergedShowArrow,
    placement,
    mouseEnterDelay,
    mouseLeaveDelay,
    prefixCls,
    classNames: {
      root: rootClassNames,
      body: bodyClassNames
    },
    styles: {
      root: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, arrowContentStyle), contextStyles.root), contextStyle), overlayStyle), styles2 === null || styles2 === void 0 ? void 0 : styles2.root),
      body: Object.assign(Object.assign(Object.assign(Object.assign({}, contextStyles.body), overlayInnerStyle), styles2 === null || styles2 === void 0 ? void 0 : styles2.body), colorInfo.overlayStyle)
    },
    getTooltipContainer: getPopupContainer || getTooltipContainer || getContextPopupContainer,
    ref: tooltipRef,
    builtinPlacements: tooltipPlacements,
    overlay: memoOverlayWrapper,
    visible: tempOpen,
    onVisibleChange: onOpenChange,
    afterVisibleChange: afterOpenChange !== null && afterOpenChange !== void 0 ? afterOpenChange : afterVisibleChange,
    arrowContent: /* @__PURE__ */ reactExports.createElement("span", {
      className: `${prefixCls}-arrow-content`
    }),
    motion: {
      motionName: getTransitionName(rootPrefixCls, "zoom-big-fast", props.transitionName),
      motionDeadline: 1e3
    },
    // TODO: In the future, destroyTooltipOnHide in rc-tooltip needs to be upgrade to destroyOnHidden
    destroyTooltipOnHide: destroyOnHidden !== null && destroyOnHidden !== void 0 ? destroyOnHidden : !!destroyTooltipOnHide
  }), tempOpen ? cloneElement(child, {
    className: childCls
  }) : child);
  return wrapCSSVar(/* @__PURE__ */ reactExports.createElement(zIndexContext.Provider, {
    value: contextZIndex
  }, content2));
});
const Tooltip$2 = InternalTooltip;
Tooltip$2._InternalPanelDoNotUseOrYouWillBeFired = PurePanel;
var IdContext = /* @__PURE__ */ reactExports.createContext(null);
function getMenuId(uuid2, eventKey) {
  if (uuid2 === void 0) {
    return null;
  }
  return "".concat(uuid2, "-").concat(eventKey);
}
function useMenuId(eventKey) {
  var id2 = reactExports.useContext(IdContext);
  return getMenuId(id2, eventKey);
}
var _excluded$l = ["children", "locked"];
var MenuContext$1 = /* @__PURE__ */ reactExports.createContext(null);
function mergeProps$2(origin2, target) {
  var clone3 = _objectSpread2({}, origin2);
  Object.keys(target).forEach(function(key) {
    var value2 = target[key];
    if (value2 !== void 0) {
      clone3[key] = value2;
    }
  });
  return clone3;
}
function InheritableContextProvider(_ref) {
  var children = _ref.children, locked = _ref.locked, restProps = _objectWithoutProperties$3(_ref, _excluded$l);
  var context = reactExports.useContext(MenuContext$1);
  var inheritableContext = useMemo(function() {
    return mergeProps$2(context, restProps);
  }, [context, restProps], function(prev2, next2) {
    return !locked && (prev2[0] !== next2[0] || !isEqual$2(prev2[1], next2[1], true));
  });
  return /* @__PURE__ */ reactExports.createElement(MenuContext$1.Provider, {
    value: inheritableContext
  }, children);
}
var EmptyList = [];
var PathRegisterContext = /* @__PURE__ */ reactExports.createContext(null);
function useMeasure() {
  return reactExports.useContext(PathRegisterContext);
}
var PathTrackerContext = /* @__PURE__ */ reactExports.createContext(EmptyList);
function useFullPath(eventKey) {
  var parentKeyPath = reactExports.useContext(PathTrackerContext);
  return reactExports.useMemo(function() {
    return eventKey !== void 0 ? [].concat(_toConsumableArray(parentKeyPath), [eventKey]) : parentKeyPath;
  }, [parentKeyPath, eventKey]);
}
var PathUserContext = /* @__PURE__ */ reactExports.createContext(null);
var PrivateContext = /* @__PURE__ */ reactExports.createContext({});
function focusable(node2) {
  var includePositive = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
  if (isVisible(node2)) {
    var nodeName = node2.nodeName.toLowerCase();
    var isFocusableElement = (
      // Focusable element
      ["input", "select", "textarea", "button"].includes(nodeName) || // Editable element
      node2.isContentEditable || // Anchor with href element
      nodeName === "a" && !!node2.getAttribute("href")
    );
    var tabIndexAttr = node2.getAttribute("tabindex");
    var tabIndexNum = Number(tabIndexAttr);
    var tabIndex = null;
    if (tabIndexAttr && !Number.isNaN(tabIndexNum)) {
      tabIndex = tabIndexNum;
    } else if (isFocusableElement && tabIndex === null) {
      tabIndex = 0;
    }
    if (isFocusableElement && node2.disabled) {
      tabIndex = null;
    }
    return tabIndex !== null && (tabIndex >= 0 || includePositive && tabIndex < 0);
  }
  return false;
}
function getFocusNodeList(node2) {
  var includePositive = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
  var res = _toConsumableArray(node2.querySelectorAll("*")).filter(function(child) {
    return focusable(child, includePositive);
  });
  if (focusable(node2, includePositive)) {
    res.unshift(node2);
  }
  return res;
}
var LEFT = KeyCode.LEFT, RIGHT = KeyCode.RIGHT, UP = KeyCode.UP, DOWN = KeyCode.DOWN, ENTER$1 = KeyCode.ENTER, ESC = KeyCode.ESC, HOME = KeyCode.HOME, END = KeyCode.END;
var ArrowKeys = [UP, DOWN, LEFT, RIGHT];
function getOffset(mode, isRootLevel, isRtl, which) {
  var _offsets;
  var prev2 = "prev";
  var next2 = "next";
  var children = "children";
  var parent = "parent";
  if (mode === "inline" && which === ENTER$1) {
    return {
      inlineTrigger: true
    };
  }
  var inline2 = _defineProperty$3(_defineProperty$3({}, UP, prev2), DOWN, next2);
  var horizontal = _defineProperty$3(_defineProperty$3(_defineProperty$3(_defineProperty$3({}, LEFT, isRtl ? next2 : prev2), RIGHT, isRtl ? prev2 : next2), DOWN, children), ENTER$1, children);
  var vertical = _defineProperty$3(_defineProperty$3(_defineProperty$3(_defineProperty$3(_defineProperty$3(_defineProperty$3({}, UP, prev2), DOWN, next2), ENTER$1, children), ESC, parent), LEFT, isRtl ? children : parent), RIGHT, isRtl ? parent : children);
  var offsets = {
    inline: inline2,
    horizontal,
    vertical,
    inlineSub: inline2,
    horizontalSub: vertical,
    verticalSub: vertical
  };
  var type4 = (_offsets = offsets["".concat(mode).concat(isRootLevel ? "" : "Sub")]) === null || _offsets === void 0 ? void 0 : _offsets[which];
  switch (type4) {
    case prev2:
      return {
        offset: -1,
        sibling: true
      };
    case next2:
      return {
        offset: 1,
        sibling: true
      };
    case parent:
      return {
        offset: -1,
        sibling: false
      };
    case children:
      return {
        offset: 1,
        sibling: false
      };
    default:
      return null;
  }
}
function findContainerUL(element2) {
  var current = element2;
  while (current) {
    if (current.getAttribute("data-menu-list")) {
      return current;
    }
    current = current.parentElement;
  }
  return null;
}
function getFocusElement(activeElement, elements) {
  var current = activeElement || document.activeElement;
  while (current) {
    if (elements.has(current)) {
      return current;
    }
    current = current.parentElement;
  }
  return null;
}
function getFocusableElements(container, elements) {
  var list2 = getFocusNodeList(container, true);
  return list2.filter(function(ele) {
    return elements.has(ele);
  });
}
function getNextFocusElement(parentQueryContainer, elements, focusMenuElement) {
  var offset2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1;
  if (!parentQueryContainer) {
    return null;
  }
  var sameLevelFocusableMenuElementList = getFocusableElements(parentQueryContainer, elements);
  var count = sameLevelFocusableMenuElementList.length;
  var focusIndex = sameLevelFocusableMenuElementList.findIndex(function(ele) {
    return focusMenuElement === ele;
  });
  if (offset2 < 0) {
    if (focusIndex === -1) {
      focusIndex = count - 1;
    } else {
      focusIndex -= 1;
    }
  } else if (offset2 > 0) {
    focusIndex += 1;
  }
  focusIndex = (focusIndex + count) % count;
  return sameLevelFocusableMenuElementList[focusIndex];
}
var refreshElements = function refreshElements2(keys2, id2) {
  var elements = /* @__PURE__ */ new Set();
  var key2element = /* @__PURE__ */ new Map();
  var element2key = /* @__PURE__ */ new Map();
  keys2.forEach(function(key) {
    var element2 = document.querySelector("[data-menu-id='".concat(getMenuId(id2, key), "']"));
    if (element2) {
      elements.add(element2);
      element2key.set(element2, key);
      key2element.set(key, element2);
    }
  });
  return {
    elements,
    key2element,
    element2key
  };
};
function useAccessibility(mode, activeKey, isRtl, id2, containerRef, getKeys, getKeyPath, triggerActiveKey, triggerAccessibilityOpen, originOnKeyDown) {
  var rafRef = reactExports.useRef();
  var activeRef = reactExports.useRef();
  activeRef.current = activeKey;
  var cleanRaf = function cleanRaf2() {
    wrapperRaf.cancel(rafRef.current);
  };
  reactExports.useEffect(function() {
    return function() {
      cleanRaf();
    };
  }, []);
  return function(e2) {
    var which = e2.which;
    if ([].concat(ArrowKeys, [ENTER$1, ESC, HOME, END]).includes(which)) {
      var keys2 = getKeys();
      var refreshedElements = refreshElements(keys2, id2);
      var _refreshedElements = refreshedElements, elements = _refreshedElements.elements, key2element = _refreshedElements.key2element, element2key = _refreshedElements.element2key;
      var activeElement = key2element.get(activeKey);
      var focusMenuElement = getFocusElement(activeElement, elements);
      var focusMenuKey = element2key.get(focusMenuElement);
      var offsetObj = getOffset(mode, getKeyPath(focusMenuKey, true).length === 1, isRtl, which);
      if (!offsetObj && which !== HOME && which !== END) {
        return;
      }
      if (ArrowKeys.includes(which) || [HOME, END].includes(which)) {
        e2.preventDefault();
      }
      var tryFocus = function tryFocus2(menuElement) {
        if (menuElement) {
          var focusTargetElement = menuElement;
          var link2 = menuElement.querySelector("a");
          if (link2 !== null && link2 !== void 0 && link2.getAttribute("href")) {
            focusTargetElement = link2;
          }
          var targetKey = element2key.get(menuElement);
          triggerActiveKey(targetKey);
          cleanRaf();
          rafRef.current = wrapperRaf(function() {
            if (activeRef.current === targetKey) {
              focusTargetElement.focus();
            }
          });
        }
      };
      if ([HOME, END].includes(which) || offsetObj.sibling || !focusMenuElement) {
        var parentQueryContainer;
        if (!focusMenuElement || mode === "inline") {
          parentQueryContainer = containerRef.current;
        } else {
          parentQueryContainer = findContainerUL(focusMenuElement);
        }
        var targetElement;
        var focusableElements2 = getFocusableElements(parentQueryContainer, elements);
        if (which === HOME) {
          targetElement = focusableElements2[0];
        } else if (which === END) {
          targetElement = focusableElements2[focusableElements2.length - 1];
        } else {
          targetElement = getNextFocusElement(parentQueryContainer, elements, focusMenuElement, offsetObj.offset);
        }
        tryFocus(targetElement);
      } else if (offsetObj.inlineTrigger) {
        triggerAccessibilityOpen(focusMenuKey);
      } else if (offsetObj.offset > 0) {
        triggerAccessibilityOpen(focusMenuKey, true);
        cleanRaf();
        rafRef.current = wrapperRaf(function() {
          refreshedElements = refreshElements(keys2, id2);
          var controlId = focusMenuElement.getAttribute("aria-controls");
          var subQueryContainer = document.getElementById(controlId);
          var targetElement2 = getNextFocusElement(subQueryContainer, refreshedElements.elements);
          tryFocus(targetElement2);
        }, 5);
      } else if (offsetObj.offset < 0) {
        var keyPath = getKeyPath(focusMenuKey, true);
        var parentKey = keyPath[keyPath.length - 2];
        var parentMenuElement = key2element.get(parentKey);
        triggerAccessibilityOpen(parentKey, false);
        tryFocus(parentMenuElement);
      }
    }
    originOnKeyDown === null || originOnKeyDown === void 0 || originOnKeyDown(e2);
  };
}
function nextSlice(callback2) {
  Promise.resolve().then(callback2);
}
var PATH_SPLIT = "__RC_UTIL_PATH_SPLIT__";
var getPathStr = function getPathStr2(keyPath) {
  return keyPath.join(PATH_SPLIT);
};
var getPathKeys = function getPathKeys2(keyPathStr) {
  return keyPathStr.split(PATH_SPLIT);
};
var OVERFLOW_KEY = "rc-menu-more";
function useKeyRecords() {
  var _React$useState = reactExports.useState({}), _React$useState2 = _slicedToArray(_React$useState, 2), internalForceUpdate = _React$useState2[1];
  var key2pathRef = reactExports.useRef(/* @__PURE__ */ new Map());
  var path2keyRef = reactExports.useRef(/* @__PURE__ */ new Map());
  var _React$useState3 = reactExports.useState([]), _React$useState4 = _slicedToArray(_React$useState3, 2), overflowKeys = _React$useState4[0], setOverflowKeys = _React$useState4[1];
  var updateRef3 = reactExports.useRef(0);
  var destroyRef = reactExports.useRef(false);
  var forceUpdate = function forceUpdate2() {
    if (!destroyRef.current) {
      internalForceUpdate({});
    }
  };
  var registerPath = reactExports.useCallback(function(key, keyPath) {
    var connectedPath = getPathStr(keyPath);
    path2keyRef.current.set(connectedPath, key);
    key2pathRef.current.set(key, connectedPath);
    updateRef3.current += 1;
    var id2 = updateRef3.current;
    nextSlice(function() {
      if (id2 === updateRef3.current) {
        forceUpdate();
      }
    });
  }, []);
  var unregisterPath = reactExports.useCallback(function(key, keyPath) {
    var connectedPath = getPathStr(keyPath);
    path2keyRef.current.delete(connectedPath);
    key2pathRef.current.delete(key);
  }, []);
  var refreshOverflowKeys = reactExports.useCallback(function(keys2) {
    setOverflowKeys(keys2);
  }, []);
  var getKeyPath = reactExports.useCallback(function(eventKey, includeOverflow) {
    var fullPath = key2pathRef.current.get(eventKey) || "";
    var keys2 = getPathKeys(fullPath);
    if (includeOverflow && overflowKeys.includes(keys2[0])) {
      keys2.unshift(OVERFLOW_KEY);
    }
    return keys2;
  }, [overflowKeys]);
  var isSubPathKey = reactExports.useCallback(function(pathKeys, eventKey) {
    return pathKeys.filter(function(item) {
      return item !== void 0;
    }).some(function(pathKey2) {
      var pathKeyList = getKeyPath(pathKey2, true);
      return pathKeyList.includes(eventKey);
    });
  }, [getKeyPath]);
  var getKeys = function getKeys2() {
    var keys2 = _toConsumableArray(key2pathRef.current.keys());
    if (overflowKeys.length) {
      keys2.push(OVERFLOW_KEY);
    }
    return keys2;
  };
  var getSubPathKeys = reactExports.useCallback(function(key) {
    var connectedPath = "".concat(key2pathRef.current.get(key)).concat(PATH_SPLIT);
    var pathKeys = /* @__PURE__ */ new Set();
    _toConsumableArray(path2keyRef.current.keys()).forEach(function(pathKey2) {
      if (pathKey2.startsWith(connectedPath)) {
        pathKeys.add(path2keyRef.current.get(pathKey2));
      }
    });
    return pathKeys;
  }, []);
  reactExports.useEffect(function() {
    return function() {
      destroyRef.current = true;
    };
  }, []);
  return {
    // Register
    registerPath,
    unregisterPath,
    refreshOverflowKeys,
    // Util
    isSubPathKey,
    getKeyPath,
    getKeys,
    getSubPathKeys
  };
}
function useMemoCallback(func) {
  var funRef = reactExports.useRef(func);
  funRef.current = func;
  var callback2 = reactExports.useCallback(function() {
    var _funRef$current;
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    return (_funRef$current = funRef.current) === null || _funRef$current === void 0 ? void 0 : _funRef$current.call.apply(_funRef$current, [funRef].concat(args));
  }, []);
  return func ? callback2 : void 0;
}
var uniquePrefix = Math.random().toFixed(5).toString().slice(2);
var internalId = 0;
function useUUID(id2) {
  var _useMergedState = useMergedState(id2, {
    value: id2
  }), _useMergedState2 = _slicedToArray(_useMergedState, 2), uuid2 = _useMergedState2[0], setUUID = _useMergedState2[1];
  reactExports.useEffect(function() {
    internalId += 1;
    var newId = "".concat(uniquePrefix, "-").concat(internalId);
    setUUID("rc-menu-uuid-".concat(newId));
  }, []);
  return uuid2;
}
function useActive(eventKey, disabled, onMouseEnter, onMouseLeave) {
  var _React$useContext = reactExports.useContext(MenuContext$1), activeKey = _React$useContext.activeKey, onActive = _React$useContext.onActive, onInactive = _React$useContext.onInactive;
  var ret = {
    active: activeKey === eventKey
  };
  if (!disabled) {
    ret.onMouseEnter = function(domEvent) {
      onMouseEnter === null || onMouseEnter === void 0 || onMouseEnter({
        key: eventKey,
        domEvent
      });
      onActive(eventKey);
    };
    ret.onMouseLeave = function(domEvent) {
      onMouseLeave === null || onMouseLeave === void 0 || onMouseLeave({
        key: eventKey,
        domEvent
      });
      onInactive(eventKey);
    };
  }
  return ret;
}
function useDirectionStyle(level) {
  var _React$useContext = reactExports.useContext(MenuContext$1), mode = _React$useContext.mode, rtl = _React$useContext.rtl, inlineIndent = _React$useContext.inlineIndent;
  if (mode !== "inline") {
    return null;
  }
  var len = level;
  return rtl ? {
    paddingRight: len * inlineIndent
  } : {
    paddingLeft: len * inlineIndent
  };
}
function Icon$2(_ref) {
  var icon = _ref.icon, props = _ref.props, children = _ref.children;
  var iconNode;
  if (icon === null || icon === false) {
    return null;
  }
  if (typeof icon === "function") {
    iconNode = /* @__PURE__ */ reactExports.createElement(icon, _objectSpread2({}, props));
  } else if (typeof icon !== "boolean") {
    iconNode = icon;
  }
  return iconNode || children || null;
}
var _excluded$k = ["item"];
function warnItemProp(_ref) {
  var item = _ref.item, restInfo = _objectWithoutProperties$3(_ref, _excluded$k);
  Object.defineProperty(restInfo, "item", {
    get: function get5() {
      warningOnce(false, "`info.item` is deprecated since we will move to function component that not provides React Node instance in future.");
      return item;
    }
  });
  return restInfo;
}
var _excluded$j = ["title", "attribute", "elementRef"], _excluded2$4 = ["style", "className", "eventKey", "warnKey", "disabled", "itemIcon", "children", "role", "onMouseEnter", "onMouseLeave", "onClick", "onKeyDown", "onFocus"], _excluded3$1 = ["active"];
var LegacyMenuItem = /* @__PURE__ */ function(_React$Component) {
  _inherits$a(LegacyMenuItem2, _React$Component);
  var _super = _createSuper$4(LegacyMenuItem2);
  function LegacyMenuItem2() {
    _classCallCheck$a(this, LegacyMenuItem2);
    return _super.apply(this, arguments);
  }
  _createClass$8(LegacyMenuItem2, [{
    key: "render",
    value: function render3() {
      var _this$props = this.props, title = _this$props.title, attribute = _this$props.attribute, elementRef = _this$props.elementRef, restProps = _objectWithoutProperties$3(_this$props, _excluded$j);
      var passedProps = omit$1(restProps, ["eventKey", "popupClassName", "popupOffset", "onTitleClick"]);
      warningOnce(!attribute, "`attribute` of Menu.Item is deprecated. Please pass attribute directly.");
      return /* @__PURE__ */ reactExports.createElement(ForwardOverflow.Item, _extends$h({}, attribute, {
        title: typeof title === "string" ? title : void 0
      }, passedProps, {
        ref: elementRef
      }));
    }
  }]);
  return LegacyMenuItem2;
}(reactExports.Component);
var InternalMenuItem = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var style2 = props.style, className = props.className, eventKey = props.eventKey;
  props.warnKey;
  var disabled = props.disabled, itemIcon = props.itemIcon, children = props.children, role = props.role, onMouseEnter = props.onMouseEnter, onMouseLeave = props.onMouseLeave, onClick = props.onClick, onKeyDown = props.onKeyDown, onFocus = props.onFocus, restProps = _objectWithoutProperties$3(props, _excluded2$4);
  var domDataId = useMenuId(eventKey);
  var _React$useContext = reactExports.useContext(MenuContext$1), prefixCls = _React$useContext.prefixCls, onItemClick = _React$useContext.onItemClick, contextDisabled = _React$useContext.disabled, overflowDisabled = _React$useContext.overflowDisabled, contextItemIcon = _React$useContext.itemIcon, selectedKeys = _React$useContext.selectedKeys, onActive = _React$useContext.onActive;
  var _React$useContext2 = reactExports.useContext(PrivateContext), _internalRenderMenuItem = _React$useContext2._internalRenderMenuItem;
  var itemCls = "".concat(prefixCls, "-item");
  var legacyMenuItemRef = reactExports.useRef();
  var elementRef = reactExports.useRef();
  var mergedDisabled = contextDisabled || disabled;
  var mergedEleRef = useComposeRef(ref, elementRef);
  var connectedKeys = useFullPath(eventKey);
  var getEventInfo = function getEventInfo2(e2) {
    return {
      key: eventKey,
      // Note: For legacy code is reversed which not like other antd component
      keyPath: _toConsumableArray(connectedKeys).reverse(),
      item: legacyMenuItemRef.current,
      domEvent: e2
    };
  };
  var mergedItemIcon = itemIcon || contextItemIcon;
  var _useActive = useActive(eventKey, mergedDisabled, onMouseEnter, onMouseLeave), active3 = _useActive.active, activeProps = _objectWithoutProperties$3(_useActive, _excluded3$1);
  var selected = selectedKeys.includes(eventKey);
  var directionStyle = useDirectionStyle(connectedKeys.length);
  var onInternalClick = function onInternalClick2(e2) {
    if (mergedDisabled) {
      return;
    }
    var info2 = getEventInfo(e2);
    onClick === null || onClick === void 0 || onClick(warnItemProp(info2));
    onItemClick(info2);
  };
  var onInternalKeyDown = function onInternalKeyDown2(e2) {
    onKeyDown === null || onKeyDown === void 0 || onKeyDown(e2);
    if (e2.which === KeyCode.ENTER) {
      var info2 = getEventInfo(e2);
      onClick === null || onClick === void 0 || onClick(warnItemProp(info2));
      onItemClick(info2);
    }
  };
  var onInternalFocus = function onInternalFocus2(e2) {
    onActive(eventKey);
    onFocus === null || onFocus === void 0 || onFocus(e2);
  };
  var optionRoleProps = {};
  if (props.role === "option") {
    optionRoleProps["aria-selected"] = selected;
  }
  var renderNode = /* @__PURE__ */ reactExports.createElement(LegacyMenuItem, _extends$h({
    ref: legacyMenuItemRef,
    elementRef: mergedEleRef,
    role: role === null ? "none" : role || "menuitem",
    tabIndex: disabled ? null : -1,
    "data-menu-id": overflowDisabled && domDataId ? null : domDataId
  }, omit$1(restProps, ["extra"]), activeProps, optionRoleProps, {
    component: "li",
    "aria-disabled": disabled,
    style: _objectSpread2(_objectSpread2({}, directionStyle), style2),
    className: classNames(itemCls, _defineProperty$3(_defineProperty$3(_defineProperty$3({}, "".concat(itemCls, "-active"), active3), "".concat(itemCls, "-selected"), selected), "".concat(itemCls, "-disabled"), mergedDisabled), className),
    onClick: onInternalClick,
    onKeyDown: onInternalKeyDown,
    onFocus: onInternalFocus
  }), children, /* @__PURE__ */ reactExports.createElement(Icon$2, {
    props: _objectSpread2(_objectSpread2({}, props), {}, {
      isSelected: selected
    }),
    icon: mergedItemIcon
  }));
  if (_internalRenderMenuItem) {
    renderNode = _internalRenderMenuItem(renderNode, props, {
      selected
    });
  }
  return renderNode;
});
function MenuItem$2(props, ref) {
  var eventKey = props.eventKey;
  var measure = useMeasure();
  var connectedKeyPath = useFullPath(eventKey);
  reactExports.useEffect(function() {
    if (measure) {
      measure.registerPath(eventKey, connectedKeyPath);
      return function() {
        measure.unregisterPath(eventKey, connectedKeyPath);
      };
    }
  }, [connectedKeyPath]);
  if (measure) {
    return null;
  }
  return /* @__PURE__ */ reactExports.createElement(InternalMenuItem, _extends$h({}, props, {
    ref
  }));
}
const MenuItem$3 = /* @__PURE__ */ reactExports.forwardRef(MenuItem$2);
var _excluded$i = ["className", "children"];
var InternalSubMenuList = function InternalSubMenuList2(_ref, ref) {
  var className = _ref.className, children = _ref.children, restProps = _objectWithoutProperties$3(_ref, _excluded$i);
  var _React$useContext = reactExports.useContext(MenuContext$1), prefixCls = _React$useContext.prefixCls, mode = _React$useContext.mode, rtl = _React$useContext.rtl;
  return /* @__PURE__ */ reactExports.createElement("ul", _extends$h({
    className: classNames(prefixCls, rtl && "".concat(prefixCls, "-rtl"), "".concat(prefixCls, "-sub"), "".concat(prefixCls, "-").concat(mode === "inline" ? "inline" : "vertical"), className),
    role: "menu"
  }, restProps, {
    "data-menu-list": true,
    ref
  }), children);
};
var SubMenuList = /* @__PURE__ */ reactExports.forwardRef(InternalSubMenuList);
SubMenuList.displayName = "SubMenuList";
function parseChildren(children, keyPath) {
  return toArray$4(children).map(function(child, index2) {
    if (/* @__PURE__ */ reactExports.isValidElement(child)) {
      var _eventKey, _child$props;
      var key = child.key;
      var eventKey = (_eventKey = (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.eventKey) !== null && _eventKey !== void 0 ? _eventKey : key;
      var emptyKey = eventKey === null || eventKey === void 0;
      if (emptyKey) {
        eventKey = "tmp_key-".concat([].concat(_toConsumableArray(keyPath), [index2]).join("-"));
      }
      var cloneProps = {
        key: eventKey,
        eventKey
      };
      return /* @__PURE__ */ reactExports.cloneElement(child, cloneProps);
    }
    return child;
  });
}
var autoAdjustOverflow = {
  adjustX: 1,
  adjustY: 1
};
var placements = {
  topLeft: {
    points: ["bl", "tl"],
    overflow: autoAdjustOverflow
  },
  topRight: {
    points: ["br", "tr"],
    overflow: autoAdjustOverflow
  },
  bottomLeft: {
    points: ["tl", "bl"],
    overflow: autoAdjustOverflow
  },
  bottomRight: {
    points: ["tr", "br"],
    overflow: autoAdjustOverflow
  },
  leftTop: {
    points: ["tr", "tl"],
    overflow: autoAdjustOverflow
  },
  leftBottom: {
    points: ["br", "bl"],
    overflow: autoAdjustOverflow
  },
  rightTop: {
    points: ["tl", "tr"],
    overflow: autoAdjustOverflow
  },
  rightBottom: {
    points: ["bl", "br"],
    overflow: autoAdjustOverflow
  }
};
var placementsRtl = {
  topLeft: {
    points: ["bl", "tl"],
    overflow: autoAdjustOverflow
  },
  topRight: {
    points: ["br", "tr"],
    overflow: autoAdjustOverflow
  },
  bottomLeft: {
    points: ["tl", "bl"],
    overflow: autoAdjustOverflow
  },
  bottomRight: {
    points: ["tr", "br"],
    overflow: autoAdjustOverflow
  },
  rightTop: {
    points: ["tr", "tl"],
    overflow: autoAdjustOverflow
  },
  rightBottom: {
    points: ["br", "bl"],
    overflow: autoAdjustOverflow
  },
  leftTop: {
    points: ["tl", "tr"],
    overflow: autoAdjustOverflow
  },
  leftBottom: {
    points: ["bl", "br"],
    overflow: autoAdjustOverflow
  }
};
function getMotion(mode, motion, defaultMotions) {
  if (motion) {
    return motion;
  }
  if (defaultMotions) {
    return defaultMotions[mode] || defaultMotions.other;
  }
  return void 0;
}
var popupPlacementMap = {
  horizontal: "bottomLeft",
  vertical: "rightTop",
  "vertical-left": "rightTop",
  "vertical-right": "leftTop"
};
function PopupTrigger(_ref) {
  var prefixCls = _ref.prefixCls, visible = _ref.visible, children = _ref.children, popup = _ref.popup, popupStyle = _ref.popupStyle, popupClassName = _ref.popupClassName, popupOffset = _ref.popupOffset, disabled = _ref.disabled, mode = _ref.mode, onVisibleChange = _ref.onVisibleChange;
  var _React$useContext = reactExports.useContext(MenuContext$1), getPopupContainer = _React$useContext.getPopupContainer, rtl = _React$useContext.rtl, subMenuOpenDelay = _React$useContext.subMenuOpenDelay, subMenuCloseDelay = _React$useContext.subMenuCloseDelay, builtinPlacements = _React$useContext.builtinPlacements, triggerSubMenuAction = _React$useContext.triggerSubMenuAction, forceSubMenuRender = _React$useContext.forceSubMenuRender, rootClassName = _React$useContext.rootClassName, motion = _React$useContext.motion, defaultMotions = _React$useContext.defaultMotions;
  var _React$useState = reactExports.useState(false), _React$useState2 = _slicedToArray(_React$useState, 2), innerVisible = _React$useState2[0], setInnerVisible = _React$useState2[1];
  var placement = rtl ? _objectSpread2(_objectSpread2({}, placementsRtl), builtinPlacements) : _objectSpread2(_objectSpread2({}, placements), builtinPlacements);
  var popupPlacement = popupPlacementMap[mode];
  var targetMotion = getMotion(mode, motion, defaultMotions);
  var targetMotionRef = reactExports.useRef(targetMotion);
  if (mode !== "inline") {
    targetMotionRef.current = targetMotion;
  }
  var mergedMotion = _objectSpread2(_objectSpread2({}, targetMotionRef.current), {}, {
    leavedClassName: "".concat(prefixCls, "-hidden"),
    removeOnLeave: false,
    motionAppear: true
  });
  var visibleRef = reactExports.useRef();
  reactExports.useEffect(function() {
    visibleRef.current = wrapperRaf(function() {
      setInnerVisible(visible);
    });
    return function() {
      wrapperRaf.cancel(visibleRef.current);
    };
  }, [visible]);
  return /* @__PURE__ */ reactExports.createElement(Trigger, {
    prefixCls,
    popupClassName: classNames("".concat(prefixCls, "-popup"), _defineProperty$3({}, "".concat(prefixCls, "-rtl"), rtl), popupClassName, rootClassName),
    stretch: mode === "horizontal" ? "minWidth" : null,
    getPopupContainer,
    builtinPlacements: placement,
    popupPlacement,
    popupVisible: innerVisible,
    popup,
    popupStyle,
    popupAlign: popupOffset && {
      offset: popupOffset
    },
    action: disabled ? [] : [triggerSubMenuAction],
    mouseEnterDelay: subMenuOpenDelay,
    mouseLeaveDelay: subMenuCloseDelay,
    onPopupVisibleChange: onVisibleChange,
    forceRender: forceSubMenuRender,
    popupMotion: mergedMotion,
    fresh: true
  }, children);
}
function InlineSubMenuList(_ref) {
  var id2 = _ref.id, open = _ref.open, keyPath = _ref.keyPath, children = _ref.children;
  var fixedMode = "inline";
  var _React$useContext = reactExports.useContext(MenuContext$1), prefixCls = _React$useContext.prefixCls, forceSubMenuRender = _React$useContext.forceSubMenuRender, motion = _React$useContext.motion, defaultMotions = _React$useContext.defaultMotions, mode = _React$useContext.mode;
  var sameModeRef = reactExports.useRef(false);
  sameModeRef.current = mode === fixedMode;
  var _React$useState = reactExports.useState(!sameModeRef.current), _React$useState2 = _slicedToArray(_React$useState, 2), destroy = _React$useState2[0], setDestroy = _React$useState2[1];
  var mergedOpen = sameModeRef.current ? open : false;
  reactExports.useEffect(function() {
    if (sameModeRef.current) {
      setDestroy(false);
    }
  }, [mode]);
  var mergedMotion = _objectSpread2({}, getMotion(fixedMode, motion, defaultMotions));
  if (keyPath.length > 1) {
    mergedMotion.motionAppear = false;
  }
  var originOnVisibleChanged = mergedMotion.onVisibleChanged;
  mergedMotion.onVisibleChanged = function(newVisible) {
    if (!sameModeRef.current && !newVisible) {
      setDestroy(true);
    }
    return originOnVisibleChanged === null || originOnVisibleChanged === void 0 ? void 0 : originOnVisibleChanged(newVisible);
  };
  if (destroy) {
    return null;
  }
  return /* @__PURE__ */ reactExports.createElement(InheritableContextProvider, {
    mode: fixedMode,
    locked: !sameModeRef.current
  }, /* @__PURE__ */ reactExports.createElement(CSSMotion, _extends$h({
    visible: mergedOpen
  }, mergedMotion, {
    forceRender: forceSubMenuRender,
    removeOnLeave: false,
    leavedClassName: "".concat(prefixCls, "-hidden")
  }), function(_ref2) {
    var motionClassName = _ref2.className, motionStyle = _ref2.style;
    return /* @__PURE__ */ reactExports.createElement(SubMenuList, {
      id: id2,
      className: motionClassName,
      style: motionStyle
    }, children);
  }));
}
var _excluded$h = ["style", "className", "title", "eventKey", "warnKey", "disabled", "internalPopupClose", "children", "itemIcon", "expandIcon", "popupClassName", "popupOffset", "popupStyle", "onClick", "onMouseEnter", "onMouseLeave", "onTitleClick", "onTitleMouseEnter", "onTitleMouseLeave"], _excluded2$3 = ["active"];
var InternalSubMenu = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var style2 = props.style, className = props.className, title = props.title, eventKey = props.eventKey;
  props.warnKey;
  var disabled = props.disabled, internalPopupClose = props.internalPopupClose, children = props.children, itemIcon = props.itemIcon, expandIcon = props.expandIcon, popupClassName = props.popupClassName, popupOffset = props.popupOffset, popupStyle = props.popupStyle, onClick = props.onClick, onMouseEnter = props.onMouseEnter, onMouseLeave = props.onMouseLeave, onTitleClick = props.onTitleClick, onTitleMouseEnter = props.onTitleMouseEnter, onTitleMouseLeave = props.onTitleMouseLeave, restProps = _objectWithoutProperties$3(props, _excluded$h);
  var domDataId = useMenuId(eventKey);
  var _React$useContext = reactExports.useContext(MenuContext$1), prefixCls = _React$useContext.prefixCls, mode = _React$useContext.mode, openKeys = _React$useContext.openKeys, contextDisabled = _React$useContext.disabled, overflowDisabled = _React$useContext.overflowDisabled, activeKey = _React$useContext.activeKey, selectedKeys = _React$useContext.selectedKeys, contextItemIcon = _React$useContext.itemIcon, contextExpandIcon = _React$useContext.expandIcon, onItemClick = _React$useContext.onItemClick, onOpenChange = _React$useContext.onOpenChange, onActive = _React$useContext.onActive;
  var _React$useContext2 = reactExports.useContext(PrivateContext), _internalRenderSubMenuItem = _React$useContext2._internalRenderSubMenuItem;
  var _React$useContext3 = reactExports.useContext(PathUserContext), isSubPathKey = _React$useContext3.isSubPathKey;
  var connectedPath = useFullPath();
  var subMenuPrefixCls = "".concat(prefixCls, "-submenu");
  var mergedDisabled = contextDisabled || disabled;
  var elementRef = reactExports.useRef();
  var popupRef = reactExports.useRef();
  var mergedItemIcon = itemIcon !== null && itemIcon !== void 0 ? itemIcon : contextItemIcon;
  var mergedExpandIcon = expandIcon !== null && expandIcon !== void 0 ? expandIcon : contextExpandIcon;
  var originOpen = openKeys.includes(eventKey);
  var open = !overflowDisabled && originOpen;
  var childrenSelected = isSubPathKey(selectedKeys, eventKey);
  var _useActive = useActive(eventKey, mergedDisabled, onTitleMouseEnter, onTitleMouseLeave), active3 = _useActive.active, activeProps = _objectWithoutProperties$3(_useActive, _excluded2$3);
  var _React$useState = reactExports.useState(false), _React$useState2 = _slicedToArray(_React$useState, 2), childrenActive = _React$useState2[0], setChildrenActive = _React$useState2[1];
  var triggerChildrenActive = function triggerChildrenActive2(newActive) {
    if (!mergedDisabled) {
      setChildrenActive(newActive);
    }
  };
  var onInternalMouseEnter = function onInternalMouseEnter2(domEvent) {
    triggerChildrenActive(true);
    onMouseEnter === null || onMouseEnter === void 0 || onMouseEnter({
      key: eventKey,
      domEvent
    });
  };
  var onInternalMouseLeave = function onInternalMouseLeave2(domEvent) {
    triggerChildrenActive(false);
    onMouseLeave === null || onMouseLeave === void 0 || onMouseLeave({
      key: eventKey,
      domEvent
    });
  };
  var mergedActive = reactExports.useMemo(function() {
    if (active3) {
      return active3;
    }
    if (mode !== "inline") {
      return childrenActive || isSubPathKey([activeKey], eventKey);
    }
    return false;
  }, [mode, active3, activeKey, childrenActive, eventKey, isSubPathKey]);
  var directionStyle = useDirectionStyle(connectedPath.length);
  var onInternalTitleClick = function onInternalTitleClick2(e2) {
    if (mergedDisabled) {
      return;
    }
    onTitleClick === null || onTitleClick === void 0 || onTitleClick({
      key: eventKey,
      domEvent: e2
    });
    if (mode === "inline") {
      onOpenChange(eventKey, !originOpen);
    }
  };
  var onMergedItemClick = useMemoCallback(function(info2) {
    onClick === null || onClick === void 0 || onClick(warnItemProp(info2));
    onItemClick(info2);
  });
  var onPopupVisibleChange = function onPopupVisibleChange2(newVisible) {
    if (mode !== "inline") {
      onOpenChange(eventKey, newVisible);
    }
  };
  var onInternalFocus = function onInternalFocus2() {
    onActive(eventKey);
  };
  var popupId = domDataId && "".concat(domDataId, "-popup");
  var expandIconNode = reactExports.useMemo(function() {
    return /* @__PURE__ */ reactExports.createElement(Icon$2, {
      icon: mode !== "horizontal" ? mergedExpandIcon : void 0,
      props: _objectSpread2(_objectSpread2({}, props), {}, {
        isOpen: open,
        // [Legacy] Not sure why need this mark
        isSubMenu: true
      })
    }, /* @__PURE__ */ reactExports.createElement("i", {
      className: "".concat(subMenuPrefixCls, "-arrow")
    }));
  }, [mode, mergedExpandIcon, props, open, subMenuPrefixCls]);
  var titleNode = /* @__PURE__ */ reactExports.createElement("div", _extends$h({
    role: "menuitem",
    style: directionStyle,
    className: "".concat(subMenuPrefixCls, "-title"),
    tabIndex: mergedDisabled ? null : -1,
    ref: elementRef,
    title: typeof title === "string" ? title : null,
    "data-menu-id": overflowDisabled && domDataId ? null : domDataId,
    "aria-expanded": open,
    "aria-haspopup": true,
    "aria-controls": popupId,
    "aria-disabled": mergedDisabled,
    onClick: onInternalTitleClick,
    onFocus: onInternalFocus
  }, activeProps), title, expandIconNode);
  var triggerModeRef = reactExports.useRef(mode);
  if (mode !== "inline" && connectedPath.length > 1) {
    triggerModeRef.current = "vertical";
  } else {
    triggerModeRef.current = mode;
  }
  if (!overflowDisabled) {
    var triggerMode = triggerModeRef.current;
    titleNode = /* @__PURE__ */ reactExports.createElement(PopupTrigger, {
      mode: triggerMode,
      prefixCls: subMenuPrefixCls,
      visible: !internalPopupClose && open && mode !== "inline",
      popupClassName,
      popupOffset,
      popupStyle,
      popup: /* @__PURE__ */ reactExports.createElement(
        InheritableContextProvider,
        {
          mode: triggerMode === "horizontal" ? "vertical" : triggerMode
        },
        /* @__PURE__ */ reactExports.createElement(SubMenuList, {
          id: popupId,
          ref: popupRef
        }, children)
      ),
      disabled: mergedDisabled,
      onVisibleChange: onPopupVisibleChange
    }, titleNode);
  }
  var listNode = /* @__PURE__ */ reactExports.createElement(ForwardOverflow.Item, _extends$h({
    ref,
    role: "none"
  }, restProps, {
    component: "li",
    style: style2,
    className: classNames(subMenuPrefixCls, "".concat(subMenuPrefixCls, "-").concat(mode), className, _defineProperty$3(_defineProperty$3(_defineProperty$3(_defineProperty$3({}, "".concat(subMenuPrefixCls, "-open"), open), "".concat(subMenuPrefixCls, "-active"), mergedActive), "".concat(subMenuPrefixCls, "-selected"), childrenSelected), "".concat(subMenuPrefixCls, "-disabled"), mergedDisabled)),
    onMouseEnter: onInternalMouseEnter,
    onMouseLeave: onInternalMouseLeave
  }), titleNode, !overflowDisabled && /* @__PURE__ */ reactExports.createElement(InlineSubMenuList, {
    id: popupId,
    open,
    keyPath: connectedPath
  }, children));
  if (_internalRenderSubMenuItem) {
    listNode = _internalRenderSubMenuItem(listNode, props, {
      selected: childrenSelected,
      active: mergedActive,
      open,
      disabled: mergedDisabled
    });
  }
  return /* @__PURE__ */ reactExports.createElement(InheritableContextProvider, {
    onItemClick: onMergedItemClick,
    mode: mode === "horizontal" ? "vertical" : mode,
    itemIcon: mergedItemIcon,
    expandIcon: mergedExpandIcon
  }, listNode);
});
var SubMenu$1 = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var eventKey = props.eventKey, children = props.children;
  var connectedKeyPath = useFullPath(eventKey);
  var childList = parseChildren(children, connectedKeyPath);
  var measure = useMeasure();
  reactExports.useEffect(function() {
    if (measure) {
      measure.registerPath(eventKey, connectedKeyPath);
      return function() {
        measure.unregisterPath(eventKey, connectedKeyPath);
      };
    }
  }, [connectedKeyPath]);
  var renderNode;
  if (measure) {
    renderNode = childList;
  } else {
    renderNode = /* @__PURE__ */ reactExports.createElement(InternalSubMenu, _extends$h({
      ref
    }, props), childList);
  }
  return /* @__PURE__ */ reactExports.createElement(PathTrackerContext.Provider, {
    value: connectedKeyPath
  }, renderNode);
});
function Divider(_ref) {
  var className = _ref.className, style2 = _ref.style;
  var _React$useContext = reactExports.useContext(MenuContext$1), prefixCls = _React$useContext.prefixCls;
  var measure = useMeasure();
  if (measure) {
    return null;
  }
  return /* @__PURE__ */ reactExports.createElement("li", {
    role: "separator",
    className: classNames("".concat(prefixCls, "-item-divider"), className),
    style: style2
  });
}
var _excluded$g = ["className", "title", "eventKey", "children"];
var InternalMenuItemGroup = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var className = props.className, title = props.title;
  props.eventKey;
  var children = props.children, restProps = _objectWithoutProperties$3(props, _excluded$g);
  var _React$useContext = reactExports.useContext(MenuContext$1), prefixCls = _React$useContext.prefixCls;
  var groupPrefixCls = "".concat(prefixCls, "-item-group");
  return /* @__PURE__ */ reactExports.createElement("li", _extends$h({
    ref,
    role: "presentation"
  }, restProps, {
    onClick: function onClick(e2) {
      return e2.stopPropagation();
    },
    className: classNames(groupPrefixCls, className)
  }), /* @__PURE__ */ reactExports.createElement("div", {
    role: "presentation",
    className: "".concat(groupPrefixCls, "-title"),
    title: typeof title === "string" ? title : void 0
  }, title), /* @__PURE__ */ reactExports.createElement("ul", {
    role: "group",
    className: "".concat(groupPrefixCls, "-list")
  }, children));
});
var MenuItemGroup = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var eventKey = props.eventKey, children = props.children;
  var connectedKeyPath = useFullPath(eventKey);
  var childList = parseChildren(children, connectedKeyPath);
  var measure = useMeasure();
  if (measure) {
    return childList;
  }
  return /* @__PURE__ */ reactExports.createElement(InternalMenuItemGroup, _extends$h({
    ref
  }, omit$1(props, ["warnKey"])), childList);
});
var _excluded$f = ["label", "children", "key", "type", "extra"];
function convertItemsToNodes(list2, components2, prefixCls) {
  var MergedMenuItem = components2.item, MergedMenuItemGroup = components2.group, MergedSubMenu = components2.submenu, MergedDivider = components2.divider;
  return (list2 || []).map(function(opt, index2) {
    if (opt && _typeof$1(opt) === "object") {
      var _ref = opt, label = _ref.label, children = _ref.children, key = _ref.key, type4 = _ref.type, extra = _ref.extra, restProps = _objectWithoutProperties$3(_ref, _excluded$f);
      var mergedKey = key !== null && key !== void 0 ? key : "tmp-".concat(index2);
      if (children || type4 === "group") {
        if (type4 === "group") {
          return /* @__PURE__ */ reactExports.createElement(MergedMenuItemGroup, _extends$h({
            key: mergedKey
          }, restProps, {
            title: label
          }), convertItemsToNodes(children, components2, prefixCls));
        }
        return /* @__PURE__ */ reactExports.createElement(MergedSubMenu, _extends$h({
          key: mergedKey
        }, restProps, {
          title: label
        }), convertItemsToNodes(children, components2, prefixCls));
      }
      if (type4 === "divider") {
        return /* @__PURE__ */ reactExports.createElement(MergedDivider, _extends$h({
          key: mergedKey
        }, restProps));
      }
      return /* @__PURE__ */ reactExports.createElement(MergedMenuItem, _extends$h({
        key: mergedKey
      }, restProps, {
        extra
      }), label, (!!extra || extra === 0) && /* @__PURE__ */ reactExports.createElement("span", {
        className: "".concat(prefixCls, "-item-extra")
      }, extra));
    }
    return null;
  }).filter(function(opt) {
    return opt;
  });
}
function parseItems(children, items, keyPath, components2, prefixCls) {
  var childNodes = children;
  var mergedComponents = _objectSpread2({
    divider: Divider,
    item: MenuItem$3,
    group: MenuItemGroup,
    submenu: SubMenu$1
  }, components2);
  if (items) {
    childNodes = convertItemsToNodes(items, mergedComponents, prefixCls);
  }
  return parseChildren(childNodes, keyPath);
}
var _excluded$e = ["prefixCls", "rootClassName", "style", "className", "tabIndex", "items", "children", "direction", "id", "mode", "inlineCollapsed", "disabled", "disabledOverflow", "subMenuOpenDelay", "subMenuCloseDelay", "forceSubMenuRender", "defaultOpenKeys", "openKeys", "activeKey", "defaultActiveFirst", "selectable", "multiple", "defaultSelectedKeys", "selectedKeys", "onSelect", "onDeselect", "inlineIndent", "motion", "defaultMotions", "triggerSubMenuAction", "builtinPlacements", "itemIcon", "expandIcon", "overflowedIndicator", "overflowedIndicatorPopupClassName", "getPopupContainer", "onClick", "onOpenChange", "onKeyDown", "openAnimation", "openTransitionName", "_internalRenderMenuItem", "_internalRenderSubMenuItem", "_internalComponents"];
var EMPTY_LIST = [];
var Menu$1 = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var _childList$;
  var _ref = props, _ref$prefixCls = _ref.prefixCls, prefixCls = _ref$prefixCls === void 0 ? "rc-menu" : _ref$prefixCls, rootClassName = _ref.rootClassName, style2 = _ref.style, className = _ref.className, _ref$tabIndex = _ref.tabIndex, tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex, items = _ref.items, children = _ref.children, direction = _ref.direction, id2 = _ref.id, _ref$mode = _ref.mode, mode = _ref$mode === void 0 ? "vertical" : _ref$mode, inlineCollapsed = _ref.inlineCollapsed, disabled = _ref.disabled, disabledOverflow = _ref.disabledOverflow, _ref$subMenuOpenDelay = _ref.subMenuOpenDelay, subMenuOpenDelay = _ref$subMenuOpenDelay === void 0 ? 0.1 : _ref$subMenuOpenDelay, _ref$subMenuCloseDela = _ref.subMenuCloseDelay, subMenuCloseDelay = _ref$subMenuCloseDela === void 0 ? 0.1 : _ref$subMenuCloseDela, forceSubMenuRender = _ref.forceSubMenuRender, defaultOpenKeys = _ref.defaultOpenKeys, openKeys = _ref.openKeys, activeKey = _ref.activeKey, defaultActiveFirst = _ref.defaultActiveFirst, _ref$selectable = _ref.selectable, selectable = _ref$selectable === void 0 ? true : _ref$selectable, _ref$multiple = _ref.multiple, multiple = _ref$multiple === void 0 ? false : _ref$multiple, defaultSelectedKeys = _ref.defaultSelectedKeys, selectedKeys = _ref.selectedKeys, onSelect = _ref.onSelect, onDeselect = _ref.onDeselect, _ref$inlineIndent = _ref.inlineIndent, inlineIndent = _ref$inlineIndent === void 0 ? 24 : _ref$inlineIndent, motion = _ref.motion, defaultMotions = _ref.defaultMotions, _ref$triggerSubMenuAc = _ref.triggerSubMenuAction, triggerSubMenuAction = _ref$triggerSubMenuAc === void 0 ? "hover" : _ref$triggerSubMenuAc, builtinPlacements = _ref.builtinPlacements, itemIcon = _ref.itemIcon, expandIcon = _ref.expandIcon, _ref$overflowedIndica = _ref.overflowedIndicator, overflowedIndicator = _ref$overflowedIndica === void 0 ? "..." : _ref$overflowedIndica, overflowedIndicatorPopupClassName = _ref.overflowedIndicatorPopupClassName, getPopupContainer = _ref.getPopupContainer, onClick = _ref.onClick, onOpenChange = _ref.onOpenChange, onKeyDown = _ref.onKeyDown;
  _ref.openAnimation;
  _ref.openTransitionName;
  var _internalRenderMenuItem = _ref._internalRenderMenuItem, _internalRenderSubMenuItem = _ref._internalRenderSubMenuItem, _internalComponents = _ref._internalComponents, restProps = _objectWithoutProperties$3(_ref, _excluded$e);
  var _React$useMemo = reactExports.useMemo(function() {
    return [parseItems(children, items, EMPTY_LIST, _internalComponents, prefixCls), parseItems(children, items, EMPTY_LIST, {}, prefixCls)];
  }, [children, items, _internalComponents]), _React$useMemo2 = _slicedToArray(_React$useMemo, 2), childList = _React$useMemo2[0], measureChildList = _React$useMemo2[1];
  var _React$useState = reactExports.useState(false), _React$useState2 = _slicedToArray(_React$useState, 2), mounted = _React$useState2[0], setMounted = _React$useState2[1];
  var containerRef = reactExports.useRef();
  var uuid2 = useUUID(id2);
  var isRtl = direction === "rtl";
  var _useMergedState = useMergedState(defaultOpenKeys, {
    value: openKeys,
    postState: function postState(keys2) {
      return keys2 || EMPTY_LIST;
    }
  }), _useMergedState2 = _slicedToArray(_useMergedState, 2), mergedOpenKeys = _useMergedState2[0], setMergedOpenKeys = _useMergedState2[1];
  var triggerOpenKeys = function triggerOpenKeys2(keys2) {
    var forceFlush = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
    function doUpdate() {
      setMergedOpenKeys(keys2);
      onOpenChange === null || onOpenChange === void 0 || onOpenChange(keys2);
    }
    if (forceFlush) {
      reactDomExports.flushSync(doUpdate);
    } else {
      doUpdate();
    }
  };
  var _React$useState3 = reactExports.useState(mergedOpenKeys), _React$useState4 = _slicedToArray(_React$useState3, 2), inlineCacheOpenKeys = _React$useState4[0], setInlineCacheOpenKeys = _React$useState4[1];
  var mountRef = reactExports.useRef(false);
  var _React$useMemo3 = reactExports.useMemo(function() {
    if ((mode === "inline" || mode === "vertical") && inlineCollapsed) {
      return ["vertical", inlineCollapsed];
    }
    return [mode, false];
  }, [mode, inlineCollapsed]), _React$useMemo4 = _slicedToArray(_React$useMemo3, 2), mergedMode = _React$useMemo4[0], mergedInlineCollapsed = _React$useMemo4[1];
  var isInlineMode = mergedMode === "inline";
  var _React$useState5 = reactExports.useState(mergedMode), _React$useState6 = _slicedToArray(_React$useState5, 2), internalMode = _React$useState6[0], setInternalMode = _React$useState6[1];
  var _React$useState7 = reactExports.useState(mergedInlineCollapsed), _React$useState8 = _slicedToArray(_React$useState7, 2), internalInlineCollapsed = _React$useState8[0], setInternalInlineCollapsed = _React$useState8[1];
  reactExports.useEffect(function() {
    setInternalMode(mergedMode);
    setInternalInlineCollapsed(mergedInlineCollapsed);
    if (!mountRef.current) {
      return;
    }
    if (isInlineMode) {
      setMergedOpenKeys(inlineCacheOpenKeys);
    } else {
      triggerOpenKeys(EMPTY_LIST);
    }
  }, [mergedMode, mergedInlineCollapsed]);
  var _React$useState9 = reactExports.useState(0), _React$useState10 = _slicedToArray(_React$useState9, 2), lastVisibleIndex = _React$useState10[0], setLastVisibleIndex = _React$useState10[1];
  var allVisible = lastVisibleIndex >= childList.length - 1 || internalMode !== "horizontal" || disabledOverflow;
  reactExports.useEffect(function() {
    if (isInlineMode) {
      setInlineCacheOpenKeys(mergedOpenKeys);
    }
  }, [mergedOpenKeys]);
  reactExports.useEffect(function() {
    mountRef.current = true;
    return function() {
      mountRef.current = false;
    };
  }, []);
  var _useKeyRecords = useKeyRecords(), registerPath = _useKeyRecords.registerPath, unregisterPath = _useKeyRecords.unregisterPath, refreshOverflowKeys = _useKeyRecords.refreshOverflowKeys, isSubPathKey = _useKeyRecords.isSubPathKey, getKeyPath = _useKeyRecords.getKeyPath, getKeys = _useKeyRecords.getKeys, getSubPathKeys = _useKeyRecords.getSubPathKeys;
  var registerPathContext = reactExports.useMemo(function() {
    return {
      registerPath,
      unregisterPath
    };
  }, [registerPath, unregisterPath]);
  var pathUserContext = reactExports.useMemo(function() {
    return {
      isSubPathKey
    };
  }, [isSubPathKey]);
  reactExports.useEffect(function() {
    refreshOverflowKeys(allVisible ? EMPTY_LIST : childList.slice(lastVisibleIndex + 1).map(function(child) {
      return child.key;
    }));
  }, [lastVisibleIndex, allVisible]);
  var _useMergedState3 = useMergedState(activeKey || defaultActiveFirst && ((_childList$ = childList[0]) === null || _childList$ === void 0 ? void 0 : _childList$.key), {
    value: activeKey
  }), _useMergedState4 = _slicedToArray(_useMergedState3, 2), mergedActiveKey = _useMergedState4[0], setMergedActiveKey = _useMergedState4[1];
  var onActive = useMemoCallback(function(key) {
    setMergedActiveKey(key);
  });
  var onInactive = useMemoCallback(function() {
    setMergedActiveKey(void 0);
  });
  reactExports.useImperativeHandle(ref, function() {
    return {
      list: containerRef.current,
      focus: function focus(options) {
        var _childList$find;
        var keys2 = getKeys();
        var _refreshElements = refreshElements(keys2, uuid2), elements = _refreshElements.elements, key2element = _refreshElements.key2element, element2key = _refreshElements.element2key;
        var focusableElements2 = getFocusableElements(containerRef.current, elements);
        var shouldFocusKey = mergedActiveKey !== null && mergedActiveKey !== void 0 ? mergedActiveKey : focusableElements2[0] ? element2key.get(focusableElements2[0]) : (_childList$find = childList.find(function(node2) {
          return !node2.props.disabled;
        })) === null || _childList$find === void 0 ? void 0 : _childList$find.key;
        var elementToFocus = key2element.get(shouldFocusKey);
        if (shouldFocusKey && elementToFocus) {
          var _elementToFocus$focus;
          elementToFocus === null || elementToFocus === void 0 || (_elementToFocus$focus = elementToFocus.focus) === null || _elementToFocus$focus === void 0 || _elementToFocus$focus.call(elementToFocus, options);
        }
      }
    };
  });
  var _useMergedState5 = useMergedState(defaultSelectedKeys || [], {
    value: selectedKeys,
    // Legacy convert key to array
    postState: function postState(keys2) {
      if (Array.isArray(keys2)) {
        return keys2;
      }
      if (keys2 === null || keys2 === void 0) {
        return EMPTY_LIST;
      }
      return [keys2];
    }
  }), _useMergedState6 = _slicedToArray(_useMergedState5, 2), mergedSelectKeys = _useMergedState6[0], setMergedSelectKeys = _useMergedState6[1];
  var triggerSelection = function triggerSelection2(info2) {
    if (selectable) {
      var targetKey = info2.key;
      var exist = mergedSelectKeys.includes(targetKey);
      var newSelectKeys;
      if (multiple) {
        if (exist) {
          newSelectKeys = mergedSelectKeys.filter(function(key) {
            return key !== targetKey;
          });
        } else {
          newSelectKeys = [].concat(_toConsumableArray(mergedSelectKeys), [targetKey]);
        }
      } else {
        newSelectKeys = [targetKey];
      }
      setMergedSelectKeys(newSelectKeys);
      var selectInfo = _objectSpread2(_objectSpread2({}, info2), {}, {
        selectedKeys: newSelectKeys
      });
      if (exist) {
        onDeselect === null || onDeselect === void 0 || onDeselect(selectInfo);
      } else {
        onSelect === null || onSelect === void 0 || onSelect(selectInfo);
      }
    }
    if (!multiple && mergedOpenKeys.length && internalMode !== "inline") {
      triggerOpenKeys(EMPTY_LIST);
    }
  };
  var onInternalClick = useMemoCallback(function(info2) {
    onClick === null || onClick === void 0 || onClick(warnItemProp(info2));
    triggerSelection(info2);
  });
  var onInternalOpenChange = useMemoCallback(function(key, open) {
    var newOpenKeys = mergedOpenKeys.filter(function(k2) {
      return k2 !== key;
    });
    if (open) {
      newOpenKeys.push(key);
    } else if (internalMode !== "inline") {
      var subPathKeys = getSubPathKeys(key);
      newOpenKeys = newOpenKeys.filter(function(k2) {
        return !subPathKeys.has(k2);
      });
    }
    if (!isEqual$2(mergedOpenKeys, newOpenKeys, true)) {
      triggerOpenKeys(newOpenKeys, true);
    }
  });
  var triggerAccessibilityOpen = function triggerAccessibilityOpen2(key, open) {
    var nextOpen = open !== null && open !== void 0 ? open : !mergedOpenKeys.includes(key);
    onInternalOpenChange(key, nextOpen);
  };
  var onInternalKeyDown = useAccessibility(internalMode, mergedActiveKey, isRtl, uuid2, containerRef, getKeys, getKeyPath, setMergedActiveKey, triggerAccessibilityOpen, onKeyDown);
  reactExports.useEffect(function() {
    setMounted(true);
  }, []);
  var privateContext = reactExports.useMemo(function() {
    return {
      _internalRenderMenuItem,
      _internalRenderSubMenuItem
    };
  }, [_internalRenderMenuItem, _internalRenderSubMenuItem]);
  var wrappedChildList = internalMode !== "horizontal" || disabledOverflow ? childList : (
    // Need wrap for overflow dropdown that do not response for open
    childList.map(function(child, index2) {
      return (
        // Always wrap provider to avoid sub node re-mount
        /* @__PURE__ */ reactExports.createElement(InheritableContextProvider, {
          key: child.key,
          overflowDisabled: index2 > lastVisibleIndex
        }, child)
      );
    })
  );
  var container = /* @__PURE__ */ reactExports.createElement(ForwardOverflow, _extends$h({
    id: id2,
    ref: containerRef,
    prefixCls: "".concat(prefixCls, "-overflow"),
    component: "ul",
    itemComponent: MenuItem$3,
    className: classNames(prefixCls, "".concat(prefixCls, "-root"), "".concat(prefixCls, "-").concat(internalMode), className, _defineProperty$3(_defineProperty$3({}, "".concat(prefixCls, "-inline-collapsed"), internalInlineCollapsed), "".concat(prefixCls, "-rtl"), isRtl), rootClassName),
    dir: direction,
    style: style2,
    role: "menu",
    tabIndex,
    data: wrappedChildList,
    renderRawItem: function renderRawItem(node2) {
      return node2;
    },
    renderRawRest: function renderRawRest(omitItems) {
      var len = omitItems.length;
      var originOmitItems = len ? childList.slice(-len) : null;
      return /* @__PURE__ */ reactExports.createElement(SubMenu$1, {
        eventKey: OVERFLOW_KEY,
        title: overflowedIndicator,
        disabled: allVisible,
        internalPopupClose: len === 0,
        popupClassName: overflowedIndicatorPopupClassName
      }, originOmitItems);
    },
    maxCount: internalMode !== "horizontal" || disabledOverflow ? ForwardOverflow.INVALIDATE : ForwardOverflow.RESPONSIVE,
    ssr: "full",
    "data-menu-list": true,
    onVisibleChange: function onVisibleChange(newLastIndex) {
      setLastVisibleIndex(newLastIndex);
    },
    onKeyDown: onInternalKeyDown
  }, restProps));
  return /* @__PURE__ */ reactExports.createElement(PrivateContext.Provider, {
    value: privateContext
  }, /* @__PURE__ */ reactExports.createElement(IdContext.Provider, {
    value: uuid2
  }, /* @__PURE__ */ reactExports.createElement(InheritableContextProvider, {
    prefixCls,
    rootClassName,
    mode: internalMode,
    openKeys: mergedOpenKeys,
    rtl: isRtl,
    disabled,
    motion: mounted ? motion : null,
    defaultMotions: mounted ? defaultMotions : null,
    activeKey: mergedActiveKey,
    onActive,
    onInactive,
    selectedKeys: mergedSelectKeys,
    inlineIndent,
    subMenuOpenDelay,
    subMenuCloseDelay,
    forceSubMenuRender,
    builtinPlacements,
    triggerSubMenuAction,
    getPopupContainer,
    itemIcon,
    expandIcon,
    onItemClick: onInternalClick,
    onOpenChange: onInternalOpenChange
  }, /* @__PURE__ */ reactExports.createElement(PathUserContext.Provider, {
    value: pathUserContext
  }, container), /* @__PURE__ */ reactExports.createElement("div", {
    style: {
      display: "none"
    },
    "aria-hidden": true
  }, /* @__PURE__ */ reactExports.createElement(PathRegisterContext.Provider, {
    value: registerPathContext
  }, measureChildList)))));
});
var ExportMenu = Menu$1;
ExportMenu.Item = MenuItem$3;
ExportMenu.SubMenu = SubMenu$1;
ExportMenu.ItemGroup = MenuItemGroup;
ExportMenu.Divider = Divider;
const SiderContext = /* @__PURE__ */ reactExports.createContext({});
var EllipsisOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z" } }] }, "name": "ellipsis", "theme": "outlined" };
var EllipsisOutlined = function EllipsisOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: EllipsisOutlined$1
  }));
};
var RefIcon$1g = /* @__PURE__ */ reactExports.forwardRef(EllipsisOutlined);
const MenuContext = /* @__PURE__ */ reactExports.createContext({
  prefixCls: "",
  firstLevel: true,
  inlineCollapsed: false
});
var __rest$5 = function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
};
const MenuDivider = (props) => {
  const {
    prefixCls: customizePrefixCls,
    className,
    dashed
  } = props, restProps = __rest$5(props, ["prefixCls", "className", "dashed"]);
  const {
    getPrefixCls
  } = reactExports.useContext(ConfigContext);
  const prefixCls = getPrefixCls("menu", customizePrefixCls);
  const classString = classNames({
    [`${prefixCls}-item-divider-dashed`]: !!dashed
  }, className);
  return /* @__PURE__ */ reactExports.createElement(Divider, Object.assign({
    className: classString
  }, restProps));
};
const MenuItem$1 = (props) => {
  var _a2;
  const {
    className,
    children,
    icon,
    title,
    danger,
    extra
  } = props;
  const {
    prefixCls,
    firstLevel,
    direction,
    disableMenuItemTitleTooltip,
    inlineCollapsed: isInlineCollapsed
  } = reactExports.useContext(MenuContext);
  const renderItemChildren = (inlineCollapsed) => {
    const label = children === null || children === void 0 ? void 0 : children[0];
    const wrapNode = /* @__PURE__ */ reactExports.createElement("span", {
      className: classNames(`${prefixCls}-title-content`, {
        [`${prefixCls}-title-content-with-extra`]: !!extra || extra === 0
      })
    }, children);
    if (!icon || /* @__PURE__ */ reactExports.isValidElement(children) && children.type === "span") {
      if (children && inlineCollapsed && firstLevel && typeof label === "string") {
        return /* @__PURE__ */ reactExports.createElement("div", {
          className: `${prefixCls}-inline-collapsed-noicon`
        }, label.charAt(0));
      }
    }
    return wrapNode;
  };
  const {
    siderCollapsed
  } = reactExports.useContext(SiderContext);
  let tooltipTitle = title;
  if (typeof title === "undefined") {
    tooltipTitle = firstLevel ? children : "";
  } else if (title === false) {
    tooltipTitle = "";
  }
  const tooltipProps = {
    title: tooltipTitle
  };
  if (!siderCollapsed && !isInlineCollapsed) {
    tooltipProps.title = null;
    tooltipProps.open = false;
  }
  const childrenLength = toArray$4(children).length;
  let returnNode = /* @__PURE__ */ reactExports.createElement(MenuItem$3, Object.assign({}, omit$1(props, ["title", "icon", "danger"]), {
    className: classNames({
      [`${prefixCls}-item-danger`]: danger,
      [`${prefixCls}-item-only-child`]: (icon ? childrenLength + 1 : childrenLength) === 1
    }, className),
    title: typeof title === "string" ? title : void 0
  }), cloneElement(icon, {
    className: classNames(/* @__PURE__ */ reactExports.isValidElement(icon) ? (_a2 = icon.props) === null || _a2 === void 0 ? void 0 : _a2.className : void 0, `${prefixCls}-item-icon`)
  }), renderItemChildren(isInlineCollapsed));
  if (!disableMenuItemTitleTooltip) {
    returnNode = /* @__PURE__ */ reactExports.createElement(Tooltip$2, Object.assign({}, tooltipProps, {
      placement: direction === "rtl" ? "left" : "right",
      classNames: {
        root: `${prefixCls}-inline-collapsed-tooltip`
      }
    }), returnNode);
  }
  return returnNode;
};
(function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
});
const OverrideContext = /* @__PURE__ */ reactExports.createContext(null);
const getHorizontalStyle = (token2) => {
  const {
    componentCls,
    motionDurationSlow,
    horizontalLineHeight,
    colorSplit,
    lineWidth,
    lineType,
    itemPaddingInline
  } = token2;
  return {
    [`${componentCls}-horizontal`]: {
      lineHeight: horizontalLineHeight,
      border: 0,
      borderBottom: `${unit$1(lineWidth)} ${lineType} ${colorSplit}`,
      boxShadow: "none",
      "&::after": {
        display: "block",
        clear: "both",
        height: 0,
        content: '"\\20"'
      },
      // ======================= Item =======================
      [`${componentCls}-item, ${componentCls}-submenu`]: {
        position: "relative",
        display: "inline-block",
        verticalAlign: "bottom",
        paddingInline: itemPaddingInline
      },
      [`> ${componentCls}-item:hover,
        > ${componentCls}-item-active,
        > ${componentCls}-submenu ${componentCls}-submenu-title:hover`]: {
        backgroundColor: "transparent"
      },
      [`${componentCls}-item, ${componentCls}-submenu-title`]: {
        transition: [`border-color ${motionDurationSlow}`, `background ${motionDurationSlow}`].join(",")
      },
      // ===================== Sub Menu =====================
      [`${componentCls}-submenu-arrow`]: {
        display: "none"
      }
    }
  };
};
const getRTLStyle = ({
  componentCls,
  menuArrowOffset,
  calc
}) => ({
  [`${componentCls}-rtl`]: {
    direction: "rtl"
  },
  [`${componentCls}-submenu-rtl`]: {
    transformOrigin: "100% 0"
  },
  // Vertical Arrow
  [`${componentCls}-rtl${componentCls}-vertical,
    ${componentCls}-submenu-rtl ${componentCls}-vertical`]: {
    [`${componentCls}-submenu-arrow`]: {
      "&::before": {
        transform: `rotate(-45deg) translateY(${unit$1(calc(menuArrowOffset).mul(-1).equal())})`
      },
      "&::after": {
        transform: `rotate(45deg) translateY(${unit$1(menuArrowOffset)})`
      }
    }
  }
});
const accessibilityFocus = (token2) => Object.assign({}, genFocusOutline(token2));
const getThemeStyle = (token2, themeSuffix) => {
  const {
    componentCls,
    itemColor,
    itemSelectedColor,
    subMenuItemSelectedColor,
    groupTitleColor,
    itemBg,
    subMenuItemBg,
    itemSelectedBg,
    activeBarHeight,
    activeBarWidth,
    activeBarBorderWidth,
    motionDurationSlow,
    motionEaseInOut,
    motionEaseOut,
    itemPaddingInline,
    motionDurationMid,
    itemHoverColor,
    lineType,
    colorSplit,
    // Disabled
    itemDisabledColor,
    // Danger
    dangerItemColor,
    dangerItemHoverColor,
    dangerItemSelectedColor,
    dangerItemActiveBg,
    dangerItemSelectedBg,
    // Bg
    popupBg,
    itemHoverBg,
    itemActiveBg,
    menuSubMenuBg,
    // Horizontal
    horizontalItemSelectedColor,
    horizontalItemSelectedBg,
    horizontalItemBorderRadius,
    horizontalItemHoverBg
  } = token2;
  return {
    [`${componentCls}-${themeSuffix}, ${componentCls}-${themeSuffix} > ${componentCls}`]: {
      color: itemColor,
      background: itemBg,
      [`&${componentCls}-root:focus-visible`]: Object.assign({}, accessibilityFocus(token2)),
      // ======================== Item ========================
      [`${componentCls}-item`]: {
        "&-group-title, &-extra": {
          color: groupTitleColor
        }
      },
      [`${componentCls}-submenu-selected > ${componentCls}-submenu-title`]: {
        color: subMenuItemSelectedColor
      },
      [`${componentCls}-item, ${componentCls}-submenu-title`]: {
        color: itemColor,
        [`&:not(${componentCls}-item-disabled):focus-visible`]: Object.assign({}, accessibilityFocus(token2))
      },
      // Disabled
      [`${componentCls}-item-disabled, ${componentCls}-submenu-disabled`]: {
        color: `${itemDisabledColor} !important`
      },
      // Hover
      [`${componentCls}-item:not(${componentCls}-item-selected):not(${componentCls}-submenu-selected)`]: {
        [`&:hover, > ${componentCls}-submenu-title:hover`]: {
          color: itemHoverColor
        }
      },
      [`&:not(${componentCls}-horizontal)`]: {
        [`${componentCls}-item:not(${componentCls}-item-selected)`]: {
          "&:hover": {
            backgroundColor: itemHoverBg
          },
          "&:active": {
            backgroundColor: itemActiveBg
          }
        },
        [`${componentCls}-submenu-title`]: {
          "&:hover": {
            backgroundColor: itemHoverBg
          },
          "&:active": {
            backgroundColor: itemActiveBg
          }
        }
      },
      // Danger - only Item has
      [`${componentCls}-item-danger`]: {
        color: dangerItemColor,
        [`&${componentCls}-item:hover`]: {
          [`&:not(${componentCls}-item-selected):not(${componentCls}-submenu-selected)`]: {
            color: dangerItemHoverColor
          }
        },
        [`&${componentCls}-item:active`]: {
          background: dangerItemActiveBg
        }
      },
      [`${componentCls}-item a`]: {
        "&, &:hover": {
          color: "inherit"
        }
      },
      [`${componentCls}-item-selected`]: {
        color: itemSelectedColor,
        // Danger
        [`&${componentCls}-item-danger`]: {
          color: dangerItemSelectedColor
        },
        "a, a:hover": {
          color: "inherit"
        }
      },
      [`& ${componentCls}-item-selected`]: {
        backgroundColor: itemSelectedBg,
        // Danger
        [`&${componentCls}-item-danger`]: {
          backgroundColor: dangerItemSelectedBg
        }
      },
      [`&${componentCls}-submenu > ${componentCls}`]: {
        backgroundColor: menuSubMenuBg
      },
      // ===== 设置浮层的颜色 =======
      // ！dark 模式会被popupBg 会被rest 为 darkPopupBg
      [`&${componentCls}-popup > ${componentCls}`]: {
        backgroundColor: popupBg
      },
      [`&${componentCls}-submenu-popup > ${componentCls}`]: {
        backgroundColor: popupBg
      },
      // ===== 设置浮层的颜色 end =======
      // ====================== Horizontal ======================
      [`&${componentCls}-horizontal`]: Object.assign(Object.assign({}, themeSuffix === "dark" ? {
        borderBottom: 0
      } : {}), {
        [`> ${componentCls}-item, > ${componentCls}-submenu`]: {
          top: activeBarBorderWidth,
          marginTop: token2.calc(activeBarBorderWidth).mul(-1).equal(),
          marginBottom: 0,
          borderRadius: horizontalItemBorderRadius,
          "&::after": {
            position: "absolute",
            insetInline: itemPaddingInline,
            bottom: 0,
            borderBottom: `${unit$1(activeBarHeight)} solid transparent`,
            transition: `border-color ${motionDurationSlow} ${motionEaseInOut}`,
            content: '""'
          },
          "&:hover, &-active, &-open": {
            background: horizontalItemHoverBg,
            "&::after": {
              borderBottomWidth: activeBarHeight,
              borderBottomColor: horizontalItemSelectedColor
            }
          },
          "&-selected": {
            color: horizontalItemSelectedColor,
            backgroundColor: horizontalItemSelectedBg,
            "&:hover": {
              backgroundColor: horizontalItemSelectedBg
            },
            "&::after": {
              borderBottomWidth: activeBarHeight,
              borderBottomColor: horizontalItemSelectedColor
            }
          }
        }
      }),
      // ================== Inline & Vertical ===================
      //
      [`&${componentCls}-root`]: {
        [`&${componentCls}-inline, &${componentCls}-vertical`]: {
          borderInlineEnd: `${unit$1(activeBarBorderWidth)} ${lineType} ${colorSplit}`
        }
      },
      // ======================== Inline ========================
      [`&${componentCls}-inline`]: {
        // Sub
        [`${componentCls}-sub${componentCls}-inline`]: {
          background: subMenuItemBg
        },
        [`${componentCls}-item`]: {
          position: "relative",
          "&::after": {
            position: "absolute",
            insetBlock: 0,
            insetInlineEnd: 0,
            borderInlineEnd: `${unit$1(activeBarWidth)} solid ${itemSelectedColor}`,
            transform: "scaleY(0.0001)",
            opacity: 0,
            transition: [`transform ${motionDurationMid} ${motionEaseOut}`, `opacity ${motionDurationMid} ${motionEaseOut}`].join(","),
            content: '""'
          },
          // Danger
          [`&${componentCls}-item-danger`]: {
            "&::after": {
              borderInlineEndColor: dangerItemSelectedColor
            }
          }
        },
        [`${componentCls}-selected, ${componentCls}-item-selected`]: {
          "&::after": {
            transform: "scaleY(1)",
            opacity: 1,
            transition: [`transform ${motionDurationMid} ${motionEaseInOut}`, `opacity ${motionDurationMid} ${motionEaseInOut}`].join(",")
          }
        }
      }
    }
  };
};
const getVerticalInlineStyle = (token2) => {
  const {
    componentCls,
    itemHeight,
    itemMarginInline,
    padding,
    menuArrowSize,
    marginXS,
    itemMarginBlock,
    itemWidth,
    itemPaddingInline
  } = token2;
  const paddingWithArrow = token2.calc(menuArrowSize).add(padding).add(marginXS).equal();
  return {
    [`${componentCls}-item`]: {
      position: "relative",
      overflow: "hidden"
    },
    [`${componentCls}-item, ${componentCls}-submenu-title`]: {
      height: itemHeight,
      lineHeight: unit$1(itemHeight),
      paddingInline: itemPaddingInline,
      overflow: "hidden",
      textOverflow: "ellipsis",
      marginInline: itemMarginInline,
      marginBlock: itemMarginBlock,
      width: itemWidth
    },
    [`> ${componentCls}-item,
            > ${componentCls}-submenu > ${componentCls}-submenu-title`]: {
      height: itemHeight,
      lineHeight: unit$1(itemHeight)
    },
    [`${componentCls}-item-group-list ${componentCls}-submenu-title,
            ${componentCls}-submenu-title`]: {
      paddingInlineEnd: paddingWithArrow
    }
  };
};
const getVerticalStyle = (token2) => {
  const {
    componentCls,
    iconCls,
    itemHeight,
    colorTextLightSolid,
    dropdownWidth,
    controlHeightLG,
    motionEaseOut,
    paddingXL,
    itemMarginInline,
    fontSizeLG,
    motionDurationFast,
    motionDurationSlow,
    paddingXS,
    boxShadowSecondary,
    collapsedWidth,
    collapsedIconSize
  } = token2;
  const inlineItemStyle = {
    height: itemHeight,
    lineHeight: unit$1(itemHeight),
    listStylePosition: "inside",
    listStyleType: "disc"
  };
  return [
    {
      [componentCls]: {
        "&-inline, &-vertical": Object.assign({
          [`&${componentCls}-root`]: {
            boxShadow: "none"
          }
        }, getVerticalInlineStyle(token2))
      },
      [`${componentCls}-submenu-popup`]: {
        [`${componentCls}-vertical`]: Object.assign(Object.assign({}, getVerticalInlineStyle(token2)), {
          boxShadow: boxShadowSecondary
        })
      }
    },
    // Vertical only
    {
      [`${componentCls}-submenu-popup ${componentCls}-vertical${componentCls}-sub`]: {
        minWidth: dropdownWidth,
        maxHeight: `calc(100vh - ${unit$1(token2.calc(controlHeightLG).mul(2.5).equal())})`,
        padding: "0",
        overflow: "hidden",
        borderInlineEnd: 0,
        // https://github.com/ant-design/ant-design/issues/22244
        // https://github.com/ant-design/ant-design/issues/26812
        "&:not([class*='-active'])": {
          overflowX: "hidden",
          overflowY: "auto"
        }
      }
    },
    // Inline Only
    {
      [`${componentCls}-inline`]: {
        width: "100%",
        // Motion enhance for first level
        [`&${componentCls}-root`]: {
          [`${componentCls}-item, ${componentCls}-submenu-title`]: {
            display: "flex",
            alignItems: "center",
            transition: [`border-color ${motionDurationSlow}`, `background ${motionDurationSlow}`, `padding ${motionDurationFast} ${motionEaseOut}`].join(","),
            [`> ${componentCls}-title-content`]: {
              flex: "auto",
              minWidth: 0,
              overflow: "hidden",
              textOverflow: "ellipsis"
            },
            "> *": {
              flex: "none"
            }
          }
        },
        // >>>>> Sub
        [`${componentCls}-sub${componentCls}-inline`]: {
          padding: 0,
          border: 0,
          borderRadius: 0,
          boxShadow: "none",
          [`& > ${componentCls}-submenu > ${componentCls}-submenu-title`]: inlineItemStyle,
          [`& ${componentCls}-item-group-title`]: {
            paddingInlineStart: paddingXL
          }
        },
        // >>>>> Item
        [`${componentCls}-item`]: inlineItemStyle
      }
    },
    // Inline Collapse Only
    {
      [`${componentCls}-inline-collapsed`]: {
        width: collapsedWidth,
        [`&${componentCls}-root`]: {
          [`${componentCls}-item, ${componentCls}-submenu ${componentCls}-submenu-title`]: {
            [`> ${componentCls}-inline-collapsed-noicon`]: {
              fontSize: fontSizeLG,
              textAlign: "center"
            }
          }
        },
        [`> ${componentCls}-item,
          > ${componentCls}-item-group > ${componentCls}-item-group-list > ${componentCls}-item,
          > ${componentCls}-item-group > ${componentCls}-item-group-list > ${componentCls}-submenu > ${componentCls}-submenu-title,
          > ${componentCls}-submenu > ${componentCls}-submenu-title`]: {
          insetInlineStart: 0,
          paddingInline: `calc(50% - ${unit$1(token2.calc(collapsedIconSize).div(2).equal())} - ${unit$1(itemMarginInline)})`,
          textOverflow: "clip",
          [`
            ${componentCls}-submenu-arrow,
            ${componentCls}-submenu-expand-icon
          `]: {
            opacity: 0
          },
          [`${componentCls}-item-icon, ${iconCls}`]: {
            margin: 0,
            fontSize: collapsedIconSize,
            lineHeight: unit$1(itemHeight),
            "+ span": {
              display: "inline-block",
              opacity: 0
            }
          }
        },
        [`${componentCls}-item-icon, ${iconCls}`]: {
          display: "inline-block"
        },
        "&-tooltip": {
          pointerEvents: "none",
          [`${componentCls}-item-icon, ${iconCls}`]: {
            display: "none"
          },
          "a, a:hover": {
            color: colorTextLightSolid
          }
        },
        [`${componentCls}-item-group-title`]: Object.assign(Object.assign({}, textEllipsis), {
          paddingInline: paddingXS
        })
      }
    }
  ];
};
const genMenuItemStyle = (token2) => {
  const {
    componentCls,
    motionDurationSlow,
    motionDurationMid,
    motionEaseInOut,
    motionEaseOut,
    iconCls,
    iconSize,
    iconMarginInlineEnd
  } = token2;
  return {
    // >>>>> Item
    [`${componentCls}-item, ${componentCls}-submenu-title`]: {
      position: "relative",
      display: "block",
      margin: 0,
      whiteSpace: "nowrap",
      cursor: "pointer",
      transition: [`border-color ${motionDurationSlow}`, `background ${motionDurationSlow}`, `padding calc(${motionDurationSlow} + 0.1s) ${motionEaseInOut}`].join(","),
      [`${componentCls}-item-icon, ${iconCls}`]: {
        minWidth: iconSize,
        fontSize: iconSize,
        transition: [`font-size ${motionDurationMid} ${motionEaseOut}`, `margin ${motionDurationSlow} ${motionEaseInOut}`, `color ${motionDurationSlow}`].join(","),
        "+ span": {
          marginInlineStart: iconMarginInlineEnd,
          opacity: 1,
          transition: [`opacity ${motionDurationSlow} ${motionEaseInOut}`, `margin ${motionDurationSlow}`, `color ${motionDurationSlow}`].join(",")
        }
      },
      [`${componentCls}-item-icon`]: Object.assign({}, resetIcon()),
      [`&${componentCls}-item-only-child`]: {
        [`> ${iconCls}, > ${componentCls}-item-icon`]: {
          marginInlineEnd: 0
        }
      }
    },
    // Disabled state sets text to gray and nukes hover/tab effects
    [`${componentCls}-item-disabled, ${componentCls}-submenu-disabled`]: {
      background: "none !important",
      cursor: "not-allowed",
      "&::after": {
        borderColor: "transparent !important"
      },
      a: {
        color: "inherit !important",
        cursor: "not-allowed",
        pointerEvents: "none"
      },
      [`> ${componentCls}-submenu-title`]: {
        color: "inherit !important",
        cursor: "not-allowed"
      }
    }
  };
};
const genSubMenuArrowStyle = (token2) => {
  const {
    componentCls,
    motionDurationSlow,
    motionEaseInOut,
    borderRadius: borderRadius2,
    menuArrowSize,
    menuArrowOffset
  } = token2;
  return {
    [`${componentCls}-submenu`]: {
      "&-expand-icon, &-arrow": {
        position: "absolute",
        top: "50%",
        insetInlineEnd: token2.margin,
        width: menuArrowSize,
        color: "currentcolor",
        transform: "translateY(-50%)",
        transition: `transform ${motionDurationSlow} ${motionEaseInOut}, opacity ${motionDurationSlow}`
      },
      "&-arrow": {
        // →
        "&::before, &::after": {
          position: "absolute",
          width: token2.calc(menuArrowSize).mul(0.6).equal(),
          height: token2.calc(menuArrowSize).mul(0.15).equal(),
          backgroundColor: "currentcolor",
          borderRadius: borderRadius2,
          transition: [`background ${motionDurationSlow} ${motionEaseInOut}`, `transform ${motionDurationSlow} ${motionEaseInOut}`, `top ${motionDurationSlow} ${motionEaseInOut}`, `color ${motionDurationSlow} ${motionEaseInOut}`].join(","),
          content: '""'
        },
        "&::before": {
          transform: `rotate(45deg) translateY(${unit$1(token2.calc(menuArrowOffset).mul(-1).equal())})`
        },
        "&::after": {
          transform: `rotate(-45deg) translateY(${unit$1(menuArrowOffset)})`
        }
      }
    }
  };
};
const getBaseStyle = (token2) => {
  const {
    antCls,
    componentCls,
    fontSize,
    motionDurationSlow,
    motionDurationMid,
    motionEaseInOut,
    paddingXS,
    padding,
    colorSplit,
    lineWidth,
    zIndexPopup,
    borderRadiusLG,
    subMenuItemBorderRadius,
    menuArrowSize,
    menuArrowOffset,
    lineType,
    groupTitleLineHeight,
    groupTitleFontSize
  } = token2;
  return [
    // Misc
    {
      "": {
        [componentCls]: Object.assign(Object.assign({}, clearFix()), {
          // Hidden
          "&-hidden": {
            display: "none"
          }
        })
      },
      [`${componentCls}-submenu-hidden`]: {
        display: "none"
      }
    },
    {
      [componentCls]: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, resetComponent(token2)), clearFix()), {
        marginBottom: 0,
        paddingInlineStart: 0,
        // Override default ul/ol
        fontSize,
        lineHeight: 0,
        listStyle: "none",
        outline: "none",
        // Magic cubic here but smooth transition
        transition: `width ${motionDurationSlow} cubic-bezier(0.2, 0, 0, 1) 0s`,
        "ul, ol": {
          margin: 0,
          padding: 0,
          listStyle: "none"
        },
        // Overflow ellipsis
        "&-overflow": {
          display: "flex",
          [`${componentCls}-item`]: {
            flex: "none"
          }
        },
        [`${componentCls}-item, ${componentCls}-submenu, ${componentCls}-submenu-title`]: {
          borderRadius: token2.itemBorderRadius
        },
        [`${componentCls}-item-group-title`]: {
          padding: `${unit$1(paddingXS)} ${unit$1(padding)}`,
          fontSize: groupTitleFontSize,
          lineHeight: groupTitleLineHeight,
          transition: `all ${motionDurationSlow}`
        },
        [`&-horizontal ${componentCls}-submenu`]: {
          transition: [`border-color ${motionDurationSlow} ${motionEaseInOut}`, `background ${motionDurationSlow} ${motionEaseInOut}`].join(",")
        },
        [`${componentCls}-submenu, ${componentCls}-submenu-inline`]: {
          transition: [`border-color ${motionDurationSlow} ${motionEaseInOut}`, `background ${motionDurationSlow} ${motionEaseInOut}`, `padding ${motionDurationMid} ${motionEaseInOut}`].join(",")
        },
        [`${componentCls}-submenu ${componentCls}-sub`]: {
          cursor: "initial",
          transition: [`background ${motionDurationSlow} ${motionEaseInOut}`, `padding ${motionDurationSlow} ${motionEaseInOut}`].join(",")
        },
        [`${componentCls}-title-content`]: {
          transition: `color ${motionDurationSlow}`,
          "&-with-extra": {
            display: "inline-flex",
            alignItems: "center",
            width: "100%"
          },
          // https://github.com/ant-design/ant-design/issues/41143
          [`> ${antCls}-typography-ellipsis-single-line`]: {
            display: "inline",
            verticalAlign: "unset"
          },
          [`${componentCls}-item-extra`]: {
            marginInlineStart: "auto",
            paddingInlineStart: token2.padding
          }
        },
        [`${componentCls}-item a`]: {
          "&::before": {
            position: "absolute",
            inset: 0,
            backgroundColor: "transparent",
            content: '""'
          }
        },
        // Removed a Badge related style seems it's safe
        // https://github.com/ant-design/ant-design/issues/19809
        // >>>>> Divider
        [`${componentCls}-item-divider`]: {
          overflow: "hidden",
          lineHeight: 0,
          borderColor: colorSplit,
          borderStyle: lineType,
          borderWidth: 0,
          borderTopWidth: lineWidth,
          marginBlock: lineWidth,
          padding: 0,
          "&-dashed": {
            borderStyle: "dashed"
          }
        }
      }), genMenuItemStyle(token2)), {
        [`${componentCls}-item-group`]: {
          [`${componentCls}-item-group-list`]: {
            margin: 0,
            padding: 0,
            [`${componentCls}-item, ${componentCls}-submenu-title`]: {
              paddingInline: `${unit$1(token2.calc(fontSize).mul(2).equal())} ${unit$1(padding)}`
            }
          }
        },
        // ======================= Sub Menu =======================
        "&-submenu": {
          "&-popup": {
            position: "absolute",
            zIndex: zIndexPopup,
            borderRadius: borderRadiusLG,
            boxShadow: "none",
            transformOrigin: "0 0",
            [`&${componentCls}-submenu`]: {
              background: "transparent"
            },
            // https://github.com/ant-design/ant-design/issues/13955
            "&::before": {
              position: "absolute",
              inset: 0,
              zIndex: -1,
              width: "100%",
              height: "100%",
              opacity: 0,
              content: '""'
            },
            [`> ${componentCls}`]: Object.assign(Object.assign(Object.assign({
              borderRadius: borderRadiusLG
            }, genMenuItemStyle(token2)), genSubMenuArrowStyle(token2)), {
              [`${componentCls}-item, ${componentCls}-submenu > ${componentCls}-submenu-title`]: {
                borderRadius: subMenuItemBorderRadius
              },
              [`${componentCls}-submenu-title::after`]: {
                transition: `transform ${motionDurationSlow} ${motionEaseInOut}`
              }
            })
          },
          [`
          &-placement-leftTop,
          &-placement-bottomRight,
          `]: {
            transformOrigin: "100% 0"
          },
          [`
          &-placement-leftBottom,
          &-placement-topRight,
          `]: {
            transformOrigin: "100% 100%"
          },
          [`
          &-placement-rightBottom,
          &-placement-topLeft,
          `]: {
            transformOrigin: "0 100%"
          },
          [`
          &-placement-bottomLeft,
          &-placement-rightTop,
          `]: {
            transformOrigin: "0 0"
          },
          [`
          &-placement-leftTop,
          &-placement-leftBottom
          `]: {
            paddingInlineEnd: token2.paddingXS
          },
          [`
          &-placement-rightTop,
          &-placement-rightBottom
          `]: {
            paddingInlineStart: token2.paddingXS
          },
          [`
          &-placement-topRight,
          &-placement-topLeft
          `]: {
            paddingBottom: token2.paddingXS
          },
          [`
          &-placement-bottomRight,
          &-placement-bottomLeft
          `]: {
            paddingTop: token2.paddingXS
          }
        }
      }), genSubMenuArrowStyle(token2)), {
        [`&-inline-collapsed ${componentCls}-submenu-arrow,
        &-inline ${componentCls}-submenu-arrow`]: {
          // ↓
          "&::before": {
            transform: `rotate(-45deg) translateX(${unit$1(menuArrowOffset)})`
          },
          "&::after": {
            transform: `rotate(45deg) translateX(${unit$1(token2.calc(menuArrowOffset).mul(-1).equal())})`
          }
        },
        [`${componentCls}-submenu-open${componentCls}-submenu-inline > ${componentCls}-submenu-title > ${componentCls}-submenu-arrow`]: {
          // ↑
          transform: `translateY(${unit$1(token2.calc(menuArrowSize).mul(0.2).mul(-1).equal())})`,
          "&::after": {
            transform: `rotate(-45deg) translateX(${unit$1(token2.calc(menuArrowOffset).mul(-1).equal())})`
          },
          "&::before": {
            transform: `rotate(45deg) translateX(${unit$1(menuArrowOffset)})`
          }
        }
      })
    },
    // Integration with header element so menu items have the same height
    {
      [`${antCls}-layout-header`]: {
        [componentCls]: {
          lineHeight: "inherit"
        }
      }
    }
  ];
};
const prepareComponentToken$3 = (token2) => {
  var _a2, _b2, _c2;
  const {
    colorPrimary,
    colorError,
    colorTextDisabled,
    colorErrorBg,
    colorText,
    colorTextDescription,
    colorBgContainer,
    colorFillAlter,
    colorFillContent,
    lineWidth,
    lineWidthBold,
    controlItemBgActive,
    colorBgTextHover,
    controlHeightLG,
    lineHeight: lineHeight2,
    colorBgElevated,
    marginXXS,
    padding,
    fontSize,
    controlHeightSM,
    fontSizeLG,
    colorTextLightSolid,
    colorErrorHover
  } = token2;
  const activeBarWidth = (_a2 = token2.activeBarWidth) !== null && _a2 !== void 0 ? _a2 : 0;
  const activeBarBorderWidth = (_b2 = token2.activeBarBorderWidth) !== null && _b2 !== void 0 ? _b2 : lineWidth;
  const itemMarginInline = (_c2 = token2.itemMarginInline) !== null && _c2 !== void 0 ? _c2 : token2.marginXXS;
  const colorTextDark = new FastColor(colorTextLightSolid).setA(0.65).toRgbString();
  return {
    dropdownWidth: 160,
    zIndexPopup: token2.zIndexPopupBase + 50,
    radiusItem: token2.borderRadiusLG,
    itemBorderRadius: token2.borderRadiusLG,
    radiusSubMenuItem: token2.borderRadiusSM,
    subMenuItemBorderRadius: token2.borderRadiusSM,
    colorItemText: colorText,
    itemColor: colorText,
    colorItemTextHover: colorText,
    itemHoverColor: colorText,
    colorItemTextHoverHorizontal: colorPrimary,
    horizontalItemHoverColor: colorPrimary,
    colorGroupTitle: colorTextDescription,
    groupTitleColor: colorTextDescription,
    colorItemTextSelected: colorPrimary,
    itemSelectedColor: colorPrimary,
    subMenuItemSelectedColor: colorPrimary,
    colorItemTextSelectedHorizontal: colorPrimary,
    horizontalItemSelectedColor: colorPrimary,
    colorItemBg: colorBgContainer,
    itemBg: colorBgContainer,
    colorItemBgHover: colorBgTextHover,
    itemHoverBg: colorBgTextHover,
    colorItemBgActive: colorFillContent,
    itemActiveBg: controlItemBgActive,
    colorSubItemBg: colorFillAlter,
    subMenuItemBg: colorFillAlter,
    colorItemBgSelected: controlItemBgActive,
    itemSelectedBg: controlItemBgActive,
    colorItemBgSelectedHorizontal: "transparent",
    horizontalItemSelectedBg: "transparent",
    colorActiveBarWidth: 0,
    activeBarWidth,
    colorActiveBarHeight: lineWidthBold,
    activeBarHeight: lineWidthBold,
    colorActiveBarBorderSize: lineWidth,
    activeBarBorderWidth,
    // Disabled
    colorItemTextDisabled: colorTextDisabled,
    itemDisabledColor: colorTextDisabled,
    // Danger
    colorDangerItemText: colorError,
    dangerItemColor: colorError,
    colorDangerItemTextHover: colorError,
    dangerItemHoverColor: colorError,
    colorDangerItemTextSelected: colorError,
    dangerItemSelectedColor: colorError,
    colorDangerItemBgActive: colorErrorBg,
    dangerItemActiveBg: colorErrorBg,
    colorDangerItemBgSelected: colorErrorBg,
    dangerItemSelectedBg: colorErrorBg,
    itemMarginInline,
    horizontalItemBorderRadius: 0,
    horizontalItemHoverBg: "transparent",
    itemHeight: controlHeightLG,
    groupTitleLineHeight: lineHeight2,
    collapsedWidth: controlHeightLG * 2,
    popupBg: colorBgElevated,
    itemMarginBlock: marginXXS,
    itemPaddingInline: padding,
    horizontalLineHeight: `${controlHeightLG * 1.15}px`,
    iconSize: fontSize,
    iconMarginInlineEnd: controlHeightSM - fontSize,
    collapsedIconSize: fontSizeLG,
    groupTitleFontSize: fontSize,
    // Disabled
    darkItemDisabledColor: new FastColor(colorTextLightSolid).setA(0.25).toRgbString(),
    // Dark
    darkItemColor: colorTextDark,
    darkDangerItemColor: colorError,
    darkItemBg: "#001529",
    darkPopupBg: "#001529",
    darkSubMenuItemBg: "#000c17",
    darkItemSelectedColor: colorTextLightSolid,
    darkItemSelectedBg: colorPrimary,
    darkDangerItemSelectedBg: colorError,
    darkItemHoverBg: "transparent",
    darkGroupTitleColor: colorTextDark,
    darkItemHoverColor: colorTextLightSolid,
    darkDangerItemHoverColor: colorErrorHover,
    darkDangerItemSelectedColor: colorTextLightSolid,
    darkDangerItemActiveBg: colorError,
    // internal
    itemWidth: activeBarWidth ? `calc(100% + ${activeBarBorderWidth}px)` : `calc(100% - ${itemMarginInline * 2}px)`
  };
};
const useStyle$3 = (prefixCls, rootCls = prefixCls, injectStyle = true) => {
  const useStyle2 = genStyleHooks("Menu", (token2) => {
    const {
      colorBgElevated,
      controlHeightLG,
      fontSize,
      darkItemColor,
      darkDangerItemColor,
      darkItemBg,
      darkSubMenuItemBg,
      darkItemSelectedColor,
      darkItemSelectedBg,
      darkDangerItemSelectedBg,
      darkItemHoverBg,
      darkGroupTitleColor,
      darkItemHoverColor,
      darkItemDisabledColor,
      darkDangerItemHoverColor,
      darkDangerItemSelectedColor,
      darkDangerItemActiveBg,
      popupBg,
      darkPopupBg
    } = token2;
    const menuArrowSize = token2.calc(fontSize).div(7).mul(5).equal();
    const menuToken = merge$4(token2, {
      menuArrowSize,
      menuHorizontalHeight: token2.calc(controlHeightLG).mul(1.15).equal(),
      menuArrowOffset: token2.calc(menuArrowSize).mul(0.25).equal(),
      menuSubMenuBg: colorBgElevated,
      calc: token2.calc,
      popupBg
    });
    const menuDarkToken = merge$4(menuToken, {
      itemColor: darkItemColor,
      itemHoverColor: darkItemHoverColor,
      groupTitleColor: darkGroupTitleColor,
      itemSelectedColor: darkItemSelectedColor,
      subMenuItemSelectedColor: darkItemSelectedColor,
      itemBg: darkItemBg,
      popupBg: darkPopupBg,
      subMenuItemBg: darkSubMenuItemBg,
      itemActiveBg: "transparent",
      itemSelectedBg: darkItemSelectedBg,
      activeBarHeight: 0,
      activeBarBorderWidth: 0,
      itemHoverBg: darkItemHoverBg,
      // Disabled
      itemDisabledColor: darkItemDisabledColor,
      // Danger
      dangerItemColor: darkDangerItemColor,
      dangerItemHoverColor: darkDangerItemHoverColor,
      dangerItemSelectedColor: darkDangerItemSelectedColor,
      dangerItemActiveBg: darkDangerItemActiveBg,
      dangerItemSelectedBg: darkDangerItemSelectedBg,
      menuSubMenuBg: darkSubMenuItemBg,
      // Horizontal
      horizontalItemSelectedColor: darkItemSelectedColor,
      horizontalItemSelectedBg: darkItemSelectedBg
    });
    return [
      // Basic
      getBaseStyle(menuToken),
      // Horizontal
      getHorizontalStyle(menuToken),
      // Hard code for some light style
      // Vertical
      getVerticalStyle(menuToken),
      // Hard code for some light style
      // Theme
      getThemeStyle(menuToken, "light"),
      getThemeStyle(menuDarkToken, "dark"),
      // RTL
      getRTLStyle(menuToken),
      // Motion
      genCollapseMotion(menuToken),
      initSlideMotion(menuToken, "slide-up"),
      initSlideMotion(menuToken, "slide-down"),
      initZoomMotion(menuToken, "zoom-big")
    ];
  }, prepareComponentToken$3, {
    deprecatedTokens: [["colorGroupTitle", "groupTitleColor"], ["radiusItem", "itemBorderRadius"], ["radiusSubMenuItem", "subMenuItemBorderRadius"], ["colorItemText", "itemColor"], ["colorItemTextHover", "itemHoverColor"], ["colorItemTextHoverHorizontal", "horizontalItemHoverColor"], ["colorItemTextSelected", "itemSelectedColor"], ["colorItemTextSelectedHorizontal", "horizontalItemSelectedColor"], ["colorItemTextDisabled", "itemDisabledColor"], ["colorDangerItemText", "dangerItemColor"], ["colorDangerItemTextHover", "dangerItemHoverColor"], ["colorDangerItemTextSelected", "dangerItemSelectedColor"], ["colorDangerItemBgActive", "dangerItemActiveBg"], ["colorDangerItemBgSelected", "dangerItemSelectedBg"], ["colorItemBg", "itemBg"], ["colorItemBgHover", "itemHoverBg"], ["colorSubItemBg", "subMenuItemBg"], ["colorItemBgActive", "itemActiveBg"], ["colorItemBgSelectedHorizontal", "horizontalItemSelectedBg"], ["colorActiveBarWidth", "activeBarWidth"], ["colorActiveBarHeight", "activeBarHeight"], ["colorActiveBarBorderSize", "activeBarBorderWidth"], ["colorItemBgSelected", "itemSelectedBg"]],
    // Dropdown will handle menu style self. We do not need to handle this.
    injectStyle,
    unitless: {
      groupTitleLineHeight: true
    }
  });
  return useStyle2(prefixCls, rootCls);
};
const SubMenu = (props) => {
  var _a2;
  const {
    popupClassName,
    icon,
    title,
    theme: customTheme
  } = props;
  const context = reactExports.useContext(MenuContext);
  const {
    prefixCls,
    inlineCollapsed,
    theme: contextTheme
  } = context;
  const parentPath = useFullPath();
  let titleNode;
  if (!icon) {
    titleNode = inlineCollapsed && !parentPath.length && title && typeof title === "string" ? /* @__PURE__ */ reactExports.createElement("div", {
      className: `${prefixCls}-inline-collapsed-noicon`
    }, title.charAt(0)) : /* @__PURE__ */ reactExports.createElement("span", {
      className: `${prefixCls}-title-content`
    }, title);
  } else {
    const titleIsSpan = /* @__PURE__ */ reactExports.isValidElement(title) && title.type === "span";
    titleNode = /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, cloneElement(icon, {
      className: classNames(/* @__PURE__ */ reactExports.isValidElement(icon) ? (_a2 = icon.props) === null || _a2 === void 0 ? void 0 : _a2.className : void 0, `${prefixCls}-item-icon`)
    }), titleIsSpan ? title : /* @__PURE__ */ reactExports.createElement("span", {
      className: `${prefixCls}-title-content`
    }, title));
  }
  const contextValue = reactExports.useMemo(() => Object.assign(Object.assign({}, context), {
    firstLevel: false
  }), [context]);
  const [zIndex] = useZIndex("Menu");
  return /* @__PURE__ */ reactExports.createElement(MenuContext.Provider, {
    value: contextValue
  }, /* @__PURE__ */ reactExports.createElement(SubMenu$1, Object.assign({}, omit$1(props, ["icon"]), {
    title: titleNode,
    popupClassName: classNames(prefixCls, popupClassName, `${prefixCls}-${customTheme || contextTheme}`),
    popupStyle: Object.assign({
      zIndex
    }, props.popupStyle)
  })));
};
var __rest$4 = function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
};
function isEmptyIcon(icon) {
  return icon === null || icon === false;
}
const MENU_COMPONENTS = {
  item: MenuItem$1,
  submenu: SubMenu,
  divider: MenuDivider
};
const InternalMenu = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
  var _a2;
  const override = reactExports.useContext(OverrideContext);
  const overrideObj = override || {};
  const {
    getPrefixCls,
    getPopupContainer,
    direction,
    menu: menu2
  } = reactExports.useContext(ConfigContext);
  const rootPrefixCls = getPrefixCls();
  const {
    prefixCls: customizePrefixCls,
    className,
    style: style2,
    theme: theme2 = "light",
    expandIcon,
    _internalDisableMenuItemTitleTooltip,
    inlineCollapsed,
    siderCollapsed,
    rootClassName,
    mode,
    selectable,
    onClick,
    overflowedIndicatorPopupClassName
  } = props, restProps = __rest$4(props, ["prefixCls", "className", "style", "theme", "expandIcon", "_internalDisableMenuItemTitleTooltip", "inlineCollapsed", "siderCollapsed", "rootClassName", "mode", "selectable", "onClick", "overflowedIndicatorPopupClassName"]);
  const passedProps = omit$1(restProps, ["collapsedWidth"]);
  (_a2 = overrideObj.validator) === null || _a2 === void 0 ? void 0 : _a2.call(overrideObj, {
    mode
  });
  const onItemClick = useEvent$1((...args) => {
    var _a22;
    onClick === null || onClick === void 0 ? void 0 : onClick.apply(void 0, args);
    (_a22 = overrideObj.onClick) === null || _a22 === void 0 ? void 0 : _a22.call(overrideObj);
  });
  const mergedMode = overrideObj.mode || mode;
  const mergedSelectable = selectable !== null && selectable !== void 0 ? selectable : overrideObj.selectable;
  const mergedInlineCollapsed = inlineCollapsed !== null && inlineCollapsed !== void 0 ? inlineCollapsed : siderCollapsed;
  const defaultMotions = {
    horizontal: {
      motionName: `${rootPrefixCls}-slide-up`
    },
    inline: initCollapseMotion(rootPrefixCls),
    other: {
      motionName: `${rootPrefixCls}-zoom-big`
    }
  };
  const prefixCls = getPrefixCls("menu", customizePrefixCls || overrideObj.prefixCls);
  const rootCls = useCSSVarCls(prefixCls);
  const [wrapCSSVar, hashId, cssVarCls] = useStyle$3(prefixCls, rootCls, !override);
  const menuClassName = classNames(`${prefixCls}-${theme2}`, menu2 === null || menu2 === void 0 ? void 0 : menu2.className, className);
  const mergedExpandIcon = reactExports.useMemo(() => {
    var _a22, _b2;
    if (typeof expandIcon === "function" || isEmptyIcon(expandIcon)) {
      return expandIcon || null;
    }
    if (typeof overrideObj.expandIcon === "function" || isEmptyIcon(overrideObj.expandIcon)) {
      return overrideObj.expandIcon || null;
    }
    if (typeof (menu2 === null || menu2 === void 0 ? void 0 : menu2.expandIcon) === "function" || isEmptyIcon(menu2 === null || menu2 === void 0 ? void 0 : menu2.expandIcon)) {
      return (menu2 === null || menu2 === void 0 ? void 0 : menu2.expandIcon) || null;
    }
    const mergedIcon = (_a22 = expandIcon !== null && expandIcon !== void 0 ? expandIcon : overrideObj === null || overrideObj === void 0 ? void 0 : overrideObj.expandIcon) !== null && _a22 !== void 0 ? _a22 : menu2 === null || menu2 === void 0 ? void 0 : menu2.expandIcon;
    return cloneElement(mergedIcon, {
      className: classNames(`${prefixCls}-submenu-expand-icon`, /* @__PURE__ */ reactExports.isValidElement(mergedIcon) ? (_b2 = mergedIcon.props) === null || _b2 === void 0 ? void 0 : _b2.className : void 0)
    });
  }, [expandIcon, overrideObj === null || overrideObj === void 0 ? void 0 : overrideObj.expandIcon, menu2 === null || menu2 === void 0 ? void 0 : menu2.expandIcon, prefixCls]);
  const contextValue = reactExports.useMemo(() => ({
    prefixCls,
    inlineCollapsed: mergedInlineCollapsed || false,
    direction,
    firstLevel: true,
    theme: theme2,
    mode: mergedMode,
    disableMenuItemTitleTooltip: _internalDisableMenuItemTitleTooltip
  }), [prefixCls, mergedInlineCollapsed, direction, _internalDisableMenuItemTitleTooltip, theme2]);
  return wrapCSSVar(/* @__PURE__ */ reactExports.createElement(OverrideContext.Provider, {
    value: null
  }, /* @__PURE__ */ reactExports.createElement(MenuContext.Provider, {
    value: contextValue
  }, /* @__PURE__ */ reactExports.createElement(ExportMenu, Object.assign({
    getPopupContainer,
    overflowedIndicator: /* @__PURE__ */ reactExports.createElement(RefIcon$1g, null),
    overflowedIndicatorPopupClassName: classNames(prefixCls, `${prefixCls}-${theme2}`, overflowedIndicatorPopupClassName),
    mode: mergedMode,
    selectable: mergedSelectable,
    onClick: onItemClick
  }, passedProps, {
    inlineCollapsed: mergedInlineCollapsed,
    style: Object.assign(Object.assign({}, menu2 === null || menu2 === void 0 ? void 0 : menu2.style), style2),
    className: menuClassName,
    prefixCls,
    direction,
    defaultMotions,
    expandIcon: mergedExpandIcon,
    ref,
    rootClassName: classNames(rootClassName, hashId, overrideObj.rootClassName, cssVarCls, rootCls),
    _internalComponents: MENU_COMPONENTS
  })))));
});
const Menu = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
  const menuRef = reactExports.useRef(null);
  const context = reactExports.useContext(SiderContext);
  reactExports.useImperativeHandle(ref, () => ({
    menu: menuRef.current,
    focus: (options) => {
      var _a2;
      (_a2 = menuRef.current) === null || _a2 === void 0 ? void 0 : _a2.focus(options);
    }
  }));
  return /* @__PURE__ */ reactExports.createElement(InternalMenu, Object.assign({
    ref: menuRef
  }, props, context));
});
Menu.Item = MenuItem$1;
Menu.SubMenu = SubMenu;
Menu.Divider = MenuDivider;
Menu.ItemGroup = MenuItemGroup;
var dayjs_min = { exports: {} };
(function(module2, exports2) {
  !function(t2, e2) {
    module2.exports = e2();
  }(commonjsGlobal, function() {
    var t2 = 1e3, e2 = 6e4, n2 = 36e5, r2 = "millisecond", i2 = "second", s2 = "minute", u2 = "hour", a2 = "day", o2 = "week", c2 = "month", f2 = "quarter", h3 = "year", d2 = "date", l2 = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y2 = /\[([^\]]+)]|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, M2 = { 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(t3) {
      var e3 = ["th", "st", "nd", "rd"], n3 = t3 % 100;
      return "[" + t3 + (e3[(n3 - 20) % 10] || e3[n3] || e3[0]) + "]";
    } }, m2 = function(t3, e3, n3) {
      var r3 = String(t3);
      return !r3 || r3.length >= e3 ? t3 : "" + Array(e3 + 1 - r3.length).join(n3) + t3;
    }, v2 = { s: m2, z: function(t3) {
      var e3 = -t3.utcOffset(), n3 = Math.abs(e3), r3 = Math.floor(n3 / 60), i3 = n3 % 60;
      return (e3 <= 0 ? "+" : "-") + m2(r3, 2, "0") + ":" + m2(i3, 2, "0");
    }, m: function t3(e3, n3) {
      if (e3.date() < n3.date())
        return -t3(n3, e3);
      var r3 = 12 * (n3.year() - e3.year()) + (n3.month() - e3.month()), i3 = e3.clone().add(r3, c2), s3 = n3 - i3 < 0, u3 = e3.clone().add(r3 + (s3 ? -1 : 1), c2);
      return +(-(r3 + (n3 - i3) / (s3 ? i3 - u3 : u3 - i3)) || 0);
    }, a: function(t3) {
      return t3 < 0 ? Math.ceil(t3) || 0 : Math.floor(t3);
    }, p: function(t3) {
      return { M: c2, y: h3, w: o2, d: a2, D: d2, h: u2, m: s2, s: i2, ms: r2, Q: f2 }[t3] || String(t3 || "").toLowerCase().replace(/s$/, "");
    }, u: function(t3) {
      return void 0 === t3;
    } }, g2 = "en", D2 = {};
    D2[g2] = M2;
    var p2 = "$isDayjsObject", S2 = function(t3) {
      return t3 instanceof _24 || !(!t3 || !t3[p2]);
    }, w2 = function t3(e3, n3, r3) {
      var i3;
      if (!e3)
        return g2;
      if ("string" == typeof e3) {
        var s3 = e3.toLowerCase();
        D2[s3] && (i3 = s3), n3 && (D2[s3] = n3, i3 = s3);
        var u3 = e3.split("-");
        if (!i3 && u3.length > 1)
          return t3(u3[0]);
      } else {
        var a3 = e3.name;
        D2[a3] = e3, i3 = a3;
      }
      return !r3 && i3 && (g2 = i3), i3 || !r3 && g2;
    }, O2 = function(t3, e3) {
      if (S2(t3))
        return t3.clone();
      var n3 = "object" == typeof e3 ? e3 : {};
      return n3.date = t3, n3.args = arguments, new _24(n3);
    }, b2 = v2;
    b2.l = w2, b2.i = S2, b2.w = function(t3, e3) {
      return O2(t3, { locale: e3.$L, utc: e3.$u, x: e3.$x, $offset: e3.$offset });
    };
    var _24 = function() {
      function M3(t3) {
        this.$L = w2(t3.locale, null, true), this.parse(t3), this.$x = this.$x || t3.x || {}, this[p2] = true;
      }
      var m3 = M3.prototype;
      return m3.parse = function(t3) {
        this.$d = function(t4) {
          var e3 = t4.date, n3 = t4.utc;
          if (null === e3)
            return /* @__PURE__ */ new Date(NaN);
          if (b2.u(e3))
            return /* @__PURE__ */ new Date();
          if (e3 instanceof Date)
            return new Date(e3);
          if ("string" == typeof e3 && !/Z$/i.test(e3)) {
            var r3 = e3.match($);
            if (r3) {
              var i3 = r3[2] - 1 || 0, s3 = (r3[7] || "0").substring(0, 3);
              return n3 ? new Date(Date.UTC(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3)) : new Date(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3);
            }
          }
          return new Date(e3);
        }(t3), this.init();
      }, m3.init = function() {
        var t3 = this.$d;
        this.$y = t3.getFullYear(), this.$M = t3.getMonth(), this.$D = t3.getDate(), this.$W = t3.getDay(), this.$H = t3.getHours(), this.$m = t3.getMinutes(), this.$s = t3.getSeconds(), this.$ms = t3.getMilliseconds();
      }, m3.$utils = function() {
        return b2;
      }, m3.isValid = function() {
        return !(this.$d.toString() === l2);
      }, m3.isSame = function(t3, e3) {
        var n3 = O2(t3);
        return this.startOf(e3) <= n3 && n3 <= this.endOf(e3);
      }, m3.isAfter = function(t3, e3) {
        return O2(t3) < this.startOf(e3);
      }, m3.isBefore = function(t3, e3) {
        return this.endOf(e3) < O2(t3);
      }, m3.$g = function(t3, e3, n3) {
        return b2.u(t3) ? this[e3] : this.set(n3, t3);
      }, m3.unix = function() {
        return Math.floor(this.valueOf() / 1e3);
      }, m3.valueOf = function() {
        return this.$d.getTime();
      }, m3.startOf = function(t3, e3) {
        var n3 = this, r3 = !!b2.u(e3) || e3, f3 = b2.p(t3), l3 = function(t4, e4) {
          var i3 = b2.w(n3.$u ? Date.UTC(n3.$y, e4, t4) : new Date(n3.$y, e4, t4), n3);
          return r3 ? i3 : i3.endOf(a2);
        }, $2 = function(t4, e4) {
          return b2.w(n3.toDate()[t4].apply(n3.toDate("s"), (r3 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e4)), n3);
        }, y3 = this.$W, M4 = this.$M, m4 = this.$D, v3 = "set" + (this.$u ? "UTC" : "");
        switch (f3) {
          case h3:
            return r3 ? l3(1, 0) : l3(31, 11);
          case c2:
            return r3 ? l3(1, M4) : l3(0, M4 + 1);
          case o2:
            var g3 = this.$locale().weekStart || 0, D3 = (y3 < g3 ? y3 + 7 : y3) - g3;
            return l3(r3 ? m4 - D3 : m4 + (6 - D3), M4);
          case a2:
          case d2:
            return $2(v3 + "Hours", 0);
          case u2:
            return $2(v3 + "Minutes", 1);
          case s2:
            return $2(v3 + "Seconds", 2);
          case i2:
            return $2(v3 + "Milliseconds", 3);
          default:
            return this.clone();
        }
      }, m3.endOf = function(t3) {
        return this.startOf(t3, false);
      }, m3.$set = function(t3, e3) {
        var n3, o3 = b2.p(t3), f3 = "set" + (this.$u ? "UTC" : ""), l3 = (n3 = {}, n3[a2] = f3 + "Date", n3[d2] = f3 + "Date", n3[c2] = f3 + "Month", n3[h3] = f3 + "FullYear", n3[u2] = f3 + "Hours", n3[s2] = f3 + "Minutes", n3[i2] = f3 + "Seconds", n3[r2] = f3 + "Milliseconds", n3)[o3], $2 = o3 === a2 ? this.$D + (e3 - this.$W) : e3;
        if (o3 === c2 || o3 === h3) {
          var y3 = this.clone().set(d2, 1);
          y3.$d[l3]($2), y3.init(), this.$d = y3.set(d2, Math.min(this.$D, y3.daysInMonth())).$d;
        } else
          l3 && this.$d[l3]($2);
        return this.init(), this;
      }, m3.set = function(t3, e3) {
        return this.clone().$set(t3, e3);
      }, m3.get = function(t3) {
        return this[b2.p(t3)]();
      }, m3.add = function(r3, f3) {
        var d3, l3 = this;
        r3 = Number(r3);
        var $2 = b2.p(f3), y3 = function(t3) {
          var e3 = O2(l3);
          return b2.w(e3.date(e3.date() + Math.round(t3 * r3)), l3);
        };
        if ($2 === c2)
          return this.set(c2, this.$M + r3);
        if ($2 === h3)
          return this.set(h3, this.$y + r3);
        if ($2 === a2)
          return y3(1);
        if ($2 === o2)
          return y3(7);
        var M4 = (d3 = {}, d3[s2] = e2, d3[u2] = n2, d3[i2] = t2, d3)[$2] || 1, m4 = this.$d.getTime() + r3 * M4;
        return b2.w(m4, this);
      }, m3.subtract = function(t3, e3) {
        return this.add(-1 * t3, e3);
      }, m3.format = function(t3) {
        var e3 = this, n3 = this.$locale();
        if (!this.isValid())
          return n3.invalidDate || l2;
        var r3 = t3 || "YYYY-MM-DDTHH:mm:ssZ", i3 = b2.z(this), s3 = this.$H, u3 = this.$m, a3 = this.$M, o3 = n3.weekdays, c3 = n3.months, f3 = n3.meridiem, h4 = function(t4, n4, i4, s4) {
          return t4 && (t4[n4] || t4(e3, r3)) || i4[n4].slice(0, s4);
        }, d3 = function(t4) {
          return b2.s(s3 % 12 || 12, t4, "0");
        }, $2 = f3 || function(t4, e4, n4) {
          var r4 = t4 < 12 ? "AM" : "PM";
          return n4 ? r4.toLowerCase() : r4;
        };
        return r3.replace(y2, function(t4, r4) {
          return r4 || function(t5) {
            switch (t5) {
              case "YY":
                return String(e3.$y).slice(-2);
              case "YYYY":
                return b2.s(e3.$y, 4, "0");
              case "M":
                return a3 + 1;
              case "MM":
                return b2.s(a3 + 1, 2, "0");
              case "MMM":
                return h4(n3.monthsShort, a3, c3, 3);
              case "MMMM":
                return h4(c3, a3);
              case "D":
                return e3.$D;
              case "DD":
                return b2.s(e3.$D, 2, "0");
              case "d":
                return String(e3.$W);
              case "dd":
                return h4(n3.weekdaysMin, e3.$W, o3, 2);
              case "ddd":
                return h4(n3.weekdaysShort, e3.$W, o3, 3);
              case "dddd":
                return o3[e3.$W];
              case "H":
                return String(s3);
              case "HH":
                return b2.s(s3, 2, "0");
              case "h":
                return d3(1);
              case "hh":
                return d3(2);
              case "a":
                return $2(s3, u3, true);
              case "A":
                return $2(s3, u3, false);
              case "m":
                return String(u3);
              case "mm":
                return b2.s(u3, 2, "0");
              case "s":
                return String(e3.$s);
              case "ss":
                return b2.s(e3.$s, 2, "0");
              case "SSS":
                return b2.s(e3.$ms, 3, "0");
              case "Z":
                return i3;
            }
            return null;
          }(t4) || i3.replace(":", "");
        });
      }, m3.utcOffset = function() {
        return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
      }, m3.diff = function(r3, d3, l3) {
        var $2, y3 = this, M4 = b2.p(d3), m4 = O2(r3), v3 = (m4.utcOffset() - this.utcOffset()) * e2, g3 = this - m4, D3 = function() {
          return b2.m(y3, m4);
        };
        switch (M4) {
          case h3:
            $2 = D3() / 12;
            break;
          case c2:
            $2 = D3();
            break;
          case f2:
            $2 = D3() / 3;
            break;
          case o2:
            $2 = (g3 - v3) / 6048e5;
            break;
          case a2:
            $2 = (g3 - v3) / 864e5;
            break;
          case u2:
            $2 = g3 / n2;
            break;
          case s2:
            $2 = g3 / e2;
            break;
          case i2:
            $2 = g3 / t2;
            break;
          default:
            $2 = g3;
        }
        return l3 ? $2 : b2.a($2);
      }, m3.daysInMonth = function() {
        return this.endOf(c2).$D;
      }, m3.$locale = function() {
        return D2[this.$L];
      }, m3.locale = function(t3, e3) {
        if (!t3)
          return this.$L;
        var n3 = this.clone(), r3 = w2(t3, e3, true);
        return r3 && (n3.$L = r3), n3;
      }, m3.clone = function() {
        return b2.w(this.$d, this);
      }, m3.toDate = function() {
        return new Date(this.valueOf());
      }, m3.toJSON = function() {
        return this.isValid() ? this.toISOString() : null;
      }, m3.toISOString = function() {
        return this.$d.toISOString();
      }, m3.toString = function() {
        return this.$d.toUTCString();
      }, M3;
    }(), k2 = _24.prototype;
    return O2.prototype = k2, [["$ms", r2], ["$s", i2], ["$m", s2], ["$H", u2], ["$W", a2], ["$M", c2], ["$y", h3], ["$D", d2]].forEach(function(t3) {
      k2[t3[1]] = function(e3) {
        return this.$g(e3, t3[0], t3[1]);
      };
    }), O2.extend = function(t3, e3) {
      return t3.$i || (t3(e3, _24, O2), t3.$i = true), O2;
    }, O2.locale = w2, O2.isDayjs = S2, O2.unix = function(t3) {
      return O2(1e3 * t3);
    }, O2.en = D2[g2], O2.Ls = D2, O2.p = {}, O2;
  });
})(dayjs_min);
var dayjs_minExports = dayjs_min.exports;
const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
var initialState$2 = {
  animating: false,
  autoplaying: null,
  currentDirection: 0,
  currentLeft: null,
  currentSlide: 0,
  direction: 1,
  dragging: false,
  edgeDragged: false,
  initialized: false,
  lazyLoadedList: [],
  listHeight: null,
  listWidth: null,
  scrolling: false,
  slideCount: null,
  slideHeight: null,
  slideWidth: null,
  swipeLeft: null,
  swiped: false,
  // used by swipeEvent. differentites between touch and swipe.
  swiping: false,
  touchObject: {
    startX: 0,
    startY: 0,
    curX: 0,
    curY: 0
  },
  trackStyle: {},
  trackWidth: 0,
  targetSlide: 0
};
function throttle$2(delay2, callback2, options) {
  var _ref = options || {}, _ref$noTrailing = _ref.noTrailing, noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing, _ref$noLeading = _ref.noLeading, noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading, _ref$debounceMode = _ref.debounceMode, debounceMode = _ref$debounceMode === void 0 ? void 0 : _ref$debounceMode;
  var timeoutID;
  var cancelled = false;
  var lastExec = 0;
  function clearExistingTimeout() {
    if (timeoutID) {
      clearTimeout(timeoutID);
    }
  }
  function cancel2(options2) {
    var _ref2 = options2 || {}, _ref2$upcomingOnly = _ref2.upcomingOnly, upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
    clearExistingTimeout();
    cancelled = !upcomingOnly;
  }
  function wrapper() {
    for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
      arguments_[_key] = arguments[_key];
    }
    var self2 = this;
    var elapsed = Date.now() - lastExec;
    if (cancelled) {
      return;
    }
    function exec() {
      lastExec = Date.now();
      callback2.apply(self2, arguments_);
    }
    function clear() {
      timeoutID = void 0;
    }
    if (!noLeading && debounceMode && !timeoutID) {
      exec();
    }
    clearExistingTimeout();
    if (debounceMode === void 0 && elapsed > delay2) {
      if (noLeading) {
        lastExec = Date.now();
        if (!noTrailing) {
          timeoutID = setTimeout(debounceMode ? clear : exec, delay2);
        }
      } else {
        exec();
      }
    } else if (noTrailing !== true) {
      timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === void 0 ? delay2 - elapsed : delay2);
    }
  }
  wrapper.cancel = cancel2;
  return wrapper;
}
function debounce$3(delay2, callback2, options) {
  var _ref = {}, _ref$atBegin = _ref.atBegin, atBegin = _ref$atBegin === void 0 ? false : _ref$atBegin;
  return throttle$2(delay2, callback2, {
    debounceMode: atBegin !== false
  });
}
var defaultProps$2 = {
  accessibility: true,
  adaptiveHeight: false,
  afterChange: null,
  appendDots: function appendDots(dots) {
    return /* @__PURE__ */ React$5.createElement("ul", {
      style: {
        display: "block"
      }
    }, dots);
  },
  arrows: true,
  autoplay: false,
  autoplaySpeed: 3e3,
  beforeChange: null,
  centerMode: false,
  centerPadding: "50px",
  className: "",
  cssEase: "ease",
  customPaging: function customPaging(i2) {
    return /* @__PURE__ */ React$5.createElement("button", null, i2 + 1);
  },
  dots: false,
  dotsClass: "slick-dots",
  draggable: true,
  easing: "linear",
  edgeFriction: 0.35,
  fade: false,
  focusOnSelect: false,
  infinite: true,
  initialSlide: 0,
  lazyLoad: null,
  nextArrow: null,
  onEdge: null,
  onInit: null,
  onLazyLoadError: null,
  onReInit: null,
  pauseOnDotsHover: false,
  pauseOnFocus: false,
  pauseOnHover: true,
  prevArrow: null,
  responsive: null,
  rows: 1,
  rtl: false,
  slide: "div",
  slidesPerRow: 1,
  slidesToScroll: 1,
  slidesToShow: 1,
  speed: 500,
  swipe: true,
  swipeEvent: null,
  swipeToSlide: false,
  touchMove: true,
  touchThreshold: 5,
  useCSS: true,
  useTransform: true,
  variableWidth: false,
  vertical: false,
  waitForAnimate: true,
  asNavFor: null
};
function clamp(number4, lowerBound, upperBound) {
  return Math.max(lowerBound, Math.min(number4, upperBound));
}
var safePreventDefault = function safePreventDefault2(event) {
  var passiveEvents = ["onTouchStart", "onTouchMove", "onWheel"];
  if (!passiveEvents.includes(event._reactName)) {
    event.preventDefault();
  }
};
var getOnDemandLazySlides = function getOnDemandLazySlides2(spec) {
  var onDemandSlides = [];
  var startIndex = lazyStartIndex(spec);
  var endIndex = lazyEndIndex(spec);
  for (var slideIndex = startIndex; slideIndex < endIndex; slideIndex++) {
    if (spec.lazyLoadedList.indexOf(slideIndex) < 0) {
      onDemandSlides.push(slideIndex);
    }
  }
  return onDemandSlides;
};
var lazyStartIndex = function lazyStartIndex2(spec) {
  return spec.currentSlide - lazySlidesOnLeft(spec);
};
var lazyEndIndex = function lazyEndIndex2(spec) {
  return spec.currentSlide + lazySlidesOnRight(spec);
};
var lazySlidesOnLeft = function lazySlidesOnLeft2(spec) {
  return spec.centerMode ? Math.floor(spec.slidesToShow / 2) + (parseInt(spec.centerPadding) > 0 ? 1 : 0) : 0;
};
var lazySlidesOnRight = function lazySlidesOnRight2(spec) {
  return spec.centerMode ? Math.floor((spec.slidesToShow - 1) / 2) + 1 + (parseInt(spec.centerPadding) > 0 ? 1 : 0) : spec.slidesToShow;
};
var getWidth = function getWidth2(elem) {
  return elem && elem.offsetWidth || 0;
};
var getHeight2 = function getHeight3(elem) {
  return elem && elem.offsetHeight || 0;
};
var getSwipeDirection = function getSwipeDirection2(touchObject) {
  var verticalSwiping = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
  var xDist, yDist, r2, swipeAngle;
  xDist = touchObject.startX - touchObject.curX;
  yDist = touchObject.startY - touchObject.curY;
  r2 = Math.atan2(yDist, xDist);
  swipeAngle = Math.round(r2 * 180 / Math.PI);
  if (swipeAngle < 0) {
    swipeAngle = 360 - Math.abs(swipeAngle);
  }
  if (swipeAngle <= 45 && swipeAngle >= 0 || swipeAngle <= 360 && swipeAngle >= 315) {
    return "left";
  }
  if (swipeAngle >= 135 && swipeAngle <= 225) {
    return "right";
  }
  if (verticalSwiping === true) {
    if (swipeAngle >= 35 && swipeAngle <= 135) {
      return "up";
    } else {
      return "down";
    }
  }
  return "vertical";
};
var canGoNext = function canGoNext2(spec) {
  var canGo = true;
  if (!spec.infinite) {
    if (spec.centerMode && spec.currentSlide >= spec.slideCount - 1) {
      canGo = false;
    } else if (spec.slideCount <= spec.slidesToShow || spec.currentSlide >= spec.slideCount - spec.slidesToShow) {
      canGo = false;
    }
  }
  return canGo;
};
var extractObject = function extractObject2(spec, keys2) {
  var newObject = {};
  keys2.forEach(function(key) {
    return newObject[key] = spec[key];
  });
  return newObject;
};
var initializedState = function initializedState2(spec) {
  var slideCount = React$5.Children.count(spec.children);
  var listNode = spec.listRef;
  var listWidth = Math.ceil(getWidth(listNode));
  var trackNode = spec.trackRef && spec.trackRef.node;
  var trackWidth = Math.ceil(getWidth(trackNode));
  var slideWidth;
  if (!spec.vertical) {
    var centerPaddingAdj = spec.centerMode && parseInt(spec.centerPadding) * 2;
    if (typeof spec.centerPadding === "string" && spec.centerPadding.slice(-1) === "%") {
      centerPaddingAdj *= listWidth / 100;
    }
    slideWidth = Math.ceil((listWidth - centerPaddingAdj) / spec.slidesToShow);
  } else {
    slideWidth = listWidth;
  }
  var slideHeight = listNode && getHeight2(listNode.querySelector('[data-index="0"]'));
  var listHeight = slideHeight * spec.slidesToShow;
  var currentSlide = spec.currentSlide === void 0 ? spec.initialSlide : spec.currentSlide;
  if (spec.rtl && spec.currentSlide === void 0) {
    currentSlide = slideCount - 1 - spec.initialSlide;
  }
  var lazyLoadedList = spec.lazyLoadedList || [];
  var slidesToLoad = getOnDemandLazySlides(_objectSpread2(_objectSpread2({}, spec), {}, {
    currentSlide,
    lazyLoadedList
  }));
  lazyLoadedList = lazyLoadedList.concat(slidesToLoad);
  var state = {
    slideCount,
    slideWidth,
    listWidth,
    trackWidth,
    currentSlide,
    slideHeight,
    listHeight,
    lazyLoadedList
  };
  if (spec.autoplaying === null && spec.autoplay) {
    state["autoplaying"] = "playing";
  }
  return state;
};
var slideHandler = function slideHandler2(spec) {
  var waitForAnimate = spec.waitForAnimate, animating = spec.animating, fade = spec.fade, infinite = spec.infinite, index2 = spec.index, slideCount = spec.slideCount, lazyLoad = spec.lazyLoad, currentSlide = spec.currentSlide, centerMode = spec.centerMode, slidesToScroll = spec.slidesToScroll, slidesToShow = spec.slidesToShow, useCSS = spec.useCSS;
  var lazyLoadedList = spec.lazyLoadedList;
  if (waitForAnimate && animating)
    return {};
  var animationSlide = index2, finalSlide, animationLeft, finalLeft;
  var state = {}, nextState = {};
  var targetSlide = infinite ? index2 : clamp(index2, 0, slideCount - 1);
  if (fade) {
    if (!infinite && (index2 < 0 || index2 >= slideCount))
      return {};
    if (index2 < 0) {
      animationSlide = index2 + slideCount;
    } else if (index2 >= slideCount) {
      animationSlide = index2 - slideCount;
    }
    if (lazyLoad && lazyLoadedList.indexOf(animationSlide) < 0) {
      lazyLoadedList = lazyLoadedList.concat(animationSlide);
    }
    state = {
      animating: true,
      currentSlide: animationSlide,
      lazyLoadedList,
      targetSlide: animationSlide
    };
    nextState = {
      animating: false,
      targetSlide: animationSlide
    };
  } else {
    finalSlide = animationSlide;
    if (animationSlide < 0) {
      finalSlide = animationSlide + slideCount;
      if (!infinite)
        finalSlide = 0;
      else if (slideCount % slidesToScroll !== 0)
        finalSlide = slideCount - slideCount % slidesToScroll;
    } else if (!canGoNext(spec) && animationSlide > currentSlide) {
      animationSlide = finalSlide = currentSlide;
    } else if (centerMode && animationSlide >= slideCount) {
      animationSlide = infinite ? slideCount : slideCount - 1;
      finalSlide = infinite ? 0 : slideCount - 1;
    } else if (animationSlide >= slideCount) {
      finalSlide = animationSlide - slideCount;
      if (!infinite)
        finalSlide = slideCount - slidesToShow;
      else if (slideCount % slidesToScroll !== 0)
        finalSlide = 0;
    }
    if (!infinite && animationSlide + slidesToShow >= slideCount) {
      finalSlide = slideCount - slidesToShow;
    }
    animationLeft = getTrackLeft(_objectSpread2(_objectSpread2({}, spec), {}, {
      slideIndex: animationSlide
    }));
    finalLeft = getTrackLeft(_objectSpread2(_objectSpread2({}, spec), {}, {
      slideIndex: finalSlide
    }));
    if (!infinite) {
      if (animationLeft === finalLeft)
        animationSlide = finalSlide;
      animationLeft = finalLeft;
    }
    if (lazyLoad) {
      lazyLoadedList = lazyLoadedList.concat(getOnDemandLazySlides(_objectSpread2(_objectSpread2({}, spec), {}, {
        currentSlide: animationSlide
      })));
    }
    if (!useCSS) {
      state = {
        currentSlide: finalSlide,
        trackStyle: getTrackCSS(_objectSpread2(_objectSpread2({}, spec), {}, {
          left: finalLeft
        })),
        lazyLoadedList,
        targetSlide
      };
    } else {
      state = {
        animating: true,
        currentSlide: finalSlide,
        trackStyle: getTrackAnimateCSS(_objectSpread2(_objectSpread2({}, spec), {}, {
          left: animationLeft
        })),
        lazyLoadedList,
        targetSlide
      };
      nextState = {
        animating: false,
        currentSlide: finalSlide,
        trackStyle: getTrackCSS(_objectSpread2(_objectSpread2({}, spec), {}, {
          left: finalLeft
        })),
        swipeLeft: null,
        targetSlide
      };
    }
  }
  return {
    state,
    nextState
  };
};
var changeSlide = function changeSlide2(spec, options) {
  var indexOffset, previousInt, slideOffset, unevenOffset, targetSlide;
  var slidesToScroll = spec.slidesToScroll, slidesToShow = spec.slidesToShow, slideCount = spec.slideCount, currentSlide = spec.currentSlide, previousTargetSlide = spec.targetSlide, lazyLoad = spec.lazyLoad, infinite = spec.infinite;
  unevenOffset = slideCount % slidesToScroll !== 0;
  indexOffset = unevenOffset ? 0 : (slideCount - currentSlide) % slidesToScroll;
  if (options.message === "previous") {
    slideOffset = indexOffset === 0 ? slidesToScroll : slidesToShow - indexOffset;
    targetSlide = currentSlide - slideOffset;
    if (lazyLoad && !infinite) {
      previousInt = currentSlide - slideOffset;
      targetSlide = previousInt === -1 ? slideCount - 1 : previousInt;
    }
    if (!infinite) {
      targetSlide = previousTargetSlide - slidesToScroll;
    }
  } else if (options.message === "next") {
    slideOffset = indexOffset === 0 ? slidesToScroll : indexOffset;
    targetSlide = currentSlide + slideOffset;
    if (lazyLoad && !infinite) {
      targetSlide = (currentSlide + slidesToScroll) % slideCount + indexOffset;
    }
    if (!infinite) {
      targetSlide = previousTargetSlide + slidesToScroll;
    }
  } else if (options.message === "dots") {
    targetSlide = options.index * options.slidesToScroll;
  } else if (options.message === "children") {
    targetSlide = options.index;
    if (infinite) {
      var direction = siblingDirection(_objectSpread2(_objectSpread2({}, spec), {}, {
        targetSlide
      }));
      if (targetSlide > options.currentSlide && direction === "left") {
        targetSlide = targetSlide - slideCount;
      } else if (targetSlide < options.currentSlide && direction === "right") {
        targetSlide = targetSlide + slideCount;
      }
    }
  } else if (options.message === "index") {
    targetSlide = Number(options.index);
  }
  return targetSlide;
};
var keyHandler = function keyHandler2(e2, accessibility, rtl) {
  if (e2.target.tagName.match("TEXTAREA|INPUT|SELECT") || !accessibility)
    return "";
  if (e2.keyCode === 37)
    return rtl ? "next" : "previous";
  if (e2.keyCode === 39)
    return rtl ? "previous" : "next";
  return "";
};
var swipeStart = function swipeStart2(e2, swipe, draggable) {
  e2.target.tagName === "IMG" && safePreventDefault(e2);
  if (!swipe || !draggable && e2.type.indexOf("mouse") !== -1)
    return "";
  return {
    dragging: true,
    touchObject: {
      startX: e2.touches ? e2.touches[0].pageX : e2.clientX,
      startY: e2.touches ? e2.touches[0].pageY : e2.clientY,
      curX: e2.touches ? e2.touches[0].pageX : e2.clientX,
      curY: e2.touches ? e2.touches[0].pageY : e2.clientY
    }
  };
};
var swipeMove = function swipeMove2(e2, spec) {
  var scrolling = spec.scrolling, animating = spec.animating, vertical = spec.vertical, swipeToSlide = spec.swipeToSlide, verticalSwiping = spec.verticalSwiping, rtl = spec.rtl, currentSlide = spec.currentSlide, edgeFriction = spec.edgeFriction, edgeDragged = spec.edgeDragged, onEdge = spec.onEdge, swiped = spec.swiped, swiping = spec.swiping, slideCount = spec.slideCount, slidesToScroll = spec.slidesToScroll, infinite = spec.infinite, touchObject = spec.touchObject, swipeEvent = spec.swipeEvent, listHeight = spec.listHeight, listWidth = spec.listWidth;
  if (scrolling)
    return;
  if (animating)
    return safePreventDefault(e2);
  if (vertical && swipeToSlide && verticalSwiping)
    safePreventDefault(e2);
  var swipeLeft, state = {};
  var curLeft = getTrackLeft(spec);
  touchObject.curX = e2.touches ? e2.touches[0].pageX : e2.clientX;
  touchObject.curY = e2.touches ? e2.touches[0].pageY : e2.clientY;
  touchObject.swipeLength = Math.round(Math.sqrt(Math.pow(touchObject.curX - touchObject.startX, 2)));
  var verticalSwipeLength = Math.round(Math.sqrt(Math.pow(touchObject.curY - touchObject.startY, 2)));
  if (!verticalSwiping && !swiping && verticalSwipeLength > 10) {
    return {
      scrolling: true
    };
  }
  if (verticalSwiping)
    touchObject.swipeLength = verticalSwipeLength;
  var positionOffset = (!rtl ? 1 : -1) * (touchObject.curX > touchObject.startX ? 1 : -1);
  if (verticalSwiping)
    positionOffset = touchObject.curY > touchObject.startY ? 1 : -1;
  var dotCount = Math.ceil(slideCount / slidesToScroll);
  var swipeDirection = getSwipeDirection(spec.touchObject, verticalSwiping);
  var touchSwipeLength = touchObject.swipeLength;
  if (!infinite) {
    if (currentSlide === 0 && (swipeDirection === "right" || swipeDirection === "down") || currentSlide + 1 >= dotCount && (swipeDirection === "left" || swipeDirection === "up") || !canGoNext(spec) && (swipeDirection === "left" || swipeDirection === "up")) {
      touchSwipeLength = touchObject.swipeLength * edgeFriction;
      if (edgeDragged === false && onEdge) {
        onEdge(swipeDirection);
        state["edgeDragged"] = true;
      }
    }
  }
  if (!swiped && swipeEvent) {
    swipeEvent(swipeDirection);
    state["swiped"] = true;
  }
  if (!vertical) {
    if (!rtl) {
      swipeLeft = curLeft + touchSwipeLength * positionOffset;
    } else {
      swipeLeft = curLeft - touchSwipeLength * positionOffset;
    }
  } else {
    swipeLeft = curLeft + touchSwipeLength * (listHeight / listWidth) * positionOffset;
  }
  if (verticalSwiping) {
    swipeLeft = curLeft + touchSwipeLength * positionOffset;
  }
  state = _objectSpread2(_objectSpread2({}, state), {}, {
    touchObject,
    swipeLeft,
    trackStyle: getTrackCSS(_objectSpread2(_objectSpread2({}, spec), {}, {
      left: swipeLeft
    }))
  });
  if (Math.abs(touchObject.curX - touchObject.startX) < Math.abs(touchObject.curY - touchObject.startY) * 0.8) {
    return state;
  }
  if (touchObject.swipeLength > 10) {
    state["swiping"] = true;
    safePreventDefault(e2);
  }
  return state;
};
var swipeEnd = function swipeEnd2(e2, spec) {
  var dragging = spec.dragging, swipe = spec.swipe, touchObject = spec.touchObject, listWidth = spec.listWidth, touchThreshold = spec.touchThreshold, verticalSwiping = spec.verticalSwiping, listHeight = spec.listHeight, swipeToSlide = spec.swipeToSlide, scrolling = spec.scrolling, onSwipe = spec.onSwipe, targetSlide = spec.targetSlide, currentSlide = spec.currentSlide, infinite = spec.infinite;
  if (!dragging) {
    if (swipe)
      safePreventDefault(e2);
    return {};
  }
  var minSwipe = verticalSwiping ? listHeight / touchThreshold : listWidth / touchThreshold;
  var swipeDirection = getSwipeDirection(touchObject, verticalSwiping);
  var state = {
    dragging: false,
    edgeDragged: false,
    scrolling: false,
    swiping: false,
    swiped: false,
    swipeLeft: null,
    touchObject: {}
  };
  if (scrolling) {
    return state;
  }
  if (!touchObject.swipeLength) {
    return state;
  }
  if (touchObject.swipeLength > minSwipe) {
    safePreventDefault(e2);
    if (onSwipe) {
      onSwipe(swipeDirection);
    }
    var slideCount, newSlide;
    var activeSlide = infinite ? currentSlide : targetSlide;
    switch (swipeDirection) {
      case "left":
      case "up":
        newSlide = activeSlide + getSlideCount(spec);
        slideCount = swipeToSlide ? checkNavigable(spec, newSlide) : newSlide;
        state["currentDirection"] = 0;
        break;
      case "right":
      case "down":
        newSlide = activeSlide - getSlideCount(spec);
        slideCount = swipeToSlide ? checkNavigable(spec, newSlide) : newSlide;
        state["currentDirection"] = 1;
        break;
      default:
        slideCount = activeSlide;
    }
    state["triggerSlideHandler"] = slideCount;
  } else {
    var currentLeft = getTrackLeft(spec);
    state["trackStyle"] = getTrackAnimateCSS(_objectSpread2(_objectSpread2({}, spec), {}, {
      left: currentLeft
    }));
  }
  return state;
};
var getNavigableIndexes = function getNavigableIndexes2(spec) {
  var max2 = spec.infinite ? spec.slideCount * 2 : spec.slideCount;
  var breakpoint = spec.infinite ? spec.slidesToShow * -1 : 0;
  var counter = spec.infinite ? spec.slidesToShow * -1 : 0;
  var indexes = [];
  while (breakpoint < max2) {
    indexes.push(breakpoint);
    breakpoint = counter + spec.slidesToScroll;
    counter += Math.min(spec.slidesToScroll, spec.slidesToShow);
  }
  return indexes;
};
var checkNavigable = function checkNavigable2(spec, index2) {
  var navigables = getNavigableIndexes(spec);
  var prevNavigable = 0;
  if (index2 > navigables[navigables.length - 1]) {
    index2 = navigables[navigables.length - 1];
  } else {
    for (var n2 in navigables) {
      if (index2 < navigables[n2]) {
        index2 = prevNavigable;
        break;
      }
      prevNavigable = navigables[n2];
    }
  }
  return index2;
};
var getSlideCount = function getSlideCount2(spec) {
  var centerOffset = spec.centerMode ? spec.slideWidth * Math.floor(spec.slidesToShow / 2) : 0;
  if (spec.swipeToSlide) {
    var swipedSlide;
    var slickList = spec.listRef;
    var slides = slickList.querySelectorAll && slickList.querySelectorAll(".slick-slide") || [];
    Array.from(slides).every(function(slide) {
      if (!spec.vertical) {
        if (slide.offsetLeft - centerOffset + getWidth(slide) / 2 > spec.swipeLeft * -1) {
          swipedSlide = slide;
          return false;
        }
      } else {
        if (slide.offsetTop + getHeight2(slide) / 2 > spec.swipeLeft * -1) {
          swipedSlide = slide;
          return false;
        }
      }
      return true;
    });
    if (!swipedSlide) {
      return 0;
    }
    var currentIndex = spec.rtl === true ? spec.slideCount - spec.currentSlide : spec.currentSlide;
    var slidesTraversed = Math.abs(swipedSlide.dataset.index - currentIndex) || 1;
    return slidesTraversed;
  } else {
    return spec.slidesToScroll;
  }
};
var checkSpecKeys = function checkSpecKeys2(spec, keysArray) {
  return (
    // eslint-disable-next-line no-prototype-builtins
    keysArray.reduce(function(value2, key) {
      return value2 && spec.hasOwnProperty(key);
    }, true) ? null : console.error("Keys Missing:", spec)
  );
};
var getTrackCSS = function getTrackCSS2(spec) {
  checkSpecKeys(spec, ["left", "variableWidth", "slideCount", "slidesToShow", "slideWidth"]);
  var trackWidth, trackHeight;
  if (!spec.vertical) {
    trackWidth = getTotalSlides(spec) * spec.slideWidth;
  } else {
    var trackChildren = spec.unslick ? spec.slideCount : spec.slideCount + 2 * spec.slidesToShow;
    trackHeight = trackChildren * spec.slideHeight;
  }
  var style2 = {
    opacity: 1,
    transition: "",
    WebkitTransition: ""
  };
  if (spec.useTransform) {
    var WebkitTransform = !spec.vertical ? "translate3d(" + spec.left + "px, 0px, 0px)" : "translate3d(0px, " + spec.left + "px, 0px)";
    var transform2 = !spec.vertical ? "translate3d(" + spec.left + "px, 0px, 0px)" : "translate3d(0px, " + spec.left + "px, 0px)";
    var msTransform = !spec.vertical ? "translateX(" + spec.left + "px)" : "translateY(" + spec.left + "px)";
    style2 = _objectSpread2(_objectSpread2({}, style2), {}, {
      WebkitTransform,
      transform: transform2,
      msTransform
    });
  } else {
    if (spec.vertical) {
      style2["top"] = spec.left;
    } else {
      style2["left"] = spec.left;
    }
  }
  if (spec.fade)
    style2 = {
      opacity: 1
    };
  if (trackWidth)
    style2.width = trackWidth;
  if (trackHeight)
    style2.height = trackHeight;
  if (window && !window.addEventListener && window.attachEvent) {
    if (!spec.vertical) {
      style2.marginLeft = spec.left + "px";
    } else {
      style2.marginTop = spec.left + "px";
    }
  }
  return style2;
};
var getTrackAnimateCSS = function getTrackAnimateCSS2(spec) {
  checkSpecKeys(spec, ["left", "variableWidth", "slideCount", "slidesToShow", "slideWidth", "speed", "cssEase"]);
  var style2 = getTrackCSS(spec);
  if (spec.useTransform) {
    style2.WebkitTransition = "-webkit-transform " + spec.speed + "ms " + spec.cssEase;
    style2.transition = "transform " + spec.speed + "ms " + spec.cssEase;
  } else {
    if (spec.vertical) {
      style2.transition = "top " + spec.speed + "ms " + spec.cssEase;
    } else {
      style2.transition = "left " + spec.speed + "ms " + spec.cssEase;
    }
  }
  return style2;
};
var getTrackLeft = function getTrackLeft2(spec) {
  if (spec.unslick) {
    return 0;
  }
  checkSpecKeys(spec, ["slideIndex", "trackRef", "infinite", "centerMode", "slideCount", "slidesToShow", "slidesToScroll", "slideWidth", "listWidth", "variableWidth", "slideHeight"]);
  var slideIndex = spec.slideIndex, trackRef = spec.trackRef, infinite = spec.infinite, centerMode = spec.centerMode, slideCount = spec.slideCount, slidesToShow = spec.slidesToShow, slidesToScroll = spec.slidesToScroll, slideWidth = spec.slideWidth, listWidth = spec.listWidth, variableWidth = spec.variableWidth, slideHeight = spec.slideHeight, fade = spec.fade, vertical = spec.vertical;
  var slideOffset = 0;
  var targetLeft;
  var targetSlide;
  var verticalOffset = 0;
  if (fade || spec.slideCount === 1) {
    return 0;
  }
  var slidesToOffset = 0;
  if (infinite) {
    slidesToOffset = -getPreClones(spec);
    if (slideCount % slidesToScroll !== 0 && slideIndex + slidesToScroll > slideCount) {
      slidesToOffset = -(slideIndex > slideCount ? slidesToShow - (slideIndex - slideCount) : slideCount % slidesToScroll);
    }
    if (centerMode) {
      slidesToOffset += parseInt(slidesToShow / 2);
    }
  } else {
    if (slideCount % slidesToScroll !== 0 && slideIndex + slidesToScroll > slideCount) {
      slidesToOffset = slidesToShow - slideCount % slidesToScroll;
    }
    if (centerMode) {
      slidesToOffset = parseInt(slidesToShow / 2);
    }
  }
  slideOffset = slidesToOffset * slideWidth;
  verticalOffset = slidesToOffset * slideHeight;
  if (!vertical) {
    targetLeft = slideIndex * slideWidth * -1 + slideOffset;
  } else {
    targetLeft = slideIndex * slideHeight * -1 + verticalOffset;
  }
  if (variableWidth === true) {
    var targetSlideIndex;
    var trackElem = trackRef && trackRef.node;
    targetSlideIndex = slideIndex + getPreClones(spec);
    targetSlide = trackElem && trackElem.childNodes[targetSlideIndex];
    targetLeft = targetSlide ? targetSlide.offsetLeft * -1 : 0;
    if (centerMode === true) {
      targetSlideIndex = infinite ? slideIndex + getPreClones(spec) : slideIndex;
      targetSlide = trackElem && trackElem.children[targetSlideIndex];
      targetLeft = 0;
      for (var slide = 0; slide < targetSlideIndex; slide++) {
        targetLeft -= trackElem && trackElem.children[slide] && trackElem.children[slide].offsetWidth;
      }
      targetLeft -= parseInt(spec.centerPadding);
      targetLeft += targetSlide && (listWidth - targetSlide.offsetWidth) / 2;
    }
  }
  return targetLeft;
};
var getPreClones = function getPreClones2(spec) {
  if (spec.unslick || !spec.infinite) {
    return 0;
  }
  if (spec.variableWidth) {
    return spec.slideCount;
  }
  return spec.slidesToShow + (spec.centerMode ? 1 : 0);
};
var getPostClones = function getPostClones2(spec) {
  if (spec.unslick || !spec.infinite) {
    return 0;
  }
  return spec.slideCount;
};
var getTotalSlides = function getTotalSlides2(spec) {
  return spec.slideCount === 1 ? 1 : getPreClones(spec) + spec.slideCount + getPostClones(spec);
};
var siblingDirection = function siblingDirection2(spec) {
  if (spec.targetSlide > spec.currentSlide) {
    if (spec.targetSlide > spec.currentSlide + slidesOnRight(spec)) {
      return "left";
    }
    return "right";
  } else {
    if (spec.targetSlide < spec.currentSlide - slidesOnLeft(spec)) {
      return "right";
    }
    return "left";
  }
};
var slidesOnRight = function slidesOnRight2(_ref) {
  var slidesToShow = _ref.slidesToShow, centerMode = _ref.centerMode, rtl = _ref.rtl, centerPadding = _ref.centerPadding;
  if (centerMode) {
    var right = (slidesToShow - 1) / 2 + 1;
    if (parseInt(centerPadding) > 0)
      right += 1;
    if (rtl && slidesToShow % 2 === 0)
      right += 1;
    return right;
  }
  if (rtl) {
    return 0;
  }
  return slidesToShow - 1;
};
var slidesOnLeft = function slidesOnLeft2(_ref2) {
  var slidesToShow = _ref2.slidesToShow, centerMode = _ref2.centerMode, rtl = _ref2.rtl, centerPadding = _ref2.centerPadding;
  if (centerMode) {
    var left2 = (slidesToShow - 1) / 2 + 1;
    if (parseInt(centerPadding) > 0)
      left2 += 1;
    if (!rtl && slidesToShow % 2 === 0)
      left2 += 1;
    return left2;
  }
  if (rtl) {
    return slidesToShow - 1;
  }
  return 0;
};
var canUseDOM$2 = function canUseDOM() {
  return !!(typeof window !== "undefined" && window.document && window.document.createElement);
};
var validSettings = Object.keys(defaultProps$2);
function filterSettings(settings) {
  return validSettings.reduce(function(acc, settingName) {
    if (settings.hasOwnProperty(settingName)) {
      acc[settingName] = settings[settingName];
    }
    return acc;
  }, {});
}
function _callSuper$j(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$g() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
var getSlideClasses = function getSlideClasses2(spec) {
  var slickActive, slickCenter, slickCloned;
  var centerOffset, index2;
  if (spec.rtl) {
    index2 = spec.slideCount - 1 - spec.index;
  } else {
    index2 = spec.index;
  }
  slickCloned = index2 < 0 || index2 >= spec.slideCount;
  if (spec.centerMode) {
    centerOffset = Math.floor(spec.slidesToShow / 2);
    slickCenter = (index2 - spec.currentSlide) % spec.slideCount === 0;
    if (index2 > spec.currentSlide - centerOffset - 1 && index2 <= spec.currentSlide + centerOffset) {
      slickActive = true;
    }
  } else {
    slickActive = spec.currentSlide <= index2 && index2 < spec.currentSlide + spec.slidesToShow;
  }
  var focusedSlide;
  if (spec.targetSlide < 0) {
    focusedSlide = spec.targetSlide + spec.slideCount;
  } else if (spec.targetSlide >= spec.slideCount) {
    focusedSlide = spec.targetSlide - spec.slideCount;
  } else {
    focusedSlide = spec.targetSlide;
  }
  var slickCurrent = index2 === focusedSlide;
  return {
    "slick-slide": true,
    "slick-active": slickActive,
    "slick-center": slickCenter,
    "slick-cloned": slickCloned,
    "slick-current": slickCurrent
    // dubious in case of RTL
  };
};
var getSlideStyle = function getSlideStyle2(spec) {
  var style2 = {};
  if (spec.variableWidth === void 0 || spec.variableWidth === false) {
    style2.width = spec.slideWidth;
  }
  if (spec.fade) {
    style2.position = "relative";
    if (spec.vertical && spec.slideHeight) {
      style2.top = -spec.index * parseInt(spec.slideHeight);
    } else {
      style2.left = -spec.index * parseInt(spec.slideWidth);
    }
    style2.opacity = spec.currentSlide === spec.index ? 1 : 0;
    style2.zIndex = spec.currentSlide === spec.index ? 999 : 998;
    if (spec.useCSS) {
      style2.transition = "opacity " + spec.speed + "ms " + spec.cssEase + ", visibility " + spec.speed + "ms " + spec.cssEase;
    }
  }
  return style2;
};
var getKey$1 = function getKey(child, fallbackKey) {
  return child.key + "-" + fallbackKey;
};
var renderSlides = function renderSlides2(spec) {
  var key;
  var slides = [];
  var preCloneSlides = [];
  var postCloneSlides = [];
  var childrenCount = React$5.Children.count(spec.children);
  var startIndex = lazyStartIndex(spec);
  var endIndex = lazyEndIndex(spec);
  React$5.Children.forEach(spec.children, function(elem, index2) {
    var child;
    var childOnClickOptions = {
      message: "children",
      index: index2,
      slidesToScroll: spec.slidesToScroll,
      currentSlide: spec.currentSlide
    };
    if (!spec.lazyLoad || spec.lazyLoad && spec.lazyLoadedList.indexOf(index2) >= 0) {
      child = elem;
    } else {
      child = /* @__PURE__ */ React$5.createElement("div", null);
    }
    var childStyle = getSlideStyle(_objectSpread2(_objectSpread2({}, spec), {}, {
      index: index2
    }));
    var slideClass = child.props.className || "";
    var slideClasses = getSlideClasses(_objectSpread2(_objectSpread2({}, spec), {}, {
      index: index2
    }));
    slides.push(/* @__PURE__ */ React$5.cloneElement(child, {
      key: "original" + getKey$1(child, index2),
      "data-index": index2,
      className: classNames(slideClasses, slideClass),
      tabIndex: "-1",
      "aria-hidden": !slideClasses["slick-active"],
      style: _objectSpread2(_objectSpread2({
        outline: "none"
      }, child.props.style || {}), childStyle),
      onClick: function onClick(e2) {
        child.props && child.props.onClick && child.props.onClick(e2);
        if (spec.focusOnSelect) {
          spec.focusOnSelect(childOnClickOptions);
        }
      }
    }));
    if (spec.infinite && childrenCount > 1 && spec.fade === false && !spec.unslick) {
      var preCloneNo = childrenCount - index2;
      if (preCloneNo <= getPreClones(spec)) {
        key = -preCloneNo;
        if (key >= startIndex) {
          child = elem;
        }
        slideClasses = getSlideClasses(_objectSpread2(_objectSpread2({}, spec), {}, {
          index: key
        }));
        preCloneSlides.push(/* @__PURE__ */ React$5.cloneElement(child, {
          key: "precloned" + getKey$1(child, key),
          "data-index": key,
          tabIndex: "-1",
          className: classNames(slideClasses, slideClass),
          "aria-hidden": !slideClasses["slick-active"],
          style: _objectSpread2(_objectSpread2({}, child.props.style || {}), childStyle),
          onClick: function onClick(e2) {
            child.props && child.props.onClick && child.props.onClick(e2);
            if (spec.focusOnSelect) {
              spec.focusOnSelect(childOnClickOptions);
            }
          }
        }));
      }
      key = childrenCount + index2;
      if (key < endIndex) {
        child = elem;
      }
      slideClasses = getSlideClasses(_objectSpread2(_objectSpread2({}, spec), {}, {
        index: key
      }));
      postCloneSlides.push(/* @__PURE__ */ React$5.cloneElement(child, {
        key: "postcloned" + getKey$1(child, key),
        "data-index": key,
        tabIndex: "-1",
        className: classNames(slideClasses, slideClass),
        "aria-hidden": !slideClasses["slick-active"],
        style: _objectSpread2(_objectSpread2({}, child.props.style || {}), childStyle),
        onClick: function onClick(e2) {
          child.props && child.props.onClick && child.props.onClick(e2);
          if (spec.focusOnSelect) {
            spec.focusOnSelect(childOnClickOptions);
          }
        }
      }));
    }
  });
  if (spec.rtl) {
    return preCloneSlides.concat(slides, postCloneSlides).reverse();
  } else {
    return preCloneSlides.concat(slides, postCloneSlides);
  }
};
var Track = /* @__PURE__ */ function(_React$PureComponent) {
  function Track2() {
    var _this;
    _classCallCheck$a(this, Track2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _callSuper$j(this, Track2, [].concat(args));
    _defineProperty$3(_this, "node", null);
    _defineProperty$3(_this, "handleRef", function(ref) {
      _this.node = ref;
    });
    return _this;
  }
  _inherits$a(Track2, _React$PureComponent);
  return _createClass$8(Track2, [{
    key: "render",
    value: function render3() {
      var slides = renderSlides(this.props);
      var _this$props = this.props, onMouseEnter = _this$props.onMouseEnter, onMouseOver = _this$props.onMouseOver, onMouseLeave = _this$props.onMouseLeave;
      var mouseEvents = {
        onMouseEnter,
        onMouseOver,
        onMouseLeave
      };
      return /* @__PURE__ */ React$5.createElement("div", _extends$h({
        ref: this.handleRef,
        className: "slick-track",
        style: this.props.trackStyle
      }, mouseEvents), slides);
    }
  }]);
}(React$5.PureComponent);
function _callSuper$i(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$g() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
var getDotCount = function getDotCount2(spec) {
  var dots;
  if (spec.infinite) {
    dots = Math.ceil(spec.slideCount / spec.slidesToScroll);
  } else {
    dots = Math.ceil((spec.slideCount - spec.slidesToShow) / spec.slidesToScroll) + 1;
  }
  return dots;
};
var Dots = /* @__PURE__ */ function(_React$PureComponent) {
  function Dots2() {
    _classCallCheck$a(this, Dots2);
    return _callSuper$i(this, Dots2, arguments);
  }
  _inherits$a(Dots2, _React$PureComponent);
  return _createClass$8(Dots2, [{
    key: "clickHandler",
    value: function clickHandler(options, e2) {
      e2.preventDefault();
      this.props.clickHandler(options);
    }
  }, {
    key: "render",
    value: function render3() {
      var _this$props = this.props, onMouseEnter = _this$props.onMouseEnter, onMouseOver = _this$props.onMouseOver, onMouseLeave = _this$props.onMouseLeave, infinite = _this$props.infinite, slidesToScroll = _this$props.slidesToScroll, slidesToShow = _this$props.slidesToShow, slideCount = _this$props.slideCount, currentSlide = _this$props.currentSlide;
      var dotCount = getDotCount({
        slideCount,
        slidesToScroll,
        slidesToShow,
        infinite
      });
      var mouseEvents = {
        onMouseEnter,
        onMouseOver,
        onMouseLeave
      };
      var dots = [];
      for (var i2 = 0; i2 < dotCount; i2++) {
        var _rightBound = (i2 + 1) * slidesToScroll - 1;
        var rightBound = infinite ? _rightBound : clamp(_rightBound, 0, slideCount - 1);
        var _leftBound = rightBound - (slidesToScroll - 1);
        var leftBound = infinite ? _leftBound : clamp(_leftBound, 0, slideCount - 1);
        var className = classNames({
          "slick-active": infinite ? currentSlide >= leftBound && currentSlide <= rightBound : currentSlide === leftBound
        });
        var dotOptions = {
          message: "dots",
          index: i2,
          slidesToScroll,
          currentSlide
        };
        var onClick = this.clickHandler.bind(this, dotOptions);
        dots = dots.concat(/* @__PURE__ */ React$5.createElement("li", {
          key: i2,
          className
        }, /* @__PURE__ */ React$5.cloneElement(this.props.customPaging(i2), {
          onClick
        })));
      }
      return /* @__PURE__ */ React$5.cloneElement(this.props.appendDots(dots), _objectSpread2({
        className: this.props.dotsClass
      }, mouseEvents));
    }
  }]);
}(React$5.PureComponent);
function _callSuper$h(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$g() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
var PrevArrow = /* @__PURE__ */ function(_React$PureComponent) {
  function PrevArrow2() {
    _classCallCheck$a(this, PrevArrow2);
    return _callSuper$h(this, PrevArrow2, arguments);
  }
  _inherits$a(PrevArrow2, _React$PureComponent);
  return _createClass$8(PrevArrow2, [{
    key: "clickHandler",
    value: function clickHandler(options, e2) {
      if (e2) {
        e2.preventDefault();
      }
      this.props.clickHandler(options, e2);
    }
  }, {
    key: "render",
    value: function render3() {
      var prevClasses = {
        "slick-arrow": true,
        "slick-prev": true
      };
      var prevHandler = this.clickHandler.bind(this, {
        message: "previous"
      });
      if (!this.props.infinite && (this.props.currentSlide === 0 || this.props.slideCount <= this.props.slidesToShow)) {
        prevClasses["slick-disabled"] = true;
        prevHandler = null;
      }
      var prevArrowProps = {
        key: "0",
        "data-role": "none",
        className: classNames(prevClasses),
        style: {
          display: "block"
        },
        onClick: prevHandler
      };
      var customProps = {
        currentSlide: this.props.currentSlide,
        slideCount: this.props.slideCount
      };
      var prevArrow;
      if (this.props.prevArrow) {
        prevArrow = /* @__PURE__ */ React$5.cloneElement(this.props.prevArrow, _objectSpread2(_objectSpread2({}, prevArrowProps), customProps));
      } else {
        prevArrow = /* @__PURE__ */ React$5.createElement("button", _extends$h({
          key: "0",
          type: "button"
        }, prevArrowProps), " ", "Previous");
      }
      return prevArrow;
    }
  }]);
}(React$5.PureComponent);
var NextArrow = /* @__PURE__ */ function(_React$PureComponent2) {
  function NextArrow2() {
    _classCallCheck$a(this, NextArrow2);
    return _callSuper$h(this, NextArrow2, arguments);
  }
  _inherits$a(NextArrow2, _React$PureComponent2);
  return _createClass$8(NextArrow2, [{
    key: "clickHandler",
    value: function clickHandler(options, e2) {
      if (e2) {
        e2.preventDefault();
      }
      this.props.clickHandler(options, e2);
    }
  }, {
    key: "render",
    value: function render3() {
      var nextClasses = {
        "slick-arrow": true,
        "slick-next": true
      };
      var nextHandler = this.clickHandler.bind(this, {
        message: "next"
      });
      if (!canGoNext(this.props)) {
        nextClasses["slick-disabled"] = true;
        nextHandler = null;
      }
      var nextArrowProps = {
        key: "1",
        "data-role": "none",
        className: classNames(nextClasses),
        style: {
          display: "block"
        },
        onClick: nextHandler
      };
      var customProps = {
        currentSlide: this.props.currentSlide,
        slideCount: this.props.slideCount
      };
      var nextArrow;
      if (this.props.nextArrow) {
        nextArrow = /* @__PURE__ */ React$5.cloneElement(this.props.nextArrow, _objectSpread2(_objectSpread2({}, nextArrowProps), customProps));
      } else {
        nextArrow = /* @__PURE__ */ React$5.createElement("button", _extends$h({
          key: "1",
          type: "button"
        }, nextArrowProps), " ", "Next");
      }
      return nextArrow;
    }
  }]);
}(React$5.PureComponent);
var _excluded$d = ["animating"];
function _callSuper$g(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$g() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
var InnerSlider = /* @__PURE__ */ function(_React$Component) {
  function InnerSlider2(props) {
    var _this;
    _classCallCheck$a(this, InnerSlider2);
    _this = _callSuper$g(this, InnerSlider2, [props]);
    _defineProperty$3(_this, "listRefHandler", function(ref) {
      return _this.list = ref;
    });
    _defineProperty$3(_this, "trackRefHandler", function(ref) {
      return _this.track = ref;
    });
    _defineProperty$3(_this, "adaptHeight", function() {
      if (_this.props.adaptiveHeight && _this.list) {
        var elem = _this.list.querySelector('[data-index="'.concat(_this.state.currentSlide, '"]'));
        _this.list.style.height = getHeight2(elem) + "px";
      }
    });
    _defineProperty$3(_this, "componentDidMount", function() {
      _this.props.onInit && _this.props.onInit();
      if (_this.props.lazyLoad) {
        var slidesToLoad = getOnDemandLazySlides(_objectSpread2(_objectSpread2({}, _this.props), _this.state));
        if (slidesToLoad.length > 0) {
          _this.setState(function(prevState) {
            return {
              lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad)
            };
          });
          if (_this.props.onLazyLoad) {
            _this.props.onLazyLoad(slidesToLoad);
          }
        }
      }
      var spec = _objectSpread2({
        listRef: _this.list,
        trackRef: _this.track
      }, _this.props);
      _this.updateState(spec, true, function() {
        _this.adaptHeight();
        _this.props.autoplay && _this.autoPlay("playing");
      });
      if (_this.props.lazyLoad === "progressive") {
        _this.lazyLoadTimer = setInterval(_this.progressiveLazyLoad, 1e3);
      }
      _this.ro = new index$1(function() {
        if (_this.state.animating) {
          _this.onWindowResized(false);
          _this.callbackTimers.push(setTimeout(function() {
            return _this.onWindowResized();
          }, _this.props.speed));
        } else {
          _this.onWindowResized();
        }
      });
      _this.ro.observe(_this.list);
      document.querySelectorAll && Array.prototype.forEach.call(document.querySelectorAll(".slick-slide"), function(slide) {
        slide.onfocus = _this.props.pauseOnFocus ? _this.onSlideFocus : null;
        slide.onblur = _this.props.pauseOnFocus ? _this.onSlideBlur : null;
      });
      if (window.addEventListener) {
        window.addEventListener("resize", _this.onWindowResized);
      } else {
        window.attachEvent("onresize", _this.onWindowResized);
      }
    });
    _defineProperty$3(_this, "componentWillUnmount", function() {
      if (_this.animationEndCallback) {
        clearTimeout(_this.animationEndCallback);
      }
      if (_this.lazyLoadTimer) {
        clearInterval(_this.lazyLoadTimer);
      }
      if (_this.callbackTimers.length) {
        _this.callbackTimers.forEach(function(timer) {
          return clearTimeout(timer);
        });
        _this.callbackTimers = [];
      }
      if (window.addEventListener) {
        window.removeEventListener("resize", _this.onWindowResized);
      } else {
        window.detachEvent("onresize", _this.onWindowResized);
      }
      if (_this.autoplayTimer) {
        clearInterval(_this.autoplayTimer);
      }
      _this.ro.disconnect();
    });
    _defineProperty$3(_this, "componentDidUpdate", function(prevProps) {
      _this.checkImagesLoad();
      _this.props.onReInit && _this.props.onReInit();
      if (_this.props.lazyLoad) {
        var slidesToLoad = getOnDemandLazySlides(_objectSpread2(_objectSpread2({}, _this.props), _this.state));
        if (slidesToLoad.length > 0) {
          _this.setState(function(prevState) {
            return {
              lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad)
            };
          });
          if (_this.props.onLazyLoad) {
            _this.props.onLazyLoad(slidesToLoad);
          }
        }
      }
      _this.adaptHeight();
      var spec = _objectSpread2(_objectSpread2({
        listRef: _this.list,
        trackRef: _this.track
      }, _this.props), _this.state);
      var setTrackStyle = _this.didPropsChange(prevProps);
      setTrackStyle && _this.updateState(spec, setTrackStyle, function() {
        if (_this.state.currentSlide >= React$5.Children.count(_this.props.children)) {
          _this.changeSlide({
            message: "index",
            index: React$5.Children.count(_this.props.children) - _this.props.slidesToShow,
            currentSlide: _this.state.currentSlide
          });
        }
        if (prevProps.autoplay !== _this.props.autoplay || prevProps.autoplaySpeed !== _this.props.autoplaySpeed) {
          if (!prevProps.autoplay && _this.props.autoplay) {
            _this.autoPlay("playing");
          } else if (_this.props.autoplay) {
            _this.autoPlay("update");
          } else {
            _this.pause("paused");
          }
        }
      });
    });
    _defineProperty$3(_this, "onWindowResized", function(setTrackStyle) {
      if (_this.debouncedResize)
        _this.debouncedResize.cancel();
      _this.debouncedResize = debounce$3(50, function() {
        return _this.resizeWindow(setTrackStyle);
      });
      _this.debouncedResize();
    });
    _defineProperty$3(_this, "resizeWindow", function() {
      var setTrackStyle = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
      var isTrackMounted = Boolean(_this.track && _this.track.node);
      if (!isTrackMounted)
        return;
      var spec = _objectSpread2(_objectSpread2({
        listRef: _this.list,
        trackRef: _this.track
      }, _this.props), _this.state);
      _this.updateState(spec, setTrackStyle, function() {
        if (_this.props.autoplay)
          _this.autoPlay("update");
        else
          _this.pause("paused");
      });
      _this.setState({
        animating: false
      });
      clearTimeout(_this.animationEndCallback);
      delete _this.animationEndCallback;
    });
    _defineProperty$3(_this, "updateState", function(spec, setTrackStyle, callback2) {
      var updatedState = initializedState(spec);
      spec = _objectSpread2(_objectSpread2(_objectSpread2({}, spec), updatedState), {}, {
        slideIndex: updatedState.currentSlide
      });
      var targetLeft = getTrackLeft(spec);
      spec = _objectSpread2(_objectSpread2({}, spec), {}, {
        left: targetLeft
      });
      var trackStyle = getTrackCSS(spec);
      if (setTrackStyle || React$5.Children.count(_this.props.children) !== React$5.Children.count(spec.children)) {
        updatedState["trackStyle"] = trackStyle;
      }
      _this.setState(updatedState, callback2);
    });
    _defineProperty$3(_this, "ssrInit", function() {
      if (_this.props.variableWidth) {
        var _trackWidth = 0, _trackLeft = 0;
        var childrenWidths = [];
        var preClones = getPreClones(_objectSpread2(_objectSpread2(_objectSpread2({}, _this.props), _this.state), {}, {
          slideCount: _this.props.children.length
        }));
        var postClones = getPostClones(_objectSpread2(_objectSpread2(_objectSpread2({}, _this.props), _this.state), {}, {
          slideCount: _this.props.children.length
        }));
        _this.props.children.forEach(function(child) {
          childrenWidths.push(child.props.style.width);
          _trackWidth += child.props.style.width;
        });
        for (var i2 = 0; i2 < preClones; i2++) {
          _trackLeft += childrenWidths[childrenWidths.length - 1 - i2];
          _trackWidth += childrenWidths[childrenWidths.length - 1 - i2];
        }
        for (var _i = 0; _i < postClones; _i++) {
          _trackWidth += childrenWidths[_i];
        }
        for (var _i2 = 0; _i2 < _this.state.currentSlide; _i2++) {
          _trackLeft += childrenWidths[_i2];
        }
        var _trackStyle = {
          width: _trackWidth + "px",
          left: -_trackLeft + "px"
        };
        if (_this.props.centerMode) {
          var currentWidth = "".concat(childrenWidths[_this.state.currentSlide], "px");
          _trackStyle.left = "calc(".concat(_trackStyle.left, " + (100% - ").concat(currentWidth, ") / 2 ) ");
        }
        return {
          trackStyle: _trackStyle
        };
      }
      var childrenCount = React$5.Children.count(_this.props.children);
      var spec = _objectSpread2(_objectSpread2(_objectSpread2({}, _this.props), _this.state), {}, {
        slideCount: childrenCount
      });
      var slideCount = getPreClones(spec) + getPostClones(spec) + childrenCount;
      var trackWidth = 100 / _this.props.slidesToShow * slideCount;
      var slideWidth = 100 / slideCount;
      var trackLeft = -slideWidth * (getPreClones(spec) + _this.state.currentSlide) * trackWidth / 100;
      if (_this.props.centerMode) {
        trackLeft += (100 - slideWidth * trackWidth / 100) / 2;
      }
      var trackStyle = {
        width: trackWidth + "%",
        left: trackLeft + "%"
      };
      return {
        slideWidth: slideWidth + "%",
        trackStyle
      };
    });
    _defineProperty$3(_this, "checkImagesLoad", function() {
      var images = _this.list && _this.list.querySelectorAll && _this.list.querySelectorAll(".slick-slide img") || [];
      var imagesCount = images.length, loadedCount = 0;
      Array.prototype.forEach.call(images, function(image2) {
        var handler = function handler2() {
          return ++loadedCount && loadedCount >= imagesCount && _this.onWindowResized();
        };
        if (!image2.onclick) {
          image2.onclick = function() {
            return image2.parentNode.focus();
          };
        } else {
          var prevClickHandler = image2.onclick;
          image2.onclick = function(e2) {
            prevClickHandler(e2);
            image2.parentNode.focus();
          };
        }
        if (!image2.onload) {
          if (_this.props.lazyLoad) {
            image2.onload = function() {
              _this.adaptHeight();
              _this.callbackTimers.push(setTimeout(_this.onWindowResized, _this.props.speed));
            };
          } else {
            image2.onload = handler;
            image2.onerror = function() {
              handler();
              _this.props.onLazyLoadError && _this.props.onLazyLoadError();
            };
          }
        }
      });
    });
    _defineProperty$3(_this, "progressiveLazyLoad", function() {
      var slidesToLoad = [];
      var spec = _objectSpread2(_objectSpread2({}, _this.props), _this.state);
      for (var index2 = _this.state.currentSlide; index2 < _this.state.slideCount + getPostClones(spec); index2++) {
        if (_this.state.lazyLoadedList.indexOf(index2) < 0) {
          slidesToLoad.push(index2);
          break;
        }
      }
      for (var _index = _this.state.currentSlide - 1; _index >= -getPreClones(spec); _index--) {
        if (_this.state.lazyLoadedList.indexOf(_index) < 0) {
          slidesToLoad.push(_index);
          break;
        }
      }
      if (slidesToLoad.length > 0) {
        _this.setState(function(state) {
          return {
            lazyLoadedList: state.lazyLoadedList.concat(slidesToLoad)
          };
        });
        if (_this.props.onLazyLoad) {
          _this.props.onLazyLoad(slidesToLoad);
        }
      } else {
        if (_this.lazyLoadTimer) {
          clearInterval(_this.lazyLoadTimer);
          delete _this.lazyLoadTimer;
        }
      }
    });
    _defineProperty$3(_this, "slideHandler", function(index2) {
      var dontAnimate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
      var _this$props = _this.props, asNavFor = _this$props.asNavFor, beforeChange = _this$props.beforeChange, onLazyLoad = _this$props.onLazyLoad, speed = _this$props.speed, afterChange = _this$props.afterChange;
      var currentSlide = _this.state.currentSlide;
      var _slideHandler = slideHandler(_objectSpread2(_objectSpread2(_objectSpread2({
        index: index2
      }, _this.props), _this.state), {}, {
        trackRef: _this.track,
        useCSS: _this.props.useCSS && !dontAnimate
      })), state = _slideHandler.state, nextState = _slideHandler.nextState;
      if (!state)
        return;
      beforeChange && beforeChange(currentSlide, state.currentSlide);
      var slidesToLoad = state.lazyLoadedList.filter(function(value2) {
        return _this.state.lazyLoadedList.indexOf(value2) < 0;
      });
      onLazyLoad && slidesToLoad.length > 0 && onLazyLoad(slidesToLoad);
      if (!_this.props.waitForAnimate && _this.animationEndCallback) {
        clearTimeout(_this.animationEndCallback);
        afterChange && afterChange(currentSlide);
        delete _this.animationEndCallback;
      }
      _this.setState(state, function() {
        if (asNavFor && _this.asNavForIndex !== index2) {
          _this.asNavForIndex = index2;
          asNavFor.innerSlider.slideHandler(index2);
        }
        if (!nextState)
          return;
        _this.animationEndCallback = setTimeout(function() {
          var animating = nextState.animating, firstBatch = _objectWithoutProperties$3(nextState, _excluded$d);
          _this.setState(firstBatch, function() {
            _this.callbackTimers.push(setTimeout(function() {
              return _this.setState({
                animating
              });
            }, 10));
            afterChange && afterChange(state.currentSlide);
            delete _this.animationEndCallback;
          });
        }, speed);
      });
    });
    _defineProperty$3(_this, "changeSlide", function(options) {
      var dontAnimate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
      var spec = _objectSpread2(_objectSpread2({}, _this.props), _this.state);
      var targetSlide = changeSlide(spec, options);
      if (targetSlide !== 0 && !targetSlide)
        return;
      if (dontAnimate === true) {
        _this.slideHandler(targetSlide, dontAnimate);
      } else {
        _this.slideHandler(targetSlide);
      }
      _this.props.autoplay && _this.autoPlay("update");
      if (_this.props.focusOnSelect) {
        var nodes = _this.list.querySelectorAll(".slick-current");
        nodes[0] && nodes[0].focus();
      }
    });
    _defineProperty$3(_this, "clickHandler", function(e2) {
      if (_this.clickable === false) {
        e2.stopPropagation();
        e2.preventDefault();
      }
      _this.clickable = true;
    });
    _defineProperty$3(_this, "keyHandler", function(e2) {
      var dir = keyHandler(e2, _this.props.accessibility, _this.props.rtl);
      dir !== "" && _this.changeSlide({
        message: dir
      });
    });
    _defineProperty$3(_this, "selectHandler", function(options) {
      _this.changeSlide(options);
    });
    _defineProperty$3(_this, "disableBodyScroll", function() {
      var preventDefault2 = function preventDefault3(e2) {
        e2 = e2 || window.event;
        if (e2.preventDefault)
          e2.preventDefault();
        e2.returnValue = false;
      };
      window.ontouchmove = preventDefault2;
    });
    _defineProperty$3(_this, "enableBodyScroll", function() {
      window.ontouchmove = null;
    });
    _defineProperty$3(_this, "swipeStart", function(e2) {
      if (_this.props.verticalSwiping) {
        _this.disableBodyScroll();
      }
      var state = swipeStart(e2, _this.props.swipe, _this.props.draggable);
      state !== "" && _this.setState(state);
    });
    _defineProperty$3(_this, "swipeMove", function(e2) {
      var state = swipeMove(e2, _objectSpread2(_objectSpread2(_objectSpread2({}, _this.props), _this.state), {}, {
        trackRef: _this.track,
        listRef: _this.list,
        slideIndex: _this.state.currentSlide
      }));
      if (!state)
        return;
      if (state["swiping"]) {
        _this.clickable = false;
      }
      _this.setState(state);
    });
    _defineProperty$3(_this, "swipeEnd", function(e2) {
      var state = swipeEnd(e2, _objectSpread2(_objectSpread2(_objectSpread2({}, _this.props), _this.state), {}, {
        trackRef: _this.track,
        listRef: _this.list,
        slideIndex: _this.state.currentSlide
      }));
      if (!state)
        return;
      var triggerSlideHandler = state["triggerSlideHandler"];
      delete state["triggerSlideHandler"];
      _this.setState(state);
      if (triggerSlideHandler === void 0)
        return;
      _this.slideHandler(triggerSlideHandler);
      if (_this.props.verticalSwiping) {
        _this.enableBodyScroll();
      }
    });
    _defineProperty$3(_this, "touchEnd", function(e2) {
      _this.swipeEnd(e2);
      _this.clickable = true;
    });
    _defineProperty$3(_this, "slickPrev", function() {
      _this.callbackTimers.push(setTimeout(function() {
        return _this.changeSlide({
          message: "previous"
        });
      }, 0));
    });
    _defineProperty$3(_this, "slickNext", function() {
      _this.callbackTimers.push(setTimeout(function() {
        return _this.changeSlide({
          message: "next"
        });
      }, 0));
    });
    _defineProperty$3(_this, "slickGoTo", function(slide) {
      var dontAnimate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
      slide = Number(slide);
      if (isNaN(slide))
        return "";
      _this.callbackTimers.push(setTimeout(function() {
        return _this.changeSlide({
          message: "index",
          index: slide,
          currentSlide: _this.state.currentSlide
        }, dontAnimate);
      }, 0));
    });
    _defineProperty$3(_this, "play", function() {
      var nextIndex;
      if (_this.props.rtl) {
        nextIndex = _this.state.currentSlide - _this.props.slidesToScroll;
      } else {
        if (canGoNext(_objectSpread2(_objectSpread2({}, _this.props), _this.state))) {
          nextIndex = _this.state.currentSlide + _this.props.slidesToScroll;
        } else {
          return false;
        }
      }
      _this.slideHandler(nextIndex);
    });
    _defineProperty$3(_this, "autoPlay", function(playType) {
      if (_this.autoplayTimer) {
        clearInterval(_this.autoplayTimer);
      }
      var autoplaying = _this.state.autoplaying;
      if (playType === "update") {
        if (autoplaying === "hovered" || autoplaying === "focused" || autoplaying === "paused") {
          return;
        }
      } else if (playType === "leave") {
        if (autoplaying === "paused" || autoplaying === "focused") {
          return;
        }
      } else if (playType === "blur") {
        if (autoplaying === "paused" || autoplaying === "hovered") {
          return;
        }
      }
      _this.autoplayTimer = setInterval(_this.play, _this.props.autoplaySpeed + 50);
      _this.setState({
        autoplaying: "playing"
      });
    });
    _defineProperty$3(_this, "pause", function(pauseType) {
      if (_this.autoplayTimer) {
        clearInterval(_this.autoplayTimer);
        _this.autoplayTimer = null;
      }
      var autoplaying = _this.state.autoplaying;
      if (pauseType === "paused") {
        _this.setState({
          autoplaying: "paused"
        });
      } else if (pauseType === "focused") {
        if (autoplaying === "hovered" || autoplaying === "playing") {
          _this.setState({
            autoplaying: "focused"
          });
        }
      } else {
        if (autoplaying === "playing") {
          _this.setState({
            autoplaying: "hovered"
          });
        }
      }
    });
    _defineProperty$3(_this, "onDotsOver", function() {
      return _this.props.autoplay && _this.pause("hovered");
    });
    _defineProperty$3(_this, "onDotsLeave", function() {
      return _this.props.autoplay && _this.state.autoplaying === "hovered" && _this.autoPlay("leave");
    });
    _defineProperty$3(_this, "onTrackOver", function() {
      return _this.props.autoplay && _this.pause("hovered");
    });
    _defineProperty$3(_this, "onTrackLeave", function() {
      return _this.props.autoplay && _this.state.autoplaying === "hovered" && _this.autoPlay("leave");
    });
    _defineProperty$3(_this, "onSlideFocus", function() {
      return _this.props.autoplay && _this.pause("focused");
    });
    _defineProperty$3(_this, "onSlideBlur", function() {
      return _this.props.autoplay && _this.state.autoplaying === "focused" && _this.autoPlay("blur");
    });
    _defineProperty$3(_this, "render", function() {
      var className = classNames("slick-slider", _this.props.className, {
        "slick-vertical": _this.props.vertical,
        "slick-initialized": true
      });
      var spec = _objectSpread2(_objectSpread2({}, _this.props), _this.state);
      var trackProps = extractObject(spec, ["fade", "cssEase", "speed", "infinite", "centerMode", "focusOnSelect", "currentSlide", "lazyLoad", "lazyLoadedList", "rtl", "slideWidth", "slideHeight", "listHeight", "vertical", "slidesToShow", "slidesToScroll", "slideCount", "trackStyle", "variableWidth", "unslick", "centerPadding", "targetSlide", "useCSS"]);
      var pauseOnHover = _this.props.pauseOnHover;
      trackProps = _objectSpread2(_objectSpread2({}, trackProps), {}, {
        onMouseEnter: pauseOnHover ? _this.onTrackOver : null,
        onMouseLeave: pauseOnHover ? _this.onTrackLeave : null,
        onMouseOver: pauseOnHover ? _this.onTrackOver : null,
        focusOnSelect: _this.props.focusOnSelect && _this.clickable ? _this.selectHandler : null
      });
      var dots;
      if (_this.props.dots === true && _this.state.slideCount >= _this.props.slidesToShow) {
        var dotProps = extractObject(spec, ["dotsClass", "slideCount", "slidesToShow", "currentSlide", "slidesToScroll", "clickHandler", "children", "customPaging", "infinite", "appendDots"]);
        var pauseOnDotsHover = _this.props.pauseOnDotsHover;
        dotProps = _objectSpread2(_objectSpread2({}, dotProps), {}, {
          clickHandler: _this.changeSlide,
          onMouseEnter: pauseOnDotsHover ? _this.onDotsLeave : null,
          onMouseOver: pauseOnDotsHover ? _this.onDotsOver : null,
          onMouseLeave: pauseOnDotsHover ? _this.onDotsLeave : null
        });
        dots = /* @__PURE__ */ React$5.createElement(Dots, dotProps);
      }
      var prevArrow, nextArrow;
      var arrowProps = extractObject(spec, ["infinite", "centerMode", "currentSlide", "slideCount", "slidesToShow", "prevArrow", "nextArrow"]);
      arrowProps.clickHandler = _this.changeSlide;
      if (_this.props.arrows) {
        prevArrow = /* @__PURE__ */ React$5.createElement(PrevArrow, arrowProps);
        nextArrow = /* @__PURE__ */ React$5.createElement(NextArrow, arrowProps);
      }
      var verticalHeightStyle = null;
      if (_this.props.vertical) {
        verticalHeightStyle = {
          height: _this.state.listHeight
        };
      }
      var centerPaddingStyle = null;
      if (_this.props.vertical === false) {
        if (_this.props.centerMode === true) {
          centerPaddingStyle = {
            padding: "0px " + _this.props.centerPadding
          };
        }
      } else {
        if (_this.props.centerMode === true) {
          centerPaddingStyle = {
            padding: _this.props.centerPadding + " 0px"
          };
        }
      }
      var listStyle = _objectSpread2(_objectSpread2({}, verticalHeightStyle), centerPaddingStyle);
      var touchMove = _this.props.touchMove;
      var listProps = {
        className: "slick-list",
        style: listStyle,
        onClick: _this.clickHandler,
        onMouseDown: touchMove ? _this.swipeStart : null,
        onMouseMove: _this.state.dragging && touchMove ? _this.swipeMove : null,
        onMouseUp: touchMove ? _this.swipeEnd : null,
        onMouseLeave: _this.state.dragging && touchMove ? _this.swipeEnd : null,
        onTouchStart: touchMove ? _this.swipeStart : null,
        onTouchMove: _this.state.dragging && touchMove ? _this.swipeMove : null,
        onTouchEnd: touchMove ? _this.touchEnd : null,
        onTouchCancel: _this.state.dragging && touchMove ? _this.swipeEnd : null,
        onKeyDown: _this.props.accessibility ? _this.keyHandler : null
      };
      var innerSliderProps = {
        className,
        dir: "ltr",
        style: _this.props.style
      };
      if (_this.props.unslick) {
        listProps = {
          className: "slick-list"
        };
        innerSliderProps = {
          className,
          style: _this.props.style
        };
      }
      return /* @__PURE__ */ React$5.createElement("div", innerSliderProps, !_this.props.unslick ? prevArrow : "", /* @__PURE__ */ React$5.createElement("div", _extends$h({
        ref: _this.listRefHandler
      }, listProps), /* @__PURE__ */ React$5.createElement(Track, _extends$h({
        ref: _this.trackRefHandler
      }, trackProps), _this.props.children)), !_this.props.unslick ? nextArrow : "", !_this.props.unslick ? dots : "");
    });
    _this.list = null;
    _this.track = null;
    _this.state = _objectSpread2(_objectSpread2({}, initialState$2), {}, {
      currentSlide: _this.props.initialSlide,
      targetSlide: _this.props.initialSlide ? _this.props.initialSlide : 0,
      slideCount: React$5.Children.count(_this.props.children)
    });
    _this.callbackTimers = [];
    _this.clickable = true;
    _this.debouncedResize = null;
    var ssrState = _this.ssrInit();
    _this.state = _objectSpread2(_objectSpread2({}, _this.state), ssrState);
    return _this;
  }
  _inherits$a(InnerSlider2, _React$Component);
  return _createClass$8(InnerSlider2, [{
    key: "didPropsChange",
    value: function didPropsChange(prevProps) {
      var setTrackStyle = false;
      for (var _i3 = 0, _Object$keys = Object.keys(this.props); _i3 < _Object$keys.length; _i3++) {
        var key = _Object$keys[_i3];
        if (!prevProps.hasOwnProperty(key)) {
          setTrackStyle = true;
          break;
        }
        if (_typeof$1(prevProps[key]) === "object" || typeof prevProps[key] === "function" || isNaN(prevProps[key])) {
          continue;
        }
        if (prevProps[key] !== this.props[key]) {
          setTrackStyle = true;
          break;
        }
      }
      return setTrackStyle || React$5.Children.count(this.props.children) !== React$5.Children.count(prevProps.children);
    }
  }]);
}(React$5.Component);
var camel2hyphen$1 = function(str) {
  return str.replace(/[A-Z]/g, function(match5) {
    return "-" + match5.toLowerCase();
  }).toLowerCase();
};
var camel2hyphen_1 = camel2hyphen$1;
var camel2hyphen = camel2hyphen_1;
var isDimension = function(feature) {
  var re2 = /[height|width]$/;
  return re2.test(feature);
};
var obj2mq = function(obj) {
  var mq = "";
  var features = Object.keys(obj);
  features.forEach(function(feature, index2) {
    var value2 = obj[feature];
    feature = camel2hyphen(feature);
    if (isDimension(feature) && typeof value2 === "number") {
      value2 = value2 + "px";
    }
    if (value2 === true) {
      mq += feature;
    } else if (value2 === false) {
      mq += "not " + feature;
    } else {
      mq += "(" + feature + ": " + value2 + ")";
    }
    if (index2 < features.length - 1) {
      mq += " and ";
    }
  });
  return mq;
};
var json2mq = function(query) {
  var mq = "";
  if (typeof query === "string") {
    return query;
  }
  if (query instanceof Array) {
    query.forEach(function(q2, index2) {
      mq += obj2mq(q2);
      if (index2 < query.length - 1) {
        mq += ", ";
      }
    });
    return mq;
  }
  return obj2mq(query);
};
var json2mq_1 = json2mq;
const json2mq$1 = /* @__PURE__ */ getDefaultExportFromCjs(json2mq_1);
function _callSuper$f(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$g() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
var Slider$1 = /* @__PURE__ */ function(_React$Component) {
  function Slider22(props) {
    var _this;
    _classCallCheck$a(this, Slider22);
    _this = _callSuper$f(this, Slider22, [props]);
    _defineProperty$3(_this, "innerSliderRefHandler", function(ref) {
      return _this.innerSlider = ref;
    });
    _defineProperty$3(_this, "slickPrev", function() {
      return _this.innerSlider.slickPrev();
    });
    _defineProperty$3(_this, "slickNext", function() {
      return _this.innerSlider.slickNext();
    });
    _defineProperty$3(_this, "slickGoTo", function(slide) {
      var dontAnimate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
      return _this.innerSlider.slickGoTo(slide, dontAnimate);
    });
    _defineProperty$3(_this, "slickPause", function() {
      return _this.innerSlider.pause("paused");
    });
    _defineProperty$3(_this, "slickPlay", function() {
      return _this.innerSlider.autoPlay("play");
    });
    _this.state = {
      breakpoint: null
    };
    _this._responsiveMediaHandlers = [];
    return _this;
  }
  _inherits$a(Slider22, _React$Component);
  return _createClass$8(Slider22, [{
    key: "media",
    value: function media(query, handler) {
      var mql = window.matchMedia(query);
      var listener = function listener2(_ref) {
        var matches = _ref.matches;
        if (matches) {
          handler();
        }
      };
      mql.addListener(listener);
      listener(mql);
      this._responsiveMediaHandlers.push({
        mql,
        query,
        listener
      });
    }
    // handles responsive breakpoints
  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      var _this2 = this;
      if (this.props.responsive) {
        var breakpoints = this.props.responsive.map(function(breakpt) {
          return breakpt.breakpoint;
        });
        breakpoints.sort(function(x2, y2) {
          return x2 - y2;
        });
        breakpoints.forEach(function(breakpoint, index2) {
          var bQuery;
          if (index2 === 0) {
            bQuery = json2mq$1({
              minWidth: 0,
              maxWidth: breakpoint
            });
          } else {
            bQuery = json2mq$1({
              minWidth: breakpoints[index2 - 1] + 1,
              maxWidth: breakpoint
            });
          }
          canUseDOM$2() && _this2.media(bQuery, function() {
            _this2.setState({
              breakpoint
            });
          });
        });
        var query = json2mq$1({
          minWidth: breakpoints.slice(-1)[0]
        });
        canUseDOM$2() && this.media(query, function() {
          _this2.setState({
            breakpoint: null
          });
        });
      }
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      this._responsiveMediaHandlers.forEach(function(obj) {
        obj.mql.removeListener(obj.listener);
      });
    }
  }, {
    key: "render",
    value: function render3() {
      var _this3 = this;
      var settings;
      var newProps;
      if (this.state.breakpoint) {
        newProps = this.props.responsive.filter(function(resp) {
          return resp.breakpoint === _this3.state.breakpoint;
        });
        settings = newProps[0].settings === "unslick" ? "unslick" : _objectSpread2(_objectSpread2(_objectSpread2({}, defaultProps$2), this.props), newProps[0].settings);
      } else {
        settings = _objectSpread2(_objectSpread2({}, defaultProps$2), this.props);
      }
      if (settings.centerMode) {
        if (settings.slidesToScroll > 1 && false)
          ;
        settings.slidesToScroll = 1;
      }
      if (settings.fade) {
        if (settings.slidesToShow > 1 && false)
          ;
        if (settings.slidesToScroll > 1 && false)
          ;
        settings.slidesToShow = 1;
        settings.slidesToScroll = 1;
      }
      var children = React$5.Children.toArray(this.props.children);
      children = children.filter(function(child) {
        if (typeof child === "string") {
          return !!child.trim();
        }
        return !!child;
      });
      if (settings.variableWidth && (settings.rows > 1 || settings.slidesPerRow > 1)) {
        console.warn("variableWidth is not supported in case of rows > 1 or slidesPerRow > 1");
        settings.variableWidth = false;
      }
      var newChildren = [];
      var currentWidth = null;
      for (var i2 = 0; i2 < children.length; i2 += settings.rows * settings.slidesPerRow) {
        var newSlide = [];
        for (var j2 = i2; j2 < i2 + settings.rows * settings.slidesPerRow; j2 += settings.slidesPerRow) {
          var row = [];
          for (var k2 = j2; k2 < j2 + settings.slidesPerRow; k2 += 1) {
            if (settings.variableWidth && children[k2].props.style) {
              currentWidth = children[k2].props.style.width;
            }
            if (k2 >= children.length)
              break;
            row.push(/* @__PURE__ */ React$5.cloneElement(children[k2], {
              key: 100 * i2 + 10 * j2 + k2,
              tabIndex: -1,
              style: {
                width: "".concat(100 / settings.slidesPerRow, "%"),
                display: "inline-block"
              }
            }));
          }
          newSlide.push(/* @__PURE__ */ React$5.createElement("div", {
            key: 10 * i2 + j2
          }, row));
        }
        if (settings.variableWidth) {
          newChildren.push(/* @__PURE__ */ React$5.createElement("div", {
            key: i2,
            style: {
              width: currentWidth
            }
          }, newSlide));
        } else {
          newChildren.push(/* @__PURE__ */ React$5.createElement("div", {
            key: i2
          }, newSlide));
        }
      }
      if (settings === "unslick") {
        var className = "regular slider " + (this.props.className || "");
        return /* @__PURE__ */ React$5.createElement("div", {
          className
        }, children);
      } else if (newChildren.length <= settings.slidesToShow && !settings.infinite) {
        settings.unslick = true;
      }
      return /* @__PURE__ */ React$5.createElement(InnerSlider, _extends$h({
        style: this.props.style,
        ref: this.innerSliderRefHandler
      }, filterSettings(settings)), newChildren);
    }
  }]);
}(React$5.Component);
const DotDuration = "--dot-duration";
const genCarouselStyle = (token2) => {
  const {
    componentCls,
    antCls
  } = token2;
  return {
    [componentCls]: Object.assign(Object.assign({}, resetComponent(token2)), {
      ".slick-slider": {
        position: "relative",
        display: "block",
        boxSizing: "border-box",
        touchAction: "pan-y",
        WebkitTouchCallout: "none",
        WebkitTapHighlightColor: "transparent",
        ".slick-track, .slick-list": {
          transform: "translate3d(0, 0, 0)",
          touchAction: "pan-y"
        }
      },
      ".slick-list": {
        position: "relative",
        display: "block",
        margin: 0,
        padding: 0,
        overflow: "hidden",
        "&:focus": {
          outline: "none"
        },
        "&.dragging": {
          cursor: "pointer"
        },
        ".slick-slide": {
          pointerEvents: "none",
          // https://github.com/ant-design/ant-design/issues/23294
          [`input${antCls}-radio-input, input${antCls}-checkbox-input`]: {
            visibility: "hidden"
          },
          "&.slick-active": {
            pointerEvents: "auto",
            [`input${antCls}-radio-input, input${antCls}-checkbox-input`]: {
              visibility: "visible"
            }
          },
          // fix Carousel content height not match parent node
          // when children is empty node
          // https://github.com/ant-design/ant-design/issues/25878
          "> div > div": {
            verticalAlign: "bottom"
          }
        }
      },
      ".slick-track": {
        position: "relative",
        top: 0,
        insetInlineStart: 0,
        display: "block",
        "&::before, &::after": {
          display: "table",
          content: '""'
        },
        "&::after": {
          clear: "both"
        }
      },
      ".slick-slide": {
        display: "none",
        float: "left",
        height: "100%",
        minHeight: 1,
        img: {
          display: "block"
        },
        "&.dragging img": {
          pointerEvents: "none"
        }
      },
      ".slick-initialized .slick-slide": {
        display: "block"
      },
      ".slick-vertical .slick-slide": {
        display: "block",
        height: "auto"
      }
    })
  };
};
const genArrowsStyle = (token2) => {
  const {
    componentCls,
    motionDurationSlow,
    arrowSize,
    arrowOffset
  } = token2;
  const arrowLength = token2.calc(arrowSize).div(Math.SQRT2).equal();
  return {
    [componentCls]: {
      // Arrows
      ".slick-prev, .slick-next": {
        position: "absolute",
        top: "50%",
        width: arrowSize,
        height: arrowSize,
        transform: "translateY(-50%)",
        color: "#fff",
        opacity: 0.4,
        background: "transparent",
        padding: 0,
        lineHeight: 0,
        border: 0,
        outline: "none",
        cursor: "pointer",
        zIndex: 1,
        transition: `opacity ${motionDurationSlow}`,
        "&:hover, &:focus": {
          opacity: 1
        },
        "&.slick-disabled": {
          pointerEvents: "none",
          opacity: 0
        },
        "&::after": {
          boxSizing: "border-box",
          position: "absolute",
          top: token2.calc(arrowSize).sub(arrowLength).div(2).equal(),
          insetInlineStart: token2.calc(arrowSize).sub(arrowLength).div(2).equal(),
          display: "inline-block",
          width: arrowLength,
          height: arrowLength,
          border: `0 solid currentcolor`,
          borderInlineStartWidth: 2,
          borderBlockStartWidth: 2,
          borderRadius: 1,
          content: '""'
        }
      },
      ".slick-prev": {
        insetInlineStart: arrowOffset,
        "&::after": {
          transform: "rotate(-45deg)"
        }
      },
      ".slick-next": {
        insetInlineEnd: arrowOffset,
        "&::after": {
          transform: "rotate(135deg)"
        }
      }
    }
  };
};
const genDotsStyle = (token2) => {
  const {
    componentCls,
    dotOffset,
    dotWidth,
    dotHeight,
    dotGap,
    colorBgContainer,
    motionDurationSlow
  } = token2;
  return {
    [componentCls]: {
      ".slick-dots": {
        position: "absolute",
        insetInlineEnd: 0,
        bottom: 0,
        insetInlineStart: 0,
        zIndex: 15,
        display: "flex !important",
        justifyContent: "center",
        paddingInlineStart: 0,
        margin: 0,
        listStyle: "none",
        "&-bottom": {
          bottom: dotOffset
        },
        "&-top": {
          top: dotOffset,
          bottom: "auto"
        },
        li: {
          position: "relative",
          display: "inline-block",
          flex: "0 1 auto",
          boxSizing: "content-box",
          width: dotWidth,
          height: dotHeight,
          marginInline: dotGap,
          padding: 0,
          textAlign: "center",
          textIndent: -999,
          verticalAlign: "top",
          transition: `all ${motionDurationSlow}`,
          borderRadius: dotHeight,
          overflow: "hidden",
          "&::after": {
            display: "block",
            position: "absolute",
            top: 0,
            insetInlineStart: 0,
            width: "100%",
            height: dotHeight,
            content: '""',
            background: colorBgContainer,
            borderRadius: dotHeight,
            opacity: 1,
            outline: "none",
            cursor: "pointer",
            overflow: "hidden",
            transform: "translate3d(-100%, 0, 0)"
          },
          button: {
            position: "relative",
            display: "block",
            width: "100%",
            height: dotHeight,
            padding: 0,
            color: "transparent",
            fontSize: 0,
            background: colorBgContainer,
            border: 0,
            borderRadius: dotHeight,
            outline: "none",
            cursor: "pointer",
            opacity: 0.2,
            transition: `all ${motionDurationSlow}`,
            overflow: "hidden",
            "&:hover": {
              opacity: 0.75
            },
            "&::after": {
              position: "absolute",
              inset: token2.calc(dotGap).mul(-1).equal(),
              content: '""'
            }
          },
          "&.slick-active": {
            width: token2.dotActiveWidth,
            position: "relative",
            "&:hover": {
              opacity: 1
            },
            "&::after": {
              transform: "translate3d(0, 0, 0)",
              transition: `transform var(${DotDuration}) ease-out`
            }
          }
        }
      }
    }
  };
};
const genCarouselVerticalStyle = (token2) => {
  const {
    componentCls,
    dotOffset,
    arrowOffset,
    marginXXS
  } = token2;
  const reverseSizeOfDot = {
    width: token2.dotHeight,
    height: token2.dotWidth
  };
  return {
    [`${componentCls}-vertical`]: {
      ".slick-prev, .slick-next": {
        insetInlineStart: "50%",
        marginBlockStart: "unset",
        transform: "translateX(-50%)"
      },
      ".slick-prev": {
        insetBlockStart: arrowOffset,
        insetInlineStart: "50%",
        "&::after": {
          transform: "rotate(45deg)"
        }
      },
      ".slick-next": {
        insetBlockStart: "auto",
        insetBlockEnd: arrowOffset,
        "&::after": {
          transform: "rotate(-135deg)"
        }
      },
      ".slick-dots": {
        top: "50%",
        bottom: "auto",
        flexDirection: "column",
        width: token2.dotHeight,
        height: "auto",
        margin: 0,
        transform: "translateY(-50%)",
        "&-left": {
          insetInlineEnd: "auto",
          insetInlineStart: dotOffset
        },
        "&-right": {
          insetInlineEnd: dotOffset,
          insetInlineStart: "auto"
        },
        li: Object.assign(Object.assign({}, reverseSizeOfDot), {
          margin: `${unit$1(marginXXS)} 0`,
          verticalAlign: "baseline",
          button: reverseSizeOfDot,
          "&::after": Object.assign(Object.assign({}, reverseSizeOfDot), {
            height: 0
          }),
          "&.slick-active": Object.assign(Object.assign({}, reverseSizeOfDot), {
            button: reverseSizeOfDot,
            "&::after": Object.assign(Object.assign({}, reverseSizeOfDot), {
              transition: `height var(${DotDuration}) ease-out`
            })
          })
        })
      }
    }
  };
};
const genCarouselRtlStyle = (token2) => {
  const {
    componentCls
  } = token2;
  return [{
    [`${componentCls}-rtl`]: {
      direction: "rtl",
      // Dots
      ".slick-dots": {
        [`${componentCls}-rtl&`]: {
          flexDirection: "row-reverse"
        }
      }
    }
  }, {
    [`${componentCls}-vertical`]: {
      ".slick-dots": {
        [`${componentCls}-rtl&`]: {
          flexDirection: "column"
        }
      }
    }
  }];
};
const prepareComponentToken$2 = (token2) => {
  const dotActiveWidth = 24;
  return {
    arrowSize: 16,
    arrowOffset: token2.marginXS,
    dotWidth: 16,
    dotHeight: 3,
    dotGap: token2.marginXXS,
    dotOffset: 12,
    dotWidthActive: dotActiveWidth,
    dotActiveWidth
  };
};
const useStyle$2 = genStyleHooks("Carousel", (token2) => [genCarouselStyle(token2), genArrowsStyle(token2), genDotsStyle(token2), genCarouselVerticalStyle(token2), genCarouselRtlStyle(token2)], prepareComponentToken$2, {
  deprecatedTokens: [["dotWidthActive", "dotActiveWidth"]]
});
var __rest$3 = function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
};
const dotsClass = "slick-dots";
const ArrowButton = (_a2) => {
  var {
    currentSlide,
    slideCount
  } = _a2, rest = __rest$3(_a2, ["currentSlide", "slideCount"]);
  return /* @__PURE__ */ reactExports.createElement("button", Object.assign({
    type: "button"
  }, rest));
};
const Carousel = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
  const {
    dots = true,
    arrows = false,
    prevArrow = /* @__PURE__ */ reactExports.createElement(ArrowButton, {
      "aria-label": "prev"
    }),
    nextArrow = /* @__PURE__ */ reactExports.createElement(ArrowButton, {
      "aria-label": "next"
    }),
    draggable = false,
    waitForAnimate = false,
    dotPosition = "bottom",
    vertical = dotPosition === "left" || dotPosition === "right",
    rootClassName,
    className: customClassName,
    style: style2,
    id: id2,
    autoplay = false,
    autoplaySpeed = 3e3
  } = props, otherProps = __rest$3(props, ["dots", "arrows", "prevArrow", "nextArrow", "draggable", "waitForAnimate", "dotPosition", "vertical", "rootClassName", "className", "style", "id", "autoplay", "autoplaySpeed"]);
  const {
    getPrefixCls,
    direction,
    className: contextClassName,
    style: contextStyle
  } = useComponentConfig("carousel");
  const slickRef = reactExports.useRef(null);
  const goTo = (slide, dontAnimate = false) => {
    slickRef.current.slickGoTo(slide, dontAnimate);
  };
  reactExports.useImperativeHandle(ref, () => ({
    goTo,
    autoPlay: slickRef.current.innerSlider.autoPlay,
    innerSlider: slickRef.current.innerSlider,
    prev: slickRef.current.slickPrev,
    next: slickRef.current.slickNext
  }), [slickRef.current]);
  const prevCount = reactExports.useRef(reactExports.Children.count(props.children));
  reactExports.useEffect(() => {
    if (prevCount.current !== reactExports.Children.count(props.children)) {
      goTo(props.initialSlide || 0, false);
      prevCount.current = reactExports.Children.count(props.children);
    }
  }, [props.children]);
  const newProps = Object.assign({
    vertical,
    className: classNames(customClassName, contextClassName),
    style: Object.assign(Object.assign({}, contextStyle), style2),
    autoplay: !!autoplay
  }, otherProps);
  if (newProps.effect === "fade") {
    newProps.fade = true;
  }
  const prefixCls = getPrefixCls("carousel", newProps.prefixCls);
  const enableDots = !!dots;
  const dsClass = classNames(dotsClass, `${dotsClass}-${dotPosition}`, typeof dots === "boolean" ? false : dots === null || dots === void 0 ? void 0 : dots.className);
  const [wrapCSSVar, hashId, cssVarCls] = useStyle$2(prefixCls);
  const className = classNames(prefixCls, {
    [`${prefixCls}-rtl`]: direction === "rtl",
    [`${prefixCls}-vertical`]: newProps.vertical
  }, hashId, cssVarCls, rootClassName);
  const mergedShowDuration = autoplay && (typeof autoplay === "object" ? autoplay.dotDuration : false);
  const dotDurationStyle = mergedShowDuration ? {
    [DotDuration]: `${autoplaySpeed}ms`
  } : {};
  return wrapCSSVar(/* @__PURE__ */ reactExports.createElement("div", {
    className,
    id: id2,
    style: dotDurationStyle
  }, /* @__PURE__ */ reactExports.createElement(Slider$1, Object.assign({
    ref: slickRef
  }, newProps, {
    dots: enableDots,
    dotsClass: dsClass,
    arrows,
    prevArrow,
    nextArrow,
    draggable,
    verticalSwiping: vertical,
    autoplaySpeed,
    waitForAnimate
  }))));
});
function getEntity(keyEntities, key) {
  return keyEntities[key];
}
var _excluded$c = ["children"];
function getPosition$1(level, index2) {
  return "".concat(level, "-").concat(index2);
}
function isTreeNode(node2) {
  return node2 && node2.type && node2.type.isTreeNode;
}
function getKey2(key, pos) {
  if (key !== null && key !== void 0) {
    return key;
  }
  return pos;
}
function fillFieldNames(fieldNames) {
  var _ref = fieldNames || {}, title = _ref.title, _title = _ref._title, key = _ref.key, children = _ref.children;
  var mergedTitle = title || "title";
  return {
    title: mergedTitle,
    _title: _title || [mergedTitle],
    key: key || "key",
    children: children || "children"
  };
}
function convertTreeToData(rootNodes) {
  function dig(node2) {
    var treeNodes = toArray$4(node2);
    return treeNodes.map(function(treeNode) {
      if (!isTreeNode(treeNode)) {
        warningOnce(!treeNode, "Tree/TreeNode can only accept TreeNode as children.");
        return null;
      }
      var key = treeNode.key;
      var _treeNode$props = treeNode.props, children = _treeNode$props.children, rest = _objectWithoutProperties$3(_treeNode$props, _excluded$c);
      var dataNode = _objectSpread2({
        key
      }, rest);
      var parsedChildren = dig(children);
      if (parsedChildren.length) {
        dataNode.children = parsedChildren;
      }
      return dataNode;
    }).filter(function(dataNode) {
      return dataNode;
    });
  }
  return dig(rootNodes);
}
function flattenTreeData(treeNodeList, expandedKeys, fieldNames) {
  var _fillFieldNames = fillFieldNames(fieldNames), fieldTitles = _fillFieldNames._title, fieldKey = _fillFieldNames.key, fieldChildren = _fillFieldNames.children;
  var expandedKeySet = new Set(expandedKeys === true ? [] : expandedKeys);
  var flattenList = [];
  function dig(list2) {
    var parent = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
    return list2.map(function(treeNode, index2) {
      var pos = getPosition$1(parent ? parent.pos : "0", index2);
      var mergedKey = getKey2(treeNode[fieldKey], pos);
      var mergedTitle;
      for (var i2 = 0; i2 < fieldTitles.length; i2 += 1) {
        var fieldTitle = fieldTitles[i2];
        if (treeNode[fieldTitle] !== void 0) {
          mergedTitle = treeNode[fieldTitle];
          break;
        }
      }
      var flattenNode = Object.assign(omit$1(treeNode, [].concat(_toConsumableArray(fieldTitles), [fieldKey, fieldChildren])), {
        title: mergedTitle,
        key: mergedKey,
        parent,
        pos,
        children: null,
        data: treeNode,
        isStart: [].concat(_toConsumableArray(parent ? parent.isStart : []), [index2 === 0]),
        isEnd: [].concat(_toConsumableArray(parent ? parent.isEnd : []), [index2 === list2.length - 1])
      });
      flattenList.push(flattenNode);
      if (expandedKeys === true || expandedKeySet.has(mergedKey)) {
        flattenNode.children = dig(treeNode[fieldChildren] || [], flattenNode);
      } else {
        flattenNode.children = [];
      }
      return flattenNode;
    });
  }
  dig(treeNodeList);
  return flattenList;
}
function traverseDataNodes(dataNodes, callback2, config2) {
  var mergedConfig = {};
  if (_typeof$1(config2) === "object") {
    mergedConfig = config2;
  } else {
    mergedConfig = {
      externalGetKey: config2
    };
  }
  mergedConfig = mergedConfig || {};
  var _mergedConfig = mergedConfig, childrenPropName = _mergedConfig.childrenPropName, externalGetKey = _mergedConfig.externalGetKey, fieldNames = _mergedConfig.fieldNames;
  var _fillFieldNames2 = fillFieldNames(fieldNames), fieldKey = _fillFieldNames2.key, fieldChildren = _fillFieldNames2.children;
  var mergeChildrenPropName = childrenPropName || fieldChildren;
  var syntheticGetKey;
  if (externalGetKey) {
    if (typeof externalGetKey === "string") {
      syntheticGetKey = function syntheticGetKey2(node2) {
        return node2[externalGetKey];
      };
    } else if (typeof externalGetKey === "function") {
      syntheticGetKey = function syntheticGetKey2(node2) {
        return externalGetKey(node2);
      };
    }
  } else {
    syntheticGetKey = function syntheticGetKey2(node2, pos) {
      return getKey2(node2[fieldKey], pos);
    };
  }
  function processNode(node2, index2, parent, pathNodes) {
    var children = node2 ? node2[mergeChildrenPropName] : dataNodes;
    var pos = node2 ? getPosition$1(parent.pos, index2) : "0";
    var connectNodes = node2 ? [].concat(_toConsumableArray(pathNodes), [node2]) : [];
    if (node2) {
      var key = syntheticGetKey(node2, pos);
      var _data = {
        node: node2,
        index: index2,
        pos,
        key,
        parentPos: parent.node ? parent.pos : null,
        level: parent.level + 1,
        nodes: connectNodes
      };
      callback2(_data);
    }
    if (children) {
      children.forEach(function(subNode, subIndex) {
        processNode(subNode, subIndex, {
          node: node2,
          pos,
          level: parent ? parent.level + 1 : -1
        }, connectNodes);
      });
    }
  }
  processNode(null);
}
function convertDataToEntities(dataNodes) {
  var _ref2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, initWrapper = _ref2.initWrapper, processEntity = _ref2.processEntity, onProcessFinished = _ref2.onProcessFinished, externalGetKey = _ref2.externalGetKey, childrenPropName = _ref2.childrenPropName, fieldNames = _ref2.fieldNames;
  var legacyExternalGetKey = arguments.length > 2 ? arguments[2] : void 0;
  var mergedExternalGetKey = externalGetKey || legacyExternalGetKey;
  var posEntities = {};
  var keyEntities = {};
  var wrapper = {
    posEntities,
    keyEntities
  };
  if (initWrapper) {
    wrapper = initWrapper(wrapper) || wrapper;
  }
  traverseDataNodes(dataNodes, function(item) {
    var node2 = item.node, index2 = item.index, pos = item.pos, key = item.key, parentPos = item.parentPos, level = item.level, nodes = item.nodes;
    var entity = {
      node: node2,
      nodes,
      index: index2,
      key,
      pos,
      level
    };
    var mergedKey = getKey2(key, pos);
    posEntities[pos] = entity;
    keyEntities[mergedKey] = entity;
    entity.parent = posEntities[parentPos];
    if (entity.parent) {
      entity.parent.children = entity.parent.children || [];
      entity.parent.children.push(entity);
    }
    if (processEntity) {
      processEntity(entity, wrapper);
    }
  }, {
    externalGetKey: mergedExternalGetKey,
    childrenPropName,
    fieldNames
  });
  if (onProcessFinished) {
    onProcessFinished(wrapper);
  }
  return wrapper;
}
function getTreeNodeProps(key, _ref3) {
  var expandedKeys = _ref3.expandedKeys, selectedKeys = _ref3.selectedKeys, loadedKeys = _ref3.loadedKeys, loadingKeys = _ref3.loadingKeys, checkedKeys = _ref3.checkedKeys, halfCheckedKeys = _ref3.halfCheckedKeys, dragOverNodeKey = _ref3.dragOverNodeKey, dropPosition = _ref3.dropPosition, keyEntities = _ref3.keyEntities;
  var entity = getEntity(keyEntities, key);
  var treeNodeProps = {
    eventKey: key,
    expanded: expandedKeys.indexOf(key) !== -1,
    selected: selectedKeys.indexOf(key) !== -1,
    loaded: loadedKeys.indexOf(key) !== -1,
    loading: loadingKeys.indexOf(key) !== -1,
    checked: checkedKeys.indexOf(key) !== -1,
    halfChecked: halfCheckedKeys.indexOf(key) !== -1,
    pos: String(entity ? entity.pos : ""),
    // [Legacy] Drag props
    // Since the interaction of drag is changed, the semantic of the props are
    // not accuracy, I think it should be finally removed
    dragOver: dragOverNodeKey === key && dropPosition === 0,
    dragOverGapTop: dragOverNodeKey === key && dropPosition === -1,
    dragOverGapBottom: dragOverNodeKey === key && dropPosition === 1
  };
  return treeNodeProps;
}
function convertNodePropsToEventData(props) {
  var data = props.data, expanded = props.expanded, selected = props.selected, checked = props.checked, loaded = props.loaded, loading = props.loading, halfChecked = props.halfChecked, dragOver = props.dragOver, dragOverGapTop = props.dragOverGapTop, dragOverGapBottom = props.dragOverGapBottom, pos = props.pos, active3 = props.active, eventKey = props.eventKey;
  var eventData = _objectSpread2(_objectSpread2({}, data), {}, {
    expanded,
    selected,
    checked,
    loaded,
    loading,
    halfChecked,
    dragOver,
    dragOverGapTop,
    dragOverGapBottom,
    pos,
    active: active3,
    key: eventKey
  });
  if (!("props" in eventData)) {
    Object.defineProperty(eventData, "props", {
      get: function get5() {
        warningOnce(false, "Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`.");
        return props;
      }
    });
  }
  return eventData;
}
function removeFromCheckedKeys(halfCheckedKeys, checkedKeys) {
  var filteredKeys = /* @__PURE__ */ new Set();
  halfCheckedKeys.forEach(function(key) {
    if (!checkedKeys.has(key)) {
      filteredKeys.add(key);
    }
  });
  return filteredKeys;
}
function isCheckDisabled(node2) {
  var _ref = node2 || {}, disabled = _ref.disabled, disableCheckbox = _ref.disableCheckbox, checkable = _ref.checkable;
  return !!(disabled || disableCheckbox) || checkable === false;
}
function fillConductCheck(keys2, levelEntities, maxLevel, syntheticGetCheckDisabled) {
  var checkedKeys = new Set(keys2);
  var halfCheckedKeys = /* @__PURE__ */ new Set();
  for (var level = 0; level <= maxLevel; level += 1) {
    var entities = levelEntities.get(level) || /* @__PURE__ */ new Set();
    entities.forEach(function(entity) {
      var key = entity.key, node2 = entity.node, _entity$children = entity.children, children = _entity$children === void 0 ? [] : _entity$children;
      if (checkedKeys.has(key) && !syntheticGetCheckDisabled(node2)) {
        children.filter(function(childEntity) {
          return !syntheticGetCheckDisabled(childEntity.node);
        }).forEach(function(childEntity) {
          checkedKeys.add(childEntity.key);
        });
      }
    });
  }
  var visitedKeys = /* @__PURE__ */ new Set();
  for (var _level = maxLevel; _level >= 0; _level -= 1) {
    var _entities = levelEntities.get(_level) || /* @__PURE__ */ new Set();
    _entities.forEach(function(entity) {
      var parent = entity.parent, node2 = entity.node;
      if (syntheticGetCheckDisabled(node2) || !entity.parent || visitedKeys.has(entity.parent.key)) {
        return;
      }
      if (syntheticGetCheckDisabled(entity.parent.node)) {
        visitedKeys.add(parent.key);
        return;
      }
      var allChecked = true;
      var partialChecked = false;
      (parent.children || []).filter(function(childEntity) {
        return !syntheticGetCheckDisabled(childEntity.node);
      }).forEach(function(_ref2) {
        var key = _ref2.key;
        var checked = checkedKeys.has(key);
        if (allChecked && !checked) {
          allChecked = false;
        }
        if (!partialChecked && (checked || halfCheckedKeys.has(key))) {
          partialChecked = true;
        }
      });
      if (allChecked) {
        checkedKeys.add(parent.key);
      }
      if (partialChecked) {
        halfCheckedKeys.add(parent.key);
      }
      visitedKeys.add(parent.key);
    });
  }
  return {
    checkedKeys: Array.from(checkedKeys),
    halfCheckedKeys: Array.from(removeFromCheckedKeys(halfCheckedKeys, checkedKeys))
  };
}
function cleanConductCheck(keys2, halfKeys, levelEntities, maxLevel, syntheticGetCheckDisabled) {
  var checkedKeys = new Set(keys2);
  var halfCheckedKeys = new Set(halfKeys);
  for (var level = 0; level <= maxLevel; level += 1) {
    var entities = levelEntities.get(level) || /* @__PURE__ */ new Set();
    entities.forEach(function(entity) {
      var key = entity.key, node2 = entity.node, _entity$children2 = entity.children, children = _entity$children2 === void 0 ? [] : _entity$children2;
      if (!checkedKeys.has(key) && !halfCheckedKeys.has(key) && !syntheticGetCheckDisabled(node2)) {
        children.filter(function(childEntity) {
          return !syntheticGetCheckDisabled(childEntity.node);
        }).forEach(function(childEntity) {
          checkedKeys.delete(childEntity.key);
        });
      }
    });
  }
  halfCheckedKeys = /* @__PURE__ */ new Set();
  var visitedKeys = /* @__PURE__ */ new Set();
  for (var _level2 = maxLevel; _level2 >= 0; _level2 -= 1) {
    var _entities2 = levelEntities.get(_level2) || /* @__PURE__ */ new Set();
    _entities2.forEach(function(entity) {
      var parent = entity.parent, node2 = entity.node;
      if (syntheticGetCheckDisabled(node2) || !entity.parent || visitedKeys.has(entity.parent.key)) {
        return;
      }
      if (syntheticGetCheckDisabled(entity.parent.node)) {
        visitedKeys.add(parent.key);
        return;
      }
      var allChecked = true;
      var partialChecked = false;
      (parent.children || []).filter(function(childEntity) {
        return !syntheticGetCheckDisabled(childEntity.node);
      }).forEach(function(_ref3) {
        var key = _ref3.key;
        var checked = checkedKeys.has(key);
        if (allChecked && !checked) {
          allChecked = false;
        }
        if (!partialChecked && (checked || halfCheckedKeys.has(key))) {
          partialChecked = true;
        }
      });
      if (!allChecked) {
        checkedKeys.delete(parent.key);
      }
      if (partialChecked) {
        halfCheckedKeys.add(parent.key);
      }
      visitedKeys.add(parent.key);
    });
  }
  return {
    checkedKeys: Array.from(checkedKeys),
    halfCheckedKeys: Array.from(removeFromCheckedKeys(halfCheckedKeys, checkedKeys))
  };
}
function conductCheck(keyList, checked, keyEntities, getCheckDisabled) {
  var warningMissKeys = [];
  var syntheticGetCheckDisabled;
  {
    syntheticGetCheckDisabled = isCheckDisabled;
  }
  var keys2 = new Set(keyList.filter(function(key) {
    var hasEntity = !!getEntity(keyEntities, key);
    if (!hasEntity) {
      warningMissKeys.push(key);
    }
    return hasEntity;
  }));
  var levelEntities = /* @__PURE__ */ new Map();
  var maxLevel = 0;
  Object.keys(keyEntities).forEach(function(key) {
    var entity = keyEntities[key];
    var level = entity.level;
    var levelSet = levelEntities.get(level);
    if (!levelSet) {
      levelSet = /* @__PURE__ */ new Set();
      levelEntities.set(level, levelSet);
    }
    levelSet.add(entity);
    maxLevel = Math.max(maxLevel, level);
  });
  warningOnce(!warningMissKeys.length, "Tree missing follow keys: ".concat(warningMissKeys.slice(0, 100).map(function(key) {
    return "'".concat(key, "'");
  }).join(", ")));
  var result;
  if (checked === true) {
    result = fillConductCheck(keys2, levelEntities, maxLevel, syntheticGetCheckDisabled);
  } else {
    result = cleanConductCheck(keys2, checked.halfCheckedKeys, levelEntities, maxLevel, syntheticGetCheckDisabled);
  }
  return result;
}
const genCheckboxStyle = (token2) => {
  const {
    checkboxCls
  } = token2;
  const wrapperCls = `${checkboxCls}-wrapper`;
  return [
    // ===================== Basic =====================
    {
      // Group
      [`${checkboxCls}-group`]: Object.assign(Object.assign({}, resetComponent(token2)), {
        display: "inline-flex",
        flexWrap: "wrap",
        columnGap: token2.marginXS,
        // Group > Grid
        [`> ${token2.antCls}-row`]: {
          flex: 1
        }
      }),
      // Wrapper
      [wrapperCls]: Object.assign(Object.assign({}, resetComponent(token2)), {
        display: "inline-flex",
        alignItems: "baseline",
        cursor: "pointer",
        // Fix checkbox & radio in flex align #30260
        "&:after": {
          display: "inline-block",
          width: 0,
          overflow: "hidden",
          content: "'\\a0'"
        },
        // Checkbox near checkbox
        [`& + ${wrapperCls}`]: {
          marginInlineStart: 0
        },
        [`&${wrapperCls}-in-form-item`]: {
          'input[type="checkbox"]': {
            width: 14,
            // FIXME: magic
            height: 14
            // FIXME: magic
          }
        }
      }),
      // Wrapper > Checkbox
      [checkboxCls]: Object.assign(Object.assign({}, resetComponent(token2)), {
        position: "relative",
        whiteSpace: "nowrap",
        lineHeight: 1,
        cursor: "pointer",
        borderRadius: token2.borderRadiusSM,
        // To make alignment right when `controlHeight` is changed
        // Ref: https://github.com/ant-design/ant-design/issues/41564
        alignSelf: "center",
        // Wrapper > Checkbox > input
        [`${checkboxCls}-input`]: {
          position: "absolute",
          // Since baseline align will get additional space offset,
          // we need to move input to top to make it align with text.
          // Ref: https://github.com/ant-design/ant-design/issues/38926#issuecomment-1486137799
          inset: 0,
          zIndex: 1,
          cursor: "pointer",
          opacity: 0,
          margin: 0,
          [`&:focus-visible + ${checkboxCls}-inner`]: Object.assign({}, genFocusOutline(token2))
        },
        // Wrapper > Checkbox > inner
        [`${checkboxCls}-inner`]: {
          boxSizing: "border-box",
          display: "block",
          width: token2.checkboxSize,
          height: token2.checkboxSize,
          direction: "ltr",
          backgroundColor: token2.colorBgContainer,
          border: `${unit$1(token2.lineWidth)} ${token2.lineType} ${token2.colorBorder}`,
          borderRadius: token2.borderRadiusSM,
          borderCollapse: "separate",
          transition: `all ${token2.motionDurationSlow}`,
          "&:after": {
            boxSizing: "border-box",
            position: "absolute",
            top: "50%",
            insetInlineStart: "25%",
            display: "table",
            width: token2.calc(token2.checkboxSize).div(14).mul(5).equal(),
            height: token2.calc(token2.checkboxSize).div(14).mul(8).equal(),
            border: `${unit$1(token2.lineWidthBold)} solid ${token2.colorWhite}`,
            borderTop: 0,
            borderInlineStart: 0,
            transform: "rotate(45deg) scale(0) translate(-50%,-50%)",
            opacity: 0,
            content: '""',
            transition: `all ${token2.motionDurationFast} ${token2.motionEaseInBack}, opacity ${token2.motionDurationFast}`
          }
        },
        // Wrapper > Checkbox + Text
        "& + span": {
          paddingInlineStart: token2.paddingXS,
          paddingInlineEnd: token2.paddingXS
        }
      })
    },
    // ===================== Hover =====================
    {
      // Wrapper & Wrapper > Checkbox
      [`
        ${wrapperCls}:not(${wrapperCls}-disabled),
        ${checkboxCls}:not(${checkboxCls}-disabled)
      `]: {
        [`&:hover ${checkboxCls}-inner`]: {
          borderColor: token2.colorPrimary
        }
      },
      [`${wrapperCls}:not(${wrapperCls}-disabled)`]: {
        [`&:hover ${checkboxCls}-checked:not(${checkboxCls}-disabled) ${checkboxCls}-inner`]: {
          backgroundColor: token2.colorPrimaryHover,
          borderColor: "transparent"
        },
        [`&:hover ${checkboxCls}-checked:not(${checkboxCls}-disabled):after`]: {
          borderColor: token2.colorPrimaryHover
        }
      }
    },
    // ==================== Checked ====================
    {
      // Wrapper > Checkbox
      [`${checkboxCls}-checked`]: {
        [`${checkboxCls}-inner`]: {
          backgroundColor: token2.colorPrimary,
          borderColor: token2.colorPrimary,
          "&:after": {
            opacity: 1,
            transform: "rotate(45deg) scale(1) translate(-50%,-50%)",
            transition: `all ${token2.motionDurationMid} ${token2.motionEaseOutBack} ${token2.motionDurationFast}`
          }
        }
      },
      [`
        ${wrapperCls}-checked:not(${wrapperCls}-disabled),
        ${checkboxCls}-checked:not(${checkboxCls}-disabled)
      `]: {
        [`&:hover ${checkboxCls}-inner`]: {
          backgroundColor: token2.colorPrimaryHover,
          borderColor: "transparent"
        }
      }
    },
    // ================= Indeterminate =================
    {
      [checkboxCls]: {
        "&-indeterminate": {
          "&": {
            // Wrapper > Checkbox > inner
            [`${checkboxCls}-inner`]: {
              backgroundColor: `${token2.colorBgContainer}`,
              borderColor: `${token2.colorBorder}`,
              "&:after": {
                top: "50%",
                insetInlineStart: "50%",
                width: token2.calc(token2.fontSizeLG).div(2).equal(),
                height: token2.calc(token2.fontSizeLG).div(2).equal(),
                backgroundColor: token2.colorPrimary,
                border: 0,
                transform: "translate(-50%, -50%) scale(1)",
                opacity: 1,
                content: '""'
              }
            },
            // https://github.com/ant-design/ant-design/issues/50074
            [`&:hover ${checkboxCls}-inner`]: {
              backgroundColor: `${token2.colorBgContainer}`,
              borderColor: `${token2.colorPrimary}`
            }
          }
        }
      }
    },
    // ==================== Disable ====================
    {
      // Wrapper
      [`${wrapperCls}-disabled`]: {
        cursor: "not-allowed"
      },
      // Wrapper > Checkbox
      [`${checkboxCls}-disabled`]: {
        // Wrapper > Checkbox > input
        [`&, ${checkboxCls}-input`]: {
          cursor: "not-allowed",
          // Disabled for native input to enable Tooltip event handler
          // ref: https://github.com/ant-design/ant-design/issues/39822#issuecomment-1365075901
          pointerEvents: "none"
        },
        // Wrapper > Checkbox > inner
        [`${checkboxCls}-inner`]: {
          background: token2.colorBgContainerDisabled,
          borderColor: token2.colorBorder,
          "&:after": {
            borderColor: token2.colorTextDisabled
          }
        },
        "&:after": {
          display: "none"
        },
        "& + span": {
          color: token2.colorTextDisabled
        },
        [`&${checkboxCls}-indeterminate ${checkboxCls}-inner::after`]: {
          background: token2.colorTextDisabled
        }
      }
    }
  ];
};
function getStyle$1(prefixCls, token2) {
  const checkboxToken = merge$4(token2, {
    checkboxCls: `.${prefixCls}`,
    checkboxSize: token2.controlInteractiveSize
  });
  return [genCheckboxStyle(checkboxToken)];
}
genStyleHooks("Checkbox", (token2, {
  prefixCls
}) => [getStyle$1(prefixCls, token2)]);
var ClockCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z" } }] }, "name": "clock-circle", "theme": "outlined" };
var ClockCircleOutlined = function ClockCircleOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: ClockCircleOutlined$1
  }));
};
var RefIcon$1f = /* @__PURE__ */ reactExports.forwardRef(ClockCircleOutlined);
var QuestionCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0130.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1080 0 40 40 0 10-80 0z" } }] }, "name": "question-circle", "theme": "outlined" };
var QuestionCircleOutlined = function QuestionCircleOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: QuestionCircleOutlined$1
  }));
};
var RefIcon$1e = /* @__PURE__ */ reactExports.forwardRef(QuestionCircleOutlined);
var EyeOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z" } }] }, "name": "eye", "theme": "outlined" };
var EyeOutlined = function EyeOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: EyeOutlined$1
  }));
};
var RefIcon$1d = /* @__PURE__ */ reactExports.forwardRef(EyeOutlined);
var ZoomInOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z" } }] }, "name": "zoom-in", "theme": "outlined" };
var ZoomInOutlined = function ZoomInOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: ZoomInOutlined$1
  }));
};
var RefIcon$1c = /* @__PURE__ */ reactExports.forwardRef(ZoomInOutlined);
var EyeInvisibleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z" } }, { "tag": "path", "attrs": { "d": "M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z" } }] }, "name": "eye-invisible", "theme": "outlined" };
var EyeInvisibleOutlined = function EyeInvisibleOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: EyeInvisibleOutlined$1
  }));
};
var RefIcon$1b = /* @__PURE__ */ reactExports.forwardRef(EyeInvisibleOutlined);
var DoubleRightOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M533.2 492.3L277.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H188c-6.7 0-10.4 7.7-6.3 12.9L447.1 512 181.7 851.1A7.98 7.98 0 00188 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5zm304 0L581.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H492c-6.7 0-10.4 7.7-6.3 12.9L751.1 512 485.7 851.1A7.98 7.98 0 00492 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5z" } }] }, "name": "double-right", "theme": "outlined" };
var DoubleRightOutlined = function DoubleRightOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: DoubleRightOutlined$1
  }));
};
var RefIcon$1a = /* @__PURE__ */ reactExports.forwardRef(DoubleRightOutlined);
var ApartmentOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M908 640H804V488c0-4.4-3.6-8-8-8H548v-96h108c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16H368c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h108v96H228c-4.4 0-8 3.6-8 8v152H116c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16H292v-88h440v88H620c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16zm-564 76v168H176V716h168zm84-408V140h168v168H428zm420 576H680V716h168v168z" } }] }, "name": "apartment", "theme": "outlined" };
var ApartmentOutlined = function ApartmentOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: ApartmentOutlined$1
  }));
};
var RefIcon$19 = /* @__PURE__ */ reactExports.forwardRef(ApartmentOutlined);
var ApiOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z" } }] }, "name": "api", "theme": "outlined" };
var ApiOutlined = function ApiOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: ApiOutlined$1
  }));
};
var RefIcon$18 = /* @__PURE__ */ reactExports.forwardRef(ApiOutlined);
var AppstoreAddOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zm52 132H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200zM424 712H296V584c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v128H104c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h128v128c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V776h128c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z" } }] }, "name": "appstore-add", "theme": "outlined" };
var AppstoreAddOutlined = function AppstoreAddOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: AppstoreAddOutlined$1
  }));
};
var RefIcon$17 = /* @__PURE__ */ reactExports.forwardRef(AppstoreAddOutlined);
var AppstoreOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zM464 544H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H212V612h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200z" } }] }, "name": "appstore", "theme": "outlined" };
var AppstoreOutlined = function AppstoreOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: AppstoreOutlined$1
  }));
};
var RefIcon$16 = /* @__PURE__ */ reactExports.forwardRef(AppstoreOutlined);
var ArrowLeftOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z" } }] }, "name": "arrow-left", "theme": "outlined" };
var ArrowLeftOutlined = function ArrowLeftOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: ArrowLeftOutlined$1
  }));
};
var RefIcon$15 = /* @__PURE__ */ reactExports.forwardRef(ArrowLeftOutlined);
var ArrowRightOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 000-48.4z" } }] }, "name": "arrow-right", "theme": "outlined" };
var ArrowRightOutlined = function ArrowRightOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: ArrowRightOutlined$1
  }));
};
var RefIcon$14 = /* @__PURE__ */ reactExports.forwardRef(ArrowRightOutlined);
var ArrowUpOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M868 545.5L536.1 163a31.96 31.96 0 00-48.3 0L156 545.5a7.97 7.97 0 006 13.2h81c4.6 0 9-2 12.1-5.5L474 300.9V864c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V300.9l218.9 252.3c3 3.5 7.4 5.5 12.1 5.5h81c6.8 0 10.5-8 6-13.2z" } }] }, "name": "arrow-up", "theme": "outlined" };
var ArrowUpOutlined = function ArrowUpOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: ArrowUpOutlined$1
  }));
};
var RefIcon$13 = /* @__PURE__ */ reactExports.forwardRef(ArrowUpOutlined);
var CaretDownFilled$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z" } }] }, "name": "caret-down", "theme": "filled" };
var CaretDownFilled = function CaretDownFilled2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: CaretDownFilled$1
  }));
};
var RefIcon$12 = /* @__PURE__ */ reactExports.forwardRef(CaretDownFilled);
var CaretRightOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M715.8 493.5L335 165.1c-14.2-12.2-35-1.2-35 18.5v656.8c0 19.7 20.8 30.7 35 18.5l380.8-328.4c10.9-9.4 10.9-27.6 0-37z" } }] }, "name": "caret-right", "theme": "outlined" };
var CaretRightOutlined = function CaretRightOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: CaretRightOutlined$1
  }));
};
var RefIcon$11 = /* @__PURE__ */ reactExports.forwardRef(CaretRightOutlined);
var CheckCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z" } }, { "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }] }, "name": "check-circle", "theme": "outlined" };
var CheckCircleOutlined = function CheckCircleOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: CheckCircleOutlined$1
  }));
};
var RefIcon$10 = /* @__PURE__ */ reactExports.forwardRef(CheckCircleOutlined);
var ClearOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M899.1 869.6l-53-305.6H864c14.4 0 26-11.6 26-26V346c0-14.4-11.6-26-26-26H618V138c0-14.4-11.6-26-26-26H432c-14.4 0-26 11.6-26 26v182H160c-14.4 0-26 11.6-26 26v192c0 14.4 11.6 26 26 26h17.9l-53 305.6a25.95 25.95 0 0025.6 30.4h723c1.5 0 3-.1 4.4-.4a25.88 25.88 0 0021.2-30zM204 390h272V182h72v208h272v104H204V390zm468 440V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H416V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H202.8l45.1-260H776l45.1 260H672z" } }] }, "name": "clear", "theme": "outlined" };
var ClearOutlined = function ClearOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: ClearOutlined$1
  }));
};
var RefIcon$$ = /* @__PURE__ */ reactExports.forwardRef(ClearOutlined);
var CloseCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z" } }] }, "name": "close-circle", "theme": "outlined" };
var CloseCircleOutlined = function CloseCircleOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: CloseCircleOutlined$1
  }));
};
var RefIcon$_ = /* @__PURE__ */ reactExports.forwardRef(CloseCircleOutlined);
var CopyOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z" } }] }, "name": "copy", "theme": "outlined" };
var CopyOutlined = function CopyOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: CopyOutlined$1
  }));
};
var RefIcon$Z = /* @__PURE__ */ reactExports.forwardRef(CopyOutlined);
var DatabaseOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM304 240a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0z" } }] }, "name": "database", "theme": "outlined" };
var DatabaseOutlined = function DatabaseOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: DatabaseOutlined$1
  }));
};
var RefIcon$Y = /* @__PURE__ */ reactExports.forwardRef(DatabaseOutlined);
var DeleteColumnOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M651.1 641.9a7.84 7.84 0 00-5.1-1.9h-54.7c-2.4 0-4.6 1.1-6.1 2.9L512 730.7l-73.1-87.8a8.1 8.1 0 00-6.1-2.9H378c-1.9 0-3.7.7-5.1 1.9a7.97 7.97 0 00-1 11.3L474.2 776 371.8 898.9a8.06 8.06 0 006.1 13.2h54.7c2.4 0 4.6-1.1 6.1-2.9l73.1-87.8 73.1 87.8a8.1 8.1 0 006.1 2.9h55c1.9 0 3.7-.7 5.1-1.9 3.4-2.8 3.9-7.9 1-11.3L549.8 776l102.4-122.9c2.8-3.4 2.3-8.4-1.1-11.2zM472 544h80c4.4 0 8-3.6 8-8V120c0-4.4-3.6-8-8-8h-80c-4.4 0-8 3.6-8 8v416c0 4.4 3.6 8 8 8zM350 386H184V136c0-3.3-2.7-6-6-6h-60c-3.3 0-6 2.7-6 6v292c0 16.6 13.4 30 30 30h208c3.3 0 6-2.7 6-6v-60c0-3.3-2.7-6-6-6zm556-256h-60c-3.3 0-6 2.7-6 6v250H674c-3.3 0-6 2.7-6 6v60c0 3.3 2.7 6 6 6h208c16.6 0 30-13.4 30-30V136c0-3.3-2.7-6-6-6z" } }] }, "name": "delete-column", "theme": "outlined" };
var DeleteColumnOutlined = function DeleteColumnOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: DeleteColumnOutlined$1
  }));
};
var RefIcon$X = /* @__PURE__ */ reactExports.forwardRef(DeleteColumnOutlined);
var DeleteOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z" } }] }, "name": "delete", "theme": "outlined" };
var DeleteOutlined = function DeleteOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: DeleteOutlined$1
  }));
};
var RefIcon$W = /* @__PURE__ */ reactExports.forwardRef(DeleteOutlined);
var DisconnectOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M832.6 191.4c-84.6-84.6-221.5-84.6-306 0l-96.9 96.9 51 51 96.9-96.9c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204l-96.9 96.9 51.1 51.1 96.9-96.9c84.4-84.6 84.4-221.5-.1-306.1zM446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l96.9-96.9-51.1-51.1-96.9 96.9c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l96.9-96.9-51-51-96.8 97zM260.3 209.4a8.03 8.03 0 00-11.3 0L209.4 249a8.03 8.03 0 000 11.3l554.4 554.4c3.1 3.1 8.2 3.1 11.3 0l39.6-39.6c3.1-3.1 3.1-8.2 0-11.3L260.3 209.4z" } }] }, "name": "disconnect", "theme": "outlined" };
var DisconnectOutlined = function DisconnectOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: DisconnectOutlined$1
  }));
};
var RefIcon$V = /* @__PURE__ */ reactExports.forwardRef(DisconnectOutlined);
var DownloadOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z" } }] }, "name": "download", "theme": "outlined" };
var DownloadOutlined = function DownloadOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: DownloadOutlined$1
  }));
};
var RefIcon$U = /* @__PURE__ */ reactExports.forwardRef(DownloadOutlined);
var EditOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z" } }] }, "name": "edit", "theme": "outlined" };
var EditOutlined = function EditOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: EditOutlined$1
  }));
};
var RefIcon$T = /* @__PURE__ */ reactExports.forwardRef(EditOutlined);
var EnterOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 000 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8z" } }] }, "name": "enter", "theme": "outlined" };
var EnterOutlined = function EnterOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: EnterOutlined$1
  }));
};
var RefIcon$S = /* @__PURE__ */ reactExports.forwardRef(EnterOutlined);
var ExclamationCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z" } }] }, "name": "exclamation-circle", "theme": "outlined" };
var ExclamationCircleOutlined = function ExclamationCircleOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: ExclamationCircleOutlined$1
  }));
};
var RefIcon$R = /* @__PURE__ */ reactExports.forwardRef(ExclamationCircleOutlined);
var ExportOutlined$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z" } }] }, "name": "export", "theme": "outlined" };
var ExportOutlined = function ExportOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: ExportOutlined$1
  }));
};
var RefIcon$Q = /* @__PURE__ */ reactExports.forwardRef(ExportOutlined);
var FieldBinaryOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M600 395.4h91V649h79V267c0-4.4-3.6-8-8-8h-48.2c-3.7 0-7 2.6-7.7 6.3-2.6 12.1-6.9 22.3-12.9 30.9a86.14 86.14 0 01-26.3 24.4c-10.3 6.2-22 10.5-35 12.9-10.4 1.9-21 3-32 3.1a8 8 0 00-7.9 8v42.8c0 4.4 3.6 8 8 8zM871 702H567c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM443.9 312.7c-16.1-19-34.4-32.4-55.2-40.4-21.3-8.2-44.1-12.3-68.4-12.3-23.9 0-46.4 4.1-67.7 12.3-20.8 8-39 21.4-54.8 40.3-15.9 19.1-28.7 44.7-38.3 77-9.6 32.5-14.5 73-14.5 121.5 0 49.9 4.9 91.4 14.5 124.4 9.6 32.8 22.4 58.7 38.3 77.7 15.8 18.9 34 32.3 54.8 40.3 21.3 8.2 43.8 12.3 67.7 12.3 24.4 0 47.2-4.1 68.4-12.3 20.8-8 39.2-21.4 55.2-40.4 16.1-19 29-44.9 38.6-77.7 9.6-33 14.5-74.5 14.5-124.4 0-48.4-4.9-88.9-14.5-121.5-9.5-32.1-22.4-57.7-38.6-76.8zm-29.5 251.7c-1 21.4-4.2 42-9.5 61.9-5.5 20.7-14.5 38.5-27 53.4-13.6 16.3-33.2 24.3-57.6 24.3-24 0-43.2-8.1-56.7-24.4-12.2-14.8-21.1-32.6-26.6-53.3-5.3-19.9-8.5-40.6-9.5-61.9-1-20.8-1.5-38.5-1.5-53.2 0-8.8.1-19.4.4-31.8.2-12.7 1.1-25.8 2.6-39.2 1.5-13.6 4-27.1 7.6-40.5 3.7-13.8 8.8-26.3 15.4-37.4 6.9-11.6 15.8-21.1 26.7-28.3 11.4-7.6 25.3-11.3 41.5-11.3 16.1 0 30.1 3.7 41.7 11.2a87.94 87.94 0 0127.4 28.2c6.9 11.2 12.1 23.8 15.6 37.7 3.3 13.2 5.8 26.6 7.5 40.1 1.8 13.5 2.8 26.6 3 39.4.2 12.4.4 23 .4 31.8.1 14.8-.4 32.5-1.4 53.3z" } }] }, "name": "field-binary", "theme": "outlined" };
var FieldBinaryOutlined = function FieldBinaryOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: FieldBinaryOutlined$1
  }));
};
var RefIcon$P = /* @__PURE__ */ reactExports.forwardRef(FieldBinaryOutlined);
var FileAddOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM544 472c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v108H372c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h108v108c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V644h108c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V472z" } }] }, "name": "file-add", "theme": "outlined" };
var FileAddOutlined = function FileAddOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: FileAddOutlined$1
  }));
};
var RefIcon$O = /* @__PURE__ */ reactExports.forwardRef(FileAddOutlined);
var FileOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z" } }] }, "name": "file", "theme": "outlined" };
var FileOutlined = function FileOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: FileOutlined$1
  }));
};
var RefIcon$N = /* @__PURE__ */ reactExports.forwardRef(FileOutlined);
var FileSyncOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M296 256c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm192 200v-48c0-4.4-3.6-8-8-8H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8zm-48 396H208V148h560v344c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h272c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm104.1-115.6c1.8-34.5 16.2-66.8 40.8-91.4 26.2-26.2 62-41 99.1-41 37.4 0 72.6 14.6 99.1 41 3.2 3.2 6.3 6.6 9.2 10.1L769.2 673a8 8 0 003 14.1l93.3 22.5c5 1.2 9.8-2.6 9.9-7.7l.6-95.4a8 8 0 00-12.9-6.4l-20.3 15.8C805.4 569.6 748.1 540 684 540c-109.9 0-199.6 86.9-204 195.7-.2 4.5 3.5 8.3 8 8.3h48.1c4.3 0 7.8-3.3 8-7.6zM880 744h-48.1c-4.3 0-7.8 3.3-8 7.6-1.8 34.5-16.2 66.8-40.8 91.4-26.2 26.2-62 41-99.1 41-37.4 0-72.6-14.6-99.1-41-3.2-3.2-6.3-6.6-9.2-10.1l23.1-17.9a8 8 0 00-3-14.1l-93.3-22.5c-5-1.2-9.8 2.6-9.9 7.7l-.6 95.4a8 8 0 0012.9 6.4l20.3-15.8C562.6 918.4 619.9 948 684 948c109.9 0 199.6-86.9 204-195.7.2-4.5-3.5-8.3-8-8.3z" } }] }, "name": "file-sync", "theme": "outlined" };
var FileSyncOutlined = function FileSyncOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: FileSyncOutlined$1
  }));
};
var RefIcon$M = /* @__PURE__ */ reactExports.forwardRef(FileSyncOutlined);
var FileUnknownOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M854.6 288.7L639.4 73.4c-6-6-14.2-9.4-22.7-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.6-9.4-22.6zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM402 549c0 5.4 4.4 9.5 9.8 9.5h32.4c5.4 0 9.8-4.2 9.8-9.4 0-28.2 25.8-51.6 58-51.6s58 23.4 58 51.5c0 25.3-21 47.2-49.3 50.9-19.3 2.8-34.5 20.3-34.7 40.1v32c0 5.5 4.5 10 10 10h32c5.5 0 10-4.5 10-10v-12.2c0-6 4-11.5 9.7-13.3 44.6-14.4 75-54 74.3-98.9-.8-55.5-49.2-100.8-108.5-101.6-61.4-.7-111.5 45.6-111.5 103zm78 195a32 32 0 1064 0 32 32 0 10-64 0z" } }] }, "name": "file-unknown", "theme": "outlined" };
var FileUnknownOutlined = function FileUnknownOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: FileUnknownOutlined$1
  }));
};
var RefIcon$L = /* @__PURE__ */ reactExports.forwardRef(FileUnknownOutlined);
var FileZipOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M296 392h64v64h-64zm0 190v160h128V582h-64v-62h-64v62zm80 48v64h-32v-64h32zm-16-302h64v64h-64zm-64-64h64v64h-64zm64 192h64v64h-64zm0-256h64v64h-64zm494.6 88.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h64v64h64v-64h174v216a42 42 0 0042 42h216v494z" } }] }, "name": "file-zip", "theme": "outlined" };
var FileZipOutlined = function FileZipOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: FileZipOutlined$1
  }));
};
var RefIcon$K = /* @__PURE__ */ reactExports.forwardRef(FileZipOutlined);
var FilterOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 597.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V597.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.4 798H420.6V642h182.9v156zm9.6-236.6l-9.5 16.6h-183l-9.5-16.6L212.7 226h598.6L613 561.4z" } }] }, "name": "filter", "theme": "outlined" };
var FilterOutlined = function FilterOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: FilterOutlined$1
  }));
};
var RefIcon$J = /* @__PURE__ */ reactExports.forwardRef(FilterOutlined);
var FireOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M834.1 469.2A347.49 347.49 0 00751.2 354l-29.1-26.7a8.09 8.09 0 00-13 3.3l-13 37.3c-8.1 23.4-23 47.3-44.1 70.8-1.4 1.5-3 1.9-4.1 2-1.1.1-2.8-.1-4.3-1.5-1.4-1.2-2.1-3-2-4.8 3.7-60.2-14.3-128.1-53.7-202C555.3 171 510 123.1 453.4 89.7l-41.3-24.3c-5.4-3.2-12.3 1-12 7.3l2.2 48c1.5 32.8-2.3 61.8-11.3 85.9-11 29.5-26.8 56.9-47 81.5a295.64 295.64 0 01-47.5 46.1 352.6 352.6 0 00-100.3 121.5A347.75 347.75 0 00160 610c0 47.2 9.3 92.9 27.7 136a349.4 349.4 0 0075.5 110.9c32.4 32 70 57.2 111.9 74.7C418.5 949.8 464.5 959 512 959s93.5-9.2 136.9-27.3A348.6 348.6 0 00760.8 857c32.4-32 57.8-69.4 75.5-110.9a344.2 344.2 0 0027.7-136c0-48.8-10-96.2-29.9-140.9zM713 808.5c-53.7 53.2-125 82.4-201 82.4s-147.3-29.2-201-82.4c-53.5-53.1-83-123.5-83-198.4 0-43.5 9.8-85.2 29.1-124 18.8-37.9 46.8-71.8 80.8-97.9a349.6 349.6 0 0058.6-56.8c25-30.5 44.6-64.5 58.2-101a240 240 0 0012.1-46.5c24.1 22.2 44.3 49 61.2 80.4 33.4 62.6 48.8 118.3 45.8 165.7a74.01 74.01 0 0024.4 59.8 73.36 73.36 0 0053.4 18.8c19.7-1 37.8-9.7 51-24.4 13.3-14.9 24.8-30.1 34.4-45.6 14 17.9 25.7 37.4 35 58.4 15.9 35.8 24 73.9 24 113.1 0 74.9-29.5 145.4-83 198.4z" } }] }, "name": "fire", "theme": "outlined" };
var FireOutlined = function FireOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: FireOutlined$1
  }));
};
var RefIcon$I = /* @__PURE__ */ reactExports.forwardRef(FireOutlined);
var FolderAddOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M484 443.1V528h-84.5c-4.1 0-7.5 3.1-7.5 7v42c0 3.8 3.4 7 7.5 7H484v84.9c0 3.9 3.2 7.1 7 7.1h42c3.9 0 7-3.2 7-7.1V584h84.5c4.1 0 7.5-3.2 7.5-7v-42c0-3.9-3.4-7-7.5-7H540v-84.9c0-3.9-3.1-7.1-7-7.1h-42c-3.8 0-7 3.2-7 7.1zm396-144.7H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z" } }] }, "name": "folder-add", "theme": "outlined" };
var FolderAddOutlined = function FolderAddOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: FolderAddOutlined$1
  }));
};
var RefIcon$H = /* @__PURE__ */ reactExports.forwardRef(FolderAddOutlined);
var FolderOpenOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 00-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z" } }] }, "name": "folder-open", "theme": "outlined" };
var FolderOpenOutlined = function FolderOpenOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: FolderOpenOutlined$1
  }));
};
var RefIcon$G = /* @__PURE__ */ reactExports.forwardRef(FolderOpenOutlined);
var FolderOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M880 298.4H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z" } }] }, "name": "folder", "theme": "outlined" };
var FolderOutlined = function FolderOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: FolderOutlined$1
  }));
};
var RefIcon$F = /* @__PURE__ */ reactExports.forwardRef(FolderOutlined);
var FullscreenOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M290 236.4l43.9-43.9a8.01 8.01 0 00-4.7-13.6L169 160c-5.1-.6-9.5 3.7-8.9 8.9L179 329.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L370 423.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L290 236.4zm352.7 187.3c3.1 3.1 8.2 3.1 11.3 0l133.7-133.6 43.7 43.7a8.01 8.01 0 0013.6-4.7L863.9 169c.6-5.1-3.7-9.5-8.9-8.9L694.8 179c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L600.3 370a8.03 8.03 0 000 11.3l42.4 42.4zM845 694.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L654 600.3a8.03 8.03 0 00-11.3 0l-42.4 42.3a8.03 8.03 0 000 11.3L734 787.6l-43.9 43.9a8.01 8.01 0 004.7 13.6L855 864c5.1.6 9.5-3.7 8.9-8.9L845 694.9zm-463.7-94.6a8.03 8.03 0 00-11.3 0L236.3 733.9l-43.7-43.7a8.01 8.01 0 00-13.6 4.7L160.1 855c-.6 5.1 3.7 9.5 8.9 8.9L329.2 845c6.6-.8 9.4-8.9 4.7-13.6L290 787.6 423.7 654c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.4z" } }] }, "name": "fullscreen", "theme": "outlined" };
var FullscreenOutlined = function FullscreenOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: FullscreenOutlined$1
  }));
};
var RefIcon$E = /* @__PURE__ */ reactExports.forwardRef(FullscreenOutlined);
var GithubOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M511.6 76.3C264.3 76.2 64 276.4 64 523.5 64 718.9 189.3 885 363.8 946c23.5 5.9 19.9-10.8 19.9-22.2v-77.5c-135.7 15.9-141.2-73.9-150.3-88.9C215 726 171.5 718 184.5 703c30.9-15.9 62.4 4 98.9 57.9 26.4 39.1 77.9 32.5 104 26 5.7-23.5 17.9-44.5 34.7-60.8-140.6-25.2-199.2-111-199.2-213 0-49.5 16.3-95 48.3-131.7-20.4-60.5 1.9-112.3 4.9-120 58.1-5.2 118.5 41.6 123.2 45.3 33-8.9 70.7-13.6 112.9-13.6 42.4 0 80.2 4.9 113.5 13.9 11.3-8.6 67.3-48.8 121.3-43.9 2.9 7.7 24.7 58.3 5.5 118 32.4 36.8 48.9 82.7 48.9 132.3 0 102.2-59 188.1-200 212.9a127.5 127.5 0 0138.1 91v112.5c.8 9 0 17.9 15 17.9 177.1-59.7 304.6-227 304.6-424.1 0-247.2-200.4-447.3-447.5-447.3z" } }] }, "name": "github", "theme": "outlined" };
var GithubOutlined = function GithubOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: GithubOutlined$1
  }));
};
var RefIcon$D = /* @__PURE__ */ reactExports.forwardRef(GithubOutlined);
var GroupOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M912 820.1V203.9c28-9.9 48-36.6 48-67.9 0-39.8-32.2-72-72-72-31.3 0-58 20-67.9 48H203.9C194 84 167.3 64 136 64c-39.8 0-72 32.2-72 72 0 31.3 20 58 48 67.9v616.2C84 830 64 856.7 64 888c0 39.8 32.2 72 72 72 31.3 0 58-20 67.9-48h616.2c9.9 28 36.6 48 67.9 48 39.8 0 72-32.2 72-72 0-31.3-20-58-48-67.9zM888 112c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zM136 912c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24zm0-752c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24zm704 680H184V184h656v656zm48 72c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24z" } }, { "tag": "path", "attrs": { "d": "M288 474h448c8.8 0 16-7.2 16-16V282c0-8.8-7.2-16-16-16H288c-8.8 0-16 7.2-16 16v176c0 8.8 7.2 16 16 16zm56-136h336v64H344v-64zm-56 420h448c8.8 0 16-7.2 16-16V566c0-8.8-7.2-16-16-16H288c-8.8 0-16 7.2-16 16v176c0 8.8 7.2 16 16 16zm56-136h336v64H344v-64z" } }] }, "name": "group", "theme": "outlined" };
var GroupOutlined = function GroupOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: GroupOutlined$1
  }));
};
var RefIcon$C = /* @__PURE__ */ reactExports.forwardRef(GroupOutlined);
var HistoryOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M536.1 273H488c-4.4 0-8 3.6-8 8v275.3c0 2.6 1.2 5 3.3 6.5l165.3 120.7c3.6 2.6 8.6 1.9 11.2-1.7l28.6-39c2.7-3.7 1.9-8.7-1.7-11.2L544.1 528.5V281c0-4.4-3.6-8-8-8zm219.8 75.2l156.8 38.3c5 1.2 9.9-2.6 9.9-7.7l.8-161.5c0-6.7-7.7-10.5-12.9-6.3L752.9 334.1a8 8 0 003 14.1zm167.7 301.1l-56.7-19.5a8 8 0 00-10.1 4.8c-1.9 5.1-3.9 10.1-6 15.1-17.8 42.1-43.3 80-75.9 112.5a353 353 0 01-112.5 75.9 352.18 352.18 0 01-137.7 27.8c-47.8 0-94.1-9.3-137.7-27.8a353 353 0 01-112.5-75.9c-32.5-32.5-58-70.4-75.9-112.5A353.44 353.44 0 01171 512c0-47.8 9.3-94.2 27.8-137.8 17.8-42.1 43.3-80 75.9-112.5a353 353 0 01112.5-75.9C430.6 167.3 477 158 524.8 158s94.1 9.3 137.7 27.8A353 353 0 01775 261.7c10.2 10.3 19.8 21 28.6 32.3l59.8-46.8C784.7 146.6 662.2 81.9 524.6 82 285 82.1 92.6 276.7 95 516.4 97.4 751.9 288.9 942 524.8 942c185.5 0 343.5-117.6 403.7-282.3 1.5-4.2-.7-8.9-4.9-10.4z" } }] }, "name": "history", "theme": "outlined" };
var HistoryOutlined = function HistoryOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: HistoryOutlined$1
  }));
};
var RefIcon$B = /* @__PURE__ */ reactExports.forwardRef(HistoryOutlined);
var HolderOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M300 276.5a56 56 0 1056-97 56 56 0 00-56 97zm0 284a56 56 0 1056-97 56 56 0 00-56 97zM640 228a56 56 0 10112 0 56 56 0 00-112 0zm0 284a56 56 0 10112 0 56 56 0 00-112 0zM300 844.5a56 56 0 1056-97 56 56 0 00-56 97zM640 796a56 56 0 10112 0 56 56 0 00-112 0z" } }] }, "name": "holder", "theme": "outlined" };
var HolderOutlined = function HolderOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: HolderOutlined$1
  }));
};
var RefIcon$A = /* @__PURE__ */ reactExports.forwardRef(HolderOutlined);
var ImportOutlined$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM653.3 424.6l52.2 52.2a8.01 8.01 0 01-4.7 13.6l-179.4 21c-5.1.6-9.5-3.7-8.9-8.9l21-179.4c.8-6.6 8.9-9.4 13.6-4.7l52.4 52.4 256.2-256.2c3.1-3.1 8.2-3.1 11.3 0l42.4 42.4c3.1 3.1 3.1 8.2 0 11.3L653.3 424.6z" } }] }, "name": "import", "theme": "outlined" };
var ImportOutlined = function ImportOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: ImportOutlined$1
  }));
};
var RefIcon$z = /* @__PURE__ */ reactExports.forwardRef(ImportOutlined);
var InfoCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z" } }] }, "name": "info-circle", "theme": "outlined" };
var InfoCircleOutlined = function InfoCircleOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: InfoCircleOutlined$1
  }));
};
var RefIcon$y = /* @__PURE__ */ reactExports.forwardRef(InfoCircleOutlined);
var LinkOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M574 665.4a8.03 8.03 0 00-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 00-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 000 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 000 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 00-11.3 0L372.3 598.7a8.03 8.03 0 000 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z" } }] }, "name": "link", "theme": "outlined" };
var LinkOutlined = function LinkOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: LinkOutlined$1
  }));
};
var RefIcon$x = /* @__PURE__ */ reactExports.forwardRef(LinkOutlined);
var MenuFoldOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 000 13.8z" } }] }, "name": "menu-fold", "theme": "outlined" };
var MenuFoldOutlined = function MenuFoldOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: MenuFoldOutlined$1
  }));
};
var RefIcon$w = /* @__PURE__ */ reactExports.forwardRef(MenuFoldOutlined);
var MenuUnfoldOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM142.4 642.1L298.7 519a8.84 8.84 0 000-13.9L142.4 381.9c-5.8-4.6-14.4-.5-14.4 6.9v246.3a8.9 8.9 0 0014.4 7z" } }] }, "name": "menu-unfold", "theme": "outlined" };
var MenuUnfoldOutlined = function MenuUnfoldOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: MenuUnfoldOutlined$1
  }));
};
var RefIcon$v = /* @__PURE__ */ reactExports.forwardRef(MenuUnfoldOutlined);
var MergeOutlined$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M248 752h72V264h-72z" } }, { "tag": "path", "attrs": { "d": "M740 863c61.86 0 112-50.14 112-112 0-48.33-30.6-89.5-73.5-105.2l-.01-113.04a50.73 50.73 0 00-34.95-48.2l-434.9-142.41-22.4 68.42 420.25 137.61.01 95.92C661 658.34 628 700.8 628 751c0 61.86 50.14 112 112 112m-456 61c61.86 0 112-50.14 112-112s-50.14-112-112-112-112 50.14-112 112 50.14 112 112 112m456-125a48 48 0 110-96 48 48 0 010 96m-456 61a48 48 0 110-96 48 48 0 010 96m0-536c61.86 0 112-50.14 112-112s-50.14-112-112-112-112 50.14-112 112 50.14 112 112 112m0-64a48 48 0 110-96 48 48 0 010 96" } }] }, "name": "merge", "theme": "outlined" };
var MergeOutlined = function MergeOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: MergeOutlined$1
  }));
};
var RefIcon$u = /* @__PURE__ */ reactExports.forwardRef(MergeOutlined);
var MinusSquareOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M328 544h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z" } }, { "tag": "path", "attrs": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z" } }] }, "name": "minus-square", "theme": "outlined" };
var MinusSquareOutlined = function MinusSquareOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: MinusSquareOutlined$1
  }));
};
var RefIcon$t = /* @__PURE__ */ reactExports.forwardRef(MinusSquareOutlined);
var MoonOutlined$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M489.5 111.66c30.65-1.8 45.98 36.44 22.58 56.33A243.35 243.35 0 00426 354c0 134.76 109.24 244 244 244 72.58 0 139.9-31.83 186.01-86.08 19.87-23.38 58.07-8.1 56.34 22.53C900.4 745.82 725.15 912 512.5 912 291.31 912 112 732.69 112 511.5c0-211.39 164.29-386.02 374.2-399.65l.2-.01zm-81.15 79.75l-4.11 1.36C271.1 237.94 176 364.09 176 511.5 176 697.34 326.66 848 512.5 848c148.28 0 274.94-96.2 319.45-230.41l.63-1.93-.11.07a307.06 307.06 0 01-159.73 46.26L670 662c-170.1 0-308-137.9-308-308 0-58.6 16.48-114.54 46.27-162.47z" } }] }, "name": "moon", "theme": "outlined" };
var MoonOutlined = function MoonOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: MoonOutlined$1
  }));
};
var RefIcon$s = /* @__PURE__ */ reactExports.forwardRef(MoonOutlined);
var MoreOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M456 231a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0z" } }] }, "name": "more", "theme": "outlined" };
var MoreOutlined = function MoreOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: MoreOutlined$1
  }));
};
var RefIcon$r = /* @__PURE__ */ reactExports.forwardRef(MoreOutlined);
var PauseCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372zm-88-532h-48c-4.4 0-8 3.6-8 8v304c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V360c0-4.4-3.6-8-8-8zm224 0h-48c-4.4 0-8 3.6-8 8v304c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V360c0-4.4-3.6-8-8-8z" } }] }, "name": "pause-circle", "theme": "outlined" };
var PauseCircleOutlined = function PauseCircleOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: PauseCircleOutlined$1
  }));
};
var RefIcon$q = /* @__PURE__ */ reactExports.forwardRef(PauseCircleOutlined);
var PauseOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M304 176h80v672h-80zm408 0h-64c-4.4 0-8 3.6-8 8v656c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V184c0-4.4-3.6-8-8-8z" } }] }, "name": "pause", "theme": "outlined" };
var PauseOutlined = function PauseOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: PauseOutlined$1
  }));
};
var RefIcon$p = /* @__PURE__ */ reactExports.forwardRef(PauseOutlined);
var PictureOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2zM304 456a88 88 0 100-176 88 88 0 000 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z" } }] }, "name": "picture", "theme": "outlined" };
var PictureOutlined = function PictureOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: PictureOutlined$1
  }));
};
var RefIcon$o = /* @__PURE__ */ reactExports.forwardRef(PictureOutlined);
var PlayCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M719.4 499.1l-296.1-215A15.9 15.9 0 00398 297v430c0 13.1 14.8 20.5 25.3 12.9l296.1-215a15.9 15.9 0 000-25.8zm-257.6 134V390.9L628.5 512 461.8 633.1z" } }] }, "name": "play-circle", "theme": "outlined" };
var PlayCircleOutlined = function PlayCircleOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: PlayCircleOutlined$1
  }));
};
var RefIcon$n = /* @__PURE__ */ reactExports.forwardRef(PlayCircleOutlined);
var PlusCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z" } }, { "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }] }, "name": "plus-circle", "theme": "outlined" };
var PlusCircleOutlined = function PlusCircleOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: PlusCircleOutlined$1
  }));
};
var RefIcon$m = /* @__PURE__ */ reactExports.forwardRef(PlusCircleOutlined);
var PlusSquareOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M328 544h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z" } }, { "tag": "path", "attrs": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z" } }] }, "name": "plus-square", "theme": "outlined" };
var PlusSquareOutlined = function PlusSquareOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: PlusSquareOutlined$1
  }));
};
var RefIcon$l = /* @__PURE__ */ reactExports.forwardRef(PlusSquareOutlined);
var ProductOutlined$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M464 144a16 16 0 0116 16v304a16 16 0 01-16 16H160a16 16 0 01-16-16V160a16 16 0 0116-16zm-52 68H212v200h200zm493.33 87.69a16 16 0 010 22.62L724.31 503.33a16 16 0 01-22.62 0L520.67 322.31a16 16 0 010-22.62l181.02-181.02a16 16 0 0122.62 0zm-84.85 11.3L713 203.53 605.52 311 713 418.48zM464 544a16 16 0 0116 16v304a16 16 0 01-16 16H160a16 16 0 01-16-16V560a16 16 0 0116-16zm-52 68H212v200h200zm452-68a16 16 0 0116 16v304a16 16 0 01-16 16H560a16 16 0 01-16-16V560a16 16 0 0116-16zm-52 68H612v200h200z" } }] }, "name": "product", "theme": "outlined" };
var ProductOutlined = function ProductOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: ProductOutlined$1
  }));
};
var RefIcon$k = /* @__PURE__ */ reactExports.forwardRef(ProductOutlined);
var ProfileOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656zM492 400h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H492c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm0 144h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H492c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm0 144h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H492c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zM340 368a40 40 0 1080 0 40 40 0 10-80 0zm0 144a40 40 0 1080 0 40 40 0 10-80 0zm0 144a40 40 0 1080 0 40 40 0 10-80 0z" } }] }, "name": "profile", "theme": "outlined" };
var ProfileOutlined = function ProfileOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: ProfileOutlined$1
  }));
};
var RefIcon$j = /* @__PURE__ */ reactExports.forwardRef(ProfileOutlined);
var PushpinOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M878.3 392.1L631.9 145.7c-6.5-6.5-15-9.7-23.5-9.7s-17 3.2-23.5 9.7L423.8 306.9c-12.2-1.4-24.5-2-36.8-2-73.2 0-146.4 24.1-206.5 72.3a33.23 33.23 0 00-2.7 49.4l181.7 181.7-215.4 215.2a15.8 15.8 0 00-4.6 9.8l-3.4 37.2c-.9 9.4 6.6 17.4 15.9 17.4.5 0 1 0 1.5-.1l37.2-3.4c3.7-.3 7.2-2 9.8-4.6l215.4-215.4 181.7 181.7c6.5 6.5 15 9.7 23.5 9.7 9.7 0 19.3-4.2 25.9-12.4 56.3-70.3 79.7-158.3 70.2-243.4l161.1-161.1c12.9-12.8 12.9-33.8 0-46.8zM666.2 549.3l-24.5 24.5 3.8 34.4a259.92 259.92 0 01-30.4 153.9L262 408.8c12.9-7.1 26.3-13.1 40.3-17.9 27.2-9.4 55.7-14.1 84.7-14.1 9.6 0 19.3.5 28.9 1.6l34.4 3.8 24.5-24.5L608.5 224 800 415.5 666.2 549.3z" } }] }, "name": "pushpin", "theme": "outlined" };
var PushpinOutlined = function PushpinOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: PushpinOutlined$1
  }));
};
var RefIcon$i = /* @__PURE__ */ reactExports.forwardRef(PushpinOutlined);
var ReloadOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z" } }] }, "name": "reload", "theme": "outlined" };
var ReloadOutlined = function ReloadOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: ReloadOutlined$1
  }));
};
var RefIcon$h = /* @__PURE__ */ reactExports.forwardRef(ReloadOutlined);
var RetweetOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M136 552h63.6c4.4 0 8-3.6 8-8V288.7h528.6v72.6c0 1.9.6 3.7 1.8 5.2a8.3 8.3 0 0011.7 1.4L893 255.4c4.3-5 3.6-10.3 0-13.2L749.7 129.8a8.22 8.22 0 00-5.2-1.8c-4.6 0-8.4 3.8-8.4 8.4V209H199.7c-39.5 0-71.7 32.2-71.7 71.8V544c0 4.4 3.6 8 8 8zm752-80h-63.6c-4.4 0-8 3.6-8 8v255.3H287.8v-72.6c0-1.9-.6-3.7-1.8-5.2a8.3 8.3 0 00-11.7-1.4L131 768.6c-4.3 5-3.6 10.3 0 13.2l143.3 112.4c1.5 1.2 3.3 1.8 5.2 1.8 4.6 0 8.4-3.8 8.4-8.4V815h536.6c39.5 0 71.7-32.2 71.7-71.8V480c-.2-4.4-3.8-8-8.2-8z" } }] }, "name": "retweet", "theme": "outlined" };
var RetweetOutlined = function RetweetOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: RetweetOutlined$1
  }));
};
var RefIcon$g = /* @__PURE__ */ reactExports.forwardRef(RetweetOutlined);
var SendOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2a15.99 15.99 0 00-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-.9 3.7-.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 .7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-.8 4.2-2.6 5-5 1.4-4.2-.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z" } }] }, "name": "send", "theme": "outlined" };
var SendOutlined = function SendOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: SendOutlined$1
  }));
};
var RefIcon$f = /* @__PURE__ */ reactExports.forwardRef(SendOutlined);
var SettingOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z" } }] }, "name": "setting", "theme": "outlined" };
var SettingOutlined = function SettingOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: SettingOutlined$1
  }));
};
var RefIcon$e = /* @__PURE__ */ reactExports.forwardRef(SettingOutlined);
var SisternodeOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M672 432c-120.3 0-219.9 88.5-237.3 204H320c-15.5 0-28-12.5-28-28V244h291c14.2 35.2 48.7 60 89 60 53 0 96-43 96-96s-43-96-96-96c-40.3 0-74.8 24.8-89 60H112v72h108v364c0 55.2 44.8 100 100 100h114.7c17.4 115.5 117 204 237.3 204 132.5 0 240-107.5 240-240S804.5 432 672 432zm128 266c0 4.4-3.6 8-8 8h-86v86c0 4.4-3.6 8-8 8h-52c-4.4 0-8-3.6-8-8v-86h-86c-4.4 0-8-3.6-8-8v-52c0-4.4 3.6-8 8-8h86v-86c0-4.4 3.6-8 8-8h52c4.4 0 8 3.6 8 8v86h86c4.4 0 8 3.6 8 8v52z" } }] }, "name": "sisternode", "theme": "outlined" };
var SisternodeOutlined = function SisternodeOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: SisternodeOutlined$1
  }));
};
var RefIcon$d = /* @__PURE__ */ reactExports.forwardRef(SisternodeOutlined);
var SnippetsOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M832 112H724V72c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v40H500V72c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v40H320c-17.7 0-32 14.3-32 32v120h-96c-17.7 0-32 14.3-32 32v632c0 17.7 14.3 32 32 32h512c17.7 0 32-14.3 32-32v-96h96c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM664 888H232V336h218v174c0 22.1 17.9 40 40 40h174v338zm0-402H514V336h.2L664 485.8v.2zm128 274h-56V456L544 264H360v-80h68v32c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-32h152v32c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-32h68v576z" } }] }, "name": "snippets", "theme": "outlined" };
var SnippetsOutlined = function SnippetsOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: SnippetsOutlined$1
  }));
};
var RefIcon$c = /* @__PURE__ */ reactExports.forwardRef(SnippetsOutlined);
var SortAscendingOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M839.6 433.8L749 150.5a9.24 9.24 0 00-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 00-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 00-9.2-9.3zM416 702h-76V172c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v530h-76c-6.7 0-10.5 7.8-6.3 13l112 141.9a8 8 0 0012.6 0l112-141.9c4.1-5.2.4-13-6.3-13z" } }] }, "name": "sort-ascending", "theme": "outlined" };
var SortAscendingOutlined = function SortAscendingOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: SortAscendingOutlined$1
  }));
};
var RefIcon$b = /* @__PURE__ */ reactExports.forwardRef(SortAscendingOutlined);
var StarFilled$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z" } }] }, "name": "star", "theme": "filled" };
var StarFilled = function StarFilled2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: StarFilled$1
  }));
};
var RefIcon$a = /* @__PURE__ */ reactExports.forwardRef(StarFilled);
var StopOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z" } }] }, "name": "stop", "theme": "outlined" };
var StopOutlined = function StopOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: StopOutlined$1
  }));
};
var RefIcon$9 = /* @__PURE__ */ reactExports.forwardRef(StopOutlined);
var SunOutlined$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M548 818v126a16 16 0 01-16 16h-40a16 16 0 01-16-16V818c15.85 1.64 27.84 2.46 36 2.46 8.15 0 20.16-.82 36-2.46m205.25-115.66l89.1 89.1a16 16 0 010 22.62l-28.29 28.29a16 16 0 01-22.62 0l-89.1-89.1c12.37-10.04 21.43-17.95 27.2-23.71 5.76-5.77 13.67-14.84 23.71-27.2m-482.5 0c10.04 12.36 17.95 21.43 23.71 27.2 5.77 5.76 14.84 13.67 27.2 23.71l-89.1 89.1a16 16 0 01-22.62 0l-28.29-28.29a16 16 0 010-22.63zM512 278c129.24 0 234 104.77 234 234S641.24 746 512 746 278 641.24 278 512s104.77-234 234-234m0 72c-89.47 0-162 72.53-162 162s72.53 162 162 162 162-72.53 162-162-72.53-162-162-162M206 476c-1.64 15.85-2.46 27.84-2.46 36 0 8.15.82 20.16 2.46 36H80a16 16 0 01-16-16v-40a16 16 0 0116-16zm738 0a16 16 0 0116 16v40a16 16 0 01-16 16H818c1.64-15.85 2.46-27.84 2.46-36 0-8.15-.82-20.16-2.46-36zM814.06 180.65l28.29 28.29a16 16 0 010 22.63l-89.1 89.09c-10.04-12.37-17.95-21.43-23.71-27.2-5.77-5.76-14.84-13.67-27.2-23.71l89.1-89.1a16 16 0 0122.62 0m-581.5 0l89.1 89.1c-12.37 10.04-21.43 17.95-27.2 23.71-5.76 5.77-13.67 14.84-23.71 27.2l-89.1-89.1a16 16 0 010-22.62l28.29-28.29a16 16 0 0122.62 0M532 64a16 16 0 0116 16v126c-15.85-1.64-27.84-2.46-36-2.46-8.15 0-20.16.82-36 2.46V80a16 16 0 0116-16z" } }] }, "name": "sun", "theme": "outlined" };
var SunOutlined = function SunOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: SunOutlined$1
  }));
};
var RefIcon$8 = /* @__PURE__ */ reactExports.forwardRef(SunOutlined);
var SyncOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M168 504.2c1-43.7 10-86.1 26.9-126 17.3-41 42.1-77.7 73.7-109.4S337 212.3 378 195c42.4-17.9 87.4-27 133.9-27s91.5 9.1 133.8 27A341.5 341.5 0 01755 268.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.7 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c0-6.7-7.7-10.5-12.9-6.3l-56.4 44.1C765.8 155.1 646.2 92 511.8 92 282.7 92 96.3 275.6 92 503.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8zm756 7.8h-60c-4.4 0-7.9 3.5-8 7.8-1 43.7-10 86.1-26.9 126-17.3 41-42.1 77.8-73.7 109.4A342.45 342.45 0 01512.1 856a342.24 342.24 0 01-243.2-100.8c-9.9-9.9-19.2-20.4-27.8-31.4l60.2-47a8 8 0 00-3-14.1l-175.7-43c-5-1.2-9.9 2.6-9.9 7.7l-.7 181c0 6.7 7.7 10.5 12.9 6.3l56.4-44.1C258.2 868.9 377.8 932 512.2 932c229.2 0 415.5-183.7 419.8-411.8a8 8 0 00-8-8.2z" } }] }, "name": "sync", "theme": "outlined" };
var SyncOutlined = function SyncOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: SyncOutlined$1
  }));
};
var RefIcon$7 = /* @__PURE__ */ reactExports.forwardRef(SyncOutlined);
var ThunderboltOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.2 732.5l60.3-241H281.1l189.6-327.4h224.6L487 427.4h211L378.2 732.5z" } }] }, "name": "thunderbolt", "theme": "outlined" };
var ThunderboltOutlined = function ThunderboltOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: ThunderboltOutlined$1
  }));
};
var RefIcon$6 = /* @__PURE__ */ reactExports.forwardRef(ThunderboltOutlined);
var ToTopOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M885 780H165c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h720c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zM400 325.7h73.9V664c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V325.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 171a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13z" } }] }, "name": "to-top", "theme": "outlined" };
var ToTopOutlined = function ToTopOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: ToTopOutlined$1
  }));
};
var RefIcon$5 = /* @__PURE__ */ reactExports.forwardRef(ToTopOutlined);
var TranslationOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M140 188h584v164h76V144c0-17.7-14.3-32-32-32H96c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h544v-76H140V188z" } }, { "tag": "path", "attrs": { "d": "M414.3 256h-60.6c-3.4 0-6.4 2.2-7.6 5.4L219 629.4c-.3.8-.4 1.7-.4 2.6 0 4.4 3.6 8 8 8h55.1c3.4 0 6.4-2.2 7.6-5.4L322 540h196.2L422 261.4a8.42 8.42 0 00-7.7-5.4zm12.4 228h-85.5L384 360.2 426.7 484zM936 528H800v-93c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v93H592c-13.3 0-24 10.7-24 24v176c0 13.3 10.7 24 24 24h136v152c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V752h136c13.3 0 24-10.7 24-24V552c0-13.3-10.7-24-24-24zM728 680h-88v-80h88v80zm160 0h-88v-80h88v80z" } }] }, "name": "translation", "theme": "outlined" };
var TranslationOutlined = function TranslationOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: TranslationOutlined$1
  }));
};
var RefIcon$4 = /* @__PURE__ */ reactExports.forwardRef(TranslationOutlined);
var UnorderedListOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z" } }] }, "name": "unordered-list", "theme": "outlined" };
var UnorderedListOutlined = function UnorderedListOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: UnorderedListOutlined$1
  }));
};
var RefIcon$3 = /* @__PURE__ */ reactExports.forwardRef(UnorderedListOutlined);
var UploadOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z" } }] }, "name": "upload", "theme": "outlined" };
var UploadOutlined = function UploadOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: UploadOutlined$1
  }));
};
var RefIcon$2 = /* @__PURE__ */ reactExports.forwardRef(UploadOutlined);
var VideoCameraAddOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M368 724H252V608c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v116H72c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h116v116c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V788h116c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z" } }, { "tag": "path", "attrs": { "d": "M912 302.3L784 376V224c0-35.3-28.7-64-64-64H128c-35.3 0-64 28.7-64 64v352h72V232h576v560H448v72h272c35.3 0 64-28.7 64-64V648l128 73.7c21.3 12.3 48-3.1 48-27.6V330c0-24.6-26.7-40-48-27.7zM888 625l-104-59.8V458.9L888 399v226z" } }, { "tag": "path", "attrs": { "d": "M320 360c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H208c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h112z" } }] }, "name": "video-camera-add", "theme": "outlined" };
var VideoCameraAddOutlined = function VideoCameraAddOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: VideoCameraAddOutlined$1
  }));
};
var RefIcon$1 = /* @__PURE__ */ reactExports.forwardRef(VideoCameraAddOutlined);
var WarningOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z" } }] }, "name": "warning", "theme": "outlined" };
var WarningOutlined = function WarningOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$3, _extends$h({}, props, {
    ref,
    icon: WarningOutlined$2
  }));
};
var RefIcon = /* @__PURE__ */ reactExports.forwardRef(WarningOutlined);
const WarningOutlined$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: RefIcon
}, Symbol.toStringTag, { value: "Module" }));
function Star(props, ref) {
  var disabled = props.disabled, prefixCls = props.prefixCls, character2 = props.character, characterRender = props.characterRender, index2 = props.index, count = props.count, value2 = props.value, allowHalf = props.allowHalf, focused = props.focused, onHover = props.onHover, onClick = props.onClick;
  var onInternalHover = function onInternalHover2(e2) {
    onHover(e2, index2);
  };
  var onInternalClick = function onInternalClick2(e2) {
    onClick(e2, index2);
  };
  var onInternalKeyDown = function onInternalKeyDown2(e2) {
    if (e2.keyCode === KeyCode.ENTER) {
      onClick(e2, index2);
    }
  };
  var starValue = index2 + 1;
  var classNameList = /* @__PURE__ */ new Set([prefixCls]);
  if (value2 === 0 && index2 === 0 && focused) {
    classNameList.add("".concat(prefixCls, "-focused"));
  } else if (allowHalf && value2 + 0.5 >= starValue && value2 < starValue) {
    classNameList.add("".concat(prefixCls, "-half"));
    classNameList.add("".concat(prefixCls, "-active"));
    if (focused) {
      classNameList.add("".concat(prefixCls, "-focused"));
    }
  } else {
    if (starValue <= value2) {
      classNameList.add("".concat(prefixCls, "-full"));
    } else {
      classNameList.add("".concat(prefixCls, "-zero"));
    }
    if (starValue === value2 && focused) {
      classNameList.add("".concat(prefixCls, "-focused"));
    }
  }
  var characterNode = typeof character2 === "function" ? character2(props) : character2;
  var start2 = /* @__PURE__ */ React$5.createElement("li", {
    className: classNames(Array.from(classNameList)),
    ref
  }, /* @__PURE__ */ React$5.createElement("div", {
    onClick: disabled ? null : onInternalClick,
    onKeyDown: disabled ? null : onInternalKeyDown,
    onMouseMove: disabled ? null : onInternalHover,
    role: "radio",
    "aria-checked": value2 > index2 ? "true" : "false",
    "aria-posinset": index2 + 1,
    "aria-setsize": count,
    tabIndex: disabled ? -1 : 0
  }, /* @__PURE__ */ React$5.createElement("div", {
    className: "".concat(prefixCls, "-first")
  }, characterNode), /* @__PURE__ */ React$5.createElement("div", {
    className: "".concat(prefixCls, "-second")
  }, characterNode)));
  if (characterRender) {
    start2 = characterRender(start2, props);
  }
  return start2;
}
const Star$1 = /* @__PURE__ */ React$5.forwardRef(Star);
function useRefs() {
  var nodeRef = reactExports.useRef({});
  function getRef(index2) {
    return nodeRef.current[index2];
  }
  function setRef2(index2) {
    return function(node2) {
      nodeRef.current[index2] = node2;
    };
  }
  return [getRef, setRef2];
}
function getScroll(w2) {
  var ret = w2.pageXOffset;
  var method4 = "scrollLeft";
  if (typeof ret !== "number") {
    var d2 = w2.document;
    ret = d2.documentElement[method4];
    if (typeof ret !== "number") {
      ret = d2.body[method4];
    }
  }
  return ret;
}
function getClientPosition(elem) {
  var x2;
  var y2;
  var doc = elem.ownerDocument;
  var body = doc.body;
  var docElem = doc && doc.documentElement;
  var box = elem.getBoundingClientRect();
  x2 = box.left;
  y2 = box.top;
  x2 -= docElem.clientLeft || body.clientLeft || 0;
  y2 -= docElem.clientTop || body.clientTop || 0;
  return {
    left: x2,
    top: y2
  };
}
function getOffsetLeft(el2) {
  var pos = getClientPosition(el2);
  var doc = el2.ownerDocument;
  var w2 = doc.defaultView || doc.parentWindow;
  pos.left += getScroll(w2);
  return pos.left;
}
var _excluded$b = ["prefixCls", "className", "defaultValue", "value", "count", "allowHalf", "allowClear", "keyboard", "character", "characterRender", "disabled", "direction", "tabIndex", "autoFocus", "onHoverChange", "onChange", "onFocus", "onBlur", "onKeyDown", "onMouseLeave"];
function Rate$2(props, ref) {
  var _props$prefixCls = props.prefixCls, prefixCls = _props$prefixCls === void 0 ? "rc-rate" : _props$prefixCls, className = props.className, defaultValue2 = props.defaultValue, propValue = props.value, _props$count = props.count, count = _props$count === void 0 ? 5 : _props$count, _props$allowHalf = props.allowHalf, allowHalf = _props$allowHalf === void 0 ? false : _props$allowHalf, _props$allowClear = props.allowClear, allowClear = _props$allowClear === void 0 ? true : _props$allowClear, _props$keyboard = props.keyboard, keyboard = _props$keyboard === void 0 ? true : _props$keyboard, _props$character = props.character, character2 = _props$character === void 0 ? "★" : _props$character, characterRender = props.characterRender, disabled = props.disabled, _props$direction = props.direction, direction = _props$direction === void 0 ? "ltr" : _props$direction, _props$tabIndex = props.tabIndex, tabIndex = _props$tabIndex === void 0 ? 0 : _props$tabIndex, autoFocus = props.autoFocus, onHoverChange = props.onHoverChange, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, onKeyDown = props.onKeyDown, onMouseLeave = props.onMouseLeave, restProps = _objectWithoutProperties$3(props, _excluded$b);
  var _useRefs = useRefs(), _useRefs2 = _slicedToArray(_useRefs, 2), getStarRef = _useRefs2[0], setStarRef = _useRefs2[1];
  var rateRef = React$5.useRef(null);
  var triggerFocus = function triggerFocus2() {
    if (!disabled) {
      var _rateRef$current;
      (_rateRef$current = rateRef.current) === null || _rateRef$current === void 0 || _rateRef$current.focus();
    }
  };
  React$5.useImperativeHandle(ref, function() {
    return {
      focus: triggerFocus,
      blur: function blur() {
        if (!disabled) {
          var _rateRef$current2;
          (_rateRef$current2 = rateRef.current) === null || _rateRef$current2 === void 0 || _rateRef$current2.blur();
        }
      }
    };
  });
  var _useMergedState = useMergedState(defaultValue2 || 0, {
    value: propValue
  }), _useMergedState2 = _slicedToArray(_useMergedState, 2), value2 = _useMergedState2[0], setValue = _useMergedState2[1];
  var _useMergedState3 = useMergedState(null), _useMergedState4 = _slicedToArray(_useMergedState3, 2), cleanedValue = _useMergedState4[0], setCleanedValue = _useMergedState4[1];
  var getStarValue = function getStarValue2(index2, x2) {
    var reverse = direction === "rtl";
    var starValue = index2 + 1;
    if (allowHalf) {
      var starEle = getStarRef(index2);
      var leftDis = getOffsetLeft(starEle);
      var width = starEle.clientWidth;
      if (reverse && x2 - leftDis > width / 2) {
        starValue -= 0.5;
      } else if (!reverse && x2 - leftDis < width / 2) {
        starValue -= 0.5;
      }
    }
    return starValue;
  };
  var changeValue = function changeValue2(nextValue) {
    setValue(nextValue);
    onChange === null || onChange === void 0 || onChange(nextValue);
  };
  var _React$useState = React$5.useState(false), _React$useState2 = _slicedToArray(_React$useState, 2), focused = _React$useState2[0], setFocused = _React$useState2[1];
  var onInternalFocus = function onInternalFocus2() {
    setFocused(true);
    onFocus === null || onFocus === void 0 || onFocus();
  };
  var onInternalBlur = function onInternalBlur2() {
    setFocused(false);
    onBlur === null || onBlur === void 0 || onBlur();
  };
  var _React$useState3 = React$5.useState(null), _React$useState4 = _slicedToArray(_React$useState3, 2), hoverValue = _React$useState4[0], setHoverValue = _React$useState4[1];
  var onHover = function onHover2(event, index2) {
    var nextHoverValue = getStarValue(index2, event.pageX);
    if (nextHoverValue !== cleanedValue) {
      setHoverValue(nextHoverValue);
      setCleanedValue(null);
    }
    onHoverChange === null || onHoverChange === void 0 || onHoverChange(nextHoverValue);
  };
  var onMouseLeaveCallback = function onMouseLeaveCallback2(event) {
    if (!disabled) {
      setHoverValue(null);
      setCleanedValue(null);
      onHoverChange === null || onHoverChange === void 0 || onHoverChange(void 0);
    }
    if (event) {
      onMouseLeave === null || onMouseLeave === void 0 || onMouseLeave(event);
    }
  };
  var onClick = function onClick2(event, index2) {
    var newValue = getStarValue(index2, event.pageX);
    var isReset = false;
    if (allowClear) {
      isReset = newValue === value2;
    }
    onMouseLeaveCallback();
    changeValue(isReset ? 0 : newValue);
    setCleanedValue(isReset ? newValue : null);
  };
  var onInternalKeyDown = function onInternalKeyDown2(event) {
    var keyCode = event.keyCode;
    var reverse = direction === "rtl";
    var step = allowHalf ? 0.5 : 1;
    if (keyboard) {
      if (keyCode === KeyCode.RIGHT && value2 < count && !reverse) {
        changeValue(value2 + step);
        event.preventDefault();
      } else if (keyCode === KeyCode.LEFT && value2 > 0 && !reverse) {
        changeValue(value2 - step);
        event.preventDefault();
      } else if (keyCode === KeyCode.RIGHT && value2 > 0 && reverse) {
        changeValue(value2 - step);
        event.preventDefault();
      } else if (keyCode === KeyCode.LEFT && value2 < count && reverse) {
        changeValue(value2 + step);
        event.preventDefault();
      }
    }
    onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
  };
  React$5.useEffect(function() {
    if (autoFocus && !disabled) {
      triggerFocus();
    }
  }, []);
  var starNodes = new Array(count).fill(0).map(function(item, index2) {
    return /* @__PURE__ */ React$5.createElement(Star$1, {
      ref: setStarRef(index2),
      index: index2,
      count,
      disabled,
      prefixCls: "".concat(prefixCls, "-star"),
      allowHalf,
      value: hoverValue === null ? value2 : hoverValue,
      onClick,
      onHover,
      key: item || index2,
      character: character2,
      characterRender,
      focused
    });
  });
  var classString = classNames(prefixCls, className, _defineProperty$3(_defineProperty$3({}, "".concat(prefixCls, "-disabled"), disabled), "".concat(prefixCls, "-rtl"), direction === "rtl"));
  return /* @__PURE__ */ React$5.createElement("ul", _extends$h({
    className: classString,
    onMouseLeave: onMouseLeaveCallback,
    tabIndex: disabled ? -1 : tabIndex,
    onFocus: disabled ? null : onInternalFocus,
    onBlur: disabled ? null : onInternalBlur,
    onKeyDown: disabled ? null : onInternalKeyDown,
    ref: rateRef
  }, pickAttrs(restProps, {
    aria: true,
    data: true,
    attr: true
  })), starNodes);
}
const Rate$3 = /* @__PURE__ */ React$5.forwardRef(Rate$2);
const genRateStarStyle = (token2) => {
  const {
    componentCls
  } = token2;
  return {
    [`${componentCls}-star`]: {
      position: "relative",
      display: "inline-block",
      color: "inherit",
      cursor: "pointer",
      "&:not(:last-child)": {
        marginInlineEnd: token2.marginXS
      },
      "> div": {
        transition: `all ${token2.motionDurationMid}, outline 0s`,
        "&:hover": {
          transform: token2.starHoverScale
        },
        "&:focus": {
          outline: 0
        },
        "&:focus-visible": {
          outline: `${unit$1(token2.lineWidth)} dashed ${token2.starColor}`,
          transform: token2.starHoverScale
        }
      },
      "&-first, &-second": {
        color: token2.starBg,
        transition: `all ${token2.motionDurationMid}`,
        userSelect: "none"
      },
      "&-first": {
        position: "absolute",
        top: 0,
        insetInlineStart: 0,
        width: "50%",
        height: "100%",
        overflow: "hidden",
        opacity: 0
      },
      [`&-half ${componentCls}-star-first, &-half ${componentCls}-star-second`]: {
        opacity: 1
      },
      [`&-half ${componentCls}-star-first, &-full ${componentCls}-star-second`]: {
        color: "inherit"
      }
    }
  };
};
const genRateRtlStyle = (token2) => ({
  [`&-rtl${token2.componentCls}`]: {
    direction: "rtl"
  }
});
const genRateStyle = (token2) => {
  const {
    componentCls
  } = token2;
  return {
    [componentCls]: Object.assign(Object.assign(Object.assign(Object.assign({}, resetComponent(token2)), {
      display: "inline-block",
      margin: 0,
      padding: 0,
      color: token2.starColor,
      fontSize: token2.starSize,
      lineHeight: 1,
      listStyle: "none",
      outline: "none",
      // disable styles
      [`&-disabled${componentCls} ${componentCls}-star`]: {
        cursor: "default",
        "> div:hover": {
          transform: "scale(1)"
        }
      }
    }), genRateStarStyle(token2)), genRateRtlStyle(token2))
  };
};
const prepareComponentToken$1 = (token2) => ({
  starColor: token2.yellow6,
  starSize: token2.controlHeightLG * 0.5,
  starHoverScale: "scale(1.1)",
  starBg: token2.colorFillContent
});
const useStyle$1 = genStyleHooks("Rate", (token2) => {
  const rateToken = merge$4(token2, {});
  return [genRateStyle(rateToken)];
}, prepareComponentToken$1);
var __rest$2 = function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
};
const Rate$1 = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
  const {
    prefixCls,
    className,
    rootClassName,
    style: style2,
    tooltips,
    character: character2 = /* @__PURE__ */ reactExports.createElement(RefIcon$a, null),
    disabled: customDisabled
  } = props, rest = __rest$2(props, ["prefixCls", "className", "rootClassName", "style", "tooltips", "character", "disabled"]);
  const characterRender = (node2, {
    index: index2
  }) => {
    if (!tooltips) {
      return node2;
    }
    return /* @__PURE__ */ reactExports.createElement(Tooltip$2, {
      title: tooltips[index2]
    }, node2);
  };
  const {
    getPrefixCls,
    direction,
    rate
  } = reactExports.useContext(ConfigContext);
  const ratePrefixCls = getPrefixCls("rate", prefixCls);
  const [wrapCSSVar, hashId, cssVarCls] = useStyle$1(ratePrefixCls);
  const mergedStyle = Object.assign(Object.assign({}, rate === null || rate === void 0 ? void 0 : rate.style), style2);
  const disabled = reactExports.useContext(DisabledContext);
  const mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;
  return wrapCSSVar(/* @__PURE__ */ reactExports.createElement(Rate$3, Object.assign({
    ref,
    character: character2,
    characterRender,
    disabled: mergedDisabled
  }, rest, {
    className: classNames(className, rootClassName, hashId, cssVarCls, rate === null || rate === void 0 ? void 0 : rate.className),
    style: mergedStyle,
    prefixCls: ratePrefixCls,
    direction
  })));
});
var TreeContext = /* @__PURE__ */ reactExports.createContext(null);
var UnstableContext = /* @__PURE__ */ reactExports.createContext({});
var Indent = function Indent2(_ref) {
  var prefixCls = _ref.prefixCls, level = _ref.level, isStart = _ref.isStart, isEnd = _ref.isEnd;
  var baseClassName = "".concat(prefixCls, "-indent-unit");
  var list2 = [];
  for (var i2 = 0; i2 < level; i2 += 1) {
    list2.push(/* @__PURE__ */ reactExports.createElement("span", {
      key: i2,
      className: classNames(baseClassName, _defineProperty$3(_defineProperty$3({}, "".concat(baseClassName, "-start"), isStart[i2]), "".concat(baseClassName, "-end"), isEnd[i2]))
    }));
  }
  return /* @__PURE__ */ reactExports.createElement("span", {
    "aria-hidden": "true",
    className: "".concat(prefixCls, "-indent")
  }, list2);
};
const Indent$1 = /* @__PURE__ */ reactExports.memo(Indent);
var _excluded$a = ["eventKey", "className", "style", "dragOver", "dragOverGapTop", "dragOverGapBottom", "isLeaf", "isStart", "isEnd", "expanded", "selected", "checked", "halfChecked", "loading", "domRef", "active", "data", "onMouseMove", "selectable"];
var ICON_OPEN = "open";
var ICON_CLOSE = "close";
var defaultTitle = "---";
var TreeNode = function TreeNode2(props) {
  var _unstableContext$node, _context$filterTreeNo, _classNames4;
  var eventKey = props.eventKey, className = props.className, style2 = props.style, dragOver = props.dragOver, dragOverGapTop = props.dragOverGapTop, dragOverGapBottom = props.dragOverGapBottom, isLeaf = props.isLeaf, isStart = props.isStart, isEnd = props.isEnd, expanded = props.expanded, selected = props.selected, checked = props.checked, halfChecked = props.halfChecked, loading = props.loading, domRef = props.domRef, active3 = props.active, data = props.data, onMouseMove = props.onMouseMove, selectable = props.selectable, otherProps = _objectWithoutProperties$3(props, _excluded$a);
  var context = React$5.useContext(TreeContext);
  var unstableContext = React$5.useContext(UnstableContext);
  var selectHandleRef = React$5.useRef(null);
  var _React$useState = React$5.useState(false), _React$useState2 = _slicedToArray(_React$useState, 2), dragNodeHighlight = _React$useState2[0], setDragNodeHighlight = _React$useState2[1];
  var isDisabled = !!(context.disabled || props.disabled || (_unstableContext$node = unstableContext.nodeDisabled) !== null && _unstableContext$node !== void 0 && _unstableContext$node.call(unstableContext, data));
  var isCheckable = React$5.useMemo(function() {
    if (!context.checkable || props.checkable === false) {
      return false;
    }
    return context.checkable;
  }, [context.checkable, props.checkable]);
  var onSelect = function onSelect2(e2) {
    if (isDisabled) {
      return;
    }
    context.onNodeSelect(e2, convertNodePropsToEventData(props));
  };
  var onCheck = function onCheck2(e2) {
    if (isDisabled) {
      return;
    }
    if (!isCheckable || props.disableCheckbox) {
      return;
    }
    context.onNodeCheck(e2, convertNodePropsToEventData(props), !checked);
  };
  var isSelectable = React$5.useMemo(function() {
    if (typeof selectable === "boolean") {
      return selectable;
    }
    return context.selectable;
  }, [selectable, context.selectable]);
  var onSelectorClick = function onSelectorClick2(e2) {
    context.onNodeClick(e2, convertNodePropsToEventData(props));
    if (isSelectable) {
      onSelect(e2);
    } else {
      onCheck(e2);
    }
  };
  var onSelectorDoubleClick = function onSelectorDoubleClick2(e2) {
    context.onNodeDoubleClick(e2, convertNodePropsToEventData(props));
  };
  var onMouseEnter = function onMouseEnter2(e2) {
    context.onNodeMouseEnter(e2, convertNodePropsToEventData(props));
  };
  var onMouseLeave = function onMouseLeave2(e2) {
    context.onNodeMouseLeave(e2, convertNodePropsToEventData(props));
  };
  var onContextMenu = function onContextMenu2(e2) {
    context.onNodeContextMenu(e2, convertNodePropsToEventData(props));
  };
  var isDraggable = React$5.useMemo(function() {
    return !!(context.draggable && (!context.draggable.nodeDraggable || context.draggable.nodeDraggable(data)));
  }, [context.draggable, data]);
  var onDragStart = function onDragStart2(e2) {
    e2.stopPropagation();
    setDragNodeHighlight(true);
    context.onNodeDragStart(e2, props);
    try {
      e2.dataTransfer.setData("text/plain", "");
    } catch (_unused) {
    }
  };
  var onDragEnter = function onDragEnter2(e2) {
    e2.preventDefault();
    e2.stopPropagation();
    context.onNodeDragEnter(e2, props);
  };
  var onDragOver = function onDragOver2(e2) {
    e2.preventDefault();
    e2.stopPropagation();
    context.onNodeDragOver(e2, props);
  };
  var onDragLeave = function onDragLeave2(e2) {
    e2.stopPropagation();
    context.onNodeDragLeave(e2, props);
  };
  var onDragEnd = function onDragEnd2(e2) {
    e2.stopPropagation();
    setDragNodeHighlight(false);
    context.onNodeDragEnd(e2, props);
  };
  var onDrop = function onDrop2(e2) {
    e2.preventDefault();
    e2.stopPropagation();
    setDragNodeHighlight(false);
    context.onNodeDrop(e2, props);
  };
  var onExpand = function onExpand2(e2) {
    if (loading) {
      return;
    }
    context.onNodeExpand(e2, convertNodePropsToEventData(props));
  };
  var hasChildren2 = React$5.useMemo(function() {
    var _ref = getEntity(context.keyEntities, eventKey) || {}, children = _ref.children;
    return Boolean((children || []).length);
  }, [context.keyEntities, eventKey]);
  var memoizedIsLeaf = React$5.useMemo(function() {
    if (isLeaf === false) {
      return false;
    }
    return isLeaf || !context.loadData && !hasChildren2 || context.loadData && props.loaded && !hasChildren2;
  }, [isLeaf, context.loadData, hasChildren2, props.loaded]);
  React$5.useEffect(function() {
    if (loading) {
      return;
    }
    if (typeof context.loadData === "function" && expanded && !memoizedIsLeaf && !props.loaded) {
      context.onNodeLoad(convertNodePropsToEventData(props));
    }
  }, [loading, context.loadData, context.onNodeLoad, expanded, memoizedIsLeaf, props]);
  var dragHandlerNode = React$5.useMemo(function() {
    var _context$draggable;
    if (!((_context$draggable = context.draggable) !== null && _context$draggable !== void 0 && _context$draggable.icon)) {
      return null;
    }
    return /* @__PURE__ */ React$5.createElement("span", {
      className: "".concat(context.prefixCls, "-draggable-icon")
    }, context.draggable.icon);
  }, [context.draggable]);
  var renderSwitcherIconDom = function renderSwitcherIconDom2(isInternalLeaf) {
    var switcherIcon = props.switcherIcon || context.switcherIcon;
    if (typeof switcherIcon === "function") {
      return switcherIcon(_objectSpread2(_objectSpread2({}, props), {}, {
        isLeaf: isInternalLeaf
      }));
    }
    return switcherIcon;
  };
  var renderSwitcher = function renderSwitcher2() {
    if (memoizedIsLeaf) {
      var _switcherIconDom = renderSwitcherIconDom(true);
      return _switcherIconDom !== false ? /* @__PURE__ */ React$5.createElement("span", {
        className: classNames("".concat(context.prefixCls, "-switcher"), "".concat(context.prefixCls, "-switcher-noop"))
      }, _switcherIconDom) : null;
    }
    var switcherIconDom = renderSwitcherIconDom(false);
    return switcherIconDom !== false ? /* @__PURE__ */ React$5.createElement("span", {
      onClick: onExpand,
      className: classNames("".concat(context.prefixCls, "-switcher"), "".concat(context.prefixCls, "-switcher_").concat(expanded ? ICON_OPEN : ICON_CLOSE))
    }, switcherIconDom) : null;
  };
  var checkboxNode = React$5.useMemo(function() {
    if (!isCheckable) {
      return null;
    }
    var $custom = typeof isCheckable !== "boolean" ? isCheckable : null;
    return /* @__PURE__ */ React$5.createElement("span", {
      className: classNames("".concat(context.prefixCls, "-checkbox"), _defineProperty$3(_defineProperty$3(_defineProperty$3({}, "".concat(context.prefixCls, "-checkbox-checked"), checked), "".concat(context.prefixCls, "-checkbox-indeterminate"), !checked && halfChecked), "".concat(context.prefixCls, "-checkbox-disabled"), isDisabled || props.disableCheckbox)),
      onClick: onCheck,
      role: "checkbox",
      "aria-checked": halfChecked ? "mixed" : checked,
      "aria-disabled": isDisabled || props.disableCheckbox,
      "aria-label": "Select ".concat(typeof props.title === "string" ? props.title : "tree node")
    }, $custom);
  }, [isCheckable, checked, halfChecked, isDisabled, props.disableCheckbox, props.title]);
  var nodeState = React$5.useMemo(function() {
    if (memoizedIsLeaf) {
      return null;
    }
    return expanded ? ICON_OPEN : ICON_CLOSE;
  }, [memoizedIsLeaf, expanded]);
  var iconNode = React$5.useMemo(function() {
    return /* @__PURE__ */ React$5.createElement("span", {
      className: classNames("".concat(context.prefixCls, "-iconEle"), "".concat(context.prefixCls, "-icon__").concat(nodeState || "docu"), _defineProperty$3({}, "".concat(context.prefixCls, "-icon_loading"), loading))
    });
  }, [context.prefixCls, nodeState, loading]);
  var dropIndicatorNode = React$5.useMemo(function() {
    var rootDraggable = Boolean(context.draggable);
    var showIndicator = !props.disabled && rootDraggable && context.dragOverNodeKey === eventKey;
    if (!showIndicator) {
      return null;
    }
    return context.dropIndicatorRender({
      dropPosition: context.dropPosition,
      dropLevelOffset: context.dropLevelOffset,
      indent: context.indent,
      prefixCls: context.prefixCls,
      direction: context.direction
    });
  }, [context.dropPosition, context.dropLevelOffset, context.indent, context.prefixCls, context.direction, context.draggable, context.dragOverNodeKey, context.dropIndicatorRender]);
  var selectorNode = React$5.useMemo(function() {
    var _props$title = props.title, title = _props$title === void 0 ? defaultTitle : _props$title;
    var wrapClass = "".concat(context.prefixCls, "-node-content-wrapper");
    var $icon;
    if (context.showIcon) {
      var currentIcon = props.icon || context.icon;
      $icon = currentIcon ? /* @__PURE__ */ React$5.createElement("span", {
        className: classNames("".concat(context.prefixCls, "-iconEle"), "".concat(context.prefixCls, "-icon__customize"))
      }, typeof currentIcon === "function" ? currentIcon(props) : currentIcon) : iconNode;
    } else if (context.loadData && loading) {
      $icon = iconNode;
    }
    var titleNode;
    if (typeof title === "function") {
      titleNode = title(data);
    } else if (context.titleRender) {
      titleNode = context.titleRender(data);
    } else {
      titleNode = title;
    }
    return /* @__PURE__ */ React$5.createElement("span", {
      ref: selectHandleRef,
      title: typeof title === "string" ? title : "",
      className: classNames(wrapClass, "".concat(wrapClass, "-").concat(nodeState || "normal"), _defineProperty$3({}, "".concat(context.prefixCls, "-node-selected"), !isDisabled && (selected || dragNodeHighlight))),
      onMouseEnter,
      onMouseLeave,
      onContextMenu,
      onClick: onSelectorClick,
      onDoubleClick: onSelectorDoubleClick
    }, $icon, /* @__PURE__ */ React$5.createElement("span", {
      className: "".concat(context.prefixCls, "-title")
    }, titleNode), dropIndicatorNode);
  }, [context.prefixCls, context.showIcon, props, context.icon, iconNode, context.titleRender, data, nodeState, onMouseEnter, onMouseLeave, onContextMenu, onSelectorClick, onSelectorDoubleClick]);
  var dataOrAriaAttributeProps = pickAttrs(otherProps, {
    aria: true,
    data: true
  });
  var _ref2 = getEntity(context.keyEntities, eventKey) || {}, level = _ref2.level;
  var isEndNode = isEnd[isEnd.length - 1];
  var draggableWithoutDisabled = !isDisabled && isDraggable;
  var dragging = context.draggingNodeKey === eventKey;
  var ariaSelected = selectable !== void 0 ? {
    "aria-selected": !!selectable
  } : void 0;
  return /* @__PURE__ */ React$5.createElement("div", _extends$h({
    ref: domRef,
    role: "treeitem",
    "aria-expanded": isLeaf ? void 0 : expanded,
    className: classNames(className, "".concat(context.prefixCls, "-treenode"), (_classNames4 = {}, _defineProperty$3(_defineProperty$3(_defineProperty$3(_defineProperty$3(_defineProperty$3(_defineProperty$3(_defineProperty$3(_defineProperty$3(_defineProperty$3(_defineProperty$3(_classNames4, "".concat(context.prefixCls, "-treenode-disabled"), isDisabled), "".concat(context.prefixCls, "-treenode-switcher-").concat(expanded ? "open" : "close"), !isLeaf), "".concat(context.prefixCls, "-treenode-checkbox-checked"), checked), "".concat(context.prefixCls, "-treenode-checkbox-indeterminate"), halfChecked), "".concat(context.prefixCls, "-treenode-selected"), selected), "".concat(context.prefixCls, "-treenode-loading"), loading), "".concat(context.prefixCls, "-treenode-active"), active3), "".concat(context.prefixCls, "-treenode-leaf-last"), isEndNode), "".concat(context.prefixCls, "-treenode-draggable"), isDraggable), "dragging", dragging), _defineProperty$3(_defineProperty$3(_defineProperty$3(_defineProperty$3(_defineProperty$3(_defineProperty$3(_defineProperty$3(_classNames4, "drop-target", context.dropTargetKey === eventKey), "drop-container", context.dropContainerKey === eventKey), "drag-over", !isDisabled && dragOver), "drag-over-gap-top", !isDisabled && dragOverGapTop), "drag-over-gap-bottom", !isDisabled && dragOverGapBottom), "filter-node", (_context$filterTreeNo = context.filterTreeNode) === null || _context$filterTreeNo === void 0 ? void 0 : _context$filterTreeNo.call(context, convertNodePropsToEventData(props))), "".concat(context.prefixCls, "-treenode-leaf"), memoizedIsLeaf))),
    style: style2,
    draggable: draggableWithoutDisabled,
    onDragStart: draggableWithoutDisabled ? onDragStart : void 0,
    onDragEnter: isDraggable ? onDragEnter : void 0,
    onDragOver: isDraggable ? onDragOver : void 0,
    onDragLeave: isDraggable ? onDragLeave : void 0,
    onDrop: isDraggable ? onDrop : void 0,
    onDragEnd: isDraggable ? onDragEnd : void 0,
    onMouseMove
  }, ariaSelected, dataOrAriaAttributeProps), /* @__PURE__ */ React$5.createElement(Indent$1, {
    prefixCls: context.prefixCls,
    level,
    isStart,
    isEnd
  }), dragHandlerNode, renderSwitcher(), checkboxNode, selectorNode);
};
TreeNode.isTreeNode = 1;
function arrDel(list2, value2) {
  if (!list2)
    return [];
  var clone3 = list2.slice();
  var index2 = clone3.indexOf(value2);
  if (index2 >= 0) {
    clone3.splice(index2, 1);
  }
  return clone3;
}
function arrAdd(list2, value2) {
  var clone3 = (list2 || []).slice();
  if (clone3.indexOf(value2) === -1) {
    clone3.push(value2);
  }
  return clone3;
}
function posToArr(pos) {
  return pos.split("-");
}
function getDragChildrenKeys(dragNodeKey, keyEntities) {
  var dragChildrenKeys = [];
  var entity = getEntity(keyEntities, dragNodeKey);
  function dig() {
    var list2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
    list2.forEach(function(_ref) {
      var key = _ref.key, children = _ref.children;
      dragChildrenKeys.push(key);
      dig(children);
    });
  }
  dig(entity.children);
  return dragChildrenKeys;
}
function isLastChild(treeNodeEntity) {
  if (treeNodeEntity.parent) {
    var posArr = posToArr(treeNodeEntity.pos);
    return Number(posArr[posArr.length - 1]) === treeNodeEntity.parent.children.length - 1;
  }
  return false;
}
function isFirstChild(treeNodeEntity) {
  var posArr = posToArr(treeNodeEntity.pos);
  return Number(posArr[posArr.length - 1]) === 0;
}
function calcDropPosition(event, dragNodeProps, targetNodeProps, indent, startMousePosition, allowDrop2, flattenedNodes, keyEntities, expandKeys, direction) {
  var _abstractDropNodeEnti;
  var clientX = event.clientX, clientY = event.clientY;
  var _getBoundingClientRec = event.target.getBoundingClientRect(), top2 = _getBoundingClientRec.top, height = _getBoundingClientRec.height;
  var horizontalMouseOffset = (direction === "rtl" ? -1 : 1) * (((startMousePosition === null || startMousePosition === void 0 ? void 0 : startMousePosition.x) || 0) - clientX);
  var rawDropLevelOffset = (horizontalMouseOffset - 12) / indent;
  var filteredExpandKeys = expandKeys.filter(function(key) {
    var _keyEntities$key;
    return (_keyEntities$key = keyEntities[key]) === null || _keyEntities$key === void 0 || (_keyEntities$key = _keyEntities$key.children) === null || _keyEntities$key === void 0 ? void 0 : _keyEntities$key.length;
  });
  var abstractDropNodeEntity = getEntity(keyEntities, targetNodeProps.eventKey);
  if (clientY < top2 + height / 2) {
    var nodeIndex = flattenedNodes.findIndex(function(flattenedNode) {
      return flattenedNode.key === abstractDropNodeEntity.key;
    });
    var prevNodeIndex = nodeIndex <= 0 ? 0 : nodeIndex - 1;
    var prevNodeKey = flattenedNodes[prevNodeIndex].key;
    abstractDropNodeEntity = getEntity(keyEntities, prevNodeKey);
  }
  var initialAbstractDropNodeKey = abstractDropNodeEntity.key;
  var abstractDragOverEntity = abstractDropNodeEntity;
  var dragOverNodeKey = abstractDropNodeEntity.key;
  var dropPosition = 0;
  var dropLevelOffset = 0;
  if (!filteredExpandKeys.includes(initialAbstractDropNodeKey)) {
    for (var i2 = 0; i2 < rawDropLevelOffset; i2 += 1) {
      if (isLastChild(abstractDropNodeEntity)) {
        abstractDropNodeEntity = abstractDropNodeEntity.parent;
        dropLevelOffset += 1;
      } else {
        break;
      }
    }
  }
  var abstractDragDataNode = dragNodeProps.data;
  var abstractDropDataNode = abstractDropNodeEntity.node;
  var dropAllowed = true;
  if (isFirstChild(abstractDropNodeEntity) && abstractDropNodeEntity.level === 0 && clientY < top2 + height / 2 && allowDrop2({
    dragNode: abstractDragDataNode,
    dropNode: abstractDropDataNode,
    dropPosition: -1
  }) && abstractDropNodeEntity.key === targetNodeProps.eventKey) {
    dropPosition = -1;
  } else if ((abstractDragOverEntity.children || []).length && filteredExpandKeys.includes(dragOverNodeKey)) {
    if (allowDrop2({
      dragNode: abstractDragDataNode,
      dropNode: abstractDropDataNode,
      dropPosition: 0
    })) {
      dropPosition = 0;
    } else {
      dropAllowed = false;
    }
  } else if (dropLevelOffset === 0) {
    if (rawDropLevelOffset > -1.5) {
      if (allowDrop2({
        dragNode: abstractDragDataNode,
        dropNode: abstractDropDataNode,
        dropPosition: 1
      })) {
        dropPosition = 1;
      } else {
        dropAllowed = false;
      }
    } else {
      if (allowDrop2({
        dragNode: abstractDragDataNode,
        dropNode: abstractDropDataNode,
        dropPosition: 0
      })) {
        dropPosition = 0;
      } else if (allowDrop2({
        dragNode: abstractDragDataNode,
        dropNode: abstractDropDataNode,
        dropPosition: 1
      })) {
        dropPosition = 1;
      } else {
        dropAllowed = false;
      }
    }
  } else {
    if (allowDrop2({
      dragNode: abstractDragDataNode,
      dropNode: abstractDropDataNode,
      dropPosition: 1
    })) {
      dropPosition = 1;
    } else {
      dropAllowed = false;
    }
  }
  return {
    dropPosition,
    dropLevelOffset,
    dropTargetKey: abstractDropNodeEntity.key,
    dropTargetPos: abstractDropNodeEntity.pos,
    dragOverNodeKey,
    dropContainerKey: dropPosition === 0 ? null : ((_abstractDropNodeEnti = abstractDropNodeEntity.parent) === null || _abstractDropNodeEnti === void 0 ? void 0 : _abstractDropNodeEnti.key) || null,
    dropAllowed
  };
}
function calcSelectedKeys(selectedKeys, props) {
  if (!selectedKeys)
    return void 0;
  var multiple = props.multiple;
  if (multiple) {
    return selectedKeys.slice();
  }
  if (selectedKeys.length) {
    return [selectedKeys[0]];
  }
  return selectedKeys;
}
function parseCheckedKeys(keys2) {
  if (!keys2) {
    return null;
  }
  var keyProps;
  if (Array.isArray(keys2)) {
    keyProps = {
      checkedKeys: keys2,
      halfCheckedKeys: void 0
    };
  } else if (_typeof$1(keys2) === "object") {
    keyProps = {
      checkedKeys: keys2.checked || void 0,
      halfCheckedKeys: keys2.halfChecked || void 0
    };
  } else {
    warningOnce(false, "`checkedKeys` is not an array or an object");
    return null;
  }
  return keyProps;
}
function conductExpandParent(keyList, keyEntities) {
  var expandedKeys = /* @__PURE__ */ new Set();
  function conductUp(key) {
    if (expandedKeys.has(key))
      return;
    var entity = getEntity(keyEntities, key);
    if (!entity)
      return;
    expandedKeys.add(key);
    var parent = entity.parent, node2 = entity.node;
    if (node2.disabled)
      return;
    if (parent) {
      conductUp(parent.key);
    }
  }
  (keyList || []).forEach(function(key) {
    conductUp(key);
  });
  return _toConsumableArray(expandedKeys);
}
var DropIndicator = function DropIndicator2(props) {
  var dropPosition = props.dropPosition, dropLevelOffset = props.dropLevelOffset, indent = props.indent;
  var style2 = {
    pointerEvents: "none",
    position: "absolute",
    right: 0,
    backgroundColor: "red",
    height: 2
  };
  switch (dropPosition) {
    case -1:
      style2.top = 0;
      style2.left = -dropLevelOffset * indent;
      break;
    case 1:
      style2.bottom = 0;
      style2.left = -dropLevelOffset * indent;
      break;
    case 0:
      style2.bottom = 0;
      style2.left = indent;
      break;
  }
  return /* @__PURE__ */ React$5.createElement("div", {
    style: style2
  });
};
function _objectDestructuringEmpty(t2) {
  if (null == t2)
    throw new TypeError("Cannot destructure " + t2);
}
function useUnmount(triggerStart, triggerEnd) {
  var _React$useState = reactExports.useState(false), _React$useState2 = _slicedToArray(_React$useState, 2), firstMount = _React$useState2[0], setFirstMount = _React$useState2[1];
  useLayoutEffect(function() {
    if (firstMount) {
      triggerStart();
      return function() {
        triggerEnd();
      };
    }
  }, [firstMount]);
  useLayoutEffect(function() {
    setFirstMount(true);
    return function() {
      setFirstMount(false);
    };
  }, []);
}
var _excluded$9 = ["className", "style", "motion", "motionNodes", "motionType", "onMotionStart", "onMotionEnd", "active", "treeNodeRequiredProps"];
var MotionTreeNode = /* @__PURE__ */ reactExports.forwardRef(function(oriProps, ref) {
  var className = oriProps.className, style2 = oriProps.style, motion = oriProps.motion, motionNodes = oriProps.motionNodes, motionType = oriProps.motionType, onOriginMotionStart = oriProps.onMotionStart, onOriginMotionEnd = oriProps.onMotionEnd, active3 = oriProps.active, treeNodeRequiredProps = oriProps.treeNodeRequiredProps, props = _objectWithoutProperties$3(oriProps, _excluded$9);
  var _React$useState = reactExports.useState(true), _React$useState2 = _slicedToArray(_React$useState, 2), visible = _React$useState2[0], setVisible = _React$useState2[1];
  var _React$useContext = reactExports.useContext(TreeContext), prefixCls = _React$useContext.prefixCls;
  var targetVisible = motionNodes && motionType !== "hide";
  useLayoutEffect(function() {
    if (motionNodes) {
      if (targetVisible !== visible) {
        setVisible(targetVisible);
      }
    }
  }, [motionNodes]);
  var triggerMotionStart = function triggerMotionStart2() {
    if (motionNodes) {
      onOriginMotionStart();
    }
  };
  var triggerMotionEndRef = reactExports.useRef(false);
  var triggerMotionEnd = function triggerMotionEnd2() {
    if (motionNodes && !triggerMotionEndRef.current) {
      triggerMotionEndRef.current = true;
      onOriginMotionEnd();
    }
  };
  useUnmount(triggerMotionStart, triggerMotionEnd);
  var onVisibleChanged = function onVisibleChanged2(nextVisible) {
    if (targetVisible === nextVisible) {
      triggerMotionEnd();
    }
  };
  if (motionNodes) {
    return /* @__PURE__ */ reactExports.createElement(CSSMotion, _extends$h({
      ref,
      visible
    }, motion, {
      motionAppear: motionType === "show",
      onVisibleChanged
    }), function(_ref, motionRef) {
      var motionClassName = _ref.className, motionStyle = _ref.style;
      return /* @__PURE__ */ reactExports.createElement("div", {
        ref: motionRef,
        className: classNames("".concat(prefixCls, "-treenode-motion"), motionClassName),
        style: motionStyle
      }, motionNodes.map(function(treeNode) {
        var restProps = Object.assign({}, (_objectDestructuringEmpty(treeNode.data), treeNode.data)), title = treeNode.title, key = treeNode.key, isStart = treeNode.isStart, isEnd = treeNode.isEnd;
        delete restProps.children;
        var treeNodeProps = getTreeNodeProps(key, treeNodeRequiredProps);
        return /* @__PURE__ */ reactExports.createElement(TreeNode, _extends$h({}, restProps, treeNodeProps, {
          title,
          active: active3,
          data: treeNode.data,
          key,
          isStart,
          isEnd
        }));
      }));
    });
  }
  return /* @__PURE__ */ reactExports.createElement(TreeNode, _extends$h({
    domRef: ref,
    className,
    style: style2
  }, props, {
    active: active3
  }));
});
function findExpandedKeys() {
  var prev2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
  var next2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
  var prevLen = prev2.length;
  var nextLen = next2.length;
  if (Math.abs(prevLen - nextLen) !== 1) {
    return {
      add: false,
      key: null
    };
  }
  function find2(shorter, longer) {
    var cache2 = /* @__PURE__ */ new Map();
    shorter.forEach(function(key) {
      cache2.set(key, true);
    });
    var keys2 = longer.filter(function(key) {
      return !cache2.has(key);
    });
    return keys2.length === 1 ? keys2[0] : null;
  }
  if (prevLen < nextLen) {
    return {
      add: true,
      key: find2(prev2, next2)
    };
  }
  return {
    add: false,
    key: find2(next2, prev2)
  };
}
function getExpandRange(shorter, longer, key) {
  var shorterStartIndex = shorter.findIndex(function(data) {
    return data.key === key;
  });
  var shorterEndNode = shorter[shorterStartIndex + 1];
  var longerStartIndex = longer.findIndex(function(data) {
    return data.key === key;
  });
  if (shorterEndNode) {
    var longerEndIndex = longer.findIndex(function(data) {
      return data.key === shorterEndNode.key;
    });
    return longer.slice(longerStartIndex + 1, longerEndIndex);
  }
  return longer.slice(longerStartIndex + 1);
}
var _excluded$8 = ["prefixCls", "data", "selectable", "checkable", "expandedKeys", "selectedKeys", "checkedKeys", "loadedKeys", "loadingKeys", "halfCheckedKeys", "keyEntities", "disabled", "dragging", "dragOverNodeKey", "dropPosition", "motion", "height", "itemHeight", "virtual", "scrollWidth", "focusable", "activeItem", "focused", "tabIndex", "onKeyDown", "onFocus", "onBlur", "onActiveChange", "onListChangeStart", "onListChangeEnd"];
var HIDDEN_STYLE = {
  width: 0,
  height: 0,
  display: "flex",
  overflow: "hidden",
  opacity: 0,
  border: 0,
  padding: 0,
  margin: 0
};
var noop$5 = function noop2() {
};
var MOTION_KEY = "RC_TREE_MOTION_".concat(Math.random());
var MotionNode = {
  key: MOTION_KEY
};
var MotionEntity = {
  key: MOTION_KEY,
  level: 0,
  index: 0,
  pos: "0",
  node: MotionNode,
  nodes: [MotionNode]
};
var MotionFlattenData = {
  parent: null,
  children: [],
  pos: MotionEntity.pos,
  data: MotionNode,
  title: null,
  key: MOTION_KEY,
  /** Hold empty list here since we do not use it */
  isStart: [],
  isEnd: []
};
function getMinimumRangeTransitionRange(list2, virtual, height, itemHeight) {
  if (virtual === false || !height) {
    return list2;
  }
  return list2.slice(0, Math.ceil(height / itemHeight) + 1);
}
function itemKey(item) {
  var key = item.key, pos = item.pos;
  return getKey2(key, pos);
}
function getAccessibilityPath(item) {
  var path = String(item.data.key);
  var current = item;
  while (current.parent) {
    current = current.parent;
    path = "".concat(current.data.key, " > ").concat(path);
  }
  return path;
}
var NodeList = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var prefixCls = props.prefixCls, data = props.data;
  props.selectable;
  props.checkable;
  var expandedKeys = props.expandedKeys, selectedKeys = props.selectedKeys, checkedKeys = props.checkedKeys, loadedKeys = props.loadedKeys, loadingKeys = props.loadingKeys, halfCheckedKeys = props.halfCheckedKeys, keyEntities = props.keyEntities, disabled = props.disabled, dragging = props.dragging, dragOverNodeKey = props.dragOverNodeKey, dropPosition = props.dropPosition, motion = props.motion, height = props.height, itemHeight = props.itemHeight, virtual = props.virtual, scrollWidth = props.scrollWidth, focusable2 = props.focusable, activeItem = props.activeItem, focused = props.focused, tabIndex = props.tabIndex, onKeyDown = props.onKeyDown, onFocus = props.onFocus, onBlur = props.onBlur, onActiveChange = props.onActiveChange, onListChangeStart = props.onListChangeStart, onListChangeEnd = props.onListChangeEnd, domProps = _objectWithoutProperties$3(props, _excluded$8);
  var listRef = reactExports.useRef(null);
  var indentMeasurerRef = reactExports.useRef(null);
  reactExports.useImperativeHandle(ref, function() {
    return {
      scrollTo: function scrollTo(scroll) {
        listRef.current.scrollTo(scroll);
      },
      getIndentWidth: function getIndentWidth() {
        return indentMeasurerRef.current.offsetWidth;
      }
    };
  });
  var _React$useState = reactExports.useState(expandedKeys), _React$useState2 = _slicedToArray(_React$useState, 2), prevExpandedKeys = _React$useState2[0], setPrevExpandedKeys = _React$useState2[1];
  var _React$useState3 = reactExports.useState(data), _React$useState4 = _slicedToArray(_React$useState3, 2), prevData = _React$useState4[0], setPrevData = _React$useState4[1];
  var _React$useState5 = reactExports.useState(data), _React$useState6 = _slicedToArray(_React$useState5, 2), transitionData = _React$useState6[0], setTransitionData = _React$useState6[1];
  var _React$useState7 = reactExports.useState([]), _React$useState8 = _slicedToArray(_React$useState7, 2), transitionRange = _React$useState8[0], setTransitionRange = _React$useState8[1];
  var _React$useState9 = reactExports.useState(null), _React$useState10 = _slicedToArray(_React$useState9, 2), motionType = _React$useState10[0], setMotionType = _React$useState10[1];
  var dataRef = reactExports.useRef(data);
  dataRef.current = data;
  function onMotionEnd() {
    var latestData = dataRef.current;
    setPrevData(latestData);
    setTransitionData(latestData);
    setTransitionRange([]);
    setMotionType(null);
    onListChangeEnd();
  }
  useLayoutEffect(function() {
    setPrevExpandedKeys(expandedKeys);
    var diffExpanded = findExpandedKeys(prevExpandedKeys, expandedKeys);
    if (diffExpanded.key !== null) {
      if (diffExpanded.add) {
        var keyIndex = prevData.findIndex(function(_ref) {
          var key = _ref.key;
          return key === diffExpanded.key;
        });
        var rangeNodes = getMinimumRangeTransitionRange(getExpandRange(prevData, data, diffExpanded.key), virtual, height, itemHeight);
        var newTransitionData = prevData.slice();
        newTransitionData.splice(keyIndex + 1, 0, MotionFlattenData);
        setTransitionData(newTransitionData);
        setTransitionRange(rangeNodes);
        setMotionType("show");
      } else {
        var _keyIndex = data.findIndex(function(_ref2) {
          var key = _ref2.key;
          return key === diffExpanded.key;
        });
        var _rangeNodes = getMinimumRangeTransitionRange(getExpandRange(data, prevData, diffExpanded.key), virtual, height, itemHeight);
        var _newTransitionData = data.slice();
        _newTransitionData.splice(_keyIndex + 1, 0, MotionFlattenData);
        setTransitionData(_newTransitionData);
        setTransitionRange(_rangeNodes);
        setMotionType("hide");
      }
    } else if (prevData !== data) {
      setPrevData(data);
      setTransitionData(data);
    }
  }, [expandedKeys, data]);
  reactExports.useEffect(function() {
    if (!dragging) {
      onMotionEnd();
    }
  }, [dragging]);
  var mergedData = motion ? transitionData : data;
  var treeNodeRequiredProps = {
    expandedKeys,
    selectedKeys,
    loadedKeys,
    loadingKeys,
    checkedKeys,
    halfCheckedKeys,
    dragOverNodeKey,
    dropPosition,
    keyEntities
  };
  return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, focused && activeItem && /* @__PURE__ */ reactExports.createElement("span", {
    style: HIDDEN_STYLE,
    "aria-live": "assertive"
  }, getAccessibilityPath(activeItem)), /* @__PURE__ */ reactExports.createElement("div", null, /* @__PURE__ */ reactExports.createElement("input", {
    style: HIDDEN_STYLE,
    disabled: focusable2 === false || disabled,
    tabIndex: focusable2 !== false ? tabIndex : null,
    onKeyDown,
    onFocus,
    onBlur,
    value: "",
    onChange: noop$5,
    "aria-label": "for screen reader"
  })), /* @__PURE__ */ reactExports.createElement("div", {
    className: "".concat(prefixCls, "-treenode"),
    "aria-hidden": true,
    style: {
      position: "absolute",
      pointerEvents: "none",
      visibility: "hidden",
      height: 0,
      overflow: "hidden",
      border: 0,
      padding: 0
    }
  }, /* @__PURE__ */ reactExports.createElement("div", {
    className: "".concat(prefixCls, "-indent")
  }, /* @__PURE__ */ reactExports.createElement("div", {
    ref: indentMeasurerRef,
    className: "".concat(prefixCls, "-indent-unit")
  }))), /* @__PURE__ */ reactExports.createElement(List$2, _extends$h({}, domProps, {
    data: mergedData,
    itemKey,
    height,
    fullHeight: false,
    virtual,
    itemHeight,
    scrollWidth,
    prefixCls: "".concat(prefixCls, "-list"),
    ref: listRef,
    role: "tree",
    onVisibleChange: function onVisibleChange(originList) {
      if (originList.every(function(item) {
        return itemKey(item) !== MOTION_KEY;
      })) {
        onMotionEnd();
      }
    }
  }), function(treeNode) {
    var pos = treeNode.pos, restProps = Object.assign({}, (_objectDestructuringEmpty(treeNode.data), treeNode.data)), title = treeNode.title, key = treeNode.key, isStart = treeNode.isStart, isEnd = treeNode.isEnd;
    var mergedKey = getKey2(key, pos);
    delete restProps.key;
    delete restProps.children;
    var treeNodeProps = getTreeNodeProps(mergedKey, treeNodeRequiredProps);
    return /* @__PURE__ */ reactExports.createElement(MotionTreeNode, _extends$h({}, restProps, treeNodeProps, {
      title,
      active: !!activeItem && key === activeItem.key,
      pos,
      data: treeNode.data,
      isStart,
      isEnd,
      motion,
      motionNodes: key === MOTION_KEY ? transitionRange : null,
      motionType,
      onMotionStart: onListChangeStart,
      onMotionEnd,
      treeNodeRequiredProps,
      onMouseMove: function onMouseMove() {
        onActiveChange(null);
      }
    }));
  }));
});
var MAX_RETRY_TIMES = 10;
var Tree$3 = /* @__PURE__ */ function(_React$Component) {
  _inherits$a(Tree2, _React$Component);
  var _super = _createSuper$4(Tree2);
  function Tree2() {
    var _this;
    _classCallCheck$a(this, Tree2);
    for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
      _args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(_args));
    _defineProperty$3(_assertThisInitialized(_this), "destroyed", false);
    _defineProperty$3(_assertThisInitialized(_this), "delayedDragEnterLogic", void 0);
    _defineProperty$3(_assertThisInitialized(_this), "loadingRetryTimes", {});
    _defineProperty$3(_assertThisInitialized(_this), "state", {
      keyEntities: {},
      indent: null,
      selectedKeys: [],
      checkedKeys: [],
      halfCheckedKeys: [],
      loadedKeys: [],
      loadingKeys: [],
      expandedKeys: [],
      draggingNodeKey: null,
      dragChildrenKeys: [],
      // dropTargetKey is the key of abstract-drop-node
      // the abstract-drop-node is the real drop node when drag and drop
      // not the DOM drag over node
      dropTargetKey: null,
      dropPosition: null,
      // the drop position of abstract-drop-node, inside 0, top -1, bottom 1
      dropContainerKey: null,
      // the container key of abstract-drop-node if dropPosition is -1 or 1
      dropLevelOffset: null,
      // the drop level offset of abstract-drag-over-node
      dropTargetPos: null,
      // the pos of abstract-drop-node
      dropAllowed: true,
      // if drop to abstract-drop-node is allowed
      // the abstract-drag-over-node
      // if mouse is on the bottom of top dom node or no the top of the bottom dom node
      // abstract-drag-over-node is the top node
      dragOverNodeKey: null,
      treeData: [],
      flattenNodes: [],
      focused: false,
      activeKey: null,
      listChanging: false,
      prevProps: null,
      fieldNames: fillFieldNames()
    });
    _defineProperty$3(_assertThisInitialized(_this), "dragStartMousePosition", null);
    _defineProperty$3(_assertThisInitialized(_this), "dragNodeProps", null);
    _defineProperty$3(_assertThisInitialized(_this), "currentMouseOverDroppableNodeKey", null);
    _defineProperty$3(_assertThisInitialized(_this), "listRef", /* @__PURE__ */ reactExports.createRef());
    _defineProperty$3(_assertThisInitialized(_this), "onNodeDragStart", function(event, nodeProps) {
      var _this$state = _this.state, expandedKeys = _this$state.expandedKeys, keyEntities = _this$state.keyEntities;
      var onDragStart = _this.props.onDragStart;
      var eventKey = nodeProps.eventKey;
      _this.dragNodeProps = nodeProps;
      _this.dragStartMousePosition = {
        x: event.clientX,
        y: event.clientY
      };
      var newExpandedKeys = arrDel(expandedKeys, eventKey);
      _this.setState({
        draggingNodeKey: eventKey,
        dragChildrenKeys: getDragChildrenKeys(eventKey, keyEntities),
        indent: _this.listRef.current.getIndentWidth()
      });
      _this.setExpandedKeys(newExpandedKeys);
      window.addEventListener("dragend", _this.onWindowDragEnd);
      onDragStart === null || onDragStart === void 0 || onDragStart({
        event,
        node: convertNodePropsToEventData(nodeProps)
      });
    });
    _defineProperty$3(_assertThisInitialized(_this), "onNodeDragEnter", function(event, nodeProps) {
      var _this$state2 = _this.state, expandedKeys = _this$state2.expandedKeys, keyEntities = _this$state2.keyEntities, dragChildrenKeys = _this$state2.dragChildrenKeys, flattenNodes = _this$state2.flattenNodes, indent = _this$state2.indent;
      var _this$props = _this.props, onDragEnter = _this$props.onDragEnter, onExpand = _this$props.onExpand, allowDrop2 = _this$props.allowDrop, direction = _this$props.direction;
      var pos = nodeProps.pos, eventKey = nodeProps.eventKey;
      if (_this.currentMouseOverDroppableNodeKey !== eventKey) {
        _this.currentMouseOverDroppableNodeKey = eventKey;
      }
      if (!_this.dragNodeProps) {
        _this.resetDragState();
        return;
      }
      var _calcDropPosition = calcDropPosition(event, _this.dragNodeProps, nodeProps, indent, _this.dragStartMousePosition, allowDrop2, flattenNodes, keyEntities, expandedKeys, direction), dropPosition = _calcDropPosition.dropPosition, dropLevelOffset = _calcDropPosition.dropLevelOffset, dropTargetKey = _calcDropPosition.dropTargetKey, dropContainerKey = _calcDropPosition.dropContainerKey, dropTargetPos = _calcDropPosition.dropTargetPos, dropAllowed = _calcDropPosition.dropAllowed, dragOverNodeKey = _calcDropPosition.dragOverNodeKey;
      if (
        // don't allow drop inside its children
        dragChildrenKeys.includes(dropTargetKey) || // don't allow drop when drop is not allowed caculated by calcDropPosition
        !dropAllowed
      ) {
        _this.resetDragState();
        return;
      }
      if (!_this.delayedDragEnterLogic) {
        _this.delayedDragEnterLogic = {};
      }
      Object.keys(_this.delayedDragEnterLogic).forEach(function(key) {
        clearTimeout(_this.delayedDragEnterLogic[key]);
      });
      if (_this.dragNodeProps.eventKey !== nodeProps.eventKey) {
        event.persist();
        _this.delayedDragEnterLogic[pos] = window.setTimeout(function() {
          if (_this.state.draggingNodeKey === null) {
            return;
          }
          var newExpandedKeys = _toConsumableArray(expandedKeys);
          var entity = getEntity(keyEntities, nodeProps.eventKey);
          if (entity && (entity.children || []).length) {
            newExpandedKeys = arrAdd(expandedKeys, nodeProps.eventKey);
          }
          if (!_this.props.hasOwnProperty("expandedKeys")) {
            _this.setExpandedKeys(newExpandedKeys);
          }
          onExpand === null || onExpand === void 0 || onExpand(newExpandedKeys, {
            node: convertNodePropsToEventData(nodeProps),
            expanded: true,
            nativeEvent: event.nativeEvent
          });
        }, 800);
      }
      if (_this.dragNodeProps.eventKey === dropTargetKey && dropLevelOffset === 0) {
        _this.resetDragState();
        return;
      }
      _this.setState({
        dragOverNodeKey,
        dropPosition,
        dropLevelOffset,
        dropTargetKey,
        dropContainerKey,
        dropTargetPos,
        dropAllowed
      });
      onDragEnter === null || onDragEnter === void 0 || onDragEnter({
        event,
        node: convertNodePropsToEventData(nodeProps),
        expandedKeys
      });
    });
    _defineProperty$3(_assertThisInitialized(_this), "onNodeDragOver", function(event, nodeProps) {
      var _this$state3 = _this.state, dragChildrenKeys = _this$state3.dragChildrenKeys, flattenNodes = _this$state3.flattenNodes, keyEntities = _this$state3.keyEntities, expandedKeys = _this$state3.expandedKeys, indent = _this$state3.indent;
      var _this$props2 = _this.props, onDragOver = _this$props2.onDragOver, allowDrop2 = _this$props2.allowDrop, direction = _this$props2.direction;
      if (!_this.dragNodeProps) {
        return;
      }
      var _calcDropPosition2 = calcDropPosition(event, _this.dragNodeProps, nodeProps, indent, _this.dragStartMousePosition, allowDrop2, flattenNodes, keyEntities, expandedKeys, direction), dropPosition = _calcDropPosition2.dropPosition, dropLevelOffset = _calcDropPosition2.dropLevelOffset, dropTargetKey = _calcDropPosition2.dropTargetKey, dropContainerKey = _calcDropPosition2.dropContainerKey, dropTargetPos = _calcDropPosition2.dropTargetPos, dropAllowed = _calcDropPosition2.dropAllowed, dragOverNodeKey = _calcDropPosition2.dragOverNodeKey;
      if (dragChildrenKeys.includes(dropTargetKey) || !dropAllowed) {
        return;
      }
      if (_this.dragNodeProps.eventKey === dropTargetKey && dropLevelOffset === 0) {
        if (!(_this.state.dropPosition === null && _this.state.dropLevelOffset === null && _this.state.dropTargetKey === null && _this.state.dropContainerKey === null && _this.state.dropTargetPos === null && _this.state.dropAllowed === false && _this.state.dragOverNodeKey === null)) {
          _this.resetDragState();
        }
      } else if (!(dropPosition === _this.state.dropPosition && dropLevelOffset === _this.state.dropLevelOffset && dropTargetKey === _this.state.dropTargetKey && dropContainerKey === _this.state.dropContainerKey && dropTargetPos === _this.state.dropTargetPos && dropAllowed === _this.state.dropAllowed && dragOverNodeKey === _this.state.dragOverNodeKey)) {
        _this.setState({
          dropPosition,
          dropLevelOffset,
          dropTargetKey,
          dropContainerKey,
          dropTargetPos,
          dropAllowed,
          dragOverNodeKey
        });
      }
      onDragOver === null || onDragOver === void 0 || onDragOver({
        event,
        node: convertNodePropsToEventData(nodeProps)
      });
    });
    _defineProperty$3(_assertThisInitialized(_this), "onNodeDragLeave", function(event, nodeProps) {
      if (_this.currentMouseOverDroppableNodeKey === nodeProps.eventKey && !event.currentTarget.contains(event.relatedTarget)) {
        _this.resetDragState();
        _this.currentMouseOverDroppableNodeKey = null;
      }
      var onDragLeave = _this.props.onDragLeave;
      onDragLeave === null || onDragLeave === void 0 || onDragLeave({
        event,
        node: convertNodePropsToEventData(nodeProps)
      });
    });
    _defineProperty$3(_assertThisInitialized(_this), "onWindowDragEnd", function(event) {
      _this.onNodeDragEnd(event, null, true);
      window.removeEventListener("dragend", _this.onWindowDragEnd);
    });
    _defineProperty$3(_assertThisInitialized(_this), "onNodeDragEnd", function(event, nodeProps) {
      var onDragEnd = _this.props.onDragEnd;
      _this.setState({
        dragOverNodeKey: null
      });
      _this.cleanDragState();
      onDragEnd === null || onDragEnd === void 0 || onDragEnd({
        event,
        node: convertNodePropsToEventData(nodeProps)
      });
      _this.dragNodeProps = null;
      window.removeEventListener("dragend", _this.onWindowDragEnd);
    });
    _defineProperty$3(_assertThisInitialized(_this), "onNodeDrop", function(event, _24) {
      var _this$getActiveItem;
      var outsideTree = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
      var _this$state4 = _this.state, dragChildrenKeys = _this$state4.dragChildrenKeys, dropPosition = _this$state4.dropPosition, dropTargetKey = _this$state4.dropTargetKey, dropTargetPos = _this$state4.dropTargetPos, dropAllowed = _this$state4.dropAllowed;
      if (!dropAllowed) {
        return;
      }
      var onDrop = _this.props.onDrop;
      _this.setState({
        dragOverNodeKey: null
      });
      _this.cleanDragState();
      if (dropTargetKey === null)
        return;
      var abstractDropNodeProps = _objectSpread2(_objectSpread2({}, getTreeNodeProps(dropTargetKey, _this.getTreeNodeRequiredProps())), {}, {
        active: ((_this$getActiveItem = _this.getActiveItem()) === null || _this$getActiveItem === void 0 ? void 0 : _this$getActiveItem.key) === dropTargetKey,
        data: getEntity(_this.state.keyEntities, dropTargetKey).node
      });
      var dropToChild = dragChildrenKeys.includes(dropTargetKey);
      warningOnce(!dropToChild, "Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");
      var posArr = posToArr(dropTargetPos);
      var dropResult = {
        event,
        node: convertNodePropsToEventData(abstractDropNodeProps),
        dragNode: _this.dragNodeProps ? convertNodePropsToEventData(_this.dragNodeProps) : null,
        dragNodesKeys: [_this.dragNodeProps.eventKey].concat(dragChildrenKeys),
        dropToGap: dropPosition !== 0,
        dropPosition: dropPosition + Number(posArr[posArr.length - 1])
      };
      if (!outsideTree) {
        onDrop === null || onDrop === void 0 || onDrop(dropResult);
      }
      _this.dragNodeProps = null;
    });
    _defineProperty$3(_assertThisInitialized(_this), "cleanDragState", function() {
      var draggingNodeKey = _this.state.draggingNodeKey;
      if (draggingNodeKey !== null) {
        _this.setState({
          draggingNodeKey: null,
          dropPosition: null,
          dropContainerKey: null,
          dropTargetKey: null,
          dropLevelOffset: null,
          dropAllowed: true,
          dragOverNodeKey: null
        });
      }
      _this.dragStartMousePosition = null;
      _this.currentMouseOverDroppableNodeKey = null;
    });
    _defineProperty$3(_assertThisInitialized(_this), "triggerExpandActionExpand", function(e2, treeNode) {
      var _this$state5 = _this.state, expandedKeys = _this$state5.expandedKeys, flattenNodes = _this$state5.flattenNodes;
      var expanded = treeNode.expanded, key = treeNode.key, isLeaf = treeNode.isLeaf;
      if (isLeaf || e2.shiftKey || e2.metaKey || e2.ctrlKey) {
        return;
      }
      var node2 = flattenNodes.filter(function(nodeItem) {
        return nodeItem.key === key;
      })[0];
      var eventNode = convertNodePropsToEventData(_objectSpread2(_objectSpread2({}, getTreeNodeProps(key, _this.getTreeNodeRequiredProps())), {}, {
        data: node2.data
      }));
      _this.setExpandedKeys(expanded ? arrDel(expandedKeys, key) : arrAdd(expandedKeys, key));
      _this.onNodeExpand(e2, eventNode);
    });
    _defineProperty$3(_assertThisInitialized(_this), "onNodeClick", function(e2, treeNode) {
      var _this$props3 = _this.props, onClick = _this$props3.onClick, expandAction = _this$props3.expandAction;
      if (expandAction === "click") {
        _this.triggerExpandActionExpand(e2, treeNode);
      }
      onClick === null || onClick === void 0 || onClick(e2, treeNode);
    });
    _defineProperty$3(_assertThisInitialized(_this), "onNodeDoubleClick", function(e2, treeNode) {
      var _this$props4 = _this.props, onDoubleClick = _this$props4.onDoubleClick, expandAction = _this$props4.expandAction;
      if (expandAction === "doubleClick") {
        _this.triggerExpandActionExpand(e2, treeNode);
      }
      onDoubleClick === null || onDoubleClick === void 0 || onDoubleClick(e2, treeNode);
    });
    _defineProperty$3(_assertThisInitialized(_this), "onNodeSelect", function(e2, treeNode) {
      var selectedKeys = _this.state.selectedKeys;
      var _this$state6 = _this.state, keyEntities = _this$state6.keyEntities, fieldNames = _this$state6.fieldNames;
      var _this$props5 = _this.props, onSelect = _this$props5.onSelect, multiple = _this$props5.multiple;
      var selected = treeNode.selected;
      var key = treeNode[fieldNames.key];
      var targetSelected = !selected;
      if (!targetSelected) {
        selectedKeys = arrDel(selectedKeys, key);
      } else if (!multiple) {
        selectedKeys = [key];
      } else {
        selectedKeys = arrAdd(selectedKeys, key);
      }
      var selectedNodes = selectedKeys.map(function(selectedKey) {
        var entity = getEntity(keyEntities, selectedKey);
        return entity ? entity.node : null;
      }).filter(Boolean);
      _this.setUncontrolledState({
        selectedKeys
      });
      onSelect === null || onSelect === void 0 || onSelect(selectedKeys, {
        event: "select",
        selected: targetSelected,
        node: treeNode,
        selectedNodes,
        nativeEvent: e2.nativeEvent
      });
    });
    _defineProperty$3(_assertThisInitialized(_this), "onNodeCheck", function(e2, treeNode, checked) {
      var _this$state7 = _this.state, keyEntities = _this$state7.keyEntities, oriCheckedKeys = _this$state7.checkedKeys, oriHalfCheckedKeys = _this$state7.halfCheckedKeys;
      var _this$props6 = _this.props, checkStrictly = _this$props6.checkStrictly, onCheck = _this$props6.onCheck;
      var key = treeNode.key;
      var checkedObj;
      var eventObj = {
        event: "check",
        node: treeNode,
        checked,
        nativeEvent: e2.nativeEvent
      };
      if (checkStrictly) {
        var checkedKeys = checked ? arrAdd(oriCheckedKeys, key) : arrDel(oriCheckedKeys, key);
        var halfCheckedKeys = arrDel(oriHalfCheckedKeys, key);
        checkedObj = {
          checked: checkedKeys,
          halfChecked: halfCheckedKeys
        };
        eventObj.checkedNodes = checkedKeys.map(function(checkedKey) {
          return getEntity(keyEntities, checkedKey);
        }).filter(Boolean).map(function(entity) {
          return entity.node;
        });
        _this.setUncontrolledState({
          checkedKeys
        });
      } else {
        var _conductCheck = conductCheck([].concat(_toConsumableArray(oriCheckedKeys), [key]), true, keyEntities), _checkedKeys = _conductCheck.checkedKeys, _halfCheckedKeys = _conductCheck.halfCheckedKeys;
        if (!checked) {
          var keySet = new Set(_checkedKeys);
          keySet.delete(key);
          var _conductCheck2 = conductCheck(Array.from(keySet), {
            halfCheckedKeys: _halfCheckedKeys
          }, keyEntities);
          _checkedKeys = _conductCheck2.checkedKeys;
          _halfCheckedKeys = _conductCheck2.halfCheckedKeys;
        }
        checkedObj = _checkedKeys;
        eventObj.checkedNodes = [];
        eventObj.checkedNodesPositions = [];
        eventObj.halfCheckedKeys = _halfCheckedKeys;
        _checkedKeys.forEach(function(checkedKey) {
          var entity = getEntity(keyEntities, checkedKey);
          if (!entity)
            return;
          var node2 = entity.node, pos = entity.pos;
          eventObj.checkedNodes.push(node2);
          eventObj.checkedNodesPositions.push({
            node: node2,
            pos
          });
        });
        _this.setUncontrolledState({
          checkedKeys: _checkedKeys
        }, false, {
          halfCheckedKeys: _halfCheckedKeys
        });
      }
      onCheck === null || onCheck === void 0 || onCheck(checkedObj, eventObj);
    });
    _defineProperty$3(_assertThisInitialized(_this), "onNodeLoad", function(treeNode) {
      var _entity$children;
      var key = treeNode.key;
      var keyEntities = _this.state.keyEntities;
      var entity = getEntity(keyEntities, key);
      if (entity !== null && entity !== void 0 && (_entity$children = entity.children) !== null && _entity$children !== void 0 && _entity$children.length) {
        return;
      }
      var loadPromise = new Promise(function(resolve2, reject) {
        _this.setState(function(_ref) {
          var _ref$loadedKeys = _ref.loadedKeys, loadedKeys = _ref$loadedKeys === void 0 ? [] : _ref$loadedKeys, _ref$loadingKeys = _ref.loadingKeys, loadingKeys = _ref$loadingKeys === void 0 ? [] : _ref$loadingKeys;
          var _this$props7 = _this.props, loadData = _this$props7.loadData, onLoad = _this$props7.onLoad;
          if (!loadData || loadedKeys.includes(key) || loadingKeys.includes(key)) {
            return null;
          }
          var promise = loadData(treeNode);
          promise.then(function() {
            var currentLoadedKeys = _this.state.loadedKeys;
            var newLoadedKeys = arrAdd(currentLoadedKeys, key);
            onLoad === null || onLoad === void 0 || onLoad(newLoadedKeys, {
              event: "load",
              node: treeNode
            });
            _this.setUncontrolledState({
              loadedKeys: newLoadedKeys
            });
            _this.setState(function(prevState) {
              return {
                loadingKeys: arrDel(prevState.loadingKeys, key)
              };
            });
            resolve2();
          }).catch(function(e2) {
            _this.setState(function(prevState) {
              return {
                loadingKeys: arrDel(prevState.loadingKeys, key)
              };
            });
            _this.loadingRetryTimes[key] = (_this.loadingRetryTimes[key] || 0) + 1;
            if (_this.loadingRetryTimes[key] >= MAX_RETRY_TIMES) {
              var currentLoadedKeys = _this.state.loadedKeys;
              warningOnce(false, "Retry for `loadData` many times but still failed. No more retry.");
              _this.setUncontrolledState({
                loadedKeys: arrAdd(currentLoadedKeys, key)
              });
              resolve2();
            }
            reject(e2);
          });
          return {
            loadingKeys: arrAdd(loadingKeys, key)
          };
        });
      });
      loadPromise.catch(function() {
      });
      return loadPromise;
    });
    _defineProperty$3(_assertThisInitialized(_this), "onNodeMouseEnter", function(event, node2) {
      var onMouseEnter = _this.props.onMouseEnter;
      onMouseEnter === null || onMouseEnter === void 0 || onMouseEnter({
        event,
        node: node2
      });
    });
    _defineProperty$3(_assertThisInitialized(_this), "onNodeMouseLeave", function(event, node2) {
      var onMouseLeave = _this.props.onMouseLeave;
      onMouseLeave === null || onMouseLeave === void 0 || onMouseLeave({
        event,
        node: node2
      });
    });
    _defineProperty$3(_assertThisInitialized(_this), "onNodeContextMenu", function(event, node2) {
      var onRightClick = _this.props.onRightClick;
      if (onRightClick) {
        event.preventDefault();
        onRightClick({
          event,
          node: node2
        });
      }
    });
    _defineProperty$3(_assertThisInitialized(_this), "onFocus", function() {
      var onFocus = _this.props.onFocus;
      _this.setState({
        focused: true
      });
      for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
        args[_key2] = arguments[_key2];
      }
      onFocus === null || onFocus === void 0 || onFocus.apply(void 0, args);
    });
    _defineProperty$3(_assertThisInitialized(_this), "onBlur", function() {
      var onBlur = _this.props.onBlur;
      _this.setState({
        focused: false
      });
      _this.onActiveChange(null);
      for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
        args[_key3] = arguments[_key3];
      }
      onBlur === null || onBlur === void 0 || onBlur.apply(void 0, args);
    });
    _defineProperty$3(_assertThisInitialized(_this), "getTreeNodeRequiredProps", function() {
      var _this$state8 = _this.state, expandedKeys = _this$state8.expandedKeys, selectedKeys = _this$state8.selectedKeys, loadedKeys = _this$state8.loadedKeys, loadingKeys = _this$state8.loadingKeys, checkedKeys = _this$state8.checkedKeys, halfCheckedKeys = _this$state8.halfCheckedKeys, dragOverNodeKey = _this$state8.dragOverNodeKey, dropPosition = _this$state8.dropPosition, keyEntities = _this$state8.keyEntities;
      return {
        expandedKeys: expandedKeys || [],
        selectedKeys: selectedKeys || [],
        loadedKeys: loadedKeys || [],
        loadingKeys: loadingKeys || [],
        checkedKeys: checkedKeys || [],
        halfCheckedKeys: halfCheckedKeys || [],
        dragOverNodeKey,
        dropPosition,
        keyEntities
      };
    });
    _defineProperty$3(_assertThisInitialized(_this), "setExpandedKeys", function(expandedKeys) {
      var _this$state9 = _this.state, treeData = _this$state9.treeData, fieldNames = _this$state9.fieldNames;
      var flattenNodes = flattenTreeData(treeData, expandedKeys, fieldNames);
      _this.setUncontrolledState({
        expandedKeys,
        flattenNodes
      }, true);
    });
    _defineProperty$3(_assertThisInitialized(_this), "onNodeExpand", function(e2, treeNode) {
      var expandedKeys = _this.state.expandedKeys;
      var _this$state10 = _this.state, listChanging = _this$state10.listChanging, fieldNames = _this$state10.fieldNames;
      var _this$props8 = _this.props, onExpand = _this$props8.onExpand, loadData = _this$props8.loadData;
      var expanded = treeNode.expanded;
      var key = treeNode[fieldNames.key];
      if (listChanging) {
        return;
      }
      var certain = expandedKeys.includes(key);
      var targetExpanded = !expanded;
      warningOnce(expanded && certain || !expanded && !certain, "Expand state not sync with index check");
      expandedKeys = targetExpanded ? arrAdd(expandedKeys, key) : arrDel(expandedKeys, key);
      _this.setExpandedKeys(expandedKeys);
      onExpand === null || onExpand === void 0 || onExpand(expandedKeys, {
        node: treeNode,
        expanded: targetExpanded,
        nativeEvent: e2.nativeEvent
      });
      if (targetExpanded && loadData) {
        var loadPromise = _this.onNodeLoad(treeNode);
        if (loadPromise) {
          loadPromise.then(function() {
            var newFlattenTreeData = flattenTreeData(_this.state.treeData, expandedKeys, fieldNames);
            _this.setUncontrolledState({
              flattenNodes: newFlattenTreeData
            });
          }).catch(function() {
            var currentExpandedKeys = _this.state.expandedKeys;
            var expandedKeysToRestore = arrDel(currentExpandedKeys, key);
            _this.setExpandedKeys(expandedKeysToRestore);
          });
        }
      }
    });
    _defineProperty$3(_assertThisInitialized(_this), "onListChangeStart", function() {
      _this.setUncontrolledState({
        listChanging: true
      });
    });
    _defineProperty$3(_assertThisInitialized(_this), "onListChangeEnd", function() {
      setTimeout(function() {
        _this.setUncontrolledState({
          listChanging: false
        });
      });
    });
    _defineProperty$3(_assertThisInitialized(_this), "onActiveChange", function(newActiveKey) {
      var activeKey = _this.state.activeKey;
      var _this$props9 = _this.props, onActiveChange = _this$props9.onActiveChange, _this$props9$itemScro = _this$props9.itemScrollOffset, itemScrollOffset = _this$props9$itemScro === void 0 ? 0 : _this$props9$itemScro;
      if (activeKey === newActiveKey) {
        return;
      }
      _this.setState({
        activeKey: newActiveKey
      });
      if (newActiveKey !== null) {
        _this.scrollTo({
          key: newActiveKey,
          offset: itemScrollOffset
        });
      }
      onActiveChange === null || onActiveChange === void 0 || onActiveChange(newActiveKey);
    });
    _defineProperty$3(_assertThisInitialized(_this), "getActiveItem", function() {
      var _this$state11 = _this.state, activeKey = _this$state11.activeKey, flattenNodes = _this$state11.flattenNodes;
      if (activeKey === null) {
        return null;
      }
      return flattenNodes.find(function(_ref2) {
        var key = _ref2.key;
        return key === activeKey;
      }) || null;
    });
    _defineProperty$3(_assertThisInitialized(_this), "offsetActiveKey", function(offset2) {
      var _this$state12 = _this.state, flattenNodes = _this$state12.flattenNodes, activeKey = _this$state12.activeKey;
      var index2 = flattenNodes.findIndex(function(_ref3) {
        var key = _ref3.key;
        return key === activeKey;
      });
      if (index2 === -1 && offset2 < 0) {
        index2 = flattenNodes.length;
      }
      index2 = (index2 + offset2 + flattenNodes.length) % flattenNodes.length;
      var item = flattenNodes[index2];
      if (item) {
        var _key4 = item.key;
        _this.onActiveChange(_key4);
      } else {
        _this.onActiveChange(null);
      }
    });
    _defineProperty$3(_assertThisInitialized(_this), "onKeyDown", function(event) {
      var _this$state13 = _this.state, activeKey = _this$state13.activeKey, expandedKeys = _this$state13.expandedKeys, checkedKeys = _this$state13.checkedKeys, fieldNames = _this$state13.fieldNames;
      var _this$props10 = _this.props, onKeyDown = _this$props10.onKeyDown, checkable = _this$props10.checkable, selectable = _this$props10.selectable;
      switch (event.which) {
        case KeyCode.UP: {
          _this.offsetActiveKey(-1);
          event.preventDefault();
          break;
        }
        case KeyCode.DOWN: {
          _this.offsetActiveKey(1);
          event.preventDefault();
          break;
        }
      }
      var activeItem = _this.getActiveItem();
      if (activeItem && activeItem.data) {
        var treeNodeRequiredProps = _this.getTreeNodeRequiredProps();
        var expandable = activeItem.data.isLeaf === false || !!(activeItem.data[fieldNames.children] || []).length;
        var eventNode = convertNodePropsToEventData(_objectSpread2(_objectSpread2({}, getTreeNodeProps(activeKey, treeNodeRequiredProps)), {}, {
          data: activeItem.data,
          active: true
        }));
        switch (event.which) {
          case KeyCode.LEFT: {
            if (expandable && expandedKeys.includes(activeKey)) {
              _this.onNodeExpand({}, eventNode);
            } else if (activeItem.parent) {
              _this.onActiveChange(activeItem.parent.key);
            }
            event.preventDefault();
            break;
          }
          case KeyCode.RIGHT: {
            if (expandable && !expandedKeys.includes(activeKey)) {
              _this.onNodeExpand({}, eventNode);
            } else if (activeItem.children && activeItem.children.length) {
              _this.onActiveChange(activeItem.children[0].key);
            }
            event.preventDefault();
            break;
          }
          case KeyCode.ENTER:
          case KeyCode.SPACE: {
            if (checkable && !eventNode.disabled && eventNode.checkable !== false && !eventNode.disableCheckbox) {
              _this.onNodeCheck({}, eventNode, !checkedKeys.includes(activeKey));
            } else if (!checkable && selectable && !eventNode.disabled && eventNode.selectable !== false) {
              _this.onNodeSelect({}, eventNode);
            }
            break;
          }
        }
      }
      onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
    });
    _defineProperty$3(_assertThisInitialized(_this), "setUncontrolledState", function(state) {
      var atomic = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
      var forceState = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
      if (!_this.destroyed) {
        var needSync = false;
        var allPassed = true;
        var newState = {};
        Object.keys(state).forEach(function(name2) {
          if (_this.props.hasOwnProperty(name2)) {
            allPassed = false;
            return;
          }
          needSync = true;
          newState[name2] = state[name2];
        });
        if (needSync && (!atomic || allPassed)) {
          _this.setState(_objectSpread2(_objectSpread2({}, newState), forceState));
        }
      }
    });
    _defineProperty$3(_assertThisInitialized(_this), "scrollTo", function(scroll) {
      _this.listRef.current.scrollTo(scroll);
    });
    return _this;
  }
  _createClass$8(Tree2, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      this.destroyed = false;
      this.onUpdated();
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate() {
      this.onUpdated();
    }
  }, {
    key: "onUpdated",
    value: function onUpdated() {
      var _this$props11 = this.props, activeKey = _this$props11.activeKey, _this$props11$itemScr = _this$props11.itemScrollOffset, itemScrollOffset = _this$props11$itemScr === void 0 ? 0 : _this$props11$itemScr;
      if (activeKey !== void 0 && activeKey !== this.state.activeKey) {
        this.setState({
          activeKey
        });
        if (activeKey !== null) {
          this.scrollTo({
            key: activeKey,
            offset: itemScrollOffset
          });
        }
      }
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      window.removeEventListener("dragend", this.onWindowDragEnd);
      this.destroyed = true;
    }
  }, {
    key: "resetDragState",
    value: function resetDragState() {
      this.setState({
        dragOverNodeKey: null,
        dropPosition: null,
        dropLevelOffset: null,
        dropTargetKey: null,
        dropContainerKey: null,
        dropTargetPos: null,
        dropAllowed: false
      });
    }
  }, {
    key: "render",
    value: function render3() {
      var _this$state14 = this.state, focused = _this$state14.focused, flattenNodes = _this$state14.flattenNodes, keyEntities = _this$state14.keyEntities, draggingNodeKey = _this$state14.draggingNodeKey, activeKey = _this$state14.activeKey, dropLevelOffset = _this$state14.dropLevelOffset, dropContainerKey = _this$state14.dropContainerKey, dropTargetKey = _this$state14.dropTargetKey, dropPosition = _this$state14.dropPosition, dragOverNodeKey = _this$state14.dragOverNodeKey, indent = _this$state14.indent;
      var _this$props12 = this.props, prefixCls = _this$props12.prefixCls, className = _this$props12.className, style2 = _this$props12.style, showLine = _this$props12.showLine, focusable2 = _this$props12.focusable, _this$props12$tabInde = _this$props12.tabIndex, tabIndex = _this$props12$tabInde === void 0 ? 0 : _this$props12$tabInde, selectable = _this$props12.selectable, showIcon = _this$props12.showIcon, icon = _this$props12.icon, switcherIcon = _this$props12.switcherIcon, draggable = _this$props12.draggable, checkable = _this$props12.checkable, checkStrictly = _this$props12.checkStrictly, disabled = _this$props12.disabled, motion = _this$props12.motion, loadData = _this$props12.loadData, filterTreeNode = _this$props12.filterTreeNode, height = _this$props12.height, itemHeight = _this$props12.itemHeight, scrollWidth = _this$props12.scrollWidth, virtual = _this$props12.virtual, titleRender = _this$props12.titleRender, dropIndicatorRender2 = _this$props12.dropIndicatorRender, onContextMenu = _this$props12.onContextMenu, onScroll6 = _this$props12.onScroll, direction = _this$props12.direction, rootClassName = _this$props12.rootClassName, rootStyle = _this$props12.rootStyle;
      var domProps = pickAttrs(this.props, {
        aria: true,
        data: true
      });
      var draggableConfig;
      if (draggable) {
        if (_typeof$1(draggable) === "object") {
          draggableConfig = draggable;
        } else if (typeof draggable === "function") {
          draggableConfig = {
            nodeDraggable: draggable
          };
        } else {
          draggableConfig = {};
        }
      }
      var contextValue = {
        prefixCls,
        selectable,
        showIcon,
        icon,
        switcherIcon,
        draggable: draggableConfig,
        draggingNodeKey,
        checkable,
        checkStrictly,
        disabled,
        keyEntities,
        dropLevelOffset,
        dropContainerKey,
        dropTargetKey,
        dropPosition,
        dragOverNodeKey,
        indent,
        direction,
        dropIndicatorRender: dropIndicatorRender2,
        loadData,
        filterTreeNode,
        titleRender,
        onNodeClick: this.onNodeClick,
        onNodeDoubleClick: this.onNodeDoubleClick,
        onNodeExpand: this.onNodeExpand,
        onNodeSelect: this.onNodeSelect,
        onNodeCheck: this.onNodeCheck,
        onNodeLoad: this.onNodeLoad,
        onNodeMouseEnter: this.onNodeMouseEnter,
        onNodeMouseLeave: this.onNodeMouseLeave,
        onNodeContextMenu: this.onNodeContextMenu,
        onNodeDragStart: this.onNodeDragStart,
        onNodeDragEnter: this.onNodeDragEnter,
        onNodeDragOver: this.onNodeDragOver,
        onNodeDragLeave: this.onNodeDragLeave,
        onNodeDragEnd: this.onNodeDragEnd,
        onNodeDrop: this.onNodeDrop
      };
      return /* @__PURE__ */ reactExports.createElement(TreeContext.Provider, {
        value: contextValue
      }, /* @__PURE__ */ reactExports.createElement("div", {
        className: classNames(prefixCls, className, rootClassName, _defineProperty$3(_defineProperty$3(_defineProperty$3({}, "".concat(prefixCls, "-show-line"), showLine), "".concat(prefixCls, "-focused"), focused), "".concat(prefixCls, "-active-focused"), activeKey !== null)),
        style: rootStyle
      }, /* @__PURE__ */ reactExports.createElement(NodeList, _extends$h({
        ref: this.listRef,
        prefixCls,
        style: style2,
        data: flattenNodes,
        disabled,
        selectable,
        checkable: !!checkable,
        motion,
        dragging: draggingNodeKey !== null,
        height,
        itemHeight,
        virtual,
        focusable: focusable2,
        focused,
        tabIndex,
        activeItem: this.getActiveItem(),
        onFocus: this.onFocus,
        onBlur: this.onBlur,
        onKeyDown: this.onKeyDown,
        onActiveChange: this.onActiveChange,
        onListChangeStart: this.onListChangeStart,
        onListChangeEnd: this.onListChangeEnd,
        onContextMenu,
        onScroll: onScroll6,
        scrollWidth
      }, this.getTreeNodeRequiredProps(), domProps))));
    }
  }], [{
    key: "getDerivedStateFromProps",
    value: function getDerivedStateFromProps(props, prevState) {
      var prevProps = prevState.prevProps;
      var newState = {
        prevProps: props
      };
      function needSync(name2) {
        return !prevProps && props.hasOwnProperty(name2) || prevProps && prevProps[name2] !== props[name2];
      }
      var treeData;
      var fieldNames = prevState.fieldNames;
      if (needSync("fieldNames")) {
        fieldNames = fillFieldNames(props.fieldNames);
        newState.fieldNames = fieldNames;
      }
      if (needSync("treeData")) {
        treeData = props.treeData;
      } else if (needSync("children")) {
        warningOnce(false, "`children` of Tree is deprecated. Please use `treeData` instead.");
        treeData = convertTreeToData(props.children);
      }
      if (treeData) {
        newState.treeData = treeData;
        var entitiesMap = convertDataToEntities(treeData, {
          fieldNames
        });
        newState.keyEntities = _objectSpread2(_defineProperty$3({}, MOTION_KEY, MotionEntity), entitiesMap.keyEntities);
      }
      var keyEntities = newState.keyEntities || prevState.keyEntities;
      if (needSync("expandedKeys") || prevProps && needSync("autoExpandParent")) {
        newState.expandedKeys = props.autoExpandParent || !prevProps && props.defaultExpandParent ? conductExpandParent(props.expandedKeys, keyEntities) : props.expandedKeys;
      } else if (!prevProps && props.defaultExpandAll) {
        var cloneKeyEntities = _objectSpread2({}, keyEntities);
        delete cloneKeyEntities[MOTION_KEY];
        var nextExpandedKeys = [];
        Object.keys(cloneKeyEntities).forEach(function(key) {
          var entity = cloneKeyEntities[key];
          if (entity.children && entity.children.length) {
            nextExpandedKeys.push(entity.key);
          }
        });
        newState.expandedKeys = nextExpandedKeys;
      } else if (!prevProps && props.defaultExpandedKeys) {
        newState.expandedKeys = props.autoExpandParent || props.defaultExpandParent ? conductExpandParent(props.defaultExpandedKeys, keyEntities) : props.defaultExpandedKeys;
      }
      if (!newState.expandedKeys) {
        delete newState.expandedKeys;
      }
      if (treeData || newState.expandedKeys) {
        var flattenNodes = flattenTreeData(treeData || prevState.treeData, newState.expandedKeys || prevState.expandedKeys, fieldNames);
        newState.flattenNodes = flattenNodes;
      }
      if (props.selectable) {
        if (needSync("selectedKeys")) {
          newState.selectedKeys = calcSelectedKeys(props.selectedKeys, props);
        } else if (!prevProps && props.defaultSelectedKeys) {
          newState.selectedKeys = calcSelectedKeys(props.defaultSelectedKeys, props);
        }
      }
      if (props.checkable) {
        var checkedKeyEntity;
        if (needSync("checkedKeys")) {
          checkedKeyEntity = parseCheckedKeys(props.checkedKeys) || {};
        } else if (!prevProps && props.defaultCheckedKeys) {
          checkedKeyEntity = parseCheckedKeys(props.defaultCheckedKeys) || {};
        } else if (treeData) {
          checkedKeyEntity = parseCheckedKeys(props.checkedKeys) || {
            checkedKeys: prevState.checkedKeys,
            halfCheckedKeys: prevState.halfCheckedKeys
          };
        }
        if (checkedKeyEntity) {
          var _checkedKeyEntity = checkedKeyEntity, _checkedKeyEntity$che = _checkedKeyEntity.checkedKeys, checkedKeys = _checkedKeyEntity$che === void 0 ? [] : _checkedKeyEntity$che, _checkedKeyEntity$hal = _checkedKeyEntity.halfCheckedKeys, halfCheckedKeys = _checkedKeyEntity$hal === void 0 ? [] : _checkedKeyEntity$hal;
          if (!props.checkStrictly) {
            var conductKeys = conductCheck(checkedKeys, true, keyEntities);
            checkedKeys = conductKeys.checkedKeys;
            halfCheckedKeys = conductKeys.halfCheckedKeys;
          }
          newState.checkedKeys = checkedKeys;
          newState.halfCheckedKeys = halfCheckedKeys;
        }
      }
      if (needSync("loadedKeys")) {
        newState.loadedKeys = props.loadedKeys;
      }
      return newState;
    }
  }]);
  return Tree2;
}(reactExports.Component);
_defineProperty$3(Tree$3, "defaultProps", {
  prefixCls: "rc-tree",
  showLine: false,
  showIcon: true,
  selectable: true,
  multiple: false,
  checkable: false,
  disabled: false,
  checkStrictly: false,
  draggable: false,
  defaultExpandParent: true,
  autoExpandParent: false,
  defaultExpandAll: false,
  defaultExpandedKeys: [],
  defaultCheckedKeys: [],
  defaultSelectedKeys: [],
  dropIndicatorRender: DropIndicator,
  allowDrop: function allowDrop() {
    return true;
  },
  expandAction: false
});
_defineProperty$3(Tree$3, "TreeNode", TreeNode);
const genDirectoryStyle = ({
  treeCls,
  treeNodeCls,
  directoryNodeSelectedBg,
  directoryNodeSelectedColor,
  motionDurationMid,
  borderRadius: borderRadius2,
  controlItemBgHover
}) => ({
  [`${treeCls}${treeCls}-directory ${treeNodeCls}`]: {
    // >>> Title
    [`${treeCls}-node-content-wrapper`]: {
      position: "static",
      [`&:has(${treeCls}-drop-indicator)`]: {
        position: "relative"
      },
      [`> *:not(${treeCls}-drop-indicator)`]: {
        position: "relative"
      },
      "&:hover": {
        background: "transparent"
      },
      // Expand interactive area to whole line
      "&:before": {
        position: "absolute",
        inset: 0,
        transition: `background-color ${motionDurationMid}`,
        content: '""',
        borderRadius: borderRadius2
      },
      "&:hover:before": {
        background: controlItemBgHover
      }
    },
    [`${treeCls}-switcher, ${treeCls}-checkbox, ${treeCls}-draggable-icon`]: {
      zIndex: 1
    },
    // ============= Selected =============
    "&-selected": {
      background: directoryNodeSelectedBg,
      borderRadius: borderRadius2,
      [`${treeCls}-switcher, ${treeCls}-draggable-icon`]: {
        color: directoryNodeSelectedColor
      },
      // >>> Title
      [`${treeCls}-node-content-wrapper`]: {
        color: directoryNodeSelectedColor,
        background: "transparent",
        "&:before, &:hover:before": {
          background: directoryNodeSelectedBg
        }
      }
    }
  }
});
const treeNodeFX = new Keyframe("ant-tree-node-fx-do-not-use", {
  "0%": {
    opacity: 0
  },
  "100%": {
    opacity: 1
  }
});
const getSwitchStyle = (prefixCls, token2) => ({
  [`.${prefixCls}-switcher-icon`]: {
    display: "inline-block",
    fontSize: 10,
    verticalAlign: "baseline",
    svg: {
      transition: `transform ${token2.motionDurationSlow}`
    }
  }
});
const getDropIndicatorStyle = (prefixCls, token2) => ({
  [`.${prefixCls}-drop-indicator`]: {
    position: "absolute",
    // it should displayed over the following node
    zIndex: 1,
    height: 2,
    backgroundColor: token2.colorPrimary,
    borderRadius: 1,
    pointerEvents: "none",
    "&:after": {
      position: "absolute",
      top: -3,
      insetInlineStart: -6,
      width: 8,
      height: 8,
      backgroundColor: "transparent",
      border: `${unit$1(token2.lineWidthBold)} solid ${token2.colorPrimary}`,
      borderRadius: "50%",
      content: '""'
    }
  }
});
const genBaseStyle = (prefixCls, token2) => {
  const {
    treeCls,
    treeNodeCls,
    treeNodePadding,
    titleHeight,
    indentSize,
    nodeSelectedBg,
    nodeHoverBg,
    colorTextQuaternary,
    controlItemBgActiveDisabled
  } = token2;
  return {
    [treeCls]: Object.assign(Object.assign({}, resetComponent(token2)), {
      // fix https://github.com/ant-design/ant-design/issues/50316
      ["--rc-virtual-list-scrollbar-bg"]: token2.colorSplit,
      background: token2.colorBgContainer,
      borderRadius: token2.borderRadius,
      transition: `background-color ${token2.motionDurationSlow}`,
      "&-rtl": {
        direction: "rtl"
      },
      [`&${treeCls}-rtl ${treeCls}-switcher_close ${treeCls}-switcher-icon svg`]: {
        transform: "rotate(90deg)"
      },
      [`&-focused:not(:hover):not(${treeCls}-active-focused)`]: Object.assign({}, genFocusOutline(token2)),
      // =================== Virtual List ===================
      [`${treeCls}-list-holder-inner`]: {
        alignItems: "flex-start"
      },
      [`&${treeCls}-block-node`]: {
        [`${treeCls}-list-holder-inner`]: {
          alignItems: "stretch",
          // >>> Title
          [`${treeCls}-node-content-wrapper`]: {
            flex: "auto"
          },
          // >>> Drag
          [`${treeNodeCls}.dragging:after`]: {
            position: "absolute",
            inset: 0,
            border: `1px solid ${token2.colorPrimary}`,
            opacity: 0,
            animationName: treeNodeFX,
            animationDuration: token2.motionDurationSlow,
            animationPlayState: "running",
            animationFillMode: "forwards",
            content: '""',
            pointerEvents: "none",
            borderRadius: token2.borderRadius
          }
        }
      },
      // ===================== TreeNode =====================
      [treeNodeCls]: {
        display: "flex",
        alignItems: "flex-start",
        marginBottom: treeNodePadding,
        lineHeight: unit$1(titleHeight),
        position: "relative",
        // 非常重要，避免 drop-indicator 在拖拽过程中闪烁
        "&:before": {
          content: '""',
          position: "absolute",
          zIndex: 1,
          insetInlineStart: 0,
          width: "100%",
          top: "100%",
          height: treeNodePadding
        },
        // Disabled
        [`&-disabled ${treeCls}-node-content-wrapper`]: {
          color: token2.colorTextDisabled,
          cursor: "not-allowed",
          "&:hover": {
            background: "transparent"
          }
        },
        [`${treeCls}-checkbox-disabled + ${treeCls}-node-selected,&${treeNodeCls}-disabled${treeNodeCls}-selected ${treeCls}-node-content-wrapper`]: {
          backgroundColor: controlItemBgActiveDisabled
        },
        // we can not set pointer-events to none for checkbox in tree
        // ref: https://github.com/ant-design/ant-design/issues/39822#issuecomment-2605234058
        [`${treeCls}-checkbox-disabled`]: {
          pointerEvents: "unset"
        },
        // not disable
        [`&:not(${treeNodeCls}-disabled)`]: {
          // >>> Title
          [`${treeCls}-node-content-wrapper`]: {
            "&:hover": {
              color: token2.nodeHoverColor
            }
          }
        },
        [`&-active ${treeCls}-node-content-wrapper`]: {
          background: token2.controlItemBgHover
        },
        [`&:not(${treeNodeCls}-disabled).filter-node ${treeCls}-title`]: {
          color: token2.colorPrimary,
          fontWeight: token2.fontWeightStrong
        },
        "&-draggable": {
          cursor: "grab",
          [`${treeCls}-draggable-icon`]: {
            // https://github.com/ant-design/ant-design/issues/41915
            flexShrink: 0,
            width: titleHeight,
            textAlign: "center",
            visibility: "visible",
            color: colorTextQuaternary
          },
          [`&${treeNodeCls}-disabled ${treeCls}-draggable-icon`]: {
            visibility: "hidden"
          }
        }
      },
      // >>> Indent
      [`${treeCls}-indent`]: {
        alignSelf: "stretch",
        whiteSpace: "nowrap",
        userSelect: "none",
        "&-unit": {
          display: "inline-block",
          width: indentSize
        }
      },
      // >>> Drag Handler
      [`${treeCls}-draggable-icon`]: {
        visibility: "hidden"
      },
      // Switcher / Checkbox
      [`${treeCls}-switcher, ${treeCls}-checkbox`]: {
        marginInlineEnd: token2.calc(token2.calc(titleHeight).sub(token2.controlInteractiveSize)).div(2).equal()
      },
      // >>> Switcher
      [`${treeCls}-switcher`]: Object.assign(Object.assign({}, getSwitchStyle(prefixCls, token2)), {
        position: "relative",
        flex: "none",
        alignSelf: "stretch",
        width: titleHeight,
        textAlign: "center",
        cursor: "pointer",
        userSelect: "none",
        transition: `all ${token2.motionDurationSlow}`,
        "&-noop": {
          cursor: "unset"
        },
        "&:before": {
          pointerEvents: "none",
          content: '""',
          width: titleHeight,
          height: titleHeight,
          position: "absolute",
          left: {
            _skip_check_: true,
            value: 0
          },
          top: 0,
          borderRadius: token2.borderRadius,
          transition: `all ${token2.motionDurationSlow}`
        },
        [`&:not(${treeCls}-switcher-noop):hover:before`]: {
          backgroundColor: token2.colorBgTextHover
        },
        [`&_close ${treeCls}-switcher-icon svg`]: {
          transform: "rotate(-90deg)"
        },
        "&-loading-icon": {
          color: token2.colorPrimary
        },
        "&-leaf-line": {
          position: "relative",
          zIndex: 1,
          display: "inline-block",
          width: "100%",
          height: "100%",
          // https://github.com/ant-design/ant-design/issues/31884
          "&:before": {
            position: "absolute",
            top: 0,
            insetInlineEnd: token2.calc(titleHeight).div(2).equal(),
            bottom: token2.calc(treeNodePadding).mul(-1).equal(),
            marginInlineStart: -1,
            borderInlineEnd: `1px solid ${token2.colorBorder}`,
            content: '""'
          },
          "&:after": {
            position: "absolute",
            width: token2.calc(token2.calc(titleHeight).div(2).equal()).mul(0.8).equal(),
            height: token2.calc(titleHeight).div(2).equal(),
            borderBottom: `1px solid ${token2.colorBorder}`,
            content: '""'
          }
        }
      }),
      // >>> Title
      // add `${treeCls}-checkbox + span` to cover checkbox `${checkboxCls} + span`
      [`${treeCls}-node-content-wrapper`]: Object.assign(Object.assign({
        position: "relative",
        minHeight: titleHeight,
        paddingBlock: 0,
        paddingInline: token2.paddingXS,
        background: "transparent",
        borderRadius: token2.borderRadius,
        cursor: "pointer",
        transition: `all ${token2.motionDurationMid}, border 0s, line-height 0s, box-shadow 0s`
      }, getDropIndicatorStyle(prefixCls, token2)), {
        "&:hover": {
          backgroundColor: nodeHoverBg
        },
        [`&${treeCls}-node-selected`]: {
          color: token2.nodeSelectedColor,
          backgroundColor: nodeSelectedBg
        },
        // Icon
        [`${treeCls}-iconEle`]: {
          display: "inline-block",
          width: titleHeight,
          height: titleHeight,
          textAlign: "center",
          verticalAlign: "top",
          "&:empty": {
            display: "none"
          }
        }
      }),
      // https://github.com/ant-design/ant-design/issues/28217
      [`${treeCls}-unselectable ${treeCls}-node-content-wrapper:hover`]: {
        backgroundColor: "transparent"
      },
      [`${treeNodeCls}.drop-container > [draggable]`]: {
        boxShadow: `0 0 0 2px ${token2.colorPrimary}`
      },
      // ==================== Show Line =====================
      "&-show-line": {
        // ================ Indent lines ================
        [`${treeCls}-indent-unit`]: {
          position: "relative",
          height: "100%",
          "&:before": {
            position: "absolute",
            top: 0,
            insetInlineEnd: token2.calc(titleHeight).div(2).equal(),
            bottom: token2.calc(treeNodePadding).mul(-1).equal(),
            borderInlineEnd: `1px solid ${token2.colorBorder}`,
            content: '""'
          },
          "&-end:before": {
            display: "none"
          }
        },
        // ============== Cover Background ==============
        [`${treeCls}-switcher`]: {
          background: "transparent",
          "&-line-icon": {
            // https://github.com/ant-design/ant-design/issues/32813
            verticalAlign: "-0.15em"
          }
        }
      },
      [`${treeNodeCls}-leaf-last ${treeCls}-switcher-leaf-line:before`]: {
        top: "auto !important",
        bottom: "auto !important",
        height: `${unit$1(token2.calc(titleHeight).div(2).equal())} !important`
      }
    })
  };
};
const genTreeStyle = (prefixCls, token2, enableDirectory = true) => {
  const treeCls = `.${prefixCls}`;
  const treeNodeCls = `${treeCls}-treenode`;
  const treeNodePadding = token2.calc(token2.paddingXS).div(2).equal();
  const treeToken = merge$4(token2, {
    treeCls,
    treeNodeCls,
    treeNodePadding
  });
  return [
    // Basic
    genBaseStyle(prefixCls, treeToken),
    // Directory
    enableDirectory && genDirectoryStyle(treeToken)
  ].filter(Boolean);
};
const initComponentToken = (token2) => {
  const {
    controlHeightSM,
    controlItemBgHover,
    controlItemBgActive
  } = token2;
  const titleHeight = controlHeightSM;
  return {
    titleHeight,
    indentSize: titleHeight,
    nodeHoverBg: controlItemBgHover,
    nodeHoverColor: token2.colorText,
    nodeSelectedBg: controlItemBgActive,
    nodeSelectedColor: token2.colorText
  };
};
const prepareComponentToken = (token2) => {
  const {
    colorTextLightSolid,
    colorPrimary
  } = token2;
  return Object.assign(Object.assign({}, initComponentToken(token2)), {
    directoryNodeSelectedColor: colorTextLightSolid,
    directoryNodeSelectedBg: colorPrimary
  });
};
const useStyle = genStyleHooks("Tree", (token2, {
  prefixCls
}) => [{
  [token2.componentCls]: getStyle$1(`${prefixCls}-checkbox`, token2)
}, genTreeStyle(prefixCls, token2), genCollapseMotion(token2)], prepareComponentToken);
const offset$1 = 4;
function dropIndicatorRender(props) {
  const {
    dropPosition,
    dropLevelOffset,
    prefixCls,
    indent,
    direction = "ltr"
  } = props;
  const startPosition = direction === "ltr" ? "left" : "right";
  const endPosition = direction === "ltr" ? "right" : "left";
  const style2 = {
    [startPosition]: -dropLevelOffset * indent + offset$1,
    [endPosition]: 0
  };
  switch (dropPosition) {
    case -1:
      style2.top = -3;
      break;
    case 1:
      style2.bottom = -3;
      break;
    default:
      style2.bottom = -3;
      style2[startPosition] = indent + offset$1;
      break;
  }
  return /* @__PURE__ */ React$5.createElement("div", {
    style: style2,
    className: `${prefixCls}-drop-indicator`
  });
}
const SwitcherIconCom = (props) => {
  var _a2, _b2;
  const {
    prefixCls,
    switcherIcon,
    treeNodeProps,
    showLine,
    switcherLoadingIcon
  } = props;
  const {
    isLeaf,
    expanded,
    loading
  } = treeNodeProps;
  if (loading) {
    if (/* @__PURE__ */ reactExports.isValidElement(switcherLoadingIcon)) {
      return switcherLoadingIcon;
    }
    return /* @__PURE__ */ reactExports.createElement(RefIcon$1i, {
      className: `${prefixCls}-switcher-loading-icon`
    });
  }
  let showLeafIcon;
  if (showLine && typeof showLine === "object") {
    showLeafIcon = showLine.showLeafIcon;
  }
  if (isLeaf) {
    if (!showLine) {
      return null;
    }
    if (typeof showLeafIcon !== "boolean" && !!showLeafIcon) {
      const leafIcon = typeof showLeafIcon === "function" ? showLeafIcon(treeNodeProps) : showLeafIcon;
      const leafCls = `${prefixCls}-switcher-line-custom-icon`;
      if (/* @__PURE__ */ reactExports.isValidElement(leafIcon)) {
        return cloneElement(leafIcon, {
          className: classNames((_a2 = leafIcon.props) === null || _a2 === void 0 ? void 0 : _a2.className, leafCls)
        });
      }
      return leafIcon;
    }
    return showLeafIcon ? /* @__PURE__ */ reactExports.createElement(RefIcon$N, {
      className: `${prefixCls}-switcher-line-icon`
    }) : /* @__PURE__ */ reactExports.createElement("span", {
      className: `${prefixCls}-switcher-leaf-line`
    });
  }
  const switcherCls = `${prefixCls}-switcher-icon`;
  const switcher = typeof switcherIcon === "function" ? switcherIcon(treeNodeProps) : switcherIcon;
  if (/* @__PURE__ */ reactExports.isValidElement(switcher)) {
    return cloneElement(switcher, {
      className: classNames((_b2 = switcher.props) === null || _b2 === void 0 ? void 0 : _b2.className, switcherCls)
    });
  }
  if (switcher !== void 0) {
    return switcher;
  }
  if (showLine) {
    return expanded ? /* @__PURE__ */ reactExports.createElement(RefIcon$t, {
      className: `${prefixCls}-switcher-line-icon`
    }) : /* @__PURE__ */ reactExports.createElement(RefIcon$l, {
      className: `${prefixCls}-switcher-line-icon`
    });
  }
  return /* @__PURE__ */ reactExports.createElement(RefIcon$12, {
    className: switcherCls
  });
};
const Tree$2 = /* @__PURE__ */ React$5.forwardRef((props, ref) => {
  var _a2;
  const {
    getPrefixCls,
    direction,
    virtual,
    tree
  } = React$5.useContext(ConfigContext);
  const {
    prefixCls: customizePrefixCls,
    className,
    showIcon = false,
    showLine,
    switcherIcon,
    switcherLoadingIcon,
    blockNode = false,
    children,
    checkable = false,
    selectable = true,
    draggable,
    motion: customMotion,
    style: style2
  } = props;
  const prefixCls = getPrefixCls("tree", customizePrefixCls);
  const rootPrefixCls = getPrefixCls();
  const motion = customMotion !== null && customMotion !== void 0 ? customMotion : Object.assign(Object.assign({}, initCollapseMotion(rootPrefixCls)), {
    motionAppear: false
  });
  const newProps = Object.assign(Object.assign({}, props), {
    checkable,
    selectable,
    showIcon,
    motion,
    blockNode,
    showLine: Boolean(showLine),
    dropIndicatorRender
  });
  const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);
  const [, token2] = useToken();
  const itemHeight = token2.paddingXS / 2 + (((_a2 = token2.Tree) === null || _a2 === void 0 ? void 0 : _a2.titleHeight) || token2.controlHeightSM);
  const draggableConfig = React$5.useMemo(() => {
    if (!draggable) {
      return false;
    }
    let mergedDraggable = {};
    switch (typeof draggable) {
      case "function":
        mergedDraggable.nodeDraggable = draggable;
        break;
      case "object":
        mergedDraggable = Object.assign({}, draggable);
        break;
    }
    if (mergedDraggable.icon !== false) {
      mergedDraggable.icon = mergedDraggable.icon || /* @__PURE__ */ React$5.createElement(RefIcon$A, null);
    }
    return mergedDraggable;
  }, [draggable]);
  const renderSwitcherIcon = (nodeProps) => /* @__PURE__ */ React$5.createElement(SwitcherIconCom, {
    prefixCls,
    switcherIcon,
    switcherLoadingIcon,
    treeNodeProps: nodeProps,
    showLine
  });
  return wrapCSSVar(
    // @ts-ignore
    /* @__PURE__ */ React$5.createElement(Tree$3, Object.assign({
      itemHeight,
      ref,
      virtual
    }, newProps, {
      // newProps may contain style so declare style below it
      style: Object.assign(Object.assign({}, tree === null || tree === void 0 ? void 0 : tree.style), style2),
      prefixCls,
      className: classNames({
        [`${prefixCls}-icon-hide`]: !showIcon,
        [`${prefixCls}-block-node`]: blockNode,
        [`${prefixCls}-unselectable`]: !selectable,
        [`${prefixCls}-rtl`]: direction === "rtl"
      }, tree === null || tree === void 0 ? void 0 : tree.className, className, hashId, cssVarCls),
      direction,
      checkable: checkable ? /* @__PURE__ */ React$5.createElement("span", {
        className: `${prefixCls}-checkbox-inner`
      }) : checkable,
      selectable,
      switcherIcon: renderSwitcherIcon,
      draggable: draggableConfig
    }), children)
  );
});
const RECORD_NONE = 0;
const RECORD_START = 1;
const RECORD_END = 2;
function traverseNodesKey(treeData, callback2, fieldNames) {
  const {
    key: fieldKey,
    children: fieldChildren
  } = fieldNames;
  function processNode(dataNode) {
    const key = dataNode[fieldKey];
    const children = dataNode[fieldChildren];
    if (callback2(key, dataNode) !== false) {
      traverseNodesKey(children || [], callback2, fieldNames);
    }
  }
  treeData.forEach(processNode);
}
function calcRangeKeys({
  treeData,
  expandedKeys,
  startKey,
  endKey,
  fieldNames
}) {
  const keys2 = [];
  let record = RECORD_NONE;
  if (startKey && startKey === endKey) {
    return [startKey];
  }
  if (!startKey || !endKey) {
    return [];
  }
  function matchKey(key) {
    return key === startKey || key === endKey;
  }
  traverseNodesKey(treeData, (key) => {
    if (record === RECORD_END) {
      return false;
    }
    if (matchKey(key)) {
      keys2.push(key);
      if (record === RECORD_NONE) {
        record = RECORD_START;
      } else if (record === RECORD_START) {
        record = RECORD_END;
        return false;
      }
    } else if (record === RECORD_START) {
      keys2.push(key);
    }
    return expandedKeys.includes(key);
  }, fillFieldNames(fieldNames));
  return keys2;
}
function convertDirectoryKeysToNodes(treeData, keys2, fieldNames) {
  const restKeys = _toConsumableArray(keys2);
  const nodes = [];
  traverseNodesKey(treeData, (key, node2) => {
    const index2 = restKeys.indexOf(key);
    if (index2 !== -1) {
      nodes.push(node2);
      restKeys.splice(index2, 1);
    }
    return !!restKeys.length;
  }, fillFieldNames(fieldNames));
  return nodes;
}
var __rest$1 = function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
};
function getIcon(props) {
  const {
    isLeaf,
    expanded
  } = props;
  if (isLeaf) {
    return /* @__PURE__ */ reactExports.createElement(RefIcon$N, null);
  }
  return expanded ? /* @__PURE__ */ reactExports.createElement(RefIcon$G, null) : /* @__PURE__ */ reactExports.createElement(RefIcon$F, null);
}
function getTreeData({
  treeData,
  children
}) {
  return treeData || convertTreeToData(children);
}
const DirectoryTree = (_a2, ref) => {
  var {
    defaultExpandAll,
    defaultExpandParent,
    defaultExpandedKeys
  } = _a2, props = __rest$1(_a2, ["defaultExpandAll", "defaultExpandParent", "defaultExpandedKeys"]);
  const lastSelectedKey = reactExports.useRef(null);
  const cachedSelectedKeys = reactExports.useRef(null);
  const getInitExpandedKeys = () => {
    const {
      keyEntities
    } = convertDataToEntities(getTreeData(props));
    let initExpandedKeys;
    if (defaultExpandAll) {
      initExpandedKeys = Object.keys(keyEntities);
    } else if (defaultExpandParent) {
      initExpandedKeys = conductExpandParent(props.expandedKeys || defaultExpandedKeys || [], keyEntities);
    } else {
      initExpandedKeys = props.expandedKeys || defaultExpandedKeys || [];
    }
    return initExpandedKeys;
  };
  const [selectedKeys, setSelectedKeys] = reactExports.useState(props.selectedKeys || props.defaultSelectedKeys || []);
  const [expandedKeys, setExpandedKeys] = reactExports.useState(() => getInitExpandedKeys());
  reactExports.useEffect(() => {
    if ("selectedKeys" in props) {
      setSelectedKeys(props.selectedKeys);
    }
  }, [props.selectedKeys]);
  reactExports.useEffect(() => {
    if ("expandedKeys" in props) {
      setExpandedKeys(props.expandedKeys);
    }
  }, [props.expandedKeys]);
  const onExpand = (keys2, info2) => {
    var _a22;
    if (!("expandedKeys" in props)) {
      setExpandedKeys(keys2);
    }
    return (_a22 = props.onExpand) === null || _a22 === void 0 ? void 0 : _a22.call(props, keys2, info2);
  };
  const onSelect = (keys2, event) => {
    var _a22;
    const {
      multiple,
      fieldNames
    } = props;
    const {
      node: node2,
      nativeEvent
    } = event;
    const {
      key = ""
    } = node2;
    const treeData = getTreeData(props);
    const newEvent = Object.assign(Object.assign({}, event), {
      selected: true
    });
    const ctrlPick = (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.ctrlKey) || (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.metaKey);
    const shiftPick = nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.shiftKey;
    let newSelectedKeys;
    if (multiple && ctrlPick) {
      newSelectedKeys = keys2;
      lastSelectedKey.current = key;
      cachedSelectedKeys.current = newSelectedKeys;
      newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData, newSelectedKeys, fieldNames);
    } else if (multiple && shiftPick) {
      newSelectedKeys = Array.from(new Set([].concat(_toConsumableArray(cachedSelectedKeys.current || []), _toConsumableArray(calcRangeKeys({
        treeData,
        expandedKeys,
        startKey: key,
        endKey: lastSelectedKey.current,
        fieldNames
      })))));
      newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData, newSelectedKeys, fieldNames);
    } else {
      newSelectedKeys = [key];
      lastSelectedKey.current = key;
      cachedSelectedKeys.current = newSelectedKeys;
      newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData, newSelectedKeys, fieldNames);
    }
    (_a22 = props.onSelect) === null || _a22 === void 0 ? void 0 : _a22.call(props, newSelectedKeys, newEvent);
    if (!("selectedKeys" in props)) {
      setSelectedKeys(newSelectedKeys);
    }
  };
  const {
    getPrefixCls,
    direction
  } = reactExports.useContext(ConfigContext);
  const {
    prefixCls: customizePrefixCls,
    className,
    showIcon = true,
    expandAction = "click"
  } = props, otherProps = __rest$1(props, ["prefixCls", "className", "showIcon", "expandAction"]);
  const prefixCls = getPrefixCls("tree", customizePrefixCls);
  const connectClassName = classNames(`${prefixCls}-directory`, {
    [`${prefixCls}-directory-rtl`]: direction === "rtl"
  }, className);
  return /* @__PURE__ */ reactExports.createElement(Tree$2, Object.assign({
    icon: getIcon,
    ref,
    blockNode: true
  }, otherProps, {
    showIcon,
    expandAction,
    prefixCls,
    className: connectClassName,
    expandedKeys,
    selectedKeys,
    onSelect,
    onExpand
  }));
};
const ForwardDirectoryTree = /* @__PURE__ */ reactExports.forwardRef(DirectoryTree);
const Tree$1 = Tree$2;
Tree$1.DirectoryTree = ForwardDirectoryTree;
Tree$1.TreeNode = TreeNode;
const getAlphaColor = (baseColor, alpha2) => new FastColor(baseColor).setA(alpha2).toRgbString();
const getSolidColor = (baseColor, brightness) => {
  const instance2 = new FastColor(baseColor);
  return instance2.lighten(brightness).toHexString();
};
const generateColorPalettes = (baseColor) => {
  const colors2 = generate$1(baseColor, {
    theme: "dark"
  });
  return {
    1: colors2[0],
    2: colors2[1],
    3: colors2[2],
    4: colors2[3],
    5: colors2[6],
    6: colors2[5],
    7: colors2[4],
    8: colors2[6],
    9: colors2[5],
    10: colors2[4]
    // 8: colors[9],
    // 9: colors[8],
    // 10: colors[7],
  };
};
const generateNeutralColorPalettes = (bgBaseColor, textBaseColor) => {
  const colorBgBase = bgBaseColor || "#000";
  const colorTextBase = textBaseColor || "#fff";
  return {
    colorBgBase,
    colorTextBase,
    colorText: getAlphaColor(colorTextBase, 0.85),
    colorTextSecondary: getAlphaColor(colorTextBase, 0.65),
    colorTextTertiary: getAlphaColor(colorTextBase, 0.45),
    colorTextQuaternary: getAlphaColor(colorTextBase, 0.25),
    colorFill: getAlphaColor(colorTextBase, 0.18),
    colorFillSecondary: getAlphaColor(colorTextBase, 0.12),
    colorFillTertiary: getAlphaColor(colorTextBase, 0.08),
    colorFillQuaternary: getAlphaColor(colorTextBase, 0.04),
    colorBgSolid: getAlphaColor(colorTextBase, 0.95),
    colorBgSolidHover: getAlphaColor(colorTextBase, 1),
    colorBgSolidActive: getAlphaColor(colorTextBase, 0.9),
    colorBgElevated: getSolidColor(colorBgBase, 12),
    colorBgContainer: getSolidColor(colorBgBase, 8),
    colorBgLayout: getSolidColor(colorBgBase, 0),
    colorBgSpotlight: getSolidColor(colorBgBase, 26),
    colorBgBlur: getAlphaColor(colorTextBase, 0.04),
    colorBorder: getSolidColor(colorBgBase, 26),
    colorBorderSecondary: getSolidColor(colorBgBase, 19)
  };
};
const derivative = (token2, mapToken) => {
  const colorPalettes = Object.keys(defaultPresetColors).map((colorKey) => {
    const colors2 = generate$1(token2[colorKey], {
      theme: "dark"
    });
    return Array.from({
      length: 10
    }, () => 1).reduce((prev2, _24, i2) => {
      prev2[`${colorKey}-${i2 + 1}`] = colors2[i2];
      prev2[`${colorKey}${i2 + 1}`] = colors2[i2];
      return prev2;
    }, {});
  }).reduce((prev2, cur) => {
    prev2 = Object.assign(Object.assign({}, prev2), cur);
    return prev2;
  }, {});
  const mergedMapToken = mapToken !== null && mapToken !== void 0 ? mapToken : derivative$1(token2);
  const colorMapToken = genColorMapToken(token2, {
    generateColorPalettes,
    generateNeutralColorPalettes
  });
  return Object.assign(Object.assign(Object.assign(Object.assign({}, mergedMapToken), colorPalettes), colorMapToken), {
    // Customize selected item background color
    // https://github.com/ant-design/ant-design/issues/30524#issuecomment-871961867
    colorPrimaryBg: colorMapToken.colorPrimaryBorder,
    colorPrimaryBgHover: colorMapToken.colorPrimaryBorderHover
  });
};
const theme = {
  /** Default seedToken */
  defaultSeed: defaultConfig.token,
  defaultAlgorithm: derivative$1,
  darkAlgorithm: derivative
};
var duration$1 = { exports: {} };
(function(module2, exports2) {
  !function(t2, s2) {
    module2.exports = s2();
  }(commonjsGlobal, function() {
    var t2, s2, n2 = 1e3, i2 = 6e4, e2 = 36e5, r2 = 864e5, o2 = /\[([^\]]+)]|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, u2 = 31536e6, d2 = 2628e6, a2 = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, h3 = { years: u2, months: d2, days: r2, hours: e2, minutes: i2, seconds: n2, milliseconds: 1, weeks: 6048e5 }, c2 = function(t3) {
      return t3 instanceof g2;
    }, f2 = function(t3, s3, n3) {
      return new g2(t3, n3, s3.$l);
    }, m2 = function(t3) {
      return s2.p(t3) + "s";
    }, l2 = function(t3) {
      return t3 < 0;
    }, $ = function(t3) {
      return l2(t3) ? Math.ceil(t3) : Math.floor(t3);
    }, y2 = function(t3) {
      return Math.abs(t3);
    }, v2 = function(t3, s3) {
      return t3 ? l2(t3) ? { negative: true, format: "" + y2(t3) + s3 } : { negative: false, format: "" + t3 + s3 } : { negative: false, format: "" };
    }, g2 = function() {
      function l3(t3, s3, n3) {
        var i3 = this;
        if (this.$d = {}, this.$l = n3, void 0 === t3 && (this.$ms = 0, this.parseFromMilliseconds()), s3)
          return f2(t3 * h3[m2(s3)], this);
        if ("number" == typeof t3)
          return this.$ms = t3, this.parseFromMilliseconds(), this;
        if ("object" == typeof t3)
          return Object.keys(t3).forEach(function(s4) {
            i3.$d[m2(s4)] = t3[s4];
          }), this.calMilliseconds(), this;
        if ("string" == typeof t3) {
          var e3 = t3.match(a2);
          if (e3) {
            var r3 = e3.slice(2).map(function(t4) {
              return null != t4 ? Number(t4) : 0;
            });
            return this.$d.years = r3[0], this.$d.months = r3[1], this.$d.weeks = r3[2], this.$d.days = r3[3], this.$d.hours = r3[4], this.$d.minutes = r3[5], this.$d.seconds = r3[6], this.calMilliseconds(), this;
          }
        }
        return this;
      }
      var y3 = l3.prototype;
      return y3.calMilliseconds = function() {
        var t3 = this;
        this.$ms = Object.keys(this.$d).reduce(function(s3, n3) {
          return s3 + (t3.$d[n3] || 0) * h3[n3];
        }, 0);
      }, y3.parseFromMilliseconds = function() {
        var t3 = this.$ms;
        this.$d.years = $(t3 / u2), t3 %= u2, this.$d.months = $(t3 / d2), t3 %= d2, this.$d.days = $(t3 / r2), t3 %= r2, this.$d.hours = $(t3 / e2), t3 %= e2, this.$d.minutes = $(t3 / i2), t3 %= i2, this.$d.seconds = $(t3 / n2), t3 %= n2, this.$d.milliseconds = t3;
      }, y3.toISOString = function() {
        var t3 = v2(this.$d.years, "Y"), s3 = v2(this.$d.months, "M"), n3 = +this.$d.days || 0;
        this.$d.weeks && (n3 += 7 * this.$d.weeks);
        var i3 = v2(n3, "D"), e3 = v2(this.$d.hours, "H"), r3 = v2(this.$d.minutes, "M"), o3 = this.$d.seconds || 0;
        this.$d.milliseconds && (o3 += this.$d.milliseconds / 1e3, o3 = Math.round(1e3 * o3) / 1e3);
        var u3 = v2(o3, "S"), d3 = t3.negative || s3.negative || i3.negative || e3.negative || r3.negative || u3.negative, a3 = e3.format || r3.format || u3.format ? "T" : "", h4 = (d3 ? "-" : "") + "P" + t3.format + s3.format + i3.format + a3 + e3.format + r3.format + u3.format;
        return "P" === h4 || "-P" === h4 ? "P0D" : h4;
      }, y3.toJSON = function() {
        return this.toISOString();
      }, y3.format = function(t3) {
        var n3 = t3 || "YYYY-MM-DDTHH:mm:ss", i3 = { Y: this.$d.years, YY: s2.s(this.$d.years, 2, "0"), YYYY: s2.s(this.$d.years, 4, "0"), M: this.$d.months, MM: s2.s(this.$d.months, 2, "0"), D: this.$d.days, DD: s2.s(this.$d.days, 2, "0"), H: this.$d.hours, HH: s2.s(this.$d.hours, 2, "0"), m: this.$d.minutes, mm: s2.s(this.$d.minutes, 2, "0"), s: this.$d.seconds, ss: s2.s(this.$d.seconds, 2, "0"), SSS: s2.s(this.$d.milliseconds, 3, "0") };
        return n3.replace(o2, function(t4, s3) {
          return s3 || String(i3[t4]);
        });
      }, y3.as = function(t3) {
        return this.$ms / h3[m2(t3)];
      }, y3.get = function(t3) {
        var s3 = this.$ms, n3 = m2(t3);
        return "milliseconds" === n3 ? s3 %= 1e3 : s3 = "weeks" === n3 ? $(s3 / h3[n3]) : this.$d[n3], s3 || 0;
      }, y3.add = function(t3, s3, n3) {
        var i3;
        return i3 = s3 ? t3 * h3[m2(s3)] : c2(t3) ? t3.$ms : f2(t3, this).$ms, f2(this.$ms + i3 * (n3 ? -1 : 1), this);
      }, y3.subtract = function(t3, s3) {
        return this.add(t3, s3, true);
      }, y3.locale = function(t3) {
        var s3 = this.clone();
        return s3.$l = t3, s3;
      }, y3.clone = function() {
        return f2(this.$ms, this);
      }, y3.humanize = function(s3) {
        return t2().add(this.$ms, "ms").locale(this.$l).fromNow(!s3);
      }, y3.valueOf = function() {
        return this.asMilliseconds();
      }, y3.milliseconds = function() {
        return this.get("milliseconds");
      }, y3.asMilliseconds = function() {
        return this.as("milliseconds");
      }, y3.seconds = function() {
        return this.get("seconds");
      }, y3.asSeconds = function() {
        return this.as("seconds");
      }, y3.minutes = function() {
        return this.get("minutes");
      }, y3.asMinutes = function() {
        return this.as("minutes");
      }, y3.hours = function() {
        return this.get("hours");
      }, y3.asHours = function() {
        return this.as("hours");
      }, y3.days = function() {
        return this.get("days");
      }, y3.asDays = function() {
        return this.as("days");
      }, y3.weeks = function() {
        return this.get("weeks");
      }, y3.asWeeks = function() {
        return this.as("weeks");
      }, y3.months = function() {
        return this.get("months");
      }, y3.asMonths = function() {
        return this.as("months");
      }, y3.years = function() {
        return this.get("years");
      }, y3.asYears = function() {
        return this.as("years");
      }, l3;
    }(), p2 = function(t3, s3, n3) {
      return t3.add(s3.years() * n3, "y").add(s3.months() * n3, "M").add(s3.days() * n3, "d").add(s3.hours() * n3, "h").add(s3.minutes() * n3, "m").add(s3.seconds() * n3, "s").add(s3.milliseconds() * n3, "ms");
    };
    return function(n3, i3, e3) {
      t2 = e3, s2 = e3().$utils(), e3.duration = function(t3, s3) {
        var n4 = e3.locale();
        return f2(t3, { $l: n4 }, s3);
      }, e3.isDuration = c2;
      var r3 = i3.prototype.add, o3 = i3.prototype.subtract;
      i3.prototype.add = function(t3, s3) {
        return c2(t3) ? p2(this, t3, 1) : r3.bind(this)(t3, s3);
      }, i3.prototype.subtract = function(t3, s3) {
        return c2(t3) ? p2(this, t3, -1) : o3.bind(this)(t3, s3);
      };
    };
  });
})(duration$1);
var durationExports = duration$1.exports;
const duration = /* @__PURE__ */ getDefaultExportFromCjs(durationExports);
class HttpError extends Error {
  /** Constructs a new instance of {@link @microsoft/signalr.HttpError}.
   *
   * @param {string} errorMessage A descriptive error message.
   * @param {number} statusCode The HTTP status code represented by this error.
   */
  constructor(errorMessage, statusCode) {
    const trueProto = new.target.prototype;
    super(`${errorMessage}: Status code '${statusCode}'`);
    this.statusCode = statusCode;
    this.__proto__ = trueProto;
  }
}
class TimeoutError extends Error {
  /** Constructs a new instance of {@link @microsoft/signalr.TimeoutError}.
   *
   * @param {string} errorMessage A descriptive error message.
   */
  constructor(errorMessage = "A timeout occurred.") {
    const trueProto = new.target.prototype;
    super(errorMessage);
    this.__proto__ = trueProto;
  }
}
class AbortError extends Error {
  /** Constructs a new instance of {@link AbortError}.
   *
   * @param {string} errorMessage A descriptive error message.
   */
  constructor(errorMessage = "An abort occurred.") {
    const trueProto = new.target.prototype;
    super(errorMessage);
    this.__proto__ = trueProto;
  }
}
class UnsupportedTransportError extends Error {
  /** Constructs a new instance of {@link @microsoft/signalr.UnsupportedTransportError}.
   *
   * @param {string} message A descriptive error message.
   * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.
   */
  constructor(message, transport) {
    const trueProto = new.target.prototype;
    super(message);
    this.transport = transport;
    this.errorType = "UnsupportedTransportError";
    this.__proto__ = trueProto;
  }
}
class DisabledTransportError extends Error {
  /** Constructs a new instance of {@link @microsoft/signalr.DisabledTransportError}.
   *
   * @param {string} message A descriptive error message.
   * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.
   */
  constructor(message, transport) {
    const trueProto = new.target.prototype;
    super(message);
    this.transport = transport;
    this.errorType = "DisabledTransportError";
    this.__proto__ = trueProto;
  }
}
class FailedToStartTransportError extends Error {
  /** Constructs a new instance of {@link @microsoft/signalr.FailedToStartTransportError}.
   *
   * @param {string} message A descriptive error message.
   * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.
   */
  constructor(message, transport) {
    const trueProto = new.target.prototype;
    super(message);
    this.transport = transport;
    this.errorType = "FailedToStartTransportError";
    this.__proto__ = trueProto;
  }
}
class FailedToNegotiateWithServerError extends Error {
  /** Constructs a new instance of {@link @microsoft/signalr.FailedToNegotiateWithServerError}.
   *
   * @param {string} message A descriptive error message.
   */
  constructor(message) {
    const trueProto = new.target.prototype;
    super(message);
    this.errorType = "FailedToNegotiateWithServerError";
    this.__proto__ = trueProto;
  }
}
class AggregateErrors extends Error {
  /** Constructs a new instance of {@link @microsoft/signalr.AggregateErrors}.
   *
   * @param {string} message A descriptive error message.
   * @param {Error[]} innerErrors The collection of errors this error is aggregating.
   */
  constructor(message, innerErrors) {
    const trueProto = new.target.prototype;
    super(message);
    this.innerErrors = innerErrors;
    this.__proto__ = trueProto;
  }
}
class HttpResponse {
  constructor(statusCode, statusText, content2) {
    this.statusCode = statusCode;
    this.statusText = statusText;
    this.content = content2;
  }
}
let HttpClient$1 = class HttpClient {
  get(url2, options) {
    return this.send({
      ...options,
      method: "GET",
      url: url2
    });
  }
  post(url2, options) {
    return this.send({
      ...options,
      method: "POST",
      url: url2
    });
  }
  delete(url2, options) {
    return this.send({
      ...options,
      method: "DELETE",
      url: url2
    });
  }
  /** Gets all cookies that apply to the specified URL.
   *
   * @param url The URL that the cookies are valid for.
   * @returns {string} A string containing all the key-value cookie pairs for the specified URL.
   */
  // @ts-ignore
  getCookieString(url2) {
    return "";
  }
};
var LogLevel$1;
(function(LogLevel2) {
  LogLevel2[LogLevel2["Trace"] = 0] = "Trace";
  LogLevel2[LogLevel2["Debug"] = 1] = "Debug";
  LogLevel2[LogLevel2["Information"] = 2] = "Information";
  LogLevel2[LogLevel2["Warning"] = 3] = "Warning";
  LogLevel2[LogLevel2["Error"] = 4] = "Error";
  LogLevel2[LogLevel2["Critical"] = 5] = "Critical";
  LogLevel2[LogLevel2["None"] = 6] = "None";
})(LogLevel$1 || (LogLevel$1 = {}));
class NullLogger {
  constructor() {
  }
  /** @inheritDoc */
  // eslint-disable-next-line
  log(_logLevel, _message) {
  }
}
NullLogger.instance = new NullLogger();
const VERSION$2 = "7.0.14";
class Arg {
  static isRequired(val, name2) {
    if (val === null || val === void 0) {
      throw new Error(`The '${name2}' argument is required.`);
    }
  }
  static isNotEmpty(val, name2) {
    if (!val || val.match(/^\s*$/)) {
      throw new Error(`The '${name2}' argument should not be empty.`);
    }
  }
  static isIn(val, values, name2) {
    if (!(val in values)) {
      throw new Error(`Unknown ${name2} value: ${val}.`);
    }
  }
}
class Platform {
  // react-native has a window but no document so we should check both
  static get isBrowser() {
    return typeof window === "object" && typeof window.document === "object";
  }
  // WebWorkers don't have a window object so the isBrowser check would fail
  static get isWebWorker() {
    return typeof self === "object" && "importScripts" in self;
  }
  // react-native has a window but no document
  static get isReactNative() {
    return typeof window === "object" && typeof window.document === "undefined";
  }
  // Node apps shouldn't have a window object, but WebWorkers don't either
  // so we need to check for both WebWorker and window
  static get isNode() {
    return !this.isBrowser && !this.isWebWorker && !this.isReactNative;
  }
}
function getDataDetail(data, includeContent) {
  let detail = "";
  if (isArrayBuffer$1(data)) {
    detail = `Binary data of length ${data.byteLength}`;
    if (includeContent) {
      detail += `. Content: '${formatArrayBuffer(data)}'`;
    }
  } else if (typeof data === "string") {
    detail = `String data of length ${data.length}`;
    if (includeContent) {
      detail += `. Content: '${data}'`;
    }
  }
  return detail;
}
function formatArrayBuffer(data) {
  const view = new Uint8Array(data);
  let str = "";
  view.forEach((num) => {
    const pad = num < 16 ? "0" : "";
    str += `0x${pad}${num.toString(16)} `;
  });
  return str.substr(0, str.length - 1);
}
function isArrayBuffer$1(val) {
  return val && typeof ArrayBuffer !== "undefined" && (val instanceof ArrayBuffer || // Sometimes we get an ArrayBuffer that doesn't satisfy instanceof
  val.constructor && val.constructor.name === "ArrayBuffer");
}
async function sendMessage(logger, transportName, httpClient, url2, content2, options) {
  const headers = {};
  const [name2, value2] = getUserAgentHeader();
  headers[name2] = value2;
  logger.log(LogLevel$1.Trace, `(${transportName} transport) sending data. ${getDataDetail(content2, options.logMessageContent)}.`);
  const responseType = isArrayBuffer$1(content2) ? "arraybuffer" : "text";
  const response = await httpClient.post(url2, {
    content: content2,
    headers: { ...headers, ...options.headers },
    responseType,
    timeout: options.timeout,
    withCredentials: options.withCredentials
  });
  logger.log(LogLevel$1.Trace, `(${transportName} transport) request complete. Response status: ${response.statusCode}.`);
}
function createLogger(logger) {
  if (logger === void 0) {
    return new ConsoleLogger(LogLevel$1.Information);
  }
  if (logger === null) {
    return NullLogger.instance;
  }
  if (logger.log !== void 0) {
    return logger;
  }
  return new ConsoleLogger(logger);
}
class SubjectSubscription {
  constructor(subject, observer) {
    this._subject = subject;
    this._observer = observer;
  }
  dispose() {
    const index2 = this._subject.observers.indexOf(this._observer);
    if (index2 > -1) {
      this._subject.observers.splice(index2, 1);
    }
    if (this._subject.observers.length === 0 && this._subject.cancelCallback) {
      this._subject.cancelCallback().catch((_24) => {
      });
    }
  }
}
class ConsoleLogger {
  constructor(minimumLogLevel) {
    this._minLevel = minimumLogLevel;
    this.out = console;
  }
  log(logLevel, message) {
    if (logLevel >= this._minLevel) {
      const msg = `[${(/* @__PURE__ */ new Date()).toISOString()}] ${LogLevel$1[logLevel]}: ${message}`;
      switch (logLevel) {
        case LogLevel$1.Critical:
        case LogLevel$1.Error:
          this.out.error(msg);
          break;
        case LogLevel$1.Warning:
          this.out.warn(msg);
          break;
        case LogLevel$1.Information:
          this.out.info(msg);
          break;
        default:
          this.out.log(msg);
          break;
      }
    }
  }
}
function getUserAgentHeader() {
  let userAgentHeaderName = "X-SignalR-User-Agent";
  if (Platform.isNode) {
    userAgentHeaderName = "User-Agent";
  }
  return [userAgentHeaderName, constructUserAgent(VERSION$2, getOsName(), getRuntime(), getRuntimeVersion())];
}
function constructUserAgent(version2, os, runtime, runtimeVersion) {
  let userAgent = "Microsoft SignalR/";
  const majorAndMinor = version2.split(".");
  userAgent += `${majorAndMinor[0]}.${majorAndMinor[1]}`;
  userAgent += ` (${version2}; `;
  if (os && os !== "") {
    userAgent += `${os}; `;
  } else {
    userAgent += "Unknown OS; ";
  }
  userAgent += `${runtime}`;
  if (runtimeVersion) {
    userAgent += `; ${runtimeVersion}`;
  } else {
    userAgent += "; Unknown Runtime Version";
  }
  userAgent += ")";
  return userAgent;
}
function getOsName() {
  if (Platform.isNode) {
    switch (process.platform) {
      case "win32":
        return "Windows NT";
      case "darwin":
        return "macOS";
      case "linux":
        return "Linux";
      default:
        return process.platform;
    }
  } else {
    return "";
  }
}
function getRuntimeVersion() {
  if (Platform.isNode) {
    return process.versions.node;
  }
  return void 0;
}
function getRuntime() {
  if (Platform.isNode) {
    return "NodeJS";
  } else {
    return "Browser";
  }
}
function getErrorString(e2) {
  if (e2.stack) {
    return e2.stack;
  } else if (e2.message) {
    return e2.message;
  }
  return `${e2}`;
}
function getGlobalThis() {
  if (typeof globalThis !== "undefined") {
    return globalThis;
  }
  if (typeof self !== "undefined") {
    return self;
  }
  if (typeof window !== "undefined") {
    return window;
  }
  if (typeof global !== "undefined") {
    return global;
  }
  throw new Error("could not find global");
}
class FetchHttpClient extends HttpClient$1 {
  constructor(logger) {
    super();
    this._logger = logger;
    if (typeof fetch === "undefined") {
      const requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require;
      this._jar = new (requireFunc("tough-cookie")).CookieJar();
      this._fetchType = requireFunc("node-fetch");
      this._fetchType = requireFunc("fetch-cookie")(this._fetchType, this._jar);
    } else {
      this._fetchType = fetch.bind(getGlobalThis());
    }
    if (typeof AbortController === "undefined") {
      const requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require;
      this._abortControllerType = requireFunc("abort-controller");
    } else {
      this._abortControllerType = AbortController;
    }
  }
  /** @inheritDoc */
  async send(request2) {
    if (request2.abortSignal && request2.abortSignal.aborted) {
      throw new AbortError();
    }
    if (!request2.method) {
      throw new Error("No method defined.");
    }
    if (!request2.url) {
      throw new Error("No url defined.");
    }
    const abortController = new this._abortControllerType();
    let error2;
    if (request2.abortSignal) {
      request2.abortSignal.onabort = () => {
        abortController.abort();
        error2 = new AbortError();
      };
    }
    let timeoutId = null;
    if (request2.timeout) {
      const msTimeout = request2.timeout;
      timeoutId = setTimeout(() => {
        abortController.abort();
        this._logger.log(LogLevel$1.Warning, `Timeout from HTTP request.`);
        error2 = new TimeoutError();
      }, msTimeout);
    }
    if (request2.content === "") {
      request2.content = void 0;
    }
    if (request2.content) {
      request2.headers = request2.headers || {};
      if (isArrayBuffer$1(request2.content)) {
        request2.headers["Content-Type"] = "application/octet-stream";
      } else {
        request2.headers["Content-Type"] = "text/plain;charset=UTF-8";
      }
    }
    let response;
    try {
      response = await this._fetchType(request2.url, {
        body: request2.content,
        cache: "no-cache",
        credentials: request2.withCredentials === true ? "include" : "same-origin",
        headers: {
          "X-Requested-With": "XMLHttpRequest",
          ...request2.headers
        },
        method: request2.method,
        mode: "cors",
        redirect: "follow",
        signal: abortController.signal
      });
    } catch (e2) {
      if (error2) {
        throw error2;
      }
      this._logger.log(LogLevel$1.Warning, `Error from HTTP request. ${e2}.`);
      throw e2;
    } finally {
      if (timeoutId) {
        clearTimeout(timeoutId);
      }
      if (request2.abortSignal) {
        request2.abortSignal.onabort = null;
      }
    }
    if (!response.ok) {
      const errorMessage = await deserializeContent(response, "text");
      throw new HttpError(errorMessage || response.statusText, response.status);
    }
    const content2 = deserializeContent(response, request2.responseType);
    const payload = await content2;
    return new HttpResponse(response.status, response.statusText, payload);
  }
  getCookieString(url2) {
    let cookies2 = "";
    if (Platform.isNode && this._jar) {
      this._jar.getCookies(url2, (e2, c2) => cookies2 = c2.join("; "));
    }
    return cookies2;
  }
}
function deserializeContent(response, responseType) {
  let content2;
  switch (responseType) {
    case "arraybuffer":
      content2 = response.arrayBuffer();
      break;
    case "text":
      content2 = response.text();
      break;
    case "blob":
    case "document":
    case "json":
      throw new Error(`${responseType} is not supported.`);
    default:
      content2 = response.text();
      break;
  }
  return content2;
}
class XhrHttpClient extends HttpClient$1 {
  constructor(logger) {
    super();
    this._logger = logger;
  }
  /** @inheritDoc */
  send(request2) {
    if (request2.abortSignal && request2.abortSignal.aborted) {
      return Promise.reject(new AbortError());
    }
    if (!request2.method) {
      return Promise.reject(new Error("No method defined."));
    }
    if (!request2.url) {
      return Promise.reject(new Error("No url defined."));
    }
    return new Promise((resolve2, reject) => {
      const xhr = new XMLHttpRequest();
      xhr.open(request2.method, request2.url, true);
      xhr.withCredentials = request2.withCredentials === void 0 ? true : request2.withCredentials;
      xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
      if (request2.content === "") {
        request2.content = void 0;
      }
      if (request2.content) {
        if (isArrayBuffer$1(request2.content)) {
          xhr.setRequestHeader("Content-Type", "application/octet-stream");
        } else {
          xhr.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");
        }
      }
      const headers = request2.headers;
      if (headers) {
        Object.keys(headers).forEach((header) => {
          xhr.setRequestHeader(header, headers[header]);
        });
      }
      if (request2.responseType) {
        xhr.responseType = request2.responseType;
      }
      if (request2.abortSignal) {
        request2.abortSignal.onabort = () => {
          xhr.abort();
          reject(new AbortError());
        };
      }
      if (request2.timeout) {
        xhr.timeout = request2.timeout;
      }
      xhr.onload = () => {
        if (request2.abortSignal) {
          request2.abortSignal.onabort = null;
        }
        if (xhr.status >= 200 && xhr.status < 300) {
          resolve2(new HttpResponse(xhr.status, xhr.statusText, xhr.response || xhr.responseText));
        } else {
          reject(new HttpError(xhr.response || xhr.responseText || xhr.statusText, xhr.status));
        }
      };
      xhr.onerror = () => {
        this._logger.log(LogLevel$1.Warning, `Error from HTTP request. ${xhr.status}: ${xhr.statusText}.`);
        reject(new HttpError(xhr.statusText, xhr.status));
      };
      xhr.ontimeout = () => {
        this._logger.log(LogLevel$1.Warning, `Timeout from HTTP request.`);
        reject(new TimeoutError());
      };
      xhr.send(request2.content);
    });
  }
}
class DefaultHttpClient extends HttpClient$1 {
  /** Creates a new instance of the {@link @microsoft/signalr.DefaultHttpClient}, using the provided {@link @microsoft/signalr.ILogger} to log messages. */
  constructor(logger) {
    super();
    if (typeof fetch !== "undefined" || Platform.isNode) {
      this._httpClient = new FetchHttpClient(logger);
    } else if (typeof XMLHttpRequest !== "undefined") {
      this._httpClient = new XhrHttpClient(logger);
    } else {
      throw new Error("No usable HttpClient found.");
    }
  }
  /** @inheritDoc */
  send(request2) {
    if (request2.abortSignal && request2.abortSignal.aborted) {
      return Promise.reject(new AbortError());
    }
    if (!request2.method) {
      return Promise.reject(new Error("No method defined."));
    }
    if (!request2.url) {
      return Promise.reject(new Error("No url defined."));
    }
    return this._httpClient.send(request2);
  }
  getCookieString(url2) {
    return this._httpClient.getCookieString(url2);
  }
}
class TextMessageFormat {
  static write(output2) {
    return `${output2}${TextMessageFormat.RecordSeparator}`;
  }
  static parse(input2) {
    if (input2[input2.length - 1] !== TextMessageFormat.RecordSeparator) {
      throw new Error("Message is incomplete.");
    }
    const messages2 = input2.split(TextMessageFormat.RecordSeparator);
    messages2.pop();
    return messages2;
  }
}
TextMessageFormat.RecordSeparatorCode = 30;
TextMessageFormat.RecordSeparator = String.fromCharCode(TextMessageFormat.RecordSeparatorCode);
class HandshakeProtocol {
  // Handshake request is always JSON
  writeHandshakeRequest(handshakeRequest) {
    return TextMessageFormat.write(JSON.stringify(handshakeRequest));
  }
  parseHandshakeResponse(data) {
    let messageData;
    let remainingData;
    if (isArrayBuffer$1(data)) {
      const binaryData = new Uint8Array(data);
      const separatorIndex = binaryData.indexOf(TextMessageFormat.RecordSeparatorCode);
      if (separatorIndex === -1) {
        throw new Error("Message is incomplete.");
      }
      const responseLength = separatorIndex + 1;
      messageData = String.fromCharCode.apply(null, Array.prototype.slice.call(binaryData.slice(0, responseLength)));
      remainingData = binaryData.byteLength > responseLength ? binaryData.slice(responseLength).buffer : null;
    } else {
      const textData = data;
      const separatorIndex = textData.indexOf(TextMessageFormat.RecordSeparator);
      if (separatorIndex === -1) {
        throw new Error("Message is incomplete.");
      }
      const responseLength = separatorIndex + 1;
      messageData = textData.substring(0, responseLength);
      remainingData = textData.length > responseLength ? textData.substring(responseLength) : null;
    }
    const messages2 = TextMessageFormat.parse(messageData);
    const response = JSON.parse(messages2[0]);
    if (response.type) {
      throw new Error("Expected a handshake response from the server.");
    }
    const responseMessage = response;
    return [remainingData, responseMessage];
  }
}
var MessageType;
(function(MessageType2) {
  MessageType2[MessageType2["Invocation"] = 1] = "Invocation";
  MessageType2[MessageType2["StreamItem"] = 2] = "StreamItem";
  MessageType2[MessageType2["Completion"] = 3] = "Completion";
  MessageType2[MessageType2["StreamInvocation"] = 4] = "StreamInvocation";
  MessageType2[MessageType2["CancelInvocation"] = 5] = "CancelInvocation";
  MessageType2[MessageType2["Ping"] = 6] = "Ping";
  MessageType2[MessageType2["Close"] = 7] = "Close";
})(MessageType || (MessageType = {}));
class Subject {
  constructor() {
    this.observers = [];
  }
  next(item) {
    for (const observer of this.observers) {
      observer.next(item);
    }
  }
  error(err) {
    for (const observer of this.observers) {
      if (observer.error) {
        observer.error(err);
      }
    }
  }
  complete() {
    for (const observer of this.observers) {
      if (observer.complete) {
        observer.complete();
      }
    }
  }
  subscribe(observer) {
    this.observers.push(observer);
    return new SubjectSubscription(this, observer);
  }
}
const DEFAULT_TIMEOUT_IN_MS = 30 * 1e3;
const DEFAULT_PING_INTERVAL_IN_MS = 15 * 1e3;
var HubConnectionState;
(function(HubConnectionState2) {
  HubConnectionState2["Disconnected"] = "Disconnected";
  HubConnectionState2["Connecting"] = "Connecting";
  HubConnectionState2["Connected"] = "Connected";
  HubConnectionState2["Disconnecting"] = "Disconnecting";
  HubConnectionState2["Reconnecting"] = "Reconnecting";
})(HubConnectionState || (HubConnectionState = {}));
class HubConnection {
  constructor(connection, logger, protocol, reconnectPolicy) {
    this._nextKeepAlive = 0;
    this._freezeEventListener = () => {
      this._logger.log(LogLevel$1.Warning, "The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://docs.microsoft.com/aspnet/core/signalr/javascript-client#bsleep");
    };
    Arg.isRequired(connection, "connection");
    Arg.isRequired(logger, "logger");
    Arg.isRequired(protocol, "protocol");
    this.serverTimeoutInMilliseconds = DEFAULT_TIMEOUT_IN_MS;
    this.keepAliveIntervalInMilliseconds = DEFAULT_PING_INTERVAL_IN_MS;
    this._logger = logger;
    this._protocol = protocol;
    this.connection = connection;
    this._reconnectPolicy = reconnectPolicy;
    this._handshakeProtocol = new HandshakeProtocol();
    this.connection.onreceive = (data) => this._processIncomingData(data);
    this.connection.onclose = (error2) => this._connectionClosed(error2);
    this._callbacks = {};
    this._methods = {};
    this._closedCallbacks = [];
    this._reconnectingCallbacks = [];
    this._reconnectedCallbacks = [];
    this._invocationId = 0;
    this._receivedHandshakeResponse = false;
    this._connectionState = HubConnectionState.Disconnected;
    this._connectionStarted = false;
    this._cachedPingMessage = this._protocol.writeMessage({ type: MessageType.Ping });
  }
  /** @internal */
  // Using a public static factory method means we can have a private constructor and an _internal_
  // create method that can be used by HubConnectionBuilder. An "internal" constructor would just
  // be stripped away and the '.d.ts' file would have no constructor, which is interpreted as a
  // public parameter-less constructor.
  static create(connection, logger, protocol, reconnectPolicy) {
    return new HubConnection(connection, logger, protocol, reconnectPolicy);
  }
  /** Indicates the state of the {@link HubConnection} to the server. */
  get state() {
    return this._connectionState;
  }
  /** Represents the connection id of the {@link HubConnection} on the server. The connection id will be null when the connection is either
   *  in the disconnected state or if the negotiation step was skipped.
   */
  get connectionId() {
    return this.connection ? this.connection.connectionId || null : null;
  }
  /** Indicates the url of the {@link HubConnection} to the server. */
  get baseUrl() {
    return this.connection.baseUrl || "";
  }
  /**
   * Sets a new url for the HubConnection. Note that the url can only be changed when the connection is in either the Disconnected or
   * Reconnecting states.
   * @param {string} url The url to connect to.
   */
  set baseUrl(url2) {
    if (this._connectionState !== HubConnectionState.Disconnected && this._connectionState !== HubConnectionState.Reconnecting) {
      throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");
    }
    if (!url2) {
      throw new Error("The HubConnection url must be a valid url.");
    }
    this.connection.baseUrl = url2;
  }
  /** Starts the connection.
   *
   * @returns {Promise<void>} A Promise that resolves when the connection has been successfully established, or rejects with an error.
   */
  start() {
    this._startPromise = this._startWithStateTransitions();
    return this._startPromise;
  }
  async _startWithStateTransitions() {
    if (this._connectionState !== HubConnectionState.Disconnected) {
      return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));
    }
    this._connectionState = HubConnectionState.Connecting;
    this._logger.log(LogLevel$1.Debug, "Starting HubConnection.");
    try {
      await this._startInternal();
      if (Platform.isBrowser) {
        window.document.addEventListener("freeze", this._freezeEventListener);
      }
      this._connectionState = HubConnectionState.Connected;
      this._connectionStarted = true;
      this._logger.log(LogLevel$1.Debug, "HubConnection connected successfully.");
    } catch (e2) {
      this._connectionState = HubConnectionState.Disconnected;
      this._logger.log(LogLevel$1.Debug, `HubConnection failed to start successfully because of error '${e2}'.`);
      return Promise.reject(e2);
    }
  }
  async _startInternal() {
    this._stopDuringStartError = void 0;
    this._receivedHandshakeResponse = false;
    const handshakePromise = new Promise((resolve2, reject) => {
      this._handshakeResolver = resolve2;
      this._handshakeRejecter = reject;
    });
    await this.connection.start(this._protocol.transferFormat);
    try {
      const handshakeRequest = {
        protocol: this._protocol.name,
        version: this._protocol.version
      };
      this._logger.log(LogLevel$1.Debug, "Sending handshake request.");
      await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(handshakeRequest));
      this._logger.log(LogLevel$1.Information, `Using HubProtocol '${this._protocol.name}'.`);
      this._cleanupTimeout();
      this._resetTimeoutPeriod();
      this._resetKeepAliveInterval();
      await handshakePromise;
      if (this._stopDuringStartError) {
        throw this._stopDuringStartError;
      }
      if (!this.connection.features.inherentKeepAlive) {
        await this._sendMessage(this._cachedPingMessage);
      }
    } catch (e2) {
      this._logger.log(LogLevel$1.Debug, `Hub handshake failed with error '${e2}' during start(). Stopping HubConnection.`);
      this._cleanupTimeout();
      this._cleanupPingTimer();
      await this.connection.stop(e2);
      throw e2;
    }
  }
  /** Stops the connection.
   *
   * @returns {Promise<void>} A Promise that resolves when the connection has been successfully terminated, or rejects with an error.
   */
  async stop() {
    const startPromise = this._startPromise;
    this._stopPromise = this._stopInternal();
    await this._stopPromise;
    try {
      await startPromise;
    } catch (e2) {
    }
  }
  _stopInternal(error2) {
    if (this._connectionState === HubConnectionState.Disconnected) {
      this._logger.log(LogLevel$1.Debug, `Call to HubConnection.stop(${error2}) ignored because it is already in the disconnected state.`);
      return Promise.resolve();
    }
    if (this._connectionState === HubConnectionState.Disconnecting) {
      this._logger.log(LogLevel$1.Debug, `Call to HttpConnection.stop(${error2}) ignored because the connection is already in the disconnecting state.`);
      return this._stopPromise;
    }
    this._connectionState = HubConnectionState.Disconnecting;
    this._logger.log(LogLevel$1.Debug, "Stopping HubConnection.");
    if (this._reconnectDelayHandle) {
      this._logger.log(LogLevel$1.Debug, "Connection stopped during reconnect delay. Done reconnecting.");
      clearTimeout(this._reconnectDelayHandle);
      this._reconnectDelayHandle = void 0;
      this._completeClose();
      return Promise.resolve();
    }
    this._cleanupTimeout();
    this._cleanupPingTimer();
    this._stopDuringStartError = error2 || new AbortError("The connection was stopped before the hub handshake could complete.");
    return this.connection.stop(error2);
  }
  /** Invokes a streaming hub method on the server using the specified name and arguments.
   *
   * @typeparam T The type of the items returned by the server.
   * @param {string} methodName The name of the server method to invoke.
   * @param {any[]} args The arguments used to invoke the server method.
   * @returns {IStreamResult<T>} An object that yields results from the server as they are received.
   */
  stream(methodName, ...args) {
    const [streams, streamIds] = this._replaceStreamingParams(args);
    const invocationDescriptor = this._createStreamInvocation(methodName, args, streamIds);
    let promiseQueue;
    const subject = new Subject();
    subject.cancelCallback = () => {
      const cancelInvocation = this._createCancelInvocation(invocationDescriptor.invocationId);
      delete this._callbacks[invocationDescriptor.invocationId];
      return promiseQueue.then(() => {
        return this._sendWithProtocol(cancelInvocation);
      });
    };
    this._callbacks[invocationDescriptor.invocationId] = (invocationEvent, error2) => {
      if (error2) {
        subject.error(error2);
        return;
      } else if (invocationEvent) {
        if (invocationEvent.type === MessageType.Completion) {
          if (invocationEvent.error) {
            subject.error(new Error(invocationEvent.error));
          } else {
            subject.complete();
          }
        } else {
          subject.next(invocationEvent.item);
        }
      }
    };
    promiseQueue = this._sendWithProtocol(invocationDescriptor).catch((e2) => {
      subject.error(e2);
      delete this._callbacks[invocationDescriptor.invocationId];
    });
    this._launchStreams(streams, promiseQueue);
    return subject;
  }
  _sendMessage(message) {
    this._resetKeepAliveInterval();
    return this.connection.send(message);
  }
  /**
   * Sends a js object to the server.
   * @param message The js object to serialize and send.
   */
  _sendWithProtocol(message) {
    return this._sendMessage(this._protocol.writeMessage(message));
  }
  /** Invokes a hub method on the server using the specified name and arguments. Does not wait for a response from the receiver.
   *
   * The Promise returned by this method resolves when the client has sent the invocation to the server. The server may still
   * be processing the invocation.
   *
   * @param {string} methodName The name of the server method to invoke.
   * @param {any[]} args The arguments used to invoke the server method.
   * @returns {Promise<void>} A Promise that resolves when the invocation has been successfully sent, or rejects with an error.
   */
  send(methodName, ...args) {
    const [streams, streamIds] = this._replaceStreamingParams(args);
    const sendPromise = this._sendWithProtocol(this._createInvocation(methodName, args, true, streamIds));
    this._launchStreams(streams, sendPromise);
    return sendPromise;
  }
  /** Invokes a hub method on the server using the specified name and arguments.
   *
   * The Promise returned by this method resolves when the server indicates it has finished invoking the method. When the promise
   * resolves, the server has finished invoking the method. If the server method returns a result, it is produced as the result of
   * resolving the Promise.
   *
   * @typeparam T The expected return type.
   * @param {string} methodName The name of the server method to invoke.
   * @param {any[]} args The arguments used to invoke the server method.
   * @returns {Promise<T>} A Promise that resolves with the result of the server method (if any), or rejects with an error.
   */
  invoke(methodName, ...args) {
    const [streams, streamIds] = this._replaceStreamingParams(args);
    const invocationDescriptor = this._createInvocation(methodName, args, false, streamIds);
    const p2 = new Promise((resolve2, reject) => {
      this._callbacks[invocationDescriptor.invocationId] = (invocationEvent, error2) => {
        if (error2) {
          reject(error2);
          return;
        } else if (invocationEvent) {
          if (invocationEvent.type === MessageType.Completion) {
            if (invocationEvent.error) {
              reject(new Error(invocationEvent.error));
            } else {
              resolve2(invocationEvent.result);
            }
          } else {
            reject(new Error(`Unexpected message type: ${invocationEvent.type}`));
          }
        }
      };
      const promiseQueue = this._sendWithProtocol(invocationDescriptor).catch((e2) => {
        reject(e2);
        delete this._callbacks[invocationDescriptor.invocationId];
      });
      this._launchStreams(streams, promiseQueue);
    });
    return p2;
  }
  on(methodName, newMethod) {
    if (!methodName || !newMethod) {
      return;
    }
    methodName = methodName.toLowerCase();
    if (!this._methods[methodName]) {
      this._methods[methodName] = [];
    }
    if (this._methods[methodName].indexOf(newMethod) !== -1) {
      return;
    }
    this._methods[methodName].push(newMethod);
  }
  off(methodName, method4) {
    if (!methodName) {
      return;
    }
    methodName = methodName.toLowerCase();
    const handlers2 = this._methods[methodName];
    if (!handlers2) {
      return;
    }
    if (method4) {
      const removeIdx = handlers2.indexOf(method4);
      if (removeIdx !== -1) {
        handlers2.splice(removeIdx, 1);
        if (handlers2.length === 0) {
          delete this._methods[methodName];
        }
      }
    } else {
      delete this._methods[methodName];
    }
  }
  /** Registers a handler that will be invoked when the connection is closed.
   *
   * @param {Function} callback The handler that will be invoked when the connection is closed. Optionally receives a single argument containing the error that caused the connection to close (if any).
   */
  onclose(callback2) {
    if (callback2) {
      this._closedCallbacks.push(callback2);
    }
  }
  /** Registers a handler that will be invoked when the connection starts reconnecting.
   *
   * @param {Function} callback The handler that will be invoked when the connection starts reconnecting. Optionally receives a single argument containing the error that caused the connection to start reconnecting (if any).
   */
  onreconnecting(callback2) {
    if (callback2) {
      this._reconnectingCallbacks.push(callback2);
    }
  }
  /** Registers a handler that will be invoked when the connection successfully reconnects.
   *
   * @param {Function} callback The handler that will be invoked when the connection successfully reconnects.
   */
  onreconnected(callback2) {
    if (callback2) {
      this._reconnectedCallbacks.push(callback2);
    }
  }
  _processIncomingData(data) {
    this._cleanupTimeout();
    if (!this._receivedHandshakeResponse) {
      data = this._processHandshakeResponse(data);
      this._receivedHandshakeResponse = true;
    }
    if (data) {
      const messages2 = this._protocol.parseMessages(data, this._logger);
      for (const message of messages2) {
        switch (message.type) {
          case MessageType.Invocation:
            this._invokeClientMethod(message);
            break;
          case MessageType.StreamItem:
          case MessageType.Completion: {
            const callback2 = this._callbacks[message.invocationId];
            if (callback2) {
              if (message.type === MessageType.Completion) {
                delete this._callbacks[message.invocationId];
              }
              try {
                callback2(message);
              } catch (e2) {
                this._logger.log(LogLevel$1.Error, `Stream callback threw error: ${getErrorString(e2)}`);
              }
            }
            break;
          }
          case MessageType.Ping:
            break;
          case MessageType.Close: {
            this._logger.log(LogLevel$1.Information, "Close message received from server.");
            const error2 = message.error ? new Error("Server returned an error on close: " + message.error) : void 0;
            if (message.allowReconnect === true) {
              this.connection.stop(error2);
            } else {
              this._stopPromise = this._stopInternal(error2);
            }
            break;
          }
          default:
            this._logger.log(LogLevel$1.Warning, `Invalid message type: ${message.type}.`);
            break;
        }
      }
    }
    this._resetTimeoutPeriod();
  }
  _processHandshakeResponse(data) {
    let responseMessage;
    let remainingData;
    try {
      [remainingData, responseMessage] = this._handshakeProtocol.parseHandshakeResponse(data);
    } catch (e2) {
      const message = "Error parsing handshake response: " + e2;
      this._logger.log(LogLevel$1.Error, message);
      const error2 = new Error(message);
      this._handshakeRejecter(error2);
      throw error2;
    }
    if (responseMessage.error) {
      const message = "Server returned handshake error: " + responseMessage.error;
      this._logger.log(LogLevel$1.Error, message);
      const error2 = new Error(message);
      this._handshakeRejecter(error2);
      throw error2;
    } else {
      this._logger.log(LogLevel$1.Debug, "Server handshake complete.");
    }
    this._handshakeResolver();
    return remainingData;
  }
  _resetKeepAliveInterval() {
    if (this.connection.features.inherentKeepAlive) {
      return;
    }
    this._nextKeepAlive = (/* @__PURE__ */ new Date()).getTime() + this.keepAliveIntervalInMilliseconds;
    this._cleanupPingTimer();
  }
  _resetTimeoutPeriod() {
    if (!this.connection.features || !this.connection.features.inherentKeepAlive) {
      this._timeoutHandle = setTimeout(() => this.serverTimeout(), this.serverTimeoutInMilliseconds);
      if (this._pingServerHandle === void 0) {
        let nextPing = this._nextKeepAlive - (/* @__PURE__ */ new Date()).getTime();
        if (nextPing < 0) {
          nextPing = 0;
        }
        this._pingServerHandle = setTimeout(async () => {
          if (this._connectionState === HubConnectionState.Connected) {
            try {
              await this._sendMessage(this._cachedPingMessage);
            } catch {
              this._cleanupPingTimer();
            }
          }
        }, nextPing);
      }
    }
  }
  // eslint-disable-next-line @typescript-eslint/naming-convention
  serverTimeout() {
    this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."));
  }
  async _invokeClientMethod(invocationMessage) {
    const methodName = invocationMessage.target.toLowerCase();
    const methods = this._methods[methodName];
    if (!methods) {
      this._logger.log(LogLevel$1.Warning, `No client method with the name '${methodName}' found.`);
      if (invocationMessage.invocationId) {
        this._logger.log(LogLevel$1.Warning, `No result given for '${methodName}' method and invocation ID '${invocationMessage.invocationId}'.`);
        await this._sendWithProtocol(this._createCompletionMessage(invocationMessage.invocationId, "Client didn't provide a result.", null));
      }
      return;
    }
    const methodsCopy = methods.slice();
    const expectsResponse = invocationMessage.invocationId ? true : false;
    let res;
    let exception;
    let completionMessage;
    for (const m2 of methodsCopy) {
      try {
        const prevRes = res;
        res = await m2.apply(this, invocationMessage.arguments);
        if (expectsResponse && res && prevRes) {
          this._logger.log(LogLevel$1.Error, `Multiple results provided for '${methodName}'. Sending error to server.`);
          completionMessage = this._createCompletionMessage(invocationMessage.invocationId, `Client provided multiple results.`, null);
        }
        exception = void 0;
      } catch (e2) {
        exception = e2;
        this._logger.log(LogLevel$1.Error, `A callback for the method '${methodName}' threw error '${e2}'.`);
      }
    }
    if (completionMessage) {
      await this._sendWithProtocol(completionMessage);
    } else if (expectsResponse) {
      if (exception) {
        completionMessage = this._createCompletionMessage(invocationMessage.invocationId, `${exception}`, null);
      } else if (res !== void 0) {
        completionMessage = this._createCompletionMessage(invocationMessage.invocationId, null, res);
      } else {
        this._logger.log(LogLevel$1.Warning, `No result given for '${methodName}' method and invocation ID '${invocationMessage.invocationId}'.`);
        completionMessage = this._createCompletionMessage(invocationMessage.invocationId, "Client didn't provide a result.", null);
      }
      await this._sendWithProtocol(completionMessage);
    } else {
      if (res) {
        this._logger.log(LogLevel$1.Error, `Result given for '${methodName}' method but server is not expecting a result.`);
      }
    }
  }
  _connectionClosed(error2) {
    this._logger.log(LogLevel$1.Debug, `HubConnection.connectionClosed(${error2}) called while in state ${this._connectionState}.`);
    this._stopDuringStartError = this._stopDuringStartError || error2 || new AbortError("The underlying connection was closed before the hub handshake could complete.");
    if (this._handshakeResolver) {
      this._handshakeResolver();
    }
    this._cancelCallbacksWithError(error2 || new Error("Invocation canceled due to the underlying connection being closed."));
    this._cleanupTimeout();
    this._cleanupPingTimer();
    if (this._connectionState === HubConnectionState.Disconnecting) {
      this._completeClose(error2);
    } else if (this._connectionState === HubConnectionState.Connected && this._reconnectPolicy) {
      this._reconnect(error2);
    } else if (this._connectionState === HubConnectionState.Connected) {
      this._completeClose(error2);
    }
  }
  _completeClose(error2) {
    if (this._connectionStarted) {
      this._connectionState = HubConnectionState.Disconnected;
      this._connectionStarted = false;
      if (Platform.isBrowser) {
        window.document.removeEventListener("freeze", this._freezeEventListener);
      }
      try {
        this._closedCallbacks.forEach((c2) => c2.apply(this, [error2]));
      } catch (e2) {
        this._logger.log(LogLevel$1.Error, `An onclose callback called with error '${error2}' threw error '${e2}'.`);
      }
    }
  }
  async _reconnect(error2) {
    const reconnectStartTime = Date.now();
    let previousReconnectAttempts = 0;
    let retryError = error2 !== void 0 ? error2 : new Error("Attempting to reconnect due to a unknown error.");
    let nextRetryDelay = this._getNextRetryDelay(previousReconnectAttempts++, 0, retryError);
    if (nextRetryDelay === null) {
      this._logger.log(LogLevel$1.Debug, "Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt.");
      this._completeClose(error2);
      return;
    }
    this._connectionState = HubConnectionState.Reconnecting;
    if (error2) {
      this._logger.log(LogLevel$1.Information, `Connection reconnecting because of error '${error2}'.`);
    } else {
      this._logger.log(LogLevel$1.Information, "Connection reconnecting.");
    }
    if (this._reconnectingCallbacks.length !== 0) {
      try {
        this._reconnectingCallbacks.forEach((c2) => c2.apply(this, [error2]));
      } catch (e2) {
        this._logger.log(LogLevel$1.Error, `An onreconnecting callback called with error '${error2}' threw error '${e2}'.`);
      }
      if (this._connectionState !== HubConnectionState.Reconnecting) {
        this._logger.log(LogLevel$1.Debug, "Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");
        return;
      }
    }
    while (nextRetryDelay !== null) {
      this._logger.log(LogLevel$1.Information, `Reconnect attempt number ${previousReconnectAttempts} will start in ${nextRetryDelay} ms.`);
      await new Promise((resolve2) => {
        this._reconnectDelayHandle = setTimeout(resolve2, nextRetryDelay);
      });
      this._reconnectDelayHandle = void 0;
      if (this._connectionState !== HubConnectionState.Reconnecting) {
        this._logger.log(LogLevel$1.Debug, "Connection left the reconnecting state during reconnect delay. Done reconnecting.");
        return;
      }
      try {
        await this._startInternal();
        this._connectionState = HubConnectionState.Connected;
        this._logger.log(LogLevel$1.Information, "HubConnection reconnected successfully.");
        if (this._reconnectedCallbacks.length !== 0) {
          try {
            this._reconnectedCallbacks.forEach((c2) => c2.apply(this, [this.connection.connectionId]));
          } catch (e2) {
            this._logger.log(LogLevel$1.Error, `An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e2}'.`);
          }
        }
        return;
      } catch (e2) {
        this._logger.log(LogLevel$1.Information, `Reconnect attempt failed because of error '${e2}'.`);
        if (this._connectionState !== HubConnectionState.Reconnecting) {
          this._logger.log(LogLevel$1.Debug, `Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`);
          if (this._connectionState === HubConnectionState.Disconnecting) {
            this._completeClose();
          }
          return;
        }
        retryError = e2 instanceof Error ? e2 : new Error(e2.toString());
        nextRetryDelay = this._getNextRetryDelay(previousReconnectAttempts++, Date.now() - reconnectStartTime, retryError);
      }
    }
    this._logger.log(LogLevel$1.Information, `Reconnect retries have been exhausted after ${Date.now() - reconnectStartTime} ms and ${previousReconnectAttempts} failed attempts. Connection disconnecting.`);
    this._completeClose();
  }
  _getNextRetryDelay(previousRetryCount, elapsedMilliseconds, retryReason) {
    try {
      return this._reconnectPolicy.nextRetryDelayInMilliseconds({
        elapsedMilliseconds,
        previousRetryCount,
        retryReason
      });
    } catch (e2) {
      this._logger.log(LogLevel$1.Error, `IRetryPolicy.nextRetryDelayInMilliseconds(${previousRetryCount}, ${elapsedMilliseconds}) threw error '${e2}'.`);
      return null;
    }
  }
  _cancelCallbacksWithError(error2) {
    const callbacks = this._callbacks;
    this._callbacks = {};
    Object.keys(callbacks).forEach((key) => {
      const callback2 = callbacks[key];
      try {
        callback2(null, error2);
      } catch (e2) {
        this._logger.log(LogLevel$1.Error, `Stream 'error' callback called with '${error2}' threw error: ${getErrorString(e2)}`);
      }
    });
  }
  _cleanupPingTimer() {
    if (this._pingServerHandle) {
      clearTimeout(this._pingServerHandle);
      this._pingServerHandle = void 0;
    }
  }
  _cleanupTimeout() {
    if (this._timeoutHandle) {
      clearTimeout(this._timeoutHandle);
    }
  }
  _createInvocation(methodName, args, nonblocking, streamIds) {
    if (nonblocking) {
      if (streamIds.length !== 0) {
        return {
          arguments: args,
          streamIds,
          target: methodName,
          type: MessageType.Invocation
        };
      } else {
        return {
          arguments: args,
          target: methodName,
          type: MessageType.Invocation
        };
      }
    } else {
      const invocationId = this._invocationId;
      this._invocationId++;
      if (streamIds.length !== 0) {
        return {
          arguments: args,
          invocationId: invocationId.toString(),
          streamIds,
          target: methodName,
          type: MessageType.Invocation
        };
      } else {
        return {
          arguments: args,
          invocationId: invocationId.toString(),
          target: methodName,
          type: MessageType.Invocation
        };
      }
    }
  }
  _launchStreams(streams, promiseQueue) {
    if (streams.length === 0) {
      return;
    }
    if (!promiseQueue) {
      promiseQueue = Promise.resolve();
    }
    for (const streamId in streams) {
      streams[streamId].subscribe({
        complete: () => {
          promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createCompletionMessage(streamId)));
        },
        error: (err) => {
          let message;
          if (err instanceof Error) {
            message = err.message;
          } else if (err && err.toString) {
            message = err.toString();
          } else {
            message = "Unknown error";
          }
          promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createCompletionMessage(streamId, message)));
        },
        next: (item) => {
          promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createStreamItemMessage(streamId, item)));
        }
      });
    }
  }
  _replaceStreamingParams(args) {
    const streams = [];
    const streamIds = [];
    for (let i2 = 0; i2 < args.length; i2++) {
      const argument = args[i2];
      if (this._isObservable(argument)) {
        const streamId = this._invocationId;
        this._invocationId++;
        streams[streamId] = argument;
        streamIds.push(streamId.toString());
        args.splice(i2, 1);
      }
    }
    return [streams, streamIds];
  }
  _isObservable(arg) {
    return arg && arg.subscribe && typeof arg.subscribe === "function";
  }
  _createStreamInvocation(methodName, args, streamIds) {
    const invocationId = this._invocationId;
    this._invocationId++;
    if (streamIds.length !== 0) {
      return {
        arguments: args,
        invocationId: invocationId.toString(),
        streamIds,
        target: methodName,
        type: MessageType.StreamInvocation
      };
    } else {
      return {
        arguments: args,
        invocationId: invocationId.toString(),
        target: methodName,
        type: MessageType.StreamInvocation
      };
    }
  }
  _createCancelInvocation(id2) {
    return {
      invocationId: id2,
      type: MessageType.CancelInvocation
    };
  }
  _createStreamItemMessage(id2, item) {
    return {
      invocationId: id2,
      item,
      type: MessageType.StreamItem
    };
  }
  _createCompletionMessage(id2, error2, result) {
    if (error2) {
      return {
        error: error2,
        invocationId: id2,
        type: MessageType.Completion
      };
    }
    return {
      invocationId: id2,
      result,
      type: MessageType.Completion
    };
  }
}
const DEFAULT_RETRY_DELAYS_IN_MILLISECONDS = [0, 2e3, 1e4, 3e4, null];
class DefaultReconnectPolicy {
  constructor(retryDelays) {
    this._retryDelays = retryDelays !== void 0 ? [...retryDelays, null] : DEFAULT_RETRY_DELAYS_IN_MILLISECONDS;
  }
  nextRetryDelayInMilliseconds(retryContext) {
    return this._retryDelays[retryContext.previousRetryCount];
  }
}
class HeaderNames {
}
HeaderNames.Authorization = "Authorization";
HeaderNames.Cookie = "Cookie";
class AccessTokenHttpClient extends HttpClient$1 {
  constructor(innerClient, accessTokenFactory) {
    super();
    this._innerClient = innerClient;
    this._accessTokenFactory = accessTokenFactory;
  }
  async send(request2) {
    let allowRetry = true;
    if (this._accessTokenFactory && (!this._accessToken || request2.url && request2.url.indexOf("/negotiate?") > 0)) {
      allowRetry = false;
      this._accessToken = await this._accessTokenFactory();
    }
    this._setAuthorizationHeader(request2);
    const response = await this._innerClient.send(request2);
    if (allowRetry && response.statusCode === 401 && this._accessTokenFactory) {
      this._accessToken = await this._accessTokenFactory();
      this._setAuthorizationHeader(request2);
      return await this._innerClient.send(request2);
    }
    return response;
  }
  _setAuthorizationHeader(request2) {
    if (!request2.headers) {
      request2.headers = {};
    }
    if (this._accessToken) {
      request2.headers[HeaderNames.Authorization] = `Bearer ${this._accessToken}`;
    } else if (this._accessTokenFactory) {
      if (request2.headers[HeaderNames.Authorization]) {
        delete request2.headers[HeaderNames.Authorization];
      }
    }
  }
  getCookieString(url2) {
    return this._innerClient.getCookieString(url2);
  }
}
var HttpTransportType;
(function(HttpTransportType2) {
  HttpTransportType2[HttpTransportType2["None"] = 0] = "None";
  HttpTransportType2[HttpTransportType2["WebSockets"] = 1] = "WebSockets";
  HttpTransportType2[HttpTransportType2["ServerSentEvents"] = 2] = "ServerSentEvents";
  HttpTransportType2[HttpTransportType2["LongPolling"] = 4] = "LongPolling";
})(HttpTransportType || (HttpTransportType = {}));
var TransferFormat;
(function(TransferFormat2) {
  TransferFormat2[TransferFormat2["Text"] = 1] = "Text";
  TransferFormat2[TransferFormat2["Binary"] = 2] = "Binary";
})(TransferFormat || (TransferFormat = {}));
let AbortController$1 = class AbortController2 {
  constructor() {
    this._isAborted = false;
    this.onabort = null;
  }
  abort() {
    if (!this._isAborted) {
      this._isAborted = true;
      if (this.onabort) {
        this.onabort();
      }
    }
  }
  get signal() {
    return this;
  }
  get aborted() {
    return this._isAborted;
  }
};
class LongPollingTransport {
  constructor(httpClient, logger, options) {
    this._httpClient = httpClient;
    this._logger = logger;
    this._pollAbort = new AbortController$1();
    this._options = options;
    this._running = false;
    this.onreceive = null;
    this.onclose = null;
  }
  // This is an internal type, not exported from 'index' so this is really just internal.
  get pollAborted() {
    return this._pollAbort.aborted;
  }
  async connect(url2, transferFormat) {
    Arg.isRequired(url2, "url");
    Arg.isRequired(transferFormat, "transferFormat");
    Arg.isIn(transferFormat, TransferFormat, "transferFormat");
    this._url = url2;
    this._logger.log(LogLevel$1.Trace, "(LongPolling transport) Connecting.");
    if (transferFormat === TransferFormat.Binary && (typeof XMLHttpRequest !== "undefined" && typeof new XMLHttpRequest().responseType !== "string")) {
      throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");
    }
    const [name2, value2] = getUserAgentHeader();
    const headers = { [name2]: value2, ...this._options.headers };
    const pollOptions = {
      abortSignal: this._pollAbort.signal,
      headers,
      timeout: 1e5,
      withCredentials: this._options.withCredentials
    };
    if (transferFormat === TransferFormat.Binary) {
      pollOptions.responseType = "arraybuffer";
    }
    const pollUrl = `${url2}&_=${Date.now()}`;
    this._logger.log(LogLevel$1.Trace, `(LongPolling transport) polling: ${pollUrl}.`);
    const response = await this._httpClient.get(pollUrl, pollOptions);
    if (response.statusCode !== 200) {
      this._logger.log(LogLevel$1.Error, `(LongPolling transport) Unexpected response code: ${response.statusCode}.`);
      this._closeError = new HttpError(response.statusText || "", response.statusCode);
      this._running = false;
    } else {
      this._running = true;
    }
    this._receiving = this._poll(this._url, pollOptions);
  }
  async _poll(url2, pollOptions) {
    try {
      while (this._running) {
        try {
          const pollUrl = `${url2}&_=${Date.now()}`;
          this._logger.log(LogLevel$1.Trace, `(LongPolling transport) polling: ${pollUrl}.`);
          const response = await this._httpClient.get(pollUrl, pollOptions);
          if (response.statusCode === 204) {
            this._logger.log(LogLevel$1.Information, "(LongPolling transport) Poll terminated by server.");
            this._running = false;
          } else if (response.statusCode !== 200) {
            this._logger.log(LogLevel$1.Error, `(LongPolling transport) Unexpected response code: ${response.statusCode}.`);
            this._closeError = new HttpError(response.statusText || "", response.statusCode);
            this._running = false;
          } else {
            if (response.content) {
              this._logger.log(LogLevel$1.Trace, `(LongPolling transport) data received. ${getDataDetail(response.content, this._options.logMessageContent)}.`);
              if (this.onreceive) {
                this.onreceive(response.content);
              }
            } else {
              this._logger.log(LogLevel$1.Trace, "(LongPolling transport) Poll timed out, reissuing.");
            }
          }
        } catch (e2) {
          if (!this._running) {
            this._logger.log(LogLevel$1.Trace, `(LongPolling transport) Poll errored after shutdown: ${e2.message}`);
          } else {
            if (e2 instanceof TimeoutError) {
              this._logger.log(LogLevel$1.Trace, "(LongPolling transport) Poll timed out, reissuing.");
            } else {
              this._closeError = e2;
              this._running = false;
            }
          }
        }
      }
    } finally {
      this._logger.log(LogLevel$1.Trace, "(LongPolling transport) Polling complete.");
      if (!this.pollAborted) {
        this._raiseOnClose();
      }
    }
  }
  async send(data) {
    if (!this._running) {
      return Promise.reject(new Error("Cannot send until the transport is connected"));
    }
    return sendMessage(this._logger, "LongPolling", this._httpClient, this._url, data, this._options);
  }
  async stop() {
    this._logger.log(LogLevel$1.Trace, "(LongPolling transport) Stopping polling.");
    this._running = false;
    this._pollAbort.abort();
    try {
      await this._receiving;
      this._logger.log(LogLevel$1.Trace, `(LongPolling transport) sending DELETE request to ${this._url}.`);
      const headers = {};
      const [name2, value2] = getUserAgentHeader();
      headers[name2] = value2;
      const deleteOptions = {
        headers: { ...headers, ...this._options.headers },
        timeout: this._options.timeout,
        withCredentials: this._options.withCredentials
      };
      await this._httpClient.delete(this._url, deleteOptions);
      this._logger.log(LogLevel$1.Trace, "(LongPolling transport) DELETE request sent.");
    } finally {
      this._logger.log(LogLevel$1.Trace, "(LongPolling transport) Stop finished.");
      this._raiseOnClose();
    }
  }
  _raiseOnClose() {
    if (this.onclose) {
      let logMessage = "(LongPolling transport) Firing onclose event.";
      if (this._closeError) {
        logMessage += " Error: " + this._closeError;
      }
      this._logger.log(LogLevel$1.Trace, logMessage);
      this.onclose(this._closeError);
    }
  }
}
class ServerSentEventsTransport {
  constructor(httpClient, accessToken, logger, options) {
    this._httpClient = httpClient;
    this._accessToken = accessToken;
    this._logger = logger;
    this._options = options;
    this.onreceive = null;
    this.onclose = null;
  }
  async connect(url2, transferFormat) {
    Arg.isRequired(url2, "url");
    Arg.isRequired(transferFormat, "transferFormat");
    Arg.isIn(transferFormat, TransferFormat, "transferFormat");
    this._logger.log(LogLevel$1.Trace, "(SSE transport) Connecting.");
    this._url = url2;
    if (this._accessToken) {
      url2 += (url2.indexOf("?") < 0 ? "?" : "&") + `access_token=${encodeURIComponent(this._accessToken)}`;
    }
    return new Promise((resolve2, reject) => {
      let opened = false;
      if (transferFormat !== TransferFormat.Text) {
        reject(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));
        return;
      }
      let eventSource;
      if (Platform.isBrowser || Platform.isWebWorker) {
        eventSource = new this._options.EventSource(url2, { withCredentials: this._options.withCredentials });
      } else {
        const cookies2 = this._httpClient.getCookieString(url2);
        const headers = {};
        headers.Cookie = cookies2;
        const [name2, value2] = getUserAgentHeader();
        headers[name2] = value2;
        eventSource = new this._options.EventSource(url2, { withCredentials: this._options.withCredentials, headers: { ...headers, ...this._options.headers } });
      }
      try {
        eventSource.onmessage = (e2) => {
          if (this.onreceive) {
            try {
              this._logger.log(LogLevel$1.Trace, `(SSE transport) data received. ${getDataDetail(e2.data, this._options.logMessageContent)}.`);
              this.onreceive(e2.data);
            } catch (error2) {
              this._close(error2);
              return;
            }
          }
        };
        eventSource.onerror = (e2) => {
          if (opened) {
            this._close();
          } else {
            reject(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."));
          }
        };
        eventSource.onopen = () => {
          this._logger.log(LogLevel$1.Information, `SSE connected to ${this._url}`);
          this._eventSource = eventSource;
          opened = true;
          resolve2();
        };
      } catch (e2) {
        reject(e2);
        return;
      }
    });
  }
  async send(data) {
    if (!this._eventSource) {
      return Promise.reject(new Error("Cannot send until the transport is connected"));
    }
    return sendMessage(this._logger, "SSE", this._httpClient, this._url, data, this._options);
  }
  stop() {
    this._close();
    return Promise.resolve();
  }
  _close(e2) {
    if (this._eventSource) {
      this._eventSource.close();
      this._eventSource = void 0;
      if (this.onclose) {
        this.onclose(e2);
      }
    }
  }
}
class WebSocketTransport {
  constructor(httpClient, accessTokenFactory, logger, logMessageContent, webSocketConstructor, headers) {
    this._logger = logger;
    this._accessTokenFactory = accessTokenFactory;
    this._logMessageContent = logMessageContent;
    this._webSocketConstructor = webSocketConstructor;
    this._httpClient = httpClient;
    this.onreceive = null;
    this.onclose = null;
    this._headers = headers;
  }
  async connect(url2, transferFormat) {
    Arg.isRequired(url2, "url");
    Arg.isRequired(transferFormat, "transferFormat");
    Arg.isIn(transferFormat, TransferFormat, "transferFormat");
    this._logger.log(LogLevel$1.Trace, "(WebSockets transport) Connecting.");
    let token2;
    if (this._accessTokenFactory) {
      token2 = await this._accessTokenFactory();
    }
    return new Promise((resolve2, reject) => {
      url2 = url2.replace(/^http/, "ws");
      let webSocket;
      const cookies2 = this._httpClient.getCookieString(url2);
      let opened = false;
      if (Platform.isNode || Platform.isReactNative) {
        const headers = {};
        const [name2, value2] = getUserAgentHeader();
        headers[name2] = value2;
        if (token2) {
          headers[HeaderNames.Authorization] = `Bearer ${token2}`;
        }
        if (cookies2) {
          headers[HeaderNames.Cookie] = cookies2;
        }
        webSocket = new this._webSocketConstructor(url2, void 0, {
          headers: { ...headers, ...this._headers }
        });
      } else {
        if (token2) {
          url2 += (url2.indexOf("?") < 0 ? "?" : "&") + `access_token=${encodeURIComponent(token2)}`;
        }
      }
      if (!webSocket) {
        webSocket = new this._webSocketConstructor(url2);
      }
      if (transferFormat === TransferFormat.Binary) {
        webSocket.binaryType = "arraybuffer";
      }
      webSocket.onopen = (_event) => {
        this._logger.log(LogLevel$1.Information, `WebSocket connected to ${url2}.`);
        this._webSocket = webSocket;
        opened = true;
        resolve2();
      };
      webSocket.onerror = (event) => {
        let error2 = null;
        if (typeof ErrorEvent !== "undefined" && event instanceof ErrorEvent) {
          error2 = event.error;
        } else {
          error2 = "There was an error with the transport";
        }
        this._logger.log(LogLevel$1.Information, `(WebSockets transport) ${error2}.`);
      };
      webSocket.onmessage = (message) => {
        this._logger.log(LogLevel$1.Trace, `(WebSockets transport) data received. ${getDataDetail(message.data, this._logMessageContent)}.`);
        if (this.onreceive) {
          try {
            this.onreceive(message.data);
          } catch (error2) {
            this._close(error2);
            return;
          }
        }
      };
      webSocket.onclose = (event) => {
        if (opened) {
          this._close(event);
        } else {
          let error2 = null;
          if (typeof ErrorEvent !== "undefined" && event instanceof ErrorEvent) {
            error2 = event.error;
          } else {
            error2 = "WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.";
          }
          reject(new Error(error2));
        }
      };
    });
  }
  send(data) {
    if (this._webSocket && this._webSocket.readyState === this._webSocketConstructor.OPEN) {
      this._logger.log(LogLevel$1.Trace, `(WebSockets transport) sending data. ${getDataDetail(data, this._logMessageContent)}.`);
      this._webSocket.send(data);
      return Promise.resolve();
    }
    return Promise.reject("WebSocket is not in the OPEN state");
  }
  stop() {
    if (this._webSocket) {
      this._close(void 0);
    }
    return Promise.resolve();
  }
  _close(event) {
    if (this._webSocket) {
      this._webSocket.onclose = () => {
      };
      this._webSocket.onmessage = () => {
      };
      this._webSocket.onerror = () => {
      };
      this._webSocket.close();
      this._webSocket = void 0;
    }
    this._logger.log(LogLevel$1.Trace, "(WebSockets transport) socket closed.");
    if (this.onclose) {
      if (this._isCloseEvent(event) && (event.wasClean === false || event.code !== 1e3)) {
        this.onclose(new Error(`WebSocket closed with status code: ${event.code} (${event.reason || "no reason given"}).`));
      } else if (event instanceof Error) {
        this.onclose(event);
      } else {
        this.onclose();
      }
    }
  }
  _isCloseEvent(event) {
    return event && typeof event.wasClean === "boolean" && typeof event.code === "number";
  }
}
const MAX_REDIRECTS = 100;
class HttpConnection {
  constructor(url2, options = {}) {
    this._stopPromiseResolver = () => {
    };
    this.features = {};
    this._negotiateVersion = 1;
    Arg.isRequired(url2, "url");
    this._logger = createLogger(options.logger);
    this.baseUrl = this._resolveUrl(url2);
    options = options || {};
    options.logMessageContent = options.logMessageContent === void 0 ? false : options.logMessageContent;
    if (typeof options.withCredentials === "boolean" || options.withCredentials === void 0) {
      options.withCredentials = options.withCredentials === void 0 ? true : options.withCredentials;
    } else {
      throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");
    }
    options.timeout = options.timeout === void 0 ? 100 * 1e3 : options.timeout;
    let webSocketModule = null;
    let eventSourceModule = null;
    if (Platform.isNode && typeof require !== "undefined") {
      const requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require;
      webSocketModule = requireFunc("ws");
      eventSourceModule = requireFunc("eventsource");
    }
    if (!Platform.isNode && typeof WebSocket !== "undefined" && !options.WebSocket) {
      options.WebSocket = WebSocket;
    } else if (Platform.isNode && !options.WebSocket) {
      if (webSocketModule) {
        options.WebSocket = webSocketModule;
      }
    }
    if (!Platform.isNode && typeof EventSource !== "undefined" && !options.EventSource) {
      options.EventSource = EventSource;
    } else if (Platform.isNode && !options.EventSource) {
      if (typeof eventSourceModule !== "undefined") {
        options.EventSource = eventSourceModule;
      }
    }
    this._httpClient = new AccessTokenHttpClient(options.httpClient || new DefaultHttpClient(this._logger), options.accessTokenFactory);
    this._connectionState = "Disconnected";
    this._connectionStarted = false;
    this._options = options;
    this.onreceive = null;
    this.onclose = null;
  }
  async start(transferFormat) {
    transferFormat = transferFormat || TransferFormat.Binary;
    Arg.isIn(transferFormat, TransferFormat, "transferFormat");
    this._logger.log(LogLevel$1.Debug, `Starting connection with transfer format '${TransferFormat[transferFormat]}'.`);
    if (this._connectionState !== "Disconnected") {
      return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));
    }
    this._connectionState = "Connecting";
    this._startInternalPromise = this._startInternal(transferFormat);
    await this._startInternalPromise;
    if (this._connectionState === "Disconnecting") {
      const message = "Failed to start the HttpConnection before stop() was called.";
      this._logger.log(LogLevel$1.Error, message);
      await this._stopPromise;
      return Promise.reject(new AbortError(message));
    } else if (this._connectionState !== "Connected") {
      const message = "HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";
      this._logger.log(LogLevel$1.Error, message);
      return Promise.reject(new AbortError(message));
    }
    this._connectionStarted = true;
  }
  send(data) {
    if (this._connectionState !== "Connected") {
      return Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State."));
    }
    if (!this._sendQueue) {
      this._sendQueue = new TransportSendQueue(this.transport);
    }
    return this._sendQueue.send(data);
  }
  async stop(error2) {
    if (this._connectionState === "Disconnected") {
      this._logger.log(LogLevel$1.Debug, `Call to HttpConnection.stop(${error2}) ignored because the connection is already in the disconnected state.`);
      return Promise.resolve();
    }
    if (this._connectionState === "Disconnecting") {
      this._logger.log(LogLevel$1.Debug, `Call to HttpConnection.stop(${error2}) ignored because the connection is already in the disconnecting state.`);
      return this._stopPromise;
    }
    this._connectionState = "Disconnecting";
    this._stopPromise = new Promise((resolve2) => {
      this._stopPromiseResolver = resolve2;
    });
    await this._stopInternal(error2);
    await this._stopPromise;
  }
  async _stopInternal(error2) {
    this._stopError = error2;
    try {
      await this._startInternalPromise;
    } catch (e2) {
    }
    if (this.transport) {
      try {
        await this.transport.stop();
      } catch (e2) {
        this._logger.log(LogLevel$1.Error, `HttpConnection.transport.stop() threw error '${e2}'.`);
        this._stopConnection();
      }
      this.transport = void 0;
    } else {
      this._logger.log(LogLevel$1.Debug, "HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.");
    }
  }
  async _startInternal(transferFormat) {
    let url2 = this.baseUrl;
    this._accessTokenFactory = this._options.accessTokenFactory;
    this._httpClient._accessTokenFactory = this._accessTokenFactory;
    try {
      if (this._options.skipNegotiation) {
        if (this._options.transport === HttpTransportType.WebSockets) {
          this.transport = this._constructTransport(HttpTransportType.WebSockets);
          await this._startTransport(url2, transferFormat);
        } else {
          throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");
        }
      } else {
        let negotiateResponse = null;
        let redirects = 0;
        do {
          negotiateResponse = await this._getNegotiationResponse(url2);
          if (this._connectionState === "Disconnecting" || this._connectionState === "Disconnected") {
            throw new AbortError("The connection was stopped during negotiation.");
          }
          if (negotiateResponse.error) {
            throw new Error(negotiateResponse.error);
          }
          if (negotiateResponse.ProtocolVersion) {
            throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");
          }
          if (negotiateResponse.url) {
            url2 = negotiateResponse.url;
          }
          if (negotiateResponse.accessToken) {
            const accessToken = negotiateResponse.accessToken;
            this._accessTokenFactory = () => accessToken;
            this._httpClient._accessToken = accessToken;
            this._httpClient._accessTokenFactory = void 0;
          }
          redirects++;
        } while (negotiateResponse.url && redirects < MAX_REDIRECTS);
        if (redirects === MAX_REDIRECTS && negotiateResponse.url) {
          throw new Error("Negotiate redirection limit exceeded.");
        }
        await this._createTransport(url2, this._options.transport, negotiateResponse, transferFormat);
      }
      if (this.transport instanceof LongPollingTransport) {
        this.features.inherentKeepAlive = true;
      }
      if (this._connectionState === "Connecting") {
        this._logger.log(LogLevel$1.Debug, "The HttpConnection connected successfully.");
        this._connectionState = "Connected";
      }
    } catch (e2) {
      this._logger.log(LogLevel$1.Error, "Failed to start the connection: " + e2);
      this._connectionState = "Disconnected";
      this.transport = void 0;
      this._stopPromiseResolver();
      return Promise.reject(e2);
    }
  }
  async _getNegotiationResponse(url2) {
    const headers = {};
    const [name2, value2] = getUserAgentHeader();
    headers[name2] = value2;
    const negotiateUrl = this._resolveNegotiateUrl(url2);
    this._logger.log(LogLevel$1.Debug, `Sending negotiation request: ${negotiateUrl}.`);
    try {
      const response = await this._httpClient.post(negotiateUrl, {
        content: "",
        headers: { ...headers, ...this._options.headers },
        timeout: this._options.timeout,
        withCredentials: this._options.withCredentials
      });
      if (response.statusCode !== 200) {
        return Promise.reject(new Error(`Unexpected status code returned from negotiate '${response.statusCode}'`));
      }
      const negotiateResponse = JSON.parse(response.content);
      if (!negotiateResponse.negotiateVersion || negotiateResponse.negotiateVersion < 1) {
        negotiateResponse.connectionToken = negotiateResponse.connectionId;
      }
      return negotiateResponse;
    } catch (e2) {
      let errorMessage = "Failed to complete negotiation with the server: " + e2;
      if (e2 instanceof HttpError) {
        if (e2.statusCode === 404) {
          errorMessage = errorMessage + " Either this is not a SignalR endpoint or there is a proxy blocking the connection.";
        }
      }
      this._logger.log(LogLevel$1.Error, errorMessage);
      return Promise.reject(new FailedToNegotiateWithServerError(errorMessage));
    }
  }
  _createConnectUrl(url2, connectionToken) {
    if (!connectionToken) {
      return url2;
    }
    return url2 + (url2.indexOf("?") === -1 ? "?" : "&") + `id=${connectionToken}`;
  }
  async _createTransport(url2, requestedTransport, negotiateResponse, requestedTransferFormat) {
    let connectUrl = this._createConnectUrl(url2, negotiateResponse.connectionToken);
    if (this._isITransport(requestedTransport)) {
      this._logger.log(LogLevel$1.Debug, "Connection was provided an instance of ITransport, using that directly.");
      this.transport = requestedTransport;
      await this._startTransport(connectUrl, requestedTransferFormat);
      this.connectionId = negotiateResponse.connectionId;
      return;
    }
    const transportExceptions = [];
    const transports = negotiateResponse.availableTransports || [];
    let negotiate = negotiateResponse;
    for (const endpoint of transports) {
      const transportOrError = this._resolveTransportOrError(endpoint, requestedTransport, requestedTransferFormat);
      if (transportOrError instanceof Error) {
        transportExceptions.push(`${endpoint.transport} failed:`);
        transportExceptions.push(transportOrError);
      } else if (this._isITransport(transportOrError)) {
        this.transport = transportOrError;
        if (!negotiate) {
          try {
            negotiate = await this._getNegotiationResponse(url2);
          } catch (ex) {
            return Promise.reject(ex);
          }
          connectUrl = this._createConnectUrl(url2, negotiate.connectionToken);
        }
        try {
          await this._startTransport(connectUrl, requestedTransferFormat);
          this.connectionId = negotiate.connectionId;
          return;
        } catch (ex) {
          this._logger.log(LogLevel$1.Error, `Failed to start the transport '${endpoint.transport}': ${ex}`);
          negotiate = void 0;
          transportExceptions.push(new FailedToStartTransportError(`${endpoint.transport} failed: ${ex}`, HttpTransportType[endpoint.transport]));
          if (this._connectionState !== "Connecting") {
            const message = "Failed to select transport before stop() was called.";
            this._logger.log(LogLevel$1.Debug, message);
            return Promise.reject(new AbortError(message));
          }
        }
      }
    }
    if (transportExceptions.length > 0) {
      return Promise.reject(new AggregateErrors(`Unable to connect to the server with any of the available transports. ${transportExceptions.join(" ")}`, transportExceptions));
    }
    return Promise.reject(new Error("None of the transports supported by the client are supported by the server."));
  }
  _constructTransport(transport) {
    switch (transport) {
      case HttpTransportType.WebSockets:
        if (!this._options.WebSocket) {
          throw new Error("'WebSocket' is not supported in your environment.");
        }
        return new WebSocketTransport(this._httpClient, this._accessTokenFactory, this._logger, this._options.logMessageContent, this._options.WebSocket, this._options.headers || {});
      case HttpTransportType.ServerSentEvents:
        if (!this._options.EventSource) {
          throw new Error("'EventSource' is not supported in your environment.");
        }
        return new ServerSentEventsTransport(this._httpClient, this._httpClient._accessToken, this._logger, this._options);
      case HttpTransportType.LongPolling:
        return new LongPollingTransport(this._httpClient, this._logger, this._options);
      default:
        throw new Error(`Unknown transport: ${transport}.`);
    }
  }
  _startTransport(url2, transferFormat) {
    this.transport.onreceive = this.onreceive;
    this.transport.onclose = (e2) => this._stopConnection(e2);
    return this.transport.connect(url2, transferFormat);
  }
  _resolveTransportOrError(endpoint, requestedTransport, requestedTransferFormat) {
    const transport = HttpTransportType[endpoint.transport];
    if (transport === null || transport === void 0) {
      this._logger.log(LogLevel$1.Debug, `Skipping transport '${endpoint.transport}' because it is not supported by this client.`);
      return new Error(`Skipping transport '${endpoint.transport}' because it is not supported by this client.`);
    } else {
      if (transportMatches(requestedTransport, transport)) {
        const transferFormats = endpoint.transferFormats.map((s2) => TransferFormat[s2]);
        if (transferFormats.indexOf(requestedTransferFormat) >= 0) {
          if (transport === HttpTransportType.WebSockets && !this._options.WebSocket || transport === HttpTransportType.ServerSentEvents && !this._options.EventSource) {
            this._logger.log(LogLevel$1.Debug, `Skipping transport '${HttpTransportType[transport]}' because it is not supported in your environment.'`);
            return new UnsupportedTransportError(`'${HttpTransportType[transport]}' is not supported in your environment.`, transport);
          } else {
            this._logger.log(LogLevel$1.Debug, `Selecting transport '${HttpTransportType[transport]}'.`);
            try {
              return this._constructTransport(transport);
            } catch (ex) {
              return ex;
            }
          }
        } else {
          this._logger.log(LogLevel$1.Debug, `Skipping transport '${HttpTransportType[transport]}' because it does not support the requested transfer format '${TransferFormat[requestedTransferFormat]}'.`);
          return new Error(`'${HttpTransportType[transport]}' does not support ${TransferFormat[requestedTransferFormat]}.`);
        }
      } else {
        this._logger.log(LogLevel$1.Debug, `Skipping transport '${HttpTransportType[transport]}' because it was disabled by the client.`);
        return new DisabledTransportError(`'${HttpTransportType[transport]}' is disabled by the client.`, transport);
      }
    }
  }
  _isITransport(transport) {
    return transport && typeof transport === "object" && "connect" in transport;
  }
  _stopConnection(error2) {
    this._logger.log(LogLevel$1.Debug, `HttpConnection.stopConnection(${error2}) called while in state ${this._connectionState}.`);
    this.transport = void 0;
    error2 = this._stopError || error2;
    this._stopError = void 0;
    if (this._connectionState === "Disconnected") {
      this._logger.log(LogLevel$1.Debug, `Call to HttpConnection.stopConnection(${error2}) was ignored because the connection is already in the disconnected state.`);
      return;
    }
    if (this._connectionState === "Connecting") {
      this._logger.log(LogLevel$1.Warning, `Call to HttpConnection.stopConnection(${error2}) was ignored because the connection is still in the connecting state.`);
      throw new Error(`HttpConnection.stopConnection(${error2}) was called while the connection is still in the connecting state.`);
    }
    if (this._connectionState === "Disconnecting") {
      this._stopPromiseResolver();
    }
    if (error2) {
      this._logger.log(LogLevel$1.Error, `Connection disconnected with error '${error2}'.`);
    } else {
      this._logger.log(LogLevel$1.Information, "Connection disconnected.");
    }
    if (this._sendQueue) {
      this._sendQueue.stop().catch((e2) => {
        this._logger.log(LogLevel$1.Error, `TransportSendQueue.stop() threw error '${e2}'.`);
      });
      this._sendQueue = void 0;
    }
    this.connectionId = void 0;
    this._connectionState = "Disconnected";
    if (this._connectionStarted) {
      this._connectionStarted = false;
      try {
        if (this.onclose) {
          this.onclose(error2);
        }
      } catch (e2) {
        this._logger.log(LogLevel$1.Error, `HttpConnection.onclose(${error2}) threw error '${e2}'.`);
      }
    }
  }
  _resolveUrl(url2) {
    if (url2.lastIndexOf("https://", 0) === 0 || url2.lastIndexOf("http://", 0) === 0) {
      return url2;
    }
    if (!Platform.isBrowser) {
      throw new Error(`Cannot resolve '${url2}'.`);
    }
    const aTag = window.document.createElement("a");
    aTag.href = url2;
    this._logger.log(LogLevel$1.Information, `Normalizing '${url2}' to '${aTag.href}'.`);
    return aTag.href;
  }
  _resolveNegotiateUrl(url2) {
    const index2 = url2.indexOf("?");
    let negotiateUrl = url2.substring(0, index2 === -1 ? url2.length : index2);
    if (negotiateUrl[negotiateUrl.length - 1] !== "/") {
      negotiateUrl += "/";
    }
    negotiateUrl += "negotiate";
    negotiateUrl += index2 === -1 ? "" : url2.substring(index2);
    if (negotiateUrl.indexOf("negotiateVersion") === -1) {
      negotiateUrl += index2 === -1 ? "?" : "&";
      negotiateUrl += "negotiateVersion=" + this._negotiateVersion;
    }
    return negotiateUrl;
  }
}
function transportMatches(requestedTransport, actualTransport) {
  return !requestedTransport || (actualTransport & requestedTransport) !== 0;
}
class TransportSendQueue {
  constructor(_transport) {
    this._transport = _transport;
    this._buffer = [];
    this._executing = true;
    this._sendBufferedData = new PromiseSource();
    this._transportResult = new PromiseSource();
    this._sendLoopPromise = this._sendLoop();
  }
  send(data) {
    this._bufferData(data);
    if (!this._transportResult) {
      this._transportResult = new PromiseSource();
    }
    return this._transportResult.promise;
  }
  stop() {
    this._executing = false;
    this._sendBufferedData.resolve();
    return this._sendLoopPromise;
  }
  _bufferData(data) {
    if (this._buffer.length && typeof this._buffer[0] !== typeof data) {
      throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof data}`);
    }
    this._buffer.push(data);
    this._sendBufferedData.resolve();
  }
  async _sendLoop() {
    while (true) {
      await this._sendBufferedData.promise;
      if (!this._executing) {
        if (this._transportResult) {
          this._transportResult.reject("Connection stopped.");
        }
        break;
      }
      this._sendBufferedData = new PromiseSource();
      const transportResult = this._transportResult;
      this._transportResult = void 0;
      const data = typeof this._buffer[0] === "string" ? this._buffer.join("") : TransportSendQueue._concatBuffers(this._buffer);
      this._buffer.length = 0;
      try {
        await this._transport.send(data);
        transportResult.resolve();
      } catch (error2) {
        transportResult.reject(error2);
      }
    }
  }
  static _concatBuffers(arrayBuffers) {
    const totalLength = arrayBuffers.map((b2) => b2.byteLength).reduce((a2, b2) => a2 + b2);
    const result = new Uint8Array(totalLength);
    let offset2 = 0;
    for (const item of arrayBuffers) {
      result.set(new Uint8Array(item), offset2);
      offset2 += item.byteLength;
    }
    return result.buffer;
  }
}
class PromiseSource {
  constructor() {
    this.promise = new Promise((resolve2, reject) => [this._resolver, this._rejecter] = [resolve2, reject]);
  }
  resolve() {
    this._resolver();
  }
  reject(reason) {
    this._rejecter(reason);
  }
}
const JSON_HUB_PROTOCOL_NAME = "json";
class JsonHubProtocol {
  constructor() {
    this.name = JSON_HUB_PROTOCOL_NAME;
    this.version = 1;
    this.transferFormat = TransferFormat.Text;
  }
  /** Creates an array of {@link @microsoft/signalr.HubMessage} objects from the specified serialized representation.
   *
   * @param {string} input A string containing the serialized representation.
   * @param {ILogger} logger A logger that will be used to log messages that occur during parsing.
   */
  parseMessages(input2, logger) {
    if (typeof input2 !== "string") {
      throw new Error("Invalid input for JSON hub protocol. Expected a string.");
    }
    if (!input2) {
      return [];
    }
    if (logger === null) {
      logger = NullLogger.instance;
    }
    const messages2 = TextMessageFormat.parse(input2);
    const hubMessages = [];
    for (const message of messages2) {
      const parsedMessage = JSON.parse(message);
      if (typeof parsedMessage.type !== "number") {
        throw new Error("Invalid payload.");
      }
      switch (parsedMessage.type) {
        case MessageType.Invocation:
          this._isInvocationMessage(parsedMessage);
          break;
        case MessageType.StreamItem:
          this._isStreamItemMessage(parsedMessage);
          break;
        case MessageType.Completion:
          this._isCompletionMessage(parsedMessage);
          break;
        case MessageType.Ping:
          break;
        case MessageType.Close:
          break;
        default:
          logger.log(LogLevel$1.Information, "Unknown message type '" + parsedMessage.type + "' ignored.");
          continue;
      }
      hubMessages.push(parsedMessage);
    }
    return hubMessages;
  }
  /** Writes the specified {@link @microsoft/signalr.HubMessage} to a string and returns it.
   *
   * @param {HubMessage} message The message to write.
   * @returns {string} A string containing the serialized representation of the message.
   */
  writeMessage(message) {
    return TextMessageFormat.write(JSON.stringify(message));
  }
  _isInvocationMessage(message) {
    this._assertNotEmptyString(message.target, "Invalid payload for Invocation message.");
    if (message.invocationId !== void 0) {
      this._assertNotEmptyString(message.invocationId, "Invalid payload for Invocation message.");
    }
  }
  _isStreamItemMessage(message) {
    this._assertNotEmptyString(message.invocationId, "Invalid payload for StreamItem message.");
    if (message.item === void 0) {
      throw new Error("Invalid payload for StreamItem message.");
    }
  }
  _isCompletionMessage(message) {
    if (message.result && message.error) {
      throw new Error("Invalid payload for Completion message.");
    }
    if (!message.result && message.error) {
      this._assertNotEmptyString(message.error, "Invalid payload for Completion message.");
    }
    this._assertNotEmptyString(message.invocationId, "Invalid payload for Completion message.");
  }
  _assertNotEmptyString(value2, errorMessage) {
    if (typeof value2 !== "string" || value2 === "") {
      throw new Error(errorMessage);
    }
  }
}
const LogLevelNameMapping = {
  trace: LogLevel$1.Trace,
  debug: LogLevel$1.Debug,
  info: LogLevel$1.Information,
  information: LogLevel$1.Information,
  warn: LogLevel$1.Warning,
  warning: LogLevel$1.Warning,
  error: LogLevel$1.Error,
  critical: LogLevel$1.Critical,
  none: LogLevel$1.None
};
function parseLogLevel(name2) {
  const mapping = LogLevelNameMapping[name2.toLowerCase()];
  if (typeof mapping !== "undefined") {
    return mapping;
  } else {
    throw new Error(`Unknown log level: ${name2}`);
  }
}
class HubConnectionBuilder {
  configureLogging(logging) {
    Arg.isRequired(logging, "logging");
    if (isLogger(logging)) {
      this.logger = logging;
    } else if (typeof logging === "string") {
      const logLevel = parseLogLevel(logging);
      this.logger = new ConsoleLogger(logLevel);
    } else {
      this.logger = new ConsoleLogger(logging);
    }
    return this;
  }
  withUrl(url2, transportTypeOrOptions) {
    Arg.isRequired(url2, "url");
    Arg.isNotEmpty(url2, "url");
    this.url = url2;
    if (typeof transportTypeOrOptions === "object") {
      this.httpConnectionOptions = { ...this.httpConnectionOptions, ...transportTypeOrOptions };
    } else {
      this.httpConnectionOptions = {
        ...this.httpConnectionOptions,
        transport: transportTypeOrOptions
      };
    }
    return this;
  }
  /** Configures the {@link @microsoft/signalr.HubConnection} to use the specified Hub Protocol.
   *
   * @param {IHubProtocol} protocol The {@link @microsoft/signalr.IHubProtocol} implementation to use.
   */
  withHubProtocol(protocol) {
    Arg.isRequired(protocol, "protocol");
    this.protocol = protocol;
    return this;
  }
  withAutomaticReconnect(retryDelaysOrReconnectPolicy) {
    if (this.reconnectPolicy) {
      throw new Error("A reconnectPolicy has already been set.");
    }
    if (!retryDelaysOrReconnectPolicy) {
      this.reconnectPolicy = new DefaultReconnectPolicy();
    } else if (Array.isArray(retryDelaysOrReconnectPolicy)) {
      this.reconnectPolicy = new DefaultReconnectPolicy(retryDelaysOrReconnectPolicy);
    } else {
      this.reconnectPolicy = retryDelaysOrReconnectPolicy;
    }
    return this;
  }
  /** Creates a {@link @microsoft/signalr.HubConnection} from the configuration options specified in this builder.
   *
   * @returns {HubConnection} The configured {@link @microsoft/signalr.HubConnection}.
   */
  build() {
    const httpConnectionOptions = this.httpConnectionOptions || {};
    if (httpConnectionOptions.logger === void 0) {
      httpConnectionOptions.logger = this.logger;
    }
    if (!this.url) {
      throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");
    }
    const connection = new HttpConnection(this.url, httpConnectionOptions);
    return HubConnection.create(connection, this.logger || NullLogger.instance, this.protocol || new JsonHubProtocol(), this.reconnectPolicy);
  }
}
function isLogger(logger) {
  return logger.log !== void 0;
}
const createAbortError = () => {
  const error2 = new Error("Delay aborted");
  error2.name = "AbortError";
  return error2;
};
const clearMethods = /* @__PURE__ */ new WeakMap();
function createDelay({ clearTimeout: defaultClear, setTimeout: defaultSet } = {}) {
  return (milliseconds2, { value: value2, signal } = {}) => {
    if (signal == null ? void 0 : signal.aborted) {
      return Promise.reject(createAbortError());
    }
    let timeoutId;
    let settle2;
    let rejectFunction;
    const clear = defaultClear ?? clearTimeout;
    const signalListener = () => {
      clear(timeoutId);
      rejectFunction(createAbortError());
    };
    const cleanup2 = () => {
      if (signal) {
        signal.removeEventListener("abort", signalListener);
      }
    };
    const delayPromise = new Promise((resolve2, reject) => {
      settle2 = () => {
        cleanup2();
        resolve2(value2);
      };
      rejectFunction = reject;
      timeoutId = (defaultSet ?? setTimeout)(settle2, milliseconds2);
    });
    if (signal) {
      signal.addEventListener("abort", signalListener, { once: true });
    }
    clearMethods.set(delayPromise, () => {
      clear(timeoutId);
      timeoutId = null;
      settle2();
    });
    return delayPromise;
  };
}
const delay = createDelay();
const byteToHex = [];
for (let i2 = 0; i2 < 256; ++i2) {
  byteToHex.push((i2 + 256).toString(16).slice(1));
}
function unsafeStringify(arr, offset2 = 0) {
  return (byteToHex[arr[offset2 + 0]] + byteToHex[arr[offset2 + 1]] + byteToHex[arr[offset2 + 2]] + byteToHex[arr[offset2 + 3]] + "-" + byteToHex[arr[offset2 + 4]] + byteToHex[arr[offset2 + 5]] + "-" + byteToHex[arr[offset2 + 6]] + byteToHex[arr[offset2 + 7]] + "-" + byteToHex[arr[offset2 + 8]] + byteToHex[arr[offset2 + 9]] + "-" + byteToHex[arr[offset2 + 10]] + byteToHex[arr[offset2 + 11]] + byteToHex[arr[offset2 + 12]] + byteToHex[arr[offset2 + 13]] + byteToHex[arr[offset2 + 14]] + byteToHex[arr[offset2 + 15]]).toLowerCase();
}
let getRandomValues;
const rnds8 = new Uint8Array(16);
function rng() {
  if (!getRandomValues) {
    if (typeof crypto === "undefined" || !crypto.getRandomValues) {
      throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
    }
    getRandomValues = crypto.getRandomValues.bind(crypto);
  }
  return getRandomValues(rnds8);
}
const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
const native = { randomUUID };
function v4(options, buf, offset2) {
  var _a2;
  if (native.randomUUID && true && !options) {
    return native.randomUUID();
  }
  options = options || {};
  const rnds = options.random ?? ((_a2 = options.rng) == null ? void 0 : _a2.call(options)) ?? rng();
  if (rnds.length < 16) {
    throw new Error("Random bytes length must be >= 16");
  }
  rnds[6] = rnds[6] & 15 | 64;
  rnds[8] = rnds[8] & 63 | 128;
  return unsafeStringify(rnds);
}
const Button = reactExports.forwardRef(
  (props, ref) => {
    let nSize;
    if (props.size) {
      switch (props.size) {
        case "sm":
        case "md":
        case "lg":
          nSize = props.size;
          break;
        case "small":
          nSize = "sm";
          break;
        case "medium":
          nSize = "md";
          break;
        case "large":
          nSize = "lg";
          break;
      }
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      button_default$1,
      {
        ref,
        isDisabled: props.disabled,
        ...props,
        size: nSize
      }
    );
  }
);
var voidElements = {
  "area": true,
  "base": true,
  "br": true,
  "col": true,
  "embed": true,
  "hr": true,
  "img": true,
  "input": true,
  "link": true,
  "meta": true,
  "param": true,
  "source": true,
  "track": true,
  "wbr": true
};
const e$2 = /* @__PURE__ */ getDefaultExportFromCjs(voidElements);
var t$5 = /\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;
function n$4(n2) {
  var r2 = { type: "tag", name: "", voidElement: false, attrs: {}, children: [] }, i2 = n2.match(/<\/?([^\s]+?)[/\s>]/);
  if (i2 && (r2.name = i2[1], (e$2[i2[1]] || "/" === n2.charAt(n2.length - 2)) && (r2.voidElement = true), r2.name.startsWith("!--"))) {
    var s2 = n2.indexOf("-->");
    return { type: "comment", comment: -1 !== s2 ? n2.slice(4, s2) : "" };
  }
  for (var a2 = new RegExp(t$5), c2 = null; null !== (c2 = a2.exec(n2)); )
    if (c2[0].trim())
      if (c2[1]) {
        var o2 = c2[1].trim(), l2 = [o2, ""];
        o2.indexOf("=") > -1 && (l2 = o2.split("=")), r2.attrs[l2[0]] = l2[1], a2.lastIndex--;
      } else
        c2[2] && (r2.attrs[c2[2]] = c2[3].trim().substring(1, c2[3].length - 1));
  return r2;
}
var r$4 = /<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g, i$2 = /^\s*$/, s$3 = /* @__PURE__ */ Object.create(null);
function a$2(e2, t2) {
  switch (t2.type) {
    case "text":
      return e2 + t2.content;
    case "tag":
      return e2 += "<" + t2.name + (t2.attrs ? function(e3) {
        var t3 = [];
        for (var n2 in e3)
          t3.push(n2 + '="' + e3[n2] + '"');
        return t3.length ? " " + t3.join(" ") : "";
      }(t2.attrs) : "") + (t2.voidElement ? "/>" : ">"), t2.voidElement ? e2 : e2 + t2.children.reduce(a$2, "") + "</" + t2.name + ">";
    case "comment":
      return e2 + "<!--" + t2.comment + "-->";
  }
}
var c$4 = { parse: function(e2, t2) {
  t2 || (t2 = {}), t2.components || (t2.components = s$3);
  var a2, c2 = [], o2 = [], l2 = -1, m2 = false;
  if (0 !== e2.indexOf("<")) {
    var u2 = e2.indexOf("<");
    c2.push({ type: "text", content: -1 === u2 ? e2 : e2.substring(0, u2) });
  }
  return e2.replace(r$4, function(r2, s2) {
    if (m2) {
      if (r2 !== "</" + a2.name + ">")
        return;
      m2 = false;
    }
    var u3, f2 = "/" !== r2.charAt(1), h3 = r2.startsWith("<!--"), p2 = s2 + r2.length, d2 = e2.charAt(p2);
    if (h3) {
      var v2 = n$4(r2);
      return l2 < 0 ? (c2.push(v2), c2) : ((u3 = o2[l2]).children.push(v2), c2);
    }
    if (f2 && (l2++, "tag" === (a2 = n$4(r2)).type && t2.components[a2.name] && (a2.type = "component", m2 = true), a2.voidElement || m2 || !d2 || "<" === d2 || a2.children.push({ type: "text", content: e2.slice(p2, e2.indexOf("<", p2)) }), 0 === l2 && c2.push(a2), (u3 = o2[l2 - 1]) && u3.children.push(a2), o2[l2] = a2), (!f2 || a2.voidElement) && (l2 > -1 && (a2.voidElement || a2.name === r2.slice(2, -1)) && (l2--, a2 = -1 === l2 ? c2 : o2[l2]), !m2 && "<" !== d2 && d2)) {
      u3 = -1 === l2 ? c2 : o2[l2].children;
      var x2 = e2.indexOf("<", p2), g2 = e2.slice(p2, -1 === x2 ? void 0 : x2);
      i$2.test(g2) && (g2 = " "), (x2 > -1 && l2 + u3.length >= 0 || " " !== g2) && u3.push({ type: "text", content: g2 });
    }
  }), c2;
}, stringify: function(e2) {
  return e2.reduce(function(e3, t2) {
    return e3 + a$2("", t2);
  }, "");
} };
var matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
var htmlEntities = {
  "&amp;": "&",
  "&#38;": "&",
  "&lt;": "<",
  "&#60;": "<",
  "&gt;": ">",
  "&#62;": ">",
  "&apos;": "'",
  "&#39;": "'",
  "&quot;": '"',
  "&#34;": '"',
  "&nbsp;": " ",
  "&#160;": " ",
  "&copy;": "©",
  "&#169;": "©",
  "&reg;": "®",
  "&#174;": "®",
  "&hellip;": "…",
  "&#8230;": "…",
  "&#x2F;": "/",
  "&#47;": "/"
};
var unescapeHtmlEntity = function unescapeHtmlEntity2(m2) {
  return htmlEntities[m2];
};
var unescape$1 = function unescape2(text2) {
  return text2.replace(matchHtmlEntity, unescapeHtmlEntity);
};
function ownKeys$e(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
      });
    }
    keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$f(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2] != null ? arguments[i2] : {};
    if (i2 % 2) {
      ownKeys$e(Object(source2), true).forEach(function(key) {
        _defineProperty$3(target, key, source2[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2));
    } else {
      ownKeys$e(Object(source2)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
      });
    }
  }
  return target;
}
var defaultOptions$1 = {
  bindI18n: "languageChanged",
  bindI18nStore: "",
  transEmptyNodeValue: "",
  transSupportBasicHtmlNodes: true,
  transWrapTextNodes: "",
  transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
  useSuspense: true,
  unescape: unescape$1
};
var i18nInstance;
var I18nContext = reactExports.createContext();
function setDefaults() {
  var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
  defaultOptions$1 = _objectSpread$f(_objectSpread$f({}, defaultOptions$1), options);
}
function getDefaults() {
  return defaultOptions$1;
}
var ReportNamespaces = function() {
  function ReportNamespaces2() {
    _classCallCheck$a(this, ReportNamespaces2);
    this.usedNamespaces = {};
  }
  _createClass$8(ReportNamespaces2, [{
    key: "addUsedNamespaces",
    value: function addUsedNamespaces(namespaces) {
      var _this = this;
      namespaces.forEach(function(ns) {
        if (!_this.usedNamespaces[ns])
          _this.usedNamespaces[ns] = true;
      });
    }
  }, {
    key: "getUsedNamespaces",
    value: function getUsedNamespaces() {
      return Object.keys(this.usedNamespaces);
    }
  }]);
  return ReportNamespaces2;
}();
function setI18n(instance2) {
  i18nInstance = instance2;
}
function getI18n() {
  return i18nInstance;
}
var initReactI18next = {
  type: "3rdParty",
  init: function init(instance2) {
    setDefaults(instance2.options.react);
    setI18n(instance2);
  }
};
function warn$1() {
  if (console && console.warn) {
    var _console;
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    if (typeof args[0] === "string")
      args[0] = "react-i18next:: ".concat(args[0]);
    (_console = console).warn.apply(_console, args);
  }
}
var alreadyWarned = {};
function warnOnce() {
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
    args[_key2] = arguments[_key2];
  }
  if (typeof args[0] === "string" && alreadyWarned[args[0]])
    return;
  if (typeof args[0] === "string")
    alreadyWarned[args[0]] = /* @__PURE__ */ new Date();
  warn$1.apply(void 0, args);
}
function loadNamespaces(i18n, ns, cb2) {
  i18n.loadNamespaces(ns, function() {
    if (i18n.isInitialized) {
      cb2();
    } else {
      var initialized = function initialized2() {
        setTimeout(function() {
          i18n.off("initialized", initialized2);
        }, 0);
        cb2();
      };
      i18n.on("initialized", initialized);
    }
  });
}
function oldI18nextHasLoadedNamespace(ns, i18n) {
  var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
  var lng = i18n.languages[0];
  var fallbackLng = i18n.options ? i18n.options.fallbackLng : false;
  var lastLng = i18n.languages[i18n.languages.length - 1];
  if (lng.toLowerCase() === "cimode")
    return true;
  var loadNotPending = function loadNotPending2(l2, n2) {
    var loadState = i18n.services.backendConnector.state["".concat(l2, "|").concat(n2)];
    return loadState === -1 || loadState === 2;
  };
  if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18n.services.backendConnector.backend && i18n.isLanguageChangingTo && !loadNotPending(i18n.isLanguageChangingTo, ns))
    return false;
  if (i18n.hasResourceBundle(lng, ns))
    return true;
  if (!i18n.services.backendConnector.backend || i18n.options.resources && !i18n.options.partialBundledLanguages)
    return true;
  if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns)))
    return true;
  return false;
}
function hasLoadedNamespace(ns, i18n) {
  var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
  if (!i18n.languages || !i18n.languages.length) {
    warnOnce("i18n.languages were undefined or empty", i18n.languages);
    return true;
  }
  var isNewerI18next = i18n.options.ignoreJSONStructure !== void 0;
  if (!isNewerI18next) {
    return oldI18nextHasLoadedNamespace(ns, i18n, options);
  }
  return i18n.hasLoadedNamespace(ns, {
    precheck: function precheck(i18nInstance2, loadNotPending) {
      if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns))
        return false;
    }
  });
}
var _excluded$7 = ["format"], _excluded2$2 = ["children", "count", "parent", "i18nKey", "context", "tOptions", "values", "defaults", "components", "ns", "i18n", "t", "shouldUnescape"];
function ownKeys$d(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
      });
    }
    keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$e(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2] != null ? arguments[i2] : {};
    if (i2 % 2) {
      ownKeys$d(Object(source2), true).forEach(function(key) {
        _defineProperty$3(target, key, source2[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2));
    } else {
      ownKeys$d(Object(source2)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
      });
    }
  }
  return target;
}
function hasChildren(node2, checkLength) {
  if (!node2)
    return false;
  var base = node2.props ? node2.props.children : node2.children;
  if (checkLength)
    return base.length > 0;
  return !!base;
}
function getChildren(node2) {
  if (!node2)
    return [];
  return node2.props ? node2.props.children : node2.children;
}
function hasValidReactChildren(children) {
  if (Object.prototype.toString.call(children) !== "[object Array]")
    return false;
  return children.every(function(child) {
    return reactExports.isValidElement(child);
  });
}
function getAsArray(data) {
  return Array.isArray(data) ? data : [data];
}
function mergeProps$1(source2, target) {
  var newTarget = _objectSpread$e({}, target);
  newTarget.props = Object.assign(source2.props, target.props);
  return newTarget;
}
function nodesToString(children, i18nOptions) {
  if (!children)
    return "";
  var stringNode = "";
  var childrenArray = getAsArray(children);
  var keepArray = i18nOptions.transSupportBasicHtmlNodes && i18nOptions.transKeepBasicHtmlNodesFor ? i18nOptions.transKeepBasicHtmlNodesFor : [];
  childrenArray.forEach(function(child, childIndex) {
    if (typeof child === "string") {
      stringNode += "".concat(child);
    } else if (reactExports.isValidElement(child)) {
      var childPropsCount = Object.keys(child.props).length;
      var shouldKeepChild = keepArray.indexOf(child.type) > -1;
      var childChildren = child.props.children;
      if (!childChildren && shouldKeepChild && childPropsCount === 0) {
        stringNode += "<".concat(child.type, "/>");
      } else if (!childChildren && (!shouldKeepChild || childPropsCount !== 0)) {
        stringNode += "<".concat(childIndex, "></").concat(childIndex, ">");
      } else if (child.props.i18nIsDynamicList) {
        stringNode += "<".concat(childIndex, "></").concat(childIndex, ">");
      } else if (shouldKeepChild && childPropsCount === 1 && typeof childChildren === "string") {
        stringNode += "<".concat(child.type, ">").concat(childChildren, "</").concat(child.type, ">");
      } else {
        var content2 = nodesToString(childChildren, i18nOptions);
        stringNode += "<".concat(childIndex, ">").concat(content2, "</").concat(childIndex, ">");
      }
    } else if (child === null) {
      warn$1("Trans: the passed in value is invalid - seems you passed in a null child.");
    } else if (_typeof$1(child) === "object") {
      var format2 = child.format, clone3 = _objectWithoutProperties$3(child, _excluded$7);
      var keys2 = Object.keys(clone3);
      if (keys2.length === 1) {
        var value2 = format2 ? "".concat(keys2[0], ", ").concat(format2) : keys2[0];
        stringNode += "{{".concat(value2, "}}");
      } else {
        warn$1("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.", child);
      }
    } else {
      warn$1("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.", child);
    }
  });
  return stringNode;
}
function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts, shouldUnescape) {
  if (targetString === "")
    return [];
  var keepArray = i18nOptions.transKeepBasicHtmlNodesFor || [];
  var emptyChildrenButNeedsHandling = targetString && new RegExp(keepArray.join("|")).test(targetString);
  if (!children && !emptyChildrenButNeedsHandling)
    return [targetString];
  var data = {};
  function getData(childs) {
    var childrenArray = getAsArray(childs);
    childrenArray.forEach(function(child) {
      if (typeof child === "string")
        return;
      if (hasChildren(child))
        getData(getChildren(child));
      else if (_typeof$1(child) === "object" && !reactExports.isValidElement(child))
        Object.assign(data, child);
    });
  }
  getData(children);
  var ast = c$4.parse("<0>".concat(targetString, "</0>"));
  var opts2 = _objectSpread$e(_objectSpread$e({}, data), combinedTOpts);
  function renderInner(child, node2, rootReactNode) {
    var childs = getChildren(child);
    var mappedChildren = mapAST(childs, node2.children, rootReactNode);
    return hasValidReactChildren(childs) && mappedChildren.length === 0 ? childs : mappedChildren;
  }
  function pushTranslatedJSX(child, inner, mem, i2, isVoid) {
    if (child.dummy)
      child.children = inner;
    mem.push(reactExports.cloneElement(child, _objectSpread$e(_objectSpread$e({}, child.props), {}, {
      key: i2
    }), isVoid ? void 0 : inner));
  }
  function mapAST(reactNode, astNode, rootReactNode) {
    var reactNodes = getAsArray(reactNode);
    var astNodes = getAsArray(astNode);
    return astNodes.reduce(function(mem, node2, i2) {
      var translationContent = node2.children && node2.children[0] && node2.children[0].content && i18n.services.interpolator.interpolate(node2.children[0].content, opts2, i18n.language);
      if (node2.type === "tag") {
        var tmp = reactNodes[parseInt(node2.name, 10)];
        if (!tmp && rootReactNode.length === 1 && rootReactNode[0][node2.name])
          tmp = rootReactNode[0][node2.name];
        if (!tmp)
          tmp = {};
        var child = Object.keys(node2.attrs).length !== 0 ? mergeProps$1({
          props: node2.attrs
        }, tmp) : tmp;
        var isElement = reactExports.isValidElement(child);
        var isValidTranslationWithChildren = isElement && hasChildren(node2, true) && !node2.voidElement;
        var isEmptyTransWithHTML = emptyChildrenButNeedsHandling && _typeof$1(child) === "object" && child.dummy && !isElement;
        var isKnownComponent = _typeof$1(children) === "object" && children !== null && Object.hasOwnProperty.call(children, node2.name);
        if (typeof child === "string") {
          var value2 = i18n.services.interpolator.interpolate(child, opts2, i18n.language);
          mem.push(value2);
        } else if (hasChildren(child) || isValidTranslationWithChildren) {
          var inner = renderInner(child, node2, rootReactNode);
          pushTranslatedJSX(child, inner, mem, i2);
        } else if (isEmptyTransWithHTML) {
          var _inner = mapAST(reactNodes, node2.children, rootReactNode);
          mem.push(reactExports.cloneElement(child, _objectSpread$e(_objectSpread$e({}, child.props), {}, {
            key: i2
          }), _inner));
        } else if (Number.isNaN(parseFloat(node2.name))) {
          if (isKnownComponent) {
            var _inner2 = renderInner(child, node2, rootReactNode);
            pushTranslatedJSX(child, _inner2, mem, i2, node2.voidElement);
          } else if (i18nOptions.transSupportBasicHtmlNodes && keepArray.indexOf(node2.name) > -1) {
            if (node2.voidElement) {
              mem.push(reactExports.createElement(node2.name, {
                key: "".concat(node2.name, "-").concat(i2)
              }));
            } else {
              var _inner3 = mapAST(reactNodes, node2.children, rootReactNode);
              mem.push(reactExports.createElement(node2.name, {
                key: "".concat(node2.name, "-").concat(i2)
              }, _inner3));
            }
          } else if (node2.voidElement) {
            mem.push("<".concat(node2.name, " />"));
          } else {
            var _inner4 = mapAST(reactNodes, node2.children, rootReactNode);
            mem.push("<".concat(node2.name, ">").concat(_inner4, "</").concat(node2.name, ">"));
          }
        } else if (_typeof$1(child) === "object" && !isElement) {
          var content2 = node2.children[0] ? translationContent : null;
          if (content2)
            mem.push(content2);
        } else if (node2.children.length === 1 && translationContent) {
          mem.push(reactExports.cloneElement(child, _objectSpread$e(_objectSpread$e({}, child.props), {}, {
            key: i2
          }), translationContent));
        } else {
          mem.push(reactExports.cloneElement(child, _objectSpread$e(_objectSpread$e({}, child.props), {}, {
            key: i2
          })));
        }
      } else if (node2.type === "text") {
        var wrapTextNodes = i18nOptions.transWrapTextNodes;
        var _content = shouldUnescape ? i18nOptions.unescape(i18n.services.interpolator.interpolate(node2.content, opts2, i18n.language)) : i18n.services.interpolator.interpolate(node2.content, opts2, i18n.language);
        if (wrapTextNodes) {
          mem.push(reactExports.createElement(wrapTextNodes, {
            key: "".concat(node2.name, "-").concat(i2)
          }, _content));
        } else {
          mem.push(_content);
        }
      }
      return mem;
    }, []);
  }
  var result = mapAST([{
    dummy: true,
    children: children || []
  }], ast, getAsArray(children || []));
  return getChildren(result[0]);
}
function Trans(_ref) {
  var children = _ref.children, count = _ref.count, parent = _ref.parent, i18nKey = _ref.i18nKey, context = _ref.context, _ref$tOptions = _ref.tOptions, tOptions = _ref$tOptions === void 0 ? {} : _ref$tOptions, values = _ref.values, defaults2 = _ref.defaults, components2 = _ref.components, ns = _ref.ns, i18nFromProps = _ref.i18n, tFromProps = _ref.t, shouldUnescape = _ref.shouldUnescape, additionalProps = _objectWithoutProperties$3(_ref, _excluded2$2);
  var _ref2 = reactExports.useContext(I18nContext) || {}, i18nFromContext = _ref2.i18n, defaultNSFromContext = _ref2.defaultNS;
  var i18n = i18nFromProps || i18nFromContext || getI18n();
  if (!i18n) {
    warnOnce("You will need to pass in an i18next instance by using i18nextReactModule");
    return children;
  }
  var t2 = tFromProps || i18n.t.bind(i18n) || function(k2) {
    return k2;
  };
  if (context)
    tOptions.context = context;
  var reactI18nextOptions = _objectSpread$e(_objectSpread$e({}, getDefaults()), i18n.options && i18n.options.react);
  var namespaces = ns || t2.ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
  namespaces = typeof namespaces === "string" ? [namespaces] : namespaces || ["translation"];
  var defaultValue2 = defaults2 || nodesToString(children, reactI18nextOptions) || reactI18nextOptions.transEmptyNodeValue || i18nKey;
  var hashTransKey = reactI18nextOptions.hashTransKey;
  var key = i18nKey || (hashTransKey ? hashTransKey(defaultValue2) : defaultValue2);
  var interpolationOverride = values ? tOptions.interpolation : {
    interpolation: _objectSpread$e(_objectSpread$e({}, tOptions.interpolation), {}, {
      prefix: "#$?",
      suffix: "?$#"
    })
  };
  var combinedTOpts = _objectSpread$e(_objectSpread$e(_objectSpread$e(_objectSpread$e({}, tOptions), {}, {
    count
  }, values), interpolationOverride), {}, {
    defaultValue: defaultValue2,
    ns: namespaces
  });
  var translation = key ? t2(key, combinedTOpts) : defaultValue2;
  var content2 = renderNodes(components2 || children, translation, i18n, reactI18nextOptions, combinedTOpts, shouldUnescape);
  var useAsParent = parent !== void 0 ? parent : reactI18nextOptions.defaultTransParent;
  return useAsParent ? reactExports.createElement(useAsParent, additionalProps, content2) : content2;
}
function ownKeys$c(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
      });
    }
    keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$d(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2] != null ? arguments[i2] : {};
    if (i2 % 2) {
      ownKeys$c(Object(source2), true).forEach(function(key) {
        _defineProperty$3(target, key, source2[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2));
    } else {
      ownKeys$c(Object(source2)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
      });
    }
  }
  return target;
}
var usePrevious$2 = function usePrevious(value2, ignore2) {
  var ref = reactExports.useRef();
  reactExports.useEffect(function() {
    ref.current = value2;
  }, [value2, ignore2]);
  return ref.current;
};
function useTranslation(ns) {
  var props = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
  var i18nFromProps = props.i18n;
  var _ref = reactExports.useContext(I18nContext) || {}, i18nFromContext = _ref.i18n, defaultNSFromContext = _ref.defaultNS;
  var i18n = i18nFromProps || i18nFromContext || getI18n();
  if (i18n && !i18n.reportNamespaces)
    i18n.reportNamespaces = new ReportNamespaces();
  if (!i18n) {
    warnOnce("You will need to pass in an i18next instance by using initReactI18next");
    var notReadyT = function notReadyT2(k2) {
      return Array.isArray(k2) ? k2[k2.length - 1] : k2;
    };
    var retNotReady = [notReadyT, {}, false];
    retNotReady.t = notReadyT;
    retNotReady.i18n = {};
    retNotReady.ready = false;
    return retNotReady;
  }
  if (i18n.options.react && i18n.options.react.wait !== void 0)
    warnOnce("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
  var i18nOptions = _objectSpread$d(_objectSpread$d(_objectSpread$d({}, getDefaults()), i18n.options.react), props);
  var useSuspense = i18nOptions.useSuspense, keyPrefix = i18nOptions.keyPrefix;
  var namespaces = defaultNSFromContext || i18n.options && i18n.options.defaultNS;
  namespaces = typeof namespaces === "string" ? [namespaces] : namespaces || ["translation"];
  if (i18n.reportNamespaces.addUsedNamespaces)
    i18n.reportNamespaces.addUsedNamespaces(namespaces);
  var ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every(function(n2) {
    return hasLoadedNamespace(n2, i18n, i18nOptions);
  });
  function getT() {
    return i18n.getFixedT(null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
  }
  var _useState = reactExports.useState(getT), _useState2 = _slicedToArray(_useState, 2), t2 = _useState2[0], setT = _useState2[1];
  var joinedNS = namespaces.join();
  var previousJoinedNS = usePrevious$2(joinedNS);
  var isMounted = reactExports.useRef(true);
  reactExports.useEffect(function() {
    var bindI18n = i18nOptions.bindI18n, bindI18nStore = i18nOptions.bindI18nStore;
    isMounted.current = true;
    if (!ready && !useSuspense) {
      loadNamespaces(i18n, namespaces, function() {
        if (isMounted.current)
          setT(getT);
      });
    }
    if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
      setT(getT);
    }
    function boundReset() {
      if (isMounted.current)
        setT(getT);
    }
    if (bindI18n && i18n)
      i18n.on(bindI18n, boundReset);
    if (bindI18nStore && i18n)
      i18n.store.on(bindI18nStore, boundReset);
    return function() {
      isMounted.current = false;
      if (bindI18n && i18n)
        bindI18n.split(" ").forEach(function(e2) {
          return i18n.off(e2, boundReset);
        });
      if (bindI18nStore && i18n)
        bindI18nStore.split(" ").forEach(function(e2) {
          return i18n.store.off(e2, boundReset);
        });
    };
  }, [i18n, joinedNS]);
  var isInitial = reactExports.useRef(true);
  reactExports.useEffect(function() {
    if (isMounted.current && !isInitial.current) {
      setT(getT);
    }
    isInitial.current = false;
  }, [i18n, keyPrefix]);
  var ret = [t2, i18n, ready];
  ret.t = t2;
  ret.i18n = i18n;
  ret.ready = ready;
  if (ready)
    return ret;
  if (!ready && !useSuspense)
    return ret;
  throw new Promise(function(resolve2) {
    loadNamespaces(i18n, namespaces, function() {
      resolve2();
    });
  });
}
const Select = ({ dataSource = [], ...props }) => {
  const { t: t2 } = useTranslation();
  const isMultiline = props.selectionMode === "multiple";
  const baseRenderValue = props.renderValue ?? (isMultiline ? (v2) => {
    if (v2.length > 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-2", children: v2.reduce((s2, x2, i2) => {
        var _a2;
        s2.push(
          /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: props.size ?? void 0, children: ((_a2 = dataSource.find((d2) => {
            var _a3;
            return d2.value === ((_a3 = x2.data) == null ? void 0 : _a3.value);
          })) == null ? void 0 : _a2.label) ?? t2("Unknown label") })
        );
        return s2;
      }, []) });
    }
    return void 0;
  } : void 0);
  const renderValue = baseRenderValue;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    select_default,
    {
      isMultiline,
      items: dataSource ?? [],
      renderValue,
      ...props,
      children: props.children ?? ((data) => {
        var _a2, _b2;
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          listbox_item_base_default,
          {
            "aria-label": (_a2 = data.label) == null ? void 0 : _a2.toString(),
            textValue: data.textValue ?? ((_b2 = data.label) == null ? void 0 : _b2.toString()),
            children: data.label
          },
          data.value
        );
      })
    }
  );
};
Select.displayName = "Select";
const Icon$1 = reactExports.forwardRef(({ type: type4, ...otherProps }, ref) => {
  const iconRef = reactExports.useRef(
    reactExports.lazy(
      () => __vitePreload(() => import(
        /* @vite-ignore */
        `@ant-design/icons/es/icons/${type4}.js`
      ), true ? __vite__mapDeps([]) : void 0).catch(
        (err) => __vitePreload(() => Promise.resolve().then(() => WarningOutlined$1), true ? void 0 : void 0)
      )
    )
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon, {}), children: /* @__PURE__ */ jsxRuntimeExports.jsx(iconRef.current, { ref, ...otherProps }) });
});
const Chip = reactExports.forwardRef((props, ref) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(chip_default, { ref, radius: "sm", ...props });
});
const Tooltip$1 = (props) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(tooltip_default, { showArrow: true, ...props, children: props.children });
};
Tooltip$1.displayName = "Tooltip";
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(module2, exports2) {
  (function() {
    var undefined$1;
    var VERSION2 = "4.17.21";
    var LARGE_ARRAY_SIZE2 = 200;
    var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT2 = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
    var HASH_UNDEFINED2 = "__lodash_hash_undefined__";
    var MAX_MEMOIZE_SIZE2 = 500;
    var PLACEHOLDER = "__lodash_placeholder__";
    var CLONE_DEEP_FLAG2 = 1, CLONE_FLAT_FLAG2 = 2, CLONE_SYMBOLS_FLAG2 = 4;
    var COMPARE_PARTIAL_FLAG2 = 1, COMPARE_UNORDERED_FLAG2 = 2;
    var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512;
    var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
    var HOT_COUNT2 = 800, HOT_SPAN2 = 16;
    var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
    var INFINITY2 = 1 / 0, MAX_SAFE_INTEGER2 = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN2 = 0 / 0;
    var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
    var wrapFlags = [
      ["ary", WRAP_ARY_FLAG],
      ["bind", WRAP_BIND_FLAG],
      ["bindKey", WRAP_BIND_KEY_FLAG],
      ["curry", WRAP_CURRY_FLAG],
      ["curryRight", WRAP_CURRY_RIGHT_FLAG],
      ["flip", WRAP_FLIP_FLAG],
      ["partial", WRAP_PARTIAL_FLAG],
      ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
      ["rearg", WRAP_REARG_FLAG]
    ];
    var argsTag2 = "[object Arguments]", arrayTag2 = "[object Array]", asyncTag2 = "[object AsyncFunction]", boolTag2 = "[object Boolean]", dateTag2 = "[object Date]", domExcTag = "[object DOMException]", errorTag2 = "[object Error]", funcTag2 = "[object Function]", genTag2 = "[object GeneratorFunction]", mapTag2 = "[object Map]", numberTag2 = "[object Number]", nullTag2 = "[object Null]", objectTag2 = "[object Object]", promiseTag2 = "[object Promise]", proxyTag2 = "[object Proxy]", regexpTag2 = "[object RegExp]", setTag2 = "[object Set]", stringTag2 = "[object String]", symbolTag2 = "[object Symbol]", undefinedTag2 = "[object Undefined]", weakMapTag2 = "[object WeakMap]", weakSetTag = "[object WeakSet]";
    var arrayBufferTag2 = "[object ArrayBuffer]", dataViewTag2 = "[object DataView]", float32Tag2 = "[object Float32Array]", float64Tag2 = "[object Float64Array]", int8Tag2 = "[object Int8Array]", int16Tag2 = "[object Int16Array]", int32Tag2 = "[object Int32Array]", uint8Tag2 = "[object Uint8Array]", uint8ClampedTag2 = "[object Uint8ClampedArray]", uint16Tag2 = "[object Uint16Array]", uint32Tag2 = "[object Uint32Array]";
    var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
    var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
    var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
    var reIsDeepProp2 = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp2 = /^\w*$/, rePropName2 = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
    var reRegExpChar2 = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar2.source);
    var reTrimStart2 = /^\s+/;
    var reWhitespace2 = /\s/;
    var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
    var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
    var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
    var reEscapeChar2 = /\\(\\)?/g;
    var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
    var reFlags2 = /\w*$/;
    var reIsBadHex2 = /^[-+]0x[0-9a-f]+$/i;
    var reIsBinary2 = /^0b[01]+$/i;
    var reIsHostCtor2 = /^\[object .+?Constructor\]$/;
    var reIsOctal2 = /^0o[0-7]+$/i;
    var reIsUint2 = /^(?:0|[1-9]\d*)$/;
    var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
    var reNoMatch = /($^)/;
    var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
    var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = "\\u2700-\\u27bf", rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff", rsMathOpRange = "\\xac\\xb1\\xd7\\xf7", rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", rsPunctuationRange = "\\u2000-\\u206f", rsSpaceRange = " \\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", rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde", rsVarRange = "\\ufe0e\\ufe0f", rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
    var rsApos = "['’]", rsAstral = "[" + rsAstralRange + "]", rsBreak = "[" + rsBreakRange + "]", rsCombo = "[" + rsComboRange + "]", rsDigits = "\\d+", rsDingbat = "[" + rsDingbatRange + "]", rsLower = "[" + rsLowerRange + "]", rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[" + rsUpperRange + "]", rsZWJ = "\\u200d";
    var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?", rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?", reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
    var reApos = RegExp(rsApos, "g");
    var reComboMark = RegExp(rsCombo, "g");
    var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
    var reUnicodeWord = RegExp([
      rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
      rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
      rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
      rsUpper + "+" + rsOptContrUpper,
      rsOrdUpper,
      rsOrdLower,
      rsDigits,
      rsEmoji
    ].join("|"), "g");
    var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
    var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
    var contextProps = [
      "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"
    ];
    var templateCounter = -1;
    var typedArrayTags2 = {};
    typedArrayTags2[float32Tag2] = typedArrayTags2[float64Tag2] = typedArrayTags2[int8Tag2] = typedArrayTags2[int16Tag2] = typedArrayTags2[int32Tag2] = typedArrayTags2[uint8Tag2] = typedArrayTags2[uint8ClampedTag2] = typedArrayTags2[uint16Tag2] = typedArrayTags2[uint32Tag2] = true;
    typedArrayTags2[argsTag2] = typedArrayTags2[arrayTag2] = typedArrayTags2[arrayBufferTag2] = typedArrayTags2[boolTag2] = typedArrayTags2[dataViewTag2] = typedArrayTags2[dateTag2] = typedArrayTags2[errorTag2] = typedArrayTags2[funcTag2] = typedArrayTags2[mapTag2] = typedArrayTags2[numberTag2] = typedArrayTags2[objectTag2] = typedArrayTags2[regexpTag2] = typedArrayTags2[setTag2] = typedArrayTags2[stringTag2] = typedArrayTags2[weakMapTag2] = false;
    var cloneableTags2 = {};
    cloneableTags2[argsTag2] = cloneableTags2[arrayTag2] = cloneableTags2[arrayBufferTag2] = cloneableTags2[dataViewTag2] = cloneableTags2[boolTag2] = cloneableTags2[dateTag2] = cloneableTags2[float32Tag2] = cloneableTags2[float64Tag2] = cloneableTags2[int8Tag2] = cloneableTags2[int16Tag2] = cloneableTags2[int32Tag2] = cloneableTags2[mapTag2] = cloneableTags2[numberTag2] = cloneableTags2[objectTag2] = cloneableTags2[regexpTag2] = cloneableTags2[setTag2] = cloneableTags2[stringTag2] = cloneableTags2[symbolTag2] = cloneableTags2[uint8Tag2] = cloneableTags2[uint8ClampedTag2] = cloneableTags2[uint16Tag2] = cloneableTags2[uint32Tag2] = true;
    cloneableTags2[errorTag2] = cloneableTags2[funcTag2] = cloneableTags2[weakMapTag2] = false;
    var deburredLetters = {
      // 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"
    };
    var htmlEscapes = {
      "&": "&amp;",
      "<": "&lt;",
      ">": "&gt;",
      '"': "&quot;",
      "'": "&#39;"
    };
    var htmlUnescapes = {
      "&amp;": "&",
      "&lt;": "<",
      "&gt;": ">",
      "&quot;": '"',
      "&#39;": "'"
    };
    var stringEscapes = {
      "\\": "\\",
      "'": "'",
      "\n": "n",
      "\r": "r",
      "\u2028": "u2028",
      "\u2029": "u2029"
    };
    var freeParseFloat = parseFloat, freeParseInt2 = parseInt;
    var freeGlobal2 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
    var freeSelf2 = typeof self == "object" && self && self.Object === Object && self;
    var root2 = freeGlobal2 || freeSelf2 || Function("return this")();
    var freeExports2 = exports2 && !exports2.nodeType && exports2;
    var freeModule2 = freeExports2 && true && module2 && !module2.nodeType && module2;
    var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
    var freeProcess2 = moduleExports2 && freeGlobal2.process;
    var nodeUtil2 = function() {
      try {
        var types2 = freeModule2 && freeModule2.require && freeModule2.require("util").types;
        if (types2) {
          return types2;
        }
        return freeProcess2 && freeProcess2.binding && freeProcess2.binding("util");
      } catch (e2) {
      }
    }();
    var nodeIsArrayBuffer = nodeUtil2 && nodeUtil2.isArrayBuffer, nodeIsDate = nodeUtil2 && nodeUtil2.isDate, nodeIsMap2 = nodeUtil2 && nodeUtil2.isMap, nodeIsRegExp = nodeUtil2 && nodeUtil2.isRegExp, nodeIsSet2 = nodeUtil2 && nodeUtil2.isSet, nodeIsTypedArray2 = nodeUtil2 && nodeUtil2.isTypedArray;
    function apply2(func, thisArg, args) {
      switch (args.length) {
        case 0:
          return func.call(thisArg);
        case 1:
          return func.call(thisArg, args[0]);
        case 2:
          return func.call(thisArg, args[0], args[1]);
        case 3:
          return func.call(thisArg, args[0], args[1], args[2]);
      }
      return func.apply(thisArg, args);
    }
    function arrayAggregator(array4, setter, iteratee, accumulator) {
      var index2 = -1, length2 = array4 == null ? 0 : array4.length;
      while (++index2 < length2) {
        var value2 = array4[index2];
        setter(accumulator, value2, iteratee(value2), array4);
      }
      return accumulator;
    }
    function arrayEach2(array4, iteratee) {
      var index2 = -1, length2 = array4 == null ? 0 : array4.length;
      while (++index2 < length2) {
        if (iteratee(array4[index2], index2, array4) === false) {
          break;
        }
      }
      return array4;
    }
    function arrayEachRight(array4, iteratee) {
      var length2 = array4 == null ? 0 : array4.length;
      while (length2--) {
        if (iteratee(array4[length2], length2, array4) === false) {
          break;
        }
      }
      return array4;
    }
    function arrayEvery(array4, predicate) {
      var index2 = -1, length2 = array4 == null ? 0 : array4.length;
      while (++index2 < length2) {
        if (!predicate(array4[index2], index2, array4)) {
          return false;
        }
      }
      return true;
    }
    function arrayFilter2(array4, predicate) {
      var index2 = -1, length2 = array4 == null ? 0 : array4.length, resIndex = 0, result = [];
      while (++index2 < length2) {
        var value2 = array4[index2];
        if (predicate(value2, index2, array4)) {
          result[resIndex++] = value2;
        }
      }
      return result;
    }
    function arrayIncludes(array4, value2) {
      var length2 = array4 == null ? 0 : array4.length;
      return !!length2 && baseIndexOf(array4, value2, 0) > -1;
    }
    function arrayIncludesWith(array4, value2, comparator) {
      var index2 = -1, length2 = array4 == null ? 0 : array4.length;
      while (++index2 < length2) {
        if (comparator(value2, array4[index2])) {
          return true;
        }
      }
      return false;
    }
    function arrayMap2(array4, iteratee) {
      var index2 = -1, length2 = array4 == null ? 0 : array4.length, result = Array(length2);
      while (++index2 < length2) {
        result[index2] = iteratee(array4[index2], index2, array4);
      }
      return result;
    }
    function arrayPush2(array4, values) {
      var index2 = -1, length2 = values.length, offset2 = array4.length;
      while (++index2 < length2) {
        array4[offset2 + index2] = values[index2];
      }
      return array4;
    }
    function arrayReduce(array4, iteratee, accumulator, initAccum) {
      var index2 = -1, length2 = array4 == null ? 0 : array4.length;
      if (initAccum && length2) {
        accumulator = array4[++index2];
      }
      while (++index2 < length2) {
        accumulator = iteratee(accumulator, array4[index2], index2, array4);
      }
      return accumulator;
    }
    function arrayReduceRight(array4, iteratee, accumulator, initAccum) {
      var length2 = array4 == null ? 0 : array4.length;
      if (initAccum && length2) {
        accumulator = array4[--length2];
      }
      while (length2--) {
        accumulator = iteratee(accumulator, array4[length2], length2, array4);
      }
      return accumulator;
    }
    function arraySome2(array4, predicate) {
      var index2 = -1, length2 = array4 == null ? 0 : array4.length;
      while (++index2 < length2) {
        if (predicate(array4[index2], index2, array4)) {
          return true;
        }
      }
      return false;
    }
    var asciiSize = baseProperty2("length");
    function asciiToArray(string3) {
      return string3.split("");
    }
    function asciiWords(string3) {
      return string3.match(reAsciiWord) || [];
    }
    function baseFindKey(collection, predicate, eachFunc) {
      var result;
      eachFunc(collection, function(value2, key, collection2) {
        if (predicate(value2, key, collection2)) {
          result = key;
          return false;
        }
      });
      return result;
    }
    function baseFindIndex(array4, predicate, fromIndex, fromRight) {
      var length2 = array4.length, index2 = fromIndex + (fromRight ? 1 : -1);
      while (fromRight ? index2-- : ++index2 < length2) {
        if (predicate(array4[index2], index2, array4)) {
          return index2;
        }
      }
      return -1;
    }
    function baseIndexOf(array4, value2, fromIndex) {
      return value2 === value2 ? strictIndexOf(array4, value2, fromIndex) : baseFindIndex(array4, baseIsNaN, fromIndex);
    }
    function baseIndexOfWith(array4, value2, fromIndex, comparator) {
      var index2 = fromIndex - 1, length2 = array4.length;
      while (++index2 < length2) {
        if (comparator(array4[index2], value2)) {
          return index2;
        }
      }
      return -1;
    }
    function baseIsNaN(value2) {
      return value2 !== value2;
    }
    function baseMean(array4, iteratee) {
      var length2 = array4 == null ? 0 : array4.length;
      return length2 ? baseSum(array4, iteratee) / length2 : NAN2;
    }
    function baseProperty2(key) {
      return function(object4) {
        return object4 == null ? undefined$1 : object4[key];
      };
    }
    function basePropertyOf(object4) {
      return function(key) {
        return object4 == null ? undefined$1 : object4[key];
      };
    }
    function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
      eachFunc(collection, function(value2, index2, collection2) {
        accumulator = initAccum ? (initAccum = false, value2) : iteratee(accumulator, value2, index2, collection2);
      });
      return accumulator;
    }
    function baseSortBy(array4, comparer) {
      var length2 = array4.length;
      array4.sort(comparer);
      while (length2--) {
        array4[length2] = array4[length2].value;
      }
      return array4;
    }
    function baseSum(array4, iteratee) {
      var result, index2 = -1, length2 = array4.length;
      while (++index2 < length2) {
        var current = iteratee(array4[index2]);
        if (current !== undefined$1) {
          result = result === undefined$1 ? current : result + current;
        }
      }
      return result;
    }
    function baseTimes2(n2, iteratee) {
      var index2 = -1, result = Array(n2);
      while (++index2 < n2) {
        result[index2] = iteratee(index2);
      }
      return result;
    }
    function baseToPairs(object4, props) {
      return arrayMap2(props, function(key) {
        return [key, object4[key]];
      });
    }
    function baseTrim2(string3) {
      return string3 ? string3.slice(0, trimmedEndIndex2(string3) + 1).replace(reTrimStart2, "") : string3;
    }
    function baseUnary2(func) {
      return function(value2) {
        return func(value2);
      };
    }
    function baseValues(object4, props) {
      return arrayMap2(props, function(key) {
        return object4[key];
      });
    }
    function cacheHas2(cache2, key) {
      return cache2.has(key);
    }
    function charsStartIndex(strSymbols, chrSymbols) {
      var index2 = -1, length2 = strSymbols.length;
      while (++index2 < length2 && baseIndexOf(chrSymbols, strSymbols[index2], 0) > -1) {
      }
      return index2;
    }
    function charsEndIndex(strSymbols, chrSymbols) {
      var index2 = strSymbols.length;
      while (index2-- && baseIndexOf(chrSymbols, strSymbols[index2], 0) > -1) {
      }
      return index2;
    }
    function countHolders(array4, placeholder) {
      var length2 = array4.length, result = 0;
      while (length2--) {
        if (array4[length2] === placeholder) {
          ++result;
        }
      }
      return result;
    }
    var deburrLetter = basePropertyOf(deburredLetters);
    var escapeHtmlChar = basePropertyOf(htmlEscapes);
    function escapeStringChar(chr) {
      return "\\" + stringEscapes[chr];
    }
    function getValue2(object4, key) {
      return object4 == null ? undefined$1 : object4[key];
    }
    function hasUnicode(string3) {
      return reHasUnicode.test(string3);
    }
    function hasUnicodeWord(string3) {
      return reHasUnicodeWord.test(string3);
    }
    function iteratorToArray(iterator2) {
      var data, result = [];
      while (!(data = iterator2.next()).done) {
        result.push(data.value);
      }
      return result;
    }
    function mapToArray2(map2) {
      var index2 = -1, result = Array(map2.size);
      map2.forEach(function(value2, key) {
        result[++index2] = [key, value2];
      });
      return result;
    }
    function overArg2(func, transform2) {
      return function(arg) {
        return func(transform2(arg));
      };
    }
    function replaceHolders(array4, placeholder) {
      var index2 = -1, length2 = array4.length, resIndex = 0, result = [];
      while (++index2 < length2) {
        var value2 = array4[index2];
        if (value2 === placeholder || value2 === PLACEHOLDER) {
          array4[index2] = PLACEHOLDER;
          result[resIndex++] = index2;
        }
      }
      return result;
    }
    function setToArray2(set2) {
      var index2 = -1, result = Array(set2.size);
      set2.forEach(function(value2) {
        result[++index2] = value2;
      });
      return result;
    }
    function setToPairs(set2) {
      var index2 = -1, result = Array(set2.size);
      set2.forEach(function(value2) {
        result[++index2] = [value2, value2];
      });
      return result;
    }
    function strictIndexOf(array4, value2, fromIndex) {
      var index2 = fromIndex - 1, length2 = array4.length;
      while (++index2 < length2) {
        if (array4[index2] === value2) {
          return index2;
        }
      }
      return -1;
    }
    function strictLastIndexOf(array4, value2, fromIndex) {
      var index2 = fromIndex + 1;
      while (index2--) {
        if (array4[index2] === value2) {
          return index2;
        }
      }
      return index2;
    }
    function stringSize(string3) {
      return hasUnicode(string3) ? unicodeSize(string3) : asciiSize(string3);
    }
    function stringToArray3(string3) {
      return hasUnicode(string3) ? unicodeToArray(string3) : asciiToArray(string3);
    }
    function trimmedEndIndex2(string3) {
      var index2 = string3.length;
      while (index2-- && reWhitespace2.test(string3.charAt(index2))) {
      }
      return index2;
    }
    var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
    function unicodeSize(string3) {
      var result = reUnicode.lastIndex = 0;
      while (reUnicode.test(string3)) {
        ++result;
      }
      return result;
    }
    function unicodeToArray(string3) {
      return string3.match(reUnicode) || [];
    }
    function unicodeWords(string3) {
      return string3.match(reUnicodeWord) || [];
    }
    var runInContext = function runInContext2(context) {
      context = context == null ? root2 : _24.defaults(root2.Object(), context, _24.pick(root2, contextProps));
      var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
      var arrayProto2 = Array2.prototype, funcProto2 = Function2.prototype, objectProto2 = Object2.prototype;
      var coreJsData2 = context["__core-js_shared__"];
      var funcToString2 = funcProto2.toString;
      var hasOwnProperty2 = objectProto2.hasOwnProperty;
      var idCounter2 = 0;
      var maskSrcKey2 = function() {
        var uid2 = /[^.]+$/.exec(coreJsData2 && coreJsData2.keys && coreJsData2.keys.IE_PROTO || "");
        return uid2 ? "Symbol(src)_1." + uid2 : "";
      }();
      var nativeObjectToString2 = objectProto2.toString;
      var objectCtorString2 = funcToString2.call(Object2);
      var oldDash = root2._;
      var reIsNative2 = RegExp2(
        "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
      );
      var Buffer2 = moduleExports2 ? context.Buffer : undefined$1, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined$1, getPrototype2 = overArg2(Object2.getPrototypeOf, Object2), objectCreate2 = Object2.create, propertyIsEnumerable2 = objectProto2.propertyIsEnumerable, splice2 = arrayProto2.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined$1, symIterator = Symbol2 ? Symbol2.iterator : undefined$1, symToStringTag2 = Symbol2 ? Symbol2.toStringTag : undefined$1;
      var defineProperty2 = function() {
        try {
          var func = getNative2(Object2, "defineProperty");
          func({}, "", {});
          return func;
        } catch (e2) {
        }
      }();
      var ctxClearTimeout = context.clearTimeout !== root2.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root2.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root2.setTimeout && context.setTimeout;
      var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols2 = Object2.getOwnPropertySymbols, nativeIsBuffer2 = Buffer2 ? Buffer2.isBuffer : undefined$1, nativeIsFinite = context.isFinite, nativeJoin = arrayProto2.join, nativeKeys2 = overArg2(Object2.keys, Object2), nativeMax2 = Math2.max, nativeMin2 = Math2.min, nativeNow2 = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto2.reverse;
      var DataView2 = getNative2(context, "DataView"), Map2 = getNative2(context, "Map"), Promise2 = getNative2(context, "Promise"), Set2 = getNative2(context, "Set"), WeakMap2 = getNative2(context, "WeakMap"), nativeCreate2 = getNative2(Object2, "create");
      var metaMap = WeakMap2 && new WeakMap2();
      var realNames = {};
      var dataViewCtorString2 = toSource2(DataView2), mapCtorString2 = toSource2(Map2), promiseCtorString2 = toSource2(Promise2), setCtorString2 = toSource2(Set2), weakMapCtorString2 = toSource2(WeakMap2);
      var symbolProto2 = Symbol2 ? Symbol2.prototype : undefined$1, symbolValueOf2 = symbolProto2 ? symbolProto2.valueOf : undefined$1, symbolToString2 = symbolProto2 ? symbolProto2.toString : undefined$1;
      function lodash2(value2) {
        if (isObjectLike2(value2) && !isArray3(value2) && !(value2 instanceof LazyWrapper)) {
          if (value2 instanceof LodashWrapper) {
            return value2;
          }
          if (hasOwnProperty2.call(value2, "__wrapped__")) {
            return wrapperClone(value2);
          }
        }
        return new LodashWrapper(value2);
      }
      var baseCreate2 = /* @__PURE__ */ function() {
        function object4() {
        }
        return function(proto2) {
          if (!isObject2(proto2)) {
            return {};
          }
          if (objectCreate2) {
            return objectCreate2(proto2);
          }
          object4.prototype = proto2;
          var result2 = new object4();
          object4.prototype = undefined$1;
          return result2;
        };
      }();
      function baseLodash() {
      }
      function LodashWrapper(value2, chainAll) {
        this.__wrapped__ = value2;
        this.__actions__ = [];
        this.__chain__ = !!chainAll;
        this.__index__ = 0;
        this.__values__ = undefined$1;
      }
      lodash2.templateSettings = {
        /**
         * Used to detect `data` property values to be HTML-escaped.
         *
         * @memberOf _.templateSettings
         * @type {RegExp}
         */
        "escape": reEscape,
        /**
         * Used to detect code to be evaluated.
         *
         * @memberOf _.templateSettings
         * @type {RegExp}
         */
        "evaluate": reEvaluate,
        /**
         * Used to detect `data` property values to inject.
         *
         * @memberOf _.templateSettings
         * @type {RegExp}
         */
        "interpolate": reInterpolate,
        /**
         * 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}
           */
          "_": lodash2
        }
      };
      lodash2.prototype = baseLodash.prototype;
      lodash2.prototype.constructor = lodash2;
      LodashWrapper.prototype = baseCreate2(baseLodash.prototype);
      LodashWrapper.prototype.constructor = LodashWrapper;
      function LazyWrapper(value2) {
        this.__wrapped__ = value2;
        this.__actions__ = [];
        this.__dir__ = 1;
        this.__filtered__ = false;
        this.__iteratees__ = [];
        this.__takeCount__ = MAX_ARRAY_LENGTH;
        this.__views__ = [];
      }
      function lazyClone() {
        var result2 = new LazyWrapper(this.__wrapped__);
        result2.__actions__ = copyArray2(this.__actions__);
        result2.__dir__ = this.__dir__;
        result2.__filtered__ = this.__filtered__;
        result2.__iteratees__ = copyArray2(this.__iteratees__);
        result2.__takeCount__ = this.__takeCount__;
        result2.__views__ = copyArray2(this.__views__);
        return result2;
      }
      function lazyReverse() {
        if (this.__filtered__) {
          var result2 = new LazyWrapper(this);
          result2.__dir__ = -1;
          result2.__filtered__ = true;
        } else {
          result2 = this.clone();
          result2.__dir__ *= -1;
        }
        return result2;
      }
      function lazyValue() {
        var array4 = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray3(array4), isRight = dir < 0, arrLength = isArr ? array4.length : 0, view = getView(0, arrLength, this.__views__), start2 = view.start, end2 = view.end, length2 = end2 - start2, index2 = isRight ? end2 : start2 - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin2(length2, this.__takeCount__);
        if (!isArr || !isRight && arrLength == length2 && takeCount == length2) {
          return baseWrapperValue(array4, this.__actions__);
        }
        var result2 = [];
        outer:
          while (length2-- && resIndex < takeCount) {
            index2 += dir;
            var iterIndex = -1, value2 = array4[index2];
            while (++iterIndex < iterLength) {
              var data = iteratees[iterIndex], iteratee2 = data.iteratee, type4 = data.type, computed = iteratee2(value2);
              if (type4 == LAZY_MAP_FLAG) {
                value2 = computed;
              } else if (!computed) {
                if (type4 == LAZY_FILTER_FLAG) {
                  continue outer;
                } else {
                  break outer;
                }
              }
            }
            result2[resIndex++] = value2;
          }
        return result2;
      }
      LazyWrapper.prototype = baseCreate2(baseLodash.prototype);
      LazyWrapper.prototype.constructor = LazyWrapper;
      function Hash2(entries) {
        var index2 = -1, length2 = entries == null ? 0 : entries.length;
        this.clear();
        while (++index2 < length2) {
          var entry = entries[index2];
          this.set(entry[0], entry[1]);
        }
      }
      function hashClear2() {
        this.__data__ = nativeCreate2 ? nativeCreate2(null) : {};
        this.size = 0;
      }
      function hashDelete2(key) {
        var result2 = this.has(key) && delete this.__data__[key];
        this.size -= result2 ? 1 : 0;
        return result2;
      }
      function hashGet2(key) {
        var data = this.__data__;
        if (nativeCreate2) {
          var result2 = data[key];
          return result2 === HASH_UNDEFINED2 ? undefined$1 : result2;
        }
        return hasOwnProperty2.call(data, key) ? data[key] : undefined$1;
      }
      function hashHas2(key) {
        var data = this.__data__;
        return nativeCreate2 ? data[key] !== undefined$1 : hasOwnProperty2.call(data, key);
      }
      function hashSet2(key, value2) {
        var data = this.__data__;
        this.size += this.has(key) ? 0 : 1;
        data[key] = nativeCreate2 && value2 === undefined$1 ? HASH_UNDEFINED2 : value2;
        return this;
      }
      Hash2.prototype.clear = hashClear2;
      Hash2.prototype["delete"] = hashDelete2;
      Hash2.prototype.get = hashGet2;
      Hash2.prototype.has = hashHas2;
      Hash2.prototype.set = hashSet2;
      function ListCache2(entries) {
        var index2 = -1, length2 = entries == null ? 0 : entries.length;
        this.clear();
        while (++index2 < length2) {
          var entry = entries[index2];
          this.set(entry[0], entry[1]);
        }
      }
      function listCacheClear2() {
        this.__data__ = [];
        this.size = 0;
      }
      function listCacheDelete2(key) {
        var data = this.__data__, index2 = assocIndexOf2(data, key);
        if (index2 < 0) {
          return false;
        }
        var lastIndex = data.length - 1;
        if (index2 == lastIndex) {
          data.pop();
        } else {
          splice2.call(data, index2, 1);
        }
        --this.size;
        return true;
      }
      function listCacheGet2(key) {
        var data = this.__data__, index2 = assocIndexOf2(data, key);
        return index2 < 0 ? undefined$1 : data[index2][1];
      }
      function listCacheHas2(key) {
        return assocIndexOf2(this.__data__, key) > -1;
      }
      function listCacheSet2(key, value2) {
        var data = this.__data__, index2 = assocIndexOf2(data, key);
        if (index2 < 0) {
          ++this.size;
          data.push([key, value2]);
        } else {
          data[index2][1] = value2;
        }
        return this;
      }
      ListCache2.prototype.clear = listCacheClear2;
      ListCache2.prototype["delete"] = listCacheDelete2;
      ListCache2.prototype.get = listCacheGet2;
      ListCache2.prototype.has = listCacheHas2;
      ListCache2.prototype.set = listCacheSet2;
      function MapCache2(entries) {
        var index2 = -1, length2 = entries == null ? 0 : entries.length;
        this.clear();
        while (++index2 < length2) {
          var entry = entries[index2];
          this.set(entry[0], entry[1]);
        }
      }
      function mapCacheClear2() {
        this.size = 0;
        this.__data__ = {
          "hash": new Hash2(),
          "map": new (Map2 || ListCache2)(),
          "string": new Hash2()
        };
      }
      function mapCacheDelete2(key) {
        var result2 = getMapData2(this, key)["delete"](key);
        this.size -= result2 ? 1 : 0;
        return result2;
      }
      function mapCacheGet2(key) {
        return getMapData2(this, key).get(key);
      }
      function mapCacheHas2(key) {
        return getMapData2(this, key).has(key);
      }
      function mapCacheSet2(key, value2) {
        var data = getMapData2(this, key), size3 = data.size;
        data.set(key, value2);
        this.size += data.size == size3 ? 0 : 1;
        return this;
      }
      MapCache2.prototype.clear = mapCacheClear2;
      MapCache2.prototype["delete"] = mapCacheDelete2;
      MapCache2.prototype.get = mapCacheGet2;
      MapCache2.prototype.has = mapCacheHas2;
      MapCache2.prototype.set = mapCacheSet2;
      function SetCache2(values2) {
        var index2 = -1, length2 = values2 == null ? 0 : values2.length;
        this.__data__ = new MapCache2();
        while (++index2 < length2) {
          this.add(values2[index2]);
        }
      }
      function setCacheAdd2(value2) {
        this.__data__.set(value2, HASH_UNDEFINED2);
        return this;
      }
      function setCacheHas2(value2) {
        return this.__data__.has(value2);
      }
      SetCache2.prototype.add = SetCache2.prototype.push = setCacheAdd2;
      SetCache2.prototype.has = setCacheHas2;
      function Stack2(entries) {
        var data = this.__data__ = new ListCache2(entries);
        this.size = data.size;
      }
      function stackClear2() {
        this.__data__ = new ListCache2();
        this.size = 0;
      }
      function stackDelete2(key) {
        var data = this.__data__, result2 = data["delete"](key);
        this.size = data.size;
        return result2;
      }
      function stackGet2(key) {
        return this.__data__.get(key);
      }
      function stackHas2(key) {
        return this.__data__.has(key);
      }
      function stackSet2(key, value2) {
        var data = this.__data__;
        if (data instanceof ListCache2) {
          var pairs = data.__data__;
          if (!Map2 || pairs.length < LARGE_ARRAY_SIZE2 - 1) {
            pairs.push([key, value2]);
            this.size = ++data.size;
            return this;
          }
          data = this.__data__ = new MapCache2(pairs);
        }
        data.set(key, value2);
        this.size = data.size;
        return this;
      }
      Stack2.prototype.clear = stackClear2;
      Stack2.prototype["delete"] = stackDelete2;
      Stack2.prototype.get = stackGet2;
      Stack2.prototype.has = stackHas2;
      Stack2.prototype.set = stackSet2;
      function arrayLikeKeys2(value2, inherited) {
        var isArr = isArray3(value2), isArg = !isArr && isArguments2(value2), isBuff = !isArr && !isArg && isBuffer2(value2), isType = !isArr && !isArg && !isBuff && isTypedArray2(value2), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes2(value2.length, String2) : [], length2 = result2.length;
        for (var key in value2) {
          if ((inherited || hasOwnProperty2.call(value2, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
          (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
          isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
          isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
          isIndex2(key, length2)))) {
            result2.push(key);
          }
        }
        return result2;
      }
      function arraySample(array4) {
        var length2 = array4.length;
        return length2 ? array4[baseRandom(0, length2 - 1)] : undefined$1;
      }
      function arraySampleSize(array4, n2) {
        return shuffleSelf(copyArray2(array4), baseClamp(n2, 0, array4.length));
      }
      function arrayShuffle(array4) {
        return shuffleSelf(copyArray2(array4));
      }
      function assignMergeValue2(object4, key, value2) {
        if (value2 !== undefined$1 && !eq2(object4[key], value2) || value2 === undefined$1 && !(key in object4)) {
          baseAssignValue2(object4, key, value2);
        }
      }
      function assignValue2(object4, key, value2) {
        var objValue = object4[key];
        if (!(hasOwnProperty2.call(object4, key) && eq2(objValue, value2)) || value2 === undefined$1 && !(key in object4)) {
          baseAssignValue2(object4, key, value2);
        }
      }
      function assocIndexOf2(array4, key) {
        var length2 = array4.length;
        while (length2--) {
          if (eq2(array4[length2][0], key)) {
            return length2;
          }
        }
        return -1;
      }
      function baseAggregator(collection, setter, iteratee2, accumulator) {
        baseEach2(collection, function(value2, key, collection2) {
          setter(accumulator, value2, iteratee2(value2), collection2);
        });
        return accumulator;
      }
      function baseAssign2(object4, source2) {
        return object4 && copyObject2(source2, keys2(source2), object4);
      }
      function baseAssignIn2(object4, source2) {
        return object4 && copyObject2(source2, keysIn2(source2), object4);
      }
      function baseAssignValue2(object4, key, value2) {
        if (key == "__proto__" && defineProperty2) {
          defineProperty2(object4, key, {
            "configurable": true,
            "enumerable": true,
            "value": value2,
            "writable": true
          });
        } else {
          object4[key] = value2;
        }
      }
      function baseAt(object4, paths) {
        var index2 = -1, length2 = paths.length, result2 = Array2(length2), skip2 = object4 == null;
        while (++index2 < length2) {
          result2[index2] = skip2 ? undefined$1 : get5(object4, paths[index2]);
        }
        return result2;
      }
      function baseClamp(number4, lower, upper) {
        if (number4 === number4) {
          if (upper !== undefined$1) {
            number4 = number4 <= upper ? number4 : upper;
          }
          if (lower !== undefined$1) {
            number4 = number4 >= lower ? number4 : lower;
          }
        }
        return number4;
      }
      function baseClone2(value2, bitmask, customizer, key, object4, stack) {
        var result2, isDeep = bitmask & CLONE_DEEP_FLAG2, isFlat = bitmask & CLONE_FLAT_FLAG2, isFull = bitmask & CLONE_SYMBOLS_FLAG2;
        if (customizer) {
          result2 = object4 ? customizer(value2, key, object4, stack) : customizer(value2);
        }
        if (result2 !== undefined$1) {
          return result2;
        }
        if (!isObject2(value2)) {
          return value2;
        }
        var isArr = isArray3(value2);
        if (isArr) {
          result2 = initCloneArray2(value2);
          if (!isDeep) {
            return copyArray2(value2, result2);
          }
        } else {
          var tag = getTag2(value2), isFunc = tag == funcTag2 || tag == genTag2;
          if (isBuffer2(value2)) {
            return cloneBuffer2(value2, isDeep);
          }
          if (tag == objectTag2 || tag == argsTag2 || isFunc && !object4) {
            result2 = isFlat || isFunc ? {} : initCloneObject2(value2);
            if (!isDeep) {
              return isFlat ? copySymbolsIn2(value2, baseAssignIn2(result2, value2)) : copySymbols2(value2, baseAssign2(result2, value2));
            }
          } else {
            if (!cloneableTags2[tag]) {
              return object4 ? value2 : {};
            }
            result2 = initCloneByTag2(value2, tag, isDeep);
          }
        }
        stack || (stack = new Stack2());
        var stacked = stack.get(value2);
        if (stacked) {
          return stacked;
        }
        stack.set(value2, result2);
        if (isSet2(value2)) {
          value2.forEach(function(subValue) {
            result2.add(baseClone2(subValue, bitmask, customizer, subValue, value2, stack));
          });
        } else if (isMap2(value2)) {
          value2.forEach(function(subValue, key2) {
            result2.set(key2, baseClone2(subValue, bitmask, customizer, key2, value2, stack));
          });
        }
        var keysFunc = isFull ? isFlat ? getAllKeysIn2 : getAllKeys2 : isFlat ? keysIn2 : keys2;
        var props = isArr ? undefined$1 : keysFunc(value2);
        arrayEach2(props || value2, function(subValue, key2) {
          if (props) {
            key2 = subValue;
            subValue = value2[key2];
          }
          assignValue2(result2, key2, baseClone2(subValue, bitmask, customizer, key2, value2, stack));
        });
        return result2;
      }
      function baseConforms(source2) {
        var props = keys2(source2);
        return function(object4) {
          return baseConformsTo(object4, source2, props);
        };
      }
      function baseConformsTo(object4, source2, props) {
        var length2 = props.length;
        if (object4 == null) {
          return !length2;
        }
        object4 = Object2(object4);
        while (length2--) {
          var key = props[length2], predicate = source2[key], value2 = object4[key];
          if (value2 === undefined$1 && !(key in object4) || !predicate(value2)) {
            return false;
          }
        }
        return true;
      }
      function baseDelay(func, wait, args) {
        if (typeof func != "function") {
          throw new TypeError2(FUNC_ERROR_TEXT2);
        }
        return setTimeout2(function() {
          func.apply(undefined$1, args);
        }, wait);
      }
      function baseDifference(array4, values2, iteratee2, comparator) {
        var index2 = -1, includes2 = arrayIncludes, isCommon = true, length2 = array4.length, result2 = [], valuesLength = values2.length;
        if (!length2) {
          return result2;
        }
        if (iteratee2) {
          values2 = arrayMap2(values2, baseUnary2(iteratee2));
        }
        if (comparator) {
          includes2 = arrayIncludesWith;
          isCommon = false;
        } else if (values2.length >= LARGE_ARRAY_SIZE2) {
          includes2 = cacheHas2;
          isCommon = false;
          values2 = new SetCache2(values2);
        }
        outer:
          while (++index2 < length2) {
            var value2 = array4[index2], computed = iteratee2 == null ? value2 : iteratee2(value2);
            value2 = comparator || value2 !== 0 ? value2 : 0;
            if (isCommon && computed === computed) {
              var valuesIndex = valuesLength;
              while (valuesIndex--) {
                if (values2[valuesIndex] === computed) {
                  continue outer;
                }
              }
              result2.push(value2);
            } else if (!includes2(values2, computed, comparator)) {
              result2.push(value2);
            }
          }
        return result2;
      }
      var baseEach2 = createBaseEach2(baseForOwn2);
      var baseEachRight = createBaseEach2(baseForOwnRight, true);
      function baseEvery(collection, predicate) {
        var result2 = true;
        baseEach2(collection, function(value2, index2, collection2) {
          result2 = !!predicate(value2, index2, collection2);
          return result2;
        });
        return result2;
      }
      function baseExtremum(array4, iteratee2, comparator) {
        var index2 = -1, length2 = array4.length;
        while (++index2 < length2) {
          var value2 = array4[index2], current = iteratee2(value2);
          if (current != null && (computed === undefined$1 ? current === current && !isSymbol2(current) : comparator(current, computed))) {
            var computed = current, result2 = value2;
          }
        }
        return result2;
      }
      function baseFill(array4, value2, start2, end2) {
        var length2 = array4.length;
        start2 = toInteger(start2);
        if (start2 < 0) {
          start2 = -start2 > length2 ? 0 : length2 + start2;
        }
        end2 = end2 === undefined$1 || end2 > length2 ? length2 : toInteger(end2);
        if (end2 < 0) {
          end2 += length2;
        }
        end2 = start2 > end2 ? 0 : toLength(end2);
        while (start2 < end2) {
          array4[start2++] = value2;
        }
        return array4;
      }
      function baseFilter(collection, predicate) {
        var result2 = [];
        baseEach2(collection, function(value2, index2, collection2) {
          if (predicate(value2, index2, collection2)) {
            result2.push(value2);
          }
        });
        return result2;
      }
      function baseFlatten(array4, depth, predicate, isStrict, result2) {
        var index2 = -1, length2 = array4.length;
        predicate || (predicate = isFlattenable);
        result2 || (result2 = []);
        while (++index2 < length2) {
          var value2 = array4[index2];
          if (depth > 0 && predicate(value2)) {
            if (depth > 1) {
              baseFlatten(value2, depth - 1, predicate, isStrict, result2);
            } else {
              arrayPush2(result2, value2);
            }
          } else if (!isStrict) {
            result2[result2.length] = value2;
          }
        }
        return result2;
      }
      var baseFor2 = createBaseFor2();
      var baseForRight = createBaseFor2(true);
      function baseForOwn2(object4, iteratee2) {
        return object4 && baseFor2(object4, iteratee2, keys2);
      }
      function baseForOwnRight(object4, iteratee2) {
        return object4 && baseForRight(object4, iteratee2, keys2);
      }
      function baseFunctions(object4, props) {
        return arrayFilter2(props, function(key) {
          return isFunction2(object4[key]);
        });
      }
      function baseGet2(object4, path) {
        path = castPath2(path, object4);
        var index2 = 0, length2 = path.length;
        while (object4 != null && index2 < length2) {
          object4 = object4[toKey2(path[index2++])];
        }
        return index2 && index2 == length2 ? object4 : undefined$1;
      }
      function baseGetAllKeys2(object4, keysFunc, symbolsFunc) {
        var result2 = keysFunc(object4);
        return isArray3(object4) ? result2 : arrayPush2(result2, symbolsFunc(object4));
      }
      function baseGetTag2(value2) {
        if (value2 == null) {
          return value2 === undefined$1 ? undefinedTag2 : nullTag2;
        }
        return symToStringTag2 && symToStringTag2 in Object2(value2) ? getRawTag2(value2) : objectToString2(value2);
      }
      function baseGt(value2, other) {
        return value2 > other;
      }
      function baseHas(object4, key) {
        return object4 != null && hasOwnProperty2.call(object4, key);
      }
      function baseHasIn2(object4, key) {
        return object4 != null && key in Object2(object4);
      }
      function baseInRange(number4, start2, end2) {
        return number4 >= nativeMin2(start2, end2) && number4 < nativeMax2(start2, end2);
      }
      function baseIntersection(arrays, iteratee2, comparator) {
        var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length2 = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = [];
        while (othIndex--) {
          var array4 = arrays[othIndex];
          if (othIndex && iteratee2) {
            array4 = arrayMap2(array4, baseUnary2(iteratee2));
          }
          maxLength = nativeMin2(array4.length, maxLength);
          caches[othIndex] = !comparator && (iteratee2 || length2 >= 120 && array4.length >= 120) ? new SetCache2(othIndex && array4) : undefined$1;
        }
        array4 = arrays[0];
        var index2 = -1, seen2 = caches[0];
        outer:
          while (++index2 < length2 && result2.length < maxLength) {
            var value2 = array4[index2], computed = iteratee2 ? iteratee2(value2) : value2;
            value2 = comparator || value2 !== 0 ? value2 : 0;
            if (!(seen2 ? cacheHas2(seen2, computed) : includes2(result2, computed, comparator))) {
              othIndex = othLength;
              while (--othIndex) {
                var cache2 = caches[othIndex];
                if (!(cache2 ? cacheHas2(cache2, computed) : includes2(arrays[othIndex], computed, comparator))) {
                  continue outer;
                }
              }
              if (seen2) {
                seen2.push(computed);
              }
              result2.push(value2);
            }
          }
        return result2;
      }
      function baseInverter(object4, setter, iteratee2, accumulator) {
        baseForOwn2(object4, function(value2, key, object5) {
          setter(accumulator, iteratee2(value2), key, object5);
        });
        return accumulator;
      }
      function baseInvoke(object4, path, args) {
        path = castPath2(path, object4);
        object4 = parent(object4, path);
        var func = object4 == null ? object4 : object4[toKey2(last(path))];
        return func == null ? undefined$1 : apply2(func, object4, args);
      }
      function baseIsArguments2(value2) {
        return isObjectLike2(value2) && baseGetTag2(value2) == argsTag2;
      }
      function baseIsArrayBuffer(value2) {
        return isObjectLike2(value2) && baseGetTag2(value2) == arrayBufferTag2;
      }
      function baseIsDate(value2) {
        return isObjectLike2(value2) && baseGetTag2(value2) == dateTag2;
      }
      function baseIsEqual2(value2, other, bitmask, customizer, stack) {
        if (value2 === other) {
          return true;
        }
        if (value2 == null || other == null || !isObjectLike2(value2) && !isObjectLike2(other)) {
          return value2 !== value2 && other !== other;
        }
        return baseIsEqualDeep2(value2, other, bitmask, customizer, baseIsEqual2, stack);
      }
      function baseIsEqualDeep2(object4, other, bitmask, customizer, equalFunc, stack) {
        var objIsArr = isArray3(object4), othIsArr = isArray3(other), objTag = objIsArr ? arrayTag2 : getTag2(object4), othTag = othIsArr ? arrayTag2 : getTag2(other);
        objTag = objTag == argsTag2 ? objectTag2 : objTag;
        othTag = othTag == argsTag2 ? objectTag2 : othTag;
        var objIsObj = objTag == objectTag2, othIsObj = othTag == objectTag2, isSameTag = objTag == othTag;
        if (isSameTag && isBuffer2(object4)) {
          if (!isBuffer2(other)) {
            return false;
          }
          objIsArr = true;
          objIsObj = false;
        }
        if (isSameTag && !objIsObj) {
          stack || (stack = new Stack2());
          return objIsArr || isTypedArray2(object4) ? equalArrays2(object4, other, bitmask, customizer, equalFunc, stack) : equalByTag2(object4, other, objTag, bitmask, customizer, equalFunc, stack);
        }
        if (!(bitmask & COMPARE_PARTIAL_FLAG2)) {
          var objIsWrapped = objIsObj && hasOwnProperty2.call(object4, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty2.call(other, "__wrapped__");
          if (objIsWrapped || othIsWrapped) {
            var objUnwrapped = objIsWrapped ? object4.value() : object4, othUnwrapped = othIsWrapped ? other.value() : other;
            stack || (stack = new Stack2());
            return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
          }
        }
        if (!isSameTag) {
          return false;
        }
        stack || (stack = new Stack2());
        return equalObjects2(object4, other, bitmask, customizer, equalFunc, stack);
      }
      function baseIsMap2(value2) {
        return isObjectLike2(value2) && getTag2(value2) == mapTag2;
      }
      function baseIsMatch2(object4, source2, matchData, customizer) {
        var index2 = matchData.length, length2 = index2, noCustomizer = !customizer;
        if (object4 == null) {
          return !length2;
        }
        object4 = Object2(object4);
        while (index2--) {
          var data = matchData[index2];
          if (noCustomizer && data[2] ? data[1] !== object4[data[0]] : !(data[0] in object4)) {
            return false;
          }
        }
        while (++index2 < length2) {
          data = matchData[index2];
          var key = data[0], objValue = object4[key], srcValue = data[1];
          if (noCustomizer && data[2]) {
            if (objValue === undefined$1 && !(key in object4)) {
              return false;
            }
          } else {
            var stack = new Stack2();
            if (customizer) {
              var result2 = customizer(objValue, srcValue, key, object4, source2, stack);
            }
            if (!(result2 === undefined$1 ? baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG2 | COMPARE_UNORDERED_FLAG2, customizer, stack) : result2)) {
              return false;
            }
          }
        }
        return true;
      }
      function baseIsNative2(value2) {
        if (!isObject2(value2) || isMasked2(value2)) {
          return false;
        }
        var pattern4 = isFunction2(value2) ? reIsNative2 : reIsHostCtor2;
        return pattern4.test(toSource2(value2));
      }
      function baseIsRegExp(value2) {
        return isObjectLike2(value2) && baseGetTag2(value2) == regexpTag2;
      }
      function baseIsSet2(value2) {
        return isObjectLike2(value2) && getTag2(value2) == setTag2;
      }
      function baseIsTypedArray2(value2) {
        return isObjectLike2(value2) && isLength2(value2.length) && !!typedArrayTags2[baseGetTag2(value2)];
      }
      function baseIteratee2(value2) {
        if (typeof value2 == "function") {
          return value2;
        }
        if (value2 == null) {
          return identity2;
        }
        if (typeof value2 == "object") {
          return isArray3(value2) ? baseMatchesProperty2(value2[0], value2[1]) : baseMatches2(value2);
        }
        return property2(value2);
      }
      function baseKeys2(object4) {
        if (!isPrototype2(object4)) {
          return nativeKeys2(object4);
        }
        var result2 = [];
        for (var key in Object2(object4)) {
          if (hasOwnProperty2.call(object4, key) && key != "constructor") {
            result2.push(key);
          }
        }
        return result2;
      }
      function baseKeysIn2(object4) {
        if (!isObject2(object4)) {
          return nativeKeysIn2(object4);
        }
        var isProto = isPrototype2(object4), result2 = [];
        for (var key in object4) {
          if (!(key == "constructor" && (isProto || !hasOwnProperty2.call(object4, key)))) {
            result2.push(key);
          }
        }
        return result2;
      }
      function baseLt(value2, other) {
        return value2 < other;
      }
      function baseMap2(collection, iteratee2) {
        var index2 = -1, result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
        baseEach2(collection, function(value2, key, collection2) {
          result2[++index2] = iteratee2(value2, key, collection2);
        });
        return result2;
      }
      function baseMatches2(source2) {
        var matchData = getMatchData2(source2);
        if (matchData.length == 1 && matchData[0][2]) {
          return matchesStrictComparable2(matchData[0][0], matchData[0][1]);
        }
        return function(object4) {
          return object4 === source2 || baseIsMatch2(object4, source2, matchData);
        };
      }
      function baseMatchesProperty2(path, srcValue) {
        if (isKey2(path) && isStrictComparable2(srcValue)) {
          return matchesStrictComparable2(toKey2(path), srcValue);
        }
        return function(object4) {
          var objValue = get5(object4, path);
          return objValue === undefined$1 && objValue === srcValue ? hasIn2(object4, path) : baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG2 | COMPARE_UNORDERED_FLAG2);
        };
      }
      function baseMerge2(object4, source2, srcIndex, customizer, stack) {
        if (object4 === source2) {
          return;
        }
        baseFor2(source2, function(srcValue, key) {
          stack || (stack = new Stack2());
          if (isObject2(srcValue)) {
            baseMergeDeep2(object4, source2, key, srcIndex, baseMerge2, customizer, stack);
          } else {
            var newValue = customizer ? customizer(safeGet2(object4, key), srcValue, key + "", object4, source2, stack) : undefined$1;
            if (newValue === undefined$1) {
              newValue = srcValue;
            }
            assignMergeValue2(object4, key, newValue);
          }
        }, keysIn2);
      }
      function baseMergeDeep2(object4, source2, key, srcIndex, mergeFunc, customizer, stack) {
        var objValue = safeGet2(object4, key), srcValue = safeGet2(source2, key), stacked = stack.get(srcValue);
        if (stacked) {
          assignMergeValue2(object4, key, stacked);
          return;
        }
        var newValue = customizer ? customizer(objValue, srcValue, key + "", object4, source2, stack) : undefined$1;
        var isCommon = newValue === undefined$1;
        if (isCommon) {
          var isArr = isArray3(srcValue), isBuff = !isArr && isBuffer2(srcValue), isTyped = !isArr && !isBuff && isTypedArray2(srcValue);
          newValue = srcValue;
          if (isArr || isBuff || isTyped) {
            if (isArray3(objValue)) {
              newValue = objValue;
            } else if (isArrayLikeObject2(objValue)) {
              newValue = copyArray2(objValue);
            } else if (isBuff) {
              isCommon = false;
              newValue = cloneBuffer2(srcValue, true);
            } else if (isTyped) {
              isCommon = false;
              newValue = cloneTypedArray2(srcValue, true);
            } else {
              newValue = [];
            }
          } else if (isPlainObject3(srcValue) || isArguments2(srcValue)) {
            newValue = objValue;
            if (isArguments2(objValue)) {
              newValue = toPlainObject2(objValue);
            } else if (!isObject2(objValue) || isFunction2(objValue)) {
              newValue = initCloneObject2(srcValue);
            }
          } else {
            isCommon = false;
          }
        }
        if (isCommon) {
          stack.set(srcValue, newValue);
          mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
          stack["delete"](srcValue);
        }
        assignMergeValue2(object4, key, newValue);
      }
      function baseNth(array4, n2) {
        var length2 = array4.length;
        if (!length2) {
          return;
        }
        n2 += n2 < 0 ? length2 : 0;
        return isIndex2(n2, length2) ? array4[n2] : undefined$1;
      }
      function baseOrderBy(collection, iteratees, orders2) {
        if (iteratees.length) {
          iteratees = arrayMap2(iteratees, function(iteratee2) {
            if (isArray3(iteratee2)) {
              return function(value2) {
                return baseGet2(value2, iteratee2.length === 1 ? iteratee2[0] : iteratee2);
              };
            }
            return iteratee2;
          });
        } else {
          iteratees = [identity2];
        }
        var index2 = -1;
        iteratees = arrayMap2(iteratees, baseUnary2(getIteratee()));
        var result2 = baseMap2(collection, function(value2, key, collection2) {
          var criteria = arrayMap2(iteratees, function(iteratee2) {
            return iteratee2(value2);
          });
          return { "criteria": criteria, "index": ++index2, "value": value2 };
        });
        return baseSortBy(result2, function(object4, other) {
          return compareMultiple(object4, other, orders2);
        });
      }
      function basePick(object4, paths) {
        return basePickBy(object4, paths, function(value2, path) {
          return hasIn2(object4, path);
        });
      }
      function basePickBy(object4, paths, predicate) {
        var index2 = -1, length2 = paths.length, result2 = {};
        while (++index2 < length2) {
          var path = paths[index2], value2 = baseGet2(object4, path);
          if (predicate(value2, path)) {
            baseSet(result2, castPath2(path, object4), value2);
          }
        }
        return result2;
      }
      function basePropertyDeep2(path) {
        return function(object4) {
          return baseGet2(object4, path);
        };
      }
      function basePullAll(array4, values2, iteratee2, comparator) {
        var indexOf3 = comparator ? baseIndexOfWith : baseIndexOf, index2 = -1, length2 = values2.length, seen2 = array4;
        if (array4 === values2) {
          values2 = copyArray2(values2);
        }
        if (iteratee2) {
          seen2 = arrayMap2(array4, baseUnary2(iteratee2));
        }
        while (++index2 < length2) {
          var fromIndex = 0, value2 = values2[index2], computed = iteratee2 ? iteratee2(value2) : value2;
          while ((fromIndex = indexOf3(seen2, computed, fromIndex, comparator)) > -1) {
            if (seen2 !== array4) {
              splice2.call(seen2, fromIndex, 1);
            }
            splice2.call(array4, fromIndex, 1);
          }
        }
        return array4;
      }
      function basePullAt(array4, indexes) {
        var length2 = array4 ? indexes.length : 0, lastIndex = length2 - 1;
        while (length2--) {
          var index2 = indexes[length2];
          if (length2 == lastIndex || index2 !== previous2) {
            var previous2 = index2;
            if (isIndex2(index2)) {
              splice2.call(array4, index2, 1);
            } else {
              baseUnset(array4, index2);
            }
          }
        }
        return array4;
      }
      function baseRandom(lower, upper) {
        return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
      }
      function baseRange(start2, end2, step, fromRight) {
        var index2 = -1, length2 = nativeMax2(nativeCeil((end2 - start2) / (step || 1)), 0), result2 = Array2(length2);
        while (length2--) {
          result2[fromRight ? length2 : ++index2] = start2;
          start2 += step;
        }
        return result2;
      }
      function baseRepeat(string3, n2) {
        var result2 = "";
        if (!string3 || n2 < 1 || n2 > MAX_SAFE_INTEGER2) {
          return result2;
        }
        do {
          if (n2 % 2) {
            result2 += string3;
          }
          n2 = nativeFloor(n2 / 2);
          if (n2) {
            string3 += string3;
          }
        } while (n2);
        return result2;
      }
      function baseRest2(func, start2) {
        return setToString2(overRest2(func, start2, identity2), func + "");
      }
      function baseSample(collection) {
        return arraySample(values(collection));
      }
      function baseSampleSize(collection, n2) {
        var array4 = values(collection);
        return shuffleSelf(array4, baseClamp(n2, 0, array4.length));
      }
      function baseSet(object4, path, value2, customizer) {
        if (!isObject2(object4)) {
          return object4;
        }
        path = castPath2(path, object4);
        var index2 = -1, length2 = path.length, lastIndex = length2 - 1, nested = object4;
        while (nested != null && ++index2 < length2) {
          var key = toKey2(path[index2]), newValue = value2;
          if (key === "__proto__" || key === "constructor" || key === "prototype") {
            return object4;
          }
          if (index2 != lastIndex) {
            var objValue = nested[key];
            newValue = customizer ? customizer(objValue, key, nested) : undefined$1;
            if (newValue === undefined$1) {
              newValue = isObject2(objValue) ? objValue : isIndex2(path[index2 + 1]) ? [] : {};
            }
          }
          assignValue2(nested, key, newValue);
          nested = nested[key];
        }
        return object4;
      }
      var baseSetData = !metaMap ? identity2 : function(func, data) {
        metaMap.set(func, data);
        return func;
      };
      var baseSetToString2 = !defineProperty2 ? identity2 : function(func, string3) {
        return defineProperty2(func, "toString", {
          "configurable": true,
          "enumerable": false,
          "value": constant2(string3),
          "writable": true
        });
      };
      function baseShuffle(collection) {
        return shuffleSelf(values(collection));
      }
      function baseSlice(array4, start2, end2) {
        var index2 = -1, length2 = array4.length;
        if (start2 < 0) {
          start2 = -start2 > length2 ? 0 : length2 + start2;
        }
        end2 = end2 > length2 ? length2 : end2;
        if (end2 < 0) {
          end2 += length2;
        }
        length2 = start2 > end2 ? 0 : end2 - start2 >>> 0;
        start2 >>>= 0;
        var result2 = Array2(length2);
        while (++index2 < length2) {
          result2[index2] = array4[index2 + start2];
        }
        return result2;
      }
      function baseSome(collection, predicate) {
        var result2;
        baseEach2(collection, function(value2, index2, collection2) {
          result2 = predicate(value2, index2, collection2);
          return !result2;
        });
        return !!result2;
      }
      function baseSortedIndex(array4, value2, retHighest) {
        var low = 0, high = array4 == null ? low : array4.length;
        if (typeof value2 == "number" && value2 === value2 && high <= HALF_MAX_ARRAY_LENGTH) {
          while (low < high) {
            var mid = low + high >>> 1, computed = array4[mid];
            if (computed !== null && !isSymbol2(computed) && (retHighest ? computed <= value2 : computed < value2)) {
              low = mid + 1;
            } else {
              high = mid;
            }
          }
          return high;
        }
        return baseSortedIndexBy(array4, value2, identity2, retHighest);
      }
      function baseSortedIndexBy(array4, value2, iteratee2, retHighest) {
        var low = 0, high = array4 == null ? 0 : array4.length;
        if (high === 0) {
          return 0;
        }
        value2 = iteratee2(value2);
        var valIsNaN = value2 !== value2, valIsNull = value2 === null, valIsSymbol = isSymbol2(value2), valIsUndefined = value2 === undefined$1;
        while (low < high) {
          var mid = nativeFloor((low + high) / 2), computed = iteratee2(array4[mid]), othIsDefined = computed !== undefined$1, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol2(computed);
          if (valIsNaN) {
            var setLow = retHighest || othIsReflexive;
          } else if (valIsUndefined) {
            setLow = othIsReflexive && (retHighest || othIsDefined);
          } else if (valIsNull) {
            setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
          } else if (valIsSymbol) {
            setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
          } else if (othIsNull || othIsSymbol) {
            setLow = false;
          } else {
            setLow = retHighest ? computed <= value2 : computed < value2;
          }
          if (setLow) {
            low = mid + 1;
          } else {
            high = mid;
          }
        }
        return nativeMin2(high, MAX_ARRAY_INDEX);
      }
      function baseSortedUniq(array4, iteratee2) {
        var index2 = -1, length2 = array4.length, resIndex = 0, result2 = [];
        while (++index2 < length2) {
          var value2 = array4[index2], computed = iteratee2 ? iteratee2(value2) : value2;
          if (!index2 || !eq2(computed, seen2)) {
            var seen2 = computed;
            result2[resIndex++] = value2 === 0 ? 0 : value2;
          }
        }
        return result2;
      }
      function baseToNumber(value2) {
        if (typeof value2 == "number") {
          return value2;
        }
        if (isSymbol2(value2)) {
          return NAN2;
        }
        return +value2;
      }
      function baseToString2(value2) {
        if (typeof value2 == "string") {
          return value2;
        }
        if (isArray3(value2)) {
          return arrayMap2(value2, baseToString2) + "";
        }
        if (isSymbol2(value2)) {
          return symbolToString2 ? symbolToString2.call(value2) : "";
        }
        var result2 = value2 + "";
        return result2 == "0" && 1 / value2 == -INFINITY2 ? "-0" : result2;
      }
      function baseUniq(array4, iteratee2, comparator) {
        var index2 = -1, includes2 = arrayIncludes, length2 = array4.length, isCommon = true, result2 = [], seen2 = result2;
        if (comparator) {
          isCommon = false;
          includes2 = arrayIncludesWith;
        } else if (length2 >= LARGE_ARRAY_SIZE2) {
          var set3 = iteratee2 ? null : createSet(array4);
          if (set3) {
            return setToArray2(set3);
          }
          isCommon = false;
          includes2 = cacheHas2;
          seen2 = new SetCache2();
        } else {
          seen2 = iteratee2 ? [] : result2;
        }
        outer:
          while (++index2 < length2) {
            var value2 = array4[index2], computed = iteratee2 ? iteratee2(value2) : value2;
            value2 = comparator || value2 !== 0 ? value2 : 0;
            if (isCommon && computed === computed) {
              var seenIndex = seen2.length;
              while (seenIndex--) {
                if (seen2[seenIndex] === computed) {
                  continue outer;
                }
              }
              if (iteratee2) {
                seen2.push(computed);
              }
              result2.push(value2);
            } else if (!includes2(seen2, computed, comparator)) {
              if (seen2 !== result2) {
                seen2.push(computed);
              }
              result2.push(value2);
            }
          }
        return result2;
      }
      function baseUnset(object4, path) {
        path = castPath2(path, object4);
        object4 = parent(object4, path);
        return object4 == null || delete object4[toKey2(last(path))];
      }
      function baseUpdate(object4, path, updater, customizer) {
        return baseSet(object4, path, updater(baseGet2(object4, path)), customizer);
      }
      function baseWhile(array4, predicate, isDrop, fromRight) {
        var length2 = array4.length, index2 = fromRight ? length2 : -1;
        while ((fromRight ? index2-- : ++index2 < length2) && predicate(array4[index2], index2, array4)) {
        }
        return isDrop ? baseSlice(array4, fromRight ? 0 : index2, fromRight ? index2 + 1 : length2) : baseSlice(array4, fromRight ? index2 + 1 : 0, fromRight ? length2 : index2);
      }
      function baseWrapperValue(value2, actions) {
        var result2 = value2;
        if (result2 instanceof LazyWrapper) {
          result2 = result2.value();
        }
        return arrayReduce(actions, function(result3, action) {
          return action.func.apply(action.thisArg, arrayPush2([result3], action.args));
        }, result2);
      }
      function baseXor(arrays, iteratee2, comparator) {
        var length2 = arrays.length;
        if (length2 < 2) {
          return length2 ? baseUniq(arrays[0]) : [];
        }
        var index2 = -1, result2 = Array2(length2);
        while (++index2 < length2) {
          var array4 = arrays[index2], othIndex = -1;
          while (++othIndex < length2) {
            if (othIndex != index2) {
              result2[index2] = baseDifference(result2[index2] || array4, arrays[othIndex], iteratee2, comparator);
            }
          }
        }
        return baseUniq(baseFlatten(result2, 1), iteratee2, comparator);
      }
      function baseZipObject(props, values2, assignFunc) {
        var index2 = -1, length2 = props.length, valsLength = values2.length, result2 = {};
        while (++index2 < length2) {
          var value2 = index2 < valsLength ? values2[index2] : undefined$1;
          assignFunc(result2, props[index2], value2);
        }
        return result2;
      }
      function castArrayLikeObject(value2) {
        return isArrayLikeObject2(value2) ? value2 : [];
      }
      function castFunction2(value2) {
        return typeof value2 == "function" ? value2 : identity2;
      }
      function castPath2(value2, object4) {
        if (isArray3(value2)) {
          return value2;
        }
        return isKey2(value2, object4) ? [value2] : stringToPath2(toString4(value2));
      }
      var castRest = baseRest2;
      function castSlice(array4, start2, end2) {
        var length2 = array4.length;
        end2 = end2 === undefined$1 ? length2 : end2;
        return !start2 && end2 >= length2 ? array4 : baseSlice(array4, start2, end2);
      }
      var clearTimeout2 = ctxClearTimeout || function(id2) {
        return root2.clearTimeout(id2);
      };
      function cloneBuffer2(buffer, isDeep) {
        if (isDeep) {
          return buffer.slice();
        }
        var length2 = buffer.length, result2 = allocUnsafe ? allocUnsafe(length2) : new buffer.constructor(length2);
        buffer.copy(result2);
        return result2;
      }
      function cloneArrayBuffer2(arrayBuffer) {
        var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
        new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer));
        return result2;
      }
      function cloneDataView2(dataView, isDeep) {
        var buffer = isDeep ? cloneArrayBuffer2(dataView.buffer) : dataView.buffer;
        return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
      }
      function cloneRegExp2(regexp4) {
        var result2 = new regexp4.constructor(regexp4.source, reFlags2.exec(regexp4));
        result2.lastIndex = regexp4.lastIndex;
        return result2;
      }
      function cloneSymbol2(symbol) {
        return symbolValueOf2 ? Object2(symbolValueOf2.call(symbol)) : {};
      }
      function cloneTypedArray2(typedArray, isDeep) {
        var buffer = isDeep ? cloneArrayBuffer2(typedArray.buffer) : typedArray.buffer;
        return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
      }
      function compareAscending(value2, other) {
        if (value2 !== other) {
          var valIsDefined = value2 !== undefined$1, valIsNull = value2 === null, valIsReflexive = value2 === value2, valIsSymbol = isSymbol2(value2);
          var othIsDefined = other !== undefined$1, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol2(other);
          if (!othIsNull && !othIsSymbol && !valIsSymbol && value2 > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
            return 1;
          }
          if (!valIsNull && !valIsSymbol && !othIsSymbol && value2 < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
            return -1;
          }
        }
        return 0;
      }
      function compareMultiple(object4, other, orders2) {
        var index2 = -1, objCriteria = object4.criteria, othCriteria = other.criteria, length2 = objCriteria.length, ordersLength = orders2.length;
        while (++index2 < length2) {
          var result2 = compareAscending(objCriteria[index2], othCriteria[index2]);
          if (result2) {
            if (index2 >= ordersLength) {
              return result2;
            }
            var order2 = orders2[index2];
            return result2 * (order2 == "desc" ? -1 : 1);
          }
        }
        return object4.index - other.index;
      }
      function composeArgs(args, partials, holders, isCurried) {
        var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax2(argsLength - holdersLength, 0), result2 = Array2(leftLength + rangeLength), isUncurried = !isCurried;
        while (++leftIndex < leftLength) {
          result2[leftIndex] = partials[leftIndex];
        }
        while (++argsIndex < holdersLength) {
          if (isUncurried || argsIndex < argsLength) {
            result2[holders[argsIndex]] = args[argsIndex];
          }
        }
        while (rangeLength--) {
          result2[leftIndex++] = args[argsIndex++];
        }
        return result2;
      }
      function composeArgsRight(args, partials, holders, isCurried) {
        var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax2(argsLength - holdersLength, 0), result2 = Array2(rangeLength + rightLength), isUncurried = !isCurried;
        while (++argsIndex < rangeLength) {
          result2[argsIndex] = args[argsIndex];
        }
        var offset2 = argsIndex;
        while (++rightIndex < rightLength) {
          result2[offset2 + rightIndex] = partials[rightIndex];
        }
        while (++holdersIndex < holdersLength) {
          if (isUncurried || argsIndex < argsLength) {
            result2[offset2 + holders[holdersIndex]] = args[argsIndex++];
          }
        }
        return result2;
      }
      function copyArray2(source2, array4) {
        var index2 = -1, length2 = source2.length;
        array4 || (array4 = Array2(length2));
        while (++index2 < length2) {
          array4[index2] = source2[index2];
        }
        return array4;
      }
      function copyObject2(source2, props, object4, customizer) {
        var isNew = !object4;
        object4 || (object4 = {});
        var index2 = -1, length2 = props.length;
        while (++index2 < length2) {
          var key = props[index2];
          var newValue = customizer ? customizer(object4[key], source2[key], key, object4, source2) : undefined$1;
          if (newValue === undefined$1) {
            newValue = source2[key];
          }
          if (isNew) {
            baseAssignValue2(object4, key, newValue);
          } else {
            assignValue2(object4, key, newValue);
          }
        }
        return object4;
      }
      function copySymbols2(source2, object4) {
        return copyObject2(source2, getSymbols2(source2), object4);
      }
      function copySymbolsIn2(source2, object4) {
        return copyObject2(source2, getSymbolsIn2(source2), object4);
      }
      function createAggregator(setter, initializer) {
        return function(collection, iteratee2) {
          var func = isArray3(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
          return func(collection, setter, getIteratee(iteratee2, 2), accumulator);
        };
      }
      function createAssigner2(assigner) {
        return baseRest2(function(object4, sources) {
          var index2 = -1, length2 = sources.length, customizer = length2 > 1 ? sources[length2 - 1] : undefined$1, guard = length2 > 2 ? sources[2] : undefined$1;
          customizer = assigner.length > 3 && typeof customizer == "function" ? (length2--, customizer) : undefined$1;
          if (guard && isIterateeCall2(sources[0], sources[1], guard)) {
            customizer = length2 < 3 ? undefined$1 : customizer;
            length2 = 1;
          }
          object4 = Object2(object4);
          while (++index2 < length2) {
            var source2 = sources[index2];
            if (source2) {
              assigner(object4, source2, index2, customizer);
            }
          }
          return object4;
        });
      }
      function createBaseEach2(eachFunc, fromRight) {
        return function(collection, iteratee2) {
          if (collection == null) {
            return collection;
          }
          if (!isArrayLike2(collection)) {
            return eachFunc(collection, iteratee2);
          }
          var length2 = collection.length, index2 = fromRight ? length2 : -1, iterable = Object2(collection);
          while (fromRight ? index2-- : ++index2 < length2) {
            if (iteratee2(iterable[index2], index2, iterable) === false) {
              break;
            }
          }
          return collection;
        };
      }
      function createBaseFor2(fromRight) {
        return function(object4, iteratee2, keysFunc) {
          var index2 = -1, iterable = Object2(object4), props = keysFunc(object4), length2 = props.length;
          while (length2--) {
            var key = props[fromRight ? length2 : ++index2];
            if (iteratee2(iterable[key], key, iterable) === false) {
              break;
            }
          }
          return object4;
        };
      }
      function createBind(func, bitmask, thisArg) {
        var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
        function wrapper() {
          var fn = this && this !== root2 && this instanceof wrapper ? Ctor : func;
          return fn.apply(isBind ? thisArg : this, arguments);
        }
        return wrapper;
      }
      function createCaseFirst(methodName) {
        return function(string3) {
          string3 = toString4(string3);
          var strSymbols = hasUnicode(string3) ? stringToArray3(string3) : undefined$1;
          var chr = strSymbols ? strSymbols[0] : string3.charAt(0);
          var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string3.slice(1);
          return chr[methodName]() + trailing;
        };
      }
      function createCompounder(callback2) {
        return function(string3) {
          return arrayReduce(words(deburr(string3).replace(reApos, "")), callback2, "");
        };
      }
      function createCtor(Ctor) {
        return function() {
          var args = arguments;
          switch (args.length) {
            case 0:
              return new Ctor();
            case 1:
              return new Ctor(args[0]);
            case 2:
              return new Ctor(args[0], args[1]);
            case 3:
              return new Ctor(args[0], args[1], args[2]);
            case 4:
              return new Ctor(args[0], args[1], args[2], args[3]);
            case 5:
              return new Ctor(args[0], args[1], args[2], args[3], args[4]);
            case 6:
              return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
            case 7:
              return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
          }
          var thisBinding = baseCreate2(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
          return isObject2(result2) ? result2 : thisBinding;
        };
      }
      function createCurry(func, bitmask, arity) {
        var Ctor = createCtor(func);
        function wrapper() {
          var length2 = arguments.length, args = Array2(length2), index2 = length2, placeholder = getHolder(wrapper);
          while (index2--) {
            args[index2] = arguments[index2];
          }
          var holders = length2 < 3 && args[0] !== placeholder && args[length2 - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
          length2 -= holders.length;
          if (length2 < arity) {
            return createRecurry(
              func,
              bitmask,
              createHybrid,
              wrapper.placeholder,
              undefined$1,
              args,
              holders,
              undefined$1,
              undefined$1,
              arity - length2
            );
          }
          var fn = this && this !== root2 && this instanceof wrapper ? Ctor : func;
          return apply2(fn, this, args);
        }
        return wrapper;
      }
      function createFind(findIndexFunc) {
        return function(collection, predicate, fromIndex) {
          var iterable = Object2(collection);
          if (!isArrayLike2(collection)) {
            var iteratee2 = getIteratee(predicate, 3);
            collection = keys2(collection);
            predicate = function(key) {
              return iteratee2(iterable[key], key, iterable);
            };
          }
          var index2 = findIndexFunc(collection, predicate, fromIndex);
          return index2 > -1 ? iterable[iteratee2 ? collection[index2] : index2] : undefined$1;
        };
      }
      function createFlow(fromRight) {
        return flatRest(function(funcs) {
          var length2 = funcs.length, index2 = length2, prereq = LodashWrapper.prototype.thru;
          if (fromRight) {
            funcs.reverse();
          }
          while (index2--) {
            var func = funcs[index2];
            if (typeof func != "function") {
              throw new TypeError2(FUNC_ERROR_TEXT2);
            }
            if (prereq && !wrapper && getFuncName(func) == "wrapper") {
              var wrapper = new LodashWrapper([], true);
            }
          }
          index2 = wrapper ? index2 : length2;
          while (++index2 < length2) {
            func = funcs[index2];
            var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined$1;
            if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1) {
              wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
            } else {
              wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
            }
          }
          return function() {
            var args = arguments, value2 = args[0];
            if (wrapper && args.length == 1 && isArray3(value2)) {
              return wrapper.plant(value2).value();
            }
            var index3 = 0, result2 = length2 ? funcs[index3].apply(this, args) : value2;
            while (++index3 < length2) {
              result2 = funcs[index3].call(this, result2);
            }
            return result2;
          };
        });
      }
      function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
        var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined$1 : createCtor(func);
        function wrapper() {
          var length2 = arguments.length, args = Array2(length2), index2 = length2;
          while (index2--) {
            args[index2] = arguments[index2];
          }
          if (isCurried) {
            var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
          }
          if (partials) {
            args = composeArgs(args, partials, holders, isCurried);
          }
          if (partialsRight) {
            args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
          }
          length2 -= holdersCount;
          if (isCurried && length2 < arity) {
            var newHolders = replaceHolders(args, placeholder);
            return createRecurry(
              func,
              bitmask,
              createHybrid,
              wrapper.placeholder,
              thisArg,
              args,
              newHolders,
              argPos,
              ary2,
              arity - length2
            );
          }
          var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
          length2 = args.length;
          if (argPos) {
            args = reorder(args, argPos);
          } else if (isFlip && length2 > 1) {
            args.reverse();
          }
          if (isAry && ary2 < length2) {
            args.length = ary2;
          }
          if (this && this !== root2 && this instanceof wrapper) {
            fn = Ctor || createCtor(fn);
          }
          return fn.apply(thisBinding, args);
        }
        return wrapper;
      }
      function createInverter(setter, toIteratee) {
        return function(object4, iteratee2) {
          return baseInverter(object4, setter, toIteratee(iteratee2), {});
        };
      }
      function createMathOperation(operator, defaultValue2) {
        return function(value2, other) {
          var result2;
          if (value2 === undefined$1 && other === undefined$1) {
            return defaultValue2;
          }
          if (value2 !== undefined$1) {
            result2 = value2;
          }
          if (other !== undefined$1) {
            if (result2 === undefined$1) {
              return other;
            }
            if (typeof value2 == "string" || typeof other == "string") {
              value2 = baseToString2(value2);
              other = baseToString2(other);
            } else {
              value2 = baseToNumber(value2);
              other = baseToNumber(other);
            }
            result2 = operator(value2, other);
          }
          return result2;
        };
      }
      function createOver(arrayFunc) {
        return flatRest(function(iteratees) {
          iteratees = arrayMap2(iteratees, baseUnary2(getIteratee()));
          return baseRest2(function(args) {
            var thisArg = this;
            return arrayFunc(iteratees, function(iteratee2) {
              return apply2(iteratee2, thisArg, args);
            });
          });
        });
      }
      function createPadding(length2, chars2) {
        chars2 = chars2 === undefined$1 ? " " : baseToString2(chars2);
        var charsLength = chars2.length;
        if (charsLength < 2) {
          return charsLength ? baseRepeat(chars2, length2) : chars2;
        }
        var result2 = baseRepeat(chars2, nativeCeil(length2 / stringSize(chars2)));
        return hasUnicode(chars2) ? castSlice(stringToArray3(result2), 0, length2).join("") : result2.slice(0, length2);
      }
      function createPartial(func, bitmask, thisArg, partials) {
        var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
        function wrapper() {
          var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root2 && this instanceof wrapper ? Ctor : func;
          while (++leftIndex < leftLength) {
            args[leftIndex] = partials[leftIndex];
          }
          while (argsLength--) {
            args[leftIndex++] = arguments[++argsIndex];
          }
          return apply2(fn, isBind ? thisArg : this, args);
        }
        return wrapper;
      }
      function createRange(fromRight) {
        return function(start2, end2, step) {
          if (step && typeof step != "number" && isIterateeCall2(start2, end2, step)) {
            end2 = step = undefined$1;
          }
          start2 = toFinite(start2);
          if (end2 === undefined$1) {
            end2 = start2;
            start2 = 0;
          } else {
            end2 = toFinite(end2);
          }
          step = step === undefined$1 ? start2 < end2 ? 1 : -1 : toFinite(step);
          return baseRange(start2, end2, step, fromRight);
        };
      }
      function createRelationalOperation(operator) {
        return function(value2, other) {
          if (!(typeof value2 == "string" && typeof other == "string")) {
            value2 = toNumber2(value2);
            other = toNumber2(other);
          }
          return operator(value2, other);
        };
      }
      function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) {
        var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined$1, newHoldersRight = isCurry ? undefined$1 : holders, newPartials = isCurry ? partials : undefined$1, newPartialsRight = isCurry ? undefined$1 : partials;
        bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG;
        bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
        if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
          bitmask &= -4;
        }
        var newData = [
          func,
          bitmask,
          thisArg,
          newPartials,
          newHolders,
          newPartialsRight,
          newHoldersRight,
          argPos,
          ary2,
          arity
        ];
        var result2 = wrapFunc.apply(undefined$1, newData);
        if (isLaziable(func)) {
          setData(result2, newData);
        }
        result2.placeholder = placeholder;
        return setWrapToString(result2, func, bitmask);
      }
      function createRound(methodName) {
        var func = Math2[methodName];
        return function(number4, precision) {
          number4 = toNumber2(number4);
          precision = precision == null ? 0 : nativeMin2(toInteger(precision), 292);
          if (precision && nativeIsFinite(number4)) {
            var pair = (toString4(number4) + "e").split("e"), value2 = func(pair[0] + "e" + (+pair[1] + precision));
            pair = (toString4(value2) + "e").split("e");
            return +(pair[0] + "e" + (+pair[1] - precision));
          }
          return func(number4);
        };
      }
      var createSet = !(Set2 && 1 / setToArray2(new Set2([, -0]))[1] == INFINITY2) ? noop4 : function(values2) {
        return new Set2(values2);
      };
      function createToPairs(keysFunc) {
        return function(object4) {
          var tag = getTag2(object4);
          if (tag == mapTag2) {
            return mapToArray2(object4);
          }
          if (tag == setTag2) {
            return setToPairs(object4);
          }
          return baseToPairs(object4, keysFunc(object4));
        };
      }
      function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
        var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
        if (!isBindKey && typeof func != "function") {
          throw new TypeError2(FUNC_ERROR_TEXT2);
        }
        var length2 = partials ? partials.length : 0;
        if (!length2) {
          bitmask &= -97;
          partials = holders = undefined$1;
        }
        ary2 = ary2 === undefined$1 ? ary2 : nativeMax2(toInteger(ary2), 0);
        arity = arity === undefined$1 ? arity : toInteger(arity);
        length2 -= holders ? holders.length : 0;
        if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
          var partialsRight = partials, holdersRight = holders;
          partials = holders = undefined$1;
        }
        var data = isBindKey ? undefined$1 : getData(func);
        var newData = [
          func,
          bitmask,
          thisArg,
          partials,
          holders,
          partialsRight,
          holdersRight,
          argPos,
          ary2,
          arity
        ];
        if (data) {
          mergeData(newData, data);
        }
        func = newData[0];
        bitmask = newData[1];
        thisArg = newData[2];
        partials = newData[3];
        holders = newData[4];
        arity = newData[9] = newData[9] === undefined$1 ? isBindKey ? 0 : func.length : nativeMax2(newData[9] - length2, 0);
        if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
          bitmask &= -25;
        }
        if (!bitmask || bitmask == WRAP_BIND_FLAG) {
          var result2 = createBind(func, bitmask, thisArg);
        } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
          result2 = createCurry(func, bitmask, arity);
        } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
          result2 = createPartial(func, bitmask, thisArg, partials);
        } else {
          result2 = createHybrid.apply(undefined$1, newData);
        }
        var setter = data ? baseSetData : setData;
        return setWrapToString(setter(result2, newData), func, bitmask);
      }
      function customDefaultsAssignIn(objValue, srcValue, key, object4) {
        if (objValue === undefined$1 || eq2(objValue, objectProto2[key]) && !hasOwnProperty2.call(object4, key)) {
          return srcValue;
        }
        return objValue;
      }
      function customDefaultsMerge(objValue, srcValue, key, object4, source2, stack) {
        if (isObject2(objValue) && isObject2(srcValue)) {
          stack.set(srcValue, objValue);
          baseMerge2(objValue, srcValue, undefined$1, customDefaultsMerge, stack);
          stack["delete"](srcValue);
        }
        return objValue;
      }
      function customOmitClone(value2) {
        return isPlainObject3(value2) ? undefined$1 : value2;
      }
      function equalArrays2(array4, other, bitmask, customizer, equalFunc, stack) {
        var isPartial = bitmask & COMPARE_PARTIAL_FLAG2, arrLength = array4.length, othLength = other.length;
        if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
          return false;
        }
        var arrStacked = stack.get(array4);
        var othStacked = stack.get(other);
        if (arrStacked && othStacked) {
          return arrStacked == other && othStacked == array4;
        }
        var index2 = -1, result2 = true, seen2 = bitmask & COMPARE_UNORDERED_FLAG2 ? new SetCache2() : undefined$1;
        stack.set(array4, other);
        stack.set(other, array4);
        while (++index2 < arrLength) {
          var arrValue = array4[index2], othValue = other[index2];
          if (customizer) {
            var compared = isPartial ? customizer(othValue, arrValue, index2, other, array4, stack) : customizer(arrValue, othValue, index2, array4, other, stack);
          }
          if (compared !== undefined$1) {
            if (compared) {
              continue;
            }
            result2 = false;
            break;
          }
          if (seen2) {
            if (!arraySome2(other, function(othValue2, othIndex) {
              if (!cacheHas2(seen2, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
                return seen2.push(othIndex);
              }
            })) {
              result2 = false;
              break;
            }
          } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
            result2 = false;
            break;
          }
        }
        stack["delete"](array4);
        stack["delete"](other);
        return result2;
      }
      function equalByTag2(object4, other, tag, bitmask, customizer, equalFunc, stack) {
        switch (tag) {
          case dataViewTag2:
            if (object4.byteLength != other.byteLength || object4.byteOffset != other.byteOffset) {
              return false;
            }
            object4 = object4.buffer;
            other = other.buffer;
          case arrayBufferTag2:
            if (object4.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object4), new Uint8Array2(other))) {
              return false;
            }
            return true;
          case boolTag2:
          case dateTag2:
          case numberTag2:
            return eq2(+object4, +other);
          case errorTag2:
            return object4.name == other.name && object4.message == other.message;
          case regexpTag2:
          case stringTag2:
            return object4 == other + "";
          case mapTag2:
            var convert2 = mapToArray2;
          case setTag2:
            var isPartial = bitmask & COMPARE_PARTIAL_FLAG2;
            convert2 || (convert2 = setToArray2);
            if (object4.size != other.size && !isPartial) {
              return false;
            }
            var stacked = stack.get(object4);
            if (stacked) {
              return stacked == other;
            }
            bitmask |= COMPARE_UNORDERED_FLAG2;
            stack.set(object4, other);
            var result2 = equalArrays2(convert2(object4), convert2(other), bitmask, customizer, equalFunc, stack);
            stack["delete"](object4);
            return result2;
          case symbolTag2:
            if (symbolValueOf2) {
              return symbolValueOf2.call(object4) == symbolValueOf2.call(other);
            }
        }
        return false;
      }
      function equalObjects2(object4, other, bitmask, customizer, equalFunc, stack) {
        var isPartial = bitmask & COMPARE_PARTIAL_FLAG2, objProps = getAllKeys2(object4), objLength = objProps.length, othProps = getAllKeys2(other), othLength = othProps.length;
        if (objLength != othLength && !isPartial) {
          return false;
        }
        var index2 = objLength;
        while (index2--) {
          var key = objProps[index2];
          if (!(isPartial ? key in other : hasOwnProperty2.call(other, key))) {
            return false;
          }
        }
        var objStacked = stack.get(object4);
        var othStacked = stack.get(other);
        if (objStacked && othStacked) {
          return objStacked == other && othStacked == object4;
        }
        var result2 = true;
        stack.set(object4, other);
        stack.set(other, object4);
        var skipCtor = isPartial;
        while (++index2 < objLength) {
          key = objProps[index2];
          var objValue = object4[key], othValue = other[key];
          if (customizer) {
            var compared = isPartial ? customizer(othValue, objValue, key, other, object4, stack) : customizer(objValue, othValue, key, object4, other, stack);
          }
          if (!(compared === undefined$1 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
            result2 = false;
            break;
          }
          skipCtor || (skipCtor = key == "constructor");
        }
        if (result2 && !skipCtor) {
          var objCtor = object4.constructor, othCtor = other.constructor;
          if (objCtor != othCtor && ("constructor" in object4 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
            result2 = false;
          }
        }
        stack["delete"](object4);
        stack["delete"](other);
        return result2;
      }
      function flatRest(func) {
        return setToString2(overRest2(func, undefined$1, flatten), func + "");
      }
      function getAllKeys2(object4) {
        return baseGetAllKeys2(object4, keys2, getSymbols2);
      }
      function getAllKeysIn2(object4) {
        return baseGetAllKeys2(object4, keysIn2, getSymbolsIn2);
      }
      var getData = !metaMap ? noop4 : function(func) {
        return metaMap.get(func);
      };
      function getFuncName(func) {
        var result2 = func.name + "", array4 = realNames[result2], length2 = hasOwnProperty2.call(realNames, result2) ? array4.length : 0;
        while (length2--) {
          var data = array4[length2], otherFunc = data.func;
          if (otherFunc == null || otherFunc == func) {
            return data.name;
          }
        }
        return result2;
      }
      function getHolder(func) {
        var object4 = hasOwnProperty2.call(lodash2, "placeholder") ? lodash2 : func;
        return object4.placeholder;
      }
      function getIteratee() {
        var result2 = lodash2.iteratee || iteratee;
        result2 = result2 === iteratee ? baseIteratee2 : result2;
        return arguments.length ? result2(arguments[0], arguments[1]) : result2;
      }
      function getMapData2(map3, key) {
        var data = map3.__data__;
        return isKeyable2(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
      }
      function getMatchData2(object4) {
        var result2 = keys2(object4), length2 = result2.length;
        while (length2--) {
          var key = result2[length2], value2 = object4[key];
          result2[length2] = [key, value2, isStrictComparable2(value2)];
        }
        return result2;
      }
      function getNative2(object4, key) {
        var value2 = getValue2(object4, key);
        return baseIsNative2(value2) ? value2 : undefined$1;
      }
      function getRawTag2(value2) {
        var isOwn = hasOwnProperty2.call(value2, symToStringTag2), tag = value2[symToStringTag2];
        try {
          value2[symToStringTag2] = undefined$1;
          var unmasked = true;
        } catch (e2) {
        }
        var result2 = nativeObjectToString2.call(value2);
        if (unmasked) {
          if (isOwn) {
            value2[symToStringTag2] = tag;
          } else {
            delete value2[symToStringTag2];
          }
        }
        return result2;
      }
      var getSymbols2 = !nativeGetSymbols2 ? stubArray2 : function(object4) {
        if (object4 == null) {
          return [];
        }
        object4 = Object2(object4);
        return arrayFilter2(nativeGetSymbols2(object4), function(symbol) {
          return propertyIsEnumerable2.call(object4, symbol);
        });
      };
      var getSymbolsIn2 = !nativeGetSymbols2 ? stubArray2 : function(object4) {
        var result2 = [];
        while (object4) {
          arrayPush2(result2, getSymbols2(object4));
          object4 = getPrototype2(object4);
        }
        return result2;
      };
      var getTag2 = baseGetTag2;
      if (DataView2 && getTag2(new DataView2(new ArrayBuffer(1))) != dataViewTag2 || Map2 && getTag2(new Map2()) != mapTag2 || Promise2 && getTag2(Promise2.resolve()) != promiseTag2 || Set2 && getTag2(new Set2()) != setTag2 || WeakMap2 && getTag2(new WeakMap2()) != weakMapTag2) {
        getTag2 = function(value2) {
          var result2 = baseGetTag2(value2), Ctor = result2 == objectTag2 ? value2.constructor : undefined$1, ctorString = Ctor ? toSource2(Ctor) : "";
          if (ctorString) {
            switch (ctorString) {
              case dataViewCtorString2:
                return dataViewTag2;
              case mapCtorString2:
                return mapTag2;
              case promiseCtorString2:
                return promiseTag2;
              case setCtorString2:
                return setTag2;
              case weakMapCtorString2:
                return weakMapTag2;
            }
          }
          return result2;
        };
      }
      function getView(start2, end2, transforms2) {
        var index2 = -1, length2 = transforms2.length;
        while (++index2 < length2) {
          var data = transforms2[index2], size3 = data.size;
          switch (data.type) {
            case "drop":
              start2 += size3;
              break;
            case "dropRight":
              end2 -= size3;
              break;
            case "take":
              end2 = nativeMin2(end2, start2 + size3);
              break;
            case "takeRight":
              start2 = nativeMax2(start2, end2 - size3);
              break;
          }
        }
        return { "start": start2, "end": end2 };
      }
      function getWrapDetails(source2) {
        var match5 = source2.match(reWrapDetails);
        return match5 ? match5[1].split(reSplitDetails) : [];
      }
      function hasPath2(object4, path, hasFunc) {
        path = castPath2(path, object4);
        var index2 = -1, length2 = path.length, result2 = false;
        while (++index2 < length2) {
          var key = toKey2(path[index2]);
          if (!(result2 = object4 != null && hasFunc(object4, key))) {
            break;
          }
          object4 = object4[key];
        }
        if (result2 || ++index2 != length2) {
          return result2;
        }
        length2 = object4 == null ? 0 : object4.length;
        return !!length2 && isLength2(length2) && isIndex2(key, length2) && (isArray3(object4) || isArguments2(object4));
      }
      function initCloneArray2(array4) {
        var length2 = array4.length, result2 = new array4.constructor(length2);
        if (length2 && typeof array4[0] == "string" && hasOwnProperty2.call(array4, "index")) {
          result2.index = array4.index;
          result2.input = array4.input;
        }
        return result2;
      }
      function initCloneObject2(object4) {
        return typeof object4.constructor == "function" && !isPrototype2(object4) ? baseCreate2(getPrototype2(object4)) : {};
      }
      function initCloneByTag2(object4, tag, isDeep) {
        var Ctor = object4.constructor;
        switch (tag) {
          case arrayBufferTag2:
            return cloneArrayBuffer2(object4);
          case boolTag2:
          case dateTag2:
            return new Ctor(+object4);
          case dataViewTag2:
            return cloneDataView2(object4, isDeep);
          case float32Tag2:
          case float64Tag2:
          case int8Tag2:
          case int16Tag2:
          case int32Tag2:
          case uint8Tag2:
          case uint8ClampedTag2:
          case uint16Tag2:
          case uint32Tag2:
            return cloneTypedArray2(object4, isDeep);
          case mapTag2:
            return new Ctor();
          case numberTag2:
          case stringTag2:
            return new Ctor(object4);
          case regexpTag2:
            return cloneRegExp2(object4);
          case setTag2:
            return new Ctor();
          case symbolTag2:
            return cloneSymbol2(object4);
        }
      }
      function insertWrapDetails(source2, details) {
        var length2 = details.length;
        if (!length2) {
          return source2;
        }
        var lastIndex = length2 - 1;
        details[lastIndex] = (length2 > 1 ? "& " : "") + details[lastIndex];
        details = details.join(length2 > 2 ? ", " : " ");
        return source2.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
      }
      function isFlattenable(value2) {
        return isArray3(value2) || isArguments2(value2) || !!(spreadableSymbol && value2 && value2[spreadableSymbol]);
      }
      function isIndex2(value2, length2) {
        var type4 = typeof value2;
        length2 = length2 == null ? MAX_SAFE_INTEGER2 : length2;
        return !!length2 && (type4 == "number" || type4 != "symbol" && reIsUint2.test(value2)) && (value2 > -1 && value2 % 1 == 0 && value2 < length2);
      }
      function isIterateeCall2(value2, index2, object4) {
        if (!isObject2(object4)) {
          return false;
        }
        var type4 = typeof index2;
        if (type4 == "number" ? isArrayLike2(object4) && isIndex2(index2, object4.length) : type4 == "string" && index2 in object4) {
          return eq2(object4[index2], value2);
        }
        return false;
      }
      function isKey2(value2, object4) {
        if (isArray3(value2)) {
          return false;
        }
        var type4 = typeof value2;
        if (type4 == "number" || type4 == "symbol" || type4 == "boolean" || value2 == null || isSymbol2(value2)) {
          return true;
        }
        return reIsPlainProp2.test(value2) || !reIsDeepProp2.test(value2) || object4 != null && value2 in Object2(object4);
      }
      function isKeyable2(value2) {
        var type4 = typeof value2;
        return type4 == "string" || type4 == "number" || type4 == "symbol" || type4 == "boolean" ? value2 !== "__proto__" : value2 === null;
      }
      function isLaziable(func) {
        var funcName = getFuncName(func), other = lodash2[funcName];
        if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
          return false;
        }
        if (func === other) {
          return true;
        }
        var data = getData(other);
        return !!data && func === data[0];
      }
      function isMasked2(func) {
        return !!maskSrcKey2 && maskSrcKey2 in func;
      }
      var isMaskable = coreJsData2 ? isFunction2 : stubFalse2;
      function isPrototype2(value2) {
        var Ctor = value2 && value2.constructor, proto2 = typeof Ctor == "function" && Ctor.prototype || objectProto2;
        return value2 === proto2;
      }
      function isStrictComparable2(value2) {
        return value2 === value2 && !isObject2(value2);
      }
      function matchesStrictComparable2(key, srcValue) {
        return function(object4) {
          if (object4 == null) {
            return false;
          }
          return object4[key] === srcValue && (srcValue !== undefined$1 || key in Object2(object4));
        };
      }
      function memoizeCapped2(func) {
        var result2 = memoize2(func, function(key) {
          if (cache2.size === MAX_MEMOIZE_SIZE2) {
            cache2.clear();
          }
          return key;
        });
        var cache2 = result2.cache;
        return result2;
      }
      function mergeData(data, source2) {
        var bitmask = data[1], srcBitmask = source2[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
        var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data[7].length <= source2[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source2[7].length <= source2[8] && bitmask == WRAP_CURRY_FLAG;
        if (!(isCommon || isCombo)) {
          return data;
        }
        if (srcBitmask & WRAP_BIND_FLAG) {
          data[2] = source2[2];
          newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
        }
        var value2 = source2[3];
        if (value2) {
          var partials = data[3];
          data[3] = partials ? composeArgs(partials, value2, source2[4]) : value2;
          data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source2[4];
        }
        value2 = source2[5];
        if (value2) {
          partials = data[5];
          data[5] = partials ? composeArgsRight(partials, value2, source2[6]) : value2;
          data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source2[6];
        }
        value2 = source2[7];
        if (value2) {
          data[7] = value2;
        }
        if (srcBitmask & WRAP_ARY_FLAG) {
          data[8] = data[8] == null ? source2[8] : nativeMin2(data[8], source2[8]);
        }
        if (data[9] == null) {
          data[9] = source2[9];
        }
        data[0] = source2[0];
        data[1] = newBitmask;
        return data;
      }
      function nativeKeysIn2(object4) {
        var result2 = [];
        if (object4 != null) {
          for (var key in Object2(object4)) {
            result2.push(key);
          }
        }
        return result2;
      }
      function objectToString2(value2) {
        return nativeObjectToString2.call(value2);
      }
      function overRest2(func, start2, transform3) {
        start2 = nativeMax2(start2 === undefined$1 ? func.length - 1 : start2, 0);
        return function() {
          var args = arguments, index2 = -1, length2 = nativeMax2(args.length - start2, 0), array4 = Array2(length2);
          while (++index2 < length2) {
            array4[index2] = args[start2 + index2];
          }
          index2 = -1;
          var otherArgs = Array2(start2 + 1);
          while (++index2 < start2) {
            otherArgs[index2] = args[index2];
          }
          otherArgs[start2] = transform3(array4);
          return apply2(func, this, otherArgs);
        };
      }
      function parent(object4, path) {
        return path.length < 2 ? object4 : baseGet2(object4, baseSlice(path, 0, -1));
      }
      function reorder(array4, indexes) {
        var arrLength = array4.length, length2 = nativeMin2(indexes.length, arrLength), oldArray = copyArray2(array4);
        while (length2--) {
          var index2 = indexes[length2];
          array4[length2] = isIndex2(index2, arrLength) ? oldArray[index2] : undefined$1;
        }
        return array4;
      }
      function safeGet2(object4, key) {
        if (key === "constructor" && typeof object4[key] === "function") {
          return;
        }
        if (key == "__proto__") {
          return;
        }
        return object4[key];
      }
      var setData = shortOut2(baseSetData);
      var setTimeout2 = ctxSetTimeout || function(func, wait) {
        return root2.setTimeout(func, wait);
      };
      var setToString2 = shortOut2(baseSetToString2);
      function setWrapToString(wrapper, reference, bitmask) {
        var source2 = reference + "";
        return setToString2(wrapper, insertWrapDetails(source2, updateWrapDetails(getWrapDetails(source2), bitmask)));
      }
      function shortOut2(func) {
        var count = 0, lastCalled = 0;
        return function() {
          var stamp = nativeNow2(), remaining = HOT_SPAN2 - (stamp - lastCalled);
          lastCalled = stamp;
          if (remaining > 0) {
            if (++count >= HOT_COUNT2) {
              return arguments[0];
            }
          } else {
            count = 0;
          }
          return func.apply(undefined$1, arguments);
        };
      }
      function shuffleSelf(array4, size3) {
        var index2 = -1, length2 = array4.length, lastIndex = length2 - 1;
        size3 = size3 === undefined$1 ? length2 : size3;
        while (++index2 < size3) {
          var rand = baseRandom(index2, lastIndex), value2 = array4[rand];
          array4[rand] = array4[index2];
          array4[index2] = value2;
        }
        array4.length = size3;
        return array4;
      }
      var stringToPath2 = memoizeCapped2(function(string3) {
        var result2 = [];
        if (string3.charCodeAt(0) === 46) {
          result2.push("");
        }
        string3.replace(rePropName2, function(match5, number4, quote, subString) {
          result2.push(quote ? subString.replace(reEscapeChar2, "$1") : number4 || match5);
        });
        return result2;
      });
      function toKey2(value2) {
        if (typeof value2 == "string" || isSymbol2(value2)) {
          return value2;
        }
        var result2 = value2 + "";
        return result2 == "0" && 1 / value2 == -INFINITY2 ? "-0" : result2;
      }
      function toSource2(func) {
        if (func != null) {
          try {
            return funcToString2.call(func);
          } catch (e2) {
          }
          try {
            return func + "";
          } catch (e2) {
          }
        }
        return "";
      }
      function updateWrapDetails(details, bitmask) {
        arrayEach2(wrapFlags, function(pair) {
          var value2 = "_." + pair[0];
          if (bitmask & pair[1] && !arrayIncludes(details, value2)) {
            details.push(value2);
          }
        });
        return details.sort();
      }
      function wrapperClone(wrapper) {
        if (wrapper instanceof LazyWrapper) {
          return wrapper.clone();
        }
        var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
        result2.__actions__ = copyArray2(wrapper.__actions__);
        result2.__index__ = wrapper.__index__;
        result2.__values__ = wrapper.__values__;
        return result2;
      }
      function chunk(array4, size3, guard) {
        if (guard ? isIterateeCall2(array4, size3, guard) : size3 === undefined$1) {
          size3 = 1;
        } else {
          size3 = nativeMax2(toInteger(size3), 0);
        }
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2 || size3 < 1) {
          return [];
        }
        var index2 = 0, resIndex = 0, result2 = Array2(nativeCeil(length2 / size3));
        while (index2 < length2) {
          result2[resIndex++] = baseSlice(array4, index2, index2 += size3);
        }
        return result2;
      }
      function compact(array4) {
        var index2 = -1, length2 = array4 == null ? 0 : array4.length, resIndex = 0, result2 = [];
        while (++index2 < length2) {
          var value2 = array4[index2];
          if (value2) {
            result2[resIndex++] = value2;
          }
        }
        return result2;
      }
      function concat() {
        var length2 = arguments.length;
        if (!length2) {
          return [];
        }
        var args = Array2(length2 - 1), array4 = arguments[0], index2 = length2;
        while (index2--) {
          args[index2 - 1] = arguments[index2];
        }
        return arrayPush2(isArray3(array4) ? copyArray2(array4) : [array4], baseFlatten(args, 1));
      }
      var difference = baseRest2(function(array4, values2) {
        return isArrayLikeObject2(array4) ? baseDifference(array4, baseFlatten(values2, 1, isArrayLikeObject2, true)) : [];
      });
      var differenceBy = baseRest2(function(array4, values2) {
        var iteratee2 = last(values2);
        if (isArrayLikeObject2(iteratee2)) {
          iteratee2 = undefined$1;
        }
        return isArrayLikeObject2(array4) ? baseDifference(array4, baseFlatten(values2, 1, isArrayLikeObject2, true), getIteratee(iteratee2, 2)) : [];
      });
      var differenceWith = baseRest2(function(array4, values2) {
        var comparator = last(values2);
        if (isArrayLikeObject2(comparator)) {
          comparator = undefined$1;
        }
        return isArrayLikeObject2(array4) ? baseDifference(array4, baseFlatten(values2, 1, isArrayLikeObject2, true), undefined$1, comparator) : [];
      });
      function drop(array4, n2, guard) {
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2) {
          return [];
        }
        n2 = guard || n2 === undefined$1 ? 1 : toInteger(n2);
        return baseSlice(array4, n2 < 0 ? 0 : n2, length2);
      }
      function dropRight(array4, n2, guard) {
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2) {
          return [];
        }
        n2 = guard || n2 === undefined$1 ? 1 : toInteger(n2);
        n2 = length2 - n2;
        return baseSlice(array4, 0, n2 < 0 ? 0 : n2);
      }
      function dropRightWhile(array4, predicate) {
        return array4 && array4.length ? baseWhile(array4, getIteratee(predicate, 3), true, true) : [];
      }
      function dropWhile(array4, predicate) {
        return array4 && array4.length ? baseWhile(array4, getIteratee(predicate, 3), true) : [];
      }
      function fill(array4, value2, start2, end2) {
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2) {
          return [];
        }
        if (start2 && typeof start2 != "number" && isIterateeCall2(array4, value2, start2)) {
          start2 = 0;
          end2 = length2;
        }
        return baseFill(array4, value2, start2, end2);
      }
      function findIndex(array4, predicate, fromIndex) {
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2) {
          return -1;
        }
        var index2 = fromIndex == null ? 0 : toInteger(fromIndex);
        if (index2 < 0) {
          index2 = nativeMax2(length2 + index2, 0);
        }
        return baseFindIndex(array4, getIteratee(predicate, 3), index2);
      }
      function findLastIndex(array4, predicate, fromIndex) {
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2) {
          return -1;
        }
        var index2 = length2 - 1;
        if (fromIndex !== undefined$1) {
          index2 = toInteger(fromIndex);
          index2 = fromIndex < 0 ? nativeMax2(length2 + index2, 0) : nativeMin2(index2, length2 - 1);
        }
        return baseFindIndex(array4, getIteratee(predicate, 3), index2, true);
      }
      function flatten(array4) {
        var length2 = array4 == null ? 0 : array4.length;
        return length2 ? baseFlatten(array4, 1) : [];
      }
      function flattenDeep(array4) {
        var length2 = array4 == null ? 0 : array4.length;
        return length2 ? baseFlatten(array4, INFINITY2) : [];
      }
      function flattenDepth(array4, depth) {
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2) {
          return [];
        }
        depth = depth === undefined$1 ? 1 : toInteger(depth);
        return baseFlatten(array4, depth);
      }
      function fromPairs(pairs) {
        var index2 = -1, length2 = pairs == null ? 0 : pairs.length, result2 = {};
        while (++index2 < length2) {
          var pair = pairs[index2];
          result2[pair[0]] = pair[1];
        }
        return result2;
      }
      function head(array4) {
        return array4 && array4.length ? array4[0] : undefined$1;
      }
      function indexOf2(array4, value2, fromIndex) {
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2) {
          return -1;
        }
        var index2 = fromIndex == null ? 0 : toInteger(fromIndex);
        if (index2 < 0) {
          index2 = nativeMax2(length2 + index2, 0);
        }
        return baseIndexOf(array4, value2, index2);
      }
      function initial(array4) {
        var length2 = array4 == null ? 0 : array4.length;
        return length2 ? baseSlice(array4, 0, -1) : [];
      }
      var intersection = baseRest2(function(arrays) {
        var mapped = arrayMap2(arrays, castArrayLikeObject);
        return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
      });
      var intersectionBy = baseRest2(function(arrays) {
        var iteratee2 = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
        if (iteratee2 === last(mapped)) {
          iteratee2 = undefined$1;
        } else {
          mapped.pop();
        }
        return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : [];
      });
      var intersectionWith = baseRest2(function(arrays) {
        var comparator = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
        comparator = typeof comparator == "function" ? comparator : undefined$1;
        if (comparator) {
          mapped.pop();
        }
        return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined$1, comparator) : [];
      });
      function join2(array4, separator) {
        return array4 == null ? "" : nativeJoin.call(array4, separator);
      }
      function last(array4) {
        var length2 = array4 == null ? 0 : array4.length;
        return length2 ? array4[length2 - 1] : undefined$1;
      }
      function lastIndexOf(array4, value2, fromIndex) {
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2) {
          return -1;
        }
        var index2 = length2;
        if (fromIndex !== undefined$1) {
          index2 = toInteger(fromIndex);
          index2 = index2 < 0 ? nativeMax2(length2 + index2, 0) : nativeMin2(index2, length2 - 1);
        }
        return value2 === value2 ? strictLastIndexOf(array4, value2, index2) : baseFindIndex(array4, baseIsNaN, index2, true);
      }
      function nth(array4, n2) {
        return array4 && array4.length ? baseNth(array4, toInteger(n2)) : undefined$1;
      }
      var pull = baseRest2(pullAll);
      function pullAll(array4, values2) {
        return array4 && array4.length && values2 && values2.length ? basePullAll(array4, values2) : array4;
      }
      function pullAllBy(array4, values2, iteratee2) {
        return array4 && array4.length && values2 && values2.length ? basePullAll(array4, values2, getIteratee(iteratee2, 2)) : array4;
      }
      function pullAllWith(array4, values2, comparator) {
        return array4 && array4.length && values2 && values2.length ? basePullAll(array4, values2, undefined$1, comparator) : array4;
      }
      var pullAt = flatRest(function(array4, indexes) {
        var length2 = array4 == null ? 0 : array4.length, result2 = baseAt(array4, indexes);
        basePullAt(array4, arrayMap2(indexes, function(index2) {
          return isIndex2(index2, length2) ? +index2 : index2;
        }).sort(compareAscending));
        return result2;
      });
      function remove(array4, predicate) {
        var result2 = [];
        if (!(array4 && array4.length)) {
          return result2;
        }
        var index2 = -1, indexes = [], length2 = array4.length;
        predicate = getIteratee(predicate, 3);
        while (++index2 < length2) {
          var value2 = array4[index2];
          if (predicate(value2, index2, array4)) {
            result2.push(value2);
            indexes.push(index2);
          }
        }
        basePullAt(array4, indexes);
        return result2;
      }
      function reverse(array4) {
        return array4 == null ? array4 : nativeReverse.call(array4);
      }
      function slice2(array4, start2, end2) {
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2) {
          return [];
        }
        if (end2 && typeof end2 != "number" && isIterateeCall2(array4, start2, end2)) {
          start2 = 0;
          end2 = length2;
        } else {
          start2 = start2 == null ? 0 : toInteger(start2);
          end2 = end2 === undefined$1 ? length2 : toInteger(end2);
        }
        return baseSlice(array4, start2, end2);
      }
      function sortedIndex(array4, value2) {
        return baseSortedIndex(array4, value2);
      }
      function sortedIndexBy(array4, value2, iteratee2) {
        return baseSortedIndexBy(array4, value2, getIteratee(iteratee2, 2));
      }
      function sortedIndexOf(array4, value2) {
        var length2 = array4 == null ? 0 : array4.length;
        if (length2) {
          var index2 = baseSortedIndex(array4, value2);
          if (index2 < length2 && eq2(array4[index2], value2)) {
            return index2;
          }
        }
        return -1;
      }
      function sortedLastIndex(array4, value2) {
        return baseSortedIndex(array4, value2, true);
      }
      function sortedLastIndexBy(array4, value2, iteratee2) {
        return baseSortedIndexBy(array4, value2, getIteratee(iteratee2, 2), true);
      }
      function sortedLastIndexOf(array4, value2) {
        var length2 = array4 == null ? 0 : array4.length;
        if (length2) {
          var index2 = baseSortedIndex(array4, value2, true) - 1;
          if (eq2(array4[index2], value2)) {
            return index2;
          }
        }
        return -1;
      }
      function sortedUniq(array4) {
        return array4 && array4.length ? baseSortedUniq(array4) : [];
      }
      function sortedUniqBy(array4, iteratee2) {
        return array4 && array4.length ? baseSortedUniq(array4, getIteratee(iteratee2, 2)) : [];
      }
      function tail(array4) {
        var length2 = array4 == null ? 0 : array4.length;
        return length2 ? baseSlice(array4, 1, length2) : [];
      }
      function take(array4, n2, guard) {
        if (!(array4 && array4.length)) {
          return [];
        }
        n2 = guard || n2 === undefined$1 ? 1 : toInteger(n2);
        return baseSlice(array4, 0, n2 < 0 ? 0 : n2);
      }
      function takeRight(array4, n2, guard) {
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2) {
          return [];
        }
        n2 = guard || n2 === undefined$1 ? 1 : toInteger(n2);
        n2 = length2 - n2;
        return baseSlice(array4, n2 < 0 ? 0 : n2, length2);
      }
      function takeRightWhile(array4, predicate) {
        return array4 && array4.length ? baseWhile(array4, getIteratee(predicate, 3), false, true) : [];
      }
      function takeWhile(array4, predicate) {
        return array4 && array4.length ? baseWhile(array4, getIteratee(predicate, 3)) : [];
      }
      var union = baseRest2(function(arrays) {
        return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject2, true));
      });
      var unionBy = baseRest2(function(arrays) {
        var iteratee2 = last(arrays);
        if (isArrayLikeObject2(iteratee2)) {
          iteratee2 = undefined$1;
        }
        return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject2, true), getIteratee(iteratee2, 2));
      });
      var unionWith = baseRest2(function(arrays) {
        var comparator = last(arrays);
        comparator = typeof comparator == "function" ? comparator : undefined$1;
        return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject2, true), undefined$1, comparator);
      });
      function uniq(array4) {
        return array4 && array4.length ? baseUniq(array4) : [];
      }
      function uniqBy(array4, iteratee2) {
        return array4 && array4.length ? baseUniq(array4, getIteratee(iteratee2, 2)) : [];
      }
      function uniqWith(array4, comparator) {
        comparator = typeof comparator == "function" ? comparator : undefined$1;
        return array4 && array4.length ? baseUniq(array4, undefined$1, comparator) : [];
      }
      function unzip(array4) {
        if (!(array4 && array4.length)) {
          return [];
        }
        var length2 = 0;
        array4 = arrayFilter2(array4, function(group) {
          if (isArrayLikeObject2(group)) {
            length2 = nativeMax2(group.length, length2);
            return true;
          }
        });
        return baseTimes2(length2, function(index2) {
          return arrayMap2(array4, baseProperty2(index2));
        });
      }
      function unzipWith(array4, iteratee2) {
        if (!(array4 && array4.length)) {
          return [];
        }
        var result2 = unzip(array4);
        if (iteratee2 == null) {
          return result2;
        }
        return arrayMap2(result2, function(group) {
          return apply2(iteratee2, undefined$1, group);
        });
      }
      var without = baseRest2(function(array4, values2) {
        return isArrayLikeObject2(array4) ? baseDifference(array4, values2) : [];
      });
      var xor = baseRest2(function(arrays) {
        return baseXor(arrayFilter2(arrays, isArrayLikeObject2));
      });
      var xorBy = baseRest2(function(arrays) {
        var iteratee2 = last(arrays);
        if (isArrayLikeObject2(iteratee2)) {
          iteratee2 = undefined$1;
        }
        return baseXor(arrayFilter2(arrays, isArrayLikeObject2), getIteratee(iteratee2, 2));
      });
      var xorWith = baseRest2(function(arrays) {
        var comparator = last(arrays);
        comparator = typeof comparator == "function" ? comparator : undefined$1;
        return baseXor(arrayFilter2(arrays, isArrayLikeObject2), undefined$1, comparator);
      });
      var zip = baseRest2(unzip);
      function zipObject(props, values2) {
        return baseZipObject(props || [], values2 || [], assignValue2);
      }
      function zipObjectDeep(props, values2) {
        return baseZipObject(props || [], values2 || [], baseSet);
      }
      var zipWith = baseRest2(function(arrays) {
        var length2 = arrays.length, iteratee2 = length2 > 1 ? arrays[length2 - 1] : undefined$1;
        iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined$1;
        return unzipWith(arrays, iteratee2);
      });
      function chain2(value2) {
        var result2 = lodash2(value2);
        result2.__chain__ = true;
        return result2;
      }
      function tap(value2, interceptor) {
        interceptor(value2);
        return value2;
      }
      function thru(value2, interceptor) {
        return interceptor(value2);
      }
      var wrapperAt = flatRest(function(paths) {
        var length2 = paths.length, start2 = length2 ? paths[0] : 0, value2 = this.__wrapped__, interceptor = function(object4) {
          return baseAt(object4, paths);
        };
        if (length2 > 1 || this.__actions__.length || !(value2 instanceof LazyWrapper) || !isIndex2(start2)) {
          return this.thru(interceptor);
        }
        value2 = value2.slice(start2, +start2 + (length2 ? 1 : 0));
        value2.__actions__.push({
          "func": thru,
          "args": [interceptor],
          "thisArg": undefined$1
        });
        return new LodashWrapper(value2, this.__chain__).thru(function(array4) {
          if (length2 && !array4.length) {
            array4.push(undefined$1);
          }
          return array4;
        });
      });
      function wrapperChain() {
        return chain2(this);
      }
      function wrapperCommit() {
        return new LodashWrapper(this.value(), this.__chain__);
      }
      function wrapperNext() {
        if (this.__values__ === undefined$1) {
          this.__values__ = toArray2(this.value());
        }
        var done = this.__index__ >= this.__values__.length, value2 = done ? undefined$1 : this.__values__[this.__index__++];
        return { "done": done, "value": value2 };
      }
      function wrapperToIterator() {
        return this;
      }
      function wrapperPlant(value2) {
        var result2, parent2 = this;
        while (parent2 instanceof baseLodash) {
          var clone4 = wrapperClone(parent2);
          clone4.__index__ = 0;
          clone4.__values__ = undefined$1;
          if (result2) {
            previous2.__wrapped__ = clone4;
          } else {
            result2 = clone4;
          }
          var previous2 = clone4;
          parent2 = parent2.__wrapped__;
        }
        previous2.__wrapped__ = value2;
        return result2;
      }
      function wrapperReverse() {
        var value2 = this.__wrapped__;
        if (value2 instanceof LazyWrapper) {
          var wrapped = value2;
          if (this.__actions__.length) {
            wrapped = new LazyWrapper(this);
          }
          wrapped = wrapped.reverse();
          wrapped.__actions__.push({
            "func": thru,
            "args": [reverse],
            "thisArg": undefined$1
          });
          return new LodashWrapper(wrapped, this.__chain__);
        }
        return this.thru(reverse);
      }
      function wrapperValue() {
        return baseWrapperValue(this.__wrapped__, this.__actions__);
      }
      var countBy = createAggregator(function(result2, value2, key) {
        if (hasOwnProperty2.call(result2, key)) {
          ++result2[key];
        } else {
          baseAssignValue2(result2, key, 1);
        }
      });
      function every(collection, predicate, guard) {
        var func = isArray3(collection) ? arrayEvery : baseEvery;
        if (guard && isIterateeCall2(collection, predicate, guard)) {
          predicate = undefined$1;
        }
        return func(collection, getIteratee(predicate, 3));
      }
      function filter3(collection, predicate) {
        var func = isArray3(collection) ? arrayFilter2 : baseFilter;
        return func(collection, getIteratee(predicate, 3));
      }
      var find2 = createFind(findIndex);
      var findLast = createFind(findLastIndex);
      function flatMap(collection, iteratee2) {
        return baseFlatten(map2(collection, iteratee2), 1);
      }
      function flatMapDeep(collection, iteratee2) {
        return baseFlatten(map2(collection, iteratee2), INFINITY2);
      }
      function flatMapDepth(collection, iteratee2, depth) {
        depth = depth === undefined$1 ? 1 : toInteger(depth);
        return baseFlatten(map2(collection, iteratee2), depth);
      }
      function forEach2(collection, iteratee2) {
        var func = isArray3(collection) ? arrayEach2 : baseEach2;
        return func(collection, getIteratee(iteratee2, 3));
      }
      function forEachRight(collection, iteratee2) {
        var func = isArray3(collection) ? arrayEachRight : baseEachRight;
        return func(collection, getIteratee(iteratee2, 3));
      }
      var groupBy = createAggregator(function(result2, value2, key) {
        if (hasOwnProperty2.call(result2, key)) {
          result2[key].push(value2);
        } else {
          baseAssignValue2(result2, key, [value2]);
        }
      });
      function includes(collection, value2, fromIndex, guard) {
        collection = isArrayLike2(collection) ? collection : values(collection);
        fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
        var length2 = collection.length;
        if (fromIndex < 0) {
          fromIndex = nativeMax2(length2 + fromIndex, 0);
        }
        return isString2(collection) ? fromIndex <= length2 && collection.indexOf(value2, fromIndex) > -1 : !!length2 && baseIndexOf(collection, value2, fromIndex) > -1;
      }
      var invokeMap = baseRest2(function(collection, path, args) {
        var index2 = -1, isFunc = typeof path == "function", result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
        baseEach2(collection, function(value2) {
          result2[++index2] = isFunc ? apply2(path, value2, args) : baseInvoke(value2, path, args);
        });
        return result2;
      });
      var keyBy = createAggregator(function(result2, value2, key) {
        baseAssignValue2(result2, key, value2);
      });
      function map2(collection, iteratee2) {
        var func = isArray3(collection) ? arrayMap2 : baseMap2;
        return func(collection, getIteratee(iteratee2, 3));
      }
      function orderBy(collection, iteratees, orders2, guard) {
        if (collection == null) {
          return [];
        }
        if (!isArray3(iteratees)) {
          iteratees = iteratees == null ? [] : [iteratees];
        }
        orders2 = guard ? undefined$1 : orders2;
        if (!isArray3(orders2)) {
          orders2 = orders2 == null ? [] : [orders2];
        }
        return baseOrderBy(collection, iteratees, orders2);
      }
      var partition = createAggregator(function(result2, value2, key) {
        result2[key ? 0 : 1].push(value2);
      }, function() {
        return [[], []];
      });
      function reduce(collection, iteratee2, accumulator) {
        var func = isArray3(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
        return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach2);
      }
      function reduceRight(collection, iteratee2, accumulator) {
        var func = isArray3(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
        return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight);
      }
      function reject(collection, predicate) {
        var func = isArray3(collection) ? arrayFilter2 : baseFilter;
        return func(collection, negate(getIteratee(predicate, 3)));
      }
      function sample2(collection) {
        var func = isArray3(collection) ? arraySample : baseSample;
        return func(collection);
      }
      function sampleSize(collection, n2, guard) {
        if (guard ? isIterateeCall2(collection, n2, guard) : n2 === undefined$1) {
          n2 = 1;
        } else {
          n2 = toInteger(n2);
        }
        var func = isArray3(collection) ? arraySampleSize : baseSampleSize;
        return func(collection, n2);
      }
      function shuffle(collection) {
        var func = isArray3(collection) ? arrayShuffle : baseShuffle;
        return func(collection);
      }
      function size2(collection) {
        if (collection == null) {
          return 0;
        }
        if (isArrayLike2(collection)) {
          return isString2(collection) ? stringSize(collection) : collection.length;
        }
        var tag = getTag2(collection);
        if (tag == mapTag2 || tag == setTag2) {
          return collection.size;
        }
        return baseKeys2(collection).length;
      }
      function some2(collection, predicate, guard) {
        var func = isArray3(collection) ? arraySome2 : baseSome;
        if (guard && isIterateeCall2(collection, predicate, guard)) {
          predicate = undefined$1;
        }
        return func(collection, getIteratee(predicate, 3));
      }
      var sortBy = baseRest2(function(collection, iteratees) {
        if (collection == null) {
          return [];
        }
        var length2 = iteratees.length;
        if (length2 > 1 && isIterateeCall2(collection, iteratees[0], iteratees[1])) {
          iteratees = [];
        } else if (length2 > 2 && isIterateeCall2(iteratees[0], iteratees[1], iteratees[2])) {
          iteratees = [iteratees[0]];
        }
        return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
      });
      var now2 = ctxNow || function() {
        return root2.Date.now();
      };
      function after(n2, func) {
        if (typeof func != "function") {
          throw new TypeError2(FUNC_ERROR_TEXT2);
        }
        n2 = toInteger(n2);
        return function() {
          if (--n2 < 1) {
            return func.apply(this, arguments);
          }
        };
      }
      function ary(func, n2, guard) {
        n2 = guard ? undefined$1 : n2;
        n2 = func && n2 == null ? func.length : n2;
        return createWrap(func, WRAP_ARY_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, n2);
      }
      function before(n2, func) {
        var result2;
        if (typeof func != "function") {
          throw new TypeError2(FUNC_ERROR_TEXT2);
        }
        n2 = toInteger(n2);
        return function() {
          if (--n2 > 0) {
            result2 = func.apply(this, arguments);
          }
          if (n2 <= 1) {
            func = undefined$1;
          }
          return result2;
        };
      }
      var bind2 = baseRest2(function(func, thisArg, partials) {
        var bitmask = WRAP_BIND_FLAG;
        if (partials.length) {
          var holders = replaceHolders(partials, getHolder(bind2));
          bitmask |= WRAP_PARTIAL_FLAG;
        }
        return createWrap(func, bitmask, thisArg, partials, holders);
      });
      var bindKey = baseRest2(function(object4, key, partials) {
        var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
        if (partials.length) {
          var holders = replaceHolders(partials, getHolder(bindKey));
          bitmask |= WRAP_PARTIAL_FLAG;
        }
        return createWrap(key, bitmask, object4, partials, holders);
      });
      function curry(func, arity, guard) {
        arity = guard ? undefined$1 : arity;
        var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, undefined$1, arity);
        result2.placeholder = curry.placeholder;
        return result2;
      }
      function curryRight(func, arity, guard) {
        arity = guard ? undefined$1 : arity;
        var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, undefined$1, arity);
        result2.placeholder = curryRight.placeholder;
        return result2;
      }
      function debounce2(func, wait, options) {
        var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
        if (typeof func != "function") {
          throw new TypeError2(FUNC_ERROR_TEXT2);
        }
        wait = toNumber2(wait) || 0;
        if (isObject2(options)) {
          leading = !!options.leading;
          maxing = "maxWait" in options;
          maxWait = maxing ? nativeMax2(toNumber2(options.maxWait) || 0, wait) : maxWait;
          trailing = "trailing" in options ? !!options.trailing : trailing;
        }
        function invokeFunc(time2) {
          var args = lastArgs, thisArg = lastThis;
          lastArgs = lastThis = undefined$1;
          lastInvokeTime = time2;
          result2 = func.apply(thisArg, args);
          return result2;
        }
        function leadingEdge(time2) {
          lastInvokeTime = time2;
          timerId = setTimeout2(timerExpired, wait);
          return leading ? invokeFunc(time2) : result2;
        }
        function remainingWait(time2) {
          var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
          return maxing ? nativeMin2(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
        }
        function shouldInvoke(time2) {
          var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime;
          return lastCallTime === undefined$1 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
        }
        function timerExpired() {
          var time2 = now2();
          if (shouldInvoke(time2)) {
            return trailingEdge(time2);
          }
          timerId = setTimeout2(timerExpired, remainingWait(time2));
        }
        function trailingEdge(time2) {
          timerId = undefined$1;
          if (trailing && lastArgs) {
            return invokeFunc(time2);
          }
          lastArgs = lastThis = undefined$1;
          return result2;
        }
        function cancel2() {
          if (timerId !== undefined$1) {
            clearTimeout2(timerId);
          }
          lastInvokeTime = 0;
          lastArgs = lastCallTime = lastThis = timerId = undefined$1;
        }
        function flush() {
          return timerId === undefined$1 ? result2 : trailingEdge(now2());
        }
        function debounced() {
          var time2 = now2(), isInvoking = shouldInvoke(time2);
          lastArgs = arguments;
          lastThis = this;
          lastCallTime = time2;
          if (isInvoking) {
            if (timerId === undefined$1) {
              return leadingEdge(lastCallTime);
            }
            if (maxing) {
              clearTimeout2(timerId);
              timerId = setTimeout2(timerExpired, wait);
              return invokeFunc(lastCallTime);
            }
          }
          if (timerId === undefined$1) {
            timerId = setTimeout2(timerExpired, wait);
          }
          return result2;
        }
        debounced.cancel = cancel2;
        debounced.flush = flush;
        return debounced;
      }
      var defer2 = baseRest2(function(func, args) {
        return baseDelay(func, 1, args);
      });
      var delay2 = baseRest2(function(func, wait, args) {
        return baseDelay(func, toNumber2(wait) || 0, args);
      });
      function flip2(func) {
        return createWrap(func, WRAP_FLIP_FLAG);
      }
      function memoize2(func, resolver2) {
        if (typeof func != "function" || resolver2 != null && typeof resolver2 != "function") {
          throw new TypeError2(FUNC_ERROR_TEXT2);
        }
        var memoized = function() {
          var args = arguments, key = resolver2 ? resolver2.apply(this, args) : args[0], cache2 = memoized.cache;
          if (cache2.has(key)) {
            return cache2.get(key);
          }
          var result2 = func.apply(this, args);
          memoized.cache = cache2.set(key, result2) || cache2;
          return result2;
        };
        memoized.cache = new (memoize2.Cache || MapCache2)();
        return memoized;
      }
      memoize2.Cache = MapCache2;
      function negate(predicate) {
        if (typeof predicate != "function") {
          throw new TypeError2(FUNC_ERROR_TEXT2);
        }
        return function() {
          var args = arguments;
          switch (args.length) {
            case 0:
              return !predicate.call(this);
            case 1:
              return !predicate.call(this, args[0]);
            case 2:
              return !predicate.call(this, args[0], args[1]);
            case 3:
              return !predicate.call(this, args[0], args[1], args[2]);
          }
          return !predicate.apply(this, args);
        };
      }
      function once(func) {
        return before(2, func);
      }
      var overArgs = castRest(function(func, transforms2) {
        transforms2 = transforms2.length == 1 && isArray3(transforms2[0]) ? arrayMap2(transforms2[0], baseUnary2(getIteratee())) : arrayMap2(baseFlatten(transforms2, 1), baseUnary2(getIteratee()));
        var funcsLength = transforms2.length;
        return baseRest2(function(args) {
          var index2 = -1, length2 = nativeMin2(args.length, funcsLength);
          while (++index2 < length2) {
            args[index2] = transforms2[index2].call(this, args[index2]);
          }
          return apply2(func, this, args);
        });
      });
      var partial = baseRest2(function(func, partials) {
        var holders = replaceHolders(partials, getHolder(partial));
        return createWrap(func, WRAP_PARTIAL_FLAG, undefined$1, partials, holders);
      });
      var partialRight = baseRest2(function(func, partials) {
        var holders = replaceHolders(partials, getHolder(partialRight));
        return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined$1, partials, holders);
      });
      var rearg = flatRest(function(func, indexes) {
        return createWrap(func, WRAP_REARG_FLAG, undefined$1, undefined$1, undefined$1, indexes);
      });
      function rest(func, start2) {
        if (typeof func != "function") {
          throw new TypeError2(FUNC_ERROR_TEXT2);
        }
        start2 = start2 === undefined$1 ? start2 : toInteger(start2);
        return baseRest2(func, start2);
      }
      function spread2(func, start2) {
        if (typeof func != "function") {
          throw new TypeError2(FUNC_ERROR_TEXT2);
        }
        start2 = start2 == null ? 0 : nativeMax2(toInteger(start2), 0);
        return baseRest2(function(args) {
          var array4 = args[start2], otherArgs = castSlice(args, 0, start2);
          if (array4) {
            arrayPush2(otherArgs, array4);
          }
          return apply2(func, this, otherArgs);
        });
      }
      function throttle2(func, wait, options) {
        var leading = true, trailing = true;
        if (typeof func != "function") {
          throw new TypeError2(FUNC_ERROR_TEXT2);
        }
        if (isObject2(options)) {
          leading = "leading" in options ? !!options.leading : leading;
          trailing = "trailing" in options ? !!options.trailing : trailing;
        }
        return debounce2(func, wait, {
          "leading": leading,
          "maxWait": wait,
          "trailing": trailing
        });
      }
      function unary(func) {
        return ary(func, 1);
      }
      function wrap2(value2, wrapper) {
        return partial(castFunction2(wrapper), value2);
      }
      function castArray() {
        if (!arguments.length) {
          return [];
        }
        var value2 = arguments[0];
        return isArray3(value2) ? value2 : [value2];
      }
      function clone3(value2) {
        return baseClone2(value2, CLONE_SYMBOLS_FLAG2);
      }
      function cloneWith(value2, customizer) {
        customizer = typeof customizer == "function" ? customizer : undefined$1;
        return baseClone2(value2, CLONE_SYMBOLS_FLAG2, customizer);
      }
      function cloneDeep2(value2) {
        return baseClone2(value2, CLONE_DEEP_FLAG2 | CLONE_SYMBOLS_FLAG2);
      }
      function cloneDeepWith(value2, customizer) {
        customizer = typeof customizer == "function" ? customizer : undefined$1;
        return baseClone2(value2, CLONE_DEEP_FLAG2 | CLONE_SYMBOLS_FLAG2, customizer);
      }
      function conformsTo(object4, source2) {
        return source2 == null || baseConformsTo(object4, source2, keys2(source2));
      }
      function eq2(value2, other) {
        return value2 === other || value2 !== value2 && other !== other;
      }
      var gt = createRelationalOperation(baseGt);
      var gte = createRelationalOperation(function(value2, other) {
        return value2 >= other;
      });
      var isArguments2 = baseIsArguments2(/* @__PURE__ */ function() {
        return arguments;
      }()) ? baseIsArguments2 : function(value2) {
        return isObjectLike2(value2) && hasOwnProperty2.call(value2, "callee") && !propertyIsEnumerable2.call(value2, "callee");
      };
      var isArray3 = Array2.isArray;
      var isArrayBuffer2 = nodeIsArrayBuffer ? baseUnary2(nodeIsArrayBuffer) : baseIsArrayBuffer;
      function isArrayLike2(value2) {
        return value2 != null && isLength2(value2.length) && !isFunction2(value2);
      }
      function isArrayLikeObject2(value2) {
        return isObjectLike2(value2) && isArrayLike2(value2);
      }
      function isBoolean2(value2) {
        return value2 === true || value2 === false || isObjectLike2(value2) && baseGetTag2(value2) == boolTag2;
      }
      var isBuffer2 = nativeIsBuffer2 || stubFalse2;
      var isDate2 = nodeIsDate ? baseUnary2(nodeIsDate) : baseIsDate;
      function isElement(value2) {
        return isObjectLike2(value2) && value2.nodeType === 1 && !isPlainObject3(value2);
      }
      function isEmpty2(value2) {
        if (value2 == null) {
          return true;
        }
        if (isArrayLike2(value2) && (isArray3(value2) || typeof value2 == "string" || typeof value2.splice == "function" || isBuffer2(value2) || isTypedArray2(value2) || isArguments2(value2))) {
          return !value2.length;
        }
        var tag = getTag2(value2);
        if (tag == mapTag2 || tag == setTag2) {
          return !value2.size;
        }
        if (isPrototype2(value2)) {
          return !baseKeys2(value2).length;
        }
        for (var key in value2) {
          if (hasOwnProperty2.call(value2, key)) {
            return false;
          }
        }
        return true;
      }
      function isEqual2(value2, other) {
        return baseIsEqual2(value2, other);
      }
      function isEqualWith(value2, other, customizer) {
        customizer = typeof customizer == "function" ? customizer : undefined$1;
        var result2 = customizer ? customizer(value2, other) : undefined$1;
        return result2 === undefined$1 ? baseIsEqual2(value2, other, undefined$1, customizer) : !!result2;
      }
      function isError(value2) {
        if (!isObjectLike2(value2)) {
          return false;
        }
        var tag = baseGetTag2(value2);
        return tag == errorTag2 || tag == domExcTag || typeof value2.message == "string" && typeof value2.name == "string" && !isPlainObject3(value2);
      }
      function isFinite2(value2) {
        return typeof value2 == "number" && nativeIsFinite(value2);
      }
      function isFunction2(value2) {
        if (!isObject2(value2)) {
          return false;
        }
        var tag = baseGetTag2(value2);
        return tag == funcTag2 || tag == genTag2 || tag == asyncTag2 || tag == proxyTag2;
      }
      function isInteger2(value2) {
        return typeof value2 == "number" && value2 == toInteger(value2);
      }
      function isLength2(value2) {
        return typeof value2 == "number" && value2 > -1 && value2 % 1 == 0 && value2 <= MAX_SAFE_INTEGER2;
      }
      function isObject2(value2) {
        var type4 = typeof value2;
        return value2 != null && (type4 == "object" || type4 == "function");
      }
      function isObjectLike2(value2) {
        return value2 != null && typeof value2 == "object";
      }
      var isMap2 = nodeIsMap2 ? baseUnary2(nodeIsMap2) : baseIsMap2;
      function isMatch(object4, source2) {
        return object4 === source2 || baseIsMatch2(object4, source2, getMatchData2(source2));
      }
      function isMatchWith(object4, source2, customizer) {
        customizer = typeof customizer == "function" ? customizer : undefined$1;
        return baseIsMatch2(object4, source2, getMatchData2(source2), customizer);
      }
      function isNaN2(value2) {
        return isNumber2(value2) && value2 != +value2;
      }
      function isNative(value2) {
        if (isMaskable(value2)) {
          throw new Error2(CORE_ERROR_TEXT);
        }
        return baseIsNative2(value2);
      }
      function isNull(value2) {
        return value2 === null;
      }
      function isNil(value2) {
        return value2 == null;
      }
      function isNumber2(value2) {
        return typeof value2 == "number" || isObjectLike2(value2) && baseGetTag2(value2) == numberTag2;
      }
      function isPlainObject3(value2) {
        if (!isObjectLike2(value2) || baseGetTag2(value2) != objectTag2) {
          return false;
        }
        var proto2 = getPrototype2(value2);
        if (proto2 === null) {
          return true;
        }
        var Ctor = hasOwnProperty2.call(proto2, "constructor") && proto2.constructor;
        return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString2.call(Ctor) == objectCtorString2;
      }
      var isRegExp2 = nodeIsRegExp ? baseUnary2(nodeIsRegExp) : baseIsRegExp;
      function isSafeInteger(value2) {
        return isInteger2(value2) && value2 >= -MAX_SAFE_INTEGER2 && value2 <= MAX_SAFE_INTEGER2;
      }
      var isSet2 = nodeIsSet2 ? baseUnary2(nodeIsSet2) : baseIsSet2;
      function isString2(value2) {
        return typeof value2 == "string" || !isArray3(value2) && isObjectLike2(value2) && baseGetTag2(value2) == stringTag2;
      }
      function isSymbol2(value2) {
        return typeof value2 == "symbol" || isObjectLike2(value2) && baseGetTag2(value2) == symbolTag2;
      }
      var isTypedArray2 = nodeIsTypedArray2 ? baseUnary2(nodeIsTypedArray2) : baseIsTypedArray2;
      function isUndefined2(value2) {
        return value2 === undefined$1;
      }
      function isWeakMap(value2) {
        return isObjectLike2(value2) && getTag2(value2) == weakMapTag2;
      }
      function isWeakSet(value2) {
        return isObjectLike2(value2) && baseGetTag2(value2) == weakSetTag;
      }
      var lt = createRelationalOperation(baseLt);
      var lte = createRelationalOperation(function(value2, other) {
        return value2 <= other;
      });
      function toArray2(value2) {
        if (!value2) {
          return [];
        }
        if (isArrayLike2(value2)) {
          return isString2(value2) ? stringToArray3(value2) : copyArray2(value2);
        }
        if (symIterator && value2[symIterator]) {
          return iteratorToArray(value2[symIterator]());
        }
        var tag = getTag2(value2), func = tag == mapTag2 ? mapToArray2 : tag == setTag2 ? setToArray2 : values;
        return func(value2);
      }
      function toFinite(value2) {
        if (!value2) {
          return value2 === 0 ? value2 : 0;
        }
        value2 = toNumber2(value2);
        if (value2 === INFINITY2 || value2 === -INFINITY2) {
          var sign2 = value2 < 0 ? -1 : 1;
          return sign2 * MAX_INTEGER;
        }
        return value2 === value2 ? value2 : 0;
      }
      function toInteger(value2) {
        var result2 = toFinite(value2), remainder = result2 % 1;
        return result2 === result2 ? remainder ? result2 - remainder : result2 : 0;
      }
      function toLength(value2) {
        return value2 ? baseClamp(toInteger(value2), 0, MAX_ARRAY_LENGTH) : 0;
      }
      function toNumber2(value2) {
        if (typeof value2 == "number") {
          return value2;
        }
        if (isSymbol2(value2)) {
          return NAN2;
        }
        if (isObject2(value2)) {
          var other = typeof value2.valueOf == "function" ? value2.valueOf() : value2;
          value2 = isObject2(other) ? other + "" : other;
        }
        if (typeof value2 != "string") {
          return value2 === 0 ? value2 : +value2;
        }
        value2 = baseTrim2(value2);
        var isBinary = reIsBinary2.test(value2);
        return isBinary || reIsOctal2.test(value2) ? freeParseInt2(value2.slice(2), isBinary ? 2 : 8) : reIsBadHex2.test(value2) ? NAN2 : +value2;
      }
      function toPlainObject2(value2) {
        return copyObject2(value2, keysIn2(value2));
      }
      function toSafeInteger(value2) {
        return value2 ? baseClamp(toInteger(value2), -MAX_SAFE_INTEGER2, MAX_SAFE_INTEGER2) : value2 === 0 ? value2 : 0;
      }
      function toString4(value2) {
        return value2 == null ? "" : baseToString2(value2);
      }
      var assign = createAssigner2(function(object4, source2) {
        if (isPrototype2(source2) || isArrayLike2(source2)) {
          copyObject2(source2, keys2(source2), object4);
          return;
        }
        for (var key in source2) {
          if (hasOwnProperty2.call(source2, key)) {
            assignValue2(object4, key, source2[key]);
          }
        }
      });
      var assignIn = createAssigner2(function(object4, source2) {
        copyObject2(source2, keysIn2(source2), object4);
      });
      var assignInWith = createAssigner2(function(object4, source2, srcIndex, customizer) {
        copyObject2(source2, keysIn2(source2), object4, customizer);
      });
      var assignWith = createAssigner2(function(object4, source2, srcIndex, customizer) {
        copyObject2(source2, keys2(source2), object4, customizer);
      });
      var at = flatRest(baseAt);
      function create2(prototype2, properties2) {
        var result2 = baseCreate2(prototype2);
        return properties2 == null ? result2 : baseAssign2(result2, properties2);
      }
      var defaults2 = baseRest2(function(object4, sources) {
        object4 = Object2(object4);
        var index2 = -1;
        var length2 = sources.length;
        var guard = length2 > 2 ? sources[2] : undefined$1;
        if (guard && isIterateeCall2(sources[0], sources[1], guard)) {
          length2 = 1;
        }
        while (++index2 < length2) {
          var source2 = sources[index2];
          var props = keysIn2(source2);
          var propsIndex = -1;
          var propsLength = props.length;
          while (++propsIndex < propsLength) {
            var key = props[propsIndex];
            var value2 = object4[key];
            if (value2 === undefined$1 || eq2(value2, objectProto2[key]) && !hasOwnProperty2.call(object4, key)) {
              object4[key] = source2[key];
            }
          }
        }
        return object4;
      });
      var defaultsDeep = baseRest2(function(args) {
        args.push(undefined$1, customDefaultsMerge);
        return apply2(mergeWith, undefined$1, args);
      });
      function findKey2(object4, predicate) {
        return baseFindKey(object4, getIteratee(predicate, 3), baseForOwn2);
      }
      function findLastKey(object4, predicate) {
        return baseFindKey(object4, getIteratee(predicate, 3), baseForOwnRight);
      }
      function forIn(object4, iteratee2) {
        return object4 == null ? object4 : baseFor2(object4, getIteratee(iteratee2, 3), keysIn2);
      }
      function forInRight(object4, iteratee2) {
        return object4 == null ? object4 : baseForRight(object4, getIteratee(iteratee2, 3), keysIn2);
      }
      function forOwn2(object4, iteratee2) {
        return object4 && baseForOwn2(object4, getIteratee(iteratee2, 3));
      }
      function forOwnRight(object4, iteratee2) {
        return object4 && baseForOwnRight(object4, getIteratee(iteratee2, 3));
      }
      function functions(object4) {
        return object4 == null ? [] : baseFunctions(object4, keys2(object4));
      }
      function functionsIn(object4) {
        return object4 == null ? [] : baseFunctions(object4, keysIn2(object4));
      }
      function get5(object4, path, defaultValue2) {
        var result2 = object4 == null ? undefined$1 : baseGet2(object4, path);
        return result2 === undefined$1 ? defaultValue2 : result2;
      }
      function has2(object4, path) {
        return object4 != null && hasPath2(object4, path, baseHas);
      }
      function hasIn2(object4, path) {
        return object4 != null && hasPath2(object4, path, baseHasIn2);
      }
      var invert = createInverter(function(result2, value2, key) {
        if (value2 != null && typeof value2.toString != "function") {
          value2 = nativeObjectToString2.call(value2);
        }
        result2[value2] = key;
      }, constant2(identity2));
      var invertBy = createInverter(function(result2, value2, key) {
        if (value2 != null && typeof value2.toString != "function") {
          value2 = nativeObjectToString2.call(value2);
        }
        if (hasOwnProperty2.call(result2, value2)) {
          result2[value2].push(key);
        } else {
          result2[value2] = [key];
        }
      }, getIteratee);
      var invoke = baseRest2(baseInvoke);
      function keys2(object4) {
        return isArrayLike2(object4) ? arrayLikeKeys2(object4) : baseKeys2(object4);
      }
      function keysIn2(object4) {
        return isArrayLike2(object4) ? arrayLikeKeys2(object4, true) : baseKeysIn2(object4);
      }
      function mapKeys(object4, iteratee2) {
        var result2 = {};
        iteratee2 = getIteratee(iteratee2, 3);
        baseForOwn2(object4, function(value2, key, object5) {
          baseAssignValue2(result2, iteratee2(value2, key, object5), value2);
        });
        return result2;
      }
      function mapValues(object4, iteratee2) {
        var result2 = {};
        iteratee2 = getIteratee(iteratee2, 3);
        baseForOwn2(object4, function(value2, key, object5) {
          baseAssignValue2(result2, key, iteratee2(value2, key, object5));
        });
        return result2;
      }
      var merge2 = createAssigner2(function(object4, source2, srcIndex) {
        baseMerge2(object4, source2, srcIndex);
      });
      var mergeWith = createAssigner2(function(object4, source2, srcIndex, customizer) {
        baseMerge2(object4, source2, srcIndex, customizer);
      });
      var omit2 = flatRest(function(object4, paths) {
        var result2 = {};
        if (object4 == null) {
          return result2;
        }
        var isDeep = false;
        paths = arrayMap2(paths, function(path) {
          path = castPath2(path, object4);
          isDeep || (isDeep = path.length > 1);
          return path;
        });
        copyObject2(object4, getAllKeysIn2(object4), result2);
        if (isDeep) {
          result2 = baseClone2(result2, CLONE_DEEP_FLAG2 | CLONE_FLAT_FLAG2 | CLONE_SYMBOLS_FLAG2, customOmitClone);
        }
        var length2 = paths.length;
        while (length2--) {
          baseUnset(result2, paths[length2]);
        }
        return result2;
      });
      function omitBy(object4, predicate) {
        return pickBy2(object4, negate(getIteratee(predicate)));
      }
      var pick3 = flatRest(function(object4, paths) {
        return object4 == null ? {} : basePick(object4, paths);
      });
      function pickBy2(object4, predicate) {
        if (object4 == null) {
          return {};
        }
        var props = arrayMap2(getAllKeysIn2(object4), function(prop) {
          return [prop];
        });
        predicate = getIteratee(predicate);
        return basePickBy(object4, props, function(value2, path) {
          return predicate(value2, path[0]);
        });
      }
      function result(object4, path, defaultValue2) {
        path = castPath2(path, object4);
        var index2 = -1, length2 = path.length;
        if (!length2) {
          length2 = 1;
          object4 = undefined$1;
        }
        while (++index2 < length2) {
          var value2 = object4 == null ? undefined$1 : object4[toKey2(path[index2])];
          if (value2 === undefined$1) {
            index2 = length2;
            value2 = defaultValue2;
          }
          object4 = isFunction2(value2) ? value2.call(object4) : value2;
        }
        return object4;
      }
      function set2(object4, path, value2) {
        return object4 == null ? object4 : baseSet(object4, path, value2);
      }
      function setWith(object4, path, value2, customizer) {
        customizer = typeof customizer == "function" ? customizer : undefined$1;
        return object4 == null ? object4 : baseSet(object4, path, value2, customizer);
      }
      var toPairs = createToPairs(keys2);
      var toPairsIn = createToPairs(keysIn2);
      function transform2(object4, iteratee2, accumulator) {
        var isArr = isArray3(object4), isArrLike = isArr || isBuffer2(object4) || isTypedArray2(object4);
        iteratee2 = getIteratee(iteratee2, 4);
        if (accumulator == null) {
          var Ctor = object4 && object4.constructor;
          if (isArrLike) {
            accumulator = isArr ? new Ctor() : [];
          } else if (isObject2(object4)) {
            accumulator = isFunction2(Ctor) ? baseCreate2(getPrototype2(object4)) : {};
          } else {
            accumulator = {};
          }
        }
        (isArrLike ? arrayEach2 : baseForOwn2)(object4, function(value2, index2, object5) {
          return iteratee2(accumulator, value2, index2, object5);
        });
        return accumulator;
      }
      function unset(object4, path) {
        return object4 == null ? true : baseUnset(object4, path);
      }
      function update(object4, path, updater) {
        return object4 == null ? object4 : baseUpdate(object4, path, castFunction2(updater));
      }
      function updateWith(object4, path, updater, customizer) {
        customizer = typeof customizer == "function" ? customizer : undefined$1;
        return object4 == null ? object4 : baseUpdate(object4, path, castFunction2(updater), customizer);
      }
      function values(object4) {
        return object4 == null ? [] : baseValues(object4, keys2(object4));
      }
      function valuesIn(object4) {
        return object4 == null ? [] : baseValues(object4, keysIn2(object4));
      }
      function clamp2(number4, lower, upper) {
        if (upper === undefined$1) {
          upper = lower;
          lower = undefined$1;
        }
        if (upper !== undefined$1) {
          upper = toNumber2(upper);
          upper = upper === upper ? upper : 0;
        }
        if (lower !== undefined$1) {
          lower = toNumber2(lower);
          lower = lower === lower ? lower : 0;
        }
        return baseClamp(toNumber2(number4), lower, upper);
      }
      function inRange2(number4, start2, end2) {
        start2 = toFinite(start2);
        if (end2 === undefined$1) {
          end2 = start2;
          start2 = 0;
        } else {
          end2 = toFinite(end2);
        }
        number4 = toNumber2(number4);
        return baseInRange(number4, start2, end2);
      }
      function random(lower, upper, floating) {
        if (floating && typeof floating != "boolean" && isIterateeCall2(lower, upper, floating)) {
          upper = floating = undefined$1;
        }
        if (floating === undefined$1) {
          if (typeof upper == "boolean") {
            floating = upper;
            upper = undefined$1;
          } else if (typeof lower == "boolean") {
            floating = lower;
            lower = undefined$1;
          }
        }
        if (lower === undefined$1 && upper === undefined$1) {
          lower = 0;
          upper = 1;
        } else {
          lower = toFinite(lower);
          if (upper === undefined$1) {
            upper = lower;
            lower = 0;
          } else {
            upper = toFinite(upper);
          }
        }
        if (lower > upper) {
          var temp = lower;
          lower = upper;
          upper = temp;
        }
        if (floating || lower % 1 || upper % 1) {
          var rand = nativeRandom();
          return nativeMin2(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
        }
        return baseRandom(lower, upper);
      }
      var camelCase2 = createCompounder(function(result2, word, index2) {
        word = word.toLowerCase();
        return result2 + (index2 ? capitalize2(word) : word);
      });
      function capitalize2(string3) {
        return upperFirst(toString4(string3).toLowerCase());
      }
      function deburr(string3) {
        string3 = toString4(string3);
        return string3 && string3.replace(reLatin, deburrLetter).replace(reComboMark, "");
      }
      function endsWith2(string3, target, position2) {
        string3 = toString4(string3);
        target = baseToString2(target);
        var length2 = string3.length;
        position2 = position2 === undefined$1 ? length2 : baseClamp(toInteger(position2), 0, length2);
        var end2 = position2;
        position2 -= target.length;
        return position2 >= 0 && string3.slice(position2, end2) == target;
      }
      function escape2(string3) {
        string3 = toString4(string3);
        return string3 && reHasUnescapedHtml.test(string3) ? string3.replace(reUnescapedHtml, escapeHtmlChar) : string3;
      }
      function escapeRegExp(string3) {
        string3 = toString4(string3);
        return string3 && reHasRegExpChar.test(string3) ? string3.replace(reRegExpChar2, "\\$&") : string3;
      }
      var kebabCase = createCompounder(function(result2, word, index2) {
        return result2 + (index2 ? "-" : "") + word.toLowerCase();
      });
      var lowerCase = createCompounder(function(result2, word, index2) {
        return result2 + (index2 ? " " : "") + word.toLowerCase();
      });
      var lowerFirst = createCaseFirst("toLowerCase");
      function pad(string3, length2, chars2) {
        string3 = toString4(string3);
        length2 = toInteger(length2);
        var strLength = length2 ? stringSize(string3) : 0;
        if (!length2 || strLength >= length2) {
          return string3;
        }
        var mid = (length2 - strLength) / 2;
        return createPadding(nativeFloor(mid), chars2) + string3 + createPadding(nativeCeil(mid), chars2);
      }
      function padEnd(string3, length2, chars2) {
        string3 = toString4(string3);
        length2 = toInteger(length2);
        var strLength = length2 ? stringSize(string3) : 0;
        return length2 && strLength < length2 ? string3 + createPadding(length2 - strLength, chars2) : string3;
      }
      function padStart(string3, length2, chars2) {
        string3 = toString4(string3);
        length2 = toInteger(length2);
        var strLength = length2 ? stringSize(string3) : 0;
        return length2 && strLength < length2 ? createPadding(length2 - strLength, chars2) + string3 : string3;
      }
      function parseInt2(string3, radix, guard) {
        if (guard || radix == null) {
          radix = 0;
        } else if (radix) {
          radix = +radix;
        }
        return nativeParseInt(toString4(string3).replace(reTrimStart2, ""), radix || 0);
      }
      function repeat(string3, n2, guard) {
        if (guard ? isIterateeCall2(string3, n2, guard) : n2 === undefined$1) {
          n2 = 1;
        } else {
          n2 = toInteger(n2);
        }
        return baseRepeat(toString4(string3), n2);
      }
      function replace2() {
        var args = arguments, string3 = toString4(args[0]);
        return args.length < 3 ? string3 : string3.replace(args[1], args[2]);
      }
      var snakeCase = createCompounder(function(result2, word, index2) {
        return result2 + (index2 ? "_" : "") + word.toLowerCase();
      });
      function split2(string3, separator, limit2) {
        if (limit2 && typeof limit2 != "number" && isIterateeCall2(string3, separator, limit2)) {
          separator = limit2 = undefined$1;
        }
        limit2 = limit2 === undefined$1 ? MAX_ARRAY_LENGTH : limit2 >>> 0;
        if (!limit2) {
          return [];
        }
        string3 = toString4(string3);
        if (string3 && (typeof separator == "string" || separator != null && !isRegExp2(separator))) {
          separator = baseToString2(separator);
          if (!separator && hasUnicode(string3)) {
            return castSlice(stringToArray3(string3), 0, limit2);
          }
        }
        return string3.split(separator, limit2);
      }
      var startCase = createCompounder(function(result2, word, index2) {
        return result2 + (index2 ? " " : "") + upperFirst(word);
      });
      function startsWith(string3, target, position2) {
        string3 = toString4(string3);
        position2 = position2 == null ? 0 : baseClamp(toInteger(position2), 0, string3.length);
        target = baseToString2(target);
        return string3.slice(position2, position2 + target.length) == target;
      }
      function template2(string3, options, guard) {
        var settings = lodash2.templateSettings;
        if (guard && isIterateeCall2(string3, options, guard)) {
          options = undefined$1;
        }
        string3 = toString4(string3);
        options = assignInWith({}, options, settings, customDefaultsAssignIn);
        var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys2(imports), importsValues = baseValues(imports, importsKeys);
        var isEscaping, isEvaluating, index2 = 0, interpolate2 = options.interpolate || reNoMatch, source2 = "__p += '";
        var reDelimiters = RegExp2(
          (options.escape || reNoMatch).source + "|" + interpolate2.source + "|" + (interpolate2 === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$",
          "g"
        );
        var sourceURL = "//# sourceURL=" + (hasOwnProperty2.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
        string3.replace(reDelimiters, function(match5, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset2) {
          interpolateValue || (interpolateValue = esTemplateValue);
          source2 += string3.slice(index2, offset2).replace(reUnescapedString, escapeStringChar);
          if (escapeValue) {
            isEscaping = true;
            source2 += "' +\n__e(" + escapeValue + ") +\n'";
          }
          if (evaluateValue) {
            isEvaluating = true;
            source2 += "';\n" + evaluateValue + ";\n__p += '";
          }
          if (interpolateValue) {
            source2 += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
          }
          index2 = offset2 + match5.length;
          return match5;
        });
        source2 += "';\n";
        var variable = hasOwnProperty2.call(options, "variable") && options.variable;
        if (!variable) {
          source2 = "with (obj) {\n" + source2 + "\n}\n";
        } else if (reForbiddenIdentifierChars.test(variable)) {
          throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
        }
        source2 = (isEvaluating ? source2.replace(reEmptyStringLeading, "") : source2).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
        source2 = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source2 + "return __p\n}";
        var result2 = attempt(function() {
          return Function2(importsKeys, sourceURL + "return " + source2).apply(undefined$1, importsValues);
        });
        result2.source = source2;
        if (isError(result2)) {
          throw result2;
        }
        return result2;
      }
      function toLower(value2) {
        return toString4(value2).toLowerCase();
      }
      function toUpper(value2) {
        return toString4(value2).toUpperCase();
      }
      function trim2(string3, chars2, guard) {
        string3 = toString4(string3);
        if (string3 && (guard || chars2 === undefined$1)) {
          return baseTrim2(string3);
        }
        if (!string3 || !(chars2 = baseToString2(chars2))) {
          return string3;
        }
        var strSymbols = stringToArray3(string3), chrSymbols = stringToArray3(chars2), start2 = charsStartIndex(strSymbols, chrSymbols), end2 = charsEndIndex(strSymbols, chrSymbols) + 1;
        return castSlice(strSymbols, start2, end2).join("");
      }
      function trimEnd(string3, chars2, guard) {
        string3 = toString4(string3);
        if (string3 && (guard || chars2 === undefined$1)) {
          return string3.slice(0, trimmedEndIndex2(string3) + 1);
        }
        if (!string3 || !(chars2 = baseToString2(chars2))) {
          return string3;
        }
        var strSymbols = stringToArray3(string3), end2 = charsEndIndex(strSymbols, stringToArray3(chars2)) + 1;
        return castSlice(strSymbols, 0, end2).join("");
      }
      function trimStart(string3, chars2, guard) {
        string3 = toString4(string3);
        if (string3 && (guard || chars2 === undefined$1)) {
          return string3.replace(reTrimStart2, "");
        }
        if (!string3 || !(chars2 = baseToString2(chars2))) {
          return string3;
        }
        var strSymbols = stringToArray3(string3), start2 = charsStartIndex(strSymbols, stringToArray3(chars2));
        return castSlice(strSymbols, start2).join("");
      }
      function truncate(string3, options) {
        var length2 = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
        if (isObject2(options)) {
          var separator = "separator" in options ? options.separator : separator;
          length2 = "length" in options ? toInteger(options.length) : length2;
          omission = "omission" in options ? baseToString2(options.omission) : omission;
        }
        string3 = toString4(string3);
        var strLength = string3.length;
        if (hasUnicode(string3)) {
          var strSymbols = stringToArray3(string3);
          strLength = strSymbols.length;
        }
        if (length2 >= strLength) {
          return string3;
        }
        var end2 = length2 - stringSize(omission);
        if (end2 < 1) {
          return omission;
        }
        var result2 = strSymbols ? castSlice(strSymbols, 0, end2).join("") : string3.slice(0, end2);
        if (separator === undefined$1) {
          return result2 + omission;
        }
        if (strSymbols) {
          end2 += result2.length - end2;
        }
        if (isRegExp2(separator)) {
          if (string3.slice(end2).search(separator)) {
            var match5, substring = result2;
            if (!separator.global) {
              separator = RegExp2(separator.source, toString4(reFlags2.exec(separator)) + "g");
            }
            separator.lastIndex = 0;
            while (match5 = separator.exec(substring)) {
              var newEnd = match5.index;
            }
            result2 = result2.slice(0, newEnd === undefined$1 ? end2 : newEnd);
          }
        } else if (string3.indexOf(baseToString2(separator), end2) != end2) {
          var index2 = result2.lastIndexOf(separator);
          if (index2 > -1) {
            result2 = result2.slice(0, index2);
          }
        }
        return result2 + omission;
      }
      function unescape3(string3) {
        string3 = toString4(string3);
        return string3 && reHasEscapedHtml.test(string3) ? string3.replace(reEscapedHtml, unescapeHtmlChar) : string3;
      }
      var upperCase = createCompounder(function(result2, word, index2) {
        return result2 + (index2 ? " " : "") + word.toUpperCase();
      });
      var upperFirst = createCaseFirst("toUpperCase");
      function words(string3, pattern4, guard) {
        string3 = toString4(string3);
        pattern4 = guard ? undefined$1 : pattern4;
        if (pattern4 === undefined$1) {
          return hasUnicodeWord(string3) ? unicodeWords(string3) : asciiWords(string3);
        }
        return string3.match(pattern4) || [];
      }
      var attempt = baseRest2(function(func, args) {
        try {
          return apply2(func, undefined$1, args);
        } catch (e2) {
          return isError(e2) ? e2 : new Error2(e2);
        }
      });
      var bindAll = flatRest(function(object4, methodNames) {
        arrayEach2(methodNames, function(key) {
          key = toKey2(key);
          baseAssignValue2(object4, key, bind2(object4[key], object4));
        });
        return object4;
      });
      function cond(pairs) {
        var length2 = pairs == null ? 0 : pairs.length, toIteratee = getIteratee();
        pairs = !length2 ? [] : arrayMap2(pairs, function(pair) {
          if (typeof pair[1] != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT2);
          }
          return [toIteratee(pair[0]), pair[1]];
        });
        return baseRest2(function(args) {
          var index2 = -1;
          while (++index2 < length2) {
            var pair = pairs[index2];
            if (apply2(pair[0], this, args)) {
              return apply2(pair[1], this, args);
            }
          }
        });
      }
      function conforms(source2) {
        return baseConforms(baseClone2(source2, CLONE_DEEP_FLAG2));
      }
      function constant2(value2) {
        return function() {
          return value2;
        };
      }
      function defaultTo(value2, defaultValue2) {
        return value2 == null || value2 !== value2 ? defaultValue2 : value2;
      }
      var flow2 = createFlow();
      var flowRight = createFlow(true);
      function identity2(value2) {
        return value2;
      }
      function iteratee(func) {
        return baseIteratee2(typeof func == "function" ? func : baseClone2(func, CLONE_DEEP_FLAG2));
      }
      function matches(source2) {
        return baseMatches2(baseClone2(source2, CLONE_DEEP_FLAG2));
      }
      function matchesProperty(path, srcValue) {
        return baseMatchesProperty2(path, baseClone2(srcValue, CLONE_DEEP_FLAG2));
      }
      var method4 = baseRest2(function(path, args) {
        return function(object4) {
          return baseInvoke(object4, path, args);
        };
      });
      var methodOf = baseRest2(function(object4, args) {
        return function(path) {
          return baseInvoke(object4, path, args);
        };
      });
      function mixin(object4, source2, options) {
        var props = keys2(source2), methodNames = baseFunctions(source2, props);
        if (options == null && !(isObject2(source2) && (methodNames.length || !props.length))) {
          options = source2;
          source2 = object4;
          object4 = this;
          methodNames = baseFunctions(source2, keys2(source2));
        }
        var chain3 = !(isObject2(options) && "chain" in options) || !!options.chain, isFunc = isFunction2(object4);
        arrayEach2(methodNames, function(methodName) {
          var func = source2[methodName];
          object4[methodName] = func;
          if (isFunc) {
            object4.prototype[methodName] = function() {
              var chainAll = this.__chain__;
              if (chain3 || chainAll) {
                var result2 = object4(this.__wrapped__), actions = result2.__actions__ = copyArray2(this.__actions__);
                actions.push({ "func": func, "args": arguments, "thisArg": object4 });
                result2.__chain__ = chainAll;
                return result2;
              }
              return func.apply(object4, arrayPush2([this.value()], arguments));
            };
          }
        });
        return object4;
      }
      function noConflict() {
        if (root2._ === this) {
          root2._ = oldDash;
        }
        return this;
      }
      function noop4() {
      }
      function nthArg(n2) {
        n2 = toInteger(n2);
        return baseRest2(function(args) {
          return baseNth(args, n2);
        });
      }
      var over = createOver(arrayMap2);
      var overEvery = createOver(arrayEvery);
      var overSome = createOver(arraySome2);
      function property2(path) {
        return isKey2(path) ? baseProperty2(toKey2(path)) : basePropertyDeep2(path);
      }
      function propertyOf(object4) {
        return function(path) {
          return object4 == null ? undefined$1 : baseGet2(object4, path);
        };
      }
      var range3 = createRange();
      var rangeRight = createRange(true);
      function stubArray2() {
        return [];
      }
      function stubFalse2() {
        return false;
      }
      function stubObject() {
        return {};
      }
      function stubString() {
        return "";
      }
      function stubTrue() {
        return true;
      }
      function times(n2, iteratee2) {
        n2 = toInteger(n2);
        if (n2 < 1 || n2 > MAX_SAFE_INTEGER2) {
          return [];
        }
        var index2 = MAX_ARRAY_LENGTH, length2 = nativeMin2(n2, MAX_ARRAY_LENGTH);
        iteratee2 = getIteratee(iteratee2);
        n2 -= MAX_ARRAY_LENGTH;
        var result2 = baseTimes2(length2, iteratee2);
        while (++index2 < n2) {
          iteratee2(index2);
        }
        return result2;
      }
      function toPath(value2) {
        if (isArray3(value2)) {
          return arrayMap2(value2, toKey2);
        }
        return isSymbol2(value2) ? [value2] : copyArray2(stringToPath2(toString4(value2)));
      }
      function uniqueId2(prefix) {
        var id2 = ++idCounter2;
        return toString4(prefix) + id2;
      }
      var add2 = createMathOperation(function(augend, addend) {
        return augend + addend;
      }, 0);
      var ceil = createRound("ceil");
      var divide = createMathOperation(function(dividend, divisor) {
        return dividend / divisor;
      }, 1);
      var floor = createRound("floor");
      function max2(array4) {
        return array4 && array4.length ? baseExtremum(array4, identity2, baseGt) : undefined$1;
      }
      function maxBy(array4, iteratee2) {
        return array4 && array4.length ? baseExtremum(array4, getIteratee(iteratee2, 2), baseGt) : undefined$1;
      }
      function mean(array4) {
        return baseMean(array4, identity2);
      }
      function meanBy(array4, iteratee2) {
        return baseMean(array4, getIteratee(iteratee2, 2));
      }
      function min2(array4) {
        return array4 && array4.length ? baseExtremum(array4, identity2, baseLt) : undefined$1;
      }
      function minBy(array4, iteratee2) {
        return array4 && array4.length ? baseExtremum(array4, getIteratee(iteratee2, 2), baseLt) : undefined$1;
      }
      var multiply = createMathOperation(function(multiplier, multiplicand) {
        return multiplier * multiplicand;
      }, 1);
      var round2 = createRound("round");
      var subtract2 = createMathOperation(function(minuend, subtrahend) {
        return minuend - subtrahend;
      }, 0);
      function sum(array4) {
        return array4 && array4.length ? baseSum(array4, identity2) : 0;
      }
      function sumBy(array4, iteratee2) {
        return array4 && array4.length ? baseSum(array4, getIteratee(iteratee2, 2)) : 0;
      }
      lodash2.after = after;
      lodash2.ary = ary;
      lodash2.assign = assign;
      lodash2.assignIn = assignIn;
      lodash2.assignInWith = assignInWith;
      lodash2.assignWith = assignWith;
      lodash2.at = at;
      lodash2.before = before;
      lodash2.bind = bind2;
      lodash2.bindAll = bindAll;
      lodash2.bindKey = bindKey;
      lodash2.castArray = castArray;
      lodash2.chain = chain2;
      lodash2.chunk = chunk;
      lodash2.compact = compact;
      lodash2.concat = concat;
      lodash2.cond = cond;
      lodash2.conforms = conforms;
      lodash2.constant = constant2;
      lodash2.countBy = countBy;
      lodash2.create = create2;
      lodash2.curry = curry;
      lodash2.curryRight = curryRight;
      lodash2.debounce = debounce2;
      lodash2.defaults = defaults2;
      lodash2.defaultsDeep = defaultsDeep;
      lodash2.defer = defer2;
      lodash2.delay = delay2;
      lodash2.difference = difference;
      lodash2.differenceBy = differenceBy;
      lodash2.differenceWith = differenceWith;
      lodash2.drop = drop;
      lodash2.dropRight = dropRight;
      lodash2.dropRightWhile = dropRightWhile;
      lodash2.dropWhile = dropWhile;
      lodash2.fill = fill;
      lodash2.filter = filter3;
      lodash2.flatMap = flatMap;
      lodash2.flatMapDeep = flatMapDeep;
      lodash2.flatMapDepth = flatMapDepth;
      lodash2.flatten = flatten;
      lodash2.flattenDeep = flattenDeep;
      lodash2.flattenDepth = flattenDepth;
      lodash2.flip = flip2;
      lodash2.flow = flow2;
      lodash2.flowRight = flowRight;
      lodash2.fromPairs = fromPairs;
      lodash2.functions = functions;
      lodash2.functionsIn = functionsIn;
      lodash2.groupBy = groupBy;
      lodash2.initial = initial;
      lodash2.intersection = intersection;
      lodash2.intersectionBy = intersectionBy;
      lodash2.intersectionWith = intersectionWith;
      lodash2.invert = invert;
      lodash2.invertBy = invertBy;
      lodash2.invokeMap = invokeMap;
      lodash2.iteratee = iteratee;
      lodash2.keyBy = keyBy;
      lodash2.keys = keys2;
      lodash2.keysIn = keysIn2;
      lodash2.map = map2;
      lodash2.mapKeys = mapKeys;
      lodash2.mapValues = mapValues;
      lodash2.matches = matches;
      lodash2.matchesProperty = matchesProperty;
      lodash2.memoize = memoize2;
      lodash2.merge = merge2;
      lodash2.mergeWith = mergeWith;
      lodash2.method = method4;
      lodash2.methodOf = methodOf;
      lodash2.mixin = mixin;
      lodash2.negate = negate;
      lodash2.nthArg = nthArg;
      lodash2.omit = omit2;
      lodash2.omitBy = omitBy;
      lodash2.once = once;
      lodash2.orderBy = orderBy;
      lodash2.over = over;
      lodash2.overArgs = overArgs;
      lodash2.overEvery = overEvery;
      lodash2.overSome = overSome;
      lodash2.partial = partial;
      lodash2.partialRight = partialRight;
      lodash2.partition = partition;
      lodash2.pick = pick3;
      lodash2.pickBy = pickBy2;
      lodash2.property = property2;
      lodash2.propertyOf = propertyOf;
      lodash2.pull = pull;
      lodash2.pullAll = pullAll;
      lodash2.pullAllBy = pullAllBy;
      lodash2.pullAllWith = pullAllWith;
      lodash2.pullAt = pullAt;
      lodash2.range = range3;
      lodash2.rangeRight = rangeRight;
      lodash2.rearg = rearg;
      lodash2.reject = reject;
      lodash2.remove = remove;
      lodash2.rest = rest;
      lodash2.reverse = reverse;
      lodash2.sampleSize = sampleSize;
      lodash2.set = set2;
      lodash2.setWith = setWith;
      lodash2.shuffle = shuffle;
      lodash2.slice = slice2;
      lodash2.sortBy = sortBy;
      lodash2.sortedUniq = sortedUniq;
      lodash2.sortedUniqBy = sortedUniqBy;
      lodash2.split = split2;
      lodash2.spread = spread2;
      lodash2.tail = tail;
      lodash2.take = take;
      lodash2.takeRight = takeRight;
      lodash2.takeRightWhile = takeRightWhile;
      lodash2.takeWhile = takeWhile;
      lodash2.tap = tap;
      lodash2.throttle = throttle2;
      lodash2.thru = thru;
      lodash2.toArray = toArray2;
      lodash2.toPairs = toPairs;
      lodash2.toPairsIn = toPairsIn;
      lodash2.toPath = toPath;
      lodash2.toPlainObject = toPlainObject2;
      lodash2.transform = transform2;
      lodash2.unary = unary;
      lodash2.union = union;
      lodash2.unionBy = unionBy;
      lodash2.unionWith = unionWith;
      lodash2.uniq = uniq;
      lodash2.uniqBy = uniqBy;
      lodash2.uniqWith = uniqWith;
      lodash2.unset = unset;
      lodash2.unzip = unzip;
      lodash2.unzipWith = unzipWith;
      lodash2.update = update;
      lodash2.updateWith = updateWith;
      lodash2.values = values;
      lodash2.valuesIn = valuesIn;
      lodash2.without = without;
      lodash2.words = words;
      lodash2.wrap = wrap2;
      lodash2.xor = xor;
      lodash2.xorBy = xorBy;
      lodash2.xorWith = xorWith;
      lodash2.zip = zip;
      lodash2.zipObject = zipObject;
      lodash2.zipObjectDeep = zipObjectDeep;
      lodash2.zipWith = zipWith;
      lodash2.entries = toPairs;
      lodash2.entriesIn = toPairsIn;
      lodash2.extend = assignIn;
      lodash2.extendWith = assignInWith;
      mixin(lodash2, lodash2);
      lodash2.add = add2;
      lodash2.attempt = attempt;
      lodash2.camelCase = camelCase2;
      lodash2.capitalize = capitalize2;
      lodash2.ceil = ceil;
      lodash2.clamp = clamp2;
      lodash2.clone = clone3;
      lodash2.cloneDeep = cloneDeep2;
      lodash2.cloneDeepWith = cloneDeepWith;
      lodash2.cloneWith = cloneWith;
      lodash2.conformsTo = conformsTo;
      lodash2.deburr = deburr;
      lodash2.defaultTo = defaultTo;
      lodash2.divide = divide;
      lodash2.endsWith = endsWith2;
      lodash2.eq = eq2;
      lodash2.escape = escape2;
      lodash2.escapeRegExp = escapeRegExp;
      lodash2.every = every;
      lodash2.find = find2;
      lodash2.findIndex = findIndex;
      lodash2.findKey = findKey2;
      lodash2.findLast = findLast;
      lodash2.findLastIndex = findLastIndex;
      lodash2.findLastKey = findLastKey;
      lodash2.floor = floor;
      lodash2.forEach = forEach2;
      lodash2.forEachRight = forEachRight;
      lodash2.forIn = forIn;
      lodash2.forInRight = forInRight;
      lodash2.forOwn = forOwn2;
      lodash2.forOwnRight = forOwnRight;
      lodash2.get = get5;
      lodash2.gt = gt;
      lodash2.gte = gte;
      lodash2.has = has2;
      lodash2.hasIn = hasIn2;
      lodash2.head = head;
      lodash2.identity = identity2;
      lodash2.includes = includes;
      lodash2.indexOf = indexOf2;
      lodash2.inRange = inRange2;
      lodash2.invoke = invoke;
      lodash2.isArguments = isArguments2;
      lodash2.isArray = isArray3;
      lodash2.isArrayBuffer = isArrayBuffer2;
      lodash2.isArrayLike = isArrayLike2;
      lodash2.isArrayLikeObject = isArrayLikeObject2;
      lodash2.isBoolean = isBoolean2;
      lodash2.isBuffer = isBuffer2;
      lodash2.isDate = isDate2;
      lodash2.isElement = isElement;
      lodash2.isEmpty = isEmpty2;
      lodash2.isEqual = isEqual2;
      lodash2.isEqualWith = isEqualWith;
      lodash2.isError = isError;
      lodash2.isFinite = isFinite2;
      lodash2.isFunction = isFunction2;
      lodash2.isInteger = isInteger2;
      lodash2.isLength = isLength2;
      lodash2.isMap = isMap2;
      lodash2.isMatch = isMatch;
      lodash2.isMatchWith = isMatchWith;
      lodash2.isNaN = isNaN2;
      lodash2.isNative = isNative;
      lodash2.isNil = isNil;
      lodash2.isNull = isNull;
      lodash2.isNumber = isNumber2;
      lodash2.isObject = isObject2;
      lodash2.isObjectLike = isObjectLike2;
      lodash2.isPlainObject = isPlainObject3;
      lodash2.isRegExp = isRegExp2;
      lodash2.isSafeInteger = isSafeInteger;
      lodash2.isSet = isSet2;
      lodash2.isString = isString2;
      lodash2.isSymbol = isSymbol2;
      lodash2.isTypedArray = isTypedArray2;
      lodash2.isUndefined = isUndefined2;
      lodash2.isWeakMap = isWeakMap;
      lodash2.isWeakSet = isWeakSet;
      lodash2.join = join2;
      lodash2.kebabCase = kebabCase;
      lodash2.last = last;
      lodash2.lastIndexOf = lastIndexOf;
      lodash2.lowerCase = lowerCase;
      lodash2.lowerFirst = lowerFirst;
      lodash2.lt = lt;
      lodash2.lte = lte;
      lodash2.max = max2;
      lodash2.maxBy = maxBy;
      lodash2.mean = mean;
      lodash2.meanBy = meanBy;
      lodash2.min = min2;
      lodash2.minBy = minBy;
      lodash2.stubArray = stubArray2;
      lodash2.stubFalse = stubFalse2;
      lodash2.stubObject = stubObject;
      lodash2.stubString = stubString;
      lodash2.stubTrue = stubTrue;
      lodash2.multiply = multiply;
      lodash2.nth = nth;
      lodash2.noConflict = noConflict;
      lodash2.noop = noop4;
      lodash2.now = now2;
      lodash2.pad = pad;
      lodash2.padEnd = padEnd;
      lodash2.padStart = padStart;
      lodash2.parseInt = parseInt2;
      lodash2.random = random;
      lodash2.reduce = reduce;
      lodash2.reduceRight = reduceRight;
      lodash2.repeat = repeat;
      lodash2.replace = replace2;
      lodash2.result = result;
      lodash2.round = round2;
      lodash2.runInContext = runInContext2;
      lodash2.sample = sample2;
      lodash2.size = size2;
      lodash2.snakeCase = snakeCase;
      lodash2.some = some2;
      lodash2.sortedIndex = sortedIndex;
      lodash2.sortedIndexBy = sortedIndexBy;
      lodash2.sortedIndexOf = sortedIndexOf;
      lodash2.sortedLastIndex = sortedLastIndex;
      lodash2.sortedLastIndexBy = sortedLastIndexBy;
      lodash2.sortedLastIndexOf = sortedLastIndexOf;
      lodash2.startCase = startCase;
      lodash2.startsWith = startsWith;
      lodash2.subtract = subtract2;
      lodash2.sum = sum;
      lodash2.sumBy = sumBy;
      lodash2.template = template2;
      lodash2.times = times;
      lodash2.toFinite = toFinite;
      lodash2.toInteger = toInteger;
      lodash2.toLength = toLength;
      lodash2.toLower = toLower;
      lodash2.toNumber = toNumber2;
      lodash2.toSafeInteger = toSafeInteger;
      lodash2.toString = toString4;
      lodash2.toUpper = toUpper;
      lodash2.trim = trim2;
      lodash2.trimEnd = trimEnd;
      lodash2.trimStart = trimStart;
      lodash2.truncate = truncate;
      lodash2.unescape = unescape3;
      lodash2.uniqueId = uniqueId2;
      lodash2.upperCase = upperCase;
      lodash2.upperFirst = upperFirst;
      lodash2.each = forEach2;
      lodash2.eachRight = forEachRight;
      lodash2.first = head;
      mixin(lodash2, function() {
        var source2 = {};
        baseForOwn2(lodash2, function(func, methodName) {
          if (!hasOwnProperty2.call(lodash2.prototype, methodName)) {
            source2[methodName] = func;
          }
        });
        return source2;
      }(), { "chain": false });
      lodash2.VERSION = VERSION2;
      arrayEach2(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
        lodash2[methodName].placeholder = lodash2;
      });
      arrayEach2(["drop", "take"], function(methodName, index2) {
        LazyWrapper.prototype[methodName] = function(n2) {
          n2 = n2 === undefined$1 ? 1 : nativeMax2(toInteger(n2), 0);
          var result2 = this.__filtered__ && !index2 ? new LazyWrapper(this) : this.clone();
          if (result2.__filtered__) {
            result2.__takeCount__ = nativeMin2(n2, result2.__takeCount__);
          } else {
            result2.__views__.push({
              "size": nativeMin2(n2, MAX_ARRAY_LENGTH),
              "type": methodName + (result2.__dir__ < 0 ? "Right" : "")
            });
          }
          return result2;
        };
        LazyWrapper.prototype[methodName + "Right"] = function(n2) {
          return this.reverse()[methodName](n2).reverse();
        };
      });
      arrayEach2(["filter", "map", "takeWhile"], function(methodName, index2) {
        var type4 = index2 + 1, isFilter = type4 == LAZY_FILTER_FLAG || type4 == LAZY_WHILE_FLAG;
        LazyWrapper.prototype[methodName] = function(iteratee2) {
          var result2 = this.clone();
          result2.__iteratees__.push({
            "iteratee": getIteratee(iteratee2, 3),
            "type": type4
          });
          result2.__filtered__ = result2.__filtered__ || isFilter;
          return result2;
        };
      });
      arrayEach2(["head", "last"], function(methodName, index2) {
        var takeName = "take" + (index2 ? "Right" : "");
        LazyWrapper.prototype[methodName] = function() {
          return this[takeName](1).value()[0];
        };
      });
      arrayEach2(["initial", "tail"], function(methodName, index2) {
        var dropName = "drop" + (index2 ? "" : "Right");
        LazyWrapper.prototype[methodName] = function() {
          return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
        };
      });
      LazyWrapper.prototype.compact = function() {
        return this.filter(identity2);
      };
      LazyWrapper.prototype.find = function(predicate) {
        return this.filter(predicate).head();
      };
      LazyWrapper.prototype.findLast = function(predicate) {
        return this.reverse().find(predicate);
      };
      LazyWrapper.prototype.invokeMap = baseRest2(function(path, args) {
        if (typeof path == "function") {
          return new LazyWrapper(this);
        }
        return this.map(function(value2) {
          return baseInvoke(value2, path, args);
        });
      });
      LazyWrapper.prototype.reject = function(predicate) {
        return this.filter(negate(getIteratee(predicate)));
      };
      LazyWrapper.prototype.slice = function(start2, end2) {
        start2 = toInteger(start2);
        var result2 = this;
        if (result2.__filtered__ && (start2 > 0 || end2 < 0)) {
          return new LazyWrapper(result2);
        }
        if (start2 < 0) {
          result2 = result2.takeRight(-start2);
        } else if (start2) {
          result2 = result2.drop(start2);
        }
        if (end2 !== undefined$1) {
          end2 = toInteger(end2);
          result2 = end2 < 0 ? result2.dropRight(-end2) : result2.take(end2 - start2);
        }
        return result2;
      };
      LazyWrapper.prototype.takeRightWhile = function(predicate) {
        return this.reverse().takeWhile(predicate).reverse();
      };
      LazyWrapper.prototype.toArray = function() {
        return this.take(MAX_ARRAY_LENGTH);
      };
      baseForOwn2(LazyWrapper.prototype, function(func, methodName) {
        var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash2[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName);
        if (!lodashFunc) {
          return;
        }
        lodash2.prototype[methodName] = function() {
          var value2 = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value2 instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray3(value2);
          var interceptor = function(value3) {
            var result3 = lodashFunc.apply(lodash2, arrayPush2([value3], args));
            return isTaker && chainAll ? result3[0] : result3;
          };
          if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
            isLazy = useLazy = false;
          }
          var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
          if (!retUnwrapped && useLazy) {
            value2 = onlyLazy ? value2 : new LazyWrapper(this);
            var result2 = func.apply(value2, args);
            result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined$1 });
            return new LodashWrapper(result2, chainAll);
          }
          if (isUnwrapped && onlyLazy) {
            return func.apply(this, args);
          }
          result2 = this.thru(interceptor);
          return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
        };
      });
      arrayEach2(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
        var func = arrayProto2[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
        lodash2.prototype[methodName] = function() {
          var args = arguments;
          if (retUnwrapped && !this.__chain__) {
            var value2 = this.value();
            return func.apply(isArray3(value2) ? value2 : [], args);
          }
          return this[chainName](function(value3) {
            return func.apply(isArray3(value3) ? value3 : [], args);
          });
        };
      });
      baseForOwn2(LazyWrapper.prototype, function(func, methodName) {
        var lodashFunc = lodash2[methodName];
        if (lodashFunc) {
          var key = lodashFunc.name + "";
          if (!hasOwnProperty2.call(realNames, key)) {
            realNames[key] = [];
          }
          realNames[key].push({ "name": methodName, "func": lodashFunc });
        }
      });
      realNames[createHybrid(undefined$1, WRAP_BIND_KEY_FLAG).name] = [{
        "name": "wrapper",
        "func": undefined$1
      }];
      LazyWrapper.prototype.clone = lazyClone;
      LazyWrapper.prototype.reverse = lazyReverse;
      LazyWrapper.prototype.value = lazyValue;
      lodash2.prototype.at = wrapperAt;
      lodash2.prototype.chain = wrapperChain;
      lodash2.prototype.commit = wrapperCommit;
      lodash2.prototype.next = wrapperNext;
      lodash2.prototype.plant = wrapperPlant;
      lodash2.prototype.reverse = wrapperReverse;
      lodash2.prototype.toJSON = lodash2.prototype.valueOf = lodash2.prototype.value = wrapperValue;
      lodash2.prototype.first = lodash2.prototype.head;
      if (symIterator) {
        lodash2.prototype[symIterator] = wrapperToIterator;
      }
      return lodash2;
    };
    var _24 = runInContext();
    if (freeModule2) {
      (freeModule2.exports = _24)._ = _24;
      freeExports2._ = _24;
    } else {
      root2._ = _24;
    }
  }).call(commonjsGlobal);
})(lodash, lodash.exports);
var lodashExports = lodash.exports;
const _$2 = /* @__PURE__ */ getDefaultExportFromCjs(lodashExports);
const Modal = (props) => {
  var _a2;
  const { t: t2 } = useTranslation();
  const [visible, setVisible] = reactExports.useState(props.defaultVisible ?? props.visible);
  const [size2, setSize] = reactExports.useState();
  const [okLoading, setOkLoading] = reactExports.useState(false);
  const domRef = reactExports.useRef(null);
  const isOpen = props.visible != void 0 ? props.visible : visible;
  const autoFocused = reactExports.useRef(false);
  reactExports.useEffect(() => {
  }, []);
  reactExports.useEffect(() => {
    switch (props.size) {
      case "sm":
        setSize("sm");
        break;
      case "md":
        setSize("lg");
        break;
      case "lg":
        setSize("2xl");
        break;
      case "xl":
        setSize("5xl");
        break;
      case "full":
        setSize("full");
        break;
      default:
        setSize(void 0);
    }
  }, [props.size]);
  const onClose = () => {
    var _a3;
    setVisible(false);
    (_a3 = props.onClose) == null ? void 0 : _a3.call(props);
  };
  const renderFooter = () => {
    var _a3;
    if (props.footer === false) {
      return null;
    }
    const simpleFooter = props.footer === void 0 || props.footer === true ? {
      actions: ["ok", "cancel"]
    } : ((_a3 = props.footer) == null ? void 0 : _a3["actions"]) ? props.footer : void 0;
    if (simpleFooter == void 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(modal_footer_default, { children: props.footer });
    }
    const elements = [];
    if (simpleFooter.actions.includes("cancel")) {
      const { children, ref, ...otherProps } = simpleFooter.cancelProps || {};
      elements.push(
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            ref,
            color: "danger",
            variant: "light",
            onPress: otherProps.onPress ?? onClose,
            ...otherProps,
            children: children ?? t2("Close")
          },
          "cancel"
        )
      );
    }
    if (simpleFooter.actions.includes("ok")) {
      const { children, ref, autoFocus, ...otherProps } = {
        ...simpleFooter.okProps,
        ...props.okProps
      };
      elements.push(
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            ref: (r2) => {
              if (typeof ref === "function") {
                ref(r2);
              } else {
                if (ref && typeof ref === "object" && "current" in ref) {
                  ref.current = r2;
                }
              }
              if (r2 && !autoFocused.current && autoFocus) {
                autoFocused.current = true;
                r2.focus();
              }
            },
            color: "primary",
            isLoading: okLoading,
            onPress: async (e2) => {
              var _a4;
              const r2 = (_a4 = props.onOk ?? otherProps.onPress) == null ? void 0 : _a4(e2);
              if (r2 instanceof Promise) {
                setOkLoading(true);
                try {
                  await r2;
                  onClose();
                } catch (e22) {
                  toast.danger(t2("An error occurred:") + (e22 == null ? void 0 : e22.message));
                  console.error(e22);
                } finally {
                  setOkLoading(false);
                }
              } else {
                onClose();
              }
            },
            ...otherProps,
            children: children ?? t2("Confirm")
          },
          "ok"
        )
      );
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(modal_footer_default, { children: elements });
  };
  const classNames2 = _$2.merge({}, props.classNames);
  if (props.size == "2xl") {
    const propsBaseClassName = ((_a2 = props.classNames) == null ? void 0 : _a2["base"]) ?? "";
    classNames2["base"] = propsBaseClassName ? `max-w-[80vw] ${propsBaseClassName}` : "max-w-[80vw]";
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    modal_default,
    {
      ref: (r2) => {
        var _a3;
        if (domRef.current && !r2 && !isOpen) {
          (_a3 = props.onDestroyed) == null ? void 0 : _a3.call(props);
        }
        domRef.current = r2;
      },
      className: props.className,
      classNames: classNames2,
      size: size2,
      style: props.style,
      isOpen,
      onClose,
      scrollBehavior: "inside",
      isKeyboardDismissDisabled: props.isKeyboardDismissDisabled ?? true,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs(modal_content_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(modal_header_default, { className: "flex flex-col gap-1", children: props.title }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(modal_body_default, { children: props.children }),
        renderFooter()
      ] })
    }
  );
};
const PopoverComponent = reactExports.forwardRef(
  ({ trigger, children, visible, closeMode = ["esc", "mask"], ...otherProps }, ref) => {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      popover_default,
      {
        isOpen: visible,
        shouldCloseOnBlur: closeMode == null ? void 0 : closeMode.includes("esc"),
        shouldCloseOnInteractOutside: () => (closeMode == null ? void 0 : closeMode.includes("mask")) == true,
        ...otherProps,
        ref,
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(popover_trigger_default, { children: trigger }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(popover_content_default, { children })
        ]
      }
    );
  }
);
PopoverComponent.displayName = "Popover";
var lib$1 = {};
var flattenNames$1 = {};
var freeGlobal$3 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
var _freeGlobal = freeGlobal$3;
var freeGlobal$2 = _freeGlobal;
var freeSelf$2 = typeof self == "object" && self && self.Object === Object && self;
var root$d = freeGlobal$2 || freeSelf$2 || Function("return this")();
var _root = root$d;
var root$c = _root;
var Symbol$8 = root$c.Symbol;
var _Symbol = Symbol$8;
var Symbol$7 = _Symbol;
var objectProto$v = Object.prototype;
var hasOwnProperty$r = objectProto$v.hasOwnProperty;
var nativeObjectToString$3 = objectProto$v.toString;
var symToStringTag$3 = Symbol$7 ? Symbol$7.toStringTag : void 0;
function getRawTag$2(value2) {
  var isOwn = hasOwnProperty$r.call(value2, symToStringTag$3), tag = value2[symToStringTag$3];
  try {
    value2[symToStringTag$3] = void 0;
    var unmasked = true;
  } catch (e2) {
  }
  var result = nativeObjectToString$3.call(value2);
  if (unmasked) {
    if (isOwn) {
      value2[symToStringTag$3] = tag;
    } else {
      delete value2[symToStringTag$3];
    }
  }
  return result;
}
var _getRawTag = getRawTag$2;
var objectProto$u = Object.prototype;
var nativeObjectToString$2 = objectProto$u.toString;
function objectToString$3(value2) {
  return nativeObjectToString$2.call(value2);
}
var _objectToString = objectToString$3;
var Symbol$6 = _Symbol, getRawTag$1 = _getRawTag, objectToString$2 = _objectToString;
var nullTag$1 = "[object Null]", undefinedTag$1 = "[object Undefined]";
var symToStringTag$2 = Symbol$6 ? Symbol$6.toStringTag : void 0;
function baseGetTag$8(value2) {
  if (value2 == null) {
    return value2 === void 0 ? undefinedTag$1 : nullTag$1;
  }
  return symToStringTag$2 && symToStringTag$2 in Object(value2) ? getRawTag$1(value2) : objectToString$2(value2);
}
var _baseGetTag = baseGetTag$8;
var isArray$i = Array.isArray;
var isArray_1 = isArray$i;
function isObjectLike$b(value2) {
  return value2 != null && typeof value2 == "object";
}
var isObjectLike_1 = isObjectLike$b;
var baseGetTag$7 = _baseGetTag, isArray$h = isArray_1, isObjectLike$a = isObjectLike_1;
var stringTag$6 = "[object String]";
function isString$3(value2) {
  return typeof value2 == "string" || !isArray$h(value2) && isObjectLike$a(value2) && baseGetTag$7(value2) == stringTag$6;
}
var isString_1 = isString$3;
function createBaseFor$2(fromRight) {
  return function(object4, iteratee, keysFunc) {
    var index2 = -1, iterable = Object(object4), props = keysFunc(object4), length2 = props.length;
    while (length2--) {
      var key = props[fromRight ? length2 : ++index2];
      if (iteratee(iterable[key], key, iterable) === false) {
        break;
      }
    }
    return object4;
  };
}
var _createBaseFor = createBaseFor$2;
var createBaseFor$1 = _createBaseFor;
var baseFor$2 = createBaseFor$1();
var _baseFor = baseFor$2;
function baseTimes$2(n2, iteratee) {
  var index2 = -1, result = Array(n2);
  while (++index2 < n2) {
    result[index2] = iteratee(index2);
  }
  return result;
}
var _baseTimes = baseTimes$2;
var baseGetTag$6 = _baseGetTag, isObjectLike$9 = isObjectLike_1;
var argsTag$6 = "[object Arguments]";
function baseIsArguments$2(value2) {
  return isObjectLike$9(value2) && baseGetTag$6(value2) == argsTag$6;
}
var _baseIsArguments = baseIsArguments$2;
var baseIsArguments$1 = _baseIsArguments, isObjectLike$8 = isObjectLike_1;
var objectProto$t = Object.prototype;
var hasOwnProperty$q = objectProto$t.hasOwnProperty;
var propertyIsEnumerable$3 = objectProto$t.propertyIsEnumerable;
var isArguments$3 = baseIsArguments$1(/* @__PURE__ */ function() {
  return arguments;
}()) ? baseIsArguments$1 : function(value2) {
  return isObjectLike$8(value2) && hasOwnProperty$q.call(value2, "callee") && !propertyIsEnumerable$3.call(value2, "callee");
};
var isArguments_1 = isArguments$3;
var isBuffer$5 = { exports: {} };
function stubFalse$1() {
  return false;
}
var stubFalse_1 = stubFalse$1;
isBuffer$5.exports;
(function(module2, exports2) {
  var root2 = _root, stubFalse2 = stubFalse_1;
  var freeExports2 = exports2 && !exports2.nodeType && exports2;
  var freeModule2 = freeExports2 && true && module2 && !module2.nodeType && module2;
  var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
  var Buffer2 = moduleExports2 ? root2.Buffer : void 0;
  var nativeIsBuffer2 = Buffer2 ? Buffer2.isBuffer : void 0;
  var isBuffer2 = nativeIsBuffer2 || stubFalse2;
  module2.exports = isBuffer2;
})(isBuffer$5, isBuffer$5.exports);
var isBufferExports = isBuffer$5.exports;
var MAX_SAFE_INTEGER$3 = 9007199254740991;
var reIsUint$1 = /^(?:0|[1-9]\d*)$/;
function isIndex$3(value2, length2) {
  var type4 = typeof value2;
  length2 = length2 == null ? MAX_SAFE_INTEGER$3 : length2;
  return !!length2 && (type4 == "number" || type4 != "symbol" && reIsUint$1.test(value2)) && (value2 > -1 && value2 % 1 == 0 && value2 < length2);
}
var _isIndex = isIndex$3;
var MAX_SAFE_INTEGER$2 = 9007199254740991;
function isLength$4(value2) {
  return typeof value2 == "number" && value2 > -1 && value2 % 1 == 0 && value2 <= MAX_SAFE_INTEGER$2;
}
var isLength_1 = isLength$4;
var baseGetTag$5 = _baseGetTag, isLength$3 = isLength_1, isObjectLike$7 = isObjectLike_1;
var argsTag$5 = "[object Arguments]", arrayTag$4 = "[object Array]", boolTag$5 = "[object Boolean]", dateTag$5 = "[object Date]", errorTag$4 = "[object Error]", funcTag$5 = "[object Function]", mapTag$8 = "[object Map]", numberTag$5 = "[object Number]", objectTag$8 = "[object Object]", regexpTag$5 = "[object RegExp]", setTag$8 = "[object Set]", stringTag$5 = "[object String]", weakMapTag$4 = "[object WeakMap]";
var arrayBufferTag$5 = "[object ArrayBuffer]", dataViewTag$7 = "[object DataView]", float32Tag$3 = "[object Float32Array]", float64Tag$3 = "[object Float64Array]", int8Tag$3 = "[object Int8Array]", int16Tag$3 = "[object Int16Array]", int32Tag$3 = "[object Int32Array]", uint8Tag$3 = "[object Uint8Array]", uint8ClampedTag$3 = "[object Uint8ClampedArray]", uint16Tag$3 = "[object Uint16Array]", uint32Tag$3 = "[object Uint32Array]";
var typedArrayTags$1 = {};
typedArrayTags$1[float32Tag$3] = typedArrayTags$1[float64Tag$3] = typedArrayTags$1[int8Tag$3] = typedArrayTags$1[int16Tag$3] = typedArrayTags$1[int32Tag$3] = typedArrayTags$1[uint8Tag$3] = typedArrayTags$1[uint8ClampedTag$3] = typedArrayTags$1[uint16Tag$3] = typedArrayTags$1[uint32Tag$3] = true;
typedArrayTags$1[argsTag$5] = typedArrayTags$1[arrayTag$4] = typedArrayTags$1[arrayBufferTag$5] = typedArrayTags$1[boolTag$5] = typedArrayTags$1[dataViewTag$7] = typedArrayTags$1[dateTag$5] = typedArrayTags$1[errorTag$4] = typedArrayTags$1[funcTag$5] = typedArrayTags$1[mapTag$8] = typedArrayTags$1[numberTag$5] = typedArrayTags$1[objectTag$8] = typedArrayTags$1[regexpTag$5] = typedArrayTags$1[setTag$8] = typedArrayTags$1[stringTag$5] = typedArrayTags$1[weakMapTag$4] = false;
function baseIsTypedArray$2(value2) {
  return isObjectLike$7(value2) && isLength$3(value2.length) && !!typedArrayTags$1[baseGetTag$5(value2)];
}
var _baseIsTypedArray = baseIsTypedArray$2;
function baseUnary$4(func) {
  return function(value2) {
    return func(value2);
  };
}
var _baseUnary = baseUnary$4;
var _nodeUtil = { exports: {} };
_nodeUtil.exports;
(function(module2, exports2) {
  var freeGlobal2 = _freeGlobal;
  var freeExports2 = exports2 && !exports2.nodeType && exports2;
  var freeModule2 = freeExports2 && true && module2 && !module2.nodeType && module2;
  var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
  var freeProcess2 = moduleExports2 && freeGlobal2.process;
  var nodeUtil2 = function() {
    try {
      var types2 = freeModule2 && freeModule2.require && freeModule2.require("util").types;
      if (types2) {
        return types2;
      }
      return freeProcess2 && freeProcess2.binding && freeProcess2.binding("util");
    } catch (e2) {
    }
  }();
  module2.exports = nodeUtil2;
})(_nodeUtil, _nodeUtil.exports);
var _nodeUtilExports = _nodeUtil.exports;
var baseIsTypedArray$1 = _baseIsTypedArray, baseUnary$3 = _baseUnary, nodeUtil$3 = _nodeUtilExports;
var nodeIsTypedArray$1 = nodeUtil$3 && nodeUtil$3.isTypedArray;
var isTypedArray$4 = nodeIsTypedArray$1 ? baseUnary$3(nodeIsTypedArray$1) : baseIsTypedArray$1;
var isTypedArray_1 = isTypedArray$4;
var baseTimes$1 = _baseTimes, isArguments$2 = isArguments_1, isArray$g = isArray_1, isBuffer$4 = isBufferExports, isIndex$2 = _isIndex, isTypedArray$3 = isTypedArray_1;
var objectProto$s = Object.prototype;
var hasOwnProperty$p = objectProto$s.hasOwnProperty;
function arrayLikeKeys$3(value2, inherited) {
  var isArr = isArray$g(value2), isArg = !isArr && isArguments$2(value2), isBuff = !isArr && !isArg && isBuffer$4(value2), isType = !isArr && !isArg && !isBuff && isTypedArray$3(value2), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes$1(value2.length, String) : [], length2 = result.length;
  for (var key in value2) {
    if ((inherited || hasOwnProperty$p.call(value2, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
    (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
    isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
    isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
    isIndex$2(key, length2)))) {
      result.push(key);
    }
  }
  return result;
}
var _arrayLikeKeys = arrayLikeKeys$3;
var objectProto$r = Object.prototype;
function isPrototype$4(value2) {
  var Ctor = value2 && value2.constructor, proto2 = typeof Ctor == "function" && Ctor.prototype || objectProto$r;
  return value2 === proto2;
}
var _isPrototype = isPrototype$4;
function overArg$3(func, transform2) {
  return function(arg) {
    return func(transform2(arg));
  };
}
var _overArg = overArg$3;
var overArg$2 = _overArg;
var nativeKeys$2 = overArg$2(Object.keys, Object);
var _nativeKeys = nativeKeys$2;
var isPrototype$3 = _isPrototype, nativeKeys$1 = _nativeKeys;
var objectProto$q = Object.prototype;
var hasOwnProperty$o = objectProto$q.hasOwnProperty;
function baseKeys$2(object4) {
  if (!isPrototype$3(object4)) {
    return nativeKeys$1(object4);
  }
  var result = [];
  for (var key in Object(object4)) {
    if (hasOwnProperty$o.call(object4, key) && key != "constructor") {
      result.push(key);
    }
  }
  return result;
}
var _baseKeys = baseKeys$2;
function isObject$b(value2) {
  var type4 = typeof value2;
  return value2 != null && (type4 == "object" || type4 == "function");
}
var isObject_1 = isObject$b;
var baseGetTag$4 = _baseGetTag, isObject$a = isObject_1;
var asyncTag$1 = "[object AsyncFunction]", funcTag$4 = "[object Function]", genTag$3 = "[object GeneratorFunction]", proxyTag$1 = "[object Proxy]";
function isFunction$7(value2) {
  if (!isObject$a(value2)) {
    return false;
  }
  var tag = baseGetTag$4(value2);
  return tag == funcTag$4 || tag == genTag$3 || tag == asyncTag$1 || tag == proxyTag$1;
}
var isFunction_1 = isFunction$7;
var isFunction$6 = isFunction_1, isLength$2 = isLength_1;
function isArrayLike$5(value2) {
  return value2 != null && isLength$2(value2.length) && !isFunction$6(value2);
}
var isArrayLike_1 = isArrayLike$5;
var arrayLikeKeys$2 = _arrayLikeKeys, baseKeys$1 = _baseKeys, isArrayLike$4 = isArrayLike_1;
function keys$8(object4) {
  return isArrayLike$4(object4) ? arrayLikeKeys$2(object4) : baseKeys$1(object4);
}
var keys_1 = keys$8;
var baseFor$1 = _baseFor, keys$7 = keys_1;
function baseForOwn$3(object4, iteratee) {
  return object4 && baseFor$1(object4, iteratee, keys$7);
}
var _baseForOwn = baseForOwn$3;
function identity$5(value2) {
  return value2;
}
var identity_1 = identity$5;
var identity$4 = identity_1;
function castFunction$2(value2) {
  return typeof value2 == "function" ? value2 : identity$4;
}
var _castFunction = castFunction$2;
var baseForOwn$2 = _baseForOwn, castFunction$1 = _castFunction;
function forOwn(object4, iteratee) {
  return object4 && baseForOwn$2(object4, castFunction$1(iteratee));
}
var forOwn_1 = forOwn;
var overArg$1 = _overArg;
var getPrototype$4 = overArg$1(Object.getPrototypeOf, Object);
var _getPrototype = getPrototype$4;
var baseGetTag$3 = _baseGetTag, getPrototype$3 = _getPrototype, isObjectLike$6 = isObjectLike_1;
var objectTag$7 = "[object Object]";
var funcProto$6 = Function.prototype, objectProto$p = Object.prototype;
var funcToString$6 = funcProto$6.toString;
var hasOwnProperty$n = objectProto$p.hasOwnProperty;
var objectCtorString$1 = funcToString$6.call(Object);
function isPlainObject$4(value2) {
  if (!isObjectLike$6(value2) || baseGetTag$3(value2) != objectTag$7) {
    return false;
  }
  var proto2 = getPrototype$3(value2);
  if (proto2 === null) {
    return true;
  }
  var Ctor = hasOwnProperty$n.call(proto2, "constructor") && proto2.constructor;
  return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString$6.call(Ctor) == objectCtorString$1;
}
var isPlainObject_1 = isPlainObject$4;
function arrayMap$3(array4, iteratee) {
  var index2 = -1, length2 = array4 == null ? 0 : array4.length, result = Array(length2);
  while (++index2 < length2) {
    result[index2] = iteratee(array4[index2], index2, array4);
  }
  return result;
}
var _arrayMap = arrayMap$3;
function listCacheClear$3() {
  this.__data__ = [];
  this.size = 0;
}
var _listCacheClear = listCacheClear$3;
function eq$6(value2, other) {
  return value2 === other || value2 !== value2 && other !== other;
}
var eq_1 = eq$6;
var eq$5 = eq_1;
function assocIndexOf$6(array4, key) {
  var length2 = array4.length;
  while (length2--) {
    if (eq$5(array4[length2][0], key)) {
      return length2;
    }
  }
  return -1;
}
var _assocIndexOf = assocIndexOf$6;
var assocIndexOf$5 = _assocIndexOf;
var arrayProto$2 = Array.prototype;
var splice$3 = arrayProto$2.splice;
function listCacheDelete$3(key) {
  var data = this.__data__, index2 = assocIndexOf$5(data, key);
  if (index2 < 0) {
    return false;
  }
  var lastIndex = data.length - 1;
  if (index2 == lastIndex) {
    data.pop();
  } else {
    splice$3.call(data, index2, 1);
  }
  --this.size;
  return true;
}
var _listCacheDelete = listCacheDelete$3;
var assocIndexOf$4 = _assocIndexOf;
function listCacheGet$3(key) {
  var data = this.__data__, index2 = assocIndexOf$4(data, key);
  return index2 < 0 ? void 0 : data[index2][1];
}
var _listCacheGet = listCacheGet$3;
var assocIndexOf$3 = _assocIndexOf;
function listCacheHas$3(key) {
  return assocIndexOf$3(this.__data__, key) > -1;
}
var _listCacheHas = listCacheHas$3;
var assocIndexOf$2 = _assocIndexOf;
function listCacheSet$3(key, value2) {
  var data = this.__data__, index2 = assocIndexOf$2(data, key);
  if (index2 < 0) {
    ++this.size;
    data.push([key, value2]);
  } else {
    data[index2][1] = value2;
  }
  return this;
}
var _listCacheSet = listCacheSet$3;
var listCacheClear$2 = _listCacheClear, listCacheDelete$2 = _listCacheDelete, listCacheGet$2 = _listCacheGet, listCacheHas$2 = _listCacheHas, listCacheSet$2 = _listCacheSet;
function ListCache$6(entries) {
  var index2 = -1, length2 = entries == null ? 0 : entries.length;
  this.clear();
  while (++index2 < length2) {
    var entry = entries[index2];
    this.set(entry[0], entry[1]);
  }
}
ListCache$6.prototype.clear = listCacheClear$2;
ListCache$6.prototype["delete"] = listCacheDelete$2;
ListCache$6.prototype.get = listCacheGet$2;
ListCache$6.prototype.has = listCacheHas$2;
ListCache$6.prototype.set = listCacheSet$2;
var _ListCache = ListCache$6;
var ListCache$5 = _ListCache;
function stackClear$2() {
  this.__data__ = new ListCache$5();
  this.size = 0;
}
var _stackClear = stackClear$2;
function stackDelete$2(key) {
  var data = this.__data__, result = data["delete"](key);
  this.size = data.size;
  return result;
}
var _stackDelete = stackDelete$2;
function stackGet$2(key) {
  return this.__data__.get(key);
}
var _stackGet = stackGet$2;
function stackHas$2(key) {
  return this.__data__.has(key);
}
var _stackHas = stackHas$2;
var root$b = _root;
var coreJsData$3 = root$b["__core-js_shared__"];
var _coreJsData = coreJsData$3;
var coreJsData$2 = _coreJsData;
var maskSrcKey$2 = function() {
  var uid2 = /[^.]+$/.exec(coreJsData$2 && coreJsData$2.keys && coreJsData$2.keys.IE_PROTO || "");
  return uid2 ? "Symbol(src)_1." + uid2 : "";
}();
function isMasked$3(func) {
  return !!maskSrcKey$2 && maskSrcKey$2 in func;
}
var _isMasked = isMasked$3;
var funcProto$5 = Function.prototype;
var funcToString$5 = funcProto$5.toString;
function toSource$4(func) {
  if (func != null) {
    try {
      return funcToString$5.call(func);
    } catch (e2) {
    }
    try {
      return func + "";
    } catch (e2) {
    }
  }
  return "";
}
var _toSource = toSource$4;
var isFunction$5 = isFunction_1, isMasked$2 = _isMasked, isObject$9 = isObject_1, toSource$3 = _toSource;
var reRegExpChar$2 = /[\\^$.*+?()[\]{}|]/g;
var reIsHostCtor$2 = /^\[object .+?Constructor\]$/;
var funcProto$4 = Function.prototype, objectProto$o = Object.prototype;
var funcToString$4 = funcProto$4.toString;
var hasOwnProperty$m = objectProto$o.hasOwnProperty;
var reIsNative$2 = RegExp(
  "^" + funcToString$4.call(hasOwnProperty$m).replace(reRegExpChar$2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function baseIsNative$3(value2) {
  if (!isObject$9(value2) || isMasked$2(value2)) {
    return false;
  }
  var pattern4 = isFunction$5(value2) ? reIsNative$2 : reIsHostCtor$2;
  return pattern4.test(toSource$3(value2));
}
var _baseIsNative = baseIsNative$3;
function getValue$3(object4, key) {
  return object4 == null ? void 0 : object4[key];
}
var _getValue = getValue$3;
var baseIsNative$2 = _baseIsNative, getValue$2 = _getValue;
function getNative$9(object4, key) {
  var value2 = getValue$2(object4, key);
  return baseIsNative$2(value2) ? value2 : void 0;
}
var _getNative = getNative$9;
var getNative$8 = _getNative, root$a = _root;
var Map$6 = getNative$8(root$a, "Map");
var _Map = Map$6;
var getNative$7 = _getNative;
var nativeCreate$6 = getNative$7(Object, "create");
var _nativeCreate = nativeCreate$6;
var nativeCreate$5 = _nativeCreate;
function hashClear$3() {
  this.__data__ = nativeCreate$5 ? nativeCreate$5(null) : {};
  this.size = 0;
}
var _hashClear = hashClear$3;
function hashDelete$3(key) {
  var result = this.has(key) && delete this.__data__[key];
  this.size -= result ? 1 : 0;
  return result;
}
var _hashDelete = hashDelete$3;
var nativeCreate$4 = _nativeCreate;
var HASH_UNDEFINED$6 = "__lodash_hash_undefined__";
var objectProto$n = Object.prototype;
var hasOwnProperty$l = objectProto$n.hasOwnProperty;
function hashGet$3(key) {
  var data = this.__data__;
  if (nativeCreate$4) {
    var result = data[key];
    return result === HASH_UNDEFINED$6 ? void 0 : result;
  }
  return hasOwnProperty$l.call(data, key) ? data[key] : void 0;
}
var _hashGet = hashGet$3;
var nativeCreate$3 = _nativeCreate;
var objectProto$m = Object.prototype;
var hasOwnProperty$k = objectProto$m.hasOwnProperty;
function hashHas$3(key) {
  var data = this.__data__;
  return nativeCreate$3 ? data[key] !== void 0 : hasOwnProperty$k.call(data, key);
}
var _hashHas = hashHas$3;
var nativeCreate$2 = _nativeCreate;
var HASH_UNDEFINED$5 = "__lodash_hash_undefined__";
function hashSet$3(key, value2) {
  var data = this.__data__;
  this.size += this.has(key) ? 0 : 1;
  data[key] = nativeCreate$2 && value2 === void 0 ? HASH_UNDEFINED$5 : value2;
  return this;
}
var _hashSet = hashSet$3;
var hashClear$2 = _hashClear, hashDelete$2 = _hashDelete, hashGet$2 = _hashGet, hashHas$2 = _hashHas, hashSet$2 = _hashSet;
function Hash$3(entries) {
  var index2 = -1, length2 = entries == null ? 0 : entries.length;
  this.clear();
  while (++index2 < length2) {
    var entry = entries[index2];
    this.set(entry[0], entry[1]);
  }
}
Hash$3.prototype.clear = hashClear$2;
Hash$3.prototype["delete"] = hashDelete$2;
Hash$3.prototype.get = hashGet$2;
Hash$3.prototype.has = hashHas$2;
Hash$3.prototype.set = hashSet$2;
var _Hash = Hash$3;
var Hash$2 = _Hash, ListCache$4 = _ListCache, Map$5 = _Map;
function mapCacheClear$3() {
  this.size = 0;
  this.__data__ = {
    "hash": new Hash$2(),
    "map": new (Map$5 || ListCache$4)(),
    "string": new Hash$2()
  };
}
var _mapCacheClear = mapCacheClear$3;
function isKeyable$3(value2) {
  var type4 = typeof value2;
  return type4 == "string" || type4 == "number" || type4 == "symbol" || type4 == "boolean" ? value2 !== "__proto__" : value2 === null;
}
var _isKeyable = isKeyable$3;
var isKeyable$2 = _isKeyable;
function getMapData$6(map2, key) {
  var data = map2.__data__;
  return isKeyable$2(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
}
var _getMapData = getMapData$6;
var getMapData$5 = _getMapData;
function mapCacheDelete$3(key) {
  var result = getMapData$5(this, key)["delete"](key);
  this.size -= result ? 1 : 0;
  return result;
}
var _mapCacheDelete = mapCacheDelete$3;
var getMapData$4 = _getMapData;
function mapCacheGet$3(key) {
  return getMapData$4(this, key).get(key);
}
var _mapCacheGet = mapCacheGet$3;
var getMapData$3 = _getMapData;
function mapCacheHas$3(key) {
  return getMapData$3(this, key).has(key);
}
var _mapCacheHas = mapCacheHas$3;
var getMapData$2 = _getMapData;
function mapCacheSet$3(key, value2) {
  var data = getMapData$2(this, key), size2 = data.size;
  data.set(key, value2);
  this.size += data.size == size2 ? 0 : 1;
  return this;
}
var _mapCacheSet = mapCacheSet$3;
var mapCacheClear$2 = _mapCacheClear, mapCacheDelete$2 = _mapCacheDelete, mapCacheGet$2 = _mapCacheGet, mapCacheHas$2 = _mapCacheHas, mapCacheSet$2 = _mapCacheSet;
function MapCache$5(entries) {
  var index2 = -1, length2 = entries == null ? 0 : entries.length;
  this.clear();
  while (++index2 < length2) {
    var entry = entries[index2];
    this.set(entry[0], entry[1]);
  }
}
MapCache$5.prototype.clear = mapCacheClear$2;
MapCache$5.prototype["delete"] = mapCacheDelete$2;
MapCache$5.prototype.get = mapCacheGet$2;
MapCache$5.prototype.has = mapCacheHas$2;
MapCache$5.prototype.set = mapCacheSet$2;
var _MapCache = MapCache$5;
var ListCache$3 = _ListCache, Map$4 = _Map, MapCache$4 = _MapCache;
var LARGE_ARRAY_SIZE$1 = 200;
function stackSet$2(key, value2) {
  var data = this.__data__;
  if (data instanceof ListCache$3) {
    var pairs = data.__data__;
    if (!Map$4 || pairs.length < LARGE_ARRAY_SIZE$1 - 1) {
      pairs.push([key, value2]);
      this.size = ++data.size;
      return this;
    }
    data = this.__data__ = new MapCache$4(pairs);
  }
  data.set(key, value2);
  this.size = data.size;
  return this;
}
var _stackSet = stackSet$2;
var ListCache$2 = _ListCache, stackClear$1 = _stackClear, stackDelete$1 = _stackDelete, stackGet$1 = _stackGet, stackHas$1 = _stackHas, stackSet$1 = _stackSet;
function Stack$4(entries) {
  var data = this.__data__ = new ListCache$2(entries);
  this.size = data.size;
}
Stack$4.prototype.clear = stackClear$1;
Stack$4.prototype["delete"] = stackDelete$1;
Stack$4.prototype.get = stackGet$1;
Stack$4.prototype.has = stackHas$1;
Stack$4.prototype.set = stackSet$1;
var _Stack = Stack$4;
var HASH_UNDEFINED$4 = "__lodash_hash_undefined__";
function setCacheAdd$2(value2) {
  this.__data__.set(value2, HASH_UNDEFINED$4);
  return this;
}
var _setCacheAdd = setCacheAdd$2;
function setCacheHas$2(value2) {
  return this.__data__.has(value2);
}
var _setCacheHas = setCacheHas$2;
var MapCache$3 = _MapCache, setCacheAdd$1 = _setCacheAdd, setCacheHas$1 = _setCacheHas;
function SetCache$2(values) {
  var index2 = -1, length2 = values == null ? 0 : values.length;
  this.__data__ = new MapCache$3();
  while (++index2 < length2) {
    this.add(values[index2]);
  }
}
SetCache$2.prototype.add = SetCache$2.prototype.push = setCacheAdd$1;
SetCache$2.prototype.has = setCacheHas$1;
var _SetCache = SetCache$2;
function arraySome$2(array4, predicate) {
  var index2 = -1, length2 = array4 == null ? 0 : array4.length;
  while (++index2 < length2) {
    if (predicate(array4[index2], index2, array4)) {
      return true;
    }
  }
  return false;
}
var _arraySome = arraySome$2;
function cacheHas$2(cache2, key) {
  return cache2.has(key);
}
var _cacheHas = cacheHas$2;
var SetCache$1 = _SetCache, arraySome$1 = _arraySome, cacheHas$1 = _cacheHas;
var COMPARE_PARTIAL_FLAG$b = 1, COMPARE_UNORDERED_FLAG$7 = 2;
function equalArrays$3(array4, other, bitmask, customizer, equalFunc, stack) {
  var isPartial = bitmask & COMPARE_PARTIAL_FLAG$b, arrLength = array4.length, othLength = other.length;
  if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
    return false;
  }
  var arrStacked = stack.get(array4);
  var othStacked = stack.get(other);
  if (arrStacked && othStacked) {
    return arrStacked == other && othStacked == array4;
  }
  var index2 = -1, result = true, seen2 = bitmask & COMPARE_UNORDERED_FLAG$7 ? new SetCache$1() : void 0;
  stack.set(array4, other);
  stack.set(other, array4);
  while (++index2 < arrLength) {
    var arrValue = array4[index2], othValue = other[index2];
    if (customizer) {
      var compared = isPartial ? customizer(othValue, arrValue, index2, other, array4, stack) : customizer(arrValue, othValue, index2, array4, other, stack);
    }
    if (compared !== void 0) {
      if (compared) {
        continue;
      }
      result = false;
      break;
    }
    if (seen2) {
      if (!arraySome$1(other, function(othValue2, othIndex) {
        if (!cacheHas$1(seen2, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
          return seen2.push(othIndex);
        }
      })) {
        result = false;
        break;
      }
    } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
      result = false;
      break;
    }
  }
  stack["delete"](array4);
  stack["delete"](other);
  return result;
}
var _equalArrays = equalArrays$3;
var root$9 = _root;
var Uint8Array$4 = root$9.Uint8Array;
var _Uint8Array = Uint8Array$4;
function mapToArray$2(map2) {
  var index2 = -1, result = Array(map2.size);
  map2.forEach(function(value2, key) {
    result[++index2] = [key, value2];
  });
  return result;
}
var _mapToArray = mapToArray$2;
function setToArray$2(set2) {
  var index2 = -1, result = Array(set2.size);
  set2.forEach(function(value2) {
    result[++index2] = value2;
  });
  return result;
}
var _setToArray = setToArray$2;
var Symbol$5 = _Symbol, Uint8Array$3 = _Uint8Array, eq$4 = eq_1, equalArrays$2 = _equalArrays, mapToArray$1 = _mapToArray, setToArray$1 = _setToArray;
var COMPARE_PARTIAL_FLAG$a = 1, COMPARE_UNORDERED_FLAG$6 = 2;
var boolTag$4 = "[object Boolean]", dateTag$4 = "[object Date]", errorTag$3 = "[object Error]", mapTag$7 = "[object Map]", numberTag$4 = "[object Number]", regexpTag$4 = "[object RegExp]", setTag$7 = "[object Set]", stringTag$4 = "[object String]", symbolTag$6 = "[object Symbol]";
var arrayBufferTag$4 = "[object ArrayBuffer]", dataViewTag$6 = "[object DataView]";
var symbolProto$5 = Symbol$5 ? Symbol$5.prototype : void 0, symbolValueOf$2 = symbolProto$5 ? symbolProto$5.valueOf : void 0;
function equalByTag$2(object4, other, tag, bitmask, customizer, equalFunc, stack) {
  switch (tag) {
    case dataViewTag$6:
      if (object4.byteLength != other.byteLength || object4.byteOffset != other.byteOffset) {
        return false;
      }
      object4 = object4.buffer;
      other = other.buffer;
    case arrayBufferTag$4:
      if (object4.byteLength != other.byteLength || !equalFunc(new Uint8Array$3(object4), new Uint8Array$3(other))) {
        return false;
      }
      return true;
    case boolTag$4:
    case dateTag$4:
    case numberTag$4:
      return eq$4(+object4, +other);
    case errorTag$3:
      return object4.name == other.name && object4.message == other.message;
    case regexpTag$4:
    case stringTag$4:
      return object4 == other + "";
    case mapTag$7:
      var convert2 = mapToArray$1;
    case setTag$7:
      var isPartial = bitmask & COMPARE_PARTIAL_FLAG$a;
      convert2 || (convert2 = setToArray$1);
      if (object4.size != other.size && !isPartial) {
        return false;
      }
      var stacked = stack.get(object4);
      if (stacked) {
        return stacked == other;
      }
      bitmask |= COMPARE_UNORDERED_FLAG$6;
      stack.set(object4, other);
      var result = equalArrays$2(convert2(object4), convert2(other), bitmask, customizer, equalFunc, stack);
      stack["delete"](object4);
      return result;
    case symbolTag$6:
      if (symbolValueOf$2) {
        return symbolValueOf$2.call(object4) == symbolValueOf$2.call(other);
      }
  }
  return false;
}
var _equalByTag = equalByTag$2;
function arrayPush$3(array4, values) {
  var index2 = -1, length2 = values.length, offset2 = array4.length;
  while (++index2 < length2) {
    array4[offset2 + index2] = values[index2];
  }
  return array4;
}
var _arrayPush = arrayPush$3;
var arrayPush$2 = _arrayPush, isArray$f = isArray_1;
function baseGetAllKeys$3(object4, keysFunc, symbolsFunc) {
  var result = keysFunc(object4);
  return isArray$f(object4) ? result : arrayPush$2(result, symbolsFunc(object4));
}
var _baseGetAllKeys = baseGetAllKeys$3;
function arrayFilter$2(array4, predicate) {
  var index2 = -1, length2 = array4 == null ? 0 : array4.length, resIndex = 0, result = [];
  while (++index2 < length2) {
    var value2 = array4[index2];
    if (predicate(value2, index2, array4)) {
      result[resIndex++] = value2;
    }
  }
  return result;
}
var _arrayFilter = arrayFilter$2;
function stubArray$3() {
  return [];
}
var stubArray_1 = stubArray$3;
var arrayFilter$1 = _arrayFilter, stubArray$2 = stubArray_1;
var objectProto$l = Object.prototype;
var propertyIsEnumerable$2 = objectProto$l.propertyIsEnumerable;
var nativeGetSymbols$2 = Object.getOwnPropertySymbols;
var getSymbols$4 = !nativeGetSymbols$2 ? stubArray$2 : function(object4) {
  if (object4 == null) {
    return [];
  }
  object4 = Object(object4);
  return arrayFilter$1(nativeGetSymbols$2(object4), function(symbol) {
    return propertyIsEnumerable$2.call(object4, symbol);
  });
};
var _getSymbols = getSymbols$4;
var baseGetAllKeys$2 = _baseGetAllKeys, getSymbols$3 = _getSymbols, keys$6 = keys_1;
function getAllKeys$3(object4) {
  return baseGetAllKeys$2(object4, keys$6, getSymbols$3);
}
var _getAllKeys = getAllKeys$3;
var getAllKeys$2 = _getAllKeys;
var COMPARE_PARTIAL_FLAG$9 = 1;
var objectProto$k = Object.prototype;
var hasOwnProperty$j = objectProto$k.hasOwnProperty;
function equalObjects$2(object4, other, bitmask, customizer, equalFunc, stack) {
  var isPartial = bitmask & COMPARE_PARTIAL_FLAG$9, objProps = getAllKeys$2(object4), objLength = objProps.length, othProps = getAllKeys$2(other), othLength = othProps.length;
  if (objLength != othLength && !isPartial) {
    return false;
  }
  var index2 = objLength;
  while (index2--) {
    var key = objProps[index2];
    if (!(isPartial ? key in other : hasOwnProperty$j.call(other, key))) {
      return false;
    }
  }
  var objStacked = stack.get(object4);
  var othStacked = stack.get(other);
  if (objStacked && othStacked) {
    return objStacked == other && othStacked == object4;
  }
  var result = true;
  stack.set(object4, other);
  stack.set(other, object4);
  var skipCtor = isPartial;
  while (++index2 < objLength) {
    key = objProps[index2];
    var objValue = object4[key], othValue = other[key];
    if (customizer) {
      var compared = isPartial ? customizer(othValue, objValue, key, other, object4, stack) : customizer(objValue, othValue, key, object4, other, stack);
    }
    if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
      result = false;
      break;
    }
    skipCtor || (skipCtor = key == "constructor");
  }
  if (result && !skipCtor) {
    var objCtor = object4.constructor, othCtor = other.constructor;
    if (objCtor != othCtor && ("constructor" in object4 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
      result = false;
    }
  }
  stack["delete"](object4);
  stack["delete"](other);
  return result;
}
var _equalObjects = equalObjects$2;
var getNative$6 = _getNative, root$8 = _root;
var DataView$3 = getNative$6(root$8, "DataView");
var _DataView = DataView$3;
var getNative$5 = _getNative, root$7 = _root;
var Promise$3 = getNative$5(root$7, "Promise");
var _Promise = Promise$3;
var getNative$4 = _getNative, root$6 = _root;
var Set$3 = getNative$4(root$6, "Set");
var _Set = Set$3;
var getNative$3 = _getNative, root$5 = _root;
var WeakMap$3 = getNative$3(root$5, "WeakMap");
var _WeakMap = WeakMap$3;
var DataView$2 = _DataView, Map$3 = _Map, Promise$2 = _Promise, Set$2 = _Set, WeakMap$2 = _WeakMap, baseGetTag$2 = _baseGetTag, toSource$2 = _toSource;
var mapTag$6 = "[object Map]", objectTag$6 = "[object Object]", promiseTag$1 = "[object Promise]", setTag$6 = "[object Set]", weakMapTag$3 = "[object WeakMap]";
var dataViewTag$5 = "[object DataView]";
var dataViewCtorString$1 = toSource$2(DataView$2), mapCtorString$1 = toSource$2(Map$3), promiseCtorString$1 = toSource$2(Promise$2), setCtorString$1 = toSource$2(Set$2), weakMapCtorString$1 = toSource$2(WeakMap$2);
var getTag$5 = baseGetTag$2;
if (DataView$2 && getTag$5(new DataView$2(new ArrayBuffer(1))) != dataViewTag$5 || Map$3 && getTag$5(new Map$3()) != mapTag$6 || Promise$2 && getTag$5(Promise$2.resolve()) != promiseTag$1 || Set$2 && getTag$5(new Set$2()) != setTag$6 || WeakMap$2 && getTag$5(new WeakMap$2()) != weakMapTag$3) {
  getTag$5 = function(value2) {
    var result = baseGetTag$2(value2), Ctor = result == objectTag$6 ? value2.constructor : void 0, ctorString = Ctor ? toSource$2(Ctor) : "";
    if (ctorString) {
      switch (ctorString) {
        case dataViewCtorString$1:
          return dataViewTag$5;
        case mapCtorString$1:
          return mapTag$6;
        case promiseCtorString$1:
          return promiseTag$1;
        case setCtorString$1:
          return setTag$6;
        case weakMapCtorString$1:
          return weakMapTag$3;
      }
    }
    return result;
  };
}
var _getTag = getTag$5;
var Stack$3 = _Stack, equalArrays$1 = _equalArrays, equalByTag$1 = _equalByTag, equalObjects$1 = _equalObjects, getTag$4 = _getTag, isArray$e = isArray_1, isBuffer$3 = isBufferExports, isTypedArray$2 = isTypedArray_1;
var COMPARE_PARTIAL_FLAG$8 = 1;
var argsTag$4 = "[object Arguments]", arrayTag$3 = "[object Array]", objectTag$5 = "[object Object]";
var objectProto$j = Object.prototype;
var hasOwnProperty$i = objectProto$j.hasOwnProperty;
function baseIsEqualDeep$2(object4, other, bitmask, customizer, equalFunc, stack) {
  var objIsArr = isArray$e(object4), othIsArr = isArray$e(other), objTag = objIsArr ? arrayTag$3 : getTag$4(object4), othTag = othIsArr ? arrayTag$3 : getTag$4(other);
  objTag = objTag == argsTag$4 ? objectTag$5 : objTag;
  othTag = othTag == argsTag$4 ? objectTag$5 : othTag;
  var objIsObj = objTag == objectTag$5, othIsObj = othTag == objectTag$5, isSameTag = objTag == othTag;
  if (isSameTag && isBuffer$3(object4)) {
    if (!isBuffer$3(other)) {
      return false;
    }
    objIsArr = true;
    objIsObj = false;
  }
  if (isSameTag && !objIsObj) {
    stack || (stack = new Stack$3());
    return objIsArr || isTypedArray$2(object4) ? equalArrays$1(object4, other, bitmask, customizer, equalFunc, stack) : equalByTag$1(object4, other, objTag, bitmask, customizer, equalFunc, stack);
  }
  if (!(bitmask & COMPARE_PARTIAL_FLAG$8)) {
    var objIsWrapped = objIsObj && hasOwnProperty$i.call(object4, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$i.call(other, "__wrapped__");
    if (objIsWrapped || othIsWrapped) {
      var objUnwrapped = objIsWrapped ? object4.value() : object4, othUnwrapped = othIsWrapped ? other.value() : other;
      stack || (stack = new Stack$3());
      return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
    }
  }
  if (!isSameTag) {
    return false;
  }
  stack || (stack = new Stack$3());
  return equalObjects$1(object4, other, bitmask, customizer, equalFunc, stack);
}
var _baseIsEqualDeep = baseIsEqualDeep$2;
var baseIsEqualDeep$1 = _baseIsEqualDeep, isObjectLike$5 = isObjectLike_1;
function baseIsEqual$3(value2, other, bitmask, customizer, stack) {
  if (value2 === other) {
    return true;
  }
  if (value2 == null || other == null || !isObjectLike$5(value2) && !isObjectLike$5(other)) {
    return value2 !== value2 && other !== other;
  }
  return baseIsEqualDeep$1(value2, other, bitmask, customizer, baseIsEqual$3, stack);
}
var _baseIsEqual = baseIsEqual$3;
var Stack$2 = _Stack, baseIsEqual$2 = _baseIsEqual;
var COMPARE_PARTIAL_FLAG$7 = 1, COMPARE_UNORDERED_FLAG$5 = 2;
function baseIsMatch$2(object4, source2, matchData, customizer) {
  var index2 = matchData.length, length2 = index2, noCustomizer = !customizer;
  if (object4 == null) {
    return !length2;
  }
  object4 = Object(object4);
  while (index2--) {
    var data = matchData[index2];
    if (noCustomizer && data[2] ? data[1] !== object4[data[0]] : !(data[0] in object4)) {
      return false;
    }
  }
  while (++index2 < length2) {
    data = matchData[index2];
    var key = data[0], objValue = object4[key], srcValue = data[1];
    if (noCustomizer && data[2]) {
      if (objValue === void 0 && !(key in object4)) {
        return false;
      }
    } else {
      var stack = new Stack$2();
      if (customizer) {
        var result = customizer(objValue, srcValue, key, object4, source2, stack);
      }
      if (!(result === void 0 ? baseIsEqual$2(srcValue, objValue, COMPARE_PARTIAL_FLAG$7 | COMPARE_UNORDERED_FLAG$5, customizer, stack) : result)) {
        return false;
      }
    }
  }
  return true;
}
var _baseIsMatch = baseIsMatch$2;
var isObject$8 = isObject_1;
function isStrictComparable$3(value2) {
  return value2 === value2 && !isObject$8(value2);
}
var _isStrictComparable = isStrictComparable$3;
var isStrictComparable$2 = _isStrictComparable, keys$5 = keys_1;
function getMatchData$2(object4) {
  var result = keys$5(object4), length2 = result.length;
  while (length2--) {
    var key = result[length2], value2 = object4[key];
    result[length2] = [key, value2, isStrictComparable$2(value2)];
  }
  return result;
}
var _getMatchData = getMatchData$2;
function matchesStrictComparable$3(key, srcValue) {
  return function(object4) {
    if (object4 == null) {
      return false;
    }
    return object4[key] === srcValue && (srcValue !== void 0 || key in Object(object4));
  };
}
var _matchesStrictComparable = matchesStrictComparable$3;
var baseIsMatch$1 = _baseIsMatch, getMatchData$1 = _getMatchData, matchesStrictComparable$2 = _matchesStrictComparable;
function baseMatches$2(source2) {
  var matchData = getMatchData$1(source2);
  if (matchData.length == 1 && matchData[0][2]) {
    return matchesStrictComparable$2(matchData[0][0], matchData[0][1]);
  }
  return function(object4) {
    return object4 === source2 || baseIsMatch$1(object4, source2, matchData);
  };
}
var _baseMatches = baseMatches$2;
var baseGetTag$1 = _baseGetTag, isObjectLike$4 = isObjectLike_1;
var symbolTag$5 = "[object Symbol]";
function isSymbol$5(value2) {
  return typeof value2 == "symbol" || isObjectLike$4(value2) && baseGetTag$1(value2) == symbolTag$5;
}
var isSymbol_1 = isSymbol$5;
var isArray$d = isArray_1, isSymbol$4 = isSymbol_1;
var reIsDeepProp$2 = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp$2 = /^\w*$/;
function isKey$5(value2, object4) {
  if (isArray$d(value2)) {
    return false;
  }
  var type4 = typeof value2;
  if (type4 == "number" || type4 == "symbol" || type4 == "boolean" || value2 == null || isSymbol$4(value2)) {
    return true;
  }
  return reIsPlainProp$2.test(value2) || !reIsDeepProp$2.test(value2) || object4 != null && value2 in Object(object4);
}
var _isKey = isKey$5;
var MapCache$2 = _MapCache;
var FUNC_ERROR_TEXT$4 = "Expected a function";
function memoize$3(func, resolver2) {
  if (typeof func != "function" || resolver2 != null && typeof resolver2 != "function") {
    throw new TypeError(FUNC_ERROR_TEXT$4);
  }
  var memoized = function() {
    var args = arguments, key = resolver2 ? resolver2.apply(this, args) : args[0], cache2 = memoized.cache;
    if (cache2.has(key)) {
      return cache2.get(key);
    }
    var result = func.apply(this, args);
    memoized.cache = cache2.set(key, result) || cache2;
    return result;
  };
  memoized.cache = new (memoize$3.Cache || MapCache$2)();
  return memoized;
}
memoize$3.Cache = MapCache$2;
var memoize_1 = memoize$3;
var memoize$2 = memoize_1;
var MAX_MEMOIZE_SIZE$1 = 500;
function memoizeCapped$2(func) {
  var result = memoize$2(func, function(key) {
    if (cache2.size === MAX_MEMOIZE_SIZE$1) {
      cache2.clear();
    }
    return key;
  });
  var cache2 = result.cache;
  return result;
}
var _memoizeCapped = memoizeCapped$2;
var memoizeCapped$1 = _memoizeCapped;
var rePropName$2 = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var reEscapeChar$2 = /\\(\\)?/g;
var stringToPath$3 = memoizeCapped$1(function(string3) {
  var result = [];
  if (string3.charCodeAt(0) === 46) {
    result.push("");
  }
  string3.replace(rePropName$2, function(match5, number4, quote, subString) {
    result.push(quote ? subString.replace(reEscapeChar$2, "$1") : number4 || match5);
  });
  return result;
});
var _stringToPath = stringToPath$3;
var Symbol$4 = _Symbol, arrayMap$2 = _arrayMap, isArray$c = isArray_1, isSymbol$3 = isSymbol_1;
var symbolProto$4 = Symbol$4 ? Symbol$4.prototype : void 0, symbolToString$2 = symbolProto$4 ? symbolProto$4.toString : void 0;
function baseToString$3(value2) {
  if (typeof value2 == "string") {
    return value2;
  }
  if (isArray$c(value2)) {
    return arrayMap$2(value2, baseToString$3) + "";
  }
  if (isSymbol$3(value2)) {
    return symbolToString$2 ? symbolToString$2.call(value2) : "";
  }
  var result = value2 + "";
  return result == "0" && 1 / value2 == -Infinity ? "-0" : result;
}
var _baseToString = baseToString$3;
var baseToString$2 = _baseToString;
function toString$7(value2) {
  return value2 == null ? "" : baseToString$2(value2);
}
var toString_1 = toString$7;
var isArray$b = isArray_1, isKey$4 = _isKey, stringToPath$2 = _stringToPath, toString$6 = toString_1;
function castPath$4(value2, object4) {
  if (isArray$b(value2)) {
    return value2;
  }
  return isKey$4(value2, object4) ? [value2] : stringToPath$2(toString$6(value2));
}
var _castPath = castPath$4;
var isSymbol$2 = isSymbol_1;
function toKey$6(value2) {
  if (typeof value2 == "string" || isSymbol$2(value2)) {
    return value2;
  }
  var result = value2 + "";
  return result == "0" && 1 / value2 == -Infinity ? "-0" : result;
}
var _toKey = toKey$6;
var castPath$3 = _castPath, toKey$5 = _toKey;
function baseGet$4(object4, path) {
  path = castPath$3(path, object4);
  var index2 = 0, length2 = path.length;
  while (object4 != null && index2 < length2) {
    object4 = object4[toKey$5(path[index2++])];
  }
  return index2 && index2 == length2 ? object4 : void 0;
}
var _baseGet = baseGet$4;
var baseGet$3 = _baseGet;
function get$9(object4, path, defaultValue2) {
  var result = object4 == null ? void 0 : baseGet$3(object4, path);
  return result === void 0 ? defaultValue2 : result;
}
var get_1 = get$9;
function baseHasIn$2(object4, key) {
  return object4 != null && key in Object(object4);
}
var _baseHasIn = baseHasIn$2;
var castPath$2 = _castPath, isArguments$1 = isArguments_1, isArray$a = isArray_1, isIndex$1 = _isIndex, isLength$1 = isLength_1, toKey$4 = _toKey;
function hasPath$2(object4, path, hasFunc) {
  path = castPath$2(path, object4);
  var index2 = -1, length2 = path.length, result = false;
  while (++index2 < length2) {
    var key = toKey$4(path[index2]);
    if (!(result = object4 != null && hasFunc(object4, key))) {
      break;
    }
    object4 = object4[key];
  }
  if (result || ++index2 != length2) {
    return result;
  }
  length2 = object4 == null ? 0 : object4.length;
  return !!length2 && isLength$1(length2) && isIndex$1(key, length2) && (isArray$a(object4) || isArguments$1(object4));
}
var _hasPath = hasPath$2;
var baseHasIn$1 = _baseHasIn, hasPath$1 = _hasPath;
function hasIn$2(object4, path) {
  return object4 != null && hasPath$1(object4, path, baseHasIn$1);
}
var hasIn_1 = hasIn$2;
var baseIsEqual$1 = _baseIsEqual, get$8 = get_1, hasIn$1 = hasIn_1, isKey$3 = _isKey, isStrictComparable$1 = _isStrictComparable, matchesStrictComparable$1 = _matchesStrictComparable, toKey$3 = _toKey;
var COMPARE_PARTIAL_FLAG$6 = 1, COMPARE_UNORDERED_FLAG$4 = 2;
function baseMatchesProperty$2(path, srcValue) {
  if (isKey$3(path) && isStrictComparable$1(srcValue)) {
    return matchesStrictComparable$1(toKey$3(path), srcValue);
  }
  return function(object4) {
    var objValue = get$8(object4, path);
    return objValue === void 0 && objValue === srcValue ? hasIn$1(object4, path) : baseIsEqual$1(srcValue, objValue, COMPARE_PARTIAL_FLAG$6 | COMPARE_UNORDERED_FLAG$4);
  };
}
var _baseMatchesProperty = baseMatchesProperty$2;
function baseProperty$2(key) {
  return function(object4) {
    return object4 == null ? void 0 : object4[key];
  };
}
var _baseProperty = baseProperty$2;
var baseGet$2 = _baseGet;
function basePropertyDeep$2(path) {
  return function(object4) {
    return baseGet$2(object4, path);
  };
}
var _basePropertyDeep = basePropertyDeep$2;
var baseProperty$1 = _baseProperty, basePropertyDeep$1 = _basePropertyDeep, isKey$2 = _isKey, toKey$2 = _toKey;
function property$3(path) {
  return isKey$2(path) ? baseProperty$1(toKey$2(path)) : basePropertyDeep$1(path);
}
var property_1 = property$3;
var baseMatches$1 = _baseMatches, baseMatchesProperty$1 = _baseMatchesProperty, identity$3 = identity_1, isArray$9 = isArray_1, property$2 = property_1;
function baseIteratee$2(value2) {
  if (typeof value2 == "function") {
    return value2;
  }
  if (value2 == null) {
    return identity$3;
  }
  if (typeof value2 == "object") {
    return isArray$9(value2) ? baseMatchesProperty$1(value2[0], value2[1]) : baseMatches$1(value2);
  }
  return property$2(value2);
}
var _baseIteratee = baseIteratee$2;
var isArrayLike$3 = isArrayLike_1;
function createBaseEach$2(eachFunc, fromRight) {
  return function(collection, iteratee) {
    if (collection == null) {
      return collection;
    }
    if (!isArrayLike$3(collection)) {
      return eachFunc(collection, iteratee);
    }
    var length2 = collection.length, index2 = fromRight ? length2 : -1, iterable = Object(collection);
    while (fromRight ? index2-- : ++index2 < length2) {
      if (iteratee(iterable[index2], index2, iterable) === false) {
        break;
      }
    }
    return collection;
  };
}
var _createBaseEach = createBaseEach$2;
var baseForOwn$1 = _baseForOwn, createBaseEach$1 = _createBaseEach;
var baseEach$2 = createBaseEach$1(baseForOwn$1);
var _baseEach = baseEach$2;
var baseEach$1 = _baseEach, isArrayLike$2 = isArrayLike_1;
function baseMap$2(collection, iteratee) {
  var index2 = -1, result = isArrayLike$2(collection) ? Array(collection.length) : [];
  baseEach$1(collection, function(value2, key, collection2) {
    result[++index2] = iteratee(value2, key, collection2);
  });
  return result;
}
var _baseMap = baseMap$2;
var arrayMap$1 = _arrayMap, baseIteratee$1 = _baseIteratee, baseMap$1 = _baseMap, isArray$8 = isArray_1;
function map$4(collection, iteratee) {
  var func = isArray$8(collection) ? arrayMap$1 : baseMap$1;
  return func(collection, baseIteratee$1(iteratee));
}
var map_1 = map$4;
Object.defineProperty(flattenNames$1, "__esModule", {
  value: true
});
flattenNames$1.flattenNames = void 0;
var _isString2 = isString_1;
var _isString3 = _interopRequireDefault$7(_isString2);
var _forOwn2$2 = forOwn_1;
var _forOwn3$2 = _interopRequireDefault$7(_forOwn2$2);
var _isPlainObject2 = isPlainObject_1;
var _isPlainObject3 = _interopRequireDefault$7(_isPlainObject2);
var _map2 = map_1;
var _map3 = _interopRequireDefault$7(_map2);
function _interopRequireDefault$7(obj) {
  return obj && obj.__esModule ? obj : { default: obj };
}
var flattenNames = flattenNames$1.flattenNames = function flattenNames2() {
  var things = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
  var names2 = [];
  (0, _map3.default)(things, function(thing) {
    if (Array.isArray(thing)) {
      flattenNames2(thing).map(function(name2) {
        return names2.push(name2);
      });
    } else if ((0, _isPlainObject3.default)(thing)) {
      (0, _forOwn3$2.default)(thing, function(value2, key) {
        value2 === true && names2.push(key);
        names2.push(key + "-" + value2);
      });
    } else if ((0, _isString3.default)(thing)) {
      names2.push(thing);
    }
  });
  return names2;
};
flattenNames$1.default = flattenNames;
var mergeClasses$1 = {};
function arrayEach$2(array4, iteratee) {
  var index2 = -1, length2 = array4 == null ? 0 : array4.length;
  while (++index2 < length2) {
    if (iteratee(array4[index2], index2, array4) === false) {
      break;
    }
  }
  return array4;
}
var _arrayEach = arrayEach$2;
var getNative$2 = _getNative;
var defineProperty$3 = function() {
  try {
    var func = getNative$2(Object, "defineProperty");
    func({}, "", {});
    return func;
  } catch (e2) {
  }
}();
var _defineProperty$2 = defineProperty$3;
var defineProperty$2 = _defineProperty$2;
function baseAssignValue$3(object4, key, value2) {
  if (key == "__proto__" && defineProperty$2) {
    defineProperty$2(object4, key, {
      "configurable": true,
      "enumerable": true,
      "value": value2,
      "writable": true
    });
  } else {
    object4[key] = value2;
  }
}
var _baseAssignValue = baseAssignValue$3;
var baseAssignValue$2 = _baseAssignValue, eq$3 = eq_1;
var objectProto$i = Object.prototype;
var hasOwnProperty$h = objectProto$i.hasOwnProperty;
function assignValue$3(object4, key, value2) {
  var objValue = object4[key];
  if (!(hasOwnProperty$h.call(object4, key) && eq$3(objValue, value2)) || value2 === void 0 && !(key in object4)) {
    baseAssignValue$2(object4, key, value2);
  }
}
var _assignValue = assignValue$3;
var assignValue$2 = _assignValue, baseAssignValue$1 = _baseAssignValue;
function copyObject$5(source2, props, object4, customizer) {
  var isNew = !object4;
  object4 || (object4 = {});
  var index2 = -1, length2 = props.length;
  while (++index2 < length2) {
    var key = props[index2];
    var newValue = customizer ? customizer(object4[key], source2[key], key, object4, source2) : void 0;
    if (newValue === void 0) {
      newValue = source2[key];
    }
    if (isNew) {
      baseAssignValue$1(object4, key, newValue);
    } else {
      assignValue$2(object4, key, newValue);
    }
  }
  return object4;
}
var _copyObject = copyObject$5;
var copyObject$4 = _copyObject, keys$4 = keys_1;
function baseAssign$1(object4, source2) {
  return object4 && copyObject$4(source2, keys$4(source2), object4);
}
var _baseAssign = baseAssign$1;
function nativeKeysIn$2(object4) {
  var result = [];
  if (object4 != null) {
    for (var key in Object(object4)) {
      result.push(key);
    }
  }
  return result;
}
var _nativeKeysIn = nativeKeysIn$2;
var isObject$7 = isObject_1, isPrototype$2 = _isPrototype, nativeKeysIn$1 = _nativeKeysIn;
var objectProto$h = Object.prototype;
var hasOwnProperty$g = objectProto$h.hasOwnProperty;
function baseKeysIn$2(object4) {
  if (!isObject$7(object4)) {
    return nativeKeysIn$1(object4);
  }
  var isProto = isPrototype$2(object4), result = [];
  for (var key in object4) {
    if (!(key == "constructor" && (isProto || !hasOwnProperty$g.call(object4, key)))) {
      result.push(key);
    }
  }
  return result;
}
var _baseKeysIn = baseKeysIn$2;
var arrayLikeKeys$1 = _arrayLikeKeys, baseKeysIn$1 = _baseKeysIn, isArrayLike$1 = isArrayLike_1;
function keysIn$4(object4) {
  return isArrayLike$1(object4) ? arrayLikeKeys$1(object4, true) : baseKeysIn$1(object4);
}
var keysIn_1 = keysIn$4;
var copyObject$3 = _copyObject, keysIn$3 = keysIn_1;
function baseAssignIn$1(object4, source2) {
  return object4 && copyObject$3(source2, keysIn$3(source2), object4);
}
var _baseAssignIn = baseAssignIn$1;
var _cloneBuffer = { exports: {} };
_cloneBuffer.exports;
(function(module2, exports2) {
  var root2 = _root;
  var freeExports2 = exports2 && !exports2.nodeType && exports2;
  var freeModule2 = freeExports2 && true && module2 && !module2.nodeType && module2;
  var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
  var Buffer2 = moduleExports2 ? root2.Buffer : void 0, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
  function cloneBuffer2(buffer, isDeep) {
    if (isDeep) {
      return buffer.slice();
    }
    var length2 = buffer.length, result = allocUnsafe ? allocUnsafe(length2) : new buffer.constructor(length2);
    buffer.copy(result);
    return result;
  }
  module2.exports = cloneBuffer2;
})(_cloneBuffer, _cloneBuffer.exports);
var _cloneBufferExports = _cloneBuffer.exports;
function copyArray$2(source2, array4) {
  var index2 = -1, length2 = source2.length;
  array4 || (array4 = Array(length2));
  while (++index2 < length2) {
    array4[index2] = source2[index2];
  }
  return array4;
}
var _copyArray = copyArray$2;
var copyObject$2 = _copyObject, getSymbols$2 = _getSymbols;
function copySymbols$1(source2, object4) {
  return copyObject$2(source2, getSymbols$2(source2), object4);
}
var _copySymbols = copySymbols$1;
var arrayPush$1 = _arrayPush, getPrototype$2 = _getPrototype, getSymbols$1 = _getSymbols, stubArray$1 = stubArray_1;
var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
var getSymbolsIn$2 = !nativeGetSymbols$1 ? stubArray$1 : function(object4) {
  var result = [];
  while (object4) {
    arrayPush$1(result, getSymbols$1(object4));
    object4 = getPrototype$2(object4);
  }
  return result;
};
var _getSymbolsIn = getSymbolsIn$2;
var copyObject$1 = _copyObject, getSymbolsIn$1 = _getSymbolsIn;
function copySymbolsIn$1(source2, object4) {
  return copyObject$1(source2, getSymbolsIn$1(source2), object4);
}
var _copySymbolsIn = copySymbolsIn$1;
var baseGetAllKeys$1 = _baseGetAllKeys, getSymbolsIn = _getSymbolsIn, keysIn$2 = keysIn_1;
function getAllKeysIn$1(object4) {
  return baseGetAllKeys$1(object4, keysIn$2, getSymbolsIn);
}
var _getAllKeysIn = getAllKeysIn$1;
var objectProto$g = Object.prototype;
var hasOwnProperty$f = objectProto$g.hasOwnProperty;
function initCloneArray$1(array4) {
  var length2 = array4.length, result = new array4.constructor(length2);
  if (length2 && typeof array4[0] == "string" && hasOwnProperty$f.call(array4, "index")) {
    result.index = array4.index;
    result.input = array4.input;
  }
  return result;
}
var _initCloneArray = initCloneArray$1;
var Uint8Array$2 = _Uint8Array;
function cloneArrayBuffer$4(arrayBuffer) {
  var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  new Uint8Array$2(result).set(new Uint8Array$2(arrayBuffer));
  return result;
}
var _cloneArrayBuffer = cloneArrayBuffer$4;
var cloneArrayBuffer$3 = _cloneArrayBuffer;
function cloneDataView$1(dataView, isDeep) {
  var buffer = isDeep ? cloneArrayBuffer$3(dataView.buffer) : dataView.buffer;
  return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
}
var _cloneDataView = cloneDataView$1;
var reFlags = /\w*$/;
function cloneRegExp$1(regexp4) {
  var result = new regexp4.constructor(regexp4.source, reFlags.exec(regexp4));
  result.lastIndex = regexp4.lastIndex;
  return result;
}
var _cloneRegExp = cloneRegExp$1;
var Symbol$3 = _Symbol;
var symbolProto$3 = Symbol$3 ? Symbol$3.prototype : void 0, symbolValueOf$1 = symbolProto$3 ? symbolProto$3.valueOf : void 0;
function cloneSymbol$1(symbol) {
  return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
}
var _cloneSymbol = cloneSymbol$1;
var cloneArrayBuffer$2 = _cloneArrayBuffer;
function cloneTypedArray$2(typedArray, isDeep) {
  var buffer = isDeep ? cloneArrayBuffer$2(typedArray.buffer) : typedArray.buffer;
  return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}
var _cloneTypedArray = cloneTypedArray$2;
var cloneArrayBuffer$1 = _cloneArrayBuffer, cloneDataView = _cloneDataView, cloneRegExp = _cloneRegExp, cloneSymbol = _cloneSymbol, cloneTypedArray$1 = _cloneTypedArray;
var boolTag$3 = "[object Boolean]", dateTag$3 = "[object Date]", mapTag$5 = "[object Map]", numberTag$3 = "[object Number]", regexpTag$3 = "[object RegExp]", setTag$5 = "[object Set]", stringTag$3 = "[object String]", symbolTag$4 = "[object Symbol]";
var arrayBufferTag$3 = "[object ArrayBuffer]", dataViewTag$4 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]";
function initCloneByTag$1(object4, tag, isDeep) {
  var Ctor = object4.constructor;
  switch (tag) {
    case arrayBufferTag$3:
      return cloneArrayBuffer$1(object4);
    case boolTag$3:
    case dateTag$3:
      return new Ctor(+object4);
    case dataViewTag$4:
      return cloneDataView(object4, isDeep);
    case float32Tag$2:
    case float64Tag$2:
    case int8Tag$2:
    case int16Tag$2:
    case int32Tag$2:
    case uint8Tag$2:
    case uint8ClampedTag$2:
    case uint16Tag$2:
    case uint32Tag$2:
      return cloneTypedArray$1(object4, isDeep);
    case mapTag$5:
      return new Ctor();
    case numberTag$3:
    case stringTag$3:
      return new Ctor(object4);
    case regexpTag$3:
      return cloneRegExp(object4);
    case setTag$5:
      return new Ctor();
    case symbolTag$4:
      return cloneSymbol(object4);
  }
}
var _initCloneByTag = initCloneByTag$1;
var isObject$6 = isObject_1;
var objectCreate$1 = Object.create;
var baseCreate$2 = /* @__PURE__ */ function() {
  function object4() {
  }
  return function(proto2) {
    if (!isObject$6(proto2)) {
      return {};
    }
    if (objectCreate$1) {
      return objectCreate$1(proto2);
    }
    object4.prototype = proto2;
    var result = new object4();
    object4.prototype = void 0;
    return result;
  };
}();
var _baseCreate = baseCreate$2;
var baseCreate$1 = _baseCreate, getPrototype$1 = _getPrototype, isPrototype$1 = _isPrototype;
function initCloneObject$2(object4) {
  return typeof object4.constructor == "function" && !isPrototype$1(object4) ? baseCreate$1(getPrototype$1(object4)) : {};
}
var _initCloneObject = initCloneObject$2;
var getTag$3 = _getTag, isObjectLike$3 = isObjectLike_1;
var mapTag$4 = "[object Map]";
function baseIsMap$1(value2) {
  return isObjectLike$3(value2) && getTag$3(value2) == mapTag$4;
}
var _baseIsMap = baseIsMap$1;
var baseIsMap = _baseIsMap, baseUnary$2 = _baseUnary, nodeUtil$2 = _nodeUtilExports;
var nodeIsMap = nodeUtil$2 && nodeUtil$2.isMap;
var isMap$1 = nodeIsMap ? baseUnary$2(nodeIsMap) : baseIsMap;
var isMap_1 = isMap$1;
var getTag$2 = _getTag, isObjectLike$2 = isObjectLike_1;
var setTag$4 = "[object Set]";
function baseIsSet$1(value2) {
  return isObjectLike$2(value2) && getTag$2(value2) == setTag$4;
}
var _baseIsSet = baseIsSet$1;
var baseIsSet = _baseIsSet, baseUnary$1 = _baseUnary, nodeUtil$1 = _nodeUtilExports;
var nodeIsSet = nodeUtil$1 && nodeUtil$1.isSet;
var isSet$2 = nodeIsSet ? baseUnary$1(nodeIsSet) : baseIsSet;
var isSet_1 = isSet$2;
var Stack$1 = _Stack, arrayEach$1 = _arrayEach, assignValue$1 = _assignValue, baseAssign = _baseAssign, baseAssignIn = _baseAssignIn, cloneBuffer$1 = _cloneBufferExports, copyArray$1 = _copyArray, copySymbols = _copySymbols, copySymbolsIn = _copySymbolsIn, getAllKeys$1 = _getAllKeys, getAllKeysIn = _getAllKeysIn, getTag$1 = _getTag, initCloneArray = _initCloneArray, initCloneByTag = _initCloneByTag, initCloneObject$1 = _initCloneObject, isArray$7 = isArray_1, isBuffer$2 = isBufferExports, isMap = isMap_1, isObject$5 = isObject_1, isSet$1 = isSet_1, keys$3 = keys_1, keysIn$1 = keysIn_1;
var CLONE_DEEP_FLAG$1 = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG$1 = 4;
var argsTag$3 = "[object Arguments]", arrayTag$2 = "[object Array]", boolTag$2 = "[object Boolean]", dateTag$2 = "[object Date]", errorTag$2 = "[object Error]", funcTag$3 = "[object Function]", genTag$2 = "[object GeneratorFunction]", mapTag$3 = "[object Map]", numberTag$2 = "[object Number]", objectTag$4 = "[object Object]", regexpTag$2 = "[object RegExp]", setTag$3 = "[object Set]", stringTag$2 = "[object String]", symbolTag$3 = "[object Symbol]", weakMapTag$2 = "[object WeakMap]";
var arrayBufferTag$2 = "[object ArrayBuffer]", dataViewTag$3 = "[object DataView]", float32Tag$1 = "[object Float32Array]", float64Tag$1 = "[object Float64Array]", int8Tag$1 = "[object Int8Array]", int16Tag$1 = "[object Int16Array]", int32Tag$1 = "[object Int32Array]", uint8Tag$1 = "[object Uint8Array]", uint8ClampedTag$1 = "[object Uint8ClampedArray]", uint16Tag$1 = "[object Uint16Array]", uint32Tag$1 = "[object Uint32Array]";
var cloneableTags = {};
cloneableTags[argsTag$3] = cloneableTags[arrayTag$2] = cloneableTags[arrayBufferTag$2] = cloneableTags[dataViewTag$3] = cloneableTags[boolTag$2] = cloneableTags[dateTag$2] = cloneableTags[float32Tag$1] = cloneableTags[float64Tag$1] = cloneableTags[int8Tag$1] = cloneableTags[int16Tag$1] = cloneableTags[int32Tag$1] = cloneableTags[mapTag$3] = cloneableTags[numberTag$2] = cloneableTags[objectTag$4] = cloneableTags[regexpTag$2] = cloneableTags[setTag$3] = cloneableTags[stringTag$2] = cloneableTags[symbolTag$3] = cloneableTags[uint8Tag$1] = cloneableTags[uint8ClampedTag$1] = cloneableTags[uint16Tag$1] = cloneableTags[uint32Tag$1] = true;
cloneableTags[errorTag$2] = cloneableTags[funcTag$3] = cloneableTags[weakMapTag$2] = false;
function baseClone$1(value2, bitmask, customizer, key, object4, stack) {
  var result, isDeep = bitmask & CLONE_DEEP_FLAG$1, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
  if (customizer) {
    result = object4 ? customizer(value2, key, object4, stack) : customizer(value2);
  }
  if (result !== void 0) {
    return result;
  }
  if (!isObject$5(value2)) {
    return value2;
  }
  var isArr = isArray$7(value2);
  if (isArr) {
    result = initCloneArray(value2);
    if (!isDeep) {
      return copyArray$1(value2, result);
    }
  } else {
    var tag = getTag$1(value2), isFunc = tag == funcTag$3 || tag == genTag$2;
    if (isBuffer$2(value2)) {
      return cloneBuffer$1(value2, isDeep);
    }
    if (tag == objectTag$4 || tag == argsTag$3 || isFunc && !object4) {
      result = isFlat || isFunc ? {} : initCloneObject$1(value2);
      if (!isDeep) {
        return isFlat ? copySymbolsIn(value2, baseAssignIn(result, value2)) : copySymbols(value2, baseAssign(result, value2));
      }
    } else {
      if (!cloneableTags[tag]) {
        return object4 ? value2 : {};
      }
      result = initCloneByTag(value2, tag, isDeep);
    }
  }
  stack || (stack = new Stack$1());
  var stacked = stack.get(value2);
  if (stacked) {
    return stacked;
  }
  stack.set(value2, result);
  if (isSet$1(value2)) {
    value2.forEach(function(subValue) {
      result.add(baseClone$1(subValue, bitmask, customizer, subValue, value2, stack));
    });
  } else if (isMap(value2)) {
    value2.forEach(function(subValue, key2) {
      result.set(key2, baseClone$1(subValue, bitmask, customizer, key2, value2, stack));
    });
  }
  var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys$1 : isFlat ? keysIn$1 : keys$3;
  var props = isArr ? void 0 : keysFunc(value2);
  arrayEach$1(props || value2, function(subValue, key2) {
    if (props) {
      key2 = subValue;
      subValue = value2[key2];
    }
    assignValue$1(result, key2, baseClone$1(subValue, bitmask, customizer, key2, value2, stack));
  });
  return result;
}
var _baseClone = baseClone$1;
var baseClone = _baseClone;
var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4;
function cloneDeep(value2) {
  return baseClone(value2, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
}
var cloneDeep_1 = cloneDeep;
Object.defineProperty(mergeClasses$1, "__esModule", {
  value: true
});
mergeClasses$1.mergeClasses = void 0;
var _forOwn2$1 = forOwn_1;
var _forOwn3$1 = _interopRequireDefault$6(_forOwn2$1);
var _cloneDeep2 = cloneDeep_1;
var _cloneDeep3 = _interopRequireDefault$6(_cloneDeep2);
var _extends$g = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
function _interopRequireDefault$6(obj) {
  return obj && obj.__esModule ? obj : { default: obj };
}
var mergeClasses = mergeClasses$1.mergeClasses = function mergeClasses2(classes) {
  var activeNames = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
  var styles2 = classes.default && (0, _cloneDeep3.default)(classes.default) || {};
  activeNames.map(function(name2) {
    var toMerge = classes[name2];
    if (toMerge) {
      (0, _forOwn3$1.default)(toMerge, function(value2, key) {
        if (!styles2[key]) {
          styles2[key] = {};
        }
        styles2[key] = _extends$g({}, styles2[key], toMerge[key]);
      });
    }
    return name2;
  });
  return styles2;
};
mergeClasses$1.default = mergeClasses;
var autoprefix$1 = {};
Object.defineProperty(autoprefix$1, "__esModule", {
  value: true
});
autoprefix$1.autoprefix = void 0;
var _forOwn2 = forOwn_1;
var _forOwn3 = _interopRequireDefault$5(_forOwn2);
var _extends$f = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
function _interopRequireDefault$5(obj) {
  return obj && obj.__esModule ? obj : { default: obj };
}
var transforms = {
  borderRadius: function borderRadius(value2) {
    return {
      msBorderRadius: value2,
      MozBorderRadius: value2,
      OBorderRadius: value2,
      WebkitBorderRadius: value2,
      borderRadius: value2
    };
  },
  boxShadow: function boxShadow(value2) {
    return {
      msBoxShadow: value2,
      MozBoxShadow: value2,
      OBoxShadow: value2,
      WebkitBoxShadow: value2,
      boxShadow: value2
    };
  },
  userSelect: function userSelect(value2) {
    return {
      WebkitTouchCallout: value2,
      KhtmlUserSelect: value2,
      MozUserSelect: value2,
      msUserSelect: value2,
      WebkitUserSelect: value2,
      userSelect: value2
    };
  },
  flex: function flex(value2) {
    return {
      WebkitBoxFlex: value2,
      MozBoxFlex: value2,
      WebkitFlex: value2,
      msFlex: value2,
      flex: value2
    };
  },
  flexBasis: function flexBasis(value2) {
    return {
      WebkitFlexBasis: value2,
      flexBasis: value2
    };
  },
  justifyContent: function justifyContent(value2) {
    return {
      WebkitJustifyContent: value2,
      justifyContent: value2
    };
  },
  transition: function transition2(value2) {
    return {
      msTransition: value2,
      MozTransition: value2,
      OTransition: value2,
      WebkitTransition: value2,
      transition: value2
    };
  },
  transform: function transform(value2) {
    return {
      msTransform: value2,
      MozTransform: value2,
      OTransform: value2,
      WebkitTransform: value2,
      transform: value2
    };
  },
  absolute: function absolute(value2) {
    var direction = value2 && value2.split(" ");
    return {
      position: "absolute",
      top: direction && direction[0],
      right: direction && direction[1],
      bottom: direction && direction[2],
      left: direction && direction[3]
    };
  },
  extend: function extend(name2, otherElementStyles) {
    var otherStyle = otherElementStyles[name2];
    if (otherStyle) {
      return otherStyle;
    }
    return {
      "extend": name2
    };
  }
};
var autoprefix = autoprefix$1.autoprefix = function autoprefix2(elements) {
  var prefixed = {};
  (0, _forOwn3.default)(elements, function(styles2, element2) {
    var expanded = {};
    (0, _forOwn3.default)(styles2, function(value2, key) {
      var transform2 = transforms[key];
      if (transform2) {
        expanded = _extends$f({}, expanded, transform2(value2));
      } else {
        expanded[key] = value2;
      }
    });
    prefixed[element2] = expanded;
  });
  return prefixed;
};
autoprefix$1.default = autoprefix;
var hover$1 = {};
Object.defineProperty(hover$1, "__esModule", {
  value: true
});
hover$1.hover = void 0;
var _extends$e = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var _react$3 = reactExports;
var _react2$3 = _interopRequireDefault$4(_react$3);
function _interopRequireDefault$4(obj) {
  return obj && obj.__esModule ? obj : { default: obj };
}
function _classCallCheck$9(instance2, Constructor) {
  if (!(instance2 instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn$9(self2, call2) {
  if (!self2) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call2 && (typeof call2 === "object" || typeof call2 === "function") ? call2 : self2;
}
function _inherits$9(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
  if (superClass)
    Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var hover = hover$1.hover = function hover2(Component2) {
  var Span = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "span";
  return function(_React$Component) {
    _inherits$9(Hover, _React$Component);
    function Hover() {
      var _ref;
      var _temp, _this, _ret;
      _classCallCheck$9(this, Hover);
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
      return _ret = (_temp = (_this = _possibleConstructorReturn$9(this, (_ref = Hover.__proto__ || Object.getPrototypeOf(Hover)).call.apply(_ref, [this].concat(args))), _this), _this.state = { hover: false }, _this.handleMouseOver = function() {
        return _this.setState({ hover: true });
      }, _this.handleMouseOut = function() {
        return _this.setState({ hover: false });
      }, _this.render = function() {
        return _react2$3.default.createElement(
          Span,
          { onMouseOver: _this.handleMouseOver, onMouseOut: _this.handleMouseOut },
          _react2$3.default.createElement(Component2, _extends$e({}, _this.props, _this.state))
        );
      }, _temp), _possibleConstructorReturn$9(_this, _ret);
    }
    return Hover;
  }(_react2$3.default.Component);
};
hover$1.default = hover;
var active$1 = {};
Object.defineProperty(active$1, "__esModule", {
  value: true
});
active$1.active = void 0;
var _extends$d = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var _react$2 = reactExports;
var _react2$2 = _interopRequireDefault$3(_react$2);
function _interopRequireDefault$3(obj) {
  return obj && obj.__esModule ? obj : { default: obj };
}
function _classCallCheck$8(instance2, Constructor) {
  if (!(instance2 instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn$8(self2, call2) {
  if (!self2) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call2 && (typeof call2 === "object" || typeof call2 === "function") ? call2 : self2;
}
function _inherits$8(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
  if (superClass)
    Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var active = active$1.active = function active2(Component2) {
  var Span = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "span";
  return function(_React$Component) {
    _inherits$8(Active, _React$Component);
    function Active() {
      var _ref;
      var _temp, _this, _ret;
      _classCallCheck$8(this, Active);
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
      return _ret = (_temp = (_this = _possibleConstructorReturn$8(this, (_ref = Active.__proto__ || Object.getPrototypeOf(Active)).call.apply(_ref, [this].concat(args))), _this), _this.state = { active: false }, _this.handleMouseDown = function() {
        return _this.setState({ active: true });
      }, _this.handleMouseUp = function() {
        return _this.setState({ active: false });
      }, _this.render = function() {
        return _react2$2.default.createElement(
          Span,
          { onMouseDown: _this.handleMouseDown, onMouseUp: _this.handleMouseUp },
          _react2$2.default.createElement(Component2, _extends$d({}, _this.props, _this.state))
        );
      }, _temp), _possibleConstructorReturn$8(_this, _ret);
    }
    return Active;
  }(_react2$2.default.Component);
};
active$1.default = active;
var loop = {};
Object.defineProperty(loop, "__esModule", {
  value: true
});
var loopable = function loopable2(i2, length2) {
  var props = {};
  var setProp = function setProp2(name2) {
    var value2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
    props[name2] = value2;
  };
  i2 === 0 && setProp("first-child");
  i2 === length2 - 1 && setProp("last-child");
  (i2 === 0 || i2 % 2 === 0) && setProp("even");
  Math.abs(i2 % 2) === 1 && setProp("odd");
  setProp("nth-child", i2);
  return props;
};
loop.default = loopable;
Object.defineProperty(lib$1, "__esModule", {
  value: true
});
lib$1.ReactCSS = lib$1.loop = lib$1.handleActive = handleHover = lib$1.handleHover = lib$1.hover = void 0;
var _flattenNames = flattenNames$1;
var _flattenNames2 = _interopRequireDefault$2(_flattenNames);
var _mergeClasses = mergeClasses$1;
var _mergeClasses2 = _interopRequireDefault$2(_mergeClasses);
var _autoprefix = autoprefix$1;
var _autoprefix2 = _interopRequireDefault$2(_autoprefix);
var _hover2 = hover$1;
var _hover3 = _interopRequireDefault$2(_hover2);
var _active = active$1;
var _active2 = _interopRequireDefault$2(_active);
var _loop2 = loop;
var _loop3 = _interopRequireDefault$2(_loop2);
function _interopRequireDefault$2(obj) {
  return obj && obj.__esModule ? obj : { default: obj };
}
lib$1.hover = _hover3.default;
var handleHover = lib$1.handleHover = _hover3.default;
lib$1.handleActive = _active2.default;
lib$1.loop = _loop3.default;
var ReactCSS = lib$1.ReactCSS = function ReactCSS2(classes) {
  for (var _len = arguments.length, activations = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    activations[_key - 1] = arguments[_key];
  }
  var activeNames = (0, _flattenNames2.default)(activations);
  var merged = (0, _mergeClasses2.default)(classes, activeNames);
  return (0, _autoprefix2.default)(merged);
};
var _default$4 = lib$1.default = ReactCSS;
var calculateChange$2 = function calculateChange(e2, hsl, direction, initialA, container) {
  var containerWidth = container.clientWidth;
  var containerHeight = container.clientHeight;
  var x2 = typeof e2.pageX === "number" ? e2.pageX : e2.touches[0].pageX;
  var y2 = typeof e2.pageY === "number" ? e2.pageY : e2.touches[0].pageY;
  var left2 = x2 - (container.getBoundingClientRect().left + window.pageXOffset);
  var top2 = y2 - (container.getBoundingClientRect().top + window.pageYOffset);
  if (direction === "vertical") {
    var a2 = void 0;
    if (top2 < 0) {
      a2 = 0;
    } else if (top2 > containerHeight) {
      a2 = 1;
    } else {
      a2 = Math.round(top2 * 100 / containerHeight) / 100;
    }
    if (hsl.a !== a2) {
      return {
        h: hsl.h,
        s: hsl.s,
        l: hsl.l,
        a: a2,
        source: "rgb"
      };
    }
  } else {
    var _a2 = void 0;
    if (left2 < 0) {
      _a2 = 0;
    } else if (left2 > containerWidth) {
      _a2 = 1;
    } else {
      _a2 = Math.round(left2 * 100 / containerWidth) / 100;
    }
    if (initialA !== _a2) {
      return {
        h: hsl.h,
        s: hsl.s,
        l: hsl.l,
        a: _a2,
        source: "rgb"
      };
    }
  }
  return null;
};
var checkboardCache = {};
var render = function render2(c1, c2, size2, serverCanvas) {
  if (typeof document === "undefined" && !serverCanvas) {
    return null;
  }
  var canvas = serverCanvas ? new serverCanvas() : document.createElement("canvas");
  canvas.width = size2 * 2;
  canvas.height = size2 * 2;
  var ctx = canvas.getContext("2d");
  if (!ctx) {
    return null;
  }
  ctx.fillStyle = c1;
  ctx.fillRect(0, 0, canvas.width, canvas.height);
  ctx.fillStyle = c2;
  ctx.fillRect(0, 0, size2, size2);
  ctx.translate(size2, size2);
  ctx.fillRect(0, 0, size2, size2);
  return canvas.toDataURL();
};
var get$7 = function get(c1, c2, size2, serverCanvas) {
  var key = c1 + "-" + c2 + "-" + size2 + (serverCanvas ? "-server" : "");
  if (checkboardCache[key]) {
    return checkboardCache[key];
  }
  var checkboard = render(c1, c2, size2, serverCanvas);
  checkboardCache[key] = checkboard;
  return checkboard;
};
var _extends$c = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var Checkboard = function Checkboard2(_ref) {
  var white = _ref.white, grey2 = _ref.grey, size2 = _ref.size, renderers = _ref.renderers, borderRadius2 = _ref.borderRadius, boxShadow2 = _ref.boxShadow, children = _ref.children;
  var styles2 = _default$4({
    "default": {
      grid: {
        borderRadius: borderRadius2,
        boxShadow: boxShadow2,
        absolute: "0px 0px 0px 0px",
        background: "url(" + get$7(white, grey2, size2, renderers.canvas) + ") center left"
      }
    }
  });
  return reactExports.isValidElement(children) ? React$5.cloneElement(children, _extends$c({}, children.props, { style: _extends$c({}, children.props.style, styles2.grid) })) : React$5.createElement("div", { style: styles2.grid });
};
Checkboard.defaultProps = {
  size: 8,
  white: "transparent",
  grey: "rgba(0,0,0,.08)",
  renderers: {}
};
var _extends$b = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var _createClass$7 = /* @__PURE__ */ function() {
  function defineProperties(target, props) {
    for (var i2 = 0; i2 < props.length; i2++) {
      var descriptor = props[i2];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor)
        descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }
  return function(Constructor, protoProps, staticProps) {
    if (protoProps)
      defineProperties(Constructor.prototype, protoProps);
    if (staticProps)
      defineProperties(Constructor, staticProps);
    return Constructor;
  };
}();
function _classCallCheck$7(instance2, Constructor) {
  if (!(instance2 instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn$7(self2, call2) {
  if (!self2) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call2 && (typeof call2 === "object" || typeof call2 === "function") ? call2 : self2;
}
function _inherits$7(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
  if (superClass)
    Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var Alpha = function(_ref) {
  _inherits$7(Alpha2, _ref);
  function Alpha2() {
    var _ref2;
    var _temp, _this, _ret;
    _classCallCheck$7(this, Alpha2);
    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    return _ret = (_temp = (_this = _possibleConstructorReturn$7(this, (_ref2 = Alpha2.__proto__ || Object.getPrototypeOf(Alpha2)).call.apply(_ref2, [this].concat(args))), _this), _this.handleChange = function(e2) {
      var change = calculateChange$2(e2, _this.props.hsl, _this.props.direction, _this.props.a, _this.container);
      change && typeof _this.props.onChange === "function" && _this.props.onChange(change, e2);
    }, _this.handleMouseDown = function(e2) {
      _this.handleChange(e2);
      window.addEventListener("mousemove", _this.handleChange);
      window.addEventListener("mouseup", _this.handleMouseUp);
    }, _this.handleMouseUp = function() {
      _this.unbindEventListeners();
    }, _this.unbindEventListeners = function() {
      window.removeEventListener("mousemove", _this.handleChange);
      window.removeEventListener("mouseup", _this.handleMouseUp);
    }, _temp), _possibleConstructorReturn$7(_this, _ret);
  }
  _createClass$7(Alpha2, [{
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      this.unbindEventListeners();
    }
  }, {
    key: "render",
    value: function render3() {
      var _this2 = this;
      var rgb = this.props.rgb;
      var styles2 = _default$4({
        "default": {
          alpha: {
            absolute: "0px 0px 0px 0px",
            borderRadius: this.props.radius
          },
          checkboard: {
            absolute: "0px 0px 0px 0px",
            overflow: "hidden",
            borderRadius: this.props.radius
          },
          gradient: {
            absolute: "0px 0px 0px 0px",
            background: "linear-gradient(to right, rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + ", 0) 0%,\n           rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + ", 1) 100%)",
            boxShadow: this.props.shadow,
            borderRadius: this.props.radius
          },
          container: {
            position: "relative",
            height: "100%",
            margin: "0 3px"
          },
          pointer: {
            position: "absolute",
            left: rgb.a * 100 + "%"
          },
          slider: {
            width: "4px",
            borderRadius: "1px",
            height: "8px",
            boxShadow: "0 0 2px rgba(0, 0, 0, .6)",
            background: "#fff",
            marginTop: "1px",
            transform: "translateX(-2px)"
          }
        },
        "vertical": {
          gradient: {
            background: "linear-gradient(to bottom, rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + ", 0) 0%,\n           rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + ", 1) 100%)"
          },
          pointer: {
            left: 0,
            top: rgb.a * 100 + "%"
          }
        },
        "overwrite": _extends$b({}, this.props.style)
      }, {
        vertical: this.props.direction === "vertical",
        overwrite: true
      });
      return React$5.createElement(
        "div",
        { style: styles2.alpha },
        React$5.createElement(
          "div",
          { style: styles2.checkboard },
          React$5.createElement(Checkboard, { renderers: this.props.renderers })
        ),
        React$5.createElement("div", { style: styles2.gradient }),
        React$5.createElement(
          "div",
          {
            style: styles2.container,
            ref: function ref(container) {
              return _this2.container = container;
            },
            onMouseDown: this.handleMouseDown,
            onTouchMove: this.handleChange,
            onTouchStart: this.handleChange
          },
          React$5.createElement(
            "div",
            { style: styles2.pointer },
            this.props.pointer ? React$5.createElement(this.props.pointer, this.props) : React$5.createElement("div", { style: styles2.slider })
          )
        )
      );
    }
  }]);
  return Alpha2;
}(reactExports.PureComponent || reactExports.Component);
var _createClass$6 = /* @__PURE__ */ function() {
  function defineProperties(target, props) {
    for (var i2 = 0; i2 < props.length; i2++) {
      var descriptor = props[i2];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor)
        descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }
  return function(Constructor, protoProps, staticProps) {
    if (protoProps)
      defineProperties(Constructor.prototype, protoProps);
    if (staticProps)
      defineProperties(Constructor, staticProps);
    return Constructor;
  };
}();
function _defineProperty$1(obj, key, value2) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value: value2, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value2;
  }
  return obj;
}
function _classCallCheck$6(instance2, Constructor) {
  if (!(instance2 instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn$6(self2, call2) {
  if (!self2) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call2 && (typeof call2 === "object" || typeof call2 === "function") ? call2 : self2;
}
function _inherits$6(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
  if (superClass)
    Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var DEFAULT_ARROW_OFFSET = 1;
var UP_KEY_CODE = 38;
var DOWN_KEY_CODE = 40;
var VALID_KEY_CODES = [UP_KEY_CODE, DOWN_KEY_CODE];
var isValidKeyCode = function isValidKeyCode2(keyCode) {
  return VALID_KEY_CODES.indexOf(keyCode) > -1;
};
var getNumberValue = function getNumberValue2(value2) {
  return Number(String(value2).replace(/%/g, ""));
};
var idCounter = 1;
var EditableInput = function(_ref) {
  _inherits$6(EditableInput2, _ref);
  function EditableInput2(props) {
    _classCallCheck$6(this, EditableInput2);
    var _this = _possibleConstructorReturn$6(this, (EditableInput2.__proto__ || Object.getPrototypeOf(EditableInput2)).call(this));
    _this.handleBlur = function() {
      if (_this.state.blurValue) {
        _this.setState({ value: _this.state.blurValue, blurValue: null });
      }
    };
    _this.handleChange = function(e2) {
      _this.setUpdatedValue(e2.target.value, e2);
    };
    _this.handleKeyDown = function(e2) {
      var value2 = getNumberValue(e2.target.value);
      if (!isNaN(value2) && isValidKeyCode(e2.keyCode)) {
        var offset2 = _this.getArrowOffset();
        var updatedValue = e2.keyCode === UP_KEY_CODE ? value2 + offset2 : value2 - offset2;
        _this.setUpdatedValue(updatedValue, e2);
      }
    };
    _this.handleDrag = function(e2) {
      if (_this.props.dragLabel) {
        var newValue = Math.round(_this.props.value + e2.movementX);
        if (newValue >= 0 && newValue <= _this.props.dragMax) {
          _this.props.onChange && _this.props.onChange(_this.getValueObjectWithLabel(newValue), e2);
        }
      }
    };
    _this.handleMouseDown = function(e2) {
      if (_this.props.dragLabel) {
        e2.preventDefault();
        _this.handleDrag(e2);
        window.addEventListener("mousemove", _this.handleDrag);
        window.addEventListener("mouseup", _this.handleMouseUp);
      }
    };
    _this.handleMouseUp = function() {
      _this.unbindEventListeners();
    };
    _this.unbindEventListeners = function() {
      window.removeEventListener("mousemove", _this.handleDrag);
      window.removeEventListener("mouseup", _this.handleMouseUp);
    };
    _this.state = {
      value: String(props.value).toUpperCase(),
      blurValue: String(props.value).toUpperCase()
    };
    _this.inputId = "rc-editable-input-" + idCounter++;
    return _this;
  }
  _createClass$6(EditableInput2, [{
    key: "componentDidUpdate",
    value: function componentDidUpdate(prevProps, prevState) {
      if (this.props.value !== this.state.value && (prevProps.value !== this.props.value || prevState.value !== this.state.value)) {
        if (this.input === document.activeElement) {
          this.setState({ blurValue: String(this.props.value).toUpperCase() });
        } else {
          this.setState({ value: String(this.props.value).toUpperCase(), blurValue: !this.state.blurValue && String(this.props.value).toUpperCase() });
        }
      }
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      this.unbindEventListeners();
    }
  }, {
    key: "getValueObjectWithLabel",
    value: function getValueObjectWithLabel(value2) {
      return _defineProperty$1({}, this.props.label, value2);
    }
  }, {
    key: "getArrowOffset",
    value: function getArrowOffset() {
      return this.props.arrowOffset || DEFAULT_ARROW_OFFSET;
    }
  }, {
    key: "setUpdatedValue",
    value: function setUpdatedValue(value2, e2) {
      var onChangeValue = this.props.label ? this.getValueObjectWithLabel(value2) : value2;
      this.props.onChange && this.props.onChange(onChangeValue, e2);
      this.setState({ value: value2 });
    }
  }, {
    key: "render",
    value: function render3() {
      var _this2 = this;
      var styles2 = _default$4({
        "default": {
          wrap: {
            position: "relative"
          }
        },
        "user-override": {
          wrap: this.props.style && this.props.style.wrap ? this.props.style.wrap : {},
          input: this.props.style && this.props.style.input ? this.props.style.input : {},
          label: this.props.style && this.props.style.label ? this.props.style.label : {}
        },
        "dragLabel-true": {
          label: {
            cursor: "ew-resize"
          }
        }
      }, {
        "user-override": true
      }, this.props);
      return React$5.createElement(
        "div",
        { style: styles2.wrap },
        React$5.createElement("input", {
          id: this.inputId,
          style: styles2.input,
          ref: function ref(input2) {
            return _this2.input = input2;
          },
          value: this.state.value,
          onKeyDown: this.handleKeyDown,
          onChange: this.handleChange,
          onBlur: this.handleBlur,
          placeholder: this.props.placeholder,
          spellCheck: "false"
        }),
        this.props.label && !this.props.hideLabel ? React$5.createElement(
          "label",
          {
            htmlFor: this.inputId,
            style: styles2.label,
            onMouseDown: this.handleMouseDown
          },
          this.props.label
        ) : null
      );
    }
  }]);
  return EditableInput2;
}(reactExports.PureComponent || reactExports.Component);
var calculateChange$1 = function calculateChange2(e2, direction, hsl, container) {
  var containerWidth = container.clientWidth;
  var containerHeight = container.clientHeight;
  var x2 = typeof e2.pageX === "number" ? e2.pageX : e2.touches[0].pageX;
  var y2 = typeof e2.pageY === "number" ? e2.pageY : e2.touches[0].pageY;
  var left2 = x2 - (container.getBoundingClientRect().left + window.pageXOffset);
  var top2 = y2 - (container.getBoundingClientRect().top + window.pageYOffset);
  if (direction === "vertical") {
    var h3 = void 0;
    if (top2 < 0) {
      h3 = 359;
    } else if (top2 > containerHeight) {
      h3 = 0;
    } else {
      var percent2 = -(top2 * 100 / containerHeight) + 100;
      h3 = 360 * percent2 / 100;
    }
    if (hsl.h !== h3) {
      return {
        h: h3,
        s: hsl.s,
        l: hsl.l,
        a: hsl.a,
        source: "hsl"
      };
    }
  } else {
    var _h = void 0;
    if (left2 < 0) {
      _h = 0;
    } else if (left2 > containerWidth) {
      _h = 359;
    } else {
      var _percent = left2 * 100 / containerWidth;
      _h = 360 * _percent / 100;
    }
    if (hsl.h !== _h) {
      return {
        h: _h,
        s: hsl.s,
        l: hsl.l,
        a: hsl.a,
        source: "hsl"
      };
    }
  }
  return null;
};
var _createClass$5 = /* @__PURE__ */ function() {
  function defineProperties(target, props) {
    for (var i2 = 0; i2 < props.length; i2++) {
      var descriptor = props[i2];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor)
        descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }
  return function(Constructor, protoProps, staticProps) {
    if (protoProps)
      defineProperties(Constructor.prototype, protoProps);
    if (staticProps)
      defineProperties(Constructor, staticProps);
    return Constructor;
  };
}();
function _classCallCheck$5(instance2, Constructor) {
  if (!(instance2 instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn$5(self2, call2) {
  if (!self2) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call2 && (typeof call2 === "object" || typeof call2 === "function") ? call2 : self2;
}
function _inherits$5(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
  if (superClass)
    Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var Hue = function(_ref) {
  _inherits$5(Hue2, _ref);
  function Hue2() {
    var _ref2;
    var _temp, _this, _ret;
    _classCallCheck$5(this, Hue2);
    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    return _ret = (_temp = (_this = _possibleConstructorReturn$5(this, (_ref2 = Hue2.__proto__ || Object.getPrototypeOf(Hue2)).call.apply(_ref2, [this].concat(args))), _this), _this.handleChange = function(e2) {
      var change = calculateChange$1(e2, _this.props.direction, _this.props.hsl, _this.container);
      change && typeof _this.props.onChange === "function" && _this.props.onChange(change, e2);
    }, _this.handleMouseDown = function(e2) {
      _this.handleChange(e2);
      window.addEventListener("mousemove", _this.handleChange);
      window.addEventListener("mouseup", _this.handleMouseUp);
    }, _this.handleMouseUp = function() {
      _this.unbindEventListeners();
    }, _temp), _possibleConstructorReturn$5(_this, _ret);
  }
  _createClass$5(Hue2, [{
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      this.unbindEventListeners();
    }
  }, {
    key: "unbindEventListeners",
    value: function unbindEventListeners() {
      window.removeEventListener("mousemove", this.handleChange);
      window.removeEventListener("mouseup", this.handleMouseUp);
    }
  }, {
    key: "render",
    value: function render3() {
      var _this2 = this;
      var _props$direction = this.props.direction, direction = _props$direction === void 0 ? "horizontal" : _props$direction;
      var styles2 = _default$4({
        "default": {
          hue: {
            absolute: "0px 0px 0px 0px",
            borderRadius: this.props.radius,
            boxShadow: this.props.shadow
          },
          container: {
            padding: "0 2px",
            position: "relative",
            height: "100%",
            borderRadius: this.props.radius
          },
          pointer: {
            position: "absolute",
            left: this.props.hsl.h * 100 / 360 + "%"
          },
          slider: {
            marginTop: "1px",
            width: "4px",
            borderRadius: "1px",
            height: "8px",
            boxShadow: "0 0 2px rgba(0, 0, 0, .6)",
            background: "#fff",
            transform: "translateX(-2px)"
          }
        },
        "vertical": {
          pointer: {
            left: "0px",
            top: -(this.props.hsl.h * 100 / 360) + 100 + "%"
          }
        }
      }, { vertical: direction === "vertical" });
      return React$5.createElement(
        "div",
        { style: styles2.hue },
        React$5.createElement(
          "div",
          {
            className: "hue-" + direction,
            style: styles2.container,
            ref: function ref(container) {
              return _this2.container = container;
            },
            onMouseDown: this.handleMouseDown,
            onTouchMove: this.handleChange,
            onTouchStart: this.handleChange
          },
          React$5.createElement(
            "style",
            null,
            "\n            .hue-horizontal {\n              background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0\n                33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n              background: -webkit-linear-gradient(to right, #f00 0%, #ff0\n                17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n            }\n\n            .hue-vertical {\n              background: linear-gradient(to top, #f00 0%, #ff0 17%, #0f0 33%,\n                #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n              background: -webkit-linear-gradient(to top, #f00 0%, #ff0 17%,\n                #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n            }\n          "
          ),
          React$5.createElement(
            "div",
            { style: styles2.pointer },
            this.props.pointer ? React$5.createElement(this.props.pointer, this.props) : React$5.createElement("div", { style: styles2.slider })
          )
        )
      );
    }
  }]);
  return Hue2;
}(reactExports.PureComponent || reactExports.Component);
var propTypes$2 = { exports: {} };
var ReactPropTypesSecret$1 = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
var ReactPropTypesSecret = ReactPropTypesSecret_1;
function emptyFunction() {
}
function emptyFunctionWithReset() {
}
emptyFunctionWithReset.resetWarningCache = emptyFunction;
var factoryWithThrowingShims = function() {
  function shim2(props, propName, componentName, location2, propFullName, secret) {
    if (secret === ReactPropTypesSecret) {
      return;
    }
    var err = new Error(
      "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
    );
    err.name = "Invariant Violation";
    throw err;
  }
  shim2.isRequired = shim2;
  function getShim() {
    return shim2;
  }
  var ReactPropTypes = {
    array: shim2,
    bigint: shim2,
    bool: shim2,
    func: shim2,
    number: shim2,
    object: shim2,
    string: shim2,
    symbol: shim2,
    any: shim2,
    arrayOf: getShim,
    element: shim2,
    elementType: shim2,
    instanceOf: getShim,
    node: shim2,
    objectOf: getShim,
    oneOf: getShim,
    oneOfType: getShim,
    shape: getShim,
    exact: getShim,
    checkPropTypes: emptyFunctionWithReset,
    resetWarningCache: emptyFunction
  };
  ReactPropTypes.PropTypes = ReactPropTypes;
  return ReactPropTypes;
};
{
  propTypes$2.exports = factoryWithThrowingShims();
}
var propTypesExports = propTypes$2.exports;
const PropTypes$4 = /* @__PURE__ */ getDefaultExportFromCjs(propTypesExports);
function listCacheClear$1() {
  this.__data__ = [];
  this.size = 0;
}
function eq$2(value2, other) {
  return value2 === other || value2 !== value2 && other !== other;
}
function assocIndexOf$1(array4, key) {
  var length2 = array4.length;
  while (length2--) {
    if (eq$2(array4[length2][0], key)) {
      return length2;
    }
  }
  return -1;
}
var arrayProto$1 = Array.prototype;
var splice$2 = arrayProto$1.splice;
function listCacheDelete$1(key) {
  var data = this.__data__, index2 = assocIndexOf$1(data, key);
  if (index2 < 0) {
    return false;
  }
  var lastIndex = data.length - 1;
  if (index2 == lastIndex) {
    data.pop();
  } else {
    splice$2.call(data, index2, 1);
  }
  --this.size;
  return true;
}
function listCacheGet$1(key) {
  var data = this.__data__, index2 = assocIndexOf$1(data, key);
  return index2 < 0 ? void 0 : data[index2][1];
}
function listCacheHas$1(key) {
  return assocIndexOf$1(this.__data__, key) > -1;
}
function listCacheSet$1(key, value2) {
  var data = this.__data__, index2 = assocIndexOf$1(data, key);
  if (index2 < 0) {
    ++this.size;
    data.push([key, value2]);
  } else {
    data[index2][1] = value2;
  }
  return this;
}
function ListCache$1(entries) {
  var index2 = -1, length2 = entries == null ? 0 : entries.length;
  this.clear();
  while (++index2 < length2) {
    var entry = entries[index2];
    this.set(entry[0], entry[1]);
  }
}
ListCache$1.prototype.clear = listCacheClear$1;
ListCache$1.prototype["delete"] = listCacheDelete$1;
ListCache$1.prototype.get = listCacheGet$1;
ListCache$1.prototype.has = listCacheHas$1;
ListCache$1.prototype.set = listCacheSet$1;
function stackClear() {
  this.__data__ = new ListCache$1();
  this.size = 0;
}
function stackDelete(key) {
  var data = this.__data__, result = data["delete"](key);
  this.size = data.size;
  return result;
}
function stackGet(key) {
  return this.__data__.get(key);
}
function stackHas(key) {
  return this.__data__.has(key);
}
var freeGlobal$1 = typeof global == "object" && global && global.Object === Object && global;
var freeSelf$1 = typeof self == "object" && self && self.Object === Object && self;
var root$4 = freeGlobal$1 || freeSelf$1 || Function("return this")();
var Symbol$2 = root$4.Symbol;
var objectProto$f = Object.prototype;
var hasOwnProperty$e = objectProto$f.hasOwnProperty;
var nativeObjectToString$1 = objectProto$f.toString;
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
function getRawTag(value2) {
  var isOwn = hasOwnProperty$e.call(value2, symToStringTag$1), tag = value2[symToStringTag$1];
  try {
    value2[symToStringTag$1] = void 0;
    var unmasked = true;
  } catch (e2) {
  }
  var result = nativeObjectToString$1.call(value2);
  if (unmasked) {
    if (isOwn) {
      value2[symToStringTag$1] = tag;
    } else {
      delete value2[symToStringTag$1];
    }
  }
  return result;
}
var objectProto$e = Object.prototype;
var nativeObjectToString = objectProto$e.toString;
function objectToString$1(value2) {
  return nativeObjectToString.call(value2);
}
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
function baseGetTag(value2) {
  if (value2 == null) {
    return value2 === void 0 ? undefinedTag : nullTag;
  }
  return symToStringTag && symToStringTag in Object(value2) ? getRawTag(value2) : objectToString$1(value2);
}
function isObject$4(value2) {
  var type4 = typeof value2;
  return value2 != null && (type4 == "object" || type4 == "function");
}
var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
function isFunction$4(value2) {
  if (!isObject$4(value2)) {
    return false;
  }
  var tag = baseGetTag(value2);
  return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
}
var coreJsData$1 = root$4["__core-js_shared__"];
var maskSrcKey$1 = function() {
  var uid2 = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
  return uid2 ? "Symbol(src)_1." + uid2 : "";
}();
function isMasked$1(func) {
  return !!maskSrcKey$1 && maskSrcKey$1 in func;
}
var funcProto$3 = Function.prototype;
var funcToString$3 = funcProto$3.toString;
function toSource$1(func) {
  if (func != null) {
    try {
      return funcToString$3.call(func);
    } catch (e2) {
    }
    try {
      return func + "";
    } catch (e2) {
    }
  }
  return "";
}
var reRegExpChar$1 = /[\\^$.*+?()[\]{}|]/g;
var reIsHostCtor$1 = /^\[object .+?Constructor\]$/;
var funcProto$2 = Function.prototype, objectProto$d = Object.prototype;
var funcToString$2 = funcProto$2.toString;
var hasOwnProperty$d = objectProto$d.hasOwnProperty;
var reIsNative$1 = RegExp(
  "^" + funcToString$2.call(hasOwnProperty$d).replace(reRegExpChar$1, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function baseIsNative$1(value2) {
  if (!isObject$4(value2) || isMasked$1(value2)) {
    return false;
  }
  var pattern4 = isFunction$4(value2) ? reIsNative$1 : reIsHostCtor$1;
  return pattern4.test(toSource$1(value2));
}
function getValue$1(object4, key) {
  return object4 == null ? void 0 : object4[key];
}
function getNative$1(object4, key) {
  var value2 = getValue$1(object4, key);
  return baseIsNative$1(value2) ? value2 : void 0;
}
var Map$2 = getNative$1(root$4, "Map");
var nativeCreate$1 = getNative$1(Object, "create");
function hashClear$1() {
  this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
  this.size = 0;
}
function hashDelete$1(key) {
  var result = this.has(key) && delete this.__data__[key];
  this.size -= result ? 1 : 0;
  return result;
}
var HASH_UNDEFINED$3 = "__lodash_hash_undefined__";
var objectProto$c = Object.prototype;
var hasOwnProperty$c = objectProto$c.hasOwnProperty;
function hashGet$1(key) {
  var data = this.__data__;
  if (nativeCreate$1) {
    var result = data[key];
    return result === HASH_UNDEFINED$3 ? void 0 : result;
  }
  return hasOwnProperty$c.call(data, key) ? data[key] : void 0;
}
var objectProto$b = Object.prototype;
var hasOwnProperty$b = objectProto$b.hasOwnProperty;
function hashHas$1(key) {
  var data = this.__data__;
  return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$b.call(data, key);
}
var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
function hashSet$1(key, value2) {
  var data = this.__data__;
  this.size += this.has(key) ? 0 : 1;
  data[key] = nativeCreate$1 && value2 === void 0 ? HASH_UNDEFINED$2 : value2;
  return this;
}
function Hash$1(entries) {
  var index2 = -1, length2 = entries == null ? 0 : entries.length;
  this.clear();
  while (++index2 < length2) {
    var entry = entries[index2];
    this.set(entry[0], entry[1]);
  }
}
Hash$1.prototype.clear = hashClear$1;
Hash$1.prototype["delete"] = hashDelete$1;
Hash$1.prototype.get = hashGet$1;
Hash$1.prototype.has = hashHas$1;
Hash$1.prototype.set = hashSet$1;
function mapCacheClear$1() {
  this.size = 0;
  this.__data__ = {
    "hash": new Hash$1(),
    "map": new (Map$2 || ListCache$1)(),
    "string": new Hash$1()
  };
}
function isKeyable$1(value2) {
  var type4 = typeof value2;
  return type4 == "string" || type4 == "number" || type4 == "symbol" || type4 == "boolean" ? value2 !== "__proto__" : value2 === null;
}
function getMapData$1(map2, key) {
  var data = map2.__data__;
  return isKeyable$1(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
}
function mapCacheDelete$1(key) {
  var result = getMapData$1(this, key)["delete"](key);
  this.size -= result ? 1 : 0;
  return result;
}
function mapCacheGet$1(key) {
  return getMapData$1(this, key).get(key);
}
function mapCacheHas$1(key) {
  return getMapData$1(this, key).has(key);
}
function mapCacheSet$1(key, value2) {
  var data = getMapData$1(this, key), size2 = data.size;
  data.set(key, value2);
  this.size += data.size == size2 ? 0 : 1;
  return this;
}
function MapCache$1(entries) {
  var index2 = -1, length2 = entries == null ? 0 : entries.length;
  this.clear();
  while (++index2 < length2) {
    var entry = entries[index2];
    this.set(entry[0], entry[1]);
  }
}
MapCache$1.prototype.clear = mapCacheClear$1;
MapCache$1.prototype["delete"] = mapCacheDelete$1;
MapCache$1.prototype.get = mapCacheGet$1;
MapCache$1.prototype.has = mapCacheHas$1;
MapCache$1.prototype.set = mapCacheSet$1;
var LARGE_ARRAY_SIZE = 200;
function stackSet(key, value2) {
  var data = this.__data__;
  if (data instanceof ListCache$1) {
    var pairs = data.__data__;
    if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
      pairs.push([key, value2]);
      this.size = ++data.size;
      return this;
    }
    data = this.__data__ = new MapCache$1(pairs);
  }
  data.set(key, value2);
  this.size = data.size;
  return this;
}
function Stack(entries) {
  var data = this.__data__ = new ListCache$1(entries);
  this.size = data.size;
}
Stack.prototype.clear = stackClear;
Stack.prototype["delete"] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
var defineProperty$1 = function() {
  try {
    var func = getNative$1(Object, "defineProperty");
    func({}, "", {});
    return func;
  } catch (e2) {
  }
}();
function baseAssignValue(object4, key, value2) {
  if (key == "__proto__" && defineProperty$1) {
    defineProperty$1(object4, key, {
      "configurable": true,
      "enumerable": true,
      "value": value2,
      "writable": true
    });
  } else {
    object4[key] = value2;
  }
}
function assignMergeValue(object4, key, value2) {
  if (value2 !== void 0 && !eq$2(object4[key], value2) || value2 === void 0 && !(key in object4)) {
    baseAssignValue(object4, key, value2);
  }
}
function createBaseFor(fromRight) {
  return function(object4, iteratee, keysFunc) {
    var index2 = -1, iterable = Object(object4), props = keysFunc(object4), length2 = props.length;
    while (length2--) {
      var key = props[++index2];
      if (iteratee(iterable[key], key, iterable) === false) {
        break;
      }
    }
    return object4;
  };
}
var baseFor = createBaseFor();
var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
var Buffer$2 = moduleExports$2 ? root$4.Buffer : void 0;
Buffer$2 ? Buffer$2.allocUnsafe : void 0;
function cloneBuffer(buffer, isDeep) {
  {
    return buffer.slice();
  }
}
var Uint8Array$1 = root$4.Uint8Array;
function cloneArrayBuffer(arrayBuffer) {
  var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
  return result;
}
function cloneTypedArray(typedArray, isDeep) {
  var buffer = cloneArrayBuffer(typedArray.buffer);
  return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}
function copyArray(source2, array4) {
  var index2 = -1, length2 = source2.length;
  array4 || (array4 = Array(length2));
  while (++index2 < length2) {
    array4[index2] = source2[index2];
  }
  return array4;
}
var objectCreate = Object.create;
var baseCreate = /* @__PURE__ */ function() {
  function object4() {
  }
  return function(proto2) {
    if (!isObject$4(proto2)) {
      return {};
    }
    if (objectCreate) {
      return objectCreate(proto2);
    }
    object4.prototype = proto2;
    var result = new object4();
    object4.prototype = void 0;
    return result;
  };
}();
function overArg(func, transform2) {
  return function(arg) {
    return func(transform2(arg));
  };
}
var getPrototype = overArg(Object.getPrototypeOf, Object);
var objectProto$a = Object.prototype;
function isPrototype(value2) {
  var Ctor = value2 && value2.constructor, proto2 = typeof Ctor == "function" && Ctor.prototype || objectProto$a;
  return value2 === proto2;
}
function initCloneObject(object4) {
  return typeof object4.constructor == "function" && !isPrototype(object4) ? baseCreate(getPrototype(object4)) : {};
}
function isObjectLike$1(value2) {
  return value2 != null && typeof value2 == "object";
}
var argsTag$2 = "[object Arguments]";
function baseIsArguments(value2) {
  return isObjectLike$1(value2) && baseGetTag(value2) == argsTag$2;
}
var objectProto$9 = Object.prototype;
var hasOwnProperty$a = objectProto$9.hasOwnProperty;
var propertyIsEnumerable$1 = objectProto$9.propertyIsEnumerable;
var isArguments = baseIsArguments(/* @__PURE__ */ function() {
  return arguments;
}()) ? baseIsArguments : function(value2) {
  return isObjectLike$1(value2) && hasOwnProperty$a.call(value2, "callee") && !propertyIsEnumerable$1.call(value2, "callee");
};
var isArray$6 = Array.isArray;
var MAX_SAFE_INTEGER$1 = 9007199254740991;
function isLength(value2) {
  return typeof value2 == "number" && value2 > -1 && value2 % 1 == 0 && value2 <= MAX_SAFE_INTEGER$1;
}
function isArrayLike(value2) {
  return value2 != null && isLength(value2.length) && !isFunction$4(value2);
}
function isArrayLikeObject(value2) {
  return isObjectLike$1(value2) && isArrayLike(value2);
}
function stubFalse() {
  return false;
}
var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
var Buffer$1 = moduleExports$1 ? root$4.Buffer : void 0;
var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
var isBuffer$1 = nativeIsBuffer || stubFalse;
var objectTag$3 = "[object Object]";
var funcProto$1 = Function.prototype, objectProto$8 = Object.prototype;
var funcToString$1 = funcProto$1.toString;
var hasOwnProperty$9 = objectProto$8.hasOwnProperty;
var objectCtorString = funcToString$1.call(Object);
function isPlainObject$3(value2) {
  if (!isObjectLike$1(value2) || baseGetTag(value2) != objectTag$3) {
    return false;
  }
  var proto2 = getPrototype(value2);
  if (proto2 === null) {
    return true;
  }
  var Ctor = hasOwnProperty$9.call(proto2, "constructor") && proto2.constructor;
  return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString$1.call(Ctor) == objectCtorString;
}
var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag$1 = "[object Function]", mapTag$2 = "[object Map]", numberTag$1 = "[object Number]", objectTag$2 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$2 = "[object Set]", stringTag$1 = "[object String]", weakMapTag$1 = "[object WeakMap]";
var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
function baseIsTypedArray(value2) {
  return isObjectLike$1(value2) && isLength(value2.length) && !!typedArrayTags[baseGetTag(value2)];
}
function baseUnary(func) {
  return function(value2) {
    return func(value2);
  };
}
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
var moduleExports = freeModule && freeModule.exports === freeExports;
var freeProcess = moduleExports && freeGlobal$1.process;
var nodeUtil = function() {
  try {
    var types2 = freeModule && freeModule.require && freeModule.require("util").types;
    if (types2) {
      return types2;
    }
    return freeProcess && freeProcess.binding && freeProcess.binding("util");
  } catch (e2) {
  }
}();
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
var isTypedArray$1 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
function safeGet(object4, key) {
  if (key === "constructor" && typeof object4[key] === "function") {
    return;
  }
  if (key == "__proto__") {
    return;
  }
  return object4[key];
}
var objectProto$7 = Object.prototype;
var hasOwnProperty$8 = objectProto$7.hasOwnProperty;
function assignValue(object4, key, value2) {
  var objValue = object4[key];
  if (!(hasOwnProperty$8.call(object4, key) && eq$2(objValue, value2)) || value2 === void 0 && !(key in object4)) {
    baseAssignValue(object4, key, value2);
  }
}
function copyObject(source2, props, object4, customizer) {
  var isNew = !object4;
  object4 || (object4 = {});
  var index2 = -1, length2 = props.length;
  while (++index2 < length2) {
    var key = props[index2];
    var newValue = void 0;
    if (newValue === void 0) {
      newValue = source2[key];
    }
    if (isNew) {
      baseAssignValue(object4, key, newValue);
    } else {
      assignValue(object4, key, newValue);
    }
  }
  return object4;
}
function baseTimes(n2, iteratee) {
  var index2 = -1, result = Array(n2);
  while (++index2 < n2) {
    result[index2] = iteratee(index2);
  }
  return result;
}
var MAX_SAFE_INTEGER = 9007199254740991;
var reIsUint = /^(?:0|[1-9]\d*)$/;
function isIndex(value2, length2) {
  var type4 = typeof value2;
  length2 = length2 == null ? MAX_SAFE_INTEGER : length2;
  return !!length2 && (type4 == "number" || type4 != "symbol" && reIsUint.test(value2)) && (value2 > -1 && value2 % 1 == 0 && value2 < length2);
}
var objectProto$6 = Object.prototype;
var hasOwnProperty$7 = objectProto$6.hasOwnProperty;
function arrayLikeKeys(value2, inherited) {
  var isArr = isArray$6(value2), isArg = !isArr && isArguments(value2), isBuff = !isArr && !isArg && isBuffer$1(value2), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value2), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value2.length, String) : [], length2 = result.length;
  for (var key in value2) {
    if ((inherited || hasOwnProperty$7.call(value2, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
    (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
    isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
    isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
    isIndex(key, length2)))) {
      result.push(key);
    }
  }
  return result;
}
function nativeKeysIn(object4) {
  var result = [];
  if (object4 != null) {
    for (var key in Object(object4)) {
      result.push(key);
    }
  }
  return result;
}
var objectProto$5 = Object.prototype;
var hasOwnProperty$6 = objectProto$5.hasOwnProperty;
function baseKeysIn(object4) {
  if (!isObject$4(object4)) {
    return nativeKeysIn(object4);
  }
  var isProto = isPrototype(object4), result = [];
  for (var key in object4) {
    if (!(key == "constructor" && (isProto || !hasOwnProperty$6.call(object4, key)))) {
      result.push(key);
    }
  }
  return result;
}
function keysIn(object4) {
  return isArrayLike(object4) ? arrayLikeKeys(object4, true) : baseKeysIn(object4);
}
function toPlainObject(value2) {
  return copyObject(value2, keysIn(value2));
}
function baseMergeDeep(object4, source2, key, srcIndex, mergeFunc, customizer, stack) {
  var objValue = safeGet(object4, key), srcValue = safeGet(source2, key), stacked = stack.get(srcValue);
  if (stacked) {
    assignMergeValue(object4, key, stacked);
    return;
  }
  var newValue = customizer ? customizer(objValue, srcValue, key + "", object4, source2, stack) : void 0;
  var isCommon = newValue === void 0;
  if (isCommon) {
    var isArr = isArray$6(srcValue), isBuff = !isArr && isBuffer$1(srcValue), isTyped = !isArr && !isBuff && isTypedArray$1(srcValue);
    newValue = srcValue;
    if (isArr || isBuff || isTyped) {
      if (isArray$6(objValue)) {
        newValue = objValue;
      } else if (isArrayLikeObject(objValue)) {
        newValue = copyArray(objValue);
      } else if (isBuff) {
        isCommon = false;
        newValue = cloneBuffer(srcValue);
      } else if (isTyped) {
        isCommon = false;
        newValue = cloneTypedArray(srcValue);
      } else {
        newValue = [];
      }
    } else if (isPlainObject$3(srcValue) || isArguments(srcValue)) {
      newValue = objValue;
      if (isArguments(objValue)) {
        newValue = toPlainObject(objValue);
      } else if (!isObject$4(objValue) || isFunction$4(objValue)) {
        newValue = initCloneObject(srcValue);
      }
    } else {
      isCommon = false;
    }
  }
  if (isCommon) {
    stack.set(srcValue, newValue);
    mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
    stack["delete"](srcValue);
  }
  assignMergeValue(object4, key, newValue);
}
function baseMerge(object4, source2, srcIndex, customizer, stack) {
  if (object4 === source2) {
    return;
  }
  baseFor(source2, function(srcValue, key) {
    stack || (stack = new Stack());
    if (isObject$4(srcValue)) {
      baseMergeDeep(object4, source2, key, srcIndex, baseMerge, customizer, stack);
    } else {
      var newValue = customizer ? customizer(safeGet(object4, key), srcValue, key + "", object4, source2, stack) : void 0;
      if (newValue === void 0) {
        newValue = srcValue;
      }
      assignMergeValue(object4, key, newValue);
    }
  }, keysIn);
}
function identity$2(value2) {
  return value2;
}
function apply(func, thisArg, args) {
  switch (args.length) {
    case 0:
      return func.call(thisArg);
    case 1:
      return func.call(thisArg, args[0]);
    case 2:
      return func.call(thisArg, args[0], args[1]);
    case 3:
      return func.call(thisArg, args[0], args[1], args[2]);
  }
  return func.apply(thisArg, args);
}
var nativeMax$1 = Math.max;
function overRest(func, start2, transform2) {
  start2 = nativeMax$1(start2 === void 0 ? func.length - 1 : start2, 0);
  return function() {
    var args = arguments, index2 = -1, length2 = nativeMax$1(args.length - start2, 0), array4 = Array(length2);
    while (++index2 < length2) {
      array4[index2] = args[start2 + index2];
    }
    index2 = -1;
    var otherArgs = Array(start2 + 1);
    while (++index2 < start2) {
      otherArgs[index2] = args[index2];
    }
    otherArgs[start2] = transform2(array4);
    return apply(func, this, otherArgs);
  };
}
function constant(value2) {
  return function() {
    return value2;
  };
}
var baseSetToString = !defineProperty$1 ? identity$2 : function(func, string3) {
  return defineProperty$1(func, "toString", {
    "configurable": true,
    "enumerable": false,
    "value": constant(string3),
    "writable": true
  });
};
var HOT_COUNT = 800, HOT_SPAN = 16;
var nativeNow = Date.now;
function shortOut(func) {
  var count = 0, lastCalled = 0;
  return function() {
    var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
    lastCalled = stamp;
    if (remaining > 0) {
      if (++count >= HOT_COUNT) {
        return arguments[0];
      }
    } else {
      count = 0;
    }
    return func.apply(void 0, arguments);
  };
}
var setToString = shortOut(baseSetToString);
function baseRest(func, start2) {
  return setToString(overRest(func, start2, identity$2), func + "");
}
function isIterateeCall(value2, index2, object4) {
  if (!isObject$4(object4)) {
    return false;
  }
  var type4 = typeof index2;
  if (type4 == "number" ? isArrayLike(object4) && isIndex(index2, object4.length) : type4 == "string" && index2 in object4) {
    return eq$2(object4[index2], value2);
  }
  return false;
}
function createAssigner(assigner) {
  return baseRest(function(object4, sources) {
    var index2 = -1, length2 = sources.length, customizer = length2 > 1 ? sources[length2 - 1] : void 0, guard = length2 > 2 ? sources[2] : void 0;
    customizer = assigner.length > 3 && typeof customizer == "function" ? (length2--, customizer) : void 0;
    if (guard && isIterateeCall(sources[0], sources[1], guard)) {
      customizer = length2 < 3 ? void 0 : customizer;
      length2 = 1;
    }
    object4 = Object(object4);
    while (++index2 < length2) {
      var source2 = sources[index2];
      if (source2) {
        assigner(object4, source2, index2, customizer);
      }
    }
    return object4;
  });
}
var merge$3 = createAssigner(function(object4, source2, srcIndex) {
  baseMerge(object4, source2, srcIndex);
});
var Raised = function Raised2(_ref) {
  var zDepth = _ref.zDepth, radius = _ref.radius, background = _ref.background, children = _ref.children, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles;
  var styles2 = _default$4(merge$3({
    "default": {
      wrap: {
        position: "relative",
        display: "inline-block"
      },
      content: {
        position: "relative"
      },
      bg: {
        absolute: "0px 0px 0px 0px",
        boxShadow: "0 " + zDepth + "px " + zDepth * 4 + "px rgba(0,0,0,.24)",
        borderRadius: radius,
        background
      }
    },
    "zDepth-0": {
      bg: {
        boxShadow: "none"
      }
    },
    "zDepth-1": {
      bg: {
        boxShadow: "0 2px 10px rgba(0,0,0,.12), 0 2px 5px rgba(0,0,0,.16)"
      }
    },
    "zDepth-2": {
      bg: {
        boxShadow: "0 6px 20px rgba(0,0,0,.19), 0 8px 17px rgba(0,0,0,.2)"
      }
    },
    "zDepth-3": {
      bg: {
        boxShadow: "0 17px 50px rgba(0,0,0,.19), 0 12px 15px rgba(0,0,0,.24)"
      }
    },
    "zDepth-4": {
      bg: {
        boxShadow: "0 25px 55px rgba(0,0,0,.21), 0 16px 28px rgba(0,0,0,.22)"
      }
    },
    "zDepth-5": {
      bg: {
        boxShadow: "0 40px 77px rgba(0,0,0,.22), 0 27px 24px rgba(0,0,0,.2)"
      }
    },
    "square": {
      bg: {
        borderRadius: "0"
      }
    },
    "circle": {
      bg: {
        borderRadius: "50%"
      }
    }
  }, passedStyles), { "zDepth-1": zDepth === 1 });
  return React$5.createElement(
    "div",
    { style: styles2.wrap },
    React$5.createElement("div", { style: styles2.bg }),
    React$5.createElement(
      "div",
      { style: styles2.content },
      children
    )
  );
};
Raised.propTypes = {
  background: PropTypes$4.string,
  zDepth: PropTypes$4.oneOf([0, 1, 2, 3, 4, 5]),
  radius: PropTypes$4.number,
  styles: PropTypes$4.object
};
Raised.defaultProps = {
  background: "#fff",
  zDepth: 1,
  radius: 2,
  styles: {}
};
var now$1 = function() {
  return root$4.Date.now();
};
var reWhitespace = /\s/;
function trimmedEndIndex(string3) {
  var index2 = string3.length;
  while (index2-- && reWhitespace.test(string3.charAt(index2))) {
  }
  return index2;
}
var reTrimStart = /^\s+/;
function baseTrim(string3) {
  return string3 ? string3.slice(0, trimmedEndIndex(string3) + 1).replace(reTrimStart, "") : string3;
}
var symbolTag$2 = "[object Symbol]";
function isSymbol$1(value2) {
  return typeof value2 == "symbol" || isObjectLike$1(value2) && baseGetTag(value2) == symbolTag$2;
}
var NAN = 0 / 0;
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
var reIsBinary = /^0b[01]+$/i;
var reIsOctal = /^0o[0-7]+$/i;
var freeParseInt = parseInt;
function toNumber(value2) {
  if (typeof value2 == "number") {
    return value2;
  }
  if (isSymbol$1(value2)) {
    return NAN;
  }
  if (isObject$4(value2)) {
    var other = typeof value2.valueOf == "function" ? value2.valueOf() : value2;
    value2 = isObject$4(other) ? other + "" : other;
  }
  if (typeof value2 != "string") {
    return value2 === 0 ? value2 : +value2;
  }
  value2 = baseTrim(value2);
  var isBinary = reIsBinary.test(value2);
  return isBinary || reIsOctal.test(value2) ? freeParseInt(value2.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value2) ? NAN : +value2;
}
var FUNC_ERROR_TEXT$3 = "Expected a function";
var nativeMax = Math.max, nativeMin = Math.min;
function debounce$2(func, wait, options) {
  var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  if (typeof func != "function") {
    throw new TypeError(FUNC_ERROR_TEXT$3);
  }
  wait = toNumber(wait) || 0;
  if (isObject$4(options)) {
    leading = !!options.leading;
    maxing = "maxWait" in options;
    maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
    trailing = "trailing" in options ? !!options.trailing : trailing;
  }
  function invokeFunc(time2) {
    var args = lastArgs, thisArg = lastThis;
    lastArgs = lastThis = void 0;
    lastInvokeTime = time2;
    result = func.apply(thisArg, args);
    return result;
  }
  function leadingEdge(time2) {
    lastInvokeTime = time2;
    timerId = setTimeout(timerExpired, wait);
    return leading ? invokeFunc(time2) : result;
  }
  function remainingWait(time2) {
    var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
    return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  }
  function shouldInvoke(time2) {
    var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime;
    return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  }
  function timerExpired() {
    var time2 = now$1();
    if (shouldInvoke(time2)) {
      return trailingEdge(time2);
    }
    timerId = setTimeout(timerExpired, remainingWait(time2));
  }
  function trailingEdge(time2) {
    timerId = void 0;
    if (trailing && lastArgs) {
      return invokeFunc(time2);
    }
    lastArgs = lastThis = void 0;
    return result;
  }
  function cancel2() {
    if (timerId !== void 0) {
      clearTimeout(timerId);
    }
    lastInvokeTime = 0;
    lastArgs = lastCallTime = lastThis = timerId = void 0;
  }
  function flush() {
    return timerId === void 0 ? result : trailingEdge(now$1());
  }
  function debounced() {
    var time2 = now$1(), isInvoking = shouldInvoke(time2);
    lastArgs = arguments;
    lastThis = this;
    lastCallTime = time2;
    if (isInvoking) {
      if (timerId === void 0) {
        return leadingEdge(lastCallTime);
      }
      if (maxing) {
        clearTimeout(timerId);
        timerId = setTimeout(timerExpired, wait);
        return invokeFunc(lastCallTime);
      }
    }
    if (timerId === void 0) {
      timerId = setTimeout(timerExpired, wait);
    }
    return result;
  }
  debounced.cancel = cancel2;
  debounced.flush = flush;
  return debounced;
}
var FUNC_ERROR_TEXT$2 = "Expected a function";
function throttle$1(func, wait, options) {
  var leading = true, trailing = true;
  if (typeof func != "function") {
    throw new TypeError(FUNC_ERROR_TEXT$2);
  }
  if (isObject$4(options)) {
    leading = "leading" in options ? !!options.leading : leading;
    trailing = "trailing" in options ? !!options.trailing : trailing;
  }
  return debounce$2(func, wait, {
    "leading": leading,
    "maxWait": wait,
    "trailing": trailing
  });
}
var calculateChange3 = function calculateChange4(e2, hsl, container) {
  var _container$getBoundin = container.getBoundingClientRect(), containerWidth = _container$getBoundin.width, containerHeight = _container$getBoundin.height;
  var x2 = typeof e2.pageX === "number" ? e2.pageX : e2.touches[0].pageX;
  var y2 = typeof e2.pageY === "number" ? e2.pageY : e2.touches[0].pageY;
  var left2 = x2 - (container.getBoundingClientRect().left + window.pageXOffset);
  var top2 = y2 - (container.getBoundingClientRect().top + window.pageYOffset);
  if (left2 < 0) {
    left2 = 0;
  } else if (left2 > containerWidth) {
    left2 = containerWidth;
  }
  if (top2 < 0) {
    top2 = 0;
  } else if (top2 > containerHeight) {
    top2 = containerHeight;
  }
  var saturation = left2 / containerWidth;
  var bright = 1 - top2 / containerHeight;
  return {
    h: hsl.h,
    s: saturation,
    v: bright,
    a: hsl.a,
    source: "hsv"
  };
};
var _createClass$4 = /* @__PURE__ */ function() {
  function defineProperties(target, props) {
    for (var i2 = 0; i2 < props.length; i2++) {
      var descriptor = props[i2];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor)
        descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }
  return function(Constructor, protoProps, staticProps) {
    if (protoProps)
      defineProperties(Constructor.prototype, protoProps);
    if (staticProps)
      defineProperties(Constructor, staticProps);
    return Constructor;
  };
}();
function _classCallCheck$4(instance2, Constructor) {
  if (!(instance2 instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn$4(self2, call2) {
  if (!self2) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call2 && (typeof call2 === "object" || typeof call2 === "function") ? call2 : self2;
}
function _inherits$4(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
  if (superClass)
    Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var Saturation = function(_ref) {
  _inherits$4(Saturation2, _ref);
  function Saturation2(props) {
    _classCallCheck$4(this, Saturation2);
    var _this = _possibleConstructorReturn$4(this, (Saturation2.__proto__ || Object.getPrototypeOf(Saturation2)).call(this, props));
    _this.handleChange = function(e2) {
      typeof _this.props.onChange === "function" && _this.throttle(_this.props.onChange, calculateChange3(e2, _this.props.hsl, _this.container), e2);
    };
    _this.handleMouseDown = function(e2) {
      _this.handleChange(e2);
      var renderWindow = _this.getContainerRenderWindow();
      renderWindow.addEventListener("mousemove", _this.handleChange);
      renderWindow.addEventListener("mouseup", _this.handleMouseUp);
    };
    _this.handleMouseUp = function() {
      _this.unbindEventListeners();
    };
    _this.throttle = throttle$1(function(fn, data, e2) {
      fn(data, e2);
    }, 50);
    return _this;
  }
  _createClass$4(Saturation2, [{
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      this.throttle.cancel();
      this.unbindEventListeners();
    }
  }, {
    key: "getContainerRenderWindow",
    value: function getContainerRenderWindow() {
      var container = this.container;
      var renderWindow = window;
      while (!renderWindow.document.contains(container) && renderWindow.parent !== renderWindow) {
        renderWindow = renderWindow.parent;
      }
      return renderWindow;
    }
  }, {
    key: "unbindEventListeners",
    value: function unbindEventListeners() {
      var renderWindow = this.getContainerRenderWindow();
      renderWindow.removeEventListener("mousemove", this.handleChange);
      renderWindow.removeEventListener("mouseup", this.handleMouseUp);
    }
  }, {
    key: "render",
    value: function render3() {
      var _this2 = this;
      var _ref2 = this.props.style || {}, color2 = _ref2.color, white = _ref2.white, black = _ref2.black, pointer = _ref2.pointer, circle = _ref2.circle;
      var styles2 = _default$4({
        "default": {
          color: {
            absolute: "0px 0px 0px 0px",
            background: "hsl(" + this.props.hsl.h + ",100%, 50%)",
            borderRadius: this.props.radius
          },
          white: {
            absolute: "0px 0px 0px 0px",
            borderRadius: this.props.radius
          },
          black: {
            absolute: "0px 0px 0px 0px",
            boxShadow: this.props.shadow,
            borderRadius: this.props.radius
          },
          pointer: {
            position: "absolute",
            top: -(this.props.hsv.v * 100) + 100 + "%",
            left: this.props.hsv.s * 100 + "%",
            cursor: "default"
          },
          circle: {
            width: "4px",
            height: "4px",
            boxShadow: "0 0 0 1.5px #fff, inset 0 0 1px 1px rgba(0,0,0,.3),\n            0 0 1px 2px rgba(0,0,0,.4)",
            borderRadius: "50%",
            cursor: "hand",
            transform: "translate(-2px, -2px)"
          }
        },
        "custom": {
          color: color2,
          white,
          black,
          pointer,
          circle
        }
      }, { "custom": !!this.props.style });
      return React$5.createElement(
        "div",
        {
          style: styles2.color,
          ref: function ref(container) {
            return _this2.container = container;
          },
          onMouseDown: this.handleMouseDown,
          onTouchMove: this.handleChange,
          onTouchStart: this.handleChange
        },
        React$5.createElement(
          "style",
          null,
          "\n          .saturation-white {\n            background: -webkit-linear-gradient(to right, #fff, rgba(255,255,255,0));\n            background: linear-gradient(to right, #fff, rgba(255,255,255,0));\n          }\n          .saturation-black {\n            background: -webkit-linear-gradient(to top, #000, rgba(0,0,0,0));\n            background: linear-gradient(to top, #000, rgba(0,0,0,0));\n          }\n        "
        ),
        React$5.createElement(
          "div",
          { style: styles2.white, className: "saturation-white" },
          React$5.createElement("div", { style: styles2.black, className: "saturation-black" }),
          React$5.createElement(
            "div",
            { style: styles2.pointer },
            this.props.pointer ? React$5.createElement(this.props.pointer, this.props) : React$5.createElement("div", { style: styles2.circle })
          )
        )
      );
    }
  }]);
  return Saturation2;
}(reactExports.PureComponent || reactExports.Component);
function arrayEach(array4, iteratee) {
  var index2 = -1, length2 = array4 == null ? 0 : array4.length;
  while (++index2 < length2) {
    if (iteratee(array4[index2], index2, array4) === false) {
      break;
    }
  }
  return array4;
}
var nativeKeys = overArg(Object.keys, Object);
var objectProto$4 = Object.prototype;
var hasOwnProperty$5 = objectProto$4.hasOwnProperty;
function baseKeys(object4) {
  if (!isPrototype(object4)) {
    return nativeKeys(object4);
  }
  var result = [];
  for (var key in Object(object4)) {
    if (hasOwnProperty$5.call(object4, key) && key != "constructor") {
      result.push(key);
    }
  }
  return result;
}
function keys$2(object4) {
  return isArrayLike(object4) ? arrayLikeKeys(object4) : baseKeys(object4);
}
function baseForOwn(object4, iteratee) {
  return object4 && baseFor(object4, iteratee, keys$2);
}
function createBaseEach(eachFunc, fromRight) {
  return function(collection, iteratee) {
    if (collection == null) {
      return collection;
    }
    if (!isArrayLike(collection)) {
      return eachFunc(collection, iteratee);
    }
    var length2 = collection.length, index2 = -1, iterable = Object(collection);
    while (++index2 < length2) {
      if (iteratee(iterable[index2], index2, iterable) === false) {
        break;
      }
    }
    return collection;
  };
}
var baseEach = createBaseEach(baseForOwn);
function castFunction(value2) {
  return typeof value2 == "function" ? value2 : identity$2;
}
function forEach$1(collection, iteratee) {
  var func = isArray$6(collection) ? arrayEach : baseEach;
  return func(collection, castFunction(iteratee));
}
function _typeof(obj) {
  "@babel/helpers - typeof";
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
    return typeof obj2;
  } : function(obj2) {
    return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
  }, _typeof(obj);
}
var trimLeft = /^\s+/;
var trimRight = /\s+$/;
function tinycolor(color2, opts2) {
  color2 = color2 ? color2 : "";
  opts2 = opts2 || {};
  if (color2 instanceof tinycolor) {
    return color2;
  }
  if (!(this instanceof tinycolor)) {
    return new tinycolor(color2, opts2);
  }
  var rgb = inputToRGB(color2);
  this._originalInput = color2, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts2.format || rgb.format;
  this._gradientType = opts2.gradientType;
  if (this._r < 1)
    this._r = Math.round(this._r);
  if (this._g < 1)
    this._g = Math.round(this._g);
  if (this._b < 1)
    this._b = Math.round(this._b);
  this._ok = rgb.ok;
}
tinycolor.prototype = {
  isDark: function isDark() {
    return this.getBrightness() < 128;
  },
  isLight: function isLight() {
    return !this.isDark();
  },
  isValid: function isValid() {
    return this._ok;
  },
  getOriginalInput: function getOriginalInput() {
    return this._originalInput;
  },
  getFormat: function getFormat() {
    return this._format;
  },
  getAlpha: function getAlpha() {
    return this._a;
  },
  getBrightness: function getBrightness() {
    var rgb = this.toRgb();
    return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  },
  getLuminance: function getLuminance() {
    var rgb = this.toRgb();
    var RsRGB, GsRGB, BsRGB, R2, G2, B2;
    RsRGB = rgb.r / 255;
    GsRGB = rgb.g / 255;
    BsRGB = rgb.b / 255;
    if (RsRGB <= 0.03928)
      R2 = RsRGB / 12.92;
    else
      R2 = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
    if (GsRGB <= 0.03928)
      G2 = GsRGB / 12.92;
    else
      G2 = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
    if (BsRGB <= 0.03928)
      B2 = BsRGB / 12.92;
    else
      B2 = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
    return 0.2126 * R2 + 0.7152 * G2 + 0.0722 * B2;
  },
  setAlpha: function setAlpha(value2) {
    this._a = boundAlpha(value2);
    this._roundA = Math.round(100 * this._a) / 100;
    return this;
  },
  toHsv: function toHsv() {
    var hsv = rgbToHsv(this._r, this._g, this._b);
    return {
      h: hsv.h * 360,
      s: hsv.s,
      v: hsv.v,
      a: this._a
    };
  },
  toHsvString: function toHsvString() {
    var hsv = rgbToHsv(this._r, this._g, this._b);
    var h3 = Math.round(hsv.h * 360), s2 = Math.round(hsv.s * 100), v2 = Math.round(hsv.v * 100);
    return this._a == 1 ? "hsv(" + h3 + ", " + s2 + "%, " + v2 + "%)" : "hsva(" + h3 + ", " + s2 + "%, " + v2 + "%, " + this._roundA + ")";
  },
  toHsl: function toHsl() {
    var hsl = rgbToHsl(this._r, this._g, this._b);
    return {
      h: hsl.h * 360,
      s: hsl.s,
      l: hsl.l,
      a: this._a
    };
  },
  toHslString: function toHslString() {
    var hsl = rgbToHsl(this._r, this._g, this._b);
    var h3 = Math.round(hsl.h * 360), s2 = Math.round(hsl.s * 100), l2 = Math.round(hsl.l * 100);
    return this._a == 1 ? "hsl(" + h3 + ", " + s2 + "%, " + l2 + "%)" : "hsla(" + h3 + ", " + s2 + "%, " + l2 + "%, " + this._roundA + ")";
  },
  toHex: function toHex(allow3Char) {
    return rgbToHex(this._r, this._g, this._b, allow3Char);
  },
  toHexString: function toHexString(allow3Char) {
    return "#" + this.toHex(allow3Char);
  },
  toHex8: function toHex8(allow4Char) {
    return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
  },
  toHex8String: function toHex8String(allow4Char) {
    return "#" + this.toHex8(allow4Char);
  },
  toRgb: function toRgb() {
    return {
      r: Math.round(this._r),
      g: Math.round(this._g),
      b: Math.round(this._b),
      a: this._a
    };
  },
  toRgbString: function toRgbString() {
    return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
  },
  toPercentageRgb: function toPercentageRgb() {
    return {
      r: Math.round(bound01(this._r, 255) * 100) + "%",
      g: Math.round(bound01(this._g, 255) * 100) + "%",
      b: Math.round(bound01(this._b, 255) * 100) + "%",
      a: this._a
    };
  },
  toPercentageRgbString: function toPercentageRgbString() {
    return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
  },
  toName: function toName() {
    if (this._a === 0) {
      return "transparent";
    }
    if (this._a < 1) {
      return false;
    }
    return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
  },
  toFilter: function toFilter(secondColor) {
    var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
    var secondHex8String = hex8String;
    var gradientType = this._gradientType ? "GradientType = 1, " : "";
    if (secondColor) {
      var s2 = tinycolor(secondColor);
      secondHex8String = "#" + rgbaToArgbHex(s2._r, s2._g, s2._b, s2._a);
    }
    return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
  },
  toString: function toString(format2) {
    var formatSet = !!format2;
    format2 = format2 || this._format;
    var formattedString = false;
    var hasAlpha = this._a < 1 && this._a >= 0;
    var needsAlphaFormat = !formatSet && hasAlpha && (format2 === "hex" || format2 === "hex6" || format2 === "hex3" || format2 === "hex4" || format2 === "hex8" || format2 === "name");
    if (needsAlphaFormat) {
      if (format2 === "name" && this._a === 0) {
        return this.toName();
      }
      return this.toRgbString();
    }
    if (format2 === "rgb") {
      formattedString = this.toRgbString();
    }
    if (format2 === "prgb") {
      formattedString = this.toPercentageRgbString();
    }
    if (format2 === "hex" || format2 === "hex6") {
      formattedString = this.toHexString();
    }
    if (format2 === "hex3") {
      formattedString = this.toHexString(true);
    }
    if (format2 === "hex4") {
      formattedString = this.toHex8String(true);
    }
    if (format2 === "hex8") {
      formattedString = this.toHex8String();
    }
    if (format2 === "name") {
      formattedString = this.toName();
    }
    if (format2 === "hsl") {
      formattedString = this.toHslString();
    }
    if (format2 === "hsv") {
      formattedString = this.toHsvString();
    }
    return formattedString || this.toHexString();
  },
  clone: function clone() {
    return tinycolor(this.toString());
  },
  _applyModification: function _applyModification(fn, args) {
    var color2 = fn.apply(null, [this].concat([].slice.call(args)));
    this._r = color2._r;
    this._g = color2._g;
    this._b = color2._b;
    this.setAlpha(color2._a);
    return this;
  },
  lighten: function lighten() {
    return this._applyModification(_lighten, arguments);
  },
  brighten: function brighten() {
    return this._applyModification(_brighten, arguments);
  },
  darken: function darken() {
    return this._applyModification(_darken, arguments);
  },
  desaturate: function desaturate() {
    return this._applyModification(_desaturate, arguments);
  },
  saturate: function saturate() {
    return this._applyModification(_saturate, arguments);
  },
  greyscale: function greyscale() {
    return this._applyModification(_greyscale, arguments);
  },
  spin: function spin() {
    return this._applyModification(_spin, arguments);
  },
  _applyCombination: function _applyCombination(fn, args) {
    return fn.apply(null, [this].concat([].slice.call(args)));
  },
  analogous: function analogous() {
    return this._applyCombination(_analogous, arguments);
  },
  complement: function complement() {
    return this._applyCombination(_complement, arguments);
  },
  monochromatic: function monochromatic() {
    return this._applyCombination(_monochromatic, arguments);
  },
  splitcomplement: function splitcomplement() {
    return this._applyCombination(_splitcomplement, arguments);
  },
  // Disabled until https://github.com/bgrins/TinyColor/issues/254
  // polyad: function (number) {
  //   return this._applyCombination(polyad, [number]);
  // },
  triad: function triad() {
    return this._applyCombination(polyad, [3]);
  },
  tetrad: function tetrad() {
    return this._applyCombination(polyad, [4]);
  }
};
tinycolor.fromRatio = function(color2, opts2) {
  if (_typeof(color2) == "object") {
    var newColor = {};
    for (var i2 in color2) {
      if (color2.hasOwnProperty(i2)) {
        if (i2 === "a") {
          newColor[i2] = color2[i2];
        } else {
          newColor[i2] = convertToPercentage(color2[i2]);
        }
      }
    }
    color2 = newColor;
  }
  return tinycolor(color2, opts2);
};
function inputToRGB(color2) {
  var rgb = {
    r: 0,
    g: 0,
    b: 0
  };
  var a2 = 1;
  var s2 = null;
  var v2 = null;
  var l2 = null;
  var ok2 = false;
  var format2 = false;
  if (typeof color2 == "string") {
    color2 = stringInputToObject(color2);
  }
  if (_typeof(color2) == "object") {
    if (isValidCSSUnit(color2.r) && isValidCSSUnit(color2.g) && isValidCSSUnit(color2.b)) {
      rgb = rgbToRgb(color2.r, color2.g, color2.b);
      ok2 = true;
      format2 = String(color2.r).substr(-1) === "%" ? "prgb" : "rgb";
    } else if (isValidCSSUnit(color2.h) && isValidCSSUnit(color2.s) && isValidCSSUnit(color2.v)) {
      s2 = convertToPercentage(color2.s);
      v2 = convertToPercentage(color2.v);
      rgb = hsvToRgb(color2.h, s2, v2);
      ok2 = true;
      format2 = "hsv";
    } else if (isValidCSSUnit(color2.h) && isValidCSSUnit(color2.s) && isValidCSSUnit(color2.l)) {
      s2 = convertToPercentage(color2.s);
      l2 = convertToPercentage(color2.l);
      rgb = hslToRgb(color2.h, s2, l2);
      ok2 = true;
      format2 = "hsl";
    }
    if (color2.hasOwnProperty("a")) {
      a2 = color2.a;
    }
  }
  a2 = boundAlpha(a2);
  return {
    ok: ok2,
    format: color2.format || format2,
    r: Math.min(255, Math.max(rgb.r, 0)),
    g: Math.min(255, Math.max(rgb.g, 0)),
    b: Math.min(255, Math.max(rgb.b, 0)),
    a: a2
  };
}
function rgbToRgb(r2, g2, b2) {
  return {
    r: bound01(r2, 255) * 255,
    g: bound01(g2, 255) * 255,
    b: bound01(b2, 255) * 255
  };
}
function rgbToHsl(r2, g2, b2) {
  r2 = bound01(r2, 255);
  g2 = bound01(g2, 255);
  b2 = bound01(b2, 255);
  var max2 = Math.max(r2, g2, b2), min2 = Math.min(r2, g2, b2);
  var h3, s2, l2 = (max2 + min2) / 2;
  if (max2 == min2) {
    h3 = s2 = 0;
  } else {
    var d2 = max2 - min2;
    s2 = l2 > 0.5 ? d2 / (2 - max2 - min2) : d2 / (max2 + min2);
    switch (max2) {
      case r2:
        h3 = (g2 - b2) / d2 + (g2 < b2 ? 6 : 0);
        break;
      case g2:
        h3 = (b2 - r2) / d2 + 2;
        break;
      case b2:
        h3 = (r2 - g2) / d2 + 4;
        break;
    }
    h3 /= 6;
  }
  return {
    h: h3,
    s: s2,
    l: l2
  };
}
function hslToRgb(h3, s2, l2) {
  var r2, g2, b2;
  h3 = bound01(h3, 360);
  s2 = bound01(s2, 100);
  l2 = bound01(l2, 100);
  function hue2rgb(p3, q3, t2) {
    if (t2 < 0)
      t2 += 1;
    if (t2 > 1)
      t2 -= 1;
    if (t2 < 1 / 6)
      return p3 + (q3 - p3) * 6 * t2;
    if (t2 < 1 / 2)
      return q3;
    if (t2 < 2 / 3)
      return p3 + (q3 - p3) * (2 / 3 - t2) * 6;
    return p3;
  }
  if (s2 === 0) {
    r2 = g2 = b2 = l2;
  } else {
    var q2 = l2 < 0.5 ? l2 * (1 + s2) : l2 + s2 - l2 * s2;
    var p2 = 2 * l2 - q2;
    r2 = hue2rgb(p2, q2, h3 + 1 / 3);
    g2 = hue2rgb(p2, q2, h3);
    b2 = hue2rgb(p2, q2, h3 - 1 / 3);
  }
  return {
    r: r2 * 255,
    g: g2 * 255,
    b: b2 * 255
  };
}
function rgbToHsv(r2, g2, b2) {
  r2 = bound01(r2, 255);
  g2 = bound01(g2, 255);
  b2 = bound01(b2, 255);
  var max2 = Math.max(r2, g2, b2), min2 = Math.min(r2, g2, b2);
  var h3, s2, v2 = max2;
  var d2 = max2 - min2;
  s2 = max2 === 0 ? 0 : d2 / max2;
  if (max2 == min2) {
    h3 = 0;
  } else {
    switch (max2) {
      case r2:
        h3 = (g2 - b2) / d2 + (g2 < b2 ? 6 : 0);
        break;
      case g2:
        h3 = (b2 - r2) / d2 + 2;
        break;
      case b2:
        h3 = (r2 - g2) / d2 + 4;
        break;
    }
    h3 /= 6;
  }
  return {
    h: h3,
    s: s2,
    v: v2
  };
}
function hsvToRgb(h3, s2, v2) {
  h3 = bound01(h3, 360) * 6;
  s2 = bound01(s2, 100);
  v2 = bound01(v2, 100);
  var i2 = Math.floor(h3), f2 = h3 - i2, p2 = v2 * (1 - s2), q2 = v2 * (1 - f2 * s2), t2 = v2 * (1 - (1 - f2) * s2), mod2 = i2 % 6, r2 = [v2, q2, p2, p2, t2, v2][mod2], g2 = [t2, v2, v2, q2, p2, p2][mod2], b2 = [p2, p2, t2, v2, v2, q2][mod2];
  return {
    r: r2 * 255,
    g: g2 * 255,
    b: b2 * 255
  };
}
function rgbToHex(r2, g2, b2, allow3Char) {
  var hex3 = [pad2(Math.round(r2).toString(16)), pad2(Math.round(g2).toString(16)), pad2(Math.round(b2).toString(16))];
  if (allow3Char && hex3[0].charAt(0) == hex3[0].charAt(1) && hex3[1].charAt(0) == hex3[1].charAt(1) && hex3[2].charAt(0) == hex3[2].charAt(1)) {
    return hex3[0].charAt(0) + hex3[1].charAt(0) + hex3[2].charAt(0);
  }
  return hex3.join("");
}
function rgbaToHex(r2, g2, b2, a2, allow4Char) {
  var hex3 = [pad2(Math.round(r2).toString(16)), pad2(Math.round(g2).toString(16)), pad2(Math.round(b2).toString(16)), pad2(convertDecimalToHex(a2))];
  if (allow4Char && hex3[0].charAt(0) == hex3[0].charAt(1) && hex3[1].charAt(0) == hex3[1].charAt(1) && hex3[2].charAt(0) == hex3[2].charAt(1) && hex3[3].charAt(0) == hex3[3].charAt(1)) {
    return hex3[0].charAt(0) + hex3[1].charAt(0) + hex3[2].charAt(0) + hex3[3].charAt(0);
  }
  return hex3.join("");
}
function rgbaToArgbHex(r2, g2, b2, a2) {
  var hex3 = [pad2(convertDecimalToHex(a2)), pad2(Math.round(r2).toString(16)), pad2(Math.round(g2).toString(16)), pad2(Math.round(b2).toString(16))];
  return hex3.join("");
}
tinycolor.equals = function(color1, color2) {
  if (!color1 || !color2)
    return false;
  return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
};
tinycolor.random = function() {
  return tinycolor.fromRatio({
    r: Math.random(),
    g: Math.random(),
    b: Math.random()
  });
};
function _desaturate(color2, amount) {
  amount = amount === 0 ? 0 : amount || 10;
  var hsl = tinycolor(color2).toHsl();
  hsl.s -= amount / 100;
  hsl.s = clamp01(hsl.s);
  return tinycolor(hsl);
}
function _saturate(color2, amount) {
  amount = amount === 0 ? 0 : amount || 10;
  var hsl = tinycolor(color2).toHsl();
  hsl.s += amount / 100;
  hsl.s = clamp01(hsl.s);
  return tinycolor(hsl);
}
function _greyscale(color2) {
  return tinycolor(color2).desaturate(100);
}
function _lighten(color2, amount) {
  amount = amount === 0 ? 0 : amount || 10;
  var hsl = tinycolor(color2).toHsl();
  hsl.l += amount / 100;
  hsl.l = clamp01(hsl.l);
  return tinycolor(hsl);
}
function _brighten(color2, amount) {
  amount = amount === 0 ? 0 : amount || 10;
  var rgb = tinycolor(color2).toRgb();
  rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  return tinycolor(rgb);
}
function _darken(color2, amount) {
  amount = amount === 0 ? 0 : amount || 10;
  var hsl = tinycolor(color2).toHsl();
  hsl.l -= amount / 100;
  hsl.l = clamp01(hsl.l);
  return tinycolor(hsl);
}
function _spin(color2, amount) {
  var hsl = tinycolor(color2).toHsl();
  var hue2 = (hsl.h + amount) % 360;
  hsl.h = hue2 < 0 ? 360 + hue2 : hue2;
  return tinycolor(hsl);
}
function _complement(color2) {
  var hsl = tinycolor(color2).toHsl();
  hsl.h = (hsl.h + 180) % 360;
  return tinycolor(hsl);
}
function polyad(color2, number4) {
  if (isNaN(number4) || number4 <= 0) {
    throw new Error("Argument to polyad must be a positive number");
  }
  var hsl = tinycolor(color2).toHsl();
  var result = [tinycolor(color2)];
  var step = 360 / number4;
  for (var i2 = 1; i2 < number4; i2++) {
    result.push(tinycolor({
      h: (hsl.h + i2 * step) % 360,
      s: hsl.s,
      l: hsl.l
    }));
  }
  return result;
}
function _splitcomplement(color2) {
  var hsl = tinycolor(color2).toHsl();
  var h3 = hsl.h;
  return [tinycolor(color2), tinycolor({
    h: (h3 + 72) % 360,
    s: hsl.s,
    l: hsl.l
  }), tinycolor({
    h: (h3 + 216) % 360,
    s: hsl.s,
    l: hsl.l
  })];
}
function _analogous(color2, results, slices) {
  results = results || 6;
  slices = slices || 30;
  var hsl = tinycolor(color2).toHsl();
  var part = 360 / slices;
  var ret = [tinycolor(color2)];
  for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
    hsl.h = (hsl.h + part) % 360;
    ret.push(tinycolor(hsl));
  }
  return ret;
}
function _monochromatic(color2, results) {
  results = results || 6;
  var hsv = tinycolor(color2).toHsv();
  var h3 = hsv.h, s2 = hsv.s, v2 = hsv.v;
  var ret = [];
  var modification = 1 / results;
  while (results--) {
    ret.push(tinycolor({
      h: h3,
      s: s2,
      v: v2
    }));
    v2 = (v2 + modification) % 1;
  }
  return ret;
}
tinycolor.mix = function(color1, color2, amount) {
  amount = amount === 0 ? 0 : amount || 50;
  var rgb1 = tinycolor(color1).toRgb();
  var rgb2 = tinycolor(color2).toRgb();
  var p2 = amount / 100;
  var rgba2 = {
    r: (rgb2.r - rgb1.r) * p2 + rgb1.r,
    g: (rgb2.g - rgb1.g) * p2 + rgb1.g,
    b: (rgb2.b - rgb1.b) * p2 + rgb1.b,
    a: (rgb2.a - rgb1.a) * p2 + rgb1.a
  };
  return tinycolor(rgba2);
};
tinycolor.readability = function(color1, color2) {
  var c1 = tinycolor(color1);
  var c2 = tinycolor(color2);
  return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
};
tinycolor.isReadable = function(color1, color2, wcag2) {
  var readability = tinycolor.readability(color1, color2);
  var wcag2Parms, out;
  out = false;
  wcag2Parms = validateWCAG2Parms(wcag2);
  switch (wcag2Parms.level + wcag2Parms.size) {
    case "AAsmall":
    case "AAAlarge":
      out = readability >= 4.5;
      break;
    case "AAlarge":
      out = readability >= 3;
      break;
    case "AAAsmall":
      out = readability >= 7;
      break;
  }
  return out;
};
tinycolor.mostReadable = function(baseColor, colorList, args) {
  var bestColor = null;
  var bestScore = 0;
  var readability;
  var includeFallbackColors, level, size2;
  args = args || {};
  includeFallbackColors = args.includeFallbackColors;
  level = args.level;
  size2 = args.size;
  for (var i2 = 0; i2 < colorList.length; i2++) {
    readability = tinycolor.readability(baseColor, colorList[i2]);
    if (readability > bestScore) {
      bestScore = readability;
      bestColor = tinycolor(colorList[i2]);
    }
  }
  if (tinycolor.isReadable(baseColor, bestColor, {
    level,
    size: size2
  }) || !includeFallbackColors) {
    return bestColor;
  } else {
    args.includeFallbackColors = false;
    return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
  }
};
var names$2 = tinycolor.names = {
  aliceblue: "f0f8ff",
  antiquewhite: "faebd7",
  aqua: "0ff",
  aquamarine: "7fffd4",
  azure: "f0ffff",
  beige: "f5f5dc",
  bisque: "ffe4c4",
  black: "000",
  blanchedalmond: "ffebcd",
  blue: "00f",
  blueviolet: "8a2be2",
  brown: "a52a2a",
  burlywood: "deb887",
  burntsienna: "ea7e5d",
  cadetblue: "5f9ea0",
  chartreuse: "7fff00",
  chocolate: "d2691e",
  coral: "ff7f50",
  cornflowerblue: "6495ed",
  cornsilk: "fff8dc",
  crimson: "dc143c",
  cyan: "0ff",
  darkblue: "00008b",
  darkcyan: "008b8b",
  darkgoldenrod: "b8860b",
  darkgray: "a9a9a9",
  darkgreen: "006400",
  darkgrey: "a9a9a9",
  darkkhaki: "bdb76b",
  darkmagenta: "8b008b",
  darkolivegreen: "556b2f",
  darkorange: "ff8c00",
  darkorchid: "9932cc",
  darkred: "8b0000",
  darksalmon: "e9967a",
  darkseagreen: "8fbc8f",
  darkslateblue: "483d8b",
  darkslategray: "2f4f4f",
  darkslategrey: "2f4f4f",
  darkturquoise: "00ced1",
  darkviolet: "9400d3",
  deeppink: "ff1493",
  deepskyblue: "00bfff",
  dimgray: "696969",
  dimgrey: "696969",
  dodgerblue: "1e90ff",
  firebrick: "b22222",
  floralwhite: "fffaf0",
  forestgreen: "228b22",
  fuchsia: "f0f",
  gainsboro: "dcdcdc",
  ghostwhite: "f8f8ff",
  gold: "ffd700",
  goldenrod: "daa520",
  gray: "808080",
  green: "008000",
  greenyellow: "adff2f",
  grey: "808080",
  honeydew: "f0fff0",
  hotpink: "ff69b4",
  indianred: "cd5c5c",
  indigo: "4b0082",
  ivory: "fffff0",
  khaki: "f0e68c",
  lavender: "e6e6fa",
  lavenderblush: "fff0f5",
  lawngreen: "7cfc00",
  lemonchiffon: "fffacd",
  lightblue: "add8e6",
  lightcoral: "f08080",
  lightcyan: "e0ffff",
  lightgoldenrodyellow: "fafad2",
  lightgray: "d3d3d3",
  lightgreen: "90ee90",
  lightgrey: "d3d3d3",
  lightpink: "ffb6c1",
  lightsalmon: "ffa07a",
  lightseagreen: "20b2aa",
  lightskyblue: "87cefa",
  lightslategray: "789",
  lightslategrey: "789",
  lightsteelblue: "b0c4de",
  lightyellow: "ffffe0",
  lime: "0f0",
  limegreen: "32cd32",
  linen: "faf0e6",
  magenta: "f0f",
  maroon: "800000",
  mediumaquamarine: "66cdaa",
  mediumblue: "0000cd",
  mediumorchid: "ba55d3",
  mediumpurple: "9370db",
  mediumseagreen: "3cb371",
  mediumslateblue: "7b68ee",
  mediumspringgreen: "00fa9a",
  mediumturquoise: "48d1cc",
  mediumvioletred: "c71585",
  midnightblue: "191970",
  mintcream: "f5fffa",
  mistyrose: "ffe4e1",
  moccasin: "ffe4b5",
  navajowhite: "ffdead",
  navy: "000080",
  oldlace: "fdf5e6",
  olive: "808000",
  olivedrab: "6b8e23",
  orange: "ffa500",
  orangered: "ff4500",
  orchid: "da70d6",
  palegoldenrod: "eee8aa",
  palegreen: "98fb98",
  paleturquoise: "afeeee",
  palevioletred: "db7093",
  papayawhip: "ffefd5",
  peachpuff: "ffdab9",
  peru: "cd853f",
  pink: "ffc0cb",
  plum: "dda0dd",
  powderblue: "b0e0e6",
  purple: "800080",
  rebeccapurple: "663399",
  red: "f00",
  rosybrown: "bc8f8f",
  royalblue: "4169e1",
  saddlebrown: "8b4513",
  salmon: "fa8072",
  sandybrown: "f4a460",
  seagreen: "2e8b57",
  seashell: "fff5ee",
  sienna: "a0522d",
  silver: "c0c0c0",
  skyblue: "87ceeb",
  slateblue: "6a5acd",
  slategray: "708090",
  slategrey: "708090",
  snow: "fffafa",
  springgreen: "00ff7f",
  steelblue: "4682b4",
  tan: "d2b48c",
  teal: "008080",
  thistle: "d8bfd8",
  tomato: "ff6347",
  turquoise: "40e0d0",
  violet: "ee82ee",
  wheat: "f5deb3",
  white: "fff",
  whitesmoke: "f5f5f5",
  yellow: "ff0",
  yellowgreen: "9acd32"
};
var hexNames = tinycolor.hexNames = flip(names$2);
function flip(o2) {
  var flipped = {};
  for (var i2 in o2) {
    if (o2.hasOwnProperty(i2)) {
      flipped[o2[i2]] = i2;
    }
  }
  return flipped;
}
function boundAlpha(a2) {
  a2 = parseFloat(a2);
  if (isNaN(a2) || a2 < 0 || a2 > 1) {
    a2 = 1;
  }
  return a2;
}
function bound01(n2, max2) {
  if (isOnePointZero(n2))
    n2 = "100%";
  var processPercent = isPercentage(n2);
  n2 = Math.min(max2, Math.max(0, parseFloat(n2)));
  if (processPercent) {
    n2 = parseInt(n2 * max2, 10) / 100;
  }
  if (Math.abs(n2 - max2) < 1e-6) {
    return 1;
  }
  return n2 % max2 / parseFloat(max2);
}
function clamp01(val) {
  return Math.min(1, Math.max(0, val));
}
function parseIntFromHex(val) {
  return parseInt(val, 16);
}
function isOnePointZero(n2) {
  return typeof n2 == "string" && n2.indexOf(".") != -1 && parseFloat(n2) === 1;
}
function isPercentage(n2) {
  return typeof n2 === "string" && n2.indexOf("%") != -1;
}
function pad2(c2) {
  return c2.length == 1 ? "0" + c2 : "" + c2;
}
function convertToPercentage(n2) {
  if (n2 <= 1) {
    n2 = n2 * 100 + "%";
  }
  return n2;
}
function convertDecimalToHex(d2) {
  return Math.round(parseFloat(d2) * 255).toString(16);
}
function convertHexToDecimal(h3) {
  return parseIntFromHex(h3) / 255;
}
var matchers = function() {
  var CSS_INTEGER = "[-\\+]?\\d+%?";
  var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
  var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
  var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
  return {
    CSS_UNIT: new RegExp(CSS_UNIT),
    rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
    rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
    hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
    hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
    hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
    hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
    hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
    hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
    hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
    hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  };
}();
function isValidCSSUnit(color2) {
  return !!matchers.CSS_UNIT.exec(color2);
}
function stringInputToObject(color2) {
  color2 = color2.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
  var named = false;
  if (names$2[color2]) {
    color2 = names$2[color2];
    named = true;
  } else if (color2 == "transparent") {
    return {
      r: 0,
      g: 0,
      b: 0,
      a: 0,
      format: "name"
    };
  }
  var match5;
  if (match5 = matchers.rgb.exec(color2)) {
    return {
      r: match5[1],
      g: match5[2],
      b: match5[3]
    };
  }
  if (match5 = matchers.rgba.exec(color2)) {
    return {
      r: match5[1],
      g: match5[2],
      b: match5[3],
      a: match5[4]
    };
  }
  if (match5 = matchers.hsl.exec(color2)) {
    return {
      h: match5[1],
      s: match5[2],
      l: match5[3]
    };
  }
  if (match5 = matchers.hsla.exec(color2)) {
    return {
      h: match5[1],
      s: match5[2],
      l: match5[3],
      a: match5[4]
    };
  }
  if (match5 = matchers.hsv.exec(color2)) {
    return {
      h: match5[1],
      s: match5[2],
      v: match5[3]
    };
  }
  if (match5 = matchers.hsva.exec(color2)) {
    return {
      h: match5[1],
      s: match5[2],
      v: match5[3],
      a: match5[4]
    };
  }
  if (match5 = matchers.hex8.exec(color2)) {
    return {
      r: parseIntFromHex(match5[1]),
      g: parseIntFromHex(match5[2]),
      b: parseIntFromHex(match5[3]),
      a: convertHexToDecimal(match5[4]),
      format: named ? "name" : "hex8"
    };
  }
  if (match5 = matchers.hex6.exec(color2)) {
    return {
      r: parseIntFromHex(match5[1]),
      g: parseIntFromHex(match5[2]),
      b: parseIntFromHex(match5[3]),
      format: named ? "name" : "hex"
    };
  }
  if (match5 = matchers.hex4.exec(color2)) {
    return {
      r: parseIntFromHex(match5[1] + "" + match5[1]),
      g: parseIntFromHex(match5[2] + "" + match5[2]),
      b: parseIntFromHex(match5[3] + "" + match5[3]),
      a: convertHexToDecimal(match5[4] + "" + match5[4]),
      format: named ? "name" : "hex8"
    };
  }
  if (match5 = matchers.hex3.exec(color2)) {
    return {
      r: parseIntFromHex(match5[1] + "" + match5[1]),
      g: parseIntFromHex(match5[2] + "" + match5[2]),
      b: parseIntFromHex(match5[3] + "" + match5[3]),
      format: named ? "name" : "hex"
    };
  }
  return false;
}
function validateWCAG2Parms(parms) {
  var level, size2;
  parms = parms || {
    level: "AA",
    size: "small"
  };
  level = (parms.level || "AA").toUpperCase();
  size2 = (parms.size || "small").toLowerCase();
  if (level !== "AA" && level !== "AAA") {
    level = "AA";
  }
  if (size2 !== "small" && size2 !== "large") {
    size2 = "small";
  }
  return {
    level,
    size: size2
  };
}
var simpleCheckForValidColor = function simpleCheckForValidColor2(data) {
  var keysToCheck = ["r", "g", "b", "a", "h", "s", "l", "v"];
  var checked = 0;
  var passed = 0;
  forEach$1(keysToCheck, function(letter) {
    if (data[letter]) {
      checked += 1;
      if (!isNaN(data[letter])) {
        passed += 1;
      }
      if (letter === "s" || letter === "l") {
        var percentPatt = /^\d+%$/;
        if (percentPatt.test(data[letter])) {
          passed += 1;
        }
      }
    }
  });
  return checked === passed ? data : false;
};
var toState = function toState2(data, oldHue) {
  var color2 = data.hex ? tinycolor(data.hex) : tinycolor(data);
  var hsl = color2.toHsl();
  var hsv = color2.toHsv();
  var rgb = color2.toRgb();
  var hex3 = color2.toHex();
  if (hsl.s === 0) {
    hsl.h = oldHue || 0;
    hsv.h = oldHue || 0;
  }
  var transparent2 = hex3 === "000000" && rgb.a === 0;
  return {
    hsl,
    hex: transparent2 ? "transparent" : "#" + hex3,
    rgb,
    hsv,
    oldHue: data.h || oldHue || hsl.h,
    source: data.source
  };
};
var isValidHex = function isValidHex2(hex3) {
  if (hex3 === "transparent") {
    return true;
  }
  var lh2 = String(hex3).charAt(0) === "#" ? 1 : 0;
  return hex3.length !== 4 + lh2 && hex3.length < 7 + lh2 && tinycolor(hex3).isValid();
};
var getContrastingColor = function getContrastingColor2(data) {
  if (!data) {
    return "#fff";
  }
  var col = toState(data);
  if (col.hex === "transparent") {
    return "rgba(0,0,0,0.4)";
  }
  var yiq = (col.rgb.r * 299 + col.rgb.g * 587 + col.rgb.b * 114) / 1e3;
  return yiq >= 128 ? "#000" : "#fff";
};
var isvalidColorString = function isvalidColorString2(string3, type4) {
  var stringWithoutDegree = string3.replace("°", "");
  return tinycolor(type4 + " (" + stringWithoutDegree + ")")._ok;
};
var _extends$a = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var _createClass$3 = /* @__PURE__ */ function() {
  function defineProperties(target, props) {
    for (var i2 = 0; i2 < props.length; i2++) {
      var descriptor = props[i2];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor)
        descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }
  return function(Constructor, protoProps, staticProps) {
    if (protoProps)
      defineProperties(Constructor.prototype, protoProps);
    if (staticProps)
      defineProperties(Constructor, staticProps);
    return Constructor;
  };
}();
function _classCallCheck$3(instance2, Constructor) {
  if (!(instance2 instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn$3(self2, call2) {
  if (!self2) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call2 && (typeof call2 === "object" || typeof call2 === "function") ? call2 : self2;
}
function _inherits$3(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
  if (superClass)
    Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var ColorWrap = function ColorWrap2(Picker) {
  var ColorPicker2 = function(_ref) {
    _inherits$3(ColorPicker3, _ref);
    function ColorPicker3(props) {
      _classCallCheck$3(this, ColorPicker3);
      var _this = _possibleConstructorReturn$3(this, (ColorPicker3.__proto__ || Object.getPrototypeOf(ColorPicker3)).call(this));
      _this.handleChange = function(data, event) {
        var isValidColor = simpleCheckForValidColor(data);
        if (isValidColor) {
          var colors2 = toState(data, data.h || _this.state.oldHue);
          _this.setState(colors2);
          _this.props.onChangeComplete && _this.debounce(_this.props.onChangeComplete, colors2, event);
          _this.props.onChange && _this.props.onChange(colors2, event);
        }
      };
      _this.handleSwatchHover = function(data, event) {
        var isValidColor = simpleCheckForValidColor(data);
        if (isValidColor) {
          var colors2 = toState(data, data.h || _this.state.oldHue);
          _this.props.onSwatchHover && _this.props.onSwatchHover(colors2, event);
        }
      };
      _this.state = _extends$a({}, toState(props.color, 0));
      _this.debounce = debounce$2(function(fn, data, event) {
        fn(data, event);
      }, 100);
      return _this;
    }
    _createClass$3(ColorPicker3, [{
      key: "render",
      value: function render3() {
        var optionalEvents = {};
        if (this.props.onSwatchHover) {
          optionalEvents.onSwatchHover = this.handleSwatchHover;
        }
        return React$5.createElement(Picker, _extends$a({}, this.props, this.state, {
          onChange: this.handleChange
        }, optionalEvents));
      }
    }], [{
      key: "getDerivedStateFromProps",
      value: function getDerivedStateFromProps(nextProps, state) {
        return _extends$a({}, toState(nextProps.color, state.oldHue));
      }
    }]);
    return ColorPicker3;
  }(reactExports.PureComponent || reactExports.Component);
  ColorPicker2.propTypes = _extends$a({}, Picker.propTypes);
  ColorPicker2.defaultProps = _extends$a({}, Picker.defaultProps, {
    color: {
      h: 250,
      s: 0.5,
      l: 0.2,
      a: 1
    }
  });
  return ColorPicker2;
};
var _extends$9 = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var _createClass$2 = /* @__PURE__ */ function() {
  function defineProperties(target, props) {
    for (var i2 = 0; i2 < props.length; i2++) {
      var descriptor = props[i2];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor)
        descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }
  return function(Constructor, protoProps, staticProps) {
    if (protoProps)
      defineProperties(Constructor.prototype, protoProps);
    if (staticProps)
      defineProperties(Constructor, staticProps);
    return Constructor;
  };
}();
function _classCallCheck$2(instance2, Constructor) {
  if (!(instance2 instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn$2(self2, call2) {
  if (!self2) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call2 && (typeof call2 === "object" || typeof call2 === "function") ? call2 : self2;
}
function _inherits$2(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
  if (superClass)
    Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var handleFocus = function handleFocus2(Component2) {
  var Span = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "span";
  return function(_React$Component) {
    _inherits$2(Focus, _React$Component);
    function Focus() {
      var _ref;
      var _temp, _this, _ret;
      _classCallCheck$2(this, Focus);
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
      return _ret = (_temp = (_this = _possibleConstructorReturn$2(this, (_ref = Focus.__proto__ || Object.getPrototypeOf(Focus)).call.apply(_ref, [this].concat(args))), _this), _this.state = { focus: false }, _this.handleFocus = function() {
        return _this.setState({ focus: true });
      }, _this.handleBlur = function() {
        return _this.setState({ focus: false });
      }, _temp), _possibleConstructorReturn$2(_this, _ret);
    }
    _createClass$2(Focus, [{
      key: "render",
      value: function render3() {
        return React$5.createElement(
          Span,
          { onFocus: this.handleFocus, onBlur: this.handleBlur },
          React$5.createElement(Component2, _extends$9({}, this.props, this.state))
        );
      }
    }]);
    return Focus;
  }(React$5.Component);
};
var _extends$8 = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var ENTER = 13;
var Swatch = function Swatch2(_ref) {
  var color2 = _ref.color, style2 = _ref.style, _ref$onClick = _ref.onClick, onClick = _ref$onClick === void 0 ? function() {
  } : _ref$onClick, onHover = _ref.onHover, _ref$title = _ref.title, title = _ref$title === void 0 ? color2 : _ref$title, children = _ref.children, focus = _ref.focus, _ref$focusStyle = _ref.focusStyle, focusStyle = _ref$focusStyle === void 0 ? {} : _ref$focusStyle;
  var transparent2 = color2 === "transparent";
  var styles2 = _default$4({
    default: {
      swatch: _extends$8({
        background: color2,
        height: "100%",
        width: "100%",
        cursor: "pointer",
        position: "relative",
        outline: "none"
      }, style2, focus ? focusStyle : {})
    }
  });
  var handleClick = function handleClick2(e2) {
    return onClick(color2, e2);
  };
  var handleKeyDown = function handleKeyDown2(e2) {
    return e2.keyCode === ENTER && onClick(color2, e2);
  };
  var handleHover2 = function handleHover3(e2) {
    return onHover(color2, e2);
  };
  var optionalEvents = {};
  if (onHover) {
    optionalEvents.onMouseOver = handleHover2;
  }
  return React$5.createElement(
    "div",
    _extends$8({
      style: styles2.swatch,
      onClick: handleClick,
      title,
      tabIndex: 0,
      onKeyDown: handleKeyDown
    }, optionalEvents),
    children,
    transparent2 && React$5.createElement(Checkboard, {
      borderRadius: styles2.swatch.borderRadius,
      boxShadow: "inset 0 0 0 1px rgba(0,0,0,0.1)"
    })
  );
};
const Swatch$1 = handleFocus(Swatch);
var AlphaPointer = function AlphaPointer2(_ref) {
  var direction = _ref.direction;
  var styles2 = _default$4({
    "default": {
      picker: {
        width: "18px",
        height: "18px",
        borderRadius: "50%",
        transform: "translate(-9px, -1px)",
        backgroundColor: "rgb(248, 248, 248)",
        boxShadow: "0 1px 4px 0 rgba(0, 0, 0, 0.37)"
      }
    },
    "vertical": {
      picker: {
        transform: "translate(-3px, -9px)"
      }
    }
  }, { vertical: direction === "vertical" });
  return React$5.createElement("div", { style: styles2.picker });
};
var _extends$7 = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var AlphaPicker = function AlphaPicker2(_ref) {
  var rgb = _ref.rgb, hsl = _ref.hsl, width = _ref.width, height = _ref.height, onChange = _ref.onChange, direction = _ref.direction, style2 = _ref.style, renderers = _ref.renderers, pointer = _ref.pointer, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4({
    "default": {
      picker: {
        position: "relative",
        width,
        height
      },
      alpha: {
        radius: "2px",
        style: style2
      }
    }
  });
  return React$5.createElement(
    "div",
    { style: styles2.picker, className: "alpha-picker " + className },
    React$5.createElement(Alpha, _extends$7({}, styles2.alpha, {
      rgb,
      hsl,
      pointer,
      renderers,
      onChange,
      direction
    }))
  );
};
AlphaPicker.defaultProps = {
  width: "316px",
  height: "16px",
  direction: "horizontal",
  pointer: AlphaPointer
};
ColorWrap(AlphaPicker);
function arrayMap(array4, iteratee) {
  var index2 = -1, length2 = array4 == null ? 0 : array4.length, result = Array(length2);
  while (++index2 < length2) {
    result[index2] = iteratee(array4[index2], index2, array4);
  }
  return result;
}
var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
function setCacheAdd(value2) {
  this.__data__.set(value2, HASH_UNDEFINED$1);
  return this;
}
function setCacheHas(value2) {
  return this.__data__.has(value2);
}
function SetCache(values) {
  var index2 = -1, length2 = values == null ? 0 : values.length;
  this.__data__ = new MapCache$1();
  while (++index2 < length2) {
    this.add(values[index2]);
  }
}
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
function arraySome(array4, predicate) {
  var index2 = -1, length2 = array4 == null ? 0 : array4.length;
  while (++index2 < length2) {
    if (predicate(array4[index2], index2, array4)) {
      return true;
    }
  }
  return false;
}
function cacheHas(cache2, key) {
  return cache2.has(key);
}
var COMPARE_PARTIAL_FLAG$5 = 1, COMPARE_UNORDERED_FLAG$3 = 2;
function equalArrays(array4, other, bitmask, customizer, equalFunc, stack) {
  var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array4.length, othLength = other.length;
  if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
    return false;
  }
  var arrStacked = stack.get(array4);
  var othStacked = stack.get(other);
  if (arrStacked && othStacked) {
    return arrStacked == other && othStacked == array4;
  }
  var index2 = -1, result = true, seen2 = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0;
  stack.set(array4, other);
  stack.set(other, array4);
  while (++index2 < arrLength) {
    var arrValue = array4[index2], othValue = other[index2];
    if (customizer) {
      var compared = isPartial ? customizer(othValue, arrValue, index2, other, array4, stack) : customizer(arrValue, othValue, index2, array4, other, stack);
    }
    if (compared !== void 0) {
      if (compared) {
        continue;
      }
      result = false;
      break;
    }
    if (seen2) {
      if (!arraySome(other, function(othValue2, othIndex) {
        if (!cacheHas(seen2, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
          return seen2.push(othIndex);
        }
      })) {
        result = false;
        break;
      }
    } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
      result = false;
      break;
    }
  }
  stack["delete"](array4);
  stack["delete"](other);
  return result;
}
function mapToArray(map2) {
  var index2 = -1, result = Array(map2.size);
  map2.forEach(function(value2, key) {
    result[++index2] = [key, value2];
  });
  return result;
}
function setToArray(set2) {
  var index2 = -1, result = Array(set2.size);
  set2.forEach(function(value2) {
    result[++index2] = value2;
  });
  return result;
}
var COMPARE_PARTIAL_FLAG$4 = 1, COMPARE_UNORDERED_FLAG$2 = 2;
var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag$1 = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag$1 = "[object Set]", stringTag = "[object String]", symbolTag$1 = "[object Symbol]";
var arrayBufferTag = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]";
var symbolProto$2 = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf = symbolProto$2 ? symbolProto$2.valueOf : void 0;
function equalByTag(object4, other, tag, bitmask, customizer, equalFunc, stack) {
  switch (tag) {
    case dataViewTag$1:
      if (object4.byteLength != other.byteLength || object4.byteOffset != other.byteOffset) {
        return false;
      }
      object4 = object4.buffer;
      other = other.buffer;
    case arrayBufferTag:
      if (object4.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object4), new Uint8Array$1(other))) {
        return false;
      }
      return true;
    case boolTag:
    case dateTag:
    case numberTag:
      return eq$2(+object4, +other);
    case errorTag:
      return object4.name == other.name && object4.message == other.message;
    case regexpTag:
    case stringTag:
      return object4 == other + "";
    case mapTag$1:
      var convert2 = mapToArray;
    case setTag$1:
      var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
      convert2 || (convert2 = setToArray);
      if (object4.size != other.size && !isPartial) {
        return false;
      }
      var stacked = stack.get(object4);
      if (stacked) {
        return stacked == other;
      }
      bitmask |= COMPARE_UNORDERED_FLAG$2;
      stack.set(object4, other);
      var result = equalArrays(convert2(object4), convert2(other), bitmask, customizer, equalFunc, stack);
      stack["delete"](object4);
      return result;
    case symbolTag$1:
      if (symbolValueOf) {
        return symbolValueOf.call(object4) == symbolValueOf.call(other);
      }
  }
  return false;
}
function arrayPush(array4, values) {
  var index2 = -1, length2 = values.length, offset2 = array4.length;
  while (++index2 < length2) {
    array4[offset2 + index2] = values[index2];
  }
  return array4;
}
function baseGetAllKeys(object4, keysFunc, symbolsFunc) {
  var result = keysFunc(object4);
  return isArray$6(object4) ? result : arrayPush(result, symbolsFunc(object4));
}
function arrayFilter(array4, predicate) {
  var index2 = -1, length2 = array4 == null ? 0 : array4.length, resIndex = 0, result = [];
  while (++index2 < length2) {
    var value2 = array4[index2];
    if (predicate(value2, index2, array4)) {
      result[resIndex++] = value2;
    }
  }
  return result;
}
function stubArray() {
  return [];
}
var objectProto$3 = Object.prototype;
var propertyIsEnumerable = objectProto$3.propertyIsEnumerable;
var nativeGetSymbols = Object.getOwnPropertySymbols;
var getSymbols = !nativeGetSymbols ? stubArray : function(object4) {
  if (object4 == null) {
    return [];
  }
  object4 = Object(object4);
  return arrayFilter(nativeGetSymbols(object4), function(symbol) {
    return propertyIsEnumerable.call(object4, symbol);
  });
};
function getAllKeys(object4) {
  return baseGetAllKeys(object4, keys$2, getSymbols);
}
var COMPARE_PARTIAL_FLAG$3 = 1;
var objectProto$2 = Object.prototype;
var hasOwnProperty$4 = objectProto$2.hasOwnProperty;
function equalObjects(object4, other, bitmask, customizer, equalFunc, stack) {
  var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object4), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
  if (objLength != othLength && !isPartial) {
    return false;
  }
  var index2 = objLength;
  while (index2--) {
    var key = objProps[index2];
    if (!(isPartial ? key in other : hasOwnProperty$4.call(other, key))) {
      return false;
    }
  }
  var objStacked = stack.get(object4);
  var othStacked = stack.get(other);
  if (objStacked && othStacked) {
    return objStacked == other && othStacked == object4;
  }
  var result = true;
  stack.set(object4, other);
  stack.set(other, object4);
  var skipCtor = isPartial;
  while (++index2 < objLength) {
    key = objProps[index2];
    var objValue = object4[key], othValue = other[key];
    if (customizer) {
      var compared = isPartial ? customizer(othValue, objValue, key, other, object4, stack) : customizer(objValue, othValue, key, object4, other, stack);
    }
    if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
      result = false;
      break;
    }
    skipCtor || (skipCtor = key == "constructor");
  }
  if (result && !skipCtor) {
    var objCtor = object4.constructor, othCtor = other.constructor;
    if (objCtor != othCtor && ("constructor" in object4 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
      result = false;
    }
  }
  stack["delete"](object4);
  stack["delete"](other);
  return result;
}
var DataView$1 = getNative$1(root$4, "DataView");
var Promise$1 = getNative$1(root$4, "Promise");
var Set$1 = getNative$1(root$4, "Set");
var WeakMap$1 = getNative$1(root$4, "WeakMap");
var mapTag = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag = "[object Set]", weakMapTag = "[object WeakMap]";
var dataViewTag = "[object DataView]";
var dataViewCtorString = toSource$1(DataView$1), mapCtorString = toSource$1(Map$2), promiseCtorString = toSource$1(Promise$1), setCtorString = toSource$1(Set$1), weakMapCtorString = toSource$1(WeakMap$1);
var getTag = baseGetTag;
if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag || Map$2 && getTag(new Map$2()) != mapTag || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag) {
  getTag = function(value2) {
    var result = baseGetTag(value2), Ctor = result == objectTag$1 ? value2.constructor : void 0, ctorString = Ctor ? toSource$1(Ctor) : "";
    if (ctorString) {
      switch (ctorString) {
        case dataViewCtorString:
          return dataViewTag;
        case mapCtorString:
          return mapTag;
        case promiseCtorString:
          return promiseTag;
        case setCtorString:
          return setTag;
        case weakMapCtorString:
          return weakMapTag;
      }
    }
    return result;
  };
}
var COMPARE_PARTIAL_FLAG$2 = 1;
var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
var objectProto$1 = Object.prototype;
var hasOwnProperty$3 = objectProto$1.hasOwnProperty;
function baseIsEqualDeep(object4, other, bitmask, customizer, equalFunc, stack) {
  var objIsArr = isArray$6(object4), othIsArr = isArray$6(other), objTag = objIsArr ? arrayTag : getTag(object4), othTag = othIsArr ? arrayTag : getTag(other);
  objTag = objTag == argsTag ? objectTag : objTag;
  othTag = othTag == argsTag ? objectTag : othTag;
  var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  if (isSameTag && isBuffer$1(object4)) {
    if (!isBuffer$1(other)) {
      return false;
    }
    objIsArr = true;
    objIsObj = false;
  }
  if (isSameTag && !objIsObj) {
    stack || (stack = new Stack());
    return objIsArr || isTypedArray$1(object4) ? equalArrays(object4, other, bitmask, customizer, equalFunc, stack) : equalByTag(object4, other, objTag, bitmask, customizer, equalFunc, stack);
  }
  if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
    var objIsWrapped = objIsObj && hasOwnProperty$3.call(object4, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$3.call(other, "__wrapped__");
    if (objIsWrapped || othIsWrapped) {
      var objUnwrapped = objIsWrapped ? object4.value() : object4, othUnwrapped = othIsWrapped ? other.value() : other;
      stack || (stack = new Stack());
      return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
    }
  }
  if (!isSameTag) {
    return false;
  }
  stack || (stack = new Stack());
  return equalObjects(object4, other, bitmask, customizer, equalFunc, stack);
}
function baseIsEqual(value2, other, bitmask, customizer, stack) {
  if (value2 === other) {
    return true;
  }
  if (value2 == null || other == null || !isObjectLike$1(value2) && !isObjectLike$1(other)) {
    return value2 !== value2 && other !== other;
  }
  return baseIsEqualDeep(value2, other, bitmask, customizer, baseIsEqual, stack);
}
var COMPARE_PARTIAL_FLAG$1 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
function baseIsMatch(object4, source2, matchData, customizer) {
  var index2 = matchData.length, length2 = index2;
  if (object4 == null) {
    return !length2;
  }
  object4 = Object(object4);
  while (index2--) {
    var data = matchData[index2];
    if (data[2] ? data[1] !== object4[data[0]] : !(data[0] in object4)) {
      return false;
    }
  }
  while (++index2 < length2) {
    data = matchData[index2];
    var key = data[0], objValue = object4[key], srcValue = data[1];
    if (data[2]) {
      if (objValue === void 0 && !(key in object4)) {
        return false;
      }
    } else {
      var stack = new Stack();
      var result;
      if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
        return false;
      }
    }
  }
  return true;
}
function isStrictComparable(value2) {
  return value2 === value2 && !isObject$4(value2);
}
function getMatchData(object4) {
  var result = keys$2(object4), length2 = result.length;
  while (length2--) {
    var key = result[length2], value2 = object4[key];
    result[length2] = [key, value2, isStrictComparable(value2)];
  }
  return result;
}
function matchesStrictComparable(key, srcValue) {
  return function(object4) {
    if (object4 == null) {
      return false;
    }
    return object4[key] === srcValue && (srcValue !== void 0 || key in Object(object4));
  };
}
function baseMatches(source2) {
  var matchData = getMatchData(source2);
  if (matchData.length == 1 && matchData[0][2]) {
    return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  }
  return function(object4) {
    return object4 === source2 || baseIsMatch(object4, source2, matchData);
  };
}
var reIsDeepProp$1 = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp$1 = /^\w*$/;
function isKey$1(value2, object4) {
  if (isArray$6(value2)) {
    return false;
  }
  var type4 = typeof value2;
  if (type4 == "number" || type4 == "symbol" || type4 == "boolean" || value2 == null || isSymbol$1(value2)) {
    return true;
  }
  return reIsPlainProp$1.test(value2) || !reIsDeepProp$1.test(value2) || object4 != null && value2 in Object(object4);
}
var FUNC_ERROR_TEXT$1 = "Expected a function";
function memoize$1(func, resolver2) {
  if (typeof func != "function" || resolver2 != null && typeof resolver2 != "function") {
    throw new TypeError(FUNC_ERROR_TEXT$1);
  }
  var memoized = function() {
    var args = arguments, key = resolver2 ? resolver2.apply(this, args) : args[0], cache2 = memoized.cache;
    if (cache2.has(key)) {
      return cache2.get(key);
    }
    var result = func.apply(this, args);
    memoized.cache = cache2.set(key, result) || cache2;
    return result;
  };
  memoized.cache = new (memoize$1.Cache || MapCache$1)();
  return memoized;
}
memoize$1.Cache = MapCache$1;
var MAX_MEMOIZE_SIZE = 500;
function memoizeCapped(func) {
  var result = memoize$1(func, function(key) {
    if (cache2.size === MAX_MEMOIZE_SIZE) {
      cache2.clear();
    }
    return key;
  });
  var cache2 = result.cache;
  return result;
}
var rePropName$1 = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var reEscapeChar$1 = /\\(\\)?/g;
var stringToPath$1 = memoizeCapped(function(string3) {
  var result = [];
  if (string3.charCodeAt(0) === 46) {
    result.push("");
  }
  string3.replace(rePropName$1, function(match5, number4, quote, subString) {
    result.push(quote ? subString.replace(reEscapeChar$1, "$1") : number4 || match5);
  });
  return result;
});
var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString$1 = symbolProto$1 ? symbolProto$1.toString : void 0;
function baseToString$1(value2) {
  if (typeof value2 == "string") {
    return value2;
  }
  if (isArray$6(value2)) {
    return arrayMap(value2, baseToString$1) + "";
  }
  if (isSymbol$1(value2)) {
    return symbolToString$1 ? symbolToString$1.call(value2) : "";
  }
  var result = value2 + "";
  return result == "0" && 1 / value2 == -Infinity ? "-0" : result;
}
function toString$5(value2) {
  return value2 == null ? "" : baseToString$1(value2);
}
function castPath$1(value2, object4) {
  if (isArray$6(value2)) {
    return value2;
  }
  return isKey$1(value2, object4) ? [value2] : stringToPath$1(toString$5(value2));
}
function toKey$1(value2) {
  if (typeof value2 == "string" || isSymbol$1(value2)) {
    return value2;
  }
  var result = value2 + "";
  return result == "0" && 1 / value2 == -Infinity ? "-0" : result;
}
function baseGet$1(object4, path) {
  path = castPath$1(path, object4);
  var index2 = 0, length2 = path.length;
  while (object4 != null && index2 < length2) {
    object4 = object4[toKey$1(path[index2++])];
  }
  return index2 && index2 == length2 ? object4 : void 0;
}
function get$6(object4, path, defaultValue2) {
  var result = object4 == null ? void 0 : baseGet$1(object4, path);
  return result === void 0 ? defaultValue2 : result;
}
function baseHasIn(object4, key) {
  return object4 != null && key in Object(object4);
}
function hasPath(object4, path, hasFunc) {
  path = castPath$1(path, object4);
  var index2 = -1, length2 = path.length, result = false;
  while (++index2 < length2) {
    var key = toKey$1(path[index2]);
    if (!(result = object4 != null && hasFunc(object4, key))) {
      break;
    }
    object4 = object4[key];
  }
  if (result || ++index2 != length2) {
    return result;
  }
  length2 = object4 == null ? 0 : object4.length;
  return !!length2 && isLength(length2) && isIndex(key, length2) && (isArray$6(object4) || isArguments(object4));
}
function hasIn(object4, path) {
  return object4 != null && hasPath(object4, path, baseHasIn);
}
var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
function baseMatchesProperty(path, srcValue) {
  if (isKey$1(path) && isStrictComparable(srcValue)) {
    return matchesStrictComparable(toKey$1(path), srcValue);
  }
  return function(object4) {
    var objValue = get$6(object4, path);
    return objValue === void 0 && objValue === srcValue ? hasIn(object4, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  };
}
function baseProperty(key) {
  return function(object4) {
    return object4 == null ? void 0 : object4[key];
  };
}
function basePropertyDeep(path) {
  return function(object4) {
    return baseGet$1(object4, path);
  };
}
function property$1(path) {
  return isKey$1(path) ? baseProperty(toKey$1(path)) : basePropertyDeep(path);
}
function baseIteratee(value2) {
  if (typeof value2 == "function") {
    return value2;
  }
  if (value2 == null) {
    return identity$2;
  }
  if (typeof value2 == "object") {
    return isArray$6(value2) ? baseMatchesProperty(value2[0], value2[1]) : baseMatches(value2);
  }
  return property$1(value2);
}
function baseMap(collection, iteratee) {
  var index2 = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
  baseEach(collection, function(value2, key, collection2) {
    result[++index2] = iteratee(value2, key, collection2);
  });
  return result;
}
function map$3(collection, iteratee) {
  var func = isArray$6(collection) ? arrayMap : baseMap;
  return func(collection, baseIteratee(iteratee));
}
var BlockSwatches = function BlockSwatches2(_ref) {
  var colors2 = _ref.colors, onClick = _ref.onClick, onSwatchHover = _ref.onSwatchHover;
  var styles2 = _default$4({
    "default": {
      swatches: {
        marginRight: "-10px"
      },
      swatch: {
        width: "22px",
        height: "22px",
        float: "left",
        marginRight: "10px",
        marginBottom: "10px",
        borderRadius: "4px"
      },
      clear: {
        clear: "both"
      }
    }
  });
  return React$5.createElement(
    "div",
    { style: styles2.swatches },
    map$3(colors2, function(c2) {
      return React$5.createElement(Swatch$1, {
        key: c2,
        color: c2,
        style: styles2.swatch,
        onClick,
        onHover: onSwatchHover,
        focusStyle: {
          boxShadow: "0 0 4px " + c2
        }
      });
    }),
    React$5.createElement("div", { style: styles2.clear })
  );
};
var Block$1 = function Block(_ref) {
  var onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, hex3 = _ref.hex, colors2 = _ref.colors, width = _ref.width, triangle = _ref.triangle, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var transparent2 = hex3 === "transparent";
  var handleChange = function handleChange2(hexCode, e2) {
    isValidHex(hexCode) && onChange({
      hex: hexCode,
      source: "hex"
    }, e2);
  };
  var styles2 = _default$4(merge$3({
    "default": {
      card: {
        width,
        background: "#fff",
        boxShadow: "0 1px rgba(0,0,0,.1)",
        borderRadius: "6px",
        position: "relative"
      },
      head: {
        height: "110px",
        background: hex3,
        borderRadius: "6px 6px 0 0",
        display: "flex",
        alignItems: "center",
        justifyContent: "center",
        position: "relative"
      },
      body: {
        padding: "10px"
      },
      label: {
        fontSize: "18px",
        color: getContrastingColor(hex3),
        position: "relative"
      },
      triangle: {
        width: "0px",
        height: "0px",
        borderStyle: "solid",
        borderWidth: "0 10px 10px 10px",
        borderColor: "transparent transparent " + hex3 + " transparent",
        position: "absolute",
        top: "-10px",
        left: "50%",
        marginLeft: "-10px"
      },
      input: {
        width: "100%",
        fontSize: "12px",
        color: "#666",
        border: "0px",
        outline: "none",
        height: "22px",
        boxShadow: "inset 0 0 0 1px #ddd",
        borderRadius: "4px",
        padding: "0 7px",
        boxSizing: "border-box"
      }
    },
    "hide-triangle": {
      triangle: {
        display: "none"
      }
    }
  }, passedStyles), { "hide-triangle": triangle === "hide" });
  return React$5.createElement(
    "div",
    { style: styles2.card, className: "block-picker " + className },
    React$5.createElement("div", { style: styles2.triangle }),
    React$5.createElement(
      "div",
      { style: styles2.head },
      transparent2 && React$5.createElement(Checkboard, { borderRadius: "6px 6px 0 0" }),
      React$5.createElement(
        "div",
        { style: styles2.label },
        hex3
      )
    ),
    React$5.createElement(
      "div",
      { style: styles2.body },
      React$5.createElement(BlockSwatches, { colors: colors2, onClick: handleChange, onSwatchHover }),
      React$5.createElement(EditableInput, {
        style: { input: styles2.input },
        value: hex3,
        onChange: handleChange
      })
    )
  );
};
Block$1.propTypes = {
  width: PropTypes$4.oneOfType([PropTypes$4.string, PropTypes$4.number]),
  colors: PropTypes$4.arrayOf(PropTypes$4.string),
  triangle: PropTypes$4.oneOf(["top", "hide"]),
  styles: PropTypes$4.object
};
Block$1.defaultProps = {
  width: 170,
  colors: ["#D9E3F0", "#F47373", "#697689", "#37D67A", "#2CCCE4", "#555555", "#dce775", "#ff8a65", "#ba68c8"],
  triangle: "top",
  styles: {}
};
ColorWrap(Block$1);
var red = { "100": "#ffcdd2", "300": "#e57373", "500": "#f44336", "700": "#d32f2f", "900": "#b71c1c" };
var pink = { "100": "#f8bbd0", "300": "#f06292", "500": "#e91e63", "700": "#c2185b", "900": "#880e4f" };
var purple = { "100": "#e1bee7", "300": "#ba68c8", "500": "#9c27b0", "700": "#7b1fa2", "900": "#4a148c" };
var deepPurple = { "100": "#d1c4e9", "300": "#9575cd", "500": "#673ab7", "700": "#512da8", "900": "#311b92" };
var indigo = { "100": "#c5cae9", "300": "#7986cb", "500": "#3f51b5", "700": "#303f9f", "900": "#1a237e" };
var blue = { "100": "#bbdefb", "300": "#64b5f6", "500": "#2196f3", "700": "#1976d2", "900": "#0d47a1" };
var lightBlue = { "100": "#b3e5fc", "300": "#4fc3f7", "500": "#03a9f4", "700": "#0288d1", "900": "#01579b" };
var cyan = { "100": "#b2ebf2", "300": "#4dd0e1", "500": "#00bcd4", "700": "#0097a7", "900": "#006064" };
var teal = { "100": "#b2dfdb", "300": "#4db6ac", "500": "#009688", "700": "#00796b", "900": "#004d40" };
var green = { "100": "#c8e6c9", "300": "#81c784", "500": "#4caf50", "700": "#388e3c" };
var lightGreen = { "100": "#dcedc8", "300": "#aed581", "500": "#8bc34a", "700": "#689f38", "900": "#33691e" };
var lime = { "100": "#f0f4c3", "300": "#dce775", "500": "#cddc39", "700": "#afb42b", "900": "#827717" };
var yellow = { "100": "#fff9c4", "300": "#fff176", "500": "#ffeb3b", "700": "#fbc02d", "900": "#f57f17" };
var amber = { "100": "#ffecb3", "300": "#ffd54f", "500": "#ffc107", "700": "#ffa000", "900": "#ff6f00" };
var orange = { "100": "#ffe0b2", "300": "#ffb74d", "500": "#ff9800", "700": "#f57c00", "900": "#e65100" };
var deepOrange = { "100": "#ffccbc", "300": "#ff8a65", "500": "#ff5722", "700": "#e64a19", "900": "#bf360c" };
var brown = { "100": "#d7ccc8", "300": "#a1887f", "500": "#795548", "700": "#5d4037", "900": "#3e2723" };
var blueGrey = { "100": "#cfd8dc", "300": "#90a4ae", "500": "#607d8b", "700": "#455a64", "900": "#263238" };
var CircleSwatch = function CircleSwatch2(_ref) {
  var color2 = _ref.color, onClick = _ref.onClick, onSwatchHover = _ref.onSwatchHover, hover3 = _ref.hover, active3 = _ref.active, circleSize = _ref.circleSize, circleSpacing = _ref.circleSpacing;
  var styles2 = _default$4({
    "default": {
      swatch: {
        width: circleSize,
        height: circleSize,
        marginRight: circleSpacing,
        marginBottom: circleSpacing,
        transform: "scale(1)",
        transition: "100ms transform ease"
      },
      Swatch: {
        borderRadius: "50%",
        background: "transparent",
        boxShadow: "inset 0 0 0 " + (circleSize / 2 + 1) + "px " + color2,
        transition: "100ms box-shadow ease"
      }
    },
    "hover": {
      swatch: {
        transform: "scale(1.2)"
      }
    },
    "active": {
      Swatch: {
        boxShadow: "inset 0 0 0 3px " + color2
      }
    }
  }, { hover: hover3, active: active3 });
  return React$5.createElement(
    "div",
    { style: styles2.swatch },
    React$5.createElement(Swatch$1, {
      style: styles2.Swatch,
      color: color2,
      onClick,
      onHover: onSwatchHover,
      focusStyle: { boxShadow: styles2.Swatch.boxShadow + ", 0 0 5px " + color2 }
    })
  );
};
CircleSwatch.defaultProps = {
  circleSize: 28,
  circleSpacing: 14
};
const CircleSwatch$1 = handleHover(CircleSwatch);
var Circle = function Circle2(_ref) {
  var width = _ref.width, onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, colors2 = _ref.colors, hex3 = _ref.hex, circleSize = _ref.circleSize, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, circleSpacing = _ref.circleSpacing, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4(merge$3({
    "default": {
      card: {
        width,
        display: "flex",
        flexWrap: "wrap",
        marginRight: -circleSpacing,
        marginBottom: -circleSpacing
      }
    }
  }, passedStyles));
  var handleChange = function handleChange2(hexCode, e2) {
    return onChange({ hex: hexCode, source: "hex" }, e2);
  };
  return React$5.createElement(
    "div",
    { style: styles2.card, className: "circle-picker " + className },
    map$3(colors2, function(c2) {
      return React$5.createElement(CircleSwatch$1, {
        key: c2,
        color: c2,
        onClick: handleChange,
        onSwatchHover,
        active: hex3 === c2.toLowerCase(),
        circleSize,
        circleSpacing
      });
    })
  );
};
Circle.propTypes = {
  width: PropTypes$4.oneOfType([PropTypes$4.string, PropTypes$4.number]),
  circleSize: PropTypes$4.number,
  circleSpacing: PropTypes$4.number,
  styles: PropTypes$4.object
};
Circle.defaultProps = {
  width: 252,
  circleSize: 28,
  circleSpacing: 14,
  colors: [red["500"], pink["500"], purple["500"], deepPurple["500"], indigo["500"], blue["500"], lightBlue["500"], cyan["500"], teal["500"], green["500"], lightGreen["500"], lime["500"], yellow["500"], amber["500"], orange["500"], deepOrange["500"], brown["500"], blueGrey["500"]],
  styles: {}
};
ColorWrap(Circle);
function isUndefined$2(value2) {
  return value2 === void 0;
}
var UnfoldMoreHorizontalIcon = {};
Object.defineProperty(UnfoldMoreHorizontalIcon, "__esModule", {
  value: true
});
var _extends$6 = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var _react$1 = reactExports;
var _react2$1 = _interopRequireDefault$1(_react$1);
function _interopRequireDefault$1(obj) {
  return obj && obj.__esModule ? obj : { default: obj };
}
function _objectWithoutProperties$2(obj, keys2) {
  var target = {};
  for (var i2 in obj) {
    if (keys2.indexOf(i2) >= 0)
      continue;
    if (!Object.prototype.hasOwnProperty.call(obj, i2))
      continue;
    target[i2] = obj[i2];
  }
  return target;
}
var DEFAULT_SIZE$1 = 24;
var _default$3 = UnfoldMoreHorizontalIcon.default = function(_ref) {
  var _ref$fill = _ref.fill, fill = _ref$fill === void 0 ? "currentColor" : _ref$fill, _ref$width = _ref.width, width = _ref$width === void 0 ? DEFAULT_SIZE$1 : _ref$width, _ref$height = _ref.height, height = _ref$height === void 0 ? DEFAULT_SIZE$1 : _ref$height, _ref$style = _ref.style, style2 = _ref$style === void 0 ? {} : _ref$style, props = _objectWithoutProperties$2(_ref, ["fill", "width", "height", "style"]);
  return _react2$1.default.createElement(
    "svg",
    _extends$6({
      viewBox: "0 0 " + DEFAULT_SIZE$1 + " " + DEFAULT_SIZE$1,
      style: _extends$6({ fill, width, height }, style2)
    }, props),
    _react2$1.default.createElement("path", { d: "M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z" })
  );
};
var _createClass$1 = /* @__PURE__ */ function() {
  function defineProperties(target, props) {
    for (var i2 = 0; i2 < props.length; i2++) {
      var descriptor = props[i2];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor)
        descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }
  return function(Constructor, protoProps, staticProps) {
    if (protoProps)
      defineProperties(Constructor.prototype, protoProps);
    if (staticProps)
      defineProperties(Constructor, staticProps);
    return Constructor;
  };
}();
function _classCallCheck$1(instance2, Constructor) {
  if (!(instance2 instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn$1(self2, call2) {
  if (!self2) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call2 && (typeof call2 === "object" || typeof call2 === "function") ? call2 : self2;
}
function _inherits$1(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
  if (superClass)
    Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var ChromeFields = function(_React$Component) {
  _inherits$1(ChromeFields2, _React$Component);
  function ChromeFields2(props) {
    _classCallCheck$1(this, ChromeFields2);
    var _this = _possibleConstructorReturn$1(this, (ChromeFields2.__proto__ || Object.getPrototypeOf(ChromeFields2)).call(this));
    _this.toggleViews = function() {
      if (_this.state.view === "hex") {
        _this.setState({ view: "rgb" });
      } else if (_this.state.view === "rgb") {
        _this.setState({ view: "hsl" });
      } else if (_this.state.view === "hsl") {
        if (_this.props.hsl.a === 1) {
          _this.setState({ view: "hex" });
        } else {
          _this.setState({ view: "rgb" });
        }
      }
    };
    _this.handleChange = function(data, e2) {
      if (data.hex) {
        isValidHex(data.hex) && _this.props.onChange({
          hex: data.hex,
          source: "hex"
        }, e2);
      } else if (data.r || data.g || data.b) {
        _this.props.onChange({
          r: data.r || _this.props.rgb.r,
          g: data.g || _this.props.rgb.g,
          b: data.b || _this.props.rgb.b,
          source: "rgb"
        }, e2);
      } else if (data.a) {
        if (data.a < 0) {
          data.a = 0;
        } else if (data.a > 1) {
          data.a = 1;
        }
        _this.props.onChange({
          h: _this.props.hsl.h,
          s: _this.props.hsl.s,
          l: _this.props.hsl.l,
          a: Math.round(data.a * 100) / 100,
          source: "rgb"
        }, e2);
      } else if (data.h || data.s || data.l) {
        if (typeof data.s === "string" && data.s.includes("%")) {
          data.s = data.s.replace("%", "");
        }
        if (typeof data.l === "string" && data.l.includes("%")) {
          data.l = data.l.replace("%", "");
        }
        if (data.s == 1) {
          data.s = 0.01;
        } else if (data.l == 1) {
          data.l = 0.01;
        }
        _this.props.onChange({
          h: data.h || _this.props.hsl.h,
          s: Number(!isUndefined$2(data.s) ? data.s : _this.props.hsl.s),
          l: Number(!isUndefined$2(data.l) ? data.l : _this.props.hsl.l),
          source: "hsl"
        }, e2);
      }
    };
    _this.showHighlight = function(e2) {
      e2.currentTarget.style.background = "#eee";
    };
    _this.hideHighlight = function(e2) {
      e2.currentTarget.style.background = "transparent";
    };
    if (props.hsl.a !== 1 && props.view === "hex") {
      _this.state = {
        view: "rgb"
      };
    } else {
      _this.state = {
        view: props.view
      };
    }
    return _this;
  }
  _createClass$1(ChromeFields2, [{
    key: "render",
    value: function render3() {
      var _this2 = this;
      var styles2 = _default$4({
        "default": {
          wrap: {
            paddingTop: "16px",
            display: "flex"
          },
          fields: {
            flex: "1",
            display: "flex",
            marginLeft: "-6px"
          },
          field: {
            paddingLeft: "6px",
            width: "100%"
          },
          alpha: {
            paddingLeft: "6px",
            width: "100%"
          },
          toggle: {
            width: "32px",
            textAlign: "right",
            position: "relative"
          },
          icon: {
            marginRight: "-4px",
            marginTop: "12px",
            cursor: "pointer",
            position: "relative"
          },
          iconHighlight: {
            position: "absolute",
            width: "24px",
            height: "28px",
            background: "#eee",
            borderRadius: "4px",
            top: "10px",
            left: "12px",
            display: "none"
          },
          input: {
            fontSize: "11px",
            color: "#333",
            width: "100%",
            borderRadius: "2px",
            border: "none",
            boxShadow: "inset 0 0 0 1px #dadada",
            height: "21px",
            textAlign: "center"
          },
          label: {
            textTransform: "uppercase",
            fontSize: "11px",
            lineHeight: "11px",
            color: "#969696",
            textAlign: "center",
            display: "block",
            marginTop: "12px"
          },
          svg: {
            fill: "#333",
            width: "24px",
            height: "24px",
            border: "1px transparent solid",
            borderRadius: "5px"
          }
        },
        "disableAlpha": {
          alpha: {
            display: "none"
          }
        }
      }, this.props, this.state);
      var fields = void 0;
      if (this.state.view === "hex") {
        fields = React$5.createElement(
          "div",
          { style: styles2.fields, className: "flexbox-fix" },
          React$5.createElement(
            "div",
            { style: styles2.field },
            React$5.createElement(EditableInput, {
              style: { input: styles2.input, label: styles2.label },
              label: "hex",
              value: this.props.hex,
              onChange: this.handleChange
            })
          )
        );
      } else if (this.state.view === "rgb") {
        fields = React$5.createElement(
          "div",
          { style: styles2.fields, className: "flexbox-fix" },
          React$5.createElement(
            "div",
            { style: styles2.field },
            React$5.createElement(EditableInput, {
              style: { input: styles2.input, label: styles2.label },
              label: "r",
              value: this.props.rgb.r,
              onChange: this.handleChange
            })
          ),
          React$5.createElement(
            "div",
            { style: styles2.field },
            React$5.createElement(EditableInput, {
              style: { input: styles2.input, label: styles2.label },
              label: "g",
              value: this.props.rgb.g,
              onChange: this.handleChange
            })
          ),
          React$5.createElement(
            "div",
            { style: styles2.field },
            React$5.createElement(EditableInput, {
              style: { input: styles2.input, label: styles2.label },
              label: "b",
              value: this.props.rgb.b,
              onChange: this.handleChange
            })
          ),
          React$5.createElement(
            "div",
            { style: styles2.alpha },
            React$5.createElement(EditableInput, {
              style: { input: styles2.input, label: styles2.label },
              label: "a",
              value: this.props.rgb.a,
              arrowOffset: 0.01,
              onChange: this.handleChange
            })
          )
        );
      } else if (this.state.view === "hsl") {
        fields = React$5.createElement(
          "div",
          { style: styles2.fields, className: "flexbox-fix" },
          React$5.createElement(
            "div",
            { style: styles2.field },
            React$5.createElement(EditableInput, {
              style: { input: styles2.input, label: styles2.label },
              label: "h",
              value: Math.round(this.props.hsl.h),
              onChange: this.handleChange
            })
          ),
          React$5.createElement(
            "div",
            { style: styles2.field },
            React$5.createElement(EditableInput, {
              style: { input: styles2.input, label: styles2.label },
              label: "s",
              value: Math.round(this.props.hsl.s * 100) + "%",
              onChange: this.handleChange
            })
          ),
          React$5.createElement(
            "div",
            { style: styles2.field },
            React$5.createElement(EditableInput, {
              style: { input: styles2.input, label: styles2.label },
              label: "l",
              value: Math.round(this.props.hsl.l * 100) + "%",
              onChange: this.handleChange
            })
          ),
          React$5.createElement(
            "div",
            { style: styles2.alpha },
            React$5.createElement(EditableInput, {
              style: { input: styles2.input, label: styles2.label },
              label: "a",
              value: this.props.hsl.a,
              arrowOffset: 0.01,
              onChange: this.handleChange
            })
          )
        );
      }
      return React$5.createElement(
        "div",
        { style: styles2.wrap, className: "flexbox-fix" },
        fields,
        React$5.createElement(
          "div",
          { style: styles2.toggle },
          React$5.createElement(
            "div",
            { style: styles2.icon, onClick: this.toggleViews, ref: function ref(icon) {
              return _this2.icon = icon;
            } },
            React$5.createElement(_default$3, {
              style: styles2.svg,
              onMouseOver: this.showHighlight,
              onMouseEnter: this.showHighlight,
              onMouseOut: this.hideHighlight
            })
          )
        )
      );
    }
  }], [{
    key: "getDerivedStateFromProps",
    value: function getDerivedStateFromProps(nextProps, state) {
      if (nextProps.hsl.a !== 1 && state.view === "hex") {
        return { view: "rgb" };
      }
      return null;
    }
  }]);
  return ChromeFields2;
}(React$5.Component);
ChromeFields.defaultProps = {
  view: "hex"
};
var ChromePointer = function ChromePointer2() {
  var styles2 = _default$4({
    "default": {
      picker: {
        width: "12px",
        height: "12px",
        borderRadius: "6px",
        transform: "translate(-6px, -1px)",
        backgroundColor: "rgb(248, 248, 248)",
        boxShadow: "0 1px 4px 0 rgba(0, 0, 0, 0.37)"
      }
    }
  });
  return React$5.createElement("div", { style: styles2.picker });
};
var ChromePointerCircle = function ChromePointerCircle2() {
  var styles2 = _default$4({
    "default": {
      picker: {
        width: "12px",
        height: "12px",
        borderRadius: "6px",
        boxShadow: "inset 0 0 0 1px #fff",
        transform: "translate(-6px, -6px)"
      }
    }
  });
  return React$5.createElement("div", { style: styles2.picker });
};
var Chrome = function Chrome2(_ref) {
  var width = _ref.width, onChange = _ref.onChange, disableAlpha = _ref.disableAlpha, rgb = _ref.rgb, hsl = _ref.hsl, hsv = _ref.hsv, hex3 = _ref.hex, renderers = _ref.renderers, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className, defaultView = _ref.defaultView;
  var styles2 = _default$4(merge$3({
    "default": {
      picker: {
        width,
        background: "#fff",
        borderRadius: "2px",
        boxShadow: "0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)",
        boxSizing: "initial",
        fontFamily: "Menlo"
      },
      saturation: {
        width: "100%",
        paddingBottom: "55%",
        position: "relative",
        borderRadius: "2px 2px 0 0",
        overflow: "hidden"
      },
      Saturation: {
        radius: "2px 2px 0 0"
      },
      body: {
        padding: "16px 16px 12px"
      },
      controls: {
        display: "flex"
      },
      color: {
        width: "32px"
      },
      swatch: {
        marginTop: "6px",
        width: "16px",
        height: "16px",
        borderRadius: "8px",
        position: "relative",
        overflow: "hidden"
      },
      active: {
        absolute: "0px 0px 0px 0px",
        borderRadius: "8px",
        boxShadow: "inset 0 0 0 1px rgba(0,0,0,.1)",
        background: "rgba(" + rgb.r + ", " + rgb.g + ", " + rgb.b + ", " + rgb.a + ")",
        zIndex: "2"
      },
      toggles: {
        flex: "1"
      },
      hue: {
        height: "10px",
        position: "relative",
        marginBottom: "8px"
      },
      Hue: {
        radius: "2px"
      },
      alpha: {
        height: "10px",
        position: "relative"
      },
      Alpha: {
        radius: "2px"
      }
    },
    "disableAlpha": {
      color: {
        width: "22px"
      },
      alpha: {
        display: "none"
      },
      hue: {
        marginBottom: "0px"
      },
      swatch: {
        width: "10px",
        height: "10px",
        marginTop: "0px"
      }
    }
  }, passedStyles), { disableAlpha });
  return React$5.createElement(
    "div",
    { style: styles2.picker, className: "chrome-picker " + className },
    React$5.createElement(
      "div",
      { style: styles2.saturation },
      React$5.createElement(Saturation, {
        style: styles2.Saturation,
        hsl,
        hsv,
        pointer: ChromePointerCircle,
        onChange
      })
    ),
    React$5.createElement(
      "div",
      { style: styles2.body },
      React$5.createElement(
        "div",
        { style: styles2.controls, className: "flexbox-fix" },
        React$5.createElement(
          "div",
          { style: styles2.color },
          React$5.createElement(
            "div",
            { style: styles2.swatch },
            React$5.createElement("div", { style: styles2.active }),
            React$5.createElement(Checkboard, { renderers })
          )
        ),
        React$5.createElement(
          "div",
          { style: styles2.toggles },
          React$5.createElement(
            "div",
            { style: styles2.hue },
            React$5.createElement(Hue, {
              style: styles2.Hue,
              hsl,
              pointer: ChromePointer,
              onChange
            })
          ),
          React$5.createElement(
            "div",
            { style: styles2.alpha },
            React$5.createElement(Alpha, {
              style: styles2.Alpha,
              rgb,
              hsl,
              pointer: ChromePointer,
              renderers,
              onChange
            })
          )
        )
      ),
      React$5.createElement(ChromeFields, {
        rgb,
        hsl,
        hex: hex3,
        view: defaultView,
        onChange,
        disableAlpha
      })
    )
  );
};
Chrome.propTypes = {
  width: PropTypes$4.oneOfType([PropTypes$4.string, PropTypes$4.number]),
  disableAlpha: PropTypes$4.bool,
  styles: PropTypes$4.object,
  defaultView: PropTypes$4.oneOf(["hex", "rgb", "hsl"])
};
Chrome.defaultProps = {
  width: 225,
  disableAlpha: false,
  styles: {}
};
ColorWrap(Chrome);
var CompactColor = function CompactColor2(_ref) {
  var color2 = _ref.color, _ref$onClick = _ref.onClick, onClick = _ref$onClick === void 0 ? function() {
  } : _ref$onClick, onSwatchHover = _ref.onSwatchHover, active3 = _ref.active;
  var styles2 = _default$4({
    "default": {
      color: {
        background: color2,
        width: "15px",
        height: "15px",
        float: "left",
        marginRight: "5px",
        marginBottom: "5px",
        position: "relative",
        cursor: "pointer"
      },
      dot: {
        absolute: "5px 5px 5px 5px",
        background: getContrastingColor(color2),
        borderRadius: "50%",
        opacity: "0"
      }
    },
    "active": {
      dot: {
        opacity: "1"
      }
    },
    "color-#FFFFFF": {
      color: {
        boxShadow: "inset 0 0 0 1px #ddd"
      },
      dot: {
        background: "#000"
      }
    },
    "transparent": {
      dot: {
        background: "#000"
      }
    }
  }, { active: active3, "color-#FFFFFF": color2 === "#FFFFFF", "transparent": color2 === "transparent" });
  return React$5.createElement(
    Swatch$1,
    {
      style: styles2.color,
      color: color2,
      onClick,
      onHover: onSwatchHover,
      focusStyle: { boxShadow: "0 0 4px " + color2 }
    },
    React$5.createElement("div", { style: styles2.dot })
  );
};
var CompactFields = function CompactFields2(_ref) {
  var hex3 = _ref.hex, rgb = _ref.rgb, onChange = _ref.onChange;
  var styles2 = _default$4({
    "default": {
      fields: {
        display: "flex",
        paddingBottom: "6px",
        paddingRight: "5px",
        position: "relative"
      },
      active: {
        position: "absolute",
        top: "6px",
        left: "5px",
        height: "9px",
        width: "9px",
        background: hex3
      },
      HEXwrap: {
        flex: "6",
        position: "relative"
      },
      HEXinput: {
        width: "80%",
        padding: "0px",
        paddingLeft: "20%",
        border: "none",
        outline: "none",
        background: "none",
        fontSize: "12px",
        color: "#333",
        height: "16px"
      },
      HEXlabel: {
        display: "none"
      },
      RGBwrap: {
        flex: "3",
        position: "relative"
      },
      RGBinput: {
        width: "70%",
        padding: "0px",
        paddingLeft: "30%",
        border: "none",
        outline: "none",
        background: "none",
        fontSize: "12px",
        color: "#333",
        height: "16px"
      },
      RGBlabel: {
        position: "absolute",
        top: "3px",
        left: "0px",
        lineHeight: "16px",
        textTransform: "uppercase",
        fontSize: "12px",
        color: "#999"
      }
    }
  });
  var handleChange = function handleChange2(data, e2) {
    if (data.r || data.g || data.b) {
      onChange({
        r: data.r || rgb.r,
        g: data.g || rgb.g,
        b: data.b || rgb.b,
        source: "rgb"
      }, e2);
    } else {
      onChange({
        hex: data.hex,
        source: "hex"
      }, e2);
    }
  };
  return React$5.createElement(
    "div",
    { style: styles2.fields, className: "flexbox-fix" },
    React$5.createElement("div", { style: styles2.active }),
    React$5.createElement(EditableInput, {
      style: { wrap: styles2.HEXwrap, input: styles2.HEXinput, label: styles2.HEXlabel },
      label: "hex",
      value: hex3,
      onChange: handleChange
    }),
    React$5.createElement(EditableInput, {
      style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
      label: "r",
      value: rgb.r,
      onChange: handleChange
    }),
    React$5.createElement(EditableInput, {
      style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
      label: "g",
      value: rgb.g,
      onChange: handleChange
    }),
    React$5.createElement(EditableInput, {
      style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
      label: "b",
      value: rgb.b,
      onChange: handleChange
    })
  );
};
var Compact = function Compact2(_ref) {
  var onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, colors2 = _ref.colors, hex3 = _ref.hex, rgb = _ref.rgb, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4(merge$3({
    "default": {
      Compact: {
        background: "#f6f6f6",
        radius: "4px"
      },
      compact: {
        paddingTop: "5px",
        paddingLeft: "5px",
        boxSizing: "initial",
        width: "240px"
      },
      clear: {
        clear: "both"
      }
    }
  }, passedStyles));
  var handleChange = function handleChange2(data, e2) {
    if (data.hex) {
      isValidHex(data.hex) && onChange({
        hex: data.hex,
        source: "hex"
      }, e2);
    } else {
      onChange(data, e2);
    }
  };
  return React$5.createElement(
    Raised,
    { style: styles2.Compact, styles: passedStyles },
    React$5.createElement(
      "div",
      { style: styles2.compact, className: "compact-picker " + className },
      React$5.createElement(
        "div",
        null,
        map$3(colors2, function(c2) {
          return React$5.createElement(CompactColor, {
            key: c2,
            color: c2,
            active: c2.toLowerCase() === hex3,
            onClick: handleChange,
            onSwatchHover
          });
        }),
        React$5.createElement("div", { style: styles2.clear })
      ),
      React$5.createElement(CompactFields, { hex: hex3, rgb, onChange: handleChange })
    )
  );
};
Compact.propTypes = {
  colors: PropTypes$4.arrayOf(PropTypes$4.string),
  styles: PropTypes$4.object
};
Compact.defaultProps = {
  colors: ["#4D4D4D", "#999999", "#FFFFFF", "#F44E3B", "#FE9200", "#FCDC00", "#DBDF00", "#A4DD00", "#68CCCA", "#73D8FF", "#AEA1FF", "#FDA1FF", "#333333", "#808080", "#cccccc", "#D33115", "#E27300", "#FCC400", "#B0BC00", "#68BC00", "#16A5A5", "#009CE0", "#7B64FF", "#FA28FF", "#000000", "#666666", "#B3B3B3", "#9F0500", "#C45100", "#FB9E00", "#808900", "#194D33", "#0C797D", "#0062B1", "#653294", "#AB149E"],
  styles: {}
};
ColorWrap(Compact);
var GithubSwatch = function GithubSwatch2(_ref) {
  var hover3 = _ref.hover, color2 = _ref.color, onClick = _ref.onClick, onSwatchHover = _ref.onSwatchHover;
  var hoverSwatch = {
    position: "relative",
    zIndex: "2",
    outline: "2px solid #fff",
    boxShadow: "0 0 5px 2px rgba(0,0,0,0.25)"
  };
  var styles2 = _default$4({
    "default": {
      swatch: {
        width: "25px",
        height: "25px",
        fontSize: "0"
      }
    },
    "hover": {
      swatch: hoverSwatch
    }
  }, { hover: hover3 });
  return React$5.createElement(
    "div",
    { style: styles2.swatch },
    React$5.createElement(Swatch$1, {
      color: color2,
      onClick,
      onHover: onSwatchHover,
      focusStyle: hoverSwatch
    })
  );
};
const GithubSwatch$1 = handleHover(GithubSwatch);
var Github = function Github2(_ref) {
  var width = _ref.width, colors2 = _ref.colors, onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, triangle = _ref.triangle, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4(merge$3({
    "default": {
      card: {
        width,
        background: "#fff",
        border: "1px solid rgba(0,0,0,0.2)",
        boxShadow: "0 3px 12px rgba(0,0,0,0.15)",
        borderRadius: "4px",
        position: "relative",
        padding: "5px",
        display: "flex",
        flexWrap: "wrap"
      },
      triangle: {
        position: "absolute",
        border: "7px solid transparent",
        borderBottomColor: "#fff"
      },
      triangleShadow: {
        position: "absolute",
        border: "8px solid transparent",
        borderBottomColor: "rgba(0,0,0,0.15)"
      }
    },
    "hide-triangle": {
      triangle: {
        display: "none"
      },
      triangleShadow: {
        display: "none"
      }
    },
    "top-left-triangle": {
      triangle: {
        top: "-14px",
        left: "10px"
      },
      triangleShadow: {
        top: "-16px",
        left: "9px"
      }
    },
    "top-right-triangle": {
      triangle: {
        top: "-14px",
        right: "10px"
      },
      triangleShadow: {
        top: "-16px",
        right: "9px"
      }
    },
    "bottom-left-triangle": {
      triangle: {
        top: "35px",
        left: "10px",
        transform: "rotate(180deg)"
      },
      triangleShadow: {
        top: "37px",
        left: "9px",
        transform: "rotate(180deg)"
      }
    },
    "bottom-right-triangle": {
      triangle: {
        top: "35px",
        right: "10px",
        transform: "rotate(180deg)"
      },
      triangleShadow: {
        top: "37px",
        right: "9px",
        transform: "rotate(180deg)"
      }
    }
  }, passedStyles), {
    "hide-triangle": triangle === "hide",
    "top-left-triangle": triangle === "top-left",
    "top-right-triangle": triangle === "top-right",
    "bottom-left-triangle": triangle === "bottom-left",
    "bottom-right-triangle": triangle === "bottom-right"
  });
  var handleChange = function handleChange2(hex3, e2) {
    return onChange({ hex: hex3, source: "hex" }, e2);
  };
  return React$5.createElement(
    "div",
    { style: styles2.card, className: "github-picker " + className },
    React$5.createElement("div", { style: styles2.triangleShadow }),
    React$5.createElement("div", { style: styles2.triangle }),
    map$3(colors2, function(c2) {
      return React$5.createElement(GithubSwatch$1, {
        color: c2,
        key: c2,
        onClick: handleChange,
        onSwatchHover
      });
    })
  );
};
Github.propTypes = {
  width: PropTypes$4.oneOfType([PropTypes$4.string, PropTypes$4.number]),
  colors: PropTypes$4.arrayOf(PropTypes$4.string),
  triangle: PropTypes$4.oneOf(["hide", "top-left", "top-right", "bottom-left", "bottom-right"]),
  styles: PropTypes$4.object
};
Github.defaultProps = {
  width: 200,
  colors: ["#B80000", "#DB3E00", "#FCCB00", "#008B02", "#006B76", "#1273DE", "#004DCF", "#5300EB", "#EB9694", "#FAD0C3", "#FEF3BD", "#C1E1C5", "#BEDADC", "#C4DEF6", "#BED3F3", "#D4C4FB"],
  triangle: "top-left",
  styles: {}
};
ColorWrap(Github);
var SliderPointer$1 = function SliderPointer(_ref) {
  var direction = _ref.direction;
  var styles2 = _default$4({
    "default": {
      picker: {
        width: "18px",
        height: "18px",
        borderRadius: "50%",
        transform: "translate(-9px, -1px)",
        backgroundColor: "rgb(248, 248, 248)",
        boxShadow: "0 1px 4px 0 rgba(0, 0, 0, 0.37)"
      }
    },
    "vertical": {
      picker: {
        transform: "translate(-3px, -9px)"
      }
    }
  }, { vertical: direction === "vertical" });
  return React$5.createElement("div", { style: styles2.picker });
};
var _extends$5 = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var HuePicker = function HuePicker2(_ref) {
  var width = _ref.width, height = _ref.height, onChange = _ref.onChange, hsl = _ref.hsl, direction = _ref.direction, pointer = _ref.pointer, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4(merge$3({
    "default": {
      picker: {
        position: "relative",
        width,
        height
      },
      hue: {
        radius: "2px"
      }
    }
  }, passedStyles));
  var handleChange = function handleChange2(data) {
    return onChange({ a: 1, h: data.h, l: 0.5, s: 1 });
  };
  return React$5.createElement(
    "div",
    { style: styles2.picker, className: "hue-picker " + className },
    React$5.createElement(Hue, _extends$5({}, styles2.hue, {
      hsl,
      pointer,
      onChange: handleChange,
      direction
    }))
  );
};
HuePicker.propTypes = {
  styles: PropTypes$4.object
};
HuePicker.defaultProps = {
  width: "316px",
  height: "16px",
  direction: "horizontal",
  pointer: SliderPointer$1,
  styles: {}
};
ColorWrap(HuePicker);
var Material = function Material2(_ref) {
  var onChange = _ref.onChange, hex3 = _ref.hex, rgb = _ref.rgb, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4(merge$3({
    "default": {
      material: {
        width: "98px",
        height: "98px",
        padding: "16px",
        fontFamily: "Roboto"
      },
      HEXwrap: {
        position: "relative"
      },
      HEXinput: {
        width: "100%",
        marginTop: "12px",
        fontSize: "15px",
        color: "#333",
        padding: "0px",
        border: "0px",
        borderBottom: "2px solid " + hex3,
        outline: "none",
        height: "30px"
      },
      HEXlabel: {
        position: "absolute",
        top: "0px",
        left: "0px",
        fontSize: "11px",
        color: "#999999",
        textTransform: "capitalize"
      },
      Hex: {
        style: {}
      },
      RGBwrap: {
        position: "relative"
      },
      RGBinput: {
        width: "100%",
        marginTop: "12px",
        fontSize: "15px",
        color: "#333",
        padding: "0px",
        border: "0px",
        borderBottom: "1px solid #eee",
        outline: "none",
        height: "30px"
      },
      RGBlabel: {
        position: "absolute",
        top: "0px",
        left: "0px",
        fontSize: "11px",
        color: "#999999",
        textTransform: "capitalize"
      },
      split: {
        display: "flex",
        marginRight: "-10px",
        paddingTop: "11px"
      },
      third: {
        flex: "1",
        paddingRight: "10px"
      }
    }
  }, passedStyles));
  var handleChange = function handleChange2(data, e2) {
    if (data.hex) {
      isValidHex(data.hex) && onChange({
        hex: data.hex,
        source: "hex"
      }, e2);
    } else if (data.r || data.g || data.b) {
      onChange({
        r: data.r || rgb.r,
        g: data.g || rgb.g,
        b: data.b || rgb.b,
        source: "rgb"
      }, e2);
    }
  };
  return React$5.createElement(
    Raised,
    { styles: passedStyles },
    React$5.createElement(
      "div",
      { style: styles2.material, className: "material-picker " + className },
      React$5.createElement(EditableInput, {
        style: { wrap: styles2.HEXwrap, input: styles2.HEXinput, label: styles2.HEXlabel },
        label: "hex",
        value: hex3,
        onChange: handleChange
      }),
      React$5.createElement(
        "div",
        { style: styles2.split, className: "flexbox-fix" },
        React$5.createElement(
          "div",
          { style: styles2.third },
          React$5.createElement(EditableInput, {
            style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
            label: "r",
            value: rgb.r,
            onChange: handleChange
          })
        ),
        React$5.createElement(
          "div",
          { style: styles2.third },
          React$5.createElement(EditableInput, {
            style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
            label: "g",
            value: rgb.g,
            onChange: handleChange
          })
        ),
        React$5.createElement(
          "div",
          { style: styles2.third },
          React$5.createElement(EditableInput, {
            style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
            label: "b",
            value: rgb.b,
            onChange: handleChange
          })
        )
      )
    )
  );
};
ColorWrap(Material);
var PhotoshopPicker = function PhotoshopPicker2(_ref) {
  var onChange = _ref.onChange, rgb = _ref.rgb, hsv = _ref.hsv, hex3 = _ref.hex;
  var styles2 = _default$4({
    "default": {
      fields: {
        paddingTop: "5px",
        paddingBottom: "9px",
        width: "80px",
        position: "relative"
      },
      divider: {
        height: "5px"
      },
      RGBwrap: {
        position: "relative"
      },
      RGBinput: {
        marginLeft: "40%",
        width: "40%",
        height: "18px",
        border: "1px solid #888888",
        boxShadow: "inset 0 1px 1px rgba(0,0,0,.1), 0 1px 0 0 #ECECEC",
        marginBottom: "5px",
        fontSize: "13px",
        paddingLeft: "3px",
        marginRight: "10px"
      },
      RGBlabel: {
        left: "0px",
        top: "0px",
        width: "34px",
        textTransform: "uppercase",
        fontSize: "13px",
        height: "18px",
        lineHeight: "22px",
        position: "absolute"
      },
      HEXwrap: {
        position: "relative"
      },
      HEXinput: {
        marginLeft: "20%",
        width: "80%",
        height: "18px",
        border: "1px solid #888888",
        boxShadow: "inset 0 1px 1px rgba(0,0,0,.1), 0 1px 0 0 #ECECEC",
        marginBottom: "6px",
        fontSize: "13px",
        paddingLeft: "3px"
      },
      HEXlabel: {
        position: "absolute",
        top: "0px",
        left: "0px",
        width: "14px",
        textTransform: "uppercase",
        fontSize: "13px",
        height: "18px",
        lineHeight: "22px"
      },
      fieldSymbols: {
        position: "absolute",
        top: "5px",
        right: "-7px",
        fontSize: "13px"
      },
      symbol: {
        height: "20px",
        lineHeight: "22px",
        paddingBottom: "7px"
      }
    }
  });
  var handleChange = function handleChange2(data, e2) {
    if (data["#"]) {
      isValidHex(data["#"]) && onChange({
        hex: data["#"],
        source: "hex"
      }, e2);
    } else if (data.r || data.g || data.b) {
      onChange({
        r: data.r || rgb.r,
        g: data.g || rgb.g,
        b: data.b || rgb.b,
        source: "rgb"
      }, e2);
    } else if (data.h || data.s || data.v) {
      onChange({
        h: data.h || hsv.h,
        s: data.s || hsv.s,
        v: data.v || hsv.v,
        source: "hsv"
      }, e2);
    }
  };
  return React$5.createElement(
    "div",
    { style: styles2.fields },
    React$5.createElement(EditableInput, {
      style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
      label: "h",
      value: Math.round(hsv.h),
      onChange: handleChange
    }),
    React$5.createElement(EditableInput, {
      style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
      label: "s",
      value: Math.round(hsv.s * 100),
      onChange: handleChange
    }),
    React$5.createElement(EditableInput, {
      style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
      label: "v",
      value: Math.round(hsv.v * 100),
      onChange: handleChange
    }),
    React$5.createElement("div", { style: styles2.divider }),
    React$5.createElement(EditableInput, {
      style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
      label: "r",
      value: rgb.r,
      onChange: handleChange
    }),
    React$5.createElement(EditableInput, {
      style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
      label: "g",
      value: rgb.g,
      onChange: handleChange
    }),
    React$5.createElement(EditableInput, {
      style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
      label: "b",
      value: rgb.b,
      onChange: handleChange
    }),
    React$5.createElement("div", { style: styles2.divider }),
    React$5.createElement(EditableInput, {
      style: { wrap: styles2.HEXwrap, input: styles2.HEXinput, label: styles2.HEXlabel },
      label: "#",
      value: hex3.replace("#", ""),
      onChange: handleChange
    }),
    React$5.createElement(
      "div",
      { style: styles2.fieldSymbols },
      React$5.createElement(
        "div",
        { style: styles2.symbol },
        "°"
      ),
      React$5.createElement(
        "div",
        { style: styles2.symbol },
        "%"
      ),
      React$5.createElement(
        "div",
        { style: styles2.symbol },
        "%"
      )
    )
  );
};
var PhotoshopPointerCircle$1 = function PhotoshopPointerCircle(_ref) {
  var hsl = _ref.hsl;
  var styles2 = _default$4({
    "default": {
      picker: {
        width: "12px",
        height: "12px",
        borderRadius: "6px",
        boxShadow: "inset 0 0 0 1px #fff",
        transform: "translate(-6px, -6px)"
      }
    },
    "black-outline": {
      picker: {
        boxShadow: "inset 0 0 0 1px #000"
      }
    }
  }, { "black-outline": hsl.l > 0.5 });
  return React$5.createElement("div", { style: styles2.picker });
};
var PhotoshopPointerCircle2 = function PhotoshopPointerCircle3() {
  var styles2 = _default$4({
    "default": {
      triangle: {
        width: 0,
        height: 0,
        borderStyle: "solid",
        borderWidth: "4px 0 4px 6px",
        borderColor: "transparent transparent transparent #fff",
        position: "absolute",
        top: "1px",
        left: "1px"
      },
      triangleBorder: {
        width: 0,
        height: 0,
        borderStyle: "solid",
        borderWidth: "5px 0 5px 8px",
        borderColor: "transparent transparent transparent #555"
      },
      left: {
        Extend: "triangleBorder",
        transform: "translate(-13px, -4px)"
      },
      leftInside: {
        Extend: "triangle",
        transform: "translate(-8px, -5px)"
      },
      right: {
        Extend: "triangleBorder",
        transform: "translate(20px, -14px) rotate(180deg)"
      },
      rightInside: {
        Extend: "triangle",
        transform: "translate(-8px, -5px)"
      }
    }
  });
  return React$5.createElement(
    "div",
    { style: styles2.pointer },
    React$5.createElement(
      "div",
      { style: styles2.left },
      React$5.createElement("div", { style: styles2.leftInside })
    ),
    React$5.createElement(
      "div",
      { style: styles2.right },
      React$5.createElement("div", { style: styles2.rightInside })
    )
  );
};
var PhotoshopButton = function PhotoshopButton2(_ref) {
  var onClick = _ref.onClick, label = _ref.label, children = _ref.children, active3 = _ref.active;
  var styles2 = _default$4({
    "default": {
      button: {
        backgroundImage: "linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)",
        border: "1px solid #878787",
        borderRadius: "2px",
        height: "20px",
        boxShadow: "0 1px 0 0 #EAEAEA",
        fontSize: "14px",
        color: "#000",
        lineHeight: "20px",
        textAlign: "center",
        marginBottom: "10px",
        cursor: "pointer"
      }
    },
    "active": {
      button: {
        boxShadow: "0 0 0 1px #878787"
      }
    }
  }, { active: active3 });
  return React$5.createElement(
    "div",
    { style: styles2.button, onClick },
    label || children
  );
};
var PhotoshopPreviews = function PhotoshopPreviews2(_ref) {
  var rgb = _ref.rgb, currentColor = _ref.currentColor;
  var styles2 = _default$4({
    "default": {
      swatches: {
        border: "1px solid #B3B3B3",
        borderBottom: "1px solid #F0F0F0",
        marginBottom: "2px",
        marginTop: "1px"
      },
      new: {
        height: "34px",
        background: "rgb(" + rgb.r + "," + rgb.g + ", " + rgb.b + ")",
        boxShadow: "inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000"
      },
      current: {
        height: "34px",
        background: currentColor,
        boxShadow: "inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000"
      },
      label: {
        fontSize: "14px",
        color: "#000",
        textAlign: "center"
      }
    }
  });
  return React$5.createElement(
    "div",
    null,
    React$5.createElement(
      "div",
      { style: styles2.label },
      "new"
    ),
    React$5.createElement(
      "div",
      { style: styles2.swatches },
      React$5.createElement("div", { style: styles2.new }),
      React$5.createElement("div", { style: styles2.current })
    ),
    React$5.createElement(
      "div",
      { style: styles2.label },
      "current"
    )
  );
};
var _createClass = /* @__PURE__ */ function() {
  function defineProperties(target, props) {
    for (var i2 = 0; i2 < props.length; i2++) {
      var descriptor = props[i2];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor)
        descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }
  return function(Constructor, protoProps, staticProps) {
    if (protoProps)
      defineProperties(Constructor.prototype, protoProps);
    if (staticProps)
      defineProperties(Constructor, staticProps);
    return Constructor;
  };
}();
function _classCallCheck(instance2, Constructor) {
  if (!(instance2 instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn(self2, call2) {
  if (!self2) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call2 && (typeof call2 === "object" || typeof call2 === "function") ? call2 : self2;
}
function _inherits(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
  if (superClass)
    Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var Photoshop = function(_React$Component) {
  _inherits(Photoshop2, _React$Component);
  function Photoshop2(props) {
    _classCallCheck(this, Photoshop2);
    var _this = _possibleConstructorReturn(this, (Photoshop2.__proto__ || Object.getPrototypeOf(Photoshop2)).call(this));
    _this.state = {
      currentColor: props.hex
    };
    return _this;
  }
  _createClass(Photoshop2, [{
    key: "render",
    value: function render3() {
      var _props = this.props, _props$styles = _props.styles, passedStyles = _props$styles === void 0 ? {} : _props$styles, _props$className = _props.className, className = _props$className === void 0 ? "" : _props$className;
      var styles2 = _default$4(merge$3({
        "default": {
          picker: {
            background: "#DCDCDC",
            borderRadius: "4px",
            boxShadow: "0 0 0 1px rgba(0,0,0,.25), 0 8px 16px rgba(0,0,0,.15)",
            boxSizing: "initial",
            width: "513px"
          },
          head: {
            backgroundImage: "linear-gradient(-180deg, #F0F0F0 0%, #D4D4D4 100%)",
            borderBottom: "1px solid #B1B1B1",
            boxShadow: "inset 0 1px 0 0 rgba(255,255,255,.2), inset 0 -1px 0 0 rgba(0,0,0,.02)",
            height: "23px",
            lineHeight: "24px",
            borderRadius: "4px 4px 0 0",
            fontSize: "13px",
            color: "#4D4D4D",
            textAlign: "center"
          },
          body: {
            padding: "15px 15px 0",
            display: "flex"
          },
          saturation: {
            width: "256px",
            height: "256px",
            position: "relative",
            border: "2px solid #B3B3B3",
            borderBottom: "2px solid #F0F0F0",
            overflow: "hidden"
          },
          hue: {
            position: "relative",
            height: "256px",
            width: "19px",
            marginLeft: "10px",
            border: "2px solid #B3B3B3",
            borderBottom: "2px solid #F0F0F0"
          },
          controls: {
            width: "180px",
            marginLeft: "10px"
          },
          top: {
            display: "flex"
          },
          previews: {
            width: "60px"
          },
          actions: {
            flex: "1",
            marginLeft: "20px"
          }
        }
      }, passedStyles));
      return React$5.createElement(
        "div",
        { style: styles2.picker, className: "photoshop-picker " + className },
        React$5.createElement(
          "div",
          { style: styles2.head },
          this.props.header
        ),
        React$5.createElement(
          "div",
          { style: styles2.body, className: "flexbox-fix" },
          React$5.createElement(
            "div",
            { style: styles2.saturation },
            React$5.createElement(Saturation, {
              hsl: this.props.hsl,
              hsv: this.props.hsv,
              pointer: PhotoshopPointerCircle$1,
              onChange: this.props.onChange
            })
          ),
          React$5.createElement(
            "div",
            { style: styles2.hue },
            React$5.createElement(Hue, {
              direction: "vertical",
              hsl: this.props.hsl,
              pointer: PhotoshopPointerCircle2,
              onChange: this.props.onChange
            })
          ),
          React$5.createElement(
            "div",
            { style: styles2.controls },
            React$5.createElement(
              "div",
              { style: styles2.top, className: "flexbox-fix" },
              React$5.createElement(
                "div",
                { style: styles2.previews },
                React$5.createElement(PhotoshopPreviews, {
                  rgb: this.props.rgb,
                  currentColor: this.state.currentColor
                })
              ),
              React$5.createElement(
                "div",
                { style: styles2.actions },
                React$5.createElement(PhotoshopButton, { label: "OK", onClick: this.props.onAccept, active: true }),
                React$5.createElement(PhotoshopButton, { label: "Cancel", onClick: this.props.onCancel }),
                React$5.createElement(PhotoshopPicker, {
                  onChange: this.props.onChange,
                  rgb: this.props.rgb,
                  hsv: this.props.hsv,
                  hex: this.props.hex
                })
              )
            )
          )
        )
      );
    }
  }]);
  return Photoshop2;
}(React$5.Component);
Photoshop.propTypes = {
  header: PropTypes$4.string,
  styles: PropTypes$4.object
};
Photoshop.defaultProps = {
  header: "Color Picker",
  styles: {}
};
ColorWrap(Photoshop);
var SketchFields = function SketchFields2(_ref) {
  var onChange = _ref.onChange, rgb = _ref.rgb, hsl = _ref.hsl, hex3 = _ref.hex, disableAlpha = _ref.disableAlpha;
  var styles2 = _default$4({
    "default": {
      fields: {
        display: "flex",
        paddingTop: "4px"
      },
      single: {
        flex: "1",
        paddingLeft: "6px"
      },
      alpha: {
        flex: "1",
        paddingLeft: "6px"
      },
      double: {
        flex: "2"
      },
      input: {
        width: "80%",
        padding: "4px 10% 3px",
        border: "none",
        boxShadow: "inset 0 0 0 1px #ccc",
        fontSize: "11px"
      },
      label: {
        display: "block",
        textAlign: "center",
        fontSize: "11px",
        color: "#222",
        paddingTop: "3px",
        paddingBottom: "4px",
        textTransform: "capitalize"
      }
    },
    "disableAlpha": {
      alpha: {
        display: "none"
      }
    }
  }, { disableAlpha });
  var handleChange = function handleChange2(data, e2) {
    if (data.hex) {
      isValidHex(data.hex) && onChange({
        hex: data.hex,
        source: "hex"
      }, e2);
    } else if (data.r || data.g || data.b) {
      onChange({
        r: data.r || rgb.r,
        g: data.g || rgb.g,
        b: data.b || rgb.b,
        a: rgb.a,
        source: "rgb"
      }, e2);
    } else if (data.a) {
      if (data.a < 0) {
        data.a = 0;
      } else if (data.a > 100) {
        data.a = 100;
      }
      data.a /= 100;
      onChange({
        h: hsl.h,
        s: hsl.s,
        l: hsl.l,
        a: data.a,
        source: "rgb"
      }, e2);
    }
  };
  return React$5.createElement(
    "div",
    { style: styles2.fields, className: "flexbox-fix" },
    React$5.createElement(
      "div",
      { style: styles2.double },
      React$5.createElement(EditableInput, {
        style: { input: styles2.input, label: styles2.label },
        label: "hex",
        value: hex3.replace("#", ""),
        onChange: handleChange
      })
    ),
    React$5.createElement(
      "div",
      { style: styles2.single },
      React$5.createElement(EditableInput, {
        style: { input: styles2.input, label: styles2.label },
        label: "r",
        value: rgb.r,
        onChange: handleChange,
        dragLabel: "true",
        dragMax: "255"
      })
    ),
    React$5.createElement(
      "div",
      { style: styles2.single },
      React$5.createElement(EditableInput, {
        style: { input: styles2.input, label: styles2.label },
        label: "g",
        value: rgb.g,
        onChange: handleChange,
        dragLabel: "true",
        dragMax: "255"
      })
    ),
    React$5.createElement(
      "div",
      { style: styles2.single },
      React$5.createElement(EditableInput, {
        style: { input: styles2.input, label: styles2.label },
        label: "b",
        value: rgb.b,
        onChange: handleChange,
        dragLabel: "true",
        dragMax: "255"
      })
    ),
    React$5.createElement(
      "div",
      { style: styles2.alpha },
      React$5.createElement(EditableInput, {
        style: { input: styles2.input, label: styles2.label },
        label: "a",
        value: Math.round(rgb.a * 100),
        onChange: handleChange,
        dragLabel: "true",
        dragMax: "100"
      })
    )
  );
};
var _extends$4 = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var SketchPresetColors = function SketchPresetColors2(_ref) {
  var colors2 = _ref.colors, _ref$onClick = _ref.onClick, onClick = _ref$onClick === void 0 ? function() {
  } : _ref$onClick, onSwatchHover = _ref.onSwatchHover;
  var styles2 = _default$4({
    "default": {
      colors: {
        margin: "0 -10px",
        padding: "10px 0 0 10px",
        borderTop: "1px solid #eee",
        display: "flex",
        flexWrap: "wrap",
        position: "relative"
      },
      swatchWrap: {
        width: "16px",
        height: "16px",
        margin: "0 10px 10px 0"
      },
      swatch: {
        borderRadius: "3px",
        boxShadow: "inset 0 0 0 1px rgba(0,0,0,.15)"
      }
    },
    "no-presets": {
      colors: {
        display: "none"
      }
    }
  }, {
    "no-presets": !colors2 || !colors2.length
  });
  var handleClick = function handleClick2(hex3, e2) {
    onClick({
      hex: hex3,
      source: "hex"
    }, e2);
  };
  return React$5.createElement(
    "div",
    { style: styles2.colors, className: "flexbox-fix" },
    colors2.map(function(colorObjOrString) {
      var c2 = typeof colorObjOrString === "string" ? { color: colorObjOrString } : colorObjOrString;
      var key = "" + c2.color + (c2.title || "");
      return React$5.createElement(
        "div",
        { key, style: styles2.swatchWrap },
        React$5.createElement(Swatch$1, _extends$4({}, c2, {
          style: styles2.swatch,
          onClick: handleClick,
          onHover: onSwatchHover,
          focusStyle: {
            boxShadow: "inset 0 0 0 1px rgba(0,0,0,.15), 0 0 4px " + c2.color
          }
        }))
      );
    })
  );
};
SketchPresetColors.propTypes = {
  colors: PropTypes$4.arrayOf(PropTypes$4.oneOfType([PropTypes$4.string, PropTypes$4.shape({
    color: PropTypes$4.string,
    title: PropTypes$4.string
  })])).isRequired
};
var _extends$3 = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var Sketch = function Sketch2(_ref) {
  var width = _ref.width, rgb = _ref.rgb, hex3 = _ref.hex, hsv = _ref.hsv, hsl = _ref.hsl, onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, disableAlpha = _ref.disableAlpha, presetColors = _ref.presetColors, renderers = _ref.renderers, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4(merge$3({
    "default": _extends$3({
      picker: {
        width,
        padding: "10px 10px 0",
        boxSizing: "initial",
        background: "#fff",
        borderRadius: "4px",
        boxShadow: "0 0 0 1px rgba(0,0,0,.15), 0 8px 16px rgba(0,0,0,.15)"
      },
      saturation: {
        width: "100%",
        paddingBottom: "75%",
        position: "relative",
        overflow: "hidden"
      },
      Saturation: {
        radius: "3px",
        shadow: "inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"
      },
      controls: {
        display: "flex"
      },
      sliders: {
        padding: "4px 0",
        flex: "1"
      },
      color: {
        width: "24px",
        height: "24px",
        position: "relative",
        marginTop: "4px",
        marginLeft: "4px",
        borderRadius: "3px"
      },
      activeColor: {
        absolute: "0px 0px 0px 0px",
        borderRadius: "2px",
        background: "rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + "," + rgb.a + ")",
        boxShadow: "inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"
      },
      hue: {
        position: "relative",
        height: "10px",
        overflow: "hidden"
      },
      Hue: {
        radius: "2px",
        shadow: "inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"
      },
      alpha: {
        position: "relative",
        height: "10px",
        marginTop: "4px",
        overflow: "hidden"
      },
      Alpha: {
        radius: "2px",
        shadow: "inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"
      }
    }, passedStyles),
    "disableAlpha": {
      color: {
        height: "10px"
      },
      hue: {
        height: "10px"
      },
      alpha: {
        display: "none"
      }
    }
  }, passedStyles), { disableAlpha });
  return React$5.createElement(
    "div",
    { style: styles2.picker, className: "sketch-picker " + className },
    React$5.createElement(
      "div",
      { style: styles2.saturation },
      React$5.createElement(Saturation, {
        style: styles2.Saturation,
        hsl,
        hsv,
        onChange
      })
    ),
    React$5.createElement(
      "div",
      { style: styles2.controls, className: "flexbox-fix" },
      React$5.createElement(
        "div",
        { style: styles2.sliders },
        React$5.createElement(
          "div",
          { style: styles2.hue },
          React$5.createElement(Hue, {
            style: styles2.Hue,
            hsl,
            onChange
          })
        ),
        React$5.createElement(
          "div",
          { style: styles2.alpha },
          React$5.createElement(Alpha, {
            style: styles2.Alpha,
            rgb,
            hsl,
            renderers,
            onChange
          })
        )
      ),
      React$5.createElement(
        "div",
        { style: styles2.color },
        React$5.createElement(Checkboard, null),
        React$5.createElement("div", { style: styles2.activeColor })
      )
    ),
    React$5.createElement(SketchFields, {
      rgb,
      hsl,
      hex: hex3,
      onChange,
      disableAlpha
    }),
    React$5.createElement(SketchPresetColors, {
      colors: presetColors,
      onClick: onChange,
      onSwatchHover
    })
  );
};
Sketch.propTypes = {
  disableAlpha: PropTypes$4.bool,
  width: PropTypes$4.oneOfType([PropTypes$4.string, PropTypes$4.number]),
  styles: PropTypes$4.object
};
Sketch.defaultProps = {
  disableAlpha: false,
  width: 200,
  styles: {},
  presetColors: ["#D0021B", "#F5A623", "#F8E71C", "#8B572A", "#7ED321", "#417505", "#BD10E0", "#9013FE", "#4A90E2", "#50E3C2", "#B8E986", "#000000", "#4A4A4A", "#9B9B9B", "#FFFFFF"]
};
const SketchPicker = ColorWrap(Sketch);
var SliderSwatch = function SliderSwatch2(_ref) {
  var hsl = _ref.hsl, offset2 = _ref.offset, _ref$onClick = _ref.onClick, onClick = _ref$onClick === void 0 ? function() {
  } : _ref$onClick, active3 = _ref.active, first = _ref.first, last = _ref.last;
  var styles2 = _default$4({
    "default": {
      swatch: {
        height: "12px",
        background: "hsl(" + hsl.h + ", 50%, " + offset2 * 100 + "%)",
        cursor: "pointer"
      }
    },
    "first": {
      swatch: {
        borderRadius: "2px 0 0 2px"
      }
    },
    "last": {
      swatch: {
        borderRadius: "0 2px 2px 0"
      }
    },
    "active": {
      swatch: {
        transform: "scaleY(1.8)",
        borderRadius: "3.6px/2px"
      }
    }
  }, { active: active3, first, last });
  var handleClick = function handleClick2(e2) {
    return onClick({
      h: hsl.h,
      s: 0.5,
      l: offset2,
      source: "hsl"
    }, e2);
  };
  return React$5.createElement("div", { style: styles2.swatch, onClick: handleClick });
};
var SliderSwatches = function SliderSwatches2(_ref) {
  var onClick = _ref.onClick, hsl = _ref.hsl;
  var styles2 = _default$4({
    "default": {
      swatches: {
        marginTop: "20px"
      },
      swatch: {
        boxSizing: "border-box",
        width: "20%",
        paddingRight: "1px",
        float: "left"
      },
      clear: {
        clear: "both"
      }
    }
  });
  var epsilon = 0.1;
  return React$5.createElement(
    "div",
    { style: styles2.swatches },
    React$5.createElement(
      "div",
      { style: styles2.swatch },
      React$5.createElement(SliderSwatch, {
        hsl,
        offset: ".80",
        active: Math.abs(hsl.l - 0.8) < epsilon && Math.abs(hsl.s - 0.5) < epsilon,
        onClick,
        first: true
      })
    ),
    React$5.createElement(
      "div",
      { style: styles2.swatch },
      React$5.createElement(SliderSwatch, {
        hsl,
        offset: ".65",
        active: Math.abs(hsl.l - 0.65) < epsilon && Math.abs(hsl.s - 0.5) < epsilon,
        onClick
      })
    ),
    React$5.createElement(
      "div",
      { style: styles2.swatch },
      React$5.createElement(SliderSwatch, {
        hsl,
        offset: ".50",
        active: Math.abs(hsl.l - 0.5) < epsilon && Math.abs(hsl.s - 0.5) < epsilon,
        onClick
      })
    ),
    React$5.createElement(
      "div",
      { style: styles2.swatch },
      React$5.createElement(SliderSwatch, {
        hsl,
        offset: ".35",
        active: Math.abs(hsl.l - 0.35) < epsilon && Math.abs(hsl.s - 0.5) < epsilon,
        onClick
      })
    ),
    React$5.createElement(
      "div",
      { style: styles2.swatch },
      React$5.createElement(SliderSwatch, {
        hsl,
        offset: ".20",
        active: Math.abs(hsl.l - 0.2) < epsilon && Math.abs(hsl.s - 0.5) < epsilon,
        onClick,
        last: true
      })
    ),
    React$5.createElement("div", { style: styles2.clear })
  );
};
var SliderPointer2 = function SliderPointer3() {
  var styles2 = _default$4({
    "default": {
      picker: {
        width: "14px",
        height: "14px",
        borderRadius: "6px",
        transform: "translate(-7px, -1px)",
        backgroundColor: "rgb(248, 248, 248)",
        boxShadow: "0 1px 4px 0 rgba(0, 0, 0, 0.37)"
      }
    }
  });
  return React$5.createElement("div", { style: styles2.picker });
};
var Slider = function Slider2(_ref) {
  var hsl = _ref.hsl, onChange = _ref.onChange, pointer = _ref.pointer, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4(merge$3({
    "default": {
      hue: {
        height: "12px",
        position: "relative"
      },
      Hue: {
        radius: "2px"
      }
    }
  }, passedStyles));
  return React$5.createElement(
    "div",
    { style: styles2.wrap || {}, className: "slider-picker " + className },
    React$5.createElement(
      "div",
      { style: styles2.hue },
      React$5.createElement(Hue, {
        style: styles2.Hue,
        hsl,
        pointer,
        onChange
      })
    ),
    React$5.createElement(
      "div",
      { style: styles2.swatches },
      React$5.createElement(SliderSwatches, { hsl, onClick: onChange })
    )
  );
};
Slider.propTypes = {
  styles: PropTypes$4.object
};
Slider.defaultProps = {
  pointer: SliderPointer2,
  styles: {}
};
ColorWrap(Slider);
var CheckIcon = {};
Object.defineProperty(CheckIcon, "__esModule", {
  value: true
});
var _extends$2 = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var _react = reactExports;
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) {
  return obj && obj.__esModule ? obj : { default: obj };
}
function _objectWithoutProperties$1(obj, keys2) {
  var target = {};
  for (var i2 in obj) {
    if (keys2.indexOf(i2) >= 0)
      continue;
    if (!Object.prototype.hasOwnProperty.call(obj, i2))
      continue;
    target[i2] = obj[i2];
  }
  return target;
}
var DEFAULT_SIZE = 24;
var _default$2 = CheckIcon.default = function(_ref) {
  var _ref$fill = _ref.fill, fill = _ref$fill === void 0 ? "currentColor" : _ref$fill, _ref$width = _ref.width, width = _ref$width === void 0 ? DEFAULT_SIZE : _ref$width, _ref$height = _ref.height, height = _ref$height === void 0 ? DEFAULT_SIZE : _ref$height, _ref$style = _ref.style, style2 = _ref$style === void 0 ? {} : _ref$style, props = _objectWithoutProperties$1(_ref, ["fill", "width", "height", "style"]);
  return _react2.default.createElement(
    "svg",
    _extends$2({
      viewBox: "0 0 " + DEFAULT_SIZE + " " + DEFAULT_SIZE,
      style: _extends$2({ fill, width, height }, style2)
    }, props),
    _react2.default.createElement("path", { d: "M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" })
  );
};
var SwatchesColor = function SwatchesColor2(_ref) {
  var color2 = _ref.color, _ref$onClick = _ref.onClick, onClick = _ref$onClick === void 0 ? function() {
  } : _ref$onClick, onSwatchHover = _ref.onSwatchHover, first = _ref.first, last = _ref.last, active3 = _ref.active;
  var styles2 = _default$4({
    "default": {
      color: {
        width: "40px",
        height: "24px",
        cursor: "pointer",
        background: color2,
        marginBottom: "1px"
      },
      check: {
        color: getContrastingColor(color2),
        marginLeft: "8px",
        display: "none"
      }
    },
    "first": {
      color: {
        overflow: "hidden",
        borderRadius: "2px 2px 0 0"
      }
    },
    "last": {
      color: {
        overflow: "hidden",
        borderRadius: "0 0 2px 2px"
      }
    },
    "active": {
      check: {
        display: "block"
      }
    },
    "color-#FFFFFF": {
      color: {
        boxShadow: "inset 0 0 0 1px #ddd"
      },
      check: {
        color: "#333"
      }
    },
    "transparent": {
      check: {
        color: "#333"
      }
    }
  }, {
    first,
    last,
    active: active3,
    "color-#FFFFFF": color2 === "#FFFFFF",
    "transparent": color2 === "transparent"
  });
  return React$5.createElement(
    Swatch$1,
    {
      color: color2,
      style: styles2.color,
      onClick,
      onHover: onSwatchHover,
      focusStyle: { boxShadow: "0 0 4px " + color2 }
    },
    React$5.createElement(
      "div",
      { style: styles2.check },
      React$5.createElement(_default$2, null)
    )
  );
};
var SwatchesGroup = function SwatchesGroup2(_ref) {
  var onClick = _ref.onClick, onSwatchHover = _ref.onSwatchHover, group = _ref.group, active3 = _ref.active;
  var styles2 = _default$4({
    "default": {
      group: {
        paddingBottom: "10px",
        width: "40px",
        float: "left",
        marginRight: "10px"
      }
    }
  });
  return React$5.createElement(
    "div",
    { style: styles2.group },
    map$3(group, function(color2, i2) {
      return React$5.createElement(SwatchesColor, {
        key: color2,
        color: color2,
        active: color2.toLowerCase() === active3,
        first: i2 === 0,
        last: i2 === group.length - 1,
        onClick,
        onSwatchHover
      });
    })
  );
};
var Swatches = function Swatches2(_ref) {
  var width = _ref.width, height = _ref.height, onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, colors2 = _ref.colors, hex3 = _ref.hex, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4(merge$3({
    "default": {
      picker: {
        width,
        height
      },
      overflow: {
        height,
        overflowY: "scroll"
      },
      body: {
        padding: "16px 0 6px 16px"
      },
      clear: {
        clear: "both"
      }
    }
  }, passedStyles));
  var handleChange = function handleChange2(data, e2) {
    return onChange({ hex: data, source: "hex" }, e2);
  };
  return React$5.createElement(
    "div",
    { style: styles2.picker, className: "swatches-picker " + className },
    React$5.createElement(
      Raised,
      null,
      React$5.createElement(
        "div",
        { style: styles2.overflow },
        React$5.createElement(
          "div",
          { style: styles2.body },
          map$3(colors2, function(group) {
            return React$5.createElement(SwatchesGroup, {
              key: group.toString(),
              group,
              active: hex3,
              onClick: handleChange,
              onSwatchHover
            });
          }),
          React$5.createElement("div", { style: styles2.clear })
        )
      )
    )
  );
};
Swatches.propTypes = {
  width: PropTypes$4.oneOfType([PropTypes$4.string, PropTypes$4.number]),
  height: PropTypes$4.oneOfType([PropTypes$4.string, PropTypes$4.number]),
  colors: PropTypes$4.arrayOf(PropTypes$4.arrayOf(PropTypes$4.string)),
  styles: PropTypes$4.object
  /* eslint-disable max-len */
};
Swatches.defaultProps = {
  width: 320,
  height: 240,
  colors: [[red["900"], red["700"], red["500"], red["300"], red["100"]], [pink["900"], pink["700"], pink["500"], pink["300"], pink["100"]], [purple["900"], purple["700"], purple["500"], purple["300"], purple["100"]], [deepPurple["900"], deepPurple["700"], deepPurple["500"], deepPurple["300"], deepPurple["100"]], [indigo["900"], indigo["700"], indigo["500"], indigo["300"], indigo["100"]], [blue["900"], blue["700"], blue["500"], blue["300"], blue["100"]], [lightBlue["900"], lightBlue["700"], lightBlue["500"], lightBlue["300"], lightBlue["100"]], [cyan["900"], cyan["700"], cyan["500"], cyan["300"], cyan["100"]], [teal["900"], teal["700"], teal["500"], teal["300"], teal["100"]], ["#194D33", green["700"], green["500"], green["300"], green["100"]], [lightGreen["900"], lightGreen["700"], lightGreen["500"], lightGreen["300"], lightGreen["100"]], [lime["900"], lime["700"], lime["500"], lime["300"], lime["100"]], [yellow["900"], yellow["700"], yellow["500"], yellow["300"], yellow["100"]], [amber["900"], amber["700"], amber["500"], amber["300"], amber["100"]], [orange["900"], orange["700"], orange["500"], orange["300"], orange["100"]], [deepOrange["900"], deepOrange["700"], deepOrange["500"], deepOrange["300"], deepOrange["100"]], [brown["900"], brown["700"], brown["500"], brown["300"], brown["100"]], [blueGrey["900"], blueGrey["700"], blueGrey["500"], blueGrey["300"], blueGrey["100"]], ["#000000", "#525252", "#969696", "#D9D9D9", "#FFFFFF"]],
  styles: {}
};
ColorWrap(Swatches);
var Twitter = function Twitter2(_ref) {
  var onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, hex3 = _ref.hex, colors2 = _ref.colors, width = _ref.width, triangle = _ref.triangle, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4(merge$3({
    "default": {
      card: {
        width,
        background: "#fff",
        border: "0 solid rgba(0,0,0,0.25)",
        boxShadow: "0 1px 4px rgba(0,0,0,0.25)",
        borderRadius: "4px",
        position: "relative"
      },
      body: {
        padding: "15px 9px 9px 15px"
      },
      label: {
        fontSize: "18px",
        color: "#fff"
      },
      triangle: {
        width: "0px",
        height: "0px",
        borderStyle: "solid",
        borderWidth: "0 9px 10px 9px",
        borderColor: "transparent transparent #fff transparent",
        position: "absolute"
      },
      triangleShadow: {
        width: "0px",
        height: "0px",
        borderStyle: "solid",
        borderWidth: "0 9px 10px 9px",
        borderColor: "transparent transparent rgba(0,0,0,.1) transparent",
        position: "absolute"
      },
      hash: {
        background: "#F0F0F0",
        height: "30px",
        width: "30px",
        borderRadius: "4px 0 0 4px",
        float: "left",
        color: "#98A1A4",
        display: "flex",
        alignItems: "center",
        justifyContent: "center"
      },
      input: {
        width: "100px",
        fontSize: "14px",
        color: "#666",
        border: "0px",
        outline: "none",
        height: "28px",
        boxShadow: "inset 0 0 0 1px #F0F0F0",
        boxSizing: "content-box",
        borderRadius: "0 4px 4px 0",
        float: "left",
        paddingLeft: "8px"
      },
      swatch: {
        width: "30px",
        height: "30px",
        float: "left",
        borderRadius: "4px",
        margin: "0 6px 6px 0"
      },
      clear: {
        clear: "both"
      }
    },
    "hide-triangle": {
      triangle: {
        display: "none"
      },
      triangleShadow: {
        display: "none"
      }
    },
    "top-left-triangle": {
      triangle: {
        top: "-10px",
        left: "12px"
      },
      triangleShadow: {
        top: "-11px",
        left: "12px"
      }
    },
    "top-right-triangle": {
      triangle: {
        top: "-10px",
        right: "12px"
      },
      triangleShadow: {
        top: "-11px",
        right: "12px"
      }
    }
  }, passedStyles), {
    "hide-triangle": triangle === "hide",
    "top-left-triangle": triangle === "top-left",
    "top-right-triangle": triangle === "top-right"
  });
  var handleChange = function handleChange2(hexcode, e2) {
    isValidHex(hexcode) && onChange({
      hex: hexcode,
      source: "hex"
    }, e2);
  };
  return React$5.createElement(
    "div",
    { style: styles2.card, className: "twitter-picker " + className },
    React$5.createElement("div", { style: styles2.triangleShadow }),
    React$5.createElement("div", { style: styles2.triangle }),
    React$5.createElement(
      "div",
      { style: styles2.body },
      map$3(colors2, function(c2, i2) {
        return React$5.createElement(Swatch$1, {
          key: i2,
          color: c2,
          hex: c2,
          style: styles2.swatch,
          onClick: handleChange,
          onHover: onSwatchHover,
          focusStyle: {
            boxShadow: "0 0 4px " + c2
          }
        });
      }),
      React$5.createElement(
        "div",
        { style: styles2.hash },
        "#"
      ),
      React$5.createElement(EditableInput, {
        label: null,
        style: { input: styles2.input },
        value: hex3.replace("#", ""),
        onChange: handleChange
      }),
      React$5.createElement("div", { style: styles2.clear })
    )
  );
};
Twitter.propTypes = {
  width: PropTypes$4.oneOfType([PropTypes$4.string, PropTypes$4.number]),
  triangle: PropTypes$4.oneOf(["hide", "top-left", "top-right"]),
  colors: PropTypes$4.arrayOf(PropTypes$4.string),
  styles: PropTypes$4.object
};
Twitter.defaultProps = {
  width: 276,
  colors: ["#FF6900", "#FCB900", "#7BDCB5", "#00D084", "#8ED1FC", "#0693E3", "#ABB8C3", "#EB144C", "#F78DA7", "#9900EF"],
  triangle: "top-left",
  styles: {}
};
ColorWrap(Twitter);
var GooglePointerCircle = function GooglePointerCircle2(props) {
  var styles2 = _default$4({
    "default": {
      picker: {
        width: "20px",
        height: "20px",
        borderRadius: "22px",
        border: "2px #fff solid",
        transform: "translate(-12px, -13px)",
        background: "hsl(" + Math.round(props.hsl.h) + ", " + Math.round(props.hsl.s * 100) + "%, " + Math.round(props.hsl.l * 100) + "%)"
      }
    }
  });
  return React$5.createElement("div", { style: styles2.picker });
};
GooglePointerCircle.propTypes = {
  hsl: PropTypes$4.shape({
    h: PropTypes$4.number,
    s: PropTypes$4.number,
    l: PropTypes$4.number,
    a: PropTypes$4.number
  })
};
GooglePointerCircle.defaultProps = {
  hsl: { a: 1, h: 249.94, l: 0.2, s: 0.5 }
};
var GooglePointer = function GooglePointer2(props) {
  var styles2 = _default$4({
    "default": {
      picker: {
        width: "20px",
        height: "20px",
        borderRadius: "22px",
        transform: "translate(-10px, -7px)",
        background: "hsl(" + Math.round(props.hsl.h) + ", 100%, 50%)",
        border: "2px white solid"
      }
    }
  });
  return React$5.createElement("div", { style: styles2.picker });
};
GooglePointer.propTypes = {
  hsl: PropTypes$4.shape({
    h: PropTypes$4.number,
    s: PropTypes$4.number,
    l: PropTypes$4.number,
    a: PropTypes$4.number
  })
};
GooglePointer.defaultProps = {
  hsl: { a: 1, h: 249.94, l: 0.2, s: 0.5 }
};
var GoogleFields = function GoogleFields2(_ref) {
  var onChange = _ref.onChange, rgb = _ref.rgb, hsl = _ref.hsl, hex3 = _ref.hex, hsv = _ref.hsv;
  var handleChange = function handleChange2(data, e2) {
    if (data.hex) {
      isValidHex(data.hex) && onChange({
        hex: data.hex,
        source: "hex"
      }, e2);
    } else if (data.rgb) {
      var values = data.rgb.split(",");
      isvalidColorString(data.rgb, "rgb") && onChange({
        r: values[0],
        g: values[1],
        b: values[2],
        a: 1,
        source: "rgb"
      }, e2);
    } else if (data.hsv) {
      var _values = data.hsv.split(",");
      if (isvalidColorString(data.hsv, "hsv")) {
        _values[2] = _values[2].replace("%", "");
        _values[1] = _values[1].replace("%", "");
        _values[0] = _values[0].replace("°", "");
        if (_values[1] == 1) {
          _values[1] = 0.01;
        } else if (_values[2] == 1) {
          _values[2] = 0.01;
        }
        onChange({
          h: Number(_values[0]),
          s: Number(_values[1]),
          v: Number(_values[2]),
          source: "hsv"
        }, e2);
      }
    } else if (data.hsl) {
      var _values2 = data.hsl.split(",");
      if (isvalidColorString(data.hsl, "hsl")) {
        _values2[2] = _values2[2].replace("%", "");
        _values2[1] = _values2[1].replace("%", "");
        _values2[0] = _values2[0].replace("°", "");
        if (hsvValue[1] == 1) {
          hsvValue[1] = 0.01;
        } else if (hsvValue[2] == 1) {
          hsvValue[2] = 0.01;
        }
        onChange({
          h: Number(_values2[0]),
          s: Number(_values2[1]),
          v: Number(_values2[2]),
          source: "hsl"
        }, e2);
      }
    }
  };
  var styles2 = _default$4({
    "default": {
      wrap: {
        display: "flex",
        height: "100px",
        marginTop: "4px"
      },
      fields: {
        width: "100%"
      },
      column: {
        paddingTop: "10px",
        display: "flex",
        justifyContent: "space-between"
      },
      double: {
        padding: "0px 4.4px",
        boxSizing: "border-box"
      },
      input: {
        width: "100%",
        height: "38px",
        boxSizing: "border-box",
        padding: "4px 10% 3px",
        textAlign: "center",
        border: "1px solid #dadce0",
        fontSize: "11px",
        textTransform: "lowercase",
        borderRadius: "5px",
        outline: "none",
        fontFamily: "Roboto,Arial,sans-serif"
      },
      input2: {
        height: "38px",
        width: "100%",
        border: "1px solid #dadce0",
        boxSizing: "border-box",
        fontSize: "11px",
        textTransform: "lowercase",
        borderRadius: "5px",
        outline: "none",
        paddingLeft: "10px",
        fontFamily: "Roboto,Arial,sans-serif"
      },
      label: {
        textAlign: "center",
        fontSize: "12px",
        background: "#fff",
        position: "absolute",
        textTransform: "uppercase",
        color: "#3c4043",
        width: "35px",
        top: "-6px",
        left: "0",
        right: "0",
        marginLeft: "auto",
        marginRight: "auto",
        fontFamily: "Roboto,Arial,sans-serif"
      },
      label2: {
        left: "10px",
        textAlign: "center",
        fontSize: "12px",
        background: "#fff",
        position: "absolute",
        textTransform: "uppercase",
        color: "#3c4043",
        width: "32px",
        top: "-6px",
        fontFamily: "Roboto,Arial,sans-serif"
      },
      single: {
        flexGrow: "1",
        margin: "0px 4.4px"
      }
    }
  });
  var rgbValue = rgb.r + ", " + rgb.g + ", " + rgb.b;
  var hslValue = Math.round(hsl.h) + "°, " + Math.round(hsl.s * 100) + "%, " + Math.round(hsl.l * 100) + "%";
  var hsvValue = Math.round(hsv.h) + "°, " + Math.round(hsv.s * 100) + "%, " + Math.round(hsv.v * 100) + "%";
  return React$5.createElement(
    "div",
    { style: styles2.wrap, className: "flexbox-fix" },
    React$5.createElement(
      "div",
      { style: styles2.fields },
      React$5.createElement(
        "div",
        { style: styles2.double },
        React$5.createElement(EditableInput, {
          style: { input: styles2.input, label: styles2.label },
          label: "hex",
          value: hex3,
          onChange: handleChange
        })
      ),
      React$5.createElement(
        "div",
        { style: styles2.column },
        React$5.createElement(
          "div",
          { style: styles2.single },
          React$5.createElement(EditableInput, {
            style: { input: styles2.input2, label: styles2.label2 },
            label: "rgb",
            value: rgbValue,
            onChange: handleChange
          })
        ),
        React$5.createElement(
          "div",
          { style: styles2.single },
          React$5.createElement(EditableInput, {
            style: { input: styles2.input2, label: styles2.label2 },
            label: "hsv",
            value: hsvValue,
            onChange: handleChange
          })
        ),
        React$5.createElement(
          "div",
          { style: styles2.single },
          React$5.createElement(EditableInput, {
            style: { input: styles2.input2, label: styles2.label2 },
            label: "hsl",
            value: hslValue,
            onChange: handleChange
          })
        )
      )
    )
  );
};
var Google = function Google2(_ref) {
  var width = _ref.width, onChange = _ref.onChange, rgb = _ref.rgb, hsl = _ref.hsl, hsv = _ref.hsv, hex3 = _ref.hex, header = _ref.header, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4(merge$3({
    "default": {
      picker: {
        width,
        background: "#fff",
        border: "1px solid #dfe1e5",
        boxSizing: "initial",
        display: "flex",
        flexWrap: "wrap",
        borderRadius: "8px 8px 0px 0px"
      },
      head: {
        height: "57px",
        width: "100%",
        paddingTop: "16px",
        paddingBottom: "16px",
        paddingLeft: "16px",
        fontSize: "20px",
        boxSizing: "border-box",
        fontFamily: "Roboto-Regular,HelveticaNeue,Arial,sans-serif"
      },
      saturation: {
        width: "70%",
        padding: "0px",
        position: "relative",
        overflow: "hidden"
      },
      swatch: {
        width: "30%",
        height: "228px",
        padding: "0px",
        background: "rgba(" + rgb.r + ", " + rgb.g + ", " + rgb.b + ", 1)",
        position: "relative",
        overflow: "hidden"
      },
      body: {
        margin: "auto",
        width: "95%"
      },
      controls: {
        display: "flex",
        boxSizing: "border-box",
        height: "52px",
        paddingTop: "22px"
      },
      color: {
        width: "32px"
      },
      hue: {
        height: "8px",
        position: "relative",
        margin: "0px 16px 0px 16px",
        width: "100%"
      },
      Hue: {
        radius: "2px"
      }
    }
  }, passedStyles));
  return React$5.createElement(
    "div",
    { style: styles2.picker, className: "google-picker " + className },
    React$5.createElement(
      "div",
      { style: styles2.head },
      header
    ),
    React$5.createElement("div", { style: styles2.swatch }),
    React$5.createElement(
      "div",
      { style: styles2.saturation },
      React$5.createElement(Saturation, {
        hsl,
        hsv,
        pointer: GooglePointerCircle,
        onChange
      })
    ),
    React$5.createElement(
      "div",
      { style: styles2.body },
      React$5.createElement(
        "div",
        { style: styles2.controls, className: "flexbox-fix" },
        React$5.createElement(
          "div",
          { style: styles2.hue },
          React$5.createElement(Hue, {
            style: styles2.Hue,
            hsl,
            radius: "4px",
            pointer: GooglePointer,
            onChange
          })
        )
      ),
      React$5.createElement(GoogleFields, {
        rgb,
        hsl,
        hex: hex3,
        hsv,
        onChange
      })
    )
  );
};
Google.propTypes = {
  width: PropTypes$4.oneOfType([PropTypes$4.string, PropTypes$4.number]),
  styles: PropTypes$4.object,
  header: PropTypes$4.string
};
Google.defaultProps = {
  width: 652,
  styles: {},
  header: "Color picker"
};
ColorWrap(Google);
function buildColorValueString(color2) {
  const strColor = color2;
  if (strColor) {
    return strColor;
  }
  const rgbColor = color2;
  if (rgbColor) {
    return `rgba(${rgbColor.r},${rgbColor.g},${rgbColor.b},${rgbColor.a})`;
  }
  const hslColor = color2;
  if (hslColor) {
    return `hsla(${hslColor.h},${hslColor.s}%,${hslColor.l}%,${hslColor.a})`;
  }
  return "";
}
const ColorPicker$1 = ({ trigger, ...props }) => {
  const [panelVisible, setPanelVisible] = React$5.useState(false);
  const [color2, setColor] = reactExports.useState(props.defaultColor ?? props.color);
  reactExports.useEffect(() => {
    setColor(props.color);
  }, [props.color]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    PopoverComponent,
    {
      closeMode: ["mask", "esc"],
      trigger: trigger ?? /* @__PURE__ */ jsxRuntimeExports.jsx(
        "div",
        {
          className: "inline-block rounded cursor-pointer border border-gray-300 p-0.5 text-center",
          onClick: () => {
            setPanelVisible(true);
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: "p-2",
              style: {
                backgroundColor: color2 ? buildColorValueString(color2) : "var(--bakaui-color)"
              }
            }
          )
        }
      ),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        SketchPicker,
        {
          color: color2,
          onChange: (v2) => {
            var _a2, _b2, _c2;
            if (v2.hex) {
              setColor(v2.hex);
              (_a2 = props.onChange) == null ? void 0 : _a2.call(props, v2.hex);
            } else {
              if (v2.rgb) {
                setColor(v2.rgb);
                (_b2 = props.onChange) == null ? void 0 : _b2.call(props, v2.rgb);
              } else {
                if (v2.hsl) {
                  setColor(v2.hsl);
                  (_c2 = props.onChange) == null ? void 0 : _c2.call(props, v2.hsl);
                }
              }
            }
          }
        }
      )
    }
  );
};
const Tabs = reactExports.forwardRef(
  ({ children, ...props }, ref) => {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(tabs_default, { ref, ...props, children });
  }
);
const Tab = tab_item_base_default;
function ownKeys$b(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
      });
    }
    keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$c(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2] != null ? arguments[i2] : {};
    if (i2 % 2) {
      ownKeys$b(Object(source2), true).forEach(function(key) {
        _defineProperty$3(target, key, source2[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2));
    } else {
      ownKeys$b(Object(source2)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
      });
    }
  }
  return target;
}
var consoleLogger = {
  type: "logger",
  log: function log(args) {
    this.output("log", args);
  },
  warn: function warn(args) {
    this.output("warn", args);
  },
  error: function error(args) {
    this.output("error", args);
  },
  output: function output(type4, args) {
    if (console && console[type4])
      console[type4].apply(console, args);
  }
};
var Logger$1 = function() {
  function Logger2(concreteLogger) {
    var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
    _classCallCheck$a(this, Logger2);
    this.init(concreteLogger, options);
  }
  _createClass$8(Logger2, [{
    key: "init",
    value: function init2(concreteLogger) {
      var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
      this.prefix = options.prefix || "i18next:";
      this.logger = concreteLogger || consoleLogger;
      this.options = options;
      this.debug = options.debug;
    }
  }, {
    key: "setDebug",
    value: function setDebug(bool) {
      this.debug = bool;
    }
  }, {
    key: "log",
    value: function log3() {
      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
      return this.forward(args, "log", "", true);
    }
  }, {
    key: "warn",
    value: function warn3() {
      for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
        args[_key2] = arguments[_key2];
      }
      return this.forward(args, "warn", "", true);
    }
  }, {
    key: "error",
    value: function error2() {
      for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
        args[_key3] = arguments[_key3];
      }
      return this.forward(args, "error", "");
    }
  }, {
    key: "deprecate",
    value: function deprecate2() {
      for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
        args[_key4] = arguments[_key4];
      }
      return this.forward(args, "warn", "WARNING DEPRECATED: ", true);
    }
  }, {
    key: "forward",
    value: function forward(args, lvl, prefix, debugOnly) {
      if (debugOnly && !this.debug)
        return null;
      if (typeof args[0] === "string")
        args[0] = "".concat(prefix).concat(this.prefix, " ").concat(args[0]);
      return this.logger[lvl](args);
    }
  }, {
    key: "create",
    value: function create2(moduleName) {
      return new Logger2(this.logger, _objectSpread$c(_objectSpread$c({}, {
        prefix: "".concat(this.prefix, ":").concat(moduleName, ":")
      }), this.options));
    }
  }, {
    key: "clone",
    value: function clone3(options) {
      options = options || this.options;
      options.prefix = options.prefix || this.prefix;
      return new Logger2(this.logger, options);
    }
  }]);
  return Logger2;
}();
var baseLogger = new Logger$1();
var EventEmitter = function() {
  function EventEmitter2() {
    _classCallCheck$a(this, EventEmitter2);
    this.observers = {};
  }
  _createClass$8(EventEmitter2, [{
    key: "on",
    value: function on2(events2, listener) {
      var _this = this;
      events2.split(" ").forEach(function(event) {
        _this.observers[event] = _this.observers[event] || [];
        _this.observers[event].push(listener);
      });
      return this;
    }
  }, {
    key: "off",
    value: function off(event, listener) {
      if (!this.observers[event])
        return;
      if (!listener) {
        delete this.observers[event];
        return;
      }
      this.observers[event] = this.observers[event].filter(function(l2) {
        return l2 !== listener;
      });
    }
  }, {
    key: "emit",
    value: function emit(event) {
      for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
        args[_key - 1] = arguments[_key];
      }
      if (this.observers[event]) {
        var cloned = [].concat(this.observers[event]);
        cloned.forEach(function(observer) {
          observer.apply(void 0, args);
        });
      }
      if (this.observers["*"]) {
        var _cloned = [].concat(this.observers["*"]);
        _cloned.forEach(function(observer) {
          observer.apply(observer, [event].concat(args));
        });
      }
    }
  }]);
  return EventEmitter2;
}();
function defer() {
  var res;
  var rej;
  var promise = new Promise(function(resolve2, reject) {
    res = resolve2;
    rej = reject;
  });
  promise.resolve = res;
  promise.reject = rej;
  return promise;
}
function makeString(object4) {
  if (object4 == null)
    return "";
  return "" + object4;
}
function copy$1(a2, s2, t2) {
  a2.forEach(function(m2) {
    if (s2[m2])
      t2[m2] = s2[m2];
  });
}
function getLastOfPath(object4, path, Empty2) {
  function cleanKey(key2) {
    return key2 && key2.indexOf("###") > -1 ? key2.replace(/###/g, ".") : key2;
  }
  function canNotTraverseDeeper() {
    return !object4 || typeof object4 === "string";
  }
  var stack = typeof path !== "string" ? [].concat(path) : path.split(".");
  while (stack.length > 1) {
    if (canNotTraverseDeeper())
      return {};
    var key = cleanKey(stack.shift());
    if (!object4[key] && Empty2)
      object4[key] = new Empty2();
    if (Object.prototype.hasOwnProperty.call(object4, key)) {
      object4 = object4[key];
    } else {
      object4 = {};
    }
  }
  if (canNotTraverseDeeper())
    return {};
  return {
    obj: object4,
    k: cleanKey(stack.shift())
  };
}
function setPath(object4, path, newValue) {
  var _getLastOfPath = getLastOfPath(object4, path, Object), obj = _getLastOfPath.obj, k2 = _getLastOfPath.k;
  obj[k2] = newValue;
}
function pushPath(object4, path, newValue, concat) {
  var _getLastOfPath2 = getLastOfPath(object4, path, Object), obj = _getLastOfPath2.obj, k2 = _getLastOfPath2.k;
  obj[k2] = obj[k2] || [];
  obj[k2].push(newValue);
}
function getPath(object4, path) {
  var _getLastOfPath3 = getLastOfPath(object4, path), obj = _getLastOfPath3.obj, k2 = _getLastOfPath3.k;
  if (!obj)
    return void 0;
  return obj[k2];
}
function getPathWithDefaults(data, defaultData2, key) {
  var value2 = getPath(data, key);
  if (value2 !== void 0) {
    return value2;
  }
  return getPath(defaultData2, key);
}
function deepExtend(target, source2, overwrite) {
  for (var prop in source2) {
    if (prop !== "__proto__" && prop !== "constructor") {
      if (prop in target) {
        if (typeof target[prop] === "string" || target[prop] instanceof String || typeof source2[prop] === "string" || source2[prop] instanceof String) {
          if (overwrite)
            target[prop] = source2[prop];
        } else {
          deepExtend(target[prop], source2[prop], overwrite);
        }
      } else {
        target[prop] = source2[prop];
      }
    }
  }
  return target;
}
function regexEscape$1(str) {
  return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}
var _entityMap = {
  "&": "&amp;",
  "<": "&lt;",
  ">": "&gt;",
  '"': "&quot;",
  "'": "&#39;",
  "/": "&#x2F;"
};
function escape(data) {
  if (typeof data === "string") {
    return data.replace(/[&<>"'\/]/g, function(s2) {
      return _entityMap[s2];
    });
  }
  return data;
}
var isIE10 = typeof window !== "undefined" && window.navigator && typeof window.navigator.userAgentData === "undefined" && window.navigator.userAgent && window.navigator.userAgent.indexOf("MSIE") > -1;
var chars = [" ", ",", "?", "!", ";"];
function looksLikeObjectPath(key, nsSeparator, keySeparator) {
  nsSeparator = nsSeparator || "";
  keySeparator = keySeparator || "";
  var possibleChars = chars.filter(function(c2) {
    return nsSeparator.indexOf(c2) < 0 && keySeparator.indexOf(c2) < 0;
  });
  if (possibleChars.length === 0)
    return true;
  var r2 = new RegExp("(".concat(possibleChars.map(function(c2) {
    return c2 === "?" ? "\\?" : c2;
  }).join("|"), ")"));
  var matched = !r2.test(key);
  if (!matched) {
    var ki2 = key.indexOf(keySeparator);
    if (ki2 > 0 && !r2.test(key.substring(0, ki2))) {
      matched = true;
    }
  }
  return matched;
}
function ownKeys$1$1(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
      });
    }
    keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$1$1(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2] != null ? arguments[i2] : {};
    if (i2 % 2) {
      ownKeys$1$1(Object(source2), true).forEach(function(key) {
        _defineProperty$3(target, key, source2[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2));
    } else {
      ownKeys$1$1(Object(source2)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
      });
    }
  }
  return target;
}
function _createSuper(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct$f();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn$a(this, result);
  };
}
function _isNativeReflectConstruct$f() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e2) {
    return false;
  }
}
function deepFind(obj, path) {
  var keySeparator = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
  if (!obj)
    return void 0;
  if (obj[path])
    return obj[path];
  var paths = path.split(keySeparator);
  var current = obj;
  for (var i2 = 0; i2 < paths.length; ++i2) {
    if (!current)
      return void 0;
    if (typeof current[paths[i2]] === "string" && i2 + 1 < paths.length) {
      return void 0;
    }
    if (current[paths[i2]] === void 0) {
      var j2 = 2;
      var p2 = paths.slice(i2, i2 + j2).join(keySeparator);
      var mix2 = current[p2];
      while (mix2 === void 0 && paths.length > i2 + j2) {
        j2++;
        p2 = paths.slice(i2, i2 + j2).join(keySeparator);
        mix2 = current[p2];
      }
      if (mix2 === void 0)
        return void 0;
      if (mix2 === null)
        return null;
      if (path.endsWith(p2)) {
        if (typeof mix2 === "string")
          return mix2;
        if (p2 && typeof mix2[p2] === "string")
          return mix2[p2];
      }
      var joinedPath = paths.slice(i2 + j2).join(keySeparator);
      if (joinedPath)
        return deepFind(mix2, joinedPath, keySeparator);
      return void 0;
    }
    current = current[paths[i2]];
  }
  return current;
}
var ResourceStore = function(_EventEmitter) {
  _inherits$a(ResourceStore2, _EventEmitter);
  var _super = _createSuper(ResourceStore2);
  function ResourceStore2(data) {
    var _this;
    var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
      ns: ["translation"],
      defaultNS: "translation"
    };
    _classCallCheck$a(this, ResourceStore2);
    _this = _super.call(this);
    if (isIE10) {
      EventEmitter.call(_assertThisInitialized(_this));
    }
    _this.data = data || {};
    _this.options = options;
    if (_this.options.keySeparator === void 0) {
      _this.options.keySeparator = ".";
    }
    if (_this.options.ignoreJSONStructure === void 0) {
      _this.options.ignoreJSONStructure = true;
    }
    return _this;
  }
  _createClass$8(ResourceStore2, [{
    key: "addNamespaces",
    value: function addNamespaces(ns) {
      if (this.options.ns.indexOf(ns) < 0) {
        this.options.ns.push(ns);
      }
    }
  }, {
    key: "removeNamespaces",
    value: function removeNamespaces(ns) {
      var index2 = this.options.ns.indexOf(ns);
      if (index2 > -1) {
        this.options.ns.splice(index2, 1);
      }
    }
  }, {
    key: "getResource",
    value: function getResource(lng, ns, key) {
      var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
      var keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
      var ignoreJSONStructure = options.ignoreJSONStructure !== void 0 ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
      var path = [lng, ns];
      if (key && typeof key !== "string")
        path = path.concat(key);
      if (key && typeof key === "string")
        path = path.concat(keySeparator ? key.split(keySeparator) : key);
      if (lng.indexOf(".") > -1) {
        path = lng.split(".");
      }
      var result = getPath(this.data, path);
      if (result || !ignoreJSONStructure || typeof key !== "string")
        return result;
      return deepFind(this.data && this.data[lng] && this.data[lng][ns], key, keySeparator);
    }
  }, {
    key: "addResource",
    value: function addResource(lng, ns, key, value2) {
      var options = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
        silent: false
      };
      var keySeparator = this.options.keySeparator;
      if (keySeparator === void 0)
        keySeparator = ".";
      var path = [lng, ns];
      if (key)
        path = path.concat(keySeparator ? key.split(keySeparator) : key);
      if (lng.indexOf(".") > -1) {
        path = lng.split(".");
        value2 = ns;
        ns = path[1];
      }
      this.addNamespaces(ns);
      setPath(this.data, path, value2);
      if (!options.silent)
        this.emit("added", lng, ns, key, value2);
    }
  }, {
    key: "addResources",
    value: function addResources(lng, ns, resources) {
      var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
        silent: false
      };
      for (var m2 in resources) {
        if (typeof resources[m2] === "string" || Object.prototype.toString.apply(resources[m2]) === "[object Array]")
          this.addResource(lng, ns, m2, resources[m2], {
            silent: true
          });
      }
      if (!options.silent)
        this.emit("added", lng, ns, resources);
    }
  }, {
    key: "addResourceBundle",
    value: function addResourceBundle(lng, ns, resources, deep, overwrite) {
      var options = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {
        silent: false
      };
      var path = [lng, ns];
      if (lng.indexOf(".") > -1) {
        path = lng.split(".");
        deep = resources;
        resources = ns;
        ns = path[1];
      }
      this.addNamespaces(ns);
      var pack = getPath(this.data, path) || {};
      if (deep) {
        deepExtend(pack, resources, overwrite);
      } else {
        pack = _objectSpread$1$1(_objectSpread$1$1({}, pack), resources);
      }
      setPath(this.data, path, pack);
      if (!options.silent)
        this.emit("added", lng, ns, resources);
    }
  }, {
    key: "removeResourceBundle",
    value: function removeResourceBundle(lng, ns) {
      if (this.hasResourceBundle(lng, ns)) {
        delete this.data[lng][ns];
      }
      this.removeNamespaces(ns);
      this.emit("removed", lng, ns);
    }
  }, {
    key: "hasResourceBundle",
    value: function hasResourceBundle(lng, ns) {
      return this.getResource(lng, ns) !== void 0;
    }
  }, {
    key: "getResourceBundle",
    value: function getResourceBundle(lng, ns) {
      if (!ns)
        ns = this.options.defaultNS;
      if (this.options.compatibilityAPI === "v1")
        return _objectSpread$1$1(_objectSpread$1$1({}, {}), this.getResource(lng, ns));
      return this.getResource(lng, ns);
    }
  }, {
    key: "getDataByLanguage",
    value: function getDataByLanguage(lng) {
      return this.data[lng];
    }
  }, {
    key: "hasLanguageSomeTranslations",
    value: function hasLanguageSomeTranslations(lng) {
      var data = this.getDataByLanguage(lng);
      var n2 = data && Object.keys(data) || [];
      return !!n2.find(function(v2) {
        return data[v2] && Object.keys(data[v2]).length > 0;
      });
    }
  }, {
    key: "toJSON",
    value: function toJSON3() {
      return this.data;
    }
  }]);
  return ResourceStore2;
}(EventEmitter);
var postProcessor = {
  processors: {},
  addPostProcessor: function addPostProcessor(module2) {
    this.processors[module2.name] = module2;
  },
  handle: function handle(processors, value2, key, options, translator) {
    var _this = this;
    processors.forEach(function(processor) {
      if (_this.processors[processor])
        value2 = _this.processors[processor].process(value2, key, options, translator);
    });
    return value2;
  }
};
function ownKeys$2$1(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
      });
    }
    keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$2$1(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2] != null ? arguments[i2] : {};
    if (i2 % 2) {
      ownKeys$2$1(Object(source2), true).forEach(function(key) {
        _defineProperty$3(target, key, source2[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2));
    } else {
      ownKeys$2$1(Object(source2)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
      });
    }
  }
  return target;
}
function _createSuper$1(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct$1$1();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn$a(this, result);
  };
}
function _isNativeReflectConstruct$1$1() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e2) {
    return false;
  }
}
var checkedLoadedFor = {};
var Translator = function(_EventEmitter) {
  _inherits$a(Translator2, _EventEmitter);
  var _super = _createSuper$1(Translator2);
  function Translator2(services) {
    var _this;
    var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
    _classCallCheck$a(this, Translator2);
    _this = _super.call(this);
    if (isIE10) {
      EventEmitter.call(_assertThisInitialized(_this));
    }
    copy$1(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], services, _assertThisInitialized(_this));
    _this.options = options;
    if (_this.options.keySeparator === void 0) {
      _this.options.keySeparator = ".";
    }
    _this.logger = baseLogger.create("translator");
    return _this;
  }
  _createClass$8(Translator2, [{
    key: "changeLanguage",
    value: function changeLanguage(lng) {
      if (lng)
        this.language = lng;
    }
  }, {
    key: "exists",
    value: function exists(key) {
      var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
        interpolation: {}
      };
      if (key === void 0 || key === null) {
        return false;
      }
      var resolved = this.resolve(key, options);
      return resolved && resolved.res !== void 0;
    }
  }, {
    key: "extractFromKey",
    value: function extractFromKey(key, options) {
      var nsSeparator = options.nsSeparator !== void 0 ? options.nsSeparator : this.options.nsSeparator;
      if (nsSeparator === void 0)
        nsSeparator = ":";
      var keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
      var namespaces = options.ns || this.options.defaultNS || [];
      var wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
      var seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !options.keySeparator && !this.options.userDefinedNsSeparator && !options.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
      if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
        var m2 = key.match(this.interpolator.nestingRegexp);
        if (m2 && m2.length > 0) {
          return {
            key,
            namespaces
          };
        }
        var parts = key.split(nsSeparator);
        if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1)
          namespaces = parts.shift();
        key = parts.join(keySeparator);
      }
      if (typeof namespaces === "string")
        namespaces = [namespaces];
      return {
        key,
        namespaces
      };
    }
  }, {
    key: "translate",
    value: function translate(keys2, options, lastKey) {
      var _this2 = this;
      if (_typeof$1(options) !== "object" && this.options.overloadTranslationOptionHandler) {
        options = this.options.overloadTranslationOptionHandler(arguments);
      }
      if (!options)
        options = {};
      if (keys2 === void 0 || keys2 === null)
        return "";
      if (!Array.isArray(keys2))
        keys2 = [String(keys2)];
      var returnDetails = options.returnDetails !== void 0 ? options.returnDetails : this.options.returnDetails;
      var keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
      var _this$extractFromKey = this.extractFromKey(keys2[keys2.length - 1], options), key = _this$extractFromKey.key, namespaces = _this$extractFromKey.namespaces;
      var namespace = namespaces[namespaces.length - 1];
      var lng = options.lng || this.language;
      var appendNamespaceToCIMode = options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
      if (lng && lng.toLowerCase() === "cimode") {
        if (appendNamespaceToCIMode) {
          var nsSeparator = options.nsSeparator || this.options.nsSeparator;
          if (returnDetails) {
            resolved.res = "".concat(namespace).concat(nsSeparator).concat(key);
            return resolved;
          }
          return "".concat(namespace).concat(nsSeparator).concat(key);
        }
        if (returnDetails) {
          resolved.res = key;
          return resolved;
        }
        return key;
      }
      var resolved = this.resolve(keys2, options);
      var res = resolved && resolved.res;
      var resUsedKey = resolved && resolved.usedKey || key;
      var resExactUsedKey = resolved && resolved.exactUsedKey || key;
      var resType = Object.prototype.toString.apply(res);
      var noObject = ["[object Number]", "[object Function]", "[object RegExp]"];
      var joinArrays = options.joinArrays !== void 0 ? options.joinArrays : this.options.joinArrays;
      var handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
      var handleAsObject = typeof res !== "string" && typeof res !== "boolean" && typeof res !== "number";
      if (handleAsObjectInI18nFormat && res && handleAsObject && noObject.indexOf(resType) < 0 && !(typeof joinArrays === "string" && resType === "[object Array]")) {
        if (!options.returnObjects && !this.options.returnObjects) {
          if (!this.options.returnedObjectHandler) {
            this.logger.warn("accessing an object - but returnObjects options is not enabled!");
          }
          var r2 = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, _objectSpread$2$1(_objectSpread$2$1({}, options), {}, {
            ns: namespaces
          })) : "key '".concat(key, " (").concat(this.language, ")' returned an object instead of string.");
          if (returnDetails) {
            resolved.res = r2;
            return resolved;
          }
          return r2;
        }
        if (keySeparator) {
          var resTypeIsArray = resType === "[object Array]";
          var copy2 = resTypeIsArray ? [] : {};
          var newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
          for (var m2 in res) {
            if (Object.prototype.hasOwnProperty.call(res, m2)) {
              var deepKey = "".concat(newKeyToUse).concat(keySeparator).concat(m2);
              copy2[m2] = this.translate(deepKey, _objectSpread$2$1(_objectSpread$2$1({}, options), {
                joinArrays: false,
                ns: namespaces
              }));
              if (copy2[m2] === deepKey)
                copy2[m2] = res[m2];
            }
          }
          res = copy2;
        }
      } else if (handleAsObjectInI18nFormat && typeof joinArrays === "string" && resType === "[object Array]") {
        res = res.join(joinArrays);
        if (res)
          res = this.extendTranslation(res, keys2, options, lastKey);
      } else {
        var usedDefault = false;
        var usedKey = false;
        var needsPluralHandling = options.count !== void 0 && typeof options.count !== "string";
        var hasDefaultValue = Translator2.hasDefaultValue(options);
        var defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, options) : "";
        var defaultValue2 = options["defaultValue".concat(defaultValueSuffix)] || options.defaultValue;
        if (!this.isValidLookup(res) && hasDefaultValue) {
          usedDefault = true;
          res = defaultValue2;
        }
        if (!this.isValidLookup(res)) {
          usedKey = true;
          res = key;
        }
        var missingKeyNoValueFallbackToKey = options.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
        var resForMissing = missingKeyNoValueFallbackToKey && usedKey ? void 0 : res;
        var updateMissing = hasDefaultValue && defaultValue2 !== res && this.options.updateMissing;
        if (usedKey || usedDefault || updateMissing) {
          this.logger.log(updateMissing ? "updateKey" : "missingKey", lng, namespace, key, updateMissing ? defaultValue2 : res);
          if (keySeparator) {
            var fk2 = this.resolve(key, _objectSpread$2$1(_objectSpread$2$1({}, options), {}, {
              keySeparator: false
            }));
            if (fk2 && fk2.res)
              this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
          }
          var lngs = [];
          var fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language);
          if (this.options.saveMissingTo === "fallback" && fallbackLngs && fallbackLngs[0]) {
            for (var i2 = 0; i2 < fallbackLngs.length; i2++) {
              lngs.push(fallbackLngs[i2]);
            }
          } else if (this.options.saveMissingTo === "all") {
            lngs = this.languageUtils.toResolveHierarchy(options.lng || this.language);
          } else {
            lngs.push(options.lng || this.language);
          }
          var send = function send2(l2, k2, specificDefaultValue) {
            var defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
            if (_this2.options.missingKeyHandler) {
              _this2.options.missingKeyHandler(l2, namespace, k2, defaultForMissing, updateMissing, options);
            } else if (_this2.backendConnector && _this2.backendConnector.saveMissing) {
              _this2.backendConnector.saveMissing(l2, namespace, k2, defaultForMissing, updateMissing, options);
            }
            _this2.emit("missingKey", l2, namespace, k2, res);
          };
          if (this.options.saveMissing) {
            if (this.options.saveMissingPlurals && needsPluralHandling) {
              lngs.forEach(function(language) {
                _this2.pluralResolver.getSuffixes(language, options).forEach(function(suffix) {
                  send([language], key + suffix, options["defaultValue".concat(suffix)] || defaultValue2);
                });
              });
            } else {
              send(lngs, key, defaultValue2);
            }
          }
        }
        res = this.extendTranslation(res, keys2, options, resolved, lastKey);
        if (usedKey && res === key && this.options.appendNamespaceToMissingKey)
          res = "".concat(namespace, ":").concat(key);
        if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
          if (this.options.compatibilityAPI !== "v1") {
            res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? "".concat(namespace, ":").concat(key) : key, usedDefault ? res : void 0);
          } else {
            res = this.options.parseMissingKeyHandler(res);
          }
        }
      }
      if (returnDetails) {
        resolved.res = res;
        return resolved;
      }
      return res;
    }
  }, {
    key: "extendTranslation",
    value: function extendTranslation(res, key, options, resolved, lastKey) {
      var _this3 = this;
      if (this.i18nFormat && this.i18nFormat.parse) {
        res = this.i18nFormat.parse(res, _objectSpread$2$1(_objectSpread$2$1({}, this.options.interpolation.defaultVariables), options), resolved.usedLng, resolved.usedNS, resolved.usedKey, {
          resolved
        });
      } else if (!options.skipInterpolation) {
        if (options.interpolation)
          this.interpolator.init(_objectSpread$2$1(_objectSpread$2$1({}, options), {
            interpolation: _objectSpread$2$1(_objectSpread$2$1({}, this.options.interpolation), options.interpolation)
          }));
        var skipOnVariables = typeof res === "string" && (options && options.interpolation && options.interpolation.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
        var nestBef;
        if (skipOnVariables) {
          var nb2 = res.match(this.interpolator.nestingRegexp);
          nestBef = nb2 && nb2.length;
        }
        var data = options.replace && typeof options.replace !== "string" ? options.replace : options;
        if (this.options.interpolation.defaultVariables)
          data = _objectSpread$2$1(_objectSpread$2$1({}, this.options.interpolation.defaultVariables), data);
        res = this.interpolator.interpolate(res, data, options.lng || this.language, options);
        if (skipOnVariables) {
          var na2 = res.match(this.interpolator.nestingRegexp);
          var nestAft = na2 && na2.length;
          if (nestBef < nestAft)
            options.nest = false;
        }
        if (options.nest !== false)
          res = this.interpolator.nest(res, function() {
            for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
              args[_key] = arguments[_key];
            }
            if (lastKey && lastKey[0] === args[0] && !options.context) {
              _this3.logger.warn("It seems you are nesting recursively key: ".concat(args[0], " in key: ").concat(key[0]));
              return null;
            }
            return _this3.translate.apply(_this3, args.concat([key]));
          }, options);
        if (options.interpolation)
          this.interpolator.reset();
      }
      var postProcess = options.postProcess || this.options.postProcess;
      var postProcessorNames = typeof postProcess === "string" ? [postProcess] : postProcess;
      if (res !== void 0 && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) {
        res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? _objectSpread$2$1({
          i18nResolved: resolved
        }, options) : options, this);
      }
      return res;
    }
  }, {
    key: "resolve",
    value: function resolve2(keys2) {
      var _this4 = this;
      var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
      var found;
      var usedKey;
      var exactUsedKey;
      var usedLng;
      var usedNS;
      if (typeof keys2 === "string")
        keys2 = [keys2];
      keys2.forEach(function(k2) {
        if (_this4.isValidLookup(found))
          return;
        var extracted = _this4.extractFromKey(k2, options);
        var key = extracted.key;
        usedKey = key;
        var namespaces = extracted.namespaces;
        if (_this4.options.fallbackNS)
          namespaces = namespaces.concat(_this4.options.fallbackNS);
        var needsPluralHandling = options.count !== void 0 && typeof options.count !== "string";
        var needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0 && _this4.pluralResolver.shouldUseIntlApi();
        var needsContextHandling = options.context !== void 0 && (typeof options.context === "string" || typeof options.context === "number") && options.context !== "";
        var codes = options.lngs ? options.lngs : _this4.languageUtils.toResolveHierarchy(options.lng || _this4.language, options.fallbackLng);
        namespaces.forEach(function(ns) {
          if (_this4.isValidLookup(found))
            return;
          usedNS = ns;
          if (!checkedLoadedFor["".concat(codes[0], "-").concat(ns)] && _this4.utils && _this4.utils.hasLoadedNamespace && !_this4.utils.hasLoadedNamespace(usedNS)) {
            checkedLoadedFor["".concat(codes[0], "-").concat(ns)] = true;
            _this4.logger.warn('key "'.concat(usedKey, '" for languages "').concat(codes.join(", "), `" won't get resolved as namespace "`).concat(usedNS, '" was not yet loaded'), "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
          }
          codes.forEach(function(code2) {
            if (_this4.isValidLookup(found))
              return;
            usedLng = code2;
            var finalKeys = [key];
            if (_this4.i18nFormat && _this4.i18nFormat.addLookupKeys) {
              _this4.i18nFormat.addLookupKeys(finalKeys, key, code2, ns, options);
            } else {
              var pluralSuffix;
              if (needsPluralHandling)
                pluralSuffix = _this4.pluralResolver.getSuffix(code2, options.count, options);
              var zeroSuffix = "".concat(_this4.options.pluralSeparator, "zero");
              if (needsPluralHandling) {
                finalKeys.push(key + pluralSuffix);
                if (needsZeroSuffixLookup) {
                  finalKeys.push(key + zeroSuffix);
                }
              }
              if (needsContextHandling) {
                var contextKey = "".concat(key).concat(_this4.options.contextSeparator).concat(options.context);
                finalKeys.push(contextKey);
                if (needsPluralHandling) {
                  finalKeys.push(contextKey + pluralSuffix);
                  if (needsZeroSuffixLookup) {
                    finalKeys.push(contextKey + zeroSuffix);
                  }
                }
              }
            }
            var possibleKey;
            while (possibleKey = finalKeys.pop()) {
              if (!_this4.isValidLookup(found)) {
                exactUsedKey = possibleKey;
                found = _this4.getResource(code2, ns, possibleKey, options);
              }
            }
          });
        });
      });
      return {
        res: found,
        usedKey,
        exactUsedKey,
        usedLng,
        usedNS
      };
    }
  }, {
    key: "isValidLookup",
    value: function isValidLookup(res) {
      return res !== void 0 && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === "");
    }
  }, {
    key: "getResource",
    value: function getResource(code2, ns, key) {
      var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
      if (this.i18nFormat && this.i18nFormat.getResource)
        return this.i18nFormat.getResource(code2, ns, key, options);
      return this.resourceStore.getResource(code2, ns, key, options);
    }
  }], [{
    key: "hasDefaultValue",
    value: function hasDefaultValue(options) {
      var prefix = "defaultValue";
      for (var option in options) {
        if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && void 0 !== options[option]) {
          return true;
        }
      }
      return false;
    }
  }]);
  return Translator2;
}(EventEmitter);
function capitalize$1(string3) {
  return string3.charAt(0).toUpperCase() + string3.slice(1);
}
var LanguageUtil = function() {
  function LanguageUtil2(options) {
    _classCallCheck$a(this, LanguageUtil2);
    this.options = options;
    this.supportedLngs = this.options.supportedLngs || false;
    this.logger = baseLogger.create("languageUtils");
  }
  _createClass$8(LanguageUtil2, [{
    key: "getScriptPartFromCode",
    value: function getScriptPartFromCode(code2) {
      if (!code2 || code2.indexOf("-") < 0)
        return null;
      var p2 = code2.split("-");
      if (p2.length === 2)
        return null;
      p2.pop();
      if (p2[p2.length - 1].toLowerCase() === "x")
        return null;
      return this.formatLanguageCode(p2.join("-"));
    }
  }, {
    key: "getLanguagePartFromCode",
    value: function getLanguagePartFromCode(code2) {
      if (!code2 || code2.indexOf("-") < 0)
        return code2;
      var p2 = code2.split("-");
      return this.formatLanguageCode(p2[0]);
    }
  }, {
    key: "formatLanguageCode",
    value: function formatLanguageCode(code2) {
      if (typeof code2 === "string" && code2.indexOf("-") > -1) {
        var specialCases = ["hans", "hant", "latn", "cyrl", "cans", "mong", "arab"];
        var p2 = code2.split("-");
        if (this.options.lowerCaseLng) {
          p2 = p2.map(function(part) {
            return part.toLowerCase();
          });
        } else if (p2.length === 2) {
          p2[0] = p2[0].toLowerCase();
          p2[1] = p2[1].toUpperCase();
          if (specialCases.indexOf(p2[1].toLowerCase()) > -1)
            p2[1] = capitalize$1(p2[1].toLowerCase());
        } else if (p2.length === 3) {
          p2[0] = p2[0].toLowerCase();
          if (p2[1].length === 2)
            p2[1] = p2[1].toUpperCase();
          if (p2[0] !== "sgn" && p2[2].length === 2)
            p2[2] = p2[2].toUpperCase();
          if (specialCases.indexOf(p2[1].toLowerCase()) > -1)
            p2[1] = capitalize$1(p2[1].toLowerCase());
          if (specialCases.indexOf(p2[2].toLowerCase()) > -1)
            p2[2] = capitalize$1(p2[2].toLowerCase());
        }
        return p2.join("-");
      }
      return this.options.cleanCode || this.options.lowerCaseLng ? code2.toLowerCase() : code2;
    }
  }, {
    key: "isSupportedCode",
    value: function isSupportedCode(code2) {
      if (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) {
        code2 = this.getLanguagePartFromCode(code2);
      }
      return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code2) > -1;
    }
  }, {
    key: "getBestMatchFromCodes",
    value: function getBestMatchFromCodes(codes) {
      var _this = this;
      if (!codes)
        return null;
      var found;
      codes.forEach(function(code2) {
        if (found)
          return;
        var cleanedLng = _this.formatLanguageCode(code2);
        if (!_this.options.supportedLngs || _this.isSupportedCode(cleanedLng))
          found = cleanedLng;
      });
      if (!found && this.options.supportedLngs) {
        codes.forEach(function(code2) {
          if (found)
            return;
          var lngOnly = _this.getLanguagePartFromCode(code2);
          if (_this.isSupportedCode(lngOnly))
            return found = lngOnly;
          found = _this.options.supportedLngs.find(function(supportedLng) {
            if (supportedLng.indexOf(lngOnly) === 0)
              return supportedLng;
          });
        });
      }
      if (!found)
        found = this.getFallbackCodes(this.options.fallbackLng)[0];
      return found;
    }
  }, {
    key: "getFallbackCodes",
    value: function getFallbackCodes(fallbacks, code2) {
      if (!fallbacks)
        return [];
      if (typeof fallbacks === "function")
        fallbacks = fallbacks(code2);
      if (typeof fallbacks === "string")
        fallbacks = [fallbacks];
      if (Object.prototype.toString.apply(fallbacks) === "[object Array]")
        return fallbacks;
      if (!code2)
        return fallbacks["default"] || [];
      var found = fallbacks[code2];
      if (!found)
        found = fallbacks[this.getScriptPartFromCode(code2)];
      if (!found)
        found = fallbacks[this.formatLanguageCode(code2)];
      if (!found)
        found = fallbacks[this.getLanguagePartFromCode(code2)];
      if (!found)
        found = fallbacks["default"];
      return found || [];
    }
  }, {
    key: "toResolveHierarchy",
    value: function toResolveHierarchy(code2, fallbackCode) {
      var _this2 = this;
      var fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code2);
      var codes = [];
      var addCode = function addCode2(c2) {
        if (!c2)
          return;
        if (_this2.isSupportedCode(c2)) {
          codes.push(c2);
        } else {
          _this2.logger.warn("rejecting language code not found in supportedLngs: ".concat(c2));
        }
      };
      if (typeof code2 === "string" && code2.indexOf("-") > -1) {
        if (this.options.load !== "languageOnly")
          addCode(this.formatLanguageCode(code2));
        if (this.options.load !== "languageOnly" && this.options.load !== "currentOnly")
          addCode(this.getScriptPartFromCode(code2));
        if (this.options.load !== "currentOnly")
          addCode(this.getLanguagePartFromCode(code2));
      } else if (typeof code2 === "string") {
        addCode(this.formatLanguageCode(code2));
      }
      fallbackCodes.forEach(function(fc2) {
        if (codes.indexOf(fc2) < 0)
          addCode(_this2.formatLanguageCode(fc2));
      });
      return codes;
    }
  }]);
  return LanguageUtil2;
}();
var sets = [{
  lngs: ["ach", "ak", "am", "arn", "br", "fil", "gun", "ln", "mfe", "mg", "mi", "oc", "pt", "pt-BR", "tg", "tl", "ti", "tr", "uz", "wa"],
  nr: [1, 2],
  fc: 1
}, {
  lngs: ["af", "an", "ast", "az", "bg", "bn", "ca", "da", "de", "dev", "el", "en", "eo", "es", "et", "eu", "fi", "fo", "fur", "fy", "gl", "gu", "ha", "hi", "hu", "hy", "ia", "it", "kk", "kn", "ku", "lb", "mai", "ml", "mn", "mr", "nah", "nap", "nb", "ne", "nl", "nn", "no", "nso", "pa", "pap", "pms", "ps", "pt-PT", "rm", "sco", "se", "si", "so", "son", "sq", "sv", "sw", "ta", "te", "tk", "ur", "yo"],
  nr: [1, 2],
  fc: 2
}, {
  lngs: ["ay", "bo", "cgg", "fa", "ht", "id", "ja", "jbo", "ka", "km", "ko", "ky", "lo", "ms", "sah", "su", "th", "tt", "ug", "vi", "wo", "zh"],
  nr: [1],
  fc: 3
}, {
  lngs: ["be", "bs", "cnr", "dz", "hr", "ru", "sr", "uk"],
  nr: [1, 2, 5],
  fc: 4
}, {
  lngs: ["ar"],
  nr: [0, 1, 2, 3, 11, 100],
  fc: 5
}, {
  lngs: ["cs", "sk"],
  nr: [1, 2, 5],
  fc: 6
}, {
  lngs: ["csb", "pl"],
  nr: [1, 2, 5],
  fc: 7
}, {
  lngs: ["cy"],
  nr: [1, 2, 3, 8],
  fc: 8
}, {
  lngs: ["fr"],
  nr: [1, 2],
  fc: 9
}, {
  lngs: ["ga"],
  nr: [1, 2, 3, 7, 11],
  fc: 10
}, {
  lngs: ["gd"],
  nr: [1, 2, 3, 20],
  fc: 11
}, {
  lngs: ["is"],
  nr: [1, 2],
  fc: 12
}, {
  lngs: ["jv"],
  nr: [0, 1],
  fc: 13
}, {
  lngs: ["kw"],
  nr: [1, 2, 3, 4],
  fc: 14
}, {
  lngs: ["lt"],
  nr: [1, 2, 10],
  fc: 15
}, {
  lngs: ["lv"],
  nr: [1, 2, 0],
  fc: 16
}, {
  lngs: ["mk"],
  nr: [1, 2],
  fc: 17
}, {
  lngs: ["mnk"],
  nr: [0, 1, 2],
  fc: 18
}, {
  lngs: ["mt"],
  nr: [1, 2, 11, 20],
  fc: 19
}, {
  lngs: ["or"],
  nr: [2, 1],
  fc: 2
}, {
  lngs: ["ro"],
  nr: [1, 2, 20],
  fc: 20
}, {
  lngs: ["sl"],
  nr: [5, 1, 2, 3],
  fc: 21
}, {
  lngs: ["he", "iw"],
  nr: [1, 2, 20, 21],
  fc: 22
}];
var _rulesPluralsTypes = {
  1: function _(n2) {
    return Number(n2 > 1);
  },
  2: function _2(n2) {
    return Number(n2 != 1);
  },
  3: function _3(n2) {
    return 0;
  },
  4: function _4(n2) {
    return Number(n2 % 10 == 1 && n2 % 100 != 11 ? 0 : n2 % 10 >= 2 && n2 % 10 <= 4 && (n2 % 100 < 10 || n2 % 100 >= 20) ? 1 : 2);
  },
  5: function _5(n2) {
    return Number(n2 == 0 ? 0 : n2 == 1 ? 1 : n2 == 2 ? 2 : n2 % 100 >= 3 && n2 % 100 <= 10 ? 3 : n2 % 100 >= 11 ? 4 : 5);
  },
  6: function _6(n2) {
    return Number(n2 == 1 ? 0 : n2 >= 2 && n2 <= 4 ? 1 : 2);
  },
  7: function _7(n2) {
    return Number(n2 == 1 ? 0 : n2 % 10 >= 2 && n2 % 10 <= 4 && (n2 % 100 < 10 || n2 % 100 >= 20) ? 1 : 2);
  },
  8: function _8(n2) {
    return Number(n2 == 1 ? 0 : n2 == 2 ? 1 : n2 != 8 && n2 != 11 ? 2 : 3);
  },
  9: function _9(n2) {
    return Number(n2 >= 2);
  },
  10: function _10(n2) {
    return Number(n2 == 1 ? 0 : n2 == 2 ? 1 : n2 < 7 ? 2 : n2 < 11 ? 3 : 4);
  },
  11: function _11(n2) {
    return Number(n2 == 1 || n2 == 11 ? 0 : n2 == 2 || n2 == 12 ? 1 : n2 > 2 && n2 < 20 ? 2 : 3);
  },
  12: function _12(n2) {
    return Number(n2 % 10 != 1 || n2 % 100 == 11);
  },
  13: function _13(n2) {
    return Number(n2 !== 0);
  },
  14: function _14(n2) {
    return Number(n2 == 1 ? 0 : n2 == 2 ? 1 : n2 == 3 ? 2 : 3);
  },
  15: function _15(n2) {
    return Number(n2 % 10 == 1 && n2 % 100 != 11 ? 0 : n2 % 10 >= 2 && (n2 % 100 < 10 || n2 % 100 >= 20) ? 1 : 2);
  },
  16: function _16(n2) {
    return Number(n2 % 10 == 1 && n2 % 100 != 11 ? 0 : n2 !== 0 ? 1 : 2);
  },
  17: function _17(n2) {
    return Number(n2 == 1 || n2 % 10 == 1 && n2 % 100 != 11 ? 0 : 1);
  },
  18: function _18(n2) {
    return Number(n2 == 0 ? 0 : n2 == 1 ? 1 : 2);
  },
  19: function _19(n2) {
    return Number(n2 == 1 ? 0 : n2 == 0 || n2 % 100 > 1 && n2 % 100 < 11 ? 1 : n2 % 100 > 10 && n2 % 100 < 20 ? 2 : 3);
  },
  20: function _20(n2) {
    return Number(n2 == 1 ? 0 : n2 == 0 || n2 % 100 > 0 && n2 % 100 < 20 ? 1 : 2);
  },
  21: function _21(n2) {
    return Number(n2 % 100 == 1 ? 1 : n2 % 100 == 2 ? 2 : n2 % 100 == 3 || n2 % 100 == 4 ? 3 : 0);
  },
  22: function _22(n2) {
    return Number(n2 == 1 ? 0 : n2 == 2 ? 1 : (n2 < 0 || n2 > 10) && n2 % 10 == 0 ? 2 : 3);
  }
};
var deprecatedJsonVersions = ["v1", "v2", "v3"];
var suffixesOrder = {
  zero: 0,
  one: 1,
  two: 2,
  few: 3,
  many: 4,
  other: 5
};
function createRules() {
  var rules2 = {};
  sets.forEach(function(set2) {
    set2.lngs.forEach(function(l2) {
      rules2[l2] = {
        numbers: set2.nr,
        plurals: _rulesPluralsTypes[set2.fc]
      };
    });
  });
  return rules2;
}
var PluralResolver = function() {
  function PluralResolver2(languageUtils) {
    var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
    _classCallCheck$a(this, PluralResolver2);
    this.languageUtils = languageUtils;
    this.options = options;
    this.logger = baseLogger.create("pluralResolver");
    if ((!this.options.compatibilityJSON || this.options.compatibilityJSON === "v4") && (typeof Intl === "undefined" || !Intl.PluralRules)) {
      this.options.compatibilityJSON = "v3";
      this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.");
    }
    this.rules = createRules();
  }
  _createClass$8(PluralResolver2, [{
    key: "addRule",
    value: function addRule(lng, obj) {
      this.rules[lng] = obj;
    }
  }, {
    key: "getRule",
    value: function getRule(code2) {
      var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
      if (this.shouldUseIntlApi()) {
        try {
          return new Intl.PluralRules(code2, {
            type: options.ordinal ? "ordinal" : "cardinal"
          });
        } catch (_unused) {
          return;
        }
      }
      return this.rules[code2] || this.rules[this.languageUtils.getLanguagePartFromCode(code2)];
    }
  }, {
    key: "needsPlural",
    value: function needsPlural(code2) {
      var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
      var rule = this.getRule(code2, options);
      if (this.shouldUseIntlApi()) {
        return rule && rule.resolvedOptions().pluralCategories.length > 1;
      }
      return rule && rule.numbers.length > 1;
    }
  }, {
    key: "getPluralFormsOfKey",
    value: function getPluralFormsOfKey(code2, key) {
      var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
      return this.getSuffixes(code2, options).map(function(suffix) {
        return "".concat(key).concat(suffix);
      });
    }
  }, {
    key: "getSuffixes",
    value: function getSuffixes(code2) {
      var _this = this;
      var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
      var rule = this.getRule(code2, options);
      if (!rule) {
        return [];
      }
      if (this.shouldUseIntlApi()) {
        return rule.resolvedOptions().pluralCategories.sort(function(pluralCategory1, pluralCategory2) {
          return suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2];
        }).map(function(pluralCategory) {
          return "".concat(_this.options.prepend).concat(pluralCategory);
        });
      }
      return rule.numbers.map(function(number4) {
        return _this.getSuffix(code2, number4, options);
      });
    }
  }, {
    key: "getSuffix",
    value: function getSuffix(code2, count) {
      var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
      var rule = this.getRule(code2, options);
      if (rule) {
        if (this.shouldUseIntlApi()) {
          return "".concat(this.options.prepend).concat(rule.select(count));
        }
        return this.getSuffixRetroCompatible(rule, count);
      }
      this.logger.warn("no plural rule found for: ".concat(code2));
      return "";
    }
  }, {
    key: "getSuffixRetroCompatible",
    value: function getSuffixRetroCompatible(rule, count) {
      var _this2 = this;
      var idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count));
      var suffix = rule.numbers[idx];
      if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
        if (suffix === 2) {
          suffix = "plural";
        } else if (suffix === 1) {
          suffix = "";
        }
      }
      var returnSuffix = function returnSuffix2() {
        return _this2.options.prepend && suffix.toString() ? _this2.options.prepend + suffix.toString() : suffix.toString();
      };
      if (this.options.compatibilityJSON === "v1") {
        if (suffix === 1)
          return "";
        if (typeof suffix === "number")
          return "_plural_".concat(suffix.toString());
        return returnSuffix();
      } else if (this.options.compatibilityJSON === "v2") {
        return returnSuffix();
      } else if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
        return returnSuffix();
      }
      return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString();
    }
  }, {
    key: "shouldUseIntlApi",
    value: function shouldUseIntlApi() {
      return !deprecatedJsonVersions.includes(this.options.compatibilityJSON);
    }
  }]);
  return PluralResolver2;
}();
function ownKeys$3$1(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
      });
    }
    keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$3$1(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2] != null ? arguments[i2] : {};
    if (i2 % 2) {
      ownKeys$3$1(Object(source2), true).forEach(function(key) {
        _defineProperty$3(target, key, source2[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2));
    } else {
      ownKeys$3$1(Object(source2)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
      });
    }
  }
  return target;
}
var Interpolator = function() {
  function Interpolator2() {
    var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    _classCallCheck$a(this, Interpolator2);
    this.logger = baseLogger.create("interpolator");
    this.options = options;
    this.format = options.interpolation && options.interpolation.format || function(value2) {
      return value2;
    };
    this.init(options);
  }
  _createClass$8(Interpolator2, [{
    key: "init",
    value: function init2() {
      var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
      if (!options.interpolation)
        options.interpolation = {
          escapeValue: true
        };
      var iOpts = options.interpolation;
      this.escape = iOpts.escape !== void 0 ? iOpts.escape : escape;
      this.escapeValue = iOpts.escapeValue !== void 0 ? iOpts.escapeValue : true;
      this.useRawValueToEscape = iOpts.useRawValueToEscape !== void 0 ? iOpts.useRawValueToEscape : false;
      this.prefix = iOpts.prefix ? regexEscape$1(iOpts.prefix) : iOpts.prefixEscaped || "{{";
      this.suffix = iOpts.suffix ? regexEscape$1(iOpts.suffix) : iOpts.suffixEscaped || "}}";
      this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ",";
      this.unescapePrefix = iOpts.unescapeSuffix ? "" : iOpts.unescapePrefix || "-";
      this.unescapeSuffix = this.unescapePrefix ? "" : iOpts.unescapeSuffix || "";
      this.nestingPrefix = iOpts.nestingPrefix ? regexEscape$1(iOpts.nestingPrefix) : iOpts.nestingPrefixEscaped || regexEscape$1("$t(");
      this.nestingSuffix = iOpts.nestingSuffix ? regexEscape$1(iOpts.nestingSuffix) : iOpts.nestingSuffixEscaped || regexEscape$1(")");
      this.nestingOptionsSeparator = iOpts.nestingOptionsSeparator ? iOpts.nestingOptionsSeparator : iOpts.nestingOptionsSeparator || ",";
      this.maxReplaces = iOpts.maxReplaces ? iOpts.maxReplaces : 1e3;
      this.alwaysFormat = iOpts.alwaysFormat !== void 0 ? iOpts.alwaysFormat : false;
      this.resetRegExp();
    }
  }, {
    key: "reset",
    value: function reset() {
      if (this.options)
        this.init(this.options);
    }
  }, {
    key: "resetRegExp",
    value: function resetRegExp() {
      var regexpStr = "".concat(this.prefix, "(.+?)").concat(this.suffix);
      this.regexp = new RegExp(regexpStr, "g");
      var regexpUnescapeStr = "".concat(this.prefix).concat(this.unescapePrefix, "(.+?)").concat(this.unescapeSuffix).concat(this.suffix);
      this.regexpUnescape = new RegExp(regexpUnescapeStr, "g");
      var nestingRegexpStr = "".concat(this.nestingPrefix, "(.+?)").concat(this.nestingSuffix);
      this.nestingRegexp = new RegExp(nestingRegexpStr, "g");
    }
  }, {
    key: "interpolate",
    value: function interpolate2(str, data, lng, options) {
      var _this = this;
      var match5;
      var value2;
      var replaces;
      var defaultData2 = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
      function regexSafe(val) {
        return val.replace(/\$/g, "$$$$");
      }
      var handleFormat = function handleFormat2(key) {
        if (key.indexOf(_this.formatSeparator) < 0) {
          var path = getPathWithDefaults(data, defaultData2, key);
          return _this.alwaysFormat ? _this.format(path, void 0, lng, _objectSpread$3$1(_objectSpread$3$1(_objectSpread$3$1({}, options), data), {}, {
            interpolationkey: key
          })) : path;
        }
        var p2 = key.split(_this.formatSeparator);
        var k2 = p2.shift().trim();
        var f2 = p2.join(_this.formatSeparator).trim();
        return _this.format(getPathWithDefaults(data, defaultData2, k2), f2, lng, _objectSpread$3$1(_objectSpread$3$1(_objectSpread$3$1({}, options), data), {}, {
          interpolationkey: k2
        }));
      };
      this.resetRegExp();
      var missingInterpolationHandler = options && options.missingInterpolationHandler || this.options.missingInterpolationHandler;
      var skipOnVariables = options && options.interpolation && options.interpolation.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
      var todos = [{
        regex: this.regexpUnescape,
        safeValue: function safeValue(val) {
          return regexSafe(val);
        }
      }, {
        regex: this.regexp,
        safeValue: function safeValue(val) {
          return _this.escapeValue ? regexSafe(_this.escape(val)) : regexSafe(val);
        }
      }];
      todos.forEach(function(todo) {
        replaces = 0;
        while (match5 = todo.regex.exec(str)) {
          var matchedVar = match5[1].trim();
          value2 = handleFormat(matchedVar);
          if (value2 === void 0) {
            if (typeof missingInterpolationHandler === "function") {
              var temp = missingInterpolationHandler(str, match5, options);
              value2 = typeof temp === "string" ? temp : "";
            } else if (options && options.hasOwnProperty(matchedVar)) {
              value2 = "";
            } else if (skipOnVariables) {
              value2 = match5[0];
              continue;
            } else {
              _this.logger.warn("missed to pass in variable ".concat(matchedVar, " for interpolating ").concat(str));
              value2 = "";
            }
          } else if (typeof value2 !== "string" && !_this.useRawValueToEscape) {
            value2 = makeString(value2);
          }
          var safeValue = todo.safeValue(value2);
          str = str.replace(match5[0], safeValue);
          if (skipOnVariables) {
            todo.regex.lastIndex += value2.length;
            todo.regex.lastIndex -= match5[0].length;
          } else {
            todo.regex.lastIndex = 0;
          }
          replaces++;
          if (replaces >= _this.maxReplaces) {
            break;
          }
        }
      });
      return str;
    }
  }, {
    key: "nest",
    value: function nest(str, fc2) {
      var _this2 = this;
      var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
      var match5;
      var value2;
      var clonedOptions = _objectSpread$3$1({}, options);
      clonedOptions.applyPostProcessor = false;
      delete clonedOptions.defaultValue;
      function handleHasOptions(key, inheritedOptions) {
        var sep = this.nestingOptionsSeparator;
        if (key.indexOf(sep) < 0)
          return key;
        var c2 = key.split(new RegExp("".concat(sep, "[ ]*{")));
        var optionsString = "{".concat(c2[1]);
        key = c2[0];
        optionsString = this.interpolate(optionsString, clonedOptions);
        var matchedSingleQuotes = optionsString.match(/'/g);
        var matchedDoubleQuotes = optionsString.match(/"/g);
        if (matchedSingleQuotes && matchedSingleQuotes.length % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {
          optionsString = optionsString.replace(/'/g, '"');
        }
        try {
          clonedOptions = JSON.parse(optionsString);
          if (inheritedOptions)
            clonedOptions = _objectSpread$3$1(_objectSpread$3$1({}, inheritedOptions), clonedOptions);
        } catch (e2) {
          this.logger.warn("failed parsing options string in nesting for key ".concat(key), e2);
          return "".concat(key).concat(sep).concat(optionsString);
        }
        delete clonedOptions.defaultValue;
        return key;
      }
      while (match5 = this.nestingRegexp.exec(str)) {
        var formatters2 = [];
        var doReduce = false;
        if (match5[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(match5[1])) {
          var r2 = match5[1].split(this.formatSeparator).map(function(elem) {
            return elem.trim();
          });
          match5[1] = r2.shift();
          formatters2 = r2;
          doReduce = true;
        }
        value2 = fc2(handleHasOptions.call(this, match5[1].trim(), clonedOptions), clonedOptions);
        if (value2 && match5[0] === str && typeof value2 !== "string")
          return value2;
        if (typeof value2 !== "string")
          value2 = makeString(value2);
        if (!value2) {
          this.logger.warn("missed to resolve ".concat(match5[1], " for nesting ").concat(str));
          value2 = "";
        }
        if (doReduce) {
          value2 = formatters2.reduce(function(v2, f2) {
            return _this2.format(v2, f2, options.lng, _objectSpread$3$1(_objectSpread$3$1({}, options), {}, {
              interpolationkey: match5[1].trim()
            }));
          }, value2.trim());
        }
        str = str.replace(match5[0], value2);
        this.regexp.lastIndex = 0;
      }
      return str;
    }
  }]);
  return Interpolator2;
}();
function ownKeys$4$1(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
      });
    }
    keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$4$1(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2] != null ? arguments[i2] : {};
    if (i2 % 2) {
      ownKeys$4$1(Object(source2), true).forEach(function(key) {
        _defineProperty$3(target, key, source2[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2));
    } else {
      ownKeys$4$1(Object(source2)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
      });
    }
  }
  return target;
}
function parseFormatStr(formatStr) {
  var formatName = formatStr.toLowerCase().trim();
  var formatOptions = {};
  if (formatStr.indexOf("(") > -1) {
    var p2 = formatStr.split("(");
    formatName = p2[0].toLowerCase().trim();
    var optStr = p2[1].substring(0, p2[1].length - 1);
    if (formatName === "currency" && optStr.indexOf(":") < 0) {
      if (!formatOptions.currency)
        formatOptions.currency = optStr.trim();
    } else if (formatName === "relativetime" && optStr.indexOf(":") < 0) {
      if (!formatOptions.range)
        formatOptions.range = optStr.trim();
    } else {
      var opts2 = optStr.split(";");
      opts2.forEach(function(opt) {
        if (!opt)
          return;
        var _opt$split = opt.split(":"), _opt$split2 = _toArray(_opt$split), key = _opt$split2[0], rest = _opt$split2.slice(1);
        var val = rest.join(":").trim().replace(/^'+|'+$/g, "");
        if (!formatOptions[key.trim()])
          formatOptions[key.trim()] = val;
        if (val === "false")
          formatOptions[key.trim()] = false;
        if (val === "true")
          formatOptions[key.trim()] = true;
        if (!isNaN(val))
          formatOptions[key.trim()] = parseInt(val, 10);
      });
    }
  }
  return {
    formatName,
    formatOptions
  };
}
function createCachedFormatter(fn) {
  var cache2 = {};
  return function invokeFormatter(val, lng, options) {
    var key = lng + JSON.stringify(options);
    var formatter = cache2[key];
    if (!formatter) {
      formatter = fn(lng, options);
      cache2[key] = formatter;
    }
    return formatter(val);
  };
}
var Formatter = function() {
  function Formatter2() {
    var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    _classCallCheck$a(this, Formatter2);
    this.logger = baseLogger.create("formatter");
    this.options = options;
    this.formats = {
      number: createCachedFormatter(function(lng, options2) {
        var formatter = new Intl.NumberFormat(lng, options2);
        return function(val) {
          return formatter.format(val);
        };
      }),
      currency: createCachedFormatter(function(lng, options2) {
        var formatter = new Intl.NumberFormat(lng, _objectSpread$4$1(_objectSpread$4$1({}, options2), {}, {
          style: "currency"
        }));
        return function(val) {
          return formatter.format(val);
        };
      }),
      datetime: createCachedFormatter(function(lng, options2) {
        var formatter = new Intl.DateTimeFormat(lng, _objectSpread$4$1({}, options2));
        return function(val) {
          return formatter.format(val);
        };
      }),
      relativetime: createCachedFormatter(function(lng, options2) {
        var formatter = new Intl.RelativeTimeFormat(lng, _objectSpread$4$1({}, options2));
        return function(val) {
          return formatter.format(val, options2.range || "day");
        };
      }),
      list: createCachedFormatter(function(lng, options2) {
        var formatter = new Intl.ListFormat(lng, _objectSpread$4$1({}, options2));
        return function(val) {
          return formatter.format(val);
        };
      })
    };
    this.init(options);
  }
  _createClass$8(Formatter2, [{
    key: "init",
    value: function init2(services) {
      var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
        interpolation: {}
      };
      var iOpts = options.interpolation;
      this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ",";
    }
  }, {
    key: "add",
    value: function add2(name2, fc2) {
      this.formats[name2.toLowerCase().trim()] = fc2;
    }
  }, {
    key: "addCached",
    value: function addCached(name2, fc2) {
      this.formats[name2.toLowerCase().trim()] = createCachedFormatter(fc2);
    }
  }, {
    key: "format",
    value: function format2(value2, _format, lng, options) {
      var _this = this;
      var formats2 = _format.split(this.formatSeparator);
      var result = formats2.reduce(function(mem, f2) {
        var _parseFormatStr = parseFormatStr(f2), formatName = _parseFormatStr.formatName, formatOptions = _parseFormatStr.formatOptions;
        if (_this.formats[formatName]) {
          var formatted = mem;
          try {
            var valOptions = options && options.formatParams && options.formatParams[options.interpolationkey] || {};
            var l2 = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
            formatted = _this.formats[formatName](mem, l2, _objectSpread$4$1(_objectSpread$4$1(_objectSpread$4$1({}, formatOptions), options), valOptions));
          } catch (error2) {
            _this.logger.warn(error2);
          }
          return formatted;
        } else {
          _this.logger.warn("there was no format function for ".concat(formatName));
        }
        return mem;
      }, value2);
      return result;
    }
  }]);
  return Formatter2;
}();
function ownKeys$5$1(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
      });
    }
    keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$5$1(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2] != null ? arguments[i2] : {};
    if (i2 % 2) {
      ownKeys$5$1(Object(source2), true).forEach(function(key) {
        _defineProperty$3(target, key, source2[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2));
    } else {
      ownKeys$5$1(Object(source2)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
      });
    }
  }
  return target;
}
function _createSuper$2(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct$2$1();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn$a(this, result);
  };
}
function _isNativeReflectConstruct$2$1() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e2) {
    return false;
  }
}
function removePending(q2, name2) {
  if (q2.pending[name2] !== void 0) {
    delete q2.pending[name2];
    q2.pendingCount--;
  }
}
var Connector = function(_EventEmitter) {
  _inherits$a(Connector2, _EventEmitter);
  var _super = _createSuper$2(Connector2);
  function Connector2(backend, store, services) {
    var _this;
    var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
    _classCallCheck$a(this, Connector2);
    _this = _super.call(this);
    if (isIE10) {
      EventEmitter.call(_assertThisInitialized(_this));
    }
    _this.backend = backend;
    _this.store = store;
    _this.services = services;
    _this.languageUtils = services.languageUtils;
    _this.options = options;
    _this.logger = baseLogger.create("backendConnector");
    _this.waitingReads = [];
    _this.maxParallelReads = options.maxParallelReads || 10;
    _this.readingCalls = 0;
    _this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
    _this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
    _this.state = {};
    _this.queue = [];
    if (_this.backend && _this.backend.init) {
      _this.backend.init(services, options.backend, options);
    }
    return _this;
  }
  _createClass$8(Connector2, [{
    key: "queueLoad",
    value: function queueLoad(languages2, namespaces, options, callback2) {
      var _this2 = this;
      var toLoad = {};
      var pending = {};
      var toLoadLanguages = {};
      var toLoadNamespaces = {};
      languages2.forEach(function(lng) {
        var hasAllNamespaces = true;
        namespaces.forEach(function(ns) {
          var name2 = "".concat(lng, "|").concat(ns);
          if (!options.reload && _this2.store.hasResourceBundle(lng, ns)) {
            _this2.state[name2] = 2;
          } else if (_this2.state[name2] < 0)
            ;
          else if (_this2.state[name2] === 1) {
            if (pending[name2] === void 0)
              pending[name2] = true;
          } else {
            _this2.state[name2] = 1;
            hasAllNamespaces = false;
            if (pending[name2] === void 0)
              pending[name2] = true;
            if (toLoad[name2] === void 0)
              toLoad[name2] = true;
            if (toLoadNamespaces[ns] === void 0)
              toLoadNamespaces[ns] = true;
          }
        });
        if (!hasAllNamespaces)
          toLoadLanguages[lng] = true;
      });
      if (Object.keys(toLoad).length || Object.keys(pending).length) {
        this.queue.push({
          pending,
          pendingCount: Object.keys(pending).length,
          loaded: {},
          errors: [],
          callback: callback2
        });
      }
      return {
        toLoad: Object.keys(toLoad),
        pending: Object.keys(pending),
        toLoadLanguages: Object.keys(toLoadLanguages),
        toLoadNamespaces: Object.keys(toLoadNamespaces)
      };
    }
  }, {
    key: "loaded",
    value: function loaded(name2, err, data) {
      var s2 = name2.split("|");
      var lng = s2[0];
      var ns = s2[1];
      if (err)
        this.emit("failedLoading", lng, ns, err);
      if (data) {
        this.store.addResourceBundle(lng, ns, data);
      }
      this.state[name2] = err ? -1 : 2;
      var loaded2 = {};
      this.queue.forEach(function(q2) {
        pushPath(q2.loaded, [lng], ns);
        removePending(q2, name2);
        if (err)
          q2.errors.push(err);
        if (q2.pendingCount === 0 && !q2.done) {
          Object.keys(q2.loaded).forEach(function(l2) {
            if (!loaded2[l2])
              loaded2[l2] = {};
            var loadedKeys = q2.loaded[l2];
            if (loadedKeys.length) {
              loadedKeys.forEach(function(ns2) {
                if (loaded2[l2][ns2] === void 0)
                  loaded2[l2][ns2] = true;
              });
            }
          });
          q2.done = true;
          if (q2.errors.length) {
            q2.callback(q2.errors);
          } else {
            q2.callback();
          }
        }
      });
      this.emit("loaded", loaded2);
      this.queue = this.queue.filter(function(q2) {
        return !q2.done;
      });
    }
  }, {
    key: "read",
    value: function read(lng, ns, fcName) {
      var _this3 = this;
      var tried = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
      var wait = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout;
      var callback2 = arguments.length > 5 ? arguments[5] : void 0;
      if (!lng.length)
        return callback2(null, {});
      if (this.readingCalls >= this.maxParallelReads) {
        this.waitingReads.push({
          lng,
          ns,
          fcName,
          tried,
          wait,
          callback: callback2
        });
        return;
      }
      this.readingCalls++;
      return this.backend[fcName](lng, ns, function(err, data) {
        _this3.readingCalls--;
        if (_this3.waitingReads.length > 0) {
          var next2 = _this3.waitingReads.shift();
          _this3.read(next2.lng, next2.ns, next2.fcName, next2.tried, next2.wait, next2.callback);
        }
        if (err && data && tried < _this3.maxRetries) {
          setTimeout(function() {
            _this3.read.call(_this3, lng, ns, fcName, tried + 1, wait * 2, callback2);
          }, wait);
          return;
        }
        callback2(err, data);
      });
    }
  }, {
    key: "prepareLoading",
    value: function prepareLoading(languages2, namespaces) {
      var _this4 = this;
      var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
      var callback2 = arguments.length > 3 ? arguments[3] : void 0;
      if (!this.backend) {
        this.logger.warn("No backend was added via i18next.use. Will not load resources.");
        return callback2 && callback2();
      }
      if (typeof languages2 === "string")
        languages2 = this.languageUtils.toResolveHierarchy(languages2);
      if (typeof namespaces === "string")
        namespaces = [namespaces];
      var toLoad = this.queueLoad(languages2, namespaces, options, callback2);
      if (!toLoad.toLoad.length) {
        if (!toLoad.pending.length)
          callback2();
        return null;
      }
      toLoad.toLoad.forEach(function(name2) {
        _this4.loadOne(name2);
      });
    }
  }, {
    key: "load",
    value: function load(languages2, namespaces, callback2) {
      this.prepareLoading(languages2, namespaces, {}, callback2);
    }
  }, {
    key: "reload",
    value: function reload(languages2, namespaces, callback2) {
      this.prepareLoading(languages2, namespaces, {
        reload: true
      }, callback2);
    }
  }, {
    key: "loadOne",
    value: function loadOne(name2) {
      var _this5 = this;
      var prefix = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
      var s2 = name2.split("|");
      var lng = s2[0];
      var ns = s2[1];
      this.read(lng, ns, "read", void 0, void 0, function(err, data) {
        if (err)
          _this5.logger.warn("".concat(prefix, "loading namespace ").concat(ns, " for language ").concat(lng, " failed"), err);
        if (!err && data)
          _this5.logger.log("".concat(prefix, "loaded namespace ").concat(ns, " for language ").concat(lng), data);
        _this5.loaded(name2, err, data);
      });
    }
  }, {
    key: "saveMissing",
    value: function saveMissing(languages2, namespace, key, fallbackValue, isUpdate) {
      var options = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {};
      if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(namespace)) {
        this.logger.warn('did not save key "'.concat(key, '" as the namespace "').concat(namespace, '" was not yet loaded'), "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
        return;
      }
      if (key === void 0 || key === null || key === "")
        return;
      if (this.backend && this.backend.create) {
        this.backend.create(languages2, namespace, key, fallbackValue, null, _objectSpread$5$1(_objectSpread$5$1({}, options), {}, {
          isUpdate
        }));
      }
      if (!languages2 || !languages2[0])
        return;
      this.store.addResource(languages2[0], namespace, key, fallbackValue);
    }
  }]);
  return Connector2;
}(EventEmitter);
function get$5() {
  return {
    debug: false,
    initImmediate: true,
    ns: ["translation"],
    defaultNS: ["translation"],
    fallbackLng: ["dev"],
    fallbackNS: false,
    supportedLngs: false,
    nonExplicitSupportedLngs: false,
    load: "all",
    preload: false,
    simplifyPluralSuffix: true,
    keySeparator: ".",
    nsSeparator: ":",
    pluralSeparator: "_",
    contextSeparator: "_",
    partialBundledLanguages: false,
    saveMissing: false,
    updateMissing: false,
    saveMissingTo: "fallback",
    saveMissingPlurals: true,
    missingKeyHandler: false,
    missingInterpolationHandler: false,
    postProcess: false,
    postProcessPassResolved: false,
    returnNull: true,
    returnEmptyString: true,
    returnObjects: false,
    joinArrays: false,
    returnedObjectHandler: false,
    parseMissingKeyHandler: false,
    appendNamespaceToMissingKey: false,
    appendNamespaceToCIMode: false,
    overloadTranslationOptionHandler: function handle2(args) {
      var ret = {};
      if (_typeof$1(args[1]) === "object")
        ret = args[1];
      if (typeof args[1] === "string")
        ret.defaultValue = args[1];
      if (typeof args[2] === "string")
        ret.tDescription = args[2];
      if (_typeof$1(args[2]) === "object" || _typeof$1(args[3]) === "object") {
        var options = args[3] || args[2];
        Object.keys(options).forEach(function(key) {
          ret[key] = options[key];
        });
      }
      return ret;
    },
    interpolation: {
      escapeValue: true,
      format: function format2(value2, _format, lng, options) {
        return value2;
      },
      prefix: "{{",
      suffix: "}}",
      formatSeparator: ",",
      unescapePrefix: "-",
      nestingPrefix: "$t(",
      nestingSuffix: ")",
      nestingOptionsSeparator: ",",
      maxReplaces: 1e3,
      skipOnVariables: true
    }
  };
}
function transformOptions(options) {
  if (typeof options.ns === "string")
    options.ns = [options.ns];
  if (typeof options.fallbackLng === "string")
    options.fallbackLng = [options.fallbackLng];
  if (typeof options.fallbackNS === "string")
    options.fallbackNS = [options.fallbackNS];
  if (options.supportedLngs && options.supportedLngs.indexOf("cimode") < 0) {
    options.supportedLngs = options.supportedLngs.concat(["cimode"]);
  }
  return options;
}
function ownKeys$6$1(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
      });
    }
    keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$6$1(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2] != null ? arguments[i2] : {};
    if (i2 % 2) {
      ownKeys$6$1(Object(source2), true).forEach(function(key) {
        _defineProperty$3(target, key, source2[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2));
    } else {
      ownKeys$6$1(Object(source2)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
      });
    }
  }
  return target;
}
function _createSuper$3(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct$3$1();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn$a(this, result);
  };
}
function _isNativeReflectConstruct$3$1() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e2) {
    return false;
  }
}
function noop$4() {
}
function bindMemberFunctions(inst) {
  var mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
  mems.forEach(function(mem) {
    if (typeof inst[mem] === "function") {
      inst[mem] = inst[mem].bind(inst);
    }
  });
}
var I18n = function(_EventEmitter) {
  _inherits$a(I18n2, _EventEmitter);
  var _super = _createSuper$3(I18n2);
  function I18n2() {
    var _this;
    var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    var callback2 = arguments.length > 1 ? arguments[1] : void 0;
    _classCallCheck$a(this, I18n2);
    _this = _super.call(this);
    if (isIE10) {
      EventEmitter.call(_assertThisInitialized(_this));
    }
    _this.options = transformOptions(options);
    _this.services = {};
    _this.logger = baseLogger;
    _this.modules = {
      external: []
    };
    bindMemberFunctions(_assertThisInitialized(_this));
    if (callback2 && !_this.isInitialized && !options.isClone) {
      if (!_this.options.initImmediate) {
        _this.init(options, callback2);
        return _possibleConstructorReturn$a(_this, _assertThisInitialized(_this));
      }
      setTimeout(function() {
        _this.init(options, callback2);
      }, 0);
    }
    return _this;
  }
  _createClass$8(I18n2, [{
    key: "init",
    value: function init2() {
      var _this2 = this;
      var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
      var callback2 = arguments.length > 1 ? arguments[1] : void 0;
      if (typeof options === "function") {
        callback2 = options;
        options = {};
      }
      if (!options.defaultNS && options.defaultNS !== false && options.ns) {
        if (typeof options.ns === "string") {
          options.defaultNS = options.ns;
        } else if (options.ns.indexOf("translation") < 0) {
          options.defaultNS = options.ns[0];
        }
      }
      var defOpts = get$5();
      this.options = _objectSpread$6$1(_objectSpread$6$1(_objectSpread$6$1({}, defOpts), this.options), transformOptions(options));
      if (this.options.compatibilityAPI !== "v1") {
        this.options.interpolation = _objectSpread$6$1(_objectSpread$6$1({}, defOpts.interpolation), this.options.interpolation);
      }
      if (options.keySeparator !== void 0) {
        this.options.userDefinedKeySeparator = options.keySeparator;
      }
      if (options.nsSeparator !== void 0) {
        this.options.userDefinedNsSeparator = options.nsSeparator;
      }
      function createClassOnDemand(ClassOrObject) {
        if (!ClassOrObject)
          return null;
        if (typeof ClassOrObject === "function")
          return new ClassOrObject();
        return ClassOrObject;
      }
      if (!this.options.isClone) {
        if (this.modules.logger) {
          baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
        } else {
          baseLogger.init(null, this.options);
        }
        var formatter;
        if (this.modules.formatter) {
          formatter = this.modules.formatter;
        } else if (typeof Intl !== "undefined") {
          formatter = Formatter;
        }
        var lu = new LanguageUtil(this.options);
        this.store = new ResourceStore(this.options.resources, this.options);
        var s2 = this.services;
        s2.logger = baseLogger;
        s2.resourceStore = this.store;
        s2.languageUtils = lu;
        s2.pluralResolver = new PluralResolver(lu, {
          prepend: this.options.pluralSeparator,
          compatibilityJSON: this.options.compatibilityJSON,
          simplifyPluralSuffix: this.options.simplifyPluralSuffix
        });
        if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
          s2.formatter = createClassOnDemand(formatter);
          s2.formatter.init(s2, this.options);
          this.options.interpolation.format = s2.formatter.format.bind(s2.formatter);
        }
        s2.interpolator = new Interpolator(this.options);
        s2.utils = {
          hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
        };
        s2.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s2.resourceStore, s2, this.options);
        s2.backendConnector.on("*", function(event) {
          for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
            args[_key - 1] = arguments[_key];
          }
          _this2.emit.apply(_this2, [event].concat(args));
        });
        if (this.modules.languageDetector) {
          s2.languageDetector = createClassOnDemand(this.modules.languageDetector);
          s2.languageDetector.init(s2, this.options.detection, this.options);
        }
        if (this.modules.i18nFormat) {
          s2.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
          if (s2.i18nFormat.init)
            s2.i18nFormat.init(this);
        }
        this.translator = new Translator(this.services, this.options);
        this.translator.on("*", function(event) {
          for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
            args[_key2 - 1] = arguments[_key2];
          }
          _this2.emit.apply(_this2, [event].concat(args));
        });
        this.modules.external.forEach(function(m2) {
          if (m2.init)
            m2.init(_this2);
        });
      }
      this.format = this.options.interpolation.format;
      if (!callback2)
        callback2 = noop$4;
      if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
        var codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
        if (codes.length > 0 && codes[0] !== "dev")
          this.options.lng = codes[0];
      }
      if (!this.services.languageDetector && !this.options.lng) {
        this.logger.warn("init: no languageDetector is used and no lng is defined");
      }
      var storeApi = ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"];
      storeApi.forEach(function(fcName) {
        _this2[fcName] = function() {
          var _this2$store;
          return (_this2$store = _this2.store)[fcName].apply(_this2$store, arguments);
        };
      });
      var storeApiChained = ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"];
      storeApiChained.forEach(function(fcName) {
        _this2[fcName] = function() {
          var _this2$store2;
          (_this2$store2 = _this2.store)[fcName].apply(_this2$store2, arguments);
          return _this2;
        };
      });
      var deferred = defer();
      var load = function load2() {
        var finish = function finish2(err, t2) {
          if (_this2.isInitialized && !_this2.initializedStoreOnce)
            _this2.logger.warn("init: i18next is already initialized. You should call init just once!");
          _this2.isInitialized = true;
          if (!_this2.options.isClone)
            _this2.logger.log("initialized", _this2.options);
          _this2.emit("initialized", _this2.options);
          deferred.resolve(t2);
          callback2(err, t2);
        };
        if (_this2.languages && _this2.options.compatibilityAPI !== "v1" && !_this2.isInitialized)
          return finish(null, _this2.t.bind(_this2));
        _this2.changeLanguage(_this2.options.lng, finish);
      };
      if (this.options.resources || !this.options.initImmediate) {
        load();
      } else {
        setTimeout(load, 0);
      }
      return deferred;
    }
  }, {
    key: "loadResources",
    value: function loadResources(language) {
      var _this3 = this;
      var callback2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$4;
      var usedCallback = callback2;
      var usedLng = typeof language === "string" ? language : this.language;
      if (typeof language === "function")
        usedCallback = language;
      if (!this.options.resources || this.options.partialBundledLanguages) {
        if (usedLng && usedLng.toLowerCase() === "cimode")
          return usedCallback();
        var toLoad = [];
        var append3 = function append4(lng) {
          if (!lng)
            return;
          var lngs = _this3.services.languageUtils.toResolveHierarchy(lng);
          lngs.forEach(function(l2) {
            if (toLoad.indexOf(l2) < 0)
              toLoad.push(l2);
          });
        };
        if (!usedLng) {
          var fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
          fallbacks.forEach(function(l2) {
            return append3(l2);
          });
        } else {
          append3(usedLng);
        }
        if (this.options.preload) {
          this.options.preload.forEach(function(l2) {
            return append3(l2);
          });
        }
        this.services.backendConnector.load(toLoad, this.options.ns, function(e2) {
          if (!e2 && !_this3.resolvedLanguage && _this3.language)
            _this3.setResolvedLanguage(_this3.language);
          usedCallback(e2);
        });
      } else {
        usedCallback(null);
      }
    }
  }, {
    key: "reloadResources",
    value: function reloadResources(lngs, ns, callback2) {
      var deferred = defer();
      if (!lngs)
        lngs = this.languages;
      if (!ns)
        ns = this.options.ns;
      if (!callback2)
        callback2 = noop$4;
      this.services.backendConnector.reload(lngs, ns, function(err) {
        deferred.resolve();
        callback2(err);
      });
      return deferred;
    }
  }, {
    key: "use",
    value: function use(module2) {
      if (!module2)
        throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
      if (!module2.type)
        throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
      if (module2.type === "backend") {
        this.modules.backend = module2;
      }
      if (module2.type === "logger" || module2.log && module2.warn && module2.error) {
        this.modules.logger = module2;
      }
      if (module2.type === "languageDetector") {
        this.modules.languageDetector = module2;
      }
      if (module2.type === "i18nFormat") {
        this.modules.i18nFormat = module2;
      }
      if (module2.type === "postProcessor") {
        postProcessor.addPostProcessor(module2);
      }
      if (module2.type === "formatter") {
        this.modules.formatter = module2;
      }
      if (module2.type === "3rdParty") {
        this.modules.external.push(module2);
      }
      return this;
    }
  }, {
    key: "setResolvedLanguage",
    value: function setResolvedLanguage(l2) {
      if (!l2 || !this.languages)
        return;
      if (["cimode", "dev"].indexOf(l2) > -1)
        return;
      for (var li2 = 0; li2 < this.languages.length; li2++) {
        var lngInLngs = this.languages[li2];
        if (["cimode", "dev"].indexOf(lngInLngs) > -1)
          continue;
        if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
          this.resolvedLanguage = lngInLngs;
          break;
        }
      }
    }
  }, {
    key: "changeLanguage",
    value: function changeLanguage(lng, callback2) {
      var _this4 = this;
      this.isLanguageChangingTo = lng;
      var deferred = defer();
      this.emit("languageChanging", lng);
      var setLngProps = function setLngProps2(l2) {
        _this4.language = l2;
        _this4.languages = _this4.services.languageUtils.toResolveHierarchy(l2);
        _this4.resolvedLanguage = void 0;
        _this4.setResolvedLanguage(l2);
      };
      var done = function done2(err, l2) {
        if (l2) {
          setLngProps(l2);
          _this4.translator.changeLanguage(l2);
          _this4.isLanguageChangingTo = void 0;
          _this4.emit("languageChanged", l2);
          _this4.logger.log("languageChanged", l2);
        } else {
          _this4.isLanguageChangingTo = void 0;
        }
        deferred.resolve(function() {
          return _this4.t.apply(_this4, arguments);
        });
        if (callback2)
          callback2(err, function() {
            return _this4.t.apply(_this4, arguments);
          });
      };
      var setLng = function setLng2(lngs) {
        if (!lng && !lngs && _this4.services.languageDetector)
          lngs = [];
        var l2 = typeof lngs === "string" ? lngs : _this4.services.languageUtils.getBestMatchFromCodes(lngs);
        if (l2) {
          if (!_this4.language) {
            setLngProps(l2);
          }
          if (!_this4.translator.language)
            _this4.translator.changeLanguage(l2);
          if (_this4.services.languageDetector)
            _this4.services.languageDetector.cacheUserLanguage(l2);
        }
        _this4.loadResources(l2, function(err) {
          done(err, l2);
        });
      };
      if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
        setLng(this.services.languageDetector.detect());
      } else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
        this.services.languageDetector.detect(setLng);
      } else {
        setLng(lng);
      }
      return deferred;
    }
  }, {
    key: "getFixedT",
    value: function getFixedT(lng, ns, keyPrefix) {
      var _this5 = this;
      var fixedT = function fixedT2(key, opts2) {
        var options;
        if (_typeof$1(opts2) !== "object") {
          for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
            rest[_key3 - 2] = arguments[_key3];
          }
          options = _this5.options.overloadTranslationOptionHandler([key, opts2].concat(rest));
        } else {
          options = _objectSpread$6$1({}, opts2);
        }
        options.lng = options.lng || fixedT2.lng;
        options.lngs = options.lngs || fixedT2.lngs;
        options.ns = options.ns || fixedT2.ns;
        options.keyPrefix = options.keyPrefix || keyPrefix || fixedT2.keyPrefix;
        var keySeparator = _this5.options.keySeparator || ".";
        var resultKey = options.keyPrefix ? "".concat(options.keyPrefix).concat(keySeparator).concat(key) : key;
        return _this5.t(resultKey, options);
      };
      if (typeof lng === "string") {
        fixedT.lng = lng;
      } else {
        fixedT.lngs = lng;
      }
      fixedT.ns = ns;
      fixedT.keyPrefix = keyPrefix;
      return fixedT;
    }
  }, {
    key: "t",
    value: function t2() {
      var _this$translator;
      return this.translator && (_this$translator = this.translator).translate.apply(_this$translator, arguments);
    }
  }, {
    key: "exists",
    value: function exists() {
      var _this$translator2;
      return this.translator && (_this$translator2 = this.translator).exists.apply(_this$translator2, arguments);
    }
  }, {
    key: "setDefaultNamespace",
    value: function setDefaultNamespace(ns) {
      this.options.defaultNS = ns;
    }
  }, {
    key: "hasLoadedNamespace",
    value: function hasLoadedNamespace2(ns) {
      var _this6 = this;
      var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
      if (!this.isInitialized) {
        this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages);
        return false;
      }
      if (!this.languages || !this.languages.length) {
        this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages);
        return false;
      }
      var lng = this.resolvedLanguage || this.languages[0];
      var fallbackLng = this.options ? this.options.fallbackLng : false;
      var lastLng = this.languages[this.languages.length - 1];
      if (lng.toLowerCase() === "cimode")
        return true;
      var loadNotPending = function loadNotPending2(l2, n2) {
        var loadState = _this6.services.backendConnector.state["".concat(l2, "|").concat(n2)];
        return loadState === -1 || loadState === 2;
      };
      if (options.precheck) {
        var preResult = options.precheck(this, loadNotPending);
        if (preResult !== void 0)
          return preResult;
      }
      if (this.hasResourceBundle(lng, ns))
        return true;
      if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages)
        return true;
      if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns)))
        return true;
      return false;
    }
  }, {
    key: "loadNamespaces",
    value: function loadNamespaces2(ns, callback2) {
      var _this7 = this;
      var deferred = defer();
      if (!this.options.ns) {
        callback2 && callback2();
        return Promise.resolve();
      }
      if (typeof ns === "string")
        ns = [ns];
      ns.forEach(function(n2) {
        if (_this7.options.ns.indexOf(n2) < 0)
          _this7.options.ns.push(n2);
      });
      this.loadResources(function(err) {
        deferred.resolve();
        if (callback2)
          callback2(err);
      });
      return deferred;
    }
  }, {
    key: "loadLanguages",
    value: function loadLanguages(lngs, callback2) {
      var deferred = defer();
      if (typeof lngs === "string")
        lngs = [lngs];
      var preloaded = this.options.preload || [];
      var newLngs = lngs.filter(function(lng) {
        return preloaded.indexOf(lng) < 0;
      });
      if (!newLngs.length) {
        if (callback2)
          callback2();
        return Promise.resolve();
      }
      this.options.preload = preloaded.concat(newLngs);
      this.loadResources(function(err) {
        deferred.resolve();
        if (callback2)
          callback2(err);
      });
      return deferred;
    }
  }, {
    key: "dir",
    value: function dir(lng) {
      if (!lng)
        lng = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language);
      if (!lng)
        return "rtl";
      var rtlLngs = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"];
      return rtlLngs.indexOf(this.services.languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
    }
  }, {
    key: "cloneInstance",
    value: function cloneInstance() {
      var _this8 = this;
      var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
      var callback2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$4;
      var mergedOptions = _objectSpread$6$1(_objectSpread$6$1(_objectSpread$6$1({}, this.options), options), {
        isClone: true
      });
      var clone3 = new I18n2(mergedOptions);
      if (options.debug !== void 0 || options.prefix !== void 0) {
        clone3.logger = clone3.logger.clone(options);
      }
      var membersToCopy = ["store", "services", "language"];
      membersToCopy.forEach(function(m2) {
        clone3[m2] = _this8[m2];
      });
      clone3.services = _objectSpread$6$1({}, this.services);
      clone3.services.utils = {
        hasLoadedNamespace: clone3.hasLoadedNamespace.bind(clone3)
      };
      clone3.translator = new Translator(clone3.services, clone3.options);
      clone3.translator.on("*", function(event) {
        for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
          args[_key4 - 1] = arguments[_key4];
        }
        clone3.emit.apply(clone3, [event].concat(args));
      });
      clone3.init(mergedOptions, callback2);
      clone3.translator.options = clone3.options;
      clone3.translator.backendConnector.services.utils = {
        hasLoadedNamespace: clone3.hasLoadedNamespace.bind(clone3)
      };
      return clone3;
    }
  }, {
    key: "toJSON",
    value: function toJSON3() {
      return {
        options: this.options,
        store: this.store,
        language: this.language,
        languages: this.languages,
        resolvedLanguage: this.resolvedLanguage
      };
    }
  }]);
  return I18n2;
}(EventEmitter);
_defineProperty$3(I18n, "createInstance", function() {
  var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
  var callback2 = arguments.length > 1 ? arguments[1] : void 0;
  return new I18n(options, callback2);
});
var instance = I18n.createInstance();
instance.createInstance = I18n.createInstance;
instance.createInstance;
instance.init;
instance.loadResources;
instance.reloadResources;
instance.use;
instance.changeLanguage;
instance.getFixedT;
instance.t;
instance.exists;
instance.setDefaultNamespace;
instance.hasLoadedNamespace;
instance.loadNamespaces;
instance.loadLanguages;
var uncPathRegex = function uncPathRegex2() {
  return /^[\\\/]{2,}[^\\\/]+[\\\/]+[^\\\/]+/;
};
var regex$1 = uncPathRegex();
var isUncPath = function(filepath) {
  if (typeof filepath !== "string") {
    throw new TypeError("expected a string");
  }
  return regex$1.test(filepath);
};
const isUncPath$1 = /* @__PURE__ */ getDefaultExportFromCjs(isUncPath);
var reactIs$1 = { exports: {} };
var reactIs_production_min = {};
/** @license React v16.13.1
 * react-is.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var b$1 = "function" === typeof Symbol && Symbol.for, c$3 = b$1 ? Symbol.for("react.element") : 60103, d$2 = b$1 ? Symbol.for("react.portal") : 60106, e$1 = b$1 ? Symbol.for("react.fragment") : 60107, f$3 = b$1 ? Symbol.for("react.strict_mode") : 60108, g$2 = b$1 ? Symbol.for("react.profiler") : 60114, h$2 = b$1 ? Symbol.for("react.provider") : 60109, k$3 = b$1 ? Symbol.for("react.context") : 60110, l$5 = b$1 ? Symbol.for("react.async_mode") : 60111, m$1 = b$1 ? Symbol.for("react.concurrent_mode") : 60111, n$3 = b$1 ? Symbol.for("react.forward_ref") : 60112, p$4 = b$1 ? Symbol.for("react.suspense") : 60113, q$1 = b$1 ? Symbol.for("react.suspense_list") : 60120, r$3 = b$1 ? Symbol.for("react.memo") : 60115, t$4 = b$1 ? Symbol.for("react.lazy") : 60116, v$2 = 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$2(a2) {
  if ("object" === typeof a2 && null !== a2) {
    var u2 = a2.$$typeof;
    switch (u2) {
      case c$3:
        switch (a2 = a2.type, a2) {
          case l$5:
          case m$1:
          case e$1:
          case g$2:
          case f$3:
          case p$4:
            return a2;
          default:
            switch (a2 = a2 && a2.$$typeof, a2) {
              case k$3:
              case n$3:
              case t$4:
              case r$3:
              case h$2:
                return a2;
              default:
                return u2;
            }
        }
      case d$2:
        return u2;
    }
  }
}
function A$3(a2) {
  return z$2(a2) === m$1;
}
reactIs_production_min.AsyncMode = l$5;
reactIs_production_min.ConcurrentMode = m$1;
reactIs_production_min.ContextConsumer = k$3;
reactIs_production_min.ContextProvider = h$2;
reactIs_production_min.Element = c$3;
reactIs_production_min.ForwardRef = n$3;
reactIs_production_min.Fragment = e$1;
reactIs_production_min.Lazy = t$4;
reactIs_production_min.Memo = r$3;
reactIs_production_min.Portal = d$2;
reactIs_production_min.Profiler = g$2;
reactIs_production_min.StrictMode = f$3;
reactIs_production_min.Suspense = p$4;
reactIs_production_min.isAsyncMode = function(a2) {
  return A$3(a2) || z$2(a2) === l$5;
};
reactIs_production_min.isConcurrentMode = A$3;
reactIs_production_min.isContextConsumer = function(a2) {
  return z$2(a2) === k$3;
};
reactIs_production_min.isContextProvider = function(a2) {
  return z$2(a2) === h$2;
};
reactIs_production_min.isElement = function(a2) {
  return "object" === typeof a2 && null !== a2 && a2.$$typeof === c$3;
};
reactIs_production_min.isForwardRef = function(a2) {
  return z$2(a2) === n$3;
};
reactIs_production_min.isFragment = function(a2) {
  return z$2(a2) === e$1;
};
reactIs_production_min.isLazy = function(a2) {
  return z$2(a2) === t$4;
};
reactIs_production_min.isMemo = function(a2) {
  return z$2(a2) === r$3;
};
reactIs_production_min.isPortal = function(a2) {
  return z$2(a2) === d$2;
};
reactIs_production_min.isProfiler = function(a2) {
  return z$2(a2) === g$2;
};
reactIs_production_min.isStrictMode = function(a2) {
  return z$2(a2) === f$3;
};
reactIs_production_min.isSuspense = function(a2) {
  return z$2(a2) === p$4;
};
reactIs_production_min.isValidElementType = function(a2) {
  return "string" === typeof a2 || "function" === typeof a2 || a2 === e$1 || a2 === m$1 || a2 === g$2 || a2 === f$3 || a2 === p$4 || a2 === q$1 || "object" === typeof a2 && null !== a2 && (a2.$$typeof === t$4 || a2.$$typeof === r$3 || a2.$$typeof === h$2 || a2.$$typeof === k$3 || a2.$$typeof === n$3 || a2.$$typeof === w$3 || a2.$$typeof === x$4 || a2.$$typeof === y$4 || a2.$$typeof === v$2);
};
reactIs_production_min.typeOf = z$2;
{
  reactIs$1.exports = reactIs_production_min;
}
var reactIsExports = reactIs$1.exports;
var reactIs = reactIsExports;
var FORWARD_REF_STATICS = {
  "$$typeof": true,
  render: true,
  defaultProps: true,
  displayName: true,
  propTypes: true
};
var MEMO_STATICS = {
  "$$typeof": true,
  compare: true,
  defaultProps: true,
  displayName: true,
  propTypes: true,
  type: true
};
var TYPE_STATICS = {};
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
var ansiStyles$1 = { exports: {} };
ansiStyles$1.exports;
(function(module2) {
  const wrapAnsi16 = (fn, offset2) => (...args) => {
    const code2 = fn(...args);
    return `\x1B[${code2 + offset2}m`;
  };
  const wrapAnsi256 = (fn, offset2) => (...args) => {
    const code2 = fn(...args);
    return `\x1B[${38 + offset2};5;${code2}m`;
  };
  const wrapAnsi16m = (fn, offset2) => (...args) => {
    const rgb = fn(...args);
    return `\x1B[${38 + offset2};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
  };
  const ansi2ansi = (n2) => n2;
  const rgb2rgb = (r2, g2, b2) => [r2, g2, b2];
  const setLazyProperty = (object4, property2, get5) => {
    Object.defineProperty(object4, property2, {
      get: () => {
        const value2 = get5();
        Object.defineProperty(object4, property2, {
          value: value2,
          enumerable: true,
          configurable: true
        });
        return value2;
      },
      enumerable: true,
      configurable: true
    });
  };
  let colorConvert2;
  const makeDynamicStyles = (wrap2, targetSpace, identity2, isBackground) => {
    if (colorConvert2 === void 0) {
      colorConvert2 = requireColorConvert();
    }
    const offset2 = isBackground ? 10 : 0;
    const styles2 = {};
    for (const [sourceSpace, suite] of Object.entries(colorConvert2)) {
      const name2 = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
      if (sourceSpace === targetSpace) {
        styles2[name2] = wrap2(identity2, offset2);
      } else if (typeof suite === "object") {
        styles2[name2] = wrap2(suite[targetSpace], offset2);
      }
    }
    return styles2;
  };
  function assembleStyles() {
    const codes = /* @__PURE__ */ new Map();
    const styles2 = {
      modifier: {
        reset: [0, 0],
        // 21 isn't widely supported and 22 does the same thing
        bold: [1, 22],
        dim: [2, 22],
        italic: [3, 23],
        underline: [4, 24],
        inverse: [7, 27],
        hidden: [8, 28],
        strikethrough: [9, 29]
      },
      color: {
        black: [30, 39],
        red: [31, 39],
        green: [32, 39],
        yellow: [33, 39],
        blue: [34, 39],
        magenta: [35, 39],
        cyan: [36, 39],
        white: [37, 39],
        // Bright color
        blackBright: [90, 39],
        redBright: [91, 39],
        greenBright: [92, 39],
        yellowBright: [93, 39],
        blueBright: [94, 39],
        magentaBright: [95, 39],
        cyanBright: [96, 39],
        whiteBright: [97, 39]
      },
      bgColor: {
        bgBlack: [40, 49],
        bgRed: [41, 49],
        bgGreen: [42, 49],
        bgYellow: [43, 49],
        bgBlue: [44, 49],
        bgMagenta: [45, 49],
        bgCyan: [46, 49],
        bgWhite: [47, 49],
        // Bright color
        bgBlackBright: [100, 49],
        bgRedBright: [101, 49],
        bgGreenBright: [102, 49],
        bgYellowBright: [103, 49],
        bgBlueBright: [104, 49],
        bgMagentaBright: [105, 49],
        bgCyanBright: [106, 49],
        bgWhiteBright: [107, 49]
      }
    };
    styles2.color.gray = styles2.color.blackBright;
    styles2.bgColor.bgGray = styles2.bgColor.bgBlackBright;
    styles2.color.grey = styles2.color.blackBright;
    styles2.bgColor.bgGrey = styles2.bgColor.bgBlackBright;
    for (const [groupName, group] of Object.entries(styles2)) {
      for (const [styleName, style2] of Object.entries(group)) {
        styles2[styleName] = {
          open: `\x1B[${style2[0]}m`,
          close: `\x1B[${style2[1]}m`
        };
        group[styleName] = styles2[styleName];
        codes.set(style2[0], style2[1]);
      }
      Object.defineProperty(styles2, groupName, {
        value: group,
        enumerable: false
      });
    }
    Object.defineProperty(styles2, "codes", {
      value: codes,
      enumerable: false
    });
    styles2.color.close = "\x1B[39m";
    styles2.bgColor.close = "\x1B[49m";
    setLazyProperty(styles2.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
    setLazyProperty(styles2.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
    setLazyProperty(styles2.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
    setLazyProperty(styles2.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
    setLazyProperty(styles2.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
    setLazyProperty(styles2.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
    return styles2;
  }
  Object.defineProperty(module2, "exports", {
    enumerable: true,
    get: assembleStyles
  });
})(ansiStyles$1);
var ansiStylesExports = ansiStyles$1.exports;
var browser$1 = {
  stdout: false,
  stderr: false
};
const stringReplaceAll$1 = (string3, substring, replacer) => {
  let index2 = string3.indexOf(substring);
  if (index2 === -1) {
    return string3;
  }
  const substringLength = substring.length;
  let endIndex = 0;
  let returnValue = "";
  do {
    returnValue += string3.substr(endIndex, index2 - endIndex) + substring + replacer;
    endIndex = index2 + substringLength;
    index2 = string3.indexOf(substring, endIndex);
  } while (index2 !== -1);
  returnValue += string3.substr(endIndex);
  return returnValue;
};
const stringEncaseCRLFWithFirstIndex$1 = (string3, prefix, postfix, index2) => {
  let endIndex = 0;
  let returnValue = "";
  do {
    const gotCR = string3[index2 - 1] === "\r";
    returnValue += string3.substr(endIndex, (gotCR ? index2 - 1 : index2) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
    endIndex = index2 + 1;
    index2 = string3.indexOf("\n", endIndex);
  } while (index2 !== -1);
  returnValue += string3.substr(endIndex);
  return returnValue;
};
var util = {
  stringReplaceAll: stringReplaceAll$1,
  stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1
};
var templates;
var hasRequiredTemplates;
function requireTemplates() {
  if (hasRequiredTemplates)
    return templates;
  hasRequiredTemplates = 1;
  const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
  const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
  const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
  const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
  const ESCAPES = /* @__PURE__ */ new Map([
    ["n", "\n"],
    ["r", "\r"],
    ["t", "	"],
    ["b", "\b"],
    ["f", "\f"],
    ["v", "\v"],
    ["0", "\0"],
    ["\\", "\\"],
    ["e", "\x1B"],
    ["a", "\x07"]
  ]);
  function unescape3(c2) {
    const u2 = c2[0] === "u";
    const bracket = c2[1] === "{";
    if (u2 && !bracket && c2.length === 5 || c2[0] === "x" && c2.length === 3) {
      return String.fromCharCode(parseInt(c2.slice(1), 16));
    }
    if (u2 && bracket) {
      return String.fromCodePoint(parseInt(c2.slice(2, -1), 16));
    }
    return ESCAPES.get(c2) || c2;
  }
  function parseArguments(name2, arguments_) {
    const results = [];
    const chunks = arguments_.trim().split(/\s*,\s*/g);
    let matches;
    for (const chunk of chunks) {
      const number4 = Number(chunk);
      if (!Number.isNaN(number4)) {
        results.push(number4);
      } else if (matches = chunk.match(STRING_REGEX)) {
        results.push(matches[2].replace(ESCAPE_REGEX, (m2, escape2, character2) => escape2 ? unescape3(escape2) : character2));
      } else {
        throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name2}')`);
      }
    }
    return results;
  }
  function parseStyle3(style2) {
    STYLE_REGEX.lastIndex = 0;
    const results = [];
    let matches;
    while ((matches = STYLE_REGEX.exec(style2)) !== null) {
      const name2 = matches[1];
      if (matches[2]) {
        const args = parseArguments(name2, matches[2]);
        results.push([name2].concat(args));
      } else {
        results.push([name2]);
      }
    }
    return results;
  }
  function buildStyle(chalk2, styles2) {
    const enabled = {};
    for (const layer2 of styles2) {
      for (const style2 of layer2.styles) {
        enabled[style2[0]] = layer2.inverse ? null : style2.slice(1);
      }
    }
    let current = chalk2;
    for (const [styleName, styles3] of Object.entries(enabled)) {
      if (!Array.isArray(styles3)) {
        continue;
      }
      if (!(styleName in current)) {
        throw new Error(`Unknown Chalk style: ${styleName}`);
      }
      current = styles3.length > 0 ? current[styleName](...styles3) : current[styleName];
    }
    return current;
  }
  templates = (chalk2, temporary) => {
    const styles2 = [];
    const chunks = [];
    let chunk = [];
    temporary.replace(TEMPLATE_REGEX, (m2, escapeCharacter, inverse, style2, close, character2) => {
      if (escapeCharacter) {
        chunk.push(unescape3(escapeCharacter));
      } else if (style2) {
        const string3 = chunk.join("");
        chunk = [];
        chunks.push(styles2.length === 0 ? string3 : buildStyle(chalk2, styles2)(string3));
        styles2.push({ inverse, styles: parseStyle3(style2) });
      } else if (close) {
        if (styles2.length === 0) {
          throw new Error("Found extraneous } in Chalk template literal");
        }
        chunks.push(buildStyle(chalk2, styles2)(chunk.join("")));
        chunk = [];
        styles2.pop();
      } else {
        chunk.push(character2);
      }
    });
    chunks.push(chunk.join(""));
    if (styles2.length > 0) {
      const errMessage = `Chalk template literal is missing ${styles2.length} closing bracket${styles2.length === 1 ? "" : "s"} (\`}\`)`;
      throw new Error(errMessage);
    }
    return chunks.join("");
  };
  return templates;
}
const ansiStyles = ansiStylesExports;
const { stdout: stdoutColor, stderr: stderrColor } = browser$1;
const {
  stringReplaceAll,
  stringEncaseCRLFWithFirstIndex
} = util;
const { isArray: isArray$5 } = Array;
const levelMapping = [
  "ansi",
  "ansi",
  "ansi256",
  "ansi16m"
];
const styles$6 = /* @__PURE__ */ Object.create(null);
const applyOptions = (object4, options = {}) => {
  if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
    throw new Error("The `level` option should be an integer from 0 to 3");
  }
  const colorLevel = stdoutColor ? stdoutColor.level : 0;
  object4.level = options.level === void 0 ? colorLevel : options.level;
};
class ChalkClass {
  constructor(options) {
    return chalkFactory(options);
  }
}
const chalkFactory = (options) => {
  const chalk2 = {};
  applyOptions(chalk2, options);
  chalk2.template = (...arguments_) => chalkTag(chalk2.template, ...arguments_);
  Object.setPrototypeOf(chalk2, Chalk.prototype);
  Object.setPrototypeOf(chalk2.template, chalk2);
  chalk2.template.constructor = () => {
    throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
  };
  chalk2.template.Instance = ChalkClass;
  return chalk2.template;
};
function Chalk(options) {
  return chalkFactory(options);
}
for (const [styleName, style2] of Object.entries(ansiStyles)) {
  styles$6[styleName] = {
    get() {
      const builder = createBuilder(this, createStyler(style2.open, style2.close, this._styler), this._isEmpty);
      Object.defineProperty(this, styleName, { value: builder });
      return builder;
    }
  };
}
styles$6.visible = {
  get() {
    const builder = createBuilder(this, this._styler, true);
    Object.defineProperty(this, "visible", { value: builder });
    return builder;
  }
};
const usedModels = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
for (const model of usedModels) {
  styles$6[model] = {
    get() {
      const { level } = this;
      return function(...arguments_) {
        const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
        return createBuilder(this, styler, this._isEmpty);
      };
    }
  };
}
for (const model of usedModels) {
  const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
  styles$6[bgModel] = {
    get() {
      const { level } = this;
      return function(...arguments_) {
        const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
        return createBuilder(this, styler, this._isEmpty);
      };
    }
  };
}
const proto$4 = Object.defineProperties(() => {
}, {
  ...styles$6,
  level: {
    enumerable: true,
    get() {
      return this._generator.level;
    },
    set(level) {
      this._generator.level = level;
    }
  }
});
const createStyler = (open, close, parent) => {
  let openAll;
  let closeAll;
  if (parent === void 0) {
    openAll = open;
    closeAll = close;
  } else {
    openAll = parent.openAll + open;
    closeAll = close + parent.closeAll;
  }
  return {
    open,
    close,
    openAll,
    closeAll,
    parent
  };
};
const createBuilder = (self2, _styler, _isEmpty) => {
  const builder = (...arguments_) => {
    if (isArray$5(arguments_[0]) && isArray$5(arguments_[0].raw)) {
      return applyStyle(builder, chalkTag(builder, ...arguments_));
    }
    return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
  };
  Object.setPrototypeOf(builder, proto$4);
  builder._generator = self2;
  builder._styler = _styler;
  builder._isEmpty = _isEmpty;
  return builder;
};
const applyStyle = (self2, string3) => {
  if (self2.level <= 0 || !string3) {
    return self2._isEmpty ? "" : string3;
  }
  let styler = self2._styler;
  if (styler === void 0) {
    return string3;
  }
  const { openAll, closeAll } = styler;
  if (string3.indexOf("\x1B") !== -1) {
    while (styler !== void 0) {
      string3 = stringReplaceAll(string3, styler.close, styler.open);
      styler = styler.parent;
    }
  }
  const lfIndex = string3.indexOf("\n");
  if (lfIndex !== -1) {
    string3 = stringEncaseCRLFWithFirstIndex(string3, closeAll, openAll, lfIndex);
  }
  return openAll + string3 + closeAll;
};
let template;
const chalkTag = (chalk2, ...strings) => {
  const [firstString] = strings;
  if (!isArray$5(firstString) || !isArray$5(firstString.raw)) {
    return strings.join(" ");
  }
  const arguments_ = strings.slice(1);
  const parts = [firstString.raw[0]];
  for (let i2 = 1; i2 < firstString.length; i2++) {
    parts.push(
      String(arguments_[i2 - 1]).replace(/[{}\\]/g, "\\$&"),
      String(firstString.raw[i2])
    );
  }
  if (template === void 0) {
    template = requireTemplates();
  }
  return template(chalk2, parts.join(""));
};
Object.defineProperties(Chalk.prototype, styles$6);
const chalk = Chalk();
chalk.supportsColor = stdoutColor;
chalk.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
chalk.stderr.supportsColor = stderrColor;
var source = chalk;
const chalk$1 = /* @__PURE__ */ getDefaultExportFromCjs(source);
var CategoryResourceDisplayNameSegmentType = /* @__PURE__ */ ((CategoryResourceDisplayNameSegmentType2) => {
  CategoryResourceDisplayNameSegmentType2[CategoryResourceDisplayNameSegmentType2["StaticText"] = 1] = "StaticText";
  CategoryResourceDisplayNameSegmentType2[CategoryResourceDisplayNameSegmentType2["Property"] = 2] = "Property";
  CategoryResourceDisplayNameSegmentType2[CategoryResourceDisplayNameSegmentType2["LeftWrapper"] = 3] = "LeftWrapper";
  CategoryResourceDisplayNameSegmentType2[CategoryResourceDisplayNameSegmentType2["RightWrapper"] = 4] = "RightWrapper";
  return CategoryResourceDisplayNameSegmentType2;
})(CategoryResourceDisplayNameSegmentType || {});
var BTaskStatus = /* @__PURE__ */ ((BTaskStatus2) => {
  BTaskStatus2[BTaskStatus2["NotStarted"] = 1] = "NotStarted";
  BTaskStatus2[BTaskStatus2["Running"] = 2] = "Running";
  BTaskStatus2[BTaskStatus2["Paused"] = 3] = "Paused";
  BTaskStatus2[BTaskStatus2["Error"] = 4] = "Error";
  BTaskStatus2[BTaskStatus2["Completed"] = 5] = "Completed";
  BTaskStatus2[BTaskStatus2["Cancelled"] = 6] = "Cancelled";
  return BTaskStatus2;
})(BTaskStatus || {});
var EnhancementRecordStatus = /* @__PURE__ */ ((EnhancementRecordStatus2) => {
  EnhancementRecordStatus2[EnhancementRecordStatus2["ContextCreated"] = 1] = "ContextCreated";
  EnhancementRecordStatus2[EnhancementRecordStatus2["ContextApplied"] = 2] = "ContextApplied";
  return EnhancementRecordStatus2;
})(EnhancementRecordStatus || {});
var InitializationContentType = /* @__PURE__ */ ((InitializationContentType2) => {
  InitializationContentType2[InitializationContentType2["NotAcceptTerms"] = 1] = "NotAcceptTerms";
  InitializationContentType2[InitializationContentType2["NeedRestart"] = 2] = "NeedRestart";
  return InitializationContentType2;
})(InitializationContentType || {});
var InternalProperty = /* @__PURE__ */ ((InternalProperty2) => {
  InternalProperty2[InternalProperty2["RootPath"] = 1] = "RootPath";
  InternalProperty2[InternalProperty2["ParentResource"] = 2] = "ParentResource";
  InternalProperty2[InternalProperty2["Resource"] = 3] = "Resource";
  InternalProperty2[InternalProperty2["Filename"] = 15] = "Filename";
  InternalProperty2[InternalProperty2["DirectoryPath"] = 16] = "DirectoryPath";
  InternalProperty2[InternalProperty2["CreatedAt"] = 17] = "CreatedAt";
  InternalProperty2[InternalProperty2["FileCreatedAt"] = 18] = "FileCreatedAt";
  InternalProperty2[InternalProperty2["FileModifiedAt"] = 19] = "FileModifiedAt";
  InternalProperty2[InternalProperty2["Category"] = 20] = "Category";
  InternalProperty2[InternalProperty2["MediaLibrary"] = 21] = "MediaLibrary";
  InternalProperty2[InternalProperty2["MediaLibraryV2"] = 24] = "MediaLibraryV2";
  return InternalProperty2;
})(InternalProperty || {});
var MediaLibraryV2AdditionalItem = /* @__PURE__ */ ((MediaLibraryV2AdditionalItem2) => {
  MediaLibraryV2AdditionalItem2[MediaLibraryV2AdditionalItem2["None"] = 0] = "None";
  MediaLibraryV2AdditionalItem2[MediaLibraryV2AdditionalItem2["Template"] = 1] = "Template";
  return MediaLibraryV2AdditionalItem2;
})(MediaLibraryV2AdditionalItem || {});
const pathFilterFsTypes = [
  {
    label: "File",
    value: 1
    /* File */
  },
  {
    label: "Directory",
    value: 2
    /* Directory */
  }
];
var PathPositioner = /* @__PURE__ */ ((PathPositioner2) => {
  PathPositioner2[PathPositioner2["Layer"] = 1] = "Layer";
  PathPositioner2[PathPositioner2["Regex"] = 2] = "Regex";
  return PathPositioner2;
})(PathPositioner || {});
const pathPositioners = [
  {
    label: "Layer",
    value: 1
    /* Layer */
  },
  {
    label: "Regex",
    value: 2
    /* Regex */
  }
];
var PathPropertyExtractorBasePathType = /* @__PURE__ */ ((PathPropertyExtractorBasePathType2) => {
  PathPropertyExtractorBasePathType2[PathPropertyExtractorBasePathType2["MediaLibrary"] = 1] = "MediaLibrary";
  PathPropertyExtractorBasePathType2[PathPropertyExtractorBasePathType2["Resource"] = 2] = "Resource";
  return PathPropertyExtractorBasePathType2;
})(PathPropertyExtractorBasePathType || {});
var PropertyPool = /* @__PURE__ */ ((PropertyPool2) => {
  PropertyPool2[PropertyPool2["Internal"] = 1] = "Internal";
  PropertyPool2[PropertyPool2["Reserved"] = 2] = "Reserved";
  PropertyPool2[PropertyPool2["Custom"] = 4] = "Custom";
  PropertyPool2[PropertyPool2["All"] = 7] = "All";
  return PropertyPool2;
})(PropertyPool || {});
var PropertyType = /* @__PURE__ */ ((PropertyType2) => {
  PropertyType2[PropertyType2["SingleLineText"] = 1] = "SingleLineText";
  PropertyType2[PropertyType2["MultilineText"] = 2] = "MultilineText";
  PropertyType2[PropertyType2["SingleChoice"] = 3] = "SingleChoice";
  PropertyType2[PropertyType2["MultipleChoice"] = 4] = "MultipleChoice";
  PropertyType2[PropertyType2["Number"] = 5] = "Number";
  PropertyType2[PropertyType2["Percentage"] = 6] = "Percentage";
  PropertyType2[PropertyType2["Rating"] = 7] = "Rating";
  PropertyType2[PropertyType2["Boolean"] = 8] = "Boolean";
  PropertyType2[PropertyType2["Link"] = 9] = "Link";
  PropertyType2[PropertyType2["Attachment"] = 10] = "Attachment";
  PropertyType2[PropertyType2["Date"] = 11] = "Date";
  PropertyType2[PropertyType2["DateTime"] = 12] = "DateTime";
  PropertyType2[PropertyType2["Time"] = 13] = "Time";
  PropertyType2[PropertyType2["Formula"] = 14] = "Formula";
  PropertyType2[PropertyType2["Multilevel"] = 15] = "Multilevel";
  PropertyType2[PropertyType2["Tags"] = 16] = "Tags";
  return PropertyType2;
})(PropertyType || {});
const propertyTypes = [
  {
    label: "SingleLineText",
    value: 1
    /* SingleLineText */
  },
  {
    label: "MultilineText",
    value: 2
    /* MultilineText */
  },
  {
    label: "SingleChoice",
    value: 3
    /* SingleChoice */
  },
  {
    label: "MultipleChoice",
    value: 4
    /* MultipleChoice */
  },
  {
    label: "Number",
    value: 5
    /* Number */
  },
  {
    label: "Percentage",
    value: 6
    /* Percentage */
  },
  {
    label: "Rating",
    value: 7
    /* Rating */
  },
  {
    label: "Boolean",
    value: 8
    /* Boolean */
  },
  {
    label: "Link",
    value: 9
    /* Link */
  },
  {
    label: "Attachment",
    value: 10
    /* Attachment */
  },
  {
    label: "Date",
    value: 11
    /* Date */
  },
  {
    label: "DateTime",
    value: 12
    /* DateTime */
  },
  {
    label: "Time",
    value: 13
    /* Time */
  },
  {
    label: "Formula",
    value: 14
    /* Formula */
  },
  {
    label: "Multilevel",
    value: 15
    /* Multilevel */
  },
  {
    label: "Tags",
    value: 16
    /* Tags */
  }
];
var PropertyValueScope = /* @__PURE__ */ ((PropertyValueScope2) => {
  PropertyValueScope2[PropertyValueScope2["Manual"] = 0] = "Manual";
  PropertyValueScope2[PropertyValueScope2["Synchronization"] = 1] = "Synchronization";
  PropertyValueScope2[PropertyValueScope2["BakabaseEnhancer"] = 1e3] = "BakabaseEnhancer";
  PropertyValueScope2[PropertyValueScope2["ExHentaiEnhancer"] = 1001] = "ExHentaiEnhancer";
  PropertyValueScope2[PropertyValueScope2["BangumiEnhancer"] = 1002] = "BangumiEnhancer";
  PropertyValueScope2[PropertyValueScope2["DLsiteEnhancer"] = 1003] = "DLsiteEnhancer";
  PropertyValueScope2[PropertyValueScope2["RegexEnhancer"] = 1004] = "RegexEnhancer";
  PropertyValueScope2[PropertyValueScope2["KodiEnhancer"] = 1005] = "KodiEnhancer";
  PropertyValueScope2[PropertyValueScope2["TmdbEnhancer"] = 1006] = "TmdbEnhancer";
  PropertyValueScope2[PropertyValueScope2["AvEnhancer"] = 1007] = "AvEnhancer";
  return PropertyValueScope2;
})(PropertyValueScope || {});
const propertyValueScopes = [
  {
    label: "Manual",
    value: 0
    /* Manual */
  },
  {
    label: "Synchronization",
    value: 1
    /* Synchronization */
  },
  {
    label: "BakabaseEnhancer",
    value: 1e3
    /* BakabaseEnhancer */
  },
  {
    label: "ExHentaiEnhancer",
    value: 1001
    /* ExHentaiEnhancer */
  },
  {
    label: "BangumiEnhancer",
    value: 1002
    /* BangumiEnhancer */
  },
  {
    label: "DLsiteEnhancer",
    value: 1003
    /* DLsiteEnhancer */
  },
  {
    label: "RegexEnhancer",
    value: 1004
    /* RegexEnhancer */
  },
  {
    label: "KodiEnhancer",
    value: 1005
    /* KodiEnhancer */
  },
  {
    label: "TmdbEnhancer",
    value: 1006
    /* TmdbEnhancer */
  },
  {
    label: "AvEnhancer",
    value: 1007
    /* AvEnhancer */
  }
];
var ReservedProperty = /* @__PURE__ */ ((ReservedProperty2) => {
  ReservedProperty2[ReservedProperty2["Introduction"] = 12] = "Introduction";
  ReservedProperty2[ReservedProperty2["Rating"] = 13] = "Rating";
  ReservedProperty2[ReservedProperty2["Cover"] = 22] = "Cover";
  return ReservedProperty2;
})(ReservedProperty || {});
var ResourceCacheType = /* @__PURE__ */ ((ResourceCacheType2) => {
  ResourceCacheType2[ResourceCacheType2["Covers"] = 1] = "Covers";
  ResourceCacheType2[ResourceCacheType2["PlayableFiles"] = 2] = "PlayableFiles";
  ResourceCacheType2[ResourceCacheType2["ResourceMarkers"] = 4] = "ResourceMarkers";
  return ResourceCacheType2;
})(ResourceCacheType || {});
var ResourceTag = /* @__PURE__ */ ((ResourceTag2) => {
  ResourceTag2[ResourceTag2["IsParent"] = 1] = "IsParent";
  ResourceTag2[ResourceTag2["Pinned"] = 2] = "Pinned";
  ResourceTag2[ResourceTag2["PathDoesNotExist"] = 4] = "PathDoesNotExist";
  ResourceTag2[ResourceTag2["UnknownMediaLibrary"] = 8] = "UnknownMediaLibrary";
  return ResourceTag2;
})(ResourceTag || {});
const resourceTags = [
  {
    label: "IsParent",
    value: 1
    /* IsParent */
  },
  {
    label: "Pinned",
    value: 2
    /* Pinned */
  },
  {
    label: "PathDoesNotExist",
    value: 4
    /* PathDoesNotExist */
  },
  {
    label: "UnknownMediaLibrary",
    value: 8
    /* UnknownMediaLibrary */
  }
];
var SearchCombinator = /* @__PURE__ */ ((SearchCombinator2) => {
  SearchCombinator2[SearchCombinator2["And"] = 1] = "And";
  SearchCombinator2[SearchCombinator2["Or"] = 2] = "Or";
  return SearchCombinator2;
})(SearchCombinator || {});
var SearchOperation = /* @__PURE__ */ ((SearchOperation2) => {
  SearchOperation2[SearchOperation2["Equals"] = 1] = "Equals";
  SearchOperation2[SearchOperation2["NotEquals"] = 2] = "NotEquals";
  SearchOperation2[SearchOperation2["Contains"] = 3] = "Contains";
  SearchOperation2[SearchOperation2["NotContains"] = 4] = "NotContains";
  SearchOperation2[SearchOperation2["StartsWith"] = 5] = "StartsWith";
  SearchOperation2[SearchOperation2["NotStartsWith"] = 6] = "NotStartsWith";
  SearchOperation2[SearchOperation2["EndsWith"] = 7] = "EndsWith";
  SearchOperation2[SearchOperation2["NotEndsWith"] = 8] = "NotEndsWith";
  SearchOperation2[SearchOperation2["GreaterThan"] = 9] = "GreaterThan";
  SearchOperation2[SearchOperation2["LessThan"] = 10] = "LessThan";
  SearchOperation2[SearchOperation2["GreaterThanOrEquals"] = 11] = "GreaterThanOrEquals";
  SearchOperation2[SearchOperation2["LessThanOrEquals"] = 12] = "LessThanOrEquals";
  SearchOperation2[SearchOperation2["IsNull"] = 13] = "IsNull";
  SearchOperation2[SearchOperation2["IsNotNull"] = 14] = "IsNotNull";
  SearchOperation2[SearchOperation2["In"] = 15] = "In";
  SearchOperation2[SearchOperation2["NotIn"] = 16] = "NotIn";
  SearchOperation2[SearchOperation2["Matches"] = 17] = "Matches";
  SearchOperation2[SearchOperation2["NotMatches"] = 18] = "NotMatches";
  return SearchOperation2;
})(SearchOperation || {});
var SpecialTextType = /* @__PURE__ */ ((SpecialTextType2) => {
  SpecialTextType2[SpecialTextType2["Useless"] = 1] = "Useless";
  SpecialTextType2[SpecialTextType2["Wrapper"] = 3] = "Wrapper";
  SpecialTextType2[SpecialTextType2["Standardization"] = 4] = "Standardization";
  SpecialTextType2[SpecialTextType2["Volume"] = 6] = "Volume";
  SpecialTextType2[SpecialTextType2["Trim"] = 7] = "Trim";
  SpecialTextType2[SpecialTextType2["DateTime"] = 8] = "DateTime";
  SpecialTextType2[SpecialTextType2["Language"] = 9] = "Language";
  return SpecialTextType2;
})(SpecialTextType || {});
const specialTextTypes = [
  {
    label: "Useless",
    value: 1
    /* Useless */
  },
  {
    label: "Wrapper",
    value: 3
    /* Wrapper */
  },
  {
    label: "Standardization",
    value: 4
    /* Standardization */
  },
  {
    label: "Volume",
    value: 6
    /* Volume */
  },
  {
    label: "Trim",
    value: 7
    /* Trim */
  },
  {
    label: "DateTime",
    value: 8
    /* DateTime */
  },
  {
    label: "Language",
    value: 9
    /* Language */
  }
];
var StandardValueType = /* @__PURE__ */ ((StandardValueType2) => {
  StandardValueType2[StandardValueType2["String"] = 1] = "String";
  StandardValueType2[StandardValueType2["ListString"] = 2] = "ListString";
  StandardValueType2[StandardValueType2["Decimal"] = 3] = "Decimal";
  StandardValueType2[StandardValueType2["Link"] = 4] = "Link";
  StandardValueType2[StandardValueType2["Boolean"] = 5] = "Boolean";
  StandardValueType2[StandardValueType2["DateTime"] = 6] = "DateTime";
  StandardValueType2[StandardValueType2["Time"] = 7] = "Time";
  StandardValueType2[StandardValueType2["ListListString"] = 8] = "ListListString";
  StandardValueType2[StandardValueType2["ListTag"] = 9] = "ListTag";
  return StandardValueType2;
})(StandardValueType || {});
var TextProcessingOperation = /* @__PURE__ */ ((TextProcessingOperation2) => {
  TextProcessingOperation2[TextProcessingOperation2["Delete"] = 1] = "Delete";
  TextProcessingOperation2[TextProcessingOperation2["SetWithFixedValue"] = 2] = "SetWithFixedValue";
  TextProcessingOperation2[TextProcessingOperation2["AddToStart"] = 3] = "AddToStart";
  TextProcessingOperation2[TextProcessingOperation2["AddToEnd"] = 4] = "AddToEnd";
  TextProcessingOperation2[TextProcessingOperation2["AddToAnyPosition"] = 5] = "AddToAnyPosition";
  TextProcessingOperation2[TextProcessingOperation2["RemoveFromStart"] = 6] = "RemoveFromStart";
  TextProcessingOperation2[TextProcessingOperation2["RemoveFromEnd"] = 7] = "RemoveFromEnd";
  TextProcessingOperation2[TextProcessingOperation2["RemoveFromAnyPosition"] = 8] = "RemoveFromAnyPosition";
  TextProcessingOperation2[TextProcessingOperation2["ReplaceFromStart"] = 9] = "ReplaceFromStart";
  TextProcessingOperation2[TextProcessingOperation2["ReplaceFromEnd"] = 10] = "ReplaceFromEnd";
  TextProcessingOperation2[TextProcessingOperation2["ReplaceFromAnyPosition"] = 11] = "ReplaceFromAnyPosition";
  TextProcessingOperation2[TextProcessingOperation2["ReplaceWithRegex"] = 12] = "ReplaceWithRegex";
  return TextProcessingOperation2;
})(TextProcessingOperation || {});
var BTaskResourceType = /* @__PURE__ */ ((BTaskResourceType2) => {
  BTaskResourceType2[BTaskResourceType2["FileSystemEntry"] = 1] = "FileSystemEntry";
  BTaskResourceType2[BTaskResourceType2["Resource"] = 2] = "Resource";
  BTaskResourceType2[BTaskResourceType2["Any"] = 1e3] = "Any";
  return BTaskResourceType2;
})(BTaskResourceType || {});
var BackgroundTaskStatus = /* @__PURE__ */ ((BackgroundTaskStatus2) => {
  BackgroundTaskStatus2[BackgroundTaskStatus2["Running"] = 1] = "Running";
  BackgroundTaskStatus2[BackgroundTaskStatus2["Complete"] = 2] = "Complete";
  BackgroundTaskStatus2[BackgroundTaskStatus2["Failed"] = 3] = "Failed";
  return BackgroundTaskStatus2;
})(BackgroundTaskStatus || {});
var ComponentDescriptorType = /* @__PURE__ */ ((ComponentDescriptorType2) => {
  ComponentDescriptorType2[ComponentDescriptorType2["Invalid"] = 0] = "Invalid";
  ComponentDescriptorType2[ComponentDescriptorType2["Fixed"] = 1] = "Fixed";
  ComponentDescriptorType2[ComponentDescriptorType2["Configurable"] = 2] = "Configurable";
  ComponentDescriptorType2[ComponentDescriptorType2["Instance"] = 3] = "Instance";
  return ComponentDescriptorType2;
})(ComponentDescriptorType || {});
var ComponentType = /* @__PURE__ */ ((ComponentType2) => {
  ComponentType2[ComponentType2["Enhancer"] = 1] = "Enhancer";
  ComponentType2[ComponentType2["PlayableFileSelector"] = 2] = "PlayableFileSelector";
  ComponentType2[ComponentType2["Player"] = 3] = "Player";
  return ComponentType2;
})(ComponentType || {});
const componentTypes = [
  {
    label: "Enhancer",
    value: 1
    /* Enhancer */
  },
  {
    label: "PlayableFileSelector",
    value: 2
    /* PlayableFileSelector */
  },
  {
    label: "Player",
    value: 3
    /* Player */
  }
];
var CookieValidatorTarget = /* @__PURE__ */ ((CookieValidatorTarget2) => {
  CookieValidatorTarget2[CookieValidatorTarget2["BiliBili"] = 1] = "BiliBili";
  CookieValidatorTarget2[CookieValidatorTarget2["ExHentai"] = 2] = "ExHentai";
  CookieValidatorTarget2[CookieValidatorTarget2["Pixiv"] = 3] = "Pixiv";
  return CookieValidatorTarget2;
})(CookieValidatorTarget || {});
var CoverFit = /* @__PURE__ */ ((CoverFit2) => {
  CoverFit2[CoverFit2["Contain"] = 1] = "Contain";
  CoverFit2[CoverFit2["Cover"] = 2] = "Cover";
  return CoverFit2;
})(CoverFit || {});
var CoverSaveMode = /* @__PURE__ */ ((CoverSaveMode2) => {
  CoverSaveMode2[CoverSaveMode2["Replace"] = 1] = "Replace";
  CoverSaveMode2[CoverSaveMode2["Prepend"] = 2] = "Prepend";
  return CoverSaveMode2;
})(CoverSaveMode || {});
const coverSaveModes = [
  {
    label: "Replace",
    value: 1
    /* Replace */
  },
  {
    label: "Prepend",
    value: 2
    /* Prepend */
  }
];
var CoverSelectOrder$2 = /* @__PURE__ */ ((CoverSelectOrder2) => {
  CoverSelectOrder2[CoverSelectOrder2["FilenameAscending"] = 1] = "FilenameAscending";
  CoverSelectOrder2[CoverSelectOrder2["FileModifyDtDescending"] = 2] = "FileModifyDtDescending";
  return CoverSelectOrder2;
})(CoverSelectOrder$2 || {});
const coverSelectOrders = [
  {
    label: "FilenameAscending",
    value: 1
    /* FilenameAscending */
  },
  {
    label: "FileModifyDtDescending",
    value: 2
    /* FileModifyDtDescending */
  }
];
var MatchResultType = /* @__PURE__ */ ((MatchResultType2) => {
  MatchResultType2[MatchResultType2["Layer"] = 1] = "Layer";
  MatchResultType2[MatchResultType2["Regex"] = 2] = "Regex";
  return MatchResultType2;
})(MatchResultType || {});
var MediaType = /* @__PURE__ */ ((MediaType2) => {
  MediaType2[MediaType2["Image"] = 1] = "Image";
  MediaType2[MediaType2["Audio"] = 2] = "Audio";
  MediaType2[MediaType2["Video"] = 3] = "Video";
  MediaType2[MediaType2["Text"] = 4] = "Text";
  MediaType2[MediaType2["Application"] = 5] = "Application";
  MediaType2[MediaType2["Unknown"] = 1e3] = "Unknown";
  return MediaType2;
})(MediaType || {});
var PlaylistItemType = /* @__PURE__ */ ((PlaylistItemType2) => {
  PlaylistItemType2[PlaylistItemType2["Resource"] = 1] = "Resource";
  PlaylistItemType2[PlaylistItemType2["Video"] = 2] = "Video";
  PlaylistItemType2[PlaylistItemType2["Image"] = 3] = "Image";
  PlaylistItemType2[PlaylistItemType2["Audio"] = 4] = "Audio";
  return PlaylistItemType2;
})(PlaylistItemType || {});
const reservedResourceFileTypes = [
  {
    label: "Cover",
    value: 1
    /* Cover */
  }
];
var ResourceMatcherValueType = /* @__PURE__ */ ((ResourceMatcherValueType2) => {
  ResourceMatcherValueType2[ResourceMatcherValueType2["Layer"] = 1] = "Layer";
  ResourceMatcherValueType2[ResourceMatcherValueType2["Regex"] = 2] = "Regex";
  ResourceMatcherValueType2[ResourceMatcherValueType2["FixedText"] = 3] = "FixedText";
  return ResourceMatcherValueType2;
})(ResourceMatcherValueType || {});
var ResourceProperty = /* @__PURE__ */ ((ResourceProperty2) => {
  ResourceProperty2[ResourceProperty2["RootPath"] = 1] = "RootPath";
  ResourceProperty2[ResourceProperty2["ParentResource"] = 2] = "ParentResource";
  ResourceProperty2[ResourceProperty2["Resource"] = 3] = "Resource";
  ResourceProperty2[ResourceProperty2["Introduction"] = 12] = "Introduction";
  ResourceProperty2[ResourceProperty2["Rating"] = 13] = "Rating";
  ResourceProperty2[ResourceProperty2["CustomProperty"] = 14] = "CustomProperty";
  ResourceProperty2[ResourceProperty2["Filename"] = 15] = "Filename";
  ResourceProperty2[ResourceProperty2["DirectoryPath"] = 16] = "DirectoryPath";
  ResourceProperty2[ResourceProperty2["CreatedAt"] = 17] = "CreatedAt";
  ResourceProperty2[ResourceProperty2["FileCreatedAt"] = 18] = "FileCreatedAt";
  ResourceProperty2[ResourceProperty2["FileModifiedAt"] = 19] = "FileModifiedAt";
  ResourceProperty2[ResourceProperty2["Category"] = 20] = "Category";
  ResourceProperty2[ResourceProperty2["MediaLibrary"] = 21] = "MediaLibrary";
  ResourceProperty2[ResourceProperty2["Cover"] = 22] = "Cover";
  ResourceProperty2[ResourceProperty2["PlayedAt"] = 23] = "PlayedAt";
  ResourceProperty2[ResourceProperty2["MediaLibraryV2"] = 24] = "MediaLibraryV2";
  return ResourceProperty2;
})(ResourceProperty || {});
const startupPages = [
  {
    label: "Default",
    value: 0
    /* Default */
  },
  {
    label: "Resource",
    value: 1
    /* Resource */
  }
];
var ThirdPartyId = /* @__PURE__ */ ((ThirdPartyId2) => {
  ThirdPartyId2[ThirdPartyId2["Bilibili"] = 1] = "Bilibili";
  ThirdPartyId2[ThirdPartyId2["ExHentai"] = 2] = "ExHentai";
  ThirdPartyId2[ThirdPartyId2["Pixiv"] = 3] = "Pixiv";
  ThirdPartyId2[ThirdPartyId2["Bangumi"] = 4] = "Bangumi";
  ThirdPartyId2[ThirdPartyId2["SoulPlus"] = 5] = "SoulPlus";
  ThirdPartyId2[ThirdPartyId2["DLsite"] = 6] = "DLsite";
  ThirdPartyId2[ThirdPartyId2["Fanbox"] = 7] = "Fanbox";
  ThirdPartyId2[ThirdPartyId2["Fantia"] = 8] = "Fantia";
  ThirdPartyId2[ThirdPartyId2["Cien"] = 9] = "Cien";
  ThirdPartyId2[ThirdPartyId2["Patreon"] = 10] = "Patreon";
  ThirdPartyId2[ThirdPartyId2["Tmdb"] = 11] = "Tmdb";
  return ThirdPartyId2;
})(ThirdPartyId || {});
var PasswordSearchOrder = /* @__PURE__ */ ((PasswordSearchOrder2) => {
  PasswordSearchOrder2[PasswordSearchOrder2["Latest"] = 1] = "Latest";
  PasswordSearchOrder2[PasswordSearchOrder2["Frequency"] = 2] = "Frequency";
  return PasswordSearchOrder2;
})(PasswordSearchOrder || {});
const resourceSearchSortableProperties = [
  {
    label: "FileCreateDt",
    value: 1
    /* FileCreateDt */
  },
  {
    label: "FileModifyDt",
    value: 2
    /* FileModifyDt */
  },
  {
    label: "Filename",
    value: 3
    /* Filename */
  },
  {
    label: "AddDt",
    value: 6
    /* AddDt */
  },
  {
    label: "PlayedAt",
    value: 11
    /* PlayedAt */
  }
];
var AliasAdditionalItem = /* @__PURE__ */ ((AliasAdditionalItem2) => {
  AliasAdditionalItem2[AliasAdditionalItem2["Candidates"] = 1] = "Candidates";
  return AliasAdditionalItem2;
})(AliasAdditionalItem || {});
var CategoryAdditionalItem = /* @__PURE__ */ ((CategoryAdditionalItem2) => {
  CategoryAdditionalItem2[CategoryAdditionalItem2["None"] = 0] = "None";
  CategoryAdditionalItem2[CategoryAdditionalItem2["Components"] = 1] = "Components";
  CategoryAdditionalItem2[CategoryAdditionalItem2["Validation"] = 3] = "Validation";
  CategoryAdditionalItem2[CategoryAdditionalItem2["CustomProperties"] = 4] = "CustomProperties";
  CategoryAdditionalItem2[CategoryAdditionalItem2["EnhancerOptions"] = 8] = "EnhancerOptions";
  return CategoryAdditionalItem2;
})(CategoryAdditionalItem || {});
var ComponentDescriptorAdditionalItem = /* @__PURE__ */ ((ComponentDescriptorAdditionalItem2) => {
  ComponentDescriptorAdditionalItem2[ComponentDescriptorAdditionalItem2["None"] = 0] = "None";
  ComponentDescriptorAdditionalItem2[ComponentDescriptorAdditionalItem2["AssociatedCategories"] = 1] = "AssociatedCategories";
  return ComponentDescriptorAdditionalItem2;
})(ComponentDescriptorAdditionalItem || {});
var CustomPropertyAdditionalItem = /* @__PURE__ */ ((CustomPropertyAdditionalItem2) => {
  CustomPropertyAdditionalItem2[CustomPropertyAdditionalItem2["None"] = 0] = "None";
  CustomPropertyAdditionalItem2[CustomPropertyAdditionalItem2["Category"] = 1] = "Category";
  CustomPropertyAdditionalItem2[CustomPropertyAdditionalItem2["ValueCount"] = 2] = "ValueCount";
  return CustomPropertyAdditionalItem2;
})(CustomPropertyAdditionalItem || {});
var MediaLibraryAdditionalItem = /* @__PURE__ */ ((MediaLibraryAdditionalItem2) => {
  MediaLibraryAdditionalItem2[MediaLibraryAdditionalItem2["None"] = 0] = "None";
  MediaLibraryAdditionalItem2[MediaLibraryAdditionalItem2["Category"] = 1] = "Category";
  MediaLibraryAdditionalItem2[MediaLibraryAdditionalItem2["FileSystemInfo"] = 2] = "FileSystemInfo";
  MediaLibraryAdditionalItem2[MediaLibraryAdditionalItem2["PathConfigurationBoundProperties"] = 4] = "PathConfigurationBoundProperties";
  return MediaLibraryAdditionalItem2;
})(MediaLibraryAdditionalItem || {});
var ResourceAdditionalItem = /* @__PURE__ */ ((ResourceAdditionalItem2) => {
  ResourceAdditionalItem2[ResourceAdditionalItem2["None"] = 0] = "None";
  ResourceAdditionalItem2[ResourceAdditionalItem2["Alias"] = 64] = "Alias";
  ResourceAdditionalItem2[ResourceAdditionalItem2["Category"] = 128] = "Category";
  ResourceAdditionalItem2[ResourceAdditionalItem2["Properties"] = 160] = "Properties";
  ResourceAdditionalItem2[ResourceAdditionalItem2["DisplayName"] = 416] = "DisplayName";
  ResourceAdditionalItem2[ResourceAdditionalItem2["HasChildren"] = 512] = "HasChildren";
  ResourceAdditionalItem2[ResourceAdditionalItem2["MediaLibraryName"] = 2048] = "MediaLibraryName";
  ResourceAdditionalItem2[ResourceAdditionalItem2["Cache"] = 4096] = "Cache";
  ResourceAdditionalItem2[ResourceAdditionalItem2["All"] = 7136] = "All";
  return ResourceAdditionalItem2;
})(ResourceAdditionalItem || {});
var ResponseCode = /* @__PURE__ */ ((ResponseCode2) => {
  ResponseCode2[ResponseCode2["Success"] = 0] = "Success";
  ResponseCode2[ResponseCode2["NotModified"] = 304] = "NotModified";
  ResponseCode2[ResponseCode2["InvalidPayloadOrOperation"] = 400] = "InvalidPayloadOrOperation";
  ResponseCode2[ResponseCode2["Unauthenticated"] = 401] = "Unauthenticated";
  ResponseCode2[ResponseCode2["Unauthorized"] = 403] = "Unauthorized";
  ResponseCode2[ResponseCode2["NotFound"] = 404] = "NotFound";
  ResponseCode2[ResponseCode2["Conflict"] = 409] = "Conflict";
  ResponseCode2[ResponseCode2["SystemError"] = 500] = "SystemError";
  ResponseCode2[ResponseCode2["Timeout"] = 504] = "Timeout";
  ResponseCode2[ResponseCode2["InvalidCaptcha"] = 100400] = "InvalidCaptcha";
  return ResponseCode2;
})(ResponseCode || {});
var RuntimeMode = /* @__PURE__ */ ((RuntimeMode2) => {
  RuntimeMode2[RuntimeMode2["Dev"] = 0] = "Dev";
  RuntimeMode2[RuntimeMode2["WinForms"] = 1] = "WinForms";
  RuntimeMode2[RuntimeMode2["Docker"] = 2] = "Docker";
  return RuntimeMode2;
})(RuntimeMode || {});
var EnhancerId = /* @__PURE__ */ ((EnhancerId2) => {
  EnhancerId2[EnhancerId2["Bakabase"] = 1] = "Bakabase";
  EnhancerId2[EnhancerId2["ExHentai"] = 2] = "ExHentai";
  EnhancerId2[EnhancerId2["Bangumi"] = 3] = "Bangumi";
  EnhancerId2[EnhancerId2["DLsite"] = 4] = "DLsite";
  EnhancerId2[EnhancerId2["Regex"] = 5] = "Regex";
  EnhancerId2[EnhancerId2["Kodi"] = 6] = "Kodi";
  EnhancerId2[EnhancerId2["Tmdb"] = 7] = "Tmdb";
  EnhancerId2[EnhancerId2["Av"] = 8] = "Av";
  return EnhancerId2;
})(EnhancerId || {});
const enhancerIds = [
  {
    label: "Bakabase",
    value: 1
    /* Bakabase */
  },
  {
    label: "ExHentai",
    value: 2
    /* ExHentai */
  },
  {
    label: "Bangumi",
    value: 3
    /* Bangumi */
  },
  {
    label: "DLsite",
    value: 4
    /* DLsite */
  },
  {
    label: "Regex",
    value: 5
    /* Regex */
  },
  {
    label: "Kodi",
    value: 6
    /* Kodi */
  },
  {
    label: "Tmdb",
    value: 7
    /* Tmdb */
  },
  {
    label: "Av",
    value: 8
    /* Av */
  }
];
var EnhancerTag = /* @__PURE__ */ ((EnhancerTag2) => {
  EnhancerTag2[EnhancerTag2["UseRegex"] = 1] = "UseRegex";
  EnhancerTag2[EnhancerTag2["UseKeyword"] = 2] = "UseKeyword";
  return EnhancerTag2;
})(EnhancerTag || {});
var RegexEnhancerTarget = /* @__PURE__ */ ((RegexEnhancerTarget2) => {
  RegexEnhancerTarget2[RegexEnhancerTarget2["CaptureGroups"] = 0] = "CaptureGroups";
  return RegexEnhancerTarget2;
})(RegexEnhancerTarget || {});
var EnhancementAdditionalItem = /* @__PURE__ */ ((EnhancementAdditionalItem2) => {
  EnhancementAdditionalItem2[EnhancementAdditionalItem2["None"] = 0] = "None";
  EnhancementAdditionalItem2[EnhancementAdditionalItem2["GeneratedPropertyValue"] = 1] = "GeneratedPropertyValue";
  return EnhancementAdditionalItem2;
})(EnhancementAdditionalItem || {});
var EnhancerTargetOptionsItem = /* @__PURE__ */ ((EnhancerTargetOptionsItem2) => {
  EnhancerTargetOptionsItem2[EnhancerTargetOptionsItem2["AutoBindProperty"] = 1] = "AutoBindProperty";
  EnhancerTargetOptionsItem2[EnhancerTargetOptionsItem2["AutoMatchMultilevelString"] = 2] = "AutoMatchMultilevelString";
  EnhancerTargetOptionsItem2[EnhancerTargetOptionsItem2["CoverSelectOrder"] = 3] = "CoverSelectOrder";
  return EnhancerTargetOptionsItem2;
})(EnhancerTargetOptionsItem || {});
const builtinPropertyForDisplayNames = [
  {
    label: "Filename",
    value: 15
    /* Filename */
  }
];
var TampermonkeyScript = /* @__PURE__ */ ((TampermonkeyScript2) => {
  TampermonkeyScript2[TampermonkeyScript2["SoulPlus"] = 1] = "SoulPlus";
  TampermonkeyScript2[TampermonkeyScript2["ExHentai"] = 2] = "ExHentai";
  return TampermonkeyScript2;
})(TampermonkeyScript || {});
var PostParserSource = /* @__PURE__ */ ((PostParserSource2) => {
  PostParserSource2[PostParserSource2["SoulPlus"] = 5] = "SoulPlus";
  return PostParserSource2;
})(PostParserSource || {});
const postParserSources = [
  {
    label: "SoulPlus",
    value: 5
    /* SoulPlus */
  }
];
var FileNameModifierCaseType = /* @__PURE__ */ ((FileNameModifierCaseType2) => {
  FileNameModifierCaseType2[FileNameModifierCaseType2["TitleCase"] = 1] = "TitleCase";
  FileNameModifierCaseType2[FileNameModifierCaseType2["UpperCase"] = 2] = "UpperCase";
  FileNameModifierCaseType2[FileNameModifierCaseType2["LowerCase"] = 3] = "LowerCase";
  FileNameModifierCaseType2[FileNameModifierCaseType2["CamelCase"] = 4] = "CamelCase";
  FileNameModifierCaseType2[FileNameModifierCaseType2["PascalCase"] = 5] = "PascalCase";
  return FileNameModifierCaseType2;
})(FileNameModifierCaseType || {});
const fileNameModifierCaseTypes = [
  {
    label: "TitleCase",
    value: 1
    /* TitleCase */
  },
  {
    label: "UpperCase",
    value: 2
    /* UpperCase */
  },
  {
    label: "LowerCase",
    value: 3
    /* LowerCase */
  },
  {
    label: "CamelCase",
    value: 4
    /* CamelCase */
  },
  {
    label: "PascalCase",
    value: 5
    /* PascalCase */
  }
];
var FileNameModifierFileNameTarget = /* @__PURE__ */ ((FileNameModifierFileNameTarget2) => {
  FileNameModifierFileNameTarget2[FileNameModifierFileNameTarget2["FileName"] = 1] = "FileName";
  FileNameModifierFileNameTarget2[FileNameModifierFileNameTarget2["FileNameWithoutExtension"] = 2] = "FileNameWithoutExtension";
  FileNameModifierFileNameTarget2[FileNameModifierFileNameTarget2["Extension"] = 3] = "Extension";
  FileNameModifierFileNameTarget2[FileNameModifierFileNameTarget2["ExtensionWithoutDot"] = 4] = "ExtensionWithoutDot";
  return FileNameModifierFileNameTarget2;
})(FileNameModifierFileNameTarget || {});
const fileNameModifierFileNameTargets = [
  {
    label: "FileName",
    value: 1
    /* FileName */
  },
  {
    label: "FileNameWithoutExtension",
    value: 2
    /* FileNameWithoutExtension */
  },
  {
    label: "Extension",
    value: 3
    /* Extension */
  },
  {
    label: "ExtensionWithoutDot",
    value: 4
    /* ExtensionWithoutDot */
  }
];
var FileNameModifierOperationType = /* @__PURE__ */ ((FileNameModifierOperationType2) => {
  FileNameModifierOperationType2[FileNameModifierOperationType2["Insert"] = 1] = "Insert";
  FileNameModifierOperationType2[FileNameModifierOperationType2["AddDateTime"] = 2] = "AddDateTime";
  FileNameModifierOperationType2[FileNameModifierOperationType2["Delete"] = 3] = "Delete";
  FileNameModifierOperationType2[FileNameModifierOperationType2["Replace"] = 4] = "Replace";
  FileNameModifierOperationType2[FileNameModifierOperationType2["ChangeCase"] = 5] = "ChangeCase";
  FileNameModifierOperationType2[FileNameModifierOperationType2["AddAlphabetSequence"] = 6] = "AddAlphabetSequence";
  FileNameModifierOperationType2[FileNameModifierOperationType2["Reverse"] = 7] = "Reverse";
  return FileNameModifierOperationType2;
})(FileNameModifierOperationType || {});
const fileNameModifierOperationTypes = [
  {
    label: "Insert",
    value: 1
    /* Insert */
  },
  {
    label: "AddDateTime",
    value: 2
    /* AddDateTime */
  },
  {
    label: "Delete",
    value: 3
    /* Delete */
  },
  {
    label: "Replace",
    value: 4
    /* Replace */
  },
  {
    label: "ChangeCase",
    value: 5
    /* ChangeCase */
  },
  {
    label: "AddAlphabetSequence",
    value: 6
    /* AddAlphabetSequence */
  },
  {
    label: "Reverse",
    value: 7
    /* Reverse */
  }
];
var FileNameModifierPosition = /* @__PURE__ */ ((FileNameModifierPosition2) => {
  FileNameModifierPosition2[FileNameModifierPosition2["Start"] = 1] = "Start";
  FileNameModifierPosition2[FileNameModifierPosition2["End"] = 2] = "End";
  FileNameModifierPosition2[FileNameModifierPosition2["AtPosition"] = 3] = "AtPosition";
  FileNameModifierPosition2[FileNameModifierPosition2["AfterText"] = 4] = "AfterText";
  FileNameModifierPosition2[FileNameModifierPosition2["BeforeText"] = 5] = "BeforeText";
  return FileNameModifierPosition2;
})(FileNameModifierPosition || {});
const fileNameModifierPositions = [
  {
    label: "Start",
    value: 1
    /* Start */
  },
  {
    label: "End",
    value: 2
    /* End */
  },
  {
    label: "AtPosition",
    value: 3
    /* AtPosition */
  },
  {
    label: "AfterText",
    value: 4
    /* AfterText */
  },
  {
    label: "BeforeText",
    value: 5
    /* BeforeText */
  }
];
var IwFsEntryChangeType = /* @__PURE__ */ ((IwFsEntryChangeType2) => {
  IwFsEntryChangeType2[IwFsEntryChangeType2["Created"] = 1] = "Created";
  IwFsEntryChangeType2[IwFsEntryChangeType2["Renamed"] = 2] = "Renamed";
  IwFsEntryChangeType2[IwFsEntryChangeType2["Changed"] = 3] = "Changed";
  IwFsEntryChangeType2[IwFsEntryChangeType2["Deleted"] = 4] = "Deleted";
  return IwFsEntryChangeType2;
})(IwFsEntryChangeType || {});
var IwFsType = /* @__PURE__ */ ((IwFsType2) => {
  IwFsType2[IwFsType2["Unknown"] = 0] = "Unknown";
  IwFsType2[IwFsType2["Directory"] = 100] = "Directory";
  IwFsType2[IwFsType2["Image"] = 200] = "Image";
  IwFsType2[IwFsType2["CompressedFileEntry"] = 300] = "CompressedFileEntry";
  IwFsType2[IwFsType2["CompressedFilePart"] = 400] = "CompressedFilePart";
  IwFsType2[IwFsType2["Symlink"] = 500] = "Symlink";
  IwFsType2[IwFsType2["Video"] = 600] = "Video";
  IwFsType2[IwFsType2["Audio"] = 700] = "Audio";
  IwFsType2[IwFsType2["Drive"] = 1e3] = "Drive";
  IwFsType2[IwFsType2["Invalid"] = 1e4] = "Invalid";
  return IwFsType2;
})(IwFsType || {});
var PixivDownloadTaskType = /* @__PURE__ */ ((PixivDownloadTaskType2) => {
  PixivDownloadTaskType2[PixivDownloadTaskType2["Search"] = 1] = "Search";
  PixivDownloadTaskType2[PixivDownloadTaskType2["Ranking"] = 2] = "Ranking";
  PixivDownloadTaskType2[PixivDownloadTaskType2["Following"] = 3] = "Following";
  return PixivDownloadTaskType2;
})(PixivDownloadTaskType || {});
var ExHentaiDownloadTaskType = /* @__PURE__ */ ((ExHentaiDownloadTaskType2) => {
  ExHentaiDownloadTaskType2[ExHentaiDownloadTaskType2["SingleWork"] = 1] = "SingleWork";
  ExHentaiDownloadTaskType2[ExHentaiDownloadTaskType2["Watched"] = 2] = "Watched";
  ExHentaiDownloadTaskType2[ExHentaiDownloadTaskType2["List"] = 3] = "List";
  ExHentaiDownloadTaskType2[ExHentaiDownloadTaskType2["Torrent"] = 4] = "Torrent";
  return ExHentaiDownloadTaskType2;
})(ExHentaiDownloadTaskType || {});
var BilibiliDownloadTaskType = /* @__PURE__ */ ((BilibiliDownloadTaskType2) => {
  BilibiliDownloadTaskType2[BilibiliDownloadTaskType2["Favorites"] = 1] = "Favorites";
  return BilibiliDownloadTaskType2;
})(BilibiliDownloadTaskType || {});
var DownloadTaskAction = /* @__PURE__ */ ((DownloadTaskAction2) => {
  DownloadTaskAction2[DownloadTaskAction2["StartManually"] = 1] = "StartManually";
  DownloadTaskAction2[DownloadTaskAction2["Restart"] = 2] = "Restart";
  DownloadTaskAction2[DownloadTaskAction2["Disable"] = 3] = "Disable";
  DownloadTaskAction2[DownloadTaskAction2["StartAutomatically"] = 4] = "StartAutomatically";
  return DownloadTaskAction2;
})(DownloadTaskAction || {});
var DownloadTaskActionOnConflict = /* @__PURE__ */ ((DownloadTaskActionOnConflict2) => {
  DownloadTaskActionOnConflict2[DownloadTaskActionOnConflict2["NotSet"] = 0] = "NotSet";
  DownloadTaskActionOnConflict2[DownloadTaskActionOnConflict2["StopOthers"] = 1] = "StopOthers";
  DownloadTaskActionOnConflict2[DownloadTaskActionOnConflict2["Ignore"] = 2] = "Ignore";
  return DownloadTaskActionOnConflict2;
})(DownloadTaskActionOnConflict || {});
var DownloadTaskStatus = /* @__PURE__ */ ((DownloadTaskStatus2) => {
  DownloadTaskStatus2[DownloadTaskStatus2["Idle"] = 100] = "Idle";
  DownloadTaskStatus2[DownloadTaskStatus2["InQueue"] = 200] = "InQueue";
  DownloadTaskStatus2[DownloadTaskStatus2["Starting"] = 300] = "Starting";
  DownloadTaskStatus2[DownloadTaskStatus2["Downloading"] = 400] = "Downloading";
  DownloadTaskStatus2[DownloadTaskStatus2["Stopping"] = 500] = "Stopping";
  DownloadTaskStatus2[DownloadTaskStatus2["Complete"] = 600] = "Complete";
  DownloadTaskStatus2[DownloadTaskStatus2["Failed"] = 700] = "Failed";
  DownloadTaskStatus2[DownloadTaskStatus2["Disabled"] = 800] = "Disabled";
  return DownloadTaskStatus2;
})(DownloadTaskStatus || {});
const downloadTaskStatuses = [
  {
    label: "Idle",
    value: 100
    /* Idle */
  },
  {
    label: "InQueue",
    value: 200
    /* InQueue */
  },
  {
    label: "Starting",
    value: 300
    /* Starting */
  },
  {
    label: "Downloading",
    value: 400
    /* Downloading */
  },
  {
    label: "Stopping",
    value: 500
    /* Stopping */
  },
  {
    label: "Complete",
    value: 600
    /* Complete */
  },
  {
    label: "Failed",
    value: 700
    /* Failed */
  },
  {
    label: "Disabled",
    value: 800
    /* Disabled */
  }
];
var DependentComponentStatus = /* @__PURE__ */ ((DependentComponentStatus2) => {
  DependentComponentStatus2[DependentComponentStatus2["NotInstalled"] = 1] = "NotInstalled";
  DependentComponentStatus2[DependentComponentStatus2["Installed"] = 2] = "Installed";
  DependentComponentStatus2[DependentComponentStatus2["Installing"] = 3] = "Installing";
  return DependentComponentStatus2;
})(DependentComponentStatus || {});
var BulkModificationProcessorOptionsItemsFilterBy = /* @__PURE__ */ ((BulkModificationProcessorOptionsItemsFilterBy2) => {
  BulkModificationProcessorOptionsItemsFilterBy2[BulkModificationProcessorOptionsItemsFilterBy2["All"] = 1] = "All";
  BulkModificationProcessorOptionsItemsFilterBy2[BulkModificationProcessorOptionsItemsFilterBy2["Containing"] = 2] = "Containing";
  BulkModificationProcessorOptionsItemsFilterBy2[BulkModificationProcessorOptionsItemsFilterBy2["Matching"] = 3] = "Matching";
  return BulkModificationProcessorOptionsItemsFilterBy2;
})(BulkModificationProcessorOptionsItemsFilterBy || {});
const bulkModificationProcessorOptionsItemsFilterBies = [
  {
    label: "All",
    value: 1
    /* All */
  },
  {
    label: "Containing",
    value: 2
    /* Containing */
  },
  {
    label: "Matching",
    value: 3
    /* Matching */
  }
];
var BulkModificationStringProcessOperation = /* @__PURE__ */ ((BulkModificationStringProcessOperation2) => {
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["Delete"] = 1] = "Delete";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["SetWithFixedValue"] = 2] = "SetWithFixedValue";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["AddToStart"] = 3] = "AddToStart";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["AddToEnd"] = 4] = "AddToEnd";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["AddToAnyPosition"] = 5] = "AddToAnyPosition";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["RemoveFromStart"] = 6] = "RemoveFromStart";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["RemoveFromEnd"] = 7] = "RemoveFromEnd";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["RemoveFromAnyPosition"] = 8] = "RemoveFromAnyPosition";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["ReplaceFromStart"] = 9] = "ReplaceFromStart";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["ReplaceFromEnd"] = 10] = "ReplaceFromEnd";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["ReplaceFromAnyPosition"] = 11] = "ReplaceFromAnyPosition";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["ReplaceWithRegex"] = 12] = "ReplaceWithRegex";
  return BulkModificationStringProcessOperation2;
})(BulkModificationStringProcessOperation || {});
const bulkModificationStringProcessOperations = [
  {
    label: "Delete",
    value: 1
    /* Delete */
  },
  {
    label: "SetWithFixedValue",
    value: 2
    /* SetWithFixedValue */
  },
  {
    label: "AddToStart",
    value: 3
    /* AddToStart */
  },
  {
    label: "AddToEnd",
    value: 4
    /* AddToEnd */
  },
  {
    label: "AddToAnyPosition",
    value: 5
    /* AddToAnyPosition */
  },
  {
    label: "RemoveFromStart",
    value: 6
    /* RemoveFromStart */
  },
  {
    label: "RemoveFromEnd",
    value: 7
    /* RemoveFromEnd */
  },
  {
    label: "RemoveFromAnyPosition",
    value: 8
    /* RemoveFromAnyPosition */
  },
  {
    label: "ReplaceFromStart",
    value: 9
    /* ReplaceFromStart */
  },
  {
    label: "ReplaceFromEnd",
    value: 10
    /* ReplaceFromEnd */
  },
  {
    label: "ReplaceFromAnyPosition",
    value: 11
    /* ReplaceFromAnyPosition */
  },
  {
    label: "ReplaceWithRegex",
    value: 12
    /* ReplaceWithRegex */
  }
];
var BulkModificationListStringProcessOperation = /* @__PURE__ */ ((BulkModificationListStringProcessOperation2) => {
  BulkModificationListStringProcessOperation2[BulkModificationListStringProcessOperation2["SetWithFixedValue"] = 1] = "SetWithFixedValue";
  BulkModificationListStringProcessOperation2[BulkModificationListStringProcessOperation2["Append"] = 2] = "Append";
  BulkModificationListStringProcessOperation2[BulkModificationListStringProcessOperation2["Prepend"] = 3] = "Prepend";
  BulkModificationListStringProcessOperation2[BulkModificationListStringProcessOperation2["Modify"] = 4] = "Modify";
  BulkModificationListStringProcessOperation2[BulkModificationListStringProcessOperation2["Delete"] = 5] = "Delete";
  return BulkModificationListStringProcessOperation2;
})(BulkModificationListStringProcessOperation || {});
const bulkModificationListStringProcessOperations = [
  {
    label: "SetWithFixedValue",
    value: 1
    /* SetWithFixedValue */
  },
  {
    label: "Append",
    value: 2
    /* Append */
  },
  {
    label: "Prepend",
    value: 3
    /* Prepend */
  },
  {
    label: "Modify",
    value: 4
    /* Modify */
  },
  {
    label: "Delete",
    value: 5
    /* Delete */
  }
];
var BulkModificationProcessorValueType = /* @__PURE__ */ ((BulkModificationProcessorValueType2) => {
  BulkModificationProcessorValueType2[BulkModificationProcessorValueType2["ManuallyInput"] = 1] = "ManuallyInput";
  BulkModificationProcessorValueType2[BulkModificationProcessorValueType2["Variable"] = 2] = "Variable";
  return BulkModificationProcessorValueType2;
})(BulkModificationProcessorValueType || {});
const bulkModificationProcessorValueTypes = [
  {
    label: "ManuallyInput",
    value: 1
    /* ManuallyInput */
  },
  {
    label: "Variable",
    value: 2
    /* Variable */
  }
];
var CloseBehavior = /* @__PURE__ */ ((CloseBehavior2) => {
  CloseBehavior2[CloseBehavior2["Prompt"] = 0] = "Prompt";
  CloseBehavior2[CloseBehavior2["Exit"] = 1] = "Exit";
  CloseBehavior2[CloseBehavior2["Minimize"] = 2] = "Minimize";
  CloseBehavior2[CloseBehavior2["Cancel"] = 1e3] = "Cancel";
  return CloseBehavior2;
})(CloseBehavior || {});
var IconType = /* @__PURE__ */ ((IconType2) => {
  IconType2[IconType2["UnknownFile"] = 1] = "UnknownFile";
  IconType2[IconType2["Directory"] = 2] = "Directory";
  IconType2[IconType2["Dynamic"] = 3] = "Dynamic";
  return IconType2;
})(IconType || {});
var UiTheme = /* @__PURE__ */ ((UiTheme2) => {
  UiTheme2[UiTheme2["FollowSystem"] = 0] = "FollowSystem";
  UiTheme2[UiTheme2["Light"] = 1] = "Light";
  UiTheme2[UiTheme2["Dark"] = 2] = "Dark";
  return UiTheme2;
})(UiTheme || {});
var UpdaterStatus = /* @__PURE__ */ ((UpdaterStatus2) => {
  UpdaterStatus2[UpdaterStatus2["Idle"] = 1] = "Idle";
  UpdaterStatus2[UpdaterStatus2["Running"] = 2] = "Running";
  UpdaterStatus2[UpdaterStatus2["PendingRestart"] = 3] = "PendingRestart";
  UpdaterStatus2[UpdaterStatus2["UpToDate"] = 4] = "UpToDate";
  UpdaterStatus2[UpdaterStatus2["Failed"] = 5] = "Failed";
  return UpdaterStatus2;
})(UpdaterStatus || {});
var ThirdPartyRequestResultType = /* @__PURE__ */ ((ThirdPartyRequestResultType2) => {
  ThirdPartyRequestResultType2[ThirdPartyRequestResultType2["Succeed"] = 1] = "Succeed";
  ThirdPartyRequestResultType2[ThirdPartyRequestResultType2["TimedOut"] = 2] = "TimedOut";
  ThirdPartyRequestResultType2[ThirdPartyRequestResultType2["Banned"] = 3] = "Banned";
  ThirdPartyRequestResultType2[ThirdPartyRequestResultType2["Canceled"] = 4] = "Canceled";
  ThirdPartyRequestResultType2[ThirdPartyRequestResultType2["Failed"] = 1e3] = "Failed";
  return ThirdPartyRequestResultType2;
})(ThirdPartyRequestResultType || {});
var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
  LogLevel2[LogLevel2["Trace"] = 0] = "Trace";
  LogLevel2[LogLevel2["Debug"] = 1] = "Debug";
  LogLevel2[LogLevel2["Information"] = 2] = "Information";
  LogLevel2[LogLevel2["Warning"] = 3] = "Warning";
  LogLevel2[LogLevel2["Error"] = 4] = "Error";
  LogLevel2[LogLevel2["Critical"] = 5] = "Critical";
  LogLevel2[LogLevel2["None"] = 6] = "None";
  return LogLevel2;
})(LogLevel || {});
var DecompressionStatus = /* @__PURE__ */ ((DecompressionStatus2) => {
  DecompressionStatus2[DecompressionStatus2["Pending"] = 1] = "Pending";
  DecompressionStatus2[DecompressionStatus2["Decompressing"] = 2] = "Decompressing";
  DecompressionStatus2[DecompressionStatus2["Success"] = 3] = "Success";
  DecompressionStatus2[DecompressionStatus2["Error"] = 4] = "Error";
  return DecompressionStatus2;
})(DecompressionStatus || {});
var CompressedFileDetectionResultStatus = /* @__PURE__ */ ((CompressedFileDetectionResultStatus2) => {
  CompressedFileDetectionResultStatus2[CompressedFileDetectionResultStatus2["Init"] = 1] = "Init";
  CompressedFileDetectionResultStatus2[CompressedFileDetectionResultStatus2["Inprogress"] = 2] = "Inprogress";
  CompressedFileDetectionResultStatus2[CompressedFileDetectionResultStatus2["Complete"] = 3] = "Complete";
  CompressedFileDetectionResultStatus2[CompressedFileDetectionResultStatus2["Error"] = 4] = "Error";
  return CompressedFileDetectionResultStatus2;
})(CompressedFileDetectionResultStatus || {});
const pathSeparator = "/";
const BusinessConstants = {
  pathSeparator,
  uncPathPrefix: pathSeparator + pathSeparator,
  DefaultResourceColumnCount: 6
};
const convertDurationToTime = (duration2) => {
  return new $35ea8db9cb2ccb90$export$680ea196effce5f(
    duration2.hours(),
    duration2.minutes(),
    duration2.seconds(),
    duration2.milliseconds()
  );
};
const convertTimeToDuration = (time2) => {
  return dayjs.duration({
    hours: time2.hour,
    minutes: time2.minute,
    seconds: time2.second,
    milliseconds: time2.millisecond
  });
};
function bytesToSize(bytes) {
  const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
  if (bytes == 0)
    return "0 Byte";
  const i2 = Math.floor(Math.floor(Math.log(bytes) / Math.log(1024)));
  return `${Math.round(bytes / Math.pow(1024, i2))} ${sizes[i2]}`;
}
function useTraceUpdate(props, logPrefix) {
  const prev2 = reactExports.useRef(props);
  reactExports.useEffect(() => {
    const changedProps = Object.entries(props).reduce((ps, [k2, v2]) => {
      if (prev2.current[k2] !== v2) {
        ps[k2] = [prev2.current[k2], v2];
      }
      return ps;
    }, {});
    if (Object.keys(changedProps).length > 0) {
      console.log(`${logPrefix}Changed props:`, changedProps);
    }
    prev2.current = props;
  });
}
function humanFileSize(bytes, si2 = false, dp = 1) {
  const thresh = si2 ? 1e3 : 1024;
  if (Math.abs(bytes) < thresh) {
    return `${bytes} B`;
  }
  const units = si2 ? ["kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] : ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
  let u2 = -1;
  const r2 = 10 ** dp;
  do {
    bytes /= thresh;
    ++u2;
  } while (Math.round(Math.abs(bytes) * r2) / r2 >= thresh && u2 < units.length - 1);
  return `${bytes.toFixed(dp)} ${units[u2]}`;
}
const layerRegex = "[^\\/]+";
const pathSeparatorInRegexStr = "\\/";
function buildLayerBasedPathRegexString(layer2, extensions2) {
  let reg = "^";
  for (let i2 = 0; i2 < layer2; i2++) {
    reg += layerRegex;
    if (i2 < layer2 - 1) {
      reg += pathSeparatorInRegexStr;
    } else {
      if (extensions2) {
        if (extensions2.length > 0) {
          reg += `\\.(?:${extensions2.map((e2) => e2.replace(/^\./, "").replaceAll(".", "\\.")).join("|")})`;
          break;
        }
      }
    }
  }
  reg += "$";
  return reg;
}
function getFileNameWithoutExtension(path) {
  if (path && path.length > 0) {
    const segments = path.split(".");
    const filename2 = segments[Math.max(0, segments.length - 2)];
    const segments2 = filename2.split("!");
    return segments2[segments2.length - 1];
  } else {
    return void 0;
  }
}
function uuidv4() {
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c2) => {
    let r2 = Math.random() * 16 | 0, v2 = c2 == "x" ? r2 : r2 & 3 | 8;
    return v2.toString(16);
  });
}
function findCapturingGroupsInRegex(regex2) {
  var _a2;
  return ((_a2 = regex2 == null ? void 0 : regex2.match(/\(\?<(\w+)>/g)) == null ? void 0 : _a2.map((match5) => match5.slice(3, -1))) || [];
}
function extractEnhancerTargetDescription(target) {
  const segs = target.split(":");
  const type4 = segs[0];
  const key = segs[1];
  let typeName;
  let keyName;
  if (type4 == "p") {
    typeName = "Property";
    const reserved = reservedResourceProperties.find(
      (x2) => x2.label.toLowerCase() == key.toLowerCase()
    );
    keyName = reserved ? instance.t(reserved.label) : key;
  } else if (type4 == "f") {
    typeName = "File";
    const reserved = reservedResourceFileTypes.find(
      (x2) => x2.label.toLowerCase() == key.toLowerCase()
    );
    keyName = reserved ? instance.t(reserved.label) : key;
  } else {
    typeName = "Unknown";
  }
  return {
    type: instance.t(typeName),
    key: keyName
  };
}
function createPortalOfComponent(Component2, props) {
  const key = uuidv4();
  const node2 = document.createElement("div");
  document.body.appendChild(node2);
  const root2 = client.createRoot(node2);
  const unmount = () => {
    console.log("Unmounting", key);
    setTimeout(() => {
      root2.unmount();
      node2.remove();
    }, 1);
  };
  console.log("Mounting", key);
  root2.render(
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Component2,
      {
        ...props,
        afterClose: () => {
          if (props.afterClose) {
            props.afterClose();
          }
          unmount();
        }
      }
    )
  );
  return {
    key,
    close: unmount
  };
}
function standardizePath(path) {
  if (path == void 0) {
    return;
  }
  const np = path.replace(/\\/g, BusinessConstants.pathSeparator);
  if (isUncPath$1(path) && !np.startsWith(BusinessConstants.uncPathPrefix)) {
    return `${BusinessConstants.uncPathPrefix}${np}`;
  }
  return np;
}
function getStandardParentPath(path) {
  if (path == void 0) {
    return void 0;
  }
  const stdPath = standardizePath(path);
  const segments = splitPathIntoSegments(stdPath);
  const suffix = segments.slice(0, -1).join(BusinessConstants.pathSeparator);
  if (suffix.length == 0) {
    return void 0;
  }
  const match5 = stdPath.match(/^([\\/]+)(.*)/);
  const prefix = match5 ? match5[1] : "";
  return `${prefix}${suffix}`;
}
function buildLogger(key) {
  return ((...args) => {
    return Function.prototype.bind.call(
      console.log,
      console,
      chalk$1.blue(`[${key}]`)
    );
  })();
}
function createSelection(field, start2, end2) {
  if (field.createTextRange) {
    const selRange = field.createTextRange();
    selRange.collapse(true);
    selRange.moveStart("character", start2);
    selRange.moveEnd("character", end2);
    selRange.select();
    field.focus();
  } else if (field.setSelectionRange) {
    field.focus();
    field.setSelectionRange(start2, end2);
  } else if (typeof field.selectionStart !== "undefined") {
    field.selectionStart = start2;
    field.selectionEnd = end2;
    field.focus();
  }
}
function isString$2(value2) {
  return typeof value2 === "string" || value2 instanceof String;
}
function forceFocus(nodeOrQuery) {
  let dom;
  if (isString$2(nodeOrQuery)) {
    const query = nodeOrQuery;
    console.log(query);
    dom = document.querySelector(query);
  } else {
    dom = nodeOrQuery;
  }
  if (dom) {
    dom.setAttribute("tabindex", "0");
    dom.focus();
  }
}
function captureVideoFrame(video, format2, quality) {
  if (typeof window === "undefined" || typeof document === "undefined") {
    return false;
  }
  if (typeof video === "string") {
    video = document.getElementById(video);
  }
  format2 = format2 || "jpeg";
  quality = quality || 0.92;
  if (!video || format2 !== "png" && format2 !== "jpeg") {
    return false;
  }
  const canvas = document.createElement("canvas");
  canvas.width = video.videoWidth;
  canvas.height = video.videoHeight;
  canvas.getContext("2d").drawImage(video, 0, 0);
  const dataUri = canvas.toDataURL(`image/${format2}`, quality);
  const data = dataUri.split(",")[1];
  const mimeType = dataUri.split(";")[0].slice(5);
  const bytes = window.atob(data);
  const buf = new ArrayBuffer(bytes.length);
  const arr = new Uint8Array(buf);
  for (let i2 = 0; i2 < bytes.length; i2++) {
    arr[i2] = bytes.charCodeAt(i2);
  }
  const blob = new Blob([arr], { type: mimeType });
  return {
    blob,
    dataUri,
    format: format2
  };
}
function execAll(regex2, str, maxCount) {
  const newReg = new RegExp(regex2, "g");
  return str.matchAll(newReg);
}
function splitPathIntoSegments(path) {
  const sp = standardizePath(path);
  const segments = sp.split(BusinessConstants.pathSeparator).filter((a2) => (a2 == null ? void 0 : a2.length) > 0);
  if (sp.startsWith(BusinessConstants.uncPathPrefix)) {
    segments[0] = `${BusinessConstants.uncPathPrefix}${segments[0]}`;
  }
  return segments;
}
function splitStringWithEscapeChar(str, separator, escapeChar) {
  if (str.length === 0) {
    return null;
  }
  const result = [];
  let idx = 0;
  while (idx <= str.length) {
    let nextIdx = idx;
    while (true) {
      nextIdx = str.indexOf(separator, nextIdx);
      if (nextIdx > 0) {
        if (str[nextIdx - 1] === escapeChar) {
          nextIdx++;
          continue;
        }
      }
      break;
    }
    if (nextIdx === -1) {
      result.push(str.substring(idx));
      break;
    }
    result.push(str.substring(idx, nextIdx));
    idx = nextIdx + 1;
  }
  return result.map(
    (r2) => r2.replaceAll(`${escapeChar}${separator}`, separator)
  );
}
function joinWithEscapeChar(data, separator, escapeChar) {
  return data.map(
    (d2) => d2 == null ? void 0 : d2.replace(new RegExp(separator, "g"), `${escapeChar}${separator}`)
  ).join(separator);
}
const getUiTheme = (uiTheme) => {
  let theme2 = uiTheme ?? UiTheme.FollowSystem;
  if (theme2 == UiTheme.FollowSystem) {
    if (typeof window !== "undefined" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
      theme2 = UiTheme.Dark;
    } else {
      theme2 = UiTheme.Light;
    }
  }
  return theme2;
};
const buildUntitledLabel = (translation, existed) => {
  let i2 = 1;
  while (true) {
    const label = `${translation} ${i2}`;
    if (!existed || existed.length == 0 || !existed.includes(label)) {
      return label;
    }
    i2++;
  }
};
function adjustAlpha(color2, alphaAdjustment) {
  if (color2.startsWith("#")) {
    return hexToRGBAWithAlpha(color2, alphaAdjustment);
  } else if (color2.startsWith("rgb")) {
    return adjustRGBAWithAlpha(color2, alphaAdjustment);
  } else if (color2.startsWith("hsl")) {
    return adjustHSLAWithAlpha(color2, alphaAdjustment);
  } else {
    throw new Error("Unsupported color format");
  }
}
function hexToRGBAWithAlpha(hex3, alphaAdjustment) {
  hex3 = hex3.replace(/^#/, "");
  if (hex3.length === 3) {
    hex3 = hex3.split("").map((char2) => char2 + char2).join("");
  }
  const r2 = parseInt(hex3.substring(0, 2), 16);
  const g2 = parseInt(hex3.substring(2, 4), 16);
  const b2 = parseInt(hex3.substring(4, 6), 16);
  const adjustedAlpha = Math.min(1, Math.max(0, alphaAdjustment));
  return `rgba(${r2}, ${g2}, ${b2}, ${adjustedAlpha})`;
}
function adjustRGBAWithAlpha(rgba2, alphaAdjustment) {
  const match5 = rgba2.match(
    /rgba?\((\d+),\s*(\d+),\s*(\d+)(,\s*(\d+\.?\d*))?\)/
  );
  if (!match5)
    throw new Error("Invalid RGB(A) format");
  const [_24, r2, g2, b2, a2 = 1] = match5.map(Number);
  const adjustedAlpha = Math.min(1, Math.max(0, a2 * alphaAdjustment));
  return `rgba(${r2}, ${g2}, ${b2}, ${adjustedAlpha})`;
}
function adjustHSLAWithAlpha(hsla2, alphaAdjustment) {
  const match5 = hsla2.match(
    /hsla?\((\d+),\s*(\d+)%,\s*(\d+)%(,\s*(\d+\.?\d*))?\)/
  );
  if (!match5)
    throw new Error("Invalid HSL(A) format");
  const [_24, h3, s2, l2, a2 = 1] = match5.map(Number);
  const adjustedAlpha = Math.min(1, Math.max(0, a2 * alphaAdjustment));
  return `hsla(${h3}, ${s2}%, ${l2}%, ${adjustedAlpha})`;
}
function autoBackgroundColor(color2) {
  return adjustAlpha(color2, 0.1);
}
function generateNextWithPrefix(prefix, currentList) {
  const regex2 = new RegExp(`^${prefix} (\\d+)$`);
  const numbers2 = currentList.map((item) => {
    const match5 = item.match(regex2);
    return match5 ? parseInt(match5[1], 10) : null;
  }).filter((num) => num !== null);
  const nextNumber = numbers2.length ? Math.max(...numbers2) + 1 : 1;
  return `${prefix} ${nextNumber}`;
}
function hasCircleReference(data, all3, getKey3, getChildKey2) {
  const visited = /* @__PURE__ */ new Set();
  let current = data;
  while (current) {
    const key = getKey3(current);
    if (visited.has(key)) {
      return true;
    }
    visited.add(key);
    const childKey = getChildKey2(current);
    if (childKey === void 0 || childKey === null) {
      return false;
    }
    current = all3.find((item) => getKey3(item) === childKey);
  }
  return false;
}
function willCauseCircleReference(parent, childKey, all3, getKey3, getChildKey2, setChildKey) {
  const prevChildKey = getChildKey2(parent);
  setChildKey(parent, childKey);
  const hasCircle = hasCircleReference(parent, all3, getKey3, getChildKey2);
  setChildKey(parent, prevChildKey);
  return hasCircle;
}
function isPromise(value2) {
  return !!value2 && typeof value2 === "object" && typeof value2.then === "function";
}
function extractErrorMessage(error2) {
  if (typeof error2 === "string") {
    return error2;
  }
  if (error2 && typeof error2 === "object") {
    if ("message" in error2 && typeof error2.message === "string") {
      return error2.message;
    }
    if (typeof error2.toString === "function") {
      return error2.toString();
    }
  }
  return "Unknown error";
}
const log$N = buildLogger("DateInput");
const convertToCalendarDateTime = (value2) => {
  if (!value2) {
    return;
  }
  const date4 = value2.toDate();
  return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(
    date4.getFullYear(),
    date4.getMonth() + 1,
    date4.getDate(),
    date4.getHours(),
    date4.getMinutes(),
    date4.getSeconds(),
    date4.getMilliseconds()
  );
};
const DateInput = ({
  value: propsValue,
  onChange,
  defaultValue: defaultValue2,
  ...props
}) => {
  const [value2, setValue] = reactExports.useState();
  log$N(propsValue);
  log$N(propsValue, propsValue == null ? void 0 : propsValue.toISOString(), value2, propsValue == null ? void 0 : propsValue.toDate());
  reactExports.useEffect(() => {
    setValue(convertToCalendarDateTime(propsValue));
  }, [propsValue]);
  const dv = convertToCalendarDateTime(defaultValue2);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    date_input_default,
    {
      "aria-label": "Date Input",
      defaultValue: dv,
      hourCycle: 24,
      value: value2,
      onChange: (v2) => {
        onChange == null ? void 0 : onChange(v2 ? dayjs(v2.toString()) : void 0);
      },
      ...props
    }
  );
};
DateInput.displayName = "DateInput";
const TimeInput = ({
  value: value2,
  onChange,
  defaultValue: defaultValue2,
  ...props
}) => {
  const dv = defaultValue2 ? convertDurationToTime(defaultValue2) : void 0;
  const v2 = value2 ? convertDurationToTime(value2) : void 0;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    time_input_default,
    {
      defaultValue: dv,
      hourCycle: 24,
      value: v2,
      onChange: (v22) => {
        onChange == null ? void 0 : onChange(convertTimeToDuration(v22));
      },
      ...props
    }
  );
};
TimeInput.displayName = "TimeInput";
function showToast(color2, titleOrProps) {
  if (typeof titleOrProps === "string") {
    addToast({ color: color2, title: titleOrProps });
  } else {
    addToast({ color: color2, ...titleOrProps });
  }
}
const toast = {
  default: (titleOrProps) => showToast("default", titleOrProps),
  primary: (titleOrProps) => showToast("primary", titleOrProps),
  secondary: (titleOrProps) => showToast("secondary", titleOrProps),
  success: (titleOrProps) => showToast("success", titleOrProps),
  warning: (titleOrProps) => showToast("warning", titleOrProps),
  danger: (titleOrProps) => showToast("danger", titleOrProps),
  foreground: (titleOrProps) => showToast("foreground", titleOrProps)
};
var define_import_meta_env_default = {};
const envConfig = {
  apiEndpoint: define_import_meta_env_default.VITE_API_ENDPOINT ?? ""
};
const createStoreImpl = (createState2) => {
  let state;
  const listeners = /* @__PURE__ */ new Set();
  const setState = (partial, replace2) => {
    const nextState = typeof partial === "function" ? partial(state) : partial;
    if (!Object.is(nextState, state)) {
      const previousState = state;
      state = (replace2 != null ? replace2 : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
      listeners.forEach((listener) => listener(state, previousState));
    }
  };
  const getState = () => state;
  const getInitialState2 = () => initialState3;
  const subscribe2 = (listener) => {
    listeners.add(listener);
    return () => listeners.delete(listener);
  };
  const api = { setState, getState, getInitialState: getInitialState2, subscribe: subscribe2 };
  const initialState3 = state = createState2(setState, getState, api);
  return api;
};
const createStore = (createState2) => createState2 ? createStoreImpl(createState2) : createStoreImpl;
const identity$1 = (arg) => arg;
function useStore(api, selector = identity$1) {
  const slice2 = React$5.useSyncExternalStore(
    api.subscribe,
    () => selector(api.getState()),
    () => selector(api.getInitialState())
  );
  React$5.useDebugValue(slice2);
  return slice2;
}
const createImpl = (createState2) => {
  const api = createStore(createState2);
  const useBoundStore = (selector) => useStore(api, selector);
  Object.assign(useBoundStore, api);
  return useBoundStore;
};
const create$1 = (createState2) => createState2 ? createImpl(createState2) : createImpl;
const useBackgroundTasksStore = create$1(
  (set2, get5) => ({
    tasks: [],
    setTasks: (tasks) => {
      console.log("background tasks changed", tasks);
      set2({ tasks: _$2.sortBy(tasks, (x2) => x2.startedAt ?? "2099") });
    },
    updateTask: (task) => set2((state) => {
      const idx = state.tasks.findIndex((t2) => t2.id == task.id);
      let newTasks = state.tasks.slice();
      if (idx > -1) {
        newTasks[idx] = task;
      } else {
        newTasks.push(task);
      }
      return { tasks: _$2.sortBy(newTasks, (x2) => x2.startedAt ?? "2099") };
    })
  })
);
const useDownloadTasksStore = create$1((set2, get5) => ({
  tasks: [],
  setTasks: (tasks) => set2({ tasks: tasks.slice() }),
  updateTask: (task) => set2((state) => {
    const idx = state.tasks.findIndex((t2) => t2.id == task.id);
    if (idx > -1) {
      const newTasks = state.tasks.slice();
      newTasks[idx] = task;
      return { tasks: newTasks };
    } else {
      return { tasks: [...state.tasks, task] };
    }
  })
}));
const useDependentComponentContextsStore = create$1((set2, get5) => ({
  contexts: [],
  setContexts: (contexts) => {
    console.log("dependent component context changed", contexts);
    set2({
      contexts: contexts.slice().sort((a2, b2) => a2.id.localeCompare(b2.id))
    });
  },
  updateContext: (context) => set2((state) => {
    const idx = state.contexts.findIndex((t2) => t2.id === context.id);
    let newContexts = state.contexts.slice();
    if (idx > -1) {
      newContexts[idx] = context;
    } else {
      newContexts.push(context);
    }
    return { contexts: newContexts };
  })
}));
const useFileMovingProgressesStore = create$1(
  (set2, get5) => ({
    progresses: {},
    setProgresses: (progresses) => set2({ progresses }),
    updateProgress: (progress2) => set2((state) => {
      const newProgresses = {
        ...state.progresses,
        [progress2.source]: progress2
      };
      return { progresses: newProgresses };
    })
  })
);
const log$M = buildLogger("BApi");
class HttpClient2 {
  constructor(apiConfig = {}) {
    __publicField(this, "baseUrl", "");
    __publicField(this, "securityData", null);
    __publicField(this, "securityWorker");
    __publicField(this, "abortControllers", /* @__PURE__ */ new Map());
    __publicField(this, "customFetch", (...fetchParams) => fetch(...fetchParams));
    __publicField(this, "baseApiParams", {
      credentials: "same-origin",
      headers: {},
      redirect: "follow",
      referrerPolicy: "no-referrer"
    });
    __publicField(this, "setSecurityData", (data) => {
      this.securityData = data;
    });
    __publicField(this, "contentFormatters", {
      [
        "application/json"
        /* Json */
      ]: (input2) => input2 !== null && (typeof input2 === "object" || typeof input2 === "string") ? JSON.stringify(input2) : input2,
      [
        "text/plain"
        /* Text */
      ]: (input2) => input2 !== null && typeof input2 !== "string" ? JSON.stringify(input2) : input2,
      [
        "multipart/form-data"
        /* FormData */
      ]: (input2) => Object.keys(input2 || {}).reduce((formData, key) => {
        const property2 = input2[key];
        formData.append(
          key,
          property2 instanceof Blob ? property2 : typeof property2 === "object" && property2 !== null ? JSON.stringify(property2) : `${property2}`
        );
        return formData;
      }, new FormData()),
      [
        "application/x-www-form-urlencoded"
        /* UrlEncoded */
      ]: (input2) => this.toQueryString(input2)
    });
    __publicField(this, "createAbortSignal", (cancelToken) => {
      if (this.abortControllers.has(cancelToken)) {
        const abortController2 = this.abortControllers.get(cancelToken);
        if (abortController2) {
          return abortController2.signal;
        }
        return void 0;
      }
      const abortController = new AbortController();
      this.abortControllers.set(cancelToken, abortController);
      return abortController.signal;
    });
    __publicField(this, "abortRequest", (cancelToken) => {
      const abortController = this.abortControllers.get(cancelToken);
      if (abortController) {
        abortController.abort();
        this.abortControllers.delete(cancelToken);
      }
    });
    __publicField(this, "request", async (fullRequestParams) => {
      const {
        body,
        secure,
        path,
        type: type4,
        query,
        format: format2,
        baseUrl,
        cancelToken,
        ...params
      } = fullRequestParams;
      const secureParams = (typeof secure === "boolean" ? secure : this.baseApiParams.secure) && this.securityWorker && await this.securityWorker(this.securityData) || {};
      const requestParams = this.mergeRequestParams(params, secureParams);
      const queryString = query && this.toQueryString(query);
      const payloadFormatter = this.contentFormatters[
        type4 || "application/json"
        /* Json */
      ];
      const responseFormat = format2 || requestParams.format;
      return this.customFetch(
        `${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`,
        {
          ...requestParams,
          headers: {
            ...requestParams.headers || {},
            ...type4 && type4 !== "multipart/form-data" ? { "Content-Type": type4 } : {}
          },
          signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal,
          body: typeof body === "undefined" || body === null ? null : payloadFormatter(body)
        }
      ).then(async (response) => {
        const r2 = response;
        r2.data = null;
        r2.error = null;
        const data = !responseFormat ? r2 : await response[responseFormat]().then((data2) => {
          if (r2.ok) {
            r2.data = data2;
          } else {
            r2.error = data2;
          }
          return r2;
        }).catch((e2) => {
          r2.error = e2;
          return r2;
        });
        if (cancelToken) {
          this.abortControllers.delete(cancelToken);
        }
        if (!response.ok) {
          this.processResponseError(data, fullRequestParams);
          throw data;
        }
        return this.processResponseData(data.data, fullRequestParams);
      }).catch((error2) => {
        this.processResponseError(error2, fullRequestParams);
        throw error2;
      });
    });
    __publicField(this, "processResponseError", (error2, params) => {
      const title = `${params.method} ${params.path} failed`;
      const description = extractErrorMessage(error2);
      toast.danger({
        title,
        description
      });
    });
    __publicField(this, "processResponseData", (response, params) => {
      if (response && typeof response === "object" && "code" in response) {
        log$M("[response]", params.path, response);
        switch (response.code) {
          case 0:
            break;
          default:
            const showErrorToast = params.showErrorToast || ((error2) => error2.code >= 400 || error2.code < 200);
            if (showErrorToast(response)) {
              const title = `[${response.code}]${params.method} ${params.path}`;
              toast.danger({
                title,
                description: response.message
              });
            }
        }
      }
      return response;
    });
    Object.assign(this, apiConfig);
  }
  encodeQueryParam(key, value2) {
    const encodedKey = encodeURIComponent(key);
    return `${encodedKey}=${encodeURIComponent(typeof value2 === "number" ? value2 : `${value2}`)}`;
  }
  addQueryParam(query, key) {
    return this.encodeQueryParam(key, query[key]);
  }
  addArrayQueryParam(query, key) {
    const value2 = query[key];
    return value2.map((v2) => this.encodeQueryParam(key, v2)).join("&");
  }
  toQueryString(rawQuery) {
    const query = rawQuery || {};
    const keys2 = Object.keys(query).filter((key) => "undefined" !== typeof query[key]);
    return keys2.map(
      (key) => Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key)
    ).join("&");
  }
  addQueryParams(rawQuery) {
    const queryString = this.toQueryString(rawQuery);
    return queryString ? `?${queryString}` : "";
  }
  mergeRequestParams(params1, params2) {
    return {
      ...this.baseApiParams,
      ...params1,
      ...params2 || {},
      headers: {
        ...this.baseApiParams.headers || {},
        ...params1.headers || {},
        ...params2 && params2.headers || {}
      }
    };
  }
}
class Api extends HttpClient2 {
  constructor() {
    super(...arguments);
    __publicField(this, "alias", {
      /**
       * No description
       *
       * @tags Alias
       * @name SearchAliasGroups
       * @request GET:/alias
       */
      searchAliasGroups: (query, params = {}) => this.request({
        path: `/alias`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for searchAliasGroups
       * @name searchAliasGroupsUrl
       */
      searchAliasGroupsUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/alias`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Alias
       * @name PatchAlias
       * @request PUT:/alias
       */
      patchAlias: (data, query, params = {}) => this.request({
        path: `/alias`,
        method: "PUT",
        query,
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchAlias
       * @name patchAliasUrl
       */
      patchAliasUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/alias`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Alias
       * @name AddAlias
       * @request POST:/alias
       */
      addAlias: (data, params = {}) => this.request({
        path: `/alias`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addAlias
       * @name addAliasUrl
       */
      addAliasUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/alias`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Alias
       * @name DeleteAlias
       * @request DELETE:/alias
       */
      deleteAlias: (query, params = {}) => this.request({
        path: `/alias`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for deleteAlias
       * @name deleteAliasUrl
       */
      deleteAliasUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/alias`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Alias
       * @name DeleteAliasGroups
       * @request DELETE:/alias/groups
       */
      deleteAliasGroups: (query, params = {}) => this.request({
        path: `/alias/groups`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for deleteAliasGroups
       * @name deleteAliasGroupsUrl
       */
      deleteAliasGroupsUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/alias/groups`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Alias
       * @name MergeAliasGroups
       * @request PUT:/alias/merge
       */
      mergeAliasGroups: (query, params = {}) => this.request({
        path: `/alias/merge`,
        method: "PUT",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for mergeAliasGroups
       * @name mergeAliasGroupsUrl
       */
      mergeAliasGroupsUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/alias/merge`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Alias
       * @name ExportAliases
       * @request GET:/alias/xlsx
       */
      exportAliases: (params = {}) => this.request({
        path: `/alias/xlsx`,
        method: "GET",
        ...params
      }),
      /**
       * @description Build URL for exportAliases
       * @name exportAliasesUrl
       */
      exportAliasesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/alias/xlsx`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Alias
       * @name ImportAliases
       * @request POST:/alias/import
       */
      importAliases: (query, params = {}) => this.request({
        path: `/alias/import`,
        method: "POST",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for importAliases
       * @name importAliasesUrl
       */
      importAliasesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/alias/import`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      }
    });
    __publicField(this, "app", {
      /**
       * No description
       *
       * @tags App
       * @name CheckAppInitialized
       * @request GET:/app/initialized
       */
      checkAppInitialized: (params = {}) => this.request({
        path: `/app/initialized`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for checkAppInitialized
       * @name checkAppInitializedUrl
       */
      checkAppInitializedUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/app/initialized`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags App
       * @name GetAppInfo
       * @request GET:/app/info
       */
      getAppInfo: (params = {}) => this.request({
        path: `/app/info`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAppInfo
       * @name getAppInfoUrl
       */
      getAppInfoUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/app/info`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags App
       * @name AcceptTerms
       * @request POST:/app/terms
       */
      acceptTerms: (params = {}) => this.request({
        path: `/app/terms`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for acceptTerms
       * @name acceptTermsUrl
       */
      acceptTermsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/app/terms`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags App
       * @name MoveCoreData
       * @request PUT:/app/data-path
       */
      moveCoreData: (data, params = {}) => this.request({
        path: `/app/data-path`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for moveCoreData
       * @name moveCoreDataUrl
       */
      moveCoreDataUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/app/data-path`;
        return baseUrl + path;
      }
    });
    __publicField(this, "backgroundTask", {
      /**
       * No description
       *
       * @tags BackgroundTask
       * @name StartBackgroundTask
       * @request POST:/background-task/{id}/run
       */
      startBackgroundTask: (id2, params = {}) => this.request({
        path: `/background-task/${id2}/run`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BackgroundTask
       * @name StopBackgroundTask
       * @request DELETE:/background-task/{id}/run
       */
      stopBackgroundTask: (id2, query, params = {}) => this.request({
        path: `/background-task/${id2}/run`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BackgroundTask
       * @name PauseBackgroundTask
       * @request POST:/background-task/{id}/pause
       */
      pauseBackgroundTask: (id2, params = {}) => this.request({
        path: `/background-task/${id2}/pause`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BackgroundTask
       * @name ResumeBackgroundTask
       * @request DELETE:/background-task/{id}/pause
       */
      resumeBackgroundTask: (id2, params = {}) => this.request({
        path: `/background-task/${id2}/pause`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BackgroundTask
       * @name CleanInactiveBackgroundTasks
       * @request DELETE:/background-task
       */
      cleanInactiveBackgroundTasks: (params = {}) => this.request({
        path: `/background-task`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for cleanInactiveBackgroundTasks
       * @name cleanInactiveBackgroundTasksUrl
       */
      cleanInactiveBackgroundTasksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/background-task`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags BackgroundTask
       * @name CleanBackgroundTask
       * @request DELETE:/background-task/{id}
       */
      cleanBackgroundTask: (id2, params = {}) => this.request({
        path: `/background-task/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      })
    });
    __publicField(this, "bilibili", {
      /**
       * No description
       *
       * @tags BiliBili
       * @name GetBiliBiliFavorites
       * @request GET:/bilibili/favorites
       */
      getBiliBiliFavorites: (params = {}) => this.request({
        path: `/bilibili/favorites`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getBiliBiliFavorites
       * @name getBiliBiliFavoritesUrl
       */
      getBiliBiliFavoritesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/bilibili/favorites`;
        return baseUrl + path;
      }
    });
    __publicField(this, "bulkModification", {
      /**
       * No description
       *
       * @tags BulkModification
       * @name GetBulkModification
       * @request GET:/bulk-modification/{id}
       */
      getBulkModification: (id2, params = {}) => this.request({
        path: `/bulk-modification/${id2}`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BulkModification
       * @name DuplicateBulkModification
       * @request POST:/bulk-modification/{id}
       */
      duplicateBulkModification: (id2, params = {}) => this.request({
        path: `/bulk-modification/${id2}`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BulkModification
       * @name PatchBulkModification
       * @request PATCH:/bulk-modification/{id}
       */
      patchBulkModification: (id2, data, params = {}) => this.request({
        path: `/bulk-modification/${id2}`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BulkModification
       * @name DeleteBulkModification
       * @request DELETE:/bulk-modification/{id}
       */
      deleteBulkModification: (id2, params = {}) => this.request({
        path: `/bulk-modification/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BulkModification
       * @name GetAllBulkModifications
       * @request GET:/bulk-modification/all
       */
      getAllBulkModifications: (params = {}) => this.request({
        path: `/bulk-modification/all`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllBulkModifications
       * @name getAllBulkModificationsUrl
       */
      getAllBulkModificationsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/bulk-modification/all`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags BulkModification
       * @name AddBulkModification
       * @request POST:/bulk-modification
       */
      addBulkModification: (params = {}) => this.request({
        path: `/bulk-modification`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addBulkModification
       * @name addBulkModificationUrl
       */
      addBulkModificationUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/bulk-modification`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags BulkModification
       * @name FilterResourcesInBulkModification
       * @request PUT:/bulk-modification/{id}/filtered-resources
       */
      filterResourcesInBulkModification: (id2, params = {}) => this.request({
        path: `/bulk-modification/${id2}/filtered-resources`,
        method: "PUT",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BulkModification
       * @name PreviewBulkModification
       * @request PUT:/bulk-modification/{id}/preview
       */
      previewBulkModification: (id2, params = {}) => this.request({
        path: `/bulk-modification/${id2}/preview`,
        method: "PUT",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BulkModification
       * @name SearchBulkModificationDiffs
       * @request GET:/bulk-modification/{bmId}/diffs
       */
      searchBulkModificationDiffs: (bmId, query, params = {}) => this.request({
        path: `/bulk-modification/${bmId}/diffs`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BulkModification
       * @name ApplyBulkModification
       * @request POST:/bulk-modification/{id}/apply
       */
      applyBulkModification: (id2, params = {}) => this.request({
        path: `/bulk-modification/${id2}/apply`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BulkModification
       * @name RevertBulkModification
       * @request DELETE:/bulk-modification/{id}/apply
       */
      revertBulkModification: (id2, params = {}) => this.request({
        path: `/bulk-modification/${id2}/apply`,
        method: "DELETE",
        format: "json",
        ...params
      })
    });
    __publicField(this, "cache", {
      /**
       * No description
       *
       * @tags Cache
       * @name GetCacheOverview
       * @request GET:/cache
       */
      getCacheOverview: (params = {}) => this.request({
        path: `/cache`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getCacheOverview
       * @name getCacheOverviewUrl
       */
      getCacheOverviewUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/cache`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Cache
       * @name CheckResourceCacheExistence
       * @request GET:/cache/resource/{resourceId}/type/{type}/existence
       */
      checkResourceCacheExistence: (resourceId, type4, params = {}) => this.request({
        path: `/cache/resource/${resourceId}/type/${type4}/existence`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Cache
       * @name DeleteResourceCacheByResourceIdAndCacheType
       * @request DELETE:/cache/resource/{resourceId}/type/{type}
       */
      deleteResourceCacheByResourceIdAndCacheType: (resourceId, type4, params = {}) => this.request({
        path: `/cache/resource/${resourceId}/type/${type4}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Cache
       * @name DeleteResourceCacheByCategoryIdAndCacheType
       * @request DELETE:/cache/category/{categoryId}/type/{type}
       */
      deleteResourceCacheByCategoryIdAndCacheType: (categoryId, type4, params = {}) => this.request({
        path: `/cache/category/${categoryId}/type/${type4}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Cache
       * @name DeleteResourceCacheByMediaLibraryIdAndCacheType
       * @request DELETE:/cache/media-library/{mediaLibraryId}/type/{type}
       */
      deleteResourceCacheByMediaLibraryIdAndCacheType: (mediaLibraryId, type4, params = {}) => this.request({
        path: `/cache/media-library/${mediaLibraryId}/type/${type4}`,
        method: "DELETE",
        format: "json",
        ...params
      })
    });
    __publicField(this, "category", {
      /**
       * No description
       *
       * @tags Category
       * @name GetCategory
       * @request GET:/category/{id}
       * @deprecated
       */
      getCategory: (id2, query, params = {}) => this.request({
        path: `/category/${id2}`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name PatchCategory
       * @request PATCH:/category/{id}
       * @deprecated
       */
      patchCategory: (id2, data, params = {}) => this.request({
        path: `/category/${id2}`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name DeleteCategory
       * @request DELETE:/category/{id}
       * @deprecated
       */
      deleteCategory: (id2, params = {}) => this.request({
        path: `/category/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name GetAllCategories
       * @request GET:/category
       * @deprecated
       */
      getAllCategories: (query, params = {}) => this.request({
        path: `/category`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllCategories
       * @name getAllCategoriesUrl
       */
      getAllCategoriesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/category`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Category
       * @name AddCategory
       * @request POST:/category
       * @deprecated
       */
      addCategory: (data, params = {}) => this.request({
        path: `/category`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addCategory
       * @name addCategoryUrl
       */
      addCategoryUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/category`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Category
       * @name DuplicateCategory
       * @request POST:/category/{id}/duplication
       * @deprecated
       */
      duplicateCategory: (id2, data, params = {}) => this.request({
        path: `/category/${id2}/duplication`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name PutCategoryResourceDisplayNameTemplate
       * @request PUT:/category/{id}/resource-display-name-template
       * @deprecated
       */
      putCategoryResourceDisplayNameTemplate: (id2, data, params = {}) => this.request({
        path: `/category/${id2}/resource-display-name-template`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name ConfigureCategoryComponents
       * @request PUT:/category/{id}/component
       * @deprecated
       */
      configureCategoryComponents: (id2, data, params = {}) => this.request({
        path: `/category/${id2}/component`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name SortCategories
       * @request PUT:/category/orders
       * @deprecated
       */
      sortCategories: (data, params = {}) => this.request({
        path: `/category/orders`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for sortCategories
       * @name sortCategoriesUrl
       */
      sortCategoriesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/category/orders`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Category
       * @name BindCustomPropertiesToCategory
       * @request PUT:/category/{id}/custom-properties
       * @deprecated
       */
      bindCustomPropertiesToCategory: (id2, data, params = {}) => this.request({
        path: `/category/${id2}/custom-properties`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name BindCustomPropertyToCategory
       * @request POST:/category/{categoryId}/custom-property/{customPropertyId}
       * @deprecated
       */
      bindCustomPropertyToCategory: (categoryId, customPropertyId, params = {}) => this.request({
        path: `/category/${categoryId}/custom-property/${customPropertyId}`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name UnlinkCustomPropertyFromCategory
       * @request DELETE:/category/{categoryId}/custom-property/{customPropertyId}
       * @deprecated
       */
      unlinkCustomPropertyFromCategory: (categoryId, customPropertyId, params = {}) => this.request({
        path: `/category/${categoryId}/custom-property/${customPropertyId}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name SortCustomPropertiesInCategory
       * @request PUT:/category/{categoryId}/custom-property/order
       * @deprecated
       */
      sortCustomPropertiesInCategory: (categoryId, data, params = {}) => this.request({
        path: `/category/${categoryId}/custom-property/order`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name PreviewCategoryDisplayNameTemplate
       * @request GET:/category/{id}/resource/resource-display-name-template/preview
       * @deprecated
       */
      previewCategoryDisplayNameTemplate: (id2, query, params = {}) => this.request({
        path: `/category/${id2}/resource/resource-display-name-template/preview`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name GetCategoryEnhancerOptions
       * @request GET:/category/{id}/enhancer/{enhancerId}/options
       * @deprecated
       */
      getCategoryEnhancerOptions: (id2, enhancerId, params = {}) => this.request({
        path: `/category/${id2}/enhancer/${enhancerId}/options`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name PatchCategoryEnhancerOptions
       * @request PATCH:/category/{id}/enhancer/{enhancerId}/options
       * @deprecated
       */
      patchCategoryEnhancerOptions: (id2, enhancerId, data, params = {}) => this.request({
        path: `/category/${id2}/enhancer/${enhancerId}/options`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name DeleteCategoryEnhancerTargetOptions
       * @request DELETE:/category/{id}/enhancer/{enhancerId}/options/target
       * @deprecated
       */
      deleteCategoryEnhancerTargetOptions: (id2, enhancerId, query, params = {}) => this.request({
        path: `/category/${id2}/enhancer/${enhancerId}/options/target`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name PatchCategoryEnhancerTargetOptions
       * @request PATCH:/category/{id}/enhancer/{enhancerId}/options/target
       * @deprecated
       */
      patchCategoryEnhancerTargetOptions: (id2, enhancerId, query, data, params = {}) => this.request({
        path: `/category/${id2}/enhancer/${enhancerId}/options/target`,
        method: "PATCH",
        query,
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name UnbindCategoryEnhancerTargetProperty
       * @request DELETE:/category/{id}/enhancer/{enhancerId}/options/target/property
       * @deprecated
       */
      unbindCategoryEnhancerTargetProperty: (id2, enhancerId, query, params = {}) => this.request({
        path: `/category/${id2}/enhancer/${enhancerId}/options/target/property`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name StartSyncingCategoryResources
       * @request PUT:/category/{id}/synchronization
       * @deprecated
       */
      startSyncingCategoryResources: (id2, params = {}) => this.request({
        path: `/category/${id2}/synchronization`,
        method: "PUT",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Enhancement
       * @name ApplyEnhancementContextDataByEnhancerAndCategory
       * @request POST:/category/{categoryId}/enhancer/{enhancerId}/enhancement/apply
       */
      applyEnhancementContextDataByEnhancerAndCategory: (categoryId, enhancerId, params = {}) => this.request({
        path: `/category/${categoryId}/enhancer/${enhancerId}/enhancement/apply`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Enhancement
       * @name DeleteEnhancementsByCategory
       * @request DELETE:/category/{categoryId}/enhancement
       */
      deleteEnhancementsByCategory: (categoryId, query, params = {}) => this.request({
        path: `/category/${categoryId}/enhancement`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Enhancement
       * @name DeleteEnhancementsByCategoryAndEnhancer
       * @request DELETE:/category/{categoryId}/enhancer/{enhancerId}/enhancements
       */
      deleteEnhancementsByCategoryAndEnhancer: (categoryId, enhancerId, query, params = {}) => this.request({
        path: `/category/${categoryId}/enhancer/${enhancerId}/enhancements`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      })
    });
    __publicField(this, "component", {
      /**
       * No description
       *
       * @tags Component
       * @name GetComponentDescriptors
       * @request GET:/component
       * @deprecated
       */
      getComponentDescriptors: (query, params = {}) => this.request({
        path: `/component`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getComponentDescriptors
       * @name getComponentDescriptorsUrl
       */
      getComponentDescriptorsUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/component`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Component
       * @name GetComponentDescriptorByKey
       * @request GET:/component/key
       * @deprecated
       */
      getComponentDescriptorByKey: (query, params = {}) => this.request({
        path: `/component/key`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getComponentDescriptorByKey
       * @name getComponentDescriptorByKeyUrl
       */
      getComponentDescriptorByKeyUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/component/key`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Component
       * @name DiscoverDependentComponent
       * @request GET:/component/dependency/discovery
       * @deprecated
       */
      discoverDependentComponent: (query, params = {}) => this.request({
        path: `/component/dependency/discovery`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for discoverDependentComponent
       * @name discoverDependentComponentUrl
       */
      discoverDependentComponentUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/component/dependency/discovery`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Component
       * @name GetDependentComponentLatestVersion
       * @request GET:/component/dependency/latest-version
       * @deprecated
       */
      getDependentComponentLatestVersion: (query, params = {}) => this.request({
        path: `/component/dependency/latest-version`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getDependentComponentLatestVersion
       * @name getDependentComponentLatestVersionUrl
       */
      getDependentComponentLatestVersionUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/component/dependency/latest-version`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Component
       * @name InstallDependentComponent
       * @request POST:/component/dependency
       * @deprecated
       */
      installDependentComponent: (query, params = {}) => this.request({
        path: `/component/dependency`,
        method: "POST",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for installDependentComponent
       * @name installDependentComponentUrl
       */
      installDependentComponentUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/component/dependency`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      }
    });
    __publicField(this, "componentOptions", {
      /**
       * No description
       *
       * @tags ComponentOptions
       * @name AddComponentOptions
       * @request POST:/component-options
       * @deprecated
       */
      addComponentOptions: (data, params = {}) => this.request({
        path: `/component-options`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addComponentOptions
       * @name addComponentOptionsUrl
       */
      addComponentOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/component-options`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags ComponentOptions
       * @name PutComponentOptions
       * @request PUT:/component-options/{id}
       * @deprecated
       */
      putComponentOptions: (id2, data, params = {}) => this.request({
        path: `/component-options/${id2}`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags ComponentOptions
       * @name RemoveComponentOptions
       * @request DELETE:/component-options/{id}
       * @deprecated
       */
      removeComponentOptions: (id2, params = {}) => this.request({
        path: `/component-options/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      })
    });
    __publicField(this, "api", {
      /**
       * No description
       *
       * @tags Constant
       * @name GetAllExtensionMediaTypes
       * @request GET:/api/constant/extension-media-types
       */
      getAllExtensionMediaTypes: (params = {}) => this.request({
        path: `/api/constant/extension-media-types`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllExtensionMediaTypes
       * @name getAllExtensionMediaTypesUrl
       */
      getAllExtensionMediaTypesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/api/constant/extension-media-types`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Constant
       * @name ConstantList
       * @request GET:/api/constant
       */
      constantList: (params = {}) => this.request({
        path: `/api/constant`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for constantList
       * @name constantListUrl
       */
      constantListUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/api/constant`;
        return baseUrl + path;
      }
    });
    __publicField(this, "customProperty", {
      /**
       * No description
       *
       * @tags CustomProperty
       * @name GetAllCustomProperties
       * @request GET:/custom-property/all
       */
      getAllCustomProperties: (query, params = {}) => this.request({
        path: `/custom-property/all`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllCustomProperties
       * @name getAllCustomPropertiesUrl
       */
      getAllCustomPropertiesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/custom-property/all`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags CustomProperty
       * @name GetCustomPropertyByKeys
       * @request GET:/custom-property/ids
       */
      getCustomPropertyByKeys: (query, params = {}) => this.request({
        path: `/custom-property/ids`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getCustomPropertyByKeys
       * @name getCustomPropertyByKeysUrl
       */
      getCustomPropertyByKeysUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/custom-property/ids`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags CustomProperty
       * @name AddCustomProperty
       * @request POST:/custom-property
       */
      addCustomProperty: (data, params = {}) => this.request({
        path: `/custom-property`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addCustomProperty
       * @name addCustomPropertyUrl
       */
      addCustomPropertyUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/custom-property`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags CustomProperty
       * @name AddCustomPropertyBatch
       * @request POST:/custom-property/batch
       */
      addCustomPropertyBatch: (data, params = {}) => this.request({
        path: `/custom-property/batch`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addCustomPropertyBatch
       * @name addCustomPropertyBatchUrl
       */
      addCustomPropertyBatchUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/custom-property/batch`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags CustomProperty
       * @name PutCustomProperty
       * @request PUT:/custom-property/{id}
       */
      putCustomProperty: (id2, data, params = {}) => this.request({
        path: `/custom-property/${id2}`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags CustomProperty
       * @name RemoveCustomProperty
       * @request DELETE:/custom-property/{id}
       */
      removeCustomProperty: (id2, params = {}) => this.request({
        path: `/custom-property/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags CustomProperty
       * @name SortCustomProperties
       * @request PUT:/custom-property/order
       */
      sortCustomProperties: (data, params = {}) => this.request({
        path: `/custom-property/order`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for sortCustomProperties
       * @name sortCustomPropertiesUrl
       */
      sortCustomPropertiesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/custom-property/order`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags CustomProperty
       * @name PreviewCustomPropertyTypeConversion
       * @request POST:/custom-property/{sourceCustomPropertyId}/{targetType}/conversion-preview
       */
      previewCustomPropertyTypeConversion: (sourceCustomPropertyId, targetType, params = {}) => this.request({
        path: `/custom-property/${sourceCustomPropertyId}/${targetType}/conversion-preview`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags CustomProperty
       * @name GetCustomPropertyConversionRules
       * @request GET:/custom-property/conversion-rule
       */
      getCustomPropertyConversionRules: (params = {}) => this.request({
        path: `/custom-property/conversion-rule`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getCustomPropertyConversionRules
       * @name getCustomPropertyConversionRulesUrl
       */
      getCustomPropertyConversionRulesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/custom-property/conversion-rule`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags CustomProperty
       * @name ChangeCustomPropertyType
       * @request PUT:/custom-property/{id}/{type}
       */
      changeCustomPropertyType: (id2, type4, params = {}) => this.request({
        path: `/custom-property/${id2}/${type4}`,
        method: "PUT",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags CustomProperty
       * @name GetCustomPropertyValueUsage
       * @request GET:/custom-property/{id}/value-usage
       */
      getCustomPropertyValueUsage: (id2, query, params = {}) => this.request({
        path: `/custom-property/${id2}/value-usage`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags CustomProperty
       * @name TestCustomPropertyTypeConversion
       * @request GET:/custom-property/type-conversion-overview
       */
      testCustomPropertyTypeConversion: (params = {}) => this.request({
        path: `/custom-property/type-conversion-overview`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for testCustomPropertyTypeConversion
       * @name testCustomPropertyTypeConversionUrl
       */
      testCustomPropertyTypeConversionUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/custom-property/type-conversion-overview`;
        return baseUrl + path;
      }
    });
    __publicField(this, "dashboard", {
      /**
       * No description
       *
       * @tags Dashboard
       * @name GetStatistics
       * @request GET:/dashboard
       */
      getStatistics: (params = {}) => this.request({
        path: `/dashboard`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getStatistics
       * @name getStatisticsUrl
       */
      getStatisticsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/dashboard`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Dashboard
       * @name GetPropertyStatistics
       * @request GET:/dashboard/property
       */
      getPropertyStatistics: (params = {}) => this.request({
        path: `/dashboard/property`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getPropertyStatistics
       * @name getPropertyStatisticsUrl
       */
      getPropertyStatisticsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/dashboard/property`;
        return baseUrl + path;
      }
    });
    __publicField(this, "downloadTask", {
      /**
       * No description
       *
       * @tags DownloadTask
       * @name GetAllDownloaderDefinitions
       * @request GET:/download-task/downloaders/definitions
       */
      getAllDownloaderDefinitions: (params = {}) => this.request({
        path: `/download-task/downloaders/definitions`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllDownloaderDefinitions
       * @name getAllDownloaderDefinitionsUrl
       */
      getAllDownloaderDefinitionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/download-task/downloaders/definitions`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags DownloadTask
       * @name GetAllDownloadTasks
       * @request GET:/download-task
       */
      getAllDownloadTasks: (params = {}) => this.request({
        path: `/download-task`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllDownloadTasks
       * @name getAllDownloadTasksUrl
       */
      getAllDownloadTasksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/download-task`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags DownloadTask
       * @name AddDownloadTask
       * @request POST:/download-task
       */
      addDownloadTask: (data, params = {}) => this.request({
        path: `/download-task`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addDownloadTask
       * @name addDownloadTaskUrl
       */
      addDownloadTaskUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/download-task`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags DownloadTask
       * @name DeleteDownloadTasks
       * @request DELETE:/download-task
       */
      deleteDownloadTasks: (data, params = {}) => this.request({
        path: `/download-task`,
        method: "DELETE",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for deleteDownloadTasks
       * @name deleteDownloadTasksUrl
       */
      deleteDownloadTasksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/download-task`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags DownloadTask
       * @name GetDownloadTask
       * @request GET:/download-task/{id}
       */
      getDownloadTask: (id2, params = {}) => this.request({
        path: `/download-task/${id2}`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags DownloadTask
       * @name DeleteDownloadTask
       * @request DELETE:/download-task/{id}
       */
      deleteDownloadTask: (id2, params = {}) => this.request({
        path: `/download-task/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags DownloadTask
       * @name PutDownloadTask
       * @request PUT:/download-task/{id}
       */
      putDownloadTask: (id2, data, params = {}) => this.request({
        path: `/download-task/${id2}`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags DownloadTask
       * @name StartDownloadTasks
       * @request POST:/download-task/download
       */
      startDownloadTasks: (data, params = {}) => this.request({
        path: `/download-task/download`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for startDownloadTasks
       * @name startDownloadTasksUrl
       */
      startDownloadTasksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/download-task/download`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags DownloadTask
       * @name StopDownloadTasks
       * @request DELETE:/download-task/download
       */
      stopDownloadTasks: (data, params = {}) => this.request({
        path: `/download-task/download`,
        method: "DELETE",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for stopDownloadTasks
       * @name stopDownloadTasksUrl
       */
      stopDownloadTasksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/download-task/download`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags DownloadTask
       * @name ClearDownloadTaskCheckpoints
       * @request DELETE:/download-task/checkpoint
       */
      clearDownloadTaskCheckpoints: (data, params = {}) => this.request({
        path: `/download-task/checkpoint`,
        method: "DELETE",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for clearDownloadTaskCheckpoints
       * @name clearDownloadTaskCheckpointsUrl
       */
      clearDownloadTaskCheckpointsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/download-task/checkpoint`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags DownloadTask
       * @name ExportAllDownloadTasks
       * @request GET:/download-task/xlsx
       */
      exportAllDownloadTasks: (params = {}) => this.request({
        path: `/download-task/xlsx`,
        method: "GET",
        ...params
      }),
      /**
       * @description Build URL for exportAllDownloadTasks
       * @name exportAllDownloadTasksUrl
       */
      exportAllDownloadTasksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/download-task/xlsx`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags DownloadTask
       * @name GetDownloaderOptions
       * @request GET:/download-task/downloader/options/{thirdPartyId}
       */
      getDownloaderOptions: (thirdPartyId, query, params = {}) => this.request({
        path: `/download-task/downloader/options/${thirdPartyId}`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags DownloadTask
       * @name PutDownloaderOptions
       * @request PUT:/download-task/downloader/options/{thirdPartyId}
       */
      putDownloaderOptions: (thirdPartyId, data, query, params = {}) => this.request({
        path: `/download-task/downloader/options/${thirdPartyId}`,
        method: "PUT",
        query,
        body: data,
        type: "application/json",
        format: "json",
        ...params
      })
    });
    __publicField(this, "resource", {
      /**
       * No description
       *
       * @tags Enhancement
       * @name GetResourceEnhancements
       * @request GET:/resource/{resourceId}/enhancement
       */
      getResourceEnhancements: (resourceId, query, params = {}) => this.request({
        path: `/resource/${resourceId}/enhancement`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Enhancement
       * @name DeleteResourceEnhancement
       * @request DELETE:/resource/{resourceId}/enhancer/{enhancerId}/enhancement
       */
      deleteResourceEnhancement: (resourceId, enhancerId, params = {}) => this.request({
        path: `/resource/${resourceId}/enhancer/${enhancerId}/enhancement`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Enhancement
       * @name EnhanceResourceByEnhancer
       * @request POST:/resource/{resourceId}/enhancer/{enhancerId}/enhancement
       */
      enhanceResourceByEnhancer: (resourceId, enhancerId, params = {}) => this.request({
        path: `/resource/${resourceId}/enhancer/${enhancerId}/enhancement`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Enhancement
       * @name ApplyEnhancementContextDataForResourceByEnhancer
       * @request POST:/resource/{resourceId}/enhancer/{enhancerId}/enhancement/apply
       */
      applyEnhancementContextDataForResourceByEnhancer: (resourceId, enhancerId, params = {}) => this.request({
        path: `/resource/${resourceId}/enhancer/${enhancerId}/enhancement/apply`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name GetSearchOperationsForProperty
       * @request GET:/resource/search-operation
       */
      getSearchOperationsForProperty: (query, params = {}) => this.request({
        path: `/resource/search-operation`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getSearchOperationsForProperty
       * @name getSearchOperationsForPropertyUrl
       */
      getSearchOperationsForPropertyUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/search-operation`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name GetFilterValueProperty
       * @request GET:/resource/filter-value-property
       */
      getFilterValueProperty: (query, params = {}) => this.request({
        path: `/resource/filter-value-property`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getFilterValueProperty
       * @name getFilterValuePropertyUrl
       */
      getFilterValuePropertyUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/filter-value-property`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name GetLastResourceSearch
       * @request GET:/resource/last-search
       */
      getLastResourceSearch: (params = {}) => this.request({
        path: `/resource/last-search`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getLastResourceSearch
       * @name getLastResourceSearchUrl
       */
      getLastResourceSearchUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/last-search`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name SaveNewResourceSearch
       * @request POST:/resource/saved-search
       */
      saveNewResourceSearch: (data, params = {}) => this.request({
        path: `/resource/saved-search`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for saveNewResourceSearch
       * @name saveNewResourceSearchUrl
       */
      saveNewResourceSearchUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/saved-search`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name PutSavedSearchName
       * @request PUT:/resource/saved-search
       */
      putSavedSearchName: (data, query, params = {}) => this.request({
        path: `/resource/saved-search`,
        method: "PUT",
        query,
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for putSavedSearchName
       * @name putSavedSearchNameUrl
       */
      putSavedSearchNameUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/saved-search`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name GetSavedSearch
       * @request GET:/resource/saved-search
       */
      getSavedSearch: (query, params = {}) => this.request({
        path: `/resource/saved-search`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getSavedSearch
       * @name getSavedSearchUrl
       */
      getSavedSearchUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/saved-search`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name DeleteSavedSearch
       * @request DELETE:/resource/saved-search
       */
      deleteSavedSearch: (query, params = {}) => this.request({
        path: `/resource/saved-search`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for deleteSavedSearch
       * @name deleteSavedSearchUrl
       */
      deleteSavedSearchUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/saved-search`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name SearchResources
       * @request POST:/resource/search
       */
      searchResources: (data, query, params = {}) => this.request({
        path: `/resource/search`,
        method: "POST",
        query,
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for searchResources
       * @name searchResourcesUrl
       */
      searchResourcesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/search`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name SearchAllResourceIds
       * @request POST:/resource/search/ids
       */
      searchAllResourceIds: (data, params = {}) => this.request({
        path: `/resource/search/ids`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for searchAllResourceIds
       * @name searchAllResourceIdsUrl
       */
      searchAllResourceIdsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/search/ids`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name GetResourcesByKeys
       * @request GET:/resource/keys
       */
      getResourcesByKeys: (query, params = {}) => this.request({
        path: `/resource/keys`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getResourcesByKeys
       * @name getResourcesByKeysUrl
       */
      getResourcesByKeysUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/keys`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name OpenResourceDirectory
       * @request GET:/resource/directory
       */
      openResourceDirectory: (query, params = {}) => this.request({
        path: `/resource/directory`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for openResourceDirectory
       * @name openResourceDirectoryUrl
       */
      openResourceDirectoryUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/directory`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name DiscoverResourceCover
       * @request GET:/resource/{id}/cover
       */
      discoverResourceCover: (id2, params = {}) => this.request({
        path: `/resource/${id2}/cover`,
        method: "GET",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name SaveCover
       * @request PUT:/resource/{id}/cover
       */
      saveCover: (id2, data, params = {}) => this.request({
        path: `/resource/${id2}/cover`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name GetResourcePlayableFiles
       * @request GET:/resource/{id}/playable-files
       */
      getResourcePlayableFiles: (id2, params = {}) => this.request({
        path: `/resource/${id2}/playable-files`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name MoveResources
       * @request PUT:/resource/move
       */
      moveResources: (data, params = {}) => this.request({
        path: `/resource/move`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for moveResources
       * @name moveResourcesUrl
       */
      moveResourcesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/move`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name GetResourceDataForPreviewer
       * @request GET:/resource/{id}/previewer
       */
      getResourceDataForPreviewer: (id2, params = {}) => this.request({
        path: `/resource/${id2}/previewer`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name PutResourcePropertyValue
       * @request PUT:/resource/{id}/property-value
       */
      putResourcePropertyValue: (id2, data, params = {}) => this.request({
        path: `/resource/${id2}/property-value`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name PlayResourceFile
       * @request GET:/resource/{resourceId}/play
       */
      playResourceFile: (resourceId, query, params = {}) => this.request({
        path: `/resource/${resourceId}/play`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name DeleteResourcesByKeys
       * @request DELETE:/resource/ids
       */
      deleteResourcesByKeys: (query, params = {}) => this.request({
        path: `/resource/ids`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for deleteResourcesByKeys
       * @name deleteResourcesByKeysUrl
       */
      deleteResourcesByKeysUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/ids`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name GetUnknownResources
       * @request GET:/resource/unknown
       */
      getUnknownResources: (query, params = {}) => this.request({
        path: `/resource/unknown`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getUnknownResources
       * @name getUnknownResourcesUrl
       */
      getUnknownResourcesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/unknown`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name DeleteUnknownResources
       * @request DELETE:/resource/unknown
       */
      deleteUnknownResources: (query, params = {}) => this.request({
        path: `/resource/unknown`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for deleteUnknownResources
       * @name deleteUnknownResourcesUrl
       */
      deleteUnknownResourcesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/unknown`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name GetUnknownResourcesCount
       * @request GET:/resource/unknown/count
       */
      getUnknownResourcesCount: (params = {}) => this.request({
        path: `/resource/unknown/count`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getUnknownResourcesCount
       * @name getUnknownResourcesCountUrl
       */
      getUnknownResourcesCountUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/unknown/count`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name PinResource
       * @request PUT:/resource/{id}/pin
       */
      pinResource: (id2, query, params = {}) => this.request({
        path: `/resource/${id2}/pin`,
        method: "PUT",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name TransferResourceData
       * @request PUT:/resource/transfer
       */
      transferResourceData: (data, params = {}) => this.request({
        path: `/resource/transfer`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for transferResourceData
       * @name transferResourceDataUrl
       */
      transferResourceDataUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/transfer`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name SearchResourcePaths
       * @request GET:/resource/paths
       */
      searchResourcePaths: (query, params = {}) => this.request({
        path: `/resource/paths`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for searchResourcePaths
       * @name searchResourcePathsUrl
       */
      searchResourcePathsUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/paths`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name MarkResourceAsNotPlayed
       * @request DELETE:/resource/{id}/played-at
       */
      markResourceAsNotPlayed: (id2, params = {}) => this.request({
        path: `/resource/${id2}/played-at`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name GetResourceSearchKeywordRecommendation
       * @request GET:/resource/search/keyword-recommendation
       */
      getResourceSearchKeywordRecommendation: (query, params = {}) => this.request({
        path: `/resource/search/keyword-recommendation`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getResourceSearchKeywordRecommendation
       * @name getResourceSearchKeywordRecommendationUrl
       */
      getResourceSearchKeywordRecommendationUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/search/keyword-recommendation`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      }
    });
    __publicField(this, "mediaLibrary", {
      /**
       * No description
       *
       * @tags Enhancement
       * @name DeleteByEnhancementsMediaLibrary
       * @request DELETE:/media-library/{mediaLibraryId}/enhancement
       */
      deleteByEnhancementsMediaLibrary: (mediaLibraryId, query, params = {}) => this.request({
        path: `/media-library/${mediaLibraryId}/enhancement`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Enhancement
       * @name DeleteEnhancementsByMediaLibraryAndEnhancer
       * @request DELETE:/media-library/{mediaLibraryId}/enhancer/{enhancerId}/enhancements
       */
      deleteEnhancementsByMediaLibraryAndEnhancer: (mediaLibraryId, enhancerId, query, params = {}) => this.request({
        path: `/media-library/${mediaLibraryId}/enhancer/${enhancerId}/enhancements`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Enhancement
       * @name GetEnhancedResourceCountsByMediaLibrary
       * @request GET:/media-library/{mediaLibraryId}/enhancer/enhanced-counts
       */
      getEnhancedResourceCountsByMediaLibrary: (mediaLibraryId, params = {}) => this.request({
        path: `/media-library/${mediaLibraryId}/enhancer/enhanced-counts`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name GetAllMediaLibraries
       * @request GET:/media-library
       * @deprecated
       */
      getAllMediaLibraries: (query, params = {}) => this.request({
        path: `/media-library`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllMediaLibraries
       * @name getAllMediaLibrariesUrl
       */
      getAllMediaLibrariesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name AddMediaLibrary
       * @request POST:/media-library
       * @deprecated
       */
      addMediaLibrary: (data, params = {}) => this.request({
        path: `/media-library`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addMediaLibrary
       * @name addMediaLibraryUrl
       */
      addMediaLibraryUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name GetMediaLibrary
       * @request GET:/media-library/{id}
       * @deprecated
       */
      getMediaLibrary: (id2, query, params = {}) => this.request({
        path: `/media-library/${id2}`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name DeleteMediaLibrary
       * @request DELETE:/media-library/{id}
       * @deprecated
       */
      deleteMediaLibrary: (id2, params = {}) => this.request({
        path: `/media-library/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name PatchMediaLibrary
       * @request PUT:/media-library/{id}
       * @deprecated
       */
      patchMediaLibrary: (id2, data, params = {}) => this.request({
        path: `/media-library/${id2}`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name StartSyncMediaLibrary
       * @request PUT:/media-library/sync
       * @deprecated
       */
      startSyncMediaLibrary: (params = {}) => this.request({
        path: `/media-library/sync`,
        method: "PUT",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for startSyncMediaLibrary
       * @name startSyncMediaLibraryUrl
       */
      startSyncMediaLibraryUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library/sync`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name ValidatePathConfiguration
       * @request POST:/media-library/path-configuration-validation
       * @deprecated
       */
      validatePathConfiguration: (data, params = {}) => this.request({
        path: `/media-library/path-configuration-validation`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for validatePathConfiguration
       * @name validatePathConfigurationUrl
       */
      validatePathConfigurationUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library/path-configuration-validation`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name SortMediaLibrariesInCategory
       * @request PUT:/media-library/orders-in-category
       * @deprecated
       */
      sortMediaLibrariesInCategory: (data, params = {}) => this.request({
        path: `/media-library/orders-in-category`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for sortMediaLibrariesInCategory
       * @name sortMediaLibrariesInCategoryUrl
       */
      sortMediaLibrariesInCategoryUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library/orders-in-category`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name AddMediaLibraryPathConfiguration
       * @request POST:/media-library/{id}/path-configuration
       * @deprecated
       */
      addMediaLibraryPathConfiguration: (id2, data, params = {}) => this.request({
        path: `/media-library/${id2}/path-configuration`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name RemoveMediaLibraryPathConfiguration
       * @request DELETE:/media-library/{id}/path-configuration
       * @deprecated
       */
      removeMediaLibraryPathConfiguration: (id2, data, params = {}) => this.request({
        path: `/media-library/${id2}/path-configuration`,
        method: "DELETE",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name AddMediaLibrariesInBulk
       * @request POST:/media-library/bulk-add/{cId}
       * @deprecated
       */
      addMediaLibrariesInBulk: (cId, data, params = {}) => this.request({
        path: `/media-library/bulk-add/${cId}`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name AddMediaLibraryRootPathsInBulk
       * @request POST:/media-library/{mlId}/path-configuration/root-paths
       * @deprecated
       */
      addMediaLibraryRootPathsInBulk: (mlId, data, params = {}) => this.request({
        path: `/media-library/${mlId}/path-configuration/root-paths`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name StartSyncingMediaLibraryResources
       * @request PUT:/media-library/{id}/synchronization
       * @deprecated
       */
      startSyncingMediaLibraryResources: (id2, params = {}) => this.request({
        path: `/media-library/${id2}/synchronization`,
        method: "PUT",
        format: "json",
        ...params
      })
    });
    __publicField(this, "mediaLibraryTemplate", {
      /**
       * No description
       *
       * @tags Enhancement
       * @name DeleteEnhancementsByMediaLibraryTemplateAndEnhancer
       * @request DELETE:/media-library-template/{mediaLibraryTemplateId}/enhancer/{enhancerId}/enhancements
       */
      deleteEnhancementsByMediaLibraryTemplateAndEnhancer: (mediaLibraryTemplateId, enhancerId, query, params = {}) => this.request({
        path: `/media-library-template/${mediaLibraryTemplateId}/enhancer/${enhancerId}/enhancements`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name GetAllMediaLibraryTemplates
       * @request GET:/media-library-template
       */
      getAllMediaLibraryTemplates: (query, params = {}) => this.request({
        path: `/media-library-template`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllMediaLibraryTemplates
       * @name getAllMediaLibraryTemplatesUrl
       */
      getAllMediaLibraryTemplatesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-template`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name AddMediaLibraryTemplate
       * @request POST:/media-library-template
       */
      addMediaLibraryTemplate: (data, params = {}) => this.request({
        path: `/media-library-template`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addMediaLibraryTemplate
       * @name addMediaLibraryTemplateUrl
       */
      addMediaLibraryTemplateUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-template`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name GetMediaLibraryTemplate
       * @request GET:/media-library-template/{id}
       */
      getMediaLibraryTemplate: (id2, query, params = {}) => this.request({
        path: `/media-library-template/${id2}`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name PutMediaLibraryTemplate
       * @request PUT:/media-library-template/{id}
       */
      putMediaLibraryTemplate: (id2, data, params = {}) => this.request({
        path: `/media-library-template/${id2}`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name DeleteMediaLibraryTemplate
       * @request DELETE:/media-library-template/{id}
       */
      deleteMediaLibraryTemplate: (id2, params = {}) => this.request({
        path: `/media-library-template/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name GetMediaLibraryTemplateShareCode
       * @request GET:/media-library-template/{id}/share-text
       */
      getMediaLibraryTemplateShareCode: (id2, params = {}) => this.request({
        path: `/media-library-template/${id2}/share-text`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name GetMediaLibraryTemplateImportConfiguration
       * @request POST:/media-library-template/share-code/import-configuration
       */
      getMediaLibraryTemplateImportConfiguration: (data, params = {}) => this.request({
        path: `/media-library-template/share-code/import-configuration`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getMediaLibraryTemplateImportConfiguration
       * @name getMediaLibraryTemplateImportConfigurationUrl
       */
      getMediaLibraryTemplateImportConfigurationUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-template/share-code/import-configuration`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name ImportMediaLibraryTemplate
       * @request POST:/media-library-template/share-code/import
       */
      importMediaLibraryTemplate: (data, params = {}) => this.request({
        path: `/media-library-template/share-code/import`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for importMediaLibraryTemplate
       * @name importMediaLibraryTemplateUrl
       */
      importMediaLibraryTemplateUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-template/share-code/import`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name AddMediaLibraryTemplateByMediaLibraryV1
       * @request POST:/media-library-template/by-media-library-v1
       */
      addMediaLibraryTemplateByMediaLibraryV1: (data, params = {}) => this.request({
        path: `/media-library-template/by-media-library-v1`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addMediaLibraryTemplateByMediaLibraryV1
       * @name addMediaLibraryTemplateByMediaLibraryV1Url
       */
      addMediaLibraryTemplateByMediaLibraryV1Url: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-template/by-media-library-v1`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name DuplicateMediaLibraryTemplate
       * @request POST:/media-library-template/{id}/duplicate
       */
      duplicateMediaLibraryTemplate: (id2, params = {}) => this.request({
        path: `/media-library-template/${id2}/duplicate`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name GetMediaLibraryTemplatePresetDataPool
       * @request GET:/media-library-template/preset-data-pool
       */
      getMediaLibraryTemplatePresetDataPool: (params = {}) => this.request({
        path: `/media-library-template/preset-data-pool`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getMediaLibraryTemplatePresetDataPool
       * @name getMediaLibraryTemplatePresetDataPoolUrl
       */
      getMediaLibraryTemplatePresetDataPoolUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-template/preset-data-pool`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name AddMediaLibraryTemplateFromPresetBuilder
       * @request POST:/media-library-template/from-preset-builder
       */
      addMediaLibraryTemplateFromPresetBuilder: (data, params = {}) => this.request({
        path: `/media-library-template/from-preset-builder`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addMediaLibraryTemplateFromPresetBuilder
       * @name addMediaLibraryTemplateFromPresetBuilderUrl
       */
      addMediaLibraryTemplateFromPresetBuilderUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-template/from-preset-builder`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name ValidateMediaLibraryTemplate
       * @request POST:/media-library-template/{id}/validate
       */
      validateMediaLibraryTemplate: (id2, data, params = {}) => this.request({
        path: `/media-library-template/${id2}/validate`,
        method: "POST",
        body: data,
        type: "application/json",
        ...params
      })
    });
    __publicField(this, "enhancer", {
      /**
       * No description
       *
       * @tags Enhancement
       * @name DeleteEnhancementsByEnhancer
       * @request DELETE:/enhancer/{enhancerId}/enhancement
       */
      deleteEnhancementsByEnhancer: (enhancerId, query, params = {}) => this.request({
        path: `/enhancer/${enhancerId}/enhancement`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Enhancer
       * @name GetAllEnhancerDescriptors
       * @request GET:/enhancer/descriptor
       */
      getAllEnhancerDescriptors: (params = {}) => this.request({
        path: `/enhancer/descriptor`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllEnhancerDescriptors
       * @name getAllEnhancerDescriptorsUrl
       */
      getAllEnhancerDescriptorsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/enhancer/descriptor`;
        return baseUrl + path;
      }
    });
    __publicField(this, "extensionGroup", {
      /**
       * No description
       *
       * @tags ExtensionGroup
       * @name GetAllExtensionGroups
       * @request GET:/extension-group
       */
      getAllExtensionGroups: (params = {}) => this.request({
        path: `/extension-group`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllExtensionGroups
       * @name getAllExtensionGroupsUrl
       */
      getAllExtensionGroupsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/extension-group`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags ExtensionGroup
       * @name AddExtensionGroup
       * @request POST:/extension-group
       */
      addExtensionGroup: (data, params = {}) => this.request({
        path: `/extension-group`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addExtensionGroup
       * @name addExtensionGroupUrl
       */
      addExtensionGroupUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/extension-group`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags ExtensionGroup
       * @name GetExtensionGroup
       * @request GET:/extension-group/{id}
       */
      getExtensionGroup: (id2, params = {}) => this.request({
        path: `/extension-group/${id2}`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags ExtensionGroup
       * @name PutExtensionGroup
       * @request PUT:/extension-group/{id}
       */
      putExtensionGroup: (id2, data, params = {}) => this.request({
        path: `/extension-group/${id2}`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags ExtensionGroup
       * @name DeleteExtensionGroup
       * @request DELETE:/extension-group/{id}
       */
      deleteExtensionGroup: (id2, params = {}) => this.request({
        path: `/extension-group/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      })
    });
    __publicField(this, "file", {
      /**
       * No description
       *
       * @tags File
       * @name DetectCompressedFiles
       * @request POST:/file/decompression/detect
       */
      detectCompressedFiles: (data, params = {}) => this.request({
        path: `/file/decompression/detect`,
        method: "POST",
        body: data,
        type: "application/json",
        ...params
      }),
      /**
       * @description Build URL for detectCompressedFiles
       * @name detectCompressedFilesUrl
       */
      detectCompressedFilesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/decompression/detect`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name DecompressCompressedFiles
       * @request POST:/file/decompression/decompress
       */
      decompressCompressedFiles: (data, params = {}) => this.request({
        path: `/file/decompression/decompress`,
        method: "POST",
        body: data,
        type: "application/json",
        ...params
      }),
      /**
       * @description Build URL for decompressCompressedFiles
       * @name decompressCompressedFilesUrl
       */
      decompressCompressedFilesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/decompression/decompress`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetTopLevelFileSystemEntryNames
       * @request GET:/file/top-level-file-system-entries
       */
      getTopLevelFileSystemEntryNames: (query, params = {}) => this.request({
        path: `/file/top-level-file-system-entries`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getTopLevelFileSystemEntryNames
       * @name getTopLevelFileSystemEntryNamesUrl
       */
      getTopLevelFileSystemEntryNamesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/top-level-file-system-entries`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name SearchFileSystemEntries
       * @request GET:/file/search-fs-entries
       */
      searchFileSystemEntries: (query, params = {}) => this.request({
        path: `/file/search-fs-entries`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for searchFileSystemEntries
       * @name searchFileSystemEntriesUrl
       */
      searchFileSystemEntriesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/search-fs-entries`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetIwFsInfo
       * @request GET:/file/iwfs-info
       */
      getIwFsInfo: (query, params = {}) => this.request({
        path: `/file/iwfs-info`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getIwFsInfo
       * @name getIwFsInfoUrl
       */
      getIwFsInfoUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/iwfs-info`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetIwFsEntry
       * @request GET:/file/iwfs-entry
       */
      getIwFsEntry: (query, params = {}) => this.request({
        path: `/file/iwfs-entry`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getIwFsEntry
       * @name getIwFsEntryUrl
       */
      getIwFsEntryUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/iwfs-entry`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name CreateDirectory
       * @request POST:/file/directory
       */
      createDirectory: (query, params = {}) => this.request({
        path: `/file/directory`,
        method: "POST",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for createDirectory
       * @name createDirectoryUrl
       */
      createDirectoryUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/directory`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetChildrenIwFsInfo
       * @request GET:/file/children/iwfs-info
       */
      getChildrenIwFsInfo: (query, params = {}) => this.request({
        path: `/file/children/iwfs-info`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getChildrenIwFsInfo
       * @name getChildrenIwFsInfoUrl
       */
      getChildrenIwFsInfoUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/children/iwfs-info`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name RemoveFiles
       * @request DELETE:/file
       */
      removeFiles: (data, params = {}) => this.request({
        path: `/file`,
        method: "DELETE",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for removeFiles
       * @name removeFilesUrl
       */
      removeFilesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name RenameFile
       * @request PUT:/file/name
       */
      renameFile: (data, params = {}) => this.request({
        path: `/file/name`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for renameFile
       * @name renameFileUrl
       */
      renameFileUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/name`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name OpenRecycleBin
       * @request GET:/file/recycle-bin
       */
      openRecycleBin: (params = {}) => this.request({
        path: `/file/recycle-bin`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for openRecycleBin
       * @name openRecycleBinUrl
       */
      openRecycleBinUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/recycle-bin`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name ExtractAndRemoveDirectory
       * @request POST:/file/extract-and-remove-directory
       */
      extractAndRemoveDirectory: (query, params = {}) => this.request({
        path: `/file/extract-and-remove-directory`,
        method: "POST",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for extractAndRemoveDirectory
       * @name extractAndRemoveDirectoryUrl
       */
      extractAndRemoveDirectoryUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/extract-and-remove-directory`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name MoveEntries
       * @request POST:/file/move-entries
       */
      moveEntries: (data, params = {}) => this.request({
        path: `/file/move-entries`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for moveEntries
       * @name moveEntriesUrl
       */
      moveEntriesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/move-entries`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetSameNameEntriesInWorkingDirectory
       * @request POST:/file/same-name-entries-in-working-directory
       */
      getSameNameEntriesInWorkingDirectory: (data, params = {}) => this.request({
        path: `/file/same-name-entries-in-working-directory`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getSameNameEntriesInWorkingDirectory
       * @name getSameNameEntriesInWorkingDirectoryUrl
       */
      getSameNameEntriesInWorkingDirectoryUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/same-name-entries-in-working-directory`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name RemoveSameNameEntryInWorkingDirectory
       * @request DELETE:/file/same-name-entry-in-working-directory
       */
      removeSameNameEntryInWorkingDirectory: (data, params = {}) => this.request({
        path: `/file/same-name-entry-in-working-directory`,
        method: "DELETE",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for removeSameNameEntryInWorkingDirectory
       * @name removeSameNameEntryInWorkingDirectoryUrl
       */
      removeSameNameEntryInWorkingDirectoryUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/same-name-entry-in-working-directory`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name StandardizeEntryName
       * @request PUT:/file/standardize
       */
      standardizeEntryName: (query, params = {}) => this.request({
        path: `/file/standardize`,
        method: "PUT",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for standardizeEntryName
       * @name standardizeEntryNameUrl
       */
      standardizeEntryNameUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/standardize`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name PlayFile
       * @request GET:/file/play
       */
      playFile: (query, params = {}) => this.request({
        path: `/file/play`,
        method: "GET",
        query,
        ...params
      }),
      /**
       * @description Build URL for playFile
       * @name playFileUrl
       */
      playFileUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/play`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name DecompressFiles
       * @request POST:/file/decompression
       */
      decompressFiles: (data, params = {}) => this.request({
        path: `/file/decompression`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for decompressFiles
       * @name decompressFilesUrl
       */
      decompressFilesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/decompression`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetIconData
       * @request GET:/file/icon
       */
      getIconData: (query, params = {}) => this.request({
        path: `/file/icon`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getIconData
       * @name getIconDataUrl
       */
      getIconDataUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/icon`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetAllFiles
       * @request GET:/file/all-files
       */
      getAllFiles: (query, params = {}) => this.request({
        path: `/file/all-files`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllFiles
       * @name getAllFilesUrl
       */
      getAllFilesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/all-files`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetCompressedFileEntries
       * @request GET:/file/compressed-file/entries
       */
      getCompressedFileEntries: (query, params = {}) => this.request({
        path: `/file/compressed-file/entries`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getCompressedFileEntries
       * @name getCompressedFileEntriesUrl
       */
      getCompressedFileEntriesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/compressed-file/entries`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetFileExtensionCounts
       * @request GET:/file/file-extension-counts
       */
      getFileExtensionCounts: (query, params = {}) => this.request({
        path: `/file/file-extension-counts`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getFileExtensionCounts
       * @name getFileExtensionCountsUrl
       */
      getFileExtensionCountsUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/file-extension-counts`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name PreviewFileSystemEntriesGroupResult
       * @request PUT:/file/group-preview
       */
      previewFileSystemEntriesGroupResult: (data, params = {}) => this.request({
        path: `/file/group-preview`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for previewFileSystemEntriesGroupResult
       * @name previewFileSystemEntriesGroupResultUrl
       */
      previewFileSystemEntriesGroupResultUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/group-preview`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GroupFileSystemEntries
       * @request PUT:/file/group
       */
      groupFileSystemEntries: (data, params = {}) => this.request({
        path: `/file/group`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for groupFileSystemEntries
       * @name groupFileSystemEntriesUrl
       */
      groupFileSystemEntriesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/group`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name StartWatchingChangesInFileProcessorWorkspace
       * @request POST:/file/file-processor-watcher
       */
      startWatchingChangesInFileProcessorWorkspace: (query, params = {}) => this.request({
        path: `/file/file-processor-watcher`,
        method: "POST",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for startWatchingChangesInFileProcessorWorkspace
       * @name startWatchingChangesInFileProcessorWorkspaceUrl
       */
      startWatchingChangesInFileProcessorWorkspaceUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/file-processor-watcher`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name StopWatchingChangesInFileProcessorWorkspace
       * @request DELETE:/file/file-processor-watcher
       */
      stopWatchingChangesInFileProcessorWorkspace: (params = {}) => this.request({
        path: `/file/file-processor-watcher`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for stopWatchingChangesInFileProcessorWorkspace
       * @name stopWatchingChangesInFileProcessorWorkspaceUrl
       */
      stopWatchingChangesInFileProcessorWorkspaceUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/file-processor-watcher`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name CheckPathIsFile
       * @request GET:/file/is-file
       */
      checkPathIsFile: (query, params = {}) => this.request({
        path: `/file/is-file`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for checkPathIsFile
       * @name checkPathIsFileUrl
       */
      checkPathIsFileUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/is-file`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetHardwareAccelerationInfo
       * @request GET:/file/hardware-acceleration
       */
      getHardwareAccelerationInfo: (params = {}) => this.request({
        path: `/file/hardware-acceleration`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getHardwareAccelerationInfo
       * @name getHardwareAccelerationInfoUrl
       */
      getHardwareAccelerationInfoUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/hardware-acceleration`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name ClearHardwareAccelerationCache
       * @request POST:/file/hardware-acceleration/clear-cache
       */
      clearHardwareAccelerationCache: (params = {}) => this.request({
        path: `/file/hardware-acceleration/clear-cache`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for clearHardwareAccelerationCache
       * @name clearHardwareAccelerationCacheUrl
       */
      clearHardwareAccelerationCacheUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/hardware-acceleration/clear-cache`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetFirstFileByExtension
       * @request GET:/file/first-file-by-ext
       */
      getFirstFileByExtension: (query, params = {}) => this.request({
        path: `/file/first-file-by-ext`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getFirstFileByExtension
       * @name getFirstFileByExtensionUrl
       */
      getFirstFileByExtensionUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/first-file-by-ext`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      }
    });
    __publicField(this, "fileNameModifier", {
      /**
       * No description
       *
       * @tags FileNameModifier
       * @name PreviewFileNameModification
       * @request POST:/file-name-modifier/preview
       */
      previewFileNameModification: (data, params = {}) => this.request({
        path: `/file-name-modifier/preview`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for previewFileNameModification
       * @name previewFileNameModificationUrl
       */
      previewFileNameModificationUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file-name-modifier/preview`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags FileNameModifier
       * @name ModifyFileNames
       * @request POST:/file-name-modifier/modify
       */
      modifyFileNames: (data, params = {}) => this.request({
        path: `/file-name-modifier/modify`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for modifyFileNames
       * @name modifyFileNamesUrl
       */
      modifyFileNamesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file-name-modifier/modify`;
        return baseUrl + path;
      }
    });
    __publicField(this, "gui", {
      /**
       * No description
       *
       * @tags Gui
       * @name OpenUrlInDefaultBrowser
       * @request GET:/gui/url
       */
      openUrlInDefaultBrowser: (query, params = {}) => this.request({
        path: `/gui/url`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for openUrlInDefaultBrowser
       * @name openUrlInDefaultBrowserUrl
       */
      openUrlInDefaultBrowserUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/gui/url`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      }
    });
    __publicField(this, "log", {
      /**
       * No description
       *
       * @tags Log
       * @name GetAllLogs
       * @request GET:/log
       */
      getAllLogs: (params = {}) => this.request({
        path: `/log`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllLogs
       * @name getAllLogsUrl
       */
      getAllLogsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/log`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Log
       * @name ClearAllLog
       * @request DELETE:/log
       */
      clearAllLog: (params = {}) => this.request({
        path: `/log`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for clearAllLog
       * @name clearAllLogUrl
       */
      clearAllLogUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/log`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Log
       * @name SearchLogs
       * @request GET:/log/filtered
       */
      searchLogs: (query, params = {}) => this.request({
        path: `/log/filtered`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for searchLogs
       * @name searchLogsUrl
       */
      searchLogsUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/log/filtered`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Log
       * @name GetUnreadLogCount
       * @request GET:/log/unread/count
       */
      getUnreadLogCount: (params = {}) => this.request({
        path: `/log/unread/count`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getUnreadLogCount
       * @name getUnreadLogCountUrl
       */
      getUnreadLogCountUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/log/unread/count`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Log
       * @name ReadLog
       * @request PATCH:/log/{id}/read
       */
      readLog: (id2, params = {}) => this.request({
        path: `/log/${id2}/read`,
        method: "PATCH",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Log
       * @name ReadAllLog
       * @request PATCH:/log/read
       */
      readAllLog: (params = {}) => this.request({
        path: `/log/read`,
        method: "PATCH",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for readAllLog
       * @name readAllLogUrl
       */
      readAllLogUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/log/read`;
        return baseUrl + path;
      }
    });
    __publicField(this, "mediaLibraryV2", {
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name GetAllMediaLibraryV2
       * @request GET:/media-library-v2
       */
      getAllMediaLibraryV2: (query, params = {}) => this.request({
        path: `/media-library-v2`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllMediaLibraryV2
       * @name getAllMediaLibraryV2Url
       */
      getAllMediaLibraryV2Url: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-v2`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name AddMediaLibraryV2
       * @request POST:/media-library-v2
       */
      addMediaLibraryV2: (data, params = {}) => this.request({
        path: `/media-library-v2`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addMediaLibraryV2
       * @name addMediaLibraryV2Url
       */
      addMediaLibraryV2Url: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-v2`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name SaveAllMediaLibrariesV2
       * @request PUT:/media-library-v2
       */
      saveAllMediaLibrariesV2: (data, params = {}) => this.request({
        path: `/media-library-v2`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for saveAllMediaLibrariesV2
       * @name saveAllMediaLibrariesV2Url
       */
      saveAllMediaLibrariesV2Url: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-v2`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name GetMediaLibraryV2
       * @request GET:/media-library-v2/{id}
       */
      getMediaLibraryV2: (id2, params = {}) => this.request({
        path: `/media-library-v2/${id2}`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name PutMediaLibraryV2
       * @request PUT:/media-library-v2/{id}
       */
      putMediaLibraryV2: (id2, data, params = {}) => this.request({
        path: `/media-library-v2/${id2}`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name PatchMediaLibraryV2
       * @request PATCH:/media-library-v2/{id}
       */
      patchMediaLibraryV2: (id2, data, params = {}) => this.request({
        path: `/media-library-v2/${id2}`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name DeleteMediaLibraryV2
       * @request DELETE:/media-library-v2/{id}
       */
      deleteMediaLibraryV2: (id2, params = {}) => this.request({
        path: `/media-library-v2/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name MarkMediaLibraryV2AsSynced
       * @request PATCH:/media-library-v2/mark-as-synced
       */
      markMediaLibraryV2AsSynced: (data, params = {}) => this.request({
        path: `/media-library-v2/mark-as-synced`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for markMediaLibraryV2AsSynced
       * @name markMediaLibraryV2AsSyncedUrl
       */
      markMediaLibraryV2AsSyncedUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-v2/mark-as-synced`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name SyncMediaLibraryV2
       * @request POST:/media-library-v2/{id}/sync
       */
      syncMediaLibraryV2: (id2, params = {}) => this.request({
        path: `/media-library-v2/${id2}/sync`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name SyncAllMediaLibrariesV2
       * @request POST:/media-library-v2/sync-all
       */
      syncAllMediaLibrariesV2: (params = {}) => this.request({
        path: `/media-library-v2/sync-all`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for syncAllMediaLibrariesV2
       * @name syncAllMediaLibrariesV2Url
       */
      syncAllMediaLibrariesV2Url: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-v2/sync-all`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name GetOutdatedMediaLibrariesV2
       * @request GET:/media-library-v2/outdated
       */
      getOutdatedMediaLibrariesV2: (params = {}) => this.request({
        path: `/media-library-v2/outdated`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getOutdatedMediaLibrariesV2
       * @name getOutdatedMediaLibrariesV2Url
       */
      getOutdatedMediaLibrariesV2Url: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-v2/outdated`;
        return baseUrl + path;
      }
    });
    __publicField(this, "migration", {
      /**
       * No description
       *
       * @tags Migration
       * @name MigrateCategoriesMediaLibrariesAndResourcesToNewMediaLibrary
       * @request POST:/migration/categories-media-libraries-and-resources-to-new-media-library
       */
      migrateCategoriesMediaLibrariesAndResourcesToNewMediaLibrary: (params = {}) => this.request({
        path: `/migration/categories-media-libraries-and-resources-to-new-media-library`,
        method: "POST",
        format: "json",
        ...params
      })
    });
    __publicField(this, "options", {
      /**
       * No description
       *
       * @tags Options
       * @name GetAppOptions
       * @request GET:/options/app
       */
      getAppOptions: (params = {}) => this.request({
        path: `/options/app`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAppOptions
       * @name getAppOptionsUrl
       */
      getAppOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/app`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchAppOptions
       * @request PATCH:/options/app
       */
      patchAppOptions: (data, params = {}) => this.request({
        path: `/options/app`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchAppOptions
       * @name patchAppOptionsUrl
       */
      patchAppOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/app`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PutAppOptions
       * @request PUT:/options/app
       */
      putAppOptions: (data, params = {}) => this.request({
        path: `/options/app`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for putAppOptions
       * @name putAppOptionsUrl
       */
      putAppOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/app`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetUiOptions
       * @request GET:/options/ui
       */
      getUiOptions: (params = {}) => this.request({
        path: `/options/ui`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getUiOptions
       * @name getUiOptionsUrl
       */
      getUiOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/ui`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchUiOptions
       * @request PATCH:/options/ui
       */
      patchUiOptions: (data, params = {}) => this.request({
        path: `/options/ui`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchUiOptions
       * @name patchUiOptionsUrl
       */
      patchUiOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/ui`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name AddLatestUsedProperty
       * @request POST:/options/ui/latest-used-property
       */
      addLatestUsedProperty: (data, params = {}) => this.request({
        path: `/options/ui/latest-used-property`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addLatestUsedProperty
       * @name addLatestUsedPropertyUrl
       */
      addLatestUsedPropertyUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/ui/latest-used-property`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetBilibiliOptions
       * @request GET:/options/bilibili
       */
      getBilibiliOptions: (params = {}) => this.request({
        path: `/options/bilibili`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getBilibiliOptions
       * @name getBilibiliOptionsUrl
       */
      getBilibiliOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/bilibili`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchBilibiliOptions
       * @request PATCH:/options/bilibili
       */
      patchBilibiliOptions: (data, params = {}) => this.request({
        path: `/options/bilibili`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchBilibiliOptions
       * @name patchBilibiliOptionsUrl
       */
      patchBilibiliOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/bilibili`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetExHentaiOptions
       * @request GET:/options/exhentai
       */
      getExHentaiOptions: (params = {}) => this.request({
        path: `/options/exhentai`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getExHentaiOptions
       * @name getExHentaiOptionsUrl
       */
      getExHentaiOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/exhentai`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchExHentaiOptions
       * @request PATCH:/options/exhentai
       */
      patchExHentaiOptions: (data, params = {}) => this.request({
        path: `/options/exhentai`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchExHentaiOptions
       * @name patchExHentaiOptionsUrl
       */
      patchExHentaiOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/exhentai`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetFileSystemOptions
       * @request GET:/options/filesystem
       */
      getFileSystemOptions: (params = {}) => this.request({
        path: `/options/filesystem`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getFileSystemOptions
       * @name getFileSystemOptionsUrl
       */
      getFileSystemOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/filesystem`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchFileSystemOptions
       * @request PATCH:/options/filesystem
       */
      patchFileSystemOptions: (data, params = {}) => this.request({
        path: `/options/filesystem`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchFileSystemOptions
       * @name patchFileSystemOptionsUrl
       */
      patchFileSystemOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/filesystem`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name AddLatestMovingDestination
       * @request PUT:/options/filesystem/latest-moving-destination
       */
      addLatestMovingDestination: (data, params = {}) => this.request({
        path: `/options/filesystem/latest-moving-destination`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addLatestMovingDestination
       * @name addLatestMovingDestinationUrl
       */
      addLatestMovingDestinationUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/filesystem/latest-moving-destination`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetJavLibraryOptions
       * @request GET:/options/javlibrary
       */
      getJavLibraryOptions: (params = {}) => this.request({
        path: `/options/javlibrary`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getJavLibraryOptions
       * @name getJavLibraryOptionsUrl
       */
      getJavLibraryOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/javlibrary`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchJavLibraryOptions
       * @request PATCH:/options/javlibrary
       */
      patchJavLibraryOptions: (data, params = {}) => this.request({
        path: `/options/javlibrary`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchJavLibraryOptions
       * @name patchJavLibraryOptionsUrl
       */
      patchJavLibraryOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/javlibrary`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetPixivOptions
       * @request GET:/options/pixiv
       */
      getPixivOptions: (params = {}) => this.request({
        path: `/options/pixiv`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getPixivOptions
       * @name getPixivOptionsUrl
       */
      getPixivOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/pixiv`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchPixivOptions
       * @request PATCH:/options/pixiv
       */
      patchPixivOptions: (data, params = {}) => this.request({
        path: `/options/pixiv`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchPixivOptions
       * @name patchPixivOptionsUrl
       */
      patchPixivOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/pixiv`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetResourceOptions
       * @request GET:/options/resource
       */
      getResourceOptions: (params = {}) => this.request({
        path: `/options/resource`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getResourceOptions
       * @name getResourceOptionsUrl
       */
      getResourceOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/resource`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchResourceOptions
       * @request PATCH:/options/resource
       */
      patchResourceOptions: (data, params = {}) => this.request({
        path: `/options/resource`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchResourceOptions
       * @name patchResourceOptionsUrl
       */
      patchResourceOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/resource`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetRecentResourceFilters
       * @request GET:/options/resource/recent-filters
       */
      getRecentResourceFilters: (params = {}) => this.request({
        path: `/options/resource/recent-filters`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getRecentResourceFilters
       * @name getRecentResourceFiltersUrl
       */
      getRecentResourceFiltersUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/resource/recent-filters`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name AddRecentResourceFilter
       * @request POST:/options/resource/recent-filters
       */
      addRecentResourceFilter: (data, params = {}) => this.request({
        path: `/options/resource/recent-filters`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addRecentResourceFilter
       * @name addRecentResourceFilterUrl
       */
      addRecentResourceFilterUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/resource/recent-filters`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetThirdPartyOptions
       * @request GET:/options/thirdparty
       */
      getThirdPartyOptions: (params = {}) => this.request({
        path: `/options/thirdparty`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getThirdPartyOptions
       * @name getThirdPartyOptionsUrl
       */
      getThirdPartyOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/thirdparty`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchThirdPartyOptions
       * @request PATCH:/options/thirdparty
       */
      patchThirdPartyOptions: (data, params = {}) => this.request({
        path: `/options/thirdparty`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchThirdPartyOptions
       * @name patchThirdPartyOptionsUrl
       */
      patchThirdPartyOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/thirdparty`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PutThirdPartyOptions
       * @request PUT:/options/thirdparty
       */
      putThirdPartyOptions: (data, params = {}) => this.request({
        path: `/options/thirdparty`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for putThirdPartyOptions
       * @name putThirdPartyOptionsUrl
       */
      putThirdPartyOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/thirdparty`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetNetworkOptions
       * @request GET:/options/network
       */
      getNetworkOptions: (params = {}) => this.request({
        path: `/options/network`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getNetworkOptions
       * @name getNetworkOptionsUrl
       */
      getNetworkOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/network`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchNetworkOptions
       * @request PATCH:/options/network
       */
      patchNetworkOptions: (data, params = {}) => this.request({
        path: `/options/network`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchNetworkOptions
       * @name patchNetworkOptionsUrl
       */
      patchNetworkOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/network`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetEnhancerOptions
       * @request GET:/options/enhancer
       */
      getEnhancerOptions: (params = {}) => this.request({
        path: `/options/enhancer`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getEnhancerOptions
       * @name getEnhancerOptionsUrl
       */
      getEnhancerOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/enhancer`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchEnhancerOptions
       * @request PATCH:/options/enhancer
       */
      patchEnhancerOptions: (data, params = {}) => this.request({
        path: `/options/enhancer`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchEnhancerOptions
       * @name patchEnhancerOptionsUrl
       */
      patchEnhancerOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/enhancer`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetTaskOptions
       * @request GET:/options/task
       */
      getTaskOptions: (params = {}) => this.request({
        path: `/options/task`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getTaskOptions
       * @name getTaskOptionsUrl
       */
      getTaskOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/task`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchTaskOptions
       * @request PATCH:/options/task
       */
      patchTaskOptions: (data, params = {}) => this.request({
        path: `/options/task`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchTaskOptions
       * @name patchTaskOptionsUrl
       */
      patchTaskOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/task`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetAiOptions
       * @request GET:/options/ai
       */
      getAiOptions: (params = {}) => this.request({
        path: `/options/ai`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAiOptions
       * @name getAiOptionsUrl
       */
      getAiOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/ai`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchAiOptions
       * @request PATCH:/options/ai
       */
      patchAiOptions: (data, params = {}) => this.request({
        path: `/options/ai`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchAiOptions
       * @name patchAiOptionsUrl
       */
      patchAiOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/ai`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PutAiOptions
       * @request PUT:/options/ai
       */
      putAiOptions: (data, params = {}) => this.request({
        path: `/options/ai`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for putAiOptions
       * @name putAiOptionsUrl
       */
      putAiOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/ai`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetSoulPlusOptions
       * @request GET:/options/soulplus
       */
      getSoulPlusOptions: (params = {}) => this.request({
        path: `/options/soulplus`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getSoulPlusOptions
       * @name getSoulPlusOptionsUrl
       */
      getSoulPlusOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/soulplus`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchSoulPlusOptions
       * @request PATCH:/options/soulplus
       */
      patchSoulPlusOptions: (data, params = {}) => this.request({
        path: `/options/soulplus`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchSoulPlusOptions
       * @name patchSoulPlusOptionsUrl
       */
      patchSoulPlusOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/soulplus`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PutSoulPlusOptions
       * @request PUT:/options/soulplus
       */
      putSoulPlusOptions: (data, params = {}) => this.request({
        path: `/options/soulplus`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for putSoulPlusOptions
       * @name putSoulPlusOptionsUrl
       */
      putSoulPlusOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/soulplus`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetBangumiOptions
       * @request GET:/options/bangumi
       */
      getBangumiOptions: (params = {}) => this.request({
        path: `/options/bangumi`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getBangumiOptions
       * @name getBangumiOptionsUrl
       */
      getBangumiOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/bangumi`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchBangumiOptions
       * @request PATCH:/options/bangumi
       */
      patchBangumiOptions: (data, params = {}) => this.request({
        path: `/options/bangumi`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchBangumiOptions
       * @name patchBangumiOptionsUrl
       */
      patchBangumiOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/bangumi`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetCienOptions
       * @request GET:/options/cien
       */
      getCienOptions: (params = {}) => this.request({
        path: `/options/cien`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getCienOptions
       * @name getCienOptionsUrl
       */
      getCienOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/cien`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchCienOptions
       * @request PATCH:/options/cien
       */
      patchCienOptions: (data, params = {}) => this.request({
        path: `/options/cien`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchCienOptions
       * @name patchCienOptionsUrl
       */
      patchCienOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/cien`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetDLsiteOptions
       * @request GET:/options/dlsite
       */
      getDLsiteOptions: (params = {}) => this.request({
        path: `/options/dlsite`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getDLsiteOptions
       * @name getDLsiteOptionsUrl
       */
      getDLsiteOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/dlsite`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchDLsiteOptions
       * @request PATCH:/options/dlsite
       */
      patchDLsiteOptions: (data, params = {}) => this.request({
        path: `/options/dlsite`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchDLsiteOptions
       * @name patchDLsiteOptionsUrl
       */
      patchDLsiteOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/dlsite`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetFanboxOptions
       * @request GET:/options/fanbox
       */
      getFanboxOptions: (params = {}) => this.request({
        path: `/options/fanbox`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getFanboxOptions
       * @name getFanboxOptionsUrl
       */
      getFanboxOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/fanbox`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchFanboxOptions
       * @request PATCH:/options/fanbox
       */
      patchFanboxOptions: (data, params = {}) => this.request({
        path: `/options/fanbox`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchFanboxOptions
       * @name patchFanboxOptionsUrl
       */
      patchFanboxOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/fanbox`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetFantiaOptions
       * @request GET:/options/fantia
       */
      getFantiaOptions: (params = {}) => this.request({
        path: `/options/fantia`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getFantiaOptions
       * @name getFantiaOptionsUrl
       */
      getFantiaOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/fantia`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchFantiaOptions
       * @request PATCH:/options/fantia
       */
      patchFantiaOptions: (data, params = {}) => this.request({
        path: `/options/fantia`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchFantiaOptions
       * @name patchFantiaOptionsUrl
       */
      patchFantiaOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/fantia`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetPatreonOptions
       * @request GET:/options/patreon
       */
      getPatreonOptions: (params = {}) => this.request({
        path: `/options/patreon`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getPatreonOptions
       * @name getPatreonOptionsUrl
       */
      getPatreonOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/patreon`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchPatreonOptions
       * @request PATCH:/options/patreon
       */
      patchPatreonOptions: (data, params = {}) => this.request({
        path: `/options/patreon`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchPatreonOptions
       * @name patchPatreonOptionsUrl
       */
      patchPatreonOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/patreon`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetTmdbOptions
       * @request GET:/options/tmdb
       */
      getTmdbOptions: (params = {}) => this.request({
        path: `/options/tmdb`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getTmdbOptions
       * @name getTmdbOptionsUrl
       */
      getTmdbOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/tmdb`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchTmdbOptions
       * @request PATCH:/options/tmdb
       */
      patchTmdbOptions: (data, params = {}) => this.request({
        path: `/options/tmdb`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchTmdbOptions
       * @name patchTmdbOptionsUrl
       */
      patchTmdbOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/tmdb`;
        return baseUrl + path;
      }
    });
    __publicField(this, "password", {
      /**
       * No description
       *
       * @tags Password
       * @name SearchPasswords
       * @request GET:/password
       */
      searchPasswords: (query, params = {}) => this.request({
        path: `/password`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for searchPasswords
       * @name searchPasswordsUrl
       */
      searchPasswordsUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/password`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Password
       * @name GetAllPasswords
       * @request GET:/password/all
       */
      getAllPasswords: (params = {}) => this.request({
        path: `/password/all`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllPasswords
       * @name getAllPasswordsUrl
       */
      getAllPasswordsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/password/all`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Password
       * @name DeletePassword
       * @request DELETE:/password/{password}
       */
      deletePassword: (password, params = {}) => this.request({
        path: `/password/${password}`,
        method: "DELETE",
        format: "json",
        ...params
      })
    });
    __publicField(this, "playHistory", {
      /**
       * No description
       *
       * @tags PlayHistory
       * @name SearchPlayHistories
       * @request GET:/play-history
       */
      searchPlayHistories: (query, params = {}) => this.request({
        path: `/play-history`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for searchPlayHistories
       * @name searchPlayHistoriesUrl
       */
      searchPlayHistoriesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/play-history`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      }
    });
    __publicField(this, "playlist", {
      /**
       * No description
       *
       * @tags Playlist
       * @name GetPlaylist
       * @request GET:/playlist/{id}
       */
      getPlaylist: (id2, params = {}) => this.request({
        path: `/playlist/${id2}`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Playlist
       * @name PutPlaylist
       * @request PUT:/playlist/{id}
       */
      putPlaylist: (id2, data, params = {}) => this.request({
        path: `/playlist/${id2}`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Playlist
       * @name DeletePlaylist
       * @request DELETE:/playlist/{id}
       */
      deletePlaylist: (id2, params = {}) => this.request({
        path: `/playlist/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Playlist
       * @name PatchPlaylist
       * @request PATCH:/playlist/{id}
       */
      patchPlaylist: (id2, data, params = {}) => this.request({
        path: `/playlist/${id2}`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Playlist
       * @name GetAllPlaylists
       * @request GET:/playlist
       */
      getAllPlaylists: (params = {}) => this.request({
        path: `/playlist`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllPlaylists
       * @name getAllPlaylistsUrl
       */
      getAllPlaylistsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/playlist`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Playlist
       * @name AddPlaylist
       * @request POST:/playlist
       */
      addPlaylist: (data, params = {}) => this.request({
        path: `/playlist`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addPlaylist
       * @name addPlaylistUrl
       */
      addPlaylistUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/playlist`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Playlist
       * @name GetPlaylistFiles
       * @request GET:/playlist/{id}/files
       */
      getPlaylistFiles: (id2, params = {}) => this.request({
        path: `/playlist/${id2}/files`,
        method: "GET",
        format: "json",
        ...params
      })
    });
    __publicField(this, "postParser", {
      /**
       * No description
       *
       * @tags PostParser
       * @name GetAllPostParserTasks
       * @request GET:/post-parser/task/all
       */
      getAllPostParserTasks: (params = {}) => this.request({
        path: `/post-parser/task/all`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllPostParserTasks
       * @name getAllPostParserTasksUrl
       */
      getAllPostParserTasksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/post-parser/task/all`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags PostParser
       * @name DeleteAllPostParserTasks
       * @request DELETE:/post-parser/task/all
       */
      deleteAllPostParserTasks: (params = {}) => this.request({
        path: `/post-parser/task/all`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for deleteAllPostParserTasks
       * @name deleteAllPostParserTasksUrl
       */
      deleteAllPostParserTasksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/post-parser/task/all`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags PostParser
       * @name AddPostParserTasks
       * @request POST:/post-parser/task
       */
      addPostParserTasks: (data, params = {}) => this.request({
        path: `/post-parser/task`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addPostParserTasks
       * @name addPostParserTasksUrl
       */
      addPostParserTasksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/post-parser/task`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags PostParser
       * @name DeletePostParserTask
       * @request DELETE:/post-parser/task/{id}
       */
      deletePostParserTask: (id2, params = {}) => this.request({
        path: `/post-parser/task/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags PostParser
       * @name StartAllPostParserTasks
       * @request POST:/post-parser/start
       */
      startAllPostParserTasks: (params = {}) => this.request({
        path: `/post-parser/start`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for startAllPostParserTasks
       * @name startAllPostParserTasksUrl
       */
      startAllPostParserTasksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/post-parser/start`;
        return baseUrl + path;
      }
    });
    __publicField(this, "property", {
      /**
       * No description
       *
       * @tags Property
       * @name GetPropertiesByPool
       * @request GET:/property/pool/{pool}
       */
      getPropertiesByPool: (pool, params = {}) => this.request({
        path: `/property/pool/${pool}`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Property
       * @name GetAvailablePropertyTypesForManuallySettingValue
       * @request GET:/property/property-types-for-manually-setting-value
       */
      getAvailablePropertyTypesForManuallySettingValue: (params = {}) => this.request({
        path: `/property/property-types-for-manually-setting-value`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAvailablePropertyTypesForManuallySettingValue
       * @name getAvailablePropertyTypesForManuallySettingValueUrl
       */
      getAvailablePropertyTypesForManuallySettingValueUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/property/property-types-for-manually-setting-value`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Property
       * @name GetPropertyBizValue
       * @request GET:/property/pool/{pool}/id/{id}/biz-value
       */
      getPropertyBizValue: (pool, id2, query, params = {}) => this.request({
        path: `/property/pool/${pool}/id/${id2}/biz-value`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Property
       * @name GetPropertyDbValue
       * @request GET:/property/pool/{pool}/id/{id}/db-value
       */
      getPropertyDbValue: (pool, id2, query, params = {}) => this.request({
        path: `/property/pool/${pool}/id/${id2}/db-value`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Property
       * @name FindBestMatchingProperty
       * @request GET:/property/best-matching
       */
      findBestMatchingProperty: (query, params = {}) => this.request({
        path: `/property/best-matching`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for findBestMatchingProperty
       * @name findBestMatchingPropertyUrl
       */
      findBestMatchingPropertyUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/property/best-matching`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      }
    });
    __publicField(this, "specialText", {
      /**
       * No description
       *
       * @tags SpecialText
       * @name GetAllSpecialTexts
       * @request GET:/special-text
       */
      getAllSpecialTexts: (params = {}) => this.request({
        path: `/special-text`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllSpecialTexts
       * @name getAllSpecialTextsUrl
       */
      getAllSpecialTextsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/special-text`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags SpecialText
       * @name AddSpecialText
       * @request POST:/special-text
       */
      addSpecialText: (data, params = {}) => this.request({
        path: `/special-text`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addSpecialText
       * @name addSpecialTextUrl
       */
      addSpecialTextUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/special-text`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags SpecialText
       * @name DeleteSpecialText
       * @request DELETE:/special-text/{id}
       */
      deleteSpecialText: (id2, params = {}) => this.request({
        path: `/special-text/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags SpecialText
       * @name PatchSpecialText
       * @request PUT:/special-text/{id}
       */
      patchSpecialText: (id2, data, params = {}) => this.request({
        path: `/special-text/${id2}`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags SpecialText
       * @name AddSpecialTextPrefabs
       * @request POST:/special-text/prefabs
       */
      addSpecialTextPrefabs: (params = {}) => this.request({
        path: `/special-text/prefabs`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addSpecialTextPrefabs
       * @name addSpecialTextPrefabsUrl
       */
      addSpecialTextPrefabsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/special-text/prefabs`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags SpecialText
       * @name PretreatText
       * @request POST:/special-text/pretreatment
       */
      pretreatText: (query, params = {}) => this.request({
        path: `/special-text/pretreatment`,
        method: "POST",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for pretreatText
       * @name pretreatTextUrl
       */
      pretreatTextUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/special-text/pretreatment`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      }
    });
    __publicField(this, "tampermonkey", {
      /**
       * No description
       *
       * @tags Tampermonkey
       * @name InstallTampermonkeyScript
       * @request GET:/Tampermonkey/install
       */
      installTampermonkeyScript: (query, params = {}) => this.request({
        path: `/Tampermonkey/install`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for installTampermonkeyScript
       * @name installTampermonkeyScriptUrl
       */
      installTampermonkeyScriptUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/Tampermonkey/install`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Tampermonkey
       * @name GetTampermonkeyScript
       * @request GET:/Tampermonkey/script/{script}.user.js
       */
      getTampermonkeyScript: (script, params = {}) => this.request({
        path: `/Tampermonkey/script/${script}.user.js`,
        method: "GET",
        ...params
      })
    });
    __publicField(this, "thirdParty", {
      /**
       * No description
       *
       * @tags ThirdParty
       * @name GetAllThirdPartyRequestStatistics
       * @request GET:/third-party/request-statistics
       */
      getAllThirdPartyRequestStatistics: (params = {}) => this.request({
        path: `/third-party/request-statistics`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllThirdPartyRequestStatistics
       * @name getAllThirdPartyRequestStatisticsUrl
       */
      getAllThirdPartyRequestStatisticsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/third-party/request-statistics`;
        return baseUrl + path;
      }
    });
    __publicField(this, "tool", {
      /**
       * No description
       *
       * @tags Tool
       * @name OpenFileOrDirectory
       * @request GET:/tool/open
       */
      openFileOrDirectory: (query, params = {}) => this.request({
        path: `/tool/open`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for openFileOrDirectory
       * @name openFileOrDirectoryUrl
       */
      openFileOrDirectoryUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/tool/open`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Tool
       * @name TestList
       * @summary Test
       * @request GET:/tool/test
       */
      testList: (params = {}) => this.request({
        path: `/tool/test`,
        method: "GET",
        ...params
      }),
      /**
       * @description Build URL for testList
       * @name testListUrl
       */
      testListUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/tool/test`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Tool
       * @name ValidateCookie
       * @request GET:/tool/cookie-validation
       */
      validateCookie: (query, params = {}) => this.request({
        path: `/tool/cookie-validation`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for validateCookie
       * @name validateCookieUrl
       */
      validateCookieUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/tool/cookie-validation`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Tool
       * @name GetThumbnail
       * @request GET:/tool/thumbnail
       */
      getThumbnail: (query, params = {}) => this.request({
        path: `/tool/thumbnail`,
        method: "GET",
        query,
        ...params
      }),
      /**
       * @description Build URL for getThumbnail
       * @name getThumbnailUrl
       */
      getThumbnailUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/tool/thumbnail`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Tool
       * @name TestMatchAll
       * @request POST:/tool/match-all
       */
      testMatchAll: (query, params = {}) => this.request({
        path: `/tool/match-all`,
        method: "POST",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for testMatchAll
       * @name testMatchAllUrl
       */
      testMatchAllUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/tool/match-all`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Tool
       * @name OpenFile
       * @request GET:/tool/open-file
       */
      openFile: (query, params = {}) => this.request({
        path: `/tool/open-file`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for openFile
       * @name openFileUrl
       */
      openFileUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/tool/open-file`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Tool
       * @name GenerateFilesToEmbedded
       * @request GET:/tool/generate-files-to-embedded
       */
      generateFilesToEmbedded: (query, params = {}) => this.request({
        path: `/tool/generate-files-to-embedded`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for generateFilesToEmbedded
       * @name generateFilesToEmbeddedUrl
       */
      generateFilesToEmbeddedUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/tool/generate-files-to-embedded`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      }
    });
    __publicField(this, "updater", {
      /**
       * No description
       *
       * @tags Updater
       * @name GetNewAppVersion
       * @request GET:/updater/app/new-version
       */
      getNewAppVersion: (params = {}) => this.request({
        path: `/updater/app/new-version`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getNewAppVersion
       * @name getNewAppVersionUrl
       */
      getNewAppVersionUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/updater/app/new-version`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Updater
       * @name StartUpdatingApp
       * @request POST:/updater/app/update
       */
      startUpdatingApp: (params = {}) => this.request({
        path: `/updater/app/update`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for startUpdatingApp
       * @name startUpdatingAppUrl
       */
      startUpdatingAppUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/updater/app/update`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Updater
       * @name StopUpdatingApp
       * @request DELETE:/updater/app/update
       */
      stopUpdatingApp: (params = {}) => this.request({
        path: `/updater/app/update`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for stopUpdatingApp
       * @name stopUpdatingAppUrl
       */
      stopUpdatingAppUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/updater/app/update`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Updater
       * @name RestartAndUpdateApp
       * @request POST:/updater/app/restart
       */
      restartAndUpdateApp: (params = {}) => this.request({
        path: `/updater/app/restart`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for restartAndUpdateApp
       * @name restartAndUpdateAppUrl
       */
      restartAndUpdateAppUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/updater/app/restart`;
        return baseUrl + path;
      }
    });
  }
}
const BApi$1 = new Api({ baseUrl: envConfig.apiEndpoint });
const useAppContextStore = create$1((set2, get5) => ({
  listeningAddresses: [],
  bApi2: null,
  runtimeMode: RuntimeMode.Dev,
  update: (payload) => {
    let bApi2;
    const addresses = payload.serverAddresses ?? [];
    if (addresses.length > 1) {
      bApi2 = new Api({ baseUrl: addresses[1] });
    } else {
      bApi2 = BApi$1;
    }
    set2((state) => ({
      ...state,
      ...payload,
      bApi2
    }));
  }
}));
const useBulkModificationInternalsStore = create$1((set2, get5) => ({
  disabledPropertyKeys: {},
  supportedStandardValueTypes: [],
  update: (payload) => set2((state) => ({ ...state, ...payload }))
}));
const useBTasksStore = create$1((set2, get5) => ({
  tasks: [],
  setTasks: (tasks) => set2({ tasks: _$2.sortBy(tasks, (x2) => x2.createdAt) }),
  removeTask: (id2) => set2((state) => ({ tasks: state.tasks.filter((t2) => t2.id != id2) })),
  updateTask: (task) => set2((state) => {
    const idx = state.tasks.findIndex((t2) => t2.id == task.id);
    let newState = state.tasks.slice();
    if (idx > -1) {
      newState[idx] = task;
    } else {
      newState.push(task);
      newState = _$2.sortBy(newState, (x2) => x2.createdAt);
    }
    return { tasks: newState };
  })
}));
const usePostParserTasksStore = create$1(
  (set2, get5) => ({
    tasks: [],
    setTasks: (tasks) => set2({ tasks: _$2.sortBy(tasks, (x2) => x2.createdAt) }),
    updateTask: (task) => set2((state) => {
      const idx = state.tasks.findIndex((t2) => t2.id == task.id);
      let newState = state.tasks.slice();
      if (idx > -1) {
        newState[idx] = task;
      } else {
        newState.push(task);
        newState = _$2.sortBy(newState, (x2) => x2.id);
      }
      return { tasks: newState };
    }),
    deleteTask: (taskId) => set2((state) => ({ tasks: state.tasks.filter((t2) => t2.id !== taskId) })),
    deleteAll: () => set2({ tasks: [] })
  })
);
const useIwFsEntryChangeEventsStore = create$1(
  (set2, get5) => ({
    events: [{ path: "123" }],
    addRange: (current) => set2((state) => {
      const newEvents = [...state.events, ...current];
      console.log("receiving new events", current, newEvents);
      return { events: newEvents };
    }),
    clear: () => {
      console.log("clearing events");
      set2({ events: [] });
    }
  })
);
const useAppUpdaterStateStore = create$1((set2, get5) => ({
  status: void 0,
  percentage: void 0,
  error: void 0,
  update: (payload) => set2((state) => ({ ...state, ...payload }))
}));
const useThirdPartyRequestStatisticsStore = create$1((set2) => ({
  statistics: [],
  setStatistics: (statistics) => set2({ statistics: statistics.slice() }),
  updateStatistics: (statistics) => set2({ statistics: statistics.slice() })
}));
function createOptionStore(updateApi, putApi) {
  return create$1((set2) => ({
    data: {},
    initialized: false,
    update: (payload) => set2((state) => ({
      data: { ...state.data, ...payload },
      initialized: true
    })),
    patch: async (patches) => {
      await updateApi(patches);
    },
    put: putApi ? async (data) => {
      await putApi(data);
    } : void 0
  }));
}
const useAppOptionsStore = createOptionStore(BApi$1.options.patchAppOptions, BApi$1.options.putAppOptions);
const useUiOptionsStore = createOptionStore(BApi$1.options.patchUiOptions);
const useBilibiliOptionsStore = createOptionStore(BApi$1.options.patchBilibiliOptions);
const useExHentaiOptionsStore = createOptionStore(BApi$1.options.patchExHentaiOptions);
const useFileSystemOptionsStore = createOptionStore(BApi$1.options.patchFileSystemOptions);
const useJavLibraryOptionsStore = createOptionStore(BApi$1.options.patchJavLibraryOptions);
const usePixivOptionsStore = createOptionStore(BApi$1.options.patchPixivOptions);
const useResourceOptionsStore = createOptionStore(BApi$1.options.patchResourceOptions);
const useThirdPartyOptionsStore = createOptionStore(BApi$1.options.patchThirdPartyOptions, BApi$1.options.putThirdPartyOptions);
const useNetworkOptionsStore = createOptionStore(BApi$1.options.patchNetworkOptions);
const useEnhancerOptionsStore = createOptionStore(BApi$1.options.patchEnhancerOptions);
const useTaskOptionsStore = createOptionStore(BApi$1.options.patchTaskOptions);
const useAiOptionsStore = createOptionStore(BApi$1.options.patchAiOptions, BApi$1.options.putAiOptions);
const useSoulPlusOptionsStore = createOptionStore(BApi$1.options.patchSoulPlusOptions, BApi$1.options.putSoulPlusOptions);
const useBangumiOptionsStore = createOptionStore(BApi$1.options.patchBangumiOptions);
const useCienOptionsStore = createOptionStore(BApi$1.options.patchCienOptions);
const useDLsiteOptionsStore = createOptionStore(BApi$1.options.patchDLsiteOptions);
const useFanboxOptionsStore = createOptionStore(BApi$1.options.patchFanboxOptions);
const useFantiaOptionsStore = createOptionStore(BApi$1.options.patchFantiaOptions);
const usePatreonOptionsStore = createOptionStore(BApi$1.options.patchPatreonOptions);
const useTmdbOptionsStore = createOptionStore(BApi$1.options.patchTmdbOptions);
const optionsStores = {
  appOptions: useAppOptionsStore,
  uiOptions: useUiOptionsStore,
  bilibiliOptions: useBilibiliOptionsStore,
  exHentaiOptions: useExHentaiOptionsStore,
  fileSystemOptions: useFileSystemOptionsStore,
  javLibraryOptions: useJavLibraryOptionsStore,
  pixivOptions: usePixivOptionsStore,
  resourceOptions: useResourceOptionsStore,
  thirdPartyOptions: useThirdPartyOptionsStore,
  networkOptions: useNetworkOptionsStore,
  enhancerOptions: useEnhancerOptionsStore,
  taskOptions: useTaskOptionsStore,
  aiOptions: useAiOptionsStore,
  soulPlusOptions: useSoulPlusOptionsStore,
  bangumiOptions: useBangumiOptionsStore,
  cienOptions: useCienOptionsStore,
  dlsiteOptions: useDLsiteOptionsStore,
  fanboxOptions: useFanboxOptionsStore,
  fantiaOptions: useFantiaOptionsStore,
  patreonOptions: usePatreonOptionsStore,
  tmdbOptions: useTmdbOptionsStore
};
const hubEndpoint = `${envConfig.apiEndpoint}/hub/ui`;
const UIHubConnection = () => {
  const connRef = reactExports.useRef(null);
  const logRef = reactExports.useRef(buildLogger(`UIHubConnection:${v4()}`));
  const log3 = logRef.current;
  const isRunningRef = reactExports.useRef(true);
  reactExports.useEffect(() => {
    const conn = new HubConnectionBuilder().withUrl(hubEndpoint).configureLogging(LogLevel$1.Information).build();
    conn.on("GetData", (key, data) => {
      log3("GetData", key, data);
      switch (key) {
        case "BackgroundTask":
          useBackgroundTasksStore.getState().setTasks(data);
          break;
        case "DownloadTask":
          useDownloadTasksStore.getState().setTasks(data);
          break;
        case "DependentComponentContext":
          useDependentComponentContextsStore.getState().setContexts(data);
          break;
        case "FileMovingProgress":
          useFileMovingProgressesStore.getState().setProgresses(data);
          break;
        case "AppContext":
          useAppContextStore.getState().update(data);
          break;
        case "BulkModificationInternals":
          useBulkModificationInternalsStore.getState().update(data);
          break;
        case "BTask":
          useBTasksStore.getState().setTasks(data);
          break;
        case "PostParserTask":
          usePostParserTasksStore.getState().setTasks(data);
          break;
        case "ThirdPartyRequestStatistics":
          useThirdPartyRequestStatisticsStore.getState().setStatistics(data);
          break;
      }
    });
    conn.on("GetIncrementalData", (key, data) => {
      log3("GetIncrementalData", key, data);
      switch (key) {
        case "BackgroundTask":
          useBackgroundTasksStore.getState().updateTask(data);
          break;
        case "DownloadTask":
          useDownloadTasksStore.getState().updateTask(data);
          break;
        case "DependentComponentContext":
          useDependentComponentContextsStore.getState().updateContext(data);
          break;
        case "FileMovingProgress":
          useFileMovingProgressesStore.getState().updateProgress(data);
          break;
        case "BTask":
          useBTasksStore.getState().updateTask(data);
          break;
        case "PostParserTask":
          usePostParserTasksStore.getState().updateTask(data);
          break;
      }
    });
    conn.on("DeleteData", (key, id2) => {
      if (key === "PostParserTask") {
        usePostParserTasksStore.getState().deleteTask(id2);
      }
    });
    conn.on("DeleteAllData", (key) => {
      if (key === "PostParserTask") {
        usePostParserTasksStore.getState().deleteAll();
      }
    });
    conn.on("GetResponse", (rsp) => {
      if (rsp.code == 0) {
        toast.success("Success");
      } else {
        toast.danger(`[${rsp.code}]${rsp.message}`);
      }
    });
    conn.on("IwFsEntriesChange", (events2) => {
      useIwFsEntryChangeEventsStore.getState().addRange(events2);
    });
    conn.on("OptionsChanged", (name2, options) => {
      if (name2.toLowerCase() === "uioptions")
        name2 = "uiOptions";
      log3("options changed", name2, options);
      const store = optionsStores[name2];
      if (store) {
        store.getState().update(options);
      }
    });
    conn.on("GetAppUpdaterState", (state) => {
      useAppUpdaterStateStore.getState().update(state);
    });
    conn.on("UpdateThirdPartyRequestStatistics", (statistics) => {
      useThirdPartyRequestStatisticsStore.getState().updateStatistics(statistics);
    });
    conn.on("OnNotification", (notification) => {
      log3("OnNotification", notification);
      const message = notification.message ? `${notification.title}
${notification.message}` : notification.title;
      const duration2 = notification.behavior === 0 ? notification.durationMs || 5e3 : 0;
      const props = { title: message, timeout: duration2, placement: "bottom-right" };
      switch (notification.severity) {
        case 0:
          toast.default(props);
          break;
        case 1:
          toast.success(props);
          break;
        case 2:
          toast.warning(props);
          break;
        case 3:
          toast.danger(props);
          break;
        default:
          toast.default(props);
      }
    });
    async function onConnected() {
      log3("connected");
      await conn.send("GetInitialData");
    }
    conn.onclose(async () => {
      log3("connection closed, attempting to reconnect...");
    });
    const guardLoop = async () => {
      while (isRunningRef.current) {
        try {
          if (conn.state === HubConnectionState.Disconnected) {
            log3("connection disconnected, attempting to connect...");
            try {
              await conn.start();
              await onConnected();
            } catch (err) {
              log3("start failed:", err);
            }
          }
        } catch (err) {
          log3("guard loop error:", err);
        } finally {
          await delay(5e3);
        }
      }
    };
    guardLoop();
    connRef.current = conn;
    return () => {
      isRunningRef.current = false;
      conn.stop();
    };
  }, []);
  return null;
};
const Add$1 = "添加";
const AddDt = "添加时间";
const addDt = "添加时间";
const Alias = "别名";
const AudioPlayableFileSelector = "声音文件查找器";
const Category = "分类";
const Color$1 = "颜色";
const CreateDt = "创建时间";
const Detail$1 = "详情";
const Edit = "编辑";
const Failed = "失败";
const File = "文件";
const FileCreateDt = "文件创建时间";
const fileCreateDt = "文件创建时间";
const FileModifyDt = "文件修改时间";
const fileModifyDt = "文件修改时间";
const ImagePlayableFileSelector = "图片文件查找器";
const InsideWorldAvParser = "InsideWorldAv资源名分析器";
const InsideWorldBiliBiliParser = "InsideWorldBiliBili资源名分析器";
const InsideWorldParser = "InsideWorld通用资源名分析器";
const Language = "语言";
const Log = "日志";
const MediaLibrary = "媒体库";
const Min = "最小";
const Modified = "修改";
const ModifyDt = "修改时间";
const Name = "名称";
const name$1 = "名称";
const Operations$1 = "操作";
const Opt = "操作";
const Orders = "排序";
const orders = "排序";
const Original$1 = "原始文本";
const original = "原作";
const Other = "其他";
const Parse = "解析";
const Publisher = "作者";
const publisher = "作者";
const Rate = "评级";
const ReleaseDt = "发售时间";
const releaseDt = "发售时间";
const Remove = "移除";
const Reset = "重置";
const Resolver = "解析器";
const Resource$1 = "资源";
const Resources$1 = "资源";
const Search = "搜索";
const Serial = "系列";
const Subscription = "订阅";
const Tag$1 = "标签";
const Tags = "标签列表";
const Text = "文本";
const Today = "今天";
const Tool = "工具";
const VideoPlayableFileSelector = "视频文件查找器";
const Yesterday = "昨天";
const NotSet$1 = "未设置";
const Chinese = "汉语";
const English = "英语";
const Japanese = "日语";
const Korean = "韩语";
const French = "法语";
const German = "德语";
const Spanish = "西班牙语";
const Russian = "俄语";
const Opened = "已打开";
const Parser = "分析器";
const PlayableFileSelector = "可播放文件查找器";
const Player$1 = "播放器";
const SelfPlayer = "系统播放器";
const PotPlayerPlayer = "PotPlayer";
const Preset = "预置";
const Components = "组件";
const Extensions = "扩展名";
const MaxFileCount = "最大可选文件数量";
const Executable = "可执行文件";
const Custom = "自定义";
const Use = "使用";
const Status$1 = "状态";
const Description = "描述";
const Setting = "设置";
const Value$1 = "值";
const Example = "样例";
const WeChat = "微信";
const Texts = "文本";
const Type = "类型";
const Useless = "无效的";
const Wrapper = "包围符";
const StandardizeName = "标准化名称";
const Volume = "期数";
const Favorites = "收藏夹";
const BiliBili = "哔哩哔哩";
const TryCompressedFilesOnCoverSelection = "尝试从压缩包内寻找封面";
const CoverSelectionOrder = "封面查找前排序";
const FilenameAscending = "文件名正序";
const FileModifyDtDescending = "文件修改时间倒序";
const Filename = "文件名";
const Start$1 = "开始";
const Sync = "同步";
const Fullname = "全名";
const fullname = "全名";
const Current = "当前";
const Preview$1 = "预览";
const Updating = "更新中";
const Support = "支持";
const formats = "格式";
const Manual = "使用说明";
const filename = "文件名";
const optional = "非必填";
const Analyze = "分析";
const Merge = "合并";
const Extract = "提取";
const minRate = "最小评级";
const languages = "语言";
const mediaLibraryIds = "媒体库";
const parseFailed = "解析失败";
const tags = "标签";
const pageSize = "每页数量";
const pageIndex = "页码";
const unnamed = "未命名";
const Hide = "隐藏";
const Syncing = "同步中";
const Complete = "完成";
const AcquireFileSystemInfo = "获取文件信息";
const CleanResources = "清理未知资源";
const AnalyzeResources = "分析资源";
const CompareResources = "确认资源变更";
const SaveResources = "保存资源";
const Saved$1 = "已保存";
const Urls = "链接";
const Download = "下载";
const Stop$1 = "停止";
const Default = "默认";
const Group = "分组";
const Collapse = "折叠";
const Order = "排序";
const Location = "位置";
const Series = "系列";
const Path = "路径";
const Filter$1 = "筛选条件";
const Shortcuts$1 = "快捷方式";
const Enhancers = "增强器";
const Target = "目标";
const Priority = "优先级";
const Validate$2 = "验证";
const Publishers = "发布人";
const Video = "视频";
const CompressedFile = "压缩文件";
const UselessWithWrapper = "被包围符包裹的无效字符";
const LanguageWithWrapper = "被包围符包裹的标识语言的字符";
const Operation = "操作";
const InsideWorldEnhancer = "InsideWorld内置增强器";
const DLsiteEnhancer = "DLsite增强器";
const NfoEnhancer = "Nfo增强器";
const Wrap = "包裹";
const Decompression = "解压";
const Standardize = "标准化";
const Move = "移动";
const Unknown = "未知";
const Directory = "文件夹";
const Image$1 = "图片";
const CompressedFileEntry = "压缩包入口";
const CompressedFilePart = "压缩包中间分P";
const Symlink = "快捷方式";
const Audio = "音频";
const Replace = "替换";
const Return = "返回";
const Deleting = "正在删除";
const QuickJump = "快速跳转";
const Recommended = "推荐";
const Enhancer = "增强器";
const Enhancement = "增强内容";
const Unsupported = "暂不支持";
const Wrapping = "正在包裹";
const Filtering = "过滤中";
const Single = "单个";
const Range = "范围";
const Batch = "批量";
const Decompress = "解压";
const Copy = "复制";
const Copied = "已复制";
const Delete = "删除";
const Save = "保存";
const Keyword$1 = "关键字";
const Import = "导入";
const Export = "导出";
const Candidates = "候选";
const Preferred = "首选";
const Playlist = "播放列表";
const Create = "创建";
const Property$1 = "属性";
const Cover = "封面";
const Threads = "线程数";
const Links = "链接";
const SingleWork = "单个作品";
const Enabled = "已启用";
const Disabled = "已停用";
const Total = "全部";
const Downloader = "下载器";
const Introduction = "介绍";
const Files = "文件列表";
const Clear = "清空";
const Site$1 = "站点";
const Interval = "间隔";
const Configurations$1 = "配置";
const Pages = "页码";
const Day = "天";
const Hour = "小时";
const Minute = "分钟";
const Second = "秒";
const Checkpoint = "检查点";
const Source$1 = "源";
const Idle = "空闲";
const Downloading = "下载中";
const Paused = "已暂停";
const Check = "查看";
const WaitingToStart = "等待下载";
const Stopped = "已停止";
const InQueue = "在队列中";
const Starting = "正在开始";
const Stopping = "停止中";
const Disable = "禁用";
const Watched = "已关注";
const ParentResource = "父级资源";
const CustomProperty = "自定义属性";
const JavLibraryEnhancer = "JavLibrary增强器";
const ExHentaiEnhancer = "ExHentai增强器";
const Missing = "缺失";
const RootPath = "根目录";
const Configuration = "配置";
const Play = "播放";
const Open = "打开";
const Level = "级别";
const Message$1 = "消息";
const Logger = "记录器";
const Event$1 = "事件";
const Time = "时间";
const List$1 = "列表";
const Ranking = "排行";
const Following = "关注";
const CommandTemplate = "命令模板";
const commandTemplate = "命令模板";
const executable = "可执行文件";
const ExtensionBasedPlayableFileSelector = "基于文件后缀的查找器";
const CustomPlayer = "自定义播放器";
const RegexEnhancer = "正则增强器";
const maxFileCount = "最大文件数量";
const extensions = "扩展列表";
const subPlayers = "子播放器";
const regex = "正则表达式";
const groups = "分组";
const Reserved = "预置";
const Version = "版本";
const Enhancements = "增强内容";
const Delay = "延迟";
const Setup = "设置";
const layer = "层级";
const Submit = "提交";
const Close$1 = "关闭";
const Readonly = "只读";
const Errors$1 = "错误";
const Test$1 = "测试";
const Layer$1 = "层级";
const Regex$1 = "正则表达式";
const FixedText = "固定文本";
const Moving = "移动中";
const Success$1 = "成功";
const Added = "已添加";
const Bulk$1 = "批量";
const Passwords = "密码列表";
const Standardization = "标准化";
const DateTime = "日期时间";
const Trim = "移除前后空白";
const Validating = "验证中";
const Saving = "保存中";
const Minimize = "最小化";
const Exit = "退出";
const Prompt = "提示";
const Initializing = "初始化中";
const NothingToPreview = "没有可预览的内容";
const ResourceDirectory = "资源文件夹";
const TempDirectory = "临时文件夹";
const Yes = "是";
const No = "否";
const Overview = "总览";
const Trending = "趋势";
const Aliases = "别名";
const SpecialTexts = "特殊字符";
const InProgress = "进行中";
const OK = "确定";
const Cancel$1 = "取消";
const Selected$1 = "已选择";
const Enable = "启用";
const FileName = "文件名";
const DirectoryPath = "文件夹路径";
const Filters = "过滤器";
const Variables$1 = "变量";
const Processes$1 = "处理器";
const Result = "结果";
const AddToStart = "添加至首位";
const AddToEnd = "添加至末尾";
const AddToAnyPosition = "添加至任意位置";
const RemoveFromStart = "从首位移除";
const RemoveFromEnd = "从末尾移除";
const RemoveFromAnyPosition = "从任意位置移除";
const ReplaceFromStart = "从首位替换";
const ReplaceFromEnd = "从末尾替换";
const ReplaceFromAnyPosition = "从任意位置替换";
const ReplaceWithRegex = "正则替换";
const SetWithFixedValue = "设置为固定值";
const SetWithDynamicValue = "设置为动态值";
const Duplicate = "复制";
const All = "全部";
const Containing = "包含";
const Matching = "正则匹配";
const FileNameWithoutExtension = "文件(夹)名(不含后缀)";
const FullPath = "完整路径";
const DirectoryName = "文件夹(父级)名";
const Find = "查找";
const None = "无";
const Modify = "修改";
const Title$1 = "标题";
const Backward = "向前";
const Forward = "向后";
const Apply = "应用";
const Processing = "处理中";
const Abort = "终止";
const Index$1 = "索引";
const Filtered = "已过滤";
const Initial = "初始化";
const Calculated = "已计算";
const Applied = "已应用";
const Revert = "还原";
const Closed = "已关闭";
const Originals = "系列";
const Option = "选项";
const Asc = "升序";
const Desc = "降序";
const Data = "数据";
const Tools = "工具";
const System = "系统";
const SingleLineText = "单行文本";
const MultilineText = "多行文本";
const Link = "链接";
const Percentage = "百分比";
const Rating = "评分";
const SingleChoice = "单选";
const MultipleChoice = "多选";
const Attachment = "附件";
const Migration = "迁移";
const Migrate = "迁移";
const Confirm = "确定";
const Continue = "继续";
const Convert = "转换";
const Formula = "公式";
const CreatedAt = "创建时间";
const FileCreatedAt = "文件创建时间";
const FileModifiedAt = "文件修改时间";
const Beta$1 = "测试版";
const Deprecated$1 = "弃用";
const Precision = "精度";
const Multilevel = "多级数据";
const UnderDevelopment = "开发中";
const General = "通用";
const Unbind = "取消绑定";
const Internal = "内部";
const Rules = "规则";
const Condition = "条件";
const Dismiss = "关闭";
const Page = "页码";
const Show = "展示";
const Finished = "已完成";
const Prepend = "添加至最前";
const Changes = "变更";
const FinalStep = "最终步骤";
const Preprocessing = "预处理";
const Scope = "维度";
const Process = "过程";
const Progress = "进度";
const Elapsed = "已用时间";
const Waiting = "等待中";
const Overwrite = "覆盖";
const Cleanup$1 = "清理";
const Developing$1 = "开发中";
const Failure$1 = "失败";
const Succeed$1 = "成功";
const TimedOut$1 = "超时";
const Banned$1 = "被封禁";
const Canceled$1 = "已取消";
const Overall = "总览";
const Details = "明细";
const Expand = "展开";
const Item = "项目";
const Untitled = "未命名";
const Global = "全局";
const ReApply = "重新应用";
const ReEnhance = "重新增强";
const Rule$1 = "规则";
const Through = "通过";
const Properties$1 = "属性";
const Experimental = "实验性功能";
const Items = "项目";
const ParsedAt = "解析时间";
const Author = "作者";
const Subresource = "子资源";
const Folder = "文件夹";
const Positioning$1 = "定位";
const Cookie$1 = "Cookie";
const Referer$1 = "Referer";
const more$1 = "更多";
const Bilibili$2 = "Bilibili";
const ExHentai$2 = "ExHentai";
const Pixiv$2 = "Pixiv";
const Bangumi$2 = "Bangumi";
const SoulPlus$2 = "SoulPlus";
const DLsite$2 = "DLsite";
const Fanbox$1 = "Fanbox";
const Fantia$1 = "Fantia";
const Cien$1 = "Cien";
const Patreon$1 = "Patreon";
const Tmdb$1 = "Tmdb";
const Diffs$1 = "差异";
const Mode = "模式";
const end = "结束";
const start = "开始";
const Count$1 = "计数";
const Development$1 = "开发";
const Duration$1 = "时长";
const Url = "网址";
const Fail = "失败";
const Password = "密码";
const Template$1 = "模板";
const ollama = "Ollama";
const Content$1 = "内容";
const View = "查看";
const Expressions = "表达式";
const Or = "或者";
const Optional = "可选";
const enhance = "增强";
const Configured = "已配置";
const Steps = "步骤";
const Cache = "缓存";
const Cached$1 = "已缓存";
const Covers$1 = "封面";
const PlayableFiles$2 = "可播放文件";
const ResourceMarkers$1 = "资源标记";
const editor = "编辑器";
const ERROR$1 = "错误";
const PlayedAt = "播放时间";
const Command$1 = "命令";
const Players$2 = "播放器";
const Auto$1 = "自动";
const Later$1 = "稍后";
const custom$1 = "自定义";
const AddedDate = "添加日期";
const UpdatedDate = "更新日期";
const FileCreatedDate = "文件创建日期";
const FileModifiedDate = "文件修改日期";
const Pretreated$1 = "预处理结果";
const Detection = "检测";
const Warning = "警告";
const cnResources = {
  "Add prefabs": "添加预置数据",
  Add: Add$1,
  AddDt,
  addDt,
  Alias,
  "Apply for a new component?": "没有找到想要的组件？点此上报",
  AudioPlayableFileSelector,
  "Available Components": "当前可用的组件",
  "Background Task": "后台任务",
  Category,
  "Click to open": "点击打开",
  Color: Color$1,
  CreateDt,
  Detail: Detail$1,
  Edit,
  Failed,
  File,
  FileCreateDt,
  fileCreateDt,
  FileModifyDt,
  fileModifyDt,
  "Found resources count": "找到的资源数",
  "How to choose components?": "如何选择组件？",
  ImagePlayableFileSelector,
  "Tag group name list, and space is the separator, and press entry to submit.": "标签组名称列表，若创建多个标签组请使用空格分隔，输入完成后按下回车键创建标签组",
  "Tag list, and space is the separator, and press entry to submit.": "标签名称列表，若创建多个标签请使用空格分隔，输入完成后按下回车键创建标签",
  InsideWorldAvParser,
  InsideWorldBiliBiliParser,
  InsideWorldParser,
  Language,
  "Last sync time": "上次同步时间",
  Log,
  "Make sure you know how to set root path of media library": "资源解析异常？",
  "Media Libraries": "媒体库",
  "Media Library": "媒体库",
  MediaLibrary,
  Min,
  Modified,
  ModifyDt,
  Name,
  name: name$1,
  Operations: Operations$1,
  Opt,
  Orders,
  orders,
  Original: Original$1,
  original,
  Other,
  Parse,
  "Past 3 days": "过去3天",
  "Past 7 days": "过去7天",
  Publisher,
  publisher,
  Rate,
  ReleaseDt,
  releaseDt,
  Remove,
  Reset,
  Resolver,
  Resource: Resource$1,
  Resources: Resources$1,
  "Resource Children": "资源子项",
  "View Children": "查看子项",
  "Loading children...": "正在加载子项...",
  "No children found": "未找到子项",
  "Failed to load children": "加载子项失败",
  "Found {{count}} children": "找到 {{count}} 个子项",
  "Mark as not played": "标记为未播放",
  "Root path": "根目录",
  "Validate media library template": "验证媒体库模板",
  "Pick a directory or file path": "选择一个目录或文件路径",
  "Limit resources count": "限制资源数量",
  "Resource keyword": "资源关键字",
  "Validating...": "验证中...",
  "Validate your template on sample resources and see live traces.": "在示例资源上验证模板并实时查看输出。",
  "Run a quick validation to check resource discovery, properties, playable files, enhancers and display names.": "快速验证资源发现、属性、可播放文件、增强器与显示名配置。",
  Search,
  Serial,
  Subscription,
  "Sure to remove?": "确定删除吗？",
  "System Property": "系统设置",
  Tag: Tag$1,
  Tags,
  Text,
  "This month": "本月",
  "This week": "本周",
  Today,
  Tool,
  VideoPlayableFileSelector,
  Yesterday,
  NotSet: NotSet$1,
  Chinese,
  English,
  Japanese,
  Korean,
  French,
  German,
  Spanish,
  Russian,
  "Under developing": "开发中，稍后开放",
  Opened,
  "Set media libraries first please": "请先设置媒体库",
  "Set categories first please.": "请先设置分类",
  "Bulk operations": "批量操作",
  "Set tags": "设置标签",
  Parser,
  PlayableFileSelector,
  Player: Player$1,
  SelfPlayer,
  PotPlayerPlayer,
  Preset,
  Components,
  "Custom component": "自定义组件",
  Extensions,
  MaxFileCount,
  Executable,
  "Component Detail": "组件详情",
  "Max File Count": "最大可选文件数量",
  "Playable File Selector Detail": "可播放文件选择器详情",
  "Input file extensions separated by a dot or space character": "输入目标文件后缀名，可用.或空格分隔",
  "Executable is required": "可执行文件不能为空",
  Custom,
  Use,
  "to play": "播放",
  "No playable file": "没有可播放文件",
  "Select one file to play": "选择一个文件播放",
  "ResourceCover.CoverTips.Tooltip": "封面缺失排查建议",
  "ResourceCover.CoverTips.Title": "未加载到封面？处理建议",
  "ResourceCover.CoverTips.S1.Title": "情形一：无法生成封面",
  "ResourceCover.CoverTips.S1.Happens": "发生于：",
  "ResourceCover.CoverTips.S1.When.NotImage": "资源本身不是图片；",
  "ResourceCover.CoverTips.S1.When.NoImageInFolder": "资源所在目录中没有任何图片；",
  "ResourceCover.CoverTips.S1.Todo": "可尝试：",
  "ResourceCover.CoverTips.S1.Todo.ManualSet": "为资源手动设置封面；",
  "ResourceCover.CoverTips.S1.Todo.FFmpeg": "若资源为视频，可在系统配置中设置 FFmpeg 以自动截取截图作为封面；",
  "ResourceCover.CoverTips.S1.Todo.Enhancers": "在媒体库模板中配置增强器并等待增强完成，增强器可为资源补全属性与可获取的文件；",
  "ResourceCover.CoverTips.S1.Todo.Cache": "完成以上操作后，必要时清理缓存或在页面临时禁用缓存；",
  "ResourceCover.CoverTips.S2.Title": "情形二：封面被缓存后又被删除",
  "ResourceCover.CoverTips.S2.Happens": "发生于：",
  "ResourceCover.CoverTips.S2.When.CacheDeleted": "封面曾被缓存，但之后缓存文件被删除；",
  "ResourceCover.CoverTips.S2.Todo": "可尝试：",
  "ResourceCover.CoverTips.S2.Todo.DisableCache": "在页面右上角通过按钮尝试禁用缓存；若封面可显示，可在“数据缓存”页面手动清理缓存",
  "The file path will be the first argument of your executable.": "可播放文件的完整路径将会作为第一个参数传递至该组件。",
  "For example": "例如",
  "Use playable file as executable": "直接执行可播放文件",
  Status: Status$1,
  "Parser is missing": "缺少分析器",
  "PlayableFileSelector is missing": "缺少可播放文件选择器",
  "Player is missing": "缺少播放器",
  "exceeds amount limit": "数量超过限制",
  Description,
  "Add custom component": "添加自定义组件",
  "Free space": "剩余空间",
  "Resource statistics": "资源统计",
  Setting,
  Value: Value$1,
  "Core Version": "内核版本",
  "App Data Path": "数据保存路径",
  "Contact us": "联系我们",
  "Path to save files to speed the loading of some resources up. Make sure there is enough free space.": "此路径用于加速临时数据的读取，建议设置到固态硬盘中，请确保剩余足够的空间。",
  Example,
  "Restart required": "重启软件后生效",
  "Double click here to set": "双击此处进行编辑",
  "Other setting": "其他配置",
  "System info": "系统信息",
  WeChat,
  Texts,
  Type,
  Useless,
  Wrapper,
  StandardizeName,
  Volume,
  "Episode(null for number part of regex)": "期数(从1开始),留空则取正则的数字部分作为期数",
  "Select a root directory": "选择根文件夹",
  "Select a executable": "选择播放程序",
  "Log Path": "日志文件",
  "Group same name files into directories": "将同名文件移至同一个文件夹",
  "Input root path": "请输入根路径",
  "input path": "输入的路径",
  Favorites,
  "Download videos in favorites": "下载收藏夹内视频",
  "Get favorites": "获取收藏夹",
  "Connecting...": "连接中...",
  "Sure?": "确定吗？",
  "Error occurred: A task was canceled.": "发生错误：任务被取消",
  "All posts have been downloaded": "所有投稿下载完成",
  "Hub connected": "Hub连接成功",
  "Error": "出错了",
  "Time costs": "耗时",
  "Downloaded count": "下载总数",
  "Total posts count": "总投稿数",
  "Open directory": "打开文件夹",
  BiliBili,
  "For authorization and accessing your personal information likes favorites.": "用于哔哩哔哩权限认证并获取您的哔哩哔哩个人信息，如收藏夹",
  "Directory to save bilibili videos.": "存储哔哩哔哩视频",
  "Invalid posts count": "失效投稿",
  "is required": "不能为空",
  "Please check": "请查看",
  "Each top level file and directory in root path of media library will be treat as a resource": "媒体库根目录下的每一个一级文件或文件夹都会被视作为一个资源",
  "Let's assume your file structure is": "假设您的资源文件结构是",
  "cover image": "封面图",
  "playable file": "可播放文件",
  "Resources will be resolved": "将会解析出以下几个资源",
  "Root path of media library": "媒体库根目录",
  "Frequency asked questions": "常见问题",
  "Check this on your first trial": "首次配置必看",
  "Other Configurations": "其他配置",
  "Try compressed files on cover selection": "尝试从压缩包内寻找封面",
  TryCompressedFilesOnCoverSelection,
  "Priority on cover selection": "封面查找优先级",
  CoverSelectionOrder,
  FilenameAscending,
  FileModifyDtDescending,
  "Column count": "列数",
  "Delete covers": "删除封面图",
  "Are you sure to delete those covers and automatically find other candidates?(Source covers will also be deleted)": "确认删除这些封面图并自动寻找新的封面图吗？(原始封面图也会被删除)",
  "Are you sure to delete this cover and automatically find another candidate?(Source covers will also be deleted)": "确认删除当前封面图并自动寻找新的封面图吗？(原始封面图也会被删除)",
  Filename,
  "Operation complete": "操作完成",
  "Are you sure to delete it?": "确认删除吗",
  "Invalid data": "非法数据",
  "Current indexes range of resources": "当前资源索引数",
  "It may cause poor performance of syncing media libraries.": "可能会导致同步媒体库的时间变长",
  "All unknown files (unknown covers for example) will be deleted permanently, are you sure?": "所有未知文件（比如未知的封面图）将会被永久删除（不可恢复），确定清除吗？",
  "Unknown files": "未知文件",
  Start: Start$1,
  "Are you sure to delete this resource?(files on your disk will also be deleted)": "确认删除当前资源吗？（物理文件也会被删除）",
  "Edit resource properties": "修改资源信息",
  Sync,
  "Resource is synced": "资源同步完成",
  "Current name on disk": "当前文件名",
  "New name": "新文件名",
  "Discard cover": "删除当前封面",
  "Open folder": "打开文件夹",
  Fullname,
  fullname,
  "Set interval to sync all media libraries automatically": "设置媒体库自动同步时间间隔",
  "Commonly used tools": "常用工具",
  "Extract everything": "一键解压",
  "Total count": "总数",
  "Done count": "完成数",
  "Failed count": "失败数",
  Current,
  "Failed files": "失败文件",
  Preview: Preview$1,
  "Enable pre-release channel": "启用预览版本通道",
  "Prefer pre-release version which has new features but less stability": "预览版可以使用更多新功能，但可能稳定性较差",
  "Latest version": "最新版本",
  "Up-to-date": "当前版本已是最新",
  "Click to auto-update": "点此自动更新",
  "Auto-Update Fails? Click to download complete installers": "自动更新失败？点此下载完整新版安装包",
  "Restart to update": "立即重启更新",
  Updating,
  Support,
  formats,
  Manual,
  filename,
  "If your compressed file is encrypted, it will also be extracted if '[{password}]' is found at end of its file name without extension": "如果在加密压缩文件名尾部（不包含后缀）加入[密码]，则会使用该密码解压该压缩文件",
  "For example: if its file name is 123[456].zip, then the 456 will be treat as its password and the 123 will be the directory to extract to": "例如：如果文件名是123[456].zip，则会用456去尝试解压该文件，且解压目录名是123",
  "Files with names (zip format and the first part for example) below will be treat as multipart compressed files with name": "如下格式（以zip格式举例）的压缩包会被认为是分P压缩包，其解压目录名为",
  "Password for multipart compressed files can be set at end of any of these files end before format and serial number part": "带密码的分P压缩包在任意一P的后缀和序号之前加密码字段即可",
  "For example: filename[456].zip.part01, filename[456].part01.zip": "例如：文件名[456].zip.part01，文件名[456].part01.zip",
  "Choose a category": "选择一个分类",
  optional,
  Analyze,
  Merge,
  "Extract sub directories recursively if directory contains folders only": "如果根目录下的文件夹仅包含子文件夹，则会将这些子文件夹提取至根目录",
  Extract,
  "Remove middle part of only-one-folder path": "如果根目录下的文件夹仅包含一个子文件夹，则会将子文件夹内的文件移至该文件夹",
  "Not work for folders which have folders and files": "如果文件夹内同时包含文件夹和文件，则不会进行操作",
  "Failed to get updater": "获取更新工具失败",
  "Downloading updater": "正在下载更新工具",
  "No available version": "无可用版本",
  "Click here to retry": "点此重试",
  "Start updating": "开始更新",
  "App.AcceleratedStaticFileDirectory": "高性能存储目录",
  "App.MediaLibrarySyncInterval": "媒体库自动同步间隔",
  "BiliBili.Directory": "哔哩哔哩下载目录",
  "BiliBili.Cookie": "哔哩哔哩Cookie",
  "Quick search slot": "快捷搜索",
  minRate,
  languages,
  mediaLibraryIds,
  parseFailed,
  tags,
  pageSize,
  pageIndex,
  "Add current search form to slot": "将当前搜索条件加入快捷搜索",
  unnamed,
  "Update name": "更新名称",
  "Select top 2147483647 files in extensions [.mkv,.wmv,.webm,.avi,.mp4,.flv,mov,.rmvb,3gp,.ts,.mpeg] as start files.": "将所有后缀为.mkv,.wmv,.webm,.avi,.mp4,.flv,mov,.rmvb,3gp,.ts,.mpeg的文件视作可播放文件",
  "Select top 1 files in extensions [.webp,.jpg,.gif,.psd,.jpeg,.tiff,.bmp,.png,.ico,.svg] as start files.": "将第一个后缀是.webp,.jpg,.gif,.psd,.jpeg,.tiff,.bmp,.png,.ico,.svg的文件作为可播放文件",
  "Select top 2147483647 files in extensions [.wav,.mid,.flac,.ogg,.weba,.mp3,.m4a,.midi] as start files.": "将第一个后缀是.wav,.mid,.flac,.ogg,.weba,.mp3,.m4a,.midi的文件作为可播放文件",
  "Parse name which likes [(20)191202][Publisher1(Publisher2,Publisher3),Publisher4(Publisher5),Publisher6]Title Part 2(Original)[CN]": '解析如"[(20)191202][发布人1(发布人2,发布人3),发布人4(发布人5),发布人6]标题 Part 2(来源作品名)[CN]"格式的名称',
  "Extract texts like ASD-999 or ASD999 from resource name": "会从文件名提取出类似ASD-999或ASD999的信息",
  "Parse name which likes [2691287][小巫酱w][A459080646]御萝双修小学妹的表白~不要拒绝啦！": '解析如"[2691287][小巫酱w][A459080646]御萝双修小学妹的表白~不要拒绝啦！"格式的名称',
  "Enable anonymous data tracking": "匿名数据采集",
  "The anonymous data will help us to improve our product experience, and no personal data will be collected": "匿名数据将会帮助我们提升产品体验，我们不会收集任何个人信息",
  "Discover and clean": "查找并清理",
  "Sync now": "立即同步",
  "Syncing media libraries": "正在同步媒体库",
  "Stop syncing": "停止同步",
  Hide,
  Syncing,
  "Failed to sync": "同步失败",
  "Library synchronization": "同步媒体库",
  Complete,
  "next sync will start at": "下次同步时间",
  AcquireFileSystemInfo,
  CleanResources,
  AnalyzeResources,
  CompareResources,
  SaveResources,
  "Start now": "立即开始",
  "Updater Path": "更新器路径",
  "Backup Path": "备份路径",
  "Invalid media libraries (category has been deleted)": "无效媒体库（分类已被删除）",
  "There are some media libraries bound with current category, please delete them first before deleting this category.": "请先删除该分类下的媒体库",
  Saved: Saved$1,
  "Sync interval": "同步时间间隔",
  "Download path": "下载路径",
  "JavLibrary torrents and covers downloader": "JavLibrary种子下载地址和封面提取器",
  Urls,
  "Torrent link keywords": "种子链接关键字",
  "One line per item": "每行一个",
  "Save form only": "仅保存表单",
  Download,
  Stop: Stop$1,
  "Media libraries belonging to category": "分类下的媒体库",
  "Other settings": "其他设置",
  "System information": "系统信息",
  "Start to analyze": "开始分析",
  "Start to remove": "开始移除",
  "Start to extract": "开始提取",
  "Start to merge": "开始合并",
  "Terms and Conditions": "使用条款",
  "Accept and start to use": "接受并开始使用",
  "We are using Microsoft Clarity to track anonymous data, which will help us to improve our product experience.": "我们正在使用Microsoft Clarity收集匿名数据以帮助我们提升产品质量。",
  "You can disable it in system settings.": "您可以在系统设置中禁用该功能。",
  Default,
  Group,
  "Tag group": "标签组",
  "Type name to search": "按名称搜索",
  "Show all": "显示全部",
  Collapse,
  Order,
  Location,
  "Please restart app and try this later": "请先重启本程序",
  "Moving files": "正在移动文件",
  "Move core data": "转移核心数据",
  "Moving files successfully, please restart app": "复制文件完成，请重启本程序",
  "Move core data to another directory": "转移核心数据到其他目录",
  "Command template": "命令模板",
  "You can change the command template for some specific scenarios. The `{0}` will be replaced by filename and the default command template is `{0}`.": "您可以自行设置调用命令模板。{0}会被替换成播放的文件名，命令模板的默认值是{0}。",
  "If the command template is `-i {0} --windowed`, the full command at runtime will be": "如果命令模板设置为'-i {0} --windowed'，实际会执行的完整命令将会是",
  "Basic components": "基础组件",
  "Clear inactive tasks": "移除非活跃任务",
  "Default priority": "默认优先级",
  "Add Date": "添加时间",
  "Release Date": "发布时间",
  "File Add Date": "文件添加时间",
  "File Modify Date": "文件修改时间",
  "Min Rate": "最低评分",
  "Custom Properties": "自定义属性",
  "Search everything": "从全部内容中搜索",
  Series,
  "Larger cover": "封面大图",
  "Root paths": "根路径",
  Path,
  Filter: Filter$1,
  "Path configuration validator": "路径配置验证器",
  Shortcuts: Shortcuts$1,
  "Custom regex": "自定义正则",
  Enhancers,
  "Set enhancement target priorities": "设置增强优先级",
  "Enable this if you want to retrieve information from local nfo files. Nfo generated by other application will not be supported for now.": "如果希望从本地nfo文件获取资源信息，请启用本项。暂不支持其他软件创建的nfo文件。",
  "Add enhancers": "设置增强器",
  Target,
  Priority,
  "Enhancements will be saved only if it's not exist, and the system will use priorities below to fill properties or files of resources.": "增强内容仅会在对应信息不存在时被保存，系统将会使用下表所配置的优先级去填充资源信息或文件",
  "You can choose which files or folders will be scanned as a resource by setting a regex to match them, and if nothing is set, the first layer things of root path will be the targets.": "您可以通过设置正则表达式来选择哪些文件(夹)应该被视作资源，默认情况下会将所有一级文件(夹)视作资源。",
  "If you just wanna choose resources by the filesystem layer, you can set it right there.": "如果您想直接通过文件(夹)层级筛选资源，可以直接在右侧设置层级。",
  Validate: Validate$2,
  "Enhancement Records": "增强记录",
  "This is a temporary page to diagnose the enhancers quickly.": "本页面是临时页面，用于快速检查增强器的处理情况。",
  "Generate nfo": "创建nfo文件",
  Publishers,
  "Resource Create Date": "资源创建时间",
  "Resource Update Date": "资源更新时间",
  "Quick selection": "快速选取",
  "File Explorer": "文件管理器",
  "FFmpeg bin directory": "FFmpeg可执行文件路径",
  "Functional configurations": "功能配置",
  "Try discovering cover from": "尝试从右侧选择的内容获取封面",
  Video,
  CompressedFile,
  "FFmpeg bin directory must be set to enable this options.": "设置FFmpeg可执行文件后方可启用该选项。",
  "You can download binary files from https://ffmpeg.org/download.html, and make sure you have ffprobe.exe and ffmpeg.exe in your directory.": "您可以从 https://ffmpeg.org/download.html 下载可执行文件，设置前请确保文件夹内包含ffprobe.exe和ffmpeg.exe2个文件。",
  "This is where core data files stored and DO NOT change them if not necessary.": "核心数据文件都存储在这里，如非必要请勿更改。",
  "Detailed information which describing the running states of app. You can send log files to developer if the app is not running normally, and you can delete them also if everything is ok.": "程序运行时的详细日志都存储在这里，如果程序运行异常，您可以将其发给开发者进行诊断，如果程序运行正常，您可以删除这些文件。",
  "Updater files for auto-updating, DO NOT delete any of them.": "用于程序自动更新，请勿删除。",
  "A data backup will be created when using the new version of app first time, you can delete them if everything is ok.": "首次使用新版本程序时会创建一次数据备份，如果新版本程序运行正常则可以删除这些备份。",
  UselessWithWrapper,
  LanguageWithWrapper,
  "Text wrapper, used to match and extract the text within the wrapper": "文本包裹符，用于匹配和提取包裹符内部的文本",
  "Text will be ignored if it surrounded by [wrappers]": "这些被包围符包裹的字符将会被忽略",
  "Text will be parsed as [specific language] if it surrounded by [wrappers]": "这些被包围符包裹的字符将会被视作是语言标识",
  "General text surrounders": "包围符",
  "Treat [text1] as [text2] during analyzation": "在分析过程中将[文本1]视作[文本2]",
  "Extract volume information from this text group": "用于尝试提取期数信息",
  "Date and time parsing template, used to extract dates and times from text": "日期和时间解析模板，用于在文本中提取日期和时间",
  "TBD, do not set it for now": "暂未启用",
  Operation,
  "You can set initial tags to resource.": "可以为资源设置初始标签。",
  "If you just wanna choose resources by the layer to root path in filesystem, you can set it by changing the layer to root, or you can set the full regex to match resources.": "如果您想仅使用相对于根目录的文件层级作为资源筛选规则，则设置目录层级即可；否则也可以通过下方正则表达式设置更复杂的规则。",
  "Before matching, all paths of filesystem entries will be start-trimmed by root path and directory separator. All types (linux-based & win-based) of directory separator will be treated as '/' internally, and you can also use start and end symbols here.": "在正则匹配前，系统会移除文件路径中包含根路径的部分，并且会移除第一个文件分隔符。无论是linux还是windows的目录分隔符均会在系统内部被转换成/，您也可以在这里使用^$。",
  "For example, if root path is C:\\123\\456, and the file path is C:\\123\\456\\789\\10.txt, the text to match will be 789/10.txt.": "例如：如果根路径是C:\\123\\456，文件路径是C:\\123\\456\\789\\10.txt，那么用于正则匹配的文本将会是789/10.txt。",
  "Fixed tags": "固定标签",
  "Tags based on paths": "基于路径的动态标签",
  "Make some layers of path tags": "将部分路径作为标签添加到资源信息中",
  "Path-based tag": "基于路径的标签",
  "Fixed tag": "固定标签",
  InsideWorldEnhancer,
  DLsiteEnhancer,
  NfoEnhancer,
  "No need to standardize": "无需标准化",
  "Recycle bin": "回收站",
  "Select all": "全选",
  "Working directory": "工作目录",
  "Go to parent directory": "返回上级目录",
  "Return to previous directory": "返回上一个目录",
  "Change working directory": "变更工作目录",
  "Click to reload": "点击重新加载",
  "Open working directory in explorer": "在资源管理器中打开工作目录",
  Wrap,
  Decompression,
  Standardize,
  Move,
  "Delete all": "删除全部",
  Unknown,
  Directory,
  Image: Image$1,
  CompressedFileEntry,
  CompressedFilePart,
  Symlink,
  Audio,
  "Filter files": "筛选文件",
  "Bulk rename": "批量重命名",
  "Add to start": "添加到首位",
  "Append to end": "添加到末尾",
  Replace,
  "Delete first n chars": "刪除前n个字符",
  "Delete last n chars": "删除后n个字符",
  "Sequence numbers": "批量编号",
  "Extract children to parent and delete current directory": "将子文件(夹)提取至当前位置，并删除该文件夹",
  "Drag to sort": "拖拽排序",
  "click to edit": "点击编辑",
  "Add tags": "添加标签",
  "Add tag groups": "添加标签组",
  "File Processor": "文件处理器",
  "Media libraries": "媒体库",
  "Add a category": "创建分类",
  "Name of category": "分类名称",
  Return,
  "Double click to edit": "双击编辑",
  Deleting,
  "You can share tags and rate of same physical filesystem item from different app instances by enabling this option, but it may cause poor performance of tag-related operations.": "启用该选项后，可以跨设备同步标签和评分等数据，但会略微降低相关的操作性能。",
  "Add media library": "添加媒体库",
  "Name of media library": "媒体库名称",
  "Path-based tags": "基于路径的标签",
  "Under development": "开发中",
  'Resources will not loaded automatically after modifying media libraries, you can click "sync button" at top-right of current page to load your resources immediately.': "修改媒体库之后资源并不会被自动加载，您可以通过在右上角点击同步按钮来加载资源",
  "Select a working directory": "请选择工作目录",
  "Id for debugging": "id，调试用",
  "Count of resources": "资源数量",
  "No file selected": "未选择文件",
  QuickJump,
  Recommended,
  "Current category": "当前分类",
  "Select a target media library": "选择目标媒体库",
  "Quick filter": "快速筛选",
  "Move to ...": "移动至...",
  "Hide all": "隐藏全部",
  "Delete all enhancement records": "删除全部增强记录",
  "Deleting all enhancement records of resources under this category": "即将删除该分类下全部增强记录",
  "Deleting all enhancement records of resources under this media library": "即将删除该媒体库下全部增强记录",
  "Enhancement records": "增强记录",
  Enhancer,
  Enhancement,
  "Enhance Dt": "增强时间",
  "If executable is not set, files will be opened by your application set in your OS settings.": "如果未设置可执行文件，则会使用系统设置的默认程序打开文件",
  "Default executable": "默认可执行文件",
  "Default command template": "默认命令模板",
  "Sub player": "子播放器",
  "You can set different players to open files with different types": "您可以为不同类型的文件设置不同的播放器",
  "Default is `{0}`. {0} will be replaced by filename": "默认值：{0}，{0}会被替换成文件名",
  "If all sub players mismatched the target file, then the default executable would be used": "如果所有的子播放器均和目标文件不匹配，则会使用默认可执行文件播放",
  "Use OS defaults": "使用系统默认",
  "Sub players": "子播放器",
  "Extensions can not be empty": "扩展名不能为空",
  "Select a path": "选择路径",
  "Checking in libraries...": "正在和媒体库比对",
  Unsupported,
  "Picked recently": "最近选择",
  Wrapping,
  "Entries will be moved to": "文件(夹)将会被移动至",
  Filtering,
  "Selection mode": "选择模式",
  Single,
  Range,
  Batch,
  "Delete all files with same name in working directory [{{workingDirectory}}]": "删除工作目录[{{workingDirectory}}]下所有同名文件",
  "{{count}} items": "{{count}}项",
  "{{count}} selected": "已选择{{count}}项",
  "Sure to delete?": "确认删除吗",
  Decompress,
  Copy,
  Copied,
  "Failed to copy": "复制失败",
  "Open {{name}} in Explorer": "在资源管理器中打开{{name}}",
  Delete,
  "Enhancer is used to populate and expand information and files of resources": "增强器是用来填充和扩充资源信息和文件的工具",
  "Media library": "媒体库",
  Save,
  "You can filter some namespaces and tags such as 'language:*' for ignoring all tags in language namespace": "您可以设置需要过滤的命名空间和标签，比如language:*可以忽略全部language命名空间下的标签",
  "External search engines": "外部搜索引擎",
  "Excluded tags": "排除标签",
  "Url template": "Url模板",
  "You can set external search engines for searching resource by name quickly in resource list, '{keyword}' will replaced by resource name or filename.": "您可以设置外部搜索引擎，设置完成后可以在资源列表页通过资源名称快速打开搜索页面，{keyword}会被替换成资源名或文件名",
  "Cookie is required for this feature. The format of excluded tags is something like 'language:chinese', and you can use * to replace namespace or tag, 'language:*' for example.": "Cookie必填。排除标签的命名格式类似于language:chinese，也可以使用*取代所有exhentai的namespace和tag，如language:*",
  "Enable scheduler": "自动定时执行",
  "Invalid cookie": "无效Cookie",
  "Cookie is good": "Cookie验证成功",
  "Validate cookie": "验证 Cookie",
  "Favorites to archive": "归档收藏夹",
  "Downloaded posts will be moved to there, please make sure the capacity of favorites is enough, the default max capacity of favorites is 1000 for now": "已下载的投稿会被转移至该收藏夹，请确保收藏夹有足够的剩余容量，目前一个收藏夹的默认总容量是1000",
  "Open directory for downloading": "打开下载文件夹",
  "Determine which files will be treated as playable files": "决定哪些文件会被视作可以播放的文件",
  "Specify a player to play playable files": "指定一个播放器用来播放可播放文件",
  "Expand properties of resources, such as publisher(property), publication date(property), tags(property), cover(file), etc": "扩展资源属性，比如作者（属性），发布时间（属性），标签（属性），封面图（文件）等",
  Keyword: Keyword$1,
  Import,
  Export,
  Candidates,
  Preferred,
  "Failed to decompress? Try another way": "解压失败？试试其他方法",
  "Password can not be empty": "密码不能为空",
  Playlist,
  Create,
  "Merge to": "合并至",
  "Set preferred": "设置为默认",
  "Creating playlist": "创建播放列表",
  "Add to playlist": "添加至播放列表",
  "Add it here": "添加到这里",
  "Adding alias": "添加别名",
  "Merging current alias group to": "合并当前别名分组至",
  "Search alias": "搜索别名",
  "Preferred alias is displayed, the original name is": "已展示别名，原名为",
  Property: Property$1,
  Cover,
  "1. Cookie of ExHentai must be set in system properties.\n2. The first item of search result will be treated as matched resource.\n3. You can set excluding tags also.": "1. 必须先在系统设置里设置ExHentai的Cookie\n2. 会使用搜索结果的第一个资源作为目标资源\n3. 您也可以设置需要排除哪些标签",
  Threads,
  "Image limits": "图片访问限制",
  Links,
  "Alias applied": "已应用别名",
  "If you are browsing exhentai.org, you should decrease the threads of downloading.": "如果您正在浏览exhentai.org，您应该适当降低下载线程数。",
  "Your download will start automatically if links are set": "如果您设置了下载链接，下载任务将会自动开始",
  "Add resource to favorites": "添加该资源至收藏夹",
  "Add to playlists": "添加至播放列表",
  "Add file to playlists": "添加当前文件至播放列表",
  "Select favorites": "选择收藏夹",
  "Sync media libraries": "同步媒体库",
  SingleWork,
  "Raw name": "原名",
  Enabled,
  Disabled,
  "Select from media library": "从媒体库选择路径",
  "Resource overview": "资源总览",
  "Added today": "本日新增",
  "Added this week": "本周新增",
  Total,
  "Show larger cover on mouse hover": "鼠标悬浮时显示封面大图",
  Downloader,
  Introduction,
  Files,
  "Bulk delete": "批量删除",
  "{{job}} will be started once an hour automatically, but you can trigger it manually by clicking there.": "{{job}}会以一小时一次的频率自动启动，但您也可以通过点击此处手动启动它。",
  "Nfo files generation": "nfo文件的生成",
  "Synchronization of media libraries": "媒体库的同步",
  "Generate nfo files": "生成nfo文件",
  Clear,
  "Selected recently": "近期选择",
  "Unable to retrieve Bilibili favorites. Please ensure your cookie is correctly set and that you have at least one favorite created.": "无法获取 Bilibili 收藏。请确保您的 Cookie 设置正确，并至少创建了一个收藏。",
  "Unable to get bilibili favorites, make sure your cookie is set properly": "无法获取哔哩哔哩收藏夹信息，请确保Cookie设置正确",
  "Set now": "立即设置",
  Site: Site$1,
  Interval,
  "Creating download task": "创建下载任务",
  "Create download task": "创建下载任务",
  Configurations: Configurations$1,
  "Set a page range if you don't want to download them all.": "如果您不想下载全部内容，可以设置页码范围。",
  "Set a page range if you don't want to download them all. The minimal page number is 1.": "如果不想下载全部内容，可以设置一个页码范围。页码从1开始。",
  Pages,
  "You can set the previous downloading checkpoint manually to make the downloader start the downloading task from it.": "您可以手动设置先前的下载检查点，使下载器从该检查点开始下载任务。",
  "In most cases, you should let this field set by downloader automatically.": "在大多数情况下，您应该让下载器自动设置此字段。",
  "Each downloader has its own checkpoint format, and invalid checkpoint data will be ignored. You can find samples on our online document.": "每个下载器都有自己的检查点格式，无效的检查点数据将被忽略。您可以在我们的在线文档中找到示例。",
  "You can set the previous downloading checkpoint manually to make the downloader start the downloading task from it. In most cases, you should let this field set by downloader automatically. Each downloader has its own checkpoint format, and invalid checkpoint data will be ignored. You can find samples on our online document.": "您可以手动设置下载检查点数据，设置后下载器将会从该检查点开始下载。大部分情况下无需手动更新该字段，下载器会自动调整该字段的内容。每个下载器的检查点数据格式均不同，如果填写的数据无效，则会被下载器忽略。您可以在本软件的文档中找到检查点数据样例。",
  "Interval for checking for new contents. ": "每过一段时间检查是否有新内容。",
  Day,
  Hour,
  Minute,
  Second,
  Checkpoint,
  "Default download path": "默认下载路径",
  Source: Source$1,
  Idle,
  Downloading,
  Paused,
  "Naming convention": "命名规则",
  "You can select fields to build a naming convention template, and '/' to create directory.": "您可以选择字段来构建命名模板。使用/可以创建文件夹。",
  "Global configurations": "全局配置",
  Check,
  "Next start time": "下次开始时间",
  "Failure times": "失败次数",
  "Remove this task": "移除这个任务",
  WaitingToStart,
  Stopped,
  InQueue,
  "Download task": "下载任务",
  "No data": "暂无数据",
  Starting,
  Stopping,
  Disable,
  "Moving direction": "移动方向",
  "Request interval": "请求间隔",
  Watched,
  "In most cases, you don't need to set this manually.": "大部分情况下无需手动设置。",
  "Add fixed tags for resources": "为资源添加固定标签",
  "Path configuration": "路径配置",
  "Which files/folders are resources?": "哪些文件(夹)是资源？",
  "Set properties of resources by path segments": "通过文件路径设置资源信息",
  "The {{layer}} layer": "第{{layer}}层",
  "The {{layer}} layer to the last": "倒数第{{layer}}层",
  "Found top {{count}} resources. (shows up to 100 results)": "找到了前{{count}}个资源。（最多展示100个结果）",
  "{{count}} possible conflicts segment configurations are found.": "发现了{{count}}个可能相互冲突的基于文件路径的配置。",
  "Path segment configuration": "基于路径的配置",
  "Not set": "未配置",
  "Set fixed tags": "设置固定标签",
  "Next step": "下一步",
  "Parent resource": "父级资源",
  ParentResource,
  CustomProperty,
  JavLibraryEnhancer,
  ExHentaiEnhancer,
  "Warning: path may be conflict with other media libraries:": "当前路径可能和其他媒体库路径冲突：",
  "No content": "暂无内容",
  "Set a name for category": "请输入分类名称",
  "End creation": "结束创建",
  "Return to previous step": "返回上一步",
  "Select a component to discover playable files": "请选择一个组件用来查找可以播放的文件",
  "What player is able to play those files?": "请选择一个播放器用来播放这些文件",
  "Set media libraries": "配置媒体库",
  "Set a name for media library": "请输入媒体库名称",
  "Where are your resources saved?": "您的资源保存在哪里？",
  "A category is used to handle one type resources (mostly cataloged by media type).": "一个分类用于处理一类资源（一般按照媒体类型分类）",
  "A good practice naming category is 'Anime', 'Comic' and 'Game' instead of 'ACG'(mixed types).": "推荐使用'动画'、'漫画'或'游戏'作为分类名称，而不是大合集'ACG'",
  "Add a media library": "创建一个媒体库",
  "Add at least one media library to continue": "请先至少创建一个媒体库",
  "You can set a name for media library freely using your own rules. Such as 'pending', 'watching', 'done'.": "您可以使用自己的规则随意为媒体库设置名称。比如：'待定', '进行中', '已阅'",
  "Select a file you want to play": "选择一个您想播放的文件",
  "Set it later and go to next step": "稍后设置",
  "Your resource is located by system automatically, you can click any path segment to change it if it's not correct.": "您的资源已被系统自动定位，您可以通过点击路径来修改它",
  "And you can set at most one parent resource too.": "而且您可以为它设置一个父级资源",
  "A root path is required for a media library, you must choose any of path segments to set it.": "您必须设置一个路径作为媒体库的根目录",
  "A resource can be a movie, manga, etc. And it is the smallest unit bound to media library and category.": "一个资源可以是一部电影、一部漫画。它是与媒体库相关联的最小单位",
  "All sub file entries will be treated as the contents of resource, but not resources self.": "所有资源内的文件将会被视作资源内容，而不会被视作一个个资源",
  "You can set conventions on each path segments to fill the properties of resources.": "您可以将每一段路径设置为资源的一些属性",
  "If your path layer isn't stable to root path but it is stable to resource, 'The xxx layer to the resource' is your better choice.": "如果您选择的路径片段相对于根目录不固定（如：可能是根目录后的第二层，也可能是第三层），但对于资源路径来说是固定的（比如是资源路径的前一级），那您应该选择'资源前的第1级'",
  Missing,
  RootPath,
  "{{properties}} are required to select this.": "必须先设置{{properties}}才能选择当前字段",
  "Add tags for resources": "为资源添加标签",
  "{{a}} can not be after than {{b}}": "{{a}}不能在{{b}}后面",
  "{{a}} can not be ahead of {{b}}": "{{a}}不能在{{b}}前面",
  "Please locate your resource first": "请先定位您的资源",
  "Sync after saving": "保存后立即同步",
  "Resources will not be loaded using new configuration automatically if this option is disabled.": "如果不选择该选项，资源将不会自动被加载",
  "Shall we add some tags for resources?": "我们需要为资源添加一些固定标签吗？",
  "Pick some tags": "挑选一些标签",
  "Do you want to extract some properties from path segments?": "您希望从路径中提取一些信息吗？",
  "Some enhancers are suitable for those resources": "有一些增强器可以使用",
  "You can change the priorities of enhancements by dragging and dropping.": "您可以通过拖拽更改增强信息的优先级",
  "This matcher is readonly.": "目前不可更改",
  "Select a file you want to play in another root path": "选择一个其他根目录下您想播放的文件",
  "Here are rest options": "其他选项",
  Configuration,
  "Locate your rest resources": "定位您的其他资源",
  "Generated nfo files are not capable loaded by other apps.": "生成的nfo文件无法在其他app中打开",
  "Validate then save": "验证然后保存",
  "Requests overview": "请求概览",
  "This is a folder": "这是一个文件夹",
  "This is a file": "这是单文件",
  "Complete the configurations and return to media library path configurations": "配置完成，返回媒体库路径配置列表",
  "Set it later and return to media library path configurations": "稍后设置本项，返回媒体库路径配置列表",
  "Complete the configurations and return to media library list": "配置完成，返回媒体库列表",
  "Set it later and return to media library list": "稍后设置，返回媒体库列表",
  "Complete the configurations and go to the next step": "完成配置并进入下一步",
  "Hide children": "隐藏子资源",
  Play,
  Open,
  "Children resources": "子资源",
  "Setup a category": "配置分类",
  "Setup media libraries": "配置媒体库",
  "Setup other options": "其他配置",
  "Startup page": "启动页",
  "Load all file types": "查询全部文件类型",
  "Please pay attention, you marked a file as a resource. We'll treat all files or folders with same path layer as resources by default. It may not be your actual design(if you chose a movie and its subtitle file has the same path layer, then the subtitle file will be another resource).": "请注意，您选择了一个文件作为资源，默认情况下，我们会将所有和该文件同一层级的文件(夹)视作资源。但在某些情况下（如果字幕文件和视频文件在同一层级，那么字幕文件会被视作另一个资源）这可能不是您想要的结果。",
  "If you want to mark resources with specific file types, you can click button below to load all file types and select some of them.": "如果您需要根据文件类型筛选资源，您可以点击下方的按钮加载全部文件类型，然后进行选择。",
  "You can mark resources by file types.": "您可以通过选择对应的文件类型来筛选您的资源。",
  "None of file types has been selected, we'll treat all files or folders with same path layer as your file as resources.": "目前未选择任何类型，会将所有同层级文件(夹)视作资源",
  "You selected {{count}} file types:": "目前已选择{{count}}项：",
  "No known file type is found.": "未找到任何已知类型的文件",
  "You are deselecting extension same as file you selected": "您正在移除您选择的文件类型",
  "After your deselection, the current file will not be treat as a resource, and you need reset the Resource part from path segments, are you sure to remove file type: {{ext}}?": "在您取消选择后，当前选择的文件将不会被视作资源，您需要重新通过路径设置资源，确认移除文件类型{{ext}}吗",
  "Please select root path first.": "请先选择根目录",
  "Create now": "立即创建",
  "Potential risks have been detected": "检测到潜在风险",
  "Sure to continue?": "是否继续？",
  Level,
  Message: Message$1,
  Logger,
  Event: Event$1,
  Time,
  "An error occurred": "发生了一些错误",
  "Back to homepage": "返回首页",
  "Please take a screenshot or copy all contents manually then send it to the developer, thanks": "请截图或复制全部内容然后发送给开发者，谢谢",
  "Sure to delete the following tags?": "确认删除以下标签吗？",
  "Editing tag": "编辑标签",
  List: List$1,
  "One url for one line": "一个链接一行",
  Ranking,
  Following,
  "Novel is not supported now, please make sure your url likes: ": "暂不支持小说，请确认您的链接和下方链接类似：",
  CommandTemplate,
  commandTemplate,
  executable,
  "Nothing here yet": "这里什么都没有",
  "Select files with specific extensions as playable files.": "选择指定后缀的文件作为目标文件",
  ExtensionBasedPlayableFileSelector,
  CustomPlayer,
  RegexEnhancer,
  maxFileCount,
  extensions,
  subPlayers,
  "Reserved property": "内置属性",
  "Custom property": "自定义属性",
  "Group name": "分组名",
  "No capturing groups are found": "未找到捕获组",
  "Multiple invalid capturing group names are found: {{names}}": "发现多个无效捕获组：{{names}}",
  "Invalid capturing group": "无效捕获组",
  "Type is not set": "未设置类型",
  "Property is not set": "未设置属性",
  regex,
  groups,
  "Invalid configuration": "无效配置",
  "Invalid group": "无效分组",
  "{{key}} is not set": "未填写{{key}}",
  Reserved,
  "Please select at least one enhancer.": "请至少选择一个增强器",
  Version,
  "Data version": "数据版本",
  "May be different in incoming versions of app": "在未来的软件版本中可能会变化",
  "May be different after configuration change": "在配置变更后可能会变化",
  "Applied to": "应用于",
  "Enhance now": "立即增强",
  "File list": "文件列表",
  "Extract contents from directory": "提取文件夹中的内容",
  "Add to favorites": "添加至收藏夹",
  Enhancements,
  "Select a path from media library": "从媒体库中选择路径",
  "Copy name": "复制名称",
  "Deleting all '{{fileName}}' in working directory: {{workingDirectory}}": "即将删除'{{workingDirectory}}'下全部名为'{{fileName}}'的文件",
  "Found {{count}} entries": "找到{{count}}个条目",
  "Discovering files with same name": "正在寻找同名文件",
  "Delete with same name": "删除同名",
  "Or use a password from history": "或者使用历史密码",
  "No password in history": "还没有历史密码",
  "Delete password from history?": "确认删除历史密码吗？",
  "Create task": "创建任务",
  "Bulk start": "批量开始",
  "Bulk stop": "批量停止",
  "Click to search": "点击搜索",
  Delay,
  "Files or directories will be moved after the delayed time from the time they are created here. The delay is working for the first layer entries only.": "文件或文件夹在移动至此的一段时间以后才会被移动。延迟仅对第一层级的条目生效。",
  "You can set a proxy for network requests, such as socks5://127.0.0.1:18888": "可以为网络请求指定代理，例如：socks5://127.0.0.1:18888",
  Setup,
  "The {{layer}} layer after root path": "根目录后的第{{layer}}层",
  "The {{layer}} layer to the resource": "资源文件（夹）前的第{{layer}}层",
  "{{a}} must come before {{b}}": "{{a}}必须在{{b}}前面",
  "{{a}} must come after {{b}}": "{{a}}必须在{{b}}后面",
  "Add a property to current segment. Some properties may not able to set by layer, but you still can set it by regex.": "为当前层级添加一个属性。有些属性可能无法通过层级设置，但您仍然可以通过正则表达式设置。",
  "Test failed, please check your regex": "测试失败，请检查您的正则表达式",
  "The whole matched text will be ignored if capturing groups are used": "如果使用了捕获组，完整的匹配文本将被忽略",
  "Set by {{thing}}": "通过{{thing}}设置",
  layer,
  Submit,
  Close: Close$1,
  "{{target}} should come after {{invalidMatchers}}": "{{target}}应该在{{invalidMatchers}}后面",
  "{{target}} should come before {{invalidMatchers}}": "{{target}}应该在{{invalidMatchers}}前面",
  Readonly,
  "Setting a Resource property to segment": "为路径片段设置资源属性",
  "Some properties may not able to set by layer, but you still can set it by regex.": "有些属性可能无法通过层级设置，但您仍然可以通过正则表达式设置。",
  "Match target is not found": "未找到正则匹配目标",
  "Fixed text: {{text}}": "固定文本：{{text}}",
  "Regex: {{regex}}": "正则表达式：{{regex}}",
  "Layer: the {{layer}} layer to the last": "层级：倒数第{{layer}}层",
  "Layer: the {{layer}} layer": "层级：第{{layer}}层",
  "[{{matchers}}] (is)are required to set this property": "必须先设置{{matchers}}",
  "Match failed": "匹配失败",
  "Text to be matched": "待匹配文本",
  "Matched {{count}} results": "匹配到{{count}}个结果",
  "Global matches": "全局匹配",
  "Segment matches": "片段匹配",
  "Match by file extensions": "通过文件后缀匹配",
  Errors: Errors$1,
  "Resource matcher can not have a regex result(make sure you are not setting groups in regex)": "资源匹配器不能有正则结果(请确保您没有在正则表达式中设置捕获组)",
  Test: Test$1,
  "Setup how to find resources and properties": "设置如何查找资源和属性",
  "To setup this item, you should pick up a file first within your root path.": "设置该项前您需要先选择一个根目录下的文件。",
  "If you want to populate properties as many as possible, you should pick up a file with more layers in path.": "如果您想设置更多属性，请选择尽量深层的文件。",
  "I need choose files with specific types as resources": "我需要选择特定类型的文件作为资源",
  "Test then save": "先验证再保存",
  Layer: Layer$1,
  Regex: Regex$1,
  FixedText,
  "Additional properties": "附加属性",
  "Sub file/folder": "子文件（夹）",
  "Will be deleted": "将会被删除",
  "Wrapping {{count}} file entries": "正在包裹{{count}}个文件(夹)",
  "No background task": "没有后台任务",
  "Contents will be decompressed to the same directory as the compressed file.": "文件内容将会被解压至和压缩文件名相同的目录。",
  "Alternatively, you can choose a password from the following candidates:": "或者，您可以从以下候选密码中选择一个：",
  "Alternatively, you can choose a password from recently used passwords:": "或者，您可以从最近使用的密码中选择一个：",
  "Alternatively, you can choose a password from frequently used passwords:": "或者，您可以从经常使用的密码中选择一个：",
  "Or you can use a custom password:": "您也可以指定密码：",
  "Use custom password to decompress": "使用指定密码解压",
  Moving,
  Success: Success$1,
  "Delete all files with same name": "删除所有同名文件",
  "File mover": "文件移动器",
  "Merge contents": "合并内容",
  "Bulk move": "批量移动",
  "Capture as a new cover": "截图并设置为新封面",
  "Sure to set new cover?": "确认变更封面吗？",
  "Failed to capture video frame": "获取视频帧失败",
  "Available when video is paused": "视频暂停时可使用",
  "Select duration": "选择时间段",
  "Add successfully": "添加成功",
  Added,
  "You can add it more than once, and if you want to remove it from playlist, you should click the corresponding playlist first.": "可以被添加多次，如果您想从播放列表中移除它，您需要先点击对应的播放列表。",
  "No playable contents": "没有可播放的内容",
  "Details of {{name}}": "{{name}} 详情",
  "Use player to play": "使用播放器播放",
  "Bad page: {{page}}": "页码错误：{{page}}",
  "Invalid tag": "无效标签",
  Bulk: Bulk$1,
  "Start all": "全部开始",
  "Stop all": "全部停止",
  "Validating cookie": "正在验证Cookie",
  "Layer mode is available": "层级模式可用",
  "Layer mode is not available": "层级模式不可用",
  "Regex mode is available": "正则模式可用",
  "Regex mode is not available": "正则模式不可用",
  "Selected value will be replaced": "已经选择的值将会被替换",
  "Sure to stop?": "确定停止吗？",
  "Show more": "查看更多",
  Passwords,
  "Used recently": "最近使用",
  "Used frequently": "经常使用",
  "Are you sure to extract contents in those directories? Those directories will be removed after extraction. You can check the demo by extracting one directory.": "确定要提取这些目录中的内容吗？提取后这些目录将会被删除。您可以通过提取单个目录来了解本功能。",
  "Extracting contents": "即将提取内容",
  "Start decompressing": "开始解压",
  Standardization,
  DateTime,
  Trim,
  "Setting tags": "设置标签",
  "dsnf-dialog-title": "在<3>{{workingDirectory}}</3>中删除全部名称为<1>{{fileName}}</1>的文件",
  "fp.te.db.defaultPassword": "默认情况下，我们将会使用<1>{{password}}</1>作为密码",
  "fp.mergeContents": "合并<1>{{name}}</1>个文件(夹)",
  "fp.mergeContentsIn": "合并<1>{{name}}</1>的子文件(夹)",
  "fp.bulkOperation": "{{operation}}<1>{{count}}</1>个文件(夹)",
  "resource.search-engine.tip": "使用 <1>{{name}}</1> 搜索 <3>{{keyword}}</3>",
  Validating,
  "Proxy": "代理",
  "Save without validation": "不验证直接保存",
  Saving,
  "Unable to find any resource": "未能找到任何资源",
  "Change name": "改变名称",
  "Exit behavior": "退出交互",
  Minimize,
  Exit,
  Prompt,
  "/ is the directory separator always, not \\": "除非特别说明，一般使用/作为目录路径分隔符，而不是\\",
  "You should not use capturing groups on Resource property due to partial path is not available to match a file system entry": "您不应该在*资源*属性中使用捕获组，因为不完整的匹配结果将无法定位到文件系统中的文件(夹)",
  "Capturing groups are not allowed on Resource property": "捕获组不可用于*资源*属性中",
  "Custom property key": "自定义属性key",
  "Type here": "在这里输入",
  "This is a child resource": "这是一个子资源",
  "This is a parent resource": "这是一个父级资源",
  "Replace tags in search": "仅搜索该标签",
  "Append to tags in search": "追加搜索该标签",
  "Remove cover cache": "清除封面緩存",
  "Current cover file will be overwritten.": "当前封面文件将会被覆盖。",
  "Save as a new cover": "保存为新封面",
  Initializing,
  NothingToPreview,
  "Follow system": "跟随系统",
  "Light mode": "浅色模式",
  "Dark mode": "深色模式",
  "It's a directory where temporary files stored, such as cover files, etc.": "这是一个存放临时文件的目录，比如自动生成的封面图等。",
  "Temporary files path": "临时文件路径",
  "Cover of single-file-resource will be saved to temp folder": "单文件资源的封面将会被保存至临时文件夹",
  "Save to temp folder": "保存至临时文件夹",
  "Cover file may be lost if you change the resource name in file system": "如果您在文件系统中修改了资源名称，封面文件可能会丢失",
  "Save to resource folder": "保存至资源文件夹",
  "Your original resource files may be tainted because the cover file will be added to the resource folder": "由于封面文件会被添加至资源文件夹，您的原始资源文件可能会被污染",
  "Quick preview is not fully enabled": "快速预览未完全启用",
  "It's highly recommended to configure ffmpeg path in settings to enable the quick preview feature for videos.": "强烈建议您在系统配置中设置ffmpeg路径，以启用视频的快速预览功能。",
  "Resource discovery": "资源发现",
  "You have to set this to discover resources": "设置该项后才能扫描到资源",
  "Capturing groups are used, only matched text will be applied": "已使用捕获组，仅被捕获的文本会被应用",
  "Whole segment will be applied if capturing group is not used": "未使用捕获组，完整的路径片段将会被应用",
  "Match result": "匹配结果",
  "Applied to {{count}} categories": "已应用于{{count}}个分类",
  "You've set multiple enhancers, so you should set priories of their enhancements below.": "您设置了多个增强器，请在页面下方设置它们的增强优先级。",
  "You can change this behavior in configuration page": "您可以在系统配置页面更改此行为",
  "Remember my choice": "记住我的选择",
  "Cover save location": "封面保存位置",
  "Overwrite existed cover": "覆盖已存在的封面",
  "Overwrite existed cover when save a new cover": "保存新封面时覆盖已存在的封面",
  ResourceDirectory,
  TempDirectory,
  Yes,
  No,
  "Cover saved successfully": "封面保存成功",
  "Added this month": "本月新增",
  Overview,
  Trending,
  Aliases,
  SpecialTexts,
  "Third party": "第三方",
  InProgress,
  "Last week": "上周",
  "{{count}} weeks ago": "{{count}}周前",
  "Resource properties": "资源属性",
  "Resource tags": "资源标签",
  OK,
  Cancel: Cancel$1,
  "New Folder": "新文件夹",
  "Select file": "选择文件",
  "Select folder": "选择文件夹",
  Selected: Selected$1,
  "You can type a path here": "您可以输入一个路径",
  "Sort by name": "按名称排序",
  "Not installed": "未安装",
  "Click to update to version": "点击更新至版本",
  "Dependent components": "依赖组件",
  "Default location": "默认位置",
  "This function is not working because Lux is not found, check it in system configurations": "此功能无法使用，因为未找到Lux，请在系统配置中检查",
  "This function is not working because FFmpeg is not found, check it in system configurations": "此功能无法使用，因为未找到FFmpeg，请在系统配置中检查",
  "This function is not working because lux or ffmpeg is not found, check them in system configurations": "该功能无法使用，因为未找到lux或ffmpeg，您可以在系统配置界面确认它们的状态",
  "Quick edit mode": "快速编辑模式",
  "Back to normal edit mode": "返回普通编辑模式",
  "One path per line": "每行一个路径",
  "Target path": "目标路径",
  "Add source path": "添加源路径",
  "Add target path": "添加目标路径",
  "Failed to get information of new version": "获取新版本信息失败",
  "Checking new version": "正在检查新版本",
  "Select file system entries": "选择文件或文件夹",
  "Disable cache": "禁用缓存",
  "Disable media previewer on mouse hover": "禁用鼠标悬浮快速预览",
  "Found some conflicted tasks": "发现一些任务冲突",
  "Download selected tasks firstly": "优先下载所选任务",
  "Add selected tasks to the queue": "将所选任务加入队列",
  "Add a filter": "添加一个过滤器",
  "Add a group": "添加一个分组",
  "BulkModificationFilterGroupOperation.And": "并且",
  "BulkModificationFilterGroupOperation.Or": "或者",
  "BulkModificationFilterOperation.Equals": "等于",
  "BulkModificationFilterOperation.NotEquals": "不等于",
  "BulkModificationFilterOperation.Contains": "包含",
  "BulkModificationFilterOperation.NotContains": "不包含",
  "BulkModificationFilterOperation.StartsWith": "前缀等于",
  "BulkModificationFilterOperation.NotStartsWith": "前缀不等于",
  "BulkModificationFilterOperation.EndsWith": "后缀等于",
  "BulkModificationFilterOperation.NotEndsWith": "后缀不等于",
  "BulkModificationFilterOperation.GreaterThan": "大于",
  "BulkModificationFilterOperation.LessThan": "小于",
  "BulkModificationFilterOperation.GreaterThanOrEquals": "大于或等于",
  "BulkModificationFilterOperation.LessThanOrEquals": "小于或等于",
  "BulkModificationFilterOperation.IsNull": "为空",
  "BulkModificationFilterOperation.IsNotNull": "不为空",
  "BulkModificationFilterOperation.In": "在列表中",
  "BulkModificationFilterOperation.NotIn": "不在列表中",
  "BulkModificationFilterOperation.Matches": "正则匹配",
  "BulkModificationFilterOperation.NotMatches": "正则不匹配",
  Enable,
  "Select tags": "选择标签",
  "Select media libraries": "选择媒体库",
  FileName,
  DirectoryPath,
  Filters,
  Variables: Variables$1,
  Processes: Processes$1,
  Result,
  "Create from this": "由此创建",
  AddToStart,
  AddToEnd,
  AddToAnyPosition,
  RemoveFromStart,
  RemoveFromEnd,
  RemoveFromAnyPosition,
  ReplaceFromStart,
  ReplaceFromEnd,
  ReplaceFromAnyPosition,
  ReplaceWithRegex,
  "BulkModification.Processor.Demonstrator.Operation.SetDirectly": "<0> 变更 </0> 为",
  "BulkModification.Processor.Demonstrator.Operation.SetWithDynamicValue": "<0> 替换 </0> 为动态值",
  SetWithFixedValue,
  SetWithDynamicValue,
  Duplicate,
  "Position.Beginning": "首位",
  "Position.End": "末尾",
  "BulkModification.Processor.Demonstrator.Operation.RemoveFromStartOrEnd": "从<3>{{direction}}</3>删除<1>{{count}}</1>个字符",
  "BulkModification.Processor.Demonstrator.Operation.AddToStartOrEnd": "在<3>{{direction}}</3>添加<1>{{value}}</1>",
  "BulkModification.Processor.Editor.Operation.AddToAnyPosition": "在 <5/> 第 <3/> 个字符处添加 <1/>",
  "BulkModification.Processor.Demonstrator.Operation.AddToAnyPosition": "在<5>{{direction}}</5>第<3>{{position}}</3>个字符处添加<1>{{value}}</1>",
  "BulkModification.Processor.Editor.Operation.RemoveFromAnyPosition": "从 <7/> 第 <5/> 个字符 <3/> 删除 <1/> 个字符",
  "BulkModification.Processor.Demonstrator.Operation.RemoveFromAnyPosition": "从<7>{{direction}}</7>第<5>{{position}}</5>个字符处<3>{{removeDirection}}</3>移除<1>{{count}}</1>个字符",
  "BulkModification.Processor.Editor.Operation.Replace": "将 <1/> 替换为 <3/>",
  "BulkModification.Processor.Demonstrator.Operation.ReplaceFromStartOrEnd": "从<5>{{direction}}</5>将<1>{{find}}</1>替换为<3>{{replace}}</3>",
  "BulkModification.Processor.Demonstrator.Operation.Replace": "将<1>{{find}}</1>替换为<3>{{replace}}</3>",
  "BulkModification.Processor.Demonstrator.Operation.ReplaceWithRegex": "使用<1>正则表达式</1>将<4>{{find}}</4>替换为<6>{{replace}}</6>",
  "BulkModification.Processor.Demonstrator.Operation.FilterThenModifyWithTextProcessor": "针对<0>{{filterBy}}</0><1>{{find}}</1>的数据，<2>{{textProcessorDemonstrator}}</2>",
  "BulkModification.Processor.Demonstrator.Operation.Filter.FilteredData": "<0/><1>{{find}}</1>的数据",
  "TextOperation.Backward": "向前",
  "TextOperation.Forward": "向后",
  All,
  Containing,
  Matching,
  FileNameWithoutExtension,
  FullPath,
  DirectoryName,
  "Variable name": "变量名",
  Find,
  None,
  "Setting variable": "设置变量",
  Modify,
  "Target properties": "目标属性",
  Title: Title$1,
  Backward,
  Forward,
  "Empty value": "空值",
  "Find in aliases": "在别名中查找",
  "Some properties have applied aliases, you can enable this feature to check your target both in raw values and aliases.": "有些属性已经应用了别名功能，您可以同时在原属性值和别名中进行查找。",
  "Creating a bulk modification": "正在创建批量修改方案",
  "Please input a name": "请输入名称",
  "Name is required": "名称不能为空",
  "How does this work?": "如何使用？",
  "You can set any combination of criteria to filter the resources that you need to modify in bulk": "您可以设置任意组合的条件来筛选需要批量修改的资源",
  "You can set some variables and use them in processes": "您可以设置一些变量并在处理器中使用它们",
  "To modify the properties of filtered resources, you should set at least one process": "要修改筛选出的资源的属性，您至少需要设置一个处理器",
  "You can preview the result then apply all changes": "您可以预览结果然后应用所有修改",
  "Calculate resource diffs": "计算资源变化",
  "Recalculate resource diffs": "重新计算资源变化",
  "Check previous calculation result": "查看最后一次计算的结果",
  Apply,
  Processing,
  Abort,
  "Calculated at {{calculatedAt}}": "于{{calculatedAt}}计算",
  "Calculate resource diffs first please": "请先计算资源变化",
  Index: Index$1,
  "Changed property": "变更属性",
  Filtered,
  "Bulk modification applied successfully": "批量修改已成功应用",
  "Apply bulk modification": "应用批量修改",
  "All changes will be applied to resources, and there is no way back. Are you sure to apply the bulk modification?": "所有修改将会被应用到资源上，且无法撤销。您确定要应用批量修改吗？",
  "Bulk modification": "批量修改",
  Initial,
  Calculated,
  Applied,
  "{{count}} resources have been filtered out": "总计筛选出{{count}}个资源",
  "Filtered at {{datetime}}": "已于{{datetime}}筛选",
  "Calculated at {{datetime}}": "已于{{datetime}}计算",
  "Reverted at {{datetime}}": "已于{{datetime}}还原",
  "Applied at {{datetime}}": "已于{{datetime}}应用",
  "Check all the resources that have been filtered out": "查看所有被筛选出的资源",
  "Continuing will result in the inability to revert the applied changes. Do you want to proceed?": "继续将导致无法还原之前已经应用的修改。您确定要继续吗？",
  Revert,
  "Filter(Verb)": "筛选",
  "Candidate(s)": "候选项",
  "New data": "新数据",
  "Resource diffs": "资源变化",
  "This process may take a long time, please be patient": "该过程可能会使用很长时间，请耐心等待",
  "Reverting will be disabled": "还原功能即将被禁用",
  "Revert bulk modification": "还原批量修改",
  "All changes will be reverted, and there is no way back. Are you sure to revert current bulk modification?": "所有修改将会被还原，且无法撤销。您确定要还原当前的批量修改吗？",
  "Bulk modification has been reverted successfully": "批量修改已成功还原",
  "Bulk modification has been applied successfully": "批量修改已成功应用",
  "Duplicating a bulk modification": "复制批量修改",
  "A new bulk modification will be created from current selection": "将会通过当前选择的批量修改规则创建一个新的方案",
  "Deleting this bulk modification": "删除批量修改",
  "Are you sure to delete this bulk modification?": "确定删除吗？",
  "Close a bulk modification": "关闭批量修改",
  "You will not be able to operate on a closed bulk modification": "关闭后将无法操作此批量修改",
  Closed,
  "Add root path": "添加根目录",
  "Add media libraries in bulk": "批量添加媒体库",
  "Add in bulk": "批量添加",
  "Add root paths in bulk": "批量添加根目录",
  "All related data will be deleted too, are you sure?": "所有相关数据也将被删除，确定吗？",
  "This page is a temporarily page, it may be removed in the future": "这是一个临时页面，将来可能会被移除",
  "Resource property": "资源属性",
  Originals,
  "Custom properties": "自定义属性",
  Option,
  "Number": "数字",
  "No category bound": "暂未绑定分类",
  "Not selected": "未选择",
  "Binding custom properties to category {{categoryName}}": "绑定自定义属性至分类 {{categoryName}}",
  "SearchOperation.Equals": "等于",
  "SearchOperation.NotEquals": "不等于",
  "SearchOperation.Contains": "包含",
  "SearchOperation.NotContains": "不包含",
  "SearchOperation.StartsWith": "前缀等于",
  "SearchOperation.NotStartsWith": "前缀不等于",
  "SearchOperation.EndsWith": "后缀等于",
  "SearchOperation.NotEndsWith": "后缀不等于",
  "SearchOperation.GreaterThan": "大于",
  "SearchOperation.LessThan": "小于",
  "SearchOperation.GreaterThanOrEquals": "大于等于",
  "SearchOperation.LessThanOrEquals": "小于等于",
  "SearchOperation.IsNull": "为空",
  "SearchOperation.IsNotNull": "不为空",
  "SearchOperation.In": "在列表中",
  "SearchOperation.NotIn": "不在列表中",
  "SearchOperation.Matches": "正则匹配",
  "SearchOperation.NotMatches": "正则不匹配",
  Asc,
  Desc,
  "Filter group": "筛选条件组",
  "Please read terms and conditions carefully before you start to use this app": "请在使用前仔细阅读使用条款",
  "Click to check": "点击查看",
  Data,
  "Other tools": "其他工具",
  Tools,
  System,
  "Preview files of a resource on mouse hover": "鼠标悬浮时预览资源文件",
  "Disabling cache may cause performance issues": "禁用缓存可能会降低加载速度",
  "Enabling caching can improve loading speed": "启用缓存可以提高加载速度",
  "Exit bulk operations mode": "退出批量操作模式",
  "Bulk operations mode": "批量操作模式",
  "Select orders": "选择排序方式",
  "Date": "日期",
  SingleLineText,
  MultilineText,
  Link,
  Percentage,
  Rating,
  SingleChoice,
  MultipleChoice,
  Attachment,
  "Boolean": "是/否",
  "With {{depth}} layers": "{{depth}}层数据",
  "Convert to": "转换为",
  "Select a property": "选择一个属性",
  Migration,
  Migrate,
  "Some data will be lost": "部分数据将会丢失",
  "check them here": "点此查看",
  Confirm,
  "StandardValueConversionLoss.All": "数据将会丢失",
  "StandardValueConversionLoss.InconvertibleDataWillBeLost": "不可转换的数据将会丢失",
  "StandardValueConversionLoss.NotEmptyValueWillBeConvertedToTrue": "非空值将会被转换为'是'",
  "StandardValueConversionLoss.ValuesWillBeMerged": "数据将会被合并",
  "StandardValueConversionLoss.OnlyFirstValueWillBeRemained": "仅保留第一个数据",
  "StandardValueConversionLoss.NonZeroValueWillBeConvertedToTrue": "非零值将会被转换为'是'",
  "StandardValueConversionLoss.TextWillBeLost": "文本信息将会丢失",
  "StandardValueConversionLoss.TimeWillBeLost": "时间信息将会丢失",
  "StandardValueConversionLoss.DateWillBeLost": "日期信息将会丢失",
  "StandardValueConversionLoss.TagGroupAndNameWillBeMerged": "标签组和名称会被合并",
  "Because the new feature is not compatible with some historical data, please complete the data migration before using it.": "由于新功能与部分历史数据不兼容，请在使用前完成数据迁移。",
  "No properties available": "没有可用的属性",
  "Add a property": "添加一个属性",
  "Max value": "最大值",
  "Are you sure to migrate [{{target}}] to [{{property}}]?": "确定要将[{{target}}]迁移至[{{property}}]吗？",
  "Congratulations, all data has been migrated": "恭喜您完成了所有数据迁移任务",
  "Conversion loss": "转换损失",
  "All data will be retained": "所有数据将会保留",
  "Found {{count}} data, and {{changedDataCount}} data will be modified or deleted": "找到{{count}}条数据，其中{{changedDataCount}}条数据会被修改或删除",
  "You are changing property type": "您正在更改属性类型",
  "Changing the property type may cause the loss of existing data. Click 'continue' to check.": "更改属性类型可能会导致现有数据丢失。点击'继续'查看。",
  Continue,
  "Final check": "最终检查",
  "Found {{count}} data, and all of them will be retained": "找到{{count}}条数据，所有数据都将会被保留",
  Convert,
  "Be careful, this process is irreversible": "请注意，此操作不可逆",
  "Volume.Index": "期数序号",
  "Volume.Name": "期数名称",
  "Volume.Title": "期数标题",
  "We are checking all the data, this may take up to 1 minute, please wait.": "我们正在检查所有数据，这可能需要1分钟，请耐心等待。",
  "Select a type": "选择类型",
  "Bind tags to resources": "绑定资源标签",
  Formula,
  "Duplicating a category": "复制分类",
  "Please input a new name for the duplicated category": "请为复制的分类录入一个新名称",
  "Click to set": "点击设置",
  "Display name template": "名称展示模板",
  "You can set a display name template for resources. By default, file name will be used as display name": "您可以设置一个模板用来展示资源的名称。默认情况下，文件名将会被用作展示名称",
  "category.displayNameTemplate.propertyExample": "您可以通过使用<1>{属性名}</1>的格式来向模板添加属性值。例如：如果使用了<3>{{{samplePropertyName}}}</3>，那么它将会被替换为属性名为<5>{{samplePropertyName}}</5>对应的值。",
  "You can use any combination of text and following properties in template, and you can add more properties in category configuration.": "您可以在模板中录入文本和以下属性的任意组合；如果需要使用更多属性，请在分类配置中关联它们。",
  "Be careful if you have multiple properties with same name, only a random one will be replaced.": "请注意，如果您有多个同名的属性，那么它将会被随机替换成其中一个属性的值。",
  "You can safely use any of following text wrappers to wrap the properties, and wrappers surrounding the property with empty value will be removed automatically.": "您可以安全地使用以下任意文本包裹字符来包裹属性，当属性值为空时，这些包裹字符会被自动移除。",
  "You can check and set the wrappers in special text configuration.": "您可以在特殊字符配置中查看和设置这些包裹字符。",
  "Edit display name template for category {{name}}": "编辑分类{{name}}的展示名称模板",
  "If you leave the template with empty value, the file name will be the display name.": "如果您将模板留空，文件名将会被用作展示名称。",
  "We have encountered some problems. You could try the following steps:": "我们遇到了一些问题。您可以尝试以下操作：",
  "how should I handle this problem?": "如何处理？",
  "What to do when encountering a problem": "遇到问题时如何处理",
  "Simply retry": "重试",
  "Press 'F5' to reload the page.": "按下'F5'重新加载页面。",
  "Restart the app": "重启应用",
  "Shutdown and restart the app completely.": "关闭并重启应用。",
  "Contact support": "联系官方支持",
  "You can find the latest log file at": "您可以在这里找到最新的日志文件",
  "If you have no programming experience,": "如果您没有编程经验，",
  "Otherwise,": "否则，",
  "please provide the latest log file to the support team.": "请将最新的日志文件提供给支持团队。",
  "you can locate and collect the error messages in the log file, and provide they to the support team. (open an issue on github, or send to developer directly)": "您可以自行定位并收集错误信息，然后将它们提供给支持团队。（在Github上创建一个issue，或者直接发送给开发者）",
  "ErrorHandlingModal.FindContactInConfigurationPage": "您可以在<1>系统配置页面</1>的底部找到支持团队的联系方式。",
  "Try other features": "尝试其他功能",
  "Return to homepage": "返回首页",
  "Data not relative to resource will not be migrated.": "未与资源关联的数据将不会被迁移。",
  "Click to preview": "点击预览",
  "This enhancer can produce the following property values": "此增强器可以生成以下属性值",
  "Save as property": "保存为属性",
  "Other options": "其他选项",
  "Configure enhancer:{{enhancerName}} for category:{{categoryName}}": "为分类:{{categoryName}}配置增强器:{{enhancerName}}",
  "StandardValueType.String": "文本",
  "StandardValueType.ListString": "多个文本",
  "StandardValueType.Decimal": "数字",
  "StandardValueType.Link": "链接",
  "StandardValueType.Boolean": "是/否",
  "StandardValueType.DateTime": "日期时间",
  "StandardValueType.Time": "时间",
  "StandardValueType.ListListString": "多级文本",
  "StandardValueType.ListTag": "标签列表",
  "Integrate with alias": "使用别名",
  "If checked, the value produced will be replaced with the preferred alias.": "如果选中，生成的值将会被替换为首选别名。",
  "We are leaving current page": "即将离开当前页面",
  "Are you sure?": "确定吗？",
  "Data will be attempted to be converted into date&time data according to relevant conversions.": "数据将会尝试根据相关转换规则转换为日期时间数据。",
  "Data will be processed with special texts.": "数据将会被特殊字符处理。",
  "Click to check special texts": "点击查看特殊字符",
  "Integrate with special text": "应用特殊字符",
  "Common options": "通用选项",
  "Targets of enhancer": "增强目标",
  "By default, an empty layer will be created if we meet an empty value in multilevel data.": "默认情况下，如果多级数据有空值，那么我们会创建对应的空的层级。",
  "If checked, this kind of data will be matched with the most similar multilevel value in the database.": "如果勾选了本选项，这类的数据将会自动尝试去与数据库中最接近的数据匹配。",
  "For example, assume we already have a multilevel data: a->b->c, then for the incoming data: ->->c, the values of 1st and 2nd layers of which are empty.": "比如，假设我们的数据库中已经有一个多级数据：a->b->c，然后我们遇到了一个新的数据：->->c，它的第一级和第二级的值为空。",
  "If this option is checked, we'll save ->->c as a->b->c, otherwise the incoming value ->->c will be saved.": "如果勾选了本选项，我们将会将该数据视为a->b->c；否则，我们将会原封不动地保存该数据：->->c。",
  "This option may cause unexpected behaviors, make sure you have enough confidence to merge the produced data into data in db before check it.": "该选项可能会导致不可预期的结果，在勾选之前请确保您有足够信心可以将产生的数据和当前数据库中的数据合并。",
  "Auto match on empty values": "自动匹配空值",
  "None of targets is mapped to a property, so no data will be enhanced.": "未检测到任何增强目标与属性值的关联，数据将不会被增强。",
  "Adding new data dynamically is disabled for this property, new data will not be saved.": "该属性被禁止动态添加新数据，新的数据将不会被保存。",
  "Allow adding new data dynamically": "允许动态添加数据",
  "Click to enable": "点击启用",
  "Some of targets are not mapped to a property, corresponding data will not be enhanced.": "部分增强目标未与属性值关联，对应的数据将不会被增强。",
  "This property is not bound to the category, its data will not be displayed.": "该属性未被绑定至分类，数据将不会被展示。",
  "Bind property {{propertyName}} to category {{categoryName}}": "将属性{{propertyName}}綁定至分类{{categoryName}}",
  "Bind now": "立即绑定",
  "Delete category": "删除分类",
  "This operation cannot be undone. Would you like to proceed?": "此操作无法撤销。您确定要继续吗？",
  "Boolean.True": "是",
  "Boolean.False": "否",
  CreatedAt,
  FileCreatedAt,
  FileModifiedAt,
  "Filter.Operation": "规则",
  "Unsupported type": "不支持的类型",
  "Combinator.And": "并且",
  "Combinator.Or": "或者",
  "Clear all": "清除全部",
  "Raw data": "原始数据",
  "Generated custom property value": "创建的自定义属性值",
  "This enhancer enhanced this resource at {{enhancedAt}}.": "此增强器于{{enhancedAt}}增强了该资源。",
  "This enhancer has not enhance this resource yet.": "此增强器尚未增强该资源。",
  "Re-enhance now": "重新增强",
  "Path of resource": "资源路径",
  "CategoryResourceDisplayNameSegmentType.StaticText": "静态文本",
  "CategoryResourceDisplayNameSegmentType.Property": "属性",
  "CategoryResourceDisplayNameSegmentType.LeftWrapper": "左包裹符",
  "CategoryResourceDisplayNameSegmentType.RightWrapper": "右包裹符",
  "Preview display names of resources": "预览资源展示名称",
  "There is no property bound yet, you can bind properties to category first.": "尚未绑定任何属性，您可以先将属性绑定至分类。",
  "FeatureRequestTip.Developing": "功能<1>{{name}}</1>正在开发中。您可以在<3>GitHub</3>或<5>QQ群</5>中催促作者或提出建议。",
  "FeatureRequestTip.Deprecated": "原功能<1>{{name}}</1>已被移除。如果您需要此功能，请在<3>GitHub</3>或<5>QQ群</5>中提出。",
  "FeatureRequestTip.Deprecating": "功能<1>{{name}}</1>将被移除。如果您需要此功能，请在<3>GitHub</3>或<5>QQ群</5>中提出。",
  Beta: Beta$1,
  "This feature is in beta and may be unstable. Please report any issues you encounter.": "此功能处于测试阶段，可能不稳定。如遇到问题请及时反馈。",
  Deprecated: Deprecated$1,
  "This feature is deprecated and may be removed in future versions. Please consider using the recommended alternative.": "此功能已弃用，可能在未来的版本中被移除。请考虑使用推荐的替代方案。",
  "Setup wizard": "设置向导",
  "Create a category": "创建一个分类",
  "Please enter the name of the category": "请输入分类的名称",
  "We'll sort categories by name": "我们将按照名称排序分类",
  "You need to set up root path before configuring this item": "设置本项之前您需要先配置根目录",
  "{{mode}} mode is available": "{{mode}}模式可用",
  "{{mode}} mode is unavailable": "{{mode}}模式不可用",
  "Mark this path segment as": "将当前路径片段标记为",
  "Sure to delete this property?": "确定删除当前属性吗？",
  "Configure [{{property}}] property for path segment": "为路径片段配置属性[{{property}}]",
  "Path segment": "路径片段",
  "Segment of root path": "根路径片段",
  "Segment of resource": "资源路径片段",
  "Current segment": "当前路径片段",
  "Deleting an alias: {{text}}": "删除别名：{{text}}",
  "There is no way back, are you sure?": "操作不可恢复，确定继续吗？",
  "{{text}} will be the preferred text in merged groups, you can change the preferred text by clicking the text.": "{{text}}将会作为合并后的别名组的首选文本，您可以通过点击它们来修改首选文本。",
  "All selected alias groups and its candidates will be delete and there is no way back, are you sure?": "所有已选择的别名组和它们的候选词均会被删除，并且不可恢复，确认继续吗？",
  "Deleting alias groups: {{texts}}": "正在删除多个别名组：{{texts}}",
  "All selected alias groups will be merged into one, and the final preferred is {{preferred}}, are you sure?": "所有选择的别名组将会被合并至一个组，并且最终的首选文本是{{preferred}}，确认继续吗？",
  "Merging alias groups: {{texts}}": "正在合并多个别名组：{{texts}}",
  "Set as preferred": "设置为首选",
  "Press enter to search": "按下回车键搜索",
  "Add an alias": "添加别名",
  "For more information, you can visit:": "为了了解更多信息，您可以访问：",
  "Add a proxy": "添加代理",
  "Use system proxy": "使用系统代理",
  "Do not use proxy": "不使用代理",
  "PropertyValueScope.Manual": "手动设置",
  "PropertyValueScope.Synchronization": "同步",
  "PropertyValueScope.BakabaseEnhancer": "Bakabase增强器",
  "PropertyValueScope.ExHentaiEnhancer": "ExHentai增强器",
  "PropertyValueScope.BangumiEnhancer": "Bangumi增强器",
  "PropertyValueScope.DLsiteEnhancer": "DLsite增强器",
  "PropertyValueScope.RegexEnhancer": "正则增强器",
  "PropertyValueScope.KodiEnhancer": "Kodi增强器",
  "PropertyValueScope.TmdbEnhancer": "TMDb增强器",
  "PropertyValueScope.AvEnhancer": "AV增强器",
  "You can set the priority for following scopes of values, the first not empty value in the priority queen will be displayed, and you also can hide values by deselecting their scopes.": "您可以设置不同维度的数据的展示优先级，第一个不为空的数据将会被展示；您也可以通过反选维度来隐藏数据。",
  "This priority will be applied for all properties and resources.": "该优先级会被应用到所有属性和资源上。",
  "Unknown property": "未知属性",
  "Select data": "选择数据",
  "Reset search criteria": "重置搜索条件",
  "Resource not found": "未找到资源",
  "Delete a property": "删除属性",
  "This operation can not be undone, are you sure?": "本操作无法被撤回，确认继续吗？",
  "PropertyType.SingleLineText": "单行文本",
  "PropertyType.MultilineText": "多行文本",
  "PropertyType.SingleChoice": "单选",
  "PropertyType.MultipleChoice": "多选",
  "PropertyType.Number": "数字",
  "PropertyType.Percentage": "百分比",
  "PropertyType.Rating": "评分",
  "PropertyType.Boolean": "是/否",
  "PropertyType.Link": "链接",
  "PropertyType.Attachment": "附件",
  "PropertyType.Date": "日期",
  "PropertyType.DateTime": "日期时间",
  "PropertyType.Time": "时间",
  "PropertyType.Formula": "公式",
  "PropertyType.Multilevel": "多级选项",
  "PropertyType.Tags": "标签",
  "Created by:": "来源于：",
  "{{count}} categories": "{{count}}个分类",
  Precision,
  Multilevel,
  UnderDevelopment,
  "Sort by alphabet": "按字母表排序",
  "Add a choice": "添加选项",
  "Allow adding new options while choosing": "允许动态添加选项",
  "Default value": "默认值",
  "Add choices in bulk": "批量添加选项",
  "Please enter the data you want to add, separated by line breaks": "请输入要添加的数据，用换行分隔",
  "Please enter the data you want to add, colon can be added between group and name, and you can separated tags by line breaks": "请输入要添加的数据，英文冒号可以被用来分隔标签组和标签名，也可以用换行分隔多个标签",
  "Searching...": "搜索中",
  "Saved passwords": "已保存密码",
  "Custom enhancer": "自定义增强器",
  "Deleting property locator for {{propertyName}}": "删除属性[{{propertyName}}]的定位器",
  "This is not a fixed enhancement target, which will be replaced with other content when data is collected": "这是一个非固定的增强目标，将会在获取数据时被替换成其他内容，请以实际采集的数据为准",
  "Dynamic target": "动态目标",
  "Enhancement target": "增强目标",
  General,
  "Specify dynamic target": "指定动态目标",
  "Auto bind property": "自动绑定属性",
  "Click to specify target": "点击指定目标",
  "Duplicate dynamic target is found": "有重复的动态目标",
  "This field is required": "该字段为必填字段",
  "If this option is checked, a property with the same name and type of the target will be bound automatically.": "如果勾选本项，系统会自动为当前目标绑定一个相同名称和类型的属性。",
  "If there isn't such a property, a new property will be created and bound to this target.": "如果未找到该属性，则会自动创建一个新属性并绑定至当前目标",
  "If this option is checked in default options of a dynamic target, all unlisted dynamic targets will be bound to properties of the same type with the same name.": "如果在动态目标的默认选项中勾选了此项，则会自动为所有未列出的动态目标分别绑定相同名称和类型的属性。",
  "Check configuration": "检查配置",
  "Delete unknown resources": "删除未知资源",
  "Delete all resources bound to unknown category or media library": "删除所有未知分类或媒体库绑定的资源",
  Unbind,
  "Advance filter": "高级筛选",
  "Value is being referenced in {{count}} places": "该值当前在{{count}}处被引用",
  "{{count}} values": "{{count}}个值",
  "Show properties not bound to categories": "显示未与分类绑定的属性",
  "Group of tag, optional": "标签组（非必填）",
  "Add or delete tags in bulk": "批量添加或删除标签",
  "Add or delete in bulk": "批量添加或删除",
  "Colon can be added between group and name, and tags will be separated by line breaks.": "英文冒号:可以被用来分隔标签组和标签名，也可以用换行分隔多个标签。",
  "Once you click the submit button, new tags will be added to the list, and missing tags will be deleted.": "一旦您点击了提交按钮，新的标签将会被加入到列表中，而缺失的标签将会被删除。",
  "Be cautions: once you modify the text in one line, it will be treated as a new tag, and the original tag will be deleted.": "请注意：一旦您修改了一行中的文本，它将会被视为一个新的标签，原有的标签将会被删除。",
  "{{count}} data will be deleted": "{{count}}条数据将会被删除",
  "{{count}} data will be added": "{{count}}条数据将会被添加",
  "Tags will be changed": "标签即将变更",
  "Regex expressions": "正则表达式",
  "Available capture groups:": "有效的捕获组：",
  "No named capture groups were found, so the enhancement will not take effect.": "没有发现任何捕获组名称，增强将不会生效。",
  "You can set multiple regex expressions(separated by new line) to match the file or folder name of each resource.": "您可以设置多个正则表达式(换行分隔)作用于资源的文件(夹)名上。",
  "Text matched by multiple capture groups with the same name will be merged into a list and deduplicated.": "被具有相同名称的捕获组匹配到的文本将会被合并成一个列表并去重。",
  "After setting regex expressions, you must go to category page to configure regex enhancer for each category.": "在设置完正则表达式后，您需要在分类页面配置为分类配置正则表达式增强器。",
  "You need to use the same name(index-based group name will be ignored) as the capture group for the dynamic enhancement target, otherwise the resource may not be enhanced.": "您需要在动态增强目标中配置和捕获组一样的名称（数字组名会被忽略），否则资源将不会被增强。",
  "Regex enhancer": "正则增强器",
  Internal,
  "Sync all media libraries": "同步全部媒体库",
  "Sync all media libraries in current category": "同步当前分类下的所有媒体库",
  "Sync current media library": "同步当前媒体库",
  "You cannot select a file outside the root folder. If you want to change the root folder of your library, you should click on your root folder.": "您不能选择根目录之外的文件，如果您想更改媒体库的根目录，请点击根目录修改。",
  "CoverSelectOrder.FilenameAscending": "文件名升序",
  "CoverSelectOrder.FileModifyDtDescending": "文件修改时间降序",
  "ResourceProperty.Introduction": "介绍",
  "ResourceProperty.Rating": "评分",
  "You can bind properties in category page": "您可以在分类页面绑定属性",
  "Check type conversion rules": "查看类型转换规则",
  "Type conversion rules": "类型转换规则",
  "Type to be converted": "待转换类型",
  "Value to be converted": "待转换值",
  "Delete all enhancement records of this enhancer for category {{categoryName}}": "删除分类 {{categoryName}} 下所有当前增强器的增强记录",
  "Delete all enhancement records of this enhancer": "删除当前增强器的所有增强记录",
  "Can not operate on this property": "无法操作当前属性",
  "Unsupported property type: {{type}}": "不支持的属性类型：{{type}}",
  "Unsupported reserved property type: {{type}}": "不支持的预置属性类型：{{type}}",
  "Add or delete choices in bulk": "批量添加或删除",
  "Choices will be separated by line breaks.": "每行是一个选项",
  "Once you click the submit button, new choices will be added to the list, and missing choices will be deleted.": "一旦您点击了提交按钮，新的数据会被添加至选项列表中，其他未和原数据匹配的选项会被移除",
  "Be cautions: once you modify the text in one line, it will be treated as a new choice, and the original choice will be deleted.": "请注意：一旦您修改了一行中的文本，它将会被视为一个新的选项，原有的选项将会被删除。",
  "Please select a property first": "请先选择一个属性",
  "Not supported": "暂不支持",
  "BuiltinPropertyForDisplayName.Filename": "文件名",
  "Source type": "源类型",
  "Target type": "目标类型",
  Rules,
  "Click to change type": "点击变更类型",
  "Following rule(s) will be applied": "将会应用下述规则",
  "Converted value": "转换后的值",
  "Check examples": "查看样例",
  "Type conversion examples": "类型转换样例",
  "Add a root path": "添加根目录",
  "Source value": "源值",
  Condition,
  "Please select a file to play": "请选择一个需要播放的文件",
  "Move to media library": "移动至媒体库",
  "Move {{count}} resources to media library": "移动{{count}}个资源至媒体库",
  "Final value": "最终值",
  "Display value": "展示值",
  "Setup priority of property value scopes": "设置多维属性值优先级",
  "Visible scopes": "可见维度",
  "This filter is used for quick check and does not change the priority of property value scopes.": "这个过滤器仅用于快速查阅，不会改变属性值维度的优先级",
  "The numbers represent the priority of property dimensions, and the property values will be displayed according to the priority of the dimensions.": "数字代表属性维度的优先级，属性值将会根据维度的优先级展示。",
  "indicates this scope is not enabled": "表示该维度未启用",
  "You can click on the scope button to change the priority of the property value scopes.": "您可以点击维度按钮来改变它的优先级。",
  "Importing, please wait...": "导入中，请稍后。。。",
  "Other files": "其他文件",
  "Other files in {{parent}}": "{{parent}}内的其他文件",
  "Decompress {{count}} files": "解压 {{count}} 个文件",
  "Extract {{count}} directories": "提取 {{count}} 个目录",
  "Wrap {{count}} items": "包裹 {{count}} 个项目",
  "Delete {{count}} items": "删除 {{count}} 个项目",
  "Delete items with the same names": "删除同名项目",
  "Move {{count}} items": "移动 {{count}} 个项目",
  "Group {{count}} items": "组合 {{count}} 个项目",
  "Group internal items": "组合内部项目",
  "Copy {{count}} names": "复制 {{count}} 个名称",
  "Copy {{count}} paths": "复制 {{count}} 个路径",
  "Removing all filesystem entries in {{workingDirectory}} that have the same names as the {{count}} selected filesystem entries": "在{{workingDirectory}}下寻找并删除所有和已选的{{count}}个文件(夹)同名的文件(夹)",
  "Calculating changes...": "正在计算变更。。。",
  "File Mover": "文件移动器",
  "The data has been created, indicating that the enhancer has completed the data retrieval process, which is typically done by accessing third-party sites or executing specific internal logic. You can check the status of the data retrieval in the table below. Frequent repeated data retrieval attempts may result in access denial from third-party services.": "数据被创建说明增强器已经完成了获取数据的步骤，获取数据通常是通过访问第三方站点或执行程序内部的特殊逻辑完成。您可以通过下方表格检查数据的获取情况，频繁重复获取数据可能会导致您被第三方服务拒绝访问。",
  "The application of data indicates that the retrieved data has been successfully converted into attribute values. This step is conducted entirely within the program, without involving any third-party data exchange.": "数据被应用表示已经成功将已获取的数据转换为属性值，该步骤尽在程序内部进行，不涉及第三方数据交换。",
  "Retrieve data then apply data. To reduce the possibility of access denial from third-party services, it is recommended to apply data only after all data has been retrieved. Configuring enhancer options in category won't affect the data retrieval process, it only affects the data applying process.": "先获取数据再应用数据。为了减少第三方服务拒绝访问的可能性，建议在数据获取完毕后仅进行应用数据操作。在分类中配置增强器不会影响数据获取过程，只会影响应用数据的过程。",
  "Data created at": "数据创建于",
  "Data applied at": "数据应用于",
  "Apply data": "应用数据",
  "Apply the data to property values of the resource.": "将数据应用到资源的属性值中。",
  "Re-apply all enhancement data of this enhancer for category {{categoryName}}": "重新应用分类 {{categoryName}} 下所有当前增强器的增强数据",
  "Task list": "任务列表",
  "Stopping task: {{taskName}}": "停止任务：{{taskName}}",
  "Are you sure to stop this task?": "确定停止该任务吗？",
  Dismiss,
  "The value type of this target is": "该目标的值类型为",
  "Successfully saved": "保存成功",
  "Target will not be applied because there is no property to store it.": "目标不会被应用，因为没有属性来存储它。",
  "Cookie is valid": "Cookie有效",
  Page,
  "Untitled search": "未命名搜索",
  "Save current search to quick search": "保存当前搜索条件至快捷搜索",
  "Save current search": "保存当前搜索条件",
  "Cover mode": "封面模式",
  "Fill cover": "填充封面",
  Show,
  "Cover cache": "封面缓存",
  "Resource Not Found. You can try the following solutions:": "未找到资源。您可以尝试以下方案：",
  "1. Please check if the search criteria is correct.": "1. 请检查搜索条件是否正确。",
  "2. Please make sure that categories have been created, the media library has been configured, and synchronization has been completed.": "2. 请确保已经创建了分类、配置了媒体库并且完成了同步操作。",
  "Go to category page": "前往分类页面",
  "Keyboard.Enter": "回车",
  "Unassociated custom properties will not be displayed.": "未关联的自定义属性将不会被展示。",
  "You should set up a media library first to visit your resources": "您需要先设置一个媒体库才能访问您的资源",
  "Set up now": "立即设置",
  "Set up in bulk": "批量设置",
  "Resource not found? Please try to perform the synchronization operation.": "未找到资源？请尝试执行同步操作。",
  "To get your resources loaded, you must add at least one root path containing your local resources to this media library": "为了加载您的资源，您必须至少添加一个包含您本地资源的根目录到该媒体库",
  "No property available. Please bind properties to category if you need to show them.": "没有可用的属性。如果您需要展示属性，请将属性绑定至分类。",
  "Categories have not been created yet. To load your resources, please ensure that at least one category is created.": "暂未创建分类，为了加载您的资源，请确保至少创建一个分类。",
  "Unassociated custom properties will not be displayed": "未关联的自定义属性将不会被展示",
  "Generated properties": "生成的属性",
  "Please set a name for current search": "请为当前搜索设置一个名称",
  "Cover carousel": "封面轮播",
  "Check integrity and attempt to repair": "检查完整性并尝试修复",
  "Disable group": "禁用组",
  "Delete group": "删除组",
  "Show all {{count}} files": "展示全部{{count}}个文件",
  "Use cache": "使用缓存",
  "Enabling cache can improve loading speed, but your covers and playable files will not be updated in time unless you clear or disable cache manually.": "启用缓存可以提高加载速度，但是您的封面和可播放文件将不会及时更新，除非您手动清除或禁用缓存。",
  "Synchronize resource data": "同步资源数据",
  "Please note that if you modify the path of the resource, the new path will be considered as a new resource, at meantime the old resource data will be deleted.": "请注意，如果您修改了资源的路径，那么它将会被视作一个新的资源，同时老的资源数据将会被删除。",
  "All eligible files or folders under the specified root directory will be saved to the media library.": "所有指定根目录下符合条件的文件或文件夹将会被保存至媒体库中。",
  "Add a bulk modification": "添加一个批量修改方案",
  "{{count}} resources related": "{{count}}个相关资源",
  "BulkModificationProcessorValueType.ManuallyInput": "手动输入",
  "BulkModificationProcessorValueType.Variable": "变量",
  "Check {{count}} diffs": "查看{{count}}个变化",
  "Under development, currently supported data types": "正在开发中，目前支持的数据类型",
  "When the enhancement is successfully executed but no data available for enhancement is retrieved, an empty enhancement record is generated.": "当增强成功执行，但获取到任何可用于增强的数据时，会产生空的增强记录。",
  "Delete empty records only": "仅删除空记录",
  "Enhancement will only be executed when there are no existing enhancement records, so in some cases, you may only need to delete the empty enhancement records.": "增强仅会在没有增强记录时执行，所以有些情况下您也许仅需要删除空的增强记录。",
  "No data retrieved for dynamic targets, please check configuration if necessary": "未获取到动态目标数据，有必要的话请检查配置",
  "No data retrieved for fixed targets, please check configuration if necessary": "未获取到固定目标数据，有必要的话请检查配置",
  "Move {{count}} resources to media library (Including file system entries)": "移动{{count}}个资源至媒体库（包括文件）",
  "Move to media library (Including file system entries)": "移动至媒体库（包括文件）",
  "Move {{count}} resources to media library (Data only)": "移动{{count}}个资源至媒体库（仅数据）",
  "Move to media library (Data only)": "移动至媒体库（仅数据）",
  "Delete {{count}} unknown resources permanently": "永久删除{{count}}个未知资源",
  "Choose a method to handle unknown (path does not exist) resources": "选择一个方法来处理未知（路径不存在）资源",
  "Transfer data": "转移数据",
  "You can transfer the data of unknown resources to existing resources.": "您可以将未知资源的数据转移至现有资源。",
  "You can also transfer the data of some of unknown resources to existing resources first, and then delete the remaining unknown resources.": "您也可以先将部分未知资源的数据转移至现有资源，然后再删除剩余的未知资源。",
  "You can delete all unknown resources permanently.": "您可以永久删除这些未知资源。",
  "Choose a method to handle unknown resources": "选择一个方法来处理未知资源",
  "When the system fails to find the file or folder corresponding to the resource path, the resource is marked as an unknown resource.": "当系统无法找到与资源路径对应的文件或文件夹时，该资源会被标记为未知资源。",
  "In most cases, this is caused by changes in the names of files or folders.": "在大多数情况下，这是由文件或文件夹名称变化导致的。",
  "Handle {{count}} unknown resources": "处理{{count}}个未知资源",
  "Hold down Ctrl to select multiple resources.": "按住Ctrl键来选择多个资源。",
  "You can perform more actions by right-clicking on the resource.": "您可以通过右键单击资源来执行更多操作。",
  "ResourceTag.IsParent": "父级资源",
  "ResourceTag.Pinned": "置顶资源",
  "ResourceTag.PathDoesNotExist": "文件不存在",
  "ResourceTag.UnknownMediaLibrary": "未知媒体库",
  "Special filters": "特殊筛选",
  "Delete resource": "删除资源",
  "Delete {{count}} resources": "删除{{count}}个资源",
  "Transfer resource data": "转移资源数据",
  "Transfer data of {{count}} resources": "转移{{count}}个资源的数据",
  "Are you sure you want to delete {{count}} resources?": "确定要删除{{count}}个资源吗？",
  "Resource will be shown again after next synchronization if you leave files undeleted.": "如果您不删除文件，资源将在下次同步后再次出现。",
  "Select a media library": "选择一个媒体库",
  "Delete files also": "同时删除文件",
  "Show unfinished only": "仅显示未完成",
  "Transfer data of resources": "转移资源数据",
  "Path keyword": "路径关键字",
  "Source resource": "源资源",
  "Resource will be overwritten": "将被覆盖的资源",
  "Please select a target resource on the right side": "请在右侧选择一个目标资源",
  "Input keyword of the resource path to select the target resource": "输入资源路径的关键字来选择目标资源",
  "20 results can be shown at most, please refine your search": "最多展示20个结果，请细化您的搜索",
  "You may need modify the default keyword to search the expected resources": "您可能需要修改默认关键字来搜索您期望的资源",
  "Can not find any resource": "未找到任何资源",
  "Current path": "当前路径",
  "Reset keyword to path of from resource": "重置关键字为源资源的路径",
  "Delete source resource (data only)": "删除源资源（仅数据）",
  "Keep associated media library information for target resource": "保留目标资源的媒体库信息",
  "Delete all {{count}} source resources (data only)": "删除所有源资源（所有页面）",
  "Category and media library of target resource will be remained by default.": "默认情况下目标资源的分类和媒体库将会被保留。",
  "By disable this options, the category and media library of target resource will be replaced with data from source resource.": "禁用本选项后，目标资源的分类和媒体库将会被源资源的数据替代。",
  "For all {{count}} items": "对全部{{count}}个项目",
  "Following properties will not be transferred": "以下属性将不会被转移",
  "Property.Parent association": "父级关联",
  "Property.Path": "路径",
  "Property.FileCreatedAt": "文件创建时间",
  "Property.FileModifiedAt": "文件修改时间",
  Finished,
  "Please note, if you modify the resource path (generally the file name), a new resource associated with the new path will be created after synchronization. You can transfer historical resource data to the new resource or directly delete the historical resource through the resource page.": "请注意，如果您修改了资源路径（通常是文件名），同步后将会创建一个与新路径关联的全新资源。您可以将历史资源数据转移至新资源，或者直接通过资源页面删除历史资源。",
  "Unknown media library": "未知媒体库",
  "File does not exist": "文件不存在",
  "Are you sure to select this media library?": "确定选择该媒体库吗？",
  "Are you sure to select this path?": "确定选择该路径吗？",
  "No files to preview": "没有可预览文件",
  "Please select mode": "请选择模式",
  "As the first cover": "作为第一张封面",
  "Current covers will be discard": "当前封面将会被弃用",
  "Please select cover save mode first": "请先选择封面保存模式",
  "Prepend to covers": "添加作为第一个封面",
  "Replace cover": "替换封面",
  Prepend,
  "Resources loaded in current page": "当前页面加载的资源",
  "{{count}} items selected": "已选择{{count}}项",
  Changes,
  FinalStep,
  "Apply changes": "应用变更",
  "Revert changes": "撤销变更",
  "Calculate changes": "计算变更",
  "Select resources to be modified.": "选择需要修改的资源。",
  "You can define and preprocess variables here, then use it in process steps.": "您可以在这里定义和预处理变量，然后在处理步骤中使用。",
  "You can define process steps here, and use variables in steps, to modify all filtered resources.": "您可以在这里定义处理步骤，并在步骤中使用变量，以修改所有筛选出的资源。",
  "Before applying bulk modification, you must calculate and check the changes here.": "在应用批量修改之前，您必须在这里计算和检查变更。",
  "Please check diffs before applying, and changed value may not be reverted perfectly in some situations,  are you sure to apply?": "请在应用前检查变更，某些情况下修改的值可能无法完全撤销，确定应用吗？",
  "Are you sure to revert the bulk modification?": "确定撤销批量修改吗？",
  "Select a scope for property value": "选择属性值的维度",
  "Set a name for this variable": "为此变量设置一个名称",
  Preprocessing,
  Scope,
  "Add a preprocess": "添加一个预处理",
  "If a preprocessing procedure is set, the variables will be preprocessed first before being used.": "如果设置了预处理过程，变量将会在使用前被预处理。",
  "You can add multiple preprocessing steps.": "您可以添加多个预处理步骤。",
  "Starts from 0": "从0开始",
  "Setting process": "设置处理流程",
  "PropertyPool.Reserved": "预置",
  "PropertyPool.Custom": "自定义",
  "Modify options are required": "修改选项是必填的",
  "Filter value is required": "筛选值是必填的",
  "Operation is required": "操作是必填的",
  "Please provide valid options": "请提供有效的选项",
  "Please provide a valid value": "请提供有效的值",
  "Please provide a valid value type": "请提供有效的值类型",
  "Please provide a valid property type": "请提供有效的属性类型",
  "Please provide a valid variable": "请提供有效的变量",
  "Find and replace are required": "查找和替换是必填的",
  Process,
  Progress,
  "Started at": "开始时间",
  Elapsed,
  "Estimate remaining time": "预计剩余时间",
  "Next time start at": "下次开始时间",
  Waiting,
  "Overwrite files in target path": "覆盖目标路径中的文件",
  Overwrite,
  "Deleting {{count}} download tasks": "删除{{count}}个下载任务",
  Cleanup: Cleanup$1,
  "Delete all completed tasks": "删除所有已完成任务",
  "Delete all failed tasks": "删除所有失败任务",
  "Export all tasks": "导出所有任务",
  "Task type": "任务类型",
  "Not available": "不可用",
  "Cookie required for authentication": "认证需要Cookie",
  "Default path where downloads will be saved": "下载文件的默认保存路径",
  "Max concurrency": "最大并发数",
  "Request interval (s)": "请求间隔（秒）",
  "Request interval help": "设置请求之间的时间间隔，避免过于频繁的请求",
  "Define how downloaded files should be named": "定义下载文件的命名规则",
  "Available fields": "可用字段",
  "Allow duplicate submission": "允许重复提交",
  "In general, it's not necessary to create identical tasks.": "通常情况下，不需要创建相同的任务。",
  "Auto retry": "自动重试",
  "Retry automatically when the downloading task failed.": "下载任务失败时自动重试。",
  "Check interval(s)": "检查间隔（秒）",
  "The interval (in seconds) after download completion or failure before restarting the task. Generally used for downloading content that updates periodically.": "在下载完成或失败后间隔多长时间（秒）再次开启任务，一般用于下载会不定期更新的内容。",
  "Select download path": "选择下载路径",
  "Page range": "页范围",
  "Start page": "起始页",
  "End page": "结束页",
  "The minimal page number is 1.": "最小页码为 1。",
  "Setup now": "立即设置",
  Developing: Developing$1,
  "This feature is currently in development and may not be fully functional.": "此功能正在开发中，可能无法完全正常工作。",
  "DevelopingFeature.ExpectChanges": "请期待后续更新。",
  Failure: Failure$1,
  Succeed: Succeed$1,
  TimedOut: TimedOut$1,
  Banned: Banned$1,
  Canceled: Canceled$1,
  Overall,
  "Property value coverage": "属性值覆盖度",
  Details,
  "As more data is filled in, property value coverage increases": "已填充的数据越多，属性值覆盖度越高",
  "Nothing to group. Please check if the folder contains any files; subfolders cannot be grouped": "未找到可以被组合的内容。请检查文件夹中是否包含文件；子文件夹无法被组合",
  Expand,
  "Expand selected": "展开选中项",
  "Collapse selected": "折叠选中项",
  "Auto group {{count}} selected files": "自动组合{{count}}个选中文件",
  "Auto group internal items in {{count}} selected directories": "自动组合{{count}}个选中文件夹的内部项目",
  "Wrap {{count}} items using directory": "使用文件夹包裹{{count}}个项目",
  "No play history": "没有播放记录",
  Item,
  "Played at": "播放时间",
  "Last played at {{dt}}": "上次播放于 {{dt}}",
  "Changing the playable file selector will clear all cached playable file information. The cache for these files will be rebuilt after the operation.": "变更可播放文件选择器将会清空所有已缓存的可播放文件信息。在执行变更后，可播放文件的缓存信息将会被重建。",
  "Play history": "播放历史",
  Untitled,
  "Add root data": "添加一级数据",
  "Bakabase enhancer pretreatment": "Bakabase增强器预处理",
  "Bakabase enhancer analysis": "Bakabase增强器分析",
  "Resource display name template": "资源展示名称模板",
  "Exhentai enhancer analysis": "Exhentai增强器分析",
  "Parsing or converting property value": "解析或转换属性值",
  "Be careful, this operation can not be undone": "请注意，该操作无法撤销",
  "No text was matched, but you can still save the regular expression.": "未匹配到任何文本，但您依旧可以保存该正则表达式。",
  "You can adjust orders or properties by dragging and dropping them": "您可以通过拖拽调整属性顺序",
  "Adjust orders of properties": "调整属性顺序",
  "Adjust the display priority of property scopes": "调整多维属性值展示优先级",
  "Adjust orders of linked properties for current category": "调整当前分类关联的属性顺序",
  "Adjust orders of properties globally": "调整全局属性顺序",
  "You can customize media library synchronization behavior here. If you leave the option blank, we will attempt to apply the parent selection according to priority.": "您可以在这里自定义同步媒体库的行为。如果您将选项留空，我们将会尝试按照优先级应用父级的选择。",
  "The priority is: Media library > Category > Global.": "优先级是：媒体库 > 分类 > 全局",
  Global,
  "Delete resources with unknown path": "删除文件不存在的资源",
  "Delete resources with unknown media library": "删除未知媒体库的资源",
  ReApply,
  ReEnhance,
  "Media library > Category > Global": "媒体库 > 分类 > 全局",
  "Resources with unknown path": "未知路径的资源",
  "The resource path becomes unknown, usually because the file has been moved or the file name or parent folder name has been modified.": "资源路径变为未知，通常是因为文件已被移动，或者文件名或父文件夹名称已被修改。",
  "Resources with unknown media library": "未知媒体库的资源",
  'The media library becoming "unknown" is usually due to the deletion of the media library or category, but its internal resources are still retained.': '媒体库变为"未知"通常是由于媒体库或分类被删除，但其内部资源仍然被保留。',
  "ReApply in enhancer": "在增强器中重新应用",
  "The enhancer will reapply the data it has already acquired to the resources based on the latest configuration. This step is relatively quick since it does not attempt to retrieve new data.": "增强器将根据最新配置，将已获取的数据重新应用到资源上。此步骤相对较快，因为它不会尝试获取新数据。",
  "ReEnhance in enhancer": "在增强器中重新增强",
  "It will delete all acquired enhanced data and applied enhanced data. Then, the enhancer will automatically attempt to reacquire and apply the data.": "此操作将删除所有已获取的增强数据和已应用的增强数据。然后，增强器将自动尝试重新获取并应用数据。",
  "Configuration item instructions": "配置项说明",
  "View configuration item instructions": "查看配置项说明",
  "Synchronization options": "同步配置",
  "Adjust display orders": "调整展示顺序",
  "Ignore the part inside the wrapper that is successfully matched by the regular expression": "忽略包裹符内部被正则匹配成功的部分",
  Rule: Rule$1,
  Through,
  "Resource filter": "资源过滤器",
  "Determine which files or folders will be considered as resources": "决定哪些文件或文件夹会被视作资源",
  "Playable(Runnable) files": "可播放(运行)文件",
  Properties: Properties$1,
  "PropertyPool.Abbreviation.Internal": "内",
  "PropertyPool.Abbreviation.Reserved": "预",
  "PropertyPool.Abbreviation.Custom": "自",
  "Sort by {{sortBy}}": "按{{sortBy}}排序",
  "Post links in {{source}}": "{{source}}帖子链接",
  "DownloadTaskParserSource.SoulPlus": "SoulPlus",
  "Current listening port is {{port}}": "当前监听端口为 {{port}}",
  "The configurable port range is {{min}}-{{max}}": "可配置的端口范围是 {{min}}-{{max}}",
  "DurationUnit.Day": "天",
  "DurationUnit.Hour": "小时",
  "DurationUnit.Minute": "分钟",
  "DurationUnit.Second": "秒",
  "SearchOperation.In.description": "属性值在指定的值列表中",
  "SearchOperation.NotIn.description": "属性值不在指定的值列表中",
  Experimental,
  "Post parser": "帖子解析器",
  "3rd Party integration": "第三方集成",
  "Add tasks": "添加任务",
  "Automatically parsing": "自动解析",
  "Instructions for use": "使用说明",
  "Support for other sites": "支持其他网站",
  Items,
  ParsedAt,
  "This feature internally uses curl. If your system-level curl version is lower than 8.14, please configure the correct curl path in the system settings.": "此功能在内部使用 curl。如果您的系统级 curl 版本低于 8.14，请在系统设置中配置正确的 curl 路径。",
  "The request interval configuration is temporarily unavailable. The built-in default interval is 3 seconds.": "请求间隔配置暂时不可用，内置默认间隔为 3 秒。",
  "This feature internally uses Ollama. You need to install and run Ollama first, and install at least one model. Then configure the Ollama API address in the system settings.": "此功能在内部使用 Ollama。您需要先安装并运行 Ollama，并至少安装一个模型，然后在系统设置中配置 Ollama API 地址。",
  "This feature will prioritize the largest model in the Ollama model list.": "此功能将优先使用 Ollama 模型列表中的最大模型。",
  "Currently, deepseek-r1:14b and 32b have been tested and can be used safely.": "目前，deepseek-r1:14b 和 32b 已经过测试，可以安全使用。",
  "Some sites can integrate quick actions through the browser (such as one-click task creation). You can check the 'Third-Party Integrations' section.": '某些网站可以通过浏览器集成快速操作（例如一键创建任务）。您可以查看"第三方集成"部分。',
  "browser integrations": "浏览器集成",
  "This script modifies some interactive behaviors of the target website. You can manually enable or disable the script in Tampermonkey.": "此脚本修改了目标网站的一些交互行为。您可以在 Tampermonkey 中手动启用或禁用该脚本。",
  "Left-clicking on covers or post titles will trigger the creation of a post parsing task on Bakabase. You can still use the middle button to open posts.": "左键点击封面或帖子标题将在 Bakabase 上触发帖子解析任务。您仍然可以使用中键打开帖子。",
  "Left-clicking on covers will trigger the creation of a torrent download task on Bakabase. You can still use the middle button to open posts.": "左键点击封面将在 Bakabase 上触发种子下载任务。您仍然可以使用中键打开帖子。",
  "Tampermonkey script": "Tampermonkey 脚本",
  "One-click installation": "一键安装",
  "Media library template": "媒体库模板",
  "Extension group": "扩展名组",
  "Media library(Deprec)": "媒体库（已弃用）",
  "Current media library feature will be removed soon": "当前媒体库功能即将移除",
  "Please note that the categorization feature will be removed soon. Please switch to the new media library function as soon as possible.": "请注意，分类功能即将移除。请尽快切换到新的媒体库功能。",
  "You can use this button in your path configuration to export the current media library configuration as a new media library template and bind it to the new media library.": "您可以在路径配置中使用此按钮，将当前媒体库配置导出为新的媒体库模板，并绑定到新的媒体库。",
  "Exporting path configuration as new media library template": "导出路径配置为新的媒体库模板",
  "The old categorization and media library features will soon be removed. Please export the data as a new media library template.": "旧的分类和媒体库功能即将移除。请将数据导出为新的媒体库模板。",
  "The resource selection rules, attribute value settings, enhancer configurations, playable file locator, and resource naming conventions of the current path will all be exported to the media library template.": "当前路径的资源选择规则、属性值设置、增强器配置、可播放文件定位器和资源命名规则都将导出到媒体库模板。",
  "However, the player will not be included. Please configure the player manually in the new media library.": "但是播放器不会包含在内。请在新的媒体库中手动配置播放器。",
  "A media library template is a combination of the rules below and can be reused across multiple paths.": "媒体库模板是以下规则的组合，可以在多个路径之间重复使用。",
  "It is not necessary to create a separate template for each path.": "无需为每个路径单独创建模板。",
  "Template name": "模板名称",
  "Template name is required": "必须填写模板名称",
  "Media library template created successfully": "媒体库模板创建成功",
  "Editing extension group": "编辑扩展名组",
  "Separate by space or newline": "以空格或换行分隔",
  "Saved successfully": "保存成功",
  "Child template": "子模板",
  "Select a child template": "选择子模板",
  "Loop detected": "检测到循环",
  "Create a template": "创建模板",
  "Enter template name": "输入模板名称",
  "Import a template": "导入模板",
  "Edit template": "编辑模板",
  Author,
  "(optional)": "（可选）",
  "Enter author name": "输入作者姓名",
  "Enter description": "输入描述",
  "Share code has been copied": "分享码已复制",
  "Share code has been copied to your clipboard, you can send it to your friends. (ctrl+v)": "分享码已复制到剪贴板，您可以发送给您的朋友。（ctrl+v）",
  "I got it": "我知道了",
  "Duplicate current template": "复制当前模板",
  "Deleting template {{name}}": "删除模板 {{name}}",
  "This action cannot be undone. Are you sure you want to delete this template?": "此操作无法撤销。您确定要删除此模板吗？",
  "Delete resource filter": "删除资源过滤器",
  "Determine which files be considered as playable files": "确定哪些文件可作为可播放文件",
  "You can configure which properties your resource includes": "您可以配置您的资源包含哪些属性",
  "You can use enhancers to automatically populate resource information or files": "您可以使用增强器自动填充资源信息或文件",
  "Unknown enhancer": "未知增强器",
  "Auto match multilevel string": "自动匹配多级字符串",
  "Not configured": "未配置",
  "You can customize the display name of the resource": "您可以自定义资源的显示名称",
  Subresource,
  "You can create cascading resources through sub-templates, where the rules of the sub-template will use the path of the resource determined by the current template as the root directory.": "您可以通过子模板创建级联资源，子模板的规则将使用当前模板确定的资源路径作为根目录。",
  "Setup paths for preview": "设置预览路径",
  "To create a preview, you must enter at least one path that will be applied to the current template. For a better preview effect, you can add as many representative subpaths as possible starting from the second line.": "要创建预览，必须输入至少一个适用于当前模板的路径。为了获得更好的预览效果，您可以从第二行开始添加尽可能多的代表性子路径。",
  "If you have set up an enhancer to retrieve data from third parties, an excessive number of subpaths may slow down the preview creation process.": "如果您已设置增强器以从第三方获取数据，过多的子路径可能会减慢预览创建过程。",
  "Paths separated by line": "路径按行分隔",
  "This template cannot be previewed because no sample path has been configured.": "此模板无法预览，因为未配置示例路径。",
  "Enhance properties": "要增强的属性",
  "Import media library template": "导入媒体库模板",
  "Failed to validate media library template": "验证媒体库模板失败",
  "Failed to import media library template": "导入媒体库模板失败",
  "Share code": "分享码",
  "Paste share code here": "在此粘贴分享码",
  "Change share code": "更改分享码",
  "New properties": "新属性",
  "Automatically process": "自动处理",
  "No proper property found": "未找到合适的属性",
  "Should we create a new property for this?": "是否为此创建新属性？",
  "Select a property manually": "手动选择属性",
  "New extension groups": "新扩展名组",
  "No proper extension group found": "未找到合适的扩展名组",
  "Should we create a new extension group for this?": "是否为此创建新扩展名组？",
  "Select an extension group manually": "手动选择扩展名组",
  "Limit file extensions": "限制文件扩展名",
  "Edit display name template for resources": "编辑资源显示名称模板",
  "Directory of media library": "媒体库目录",
  Folder,
  "Layer 0 is directory of media library": "第 0 层是媒体库目录",
  "Regex to match sub path": "用于匹配子路径的正则表达式",
  Positioning: Positioning$1,
  "Limit path type": "限制路径类型",
  "No limited": "无限制",
  "Extract property values from resource path": "从资源路径提取属性值",
  "Add a rule": "添加规则",
  "For layer-based rules, level 0 represents the current directory; for regex rules, the text to be matched starts from the next level under the current directory up to the resource path portion.": "对于基于层的规则，层级 0 代表当前目录；对于正则表达式规则，要匹配的文本从当前目录下一级开始，到资源路径部分。",
  "All rules will be run independently, and the results will be merged": "所有规则将独立运行，结果将合并",
  "Edit property values quickly": "快速编辑属性值",
  "You can hover over the property name in the resource details to set the property as quickly editable": "您可以在资源详情中悬停在属性名称上，将其设置为可快速编辑",
  "MediaLibrary.Players": "播放器",
  "Select properties": "选择属性",
  "Bind referenced properties to current template?": "将引用的属性绑定到当前模板？",
  "Maximum concurrent download threads": "最大并发下载线程数",
  Cookie: Cookie$1,
  "Max Concurrency": "最大并发数",
  "Request Interval (ms)": "请求间隔（毫秒）",
  "Default Path": "默认路径",
  "Naming Convention": "命名规则",
  "Max Retries": "最大重试次数",
  "Request Timeout (ms)": "请求超时（毫秒）",
  "Auto Buy Threshold": "自动购买阈值",
  "User Agent": "User Agent",
  Referer: Referer$1,
  "API Key": "API Key",
  more: more$1,
  Bilibili: Bilibili$2,
  ExHentai: ExHentai$2,
  Pixiv: Pixiv$2,
  Bangumi: Bangumi$2,
  SoulPlus: SoulPlus$2,
  DLsite: DLsite$2,
  Fanbox: Fanbox$1,
  Fantia: Fantia$1,
  Cien: Cien$1,
  Patreon: Patreon$1,
  Tmdb: Tmdb$1,
  "No resources to be transferred": "没有可转移的资源",
  "Unknown resource": "未知资源",
  "Create tag group": "创建标签组",
  "Font size": "字体大小",
  "Font color": "字体颜色",
  "Background color": "背景颜色",
  "Will start at": "将从…开始",
  "Name cannot be empty": "名称不能为空",
  "Please check diffs before applying, and changed value may not be reverted perfectly in some situations, are you sure to apply?": "请在应用前检查差异，在某些情况下更改的值可能无法完美恢复，您确定要应用吗？",
  "Please ensure that the calculation operation has been executed.": "请确保计算操作已执行。",
  "If the calculation operation has been executed, there may be no resources that will be changed.": "如果计算操作已执行，可能没有需要更改的资源。",
  "Please check the search criteria.": "请检查搜索条件。",
  Diffs: Diffs$1,
  "Sequence number": "序列号",
  Mode,
  end,
  start,
  "Unsupported value": "不支持的值",
  "Filter branches by": "按分支筛选",
  Count: Count$1,
  "No set": "未设置",
  "Unable to get property information": "无法获取属性信息",
  "No variables available": "没有可用变量",
  "Delete variable": "删除变量",
  "Are you sure to delete variable {{name}}?": "您确定要删除变量 {{name}} 吗？",
  "Property Key": "属性键",
  "Press enter to add a item to list": "按 Enter 键添加项到列表",
  "Filtered resources": "筛选后的资源",
  "Unsupported processor type": "不支持的处理器类型",
  "No cache for now": "当前无缓存",
  "Are you sure to change playable file selector?": "您确定要更改可播放文件选择器吗？",
  "Resources will not loaded automatically after modifying media libraries, ": "修改媒体库后，资源不会自动加载。",
  "The resource selection rules, attribute value settings, enhancer configurations, playable file locator, ": "资源选择规则、属性值设置、增强器配置、可播放文件定位器，",
  "Your resource is located by system automatically, you can click any path segment to change it if it": "您的资源由系统自动定位，您可以点击任何路径段进行更改。",
  "You can share tags and rate of same physical filesystem item from different app instances by enabling this option, ": "启用此选项后，您可以在不同应用实例中共享标签和评分，但仍指向同一个物理文件系统项。",
  "Updater is required to auto-update app": "需要更新程序以自动更新应用",
  "Failed to get latest version": "获取最新版本失败",
  "Failed to update app": "更新应用失败",
  "Ollama endpoint": "Ollama 端点",
  Development: Development$1,
  "Port number": "端口号",
  "Add your resources": "添加您的资源",
  "If you are browsing {{thirdPartyName}}, you should decrease the threads of downloading.": "如果您正在浏览 {{thirdPartyName}}，建议减少下载线程。",
  "Gallery url(s)": "图库 URL",
  "Watched page url": "已观看页面 URL",
  "List page url": "列表页面 URL",
  Duration: Duration$1,
  Url,
  Fail,
  Password,
  "Save all media libraries": "保存所有媒体库",
  "Deleted media libraries will not be restored. Are you sure you want to save?": "已删除的媒体库将无法恢复。您确定要保存吗？",
  "Exit editing mode": "退出编辑模式",
  "Add or edit": "添加或编辑",
  "Synchronize all media libraries": "同步所有媒体库",
  "Path of media library": "媒体库路径",
  Template: Template$1,
  "Template for media library": "媒体库模板",
  ollama,
  'Some sites can integrate quick actions through the browser (such as one-click task creation). You can check the "Third-Party Integrations" section.': '某些网站可以通过浏览器集成快速操作（例如一键创建任务）。您可以查看"第三方集成"部分。',
  "Access code": "访问码",
  "Decompression password": "解压密码",
  "Cookie is used to access SoulPlus posts.": "Cookie 用于访问 SoulPlus 帖子。",
  "Auto buy threshold": "自动购买阈值",
  "Items priced below this value will be bought automatically.": "低于此价格的商品将自动购买。",
  "Display resource ID": "显示资源 ID",
  "Category is deprecated and will be removed in a future version.": "类别已弃用，并将在未来版本中移除。",
  "Source text": "源文本",
  "Left wrapper": "左包裹符",
  "Right wrapper": "右包裹符",
  "Auto select overwritten resources": "自动选择被覆盖的资源",
  "Last modified at": "最后修改时间",
  "Enhance Time": "增强时间",
  "Name of favorites can not be empty": "收藏名称不能为空",
  "Path is required": "必须填写路径",
  Content: Content$1,
  View,
  Expressions,
  "No templates found. You can create a template or import one from a share code.": "未找到模板。您可以创建一个模板或从分享码导入。",
  Or,
  "Import builtin templates": "导入内置模板",
  "2. Please ensure that media libraries are created, bound to a template, and fully synchronized.": "2. 请确保媒体库已创建、绑定到模板并完全同步。",
  "Go to media library page": "前往媒体库页面",
  "MediaType.Video": "视频",
  "MediaType.Audio": "音频",
  "MediaType.Text": "文本",
  "MediaType.Image": "图片",
  "MediaType.Application": "应用",
  "The {{layer}}th layer of path -> {{propertyName}}": "路径第 {{layer}} 层 -> {{propertyName}}",
  "Builtin media library templates": "内置媒体库模板",
  "Select a builtin template": "选择一个内置模板",
  "Use base template": "使用基础模板",
  "Select a base template": "选择一个基础模板",
  "Add a media library template": "添加媒体库模板",
  "No media libraries found. You must add at least one media library and synchronize it to manage your resources.": "未找到媒体库。您必须添加至少一个媒体库并同步它，以管理您的资源。",
  Optional,
  "The current template contains data missing from the application. Please configure how to handle this data before proceeding with the import.": "当前模板包含应用程序中缺失的数据。请在继续导入之前配置如何处理这些数据。",
  "Limit file extension groups": "限制文件扩展名组",
  "Select from extension groups": "从扩展名组中选择",
  enhance,
  "Resource type": "资源类型",
  "Media type": "媒体类型",
  "No built-in media library templates found": "未找到内置媒体库模板",
  "No enhancer configured": "未配置增强器",
  "Search templates": "搜索模板",
  "Collapse all": "全部折叠",
  "Expand all": "全部展开",
  "No properties enhanced": "没有属性被增强",
  "The {{layer}}th layer": "第 {{layer}} 层",
  "Set a name for this template": "为此模板设置一个名称",
  "Preset media library template builder": "预设媒体库模板构建器",
  "Resource layer": "资源层级",
  "Set the directory name between the media library and the resource as a property of the resource": "将媒体库和资源之间的目录名称设置为资源的属性",
  "You can configure how many levels deep the resource path should be under the media library path, and you can assign the intermediate directories as property values of the resource": "您可以设置资源路径在媒体库路径后第几层，并且可以将中间的目录设置为资源的属性值",
  "media-library-template.use-preset-template-builder": "如果您是首次创建媒体库模板，推荐您使用<1>预置媒体库模板构建器</1>",
  "Preset template builder": "预置媒体库模板构建器",
  "Select all {{count}} filtered resources (including those not currently loaded).": "选择{{count}}个筛选后的资源（包括尚未加载的资源）",
  "Loaded resources": "已加载资源",
  "All filtered resources": "所有筛选后的资源",
  "No custom property bound. You can bind them in media library template": "没有绑定自定义属性。您可以在媒体库模板中绑定它们",
  "Configure enhancer:{{enhancerName}}": "配置增强器：{{enhancerName}}",
  Configured,
  "Bind property": "绑定属性",
  "You can": "您可以",
  "Automatically match property": "自动匹配属性",
  "Automatically create a new property": "自动创建新属性",
  "Select manually": "手动选择",
  "Resource ID": "资源ID",
  "To reduce synchronization time, we will, by default, use 40% of your CPU's maximum thread count (rounded down) for syncing the media library": "为了降低同步耗时，默认情况下，我们将会使用您的CPU最大线程数的40%（向下取整）用于同步媒体库",
  "Max threads": "最大线程数",
  "Editing media library template": "编辑媒体库模板",
  "Create new template": "创建新模板",
  "About to leave current page": "即将离开当前页面",
  "Media library caches": "媒体库缓存",
  "FileNameModifier.Original": "原路径",
  "FileNameModifier.Modified": "新路径",
  "FileNameModifier.PathDisplay": "路径显示",
  "FileNameModifier.HideFullPaths": "隐藏完整路径",
  "FileNameModifier.ShowFullPaths": "显示完整路径",
  "FileNameModifier.FullPath": "完整路径",
  "FileNameModifier.FileName": "文件名",
  "FileNameModifier.CommonPrefix": "公共前缀",
  "FileNameModifier.OriginalPath": "原始路径",
  "FileNameModifier.ModifiedPath": "修改后路径",
  "FileNameModifier.ExecuteModification": "执行修改",
  "FileNameModifier.PreviewResults": "预览结果",
  "FileNameModifier.EditFileList": "编辑文件列表",
  "FileNameModifier.LoadingPreview": "正在加载预览...",
  "FileNameModifier.NoPreviewResults": "无预览结果",
  Steps,
  "By enabling this options data will be changed according to the changes in dynamic properties (single choice, multiple choice, multilevel data, etc.).": "该选项启用后，数据会根据动态属性（单选、多选、多级数据等）的变化而变化。",
  "For example, if you use the 'actor' from the multiple-choice data as the change result, then in the future, if you modify 'actor' to 'actor1', the current data will also be changed to 'actor1' after next time processing. However, if this options is not enabled, the current data will be changed to 'actor' after next time processing.": '例如，如果您使用多选数据中的"演员"作为变更结果，那么在未来，如果您将"演员"修改为"演员1"，当前数据也会在下一次处理后变更为"演员1"。但是，如果您未启用该选项，那么数据会在下次处理后变更为"演员"。',
  "For properties(such as text, numbers, dates, etc.) without reference values, there is no difference between statuses of this options.": "对于没有引用值类型的属性（如文本、数字、日期等）来说，该选项不起作用。",
  "Click to disable": "点击禁用",
  "Edit name of bulk modification": "编辑批量修改方案的名称",
  "Delete bulk modification": "删除批量修改方案",
  "For each filtered item": "对每个筛选出的项目",
  "Filter by": "筛选方式",
  "Please input keyword": "请输入关键字",
  "Please input a regular expression": "请输入一个正则表达式",
  Cache,
  "Category caches": "分类缓存",
  "Resource count": "资源数量",
  Cached: Cached$1,
  Covers: Covers$1,
  PlayableFiles: PlayableFiles$2,
  ResourceMarkers: ResourceMarkers$1,
  "Enable resource markers": "启用资源标记",
  "If you enable this feature, a hidden .bakabase.json file will be generated inside folder resources to store their resource IDs.": "如果您启用了该功能，我们将在文件夹资源内生成一个隐藏的 .bakabase.json 文件来存储其资源ID。",
  "During synchronization, if a folder path changes but contains a .bakabase.json with any matching resource IDs, the resource data will be preserved instead of creating a new resource.": "在同步时，如果文件夹路径改变但包含一个匹配资源ID的 .bakabase.json 文件，资源数据将被保留而不是创建新资源。",
  "Since a path can be added to multiple media libraries, resources under each path will be tracked per media library.": "因为我们允许一个路径被添加至多个媒体库，所以会保存当前路径下的资源在每个媒体库内的资源ID。",
  "Only supports resources in new version (V2) media libraries. Legacy resources (category-based media libraries) are not supported.": "仅支持新版本的媒体库内的资源，老的资源（分类-媒体库）不支持。",
  "Enabling this feature will increase synchronization time as marker files need to be generated and verified.": "启用此功能将增加同步时间，因为需要生成和验证标记文件。",
  "This feature will work after a complete GenerateResourceMarker task finishes.": "此功能将在 生成资源标记 任务完成后生效。",
  "Confirm disabling resource markers": "确认禁用资源标记",
  "Confirm and stop task": "确认并停止任务",
  "The GenerateResourceMarker task is currently running.": "生成资源标记 任务正在运行中。",
  "Disabling this feature will stop the task. Are you sure you want to continue?": "禁用此功能将停止该任务。您确定要继续吗？",
  "Delete marker files?": "删除标记文件？",
  "Delete markers": "删除标记",
  "Keep markers": "保留标记",
  "Do you want to delete all .bakabase.json marker files?": "您想删除所有 .bakabase.json 标记文件吗？",
  "If you keep them, existing markers will remain in the folders.": "如果保留它们，现有标记将保留在文件夹中。",
  "Processing...": "处理中...",
  "Deleting resource markers, please wait...": "正在删除资源标记，请稍候...",
  "Deleting resource markers": "正在删除资源标记",
  "Processing {{processed}} of {{total}} resources": "正在处理 {{processed}} / {{total}} 个路径",
  "Deleted: {{deleted}}, Failed: {{failed}}": "已删除：{{deleted}}，失败：{{failed}}",
  "Failed to delete markers": "删除标记失败",
  "Manage cache": "管理缓存",
  "Use {{any}}": "使用 {{any}}",
  editor,
  "Choose a property value editor": "选择一个属性值编辑器",
  "Choose a property": "选择一个属性",
  "Follow property changes": "跟随属性变化",
  "No choices available, please check your configurations": "没有可用选项，请检查您的配置",
  "We will automatically convert the value from {{fromType}} to {{toType}}.": "我们将自动将数据从 {{fromType}} 转换为 {{toType}} 。",
  "You can check type conversion rules here": "您可以在这里查看类型转换规则",
  "Type transformation": "类型转换",
  "A property may have multiple dimensional values, and you can choose one of the dimensions as the base data.": "一个属性可能会有多个维度的属性值，您可以选择其中一个维度作为基础数据。",
  "Set rating": "设置评分",
  ERROR: ERROR$1,
  "Value is required": "值是必填的",
  "Count and index are required": "数量和索引是必填的",
  "Value and index are required": "值和索引是必填的",
  "Find is required": "查找是必填的",
  "Please select a variable": "请选择一个变量",
  "Delete current process": "删除当前处理流程",
  "Are you sure you want to delete this process and all its process steps?": "确定要删除此处理流程及其所有处理步骤吗？",
  "Are you sure you want to delete this process step?": "确定要删除此处理步骤吗？",
  "Delete a process step": "删除处理步骤",
  "PropertyPool.Internal": "内置",
  "FileNameModifier.OperationType": "操作类型",
  "FileNameModifier.OperationType.Insert": "插入",
  "FileNameModifier.OperationType.AddDateTime": "添加日期时间",
  "FileNameModifier.OperationType.Delete": "删除",
  "FileNameModifier.OperationType.Replace": "替换",
  "FileNameModifier.OperationType.ChangeCase": "更改大小写",
  "FileNameModifier.OperationType.AddAlphabetSequence": "添加字母序列",
  "FileNameModifier.OperationType.Reverse": "反转",
  "FileNameModifier.OperationTypePlaceholder": "请选择操作类型",
  "FileNameModifier.Placeholder.Text": "文本",
  "FileNameModifier.Placeholder.TargetText": "目标文本",
  "FileNameModifier.Placeholder.DateTimeFormat": "日期时间格式",
  "FileNameModifier.Placeholder.DeleteCount": "删除数量",
  "FileNameModifier.Placeholder.DeleteStartPosition": "起始位置",
  "FileNameModifier.Placeholder.MatchText": "匹配文本",
  "FileNameModifier.Placeholder.StartChar": "起始字母",
  "FileNameModifier.Placeholder.Count": "数量",
  "FileNameModifier.Placeholder.CaseType": "大小写类型",
  "FileNameModifier.Placeholder.PositionType": "位置类型",
  "FileNameModifier.Title": "批量文件名修改",
  "FileNameModifier.FilePathsPlaceholder": "每行一个完整文件路径",
  "FileNameModifier.OperationsList": "操作列表：",
  "FileNameModifier.AddOperation": "添加操作",
  "FileNameModifier.Delete": "删除",
  "FileNameModifier.Preview": "预览",
  "FileNameModifier.OriginalFileName": "原始文件名",
  "FileNameModifier.NewFileName": "新文件名",
  "FileNameModifier.PreviewFailed": "预览失败",
  "FileNameModifier.ModificationSuccess": "修改成功",
  "FileNameModifier.ModificationFailed": "修改失败",
  "FileNameModifier.Validation.InsertRequiresText": "插入操作需要文本",
  "FileNameModifier.Validation.AddDateTimeRequiresFormat": "添加日期时间操作需要日期时间格式",
  "FileNameModifier.Validation.DeleteRequiresCount": "删除操作需要删除数量 > 0",
  "FileNameModifier.Validation.DeleteRequiresPosition": "删除操作需要起始位置 >= 0",
  "FileNameModifier.Validation.ReplaceRequiresText": "替换操作需要文本或目标文本",
  "FileNameModifier.Validation.AddAlphabetRequiresCount": "添加字母序列操作需要字母数量 > 0",
  "FileNameModifier.Operation.Insert": "插入",
  "FileNameModifier.Operation.AddDateTime": "添加日期时间",
  "FileNameModifier.Operation.Delete": "删除",
  "FileNameModifier.Operation.Replace": "替换",
  "FileNameModifier.Operation.ChangeCase": "更改大小写",
  "FileNameModifier.Operation.AddAlphabetSequence": "添加字母序列",
  "FileNameModifier.Operation.Reverse": "反转",
  "FileNameModifier.CaseType.TitleCase": "标题大小写",
  "FileNameModifier.CaseType.UpperCase": "大写",
  "FileNameModifier.CaseType.LowerCase": "小写",
  "FileNameModifier.CaseType.CamelCase": "驼峰大小写",
  "FileNameModifier.CaseType.PascalCase": "帕斯卡大小写",
  "FileNameModifier.ConfirmPaths": "确认路径",
  "FileNameModifier.EditPaths": "编辑路径",
  "FileNameModifier.ShowPreview": "显示预览",
  "FileNameModifier.ClickPreviewToSeeResults": "点击预览查看结果",
  "FileNameModifier.PleaseConfirmFilePathsFirst": "请先确认文件路径",
  "FileNameModifier.ReplaceEntire": "替换整个文件名",
  "FileNameModifier.Validation.NoFilePaths": "未提供文件路径",
  "FileNameModifier.Validation.InsertRequiresValidIndex": "插入操作需要有效的位置索引",
  "FileNameModifier.Validation.DeleteRequiresValidPosition": "删除操作需要有效的位置",
  "FileNameModifier.PositionType.Start": "开始",
  "FileNameModifier.PositionType.End": "结束",
  "FileNameModifier.PositionType.BeforeMatch": "匹配前",
  "FileNameModifier.PositionType.AfterMatch": "匹配后",
  "FileNameModifier.PositionType.AtIndex": "指定位置",
  "FileNameModifier.DeleteType.Entire": "全部",
  "FileNameModifier.DeleteType.FromStart": "从开始",
  "FileNameModifier.DeleteType.FromEnd": "从结束",
  "FileNameModifier.DeleteType.BeforeMatch": "匹配前",
  "FileNameModifier.DeleteType.AfterMatch": "匹配后",
  "FileNameModifier.DeleteType.AtPosition": "指定位置",
  "FileNameModifier.Label.PositionType": "位置类型",
  "FileNameModifier.Label.PositionIndex": "位置索引",
  "FileNameModifier.Label.Text": "文本",
  "FileNameModifier.Label.TargetText": "目标文本",
  "FileNameModifier.Label.DateTimeFormat": "日期时间格式",
  "FileNameModifier.Label.DeleteCount": "删除数量",
  "FileNameModifier.Label.DeleteStartPosition": "删除起始位置",
  "FileNameModifier.Label.MatchText": "匹配文本",
  "FileNameModifier.Label.CaseType": "大小写类型",
  "FileNameModifier.Label.StartChar": "起始字符",
  "FileNameModifier.Label.Count": "数量",
  "FileNameModifier.Deduplicate": "去重",
  "FileNameModifier.Clear": "清空",
  "FileNameModifier.Paste": "粘贴",
  "FileNameModifier.PathEmpty": "路径不能为空",
  "FileNameModifier.PathInvalidChar": "包含无效字符",
  "FileNameModifier.ClipboardReadError": "读取剪贴板失败",
  "FileNameModifier.OperationCardAria": "操作项 {{index}}",
  "FileNameModifier.FilePathsTextarea": "文件路径文本框",
  "FileNameModifier.Cancel": "取消",
  "FileNameModifier.Error.TargetRequired": "目标区域不能为空",
  "FileNameModifier.TargetType": "目标区域",
  "FileNameModifier.TargetTypePlaceholder": "请选择目标区域",
  "FileNameModifier.Target.FileName": "完整文件名（含扩展名）",
  "FileNameModifier.Target.FileNameWithoutExtension": "文件名（不含扩展名）",
  "FileNameModifier.Target.Extension": "扩展名（含点）",
  "FileNameModifier.Target.ExtensionWithoutDot": "扩展名（不含点）",
  "FileNameModifier.Error.OperationTypeRequired": "操作类型不能为空",
  "FileNameModifier.Error.InsertTextRequired": "插入操作需填写插入文本或目标文本",
  "FileNameModifier.Error.DateTimeFormatRequired": "日期时间格式不能为空",
  "FileNameModifier.Error.DeleteParamsRequired": "删除操作参数不完整",
  "FileNameModifier.Error.ReplaceTextRequired": "替换操作需填写替换文本或目标文本",
  "FileNameModifier.Error.CaseTypeRequired": "大小写类型不能为空",
  "FileNameModifier.Error.AlphabetParamsRequired": "字母序列参数不完整",
  "FileNameModifier.Error.UnknownOperationType": "未知操作类型",
  "MediaLibrary.AddOrEdit": "添加或编辑",
  "MediaLibrary.SynchronizeAll": "同步所有媒体库",
  "MediaLibrary.SortBy": "按{{sortBy}}排序",
  "MediaLibrary.SortBy.Path": "路径",
  "MediaLibrary.SortBy.Template": "模板",
  "MediaLibrary.Name": "名称",
  "MediaLibrary.NamePlaceholder": "媒体库名称",
  "MediaLibrary.Path": "路径",
  "MediaLibrary.PathPlaceholder": "媒体库路径",
  "MediaLibrary.Template": "模板",
  "MediaLibrary.TemplatePlaceholder": "媒体库模板",
  "MediaLibrary.CreateNewTemplate": "创建新模板",
  "MediaLibrary.Add": "添加",
  "MediaLibrary.Save": "保存",
  "MediaLibrary.SaveAll": "保存所有媒体库",
  "MediaLibrary.SaveAllConfirm": "删除的媒体库将无法恢复。确定要保存吗？",
  "MediaLibrary.Saved": "已保存",
  "MediaLibrary.ExitEditingMode": "退出编辑模式",
  "MediaLibrary.SearchResources": "在当前媒体库中搜索资源",
  "MediaLibrary.Confirm": "确认",
  "MediaLibrary.LeavePageConfirm": "确定要离开当前页面吗？",
  "MediaLibrary.Continue": "继续",
  "MediaLibrary.Cancel": "取消",
  "MediaLibrary.Unknown": "未知",
  "MediaLibrary.NoMediaLibrariesFound": "未找到媒体库。您必须添加至少一个媒体库并同步它以管理您的资源。",
  "MediaLibrary.DeleteEnhancements": "删除增强数据",
  "MediaLibraryTemplate.RemoveEnhancer": "移除增强器",
  "Enhancement.DeleteAllByEnhancerForTemplate": "删除该增强器在模板 {{templateName}} 下的所有增强数据",
  "Enhancement.DeleteAllByEnhancerForTemplate.ScopeWarning": "这将删除所有使用该模板的媒体库中资源的所有增强数据。",
  "Enhancement.EnhancedResourceCount": "{{count}} 个资源已增强",
  "FileNameModifier.ModificationResult": "批量重命名结果",
  "FileNameModifier.ModificationSuccessCount": "成功：{{count}} 个",
  "FileNameModifier.ModificationFailCount": "失败：{{count}} 个",
  "FileNameModifier.ModificationFailList": "失败文件列表",
  "FileNameModifier.ModificationFailReason": "失败原因",
  "FileNameModifier.Close": "关闭",
  "Maximum file count": "最大文件数量",
  "Leave empty for no limit": "留空表示无限制",
  "Max: {{count}}": "最大: {{count}}",
  "Configure enhancer": "配置增强器",
  "Batch rename {{count}} items": "批量重命名{{count}}项",
  "BetaFeature.BackupWarning": "如果您正在处理重要数据，建议先备份后再尝试。",
  "File name modifier": "文件名修改器",
  "Layer 0 is {{basePathType}}, negative means before {{basePathType}}, positive means after {{basePathType}}": "第0层为{{basePathType}}，负数表示在{{basePathType}}之前，正数表示在{{basePathType}}之后",
  "The {{n}}th layer before {{basePathType}}": "{{basePathType}}前的第{{n}}层",
  "The {{n}}th layer after {{basePathType}}": "{{basePathType}}后的第{{n}}层",
  "Based on": "基于",
  "Based on media library": "基于媒体库",
  "Based on resource": "基于资源",
  "Once synced, you can search for resources in the media library": "同步后可在媒体库中搜索资源",
  "Delay (minutes)": "延迟（分钟）",
  "Select from file system": "从文件系统中选择",
  PlayedAt,
  "Enable filter": "启用搜索条件",
  "Disable filter": "禁用搜索条件",
  "Delete filter": "删除搜索条件",
  "Enable group": "启用组",
  "Interval(s)": "间隔（秒）",
  "Cookie validator": "Cookie 验证器",
  "No items": "无项目",
  "curl executable": "curl 可执行文件",
  "Custom components will be removed soon": "自定义组件即将移除",
  "Please note that the custom components will be removed soon. Please use the new media library template.": "请注意，自定义组件即将移除。请使用新的媒体库模板。",
  "Create your first playlist to get started": "创建您的第一个播放列表以开始",
  "No playlists found": "未找到播放列表",
  "Error Details": "错误详情",
  Command: Command$1,
  "Configure media players for different file types": "为不同文件类型配置媒体播放器",
  Players: Players$2,
  "No players configured": "未配置播放器",
  "Configure Players": "配置播放器",
  "Add Player": "添加播放器",
  "No players configured. Click 'Add Player' to get started.": '未配置播放器。点击"添加播放器"开始配置。',
  "Player {{index}}": "播放器 {{index}}",
  "Player ${index + 1}": "播放器 ${index + 1}",
  "Executable Path": "可执行文件路径",
  "Path to the player executable": "播放器可执行文件路径",
  "Use {0} as placeholder for the file path": "使用 {0} 作为文件路径占位符",
  "Supported file extensions": "支持的文件扩展名",
  "Executable path is required": "可执行文件路径不能为空",
  "Please fill in all executable paths before saving.": "保存前请填写所有可执行文件路径。",
  "Setup custom players": "设置自定义播放器",
  "Invalid Data": "数据无效",
  "Listening port count": "监听端口数量",
  "Current listening port count is {{port}}": "当前监听端口数量为 {{port}}",
  Auto: Auto$1,
  "The configurable port range is {{min}}-{{max}}. And you can set it to 0 for auto count.": "可配置的端口范围为 {{min}}-{{max}}，设置为 0 表示自动数量。",
  "Changes will take effect after restarting the application": "更改将在重启应用后生效",
  "Please be careful when setting this value, if you set it to a value that is already in use by another application, our application will not be able to start.": "请谨慎设置该值，如果设置为已被其他程序占用的端口，我们的应用将无法启动。",
  "Listening ports": "固定监听端口",
  "You can set fixed listening ports.": "可以设置固定的监听端口。",
  "Enter ports separated by commas, e.g. 34567, 34568": "使用逗号分隔端口，例如：34567, 34568",
  "e.g. 34567, 34568": "例如：34567, 34568",
  "Too many ports. Up to {{max}} ports are supported.": "端口数量过多，最多支持 {{max}} 个端口。",
  "You can configure the number of listening ports. The more listening ports you set, the more it helps with parallel processing of interface‑related operations. It's recommended not to exceed the number of CPU cores. In most cases, you can just ignore this setting. If you leave it as empty and listening ports are not specified, we'll use a default value.": "你可以配置监听端口的数量。设置更多的监听端口有助于提升接口相关操作的并行处理能力。建议不要超过 CPU 核心数。在大多数情况下，你可以忽略此设置；如果留空且未指定监听端口，我们将使用默认值。",
  "Not configured for now": "暂不配置",
  "Synchronize now?": "现在同步？",
  "Media libraries have changed (added/removed/modified).": "媒体库已发生变化（新增/删除/修改）。",
  "Changed libraries to sync: {count}": "需要同步的变更媒体库数量：{{count}}",
  "Resource will be displayed only after synchronization is complete.": "资源将在同步完成后才会显示。",
  "Would you like to synchronize now, or do it later manually?": "是否立即同步？也可以稍后手动执行。",
  "Synchronization started": "已开始同步",
  "Sync Now": "立即同步",
  "Mark as synced": "标记为已同步",
  "Are you sure you want to mark these libraries as synced?": "确定将这些媒体库标记为已同步吗？",
  "Following media libraries may be outdated and should be synchronized:": "以下媒体库可能已过期，需要进行同步：",
  Later: Later$1,
  "Marked as synced": "已标记为已同步",
  "MediaLibrary.DeleteConfirm": "确定删除媒体库吗？",
  "Enhancement.DeleteByEnhancer.SelectEnhancerTitle": "选择一个增强器以删除增强数据",
  "Enhancement.DeleteByEnhancer.NoEnhancerInTemplate": "模板中未配置任何增强器",
  "Reset cover cache of current resource": "重置当前资源的封面缓存",
  "Cover cache has been reset": "封面缓存已被重置",
  "No tasks found": "未找到任务",
  "View in new tab": "在新标签页中查看",
  "Similarity threshold": "相似度阈值",
  "All items will be stored in one folder": "所有项将被存储在同一个文件夹中",
  "Items with exactly the same name (excluding file extensions) will be stored in the same folder": "文件名(不含后缀)完全相同的项将被存储在同一个文件夹中",
  "Quick preview using the default application": "使用默认打开方式快速预览",
  "No files under this path": "在该路径下没有找到文件",
  "Multiple file types are found": "找到了多种文件类型",
  "Please select one to open": "请选择一个打开",
  "Select Path": "选择路径",
  custom: custom$1,
  "media library": "媒体库",
  "Manually enter a path": "手动输入路径",
  "Show operations after playing first file": "播放第一个文件后显示操作",
  "After first play: operations": "首次播放后：可执行的操作",
  "Move to...": "移动到...",
  "Current Path": "当前路径",
  "Usually this will work fine if you are categorizing files.": "通常情况下，当您分类文件时，这会很好用。",
  AddedDate,
  UpdatedDate,
  FileCreatedDate,
  FileModifiedDate,
  "Display properties": "展示属性",
  "Display options": "展示选项",
  "Inline display name and tags": "内联展示名称和标签",
  "Inline the display name and tags will place them inside the bottom area of the resource cover, rather than below the cover.": "内联展示名称和标签会将它们放置在资源封面的底部区域，而不是在封面下方。",
  "Shortcut.LeftClick": "左键点击",
  "Shortcut.CtrlClick": "Ctrl+左键",
  "Shortcut.ShiftClick": "Shift+左键",
  "Shortcut.W": "W",
  "Shortcut.E": "E",
  "Shortcut.M": "M",
  "Shortcut.G": "G",
  "Shortcut.D": "D",
  "Shortcut.F2": "F2",
  "Shortcut.Delete": "Delete",
  "Shortcut.Space": "空格",
  "Capability.select": "选择",
  "Capability.multi-select": "多选",
  "Capability.range-select": "范围选择",
  "Capability.wrap": "打包",
  "Capability.extract": "提取",
  "Capability.move": "移动",
  "Capability.delete": "删除",
  "Capability.rename": "重命名",
  "Capability.decompress": "解压",
  "Capability.delete-all-same-name": "删除同名文件",
  "Capability.group": "分组",
  "Capability.play": "播放",
  "Capability.play-first-file": "播放第一个文件",
  "Media library template must be set": "必须设置媒体库模板",
  "Recent filters": "最近过滤器",
  "{{count}} resource(s) have set this property value.": "{{count}} 个资源已设置此属性值。",
  "Delete this media library": "删除此媒体库",
  "{{count}} resource(s) loaded in this media library.": "已加载 {{count}} 个资源到此媒体库。",
  "No resource loaded in this media library, you can click the synchronize button to load resources.": "没有资源加载到此媒体库，您可以点击同步按钮加载资源。",
  "Apply this filter to the current search": "应用到当前搜索条件",
  "Configure filter": "配置筛选条件",
  "Clear checkpoints": "清空检查点",
  "Run after enhancers": "在以下增强器之后运行",
  "You can perform chained enhancement by customizing the execution order of the enhancers.": "你可以通过自定义增强器的执行顺序来实现链式增强。",
  "Generally, you can just leave it as empty.": "一般情况下可以留空。",
  "Property value used during enhancement": "增强过程中使用的属性值",
  "Generally, this enhancer will use file/folder name of resource to perform enhancement and its not necessary to change this.": "通常情况下，该增强器会使用资源的文件/文件夹名称来进行增强，无需修改。",
  "In some cases, you can change the property value used during enhancement to perform enhancement on other property values.": "在某些情况下，你可以更改增强过程中所使用的属性值，从而对其他属性值执行增强。",
  "Select property": "选择属性",
  "Property value scope": "属性值来源范围",
  "Property value scope usually means who the property value is generated by.": "属性值来源范围通常表示该属性值是由谁生成的。",
  "For internal options, property value scope will be ignored.": "对于内置选项，属性值来源范围将被忽略。",
  "Manual property value scope has been selected": "已选择“手动”属性值来源范围",
  "I've understood": "我已了解",
  "Please select at least one property to enhance.": "请至少选择一个需要增强的属性。",
  "Special text": "特殊文本",
  "Pretreat property value": "预处理属性值",
  "If checked, the property value will be pretreated before enhancement.": "如果勾选，属性值将会在增强之前被预处理。",
  "You can configure the special texts to be pretreated in special text page under data menu.": "你可以在数据菜单下的特殊文本页面中配置需要预处理的特殊文本。",
  "Remove folder from media library?": "从媒体库中移除文件夹？",
  "This operation will not affect the files in the directory.": "此操作不会影响目录中的文件。",
  "Text pretreatment": "预处理文本",
  "Pretreatment test": "预处理测试",
  "Enter text": "输入文本",
  "Run pretreatment": "运行预处理",
  Pretreated: Pretreated$1,
  "No changes": "无变化",
  "Run after these enhancers have completed": "在以下增强器完成后运行",
  "Prerequisite enhancers": "前置增强器",
  "This enhancer won't have any effect since no target property is mapped. You need to configure at least one target property to let enhancer save data to.": "该增强器不会产生任何效果，因为未映射任何目标属性。你需要配置至少一个目标属性，让增强器保存数据到目标属性中。",
  "The property used to generate the keyword for enhancers that need it. Default is file/folder name.": "增强器会使用该关键词对资源进行增强。默认是文件/文件夹名称。",
  "Whether to pretreat the keyword before using it.": "是否在增强之前预处理关键词。",
  "Configure special texts for pretreatment": "配置预处理特殊文本",
  "Keyword property": "关键词属性",
  "Pretreat keyword": "预处理关键词",
  "No proper property name provided": "没有提供合适的属性名",
  "Please provide a property name": "请提供一个属性名",
  "Third party integration": "第三方集成",
  "Change log": "更新日志",
  "Alias is used to replace the original text of property values in UI, such as translations, etc.": "别名用于替换属性值在 UI 中的原始文本，例如翻译等。",
  "Are you sure you want to delete this file/folder?": "确定要删除这个文件/文件夹吗？",
  "We noticed that you played the first file in this path. Would you like to proceed with the following actions?": "我们注意到您播放了此路径中的第一个文件。您想继续执行以下操作吗？",
  "You can move it to another path.": "您可以将它移动到另一个路径。",
  "Or delete it?": "或者删除它？",
  "Delete this file/folder?": "删除这个文件/文件夹？",
  "Handle {{count}} unknown resources in this media library": "处理当前媒体库的{{count}}个未知资源",
  "Keep resources on path change": "当资源路径变化时保留资源",
  "By default, when a folder path changes, the resource data will be created as a new resource.": "默认情况下，当文件夹路径变化时，资源数据将会被创建为一个新的资源。",
  "Password candidates": "候选密码",
  "Compressed files handling": "处理压缩文件",
  "Detect compressed files": "检测压缩文件",
  "No compressed files detected": "未检测到压缩文件",
  "Use bulk decompression tool": "使用批量解压工具",
  "Bulk decompression all decompressed files in current folder": "批量解压当前文件夹中的所有压缩文件",
  "Include unknown extensions": "包含未知扩展名",
  "Unknown extensions min size (MB)": "未知扩展名最小大小（MB）",
  "Waiting for detection to complete...": "等待检测完成...",
  "Continue on failure": "失败后继续",
  "Decompress all successfully detected": "解压所有成功检测到的文件",
  Detection,
  "Decompression task completed": "解压任务完成",
  Warning,
  "You have set 'Move to parent directory' without 'Extract to new directory' for {{count}} item(s). This is a dangerous combination that may cause unexpected behavior:": "您已为 {{count}} 个项目设置了「移动到父目录」而未勾选「解压到新文件夹」。这是一个危险的组合，可能导致意外行为：",
  "All file system entries in the same directory will be moved to parent folder": "同一目录下的所有文件系统条目都将被移动到父文件夹",
  "Pending compressed files may be moved before decompression, causing failures": "待解压的压缩文件可能会在解压前被移动，导致解压失败",
  "The final file structure may be completely messed up": "最终的文件结构可能会完全混乱",
  "Tip:": "提示：",
  "However, for some cases we recommend users to make this choice. Please make sure you clearly understand what will happen.": "但是，对于某些情况我们建议用户做出这个选择。请确保您清楚了解将会发生什么。",
  "Are you sure you want to continue?": "您确定要继续吗？",
  "Continue anyway": "仍然继续",
  "Extract to new directory": "解压到新文件夹",
  "Delete the source file after decompression": "解压后删除源文件",
  "Move to parent directory": "移动到父目录",
  "Overwrite existing files": "覆盖已存在的文件",
  "Extract to new directory(we will use file name without extension as the new directory name)": "解压到新文件夹（我们将使用文件名（不含扩展名）作为新文件夹名称）",
  "Move all files and folders located in the extraction target directory to the parent directory of the compressed file. Note that any files or folders not contained in the compressed file, but present in the directory where the compressed file is being extracted, will also be moved to the parent directory.": "将所有位于解压目标文件夹内的文件或文件夹都移动至压缩文件的父级目录。请注意，不在解压文件内的文件或文件夹，只要它们位于该压缩文件即将被解压至的目录，那么也会被移动至父级目录。",
  "You can migrate data button at top of the page to migrate data to the new media library.": "您可以点击页面顶部的迁移数据按钮，将数据迁移到新的媒体库。",
  "Migrate data (one-click)": "一键迁移",
  "Migrating...": "迁移中...",
  "Some properties cannot be matched": "部分属性无法匹配",
  "Auto matched": "自动匹配",
  "Automatically create missing properties": "自动创建缺失的属性",
  "Keep matched properties, handle missing ones manually": "保留匹配的属性，手动处理缺失的属性",
  "Only media library v2 is supported": "仅支持媒体库 v2",
  "Cannot move resources to the same media library": "不能将资源移动到同一个媒体库",
  "Move resources completed. Delete the source media library?": "移动资源完成。删除源媒体库？",
  "Operation failed": "操作失败",
  "Keep it": "保留",
  "Move resources to another media library": "移动资源到另一个媒体库",
  "Manual property value scope means the property values are generated by yourself, and these values are typically not yet available at the time of enhancement.": "手动属性值来源范围意味着属性值是由您自己生成的，这些值通常在增强时还未可用。",
  "Path copied to clipboard": "路径已复制到剪贴板",
  "We are deleting": "即将删除",
  "If you stop this operation now, you will need to delete the remaining marker files manually.": "如果您现在停止此操作，将需要手动删除剩余的标记文件。",
  "Marker file information:": "标记文件信息：",
  "File name: {{filename}}": "文件名：{{filename}}",
  "Location: Inside folder resources": "位置：资源文件夹内部",
  "Attribute: Hidden file": "属性：隐藏文件",
  "You can search for and delete these files using your file manager or terminal.": "您可以使用文件管理器或终端搜索并删除这些文件。",
  "Auto-select first playable file has been enabled. You can change this in the resource page settings.": "自动选择第一个可播放文件已启用。您可以在资源页面设置中更改此设置。",
  "Auto-select first file if multiple playable files exist": "自动选择第一个文件（如果存在多个可播放文件）"
};
const Beta = "Beta";
const Deprecated = "Deprecated";
const Later = "Later";
const Bulk = "Bulk";
const Start = "Start";
const Stop = "Stop";
const Source = "Source";
const Keyword = "Keyword";
const Cleanup = "Cleanup";
const Configurations = "Configurations";
const Site = "Site";
const Developing = "Developing";
const Success = "Success";
const Failure = "Failure";
const Succeed = "Succeed";
const TimedOut = "Timed Out";
const Banned = "Banned";
const Canceled = "Canceled";
const Layer = "Layer";
const Regex = "Regex";
const Rule = "Rule";
const Positioning = "Positioning";
const Players$1 = "Players";
const Command = "Command";
const Bilibili$1 = "Bilibili";
const ExHentai$1 = "ExHentai";
const Pixiv$1 = "Pixiv";
const Bangumi$1 = "Bangumi";
const SoulPlus$1 = "SoulPlus";
const DLsite$1 = "DLsite";
const Fanbox = "Fanbox";
const Fantia = "Fantia";
const Cien = "Cien";
const Patreon = "Patreon";
const Tmdb = "Tmdb";
const Validate$1 = "Validate";
const Cookie = "Cookie";
const Referer = "Referer";
const Selected = "Selected";
const more = "more";
const Add = "Add";
const Saved = "Saved";
const Auto = "Auto";
const Count = "Count";
const custom = "Custom";
const Original = "Original";
const Pretreated = "Pretreated";
const Diffs = "Diffs";
const Cached = "Cached";
const Covers = "Covers";
const PlayableFiles$1 = "Playable Files";
const ResourceMarkers = "Resource Markers";
const enResources = {
  "dsnf-dialog-title": "Delete all contents with name <1> {{fileName}} </1> in <3> {{workingDirectory}} </3>",
  "fp.te.db.defaultPassword": "We'll use <1> {{password}} </1> as password for decompressing by default",
  "fp.mergeContents": "Merge <1> {{name}} </1> file system entries",
  "fp.mergeContentsIn": "Merge contents in <1> {{name}} </1>",
  "fp.bulkOperation": "{{operation}} <1> {{count}} </1> file system entries",
  "resource.search-engine.tip": "Use <1> {{name}} </1> to search <3> {{keyword}} </3>",
  "BulkModificationFilterGroupOperation.And": "and",
  "BulkModificationFilterGroupOperation.Or": "or",
  "BulkModificationFilterOperation.Equals": "Equals",
  "BulkModificationFilterOperation.NotEquals": "Not Equals",
  "BulkModificationFilterOperation.Contains": "Contains",
  "BulkModificationFilterOperation.NotContains": "Not Contains",
  "BulkModificationFilterOperation.StartsWith": "Starts With",
  "BulkModificationFilterOperation.NotStartsWith": "Not Starts With",
  "BulkModificationFilterOperation.EndsWith": "Ends With",
  "BulkModificationFilterOperation.NotEndsWith": "Not Ends With",
  "BulkModificationFilterOperation.GreaterThan": "Greater Than",
  "BulkModificationFilterOperation.LessThan": "Less Than",
  "BulkModificationFilterOperation.GreaterThanOrEquals": "Greater Than Or Equals",
  "BulkModificationFilterOperation.LessThanOrEquals": "Less Than Or Equals",
  "BulkModificationFilterOperation.IsNull": "Is Null",
  "BulkModificationFilterOperation.IsNotNull": "Is Not Null",
  "BulkModificationFilterOperation.In": "In",
  "BulkModificationFilterOperation.NotIn": "Not In",
  "BulkModificationFilterOperation.Matches": "Matches",
  "BulkModificationFilterOperation.NotMatches": "Not Matches",
  "BulkModification.Processor.Demonstrator.Operation.SetDirectly": "<0> Change </0> to",
  "BulkModification.Processor.Demonstrator.Operation.SetWithDynamicValue": "<0> Replace </0> with dynamic value",
  "BulkModification.Processor.Demonstrator.Operation.Replace": "Find<1>{{find}}</1>then replace with<3>{{replace}}</3>",
  "BulkModification.Processor.Demonstrator.Operation.RemoveFromStartOrEnd": "Delete <1>{{count}}</1> character(s) from <3>{{direction}}</3>",
  "BulkModification.Processor.Demonstrator.Operation.AddToStartOrEnd": "Add <1>{{value}}</1> to <3>{{direction}}</3>",
  "BulkModification.Processor.Editor.Operation.AddToAnyPosition": "Add <1/> to the  <3/> character from <5/> ",
  "BulkModification.Processor.Demonstrator.Operation.AddToAnyPosition": "Add <1>{{value}}</1> to the <3>{{position}}</3> position from <5>{{direction}}</5>",
  "BulkModification.Processor.Editor.Operation.RemoveFromAnyPosition": "Delete <1/> character(s) <3/> from the  <5/>  position from  <7/> ",
  "BulkModification.Processor.Demonstrator.Operation.RemoveFromAnyPosition": "Delete<1>{{count}}</1>character(s) <3>{{removeDirection}}</3> from the <5>{{position}}</5> position from <7>{{direction}}</7>",
  "BulkModification.Processor.Editor.Operation.Replace": "将 <1/> 替换为 <3/>",
  "BulkModification.Processor.Demonstrator.Operation.ReplaceFromStartOrEnd": "Replace<1>{{find}}</1>with<3>{{replace}}</3>from<5>{{direction}}</5>",
  "BulkModification.Processor.Demonstrator.Operation.ReplaceWithRegex": "Use<1>Regex</1>to replace<4>{{find}}</4>with<6>{{replace}}</6>",
  "BulkModification.Processor.Demonstrator.Operation.FilterThenModifyWithTextProcessor": "For data filtered by <0>{{filterBy}}</0><1>{{find}}</1>: <2>{{textProcessorDemonstrator}}</2>",
  "Position.Beginning": "the beginning",
  "Position.End": "the end",
  "BulkModification.Processor.Demonstrator.Operation.Filter.FilteredData": "Data filtered by <0/> <1>{{find}}</1>",
  "TextOperation.Backward": "backward",
  "TextOperation.Forward": "forward",
  "category.displayNameTemplate.propertyExample": "To add a property value as a variable in the template, you can use the following format: <1>{name of property}</1>. For example, <3>{{{samplePropertyName}}}</3> will be replaced with the value of the property named <5>{{samplePropertyName}}</5>",
  "ErrorHandlingModal.FindContactInConfigurationPage": "You can find the concat at the bottom of <1>Configuration page</1>",
  "Filter.Operation": "Rule",
  "Combinator.And": "and",
  "Combinator.Or": "or",
  "CategoryResourceDisplayNameSegmentType.StaticText": "static text",
  "CategoryResourceDisplayNameSegmentType.Property": "property",
  "CategoryResourceDisplayNameSegmentType.LeftWrapper": "left wrapper",
  "CategoryResourceDisplayNameSegmentType.RightWrapper": "right wrapper",
  "FeatureRequestTip.Developing": "The <1>{{name}}</1> feature is under development. You can urge the author or make suggestions on <3>Github</3> or <5>QQ group</5>",
  "FeatureRequestTip.Deprecated": "The <1>{{name}}</1> feature has been deprecated. If you need this feature, please propose it on <3>Github</3> or <5>QQ group</5>",
  "FeatureRequestTip.Deprecating": "The <1>{{name}}</1> feature will be deprecated. If you need this feature, please propose it on <3>Github</3> or <5>QQ group</5>",
  Beta,
  "This feature is in beta and may be unstable. Please report any issues you encounter.": "This feature is in beta and may be unstable. Please report any issues you encounter.",
  Deprecated,
  "This feature is deprecated and may be removed in future versions. Please consider using the recommended alternative.": "This feature is deprecated and may be removed in future versions. Please consider using the recommended alternative.",
  "Keyboard.Enter": "Enter",
  "Filter(Verb)": "Filter",
  "Move {{count}} resources to media library (Including file system entries)": "Move {{count}} resources to media library (Including file system entries)",
  "Move to media library (Including file system entries)": "Move to media library (Including file system entries)",
  "Move {{count}} resources to media library (Data only)": "Move {{count}} resources to media library (Data only)",
  "Move to media library (Data only)": "Move to media library (Data only)",
  "Handle {{count}} unknown resources": "Handle {{count}} unknown resources",
  "Use {{any}}": "Use {{any}}",
  "Delete all files with same name in working directory [{{workingDirectory}}]": "Delete all files with same name in working directory [{{workingDirectory}}]",
  "{{count}} items": "{{count}} items",
  "{{count}} selected": "{{count}} selected",
  "Open {{name}} in Explorer": "Open {{name}} in Explorer",
  "{{job}} will be started once an hour automatically, but you can trigger it manually by clicking there.": "{{job}} will be started once an hour automatically, but you can trigger it manually by clicking there.",
  "The {{layer}} layer": "The {{layer}} layer",
  "The {{layer}} layer to the last": "The {{layer}} layer to the last",
  "Found top {{count}} resources. (shows up to 100 results)": "Found top {{count}} resources. (shows up to 100 results)",
  "{{count}} possible conflicts segment configurations are found.": "{{count}} possible conflicts segment configurations are found.",
  "{{properties}} are required to select this.": "{{properties}} are required to select this.",
  "{{a}} can not be after than {{b}}": "{{a}} can not be after than {{b}}",
  "{{a}} can not be ahead of {{b}}": "{{a}} can not be ahead of {{b}}",
  "You selected {{count}} file types:": "You selected {{count}} file types:",
  "After your deselection, the current file will not be treat as a resource, and you need reset the Resource part from path segments, are you sure to remove file type: {{ext}}?": "After your deselection, the current file will not be treat as a resource, and you need reset the Resource part from path segments, are you sure to remove file type: {{ext}}?",
  "Multiple invalid capturing group names are found: {{names}}": "Multiple invalid capturing group names are found: {{names}}",
  "{{key}} is not set": "{{key}} is not set",
  "Deleting all '{{fileName}}' in working directory: {{workingDirectory}}": "Deleting all '{{fileName}}' in working directory: {{workingDirectory}}",
  "Found {{count}} entries": "Found {{count}} entries",
  "The {{layer}} layer after root path": "The {{layer}} layer after root path",
  "The {{layer}} layer to the resource": "The {{layer}} layer to the resource",
  "{{a}} must come before {{b}}": "{{a}} must come before {{b}}",
  "{{a}} must come after {{b}}": "{{a}} must come after {{b}}",
  "Set by {{thing}}": "Set by {{thing}}",
  "{{target}} should come after {{invalidMatchers}}": "{{target}} should come after {{invalidMatchers}}",
  "{{target}} should come before {{invalidMatchers}}": "{{target}} should come before {{invalidMatchers}}",
  "Fixed text: {{text}}": "Fixed text: {{text}}",
  "Regex: {{regex}}": "Regex: {{regex}}",
  "Layer: the {{layer}} layer to the last": "Layer: the {{layer}} layer to the last",
  "Layer: the {{layer}} layer": "Layer: the {{layer}} layer",
  "[{{matchers}}] (is)are required to set this property": "[{{matchers}}] (is)are required to set this property",
  "Matched {{count}} results": "Matched {{count}} results",
  "Wrapping {{count}} file entries": "Wrapping {{count}} file entries",
  "Details of {{name}}": "Details of {{name}}",
  "Bad page: {{page}}": "Bad page: {{page}}",
  "Applied to {{count}} categories": "Applied to {{count}} categories",
  "This week": "This week",
  "Last week": "Last week",
  "{{count}} weeks ago": "{{count}} weeks ago",
  "Calculated at {{calculatedAt}}": "Calculated at {{calculatedAt}}",
  "{{count}} resources have been filtered out": "{{count}} resources have been filtered out",
  "Filtered at {{datetime}}": "Filtered at {{datetime}}",
  "Calculated at {{datetime}}": "Calculated at {{datetime}}",
  "Reverted at {{datetime}}": "Reverted at {{datetime}}",
  "Applied at {{datetime}}": "Applied at {{datetime}}",
  "Binding custom properties to category {{categoryName}}": "Binding custom properties to category {{categoryName}}",
  "With {{depth}} layers": "With {{depth}} layers",
  "Are you sure to migrate [{{target}}] to [{{property}}]?": "Are you sure to migrate [{{target}}] to [{{property}}]?",
  "Found {{count}} data, and {{changedDataCount}} data will be modified or deleted": "Found {{count}} data, and {{changedDataCount}} data will be modified or deleted",
  "Found {{count}} data, and all of them will be retained": "Found {{count}} data, and all of them will be retained",
  "Edit display name template for category {{name}}": "Edit display name template for category {{name}}",
  "Configure enhancer:{{enhancerName}} for category:{{categoryName}}": "Configure enhancer:{{enhancerName}} for category:{{categoryName}}",
  "Bind property {{propertyName}} to category {{categoryName}}": "Bind property {{propertyName}} to category {{categoryName}}",
  "This enhancer enhanced this resource at {{enhancedAt}}.": "This enhancer enhanced this resource at {{enhancedAt}}.",
  "{{mode}} mode is available": "{{mode}} mode is available",
  "{{mode}} mode is unavailable": "{{mode}} mode is unavailable",
  "Configure [{{property}}] property for path segment": "Configure [{{property}}] property for path segment",
  "Deleting an alias: {{text}}": "Deleting an alias: {{text}}",
  "{{text}} will be the preferred text in merged groups, you can change the preferred text by clicking the text.": "{{text}} will be the preferred text in merged groups, you can change the preferred text by clicking the text.",
  "Deleting alias groups: {{texts}}": "Deleting alias groups: {{texts}}",
  "All selected alias groups will be merged into one, and the final preferred is {{preferred}}, are you sure?": "All selected alias groups will be merged into one, and the final preferred is {{preferred}}, are you sure?",
  "Merging alias groups: {{texts}}": "Merging alias groups: {{texts}}",
  "{{count}} categories": "{{count}} categories",
  "Deleting property locator for {{propertyName}}": "Deleting property locator for {{propertyName}}",
  "Value is being referenced in {{count}} places": "Value is being referenced in {{count}} places",
  "{{count}} values": "{{count}} values",
  "{{count}} data will be deleted": "{{count}} data will be deleted",
  "{{count}} data will be added": "{{count}} data will be added",
  "Delete all enhancement records of this enhancer for category {{categoryName}}": "Delete all enhancement records of this enhancer for category {{categoryName}}",
  "Unsupported property type: {{type}}": "Unsupported property type: {{type}}",
  "Unsupported reserved property type: {{type}}": "Unsupported reserved property type: {{type}}",
  "Move {{count}} resources to media library": "Move {{count}} resources to media library",
  "Other files in {{parent}}": "Other files in {{parent}}",
  "Decompress {{count}} files": "Decompress {{count}} files",
  "Extract {{count}} directories": "Extract {{count}} directories",
  "Wrap {{count}} items": "Wrap {{count}} items",
  "Delete {{count}} items": "Delete {{count}} items",
  "Move {{count}} items": "Move {{count}} items",
  "Group {{count}} items": "Group {{count}} items",
  "Copy {{count}} names": "Copy {{count}} names",
  "Copy {{count}} paths": "Copy {{count}} paths",
  "Removing all filesystem entries in {{workingDirectory}} that have the same names as the {{count}} selected filesystem entries": "Removing all filesystem entries in {{workingDirectory}} that have the same names as the {{count}} selected filesystem entries",
  "Re-apply all enhancement data of this enhancer for category {{categoryName}}": "Re-apply all enhancement data of this enhancer for category {{categoryName}}",
  "Stopping task: {{taskName}}": "Stopping task: {{taskName}}",
  "Show all {{count}} files": "Show all {{count}} files",
  "{{count}} resources related": "{{count}} resources related",
  "Check {{count}} diffs": "Check {{count}} diffs",
  "Delete {{count}} unknown resources permanently": "Delete {{count}} unknown resources permanently",
  "Delete {{count}} resources": "Delete {{count}} resources",
  "Transfer data of {{count}} resources": "Transfer data of {{count}} resources",
  "Are you sure you want to delete {{count}} resources?": "Are you sure you want to delete {{count}} resources?",
  "Delete all {{count}} source resources (data only)": "Delete all {{count}} source resources (data only)",
  "For all {{count}} items": "For all {{count}} items",
  "{{count}} items selected": "{{count}} items selected",
  "We will automatically convert the value from {{fromType}} to {{toType}}.": "We will automatically convert the value from {{fromType}} to {{toType}}.",
  "Deleting {{count}} download tasks": "Deleting {{count}} download tasks",
  "Auto group {{count}} selected items": "Auto group {{count}} selected items",
  "Auto group internal items in {{count}} selected directories": "Auto group internal items in {{count}} selected directories",
  "Wrap {{count}} items using directory": "Wrap {{count}} items using directory",
  "Last played at {{dt}}": "Last played at {{dt}}",
  "ResourceTag.IsParent": "Is parent",
  "ResourceTag.Pinned": "Pinned",
  "ResourceTag.PathDoesNotExist": "Path does not exist",
  "ResourceTag.UnknownMediaLibrary": "Unknown media library",
  "StandardValueType.String": "Text",
  "StandardValueType.ListString": "Multiple texts",
  "StandardValueType.Decimal": "Number",
  "StandardValueType.Link": "Link",
  "StandardValueType.Boolean": "Yes/No",
  "StandardValueType.DateTime": "Date time",
  "StandardValueType.Time": "time",
  "StandardValueType.ListListString": "Multilevel texts",
  "StandardValueType.ListTag": "Tags",
  "App.AcceleratedStaticFileDirectory": "High-performance storage directory",
  "App.MediaLibrarySyncInterval": "Media library auto-sync interval",
  "BiliBili.Directory": "Bilibili download directory",
  "BiliBili.Cookie": "Bilibili Cookie",
  "SearchOperation.Equals": "Equals",
  "SearchOperation.NotEquals": "Not equals",
  "SearchOperation.Contains": "Contains",
  "SearchOperation.NotContains": "Does not contain",
  "SearchOperation.StartsWith": "Prefix equals",
  "SearchOperation.NotStartsWith": "Prefix not equals",
  "SearchOperation.EndsWith": "Suffix equals",
  "SearchOperation.NotEndsWith": "Suffix not equals",
  "SearchOperation.GreaterThan": "Greater than",
  "SearchOperation.LessThan": "Less than",
  "SearchOperation.GreaterThanOrEquals": "Greater than or equals",
  "SearchOperation.LessThanOrEquals": "Less than or equals",
  "SearchOperation.IsNull": "Is null",
  "SearchOperation.IsNotNull": "Is not null",
  "SearchOperation.In": "In list",
  "SearchOperation.NotIn": "Not in list",
  "SearchOperation.Matches": "Regex matches",
  "SearchOperation.NotMatches": "Regex does not match",
  "StandardValueConversionLoss.All": "Data will be lost",
  "StandardValueConversionLoss.InconvertibleDataWillBeLost": "Non-convertible data will be lost",
  "StandardValueConversionLoss.NotEmptyValueWillBeConvertedToTrue": "Non-empty value will be converted to 'true'",
  "Resource Children": "Resource Children",
  "View Children": "View Children",
  "Loading children...": "Loading children...",
  "No children found": "No children found",
  "Failed to load children": "Failed to load children",
  "Found {{count}} children": "Found {{count}} children",
  "Mark as not played": "Mark as not played",
  "StandardValueConversionLoss.ValuesWillBeMerged": "Data will be merged",
  "StandardValueConversionLoss.OnlyFirstValueWillBeRemained": "Only the first value will be retained",
  "StandardValueConversionLoss.NonZeroValueWillBeConvertedToTrue": "Non-zero value will be converted to 'true'",
  "StandardValueConversionLoss.TextWillBeLost": "Text information will be lost",
  "StandardValueConversionLoss.TimeWillBeLost": "Time information will be lost",
  "StandardValueConversionLoss.DateWillBeLost": "Date information will be lost",
  "StandardValueConversionLoss.TagGroupAndNameWillBeMerged": "Tag group and name will be merged",
  "Volume.Index": "Issue index",
  "Volume.Name": "Issue name",
  "Volume.Title": "Issue title",
  "Boolean.True": "True",
  "Boolean.False": "False",
  "PropertyValueScope.Manual": "Manual",
  "PropertyValueScope.Synchronization": "Synchronization",
  "PropertyValueScope.BakabaseEnhancer": "Bakabase enhancer",
  "PropertyValueScope.ExHentaiEnhancer": "ExHentai enhancer",
  "PropertyValueScope.BangumiEnhancer": "Bangumi enhancer",
  "PropertyValueScope.DLsiteEnhancer": "DLsite enhancer",
  "PropertyValueScope.RegexEnhancer": "Regex enhancer",
  "PropertyValueScope.KodiEnhancer": "Kodi enhancer",
  "PropertyValueScope.TmdbEnhancer": "TMDb enhancer",
  "PropertyValueScope.AvEnhancer": "AV enhancer",
  "PropertyType.SingleLineText": "Single-line text",
  "PropertyType.MultilineText": "Multi-line text",
  "PropertyType.SingleChoice": "Single choice",
  "PropertyType.MultipleChoice": "Multiple choice",
  "PropertyType.Number": "Number",
  "PropertyType.Percentage": "Percentage",
  "PropertyType.Rating": "Rating",
  "PropertyType.Boolean": "True/False",
  "PropertyType.Link": "Link",
  "PropertyType.Attachment": "Attachment",
  "PropertyType.Date": "Date",
  "PropertyType.DateTime": "DateTime",
  "PropertyType.Time": "Time",
  "PropertyType.Formula": "Formula",
  "PropertyType.Multilevel": "Multi-level option",
  "PropertyType.Tags": "Tags",
  "CoverSelectOrder.FilenameAscending": "Filename ascending",
  "CoverSelectOrder.FileModifyDtDescending": "File modification time descending",
  "ResourceProperty.Introduction": "Introduction",
  "ResourceProperty.Rating": "Rating",
  "BuiltinPropertyForDisplayName.Filename": "Filename",
  "BulkModificationProcessorValueType.ManuallyInput": "Manual input",
  "BulkModificationProcessorValueType.Variable": "Variable",
  "Property.Parent association": "Parent association",
  "Property.Path": "Path",
  "Property.FileCreatedAt": "File creation time",
  "Property.FileModifiedAt": "File modification time",
  "PropertyPool.Internal": "Built-in",
  "PropertyPool.Reserved": "Reserved",
  "PropertyPool.Custom": "Custom",
  "PropertyPool.Abbreviation.Internal": "I",
  "PropertyPool.Abbreviation.Reserved": "R",
  "PropertyPool.Abbreviation.Custom": "C",
  "Sort by {{sortBy}}": "Sort by {{sortBy}}",
  "Post links in {{source}}": "Post links in {{source}}",
  "DownloadTaskParserSource.SoulPlus": "SoulPlus",
  "Current listening port is {{port}}": "Current listening port is {{port}}",
  "The configurable port range is {{min}}-{{max}}": "The configurable port range is {{min}}-{{max}}",
  "DurationUnit.Day": "days",
  "DurationUnit.Hour": "hours",
  "DurationUnit.Minute": "minutes",
  "DurationUnit.Second": "seconds",
  "SearchOperation.In.description": "Property value is in the specified value list",
  "SearchOperation.NotIn.description": "Property value is not in the specified value list",
  "Deleting template {{name}}": "Deleting template {{name}}",
  "Are you sure to delete variable {{name}}?": "Are you sure to delete variable {{name}}?",
  "If you are browsing {{thirdPartyName}}, you should decrease the threads of downloading.": "If you are browsing {{thirdPartyName}}, you should decrease the threads of downloading.",
  "The {{layer}}th layer in media library -> {{propertyName}}": "The {{layer}}th layer in media library -> {{propertyName}}",
  "The {{layer}}th layer": "The {{layer}}th layer",
  "media-library-template.use-preset-template-builder": "We recommend using our <1>Preset Template Builder</1> the first time you create a media library template",
  "Select all {{count}} filtered resources (including those not currently loaded).": "Select all {{count}} filtered resources (including those not currently loaded).",
  "Configure enhancer:{{enhancerName}}": "Configure enhancer:{{enhancerName}}",
  "FileNameModifier.Title": "Batch File Name Modification",
  "FileNameModifier.FilePathsPlaceholder": "One complete file path per line",
  "FileNameModifier.OperationsList": "Operations List:",
  "FileNameModifier.AddOperation": "Add Operation",
  "FileNameModifier.Delete": "Delete",
  "FileNameModifier.Preview": "Preview",
  "FileNameModifier.ExecuteModification": "Execute Modification",
  "FileNameModifier.PreviewResults": "Preview Results",
  "FileNameModifier.OriginalFileName": "Original File Name",
  "FileNameModifier.NewFileName": "New File Name",
  "FileNameModifier.PreviewFailed": "Preview failed",
  "FileNameModifier.ModificationSuccess": "Modification successful",
  "FileNameModifier.ModificationFailed": "Modification failed",
  "FileNameModifier.Validation.InsertRequiresText": "Insert operation requires Text",
  "FileNameModifier.Validation.AddDateTimeRequiresFormat": "AddDateTime operation requires DateTimeFormat",
  "FileNameModifier.Validation.DeleteRequiresCount": "Delete operation requires DeleteCount > 0",
  "FileNameModifier.Validation.DeleteRequiresPosition": "Delete operation requires DeleteStartPosition >= 0",
  "FileNameModifier.Validation.ReplaceRequiresText": "Replace operation requires Text or TargetText",
  "FileNameModifier.Validation.AddAlphabetRequiresCount": "AddAlphabetSequence operation requires AlphabetCount > 0",
  "FileNameModifier.Operation.Insert": "Insert",
  "FileNameModifier.Operation.AddDateTime": "AddDateTime",
  "FileNameModifier.Operation.Delete": "Delete",
  "FileNameModifier.Operation.Replace": "Replace",
  "FileNameModifier.Operation.ChangeCase": "ChangeCase",
  "FileNameModifier.Operation.AddAlphabetSequence": "AddAlphabetSequence",
  "FileNameModifier.Operation.Reverse": "Reverse",
  "FileNameModifier.CaseType.TitleCase": "TitleCase",
  "FileNameModifier.CaseType.UpperCase": "UpperCase",
  "FileNameModifier.CaseType.LowerCase": "LowerCase",
  "FileNameModifier.CaseType.CamelCase": "CamelCase",
  "FileNameModifier.CaseType.PascalCase": "PascalCase",
  "Click Preview to see results": "Click Preview to see results",
  "FileNameModifier.ConfirmPaths": "Confirm Paths",
  "FileNameModifier.EditPaths": "Edit Paths",
  "Please confirm file paths first": "Please confirm file paths first",
  "FileNameModifier.ShowPreview": "Show Preview",
  "FileNameModifier.ClickPreviewToSeeResults": "Click Preview to see results",
  "FileNameModifier.PleaseConfirmFilePathsFirst": "Please confirm file paths first",
  "FileNameModifier.ReplaceEntire": "Replace entire filename",
  "FileNameModifier.Validation.NoFilePaths": "No file paths provided",
  "FileNameModifier.Validation.InsertRequiresValidIndex": "Insert operation requires valid position index",
  "FileNameModifier.Validation.DeleteRequiresValidPosition": "Delete operation requires valid position",
  "FileNameModifier.PositionType.Start": "Start",
  "FileNameModifier.PositionType.End": "End",
  "FileNameModifier.PositionType.BeforeMatch": "Before Match",
  "FileNameModifier.PositionType.AfterMatch": "After Match",
  "FileNameModifier.PositionType.AtIndex": "At Index",
  "FileNameModifier.DeleteType.Entire": "Entire",
  "FileNameModifier.DeleteType.FromStart": "From Start",
  "FileNameModifier.DeleteType.FromEnd": "From End",
  "FileNameModifier.DeleteType.BeforeMatch": "Before Match",
  "FileNameModifier.DeleteType.AfterMatch": "After Match",
  "FileNameModifier.DeleteType.AtPosition": "At Position",
  "FileNameModifier.Placeholder.Text": "Text",
  "FileNameModifier.Placeholder.TargetText": "Target text",
  "FileNameModifier.Placeholder.DateTimeFormat": "DateTime format",
  "FileNameModifier.Placeholder.DeleteCount": "Delete count",
  "FileNameModifier.Placeholder.DeleteStartPosition": "Start position",
  "FileNameModifier.Placeholder.MatchText": "Match text",
  "FileNameModifier.Placeholder.StartChar": "Start char",
  "FileNameModifier.Placeholder.Count": "Count",
  "FileNameModifier.Placeholder.CaseType": "Case type",
  "FileNameModifier.Placeholder.PositionType": "Position type",
  "FileNameModifier.Label.PositionType": "Position Type",
  "FileNameModifier.Label.PositionIndex": "Position Index",
  "FileNameModifier.Label.Text": "Text",
  "FileNameModifier.Label.TargetText": "Target Text",
  "FileNameModifier.Label.DateTimeFormat": "Date Time Format",
  "FileNameModifier.Label.DeleteCount": "Delete Count",
  "FileNameModifier.Label.DeleteStartPosition": "Delete Start Position",
  "FileNameModifier.Label.MatchText": "Match Text",
  "FileNameModifier.Label.CaseType": "Case Type",
  "FileNameModifier.Label.StartChar": "Start Character",
  "FileNameModifier.Label.Count": "Count",
  "FileNameModifier.Original": "Original Path",
  "FileNameModifier.Modified": "Modified Path",
  "FileNameModifier.PathDisplay": "Path Display",
  "FileNameModifier.HideFullPaths": "Hide Full Paths",
  "FileNameModifier.ShowFullPaths": "Show Full Paths",
  "FileNameModifier.FullPath": "Full Path",
  "FileNameModifier.FileName": "File Name",
  "FileNameModifier.CommonPrefix": "Common Prefix",
  "FileNameModifier.OriginalPath": "Original Path",
  "FileNameModifier.ModifiedPath": "Modified Path",
  "FileNameModifier.EditFileList": "Edit File List",
  "FileNameModifier.LoadingPreview": "Loading preview...",
  "FileNameModifier.NoPreviewResults": "No preview results",
  "FileNameModifier.Deduplicate": "Deduplicate",
  "FileNameModifier.Clear": "Clear",
  "FileNameModifier.Paste": "Paste",
  "FileNameModifier.PathEmpty": "Path cannot be empty",
  "FileNameModifier.PathInvalidChar": "Contains invalid character",
  "FileNameModifier.ClipboardReadError": "Failed to read clipboard",
  "FileNameModifier.OperationCardAria": "Operation item {{index}}",
  "FileNameModifier.FilePathsTextarea": "File paths textarea",
  "FileNameModifier.OperationType": "Operation Type",
  "FileNameModifier.OperationType.Insert": "Insert",
  "FileNameModifier.OperationType.AddDateTime": "Add DateTime",
  "FileNameModifier.OperationType.Delete": "Delete",
  "FileNameModifier.OperationType.Replace": "Replace",
  "FileNameModifier.OperationType.ChangeCase": "Change Case",
  "FileNameModifier.OperationType.AddAlphabetSequence": "Add Alphabet Sequence",
  "FileNameModifier.OperationType.Reverse": "Reverse",
  "FileNameModifier.OperationTypePlaceholder": "Select operation type",
  "FileNameModifier.Cancel": "Cancel",
  "FileNameModifier.Error.TargetRequired": "Target is required",
  "FileNameModifier.TargetType": "Target",
  "FileNameModifier.TargetTypePlaceholder": "Please select target",
  "FileNameModifier.Target.FileName": "Full file name (with extension)",
  "FileNameModifier.Target.FileNameWithoutExtension": "File name (without extension)",
  "FileNameModifier.Target.Extension": "Extension (with dot)",
  "FileNameModifier.Target.ExtensionWithoutDot": "Extension (without dot)",
  "FileNameModifier.Error.OperationTypeRequired": "Operation type is required",
  "FileNameModifier.Error.InsertTextRequired": "Insert operation requires text or target text",
  "FileNameModifier.Error.DateTimeFormatRequired": "Date time format is required",
  "FileNameModifier.Error.DeleteParamsRequired": "Delete operation parameters are incomplete",
  "FileNameModifier.Error.ReplaceTextRequired": "Replace operation requires text or target text",
  "FileNameModifier.Error.CaseTypeRequired": "Case type is required",
  "FileNameModifier.Error.AlphabetParamsRequired": "Alphabet sequence parameters are incomplete",
  "FileNameModifier.Error.UnknownOperationType": "Unknown operation type",
  "FileNameModifier.Error.NoValidOperation": "No valid operation configured. Please add at least one valid operation.",
  "MediaLibrary.AddOrEdit": "Add or edit",
  "MediaLibrary.SynchronizeAll": "Synchronize all media libraries",
  "MediaLibrary.DeleteEnhancements": "Delete enhancements",
  "MediaLibraryTemplate.RemoveEnhancer": "Remove enhancer",
  "Enhancement.DeleteAllByEnhancerForTemplate": "Delete all enhancements of this enhancer for template {{templateName}}",
  "Enhancement.DeleteAllByEnhancerForTemplate.ScopeWarning": "This will delete all enhancements of resources in all media libraries using this template.",
  "Enhancement.EnhancedResourceCount": "{{count}} resources enhanced",
  "Enhancement.DeleteByEnhancer.SelectEnhancerTitle": "Select an enhancer to delete enhancements",
  "Enhancement.DeleteByEnhancer.NoEnhancerInTemplate": "No enhancers configured in template",
  "MediaLibrary.SortBy": "Sort by {{sortBy}}",
  "MediaLibrary.SortBy.Path": "Path",
  "MediaLibrary.SortBy.Template": "Template",
  "MediaLibrary.Name": "Name",
  "MediaLibrary.NamePlaceholder": "Name of media library",
  "MediaLibrary.Path": "Path",
  "MediaLibrary.PathPlaceholder": "Path of media library",
  "MediaLibrary.Template": "Template",
  "MediaLibrary.TemplatePlaceholder": "Template for media library",
  "MediaLibrary.CreateNewTemplate": "Create new template",
  "MediaLibrary.Add": "Add",
  "MediaLibrary.Save": "Save",
  "MediaLibrary.SaveAll": "Save all media libraries",
  "MediaLibrary.SaveAllConfirm": "Deleted media libraries will not be restored. Are you sure you want to save?",
  "MediaLibrary.Saved": "Saved",
  "MediaLibrary.ExitEditingMode": "Exit editing mode",
  "MediaLibrary.SearchResources": "Search resources in current media library",
  "MediaLibrary.Confirm": "Confirm",
  "MediaLibrary.LeavePageConfirm": "Are you sure you want to leave the current page?",
  "MediaLibrary.Continue": "Continue",
  "MediaLibrary.Cancel": "Cancel",
  "MediaLibrary.Unknown": "Unknown",
  "MediaLibrary.NoMediaLibrariesFound": "No media libraries found. You must add at least one media library and synchronize it to manage your resources.",
  "Synchronize now?": "Synchronize now?",
  "Media libraries have changed (added/removed/modified).": "Media libraries have changed (added/removed/modified).",
  "Changed libraries to sync: {count}": "Changed libraries to sync: {{count}}",
  "Resource will be displayed only after synchronization is complete.": "Resource will be displayed only after synchronization is complete.",
  "Would you like to synchronize now, or do it later manually?": "Would you like to synchronize now, or do it later manually?",
  "Synchronization started": "Synchronization started",
  "Sync Now": "Sync Now",
  "Sync now": "Sync now",
  "Mark as synced": "Mark as synced",
  "Are you sure you want to mark these libraries as synced?": "Are you sure you want to mark these libraries as synced?",
  "Following media libraries may be outdated and should be synchronized:": "Following media libraries may be outdated and should be synchronized:",
  Later,
  "FileNameModifier.ModificationResult": "Batch Rename Result",
  "FileNameModifier.ModificationSuccessCount": "Success: {{count}}",
  "FileNameModifier.ModificationFailCount": "Failed: {{count}}",
  "FileNameModifier.ModificationFailList": "Failed Files",
  "FileNameModifier.ModificationFailReason": "Reason",
  "FileNameModifier.Close": "Close",
  "Maximum file count": "Maximum file count",
  "Leave empty for no limit": "Leave empty for no limit",
  "Max: {{count}}": "Max: {{count}}",
  "Batch rename {{count}} items": "Batch rename {{count}} items",
  "BetaFeature.BackupWarning": "If you are processing important data, it is recommended to back it up before trying.",
  "Found some conflicted tasks": "Found some conflicted tasks",
  "Download selected tasks firstly": "Download selected tasks firstly",
  "Add selected tasks to the queue": "Add selected tasks to the queue",
  Bulk,
  Start,
  Stop,
  Source,
  Keyword,
  "Create task": "Create task",
  "Start all": "Start all",
  "Stop all": "Stop all",
  Cleanup,
  "Delete all completed tasks": "Delete all completed tasks",
  "Delete all failed tasks": "Delete all failed tasks",
  "Export all tasks": "Export all tasks",
  Configurations,
  "Next start time": "Next start time",
  "Creating download task": "Creating download task",
  "Download task": "Download task",
  Site,
  "Task type": "Task type",
  "Not available": "Not available",
  "Cookie required for authentication": "Cookie required for authentication",
  "Default download path": "Default download path",
  "Default path where downloads will be saved": "Default path where downloads will be saved",
  "Max concurrency": "Max concurrency",
  "Request interval (s)": "Request interval (s)",
  "Request interval help": "Set the time interval between requests to avoid too frequent requests",
  "Define how downloaded files should be named": "Define how downloaded files should be named",
  "Available fields": "Available fields",
  "Naming convention": "Naming convention",
  "Allow duplicate submission": "Allow duplicate submission",
  "In general, it's not necessary to create identical tasks.": "In general, it's not necessary to create identical tasks.",
  "Auto retry": "Auto retry",
  "Retry automatically when the downloading task failed.": "Retry automatically when the downloading task failed.",
  "Check interval(s)": "Check interval(s)",
  "Select download path": "Select download path",
  "Page range": "Page range",
  "Start page": "Start page",
  "End page": "End page",
  "The minimal page number is 1.": "The minimal page number is 1.",
  "Set a page range if you don't want to download them all.": "Set a page range if you don't want to download them all.",
  "Select favorites": "Select favorites",
  "Setup now": "Setup now",
  Developing,
  "This feature is currently in development and may not be fully functional.": "This feature is currently in development and may not be fully functional.",
  "DevelopingFeature.ExpectChanges": "Please expect updates in the future.",
  "Unable to retrieve Bilibili favorites. Please ensure your cookie is correctly set and that you have at least one favorite created.": "Unable to retrieve Bilibili favorites. Please ensure your cookie is correctly set and that you have at least one favorite created.",
  "This function is not working because Lux is not found, check it in system configurations": "This function is not working because Lux is not found, check it in system configurations",
  "This function is not working because FFmpeg is not found, check it in system configurations": "This function is not working because FFmpeg is not found, check it in system configurations",
  "You can set the previous downloading checkpoint manually to make the downloader start the downloading task from it.": "You can set the previous downloading checkpoint manually to make the downloader start the downloading task from it.",
  "In most cases, you should let this field set by downloader automatically.": "In most cases, you should let this field set by downloader automatically.",
  "Each downloader has its own checkpoint format, and invalid checkpoint data will be ignored. You can find samples on our online document.": "Each downloader has its own checkpoint format, and invalid checkpoint data will be ignored. You can find samples on our online document.",
  "Requests overview": "Requests overview",
  Success,
  Failure,
  Succeed,
  TimedOut,
  Banned,
  Canceled,
  "The {{n}}th layer before {{basePathType}}": "The {{n}}th layer before {{basePathType}}",
  "The {{n}}th layer after {{basePathType}}": "The {{n}}th layer after {{basePathType}}",
  Layer,
  "Layer 0 is {{basePathType}}, negative means before {{basePathType}}, positive means after {{basePathType}}": "Layer 0 is {{basePathType}}, negative means before {{basePathType}}, positive means after {{basePathType}}",
  Regex,
  "Regex to match sub path": "Regex to match sub path",
  "Not supported": "Not supported",
  "Extract property values from resource path": "Extract property values from resource path",
  Rule,
  Positioning,
  "Based on": "Based on",
  "Based on media library": "Based on media library",
  "Based on resource": "Based on resource",
  "Add a rule": "Add a rule",
  "For layer-based rules, level 0 represents the current directory; for regex rules, the text to be matched starts from the next level under the current directory up to the resource path portion.": "For layer-based rules, level 0 represents the current directory; for regex rules, the text to be matched starts from the next level under the current directory up to the resource path portion.",
  "All rules will be run independently, and the results will be merged": "All rules will be run independently, and the results will be merged",
  "Configure media players for different file types": "Configure media players for different file types",
  Players: Players$1,
  "No players configured": "No players configured",
  "Configure Players": "Configure Players",
  "Add Player": "Add Player",
  "No players configured. Click 'Add Player' to get started.": "No players configured. Click 'Add Player' to get started.",
  "Player {{index}}": "Player {{index}}",
  "Player ${index + 1}": "Player ${index + 1}",
  "Executable Path": "Executable Path",
  "Path to the player executable": "Path to the player executable",
  Command,
  "Use {0} as placeholder for the file path": "Use {0} as placeholder for the file path",
  "Supported file extensions": "Supported file extensions",
  "Executable path is required": "Executable path is required",
  "Please fill in all executable paths before saving.": "Please fill in all executable paths before saving.",
  "Tampermonkey script": "Tampermonkey script",
  "One-click installation": "One-click installation",
  "This script modifies some interactive behaviors of the target website. You can manually enable or disable the script in Tampermonkey.": "This script modifies some interactive behaviors of the target website. You can manually enable or disable the script in Tampermonkey.",
  "Left-clicking on covers or post titles will trigger the creation of a post parsing task on Bakabase. You can still use the middle button to open posts.": "Left-clicking on covers or post titles will trigger the creation of a post parsing task on Bakabase. You can still use the middle button to open posts.",
  "Left-clicking on covers will trigger the creation of a torrent download task on Bakabase. You can still use the middle button to open posts.": "Left-clicking on covers will trigger the creation of a torrent download task on Bakabase. You can still use the middle button to open posts.",
  "MediaLibrary.Players": "Players",
  "Select properties": "Select properties",
  "Select a property": "Select a property",
  "Automatically match property": "Automatically match property",
  "No proper property found": "No proper property found",
  "You can": "You can",
  "Automatically create a new property": "Automatically create a new property",
  "Select manually": "Select manually",
  "Bind referenced properties to current template?": "Bind referenced properties to current template?",
  "Maximum concurrent download threads": "Maximum concurrent download threads",
  Bilibili: Bilibili$1,
  ExHentai: ExHentai$1,
  Pixiv: Pixiv$1,
  Bangumi: Bangumi$1,
  SoulPlus: SoulPlus$1,
  DLsite: DLsite$1,
  Fanbox,
  Fantia,
  Cien,
  Patreon,
  Tmdb,
  "Cookie validator": "Cookie validator",
  Validate: Validate$1,
  Cookie,
  "Max Concurrency": "Max Concurrency",
  "Request Interval (ms)": "Request Interval (ms)",
  "Default Path": "Default Path",
  "Naming Convention": "Naming Convention",
  "Max Retries": "Max Retries",
  "Request Timeout (ms)": "Request Timeout (ms)",
  "Validate cookie": "Validate cookie",
  "Auto Buy Threshold": "Auto Buy Threshold",
  "User Agent": "User Agent",
  Referer,
  "API Key": "API Key",
  "Enhance properties": "Enhance properties",
  Selected,
  more,
  "Other settings": "Other settings",
  "Proxy": "Proxy",
  "Do not use proxy": "Do not use proxy",
  "Use system proxy": "Use system proxy",
  "Add a proxy": "Add a proxy",
  "You can set a proxy for network requests, such as socks5://127.0.0.1:18888": "You can set a proxy for network requests, such as socks5://127.0.0.1:18888",
  Add,
  Saved,
  "Invalid Data": "Invalid Data",
  "Enable pre-release channel": "Enable pre-release channel",
  "Prefer pre-release version which has new features but less stability": "Prefer pre-release version which has new features but less stability",
  "Enable anonymous data tracking": "Enable anonymous data tracking",
  "We are using Microsoft Clarity to track anonymous data, which will help us to improve our product experience.": "We are using Microsoft Clarity to track anonymous data, which will help us to improve our product experience.",
  "Listening port count": "Listening port count",
  "Current listening port count is {{port}}": "Current listening port count is {{port}}",
  Auto,
  "The configurable port range is {{min}}-{{max}}. And you can set it to 0 for auto count.": "The configurable port range is {{min}}-{{max}}. And you can set it to 0 for auto count.",
  "Changes will take effect after restarting the application": "Changes will take effect after restarting the application",
  "Please be careful when setting this value, if you set it to a value that is already in use by another application, our application will not be able to start.": "Please be careful when setting this value, if you set it to a value that is already in use by another application, our application will not be able to start.",
  Count,
  "Listening ports": "Listening ports",
  "You can set fixed listening ports.": "You can set fixed listening ports.",
  "Enter ports separated by commas, e.g. 34567, 34568": "Enter ports separated by commas, e.g. 34567, 34568",
  "e.g. 34567, 34568": "e.g. 34567, 34568",
  "Too many ports. Up to {{max}} ports are supported.": "Too many ports. Up to {{max}} ports are supported.",
  "You can configure the number of listening ports. The more listening ports you set, the more it helps with parallel processing of interface‑related operations. It’s recommended not to exceed the number of CPU cores. In most cases, you can just ignore this setting. If you leave it as empty and listening ports are not specified, we'll use a default value.": "You can configure the number of listening ports. The more listening ports you set, the more it helps with parallel processing of interface‑related operations. It’s recommended not to exceed the number of CPU cores. In most cases, you can just ignore this setting. If you leave it as empty and listening ports are not specified, we'll use a default value.",
  "ResourceCover.CoverTips.Tooltip": "Tips about missing covers",
  "ResourceCover.CoverTips.Title": "No covers loaded? Tips",
  "ResourceCover.CoverTips.S1.Title": "Situation 1: No cover can be generated",
  "ResourceCover.CoverTips.S1.Happens": "Happens when:",
  "ResourceCover.CoverTips.S1.When.NotImage": "the resource is not an image itself.",
  "ResourceCover.CoverTips.S1.When.NoImageInFolder": "there is not any image in resource's folder",
  "ResourceCover.CoverTips.S1.Todo": "What you can do:",
  "ResourceCover.CoverTips.S1.Todo.ManualSet": "manually set covers for resources",
  "ResourceCover.CoverTips.S1.Todo.FFmpeg": "if resource is video, you can setup ffmpeg in configuration to auto capture screenshot as covers;",
  "ResourceCover.CoverTips.S1.Todo.Enhancers": "setup enhancers in media library template and wait the enhancements complete, enhancers may fill everything including property values and files they can acquired for each resources.",
  "ResourceCover.CoverTips.S1.Todo.Cache": "sometimes you may should clear cache or disable cache after above operations.",
  "ResourceCover.CoverTips.S2.Title": "Situation 2: Cached cover was deleted",
  "ResourceCover.CoverTips.S2.Happens": "Happens when:",
  "ResourceCover.CoverTips.S2.When.CacheDeleted": "the cover was cached but deleted after",
  "ResourceCover.CoverTips.S2.Todo": "What you can do:",
  "ResourceCover.CoverTips.S2.Todo.DisableCache": "try to disable cache from the button inside upper right area of current page, if covers display, you can manually remove caches in data-cache page",
  "MediaLibrary.DeleteConfirm": "Are you sure you want to delete this media library?",
  "Select Path": "Select Path",
  custom,
  "media library": "Media library",
  "Manually enter a path": "Manually enter a path",
  "Show operations after playing first file": "Show operations after playing first file",
  "After first play: operations": "After first play: operations",
  "Move to...": "Move to...",
  "Current Path": "Current Path",
  "Usually this will work fine if you are categorizing files.": "Usually this will work fine if you are categorizing files.",
  "Shortcut.LeftClick": "Left-click",
  "Shortcut.CtrlClick": "Ctrl-click",
  "Shortcut.ShiftClick": "Shift-click",
  "Shortcut.W": "W",
  "Shortcut.E": "E",
  "Shortcut.M": "M",
  "Shortcut.G": "G",
  "Shortcut.D": "D",
  "Shortcut.F2": "F2",
  "Shortcut.Delete": "Delete",
  "Shortcut.Space": "Space",
  "Capability.select": "Select",
  "Capability.multi-select": "Multi-select",
  "Capability.range-select": "Range-select",
  "Capability.wrap": "Wrap",
  "Capability.extract": "Extract",
  "Capability.move": "Move",
  "Capability.delete": "Delete",
  "Capability.rename": "Rename",
  "Capability.decompress": "Decompress",
  "Capability.delete-all-same-name": "Delete all by same name",
  "Capability.group": "Group",
  "Capability.play": "Play",
  "Capability.play-first-file": "Play first file",
  "{{count}} resource(s) have set this property value.": "{{count}} resource(s) have set this property value.",
  "{{count}} resource(s) loaded in this media library.": "{{count}} resource(s) loaded in this media library.",
  "Configure enhancer": "Configure enhancer",
  "Run after enhancers": "Run after enhancers",
  "You can perform chained enhancement by customizing the execution order of the enhancers.": "You can perform chained enhancement by customizing the execution order of the enhancers.",
  "Generally, you can just leave it as empty.": "Generally, you can just leave it as empty.",
  "Property value used during enhancement": "Property value used during enhancement",
  "Generally, this enhancer will use file/folder name of resource to perform enhancement and its not necessary to change this.": "Generally, this enhancer will use file/folder name of resource to perform enhancement and its not necessary to change this.",
  "In some cases, you can change the property value used during enhancement to perform enhancement on other property values.": "In some cases, you can change the property value used during enhancement to perform enhancement on other property values.",
  "Select property": "Select property",
  "Property value scope": "Property value scope",
  "Property value scope usually means who the property value is generated by.": "Property value scope usually means who the property value is generated by.",
  "For internal options, property value scope will be ignored.": "For internal options, property value scope will be ignored.",
  "Manual property value scope has been selected": "Manual property value scope has been selected",
  "I've understood": "I've understood",
  "Please select at least one property to enhance.": "Please select at least one property to enhance.",
  "Pretreatment test": "Pretreatment test",
  "Enter text": "Enter text",
  "Run pretreatment": "Run pretreatment",
  Original,
  Pretreated,
  "No changes": "No changes",
  Diffs,
  "Validate media library template": "Validate media library template",
  "Root path": "Root path",
  "Pick a directory or file path": "Pick a directory or file path",
  "Limit resources count": "Limit resources count",
  "Resource keyword": "Resource keyword",
  "Validating...": "Validating...",
  "Validate your template on sample resources and see live traces.": "Validate your template on sample resources and see live traces.",
  "Run a quick validation to check resource discovery, properties, playable files, enhancers and display names.": "Run a quick validation to check resource discovery, properties, playable files, enhancers and display names.",
  "Resource count": "Resource count",
  Cached,
  Covers,
  PlayableFiles: PlayableFiles$1,
  ResourceMarkers,
  "Enable resource markers": "Enable resource markers",
  "A hidden .bakabase.json file will be generated inside folder resources to store their resource IDs.": "A hidden .bakabase.json file will be generated inside folder resources to store their resource IDs.",
  "During synchronization, if a folder path changes but contains a .bakabase.json with any matching resource IDs, the resource data will be preserved instead of creating a new resource.": "During synchronization, if a folder path changes but contains a .bakabase.json with any matching resource IDs, the resource data will be preserved instead of creating a new resource.",
  "Since a path can be added to multiple media libraries, resources under each path will be tracked per media library.": "Since a path can be added to multiple media libraries, resources under each path will be tracked per media library.",
  "Only supports resources in new version (V2) media libraries. Legacy resources (category-based media libraries) are not supported.": "Only supports resources in new version (V2) media libraries. Legacy resources (category-based media libraries) are not supported.",
  "Enabling this feature will increase synchronization time as marker files need to be generated and verified.": "Enabling this feature will increase synchronization time as marker files need to be generated and verified.",
  "This feature will work after a complete GenerateResourceMarker task finishes.": "This feature will work after a complete GenerateResourceMarker task finishes.",
  "Confirm disabling resource markers": "Confirm disabling resource markers",
  "Confirm and stop task": "Confirm and stop task",
  "The KeepResourcesOnPathChange task is currently running.": "The KeepResourcesOnPathChange task is currently running.",
  "Disabling this feature will stop the task. Are you sure you want to continue?": "Disabling this feature will stop the task. Are you sure you want to continue?",
  "Delete marker files?": "Delete marker files?",
  "Delete markers": "Delete markers",
  "Keep markers": "Keep markers",
  "Do you want to delete all .bakabase.json marker files?": "Do you want to delete all .bakabase.json marker files?",
  "If you keep them, existing markers will remain in the folders.": "If you keep them, existing markers will remain in the folders.",
  "Processing...": "Processing...",
  "Updating settings, please wait...": "Updating settings, please wait...",
  "Deleting resource markers": "Deleting resource markers",
  "Processing {{processed}} of {{total}} resources": "Processing {{processed}} of {{total}} paths",
  "Deleted: {{deleted}}, Failed: {{failed}}": "Deleted: {{deleted}}, Failed: {{failed}}",
  "Failed to delete markers": "Failed to delete markers",
  "By default, when a folder path changes, the resource data will be created as a new resource.": "By default, when a folder path changes, the resource data will be created as a new resource.",
  "If you enable this feature, a hidden .bakabase.json file will be generated inside folder resources to store their resource IDs.": "If you enable this feature, a hidden .bakabase.json file will be generated inside folder resources to store their resource IDs.",
  "Keep resources on path change": "Keep resources on path change"
};
if (!instance.isInitialized) {
  instance.use(initReactI18next).init({
    resources: {
      cn: { translation: cnResources },
      en: { translation: enResources }
    },
    lng: "en",
    // 默认语言
    fallbackLng: "en",
    returnNull: false,
    interpolation: { escapeValue: false },
    parseMissingKeyHandler: (key) => key,
    returnObjects: false
  });
  console.log("i18n initialized");
}
dayjs.extend(duration);
const BakabaseContext = reactExports.createContext({
  createPortal: (C2, props) => ({ key: "", destroy: () => {
  } }),
  isDarkMode: false,
  isDebugging: false
});
const useBakabaseContext = () => {
  return reactExports.useContext(BakabaseContext);
};
const getStoredTheme = () => {
  if (typeof window === "undefined" || typeof localStorage === "undefined") {
    return void 0;
  }
  try {
    const stored = localStorage.getItem("bakabase-theme");
    if (stored) {
      const themeValue = parseInt(stored);
      if (Object.values(UiTheme).includes(themeValue)) {
        return themeValue;
      }
    }
  } catch (error2) {
    console.warn("Failed to read theme from localStorage:", error2);
  }
};
const setStoredTheme = (theme2) => {
  if (typeof window === "undefined" || typeof localStorage === "undefined") {
    return;
  }
  try {
    localStorage.setItem("bakabase-theme", theme2.toString());
  } catch (error2) {
    console.warn("Failed to save theme to localStorage:", error2);
  }
};
const changeTheme = (theme2) => {
  console.log(theme2, document);
  if (typeof document === "undefined") {
    return;
  }
  const cls = document.documentElement.classList;
  cls.remove("iw-theme-dark", "iw-theme-light", "dark", "light");
  cls.add(
    `iw-theme-${theme2 == UiTheme.Dark ? "dark" : "light"}`,
    theme2 == UiTheme.Dark ? "dark" : "light"
  );
};
const BakabaseContextProvider = ({ children }) => {
  const [appOptions, setAppOptions] = reactExports.useState();
  const currentTheme = reactExports.useRef(getUiTheme(appOptions ? appOptions.uiTheme : getStoredTheme()));
  const isDarkMode = reactExports.useMemo(() => currentTheme.current === UiTheme.Dark, [currentTheme]);
  const [portals, setPortals] = reactExports.useState([]);
  const mount = (C2, props) => {
    console.log("[createPortal] mount", C2, props);
    const key = uuidv4();
    setPortals((prev2) => [...prev2, { key, component: /* @__PURE__ */ jsxRuntimeExports.jsx(C2, { ...props }) }]);
    const destroy = () => {
      console.log("[createPortal] destroy", key);
      setPortals((prev2) => prev2.filter((p2) => p2.key !== key));
    };
    return { key, destroy };
  };
  const appOptionsStore = useAppOptionsStore();
  const isDebugging = false;
  const firstTimeGotAppOptionsRef = reactExports.useRef(false);
  const location2 = useLocation();
  const navigate = useNavigate();
  const href = useHref;
  reactExports.useEffect(() => {
    changeTheme(currentTheme.current);
    BApi$1.options.getAppOptions().then((r2) => {
      setAppOptions(r2.data);
    });
    console.log("bakabase context provider initialized");
    Clarity.init("r5xlbsu4fl");
    return () => {
      console.log("bakabase context provider is unmounting");
    };
  }, []);
  reactExports.useEffect(() => {
    if (appOptionsStore.initialized) {
      setAppOptions(appOptionsStore.data);
    }
  }, [appOptionsStore]);
  reactExports.useEffect(() => {
    if (appOptions) {
      console.log("appOptions", appOptions, firstTimeGotAppOptionsRef.current);
      if (!firstTimeGotAppOptionsRef.current) {
        firstTimeGotAppOptionsRef.current = true;
        Clarity.setTag("appVersion", appOptions.version);
        instance.changeLanguage(appOptions.language);
      }
      const uiTheme = getUiTheme(appOptions.uiTheme);
      if (currentTheme.current != uiTheme) {
        currentTheme.current = uiTheme;
        changeTheme(uiTheme);
        setStoredTheme(uiTheme);
        console.log("theme changed to:", uiTheme);
      }
    }
  }, [appOptions]);
  reactExports.useEffect(() => {
    setPortals([]);
  }, [location2.pathname]);
  console.log("current theme", UiTheme[currentTheme.current], "portals", portals);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(UIHubConnection, {}),
    /* @__PURE__ */ jsxRuntimeExports.jsx(HeroUIProvider, { navigate, useHref: href, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
      ConfigProvider,
      {
        theme: {
          algorithm: isDarkMode ? theme.darkAlgorithm : theme.defaultAlgorithm
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(ToastProvider, { placement: "top-center" }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            BakabaseContext.Provider,
            {
              value: {
                isDarkMode,
                createPortal: mount,
                isDebugging
              },
              children: [
                portals.map(({ key, component }) => /* @__PURE__ */ jsxRuntimeExports.jsx(reactExports.Fragment, { children: component }, key)),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  "div",
                  {
                    className: `${isDarkMode ? "dark" : "light"} h-[100vh] w-[100vw] text-foreground bg-background`,
                    children: appOptions ? children : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, {}) })
                  }
                )
              ]
            }
          )
        ]
      }
    ) })
  ] });
};
var DefaultContext = {
  color: void 0,
  size: void 0,
  className: void 0,
  style: void 0,
  attr: void 0
};
var IconContext = React$5.createContext && /* @__PURE__ */ React$5.createContext(DefaultContext);
var _excluded$6 = ["attr", "size", "title"];
function _objectWithoutProperties(source2, excluded) {
  if (source2 == null)
    return {};
  var target = _objectWithoutPropertiesLoose$1(source2, excluded);
  var key, i2;
  if (Object.getOwnPropertySymbols) {
    var sourceSymbolKeys = Object.getOwnPropertySymbols(source2);
    for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) {
      key = sourceSymbolKeys[i2];
      if (excluded.indexOf(key) >= 0)
        continue;
      if (!Object.prototype.propertyIsEnumerable.call(source2, key))
        continue;
      target[key] = source2[key];
    }
  }
  return target;
}
function _objectWithoutPropertiesLoose$1(source2, excluded) {
  if (source2 == null)
    return {};
  var target = {};
  for (var key in source2) {
    if (Object.prototype.hasOwnProperty.call(source2, key)) {
      if (excluded.indexOf(key) >= 0)
        continue;
      target[key] = source2[key];
    }
  }
  return target;
}
function _extends$1() {
  _extends$1 = Object.assign ? Object.assign.bind() : function(target) {
    for (var i2 = 1; i2 < arguments.length; i2++) {
      var source2 = arguments[i2];
      for (var key in source2) {
        if (Object.prototype.hasOwnProperty.call(source2, key)) {
          target[key] = source2[key];
        }
      }
    }
    return target;
  };
  return _extends$1.apply(this, arguments);
}
function ownKeys$a(e2, r2) {
  var t2 = Object.keys(e2);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e2);
    r2 && (o2 = o2.filter(function(r3) {
      return Object.getOwnPropertyDescriptor(e2, r3).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread$b(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys$a(Object(t2), true).forEach(function(r3) {
      _defineProperty(e2, r3, t2[r3]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$a(Object(t2)).forEach(function(r3) {
      Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3));
    });
  }
  return e2;
}
function _defineProperty(obj, key, value2) {
  key = _toPropertyKey(key);
  if (key in obj) {
    Object.defineProperty(obj, key, { value: value2, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value2;
  }
  return obj;
}
function _toPropertyKey(t2) {
  var i2 = _toPrimitive(t2, "string");
  return "symbol" == typeof i2 ? i2 : i2 + "";
}
function _toPrimitive(t2, r2) {
  if ("object" != typeof t2 || !t2)
    return t2;
  var e2 = t2[Symbol.toPrimitive];
  if (void 0 !== e2) {
    var i2 = e2.call(t2, r2);
    if ("object" != typeof i2)
      return i2;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r2 ? String : Number)(t2);
}
function Tree2Element(tree) {
  return tree && tree.map((node2, i2) => /* @__PURE__ */ React$5.createElement(node2.tag, _objectSpread$b({
    key: i2
  }, node2.attr), Tree2Element(node2.child)));
}
function GenIcon(data) {
  return (props) => /* @__PURE__ */ React$5.createElement(IconBase2, _extends$1({
    attr: _objectSpread$b({}, data.attr)
  }, props), Tree2Element(data.child));
}
function IconBase2(props) {
  var elem = (conf) => {
    var {
      attr,
      size: size2,
      title
    } = props, svgProps = _objectWithoutProperties(props, _excluded$6);
    var computedSize = size2 || conf.size || "1em";
    var className;
    if (conf.className)
      className = conf.className;
    if (props.className)
      className = (className ? className + " " : "") + props.className;
    return /* @__PURE__ */ React$5.createElement("svg", _extends$1({
      stroke: "currentColor",
      fill: "currentColor",
      strokeWidth: "0"
    }, conf.attr, attr, svgProps, {
      className,
      style: _objectSpread$b(_objectSpread$b({
        color: props.color || conf.color
      }, conf.style), props.style),
      height: computedSize,
      width: computedSize,
      xmlns: "http://www.w3.org/2000/svg"
    }), title && /* @__PURE__ */ React$5.createElement("title", null, title), props.children);
  };
  return IconContext !== void 0 ? /* @__PURE__ */ React$5.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
}
function AiOutlineAppstoreAdd(props) {
  return GenIcon({ "attr": { "t": "1569683928793", "viewBox": "0 0 1024 1024", "version": "1.1" }, "child": [{ "tag": "defs", "attr": {}, "child": [] }, { "tag": "path", "attr": { "d": "M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16z m-52 268H212V212h200v200zM864 144H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16z m-52 268H612V212h200v200zM864 544H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16z m-52 268H612V612h200v200zM424 712H296V584c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v128H104c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h128v128c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V776h128c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z" }, "child": [] }] })(props);
}
function AiOutlineAppstore(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zM464 544H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H212V612h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200z" }, "child": [] }] })(props);
}
function AiOutlineArrowRight(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 0 0 0-48.4z" }, "child": [] }] })(props);
}
function AiOutlineBarChart(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-600-80h56c4.4 0 8-3.6 8-8V560c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v144c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V384c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v320c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V462c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v242c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V304c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v400c0 4.4 3.6 8 8 8z" }, "child": [] }] })(props);
}
function AiOutlineBlock(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M856 376H648V168c0-8.8-7.2-16-16-16H168c-8.8 0-16 7.2-16 16v464c0 8.8 7.2 16 16 16h208v208c0 8.8 7.2 16 16 16h464c8.8 0 16-7.2 16-16V392c0-8.8-7.2-16-16-16zm-480 16v188H220V220h360v156H392c-8.8 0-16 7.2-16 16zm204 52v136H444V444h136zm224 360H444V648h188c8.8 0 16-7.2 16-16V444h156v360z" }, "child": [] }] })(props);
}
function AiOutlineBranches(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M740 161c-61.8 0-112 50.2-112 112 0 50.1 33.1 92.6 78.5 106.9v95.9L320 602.4V318.1c44.2-15 76-56.9 76-106.1 0-61.8-50.2-112-112-112s-112 50.2-112 112c0 49.2 31.8 91 76 106.1V706c-44.2 15-76 56.9-76 106.1 0 61.8 50.2 112 112 112s112-50.2 112-112c0-49.2-31.8-91-76-106.1v-27.8l423.5-138.7a50.52 50.52 0 0 0 34.9-48.2V378.2c42.9-15.8 73.6-57 73.6-105.2 0-61.8-50.2-112-112-112zm-504 51a48.01 48.01 0 0 1 96 0 48.01 48.01 0 0 1-96 0zm96 600a48.01 48.01 0 0 1-96 0 48.01 48.01 0 0 1 96 0zm408-491a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z" }, "child": [] }] })(props);
}
function AiOutlineBug(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M304 280h56c4.4 0 8-3.6 8-8 0-28.3 5.9-53.2 17.1-73.5 10.6-19.4 26-34.8 45.4-45.4C450.9 142 475.7 136 504 136h16c28.3 0 53.2 5.9 73.5 17.1 19.4 10.6 34.8 26 45.4 45.4C650 218.9 656 243.7 656 272c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-40-8.8-76.7-25.9-108.1-17.2-31.5-42.5-56.8-74-74C596.7 72.8 560 64 520 64h-16c-40 0-76.7 8.8-108.1 25.9-31.5 17.2-56.8 42.5-74 74C304.8 195.3 296 232 296 272c0 4.4 3.6 8 8 8z" }, "child": [] }, { "tag": "path", "attr": { "d": "M940 512H792V412c76.8 0 139-62.2 139-139 0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 34.8-28.2 63-63 63H232c-34.8 0-63-28.2-63-63 0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 76.8 62.2 139 139 139v100H84c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h148v96c0 6.5.2 13 .7 19.3C164.1 728.6 116 796.7 116 876c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-44.2 23.9-82.9 59.6-103.7 6 17.2 13.6 33.6 22.7 49 24.3 41.5 59 76.2 100.5 100.5S460.5 960 512 960s99.8-13.9 141.3-38.2c41.5-24.3 76.2-59 100.5-100.5 9.1-15.5 16.7-31.9 22.7-49C812.1 793.1 836 831.8 836 876c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-79.3-48.1-147.4-116.7-176.7.4-6.4.7-12.8.7-19.3v-96h148c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM716 680c0 36.8-9.7 72-27.8 102.9-17.7 30.3-43 55.6-73.3 73.3C584 874.3 548.8 884 512 884s-72-9.7-102.9-27.8c-30.3-17.7-55.6-43-73.3-73.3C317.7 752 308 716.8 308 680V412h408v268z" }, "child": [] }] })(props);
}
function AiOutlineCheckCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0 0 51.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z" }, "child": [] }, { "tag": "path", "attr": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" }, "child": [] }] })(props);
}
function AiOutlineCheck(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z" }, "child": [] }] })(props);
}
function AiOutlineCloseCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024", "fill": "currentColor", "fillRule": "evenodd" }, "child": [{ "tag": "path", "attr": { "d": "M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64Zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372Zm128.013 198.826c.023.007.042.018.083.059l45.02 45.019c.04.04.05.06.058.083a.118.118 0 0 1 0 .07c-.007.022-.018.041-.059.082L557.254 512l127.861 127.862a.268.268 0 0 1 .05.06l.009.023a.118.118 0 0 1 0 .07c-.007.022-.018.041-.059.082l-45.019 45.02c-.04.04-.06.05-.083.058a.118.118 0 0 1-.07 0c-.022-.007-.041-.018-.082-.059L512 557.254 384.14 685.115c-.042.041-.06.052-.084.059a.118.118 0 0 1-.07 0c-.022-.007-.041-.018-.082-.059l-45.02-45.019c-.04-.04-.05-.06-.058-.083a.118.118 0 0 1 0-.07c.007-.022.018-.041.059-.082L466.745 512l-127.86-127.86a.268.268 0 0 1-.05-.061l-.009-.023a.118.118 0 0 1 0-.07c.007-.022.018-.041.059-.082l45.019-45.02c.04-.04.06-.05.083-.058a.118.118 0 0 1 .07 0c.022.007.041.018.082.059L512 466.745l127.862-127.86c.04-.041.06-.052.083-.059a.118.118 0 0 1 .07 0Z" }, "child": [] }] })(props);
}
function AiOutlineClose(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024", "fill": "currentColor", "fillRule": "evenodd" }, "child": [{ "tag": "path", "attr": { "d": "M799.855 166.312c.023.007.043.018.084.059l57.69 57.69c.041.041.052.06.059.084a.118.118 0 0 1 0 .069c-.007.023-.018.042-.059.083L569.926 512l287.703 287.703c.041.04.052.06.059.083a.118.118 0 0 1 0 .07c-.007.022-.018.042-.059.083l-57.69 57.69c-.041.041-.06.052-.084.059a.118.118 0 0 1-.069 0c-.023-.007-.042-.018-.083-.059L512 569.926 224.297 857.629c-.04.041-.06.052-.083.059a.118.118 0 0 1-.07 0c-.022-.007-.042-.018-.083-.059l-57.69-57.69c-.041-.041-.052-.06-.059-.084a.118.118 0 0 1 0-.069c.007-.023.018-.042.059-.083L454.073 512 166.371 224.297c-.041-.04-.052-.06-.059-.083a.118.118 0 0 1 0-.07c.007-.022.018-.042.059-.083l57.69-57.69c.041-.041.06-.052.084-.059a.118.118 0 0 1 .069 0c.023.007.042.018.083.059L512 454.073l287.703-287.702c.04-.041.06-.052.083-.059a.118.118 0 0 1 .07 0Z" }, "child": [] }] })(props);
}
function AiOutlineCode(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 0 0 308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 0 0-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z" }, "child": [] }] })(props);
}
function AiOutlineControl(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656zM340 683v77c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-77c-10.1 3.3-20.8 5-32 5s-21.9-1.8-32-5zm64-198V264c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v221c10.1-3.3 20.8-5 32-5s21.9 1.8 32 5zm-64 198c10.1 3.3 20.8 5 32 5s21.9-1.8 32-5c41.8-13.5 72-52.7 72-99s-30.2-85.5-72-99c-10.1-3.3-20.8-5-32-5s-21.9 1.8-32 5c-41.8 13.5-72 52.7-72 99s30.2 85.5 72 99zm.1-115.7c.3-.6.7-1.2 1-1.8v-.1l1.2-1.8c.1-.2.2-.3.3-.5.3-.5.7-.9 1-1.4.1-.1.2-.3.3-.4.5-.6.9-1.1 1.4-1.6l.3-.3 1.2-1.2.4-.4c.5-.5 1-.9 1.6-1.4.6-.5 1.1-.9 1.7-1.3.2-.1.3-.2.5-.3.5-.3.9-.7 1.4-1 .1-.1.3-.2.4-.3.6-.4 1.2-.7 1.9-1.1.1-.1.3-.1.4-.2.5-.3 1-.5 1.6-.8l.6-.3c.7-.3 1.3-.6 2-.8.7-.3 1.4-.5 2.1-.7.2-.1.4-.1.6-.2.6-.2 1.1-.3 1.7-.4.2 0 .3-.1.5-.1.7-.2 1.5-.3 2.2-.4.2 0 .3 0 .5-.1.6-.1 1.2-.1 1.8-.2h.6c.8 0 1.5-.1 2.3-.1s1.5 0 2.3.1h.6c.6 0 1.2.1 1.8.2.2 0 .3 0 .5.1.7.1 1.5.2 2.2.4.2 0 .3.1.5.1.6.1 1.2.3 1.7.4.2.1.4.1.6.2.7.2 1.4.4 2.1.7.7.2 1.3.5 2 .8l.6.3c.5.2 1.1.5 1.6.8.1.1.3.1.4.2.6.3 1.3.7 1.9 1.1.1.1.3.2.4.3.5.3 1 .6 1.4 1 .2.1.3.2.5.3.6.4 1.2.9 1.7 1.3s1.1.9 1.6 1.4l.4.4 1.2 1.2.3.3c.5.5 1 1.1 1.4 1.6.1.1.2.3.3.4.4.4.7.9 1 1.4.1.2.2.3.3.5l1.2 1.8s0 .1.1.1a36.18 36.18 0 0 1 5.1 18.5c0 6-1.5 11.7-4.1 16.7-.3.6-.7 1.2-1 1.8 0 0 0 .1-.1.1l-1.2 1.8c-.1.2-.2.3-.3.5-.3.5-.7.9-1 1.4-.1.1-.2.3-.3.4-.5.6-.9 1.1-1.4 1.6l-.3.3-1.2 1.2-.4.4c-.5.5-1 .9-1.6 1.4-.6.5-1.1.9-1.7 1.3-.2.1-.3.2-.5.3-.5.3-.9.7-1.4 1-.1.1-.3.2-.4.3-.6.4-1.2.7-1.9 1.1-.1.1-.3.1-.4.2-.5.3-1 .5-1.6.8l-.6.3c-.7.3-1.3.6-2 .8-.7.3-1.4.5-2.1.7-.2.1-.4.1-.6.2-.6.2-1.1.3-1.7.4-.2 0-.3.1-.5.1-.7.2-1.5.3-2.2.4-.2 0-.3 0-.5.1-.6.1-1.2.1-1.8.2h-.6c-.8 0-1.5.1-2.3.1s-1.5 0-2.3-.1h-.6c-.6 0-1.2-.1-1.8-.2-.2 0-.3 0-.5-.1-.7-.1-1.5-.2-2.2-.4-.2 0-.3-.1-.5-.1-.6-.1-1.2-.3-1.7-.4-.2-.1-.4-.1-.6-.2-.7-.2-1.4-.4-2.1-.7-.7-.2-1.3-.5-2-.8l-.6-.3c-.5-.2-1.1-.5-1.6-.8-.1-.1-.3-.1-.4-.2-.6-.3-1.3-.7-1.9-1.1-.1-.1-.3-.2-.4-.3-.5-.3-1-.6-1.4-1-.2-.1-.3-.2-.5-.3-.6-.4-1.2-.9-1.7-1.3s-1.1-.9-1.6-1.4l-.4-.4-1.2-1.2-.3-.3c-.5-.5-1-1.1-1.4-1.6-.1-.1-.2-.3-.3-.4-.4-.4-.7-.9-1-1.4-.1-.2-.2-.3-.3-.5l-1.2-1.8v-.1c-.4-.6-.7-1.2-1-1.8-2.6-5-4.1-10.7-4.1-16.7s1.5-11.7 4.1-16.7zM620 539v221c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V539c-10.1 3.3-20.8 5-32 5s-21.9-1.8-32-5zm64-198v-77c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v77c10.1-3.3 20.8-5 32-5s21.9 1.8 32 5zm-64 198c10.1 3.3 20.8 5 32 5s21.9-1.8 32-5c41.8-13.5 72-52.7 72-99s-30.2-85.5-72-99c-10.1-3.3-20.8-5-32-5s-21.9 1.8-32 5c-41.8 13.5-72 52.7-72 99s30.2 85.5 72 99zm.1-115.7c.3-.6.7-1.2 1-1.8v-.1l1.2-1.8c.1-.2.2-.3.3-.5.3-.5.7-.9 1-1.4.1-.1.2-.3.3-.4.5-.6.9-1.1 1.4-1.6l.3-.3 1.2-1.2.4-.4c.5-.5 1-.9 1.6-1.4.6-.5 1.1-.9 1.7-1.3.2-.1.3-.2.5-.3.5-.3.9-.7 1.4-1 .1-.1.3-.2.4-.3.6-.4 1.2-.7 1.9-1.1.1-.1.3-.1.4-.2.5-.3 1-.5 1.6-.8l.6-.3c.7-.3 1.3-.6 2-.8.7-.3 1.4-.5 2.1-.7.2-.1.4-.1.6-.2.6-.2 1.1-.3 1.7-.4.2 0 .3-.1.5-.1.7-.2 1.5-.3 2.2-.4.2 0 .3 0 .5-.1.6-.1 1.2-.1 1.8-.2h.6c.8 0 1.5-.1 2.3-.1s1.5 0 2.3.1h.6c.6 0 1.2.1 1.8.2.2 0 .3 0 .5.1.7.1 1.5.2 2.2.4.2 0 .3.1.5.1.6.1 1.2.3 1.7.4.2.1.4.1.6.2.7.2 1.4.4 2.1.7.7.2 1.3.5 2 .8l.6.3c.5.2 1.1.5 1.6.8.1.1.3.1.4.2.6.3 1.3.7 1.9 1.1.1.1.3.2.4.3.5.3 1 .6 1.4 1 .2.1.3.2.5.3.6.4 1.2.9 1.7 1.3s1.1.9 1.6 1.4l.4.4 1.2 1.2.3.3c.5.5 1 1.1 1.4 1.6.1.1.2.3.3.4.4.4.7.9 1 1.4.1.2.2.3.3.5l1.2 1.8v.1a36.18 36.18 0 0 1 5.1 18.5c0 6-1.5 11.7-4.1 16.7-.3.6-.7 1.2-1 1.8v.1l-1.2 1.8c-.1.2-.2.3-.3.5-.3.5-.7.9-1 1.4-.1.1-.2.3-.3.4-.5.6-.9 1.1-1.4 1.6l-.3.3-1.2 1.2-.4.4c-.5.5-1 .9-1.6 1.4-.6.5-1.1.9-1.7 1.3-.2.1-.3.2-.5.3-.5.3-.9.7-1.4 1-.1.1-.3.2-.4.3-.6.4-1.2.7-1.9 1.1-.1.1-.3.1-.4.2-.5.3-1 .5-1.6.8l-.6.3c-.7.3-1.3.6-2 .8-.7.3-1.4.5-2.1.7-.2.1-.4.1-.6.2-.6.2-1.1.3-1.7.4-.2 0-.3.1-.5.1-.7.2-1.5.3-2.2.4-.2 0-.3 0-.5.1-.6.1-1.2.1-1.8.2h-.6c-.8 0-1.5.1-2.3.1s-1.5 0-2.3-.1h-.6c-.6 0-1.2-.1-1.8-.2-.2 0-.3 0-.5-.1-.7-.1-1.5-.2-2.2-.4-.2 0-.3-.1-.5-.1-.6-.1-1.2-.3-1.7-.4-.2-.1-.4-.1-.6-.2-.7-.2-1.4-.4-2.1-.7-.7-.2-1.3-.5-2-.8l-.6-.3c-.5-.2-1.1-.5-1.6-.8-.1-.1-.3-.1-.4-.2-.6-.3-1.3-.7-1.9-1.1-.1-.1-.3-.2-.4-.3-.5-.3-1-.6-1.4-1-.2-.1-.3-.2-.5-.3-.6-.4-1.2-.9-1.7-1.3s-1.1-.9-1.6-1.4l-.4-.4-1.2-1.2-.3-.3c-.5-.5-1-1.1-1.4-1.6-.1-.1-.2-.3-.3-.4-.4-.4-.7-.9-1-1.4-.1-.2-.2-.3-.3-.5l-1.2-1.8v-.1c-.4-.6-.7-1.2-1-1.8-2.6-5-4.1-10.7-4.1-16.7s1.5-11.7 4.1-16.7z" }, "child": [] }] })(props);
}
function AiOutlineCopy(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z" }, "child": [] }] })(props);
}
function AiOutlineDashboard(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M924.8 385.6a446.7 446.7 0 0 0-96-142.4 446.7 446.7 0 0 0-142.4-96C631.1 123.8 572.5 112 512 112s-119.1 11.8-174.4 35.2a446.7 446.7 0 0 0-142.4 96 446.7 446.7 0 0 0-96 142.4C75.8 440.9 64 499.5 64 560c0 132.7 58.3 257.7 159.9 343.1l1.7 1.4c5.8 4.8 13.1 7.5 20.6 7.5h531.7c7.5 0 14.8-2.7 20.6-7.5l1.7-1.4C901.7 817.7 960 692.7 960 560c0-60.5-11.9-119.1-35.2-174.4zM761.4 836H262.6A371.12 371.12 0 0 1 140 560c0-99.4 38.7-192.8 109-263 70.3-70.3 163.7-109 263-109 99.4 0 192.8 38.7 263 109 70.3 70.3 109 163.7 109 263 0 105.6-44.5 205.5-122.6 276zM623.5 421.5a8.03 8.03 0 0 0-11.3 0L527.7 506c-18.7-5-39.4-.2-54.1 14.5a55.95 55.95 0 0 0 0 79.2 55.95 55.95 0 0 0 79.2 0 55.87 55.87 0 0 0 14.5-54.1l84.5-84.5c3.1-3.1 3.1-8.2 0-11.3l-28.3-28.3zM490 320h44c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8h-44c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8zm260 218v44c0 4.4 3.6 8 8 8h80c4.4 0 8-3.6 8-8v-44c0-4.4-3.6-8-8-8h-80c-4.4 0-8 3.6-8 8zm12.7-197.2l-31.1-31.1a8.03 8.03 0 0 0-11.3 0l-56.6 56.6a8.03 8.03 0 0 0 0 11.3l31.1 31.1c3.1 3.1 8.2 3.1 11.3 0l56.6-56.6c3.1-3.1 3.1-8.2 0-11.3zm-458.6-31.1a8.03 8.03 0 0 0-11.3 0l-31.1 31.1a8.03 8.03 0 0 0 0 11.3l56.6 56.6c3.1 3.1 8.2 3.1 11.3 0l31.1-31.1c3.1-3.1 3.1-8.2 0-11.3l-56.6-56.6zM262 530h-80c-4.4 0-8 3.6-8 8v44c0 4.4 3.6 8 8 8h80c4.4 0 8-3.6 8-8v-44c0-4.4-3.6-8-8-8z" }, "child": [] }] })(props);
}
function AiOutlineDatabase(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM304 240a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm0 272a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm0 272a40 40 0 1 0 80 0 40 40 0 1 0-80 0z" }, "child": [] }] })(props);
}
function AiOutlineDelete(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z" }, "child": [] }] })(props);
}
function AiOutlineDisconnect(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M832.6 191.4c-84.6-84.6-221.5-84.6-306 0l-96.9 96.9 51 51 96.9-96.9c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204l-96.9 96.9 51.1 51.1 96.9-96.9c84.4-84.6 84.4-221.5-.1-306.1zM446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l96.9-96.9-51.1-51.1-96.9 96.9c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l96.9-96.9-51-51-96.8 97zM260.3 209.4a8.03 8.03 0 0 0-11.3 0L209.4 249a8.03 8.03 0 0 0 0 11.3l554.4 554.4c3.1 3.1 8.2 3.1 11.3 0l39.6-39.6c3.1-3.1 3.1-8.2 0-11.3L260.3 209.4z" }, "child": [] }] })(props);
}
function AiOutlineDoubleRight(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M533.2 492.3L277.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H188c-6.7 0-10.4 7.7-6.3 12.9L447.1 512 181.7 851.1A7.98 7.98 0 0 0 188 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5zm304 0L581.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H492c-6.7 0-10.4 7.7-6.3 12.9L751.1 512 485.7 851.1A7.98 7.98 0 0 0 492 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5z" }, "child": [] }] })(props);
}
function AiOutlineDown(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" }, "child": [] }] })(props);
}
function AiOutlineDownload(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z" }, "child": [] }] })(props);
}
function AiOutlineDrag(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M909.3 506.3L781.7 405.6a7.23 7.23 0 0 0-11.7 5.7V476H548V254h64.8c6 0 9.4-7 5.7-11.7L517.7 114.7a7.14 7.14 0 0 0-11.3 0L405.6 242.3a7.23 7.23 0 0 0 5.7 11.7H476v222H254v-64.8c0-6-7-9.4-11.7-5.7L114.7 506.3a7.14 7.14 0 0 0 0 11.3l127.5 100.8c4.7 3.7 11.7.4 11.7-5.7V548h222v222h-64.8c-6 0-9.4 7-5.7 11.7l100.8 127.5c2.9 3.7 8.5 3.7 11.3 0l100.8-127.5c3.7-4.7.4-11.7-5.7-11.7H548V548h222v64.8c0 6 7 9.4 11.7 5.7l127.5-100.8a7.3 7.3 0 0 0 .1-11.4z" }, "child": [] }] })(props);
}
function AiOutlineEdit(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 0 0 0-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 0 0 9.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z" }, "child": [] }] })(props);
}
function AiOutlineEllipsis(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M176 511a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm280 0a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm280 0a56 56 0 1 0 112 0 56 56 0 1 0-112 0z" }, "child": [] }] })(props);
}
function AiOutlineEnter(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 0 0 0 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8z" }, "child": [] }] })(props);
}
function AiOutlineExperiment(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M512 472a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm367 352.9L696.3 352V178H768v-68H256v68h71.7v174L145 824.9c-2.8 7.4-4.3 15.2-4.3 23.1 0 35.3 28.7 64 64 64h614.6c7.9 0 15.7-1.5 23.1-4.3 33-12.7 49.4-49.8 36.6-82.8zM395.7 364.7V180h232.6v184.7L719.2 600c-20.7-5.3-42.1-8-63.9-8-61.2 0-119.2 21.5-165.3 60a188.78 188.78 0 0 1-121.3 43.9c-32.7 0-64.1-8.3-91.8-23.7l118.8-307.5zM210.5 844l41.7-107.8c35.7 18.1 75.4 27.8 116.6 27.8 61.2 0 119.2-21.5 165.3-60 33.9-28.2 76.3-43.9 121.3-43.9 35 0 68.4 9.5 97.6 27.1L813.5 844h-603z" }, "child": [] }] })(props);
}
function AiOutlineExport(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024", "fill": "currentColor", "fillRule": "evenodd" }, "child": [{ "tag": "path", "attr": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h360c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H184V184h656v320c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V144c0-17.7-14.3-32-32-32ZM770.87 824.869l-52.2 52.2c-4.7 4.7-1.9 12.8 4.7 13.6l179.4 21c5.1.6 9.5-3.7 8.9-8.9l-21-179.4c-.8-6.6-8.9-9.4-13.6-4.7l-52.4 52.4-256.2-256.2c-3.1-3.1-8.2-3.1-11.3 0l-42.4 42.4c-3.1 3.1-3.1 8.2 0 11.3l256.1 256.3Z", "transform": "matrix(1 0 0 -1 0 1024)" }, "child": [] }] })(props);
}
function AiOutlineEyeInvisible(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 0 0 0-51.5zm-63.57-320.64L836 122.88a8 8 0 0 0-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 0 0 0 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 0 0 0 11.31L155.17 889a8 8 0 0 0 11.31 0l712.15-712.12a8 8 0 0 0 0-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 0 0-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 0 1 146.2-106.69L401.31 546.2A112 112 0 0 1 396 512z" }, "child": [] }, { "tag": "path", "attr": { "d": "M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 0 0 227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 0 1-112 112z" }, "child": [] }] })(props);
}
function AiOutlineEye(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 0 0 0 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z" }, "child": [] }] })(props);
}
function AiOutlineFieldNumber(props) {
  return GenIcon({ "attr": { "t": "1569683604581", "viewBox": "0 0 1024 1024", "version": "1.1" }, "child": [{ "tag": "defs", "attr": {}, "child": [] }, { "tag": "path", "attr": { "d": "M508 280h-63.3c-3.3 0-6 2.7-6 6v340.2H433L197.4 282.6c-1.1-1.6-3-2.6-4.9-2.6H126c-3.3 0-6 2.7-6 6v464c0 3.3 2.7 6 6 6h62.7c3.3 0 6-2.7 6-6V405.1h5.7l238.2 348.3c1.1 1.6 3 2.6 5 2.6H508c3.3 0 6-2.7 6-6V286c0-3.3-2.7-6-6-6zM886 693H582c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM733.8 630c52.9 0 95.2-17.2 126.2-51.7 29.4-32.9 44-75.8 44-128.8 0-53.1-14.6-96.5-44-129.3-30.9-34.8-73.2-52.2-126.2-52.2-53.7 0-95.9 17.5-126.3 52.8-29.2 33.1-43.4 75.9-43.4 128.7 0 52.4 14.3 95.2 43.5 128.3 30.6 34.7 73 52.2 126.2 52.2z m-71.5-263.7c16.9-20.6 40.3-30.9 71.4-30.9 31.5 0 54.8 9.6 71 29.1 16.4 20.3 24.9 48.6 24.9 84.9 0 36.3-8.4 64.1-24.8 83.9-16.5 19.4-40 29.2-71.1 29.2-31.2 0-55-10.3-71.4-30.4-16.3-20.1-24.5-47.3-24.5-82.6 0.1-35.8 8.2-63 24.5-83.2z" }, "child": [] }] })(props);
}
function AiOutlineFieldString(props) {
  return GenIcon({ "attr": { "t": "1569683607277", "viewBox": "0 0 1024 1024", "version": "1.1" }, "child": [{ "tag": "defs", "attr": {}, "child": [] }, { "tag": "path", "attr": { "d": "M875.6 515.9c2.1 0.8 4.4-0.3 5.2-2.4 0.2-0.4 0.2-0.9 0.2-1.4v-58.3c0-1.8-1.1-3.3-2.8-3.8-6-1.8-17.2-3-27.2-3-32.9 0-61.7 16.7-73.5 41.2v-28.6c0-4.4-3.6-8-8-8H717c-4.4 0-8 3.6-8 8V729c0 4.4 3.6 8 8 8h54.8c4.4 0 8-3.6 8-8V572.7c0-36.2 26.1-60.2 65.1-60.2 10.4 0.1 26.6 1.8 30.7 3.4zM338.6 475.4l-54.7-12.6c-61.2-14.2-87.7-34.8-87.7-70.7 0-44.6 39.1-73.5 96.9-73.5 52.8 0 91.4 26.5 99.9 68.9h70C455.9 311.6 387.6 259 293.4 259c-103.3 0-171 55.5-171 139 0 68.6 38.6 109.5 122.2 128.5l61.6 14.3c63.6 14.9 91.6 37.1 91.6 75.1 0 44.1-43.5 75.2-102.5 75.2-60.6 0-104.5-27.2-112.8-70.5H111c7.2 79.9 75.6 130.4 179.1 130.4C402.3 751 471 695.2 471 605.3c0-70.2-38.6-108.5-132.4-129.9z" }, "child": [] }, { "tag": "path", "attr": { "d": "M877 729m-36 0a36 36 0 1 0 72 0 36 36 0 1 0-72 0Z" }, "child": [] }, { "tag": "path", "attr": { "d": "M653 457.8h-51.4V396c0-4.4-3.6-8-8-8h-54.7c-4.4 0-8 3.6-8 8v61.8H495c-4.4 0-8 3.6-8 8v42.3c0 4.4 3.6 8 8 8h35.9v147.5c0 56.2 27.4 79.4 93.1 79.4 11.7 0 23.6-1.2 33.8-3.1 1.9-0.3 3.2-2 3.2-3.9v-49.3c0-2.2-1.8-4-4-4h-0.4c-4.9 0.5-6.2 0.6-8.3 0.8-4.1 0.3-7.8 0.5-12.6 0.5-24.1 0-34.1-10.3-34.1-35.6V516.1H653c4.4 0 8-3.6 8-8v-42.3c0-4.4-3.6-8-8-8z" }, "child": [] }] })(props);
}
function AiOutlineFieldTime(props) {
  return GenIcon({ "attr": { "t": "1569683618210", "viewBox": "0 0 1024 1024", "version": "1.1" }, "child": [{ "tag": "defs", "attr": {}, "child": [] }, { "tag": "path", "attr": { "d": "M945 412H689c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h256c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM811 548H689c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h122c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM477.3 322.5H434c-6.2 0-11.2 5-11.2 11.2v248c0 3.6 1.7 6.9 4.6 9l148.9 108.6c5 3.6 12 2.6 15.6-2.4l25.7-35.1v-0.1c3.6-5 2.5-12-2.5-15.6l-126.7-91.6V333.7c0.1-6.2-5-11.2-11.1-11.2z" }, "child": [] }, { "tag": "path", "attr": { "d": "M804.8 673.9H747c-5.6 0-10.9 2.9-13.9 7.7-12.7 20.1-27.5 38.7-44.5 55.7-29.3 29.3-63.4 52.3-101.3 68.3-39.3 16.6-81 25-124 25-43.1 0-84.8-8.4-124-25-37.9-16-72-39-101.3-68.3s-52.3-63.4-68.3-101.3c-16.6-39.2-25-80.9-25-124 0-43.1 8.4-84.7 25-124 16-37.9 39-72 68.3-101.3 29.3-29.3 63.4-52.3 101.3-68.3 39.2-16.6 81-25 124-25 43.1 0 84.8 8.4 124 25 37.9 16 72 39 101.3 68.3 17 17 31.8 35.6 44.5 55.7 3 4.8 8.3 7.7 13.9 7.7h57.8c6.9 0 11.3-7.2 8.2-13.3-65.2-129.7-197.4-214-345-215.7-216.1-2.7-395.6 174.2-396 390.1C71.6 727.5 246.9 903 463.2 903c149.5 0 283.9-84.6 349.8-215.8 3.1-6.1-1.4-13.3-8.2-13.3z" }, "child": [] }] })(props);
}
function AiOutlineFileSync(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M296 256c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm192 200v-48c0-4.4-3.6-8-8-8H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8zm-48 396H208V148h560v344c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h272c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm104.1-115.6c1.8-34.5 16.2-66.8 40.8-91.4 26.2-26.2 62-41 99.1-41 37.4 0 72.6 14.6 99.1 41 3.2 3.2 6.3 6.6 9.2 10.1L769.2 673a8 8 0 0 0 3 14.1l93.3 22.5c5 1.2 9.8-2.6 9.9-7.7l.6-95.4a8 8 0 0 0-12.9-6.4l-20.3 15.8C805.4 569.6 748.1 540 684 540c-109.9 0-199.6 86.9-204 195.7-.2 4.5 3.5 8.3 8 8.3h48.1c4.3 0 7.8-3.3 8-7.6zM880 744h-48.1c-4.3 0-7.8 3.3-8 7.6-1.8 34.5-16.2 66.8-40.8 91.4-26.2 26.2-62 41-99.1 41-37.4 0-72.6-14.6-99.1-41-3.2-3.2-6.3-6.6-9.2-10.1l23.1-17.9a8 8 0 0 0-3-14.1l-93.3-22.5c-5-1.2-9.8 2.6-9.9 7.7l-.6 95.4a8 8 0 0 0 12.9 6.4l20.3-15.8C562.6 918.4 619.9 948 684 948c109.9 0 199.6-86.9 204-195.7.2-4.5-3.5-8.3-8-8.3z" }, "child": [] }] })(props);
}
function AiOutlineFileText(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z" }, "child": [] }] })(props);
}
function AiOutlineFileUnknown(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M854.6 288.7L639.4 73.4c-6-6-14.2-9.4-22.7-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.6-9.4-22.6zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494zM402 549c0 5.4 4.4 9.5 9.8 9.5h32.4c5.4 0 9.8-4.2 9.8-9.4 0-28.2 25.8-51.6 58-51.6s58 23.4 58 51.5c0 25.3-21 47.2-49.3 50.9-19.3 2.8-34.5 20.3-34.7 40.1v32c0 5.5 4.5 10 10 10h32c5.5 0 10-4.5 10-10v-12.2c0-6 4-11.5 9.7-13.3 44.6-14.4 75-54 74.3-98.9-.8-55.5-49.2-100.8-108.5-101.6-61.4-.7-111.5 45.6-111.5 103zm78 195a32 32 0 1 0 64 0 32 32 0 1 0-64 0z" }, "child": [] }] })(props);
}
function AiOutlineFileZip(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M296 392h64v64h-64zm0 190v160h128V582h-64v-62h-64v62zm80 48v64h-32v-64h32zm-16-302h64v64h-64zm-64-64h64v64h-64zm64 192h64v64h-64zm0-256h64v64h-64zm494.6 88.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h64v64h64v-64h174v216a42 42 0 0 0 42 42h216v494z" }, "child": [] }] })(props);
}
function AiOutlineFolderAdd(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M484 443.1V528h-84.5c-4.1 0-7.5 3.1-7.5 7v42c0 3.8 3.4 7 7.5 7H484v84.9c0 3.9 3.2 7.1 7 7.1h42c3.9 0 7-3.2 7-7.1V584h84.5c4.1 0 7.5-3.2 7.5-7v-42c0-3.9-3.4-7-7.5-7H540v-84.9c0-3.9-3.1-7.1-7-7.1h-42c-3.8 0-7 3.2-7 7.1zm396-144.7H521L403.7 186.2a8.15 8.15 0 0 0-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z" }, "child": [] }] })(props);
}
function AiOutlineFolderOpen(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 0 0-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z" }, "child": [] }] })(props);
}
function AiOutlineFolder(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M880 298.4H521L403.7 186.2a8.15 8.15 0 0 0-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z" }, "child": [] }] })(props);
}
function AiOutlineForm(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M904 512h-56c-4.4 0-8 3.6-8 8v320H184V184h320c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V520c0-4.4-3.6-8-8-8z" }, "child": [] }, { "tag": "path", "attr": { "d": "M355.9 534.9L354 653.8c-.1 8.9 7.1 16.2 16 16.2h.4l118-2.9c2-.1 4-.9 5.4-2.3l415.9-415c3.1-3.1 3.1-8.2 0-11.3L785.4 114.3c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-415.8 415a8.3 8.3 0 0 0-2.3 5.6zm63.5 23.6L779.7 199l45.2 45.1-360.5 359.7-45.7 1.1.7-46.4z" }, "child": [] }] })(props);
}
function AiOutlineHdd(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM496 208H312c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 544h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H312c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm328 244a40 40 0 1 0 80 0 40 40 0 1 0-80 0z" }, "child": [] }] })(props);
}
function AiOutlineHistory(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M536.1 273H488c-4.4 0-8 3.6-8 8v275.3c0 2.6 1.2 5 3.3 6.5l165.3 120.7c3.6 2.6 8.6 1.9 11.2-1.7l28.6-39c2.7-3.7 1.9-8.7-1.7-11.2L544.1 528.5V281c0-4.4-3.6-8-8-8zm219.8 75.2l156.8 38.3c5 1.2 9.9-2.6 9.9-7.7l.8-161.5c0-6.7-7.7-10.5-12.9-6.3L752.9 334.1a8 8 0 0 0 3 14.1zm167.7 301.1l-56.7-19.5a8 8 0 0 0-10.1 4.8c-1.9 5.1-3.9 10.1-6 15.1-17.8 42.1-43.3 80-75.9 112.5a353 353 0 0 1-112.5 75.9 352.18 352.18 0 0 1-137.7 27.8c-47.8 0-94.1-9.3-137.7-27.8a353 353 0 0 1-112.5-75.9c-32.5-32.5-58-70.4-75.9-112.5A353.44 353.44 0 0 1 171 512c0-47.8 9.3-94.2 27.8-137.8 17.8-42.1 43.3-80 75.9-112.5a353 353 0 0 1 112.5-75.9C430.6 167.3 477 158 524.8 158s94.1 9.3 137.7 27.8A353 353 0 0 1 775 261.7c10.2 10.3 19.8 21 28.6 32.3l59.8-46.8C784.7 146.6 662.2 81.9 524.6 82 285 82.1 92.6 276.7 95 516.4 97.4 751.9 288.9 942 524.8 942c185.5 0 343.5-117.6 403.7-282.3 1.5-4.2-.7-8.9-4.9-10.4z" }, "child": [] }] })(props);
}
function AiOutlineImport(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024", "fill": "currentColor", "fillRule": "evenodd" }, "child": [{ "tag": "path", "attr": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h360c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H184V184h656v320c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V144c0-17.7-14.3-32-32-32ZM653.3 599.4l52.2-52.2c4.7-4.7 1.9-12.8-4.7-13.6l-179.4-21c-5.1-.6-9.5 3.7-8.9 8.9l21 179.4c.8 6.6 8.9 9.4 13.6 4.7l52.4-52.4 256.2 256.2c3.1 3.1 8.2 3.1 11.3 0l42.4-42.4c3.1-3.1 3.1-8.2 0-11.3L653.3 599.4Z", "transform": "matrix(1 0 0 -1 0 1024)" }, "child": [] }] })(props);
}
function AiOutlineInteraction(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656zM304.8 524h50.7c3.7 0 6.8-3 6.8-6.8v-78.9c0-19.7 15.9-35.6 35.5-35.6h205.7v53.4c0 5.7 6.5 8.8 10.9 5.3l109.1-85.7c3.5-2.7 3.5-8 0-10.7l-109.1-85.7c-4.4-3.5-10.9-.3-10.9 5.3V338H397.7c-55.1 0-99.7 44.8-99.7 100.1V517c0 4 3 7 6.8 7zm-4.2 134.9l109.1 85.7c4.4 3.5 10.9.3 10.9-5.3v-53.4h205.7c55.1 0 99.7-44.8 99.7-100.1v-78.9c0-3.7-3-6.8-6.8-6.8h-50.7c-3.7 0-6.8 3-6.8 6.8v78.9c0 19.7-15.9 35.6-35.5 35.6H420.6V568c0-5.7-6.5-8.8-10.9-5.3l-109.1 85.7c-3.5 2.5-3.5 7.8 0 10.5z" }, "child": [] }] })(props);
}
function AiOutlineLike(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M885.9 533.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.4-65.5-111.1a67.67 67.67 0 0 0-34.3-9.3H572.4l6-122.9c1.4-29.7-9.1-57.9-29.5-79.4A106.62 106.62 0 0 0 471 99.9c-52 0-98 35-111.8 85.1l-85.9 311H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h601.3c9.2 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7-.2-12.6-2-25.1-5.6-37.1zM184 852V568h81v284h-81zm636.4-353l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 22.4-13.2 42.6-33.6 51.8H329V564.8l99.5-360.5a44.1 44.1 0 0 1 42.2-32.3c7.6 0 15.1 2.2 21.1 6.7 9.9 7.4 15.2 18.6 14.6 30.5l-9.6 198.4h314.4C829 418.5 840 436.9 840 456c0 16.5-7.2 32.1-19.6 43z" }, "child": [] }] })(props);
}
function AiOutlineMinusCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M696 480H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z" }, "child": [] }, { "tag": "path", "attr": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" }, "child": [] }] })(props);
}
function AiOutlineNumber(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M872 394c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8H708V152c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v166H400V152c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v166H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h168v236H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h168v166c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V706h228v166c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V706h164c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8H708V394h164zM628 630H400V394h228v236z" }, "child": [] }] })(props);
}
function AiOutlinePicture(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2zM304 456a88 88 0 1 0 0-176 88 88 0 0 0 0 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z" }, "child": [] }] })(props);
}
function AiOutlinePlayCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" }, "child": [] }, { "tag": "path", "attr": { "d": "M719.4 499.1l-296.1-215A15.9 15.9 0 0 0 398 297v430c0 13.1 14.8 20.5 25.3 12.9l296.1-215a15.9 15.9 0 0 0 0-25.8zm-257.6 134V390.9L628.5 512 461.8 633.1z" }, "child": [] }] })(props);
}
function AiOutlinePlusCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z" }, "child": [] }, { "tag": "path", "attr": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" }, "child": [] }] })(props);
}
function AiOutlinePlus(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8Z" }, "child": [] }, { "tag": "path", "attr": { "d": "M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8Z" }, "child": [] }] })(props);
}
function AiOutlineProduct(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024", "fill": "currentColor", "fillRule": "evenodd" }, "child": [{ "tag": "path", "attr": { "d": "M320 30.02c8.837 0 16 7.163 16 16v304c0 8.836-7.163 16-16 16H16c-8.837 0-16-7.164-16-16v-304c0-8.837 7.163-16 16-16zm-52 68H68v200h200zm493.333 87.686c6.248 6.248 6.248 16.379 0 22.627l-181.02 181.02c-6.248 6.248-16.378 6.248-22.627 0l-181.019-181.02c-6.248-6.248-6.248-16.379 0-22.627l181.02-181.02c6.248-6.248 16.378-6.248 22.627 0zm-84.853 11.313L569 89.54 461.52 197.02 569 304.5zM320 430.02c8.837 0 16 7.164 16 16v304c0 8.837-7.163 16-16 16H16c-8.837 0-16-7.163-16-16v-304c0-8.836 7.163-16 16-16zm-52 68H68v200h200zm452-68c8.837 0 16 7.164 16 16v304c0 8.837-7.163 16-16 16H416c-8.837 0-16-7.163-16-16v-304c0-8.836 7.163-16 16-16zm-52 68H468v200h200z", "transform": "translate(144 113.98)" }, "child": [] }] })(props);
}
function AiOutlineQuestionCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" }, "child": [] }, { "tag": "path", "attr": { "d": "M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0 1 30.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1 0 80 0 40 40 0 1 0-80 0z" }, "child": [] }] })(props);
}
function AiOutlineRadarChart(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M926.8 397.1l-396-288a31.81 31.81 0 0 0-37.6 0l-396 288a31.99 31.99 0 0 0-11.6 35.8l151.3 466a32 32 0 0 0 30.4 22.1h489.5c13.9 0 26.1-8.9 30.4-22.1l151.3-466c4.2-13.2-.5-27.6-11.7-35.8zM838.6 417l-98.5 32-200-144.7V199.9L838.6 417zM466 567.2l-89.1 122.3-55.2-169.2L466 567.2zm-116.3-96.8L484 373.3v140.8l-134.3-43.7zM512 599.2l93.9 128.9H418.1L512 599.2zm28.1-225.9l134.2 97.1L540.1 514V373.3zM558 567.2l144.3-46.9-55.2 169.2L558 567.2zm-74-367.3v104.4L283.9 449l-98.5-32L484 199.9zM169.3 470.8l86.5 28.1 80.4 246.4-53.8 73.9-113.1-348.4zM327.1 853l50.3-69h269.3l50.3 69H327.1zm414.5-33.8l-53.8-73.9 80.4-246.4 86.5-28.1-113.1 348.4z" }, "child": [] }] })(props);
}
function AiOutlineRedo(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M758.2 839.1C851.8 765.9 912 651.9 912 523.9 912 303 733.5 124.3 512.6 124 291.4 123.7 112 302.8 112 523.9c0 125.2 57.5 236.9 147.6 310.2 3.5 2.8 8.6 2.2 11.4-1.3l39.4-50.5c2.7-3.4 2.1-8.3-1.2-11.1-8.1-6.6-15.9-13.7-23.4-21.2a318.64 318.64 0 0 1-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 0 1-68.6 101.7c-9.3 9.3-19.1 18-29.3 26L668.2 724a8 8 0 0 0-14.1 3l-39.6 162.2c-1.2 5 2.6 9.9 7.7 9.9l167 .8c6.7 0 10.5-7.7 6.3-12.9l-37.3-47.9z" }, "child": [] }] })(props);
}
function AiOutlineRightCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M666.7 505.5l-246-178A8 8 0 0 0 408 334v46.9c0 10.2 4.9 19.9 13.2 25.9L566.6 512 421.2 617.2c-8.3 6-13.2 15.6-13.2 25.9V690c0 6.5 7.4 10.3 12.7 6.5l246-178c4.4-3.2 4.4-9.8 0-13z" }, "child": [] }, { "tag": "path", "attr": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" }, "child": [] }] })(props);
}
function AiOutlineSearch(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0 0 11.6 0l43.6-43.5a8.2 8.2 0 0 0 0-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z" }, "child": [] }] })(props);
}
function AiOutlineSetting(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 0 0 9.3-35.2l-.9-2.6a443.74 443.74 0 0 0-79.7-137.9l-1.8-2.1a32.12 32.12 0 0 0-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 0 0-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 0 0-25.8 25.7l-15.8 85.4a351.86 351.86 0 0 0-99 57.4l-81.9-29.1a32 32 0 0 0-35.1 9.5l-1.8 2.1a446.02 446.02 0 0 0-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 0 0-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0 0 35.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0 0 25.8 25.7l2.7.5a449.4 449.4 0 0 0 159 0l2.7-.5a32.05 32.05 0 0 0 25.8-25.7l15.7-85a350 350 0 0 0 99.7-57.6l81.3 28.9a32 32 0 0 0 35.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 0 1-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 0 1-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 0 1 512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 0 1 400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 0 1 624 502c0 29.9-11.7 58-32.8 79.2z" }, "child": [] }] })(props);
}
function AiOutlineSisternode(props) {
  return GenIcon({ "attr": { "t": "1569683586275", "viewBox": "0 0 1024 1024", "version": "1.1" }, "child": [{ "tag": "defs", "attr": {}, "child": [] }, { "tag": "path", "attr": { "d": "M672 432c-120.3 0-219.9 88.5-237.3 204H320c-15.5 0-28-12.5-28-28V244h291c14.2 35.2 48.7 60 89 60 53 0 96-43 96-96s-43-96-96-96c-40.3 0-74.8 24.8-89 60H112v72h108v364c0 55.2 44.8 100 100 100h114.7c17.4 115.5 117 204 237.3 204 132.5 0 240-107.5 240-240S804.5 432 672 432z m128 266c0 4.4-3.6 8-8 8h-86v86c0 4.4-3.6 8-8 8h-52c-4.4 0-8-3.6-8-8v-86h-86c-4.4 0-8-3.6-8-8v-52c0-4.4 3.6-8 8-8h86v-86c0-4.4 3.6-8 8-8h52c4.4 0 8 3.6 8 8v86h86c4.4 0 8 3.6 8 8v52z" }, "child": [] }] })(props);
}
function AiOutlineStar(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 0 0 .6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0 0 46.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3zM664.8 561.6l36.1 210.3L512 672.7 323.1 772l36.1-210.3-152.8-149L417.6 382 512 190.7 606.4 382l211.2 30.7-152.8 148.9z" }, "child": [] }] })(props);
}
function AiOutlineStop(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z" }, "child": [] }] })(props);
}
function AiOutlineSwap(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M847.9 592H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h605.2L612.9 851c-4.1 5.2-.4 13 6.3 13h72.5c4.9 0 9.5-2.2 12.6-6.1l168.8-214.1c16.5-21 1.6-51.8-25.2-51.8zM872 356H266.8l144.3-183c4.1-5.2.4-13-6.3-13h-72.5c-4.9 0-9.5 2.2-12.6 6.1L150.9 380.2c-16.5 21-1.6 51.8 25.1 51.8h696c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z" }, "child": [] }] })(props);
}
function AiOutlineSync(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M168 504.2c1-43.7 10-86.1 26.9-126 17.3-41 42.1-77.7 73.7-109.4S337 212.3 378 195c42.4-17.9 87.4-27 133.9-27s91.5 9.1 133.8 27A341.5 341.5 0 0 1 755 268.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 0 0 3 14.1l175.7 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c0-6.7-7.7-10.5-12.9-6.3l-56.4 44.1C765.8 155.1 646.2 92 511.8 92 282.7 92 96.3 275.6 92 503.8a8 8 0 0 0 8 8.2h60c4.4 0 7.9-3.5 8-7.8zm756 7.8h-60c-4.4 0-7.9 3.5-8 7.8-1 43.7-10 86.1-26.9 126-17.3 41-42.1 77.8-73.7 109.4A342.45 342.45 0 0 1 512.1 856a342.24 342.24 0 0 1-243.2-100.8c-9.9-9.9-19.2-20.4-27.8-31.4l60.2-47a8 8 0 0 0-3-14.1l-175.7-43c-5-1.2-9.9 2.6-9.9 7.7l-.7 181c0 6.7 7.7 10.5 12.9 6.3l56.4-44.1C258.2 868.9 377.8 932 512.2 932c229.2 0 415.5-183.7 419.8-411.8a8 8 0 0 0-8-8.2z" }, "child": [] }] })(props);
}
function AiOutlineTool(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M876.6 239.5c-.5-.9-1.2-1.8-2-2.5-5-5-13.1-5-18.1 0L684.2 409.3l-67.9-67.9L788.7 169c.8-.8 1.4-1.6 2-2.5 3.6-6.1 1.6-13.9-4.5-17.5-98.2-58-226.8-44.7-311.3 39.7-67 67-89.2 162-66.5 247.4l-293 293c-3 3-2.8 7.9.3 11l169.7 169.7c3.1 3.1 8.1 3.3 11 .3l292.9-292.9c85.5 22.8 180.5.7 247.6-66.4 84.4-84.5 97.7-213.1 39.7-311.3zM786 499.8c-58.1 58.1-145.3 69.3-214.6 33.6l-8.8 8.8-.1-.1-274 274.1-79.2-79.2 230.1-230.1s0 .1.1.1l52.8-52.8c-35.7-69.3-24.5-156.5 33.6-214.6a184.2 184.2 0 0 1 144-53.5L537 318.9a32.05 32.05 0 0 0 0 45.3l124.5 124.5a32.05 32.05 0 0 0 45.3 0l132.8-132.8c3.7 51.8-14.4 104.8-53.6 143.9z" }, "child": [] }] })(props);
}
function AiOutlineUngroup(props) {
  return GenIcon({ "attr": { "t": "1569683823033", "viewBox": "0 0 1024 1024", "version": "1.1" }, "child": [{ "tag": "defs", "attr": {}, "child": [] }, { "tag": "path", "attr": { "d": "M736 550H288c-8.8 0-16 7.2-16 16v176c0 8.8 7.2 16 16 16h448c8.8 0 16-7.2 16-16V566c0-8.8-7.2-16-16-16z m-56 136H344v-64h336v64zM888 816c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z m0 96c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24zM736 266H288c-8.8 0-16 7.2-16 16v176c0 8.8 7.2 16 16 16h448c8.8 0 16-7.2 16-16V282c0-8.8-7.2-16-16-16z m-56 136H344v-64h336v64zM888 208c39.8 0 72-32.2 72-72s-32.2-72-72-72-72 32.2-72 72 32.2 72 72 72z m0-96c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zM136 64c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z m0 96c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24zM136 816c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z m0 96c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24z" }, "child": [] }] })(props);
}
function AiOutlineUnorderedList(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 1 0-112 0z" }, "child": [] }] })(props);
}
function AiOutlineUp(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 0 0 140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z" }, "child": [] }] })(props);
}
function AiOutlineWarning(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M464 720a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z" }, "child": [] }] })(props);
}
function MdCalendarMonth(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V10h14v10zM9 14H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2zm-8 4H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2z" }, "child": [] }] })(props);
}
function MdCheckCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" }, "child": [] }] })(props);
}
function MdDeleteOutline(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM8 9h8v10H8V9zm7.5-5-1-1h-5l-1 1H5v2h14V4z" }, "child": [] }] })(props);
}
function MdDelete(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" }, "child": [] }] })(props);
}
function MdSearch(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" }, "child": [] }] })(props);
}
function MdError(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }, "child": [] }] })(props);
}
function MdWarning(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" }, "child": [] }] })(props);
}
function MdPlayCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM9.5 16.5v-9l7 4.5-7 4.5z" }, "child": [] }] })(props);
}
function MdPlaylistAdd(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M14 10H3v2h11v-2zm0-4H3v2h11V6zm4 8v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zM3 16h7v-2H3v2z" }, "child": [] }] })(props);
}
function MdPlaylistPlay(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M3 10h11v2H3zM3 6h11v2H3zM3 14h7v2H3zM16 13v8l6-4z" }, "child": [] }] })(props);
}
function MdVideoFile(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M14 2H6.01a2 2 0 0 0-2 2L4 20c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm-1 7V3.5L18.5 9H13zm1 5 2-1.06v4.12L14 16v1c0 .55-.45 1-1 1H9c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h4c.55 0 1 .45 1 1v1z" }, "child": [] }] })(props);
}
function MdVideoLibrary(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8 12.5v-9l6 4.5-6 4.5z" }, "child": [] }] })(props);
}
function MdAddCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 11h-4v4h-2v-4H7v-2h4V7h2v4h4v2z" }, "child": [] }] })(props);
}
function MdInventory(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M20 2H4c-1 0-2 .9-2 2v3.01c0 .72.43 1.34 1 1.69V20c0 1.1 1.1 2 2 2h14c.9 0 2-.9 2-2V8.7c.57-.35 1-.97 1-1.69V4c0-1.1-1-2-2-2zm-5 12H9v-2h6v2zm5-7H4V4l16-.02V7z" }, "child": [] }] })(props);
}
function MdSort(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M3 18h6v-2H3v2zM3 6v2h18V6H3zm0 7h12v-2H3v2z" }, "child": [] }] })(props);
}
function MdUnarchive(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "m20.55 5.22-1.39-1.68A1.51 1.51 0 0 0 18 3H6c-.47 0-.88.21-1.15.55L3.46 5.22C3.17 5.57 3 6.01 3 6.5V19a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V6.5c0-.49-.17-.93-.45-1.28zM12 9.5l5.5 5.5H14v2h-4v-2H6.5L12 9.5zM5.12 5l.82-1h12l.93 1H5.12z" }, "child": [] }] })(props);
}
function MdAccessTime(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z" }, "child": [] }, { "tag": "path", "attr": { "d": "M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z" }, "child": [] }] })(props);
}
function MdFlashlightOn(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M6 2h12v3H6zM6 7v1l2 3v11h8V11l2-3V7H6zm6 8.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z" }, "child": [] }] })(props);
}
function MdAttachFile(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 0 1 5 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 0 0 5 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z" }, "child": [] }] })(props);
}
function MdInsertDriveFile(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z" }, "child": [] }] })(props);
}
function MdDriveFileRenameOutline(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M18.41 5.8 17.2 4.59c-.78-.78-2.05-.78-2.83 0l-2.68 2.68L3 15.96V20h4.04l8.74-8.74 2.63-2.63c.79-.78.79-2.05 0-2.83zM6.21 18H5v-1.21l8.66-8.66 1.21 1.21L6.21 18zM11 20l4-4h6v4H11z" }, "child": [] }] })(props);
}
function MdFolder(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z" }, "child": [] }] })(props);
}
function MdAudiotrack(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 3v9.28a4.39 4.39 0 0 0-1.5-.28C8.01 12 6 14.01 6 16.5S8.01 21 10.5 21c2.31 0 4.2-1.75 4.45-4H15V6h4V3h-7z" }, "child": [] }] })(props);
}
function MdAutoFixHigh(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.996.996 0 0 0-1.41 0L1.29 18.96a.996.996 0 0 0 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05a.996.996 0 0 0 0-1.41l-2.33-2.35zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12-2.44 2.44z" }, "child": [] }] })(props);
}
function MdBrokenImage(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0zm0 0h24v24H0zm21 19c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2V5c0-1.1.9-2 2-2h14c1.1 0 2 .9 2 2" }, "child": [] }, { "tag": "path", "attr": { "d": "M21 5v6.59l-3-3.01-4 4.01-4-4-4 4-3-3.01V5c0-1.1.9-2 2-2h14c1.1 0 2 .9 2 2zm-3 6.42 3 3.01V19c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2v-6.58l3 2.99 4-4 4 4 4-3.99z" }, "child": [] }] })(props);
}
function MdEdit(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a.996.996 0 0 0 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z" }, "child": [] }] })(props);
}
function MdImage(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z" }, "child": [] }] })(props);
}
function MdCheck(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" }, "child": [] }] })(props);
}
function MdClose(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }, "child": [] }] })(props);
}
function MdSync(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46A7.93 7.93 0 0 0 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74A7.93 7.93 0 0 0 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z" }, "child": [] }] })(props);
}
function MdOutlineArticle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z" }, "child": [] }, { "tag": "path", "attr": { "d": "M14 17H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z" }, "child": [] }] })(props);
}
function MdOutlineDelete(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z" }, "child": [] }] })(props);
}
function MdOutlineFactCheck(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "g", "attr": { "fillRule": "evenodd" }, "child": [{ "tag": "path", "attr": { "d": "M20 3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H4V5h16v14z" }, "child": [] }, { "tag": "path", "attr": { "d": "M19.41 10.42 17.99 9l-3.17 3.17-1.41-1.42L12 12.16 14.82 15zM5 7h5v2H5zM5 11h5v2H5zM5 15h5v2H5z" }, "child": [] }] }] })(props);
}
function MdOutlineFilterAltOff(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "m16.95 6-3.57 4.55 1.43 1.43c1.03-1.31 4.98-6.37 4.98-6.37A.998.998 0 0 0 19 4H6.83l2 2h8.12zM2.81 2.81 1.39 4.22 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-2.17l5.78 5.78 1.41-1.41L2.81 2.81z" }, "child": [] }] })(props);
}
function MdOutlineFilterAlt(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24m0 24H0" }, "child": [] }, { "tag": "path", "attr": { "d": "M7 6h10l-5.01 6.3L7 6zm-2.75-.39C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39A.998.998 0 0 0 18.95 4H5.04c-.83 0-1.3.95-.79 1.61z" }, "child": [] }, { "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }] })(props);
}
function MdOutlinePercent(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M7.5 4C5.57 4 4 5.57 4 7.5S5.57 11 7.5 11 11 9.43 11 7.5 9.43 4 7.5 4zm0 5C6.67 9 6 8.33 6 7.5S6.67 6 7.5 6 9 6.67 9 7.5 8.33 9 7.5 9zm9 4c-1.93 0-3.5 1.57-3.5 3.5s1.57 3.5 3.5 3.5 3.5-1.57 3.5-3.5-1.57-3.5-3.5-3.5zm0 5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5.41 20 4 18.59 18.59 4 20 5.41 5.41 20z" }, "child": [] }] })(props);
}
function MdOutlineStopCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm4-4H8V8h8v8z" }, "child": [] }] })(props);
}
function MdOutlineSubtitles(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V6h16v12zM6 10h2v2H6zm0 4h8v2H6zm10 0h2v2h-2zm-6-4h8v2h-8z" }, "child": [] }] })(props);
}
function MdOutlineTextFormat(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M5 17v2h14v-2H5zm4.5-4.2h5l.9 2.2h2.1L12.75 4h-1.5L6.5 15h2.1l.9-2.2zM12 5.98 13.87 11h-3.74L12 5.98z" }, "child": [] }] })(props);
}
function MdOutlineAccessTime(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z" }, "child": [] }] })(props);
}
function MdOutlineCreateNewFolder(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M20 6h-8l-2-2H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm0 12H4V6h5.17l2 2H20v10zm-8-4h2v2h2v-2h2v-2h-2v-2h-2v2h-2z" }, "child": [] }] })(props);
}
function MdOutlineTextSnippet(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M14.17 5 19 9.83V19H5V5h9.17m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V9.83c0-.53-.21-1.04-.59-1.41l-4.83-4.83c-.37-.38-.88-.59-1.41-.59zM7 15h10v2H7v-2zm0-4h10v2H7v-2zm0-4h7v2H7V7z" }, "child": [] }] })(props);
}
function MdOutlineCleaningServices(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M16 11h-1V3c0-1.1-.9-2-2-2h-2c-1.1 0-2 .9-2 2v8H8c-2.76 0-5 2.24-5 5v7h18v-7c0-2.76-2.24-5-5-5zm-5-8h2v8h-2V3zm8 18h-2v-3c0-.55-.45-1-1-1s-1 .45-1 1v3h-2v-3c0-.55-.45-1-1-1s-1 .45-1 1v3H9v-3c0-.55-.45-1-1-1s-1 .45-1 1v3H5v-5c0-1.65 1.35-3 3-3h8c1.65 0 3 1.35 3 3v5z" }, "child": [] }] })(props);
}
function MdOutlineCheckBox(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zM17.99 9l-1.41-1.42-6.59 6.59-2.58-2.57-1.42 1.41 4 3.99z" }, "child": [] }] })(props);
}
function TbDatabase(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M12 6m-8 0a8 3 0 1 0 16 0a8 3 0 1 0 -16 0" }, "child": [] }, { "tag": "path", "attr": { "d": "M4 6v6a8 3 0 0 0 16 0v-6" }, "child": [] }, { "tag": "path", "attr": { "d": "M4 12v6a8 3 0 0 0 16 0v-6" }, "child": [] }] })(props);
}
function TbExternalLink(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6" }, "child": [] }, { "tag": "path", "attr": { "d": "M11 13l9 -9" }, "child": [] }, { "tag": "path", "attr": { "d": "M15 4h5v5" }, "child": [] }] })(props);
}
function TbFilterPlus(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "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" }, "child": [] }, { "tag": "path", "attr": { "d": "M16 19h6" }, "child": [] }, { "tag": "path", "attr": { "d": "M19 16v6" }, "child": [] }] })(props);
}
function TbNumber123(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M3 10l2 -2v8" }, "child": [] }, { "tag": "path", "attr": { "d": "M9 8h3a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 0 -1 1v2a1 1 0 0 0 1 1h3" }, "child": [] }, { "tag": "path", "attr": { "d": "M17 8h2.5a1.5 1.5 0 0 1 1.5 1.5v1a1.5 1.5 0 0 1 -1.5 1.5h-1.5h1.5a1.5 1.5 0 0 1 1.5 1.5v1a1.5 1.5 0 0 1 -1.5 1.5h-2.5" }, "child": [] }] })(props);
}
function TbPackageExport(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M12 21l-8 -4.5v-9l8 -4.5l8 4.5v4.5" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 12l8 -4.5" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 12v9" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 12l-8 -4.5" }, "child": [] }, { "tag": "path", "attr": { "d": "M15 18h7" }, "child": [] }, { "tag": "path", "attr": { "d": "M19 15l3 3l-3 3" }, "child": [] }] })(props);
}
function TbSectionSign(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M9.172 19a3 3 0 1 0 2.828 -4" }, "child": [] }, { "tag": "path", "attr": { "d": "M14.83 5a3 3 0 1 0 -2.83 4" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0" }, "child": [] }] })(props);
}
function TbSelect(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M3 3m0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z" }, "child": [] }, { "tag": "path", "attr": { "d": "M9 11l3 3l3 -3" }, "child": [] }] })(props);
}
function TbTemplate(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M4 4m0 1a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1z" }, "child": [] }, { "tag": "path", "attr": { "d": "M4 12m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" }, "child": [] }, { "tag": "path", "attr": { "d": "M14 12l6 0" }, "child": [] }, { "tag": "path", "attr": { "d": "M14 16l6 0" }, "child": [] }, { "tag": "path", "attr": { "d": "M14 20l6 0" }, "child": [] }] })(props);
}
function TbToolsKitchen(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M4 3h8l-1 9h-6z" }, "child": [] }, { "tag": "path", "attr": { "d": "M7 18h2v3h-2z" }, "child": [] }, { "tag": "path", "attr": { "d": "M20 3v12h-5c-.023 -3.681 .184 -7.406 5 -12z" }, "child": [] }, { "tag": "path", "attr": { "d": "M20 15v6h-1v-3" }, "child": [] }, { "tag": "path", "attr": { "d": "M8 12l0 6" }, "child": [] }] })(props);
}
/*!
 * @kurkle/color v0.3.4
 * https://github.com/kurkle/color#readme
 * (c) 2024 Jukka Kurkela
 * Released under the MIT License
 */
function round$1(v2) {
  return v2 + 0.5 | 0;
}
const lim = (v2, l2, h3) => Math.max(Math.min(v2, h3), l2);
function p2b(v2) {
  return lim(round$1(v2 * 2.55), 0, 255);
}
function n2b(v2) {
  return lim(round$1(v2 * 255), 0, 255);
}
function b2n(v2) {
  return lim(round$1(v2 / 2.55) / 100, 0, 1);
}
function n2p(v2) {
  return lim(round$1(v2 * 100), 0, 100);
}
const map$1 = { 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, A: 10, B: 11, C: 12, D: 13, E: 14, F: 15, a: 10, b: 11, c: 12, d: 13, e: 14, f: 15 };
const hex2 = [..."0123456789ABCDEF"];
const h1 = (b2) => hex2[b2 & 15];
const h2 = (b2) => hex2[(b2 & 240) >> 4] + hex2[b2 & 15];
const eq$1 = (b2) => (b2 & 240) >> 4 === (b2 & 15);
const isShort = (v2) => eq$1(v2.r) && eq$1(v2.g) && eq$1(v2.b) && eq$1(v2.a);
function hexParse(str) {
  var len = str.length;
  var ret;
  if (str[0] === "#") {
    if (len === 4 || len === 5) {
      ret = {
        r: 255 & map$1[str[1]] * 17,
        g: 255 & map$1[str[2]] * 17,
        b: 255 & map$1[str[3]] * 17,
        a: len === 5 ? map$1[str[4]] * 17 : 255
      };
    } else if (len === 7 || len === 9) {
      ret = {
        r: map$1[str[1]] << 4 | map$1[str[2]],
        g: map$1[str[3]] << 4 | map$1[str[4]],
        b: map$1[str[5]] << 4 | map$1[str[6]],
        a: len === 9 ? map$1[str[7]] << 4 | map$1[str[8]] : 255
      };
    }
  }
  return ret;
}
const alpha = (a2, f2) => a2 < 255 ? f2(a2) : "";
function hexString(v2) {
  var f2 = isShort(v2) ? h1 : h2;
  return v2 ? "#" + f2(v2.r) + f2(v2.g) + f2(v2.b) + alpha(v2.a, f2) : void 0;
}
const HUE_RE = /^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;
function hsl2rgbn(h3, s2, l2) {
  const a2 = s2 * Math.min(l2, 1 - l2);
  const f2 = (n2, k2 = (n2 + h3 / 30) % 12) => l2 - a2 * Math.max(Math.min(k2 - 3, 9 - k2, 1), -1);
  return [f2(0), f2(8), f2(4)];
}
function hsv2rgbn(h3, s2, v2) {
  const f2 = (n2, k2 = (n2 + h3 / 60) % 6) => v2 - v2 * s2 * Math.max(Math.min(k2, 4 - k2, 1), 0);
  return [f2(5), f2(3), f2(1)];
}
function hwb2rgbn(h3, w2, b2) {
  const rgb = hsl2rgbn(h3, 1, 0.5);
  let i2;
  if (w2 + b2 > 1) {
    i2 = 1 / (w2 + b2);
    w2 *= i2;
    b2 *= i2;
  }
  for (i2 = 0; i2 < 3; i2++) {
    rgb[i2] *= 1 - w2 - b2;
    rgb[i2] += w2;
  }
  return rgb;
}
function hueValue(r2, g2, b2, d2, max2) {
  if (r2 === max2) {
    return (g2 - b2) / d2 + (g2 < b2 ? 6 : 0);
  }
  if (g2 === max2) {
    return (b2 - r2) / d2 + 2;
  }
  return (r2 - g2) / d2 + 4;
}
function rgb2hsl(v2) {
  const range3 = 255;
  const r2 = v2.r / range3;
  const g2 = v2.g / range3;
  const b2 = v2.b / range3;
  const max2 = Math.max(r2, g2, b2);
  const min2 = Math.min(r2, g2, b2);
  const l2 = (max2 + min2) / 2;
  let h3, s2, d2;
  if (max2 !== min2) {
    d2 = max2 - min2;
    s2 = l2 > 0.5 ? d2 / (2 - max2 - min2) : d2 / (max2 + min2);
    h3 = hueValue(r2, g2, b2, d2, max2);
    h3 = h3 * 60 + 0.5;
  }
  return [h3 | 0, s2 || 0, l2];
}
function calln(f2, a2, b2, c2) {
  return (Array.isArray(a2) ? f2(a2[0], a2[1], a2[2]) : f2(a2, b2, c2)).map(n2b);
}
function hsl2rgb(h3, s2, l2) {
  return calln(hsl2rgbn, h3, s2, l2);
}
function hwb2rgb(h3, w2, b2) {
  return calln(hwb2rgbn, h3, w2, b2);
}
function hsv2rgb(h3, s2, v2) {
  return calln(hsv2rgbn, h3, s2, v2);
}
function hue(h3) {
  return (h3 % 360 + 360) % 360;
}
function hueParse(str) {
  const m2 = HUE_RE.exec(str);
  let a2 = 255;
  let v2;
  if (!m2) {
    return;
  }
  if (m2[5] !== v2) {
    a2 = m2[6] ? p2b(+m2[5]) : n2b(+m2[5]);
  }
  const h3 = hue(+m2[2]);
  const p1 = +m2[3] / 100;
  const p2 = +m2[4] / 100;
  if (m2[1] === "hwb") {
    v2 = hwb2rgb(h3, p1, p2);
  } else if (m2[1] === "hsv") {
    v2 = hsv2rgb(h3, p1, p2);
  } else {
    v2 = hsl2rgb(h3, p1, p2);
  }
  return {
    r: v2[0],
    g: v2[1],
    b: v2[2],
    a: a2
  };
}
function rotate(v2, deg) {
  var h3 = rgb2hsl(v2);
  h3[0] = hue(h3[0] + deg);
  h3 = hsl2rgb(h3);
  v2.r = h3[0];
  v2.g = h3[1];
  v2.b = h3[2];
}
function hslString(v2) {
  if (!v2) {
    return;
  }
  const a2 = rgb2hsl(v2);
  const h3 = a2[0];
  const s2 = n2p(a2[1]);
  const l2 = n2p(a2[2]);
  return v2.a < 255 ? `hsla(${h3}, ${s2}%, ${l2}%, ${b2n(v2.a)})` : `hsl(${h3}, ${s2}%, ${l2}%)`;
}
const map$2 = {
  x: "dark",
  Z: "light",
  Y: "re",
  X: "blu",
  W: "gr",
  V: "medium",
  U: "slate",
  A: "ee",
  T: "ol",
  S: "or",
  B: "ra",
  C: "lateg",
  D: "ights",
  R: "in",
  Q: "turquois",
  E: "hi",
  P: "ro",
  O: "al",
  N: "le",
  M: "de",
  L: "yello",
  F: "en",
  K: "ch",
  G: "arks",
  H: "ea",
  I: "ightg",
  J: "wh"
};
const names$1 = {
  OiceXe: "f0f8ff",
  antiquewEte: "faebd7",
  aqua: "ffff",
  aquamarRe: "7fffd4",
  azuY: "f0ffff",
  beige: "f5f5dc",
  bisque: "ffe4c4",
  black: "0",
  blanKedOmond: "ffebcd",
  Xe: "ff",
  XeviTet: "8a2be2",
  bPwn: "a52a2a",
  burlywood: "deb887",
  caMtXe: "5f9ea0",
  KartYuse: "7fff00",
  KocTate: "d2691e",
  cSO: "ff7f50",
  cSnflowerXe: "6495ed",
  cSnsilk: "fff8dc",
  crimson: "dc143c",
  cyan: "ffff",
  xXe: "8b",
  xcyan: "8b8b",
  xgTMnPd: "b8860b",
  xWay: "a9a9a9",
  xgYF: "6400",
  xgYy: "a9a9a9",
  xkhaki: "bdb76b",
  xmagFta: "8b008b",
  xTivegYF: "556b2f",
  xSange: "ff8c00",
  xScEd: "9932cc",
  xYd: "8b0000",
  xsOmon: "e9967a",
  xsHgYF: "8fbc8f",
  xUXe: "483d8b",
  xUWay: "2f4f4f",
  xUgYy: "2f4f4f",
  xQe: "ced1",
  xviTet: "9400d3",
  dAppRk: "ff1493",
  dApskyXe: "bfff",
  dimWay: "696969",
  dimgYy: "696969",
  dodgerXe: "1e90ff",
  fiYbrick: "b22222",
  flSOwEte: "fffaf0",
  foYstWAn: "228b22",
  fuKsia: "ff00ff",
  gaRsbSo: "dcdcdc",
  ghostwEte: "f8f8ff",
  gTd: "ffd700",
  gTMnPd: "daa520",
  Way: "808080",
  gYF: "8000",
  gYFLw: "adff2f",
  gYy: "808080",
  honeyMw: "f0fff0",
  hotpRk: "ff69b4",
  RdianYd: "cd5c5c",
  Rdigo: "4b0082",
  ivSy: "fffff0",
  khaki: "f0e68c",
  lavFMr: "e6e6fa",
  lavFMrXsh: "fff0f5",
  lawngYF: "7cfc00",
  NmoncEffon: "fffacd",
  ZXe: "add8e6",
  ZcSO: "f08080",
  Zcyan: "e0ffff",
  ZgTMnPdLw: "fafad2",
  ZWay: "d3d3d3",
  ZgYF: "90ee90",
  ZgYy: "d3d3d3",
  ZpRk: "ffb6c1",
  ZsOmon: "ffa07a",
  ZsHgYF: "20b2aa",
  ZskyXe: "87cefa",
  ZUWay: "778899",
  ZUgYy: "778899",
  ZstAlXe: "b0c4de",
  ZLw: "ffffe0",
  lime: "ff00",
  limegYF: "32cd32",
  lRF: "faf0e6",
  magFta: "ff00ff",
  maPon: "800000",
  VaquamarRe: "66cdaa",
  VXe: "cd",
  VScEd: "ba55d3",
  VpurpN: "9370db",
  VsHgYF: "3cb371",
  VUXe: "7b68ee",
  VsprRggYF: "fa9a",
  VQe: "48d1cc",
  VviTetYd: "c71585",
  midnightXe: "191970",
  mRtcYam: "f5fffa",
  mistyPse: "ffe4e1",
  moccasR: "ffe4b5",
  navajowEte: "ffdead",
  navy: "80",
  Tdlace: "fdf5e6",
  Tive: "808000",
  TivedBb: "6b8e23",
  Sange: "ffa500",
  SangeYd: "ff4500",
  ScEd: "da70d6",
  pOegTMnPd: "eee8aa",
  pOegYF: "98fb98",
  pOeQe: "afeeee",
  pOeviTetYd: "db7093",
  papayawEp: "ffefd5",
  pHKpuff: "ffdab9",
  peru: "cd853f",
  pRk: "ffc0cb",
  plum: "dda0dd",
  powMrXe: "b0e0e6",
  purpN: "800080",
  YbeccapurpN: "663399",
  Yd: "ff0000",
  Psybrown: "bc8f8f",
  PyOXe: "4169e1",
  saddNbPwn: "8b4513",
  sOmon: "fa8072",
  sandybPwn: "f4a460",
  sHgYF: "2e8b57",
  sHshell: "fff5ee",
  siFna: "a0522d",
  silver: "c0c0c0",
  skyXe: "87ceeb",
  UXe: "6a5acd",
  UWay: "708090",
  UgYy: "708090",
  snow: "fffafa",
  sprRggYF: "ff7f",
  stAlXe: "4682b4",
  tan: "d2b48c",
  teO: "8080",
  tEstN: "d8bfd8",
  tomato: "ff6347",
  Qe: "40e0d0",
  viTet: "ee82ee",
  JHt: "f5deb3",
  wEte: "ffffff",
  wEtesmoke: "f5f5f5",
  Lw: "ffff00",
  LwgYF: "9acd32"
};
function unpack() {
  const unpacked = {};
  const keys2 = Object.keys(names$1);
  const tkeys = Object.keys(map$2);
  let i2, j2, k2, ok2, nk2;
  for (i2 = 0; i2 < keys2.length; i2++) {
    ok2 = nk2 = keys2[i2];
    for (j2 = 0; j2 < tkeys.length; j2++) {
      k2 = tkeys[j2];
      nk2 = nk2.replace(k2, map$2[k2]);
    }
    k2 = parseInt(names$1[ok2], 16);
    unpacked[nk2] = [k2 >> 16 & 255, k2 >> 8 & 255, k2 & 255];
  }
  return unpacked;
}
let names;
function nameParse(str) {
  if (!names) {
    names = unpack();
    names.transparent = [0, 0, 0, 0];
  }
  const a2 = names[str.toLowerCase()];
  return a2 && {
    r: a2[0],
    g: a2[1],
    b: a2[2],
    a: a2.length === 4 ? a2[3] : 255
  };
}
const RGB_RE = /^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;
function rgbParse(str) {
  const m2 = RGB_RE.exec(str);
  let a2 = 255;
  let r2, g2, b2;
  if (!m2) {
    return;
  }
  if (m2[7] !== r2) {
    const v2 = +m2[7];
    a2 = m2[8] ? p2b(v2) : lim(v2 * 255, 0, 255);
  }
  r2 = +m2[1];
  g2 = +m2[3];
  b2 = +m2[5];
  r2 = 255 & (m2[2] ? p2b(r2) : lim(r2, 0, 255));
  g2 = 255 & (m2[4] ? p2b(g2) : lim(g2, 0, 255));
  b2 = 255 & (m2[6] ? p2b(b2) : lim(b2, 0, 255));
  return {
    r: r2,
    g: g2,
    b: b2,
    a: a2
  };
}
function rgbString(v2) {
  return v2 && (v2.a < 255 ? `rgba(${v2.r}, ${v2.g}, ${v2.b}, ${b2n(v2.a)})` : `rgb(${v2.r}, ${v2.g}, ${v2.b})`);
}
const to$1 = (v2) => v2 <= 31308e-7 ? v2 * 12.92 : Math.pow(v2, 1 / 2.4) * 1.055 - 0.055;
const from$1 = (v2) => v2 <= 0.04045 ? v2 / 12.92 : Math.pow((v2 + 0.055) / 1.055, 2.4);
function interpolate$1(rgb1, rgb2, t2) {
  const r2 = from$1(b2n(rgb1.r));
  const g2 = from$1(b2n(rgb1.g));
  const b2 = from$1(b2n(rgb1.b));
  return {
    r: n2b(to$1(r2 + t2 * (from$1(b2n(rgb2.r)) - r2))),
    g: n2b(to$1(g2 + t2 * (from$1(b2n(rgb2.g)) - g2))),
    b: n2b(to$1(b2 + t2 * (from$1(b2n(rgb2.b)) - b2))),
    a: rgb1.a + t2 * (rgb2.a - rgb1.a)
  };
}
function modHSL(v2, i2, ratio) {
  if (v2) {
    let tmp = rgb2hsl(v2);
    tmp[i2] = Math.max(0, Math.min(tmp[i2] + tmp[i2] * ratio, i2 === 0 ? 360 : 1));
    tmp = hsl2rgb(tmp);
    v2.r = tmp[0];
    v2.g = tmp[1];
    v2.b = tmp[2];
  }
}
function clone$3(v2, proto2) {
  return v2 ? Object.assign(proto2 || {}, v2) : v2;
}
function fromObject(input2) {
  var v2 = { r: 0, g: 0, b: 0, a: 255 };
  if (Array.isArray(input2)) {
    if (input2.length >= 3) {
      v2 = { r: input2[0], g: input2[1], b: input2[2], a: 255 };
      if (input2.length > 3) {
        v2.a = n2b(input2[3]);
      }
    }
  } else {
    v2 = clone$3(input2, { r: 0, g: 0, b: 0, a: 1 });
    v2.a = n2b(v2.a);
  }
  return v2;
}
function functionParse(str) {
  if (str.charAt(0) === "r") {
    return rgbParse(str);
  }
  return hueParse(str);
}
class Color {
  constructor(input2) {
    if (input2 instanceof Color) {
      return input2;
    }
    const type4 = typeof input2;
    let v2;
    if (type4 === "object") {
      v2 = fromObject(input2);
    } else if (type4 === "string") {
      v2 = hexParse(input2) || nameParse(input2) || functionParse(input2);
    }
    this._rgb = v2;
    this._valid = !!v2;
  }
  get valid() {
    return this._valid;
  }
  get rgb() {
    var v2 = clone$3(this._rgb);
    if (v2) {
      v2.a = b2n(v2.a);
    }
    return v2;
  }
  set rgb(obj) {
    this._rgb = fromObject(obj);
  }
  rgbString() {
    return this._valid ? rgbString(this._rgb) : void 0;
  }
  hexString() {
    return this._valid ? hexString(this._rgb) : void 0;
  }
  hslString() {
    return this._valid ? hslString(this._rgb) : void 0;
  }
  mix(color2, weight) {
    if (color2) {
      const c1 = this.rgb;
      const c2 = color2.rgb;
      let w2;
      const p2 = weight === w2 ? 0.5 : weight;
      const w3 = 2 * p2 - 1;
      const a2 = c1.a - c2.a;
      const w1 = ((w3 * a2 === -1 ? w3 : (w3 + a2) / (1 + w3 * a2)) + 1) / 2;
      w2 = 1 - w1;
      c1.r = 255 & w1 * c1.r + w2 * c2.r + 0.5;
      c1.g = 255 & w1 * c1.g + w2 * c2.g + 0.5;
      c1.b = 255 & w1 * c1.b + w2 * c2.b + 0.5;
      c1.a = p2 * c1.a + (1 - p2) * c2.a;
      this.rgb = c1;
    }
    return this;
  }
  interpolate(color2, t2) {
    if (color2) {
      this._rgb = interpolate$1(this._rgb, color2._rgb, t2);
    }
    return this;
  }
  clone() {
    return new Color(this.rgb);
  }
  alpha(a2) {
    this._rgb.a = n2b(a2);
    return this;
  }
  clearer(ratio) {
    const rgb = this._rgb;
    rgb.a *= 1 - ratio;
    return this;
  }
  greyscale() {
    const rgb = this._rgb;
    const val = round$1(rgb.r * 0.3 + rgb.g * 0.59 + rgb.b * 0.11);
    rgb.r = rgb.g = rgb.b = val;
    return this;
  }
  opaquer(ratio) {
    const rgb = this._rgb;
    rgb.a *= 1 + ratio;
    return this;
  }
  negate() {
    const v2 = this._rgb;
    v2.r = 255 - v2.r;
    v2.g = 255 - v2.g;
    v2.b = 255 - v2.b;
    return this;
  }
  lighten(ratio) {
    modHSL(this._rgb, 2, ratio);
    return this;
  }
  darken(ratio) {
    modHSL(this._rgb, 2, -ratio);
    return this;
  }
  saturate(ratio) {
    modHSL(this._rgb, 1, ratio);
    return this;
  }
  desaturate(ratio) {
    modHSL(this._rgb, 1, -ratio);
    return this;
  }
  rotate(deg) {
    rotate(this._rgb, deg);
    return this;
  }
}
/*!
 * Chart.js v4.5.0
 * https://www.chartjs.org
 * (c) 2025 Chart.js Contributors
 * Released under the MIT License
 */
function noop$3() {
}
const uid = /* @__PURE__ */ (() => {
  let id2 = 0;
  return () => id2++;
})();
function isNullOrUndef(value2) {
  return value2 === null || value2 === void 0;
}
function isArray$4(value2) {
  if (Array.isArray && Array.isArray(value2)) {
    return true;
  }
  const type4 = Object.prototype.toString.call(value2);
  if (type4.slice(0, 7) === "[object" && type4.slice(-6) === "Array]") {
    return true;
  }
  return false;
}
function isObject$3(value2) {
  return value2 !== null && Object.prototype.toString.call(value2) === "[object Object]";
}
function isNumberFinite(value2) {
  return (typeof value2 === "number" || value2 instanceof Number) && isFinite(+value2);
}
function finiteOrDefault(value2, defaultValue2) {
  return isNumberFinite(value2) ? value2 : defaultValue2;
}
function valueOrDefault(value2, defaultValue2) {
  return typeof value2 === "undefined" ? defaultValue2 : value2;
}
const toDimension = (value2, dimension) => typeof value2 === "string" && value2.endsWith("%") ? parseFloat(value2) / 100 * dimension : +value2;
function callback(fn, args, thisArg) {
  if (fn && typeof fn.call === "function") {
    return fn.apply(thisArg, args);
  }
}
function each(loopable3, fn, thisArg, reverse) {
  let i2, len, keys2;
  if (isArray$4(loopable3)) {
    len = loopable3.length;
    {
      for (i2 = 0; i2 < len; i2++) {
        fn.call(thisArg, loopable3[i2], i2);
      }
    }
  } else if (isObject$3(loopable3)) {
    keys2 = Object.keys(loopable3);
    len = keys2.length;
    for (i2 = 0; i2 < len; i2++) {
      fn.call(thisArg, loopable3[keys2[i2]], keys2[i2]);
    }
  }
}
function _elementsEqual(a0, a1) {
  let i2, ilen, v0, v1;
  if (!a0 || !a1 || a0.length !== a1.length) {
    return false;
  }
  for (i2 = 0, ilen = a0.length; i2 < ilen; ++i2) {
    v0 = a0[i2];
    v1 = a1[i2];
    if (v0.datasetIndex !== v1.datasetIndex || v0.index !== v1.index) {
      return false;
    }
  }
  return true;
}
function clone$2(source2) {
  if (isArray$4(source2)) {
    return source2.map(clone$2);
  }
  if (isObject$3(source2)) {
    const target = /* @__PURE__ */ Object.create(null);
    const keys2 = Object.keys(source2);
    const klen = keys2.length;
    let k2 = 0;
    for (; k2 < klen; ++k2) {
      target[keys2[k2]] = clone$2(source2[keys2[k2]]);
    }
    return target;
  }
  return source2;
}
function isValidKey(key) {
  return [
    "__proto__",
    "prototype",
    "constructor"
  ].indexOf(key) === -1;
}
function _merger(key, target, source2, options) {
  if (!isValidKey(key)) {
    return;
  }
  const tval = target[key];
  const sval = source2[key];
  if (isObject$3(tval) && isObject$3(sval)) {
    merge$2(tval, sval, options);
  } else {
    target[key] = clone$2(sval);
  }
}
function merge$2(target, source2, options) {
  const sources = isArray$4(source2) ? source2 : [
    source2
  ];
  const ilen = sources.length;
  if (!isObject$3(target)) {
    return target;
  }
  options = options || {};
  const merger = options.merger || _merger;
  let current;
  for (let i2 = 0; i2 < ilen; ++i2) {
    current = sources[i2];
    if (!isObject$3(current)) {
      continue;
    }
    const keys2 = Object.keys(current);
    for (let k2 = 0, klen = keys2.length; k2 < klen; ++k2) {
      merger(keys2[k2], target, current, options);
    }
  }
  return target;
}
function mergeIf(target, source2) {
  return merge$2(target, source2, {
    merger: _mergerIf
  });
}
function _mergerIf(key, target, source2) {
  if (!isValidKey(key)) {
    return;
  }
  const tval = target[key];
  const sval = source2[key];
  if (isObject$3(tval) && isObject$3(sval)) {
    mergeIf(tval, sval);
  } else if (!Object.prototype.hasOwnProperty.call(target, key)) {
    target[key] = clone$2(sval);
  }
}
const keyResolvers = {
  // Chart.helpers.core resolveObjectKey should resolve empty key to root object
  "": (v2) => v2,
  // default resolvers
  x: (o2) => o2.x,
  y: (o2) => o2.y
};
function _splitKey(key) {
  const parts = key.split(".");
  const keys2 = [];
  let tmp = "";
  for (const part of parts) {
    tmp += part;
    if (tmp.endsWith("\\")) {
      tmp = tmp.slice(0, -1) + ".";
    } else {
      keys2.push(tmp);
      tmp = "";
    }
  }
  return keys2;
}
function _getKeyResolver(key) {
  const keys2 = _splitKey(key);
  return (obj) => {
    for (const k2 of keys2) {
      if (k2 === "") {
        break;
      }
      obj = obj && obj[k2];
    }
    return obj;
  };
}
function resolveObjectKey(obj, key) {
  const resolver2 = keyResolvers[key] || (keyResolvers[key] = _getKeyResolver(key));
  return resolver2(obj);
}
function _capitalize(str) {
  return str.charAt(0).toUpperCase() + str.slice(1);
}
const defined = (value2) => typeof value2 !== "undefined";
const isFunction$3 = (value2) => typeof value2 === "function";
const setsEqual = (a2, b2) => {
  if (a2.size !== b2.size) {
    return false;
  }
  for (const item of a2) {
    if (!b2.has(item)) {
      return false;
    }
  }
  return true;
};
function _isClickEvent(e2) {
  return e2.type === "mouseup" || e2.type === "click" || e2.type === "contextmenu";
}
const PI = Math.PI;
const TAU = 2 * PI;
const PITAU = TAU + PI;
const INFINITY = Number.POSITIVE_INFINITY;
const RAD_PER_DEG = PI / 180;
const HALF_PI = PI / 2;
const QUARTER_PI = PI / 4;
const TWO_THIRDS_PI = PI * 2 / 3;
const log10 = Math.log10;
const sign$1 = Math.sign;
function almostEquals(x2, y2, epsilon) {
  return Math.abs(x2 - y2) < epsilon;
}
function niceNum(range3) {
  const roundedRange = Math.round(range3);
  range3 = almostEquals(range3, roundedRange, range3 / 1e3) ? roundedRange : range3;
  const niceRange = Math.pow(10, Math.floor(log10(range3)));
  const fraction = range3 / niceRange;
  const niceFraction = fraction <= 1 ? 1 : fraction <= 2 ? 2 : fraction <= 5 ? 5 : 10;
  return niceFraction * niceRange;
}
function _factorize(value2) {
  const result = [];
  const sqrt = Math.sqrt(value2);
  let i2;
  for (i2 = 1; i2 < sqrt; i2++) {
    if (value2 % i2 === 0) {
      result.push(i2);
      result.push(value2 / i2);
    }
  }
  if (sqrt === (sqrt | 0)) {
    result.push(sqrt);
  }
  result.sort((a2, b2) => a2 - b2).pop();
  return result;
}
function isNonPrimitive(n2) {
  return typeof n2 === "symbol" || typeof n2 === "object" && n2 !== null && !(Symbol.toPrimitive in n2 || "toString" in n2 || "valueOf" in n2);
}
function isNumber$2(n2) {
  return !isNonPrimitive(n2) && !isNaN(parseFloat(n2)) && isFinite(n2);
}
function almostWhole(x2, epsilon) {
  const rounded = Math.round(x2);
  return rounded - epsilon <= x2 && rounded + epsilon >= x2;
}
function _setMinAndMaxByKey(array4, target, property2) {
  let i2, ilen, value2;
  for (i2 = 0, ilen = array4.length; i2 < ilen; i2++) {
    value2 = array4[i2][property2];
    if (!isNaN(value2)) {
      target.min = Math.min(target.min, value2);
      target.max = Math.max(target.max, value2);
    }
  }
}
function toRadians(degrees2) {
  return degrees2 * (PI / 180);
}
function toDegrees(radians) {
  return radians * (180 / PI);
}
function _decimalPlaces(x2) {
  if (!isNumberFinite(x2)) {
    return;
  }
  let e2 = 1;
  let p2 = 0;
  while (Math.round(x2 * e2) / e2 !== x2) {
    e2 *= 10;
    p2++;
  }
  return p2;
}
function getAngleFromPoint(centrePoint, anglePoint) {
  const distanceFromXCenter = anglePoint.x - centrePoint.x;
  const distanceFromYCenter = anglePoint.y - centrePoint.y;
  const radialDistanceFromCenter = Math.sqrt(distanceFromXCenter * distanceFromXCenter + distanceFromYCenter * distanceFromYCenter);
  let angle = Math.atan2(distanceFromYCenter, distanceFromXCenter);
  if (angle < -0.5 * PI) {
    angle += TAU;
  }
  return {
    angle,
    distance: radialDistanceFromCenter
  };
}
function distanceBetweenPoints(pt1, pt2) {
  return Math.sqrt(Math.pow(pt2.x - pt1.x, 2) + Math.pow(pt2.y - pt1.y, 2));
}
function _angleDiff(a2, b2) {
  return (a2 - b2 + PITAU) % TAU - PI;
}
function _normalizeAngle(a2) {
  return (a2 % TAU + TAU) % TAU;
}
function _angleBetween(angle, start2, end2, sameAngleIsFullCircle) {
  const a2 = _normalizeAngle(angle);
  const s2 = _normalizeAngle(start2);
  const e2 = _normalizeAngle(end2);
  const angleToStart = _normalizeAngle(s2 - a2);
  const angleToEnd = _normalizeAngle(e2 - a2);
  const startToAngle = _normalizeAngle(a2 - s2);
  const endToAngle = _normalizeAngle(a2 - e2);
  return a2 === s2 || a2 === e2 || sameAngleIsFullCircle && s2 === e2 || angleToStart > angleToEnd && startToAngle < endToAngle;
}
function _limitValue(value2, min2, max2) {
  return Math.max(min2, Math.min(max2, value2));
}
function _int16Range(value2) {
  return _limitValue(value2, -32768, 32767);
}
function _isBetween(value2, start2, end2, epsilon = 1e-6) {
  return value2 >= Math.min(start2, end2) - epsilon && value2 <= Math.max(start2, end2) + epsilon;
}
function _lookup(table2, value2, cmp) {
  cmp = cmp || ((index2) => table2[index2] < value2);
  let hi2 = table2.length - 1;
  let lo = 0;
  let mid;
  while (hi2 - lo > 1) {
    mid = lo + hi2 >> 1;
    if (cmp(mid)) {
      lo = mid;
    } else {
      hi2 = mid;
    }
  }
  return {
    lo,
    hi: hi2
  };
}
const _lookupByKey = (table2, key, value2, last) => _lookup(table2, value2, last ? (index2) => {
  const ti2 = table2[index2][key];
  return ti2 < value2 || ti2 === value2 && table2[index2 + 1][key] === value2;
} : (index2) => table2[index2][key] < value2);
const _rlookupByKey = (table2, key, value2) => _lookup(table2, value2, (index2) => table2[index2][key] >= value2);
function _filterBetween(values, min2, max2) {
  let start2 = 0;
  let end2 = values.length;
  while (start2 < end2 && values[start2] < min2) {
    start2++;
  }
  while (end2 > start2 && values[end2 - 1] > max2) {
    end2--;
  }
  return start2 > 0 || end2 < values.length ? values.slice(start2, end2) : values;
}
const arrayEvents = [
  "push",
  "pop",
  "shift",
  "splice",
  "unshift"
];
function listenArrayEvents(array4, listener) {
  if (array4._chartjs) {
    array4._chartjs.listeners.push(listener);
    return;
  }
  Object.defineProperty(array4, "_chartjs", {
    configurable: true,
    enumerable: false,
    value: {
      listeners: [
        listener
      ]
    }
  });
  arrayEvents.forEach((key) => {
    const method4 = "_onData" + _capitalize(key);
    const base = array4[key];
    Object.defineProperty(array4, key, {
      configurable: true,
      enumerable: false,
      value(...args) {
        const res = base.apply(this, args);
        array4._chartjs.listeners.forEach((object4) => {
          if (typeof object4[method4] === "function") {
            object4[method4](...args);
          }
        });
        return res;
      }
    });
  });
}
function unlistenArrayEvents(array4, listener) {
  const stub = array4._chartjs;
  if (!stub) {
    return;
  }
  const listeners = stub.listeners;
  const index2 = listeners.indexOf(listener);
  if (index2 !== -1) {
    listeners.splice(index2, 1);
  }
  if (listeners.length > 0) {
    return;
  }
  arrayEvents.forEach((key) => {
    delete array4[key];
  });
  delete array4._chartjs;
}
function _arrayUnique(items) {
  const set2 = new Set(items);
  if (set2.size === items.length) {
    return items;
  }
  return Array.from(set2);
}
const requestAnimFrame = function() {
  if (typeof window === "undefined") {
    return function(callback2) {
      return callback2();
    };
  }
  return window.requestAnimationFrame;
}();
function throttled(fn, thisArg) {
  let argsToUse = [];
  let ticking = false;
  return function(...args) {
    argsToUse = args;
    if (!ticking) {
      ticking = true;
      requestAnimFrame.call(window, () => {
        ticking = false;
        fn.apply(thisArg, argsToUse);
      });
    }
  };
}
function debounce$1(fn, delay2) {
  let timeout;
  return function(...args) {
    if (delay2) {
      clearTimeout(timeout);
      timeout = setTimeout(fn, delay2, args);
    } else {
      fn.apply(this, args);
    }
    return delay2;
  };
}
const _toLeftRightCenter = (align) => align === "start" ? "left" : align === "end" ? "right" : "center";
const _alignStartEnd = (align, start2, end2) => align === "start" ? start2 : align === "end" ? end2 : (start2 + end2) / 2;
const _textX = (align, left2, right, rtl) => {
  const check = rtl ? "left" : "right";
  return align === check ? right : align === "center" ? (left2 + right) / 2 : left2;
};
function _getStartAndCountOfVisiblePoints(meta, points, animationsDisabled) {
  const pointCount = points.length;
  let start2 = 0;
  let count = pointCount;
  if (meta._sorted) {
    const { iScale, vScale, _parsed } = meta;
    const spanGaps = meta.dataset ? meta.dataset.options ? meta.dataset.options.spanGaps : null : null;
    const axis = iScale.axis;
    const { min: min2, max: max2, minDefined, maxDefined } = iScale.getUserBounds();
    if (minDefined) {
      start2 = Math.min(
        // @ts-expect-error Need to type _parsed
        _lookupByKey(_parsed, axis, min2).lo,
        // @ts-expect-error Need to fix types on _lookupByKey
        animationsDisabled ? pointCount : _lookupByKey(points, axis, iScale.getPixelForValue(min2)).lo
      );
      if (spanGaps) {
        const distanceToDefinedLo = _parsed.slice(0, start2 + 1).reverse().findIndex((point2) => !isNullOrUndef(point2[vScale.axis]));
        start2 -= Math.max(0, distanceToDefinedLo);
      }
      start2 = _limitValue(start2, 0, pointCount - 1);
    }
    if (maxDefined) {
      let end2 = Math.max(
        // @ts-expect-error Need to type _parsed
        _lookupByKey(_parsed, iScale.axis, max2, true).hi + 1,
        // @ts-expect-error Need to fix types on _lookupByKey
        animationsDisabled ? 0 : _lookupByKey(points, axis, iScale.getPixelForValue(max2), true).hi + 1
      );
      if (spanGaps) {
        const distanceToDefinedHi = _parsed.slice(end2 - 1).findIndex((point2) => !isNullOrUndef(point2[vScale.axis]));
        end2 += Math.max(0, distanceToDefinedHi);
      }
      count = _limitValue(end2, start2, pointCount) - start2;
    } else {
      count = pointCount - start2;
    }
  }
  return {
    start: start2,
    count
  };
}
function _scaleRangesChanged(meta) {
  const { xScale, yScale, _scaleRanges } = meta;
  const newRanges = {
    xmin: xScale.min,
    xmax: xScale.max,
    ymin: yScale.min,
    ymax: yScale.max
  };
  if (!_scaleRanges) {
    meta._scaleRanges = newRanges;
    return true;
  }
  const changed = _scaleRanges.xmin !== xScale.min || _scaleRanges.xmax !== xScale.max || _scaleRanges.ymin !== yScale.min || _scaleRanges.ymax !== yScale.max;
  Object.assign(_scaleRanges, newRanges);
  return changed;
}
const atEdge = (t2) => t2 === 0 || t2 === 1;
const elasticIn = (t2, s2, p2) => -(Math.pow(2, 10 * (t2 -= 1)) * Math.sin((t2 - s2) * TAU / p2));
const elasticOut = (t2, s2, p2) => Math.pow(2, -10 * t2) * Math.sin((t2 - s2) * TAU / p2) + 1;
const effects = {
  linear: (t2) => t2,
  easeInQuad: (t2) => t2 * t2,
  easeOutQuad: (t2) => -t2 * (t2 - 2),
  easeInOutQuad: (t2) => (t2 /= 0.5) < 1 ? 0.5 * t2 * t2 : -0.5 * (--t2 * (t2 - 2) - 1),
  easeInCubic: (t2) => t2 * t2 * t2,
  easeOutCubic: (t2) => (t2 -= 1) * t2 * t2 + 1,
  easeInOutCubic: (t2) => (t2 /= 0.5) < 1 ? 0.5 * t2 * t2 * t2 : 0.5 * ((t2 -= 2) * t2 * t2 + 2),
  easeInQuart: (t2) => t2 * t2 * t2 * t2,
  easeOutQuart: (t2) => -((t2 -= 1) * t2 * t2 * t2 - 1),
  easeInOutQuart: (t2) => (t2 /= 0.5) < 1 ? 0.5 * t2 * t2 * t2 * t2 : -0.5 * ((t2 -= 2) * t2 * t2 * t2 - 2),
  easeInQuint: (t2) => t2 * t2 * t2 * t2 * t2,
  easeOutQuint: (t2) => (t2 -= 1) * t2 * t2 * t2 * t2 + 1,
  easeInOutQuint: (t2) => (t2 /= 0.5) < 1 ? 0.5 * t2 * t2 * t2 * t2 * t2 : 0.5 * ((t2 -= 2) * t2 * t2 * t2 * t2 + 2),
  easeInSine: (t2) => -Math.cos(t2 * HALF_PI) + 1,
  easeOutSine: (t2) => Math.sin(t2 * HALF_PI),
  easeInOutSine: (t2) => -0.5 * (Math.cos(PI * t2) - 1),
  easeInExpo: (t2) => t2 === 0 ? 0 : Math.pow(2, 10 * (t2 - 1)),
  easeOutExpo: (t2) => t2 === 1 ? 1 : -Math.pow(2, -10 * t2) + 1,
  easeInOutExpo: (t2) => atEdge(t2) ? t2 : t2 < 0.5 ? 0.5 * Math.pow(2, 10 * (t2 * 2 - 1)) : 0.5 * (-Math.pow(2, -10 * (t2 * 2 - 1)) + 2),
  easeInCirc: (t2) => t2 >= 1 ? t2 : -(Math.sqrt(1 - t2 * t2) - 1),
  easeOutCirc: (t2) => Math.sqrt(1 - (t2 -= 1) * t2),
  easeInOutCirc: (t2) => (t2 /= 0.5) < 1 ? -0.5 * (Math.sqrt(1 - t2 * t2) - 1) : 0.5 * (Math.sqrt(1 - (t2 -= 2) * t2) + 1),
  easeInElastic: (t2) => atEdge(t2) ? t2 : elasticIn(t2, 0.075, 0.3),
  easeOutElastic: (t2) => atEdge(t2) ? t2 : elasticOut(t2, 0.075, 0.3),
  easeInOutElastic(t2) {
    const s2 = 0.1125;
    const p2 = 0.45;
    return atEdge(t2) ? t2 : t2 < 0.5 ? 0.5 * elasticIn(t2 * 2, s2, p2) : 0.5 + 0.5 * elasticOut(t2 * 2 - 1, s2, p2);
  },
  easeInBack(t2) {
    const s2 = 1.70158;
    return t2 * t2 * ((s2 + 1) * t2 - s2);
  },
  easeOutBack(t2) {
    const s2 = 1.70158;
    return (t2 -= 1) * t2 * ((s2 + 1) * t2 + s2) + 1;
  },
  easeInOutBack(t2) {
    let s2 = 1.70158;
    if ((t2 /= 0.5) < 1) {
      return 0.5 * (t2 * t2 * (((s2 *= 1.525) + 1) * t2 - s2));
    }
    return 0.5 * ((t2 -= 2) * t2 * (((s2 *= 1.525) + 1) * t2 + s2) + 2);
  },
  easeInBounce: (t2) => 1 - effects.easeOutBounce(1 - t2),
  easeOutBounce(t2) {
    const m2 = 7.5625;
    const d2 = 2.75;
    if (t2 < 1 / d2) {
      return m2 * t2 * t2;
    }
    if (t2 < 2 / d2) {
      return m2 * (t2 -= 1.5 / d2) * t2 + 0.75;
    }
    if (t2 < 2.5 / d2) {
      return m2 * (t2 -= 2.25 / d2) * t2 + 0.9375;
    }
    return m2 * (t2 -= 2.625 / d2) * t2 + 0.984375;
  },
  easeInOutBounce: (t2) => t2 < 0.5 ? effects.easeInBounce(t2 * 2) * 0.5 : effects.easeOutBounce(t2 * 2 - 1) * 0.5 + 0.5
};
function isPatternOrGradient(value2) {
  if (value2 && typeof value2 === "object") {
    const type4 = value2.toString();
    return type4 === "[object CanvasPattern]" || type4 === "[object CanvasGradient]";
  }
  return false;
}
function color$1(value2) {
  return isPatternOrGradient(value2) ? value2 : new Color(value2);
}
function getHoverColor(value2) {
  return isPatternOrGradient(value2) ? value2 : new Color(value2).saturate(0.5).darken(0.1).hexString();
}
const numbers = [
  "x",
  "y",
  "borderWidth",
  "radius",
  "tension"
];
const colors$1 = [
  "color",
  "borderColor",
  "backgroundColor"
];
function applyAnimationsDefaults(defaults2) {
  defaults2.set("animation", {
    delay: void 0,
    duration: 1e3,
    easing: "easeOutQuart",
    fn: void 0,
    from: void 0,
    loop: void 0,
    to: void 0,
    type: void 0
  });
  defaults2.describe("animation", {
    _fallback: false,
    _indexable: false,
    _scriptable: (name2) => name2 !== "onProgress" && name2 !== "onComplete" && name2 !== "fn"
  });
  defaults2.set("animations", {
    colors: {
      type: "color",
      properties: colors$1
    },
    numbers: {
      type: "number",
      properties: numbers
    }
  });
  defaults2.describe("animations", {
    _fallback: "animation"
  });
  defaults2.set("transitions", {
    active: {
      animation: {
        duration: 400
      }
    },
    resize: {
      animation: {
        duration: 0
      }
    },
    show: {
      animations: {
        colors: {
          from: "transparent"
        },
        visible: {
          type: "boolean",
          duration: 0
        }
      }
    },
    hide: {
      animations: {
        colors: {
          to: "transparent"
        },
        visible: {
          type: "boolean",
          easing: "linear",
          fn: (v2) => v2 | 0
        }
      }
    }
  });
}
function applyLayoutsDefaults(defaults2) {
  defaults2.set("layout", {
    autoPadding: true,
    padding: {
      top: 0,
      right: 0,
      bottom: 0,
      left: 0
    }
  });
}
const intlCache = /* @__PURE__ */ new Map();
function getNumberFormat(locale2, options) {
  options = options || {};
  const cacheKey = locale2 + JSON.stringify(options);
  let formatter = intlCache.get(cacheKey);
  if (!formatter) {
    formatter = new Intl.NumberFormat(locale2, options);
    intlCache.set(cacheKey, formatter);
  }
  return formatter;
}
function formatNumber(num, locale2, options) {
  return getNumberFormat(locale2, options).format(num);
}
const formatters = {
  values(value2) {
    return isArray$4(value2) ? value2 : "" + value2;
  },
  numeric(tickValue, index2, ticks) {
    if (tickValue === 0) {
      return "0";
    }
    const locale2 = this.chart.options.locale;
    let notation;
    let delta = tickValue;
    if (ticks.length > 1) {
      const maxTick = Math.max(Math.abs(ticks[0].value), Math.abs(ticks[ticks.length - 1].value));
      if (maxTick < 1e-4 || maxTick > 1e15) {
        notation = "scientific";
      }
      delta = calculateDelta(tickValue, ticks);
    }
    const logDelta = log10(Math.abs(delta));
    const numDecimal = isNaN(logDelta) ? 1 : Math.max(Math.min(-1 * Math.floor(logDelta), 20), 0);
    const options = {
      notation,
      minimumFractionDigits: numDecimal,
      maximumFractionDigits: numDecimal
    };
    Object.assign(options, this.options.ticks.format);
    return formatNumber(tickValue, locale2, options);
  }
};
function calculateDelta(tickValue, ticks) {
  let delta = ticks.length > 3 ? ticks[2].value - ticks[1].value : ticks[1].value - ticks[0].value;
  if (Math.abs(delta) >= 1 && tickValue !== Math.floor(tickValue)) {
    delta = tickValue - Math.floor(tickValue);
  }
  return delta;
}
var Ticks = {
  formatters
};
function applyScaleDefaults(defaults2) {
  defaults2.set("scale", {
    display: true,
    offset: false,
    reverse: false,
    beginAtZero: false,
    bounds: "ticks",
    clip: true,
    grace: 0,
    grid: {
      display: true,
      lineWidth: 1,
      drawOnChartArea: true,
      drawTicks: true,
      tickLength: 8,
      tickWidth: (_ctx, options) => options.lineWidth,
      tickColor: (_ctx, options) => options.color,
      offset: false
    },
    border: {
      display: true,
      dash: [],
      dashOffset: 0,
      width: 1
    },
    title: {
      display: false,
      text: "",
      padding: {
        top: 4,
        bottom: 4
      }
    },
    ticks: {
      minRotation: 0,
      maxRotation: 50,
      mirror: false,
      textStrokeWidth: 0,
      textStrokeColor: "",
      padding: 3,
      display: true,
      autoSkip: true,
      autoSkipPadding: 3,
      labelOffset: 0,
      callback: Ticks.formatters.values,
      minor: {},
      major: {},
      align: "center",
      crossAlign: "near",
      showLabelBackdrop: false,
      backdropColor: "rgba(255, 255, 255, 0.75)",
      backdropPadding: 2
    }
  });
  defaults2.route("scale.ticks", "color", "", "color");
  defaults2.route("scale.grid", "color", "", "borderColor");
  defaults2.route("scale.border", "color", "", "borderColor");
  defaults2.route("scale.title", "color", "", "color");
  defaults2.describe("scale", {
    _fallback: false,
    _scriptable: (name2) => !name2.startsWith("before") && !name2.startsWith("after") && name2 !== "callback" && name2 !== "parser",
    _indexable: (name2) => name2 !== "borderDash" && name2 !== "tickBorderDash" && name2 !== "dash"
  });
  defaults2.describe("scales", {
    _fallback: "scale"
  });
  defaults2.describe("scale.ticks", {
    _scriptable: (name2) => name2 !== "backdropPadding" && name2 !== "callback",
    _indexable: (name2) => name2 !== "backdropPadding"
  });
}
const overrides = /* @__PURE__ */ Object.create(null);
const descriptors$1 = /* @__PURE__ */ Object.create(null);
function getScope$1(node2, key) {
  if (!key) {
    return node2;
  }
  const keys2 = key.split(".");
  for (let i2 = 0, n2 = keys2.length; i2 < n2; ++i2) {
    const k2 = keys2[i2];
    node2 = node2[k2] || (node2[k2] = /* @__PURE__ */ Object.create(null));
  }
  return node2;
}
function set$2(root2, scope, values) {
  if (typeof scope === "string") {
    return merge$2(getScope$1(root2, scope), values);
  }
  return merge$2(getScope$1(root2, ""), scope);
}
class Defaults {
  constructor(_descriptors2, _appliers) {
    this.animation = void 0;
    this.backgroundColor = "rgba(0,0,0,0.1)";
    this.borderColor = "rgba(0,0,0,0.1)";
    this.color = "#666";
    this.datasets = {};
    this.devicePixelRatio = (context) => context.chart.platform.getDevicePixelRatio();
    this.elements = {};
    this.events = [
      "mousemove",
      "mouseout",
      "click",
      "touchstart",
      "touchmove"
    ];
    this.font = {
      family: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
      size: 12,
      style: "normal",
      lineHeight: 1.2,
      weight: null
    };
    this.hover = {};
    this.hoverBackgroundColor = (ctx, options) => getHoverColor(options.backgroundColor);
    this.hoverBorderColor = (ctx, options) => getHoverColor(options.borderColor);
    this.hoverColor = (ctx, options) => getHoverColor(options.color);
    this.indexAxis = "x";
    this.interaction = {
      mode: "nearest",
      intersect: true,
      includeInvisible: false
    };
    this.maintainAspectRatio = true;
    this.onHover = null;
    this.onClick = null;
    this.parsing = true;
    this.plugins = {};
    this.responsive = true;
    this.scale = void 0;
    this.scales = {};
    this.showLine = true;
    this.drawActiveElementsOnTop = true;
    this.describe(_descriptors2);
    this.apply(_appliers);
  }
  set(scope, values) {
    return set$2(this, scope, values);
  }
  get(scope) {
    return getScope$1(this, scope);
  }
  describe(scope, values) {
    return set$2(descriptors$1, scope, values);
  }
  override(scope, values) {
    return set$2(overrides, scope, values);
  }
  route(scope, name2, targetScope, targetName) {
    const scopeObject = getScope$1(this, scope);
    const targetScopeObject = getScope$1(this, targetScope);
    const privateName = "_" + name2;
    Object.defineProperties(scopeObject, {
      [privateName]: {
        value: scopeObject[name2],
        writable: true
      },
      [name2]: {
        enumerable: true,
        get() {
          const local = this[privateName];
          const target = targetScopeObject[targetName];
          if (isObject$3(local)) {
            return Object.assign({}, target, local);
          }
          return valueOrDefault(local, target);
        },
        set(value2) {
          this[privateName] = value2;
        }
      }
    });
  }
  apply(appliers) {
    appliers.forEach((apply2) => apply2(this));
  }
}
var defaults$2 = /* @__PURE__ */ new Defaults({
  _scriptable: (name2) => !name2.startsWith("on"),
  _indexable: (name2) => name2 !== "events",
  hover: {
    _fallback: "interaction"
  },
  interaction: {
    _scriptable: false,
    _indexable: false
  }
}, [
  applyAnimationsDefaults,
  applyLayoutsDefaults,
  applyScaleDefaults
]);
function toFontString(font) {
  if (!font || isNullOrUndef(font.size) || isNullOrUndef(font.family)) {
    return null;
  }
  return (font.style ? font.style + " " : "") + (font.weight ? font.weight + " " : "") + font.size + "px " + font.family;
}
function _measureText(ctx, data, gc2, longest, string3) {
  let textWidth = data[string3];
  if (!textWidth) {
    textWidth = data[string3] = ctx.measureText(string3).width;
    gc2.push(string3);
  }
  if (textWidth > longest) {
    longest = textWidth;
  }
  return longest;
}
function _alignPixel(chart, pixel, width) {
  const devicePixelRatio = chart.currentDevicePixelRatio;
  const halfWidth = width !== 0 ? Math.max(width / 2, 0.5) : 0;
  return Math.round((pixel - halfWidth) * devicePixelRatio) / devicePixelRatio + halfWidth;
}
function clearCanvas(canvas, ctx) {
  if (!ctx && !canvas) {
    return;
  }
  ctx = ctx || canvas.getContext("2d");
  ctx.save();
  ctx.resetTransform();
  ctx.clearRect(0, 0, canvas.width, canvas.height);
  ctx.restore();
}
function drawPoint(ctx, options, x2, y2) {
  drawPointLegend(ctx, options, x2, y2, null);
}
function drawPointLegend(ctx, options, x2, y2, w2) {
  let type4, xOffset, yOffset, size2, cornerRadius, width, xOffsetW, yOffsetW;
  const style2 = options.pointStyle;
  const rotation = options.rotation;
  const radius = options.radius;
  let rad = (rotation || 0) * RAD_PER_DEG;
  if (style2 && typeof style2 === "object") {
    type4 = style2.toString();
    if (type4 === "[object HTMLImageElement]" || type4 === "[object HTMLCanvasElement]") {
      ctx.save();
      ctx.translate(x2, y2);
      ctx.rotate(rad);
      ctx.drawImage(style2, -style2.width / 2, -style2.height / 2, style2.width, style2.height);
      ctx.restore();
      return;
    }
  }
  if (isNaN(radius) || radius <= 0) {
    return;
  }
  ctx.beginPath();
  switch (style2) {
    default:
      if (w2) {
        ctx.ellipse(x2, y2, w2 / 2, radius, 0, 0, TAU);
      } else {
        ctx.arc(x2, y2, radius, 0, TAU);
      }
      ctx.closePath();
      break;
    case "triangle":
      width = w2 ? w2 / 2 : radius;
      ctx.moveTo(x2 + Math.sin(rad) * width, y2 - Math.cos(rad) * radius);
      rad += TWO_THIRDS_PI;
      ctx.lineTo(x2 + Math.sin(rad) * width, y2 - Math.cos(rad) * radius);
      rad += TWO_THIRDS_PI;
      ctx.lineTo(x2 + Math.sin(rad) * width, y2 - Math.cos(rad) * radius);
      ctx.closePath();
      break;
    case "rectRounded":
      cornerRadius = radius * 0.516;
      size2 = radius - cornerRadius;
      xOffset = Math.cos(rad + QUARTER_PI) * size2;
      xOffsetW = Math.cos(rad + QUARTER_PI) * (w2 ? w2 / 2 - cornerRadius : size2);
      yOffset = Math.sin(rad + QUARTER_PI) * size2;
      yOffsetW = Math.sin(rad + QUARTER_PI) * (w2 ? w2 / 2 - cornerRadius : size2);
      ctx.arc(x2 - xOffsetW, y2 - yOffset, cornerRadius, rad - PI, rad - HALF_PI);
      ctx.arc(x2 + yOffsetW, y2 - xOffset, cornerRadius, rad - HALF_PI, rad);
      ctx.arc(x2 + xOffsetW, y2 + yOffset, cornerRadius, rad, rad + HALF_PI);
      ctx.arc(x2 - yOffsetW, y2 + xOffset, cornerRadius, rad + HALF_PI, rad + PI);
      ctx.closePath();
      break;
    case "rect":
      if (!rotation) {
        size2 = Math.SQRT1_2 * radius;
        width = w2 ? w2 / 2 : size2;
        ctx.rect(x2 - width, y2 - size2, 2 * width, 2 * size2);
        break;
      }
      rad += QUARTER_PI;
    case "rectRot":
      xOffsetW = Math.cos(rad) * (w2 ? w2 / 2 : radius);
      xOffset = Math.cos(rad) * radius;
      yOffset = Math.sin(rad) * radius;
      yOffsetW = Math.sin(rad) * (w2 ? w2 / 2 : radius);
      ctx.moveTo(x2 - xOffsetW, y2 - yOffset);
      ctx.lineTo(x2 + yOffsetW, y2 - xOffset);
      ctx.lineTo(x2 + xOffsetW, y2 + yOffset);
      ctx.lineTo(x2 - yOffsetW, y2 + xOffset);
      ctx.closePath();
      break;
    case "crossRot":
      rad += QUARTER_PI;
    case "cross":
      xOffsetW = Math.cos(rad) * (w2 ? w2 / 2 : radius);
      xOffset = Math.cos(rad) * radius;
      yOffset = Math.sin(rad) * radius;
      yOffsetW = Math.sin(rad) * (w2 ? w2 / 2 : radius);
      ctx.moveTo(x2 - xOffsetW, y2 - yOffset);
      ctx.lineTo(x2 + xOffsetW, y2 + yOffset);
      ctx.moveTo(x2 + yOffsetW, y2 - xOffset);
      ctx.lineTo(x2 - yOffsetW, y2 + xOffset);
      break;
    case "star":
      xOffsetW = Math.cos(rad) * (w2 ? w2 / 2 : radius);
      xOffset = Math.cos(rad) * radius;
      yOffset = Math.sin(rad) * radius;
      yOffsetW = Math.sin(rad) * (w2 ? w2 / 2 : radius);
      ctx.moveTo(x2 - xOffsetW, y2 - yOffset);
      ctx.lineTo(x2 + xOffsetW, y2 + yOffset);
      ctx.moveTo(x2 + yOffsetW, y2 - xOffset);
      ctx.lineTo(x2 - yOffsetW, y2 + xOffset);
      rad += QUARTER_PI;
      xOffsetW = Math.cos(rad) * (w2 ? w2 / 2 : radius);
      xOffset = Math.cos(rad) * radius;
      yOffset = Math.sin(rad) * radius;
      yOffsetW = Math.sin(rad) * (w2 ? w2 / 2 : radius);
      ctx.moveTo(x2 - xOffsetW, y2 - yOffset);
      ctx.lineTo(x2 + xOffsetW, y2 + yOffset);
      ctx.moveTo(x2 + yOffsetW, y2 - xOffset);
      ctx.lineTo(x2 - yOffsetW, y2 + xOffset);
      break;
    case "line":
      xOffset = w2 ? w2 / 2 : Math.cos(rad) * radius;
      yOffset = Math.sin(rad) * radius;
      ctx.moveTo(x2 - xOffset, y2 - yOffset);
      ctx.lineTo(x2 + xOffset, y2 + yOffset);
      break;
    case "dash":
      ctx.moveTo(x2, y2);
      ctx.lineTo(x2 + Math.cos(rad) * (w2 ? w2 / 2 : radius), y2 + Math.sin(rad) * radius);
      break;
    case false:
      ctx.closePath();
      break;
  }
  ctx.fill();
  if (options.borderWidth > 0) {
    ctx.stroke();
  }
}
function _isPointInArea(point2, area, margin) {
  margin = margin || 0.5;
  return !area || point2 && point2.x > area.left - margin && point2.x < area.right + margin && point2.y > area.top - margin && point2.y < area.bottom + margin;
}
function clipArea(ctx, area) {
  ctx.save();
  ctx.beginPath();
  ctx.rect(area.left, area.top, area.right - area.left, area.bottom - area.top);
  ctx.clip();
}
function unclipArea(ctx) {
  ctx.restore();
}
function _steppedLineTo(ctx, previous2, target, flip2, mode) {
  if (!previous2) {
    return ctx.lineTo(target.x, target.y);
  }
  if (mode === "middle") {
    const midpoint = (previous2.x + target.x) / 2;
    ctx.lineTo(midpoint, previous2.y);
    ctx.lineTo(midpoint, target.y);
  } else if (mode === "after" !== !!flip2) {
    ctx.lineTo(previous2.x, target.y);
  } else {
    ctx.lineTo(target.x, previous2.y);
  }
  ctx.lineTo(target.x, target.y);
}
function _bezierCurveTo(ctx, previous2, target, flip2) {
  if (!previous2) {
    return ctx.lineTo(target.x, target.y);
  }
  ctx.bezierCurveTo(flip2 ? previous2.cp1x : previous2.cp2x, flip2 ? previous2.cp1y : previous2.cp2y, flip2 ? target.cp2x : target.cp1x, flip2 ? target.cp2y : target.cp1y, target.x, target.y);
}
function setRenderOpts(ctx, opts2) {
  if (opts2.translation) {
    ctx.translate(opts2.translation[0], opts2.translation[1]);
  }
  if (!isNullOrUndef(opts2.rotation)) {
    ctx.rotate(opts2.rotation);
  }
  if (opts2.color) {
    ctx.fillStyle = opts2.color;
  }
  if (opts2.textAlign) {
    ctx.textAlign = opts2.textAlign;
  }
  if (opts2.textBaseline) {
    ctx.textBaseline = opts2.textBaseline;
  }
}
function decorateText(ctx, x2, y2, line2, opts2) {
  if (opts2.strikethrough || opts2.underline) {
    const metrics2 = ctx.measureText(line2);
    const left2 = x2 - metrics2.actualBoundingBoxLeft;
    const right = x2 + metrics2.actualBoundingBoxRight;
    const top2 = y2 - metrics2.actualBoundingBoxAscent;
    const bottom2 = y2 + metrics2.actualBoundingBoxDescent;
    const yDecoration = opts2.strikethrough ? (top2 + bottom2) / 2 : bottom2;
    ctx.strokeStyle = ctx.fillStyle;
    ctx.beginPath();
    ctx.lineWidth = opts2.decorationWidth || 2;
    ctx.moveTo(left2, yDecoration);
    ctx.lineTo(right, yDecoration);
    ctx.stroke();
  }
}
function drawBackdrop(ctx, opts2) {
  const oldColor = ctx.fillStyle;
  ctx.fillStyle = opts2.color;
  ctx.fillRect(opts2.left, opts2.top, opts2.width, opts2.height);
  ctx.fillStyle = oldColor;
}
function renderText(ctx, text2, x2, y2, font, opts2 = {}) {
  const lines = isArray$4(text2) ? text2 : [
    text2
  ];
  const stroke = opts2.strokeWidth > 0 && opts2.strokeColor !== "";
  let i2, line2;
  ctx.save();
  ctx.font = font.string;
  setRenderOpts(ctx, opts2);
  for (i2 = 0; i2 < lines.length; ++i2) {
    line2 = lines[i2];
    if (opts2.backdrop) {
      drawBackdrop(ctx, opts2.backdrop);
    }
    if (stroke) {
      if (opts2.strokeColor) {
        ctx.strokeStyle = opts2.strokeColor;
      }
      if (!isNullOrUndef(opts2.strokeWidth)) {
        ctx.lineWidth = opts2.strokeWidth;
      }
      ctx.strokeText(line2, x2, y2, opts2.maxWidth);
    }
    ctx.fillText(line2, x2, y2, opts2.maxWidth);
    decorateText(ctx, x2, y2, line2, opts2);
    y2 += Number(font.lineHeight);
  }
  ctx.restore();
}
function addRoundedRectPath(ctx, rect) {
  const { x: x2, y: y2, w: w2, h: h3, radius } = rect;
  ctx.arc(x2 + radius.topLeft, y2 + radius.topLeft, radius.topLeft, 1.5 * PI, PI, true);
  ctx.lineTo(x2, y2 + h3 - radius.bottomLeft);
  ctx.arc(x2 + radius.bottomLeft, y2 + h3 - radius.bottomLeft, radius.bottomLeft, PI, HALF_PI, true);
  ctx.lineTo(x2 + w2 - radius.bottomRight, y2 + h3);
  ctx.arc(x2 + w2 - radius.bottomRight, y2 + h3 - radius.bottomRight, radius.bottomRight, HALF_PI, 0, true);
  ctx.lineTo(x2 + w2, y2 + radius.topRight);
  ctx.arc(x2 + w2 - radius.topRight, y2 + radius.topRight, radius.topRight, 0, -HALF_PI, true);
  ctx.lineTo(x2 + radius.topLeft, y2);
}
const LINE_HEIGHT = /^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/;
const FONT_STYLE = /^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;
function toLineHeight(value2, size2) {
  const matches = ("" + value2).match(LINE_HEIGHT);
  if (!matches || matches[1] === "normal") {
    return size2 * 1.2;
  }
  value2 = +matches[2];
  switch (matches[3]) {
    case "px":
      return value2;
    case "%":
      value2 /= 100;
      break;
  }
  return size2 * value2;
}
const numberOrZero = (v2) => +v2 || 0;
function _readValueToProps(value2, props) {
  const ret = {};
  const objProps = isObject$3(props);
  const keys2 = objProps ? Object.keys(props) : props;
  const read = isObject$3(value2) ? objProps ? (prop) => valueOrDefault(value2[prop], value2[props[prop]]) : (prop) => value2[prop] : () => value2;
  for (const prop of keys2) {
    ret[prop] = numberOrZero(read(prop));
  }
  return ret;
}
function toTRBL(value2) {
  return _readValueToProps(value2, {
    top: "y",
    right: "x",
    bottom: "y",
    left: "x"
  });
}
function toTRBLCorners(value2) {
  return _readValueToProps(value2, [
    "topLeft",
    "topRight",
    "bottomLeft",
    "bottomRight"
  ]);
}
function toPadding(value2) {
  const obj = toTRBL(value2);
  obj.width = obj.left + obj.right;
  obj.height = obj.top + obj.bottom;
  return obj;
}
function toFont(options, fallback2) {
  options = options || {};
  fallback2 = fallback2 || defaults$2.font;
  let size2 = valueOrDefault(options.size, fallback2.size);
  if (typeof size2 === "string") {
    size2 = parseInt(size2, 10);
  }
  let style2 = valueOrDefault(options.style, fallback2.style);
  if (style2 && !("" + style2).match(FONT_STYLE)) {
    console.warn('Invalid font style specified: "' + style2 + '"');
    style2 = void 0;
  }
  const font = {
    family: valueOrDefault(options.family, fallback2.family),
    lineHeight: toLineHeight(valueOrDefault(options.lineHeight, fallback2.lineHeight), size2),
    size: size2,
    style: style2,
    weight: valueOrDefault(options.weight, fallback2.weight),
    string: ""
  };
  font.string = toFontString(font);
  return font;
}
function resolve(inputs, context, index2, info2) {
  let i2, ilen, value2;
  for (i2 = 0, ilen = inputs.length; i2 < ilen; ++i2) {
    value2 = inputs[i2];
    if (value2 === void 0) {
      continue;
    }
    if (value2 !== void 0) {
      return value2;
    }
  }
}
function _addGrace(minmax, grace, beginAtZero) {
  const { min: min2, max: max2 } = minmax;
  const change = toDimension(grace, (max2 - min2) / 2);
  const keepZero = (value2, add2) => beginAtZero && value2 === 0 ? 0 : value2 + add2;
  return {
    min: keepZero(min2, -Math.abs(change)),
    max: keepZero(max2, change)
  };
}
function createContext(parentContext, context) {
  return Object.assign(Object.create(parentContext), context);
}
function _createResolver(scopes, prefixes = [
  ""
], rootScopes, fallback2, getTarget = () => scopes[0]) {
  const finalRootScopes = rootScopes || scopes;
  if (typeof fallback2 === "undefined") {
    fallback2 = _resolve("_fallback", scopes);
  }
  const cache2 = {
    [Symbol.toStringTag]: "Object",
    _cacheable: true,
    _scopes: scopes,
    _rootScopes: finalRootScopes,
    _fallback: fallback2,
    _getTarget: getTarget,
    override: (scope) => _createResolver([
      scope,
      ...scopes
    ], prefixes, finalRootScopes, fallback2)
  };
  return new Proxy(cache2, {
    /**
    * A trap for the delete operator.
    */
    deleteProperty(target, prop) {
      delete target[prop];
      delete target._keys;
      delete scopes[0][prop];
      return true;
    },
    /**
    * A trap for getting property values.
    */
    get(target, prop) {
      return _cached(target, prop, () => _resolveWithPrefixes(prop, prefixes, scopes, target));
    },
    /**
    * A trap for Object.getOwnPropertyDescriptor.
    * Also used by Object.hasOwnProperty.
    */
    getOwnPropertyDescriptor(target, prop) {
      return Reflect.getOwnPropertyDescriptor(target._scopes[0], prop);
    },
    /**
    * A trap for Object.getPrototypeOf.
    */
    getPrototypeOf() {
      return Reflect.getPrototypeOf(scopes[0]);
    },
    /**
    * A trap for the in operator.
    */
    has(target, prop) {
      return getKeysFromAllScopes(target).includes(prop);
    },
    /**
    * A trap for Object.getOwnPropertyNames and Object.getOwnPropertySymbols.
    */
    ownKeys(target) {
      return getKeysFromAllScopes(target);
    },
    /**
    * A trap for setting property values.
    */
    set(target, prop, value2) {
      const storage = target._storage || (target._storage = getTarget());
      target[prop] = storage[prop] = value2;
      delete target._keys;
      return true;
    }
  });
}
function _attachContext(proxy, context, subProxy, descriptorDefaults) {
  const cache2 = {
    _cacheable: false,
    _proxy: proxy,
    _context: context,
    _subProxy: subProxy,
    _stack: /* @__PURE__ */ new Set(),
    _descriptors: _descriptors(proxy, descriptorDefaults),
    setContext: (ctx) => _attachContext(proxy, ctx, subProxy, descriptorDefaults),
    override: (scope) => _attachContext(proxy.override(scope), context, subProxy, descriptorDefaults)
  };
  return new Proxy(cache2, {
    /**
    * A trap for the delete operator.
    */
    deleteProperty(target, prop) {
      delete target[prop];
      delete proxy[prop];
      return true;
    },
    /**
    * A trap for getting property values.
    */
    get(target, prop, receiver) {
      return _cached(target, prop, () => _resolveWithContext(target, prop, receiver));
    },
    /**
    * A trap for Object.getOwnPropertyDescriptor.
    * Also used by Object.hasOwnProperty.
    */
    getOwnPropertyDescriptor(target, prop) {
      return target._descriptors.allKeys ? Reflect.has(proxy, prop) ? {
        enumerable: true,
        configurable: true
      } : void 0 : Reflect.getOwnPropertyDescriptor(proxy, prop);
    },
    /**
    * A trap for Object.getPrototypeOf.
    */
    getPrototypeOf() {
      return Reflect.getPrototypeOf(proxy);
    },
    /**
    * A trap for the in operator.
    */
    has(target, prop) {
      return Reflect.has(proxy, prop);
    },
    /**
    * A trap for Object.getOwnPropertyNames and Object.getOwnPropertySymbols.
    */
    ownKeys() {
      return Reflect.ownKeys(proxy);
    },
    /**
    * A trap for setting property values.
    */
    set(target, prop, value2) {
      proxy[prop] = value2;
      delete target[prop];
      return true;
    }
  });
}
function _descriptors(proxy, defaults2 = {
  scriptable: true,
  indexable: true
}) {
  const { _scriptable = defaults2.scriptable, _indexable = defaults2.indexable, _allKeys = defaults2.allKeys } = proxy;
  return {
    allKeys: _allKeys,
    scriptable: _scriptable,
    indexable: _indexable,
    isScriptable: isFunction$3(_scriptable) ? _scriptable : () => _scriptable,
    isIndexable: isFunction$3(_indexable) ? _indexable : () => _indexable
  };
}
const readKey = (prefix, name2) => prefix ? prefix + _capitalize(name2) : name2;
const needsSubResolver = (prop, value2) => isObject$3(value2) && prop !== "adapters" && (Object.getPrototypeOf(value2) === null || value2.constructor === Object);
function _cached(target, prop, resolve2) {
  if (Object.prototype.hasOwnProperty.call(target, prop) || prop === "constructor") {
    return target[prop];
  }
  const value2 = resolve2();
  target[prop] = value2;
  return value2;
}
function _resolveWithContext(target, prop, receiver) {
  const { _proxy, _context, _subProxy, _descriptors: descriptors2 } = target;
  let value2 = _proxy[prop];
  if (isFunction$3(value2) && descriptors2.isScriptable(prop)) {
    value2 = _resolveScriptable(prop, value2, target, receiver);
  }
  if (isArray$4(value2) && value2.length) {
    value2 = _resolveArray(prop, value2, target, descriptors2.isIndexable);
  }
  if (needsSubResolver(prop, value2)) {
    value2 = _attachContext(value2, _context, _subProxy && _subProxy[prop], descriptors2);
  }
  return value2;
}
function _resolveScriptable(prop, getValue2, target, receiver) {
  const { _proxy, _context, _subProxy, _stack } = target;
  if (_stack.has(prop)) {
    throw new Error("Recursion detected: " + Array.from(_stack).join("->") + "->" + prop);
  }
  _stack.add(prop);
  let value2 = getValue2(_context, _subProxy || receiver);
  _stack.delete(prop);
  if (needsSubResolver(prop, value2)) {
    value2 = createSubResolver(_proxy._scopes, _proxy, prop, value2);
  }
  return value2;
}
function _resolveArray(prop, value2, target, isIndexable) {
  const { _proxy, _context, _subProxy, _descriptors: descriptors2 } = target;
  if (typeof _context.index !== "undefined" && isIndexable(prop)) {
    return value2[_context.index % value2.length];
  } else if (isObject$3(value2[0])) {
    const arr = value2;
    const scopes = _proxy._scopes.filter((s2) => s2 !== arr);
    value2 = [];
    for (const item of arr) {
      const resolver2 = createSubResolver(scopes, _proxy, prop, item);
      value2.push(_attachContext(resolver2, _context, _subProxy && _subProxy[prop], descriptors2));
    }
  }
  return value2;
}
function resolveFallback(fallback2, prop, value2) {
  return isFunction$3(fallback2) ? fallback2(prop, value2) : fallback2;
}
const getScope = (key, parent) => key === true ? parent : typeof key === "string" ? resolveObjectKey(parent, key) : void 0;
function addScopes(set2, parentScopes, key, parentFallback, value2) {
  for (const parent of parentScopes) {
    const scope = getScope(key, parent);
    if (scope) {
      set2.add(scope);
      const fallback2 = resolveFallback(scope._fallback, key, value2);
      if (typeof fallback2 !== "undefined" && fallback2 !== key && fallback2 !== parentFallback) {
        return fallback2;
      }
    } else if (scope === false && typeof parentFallback !== "undefined" && key !== parentFallback) {
      return null;
    }
  }
  return false;
}
function createSubResolver(parentScopes, resolver2, prop, value2) {
  const rootScopes = resolver2._rootScopes;
  const fallback2 = resolveFallback(resolver2._fallback, prop, value2);
  const allScopes = [
    ...parentScopes,
    ...rootScopes
  ];
  const set2 = /* @__PURE__ */ new Set();
  set2.add(value2);
  let key = addScopesFromKey(set2, allScopes, prop, fallback2 || prop, value2);
  if (key === null) {
    return false;
  }
  if (typeof fallback2 !== "undefined" && fallback2 !== prop) {
    key = addScopesFromKey(set2, allScopes, fallback2, key, value2);
    if (key === null) {
      return false;
    }
  }
  return _createResolver(Array.from(set2), [
    ""
  ], rootScopes, fallback2, () => subGetTarget(resolver2, prop, value2));
}
function addScopesFromKey(set2, allScopes, key, fallback2, item) {
  while (key) {
    key = addScopes(set2, allScopes, key, fallback2, item);
  }
  return key;
}
function subGetTarget(resolver2, prop, value2) {
  const parent = resolver2._getTarget();
  if (!(prop in parent)) {
    parent[prop] = {};
  }
  const target = parent[prop];
  if (isArray$4(target) && isObject$3(value2)) {
    return value2;
  }
  return target || {};
}
function _resolveWithPrefixes(prop, prefixes, scopes, proxy) {
  let value2;
  for (const prefix of prefixes) {
    value2 = _resolve(readKey(prefix, prop), scopes);
    if (typeof value2 !== "undefined") {
      return needsSubResolver(prop, value2) ? createSubResolver(scopes, proxy, prop, value2) : value2;
    }
  }
}
function _resolve(key, scopes) {
  for (const scope of scopes) {
    if (!scope) {
      continue;
    }
    const value2 = scope[key];
    if (typeof value2 !== "undefined") {
      return value2;
    }
  }
}
function getKeysFromAllScopes(target) {
  let keys2 = target._keys;
  if (!keys2) {
    keys2 = target._keys = resolveKeysFromAllScopes(target._scopes);
  }
  return keys2;
}
function resolveKeysFromAllScopes(scopes) {
  const set2 = /* @__PURE__ */ new Set();
  for (const scope of scopes) {
    for (const key of Object.keys(scope).filter((k2) => !k2.startsWith("_"))) {
      set2.add(key);
    }
  }
  return Array.from(set2);
}
const EPSILON = Number.EPSILON || 1e-14;
const getPoint = (points, i2) => i2 < points.length && !points[i2].skip && points[i2];
const getValueAxis = (indexAxis) => indexAxis === "x" ? "y" : "x";
function splineCurve(firstPoint, middlePoint, afterPoint, t2) {
  const previous2 = firstPoint.skip ? middlePoint : firstPoint;
  const current = middlePoint;
  const next2 = afterPoint.skip ? middlePoint : afterPoint;
  const d01 = distanceBetweenPoints(current, previous2);
  const d12 = distanceBetweenPoints(next2, current);
  let s01 = d01 / (d01 + d12);
  let s12 = d12 / (d01 + d12);
  s01 = isNaN(s01) ? 0 : s01;
  s12 = isNaN(s12) ? 0 : s12;
  const fa2 = t2 * s01;
  const fb2 = t2 * s12;
  return {
    previous: {
      x: current.x - fa2 * (next2.x - previous2.x),
      y: current.y - fa2 * (next2.y - previous2.y)
    },
    next: {
      x: current.x + fb2 * (next2.x - previous2.x),
      y: current.y + fb2 * (next2.y - previous2.y)
    }
  };
}
function monotoneAdjust(points, deltaK, mK) {
  const pointsLen = points.length;
  let alphaK, betaK, tauK, squaredMagnitude, pointCurrent;
  let pointAfter = getPoint(points, 0);
  for (let i2 = 0; i2 < pointsLen - 1; ++i2) {
    pointCurrent = pointAfter;
    pointAfter = getPoint(points, i2 + 1);
    if (!pointCurrent || !pointAfter) {
      continue;
    }
    if (almostEquals(deltaK[i2], 0, EPSILON)) {
      mK[i2] = mK[i2 + 1] = 0;
      continue;
    }
    alphaK = mK[i2] / deltaK[i2];
    betaK = mK[i2 + 1] / deltaK[i2];
    squaredMagnitude = Math.pow(alphaK, 2) + Math.pow(betaK, 2);
    if (squaredMagnitude <= 9) {
      continue;
    }
    tauK = 3 / Math.sqrt(squaredMagnitude);
    mK[i2] = alphaK * tauK * deltaK[i2];
    mK[i2 + 1] = betaK * tauK * deltaK[i2];
  }
}
function monotoneCompute(points, mK, indexAxis = "x") {
  const valueAxis = getValueAxis(indexAxis);
  const pointsLen = points.length;
  let delta, pointBefore, pointCurrent;
  let pointAfter = getPoint(points, 0);
  for (let i2 = 0; i2 < pointsLen; ++i2) {
    pointBefore = pointCurrent;
    pointCurrent = pointAfter;
    pointAfter = getPoint(points, i2 + 1);
    if (!pointCurrent) {
      continue;
    }
    const iPixel = pointCurrent[indexAxis];
    const vPixel = pointCurrent[valueAxis];
    if (pointBefore) {
      delta = (iPixel - pointBefore[indexAxis]) / 3;
      pointCurrent[`cp1${indexAxis}`] = iPixel - delta;
      pointCurrent[`cp1${valueAxis}`] = vPixel - delta * mK[i2];
    }
    if (pointAfter) {
      delta = (pointAfter[indexAxis] - iPixel) / 3;
      pointCurrent[`cp2${indexAxis}`] = iPixel + delta;
      pointCurrent[`cp2${valueAxis}`] = vPixel + delta * mK[i2];
    }
  }
}
function splineCurveMonotone(points, indexAxis = "x") {
  const valueAxis = getValueAxis(indexAxis);
  const pointsLen = points.length;
  const deltaK = Array(pointsLen).fill(0);
  const mK = Array(pointsLen);
  let i2, pointBefore, pointCurrent;
  let pointAfter = getPoint(points, 0);
  for (i2 = 0; i2 < pointsLen; ++i2) {
    pointBefore = pointCurrent;
    pointCurrent = pointAfter;
    pointAfter = getPoint(points, i2 + 1);
    if (!pointCurrent) {
      continue;
    }
    if (pointAfter) {
      const slopeDelta = pointAfter[indexAxis] - pointCurrent[indexAxis];
      deltaK[i2] = slopeDelta !== 0 ? (pointAfter[valueAxis] - pointCurrent[valueAxis]) / slopeDelta : 0;
    }
    mK[i2] = !pointBefore ? deltaK[i2] : !pointAfter ? deltaK[i2 - 1] : sign$1(deltaK[i2 - 1]) !== sign$1(deltaK[i2]) ? 0 : (deltaK[i2 - 1] + deltaK[i2]) / 2;
  }
  monotoneAdjust(points, deltaK, mK);
  monotoneCompute(points, mK, indexAxis);
}
function capControlPoint(pt, min2, max2) {
  return Math.max(Math.min(pt, max2), min2);
}
function capBezierPoints(points, area) {
  let i2, ilen, point2, inArea, inAreaPrev;
  let inAreaNext = _isPointInArea(points[0], area);
  for (i2 = 0, ilen = points.length; i2 < ilen; ++i2) {
    inAreaPrev = inArea;
    inArea = inAreaNext;
    inAreaNext = i2 < ilen - 1 && _isPointInArea(points[i2 + 1], area);
    if (!inArea) {
      continue;
    }
    point2 = points[i2];
    if (inAreaPrev) {
      point2.cp1x = capControlPoint(point2.cp1x, area.left, area.right);
      point2.cp1y = capControlPoint(point2.cp1y, area.top, area.bottom);
    }
    if (inAreaNext) {
      point2.cp2x = capControlPoint(point2.cp2x, area.left, area.right);
      point2.cp2y = capControlPoint(point2.cp2y, area.top, area.bottom);
    }
  }
}
function _updateBezierControlPoints(points, options, area, loop2, indexAxis) {
  let i2, ilen, point2, controlPoints;
  if (options.spanGaps) {
    points = points.filter((pt) => !pt.skip);
  }
  if (options.cubicInterpolationMode === "monotone") {
    splineCurveMonotone(points, indexAxis);
  } else {
    let prev2 = loop2 ? points[points.length - 1] : points[0];
    for (i2 = 0, ilen = points.length; i2 < ilen; ++i2) {
      point2 = points[i2];
      controlPoints = splineCurve(prev2, point2, points[Math.min(i2 + 1, ilen - (loop2 ? 0 : 1)) % ilen], options.tension);
      point2.cp1x = controlPoints.previous.x;
      point2.cp1y = controlPoints.previous.y;
      point2.cp2x = controlPoints.next.x;
      point2.cp2y = controlPoints.next.y;
      prev2 = point2;
    }
  }
  if (options.capBezierPoints) {
    capBezierPoints(points, area);
  }
}
function _isDomSupported() {
  return typeof window !== "undefined" && typeof document !== "undefined";
}
function _getParentNode(domNode) {
  let parent = domNode.parentNode;
  if (parent && parent.toString() === "[object ShadowRoot]") {
    parent = parent.host;
  }
  return parent;
}
function parseMaxStyle(styleValue, node2, parentProperty) {
  let valueInPixels;
  if (typeof styleValue === "string") {
    valueInPixels = parseInt(styleValue, 10);
    if (styleValue.indexOf("%") !== -1) {
      valueInPixels = valueInPixels / 100 * node2.parentNode[parentProperty];
    }
  } else {
    valueInPixels = styleValue;
  }
  return valueInPixels;
}
const getComputedStyle$1 = (element2) => element2.ownerDocument.defaultView.getComputedStyle(element2, null);
function getStyle(el2, property2) {
  return getComputedStyle$1(el2).getPropertyValue(property2);
}
const positions = [
  "top",
  "right",
  "bottom",
  "left"
];
function getPositionedStyle(styles2, style2, suffix) {
  const result = {};
  suffix = suffix ? "-" + suffix : "";
  for (let i2 = 0; i2 < 4; i2++) {
    const pos = positions[i2];
    result[pos] = parseFloat(styles2[style2 + "-" + pos + suffix]) || 0;
  }
  result.width = result.left + result.right;
  result.height = result.top + result.bottom;
  return result;
}
const useOffsetPos = (x2, y2, target) => (x2 > 0 || y2 > 0) && (!target || !target.shadowRoot);
function getCanvasPosition(e2, canvas) {
  const touches = e2.touches;
  const source2 = touches && touches.length ? touches[0] : e2;
  const { offsetX, offsetY } = source2;
  let box = false;
  let x2, y2;
  if (useOffsetPos(offsetX, offsetY, e2.target)) {
    x2 = offsetX;
    y2 = offsetY;
  } else {
    const rect = canvas.getBoundingClientRect();
    x2 = source2.clientX - rect.left;
    y2 = source2.clientY - rect.top;
    box = true;
  }
  return {
    x: x2,
    y: y2,
    box
  };
}
function getRelativePosition(event, chart) {
  if ("native" in event) {
    return event;
  }
  const { canvas, currentDevicePixelRatio } = chart;
  const style2 = getComputedStyle$1(canvas);
  const borderBox = style2.boxSizing === "border-box";
  const paddings = getPositionedStyle(style2, "padding");
  const borders2 = getPositionedStyle(style2, "border", "width");
  const { x: x2, y: y2, box } = getCanvasPosition(event, canvas);
  const xOffset = paddings.left + (box && borders2.left);
  const yOffset = paddings.top + (box && borders2.top);
  let { width, height } = chart;
  if (borderBox) {
    width -= paddings.width + borders2.width;
    height -= paddings.height + borders2.height;
  }
  return {
    x: Math.round((x2 - xOffset) / width * canvas.width / currentDevicePixelRatio),
    y: Math.round((y2 - yOffset) / height * canvas.height / currentDevicePixelRatio)
  };
}
function getContainerSize(canvas, width, height) {
  let maxWidth, maxHeight;
  if (width === void 0 || height === void 0) {
    const container = canvas && _getParentNode(canvas);
    if (!container) {
      width = canvas.clientWidth;
      height = canvas.clientHeight;
    } else {
      const rect = container.getBoundingClientRect();
      const containerStyle = getComputedStyle$1(container);
      const containerBorder = getPositionedStyle(containerStyle, "border", "width");
      const containerPadding = getPositionedStyle(containerStyle, "padding");
      width = rect.width - containerPadding.width - containerBorder.width;
      height = rect.height - containerPadding.height - containerBorder.height;
      maxWidth = parseMaxStyle(containerStyle.maxWidth, container, "clientWidth");
      maxHeight = parseMaxStyle(containerStyle.maxHeight, container, "clientHeight");
    }
  }
  return {
    width,
    height,
    maxWidth: maxWidth || INFINITY,
    maxHeight: maxHeight || INFINITY
  };
}
const round1 = (v2) => Math.round(v2 * 10) / 10;
function getMaximumSize(canvas, bbWidth, bbHeight, aspectRatio2) {
  const style2 = getComputedStyle$1(canvas);
  const margins = getPositionedStyle(style2, "margin");
  const maxWidth = parseMaxStyle(style2.maxWidth, canvas, "clientWidth") || INFINITY;
  const maxHeight = parseMaxStyle(style2.maxHeight, canvas, "clientHeight") || INFINITY;
  const containerSize = getContainerSize(canvas, bbWidth, bbHeight);
  let { width, height } = containerSize;
  if (style2.boxSizing === "content-box") {
    const borders2 = getPositionedStyle(style2, "border", "width");
    const paddings = getPositionedStyle(style2, "padding");
    width -= paddings.width + borders2.width;
    height -= paddings.height + borders2.height;
  }
  width = Math.max(0, width - margins.width);
  height = Math.max(0, aspectRatio2 ? width / aspectRatio2 : height - margins.height);
  width = round1(Math.min(width, maxWidth, containerSize.maxWidth));
  height = round1(Math.min(height, maxHeight, containerSize.maxHeight));
  if (width && !height) {
    height = round1(width / 2);
  }
  const maintainHeight = bbWidth !== void 0 || bbHeight !== void 0;
  if (maintainHeight && aspectRatio2 && containerSize.height && height > containerSize.height) {
    height = containerSize.height;
    width = round1(Math.floor(height * aspectRatio2));
  }
  return {
    width,
    height
  };
}
function retinaScale(chart, forceRatio, forceStyle) {
  const pixelRatio = forceRatio || 1;
  const deviceHeight = Math.floor(chart.height * pixelRatio);
  const deviceWidth = Math.floor(chart.width * pixelRatio);
  chart.height = Math.floor(chart.height);
  chart.width = Math.floor(chart.width);
  const canvas = chart.canvas;
  if (canvas.style && (forceStyle || !canvas.style.height && !canvas.style.width)) {
    canvas.style.height = `${chart.height}px`;
    canvas.style.width = `${chart.width}px`;
  }
  if (chart.currentDevicePixelRatio !== pixelRatio || canvas.height !== deviceHeight || canvas.width !== deviceWidth) {
    chart.currentDevicePixelRatio = pixelRatio;
    canvas.height = deviceHeight;
    canvas.width = deviceWidth;
    chart.ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
    return true;
  }
  return false;
}
const supportsEventListenerOptions = function() {
  let passiveSupported = false;
  try {
    const options = {
      get passive() {
        passiveSupported = true;
        return false;
      }
    };
    if (_isDomSupported()) {
      window.addEventListener("test", null, options);
      window.removeEventListener("test", null, options);
    }
  } catch (e2) {
  }
  return passiveSupported;
}();
function readUsedSize(element2, property2) {
  const value2 = getStyle(element2, property2);
  const matches = value2 && value2.match(/^(\d+)(\.\d+)?px$/);
  return matches ? +matches[1] : void 0;
}
function _pointInLine(p1, p2, t2, mode) {
  return {
    x: p1.x + t2 * (p2.x - p1.x),
    y: p1.y + t2 * (p2.y - p1.y)
  };
}
function _steppedInterpolation(p1, p2, t2, mode) {
  return {
    x: p1.x + t2 * (p2.x - p1.x),
    y: mode === "middle" ? t2 < 0.5 ? p1.y : p2.y : mode === "after" ? t2 < 1 ? p1.y : p2.y : t2 > 0 ? p2.y : p1.y
  };
}
function _bezierInterpolation(p1, p2, t2, mode) {
  const cp1 = {
    x: p1.cp2x,
    y: p1.cp2y
  };
  const cp2 = {
    x: p2.cp1x,
    y: p2.cp1y
  };
  const a2 = _pointInLine(p1, cp1, t2);
  const b2 = _pointInLine(cp1, cp2, t2);
  const c2 = _pointInLine(cp2, p2, t2);
  const d2 = _pointInLine(a2, b2, t2);
  const e2 = _pointInLine(b2, c2, t2);
  return _pointInLine(d2, e2, t2);
}
const getRightToLeftAdapter = function(rectX, width) {
  return {
    x(x2) {
      return rectX + rectX + width - x2;
    },
    setWidth(w2) {
      width = w2;
    },
    textAlign(align) {
      if (align === "center") {
        return align;
      }
      return align === "right" ? "left" : "right";
    },
    xPlus(x2, value2) {
      return x2 - value2;
    },
    leftForLtr(x2, itemWidth) {
      return x2 - itemWidth;
    }
  };
};
const getLeftToRightAdapter = function() {
  return {
    x(x2) {
      return x2;
    },
    setWidth(w2) {
    },
    textAlign(align) {
      return align;
    },
    xPlus(x2, value2) {
      return x2 + value2;
    },
    leftForLtr(x2, _itemWidth) {
      return x2;
    }
  };
};
function getRtlAdapter(rtl, rectX, width) {
  return rtl ? getRightToLeftAdapter(rectX, width) : getLeftToRightAdapter();
}
function overrideTextDirection(ctx, direction) {
  let style2, original2;
  if (direction === "ltr" || direction === "rtl") {
    style2 = ctx.canvas.style;
    original2 = [
      style2.getPropertyValue("direction"),
      style2.getPropertyPriority("direction")
    ];
    style2.setProperty("direction", direction, "important");
    ctx.prevTextDirection = original2;
  }
}
function restoreTextDirection(ctx, original2) {
  if (original2 !== void 0) {
    delete ctx.prevTextDirection;
    ctx.canvas.style.setProperty("direction", original2[0], original2[1]);
  }
}
function propertyFn(property2) {
  if (property2 === "angle") {
    return {
      between: _angleBetween,
      compare: _angleDiff,
      normalize: _normalizeAngle
    };
  }
  return {
    between: _isBetween,
    compare: (a2, b2) => a2 - b2,
    normalize: (x2) => x2
  };
}
function normalizeSegment({ start: start2, end: end2, count, loop: loop2, style: style2 }) {
  return {
    start: start2 % count,
    end: end2 % count,
    loop: loop2 && (end2 - start2 + 1) % count === 0,
    style: style2
  };
}
function getSegment(segment, points, bounds2) {
  const { property: property2, start: startBound, end: endBound } = bounds2;
  const { between, normalize: normalize2 } = propertyFn(property2);
  const count = points.length;
  let { start: start2, end: end2, loop: loop2 } = segment;
  let i2, ilen;
  if (loop2) {
    start2 += count;
    end2 += count;
    for (i2 = 0, ilen = count; i2 < ilen; ++i2) {
      if (!between(normalize2(points[start2 % count][property2]), startBound, endBound)) {
        break;
      }
      start2--;
      end2--;
    }
    start2 %= count;
    end2 %= count;
  }
  if (end2 < start2) {
    end2 += count;
  }
  return {
    start: start2,
    end: end2,
    loop: loop2,
    style: segment.style
  };
}
function _boundSegment(segment, points, bounds2) {
  if (!bounds2) {
    return [
      segment
    ];
  }
  const { property: property2, start: startBound, end: endBound } = bounds2;
  const count = points.length;
  const { compare, between, normalize: normalize2 } = propertyFn(property2);
  const { start: start2, end: end2, loop: loop2, style: style2 } = getSegment(segment, points, bounds2);
  const result = [];
  let inside = false;
  let subStart = null;
  let value2, point2, prevValue;
  const startIsBefore = () => between(startBound, prevValue, value2) && compare(startBound, prevValue) !== 0;
  const endIsBefore = () => compare(endBound, value2) === 0 || between(endBound, prevValue, value2);
  const shouldStart = () => inside || startIsBefore();
  const shouldStop = () => !inside || endIsBefore();
  for (let i2 = start2, prev2 = start2; i2 <= end2; ++i2) {
    point2 = points[i2 % count];
    if (point2.skip) {
      continue;
    }
    value2 = normalize2(point2[property2]);
    if (value2 === prevValue) {
      continue;
    }
    inside = between(value2, startBound, endBound);
    if (subStart === null && shouldStart()) {
      subStart = compare(value2, startBound) === 0 ? i2 : prev2;
    }
    if (subStart !== null && shouldStop()) {
      result.push(normalizeSegment({
        start: subStart,
        end: i2,
        loop: loop2,
        count,
        style: style2
      }));
      subStart = null;
    }
    prev2 = i2;
    prevValue = value2;
  }
  if (subStart !== null) {
    result.push(normalizeSegment({
      start: subStart,
      end: end2,
      loop: loop2,
      count,
      style: style2
    }));
  }
  return result;
}
function _boundSegments(line2, bounds2) {
  const result = [];
  const segments = line2.segments;
  for (let i2 = 0; i2 < segments.length; i2++) {
    const sub = _boundSegment(segments[i2], line2.points, bounds2);
    if (sub.length) {
      result.push(...sub);
    }
  }
  return result;
}
function findStartAndEnd(points, count, loop2, spanGaps) {
  let start2 = 0;
  let end2 = count - 1;
  if (loop2 && !spanGaps) {
    while (start2 < count && !points[start2].skip) {
      start2++;
    }
  }
  while (start2 < count && points[start2].skip) {
    start2++;
  }
  start2 %= count;
  if (loop2) {
    end2 += start2;
  }
  while (end2 > start2 && points[end2 % count].skip) {
    end2--;
  }
  end2 %= count;
  return {
    start: start2,
    end: end2
  };
}
function solidSegments(points, start2, max2, loop2) {
  const count = points.length;
  const result = [];
  let last = start2;
  let prev2 = points[start2];
  let end2;
  for (end2 = start2 + 1; end2 <= max2; ++end2) {
    const cur = points[end2 % count];
    if (cur.skip || cur.stop) {
      if (!prev2.skip) {
        loop2 = false;
        result.push({
          start: start2 % count,
          end: (end2 - 1) % count,
          loop: loop2
        });
        start2 = last = cur.stop ? end2 : null;
      }
    } else {
      last = end2;
      if (prev2.skip) {
        start2 = end2;
      }
    }
    prev2 = cur;
  }
  if (last !== null) {
    result.push({
      start: start2 % count,
      end: last % count,
      loop: loop2
    });
  }
  return result;
}
function _computeSegments(line2, segmentOptions) {
  const points = line2.points;
  const spanGaps = line2.options.spanGaps;
  const count = points.length;
  if (!count) {
    return [];
  }
  const loop2 = !!line2._loop;
  const { start: start2, end: end2 } = findStartAndEnd(points, count, loop2, spanGaps);
  if (spanGaps === true) {
    return splitByStyles(line2, [
      {
        start: start2,
        end: end2,
        loop: loop2
      }
    ], points, segmentOptions);
  }
  const max2 = end2 < start2 ? end2 + count : end2;
  const completeLoop = !!line2._fullLoop && start2 === 0 && end2 === count - 1;
  return splitByStyles(line2, solidSegments(points, start2, max2, completeLoop), points, segmentOptions);
}
function splitByStyles(line2, segments, points, segmentOptions) {
  if (!segmentOptions || !segmentOptions.setContext || !points) {
    return segments;
  }
  return doSplitByStyles(line2, segments, points, segmentOptions);
}
function doSplitByStyles(line2, segments, points, segmentOptions) {
  const chartContext = line2._chart.getContext();
  const baseStyle = readStyle(line2.options);
  const { _datasetIndex: datasetIndex, options: { spanGaps } } = line2;
  const count = points.length;
  const result = [];
  let prevStyle = baseStyle;
  let start2 = segments[0].start;
  let i2 = start2;
  function addStyle(s2, e2, l2, st) {
    const dir = spanGaps ? -1 : 1;
    if (s2 === e2) {
      return;
    }
    s2 += count;
    while (points[s2 % count].skip) {
      s2 -= dir;
    }
    while (points[e2 % count].skip) {
      e2 += dir;
    }
    if (s2 % count !== e2 % count) {
      result.push({
        start: s2 % count,
        end: e2 % count,
        loop: l2,
        style: st
      });
      prevStyle = st;
      start2 = e2 % count;
    }
  }
  for (const segment of segments) {
    start2 = spanGaps ? start2 : segment.start;
    let prev2 = points[start2 % count];
    let style2;
    for (i2 = start2 + 1; i2 <= segment.end; i2++) {
      const pt = points[i2 % count];
      style2 = readStyle(segmentOptions.setContext(createContext(chartContext, {
        type: "segment",
        p0: prev2,
        p1: pt,
        p0DataIndex: (i2 - 1) % count,
        p1DataIndex: i2 % count,
        datasetIndex
      })));
      if (styleChanged(style2, prevStyle)) {
        addStyle(start2, i2 - 1, segment.loop, prevStyle);
      }
      prev2 = pt;
      prevStyle = style2;
    }
    if (start2 < i2 - 1) {
      addStyle(start2, i2 - 1, segment.loop, prevStyle);
    }
  }
  return result;
}
function readStyle(options) {
  return {
    backgroundColor: options.backgroundColor,
    borderCapStyle: options.borderCapStyle,
    borderDash: options.borderDash,
    borderDashOffset: options.borderDashOffset,
    borderJoinStyle: options.borderJoinStyle,
    borderWidth: options.borderWidth,
    borderColor: options.borderColor
  };
}
function styleChanged(style2, prevStyle) {
  if (!prevStyle) {
    return false;
  }
  const cache2 = [];
  const replacer = function(key, value2) {
    if (!isPatternOrGradient(value2)) {
      return value2;
    }
    if (!cache2.includes(value2)) {
      cache2.push(value2);
    }
    return cache2.indexOf(value2);
  };
  return JSON.stringify(style2, replacer) !== JSON.stringify(prevStyle, replacer);
}
function getSizeForArea(scale2, chartArea, field) {
  return scale2.options.clip ? scale2[field] : chartArea[field];
}
function getDatasetArea(meta, chartArea) {
  const { xScale, yScale } = meta;
  if (xScale && yScale) {
    return {
      left: getSizeForArea(xScale, chartArea, "left"),
      right: getSizeForArea(xScale, chartArea, "right"),
      top: getSizeForArea(yScale, chartArea, "top"),
      bottom: getSizeForArea(yScale, chartArea, "bottom")
    };
  }
  return chartArea;
}
function getDatasetClipArea(chart, meta) {
  const clip = meta._clip;
  if (clip.disabled) {
    return false;
  }
  const area = getDatasetArea(meta, chart.chartArea);
  return {
    left: clip.left === false ? 0 : area.left - (clip.left === true ? 0 : clip.left),
    right: clip.right === false ? chart.width : area.right + (clip.right === true ? 0 : clip.right),
    top: clip.top === false ? 0 : area.top - (clip.top === true ? 0 : clip.top),
    bottom: clip.bottom === false ? chart.height : area.bottom + (clip.bottom === true ? 0 : clip.bottom)
  };
}
/*!
 * Chart.js v4.5.0
 * https://www.chartjs.org
 * (c) 2025 Chart.js Contributors
 * Released under the MIT License
 */
class Animator {
  constructor() {
    this._request = null;
    this._charts = /* @__PURE__ */ new Map();
    this._running = false;
    this._lastDate = void 0;
  }
  _notify(chart, anims, date4, type4) {
    const callbacks = anims.listeners[type4];
    const numSteps = anims.duration;
    callbacks.forEach((fn) => fn({
      chart,
      initial: anims.initial,
      numSteps,
      currentStep: Math.min(date4 - anims.start, numSteps)
    }));
  }
  _refresh() {
    if (this._request) {
      return;
    }
    this._running = true;
    this._request = requestAnimFrame.call(window, () => {
      this._update();
      this._request = null;
      if (this._running) {
        this._refresh();
      }
    });
  }
  _update(date4 = Date.now()) {
    let remaining = 0;
    this._charts.forEach((anims, chart) => {
      if (!anims.running || !anims.items.length) {
        return;
      }
      const items = anims.items;
      let i2 = items.length - 1;
      let draw2 = false;
      let item;
      for (; i2 >= 0; --i2) {
        item = items[i2];
        if (item._active) {
          if (item._total > anims.duration) {
            anims.duration = item._total;
          }
          item.tick(date4);
          draw2 = true;
        } else {
          items[i2] = items[items.length - 1];
          items.pop();
        }
      }
      if (draw2) {
        chart.draw();
        this._notify(chart, anims, date4, "progress");
      }
      if (!items.length) {
        anims.running = false;
        this._notify(chart, anims, date4, "complete");
        anims.initial = false;
      }
      remaining += items.length;
    });
    this._lastDate = date4;
    if (remaining === 0) {
      this._running = false;
    }
  }
  _getAnims(chart) {
    const charts = this._charts;
    let anims = charts.get(chart);
    if (!anims) {
      anims = {
        running: false,
        initial: true,
        items: [],
        listeners: {
          complete: [],
          progress: []
        }
      };
      charts.set(chart, anims);
    }
    return anims;
  }
  listen(chart, event, cb2) {
    this._getAnims(chart).listeners[event].push(cb2);
  }
  add(chart, items) {
    if (!items || !items.length) {
      return;
    }
    this._getAnims(chart).items.push(...items);
  }
  has(chart) {
    return this._getAnims(chart).items.length > 0;
  }
  start(chart) {
    const anims = this._charts.get(chart);
    if (!anims) {
      return;
    }
    anims.running = true;
    anims.start = Date.now();
    anims.duration = anims.items.reduce((acc, cur) => Math.max(acc, cur._duration), 0);
    this._refresh();
  }
  running(chart) {
    if (!this._running) {
      return false;
    }
    const anims = this._charts.get(chart);
    if (!anims || !anims.running || !anims.items.length) {
      return false;
    }
    return true;
  }
  stop(chart) {
    const anims = this._charts.get(chart);
    if (!anims || !anims.items.length) {
      return;
    }
    const items = anims.items;
    let i2 = items.length - 1;
    for (; i2 >= 0; --i2) {
      items[i2].cancel();
    }
    anims.items = [];
    this._notify(chart, anims, Date.now(), "complete");
  }
  remove(chart) {
    return this._charts.delete(chart);
  }
}
var animator = /* @__PURE__ */ new Animator();
const transparent = "transparent";
const interpolators = {
  boolean(from2, to2, factor) {
    return factor > 0.5 ? to2 : from2;
  },
  color(from2, to2, factor) {
    const c0 = color$1(from2 || transparent);
    const c1 = c0.valid && color$1(to2 || transparent);
    return c1 && c1.valid ? c1.mix(c0, factor).hexString() : to2;
  },
  number(from2, to2, factor) {
    return from2 + (to2 - from2) * factor;
  }
};
class Animation {
  constructor(cfg, target, prop, to2) {
    const currentValue = target[prop];
    to2 = resolve([
      cfg.to,
      to2,
      currentValue,
      cfg.from
    ]);
    const from2 = resolve([
      cfg.from,
      currentValue,
      to2
    ]);
    this._active = true;
    this._fn = cfg.fn || interpolators[cfg.type || typeof from2];
    this._easing = effects[cfg.easing] || effects.linear;
    this._start = Math.floor(Date.now() + (cfg.delay || 0));
    this._duration = this._total = Math.floor(cfg.duration);
    this._loop = !!cfg.loop;
    this._target = target;
    this._prop = prop;
    this._from = from2;
    this._to = to2;
    this._promises = void 0;
  }
  active() {
    return this._active;
  }
  update(cfg, to2, date4) {
    if (this._active) {
      this._notify(false);
      const currentValue = this._target[this._prop];
      const elapsed = date4 - this._start;
      const remain = this._duration - elapsed;
      this._start = date4;
      this._duration = Math.floor(Math.max(remain, cfg.duration));
      this._total += elapsed;
      this._loop = !!cfg.loop;
      this._to = resolve([
        cfg.to,
        to2,
        currentValue,
        cfg.from
      ]);
      this._from = resolve([
        cfg.from,
        currentValue,
        to2
      ]);
    }
  }
  cancel() {
    if (this._active) {
      this.tick(Date.now());
      this._active = false;
      this._notify(false);
    }
  }
  tick(date4) {
    const elapsed = date4 - this._start;
    const duration2 = this._duration;
    const prop = this._prop;
    const from2 = this._from;
    const loop2 = this._loop;
    const to2 = this._to;
    let factor;
    this._active = from2 !== to2 && (loop2 || elapsed < duration2);
    if (!this._active) {
      this._target[prop] = to2;
      this._notify(true);
      return;
    }
    if (elapsed < 0) {
      this._target[prop] = from2;
      return;
    }
    factor = elapsed / duration2 % 2;
    factor = loop2 && factor > 1 ? 2 - factor : factor;
    factor = this._easing(Math.min(1, Math.max(0, factor)));
    this._target[prop] = this._fn(from2, to2, factor);
  }
  wait() {
    const promises = this._promises || (this._promises = []);
    return new Promise((res, rej) => {
      promises.push({
        res,
        rej
      });
    });
  }
  _notify(resolved) {
    const method4 = resolved ? "res" : "rej";
    const promises = this._promises || [];
    for (let i2 = 0; i2 < promises.length; i2++) {
      promises[i2][method4]();
    }
  }
}
class Animations {
  constructor(chart, config2) {
    this._chart = chart;
    this._properties = /* @__PURE__ */ new Map();
    this.configure(config2);
  }
  configure(config2) {
    if (!isObject$3(config2)) {
      return;
    }
    const animationOptions = Object.keys(defaults$2.animation);
    const animatedProps = this._properties;
    Object.getOwnPropertyNames(config2).forEach((key) => {
      const cfg = config2[key];
      if (!isObject$3(cfg)) {
        return;
      }
      const resolved = {};
      for (const option of animationOptions) {
        resolved[option] = cfg[option];
      }
      (isArray$4(cfg.properties) && cfg.properties || [
        key
      ]).forEach((prop) => {
        if (prop === key || !animatedProps.has(prop)) {
          animatedProps.set(prop, resolved);
        }
      });
    });
  }
  _animateOptions(target, values) {
    const newOptions = values.options;
    const options = resolveTargetOptions(target, newOptions);
    if (!options) {
      return [];
    }
    const animations2 = this._createAnimations(options, newOptions);
    if (newOptions.$shared) {
      awaitAll(target.options.$animations, newOptions).then(() => {
        target.options = newOptions;
      }, () => {
      });
    }
    return animations2;
  }
  _createAnimations(target, values) {
    const animatedProps = this._properties;
    const animations2 = [];
    const running = target.$animations || (target.$animations = {});
    const props = Object.keys(values);
    const date4 = Date.now();
    let i2;
    for (i2 = props.length - 1; i2 >= 0; --i2) {
      const prop = props[i2];
      if (prop.charAt(0) === "$") {
        continue;
      }
      if (prop === "options") {
        animations2.push(...this._animateOptions(target, values));
        continue;
      }
      const value2 = values[prop];
      let animation = running[prop];
      const cfg = animatedProps.get(prop);
      if (animation) {
        if (cfg && animation.active()) {
          animation.update(cfg, value2, date4);
          continue;
        } else {
          animation.cancel();
        }
      }
      if (!cfg || !cfg.duration) {
        target[prop] = value2;
        continue;
      }
      running[prop] = animation = new Animation(cfg, target, prop, value2);
      animations2.push(animation);
    }
    return animations2;
  }
  update(target, values) {
    if (this._properties.size === 0) {
      Object.assign(target, values);
      return;
    }
    const animations2 = this._createAnimations(target, values);
    if (animations2.length) {
      animator.add(this._chart, animations2);
      return true;
    }
  }
}
function awaitAll(animations2, properties2) {
  const running = [];
  const keys2 = Object.keys(properties2);
  for (let i2 = 0; i2 < keys2.length; i2++) {
    const anim = animations2[keys2[i2]];
    if (anim && anim.active()) {
      running.push(anim.wait());
    }
  }
  return Promise.all(running);
}
function resolveTargetOptions(target, newOptions) {
  if (!newOptions) {
    return;
  }
  let options = target.options;
  if (!options) {
    target.options = newOptions;
    return;
  }
  if (options.$shared) {
    target.options = options = Object.assign({}, options, {
      $shared: false,
      $animations: {}
    });
  }
  return options;
}
function scaleClip(scale2, allowedOverflow) {
  const opts2 = scale2 && scale2.options || {};
  const reverse = opts2.reverse;
  const min2 = opts2.min === void 0 ? allowedOverflow : 0;
  const max2 = opts2.max === void 0 ? allowedOverflow : 0;
  return {
    start: reverse ? max2 : min2,
    end: reverse ? min2 : max2
  };
}
function defaultClip(xScale, yScale, allowedOverflow) {
  if (allowedOverflow === false) {
    return false;
  }
  const x2 = scaleClip(xScale, allowedOverflow);
  const y2 = scaleClip(yScale, allowedOverflow);
  return {
    top: y2.end,
    right: x2.end,
    bottom: y2.start,
    left: x2.start
  };
}
function toClip(value2) {
  let t2, r2, b2, l2;
  if (isObject$3(value2)) {
    t2 = value2.top;
    r2 = value2.right;
    b2 = value2.bottom;
    l2 = value2.left;
  } else {
    t2 = r2 = b2 = l2 = value2;
  }
  return {
    top: t2,
    right: r2,
    bottom: b2,
    left: l2,
    disabled: value2 === false
  };
}
function getSortedDatasetIndices(chart, filterVisible) {
  const keys2 = [];
  const metasets = chart._getSortedDatasetMetas(filterVisible);
  let i2, ilen;
  for (i2 = 0, ilen = metasets.length; i2 < ilen; ++i2) {
    keys2.push(metasets[i2].index);
  }
  return keys2;
}
function applyStack(stack, value2, dsIndex, options = {}) {
  const keys2 = stack.keys;
  const singleMode = options.mode === "single";
  let i2, ilen, datasetIndex, otherValue;
  if (value2 === null) {
    return;
  }
  let found = false;
  for (i2 = 0, ilen = keys2.length; i2 < ilen; ++i2) {
    datasetIndex = +keys2[i2];
    if (datasetIndex === dsIndex) {
      found = true;
      if (options.all) {
        continue;
      }
      break;
    }
    otherValue = stack.values[datasetIndex];
    if (isNumberFinite(otherValue) && (singleMode || value2 === 0 || sign$1(value2) === sign$1(otherValue))) {
      value2 += otherValue;
    }
  }
  if (!found && !options.all) {
    return 0;
  }
  return value2;
}
function convertObjectDataToArray(data, meta) {
  const { iScale, vScale } = meta;
  const iAxisKey = iScale.axis === "x" ? "x" : "y";
  const vAxisKey = vScale.axis === "x" ? "x" : "y";
  const keys2 = Object.keys(data);
  const adata = new Array(keys2.length);
  let i2, ilen, key;
  for (i2 = 0, ilen = keys2.length; i2 < ilen; ++i2) {
    key = keys2[i2];
    adata[i2] = {
      [iAxisKey]: key,
      [vAxisKey]: data[key]
    };
  }
  return adata;
}
function isStacked(scale2, meta) {
  const stacked = scale2 && scale2.options.stacked;
  return stacked || stacked === void 0 && meta.stack !== void 0;
}
function getStackKey(indexScale, valueScale, meta) {
  return `${indexScale.id}.${valueScale.id}.${meta.stack || meta.type}`;
}
function getUserBounds(scale2) {
  const { min: min2, max: max2, minDefined, maxDefined } = scale2.getUserBounds();
  return {
    min: minDefined ? min2 : Number.NEGATIVE_INFINITY,
    max: maxDefined ? max2 : Number.POSITIVE_INFINITY
  };
}
function getOrCreateStack(stacks, stackKey, indexValue) {
  const subStack = stacks[stackKey] || (stacks[stackKey] = {});
  return subStack[indexValue] || (subStack[indexValue] = {});
}
function getLastIndexInStack(stack, vScale, positive, type4) {
  for (const meta of vScale.getMatchingVisibleMetas(type4).reverse()) {
    const value2 = stack[meta.index];
    if (positive && value2 > 0 || !positive && value2 < 0) {
      return meta.index;
    }
  }
  return null;
}
function updateStacks(controller, parsed) {
  const { chart, _cachedMeta: meta } = controller;
  const stacks = chart._stacks || (chart._stacks = {});
  const { iScale, vScale, index: datasetIndex } = meta;
  const iAxis = iScale.axis;
  const vAxis = vScale.axis;
  const key = getStackKey(iScale, vScale, meta);
  const ilen = parsed.length;
  let stack;
  for (let i2 = 0; i2 < ilen; ++i2) {
    const item = parsed[i2];
    const { [iAxis]: index2, [vAxis]: value2 } = item;
    const itemStacks = item._stacks || (item._stacks = {});
    stack = itemStacks[vAxis] = getOrCreateStack(stacks, key, index2);
    stack[datasetIndex] = value2;
    stack._top = getLastIndexInStack(stack, vScale, true, meta.type);
    stack._bottom = getLastIndexInStack(stack, vScale, false, meta.type);
    const visualValues = stack._visualValues || (stack._visualValues = {});
    visualValues[datasetIndex] = value2;
  }
}
function getFirstScaleId(chart, axis) {
  const scales = chart.scales;
  return Object.keys(scales).filter((key) => scales[key].axis === axis).shift();
}
function createDatasetContext(parent, index2) {
  return createContext(parent, {
    active: false,
    dataset: void 0,
    datasetIndex: index2,
    index: index2,
    mode: "default",
    type: "dataset"
  });
}
function createDataContext(parent, index2, element2) {
  return createContext(parent, {
    active: false,
    dataIndex: index2,
    parsed: void 0,
    raw: void 0,
    element: element2,
    index: index2,
    mode: "default",
    type: "data"
  });
}
function clearStacks(meta, items) {
  const datasetIndex = meta.controller.index;
  const axis = meta.vScale && meta.vScale.axis;
  if (!axis) {
    return;
  }
  items = items || meta._parsed;
  for (const parsed of items) {
    const stacks = parsed._stacks;
    if (!stacks || stacks[axis] === void 0 || stacks[axis][datasetIndex] === void 0) {
      return;
    }
    delete stacks[axis][datasetIndex];
    if (stacks[axis]._visualValues !== void 0 && stacks[axis]._visualValues[datasetIndex] !== void 0) {
      delete stacks[axis]._visualValues[datasetIndex];
    }
  }
}
const isDirectUpdateMode = (mode) => mode === "reset" || mode === "none";
const cloneIfNotShared = (cached, shared) => shared ? cached : Object.assign({}, cached);
const createStack = (canStack, meta, chart) => canStack && !meta.hidden && meta._stacked && {
  keys: getSortedDatasetIndices(chart, true),
  values: null
};
class DatasetController {
  constructor(chart, datasetIndex) {
    this.chart = chart;
    this._ctx = chart.ctx;
    this.index = datasetIndex;
    this._cachedDataOpts = {};
    this._cachedMeta = this.getMeta();
    this._type = this._cachedMeta.type;
    this.options = void 0;
    this._parsing = false;
    this._data = void 0;
    this._objectData = void 0;
    this._sharedOptions = void 0;
    this._drawStart = void 0;
    this._drawCount = void 0;
    this.enableOptionSharing = false;
    this.supportsDecimation = false;
    this.$context = void 0;
    this._syncList = [];
    this.datasetElementType = new.target.datasetElementType;
    this.dataElementType = new.target.dataElementType;
    this.initialize();
  }
  initialize() {
    const meta = this._cachedMeta;
    this.configure();
    this.linkScales();
    meta._stacked = isStacked(meta.vScale, meta);
    this.addElements();
    if (this.options.fill && !this.chart.isPluginEnabled("filler")) {
      console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options");
    }
  }
  updateIndex(datasetIndex) {
    if (this.index !== datasetIndex) {
      clearStacks(this._cachedMeta);
    }
    this.index = datasetIndex;
  }
  linkScales() {
    const chart = this.chart;
    const meta = this._cachedMeta;
    const dataset = this.getDataset();
    const chooseId = (axis, x2, y2, r2) => axis === "x" ? x2 : axis === "r" ? r2 : y2;
    const xid = meta.xAxisID = valueOrDefault(dataset.xAxisID, getFirstScaleId(chart, "x"));
    const yid = meta.yAxisID = valueOrDefault(dataset.yAxisID, getFirstScaleId(chart, "y"));
    const rid = meta.rAxisID = valueOrDefault(dataset.rAxisID, getFirstScaleId(chart, "r"));
    const indexAxis = meta.indexAxis;
    const iid = meta.iAxisID = chooseId(indexAxis, xid, yid, rid);
    const vid = meta.vAxisID = chooseId(indexAxis, yid, xid, rid);
    meta.xScale = this.getScaleForId(xid);
    meta.yScale = this.getScaleForId(yid);
    meta.rScale = this.getScaleForId(rid);
    meta.iScale = this.getScaleForId(iid);
    meta.vScale = this.getScaleForId(vid);
  }
  getDataset() {
    return this.chart.data.datasets[this.index];
  }
  getMeta() {
    return this.chart.getDatasetMeta(this.index);
  }
  getScaleForId(scaleID) {
    return this.chart.scales[scaleID];
  }
  _getOtherScale(scale2) {
    const meta = this._cachedMeta;
    return scale2 === meta.iScale ? meta.vScale : meta.iScale;
  }
  reset() {
    this._update("reset");
  }
  _destroy() {
    const meta = this._cachedMeta;
    if (this._data) {
      unlistenArrayEvents(this._data, this);
    }
    if (meta._stacked) {
      clearStacks(meta);
    }
  }
  _dataCheck() {
    const dataset = this.getDataset();
    const data = dataset.data || (dataset.data = []);
    const _data = this._data;
    if (isObject$3(data)) {
      const meta = this._cachedMeta;
      this._data = convertObjectDataToArray(data, meta);
    } else if (_data !== data) {
      if (_data) {
        unlistenArrayEvents(_data, this);
        const meta = this._cachedMeta;
        clearStacks(meta);
        meta._parsed = [];
      }
      if (data && Object.isExtensible(data)) {
        listenArrayEvents(data, this);
      }
      this._syncList = [];
      this._data = data;
    }
  }
  addElements() {
    const meta = this._cachedMeta;
    this._dataCheck();
    if (this.datasetElementType) {
      meta.dataset = new this.datasetElementType();
    }
  }
  buildOrUpdateElements(resetNewElements) {
    const meta = this._cachedMeta;
    const dataset = this.getDataset();
    let stackChanged = false;
    this._dataCheck();
    const oldStacked = meta._stacked;
    meta._stacked = isStacked(meta.vScale, meta);
    if (meta.stack !== dataset.stack) {
      stackChanged = true;
      clearStacks(meta);
      meta.stack = dataset.stack;
    }
    this._resyncElements(resetNewElements);
    if (stackChanged || oldStacked !== meta._stacked) {
      updateStacks(this, meta._parsed);
      meta._stacked = isStacked(meta.vScale, meta);
    }
  }
  configure() {
    const config2 = this.chart.config;
    const scopeKeys = config2.datasetScopeKeys(this._type);
    const scopes = config2.getOptionScopes(this.getDataset(), scopeKeys, true);
    this.options = config2.createResolver(scopes, this.getContext());
    this._parsing = this.options.parsing;
    this._cachedDataOpts = {};
  }
  parse(start2, count) {
    const { _cachedMeta: meta, _data: data } = this;
    const { iScale, _stacked } = meta;
    const iAxis = iScale.axis;
    let sorted = start2 === 0 && count === data.length ? true : meta._sorted;
    let prev2 = start2 > 0 && meta._parsed[start2 - 1];
    let i2, cur, parsed;
    if (this._parsing === false) {
      meta._parsed = data;
      meta._sorted = true;
      parsed = data;
    } else {
      if (isArray$4(data[start2])) {
        parsed = this.parseArrayData(meta, data, start2, count);
      } else if (isObject$3(data[start2])) {
        parsed = this.parseObjectData(meta, data, start2, count);
      } else {
        parsed = this.parsePrimitiveData(meta, data, start2, count);
      }
      const isNotInOrderComparedToPrev = () => cur[iAxis] === null || prev2 && cur[iAxis] < prev2[iAxis];
      for (i2 = 0; i2 < count; ++i2) {
        meta._parsed[i2 + start2] = cur = parsed[i2];
        if (sorted) {
          if (isNotInOrderComparedToPrev()) {
            sorted = false;
          }
          prev2 = cur;
        }
      }
      meta._sorted = sorted;
    }
    if (_stacked) {
      updateStacks(this, parsed);
    }
  }
  parsePrimitiveData(meta, data, start2, count) {
    const { iScale, vScale } = meta;
    const iAxis = iScale.axis;
    const vAxis = vScale.axis;
    const labels = iScale.getLabels();
    const singleScale = iScale === vScale;
    const parsed = new Array(count);
    let i2, ilen, index2;
    for (i2 = 0, ilen = count; i2 < ilen; ++i2) {
      index2 = i2 + start2;
      parsed[i2] = {
        [iAxis]: singleScale || iScale.parse(labels[index2], index2),
        [vAxis]: vScale.parse(data[index2], index2)
      };
    }
    return parsed;
  }
  parseArrayData(meta, data, start2, count) {
    const { xScale, yScale } = meta;
    const parsed = new Array(count);
    let i2, ilen, index2, item;
    for (i2 = 0, ilen = count; i2 < ilen; ++i2) {
      index2 = i2 + start2;
      item = data[index2];
      parsed[i2] = {
        x: xScale.parse(item[0], index2),
        y: yScale.parse(item[1], index2)
      };
    }
    return parsed;
  }
  parseObjectData(meta, data, start2, count) {
    const { xScale, yScale } = meta;
    const { xAxisKey = "x", yAxisKey = "y" } = this._parsing;
    const parsed = new Array(count);
    let i2, ilen, index2, item;
    for (i2 = 0, ilen = count; i2 < ilen; ++i2) {
      index2 = i2 + start2;
      item = data[index2];
      parsed[i2] = {
        x: xScale.parse(resolveObjectKey(item, xAxisKey), index2),
        y: yScale.parse(resolveObjectKey(item, yAxisKey), index2)
      };
    }
    return parsed;
  }
  getParsed(index2) {
    return this._cachedMeta._parsed[index2];
  }
  getDataElement(index2) {
    return this._cachedMeta.data[index2];
  }
  applyStack(scale2, parsed, mode) {
    const chart = this.chart;
    const meta = this._cachedMeta;
    const value2 = parsed[scale2.axis];
    const stack = {
      keys: getSortedDatasetIndices(chart, true),
      values: parsed._stacks[scale2.axis]._visualValues
    };
    return applyStack(stack, value2, meta.index, {
      mode
    });
  }
  updateRangeFromParsed(range3, scale2, parsed, stack) {
    const parsedValue = parsed[scale2.axis];
    let value2 = parsedValue === null ? NaN : parsedValue;
    const values = stack && parsed._stacks[scale2.axis];
    if (stack && values) {
      stack.values = values;
      value2 = applyStack(stack, parsedValue, this._cachedMeta.index);
    }
    range3.min = Math.min(range3.min, value2);
    range3.max = Math.max(range3.max, value2);
  }
  getMinMax(scale2, canStack) {
    const meta = this._cachedMeta;
    const _parsed = meta._parsed;
    const sorted = meta._sorted && scale2 === meta.iScale;
    const ilen = _parsed.length;
    const otherScale = this._getOtherScale(scale2);
    const stack = createStack(canStack, meta, this.chart);
    const range3 = {
      min: Number.POSITIVE_INFINITY,
      max: Number.NEGATIVE_INFINITY
    };
    const { min: otherMin, max: otherMax } = getUserBounds(otherScale);
    let i2, parsed;
    function _skip() {
      parsed = _parsed[i2];
      const otherValue = parsed[otherScale.axis];
      return !isNumberFinite(parsed[scale2.axis]) || otherMin > otherValue || otherMax < otherValue;
    }
    for (i2 = 0; i2 < ilen; ++i2) {
      if (_skip()) {
        continue;
      }
      this.updateRangeFromParsed(range3, scale2, parsed, stack);
      if (sorted) {
        break;
      }
    }
    if (sorted) {
      for (i2 = ilen - 1; i2 >= 0; --i2) {
        if (_skip()) {
          continue;
        }
        this.updateRangeFromParsed(range3, scale2, parsed, stack);
        break;
      }
    }
    return range3;
  }
  getAllParsedValues(scale2) {
    const parsed = this._cachedMeta._parsed;
    const values = [];
    let i2, ilen, value2;
    for (i2 = 0, ilen = parsed.length; i2 < ilen; ++i2) {
      value2 = parsed[i2][scale2.axis];
      if (isNumberFinite(value2)) {
        values.push(value2);
      }
    }
    return values;
  }
  getMaxOverflow() {
    return false;
  }
  getLabelAndValue(index2) {
    const meta = this._cachedMeta;
    const iScale = meta.iScale;
    const vScale = meta.vScale;
    const parsed = this.getParsed(index2);
    return {
      label: iScale ? "" + iScale.getLabelForValue(parsed[iScale.axis]) : "",
      value: vScale ? "" + vScale.getLabelForValue(parsed[vScale.axis]) : ""
    };
  }
  _update(mode) {
    const meta = this._cachedMeta;
    this.update(mode || "default");
    meta._clip = toClip(valueOrDefault(this.options.clip, defaultClip(meta.xScale, meta.yScale, this.getMaxOverflow())));
  }
  update(mode) {
  }
  draw() {
    const ctx = this._ctx;
    const chart = this.chart;
    const meta = this._cachedMeta;
    const elements = meta.data || [];
    const area = chart.chartArea;
    const active3 = [];
    const start2 = this._drawStart || 0;
    const count = this._drawCount || elements.length - start2;
    const drawActiveElementsOnTop = this.options.drawActiveElementsOnTop;
    let i2;
    if (meta.dataset) {
      meta.dataset.draw(ctx, area, start2, count);
    }
    for (i2 = start2; i2 < start2 + count; ++i2) {
      const element2 = elements[i2];
      if (element2.hidden) {
        continue;
      }
      if (element2.active && drawActiveElementsOnTop) {
        active3.push(element2);
      } else {
        element2.draw(ctx, area);
      }
    }
    for (i2 = 0; i2 < active3.length; ++i2) {
      active3[i2].draw(ctx, area);
    }
  }
  getStyle(index2, active3) {
    const mode = active3 ? "active" : "default";
    return index2 === void 0 && this._cachedMeta.dataset ? this.resolveDatasetElementOptions(mode) : this.resolveDataElementOptions(index2 || 0, mode);
  }
  getContext(index2, active3, mode) {
    const dataset = this.getDataset();
    let context;
    if (index2 >= 0 && index2 < this._cachedMeta.data.length) {
      const element2 = this._cachedMeta.data[index2];
      context = element2.$context || (element2.$context = createDataContext(this.getContext(), index2, element2));
      context.parsed = this.getParsed(index2);
      context.raw = dataset.data[index2];
      context.index = context.dataIndex = index2;
    } else {
      context = this.$context || (this.$context = createDatasetContext(this.chart.getContext(), this.index));
      context.dataset = dataset;
      context.index = context.datasetIndex = this.index;
    }
    context.active = !!active3;
    context.mode = mode;
    return context;
  }
  resolveDatasetElementOptions(mode) {
    return this._resolveElementOptions(this.datasetElementType.id, mode);
  }
  resolveDataElementOptions(index2, mode) {
    return this._resolveElementOptions(this.dataElementType.id, mode, index2);
  }
  _resolveElementOptions(elementType, mode = "default", index2) {
    const active3 = mode === "active";
    const cache2 = this._cachedDataOpts;
    const cacheKey = elementType + "-" + mode;
    const cached = cache2[cacheKey];
    const sharing = this.enableOptionSharing && defined(index2);
    if (cached) {
      return cloneIfNotShared(cached, sharing);
    }
    const config2 = this.chart.config;
    const scopeKeys = config2.datasetElementScopeKeys(this._type, elementType);
    const prefixes = active3 ? [
      `${elementType}Hover`,
      "hover",
      elementType,
      ""
    ] : [
      elementType,
      ""
    ];
    const scopes = config2.getOptionScopes(this.getDataset(), scopeKeys);
    const names2 = Object.keys(defaults$2.elements[elementType]);
    const context = () => this.getContext(index2, active3, mode);
    const values = config2.resolveNamedOptions(scopes, names2, context, prefixes);
    if (values.$shared) {
      values.$shared = sharing;
      cache2[cacheKey] = Object.freeze(cloneIfNotShared(values, sharing));
    }
    return values;
  }
  _resolveAnimations(index2, transition3, active3) {
    const chart = this.chart;
    const cache2 = this._cachedDataOpts;
    const cacheKey = `animation-${transition3}`;
    const cached = cache2[cacheKey];
    if (cached) {
      return cached;
    }
    let options;
    if (chart.options.animation !== false) {
      const config2 = this.chart.config;
      const scopeKeys = config2.datasetAnimationScopeKeys(this._type, transition3);
      const scopes = config2.getOptionScopes(this.getDataset(), scopeKeys);
      options = config2.createResolver(scopes, this.getContext(index2, active3, transition3));
    }
    const animations2 = new Animations(chart, options && options.animations);
    if (options && options._cacheable) {
      cache2[cacheKey] = Object.freeze(animations2);
    }
    return animations2;
  }
  getSharedOptions(options) {
    if (!options.$shared) {
      return;
    }
    return this._sharedOptions || (this._sharedOptions = Object.assign({}, options));
  }
  includeOptions(mode, sharedOptions) {
    return !sharedOptions || isDirectUpdateMode(mode) || this.chart._animationsDisabled;
  }
  _getSharedOptions(start2, mode) {
    const firstOpts = this.resolveDataElementOptions(start2, mode);
    const previouslySharedOptions = this._sharedOptions;
    const sharedOptions = this.getSharedOptions(firstOpts);
    const includeOptions = this.includeOptions(mode, sharedOptions) || sharedOptions !== previouslySharedOptions;
    this.updateSharedOptions(sharedOptions, mode, firstOpts);
    return {
      sharedOptions,
      includeOptions
    };
  }
  updateElement(element2, index2, properties2, mode) {
    if (isDirectUpdateMode(mode)) {
      Object.assign(element2, properties2);
    } else {
      this._resolveAnimations(index2, mode).update(element2, properties2);
    }
  }
  updateSharedOptions(sharedOptions, mode, newOptions) {
    if (sharedOptions && !isDirectUpdateMode(mode)) {
      this._resolveAnimations(void 0, mode).update(sharedOptions, newOptions);
    }
  }
  _setStyle(element2, index2, mode, active3) {
    element2.active = active3;
    const options = this.getStyle(index2, active3);
    this._resolveAnimations(index2, mode, active3).update(element2, {
      options: !active3 && this.getSharedOptions(options) || options
    });
  }
  removeHoverStyle(element2, datasetIndex, index2) {
    this._setStyle(element2, index2, "active", false);
  }
  setHoverStyle(element2, datasetIndex, index2) {
    this._setStyle(element2, index2, "active", true);
  }
  _removeDatasetHoverStyle() {
    const element2 = this._cachedMeta.dataset;
    if (element2) {
      this._setStyle(element2, void 0, "active", false);
    }
  }
  _setDatasetHoverStyle() {
    const element2 = this._cachedMeta.dataset;
    if (element2) {
      this._setStyle(element2, void 0, "active", true);
    }
  }
  _resyncElements(resetNewElements) {
    const data = this._data;
    const elements = this._cachedMeta.data;
    for (const [method4, arg1, arg2] of this._syncList) {
      this[method4](arg1, arg2);
    }
    this._syncList = [];
    const numMeta = elements.length;
    const numData = data.length;
    const count = Math.min(numData, numMeta);
    if (count) {
      this.parse(0, count);
    }
    if (numData > numMeta) {
      this._insertElements(numMeta, numData - numMeta, resetNewElements);
    } else if (numData < numMeta) {
      this._removeElements(numData, numMeta - numData);
    }
  }
  _insertElements(start2, count, resetNewElements = true) {
    const meta = this._cachedMeta;
    const data = meta.data;
    const end2 = start2 + count;
    let i2;
    const move2 = (arr) => {
      arr.length += count;
      for (i2 = arr.length - 1; i2 >= end2; i2--) {
        arr[i2] = arr[i2 - count];
      }
    };
    move2(data);
    for (i2 = start2; i2 < end2; ++i2) {
      data[i2] = new this.dataElementType();
    }
    if (this._parsing) {
      move2(meta._parsed);
    }
    this.parse(start2, count);
    if (resetNewElements) {
      this.updateElements(data, start2, count, "reset");
    }
  }
  updateElements(element2, start2, count, mode) {
  }
  _removeElements(start2, count) {
    const meta = this._cachedMeta;
    if (this._parsing) {
      const removed = meta._parsed.splice(start2, count);
      if (meta._stacked) {
        clearStacks(meta, removed);
      }
    }
    meta.data.splice(start2, count);
  }
  _sync(args) {
    if (this._parsing) {
      this._syncList.push(args);
    } else {
      const [method4, arg1, arg2] = args;
      this[method4](arg1, arg2);
    }
    this.chart._dataChanges.push([
      this.index,
      ...args
    ]);
  }
  _onDataPush() {
    const count = arguments.length;
    this._sync([
      "_insertElements",
      this.getDataset().data.length - count,
      count
    ]);
  }
  _onDataPop() {
    this._sync([
      "_removeElements",
      this._cachedMeta.data.length - 1,
      1
    ]);
  }
  _onDataShift() {
    this._sync([
      "_removeElements",
      0,
      1
    ]);
  }
  _onDataSplice(start2, count) {
    if (count) {
      this._sync([
        "_removeElements",
        start2,
        count
      ]);
    }
    const newCount = arguments.length - 2;
    if (newCount) {
      this._sync([
        "_insertElements",
        start2,
        newCount
      ]);
    }
  }
  _onDataUnshift() {
    this._sync([
      "_insertElements",
      0,
      arguments.length
    ]);
  }
}
__publicField(DatasetController, "defaults", {});
__publicField(DatasetController, "datasetElementType", null);
__publicField(DatasetController, "dataElementType", null);
function getAllScaleValues(scale2, type4) {
  if (!scale2._cache.$bar) {
    const visibleMetas = scale2.getMatchingVisibleMetas(type4);
    let values = [];
    for (let i2 = 0, ilen = visibleMetas.length; i2 < ilen; i2++) {
      values = values.concat(visibleMetas[i2].controller.getAllParsedValues(scale2));
    }
    scale2._cache.$bar = _arrayUnique(values.sort((a2, b2) => a2 - b2));
  }
  return scale2._cache.$bar;
}
function computeMinSampleSize(meta) {
  const scale2 = meta.iScale;
  const values = getAllScaleValues(scale2, meta.type);
  let min2 = scale2._length;
  let i2, ilen, curr, prev2;
  const updateMinAndPrev = () => {
    if (curr === 32767 || curr === -32768) {
      return;
    }
    if (defined(prev2)) {
      min2 = Math.min(min2, Math.abs(curr - prev2) || min2);
    }
    prev2 = curr;
  };
  for (i2 = 0, ilen = values.length; i2 < ilen; ++i2) {
    curr = scale2.getPixelForValue(values[i2]);
    updateMinAndPrev();
  }
  prev2 = void 0;
  for (i2 = 0, ilen = scale2.ticks.length; i2 < ilen; ++i2) {
    curr = scale2.getPixelForTick(i2);
    updateMinAndPrev();
  }
  return min2;
}
function computeFitCategoryTraits(index2, ruler, options, stackCount) {
  const thickness = options.barThickness;
  let size2, ratio;
  if (isNullOrUndef(thickness)) {
    size2 = ruler.min * options.categoryPercentage;
    ratio = options.barPercentage;
  } else {
    size2 = thickness * stackCount;
    ratio = 1;
  }
  return {
    chunk: size2 / stackCount,
    ratio,
    start: ruler.pixels[index2] - size2 / 2
  };
}
function computeFlexCategoryTraits(index2, ruler, options, stackCount) {
  const pixels = ruler.pixels;
  const curr = pixels[index2];
  let prev2 = index2 > 0 ? pixels[index2 - 1] : null;
  let next2 = index2 < pixels.length - 1 ? pixels[index2 + 1] : null;
  const percent2 = options.categoryPercentage;
  if (prev2 === null) {
    prev2 = curr - (next2 === null ? ruler.end - ruler.start : next2 - curr);
  }
  if (next2 === null) {
    next2 = curr + curr - prev2;
  }
  const start2 = curr - (curr - Math.min(prev2, next2)) / 2 * percent2;
  const size2 = Math.abs(next2 - prev2) / 2 * percent2;
  return {
    chunk: size2 / stackCount,
    ratio: options.barPercentage,
    start: start2
  };
}
function parseFloatBar(entry, item, vScale, i2) {
  const startValue = vScale.parse(entry[0], i2);
  const endValue = vScale.parse(entry[1], i2);
  const min2 = Math.min(startValue, endValue);
  const max2 = Math.max(startValue, endValue);
  let barStart = min2;
  let barEnd = max2;
  if (Math.abs(min2) > Math.abs(max2)) {
    barStart = max2;
    barEnd = min2;
  }
  item[vScale.axis] = barEnd;
  item._custom = {
    barStart,
    barEnd,
    start: startValue,
    end: endValue,
    min: min2,
    max: max2
  };
}
function parseValue(entry, item, vScale, i2) {
  if (isArray$4(entry)) {
    parseFloatBar(entry, item, vScale, i2);
  } else {
    item[vScale.axis] = vScale.parse(entry, i2);
  }
  return item;
}
function parseArrayOrPrimitive(meta, data, start2, count) {
  const iScale = meta.iScale;
  const vScale = meta.vScale;
  const labels = iScale.getLabels();
  const singleScale = iScale === vScale;
  const parsed = [];
  let i2, ilen, item, entry;
  for (i2 = start2, ilen = start2 + count; i2 < ilen; ++i2) {
    entry = data[i2];
    item = {};
    item[iScale.axis] = singleScale || iScale.parse(labels[i2], i2);
    parsed.push(parseValue(entry, item, vScale, i2));
  }
  return parsed;
}
function isFloatBar(custom2) {
  return custom2 && custom2.barStart !== void 0 && custom2.barEnd !== void 0;
}
function barSign(size2, vScale, actualBase) {
  if (size2 !== 0) {
    return sign$1(size2);
  }
  return (vScale.isHorizontal() ? 1 : -1) * (vScale.min >= actualBase ? 1 : -1);
}
function borderProps(properties2) {
  let reverse, start2, end2, top2, bottom2;
  if (properties2.horizontal) {
    reverse = properties2.base > properties2.x;
    start2 = "left";
    end2 = "right";
  } else {
    reverse = properties2.base < properties2.y;
    start2 = "bottom";
    end2 = "top";
  }
  if (reverse) {
    top2 = "end";
    bottom2 = "start";
  } else {
    top2 = "start";
    bottom2 = "end";
  }
  return {
    start: start2,
    end: end2,
    reverse,
    top: top2,
    bottom: bottom2
  };
}
function setBorderSkipped(properties2, options, stack, index2) {
  let edge = options.borderSkipped;
  const res = {};
  if (!edge) {
    properties2.borderSkipped = res;
    return;
  }
  if (edge === true) {
    properties2.borderSkipped = {
      top: true,
      right: true,
      bottom: true,
      left: true
    };
    return;
  }
  const { start: start2, end: end2, reverse, top: top2, bottom: bottom2 } = borderProps(properties2);
  if (edge === "middle" && stack) {
    properties2.enableBorderRadius = true;
    if ((stack._top || 0) === index2) {
      edge = top2;
    } else if ((stack._bottom || 0) === index2) {
      edge = bottom2;
    } else {
      res[parseEdge(bottom2, start2, end2, reverse)] = true;
      edge = top2;
    }
  }
  res[parseEdge(edge, start2, end2, reverse)] = true;
  properties2.borderSkipped = res;
}
function parseEdge(edge, a2, b2, reverse) {
  if (reverse) {
    edge = swap(edge, a2, b2);
    edge = startEnd(edge, b2, a2);
  } else {
    edge = startEnd(edge, a2, b2);
  }
  return edge;
}
function swap(orig, v1, v2) {
  return orig === v1 ? v2 : orig === v2 ? v1 : orig;
}
function startEnd(v2, start2, end2) {
  return v2 === "start" ? start2 : v2 === "end" ? end2 : v2;
}
function setInflateAmount(properties2, { inflateAmount }, ratio) {
  properties2.inflateAmount = inflateAmount === "auto" ? ratio === 1 ? 0.33 : 0 : inflateAmount;
}
class BarController extends DatasetController {
  parsePrimitiveData(meta, data, start2, count) {
    return parseArrayOrPrimitive(meta, data, start2, count);
  }
  parseArrayData(meta, data, start2, count) {
    return parseArrayOrPrimitive(meta, data, start2, count);
  }
  parseObjectData(meta, data, start2, count) {
    const { iScale, vScale } = meta;
    const { xAxisKey = "x", yAxisKey = "y" } = this._parsing;
    const iAxisKey = iScale.axis === "x" ? xAxisKey : yAxisKey;
    const vAxisKey = vScale.axis === "x" ? xAxisKey : yAxisKey;
    const parsed = [];
    let i2, ilen, item, obj;
    for (i2 = start2, ilen = start2 + count; i2 < ilen; ++i2) {
      obj = data[i2];
      item = {};
      item[iScale.axis] = iScale.parse(resolveObjectKey(obj, iAxisKey), i2);
      parsed.push(parseValue(resolveObjectKey(obj, vAxisKey), item, vScale, i2));
    }
    return parsed;
  }
  updateRangeFromParsed(range3, scale2, parsed, stack) {
    super.updateRangeFromParsed(range3, scale2, parsed, stack);
    const custom2 = parsed._custom;
    if (custom2 && scale2 === this._cachedMeta.vScale) {
      range3.min = Math.min(range3.min, custom2.min);
      range3.max = Math.max(range3.max, custom2.max);
    }
  }
  getMaxOverflow() {
    return 0;
  }
  getLabelAndValue(index2) {
    const meta = this._cachedMeta;
    const { iScale, vScale } = meta;
    const parsed = this.getParsed(index2);
    const custom2 = parsed._custom;
    const value2 = isFloatBar(custom2) ? "[" + custom2.start + ", " + custom2.end + "]" : "" + vScale.getLabelForValue(parsed[vScale.axis]);
    return {
      label: "" + iScale.getLabelForValue(parsed[iScale.axis]),
      value: value2
    };
  }
  initialize() {
    this.enableOptionSharing = true;
    super.initialize();
    const meta = this._cachedMeta;
    meta.stack = this.getDataset().stack;
  }
  update(mode) {
    const meta = this._cachedMeta;
    this.updateElements(meta.data, 0, meta.data.length, mode);
  }
  updateElements(bars, start2, count, mode) {
    const reset = mode === "reset";
    const { index: index2, _cachedMeta: { vScale } } = this;
    const base = vScale.getBasePixel();
    const horizontal = vScale.isHorizontal();
    const ruler = this._getRuler();
    const { sharedOptions, includeOptions } = this._getSharedOptions(start2, mode);
    for (let i2 = start2; i2 < start2 + count; i2++) {
      const parsed = this.getParsed(i2);
      const vpixels = reset || isNullOrUndef(parsed[vScale.axis]) ? {
        base,
        head: base
      } : this._calculateBarValuePixels(i2);
      const ipixels = this._calculateBarIndexPixels(i2, ruler);
      const stack = (parsed._stacks || {})[vScale.axis];
      const properties2 = {
        horizontal,
        base: vpixels.base,
        enableBorderRadius: !stack || isFloatBar(parsed._custom) || index2 === stack._top || index2 === stack._bottom,
        x: horizontal ? vpixels.head : ipixels.center,
        y: horizontal ? ipixels.center : vpixels.head,
        height: horizontal ? ipixels.size : Math.abs(vpixels.size),
        width: horizontal ? Math.abs(vpixels.size) : ipixels.size
      };
      if (includeOptions) {
        properties2.options = sharedOptions || this.resolveDataElementOptions(i2, bars[i2].active ? "active" : mode);
      }
      const options = properties2.options || bars[i2].options;
      setBorderSkipped(properties2, options, stack, index2);
      setInflateAmount(properties2, options, ruler.ratio);
      this.updateElement(bars[i2], i2, properties2, mode);
    }
  }
  _getStacks(last, dataIndex) {
    const { iScale } = this._cachedMeta;
    const metasets = iScale.getMatchingVisibleMetas(this._type).filter((meta) => meta.controller.options.grouped);
    const stacked = iScale.options.stacked;
    const stacks = [];
    const currentParsed = this._cachedMeta.controller.getParsed(dataIndex);
    const iScaleValue = currentParsed && currentParsed[iScale.axis];
    const skipNull = (meta) => {
      const parsed = meta._parsed.find((item) => item[iScale.axis] === iScaleValue);
      const val = parsed && parsed[meta.vScale.axis];
      if (isNullOrUndef(val) || isNaN(val)) {
        return true;
      }
    };
    for (const meta of metasets) {
      if (dataIndex !== void 0 && skipNull(meta)) {
        continue;
      }
      if (stacked === false || stacks.indexOf(meta.stack) === -1 || stacked === void 0 && meta.stack === void 0) {
        stacks.push(meta.stack);
      }
      if (meta.index === last) {
        break;
      }
    }
    if (!stacks.length) {
      stacks.push(void 0);
    }
    return stacks;
  }
  _getStackCount(index2) {
    return this._getStacks(void 0, index2).length;
  }
  _getAxisCount() {
    return this._getAxis().length;
  }
  getFirstScaleIdForIndexAxis() {
    const scales = this.chart.scales;
    const indexScaleId = this.chart.options.indexAxis;
    return Object.keys(scales).filter((key) => scales[key].axis === indexScaleId).shift();
  }
  _getAxis() {
    const axis = {};
    const firstScaleAxisId = this.getFirstScaleIdForIndexAxis();
    for (const dataset of this.chart.data.datasets) {
      axis[valueOrDefault(this.chart.options.indexAxis === "x" ? dataset.xAxisID : dataset.yAxisID, firstScaleAxisId)] = true;
    }
    return Object.keys(axis);
  }
  _getStackIndex(datasetIndex, name2, dataIndex) {
    const stacks = this._getStacks(datasetIndex, dataIndex);
    const index2 = name2 !== void 0 ? stacks.indexOf(name2) : -1;
    return index2 === -1 ? stacks.length - 1 : index2;
  }
  _getRuler() {
    const opts2 = this.options;
    const meta = this._cachedMeta;
    const iScale = meta.iScale;
    const pixels = [];
    let i2, ilen;
    for (i2 = 0, ilen = meta.data.length; i2 < ilen; ++i2) {
      pixels.push(iScale.getPixelForValue(this.getParsed(i2)[iScale.axis], i2));
    }
    const barThickness = opts2.barThickness;
    const min2 = barThickness || computeMinSampleSize(meta);
    return {
      min: min2,
      pixels,
      start: iScale._startPixel,
      end: iScale._endPixel,
      stackCount: this._getStackCount(),
      scale: iScale,
      grouped: opts2.grouped,
      ratio: barThickness ? 1 : opts2.categoryPercentage * opts2.barPercentage
    };
  }
  _calculateBarValuePixels(index2) {
    const { _cachedMeta: { vScale, _stacked, index: datasetIndex }, options: { base: baseValue, minBarLength } } = this;
    const actualBase = baseValue || 0;
    const parsed = this.getParsed(index2);
    const custom2 = parsed._custom;
    const floating = isFloatBar(custom2);
    let value2 = parsed[vScale.axis];
    let start2 = 0;
    let length2 = _stacked ? this.applyStack(vScale, parsed, _stacked) : value2;
    let head, size2;
    if (length2 !== value2) {
      start2 = length2 - value2;
      length2 = value2;
    }
    if (floating) {
      value2 = custom2.barStart;
      length2 = custom2.barEnd - custom2.barStart;
      if (value2 !== 0 && sign$1(value2) !== sign$1(custom2.barEnd)) {
        start2 = 0;
      }
      start2 += value2;
    }
    const startValue = !isNullOrUndef(baseValue) && !floating ? baseValue : start2;
    let base = vScale.getPixelForValue(startValue);
    if (this.chart.getDataVisibility(index2)) {
      head = vScale.getPixelForValue(start2 + length2);
    } else {
      head = base;
    }
    size2 = head - base;
    if (Math.abs(size2) < minBarLength) {
      size2 = barSign(size2, vScale, actualBase) * minBarLength;
      if (value2 === actualBase) {
        base -= size2 / 2;
      }
      const startPixel = vScale.getPixelForDecimal(0);
      const endPixel = vScale.getPixelForDecimal(1);
      const min2 = Math.min(startPixel, endPixel);
      const max2 = Math.max(startPixel, endPixel);
      base = Math.max(Math.min(base, max2), min2);
      head = base + size2;
      if (_stacked && !floating) {
        parsed._stacks[vScale.axis]._visualValues[datasetIndex] = vScale.getValueForPixel(head) - vScale.getValueForPixel(base);
      }
    }
    if (base === vScale.getPixelForValue(actualBase)) {
      const halfGrid = sign$1(size2) * vScale.getLineWidthForValue(actualBase) / 2;
      base += halfGrid;
      size2 -= halfGrid;
    }
    return {
      size: size2,
      base,
      head,
      center: head + size2 / 2
    };
  }
  _calculateBarIndexPixels(index2, ruler) {
    const scale2 = ruler.scale;
    const options = this.options;
    const skipNull = options.skipNull;
    const maxBarThickness = valueOrDefault(options.maxBarThickness, Infinity);
    let center, size2;
    const axisCount = this._getAxisCount();
    if (ruler.grouped) {
      const stackCount = skipNull ? this._getStackCount(index2) : ruler.stackCount;
      const range3 = options.barThickness === "flex" ? computeFlexCategoryTraits(index2, ruler, options, stackCount * axisCount) : computeFitCategoryTraits(index2, ruler, options, stackCount * axisCount);
      const axisID = this.chart.options.indexAxis === "x" ? this.getDataset().xAxisID : this.getDataset().yAxisID;
      const axisNumber = this._getAxis().indexOf(valueOrDefault(axisID, this.getFirstScaleIdForIndexAxis()));
      const stackIndex = this._getStackIndex(this.index, this._cachedMeta.stack, skipNull ? index2 : void 0) + axisNumber;
      center = range3.start + range3.chunk * stackIndex + range3.chunk / 2;
      size2 = Math.min(maxBarThickness, range3.chunk * range3.ratio);
    } else {
      center = scale2.getPixelForValue(this.getParsed(index2)[scale2.axis], index2);
      size2 = Math.min(maxBarThickness, ruler.min * ruler.ratio);
    }
    return {
      base: center - size2 / 2,
      head: center + size2 / 2,
      center,
      size: size2
    };
  }
  draw() {
    const meta = this._cachedMeta;
    const vScale = meta.vScale;
    const rects = meta.data;
    const ilen = rects.length;
    let i2 = 0;
    for (; i2 < ilen; ++i2) {
      if (this.getParsed(i2)[vScale.axis] !== null && !rects[i2].hidden) {
        rects[i2].draw(this._ctx);
      }
    }
  }
}
__publicField(BarController, "id", "bar");
__publicField(BarController, "defaults", {
  datasetElementType: false,
  dataElementType: "bar",
  categoryPercentage: 0.8,
  barPercentage: 0.9,
  grouped: true,
  animations: {
    numbers: {
      type: "number",
      properties: [
        "x",
        "y",
        "base",
        "width",
        "height"
      ]
    }
  }
});
__publicField(BarController, "overrides", {
  scales: {
    _index_: {
      type: "category",
      offset: true,
      grid: {
        offset: true
      }
    },
    _value_: {
      type: "linear",
      beginAtZero: true
    }
  }
});
class LineController extends DatasetController {
  initialize() {
    this.enableOptionSharing = true;
    this.supportsDecimation = true;
    super.initialize();
  }
  update(mode) {
    const meta = this._cachedMeta;
    const { dataset: line2, data: points = [], _dataset } = meta;
    const animationsDisabled = this.chart._animationsDisabled;
    let { start: start2, count } = _getStartAndCountOfVisiblePoints(meta, points, animationsDisabled);
    this._drawStart = start2;
    this._drawCount = count;
    if (_scaleRangesChanged(meta)) {
      start2 = 0;
      count = points.length;
    }
    line2._chart = this.chart;
    line2._datasetIndex = this.index;
    line2._decimated = !!_dataset._decimated;
    line2.points = points;
    const options = this.resolveDatasetElementOptions(mode);
    if (!this.options.showLine) {
      options.borderWidth = 0;
    }
    options.segment = this.options.segment;
    this.updateElement(line2, void 0, {
      animated: !animationsDisabled,
      options
    }, mode);
    this.updateElements(points, start2, count, mode);
  }
  updateElements(points, start2, count, mode) {
    const reset = mode === "reset";
    const { iScale, vScale, _stacked, _dataset } = this._cachedMeta;
    const { sharedOptions, includeOptions } = this._getSharedOptions(start2, mode);
    const iAxis = iScale.axis;
    const vAxis = vScale.axis;
    const { spanGaps, segment } = this.options;
    const maxGapLength = isNumber$2(spanGaps) ? spanGaps : Number.POSITIVE_INFINITY;
    const directUpdate = this.chart._animationsDisabled || reset || mode === "none";
    const end2 = start2 + count;
    const pointsCount = points.length;
    let prevParsed = start2 > 0 && this.getParsed(start2 - 1);
    for (let i2 = 0; i2 < pointsCount; ++i2) {
      const point2 = points[i2];
      const properties2 = directUpdate ? point2 : {};
      if (i2 < start2 || i2 >= end2) {
        properties2.skip = true;
        continue;
      }
      const parsed = this.getParsed(i2);
      const nullData = isNullOrUndef(parsed[vAxis]);
      const iPixel = properties2[iAxis] = iScale.getPixelForValue(parsed[iAxis], i2);
      const vPixel = properties2[vAxis] = reset || nullData ? vScale.getBasePixel() : vScale.getPixelForValue(_stacked ? this.applyStack(vScale, parsed, _stacked) : parsed[vAxis], i2);
      properties2.skip = isNaN(iPixel) || isNaN(vPixel) || nullData;
      properties2.stop = i2 > 0 && Math.abs(parsed[iAxis] - prevParsed[iAxis]) > maxGapLength;
      if (segment) {
        properties2.parsed = parsed;
        properties2.raw = _dataset.data[i2];
      }
      if (includeOptions) {
        properties2.options = sharedOptions || this.resolveDataElementOptions(i2, point2.active ? "active" : mode);
      }
      if (!directUpdate) {
        this.updateElement(point2, i2, properties2, mode);
      }
      prevParsed = parsed;
    }
  }
  getMaxOverflow() {
    const meta = this._cachedMeta;
    const dataset = meta.dataset;
    const border = dataset.options && dataset.options.borderWidth || 0;
    const data = meta.data || [];
    if (!data.length) {
      return border;
    }
    const firstPoint = data[0].size(this.resolveDataElementOptions(0));
    const lastPoint = data[data.length - 1].size(this.resolveDataElementOptions(data.length - 1));
    return Math.max(border, firstPoint, lastPoint) / 2;
  }
  draw() {
    const meta = this._cachedMeta;
    meta.dataset.updateControlPoints(this.chart.chartArea, meta.iScale.axis);
    super.draw();
  }
}
__publicField(LineController, "id", "line");
__publicField(LineController, "defaults", {
  datasetElementType: "line",
  dataElementType: "point",
  showLine: true,
  spanGaps: false
});
__publicField(LineController, "overrides", {
  scales: {
    _index_: {
      type: "category"
    },
    _value_: {
      type: "linear"
    }
  }
});
function abstract() {
  throw new Error("This method is not implemented: Check that a complete date adapter is provided.");
}
class DateAdapterBase {
  constructor(options) {
    __publicField(this, "options");
    this.options = options || {};
  }
  /**
  * Override default date adapter methods.
  * Accepts type parameter to define options type.
  * @example
  * Chart._adapters._date.override<{myAdapterOption: string}>({
  *   init() {
  *     console.log(this.options.myAdapterOption);
  *   }
  * })
  */
  static override(members) {
    Object.assign(DateAdapterBase.prototype, members);
  }
  // eslint-disable-next-line @typescript-eslint/no-empty-function
  init() {
  }
  formats() {
    return abstract();
  }
  parse() {
    return abstract();
  }
  format() {
    return abstract();
  }
  add() {
    return abstract();
  }
  diff() {
    return abstract();
  }
  startOf() {
    return abstract();
  }
  endOf() {
    return abstract();
  }
}
var adapters$1 = {
  _date: DateAdapterBase
};
function binarySearch(metaset, axis, value2, intersect) {
  const { controller, data, _sorted } = metaset;
  const iScale = controller._cachedMeta.iScale;
  const spanGaps = metaset.dataset ? metaset.dataset.options ? metaset.dataset.options.spanGaps : null : null;
  if (iScale && axis === iScale.axis && axis !== "r" && _sorted && data.length) {
    const lookupMethod = iScale._reversePixels ? _rlookupByKey : _lookupByKey;
    if (!intersect) {
      const result = lookupMethod(data, axis, value2);
      if (spanGaps) {
        const { vScale } = controller._cachedMeta;
        const { _parsed } = metaset;
        const distanceToDefinedLo = _parsed.slice(0, result.lo + 1).reverse().findIndex((point2) => !isNullOrUndef(point2[vScale.axis]));
        result.lo -= Math.max(0, distanceToDefinedLo);
        const distanceToDefinedHi = _parsed.slice(result.hi).findIndex((point2) => !isNullOrUndef(point2[vScale.axis]));
        result.hi += Math.max(0, distanceToDefinedHi);
      }
      return result;
    } else if (controller._sharedOptions) {
      const el2 = data[0];
      const range3 = typeof el2.getRange === "function" && el2.getRange(axis);
      if (range3) {
        const start2 = lookupMethod(data, axis, value2 - range3);
        const end2 = lookupMethod(data, axis, value2 + range3);
        return {
          lo: start2.lo,
          hi: end2.hi
        };
      }
    }
  }
  return {
    lo: 0,
    hi: data.length - 1
  };
}
function evaluateInteractionItems(chart, axis, position2, handler, intersect) {
  const metasets = chart.getSortedVisibleDatasetMetas();
  const value2 = position2[axis];
  for (let i2 = 0, ilen = metasets.length; i2 < ilen; ++i2) {
    const { index: index2, data } = metasets[i2];
    const { lo, hi: hi2 } = binarySearch(metasets[i2], axis, value2, intersect);
    for (let j2 = lo; j2 <= hi2; ++j2) {
      const element2 = data[j2];
      if (!element2.skip) {
        handler(element2, index2, j2);
      }
    }
  }
}
function getDistanceMetricForAxis(axis) {
  const useX = axis.indexOf("x") !== -1;
  const useY = axis.indexOf("y") !== -1;
  return function(pt1, pt2) {
    const deltaX = useX ? Math.abs(pt1.x - pt2.x) : 0;
    const deltaY = useY ? Math.abs(pt1.y - pt2.y) : 0;
    return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));
  };
}
function getIntersectItems(chart, position2, axis, useFinalPosition, includeInvisible) {
  const items = [];
  if (!includeInvisible && !chart.isPointInArea(position2)) {
    return items;
  }
  const evaluationFunc = function(element2, datasetIndex, index2) {
    if (!includeInvisible && !_isPointInArea(element2, chart.chartArea, 0)) {
      return;
    }
    if (element2.inRange(position2.x, position2.y, useFinalPosition)) {
      items.push({
        element: element2,
        datasetIndex,
        index: index2
      });
    }
  };
  evaluateInteractionItems(chart, axis, position2, evaluationFunc, true);
  return items;
}
function getNearestRadialItems(chart, position2, axis, useFinalPosition) {
  let items = [];
  function evaluationFunc(element2, datasetIndex, index2) {
    const { startAngle, endAngle } = element2.getProps([
      "startAngle",
      "endAngle"
    ], useFinalPosition);
    const { angle } = getAngleFromPoint(element2, {
      x: position2.x,
      y: position2.y
    });
    if (_angleBetween(angle, startAngle, endAngle)) {
      items.push({
        element: element2,
        datasetIndex,
        index: index2
      });
    }
  }
  evaluateInteractionItems(chart, axis, position2, evaluationFunc);
  return items;
}
function getNearestCartesianItems(chart, position2, axis, intersect, useFinalPosition, includeInvisible) {
  let items = [];
  const distanceMetric = getDistanceMetricForAxis(axis);
  let minDistance = Number.POSITIVE_INFINITY;
  function evaluationFunc(element2, datasetIndex, index2) {
    const inRange2 = element2.inRange(position2.x, position2.y, useFinalPosition);
    if (intersect && !inRange2) {
      return;
    }
    const center = element2.getCenterPoint(useFinalPosition);
    const pointInArea = !!includeInvisible || chart.isPointInArea(center);
    if (!pointInArea && !inRange2) {
      return;
    }
    const distance2 = distanceMetric(position2, center);
    if (distance2 < minDistance) {
      items = [
        {
          element: element2,
          datasetIndex,
          index: index2
        }
      ];
      minDistance = distance2;
    } else if (distance2 === minDistance) {
      items.push({
        element: element2,
        datasetIndex,
        index: index2
      });
    }
  }
  evaluateInteractionItems(chart, axis, position2, evaluationFunc);
  return items;
}
function getNearestItems(chart, position2, axis, intersect, useFinalPosition, includeInvisible) {
  if (!includeInvisible && !chart.isPointInArea(position2)) {
    return [];
  }
  return axis === "r" && !intersect ? getNearestRadialItems(chart, position2, axis, useFinalPosition) : getNearestCartesianItems(chart, position2, axis, intersect, useFinalPosition, includeInvisible);
}
function getAxisItems(chart, position2, axis, intersect, useFinalPosition) {
  const items = [];
  const rangeMethod = axis === "x" ? "inXRange" : "inYRange";
  let intersectsItem = false;
  evaluateInteractionItems(chart, axis, position2, (element2, datasetIndex, index2) => {
    if (element2[rangeMethod] && element2[rangeMethod](position2[axis], useFinalPosition)) {
      items.push({
        element: element2,
        datasetIndex,
        index: index2
      });
      intersectsItem = intersectsItem || element2.inRange(position2.x, position2.y, useFinalPosition);
    }
  });
  if (intersect && !intersectsItem) {
    return [];
  }
  return items;
}
var Interaction = {
  modes: {
    index(chart, e2, options, useFinalPosition) {
      const position2 = getRelativePosition(e2, chart);
      const axis = options.axis || "x";
      const includeInvisible = options.includeInvisible || false;
      const items = options.intersect ? getIntersectItems(chart, position2, axis, useFinalPosition, includeInvisible) : getNearestItems(chart, position2, axis, false, useFinalPosition, includeInvisible);
      const elements = [];
      if (!items.length) {
        return [];
      }
      chart.getSortedVisibleDatasetMetas().forEach((meta) => {
        const index2 = items[0].index;
        const element2 = meta.data[index2];
        if (element2 && !element2.skip) {
          elements.push({
            element: element2,
            datasetIndex: meta.index,
            index: index2
          });
        }
      });
      return elements;
    },
    dataset(chart, e2, options, useFinalPosition) {
      const position2 = getRelativePosition(e2, chart);
      const axis = options.axis || "xy";
      const includeInvisible = options.includeInvisible || false;
      let items = options.intersect ? getIntersectItems(chart, position2, axis, useFinalPosition, includeInvisible) : getNearestItems(chart, position2, axis, false, useFinalPosition, includeInvisible);
      if (items.length > 0) {
        const datasetIndex = items[0].datasetIndex;
        const data = chart.getDatasetMeta(datasetIndex).data;
        items = [];
        for (let i2 = 0; i2 < data.length; ++i2) {
          items.push({
            element: data[i2],
            datasetIndex,
            index: i2
          });
        }
      }
      return items;
    },
    point(chart, e2, options, useFinalPosition) {
      const position2 = getRelativePosition(e2, chart);
      const axis = options.axis || "xy";
      const includeInvisible = options.includeInvisible || false;
      return getIntersectItems(chart, position2, axis, useFinalPosition, includeInvisible);
    },
    nearest(chart, e2, options, useFinalPosition) {
      const position2 = getRelativePosition(e2, chart);
      const axis = options.axis || "xy";
      const includeInvisible = options.includeInvisible || false;
      return getNearestItems(chart, position2, axis, options.intersect, useFinalPosition, includeInvisible);
    },
    x(chart, e2, options, useFinalPosition) {
      const position2 = getRelativePosition(e2, chart);
      return getAxisItems(chart, position2, "x", options.intersect, useFinalPosition);
    },
    y(chart, e2, options, useFinalPosition) {
      const position2 = getRelativePosition(e2, chart);
      return getAxisItems(chart, position2, "y", options.intersect, useFinalPosition);
    }
  }
};
const STATIC_POSITIONS = [
  "left",
  "top",
  "right",
  "bottom"
];
function filterByPosition(array4, position2) {
  return array4.filter((v2) => v2.pos === position2);
}
function filterDynamicPositionByAxis(array4, axis) {
  return array4.filter((v2) => STATIC_POSITIONS.indexOf(v2.pos) === -1 && v2.box.axis === axis);
}
function sortByWeight(array4, reverse) {
  return array4.sort((a2, b2) => {
    const v0 = reverse ? b2 : a2;
    const v1 = reverse ? a2 : b2;
    return v0.weight === v1.weight ? v0.index - v1.index : v0.weight - v1.weight;
  });
}
function wrapBoxes(boxes) {
  const layoutBoxes = [];
  let i2, ilen, box, pos, stack, stackWeight;
  for (i2 = 0, ilen = (boxes || []).length; i2 < ilen; ++i2) {
    box = boxes[i2];
    ({ position: pos, options: { stack, stackWeight = 1 } } = box);
    layoutBoxes.push({
      index: i2,
      box,
      pos,
      horizontal: box.isHorizontal(),
      weight: box.weight,
      stack: stack && pos + stack,
      stackWeight
    });
  }
  return layoutBoxes;
}
function buildStacks(layouts2) {
  const stacks = {};
  for (const wrap2 of layouts2) {
    const { stack, pos, stackWeight } = wrap2;
    if (!stack || !STATIC_POSITIONS.includes(pos)) {
      continue;
    }
    const _stack = stacks[stack] || (stacks[stack] = {
      count: 0,
      placed: 0,
      weight: 0,
      size: 0
    });
    _stack.count++;
    _stack.weight += stackWeight;
  }
  return stacks;
}
function setLayoutDims(layouts2, params) {
  const stacks = buildStacks(layouts2);
  const { vBoxMaxWidth, hBoxMaxHeight } = params;
  let i2, ilen, layout2;
  for (i2 = 0, ilen = layouts2.length; i2 < ilen; ++i2) {
    layout2 = layouts2[i2];
    const { fullSize } = layout2.box;
    const stack = stacks[layout2.stack];
    const factor = stack && layout2.stackWeight / stack.weight;
    if (layout2.horizontal) {
      layout2.width = factor ? factor * vBoxMaxWidth : fullSize && params.availableWidth;
      layout2.height = hBoxMaxHeight;
    } else {
      layout2.width = vBoxMaxWidth;
      layout2.height = factor ? factor * hBoxMaxHeight : fullSize && params.availableHeight;
    }
  }
  return stacks;
}
function buildLayoutBoxes(boxes) {
  const layoutBoxes = wrapBoxes(boxes);
  const fullSize = sortByWeight(layoutBoxes.filter((wrap2) => wrap2.box.fullSize), true);
  const left2 = sortByWeight(filterByPosition(layoutBoxes, "left"), true);
  const right = sortByWeight(filterByPosition(layoutBoxes, "right"));
  const top2 = sortByWeight(filterByPosition(layoutBoxes, "top"), true);
  const bottom2 = sortByWeight(filterByPosition(layoutBoxes, "bottom"));
  const centerHorizontal = filterDynamicPositionByAxis(layoutBoxes, "x");
  const centerVertical = filterDynamicPositionByAxis(layoutBoxes, "y");
  return {
    fullSize,
    leftAndTop: left2.concat(top2),
    rightAndBottom: right.concat(centerVertical).concat(bottom2).concat(centerHorizontal),
    chartArea: filterByPosition(layoutBoxes, "chartArea"),
    vertical: left2.concat(right).concat(centerVertical),
    horizontal: top2.concat(bottom2).concat(centerHorizontal)
  };
}
function getCombinedMax(maxPadding, chartArea, a2, b2) {
  return Math.max(maxPadding[a2], chartArea[a2]) + Math.max(maxPadding[b2], chartArea[b2]);
}
function updateMaxPadding(maxPadding, boxPadding) {
  maxPadding.top = Math.max(maxPadding.top, boxPadding.top);
  maxPadding.left = Math.max(maxPadding.left, boxPadding.left);
  maxPadding.bottom = Math.max(maxPadding.bottom, boxPadding.bottom);
  maxPadding.right = Math.max(maxPadding.right, boxPadding.right);
}
function updateDims(chartArea, params, layout2, stacks) {
  const { pos, box } = layout2;
  const maxPadding = chartArea.maxPadding;
  if (!isObject$3(pos)) {
    if (layout2.size) {
      chartArea[pos] -= layout2.size;
    }
    const stack = stacks[layout2.stack] || {
      size: 0,
      count: 1
    };
    stack.size = Math.max(stack.size, layout2.horizontal ? box.height : box.width);
    layout2.size = stack.size / stack.count;
    chartArea[pos] += layout2.size;
  }
  if (box.getPadding) {
    updateMaxPadding(maxPadding, box.getPadding());
  }
  const newWidth = Math.max(0, params.outerWidth - getCombinedMax(maxPadding, chartArea, "left", "right"));
  const newHeight = Math.max(0, params.outerHeight - getCombinedMax(maxPadding, chartArea, "top", "bottom"));
  const widthChanged = newWidth !== chartArea.w;
  const heightChanged = newHeight !== chartArea.h;
  chartArea.w = newWidth;
  chartArea.h = newHeight;
  return layout2.horizontal ? {
    same: widthChanged,
    other: heightChanged
  } : {
    same: heightChanged,
    other: widthChanged
  };
}
function handleMaxPadding(chartArea) {
  const maxPadding = chartArea.maxPadding;
  function updatePos(pos) {
    const change = Math.max(maxPadding[pos] - chartArea[pos], 0);
    chartArea[pos] += change;
    return change;
  }
  chartArea.y += updatePos("top");
  chartArea.x += updatePos("left");
  updatePos("right");
  updatePos("bottom");
}
function getMargins(horizontal, chartArea) {
  const maxPadding = chartArea.maxPadding;
  function marginForPositions(positions2) {
    const margin = {
      left: 0,
      top: 0,
      right: 0,
      bottom: 0
    };
    positions2.forEach((pos) => {
      margin[pos] = Math.max(chartArea[pos], maxPadding[pos]);
    });
    return margin;
  }
  return horizontal ? marginForPositions([
    "left",
    "right"
  ]) : marginForPositions([
    "top",
    "bottom"
  ]);
}
function fitBoxes(boxes, chartArea, params, stacks) {
  const refitBoxes = [];
  let i2, ilen, layout2, box, refit, changed;
  for (i2 = 0, ilen = boxes.length, refit = 0; i2 < ilen; ++i2) {
    layout2 = boxes[i2];
    box = layout2.box;
    box.update(layout2.width || chartArea.w, layout2.height || chartArea.h, getMargins(layout2.horizontal, chartArea));
    const { same, other } = updateDims(chartArea, params, layout2, stacks);
    refit |= same && refitBoxes.length;
    changed = changed || other;
    if (!box.fullSize) {
      refitBoxes.push(layout2);
    }
  }
  return refit && fitBoxes(refitBoxes, chartArea, params, stacks) || changed;
}
function setBoxDims(box, left2, top2, width, height) {
  box.top = top2;
  box.left = left2;
  box.right = left2 + width;
  box.bottom = top2 + height;
  box.width = width;
  box.height = height;
}
function placeBoxes(boxes, chartArea, params, stacks) {
  const userPadding = params.padding;
  let { x: x2, y: y2 } = chartArea;
  for (const layout2 of boxes) {
    const box = layout2.box;
    const stack = stacks[layout2.stack] || {
      placed: 0,
      weight: 1
    };
    const weight = layout2.stackWeight / stack.weight || 1;
    if (layout2.horizontal) {
      const width = chartArea.w * weight;
      const height = stack.size || box.height;
      if (defined(stack.start)) {
        y2 = stack.start;
      }
      if (box.fullSize) {
        setBoxDims(box, userPadding.left, y2, params.outerWidth - userPadding.right - userPadding.left, height);
      } else {
        setBoxDims(box, chartArea.left + stack.placed, y2, width, height);
      }
      stack.start = y2;
      stack.placed += width;
      y2 = box.bottom;
    } else {
      const height = chartArea.h * weight;
      const width = stack.size || box.width;
      if (defined(stack.start)) {
        x2 = stack.start;
      }
      if (box.fullSize) {
        setBoxDims(box, x2, userPadding.top, width, params.outerHeight - userPadding.bottom - userPadding.top);
      } else {
        setBoxDims(box, x2, chartArea.top + stack.placed, width, height);
      }
      stack.start = x2;
      stack.placed += height;
      x2 = box.right;
    }
  }
  chartArea.x = x2;
  chartArea.y = y2;
}
var layouts = {
  addBox(chart, item) {
    if (!chart.boxes) {
      chart.boxes = [];
    }
    item.fullSize = item.fullSize || false;
    item.position = item.position || "top";
    item.weight = item.weight || 0;
    item._layers = item._layers || function() {
      return [
        {
          z: 0,
          draw(chartArea) {
            item.draw(chartArea);
          }
        }
      ];
    };
    chart.boxes.push(item);
  },
  removeBox(chart, layoutItem) {
    const index2 = chart.boxes ? chart.boxes.indexOf(layoutItem) : -1;
    if (index2 !== -1) {
      chart.boxes.splice(index2, 1);
    }
  },
  configure(chart, item, options) {
    item.fullSize = options.fullSize;
    item.position = options.position;
    item.weight = options.weight;
  },
  update(chart, width, height, minPadding) {
    if (!chart) {
      return;
    }
    const padding = toPadding(chart.options.layout.padding);
    const availableWidth = Math.max(width - padding.width, 0);
    const availableHeight = Math.max(height - padding.height, 0);
    const boxes = buildLayoutBoxes(chart.boxes);
    const verticalBoxes = boxes.vertical;
    const horizontalBoxes = boxes.horizontal;
    each(chart.boxes, (box) => {
      if (typeof box.beforeLayout === "function") {
        box.beforeLayout();
      }
    });
    const visibleVerticalBoxCount = verticalBoxes.reduce((total, wrap2) => wrap2.box.options && wrap2.box.options.display === false ? total : total + 1, 0) || 1;
    const params = Object.freeze({
      outerWidth: width,
      outerHeight: height,
      padding,
      availableWidth,
      availableHeight,
      vBoxMaxWidth: availableWidth / 2 / visibleVerticalBoxCount,
      hBoxMaxHeight: availableHeight / 2
    });
    const maxPadding = Object.assign({}, padding);
    updateMaxPadding(maxPadding, toPadding(minPadding));
    const chartArea = Object.assign({
      maxPadding,
      w: availableWidth,
      h: availableHeight,
      x: padding.left,
      y: padding.top
    }, padding);
    const stacks = setLayoutDims(verticalBoxes.concat(horizontalBoxes), params);
    fitBoxes(boxes.fullSize, chartArea, params, stacks);
    fitBoxes(verticalBoxes, chartArea, params, stacks);
    if (fitBoxes(horizontalBoxes, chartArea, params, stacks)) {
      fitBoxes(verticalBoxes, chartArea, params, stacks);
    }
    handleMaxPadding(chartArea);
    placeBoxes(boxes.leftAndTop, chartArea, params, stacks);
    chartArea.x += chartArea.w;
    chartArea.y += chartArea.h;
    placeBoxes(boxes.rightAndBottom, chartArea, params, stacks);
    chart.chartArea = {
      left: chartArea.left,
      top: chartArea.top,
      right: chartArea.left + chartArea.w,
      bottom: chartArea.top + chartArea.h,
      height: chartArea.h,
      width: chartArea.w
    };
    each(boxes.chartArea, (layout2) => {
      const box = layout2.box;
      Object.assign(box, chart.chartArea);
      box.update(chartArea.w, chartArea.h, {
        left: 0,
        top: 0,
        right: 0,
        bottom: 0
      });
    });
  }
};
class BasePlatform {
  acquireContext(canvas, aspectRatio2) {
  }
  releaseContext(context) {
    return false;
  }
  addEventListener(chart, type4, listener) {
  }
  removeEventListener(chart, type4, listener) {
  }
  getDevicePixelRatio() {
    return 1;
  }
  getMaximumSize(element2, width, height, aspectRatio2) {
    width = Math.max(0, width || element2.width);
    height = height || element2.height;
    return {
      width,
      height: Math.max(0, aspectRatio2 ? Math.floor(width / aspectRatio2) : height)
    };
  }
  isAttached(canvas) {
    return true;
  }
  updateConfig(config2) {
  }
}
class BasicPlatform extends BasePlatform {
  acquireContext(item) {
    return item && item.getContext && item.getContext("2d") || null;
  }
  updateConfig(config2) {
    config2.options.animation = false;
  }
}
const EXPANDO_KEY = "$chartjs";
const EVENT_TYPES = {
  touchstart: "mousedown",
  touchmove: "mousemove",
  touchend: "mouseup",
  pointerenter: "mouseenter",
  pointerdown: "mousedown",
  pointermove: "mousemove",
  pointerup: "mouseup",
  pointerleave: "mouseout",
  pointerout: "mouseout"
};
const isNullOrEmpty = (value2) => value2 === null || value2 === "";
function initCanvas(canvas, aspectRatio2) {
  const style2 = canvas.style;
  const renderHeight = canvas.getAttribute("height");
  const renderWidth = canvas.getAttribute("width");
  canvas[EXPANDO_KEY] = {
    initial: {
      height: renderHeight,
      width: renderWidth,
      style: {
        display: style2.display,
        height: style2.height,
        width: style2.width
      }
    }
  };
  style2.display = style2.display || "block";
  style2.boxSizing = style2.boxSizing || "border-box";
  if (isNullOrEmpty(renderWidth)) {
    const displayWidth = readUsedSize(canvas, "width");
    if (displayWidth !== void 0) {
      canvas.width = displayWidth;
    }
  }
  if (isNullOrEmpty(renderHeight)) {
    if (canvas.style.height === "") {
      canvas.height = canvas.width / (aspectRatio2 || 2);
    } else {
      const displayHeight = readUsedSize(canvas, "height");
      if (displayHeight !== void 0) {
        canvas.height = displayHeight;
      }
    }
  }
  return canvas;
}
const eventListenerOptions = supportsEventListenerOptions ? {
  passive: true
} : false;
function addListener(node2, type4, listener) {
  if (node2) {
    node2.addEventListener(type4, listener, eventListenerOptions);
  }
}
function removeListener(chart, type4, listener) {
  if (chart && chart.canvas) {
    chart.canvas.removeEventListener(type4, listener, eventListenerOptions);
  }
}
function fromNativeEvent(event, chart) {
  const type4 = EVENT_TYPES[event.type] || event.type;
  const { x: x2, y: y2 } = getRelativePosition(event, chart);
  return {
    type: type4,
    chart,
    native: event,
    x: x2 !== void 0 ? x2 : null,
    y: y2 !== void 0 ? y2 : null
  };
}
function nodeListContains(nodeList, canvas) {
  for (const node2 of nodeList) {
    if (node2 === canvas || node2.contains(canvas)) {
      return true;
    }
  }
}
function createAttachObserver(chart, type4, listener) {
  const canvas = chart.canvas;
  const observer = new MutationObserver((entries) => {
    let trigger = false;
    for (const entry of entries) {
      trigger = trigger || nodeListContains(entry.addedNodes, canvas);
      trigger = trigger && !nodeListContains(entry.removedNodes, canvas);
    }
    if (trigger) {
      listener();
    }
  });
  observer.observe(document, {
    childList: true,
    subtree: true
  });
  return observer;
}
function createDetachObserver(chart, type4, listener) {
  const canvas = chart.canvas;
  const observer = new MutationObserver((entries) => {
    let trigger = false;
    for (const entry of entries) {
      trigger = trigger || nodeListContains(entry.removedNodes, canvas);
      trigger = trigger && !nodeListContains(entry.addedNodes, canvas);
    }
    if (trigger) {
      listener();
    }
  });
  observer.observe(document, {
    childList: true,
    subtree: true
  });
  return observer;
}
const drpListeningCharts = /* @__PURE__ */ new Map();
let oldDevicePixelRatio = 0;
function onWindowResize() {
  const dpr = window.devicePixelRatio;
  if (dpr === oldDevicePixelRatio) {
    return;
  }
  oldDevicePixelRatio = dpr;
  drpListeningCharts.forEach((resize, chart) => {
    if (chart.currentDevicePixelRatio !== dpr) {
      resize();
    }
  });
}
function listenDevicePixelRatioChanges(chart, resize) {
  if (!drpListeningCharts.size) {
    window.addEventListener("resize", onWindowResize);
  }
  drpListeningCharts.set(chart, resize);
}
function unlistenDevicePixelRatioChanges(chart) {
  drpListeningCharts.delete(chart);
  if (!drpListeningCharts.size) {
    window.removeEventListener("resize", onWindowResize);
  }
}
function createResizeObserver(chart, type4, listener) {
  const canvas = chart.canvas;
  const container = canvas && _getParentNode(canvas);
  if (!container) {
    return;
  }
  const resize = throttled((width, height) => {
    const w2 = container.clientWidth;
    listener(width, height);
    if (w2 < container.clientWidth) {
      listener();
    }
  }, window);
  const observer = new ResizeObserver((entries) => {
    const entry = entries[0];
    const width = entry.contentRect.width;
    const height = entry.contentRect.height;
    if (width === 0 && height === 0) {
      return;
    }
    resize(width, height);
  });
  observer.observe(container);
  listenDevicePixelRatioChanges(chart, resize);
  return observer;
}
function releaseObserver(chart, type4, observer) {
  if (observer) {
    observer.disconnect();
  }
  if (type4 === "resize") {
    unlistenDevicePixelRatioChanges(chart);
  }
}
function createProxyAndListen(chart, type4, listener) {
  const canvas = chart.canvas;
  const proxy = throttled((event) => {
    if (chart.ctx !== null) {
      listener(fromNativeEvent(event, chart));
    }
  }, chart);
  addListener(canvas, type4, proxy);
  return proxy;
}
class DomPlatform extends BasePlatform {
  acquireContext(canvas, aspectRatio2) {
    const context = canvas && canvas.getContext && canvas.getContext("2d");
    if (context && context.canvas === canvas) {
      initCanvas(canvas, aspectRatio2);
      return context;
    }
    return null;
  }
  releaseContext(context) {
    const canvas = context.canvas;
    if (!canvas[EXPANDO_KEY]) {
      return false;
    }
    const initial = canvas[EXPANDO_KEY].initial;
    [
      "height",
      "width"
    ].forEach((prop) => {
      const value2 = initial[prop];
      if (isNullOrUndef(value2)) {
        canvas.removeAttribute(prop);
      } else {
        canvas.setAttribute(prop, value2);
      }
    });
    const style2 = initial.style || {};
    Object.keys(style2).forEach((key) => {
      canvas.style[key] = style2[key];
    });
    canvas.width = canvas.width;
    delete canvas[EXPANDO_KEY];
    return true;
  }
  addEventListener(chart, type4, listener) {
    this.removeEventListener(chart, type4);
    const proxies = chart.$proxies || (chart.$proxies = {});
    const handlers2 = {
      attach: createAttachObserver,
      detach: createDetachObserver,
      resize: createResizeObserver
    };
    const handler = handlers2[type4] || createProxyAndListen;
    proxies[type4] = handler(chart, type4, listener);
  }
  removeEventListener(chart, type4) {
    const proxies = chart.$proxies || (chart.$proxies = {});
    const proxy = proxies[type4];
    if (!proxy) {
      return;
    }
    const handlers2 = {
      attach: releaseObserver,
      detach: releaseObserver,
      resize: releaseObserver
    };
    const handler = handlers2[type4] || removeListener;
    handler(chart, type4, proxy);
    proxies[type4] = void 0;
  }
  getDevicePixelRatio() {
    return window.devicePixelRatio;
  }
  getMaximumSize(canvas, width, height, aspectRatio2) {
    return getMaximumSize(canvas, width, height, aspectRatio2);
  }
  isAttached(canvas) {
    const container = canvas && _getParentNode(canvas);
    return !!(container && container.isConnected);
  }
}
function _detectPlatform(canvas) {
  if (!_isDomSupported() || typeof OffscreenCanvas !== "undefined" && canvas instanceof OffscreenCanvas) {
    return BasicPlatform;
  }
  return DomPlatform;
}
let Element$1 = (_a = class {
  constructor() {
    __publicField(this, "x");
    __publicField(this, "y");
    __publicField(this, "active", false);
    __publicField(this, "options");
    __publicField(this, "$animations");
  }
  tooltipPosition(useFinalPosition) {
    const { x: x2, y: y2 } = this.getProps([
      "x",
      "y"
    ], useFinalPosition);
    return {
      x: x2,
      y: y2
    };
  }
  hasValue() {
    return isNumber$2(this.x) && isNumber$2(this.y);
  }
  getProps(props, final) {
    const anims = this.$animations;
    if (!final || !anims) {
      return this;
    }
    const ret = {};
    props.forEach((prop) => {
      ret[prop] = anims[prop] && anims[prop].active() ? anims[prop]._to : this[prop];
    });
    return ret;
  }
}, __publicField(_a, "defaults", {}), __publicField(_a, "defaultRoutes"), _a);
function autoSkip(scale2, ticks) {
  const tickOpts = scale2.options.ticks;
  const determinedMaxTicks = determineMaxTicks(scale2);
  const ticksLimit = Math.min(tickOpts.maxTicksLimit || determinedMaxTicks, determinedMaxTicks);
  const majorIndices = tickOpts.major.enabled ? getMajorIndices(ticks) : [];
  const numMajorIndices = majorIndices.length;
  const first = majorIndices[0];
  const last = majorIndices[numMajorIndices - 1];
  const newTicks = [];
  if (numMajorIndices > ticksLimit) {
    skipMajors(ticks, newTicks, majorIndices, numMajorIndices / ticksLimit);
    return newTicks;
  }
  const spacing2 = calculateSpacing(majorIndices, ticks, ticksLimit);
  if (numMajorIndices > 0) {
    let i2, ilen;
    const avgMajorSpacing = numMajorIndices > 1 ? Math.round((last - first) / (numMajorIndices - 1)) : null;
    skip(ticks, newTicks, spacing2, isNullOrUndef(avgMajorSpacing) ? 0 : first - avgMajorSpacing, first);
    for (i2 = 0, ilen = numMajorIndices - 1; i2 < ilen; i2++) {
      skip(ticks, newTicks, spacing2, majorIndices[i2], majorIndices[i2 + 1]);
    }
    skip(ticks, newTicks, spacing2, last, isNullOrUndef(avgMajorSpacing) ? ticks.length : last + avgMajorSpacing);
    return newTicks;
  }
  skip(ticks, newTicks, spacing2);
  return newTicks;
}
function determineMaxTicks(scale2) {
  const offset2 = scale2.options.offset;
  const tickLength = scale2._tickSize();
  const maxScale = scale2._length / tickLength + (offset2 ? 0 : 1);
  const maxChart = scale2._maxLength / tickLength;
  return Math.floor(Math.min(maxScale, maxChart));
}
function calculateSpacing(majorIndices, ticks, ticksLimit) {
  const evenMajorSpacing = getEvenSpacing(majorIndices);
  const spacing2 = ticks.length / ticksLimit;
  if (!evenMajorSpacing) {
    return Math.max(spacing2, 1);
  }
  const factors = _factorize(evenMajorSpacing);
  for (let i2 = 0, ilen = factors.length - 1; i2 < ilen; i2++) {
    const factor = factors[i2];
    if (factor > spacing2) {
      return factor;
    }
  }
  return Math.max(spacing2, 1);
}
function getMajorIndices(ticks) {
  const result = [];
  let i2, ilen;
  for (i2 = 0, ilen = ticks.length; i2 < ilen; i2++) {
    if (ticks[i2].major) {
      result.push(i2);
    }
  }
  return result;
}
function skipMajors(ticks, newTicks, majorIndices, spacing2) {
  let count = 0;
  let next2 = majorIndices[0];
  let i2;
  spacing2 = Math.ceil(spacing2);
  for (i2 = 0; i2 < ticks.length; i2++) {
    if (i2 === next2) {
      newTicks.push(ticks[i2]);
      count++;
      next2 = majorIndices[count * spacing2];
    }
  }
}
function skip(ticks, newTicks, spacing2, majorStart, majorEnd) {
  const start2 = valueOrDefault(majorStart, 0);
  const end2 = Math.min(valueOrDefault(majorEnd, ticks.length), ticks.length);
  let count = 0;
  let length2, i2, next2;
  spacing2 = Math.ceil(spacing2);
  if (majorEnd) {
    length2 = majorEnd - majorStart;
    spacing2 = length2 / Math.floor(length2 / spacing2);
  }
  next2 = start2;
  while (next2 < 0) {
    count++;
    next2 = Math.round(start2 + count * spacing2);
  }
  for (i2 = Math.max(start2, 0); i2 < end2; i2++) {
    if (i2 === next2) {
      newTicks.push(ticks[i2]);
      count++;
      next2 = Math.round(start2 + count * spacing2);
    }
  }
}
function getEvenSpacing(arr) {
  const len = arr.length;
  let i2, diff2;
  if (len < 2) {
    return false;
  }
  for (diff2 = arr[0], i2 = 1; i2 < len; ++i2) {
    if (arr[i2] - arr[i2 - 1] !== diff2) {
      return false;
    }
  }
  return diff2;
}
const reverseAlign = (align) => align === "left" ? "right" : align === "right" ? "left" : align;
const offsetFromEdge = (scale2, edge, offset2) => edge === "top" || edge === "left" ? scale2[edge] + offset2 : scale2[edge] - offset2;
const getTicksLimit = (ticksLength, maxTicksLimit) => Math.min(maxTicksLimit || ticksLength, ticksLength);
function sample(arr, numItems) {
  const result = [];
  const increment2 = arr.length / numItems;
  const len = arr.length;
  let i2 = 0;
  for (; i2 < len; i2 += increment2) {
    result.push(arr[Math.floor(i2)]);
  }
  return result;
}
function getPixelForGridLine(scale2, index2, offsetGridLines) {
  const length2 = scale2.ticks.length;
  const validIndex2 = Math.min(index2, length2 - 1);
  const start2 = scale2._startPixel;
  const end2 = scale2._endPixel;
  const epsilon = 1e-6;
  let lineValue = scale2.getPixelForTick(validIndex2);
  let offset2;
  if (offsetGridLines) {
    if (length2 === 1) {
      offset2 = Math.max(lineValue - start2, end2 - lineValue);
    } else if (index2 === 0) {
      offset2 = (scale2.getPixelForTick(1) - lineValue) / 2;
    } else {
      offset2 = (lineValue - scale2.getPixelForTick(validIndex2 - 1)) / 2;
    }
    lineValue += validIndex2 < index2 ? offset2 : -offset2;
    if (lineValue < start2 - epsilon || lineValue > end2 + epsilon) {
      return;
    }
  }
  return lineValue;
}
function garbageCollect(caches, length2) {
  each(caches, (cache2) => {
    const gc2 = cache2.gc;
    const gcLen = gc2.length / 2;
    let i2;
    if (gcLen > length2) {
      for (i2 = 0; i2 < gcLen; ++i2) {
        delete cache2.data[gc2[i2]];
      }
      gc2.splice(0, gcLen);
    }
  });
}
function getTickMarkLength(options) {
  return options.drawTicks ? options.tickLength : 0;
}
function getTitleHeight(options, fallback2) {
  if (!options.display) {
    return 0;
  }
  const font = toFont(options.font, fallback2);
  const padding = toPadding(options.padding);
  const lines = isArray$4(options.text) ? options.text.length : 1;
  return lines * font.lineHeight + padding.height;
}
function createScaleContext(parent, scale2) {
  return createContext(parent, {
    scale: scale2,
    type: "scale"
  });
}
function createTickContext(parent, index2, tick) {
  return createContext(parent, {
    tick,
    index: index2,
    type: "tick"
  });
}
function titleAlign(align, position2, reverse) {
  let ret = _toLeftRightCenter(align);
  if (reverse && position2 !== "right" || !reverse && position2 === "right") {
    ret = reverseAlign(ret);
  }
  return ret;
}
function titleArgs(scale2, offset2, position2, align) {
  const { top: top2, left: left2, bottom: bottom2, right, chart } = scale2;
  const { chartArea, scales } = chart;
  let rotation = 0;
  let maxWidth, titleX, titleY;
  const height = bottom2 - top2;
  const width = right - left2;
  if (scale2.isHorizontal()) {
    titleX = _alignStartEnd(align, left2, right);
    if (isObject$3(position2)) {
      const positionAxisID = Object.keys(position2)[0];
      const value2 = position2[positionAxisID];
      titleY = scales[positionAxisID].getPixelForValue(value2) + height - offset2;
    } else if (position2 === "center") {
      titleY = (chartArea.bottom + chartArea.top) / 2 + height - offset2;
    } else {
      titleY = offsetFromEdge(scale2, position2, offset2);
    }
    maxWidth = right - left2;
  } else {
    if (isObject$3(position2)) {
      const positionAxisID = Object.keys(position2)[0];
      const value2 = position2[positionAxisID];
      titleX = scales[positionAxisID].getPixelForValue(value2) - width + offset2;
    } else if (position2 === "center") {
      titleX = (chartArea.left + chartArea.right) / 2 - width + offset2;
    } else {
      titleX = offsetFromEdge(scale2, position2, offset2);
    }
    titleY = _alignStartEnd(align, bottom2, top2);
    rotation = position2 === "left" ? -HALF_PI : HALF_PI;
  }
  return {
    titleX,
    titleY,
    maxWidth,
    rotation
  };
}
class Scale extends Element$1 {
  constructor(cfg) {
    super();
    this.id = cfg.id;
    this.type = cfg.type;
    this.options = void 0;
    this.ctx = cfg.ctx;
    this.chart = cfg.chart;
    this.top = void 0;
    this.bottom = void 0;
    this.left = void 0;
    this.right = void 0;
    this.width = void 0;
    this.height = void 0;
    this._margins = {
      left: 0,
      right: 0,
      top: 0,
      bottom: 0
    };
    this.maxWidth = void 0;
    this.maxHeight = void 0;
    this.paddingTop = void 0;
    this.paddingBottom = void 0;
    this.paddingLeft = void 0;
    this.paddingRight = void 0;
    this.axis = void 0;
    this.labelRotation = void 0;
    this.min = void 0;
    this.max = void 0;
    this._range = void 0;
    this.ticks = [];
    this._gridLineItems = null;
    this._labelItems = null;
    this._labelSizes = null;
    this._length = 0;
    this._maxLength = 0;
    this._longestTextCache = {};
    this._startPixel = void 0;
    this._endPixel = void 0;
    this._reversePixels = false;
    this._userMax = void 0;
    this._userMin = void 0;
    this._suggestedMax = void 0;
    this._suggestedMin = void 0;
    this._ticksLength = 0;
    this._borderValue = 0;
    this._cache = {};
    this._dataLimitsCached = false;
    this.$context = void 0;
  }
  init(options) {
    this.options = options.setContext(this.getContext());
    this.axis = options.axis;
    this._userMin = this.parse(options.min);
    this._userMax = this.parse(options.max);
    this._suggestedMin = this.parse(options.suggestedMin);
    this._suggestedMax = this.parse(options.suggestedMax);
  }
  parse(raw, index2) {
    return raw;
  }
  getUserBounds() {
    let { _userMin, _userMax, _suggestedMin, _suggestedMax } = this;
    _userMin = finiteOrDefault(_userMin, Number.POSITIVE_INFINITY);
    _userMax = finiteOrDefault(_userMax, Number.NEGATIVE_INFINITY);
    _suggestedMin = finiteOrDefault(_suggestedMin, Number.POSITIVE_INFINITY);
    _suggestedMax = finiteOrDefault(_suggestedMax, Number.NEGATIVE_INFINITY);
    return {
      min: finiteOrDefault(_userMin, _suggestedMin),
      max: finiteOrDefault(_userMax, _suggestedMax),
      minDefined: isNumberFinite(_userMin),
      maxDefined: isNumberFinite(_userMax)
    };
  }
  getMinMax(canStack) {
    let { min: min2, max: max2, minDefined, maxDefined } = this.getUserBounds();
    let range3;
    if (minDefined && maxDefined) {
      return {
        min: min2,
        max: max2
      };
    }
    const metas = this.getMatchingVisibleMetas();
    for (let i2 = 0, ilen = metas.length; i2 < ilen; ++i2) {
      range3 = metas[i2].controller.getMinMax(this, canStack);
      if (!minDefined) {
        min2 = Math.min(min2, range3.min);
      }
      if (!maxDefined) {
        max2 = Math.max(max2, range3.max);
      }
    }
    min2 = maxDefined && min2 > max2 ? max2 : min2;
    max2 = minDefined && min2 > max2 ? min2 : max2;
    return {
      min: finiteOrDefault(min2, finiteOrDefault(max2, min2)),
      max: finiteOrDefault(max2, finiteOrDefault(min2, max2))
    };
  }
  getPadding() {
    return {
      left: this.paddingLeft || 0,
      top: this.paddingTop || 0,
      right: this.paddingRight || 0,
      bottom: this.paddingBottom || 0
    };
  }
  getTicks() {
    return this.ticks;
  }
  getLabels() {
    const data = this.chart.data;
    return this.options.labels || (this.isHorizontal() ? data.xLabels : data.yLabels) || data.labels || [];
  }
  getLabelItems(chartArea = this.chart.chartArea) {
    const items = this._labelItems || (this._labelItems = this._computeLabelItems(chartArea));
    return items;
  }
  beforeLayout() {
    this._cache = {};
    this._dataLimitsCached = false;
  }
  beforeUpdate() {
    callback(this.options.beforeUpdate, [
      this
    ]);
  }
  update(maxWidth, maxHeight, margins) {
    const { beginAtZero, grace, ticks: tickOpts } = this.options;
    const sampleSize = tickOpts.sampleSize;
    this.beforeUpdate();
    this.maxWidth = maxWidth;
    this.maxHeight = maxHeight;
    this._margins = margins = Object.assign({
      left: 0,
      right: 0,
      top: 0,
      bottom: 0
    }, margins);
    this.ticks = null;
    this._labelSizes = null;
    this._gridLineItems = null;
    this._labelItems = null;
    this.beforeSetDimensions();
    this.setDimensions();
    this.afterSetDimensions();
    this._maxLength = this.isHorizontal() ? this.width + margins.left + margins.right : this.height + margins.top + margins.bottom;
    if (!this._dataLimitsCached) {
      this.beforeDataLimits();
      this.determineDataLimits();
      this.afterDataLimits();
      this._range = _addGrace(this, grace, beginAtZero);
      this._dataLimitsCached = true;
    }
    this.beforeBuildTicks();
    this.ticks = this.buildTicks() || [];
    this.afterBuildTicks();
    const samplingEnabled = sampleSize < this.ticks.length;
    this._convertTicksToLabels(samplingEnabled ? sample(this.ticks, sampleSize) : this.ticks);
    this.configure();
    this.beforeCalculateLabelRotation();
    this.calculateLabelRotation();
    this.afterCalculateLabelRotation();
    if (tickOpts.display && (tickOpts.autoSkip || tickOpts.source === "auto")) {
      this.ticks = autoSkip(this, this.ticks);
      this._labelSizes = null;
      this.afterAutoSkip();
    }
    if (samplingEnabled) {
      this._convertTicksToLabels(this.ticks);
    }
    this.beforeFit();
    this.fit();
    this.afterFit();
    this.afterUpdate();
  }
  configure() {
    let reversePixels = this.options.reverse;
    let startPixel, endPixel;
    if (this.isHorizontal()) {
      startPixel = this.left;
      endPixel = this.right;
    } else {
      startPixel = this.top;
      endPixel = this.bottom;
      reversePixels = !reversePixels;
    }
    this._startPixel = startPixel;
    this._endPixel = endPixel;
    this._reversePixels = reversePixels;
    this._length = endPixel - startPixel;
    this._alignToPixels = this.options.alignToPixels;
  }
  afterUpdate() {
    callback(this.options.afterUpdate, [
      this
    ]);
  }
  beforeSetDimensions() {
    callback(this.options.beforeSetDimensions, [
      this
    ]);
  }
  setDimensions() {
    if (this.isHorizontal()) {
      this.width = this.maxWidth;
      this.left = 0;
      this.right = this.width;
    } else {
      this.height = this.maxHeight;
      this.top = 0;
      this.bottom = this.height;
    }
    this.paddingLeft = 0;
    this.paddingTop = 0;
    this.paddingRight = 0;
    this.paddingBottom = 0;
  }
  afterSetDimensions() {
    callback(this.options.afterSetDimensions, [
      this
    ]);
  }
  _callHooks(name2) {
    this.chart.notifyPlugins(name2, this.getContext());
    callback(this.options[name2], [
      this
    ]);
  }
  beforeDataLimits() {
    this._callHooks("beforeDataLimits");
  }
  determineDataLimits() {
  }
  afterDataLimits() {
    this._callHooks("afterDataLimits");
  }
  beforeBuildTicks() {
    this._callHooks("beforeBuildTicks");
  }
  buildTicks() {
    return [];
  }
  afterBuildTicks() {
    this._callHooks("afterBuildTicks");
  }
  beforeTickToLabelConversion() {
    callback(this.options.beforeTickToLabelConversion, [
      this
    ]);
  }
  generateTickLabels(ticks) {
    const tickOpts = this.options.ticks;
    let i2, ilen, tick;
    for (i2 = 0, ilen = ticks.length; i2 < ilen; i2++) {
      tick = ticks[i2];
      tick.label = callback(tickOpts.callback, [
        tick.value,
        i2,
        ticks
      ], this);
    }
  }
  afterTickToLabelConversion() {
    callback(this.options.afterTickToLabelConversion, [
      this
    ]);
  }
  beforeCalculateLabelRotation() {
    callback(this.options.beforeCalculateLabelRotation, [
      this
    ]);
  }
  calculateLabelRotation() {
    const options = this.options;
    const tickOpts = options.ticks;
    const numTicks = getTicksLimit(this.ticks.length, options.ticks.maxTicksLimit);
    const minRotation = tickOpts.minRotation || 0;
    const maxRotation = tickOpts.maxRotation;
    let labelRotation = minRotation;
    let tickWidth, maxHeight, maxLabelDiagonal;
    if (!this._isVisible() || !tickOpts.display || minRotation >= maxRotation || numTicks <= 1 || !this.isHorizontal()) {
      this.labelRotation = minRotation;
      return;
    }
    const labelSizes = this._getLabelSizes();
    const maxLabelWidth = labelSizes.widest.width;
    const maxLabelHeight = labelSizes.highest.height;
    const maxWidth = _limitValue(this.chart.width - maxLabelWidth, 0, this.maxWidth);
    tickWidth = options.offset ? this.maxWidth / numTicks : maxWidth / (numTicks - 1);
    if (maxLabelWidth + 6 > tickWidth) {
      tickWidth = maxWidth / (numTicks - (options.offset ? 0.5 : 1));
      maxHeight = this.maxHeight - getTickMarkLength(options.grid) - tickOpts.padding - getTitleHeight(options.title, this.chart.options.font);
      maxLabelDiagonal = Math.sqrt(maxLabelWidth * maxLabelWidth + maxLabelHeight * maxLabelHeight);
      labelRotation = toDegrees(Math.min(Math.asin(_limitValue((labelSizes.highest.height + 6) / tickWidth, -1, 1)), Math.asin(_limitValue(maxHeight / maxLabelDiagonal, -1, 1)) - Math.asin(_limitValue(maxLabelHeight / maxLabelDiagonal, -1, 1))));
      labelRotation = Math.max(minRotation, Math.min(maxRotation, labelRotation));
    }
    this.labelRotation = labelRotation;
  }
  afterCalculateLabelRotation() {
    callback(this.options.afterCalculateLabelRotation, [
      this
    ]);
  }
  afterAutoSkip() {
  }
  beforeFit() {
    callback(this.options.beforeFit, [
      this
    ]);
  }
  fit() {
    const minSize = {
      width: 0,
      height: 0
    };
    const { chart, options: { ticks: tickOpts, title: titleOpts, grid: gridOpts } } = this;
    const display = this._isVisible();
    const isHorizontal = this.isHorizontal();
    if (display) {
      const titleHeight = getTitleHeight(titleOpts, chart.options.font);
      if (isHorizontal) {
        minSize.width = this.maxWidth;
        minSize.height = getTickMarkLength(gridOpts) + titleHeight;
      } else {
        minSize.height = this.maxHeight;
        minSize.width = getTickMarkLength(gridOpts) + titleHeight;
      }
      if (tickOpts.display && this.ticks.length) {
        const { first, last, widest, highest } = this._getLabelSizes();
        const tickPadding = tickOpts.padding * 2;
        const angleRadians = toRadians(this.labelRotation);
        const cos = Math.cos(angleRadians);
        const sin = Math.sin(angleRadians);
        if (isHorizontal) {
          const labelHeight = tickOpts.mirror ? 0 : sin * widest.width + cos * highest.height;
          minSize.height = Math.min(this.maxHeight, minSize.height + labelHeight + tickPadding);
        } else {
          const labelWidth = tickOpts.mirror ? 0 : cos * widest.width + sin * highest.height;
          minSize.width = Math.min(this.maxWidth, minSize.width + labelWidth + tickPadding);
        }
        this._calculatePadding(first, last, sin, cos);
      }
    }
    this._handleMargins();
    if (isHorizontal) {
      this.width = this._length = chart.width - this._margins.left - this._margins.right;
      this.height = minSize.height;
    } else {
      this.width = minSize.width;
      this.height = this._length = chart.height - this._margins.top - this._margins.bottom;
    }
  }
  _calculatePadding(first, last, sin, cos) {
    const { ticks: { align, padding }, position: position2 } = this.options;
    const isRotated = this.labelRotation !== 0;
    const labelsBelowTicks = position2 !== "top" && this.axis === "x";
    if (this.isHorizontal()) {
      const offsetLeft = this.getPixelForTick(0) - this.left;
      const offsetRight = this.right - this.getPixelForTick(this.ticks.length - 1);
      let paddingLeft = 0;
      let paddingRight = 0;
      if (isRotated) {
        if (labelsBelowTicks) {
          paddingLeft = cos * first.width;
          paddingRight = sin * last.height;
        } else {
          paddingLeft = sin * first.height;
          paddingRight = cos * last.width;
        }
      } else if (align === "start") {
        paddingRight = last.width;
      } else if (align === "end") {
        paddingLeft = first.width;
      } else if (align !== "inner") {
        paddingLeft = first.width / 2;
        paddingRight = last.width / 2;
      }
      this.paddingLeft = Math.max((paddingLeft - offsetLeft + padding) * this.width / (this.width - offsetLeft), 0);
      this.paddingRight = Math.max((paddingRight - offsetRight + padding) * this.width / (this.width - offsetRight), 0);
    } else {
      let paddingTop = last.height / 2;
      let paddingBottom = first.height / 2;
      if (align === "start") {
        paddingTop = 0;
        paddingBottom = first.height;
      } else if (align === "end") {
        paddingTop = last.height;
        paddingBottom = 0;
      }
      this.paddingTop = paddingTop + padding;
      this.paddingBottom = paddingBottom + padding;
    }
  }
  _handleMargins() {
    if (this._margins) {
      this._margins.left = Math.max(this.paddingLeft, this._margins.left);
      this._margins.top = Math.max(this.paddingTop, this._margins.top);
      this._margins.right = Math.max(this.paddingRight, this._margins.right);
      this._margins.bottom = Math.max(this.paddingBottom, this._margins.bottom);
    }
  }
  afterFit() {
    callback(this.options.afterFit, [
      this
    ]);
  }
  isHorizontal() {
    const { axis, position: position2 } = this.options;
    return position2 === "top" || position2 === "bottom" || axis === "x";
  }
  isFullSize() {
    return this.options.fullSize;
  }
  _convertTicksToLabels(ticks) {
    this.beforeTickToLabelConversion();
    this.generateTickLabels(ticks);
    let i2, ilen;
    for (i2 = 0, ilen = ticks.length; i2 < ilen; i2++) {
      if (isNullOrUndef(ticks[i2].label)) {
        ticks.splice(i2, 1);
        ilen--;
        i2--;
      }
    }
    this.afterTickToLabelConversion();
  }
  _getLabelSizes() {
    let labelSizes = this._labelSizes;
    if (!labelSizes) {
      const sampleSize = this.options.ticks.sampleSize;
      let ticks = this.ticks;
      if (sampleSize < ticks.length) {
        ticks = sample(ticks, sampleSize);
      }
      this._labelSizes = labelSizes = this._computeLabelSizes(ticks, ticks.length, this.options.ticks.maxTicksLimit);
    }
    return labelSizes;
  }
  _computeLabelSizes(ticks, length2, maxTicksLimit) {
    const { ctx, _longestTextCache: caches } = this;
    const widths = [];
    const heights = [];
    const increment2 = Math.floor(length2 / getTicksLimit(length2, maxTicksLimit));
    let widestLabelSize = 0;
    let highestLabelSize = 0;
    let i2, j2, jlen, label, tickFont, fontString, cache2, lineHeight2, width, height, nestedLabel;
    for (i2 = 0; i2 < length2; i2 += increment2) {
      label = ticks[i2].label;
      tickFont = this._resolveTickFontOptions(i2);
      ctx.font = fontString = tickFont.string;
      cache2 = caches[fontString] = caches[fontString] || {
        data: {},
        gc: []
      };
      lineHeight2 = tickFont.lineHeight;
      width = height = 0;
      if (!isNullOrUndef(label) && !isArray$4(label)) {
        width = _measureText(ctx, cache2.data, cache2.gc, width, label);
        height = lineHeight2;
      } else if (isArray$4(label)) {
        for (j2 = 0, jlen = label.length; j2 < jlen; ++j2) {
          nestedLabel = label[j2];
          if (!isNullOrUndef(nestedLabel) && !isArray$4(nestedLabel)) {
            width = _measureText(ctx, cache2.data, cache2.gc, width, nestedLabel);
            height += lineHeight2;
          }
        }
      }
      widths.push(width);
      heights.push(height);
      widestLabelSize = Math.max(width, widestLabelSize);
      highestLabelSize = Math.max(height, highestLabelSize);
    }
    garbageCollect(caches, length2);
    const widest = widths.indexOf(widestLabelSize);
    const highest = heights.indexOf(highestLabelSize);
    const valueAt = (idx) => ({
      width: widths[idx] || 0,
      height: heights[idx] || 0
    });
    return {
      first: valueAt(0),
      last: valueAt(length2 - 1),
      widest: valueAt(widest),
      highest: valueAt(highest),
      widths,
      heights
    };
  }
  getLabelForValue(value2) {
    return value2;
  }
  getPixelForValue(value2, index2) {
    return NaN;
  }
  getValueForPixel(pixel) {
  }
  getPixelForTick(index2) {
    const ticks = this.ticks;
    if (index2 < 0 || index2 > ticks.length - 1) {
      return null;
    }
    return this.getPixelForValue(ticks[index2].value);
  }
  getPixelForDecimal(decimal) {
    if (this._reversePixels) {
      decimal = 1 - decimal;
    }
    const pixel = this._startPixel + decimal * this._length;
    return _int16Range(this._alignToPixels ? _alignPixel(this.chart, pixel, 0) : pixel);
  }
  getDecimalForPixel(pixel) {
    const decimal = (pixel - this._startPixel) / this._length;
    return this._reversePixels ? 1 - decimal : decimal;
  }
  getBasePixel() {
    return this.getPixelForValue(this.getBaseValue());
  }
  getBaseValue() {
    const { min: min2, max: max2 } = this;
    return min2 < 0 && max2 < 0 ? max2 : min2 > 0 && max2 > 0 ? min2 : 0;
  }
  getContext(index2) {
    const ticks = this.ticks || [];
    if (index2 >= 0 && index2 < ticks.length) {
      const tick = ticks[index2];
      return tick.$context || (tick.$context = createTickContext(this.getContext(), index2, tick));
    }
    return this.$context || (this.$context = createScaleContext(this.chart.getContext(), this));
  }
  _tickSize() {
    const optionTicks = this.options.ticks;
    const rot = toRadians(this.labelRotation);
    const cos = Math.abs(Math.cos(rot));
    const sin = Math.abs(Math.sin(rot));
    const labelSizes = this._getLabelSizes();
    const padding = optionTicks.autoSkipPadding || 0;
    const w2 = labelSizes ? labelSizes.widest.width + padding : 0;
    const h3 = labelSizes ? labelSizes.highest.height + padding : 0;
    return this.isHorizontal() ? h3 * cos > w2 * sin ? w2 / cos : h3 / sin : h3 * sin < w2 * cos ? h3 / cos : w2 / sin;
  }
  _isVisible() {
    const display = this.options.display;
    if (display !== "auto") {
      return !!display;
    }
    return this.getMatchingVisibleMetas().length > 0;
  }
  _computeGridLineItems(chartArea) {
    const axis = this.axis;
    const chart = this.chart;
    const options = this.options;
    const { grid, position: position2, border } = options;
    const offset2 = grid.offset;
    const isHorizontal = this.isHorizontal();
    const ticks = this.ticks;
    const ticksLength = ticks.length + (offset2 ? 1 : 0);
    const tl2 = getTickMarkLength(grid);
    const items = [];
    const borderOpts = border.setContext(this.getContext());
    const axisWidth = borderOpts.display ? borderOpts.width : 0;
    const axisHalfWidth = axisWidth / 2;
    const alignBorderValue = function(pixel) {
      return _alignPixel(chart, pixel, axisWidth);
    };
    let borderValue, i2, lineValue, alignedLineValue;
    let tx1, ty1, tx2, ty2, x1, y1, x2, y2;
    if (position2 === "top") {
      borderValue = alignBorderValue(this.bottom);
      ty1 = this.bottom - tl2;
      ty2 = borderValue - axisHalfWidth;
      y1 = alignBorderValue(chartArea.top) + axisHalfWidth;
      y2 = chartArea.bottom;
    } else if (position2 === "bottom") {
      borderValue = alignBorderValue(this.top);
      y1 = chartArea.top;
      y2 = alignBorderValue(chartArea.bottom) - axisHalfWidth;
      ty1 = borderValue + axisHalfWidth;
      ty2 = this.top + tl2;
    } else if (position2 === "left") {
      borderValue = alignBorderValue(this.right);
      tx1 = this.right - tl2;
      tx2 = borderValue - axisHalfWidth;
      x1 = alignBorderValue(chartArea.left) + axisHalfWidth;
      x2 = chartArea.right;
    } else if (position2 === "right") {
      borderValue = alignBorderValue(this.left);
      x1 = chartArea.left;
      x2 = alignBorderValue(chartArea.right) - axisHalfWidth;
      tx1 = borderValue + axisHalfWidth;
      tx2 = this.left + tl2;
    } else if (axis === "x") {
      if (position2 === "center") {
        borderValue = alignBorderValue((chartArea.top + chartArea.bottom) / 2 + 0.5);
      } else if (isObject$3(position2)) {
        const positionAxisID = Object.keys(position2)[0];
        const value2 = position2[positionAxisID];
        borderValue = alignBorderValue(this.chart.scales[positionAxisID].getPixelForValue(value2));
      }
      y1 = chartArea.top;
      y2 = chartArea.bottom;
      ty1 = borderValue + axisHalfWidth;
      ty2 = ty1 + tl2;
    } else if (axis === "y") {
      if (position2 === "center") {
        borderValue = alignBorderValue((chartArea.left + chartArea.right) / 2);
      } else if (isObject$3(position2)) {
        const positionAxisID = Object.keys(position2)[0];
        const value2 = position2[positionAxisID];
        borderValue = alignBorderValue(this.chart.scales[positionAxisID].getPixelForValue(value2));
      }
      tx1 = borderValue - axisHalfWidth;
      tx2 = tx1 - tl2;
      x1 = chartArea.left;
      x2 = chartArea.right;
    }
    const limit2 = valueOrDefault(options.ticks.maxTicksLimit, ticksLength);
    const step = Math.max(1, Math.ceil(ticksLength / limit2));
    for (i2 = 0; i2 < ticksLength; i2 += step) {
      const context = this.getContext(i2);
      const optsAtIndex = grid.setContext(context);
      const optsAtIndexBorder = border.setContext(context);
      const lineWidth = optsAtIndex.lineWidth;
      const lineColor = optsAtIndex.color;
      const borderDash = optsAtIndexBorder.dash || [];
      const borderDashOffset = optsAtIndexBorder.dashOffset;
      const tickWidth = optsAtIndex.tickWidth;
      const tickColor = optsAtIndex.tickColor;
      const tickBorderDash = optsAtIndex.tickBorderDash || [];
      const tickBorderDashOffset = optsAtIndex.tickBorderDashOffset;
      lineValue = getPixelForGridLine(this, i2, offset2);
      if (lineValue === void 0) {
        continue;
      }
      alignedLineValue = _alignPixel(chart, lineValue, lineWidth);
      if (isHorizontal) {
        tx1 = tx2 = x1 = x2 = alignedLineValue;
      } else {
        ty1 = ty2 = y1 = y2 = alignedLineValue;
      }
      items.push({
        tx1,
        ty1,
        tx2,
        ty2,
        x1,
        y1,
        x2,
        y2,
        width: lineWidth,
        color: lineColor,
        borderDash,
        borderDashOffset,
        tickWidth,
        tickColor,
        tickBorderDash,
        tickBorderDashOffset
      });
    }
    this._ticksLength = ticksLength;
    this._borderValue = borderValue;
    return items;
  }
  _computeLabelItems(chartArea) {
    const axis = this.axis;
    const options = this.options;
    const { position: position2, ticks: optionTicks } = options;
    const isHorizontal = this.isHorizontal();
    const ticks = this.ticks;
    const { align, crossAlign, padding, mirror } = optionTicks;
    const tl2 = getTickMarkLength(options.grid);
    const tickAndPadding = tl2 + padding;
    const hTickAndPadding = mirror ? -padding : tickAndPadding;
    const rotation = -toRadians(this.labelRotation);
    const items = [];
    let i2, ilen, tick, label, x2, y2, textAlign, pixel, font, lineHeight2, lineCount, textOffset;
    let textBaseline = "middle";
    if (position2 === "top") {
      y2 = this.bottom - hTickAndPadding;
      textAlign = this._getXAxisLabelAlignment();
    } else if (position2 === "bottom") {
      y2 = this.top + hTickAndPadding;
      textAlign = this._getXAxisLabelAlignment();
    } else if (position2 === "left") {
      const ret = this._getYAxisLabelAlignment(tl2);
      textAlign = ret.textAlign;
      x2 = ret.x;
    } else if (position2 === "right") {
      const ret = this._getYAxisLabelAlignment(tl2);
      textAlign = ret.textAlign;
      x2 = ret.x;
    } else if (axis === "x") {
      if (position2 === "center") {
        y2 = (chartArea.top + chartArea.bottom) / 2 + tickAndPadding;
      } else if (isObject$3(position2)) {
        const positionAxisID = Object.keys(position2)[0];
        const value2 = position2[positionAxisID];
        y2 = this.chart.scales[positionAxisID].getPixelForValue(value2) + tickAndPadding;
      }
      textAlign = this._getXAxisLabelAlignment();
    } else if (axis === "y") {
      if (position2 === "center") {
        x2 = (chartArea.left + chartArea.right) / 2 - tickAndPadding;
      } else if (isObject$3(position2)) {
        const positionAxisID = Object.keys(position2)[0];
        const value2 = position2[positionAxisID];
        x2 = this.chart.scales[positionAxisID].getPixelForValue(value2);
      }
      textAlign = this._getYAxisLabelAlignment(tl2).textAlign;
    }
    if (axis === "y") {
      if (align === "start") {
        textBaseline = "top";
      } else if (align === "end") {
        textBaseline = "bottom";
      }
    }
    const labelSizes = this._getLabelSizes();
    for (i2 = 0, ilen = ticks.length; i2 < ilen; ++i2) {
      tick = ticks[i2];
      label = tick.label;
      const optsAtIndex = optionTicks.setContext(this.getContext(i2));
      pixel = this.getPixelForTick(i2) + optionTicks.labelOffset;
      font = this._resolveTickFontOptions(i2);
      lineHeight2 = font.lineHeight;
      lineCount = isArray$4(label) ? label.length : 1;
      const halfCount = lineCount / 2;
      const color2 = optsAtIndex.color;
      const strokeColor = optsAtIndex.textStrokeColor;
      const strokeWidth = optsAtIndex.textStrokeWidth;
      let tickTextAlign = textAlign;
      if (isHorizontal) {
        x2 = pixel;
        if (textAlign === "inner") {
          if (i2 === ilen - 1) {
            tickTextAlign = !this.options.reverse ? "right" : "left";
          } else if (i2 === 0) {
            tickTextAlign = !this.options.reverse ? "left" : "right";
          } else {
            tickTextAlign = "center";
          }
        }
        if (position2 === "top") {
          if (crossAlign === "near" || rotation !== 0) {
            textOffset = -lineCount * lineHeight2 + lineHeight2 / 2;
          } else if (crossAlign === "center") {
            textOffset = -labelSizes.highest.height / 2 - halfCount * lineHeight2 + lineHeight2;
          } else {
            textOffset = -labelSizes.highest.height + lineHeight2 / 2;
          }
        } else {
          if (crossAlign === "near" || rotation !== 0) {
            textOffset = lineHeight2 / 2;
          } else if (crossAlign === "center") {
            textOffset = labelSizes.highest.height / 2 - halfCount * lineHeight2;
          } else {
            textOffset = labelSizes.highest.height - lineCount * lineHeight2;
          }
        }
        if (mirror) {
          textOffset *= -1;
        }
        if (rotation !== 0 && !optsAtIndex.showLabelBackdrop) {
          x2 += lineHeight2 / 2 * Math.sin(rotation);
        }
      } else {
        y2 = pixel;
        textOffset = (1 - lineCount) * lineHeight2 / 2;
      }
      let backdrop;
      if (optsAtIndex.showLabelBackdrop) {
        const labelPadding = toPadding(optsAtIndex.backdropPadding);
        const height = labelSizes.heights[i2];
        const width = labelSizes.widths[i2];
        let top2 = textOffset - labelPadding.top;
        let left2 = 0 - labelPadding.left;
        switch (textBaseline) {
          case "middle":
            top2 -= height / 2;
            break;
          case "bottom":
            top2 -= height;
            break;
        }
        switch (textAlign) {
          case "center":
            left2 -= width / 2;
            break;
          case "right":
            left2 -= width;
            break;
          case "inner":
            if (i2 === ilen - 1) {
              left2 -= width;
            } else if (i2 > 0) {
              left2 -= width / 2;
            }
            break;
        }
        backdrop = {
          left: left2,
          top: top2,
          width: width + labelPadding.width,
          height: height + labelPadding.height,
          color: optsAtIndex.backdropColor
        };
      }
      items.push({
        label,
        font,
        textOffset,
        options: {
          rotation,
          color: color2,
          strokeColor,
          strokeWidth,
          textAlign: tickTextAlign,
          textBaseline,
          translation: [
            x2,
            y2
          ],
          backdrop
        }
      });
    }
    return items;
  }
  _getXAxisLabelAlignment() {
    const { position: position2, ticks } = this.options;
    const rotation = -toRadians(this.labelRotation);
    if (rotation) {
      return position2 === "top" ? "left" : "right";
    }
    let align = "center";
    if (ticks.align === "start") {
      align = "left";
    } else if (ticks.align === "end") {
      align = "right";
    } else if (ticks.align === "inner") {
      align = "inner";
    }
    return align;
  }
  _getYAxisLabelAlignment(tl2) {
    const { position: position2, ticks: { crossAlign, mirror, padding } } = this.options;
    const labelSizes = this._getLabelSizes();
    const tickAndPadding = tl2 + padding;
    const widest = labelSizes.widest.width;
    let textAlign;
    let x2;
    if (position2 === "left") {
      if (mirror) {
        x2 = this.right + padding;
        if (crossAlign === "near") {
          textAlign = "left";
        } else if (crossAlign === "center") {
          textAlign = "center";
          x2 += widest / 2;
        } else {
          textAlign = "right";
          x2 += widest;
        }
      } else {
        x2 = this.right - tickAndPadding;
        if (crossAlign === "near") {
          textAlign = "right";
        } else if (crossAlign === "center") {
          textAlign = "center";
          x2 -= widest / 2;
        } else {
          textAlign = "left";
          x2 = this.left;
        }
      }
    } else if (position2 === "right") {
      if (mirror) {
        x2 = this.left + padding;
        if (crossAlign === "near") {
          textAlign = "right";
        } else if (crossAlign === "center") {
          textAlign = "center";
          x2 -= widest / 2;
        } else {
          textAlign = "left";
          x2 -= widest;
        }
      } else {
        x2 = this.left + tickAndPadding;
        if (crossAlign === "near") {
          textAlign = "left";
        } else if (crossAlign === "center") {
          textAlign = "center";
          x2 += widest / 2;
        } else {
          textAlign = "right";
          x2 = this.right;
        }
      }
    } else {
      textAlign = "right";
    }
    return {
      textAlign,
      x: x2
    };
  }
  _computeLabelArea() {
    if (this.options.ticks.mirror) {
      return;
    }
    const chart = this.chart;
    const position2 = this.options.position;
    if (position2 === "left" || position2 === "right") {
      return {
        top: 0,
        left: this.left,
        bottom: chart.height,
        right: this.right
      };
    }
    if (position2 === "top" || position2 === "bottom") {
      return {
        top: this.top,
        left: 0,
        bottom: this.bottom,
        right: chart.width
      };
    }
  }
  drawBackground() {
    const { ctx, options: { backgroundColor }, left: left2, top: top2, width, height } = this;
    if (backgroundColor) {
      ctx.save();
      ctx.fillStyle = backgroundColor;
      ctx.fillRect(left2, top2, width, height);
      ctx.restore();
    }
  }
  getLineWidthForValue(value2) {
    const grid = this.options.grid;
    if (!this._isVisible() || !grid.display) {
      return 0;
    }
    const ticks = this.ticks;
    const index2 = ticks.findIndex((t2) => t2.value === value2);
    if (index2 >= 0) {
      const opts2 = grid.setContext(this.getContext(index2));
      return opts2.lineWidth;
    }
    return 0;
  }
  drawGrid(chartArea) {
    const grid = this.options.grid;
    const ctx = this.ctx;
    const items = this._gridLineItems || (this._gridLineItems = this._computeGridLineItems(chartArea));
    let i2, ilen;
    const drawLine = (p1, p2, style2) => {
      if (!style2.width || !style2.color) {
        return;
      }
      ctx.save();
      ctx.lineWidth = style2.width;
      ctx.strokeStyle = style2.color;
      ctx.setLineDash(style2.borderDash || []);
      ctx.lineDashOffset = style2.borderDashOffset;
      ctx.beginPath();
      ctx.moveTo(p1.x, p1.y);
      ctx.lineTo(p2.x, p2.y);
      ctx.stroke();
      ctx.restore();
    };
    if (grid.display) {
      for (i2 = 0, ilen = items.length; i2 < ilen; ++i2) {
        const item = items[i2];
        if (grid.drawOnChartArea) {
          drawLine({
            x: item.x1,
            y: item.y1
          }, {
            x: item.x2,
            y: item.y2
          }, item);
        }
        if (grid.drawTicks) {
          drawLine({
            x: item.tx1,
            y: item.ty1
          }, {
            x: item.tx2,
            y: item.ty2
          }, {
            color: item.tickColor,
            width: item.tickWidth,
            borderDash: item.tickBorderDash,
            borderDashOffset: item.tickBorderDashOffset
          });
        }
      }
    }
  }
  drawBorder() {
    const { chart, ctx, options: { border, grid } } = this;
    const borderOpts = border.setContext(this.getContext());
    const axisWidth = border.display ? borderOpts.width : 0;
    if (!axisWidth) {
      return;
    }
    const lastLineWidth = grid.setContext(this.getContext(0)).lineWidth;
    const borderValue = this._borderValue;
    let x1, x2, y1, y2;
    if (this.isHorizontal()) {
      x1 = _alignPixel(chart, this.left, axisWidth) - axisWidth / 2;
      x2 = _alignPixel(chart, this.right, lastLineWidth) + lastLineWidth / 2;
      y1 = y2 = borderValue;
    } else {
      y1 = _alignPixel(chart, this.top, axisWidth) - axisWidth / 2;
      y2 = _alignPixel(chart, this.bottom, lastLineWidth) + lastLineWidth / 2;
      x1 = x2 = borderValue;
    }
    ctx.save();
    ctx.lineWidth = borderOpts.width;
    ctx.strokeStyle = borderOpts.color;
    ctx.beginPath();
    ctx.moveTo(x1, y1);
    ctx.lineTo(x2, y2);
    ctx.stroke();
    ctx.restore();
  }
  drawLabels(chartArea) {
    const optionTicks = this.options.ticks;
    if (!optionTicks.display) {
      return;
    }
    const ctx = this.ctx;
    const area = this._computeLabelArea();
    if (area) {
      clipArea(ctx, area);
    }
    const items = this.getLabelItems(chartArea);
    for (const item of items) {
      const renderTextOptions = item.options;
      const tickFont = item.font;
      const label = item.label;
      const y2 = item.textOffset;
      renderText(ctx, label, 0, y2, tickFont, renderTextOptions);
    }
    if (area) {
      unclipArea(ctx);
    }
  }
  drawTitle() {
    const { ctx, options: { position: position2, title, reverse } } = this;
    if (!title.display) {
      return;
    }
    const font = toFont(title.font);
    const padding = toPadding(title.padding);
    const align = title.align;
    let offset2 = font.lineHeight / 2;
    if (position2 === "bottom" || position2 === "center" || isObject$3(position2)) {
      offset2 += padding.bottom;
      if (isArray$4(title.text)) {
        offset2 += font.lineHeight * (title.text.length - 1);
      }
    } else {
      offset2 += padding.top;
    }
    const { titleX, titleY, maxWidth, rotation } = titleArgs(this, offset2, position2, align);
    renderText(ctx, title.text, 0, 0, font, {
      color: title.color,
      maxWidth,
      rotation,
      textAlign: titleAlign(align, position2, reverse),
      textBaseline: "middle",
      translation: [
        titleX,
        titleY
      ]
    });
  }
  draw(chartArea) {
    if (!this._isVisible()) {
      return;
    }
    this.drawBackground();
    this.drawGrid(chartArea);
    this.drawBorder();
    this.drawTitle();
    this.drawLabels(chartArea);
  }
  _layers() {
    const opts2 = this.options;
    const tz = opts2.ticks && opts2.ticks.z || 0;
    const gz = valueOrDefault(opts2.grid && opts2.grid.z, -1);
    const bz = valueOrDefault(opts2.border && opts2.border.z, 0);
    if (!this._isVisible() || this.draw !== Scale.prototype.draw) {
      return [
        {
          z: tz,
          draw: (chartArea) => {
            this.draw(chartArea);
          }
        }
      ];
    }
    return [
      {
        z: gz,
        draw: (chartArea) => {
          this.drawBackground();
          this.drawGrid(chartArea);
          this.drawTitle();
        }
      },
      {
        z: bz,
        draw: () => {
          this.drawBorder();
        }
      },
      {
        z: tz,
        draw: (chartArea) => {
          this.drawLabels(chartArea);
        }
      }
    ];
  }
  getMatchingVisibleMetas(type4) {
    const metas = this.chart.getSortedVisibleDatasetMetas();
    const axisID = this.axis + "AxisID";
    const result = [];
    let i2, ilen;
    for (i2 = 0, ilen = metas.length; i2 < ilen; ++i2) {
      const meta = metas[i2];
      if (meta[axisID] === this.id && (!type4 || meta.type === type4)) {
        result.push(meta);
      }
    }
    return result;
  }
  _resolveTickFontOptions(index2) {
    const opts2 = this.options.ticks.setContext(this.getContext(index2));
    return toFont(opts2.font);
  }
  _maxDigits() {
    const fontSize = this._resolveTickFontOptions(0).lineHeight;
    return (this.isHorizontal() ? this.width : this.height) / fontSize;
  }
}
class TypedRegistry {
  constructor(type4, scope, override) {
    this.type = type4;
    this.scope = scope;
    this.override = override;
    this.items = /* @__PURE__ */ Object.create(null);
  }
  isForType(type4) {
    return Object.prototype.isPrototypeOf.call(this.type.prototype, type4.prototype);
  }
  register(item) {
    const proto2 = Object.getPrototypeOf(item);
    let parentScope;
    if (isIChartComponent(proto2)) {
      parentScope = this.register(proto2);
    }
    const items = this.items;
    const id2 = item.id;
    const scope = this.scope + "." + id2;
    if (!id2) {
      throw new Error("class does not have id: " + item);
    }
    if (id2 in items) {
      return scope;
    }
    items[id2] = item;
    registerDefaults(item, scope, parentScope);
    if (this.override) {
      defaults$2.override(item.id, item.overrides);
    }
    return scope;
  }
  get(id2) {
    return this.items[id2];
  }
  unregister(item) {
    const items = this.items;
    const id2 = item.id;
    const scope = this.scope;
    if (id2 in items) {
      delete items[id2];
    }
    if (scope && id2 in defaults$2[scope]) {
      delete defaults$2[scope][id2];
      if (this.override) {
        delete overrides[id2];
      }
    }
  }
}
function registerDefaults(item, scope, parentScope) {
  const itemDefaults = merge$2(/* @__PURE__ */ Object.create(null), [
    parentScope ? defaults$2.get(parentScope) : {},
    defaults$2.get(scope),
    item.defaults
  ]);
  defaults$2.set(scope, itemDefaults);
  if (item.defaultRoutes) {
    routeDefaults(scope, item.defaultRoutes);
  }
  if (item.descriptors) {
    defaults$2.describe(scope, item.descriptors);
  }
}
function routeDefaults(scope, routes) {
  Object.keys(routes).forEach((property2) => {
    const propertyParts = property2.split(".");
    const sourceName = propertyParts.pop();
    const sourceScope = [
      scope
    ].concat(propertyParts).join(".");
    const parts = routes[property2].split(".");
    const targetName = parts.pop();
    const targetScope = parts.join(".");
    defaults$2.route(sourceScope, sourceName, targetScope, targetName);
  });
}
function isIChartComponent(proto2) {
  return "id" in proto2 && "defaults" in proto2;
}
class Registry {
  constructor() {
    this.controllers = new TypedRegistry(DatasetController, "datasets", true);
    this.elements = new TypedRegistry(Element$1, "elements");
    this.plugins = new TypedRegistry(Object, "plugins");
    this.scales = new TypedRegistry(Scale, "scales");
    this._typedRegistries = [
      this.controllers,
      this.scales,
      this.elements
    ];
  }
  add(...args) {
    this._each("register", args);
  }
  remove(...args) {
    this._each("unregister", args);
  }
  addControllers(...args) {
    this._each("register", args, this.controllers);
  }
  addElements(...args) {
    this._each("register", args, this.elements);
  }
  addPlugins(...args) {
    this._each("register", args, this.plugins);
  }
  addScales(...args) {
    this._each("register", args, this.scales);
  }
  getController(id2) {
    return this._get(id2, this.controllers, "controller");
  }
  getElement(id2) {
    return this._get(id2, this.elements, "element");
  }
  getPlugin(id2) {
    return this._get(id2, this.plugins, "plugin");
  }
  getScale(id2) {
    return this._get(id2, this.scales, "scale");
  }
  removeControllers(...args) {
    this._each("unregister", args, this.controllers);
  }
  removeElements(...args) {
    this._each("unregister", args, this.elements);
  }
  removePlugins(...args) {
    this._each("unregister", args, this.plugins);
  }
  removeScales(...args) {
    this._each("unregister", args, this.scales);
  }
  _each(method4, args, typedRegistry) {
    [
      ...args
    ].forEach((arg) => {
      const reg = typedRegistry || this._getRegistryForType(arg);
      if (typedRegistry || reg.isForType(arg) || reg === this.plugins && arg.id) {
        this._exec(method4, reg, arg);
      } else {
        each(arg, (item) => {
          const itemReg = typedRegistry || this._getRegistryForType(item);
          this._exec(method4, itemReg, item);
        });
      }
    });
  }
  _exec(method4, registry2, component) {
    const camelMethod = _capitalize(method4);
    callback(component["before" + camelMethod], [], component);
    registry2[method4](component);
    callback(component["after" + camelMethod], [], component);
  }
  _getRegistryForType(type4) {
    for (let i2 = 0; i2 < this._typedRegistries.length; i2++) {
      const reg = this._typedRegistries[i2];
      if (reg.isForType(type4)) {
        return reg;
      }
    }
    return this.plugins;
  }
  _get(id2, typedRegistry, type4) {
    const item = typedRegistry.get(id2);
    if (item === void 0) {
      throw new Error('"' + id2 + '" is not a registered ' + type4 + ".");
    }
    return item;
  }
}
var registry = /* @__PURE__ */ new Registry();
class PluginService {
  constructor() {
    this._init = [];
  }
  notify(chart, hook, args, filter3) {
    if (hook === "beforeInit") {
      this._init = this._createDescriptors(chart, true);
      this._notify(this._init, chart, "install");
    }
    const descriptors2 = filter3 ? this._descriptors(chart).filter(filter3) : this._descriptors(chart);
    const result = this._notify(descriptors2, chart, hook, args);
    if (hook === "afterDestroy") {
      this._notify(descriptors2, chart, "stop");
      this._notify(this._init, chart, "uninstall");
    }
    return result;
  }
  _notify(descriptors2, chart, hook, args) {
    args = args || {};
    for (const descriptor of descriptors2) {
      const plugin = descriptor.plugin;
      const method4 = plugin[hook];
      const params = [
        chart,
        args,
        descriptor.options
      ];
      if (callback(method4, params, plugin) === false && args.cancelable) {
        return false;
      }
    }
    return true;
  }
  invalidate() {
    if (!isNullOrUndef(this._cache)) {
      this._oldCache = this._cache;
      this._cache = void 0;
    }
  }
  _descriptors(chart) {
    if (this._cache) {
      return this._cache;
    }
    const descriptors2 = this._cache = this._createDescriptors(chart);
    this._notifyStateChanges(chart);
    return descriptors2;
  }
  _createDescriptors(chart, all3) {
    const config2 = chart && chart.config;
    const options = valueOrDefault(config2.options && config2.options.plugins, {});
    const plugins = allPlugins(config2);
    return options === false && !all3 ? [] : createDescriptors(chart, plugins, options, all3);
  }
  _notifyStateChanges(chart) {
    const previousDescriptors = this._oldCache || [];
    const descriptors2 = this._cache;
    const diff2 = (a2, b2) => a2.filter((x2) => !b2.some((y2) => x2.plugin.id === y2.plugin.id));
    this._notify(diff2(previousDescriptors, descriptors2), chart, "stop");
    this._notify(diff2(descriptors2, previousDescriptors), chart, "start");
  }
}
function allPlugins(config2) {
  const localIds = {};
  const plugins = [];
  const keys2 = Object.keys(registry.plugins.items);
  for (let i2 = 0; i2 < keys2.length; i2++) {
    plugins.push(registry.getPlugin(keys2[i2]));
  }
  const local = config2.plugins || [];
  for (let i2 = 0; i2 < local.length; i2++) {
    const plugin = local[i2];
    if (plugins.indexOf(plugin) === -1) {
      plugins.push(plugin);
      localIds[plugin.id] = true;
    }
  }
  return {
    plugins,
    localIds
  };
}
function getOpts(options, all3) {
  if (!all3 && options === false) {
    return null;
  }
  if (options === true) {
    return {};
  }
  return options;
}
function createDescriptors(chart, { plugins, localIds }, options, all3) {
  const result = [];
  const context = chart.getContext();
  for (const plugin of plugins) {
    const id2 = plugin.id;
    const opts2 = getOpts(options[id2], all3);
    if (opts2 === null) {
      continue;
    }
    result.push({
      plugin,
      options: pluginOpts(chart.config, {
        plugin,
        local: localIds[id2]
      }, opts2, context)
    });
  }
  return result;
}
function pluginOpts(config2, { plugin, local }, opts2, context) {
  const keys2 = config2.pluginScopeKeys(plugin);
  const scopes = config2.getOptionScopes(opts2, keys2);
  if (local && plugin.defaults) {
    scopes.push(plugin.defaults);
  }
  return config2.createResolver(scopes, context, [
    ""
  ], {
    scriptable: false,
    indexable: false,
    allKeys: true
  });
}
function getIndexAxis(type4, options) {
  const datasetDefaults = defaults$2.datasets[type4] || {};
  const datasetOptions = (options.datasets || {})[type4] || {};
  return datasetOptions.indexAxis || options.indexAxis || datasetDefaults.indexAxis || "x";
}
function getAxisFromDefaultScaleID(id2, indexAxis) {
  let axis = id2;
  if (id2 === "_index_") {
    axis = indexAxis;
  } else if (id2 === "_value_") {
    axis = indexAxis === "x" ? "y" : "x";
  }
  return axis;
}
function getDefaultScaleIDFromAxis(axis, indexAxis) {
  return axis === indexAxis ? "_index_" : "_value_";
}
function idMatchesAxis(id2) {
  if (id2 === "x" || id2 === "y" || id2 === "r") {
    return id2;
  }
}
function axisFromPosition(position2) {
  if (position2 === "top" || position2 === "bottom") {
    return "x";
  }
  if (position2 === "left" || position2 === "right") {
    return "y";
  }
}
function determineAxis(id2, ...scaleOptions) {
  if (idMatchesAxis(id2)) {
    return id2;
  }
  for (const opts2 of scaleOptions) {
    const axis = opts2.axis || axisFromPosition(opts2.position) || id2.length > 1 && idMatchesAxis(id2[0].toLowerCase());
    if (axis) {
      return axis;
    }
  }
  throw new Error(`Cannot determine type of '${id2}' axis. Please provide 'axis' or 'position' option.`);
}
function getAxisFromDataset(id2, axis, dataset) {
  if (dataset[axis + "AxisID"] === id2) {
    return {
      axis
    };
  }
}
function retrieveAxisFromDatasets(id2, config2) {
  if (config2.data && config2.data.datasets) {
    const boundDs = config2.data.datasets.filter((d2) => d2.xAxisID === id2 || d2.yAxisID === id2);
    if (boundDs.length) {
      return getAxisFromDataset(id2, "x", boundDs[0]) || getAxisFromDataset(id2, "y", boundDs[0]);
    }
  }
  return {};
}
function mergeScaleConfig(config2, options) {
  const chartDefaults = overrides[config2.type] || {
    scales: {}
  };
  const configScales = options.scales || {};
  const chartIndexAxis = getIndexAxis(config2.type, options);
  const scales = /* @__PURE__ */ Object.create(null);
  Object.keys(configScales).forEach((id2) => {
    const scaleConf = configScales[id2];
    if (!isObject$3(scaleConf)) {
      return console.error(`Invalid scale configuration for scale: ${id2}`);
    }
    if (scaleConf._proxy) {
      return console.warn(`Ignoring resolver passed as options for scale: ${id2}`);
    }
    const axis = determineAxis(id2, scaleConf, retrieveAxisFromDatasets(id2, config2), defaults$2.scales[scaleConf.type]);
    const defaultId = getDefaultScaleIDFromAxis(axis, chartIndexAxis);
    const defaultScaleOptions = chartDefaults.scales || {};
    scales[id2] = mergeIf(/* @__PURE__ */ Object.create(null), [
      {
        axis
      },
      scaleConf,
      defaultScaleOptions[axis],
      defaultScaleOptions[defaultId]
    ]);
  });
  config2.data.datasets.forEach((dataset) => {
    const type4 = dataset.type || config2.type;
    const indexAxis = dataset.indexAxis || getIndexAxis(type4, options);
    const datasetDefaults = overrides[type4] || {};
    const defaultScaleOptions = datasetDefaults.scales || {};
    Object.keys(defaultScaleOptions).forEach((defaultID) => {
      const axis = getAxisFromDefaultScaleID(defaultID, indexAxis);
      const id2 = dataset[axis + "AxisID"] || axis;
      scales[id2] = scales[id2] || /* @__PURE__ */ Object.create(null);
      mergeIf(scales[id2], [
        {
          axis
        },
        configScales[id2],
        defaultScaleOptions[defaultID]
      ]);
    });
  });
  Object.keys(scales).forEach((key) => {
    const scale2 = scales[key];
    mergeIf(scale2, [
      defaults$2.scales[scale2.type],
      defaults$2.scale
    ]);
  });
  return scales;
}
function initOptions(config2) {
  const options = config2.options || (config2.options = {});
  options.plugins = valueOrDefault(options.plugins, {});
  options.scales = mergeScaleConfig(config2, options);
}
function initData(data) {
  data = data || {};
  data.datasets = data.datasets || [];
  data.labels = data.labels || [];
  return data;
}
function initConfig(config2) {
  config2 = config2 || {};
  config2.data = initData(config2.data);
  initOptions(config2);
  return config2;
}
const keyCache = /* @__PURE__ */ new Map();
const keysCached = /* @__PURE__ */ new Set();
function cachedKeys(cacheKey, generate2) {
  let keys2 = keyCache.get(cacheKey);
  if (!keys2) {
    keys2 = generate2();
    keyCache.set(cacheKey, keys2);
    keysCached.add(keys2);
  }
  return keys2;
}
const addIfFound = (set2, obj, key) => {
  const opts2 = resolveObjectKey(obj, key);
  if (opts2 !== void 0) {
    set2.add(opts2);
  }
};
class Config {
  constructor(config2) {
    this._config = initConfig(config2);
    this._scopeCache = /* @__PURE__ */ new Map();
    this._resolverCache = /* @__PURE__ */ new Map();
  }
  get platform() {
    return this._config.platform;
  }
  get type() {
    return this._config.type;
  }
  set type(type4) {
    this._config.type = type4;
  }
  get data() {
    return this._config.data;
  }
  set data(data) {
    this._config.data = initData(data);
  }
  get options() {
    return this._config.options;
  }
  set options(options) {
    this._config.options = options;
  }
  get plugins() {
    return this._config.plugins;
  }
  update() {
    const config2 = this._config;
    this.clearCache();
    initOptions(config2);
  }
  clearCache() {
    this._scopeCache.clear();
    this._resolverCache.clear();
  }
  datasetScopeKeys(datasetType) {
    return cachedKeys(datasetType, () => [
      [
        `datasets.${datasetType}`,
        ""
      ]
    ]);
  }
  datasetAnimationScopeKeys(datasetType, transition3) {
    return cachedKeys(`${datasetType}.transition.${transition3}`, () => [
      [
        `datasets.${datasetType}.transitions.${transition3}`,
        `transitions.${transition3}`
      ],
      [
        `datasets.${datasetType}`,
        ""
      ]
    ]);
  }
  datasetElementScopeKeys(datasetType, elementType) {
    return cachedKeys(`${datasetType}-${elementType}`, () => [
      [
        `datasets.${datasetType}.elements.${elementType}`,
        `datasets.${datasetType}`,
        `elements.${elementType}`,
        ""
      ]
    ]);
  }
  pluginScopeKeys(plugin) {
    const id2 = plugin.id;
    const type4 = this.type;
    return cachedKeys(`${type4}-plugin-${id2}`, () => [
      [
        `plugins.${id2}`,
        ...plugin.additionalOptionScopes || []
      ]
    ]);
  }
  _cachedScopes(mainScope, resetCache) {
    const _scopeCache = this._scopeCache;
    let cache2 = _scopeCache.get(mainScope);
    if (!cache2 || resetCache) {
      cache2 = /* @__PURE__ */ new Map();
      _scopeCache.set(mainScope, cache2);
    }
    return cache2;
  }
  getOptionScopes(mainScope, keyLists, resetCache) {
    const { options, type: type4 } = this;
    const cache2 = this._cachedScopes(mainScope, resetCache);
    const cached = cache2.get(keyLists);
    if (cached) {
      return cached;
    }
    const scopes = /* @__PURE__ */ new Set();
    keyLists.forEach((keys2) => {
      if (mainScope) {
        scopes.add(mainScope);
        keys2.forEach((key) => addIfFound(scopes, mainScope, key));
      }
      keys2.forEach((key) => addIfFound(scopes, options, key));
      keys2.forEach((key) => addIfFound(scopes, overrides[type4] || {}, key));
      keys2.forEach((key) => addIfFound(scopes, defaults$2, key));
      keys2.forEach((key) => addIfFound(scopes, descriptors$1, key));
    });
    const array4 = Array.from(scopes);
    if (array4.length === 0) {
      array4.push(/* @__PURE__ */ Object.create(null));
    }
    if (keysCached.has(keyLists)) {
      cache2.set(keyLists, array4);
    }
    return array4;
  }
  chartOptionScopes() {
    const { options, type: type4 } = this;
    return [
      options,
      overrides[type4] || {},
      defaults$2.datasets[type4] || {},
      {
        type: type4
      },
      defaults$2,
      descriptors$1
    ];
  }
  resolveNamedOptions(scopes, names2, context, prefixes = [
    ""
  ]) {
    const result = {
      $shared: true
    };
    const { resolver: resolver2, subPrefixes } = getResolver(this._resolverCache, scopes, prefixes);
    let options = resolver2;
    if (needContext(resolver2, names2)) {
      result.$shared = false;
      context = isFunction$3(context) ? context() : context;
      const subResolver = this.createResolver(scopes, context, subPrefixes);
      options = _attachContext(resolver2, context, subResolver);
    }
    for (const prop of names2) {
      result[prop] = options[prop];
    }
    return result;
  }
  createResolver(scopes, context, prefixes = [
    ""
  ], descriptorDefaults) {
    const { resolver: resolver2 } = getResolver(this._resolverCache, scopes, prefixes);
    return isObject$3(context) ? _attachContext(resolver2, context, void 0, descriptorDefaults) : resolver2;
  }
}
function getResolver(resolverCache, scopes, prefixes) {
  let cache2 = resolverCache.get(scopes);
  if (!cache2) {
    cache2 = /* @__PURE__ */ new Map();
    resolverCache.set(scopes, cache2);
  }
  const cacheKey = prefixes.join();
  let cached = cache2.get(cacheKey);
  if (!cached) {
    const resolver2 = _createResolver(scopes, prefixes);
    cached = {
      resolver: resolver2,
      subPrefixes: prefixes.filter((p2) => !p2.toLowerCase().includes("hover"))
    };
    cache2.set(cacheKey, cached);
  }
  return cached;
}
const hasFunction = (value2) => isObject$3(value2) && Object.getOwnPropertyNames(value2).some((key) => isFunction$3(value2[key]));
function needContext(proxy, names2) {
  const { isScriptable, isIndexable } = _descriptors(proxy);
  for (const prop of names2) {
    const scriptable = isScriptable(prop);
    const indexable = isIndexable(prop);
    const value2 = (indexable || scriptable) && proxy[prop];
    if (scriptable && (isFunction$3(value2) || hasFunction(value2)) || indexable && isArray$4(value2)) {
      return true;
    }
  }
  return false;
}
var version = "4.5.0";
const KNOWN_POSITIONS = [
  "top",
  "bottom",
  "left",
  "right",
  "chartArea"
];
function positionIsHorizontal(position2, axis) {
  return position2 === "top" || position2 === "bottom" || KNOWN_POSITIONS.indexOf(position2) === -1 && axis === "x";
}
function compare2Level(l1, l2) {
  return function(a2, b2) {
    return a2[l1] === b2[l1] ? a2[l2] - b2[l2] : a2[l1] - b2[l1];
  };
}
function onAnimationsComplete(context) {
  const chart = context.chart;
  const animationOptions = chart.options.animation;
  chart.notifyPlugins("afterRender");
  callback(animationOptions && animationOptions.onComplete, [
    context
  ], chart);
}
function onAnimationProgress(context) {
  const chart = context.chart;
  const animationOptions = chart.options.animation;
  callback(animationOptions && animationOptions.onProgress, [
    context
  ], chart);
}
function getCanvas(item) {
  if (_isDomSupported() && typeof item === "string") {
    item = document.getElementById(item);
  } else if (item && item.length) {
    item = item[0];
  }
  if (item && item.canvas) {
    item = item.canvas;
  }
  return item;
}
const instances = {};
const getChart = (key) => {
  const canvas = getCanvas(key);
  return Object.values(instances).filter((c2) => c2.canvas === canvas).pop();
};
function moveNumericKeys(obj, start2, move2) {
  const keys2 = Object.keys(obj);
  for (const key of keys2) {
    const intKey = +key;
    if (intKey >= start2) {
      const value2 = obj[key];
      delete obj[key];
      if (move2 > 0 || intKey > start2) {
        obj[intKey + move2] = value2;
      }
    }
  }
}
function determineLastEvent(e2, lastEvent, inChartArea, isClick) {
  if (!inChartArea || e2.type === "mouseout") {
    return null;
  }
  if (isClick) {
    return lastEvent;
  }
  return e2;
}
let Chart$1 = (_b = class {
  static register(...items) {
    registry.add(...items);
    invalidatePlugins();
  }
  static unregister(...items) {
    registry.remove(...items);
    invalidatePlugins();
  }
  constructor(item, userConfig) {
    const config2 = this.config = new Config(userConfig);
    const initialCanvas = getCanvas(item);
    const existingChart = getChart(initialCanvas);
    if (existingChart) {
      throw new Error("Canvas is already in use. Chart with ID '" + existingChart.id + "' must be destroyed before the canvas with ID '" + existingChart.canvas.id + "' can be reused.");
    }
    const options = config2.createResolver(config2.chartOptionScopes(), this.getContext());
    this.platform = new (config2.platform || _detectPlatform(initialCanvas))();
    this.platform.updateConfig(config2);
    const context = this.platform.acquireContext(initialCanvas, options.aspectRatio);
    const canvas = context && context.canvas;
    const height = canvas && canvas.height;
    const width = canvas && canvas.width;
    this.id = uid();
    this.ctx = context;
    this.canvas = canvas;
    this.width = width;
    this.height = height;
    this._options = options;
    this._aspectRatio = this.aspectRatio;
    this._layers = [];
    this._metasets = [];
    this._stacks = void 0;
    this.boxes = [];
    this.currentDevicePixelRatio = void 0;
    this.chartArea = void 0;
    this._active = [];
    this._lastEvent = void 0;
    this._listeners = {};
    this._responsiveListeners = void 0;
    this._sortedMetasets = [];
    this.scales = {};
    this._plugins = new PluginService();
    this.$proxies = {};
    this._hiddenIndices = {};
    this.attached = false;
    this._animationsDisabled = void 0;
    this.$context = void 0;
    this._doResize = debounce$1((mode) => this.update(mode), options.resizeDelay || 0);
    this._dataChanges = [];
    instances[this.id] = this;
    if (!context || !canvas) {
      console.error("Failed to create chart: can't acquire context from the given item");
      return;
    }
    animator.listen(this, "complete", onAnimationsComplete);
    animator.listen(this, "progress", onAnimationProgress);
    this._initialize();
    if (this.attached) {
      this.update();
    }
  }
  get aspectRatio() {
    const { options: { aspectRatio: aspectRatio2, maintainAspectRatio }, width, height, _aspectRatio } = this;
    if (!isNullOrUndef(aspectRatio2)) {
      return aspectRatio2;
    }
    if (maintainAspectRatio && _aspectRatio) {
      return _aspectRatio;
    }
    return height ? width / height : null;
  }
  get data() {
    return this.config.data;
  }
  set data(data) {
    this.config.data = data;
  }
  get options() {
    return this._options;
  }
  set options(options) {
    this.config.options = options;
  }
  get registry() {
    return registry;
  }
  _initialize() {
    this.notifyPlugins("beforeInit");
    if (this.options.responsive) {
      this.resize();
    } else {
      retinaScale(this, this.options.devicePixelRatio);
    }
    this.bindEvents();
    this.notifyPlugins("afterInit");
    return this;
  }
  clear() {
    clearCanvas(this.canvas, this.ctx);
    return this;
  }
  stop() {
    animator.stop(this);
    return this;
  }
  resize(width, height) {
    if (!animator.running(this)) {
      this._resize(width, height);
    } else {
      this._resizeBeforeDraw = {
        width,
        height
      };
    }
  }
  _resize(width, height) {
    const options = this.options;
    const canvas = this.canvas;
    const aspectRatio2 = options.maintainAspectRatio && this.aspectRatio;
    const newSize = this.platform.getMaximumSize(canvas, width, height, aspectRatio2);
    const newRatio = options.devicePixelRatio || this.platform.getDevicePixelRatio();
    const mode = this.width ? "resize" : "attach";
    this.width = newSize.width;
    this.height = newSize.height;
    this._aspectRatio = this.aspectRatio;
    if (!retinaScale(this, newRatio, true)) {
      return;
    }
    this.notifyPlugins("resize", {
      size: newSize
    });
    callback(options.onResize, [
      this,
      newSize
    ], this);
    if (this.attached) {
      if (this._doResize(mode)) {
        this.render();
      }
    }
  }
  ensureScalesHaveIDs() {
    const options = this.options;
    const scalesOptions = options.scales || {};
    each(scalesOptions, (axisOptions, axisID) => {
      axisOptions.id = axisID;
    });
  }
  buildOrUpdateScales() {
    const options = this.options;
    const scaleOpts = options.scales;
    const scales = this.scales;
    const updated = Object.keys(scales).reduce((obj, id2) => {
      obj[id2] = false;
      return obj;
    }, {});
    let items = [];
    if (scaleOpts) {
      items = items.concat(Object.keys(scaleOpts).map((id2) => {
        const scaleOptions = scaleOpts[id2];
        const axis = determineAxis(id2, scaleOptions);
        const isRadial = axis === "r";
        const isHorizontal = axis === "x";
        return {
          options: scaleOptions,
          dposition: isRadial ? "chartArea" : isHorizontal ? "bottom" : "left",
          dtype: isRadial ? "radialLinear" : isHorizontal ? "category" : "linear"
        };
      }));
    }
    each(items, (item) => {
      const scaleOptions = item.options;
      const id2 = scaleOptions.id;
      const axis = determineAxis(id2, scaleOptions);
      const scaleType = valueOrDefault(scaleOptions.type, item.dtype);
      if (scaleOptions.position === void 0 || positionIsHorizontal(scaleOptions.position, axis) !== positionIsHorizontal(item.dposition)) {
        scaleOptions.position = item.dposition;
      }
      updated[id2] = true;
      let scale2 = null;
      if (id2 in scales && scales[id2].type === scaleType) {
        scale2 = scales[id2];
      } else {
        const scaleClass = registry.getScale(scaleType);
        scale2 = new scaleClass({
          id: id2,
          type: scaleType,
          ctx: this.ctx,
          chart: this
        });
        scales[scale2.id] = scale2;
      }
      scale2.init(scaleOptions, options);
    });
    each(updated, (hasUpdated, id2) => {
      if (!hasUpdated) {
        delete scales[id2];
      }
    });
    each(scales, (scale2) => {
      layouts.configure(this, scale2, scale2.options);
      layouts.addBox(this, scale2);
    });
  }
  _updateMetasets() {
    const metasets = this._metasets;
    const numData = this.data.datasets.length;
    const numMeta = metasets.length;
    metasets.sort((a2, b2) => a2.index - b2.index);
    if (numMeta > numData) {
      for (let i2 = numData; i2 < numMeta; ++i2) {
        this._destroyDatasetMeta(i2);
      }
      metasets.splice(numData, numMeta - numData);
    }
    this._sortedMetasets = metasets.slice(0).sort(compare2Level("order", "index"));
  }
  _removeUnreferencedMetasets() {
    const { _metasets: metasets, data: { datasets } } = this;
    if (metasets.length > datasets.length) {
      delete this._stacks;
    }
    metasets.forEach((meta, index2) => {
      if (datasets.filter((x2) => x2 === meta._dataset).length === 0) {
        this._destroyDatasetMeta(index2);
      }
    });
  }
  buildOrUpdateControllers() {
    const newControllers = [];
    const datasets = this.data.datasets;
    let i2, ilen;
    this._removeUnreferencedMetasets();
    for (i2 = 0, ilen = datasets.length; i2 < ilen; i2++) {
      const dataset = datasets[i2];
      let meta = this.getDatasetMeta(i2);
      const type4 = dataset.type || this.config.type;
      if (meta.type && meta.type !== type4) {
        this._destroyDatasetMeta(i2);
        meta = this.getDatasetMeta(i2);
      }
      meta.type = type4;
      meta.indexAxis = dataset.indexAxis || getIndexAxis(type4, this.options);
      meta.order = dataset.order || 0;
      meta.index = i2;
      meta.label = "" + dataset.label;
      meta.visible = this.isDatasetVisible(i2);
      if (meta.controller) {
        meta.controller.updateIndex(i2);
        meta.controller.linkScales();
      } else {
        const ControllerClass = registry.getController(type4);
        const { datasetElementType, dataElementType } = defaults$2.datasets[type4];
        Object.assign(ControllerClass, {
          dataElementType: registry.getElement(dataElementType),
          datasetElementType: datasetElementType && registry.getElement(datasetElementType)
        });
        meta.controller = new ControllerClass(this, i2);
        newControllers.push(meta.controller);
      }
    }
    this._updateMetasets();
    return newControllers;
  }
  _resetElements() {
    each(this.data.datasets, (dataset, datasetIndex) => {
      this.getDatasetMeta(datasetIndex).controller.reset();
    }, this);
  }
  reset() {
    this._resetElements();
    this.notifyPlugins("reset");
  }
  update(mode) {
    const config2 = this.config;
    config2.update();
    const options = this._options = config2.createResolver(config2.chartOptionScopes(), this.getContext());
    const animsDisabled = this._animationsDisabled = !options.animation;
    this._updateScales();
    this._checkEventBindings();
    this._updateHiddenIndices();
    this._plugins.invalidate();
    if (this.notifyPlugins("beforeUpdate", {
      mode,
      cancelable: true
    }) === false) {
      return;
    }
    const newControllers = this.buildOrUpdateControllers();
    this.notifyPlugins("beforeElementsUpdate");
    let minPadding = 0;
    for (let i2 = 0, ilen = this.data.datasets.length; i2 < ilen; i2++) {
      const { controller } = this.getDatasetMeta(i2);
      const reset = !animsDisabled && newControllers.indexOf(controller) === -1;
      controller.buildOrUpdateElements(reset);
      minPadding = Math.max(+controller.getMaxOverflow(), minPadding);
    }
    minPadding = this._minPadding = options.layout.autoPadding ? minPadding : 0;
    this._updateLayout(minPadding);
    if (!animsDisabled) {
      each(newControllers, (controller) => {
        controller.reset();
      });
    }
    this._updateDatasets(mode);
    this.notifyPlugins("afterUpdate", {
      mode
    });
    this._layers.sort(compare2Level("z", "_idx"));
    const { _active: _active3, _lastEvent } = this;
    if (_lastEvent) {
      this._eventHandler(_lastEvent, true);
    } else if (_active3.length) {
      this._updateHoverStyles(_active3, _active3, true);
    }
    this.render();
  }
  _updateScales() {
    each(this.scales, (scale2) => {
      layouts.removeBox(this, scale2);
    });
    this.ensureScalesHaveIDs();
    this.buildOrUpdateScales();
  }
  _checkEventBindings() {
    const options = this.options;
    const existingEvents = new Set(Object.keys(this._listeners));
    const newEvents = new Set(options.events);
    if (!setsEqual(existingEvents, newEvents) || !!this._responsiveListeners !== options.responsive) {
      this.unbindEvents();
      this.bindEvents();
    }
  }
  _updateHiddenIndices() {
    const { _hiddenIndices } = this;
    const changes = this._getUniformDataChanges() || [];
    for (const { method: method4, start: start2, count } of changes) {
      const move2 = method4 === "_removeElements" ? -count : count;
      moveNumericKeys(_hiddenIndices, start2, move2);
    }
  }
  _getUniformDataChanges() {
    const _dataChanges = this._dataChanges;
    if (!_dataChanges || !_dataChanges.length) {
      return;
    }
    this._dataChanges = [];
    const datasetCount = this.data.datasets.length;
    const makeSet = (idx) => new Set(_dataChanges.filter((c2) => c2[0] === idx).map((c2, i2) => i2 + "," + c2.splice(1).join(",")));
    const changeSet = makeSet(0);
    for (let i2 = 1; i2 < datasetCount; i2++) {
      if (!setsEqual(changeSet, makeSet(i2))) {
        return;
      }
    }
    return Array.from(changeSet).map((c2) => c2.split(",")).map((a2) => ({
      method: a2[1],
      start: +a2[2],
      count: +a2[3]
    }));
  }
  _updateLayout(minPadding) {
    if (this.notifyPlugins("beforeLayout", {
      cancelable: true
    }) === false) {
      return;
    }
    layouts.update(this, this.width, this.height, minPadding);
    const area = this.chartArea;
    const noArea = area.width <= 0 || area.height <= 0;
    this._layers = [];
    each(this.boxes, (box) => {
      if (noArea && box.position === "chartArea") {
        return;
      }
      if (box.configure) {
        box.configure();
      }
      this._layers.push(...box._layers());
    }, this);
    this._layers.forEach((item, index2) => {
      item._idx = index2;
    });
    this.notifyPlugins("afterLayout");
  }
  _updateDatasets(mode) {
    if (this.notifyPlugins("beforeDatasetsUpdate", {
      mode,
      cancelable: true
    }) === false) {
      return;
    }
    for (let i2 = 0, ilen = this.data.datasets.length; i2 < ilen; ++i2) {
      this.getDatasetMeta(i2).controller.configure();
    }
    for (let i2 = 0, ilen = this.data.datasets.length; i2 < ilen; ++i2) {
      this._updateDataset(i2, isFunction$3(mode) ? mode({
        datasetIndex: i2
      }) : mode);
    }
    this.notifyPlugins("afterDatasetsUpdate", {
      mode
    });
  }
  _updateDataset(index2, mode) {
    const meta = this.getDatasetMeta(index2);
    const args = {
      meta,
      index: index2,
      mode,
      cancelable: true
    };
    if (this.notifyPlugins("beforeDatasetUpdate", args) === false) {
      return;
    }
    meta.controller._update(mode);
    args.cancelable = false;
    this.notifyPlugins("afterDatasetUpdate", args);
  }
  render() {
    if (this.notifyPlugins("beforeRender", {
      cancelable: true
    }) === false) {
      return;
    }
    if (animator.has(this)) {
      if (this.attached && !animator.running(this)) {
        animator.start(this);
      }
    } else {
      this.draw();
      onAnimationsComplete({
        chart: this
      });
    }
  }
  draw() {
    let i2;
    if (this._resizeBeforeDraw) {
      const { width, height } = this._resizeBeforeDraw;
      this._resizeBeforeDraw = null;
      this._resize(width, height);
    }
    this.clear();
    if (this.width <= 0 || this.height <= 0) {
      return;
    }
    if (this.notifyPlugins("beforeDraw", {
      cancelable: true
    }) === false) {
      return;
    }
    const layers = this._layers;
    for (i2 = 0; i2 < layers.length && layers[i2].z <= 0; ++i2) {
      layers[i2].draw(this.chartArea);
    }
    this._drawDatasets();
    for (; i2 < layers.length; ++i2) {
      layers[i2].draw(this.chartArea);
    }
    this.notifyPlugins("afterDraw");
  }
  _getSortedDatasetMetas(filterVisible) {
    const metasets = this._sortedMetasets;
    const result = [];
    let i2, ilen;
    for (i2 = 0, ilen = metasets.length; i2 < ilen; ++i2) {
      const meta = metasets[i2];
      if (!filterVisible || meta.visible) {
        result.push(meta);
      }
    }
    return result;
  }
  getSortedVisibleDatasetMetas() {
    return this._getSortedDatasetMetas(true);
  }
  _drawDatasets() {
    if (this.notifyPlugins("beforeDatasetsDraw", {
      cancelable: true
    }) === false) {
      return;
    }
    const metasets = this.getSortedVisibleDatasetMetas();
    for (let i2 = metasets.length - 1; i2 >= 0; --i2) {
      this._drawDataset(metasets[i2]);
    }
    this.notifyPlugins("afterDatasetsDraw");
  }
  _drawDataset(meta) {
    const ctx = this.ctx;
    const args = {
      meta,
      index: meta.index,
      cancelable: true
    };
    const clip = getDatasetClipArea(this, meta);
    if (this.notifyPlugins("beforeDatasetDraw", args) === false) {
      return;
    }
    if (clip) {
      clipArea(ctx, clip);
    }
    meta.controller.draw();
    if (clip) {
      unclipArea(ctx);
    }
    args.cancelable = false;
    this.notifyPlugins("afterDatasetDraw", args);
  }
  isPointInArea(point2) {
    return _isPointInArea(point2, this.chartArea, this._minPadding);
  }
  getElementsAtEventForMode(e2, mode, options, useFinalPosition) {
    const method4 = Interaction.modes[mode];
    if (typeof method4 === "function") {
      return method4(this, e2, options, useFinalPosition);
    }
    return [];
  }
  getDatasetMeta(datasetIndex) {
    const dataset = this.data.datasets[datasetIndex];
    const metasets = this._metasets;
    let meta = metasets.filter((x2) => x2 && x2._dataset === dataset).pop();
    if (!meta) {
      meta = {
        type: null,
        data: [],
        dataset: null,
        controller: null,
        hidden: null,
        xAxisID: null,
        yAxisID: null,
        order: dataset && dataset.order || 0,
        index: datasetIndex,
        _dataset: dataset,
        _parsed: [],
        _sorted: false
      };
      metasets.push(meta);
    }
    return meta;
  }
  getContext() {
    return this.$context || (this.$context = createContext(null, {
      chart: this,
      type: "chart"
    }));
  }
  getVisibleDatasetCount() {
    return this.getSortedVisibleDatasetMetas().length;
  }
  isDatasetVisible(datasetIndex) {
    const dataset = this.data.datasets[datasetIndex];
    if (!dataset) {
      return false;
    }
    const meta = this.getDatasetMeta(datasetIndex);
    return typeof meta.hidden === "boolean" ? !meta.hidden : !dataset.hidden;
  }
  setDatasetVisibility(datasetIndex, visible) {
    const meta = this.getDatasetMeta(datasetIndex);
    meta.hidden = !visible;
  }
  toggleDataVisibility(index2) {
    this._hiddenIndices[index2] = !this._hiddenIndices[index2];
  }
  getDataVisibility(index2) {
    return !this._hiddenIndices[index2];
  }
  _updateVisibility(datasetIndex, dataIndex, visible) {
    const mode = visible ? "show" : "hide";
    const meta = this.getDatasetMeta(datasetIndex);
    const anims = meta.controller._resolveAnimations(void 0, mode);
    if (defined(dataIndex)) {
      meta.data[dataIndex].hidden = !visible;
      this.update();
    } else {
      this.setDatasetVisibility(datasetIndex, visible);
      anims.update(meta, {
        visible
      });
      this.update((ctx) => ctx.datasetIndex === datasetIndex ? mode : void 0);
    }
  }
  hide(datasetIndex, dataIndex) {
    this._updateVisibility(datasetIndex, dataIndex, false);
  }
  show(datasetIndex, dataIndex) {
    this._updateVisibility(datasetIndex, dataIndex, true);
  }
  _destroyDatasetMeta(datasetIndex) {
    const meta = this._metasets[datasetIndex];
    if (meta && meta.controller) {
      meta.controller._destroy();
    }
    delete this._metasets[datasetIndex];
  }
  _stop() {
    let i2, ilen;
    this.stop();
    animator.remove(this);
    for (i2 = 0, ilen = this.data.datasets.length; i2 < ilen; ++i2) {
      this._destroyDatasetMeta(i2);
    }
  }
  destroy() {
    this.notifyPlugins("beforeDestroy");
    const { canvas, ctx } = this;
    this._stop();
    this.config.clearCache();
    if (canvas) {
      this.unbindEvents();
      clearCanvas(canvas, ctx);
      this.platform.releaseContext(ctx);
      this.canvas = null;
      this.ctx = null;
    }
    delete instances[this.id];
    this.notifyPlugins("afterDestroy");
  }
  toBase64Image(...args) {
    return this.canvas.toDataURL(...args);
  }
  bindEvents() {
    this.bindUserEvents();
    if (this.options.responsive) {
      this.bindResponsiveEvents();
    } else {
      this.attached = true;
    }
  }
  bindUserEvents() {
    const listeners = this._listeners;
    const platform2 = this.platform;
    const _add = (type4, listener2) => {
      platform2.addEventListener(this, type4, listener2);
      listeners[type4] = listener2;
    };
    const listener = (e2, x2, y2) => {
      e2.offsetX = x2;
      e2.offsetY = y2;
      this._eventHandler(e2);
    };
    each(this.options.events, (type4) => _add(type4, listener));
  }
  bindResponsiveEvents() {
    if (!this._responsiveListeners) {
      this._responsiveListeners = {};
    }
    const listeners = this._responsiveListeners;
    const platform2 = this.platform;
    const _add = (type4, listener2) => {
      platform2.addEventListener(this, type4, listener2);
      listeners[type4] = listener2;
    };
    const _remove = (type4, listener2) => {
      if (listeners[type4]) {
        platform2.removeEventListener(this, type4, listener2);
        delete listeners[type4];
      }
    };
    const listener = (width, height) => {
      if (this.canvas) {
        this.resize(width, height);
      }
    };
    let detached;
    const attached = () => {
      _remove("attach", attached);
      this.attached = true;
      this.resize();
      _add("resize", listener);
      _add("detach", detached);
    };
    detached = () => {
      this.attached = false;
      _remove("resize", listener);
      this._stop();
      this._resize(0, 0);
      _add("attach", attached);
    };
    if (platform2.isAttached(this.canvas)) {
      attached();
    } else {
      detached();
    }
  }
  unbindEvents() {
    each(this._listeners, (listener, type4) => {
      this.platform.removeEventListener(this, type4, listener);
    });
    this._listeners = {};
    each(this._responsiveListeners, (listener, type4) => {
      this.platform.removeEventListener(this, type4, listener);
    });
    this._responsiveListeners = void 0;
  }
  updateHoverStyle(items, mode, enabled) {
    const prefix = enabled ? "set" : "remove";
    let meta, item, i2, ilen;
    if (mode === "dataset") {
      meta = this.getDatasetMeta(items[0].datasetIndex);
      meta.controller["_" + prefix + "DatasetHoverStyle"]();
    }
    for (i2 = 0, ilen = items.length; i2 < ilen; ++i2) {
      item = items[i2];
      const controller = item && this.getDatasetMeta(item.datasetIndex).controller;
      if (controller) {
        controller[prefix + "HoverStyle"](item.element, item.datasetIndex, item.index);
      }
    }
  }
  getActiveElements() {
    return this._active || [];
  }
  setActiveElements(activeElements) {
    const lastActive = this._active || [];
    const active3 = activeElements.map(({ datasetIndex, index: index2 }) => {
      const meta = this.getDatasetMeta(datasetIndex);
      if (!meta) {
        throw new Error("No dataset found at index " + datasetIndex);
      }
      return {
        datasetIndex,
        element: meta.data[index2],
        index: index2
      };
    });
    const changed = !_elementsEqual(active3, lastActive);
    if (changed) {
      this._active = active3;
      this._lastEvent = null;
      this._updateHoverStyles(active3, lastActive);
    }
  }
  notifyPlugins(hook, args, filter3) {
    return this._plugins.notify(this, hook, args, filter3);
  }
  isPluginEnabled(pluginId) {
    return this._plugins._cache.filter((p2) => p2.plugin.id === pluginId).length === 1;
  }
  _updateHoverStyles(active3, lastActive, replay) {
    const hoverOptions = this.options.hover;
    const diff2 = (a2, b2) => a2.filter((x2) => !b2.some((y2) => x2.datasetIndex === y2.datasetIndex && x2.index === y2.index));
    const deactivated = diff2(lastActive, active3);
    const activated = replay ? active3 : diff2(active3, lastActive);
    if (deactivated.length) {
      this.updateHoverStyle(deactivated, hoverOptions.mode, false);
    }
    if (activated.length && hoverOptions.mode) {
      this.updateHoverStyle(activated, hoverOptions.mode, true);
    }
  }
  _eventHandler(e2, replay) {
    const args = {
      event: e2,
      replay,
      cancelable: true,
      inChartArea: this.isPointInArea(e2)
    };
    const eventFilter = (plugin) => (plugin.options.events || this.options.events).includes(e2.native.type);
    if (this.notifyPlugins("beforeEvent", args, eventFilter) === false) {
      return;
    }
    const changed = this._handleEvent(e2, replay, args.inChartArea);
    args.cancelable = false;
    this.notifyPlugins("afterEvent", args, eventFilter);
    if (changed || args.changed) {
      this.render();
    }
    return this;
  }
  _handleEvent(e2, replay, inChartArea) {
    const { _active: lastActive = [], options } = this;
    const useFinalPosition = replay;
    const active3 = this._getActiveElements(e2, lastActive, inChartArea, useFinalPosition);
    const isClick = _isClickEvent(e2);
    const lastEvent = determineLastEvent(e2, this._lastEvent, inChartArea, isClick);
    if (inChartArea) {
      this._lastEvent = null;
      callback(options.onHover, [
        e2,
        active3,
        this
      ], this);
      if (isClick) {
        callback(options.onClick, [
          e2,
          active3,
          this
        ], this);
      }
    }
    const changed = !_elementsEqual(active3, lastActive);
    if (changed || replay) {
      this._active = active3;
      this._updateHoverStyles(active3, lastActive, replay);
    }
    this._lastEvent = lastEvent;
    return changed;
  }
  _getActiveElements(e2, lastActive, inChartArea, useFinalPosition) {
    if (e2.type === "mouseout") {
      return [];
    }
    if (!inChartArea) {
      return lastActive;
    }
    const hoverOptions = this.options.hover;
    return this.getElementsAtEventForMode(e2, hoverOptions.mode, hoverOptions, useFinalPosition);
  }
}, __publicField(_b, "defaults", defaults$2), __publicField(_b, "instances", instances), __publicField(_b, "overrides", overrides), __publicField(_b, "registry", registry), __publicField(_b, "version", version), __publicField(_b, "getChart", getChart), _b);
function invalidatePlugins() {
  return each(Chart$1.instances, (chart) => chart._plugins.invalidate());
}
function setStyle(ctx, options, style2 = options) {
  ctx.lineCap = valueOrDefault(style2.borderCapStyle, options.borderCapStyle);
  ctx.setLineDash(valueOrDefault(style2.borderDash, options.borderDash));
  ctx.lineDashOffset = valueOrDefault(style2.borderDashOffset, options.borderDashOffset);
  ctx.lineJoin = valueOrDefault(style2.borderJoinStyle, options.borderJoinStyle);
  ctx.lineWidth = valueOrDefault(style2.borderWidth, options.borderWidth);
  ctx.strokeStyle = valueOrDefault(style2.borderColor, options.borderColor);
}
function lineTo(ctx, previous2, target) {
  ctx.lineTo(target.x, target.y);
}
function getLineMethod(options) {
  if (options.stepped) {
    return _steppedLineTo;
  }
  if (options.tension || options.cubicInterpolationMode === "monotone") {
    return _bezierCurveTo;
  }
  return lineTo;
}
function pathVars(points, segment, params = {}) {
  const count = points.length;
  const { start: paramsStart = 0, end: paramsEnd = count - 1 } = params;
  const { start: segmentStart, end: segmentEnd } = segment;
  const start2 = Math.max(paramsStart, segmentStart);
  const end2 = Math.min(paramsEnd, segmentEnd);
  const outside = paramsStart < segmentStart && paramsEnd < segmentStart || paramsStart > segmentEnd && paramsEnd > segmentEnd;
  return {
    count,
    start: start2,
    loop: segment.loop,
    ilen: end2 < start2 && !outside ? count + end2 - start2 : end2 - start2
  };
}
function pathSegment(ctx, line2, segment, params) {
  const { points, options } = line2;
  const { count, start: start2, loop: loop2, ilen } = pathVars(points, segment, params);
  const lineMethod = getLineMethod(options);
  let { move: move2 = true, reverse } = params || {};
  let i2, point2, prev2;
  for (i2 = 0; i2 <= ilen; ++i2) {
    point2 = points[(start2 + (reverse ? ilen - i2 : i2)) % count];
    if (point2.skip) {
      continue;
    } else if (move2) {
      ctx.moveTo(point2.x, point2.y);
      move2 = false;
    } else {
      lineMethod(ctx, prev2, point2, reverse, options.stepped);
    }
    prev2 = point2;
  }
  if (loop2) {
    point2 = points[(start2 + (reverse ? ilen : 0)) % count];
    lineMethod(ctx, prev2, point2, reverse, options.stepped);
  }
  return !!loop2;
}
function fastPathSegment(ctx, line2, segment, params) {
  const points = line2.points;
  const { count, start: start2, ilen } = pathVars(points, segment, params);
  const { move: move2 = true, reverse } = params || {};
  let avgX = 0;
  let countX = 0;
  let i2, point2, prevX, minY, maxY, lastY;
  const pointIndex = (index2) => (start2 + (reverse ? ilen - index2 : index2)) % count;
  const drawX = () => {
    if (minY !== maxY) {
      ctx.lineTo(avgX, maxY);
      ctx.lineTo(avgX, minY);
      ctx.lineTo(avgX, lastY);
    }
  };
  if (move2) {
    point2 = points[pointIndex(0)];
    ctx.moveTo(point2.x, point2.y);
  }
  for (i2 = 0; i2 <= ilen; ++i2) {
    point2 = points[pointIndex(i2)];
    if (point2.skip) {
      continue;
    }
    const x2 = point2.x;
    const y2 = point2.y;
    const truncX = x2 | 0;
    if (truncX === prevX) {
      if (y2 < minY) {
        minY = y2;
      } else if (y2 > maxY) {
        maxY = y2;
      }
      avgX = (countX * avgX + x2) / ++countX;
    } else {
      drawX();
      ctx.lineTo(x2, y2);
      prevX = truncX;
      countX = 0;
      minY = maxY = y2;
    }
    lastY = y2;
  }
  drawX();
}
function _getSegmentMethod(line2) {
  const opts2 = line2.options;
  const borderDash = opts2.borderDash && opts2.borderDash.length;
  const useFastPath = !line2._decimated && !line2._loop && !opts2.tension && opts2.cubicInterpolationMode !== "monotone" && !opts2.stepped && !borderDash;
  return useFastPath ? fastPathSegment : pathSegment;
}
function _getInterpolationMethod(options) {
  if (options.stepped) {
    return _steppedInterpolation;
  }
  if (options.tension || options.cubicInterpolationMode === "monotone") {
    return _bezierInterpolation;
  }
  return _pointInLine;
}
function strokePathWithCache(ctx, line2, start2, count) {
  let path = line2._path;
  if (!path) {
    path = line2._path = new Path2D();
    if (line2.path(path, start2, count)) {
      path.closePath();
    }
  }
  setStyle(ctx, line2.options);
  ctx.stroke(path);
}
function strokePathDirect(ctx, line2, start2, count) {
  const { segments, options } = line2;
  const segmentMethod = _getSegmentMethod(line2);
  for (const segment of segments) {
    setStyle(ctx, options, segment.style);
    ctx.beginPath();
    if (segmentMethod(ctx, line2, segment, {
      start: start2,
      end: start2 + count - 1
    })) {
      ctx.closePath();
    }
    ctx.stroke();
  }
}
const usePath2D = typeof Path2D === "function";
function draw(ctx, line2, start2, count) {
  if (usePath2D && !line2.options.segment) {
    strokePathWithCache(ctx, line2, start2, count);
  } else {
    strokePathDirect(ctx, line2, start2, count);
  }
}
class LineElement extends Element$1 {
  constructor(cfg) {
    super();
    this.animated = true;
    this.options = void 0;
    this._chart = void 0;
    this._loop = void 0;
    this._fullLoop = void 0;
    this._path = void 0;
    this._points = void 0;
    this._segments = void 0;
    this._decimated = false;
    this._pointsUpdated = false;
    this._datasetIndex = void 0;
    if (cfg) {
      Object.assign(this, cfg);
    }
  }
  updateControlPoints(chartArea, indexAxis) {
    const options = this.options;
    if ((options.tension || options.cubicInterpolationMode === "monotone") && !options.stepped && !this._pointsUpdated) {
      const loop2 = options.spanGaps ? this._loop : this._fullLoop;
      _updateBezierControlPoints(this._points, options, chartArea, loop2, indexAxis);
      this._pointsUpdated = true;
    }
  }
  set points(points) {
    this._points = points;
    delete this._segments;
    delete this._path;
    this._pointsUpdated = false;
  }
  get points() {
    return this._points;
  }
  get segments() {
    return this._segments || (this._segments = _computeSegments(this, this.options.segment));
  }
  first() {
    const segments = this.segments;
    const points = this.points;
    return segments.length && points[segments[0].start];
  }
  last() {
    const segments = this.segments;
    const points = this.points;
    const count = segments.length;
    return count && points[segments[count - 1].end];
  }
  interpolate(point2, property2) {
    const options = this.options;
    const value2 = point2[property2];
    const points = this.points;
    const segments = _boundSegments(this, {
      property: property2,
      start: value2,
      end: value2
    });
    if (!segments.length) {
      return;
    }
    const result = [];
    const _interpolate = _getInterpolationMethod(options);
    let i2, ilen;
    for (i2 = 0, ilen = segments.length; i2 < ilen; ++i2) {
      const { start: start2, end: end2 } = segments[i2];
      const p1 = points[start2];
      const p2 = points[end2];
      if (p1 === p2) {
        result.push(p1);
        continue;
      }
      const t2 = Math.abs((value2 - p1[property2]) / (p2[property2] - p1[property2]));
      const interpolated = _interpolate(p1, p2, t2, options.stepped);
      interpolated[property2] = point2[property2];
      result.push(interpolated);
    }
    return result.length === 1 ? result[0] : result;
  }
  pathSegment(ctx, segment, params) {
    const segmentMethod = _getSegmentMethod(this);
    return segmentMethod(ctx, this, segment, params);
  }
  path(ctx, start2, count) {
    const segments = this.segments;
    const segmentMethod = _getSegmentMethod(this);
    let loop2 = this._loop;
    start2 = start2 || 0;
    count = count || this.points.length - start2;
    for (const segment of segments) {
      loop2 &= segmentMethod(ctx, this, segment, {
        start: start2,
        end: start2 + count - 1
      });
    }
    return !!loop2;
  }
  draw(ctx, chartArea, start2, count) {
    const options = this.options || {};
    const points = this.points || [];
    if (points.length && options.borderWidth) {
      ctx.save();
      draw(ctx, this, start2, count);
      ctx.restore();
    }
    if (this.animated) {
      this._pointsUpdated = false;
      this._path = void 0;
    }
  }
}
__publicField(LineElement, "id", "line");
__publicField(LineElement, "defaults", {
  borderCapStyle: "butt",
  borderDash: [],
  borderDashOffset: 0,
  borderJoinStyle: "miter",
  borderWidth: 3,
  capBezierPoints: true,
  cubicInterpolationMode: "default",
  fill: false,
  spanGaps: false,
  stepped: false,
  tension: 0
});
__publicField(LineElement, "defaultRoutes", {
  backgroundColor: "backgroundColor",
  borderColor: "borderColor"
});
__publicField(LineElement, "descriptors", {
  _scriptable: true,
  _indexable: (name2) => name2 !== "borderDash" && name2 !== "fill"
});
function inRange$1(el2, pos, axis, useFinalPosition) {
  const options = el2.options;
  const { [axis]: value2 } = el2.getProps([
    axis
  ], useFinalPosition);
  return Math.abs(pos - value2) < options.radius + options.hitRadius;
}
class PointElement extends Element$1 {
  constructor(cfg) {
    super();
    __publicField(this, "parsed");
    __publicField(this, "skip");
    __publicField(this, "stop");
    this.options = void 0;
    this.parsed = void 0;
    this.skip = void 0;
    this.stop = void 0;
    if (cfg) {
      Object.assign(this, cfg);
    }
  }
  inRange(mouseX, mouseY, useFinalPosition) {
    const options = this.options;
    const { x: x2, y: y2 } = this.getProps([
      "x",
      "y"
    ], useFinalPosition);
    return Math.pow(mouseX - x2, 2) + Math.pow(mouseY - y2, 2) < Math.pow(options.hitRadius + options.radius, 2);
  }
  inXRange(mouseX, useFinalPosition) {
    return inRange$1(this, mouseX, "x", useFinalPosition);
  }
  inYRange(mouseY, useFinalPosition) {
    return inRange$1(this, mouseY, "y", useFinalPosition);
  }
  getCenterPoint(useFinalPosition) {
    const { x: x2, y: y2 } = this.getProps([
      "x",
      "y"
    ], useFinalPosition);
    return {
      x: x2,
      y: y2
    };
  }
  size(options) {
    options = options || this.options || {};
    let radius = options.radius || 0;
    radius = Math.max(radius, radius && options.hoverRadius || 0);
    const borderWidth = radius && options.borderWidth || 0;
    return (radius + borderWidth) * 2;
  }
  draw(ctx, area) {
    const options = this.options;
    if (this.skip || options.radius < 0.1 || !_isPointInArea(this, area, this.size(options) / 2)) {
      return;
    }
    ctx.strokeStyle = options.borderColor;
    ctx.lineWidth = options.borderWidth;
    ctx.fillStyle = options.backgroundColor;
    drawPoint(ctx, options, this.x, this.y);
  }
  getRange() {
    const options = this.options || {};
    return options.radius + options.hitRadius;
  }
}
__publicField(PointElement, "id", "point");
/**
* @type {any}
*/
__publicField(PointElement, "defaults", {
  borderWidth: 1,
  hitRadius: 1,
  hoverBorderWidth: 1,
  hoverRadius: 4,
  pointStyle: "circle",
  radius: 3,
  rotation: 0
});
/**
* @type {any}
*/
__publicField(PointElement, "defaultRoutes", {
  backgroundColor: "backgroundColor",
  borderColor: "borderColor"
});
function getBarBounds(bar, useFinalPosition) {
  const { x: x2, y: y2, base, width, height } = bar.getProps([
    "x",
    "y",
    "base",
    "width",
    "height"
  ], useFinalPosition);
  let left2, right, top2, bottom2, half;
  if (bar.horizontal) {
    half = height / 2;
    left2 = Math.min(x2, base);
    right = Math.max(x2, base);
    top2 = y2 - half;
    bottom2 = y2 + half;
  } else {
    half = width / 2;
    left2 = x2 - half;
    right = x2 + half;
    top2 = Math.min(y2, base);
    bottom2 = Math.max(y2, base);
  }
  return {
    left: left2,
    top: top2,
    right,
    bottom: bottom2
  };
}
function skipOrLimit(skip2, value2, min2, max2) {
  return skip2 ? 0 : _limitValue(value2, min2, max2);
}
function parseBorderWidth(bar, maxW, maxH) {
  const value2 = bar.options.borderWidth;
  const skip2 = bar.borderSkipped;
  const o2 = toTRBL(value2);
  return {
    t: skipOrLimit(skip2.top, o2.top, 0, maxH),
    r: skipOrLimit(skip2.right, o2.right, 0, maxW),
    b: skipOrLimit(skip2.bottom, o2.bottom, 0, maxH),
    l: skipOrLimit(skip2.left, o2.left, 0, maxW)
  };
}
function parseBorderRadius(bar, maxW, maxH) {
  const { enableBorderRadius } = bar.getProps([
    "enableBorderRadius"
  ]);
  const value2 = bar.options.borderRadius;
  const o2 = toTRBLCorners(value2);
  const maxR = Math.min(maxW, maxH);
  const skip2 = bar.borderSkipped;
  const enableBorder = enableBorderRadius || isObject$3(value2);
  return {
    topLeft: skipOrLimit(!enableBorder || skip2.top || skip2.left, o2.topLeft, 0, maxR),
    topRight: skipOrLimit(!enableBorder || skip2.top || skip2.right, o2.topRight, 0, maxR),
    bottomLeft: skipOrLimit(!enableBorder || skip2.bottom || skip2.left, o2.bottomLeft, 0, maxR),
    bottomRight: skipOrLimit(!enableBorder || skip2.bottom || skip2.right, o2.bottomRight, 0, maxR)
  };
}
function boundingRects(bar) {
  const bounds2 = getBarBounds(bar);
  const width = bounds2.right - bounds2.left;
  const height = bounds2.bottom - bounds2.top;
  const border = parseBorderWidth(bar, width / 2, height / 2);
  const radius = parseBorderRadius(bar, width / 2, height / 2);
  return {
    outer: {
      x: bounds2.left,
      y: bounds2.top,
      w: width,
      h: height,
      radius
    },
    inner: {
      x: bounds2.left + border.l,
      y: bounds2.top + border.t,
      w: width - border.l - border.r,
      h: height - border.t - border.b,
      radius: {
        topLeft: Math.max(0, radius.topLeft - Math.max(border.t, border.l)),
        topRight: Math.max(0, radius.topRight - Math.max(border.t, border.r)),
        bottomLeft: Math.max(0, radius.bottomLeft - Math.max(border.b, border.l)),
        bottomRight: Math.max(0, radius.bottomRight - Math.max(border.b, border.r))
      }
    }
  };
}
function inRange(bar, x2, y2, useFinalPosition) {
  const skipX = x2 === null;
  const skipY = y2 === null;
  const skipBoth = skipX && skipY;
  const bounds2 = bar && !skipBoth && getBarBounds(bar, useFinalPosition);
  return bounds2 && (skipX || _isBetween(x2, bounds2.left, bounds2.right)) && (skipY || _isBetween(y2, bounds2.top, bounds2.bottom));
}
function hasRadius(radius) {
  return radius.topLeft || radius.topRight || radius.bottomLeft || radius.bottomRight;
}
function addNormalRectPath(ctx, rect) {
  ctx.rect(rect.x, rect.y, rect.w, rect.h);
}
function inflateRect(rect, amount, refRect = {}) {
  const x2 = rect.x !== refRect.x ? -amount : 0;
  const y2 = rect.y !== refRect.y ? -amount : 0;
  const w2 = (rect.x + rect.w !== refRect.x + refRect.w ? amount : 0) - x2;
  const h3 = (rect.y + rect.h !== refRect.y + refRect.h ? amount : 0) - y2;
  return {
    x: rect.x + x2,
    y: rect.y + y2,
    w: rect.w + w2,
    h: rect.h + h3,
    radius: rect.radius
  };
}
class BarElement extends Element$1 {
  constructor(cfg) {
    super();
    this.options = void 0;
    this.horizontal = void 0;
    this.base = void 0;
    this.width = void 0;
    this.height = void 0;
    this.inflateAmount = void 0;
    if (cfg) {
      Object.assign(this, cfg);
    }
  }
  draw(ctx) {
    const { inflateAmount, options: { borderColor, backgroundColor } } = this;
    const { inner, outer } = boundingRects(this);
    const addRectPath = hasRadius(outer.radius) ? addRoundedRectPath : addNormalRectPath;
    ctx.save();
    if (outer.w !== inner.w || outer.h !== inner.h) {
      ctx.beginPath();
      addRectPath(ctx, inflateRect(outer, inflateAmount, inner));
      ctx.clip();
      addRectPath(ctx, inflateRect(inner, -inflateAmount, outer));
      ctx.fillStyle = borderColor;
      ctx.fill("evenodd");
    }
    ctx.beginPath();
    addRectPath(ctx, inflateRect(inner, inflateAmount));
    ctx.fillStyle = backgroundColor;
    ctx.fill();
    ctx.restore();
  }
  inRange(mouseX, mouseY, useFinalPosition) {
    return inRange(this, mouseX, mouseY, useFinalPosition);
  }
  inXRange(mouseX, useFinalPosition) {
    return inRange(this, mouseX, null, useFinalPosition);
  }
  inYRange(mouseY, useFinalPosition) {
    return inRange(this, null, mouseY, useFinalPosition);
  }
  getCenterPoint(useFinalPosition) {
    const { x: x2, y: y2, base, horizontal } = this.getProps([
      "x",
      "y",
      "base",
      "horizontal"
    ], useFinalPosition);
    return {
      x: horizontal ? (x2 + base) / 2 : x2,
      y: horizontal ? y2 : (y2 + base) / 2
    };
  }
  getRange(axis) {
    return axis === "x" ? this.width / 2 : this.height / 2;
  }
}
__publicField(BarElement, "id", "bar");
__publicField(BarElement, "defaults", {
  borderSkipped: "start",
  borderWidth: 0,
  borderRadius: 0,
  inflateAmount: "auto",
  pointStyle: void 0
});
__publicField(BarElement, "defaultRoutes", {
  backgroundColor: "backgroundColor",
  borderColor: "borderColor"
});
const getBoxSize = (labelOpts, fontSize) => {
  let { boxHeight = fontSize, boxWidth = fontSize } = labelOpts;
  if (labelOpts.usePointStyle) {
    boxHeight = Math.min(boxHeight, fontSize);
    boxWidth = labelOpts.pointStyleWidth || Math.min(boxWidth, fontSize);
  }
  return {
    boxWidth,
    boxHeight,
    itemHeight: Math.max(fontSize, boxHeight)
  };
};
const itemsEqual$1 = (a2, b2) => a2 !== null && b2 !== null && a2.datasetIndex === b2.datasetIndex && a2.index === b2.index;
class Legend extends Element$1 {
  constructor(config2) {
    super();
    this._added = false;
    this.legendHitBoxes = [];
    this._hoveredItem = null;
    this.doughnutMode = false;
    this.chart = config2.chart;
    this.options = config2.options;
    this.ctx = config2.ctx;
    this.legendItems = void 0;
    this.columnSizes = void 0;
    this.lineWidths = void 0;
    this.maxHeight = void 0;
    this.maxWidth = void 0;
    this.top = void 0;
    this.bottom = void 0;
    this.left = void 0;
    this.right = void 0;
    this.height = void 0;
    this.width = void 0;
    this._margins = void 0;
    this.position = void 0;
    this.weight = void 0;
    this.fullSize = void 0;
  }
  update(maxWidth, maxHeight, margins) {
    this.maxWidth = maxWidth;
    this.maxHeight = maxHeight;
    this._margins = margins;
    this.setDimensions();
    this.buildLabels();
    this.fit();
  }
  setDimensions() {
    if (this.isHorizontal()) {
      this.width = this.maxWidth;
      this.left = this._margins.left;
      this.right = this.width;
    } else {
      this.height = this.maxHeight;
      this.top = this._margins.top;
      this.bottom = this.height;
    }
  }
  buildLabels() {
    const labelOpts = this.options.labels || {};
    let legendItems = callback(labelOpts.generateLabels, [
      this.chart
    ], this) || [];
    if (labelOpts.filter) {
      legendItems = legendItems.filter((item) => labelOpts.filter(item, this.chart.data));
    }
    if (labelOpts.sort) {
      legendItems = legendItems.sort((a2, b2) => labelOpts.sort(a2, b2, this.chart.data));
    }
    if (this.options.reverse) {
      legendItems.reverse();
    }
    this.legendItems = legendItems;
  }
  fit() {
    const { options, ctx } = this;
    if (!options.display) {
      this.width = this.height = 0;
      return;
    }
    const labelOpts = options.labels;
    const labelFont = toFont(labelOpts.font);
    const fontSize = labelFont.size;
    const titleHeight = this._computeTitleHeight();
    const { boxWidth, itemHeight } = getBoxSize(labelOpts, fontSize);
    let width, height;
    ctx.font = labelFont.string;
    if (this.isHorizontal()) {
      width = this.maxWidth;
      height = this._fitRows(titleHeight, fontSize, boxWidth, itemHeight) + 10;
    } else {
      height = this.maxHeight;
      width = this._fitCols(titleHeight, labelFont, boxWidth, itemHeight) + 10;
    }
    this.width = Math.min(width, options.maxWidth || this.maxWidth);
    this.height = Math.min(height, options.maxHeight || this.maxHeight);
  }
  _fitRows(titleHeight, fontSize, boxWidth, itemHeight) {
    const { ctx, maxWidth, options: { labels: { padding } } } = this;
    const hitboxes = this.legendHitBoxes = [];
    const lineWidths = this.lineWidths = [
      0
    ];
    const lineHeight2 = itemHeight + padding;
    let totalHeight = titleHeight;
    ctx.textAlign = "left";
    ctx.textBaseline = "middle";
    let row = -1;
    let top2 = -lineHeight2;
    this.legendItems.forEach((legendItem, i2) => {
      const itemWidth = boxWidth + fontSize / 2 + ctx.measureText(legendItem.text).width;
      if (i2 === 0 || lineWidths[lineWidths.length - 1] + itemWidth + 2 * padding > maxWidth) {
        totalHeight += lineHeight2;
        lineWidths[lineWidths.length - (i2 > 0 ? 0 : 1)] = 0;
        top2 += lineHeight2;
        row++;
      }
      hitboxes[i2] = {
        left: 0,
        top: top2,
        row,
        width: itemWidth,
        height: itemHeight
      };
      lineWidths[lineWidths.length - 1] += itemWidth + padding;
    });
    return totalHeight;
  }
  _fitCols(titleHeight, labelFont, boxWidth, _itemHeight) {
    const { ctx, maxHeight, options: { labels: { padding } } } = this;
    const hitboxes = this.legendHitBoxes = [];
    const columnSizes = this.columnSizes = [];
    const heightLimit = maxHeight - titleHeight;
    let totalWidth = padding;
    let currentColWidth = 0;
    let currentColHeight = 0;
    let left2 = 0;
    let col = 0;
    this.legendItems.forEach((legendItem, i2) => {
      const { itemWidth, itemHeight } = calculateItemSize(boxWidth, labelFont, ctx, legendItem, _itemHeight);
      if (i2 > 0 && currentColHeight + itemHeight + 2 * padding > heightLimit) {
        totalWidth += currentColWidth + padding;
        columnSizes.push({
          width: currentColWidth,
          height: currentColHeight
        });
        left2 += currentColWidth + padding;
        col++;
        currentColWidth = currentColHeight = 0;
      }
      hitboxes[i2] = {
        left: left2,
        top: currentColHeight,
        col,
        width: itemWidth,
        height: itemHeight
      };
      currentColWidth = Math.max(currentColWidth, itemWidth);
      currentColHeight += itemHeight + padding;
    });
    totalWidth += currentColWidth;
    columnSizes.push({
      width: currentColWidth,
      height: currentColHeight
    });
    return totalWidth;
  }
  adjustHitBoxes() {
    if (!this.options.display) {
      return;
    }
    const titleHeight = this._computeTitleHeight();
    const { legendHitBoxes: hitboxes, options: { align, labels: { padding }, rtl } } = this;
    const rtlHelper = getRtlAdapter(rtl, this.left, this.width);
    if (this.isHorizontal()) {
      let row = 0;
      let left2 = _alignStartEnd(align, this.left + padding, this.right - this.lineWidths[row]);
      for (const hitbox of hitboxes) {
        if (row !== hitbox.row) {
          row = hitbox.row;
          left2 = _alignStartEnd(align, this.left + padding, this.right - this.lineWidths[row]);
        }
        hitbox.top += this.top + titleHeight + padding;
        hitbox.left = rtlHelper.leftForLtr(rtlHelper.x(left2), hitbox.width);
        left2 += hitbox.width + padding;
      }
    } else {
      let col = 0;
      let top2 = _alignStartEnd(align, this.top + titleHeight + padding, this.bottom - this.columnSizes[col].height);
      for (const hitbox of hitboxes) {
        if (hitbox.col !== col) {
          col = hitbox.col;
          top2 = _alignStartEnd(align, this.top + titleHeight + padding, this.bottom - this.columnSizes[col].height);
        }
        hitbox.top = top2;
        hitbox.left += this.left + padding;
        hitbox.left = rtlHelper.leftForLtr(rtlHelper.x(hitbox.left), hitbox.width);
        top2 += hitbox.height + padding;
      }
    }
  }
  isHorizontal() {
    return this.options.position === "top" || this.options.position === "bottom";
  }
  draw() {
    if (this.options.display) {
      const ctx = this.ctx;
      clipArea(ctx, this);
      this._draw();
      unclipArea(ctx);
    }
  }
  _draw() {
    const { options: opts2, columnSizes, lineWidths, ctx } = this;
    const { align, labels: labelOpts } = opts2;
    const defaultColor = defaults$2.color;
    const rtlHelper = getRtlAdapter(opts2.rtl, this.left, this.width);
    const labelFont = toFont(labelOpts.font);
    const { padding } = labelOpts;
    const fontSize = labelFont.size;
    const halfFontSize = fontSize / 2;
    let cursor;
    this.drawTitle();
    ctx.textAlign = rtlHelper.textAlign("left");
    ctx.textBaseline = "middle";
    ctx.lineWidth = 0.5;
    ctx.font = labelFont.string;
    const { boxWidth, boxHeight, itemHeight } = getBoxSize(labelOpts, fontSize);
    const drawLegendBox = function(x2, y2, legendItem) {
      if (isNaN(boxWidth) || boxWidth <= 0 || isNaN(boxHeight) || boxHeight < 0) {
        return;
      }
      ctx.save();
      const lineWidth = valueOrDefault(legendItem.lineWidth, 1);
      ctx.fillStyle = valueOrDefault(legendItem.fillStyle, defaultColor);
      ctx.lineCap = valueOrDefault(legendItem.lineCap, "butt");
      ctx.lineDashOffset = valueOrDefault(legendItem.lineDashOffset, 0);
      ctx.lineJoin = valueOrDefault(legendItem.lineJoin, "miter");
      ctx.lineWidth = lineWidth;
      ctx.strokeStyle = valueOrDefault(legendItem.strokeStyle, defaultColor);
      ctx.setLineDash(valueOrDefault(legendItem.lineDash, []));
      if (labelOpts.usePointStyle) {
        const drawOptions = {
          radius: boxHeight * Math.SQRT2 / 2,
          pointStyle: legendItem.pointStyle,
          rotation: legendItem.rotation,
          borderWidth: lineWidth
        };
        const centerX = rtlHelper.xPlus(x2, boxWidth / 2);
        const centerY = y2 + halfFontSize;
        drawPointLegend(ctx, drawOptions, centerX, centerY, labelOpts.pointStyleWidth && boxWidth);
      } else {
        const yBoxTop = y2 + Math.max((fontSize - boxHeight) / 2, 0);
        const xBoxLeft = rtlHelper.leftForLtr(x2, boxWidth);
        const borderRadius2 = toTRBLCorners(legendItem.borderRadius);
        ctx.beginPath();
        if (Object.values(borderRadius2).some((v2) => v2 !== 0)) {
          addRoundedRectPath(ctx, {
            x: xBoxLeft,
            y: yBoxTop,
            w: boxWidth,
            h: boxHeight,
            radius: borderRadius2
          });
        } else {
          ctx.rect(xBoxLeft, yBoxTop, boxWidth, boxHeight);
        }
        ctx.fill();
        if (lineWidth !== 0) {
          ctx.stroke();
        }
      }
      ctx.restore();
    };
    const fillText = function(x2, y2, legendItem) {
      renderText(ctx, legendItem.text, x2, y2 + itemHeight / 2, labelFont, {
        strikethrough: legendItem.hidden,
        textAlign: rtlHelper.textAlign(legendItem.textAlign)
      });
    };
    const isHorizontal = this.isHorizontal();
    const titleHeight = this._computeTitleHeight();
    if (isHorizontal) {
      cursor = {
        x: _alignStartEnd(align, this.left + padding, this.right - lineWidths[0]),
        y: this.top + padding + titleHeight,
        line: 0
      };
    } else {
      cursor = {
        x: this.left + padding,
        y: _alignStartEnd(align, this.top + titleHeight + padding, this.bottom - columnSizes[0].height),
        line: 0
      };
    }
    overrideTextDirection(this.ctx, opts2.textDirection);
    const lineHeight2 = itemHeight + padding;
    this.legendItems.forEach((legendItem, i2) => {
      ctx.strokeStyle = legendItem.fontColor;
      ctx.fillStyle = legendItem.fontColor;
      const textWidth = ctx.measureText(legendItem.text).width;
      const textAlign = rtlHelper.textAlign(legendItem.textAlign || (legendItem.textAlign = labelOpts.textAlign));
      const width = boxWidth + halfFontSize + textWidth;
      let x2 = cursor.x;
      let y2 = cursor.y;
      rtlHelper.setWidth(this.width);
      if (isHorizontal) {
        if (i2 > 0 && x2 + width + padding > this.right) {
          y2 = cursor.y += lineHeight2;
          cursor.line++;
          x2 = cursor.x = _alignStartEnd(align, this.left + padding, this.right - lineWidths[cursor.line]);
        }
      } else if (i2 > 0 && y2 + lineHeight2 > this.bottom) {
        x2 = cursor.x = x2 + columnSizes[cursor.line].width + padding;
        cursor.line++;
        y2 = cursor.y = _alignStartEnd(align, this.top + titleHeight + padding, this.bottom - columnSizes[cursor.line].height);
      }
      const realX = rtlHelper.x(x2);
      drawLegendBox(realX, y2, legendItem);
      x2 = _textX(textAlign, x2 + boxWidth + halfFontSize, isHorizontal ? x2 + width : this.right, opts2.rtl);
      fillText(rtlHelper.x(x2), y2, legendItem);
      if (isHorizontal) {
        cursor.x += width + padding;
      } else if (typeof legendItem.text !== "string") {
        const fontLineHeight = labelFont.lineHeight;
        cursor.y += calculateLegendItemHeight(legendItem, fontLineHeight) + padding;
      } else {
        cursor.y += lineHeight2;
      }
    });
    restoreTextDirection(this.ctx, opts2.textDirection);
  }
  drawTitle() {
    const opts2 = this.options;
    const titleOpts = opts2.title;
    const titleFont = toFont(titleOpts.font);
    const titlePadding = toPadding(titleOpts.padding);
    if (!titleOpts.display) {
      return;
    }
    const rtlHelper = getRtlAdapter(opts2.rtl, this.left, this.width);
    const ctx = this.ctx;
    const position2 = titleOpts.position;
    const halfFontSize = titleFont.size / 2;
    const topPaddingPlusHalfFontSize = titlePadding.top + halfFontSize;
    let y2;
    let left2 = this.left;
    let maxWidth = this.width;
    if (this.isHorizontal()) {
      maxWidth = Math.max(...this.lineWidths);
      y2 = this.top + topPaddingPlusHalfFontSize;
      left2 = _alignStartEnd(opts2.align, left2, this.right - maxWidth);
    } else {
      const maxHeight = this.columnSizes.reduce((acc, size2) => Math.max(acc, size2.height), 0);
      y2 = topPaddingPlusHalfFontSize + _alignStartEnd(opts2.align, this.top, this.bottom - maxHeight - opts2.labels.padding - this._computeTitleHeight());
    }
    const x2 = _alignStartEnd(position2, left2, left2 + maxWidth);
    ctx.textAlign = rtlHelper.textAlign(_toLeftRightCenter(position2));
    ctx.textBaseline = "middle";
    ctx.strokeStyle = titleOpts.color;
    ctx.fillStyle = titleOpts.color;
    ctx.font = titleFont.string;
    renderText(ctx, titleOpts.text, x2, y2, titleFont);
  }
  _computeTitleHeight() {
    const titleOpts = this.options.title;
    const titleFont = toFont(titleOpts.font);
    const titlePadding = toPadding(titleOpts.padding);
    return titleOpts.display ? titleFont.lineHeight + titlePadding.height : 0;
  }
  _getLegendItemAt(x2, y2) {
    let i2, hitBox, lh2;
    if (_isBetween(x2, this.left, this.right) && _isBetween(y2, this.top, this.bottom)) {
      lh2 = this.legendHitBoxes;
      for (i2 = 0; i2 < lh2.length; ++i2) {
        hitBox = lh2[i2];
        if (_isBetween(x2, hitBox.left, hitBox.left + hitBox.width) && _isBetween(y2, hitBox.top, hitBox.top + hitBox.height)) {
          return this.legendItems[i2];
        }
      }
    }
    return null;
  }
  handleEvent(e2) {
    const opts2 = this.options;
    if (!isListened(e2.type, opts2)) {
      return;
    }
    const hoveredItem = this._getLegendItemAt(e2.x, e2.y);
    if (e2.type === "mousemove" || e2.type === "mouseout") {
      const previous2 = this._hoveredItem;
      const sameItem = itemsEqual$1(previous2, hoveredItem);
      if (previous2 && !sameItem) {
        callback(opts2.onLeave, [
          e2,
          previous2,
          this
        ], this);
      }
      this._hoveredItem = hoveredItem;
      if (hoveredItem && !sameItem) {
        callback(opts2.onHover, [
          e2,
          hoveredItem,
          this
        ], this);
      }
    } else if (hoveredItem) {
      callback(opts2.onClick, [
        e2,
        hoveredItem,
        this
      ], this);
    }
  }
}
function calculateItemSize(boxWidth, labelFont, ctx, legendItem, _itemHeight) {
  const itemWidth = calculateItemWidth(legendItem, boxWidth, labelFont, ctx);
  const itemHeight = calculateItemHeight(_itemHeight, legendItem, labelFont.lineHeight);
  return {
    itemWidth,
    itemHeight
  };
}
function calculateItemWidth(legendItem, boxWidth, labelFont, ctx) {
  let legendItemText = legendItem.text;
  if (legendItemText && typeof legendItemText !== "string") {
    legendItemText = legendItemText.reduce((a2, b2) => a2.length > b2.length ? a2 : b2);
  }
  return boxWidth + labelFont.size / 2 + ctx.measureText(legendItemText).width;
}
function calculateItemHeight(_itemHeight, legendItem, fontLineHeight) {
  let itemHeight = _itemHeight;
  if (typeof legendItem.text !== "string") {
    itemHeight = calculateLegendItemHeight(legendItem, fontLineHeight);
  }
  return itemHeight;
}
function calculateLegendItemHeight(legendItem, fontLineHeight) {
  const labelHeight = legendItem.text ? legendItem.text.length : 0;
  return fontLineHeight * labelHeight;
}
function isListened(type4, opts2) {
  if ((type4 === "mousemove" || type4 === "mouseout") && (opts2.onHover || opts2.onLeave)) {
    return true;
  }
  if (opts2.onClick && (type4 === "click" || type4 === "mouseup")) {
    return true;
  }
  return false;
}
var plugin_legend = {
  id: "legend",
  _element: Legend,
  start(chart, _args, options) {
    const legend = chart.legend = new Legend({
      ctx: chart.ctx,
      options,
      chart
    });
    layouts.configure(chart, legend, options);
    layouts.addBox(chart, legend);
  },
  stop(chart) {
    layouts.removeBox(chart, chart.legend);
    delete chart.legend;
  },
  beforeUpdate(chart, _args, options) {
    const legend = chart.legend;
    layouts.configure(chart, legend, options);
    legend.options = options;
  },
  afterUpdate(chart) {
    const legend = chart.legend;
    legend.buildLabels();
    legend.adjustHitBoxes();
  },
  afterEvent(chart, args) {
    if (!args.replay) {
      chart.legend.handleEvent(args.event);
    }
  },
  defaults: {
    display: true,
    position: "top",
    align: "center",
    fullSize: true,
    reverse: false,
    weight: 1e3,
    onClick(e2, legendItem, legend) {
      const index2 = legendItem.datasetIndex;
      const ci2 = legend.chart;
      if (ci2.isDatasetVisible(index2)) {
        ci2.hide(index2);
        legendItem.hidden = true;
      } else {
        ci2.show(index2);
        legendItem.hidden = false;
      }
    },
    onHover: null,
    onLeave: null,
    labels: {
      color: (ctx) => ctx.chart.options.color,
      boxWidth: 40,
      padding: 10,
      generateLabels(chart) {
        const datasets = chart.data.datasets;
        const { labels: { usePointStyle, pointStyle, textAlign, color: color2, useBorderRadius, borderRadius: borderRadius2 } } = chart.legend.options;
        return chart._getSortedDatasetMetas().map((meta) => {
          const style2 = meta.controller.getStyle(usePointStyle ? 0 : void 0);
          const borderWidth = toPadding(style2.borderWidth);
          return {
            text: datasets[meta.index].label,
            fillStyle: style2.backgroundColor,
            fontColor: color2,
            hidden: !meta.visible,
            lineCap: style2.borderCapStyle,
            lineDash: style2.borderDash,
            lineDashOffset: style2.borderDashOffset,
            lineJoin: style2.borderJoinStyle,
            lineWidth: (borderWidth.width + borderWidth.height) / 4,
            strokeStyle: style2.borderColor,
            pointStyle: pointStyle || style2.pointStyle,
            rotation: style2.rotation,
            textAlign: textAlign || style2.textAlign,
            borderRadius: useBorderRadius && (borderRadius2 || style2.borderRadius),
            datasetIndex: meta.index
          };
        }, this);
      }
    },
    title: {
      color: (ctx) => ctx.chart.options.color,
      display: false,
      position: "center",
      text: ""
    }
  },
  descriptors: {
    _scriptable: (name2) => !name2.startsWith("on"),
    labels: {
      _scriptable: (name2) => ![
        "generateLabels",
        "filter",
        "sort"
      ].includes(name2)
    }
  }
};
class Title extends Element$1 {
  constructor(config2) {
    super();
    this.chart = config2.chart;
    this.options = config2.options;
    this.ctx = config2.ctx;
    this._padding = void 0;
    this.top = void 0;
    this.bottom = void 0;
    this.left = void 0;
    this.right = void 0;
    this.width = void 0;
    this.height = void 0;
    this.position = void 0;
    this.weight = void 0;
    this.fullSize = void 0;
  }
  update(maxWidth, maxHeight) {
    const opts2 = this.options;
    this.left = 0;
    this.top = 0;
    if (!opts2.display) {
      this.width = this.height = this.right = this.bottom = 0;
      return;
    }
    this.width = this.right = maxWidth;
    this.height = this.bottom = maxHeight;
    const lineCount = isArray$4(opts2.text) ? opts2.text.length : 1;
    this._padding = toPadding(opts2.padding);
    const textSize = lineCount * toFont(opts2.font).lineHeight + this._padding.height;
    if (this.isHorizontal()) {
      this.height = textSize;
    } else {
      this.width = textSize;
    }
  }
  isHorizontal() {
    const pos = this.options.position;
    return pos === "top" || pos === "bottom";
  }
  _drawArgs(offset2) {
    const { top: top2, left: left2, bottom: bottom2, right, options } = this;
    const align = options.align;
    let rotation = 0;
    let maxWidth, titleX, titleY;
    if (this.isHorizontal()) {
      titleX = _alignStartEnd(align, left2, right);
      titleY = top2 + offset2;
      maxWidth = right - left2;
    } else {
      if (options.position === "left") {
        titleX = left2 + offset2;
        titleY = _alignStartEnd(align, bottom2, top2);
        rotation = PI * -0.5;
      } else {
        titleX = right - offset2;
        titleY = _alignStartEnd(align, top2, bottom2);
        rotation = PI * 0.5;
      }
      maxWidth = bottom2 - top2;
    }
    return {
      titleX,
      titleY,
      maxWidth,
      rotation
    };
  }
  draw() {
    const ctx = this.ctx;
    const opts2 = this.options;
    if (!opts2.display) {
      return;
    }
    const fontOpts = toFont(opts2.font);
    const lineHeight2 = fontOpts.lineHeight;
    const offset2 = lineHeight2 / 2 + this._padding.top;
    const { titleX, titleY, maxWidth, rotation } = this._drawArgs(offset2);
    renderText(ctx, opts2.text, 0, 0, fontOpts, {
      color: opts2.color,
      maxWidth,
      rotation,
      textAlign: _toLeftRightCenter(opts2.align),
      textBaseline: "middle",
      translation: [
        titleX,
        titleY
      ]
    });
  }
}
function createTitle(chart, titleOpts) {
  const title = new Title({
    ctx: chart.ctx,
    options: titleOpts,
    chart
  });
  layouts.configure(chart, title, titleOpts);
  layouts.addBox(chart, title);
  chart.titleBlock = title;
}
var plugin_title = {
  id: "title",
  _element: Title,
  start(chart, _args, options) {
    createTitle(chart, options);
  },
  stop(chart) {
    const titleBlock = chart.titleBlock;
    layouts.removeBox(chart, titleBlock);
    delete chart.titleBlock;
  },
  beforeUpdate(chart, _args, options) {
    const title = chart.titleBlock;
    layouts.configure(chart, title, options);
    title.options = options;
  },
  defaults: {
    align: "center",
    display: false,
    font: {
      weight: "bold"
    },
    fullSize: true,
    padding: 10,
    position: "top",
    text: "",
    weight: 2e3
  },
  defaultRoutes: {
    color: "color"
  },
  descriptors: {
    _scriptable: true,
    _indexable: false
  }
};
const positioners = {
  average(items) {
    if (!items.length) {
      return false;
    }
    let i2, len;
    let xSet = /* @__PURE__ */ new Set();
    let y2 = 0;
    let count = 0;
    for (i2 = 0, len = items.length; i2 < len; ++i2) {
      const el2 = items[i2].element;
      if (el2 && el2.hasValue()) {
        const pos = el2.tooltipPosition();
        xSet.add(pos.x);
        y2 += pos.y;
        ++count;
      }
    }
    if (count === 0 || xSet.size === 0) {
      return false;
    }
    const xAverage = [
      ...xSet
    ].reduce((a2, b2) => a2 + b2) / xSet.size;
    return {
      x: xAverage,
      y: y2 / count
    };
  },
  nearest(items, eventPosition) {
    if (!items.length) {
      return false;
    }
    let x2 = eventPosition.x;
    let y2 = eventPosition.y;
    let minDistance = Number.POSITIVE_INFINITY;
    let i2, len, nearestElement;
    for (i2 = 0, len = items.length; i2 < len; ++i2) {
      const el2 = items[i2].element;
      if (el2 && el2.hasValue()) {
        const center = el2.getCenterPoint();
        const d2 = distanceBetweenPoints(eventPosition, center);
        if (d2 < minDistance) {
          minDistance = d2;
          nearestElement = el2;
        }
      }
    }
    if (nearestElement) {
      const tp = nearestElement.tooltipPosition();
      x2 = tp.x;
      y2 = tp.y;
    }
    return {
      x: x2,
      y: y2
    };
  }
};
function pushOrConcat(base, toPush) {
  if (toPush) {
    if (isArray$4(toPush)) {
      Array.prototype.push.apply(base, toPush);
    } else {
      base.push(toPush);
    }
  }
  return base;
}
function splitNewlines(str) {
  if ((typeof str === "string" || str instanceof String) && str.indexOf("\n") > -1) {
    return str.split("\n");
  }
  return str;
}
function createTooltipItem(chart, item) {
  const { element: element2, datasetIndex, index: index2 } = item;
  const controller = chart.getDatasetMeta(datasetIndex).controller;
  const { label, value: value2 } = controller.getLabelAndValue(index2);
  return {
    chart,
    label,
    parsed: controller.getParsed(index2),
    raw: chart.data.datasets[datasetIndex].data[index2],
    formattedValue: value2,
    dataset: controller.getDataset(),
    dataIndex: index2,
    datasetIndex,
    element: element2
  };
}
function getTooltipSize(tooltip, options) {
  const ctx = tooltip.chart.ctx;
  const { body, footer: footer2, title } = tooltip;
  const { boxWidth, boxHeight } = options;
  const bodyFont = toFont(options.bodyFont);
  const titleFont = toFont(options.titleFont);
  const footerFont = toFont(options.footerFont);
  const titleLineCount = title.length;
  const footerLineCount = footer2.length;
  const bodyLineItemCount = body.length;
  const padding = toPadding(options.padding);
  let height = padding.height;
  let width = 0;
  let combinedBodyLength = body.reduce((count, bodyItem) => count + bodyItem.before.length + bodyItem.lines.length + bodyItem.after.length, 0);
  combinedBodyLength += tooltip.beforeBody.length + tooltip.afterBody.length;
  if (titleLineCount) {
    height += titleLineCount * titleFont.lineHeight + (titleLineCount - 1) * options.titleSpacing + options.titleMarginBottom;
  }
  if (combinedBodyLength) {
    const bodyLineHeight = options.displayColors ? Math.max(boxHeight, bodyFont.lineHeight) : bodyFont.lineHeight;
    height += bodyLineItemCount * bodyLineHeight + (combinedBodyLength - bodyLineItemCount) * bodyFont.lineHeight + (combinedBodyLength - 1) * options.bodySpacing;
  }
  if (footerLineCount) {
    height += options.footerMarginTop + footerLineCount * footerFont.lineHeight + (footerLineCount - 1) * options.footerSpacing;
  }
  let widthPadding = 0;
  const maxLineWidth = function(line2) {
    width = Math.max(width, ctx.measureText(line2).width + widthPadding);
  };
  ctx.save();
  ctx.font = titleFont.string;
  each(tooltip.title, maxLineWidth);
  ctx.font = bodyFont.string;
  each(tooltip.beforeBody.concat(tooltip.afterBody), maxLineWidth);
  widthPadding = options.displayColors ? boxWidth + 2 + options.boxPadding : 0;
  each(body, (bodyItem) => {
    each(bodyItem.before, maxLineWidth);
    each(bodyItem.lines, maxLineWidth);
    each(bodyItem.after, maxLineWidth);
  });
  widthPadding = 0;
  ctx.font = footerFont.string;
  each(tooltip.footer, maxLineWidth);
  ctx.restore();
  width += padding.width;
  return {
    width,
    height
  };
}
function determineYAlign(chart, size2) {
  const { y: y2, height } = size2;
  if (y2 < height / 2) {
    return "top";
  } else if (y2 > chart.height - height / 2) {
    return "bottom";
  }
  return "center";
}
function doesNotFitWithAlign(xAlign, chart, options, size2) {
  const { x: x2, width } = size2;
  const caret2 = options.caretSize + options.caretPadding;
  if (xAlign === "left" && x2 + width + caret2 > chart.width) {
    return true;
  }
  if (xAlign === "right" && x2 - width - caret2 < 0) {
    return true;
  }
}
function determineXAlign(chart, options, size2, yAlign) {
  const { x: x2, width } = size2;
  const { width: chartWidth, chartArea: { left: left2, right } } = chart;
  let xAlign = "center";
  if (yAlign === "center") {
    xAlign = x2 <= (left2 + right) / 2 ? "left" : "right";
  } else if (x2 <= width / 2) {
    xAlign = "left";
  } else if (x2 >= chartWidth - width / 2) {
    xAlign = "right";
  }
  if (doesNotFitWithAlign(xAlign, chart, options, size2)) {
    xAlign = "center";
  }
  return xAlign;
}
function determineAlignment(chart, options, size2) {
  const yAlign = size2.yAlign || options.yAlign || determineYAlign(chart, size2);
  return {
    xAlign: size2.xAlign || options.xAlign || determineXAlign(chart, options, size2, yAlign),
    yAlign
  };
}
function alignX(size2, xAlign) {
  let { x: x2, width } = size2;
  if (xAlign === "right") {
    x2 -= width;
  } else if (xAlign === "center") {
    x2 -= width / 2;
  }
  return x2;
}
function alignY(size2, yAlign, paddingAndSize) {
  let { y: y2, height } = size2;
  if (yAlign === "top") {
    y2 += paddingAndSize;
  } else if (yAlign === "bottom") {
    y2 -= height + paddingAndSize;
  } else {
    y2 -= height / 2;
  }
  return y2;
}
function getBackgroundPoint(options, size2, alignment, chart) {
  const { caretSize, caretPadding, cornerRadius } = options;
  const { xAlign, yAlign } = alignment;
  const paddingAndSize = caretSize + caretPadding;
  const { topLeft, topRight, bottomLeft, bottomRight } = toTRBLCorners(cornerRadius);
  let x2 = alignX(size2, xAlign);
  const y2 = alignY(size2, yAlign, paddingAndSize);
  if (yAlign === "center") {
    if (xAlign === "left") {
      x2 += paddingAndSize;
    } else if (xAlign === "right") {
      x2 -= paddingAndSize;
    }
  } else if (xAlign === "left") {
    x2 -= Math.max(topLeft, bottomLeft) + caretSize;
  } else if (xAlign === "right") {
    x2 += Math.max(topRight, bottomRight) + caretSize;
  }
  return {
    x: _limitValue(x2, 0, chart.width - size2.width),
    y: _limitValue(y2, 0, chart.height - size2.height)
  };
}
function getAlignedX(tooltip, align, options) {
  const padding = toPadding(options.padding);
  return align === "center" ? tooltip.x + tooltip.width / 2 : align === "right" ? tooltip.x + tooltip.width - padding.right : tooltip.x + padding.left;
}
function getBeforeAfterBodyLines(callback2) {
  return pushOrConcat([], splitNewlines(callback2));
}
function createTooltipContext(parent, tooltip, tooltipItems) {
  return createContext(parent, {
    tooltip,
    tooltipItems,
    type: "tooltip"
  });
}
function overrideCallbacks(callbacks, context) {
  const override = context && context.dataset && context.dataset.tooltip && context.dataset.tooltip.callbacks;
  return override ? callbacks.override(override) : callbacks;
}
const defaultCallbacks = {
  beforeTitle: noop$3,
  title(tooltipItems) {
    if (tooltipItems.length > 0) {
      const item = tooltipItems[0];
      const labels = item.chart.data.labels;
      const labelCount = labels ? labels.length : 0;
      if (this && this.options && this.options.mode === "dataset") {
        return item.dataset.label || "";
      } else if (item.label) {
        return item.label;
      } else if (labelCount > 0 && item.dataIndex < labelCount) {
        return labels[item.dataIndex];
      }
    }
    return "";
  },
  afterTitle: noop$3,
  beforeBody: noop$3,
  beforeLabel: noop$3,
  label(tooltipItem) {
    if (this && this.options && this.options.mode === "dataset") {
      return tooltipItem.label + ": " + tooltipItem.formattedValue || tooltipItem.formattedValue;
    }
    let label = tooltipItem.dataset.label || "";
    if (label) {
      label += ": ";
    }
    const value2 = tooltipItem.formattedValue;
    if (!isNullOrUndef(value2)) {
      label += value2;
    }
    return label;
  },
  labelColor(tooltipItem) {
    const meta = tooltipItem.chart.getDatasetMeta(tooltipItem.datasetIndex);
    const options = meta.controller.getStyle(tooltipItem.dataIndex);
    return {
      borderColor: options.borderColor,
      backgroundColor: options.backgroundColor,
      borderWidth: options.borderWidth,
      borderDash: options.borderDash,
      borderDashOffset: options.borderDashOffset,
      borderRadius: 0
    };
  },
  labelTextColor() {
    return this.options.bodyColor;
  },
  labelPointStyle(tooltipItem) {
    const meta = tooltipItem.chart.getDatasetMeta(tooltipItem.datasetIndex);
    const options = meta.controller.getStyle(tooltipItem.dataIndex);
    return {
      pointStyle: options.pointStyle,
      rotation: options.rotation
    };
  },
  afterLabel: noop$3,
  afterBody: noop$3,
  beforeFooter: noop$3,
  footer: noop$3,
  afterFooter: noop$3
};
function invokeCallbackWithFallback(callbacks, name2, ctx, arg) {
  const result = callbacks[name2].call(ctx, arg);
  if (typeof result === "undefined") {
    return defaultCallbacks[name2].call(ctx, arg);
  }
  return result;
}
class Tooltip2 extends Element$1 {
  constructor(config2) {
    super();
    this.opacity = 0;
    this._active = [];
    this._eventPosition = void 0;
    this._size = void 0;
    this._cachedAnimations = void 0;
    this._tooltipItems = [];
    this.$animations = void 0;
    this.$context = void 0;
    this.chart = config2.chart;
    this.options = config2.options;
    this.dataPoints = void 0;
    this.title = void 0;
    this.beforeBody = void 0;
    this.body = void 0;
    this.afterBody = void 0;
    this.footer = void 0;
    this.xAlign = void 0;
    this.yAlign = void 0;
    this.x = void 0;
    this.y = void 0;
    this.height = void 0;
    this.width = void 0;
    this.caretX = void 0;
    this.caretY = void 0;
    this.labelColors = void 0;
    this.labelPointStyles = void 0;
    this.labelTextColors = void 0;
  }
  initialize(options) {
    this.options = options;
    this._cachedAnimations = void 0;
    this.$context = void 0;
  }
  _resolveAnimations() {
    const cached = this._cachedAnimations;
    if (cached) {
      return cached;
    }
    const chart = this.chart;
    const options = this.options.setContext(this.getContext());
    const opts2 = options.enabled && chart.options.animation && options.animations;
    const animations2 = new Animations(this.chart, opts2);
    if (opts2._cacheable) {
      this._cachedAnimations = Object.freeze(animations2);
    }
    return animations2;
  }
  getContext() {
    return this.$context || (this.$context = createTooltipContext(this.chart.getContext(), this, this._tooltipItems));
  }
  getTitle(context, options) {
    const { callbacks } = options;
    const beforeTitle = invokeCallbackWithFallback(callbacks, "beforeTitle", this, context);
    const title = invokeCallbackWithFallback(callbacks, "title", this, context);
    const afterTitle = invokeCallbackWithFallback(callbacks, "afterTitle", this, context);
    let lines = [];
    lines = pushOrConcat(lines, splitNewlines(beforeTitle));
    lines = pushOrConcat(lines, splitNewlines(title));
    lines = pushOrConcat(lines, splitNewlines(afterTitle));
    return lines;
  }
  getBeforeBody(tooltipItems, options) {
    return getBeforeAfterBodyLines(invokeCallbackWithFallback(options.callbacks, "beforeBody", this, tooltipItems));
  }
  getBody(tooltipItems, options) {
    const { callbacks } = options;
    const bodyItems = [];
    each(tooltipItems, (context) => {
      const bodyItem = {
        before: [],
        lines: [],
        after: []
      };
      const scoped = overrideCallbacks(callbacks, context);
      pushOrConcat(bodyItem.before, splitNewlines(invokeCallbackWithFallback(scoped, "beforeLabel", this, context)));
      pushOrConcat(bodyItem.lines, invokeCallbackWithFallback(scoped, "label", this, context));
      pushOrConcat(bodyItem.after, splitNewlines(invokeCallbackWithFallback(scoped, "afterLabel", this, context)));
      bodyItems.push(bodyItem);
    });
    return bodyItems;
  }
  getAfterBody(tooltipItems, options) {
    return getBeforeAfterBodyLines(invokeCallbackWithFallback(options.callbacks, "afterBody", this, tooltipItems));
  }
  getFooter(tooltipItems, options) {
    const { callbacks } = options;
    const beforeFooter = invokeCallbackWithFallback(callbacks, "beforeFooter", this, tooltipItems);
    const footer2 = invokeCallbackWithFallback(callbacks, "footer", this, tooltipItems);
    const afterFooter = invokeCallbackWithFallback(callbacks, "afterFooter", this, tooltipItems);
    let lines = [];
    lines = pushOrConcat(lines, splitNewlines(beforeFooter));
    lines = pushOrConcat(lines, splitNewlines(footer2));
    lines = pushOrConcat(lines, splitNewlines(afterFooter));
    return lines;
  }
  _createItems(options) {
    const active3 = this._active;
    const data = this.chart.data;
    const labelColors = [];
    const labelPointStyles = [];
    const labelTextColors = [];
    let tooltipItems = [];
    let i2, len;
    for (i2 = 0, len = active3.length; i2 < len; ++i2) {
      tooltipItems.push(createTooltipItem(this.chart, active3[i2]));
    }
    if (options.filter) {
      tooltipItems = tooltipItems.filter((element2, index2, array4) => options.filter(element2, index2, array4, data));
    }
    if (options.itemSort) {
      tooltipItems = tooltipItems.sort((a2, b2) => options.itemSort(a2, b2, data));
    }
    each(tooltipItems, (context) => {
      const scoped = overrideCallbacks(options.callbacks, context);
      labelColors.push(invokeCallbackWithFallback(scoped, "labelColor", this, context));
      labelPointStyles.push(invokeCallbackWithFallback(scoped, "labelPointStyle", this, context));
      labelTextColors.push(invokeCallbackWithFallback(scoped, "labelTextColor", this, context));
    });
    this.labelColors = labelColors;
    this.labelPointStyles = labelPointStyles;
    this.labelTextColors = labelTextColors;
    this.dataPoints = tooltipItems;
    return tooltipItems;
  }
  update(changed, replay) {
    const options = this.options.setContext(this.getContext());
    const active3 = this._active;
    let properties2;
    let tooltipItems = [];
    if (!active3.length) {
      if (this.opacity !== 0) {
        properties2 = {
          opacity: 0
        };
      }
    } else {
      const position2 = positioners[options.position].call(this, active3, this._eventPosition);
      tooltipItems = this._createItems(options);
      this.title = this.getTitle(tooltipItems, options);
      this.beforeBody = this.getBeforeBody(tooltipItems, options);
      this.body = this.getBody(tooltipItems, options);
      this.afterBody = this.getAfterBody(tooltipItems, options);
      this.footer = this.getFooter(tooltipItems, options);
      const size2 = this._size = getTooltipSize(this, options);
      const positionAndSize = Object.assign({}, position2, size2);
      const alignment = determineAlignment(this.chart, options, positionAndSize);
      const backgroundPoint = getBackgroundPoint(options, positionAndSize, alignment, this.chart);
      this.xAlign = alignment.xAlign;
      this.yAlign = alignment.yAlign;
      properties2 = {
        opacity: 1,
        x: backgroundPoint.x,
        y: backgroundPoint.y,
        width: size2.width,
        height: size2.height,
        caretX: position2.x,
        caretY: position2.y
      };
    }
    this._tooltipItems = tooltipItems;
    this.$context = void 0;
    if (properties2) {
      this._resolveAnimations().update(this, properties2);
    }
    if (changed && options.external) {
      options.external.call(this, {
        chart: this.chart,
        tooltip: this,
        replay
      });
    }
  }
  drawCaret(tooltipPoint, ctx, size2, options) {
    const caretPosition = this.getCaretPosition(tooltipPoint, size2, options);
    ctx.lineTo(caretPosition.x1, caretPosition.y1);
    ctx.lineTo(caretPosition.x2, caretPosition.y2);
    ctx.lineTo(caretPosition.x3, caretPosition.y3);
  }
  getCaretPosition(tooltipPoint, size2, options) {
    const { xAlign, yAlign } = this;
    const { caretSize, cornerRadius } = options;
    const { topLeft, topRight, bottomLeft, bottomRight } = toTRBLCorners(cornerRadius);
    const { x: ptX, y: ptY } = tooltipPoint;
    const { width, height } = size2;
    let x1, x2, x3, y1, y2, y3;
    if (yAlign === "center") {
      y2 = ptY + height / 2;
      if (xAlign === "left") {
        x1 = ptX;
        x2 = x1 - caretSize;
        y1 = y2 + caretSize;
        y3 = y2 - caretSize;
      } else {
        x1 = ptX + width;
        x2 = x1 + caretSize;
        y1 = y2 - caretSize;
        y3 = y2 + caretSize;
      }
      x3 = x1;
    } else {
      if (xAlign === "left") {
        x2 = ptX + Math.max(topLeft, bottomLeft) + caretSize;
      } else if (xAlign === "right") {
        x2 = ptX + width - Math.max(topRight, bottomRight) - caretSize;
      } else {
        x2 = this.caretX;
      }
      if (yAlign === "top") {
        y1 = ptY;
        y2 = y1 - caretSize;
        x1 = x2 - caretSize;
        x3 = x2 + caretSize;
      } else {
        y1 = ptY + height;
        y2 = y1 + caretSize;
        x1 = x2 + caretSize;
        x3 = x2 - caretSize;
      }
      y3 = y1;
    }
    return {
      x1,
      x2,
      x3,
      y1,
      y2,
      y3
    };
  }
  drawTitle(pt, ctx, options) {
    const title = this.title;
    const length2 = title.length;
    let titleFont, titleSpacing, i2;
    if (length2) {
      const rtlHelper = getRtlAdapter(options.rtl, this.x, this.width);
      pt.x = getAlignedX(this, options.titleAlign, options);
      ctx.textAlign = rtlHelper.textAlign(options.titleAlign);
      ctx.textBaseline = "middle";
      titleFont = toFont(options.titleFont);
      titleSpacing = options.titleSpacing;
      ctx.fillStyle = options.titleColor;
      ctx.font = titleFont.string;
      for (i2 = 0; i2 < length2; ++i2) {
        ctx.fillText(title[i2], rtlHelper.x(pt.x), pt.y + titleFont.lineHeight / 2);
        pt.y += titleFont.lineHeight + titleSpacing;
        if (i2 + 1 === length2) {
          pt.y += options.titleMarginBottom - titleSpacing;
        }
      }
    }
  }
  _drawColorBox(ctx, pt, i2, rtlHelper, options) {
    const labelColor = this.labelColors[i2];
    const labelPointStyle = this.labelPointStyles[i2];
    const { boxHeight, boxWidth } = options;
    const bodyFont = toFont(options.bodyFont);
    const colorX = getAlignedX(this, "left", options);
    const rtlColorX = rtlHelper.x(colorX);
    const yOffSet = boxHeight < bodyFont.lineHeight ? (bodyFont.lineHeight - boxHeight) / 2 : 0;
    const colorY = pt.y + yOffSet;
    if (options.usePointStyle) {
      const drawOptions = {
        radius: Math.min(boxWidth, boxHeight) / 2,
        pointStyle: labelPointStyle.pointStyle,
        rotation: labelPointStyle.rotation,
        borderWidth: 1
      };
      const centerX = rtlHelper.leftForLtr(rtlColorX, boxWidth) + boxWidth / 2;
      const centerY = colorY + boxHeight / 2;
      ctx.strokeStyle = options.multiKeyBackground;
      ctx.fillStyle = options.multiKeyBackground;
      drawPoint(ctx, drawOptions, centerX, centerY);
      ctx.strokeStyle = labelColor.borderColor;
      ctx.fillStyle = labelColor.backgroundColor;
      drawPoint(ctx, drawOptions, centerX, centerY);
    } else {
      ctx.lineWidth = isObject$3(labelColor.borderWidth) ? Math.max(...Object.values(labelColor.borderWidth)) : labelColor.borderWidth || 1;
      ctx.strokeStyle = labelColor.borderColor;
      ctx.setLineDash(labelColor.borderDash || []);
      ctx.lineDashOffset = labelColor.borderDashOffset || 0;
      const outerX = rtlHelper.leftForLtr(rtlColorX, boxWidth);
      const innerX = rtlHelper.leftForLtr(rtlHelper.xPlus(rtlColorX, 1), boxWidth - 2);
      const borderRadius2 = toTRBLCorners(labelColor.borderRadius);
      if (Object.values(borderRadius2).some((v2) => v2 !== 0)) {
        ctx.beginPath();
        ctx.fillStyle = options.multiKeyBackground;
        addRoundedRectPath(ctx, {
          x: outerX,
          y: colorY,
          w: boxWidth,
          h: boxHeight,
          radius: borderRadius2
        });
        ctx.fill();
        ctx.stroke();
        ctx.fillStyle = labelColor.backgroundColor;
        ctx.beginPath();
        addRoundedRectPath(ctx, {
          x: innerX,
          y: colorY + 1,
          w: boxWidth - 2,
          h: boxHeight - 2,
          radius: borderRadius2
        });
        ctx.fill();
      } else {
        ctx.fillStyle = options.multiKeyBackground;
        ctx.fillRect(outerX, colorY, boxWidth, boxHeight);
        ctx.strokeRect(outerX, colorY, boxWidth, boxHeight);
        ctx.fillStyle = labelColor.backgroundColor;
        ctx.fillRect(innerX, colorY + 1, boxWidth - 2, boxHeight - 2);
      }
    }
    ctx.fillStyle = this.labelTextColors[i2];
  }
  drawBody(pt, ctx, options) {
    const { body } = this;
    const { bodySpacing, bodyAlign, displayColors, boxHeight, boxWidth, boxPadding } = options;
    const bodyFont = toFont(options.bodyFont);
    let bodyLineHeight = bodyFont.lineHeight;
    let xLinePadding = 0;
    const rtlHelper = getRtlAdapter(options.rtl, this.x, this.width);
    const fillLineOfText = function(line2) {
      ctx.fillText(line2, rtlHelper.x(pt.x + xLinePadding), pt.y + bodyLineHeight / 2);
      pt.y += bodyLineHeight + bodySpacing;
    };
    const bodyAlignForCalculation = rtlHelper.textAlign(bodyAlign);
    let bodyItem, textColor, lines, i2, j2, ilen, jlen;
    ctx.textAlign = bodyAlign;
    ctx.textBaseline = "middle";
    ctx.font = bodyFont.string;
    pt.x = getAlignedX(this, bodyAlignForCalculation, options);
    ctx.fillStyle = options.bodyColor;
    each(this.beforeBody, fillLineOfText);
    xLinePadding = displayColors && bodyAlignForCalculation !== "right" ? bodyAlign === "center" ? boxWidth / 2 + boxPadding : boxWidth + 2 + boxPadding : 0;
    for (i2 = 0, ilen = body.length; i2 < ilen; ++i2) {
      bodyItem = body[i2];
      textColor = this.labelTextColors[i2];
      ctx.fillStyle = textColor;
      each(bodyItem.before, fillLineOfText);
      lines = bodyItem.lines;
      if (displayColors && lines.length) {
        this._drawColorBox(ctx, pt, i2, rtlHelper, options);
        bodyLineHeight = Math.max(bodyFont.lineHeight, boxHeight);
      }
      for (j2 = 0, jlen = lines.length; j2 < jlen; ++j2) {
        fillLineOfText(lines[j2]);
        bodyLineHeight = bodyFont.lineHeight;
      }
      each(bodyItem.after, fillLineOfText);
    }
    xLinePadding = 0;
    bodyLineHeight = bodyFont.lineHeight;
    each(this.afterBody, fillLineOfText);
    pt.y -= bodySpacing;
  }
  drawFooter(pt, ctx, options) {
    const footer2 = this.footer;
    const length2 = footer2.length;
    let footerFont, i2;
    if (length2) {
      const rtlHelper = getRtlAdapter(options.rtl, this.x, this.width);
      pt.x = getAlignedX(this, options.footerAlign, options);
      pt.y += options.footerMarginTop;
      ctx.textAlign = rtlHelper.textAlign(options.footerAlign);
      ctx.textBaseline = "middle";
      footerFont = toFont(options.footerFont);
      ctx.fillStyle = options.footerColor;
      ctx.font = footerFont.string;
      for (i2 = 0; i2 < length2; ++i2) {
        ctx.fillText(footer2[i2], rtlHelper.x(pt.x), pt.y + footerFont.lineHeight / 2);
        pt.y += footerFont.lineHeight + options.footerSpacing;
      }
    }
  }
  drawBackground(pt, ctx, tooltipSize, options) {
    const { xAlign, yAlign } = this;
    const { x: x2, y: y2 } = pt;
    const { width, height } = tooltipSize;
    const { topLeft, topRight, bottomLeft, bottomRight } = toTRBLCorners(options.cornerRadius);
    ctx.fillStyle = options.backgroundColor;
    ctx.strokeStyle = options.borderColor;
    ctx.lineWidth = options.borderWidth;
    ctx.beginPath();
    ctx.moveTo(x2 + topLeft, y2);
    if (yAlign === "top") {
      this.drawCaret(pt, ctx, tooltipSize, options);
    }
    ctx.lineTo(x2 + width - topRight, y2);
    ctx.quadraticCurveTo(x2 + width, y2, x2 + width, y2 + topRight);
    if (yAlign === "center" && xAlign === "right") {
      this.drawCaret(pt, ctx, tooltipSize, options);
    }
    ctx.lineTo(x2 + width, y2 + height - bottomRight);
    ctx.quadraticCurveTo(x2 + width, y2 + height, x2 + width - bottomRight, y2 + height);
    if (yAlign === "bottom") {
      this.drawCaret(pt, ctx, tooltipSize, options);
    }
    ctx.lineTo(x2 + bottomLeft, y2 + height);
    ctx.quadraticCurveTo(x2, y2 + height, x2, y2 + height - bottomLeft);
    if (yAlign === "center" && xAlign === "left") {
      this.drawCaret(pt, ctx, tooltipSize, options);
    }
    ctx.lineTo(x2, y2 + topLeft);
    ctx.quadraticCurveTo(x2, y2, x2 + topLeft, y2);
    ctx.closePath();
    ctx.fill();
    if (options.borderWidth > 0) {
      ctx.stroke();
    }
  }
  _updateAnimationTarget(options) {
    const chart = this.chart;
    const anims = this.$animations;
    const animX = anims && anims.x;
    const animY = anims && anims.y;
    if (animX || animY) {
      const position2 = positioners[options.position].call(this, this._active, this._eventPosition);
      if (!position2) {
        return;
      }
      const size2 = this._size = getTooltipSize(this, options);
      const positionAndSize = Object.assign({}, position2, this._size);
      const alignment = determineAlignment(chart, options, positionAndSize);
      const point2 = getBackgroundPoint(options, positionAndSize, alignment, chart);
      if (animX._to !== point2.x || animY._to !== point2.y) {
        this.xAlign = alignment.xAlign;
        this.yAlign = alignment.yAlign;
        this.width = size2.width;
        this.height = size2.height;
        this.caretX = position2.x;
        this.caretY = position2.y;
        this._resolveAnimations().update(this, point2);
      }
    }
  }
  _willRender() {
    return !!this.opacity;
  }
  draw(ctx) {
    const options = this.options.setContext(this.getContext());
    let opacity = this.opacity;
    if (!opacity) {
      return;
    }
    this._updateAnimationTarget(options);
    const tooltipSize = {
      width: this.width,
      height: this.height
    };
    const pt = {
      x: this.x,
      y: this.y
    };
    opacity = Math.abs(opacity) < 1e-3 ? 0 : opacity;
    const padding = toPadding(options.padding);
    const hasTooltipContent = this.title.length || this.beforeBody.length || this.body.length || this.afterBody.length || this.footer.length;
    if (options.enabled && hasTooltipContent) {
      ctx.save();
      ctx.globalAlpha = opacity;
      this.drawBackground(pt, ctx, tooltipSize, options);
      overrideTextDirection(ctx, options.textDirection);
      pt.y += padding.top;
      this.drawTitle(pt, ctx, options);
      this.drawBody(pt, ctx, options);
      this.drawFooter(pt, ctx, options);
      restoreTextDirection(ctx, options.textDirection);
      ctx.restore();
    }
  }
  getActiveElements() {
    return this._active || [];
  }
  setActiveElements(activeElements, eventPosition) {
    const lastActive = this._active;
    const active3 = activeElements.map(({ datasetIndex, index: index2 }) => {
      const meta = this.chart.getDatasetMeta(datasetIndex);
      if (!meta) {
        throw new Error("Cannot find a dataset at index " + datasetIndex);
      }
      return {
        datasetIndex,
        element: meta.data[index2],
        index: index2
      };
    });
    const changed = !_elementsEqual(lastActive, active3);
    const positionChanged = this._positionChanged(active3, eventPosition);
    if (changed || positionChanged) {
      this._active = active3;
      this._eventPosition = eventPosition;
      this._ignoreReplayEvents = true;
      this.update(true);
    }
  }
  handleEvent(e2, replay, inChartArea = true) {
    if (replay && this._ignoreReplayEvents) {
      return false;
    }
    this._ignoreReplayEvents = false;
    const options = this.options;
    const lastActive = this._active || [];
    const active3 = this._getActiveElements(e2, lastActive, replay, inChartArea);
    const positionChanged = this._positionChanged(active3, e2);
    const changed = replay || !_elementsEqual(active3, lastActive) || positionChanged;
    if (changed) {
      this._active = active3;
      if (options.enabled || options.external) {
        this._eventPosition = {
          x: e2.x,
          y: e2.y
        };
        this.update(true, replay);
      }
    }
    return changed;
  }
  _getActiveElements(e2, lastActive, replay, inChartArea) {
    const options = this.options;
    if (e2.type === "mouseout") {
      return [];
    }
    if (!inChartArea) {
      return lastActive.filter((i2) => this.chart.data.datasets[i2.datasetIndex] && this.chart.getDatasetMeta(i2.datasetIndex).controller.getParsed(i2.index) !== void 0);
    }
    const active3 = this.chart.getElementsAtEventForMode(e2, options.mode, options, replay);
    if (options.reverse) {
      active3.reverse();
    }
    return active3;
  }
  _positionChanged(active3, e2) {
    const { caretX, caretY, options } = this;
    const position2 = positioners[options.position].call(this, active3, e2);
    return position2 !== false && (caretX !== position2.x || caretY !== position2.y);
  }
}
__publicField(Tooltip2, "positioners", positioners);
var plugin_tooltip = {
  id: "tooltip",
  _element: Tooltip2,
  positioners,
  afterInit(chart, _args, options) {
    if (options) {
      chart.tooltip = new Tooltip2({
        chart,
        options
      });
    }
  },
  beforeUpdate(chart, _args, options) {
    if (chart.tooltip) {
      chart.tooltip.initialize(options);
    }
  },
  reset(chart, _args, options) {
    if (chart.tooltip) {
      chart.tooltip.initialize(options);
    }
  },
  afterDraw(chart) {
    const tooltip = chart.tooltip;
    if (tooltip && tooltip._willRender()) {
      const args = {
        tooltip
      };
      if (chart.notifyPlugins("beforeTooltipDraw", {
        ...args,
        cancelable: true
      }) === false) {
        return;
      }
      tooltip.draw(chart.ctx);
      chart.notifyPlugins("afterTooltipDraw", args);
    }
  },
  afterEvent(chart, args) {
    if (chart.tooltip) {
      const useFinalPosition = args.replay;
      if (chart.tooltip.handleEvent(args.event, useFinalPosition, args.inChartArea)) {
        args.changed = true;
      }
    }
  },
  defaults: {
    enabled: true,
    external: null,
    position: "average",
    backgroundColor: "rgba(0,0,0,0.8)",
    titleColor: "#fff",
    titleFont: {
      weight: "bold"
    },
    titleSpacing: 2,
    titleMarginBottom: 6,
    titleAlign: "left",
    bodyColor: "#fff",
    bodySpacing: 2,
    bodyFont: {},
    bodyAlign: "left",
    footerColor: "#fff",
    footerSpacing: 2,
    footerMarginTop: 6,
    footerFont: {
      weight: "bold"
    },
    footerAlign: "left",
    padding: 6,
    caretPadding: 2,
    caretSize: 5,
    cornerRadius: 6,
    boxHeight: (ctx, opts2) => opts2.bodyFont.size,
    boxWidth: (ctx, opts2) => opts2.bodyFont.size,
    multiKeyBackground: "#fff",
    displayColors: true,
    boxPadding: 0,
    borderColor: "rgba(0,0,0,0)",
    borderWidth: 0,
    animation: {
      duration: 400,
      easing: "easeOutQuart"
    },
    animations: {
      numbers: {
        type: "number",
        properties: [
          "x",
          "y",
          "width",
          "height",
          "caretX",
          "caretY"
        ]
      },
      opacity: {
        easing: "linear",
        duration: 200
      }
    },
    callbacks: defaultCallbacks
  },
  defaultRoutes: {
    bodyFont: "font",
    footerFont: "font",
    titleFont: "font"
  },
  descriptors: {
    _scriptable: (name2) => name2 !== "filter" && name2 !== "itemSort" && name2 !== "external",
    _indexable: false,
    callbacks: {
      _scriptable: false,
      _indexable: false
    },
    animation: {
      _fallback: false
    },
    animations: {
      _fallback: "animation"
    }
  },
  additionalOptionScopes: [
    "interaction"
  ]
};
const addIfString = (labels, raw, index2, addedLabels) => {
  if (typeof raw === "string") {
    index2 = labels.push(raw) - 1;
    addedLabels.unshift({
      index: index2,
      label: raw
    });
  } else if (isNaN(raw)) {
    index2 = null;
  }
  return index2;
};
function findOrAddLabel(labels, raw, index2, addedLabels) {
  const first = labels.indexOf(raw);
  if (first === -1) {
    return addIfString(labels, raw, index2, addedLabels);
  }
  const last = labels.lastIndexOf(raw);
  return first !== last ? index2 : first;
}
const validIndex = (index2, max2) => index2 === null ? null : _limitValue(Math.round(index2), 0, max2);
function _getLabelForValue(value2) {
  const labels = this.getLabels();
  if (value2 >= 0 && value2 < labels.length) {
    return labels[value2];
  }
  return value2;
}
class CategoryScale extends Scale {
  constructor(cfg) {
    super(cfg);
    this._startValue = void 0;
    this._valueRange = 0;
    this._addedLabels = [];
  }
  init(scaleOptions) {
    const added = this._addedLabels;
    if (added.length) {
      const labels = this.getLabels();
      for (const { index: index2, label } of added) {
        if (labels[index2] === label) {
          labels.splice(index2, 1);
        }
      }
      this._addedLabels = [];
    }
    super.init(scaleOptions);
  }
  parse(raw, index2) {
    if (isNullOrUndef(raw)) {
      return null;
    }
    const labels = this.getLabels();
    index2 = isFinite(index2) && labels[index2] === raw ? index2 : findOrAddLabel(labels, raw, valueOrDefault(index2, raw), this._addedLabels);
    return validIndex(index2, labels.length - 1);
  }
  determineDataLimits() {
    const { minDefined, maxDefined } = this.getUserBounds();
    let { min: min2, max: max2 } = this.getMinMax(true);
    if (this.options.bounds === "ticks") {
      if (!minDefined) {
        min2 = 0;
      }
      if (!maxDefined) {
        max2 = this.getLabels().length - 1;
      }
    }
    this.min = min2;
    this.max = max2;
  }
  buildTicks() {
    const min2 = this.min;
    const max2 = this.max;
    const offset2 = this.options.offset;
    const ticks = [];
    let labels = this.getLabels();
    labels = min2 === 0 && max2 === labels.length - 1 ? labels : labels.slice(min2, max2 + 1);
    this._valueRange = Math.max(labels.length - (offset2 ? 0 : 1), 1);
    this._startValue = this.min - (offset2 ? 0.5 : 0);
    for (let value2 = min2; value2 <= max2; value2++) {
      ticks.push({
        value: value2
      });
    }
    return ticks;
  }
  getLabelForValue(value2) {
    return _getLabelForValue.call(this, value2);
  }
  configure() {
    super.configure();
    if (!this.isHorizontal()) {
      this._reversePixels = !this._reversePixels;
    }
  }
  getPixelForValue(value2) {
    if (typeof value2 !== "number") {
      value2 = this.parse(value2);
    }
    return value2 === null ? NaN : this.getPixelForDecimal((value2 - this._startValue) / this._valueRange);
  }
  getPixelForTick(index2) {
    const ticks = this.ticks;
    if (index2 < 0 || index2 > ticks.length - 1) {
      return null;
    }
    return this.getPixelForValue(ticks[index2].value);
  }
  getValueForPixel(pixel) {
    return Math.round(this._startValue + this.getDecimalForPixel(pixel) * this._valueRange);
  }
  getBasePixel() {
    return this.bottom;
  }
}
__publicField(CategoryScale, "id", "category");
__publicField(CategoryScale, "defaults", {
  ticks: {
    callback: _getLabelForValue
  }
});
function generateTicks$1(generationOptions, dataRange) {
  const ticks = [];
  const MIN_SPACING = 1e-14;
  const { bounds: bounds2, step, min: min2, max: max2, precision, count, maxTicks, maxDigits, includeBounds } = generationOptions;
  const unit2 = step || 1;
  const maxSpaces = maxTicks - 1;
  const { min: rmin, max: rmax } = dataRange;
  const minDefined = !isNullOrUndef(min2);
  const maxDefined = !isNullOrUndef(max2);
  const countDefined = !isNullOrUndef(count);
  const minSpacing = (rmax - rmin) / (maxDigits + 1);
  let spacing2 = niceNum((rmax - rmin) / maxSpaces / unit2) * unit2;
  let factor, niceMin, niceMax, numSpaces;
  if (spacing2 < MIN_SPACING && !minDefined && !maxDefined) {
    return [
      {
        value: rmin
      },
      {
        value: rmax
      }
    ];
  }
  numSpaces = Math.ceil(rmax / spacing2) - Math.floor(rmin / spacing2);
  if (numSpaces > maxSpaces) {
    spacing2 = niceNum(numSpaces * spacing2 / maxSpaces / unit2) * unit2;
  }
  if (!isNullOrUndef(precision)) {
    factor = Math.pow(10, precision);
    spacing2 = Math.ceil(spacing2 * factor) / factor;
  }
  if (bounds2 === "ticks") {
    niceMin = Math.floor(rmin / spacing2) * spacing2;
    niceMax = Math.ceil(rmax / spacing2) * spacing2;
  } else {
    niceMin = rmin;
    niceMax = rmax;
  }
  if (minDefined && maxDefined && step && almostWhole((max2 - min2) / step, spacing2 / 1e3)) {
    numSpaces = Math.round(Math.min((max2 - min2) / spacing2, maxTicks));
    spacing2 = (max2 - min2) / numSpaces;
    niceMin = min2;
    niceMax = max2;
  } else if (countDefined) {
    niceMin = minDefined ? min2 : niceMin;
    niceMax = maxDefined ? max2 : niceMax;
    numSpaces = count - 1;
    spacing2 = (niceMax - niceMin) / numSpaces;
  } else {
    numSpaces = (niceMax - niceMin) / spacing2;
    if (almostEquals(numSpaces, Math.round(numSpaces), spacing2 / 1e3)) {
      numSpaces = Math.round(numSpaces);
    } else {
      numSpaces = Math.ceil(numSpaces);
    }
  }
  const decimalPlaces = Math.max(_decimalPlaces(spacing2), _decimalPlaces(niceMin));
  factor = Math.pow(10, isNullOrUndef(precision) ? decimalPlaces : precision);
  niceMin = Math.round(niceMin * factor) / factor;
  niceMax = Math.round(niceMax * factor) / factor;
  let j2 = 0;
  if (minDefined) {
    if (includeBounds && niceMin !== min2) {
      ticks.push({
        value: min2
      });
      if (niceMin < min2) {
        j2++;
      }
      if (almostEquals(Math.round((niceMin + j2 * spacing2) * factor) / factor, min2, relativeLabelSize(min2, minSpacing, generationOptions))) {
        j2++;
      }
    } else if (niceMin < min2) {
      j2++;
    }
  }
  for (; j2 < numSpaces; ++j2) {
    const tickValue = Math.round((niceMin + j2 * spacing2) * factor) / factor;
    if (maxDefined && tickValue > max2) {
      break;
    }
    ticks.push({
      value: tickValue
    });
  }
  if (maxDefined && includeBounds && niceMax !== max2) {
    if (ticks.length && almostEquals(ticks[ticks.length - 1].value, max2, relativeLabelSize(max2, minSpacing, generationOptions))) {
      ticks[ticks.length - 1].value = max2;
    } else {
      ticks.push({
        value: max2
      });
    }
  } else if (!maxDefined || niceMax === max2) {
    ticks.push({
      value: niceMax
    });
  }
  return ticks;
}
function relativeLabelSize(value2, minSpacing, { horizontal, minRotation }) {
  const rad = toRadians(minRotation);
  const ratio = (horizontal ? Math.sin(rad) : Math.cos(rad)) || 1e-3;
  const length2 = 0.75 * minSpacing * ("" + value2).length;
  return Math.min(minSpacing / ratio, length2);
}
class LinearScaleBase extends Scale {
  constructor(cfg) {
    super(cfg);
    this.start = void 0;
    this.end = void 0;
    this._startValue = void 0;
    this._endValue = void 0;
    this._valueRange = 0;
  }
  parse(raw, index2) {
    if (isNullOrUndef(raw)) {
      return null;
    }
    if ((typeof raw === "number" || raw instanceof Number) && !isFinite(+raw)) {
      return null;
    }
    return +raw;
  }
  handleTickRangeOptions() {
    const { beginAtZero } = this.options;
    const { minDefined, maxDefined } = this.getUserBounds();
    let { min: min2, max: max2 } = this;
    const setMin = (v2) => min2 = minDefined ? min2 : v2;
    const setMax = (v2) => max2 = maxDefined ? max2 : v2;
    if (beginAtZero) {
      const minSign = sign$1(min2);
      const maxSign = sign$1(max2);
      if (minSign < 0 && maxSign < 0) {
        setMax(0);
      } else if (minSign > 0 && maxSign > 0) {
        setMin(0);
      }
    }
    if (min2 === max2) {
      let offset2 = max2 === 0 ? 1 : Math.abs(max2 * 0.05);
      setMax(max2 + offset2);
      if (!beginAtZero) {
        setMin(min2 - offset2);
      }
    }
    this.min = min2;
    this.max = max2;
  }
  getTickLimit() {
    const tickOpts = this.options.ticks;
    let { maxTicksLimit, stepSize } = tickOpts;
    let maxTicks;
    if (stepSize) {
      maxTicks = Math.ceil(this.max / stepSize) - Math.floor(this.min / stepSize) + 1;
      if (maxTicks > 1e3) {
        console.warn(`scales.${this.id}.ticks.stepSize: ${stepSize} would result generating up to ${maxTicks} ticks. Limiting to 1000.`);
        maxTicks = 1e3;
      }
    } else {
      maxTicks = this.computeTickLimit();
      maxTicksLimit = maxTicksLimit || 11;
    }
    if (maxTicksLimit) {
      maxTicks = Math.min(maxTicksLimit, maxTicks);
    }
    return maxTicks;
  }
  computeTickLimit() {
    return Number.POSITIVE_INFINITY;
  }
  buildTicks() {
    const opts2 = this.options;
    const tickOpts = opts2.ticks;
    let maxTicks = this.getTickLimit();
    maxTicks = Math.max(2, maxTicks);
    const numericGeneratorOptions = {
      maxTicks,
      bounds: opts2.bounds,
      min: opts2.min,
      max: opts2.max,
      precision: tickOpts.precision,
      step: tickOpts.stepSize,
      count: tickOpts.count,
      maxDigits: this._maxDigits(),
      horizontal: this.isHorizontal(),
      minRotation: tickOpts.minRotation || 0,
      includeBounds: tickOpts.includeBounds !== false
    };
    const dataRange = this._range || this;
    const ticks = generateTicks$1(numericGeneratorOptions, dataRange);
    if (opts2.bounds === "ticks") {
      _setMinAndMaxByKey(ticks, this, "value");
    }
    if (opts2.reverse) {
      ticks.reverse();
      this.start = this.max;
      this.end = this.min;
    } else {
      this.start = this.min;
      this.end = this.max;
    }
    return ticks;
  }
  configure() {
    const ticks = this.ticks;
    let start2 = this.min;
    let end2 = this.max;
    super.configure();
    if (this.options.offset && ticks.length) {
      const offset2 = (end2 - start2) / Math.max(ticks.length - 1, 1) / 2;
      start2 -= offset2;
      end2 += offset2;
    }
    this._startValue = start2;
    this._endValue = end2;
    this._valueRange = end2 - start2;
  }
  getLabelForValue(value2) {
    return formatNumber(value2, this.chart.options.locale, this.options.ticks.format);
  }
}
class LinearScale extends LinearScaleBase {
  determineDataLimits() {
    const { min: min2, max: max2 } = this.getMinMax(true);
    this.min = isNumberFinite(min2) ? min2 : 0;
    this.max = isNumberFinite(max2) ? max2 : 1;
    this.handleTickRangeOptions();
  }
  computeTickLimit() {
    const horizontal = this.isHorizontal();
    const length2 = horizontal ? this.width : this.height;
    const minRotation = toRadians(this.options.ticks.minRotation);
    const ratio = (horizontal ? Math.sin(minRotation) : Math.cos(minRotation)) || 1e-3;
    const tickFont = this._resolveTickFontOptions(0);
    return Math.ceil(length2 / Math.min(40, tickFont.lineHeight / ratio));
  }
  getPixelForValue(value2) {
    return value2 === null ? NaN : this.getPixelForDecimal((value2 - this._startValue) / this._valueRange);
  }
  getValueForPixel(pixel) {
    return this._startValue + this.getDecimalForPixel(pixel) * this._valueRange;
  }
}
__publicField(LinearScale, "id", "linear");
__publicField(LinearScale, "defaults", {
  ticks: {
    callback: Ticks.formatters.numeric
  }
});
const INTERVALS = {
  millisecond: {
    common: true,
    size: 1,
    steps: 1e3
  },
  second: {
    common: true,
    size: 1e3,
    steps: 60
  },
  minute: {
    common: true,
    size: 6e4,
    steps: 60
  },
  hour: {
    common: true,
    size: 36e5,
    steps: 24
  },
  day: {
    common: true,
    size: 864e5,
    steps: 30
  },
  week: {
    common: false,
    size: 6048e5,
    steps: 4
  },
  month: {
    common: true,
    size: 2628e6,
    steps: 12
  },
  quarter: {
    common: false,
    size: 7884e6,
    steps: 4
  },
  year: {
    common: true,
    size: 3154e7
  }
};
const UNITS = /* @__PURE__ */ Object.keys(INTERVALS);
function sorter(a2, b2) {
  return a2 - b2;
}
function parse$1(scale2, input2) {
  if (isNullOrUndef(input2)) {
    return null;
  }
  const adapter = scale2._adapter;
  const { parser, round: round2, isoWeekday } = scale2._parseOpts;
  let value2 = input2;
  if (typeof parser === "function") {
    value2 = parser(value2);
  }
  if (!isNumberFinite(value2)) {
    value2 = typeof parser === "string" ? adapter.parse(value2, parser) : adapter.parse(value2);
  }
  if (value2 === null) {
    return null;
  }
  if (round2) {
    value2 = round2 === "week" && (isNumber$2(isoWeekday) || isoWeekday === true) ? adapter.startOf(value2, "isoWeek", isoWeekday) : adapter.startOf(value2, round2);
  }
  return +value2;
}
function determineUnitForAutoTicks(minUnit, min2, max2, capacity) {
  const ilen = UNITS.length;
  for (let i2 = UNITS.indexOf(minUnit); i2 < ilen - 1; ++i2) {
    const interval = INTERVALS[UNITS[i2]];
    const factor = interval.steps ? interval.steps : Number.MAX_SAFE_INTEGER;
    if (interval.common && Math.ceil((max2 - min2) / (factor * interval.size)) <= capacity) {
      return UNITS[i2];
    }
  }
  return UNITS[ilen - 1];
}
function determineUnitForFormatting(scale2, numTicks, minUnit, min2, max2) {
  for (let i2 = UNITS.length - 1; i2 >= UNITS.indexOf(minUnit); i2--) {
    const unit2 = UNITS[i2];
    if (INTERVALS[unit2].common && scale2._adapter.diff(max2, min2, unit2) >= numTicks - 1) {
      return unit2;
    }
  }
  return UNITS[minUnit ? UNITS.indexOf(minUnit) : 0];
}
function determineMajorUnit(unit2) {
  for (let i2 = UNITS.indexOf(unit2) + 1, ilen = UNITS.length; i2 < ilen; ++i2) {
    if (INTERVALS[UNITS[i2]].common) {
      return UNITS[i2];
    }
  }
}
function addTick(ticks, time2, timestamps) {
  if (!timestamps) {
    ticks[time2] = true;
  } else if (timestamps.length) {
    const { lo, hi: hi2 } = _lookup(timestamps, time2);
    const timestamp = timestamps[lo] >= time2 ? timestamps[lo] : timestamps[hi2];
    ticks[timestamp] = true;
  }
}
function setMajorTicks(scale2, ticks, map2, majorUnit) {
  const adapter = scale2._adapter;
  const first = +adapter.startOf(ticks[0].value, majorUnit);
  const last = ticks[ticks.length - 1].value;
  let major, index2;
  for (major = first; major <= last; major = +adapter.add(major, 1, majorUnit)) {
    index2 = map2[major];
    if (index2 >= 0) {
      ticks[index2].major = true;
    }
  }
  return ticks;
}
function ticksFromTimestamps(scale2, values, majorUnit) {
  const ticks = [];
  const map2 = {};
  const ilen = values.length;
  let i2, value2;
  for (i2 = 0; i2 < ilen; ++i2) {
    value2 = values[i2];
    map2[value2] = i2;
    ticks.push({
      value: value2,
      major: false
    });
  }
  return ilen === 0 || !majorUnit ? ticks : setMajorTicks(scale2, ticks, map2, majorUnit);
}
class TimeScale extends Scale {
  constructor(props) {
    super(props);
    this._cache = {
      data: [],
      labels: [],
      all: []
    };
    this._unit = "day";
    this._majorUnit = void 0;
    this._offsets = {};
    this._normalized = false;
    this._parseOpts = void 0;
  }
  init(scaleOpts, opts2 = {}) {
    const time2 = scaleOpts.time || (scaleOpts.time = {});
    const adapter = this._adapter = new adapters$1._date(scaleOpts.adapters.date);
    adapter.init(opts2);
    mergeIf(time2.displayFormats, adapter.formats());
    this._parseOpts = {
      parser: time2.parser,
      round: time2.round,
      isoWeekday: time2.isoWeekday
    };
    super.init(scaleOpts);
    this._normalized = opts2.normalized;
  }
  parse(raw, index2) {
    if (raw === void 0) {
      return null;
    }
    return parse$1(this, raw);
  }
  beforeLayout() {
    super.beforeLayout();
    this._cache = {
      data: [],
      labels: [],
      all: []
    };
  }
  determineDataLimits() {
    const options = this.options;
    const adapter = this._adapter;
    const unit2 = options.time.unit || "day";
    let { min: min2, max: max2, minDefined, maxDefined } = this.getUserBounds();
    function _applyBounds(bounds2) {
      if (!minDefined && !isNaN(bounds2.min)) {
        min2 = Math.min(min2, bounds2.min);
      }
      if (!maxDefined && !isNaN(bounds2.max)) {
        max2 = Math.max(max2, bounds2.max);
      }
    }
    if (!minDefined || !maxDefined) {
      _applyBounds(this._getLabelBounds());
      if (options.bounds !== "ticks" || options.ticks.source !== "labels") {
        _applyBounds(this.getMinMax(false));
      }
    }
    min2 = isNumberFinite(min2) && !isNaN(min2) ? min2 : +adapter.startOf(Date.now(), unit2);
    max2 = isNumberFinite(max2) && !isNaN(max2) ? max2 : +adapter.endOf(Date.now(), unit2) + 1;
    this.min = Math.min(min2, max2 - 1);
    this.max = Math.max(min2 + 1, max2);
  }
  _getLabelBounds() {
    const arr = this.getLabelTimestamps();
    let min2 = Number.POSITIVE_INFINITY;
    let max2 = Number.NEGATIVE_INFINITY;
    if (arr.length) {
      min2 = arr[0];
      max2 = arr[arr.length - 1];
    }
    return {
      min: min2,
      max: max2
    };
  }
  buildTicks() {
    const options = this.options;
    const timeOpts = options.time;
    const tickOpts = options.ticks;
    const timestamps = tickOpts.source === "labels" ? this.getLabelTimestamps() : this._generate();
    if (options.bounds === "ticks" && timestamps.length) {
      this.min = this._userMin || timestamps[0];
      this.max = this._userMax || timestamps[timestamps.length - 1];
    }
    const min2 = this.min;
    const max2 = this.max;
    const ticks = _filterBetween(timestamps, min2, max2);
    this._unit = timeOpts.unit || (tickOpts.autoSkip ? determineUnitForAutoTicks(timeOpts.minUnit, this.min, this.max, this._getLabelCapacity(min2)) : determineUnitForFormatting(this, ticks.length, timeOpts.minUnit, this.min, this.max));
    this._majorUnit = !tickOpts.major.enabled || this._unit === "year" ? void 0 : determineMajorUnit(this._unit);
    this.initOffsets(timestamps);
    if (options.reverse) {
      ticks.reverse();
    }
    return ticksFromTimestamps(this, ticks, this._majorUnit);
  }
  afterAutoSkip() {
    if (this.options.offsetAfterAutoskip) {
      this.initOffsets(this.ticks.map((tick) => +tick.value));
    }
  }
  initOffsets(timestamps = []) {
    let start2 = 0;
    let end2 = 0;
    let first, last;
    if (this.options.offset && timestamps.length) {
      first = this.getDecimalForValue(timestamps[0]);
      if (timestamps.length === 1) {
        start2 = 1 - first;
      } else {
        start2 = (this.getDecimalForValue(timestamps[1]) - first) / 2;
      }
      last = this.getDecimalForValue(timestamps[timestamps.length - 1]);
      if (timestamps.length === 1) {
        end2 = last;
      } else {
        end2 = (last - this.getDecimalForValue(timestamps[timestamps.length - 2])) / 2;
      }
    }
    const limit2 = timestamps.length < 3 ? 0.5 : 0.25;
    start2 = _limitValue(start2, 0, limit2);
    end2 = _limitValue(end2, 0, limit2);
    this._offsets = {
      start: start2,
      end: end2,
      factor: 1 / (start2 + 1 + end2)
    };
  }
  _generate() {
    const adapter = this._adapter;
    const min2 = this.min;
    const max2 = this.max;
    const options = this.options;
    const timeOpts = options.time;
    const minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min2, max2, this._getLabelCapacity(min2));
    const stepSize = valueOrDefault(options.ticks.stepSize, 1);
    const weekday = minor === "week" ? timeOpts.isoWeekday : false;
    const hasWeekday = isNumber$2(weekday) || weekday === true;
    const ticks = {};
    let first = min2;
    let time2, count;
    if (hasWeekday) {
      first = +adapter.startOf(first, "isoWeek", weekday);
    }
    first = +adapter.startOf(first, hasWeekday ? "day" : minor);
    if (adapter.diff(max2, min2, minor) > 1e5 * stepSize) {
      throw new Error(min2 + " and " + max2 + " are too far apart with stepSize of " + stepSize + " " + minor);
    }
    const timestamps = options.ticks.source === "data" && this.getDataTimestamps();
    for (time2 = first, count = 0; time2 < max2; time2 = +adapter.add(time2, stepSize, minor), count++) {
      addTick(ticks, time2, timestamps);
    }
    if (time2 === max2 || options.bounds === "ticks" || count === 1) {
      addTick(ticks, time2, timestamps);
    }
    return Object.keys(ticks).sort(sorter).map((x2) => +x2);
  }
  getLabelForValue(value2) {
    const adapter = this._adapter;
    const timeOpts = this.options.time;
    if (timeOpts.tooltipFormat) {
      return adapter.format(value2, timeOpts.tooltipFormat);
    }
    return adapter.format(value2, timeOpts.displayFormats.datetime);
  }
  format(value2, format2) {
    const options = this.options;
    const formats2 = options.time.displayFormats;
    const unit2 = this._unit;
    const fmt = format2 || formats2[unit2];
    return this._adapter.format(value2, fmt);
  }
  _tickFormatFunction(time2, index2, ticks, format2) {
    const options = this.options;
    const formatter = options.ticks.callback;
    if (formatter) {
      return callback(formatter, [
        time2,
        index2,
        ticks
      ], this);
    }
    const formats2 = options.time.displayFormats;
    const unit2 = this._unit;
    const majorUnit = this._majorUnit;
    const minorFormat = unit2 && formats2[unit2];
    const majorFormat = majorUnit && formats2[majorUnit];
    const tick = ticks[index2];
    const major = majorUnit && majorFormat && tick && tick.major;
    return this._adapter.format(time2, format2 || (major ? majorFormat : minorFormat));
  }
  generateTickLabels(ticks) {
    let i2, ilen, tick;
    for (i2 = 0, ilen = ticks.length; i2 < ilen; ++i2) {
      tick = ticks[i2];
      tick.label = this._tickFormatFunction(tick.value, i2, ticks);
    }
  }
  getDecimalForValue(value2) {
    return value2 === null ? NaN : (value2 - this.min) / (this.max - this.min);
  }
  getPixelForValue(value2) {
    const offsets = this._offsets;
    const pos = this.getDecimalForValue(value2);
    return this.getPixelForDecimal((offsets.start + pos) * offsets.factor);
  }
  getValueForPixel(pixel) {
    const offsets = this._offsets;
    const pos = this.getDecimalForPixel(pixel) / offsets.factor - offsets.end;
    return this.min + pos * (this.max - this.min);
  }
  _getLabelSize(label) {
    const ticksOpts = this.options.ticks;
    const tickLabelWidth = this.ctx.measureText(label).width;
    const angle = toRadians(this.isHorizontal() ? ticksOpts.maxRotation : ticksOpts.minRotation);
    const cosRotation = Math.cos(angle);
    const sinRotation = Math.sin(angle);
    const tickFontSize = this._resolveTickFontOptions(0).size;
    return {
      w: tickLabelWidth * cosRotation + tickFontSize * sinRotation,
      h: tickLabelWidth * sinRotation + tickFontSize * cosRotation
    };
  }
  _getLabelCapacity(exampleTime) {
    const timeOpts = this.options.time;
    const displayFormats = timeOpts.displayFormats;
    const format2 = displayFormats[timeOpts.unit] || displayFormats.millisecond;
    const exampleLabel = this._tickFormatFunction(exampleTime, 0, ticksFromTimestamps(this, [
      exampleTime
    ], this._majorUnit), format2);
    const size2 = this._getLabelSize(exampleLabel);
    const capacity = Math.floor(this.isHorizontal() ? this.width / size2.w : this.height / size2.h) - 1;
    return capacity > 0 ? capacity : 1;
  }
  getDataTimestamps() {
    let timestamps = this._cache.data || [];
    let i2, ilen;
    if (timestamps.length) {
      return timestamps;
    }
    const metas = this.getMatchingVisibleMetas();
    if (this._normalized && metas.length) {
      return this._cache.data = metas[0].controller.getAllParsedValues(this);
    }
    for (i2 = 0, ilen = metas.length; i2 < ilen; ++i2) {
      timestamps = timestamps.concat(metas[i2].controller.getAllParsedValues(this));
    }
    return this._cache.data = this.normalize(timestamps);
  }
  getLabelTimestamps() {
    const timestamps = this._cache.labels || [];
    let i2, ilen;
    if (timestamps.length) {
      return timestamps;
    }
    const labels = this.getLabels();
    for (i2 = 0, ilen = labels.length; i2 < ilen; ++i2) {
      timestamps.push(parse$1(this, labels[i2]));
    }
    return this._cache.labels = this._normalized ? timestamps : this.normalize(timestamps);
  }
  normalize(values) {
    return _arrayUnique(values.sort(sorter));
  }
}
__publicField(TimeScale, "id", "time");
__publicField(TimeScale, "defaults", {
  bounds: "data",
  adapters: {},
  time: {
    parser: false,
    unit: false,
    round: false,
    isoWeekday: false,
    minUnit: "millisecond",
    displayFormats: {}
  },
  ticks: {
    source: "auto",
    callback: false,
    major: {
      enabled: false
    }
  }
});
function interpolate(table2, val, reverse) {
  let lo = 0;
  let hi2 = table2.length - 1;
  let prevSource, nextSource, prevTarget, nextTarget;
  if (reverse) {
    if (val >= table2[lo].pos && val <= table2[hi2].pos) {
      ({ lo, hi: hi2 } = _lookupByKey(table2, "pos", val));
    }
    ({ pos: prevSource, time: prevTarget } = table2[lo]);
    ({ pos: nextSource, time: nextTarget } = table2[hi2]);
  } else {
    if (val >= table2[lo].time && val <= table2[hi2].time) {
      ({ lo, hi: hi2 } = _lookupByKey(table2, "time", val));
    }
    ({ time: prevSource, pos: prevTarget } = table2[lo]);
    ({ time: nextSource, pos: nextTarget } = table2[hi2]);
  }
  const span = nextSource - prevSource;
  return span ? prevTarget + (nextTarget - prevTarget) * (val - prevSource) / span : prevTarget;
}
class TimeSeriesScale extends TimeScale {
  constructor(props) {
    super(props);
    this._table = [];
    this._minPos = void 0;
    this._tableRange = void 0;
  }
  initOffsets() {
    const timestamps = this._getTimestampsForTable();
    const table2 = this._table = this.buildLookupTable(timestamps);
    this._minPos = interpolate(table2, this.min);
    this._tableRange = interpolate(table2, this.max) - this._minPos;
    super.initOffsets(timestamps);
  }
  buildLookupTable(timestamps) {
    const { min: min2, max: max2 } = this;
    const items = [];
    const table2 = [];
    let i2, ilen, prev2, curr, next2;
    for (i2 = 0, ilen = timestamps.length; i2 < ilen; ++i2) {
      curr = timestamps[i2];
      if (curr >= min2 && curr <= max2) {
        items.push(curr);
      }
    }
    if (items.length < 2) {
      return [
        {
          time: min2,
          pos: 0
        },
        {
          time: max2,
          pos: 1
        }
      ];
    }
    for (i2 = 0, ilen = items.length; i2 < ilen; ++i2) {
      next2 = items[i2 + 1];
      prev2 = items[i2 - 1];
      curr = items[i2];
      if (Math.round((next2 + prev2) / 2) !== curr) {
        table2.push({
          time: curr,
          pos: i2 / (ilen - 1)
        });
      }
    }
    return table2;
  }
  _generate() {
    const min2 = this.min;
    const max2 = this.max;
    let timestamps = super.getDataTimestamps();
    if (!timestamps.includes(min2) || !timestamps.length) {
      timestamps.splice(0, 0, min2);
    }
    if (!timestamps.includes(max2) || timestamps.length === 1) {
      timestamps.push(max2);
    }
    return timestamps.sort((a2, b2) => a2 - b2);
  }
  _getTimestampsForTable() {
    let timestamps = this._cache.all || [];
    if (timestamps.length) {
      return timestamps;
    }
    const data = this.getDataTimestamps();
    const label = this.getLabelTimestamps();
    if (data.length && label.length) {
      timestamps = this.normalize(data.concat(label));
    } else {
      timestamps = data.length ? data : label;
    }
    timestamps = this._cache.all = timestamps;
    return timestamps;
  }
  getDecimalForValue(value2) {
    return (interpolate(this._table, value2) - this._minPos) / this._tableRange;
  }
  getValueForPixel(pixel) {
    const offsets = this._offsets;
    const decimal = this.getDecimalForPixel(pixel) / offsets.factor - offsets.end;
    return interpolate(this._table, decimal * this._tableRange + this._minPos, true);
  }
}
__publicField(TimeSeriesScale, "id", "timeseries");
__publicField(TimeSeriesScale, "defaults", TimeScale.defaults);
const defaultDatasetIdKey = "label";
function reforwardRef(ref, value2) {
  if (typeof ref === "function") {
    ref(value2);
  } else if (ref) {
    ref.current = value2;
  }
}
function setOptions(chart, nextOptions) {
  const options = chart.options;
  if (options && nextOptions) {
    Object.assign(options, nextOptions);
  }
}
function setLabels(currentData, nextLabels) {
  currentData.labels = nextLabels;
}
function setDatasets(currentData, nextDatasets) {
  let datasetIdKey = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : defaultDatasetIdKey;
  const addedDatasets = [];
  currentData.datasets = nextDatasets.map((nextDataset) => {
    const currentDataset = currentData.datasets.find((dataset) => dataset[datasetIdKey] === nextDataset[datasetIdKey]);
    if (!currentDataset || !nextDataset.data || addedDatasets.includes(currentDataset)) {
      return {
        ...nextDataset
      };
    }
    addedDatasets.push(currentDataset);
    Object.assign(currentDataset, nextDataset);
    return currentDataset;
  });
}
function cloneData(data) {
  let datasetIdKey = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : defaultDatasetIdKey;
  const nextData = {
    labels: [],
    datasets: []
  };
  setLabels(nextData, data.labels);
  setDatasets(nextData, data.datasets, datasetIdKey);
  return nextData;
}
function ChartComponent$1(props, ref) {
  const { height = 150, width = 300, redraw = false, datasetIdKey, type: type4, data, options, plugins = [], fallbackContent, updateMode, ...canvasProps } = props;
  const canvasRef = reactExports.useRef(null);
  const chartRef = reactExports.useRef(null);
  const renderChart = () => {
    if (!canvasRef.current)
      return;
    chartRef.current = new Chart$1(canvasRef.current, {
      type: type4,
      data: cloneData(data, datasetIdKey),
      options: options && {
        ...options
      },
      plugins
    });
    reforwardRef(ref, chartRef.current);
  };
  const destroyChart = () => {
    reforwardRef(ref, null);
    if (chartRef.current) {
      chartRef.current.destroy();
      chartRef.current = null;
    }
  };
  reactExports.useEffect(() => {
    if (!redraw && chartRef.current && options) {
      setOptions(chartRef.current, options);
    }
  }, [
    redraw,
    options
  ]);
  reactExports.useEffect(() => {
    if (!redraw && chartRef.current) {
      setLabels(chartRef.current.config.data, data.labels);
    }
  }, [
    redraw,
    data.labels
  ]);
  reactExports.useEffect(() => {
    if (!redraw && chartRef.current && data.datasets) {
      setDatasets(chartRef.current.config.data, data.datasets, datasetIdKey);
    }
  }, [
    redraw,
    data.datasets
  ]);
  reactExports.useEffect(() => {
    if (!chartRef.current)
      return;
    if (redraw) {
      destroyChart();
      setTimeout(renderChart);
    } else {
      chartRef.current.update(updateMode);
    }
  }, [
    redraw,
    options,
    data.labels,
    data.datasets,
    updateMode
  ]);
  reactExports.useEffect(() => {
    if (!chartRef.current)
      return;
    destroyChart();
    setTimeout(renderChart);
  }, [
    type4
  ]);
  reactExports.useEffect(() => {
    renderChart();
    return () => destroyChart();
  }, []);
  return /* @__PURE__ */ React$5.createElement("canvas", {
    ref: canvasRef,
    role: "img",
    height,
    width,
    ...canvasProps
  }, fallbackContent);
}
const Chart = /* @__PURE__ */ reactExports.forwardRef(ChartComponent$1);
function createTypedChart(type4, registerables) {
  Chart$1.register(registerables);
  return /* @__PURE__ */ reactExports.forwardRef((props, ref) => /* @__PURE__ */ React$5.createElement(Chart, {
    ...props,
    ref,
    type: type4
  }));
}
const Line = /* @__PURE__ */ createTypedChart("line", LineController);
const Bar = /* @__PURE__ */ createTypedChart("bar", BarController);
Chart$1.register(
  CategoryScale,
  LinearScale,
  PointElement,
  LineElement,
  plugin_title,
  plugin_tooltip,
  plugin_legend
);
const DashboardPage = () => {
  var _a2, _b2, _c2, _d, _e;
  const { t: t2 } = useTranslation();
  const navigate = useNavigate();
  const [data, setData] = reactExports.useState(
    {}
  );
  const [property2, setProperty3] = reactExports.useState();
  const initializedRef = reactExports.useRef(false);
  reactExports.useEffect(() => {
    BApi$1.dashboard.getStatistics().then((res) => {
      initializedRef.current = true;
      setData(
        res.data || {}
      );
    });
    BApi$1.dashboard.getPropertyStatistics().then((r2) => {
      setProperty3(r2.data);
    });
  }, []);
  const renderTrending = () => {
    if (data && data.resourceTrending) {
      const chartData = data.resourceTrending.map((r2) => ({
        week: r2.offset == 0 ? t2("This week") : r2.offset == -1 ? t2("Last week") : `${t2("{{count}} weeks ago", { count: -r2.offset })}`,
        count: r2.count
      })) ?? [];
      return /* @__PURE__ */ jsxRuntimeExports.jsx(ChartComponent, { chartData });
    }
    return null;
  };
  const renderResourceCounts = () => {
    const list2 = data.mediaLibraryResourceCounts ?? [];
    if (list2.length == 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          color: "primary",
          variant: "flat",
          onPress: () => navigate("/media-library"),
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-base" }),
            t2("Add your resources")
          ]
        }
      );
    }
    const getCssVariable = (variableName) => {
      if (typeof document === "undefined")
        return "";
      return getComputedStyle(document.documentElement).getPropertyValue(
        variableName
      );
    };
    const primaryColor = getCssVariable("--theme-text-primary") || "rgba(59,130,246,1)";
    const textColor = getCssVariable("--theme-text") || "#222";
    const subtleColor = getCssVariable("--theme-text-subtle") || "#888";
    const borderColor = getCssVariable("--theme-border-color") || "#eee";
    const blockBg = getCssVariable("--theme-block-background") || "#fff";
    const options = {
      responsive: true,
      maintainAspectRatio: false,
      plugins: {
        legend: { display: false },
        tooltip: {
          backgroundColor: blockBg,
          titleColor: textColor,
          bodyColor: textColor,
          borderColor: primaryColor,
          borderWidth: 1
        }
      },
      scales: {
        y: {
          beginAtZero: true,
          grid: { color: borderColor },
          ticks: { color: subtleColor }
        },
        x: {
          grid: { display: false },
          ticks: { color: subtleColor }
        }
      }
    };
    const chartData = {
      labels: list2.map((item) => item.name),
      datasets: [
        {
          label: t2("Resource count"),
          data: list2.map((item) => item.count),
          backgroundColor: `${primaryColor}33`,
          borderColor: primaryColor,
          borderWidth: 2,
          borderRadius: 8,
          // 圆角
          maxBarThickness: 32
          // 柱子最大宽度
        }
      ]
    };
    const total = (data.mediaLibraryResourceCounts ?? []).reduce(
      (s2, t22) => s2 + t22.count,
      0
    );
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full h-44 flex gap-2 items-start", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-lg", children: t2("Count of resources") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-3xl", children: total })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Bar, { data: chartData, options }) })
    ] });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "dashboard-page", children: initializedRef.current ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "h-1/3 max-h-1/3", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "block w-2/3", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "title", children: t2("Overview") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "content min-h-0", children: renderResourceCounts() })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "block trending", style: { flex: 1 }, children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "title", children: t2("Trending") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "content", children: renderTrending() })
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("section", { style: { maxHeight: "40%" }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "block", style: { flex: 2.5 }, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "title flex items-center gap-2", children: [
        t2("Property value coverage"),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm opacity-60", children: t2(
          "As more data is filled in, property value coverage increases"
        ) })
      ] }),
      property2 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-8 min-h-0", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[200px]", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-lg", children: t2("Overall") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-3xl", children: [
            property2.totalExpectedPropertyValueCount > 0 ? (property2.totalFilledPropertyValueCount / property2.totalExpectedPropertyValueCount * 100).toFixed(2) : 0,
            "%"
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-60 text-xs", children: property2.totalExpectedPropertyValueCount > 0 ? property2.totalFilledPropertyValueCount / property2.totalExpectedPropertyValueCount : 0 })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col min-h-0 max-h-full", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-lg", children: t2("Details") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: "flex flex-wrap gap-2 min-h-0 overflow-auto",
              children: (_a2 = property2.propertyValueCoverages) == null ? void 0 : _a2.map((x2) => {
                return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Chip,
                      {
                        color: x2.pool == PropertyPool.Reserved ? "secondary" : "success",
                        radius: "sm",
                        size: "sm",
                        variant: "flat",
                        children: x2.name
                      }
                    ),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                      (x2.filledCount / x2.expectedCount * 100).toFixed(2),
                      "%"
                    ] })
                  ] }),
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "opacity-60 text-xs text-center", children: [
                    x2.filledCount,
                    " / ",
                    x2.expectedCount
                  ] })
                ] });
              })
            }
          )
        ] })
      ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center py-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, {}) })
    ] }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "block", style: { flex: 1.5 }, children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "title", children: t2("Downloader") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "content", children: data.downloaderDataCounts && data.downloaderDataCounts.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "downloader-item", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Third party") }),
            downloadTaskStatuses.map((s2, i2) => {
              return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(s2.label) }, i2);
            })
          ] }),
          (_b2 = data.downloaderDataCounts) == null ? void 0 : _b2.map((c2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "downloader-item", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(ThirdPartyId[c2.id]) }),
              downloadTaskStatuses.map((s2, i2) => {
                var _a3;
                return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: ((_a3 = c2.statusAndCounts) == null ? void 0 : _a3[s2.value]) ?? 0 }, i2);
              })
            ] });
          })
        ] }) : t2("No content") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "blocks", children: [
        (_c2 = data.otherCounts) == null ? void 0 : _c2.map((list2, r2) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsx("section", { children: list2.map((c2, j2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "block", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "content", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: t2(c2.name) }),
              c2.count
            ] }, j2) }) }, j2);
          }) }, r2);
        }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("section", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "block", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "content", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "t-t-c file-mover", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "left", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text", children: t2("File mover") }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "count flex items-center gap-1", children: [
            ((_d = data.fileMover) == null ? void 0 : _d.sourceCount) ?? 0,
            /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineArrowRight, {}),
            ((_e = data.fileMover) == null ? void 0 : _e.targetCount) ?? 0
          ] }) })
        ] }) }) }) })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "block hidden", style: { flex: 1.5 } })
    ] })
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "lg" }) }) });
};
DashboardPage.displayName = "DashboardPage";
const ChartComponent = ({ chartData }) => {
  const { isDarkMode } = useBakabaseContext();
  const getCssVariable = (variableName) => {
    if (typeof document === "undefined") {
      return "";
    }
    return getComputedStyle(document.documentElement).getPropertyValue(
      variableName
    );
  };
  if (!Array.isArray(chartData) || chartData.length === 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center py-4 text-gray-500", children: "No data available" });
  }
  const primaryColor = getCssVariable("--theme-text-primary");
  const textColor = getCssVariable("--theme-text");
  const subtleColor = getCssVariable("--theme-text-subtle");
  const borderColor = getCssVariable("--theme-border-color");
  const blockBg = getCssVariable("--theme-block-background");
  const data = {
    labels: chartData.map((item) => item.week),
    datasets: [
      {
        label: "Count",
        data: chartData.map((item) => item.count),
        borderColor: primaryColor,
        backgroundColor: `${primaryColor}33`,
        // 20ity
        borderWidth: 2,
        fill: true,
        tension: 0.4,
        pointBackgroundColor: primaryColor,
        pointBorderColor: textColor,
        pointBorderWidth: 2,
        pointRadius: 4,
        pointHoverRadius: 6
      }
    ]
  };
  const options = {
    responsive: true,
    maintainAspectRatio: false,
    plugins: {
      legend: {
        display: false
      },
      tooltip: {
        backgroundColor: blockBg,
        titleColor: textColor,
        bodyColor: textColor,
        borderColor: primaryColor,
        borderWidth: 1
      }
    },
    scales: {
      y: {
        beginAtZero: true,
        grid: {
          color: borderColor
        },
        ticks: {
          color: subtleColor
        }
      },
      x: {
        display: false,
        // 隐藏X轴标签
        grid: {
          display: false
        }
      }
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full h-44", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Line, { data, options }) });
};
function useFirstMountState() {
  var isFirst = reactExports.useRef(true);
  if (isFirst.current) {
    isFirst.current = false;
    return true;
  }
  return isFirst.current;
}
var useUpdateEffect = function(effect, deps) {
  var isFirstMount = useFirstMountState();
  reactExports.useEffect(function() {
    if (!isFirstMount) {
      return effect();
    }
  }, deps);
};
var updateReducer = function(num) {
  return (num + 1) % 1e6;
};
function useUpdate() {
  var _a2 = reactExports.useReducer(updateReducer, 0), update = _a2[1];
  return update;
}
function useTimeoutFn(fn, ms) {
  if (ms === void 0) {
    ms = 0;
  }
  var ready = reactExports.useRef(false);
  var timeout = reactExports.useRef();
  var callback2 = reactExports.useRef(fn);
  var isReady = reactExports.useCallback(function() {
    return ready.current;
  }, []);
  var set2 = reactExports.useCallback(function() {
    ready.current = false;
    timeout.current && clearTimeout(timeout.current);
    timeout.current = setTimeout(function() {
      ready.current = true;
      callback2.current();
    }, ms);
  }, [ms]);
  var clear = reactExports.useCallback(function() {
    ready.current = null;
    timeout.current && clearTimeout(timeout.current);
  }, []);
  reactExports.useEffect(function() {
    callback2.current = fn;
  }, [fn]);
  reactExports.useEffect(function() {
    set2();
    return clear;
  }, [ms]);
  return [isReady, clear, set2];
}
function useDebounce(fn, ms, deps) {
  if (ms === void 0) {
    ms = 0;
  }
  if (deps === void 0) {
    deps = [];
  }
  var _a2 = useTimeoutFn(fn, ms), isReady = _a2[0], cancel2 = _a2[1], reset = _a2[2];
  reactExports.useEffect(reset, deps);
  return [isReady, cancel2];
}
function usePrevious$1(state) {
  var ref = reactExports.useRef();
  reactExports.useEffect(function() {
    ref.current = state;
  });
  return ref.current;
}
function componentWillMount() {
  var state = this.constructor.getDerivedStateFromProps(this.props, this.state);
  if (state !== null && state !== void 0) {
    this.setState(state);
  }
}
function componentWillReceiveProps(nextProps) {
  function updater(prevState) {
    var state = this.constructor.getDerivedStateFromProps(nextProps, prevState);
    return state !== null && state !== void 0 ? state : null;
  }
  this.setState(updater.bind(this));
}
function componentWillUpdate(nextProps, nextState) {
  try {
    var prevProps = this.props;
    var prevState = this.state;
    this.props = nextProps;
    this.state = nextState;
    this.__reactInternalSnapshotFlag = true;
    this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(
      prevProps,
      prevState
    );
  } finally {
    this.props = prevProps;
    this.state = prevState;
  }
}
componentWillMount.__suppressDeprecationWarning = true;
componentWillReceiveProps.__suppressDeprecationWarning = true;
componentWillUpdate.__suppressDeprecationWarning = true;
function polyfill2(Component2) {
  var prototype2 = Component2.prototype;
  if (!prototype2 || !prototype2.isReactComponent) {
    throw new Error("Can only polyfill class components");
  }
  if (typeof Component2.getDerivedStateFromProps !== "function" && typeof prototype2.getSnapshotBeforeUpdate !== "function") {
    return Component2;
  }
  var foundWillMountName = null;
  var foundWillReceivePropsName = null;
  var foundWillUpdateName = null;
  if (typeof prototype2.componentWillMount === "function") {
    foundWillMountName = "componentWillMount";
  } else if (typeof prototype2.UNSAFE_componentWillMount === "function") {
    foundWillMountName = "UNSAFE_componentWillMount";
  }
  if (typeof prototype2.componentWillReceiveProps === "function") {
    foundWillReceivePropsName = "componentWillReceiveProps";
  } else if (typeof prototype2.UNSAFE_componentWillReceiveProps === "function") {
    foundWillReceivePropsName = "UNSAFE_componentWillReceiveProps";
  }
  if (typeof prototype2.componentWillUpdate === "function") {
    foundWillUpdateName = "componentWillUpdate";
  } else if (typeof prototype2.UNSAFE_componentWillUpdate === "function") {
    foundWillUpdateName = "UNSAFE_componentWillUpdate";
  }
  if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
    var componentName = Component2.displayName || Component2.name;
    var newApiName = typeof Component2.getDerivedStateFromProps === "function" ? "getDerivedStateFromProps()" : "getSnapshotBeforeUpdate()";
    throw Error(
      "Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n" + componentName + " uses " + newApiName + " but also contains the following legacy lifecycles:" + (foundWillMountName !== null ? "\n  " + foundWillMountName : "") + (foundWillReceivePropsName !== null ? "\n  " + foundWillReceivePropsName : "") + (foundWillUpdateName !== null ? "\n  " + foundWillUpdateName : "") + "\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks"
    );
  }
  if (typeof Component2.getDerivedStateFromProps === "function") {
    prototype2.componentWillMount = componentWillMount;
    prototype2.componentWillReceiveProps = componentWillReceiveProps;
  }
  if (typeof prototype2.getSnapshotBeforeUpdate === "function") {
    if (typeof prototype2.componentDidUpdate !== "function") {
      throw new Error(
        "Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype"
      );
    }
    prototype2.componentWillUpdate = componentWillUpdate;
    var componentDidUpdate = prototype2.componentDidUpdate;
    prototype2.componentDidUpdate = function componentDidUpdatePolyfill(prevProps, prevState, maybeSnapshot) {
      var snapshot = this.__reactInternalSnapshotFlag ? this.__reactInternalSnapshot : maybeSnapshot;
      componentDidUpdate.call(this, prevProps, prevState, snapshot);
    };
  }
  return Component2;
}
function ownKeys$9(e2, r2) {
  var t2 = Object.keys(e2);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e2);
    r2 && (o2 = o2.filter(function(r3) {
      return Object.getOwnPropertyDescriptor(e2, r3).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread$a(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys$9(Object(t2), true).forEach(function(r3) {
      _defineProperty$3(e2, r3, t2[r3]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$9(Object(t2)).forEach(function(r3) {
      Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3));
    });
  }
  return e2;
}
function _callSuper$e(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$e() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$e() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t3) {
  }
  return (_isNativeReflectConstruct$e = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var ArrowKeyStepper = /* @__PURE__ */ function(_React$PureComponent) {
  function ArrowKeyStepper2() {
    var _this;
    _classCallCheck$a(this, ArrowKeyStepper2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _callSuper$e(this, ArrowKeyStepper2, [].concat(args));
    _defineProperty$3(_this, "state", {
      scrollToColumn: 0,
      scrollToRow: 0,
      instanceProps: {
        prevScrollToColumn: 0,
        prevScrollToRow: 0
      }
    });
    _defineProperty$3(_this, "_columnStartIndex", 0);
    _defineProperty$3(_this, "_columnStopIndex", 0);
    _defineProperty$3(_this, "_rowStartIndex", 0);
    _defineProperty$3(_this, "_rowStopIndex", 0);
    _defineProperty$3(_this, "_onKeyDown", function(event) {
      var _this$props = _this.props, columnCount = _this$props.columnCount, disabled = _this$props.disabled, mode = _this$props.mode, rowCount = _this$props.rowCount;
      if (disabled) {
        return;
      }
      var _this$_getScrollState = _this._getScrollState(), scrollToColumnPrevious = _this$_getScrollState.scrollToColumn, scrollToRowPrevious = _this$_getScrollState.scrollToRow;
      var _this$_getScrollState2 = _this._getScrollState(), scrollToColumn = _this$_getScrollState2.scrollToColumn, scrollToRow = _this$_getScrollState2.scrollToRow;
      switch (event.key) {
        case "ArrowDown":
          scrollToRow = mode === "cells" ? Math.min(scrollToRow + 1, rowCount - 1) : Math.min(_this._rowStopIndex + 1, rowCount - 1);
          break;
        case "ArrowLeft":
          scrollToColumn = mode === "cells" ? Math.max(scrollToColumn - 1, 0) : Math.max(_this._columnStartIndex - 1, 0);
          break;
        case "ArrowRight":
          scrollToColumn = mode === "cells" ? Math.min(scrollToColumn + 1, columnCount - 1) : Math.min(_this._columnStopIndex + 1, columnCount - 1);
          break;
        case "ArrowUp":
          scrollToRow = mode === "cells" ? Math.max(scrollToRow - 1, 0) : Math.max(_this._rowStartIndex - 1, 0);
          break;
      }
      if (scrollToColumn !== scrollToColumnPrevious || scrollToRow !== scrollToRowPrevious) {
        event.preventDefault();
        _this._updateScrollState({
          scrollToColumn,
          scrollToRow
        });
      }
    });
    _defineProperty$3(_this, "_onSectionRendered", function(_ref) {
      var columnStartIndex = _ref.columnStartIndex, columnStopIndex = _ref.columnStopIndex, rowStartIndex = _ref.rowStartIndex, rowStopIndex = _ref.rowStopIndex;
      _this._columnStartIndex = columnStartIndex;
      _this._columnStopIndex = columnStopIndex;
      _this._rowStartIndex = rowStartIndex;
      _this._rowStopIndex = rowStopIndex;
    });
    return _this;
  }
  _inherits$a(ArrowKeyStepper2, _React$PureComponent);
  return _createClass$8(ArrowKeyStepper2, [{
    key: "setScrollIndexes",
    value: function setScrollIndexes(_ref2) {
      var scrollToColumn = _ref2.scrollToColumn, scrollToRow = _ref2.scrollToRow;
      this.setState({
        scrollToRow,
        scrollToColumn
      });
    }
  }, {
    key: "render",
    value: function render3() {
      var _this$props2 = this.props, className = _this$props2.className, children = _this$props2.children;
      var _this$_getScrollState3 = this._getScrollState(), scrollToColumn = _this$_getScrollState3.scrollToColumn, scrollToRow = _this$_getScrollState3.scrollToRow;
      return /* @__PURE__ */ reactExports.createElement("div", {
        className,
        onKeyDown: this._onKeyDown
      }, children({
        onSectionRendered: this._onSectionRendered,
        scrollToColumn,
        scrollToRow
      }));
    }
  }, {
    key: "_getScrollState",
    value: function _getScrollState() {
      return this.props.isControlled ? this.props : this.state;
    }
  }, {
    key: "_updateScrollState",
    value: function _updateScrollState(_ref3) {
      var scrollToColumn = _ref3.scrollToColumn, scrollToRow = _ref3.scrollToRow;
      var _this$props3 = this.props, isControlled = _this$props3.isControlled, onScrollToChange = _this$props3.onScrollToChange;
      if (typeof onScrollToChange === "function") {
        onScrollToChange({
          scrollToColumn,
          scrollToRow
        });
      }
      if (!isControlled) {
        this.setState({
          scrollToColumn,
          scrollToRow
        });
      }
    }
  }], [{
    key: "getDerivedStateFromProps",
    value: function getDerivedStateFromProps(nextProps, prevState) {
      if (nextProps.isControlled) {
        return {};
      }
      if (nextProps.scrollToColumn !== prevState.instanceProps.prevScrollToColumn || nextProps.scrollToRow !== prevState.instanceProps.prevScrollToRow) {
        return _objectSpread$a(_objectSpread$a({}, prevState), {}, {
          scrollToColumn: nextProps.scrollToColumn,
          scrollToRow: nextProps.scrollToRow,
          instanceProps: {
            prevScrollToColumn: nextProps.scrollToColumn,
            prevScrollToRow: nextProps.scrollToRow
          }
        });
      }
      return {};
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$3(ArrowKeyStepper, "defaultProps", {
  disabled: false,
  isControlled: false,
  mode: "edges",
  scrollToColumn: 0,
  scrollToRow: 0
});
polyfill2(ArrowKeyStepper);
function createDetectElementResize(nonce, hostWindow) {
  var _window;
  if (typeof hostWindow !== "undefined") {
    _window = hostWindow;
  } else if (typeof window !== "undefined") {
    _window = window;
  } else if (typeof self !== "undefined") {
    _window = self;
  } else {
    _window = global;
  }
  var attachEvent = typeof _window.document !== "undefined" && _window.document.attachEvent;
  if (!attachEvent) {
    var requestFrame = function() {
      var raf3 = _window.requestAnimationFrame || _window.mozRequestAnimationFrame || _window.webkitRequestAnimationFrame || function(fn) {
        return _window.setTimeout(fn, 20);
      };
      return function(fn) {
        return raf3(fn);
      };
    }();
    var cancelFrame2 = function() {
      var cancel2 = _window.cancelAnimationFrame || _window.mozCancelAnimationFrame || _window.webkitCancelAnimationFrame || _window.clearTimeout;
      return function(id2) {
        return cancel2(id2);
      };
    }();
    var resetTriggers = function resetTriggers2(element2) {
      var triggers = element2.__resizeTriggers__, expand = triggers.firstElementChild, contract = triggers.lastElementChild, expandChild = expand.firstElementChild;
      contract.scrollLeft = contract.scrollWidth;
      contract.scrollTop = contract.scrollHeight;
      expandChild.style.width = expand.offsetWidth + 1 + "px";
      expandChild.style.height = expand.offsetHeight + 1 + "px";
      expand.scrollLeft = expand.scrollWidth;
      expand.scrollTop = expand.scrollHeight;
    };
    var checkTriggers = function checkTriggers2(element2) {
      return element2.offsetWidth != element2.__resizeLast__.width || element2.offsetHeight != element2.__resizeLast__.height;
    };
    var scrollListener = function scrollListener2(e2) {
      if (e2.target.className && typeof e2.target.className.indexOf === "function" && e2.target.className.indexOf("contract-trigger") < 0 && e2.target.className.indexOf("expand-trigger") < 0) {
        return;
      }
      var element2 = this;
      resetTriggers(this);
      if (this.__resizeRAF__) {
        cancelFrame2(this.__resizeRAF__);
      }
      this.__resizeRAF__ = requestFrame(function() {
        if (checkTriggers(element2)) {
          element2.__resizeLast__.width = element2.offsetWidth;
          element2.__resizeLast__.height = element2.offsetHeight;
          element2.__resizeListeners__.forEach(function(fn) {
            fn.call(element2, e2);
          });
        }
      });
    };
    var animation = false, keyframeprefix = "", animationstartevent = "animationstart", domPrefixes = "Webkit Moz O ms".split(" "), startEvents = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "), pfx = "";
    {
      var elm = _window.document.createElement("fakeelement");
      if (elm.style.animationName !== void 0) {
        animation = true;
      }
      if (animation === false) {
        for (var i2 = 0; i2 < domPrefixes.length; i2++) {
          if (elm.style[domPrefixes[i2] + "AnimationName"] !== void 0) {
            pfx = domPrefixes[i2];
            keyframeprefix = "-" + pfx.toLowerCase() + "-";
            animationstartevent = startEvents[i2];
            animation = true;
            break;
          }
        }
      }
    }
    var animationName = "resizeanim";
    var animationKeyframes = "@" + keyframeprefix + "keyframes " + animationName + " { from { opacity: 0; } to { opacity: 0; } } ";
    var animationStyle = keyframeprefix + "animation: 1ms " + animationName + "; ";
  }
  var createStyles = function createStyles2(doc) {
    if (!doc.getElementById("detectElementResize")) {
      var css = (animationKeyframes ? animationKeyframes : "") + ".resize-triggers { " + (animationStyle ? animationStyle : "") + 'visibility: hidden; opacity: 0; } .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }', head = doc.head || doc.getElementsByTagName("head")[0], style2 = doc.createElement("style");
      style2.id = "detectElementResize";
      style2.type = "text/css";
      if (nonce != null) {
        style2.setAttribute("nonce", nonce);
      }
      if (style2.styleSheet) {
        style2.styleSheet.cssText = css;
      } else {
        style2.appendChild(doc.createTextNode(css));
      }
      head.appendChild(style2);
    }
  };
  var addResizeListener = function addResizeListener2(element2, fn) {
    if (attachEvent) {
      element2.attachEvent("onresize", fn);
    } else {
      if (!element2.__resizeTriggers__) {
        var doc = element2.ownerDocument;
        var elementStyle = _window.getComputedStyle(element2);
        if (elementStyle && elementStyle.position == "static") {
          element2.style.position = "relative";
        }
        createStyles(doc);
        element2.__resizeLast__ = {};
        element2.__resizeListeners__ = [];
        (element2.__resizeTriggers__ = doc.createElement("div")).className = "resize-triggers";
        var expandTrigger = doc.createElement("div");
        expandTrigger.className = "expand-trigger";
        expandTrigger.appendChild(doc.createElement("div"));
        var contractTrigger = doc.createElement("div");
        contractTrigger.className = "contract-trigger";
        element2.__resizeTriggers__.appendChild(expandTrigger);
        element2.__resizeTriggers__.appendChild(contractTrigger);
        element2.appendChild(element2.__resizeTriggers__);
        resetTriggers(element2);
        element2.addEventListener("scroll", scrollListener, true);
        if (animationstartevent) {
          element2.__resizeTriggers__.__animationListener__ = function animationListener(e2) {
            if (e2.animationName == animationName) {
              resetTriggers(element2);
            }
          };
          element2.__resizeTriggers__.addEventListener(animationstartevent, element2.__resizeTriggers__.__animationListener__);
        }
      }
      element2.__resizeListeners__.push(fn);
    }
  };
  var removeResizeListener = function removeResizeListener2(element2, fn) {
    if (attachEvent) {
      element2.detachEvent("onresize", fn);
    } else {
      element2.__resizeListeners__.splice(element2.__resizeListeners__.indexOf(fn), 1);
      if (!element2.__resizeListeners__.length) {
        element2.removeEventListener("scroll", scrollListener, true);
        if (element2.__resizeTriggers__.__animationListener__) {
          element2.__resizeTriggers__.removeEventListener(animationstartevent, element2.__resizeTriggers__.__animationListener__);
          element2.__resizeTriggers__.__animationListener__ = null;
        }
        try {
          element2.__resizeTriggers__ = !element2.removeChild(element2.__resizeTriggers__);
        } catch (e2) {
        }
      }
    }
  };
  return {
    addResizeListener,
    removeResizeListener
  };
}
function ownKeys$8(e2, r2) {
  var t2 = Object.keys(e2);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e2);
    r2 && (o2 = o2.filter(function(r3) {
      return Object.getOwnPropertyDescriptor(e2, r3).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread$9(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys$8(Object(t2), true).forEach(function(r3) {
      _defineProperty$3(e2, r3, t2[r3]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$8(Object(t2)).forEach(function(r3) {
      Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3));
    });
  }
  return e2;
}
function _callSuper$d(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$d() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$d() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t3) {
  }
  return (_isNativeReflectConstruct$d = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var AutoSizer = /* @__PURE__ */ function(_React$Component) {
  function AutoSizer2() {
    var _this;
    _classCallCheck$a(this, AutoSizer2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _callSuper$d(this, AutoSizer2, [].concat(args));
    _defineProperty$3(_this, "state", {
      height: _this.props.defaultHeight || 0,
      width: _this.props.defaultWidth || 0
    });
    _defineProperty$3(_this, "_parentNode", void 0);
    _defineProperty$3(_this, "_autoSizer", void 0);
    _defineProperty$3(_this, "_window", void 0);
    _defineProperty$3(_this, "_detectElementResize", void 0);
    _defineProperty$3(_this, "_onResize", function() {
      var _this$props = _this.props, disableHeight = _this$props.disableHeight, disableWidth = _this$props.disableWidth, onResize4 = _this$props.onResize;
      if (_this._parentNode) {
        var height = _this._parentNode.offsetHeight || 0;
        var width = _this._parentNode.offsetWidth || 0;
        var win2 = _this._window || window;
        var style2 = win2.getComputedStyle(_this._parentNode) || {};
        var paddingLeft = parseInt(style2.paddingLeft, 10) || 0;
        var paddingRight = parseInt(style2.paddingRight, 10) || 0;
        var paddingTop = parseInt(style2.paddingTop, 10) || 0;
        var paddingBottom = parseInt(style2.paddingBottom, 10) || 0;
        var newHeight = height - paddingTop - paddingBottom;
        var newWidth = width - paddingLeft - paddingRight;
        if (!disableHeight && _this.state.height !== newHeight || !disableWidth && _this.state.width !== newWidth) {
          _this.setState({
            height: height - paddingTop - paddingBottom,
            width: width - paddingLeft - paddingRight
          });
          onResize4({
            height,
            width
          });
        }
      }
    });
    _defineProperty$3(_this, "_setRef", function(autoSizer) {
      _this._autoSizer = autoSizer;
    });
    return _this;
  }
  _inherits$a(AutoSizer2, _React$Component);
  return _createClass$8(AutoSizer2, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      var nonce = this.props.nonce;
      if (this._autoSizer && this._autoSizer.parentNode && this._autoSizer.parentNode.ownerDocument && this._autoSizer.parentNode.ownerDocument.defaultView && this._autoSizer.parentNode instanceof this._autoSizer.parentNode.ownerDocument.defaultView.HTMLElement) {
        this._parentNode = this._autoSizer.parentNode;
        this._window = this._autoSizer.parentNode.ownerDocument.defaultView;
        this._detectElementResize = createDetectElementResize(nonce, this._window);
        this._detectElementResize.addResizeListener(this._parentNode, this._onResize);
        this._onResize();
      }
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      if (this._detectElementResize && this._parentNode) {
        this._detectElementResize.removeResizeListener(this._parentNode, this._onResize);
      }
    }
  }, {
    key: "render",
    value: function render3() {
      var _this$props2 = this.props, children = _this$props2.children, className = _this$props2.className, disableHeight = _this$props2.disableHeight, disableWidth = _this$props2.disableWidth, style2 = _this$props2.style;
      var _this$state = this.state, height = _this$state.height, width = _this$state.width;
      var outerStyle = {
        overflow: "visible"
      };
      var childParams = {};
      if (!disableHeight) {
        outerStyle.height = 0;
        childParams.height = height;
      }
      if (!disableWidth) {
        outerStyle.width = 0;
        childParams.width = width;
      }
      return /* @__PURE__ */ reactExports.createElement("div", {
        className,
        ref: this._setRef,
        style: _objectSpread$9(_objectSpread$9({}, outerStyle), style2)
      }, children(childParams));
    }
  }]);
}(reactExports.Component);
_defineProperty$3(AutoSizer, "defaultProps", {
  onResize: function onResize2() {
  },
  disableHeight: false,
  disableWidth: false,
  style: {}
});
function _callSuper$c(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$c() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$c() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t22) {
  }
  return (_isNativeReflectConstruct$c = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var CellMeasurer = /* @__PURE__ */ function(_React$PureComponent) {
  function CellMeasurer2() {
    var _this;
    _classCallCheck$a(this, CellMeasurer2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _callSuper$c(this, CellMeasurer2, [].concat(args));
    _defineProperty$3(_this, "_child", /* @__PURE__ */ reactExports.createRef());
    _defineProperty$3(_this, "_measure", function() {
      var _this$props = _this.props, cache2 = _this$props.cache, _this$props$columnInd = _this$props.columnIndex, columnIndex = _this$props$columnInd === void 0 ? 0 : _this$props$columnInd, parent = _this$props.parent, _this$props$rowIndex = _this$props.rowIndex, rowIndex = _this$props$rowIndex === void 0 ? _this.props.index || 0 : _this$props$rowIndex;
      var _this$_getCellMeasure = _this._getCellMeasurements(), height = _this$_getCellMeasure.height, width = _this$_getCellMeasure.width;
      if (height !== cache2.getHeight(rowIndex, columnIndex) || width !== cache2.getWidth(rowIndex, columnIndex)) {
        cache2.set(rowIndex, columnIndex, width, height);
        if (parent && typeof parent.recomputeGridSize === "function") {
          parent.recomputeGridSize({
            columnIndex,
            rowIndex
          });
        }
      }
    });
    _defineProperty$3(_this, "_registerChild", function(element2) {
      if (element2 && !(element2 instanceof Element)) {
        console.warn("CellMeasurer registerChild expects to be passed Element or null");
      }
      _this._child.current = element2;
      if (element2) {
        _this._maybeMeasureCell();
      }
    });
    return _this;
  }
  _inherits$a(CellMeasurer2, _React$PureComponent);
  return _createClass$8(CellMeasurer2, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      this._maybeMeasureCell();
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate() {
      this._maybeMeasureCell();
    }
  }, {
    key: "render",
    value: function render3() {
      var _this2 = this;
      var children = this.props.children;
      var resolvedChildren = typeof children === "function" ? children({
        measure: this._measure,
        registerChild: this._registerChild
      }) : children;
      if (resolvedChildren === null) {
        return resolvedChildren;
      }
      return /* @__PURE__ */ reactExports.cloneElement(resolvedChildren, {
        ref: function ref(node2) {
          if (typeof resolvedChildren.ref === "function") {
            resolvedChildren.ref(node2);
          } else if (resolvedChildren.ref) {
            resolvedChildren.ref.current = node2;
          }
          _this2._child.current = node2;
        }
      });
    }
  }, {
    key: "_getCellMeasurements",
    value: function _getCellMeasurements() {
      var cache2 = this.props.cache;
      var node2 = this._child.current;
      if (node2 && node2.ownerDocument && node2.ownerDocument.defaultView && node2 instanceof node2.ownerDocument.defaultView.HTMLElement) {
        var styleWidth = node2.style.width;
        var styleHeight = node2.style.height;
        if (!cache2.hasFixedWidth()) {
          node2.style.width = "auto";
        }
        if (!cache2.hasFixedHeight()) {
          node2.style.height = "auto";
        }
        var height = Math.ceil(node2.offsetHeight);
        var width = Math.ceil(node2.offsetWidth);
        if (styleWidth) {
          node2.style.width = styleWidth;
        }
        if (styleHeight) {
          node2.style.height = styleHeight;
        }
        return {
          height,
          width
        };
      } else {
        return {
          height: 0,
          width: 0
        };
      }
    }
  }, {
    key: "_maybeMeasureCell",
    value: function _maybeMeasureCell() {
      var _this$props2 = this.props, cache2 = _this$props2.cache, _this$props2$columnIn = _this$props2.columnIndex, columnIndex = _this$props2$columnIn === void 0 ? 0 : _this$props2$columnIn, parent = _this$props2.parent, _this$props2$rowIndex = _this$props2.rowIndex, rowIndex = _this$props2$rowIndex === void 0 ? this.props.index || 0 : _this$props2$rowIndex;
      if (!cache2.has(rowIndex, columnIndex)) {
        var _this$_getCellMeasure2 = this._getCellMeasurements(), height = _this$_getCellMeasure2.height, width = _this$_getCellMeasure2.width;
        cache2.set(rowIndex, columnIndex, width, height);
        if (parent && typeof parent.invalidateCellSizeAfterRender === "function") {
          parent.invalidateCellSizeAfterRender({
            columnIndex,
            rowIndex
          });
        }
      }
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$3(CellMeasurer, "__internalCellMeasurerFlag", false);
var DEFAULT_HEIGHT = 30;
var DEFAULT_WIDTH = 100;
var CellMeasurerCache = /* @__PURE__ */ function() {
  function CellMeasurerCache2() {
    var _this = this;
    var params = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    _classCallCheck$a(this, CellMeasurerCache2);
    _defineProperty$3(this, "_cellHeightCache", {});
    _defineProperty$3(this, "_cellWidthCache", {});
    _defineProperty$3(this, "_columnWidthCache", {});
    _defineProperty$3(this, "_rowHeightCache", {});
    _defineProperty$3(this, "_defaultHeight", void 0);
    _defineProperty$3(this, "_defaultWidth", void 0);
    _defineProperty$3(this, "_minHeight", void 0);
    _defineProperty$3(this, "_minWidth", void 0);
    _defineProperty$3(this, "_keyMapper", void 0);
    _defineProperty$3(this, "_hasFixedHeight", void 0);
    _defineProperty$3(this, "_hasFixedWidth", void 0);
    _defineProperty$3(this, "_columnCount", 0);
    _defineProperty$3(this, "_rowCount", 0);
    _defineProperty$3(this, "columnWidth", function(_ref) {
      var index2 = _ref.index;
      var key = _this._keyMapper(0, index2);
      return _this._columnWidthCache[key] !== void 0 ? _this._columnWidthCache[key] : _this._defaultWidth;
    });
    _defineProperty$3(this, "rowHeight", function(_ref2) {
      var index2 = _ref2.index;
      var key = _this._keyMapper(index2, 0);
      return _this._rowHeightCache[key] !== void 0 ? _this._rowHeightCache[key] : _this._defaultHeight;
    });
    var defaultHeight = params.defaultHeight, defaultWidth = params.defaultWidth, fixedHeight = params.fixedHeight, fixedWidth = params.fixedWidth, keyMapper = params.keyMapper, minHeight = params.minHeight, minWidth = params.minWidth;
    this._hasFixedHeight = fixedHeight === true;
    this._hasFixedWidth = fixedWidth === true;
    this._minHeight = minHeight || 0;
    this._minWidth = minWidth || 0;
    this._keyMapper = keyMapper || defaultKeyMapper;
    this._defaultHeight = Math.max(this._minHeight, typeof defaultHeight === "number" ? defaultHeight : DEFAULT_HEIGHT);
    this._defaultWidth = Math.max(this._minWidth, typeof defaultWidth === "number" ? defaultWidth : DEFAULT_WIDTH);
  }
  return _createClass$8(CellMeasurerCache2, [{
    key: "clear",
    value: function clear(rowIndex) {
      var columnIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      var key = this._keyMapper(rowIndex, columnIndex);
      delete this._cellHeightCache[key];
      delete this._cellWidthCache[key];
      this._updateCachedColumnAndRowSizes(rowIndex, columnIndex);
    }
  }, {
    key: "clearAll",
    value: function clearAll() {
      this._cellHeightCache = {};
      this._cellWidthCache = {};
      this._columnWidthCache = {};
      this._rowHeightCache = {};
      this._rowCount = 0;
      this._columnCount = 0;
    }
  }, {
    key: "defaultHeight",
    get: function get5() {
      return this._defaultHeight;
    }
  }, {
    key: "defaultWidth",
    get: function get5() {
      return this._defaultWidth;
    }
  }, {
    key: "hasFixedHeight",
    value: function hasFixedHeight() {
      return this._hasFixedHeight;
    }
  }, {
    key: "hasFixedWidth",
    value: function hasFixedWidth() {
      return this._hasFixedWidth;
    }
  }, {
    key: "getHeight",
    value: function getHeight4(rowIndex) {
      var columnIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      if (this._hasFixedHeight) {
        return this._defaultHeight;
      } else {
        var _key = this._keyMapper(rowIndex, columnIndex);
        return this._cellHeightCache[_key] !== void 0 ? Math.max(this._minHeight, this._cellHeightCache[_key]) : this._defaultHeight;
      }
    }
  }, {
    key: "getWidth",
    value: function getWidth3(rowIndex) {
      var columnIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      if (this._hasFixedWidth) {
        return this._defaultWidth;
      } else {
        var _key2 = this._keyMapper(rowIndex, columnIndex);
        return this._cellWidthCache[_key2] !== void 0 ? Math.max(this._minWidth, this._cellWidthCache[_key2]) : this._defaultWidth;
      }
    }
  }, {
    key: "has",
    value: function has2(rowIndex) {
      var columnIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      var key = this._keyMapper(rowIndex, columnIndex);
      return this._cellHeightCache[key] !== void 0;
    }
  }, {
    key: "set",
    value: function set2(rowIndex, columnIndex, width, height) {
      var key = this._keyMapper(rowIndex, columnIndex);
      if (columnIndex >= this._columnCount) {
        this._columnCount = columnIndex + 1;
      }
      if (rowIndex >= this._rowCount) {
        this._rowCount = rowIndex + 1;
      }
      this._cellHeightCache[key] = height;
      this._cellWidthCache[key] = width;
      this._updateCachedColumnAndRowSizes(rowIndex, columnIndex);
    }
  }, {
    key: "_updateCachedColumnAndRowSizes",
    value: function _updateCachedColumnAndRowSizes(rowIndex, columnIndex) {
      if (!this._hasFixedWidth) {
        var columnWidth = 0;
        for (var i2 = 0; i2 < this._rowCount; i2++) {
          columnWidth = Math.max(columnWidth, this.getWidth(i2, columnIndex));
        }
        var columnKey = this._keyMapper(0, columnIndex);
        this._columnWidthCache[columnKey] = columnWidth;
      }
      if (!this._hasFixedHeight) {
        var rowHeight = 0;
        for (var _i = 0; _i < this._columnCount; _i++) {
          rowHeight = Math.max(rowHeight, this.getHeight(rowIndex, _i));
        }
        var rowKey = this._keyMapper(rowIndex, 0);
        this._rowHeightCache[rowKey] = rowHeight;
      }
    }
  }]);
}();
function defaultKeyMapper(rowIndex, columnIndex) {
  return "".concat(rowIndex, "-").concat(columnIndex);
}
function r$2(e2) {
  var t2, f2, n2 = "";
  if ("string" == typeof e2 || "number" == typeof e2)
    n2 += e2;
  else if ("object" == typeof e2)
    if (Array.isArray(e2))
      for (t2 = 0; t2 < e2.length; t2++)
        e2[t2] && (f2 = r$2(e2[t2])) && (n2 && (n2 += " "), n2 += f2);
    else
      for (t2 in e2)
        e2[t2] && (n2 && (n2 += " "), n2 += t2);
  return n2;
}
function clsx() {
  for (var e2, t2, f2 = 0, n2 = ""; f2 < arguments.length; )
    (e2 = arguments[f2++]) && (t2 = r$2(e2)) && (n2 && (n2 += " "), n2 += t2);
  return n2;
}
function createCallbackMemoizer() {
  var requireAllKeys = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
  var cachedIndices = {};
  return function(_ref) {
    var callback2 = _ref.callback, indices = _ref.indices;
    var keys2 = Object.keys(indices);
    var allInitialized = !requireAllKeys || keys2.every(function(key) {
      var value2 = indices[key];
      return Array.isArray(value2) ? value2.length > 0 : value2 >= 0;
    });
    var indexChanged = keys2.length !== Object.keys(cachedIndices).length || keys2.some(function(key) {
      var cachedValue = cachedIndices[key];
      var value2 = indices[key];
      return Array.isArray(value2) ? cachedValue.join(",") !== value2.join(",") : cachedValue !== value2;
    });
    cachedIndices = indices;
    if (allInitialized && indexChanged) {
      callback2(indices);
    }
  };
}
const canUseDOM$1 = !!(typeof window !== "undefined" && window.document && window.document.createElement);
var size;
function scrollbarSize(recalc) {
  if (!size && size !== 0 || recalc) {
    if (canUseDOM$1) {
      var scrollDiv = document.createElement("div");
      scrollDiv.style.position = "absolute";
      scrollDiv.style.top = "-9999px";
      scrollDiv.style.width = "50px";
      scrollDiv.style.height = "50px";
      scrollDiv.style.overflow = "scroll";
      document.body.appendChild(scrollDiv);
      size = scrollDiv.offsetWidth - scrollDiv.clientWidth;
      document.body.removeChild(scrollDiv);
    }
  }
  return size;
}
function ownKeys$7(e2, r2) {
  var t2 = Object.keys(e2);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e2);
    r2 && (o2 = o2.filter(function(r22) {
      return Object.getOwnPropertyDescriptor(e2, r22).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread$8(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys$7(Object(t2), true).forEach(function(r22) {
      _defineProperty$3(e2, r22, t2[r22]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$7(Object(t2)).forEach(function(r22) {
      Object.defineProperty(e2, r22, Object.getOwnPropertyDescriptor(t2, r22));
    });
  }
  return e2;
}
function _callSuper$b(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$b() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$b() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t22) {
  }
  return (_isNativeReflectConstruct$b = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var IS_SCROLLING_TIMEOUT$1 = 150;
var SCROLL_POSITION_CHANGE_REASONS$1 = {
  OBSERVED: "observed",
  REQUESTED: "requested"
};
var CollectionView = /* @__PURE__ */ function(_React$PureComponent) {
  function CollectionView2() {
    var _this;
    _classCallCheck$a(this, CollectionView2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _callSuper$b(this, CollectionView2, [].concat(args));
    _defineProperty$3(_this, "state", {
      isScrolling: false,
      scrollLeft: 0,
      scrollTop: 0
    });
    _defineProperty$3(_this, "_calculateSizeAndPositionDataOnNextUpdate", false);
    _defineProperty$3(_this, "_onSectionRenderedMemoizer", createCallbackMemoizer());
    _defineProperty$3(_this, "_onScrollMemoizer", createCallbackMemoizer(false));
    _defineProperty$3(_this, "_invokeOnSectionRenderedHelper", function() {
      var _this$props = _this.props, cellLayoutManager = _this$props.cellLayoutManager, onSectionRendered22 = _this$props.onSectionRendered;
      _this._onSectionRenderedMemoizer({
        callback: onSectionRendered22,
        indices: {
          indices: cellLayoutManager.getLastRenderedIndices()
        }
      });
    });
    _defineProperty$3(_this, "_setScrollingContainerRef", function(ref) {
      _this._scrollingContainer = ref;
    });
    _defineProperty$3(_this, "_updateScrollPositionForScrollToCell", function() {
      var _this$props2 = _this.props, cellLayoutManager = _this$props2.cellLayoutManager, height = _this$props2.height, scrollToAlignment = _this$props2.scrollToAlignment, scrollToCell = _this$props2.scrollToCell, width = _this$props2.width;
      var _this$state = _this.state, scrollLeft = _this$state.scrollLeft, scrollTop = _this$state.scrollTop;
      if (scrollToCell >= 0) {
        var scrollPosition = cellLayoutManager.getScrollPositionForCell({
          align: scrollToAlignment,
          cellIndex: scrollToCell,
          height,
          scrollLeft,
          scrollTop,
          width
        });
        if (scrollPosition.scrollLeft !== scrollLeft || scrollPosition.scrollTop !== scrollTop) {
          _this._setScrollPosition(scrollPosition);
        }
      }
    });
    _defineProperty$3(_this, "_onScroll", function(event) {
      if (event.target !== _this._scrollingContainer) {
        return;
      }
      _this._enablePointerEventsAfterDelay();
      var _this$props3 = _this.props, cellLayoutManager = _this$props3.cellLayoutManager, height = _this$props3.height, isScrollingChange = _this$props3.isScrollingChange, width = _this$props3.width;
      var scrollbarSize2 = _this._scrollbarSize;
      var _cellLayoutManager$ge = cellLayoutManager.getTotalSize(), totalHeight = _cellLayoutManager$ge.height, totalWidth = _cellLayoutManager$ge.width;
      var scrollLeft = Math.max(0, Math.min(totalWidth - width + scrollbarSize2, event.target.scrollLeft));
      var scrollTop = Math.max(0, Math.min(totalHeight - height + scrollbarSize2, event.target.scrollTop));
      if (_this.state.scrollLeft !== scrollLeft || _this.state.scrollTop !== scrollTop) {
        var scrollPositionChangeReason = event.cancelable ? SCROLL_POSITION_CHANGE_REASONS$1.OBSERVED : SCROLL_POSITION_CHANGE_REASONS$1.REQUESTED;
        if (!_this.state.isScrolling) {
          isScrollingChange(true);
        }
        _this.setState({
          isScrolling: true,
          scrollLeft,
          scrollPositionChangeReason,
          scrollTop
        });
      }
      _this._invokeOnScrollMemoizer({
        scrollLeft,
        scrollTop,
        totalWidth,
        totalHeight
      });
    });
    _this._scrollbarSize = scrollbarSize();
    if (_this._scrollbarSize === void 0) {
      _this._scrollbarSizeMeasured = false;
      _this._scrollbarSize = 0;
    } else {
      _this._scrollbarSizeMeasured = true;
    }
    return _this;
  }
  _inherits$a(CollectionView2, _React$PureComponent);
  return _createClass$8(CollectionView2, [{
    key: "recomputeCellSizesAndPositions",
    value: function recomputeCellSizesAndPositions() {
      this._calculateSizeAndPositionDataOnNextUpdate = true;
      this.forceUpdate();
    }
    /* ---------------------------- Component lifecycle methods ---------------------------- */
    /**
     * @private
     * This method updates scrollLeft/scrollTop in state for the following conditions:
     * 1) Empty content (0 rows or columns)
     * 2) New scroll props overriding the current state
     * 3) Cells-count or cells-size has changed, making previous scroll offsets invalid
     */
  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      var _this$props4 = this.props, cellLayoutManager = _this$props4.cellLayoutManager, scrollLeft = _this$props4.scrollLeft, scrollToCell = _this$props4.scrollToCell, scrollTop = _this$props4.scrollTop;
      if (!this._scrollbarSizeMeasured) {
        this._scrollbarSize = scrollbarSize();
        this._scrollbarSizeMeasured = true;
        this.setState({});
      }
      if (scrollToCell >= 0) {
        this._updateScrollPositionForScrollToCell();
      } else if (scrollLeft >= 0 || scrollTop >= 0) {
        this._setScrollPosition({
          scrollLeft,
          scrollTop
        });
      }
      this._invokeOnSectionRenderedHelper();
      var _cellLayoutManager$ge2 = cellLayoutManager.getTotalSize(), totalHeight = _cellLayoutManager$ge2.height, totalWidth = _cellLayoutManager$ge2.width;
      this._invokeOnScrollMemoizer({
        scrollLeft: scrollLeft || 0,
        scrollTop: scrollTop || 0,
        totalHeight,
        totalWidth
      });
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate(prevProps, prevState) {
      var _this$props5 = this.props, height = _this$props5.height, scrollToAlignment = _this$props5.scrollToAlignment, scrollToCell = _this$props5.scrollToCell, width = _this$props5.width;
      var _this$state2 = this.state, scrollLeft = _this$state2.scrollLeft, scrollPositionChangeReason = _this$state2.scrollPositionChangeReason, scrollTop = _this$state2.scrollTop;
      if (scrollPositionChangeReason === SCROLL_POSITION_CHANGE_REASONS$1.REQUESTED) {
        if (scrollLeft >= 0 && scrollLeft !== prevState.scrollLeft && scrollLeft !== this._scrollingContainer.scrollLeft) {
          this._scrollingContainer.scrollLeft = scrollLeft;
        }
        if (scrollTop >= 0 && scrollTop !== prevState.scrollTop && scrollTop !== this._scrollingContainer.scrollTop) {
          this._scrollingContainer.scrollTop = scrollTop;
        }
      }
      if (height !== prevProps.height || scrollToAlignment !== prevProps.scrollToAlignment || scrollToCell !== prevProps.scrollToCell || width !== prevProps.width) {
        this._updateScrollPositionForScrollToCell();
      }
      this._invokeOnSectionRenderedHelper();
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      if (this._disablePointerEventsTimeoutId) {
        clearTimeout(this._disablePointerEventsTimeoutId);
      }
    }
  }, {
    key: "render",
    value: function render3() {
      var _this$props6 = this.props, autoHeight = _this$props6.autoHeight, cellCount = _this$props6.cellCount, cellLayoutManager = _this$props6.cellLayoutManager, className = _this$props6.className, height = _this$props6.height, horizontalOverscanSize = _this$props6.horizontalOverscanSize, id2 = _this$props6.id, noContentRenderer2 = _this$props6.noContentRenderer, style2 = _this$props6.style, verticalOverscanSize = _this$props6.verticalOverscanSize, width = _this$props6.width;
      var _this$state3 = this.state, isScrolling = _this$state3.isScrolling, scrollLeft = _this$state3.scrollLeft, scrollTop = _this$state3.scrollTop;
      if (this._lastRenderedCellCount !== cellCount || this._lastRenderedCellLayoutManager !== cellLayoutManager || this._calculateSizeAndPositionDataOnNextUpdate) {
        this._lastRenderedCellCount = cellCount;
        this._lastRenderedCellLayoutManager = cellLayoutManager;
        this._calculateSizeAndPositionDataOnNextUpdate = false;
        cellLayoutManager.calculateSizeAndPositionData();
      }
      var _cellLayoutManager$ge3 = cellLayoutManager.getTotalSize(), totalHeight = _cellLayoutManager$ge3.height, totalWidth = _cellLayoutManager$ge3.width;
      var left2 = Math.max(0, scrollLeft - horizontalOverscanSize);
      var top2 = Math.max(0, scrollTop - verticalOverscanSize);
      var right = Math.min(totalWidth, scrollLeft + width + horizontalOverscanSize);
      var bottom2 = Math.min(totalHeight, scrollTop + height + verticalOverscanSize);
      var childrenToDisplay = height > 0 && width > 0 ? cellLayoutManager.cellRenderers({
        height: bottom2 - top2,
        isScrolling,
        width: right - left2,
        x: left2,
        y: top2
      }) : [];
      var collectionStyle = {
        boxSizing: "border-box",
        direction: "ltr",
        height: autoHeight ? "auto" : height,
        position: "relative",
        WebkitOverflowScrolling: "touch",
        width,
        willChange: "transform"
      };
      var verticalScrollBarSize = totalHeight > height ? this._scrollbarSize : 0;
      var horizontalScrollBarSize = totalWidth > width ? this._scrollbarSize : 0;
      collectionStyle.overflowX = totalWidth + verticalScrollBarSize <= width ? "hidden" : "auto";
      collectionStyle.overflowY = totalHeight + horizontalScrollBarSize <= height ? "hidden" : "auto";
      return /* @__PURE__ */ reactExports.createElement("div", {
        ref: this._setScrollingContainerRef,
        "aria-label": this.props["aria-label"],
        className: clsx("ReactVirtualized__Collection", className),
        id: id2,
        onScroll: this._onScroll,
        role: "grid",
        style: _objectSpread$8(_objectSpread$8({}, collectionStyle), style2),
        tabIndex: 0
      }, cellCount > 0 && /* @__PURE__ */ reactExports.createElement("div", {
        className: "ReactVirtualized__Collection__innerScrollContainer",
        style: {
          height: totalHeight,
          maxHeight: totalHeight,
          maxWidth: totalWidth,
          overflow: "hidden",
          pointerEvents: isScrolling ? "none" : "",
          width: totalWidth
        }
      }, childrenToDisplay), cellCount === 0 && noContentRenderer2());
    }
    /* ---------------------------- Helper methods ---------------------------- */
    /**
     * Sets an :isScrolling flag for a small window of time.
     * This flag is used to disable pointer events on the scrollable portion of the Collection.
     * This prevents jerky/stuttery mouse-wheel scrolling.
     */
  }, {
    key: "_enablePointerEventsAfterDelay",
    value: function _enablePointerEventsAfterDelay() {
      var _this2 = this;
      if (this._disablePointerEventsTimeoutId) {
        clearTimeout(this._disablePointerEventsTimeoutId);
      }
      this._disablePointerEventsTimeoutId = setTimeout(function() {
        var isScrollingChange = _this2.props.isScrollingChange;
        isScrollingChange(false);
        _this2._disablePointerEventsTimeoutId = null;
        _this2.setState({
          isScrolling: false
        });
      }, IS_SCROLLING_TIMEOUT$1);
    }
  }, {
    key: "_invokeOnScrollMemoizer",
    value: function _invokeOnScrollMemoizer(_ref) {
      var _this3 = this;
      var scrollLeft = _ref.scrollLeft, scrollTop = _ref.scrollTop, totalHeight = _ref.totalHeight, totalWidth = _ref.totalWidth;
      this._onScrollMemoizer({
        callback: function callback2(_ref2) {
          var scrollLeft2 = _ref2.scrollLeft, scrollTop2 = _ref2.scrollTop;
          var _this3$props = _this3.props, height = _this3$props.height, onScroll22 = _this3$props.onScroll, width = _this3$props.width;
          onScroll22({
            clientHeight: height,
            clientWidth: width,
            scrollHeight: totalHeight,
            scrollLeft: scrollLeft2,
            scrollTop: scrollTop2,
            scrollWidth: totalWidth
          });
        },
        indices: {
          scrollLeft,
          scrollTop
        }
      });
    }
  }, {
    key: "_setScrollPosition",
    value: function _setScrollPosition(_ref3) {
      var scrollLeft = _ref3.scrollLeft, scrollTop = _ref3.scrollTop;
      var newState = {
        scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS$1.REQUESTED
      };
      if (scrollLeft >= 0) {
        newState.scrollLeft = scrollLeft;
      }
      if (scrollTop >= 0) {
        newState.scrollTop = scrollTop;
      }
      if (scrollLeft >= 0 && scrollLeft !== this.state.scrollLeft || scrollTop >= 0 && scrollTop !== this.state.scrollTop) {
        this.setState(newState);
      }
    }
  }], [{
    key: "getDerivedStateFromProps",
    value: function getDerivedStateFromProps(nextProps, prevState) {
      if (nextProps.cellCount === 0 && (prevState.scrollLeft !== 0 || prevState.scrollTop !== 0)) {
        return {
          scrollLeft: 0,
          scrollTop: 0,
          scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS$1.REQUESTED
        };
      } else if (nextProps.scrollLeft !== prevState.scrollLeft || nextProps.scrollTop !== prevState.scrollTop) {
        return {
          scrollLeft: nextProps.scrollLeft != null ? nextProps.scrollLeft : prevState.scrollLeft,
          scrollTop: nextProps.scrollTop != null ? nextProps.scrollTop : prevState.scrollTop,
          scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS$1.REQUESTED
        };
      }
      return null;
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$3(CollectionView, "defaultProps", {
  "aria-label": "grid",
  horizontalOverscanSize: 0,
  noContentRenderer: function noContentRenderer() {
    return null;
  },
  onScroll: function onScroll() {
    return null;
  },
  onSectionRendered: function onSectionRendered() {
    return null;
  },
  scrollToAlignment: "auto",
  scrollToCell: -1,
  style: {},
  verticalOverscanSize: 0
});
CollectionView.propTypes = {};
polyfill2(CollectionView);
var Section = /* @__PURE__ */ function() {
  function Section2(_ref) {
    var height = _ref.height, width = _ref.width, x2 = _ref.x, y2 = _ref.y;
    _classCallCheck$a(this, Section2);
    this.height = height;
    this.width = width;
    this.x = x2;
    this.y = y2;
    this._indexMap = {};
    this._indices = [];
  }
  return _createClass$8(Section2, [{
    key: "addCellIndex",
    value: function addCellIndex(_ref2) {
      var index2 = _ref2.index;
      if (!this._indexMap[index2]) {
        this._indexMap[index2] = true;
        this._indices.push(index2);
      }
    }
    /** Get all cell indices that have been added to this section. */
  }, {
    key: "getCellIndices",
    value: function getCellIndices() {
      return this._indices;
    }
    /** Intended for debugger/test purposes only */
  }, {
    key: "toString",
    value: function toString4() {
      return "".concat(this.x, ",").concat(this.y, " ").concat(this.width, "x").concat(this.height);
    }
  }]);
}();
var SECTION_SIZE = 100;
var SectionManager = /* @__PURE__ */ function() {
  function SectionManager2() {
    var sectionSize = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : SECTION_SIZE;
    _classCallCheck$a(this, SectionManager2);
    this._sectionSize = sectionSize;
    this._cellMetadata = [];
    this._sections = {};
  }
  return _createClass$8(SectionManager2, [{
    key: "getCellIndices",
    value: function getCellIndices(_ref) {
      var height = _ref.height, width = _ref.width, x2 = _ref.x, y2 = _ref.y;
      var indices = {};
      this.getSections({
        height,
        width,
        x: x2,
        y: y2
      }).forEach(function(section) {
        return section.getCellIndices().forEach(function(index2) {
          indices[index2] = index2;
        });
      });
      return Object.keys(indices).map(function(index2) {
        return indices[index2];
      });
    }
    /** Get size and position information for the cell specified. */
  }, {
    key: "getCellMetadata",
    value: function getCellMetadata(_ref2) {
      var index2 = _ref2.index;
      return this._cellMetadata[index2];
    }
    /** Get all Sections overlapping the specified region. */
  }, {
    key: "getSections",
    value: function getSections(_ref3) {
      var height = _ref3.height, width = _ref3.width, x2 = _ref3.x, y2 = _ref3.y;
      var sectionXStart = Math.floor(x2 / this._sectionSize);
      var sectionXStop = Math.floor((x2 + width - 1) / this._sectionSize);
      var sectionYStart = Math.floor(y2 / this._sectionSize);
      var sectionYStop = Math.floor((y2 + height - 1) / this._sectionSize);
      var sections = [];
      for (var sectionX = sectionXStart; sectionX <= sectionXStop; sectionX++) {
        for (var sectionY = sectionYStart; sectionY <= sectionYStop; sectionY++) {
          var key = "".concat(sectionX, ".").concat(sectionY);
          if (!this._sections[key]) {
            this._sections[key] = new Section({
              height: this._sectionSize,
              width: this._sectionSize,
              x: sectionX * this._sectionSize,
              y: sectionY * this._sectionSize
            });
          }
          sections.push(this._sections[key]);
        }
      }
      return sections;
    }
    /** Total number of Sections based on the currently registered cells. */
  }, {
    key: "getTotalSectionCount",
    value: function getTotalSectionCount() {
      return Object.keys(this._sections).length;
    }
    /** Intended for debugger/test purposes only */
  }, {
    key: "toString",
    value: function toString4() {
      var _this = this;
      return Object.keys(this._sections).map(function(index2) {
        return _this._sections[index2].toString();
      });
    }
    /** Adds a cell to the appropriate Sections and registers it metadata for later retrievable. */
  }, {
    key: "registerCell",
    value: function registerCell(_ref4) {
      var cellMetadatum = _ref4.cellMetadatum, index2 = _ref4.index;
      this._cellMetadata[index2] = cellMetadatum;
      this.getSections(cellMetadatum).forEach(function(section) {
        return section.addCellIndex({
          index: index2
        });
      });
    }
  }]);
}();
function calculateSizeAndPositionData(_ref) {
  var cellCount = _ref.cellCount, cellSizeAndPositionGetter = _ref.cellSizeAndPositionGetter, sectionSize = _ref.sectionSize;
  var cellMetadata = [];
  var sectionManager = new SectionManager(sectionSize);
  var height = 0;
  var width = 0;
  for (var index2 = 0; index2 < cellCount; index2++) {
    var cellMetadatum = cellSizeAndPositionGetter({
      index: index2
    });
    if (cellMetadatum.height == null || isNaN(cellMetadatum.height) || cellMetadatum.width == null || isNaN(cellMetadatum.width) || cellMetadatum.x == null || isNaN(cellMetadatum.x) || cellMetadatum.y == null || isNaN(cellMetadatum.y)) {
      throw Error("Invalid metadata returned for cell ".concat(index2, ":\n        x:").concat(cellMetadatum.x, ", y:").concat(cellMetadatum.y, ", width:").concat(cellMetadatum.width, ", height:").concat(cellMetadatum.height));
    }
    height = Math.max(height, cellMetadatum.y + cellMetadatum.height);
    width = Math.max(width, cellMetadatum.x + cellMetadatum.width);
    cellMetadata[index2] = cellMetadatum;
    sectionManager.registerCell({
      cellMetadatum,
      index: index2
    });
  }
  return {
    cellMetadata,
    height,
    sectionManager,
    width
  };
}
function getUpdatedOffsetForIndex(_ref) {
  var _ref$align = _ref.align, align = _ref$align === void 0 ? "auto" : _ref$align, cellOffset = _ref.cellOffset, cellSize = _ref.cellSize, containerSize = _ref.containerSize, currentOffset = _ref.currentOffset;
  var maxOffset = cellOffset;
  var minOffset = maxOffset - containerSize + cellSize;
  switch (align) {
    case "start":
      return maxOffset;
    case "end":
      return minOffset;
    case "center":
      return maxOffset - (containerSize - cellSize) / 2;
    default:
      return Math.max(minOffset, Math.min(maxOffset, currentOffset));
  }
}
function _callSuper$a(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$a() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$a() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t22) {
  }
  return (_isNativeReflectConstruct$a = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var Collection$1 = /* @__PURE__ */ function(_React$PureComponent) {
  function Collection2(props, context) {
    var _this;
    _classCallCheck$a(this, Collection2);
    _this = _callSuper$a(this, Collection2, [props, context]);
    _this._cellMetadata = [];
    _this._lastRenderedCellIndices = [];
    _this._cellCache = [];
    _this._isScrollingChange = _this._isScrollingChange.bind(_this);
    _this._setCollectionViewRef = _this._setCollectionViewRef.bind(_this);
    return _this;
  }
  _inherits$a(Collection2, _React$PureComponent);
  return _createClass$8(Collection2, [{
    key: "forceUpdate",
    value: function forceUpdate() {
      if (this._collectionView !== void 0) {
        this._collectionView.forceUpdate();
      }
    }
    /** See Collection#recomputeCellSizesAndPositions */
  }, {
    key: "recomputeCellSizesAndPositions",
    value: function recomputeCellSizesAndPositions() {
      this._cellCache = [];
      this._collectionView.recomputeCellSizesAndPositions();
    }
    /** React lifecycle methods */
  }, {
    key: "render",
    value: function render3() {
      var props = _extends$h({}, (_objectDestructuringEmpty(this.props), this.props));
      return /* @__PURE__ */ reactExports.createElement(CollectionView, _extends$h({
        cellLayoutManager: this,
        isScrollingChange: this._isScrollingChange,
        ref: this._setCollectionViewRef
      }, props));
    }
    /** CellLayoutManager interface */
  }, {
    key: "calculateSizeAndPositionData",
    value: function calculateSizeAndPositionData$1() {
      var _this$props = this.props, cellCount = _this$props.cellCount, cellSizeAndPositionGetter = _this$props.cellSizeAndPositionGetter, sectionSize = _this$props.sectionSize;
      var data = calculateSizeAndPositionData({
        cellCount,
        cellSizeAndPositionGetter,
        sectionSize
      });
      this._cellMetadata = data.cellMetadata;
      this._sectionManager = data.sectionManager;
      this._height = data.height;
      this._width = data.width;
    }
    /**
     * Returns the most recently rendered set of cell indices.
     */
  }, {
    key: "getLastRenderedIndices",
    value: function getLastRenderedIndices() {
      return this._lastRenderedCellIndices;
    }
    /**
     * Calculates the minimum amount of change from the current scroll position to ensure the specified cell is (fully) visible.
     */
  }, {
    key: "getScrollPositionForCell",
    value: function getScrollPositionForCell(_ref) {
      var align = _ref.align, cellIndex = _ref.cellIndex, height = _ref.height, scrollLeft = _ref.scrollLeft, scrollTop = _ref.scrollTop, width = _ref.width;
      var cellCount = this.props.cellCount;
      if (cellIndex >= 0 && cellIndex < cellCount) {
        var cellMetadata = this._cellMetadata[cellIndex];
        scrollLeft = getUpdatedOffsetForIndex({
          align,
          cellOffset: cellMetadata.x,
          cellSize: cellMetadata.width,
          containerSize: width,
          currentOffset: scrollLeft
        });
        scrollTop = getUpdatedOffsetForIndex({
          align,
          cellOffset: cellMetadata.y,
          cellSize: cellMetadata.height,
          containerSize: height,
          currentOffset: scrollTop
        });
      }
      return {
        scrollLeft,
        scrollTop
      };
    }
  }, {
    key: "getTotalSize",
    value: function getTotalSize() {
      return {
        height: this._height,
        width: this._width
      };
    }
  }, {
    key: "cellRenderers",
    value: function cellRenderers(_ref2) {
      var _this2 = this;
      var height = _ref2.height, isScrolling = _ref2.isScrolling, width = _ref2.width, x2 = _ref2.x, y2 = _ref2.y;
      var _this$props2 = this.props, cellGroupRenderer = _this$props2.cellGroupRenderer, cellRenderer = _this$props2.cellRenderer;
      this._lastRenderedCellIndices = this._sectionManager.getCellIndices({
        height,
        width,
        x: x2,
        y: y2
      });
      return cellGroupRenderer({
        cellCache: this._cellCache,
        cellRenderer,
        cellSizeAndPositionGetter: function cellSizeAndPositionGetter(_ref3) {
          var index2 = _ref3.index;
          return _this2._sectionManager.getCellMetadata({
            index: index2
          });
        },
        indices: this._lastRenderedCellIndices,
        isScrolling
      });
    }
  }, {
    key: "_isScrollingChange",
    value: function _isScrollingChange(isScrolling) {
      if (!isScrolling) {
        this._cellCache = [];
      }
    }
  }, {
    key: "_setCollectionViewRef",
    value: function _setCollectionViewRef(ref) {
      this._collectionView = ref;
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$3(Collection$1, "defaultProps", {
  "aria-label": "grid",
  cellGroupRenderer: defaultCellGroupRenderer
});
Collection$1.propTypes = {};
function defaultCellGroupRenderer(_ref4) {
  var cellCache = _ref4.cellCache, cellRenderer = _ref4.cellRenderer, cellSizeAndPositionGetter = _ref4.cellSizeAndPositionGetter, indices = _ref4.indices, isScrolling = _ref4.isScrolling;
  return indices.map(function(index2) {
    var cellMetadata = cellSizeAndPositionGetter({
      index: index2
    });
    var cellRendererProps = {
      index: index2,
      isScrolling,
      key: index2,
      style: {
        height: cellMetadata.height,
        left: cellMetadata.x,
        position: "absolute",
        top: cellMetadata.y,
        width: cellMetadata.width
      }
    };
    if (isScrolling) {
      if (!(index2 in cellCache)) {
        cellCache[index2] = cellRenderer(cellRendererProps);
      }
      return cellCache[index2];
    } else {
      return cellRenderer(cellRendererProps);
    }
  }).filter(function(renderedCell) {
    return !!renderedCell;
  });
}
function _callSuper$9(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$9() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$9() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t22) {
  }
  return (_isNativeReflectConstruct$9 = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var ColumnSizer = /* @__PURE__ */ function(_React$PureComponent) {
  function ColumnSizer2(props, context) {
    var _this;
    _classCallCheck$a(this, ColumnSizer2);
    _this = _callSuper$9(this, ColumnSizer2, [props, context]);
    _this._registerChild = _this._registerChild.bind(_this);
    return _this;
  }
  _inherits$a(ColumnSizer2, _React$PureComponent);
  return _createClass$8(ColumnSizer2, [{
    key: "componentDidUpdate",
    value: function componentDidUpdate(prevProps) {
      var _this$props = this.props, columnMaxWidth = _this$props.columnMaxWidth, columnMinWidth = _this$props.columnMinWidth, columnCount = _this$props.columnCount, width = _this$props.width;
      if (columnMaxWidth !== prevProps.columnMaxWidth || columnMinWidth !== prevProps.columnMinWidth || columnCount !== prevProps.columnCount || width !== prevProps.width) {
        if (this._registeredChild) {
          this._registeredChild.recomputeGridSize();
        }
      }
    }
  }, {
    key: "render",
    value: function render3() {
      var _this$props2 = this.props, children = _this$props2.children, columnMaxWidth = _this$props2.columnMaxWidth, columnMinWidth = _this$props2.columnMinWidth, columnCount = _this$props2.columnCount, width = _this$props2.width;
      var safeColumnMinWidth = columnMinWidth || 1;
      var safeColumnMaxWidth = columnMaxWidth ? Math.min(columnMaxWidth, width) : width;
      var columnWidth = width / columnCount;
      columnWidth = Math.max(safeColumnMinWidth, columnWidth);
      columnWidth = Math.min(safeColumnMaxWidth, columnWidth);
      columnWidth = Math.floor(columnWidth);
      var adjustedWidth = Math.min(width, columnWidth * columnCount);
      return children({
        adjustedWidth,
        columnWidth,
        getColumnWidth: function getColumnWidth() {
          return columnWidth;
        },
        registerChild: this._registerChild
      });
    }
  }, {
    key: "_registerChild",
    value: function _registerChild(child) {
      if (child && typeof child.recomputeGridSize !== "function") {
        throw Error("Unexpected child type registered; only Grid/MultiGrid children are supported.");
      }
      this._registeredChild = child;
      if (this._registeredChild) {
        this._registeredChild.recomputeGridSize();
      }
    }
  }]);
}(reactExports.PureComponent);
ColumnSizer.propTypes = {};
function calculateSizeAndPositionDataAndUpdateScrollOffset(_ref) {
  var cellCount = _ref.cellCount, cellSize = _ref.cellSize, computeMetadataCallback = _ref.computeMetadataCallback, computeMetadataCallbackProps = _ref.computeMetadataCallbackProps, nextCellsCount = _ref.nextCellsCount, nextCellSize = _ref.nextCellSize, nextScrollToIndex = _ref.nextScrollToIndex, scrollToIndex = _ref.scrollToIndex, updateScrollOffsetForScrollToIndex = _ref.updateScrollOffsetForScrollToIndex;
  if (cellCount !== nextCellsCount || (typeof cellSize === "number" || typeof nextCellSize === "number") && cellSize !== nextCellSize) {
    computeMetadataCallback(computeMetadataCallbackProps);
    if (scrollToIndex >= 0 && scrollToIndex === nextScrollToIndex) {
      updateScrollOffsetForScrollToIndex();
    }
  }
}
var CellSizeAndPositionManager = /* @__PURE__ */ function() {
  function CellSizeAndPositionManager2(_ref) {
    var cellCount = _ref.cellCount, cellSizeGetter = _ref.cellSizeGetter, estimatedCellSize = _ref.estimatedCellSize;
    _classCallCheck$a(this, CellSizeAndPositionManager2);
    _defineProperty$3(this, "_cellSizeAndPositionData", {});
    _defineProperty$3(this, "_lastMeasuredIndex", -1);
    _defineProperty$3(this, "_lastBatchedIndex", -1);
    _defineProperty$3(this, "_cellCount", void 0);
    _defineProperty$3(this, "_cellSizeGetter", void 0);
    _defineProperty$3(this, "_estimatedCellSize", void 0);
    this._cellSizeGetter = cellSizeGetter;
    this._cellCount = cellCount;
    this._estimatedCellSize = estimatedCellSize;
  }
  return _createClass$8(CellSizeAndPositionManager2, [{
    key: "areOffsetsAdjusted",
    value: function areOffsetsAdjusted() {
      return false;
    }
  }, {
    key: "configure",
    value: function configure2(_ref2) {
      var cellCount = _ref2.cellCount, estimatedCellSize = _ref2.estimatedCellSize, cellSizeGetter = _ref2.cellSizeGetter;
      this._cellCount = cellCount;
      this._estimatedCellSize = estimatedCellSize;
      this._cellSizeGetter = cellSizeGetter;
    }
  }, {
    key: "getCellCount",
    value: function getCellCount() {
      return this._cellCount;
    }
  }, {
    key: "getEstimatedCellSize",
    value: function getEstimatedCellSize() {
      return this._estimatedCellSize;
    }
  }, {
    key: "getLastMeasuredIndex",
    value: function getLastMeasuredIndex() {
      return this._lastMeasuredIndex;
    }
  }, {
    key: "getOffsetAdjustment",
    value: function getOffsetAdjustment() {
      return 0;
    }
    /**
     * This method returns the size and position for the cell at the specified index.
     * It just-in-time calculates (or used cached values) for cells leading up to the index.
     */
  }, {
    key: "getSizeAndPositionOfCell",
    value: function getSizeAndPositionOfCell(index2) {
      if (index2 < 0 || index2 >= this._cellCount) {
        throw Error("Requested index ".concat(index2, " is outside of range 0..").concat(this._cellCount));
      }
      if (index2 > this._lastMeasuredIndex) {
        var lastMeasuredCellSizeAndPosition = this.getSizeAndPositionOfLastMeasuredCell();
        var offset2 = lastMeasuredCellSizeAndPosition.offset + lastMeasuredCellSizeAndPosition.size;
        for (var i2 = this._lastMeasuredIndex + 1; i2 <= index2; i2++) {
          var size2 = this._cellSizeGetter({
            index: i2
          });
          if (size2 === void 0 || isNaN(size2)) {
            throw Error("Invalid size returned for cell ".concat(i2, " of value ").concat(size2));
          } else if (size2 === null) {
            this._cellSizeAndPositionData[i2] = {
              offset: offset2,
              size: 0
            };
            this._lastBatchedIndex = index2;
          } else {
            this._cellSizeAndPositionData[i2] = {
              offset: offset2,
              size: size2
            };
            offset2 += size2;
            this._lastMeasuredIndex = index2;
          }
        }
      }
      return this._cellSizeAndPositionData[index2];
    }
  }, {
    key: "getSizeAndPositionOfLastMeasuredCell",
    value: function getSizeAndPositionOfLastMeasuredCell() {
      return this._lastMeasuredIndex >= 0 ? this._cellSizeAndPositionData[this._lastMeasuredIndex] : {
        offset: 0,
        size: 0
      };
    }
    /**
     * Total size of all cells being measured.
     * This value will be completely estimated initially.
     * As cells are measured, the estimate will be updated.
     */
  }, {
    key: "getTotalSize",
    value: function getTotalSize() {
      var lastMeasuredCellSizeAndPosition = this.getSizeAndPositionOfLastMeasuredCell();
      var totalSizeOfMeasuredCells = lastMeasuredCellSizeAndPosition.offset + lastMeasuredCellSizeAndPosition.size;
      var numUnmeasuredCells = this._cellCount - this._lastMeasuredIndex - 1;
      var totalSizeOfUnmeasuredCells = numUnmeasuredCells * this._estimatedCellSize;
      return totalSizeOfMeasuredCells + totalSizeOfUnmeasuredCells;
    }
    /**
     * Determines a new offset that ensures a certain cell is visible, given the current offset.
     * If the cell is already visible then the current offset will be returned.
     * If the current offset is too great or small, it will be adjusted just enough to ensure the specified index is visible.
     *
     * @param align Desired alignment within container; one of "auto" (default), "start", or "end"
     * @param containerSize Size (width or height) of the container viewport
     * @param currentOffset Container's current (x or y) offset
     * @param totalSize Total size (width or height) of all cells
     * @return Offset to use to ensure the specified cell is visible
     */
  }, {
    key: "getUpdatedOffsetForIndex",
    value: function getUpdatedOffsetForIndex2(_ref3) {
      var _ref3$align = _ref3.align, align = _ref3$align === void 0 ? "auto" : _ref3$align, containerSize = _ref3.containerSize, currentOffset = _ref3.currentOffset, targetIndex = _ref3.targetIndex;
      if (containerSize <= 0) {
        return 0;
      }
      var datum = this.getSizeAndPositionOfCell(targetIndex);
      var maxOffset = datum.offset;
      var minOffset = maxOffset - containerSize + datum.size;
      var idealOffset;
      switch (align) {
        case "start":
          idealOffset = maxOffset;
          break;
        case "end":
          idealOffset = minOffset;
          break;
        case "center":
          idealOffset = maxOffset - (containerSize - datum.size) / 2;
          break;
        default:
          idealOffset = Math.max(minOffset, Math.min(maxOffset, currentOffset));
          break;
      }
      var totalSize = this.getTotalSize();
      return Math.max(0, Math.min(totalSize - containerSize, idealOffset));
    }
  }, {
    key: "getVisibleCellRange",
    value: function getVisibleCellRange(params) {
      var containerSize = params.containerSize, offset2 = params.offset;
      var totalSize = this.getTotalSize();
      if (totalSize === 0) {
        return {};
      }
      var maxOffset = offset2 + containerSize;
      var start2 = this._findNearestCell(offset2);
      var datum = this.getSizeAndPositionOfCell(start2);
      offset2 = datum.offset + datum.size;
      var stop = start2;
      while (offset2 < maxOffset && stop < this._cellCount - 1) {
        stop++;
        offset2 += this.getSizeAndPositionOfCell(stop).size;
      }
      return {
        start: start2,
        stop
      };
    }
    /**
     * Clear all cached values for cells after the specified index.
     * This method should be called for any cell that has changed its size.
     * It will not immediately perform any calculations; they'll be performed the next time getSizeAndPositionOfCell() is called.
     */
  }, {
    key: "resetCell",
    value: function resetCell(index2) {
      this._lastMeasuredIndex = Math.min(this._lastMeasuredIndex, index2 - 1);
    }
  }, {
    key: "_binarySearch",
    value: function _binarySearch(high, low, offset2) {
      while (low <= high) {
        var middle = low + Math.floor((high - low) / 2);
        var currentOffset = this.getSizeAndPositionOfCell(middle).offset;
        if (currentOffset === offset2) {
          return middle;
        } else if (currentOffset < offset2) {
          low = middle + 1;
        } else if (currentOffset > offset2) {
          high = middle - 1;
        }
      }
      if (low > 0) {
        return low - 1;
      } else {
        return 0;
      }
    }
  }, {
    key: "_exponentialSearch",
    value: function _exponentialSearch(index2, offset2) {
      var interval = 1;
      while (index2 < this._cellCount && this.getSizeAndPositionOfCell(index2).offset < offset2) {
        index2 += interval;
        interval *= 2;
      }
      return this._binarySearch(Math.min(index2, this._cellCount - 1), Math.floor(index2 / 2), offset2);
    }
    /**
     * Searches for the cell (index) nearest the specified offset.
     *
     * If no exact match is found the next lowest cell index will be returned.
     * This allows partially visible cells (with offsets just before/above the fold) to be visible.
     */
  }, {
    key: "_findNearestCell",
    value: function _findNearestCell(offset2) {
      if (isNaN(offset2)) {
        throw Error("Invalid offset ".concat(offset2, " specified"));
      }
      offset2 = Math.max(0, offset2);
      var lastMeasuredCellSizeAndPosition = this.getSizeAndPositionOfLastMeasuredCell();
      var lastMeasuredIndex = Math.max(0, this._lastMeasuredIndex);
      if (lastMeasuredCellSizeAndPosition.offset >= offset2) {
        return this._binarySearch(lastMeasuredIndex, 0, offset2);
      } else {
        return this._exponentialSearch(lastMeasuredIndex, offset2);
      }
    }
  }]);
}();
var DEFAULT_MAX_ELEMENT_SIZE = 15e5;
var CHROME_MAX_ELEMENT_SIZE = 16777100;
var isBrowser = function isBrowser2() {
  return typeof window !== "undefined";
};
var isChrome = function isChrome2() {
  return !!window.chrome;
};
var getMaxElementSize = function getMaxElementSize2() {
  if (isBrowser()) {
    if (isChrome()) {
      return CHROME_MAX_ELEMENT_SIZE;
    }
  }
  return DEFAULT_MAX_ELEMENT_SIZE;
};
var _excluded$5 = ["maxScrollSize"];
var ScalingCellSizeAndPositionManager = /* @__PURE__ */ function() {
  function ScalingCellSizeAndPositionManager2(_ref) {
    var _ref$maxScrollSize = _ref.maxScrollSize, maxScrollSize = _ref$maxScrollSize === void 0 ? getMaxElementSize() : _ref$maxScrollSize, params = _objectWithoutProperties$3(_ref, _excluded$5);
    _classCallCheck$a(this, ScalingCellSizeAndPositionManager2);
    _defineProperty$3(this, "_cellSizeAndPositionManager", void 0);
    _defineProperty$3(this, "_maxScrollSize", void 0);
    this._cellSizeAndPositionManager = new CellSizeAndPositionManager(params);
    this._maxScrollSize = maxScrollSize;
  }
  return _createClass$8(ScalingCellSizeAndPositionManager2, [{
    key: "areOffsetsAdjusted",
    value: function areOffsetsAdjusted() {
      return this._cellSizeAndPositionManager.getTotalSize() > this._maxScrollSize;
    }
  }, {
    key: "configure",
    value: function configure2(params) {
      this._cellSizeAndPositionManager.configure(params);
    }
  }, {
    key: "getCellCount",
    value: function getCellCount() {
      return this._cellSizeAndPositionManager.getCellCount();
    }
  }, {
    key: "getEstimatedCellSize",
    value: function getEstimatedCellSize() {
      return this._cellSizeAndPositionManager.getEstimatedCellSize();
    }
  }, {
    key: "getLastMeasuredIndex",
    value: function getLastMeasuredIndex() {
      return this._cellSizeAndPositionManager.getLastMeasuredIndex();
    }
    /**
     * Number of pixels a cell at the given position (offset) should be shifted in order to fit within the scaled container.
     * The offset passed to this function is scaled (safe) as well.
     */
  }, {
    key: "getOffsetAdjustment",
    value: function getOffsetAdjustment(_ref2) {
      var containerSize = _ref2.containerSize, offset2 = _ref2.offset;
      var totalSize = this._cellSizeAndPositionManager.getTotalSize();
      var safeTotalSize = this.getTotalSize();
      var offsetPercentage = this._getOffsetPercentage({
        containerSize,
        offset: offset2,
        totalSize: safeTotalSize
      });
      return Math.round(offsetPercentage * (safeTotalSize - totalSize));
    }
  }, {
    key: "getSizeAndPositionOfCell",
    value: function getSizeAndPositionOfCell(index2) {
      return this._cellSizeAndPositionManager.getSizeAndPositionOfCell(index2);
    }
  }, {
    key: "getSizeAndPositionOfLastMeasuredCell",
    value: function getSizeAndPositionOfLastMeasuredCell() {
      return this._cellSizeAndPositionManager.getSizeAndPositionOfLastMeasuredCell();
    }
    /** See CellSizeAndPositionManager#getTotalSize */
  }, {
    key: "getTotalSize",
    value: function getTotalSize() {
      return Math.min(this._maxScrollSize, this._cellSizeAndPositionManager.getTotalSize());
    }
    /** See CellSizeAndPositionManager#getUpdatedOffsetForIndex */
  }, {
    key: "getUpdatedOffsetForIndex",
    value: function getUpdatedOffsetForIndex2(_ref3) {
      var _ref3$align = _ref3.align, align = _ref3$align === void 0 ? "auto" : _ref3$align, containerSize = _ref3.containerSize, currentOffset = _ref3.currentOffset, targetIndex = _ref3.targetIndex;
      currentOffset = this._safeOffsetToOffset({
        containerSize,
        offset: currentOffset
      });
      var offset2 = this._cellSizeAndPositionManager.getUpdatedOffsetForIndex({
        align,
        containerSize,
        currentOffset,
        targetIndex
      });
      return this._offsetToSafeOffset({
        containerSize,
        offset: offset2
      });
    }
    /** See CellSizeAndPositionManager#getVisibleCellRange */
  }, {
    key: "getVisibleCellRange",
    value: function getVisibleCellRange(_ref4) {
      var containerSize = _ref4.containerSize, offset2 = _ref4.offset;
      offset2 = this._safeOffsetToOffset({
        containerSize,
        offset: offset2
      });
      return this._cellSizeAndPositionManager.getVisibleCellRange({
        containerSize,
        offset: offset2
      });
    }
  }, {
    key: "resetCell",
    value: function resetCell(index2) {
      this._cellSizeAndPositionManager.resetCell(index2);
    }
  }, {
    key: "_getOffsetPercentage",
    value: function _getOffsetPercentage(_ref5) {
      var containerSize = _ref5.containerSize, offset2 = _ref5.offset, totalSize = _ref5.totalSize;
      return totalSize <= containerSize ? 0 : offset2 / (totalSize - containerSize);
    }
  }, {
    key: "_offsetToSafeOffset",
    value: function _offsetToSafeOffset(_ref6) {
      var containerSize = _ref6.containerSize, offset2 = _ref6.offset;
      var totalSize = this._cellSizeAndPositionManager.getTotalSize();
      var safeTotalSize = this.getTotalSize();
      if (totalSize === safeTotalSize) {
        return offset2;
      } else {
        var offsetPercentage = this._getOffsetPercentage({
          containerSize,
          offset: offset2,
          totalSize
        });
        return Math.round(offsetPercentage * (safeTotalSize - containerSize));
      }
    }
  }, {
    key: "_safeOffsetToOffset",
    value: function _safeOffsetToOffset(_ref7) {
      var containerSize = _ref7.containerSize, offset2 = _ref7.offset;
      var totalSize = this._cellSizeAndPositionManager.getTotalSize();
      var safeTotalSize = this.getTotalSize();
      if (totalSize === safeTotalSize) {
        return offset2;
      } else {
        var offsetPercentage = this._getOffsetPercentage({
          containerSize,
          offset: offset2,
          totalSize: safeTotalSize
        });
        return Math.round(offsetPercentage * (totalSize - containerSize));
      }
    }
  }]);
}();
var SCROLL_DIRECTION_BACKWARD = -1;
var SCROLL_DIRECTION_FORWARD$1 = 1;
function defaultOverscanIndicesGetter$1(_ref) {
  var cellCount = _ref.cellCount, overscanCellsCount = _ref.overscanCellsCount, scrollDirection = _ref.scrollDirection, startIndex = _ref.startIndex, stopIndex = _ref.stopIndex;
  if (scrollDirection === SCROLL_DIRECTION_FORWARD$1) {
    return {
      overscanStartIndex: Math.max(0, startIndex),
      overscanStopIndex: Math.min(cellCount - 1, stopIndex + overscanCellsCount)
    };
  } else {
    return {
      overscanStartIndex: Math.max(0, startIndex - overscanCellsCount),
      overscanStopIndex: Math.min(cellCount - 1, stopIndex)
    };
  }
}
function updateScrollIndexHelper(_ref) {
  var cellSize = _ref.cellSize, cellSizeAndPositionManager = _ref.cellSizeAndPositionManager, previousCellsCount = _ref.previousCellsCount, previousCellSize = _ref.previousCellSize, previousScrollToAlignment = _ref.previousScrollToAlignment, previousScrollToIndex = _ref.previousScrollToIndex, previousSize = _ref.previousSize, scrollOffset = _ref.scrollOffset, scrollToAlignment = _ref.scrollToAlignment, scrollToIndex = _ref.scrollToIndex, size2 = _ref.size, sizeJustIncreasedFromZero = _ref.sizeJustIncreasedFromZero, updateScrollIndexCallback = _ref.updateScrollIndexCallback;
  var cellCount = cellSizeAndPositionManager.getCellCount();
  var hasScrollToIndex = scrollToIndex >= 0 && scrollToIndex < cellCount;
  var sizeHasChanged = size2 !== previousSize || sizeJustIncreasedFromZero || !previousCellSize || typeof cellSize === "number" && cellSize !== previousCellSize;
  if (hasScrollToIndex && (sizeHasChanged || scrollToAlignment !== previousScrollToAlignment || scrollToIndex !== previousScrollToIndex)) {
    updateScrollIndexCallback(scrollToIndex);
  } else if (!hasScrollToIndex && cellCount > 0 && (size2 < previousSize || cellCount < previousCellsCount)) {
    if (scrollOffset > cellSizeAndPositionManager.getTotalSize() - size2) {
      updateScrollIndexCallback(cellCount - 1);
    }
  }
}
function defaultCellRangeRenderer(_ref) {
  var cellCache = _ref.cellCache, cellRenderer = _ref.cellRenderer, columnSizeAndPositionManager = _ref.columnSizeAndPositionManager, columnStartIndex = _ref.columnStartIndex, columnStopIndex = _ref.columnStopIndex, deferredMeasurementCache = _ref.deferredMeasurementCache, horizontalOffsetAdjustment = _ref.horizontalOffsetAdjustment, isScrolling = _ref.isScrolling, isScrollingOptOut = _ref.isScrollingOptOut, parent = _ref.parent, rowSizeAndPositionManager = _ref.rowSizeAndPositionManager, rowStartIndex = _ref.rowStartIndex, rowStopIndex = _ref.rowStopIndex, styleCache = _ref.styleCache, verticalOffsetAdjustment = _ref.verticalOffsetAdjustment, visibleColumnIndices = _ref.visibleColumnIndices, visibleRowIndices = _ref.visibleRowIndices;
  var renderedCells = [];
  var areOffsetsAdjusted = columnSizeAndPositionManager.areOffsetsAdjusted() || rowSizeAndPositionManager.areOffsetsAdjusted();
  var canCacheStyle = !isScrolling && !areOffsetsAdjusted;
  for (var rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {
    var rowDatum = rowSizeAndPositionManager.getSizeAndPositionOfCell(rowIndex);
    for (var columnIndex = columnStartIndex; columnIndex <= columnStopIndex; columnIndex++) {
      var columnDatum = columnSizeAndPositionManager.getSizeAndPositionOfCell(columnIndex);
      var isVisible2 = columnIndex >= visibleColumnIndices.start && columnIndex <= visibleColumnIndices.stop && rowIndex >= visibleRowIndices.start && rowIndex <= visibleRowIndices.stop;
      var key = "".concat(rowIndex, "-").concat(columnIndex);
      var style2 = void 0;
      if (canCacheStyle && styleCache[key]) {
        style2 = styleCache[key];
      } else {
        if (deferredMeasurementCache && !deferredMeasurementCache.has(rowIndex, columnIndex)) {
          style2 = {
            height: "auto",
            left: 0,
            position: "absolute",
            top: 0,
            width: "auto"
          };
        } else {
          style2 = {
            height: rowDatum.size,
            left: columnDatum.offset + horizontalOffsetAdjustment,
            position: "absolute",
            top: rowDatum.offset + verticalOffsetAdjustment,
            width: columnDatum.size
          };
          styleCache[key] = style2;
        }
      }
      var cellRendererParams = {
        columnIndex,
        isScrolling,
        isVisible: isVisible2,
        key,
        parent,
        rowIndex,
        style: style2
      };
      var renderedCell = void 0;
      if ((isScrollingOptOut || isScrolling) && !horizontalOffsetAdjustment && !verticalOffsetAdjustment) {
        if (!cellCache[key]) {
          cellCache[key] = cellRenderer(cellRendererParams);
        }
        renderedCell = cellCache[key];
      } else {
        renderedCell = cellRenderer(cellRendererParams);
      }
      if (renderedCell == null || renderedCell === false) {
        continue;
      }
      if (!renderedCell.props.role) {
        renderedCell = /* @__PURE__ */ React$5.cloneElement(renderedCell, {
          role: "gridcell"
        });
      }
      renderedCells.push(renderedCell);
    }
  }
  return renderedCells;
}
var win;
if (typeof window !== "undefined") {
  win = window;
} else if (typeof self !== "undefined") {
  win = self;
} else {
  win = {};
}
var request = win.requestAnimationFrame || win.webkitRequestAnimationFrame || win.mozRequestAnimationFrame || win.oRequestAnimationFrame || win.msRequestAnimationFrame || function(callback2) {
  return win.setTimeout(callback2, 1e3 / 60);
};
var cancel = win.cancelAnimationFrame || win.webkitCancelAnimationFrame || win.mozCancelAnimationFrame || win.oCancelAnimationFrame || win.msCancelAnimationFrame || function(id2) {
  win.clearTimeout(id2);
};
var raf = request;
var caf = cancel;
var cancelAnimationTimeout = function cancelAnimationTimeout2(frame2) {
  return caf(frame2.id);
};
var requestAnimationTimeout = function requestAnimationTimeout2(callback2, delay2) {
  var start2;
  Promise.resolve().then(function() {
    start2 = Date.now();
  });
  var _timeout = function timeout() {
    if (Date.now() - start2 >= delay2) {
      callback2.call();
    } else {
      frame2.id = raf(_timeout);
    }
  };
  var frame2 = {
    id: raf(_timeout)
  };
  return frame2;
};
function ownKeys$6(e2, r2) {
  var t2 = Object.keys(e2);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e2);
    r2 && (o2 = o2.filter(function(r3) {
      return Object.getOwnPropertyDescriptor(e2, r3).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread$7(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys$6(Object(t2), true).forEach(function(r3) {
      _defineProperty$3(e2, r3, t2[r3]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$6(Object(t2)).forEach(function(r3) {
      Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3));
    });
  }
  return e2;
}
function _callSuper$8(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$8() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$8() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t3) {
  }
  return (_isNativeReflectConstruct$8 = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var DEFAULT_SCROLLING_RESET_TIME_INTERVAL$1 = 150;
var SCROLL_POSITION_CHANGE_REASONS = {
  OBSERVED: "observed",
  REQUESTED: "requested"
};
var renderNull = function renderNull2() {
  return null;
};
var Grid = /* @__PURE__ */ function(_React$PureComponent) {
  function Grid2(props) {
    var _this;
    _classCallCheck$a(this, Grid2);
    _this = _callSuper$8(this, Grid2, [props]);
    _defineProperty$3(_this, "_onGridRenderedMemoizer", createCallbackMemoizer());
    _defineProperty$3(_this, "_onScrollMemoizer", createCallbackMemoizer(false));
    _defineProperty$3(_this, "_deferredInvalidateColumnIndex", null);
    _defineProperty$3(_this, "_deferredInvalidateRowIndex", null);
    _defineProperty$3(_this, "_recomputeScrollLeftFlag", false);
    _defineProperty$3(_this, "_recomputeScrollTopFlag", false);
    _defineProperty$3(_this, "_horizontalScrollBarSize", 0);
    _defineProperty$3(_this, "_verticalScrollBarSize", 0);
    _defineProperty$3(_this, "_scrollbarPresenceChanged", false);
    _defineProperty$3(_this, "_scrollingContainer", void 0);
    _defineProperty$3(_this, "_childrenToDisplay", void 0);
    _defineProperty$3(_this, "_columnStartIndex", void 0);
    _defineProperty$3(_this, "_columnStopIndex", void 0);
    _defineProperty$3(_this, "_rowStartIndex", void 0);
    _defineProperty$3(_this, "_rowStopIndex", void 0);
    _defineProperty$3(_this, "_renderedColumnStartIndex", 0);
    _defineProperty$3(_this, "_renderedColumnStopIndex", 0);
    _defineProperty$3(_this, "_renderedRowStartIndex", 0);
    _defineProperty$3(_this, "_renderedRowStopIndex", 0);
    _defineProperty$3(_this, "_initialScrollTop", void 0);
    _defineProperty$3(_this, "_initialScrollLeft", void 0);
    _defineProperty$3(_this, "_disablePointerEventsTimeoutId", void 0);
    _defineProperty$3(_this, "_styleCache", {});
    _defineProperty$3(_this, "_cellCache", {});
    _defineProperty$3(_this, "_debounceScrollEndedCallback", function() {
      _this._disablePointerEventsTimeoutId = null;
      _this.setState({
        isScrolling: false,
        needToResetStyleCache: false
      });
    });
    _defineProperty$3(_this, "_invokeOnGridRenderedHelper", function() {
      var onSectionRendered3 = _this.props.onSectionRendered;
      _this._onGridRenderedMemoizer({
        callback: onSectionRendered3,
        indices: {
          columnOverscanStartIndex: _this._columnStartIndex,
          columnOverscanStopIndex: _this._columnStopIndex,
          columnStartIndex: _this._renderedColumnStartIndex,
          columnStopIndex: _this._renderedColumnStopIndex,
          rowOverscanStartIndex: _this._rowStartIndex,
          rowOverscanStopIndex: _this._rowStopIndex,
          rowStartIndex: _this._renderedRowStartIndex,
          rowStopIndex: _this._renderedRowStopIndex
        }
      });
    });
    _defineProperty$3(_this, "_setScrollingContainerRef", function(ref) {
      _this._scrollingContainer = ref;
      if (typeof _this.props.elementRef === "function") {
        _this.props.elementRef(ref);
      } else if (_typeof$1(_this.props.elementRef) === "object") {
        _this.props.elementRef.current = ref;
      }
    });
    _defineProperty$3(_this, "_onScroll", function(event) {
      if (event.target === _this._scrollingContainer) {
        _this.handleScrollEvent(event.target);
      }
    });
    var columnSizeAndPositionManager = new ScalingCellSizeAndPositionManager({
      cellCount: props.columnCount,
      cellSizeGetter: function cellSizeGetter(params) {
        return Grid2._wrapSizeGetter(props.columnWidth)(params);
      },
      estimatedCellSize: Grid2._getEstimatedColumnSize(props)
    });
    var rowSizeAndPositionManager = new ScalingCellSizeAndPositionManager({
      cellCount: props.rowCount,
      cellSizeGetter: function cellSizeGetter(params) {
        return Grid2._wrapSizeGetter(props.rowHeight)(params);
      },
      estimatedCellSize: Grid2._getEstimatedRowSize(props)
    });
    _this.state = {
      instanceProps: {
        columnSizeAndPositionManager,
        rowSizeAndPositionManager,
        prevColumnWidth: props.columnWidth,
        prevRowHeight: props.rowHeight,
        prevColumnCount: props.columnCount,
        prevRowCount: props.rowCount,
        prevIsScrolling: props.isScrolling === true,
        prevScrollToColumn: props.scrollToColumn,
        prevScrollToRow: props.scrollToRow,
        scrollbarSize: 0,
        scrollbarSizeMeasured: false
      },
      isScrolling: false,
      scrollDirectionHorizontal: SCROLL_DIRECTION_FORWARD$1,
      scrollDirectionVertical: SCROLL_DIRECTION_FORWARD$1,
      scrollLeft: 0,
      scrollTop: 0,
      scrollPositionChangeReason: null,
      needToResetStyleCache: false
    };
    if (props.scrollToRow > 0) {
      _this._initialScrollTop = _this._getCalculatedScrollTop(props, _this.state);
    }
    if (props.scrollToColumn > 0) {
      _this._initialScrollLeft = _this._getCalculatedScrollLeft(props, _this.state);
    }
    return _this;
  }
  _inherits$a(Grid2, _React$PureComponent);
  return _createClass$8(Grid2, [{
    key: "getOffsetForCell",
    value: function getOffsetForCell() {
      var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref$alignment = _ref.alignment, alignment = _ref$alignment === void 0 ? this.props.scrollToAlignment : _ref$alignment, _ref$columnIndex = _ref.columnIndex, columnIndex = _ref$columnIndex === void 0 ? this.props.scrollToColumn : _ref$columnIndex, _ref$rowIndex = _ref.rowIndex, rowIndex = _ref$rowIndex === void 0 ? this.props.scrollToRow : _ref$rowIndex;
      var offsetProps = _objectSpread$7(_objectSpread$7({}, this.props), {}, {
        scrollToAlignment: alignment,
        scrollToColumn: columnIndex,
        scrollToRow: rowIndex
      });
      return {
        scrollLeft: this._getCalculatedScrollLeft(offsetProps),
        scrollTop: this._getCalculatedScrollTop(offsetProps)
      };
    }
    /**
     * Gets estimated total rows' height.
     */
  }, {
    key: "getTotalRowsHeight",
    value: function getTotalRowsHeight() {
      return this.state.instanceProps.rowSizeAndPositionManager.getTotalSize();
    }
    /**
     * Gets estimated total columns' width.
     */
  }, {
    key: "getTotalColumnsWidth",
    value: function getTotalColumnsWidth() {
      return this.state.instanceProps.columnSizeAndPositionManager.getTotalSize();
    }
    /**
     * This method handles a scroll event originating from an external scroll control.
     * It's an advanced method and should probably not be used unless you're implementing a custom scroll-bar solution.
     */
  }, {
    key: "handleScrollEvent",
    value: function handleScrollEvent(_ref2) {
      var _ref2$scrollLeft = _ref2.scrollLeft, scrollLeftParam = _ref2$scrollLeft === void 0 ? 0 : _ref2$scrollLeft, _ref2$scrollTop = _ref2.scrollTop, scrollTopParam = _ref2$scrollTop === void 0 ? 0 : _ref2$scrollTop;
      if (scrollTopParam < 0) {
        return;
      }
      this._debounceScrollEnded();
      var _this$props = this.props, autoHeight = _this$props.autoHeight, autoWidth = _this$props.autoWidth, height = _this$props.height, width = _this$props.width;
      var instanceProps = this.state.instanceProps;
      var scrollbarSize2 = instanceProps.scrollbarSize;
      var totalRowsHeight = instanceProps.rowSizeAndPositionManager.getTotalSize();
      var totalColumnsWidth = instanceProps.columnSizeAndPositionManager.getTotalSize();
      var scrollLeft = Math.min(Math.max(0, totalColumnsWidth - width + scrollbarSize2), scrollLeftParam);
      var scrollTop = Math.min(Math.max(0, totalRowsHeight - height + scrollbarSize2), scrollTopParam);
      if (this.state.scrollLeft !== scrollLeft || this.state.scrollTop !== scrollTop) {
        var scrollDirectionHorizontal = scrollLeft !== this.state.scrollLeft ? scrollLeft > this.state.scrollLeft ? SCROLL_DIRECTION_FORWARD$1 : SCROLL_DIRECTION_BACKWARD : this.state.scrollDirectionHorizontal;
        var scrollDirectionVertical = scrollTop !== this.state.scrollTop ? scrollTop > this.state.scrollTop ? SCROLL_DIRECTION_FORWARD$1 : SCROLL_DIRECTION_BACKWARD : this.state.scrollDirectionVertical;
        var newState = {
          isScrolling: true,
          scrollDirectionHorizontal,
          scrollDirectionVertical,
          scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS.OBSERVED
        };
        if (!autoHeight) {
          newState.scrollTop = scrollTop;
        }
        if (!autoWidth) {
          newState.scrollLeft = scrollLeft;
        }
        newState.needToResetStyleCache = false;
        this.setState(newState);
      }
      this._invokeOnScrollMemoizer({
        scrollLeft,
        scrollTop,
        totalColumnsWidth,
        totalRowsHeight
      });
    }
    /**
     * Invalidate Grid size and recompute visible cells.
     * This is a deferred wrapper for recomputeGridSize().
     * It sets a flag to be evaluated on cDM/cDU to avoid unnecessary renders.
     * This method is intended for advanced use-cases like CellMeasurer.
     */
    // @TODO (bvaughn) Add automated test coverage for this.
  }, {
    key: "invalidateCellSizeAfterRender",
    value: function invalidateCellSizeAfterRender(_ref3) {
      var columnIndex = _ref3.columnIndex, rowIndex = _ref3.rowIndex;
      this._deferredInvalidateColumnIndex = typeof this._deferredInvalidateColumnIndex === "number" ? Math.min(this._deferredInvalidateColumnIndex, columnIndex) : columnIndex;
      this._deferredInvalidateRowIndex = typeof this._deferredInvalidateRowIndex === "number" ? Math.min(this._deferredInvalidateRowIndex, rowIndex) : rowIndex;
    }
    /**
     * Pre-measure all columns and rows in a Grid.
     * Typically cells are only measured as needed and estimated sizes are used for cells that have not yet been measured.
     * This method ensures that the next call to getTotalSize() returns an exact size (as opposed to just an estimated one).
     */
  }, {
    key: "measureAllCells",
    value: function measureAllCells() {
      var _this$props2 = this.props, columnCount = _this$props2.columnCount, rowCount = _this$props2.rowCount;
      var instanceProps = this.state.instanceProps;
      instanceProps.columnSizeAndPositionManager.getSizeAndPositionOfCell(columnCount - 1);
      instanceProps.rowSizeAndPositionManager.getSizeAndPositionOfCell(rowCount - 1);
    }
    /**
     * Forced recompute of row heights and column widths.
     * This function should be called if dynamic column or row sizes have changed but nothing else has.
     * Since Grid only receives :columnCount and :rowCount it has no way of detecting when the underlying data changes.
     */
  }, {
    key: "recomputeGridSize",
    value: function recomputeGridSize() {
      var _ref4 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref4$columnIndex = _ref4.columnIndex, columnIndex = _ref4$columnIndex === void 0 ? 0 : _ref4$columnIndex, _ref4$rowIndex = _ref4.rowIndex, rowIndex = _ref4$rowIndex === void 0 ? 0 : _ref4$rowIndex;
      var _this$props3 = this.props, scrollToColumn = _this$props3.scrollToColumn, scrollToRow = _this$props3.scrollToRow;
      var instanceProps = this.state.instanceProps;
      instanceProps.columnSizeAndPositionManager.resetCell(columnIndex);
      instanceProps.rowSizeAndPositionManager.resetCell(rowIndex);
      this._recomputeScrollLeftFlag = scrollToColumn >= 0 && (this.state.scrollDirectionHorizontal === SCROLL_DIRECTION_FORWARD$1 ? columnIndex <= scrollToColumn : columnIndex >= scrollToColumn);
      this._recomputeScrollTopFlag = scrollToRow >= 0 && (this.state.scrollDirectionVertical === SCROLL_DIRECTION_FORWARD$1 ? rowIndex <= scrollToRow : rowIndex >= scrollToRow);
      this._styleCache = {};
      this._cellCache = {};
      this.forceUpdate();
    }
    /**
     * Ensure column and row are visible.
     */
  }, {
    key: "scrollToCell",
    value: function scrollToCell(_ref5) {
      var columnIndex = _ref5.columnIndex, rowIndex = _ref5.rowIndex;
      var columnCount = this.props.columnCount;
      var props = this.props;
      if (columnCount > 1 && columnIndex !== void 0) {
        this._updateScrollLeftForScrollToColumn(_objectSpread$7(_objectSpread$7({}, props), {}, {
          scrollToColumn: columnIndex
        }));
      }
      if (rowIndex !== void 0) {
        this._updateScrollTopForScrollToRow(_objectSpread$7(_objectSpread$7({}, props), {}, {
          scrollToRow: rowIndex
        }));
      }
    }
  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      var _this$props4 = this.props, getScrollbarSize = _this$props4.getScrollbarSize, height = _this$props4.height, scrollLeft = _this$props4.scrollLeft, scrollToColumn = _this$props4.scrollToColumn, scrollTop = _this$props4.scrollTop, scrollToRow = _this$props4.scrollToRow, width = _this$props4.width;
      var instanceProps = this.state.instanceProps;
      this._initialScrollTop = 0;
      this._initialScrollLeft = 0;
      this._handleInvalidatedGridSize();
      if (!instanceProps.scrollbarSizeMeasured) {
        this.setState(function(prevState) {
          var stateUpdate2 = _objectSpread$7(_objectSpread$7({}, prevState), {}, {
            needToResetStyleCache: false
          });
          stateUpdate2.instanceProps.scrollbarSize = getScrollbarSize();
          stateUpdate2.instanceProps.scrollbarSizeMeasured = true;
          return stateUpdate2;
        });
      }
      if (typeof scrollLeft === "number" && scrollLeft >= 0 || typeof scrollTop === "number" && scrollTop >= 0) {
        var stateUpdate = Grid2._getScrollToPositionStateUpdate({
          prevState: this.state,
          scrollLeft,
          scrollTop
        });
        if (stateUpdate) {
          stateUpdate.needToResetStyleCache = false;
          this.setState(stateUpdate);
        }
      }
      if (this._scrollingContainer) {
        if (this._scrollingContainer.scrollLeft !== this.state.scrollLeft) {
          this._scrollingContainer.scrollLeft = this.state.scrollLeft;
        }
        if (this._scrollingContainer.scrollTop !== this.state.scrollTop) {
          this._scrollingContainer.scrollTop = this.state.scrollTop;
        }
      }
      var sizeIsBiggerThanZero = height > 0 && width > 0;
      if (scrollToColumn >= 0 && sizeIsBiggerThanZero) {
        this._updateScrollLeftForScrollToColumn();
      }
      if (scrollToRow >= 0 && sizeIsBiggerThanZero) {
        this._updateScrollTopForScrollToRow();
      }
      this._invokeOnGridRenderedHelper();
      this._invokeOnScrollMemoizer({
        scrollLeft: scrollLeft || 0,
        scrollTop: scrollTop || 0,
        totalColumnsWidth: instanceProps.columnSizeAndPositionManager.getTotalSize(),
        totalRowsHeight: instanceProps.rowSizeAndPositionManager.getTotalSize()
      });
      this._maybeCallOnScrollbarPresenceChange();
    }
    /**
     * @private
     * This method updates scrollLeft/scrollTop in state for the following conditions:
     * 1) New scroll-to-cell props have been set
     */
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate(prevProps, prevState) {
      var _this2 = this;
      var _this$props5 = this.props, autoHeight = _this$props5.autoHeight, autoWidth = _this$props5.autoWidth, columnCount = _this$props5.columnCount, height = _this$props5.height, rowCount = _this$props5.rowCount, scrollToAlignment = _this$props5.scrollToAlignment, scrollToColumn = _this$props5.scrollToColumn, scrollToRow = _this$props5.scrollToRow, width = _this$props5.width;
      var _this$state = this.state, scrollLeft = _this$state.scrollLeft, scrollPositionChangeReason = _this$state.scrollPositionChangeReason, scrollTop = _this$state.scrollTop, instanceProps = _this$state.instanceProps;
      this._handleInvalidatedGridSize();
      var columnOrRowCountJustIncreasedFromZero = columnCount > 0 && prevProps.columnCount === 0 || rowCount > 0 && prevProps.rowCount === 0;
      if (scrollPositionChangeReason === SCROLL_POSITION_CHANGE_REASONS.REQUESTED) {
        if (!autoWidth && scrollLeft >= 0 && (scrollLeft !== this._scrollingContainer.scrollLeft || columnOrRowCountJustIncreasedFromZero)) {
          this._scrollingContainer.scrollLeft = scrollLeft;
        }
        if (!autoHeight && scrollTop >= 0 && (scrollTop !== this._scrollingContainer.scrollTop || columnOrRowCountJustIncreasedFromZero)) {
          this._scrollingContainer.scrollTop = scrollTop;
        }
      }
      var sizeJustIncreasedFromZero = (prevProps.width === 0 || prevProps.height === 0) && height > 0 && width > 0;
      if (this._recomputeScrollLeftFlag) {
        this._recomputeScrollLeftFlag = false;
        this._updateScrollLeftForScrollToColumn(this.props);
      } else {
        updateScrollIndexHelper({
          cellSizeAndPositionManager: instanceProps.columnSizeAndPositionManager,
          previousCellsCount: prevProps.columnCount,
          previousCellSize: prevProps.columnWidth,
          previousScrollToAlignment: prevProps.scrollToAlignment,
          previousScrollToIndex: prevProps.scrollToColumn,
          previousSize: prevProps.width,
          scrollOffset: scrollLeft,
          scrollToAlignment,
          scrollToIndex: scrollToColumn,
          size: width,
          sizeJustIncreasedFromZero,
          updateScrollIndexCallback: function updateScrollIndexCallback() {
            return _this2._updateScrollLeftForScrollToColumn(_this2.props);
          }
        });
      }
      if (this._recomputeScrollTopFlag) {
        this._recomputeScrollTopFlag = false;
        this._updateScrollTopForScrollToRow(this.props);
      } else {
        updateScrollIndexHelper({
          cellSizeAndPositionManager: instanceProps.rowSizeAndPositionManager,
          previousCellsCount: prevProps.rowCount,
          previousCellSize: prevProps.rowHeight,
          previousScrollToAlignment: prevProps.scrollToAlignment,
          previousScrollToIndex: prevProps.scrollToRow,
          previousSize: prevProps.height,
          scrollOffset: scrollTop,
          scrollToAlignment,
          scrollToIndex: scrollToRow,
          size: height,
          sizeJustIncreasedFromZero,
          updateScrollIndexCallback: function updateScrollIndexCallback() {
            return _this2._updateScrollTopForScrollToRow(_this2.props);
          }
        });
      }
      this._invokeOnGridRenderedHelper();
      if (scrollLeft !== prevState.scrollLeft || scrollTop !== prevState.scrollTop) {
        var totalRowsHeight = instanceProps.rowSizeAndPositionManager.getTotalSize();
        var totalColumnsWidth = instanceProps.columnSizeAndPositionManager.getTotalSize();
        this._invokeOnScrollMemoizer({
          scrollLeft,
          scrollTop,
          totalColumnsWidth,
          totalRowsHeight
        });
      }
      this._maybeCallOnScrollbarPresenceChange();
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      if (this._disablePointerEventsTimeoutId) {
        cancelAnimationTimeout(this._disablePointerEventsTimeoutId);
      }
    }
    /**
     * This method updates scrollLeft/scrollTop in state for the following conditions:
     * 1) Empty content (0 rows or columns)
     * 2) New scroll props overriding the current state
     * 3) Cells-count or cells-size has changed, making previous scroll offsets invalid
     */
  }, {
    key: "render",
    value: function render3() {
      var _this$props6 = this.props, autoContainerWidth = _this$props6.autoContainerWidth, autoHeight = _this$props6.autoHeight, autoWidth = _this$props6.autoWidth, className = _this$props6.className, containerProps = _this$props6.containerProps, containerRole = _this$props6.containerRole, containerStyle = _this$props6.containerStyle, height = _this$props6.height, id2 = _this$props6.id, noContentRenderer2 = _this$props6.noContentRenderer, role = _this$props6.role, style2 = _this$props6.style, tabIndex = _this$props6.tabIndex, width = _this$props6.width;
      var _this$state2 = this.state, instanceProps = _this$state2.instanceProps, needToResetStyleCache = _this$state2.needToResetStyleCache;
      var isScrolling = this._isScrolling();
      var gridStyle = {
        boxSizing: "border-box",
        direction: "ltr",
        height: autoHeight ? "auto" : height,
        position: "relative",
        width: autoWidth ? "auto" : width,
        WebkitOverflowScrolling: "touch",
        willChange: "transform"
      };
      if (needToResetStyleCache) {
        this._styleCache = {};
      }
      if (!this.state.isScrolling) {
        this._resetStyleCache();
      }
      this._calculateChildrenToRender(this.props, this.state);
      var totalColumnsWidth = instanceProps.columnSizeAndPositionManager.getTotalSize();
      var totalRowsHeight = instanceProps.rowSizeAndPositionManager.getTotalSize();
      var verticalScrollBarSize = totalRowsHeight > height ? instanceProps.scrollbarSize : 0;
      var horizontalScrollBarSize = totalColumnsWidth > width ? instanceProps.scrollbarSize : 0;
      if (horizontalScrollBarSize !== this._horizontalScrollBarSize || verticalScrollBarSize !== this._verticalScrollBarSize) {
        this._horizontalScrollBarSize = horizontalScrollBarSize;
        this._verticalScrollBarSize = verticalScrollBarSize;
        this._scrollbarPresenceChanged = true;
      }
      gridStyle.overflowX = totalColumnsWidth + verticalScrollBarSize <= width ? "hidden" : "auto";
      gridStyle.overflowY = totalRowsHeight + horizontalScrollBarSize <= height ? "hidden" : "auto";
      var childrenToDisplay = this._childrenToDisplay;
      var showNoContentRenderer = childrenToDisplay.length === 0 && height > 0 && width > 0;
      return /* @__PURE__ */ reactExports.createElement("div", _extends$h({
        ref: this._setScrollingContainerRef
      }, containerProps, {
        "aria-label": this.props["aria-label"],
        "aria-readonly": this.props["aria-readonly"],
        className: clsx("ReactVirtualized__Grid", className),
        id: id2,
        onScroll: this._onScroll,
        role,
        style: _objectSpread$7(_objectSpread$7({}, gridStyle), style2),
        tabIndex
      }), childrenToDisplay.length > 0 && /* @__PURE__ */ reactExports.createElement("div", {
        className: "ReactVirtualized__Grid__innerScrollContainer",
        role: containerRole,
        style: _objectSpread$7({
          width: autoContainerWidth ? "auto" : totalColumnsWidth,
          height: totalRowsHeight,
          maxWidth: totalColumnsWidth,
          maxHeight: totalRowsHeight,
          overflow: "hidden",
          pointerEvents: isScrolling ? "none" : "",
          position: "relative"
        }, containerStyle)
      }, childrenToDisplay), showNoContentRenderer && noContentRenderer2());
    }
    /* ---------------------------- Helper methods ---------------------------- */
  }, {
    key: "_calculateChildrenToRender",
    value: function _calculateChildrenToRender() {
      var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props;
      var state = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.state;
      var cellRenderer = props.cellRenderer, cellRangeRenderer = props.cellRangeRenderer, columnCount = props.columnCount, deferredMeasurementCache = props.deferredMeasurementCache, height = props.height, overscanColumnCount = props.overscanColumnCount, overscanIndicesGetter = props.overscanIndicesGetter, overscanRowCount = props.overscanRowCount, rowCount = props.rowCount, width = props.width, isScrollingOptOut = props.isScrollingOptOut;
      var scrollDirectionHorizontal = state.scrollDirectionHorizontal, scrollDirectionVertical = state.scrollDirectionVertical, instanceProps = state.instanceProps;
      var scrollTop = this._initialScrollTop > 0 ? this._initialScrollTop : state.scrollTop;
      var scrollLeft = this._initialScrollLeft > 0 ? this._initialScrollLeft : state.scrollLeft;
      var isScrolling = this._isScrolling(props, state);
      this._childrenToDisplay = [];
      if (height > 0 && width > 0) {
        var visibleColumnIndices = instanceProps.columnSizeAndPositionManager.getVisibleCellRange({
          containerSize: width,
          offset: scrollLeft
        });
        var visibleRowIndices = instanceProps.rowSizeAndPositionManager.getVisibleCellRange({
          containerSize: height,
          offset: scrollTop
        });
        var horizontalOffsetAdjustment = instanceProps.columnSizeAndPositionManager.getOffsetAdjustment({
          containerSize: width,
          offset: scrollLeft
        });
        var verticalOffsetAdjustment = instanceProps.rowSizeAndPositionManager.getOffsetAdjustment({
          containerSize: height,
          offset: scrollTop
        });
        this._renderedColumnStartIndex = visibleColumnIndices.start;
        this._renderedColumnStopIndex = visibleColumnIndices.stop;
        this._renderedRowStartIndex = visibleRowIndices.start;
        this._renderedRowStopIndex = visibleRowIndices.stop;
        var overscanColumnIndices = overscanIndicesGetter({
          direction: "horizontal",
          cellCount: columnCount,
          overscanCellsCount: overscanColumnCount,
          scrollDirection: scrollDirectionHorizontal,
          startIndex: typeof visibleColumnIndices.start === "number" ? visibleColumnIndices.start : 0,
          stopIndex: typeof visibleColumnIndices.stop === "number" ? visibleColumnIndices.stop : -1
        });
        var overscanRowIndices = overscanIndicesGetter({
          direction: "vertical",
          cellCount: rowCount,
          overscanCellsCount: overscanRowCount,
          scrollDirection: scrollDirectionVertical,
          startIndex: typeof visibleRowIndices.start === "number" ? visibleRowIndices.start : 0,
          stopIndex: typeof visibleRowIndices.stop === "number" ? visibleRowIndices.stop : -1
        });
        var columnStartIndex = overscanColumnIndices.overscanStartIndex;
        var columnStopIndex = overscanColumnIndices.overscanStopIndex;
        var rowStartIndex = overscanRowIndices.overscanStartIndex;
        var rowStopIndex = overscanRowIndices.overscanStopIndex;
        if (deferredMeasurementCache) {
          if (!deferredMeasurementCache.hasFixedHeight()) {
            for (var rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {
              if (!deferredMeasurementCache.has(rowIndex, 0)) {
                columnStartIndex = 0;
                columnStopIndex = columnCount - 1;
                break;
              }
            }
          }
          if (!deferredMeasurementCache.hasFixedWidth()) {
            for (var columnIndex = columnStartIndex; columnIndex <= columnStopIndex; columnIndex++) {
              if (!deferredMeasurementCache.has(0, columnIndex)) {
                rowStartIndex = 0;
                rowStopIndex = rowCount - 1;
                break;
              }
            }
          }
        }
        this._childrenToDisplay = cellRangeRenderer({
          cellCache: this._cellCache,
          cellRenderer,
          columnSizeAndPositionManager: instanceProps.columnSizeAndPositionManager,
          columnStartIndex,
          columnStopIndex,
          deferredMeasurementCache,
          horizontalOffsetAdjustment,
          isScrolling,
          isScrollingOptOut,
          parent: this,
          rowSizeAndPositionManager: instanceProps.rowSizeAndPositionManager,
          rowStartIndex,
          rowStopIndex,
          scrollLeft,
          scrollTop,
          styleCache: this._styleCache,
          verticalOffsetAdjustment,
          visibleColumnIndices,
          visibleRowIndices
        });
        this._columnStartIndex = columnStartIndex;
        this._columnStopIndex = columnStopIndex;
        this._rowStartIndex = rowStartIndex;
        this._rowStopIndex = rowStopIndex;
      }
    }
    /**
     * Sets an :isScrolling flag for a small window of time.
     * This flag is used to disable pointer events on the scrollable portion of the Grid.
     * This prevents jerky/stuttery mouse-wheel scrolling.
     */
  }, {
    key: "_debounceScrollEnded",
    value: function _debounceScrollEnded() {
      var scrollingResetTimeInterval = this.props.scrollingResetTimeInterval;
      if (this._disablePointerEventsTimeoutId) {
        cancelAnimationTimeout(this._disablePointerEventsTimeoutId);
      }
      this._disablePointerEventsTimeoutId = requestAnimationTimeout(this._debounceScrollEndedCallback, scrollingResetTimeInterval);
    }
  }, {
    key: "_handleInvalidatedGridSize",
    value: (
      /**
       * Check for batched CellMeasurer size invalidations.
       * This will occur the first time one or more previously unmeasured cells are rendered.
       */
      function _handleInvalidatedGridSize() {
        if (typeof this._deferredInvalidateColumnIndex === "number" && typeof this._deferredInvalidateRowIndex === "number") {
          var columnIndex = this._deferredInvalidateColumnIndex;
          var rowIndex = this._deferredInvalidateRowIndex;
          this._deferredInvalidateColumnIndex = null;
          this._deferredInvalidateRowIndex = null;
          this.recomputeGridSize({
            columnIndex,
            rowIndex
          });
        }
      }
    )
  }, {
    key: "_invokeOnScrollMemoizer",
    value: function _invokeOnScrollMemoizer(_ref6) {
      var _this3 = this;
      var scrollLeft = _ref6.scrollLeft, scrollTop = _ref6.scrollTop, totalColumnsWidth = _ref6.totalColumnsWidth, totalRowsHeight = _ref6.totalRowsHeight;
      this._onScrollMemoizer({
        callback: function callback2(_ref7) {
          var scrollLeft2 = _ref7.scrollLeft, scrollTop2 = _ref7.scrollTop;
          var _this3$props = _this3.props, height = _this3$props.height, onScroll6 = _this3$props.onScroll, width = _this3$props.width;
          onScroll6({
            clientHeight: height,
            clientWidth: width,
            scrollHeight: totalRowsHeight,
            scrollLeft: scrollLeft2,
            scrollTop: scrollTop2,
            scrollWidth: totalColumnsWidth
          });
        },
        indices: {
          scrollLeft,
          scrollTop
        }
      });
    }
  }, {
    key: "_isScrolling",
    value: function _isScrolling() {
      var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props;
      var state = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.state;
      return Object.hasOwnProperty.call(props, "isScrolling") ? Boolean(props.isScrolling) : Boolean(state.isScrolling);
    }
  }, {
    key: "_maybeCallOnScrollbarPresenceChange",
    value: function _maybeCallOnScrollbarPresenceChange() {
      if (this._scrollbarPresenceChanged) {
        var onScrollbarPresenceChange2 = this.props.onScrollbarPresenceChange;
        this._scrollbarPresenceChanged = false;
        onScrollbarPresenceChange2({
          horizontal: this._horizontalScrollBarSize > 0,
          size: this.state.instanceProps.scrollbarSize,
          vertical: this._verticalScrollBarSize > 0
        });
      }
    }
  }, {
    key: "scrollToPosition",
    value: (
      /**
       * Scroll to the specified offset(s).
       * Useful for animating position changes.
       */
      function scrollToPosition(_ref8) {
        var scrollLeft = _ref8.scrollLeft, scrollTop = _ref8.scrollTop;
        var stateUpdate = Grid2._getScrollToPositionStateUpdate({
          prevState: this.state,
          scrollLeft,
          scrollTop
        });
        if (stateUpdate) {
          stateUpdate.needToResetStyleCache = false;
          this.setState(stateUpdate);
        }
      }
    )
  }, {
    key: "_getCalculatedScrollLeft",
    value: function _getCalculatedScrollLeft() {
      var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props;
      var state = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.state;
      return Grid2._getCalculatedScrollLeft(props, state);
    }
  }, {
    key: "_updateScrollLeftForScrollToColumn",
    value: function _updateScrollLeftForScrollToColumn() {
      var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props;
      var state = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.state;
      var stateUpdate = Grid2._getScrollLeftForScrollToColumnStateUpdate(props, state);
      if (stateUpdate) {
        stateUpdate.needToResetStyleCache = false;
        this.setState(stateUpdate);
      }
    }
  }, {
    key: "_getCalculatedScrollTop",
    value: function _getCalculatedScrollTop() {
      var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props;
      var state = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.state;
      return Grid2._getCalculatedScrollTop(props, state);
    }
  }, {
    key: "_resetStyleCache",
    value: function _resetStyleCache() {
      var styleCache = this._styleCache;
      var cellCache = this._cellCache;
      var isScrollingOptOut = this.props.isScrollingOptOut;
      this._cellCache = {};
      this._styleCache = {};
      for (var rowIndex = this._rowStartIndex; rowIndex <= this._rowStopIndex; rowIndex++) {
        for (var columnIndex = this._columnStartIndex; columnIndex <= this._columnStopIndex; columnIndex++) {
          var key = "".concat(rowIndex, "-").concat(columnIndex);
          this._styleCache[key] = styleCache[key];
          if (isScrollingOptOut) {
            this._cellCache[key] = cellCache[key];
          }
        }
      }
    }
  }, {
    key: "_updateScrollTopForScrollToRow",
    value: function _updateScrollTopForScrollToRow() {
      var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props;
      var state = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.state;
      var stateUpdate = Grid2._getScrollTopForScrollToRowStateUpdate(props, state);
      if (stateUpdate) {
        stateUpdate.needToResetStyleCache = false;
        this.setState(stateUpdate);
      }
    }
  }], [{
    key: "getDerivedStateFromProps",
    value: function getDerivedStateFromProps(nextProps, prevState) {
      var newState = {};
      if (nextProps.columnCount === 0 && prevState.scrollLeft !== 0 || nextProps.rowCount === 0 && prevState.scrollTop !== 0) {
        newState.scrollLeft = 0;
        newState.scrollTop = 0;
      } else if (nextProps.scrollLeft !== prevState.scrollLeft && nextProps.scrollToColumn < 0 || nextProps.scrollTop !== prevState.scrollTop && nextProps.scrollToRow < 0) {
        Object.assign(newState, Grid2._getScrollToPositionStateUpdate({
          prevState,
          scrollLeft: nextProps.scrollLeft,
          scrollTop: nextProps.scrollTop
        }));
      }
      var instanceProps = prevState.instanceProps;
      newState.needToResetStyleCache = false;
      if (nextProps.columnWidth !== instanceProps.prevColumnWidth || nextProps.rowHeight !== instanceProps.prevRowHeight) {
        newState.needToResetStyleCache = true;
      }
      instanceProps.columnSizeAndPositionManager.configure({
        cellCount: nextProps.columnCount,
        estimatedCellSize: Grid2._getEstimatedColumnSize(nextProps),
        cellSizeGetter: Grid2._wrapSizeGetter(nextProps.columnWidth)
      });
      instanceProps.rowSizeAndPositionManager.configure({
        cellCount: nextProps.rowCount,
        estimatedCellSize: Grid2._getEstimatedRowSize(nextProps),
        cellSizeGetter: Grid2._wrapSizeGetter(nextProps.rowHeight)
      });
      if (instanceProps.prevColumnCount === 0 || instanceProps.prevRowCount === 0) {
        instanceProps.prevColumnCount = 0;
        instanceProps.prevRowCount = 0;
      }
      if (nextProps.autoHeight && nextProps.isScrolling === false && instanceProps.prevIsScrolling === true) {
        Object.assign(newState, {
          isScrolling: false
        });
      }
      var maybeStateA;
      var maybeStateB;
      calculateSizeAndPositionDataAndUpdateScrollOffset({
        cellCount: instanceProps.prevColumnCount,
        cellSize: typeof instanceProps.prevColumnWidth === "number" ? instanceProps.prevColumnWidth : null,
        computeMetadataCallback: function computeMetadataCallback() {
          return instanceProps.columnSizeAndPositionManager.resetCell(0);
        },
        computeMetadataCallbackProps: nextProps,
        nextCellsCount: nextProps.columnCount,
        nextCellSize: typeof nextProps.columnWidth === "number" ? nextProps.columnWidth : null,
        nextScrollToIndex: nextProps.scrollToColumn,
        scrollToIndex: instanceProps.prevScrollToColumn,
        updateScrollOffsetForScrollToIndex: function updateScrollOffsetForScrollToIndex() {
          maybeStateA = Grid2._getScrollLeftForScrollToColumnStateUpdate(nextProps, prevState);
        }
      });
      calculateSizeAndPositionDataAndUpdateScrollOffset({
        cellCount: instanceProps.prevRowCount,
        cellSize: typeof instanceProps.prevRowHeight === "number" ? instanceProps.prevRowHeight : null,
        computeMetadataCallback: function computeMetadataCallback() {
          return instanceProps.rowSizeAndPositionManager.resetCell(0);
        },
        computeMetadataCallbackProps: nextProps,
        nextCellsCount: nextProps.rowCount,
        nextCellSize: typeof nextProps.rowHeight === "number" ? nextProps.rowHeight : null,
        nextScrollToIndex: nextProps.scrollToRow,
        scrollToIndex: instanceProps.prevScrollToRow,
        updateScrollOffsetForScrollToIndex: function updateScrollOffsetForScrollToIndex() {
          maybeStateB = Grid2._getScrollTopForScrollToRowStateUpdate(nextProps, prevState);
        }
      });
      instanceProps.prevColumnCount = nextProps.columnCount;
      instanceProps.prevColumnWidth = nextProps.columnWidth;
      instanceProps.prevIsScrolling = nextProps.isScrolling === true;
      instanceProps.prevRowCount = nextProps.rowCount;
      instanceProps.prevRowHeight = nextProps.rowHeight;
      instanceProps.prevScrollToColumn = nextProps.scrollToColumn;
      instanceProps.prevScrollToRow = nextProps.scrollToRow;
      instanceProps.scrollbarSize = nextProps.getScrollbarSize();
      if (instanceProps.scrollbarSize === void 0) {
        instanceProps.scrollbarSizeMeasured = false;
        instanceProps.scrollbarSize = 0;
      } else {
        instanceProps.scrollbarSizeMeasured = true;
      }
      newState.instanceProps = instanceProps;
      return _objectSpread$7(_objectSpread$7(_objectSpread$7({}, newState), maybeStateA), maybeStateB);
    }
  }, {
    key: "_getEstimatedColumnSize",
    value: function _getEstimatedColumnSize(props) {
      return typeof props.columnWidth === "number" ? props.columnWidth : props.estimatedColumnSize;
    }
  }, {
    key: "_getEstimatedRowSize",
    value: function _getEstimatedRowSize(props) {
      return typeof props.rowHeight === "number" ? props.rowHeight : props.estimatedRowSize;
    }
  }, {
    key: "_getScrollToPositionStateUpdate",
    value: (
      /**
       * Get the updated state after scrolling to
       * scrollLeft and scrollTop
       */
      function _getScrollToPositionStateUpdate(_ref9) {
        var prevState = _ref9.prevState, scrollLeft = _ref9.scrollLeft, scrollTop = _ref9.scrollTop;
        var newState = {
          scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS.REQUESTED
        };
        if (typeof scrollLeft === "number" && scrollLeft >= 0) {
          newState.scrollDirectionHorizontal = scrollLeft > prevState.scrollLeft ? SCROLL_DIRECTION_FORWARD$1 : SCROLL_DIRECTION_BACKWARD;
          newState.scrollLeft = scrollLeft;
        }
        if (typeof scrollTop === "number" && scrollTop >= 0) {
          newState.scrollDirectionVertical = scrollTop > prevState.scrollTop ? SCROLL_DIRECTION_FORWARD$1 : SCROLL_DIRECTION_BACKWARD;
          newState.scrollTop = scrollTop;
        }
        if (typeof scrollLeft === "number" && scrollLeft >= 0 && scrollLeft !== prevState.scrollLeft || typeof scrollTop === "number" && scrollTop >= 0 && scrollTop !== prevState.scrollTop) {
          return newState;
        }
        return {};
      }
    )
  }, {
    key: "_wrapSizeGetter",
    value: function _wrapSizeGetter(value2) {
      return typeof value2 === "function" ? value2 : function() {
        return value2;
      };
    }
  }, {
    key: "_getCalculatedScrollLeft",
    value: function _getCalculatedScrollLeft(nextProps, prevState) {
      var columnCount = nextProps.columnCount, height = nextProps.height, scrollToAlignment = nextProps.scrollToAlignment, scrollToColumn = nextProps.scrollToColumn, width = nextProps.width;
      var scrollLeft = prevState.scrollLeft, instanceProps = prevState.instanceProps;
      if (columnCount > 0) {
        var finalColumn = columnCount - 1;
        var targetIndex = scrollToColumn < 0 ? finalColumn : Math.min(finalColumn, scrollToColumn);
        var totalRowsHeight = instanceProps.rowSizeAndPositionManager.getTotalSize();
        var scrollBarSize = instanceProps.scrollbarSizeMeasured && totalRowsHeight > height ? instanceProps.scrollbarSize : 0;
        return instanceProps.columnSizeAndPositionManager.getUpdatedOffsetForIndex({
          align: scrollToAlignment,
          containerSize: width - scrollBarSize,
          currentOffset: scrollLeft,
          targetIndex
        });
      }
      return 0;
    }
  }, {
    key: "_getScrollLeftForScrollToColumnStateUpdate",
    value: function _getScrollLeftForScrollToColumnStateUpdate(nextProps, prevState) {
      var scrollLeft = prevState.scrollLeft;
      var calculatedScrollLeft = Grid2._getCalculatedScrollLeft(nextProps, prevState);
      if (typeof calculatedScrollLeft === "number" && calculatedScrollLeft >= 0 && scrollLeft !== calculatedScrollLeft) {
        return Grid2._getScrollToPositionStateUpdate({
          prevState,
          scrollLeft: calculatedScrollLeft,
          scrollTop: -1
        });
      }
      return {};
    }
  }, {
    key: "_getCalculatedScrollTop",
    value: function _getCalculatedScrollTop(nextProps, prevState) {
      var height = nextProps.height, rowCount = nextProps.rowCount, scrollToAlignment = nextProps.scrollToAlignment, scrollToRow = nextProps.scrollToRow, width = nextProps.width;
      var scrollTop = prevState.scrollTop, instanceProps = prevState.instanceProps;
      if (rowCount > 0) {
        var finalRow = rowCount - 1;
        var targetIndex = scrollToRow < 0 ? finalRow : Math.min(finalRow, scrollToRow);
        var totalColumnsWidth = instanceProps.columnSizeAndPositionManager.getTotalSize();
        var scrollBarSize = instanceProps.scrollbarSizeMeasured && totalColumnsWidth > width ? instanceProps.scrollbarSize : 0;
        return instanceProps.rowSizeAndPositionManager.getUpdatedOffsetForIndex({
          align: scrollToAlignment,
          containerSize: height - scrollBarSize,
          currentOffset: scrollTop,
          targetIndex
        });
      }
      return 0;
    }
  }, {
    key: "_getScrollTopForScrollToRowStateUpdate",
    value: function _getScrollTopForScrollToRowStateUpdate(nextProps, prevState) {
      var scrollTop = prevState.scrollTop;
      var calculatedScrollTop = Grid2._getCalculatedScrollTop(nextProps, prevState);
      if (typeof calculatedScrollTop === "number" && calculatedScrollTop >= 0 && scrollTop !== calculatedScrollTop) {
        return Grid2._getScrollToPositionStateUpdate({
          prevState,
          scrollLeft: -1,
          scrollTop: calculatedScrollTop
        });
      }
      return {};
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$3(Grid, "defaultProps", {
  "aria-label": "grid",
  "aria-readonly": true,
  autoContainerWidth: false,
  autoHeight: false,
  autoWidth: false,
  cellRangeRenderer: defaultCellRangeRenderer,
  containerRole: "row",
  containerStyle: {},
  estimatedColumnSize: 100,
  estimatedRowSize: 30,
  getScrollbarSize: scrollbarSize,
  noContentRenderer: renderNull,
  onScroll: function onScroll2() {
  },
  onScrollbarPresenceChange: function onScrollbarPresenceChange() {
  },
  onSectionRendered: function onSectionRendered2() {
  },
  overscanColumnCount: 0,
  overscanIndicesGetter: defaultOverscanIndicesGetter$1,
  overscanRowCount: 10,
  role: "grid",
  scrollingResetTimeInterval: DEFAULT_SCROLLING_RESET_TIME_INTERVAL$1,
  scrollToAlignment: "auto",
  scrollToColumn: -1,
  scrollToRow: -1,
  style: {},
  tabIndex: 0,
  isScrollingOptOut: false
});
polyfill2(Grid);
var SCROLL_DIRECTION_FORWARD = 1;
function defaultOverscanIndicesGetter(_ref) {
  var cellCount = _ref.cellCount, overscanCellsCount = _ref.overscanCellsCount, scrollDirection = _ref.scrollDirection, startIndex = _ref.startIndex, stopIndex = _ref.stopIndex;
  overscanCellsCount = Math.max(1, overscanCellsCount);
  if (scrollDirection === SCROLL_DIRECTION_FORWARD) {
    return {
      overscanStartIndex: Math.max(0, startIndex - 1),
      overscanStopIndex: Math.min(cellCount - 1, stopIndex + overscanCellsCount)
    };
  } else {
    return {
      overscanStartIndex: Math.max(0, startIndex - overscanCellsCount),
      overscanStopIndex: Math.min(cellCount - 1, stopIndex + 1)
    };
  }
}
function _callSuper$7(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$7() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$7() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t22) {
  }
  return (_isNativeReflectConstruct$7 = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var InfiniteLoader = /* @__PURE__ */ function(_React$PureComponent) {
  function InfiniteLoader2(props, context) {
    var _this;
    _classCallCheck$a(this, InfiniteLoader2);
    _this = _callSuper$7(this, InfiniteLoader2, [props, context]);
    _this._loadMoreRowsMemoizer = createCallbackMemoizer();
    _this._onRowsRendered = _this._onRowsRendered.bind(_this);
    _this._registerChild = _this._registerChild.bind(_this);
    return _this;
  }
  _inherits$a(InfiniteLoader2, _React$PureComponent);
  return _createClass$8(InfiniteLoader2, [{
    key: "resetLoadMoreRowsCache",
    value: function resetLoadMoreRowsCache(autoReload) {
      this._loadMoreRowsMemoizer = createCallbackMemoizer();
      if (autoReload) {
        this._doStuff(this._lastRenderedStartIndex, this._lastRenderedStopIndex);
      }
    }
  }, {
    key: "render",
    value: function render3() {
      var children = this.props.children;
      return children({
        onRowsRendered: this._onRowsRendered,
        registerChild: this._registerChild
      });
    }
  }, {
    key: "_loadUnloadedRanges",
    value: function _loadUnloadedRanges(unloadedRanges) {
      var _this2 = this;
      var loadMoreRows = this.props.loadMoreRows;
      unloadedRanges.forEach(function(unloadedRange) {
        var promise = loadMoreRows(unloadedRange);
        if (promise) {
          promise.then(function() {
            if (isRangeVisible({
              lastRenderedStartIndex: _this2._lastRenderedStartIndex,
              lastRenderedStopIndex: _this2._lastRenderedStopIndex,
              startIndex: unloadedRange.startIndex,
              stopIndex: unloadedRange.stopIndex
            })) {
              if (_this2._registeredChild) {
                forceUpdateReactVirtualizedComponent(_this2._registeredChild, _this2._lastRenderedStartIndex);
              }
            }
          });
        }
      });
    }
  }, {
    key: "_onRowsRendered",
    value: function _onRowsRendered(_ref) {
      var startIndex = _ref.startIndex, stopIndex = _ref.stopIndex;
      this._lastRenderedStartIndex = startIndex;
      this._lastRenderedStopIndex = stopIndex;
      this._doStuff(startIndex, stopIndex);
    }
  }, {
    key: "_doStuff",
    value: function _doStuff(startIndex, stopIndex) {
      var _ref2, _this3 = this;
      var _this$props = this.props, isRowLoaded = _this$props.isRowLoaded, minimumBatchSize = _this$props.minimumBatchSize, rowCount = _this$props.rowCount, threshold = _this$props.threshold;
      var unloadedRanges = scanForUnloadedRanges({
        isRowLoaded,
        minimumBatchSize,
        rowCount,
        startIndex: Math.max(0, startIndex - threshold),
        stopIndex: Math.min(rowCount - 1, stopIndex + threshold)
      });
      var squashedUnloadedRanges = (_ref2 = []).concat.apply(_ref2, _toConsumableArray(unloadedRanges.map(function(_ref3) {
        var startIndex2 = _ref3.startIndex, stopIndex2 = _ref3.stopIndex;
        return [startIndex2, stopIndex2];
      })));
      this._loadMoreRowsMemoizer({
        callback: function callback2() {
          _this3._loadUnloadedRanges(unloadedRanges);
        },
        indices: {
          squashedUnloadedRanges
        }
      });
    }
  }, {
    key: "_registerChild",
    value: function _registerChild(registeredChild) {
      this._registeredChild = registeredChild;
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$3(InfiniteLoader, "defaultProps", {
  minimumBatchSize: 10,
  rowCount: 0,
  threshold: 15
});
InfiniteLoader.propTypes = {};
function isRangeVisible(_ref4) {
  var lastRenderedStartIndex = _ref4.lastRenderedStartIndex, lastRenderedStopIndex = _ref4.lastRenderedStopIndex, startIndex = _ref4.startIndex, stopIndex = _ref4.stopIndex;
  return !(startIndex > lastRenderedStopIndex || stopIndex < lastRenderedStartIndex);
}
function scanForUnloadedRanges(_ref5) {
  var isRowLoaded = _ref5.isRowLoaded, minimumBatchSize = _ref5.minimumBatchSize, rowCount = _ref5.rowCount, startIndex = _ref5.startIndex, stopIndex = _ref5.stopIndex;
  var unloadedRanges = [];
  var rangeStartIndex = null;
  var rangeStopIndex = null;
  for (var index2 = startIndex; index2 <= stopIndex; index2++) {
    var loaded = isRowLoaded({
      index: index2
    });
    if (!loaded) {
      rangeStopIndex = index2;
      if (rangeStartIndex === null) {
        rangeStartIndex = index2;
      }
    } else if (rangeStopIndex !== null) {
      unloadedRanges.push({
        startIndex: rangeStartIndex,
        stopIndex: rangeStopIndex
      });
      rangeStartIndex = rangeStopIndex = null;
    }
  }
  if (rangeStopIndex !== null) {
    var potentialStopIndex = Math.min(Math.max(rangeStopIndex, rangeStartIndex + minimumBatchSize - 1), rowCount - 1);
    for (var _index = rangeStopIndex + 1; _index <= potentialStopIndex; _index++) {
      if (!isRowLoaded({
        index: _index
      })) {
        rangeStopIndex = _index;
      } else {
        break;
      }
    }
    unloadedRanges.push({
      startIndex: rangeStartIndex,
      stopIndex: rangeStopIndex
    });
  }
  if (unloadedRanges.length) {
    var firstUnloadedRange = unloadedRanges[0];
    while (firstUnloadedRange.stopIndex - firstUnloadedRange.startIndex + 1 < minimumBatchSize && firstUnloadedRange.startIndex > 0) {
      var _index2 = firstUnloadedRange.startIndex - 1;
      if (!isRowLoaded({
        index: _index2
      })) {
        firstUnloadedRange.startIndex = _index2;
      } else {
        break;
      }
    }
  }
  return unloadedRanges;
}
function forceUpdateReactVirtualizedComponent(component) {
  var currentIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
  var recomputeSize = typeof component.recomputeGridSize === "function" ? component.recomputeGridSize : component.recomputeRowHeights;
  if (recomputeSize) {
    recomputeSize.call(component, currentIndex);
  } else {
    component.forceUpdate();
  }
}
function _callSuper$6(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$6() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$6() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t3) {
  }
  return (_isNativeReflectConstruct$6 = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var List = /* @__PURE__ */ function(_React$PureComponent) {
  function List2() {
    var _this;
    _classCallCheck$a(this, List2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _callSuper$6(this, List2, [].concat(args));
    _defineProperty$3(_this, "Grid", void 0);
    _defineProperty$3(_this, "_cellRenderer", function(_ref) {
      var parent = _ref.parent, rowIndex = _ref.rowIndex, style2 = _ref.style, isScrolling = _ref.isScrolling, isVisible2 = _ref.isVisible, key = _ref.key;
      var rowRenderer = _this.props.rowRenderer;
      var widthDescriptor = Object.getOwnPropertyDescriptor(style2, "width");
      if (widthDescriptor && widthDescriptor.writable) {
        style2.width = "100%";
      }
      return rowRenderer({
        index: rowIndex,
        style: style2,
        isScrolling,
        isVisible: isVisible2,
        key,
        parent
      });
    });
    _defineProperty$3(_this, "_setRef", function(ref) {
      _this.Grid = ref;
    });
    _defineProperty$3(_this, "_onScroll", function(_ref2) {
      var clientHeight = _ref2.clientHeight, scrollHeight = _ref2.scrollHeight, scrollTop = _ref2.scrollTop;
      var onScroll6 = _this.props.onScroll;
      onScroll6({
        clientHeight,
        scrollHeight,
        scrollTop
      });
    });
    _defineProperty$3(_this, "_onSectionRendered", function(_ref3) {
      var rowOverscanStartIndex = _ref3.rowOverscanStartIndex, rowOverscanStopIndex = _ref3.rowOverscanStopIndex, rowStartIndex = _ref3.rowStartIndex, rowStopIndex = _ref3.rowStopIndex;
      var onRowsRendered3 = _this.props.onRowsRendered;
      onRowsRendered3({
        overscanStartIndex: rowOverscanStartIndex,
        overscanStopIndex: rowOverscanStopIndex,
        startIndex: rowStartIndex,
        stopIndex: rowStopIndex
      });
    });
    return _this;
  }
  _inherits$a(List2, _React$PureComponent);
  return _createClass$8(List2, [{
    key: "forceUpdateGrid",
    value: function forceUpdateGrid() {
      if (this.Grid) {
        this.Grid.forceUpdate();
      }
    }
    /** See Grid#getOffsetForCell */
  }, {
    key: "getOffsetForRow",
    value: function getOffsetForRow(_ref4) {
      var alignment = _ref4.alignment, index2 = _ref4.index;
      if (this.Grid) {
        var _this$Grid$getOffsetF = this.Grid.getOffsetForCell({
          alignment,
          rowIndex: index2,
          columnIndex: 0
        }), scrollTop = _this$Grid$getOffsetF.scrollTop;
        return scrollTop;
      }
      return 0;
    }
    /** CellMeasurer compatibility */
  }, {
    key: "invalidateCellSizeAfterRender",
    value: function invalidateCellSizeAfterRender(_ref5) {
      var columnIndex = _ref5.columnIndex, rowIndex = _ref5.rowIndex;
      if (this.Grid) {
        this.Grid.invalidateCellSizeAfterRender({
          rowIndex,
          columnIndex
        });
      }
    }
    /** See Grid#measureAllCells */
  }, {
    key: "measureAllRows",
    value: function measureAllRows() {
      if (this.Grid) {
        this.Grid.measureAllCells();
      }
    }
    /** CellMeasurer compatibility */
  }, {
    key: "recomputeGridSize",
    value: function recomputeGridSize() {
      var _ref6 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref6$columnIndex = _ref6.columnIndex, columnIndex = _ref6$columnIndex === void 0 ? 0 : _ref6$columnIndex, _ref6$rowIndex = _ref6.rowIndex, rowIndex = _ref6$rowIndex === void 0 ? 0 : _ref6$rowIndex;
      if (this.Grid) {
        this.Grid.recomputeGridSize({
          rowIndex,
          columnIndex
        });
      }
    }
    /** See Grid#recomputeGridSize */
  }, {
    key: "recomputeRowHeights",
    value: function recomputeRowHeights() {
      var index2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
      if (this.Grid) {
        this.Grid.recomputeGridSize({
          rowIndex: index2,
          columnIndex: 0
        });
      }
    }
    /** See Grid#scrollToPosition */
  }, {
    key: "scrollToPosition",
    value: function scrollToPosition() {
      var scrollTop = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
      if (this.Grid) {
        this.Grid.scrollToPosition({
          scrollTop
        });
      }
    }
    /** See Grid#scrollToCell */
  }, {
    key: "scrollToRow",
    value: function scrollToRow() {
      var index2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
      if (this.Grid) {
        this.Grid.scrollToCell({
          columnIndex: 0,
          rowIndex: index2
        });
      }
    }
  }, {
    key: "render",
    value: function render3() {
      var _this$props = this.props, className = _this$props.className, noRowsRenderer3 = _this$props.noRowsRenderer, scrollToIndex = _this$props.scrollToIndex, width = _this$props.width;
      var classNames2 = clsx("ReactVirtualized__List", className);
      return /* @__PURE__ */ reactExports.createElement(Grid, _extends$h({}, this.props, {
        autoContainerWidth: true,
        cellRenderer: this._cellRenderer,
        className: classNames2,
        columnWidth: width,
        columnCount: 1,
        noContentRenderer: noRowsRenderer3,
        onScroll: this._onScroll,
        onSectionRendered: this._onSectionRendered,
        ref: this._setRef,
        scrollToRow: scrollToIndex
      }));
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$3(List, "defaultProps", {
  autoHeight: false,
  estimatedRowSize: 30,
  onScroll: function onScroll3() {
  },
  noRowsRenderer: function noRowsRenderer() {
    return null;
  },
  onRowsRendered: function onRowsRendered() {
  },
  overscanIndicesGetter: defaultOverscanIndicesGetter,
  overscanRowCount: 10,
  scrollToAlignment: "auto",
  scrollToIndex: -1,
  style: {}
});
function _GEA(a2, l2, h3, y2) {
  var i2 = h3 + 1;
  while (l2 <= h3) {
    var m2 = l2 + h3 >>> 1, x2 = a2[m2];
    if (x2 >= y2) {
      i2 = m2;
      h3 = m2 - 1;
    } else {
      l2 = m2 + 1;
    }
  }
  return i2;
}
function _GEP(a2, l2, h3, y2, c2) {
  var i2 = h3 + 1;
  while (l2 <= h3) {
    var m2 = l2 + h3 >>> 1, x2 = a2[m2];
    if (c2(x2, y2) >= 0) {
      i2 = m2;
      h3 = m2 - 1;
    } else {
      l2 = m2 + 1;
    }
  }
  return i2;
}
function dispatchBsearchGE(a2, y2, c2, l2, h3) {
  if (typeof c2 === "function") {
    return _GEP(a2, l2 === void 0 ? 0 : l2 | 0, h3 === void 0 ? a2.length - 1 : h3 | 0, y2, c2);
  } else {
    return _GEA(a2, c2 === void 0 ? 0 : c2 | 0, l2 === void 0 ? a2.length - 1 : l2 | 0, y2);
  }
}
function _GTA(a2, l2, h3, y2) {
  var i2 = h3 + 1;
  while (l2 <= h3) {
    var m2 = l2 + h3 >>> 1, x2 = a2[m2];
    if (x2 > y2) {
      i2 = m2;
      h3 = m2 - 1;
    } else {
      l2 = m2 + 1;
    }
  }
  return i2;
}
function _GTP(a2, l2, h3, y2, c2) {
  var i2 = h3 + 1;
  while (l2 <= h3) {
    var m2 = l2 + h3 >>> 1, x2 = a2[m2];
    if (c2(x2, y2) > 0) {
      i2 = m2;
      h3 = m2 - 1;
    } else {
      l2 = m2 + 1;
    }
  }
  return i2;
}
function dispatchBsearchGT(a2, y2, c2, l2, h3) {
  if (typeof c2 === "function") {
    return _GTP(a2, l2 === void 0 ? 0 : l2 | 0, h3 === void 0 ? a2.length - 1 : h3 | 0, y2, c2);
  } else {
    return _GTA(a2, c2 === void 0 ? 0 : c2 | 0, l2 === void 0 ? a2.length - 1 : l2 | 0, y2);
  }
}
function _LTA(a2, l2, h3, y2) {
  var i2 = l2 - 1;
  while (l2 <= h3) {
    var m2 = l2 + h3 >>> 1, x2 = a2[m2];
    if (x2 < y2) {
      i2 = m2;
      l2 = m2 + 1;
    } else {
      h3 = m2 - 1;
    }
  }
  return i2;
}
function _LTP(a2, l2, h3, y2, c2) {
  var i2 = l2 - 1;
  while (l2 <= h3) {
    var m2 = l2 + h3 >>> 1, x2 = a2[m2];
    if (c2(x2, y2) < 0) {
      i2 = m2;
      l2 = m2 + 1;
    } else {
      h3 = m2 - 1;
    }
  }
  return i2;
}
function dispatchBsearchLT(a2, y2, c2, l2, h3) {
  if (typeof c2 === "function") {
    return _LTP(a2, l2 === void 0 ? 0 : l2 | 0, h3 === void 0 ? a2.length - 1 : h3 | 0, y2, c2);
  } else {
    return _LTA(a2, c2 === void 0 ? 0 : c2 | 0, l2 === void 0 ? a2.length - 1 : l2 | 0, y2);
  }
}
function _LEA(a2, l2, h3, y2) {
  var i2 = l2 - 1;
  while (l2 <= h3) {
    var m2 = l2 + h3 >>> 1, x2 = a2[m2];
    if (x2 <= y2) {
      i2 = m2;
      l2 = m2 + 1;
    } else {
      h3 = m2 - 1;
    }
  }
  return i2;
}
function _LEP(a2, l2, h3, y2, c2) {
  var i2 = l2 - 1;
  while (l2 <= h3) {
    var m2 = l2 + h3 >>> 1, x2 = a2[m2];
    if (c2(x2, y2) <= 0) {
      i2 = m2;
      l2 = m2 + 1;
    } else {
      h3 = m2 - 1;
    }
  }
  return i2;
}
function dispatchBsearchLE(a2, y2, c2, l2, h3) {
  if (typeof c2 === "function") {
    return _LEP(a2, l2 === void 0 ? 0 : l2 | 0, h3 === void 0 ? a2.length - 1 : h3 | 0, y2, c2);
  } else {
    return _LEA(a2, c2 === void 0 ? 0 : c2 | 0, l2 === void 0 ? a2.length - 1 : l2 | 0, y2);
  }
}
function _EQA(a2, l2, h3, y2) {
  while (l2 <= h3) {
    var m2 = l2 + h3 >>> 1, x2 = a2[m2];
    if (x2 === y2) {
      return m2;
    } else if (x2 <= y2) {
      l2 = m2 + 1;
    } else {
      h3 = m2 - 1;
    }
  }
  return -1;
}
function _EQP(a2, l2, h3, y2, c2) {
  while (l2 <= h3) {
    var m2 = l2 + h3 >>> 1, x2 = a2[m2];
    var p2 = c2(x2, y2);
    if (p2 === 0) {
      return m2;
    } else if (p2 <= 0) {
      l2 = m2 + 1;
    } else {
      h3 = m2 - 1;
    }
  }
  return -1;
}
function dispatchBsearchEQ(a2, y2, c2, l2, h3) {
  if (typeof c2 === "function") {
    return _EQP(a2, l2 === void 0 ? 0 : l2 | 0, h3 === void 0 ? a2.length - 1 : h3 | 0, y2, c2);
  } else {
    return _EQA(a2, c2 === void 0 ? 0 : c2 | 0, l2 === void 0 ? a2.length - 1 : l2 | 0, y2);
  }
}
const bounds = {
  ge: dispatchBsearchGE,
  gt: dispatchBsearchGT,
  lt: dispatchBsearchLT,
  le: dispatchBsearchLE,
  eq: dispatchBsearchEQ
};
var NOT_FOUND = 0;
var SUCCESS = 1;
var EMPTY$1 = 2;
function IntervalTreeNode(mid, left2, right, leftPoints, rightPoints) {
  this.mid = mid;
  this.left = left2;
  this.right = right;
  this.leftPoints = leftPoints;
  this.rightPoints = rightPoints;
  this.count = (left2 ? left2.count : 0) + (right ? right.count : 0) + leftPoints.length;
}
var proto$3 = IntervalTreeNode.prototype;
function copy(a2, b2) {
  a2.mid = b2.mid;
  a2.left = b2.left;
  a2.right = b2.right;
  a2.leftPoints = b2.leftPoints;
  a2.rightPoints = b2.rightPoints;
  a2.count = b2.count;
}
function rebuild(node2, intervals) {
  var ntree = createIntervalTree(intervals);
  node2.mid = ntree.mid;
  node2.left = ntree.left;
  node2.right = ntree.right;
  node2.leftPoints = ntree.leftPoints;
  node2.rightPoints = ntree.rightPoints;
  node2.count = ntree.count;
}
function rebuildWithInterval(node2, interval) {
  var intervals = node2.intervals([]);
  intervals.push(interval);
  rebuild(node2, intervals);
}
function rebuildWithoutInterval(node2, interval) {
  var intervals = node2.intervals([]);
  var idx = intervals.indexOf(interval);
  if (idx < 0) {
    return NOT_FOUND;
  }
  intervals.splice(idx, 1);
  rebuild(node2, intervals);
  return SUCCESS;
}
proto$3.intervals = function(result) {
  result.push.apply(result, this.leftPoints);
  if (this.left) {
    this.left.intervals(result);
  }
  if (this.right) {
    this.right.intervals(result);
  }
  return result;
};
proto$3.insert = function(interval) {
  var weight = this.count - this.leftPoints.length;
  this.count += 1;
  if (interval[1] < this.mid) {
    if (this.left) {
      if (4 * (this.left.count + 1) > 3 * (weight + 1)) {
        rebuildWithInterval(this, interval);
      } else {
        this.left.insert(interval);
      }
    } else {
      this.left = createIntervalTree([interval]);
    }
  } else if (interval[0] > this.mid) {
    if (this.right) {
      if (4 * (this.right.count + 1) > 3 * (weight + 1)) {
        rebuildWithInterval(this, interval);
      } else {
        this.right.insert(interval);
      }
    } else {
      this.right = createIntervalTree([interval]);
    }
  } else {
    var l2 = bounds.ge(this.leftPoints, interval, compareBegin);
    var r2 = bounds.ge(this.rightPoints, interval, compareEnd);
    this.leftPoints.splice(l2, 0, interval);
    this.rightPoints.splice(r2, 0, interval);
  }
};
proto$3.remove = function(interval) {
  var weight = this.count - this.leftPoints;
  if (interval[1] < this.mid) {
    if (!this.left) {
      return NOT_FOUND;
    }
    var rw = this.right ? this.right.count : 0;
    if (4 * rw > 3 * (weight - 1)) {
      return rebuildWithoutInterval(this, interval);
    }
    var r2 = this.left.remove(interval);
    if (r2 === EMPTY$1) {
      this.left = null;
      this.count -= 1;
      return SUCCESS;
    } else if (r2 === SUCCESS) {
      this.count -= 1;
    }
    return r2;
  } else if (interval[0] > this.mid) {
    if (!this.right) {
      return NOT_FOUND;
    }
    var lw = this.left ? this.left.count : 0;
    if (4 * lw > 3 * (weight - 1)) {
      return rebuildWithoutInterval(this, interval);
    }
    var r2 = this.right.remove(interval);
    if (r2 === EMPTY$1) {
      this.right = null;
      this.count -= 1;
      return SUCCESS;
    } else if (r2 === SUCCESS) {
      this.count -= 1;
    }
    return r2;
  } else {
    if (this.count === 1) {
      if (this.leftPoints[0] === interval) {
        return EMPTY$1;
      } else {
        return NOT_FOUND;
      }
    }
    if (this.leftPoints.length === 1 && this.leftPoints[0] === interval) {
      if (this.left && this.right) {
        var p2 = this;
        var n2 = this.left;
        while (n2.right) {
          p2 = n2;
          n2 = n2.right;
        }
        if (p2 === this) {
          n2.right = this.right;
        } else {
          var l2 = this.left;
          var r2 = this.right;
          p2.count -= n2.count;
          p2.right = n2.left;
          n2.left = l2;
          n2.right = r2;
        }
        copy(this, n2);
        this.count = (this.left ? this.left.count : 0) + (this.right ? this.right.count : 0) + this.leftPoints.length;
      } else if (this.left) {
        copy(this, this.left);
      } else {
        copy(this, this.right);
      }
      return SUCCESS;
    }
    for (var l2 = bounds.ge(this.leftPoints, interval, compareBegin); l2 < this.leftPoints.length; ++l2) {
      if (this.leftPoints[l2][0] !== interval[0]) {
        break;
      }
      if (this.leftPoints[l2] === interval) {
        this.count -= 1;
        this.leftPoints.splice(l2, 1);
        for (var r2 = bounds.ge(this.rightPoints, interval, compareEnd); r2 < this.rightPoints.length; ++r2) {
          if (this.rightPoints[r2][1] !== interval[1]) {
            break;
          } else if (this.rightPoints[r2] === interval) {
            this.rightPoints.splice(r2, 1);
            return SUCCESS;
          }
        }
      }
    }
    return NOT_FOUND;
  }
};
function reportLeftRange(arr, hi2, cb2) {
  for (var i2 = 0; i2 < arr.length && arr[i2][0] <= hi2; ++i2) {
    var r2 = cb2(arr[i2]);
    if (r2) {
      return r2;
    }
  }
}
function reportRightRange(arr, lo, cb2) {
  for (var i2 = arr.length - 1; i2 >= 0 && arr[i2][1] >= lo; --i2) {
    var r2 = cb2(arr[i2]);
    if (r2) {
      return r2;
    }
  }
}
function reportRange(arr, cb2) {
  for (var i2 = 0; i2 < arr.length; ++i2) {
    var r2 = cb2(arr[i2]);
    if (r2) {
      return r2;
    }
  }
}
proto$3.queryPoint = function(x2, cb2) {
  if (x2 < this.mid) {
    if (this.left) {
      var r2 = this.left.queryPoint(x2, cb2);
      if (r2) {
        return r2;
      }
    }
    return reportLeftRange(this.leftPoints, x2, cb2);
  } else if (x2 > this.mid) {
    if (this.right) {
      var r2 = this.right.queryPoint(x2, cb2);
      if (r2) {
        return r2;
      }
    }
    return reportRightRange(this.rightPoints, x2, cb2);
  } else {
    return reportRange(this.leftPoints, cb2);
  }
};
proto$3.queryInterval = function(lo, hi2, cb2) {
  if (lo < this.mid && this.left) {
    var r2 = this.left.queryInterval(lo, hi2, cb2);
    if (r2) {
      return r2;
    }
  }
  if (hi2 > this.mid && this.right) {
    var r2 = this.right.queryInterval(lo, hi2, cb2);
    if (r2) {
      return r2;
    }
  }
  if (hi2 < this.mid) {
    return reportLeftRange(this.leftPoints, hi2, cb2);
  } else if (lo > this.mid) {
    return reportRightRange(this.rightPoints, lo, cb2);
  } else {
    return reportRange(this.leftPoints, cb2);
  }
};
function compareNumbers(a2, b2) {
  return a2 - b2;
}
function compareBegin(a2, b2) {
  var d2 = a2[0] - b2[0];
  if (d2) {
    return d2;
  }
  return a2[1] - b2[1];
}
function compareEnd(a2, b2) {
  var d2 = a2[1] - b2[1];
  if (d2) {
    return d2;
  }
  return a2[0] - b2[0];
}
function createIntervalTree(intervals) {
  if (intervals.length === 0) {
    return null;
  }
  var pts = [];
  for (var i2 = 0; i2 < intervals.length; ++i2) {
    pts.push(intervals[i2][0], intervals[i2][1]);
  }
  pts.sort(compareNumbers);
  var mid = pts[pts.length >> 1];
  var leftIntervals = [];
  var rightIntervals = [];
  var centerIntervals = [];
  for (var i2 = 0; i2 < intervals.length; ++i2) {
    var s2 = intervals[i2];
    if (s2[1] < mid) {
      leftIntervals.push(s2);
    } else if (mid < s2[0]) {
      rightIntervals.push(s2);
    } else {
      centerIntervals.push(s2);
    }
  }
  var leftPoints = centerIntervals;
  var rightPoints = centerIntervals.slice();
  leftPoints.sort(compareBegin);
  rightPoints.sort(compareEnd);
  return new IntervalTreeNode(mid, createIntervalTree(leftIntervals), createIntervalTree(rightIntervals), leftPoints, rightPoints);
}
function IntervalTree(root2) {
  this.root = root2;
}
var tproto = IntervalTree.prototype;
tproto.insert = function(interval) {
  if (this.root) {
    this.root.insert(interval);
  } else {
    this.root = new IntervalTreeNode(interval[0], null, null, [interval], [interval]);
  }
};
tproto.remove = function(interval) {
  if (this.root) {
    var r2 = this.root.remove(interval);
    if (r2 === EMPTY$1) {
      this.root = null;
    }
    return r2 !== NOT_FOUND;
  }
  return false;
};
tproto.queryPoint = function(p2, cb2) {
  if (this.root) {
    return this.root.queryPoint(p2, cb2);
  }
};
tproto.queryInterval = function(lo, hi2, cb2) {
  if (lo <= hi2 && this.root) {
    return this.root.queryInterval(lo, hi2, cb2);
  }
};
Object.defineProperty(tproto, "count", {
  get: function get2() {
    if (this.root) {
      return this.root.count;
    }
    return 0;
  }
});
Object.defineProperty(tproto, "intervals", {
  get: function get3() {
    if (this.root) {
      return this.root.intervals([]);
    }
    return [];
  }
});
function createWrapper(intervals) {
  {
    return new IntervalTree(null);
  }
}
var PositionCache = /* @__PURE__ */ function() {
  function PositionCache2() {
    _classCallCheck$a(this, PositionCache2);
    _defineProperty$3(this, "_columnSizeMap", {});
    _defineProperty$3(this, "_intervalTree", createWrapper());
    _defineProperty$3(this, "_leftMap", {});
  }
  return _createClass$8(PositionCache2, [{
    key: "estimateTotalHeight",
    value: function estimateTotalHeight(cellCount, columnCount, defaultCellHeight) {
      var unmeasuredCellCount = cellCount - this.count;
      return this.tallestColumnSize + Math.ceil(unmeasuredCellCount / columnCount) * defaultCellHeight;
    }
    // Render all cells visible within the viewport range defined.
  }, {
    key: "range",
    value: function range3(scrollTop, clientHeight, renderCallback) {
      var _this = this;
      this._intervalTree.queryInterval(scrollTop, scrollTop + clientHeight, function(_ref) {
        var _ref2 = _slicedToArray(_ref, 3), top2 = _ref2[0];
        _ref2[1];
        var index2 = _ref2[2];
        return renderCallback(index2, _this._leftMap[index2], top2);
      });
    }
  }, {
    key: "setPosition",
    value: function setPosition(index2, left2, top2, height) {
      this._intervalTree.insert([top2, top2 + height, index2]);
      this._leftMap[index2] = left2;
      var columnSizeMap = this._columnSizeMap;
      var columnHeight = columnSizeMap[left2];
      if (columnHeight === void 0) {
        columnSizeMap[left2] = top2 + height;
      } else {
        columnSizeMap[left2] = Math.max(columnHeight, top2 + height);
      }
    }
  }, {
    key: "count",
    get: function get5() {
      return this._intervalTree.count;
    }
  }, {
    key: "shortestColumnSize",
    get: function get5() {
      var columnSizeMap = this._columnSizeMap;
      var size2 = 0;
      for (var i2 in columnSizeMap) {
        var height = columnSizeMap[i2];
        size2 = size2 === 0 ? height : Math.min(size2, height);
      }
      return size2;
    }
  }, {
    key: "tallestColumnSize",
    get: function get5() {
      var columnSizeMap = this._columnSizeMap;
      var size2 = 0;
      for (var i2 in columnSizeMap) {
        var height = columnSizeMap[i2];
        size2 = Math.max(size2, height);
      }
      return size2;
    }
  }]);
}();
function ownKeys$5(e2, r2) {
  var t2 = Object.keys(e2);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e2);
    r2 && (o2 = o2.filter(function(r3) {
      return Object.getOwnPropertyDescriptor(e2, r3).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread$6(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys$5(Object(t2), true).forEach(function(r3) {
      _defineProperty$3(e2, r3, t2[r3]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$5(Object(t2)).forEach(function(r3) {
      Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3));
    });
  }
  return e2;
}
function _callSuper$5(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$5() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$5() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t3) {
  }
  return (_isNativeReflectConstruct$5 = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var emptyObject = {};
var DEFAULT_SCROLLING_RESET_TIME_INTERVAL = 150;
var Masonry = /* @__PURE__ */ function(_React$PureComponent) {
  function Masonry2() {
    var _this;
    _classCallCheck$a(this, Masonry2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _callSuper$5(this, Masonry2, [].concat(args));
    _defineProperty$3(_this, "state", {
      isScrolling: false,
      scrollTop: 0
    });
    _defineProperty$3(_this, "_debounceResetIsScrollingId", void 0);
    _defineProperty$3(_this, "_invalidateOnUpdateStartIndex", null);
    _defineProperty$3(_this, "_invalidateOnUpdateStopIndex", null);
    _defineProperty$3(_this, "_positionCache", new PositionCache());
    _defineProperty$3(_this, "_startIndex", null);
    _defineProperty$3(_this, "_startIndexMemoized", null);
    _defineProperty$3(_this, "_stopIndex", null);
    _defineProperty$3(_this, "_stopIndexMemoized", null);
    _defineProperty$3(_this, "_debounceResetIsScrollingCallback", function() {
      _this.setState({
        isScrolling: false
      });
    });
    _defineProperty$3(_this, "_setScrollingContainerRef", function(ref) {
      _this._scrollingContainer = ref;
    });
    _defineProperty$3(_this, "_onScroll", function(event) {
      var height = _this.props.height;
      var eventScrollTop = event.currentTarget.scrollTop;
      var scrollTop = Math.min(Math.max(0, _this._getEstimatedTotalHeight() - height), eventScrollTop);
      if (eventScrollTop !== scrollTop) {
        return;
      }
      _this._debounceResetIsScrolling();
      if (_this.state.scrollTop !== scrollTop) {
        _this.setState({
          isScrolling: true,
          scrollTop
        });
      }
    });
    return _this;
  }
  _inherits$a(Masonry2, _React$PureComponent);
  return _createClass$8(Masonry2, [{
    key: "clearCellPositions",
    value: function clearCellPositions() {
      this._positionCache = new PositionCache();
      this.forceUpdate();
    }
    // HACK This method signature was intended for Grid
  }, {
    key: "invalidateCellSizeAfterRender",
    value: function invalidateCellSizeAfterRender(_ref) {
      var index2 = _ref.rowIndex;
      if (this._invalidateOnUpdateStartIndex === null) {
        this._invalidateOnUpdateStartIndex = index2;
        this._invalidateOnUpdateStopIndex = index2;
      } else {
        this._invalidateOnUpdateStartIndex = Math.min(this._invalidateOnUpdateStartIndex, index2);
        this._invalidateOnUpdateStopIndex = Math.max(this._invalidateOnUpdateStopIndex, index2);
      }
    }
  }, {
    key: "recomputeCellPositions",
    value: function recomputeCellPositions() {
      var stopIndex = this._positionCache.count - 1;
      this._positionCache = new PositionCache();
      this._populatePositionCache(0, stopIndex);
      this.forceUpdate();
    }
  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      this._checkInvalidateOnUpdate();
      this._invokeOnScrollCallback();
      this._invokeOnCellsRenderedCallback();
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate(prevProps, prevState) {
      this._checkInvalidateOnUpdate();
      this._invokeOnScrollCallback();
      this._invokeOnCellsRenderedCallback();
      if (this.props.scrollTop !== prevProps.scrollTop) {
        this._debounceResetIsScrolling();
      }
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      if (this._debounceResetIsScrollingId) {
        cancelAnimationTimeout(this._debounceResetIsScrollingId);
      }
    }
  }, {
    key: "render",
    value: function render3() {
      var _this2 = this;
      var _this$props = this.props, autoHeight = _this$props.autoHeight, cellCount = _this$props.cellCount, cellMeasurerCache = _this$props.cellMeasurerCache, cellRenderer = _this$props.cellRenderer, className = _this$props.className, height = _this$props.height, id2 = _this$props.id, keyMapper = _this$props.keyMapper, overscanByPixels = _this$props.overscanByPixels, role = _this$props.role, style2 = _this$props.style, tabIndex = _this$props.tabIndex, width = _this$props.width, rowDirection = _this$props.rowDirection;
      var _this$state = this.state, isScrolling = _this$state.isScrolling, scrollTop = _this$state.scrollTop;
      var children = [];
      var estimateTotalHeight = this._getEstimatedTotalHeight();
      var shortestColumnSize = this._positionCache.shortestColumnSize;
      var measuredCellCount = this._positionCache.count;
      var startIndex = 0;
      var stopIndex;
      this._positionCache.range(Math.max(0, scrollTop - overscanByPixels), height + overscanByPixels * 2, function(index2, left2, top2) {
        if (typeof stopIndex === "undefined") {
          startIndex = index2;
          stopIndex = index2;
        } else {
          startIndex = Math.min(startIndex, index2);
          stopIndex = Math.max(stopIndex, index2);
        }
        children.push(cellRenderer({
          index: index2,
          isScrolling,
          key: keyMapper(index2),
          parent: _this2,
          style: _defineProperty$3(_defineProperty$3(_defineProperty$3(_defineProperty$3({
            height: cellMeasurerCache.getHeight(index2)
          }, rowDirection === "ltr" ? "left" : "right", left2), "position", "absolute"), "top", top2), "width", cellMeasurerCache.getWidth(index2))
        }));
      });
      if (shortestColumnSize < scrollTop + height + overscanByPixels && measuredCellCount < cellCount) {
        var batchSize = Math.min(cellCount - measuredCellCount, Math.ceil((scrollTop + height + overscanByPixels - shortestColumnSize) / cellMeasurerCache.defaultHeight * width / cellMeasurerCache.defaultWidth));
        for (var _index = measuredCellCount; _index < measuredCellCount + batchSize; _index++) {
          stopIndex = _index;
          children.push(cellRenderer({
            index: _index,
            isScrolling,
            key: keyMapper(_index),
            parent: this,
            style: {
              width: cellMeasurerCache.getWidth(_index)
            }
          }));
        }
      }
      this._startIndex = startIndex;
      this._stopIndex = stopIndex;
      return /* @__PURE__ */ reactExports.createElement("div", {
        ref: this._setScrollingContainerRef,
        "aria-label": this.props["aria-label"],
        className: clsx("ReactVirtualized__Masonry", className),
        id: id2,
        onScroll: this._onScroll,
        role,
        style: _objectSpread$6({
          boxSizing: "border-box",
          direction: "ltr",
          height: autoHeight ? "auto" : height,
          overflowX: "hidden",
          overflowY: estimateTotalHeight < height ? "hidden" : "auto",
          position: "relative",
          width,
          WebkitOverflowScrolling: "touch",
          willChange: "transform"
        }, style2),
        tabIndex
      }, /* @__PURE__ */ reactExports.createElement("div", {
        className: "ReactVirtualized__Masonry__innerScrollContainer",
        style: {
          width: "100%",
          height: estimateTotalHeight,
          maxWidth: "100%",
          maxHeight: estimateTotalHeight,
          overflow: "hidden",
          pointerEvents: isScrolling ? "none" : "",
          position: "relative"
        }
      }, children));
    }
  }, {
    key: "_checkInvalidateOnUpdate",
    value: function _checkInvalidateOnUpdate() {
      if (typeof this._invalidateOnUpdateStartIndex === "number") {
        var startIndex = this._invalidateOnUpdateStartIndex;
        var stopIndex = this._invalidateOnUpdateStopIndex;
        this._invalidateOnUpdateStartIndex = null;
        this._invalidateOnUpdateStopIndex = null;
        this._populatePositionCache(startIndex, stopIndex);
        this.forceUpdate();
      }
    }
  }, {
    key: "_debounceResetIsScrolling",
    value: function _debounceResetIsScrolling() {
      var scrollingResetTimeInterval = this.props.scrollingResetTimeInterval;
      if (this._debounceResetIsScrollingId) {
        cancelAnimationTimeout(this._debounceResetIsScrollingId);
      }
      this._debounceResetIsScrollingId = requestAnimationTimeout(this._debounceResetIsScrollingCallback, scrollingResetTimeInterval);
    }
  }, {
    key: "_getEstimatedTotalHeight",
    value: function _getEstimatedTotalHeight() {
      var _this$props2 = this.props, cellCount = _this$props2.cellCount, cellMeasurerCache = _this$props2.cellMeasurerCache, width = _this$props2.width;
      var estimatedColumnCount = Math.max(1, Math.floor(width / cellMeasurerCache.defaultWidth));
      return this._positionCache.estimateTotalHeight(cellCount, estimatedColumnCount, cellMeasurerCache.defaultHeight);
    }
  }, {
    key: "_invokeOnScrollCallback",
    value: function _invokeOnScrollCallback() {
      var _this$props3 = this.props, height = _this$props3.height, onScroll6 = _this$props3.onScroll;
      var scrollTop = this.state.scrollTop;
      if (this._onScrollMemoized !== scrollTop) {
        onScroll6({
          clientHeight: height,
          scrollHeight: this._getEstimatedTotalHeight(),
          scrollTop
        });
        this._onScrollMemoized = scrollTop;
      }
    }
  }, {
    key: "_invokeOnCellsRenderedCallback",
    value: function _invokeOnCellsRenderedCallback() {
      if (this._startIndexMemoized !== this._startIndex || this._stopIndexMemoized !== this._stopIndex) {
        var onCellsRendered = this.props.onCellsRendered;
        onCellsRendered({
          startIndex: this._startIndex,
          stopIndex: this._stopIndex
        });
        this._startIndexMemoized = this._startIndex;
        this._stopIndexMemoized = this._stopIndex;
      }
    }
  }, {
    key: "_populatePositionCache",
    value: function _populatePositionCache(startIndex, stopIndex) {
      var _this$props4 = this.props, cellMeasurerCache = _this$props4.cellMeasurerCache, cellPositioner = _this$props4.cellPositioner;
      for (var _index2 = startIndex; _index2 <= stopIndex; _index2++) {
        var _cellPositioner = cellPositioner(_index2), left2 = _cellPositioner.left, top2 = _cellPositioner.top;
        this._positionCache.setPosition(_index2, left2, top2, cellMeasurerCache.getHeight(_index2));
      }
    }
  }], [{
    key: "getDerivedStateFromProps",
    value: function getDerivedStateFromProps(nextProps, prevState) {
      if (nextProps.scrollTop !== void 0 && prevState.scrollTop !== nextProps.scrollTop) {
        return {
          isScrolling: true,
          scrollTop: nextProps.scrollTop
        };
      }
      return null;
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$3(Masonry, "defaultProps", {
  autoHeight: false,
  keyMapper: identity,
  onCellsRendered: noop$2,
  onScroll: noop$2,
  overscanByPixels: 20,
  role: "grid",
  scrollingResetTimeInterval: DEFAULT_SCROLLING_RESET_TIME_INTERVAL,
  style: emptyObject,
  tabIndex: 0,
  rowDirection: "ltr"
});
function identity(value2) {
  return value2;
}
function noop$2() {
}
polyfill2(Masonry);
var CellMeasurerCacheDecorator = /* @__PURE__ */ function() {
  function CellMeasurerCacheDecorator2() {
    var _this = this;
    var params = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    _classCallCheck$a(this, CellMeasurerCacheDecorator2);
    _defineProperty$3(this, "_cellMeasurerCache", void 0);
    _defineProperty$3(this, "_columnIndexOffset", void 0);
    _defineProperty$3(this, "_rowIndexOffset", void 0);
    _defineProperty$3(this, "columnWidth", function(_ref) {
      var index2 = _ref.index;
      _this._cellMeasurerCache.columnWidth({
        index: index2 + _this._columnIndexOffset
      });
    });
    _defineProperty$3(this, "rowHeight", function(_ref2) {
      var index2 = _ref2.index;
      _this._cellMeasurerCache.rowHeight({
        index: index2 + _this._rowIndexOffset
      });
    });
    var cellMeasurerCache = params.cellMeasurerCache, _params$columnIndexOf = params.columnIndexOffset, columnIndexOffset = _params$columnIndexOf === void 0 ? 0 : _params$columnIndexOf, _params$rowIndexOffse = params.rowIndexOffset, rowIndexOffset = _params$rowIndexOffse === void 0 ? 0 : _params$rowIndexOffse;
    this._cellMeasurerCache = cellMeasurerCache;
    this._columnIndexOffset = columnIndexOffset;
    this._rowIndexOffset = rowIndexOffset;
  }
  return _createClass$8(CellMeasurerCacheDecorator2, [{
    key: "clear",
    value: function clear(rowIndex, columnIndex) {
      this._cellMeasurerCache.clear(rowIndex + this._rowIndexOffset, columnIndex + this._columnIndexOffset);
    }
  }, {
    key: "clearAll",
    value: function clearAll() {
      this._cellMeasurerCache.clearAll();
    }
  }, {
    key: "defaultHeight",
    get: function get5() {
      return this._cellMeasurerCache.defaultHeight;
    }
  }, {
    key: "defaultWidth",
    get: function get5() {
      return this._cellMeasurerCache.defaultWidth;
    }
  }, {
    key: "hasFixedHeight",
    value: function hasFixedHeight() {
      return this._cellMeasurerCache.hasFixedHeight();
    }
  }, {
    key: "hasFixedWidth",
    value: function hasFixedWidth() {
      return this._cellMeasurerCache.hasFixedWidth();
    }
  }, {
    key: "getHeight",
    value: function getHeight4(rowIndex) {
      var columnIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      return this._cellMeasurerCache.getHeight(rowIndex + this._rowIndexOffset, columnIndex + this._columnIndexOffset);
    }
  }, {
    key: "getWidth",
    value: function getWidth3(rowIndex) {
      var columnIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      return this._cellMeasurerCache.getWidth(rowIndex + this._rowIndexOffset, columnIndex + this._columnIndexOffset);
    }
  }, {
    key: "has",
    value: function has2(rowIndex) {
      var columnIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      return this._cellMeasurerCache.has(rowIndex + this._rowIndexOffset, columnIndex + this._columnIndexOffset);
    }
  }, {
    key: "set",
    value: function set2(rowIndex, columnIndex, width, height) {
      this._cellMeasurerCache.set(rowIndex + this._rowIndexOffset, columnIndex + this._columnIndexOffset, width, height);
    }
  }]);
}();
var _excluded$4 = ["rowIndex"], _excluded2$1 = ["columnIndex", "rowIndex"], _excluded3 = ["columnIndex"], _excluded4 = ["onScroll", "onSectionRendered", "onScrollbarPresenceChange", "scrollLeft", "scrollToColumn", "scrollTop", "scrollToRow"];
function ownKeys$4(e2, r2) {
  var t2 = Object.keys(e2);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e2);
    r2 && (o2 = o2.filter(function(r22) {
      return Object.getOwnPropertyDescriptor(e2, r22).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread$5(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys$4(Object(t2), true).forEach(function(r22) {
      _defineProperty$3(e2, r22, t2[r22]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$4(Object(t2)).forEach(function(r22) {
      Object.defineProperty(e2, r22, Object.getOwnPropertyDescriptor(t2, r22));
    });
  }
  return e2;
}
function _callSuper$4(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$4() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$4() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t22) {
  }
  return (_isNativeReflectConstruct$4 = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var SCROLLBAR_SIZE_BUFFER = 20;
var MultiGrid = /* @__PURE__ */ function(_React$PureComponent) {
  function MultiGrid2(props, context) {
    var _this;
    _classCallCheck$a(this, MultiGrid2);
    _this = _callSuper$4(this, MultiGrid2, [props, context]);
    _defineProperty$3(_this, "state", {
      scrollLeft: 0,
      scrollTop: 0,
      scrollbarSize: 0,
      showHorizontalScrollbar: false,
      showVerticalScrollbar: false
    });
    _defineProperty$3(_this, "_deferredInvalidateColumnIndex", null);
    _defineProperty$3(_this, "_deferredInvalidateRowIndex", null);
    _defineProperty$3(_this, "_bottomLeftGridRef", function(ref) {
      _this._bottomLeftGrid = ref;
    });
    _defineProperty$3(_this, "_bottomRightGridRef", function(ref) {
      _this._bottomRightGrid = ref;
    });
    _defineProperty$3(_this, "_cellRendererBottomLeftGrid", function(_ref) {
      var rowIndex = _ref.rowIndex, rest = _objectWithoutProperties$3(_ref, _excluded$4);
      var _this$props = _this.props, cellRenderer = _this$props.cellRenderer, fixedRowCount = _this$props.fixedRowCount, rowCount = _this$props.rowCount;
      if (rowIndex === rowCount - fixedRowCount) {
        return /* @__PURE__ */ reactExports.createElement("div", {
          key: rest.key,
          style: _objectSpread$5(_objectSpread$5({}, rest.style), {}, {
            height: SCROLLBAR_SIZE_BUFFER
          })
        });
      } else {
        return cellRenderer(_objectSpread$5(_objectSpread$5({}, rest), {}, {
          parent: _this,
          rowIndex: rowIndex + fixedRowCount
        }));
      }
    });
    _defineProperty$3(_this, "_cellRendererBottomRightGrid", function(_ref2) {
      var columnIndex = _ref2.columnIndex, rowIndex = _ref2.rowIndex, rest = _objectWithoutProperties$3(_ref2, _excluded2$1);
      var _this$props2 = _this.props, cellRenderer = _this$props2.cellRenderer, fixedColumnCount = _this$props2.fixedColumnCount, fixedRowCount = _this$props2.fixedRowCount;
      return cellRenderer(_objectSpread$5(_objectSpread$5({}, rest), {}, {
        columnIndex: columnIndex + fixedColumnCount,
        parent: _this,
        rowIndex: rowIndex + fixedRowCount
      }));
    });
    _defineProperty$3(_this, "_cellRendererTopRightGrid", function(_ref3) {
      var columnIndex = _ref3.columnIndex, rest = _objectWithoutProperties$3(_ref3, _excluded3);
      var _this$props3 = _this.props, cellRenderer = _this$props3.cellRenderer, columnCount = _this$props3.columnCount, fixedColumnCount = _this$props3.fixedColumnCount;
      if (columnIndex === columnCount - fixedColumnCount) {
        return /* @__PURE__ */ reactExports.createElement("div", {
          key: rest.key,
          style: _objectSpread$5(_objectSpread$5({}, rest.style), {}, {
            width: SCROLLBAR_SIZE_BUFFER
          })
        });
      } else {
        return cellRenderer(_objectSpread$5(_objectSpread$5({}, rest), {}, {
          columnIndex: columnIndex + fixedColumnCount,
          parent: _this
        }));
      }
    });
    _defineProperty$3(_this, "_columnWidthRightGrid", function(_ref4) {
      var index2 = _ref4.index;
      var _this$props4 = _this.props, columnCount = _this$props4.columnCount, fixedColumnCount = _this$props4.fixedColumnCount, columnWidth = _this$props4.columnWidth;
      var _this$state = _this.state, scrollbarSize2 = _this$state.scrollbarSize, showHorizontalScrollbar = _this$state.showHorizontalScrollbar;
      if (showHorizontalScrollbar && index2 === columnCount - fixedColumnCount) {
        return scrollbarSize2;
      }
      return typeof columnWidth === "function" ? columnWidth({
        index: index2 + fixedColumnCount
      }) : columnWidth;
    });
    _defineProperty$3(_this, "_onScroll", function(scrollInfo) {
      var scrollLeft = scrollInfo.scrollLeft, scrollTop = scrollInfo.scrollTop;
      _this.setState({
        scrollLeft,
        scrollTop
      });
      var onScroll6 = _this.props.onScroll;
      if (onScroll6) {
        onScroll6(scrollInfo);
      }
    });
    _defineProperty$3(_this, "_onScrollbarPresenceChange", function(_ref5) {
      var horizontal = _ref5.horizontal, size2 = _ref5.size, vertical = _ref5.vertical;
      var _this$state2 = _this.state, showHorizontalScrollbar = _this$state2.showHorizontalScrollbar, showVerticalScrollbar = _this$state2.showVerticalScrollbar;
      if (horizontal !== showHorizontalScrollbar || vertical !== showVerticalScrollbar) {
        _this.setState({
          scrollbarSize: size2,
          showHorizontalScrollbar: horizontal,
          showVerticalScrollbar: vertical
        });
        var onScrollbarPresenceChange2 = _this.props.onScrollbarPresenceChange;
        if (typeof onScrollbarPresenceChange2 === "function") {
          onScrollbarPresenceChange2({
            horizontal,
            size: size2,
            vertical
          });
        }
      }
    });
    _defineProperty$3(_this, "_onScrollLeft", function(scrollInfo) {
      var scrollLeft = scrollInfo.scrollLeft;
      _this._onScroll({
        scrollLeft,
        scrollTop: _this.state.scrollTop
      });
    });
    _defineProperty$3(_this, "_onScrollTop", function(scrollInfo) {
      var scrollTop = scrollInfo.scrollTop;
      _this._onScroll({
        scrollTop,
        scrollLeft: _this.state.scrollLeft
      });
    });
    _defineProperty$3(_this, "_rowHeightBottomGrid", function(_ref6) {
      var index2 = _ref6.index;
      var _this$props5 = _this.props, fixedRowCount = _this$props5.fixedRowCount, rowCount = _this$props5.rowCount, rowHeight = _this$props5.rowHeight;
      var _this$state3 = _this.state, scrollbarSize2 = _this$state3.scrollbarSize, showVerticalScrollbar = _this$state3.showVerticalScrollbar;
      if (showVerticalScrollbar && index2 === rowCount - fixedRowCount) {
        return scrollbarSize2;
      }
      return typeof rowHeight === "function" ? rowHeight({
        index: index2 + fixedRowCount
      }) : rowHeight;
    });
    _defineProperty$3(_this, "_topLeftGridRef", function(ref) {
      _this._topLeftGrid = ref;
    });
    _defineProperty$3(_this, "_topRightGridRef", function(ref) {
      _this._topRightGrid = ref;
    });
    var deferredMeasurementCache = props.deferredMeasurementCache, _fixedColumnCount = props.fixedColumnCount, _fixedRowCount = props.fixedRowCount;
    _this._maybeCalculateCachedStyles(true);
    if (deferredMeasurementCache) {
      _this._deferredMeasurementCacheBottomLeftGrid = _fixedRowCount > 0 ? new CellMeasurerCacheDecorator({
        cellMeasurerCache: deferredMeasurementCache,
        columnIndexOffset: 0,
        rowIndexOffset: _fixedRowCount
      }) : deferredMeasurementCache;
      _this._deferredMeasurementCacheBottomRightGrid = _fixedColumnCount > 0 || _fixedRowCount > 0 ? new CellMeasurerCacheDecorator({
        cellMeasurerCache: deferredMeasurementCache,
        columnIndexOffset: _fixedColumnCount,
        rowIndexOffset: _fixedRowCount
      }) : deferredMeasurementCache;
      _this._deferredMeasurementCacheTopRightGrid = _fixedColumnCount > 0 ? new CellMeasurerCacheDecorator({
        cellMeasurerCache: deferredMeasurementCache,
        columnIndexOffset: _fixedColumnCount,
        rowIndexOffset: 0
      }) : deferredMeasurementCache;
    }
    return _this;
  }
  _inherits$a(MultiGrid2, _React$PureComponent);
  return _createClass$8(MultiGrid2, [{
    key: "forceUpdateGrids",
    value: function forceUpdateGrids() {
      this._bottomLeftGrid && this._bottomLeftGrid.forceUpdate();
      this._bottomRightGrid && this._bottomRightGrid.forceUpdate();
      this._topLeftGrid && this._topLeftGrid.forceUpdate();
      this._topRightGrid && this._topRightGrid.forceUpdate();
    }
    /** See Grid#invalidateCellSizeAfterRender */
  }, {
    key: "invalidateCellSizeAfterRender",
    value: function invalidateCellSizeAfterRender() {
      var _ref7 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref7$columnIndex = _ref7.columnIndex, columnIndex = _ref7$columnIndex === void 0 ? 0 : _ref7$columnIndex, _ref7$rowIndex = _ref7.rowIndex, rowIndex = _ref7$rowIndex === void 0 ? 0 : _ref7$rowIndex;
      this._deferredInvalidateColumnIndex = typeof this._deferredInvalidateColumnIndex === "number" ? Math.min(this._deferredInvalidateColumnIndex, columnIndex) : columnIndex;
      this._deferredInvalidateRowIndex = typeof this._deferredInvalidateRowIndex === "number" ? Math.min(this._deferredInvalidateRowIndex, rowIndex) : rowIndex;
    }
    /** See Grid#measureAllCells */
  }, {
    key: "measureAllCells",
    value: function measureAllCells() {
      this._bottomLeftGrid && this._bottomLeftGrid.measureAllCells();
      this._bottomRightGrid && this._bottomRightGrid.measureAllCells();
      this._topLeftGrid && this._topLeftGrid.measureAllCells();
      this._topRightGrid && this._topRightGrid.measureAllCells();
    }
    /** See Grid#recomputeGridSize */
  }, {
    key: "recomputeGridSize",
    value: function recomputeGridSize() {
      var _ref8 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref8$columnIndex = _ref8.columnIndex, columnIndex = _ref8$columnIndex === void 0 ? 0 : _ref8$columnIndex, _ref8$rowIndex = _ref8.rowIndex, rowIndex = _ref8$rowIndex === void 0 ? 0 : _ref8$rowIndex;
      var _this$props6 = this.props, fixedColumnCount = _this$props6.fixedColumnCount, fixedRowCount = _this$props6.fixedRowCount;
      var adjustedColumnIndex = Math.max(0, columnIndex - fixedColumnCount);
      var adjustedRowIndex = Math.max(0, rowIndex - fixedRowCount);
      this._bottomLeftGrid && this._bottomLeftGrid.recomputeGridSize({
        columnIndex,
        rowIndex: adjustedRowIndex
      });
      this._bottomRightGrid && this._bottomRightGrid.recomputeGridSize({
        columnIndex: adjustedColumnIndex,
        rowIndex: adjustedRowIndex
      });
      this._topLeftGrid && this._topLeftGrid.recomputeGridSize({
        columnIndex,
        rowIndex
      });
      this._topRightGrid && this._topRightGrid.recomputeGridSize({
        columnIndex: adjustedColumnIndex,
        rowIndex
      });
      this._leftGridWidth = null;
      this._topGridHeight = null;
      this._maybeCalculateCachedStyles(true);
    }
  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      var _this$props7 = this.props, scrollLeft = _this$props7.scrollLeft, scrollTop = _this$props7.scrollTop;
      if (scrollLeft > 0 || scrollTop > 0) {
        var newState = {};
        if (scrollLeft > 0) {
          newState.scrollLeft = scrollLeft;
        }
        if (scrollTop > 0) {
          newState.scrollTop = scrollTop;
        }
        this.setState(newState);
      }
      this._handleInvalidatedGridSize();
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate() {
      this._handleInvalidatedGridSize();
    }
  }, {
    key: "render",
    value: function render3() {
      var _this$props8 = this.props, onScroll6 = _this$props8.onScroll, onSectionRendered3 = _this$props8.onSectionRendered;
      _this$props8.onScrollbarPresenceChange;
      _this$props8.scrollLeft;
      var scrollToColumn = _this$props8.scrollToColumn;
      _this$props8.scrollTop;
      var scrollToRow = _this$props8.scrollToRow, rest = _objectWithoutProperties$3(_this$props8, _excluded4);
      this._prepareForRender();
      if (this.props.width === 0 || this.props.height === 0) {
        return null;
      }
      var _this$state4 = this.state, scrollLeft = _this$state4.scrollLeft, scrollTop = _this$state4.scrollTop;
      return /* @__PURE__ */ reactExports.createElement("div", {
        style: this._containerOuterStyle
      }, /* @__PURE__ */ reactExports.createElement("div", {
        style: this._containerTopStyle
      }, this._renderTopLeftGrid(rest), this._renderTopRightGrid(_objectSpread$5(_objectSpread$5({}, rest), {}, {
        onScroll: onScroll6,
        scrollLeft
      }))), /* @__PURE__ */ reactExports.createElement("div", {
        style: this._containerBottomStyle
      }, this._renderBottomLeftGrid(_objectSpread$5(_objectSpread$5({}, rest), {}, {
        onScroll: onScroll6,
        scrollTop
      })), this._renderBottomRightGrid(_objectSpread$5(_objectSpread$5({}, rest), {}, {
        onScroll: onScroll6,
        onSectionRendered: onSectionRendered3,
        scrollLeft,
        scrollToColumn,
        scrollToRow,
        scrollTop
      }))));
    }
  }, {
    key: "_getBottomGridHeight",
    value: function _getBottomGridHeight(props) {
      var height = props.height;
      var topGridHeight = this._getTopGridHeight(props);
      return height - topGridHeight;
    }
  }, {
    key: "_getLeftGridWidth",
    value: function _getLeftGridWidth(props) {
      var fixedColumnCount = props.fixedColumnCount, columnWidth = props.columnWidth;
      if (this._leftGridWidth == null) {
        if (typeof columnWidth === "function") {
          var leftGridWidth = 0;
          for (var index2 = 0; index2 < fixedColumnCount; index2++) {
            leftGridWidth += columnWidth({
              index: index2
            });
          }
          this._leftGridWidth = leftGridWidth;
        } else {
          this._leftGridWidth = columnWidth * fixedColumnCount;
        }
      }
      return this._leftGridWidth;
    }
  }, {
    key: "_getRightGridWidth",
    value: function _getRightGridWidth(props) {
      var width = props.width;
      var leftGridWidth = this._getLeftGridWidth(props);
      return width - leftGridWidth;
    }
  }, {
    key: "_getTopGridHeight",
    value: function _getTopGridHeight(props) {
      var fixedRowCount = props.fixedRowCount, rowHeight = props.rowHeight;
      if (this._topGridHeight == null) {
        if (typeof rowHeight === "function") {
          var topGridHeight = 0;
          for (var index2 = 0; index2 < fixedRowCount; index2++) {
            topGridHeight += rowHeight({
              index: index2
            });
          }
          this._topGridHeight = topGridHeight;
        } else {
          this._topGridHeight = rowHeight * fixedRowCount;
        }
      }
      return this._topGridHeight;
    }
  }, {
    key: "_handleInvalidatedGridSize",
    value: function _handleInvalidatedGridSize() {
      if (typeof this._deferredInvalidateColumnIndex === "number") {
        var columnIndex = this._deferredInvalidateColumnIndex;
        var rowIndex = this._deferredInvalidateRowIndex;
        this._deferredInvalidateColumnIndex = null;
        this._deferredInvalidateRowIndex = null;
        this.recomputeGridSize({
          columnIndex,
          rowIndex
        });
        this.forceUpdate();
      }
    }
    /**
     * Avoid recreating inline styles each render; this bypasses Grid's shallowCompare.
     * This method recalculates styles only when specific props change.
     */
  }, {
    key: "_maybeCalculateCachedStyles",
    value: function _maybeCalculateCachedStyles(resetAll) {
      var _this$props9 = this.props, columnWidth = _this$props9.columnWidth, enableFixedColumnScroll = _this$props9.enableFixedColumnScroll, enableFixedRowScroll = _this$props9.enableFixedRowScroll, height = _this$props9.height, fixedColumnCount = _this$props9.fixedColumnCount, fixedRowCount = _this$props9.fixedRowCount, rowHeight = _this$props9.rowHeight, style2 = _this$props9.style, styleBottomLeftGrid = _this$props9.styleBottomLeftGrid, styleBottomRightGrid = _this$props9.styleBottomRightGrid, styleTopLeftGrid = _this$props9.styleTopLeftGrid, styleTopRightGrid = _this$props9.styleTopRightGrid, width = _this$props9.width;
      var sizeChange = resetAll || height !== this._lastRenderedHeight || width !== this._lastRenderedWidth;
      var leftSizeChange = resetAll || columnWidth !== this._lastRenderedColumnWidth || fixedColumnCount !== this._lastRenderedFixedColumnCount;
      var topSizeChange = resetAll || fixedRowCount !== this._lastRenderedFixedRowCount || rowHeight !== this._lastRenderedRowHeight;
      if (resetAll || sizeChange || style2 !== this._lastRenderedStyle) {
        this._containerOuterStyle = _objectSpread$5({
          height,
          overflow: "visible",
          // Let :focus outline show through
          width
        }, style2);
      }
      if (resetAll || sizeChange || topSizeChange) {
        this._containerTopStyle = {
          height: this._getTopGridHeight(this.props),
          position: "relative",
          width
        };
        this._containerBottomStyle = {
          height: height - this._getTopGridHeight(this.props),
          overflow: "visible",
          // Let :focus outline show through
          position: "relative",
          width
        };
      }
      if (resetAll || styleBottomLeftGrid !== this._lastRenderedStyleBottomLeftGrid) {
        this._bottomLeftGridStyle = _objectSpread$5({
          left: 0,
          overflowX: "hidden",
          overflowY: enableFixedColumnScroll ? "auto" : "hidden",
          position: "absolute"
        }, styleBottomLeftGrid);
      }
      if (resetAll || leftSizeChange || styleBottomRightGrid !== this._lastRenderedStyleBottomRightGrid) {
        this._bottomRightGridStyle = _objectSpread$5({
          left: this._getLeftGridWidth(this.props),
          position: "absolute"
        }, styleBottomRightGrid);
      }
      if (resetAll || styleTopLeftGrid !== this._lastRenderedStyleTopLeftGrid) {
        this._topLeftGridStyle = _objectSpread$5({
          left: 0,
          overflowX: "hidden",
          overflowY: "hidden",
          position: "absolute",
          top: 0
        }, styleTopLeftGrid);
      }
      if (resetAll || leftSizeChange || styleTopRightGrid !== this._lastRenderedStyleTopRightGrid) {
        this._topRightGridStyle = _objectSpread$5({
          left: this._getLeftGridWidth(this.props),
          overflowX: enableFixedRowScroll ? "auto" : "hidden",
          overflowY: "hidden",
          position: "absolute",
          top: 0
        }, styleTopRightGrid);
      }
      this._lastRenderedColumnWidth = columnWidth;
      this._lastRenderedFixedColumnCount = fixedColumnCount;
      this._lastRenderedFixedRowCount = fixedRowCount;
      this._lastRenderedHeight = height;
      this._lastRenderedRowHeight = rowHeight;
      this._lastRenderedStyle = style2;
      this._lastRenderedStyleBottomLeftGrid = styleBottomLeftGrid;
      this._lastRenderedStyleBottomRightGrid = styleBottomRightGrid;
      this._lastRenderedStyleTopLeftGrid = styleTopLeftGrid;
      this._lastRenderedStyleTopRightGrid = styleTopRightGrid;
      this._lastRenderedWidth = width;
    }
  }, {
    key: "_prepareForRender",
    value: function _prepareForRender() {
      if (this._lastRenderedColumnWidth !== this.props.columnWidth || this._lastRenderedFixedColumnCount !== this.props.fixedColumnCount) {
        this._leftGridWidth = null;
      }
      if (this._lastRenderedFixedRowCount !== this.props.fixedRowCount || this._lastRenderedRowHeight !== this.props.rowHeight) {
        this._topGridHeight = null;
      }
      this._maybeCalculateCachedStyles();
      this._lastRenderedColumnWidth = this.props.columnWidth;
      this._lastRenderedFixedColumnCount = this.props.fixedColumnCount;
      this._lastRenderedFixedRowCount = this.props.fixedRowCount;
      this._lastRenderedRowHeight = this.props.rowHeight;
    }
  }, {
    key: "_renderBottomLeftGrid",
    value: function _renderBottomLeftGrid(props) {
      var enableFixedColumnScroll = props.enableFixedColumnScroll, fixedColumnCount = props.fixedColumnCount, fixedRowCount = props.fixedRowCount, rowCount = props.rowCount, hideBottomLeftGridScrollbar = props.hideBottomLeftGridScrollbar;
      var showVerticalScrollbar = this.state.showVerticalScrollbar;
      if (!fixedColumnCount) {
        return null;
      }
      var additionalRowCount = showVerticalScrollbar ? 1 : 0, height = this._getBottomGridHeight(props), width = this._getLeftGridWidth(props), scrollbarSize2 = this.state.showVerticalScrollbar ? this.state.scrollbarSize : 0, gridWidth = hideBottomLeftGridScrollbar ? width + scrollbarSize2 : width;
      var bottomLeftGrid = /* @__PURE__ */ reactExports.createElement(Grid, _extends$h({}, props, {
        cellRenderer: this._cellRendererBottomLeftGrid,
        className: this.props.classNameBottomLeftGrid,
        columnCount: fixedColumnCount,
        deferredMeasurementCache: this._deferredMeasurementCacheBottomLeftGrid,
        height,
        onScroll: enableFixedColumnScroll ? this._onScrollTop : void 0,
        ref: this._bottomLeftGridRef,
        rowCount: Math.max(0, rowCount - fixedRowCount) + additionalRowCount,
        rowHeight: this._rowHeightBottomGrid,
        style: this._bottomLeftGridStyle,
        tabIndex: null,
        width: gridWidth
      }));
      if (hideBottomLeftGridScrollbar) {
        return /* @__PURE__ */ reactExports.createElement("div", {
          className: "BottomLeftGrid_ScrollWrapper",
          style: _objectSpread$5(_objectSpread$5({}, this._bottomLeftGridStyle), {}, {
            height,
            width,
            overflowY: "hidden"
          })
        }, bottomLeftGrid);
      }
      return bottomLeftGrid;
    }
  }, {
    key: "_renderBottomRightGrid",
    value: function _renderBottomRightGrid(props) {
      var columnCount = props.columnCount, fixedColumnCount = props.fixedColumnCount, fixedRowCount = props.fixedRowCount, rowCount = props.rowCount, scrollToColumn = props.scrollToColumn, scrollToRow = props.scrollToRow;
      return /* @__PURE__ */ reactExports.createElement(Grid, _extends$h({}, props, {
        cellRenderer: this._cellRendererBottomRightGrid,
        className: this.props.classNameBottomRightGrid,
        columnCount: Math.max(0, columnCount - fixedColumnCount),
        columnWidth: this._columnWidthRightGrid,
        deferredMeasurementCache: this._deferredMeasurementCacheBottomRightGrid,
        height: this._getBottomGridHeight(props),
        onScroll: this._onScroll,
        onScrollbarPresenceChange: this._onScrollbarPresenceChange,
        ref: this._bottomRightGridRef,
        rowCount: Math.max(0, rowCount - fixedRowCount),
        rowHeight: this._rowHeightBottomGrid,
        scrollToColumn: scrollToColumn - fixedColumnCount,
        scrollToRow: scrollToRow - fixedRowCount,
        style: this._bottomRightGridStyle,
        width: this._getRightGridWidth(props)
      }));
    }
  }, {
    key: "_renderTopLeftGrid",
    value: function _renderTopLeftGrid(props) {
      var fixedColumnCount = props.fixedColumnCount, fixedRowCount = props.fixedRowCount;
      if (!fixedColumnCount || !fixedRowCount) {
        return null;
      }
      return /* @__PURE__ */ reactExports.createElement(Grid, _extends$h({}, props, {
        className: this.props.classNameTopLeftGrid,
        columnCount: fixedColumnCount,
        height: this._getTopGridHeight(props),
        ref: this._topLeftGridRef,
        rowCount: fixedRowCount,
        style: this._topLeftGridStyle,
        tabIndex: null,
        width: this._getLeftGridWidth(props)
      }));
    }
  }, {
    key: "_renderTopRightGrid",
    value: function _renderTopRightGrid(props) {
      var columnCount = props.columnCount, enableFixedRowScroll = props.enableFixedRowScroll, fixedColumnCount = props.fixedColumnCount, fixedRowCount = props.fixedRowCount, scrollLeft = props.scrollLeft, hideTopRightGridScrollbar = props.hideTopRightGridScrollbar;
      var _this$state5 = this.state, showHorizontalScrollbar = _this$state5.showHorizontalScrollbar, scrollbarSize2 = _this$state5.scrollbarSize;
      if (!fixedRowCount) {
        return null;
      }
      var additionalColumnCount = showHorizontalScrollbar ? 1 : 0, height = this._getTopGridHeight(props), width = this._getRightGridWidth(props), additionalHeight = showHorizontalScrollbar ? scrollbarSize2 : 0;
      var gridHeight = height, style2 = this._topRightGridStyle;
      if (hideTopRightGridScrollbar) {
        gridHeight = height + additionalHeight;
        style2 = _objectSpread$5(_objectSpread$5({}, this._topRightGridStyle), {}, {
          left: 0
        });
      }
      var topRightGrid = /* @__PURE__ */ reactExports.createElement(Grid, _extends$h({}, props, {
        cellRenderer: this._cellRendererTopRightGrid,
        className: this.props.classNameTopRightGrid,
        columnCount: Math.max(0, columnCount - fixedColumnCount) + additionalColumnCount,
        columnWidth: this._columnWidthRightGrid,
        deferredMeasurementCache: this._deferredMeasurementCacheTopRightGrid,
        height: gridHeight,
        onScroll: enableFixedRowScroll ? this._onScrollLeft : void 0,
        ref: this._topRightGridRef,
        rowCount: fixedRowCount,
        scrollLeft,
        style: style2,
        tabIndex: null,
        width
      }));
      if (hideTopRightGridScrollbar) {
        return /* @__PURE__ */ reactExports.createElement("div", {
          className: "TopRightGrid_ScrollWrapper",
          style: _objectSpread$5(_objectSpread$5({}, this._topRightGridStyle), {}, {
            height,
            width,
            overflowX: "hidden"
          })
        }, topRightGrid);
      }
      return topRightGrid;
    }
  }], [{
    key: "getDerivedStateFromProps",
    value: function getDerivedStateFromProps(nextProps, prevState) {
      if (nextProps.scrollLeft !== prevState.scrollLeft || nextProps.scrollTop !== prevState.scrollTop) {
        return {
          scrollLeft: nextProps.scrollLeft != null && nextProps.scrollLeft >= 0 ? nextProps.scrollLeft : prevState.scrollLeft,
          scrollTop: nextProps.scrollTop != null && nextProps.scrollTop >= 0 ? nextProps.scrollTop : prevState.scrollTop
        };
      }
      return null;
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$3(MultiGrid, "defaultProps", {
  classNameBottomLeftGrid: "",
  classNameBottomRightGrid: "",
  classNameTopLeftGrid: "",
  classNameTopRightGrid: "",
  enableFixedColumnScroll: false,
  enableFixedRowScroll: false,
  fixedColumnCount: 0,
  fixedRowCount: 0,
  scrollToColumn: -1,
  scrollToRow: -1,
  style: {},
  styleBottomLeftGrid: {},
  styleBottomRightGrid: {},
  styleTopLeftGrid: {},
  styleTopRightGrid: {},
  hideTopRightGridScrollbar: false,
  hideBottomLeftGridScrollbar: false
});
MultiGrid.propTypes = {};
polyfill2(MultiGrid);
function _callSuper$3(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$3() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$3() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t22) {
  }
  return (_isNativeReflectConstruct$3 = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var ScrollSync = /* @__PURE__ */ function(_React$PureComponent) {
  function ScrollSync2(props, context) {
    var _this;
    _classCallCheck$a(this, ScrollSync2);
    _this = _callSuper$3(this, ScrollSync2, [props, context]);
    _this.state = {
      clientHeight: 0,
      clientWidth: 0,
      scrollHeight: 0,
      scrollLeft: 0,
      scrollTop: 0,
      scrollWidth: 0
    };
    _this._onScroll = _this._onScroll.bind(_this);
    return _this;
  }
  _inherits$a(ScrollSync2, _React$PureComponent);
  return _createClass$8(ScrollSync2, [{
    key: "render",
    value: function render3() {
      var children = this.props.children;
      var _this$state = this.state, clientHeight = _this$state.clientHeight, clientWidth = _this$state.clientWidth, scrollHeight = _this$state.scrollHeight, scrollLeft = _this$state.scrollLeft, scrollTop = _this$state.scrollTop, scrollWidth = _this$state.scrollWidth;
      return children({
        clientHeight,
        clientWidth,
        onScroll: this._onScroll,
        scrollHeight,
        scrollLeft,
        scrollTop,
        scrollWidth
      });
    }
  }, {
    key: "_onScroll",
    value: function _onScroll(_ref) {
      var clientHeight = _ref.clientHeight, clientWidth = _ref.clientWidth, scrollHeight = _ref.scrollHeight, scrollLeft = _ref.scrollLeft, scrollTop = _ref.scrollTop, scrollWidth = _ref.scrollWidth;
      this.setState({
        clientHeight,
        clientWidth,
        scrollHeight,
        scrollLeft,
        scrollTop,
        scrollWidth
      });
    }
  }]);
}(reactExports.PureComponent);
ScrollSync.propTypes = {};
function defaultCellDataGetter(_ref) {
  var dataKey = _ref.dataKey, rowData = _ref.rowData;
  if (typeof rowData.get === "function") {
    return rowData.get(dataKey);
  } else {
    return rowData[dataKey];
  }
}
function defaultCellRenderer(_ref) {
  var cellData = _ref.cellData;
  if (cellData == null) {
    return "";
  } else {
    return String(cellData);
  }
}
function defaultHeaderRowRenderer(_ref) {
  var className = _ref.className, columns = _ref.columns, style2 = _ref.style;
  return /* @__PURE__ */ reactExports.createElement("div", {
    className,
    role: "row",
    style: style2
  }, columns);
}
var SortDirection = {
  /**
   * Sort items in ascending order.
   * This means arranging from the lowest value to the highest (e.g. a-z, 0-9).
   */
  ASC: "ASC",
  /**
   * Sort items in descending order.
   * This means arranging from the highest value to the lowest (e.g. z-a, 9-0).
   */
  DESC: "DESC"
};
function SortIndicator(_ref) {
  var sortDirection = _ref.sortDirection;
  var classNames2 = clsx("ReactVirtualized__Table__sortableHeaderIcon", {
    "ReactVirtualized__Table__sortableHeaderIcon--ASC": sortDirection === SortDirection.ASC,
    "ReactVirtualized__Table__sortableHeaderIcon--DESC": sortDirection === SortDirection.DESC
  });
  return /* @__PURE__ */ reactExports.createElement("svg", {
    className: classNames2,
    width: 18,
    height: 18,
    viewBox: "0 0 24 24"
  }, sortDirection === SortDirection.ASC ? /* @__PURE__ */ reactExports.createElement("path", {
    d: "M7 14l5-5 5 5z"
  }) : /* @__PURE__ */ reactExports.createElement("path", {
    d: "M7 10l5 5 5-5z"
  }), /* @__PURE__ */ reactExports.createElement("path", {
    d: "M0 0h24v24H0z",
    fill: "none"
  }));
}
SortIndicator.propTypes = {};
function defaultHeaderRenderer(_ref) {
  var dataKey = _ref.dataKey, label = _ref.label, sortBy = _ref.sortBy, sortDirection = _ref.sortDirection;
  var showSortIndicator = sortBy === dataKey;
  var children = [/* @__PURE__ */ reactExports.createElement("span", {
    className: "ReactVirtualized__Table__headerTruncatedText",
    key: "label",
    title: typeof label === "string" ? label : null
  }, label)];
  if (showSortIndicator) {
    children.push(/* @__PURE__ */ reactExports.createElement(SortIndicator, {
      key: "SortIndicator",
      sortDirection
    }));
  }
  return children;
}
function defaultRowRenderer(_ref) {
  var className = _ref.className, columns = _ref.columns, index2 = _ref.index, key = _ref.key, onRowClick = _ref.onRowClick, onRowDoubleClick = _ref.onRowDoubleClick, onRowMouseOut = _ref.onRowMouseOut, onRowMouseOver = _ref.onRowMouseOver, onRowRightClick = _ref.onRowRightClick, rowData = _ref.rowData, style2 = _ref.style;
  var a11yProps = {
    "aria-rowindex": index2 + 1
  };
  if (onRowClick || onRowDoubleClick || onRowMouseOut || onRowMouseOver || onRowRightClick) {
    a11yProps["aria-label"] = "row";
    a11yProps.tabIndex = 0;
    if (onRowClick) {
      a11yProps.onClick = function(event) {
        return onRowClick({
          event,
          index: index2,
          rowData
        });
      };
    }
    if (onRowDoubleClick) {
      a11yProps.onDoubleClick = function(event) {
        return onRowDoubleClick({
          event,
          index: index2,
          rowData
        });
      };
    }
    if (onRowMouseOut) {
      a11yProps.onMouseOut = function(event) {
        return onRowMouseOut({
          event,
          index: index2,
          rowData
        });
      };
    }
    if (onRowMouseOver) {
      a11yProps.onMouseOver = function(event) {
        return onRowMouseOver({
          event,
          index: index2,
          rowData
        });
      };
    }
    if (onRowRightClick) {
      a11yProps.onContextMenu = function(event) {
        return onRowRightClick({
          event,
          index: index2,
          rowData
        });
      };
    }
  }
  return /* @__PURE__ */ reactExports.createElement("div", _extends$h({}, a11yProps, {
    className,
    key,
    role: "row",
    style: style2
  }), columns);
}
function _callSuper$2(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$2() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$2() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t22) {
  }
  return (_isNativeReflectConstruct$2 = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var Column = /* @__PURE__ */ function(_React$Component) {
  function Column2() {
    _classCallCheck$a(this, Column2);
    return _callSuper$2(this, Column2, arguments);
  }
  _inherits$a(Column2, _React$Component);
  return _createClass$8(Column2);
}(reactExports.Component);
_defineProperty$3(Column, "defaultProps", {
  cellDataGetter: defaultCellDataGetter,
  cellRenderer: defaultCellRenderer,
  defaultSortDirection: SortDirection.ASC,
  flexGrow: 0,
  flexShrink: 1,
  headerRenderer: defaultHeaderRenderer,
  style: {}
});
Column.propTypes = {};
function ownKeys$3(e2, r2) {
  var t2 = Object.keys(e2);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e2);
    r2 && (o2 = o2.filter(function(r22) {
      return Object.getOwnPropertyDescriptor(e2, r22).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread$4(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys$3(Object(t2), true).forEach(function(r22) {
      _defineProperty$3(e2, r22, t2[r22]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$3(Object(t2)).forEach(function(r22) {
      Object.defineProperty(e2, r22, Object.getOwnPropertyDescriptor(t2, r22));
    });
  }
  return e2;
}
function _callSuper$1(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$1() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$1() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t22) {
  }
  return (_isNativeReflectConstruct$1 = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var Table = /* @__PURE__ */ function(_React$PureComponent) {
  function Table2(props) {
    var _this;
    _classCallCheck$a(this, Table2);
    _this = _callSuper$1(this, Table2, [props]);
    _this.state = {
      scrollbarWidth: 0
    };
    _this._createColumn = _this._createColumn.bind(_this);
    _this._createRow = _this._createRow.bind(_this);
    _this._onScroll = _this._onScroll.bind(_this);
    _this._onSectionRendered = _this._onSectionRendered.bind(_this);
    _this._setRef = _this._setRef.bind(_this);
    _this._setGridElementRef = _this._setGridElementRef.bind(_this);
    return _this;
  }
  _inherits$a(Table2, _React$PureComponent);
  return _createClass$8(Table2, [{
    key: "forceUpdateGrid",
    value: function forceUpdateGrid() {
      if (this.Grid) {
        this.Grid.forceUpdate();
      }
    }
    /** See Grid#getOffsetForCell */
  }, {
    key: "getOffsetForRow",
    value: function getOffsetForRow(_ref) {
      var alignment = _ref.alignment, index2 = _ref.index;
      if (this.Grid) {
        var _this$Grid$getOffsetF = this.Grid.getOffsetForCell({
          alignment,
          rowIndex: index2
        }), scrollTop = _this$Grid$getOffsetF.scrollTop;
        return scrollTop;
      }
      return 0;
    }
    /** CellMeasurer compatibility */
  }, {
    key: "invalidateCellSizeAfterRender",
    value: function invalidateCellSizeAfterRender(_ref2) {
      var columnIndex = _ref2.columnIndex, rowIndex = _ref2.rowIndex;
      if (this.Grid) {
        this.Grid.invalidateCellSizeAfterRender({
          rowIndex,
          columnIndex
        });
      }
    }
    /** See Grid#measureAllCells */
  }, {
    key: "measureAllRows",
    value: function measureAllRows() {
      if (this.Grid) {
        this.Grid.measureAllCells();
      }
    }
    /** CellMeasurer compatibility */
  }, {
    key: "recomputeGridSize",
    value: function recomputeGridSize() {
      var _ref3 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref3$columnIndex = _ref3.columnIndex, columnIndex = _ref3$columnIndex === void 0 ? 0 : _ref3$columnIndex, _ref3$rowIndex = _ref3.rowIndex, rowIndex = _ref3$rowIndex === void 0 ? 0 : _ref3$rowIndex;
      if (this.Grid) {
        this.Grid.recomputeGridSize({
          rowIndex,
          columnIndex
        });
      }
    }
    /** See Grid#recomputeGridSize */
  }, {
    key: "recomputeRowHeights",
    value: function recomputeRowHeights() {
      var index2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
      if (this.Grid) {
        this.Grid.recomputeGridSize({
          rowIndex: index2
        });
      }
    }
    /** See Grid#scrollToPosition */
  }, {
    key: "scrollToPosition",
    value: function scrollToPosition() {
      var scrollTop = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
      if (this.Grid) {
        this.Grid.scrollToPosition({
          scrollTop
        });
      }
    }
    /** See Grid#scrollToCell */
  }, {
    key: "scrollToRow",
    value: function scrollToRow() {
      var index2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
      if (this.Grid) {
        this.Grid.scrollToCell({
          columnIndex: 0,
          rowIndex: index2
        });
      }
    }
  }, {
    key: "getScrollbarWidth",
    value: function getScrollbarWidth() {
      if (this.GridElement) {
        var _Grid = this.GridElement;
        var clientWidth = _Grid.clientWidth || 0;
        var offsetWidth = _Grid.offsetWidth || 0;
        return offsetWidth - clientWidth;
      }
      return 0;
    }
  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      this._setScrollbarWidth();
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate() {
      this._setScrollbarWidth();
    }
  }, {
    key: "render",
    value: function render3() {
      var _this2 = this;
      var _this$props = this.props, children2 = _this$props.children, className = _this$props.className, disableHeader = _this$props.disableHeader, gridClassName = _this$props.gridClassName, gridStyle = _this$props.gridStyle, headerHeight = _this$props.headerHeight, headerRowRenderer = _this$props.headerRowRenderer, height = _this$props.height, id2 = _this$props.id, noRowsRenderer22 = _this$props.noRowsRenderer, rowClassName = _this$props.rowClassName, rowStyle = _this$props.rowStyle, scrollToIndex = _this$props.scrollToIndex, style2 = _this$props.style, width = _this$props.width;
      var scrollbarWidth = this.state.scrollbarWidth;
      var availableRowsHeight = disableHeader ? height : height - headerHeight;
      var rowClass = typeof rowClassName === "function" ? rowClassName({
        index: -1
      }) : rowClassName;
      var rowStyleObject = typeof rowStyle === "function" ? rowStyle({
        index: -1
      }) : rowStyle;
      this._cachedColumnStyles = [];
      reactExports.Children.toArray(children2).forEach(function(column2, index2) {
        var flexStyles = _this2._getFlexStyleForColumn(column2, column2.props.style || Column.defaultProps.style);
        _this2._cachedColumnStyles[index2] = _objectSpread$4({
          overflow: "hidden"
        }, flexStyles);
      });
      return /* @__PURE__ */ reactExports.createElement("div", {
        "aria-label": this.props["aria-label"],
        "aria-labelledby": this.props["aria-labelledby"],
        "aria-colcount": reactExports.Children.toArray(children2).length,
        "aria-rowcount": this.props.rowCount,
        className: clsx("ReactVirtualized__Table", className),
        id: id2,
        role: "grid",
        style: style2
      }, !disableHeader && headerRowRenderer({
        className: clsx("ReactVirtualized__Table__headerRow", rowClass),
        columns: this._getHeaderColumns(),
        style: _objectSpread$4({
          height: headerHeight,
          overflow: "hidden",
          paddingRight: scrollbarWidth,
          width
        }, rowStyleObject)
      }), /* @__PURE__ */ reactExports.createElement(Grid, _extends$h({}, this.props, {
        elementRef: this._setGridElementRef,
        "aria-readonly": null,
        autoContainerWidth: true,
        className: clsx("ReactVirtualized__Table__Grid", gridClassName),
        cellRenderer: this._createRow,
        columnWidth: width,
        columnCount: 1,
        height: availableRowsHeight,
        id: void 0,
        noContentRenderer: noRowsRenderer22,
        onScroll: this._onScroll,
        onSectionRendered: this._onSectionRendered,
        ref: this._setRef,
        role: "rowgroup",
        scrollbarWidth,
        scrollToRow: scrollToIndex,
        style: _objectSpread$4(_objectSpread$4({}, gridStyle), {}, {
          overflowX: "hidden"
        })
      })));
    }
  }, {
    key: "_createColumn",
    value: function _createColumn(_ref4) {
      var column2 = _ref4.column, columnIndex = _ref4.columnIndex, isScrolling = _ref4.isScrolling, parent = _ref4.parent, rowData = _ref4.rowData, rowIndex = _ref4.rowIndex;
      var onColumnClick = this.props.onColumnClick;
      var _column$props = column2.props, cellDataGetter = _column$props.cellDataGetter, cellRenderer = _column$props.cellRenderer, className = _column$props.className, columnData = _column$props.columnData, dataKey = _column$props.dataKey, id2 = _column$props.id;
      var cellData = cellDataGetter({
        columnData,
        dataKey,
        rowData
      });
      var renderedCell = cellRenderer({
        cellData,
        columnData,
        columnIndex,
        dataKey,
        isScrolling,
        parent,
        rowData,
        rowIndex
      });
      var onClick = function onClick2(event) {
        onColumnClick && onColumnClick({
          columnData,
          dataKey,
          event
        });
      };
      var style2 = this._cachedColumnStyles[columnIndex];
      var title = typeof renderedCell === "string" ? renderedCell : null;
      return /* @__PURE__ */ reactExports.createElement("div", {
        "aria-colindex": columnIndex + 1,
        "aria-describedby": id2,
        className: clsx("ReactVirtualized__Table__rowColumn", className),
        key: "Row" + rowIndex + "-Col" + columnIndex,
        onClick,
        role: "gridcell",
        style: style2,
        title
      }, renderedCell);
    }
  }, {
    key: "_createHeader",
    value: function _createHeader(_ref5) {
      var column2 = _ref5.column, index2 = _ref5.index;
      var _this$props2 = this.props, headerClassName = _this$props2.headerClassName, headerStyle = _this$props2.headerStyle, onHeaderClick = _this$props2.onHeaderClick, sort = _this$props2.sort, sortBy = _this$props2.sortBy, sortDirection = _this$props2.sortDirection;
      var _column$props2 = column2.props, columnData = _column$props2.columnData, dataKey = _column$props2.dataKey, defaultSortDirection = _column$props2.defaultSortDirection, disableSort = _column$props2.disableSort, headerRenderer = _column$props2.headerRenderer, id2 = _column$props2.id, label = _column$props2.label;
      var sortEnabled = !disableSort && sort;
      var classNames2 = clsx("ReactVirtualized__Table__headerColumn", headerClassName, column2.props.headerClassName, {
        ReactVirtualized__Table__sortableHeaderColumn: sortEnabled
      });
      var style2 = this._getFlexStyleForColumn(column2, _objectSpread$4(_objectSpread$4({}, headerStyle), column2.props.headerStyle));
      var renderedHeader = headerRenderer({
        columnData,
        dataKey,
        disableSort,
        label,
        sortBy,
        sortDirection
      });
      var headerOnClick, headerOnKeyDown, headerTabIndex, headerAriaSort, headerAriaLabel;
      if (sortEnabled || onHeaderClick) {
        var isFirstTimeSort = sortBy !== dataKey;
        var newSortDirection = isFirstTimeSort ? defaultSortDirection : sortDirection === SortDirection.DESC ? SortDirection.ASC : SortDirection.DESC;
        var onClick = function onClick2(event) {
          sortEnabled && sort({
            defaultSortDirection,
            event,
            sortBy: dataKey,
            sortDirection: newSortDirection
          });
          onHeaderClick && onHeaderClick({
            columnData,
            dataKey,
            event
          });
        };
        var onKeyDown = function onKeyDown2(event) {
          if (event.key === "Enter" || event.key === " ") {
            onClick(event);
          }
        };
        headerAriaLabel = column2.props["aria-label"] || label || dataKey;
        headerAriaSort = "none";
        headerTabIndex = 0;
        headerOnClick = onClick;
        headerOnKeyDown = onKeyDown;
      }
      if (sortBy === dataKey) {
        headerAriaSort = sortDirection === SortDirection.ASC ? "ascending" : "descending";
      }
      return /* @__PURE__ */ reactExports.createElement("div", {
        "aria-label": headerAriaLabel,
        "aria-sort": headerAriaSort,
        className: classNames2,
        id: id2,
        key: "Header-Col" + index2,
        onClick: headerOnClick,
        onKeyDown: headerOnKeyDown,
        role: "columnheader",
        style: style2,
        tabIndex: headerTabIndex
      }, renderedHeader);
    }
  }, {
    key: "_createRow",
    value: function _createRow(_ref6) {
      var _this3 = this;
      var index2 = _ref6.rowIndex, isScrolling = _ref6.isScrolling, key = _ref6.key, parent = _ref6.parent, style2 = _ref6.style;
      var _this$props3 = this.props, children2 = _this$props3.children, onRowClick = _this$props3.onRowClick, onRowDoubleClick = _this$props3.onRowDoubleClick, onRowRightClick = _this$props3.onRowRightClick, onRowMouseOver = _this$props3.onRowMouseOver, onRowMouseOut = _this$props3.onRowMouseOut, rowClassName = _this$props3.rowClassName, rowGetter = _this$props3.rowGetter, rowRenderer = _this$props3.rowRenderer, rowStyle = _this$props3.rowStyle;
      var scrollbarWidth = this.state.scrollbarWidth;
      var rowClass = typeof rowClassName === "function" ? rowClassName({
        index: index2
      }) : rowClassName;
      var rowStyleObject = typeof rowStyle === "function" ? rowStyle({
        index: index2
      }) : rowStyle;
      var rowData = rowGetter({
        index: index2
      });
      var columns = reactExports.Children.toArray(children2).map(function(column2, columnIndex) {
        return _this3._createColumn({
          column: column2,
          columnIndex,
          isScrolling,
          parent,
          rowData,
          rowIndex: index2,
          scrollbarWidth
        });
      });
      var className = clsx("ReactVirtualized__Table__row", rowClass);
      var flattenedStyle = _objectSpread$4(_objectSpread$4({}, style2), {}, {
        height: this._getRowHeight(index2),
        overflow: "hidden",
        paddingRight: scrollbarWidth
      }, rowStyleObject);
      return rowRenderer({
        className,
        columns,
        index: index2,
        isScrolling,
        key,
        onRowClick,
        onRowDoubleClick,
        onRowRightClick,
        onRowMouseOver,
        onRowMouseOut,
        rowData,
        style: flattenedStyle
      });
    }
    /**
     * Determines the flex-shrink, flex-grow, and width values for a cell (header or column).
     */
  }, {
    key: "_getFlexStyleForColumn",
    value: function _getFlexStyleForColumn(column2) {
      var customStyle = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
      var flexValue = "".concat(column2.props.flexGrow, " ").concat(column2.props.flexShrink, " ").concat(column2.props.width, "px");
      var style2 = _objectSpread$4(_objectSpread$4({}, customStyle), {}, {
        flex: flexValue,
        msFlex: flexValue,
        WebkitFlex: flexValue
      });
      if (column2.props.maxWidth) {
        style2.maxWidth = column2.props.maxWidth;
      }
      if (column2.props.minWidth) {
        style2.minWidth = column2.props.minWidth;
      }
      return style2;
    }
  }, {
    key: "_getHeaderColumns",
    value: function _getHeaderColumns() {
      var _this4 = this;
      var _this$props4 = this.props, children2 = _this$props4.children, disableHeader = _this$props4.disableHeader;
      var items = disableHeader ? [] : reactExports.Children.toArray(children2);
      return items.map(function(column2, index2) {
        return _this4._createHeader({
          column: column2,
          index: index2
        });
      });
    }
  }, {
    key: "_getRowHeight",
    value: function _getRowHeight(rowIndex) {
      var rowHeight = this.props.rowHeight;
      return typeof rowHeight === "function" ? rowHeight({
        index: rowIndex
      }) : rowHeight;
    }
  }, {
    key: "_onScroll",
    value: function _onScroll(_ref7) {
      var clientHeight = _ref7.clientHeight, scrollHeight = _ref7.scrollHeight, scrollTop = _ref7.scrollTop;
      var onScroll22 = this.props.onScroll;
      onScroll22({
        clientHeight,
        scrollHeight,
        scrollTop
      });
    }
  }, {
    key: "_onSectionRendered",
    value: function _onSectionRendered(_ref8) {
      var rowOverscanStartIndex = _ref8.rowOverscanStartIndex, rowOverscanStopIndex = _ref8.rowOverscanStopIndex, rowStartIndex = _ref8.rowStartIndex, rowStopIndex = _ref8.rowStopIndex;
      var onRowsRendered22 = this.props.onRowsRendered;
      onRowsRendered22({
        overscanStartIndex: rowOverscanStartIndex,
        overscanStopIndex: rowOverscanStopIndex,
        startIndex: rowStartIndex,
        stopIndex: rowStopIndex
      });
    }
  }, {
    key: "_setRef",
    value: function _setRef(ref) {
      this.Grid = ref;
    }
  }, {
    key: "_setGridElementRef",
    value: function _setGridElementRef(ref) {
      this.GridElement = ref;
    }
  }, {
    key: "_setScrollbarWidth",
    value: function _setScrollbarWidth() {
      var scrollbarWidth = this.getScrollbarWidth();
      this.setState({
        scrollbarWidth
      });
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$3(Table, "defaultProps", {
  disableHeader: false,
  estimatedRowSize: 30,
  headerHeight: 0,
  headerStyle: {},
  noRowsRenderer: function noRowsRenderer2() {
    return null;
  },
  onRowsRendered: function onRowsRendered2() {
    return null;
  },
  onScroll: function onScroll4() {
    return null;
  },
  overscanIndicesGetter: defaultOverscanIndicesGetter,
  overscanRowCount: 10,
  rowRenderer: defaultRowRenderer,
  headerRowRenderer: defaultHeaderRowRenderer,
  rowStyle: {},
  scrollToAlignment: "auto",
  scrollToIndex: -1,
  style: {}
});
Table.propTypes = {};
var mountedInstances = [];
var originalBodyPointerEvents = null;
var disablePointerEventsTimeoutId = null;
function enablePointerEventsIfDisabled() {
  if (disablePointerEventsTimeoutId) {
    disablePointerEventsTimeoutId = null;
    if (document.body && originalBodyPointerEvents != null) {
      document.body.style.pointerEvents = originalBodyPointerEvents;
    }
    originalBodyPointerEvents = null;
  }
}
function enablePointerEventsAfterDelayCallback() {
  enablePointerEventsIfDisabled();
  mountedInstances.forEach(function(instance2) {
    return instance2.__resetIsScrolling();
  });
}
function enablePointerEventsAfterDelay() {
  if (disablePointerEventsTimeoutId) {
    cancelAnimationTimeout(disablePointerEventsTimeoutId);
  }
  var maximumTimeout = 0;
  mountedInstances.forEach(function(instance2) {
    maximumTimeout = Math.max(maximumTimeout, instance2.props.scrollingResetTimeInterval);
  });
  disablePointerEventsTimeoutId = requestAnimationTimeout(enablePointerEventsAfterDelayCallback, maximumTimeout);
}
function onScrollWindow(event) {
  if (event.currentTarget === window && originalBodyPointerEvents == null && document.body) {
    originalBodyPointerEvents = document.body.style.pointerEvents;
    document.body.style.pointerEvents = "none";
  }
  enablePointerEventsAfterDelay();
  mountedInstances.forEach(function(instance2) {
    if (instance2.props.scrollElement === event.currentTarget) {
      instance2.__handleWindowScrollEvent();
    }
  });
}
function registerScrollListener(component, element2) {
  if (!mountedInstances.some(function(instance2) {
    return instance2.props.scrollElement === element2;
  })) {
    element2.addEventListener("scroll", onScrollWindow);
  }
  mountedInstances.push(component);
}
function unregisterScrollListener(component, element2) {
  mountedInstances = mountedInstances.filter(function(instance2) {
    return instance2 !== component;
  });
  if (!mountedInstances.length) {
    element2.removeEventListener("scroll", onScrollWindow);
    if (disablePointerEventsTimeoutId) {
      cancelAnimationTimeout(disablePointerEventsTimeoutId);
      enablePointerEventsIfDisabled();
    }
  }
}
var isWindow$1 = function isWindow(element2) {
  return element2 === window;
};
var getBoundingBox = function getBoundingBox2(element2) {
  return element2.getBoundingClientRect();
};
function getDimensions(scrollElement, props) {
  if (!scrollElement) {
    return {
      height: props.serverHeight,
      width: props.serverWidth
    };
  } else if (isWindow$1(scrollElement)) {
    var _window = window, innerHeight2 = _window.innerHeight, innerWidth2 = _window.innerWidth;
    return {
      height: typeof innerHeight2 === "number" ? innerHeight2 : 0,
      width: typeof innerWidth2 === "number" ? innerWidth2 : 0
    };
  } else {
    return getBoundingBox(scrollElement);
  }
}
function getPositionOffset(element2, container) {
  if (isWindow$1(container) && document.documentElement) {
    var containerElement = document.documentElement;
    var elementRect = getBoundingBox(element2);
    var containerRect = getBoundingBox(containerElement);
    return {
      top: elementRect.top - containerRect.top,
      left: elementRect.left - containerRect.left
    };
  } else {
    var scrollOffset = getScrollOffset(container);
    var _elementRect = getBoundingBox(element2);
    var _containerRect = getBoundingBox(container);
    return {
      top: _elementRect.top + scrollOffset.top - _containerRect.top,
      left: _elementRect.left + scrollOffset.left - _containerRect.left
    };
  }
}
function getScrollOffset(element2) {
  if (isWindow$1(element2) && document.documentElement) {
    return {
      top: "scrollY" in window ? window.scrollY : document.documentElement.scrollTop,
      left: "scrollX" in window ? window.scrollX : document.documentElement.scrollLeft
    };
  } else {
    return {
      top: element2.scrollTop,
      left: element2.scrollLeft
    };
  }
}
function ownKeys$2(e2, r2) {
  var t2 = Object.keys(e2);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e2);
    r2 && (o2 = o2.filter(function(r3) {
      return Object.getOwnPropertyDescriptor(e2, r3).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread$3(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys$2(Object(t2), true).forEach(function(r3) {
      _defineProperty$3(e2, r3, t2[r3]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$2(Object(t2)).forEach(function(r3) {
      Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3));
    });
  }
  return e2;
}
function _callSuper(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t3) {
  }
  return (_isNativeReflectConstruct = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var IS_SCROLLING_TIMEOUT = 150;
var getWindow$2 = function getWindow() {
  return typeof window !== "undefined" ? window : void 0;
};
var WindowScroller = /* @__PURE__ */ function(_React$PureComponent) {
  function WindowScroller2() {
    var _this;
    _classCallCheck$a(this, WindowScroller2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _callSuper(this, WindowScroller2, [].concat(args));
    _defineProperty$3(_this, "_window", getWindow$2());
    _defineProperty$3(_this, "_isMounted", false);
    _defineProperty$3(_this, "_positionFromTop", 0);
    _defineProperty$3(_this, "_positionFromLeft", 0);
    _defineProperty$3(_this, "_detectElementResize", void 0);
    _defineProperty$3(_this, "_child", void 0);
    _defineProperty$3(_this, "_windowScrollerRef", /* @__PURE__ */ reactExports.createRef());
    _defineProperty$3(_this, "state", _objectSpread$3(_objectSpread$3({}, getDimensions(_this.props.scrollElement, _this.props)), {}, {
      isScrolling: false,
      scrollLeft: 0,
      scrollTop: 0
    }));
    _defineProperty$3(_this, "_registerChild", function(element2) {
      if (element2 && !(element2 instanceof Element)) {
        console.warn("WindowScroller registerChild expects to be passed Element or null");
      }
      _this._child = element2;
      _this.updatePosition();
    });
    _defineProperty$3(_this, "_onChildScroll", function(_ref) {
      var scrollTop = _ref.scrollTop;
      if (_this.state.scrollTop === scrollTop) {
        return;
      }
      var scrollElement = _this.props.scrollElement;
      if (scrollElement) {
        if (typeof scrollElement.scrollTo === "function") {
          scrollElement.scrollTo(0, scrollTop + _this._positionFromTop);
        } else {
          scrollElement.scrollTop = scrollTop + _this._positionFromTop;
        }
      }
    });
    _defineProperty$3(_this, "_registerResizeListener", function(element2) {
      if (element2 === window) {
        window.addEventListener("resize", _this._onResize, false);
      } else {
        _this._detectElementResize.addResizeListener(element2, _this._onResize);
      }
    });
    _defineProperty$3(_this, "_unregisterResizeListener", function(element2) {
      if (element2 === window) {
        window.removeEventListener("resize", _this._onResize, false);
      } else if (element2) {
        _this._detectElementResize.removeResizeListener(element2, _this._onResize);
      }
    });
    _defineProperty$3(_this, "_onResize", function() {
      _this.updatePosition();
    });
    _defineProperty$3(_this, "__handleWindowScrollEvent", function() {
      if (!_this._isMounted) {
        return;
      }
      var onScroll6 = _this.props.onScroll;
      var scrollElement = _this.props.scrollElement;
      if (scrollElement) {
        var scrollOffset = getScrollOffset(scrollElement);
        var scrollLeft = Math.max(0, scrollOffset.left - _this._positionFromLeft);
        var scrollTop = Math.max(0, scrollOffset.top - _this._positionFromTop);
        _this.setState({
          isScrolling: true,
          scrollLeft,
          scrollTop
        });
        onScroll6({
          scrollLeft,
          scrollTop
        });
      }
    });
    _defineProperty$3(_this, "__resetIsScrolling", function() {
      _this.setState({
        isScrolling: false
      });
    });
    return _this;
  }
  _inherits$a(WindowScroller2, _React$PureComponent);
  return _createClass$8(WindowScroller2, [{
    key: "updatePosition",
    value: function updatePosition() {
      var scrollElement = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props.scrollElement;
      var onResize4 = this.props.onResize;
      var _this$state = this.state, height = _this$state.height, width = _this$state.width;
      var thisNode = this._child || this._windowScrollerRef.current;
      if (thisNode instanceof Element && scrollElement) {
        var offset2 = getPositionOffset(thisNode, scrollElement);
        this._positionFromTop = offset2.top;
        this._positionFromLeft = offset2.left;
      }
      var dimensions = getDimensions(scrollElement, this.props);
      if (height !== dimensions.height || width !== dimensions.width) {
        this.setState({
          height: dimensions.height,
          width: dimensions.width
        });
        onResize4({
          height: dimensions.height,
          width: dimensions.width
        });
      }
      if (this.props.updateScrollTopOnUpdatePosition === true) {
        this.__handleWindowScrollEvent();
        this.__resetIsScrolling();
      }
    }
  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      var scrollElement = this.props.scrollElement;
      this._detectElementResize = createDetectElementResize();
      this.updatePosition(scrollElement);
      if (scrollElement) {
        registerScrollListener(this, scrollElement);
        this._registerResizeListener(scrollElement);
      }
      this._isMounted = true;
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate(prevProps, prevState) {
      var scrollElement = this.props.scrollElement;
      var prevScrollElement = prevProps.scrollElement;
      if (prevScrollElement !== scrollElement && prevScrollElement != null && scrollElement != null) {
        this.updatePosition(scrollElement);
        unregisterScrollListener(this, prevScrollElement);
        registerScrollListener(this, scrollElement);
        this._unregisterResizeListener(prevScrollElement);
        this._registerResizeListener(scrollElement);
      }
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      var scrollElement = this.props.scrollElement;
      if (scrollElement) {
        unregisterScrollListener(this, scrollElement);
        this._unregisterResizeListener(scrollElement);
      }
      this._isMounted = false;
    }
  }, {
    key: "render",
    value: function render3() {
      var children = this.props.children;
      var _this$state2 = this.state, isScrolling = _this$state2.isScrolling, scrollTop = _this$state2.scrollTop, scrollLeft = _this$state2.scrollLeft, height = _this$state2.height, width = _this$state2.width;
      return /* @__PURE__ */ reactExports.createElement("div", {
        ref: this._windowScrollerRef
      }, children({
        onChildScroll: this._onChildScroll,
        registerChild: this._registerChild,
        height,
        isScrolling,
        scrollLeft,
        scrollTop,
        width
      }));
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$3(WindowScroller, "defaultProps", {
  onResize: function onResize3() {
  },
  onScroll: function onScroll5() {
  },
  scrollingResetTimeInterval: IS_SCROLLING_TIMEOUT,
  scrollElement: getWindow$2(),
  serverHeight: 0,
  serverWidth: 0
});
const log$L = buildLogger("Resources");
const Resources = reactExports.forwardRef(
  ({ columnCount, loadMore, renderCell, cellCount, onScroll: onScroll6, onScrollToTop }, ref) => {
    reactExports.useRef(false);
    const gridRef = reactExports.useRef();
    const cacheRef = reactExports.useRef(
      new CellMeasurerCache({
        defaultHeight: 180,
        defaultWidth: 160,
        fixedWidth: true
      })
    );
    const verScrollbarWidthRef = reactExports.useRef(0);
    const prevContainerWidthRef = reactExports.useRef(void 0);
    const scrollTopRef = reactExports.useRef(0);
    log$L("rendering");
    reactExports.useEffect(() => {
      if (!containerRef.current)
        return;
      const resizeObserver2 = new ResizeObserver(() => {
        var _a2, _b2;
        const clearCache = prevContainerWidthRef.current != ((_a2 = containerRef.current) == null ? void 0 : _a2.clientWidth);
        prevContainerWidthRef.current = (_b2 = containerRef.current) == null ? void 0 : _b2.clientWidth;
        onResize4(clearCache);
      });
      resizeObserver2.observe(containerRef.current);
      return () => resizeObserver2.disconnect();
    }, []);
    const forceUpdate = useUpdate();
    const containerRef = reactExports.useRef(null);
    const cellRenderer = ({
      columnIndex,
      key,
      parent,
      rowIndex,
      style: style2,
      isScrolling,
      isVisible: isVisible2
    }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      CellMeasurer,
      {
        cache: cacheRef.current,
        columnIndex,
        parent,
        rowIndex,
        children: ({ measure }) => {
          return renderCell({
            columnIndex,
            key,
            parent,
            rowIndex,
            style: style2,
            measure,
            isScrolling,
            isVisible: isVisible2
          });
        }
      },
      key
    );
    useUpdateEffect(() => {
      onResize4(true);
    }, [columnCount]);
    const onResize4 = (clearCache = false) => {
      var _a2, _b2;
      log$L("on resize on scroll", gridRef, (_a2 = containerRef.current) == null ? void 0 : _a2.clientHeight, clearCache);
      if (clearCache) {
        cacheRef.current.clearAll();
      } else {
        (_b2 = gridRef.current) == null ? void 0 : _b2.measureAllCells();
      }
      forceUpdate();
    };
    reactExports.useImperativeHandle(ref, () => ({
      rearrange: () => {
        onResize4(true);
      }
    }));
    function renderGrid() {
      var _a2, _b2;
      const containerWidth = ((_a2 = containerRef.current) == null ? void 0 : _a2.clientWidth) ?? 0;
      const containerHeight = ((_b2 = containerRef.current) == null ? void 0 : _b2.clientHeight) ?? 0;
      const columnWidth = (containerWidth - verScrollbarWidthRef.current) / columnCount;
      log$L(containerWidth, containerHeight, columnWidth, columnCount, gridRef);
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        "div",
        {
          ref: (r2) => {
            if (!containerRef.current) {
              containerRef.current = r2;
              forceUpdate();
            }
          },
          className: "grow min-h-[0] overflow-hidden",
          onWheel: (e2) => {
            log$L("onWheel", e2);
            if (e2.deltaY < 0 && scrollTopRef.current == 0) {
              onScrollToTop == null ? void 0 : onScrollToTop();
            }
          },
          children: containerRef.current && /* @__PURE__ */ jsxRuntimeExports.jsx(AutoSizer, { children: ({ height, width }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
            Grid,
            {
              cellRenderer,
              ref: gridRef,
              columnCount,
              columnWidth,
              containerStyle: {
                overflow: "visible"
              },
              height,
              overscanIndicesGetter: ({
                cellCount: cellCount2,
                overscanCellsCount,
                startIndex,
                stopIndex
              }) => ({
                overscanStartIndex: Math.max(
                  0,
                  startIndex - overscanCellsCount
                ),
                overscanStopIndex: Math.min(
                  cellCount2 - 1,
                  stopIndex + overscanCellsCount
                )
              }),
              overscanRowCount: 4,
              rowCount: Math.ceil(cellCount / columnCount),
              rowHeight: cacheRef.current.rowHeight,
              width,
              onScroll: (e2) => {
                log$L("onScroll", e2);
                scrollTopRef.current = e2.scrollTop;
                onScroll6 == null ? void 0 : onScroll6(e2);
              },
              onScrollbarPresenceChange: (e2) => {
                const newWidth = e2.vertical ? e2.size : 0;
                log$L("onScrollbarPresenceChange", e2, newWidth, verScrollbarWidthRef.current);
                if (newWidth != verScrollbarWidthRef.current) {
                  verScrollbarWidthRef.current = newWidth;
                  onResize4(true);
                }
              }
            }
          ) })
        }
      );
    }
    return renderGrid();
  }
);
const filterPanel = "_filterPanel_aupwj_2";
const styles$5 = {
  filterPanel
};
var GroupCombinator = /* @__PURE__ */ ((GroupCombinator2) => {
  GroupCombinator2[GroupCombinator2["And"] = 1] = "And";
  GroupCombinator2[GroupCombinator2["Or"] = 2] = "Or";
  return GroupCombinator2;
})(GroupCombinator || {});
const filterGroup = "_filterGroup_i8qs2_1";
const root$3 = "_root_i8qs2_10";
const styles$4 = {
  filterGroup,
  root: root$3
};
var lib = {};
var ace$4 = {};
var ace$3 = { exports: {} };
(function(module2, exports2) {
  (function() {
    var ACE_NAMESPACE = "ace";
    var global2 = /* @__PURE__ */ function() {
      return this;
    }();
    if (!global2 && typeof window != "undefined")
      global2 = window;
    var define = function(module3, deps, payload) {
      if (typeof module3 !== "string") {
        if (define.original)
          define.original.apply(this, arguments);
        else {
          console.error("dropping module because define wasn't a string.");
          console.trace();
        }
        return;
      }
      if (arguments.length == 2)
        payload = deps;
      if (!define.modules[module3]) {
        define.payloads[module3] = payload;
        define.modules[module3] = null;
      }
    };
    define.modules = {};
    define.payloads = {};
    var _require = function(parentId, module3, callback2) {
      if (typeof module3 === "string") {
        var payload = lookup(parentId, module3);
        if (payload != void 0) {
          callback2 && callback2();
          return payload;
        }
      } else if (Object.prototype.toString.call(module3) === "[object Array]") {
        var params = [];
        for (var i2 = 0, l2 = module3.length; i2 < l2; ++i2) {
          var dep = lookup(parentId, module3[i2]);
          if (dep == void 0 && require2.original)
            return;
          params.push(dep);
        }
        return callback2 && callback2.apply(null, params) || true;
      }
    };
    var require2 = function(module3, callback2) {
      var packagedModule = _require("", module3, callback2);
      if (packagedModule == void 0 && require2.original)
        return require2.original.apply(this, arguments);
      return packagedModule;
    };
    var normalizeModule = function(parentId, moduleName) {
      if (moduleName.indexOf("!") !== -1) {
        var chunks = moduleName.split("!");
        return normalizeModule(parentId, chunks[0]) + "!" + normalizeModule(parentId, chunks[1]);
      }
      if (moduleName.charAt(0) == ".") {
        var base = parentId.split("/").slice(0, -1).join("/");
        moduleName = base + "/" + moduleName;
        while (moduleName.indexOf(".") !== -1 && previous2 != moduleName) {
          var previous2 = moduleName;
          moduleName = moduleName.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
        }
      }
      return moduleName;
    };
    var lookup = function(parentId, moduleName) {
      moduleName = normalizeModule(parentId, moduleName);
      var module3 = define.modules[moduleName];
      if (!module3) {
        module3 = define.payloads[moduleName];
        if (typeof module3 === "function") {
          var exports3 = {};
          var mod2 = {
            id: moduleName,
            uri: "",
            exports: exports3,
            packaged: true
          };
          var req = function(module4, callback2) {
            return _require(moduleName, module4, callback2);
          };
          var returnValue = module3(req, exports3, mod2);
          exports3 = returnValue || mod2.exports;
          define.modules[moduleName] = exports3;
          delete define.payloads[moduleName];
        }
        module3 = define.modules[moduleName] = exports3 || module3;
      }
      return module3;
    };
    function exportAce(ns) {
      var root2 = global2;
      {
        if (!global2[ns])
          global2[ns] = {};
        root2 = global2[ns];
      }
      if (!root2.define || !root2.define.packaged) {
        define.original = root2.define;
        root2.define = define;
        root2.define.packaged = true;
      }
      if (!root2.require || !root2.require.packaged) {
        require2.original = root2.require;
        root2.require = require2;
        root2.require.packaged = true;
      }
    }
    exportAce(ACE_NAMESPACE);
  })();
  ace.define("ace/lib/es6-shim", ["require", "exports", "module"], function(require2, exports3, module3) {
    function defineProp(obj, name2, val) {
      Object.defineProperty(obj, name2, {
        value: val,
        enumerable: false,
        writable: true,
        configurable: true
      });
    }
    if (!String.prototype.startsWith) {
      defineProp(String.prototype, "startsWith", function(searchString, position2) {
        position2 = position2 || 0;
        return this.lastIndexOf(searchString, position2) === position2;
      });
    }
    if (!String.prototype.endsWith) {
      defineProp(String.prototype, "endsWith", function(searchString, position2) {
        var subjectString = this;
        if (position2 === void 0 || position2 > subjectString.length) {
          position2 = subjectString.length;
        }
        position2 -= searchString.length;
        var lastIndex = subjectString.indexOf(searchString, position2);
        return lastIndex !== -1 && lastIndex === position2;
      });
    }
    if (!String.prototype.repeat) {
      defineProp(String.prototype, "repeat", function(count) {
        var result = "";
        var string3 = this;
        while (count > 0) {
          if (count & 1)
            result += string3;
          if (count >>= 1)
            string3 += string3;
        }
        return result;
      });
    }
    if (!String.prototype.includes) {
      defineProp(String.prototype, "includes", function(str, position2) {
        return this.indexOf(str, position2) != -1;
      });
    }
    if (!Object.assign) {
      Object.assign = function(target) {
        if (target === void 0 || target === null) {
          throw new TypeError("Cannot convert undefined or null to object");
        }
        var output2 = Object(target);
        for (var index2 = 1; index2 < arguments.length; index2++) {
          var source2 = arguments[index2];
          if (source2 !== void 0 && source2 !== null) {
            Object.keys(source2).forEach(function(key) {
              output2[key] = source2[key];
            });
          }
        }
        return output2;
      };
    }
    if (!Object.values) {
      Object.values = function(o2) {
        return Object.keys(o2).map(function(k2) {
          return o2[k2];
        });
      };
    }
    if (!Array.prototype.find) {
      defineProp(Array.prototype, "find", function(predicate) {
        var len = this.length;
        var thisArg = arguments[1];
        for (var k2 = 0; k2 < len; k2++) {
          var kValue = this[k2];
          if (predicate.call(thisArg, kValue, k2, this)) {
            return kValue;
          }
        }
      });
    }
    if (!Array.prototype.findIndex) {
      defineProp(Array.prototype, "findIndex", function(predicate) {
        var len = this.length;
        var thisArg = arguments[1];
        for (var k2 = 0; k2 < len; k2++) {
          var kValue = this[k2];
          if (predicate.call(thisArg, kValue, k2, this)) {
            return k2;
          }
        }
      });
    }
    if (!Array.prototype.includes) {
      defineProp(Array.prototype, "includes", function(item, position2) {
        return this.indexOf(item, position2) != -1;
      });
    }
    if (!Array.prototype.fill) {
      defineProp(Array.prototype, "fill", function(value2) {
        var O2 = this;
        var len = O2.length >>> 0;
        var start2 = arguments[1];
        var relativeStart = start2 >> 0;
        var k2 = relativeStart < 0 ? Math.max(len + relativeStart, 0) : Math.min(relativeStart, len);
        var end2 = arguments[2];
        var relativeEnd = end2 === void 0 ? len : end2 >> 0;
        var final = relativeEnd < 0 ? Math.max(len + relativeEnd, 0) : Math.min(relativeEnd, len);
        while (k2 < final) {
          O2[k2] = value2;
          k2++;
        }
        return O2;
      });
    }
    if (!Array.of) {
      defineProp(Array, "of", function() {
        return Array.prototype.slice.call(arguments);
      });
    }
  });
  ace.define("ace/lib/fixoldbrowsers", ["require", "exports", "module", "ace/lib/es6-shim"], function(require2, exports3, module3) {
    require2("./es6-shim");
  });
  ace.define("ace/lib/deep_copy", ["require", "exports", "module"], function(require2, exports3, module3) {
    exports3.deepCopy = function deepCopy(obj) {
      if (typeof obj !== "object" || !obj)
        return obj;
      var copy2;
      if (Array.isArray(obj)) {
        copy2 = [];
        for (var key = 0; key < obj.length; key++) {
          copy2[key] = deepCopy(obj[key]);
        }
        return copy2;
      }
      if (Object.prototype.toString.call(obj) !== "[object Object]")
        return obj;
      copy2 = {};
      for (var key in obj)
        copy2[key] = deepCopy(obj[key]);
      return copy2;
    };
  });
  ace.define("ace/lib/lang", ["require", "exports", "module", "ace/lib/deep_copy"], function(require2, exports3, module3) {
    exports3.last = function(a2) {
      return a2[a2.length - 1];
    };
    exports3.stringReverse = function(string3) {
      return string3.split("").reverse().join("");
    };
    exports3.stringRepeat = function(string3, count) {
      var result = "";
      while (count > 0) {
        if (count & 1)
          result += string3;
        if (count >>= 1)
          string3 += string3;
      }
      return result;
    };
    var trimBeginRegexp = /^\s\s*/;
    var trimEndRegexp = /\s\s*$/;
    exports3.stringTrimLeft = function(string3) {
      return string3.replace(trimBeginRegexp, "");
    };
    exports3.stringTrimRight = function(string3) {
      return string3.replace(trimEndRegexp, "");
    };
    exports3.copyObject = function(obj) {
      var copy2 = {};
      for (var key in obj) {
        copy2[key] = obj[key];
      }
      return copy2;
    };
    exports3.copyArray = function(array4) {
      var copy2 = [];
      for (var i2 = 0, l2 = array4.length; i2 < l2; i2++) {
        if (array4[i2] && typeof array4[i2] == "object")
          copy2[i2] = this.copyObject(array4[i2]);
        else
          copy2[i2] = array4[i2];
      }
      return copy2;
    };
    exports3.deepCopy = require2("./deep_copy").deepCopy;
    exports3.arrayToMap = function(arr) {
      var map2 = {};
      for (var i2 = 0; i2 < arr.length; i2++) {
        map2[arr[i2]] = 1;
      }
      return map2;
    };
    exports3.createMap = function(props) {
      var map2 = /* @__PURE__ */ Object.create(null);
      for (var i2 in props) {
        map2[i2] = props[i2];
      }
      return map2;
    };
    exports3.arrayRemove = function(array4, value2) {
      for (var i2 = 0; i2 <= array4.length; i2++) {
        if (value2 === array4[i2]) {
          array4.splice(i2, 1);
        }
      }
    };
    exports3.escapeRegExp = function(str) {
      return str.replace(/([.*+?^${}()|[\]\/\\])/g, "\\$1");
    };
    exports3.escapeHTML = function(str) {
      return ("" + str).replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
    };
    exports3.getMatchOffsets = function(string3, regExp) {
      var matches = [];
      string3.replace(regExp, function(str) {
        matches.push({
          offset: arguments[arguments.length - 2],
          length: str.length
        });
      });
      return matches;
    };
    exports3.deferredCall = function(fcn) {
      var timer = null;
      var callback2 = function() {
        timer = null;
        fcn();
      };
      var deferred = function(timeout) {
        deferred.cancel();
        timer = setTimeout(callback2, timeout || 0);
        return deferred;
      };
      deferred.schedule = deferred;
      deferred.call = function() {
        this.cancel();
        fcn();
        return deferred;
      };
      deferred.cancel = function() {
        clearTimeout(timer);
        timer = null;
        return deferred;
      };
      deferred.isPending = function() {
        return timer;
      };
      return deferred;
    };
    exports3.delayedCall = function(fcn, defaultTimeout) {
      var timer = null;
      var callback2 = function() {
        timer = null;
        fcn();
      };
      var _self = function(timeout) {
        if (timer == null)
          timer = setTimeout(callback2, timeout || defaultTimeout);
      };
      _self.delay = function(timeout) {
        timer && clearTimeout(timer);
        timer = setTimeout(callback2, timeout || defaultTimeout);
      };
      _self.schedule = _self;
      _self.call = function() {
        this.cancel();
        fcn();
      };
      _self.cancel = function() {
        timer && clearTimeout(timer);
        timer = null;
      };
      _self.isPending = function() {
        return timer;
      };
      return _self;
    };
    exports3.supportsLookbehind = function() {
      try {
        new RegExp("(?<=.)");
      } catch (e2) {
        return false;
      }
      return true;
    };
    exports3.skipEmptyMatch = function(line2, last, supportsUnicodeFlag) {
      return supportsUnicodeFlag && line2.codePointAt(last) > 65535 ? 2 : 1;
    };
  });
  ace.define("ace/lib/useragent", ["require", "exports", "module"], function(require2, exports3, module3) {
    exports3.OS = {
      LINUX: "LINUX",
      MAC: "MAC",
      WINDOWS: "WINDOWS"
    };
    exports3.getOS = function() {
      if (exports3.isMac) {
        return exports3.OS.MAC;
      } else if (exports3.isLinux) {
        return exports3.OS.LINUX;
      } else {
        return exports3.OS.WINDOWS;
      }
    };
    var _navigator2 = typeof navigator == "object" ? navigator : {};
    var os = (/mac|win|linux/i.exec(_navigator2.platform) || ["other"])[0].toLowerCase();
    var ua2 = _navigator2.userAgent || "";
    var appName = _navigator2.appName || "";
    exports3.isWin = os == "win";
    exports3.isMac = os == "mac";
    exports3.isLinux = os == "linux";
    exports3.isIE = appName == "Microsoft Internet Explorer" || appName.indexOf("MSAppHost") >= 0 ? parseFloat((ua2.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/) || [])[1]) : parseFloat((ua2.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/) || [])[1]);
    exports3.isOldIE = exports3.isIE && exports3.isIE < 9;
    exports3.isGecko = exports3.isMozilla = ua2.match(/ Gecko\/\d+/);
    exports3.isOpera = typeof opera == "object" && Object.prototype.toString.call(window["opera"]) == "[object Opera]";
    exports3.isWebKit = parseFloat(ua2.split("WebKit/")[1]) || void 0;
    exports3.isChrome = parseFloat(ua2.split(" Chrome/")[1]) || void 0;
    exports3.isSafari = parseFloat(ua2.split(" Safari/")[1]) && !exports3.isChrome || void 0;
    exports3.isEdge = parseFloat(ua2.split(" Edge/")[1]) || void 0;
    exports3.isAIR = ua2.indexOf("AdobeAIR") >= 0;
    exports3.isAndroid = ua2.indexOf("Android") >= 0;
    exports3.isChromeOS = ua2.indexOf(" CrOS ") >= 0;
    exports3.isIOS = /iPad|iPhone|iPod/.test(ua2) && !window["MSStream"];
    if (exports3.isIOS)
      exports3.isMac = true;
    exports3.isMobile = exports3.isIOS || exports3.isAndroid;
  });
  ace.define("ace/lib/dom", ["require", "exports", "module", "ace/lib/useragent"], function(require2, exports3, module3) {
    var useragent = require2("./useragent");
    var XHTML_NS = "http://www.w3.org/1999/xhtml";
    exports3.buildDom = function buildDom(arr, parent, refs) {
      if (typeof arr == "string" && arr) {
        var txt = document.createTextNode(arr);
        if (parent)
          parent.appendChild(txt);
        return txt;
      }
      if (!Array.isArray(arr)) {
        if (arr && arr.appendChild && parent)
          parent.appendChild(arr);
        return arr;
      }
      if (typeof arr[0] != "string" || !arr[0]) {
        var els = [];
        for (var i2 = 0; i2 < arr.length; i2++) {
          var ch2 = buildDom(arr[i2], parent, refs);
          ch2 && els.push(ch2);
        }
        return els;
      }
      var el2 = document.createElement(arr[0]);
      var options = arr[1];
      var childIndex = 1;
      if (options && typeof options == "object" && !Array.isArray(options))
        childIndex = 2;
      for (var i2 = childIndex; i2 < arr.length; i2++)
        buildDom(arr[i2], el2, refs);
      if (childIndex == 2) {
        Object.keys(options).forEach(function(n2) {
          var val = options[n2];
          if (n2 === "class") {
            el2.className = Array.isArray(val) ? val.join(" ") : val;
          } else if (typeof val == "function" || n2 == "value" || n2[0] == "$") {
            el2[n2] = val;
          } else if (n2 === "ref") {
            if (refs)
              refs[val] = el2;
          } else if (n2 === "style") {
            if (typeof val == "string")
              el2.style.cssText = val;
          } else if (val != null) {
            el2.setAttribute(n2, val);
          }
        });
      }
      if (parent)
        parent.appendChild(el2);
      return el2;
    };
    exports3.getDocumentHead = function(doc) {
      if (!doc)
        doc = document;
      return doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement;
    };
    exports3.createElement = function(tag, ns) {
      return document.createElementNS ? document.createElementNS(ns || XHTML_NS, tag) : document.createElement(tag);
    };
    exports3.removeChildren = function(element2) {
      element2.innerHTML = "";
    };
    exports3.createTextNode = function(textContent, element2) {
      var doc = element2 ? element2.ownerDocument : document;
      return doc.createTextNode(textContent);
    };
    exports3.createFragment = function(element2) {
      var doc = element2 ? element2.ownerDocument : document;
      return doc.createDocumentFragment();
    };
    exports3.hasCssClass = function(el2, name2) {
      var classes = (el2.className + "").split(/\s+/g);
      return classes.indexOf(name2) !== -1;
    };
    exports3.addCssClass = function(el2, name2) {
      if (!exports3.hasCssClass(el2, name2)) {
        el2.className += " " + name2;
      }
    };
    exports3.removeCssClass = function(el2, name2) {
      var classes = el2.className.split(/\s+/g);
      while (true) {
        var index2 = classes.indexOf(name2);
        if (index2 == -1) {
          break;
        }
        classes.splice(index2, 1);
      }
      el2.className = classes.join(" ");
    };
    exports3.toggleCssClass = function(el2, name2) {
      var classes = el2.className.split(/\s+/g), add2 = true;
      while (true) {
        var index2 = classes.indexOf(name2);
        if (index2 == -1) {
          break;
        }
        add2 = false;
        classes.splice(index2, 1);
      }
      if (add2)
        classes.push(name2);
      el2.className = classes.join(" ");
      return add2;
    };
    exports3.setCssClass = function(node2, className, include) {
      if (include) {
        exports3.addCssClass(node2, className);
      } else {
        exports3.removeCssClass(node2, className);
      }
    };
    exports3.hasCssString = function(id2, doc) {
      var index2 = 0, sheets;
      doc = doc || document;
      if (sheets = doc.querySelectorAll("style")) {
        while (index2 < sheets.length) {
          if (sheets[index2++].id === id2) {
            return true;
          }
        }
      }
    };
    exports3.removeElementById = function(id2, doc) {
      doc = doc || document;
      if (doc.getElementById(id2)) {
        doc.getElementById(id2).remove();
      }
    };
    var strictCSP;
    var cssCache = [];
    exports3.useStrictCSP = function(value2) {
      strictCSP = value2;
      if (value2 == false)
        insertPendingStyles();
      else if (!cssCache)
        cssCache = [];
    };
    function insertPendingStyles() {
      var cache2 = cssCache;
      cssCache = null;
      cache2 && cache2.forEach(function(item) {
        importCssString(item[0], item[1]);
      });
    }
    function importCssString(cssText, id2, target) {
      if (typeof document == "undefined")
        return;
      if (cssCache) {
        if (target) {
          insertPendingStyles();
        } else if (target === false) {
          return cssCache.push([cssText, id2]);
        }
      }
      if (strictCSP)
        return;
      var container = target;
      if (!target || !target.getRootNode) {
        container = document;
      } else {
        container = target.getRootNode();
        if (!container || container == target)
          container = document;
      }
      var doc = container.ownerDocument || container;
      if (id2 && exports3.hasCssString(id2, container))
        return null;
      if (id2)
        cssText += "\n/*# sourceURL=ace/css/" + id2 + " */";
      var style2 = exports3.createElement("style");
      style2.appendChild(doc.createTextNode(cssText));
      if (id2)
        style2.id = id2;
      if (container == doc)
        container = exports3.getDocumentHead(doc);
      container.insertBefore(style2, container.firstChild);
    }
    exports3.importCssString = importCssString;
    exports3.importCssStylsheet = function(uri, doc) {
      exports3.buildDom(["link", { rel: "stylesheet", href: uri }], exports3.getDocumentHead(doc));
    };
    exports3.scrollbarWidth = function(doc) {
      var inner = exports3.createElement("ace_inner");
      inner.style.width = "100%";
      inner.style.minWidth = "0px";
      inner.style.height = "200px";
      inner.style.display = "block";
      var outer = exports3.createElement("ace_outer");
      var style2 = outer.style;
      style2.position = "absolute";
      style2.left = "-10000px";
      style2.overflow = "hidden";
      style2.width = "200px";
      style2.minWidth = "0px";
      style2.height = "150px";
      style2.display = "block";
      outer.appendChild(inner);
      var body = doc && doc.documentElement || document && document.documentElement;
      if (!body)
        return 0;
      body.appendChild(outer);
      var noScrollbar = inner.offsetWidth;
      style2.overflow = "scroll";
      var withScrollbar = inner.offsetWidth;
      if (noScrollbar === withScrollbar) {
        withScrollbar = outer.clientWidth;
      }
      body.removeChild(outer);
      return noScrollbar - withScrollbar;
    };
    exports3.computedStyle = function(element2, style2) {
      return window.getComputedStyle(element2, "") || {};
    };
    exports3.setStyle = function(styles2, property2, value2) {
      if (styles2[property2] !== value2) {
        styles2[property2] = value2;
      }
    };
    exports3.HAS_CSS_ANIMATION = false;
    exports3.HAS_CSS_TRANSFORMS = false;
    exports3.HI_DPI = useragent.isWin ? typeof window !== "undefined" && window.devicePixelRatio >= 1.5 : true;
    if (useragent.isChromeOS)
      exports3.HI_DPI = false;
    if (typeof document !== "undefined") {
      var div = document.createElement("div");
      if (exports3.HI_DPI && div.style.transform !== void 0)
        exports3.HAS_CSS_TRANSFORMS = true;
      if (!useragent.isEdge && typeof div.style.animationName !== "undefined")
        exports3.HAS_CSS_ANIMATION = true;
      div = null;
    }
    if (exports3.HAS_CSS_TRANSFORMS) {
      exports3.translate = function(element2, tx, ty) {
        element2.style.transform = "translate(" + Math.round(tx) + "px, " + Math.round(ty) + "px)";
      };
    } else {
      exports3.translate = function(element2, tx, ty) {
        element2.style.top = Math.round(ty) + "px";
        element2.style.left = Math.round(tx) + "px";
      };
    }
  });
  ace.define("ace/lib/net", ["require", "exports", "module", "ace/lib/dom"], function(require2, exports3, module3) {
    /*
    * based on code from:
    *
    * @license RequireJS text 0.25.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
    * Available via the MIT or new BSD license.
    * see: http://github.com/jrburke/requirejs for details
    */
    var dom = require2("./dom");
    exports3.get = function(url2, callback2) {
      var xhr = new XMLHttpRequest();
      xhr.open("GET", url2, true);
      xhr.onreadystatechange = function() {
        if (xhr.readyState === 4) {
          callback2(xhr.responseText);
        }
      };
      xhr.send(null);
    };
    exports3.loadScript = function(path, callback2) {
      var head = dom.getDocumentHead();
      var s2 = document.createElement("script");
      s2.src = path;
      head.appendChild(s2);
      s2.onload = s2.onreadystatechange = function(_24, isAbort) {
        if (isAbort || !s2.readyState || s2.readyState == "loaded" || s2.readyState == "complete") {
          s2 = s2.onload = s2.onreadystatechange = null;
          if (!isAbort)
            callback2();
        }
      };
    };
    exports3.qualifyURL = function(url2) {
      var a2 = document.createElement("a");
      a2.href = url2;
      return a2.href;
    };
  });
  ace.define("ace/lib/oop", ["require", "exports", "module"], function(require2, exports3, module3) {
    exports3.inherits = function(ctor, superCtor) {
      ctor.super_ = superCtor;
      ctor.prototype = Object.create(superCtor.prototype, {
        constructor: {
          value: ctor,
          enumerable: false,
          writable: true,
          configurable: true
        }
      });
    };
    exports3.mixin = function(obj, mixin) {
      for (var key in mixin) {
        obj[key] = mixin[key];
      }
      return obj;
    };
    exports3.implement = function(proto2, mixin) {
      exports3.mixin(proto2, mixin);
    };
  });
  ace.define("ace/lib/event_emitter", ["require", "exports", "module"], function(require2, exports3, module3) {
    var EventEmitter2 = {};
    var stopPropagation2 = function() {
      this.propagationStopped = true;
    };
    var preventDefault2 = function() {
      this.defaultPrevented = true;
    };
    EventEmitter2._emit = EventEmitter2._dispatchEvent = function(eventName, e2) {
      this._eventRegistry || (this._eventRegistry = {});
      this._defaultHandlers || (this._defaultHandlers = {});
      var listeners = this._eventRegistry[eventName] || [];
      var defaultHandler = this._defaultHandlers[eventName];
      if (!listeners.length && !defaultHandler)
        return;
      if (typeof e2 != "object" || !e2)
        e2 = {};
      if (!e2.type)
        e2.type = eventName;
      if (!e2.stopPropagation)
        e2.stopPropagation = stopPropagation2;
      if (!e2.preventDefault)
        e2.preventDefault = preventDefault2;
      listeners = listeners.slice();
      for (var i2 = 0; i2 < listeners.length; i2++) {
        listeners[i2](e2, this);
        if (e2.propagationStopped)
          break;
      }
      if (defaultHandler && !e2.defaultPrevented)
        return defaultHandler(e2, this);
    };
    EventEmitter2._signal = function(eventName, e2) {
      var listeners = (this._eventRegistry || {})[eventName];
      if (!listeners)
        return;
      listeners = listeners.slice();
      for (var i2 = 0; i2 < listeners.length; i2++)
        listeners[i2](e2, this);
    };
    EventEmitter2.once = function(eventName, callback2) {
      var _self = this;
      this.on(eventName, function newCallback() {
        _self.off(eventName, newCallback);
        callback2.apply(null, arguments);
      });
      if (!callback2) {
        return new Promise(function(resolve2) {
          callback2 = resolve2;
        });
      }
    };
    EventEmitter2.setDefaultHandler = function(eventName, callback2) {
      var handlers2 = this._defaultHandlers;
      if (!handlers2)
        handlers2 = this._defaultHandlers = { _disabled_: {} };
      if (handlers2[eventName]) {
        var old = handlers2[eventName];
        var disabled = handlers2._disabled_[eventName];
        if (!disabled)
          handlers2._disabled_[eventName] = disabled = [];
        disabled.push(old);
        var i2 = disabled.indexOf(callback2);
        if (i2 != -1)
          disabled.splice(i2, 1);
      }
      handlers2[eventName] = callback2;
    };
    EventEmitter2.removeDefaultHandler = function(eventName, callback2) {
      var handlers2 = this._defaultHandlers;
      if (!handlers2)
        return;
      var disabled = handlers2._disabled_[eventName];
      if (handlers2[eventName] == callback2) {
        if (disabled)
          this.setDefaultHandler(eventName, disabled.pop());
      } else if (disabled) {
        var i2 = disabled.indexOf(callback2);
        if (i2 != -1)
          disabled.splice(i2, 1);
      }
    };
    EventEmitter2.on = EventEmitter2.addEventListener = function(eventName, callback2, capturing) {
      this._eventRegistry = this._eventRegistry || {};
      var listeners = this._eventRegistry[eventName];
      if (!listeners)
        listeners = this._eventRegistry[eventName] = [];
      if (listeners.indexOf(callback2) == -1)
        listeners[capturing ? "unshift" : "push"](callback2);
      return callback2;
    };
    EventEmitter2.off = EventEmitter2.removeListener = EventEmitter2.removeEventListener = function(eventName, callback2) {
      this._eventRegistry = this._eventRegistry || {};
      var listeners = this._eventRegistry[eventName];
      if (!listeners)
        return;
      var index2 = listeners.indexOf(callback2);
      if (index2 !== -1)
        listeners.splice(index2, 1);
    };
    EventEmitter2.removeAllListeners = function(eventName) {
      if (!eventName)
        this._eventRegistry = this._defaultHandlers = void 0;
      if (this._eventRegistry)
        this._eventRegistry[eventName] = void 0;
      if (this._defaultHandlers)
        this._defaultHandlers[eventName] = void 0;
    };
    exports3.EventEmitter = EventEmitter2;
  });
  ace.define("ace/lib/report_error", ["require", "exports", "module"], function(require2, exports3, module3) {
    exports3.reportError = function reportError2(msg, data) {
      var e2 = new Error(msg);
      e2["data"] = data;
      if (typeof console == "object" && console.error)
        console.error(e2);
      setTimeout(function() {
        throw e2;
      });
    };
  });
  ace.define("ace/lib/default_english_messages", ["require", "exports", "module"], function(require2, exports3, module3) {
    var defaultEnglishMessages = {
      "autocomplete.popup.aria-roledescription": "Autocomplete suggestions",
      "autocomplete.popup.aria-label": "Autocomplete suggestions",
      "autocomplete.popup.item.aria-roledescription": "item",
      "autocomplete.loading": "Loading...",
      "editor.scroller.aria-roledescription": "editor",
      "editor.scroller.aria-label": "Editor content, press Enter to start editing, press Escape to exit",
      "editor.gutter.aria-roledescription": "editor gutter",
      "editor.gutter.aria-label": "Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit",
      "error-marker.good-state": "Looks good!",
      "prompt.recently-used": "Recently used",
      "prompt.other-commands": "Other commands",
      "prompt.no-matching-commands": "No matching commands",
      "search-box.find.placeholder": "Search for",
      "search-box.find-all.text": "All",
      "search-box.replace.placeholder": "Replace with",
      "search-box.replace-next.text": "Replace",
      "search-box.replace-all.text": "All",
      "search-box.toggle-replace.title": "Toggle Replace mode",
      "search-box.toggle-regexp.title": "RegExp Search",
      "search-box.toggle-case.title": "CaseSensitive Search",
      "search-box.toggle-whole-word.title": "Whole Word Search",
      "search-box.toggle-in-selection.title": "Search In Selection",
      "search-box.search-counter": "$0 of $1",
      "text-input.aria-roledescription": "editor",
      "text-input.aria-label": "Cursor at row $0",
      "gutter.code-folding.range.aria-label": "Toggle code folding, rows $0 through $1",
      "gutter.code-folding.closed.aria-label": "Toggle code folding, rows $0 through $1",
      "gutter.code-folding.open.aria-label": "Toggle code folding, row $0",
      "gutter.code-folding.closed.title": "Unfold code",
      "gutter.code-folding.open.title": "Fold code",
      "gutter.annotation.aria-label.error": "Error, read annotations row $0",
      "gutter.annotation.aria-label.warning": "Warning, read annotations row $0",
      "gutter.annotation.aria-label.info": "Info, read annotations row $0",
      "inline-fold.closed.title": "Unfold code",
      "gutter-tooltip.aria-label.error.singular": "error",
      "gutter-tooltip.aria-label.error.plural": "errors",
      "gutter-tooltip.aria-label.warning.singular": "warning",
      "gutter-tooltip.aria-label.warning.plural": "warnings",
      "gutter-tooltip.aria-label.info.singular": "information message",
      "gutter-tooltip.aria-label.info.plural": "information messages",
      "gutter.annotation.aria-label.security": "Security finding, read annotations row $0",
      "gutter.annotation.aria-label.hint": "Suggestion, read annotations row $0",
      "gutter-tooltip.aria-label.security.singular": "security finding",
      "gutter-tooltip.aria-label.security.plural": "security findings",
      "gutter-tooltip.aria-label.hint.singular": "suggestion",
      "gutter-tooltip.aria-label.hint.plural": "suggestions",
      "editor.tooltip.disable-editing": "Editing is disabled"
    };
    exports3.defaultEnglishMessages = defaultEnglishMessages;
  });
  ace.define("ace/lib/app_config", ["require", "exports", "module", "ace/lib/oop", "ace/lib/event_emitter", "ace/lib/report_error", "ace/lib/default_english_messages"], function(require2, exports3, module3) {
    "no use strict";
    var oop = require2("./oop");
    var EventEmitter2 = require2("./event_emitter").EventEmitter;
    var reportError2 = require2("./report_error").reportError;
    var defaultEnglishMessages = require2("./default_english_messages").defaultEnglishMessages;
    var optionsProvider = {
      setOptions: function(optList) {
        Object.keys(optList).forEach(function(key) {
          this.setOption(key, optList[key]);
        }, this);
      },
      getOptions: function(optionNames) {
        var result = {};
        if (!optionNames) {
          var options = this.$options;
          optionNames = Object.keys(options).filter(function(key) {
            return !options[key].hidden;
          });
        } else if (!Array.isArray(optionNames)) {
          optionNames = Object.keys(optionNames);
        }
        optionNames.forEach(function(key) {
          result[key] = this.getOption(key);
        }, this);
        return result;
      },
      setOption: function(name2, value2) {
        if (this["$" + name2] === value2)
          return;
        var opt = this.$options[name2];
        if (!opt) {
          return warn3('misspelled option "' + name2 + '"');
        }
        if (opt.forwardTo)
          return this[opt.forwardTo] && this[opt.forwardTo].setOption(name2, value2);
        if (!opt.handlesSet)
          this["$" + name2] = value2;
        if (opt && opt.set)
          opt.set.call(this, value2);
      },
      getOption: function(name2) {
        var opt = this.$options[name2];
        if (!opt) {
          return warn3('misspelled option "' + name2 + '"');
        }
        if (opt.forwardTo)
          return this[opt.forwardTo] && this[opt.forwardTo].getOption(name2);
        return opt && opt.get ? opt.get.call(this) : this["$" + name2];
      }
    };
    function warn3(message) {
      if (typeof console != "undefined" && console.warn)
        console.warn.apply(console, arguments);
    }
    var messages2;
    var nlsPlaceholders;
    var AppConfig = (
      /** @class */
      function() {
        function AppConfig2() {
          this.$defaultOptions = {};
          messages2 = defaultEnglishMessages;
          nlsPlaceholders = "dollarSigns";
        }
        AppConfig2.prototype.defineOptions = function(obj, path, options) {
          if (!obj.$options)
            this.$defaultOptions[path] = obj.$options = {};
          Object.keys(options).forEach(function(key) {
            var opt = options[key];
            if (typeof opt == "string")
              opt = { forwardTo: opt };
            opt.name || (opt.name = key);
            obj.$options[opt.name] = opt;
            if ("initialValue" in opt)
              obj["$" + opt.name] = opt.initialValue;
          });
          oop.implement(obj, optionsProvider);
          return this;
        };
        AppConfig2.prototype.resetOptions = function(obj) {
          Object.keys(obj.$options).forEach(function(key) {
            var opt = obj.$options[key];
            if ("value" in opt)
              obj.setOption(key, opt.value);
          });
        };
        AppConfig2.prototype.setDefaultValue = function(path, name2, value2) {
          if (!path) {
            for (path in this.$defaultOptions)
              if (this.$defaultOptions[path][name2])
                break;
            if (!this.$defaultOptions[path][name2])
              return false;
          }
          var opts2 = this.$defaultOptions[path] || (this.$defaultOptions[path] = {});
          if (opts2[name2]) {
            if (opts2.forwardTo)
              this.setDefaultValue(opts2.forwardTo, name2, value2);
            else
              opts2[name2].value = value2;
          }
        };
        AppConfig2.prototype.setDefaultValues = function(path, optionHash) {
          Object.keys(optionHash).forEach(function(key) {
            this.setDefaultValue(path, key, optionHash[key]);
          }, this);
        };
        AppConfig2.prototype.setMessages = function(value2, options) {
          messages2 = value2;
          if (options && options.placeholders) {
            nlsPlaceholders = options.placeholders;
          }
        };
        AppConfig2.prototype.nls = function(key, defaultString, params) {
          if (!messages2[key]) {
            warn3("No message found for the key '" + key + "' in messages with id " + messages2.$id + ", trying to find a translation for the default string '" + defaultString + "'.");
            if (!messages2[defaultString]) {
              warn3("No message found for the default string '" + defaultString + "' in the provided messages. Falling back to the default English message.");
            }
          }
          var translated = messages2[key] || messages2[defaultString] || defaultString;
          if (params) {
            if (nlsPlaceholders === "dollarSigns") {
              translated = translated.replace(/\$(\$|[\d]+)/g, function(_24, dollarMatch) {
                if (dollarMatch == "$")
                  return "$";
                return params[dollarMatch];
              });
            }
            if (nlsPlaceholders === "curlyBrackets") {
              translated = translated.replace(/\{([^\}]+)\}/g, function(_24, curlyBracketMatch) {
                return params[curlyBracketMatch];
              });
            }
          }
          return translated;
        };
        return AppConfig2;
      }()
    );
    AppConfig.prototype.warn = warn3;
    AppConfig.prototype.reportError = reportError2;
    oop.implement(AppConfig.prototype, EventEmitter2);
    exports3.AppConfig = AppConfig;
  });
  ace.define("ace/theme/textmate-css", ["require", "exports", "module"], function(require2, exports3, module3) {
    module3.exports = '.ace-tm .ace_gutter {\n  background: #f0f0f0;\n  color: #333;\n}\n\n.ace-tm .ace_print-margin {\n  width: 1px;\n  background: #e8e8e8;\n}\n\n.ace-tm .ace_fold {\n    background-color: #6B72E6;\n}\n\n.ace-tm {\n  background-color: #FFFFFF;\n  color: black;\n}\n\n.ace-tm .ace_cursor {\n  color: black;\n}\n        \n.ace-tm .ace_invisible {\n  color: rgb(191, 191, 191);\n}\n\n.ace-tm .ace_storage,\n.ace-tm .ace_keyword {\n  color: blue;\n}\n\n.ace-tm .ace_constant {\n  color: rgb(197, 6, 11);\n}\n\n.ace-tm .ace_constant.ace_buildin {\n  color: rgb(88, 72, 246);\n}\n\n.ace-tm .ace_constant.ace_language {\n  color: rgb(88, 92, 246);\n}\n\n.ace-tm .ace_constant.ace_library {\n  color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_invalid {\n  background-color: rgba(255, 0, 0, 0.1);\n  color: red;\n}\n\n.ace-tm .ace_support.ace_function {\n  color: rgb(60, 76, 114);\n}\n\n.ace-tm .ace_support.ace_constant {\n  color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_support.ace_type,\n.ace-tm .ace_support.ace_class {\n  color: rgb(109, 121, 222);\n}\n\n.ace-tm .ace_keyword.ace_operator {\n  color: rgb(104, 118, 135);\n}\n\n.ace-tm .ace_string {\n  color: rgb(3, 106, 7);\n}\n\n.ace-tm .ace_comment {\n  color: rgb(76, 136, 107);\n}\n\n.ace-tm .ace_comment.ace_doc {\n  color: rgb(0, 102, 255);\n}\n\n.ace-tm .ace_comment.ace_doc.ace_tag {\n  color: rgb(128, 159, 191);\n}\n\n.ace-tm .ace_constant.ace_numeric {\n  color: rgb(0, 0, 205);\n}\n\n.ace-tm .ace_variable {\n  color: rgb(49, 132, 149);\n}\n\n.ace-tm .ace_xml-pe {\n  color: rgb(104, 104, 91);\n}\n\n.ace-tm .ace_entity.ace_name.ace_function {\n  color: #0000A2;\n}\n\n\n.ace-tm .ace_heading {\n  color: rgb(12, 7, 255);\n}\n\n.ace-tm .ace_list {\n  color:rgb(185, 6, 144);\n}\n\n.ace-tm .ace_meta.ace_tag {\n  color:rgb(0, 22, 142);\n}\n\n.ace-tm .ace_string.ace_regex {\n  color: rgb(255, 0, 0)\n}\n\n.ace-tm .ace_marker-layer .ace_selection {\n  background: rgb(181, 213, 255);\n}\n.ace-tm.ace_multiselect .ace_selection.ace_start {\n  box-shadow: 0 0 3px 0px white;\n}\n.ace-tm .ace_marker-layer .ace_step {\n  background: rgb(252, 255, 0);\n}\n\n.ace-tm .ace_marker-layer .ace_stack {\n  background: rgb(164, 229, 101);\n}\n\n.ace-tm .ace_marker-layer .ace_bracket {\n  margin: -1px 0 0 -1px;\n  border: 1px solid rgb(192, 192, 192);\n}\n\n.ace-tm .ace_marker-layer .ace_active-line {\n  background: rgba(0, 0, 0, 0.07);\n}\n\n.ace-tm .ace_gutter-active-line {\n    background-color : #dcdcdc;\n}\n\n.ace-tm .ace_marker-layer .ace_selected-word {\n  background: rgb(250, 250, 255);\n  border: 1px solid rgb(200, 200, 250);\n}\n\n.ace-tm .ace_indent-guide {\n  background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;\n}\n\n.ace-tm .ace_indent-guide-active {\n  background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAZSURBVHjaYvj///9/hivKyv8BAAAA//8DACLqBhbvk+/eAAAAAElFTkSuQmCC") right repeat-y;\n}\n';
  });
  ace.define("ace/theme/textmate", ["require", "exports", "module", "ace/theme/textmate-css", "ace/lib/dom"], function(require2, exports3, module3) {
    exports3.isDark = false;
    exports3.cssClass = "ace-tm";
    exports3.cssText = require2("./textmate-css");
    exports3.$id = "ace/theme/textmate";
    var dom = require2("../lib/dom");
    dom.importCssString(exports3.cssText, exports3.cssClass, false);
  });
  ace.define("ace/config", ["require", "exports", "module", "ace/lib/lang", "ace/lib/net", "ace/lib/dom", "ace/lib/app_config", "ace/theme/textmate"], function(require2, exports3, module3) {
    "no use strict";
    var lang2 = require2("./lib/lang");
    var net = require2("./lib/net");
    var dom = require2("./lib/dom");
    var AppConfig = require2("./lib/app_config").AppConfig;
    module3.exports = exports3 = new AppConfig();
    var options = {
      packaged: false,
      workerPath: null,
      modePath: null,
      themePath: null,
      basePath: "",
      suffix: ".js",
      $moduleUrls: {},
      loadWorkerFromBlob: true,
      sharedPopups: false,
      useStrictCSP: null
    };
    exports3.get = function(key) {
      if (!options.hasOwnProperty(key))
        throw new Error("Unknown config key: " + key);
      return options[key];
    };
    exports3.set = function(key, value2) {
      if (options.hasOwnProperty(key))
        options[key] = value2;
      else if (this.setDefaultValue("", key, value2) == false)
        throw new Error("Unknown config key: " + key);
      if (key == "useStrictCSP")
        dom.useStrictCSP(value2);
    };
    exports3.all = function() {
      return lang2.copyObject(options);
    };
    exports3.$modes = {};
    exports3.moduleUrl = function(name2, component) {
      if (options.$moduleUrls[name2])
        return options.$moduleUrls[name2];
      var parts = name2.split("/");
      component = component || parts[parts.length - 2] || "";
      var sep = component == "snippets" ? "/" : "-";
      var base = parts[parts.length - 1];
      if (component == "worker" && sep == "-") {
        var re2 = new RegExp("^" + component + "[\\-_]|[\\-_]" + component + "$", "g");
        base = base.replace(re2, "");
      }
      if ((!base || base == component) && parts.length > 1)
        base = parts[parts.length - 2];
      var path = options[component + "Path"];
      if (path == null) {
        path = options.basePath;
      } else if (sep == "/") {
        component = sep = "";
      }
      if (path && path.slice(-1) != "/")
        path += "/";
      return path + component + sep + base + this.get("suffix");
    };
    exports3.setModuleUrl = function(name2, subst) {
      return options.$moduleUrls[name2] = subst;
    };
    var loader = function(moduleName, cb2) {
      if (moduleName === "ace/theme/textmate" || moduleName === "./theme/textmate")
        return cb2(null, require2("./theme/textmate"));
      if (customLoader)
        return customLoader(moduleName, cb2);
      console.error("loader is not configured");
    };
    var customLoader;
    exports3.setLoader = function(cb2) {
      customLoader = cb2;
    };
    exports3.dynamicModules = /* @__PURE__ */ Object.create(null);
    exports3.$loading = {};
    exports3.$loaded = {};
    exports3.loadModule = function(moduleId, onLoad) {
      var loadedModule;
      if (Array.isArray(moduleId)) {
        var moduleType = moduleId[0];
        var moduleName = moduleId[1];
      } else if (typeof moduleId == "string") {
        var moduleName = moduleId;
      }
      var load = function(module4) {
        if (module4 && !exports3.$loading[moduleName])
          return onLoad && onLoad(module4);
        if (!exports3.$loading[moduleName])
          exports3.$loading[moduleName] = [];
        exports3.$loading[moduleName].push(onLoad);
        if (exports3.$loading[moduleName].length > 1)
          return;
        var afterLoad = function() {
          loader(moduleName, function(err, module5) {
            if (module5)
              exports3.$loaded[moduleName] = module5;
            exports3._emit("load.module", { name: moduleName, module: module5 });
            var listeners = exports3.$loading[moduleName];
            exports3.$loading[moduleName] = null;
            listeners.forEach(function(onLoad2) {
              onLoad2 && onLoad2(module5);
            });
          });
        };
        if (!exports3.get("packaged"))
          return afterLoad();
        net.loadScript(exports3.moduleUrl(moduleName, moduleType), afterLoad);
        reportErrorIfPathIsNotConfigured();
      };
      if (exports3.dynamicModules[moduleName]) {
        exports3.dynamicModules[moduleName]().then(function(module4) {
          if (module4.default) {
            load(module4.default);
          } else {
            load(module4);
          }
        });
      } else {
        try {
          loadedModule = this.$require(moduleName);
        } catch (e2) {
        }
        load(loadedModule || exports3.$loaded[moduleName]);
      }
    };
    exports3.$require = function(moduleName) {
      if (typeof module3["require"] == "function") {
        var req = "require";
        return module3[req](moduleName);
      }
    };
    exports3.setModuleLoader = function(moduleName, onLoad) {
      exports3.dynamicModules[moduleName] = onLoad;
    };
    var reportErrorIfPathIsNotConfigured = function() {
      if (!options.basePath && !options.workerPath && !options.modePath && !options.themePath && !Object.keys(options.$moduleUrls).length) {
        console.error("Unable to infer path to ace from script src,", "use ace.config.set('basePath', 'path') to enable dynamic loading of modes and themes", "or with webpack use ace/webpack-resolver");
        reportErrorIfPathIsNotConfigured = function() {
        };
      }
    };
    exports3.version = "1.43.2";
  });
  ace.define("ace/loader_build", ["require", "exports", "module", "ace/lib/fixoldbrowsers", "ace/config"], function(require2, exports3, module3) {
    require2("./lib/fixoldbrowsers");
    var config2 = require2("./config");
    config2.setLoader(function(moduleName, cb2) {
      require2([moduleName], function(module4) {
        cb2(null, module4);
      });
    });
    var global2 = /* @__PURE__ */ function() {
      return this || typeof window != "undefined" && window;
    }();
    module3.exports = function(ace2) {
      config2.init = init2;
      config2.$require = require2;
      ace2.require = require2;
    };
    init2(true);
    function init2(packaged) {
      if (!global2 || !global2.document)
        return;
      config2.set("packaged", packaged || require2.packaged || module3.packaged || global2.define && (void 0).packaged);
      var scriptOptions = {};
      var scriptUrl = "";
      var currentScript = document.currentScript || document._currentScript;
      var currentDocument = currentScript && currentScript.ownerDocument || document;
      if (currentScript && currentScript.src) {
        scriptUrl = currentScript.src.split(/[?#]/)[0].split("/").slice(0, -1).join("/") || "";
      }
      var scripts = currentDocument.getElementsByTagName("script");
      for (var i2 = 0; i2 < scripts.length; i2++) {
        var script = scripts[i2];
        var src = script.src || script.getAttribute("src");
        if (!src)
          continue;
        var attributes2 = script.attributes;
        for (var j2 = 0, l2 = attributes2.length; j2 < l2; j2++) {
          var attr = attributes2[j2];
          if (attr.name.indexOf("data-ace-") === 0) {
            scriptOptions[deHyphenate(attr.name.replace(/^data-ace-/, ""))] = attr.value;
          }
        }
        var m2 = src.match(/^(.*)\/ace([\-.]\w+)?\.js(\?|$)/);
        if (m2)
          scriptUrl = m2[1];
      }
      if (scriptUrl) {
        scriptOptions.base = scriptOptions.base || scriptUrl;
        scriptOptions.packaged = true;
      }
      scriptOptions.basePath = scriptOptions.base;
      scriptOptions.workerPath = scriptOptions.workerPath || scriptOptions.base;
      scriptOptions.modePath = scriptOptions.modePath || scriptOptions.base;
      scriptOptions.themePath = scriptOptions.themePath || scriptOptions.base;
      delete scriptOptions.base;
      for (var key in scriptOptions)
        if (typeof scriptOptions[key] !== "undefined")
          config2.set(key, scriptOptions[key]);
    }
    function deHyphenate(str) {
      return str.replace(/-(.)/g, function(m2, m1) {
        return m1.toUpperCase();
      });
    }
  });
  ace.define("ace/range", ["require", "exports", "module"], function(require2, exports3, module3) {
    var Range2 = (
      /** @class */
      function() {
        function Range3(startRow, startColumn, endRow, endColumn) {
          this.start = {
            row: startRow,
            column: startColumn
          };
          this.end = {
            row: endRow,
            column: endColumn
          };
        }
        Range3.prototype.isEqual = function(range3) {
          return this.start.row === range3.start.row && this.end.row === range3.end.row && this.start.column === range3.start.column && this.end.column === range3.end.column;
        };
        Range3.prototype.toString = function() {
          return "Range: [" + this.start.row + "/" + this.start.column + "] -> [" + this.end.row + "/" + this.end.column + "]";
        };
        Range3.prototype.contains = function(row, column2) {
          return this.compare(row, column2) == 0;
        };
        Range3.prototype.compareRange = function(range3) {
          var cmp, end2 = range3.end, start2 = range3.start;
          cmp = this.compare(end2.row, end2.column);
          if (cmp == 1) {
            cmp = this.compare(start2.row, start2.column);
            if (cmp == 1) {
              return 2;
            } else if (cmp == 0) {
              return 1;
            } else {
              return 0;
            }
          } else if (cmp == -1) {
            return -2;
          } else {
            cmp = this.compare(start2.row, start2.column);
            if (cmp == -1) {
              return -1;
            } else if (cmp == 1) {
              return 42;
            } else {
              return 0;
            }
          }
        };
        Range3.prototype.comparePoint = function(p2) {
          return this.compare(p2.row, p2.column);
        };
        Range3.prototype.containsRange = function(range3) {
          return this.comparePoint(range3.start) == 0 && this.comparePoint(range3.end) == 0;
        };
        Range3.prototype.intersects = function(range3) {
          var cmp = this.compareRange(range3);
          return cmp == -1 || cmp == 0 || cmp == 1;
        };
        Range3.prototype.isEnd = function(row, column2) {
          return this.end.row == row && this.end.column == column2;
        };
        Range3.prototype.isStart = function(row, column2) {
          return this.start.row == row && this.start.column == column2;
        };
        Range3.prototype.setStart = function(row, column2) {
          if (typeof row == "object") {
            this.start.column = row.column;
            this.start.row = row.row;
          } else {
            this.start.row = row;
            this.start.column = column2;
          }
        };
        Range3.prototype.setEnd = function(row, column2) {
          if (typeof row == "object") {
            this.end.column = row.column;
            this.end.row = row.row;
          } else {
            this.end.row = row;
            this.end.column = column2;
          }
        };
        Range3.prototype.inside = function(row, column2) {
          if (this.compare(row, column2) == 0) {
            if (this.isEnd(row, column2) || this.isStart(row, column2)) {
              return false;
            } else {
              return true;
            }
          }
          return false;
        };
        Range3.prototype.insideStart = function(row, column2) {
          if (this.compare(row, column2) == 0) {
            if (this.isEnd(row, column2)) {
              return false;
            } else {
              return true;
            }
          }
          return false;
        };
        Range3.prototype.insideEnd = function(row, column2) {
          if (this.compare(row, column2) == 0) {
            if (this.isStart(row, column2)) {
              return false;
            } else {
              return true;
            }
          }
          return false;
        };
        Range3.prototype.compare = function(row, column2) {
          if (!this.isMultiLine()) {
            if (row === this.start.row) {
              return column2 < this.start.column ? -1 : column2 > this.end.column ? 1 : 0;
            }
          }
          if (row < this.start.row)
            return -1;
          if (row > this.end.row)
            return 1;
          if (this.start.row === row)
            return column2 >= this.start.column ? 0 : -1;
          if (this.end.row === row)
            return column2 <= this.end.column ? 0 : 1;
          return 0;
        };
        Range3.prototype.compareStart = function(row, column2) {
          if (this.start.row == row && this.start.column == column2) {
            return -1;
          } else {
            return this.compare(row, column2);
          }
        };
        Range3.prototype.compareEnd = function(row, column2) {
          if (this.end.row == row && this.end.column == column2) {
            return 1;
          } else {
            return this.compare(row, column2);
          }
        };
        Range3.prototype.compareInside = function(row, column2) {
          if (this.end.row == row && this.end.column == column2) {
            return 1;
          } else if (this.start.row == row && this.start.column == column2) {
            return -1;
          } else {
            return this.compare(row, column2);
          }
        };
        Range3.prototype.clipRows = function(firstRow, lastRow) {
          if (this.end.row > lastRow)
            var end2 = { row: lastRow + 1, column: 0 };
          else if (this.end.row < firstRow)
            var end2 = { row: firstRow, column: 0 };
          if (this.start.row > lastRow)
            var start2 = { row: lastRow + 1, column: 0 };
          else if (this.start.row < firstRow)
            var start2 = { row: firstRow, column: 0 };
          return Range3.fromPoints(start2 || this.start, end2 || this.end);
        };
        Range3.prototype.extend = function(row, column2) {
          var cmp = this.compare(row, column2);
          if (cmp == 0)
            return this;
          else if (cmp == -1)
            var start2 = { row, column: column2 };
          else
            var end2 = { row, column: column2 };
          return Range3.fromPoints(start2 || this.start, end2 || this.end);
        };
        Range3.prototype.isEmpty = function() {
          return this.start.row === this.end.row && this.start.column === this.end.column;
        };
        Range3.prototype.isMultiLine = function() {
          return this.start.row !== this.end.row;
        };
        Range3.prototype.clone = function() {
          return Range3.fromPoints(this.start, this.end);
        };
        Range3.prototype.collapseRows = function() {
          if (this.end.column == 0)
            return new Range3(this.start.row, 0, Math.max(this.start.row, this.end.row - 1), 0);
          else
            return new Range3(this.start.row, 0, this.end.row, 0);
        };
        Range3.prototype.toScreenRange = function(session) {
          var screenPosStart = session.documentToScreenPosition(this.start);
          var screenPosEnd = session.documentToScreenPosition(this.end);
          return new Range3(screenPosStart.row, screenPosStart.column, screenPosEnd.row, screenPosEnd.column);
        };
        Range3.prototype.moveBy = function(row, column2) {
          this.start.row += row;
          this.start.column += column2;
          this.end.row += row;
          this.end.column += column2;
        };
        return Range3;
      }()
    );
    Range2.fromPoints = function(start2, end2) {
      return new Range2(start2.row, start2.column, end2.row, end2.column);
    };
    Range2.comparePoints = function(p1, p2) {
      return p1.row - p2.row || p1.column - p2.column;
    };
    exports3.Range = Range2;
  });
  ace.define("ace/lib/keys", ["require", "exports", "module", "ace/lib/oop"], function(require2, exports3, module3) {
    var oop = require2("./oop");
    var Keys2 = {
      MODIFIER_KEYS: {
        16: "Shift",
        17: "Ctrl",
        18: "Alt",
        224: "Meta",
        91: "MetaLeft",
        92: "MetaRight",
        93: "ContextMenu"
      },
      KEY_MODS: {
        "ctrl": 1,
        "alt": 2,
        "option": 2,
        "shift": 4,
        "super": 8,
        "meta": 8,
        "command": 8,
        "cmd": 8,
        "control": 1
      },
      FUNCTION_KEYS: {
        8: "Backspace",
        9: "Tab",
        13: "Return",
        19: "Pause",
        27: "Esc",
        32: "Space",
        33: "PageUp",
        34: "PageDown",
        35: "End",
        36: "Home",
        37: "Left",
        38: "Up",
        39: "Right",
        40: "Down",
        44: "Print",
        45: "Insert",
        46: "Delete",
        "-13": "NumpadEnter",
        144: "Numlock",
        145: "Scrolllock"
      },
      PRINTABLE_KEYS: {
        32: " ",
        59: ";",
        61: "=",
        107: "+",
        109: "-",
        110: ".",
        186: ";",
        187: "=",
        188: ",",
        189: "-",
        190: ".",
        191: "/",
        192: "`",
        219: "[",
        220: "\\",
        221: "]",
        222: "'",
        111: "/",
        106: "*"
      }
    };
    var codeToKeyCode = {
      Command: 224,
      Backspace: 8,
      Tab: 9,
      Return: 13,
      Enter: 13,
      Pause: 19,
      Escape: 27,
      PageUp: 33,
      PageDown: 34,
      End: 35,
      Home: 36,
      Insert: 45,
      Delete: 46,
      ArrowLeft: 37,
      ArrowUp: 38,
      ArrowRight: 39,
      ArrowDown: 40,
      Backquote: 192,
      Minus: 189,
      Equal: 187,
      BracketLeft: 219,
      Backslash: 220,
      BracketRight: 221,
      Semicolon: 186,
      Quote: 222,
      Comma: 188,
      Period: 190,
      Slash: 191,
      Space: 32,
      NumpadAdd: 107,
      NumpadDecimal: 110,
      NumpadSubtract: 109,
      NumpadDivide: 111,
      NumpadMultiply: 106
    };
    for (var i2 = 0; i2 < 10; i2++) {
      codeToKeyCode["Digit" + i2] = 48 + i2;
      codeToKeyCode["Numpad" + i2] = 96 + i2;
      Keys2.PRINTABLE_KEYS[48 + i2] = "" + i2;
      Keys2.FUNCTION_KEYS[96 + i2] = "Numpad" + i2;
    }
    for (var i2 = 65; i2 < 91; i2++) {
      var chr = String.fromCharCode(i2 + 32);
      codeToKeyCode["Key" + chr.toUpperCase()] = i2;
      Keys2.PRINTABLE_KEYS[i2] = chr;
    }
    for (var i2 = 1; i2 < 13; i2++) {
      codeToKeyCode["F" + i2] = 111 + i2;
      Keys2.FUNCTION_KEYS[111 + i2] = "F" + i2;
    }
    var modifiers = {
      Shift: 16,
      Control: 17,
      Alt: 18,
      Meta: 224
    };
    for (var mod2 in modifiers) {
      codeToKeyCode[mod2] = codeToKeyCode[mod2 + "Left"] = codeToKeyCode[mod2 + "Right"] = modifiers[mod2];
    }
    exports3.$codeToKeyCode = codeToKeyCode;
    Keys2.PRINTABLE_KEYS[173] = "-";
    for (var j2 in Keys2.FUNCTION_KEYS) {
      var name2 = Keys2.FUNCTION_KEYS[j2].toLowerCase();
      Keys2[name2] = parseInt(j2, 10);
    }
    for (var j2 in Keys2.PRINTABLE_KEYS) {
      var name2 = Keys2.PRINTABLE_KEYS[j2].toLowerCase();
      Keys2[name2] = parseInt(j2, 10);
    }
    oop.mixin(Keys2, Keys2.MODIFIER_KEYS);
    oop.mixin(Keys2, Keys2.PRINTABLE_KEYS);
    oop.mixin(Keys2, Keys2.FUNCTION_KEYS);
    Keys2.enter = Keys2["return"];
    Keys2.escape = Keys2.esc;
    Keys2.del = Keys2["delete"];
    (function() {
      var mods = ["cmd", "ctrl", "alt", "shift"];
      for (var i3 = Math.pow(2, mods.length); i3--; ) {
        Keys2.KEY_MODS[i3] = mods.filter(function(x2) {
          return i3 & Keys2.KEY_MODS[x2];
        }).join("-") + "-";
      }
    })();
    Keys2.KEY_MODS[0] = "";
    Keys2.KEY_MODS[-1] = "input-";
    oop.mixin(exports3, Keys2);
    exports3.default = exports3;
    exports3.keyCodeToString = function(keyCode) {
      var keyString = Keys2[keyCode];
      if (typeof keyString != "string")
        keyString = String.fromCharCode(keyCode);
      return keyString.toLowerCase();
    };
  });
  ace.define("ace/lib/event", ["require", "exports", "module", "ace/lib/keys", "ace/lib/useragent"], function(require2, exports3, module3) {
    var keys2 = require2("./keys");
    var useragent = require2("./useragent");
    var pressedKeys = null;
    var ts = 0;
    var activeListenerOptions;
    function detectListenerOptionsSupport() {
      activeListenerOptions = false;
      try {
        document.createComment("").addEventListener("test", function() {
        }, {
          get passive() {
            activeListenerOptions = { passive: false };
            return true;
          }
        });
      } catch (e2) {
      }
    }
    function getListenerOptions() {
      if (activeListenerOptions == void 0)
        detectListenerOptionsSupport();
      return activeListenerOptions;
    }
    function EventListener2(elem, type4, callback2) {
      this.elem = elem;
      this.type = type4;
      this.callback = callback2;
    }
    EventListener2.prototype.destroy = function() {
      removeListener2(this.elem, this.type, this.callback);
      this.elem = this.type = this.callback = void 0;
    };
    var addListener2 = exports3.addListener = function(elem, type4, callback2, destroyer) {
      elem.addEventListener(type4, callback2, getListenerOptions());
      if (destroyer)
        destroyer.$toDestroy.push(new EventListener2(elem, type4, callback2));
    };
    var removeListener2 = exports3.removeListener = function(elem, type4, callback2) {
      elem.removeEventListener(type4, callback2, getListenerOptions());
    };
    exports3.stopEvent = function(e2) {
      exports3.stopPropagation(e2);
      exports3.preventDefault(e2);
      return false;
    };
    exports3.stopPropagation = function(e2) {
      if (e2.stopPropagation)
        e2.stopPropagation();
    };
    exports3.preventDefault = function(e2) {
      if (e2.preventDefault)
        e2.preventDefault();
    };
    exports3.getButton = function(e2) {
      if (e2.type == "dblclick")
        return 0;
      if (e2.type == "contextmenu" || useragent.isMac && (e2.ctrlKey && !e2.altKey && !e2.shiftKey))
        return 2;
      return e2.button;
    };
    exports3.capture = function(el2, eventHandler, releaseCaptureHandler) {
      var ownerDocument = el2 && el2.ownerDocument || document;
      function onMouseUp(e2) {
        eventHandler && eventHandler(e2);
        releaseCaptureHandler && releaseCaptureHandler(e2);
        removeListener2(ownerDocument, "mousemove", eventHandler);
        removeListener2(ownerDocument, "mouseup", onMouseUp);
        removeListener2(ownerDocument, "dragstart", onMouseUp);
      }
      addListener2(ownerDocument, "mousemove", eventHandler);
      addListener2(ownerDocument, "mouseup", onMouseUp);
      addListener2(ownerDocument, "dragstart", onMouseUp);
      return onMouseUp;
    };
    exports3.addMouseWheelListener = function(el2, callback2, destroyer) {
      addListener2(el2, "wheel", function(e2) {
        var factor = 0.15;
        var deltaX = e2.deltaX || 0;
        var deltaY = e2.deltaY || 0;
        switch (e2.deltaMode) {
          case e2.DOM_DELTA_PIXEL:
            e2.wheelX = deltaX * factor;
            e2.wheelY = deltaY * factor;
            break;
          case e2.DOM_DELTA_LINE:
            var linePixels = 15;
            e2.wheelX = deltaX * linePixels;
            e2.wheelY = deltaY * linePixels;
            break;
          case e2.DOM_DELTA_PAGE:
            var pagePixels = 150;
            e2.wheelX = deltaX * pagePixels;
            e2.wheelY = deltaY * pagePixels;
            break;
        }
        callback2(e2);
      }, destroyer);
    };
    exports3.addMultiMouseDownListener = function(elements, timeouts, eventHandler, callbackName, destroyer) {
      var clicks = 0;
      var startX, startY, timer;
      var eventNames = {
        2: "dblclick",
        3: "tripleclick",
        4: "quadclick"
      };
      function onMousedown(e2) {
        if (exports3.getButton(e2) !== 0) {
          clicks = 0;
        } else if (e2.detail > 1) {
          clicks++;
          if (clicks > 4)
            clicks = 1;
        } else {
          clicks = 1;
        }
        if (useragent.isIE) {
          var isNewClick = Math.abs(e2.clientX - startX) > 5 || Math.abs(e2.clientY - startY) > 5;
          if (!timer || isNewClick)
            clicks = 1;
          if (timer)
            clearTimeout(timer);
          timer = setTimeout(function() {
            timer = null;
          }, timeouts[clicks - 1] || 600);
          if (clicks == 1) {
            startX = e2.clientX;
            startY = e2.clientY;
          }
        }
        e2._clicks = clicks;
        eventHandler[callbackName]("mousedown", e2);
        if (clicks > 4)
          clicks = 0;
        else if (clicks > 1)
          return eventHandler[callbackName](eventNames[clicks], e2);
      }
      if (!Array.isArray(elements))
        elements = [elements];
      elements.forEach(function(el2) {
        addListener2(el2, "mousedown", onMousedown, destroyer);
      });
    };
    function getModifierHash(e2) {
      return 0 | (e2.ctrlKey ? 1 : 0) | (e2.altKey ? 2 : 0) | (e2.shiftKey ? 4 : 0) | (e2.metaKey ? 8 : 0);
    }
    exports3.getModifierString = function(e2) {
      return keys2.KEY_MODS[getModifierHash(e2)];
    };
    function normalizeCommandKeys(callback2, e2, keyCode) {
      var hashId = getModifierHash(e2);
      if (!keyCode && e2.code) {
        keyCode = keys2.$codeToKeyCode[e2.code] || keyCode;
      }
      if (!useragent.isMac && pressedKeys) {
        if (e2.getModifierState && (e2.getModifierState("OS") || e2.getModifierState("Win")))
          hashId |= 8;
        if (pressedKeys.altGr) {
          if ((3 & hashId) != 3)
            pressedKeys.altGr = 0;
          else
            return;
        }
        if (keyCode === 18 || keyCode === 17) {
          var location2 = e2.location;
          if (keyCode === 17 && location2 === 1) {
            if (pressedKeys[keyCode] == 1)
              ts = e2.timeStamp;
          } else if (keyCode === 18 && hashId === 3 && location2 === 2) {
            var dt = e2.timeStamp - ts;
            if (dt < 50)
              pressedKeys.altGr = true;
          }
        }
      }
      if (keyCode in keys2.MODIFIER_KEYS) {
        keyCode = -1;
      }
      if (!hashId && keyCode === 13) {
        if (e2.location === 3) {
          callback2(e2, hashId, -keyCode);
          if (e2.defaultPrevented)
            return;
        }
      }
      if (useragent.isChromeOS && hashId & 8) {
        callback2(e2, hashId, keyCode);
        if (e2.defaultPrevented)
          return;
        else
          hashId &= -9;
      }
      if (!hashId && !(keyCode in keys2.FUNCTION_KEYS) && !(keyCode in keys2.PRINTABLE_KEYS)) {
        return false;
      }
      return callback2(e2, hashId, keyCode);
    }
    exports3.addCommandKeyListener = function(el2, callback2, destroyer) {
      var lastDefaultPrevented = null;
      addListener2(el2, "keydown", function(e2) {
        pressedKeys[e2.keyCode] = (pressedKeys[e2.keyCode] || 0) + 1;
        var result = normalizeCommandKeys(callback2, e2, e2.keyCode);
        lastDefaultPrevented = e2.defaultPrevented;
        return result;
      }, destroyer);
      addListener2(el2, "keypress", function(e2) {
        if (lastDefaultPrevented && (e2.ctrlKey || e2.altKey || e2.shiftKey || e2.metaKey)) {
          exports3.stopEvent(e2);
          lastDefaultPrevented = null;
        }
      }, destroyer);
      addListener2(el2, "keyup", function(e2) {
        pressedKeys[e2.keyCode] = null;
      }, destroyer);
      if (!pressedKeys) {
        resetPressedKeys();
        addListener2(window, "focus", resetPressedKeys);
      }
    };
    function resetPressedKeys() {
      pressedKeys = /* @__PURE__ */ Object.create(null);
    }
    if (typeof window == "object" && window.postMessage && !useragent.isOldIE) {
      var postMessageId = 1;
      exports3.nextTick = function(callback2, win2) {
        win2 = win2 || window;
        var messageName = "zero-timeout-message-" + postMessageId++;
        var listener = function(e2) {
          if (e2.data == messageName) {
            exports3.stopPropagation(e2);
            removeListener2(win2, "message", listener);
            callback2();
          }
        };
        addListener2(win2, "message", listener);
        win2.postMessage(messageName, "*");
      };
    }
    exports3.$idleBlocked = false;
    exports3.onIdle = function(cb2, timeout) {
      return setTimeout(function handler() {
        if (!exports3.$idleBlocked) {
          cb2();
        } else {
          setTimeout(handler, 100);
        }
      }, timeout);
    };
    exports3.$idleBlockId = null;
    exports3.blockIdle = function(delay2) {
      if (exports3.$idleBlockId)
        clearTimeout(exports3.$idleBlockId);
      exports3.$idleBlocked = true;
      exports3.$idleBlockId = setTimeout(function() {
        exports3.$idleBlocked = false;
      }, delay2 || 100);
    };
    exports3.nextFrame = typeof window == "object" && (window.requestAnimationFrame || window["mozRequestAnimationFrame"] || window["webkitRequestAnimationFrame"] || window["msRequestAnimationFrame"] || window["oRequestAnimationFrame"]);
    if (exports3.nextFrame)
      exports3.nextFrame = exports3.nextFrame.bind(window);
    else
      exports3.nextFrame = function(callback2) {
        setTimeout(callback2, 17);
      };
  });
  ace.define("ace/clipboard", ["require", "exports", "module"], function(require2, exports3, module3) {
    var $cancelT;
    module3.exports = {
      lineMode: false,
      pasteCancelled: function() {
        if ($cancelT && $cancelT > Date.now() - 50)
          return true;
        return $cancelT = false;
      },
      cancel: function() {
        $cancelT = Date.now();
      }
    };
  });
  ace.define("ace/keyboard/textinput", ["require", "exports", "module", "ace/lib/event", "ace/config", "ace/lib/useragent", "ace/lib/dom", "ace/lib/lang", "ace/clipboard", "ace/lib/keys"], function(require2, exports3, module3) {
    var event = require2("../lib/event");
    var nls = require2("../config").nls;
    var useragent = require2("../lib/useragent");
    var dom = require2("../lib/dom");
    var lang2 = require2("../lib/lang");
    var clipboard = require2("../clipboard");
    var BROKEN_SETDATA = useragent.isChrome < 18;
    var USE_IE_MIME_TYPE = useragent.isIE;
    var HAS_FOCUS_ARGS = useragent.isChrome > 63;
    var MAX_LINE_LENGTH = 400;
    var KEYS = require2("../lib/keys");
    var MODS = KEYS.KEY_MODS;
    var isIOS = useragent.isIOS;
    var valueResetRegex = isIOS ? /\s/ : /\n/;
    var isMobile2 = useragent.isMobile;
    var TextInput = (
      /** @class */
      function() {
        function TextInput2(parentNode, host) {
          var _this = this;
          this.host = host;
          this.text = dom.createElement("textarea");
          this.text.className = "ace_text-input";
          this.text.setAttribute("wrap", "off");
          this.text.setAttribute("autocorrect", "off");
          this.text.setAttribute("autocapitalize", "off");
          this.text.setAttribute("spellcheck", "false");
          this.text.style.opacity = "0";
          parentNode.insertBefore(this.text, parentNode.firstChild);
          this.copied = false;
          this.pasted = false;
          this.inComposition = false;
          this.sendingText = false;
          this.tempStyle = "";
          if (!isMobile2)
            this.text.style.fontSize = "1px";
          this.commandMode = false;
          this.ignoreFocusEvents = false;
          this.lastValue = "";
          this.lastSelectionStart = 0;
          this.lastSelectionEnd = 0;
          this.lastRestoreEnd = 0;
          this.rowStart = Number.MAX_SAFE_INTEGER;
          this.rowEnd = Number.MIN_SAFE_INTEGER;
          this.numberOfExtraLines = 0;
          try {
            this.$isFocused = document.activeElement === this.text;
          } catch (e2) {
          }
          this.cancelComposition = this.cancelComposition.bind(this);
          this.setAriaOptions({ role: "textbox" });
          event.addListener(this.text, "blur", function(e2) {
            if (_this.ignoreFocusEvents)
              return;
            host.onBlur(e2);
            _this.$isFocused = false;
          }, host);
          event.addListener(this.text, "focus", function(e2) {
            if (_this.ignoreFocusEvents)
              return;
            _this.$isFocused = true;
            if (useragent.isEdge) {
              try {
                if (!document.hasFocus())
                  return;
              } catch (e3) {
              }
            }
            host.onFocus(e2);
            if (useragent.isEdge)
              setTimeout(_this.resetSelection.bind(_this));
            else
              _this.resetSelection();
          }, host);
          this.$focusScroll = false;
          host.on("beforeEndOperation", function() {
            var curOp = host.curOp;
            var commandName = curOp && curOp.command && curOp.command.name;
            if (commandName == "insertstring")
              return;
            var isUserAction = commandName && (curOp.docChanged || curOp.selectionChanged);
            if (_this.inComposition && isUserAction) {
              _this.lastValue = _this.text.value = "";
              _this.onCompositionEnd();
            }
            _this.resetSelection();
          });
          host.on("changeSelection", this.setAriaLabel.bind(this));
          this.resetSelection = isIOS ? this.$resetSelectionIOS : this.$resetSelection;
          if (this.$isFocused)
            host.onFocus();
          this.inputHandler = null;
          this.afterContextMenu = false;
          event.addCommandKeyListener(this.text, function(e2, hashId, keyCode) {
            if (_this.inComposition)
              return;
            return host.onCommandKey(e2, hashId, keyCode);
          }, host);
          event.addListener(this.text, "select", this.onSelect.bind(this), host);
          event.addListener(this.text, "input", this.onInput.bind(this), host);
          event.addListener(this.text, "cut", this.onCut.bind(this), host);
          event.addListener(this.text, "copy", this.onCopy.bind(this), host);
          event.addListener(this.text, "paste", this.onPaste.bind(this), host);
          if (!("oncut" in this.text) || !("oncopy" in this.text) || !("onpaste" in this.text)) {
            event.addListener(parentNode, "keydown", function(e2) {
              if (useragent.isMac && !e2.metaKey || !e2.ctrlKey)
                return;
              switch (e2.keyCode) {
                case 67:
                  _this.onCopy(e2);
                  break;
                case 86:
                  _this.onPaste(e2);
                  break;
                case 88:
                  _this.onCut(e2);
                  break;
              }
            }, host);
          }
          this.syncComposition = lang2.delayedCall(this.onCompositionUpdate.bind(this), 50).schedule.bind(null, null);
          event.addListener(this.text, "compositionstart", this.onCompositionStart.bind(this), host);
          event.addListener(this.text, "compositionupdate", this.onCompositionUpdate.bind(this), host);
          event.addListener(this.text, "keyup", this.onKeyup.bind(this), host);
          event.addListener(this.text, "keydown", this.syncComposition.bind(this), host);
          event.addListener(this.text, "compositionend", this.onCompositionEnd.bind(this), host);
          this.closeTimeout;
          event.addListener(this.text, "mouseup", this.$onContextMenu.bind(this), host);
          event.addListener(this.text, "mousedown", function(e2) {
            e2.preventDefault();
            _this.onContextMenuClose();
          }, host);
          event.addListener(host.renderer.scroller, "contextmenu", this.$onContextMenu.bind(this), host);
          event.addListener(this.text, "contextmenu", this.$onContextMenu.bind(this), host);
          if (isIOS)
            this.addIosSelectionHandler(parentNode, host, this.text);
        }
        TextInput2.prototype.addIosSelectionHandler = function(parentNode, host, text2) {
          var _this = this;
          var typingResetTimeout = null;
          var typing = false;
          text2.addEventListener("keydown", function(e2) {
            if (typingResetTimeout)
              clearTimeout(typingResetTimeout);
            typing = true;
          }, true);
          text2.addEventListener("keyup", function(e2) {
            typingResetTimeout = setTimeout(function() {
              typing = false;
            }, 100);
          }, true);
          var detectArrowKeys = function(e2) {
            if (document.activeElement !== text2)
              return;
            if (typing || _this.inComposition || host.$mouseHandler.isMousePressed)
              return;
            if (_this.copied) {
              return;
            }
            var selectionStart = text2.selectionStart;
            var selectionEnd = text2.selectionEnd;
            var key = null;
            var modifier = 0;
            if (selectionStart == 0) {
              key = KEYS.up;
            } else if (selectionStart == 1) {
              key = KEYS.home;
            } else if (selectionEnd > _this.lastSelectionEnd && _this.lastValue[selectionEnd] == "\n") {
              key = KEYS.end;
            } else if (selectionStart < _this.lastSelectionStart && _this.lastValue[selectionStart - 1] == " ") {
              key = KEYS.left;
              modifier = MODS.option;
            } else if (selectionStart < _this.lastSelectionStart || selectionStart == _this.lastSelectionStart && _this.lastSelectionEnd != _this.lastSelectionStart && selectionStart == selectionEnd) {
              key = KEYS.left;
            } else if (selectionEnd > _this.lastSelectionEnd && _this.lastValue.slice(0, selectionEnd).split("\n").length > 2) {
              key = KEYS.down;
            } else if (selectionEnd > _this.lastSelectionEnd && _this.lastValue[selectionEnd - 1] == " ") {
              key = KEYS.right;
              modifier = MODS.option;
            } else if (selectionEnd > _this.lastSelectionEnd || selectionEnd == _this.lastSelectionEnd && _this.lastSelectionEnd != _this.lastSelectionStart && selectionStart == selectionEnd) {
              key = KEYS.right;
            }
            if (selectionStart !== selectionEnd)
              modifier |= MODS.shift;
            if (key) {
              var result = host.onCommandKey({}, modifier, key);
              if (!result && host.commands) {
                key = KEYS.keyCodeToString(key);
                var command = host.commands.findKeyCommand(modifier, key);
                if (command)
                  host.execCommand(command);
              }
              _this.lastSelectionStart = selectionStart;
              _this.lastSelectionEnd = selectionEnd;
              _this.resetSelection("");
            }
          };
          document.addEventListener("selectionchange", detectArrowKeys);
          host.on("destroy", function() {
            document.removeEventListener("selectionchange", detectArrowKeys);
          });
        };
        TextInput2.prototype.onContextMenuClose = function() {
          var _this = this;
          clearTimeout(this.closeTimeout);
          this.closeTimeout = setTimeout(function() {
            if (_this.tempStyle) {
              _this.text.style.cssText = _this.tempStyle;
              _this.tempStyle = "";
            }
            _this.host.renderer.$isMousePressed = false;
            if (_this.host.renderer.$keepTextAreaAtCursor)
              _this.host.renderer.$moveTextAreaToCursor();
          }, 0);
        };
        TextInput2.prototype.$onContextMenu = function(e2) {
          this.host.textInput.onContextMenu(e2);
          this.onContextMenuClose();
        };
        TextInput2.prototype.onKeyup = function(e2) {
          if (e2.keyCode == 27 && this.text.value.length < this.text.selectionStart) {
            if (!this.inComposition)
              this.lastValue = this.text.value;
            this.lastSelectionStart = this.lastSelectionEnd = -1;
            this.resetSelection();
          }
          this.syncComposition();
        };
        TextInput2.prototype.cancelComposition = function() {
          this.ignoreFocusEvents = true;
          this.text.blur();
          this.text.focus();
          this.ignoreFocusEvents = false;
        };
        TextInput2.prototype.onCompositionStart = function(e2) {
          if (this.inComposition || !this.host.onCompositionStart || this.host.$readOnly)
            return;
          this.inComposition = {};
          if (this.commandMode)
            return;
          if (e2.data)
            this.inComposition.useTextareaForIME = false;
          setTimeout(this.onCompositionUpdate.bind(this), 0);
          this.host._signal("compositionStart");
          this.host.on("mousedown", this.cancelComposition);
          var range3 = this.host.getSelectionRange();
          range3.end.row = range3.start.row;
          range3.end.column = range3.start.column;
          this.inComposition.markerRange = range3;
          this.inComposition.selectionStart = this.lastSelectionStart;
          this.host.onCompositionStart(this.inComposition);
          if (this.inComposition.useTextareaForIME) {
            this.lastValue = this.text.value = "";
            this.lastSelectionStart = 0;
            this.lastSelectionEnd = 0;
          } else {
            if (this.text.msGetInputContext)
              this.inComposition.context = this.text.msGetInputContext();
            if (this.text.getInputContext)
              this.inComposition.context = this.text.getInputContext();
          }
        };
        TextInput2.prototype.onCompositionUpdate = function() {
          if (!this.inComposition || !this.host.onCompositionUpdate || this.host.$readOnly)
            return;
          if (this.commandMode)
            return this.cancelComposition();
          if (this.inComposition.useTextareaForIME) {
            this.host.onCompositionUpdate(this.text.value);
          } else {
            var data = this.text.value;
            this.sendText(data);
            if (this.inComposition.markerRange) {
              if (this.inComposition.context) {
                this.inComposition.markerRange.start.column = this.inComposition.selectionStart = this.inComposition.context.compositionStartOffset;
              }
              this.inComposition.markerRange.end.column = this.inComposition.markerRange.start.column + this.lastSelectionEnd - this.inComposition.selectionStart + this.lastRestoreEnd;
            }
          }
        };
        TextInput2.prototype.onCompositionEnd = function(e2) {
          if (!this.host.onCompositionEnd || this.host.$readOnly)
            return;
          this.inComposition = false;
          this.host.onCompositionEnd();
          this.host.off("mousedown", this.cancelComposition);
          if (e2)
            this.onInput();
        };
        TextInput2.prototype.onCut = function(e2) {
          this.doCopy(e2, true);
        };
        TextInput2.prototype.onCopy = function(e2) {
          this.doCopy(e2, false);
        };
        TextInput2.prototype.onPaste = function(e2) {
          var data = this.handleClipboardData(e2);
          if (clipboard.pasteCancelled())
            return;
          if (typeof data == "string") {
            if (data)
              this.host.onPaste(data, e2);
            if (useragent.isIE)
              setTimeout(this.resetSelection);
            event.preventDefault(e2);
          } else {
            this.text.value = "";
            this.pasted = true;
          }
        };
        TextInput2.prototype.doCopy = function(e2, isCut) {
          var _this = this;
          var data = this.host.getCopyText();
          if (!data)
            return event.preventDefault(e2);
          if (this.handleClipboardData(e2, data)) {
            if (isIOS) {
              this.resetSelection(data);
              this.copied = data;
              setTimeout(function() {
                _this.copied = false;
              }, 10);
            }
            isCut ? this.host.onCut() : this.host.onCopy();
            event.preventDefault(e2);
          } else {
            this.copied = true;
            this.text.value = data;
            this.text.select();
            setTimeout(function() {
              _this.copied = false;
              _this.resetSelection();
              isCut ? _this.host.onCut() : _this.host.onCopy();
            });
          }
        };
        TextInput2.prototype.handleClipboardData = function(e2, data, forceIEMime) {
          var clipboardData = e2.clipboardData || window["clipboardData"];
          if (!clipboardData || BROKEN_SETDATA)
            return;
          var mime = USE_IE_MIME_TYPE || forceIEMime ? "Text" : "text/plain";
          try {
            if (data) {
              return clipboardData.setData(mime, data) !== false;
            } else {
              return clipboardData.getData(mime);
            }
          } catch (e3) {
            if (!forceIEMime)
              return this.handleClipboardData(e3, data, true);
          }
        };
        TextInput2.prototype.onInput = function(e2) {
          if (this.inComposition)
            return this.onCompositionUpdate();
          if (e2 && e2.inputType) {
            if (e2.inputType == "historyUndo")
              return this.host.execCommand("undo");
            if (e2.inputType == "historyRedo")
              return this.host.execCommand("redo");
          }
          var data = this.text.value;
          var inserted = this.sendText(data, true);
          if (data.length > MAX_LINE_LENGTH + 100 || valueResetRegex.test(inserted) || isMobile2 && this.lastSelectionStart < 1 && this.lastSelectionStart == this.lastSelectionEnd) {
            this.resetSelection();
          }
        };
        TextInput2.prototype.sendText = function(value2, fromInput) {
          if (this.afterContextMenu)
            this.afterContextMenu = false;
          if (this.pasted) {
            this.resetSelection();
            if (value2)
              this.host.onPaste(value2);
            this.pasted = false;
            return "";
          } else {
            var selectionStart = this.text.selectionStart;
            var selectionEnd = this.text.selectionEnd;
            var extendLeft = this.lastSelectionStart;
            var extendRight = this.lastValue.length - this.lastSelectionEnd;
            var inserted = value2;
            var restoreStart = value2.length - selectionStart;
            var restoreEnd = value2.length - selectionEnd;
            var i2 = 0;
            while (extendLeft > 0 && this.lastValue[i2] == value2[i2]) {
              i2++;
              extendLeft--;
            }
            inserted = inserted.slice(i2);
            i2 = 1;
            while (extendRight > 0 && this.lastValue.length - i2 > this.lastSelectionStart - 1 && this.lastValue[this.lastValue.length - i2] == value2[value2.length - i2]) {
              i2++;
              extendRight--;
            }
            restoreStart -= i2 - 1;
            restoreEnd -= i2 - 1;
            var endIndex = inserted.length - i2 + 1;
            if (endIndex < 0) {
              extendLeft = -endIndex;
              endIndex = 0;
            }
            inserted = inserted.slice(0, endIndex);
            if (!fromInput && !inserted && !restoreStart && !extendLeft && !extendRight && !restoreEnd)
              return "";
            this.sendingText = true;
            var shouldReset = false;
            if (useragent.isAndroid && inserted == ". ") {
              inserted = "  ";
              shouldReset = true;
            }
            if (inserted && !extendLeft && !extendRight && !restoreStart && !restoreEnd || this.commandMode) {
              this.host.onTextInput(inserted);
            } else {
              this.host.onTextInput(inserted, {
                extendLeft,
                extendRight,
                restoreStart,
                restoreEnd
              });
            }
            this.sendingText = false;
            this.lastValue = value2;
            this.lastSelectionStart = selectionStart;
            this.lastSelectionEnd = selectionEnd;
            this.lastRestoreEnd = restoreEnd;
            return shouldReset ? "\n" : inserted;
          }
        };
        TextInput2.prototype.onSelect = function(e2) {
          var _this = this;
          if (this.inComposition)
            return;
          var isAllSelected = function(text2) {
            return text2.selectionStart === 0 && text2.selectionEnd >= _this.lastValue.length && text2.value === _this.lastValue && _this.lastValue && text2.selectionEnd !== _this.lastSelectionEnd;
          };
          if (this.copied) {
            this.copied = false;
          } else if (isAllSelected(this.text)) {
            this.host.selectAll();
            this.resetSelection();
          } else if (isMobile2 && this.text.selectionStart != this.lastSelectionStart) {
            this.resetSelection();
          }
        };
        TextInput2.prototype.$resetSelectionIOS = function(value2) {
          if (!this.$isFocused || this.copied && !value2 || this.sendingText)
            return;
          if (!value2)
            value2 = "";
          var newValue = "\n ab" + value2 + "cde fg\n";
          if (newValue != this.text.value)
            this.text.value = this.lastValue = newValue;
          var selectionStart = 4;
          var selectionEnd = 4 + (value2.length || (this.host.selection.isEmpty() ? 0 : 1));
          if (this.lastSelectionStart != selectionStart || this.lastSelectionEnd != selectionEnd) {
            this.text.setSelectionRange(selectionStart, selectionEnd);
          }
          this.lastSelectionStart = selectionStart;
          this.lastSelectionEnd = selectionEnd;
        };
        TextInput2.prototype.$resetSelection = function() {
          var _this = this;
          if (this.inComposition || this.sendingText)
            return;
          if (!this.$isFocused && !this.afterContextMenu)
            return;
          this.inComposition = true;
          var selectionStart = 0;
          var selectionEnd = 0;
          var line2 = "";
          var positionToSelection = function(row2, column2) {
            var selection2 = column2;
            for (var i3 = 1; i3 <= row2 - _this.rowStart && i3 < 2 * _this.numberOfExtraLines + 1; i3++) {
              selection2 += _this.host.session.getLine(row2 - i3).length + 1;
            }
            return selection2;
          };
          if (this.host.session) {
            var selection = this.host.selection;
            var range3 = selection.getRange();
            var row = selection.cursor.row;
            if (row === this.rowEnd + 1) {
              this.rowStart = this.rowEnd + 1;
              this.rowEnd = this.rowStart + 2 * this.numberOfExtraLines;
            } else if (row === this.rowStart - 1) {
              this.rowEnd = this.rowStart - 1;
              this.rowStart = this.rowEnd - 2 * this.numberOfExtraLines;
            } else if (row < this.rowStart - 1 || row > this.rowEnd + 1) {
              this.rowStart = row > this.numberOfExtraLines ? row - this.numberOfExtraLines : 0;
              this.rowEnd = row > this.numberOfExtraLines ? row + this.numberOfExtraLines : 2 * this.numberOfExtraLines;
            }
            var lines = [];
            for (var i2 = this.rowStart; i2 <= this.rowEnd; i2++) {
              lines.push(this.host.session.getLine(i2));
            }
            line2 = lines.join("\n");
            selectionStart = positionToSelection(range3.start.row, range3.start.column);
            selectionEnd = positionToSelection(range3.end.row, range3.end.column);
            if (range3.start.row < this.rowStart) {
              var prevLine = this.host.session.getLine(this.rowStart - 1);
              selectionStart = range3.start.row < this.rowStart - 1 ? 0 : selectionStart;
              selectionEnd += prevLine.length + 1;
              line2 = prevLine + "\n" + line2;
            } else if (range3.end.row > this.rowEnd) {
              var nextLine = this.host.session.getLine(this.rowEnd + 1);
              selectionEnd = range3.end.row > this.rowEnd + 1 ? nextLine.length : range3.end.column;
              selectionEnd += line2.length + 1;
              line2 = line2 + "\n" + nextLine;
            } else if (isMobile2 && row > 0) {
              line2 = "\n" + line2;
              selectionEnd += 1;
              selectionStart += 1;
            }
            if (line2.length > MAX_LINE_LENGTH) {
              if (selectionStart < MAX_LINE_LENGTH && selectionEnd < MAX_LINE_LENGTH) {
                line2 = line2.slice(0, MAX_LINE_LENGTH);
              } else {
                line2 = "\n";
                if (selectionStart == selectionEnd) {
                  selectionStart = selectionEnd = 0;
                } else {
                  selectionStart = 0;
                  selectionEnd = 1;
                }
              }
            }
            var newValue = line2 + "\n\n";
            if (newValue != this.lastValue) {
              this.text.value = this.lastValue = newValue;
              this.lastSelectionStart = this.lastSelectionEnd = newValue.length;
            }
          }
          if (this.afterContextMenu) {
            this.lastSelectionStart = this.text.selectionStart;
            this.lastSelectionEnd = this.text.selectionEnd;
          }
          if (this.lastSelectionEnd != selectionEnd || this.lastSelectionStart != selectionStart || this.text.selectionEnd != this.lastSelectionEnd) {
            try {
              this.text.setSelectionRange(selectionStart, selectionEnd);
              this.lastSelectionStart = selectionStart;
              this.lastSelectionEnd = selectionEnd;
            } catch (e2) {
            }
          }
          this.inComposition = false;
        };
        TextInput2.prototype.setHost = function(newHost) {
          this.host = newHost;
        };
        TextInput2.prototype.setNumberOfExtraLines = function(number4) {
          this.rowStart = Number.MAX_SAFE_INTEGER;
          this.rowEnd = Number.MIN_SAFE_INTEGER;
          if (number4 < 0) {
            this.numberOfExtraLines = 0;
            return;
          }
          this.numberOfExtraLines = number4;
        };
        TextInput2.prototype.setAriaLabel = function() {
          var ariaLabel = "";
          if (this.host.$textInputAriaLabel) {
            ariaLabel += "".concat(this.host.$textInputAriaLabel, ", ");
          }
          if (this.host.session) {
            var row = this.host.session.selection.cursor.row;
            ariaLabel += nls("text-input.aria-label", "Cursor at row $0", [row + 1]);
          }
          this.text.setAttribute("aria-label", ariaLabel);
        };
        TextInput2.prototype.setAriaOptions = function(options) {
          if (options.activeDescendant) {
            this.text.setAttribute("aria-haspopup", "true");
            this.text.setAttribute("aria-autocomplete", options.inline ? "both" : "list");
            this.text.setAttribute("aria-activedescendant", options.activeDescendant);
          } else {
            this.text.setAttribute("aria-haspopup", "false");
            this.text.setAttribute("aria-autocomplete", "both");
            this.text.removeAttribute("aria-activedescendant");
          }
          if (options.role) {
            this.text.setAttribute("role", options.role);
          }
          if (options.setLabel) {
            this.text.setAttribute("aria-roledescription", nls("text-input.aria-roledescription", "editor"));
            this.setAriaLabel();
          }
        };
        TextInput2.prototype.focus = function() {
          var _this = this;
          this.setAriaOptions({
            setLabel: this.host.renderer.enableKeyboardAccessibility
          });
          if (this.tempStyle || HAS_FOCUS_ARGS || this.$focusScroll == "browser")
            return this.text.focus({ preventScroll: true });
          var top2 = this.text.style.top;
          this.text.style.position = "fixed";
          this.text.style.top = "0px";
          try {
            var isTransformed = this.text.getBoundingClientRect().top != 0;
          } catch (e2) {
            return;
          }
          var ancestors = [];
          if (isTransformed) {
            var t2 = this.text.parentElement;
            while (t2 && t2.nodeType == 1) {
              ancestors.push(t2);
              t2.setAttribute("ace_nocontext", "true");
              if (!t2.parentElement && t2.getRootNode)
                t2 = t2.getRootNode()["host"];
              else
                t2 = t2.parentElement;
            }
          }
          this.text.focus({ preventScroll: true });
          if (isTransformed) {
            ancestors.forEach(function(p2) {
              p2.removeAttribute("ace_nocontext");
            });
          }
          setTimeout(function() {
            _this.text.style.position = "";
            if (_this.text.style.top == "0px")
              _this.text.style.top = top2;
          }, 0);
        };
        TextInput2.prototype.blur = function() {
          this.text.blur();
        };
        TextInput2.prototype.isFocused = function() {
          return this.$isFocused;
        };
        TextInput2.prototype.setInputHandler = function(cb2) {
          this.inputHandler = cb2;
        };
        TextInput2.prototype.getInputHandler = function() {
          return this.inputHandler;
        };
        TextInput2.prototype.getElement = function() {
          return this.text;
        };
        TextInput2.prototype.setCommandMode = function(value2) {
          this.commandMode = value2;
          this.text.readOnly = false;
        };
        TextInput2.prototype.setReadOnly = function(readOnly) {
          if (!this.commandMode)
            this.text.readOnly = readOnly;
        };
        TextInput2.prototype.setCopyWithEmptySelection = function(value2) {
        };
        TextInput2.prototype.onContextMenu = function(e2) {
          this.afterContextMenu = true;
          this.resetSelection();
          this.host._emit("nativecontextmenu", {
            target: this.host,
            domEvent: e2
          });
          this.moveToMouse(e2, true);
        };
        TextInput2.prototype.moveToMouse = function(e2, bringToFront) {
          var _this = this;
          if (!this.tempStyle)
            this.tempStyle = this.text.style.cssText;
          this.text.style.cssText = (bringToFront ? "z-index:100000;" : "") + (useragent.isIE ? "opacity:0.1;" : "") + "text-indent: -" + (this.lastSelectionStart + this.lastSelectionEnd) * this.host.renderer.characterWidth * 0.5 + "px;";
          var rect = this.host.container.getBoundingClientRect();
          var style2 = dom.computedStyle(this.host.container);
          var top2 = rect.top + (parseInt(style2.borderTopWidth) || 0);
          var left2 = rect.left + (parseInt(style2.borderLeftWidth) || 0);
          var maxTop = rect.bottom - top2 - this.text.clientHeight - 2;
          var move2 = function(e3) {
            dom.translate(_this.text, e3.clientX - left2 - 2, Math.min(e3.clientY - top2 - 2, maxTop));
          };
          move2(e2);
          if (e2.type != "mousedown")
            return;
          this.host.renderer.$isMousePressed = true;
          clearTimeout(this.closeTimeout);
          if (useragent.isWin)
            event.capture(this.host.container, move2, this.onContextMenuClose.bind(this));
        };
        TextInput2.prototype.destroy = function() {
          if (this.text.parentElement)
            this.text.parentElement.removeChild(this.text);
        };
        return TextInput2;
      }()
    );
    exports3.TextInput = TextInput;
    exports3.$setUserAgentForTests = function(_isMobile, _isIOS) {
      isMobile2 = _isMobile;
      isIOS = _isIOS;
    };
  });
  ace.define("ace/mouse/default_handlers", ["require", "exports", "module", "ace/lib/useragent"], function(require2, exports3, module3) {
    var useragent = require2("../lib/useragent");
    var DRAG_OFFSET = 0;
    var SCROLL_COOLDOWN_T = 550;
    var DefaultHandlers = (
      /** @class */
      function() {
        function DefaultHandlers2(mouseHandler) {
          mouseHandler.$clickSelection = null;
          var editor2 = mouseHandler.editor;
          editor2.setDefaultHandler("mousedown", this.onMouseDown.bind(mouseHandler));
          editor2.setDefaultHandler("dblclick", this.onDoubleClick.bind(mouseHandler));
          editor2.setDefaultHandler("tripleclick", this.onTripleClick.bind(mouseHandler));
          editor2.setDefaultHandler("quadclick", this.onQuadClick.bind(mouseHandler));
          editor2.setDefaultHandler("mousewheel", this.onMouseWheel.bind(mouseHandler));
          var exports4 = [
            "select",
            "startSelect",
            "selectEnd",
            "selectAllEnd",
            "selectByWordsEnd",
            "selectByLinesEnd",
            "dragWait",
            "dragWaitEnd",
            "focusWait"
          ];
          exports4.forEach(function(x2) {
            mouseHandler[x2] = this[x2];
          }, this);
          mouseHandler["selectByLines"] = this.extendSelectionBy.bind(mouseHandler, "getLineRange");
          mouseHandler["selectByWords"] = this.extendSelectionBy.bind(mouseHandler, "getWordRange");
        }
        DefaultHandlers2.prototype.onMouseDown = function(ev) {
          var inSelection = ev.inSelection();
          var pos = ev.getDocumentPosition();
          this.mousedownEvent = ev;
          var editor2 = this.editor;
          var button2 = ev.getButton();
          if (button2 !== 0) {
            var selectionRange = editor2.getSelectionRange();
            var selectionEmpty = selectionRange.isEmpty();
            if (selectionEmpty || button2 == 1)
              editor2.selection.moveToPosition(pos);
            if (button2 == 2) {
              editor2.textInput.onContextMenu(ev.domEvent);
              if (!useragent.isMozilla)
                ev.preventDefault();
            }
            return;
          }
          this.mousedownEvent.time = Date.now();
          if (inSelection && !editor2.isFocused()) {
            editor2.focus();
            if (this.$focusTimeout && !this.$clickSelection && !editor2.inMultiSelectMode) {
              this.setState("focusWait");
              this.captureMouse(ev);
              return;
            }
          }
          this.captureMouse(ev);
          this.startSelect(pos, ev.domEvent._clicks > 1);
          return ev.preventDefault();
        };
        DefaultHandlers2.prototype.startSelect = function(pos, waitForClickSelection) {
          pos = pos || this.editor.renderer.screenToTextCoordinates(this.x, this.y);
          var editor2 = this.editor;
          if (!this.mousedownEvent)
            return;
          if (this.mousedownEvent.getShiftKey())
            editor2.selection.selectToPosition(pos);
          else if (!waitForClickSelection)
            editor2.selection.moveToPosition(pos);
          if (!waitForClickSelection)
            this.select();
          editor2.setStyle("ace_selecting");
          this.setState("select");
        };
        DefaultHandlers2.prototype.select = function() {
          var anchor, editor2 = this.editor;
          var cursor = editor2.renderer.screenToTextCoordinates(this.x, this.y);
          if (this.$clickSelection) {
            var cmp = this.$clickSelection.comparePoint(cursor);
            if (cmp == -1) {
              anchor = this.$clickSelection.end;
            } else if (cmp == 1) {
              anchor = this.$clickSelection.start;
            } else {
              var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);
              cursor = orientedRange.cursor;
              anchor = orientedRange.anchor;
            }
            editor2.selection.setSelectionAnchor(anchor.row, anchor.column);
          }
          editor2.selection.selectToPosition(cursor);
          editor2.renderer.scrollCursorIntoView();
        };
        DefaultHandlers2.prototype.extendSelectionBy = function(unitName) {
          var anchor, editor2 = this.editor;
          var cursor = editor2.renderer.screenToTextCoordinates(this.x, this.y);
          var range3 = editor2.selection[unitName](cursor.row, cursor.column);
          if (this.$clickSelection) {
            var cmpStart = this.$clickSelection.comparePoint(range3.start);
            var cmpEnd = this.$clickSelection.comparePoint(range3.end);
            if (cmpStart == -1 && cmpEnd <= 0) {
              anchor = this.$clickSelection.end;
              if (range3.end.row != cursor.row || range3.end.column != cursor.column)
                cursor = range3.start;
            } else if (cmpEnd == 1 && cmpStart >= 0) {
              anchor = this.$clickSelection.start;
              if (range3.start.row != cursor.row || range3.start.column != cursor.column)
                cursor = range3.end;
            } else if (cmpStart == -1 && cmpEnd == 1) {
              cursor = range3.end;
              anchor = range3.start;
            } else {
              var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);
              cursor = orientedRange.cursor;
              anchor = orientedRange.anchor;
            }
            editor2.selection.setSelectionAnchor(anchor.row, anchor.column);
          }
          editor2.selection.selectToPosition(cursor);
          editor2.renderer.scrollCursorIntoView();
        };
        DefaultHandlers2.prototype.selectByLinesEnd = function() {
          this.$clickSelection = null;
          this.editor.unsetStyle("ace_selecting");
        };
        DefaultHandlers2.prototype.focusWait = function() {
          var distance2 = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
          var time2 = Date.now();
          if (distance2 > DRAG_OFFSET || time2 - this.mousedownEvent.time > this.$focusTimeout)
            this.startSelect(this.mousedownEvent.getDocumentPosition());
        };
        DefaultHandlers2.prototype.onDoubleClick = function(ev) {
          var pos = ev.getDocumentPosition();
          var editor2 = this.editor;
          var session = editor2.session;
          var range3 = session.getBracketRange(pos);
          if (range3) {
            if (range3.isEmpty()) {
              range3.start.column--;
              range3.end.column++;
            }
            this.setState("select");
          } else {
            range3 = editor2.selection.getWordRange(pos.row, pos.column);
            this.setState("selectByWords");
          }
          this.$clickSelection = range3;
          this.select();
        };
        DefaultHandlers2.prototype.onTripleClick = function(ev) {
          var pos = ev.getDocumentPosition();
          var editor2 = this.editor;
          this.setState("selectByLines");
          var range3 = editor2.getSelectionRange();
          if (range3.isMultiLine() && range3.contains(pos.row, pos.column)) {
            this.$clickSelection = editor2.selection.getLineRange(range3.start.row);
            this.$clickSelection.end = editor2.selection.getLineRange(range3.end.row).end;
          } else {
            this.$clickSelection = editor2.selection.getLineRange(pos.row);
          }
          this.select();
        };
        DefaultHandlers2.prototype.onQuadClick = function(ev) {
          var editor2 = this.editor;
          editor2.selectAll();
          this.$clickSelection = editor2.getSelectionRange();
          this.setState("selectAll");
        };
        DefaultHandlers2.prototype.onMouseWheel = function(ev) {
          if (ev.getAccelKey())
            return;
          if (ev.getShiftKey() && ev.wheelY && !ev.wheelX) {
            ev.wheelX = ev.wheelY;
            ev.wheelY = 0;
          }
          var editor2 = this.editor;
          if (!this.$lastScroll)
            this.$lastScroll = { t: 0, vx: 0, vy: 0, allowed: 0 };
          var prevScroll = this.$lastScroll;
          var t2 = ev.domEvent.timeStamp;
          var dt = t2 - prevScroll.t;
          var vx = dt ? ev.wheelX / dt : prevScroll.vx;
          var vy = dt ? ev.wheelY / dt : prevScroll.vy;
          if (dt < SCROLL_COOLDOWN_T) {
            vx = (vx + prevScroll.vx) / 2;
            vy = (vy + prevScroll.vy) / 2;
          }
          var direction = Math.abs(vx / vy);
          var canScroll = false;
          if (direction >= 1 && editor2.renderer.isScrollableBy(ev.wheelX * ev.speed, 0))
            canScroll = true;
          if (direction <= 1 && editor2.renderer.isScrollableBy(0, ev.wheelY * ev.speed))
            canScroll = true;
          if (canScroll) {
            prevScroll.allowed = t2;
          } else if (t2 - prevScroll.allowed < SCROLL_COOLDOWN_T) {
            var isSlower = Math.abs(vx) <= 1.5 * Math.abs(prevScroll.vx) && Math.abs(vy) <= 1.5 * Math.abs(prevScroll.vy);
            if (isSlower) {
              canScroll = true;
              prevScroll.allowed = t2;
            } else {
              prevScroll.allowed = 0;
            }
          }
          prevScroll.t = t2;
          prevScroll.vx = vx;
          prevScroll.vy = vy;
          if (canScroll) {
            editor2.renderer.scrollBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
            return ev.stop();
          }
        };
        return DefaultHandlers2;
      }()
    );
    DefaultHandlers.prototype.selectEnd = DefaultHandlers.prototype.selectByLinesEnd;
    DefaultHandlers.prototype.selectAllEnd = DefaultHandlers.prototype.selectByLinesEnd;
    DefaultHandlers.prototype.selectByWordsEnd = DefaultHandlers.prototype.selectByLinesEnd;
    exports3.DefaultHandlers = DefaultHandlers;
    function calcDistance(ax, ay, bx, by) {
      return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
    }
    function calcRangeOrientation(range3, cursor) {
      if (range3.start.row == range3.end.row)
        var cmp = 2 * cursor.column - range3.start.column - range3.end.column;
      else if (range3.start.row == range3.end.row - 1 && !range3.start.column && !range3.end.column)
        var cmp = cursor.column - 4;
      else
        var cmp = 2 * cursor.row - range3.start.row - range3.end.row;
      if (cmp < 0)
        return { cursor: range3.start, anchor: range3.end };
      else
        return { cursor: range3.end, anchor: range3.start };
    }
  });
  ace.define("ace/lib/scroll", ["require", "exports", "module"], function(require2, exports3, module3) {
    exports3.preventParentScroll = function preventParentScroll(event) {
      event.stopPropagation();
      var target = event.currentTarget;
      var contentOverflows = target.scrollHeight > target.clientHeight;
      if (!contentOverflows) {
        event.preventDefault();
      }
    };
  });
  ace.define("ace/tooltip", ["require", "exports", "module", "ace/lib/dom", "ace/lib/event", "ace/range", "ace/lib/scroll"], function(require2, exports3, module3) {
    var __extends2 = this && this.__extends || /* @__PURE__ */ function() {
      var extendStatics = function(d2, b2) {
        extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
          d3.__proto__ = b3;
        } || function(d3, b3) {
          for (var p2 in b3)
            if (Object.prototype.hasOwnProperty.call(b3, p2))
              d3[p2] = b3[p2];
        };
        return extendStatics(d2, b2);
      };
      return function(d2, b2) {
        if (typeof b2 !== "function" && b2 !== null)
          throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
        extendStatics(d2, b2);
        function __() {
          this.constructor = d2;
        }
        d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
      };
    }();
    var __values = this && this.__values || function(o2) {
      var s2 = typeof Symbol === "function" && Symbol.iterator, m2 = s2 && o2[s2], i2 = 0;
      if (m2)
        return m2.call(o2);
      if (o2 && typeof o2.length === "number")
        return {
          next: function() {
            if (o2 && i2 >= o2.length)
              o2 = void 0;
            return { value: o2 && o2[i2++], done: !o2 };
          }
        };
      throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined.");
    };
    var dom = require2("./lib/dom");
    require2("./lib/event");
    var Range2 = require2("./range").Range;
    var preventParentScroll = require2("./lib/scroll").preventParentScroll;
    var CLASSNAME = "ace_tooltip";
    var Tooltip3 = (
      /** @class */
      function() {
        function Tooltip4(parentNode) {
          this.isOpen = false;
          this.$element = null;
          this.$parentNode = parentNode;
        }
        Tooltip4.prototype.$init = function() {
          this.$element = dom.createElement("div");
          this.$element.className = CLASSNAME;
          this.$element.style.display = "none";
          this.$parentNode.appendChild(this.$element);
          return this.$element;
        };
        Tooltip4.prototype.getElement = function() {
          return this.$element || this.$init();
        };
        Tooltip4.prototype.setText = function(text2) {
          this.getElement().textContent = text2;
        };
        Tooltip4.prototype.setHtml = function(html2) {
          this.getElement().innerHTML = html2;
        };
        Tooltip4.prototype.setPosition = function(x2, y2) {
          this.getElement().style.left = x2 + "px";
          this.getElement().style.top = y2 + "px";
        };
        Tooltip4.prototype.setClassName = function(className) {
          dom.addCssClass(this.getElement(), className);
        };
        Tooltip4.prototype.setTheme = function(theme2) {
          this.$element.className = CLASSNAME + " " + (theme2.isDark ? "ace_dark " : "") + (theme2.cssClass || "");
        };
        Tooltip4.prototype.show = function(text2, x2, y2) {
          if (text2 != null)
            this.setText(text2);
          if (x2 != null && y2 != null)
            this.setPosition(x2, y2);
          if (!this.isOpen) {
            this.getElement().style.display = "block";
            this.isOpen = true;
          }
        };
        Tooltip4.prototype.hide = function(e2) {
          if (this.isOpen) {
            this.getElement().style.display = "none";
            this.getElement().className = CLASSNAME;
            this.isOpen = false;
          }
        };
        Tooltip4.prototype.getHeight = function() {
          return this.getElement().offsetHeight;
        };
        Tooltip4.prototype.getWidth = function() {
          return this.getElement().offsetWidth;
        };
        Tooltip4.prototype.destroy = function() {
          this.isOpen = false;
          if (this.$element && this.$element.parentNode) {
            this.$element.parentNode.removeChild(this.$element);
          }
        };
        return Tooltip4;
      }()
    );
    var PopupManager = (
      /** @class */
      function() {
        function PopupManager2() {
          this.popups = [];
        }
        PopupManager2.prototype.addPopup = function(popup) {
          this.popups.push(popup);
          this.updatePopups();
        };
        PopupManager2.prototype.removePopup = function(popup) {
          var index2 = this.popups.indexOf(popup);
          if (index2 !== -1) {
            this.popups.splice(index2, 1);
            this.updatePopups();
          }
        };
        PopupManager2.prototype.updatePopups = function() {
          var e_1, _a2, e_2, _b2;
          this.popups.sort(function(a2, b2) {
            return b2.priority - a2.priority;
          });
          var visiblepopups = [];
          try {
            for (var _c2 = __values(this.popups), _d = _c2.next(); !_d.done; _d = _c2.next()) {
              var popup = _d.value;
              var shouldDisplay = true;
              try {
                for (var visiblepopups_1 = (e_2 = void 0, __values(visiblepopups)), visiblepopups_1_1 = visiblepopups_1.next(); !visiblepopups_1_1.done; visiblepopups_1_1 = visiblepopups_1.next()) {
                  var visiblePopup = visiblepopups_1_1.value;
                  if (this.doPopupsOverlap(visiblePopup, popup)) {
                    shouldDisplay = false;
                    break;
                  }
                }
              } catch (e_2_1) {
                e_2 = { error: e_2_1 };
              } finally {
                try {
                  if (visiblepopups_1_1 && !visiblepopups_1_1.done && (_b2 = visiblepopups_1.return))
                    _b2.call(visiblepopups_1);
                } finally {
                  if (e_2)
                    throw e_2.error;
                }
              }
              if (shouldDisplay) {
                visiblepopups.push(popup);
              } else {
                popup.hide();
              }
            }
          } catch (e_1_1) {
            e_1 = { error: e_1_1 };
          } finally {
            try {
              if (_d && !_d.done && (_a2 = _c2.return))
                _a2.call(_c2);
            } finally {
              if (e_1)
                throw e_1.error;
            }
          }
        };
        PopupManager2.prototype.doPopupsOverlap = function(popupA, popupB) {
          var rectA = popupA.getElement().getBoundingClientRect();
          var rectB = popupB.getElement().getBoundingClientRect();
          return rectA.left < rectB.right && rectA.right > rectB.left && rectA.top < rectB.bottom && rectA.bottom > rectB.top;
        };
        return PopupManager2;
      }()
    );
    var popupManager = new PopupManager();
    exports3.popupManager = popupManager;
    exports3.Tooltip = Tooltip3;
    var HoverTooltip = (
      /** @class */
      function(_super) {
        __extends2(HoverTooltip2, _super);
        function HoverTooltip2(parentNode) {
          if (parentNode === void 0) {
            parentNode = document.body;
          }
          var _this = _super.call(this, parentNode) || this;
          _this.timeout = void 0;
          _this.lastT = 0;
          _this.idleTime = 350;
          _this.lastEvent = void 0;
          _this.onMouseOut = _this.onMouseOut.bind(_this);
          _this.onMouseMove = _this.onMouseMove.bind(_this);
          _this.waitForHover = _this.waitForHover.bind(_this);
          _this.hide = _this.hide.bind(_this);
          var el2 = _this.getElement();
          el2.style.whiteSpace = "pre-wrap";
          el2.style.pointerEvents = "auto";
          el2.addEventListener("mouseout", _this.onMouseOut);
          el2.tabIndex = -1;
          el2.addEventListener("blur", (function() {
            if (!el2.contains(document.activeElement))
              this.hide();
          }).bind(_this));
          el2.addEventListener("wheel", preventParentScroll);
          return _this;
        }
        HoverTooltip2.prototype.addToEditor = function(editor2) {
          editor2.on("mousemove", this.onMouseMove);
          editor2.on("mousedown", this.hide);
          editor2.renderer.getMouseEventTarget().addEventListener("mouseout", this.onMouseOut, true);
        };
        HoverTooltip2.prototype.removeFromEditor = function(editor2) {
          editor2.off("mousemove", this.onMouseMove);
          editor2.off("mousedown", this.hide);
          editor2.renderer.getMouseEventTarget().removeEventListener("mouseout", this.onMouseOut, true);
          if (this.timeout) {
            clearTimeout(this.timeout);
            this.timeout = null;
          }
        };
        HoverTooltip2.prototype.onMouseMove = function(e2, editor2) {
          this.lastEvent = e2;
          this.lastT = Date.now();
          var isMousePressed = editor2.$mouseHandler.isMousePressed;
          if (this.isOpen) {
            var pos = this.lastEvent && this.lastEvent.getDocumentPosition();
            if (!this.range || !this.range.contains(pos.row, pos.column) || isMousePressed || this.isOutsideOfText(this.lastEvent)) {
              this.hide();
            }
          }
          if (this.timeout || isMousePressed)
            return;
          this.lastEvent = e2;
          this.timeout = setTimeout(this.waitForHover, this.idleTime);
        };
        HoverTooltip2.prototype.waitForHover = function() {
          if (this.timeout)
            clearTimeout(this.timeout);
          var dt = Date.now() - this.lastT;
          if (this.idleTime - dt > 10) {
            this.timeout = setTimeout(this.waitForHover, this.idleTime - dt);
            return;
          }
          this.timeout = null;
          if (this.lastEvent && !this.isOutsideOfText(this.lastEvent)) {
            this.$gatherData(this.lastEvent, this.lastEvent.editor);
          }
        };
        HoverTooltip2.prototype.isOutsideOfText = function(e2) {
          var editor2 = e2.editor;
          var docPos = e2.getDocumentPosition();
          var line2 = editor2.session.getLine(docPos.row);
          if (docPos.column == line2.length) {
            var screenPos = editor2.renderer.pixelToScreenCoordinates(e2.clientX, e2.clientY);
            var clippedPos = editor2.session.documentToScreenPosition(docPos.row, docPos.column);
            if (clippedPos.column != screenPos.column || clippedPos.row != screenPos.row) {
              return true;
            }
          }
          return false;
        };
        HoverTooltip2.prototype.setDataProvider = function(value2) {
          this.$gatherData = value2;
        };
        HoverTooltip2.prototype.showForRange = function(editor2, range3, domNode, startingEvent) {
          var MARGIN = 10;
          if (startingEvent && startingEvent != this.lastEvent)
            return;
          if (this.isOpen && document.activeElement == this.getElement())
            return;
          var renderer = editor2.renderer;
          if (!this.isOpen) {
            popupManager.addPopup(this);
            this.$registerCloseEvents();
            this.setTheme(renderer.theme);
          }
          this.isOpen = true;
          this.addMarker(range3, editor2.session);
          this.range = Range2.fromPoints(range3.start, range3.end);
          var position2 = renderer.textToScreenCoordinates(range3.start.row, range3.start.column);
          var rect = renderer.scroller.getBoundingClientRect();
          if (position2.pageX < rect.left)
            position2.pageX = rect.left;
          var element2 = this.getElement();
          element2.innerHTML = "";
          element2.appendChild(domNode);
          element2.style.maxHeight = "";
          element2.style.display = "block";
          var labelHeight = element2.clientHeight;
          var labelWidth = element2.clientWidth;
          var spaceBelow = window.innerHeight - position2.pageY - renderer.lineHeight;
          var isAbove = true;
          if (position2.pageY - labelHeight < 0 && position2.pageY < spaceBelow) {
            isAbove = false;
          }
          element2.style.maxHeight = (isAbove ? position2.pageY : spaceBelow) - MARGIN + "px";
          element2.style.top = isAbove ? "" : position2.pageY + renderer.lineHeight + "px";
          element2.style.bottom = isAbove ? window.innerHeight - position2.pageY + "px" : "";
          element2.style.left = Math.min(position2.pageX, window.innerWidth - labelWidth - MARGIN) + "px";
        };
        HoverTooltip2.prototype.addMarker = function(range3, session) {
          if (this.marker) {
            this.$markerSession.removeMarker(this.marker);
          }
          this.$markerSession = session;
          this.marker = session && session.addMarker(range3, "ace_highlight-marker", "text");
        };
        HoverTooltip2.prototype.hide = function(e2) {
          if (!e2 && document.activeElement == this.getElement())
            return;
          if (e2 && e2.target && (e2.type != "keydown" || e2.ctrlKey || e2.metaKey) && this.$element.contains(e2.target))
            return;
          this.lastEvent = null;
          if (this.timeout)
            clearTimeout(this.timeout);
          this.timeout = null;
          this.addMarker(null);
          if (this.isOpen) {
            this.$removeCloseEvents();
            this.getElement().style.display = "none";
            this.isOpen = false;
            popupManager.removePopup(this);
          }
        };
        HoverTooltip2.prototype.$registerCloseEvents = function() {
          window.addEventListener("keydown", this.hide, true);
          window.addEventListener("wheel", this.hide, true);
          window.addEventListener("mousedown", this.hide, true);
        };
        HoverTooltip2.prototype.$removeCloseEvents = function() {
          window.removeEventListener("keydown", this.hide, true);
          window.removeEventListener("wheel", this.hide, true);
          window.removeEventListener("mousedown", this.hide, true);
        };
        HoverTooltip2.prototype.onMouseOut = function(e2) {
          if (this.timeout) {
            clearTimeout(this.timeout);
            this.timeout = null;
          }
          this.lastEvent = null;
          if (!this.isOpen)
            return;
          if (!e2.relatedTarget || this.getElement().contains(e2.relatedTarget))
            return;
          if (e2 && e2.currentTarget.contains(e2.relatedTarget))
            return;
          if (!e2.relatedTarget.classList.contains("ace_content"))
            this.hide();
        };
        return HoverTooltip2;
      }(Tooltip3)
    );
    exports3.HoverTooltip = HoverTooltip;
  });
  ace.define("ace/mouse/default_gutter_handler", ["require", "exports", "module", "ace/lib/dom", "ace/lib/event", "ace/tooltip", "ace/config"], function(require2, exports3, module3) {
    var __extends2 = this && this.__extends || /* @__PURE__ */ function() {
      var extendStatics = function(d2, b2) {
        extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
          d3.__proto__ = b3;
        } || function(d3, b3) {
          for (var p2 in b3)
            if (Object.prototype.hasOwnProperty.call(b3, p2))
              d3[p2] = b3[p2];
        };
        return extendStatics(d2, b2);
      };
      return function(d2, b2) {
        if (typeof b2 !== "function" && b2 !== null)
          throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
        extendStatics(d2, b2);
        function __() {
          this.constructor = d2;
        }
        d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
      };
    }();
    var __values = this && this.__values || function(o2) {
      var s2 = typeof Symbol === "function" && Symbol.iterator, m2 = s2 && o2[s2], i2 = 0;
      if (m2)
        return m2.call(o2);
      if (o2 && typeof o2.length === "number")
        return {
          next: function() {
            if (o2 && i2 >= o2.length)
              o2 = void 0;
            return { value: o2 && o2[i2++], done: !o2 };
          }
        };
      throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined.");
    };
    var dom = require2("../lib/dom");
    var event = require2("../lib/event");
    var Tooltip3 = require2("../tooltip").Tooltip;
    var nls = require2("../config").nls;
    var GUTTER_TOOLTIP_LEFT_OFFSET = 5;
    var GUTTER_TOOLTIP_TOP_OFFSET = 3;
    exports3.GUTTER_TOOLTIP_LEFT_OFFSET = GUTTER_TOOLTIP_LEFT_OFFSET;
    exports3.GUTTER_TOOLTIP_TOP_OFFSET = GUTTER_TOOLTIP_TOP_OFFSET;
    function GutterHandler(mouseHandler) {
      var editor2 = mouseHandler.editor;
      var gutter = editor2.renderer.$gutterLayer;
      var tooltip = new GutterTooltip(editor2, true);
      mouseHandler.editor.setDefaultHandler("guttermousedown", function(e2) {
        if (!editor2.isFocused() || e2.getButton() != 0)
          return;
        var gutterRegion = gutter.getRegion(e2);
        if (gutterRegion == "foldWidgets")
          return;
        var row = e2.getDocumentPosition().row;
        var selection = editor2.session.selection;
        if (e2.getShiftKey())
          selection.selectTo(row, 0);
        else {
          if (e2.domEvent.detail == 2) {
            editor2.selectAll();
            return e2.preventDefault();
          }
          mouseHandler.$clickSelection = editor2.selection.getLineRange(row);
        }
        mouseHandler.setState("selectByLines");
        mouseHandler.captureMouse(e2);
        return e2.preventDefault();
      });
      var tooltipTimeout, mouseEvent;
      function showTooltip() {
        var row = mouseEvent.getDocumentPosition().row;
        var maxRow = editor2.session.getLength();
        if (row == maxRow) {
          var screenRow = editor2.renderer.pixelToScreenCoordinates(0, mouseEvent.y).row;
          var pos = mouseEvent.$pos;
          if (screenRow > editor2.session.documentToScreenRow(pos.row, pos.column))
            return hideTooltip();
        }
        tooltip.showTooltip(row);
        if (!tooltip.isOpen)
          return;
        editor2.on("mousewheel", hideTooltip);
        editor2.on("changeSession", hideTooltip);
        window.addEventListener("keydown", hideTooltip, true);
        if (mouseHandler.$tooltipFollowsMouse) {
          moveTooltip(mouseEvent);
        } else {
          var gutterRow = mouseEvent.getGutterRow();
          var gutterCell = gutter.$lines.get(gutterRow);
          if (gutterCell) {
            var gutterElement = gutterCell.element.querySelector(".ace_gutter_annotation");
            var rect = gutterElement.getBoundingClientRect();
            var style2 = tooltip.getElement().style;
            style2.left = rect.right - GUTTER_TOOLTIP_LEFT_OFFSET + "px";
            style2.top = rect.bottom - GUTTER_TOOLTIP_TOP_OFFSET + "px";
          } else {
            moveTooltip(mouseEvent);
          }
        }
      }
      function hideTooltip(e2) {
        if (e2 && e2.type === "keydown" && (e2.ctrlKey || e2.metaKey))
          return;
        if (e2 && e2.type === "mouseout" && (!e2.relatedTarget || tooltip.getElement().contains(e2.relatedTarget)))
          return;
        if (tooltipTimeout)
          tooltipTimeout = clearTimeout(tooltipTimeout);
        if (tooltip.isOpen) {
          tooltip.hideTooltip();
          editor2.off("mousewheel", hideTooltip);
          editor2.off("changeSession", hideTooltip);
          window.removeEventListener("keydown", hideTooltip, true);
        }
      }
      function moveTooltip(e2) {
        tooltip.setPosition(e2.x, e2.y);
      }
      mouseHandler.editor.setDefaultHandler("guttermousemove", function(e2) {
        var target = e2.domEvent.target || e2.domEvent.srcElement;
        if (dom.hasCssClass(target, "ace_fold-widget") || dom.hasCssClass(target, "ace_custom-widget"))
          return hideTooltip();
        if (tooltip.isOpen && mouseHandler.$tooltipFollowsMouse)
          moveTooltip(e2);
        mouseEvent = e2;
        if (tooltipTimeout)
          return;
        tooltipTimeout = setTimeout(function() {
          tooltipTimeout = null;
          if (mouseEvent && !mouseHandler.isMousePressed)
            showTooltip();
        }, 50);
      });
      event.addListener(editor2.renderer.$gutter, "mouseout", function(e2) {
        mouseEvent = null;
        if (!tooltip.isOpen)
          return;
        tooltipTimeout = setTimeout(function() {
          tooltipTimeout = null;
          hideTooltip(e2);
        }, 50);
      }, editor2);
    }
    exports3.GutterHandler = GutterHandler;
    var GutterTooltip = (
      /** @class */
      function(_super) {
        __extends2(GutterTooltip2, _super);
        function GutterTooltip2(editor2, isHover) {
          if (isHover === void 0) {
            isHover = false;
          }
          var _this = _super.call(this, editor2.container) || this;
          _this.id = "gt" + ++GutterTooltip2.$uid;
          _this.editor = editor2;
          _this.visibleTooltipRow;
          var el2 = _this.getElement();
          el2.setAttribute("role", "tooltip");
          el2.setAttribute("id", _this.id);
          el2.style.pointerEvents = "auto";
          if (isHover) {
            _this.onMouseOut = _this.onMouseOut.bind(_this);
            el2.addEventListener("mouseout", _this.onMouseOut);
          }
          return _this;
        }
        GutterTooltip2.prototype.onMouseOut = function(e2) {
          if (!this.isOpen)
            return;
          if (!e2.relatedTarget || this.getElement().contains(e2.relatedTarget))
            return;
          if (e2 && e2.currentTarget.contains(e2.relatedTarget))
            return;
          this.hideTooltip();
        };
        GutterTooltip2.prototype.setPosition = function(x2, y2) {
          var windowWidth = window.innerWidth || document.documentElement.clientWidth;
          var windowHeight = window.innerHeight || document.documentElement.clientHeight;
          var width = this.getWidth();
          var height = this.getHeight();
          x2 += 15;
          y2 += 15;
          if (x2 + width > windowWidth) {
            x2 -= x2 + width - windowWidth;
          }
          if (y2 + height > windowHeight) {
            y2 -= 20 + height;
          }
          Tooltip3.prototype.setPosition.call(this, x2, y2);
        };
        Object.defineProperty(GutterTooltip2, "annotationLabels", {
          get: function() {
            return {
              error: {
                singular: nls("gutter-tooltip.aria-label.error.singular", "error"),
                plural: nls("gutter-tooltip.aria-label.error.plural", "errors")
              },
              security: {
                singular: nls("gutter-tooltip.aria-label.security.singular", "security finding"),
                plural: nls("gutter-tooltip.aria-label.security.plural", "security findings")
              },
              warning: {
                singular: nls("gutter-tooltip.aria-label.warning.singular", "warning"),
                plural: nls("gutter-tooltip.aria-label.warning.plural", "warnings")
              },
              info: {
                singular: nls("gutter-tooltip.aria-label.info.singular", "information message"),
                plural: nls("gutter-tooltip.aria-label.info.plural", "information messages")
              },
              hint: {
                singular: nls("gutter-tooltip.aria-label.hint.singular", "suggestion"),
                plural: nls("gutter-tooltip.aria-label.hint.plural", "suggestions")
              }
            };
          },
          enumerable: false,
          configurable: true
        });
        GutterTooltip2.prototype.showTooltip = function(row) {
          var _a2;
          var gutter = this.editor.renderer.$gutterLayer;
          var annotationsInRow = gutter.$annotations[row];
          var annotation;
          if (annotationsInRow)
            annotation = {
              displayText: Array.from(annotationsInRow.displayText),
              type: Array.from(annotationsInRow.type)
            };
          else
            annotation = { displayText: [], type: [] };
          var fold = gutter.session.getFoldLine(row);
          if (fold && gutter.$showFoldedAnnotations) {
            var annotationsInFold = { error: [], security: [], warning: [], info: [], hint: [] };
            var severityRank = { error: 1, security: 2, warning: 3, info: 4, hint: 5 };
            var mostSevereAnnotationTypeInFold;
            for (var i2 = row + 1; i2 <= fold.end.row; i2++) {
              if (!gutter.$annotations[i2])
                continue;
              for (var j2 = 0; j2 < gutter.$annotations[i2].text.length; j2++) {
                var annotationType = gutter.$annotations[i2].type[j2];
                annotationsInFold[annotationType].push(gutter.$annotations[i2].text[j2]);
                if (!mostSevereAnnotationTypeInFold || severityRank[annotationType] < severityRank[mostSevereAnnotationTypeInFold]) {
                  mostSevereAnnotationTypeInFold = annotationType;
                }
              }
            }
            if (["error", "security", "warning"].includes(mostSevereAnnotationTypeInFold)) {
              var summaryFoldedAnnotations = "".concat(GutterTooltip2.annotationsToSummaryString(annotationsInFold), " in folded code.");
              annotation.displayText.push(summaryFoldedAnnotations);
              annotation.type.push(mostSevereAnnotationTypeInFold + "_fold");
            }
          }
          if (annotation.displayText.length === 0)
            return this.hideTooltip();
          var annotationMessages = { error: [], security: [], warning: [], info: [], hint: [] };
          var iconClassName = gutter.$useSvgGutterIcons ? "ace_icon_svg" : "ace_icon";
          for (var i2 = 0; i2 < annotation.displayText.length; i2++) {
            var lineElement = dom.createElement("span");
            var iconElement = dom.createElement("span");
            (_a2 = iconElement.classList).add.apply(_a2, ["ace_".concat(annotation.type[i2]), iconClassName]);
            iconElement.setAttribute("aria-label", "".concat(GutterTooltip2.annotationLabels[annotation.type[i2].replace("_fold", "")].singular));
            iconElement.setAttribute("role", "img");
            iconElement.appendChild(dom.createTextNode(" "));
            lineElement.appendChild(iconElement);
            lineElement.appendChild(dom.createTextNode(annotation.displayText[i2]));
            lineElement.appendChild(dom.createElement("br"));
            annotationMessages[annotation.type[i2].replace("_fold", "")].push(lineElement);
          }
          var tooltipElement = this.getElement();
          dom.removeChildren(tooltipElement);
          annotationMessages.error.forEach(function(el2) {
            return tooltipElement.appendChild(el2);
          });
          annotationMessages.security.forEach(function(el2) {
            return tooltipElement.appendChild(el2);
          });
          annotationMessages.warning.forEach(function(el2) {
            return tooltipElement.appendChild(el2);
          });
          annotationMessages.info.forEach(function(el2) {
            return tooltipElement.appendChild(el2);
          });
          annotationMessages.hint.forEach(function(el2) {
            return tooltipElement.appendChild(el2);
          });
          tooltipElement.setAttribute("aria-live", "polite");
          if (!this.isOpen) {
            this.setTheme(this.editor.renderer.theme);
            this.setClassName("ace_gutter-tooltip");
          }
          var annotationNode = this.$findLinkedAnnotationNode(row);
          if (annotationNode) {
            annotationNode.setAttribute("aria-describedby", this.id);
          }
          this.show();
          this.visibleTooltipRow = row;
          this.editor._signal("showGutterTooltip", this);
        };
        GutterTooltip2.prototype.$findLinkedAnnotationNode = function(row) {
          var cell = this.$findCellByRow(row);
          if (cell) {
            var element2 = cell.element;
            if (element2.childNodes.length > 2) {
              return element2.childNodes[2];
            }
          }
        };
        GutterTooltip2.prototype.$findCellByRow = function(row) {
          return this.editor.renderer.$gutterLayer.$lines.cells.find(function(el2) {
            return el2.row === row;
          });
        };
        GutterTooltip2.prototype.hideTooltip = function() {
          if (!this.isOpen) {
            return;
          }
          this.$element.removeAttribute("aria-live");
          this.hide();
          if (this.visibleTooltipRow != void 0) {
            var annotationNode = this.$findLinkedAnnotationNode(this.visibleTooltipRow);
            if (annotationNode) {
              annotationNode.removeAttribute("aria-describedby");
            }
          }
          this.visibleTooltipRow = void 0;
          this.editor._signal("hideGutterTooltip", this);
        };
        GutterTooltip2.annotationsToSummaryString = function(annotations) {
          var e_1, _a2;
          var summary = [];
          var annotationTypes = ["error", "security", "warning", "info", "hint"];
          try {
            for (var annotationTypes_1 = __values(annotationTypes), annotationTypes_1_1 = annotationTypes_1.next(); !annotationTypes_1_1.done; annotationTypes_1_1 = annotationTypes_1.next()) {
              var annotationType = annotationTypes_1_1.value;
              if (!annotations[annotationType].length)
                continue;
              var label = annotations[annotationType].length === 1 ? GutterTooltip2.annotationLabels[annotationType].singular : GutterTooltip2.annotationLabels[annotationType].plural;
              summary.push("".concat(annotations[annotationType].length, " ").concat(label));
            }
          } catch (e_1_1) {
            e_1 = { error: e_1_1 };
          } finally {
            try {
              if (annotationTypes_1_1 && !annotationTypes_1_1.done && (_a2 = annotationTypes_1.return))
                _a2.call(annotationTypes_1);
            } finally {
              if (e_1)
                throw e_1.error;
            }
          }
          return summary.join(", ");
        };
        return GutterTooltip2;
      }(Tooltip3)
    );
    GutterTooltip.$uid = 0;
    exports3.GutterTooltip = GutterTooltip;
  });
  ace.define("ace/mouse/mouse_event", ["require", "exports", "module", "ace/lib/event", "ace/lib/useragent"], function(require2, exports3, module3) {
    var event = require2("../lib/event");
    var useragent = require2("../lib/useragent");
    var MouseEvent2 = (
      /** @class */
      function() {
        function MouseEvent3(domEvent, editor2) {
          this.speed;
          this.wheelX;
          this.wheelY;
          this.domEvent = domEvent;
          this.editor = editor2;
          this.x = this.clientX = domEvent.clientX;
          this.y = this.clientY = domEvent.clientY;
          this.$pos = null;
          this.$inSelection = null;
          this.propagationStopped = false;
          this.defaultPrevented = false;
        }
        MouseEvent3.prototype.stopPropagation = function() {
          event.stopPropagation(this.domEvent);
          this.propagationStopped = true;
        };
        MouseEvent3.prototype.preventDefault = function() {
          event.preventDefault(this.domEvent);
          this.defaultPrevented = true;
        };
        MouseEvent3.prototype.stop = function() {
          this.stopPropagation();
          this.preventDefault();
        };
        MouseEvent3.prototype.getDocumentPosition = function() {
          if (this.$pos)
            return this.$pos;
          this.$pos = this.editor.renderer.screenToTextCoordinates(this.clientX, this.clientY);
          return this.$pos;
        };
        MouseEvent3.prototype.getGutterRow = function() {
          var documentRow = this.getDocumentPosition().row;
          var screenRow = this.editor.session.documentToScreenRow(documentRow, 0);
          var screenTopRow = this.editor.session.documentToScreenRow(this.editor.renderer.$gutterLayer.$lines.get(0).row, 0);
          return screenRow - screenTopRow;
        };
        MouseEvent3.prototype.inSelection = function() {
          if (this.$inSelection !== null)
            return this.$inSelection;
          var editor2 = this.editor;
          var selectionRange = editor2.getSelectionRange();
          if (selectionRange.isEmpty())
            this.$inSelection = false;
          else {
            var pos = this.getDocumentPosition();
            this.$inSelection = selectionRange.contains(pos.row, pos.column);
          }
          return this.$inSelection;
        };
        MouseEvent3.prototype.getButton = function() {
          return event.getButton(this.domEvent);
        };
        MouseEvent3.prototype.getShiftKey = function() {
          return this.domEvent.shiftKey;
        };
        MouseEvent3.prototype.getAccelKey = function() {
          return useragent.isMac ? this.domEvent.metaKey : this.domEvent.ctrlKey;
        };
        return MouseEvent3;
      }()
    );
    exports3.MouseEvent = MouseEvent2;
  });
  ace.define("ace/mouse/dragdrop_handler", ["require", "exports", "module", "ace/lib/dom", "ace/lib/event", "ace/lib/useragent"], function(require2, exports3, module3) {
    var dom = require2("../lib/dom");
    var event = require2("../lib/event");
    var useragent = require2("../lib/useragent");
    var AUTOSCROLL_DELAY = 200;
    var SCROLL_CURSOR_DELAY = 200;
    var SCROLL_CURSOR_HYSTERESIS = 5;
    function DragdropHandler(mouseHandler) {
      var editor2 = mouseHandler.editor;
      var dragImage = dom.createElement("div");
      dragImage.style.cssText = "top:-100px;position:absolute;z-index:2147483647;opacity:0.5";
      dragImage.textContent = " ";
      var exports4 = ["dragWait", "dragWaitEnd", "startDrag", "dragReadyEnd", "onMouseDrag"];
      exports4.forEach(function(x3) {
        mouseHandler[x3] = this[x3];
      }, this);
      editor2.on("mousedown", this.onMouseDown.bind(mouseHandler));
      var mouseTarget = editor2.container;
      var dragSelectionMarker, x2, y2;
      var timerId, range3;
      var dragCursor, counter = 0;
      var dragOperation;
      var isInternal;
      var autoScrollStartTime;
      var cursorMovedTime;
      var cursorPointOnCaretMoved;
      this.onDragStart = function(e2) {
        if (this.cancelDrag || !mouseTarget.draggable) {
          var self2 = this;
          setTimeout(function() {
            self2.startSelect();
            self2.captureMouse(e2);
          }, 0);
          return e2.preventDefault();
        }
        range3 = editor2.getSelectionRange();
        var dataTransfer = e2.dataTransfer;
        dataTransfer.effectAllowed = editor2.getReadOnly() ? "copy" : "copyMove";
        editor2.container.appendChild(dragImage);
        dataTransfer.setDragImage && dataTransfer.setDragImage(dragImage, 0, 0);
        setTimeout(function() {
          editor2.container.removeChild(dragImage);
        });
        dataTransfer.clearData();
        dataTransfer.setData("Text", editor2.session.getTextRange());
        isInternal = true;
        this.setState("drag");
      };
      this.onDragEnd = function(e2) {
        mouseTarget.draggable = false;
        isInternal = false;
        this.setState(null);
        if (!editor2.getReadOnly()) {
          var dropEffect = e2.dataTransfer.dropEffect;
          if (!dragOperation && dropEffect == "move")
            editor2.session.remove(editor2.getSelectionRange());
          editor2.$resetCursorStyle();
        }
        this.editor.unsetStyle("ace_dragging");
        this.editor.renderer.setCursorStyle("");
      };
      this.onDragEnter = function(e2) {
        if (editor2.getReadOnly() || !canAccept(e2.dataTransfer))
          return;
        x2 = e2.clientX;
        y2 = e2.clientY;
        if (!dragSelectionMarker)
          addDragMarker();
        counter++;
        e2.dataTransfer.dropEffect = dragOperation = getDropEffect(e2);
        return event.preventDefault(e2);
      };
      this.onDragOver = function(e2) {
        if (editor2.getReadOnly() || !canAccept(e2.dataTransfer))
          return;
        x2 = e2.clientX;
        y2 = e2.clientY;
        if (!dragSelectionMarker) {
          addDragMarker();
          counter++;
        }
        if (onMouseMoveTimer !== null)
          onMouseMoveTimer = null;
        e2.dataTransfer.dropEffect = dragOperation = getDropEffect(e2);
        return event.preventDefault(e2);
      };
      this.onDragLeave = function(e2) {
        counter--;
        if (counter <= 0 && dragSelectionMarker) {
          clearDragMarker();
          dragOperation = null;
          return event.preventDefault(e2);
        }
      };
      this.onDrop = function(e2) {
        if (!dragCursor)
          return;
        var dataTransfer = e2.dataTransfer;
        if (isInternal) {
          switch (dragOperation) {
            case "move":
              if (range3.contains(dragCursor.row, dragCursor.column)) {
                range3 = {
                  start: dragCursor,
                  end: dragCursor
                };
              } else {
                range3 = editor2.moveText(range3, dragCursor);
              }
              break;
            case "copy":
              range3 = editor2.moveText(range3, dragCursor, true);
              break;
          }
        } else {
          var dropData = dataTransfer.getData("Text");
          range3 = {
            start: dragCursor,
            end: editor2.session.insert(dragCursor, dropData)
          };
          editor2.focus();
          dragOperation = null;
        }
        clearDragMarker();
        return event.preventDefault(e2);
      };
      event.addListener(mouseTarget, "dragstart", this.onDragStart.bind(mouseHandler), editor2);
      event.addListener(mouseTarget, "dragend", this.onDragEnd.bind(mouseHandler), editor2);
      event.addListener(mouseTarget, "dragenter", this.onDragEnter.bind(mouseHandler), editor2);
      event.addListener(mouseTarget, "dragover", this.onDragOver.bind(mouseHandler), editor2);
      event.addListener(mouseTarget, "dragleave", this.onDragLeave.bind(mouseHandler), editor2);
      event.addListener(mouseTarget, "drop", this.onDrop.bind(mouseHandler), editor2);
      function scrollCursorIntoView(cursor, prevCursor) {
        var now2 = Date.now();
        var vMovement = !prevCursor || cursor.row != prevCursor.row;
        var hMovement = !prevCursor || cursor.column != prevCursor.column;
        if (!cursorMovedTime || vMovement || hMovement) {
          editor2.moveCursorToPosition(cursor);
          cursorMovedTime = now2;
          cursorPointOnCaretMoved = { x: x2, y: y2 };
        } else {
          var distance2 = calcDistance(cursorPointOnCaretMoved.x, cursorPointOnCaretMoved.y, x2, y2);
          if (distance2 > SCROLL_CURSOR_HYSTERESIS) {
            cursorMovedTime = null;
          } else if (now2 - cursorMovedTime >= SCROLL_CURSOR_DELAY) {
            editor2.renderer.scrollCursorIntoView();
            cursorMovedTime = null;
          }
        }
      }
      function autoScroll(cursor, prevCursor) {
        var now2 = Date.now();
        var lineHeight2 = editor2.renderer.layerConfig.lineHeight;
        var characterWidth = editor2.renderer.layerConfig.characterWidth;
        var editorRect = editor2.renderer.scroller.getBoundingClientRect();
        var offsets = {
          x: {
            left: x2 - editorRect.left,
            right: editorRect.right - x2
          },
          y: {
            top: y2 - editorRect.top,
            bottom: editorRect.bottom - y2
          }
        };
        var nearestXOffset = Math.min(offsets.x.left, offsets.x.right);
        var nearestYOffset = Math.min(offsets.y.top, offsets.y.bottom);
        var scrollCursor = { row: cursor.row, column: cursor.column };
        if (nearestXOffset / characterWidth <= 2) {
          scrollCursor.column += offsets.x.left < offsets.x.right ? -3 : 2;
        }
        if (nearestYOffset / lineHeight2 <= 1) {
          scrollCursor.row += offsets.y.top < offsets.y.bottom ? -1 : 1;
        }
        var vScroll = cursor.row != scrollCursor.row;
        var hScroll = cursor.column != scrollCursor.column;
        var vMovement = !prevCursor || cursor.row != prevCursor.row;
        if (vScroll || hScroll && !vMovement) {
          if (!autoScrollStartTime)
            autoScrollStartTime = now2;
          else if (now2 - autoScrollStartTime >= AUTOSCROLL_DELAY)
            editor2.renderer.scrollCursorIntoView(scrollCursor);
        } else {
          autoScrollStartTime = null;
        }
      }
      function onDragInterval() {
        var prevCursor = dragCursor;
        dragCursor = editor2.renderer.screenToTextCoordinates(x2, y2);
        scrollCursorIntoView(dragCursor, prevCursor);
        autoScroll(dragCursor, prevCursor);
      }
      function addDragMarker() {
        range3 = editor2.selection.toOrientedRange();
        dragSelectionMarker = editor2.session.addMarker(range3, "ace_selection", editor2.getSelectionStyle());
        editor2.clearSelection();
        if (editor2.isFocused())
          editor2.renderer.$cursorLayer.setBlinking(false);
        clearInterval(timerId);
        onDragInterval();
        timerId = setInterval(onDragInterval, 20);
        counter = 0;
        event.addListener(document, "mousemove", onMouseMove);
      }
      function clearDragMarker() {
        clearInterval(timerId);
        editor2.session.removeMarker(dragSelectionMarker);
        dragSelectionMarker = null;
        editor2.selection.fromOrientedRange(range3);
        if (editor2.isFocused() && !isInternal)
          editor2.$resetCursorStyle();
        range3 = null;
        dragCursor = null;
        counter = 0;
        autoScrollStartTime = null;
        cursorMovedTime = null;
        event.removeListener(document, "mousemove", onMouseMove);
      }
      var onMouseMoveTimer = null;
      function onMouseMove() {
        if (onMouseMoveTimer == null) {
          onMouseMoveTimer = setTimeout(function() {
            if (onMouseMoveTimer != null && dragSelectionMarker)
              clearDragMarker();
          }, 20);
        }
      }
      function canAccept(dataTransfer) {
        var types2 = dataTransfer.types;
        return !types2 || Array.prototype.some.call(types2, function(type4) {
          return type4 == "text/plain" || type4 == "Text";
        });
      }
      function getDropEffect(e2) {
        var copyAllowed = ["copy", "copymove", "all", "uninitialized"];
        var moveAllowed = ["move", "copymove", "linkmove", "all", "uninitialized"];
        var copyModifierState = useragent.isMac ? e2.altKey : e2.ctrlKey;
        var effectAllowed = "uninitialized";
        try {
          effectAllowed = e2.dataTransfer.effectAllowed.toLowerCase();
        } catch (e3) {
        }
        var dropEffect = "none";
        if (copyModifierState && copyAllowed.indexOf(effectAllowed) >= 0)
          dropEffect = "copy";
        else if (moveAllowed.indexOf(effectAllowed) >= 0)
          dropEffect = "move";
        else if (copyAllowed.indexOf(effectAllowed) >= 0)
          dropEffect = "copy";
        return dropEffect;
      }
    }
    (function() {
      this.dragWait = function() {
        var interval = Date.now() - this.mousedownEvent.time;
        if (interval > this.editor.getDragDelay())
          this.startDrag();
      };
      this.dragWaitEnd = function() {
        var target = this.editor.container;
        target.draggable = false;
        this.startSelect(this.mousedownEvent.getDocumentPosition());
        this.selectEnd();
      };
      this.dragReadyEnd = function(e2) {
        this.editor.$resetCursorStyle();
        this.editor.unsetStyle("ace_dragging");
        this.editor.renderer.setCursorStyle("");
        this.dragWaitEnd();
      };
      this.startDrag = function() {
        this.cancelDrag = false;
        var editor2 = this.editor;
        var target = editor2.container;
        target.draggable = true;
        editor2.renderer.$cursorLayer.setBlinking(false);
        editor2.setStyle("ace_dragging");
        var cursorStyle = useragent.isWin ? "default" : "move";
        editor2.renderer.setCursorStyle(cursorStyle);
        this.setState("dragReady");
      };
      this.onMouseDrag = function(e2) {
        var target = this.editor.container;
        if (useragent.isIE && this.state == "dragReady") {
          var distance2 = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
          if (distance2 > 3)
            target.dragDrop();
        }
        if (this.state === "dragWait") {
          var distance2 = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
          if (distance2 > 0) {
            target.draggable = false;
            this.startSelect(this.mousedownEvent.getDocumentPosition());
          }
        }
      };
      this.onMouseDown = function(e2) {
        if (!this.$dragEnabled)
          return;
        this.mousedownEvent = e2;
        var editor2 = this.editor;
        var inSelection = e2.inSelection();
        var button2 = e2.getButton();
        var clickCount = e2.domEvent.detail || 1;
        if (clickCount === 1 && button2 === 0 && inSelection) {
          if (e2.editor.inMultiSelectMode && (e2.getAccelKey() || e2.getShiftKey()))
            return;
          this.mousedownEvent.time = Date.now();
          var eventTarget = e2.domEvent.target || e2.domEvent.srcElement;
          if ("unselectable" in eventTarget)
            eventTarget.unselectable = "on";
          if (editor2.getDragDelay()) {
            if (useragent.isWebKit) {
              this.cancelDrag = true;
              var mouseTarget = editor2.container;
              mouseTarget.draggable = true;
            }
            this.setState("dragWait");
          } else {
            this.startDrag();
          }
          this.captureMouse(e2, this.onMouseDrag.bind(this));
          e2.defaultPrevented = true;
        }
      };
    }).call(DragdropHandler.prototype);
    function calcDistance(ax, ay, bx, by) {
      return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
    }
    exports3.DragdropHandler = DragdropHandler;
  });
  ace.define("ace/mouse/touch_handler", ["require", "exports", "module", "ace/mouse/mouse_event", "ace/lib/event", "ace/lib/dom"], function(require2, exports3, module3) {
    var MouseEvent2 = require2("./mouse_event").MouseEvent;
    var event = require2("../lib/event");
    var dom = require2("../lib/dom");
    exports3.addTouchListeners = function(el2, editor2) {
      var mode = "scroll";
      var startX;
      var startY;
      var touchStartT;
      var lastT;
      var longTouchTimer;
      var animationTimer;
      var animationSteps = 0;
      var pos;
      var clickCount = 0;
      var vX = 0;
      var vY = 0;
      var pressed;
      var contextMenu;
      function createContextMenu() {
        var clipboard = window.navigator && window.navigator.clipboard;
        var isOpen = false;
        var updateMenu = function() {
          var selected = editor2.getCopyText();
          var hasUndo = editor2.session.getUndoManager().hasUndo();
          contextMenu.replaceChild(dom.buildDom(isOpen ? [
            "span",
            !selected && canExecuteCommand("selectall") && ["span", { class: "ace_mobile-button", action: "selectall" }, "Select All"],
            selected && canExecuteCommand("copy") && ["span", { class: "ace_mobile-button", action: "copy" }, "Copy"],
            selected && canExecuteCommand("cut") && ["span", { class: "ace_mobile-button", action: "cut" }, "Cut"],
            clipboard && canExecuteCommand("paste") && ["span", { class: "ace_mobile-button", action: "paste" }, "Paste"],
            hasUndo && canExecuteCommand("undo") && ["span", { class: "ace_mobile-button", action: "undo" }, "Undo"],
            canExecuteCommand("find") && ["span", { class: "ace_mobile-button", action: "find" }, "Find"],
            canExecuteCommand("openCommandPalette") && ["span", { class: "ace_mobile-button", action: "openCommandPalette" }, "Palette"]
          ] : ["span"]), contextMenu.firstChild);
        };
        var canExecuteCommand = function(cmd) {
          return editor2.commands.canExecute(cmd, editor2);
        };
        var handleClick = function(e2) {
          var action = e2.target.getAttribute("action");
          if (action == "more" || !isOpen) {
            isOpen = !isOpen;
            return updateMenu();
          }
          if (action == "paste") {
            clipboard.readText().then(function(text2) {
              editor2.execCommand(action, text2);
            });
          } else if (action) {
            if (action == "cut" || action == "copy") {
              if (clipboard)
                clipboard.writeText(editor2.getCopyText());
              else
                document.execCommand("copy");
            }
            editor2.execCommand(action);
          }
          contextMenu.firstChild.style.display = "none";
          isOpen = false;
          if (action != "openCommandPalette")
            editor2.focus();
        };
        contextMenu = dom.buildDom([
          "div",
          {
            class: "ace_mobile-menu",
            ontouchstart: function(e2) {
              mode = "menu";
              e2.stopPropagation();
              e2.preventDefault();
              editor2.textInput.focus();
            },
            ontouchend: function(e2) {
              e2.stopPropagation();
              e2.preventDefault();
              handleClick(e2);
            },
            onclick: handleClick
          },
          ["span"],
          ["span", { class: "ace_mobile-button", action: "more" }, "..."]
        ], editor2.container);
      }
      function showContextMenu() {
        if (!editor2.getOption("enableMobileMenu")) {
          if (contextMenu) {
            hideContextMenu();
          }
          return;
        }
        if (!contextMenu)
          createContextMenu();
        var cursor = editor2.selection.cursor;
        var pagePos = editor2.renderer.textToScreenCoordinates(cursor.row, cursor.column);
        var leftOffset = editor2.renderer.textToScreenCoordinates(0, 0).pageX;
        var scrollLeft = editor2.renderer.scrollLeft;
        var rect = editor2.container.getBoundingClientRect();
        contextMenu.style.top = pagePos.pageY - rect.top - 3 + "px";
        if (pagePos.pageX - rect.left < rect.width - 70) {
          contextMenu.style.left = "";
          contextMenu.style.right = "10px";
        } else {
          contextMenu.style.right = "";
          contextMenu.style.left = leftOffset + scrollLeft - rect.left + "px";
        }
        contextMenu.style.display = "";
        contextMenu.firstChild.style.display = "none";
        editor2.on("input", hideContextMenu);
      }
      function hideContextMenu(e2) {
        if (contextMenu)
          contextMenu.style.display = "none";
        editor2.off("input", hideContextMenu);
      }
      function handleLongTap() {
        longTouchTimer = null;
        clearTimeout(longTouchTimer);
        var range3 = editor2.selection.getRange();
        var inSelection = range3.contains(pos.row, pos.column);
        if (range3.isEmpty() || !inSelection) {
          editor2.selection.moveToPosition(pos);
          editor2.selection.selectWord();
        }
        mode = "wait";
        showContextMenu();
      }
      function switchToSelectionMode() {
        longTouchTimer = null;
        clearTimeout(longTouchTimer);
        editor2.selection.moveToPosition(pos);
        var range3 = clickCount >= 2 ? editor2.selection.getLineRange(pos.row) : editor2.session.getBracketRange(pos);
        if (range3 && !range3.isEmpty()) {
          editor2.selection.setRange(range3);
        } else {
          editor2.selection.selectWord();
        }
        mode = "wait";
      }
      event.addListener(el2, "contextmenu", function(e2) {
        if (!pressed)
          return;
        var textarea = editor2.textInput.getElement();
        textarea.focus();
      }, editor2);
      event.addListener(el2, "touchstart", function(e2) {
        var touches = e2.touches;
        if (longTouchTimer || touches.length > 1) {
          clearTimeout(longTouchTimer);
          longTouchTimer = null;
          touchStartT = -1;
          mode = "zoom";
          return;
        }
        pressed = editor2.$mouseHandler.isMousePressed = true;
        var h3 = editor2.renderer.layerConfig.lineHeight;
        var w2 = editor2.renderer.layerConfig.lineHeight;
        var t2 = e2.timeStamp;
        lastT = t2;
        var touchObj = touches[0];
        var x2 = touchObj.clientX;
        var y2 = touchObj.clientY;
        if (Math.abs(startX - x2) + Math.abs(startY - y2) > h3)
          touchStartT = -1;
        startX = e2.clientX = x2;
        startY = e2.clientY = y2;
        vX = vY = 0;
        var ev = new MouseEvent2(e2, editor2);
        pos = ev.getDocumentPosition();
        if (t2 - touchStartT < 500 && touches.length == 1 && !animationSteps) {
          clickCount++;
          e2.preventDefault();
          e2.button = 0;
          switchToSelectionMode();
        } else {
          clickCount = 0;
          var cursor = editor2.selection.cursor;
          var anchor = editor2.selection.isEmpty() ? cursor : editor2.selection.anchor;
          var cursorPos = editor2.renderer.$cursorLayer.getPixelPosition(cursor, true);
          var anchorPos = editor2.renderer.$cursorLayer.getPixelPosition(anchor, true);
          var rect = editor2.renderer.scroller.getBoundingClientRect();
          var offsetTop = editor2.renderer.layerConfig.offset;
          var offsetLeft = editor2.renderer.scrollLeft;
          var weightedDistance = function(x3, y3) {
            x3 = x3 / w2;
            y3 = y3 / h3 - 0.75;
            return x3 * x3 + y3 * y3;
          };
          if (e2.clientX < rect.left) {
            mode = "zoom";
            return;
          }
          var diff1 = weightedDistance(e2.clientX - rect.left - cursorPos.left + offsetLeft, e2.clientY - rect.top - cursorPos.top + offsetTop);
          var diff2 = weightedDistance(e2.clientX - rect.left - anchorPos.left + offsetLeft, e2.clientY - rect.top - anchorPos.top + offsetTop);
          if (diff1 < 3.5 && diff2 < 3.5)
            mode = diff1 > diff2 ? "cursor" : "anchor";
          if (diff2 < 3.5)
            mode = "anchor";
          else if (diff1 < 3.5)
            mode = "cursor";
          else
            mode = "scroll";
          longTouchTimer = setTimeout(handleLongTap, 450);
        }
        touchStartT = t2;
      }, editor2);
      event.addListener(el2, "touchend", function(e2) {
        pressed = editor2.$mouseHandler.isMousePressed = false;
        if (animationTimer)
          clearInterval(animationTimer);
        if (mode == "zoom") {
          mode = "";
          animationSteps = 0;
        } else if (longTouchTimer) {
          editor2.selection.moveToPosition(pos);
          animationSteps = 0;
          showContextMenu();
        } else if (mode == "scroll") {
          animate();
          hideContextMenu();
        } else {
          showContextMenu();
        }
        clearTimeout(longTouchTimer);
        longTouchTimer = null;
      }, editor2);
      event.addListener(el2, "touchmove", function(e2) {
        if (longTouchTimer) {
          clearTimeout(longTouchTimer);
          longTouchTimer = null;
        }
        var touches = e2.touches;
        if (touches.length > 1 || mode == "zoom")
          return;
        var touchObj = touches[0];
        var wheelX = startX - touchObj.clientX;
        var wheelY = startY - touchObj.clientY;
        if (mode == "wait") {
          if (wheelX * wheelX + wheelY * wheelY > 4)
            mode = "cursor";
          else
            return e2.preventDefault();
        }
        startX = touchObj.clientX;
        startY = touchObj.clientY;
        e2.clientX = touchObj.clientX;
        e2.clientY = touchObj.clientY;
        var t2 = e2.timeStamp;
        var dt = t2 - lastT;
        lastT = t2;
        if (mode == "scroll") {
          var mouseEvent = new MouseEvent2(e2, editor2);
          mouseEvent.speed = 1;
          mouseEvent.wheelX = wheelX;
          mouseEvent.wheelY = wheelY;
          if (10 * Math.abs(wheelX) < Math.abs(wheelY))
            wheelX = 0;
          if (10 * Math.abs(wheelY) < Math.abs(wheelX))
            wheelY = 0;
          if (dt != 0) {
            vX = wheelX / dt;
            vY = wheelY / dt;
          }
          editor2._emit("mousewheel", mouseEvent);
          if (!mouseEvent.propagationStopped) {
            vX = vY = 0;
          }
        } else {
          var ev = new MouseEvent2(e2, editor2);
          var pos2 = ev.getDocumentPosition();
          if (mode == "cursor")
            editor2.selection.moveCursorToPosition(pos2);
          else if (mode == "anchor")
            editor2.selection.setSelectionAnchor(pos2.row, pos2.column);
          editor2.renderer.scrollCursorIntoView(pos2);
          e2.preventDefault();
        }
      }, editor2);
      function animate() {
        animationSteps += 60;
        animationTimer = setInterval(function() {
          if (animationSteps-- <= 0) {
            clearInterval(animationTimer);
            animationTimer = null;
          }
          if (Math.abs(vX) < 0.01)
            vX = 0;
          if (Math.abs(vY) < 0.01)
            vY = 0;
          if (animationSteps < 20)
            vX = 0.9 * vX;
          if (animationSteps < 20)
            vY = 0.9 * vY;
          var oldScrollTop = editor2.session.getScrollTop();
          editor2.renderer.scrollBy(10 * vX, 10 * vY);
          if (oldScrollTop == editor2.session.getScrollTop())
            animationSteps = 0;
        }, 10);
      }
    };
  });
  ace.define("ace/mouse/mouse_handler", ["require", "exports", "module", "ace/lib/event", "ace/lib/useragent", "ace/mouse/default_handlers", "ace/mouse/default_gutter_handler", "ace/mouse/mouse_event", "ace/mouse/dragdrop_handler", "ace/mouse/touch_handler", "ace/config"], function(require2, exports3, module3) {
    var event = require2("../lib/event");
    var useragent = require2("../lib/useragent");
    var DefaultHandlers = require2("./default_handlers").DefaultHandlers;
    var DefaultGutterHandler = require2("./default_gutter_handler").GutterHandler;
    var MouseEvent2 = require2("./mouse_event").MouseEvent;
    var DragdropHandler = require2("./dragdrop_handler").DragdropHandler;
    var addTouchListeners = require2("./touch_handler").addTouchListeners;
    var config2 = require2("../config");
    var MouseHandler = (
      /** @class */
      function() {
        function MouseHandler2(editor2) {
          this.$dragDelay;
          this.$dragEnabled;
          this.$mouseMoved;
          this.mouseEvent;
          this.$focusTimeout;
          var _self = this;
          this.editor = editor2;
          new DefaultHandlers(this);
          new DefaultGutterHandler(this);
          new DragdropHandler(this);
          var focusEditor = function(e2) {
            var windowBlurred = !document.hasFocus || !document.hasFocus() || !editor2.isFocused() && document.activeElement == (editor2.textInput && editor2.textInput.getElement());
            if (windowBlurred)
              window.focus();
            editor2.focus();
            setTimeout(function() {
              if (!editor2.isFocused())
                editor2.focus();
            });
          };
          var mouseTarget = editor2.renderer.getMouseEventTarget();
          event.addListener(mouseTarget, "click", this.onMouseEvent.bind(this, "click"), editor2);
          event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this, "mousemove"), editor2);
          event.addMultiMouseDownListener([
            mouseTarget,
            editor2.renderer.scrollBarV && editor2.renderer.scrollBarV.inner,
            editor2.renderer.scrollBarH && editor2.renderer.scrollBarH.inner,
            editor2.textInput && editor2.textInput.getElement()
          ].filter(Boolean), [400, 300, 250], this, "onMouseEvent", editor2);
          event.addMouseWheelListener(editor2.container, this.onMouseWheel.bind(this, "mousewheel"), editor2);
          addTouchListeners(editor2.container, editor2);
          var gutterEl = editor2.renderer.$gutter;
          event.addListener(gutterEl, "mousedown", this.onMouseEvent.bind(this, "guttermousedown"), editor2);
          event.addListener(gutterEl, "click", this.onMouseEvent.bind(this, "gutterclick"), editor2);
          event.addListener(gutterEl, "dblclick", this.onMouseEvent.bind(this, "gutterdblclick"), editor2);
          event.addListener(gutterEl, "mousemove", this.onMouseEvent.bind(this, "guttermousemove"), editor2);
          event.addListener(mouseTarget, "mousedown", focusEditor, editor2);
          event.addListener(gutterEl, "mousedown", focusEditor, editor2);
          if (useragent.isIE && editor2.renderer.scrollBarV) {
            event.addListener(editor2.renderer.scrollBarV.element, "mousedown", focusEditor, editor2);
            event.addListener(editor2.renderer.scrollBarH.element, "mousedown", focusEditor, editor2);
          }
          editor2.on(
            "mousemove",
            function(e2) {
              if (_self.state || _self.$dragDelay || !_self.$dragEnabled)
                return;
              var character2 = editor2.renderer.screenToTextCoordinates(e2.x, e2.y);
              var range3 = editor2.session.selection.getRange();
              var renderer = editor2.renderer;
              if (!range3.isEmpty() && range3.insideStart(character2.row, character2.column)) {
                renderer.setCursorStyle("default");
              } else {
                renderer.setCursorStyle("");
              }
            },
            //@ts-expect-error TODO: seems mistyping - should be boolean
            editor2
          );
        }
        MouseHandler2.prototype.onMouseEvent = function(name2, e2) {
          if (!this.editor.session)
            return;
          this.editor._emit(name2, new MouseEvent2(e2, this.editor));
        };
        MouseHandler2.prototype.onMouseMove = function(name2, e2) {
          var listeners = this.editor._eventRegistry && this.editor._eventRegistry.mousemove;
          if (!listeners || !listeners.length)
            return;
          this.editor._emit(name2, new MouseEvent2(e2, this.editor));
        };
        MouseHandler2.prototype.onMouseWheel = function(name2, e2) {
          var mouseEvent = new MouseEvent2(e2, this.editor);
          mouseEvent.speed = this.$scrollSpeed * 2;
          mouseEvent.wheelX = e2.wheelX;
          mouseEvent.wheelY = e2.wheelY;
          this.editor._emit(name2, mouseEvent);
        };
        MouseHandler2.prototype.setState = function(state) {
          this.state = state;
        };
        MouseHandler2.prototype.captureMouse = function(ev, mouseMoveHandler) {
          this.x = ev.x;
          this.y = ev.y;
          this.isMousePressed = true;
          var editor2 = this.editor;
          var renderer = this.editor.renderer;
          renderer.$isMousePressed = true;
          var self2 = this;
          var continueCapture = true;
          var onMouseMove = function(e2) {
            if (!e2)
              return;
            if (useragent.isWebKit && !e2.which && self2.releaseMouse)
              return self2.releaseMouse();
            self2.x = e2.clientX;
            self2.y = e2.clientY;
            mouseMoveHandler && mouseMoveHandler(e2);
            self2.mouseEvent = new MouseEvent2(e2, self2.editor);
            self2.$mouseMoved = true;
          };
          var onCaptureEnd = function(e2) {
            editor2.off("beforeEndOperation", onOperationEnd);
            continueCapture = false;
            if (editor2.session)
              onCaptureUpdate();
            self2[self2.state + "End"] && self2[self2.state + "End"](e2);
            self2.state = "";
            self2.isMousePressed = renderer.$isMousePressed = false;
            if (renderer.$keepTextAreaAtCursor)
              renderer.$moveTextAreaToCursor();
            self2.$onCaptureMouseMove = self2.releaseMouse = null;
            e2 && self2.onMouseEvent("mouseup", e2);
            editor2.endOperation();
          };
          var onCaptureUpdate = function() {
            self2[self2.state] && self2[self2.state]();
            self2.$mouseMoved = false;
          };
          var onCaptureInterval = function() {
            if (continueCapture) {
              onCaptureUpdate();
              event.nextFrame(onCaptureInterval);
            }
          };
          if (useragent.isOldIE && ev.domEvent.type == "dblclick") {
            return setTimeout(function() {
              onCaptureEnd(ev);
            });
          }
          var onOperationEnd = function(e2) {
            if (!self2.releaseMouse)
              return;
            if (editor2.curOp.command.name && editor2.curOp.selectionChanged) {
              self2[self2.state + "End"] && self2[self2.state + "End"]();
              self2.state = "";
              self2.releaseMouse();
            }
          };
          editor2.on("beforeEndOperation", onOperationEnd);
          editor2.startOperation({ command: { name: "mouse" } });
          self2.$onCaptureMouseMove = onMouseMove;
          self2.releaseMouse = event.capture(this.editor.container, onMouseMove, onCaptureEnd);
          onCaptureInterval();
        };
        MouseHandler2.prototype.cancelContextMenu = function() {
          var stop = (function(e2) {
            if (e2 && e2.domEvent && e2.domEvent.type != "contextmenu")
              return;
            this.editor.off("nativecontextmenu", stop);
            if (e2 && e2.domEvent)
              event.stopEvent(e2.domEvent);
          }).bind(this);
          setTimeout(stop, 10);
          this.editor.on("nativecontextmenu", stop);
        };
        MouseHandler2.prototype.destroy = function() {
          if (this.releaseMouse)
            this.releaseMouse();
        };
        return MouseHandler2;
      }()
    );
    MouseHandler.prototype.releaseMouse = null;
    config2.defineOptions(MouseHandler.prototype, "mouseHandler", {
      scrollSpeed: { initialValue: 2 },
      dragDelay: { initialValue: useragent.isMac ? 150 : 0 },
      dragEnabled: { initialValue: true },
      focusTimeout: { initialValue: 0 },
      tooltipFollowsMouse: { initialValue: true }
    });
    exports3.MouseHandler = MouseHandler;
  });
  ace.define("ace/mouse/fold_handler", ["require", "exports", "module", "ace/lib/dom"], function(require2, exports3, module3) {
    var dom = require2("../lib/dom");
    var FoldHandler = (
      /** @class */
      /* @__PURE__ */ function() {
        function FoldHandler2(editor2) {
          editor2.on("click", function(e2) {
            var position2 = e2.getDocumentPosition();
            var session = editor2.session;
            var fold = session.getFoldAt(position2.row, position2.column, 1);
            if (fold) {
              if (e2.getAccelKey())
                session.removeFold(fold);
              else
                session.expandFold(fold);
              e2.stop();
            }
            var target = e2.domEvent && e2.domEvent.target;
            if (target && dom.hasCssClass(target, "ace_inline_button")) {
              if (dom.hasCssClass(target, "ace_toggle_wrap")) {
                session.setOption("wrap", !session.getUseWrapMode());
                editor2.renderer.scrollCursorIntoView();
              }
            }
          });
          editor2.on("gutterclick", function(e2) {
            var gutterRegion = editor2.renderer.$gutterLayer.getRegion(e2);
            if (gutterRegion == "foldWidgets") {
              var row = e2.getDocumentPosition().row;
              var session = editor2.session;
              if (session.foldWidgets && session.foldWidgets[row])
                editor2.session.onFoldWidgetClick(row, e2);
              if (!editor2.isFocused())
                editor2.focus();
              e2.stop();
            }
          });
          editor2.on("gutterdblclick", function(e2) {
            var gutterRegion = editor2.renderer.$gutterLayer.getRegion(e2);
            if (gutterRegion == "foldWidgets") {
              var row = e2.getDocumentPosition().row;
              var session = editor2.session;
              var data = session.getParentFoldRangeData(row, true);
              var range3 = data.range || data.firstRange;
              if (range3) {
                row = range3.start.row;
                var fold = session.getFoldAt(row, session.getLine(row).length, 1);
                if (fold) {
                  session.removeFold(fold);
                } else {
                  session.addFold("...", range3);
                  editor2.renderer.scrollCursorIntoView({ row: range3.start.row, column: 0 });
                }
              }
              e2.stop();
            }
          });
        }
        return FoldHandler2;
      }()
    );
    exports3.FoldHandler = FoldHandler;
  });
  ace.define("ace/keyboard/keybinding", ["require", "exports", "module", "ace/lib/keys", "ace/lib/event"], function(require2, exports3, module3) {
    var keyUtil = require2("../lib/keys");
    var event = require2("../lib/event");
    var KeyBinding = (
      /** @class */
      function() {
        function KeyBinding2(editor2) {
          this.$editor = editor2;
          this.$data = { editor: editor2 };
          this.$handlers = [];
          this.setDefaultHandler(editor2.commands);
        }
        KeyBinding2.prototype.setDefaultHandler = function(kb2) {
          this.removeKeyboardHandler(this.$defaultHandler);
          this.$defaultHandler = kb2;
          this.addKeyboardHandler(kb2, 0);
        };
        KeyBinding2.prototype.setKeyboardHandler = function(kb2) {
          var h3 = this.$handlers;
          if (h3[h3.length - 1] == kb2)
            return;
          while (h3[h3.length - 1] && h3[h3.length - 1] != this.$defaultHandler)
            this.removeKeyboardHandler(h3[h3.length - 1]);
          this.addKeyboardHandler(kb2, 1);
        };
        KeyBinding2.prototype.addKeyboardHandler = function(kb2, pos) {
          if (!kb2)
            return;
          if (typeof kb2 == "function" && !kb2.handleKeyboard)
            kb2.handleKeyboard = kb2;
          var i2 = this.$handlers.indexOf(kb2);
          if (i2 != -1)
            this.$handlers.splice(i2, 1);
          if (pos == void 0)
            this.$handlers.push(kb2);
          else
            this.$handlers.splice(pos, 0, kb2);
          if (i2 == -1 && kb2.attach)
            kb2.attach(this.$editor);
        };
        KeyBinding2.prototype.removeKeyboardHandler = function(kb2) {
          var i2 = this.$handlers.indexOf(kb2);
          if (i2 == -1)
            return false;
          this.$handlers.splice(i2, 1);
          kb2.detach && kb2.detach(this.$editor);
          return true;
        };
        KeyBinding2.prototype.getKeyboardHandler = function() {
          return this.$handlers[this.$handlers.length - 1];
        };
        KeyBinding2.prototype.getStatusText = function() {
          var data = this.$data;
          var editor2 = data.editor;
          return this.$handlers.map(function(h3) {
            return h3.getStatusText && h3.getStatusText(editor2, data) || "";
          }).filter(Boolean).join(" ");
        };
        KeyBinding2.prototype.$callKeyboardHandlers = function(hashId, keyString, keyCode, e2) {
          var toExecute;
          var success = false;
          var commands = this.$editor.commands;
          for (var i2 = this.$handlers.length; i2--; ) {
            toExecute = this.$handlers[i2].handleKeyboard(
              this.$data,
              hashId,
              keyString,
              keyCode,
              e2
            );
            if (!toExecute || !toExecute.command)
              continue;
            if (toExecute.command == "null") {
              success = true;
            } else {
              success = commands.exec(toExecute.command, this.$editor, toExecute.args, e2);
            }
            if (success && e2 && hashId != -1 && toExecute["passEvent"] != true && toExecute.command["passEvent"] != true) {
              event.stopEvent(e2);
            }
            if (success)
              break;
          }
          if (!success && hashId == -1) {
            toExecute = { command: "insertstring" };
            success = commands.exec("insertstring", this.$editor, keyString);
          }
          if (success && this.$editor._signal)
            this.$editor._signal("keyboardActivity", toExecute);
          return success;
        };
        KeyBinding2.prototype.onCommandKey = function(e2, hashId, keyCode) {
          var keyString = keyUtil.keyCodeToString(keyCode);
          return this.$callKeyboardHandlers(hashId, keyString, keyCode, e2);
        };
        KeyBinding2.prototype.onTextInput = function(text2) {
          return this.$callKeyboardHandlers(-1, text2);
        };
        return KeyBinding2;
      }()
    );
    exports3.KeyBinding = KeyBinding;
  });
  ace.define("ace/lib/bidiutil", ["require", "exports", "module"], function(require2, exports3, module3) {
    var dir = 0, hiLevel = 0;
    var lastArabic = false, hasUBAT_B = false, hasUBAT_S = false;
    var impTab_LTR = [
      [0, 3, 0, 1, 0, 0, 0],
      [0, 3, 0, 1, 2, 2, 0],
      [0, 3, 0, 17, 2, 0, 1],
      [0, 3, 5, 5, 4, 1, 0],
      [0, 3, 21, 21, 4, 0, 1],
      [0, 3, 5, 5, 4, 2, 0]
    ];
    var impTab_RTL = [
      [2, 0, 1, 1, 0, 1, 0],
      [2, 0, 1, 1, 0, 2, 0],
      [2, 0, 2, 1, 3, 2, 0],
      [2, 0, 2, 33, 3, 1, 1]
    ];
    var LTR = 0, RTL = 1;
    var L2 = 0;
    var R2 = 1;
    var EN = 2;
    var AN = 3;
    var ON = 4;
    var B2 = 5;
    var S2 = 6;
    var AL = 7;
    var WS = 8;
    var CS = 9;
    var ES = 10;
    var ET = 11;
    var NSM = 12;
    var LRE = 13;
    var RLE = 14;
    var PDF = 15;
    var LRO = 16;
    var RLO = 17;
    var BN = 18;
    var UnicodeTBL00 = [
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      S2,
      B2,
      S2,
      WS,
      B2,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      B2,
      B2,
      B2,
      S2,
      WS,
      ON,
      ON,
      ET,
      ET,
      ET,
      ON,
      ON,
      ON,
      ON,
      ON,
      ES,
      CS,
      ES,
      CS,
      CS,
      EN,
      EN,
      EN,
      EN,
      EN,
      EN,
      EN,
      EN,
      EN,
      EN,
      CS,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      ON,
      ON,
      ON,
      ON,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      B2,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      CS,
      ON,
      ET,
      ET,
      ET,
      ET,
      ON,
      ON,
      ON,
      ON,
      L2,
      ON,
      ON,
      BN,
      ON,
      ON,
      ET,
      ET,
      EN,
      EN,
      ON,
      L2,
      ON,
      ON,
      ON,
      EN,
      L2,
      ON,
      ON,
      ON,
      ON,
      ON
    ];
    var UnicodeTBL20 = [
      WS,
      WS,
      WS,
      WS,
      WS,
      WS,
      WS,
      WS,
      WS,
      WS,
      WS,
      BN,
      BN,
      BN,
      L2,
      R2,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      WS,
      B2,
      LRE,
      RLE,
      PDF,
      LRO,
      RLO,
      CS,
      ET,
      ET,
      ET,
      ET,
      ET,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      CS,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      WS
    ];
    function _computeLevels(chars2, levels, len, charTypes) {
      var impTab = dir ? impTab_RTL : impTab_LTR, prevState = null, newClass = null, newLevel = null, newState = 0, action = null, cond = null, condPos = -1, i2 = null, ix = null, classes = [];
      if (!charTypes) {
        for (i2 = 0, charTypes = []; i2 < len; i2++) {
          charTypes[i2] = _getCharacterType(chars2[i2]);
        }
      }
      hiLevel = dir;
      lastArabic = false;
      hasUBAT_B = false;
      hasUBAT_S = false;
      for (ix = 0; ix < len; ix++) {
        prevState = newState;
        classes[ix] = newClass = _getCharClass(chars2, charTypes, classes, ix);
        newState = impTab[prevState][newClass];
        action = newState & 240;
        newState &= 15;
        levels[ix] = newLevel = impTab[newState][5];
        if (action > 0) {
          if (action == 16) {
            for (i2 = condPos; i2 < ix; i2++) {
              levels[i2] = 1;
            }
            condPos = -1;
          } else {
            condPos = -1;
          }
        }
        cond = impTab[newState][6];
        if (cond) {
          if (condPos == -1) {
            condPos = ix;
          }
        } else {
          if (condPos > -1) {
            for (i2 = condPos; i2 < ix; i2++) {
              levels[i2] = newLevel;
            }
            condPos = -1;
          }
        }
        if (charTypes[ix] == B2) {
          levels[ix] = 0;
        }
        hiLevel |= newLevel;
      }
      if (hasUBAT_S) {
        for (i2 = 0; i2 < len; i2++) {
          if (charTypes[i2] == S2) {
            levels[i2] = dir;
            for (var j2 = i2 - 1; j2 >= 0; j2--) {
              if (charTypes[j2] == WS) {
                levels[j2] = dir;
              } else {
                break;
              }
            }
          }
        }
      }
    }
    function _invertLevel(lev, levels, _array) {
      if (hiLevel < lev) {
        return;
      }
      if (lev == 1 && dir == RTL && !hasUBAT_B) {
        _array.reverse();
        return;
      }
      var len = _array.length, start2 = 0, end2, lo, hi2, tmp;
      while (start2 < len) {
        if (levels[start2] >= lev) {
          end2 = start2 + 1;
          while (end2 < len && levels[end2] >= lev) {
            end2++;
          }
          for (lo = start2, hi2 = end2 - 1; lo < hi2; lo++, hi2--) {
            tmp = _array[lo];
            _array[lo] = _array[hi2];
            _array[hi2] = tmp;
          }
          start2 = end2;
        }
        start2++;
      }
    }
    function _getCharClass(chars2, types2, classes, ix) {
      var cType = types2[ix], wType, nType, len, i2;
      switch (cType) {
        case L2:
        case R2:
          lastArabic = false;
        case ON:
        case AN:
          return cType;
        case EN:
          return lastArabic ? AN : EN;
        case AL:
          lastArabic = true;
          return R2;
        case WS:
          return ON;
        case CS:
          if (ix < 1 || ix + 1 >= types2.length || (wType = classes[ix - 1]) != EN && wType != AN || (nType = types2[ix + 1]) != EN && nType != AN) {
            return ON;
          }
          if (lastArabic) {
            nType = AN;
          }
          return nType == wType ? nType : ON;
        case ES:
          wType = ix > 0 ? classes[ix - 1] : B2;
          if (wType == EN && ix + 1 < types2.length && types2[ix + 1] == EN) {
            return EN;
          }
          return ON;
        case ET:
          if (ix > 0 && classes[ix - 1] == EN) {
            return EN;
          }
          if (lastArabic) {
            return ON;
          }
          i2 = ix + 1;
          len = types2.length;
          while (i2 < len && types2[i2] == ET) {
            i2++;
          }
          if (i2 < len && types2[i2] == EN) {
            return EN;
          }
          return ON;
        case NSM:
          len = types2.length;
          i2 = ix + 1;
          while (i2 < len && types2[i2] == NSM) {
            i2++;
          }
          if (i2 < len) {
            var c2 = chars2[ix], rtlCandidate = c2 >= 1425 && c2 <= 2303 || c2 == 64286;
            wType = types2[i2];
            if (rtlCandidate && (wType == R2 || wType == AL)) {
              return R2;
            }
          }
          if (ix < 1 || (wType = types2[ix - 1]) == B2) {
            return ON;
          }
          return classes[ix - 1];
        case B2:
          lastArabic = false;
          hasUBAT_B = true;
          return dir;
        case S2:
          hasUBAT_S = true;
          return ON;
        case LRE:
        case RLE:
        case LRO:
        case RLO:
        case PDF:
          lastArabic = false;
        case BN:
          return ON;
      }
    }
    function _getCharacterType(ch2) {
      var uc2 = ch2.charCodeAt(0), hi2 = uc2 >> 8;
      if (hi2 == 0) {
        return uc2 > 191 ? L2 : UnicodeTBL00[uc2];
      } else if (hi2 == 5) {
        return /[\u0591-\u05f4]/.test(ch2) ? R2 : L2;
      } else if (hi2 == 6) {
        if (/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(ch2))
          return NSM;
        else if (/[\u0660-\u0669\u066b-\u066c]/.test(ch2))
          return AN;
        else if (uc2 == 1642)
          return ET;
        else if (/[\u06f0-\u06f9]/.test(ch2))
          return EN;
        else
          return AL;
      } else if (hi2 == 32 && uc2 <= 8287) {
        return UnicodeTBL20[uc2 & 255];
      } else if (hi2 == 254) {
        return uc2 >= 65136 ? AL : ON;
      }
      return ON;
    }
    exports3.L = L2;
    exports3.R = R2;
    exports3.EN = EN;
    exports3.ON_R = 3;
    exports3.AN = 4;
    exports3.R_H = 5;
    exports3.B = 6;
    exports3.RLE = 7;
    exports3.DOT = "·";
    exports3.doBidiReorder = function(text2, textCharTypes, isRtl) {
      if (text2.length < 2)
        return {};
      var chars2 = text2.split(""), logicalFromVisual = new Array(chars2.length), bidiLevels = new Array(chars2.length), levels = [];
      dir = isRtl ? RTL : LTR;
      _computeLevels(chars2, levels, chars2.length, textCharTypes);
      for (var i2 = 0; i2 < logicalFromVisual.length; logicalFromVisual[i2] = i2, i2++)
        ;
      _invertLevel(2, levels, logicalFromVisual);
      _invertLevel(1, levels, logicalFromVisual);
      for (var i2 = 0; i2 < logicalFromVisual.length - 1; i2++) {
        if (textCharTypes[i2] === AN) {
          levels[i2] = exports3.AN;
        } else if (levels[i2] === R2 && (textCharTypes[i2] > AL && textCharTypes[i2] < LRE || textCharTypes[i2] === ON || textCharTypes[i2] === BN)) {
          levels[i2] = exports3.ON_R;
        } else if (i2 > 0 && chars2[i2 - 1] === "ل" && /\u0622|\u0623|\u0625|\u0627/.test(chars2[i2])) {
          levels[i2 - 1] = levels[i2] = exports3.R_H;
          i2++;
        }
      }
      if (chars2[chars2.length - 1] === exports3.DOT)
        levels[chars2.length - 1] = exports3.B;
      if (chars2[0] === "‫")
        levels[0] = exports3.RLE;
      for (var i2 = 0; i2 < logicalFromVisual.length; i2++) {
        bidiLevels[i2] = levels[logicalFromVisual[i2]];
      }
      return { "logicalFromVisual": logicalFromVisual, "bidiLevels": bidiLevels };
    };
    exports3.hasBidiCharacters = function(text2, textCharTypes) {
      var ret = false;
      for (var i2 = 0; i2 < text2.length; i2++) {
        textCharTypes[i2] = _getCharacterType(text2.charAt(i2));
        if (!ret && (textCharTypes[i2] == R2 || textCharTypes[i2] == AL || textCharTypes[i2] == AN))
          ret = true;
      }
      return ret;
    };
    exports3.getVisualFromLogicalIdx = function(logIdx, rowMap) {
      for (var i2 = 0; i2 < rowMap.logicalFromVisual.length; i2++) {
        if (rowMap.logicalFromVisual[i2] == logIdx)
          return i2;
      }
      return 0;
    };
  });
  ace.define("ace/bidihandler", ["require", "exports", "module", "ace/lib/bidiutil", "ace/lib/lang"], function(require2, exports3, module3) {
    var bidiUtil = require2("./lib/bidiutil");
    var lang2 = require2("./lib/lang");
    var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/;
    var BidiHandler = (
      /** @class */
      function() {
        function BidiHandler2(session) {
          this.session = session;
          this.bidiMap = {};
          this.currentRow = null;
          this.bidiUtil = bidiUtil;
          this.charWidths = [];
          this.EOL = "¬";
          this.showInvisibles = true;
          this.isRtlDir = false;
          this.$isRtl = false;
          this.line = "";
          this.wrapIndent = 0;
          this.EOF = "¶";
          this.RLE = "‫";
          this.contentWidth = 0;
          this.fontMetrics = null;
          this.rtlLineOffset = 0;
          this.wrapOffset = 0;
          this.isMoveLeftOperation = false;
          this.seenBidi = bidiRE.test(session.getValue());
        }
        BidiHandler2.prototype.isBidiRow = function(screenRow, docRow, splitIndex) {
          if (!this.seenBidi)
            return false;
          if (screenRow !== this.currentRow) {
            this.currentRow = screenRow;
            this.updateRowLine(docRow, splitIndex);
            this.updateBidiMap();
          }
          return this.bidiMap.bidiLevels;
        };
        BidiHandler2.prototype.onChange = function(delta) {
          if (!this.seenBidi) {
            if (delta.action == "insert" && bidiRE.test(delta.lines.join("\n"))) {
              this.seenBidi = true;
              this.currentRow = null;
            }
          } else {
            this.currentRow = null;
          }
        };
        BidiHandler2.prototype.getDocumentRow = function() {
          var docRow = 0;
          var rowCache = this.session.$screenRowCache;
          if (rowCache.length) {
            var index2 = this.session.$getRowCacheIndex(rowCache, this.currentRow);
            if (index2 >= 0)
              docRow = this.session.$docRowCache[index2];
          }
          return docRow;
        };
        BidiHandler2.prototype.getSplitIndex = function() {
          var splitIndex = 0;
          var rowCache = this.session.$screenRowCache;
          if (rowCache.length) {
            var currentIndex, prevIndex = this.session.$getRowCacheIndex(rowCache, this.currentRow);
            while (this.currentRow - splitIndex > 0) {
              currentIndex = this.session.$getRowCacheIndex(rowCache, this.currentRow - splitIndex - 1);
              if (currentIndex !== prevIndex)
                break;
              prevIndex = currentIndex;
              splitIndex++;
            }
          } else {
            splitIndex = this.currentRow;
          }
          return splitIndex;
        };
        BidiHandler2.prototype.updateRowLine = function(docRow, splitIndex) {
          if (docRow === void 0)
            docRow = this.getDocumentRow();
          var isLastRow = docRow === this.session.getLength() - 1, endOfLine = isLastRow ? this.EOF : this.EOL;
          this.wrapIndent = 0;
          this.line = this.session.getLine(docRow);
          this.isRtlDir = this.$isRtl || this.line.charAt(0) === this.RLE;
          if (this.session.$useWrapMode) {
            var splits = this.session.$wrapData[docRow];
            if (splits) {
              if (splitIndex === void 0)
                splitIndex = this.getSplitIndex();
              if (splitIndex > 0 && splits.length) {
                this.wrapIndent = splits.indent;
                this.wrapOffset = this.wrapIndent * this.charWidths[bidiUtil.L];
                this.line = splitIndex < splits.length ? this.line.substring(splits[splitIndex - 1], splits[splitIndex]) : this.line.substring(splits[splits.length - 1]);
              } else {
                this.line = this.line.substring(0, splits[splitIndex]);
              }
              if (splitIndex == splits.length) {
                this.line += this.showInvisibles ? endOfLine : bidiUtil.DOT;
              }
            }
          } else {
            this.line += this.showInvisibles ? endOfLine : bidiUtil.DOT;
          }
          var session = this.session, shift = 0, size2;
          this.line = this.line.replace(/\t|[\u1100-\u2029, \u202F-\uFFE6]/g, function(ch2, i2) {
            if (ch2 === "	" || session.isFullWidth(ch2.charCodeAt(0))) {
              size2 = ch2 === "	" ? session.getScreenTabSize(i2 + shift) : 2;
              shift += size2 - 1;
              return lang2.stringRepeat(bidiUtil.DOT, size2);
            }
            return ch2;
          });
          if (this.isRtlDir) {
            this.fontMetrics.$main.textContent = this.line.charAt(this.line.length - 1) == bidiUtil.DOT ? this.line.substr(0, this.line.length - 1) : this.line;
            this.rtlLineOffset = this.contentWidth - this.fontMetrics.$main.getBoundingClientRect().width;
          }
        };
        BidiHandler2.prototype.updateBidiMap = function() {
          var textCharTypes = [];
          if (bidiUtil.hasBidiCharacters(this.line, textCharTypes) || this.isRtlDir) {
            this.bidiMap = bidiUtil.doBidiReorder(this.line, textCharTypes, this.isRtlDir);
          } else {
            this.bidiMap = {};
          }
        };
        BidiHandler2.prototype.markAsDirty = function() {
          this.currentRow = null;
        };
        BidiHandler2.prototype.updateCharacterWidths = function(fontMetrics) {
          if (this.characterWidth === fontMetrics.$characterSize.width)
            return;
          this.fontMetrics = fontMetrics;
          var characterWidth = this.characterWidth = fontMetrics.$characterSize.width;
          var bidiCharWidth = fontMetrics.$measureCharWidth("ה");
          this.charWidths[bidiUtil.L] = this.charWidths[bidiUtil.EN] = this.charWidths[bidiUtil.ON_R] = characterWidth;
          this.charWidths[bidiUtil.R] = this.charWidths[bidiUtil.AN] = bidiCharWidth;
          this.charWidths[bidiUtil.R_H] = bidiCharWidth * 0.45;
          this.charWidths[bidiUtil.B] = this.charWidths[bidiUtil.RLE] = 0;
          this.currentRow = null;
        };
        BidiHandler2.prototype.setShowInvisibles = function(showInvisibles) {
          this.showInvisibles = showInvisibles;
          this.currentRow = null;
        };
        BidiHandler2.prototype.setEolChar = function(eolChar) {
          this.EOL = eolChar;
        };
        BidiHandler2.prototype.setContentWidth = function(width) {
          this.contentWidth = width;
        };
        BidiHandler2.prototype.isRtlLine = function(row) {
          if (this.$isRtl)
            return true;
          if (row != void 0)
            return this.session.getLine(row).charAt(0) == this.RLE;
          else
            return this.isRtlDir;
        };
        BidiHandler2.prototype.setRtlDirection = function(editor2, isRtlDir) {
          var cursor = editor2.getCursorPosition();
          for (var row = editor2.selection.getSelectionAnchor().row; row <= cursor.row; row++) {
            if (!isRtlDir && editor2.session.getLine(row).charAt(0) === editor2.session.$bidiHandler.RLE)
              editor2.session.doc.removeInLine(row, 0, 1);
            else if (isRtlDir && editor2.session.getLine(row).charAt(0) !== editor2.session.$bidiHandler.RLE)
              editor2.session.doc.insert({ column: 0, row }, editor2.session.$bidiHandler.RLE);
          }
        };
        BidiHandler2.prototype.getPosLeft = function(col) {
          col -= this.wrapIndent;
          var leftBoundary = this.line.charAt(0) === this.RLE ? 1 : 0;
          var logicalIdx = col > leftBoundary ? this.session.getOverwrite() ? col : col - 1 : leftBoundary;
          var visualIdx = bidiUtil.getVisualFromLogicalIdx(logicalIdx, this.bidiMap), levels = this.bidiMap.bidiLevels, left2 = 0;
          if (!this.session.getOverwrite() && col <= leftBoundary && levels[visualIdx] % 2 !== 0)
            visualIdx++;
          for (var i2 = 0; i2 < visualIdx; i2++) {
            left2 += this.charWidths[levels[i2]];
          }
          if (!this.session.getOverwrite() && col > leftBoundary && levels[visualIdx] % 2 === 0)
            left2 += this.charWidths[levels[visualIdx]];
          if (this.wrapIndent)
            left2 += this.isRtlDir ? -1 * this.wrapOffset : this.wrapOffset;
          if (this.isRtlDir)
            left2 += this.rtlLineOffset;
          return left2;
        };
        BidiHandler2.prototype.getSelections = function(startCol, endCol) {
          var map2 = this.bidiMap, levels = map2.bidiLevels, level, selections = [], offset2 = 0, selColMin = Math.min(startCol, endCol) - this.wrapIndent, selColMax = Math.max(startCol, endCol) - this.wrapIndent, isSelected = false, isSelectedPrev = false, selectionStart = 0;
          if (this.wrapIndent)
            offset2 += this.isRtlDir ? -1 * this.wrapOffset : this.wrapOffset;
          for (var logIdx, visIdx = 0; visIdx < levels.length; visIdx++) {
            logIdx = map2.logicalFromVisual[visIdx];
            level = levels[visIdx];
            isSelected = logIdx >= selColMin && logIdx < selColMax;
            if (isSelected && !isSelectedPrev) {
              selectionStart = offset2;
            } else if (!isSelected && isSelectedPrev) {
              selections.push({ left: selectionStart, width: offset2 - selectionStart });
            }
            offset2 += this.charWidths[level];
            isSelectedPrev = isSelected;
          }
          if (isSelected && visIdx === levels.length) {
            selections.push({ left: selectionStart, width: offset2 - selectionStart });
          }
          if (this.isRtlDir) {
            for (var i2 = 0; i2 < selections.length; i2++) {
              selections[i2].left += this.rtlLineOffset;
            }
          }
          return selections;
        };
        BidiHandler2.prototype.offsetToCol = function(posX) {
          if (this.isRtlDir)
            posX -= this.rtlLineOffset;
          var logicalIdx = 0, posX = Math.max(posX, 0), offset2 = 0, visualIdx = 0, levels = this.bidiMap.bidiLevels, charWidth = this.charWidths[levels[visualIdx]];
          if (this.wrapIndent)
            posX -= this.isRtlDir ? -1 * this.wrapOffset : this.wrapOffset;
          while (posX > offset2 + charWidth / 2) {
            offset2 += charWidth;
            if (visualIdx === levels.length - 1) {
              charWidth = 0;
              break;
            }
            charWidth = this.charWidths[levels[++visualIdx]];
          }
          if (visualIdx > 0 && levels[visualIdx - 1] % 2 !== 0 && levels[visualIdx] % 2 === 0) {
            if (posX < offset2)
              visualIdx--;
            logicalIdx = this.bidiMap.logicalFromVisual[visualIdx];
          } else if (visualIdx > 0 && levels[visualIdx - 1] % 2 === 0 && levels[visualIdx] % 2 !== 0) {
            logicalIdx = 1 + (posX > offset2 ? this.bidiMap.logicalFromVisual[visualIdx] : this.bidiMap.logicalFromVisual[visualIdx - 1]);
          } else if (this.isRtlDir && visualIdx === levels.length - 1 && charWidth === 0 && levels[visualIdx - 1] % 2 === 0 || !this.isRtlDir && visualIdx === 0 && levels[visualIdx] % 2 !== 0) {
            logicalIdx = 1 + this.bidiMap.logicalFromVisual[visualIdx];
          } else {
            if (visualIdx > 0 && levels[visualIdx - 1] % 2 !== 0 && charWidth !== 0)
              visualIdx--;
            logicalIdx = this.bidiMap.logicalFromVisual[visualIdx];
          }
          if (logicalIdx === 0 && this.isRtlDir)
            logicalIdx++;
          return logicalIdx + this.wrapIndent;
        };
        return BidiHandler2;
      }()
    );
    exports3.BidiHandler = BidiHandler;
  });
  ace.define("ace/selection", ["require", "exports", "module", "ace/lib/oop", "ace/lib/lang", "ace/lib/event_emitter", "ace/range"], function(require2, exports3, module3) {
    var oop = require2("./lib/oop");
    var lang2 = require2("./lib/lang");
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var Range2 = require2("./range").Range;
    var Selection = (
      /** @class */
      function() {
        function Selection2(session) {
          this.session = session;
          this.doc = session.getDocument();
          this.clearSelection();
          this.cursor = this.lead = this.doc.createAnchor(0, 0);
          this.anchor = this.doc.createAnchor(0, 0);
          this.$silent = false;
          var self2 = this;
          this.cursor.on("change", function(e2) {
            self2.$cursorChanged = true;
            if (!self2.$silent)
              self2._emit("changeCursor");
            if (!self2.$isEmpty && !self2.$silent)
              self2._emit("changeSelection");
            if (!self2.$keepDesiredColumnOnChange && e2.old.column != e2.value.column)
              self2.$desiredColumn = null;
          });
          this.anchor.on("change", function() {
            self2.$anchorChanged = true;
            if (!self2.$isEmpty && !self2.$silent)
              self2._emit("changeSelection");
          });
        }
        Selection2.prototype.isEmpty = function() {
          return this.$isEmpty || this.anchor.row == this.lead.row && this.anchor.column == this.lead.column;
        };
        Selection2.prototype.isMultiLine = function() {
          return !this.$isEmpty && this.anchor.row != this.cursor.row;
        };
        Selection2.prototype.getCursor = function() {
          return this.lead.getPosition();
        };
        Selection2.prototype.setAnchor = function(row, column2) {
          this.$isEmpty = false;
          this.anchor.setPosition(row, column2);
        };
        Selection2.prototype.getAnchor = function() {
          if (this.$isEmpty)
            return this.getSelectionLead();
          return this.anchor.getPosition();
        };
        Selection2.prototype.getSelectionLead = function() {
          return this.lead.getPosition();
        };
        Selection2.prototype.isBackwards = function() {
          var anchor = this.anchor;
          var lead = this.lead;
          return anchor.row > lead.row || anchor.row == lead.row && anchor.column > lead.column;
        };
        Selection2.prototype.getRange = function() {
          var anchor = this.anchor;
          var lead = this.lead;
          if (this.$isEmpty)
            return Range2.fromPoints(lead, lead);
          return this.isBackwards() ? Range2.fromPoints(lead, anchor) : Range2.fromPoints(anchor, lead);
        };
        Selection2.prototype.clearSelection = function() {
          if (!this.$isEmpty) {
            this.$isEmpty = true;
            this._emit("changeSelection");
          }
        };
        Selection2.prototype.selectAll = function() {
          this.$setSelection(0, 0, Number.MAX_VALUE, Number.MAX_VALUE);
        };
        Selection2.prototype.setRange = function(range3, reverse) {
          var start2 = reverse ? range3.end : range3.start;
          var end2 = reverse ? range3.start : range3.end;
          this.$setSelection(start2.row, start2.column, end2.row, end2.column);
        };
        Selection2.prototype.$setSelection = function(anchorRow, anchorColumn, cursorRow, cursorColumn) {
          if (this.$silent)
            return;
          var wasEmpty = this.$isEmpty;
          var wasMultiselect = this.inMultiSelectMode;
          this.$silent = true;
          this.$cursorChanged = this.$anchorChanged = false;
          this.anchor.setPosition(anchorRow, anchorColumn);
          this.cursor.setPosition(cursorRow, cursorColumn);
          this.$isEmpty = !Range2.comparePoints(this.anchor, this.cursor);
          this.$silent = false;
          if (this.$cursorChanged)
            this._emit("changeCursor");
          if (this.$cursorChanged || this.$anchorChanged || wasEmpty != this.$isEmpty || wasMultiselect)
            this._emit("changeSelection");
        };
        Selection2.prototype.$moveSelection = function(mover) {
          var lead = this.lead;
          if (this.$isEmpty)
            this.setSelectionAnchor(lead.row, lead.column);
          mover.call(this);
        };
        Selection2.prototype.selectTo = function(row, column2) {
          this.$moveSelection(function() {
            this.moveCursorTo(row, column2);
          });
        };
        Selection2.prototype.selectToPosition = function(pos) {
          this.$moveSelection(function() {
            this.moveCursorToPosition(pos);
          });
        };
        Selection2.prototype.moveTo = function(row, column2) {
          this.clearSelection();
          this.moveCursorTo(row, column2);
        };
        Selection2.prototype.moveToPosition = function(pos) {
          this.clearSelection();
          this.moveCursorToPosition(pos);
        };
        Selection2.prototype.selectUp = function() {
          this.$moveSelection(this.moveCursorUp);
        };
        Selection2.prototype.selectDown = function() {
          this.$moveSelection(this.moveCursorDown);
        };
        Selection2.prototype.selectRight = function() {
          this.$moveSelection(this.moveCursorRight);
        };
        Selection2.prototype.selectLeft = function() {
          this.$moveSelection(this.moveCursorLeft);
        };
        Selection2.prototype.selectLineStart = function() {
          this.$moveSelection(this.moveCursorLineStart);
        };
        Selection2.prototype.selectLineEnd = function() {
          this.$moveSelection(this.moveCursorLineEnd);
        };
        Selection2.prototype.selectFileEnd = function() {
          this.$moveSelection(this.moveCursorFileEnd);
        };
        Selection2.prototype.selectFileStart = function() {
          this.$moveSelection(this.moveCursorFileStart);
        };
        Selection2.prototype.selectWordRight = function() {
          this.$moveSelection(this.moveCursorWordRight);
        };
        Selection2.prototype.selectWordLeft = function() {
          this.$moveSelection(this.moveCursorWordLeft);
        };
        Selection2.prototype.getWordRange = function(row, column2) {
          if (typeof column2 == "undefined") {
            var cursor = row || this.lead;
            row = cursor.row;
            column2 = cursor.column;
          }
          return this.session.getWordRange(row, column2);
        };
        Selection2.prototype.selectWord = function() {
          this.setSelectionRange(this.getWordRange());
        };
        Selection2.prototype.selectAWord = function() {
          var cursor = this.getCursor();
          var range3 = this.session.getAWordRange(cursor.row, cursor.column);
          this.setSelectionRange(range3);
        };
        Selection2.prototype.getLineRange = function(row, excludeLastChar) {
          var rowStart = typeof row == "number" ? row : this.lead.row;
          var rowEnd;
          var foldLine = this.session.getFoldLine(rowStart);
          if (foldLine) {
            rowStart = foldLine.start.row;
            rowEnd = foldLine.end.row;
          } else {
            rowEnd = rowStart;
          }
          if (excludeLastChar === true)
            return new Range2(rowStart, 0, rowEnd, this.session.getLine(rowEnd).length);
          else
            return new Range2(rowStart, 0, rowEnd + 1, 0);
        };
        Selection2.prototype.selectLine = function() {
          this.setSelectionRange(this.getLineRange());
        };
        Selection2.prototype.moveCursorUp = function() {
          this.moveCursorBy(-1, 0);
        };
        Selection2.prototype.moveCursorDown = function() {
          this.moveCursorBy(1, 0);
        };
        Selection2.prototype.wouldMoveIntoSoftTab = function(cursor, tabSize, direction) {
          var start2 = cursor.column;
          var end2 = cursor.column + tabSize;
          if (direction < 0) {
            start2 = cursor.column - tabSize;
            end2 = cursor.column;
          }
          return this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(start2, end2).split(" ").length - 1 == tabSize;
        };
        Selection2.prototype.moveCursorLeft = function() {
          var cursor = this.lead.getPosition(), fold;
          if (fold = this.session.getFoldAt(cursor.row, cursor.column, -1)) {
            this.moveCursorTo(fold.start.row, fold.start.column);
          } else if (cursor.column === 0) {
            if (cursor.row > 0) {
              this.moveCursorTo(cursor.row - 1, this.doc.getLine(cursor.row - 1).length);
            }
          } else {
            var tabSize = this.session.getTabSize();
            if (this.wouldMoveIntoSoftTab(cursor, tabSize, -1) && !this.session.getNavigateWithinSoftTabs()) {
              this.moveCursorBy(0, -tabSize);
            } else {
              this.moveCursorBy(0, -1);
            }
          }
        };
        Selection2.prototype.moveCursorRight = function() {
          var cursor = this.lead.getPosition(), fold;
          if (fold = this.session.getFoldAt(cursor.row, cursor.column, 1)) {
            this.moveCursorTo(fold.end.row, fold.end.column);
          } else if (this.lead.column == this.doc.getLine(this.lead.row).length) {
            if (this.lead.row < this.doc.getLength() - 1) {
              this.moveCursorTo(this.lead.row + 1, 0);
            }
          } else {
            var tabSize = this.session.getTabSize();
            var cursor = this.lead;
            if (this.wouldMoveIntoSoftTab(cursor, tabSize, 1) && !this.session.getNavigateWithinSoftTabs()) {
              this.moveCursorBy(0, tabSize);
            } else {
              this.moveCursorBy(0, 1);
            }
          }
        };
        Selection2.prototype.moveCursorLineStart = function() {
          var row = this.lead.row;
          var column2 = this.lead.column;
          var screenRow = this.session.documentToScreenRow(row, column2);
          var firstColumnPosition = this.session.screenToDocumentPosition(screenRow, 0);
          var beforeCursor = this.session.getDisplayLine(row, null, firstColumnPosition.row, firstColumnPosition.column);
          var leadingSpace = beforeCursor.match(/^\s*/);
          if (leadingSpace[0].length != column2 && !this.session.$useEmacsStyleLineStart)
            firstColumnPosition.column += leadingSpace[0].length;
          this.moveCursorToPosition(firstColumnPosition);
        };
        Selection2.prototype.moveCursorLineEnd = function() {
          var lead = this.lead;
          var lineEnd = this.session.getDocumentLastRowColumnPosition(lead.row, lead.column);
          if (this.lead.column == lineEnd.column) {
            var line2 = this.session.getLine(lineEnd.row);
            if (lineEnd.column == line2.length) {
              var textEnd = line2.search(/\s+$/);
              if (textEnd > 0)
                lineEnd.column = textEnd;
            }
          }
          this.moveCursorTo(lineEnd.row, lineEnd.column);
        };
        Selection2.prototype.moveCursorFileEnd = function() {
          var row = this.doc.getLength() - 1;
          var column2 = this.doc.getLine(row).length;
          this.moveCursorTo(row, column2);
        };
        Selection2.prototype.moveCursorFileStart = function() {
          this.moveCursorTo(0, 0);
        };
        Selection2.prototype.moveCursorLongWordRight = function() {
          var row = this.lead.row;
          var column2 = this.lead.column;
          var line2 = this.doc.getLine(row);
          var rightOfCursor = line2.substring(column2);
          this.session.nonTokenRe.lastIndex = 0;
          this.session.tokenRe.lastIndex = 0;
          var fold = this.session.getFoldAt(row, column2, 1);
          if (fold) {
            this.moveCursorTo(fold.end.row, fold.end.column);
            return;
          }
          if (this.session.nonTokenRe.exec(rightOfCursor)) {
            column2 += this.session.nonTokenRe.lastIndex;
            this.session.nonTokenRe.lastIndex = 0;
            rightOfCursor = line2.substring(column2);
          }
          if (column2 >= line2.length) {
            this.moveCursorTo(row, line2.length);
            this.moveCursorRight();
            if (row < this.doc.getLength() - 1)
              this.moveCursorWordRight();
            return;
          }
          if (this.session.tokenRe.exec(rightOfCursor)) {
            column2 += this.session.tokenRe.lastIndex;
            this.session.tokenRe.lastIndex = 0;
          }
          this.moveCursorTo(row, column2);
        };
        Selection2.prototype.moveCursorLongWordLeft = function() {
          var row = this.lead.row;
          var column2 = this.lead.column;
          var fold;
          if (fold = this.session.getFoldAt(row, column2, -1)) {
            this.moveCursorTo(fold.start.row, fold.start.column);
            return;
          }
          var str = this.session.getFoldStringAt(row, column2, -1);
          if (str == null) {
            str = this.doc.getLine(row).substring(0, column2);
          }
          var leftOfCursor = lang2.stringReverse(str);
          this.session.nonTokenRe.lastIndex = 0;
          this.session.tokenRe.lastIndex = 0;
          if (this.session.nonTokenRe.exec(leftOfCursor)) {
            column2 -= this.session.nonTokenRe.lastIndex;
            leftOfCursor = leftOfCursor.slice(this.session.nonTokenRe.lastIndex);
            this.session.nonTokenRe.lastIndex = 0;
          }
          if (column2 <= 0) {
            this.moveCursorTo(row, 0);
            this.moveCursorLeft();
            if (row > 0)
              this.moveCursorWordLeft();
            return;
          }
          if (this.session.tokenRe.exec(leftOfCursor)) {
            column2 -= this.session.tokenRe.lastIndex;
            this.session.tokenRe.lastIndex = 0;
          }
          this.moveCursorTo(row, column2);
        };
        Selection2.prototype.$shortWordEndIndex = function(rightOfCursor) {
          var index2 = 0, ch2;
          var whitespaceRe = /\s/;
          var tokenRe = this.session.tokenRe;
          tokenRe.lastIndex = 0;
          if (this.session.tokenRe.exec(rightOfCursor)) {
            index2 = this.session.tokenRe.lastIndex;
          } else {
            while ((ch2 = rightOfCursor[index2]) && whitespaceRe.test(ch2))
              index2++;
            if (index2 < 1) {
              tokenRe.lastIndex = 0;
              while ((ch2 = rightOfCursor[index2]) && !tokenRe.test(ch2)) {
                tokenRe.lastIndex = 0;
                index2++;
                if (whitespaceRe.test(ch2)) {
                  if (index2 > 2) {
                    index2--;
                    break;
                  } else {
                    while ((ch2 = rightOfCursor[index2]) && whitespaceRe.test(ch2))
                      index2++;
                    if (index2 > 2)
                      break;
                  }
                }
              }
            }
          }
          tokenRe.lastIndex = 0;
          return index2;
        };
        Selection2.prototype.moveCursorShortWordRight = function() {
          var row = this.lead.row;
          var column2 = this.lead.column;
          var line2 = this.doc.getLine(row);
          var rightOfCursor = line2.substring(column2);
          var fold = this.session.getFoldAt(row, column2, 1);
          if (fold)
            return this.moveCursorTo(fold.end.row, fold.end.column);
          if (column2 == line2.length) {
            var l2 = this.doc.getLength();
            do {
              row++;
              rightOfCursor = this.doc.getLine(row);
            } while (row < l2 && /^\s*$/.test(rightOfCursor));
            if (!/^\s+/.test(rightOfCursor))
              rightOfCursor = "";
            column2 = 0;
          }
          var index2 = this.$shortWordEndIndex(rightOfCursor);
          this.moveCursorTo(row, column2 + index2);
        };
        Selection2.prototype.moveCursorShortWordLeft = function() {
          var row = this.lead.row;
          var column2 = this.lead.column;
          var fold;
          if (fold = this.session.getFoldAt(row, column2, -1))
            return this.moveCursorTo(fold.start.row, fold.start.column);
          var line2 = this.session.getLine(row).substring(0, column2);
          if (column2 === 0) {
            do {
              row--;
              line2 = this.doc.getLine(row);
            } while (row > 0 && /^\s*$/.test(line2));
            column2 = line2.length;
            if (!/\s+$/.test(line2))
              line2 = "";
          }
          var leftOfCursor = lang2.stringReverse(line2);
          var index2 = this.$shortWordEndIndex(leftOfCursor);
          return this.moveCursorTo(row, column2 - index2);
        };
        Selection2.prototype.moveCursorWordRight = function() {
          if (this.session.$selectLongWords)
            this.moveCursorLongWordRight();
          else
            this.moveCursorShortWordRight();
        };
        Selection2.prototype.moveCursorWordLeft = function() {
          if (this.session.$selectLongWords)
            this.moveCursorLongWordLeft();
          else
            this.moveCursorShortWordLeft();
        };
        Selection2.prototype.moveCursorBy = function(rows, chars2) {
          var screenPos = this.session.documentToScreenPosition(this.lead.row, this.lead.column);
          var offsetX;
          if (chars2 === 0) {
            if (rows !== 0) {
              if (this.session.$bidiHandler.isBidiRow(screenPos.row, this.lead.row)) {
                offsetX = this.session.$bidiHandler.getPosLeft(screenPos.column);
                screenPos.column = Math.round(offsetX / this.session.$bidiHandler.charWidths[0]);
              } else {
                offsetX = screenPos.column * this.session.$bidiHandler.charWidths[0];
              }
            }
            if (this.$desiredColumn)
              screenPos.column = this.$desiredColumn;
            else
              this.$desiredColumn = screenPos.column;
          }
          if (rows != 0 && this.session.lineWidgets && this.session.lineWidgets[this.lead.row]) {
            var widget = this.session.lineWidgets[this.lead.row];
            if (rows < 0)
              rows -= widget.rowsAbove || 0;
            else if (rows > 0)
              rows += widget.rowCount - (widget.rowsAbove || 0);
          }
          var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenPos.column, offsetX);
          if (rows !== 0 && chars2 === 0 && docPos.row === this.lead.row && docPos.column === this.lead.column)
            ;
          this.moveCursorTo(docPos.row, docPos.column + chars2, chars2 === 0);
        };
        Selection2.prototype.moveCursorToPosition = function(position2) {
          this.moveCursorTo(position2.row, position2.column);
        };
        Selection2.prototype.moveCursorTo = function(row, column2, keepDesiredColumn) {
          var fold = this.session.getFoldAt(row, column2, 1);
          if (fold) {
            row = fold.start.row;
            column2 = fold.start.column;
          }
          this.$keepDesiredColumnOnChange = true;
          var line2 = this.session.getLine(row);
          if (/[\uDC00-\uDFFF]/.test(line2.charAt(column2)) && line2.charAt(column2 - 1)) {
            if (this.lead.row == row && this.lead.column == column2 + 1)
              column2 = column2 - 1;
            else
              column2 = column2 + 1;
          }
          this.lead.setPosition(row, column2);
          this.$keepDesiredColumnOnChange = false;
          if (!keepDesiredColumn)
            this.$desiredColumn = null;
        };
        Selection2.prototype.moveCursorToScreen = function(row, column2, keepDesiredColumn) {
          var pos = this.session.screenToDocumentPosition(row, column2);
          this.moveCursorTo(pos.row, pos.column, keepDesiredColumn);
        };
        Selection2.prototype.detach = function() {
          this.lead.detach();
          this.anchor.detach();
        };
        Selection2.prototype.fromOrientedRange = function(range3) {
          this.setSelectionRange(range3, range3.cursor == range3.start);
          this.$desiredColumn = range3.desiredColumn || this.$desiredColumn;
        };
        Selection2.prototype.toOrientedRange = function(range3) {
          var r2 = this.getRange();
          if (range3) {
            range3.start.column = r2.start.column;
            range3.start.row = r2.start.row;
            range3.end.column = r2.end.column;
            range3.end.row = r2.end.row;
          } else {
            range3 = r2;
          }
          range3.cursor = this.isBackwards() ? range3.start : range3.end;
          range3.desiredColumn = this.$desiredColumn;
          return range3;
        };
        Selection2.prototype.getRangeOfMovements = function(func) {
          var start2 = this.getCursor();
          try {
            func(this);
            var end2 = this.getCursor();
            return Range2.fromPoints(start2, end2);
          } catch (e2) {
            return Range2.fromPoints(start2, start2);
          } finally {
            this.moveCursorToPosition(start2);
          }
        };
        Selection2.prototype.toJSON = function() {
          if (this.rangeCount) {
            var data = this.ranges.map(function(r2) {
              var r1 = r2.clone();
              r1.isBackwards = r2.cursor == r2.start;
              return r1;
            });
          } else {
            var data = this.getRange();
            data.isBackwards = this.isBackwards();
          }
          return data;
        };
        Selection2.prototype.fromJSON = function(data) {
          if (data.start == void 0) {
            if (this.rangeList && data.length > 1) {
              this.toSingleRange(data[0]);
              for (var i2 = data.length; i2--; ) {
                var r2 = Range2.fromPoints(data[i2].start, data[i2].end);
                if (data[i2].isBackwards)
                  r2.cursor = r2.start;
                this.addRange(r2, true);
              }
              return;
            } else {
              data = data[0];
            }
          }
          if (this.rangeList)
            this.toSingleRange(data);
          this.setSelectionRange(data, data.isBackwards);
        };
        Selection2.prototype.isEqual = function(data) {
          if ((data.length || this.rangeCount) && data.length != this.rangeCount)
            return false;
          if (!data.length || !this.ranges)
            return this.getRange().isEqual(data);
          for (var i2 = this.ranges.length; i2--; ) {
            if (!this.ranges[i2].isEqual(data[i2]))
              return false;
          }
          return true;
        };
        return Selection2;
      }()
    );
    Selection.prototype.setSelectionAnchor = Selection.prototype.setAnchor;
    Selection.prototype.getSelectionAnchor = Selection.prototype.getAnchor;
    Selection.prototype.setSelectionRange = Selection.prototype.setRange;
    oop.implement(Selection.prototype, EventEmitter2);
    exports3.Selection = Selection;
  });
  ace.define("ace/tokenizer", ["require", "exports", "module", "ace/lib/report_error"], function(require2, exports3, module3) {
    var reportError2 = require2("./lib/report_error").reportError;
    var MAX_TOKEN_COUNT = 2e3;
    var Tokenizer = (
      /** @class */
      function() {
        function Tokenizer2(rules2) {
          this.splitRegex;
          this.states = rules2;
          this.regExps = {};
          this.matchMappings = {};
          for (var key in this.states) {
            var state = this.states[key];
            var ruleRegExps = [];
            var matchTotal = 0;
            var mapping = this.matchMappings[key] = { defaultToken: "text" };
            var flag = "g";
            var splitterRurles = [];
            for (var i2 = 0; i2 < state.length; i2++) {
              var rule = state[i2];
              if (rule.defaultToken)
                mapping.defaultToken = rule.defaultToken;
              if (rule.caseInsensitive && flag.indexOf("i") === -1)
                flag += "i";
              if (rule.unicode && flag.indexOf("u") === -1)
                flag += "u";
              if (rule.regex == null)
                continue;
              if (rule.regex instanceof RegExp)
                rule.regex = rule.regex.toString().slice(1, -1);
              var adjustedregex = rule.regex;
              var matchcount = new RegExp("(?:(" + adjustedregex + ")|(.))").exec("a").length - 2;
              if (Array.isArray(rule.token)) {
                if (rule.token.length == 1 || matchcount == 1) {
                  rule.token = rule.token[0];
                } else if (matchcount - 1 != rule.token.length) {
                  this.reportError("number of classes and regexp groups doesn't match", {
                    rule,
                    groupCount: matchcount - 1
                  });
                  rule.token = rule.token[0];
                } else {
                  rule.tokenArray = rule.token;
                  rule.token = null;
                  rule.onMatch = this.$arrayTokens;
                }
              } else if (typeof rule.token == "function" && !rule.onMatch) {
                if (matchcount > 1)
                  rule.onMatch = this.$applyToken;
                else
                  rule.onMatch = rule.token;
              }
              if (matchcount > 1) {
                if (/\\\d/.test(rule.regex)) {
                  adjustedregex = rule.regex.replace(/\\([0-9]+)/g, function(match5, digit) {
                    return "\\" + (parseInt(digit, 10) + matchTotal + 1);
                  });
                } else {
                  matchcount = 1;
                  adjustedregex = this.removeCapturingGroups(rule.regex);
                }
                if (!rule.splitRegex && typeof rule.token != "string")
                  splitterRurles.push(rule);
              }
              mapping[matchTotal] = i2;
              matchTotal += matchcount;
              ruleRegExps.push(adjustedregex);
              if (!rule.onMatch)
                rule.onMatch = null;
            }
            if (!ruleRegExps.length) {
              mapping[0] = 0;
              ruleRegExps.push("$");
            }
            splitterRurles.forEach(function(rule2) {
              rule2.splitRegex = this.createSplitterRegexp(rule2.regex, flag);
            }, this);
            this.regExps[key] = new RegExp("(" + ruleRegExps.join(")|(") + ")|($)", flag);
          }
        }
        Tokenizer2.prototype.$setMaxTokenCount = function(m2) {
          MAX_TOKEN_COUNT = m2 | 0;
        };
        Tokenizer2.prototype.$applyToken = function(str) {
          var values = this.splitRegex.exec(str).slice(1);
          var types2 = this.token.apply(this, values);
          if (typeof types2 === "string")
            return [{ type: types2, value: str }];
          var tokens2 = [];
          for (var i2 = 0, l2 = types2.length; i2 < l2; i2++) {
            if (values[i2])
              tokens2[tokens2.length] = {
                type: types2[i2],
                value: values[i2]
              };
          }
          return tokens2;
        };
        Tokenizer2.prototype.$arrayTokens = function(str) {
          if (!str)
            return [];
          var values = this.splitRegex.exec(str);
          if (!values)
            return "text";
          var tokens2 = [];
          var types2 = this.tokenArray;
          for (var i2 = 0, l2 = types2.length; i2 < l2; i2++) {
            if (values[i2 + 1])
              tokens2[tokens2.length] = {
                type: types2[i2],
                value: values[i2 + 1]
              };
          }
          return tokens2;
        };
        Tokenizer2.prototype.removeCapturingGroups = function(src) {
          var r2 = src.replace(/\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!<]|(\()/g, function(x2, y2) {
            return y2 ? "(?:" : x2;
          });
          return r2;
        };
        Tokenizer2.prototype.createSplitterRegexp = function(src, flag) {
          if (src.indexOf("(?=") != -1) {
            var stack = 0;
            var inChClass = false;
            var lastCapture = {};
            src.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g, function(m2, esc, parenOpen, parenClose, square, index2) {
              if (inChClass) {
                inChClass = square != "]";
              } else if (square) {
                inChClass = true;
              } else if (parenClose) {
                if (stack == lastCapture.stack) {
                  lastCapture.end = index2 + 1;
                  lastCapture.stack = -1;
                }
                stack--;
              } else if (parenOpen) {
                stack++;
                if (parenOpen.length != 1) {
                  lastCapture.stack = stack;
                  lastCapture.start = index2;
                }
              }
              return m2;
            });
            if (lastCapture.end != null && /^\)*$/.test(src.substr(lastCapture.end)))
              src = src.substring(0, lastCapture.start) + src.substr(lastCapture.end);
          }
          if (src.charAt(0) != "^")
            src = "^" + src;
          if (src.charAt(src.length - 1) != "$")
            src += "$";
          return new RegExp(src, (flag || "").replace("g", ""));
        };
        Tokenizer2.prototype.getLineTokens = function(line2, startState) {
          if (startState && typeof startState != "string") {
            var stack = startState.slice(0);
            startState = stack[0];
            if (startState === "#tmp") {
              stack.shift();
              startState = stack.shift();
            }
          } else
            var stack = [];
          var currentState = (
            /**@type{string}*/
            startState || "start"
          );
          var state = this.states[currentState];
          if (!state) {
            currentState = "start";
            state = this.states[currentState];
          }
          var mapping = this.matchMappings[currentState];
          var re2 = this.regExps[currentState];
          re2.lastIndex = 0;
          var match5, tokens2 = [];
          var lastIndex = 0;
          var matchAttempts = 0;
          var token2 = { type: null, value: "" };
          while (match5 = re2.exec(line2)) {
            var type4 = mapping.defaultToken;
            var rule = null;
            var value2 = match5[0];
            var index2 = re2.lastIndex;
            if (index2 - value2.length > lastIndex) {
              var skipped = line2.substring(lastIndex, index2 - value2.length);
              if (token2.type == type4) {
                token2.value += skipped;
              } else {
                if (token2.type)
                  tokens2.push(token2);
                token2 = { type: type4, value: skipped };
              }
            }
            for (var i2 = 0; i2 < match5.length - 2; i2++) {
              if (match5[i2 + 1] === void 0)
                continue;
              rule = state[mapping[i2]];
              if (rule.onMatch)
                type4 = rule.onMatch(value2, currentState, stack, line2);
              else
                type4 = rule.token;
              if (rule.next) {
                if (typeof rule.next == "string") {
                  currentState = rule.next;
                } else {
                  currentState = rule.next(currentState, stack);
                }
                state = this.states[currentState];
                if (!state) {
                  this.reportError("state doesn't exist", currentState);
                  currentState = "start";
                  state = this.states[currentState];
                }
                mapping = this.matchMappings[currentState];
                lastIndex = index2;
                re2 = this.regExps[currentState];
                re2.lastIndex = index2;
              }
              if (rule.consumeLineEnd)
                lastIndex = index2;
              break;
            }
            if (value2) {
              if (typeof type4 === "string") {
                if ((!rule || rule.merge !== false) && token2.type === type4) {
                  token2.value += value2;
                } else {
                  if (token2.type)
                    tokens2.push(token2);
                  token2 = { type: type4, value: value2 };
                }
              } else if (type4) {
                if (token2.type)
                  tokens2.push(token2);
                token2 = { type: null, value: "" };
                for (var i2 = 0; i2 < type4.length; i2++)
                  tokens2.push(type4[i2]);
              }
            }
            if (lastIndex == line2.length)
              break;
            lastIndex = index2;
            if (matchAttempts++ > MAX_TOKEN_COUNT) {
              if (matchAttempts > 2 * line2.length) {
                this.reportError("infinite loop with in ace tokenizer", {
                  startState,
                  line: line2
                });
              }
              while (lastIndex < line2.length) {
                if (token2.type)
                  tokens2.push(token2);
                token2 = {
                  value: line2.substring(lastIndex, lastIndex += 500),
                  type: "overflow"
                };
              }
              currentState = "start";
              stack = [];
              break;
            }
          }
          if (token2.type)
            tokens2.push(token2);
          if (stack.length > 1) {
            if (stack[0] !== currentState)
              stack.unshift("#tmp", currentState);
          }
          return {
            tokens: tokens2,
            state: stack.length ? stack : currentState
          };
        };
        return Tokenizer2;
      }()
    );
    Tokenizer.prototype.reportError = reportError2;
    exports3.Tokenizer = Tokenizer;
  });
  ace.define("ace/mode/text_highlight_rules", ["require", "exports", "module", "ace/lib/deep_copy"], function(require2, exports3, module3) {
    var deepCopy = require2("../lib/deep_copy").deepCopy;
    var TextHighlightRules;
    TextHighlightRules = function() {
      this.$rules = {
        "start": [{
          token: "empty_line",
          regex: "^$"
        }, {
          defaultToken: "text"
        }]
      };
    };
    (function() {
      this.addRules = function(rules2, prefix) {
        if (!prefix) {
          for (var key in rules2)
            this.$rules[key] = rules2[key];
          return;
        }
        for (var key in rules2) {
          var state = rules2[key];
          for (var i2 = 0; i2 < state.length; i2++) {
            var rule = state[i2];
            if (rule.next || rule.onMatch) {
              if (typeof rule.next == "string") {
                if (rule.next.indexOf(prefix) !== 0)
                  rule.next = prefix + rule.next;
              }
              if (rule.nextState && rule.nextState.indexOf(prefix) !== 0)
                rule.nextState = prefix + rule.nextState;
            }
          }
          this.$rules[prefix + key] = state;
        }
      };
      this.getRules = function() {
        return this.$rules;
      };
      this.embedRules = function(HighlightRules, prefix, escapeRules, states, append3) {
        var embedRules = typeof HighlightRules == "function" ? new HighlightRules().getRules() : HighlightRules;
        if (states) {
          for (var i2 = 0; i2 < states.length; i2++)
            states[i2] = prefix + states[i2];
        } else {
          states = [];
          for (var key in embedRules)
            states.push(prefix + key);
        }
        this.addRules(embedRules, prefix);
        if (escapeRules) {
          var addRules = Array.prototype[append3 ? "push" : "unshift"];
          for (var i2 = 0; i2 < states.length; i2++)
            addRules.apply(this.$rules[states[i2]], deepCopy(escapeRules));
        }
        if (!this.$embeds)
          this.$embeds = [];
        this.$embeds.push(prefix);
      };
      this.getEmbeds = function() {
        return this.$embeds;
      };
      var pushState = function(currentState, stack) {
        if (currentState != "start" || stack.length)
          stack.unshift(this.nextState, currentState);
        return this.nextState;
      };
      var popState = function(currentState, stack) {
        stack.shift();
        return stack.shift() || "start";
      };
      this.normalizeRules = function() {
        var id2 = 0;
        var rules2 = this.$rules;
        function processState(key) {
          var state = rules2[key];
          state["processed"] = true;
          for (var i2 = 0; i2 < state.length; i2++) {
            var rule = state[i2];
            var toInsert = null;
            if (Array.isArray(rule)) {
              toInsert = rule;
              rule = {};
            }
            if (!rule.regex && rule.start) {
              rule.regex = rule.start;
              if (!rule.next)
                rule.next = [];
              rule.next.push({
                defaultToken: rule.token
              }, {
                token: rule.token + ".end",
                regex: rule.end || rule.start,
                next: "pop"
              });
              rule.token = rule.token + ".start";
              rule.push = true;
            }
            var next2 = rule.next || rule.push;
            if (next2 && Array.isArray(next2)) {
              var stateName = rule.stateName;
              if (!stateName) {
                stateName = rule.token;
                if (typeof stateName != "string")
                  stateName = stateName[0] || "";
                if (rules2[stateName])
                  stateName += id2++;
              }
              rules2[stateName] = next2;
              rule.next = stateName;
              processState(stateName);
            } else if (next2 == "pop") {
              rule.next = popState;
            }
            if (rule.push) {
              rule.nextState = rule.next || rule.push;
              rule.next = pushState;
              delete rule.push;
            }
            if (rule.rules) {
              for (var r2 in rule.rules) {
                if (rules2[r2]) {
                  if (rules2[r2].push)
                    rules2[r2].push.apply(rules2[r2], rule.rules[r2]);
                } else {
                  rules2[r2] = rule.rules[r2];
                }
              }
            }
            var includeName = typeof rule == "string" ? rule : rule.include;
            if (includeName) {
              if (includeName === "$self")
                includeName = "start";
              if (Array.isArray(includeName))
                toInsert = includeName.map(function(x2) {
                  return rules2[x2];
                });
              else
                toInsert = rules2[includeName];
            }
            if (toInsert) {
              var args = [i2, 1].concat(toInsert);
              if (rule.noEscape)
                args = args.filter(function(x2) {
                  return !x2.next;
                });
              state.splice.apply(state, args);
              i2--;
            }
            if (rule.keywordMap) {
              rule.token = this.createKeywordMapper(rule.keywordMap, rule.defaultToken || "text", rule.caseInsensitive);
              delete rule.defaultToken;
            }
          }
        }
        Object.keys(rules2).forEach(processState, this);
      };
      this.createKeywordMapper = function(map2, defaultToken, ignoreCase, splitChar) {
        var keywords = /* @__PURE__ */ Object.create(null);
        this.$keywordList = [];
        Object.keys(map2).forEach(function(className) {
          var a2 = map2[className];
          var list2 = a2.split(splitChar || "|");
          for (var i2 = list2.length; i2--; ) {
            var word = list2[i2];
            this.$keywordList.push(word);
            if (ignoreCase)
              word = word.toLowerCase();
            keywords[word] = className;
          }
        }, this);
        map2 = null;
        return ignoreCase ? function(value2) {
          return keywords[value2.toLowerCase()] || defaultToken;
        } : function(value2) {
          return keywords[value2] || defaultToken;
        };
      };
      this.getKeywords = function() {
        return this.$keywords;
      };
    }).call(TextHighlightRules.prototype);
    exports3.TextHighlightRules = TextHighlightRules;
  });
  ace.define("ace/mode/behaviour", ["require", "exports", "module"], function(require2, exports3, module3) {
    var Behaviour;
    Behaviour = function() {
      this.$behaviours = {};
    };
    (function() {
      this.add = function(name2, action, callback2) {
        switch (void 0) {
          case this.$behaviours:
            this.$behaviours = {};
          case this.$behaviours[name2]:
            this.$behaviours[name2] = {};
        }
        this.$behaviours[name2][action] = callback2;
      };
      this.addBehaviours = function(behaviours) {
        for (var key in behaviours) {
          for (var action in behaviours[key]) {
            this.add(key, action, behaviours[key][action]);
          }
        }
      };
      this.remove = function(name2) {
        if (this.$behaviours && this.$behaviours[name2]) {
          delete this.$behaviours[name2];
        }
      };
      this.inherit = function(mode, filter3) {
        if (typeof mode === "function") {
          var behaviours = new mode().getBehaviours(filter3);
        } else {
          var behaviours = mode.getBehaviours(filter3);
        }
        this.addBehaviours(behaviours);
      };
      this.getBehaviours = function(filter3) {
        if (!filter3) {
          return this.$behaviours;
        } else {
          var ret = {};
          for (var i2 = 0; i2 < filter3.length; i2++) {
            if (this.$behaviours[filter3[i2]]) {
              ret[filter3[i2]] = this.$behaviours[filter3[i2]];
            }
          }
          return ret;
        }
      };
    }).call(Behaviour.prototype);
    exports3.Behaviour = Behaviour;
  });
  ace.define("ace/token_iterator", ["require", "exports", "module", "ace/range"], function(require2, exports3, module3) {
    var Range2 = require2("./range").Range;
    var TokenIterator = (
      /** @class */
      function() {
        function TokenIterator2(session, initialRow, initialColumn) {
          this.$session = session;
          this.$row = initialRow;
          this.$rowTokens = session.getTokens(initialRow);
          var token2 = session.getTokenAt(initialRow, initialColumn);
          this.$tokenIndex = token2 ? token2.index : -1;
        }
        TokenIterator2.prototype.stepBackward = function() {
          this.$tokenIndex -= 1;
          while (this.$tokenIndex < 0) {
            this.$row -= 1;
            if (this.$row < 0) {
              this.$row = 0;
              return null;
            }
            this.$rowTokens = this.$session.getTokens(this.$row);
            this.$tokenIndex = this.$rowTokens.length - 1;
          }
          return this.$rowTokens[this.$tokenIndex];
        };
        TokenIterator2.prototype.stepForward = function() {
          this.$tokenIndex += 1;
          var rowCount;
          while (this.$tokenIndex >= this.$rowTokens.length) {
            this.$row += 1;
            if (!rowCount)
              rowCount = this.$session.getLength();
            if (this.$row >= rowCount) {
              this.$row = rowCount - 1;
              return null;
            }
            this.$rowTokens = this.$session.getTokens(this.$row);
            this.$tokenIndex = 0;
          }
          return this.$rowTokens[this.$tokenIndex];
        };
        TokenIterator2.prototype.getCurrentToken = function() {
          return this.$rowTokens[this.$tokenIndex];
        };
        TokenIterator2.prototype.getCurrentTokenRow = function() {
          return this.$row;
        };
        TokenIterator2.prototype.getCurrentTokenColumn = function() {
          var rowTokens = this.$rowTokens;
          var tokenIndex = this.$tokenIndex;
          var column2 = rowTokens[tokenIndex].start;
          if (column2 !== void 0)
            return column2;
          column2 = 0;
          while (tokenIndex > 0) {
            tokenIndex -= 1;
            column2 += rowTokens[tokenIndex].value.length;
          }
          return column2;
        };
        TokenIterator2.prototype.getCurrentTokenPosition = function() {
          return { row: this.$row, column: this.getCurrentTokenColumn() };
        };
        TokenIterator2.prototype.getCurrentTokenRange = function() {
          var token2 = this.$rowTokens[this.$tokenIndex];
          var column2 = this.getCurrentTokenColumn();
          return new Range2(this.$row, column2, this.$row, column2 + token2.value.length);
        };
        return TokenIterator2;
      }()
    );
    exports3.TokenIterator = TokenIterator;
  });
  ace.define("ace/mode/behaviour/cstyle", ["require", "exports", "module", "ace/lib/oop", "ace/mode/behaviour", "ace/token_iterator", "ace/lib/lang"], function(require2, exports3, module3) {
    var oop = require2("../../lib/oop");
    var Behaviour = require2("../behaviour").Behaviour;
    var TokenIterator = require2("../../token_iterator").TokenIterator;
    var lang2 = require2("../../lib/lang");
    var SAFE_INSERT_IN_TOKENS = ["text", "paren.rparen", "rparen", "paren", "punctuation.operator"];
    var SAFE_INSERT_BEFORE_TOKENS = ["text", "paren.rparen", "rparen", "paren", "punctuation.operator", "comment"];
    var context;
    var contextCache = {};
    var defaultQuotes = { '"': '"', "'": "'" };
    var initContext = function(editor2) {
      var id2 = -1;
      if (editor2.multiSelect) {
        id2 = editor2.selection.index;
        if (contextCache.rangeCount != editor2.multiSelect.rangeCount)
          contextCache = { rangeCount: editor2.multiSelect.rangeCount };
      }
      if (contextCache[id2])
        return context = contextCache[id2];
      context = contextCache[id2] = {
        autoInsertedBrackets: 0,
        autoInsertedRow: -1,
        autoInsertedLineEnd: "",
        maybeInsertedBrackets: 0,
        maybeInsertedRow: -1,
        maybeInsertedLineStart: "",
        maybeInsertedLineEnd: ""
      };
    };
    var getWrapped = function(selection, selected, opening, closing) {
      var rowDiff = selection.end.row - selection.start.row;
      return {
        text: opening + selected + closing,
        selection: [
          0,
          selection.start.column + 1,
          rowDiff,
          selection.end.column + (rowDiff ? 0 : 1)
        ]
      };
    };
    var CstyleBehaviour;
    CstyleBehaviour = function(options) {
      options = options || {};
      this.add("braces", "insertion", function(state, action, editor2, session, text2) {
        var cursor = editor2.getCursorPosition();
        var line2 = session.doc.getLine(cursor.row);
        if (text2 == "{") {
          initContext(editor2);
          var selection = editor2.getSelectionRange();
          var selected = session.doc.getTextRange(selection);
          var token2 = session.getTokenAt(cursor.row, cursor.column);
          if (selected !== "" && selected !== "{" && editor2.getWrapBehavioursEnabled()) {
            return getWrapped(selection, selected, "{", "}");
          } else if (token2 && /(?:string)\.quasi|\.xml/.test(token2.type)) {
            var excludeTokens = [
              /tag\-(?:open|name)/,
              /attribute\-name/
            ];
            if (excludeTokens.some(function(el2) {
              return el2.test(token2.type);
            }) || /(string)\.quasi/.test(token2.type) && token2.value[cursor.column - token2.start - 1] !== "$")
              return;
            CstyleBehaviour.recordAutoInsert(editor2, session, "}");
            return {
              text: "{}",
              selection: [1, 1]
            };
          } else if (CstyleBehaviour.isSaneInsertion(editor2, session)) {
            if (/[\]\}\)]/.test(line2[cursor.column]) || editor2.inMultiSelectMode || options.braces) {
              CstyleBehaviour.recordAutoInsert(editor2, session, "}");
              return {
                text: "{}",
                selection: [1, 1]
              };
            } else {
              CstyleBehaviour.recordMaybeInsert(editor2, session, "{");
              return {
                text: "{",
                selection: [1, 1]
              };
            }
          }
        } else if (text2 == "}") {
          initContext(editor2);
          var rightChar = line2.substring(cursor.column, cursor.column + 1);
          if (rightChar == "}") {
            var matching = session.$findOpeningBracket("}", { column: cursor.column + 1, row: cursor.row });
            if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line2, text2)) {
              CstyleBehaviour.popAutoInsertedClosing();
              return {
                text: "",
                selection: [1, 1]
              };
            }
          }
        } else if (text2 == "\n" || text2 == "\r\n") {
          initContext(editor2);
          var closing = "";
          if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line2)) {
            closing = lang2.stringRepeat("}", context.maybeInsertedBrackets);
            CstyleBehaviour.clearMaybeInsertedClosing();
          }
          var rightChar = line2.substring(cursor.column, cursor.column + 1);
          if (rightChar === "}") {
            var openBracePos = session.findMatchingBracket({ row: cursor.row, column: cursor.column + 1 }, "}");
            if (!openBracePos)
              return null;
            var next_indent = this.$getIndent(session.getLine(openBracePos.row));
          } else if (closing) {
            var next_indent = this.$getIndent(line2);
          } else {
            CstyleBehaviour.clearMaybeInsertedClosing();
            return;
          }
          var indent = next_indent + session.getTabString();
          return {
            text: "\n" + indent + "\n" + next_indent + closing,
            selection: [1, indent.length, 1, indent.length]
          };
        } else {
          CstyleBehaviour.clearMaybeInsertedClosing();
        }
      });
      this.add("braces", "deletion", function(state, action, editor2, session, range3) {
        var selected = session.doc.getTextRange(range3);
        if (!range3.isMultiLine() && selected == "{") {
          initContext(editor2);
          var line2 = session.doc.getLine(range3.start.row);
          var rightChar = line2.substring(range3.end.column, range3.end.column + 1);
          if (rightChar == "}") {
            range3.end.column++;
            return range3;
          } else {
            context.maybeInsertedBrackets--;
          }
        }
      });
      this.add("parens", "insertion", function(state, action, editor2, session, text2) {
        if (text2 == "(") {
          initContext(editor2);
          var selection = editor2.getSelectionRange();
          var selected = session.doc.getTextRange(selection);
          if (selected !== "" && editor2.getWrapBehavioursEnabled()) {
            return getWrapped(selection, selected, "(", ")");
          } else if (CstyleBehaviour.isSaneInsertion(editor2, session)) {
            CstyleBehaviour.recordAutoInsert(editor2, session, ")");
            return {
              text: "()",
              selection: [1, 1]
            };
          }
        } else if (text2 == ")") {
          initContext(editor2);
          var cursor = editor2.getCursorPosition();
          var line2 = session.doc.getLine(cursor.row);
          var rightChar = line2.substring(cursor.column, cursor.column + 1);
          if (rightChar == ")") {
            var matching = session.$findOpeningBracket(")", { column: cursor.column + 1, row: cursor.row });
            if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line2, text2)) {
              CstyleBehaviour.popAutoInsertedClosing();
              return {
                text: "",
                selection: [1, 1]
              };
            }
          }
        }
      });
      this.add("parens", "deletion", function(state, action, editor2, session, range3) {
        var selected = session.doc.getTextRange(range3);
        if (!range3.isMultiLine() && selected == "(") {
          initContext(editor2);
          var line2 = session.doc.getLine(range3.start.row);
          var rightChar = line2.substring(range3.start.column + 1, range3.start.column + 2);
          if (rightChar == ")") {
            range3.end.column++;
            return range3;
          }
        }
      });
      this.add("brackets", "insertion", function(state, action, editor2, session, text2) {
        if (text2 == "[") {
          initContext(editor2);
          var selection = editor2.getSelectionRange();
          var selected = session.doc.getTextRange(selection);
          if (selected !== "" && editor2.getWrapBehavioursEnabled()) {
            return getWrapped(selection, selected, "[", "]");
          } else if (CstyleBehaviour.isSaneInsertion(editor2, session)) {
            CstyleBehaviour.recordAutoInsert(editor2, session, "]");
            return {
              text: "[]",
              selection: [1, 1]
            };
          }
        } else if (text2 == "]") {
          initContext(editor2);
          var cursor = editor2.getCursorPosition();
          var line2 = session.doc.getLine(cursor.row);
          var rightChar = line2.substring(cursor.column, cursor.column + 1);
          if (rightChar == "]") {
            var matching = session.$findOpeningBracket("]", { column: cursor.column + 1, row: cursor.row });
            if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line2, text2)) {
              CstyleBehaviour.popAutoInsertedClosing();
              return {
                text: "",
                selection: [1, 1]
              };
            }
          }
        }
      });
      this.add("brackets", "deletion", function(state, action, editor2, session, range3) {
        var selected = session.doc.getTextRange(range3);
        if (!range3.isMultiLine() && selected == "[") {
          initContext(editor2);
          var line2 = session.doc.getLine(range3.start.row);
          var rightChar = line2.substring(range3.start.column + 1, range3.start.column + 2);
          if (rightChar == "]") {
            range3.end.column++;
            return range3;
          }
        }
      });
      this.add("string_dquotes", "insertion", function(state, action, editor2, session, text2) {
        var quotes = session.$mode.$quotes || defaultQuotes;
        if (text2.length == 1 && quotes[text2]) {
          if (this.lineCommentStart && this.lineCommentStart.indexOf(text2) != -1)
            return;
          initContext(editor2);
          var quote = text2;
          var selection = editor2.getSelectionRange();
          var selected = session.doc.getTextRange(selection);
          if (selected !== "" && (selected.length != 1 || !quotes[selected]) && editor2.getWrapBehavioursEnabled()) {
            return getWrapped(selection, selected, quote, quote);
          } else if (!selected) {
            var cursor = editor2.getCursorPosition();
            var line2 = session.doc.getLine(cursor.row);
            var leftChar = line2.substring(cursor.column - 1, cursor.column);
            var rightChar = line2.substring(cursor.column, cursor.column + 1);
            var token2 = session.getTokenAt(cursor.row, cursor.column);
            var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
            if (leftChar == "\\" && token2 && /escape/.test(token2.type))
              return null;
            var stringBefore = token2 && /string|escape/.test(token2.type);
            var stringAfter = !rightToken || /string|escape/.test(rightToken.type);
            var pair;
            if (rightChar == quote) {
              pair = stringBefore !== stringAfter;
              if (pair && /string\.end/.test(rightToken.type))
                pair = false;
            } else {
              if (stringBefore && !stringAfter)
                return null;
              if (stringBefore && stringAfter)
                return null;
              var wordRe = session.$mode.tokenRe;
              wordRe.lastIndex = 0;
              var isWordBefore = wordRe.test(leftChar);
              wordRe.lastIndex = 0;
              var isWordAfter = wordRe.test(rightChar);
              var pairQuotesAfter = session.$mode.$pairQuotesAfter;
              var shouldPairQuotes = pairQuotesAfter && pairQuotesAfter[quote] && pairQuotesAfter[quote].test(leftChar);
              if (!shouldPairQuotes && isWordBefore || isWordAfter)
                return null;
              if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
                return null;
              var charBefore = line2[cursor.column - 2];
              if (leftChar == quote && (charBefore == quote || wordRe.test(charBefore)))
                return null;
              pair = true;
            }
            return {
              text: pair ? quote + quote : "",
              selection: [1, 1]
            };
          }
        }
      });
      this.add("string_dquotes", "deletion", function(state, action, editor2, session, range3) {
        var quotes = session.$mode.$quotes || defaultQuotes;
        var selected = session.doc.getTextRange(range3);
        if (!range3.isMultiLine() && quotes.hasOwnProperty(selected)) {
          initContext(editor2);
          var line2 = session.doc.getLine(range3.start.row);
          var rightChar = line2.substring(range3.start.column + 1, range3.start.column + 2);
          if (rightChar == selected) {
            range3.end.column++;
            return range3;
          }
        }
      });
      if (options.closeDocComment !== false) {
        this.add("doc comment end", "insertion", function(state, action, editor2, session, text2) {
          if (state === "doc-start" && (text2 === "\n" || text2 === "\r\n") && editor2.selection.isEmpty()) {
            var cursor = editor2.getCursorPosition();
            if (cursor.column === 0) {
              return;
            }
            var line2 = session.doc.getLine(cursor.row);
            var nextLine = session.doc.getLine(cursor.row + 1);
            var tokens2 = session.getTokens(cursor.row);
            var index2 = 0;
            for (var i2 = 0; i2 < tokens2.length; i2++) {
              index2 += tokens2[i2].value.length;
              var currentToken = tokens2[i2];
              if (index2 >= cursor.column) {
                if (index2 === cursor.column) {
                  if (!/\.doc/.test(currentToken.type)) {
                    return;
                  }
                  if (/\*\//.test(currentToken.value)) {
                    var nextToken = tokens2[i2 + 1];
                    if (!nextToken || !/\.doc/.test(nextToken.type)) {
                      return;
                    }
                  }
                }
                var cursorPosInToken = cursor.column - (index2 - currentToken.value.length);
                var closeDocPos = currentToken.value.indexOf("*/");
                var openDocPos = currentToken.value.indexOf("/**", closeDocPos > -1 ? closeDocPos + 2 : 0);
                if (openDocPos !== -1 && cursorPosInToken > openDocPos && cursorPosInToken < openDocPos + 3) {
                  return;
                }
                if (closeDocPos !== -1 && openDocPos !== -1 && cursorPosInToken >= closeDocPos && cursorPosInToken <= openDocPos || !/\.doc/.test(currentToken.type)) {
                  return;
                }
                break;
              }
            }
            var indent = this.$getIndent(line2);
            if (/\s*\*/.test(nextLine)) {
              if (/^\s*\*/.test(line2)) {
                return {
                  text: text2 + indent + "* ",
                  selection: [1, 2 + indent.length, 1, 2 + indent.length]
                };
              } else {
                return {
                  text: text2 + indent + " * ",
                  selection: [1, 3 + indent.length, 1, 3 + indent.length]
                };
              }
            }
            if (/\/\*\*/.test(line2.substring(0, cursor.column))) {
              return {
                text: text2 + indent + " * " + text2 + " " + indent + "*/",
                selection: [1, 4 + indent.length, 1, 4 + indent.length]
              };
            }
          }
        });
      }
    };
    CstyleBehaviour.isSaneInsertion = function(editor2, session) {
      var cursor = editor2.getCursorPosition();
      var iterator2 = new TokenIterator(session, cursor.row, cursor.column);
      if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
        if (/[)}\]]/.test(editor2.session.getLine(cursor.row)[cursor.column]))
          return true;
        var iterator22 = new TokenIterator(session, cursor.row, cursor.column + 1);
        if (!this.$matchTokenType(iterator22.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
          return false;
      }
      iterator2.stepForward();
      return iterator2.getCurrentTokenRow() !== cursor.row || this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
    };
    CstyleBehaviour["$matchTokenType"] = function(token2, types2) {
      return types2.indexOf(token2.type || token2) > -1;
    };
    CstyleBehaviour["recordAutoInsert"] = function(editor2, session, bracket) {
      var cursor = editor2.getCursorPosition();
      var line2 = session.doc.getLine(cursor.row);
      if (!this["isAutoInsertedClosing"](cursor, line2, context.autoInsertedLineEnd[0]))
        context.autoInsertedBrackets = 0;
      context.autoInsertedRow = cursor.row;
      context.autoInsertedLineEnd = bracket + line2.substr(cursor.column);
      context.autoInsertedBrackets++;
    };
    CstyleBehaviour["recordMaybeInsert"] = function(editor2, session, bracket) {
      var cursor = editor2.getCursorPosition();
      var line2 = session.doc.getLine(cursor.row);
      if (!this["isMaybeInsertedClosing"](cursor, line2))
        context.maybeInsertedBrackets = 0;
      context.maybeInsertedRow = cursor.row;
      context.maybeInsertedLineStart = line2.substr(0, cursor.column) + bracket;
      context.maybeInsertedLineEnd = line2.substr(cursor.column);
      context.maybeInsertedBrackets++;
    };
    CstyleBehaviour["isAutoInsertedClosing"] = function(cursor, line2, bracket) {
      return context.autoInsertedBrackets > 0 && cursor.row === context.autoInsertedRow && bracket === context.autoInsertedLineEnd[0] && line2.substr(cursor.column) === context.autoInsertedLineEnd;
    };
    CstyleBehaviour["isMaybeInsertedClosing"] = function(cursor, line2) {
      return context.maybeInsertedBrackets > 0 && cursor.row === context.maybeInsertedRow && line2.substr(cursor.column) === context.maybeInsertedLineEnd && line2.substr(0, cursor.column) == context.maybeInsertedLineStart;
    };
    CstyleBehaviour["popAutoInsertedClosing"] = function() {
      context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
      context.autoInsertedBrackets--;
    };
    CstyleBehaviour["clearMaybeInsertedClosing"] = function() {
      if (context) {
        context.maybeInsertedBrackets = 0;
        context.maybeInsertedRow = -1;
      }
    };
    oop.inherits(CstyleBehaviour, Behaviour);
    exports3.CstyleBehaviour = CstyleBehaviour;
  });
  ace.define("ace/unicode", ["require", "exports", "module"], function(require2, exports3, module3) {
    var wordChars = [48, 9, 8, 25, 5, 0, 2, 25, 48, 0, 11, 0, 5, 0, 6, 22, 2, 30, 2, 457, 5, 11, 15, 4, 8, 0, 2, 0, 18, 116, 2, 1, 3, 3, 9, 0, 2, 2, 2, 0, 2, 19, 2, 82, 2, 138, 2, 4, 3, 155, 12, 37, 3, 0, 8, 38, 10, 44, 2, 0, 2, 1, 2, 1, 2, 0, 9, 26, 6, 2, 30, 10, 7, 61, 2, 9, 5, 101, 2, 7, 3, 9, 2, 18, 3, 0, 17, 58, 3, 100, 15, 53, 5, 0, 6, 45, 211, 57, 3, 18, 2, 5, 3, 11, 3, 9, 2, 1, 7, 6, 2, 2, 2, 7, 3, 1, 3, 21, 2, 6, 2, 0, 4, 3, 3, 8, 3, 1, 3, 3, 9, 0, 5, 1, 2, 4, 3, 11, 16, 2, 2, 5, 5, 1, 3, 21, 2, 6, 2, 1, 2, 1, 2, 1, 3, 0, 2, 4, 5, 1, 3, 2, 4, 0, 8, 3, 2, 0, 8, 15, 12, 2, 2, 8, 2, 2, 2, 21, 2, 6, 2, 1, 2, 4, 3, 9, 2, 2, 2, 2, 3, 0, 16, 3, 3, 9, 18, 2, 2, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 3, 8, 3, 1, 3, 2, 9, 1, 5, 1, 2, 4, 3, 9, 2, 0, 17, 1, 2, 5, 4, 2, 2, 3, 4, 1, 2, 0, 2, 1, 4, 1, 4, 2, 4, 11, 5, 4, 4, 2, 2, 3, 3, 0, 7, 0, 15, 9, 18, 2, 2, 7, 2, 2, 2, 22, 2, 9, 2, 4, 4, 7, 2, 2, 2, 3, 8, 1, 2, 1, 7, 3, 3, 9, 19, 1, 2, 7, 2, 2, 2, 22, 2, 9, 2, 4, 3, 8, 2, 2, 2, 3, 8, 1, 8, 0, 2, 3, 3, 9, 19, 1, 2, 7, 2, 2, 2, 22, 2, 15, 4, 7, 2, 2, 2, 3, 10, 0, 9, 3, 3, 9, 11, 5, 3, 1, 2, 17, 4, 23, 2, 8, 2, 0, 3, 6, 4, 0, 5, 5, 2, 0, 2, 7, 19, 1, 14, 57, 6, 14, 2, 9, 40, 1, 2, 0, 3, 1, 2, 0, 3, 0, 7, 3, 2, 6, 2, 2, 2, 0, 2, 0, 3, 1, 2, 12, 2, 2, 3, 4, 2, 0, 2, 5, 3, 9, 3, 1, 35, 0, 24, 1, 7, 9, 12, 0, 2, 0, 2, 0, 5, 9, 2, 35, 5, 19, 2, 5, 5, 7, 2, 35, 10, 0, 58, 73, 7, 77, 3, 37, 11, 42, 2, 0, 4, 328, 2, 3, 3, 6, 2, 0, 2, 3, 3, 40, 2, 3, 3, 32, 2, 3, 3, 6, 2, 0, 2, 3, 3, 14, 2, 56, 2, 3, 3, 66, 5, 0, 33, 15, 17, 84, 13, 619, 3, 16, 2, 25, 6, 74, 22, 12, 2, 6, 12, 20, 12, 19, 13, 12, 2, 2, 2, 1, 13, 51, 3, 29, 4, 0, 5, 1, 3, 9, 34, 2, 3, 9, 7, 87, 9, 42, 6, 69, 11, 28, 4, 11, 5, 11, 11, 39, 3, 4, 12, 43, 5, 25, 7, 10, 38, 27, 5, 62, 2, 28, 3, 10, 7, 9, 14, 0, 89, 75, 5, 9, 18, 8, 13, 42, 4, 11, 71, 55, 9, 9, 4, 48, 83, 2, 2, 30, 14, 230, 23, 280, 3, 5, 3, 37, 3, 5, 3, 7, 2, 0, 2, 0, 2, 0, 2, 30, 3, 52, 2, 6, 2, 0, 4, 2, 2, 6, 4, 3, 3, 5, 5, 12, 6, 2, 2, 6, 67, 1, 20, 0, 29, 0, 14, 0, 17, 4, 60, 12, 5, 0, 4, 11, 18, 0, 5, 0, 3, 9, 2, 0, 4, 4, 7, 0, 2, 0, 2, 0, 2, 3, 2, 10, 3, 3, 6, 4, 5, 0, 53, 1, 2684, 46, 2, 46, 2, 132, 7, 6, 15, 37, 11, 53, 10, 0, 17, 22, 10, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 31, 48, 0, 470, 1, 36, 5, 2, 4, 6, 1, 5, 85, 3, 1, 3, 2, 2, 89, 2, 3, 6, 40, 4, 93, 18, 23, 57, 15, 513, 6581, 75, 20939, 53, 1164, 68, 45, 3, 268, 4, 27, 21, 31, 3, 13, 13, 1, 2, 24, 9, 69, 11, 1, 38, 8, 3, 102, 3, 1, 111, 44, 25, 51, 13, 68, 12, 9, 7, 23, 4, 0, 5, 45, 3, 35, 13, 28, 4, 64, 15, 10, 39, 54, 10, 13, 3, 9, 7, 22, 4, 1, 5, 66, 25, 2, 227, 42, 2, 1, 3, 9, 7, 11171, 13, 22, 5, 48, 8453, 301, 3, 61, 3, 105, 39, 6, 13, 4, 6, 11, 2, 12, 2, 4, 2, 0, 2, 1, 2, 1, 2, 107, 34, 362, 19, 63, 3, 53, 41, 11, 5, 15, 17, 6, 13, 1, 25, 2, 33, 4, 2, 134, 20, 9, 8, 25, 5, 0, 2, 25, 12, 88, 4, 5, 3, 5, 3, 5, 3, 2];
    var code2 = 0;
    var str = [];
    for (var i2 = 0; i2 < wordChars.length; i2 += 2) {
      str.push(code2 += wordChars[i2]);
      if (wordChars[i2 + 1])
        str.push(45, code2 += wordChars[i2 + 1]);
    }
    exports3.wordChars = String.fromCharCode.apply(null, str);
  });
  ace.define("ace/mode/text", ["require", "exports", "module", "ace/config", "ace/tokenizer", "ace/mode/text_highlight_rules", "ace/mode/behaviour/cstyle", "ace/unicode", "ace/lib/lang", "ace/token_iterator", "ace/range"], function(require2, exports3, module3) {
    var config2 = require2("../config");
    var Tokenizer = require2("../tokenizer").Tokenizer;
    var TextHighlightRules = require2("./text_highlight_rules").TextHighlightRules;
    var CstyleBehaviour = require2("./behaviour/cstyle").CstyleBehaviour;
    var unicode = require2("../unicode");
    var lang2 = require2("../lib/lang");
    var TokenIterator = require2("../token_iterator").TokenIterator;
    var Range2 = require2("../range").Range;
    var Mode2;
    Mode2 = function() {
      this.HighlightRules = TextHighlightRules;
    };
    (function() {
      this.$defaultBehaviour = new CstyleBehaviour();
      this.tokenRe = new RegExp("^[" + unicode.wordChars + "\\$_]+", "g");
      this.nonTokenRe = new RegExp("^(?:[^" + unicode.wordChars + "\\$_]|\\s])+", "g");
      this.getTokenizer = function() {
        if (!this.$tokenizer) {
          this.$highlightRules = this.$highlightRules || new this.HighlightRules(this.$highlightRuleConfig);
          this.$tokenizer = new Tokenizer(this.$highlightRules.getRules());
        }
        return this.$tokenizer;
      };
      this.lineCommentStart = "";
      this.blockComment = "";
      this.toggleCommentLines = function(state, session, startRow, endRow) {
        var doc = session.doc;
        var ignoreBlankLines = true;
        var shouldRemove = true;
        var minIndent = Infinity;
        var tabSize = session.getTabSize();
        var insertAtTabStop = false;
        if (!this.lineCommentStart) {
          if (!this.blockComment)
            return false;
          var lineCommentStart = this.blockComment.start;
          var lineCommentEnd = this.blockComment.end;
          var regexpStart = new RegExp("^(\\s*)(?:" + lang2.escapeRegExp(lineCommentStart) + ")");
          var regexpEnd = new RegExp("(?:" + lang2.escapeRegExp(lineCommentEnd) + ")\\s*$");
          var comment2 = function(line2, i2) {
            if (testRemove(line2, i2))
              return;
            if (!ignoreBlankLines || /\S/.test(line2)) {
              doc.insertInLine({ row: i2, column: line2.length }, lineCommentEnd);
              doc.insertInLine({ row: i2, column: minIndent }, lineCommentStart);
            }
          };
          var uncomment = function(line2, i2) {
            var m2;
            if (m2 = line2.match(regexpEnd))
              doc.removeInLine(i2, line2.length - m2[0].length, line2.length);
            if (m2 = line2.match(regexpStart))
              doc.removeInLine(i2, m2[1].length, m2[0].length);
          };
          var testRemove = function(line2, row) {
            if (regexpStart.test(line2))
              return true;
            var tokens2 = session.getTokens(row);
            for (var i2 = 0; i2 < tokens2.length; i2++) {
              if (tokens2[i2].type === "comment")
                return true;
            }
          };
        } else {
          if (Array.isArray(this.lineCommentStart)) {
            var regexpStart = this.lineCommentStart.map(lang2.escapeRegExp).join("|");
            var lineCommentStart = this.lineCommentStart[0];
          } else {
            var regexpStart = lang2.escapeRegExp(this.lineCommentStart);
            var lineCommentStart = this.lineCommentStart;
          }
          regexpStart = new RegExp("^(\\s*)(?:" + regexpStart + ") ?");
          insertAtTabStop = session.getUseSoftTabs();
          var uncomment = function(line2, i2) {
            var m2 = line2.match(regexpStart);
            if (!m2)
              return;
            var start2 = m2[1].length, end2 = m2[0].length;
            if (!shouldInsertSpace(line2, start2, end2) && m2[0][end2 - 1] == " ")
              end2--;
            doc.removeInLine(i2, start2, end2);
          };
          var commentWithSpace = lineCommentStart + " ";
          var comment2 = function(line2, i2) {
            if (!ignoreBlankLines || /\S/.test(line2)) {
              if (shouldInsertSpace(line2, minIndent, minIndent))
                doc.insertInLine({ row: i2, column: minIndent }, commentWithSpace);
              else
                doc.insertInLine({ row: i2, column: minIndent }, lineCommentStart);
            }
          };
          var testRemove = function(line2, i2) {
            return regexpStart.test(line2);
          };
          var shouldInsertSpace = function(line2, before, after) {
            var spaces = 0;
            while (before-- && line2.charAt(before) == " ")
              spaces++;
            if (spaces % tabSize != 0)
              return false;
            var spaces = 0;
            while (line2.charAt(after++) == " ")
              spaces++;
            if (tabSize > 2)
              return spaces % tabSize != tabSize - 1;
            else
              return spaces % tabSize == 0;
          };
        }
        function iter(fun) {
          for (var i2 = startRow; i2 <= endRow; i2++)
            fun(doc.getLine(i2), i2);
        }
        var minEmptyLength = Infinity;
        iter(function(line2, i2) {
          var indent = line2.search(/\S/);
          if (indent !== -1) {
            if (indent < minIndent)
              minIndent = indent;
            if (shouldRemove && !testRemove(line2, i2))
              shouldRemove = false;
          } else if (minEmptyLength > line2.length) {
            minEmptyLength = line2.length;
          }
        });
        if (minIndent == Infinity) {
          minIndent = minEmptyLength;
          ignoreBlankLines = false;
          shouldRemove = false;
        }
        if (insertAtTabStop && minIndent % tabSize != 0)
          minIndent = Math.floor(minIndent / tabSize) * tabSize;
        iter(shouldRemove ? uncomment : comment2);
      };
      this.toggleBlockComment = function(state, session, range3, cursor) {
        var comment2 = this.blockComment;
        if (!comment2)
          return;
        if (!comment2.start && comment2[0])
          comment2 = comment2[0];
        var iterator2 = new TokenIterator(session, cursor.row, cursor.column);
        var token2 = iterator2.getCurrentToken();
        session.selection;
        var initialRange = session.selection.toOrientedRange();
        var startRow, colDiff;
        if (token2 && /comment/.test(token2.type)) {
          var startRange, endRange;
          while (token2 && /comment/.test(token2.type)) {
            var i2 = token2.value.indexOf(comment2.start);
            if (i2 != -1) {
              var row = iterator2.getCurrentTokenRow();
              var column2 = iterator2.getCurrentTokenColumn() + i2;
              startRange = new Range2(row, column2, row, column2 + comment2.start.length);
              break;
            }
            token2 = iterator2.stepBackward();
          }
          var iterator2 = new TokenIterator(session, cursor.row, cursor.column);
          var token2 = iterator2.getCurrentToken();
          while (token2 && /comment/.test(token2.type)) {
            var i2 = token2.value.indexOf(comment2.end);
            if (i2 != -1) {
              var row = iterator2.getCurrentTokenRow();
              var column2 = iterator2.getCurrentTokenColumn() + i2;
              endRange = new Range2(row, column2, row, column2 + comment2.end.length);
              break;
            }
            token2 = iterator2.stepForward();
          }
          if (endRange)
            session.remove(endRange);
          if (startRange) {
            session.remove(startRange);
            startRow = startRange.start.row;
            colDiff = -comment2.start.length;
          }
        } else {
          colDiff = comment2.start.length;
          startRow = range3.start.row;
          session.insert(range3.end, comment2.end);
          session.insert(range3.start, comment2.start);
        }
        if (initialRange.start.row == startRow)
          initialRange.start.column += colDiff;
        if (initialRange.end.row == startRow)
          initialRange.end.column += colDiff;
        session.selection.fromOrientedRange(initialRange);
      };
      this.getNextLineIndent = function(state, line2, tab2) {
        return this.$getIndent(line2);
      };
      this.checkOutdent = function(state, line2, input2) {
        return false;
      };
      this.autoOutdent = function(state, doc, row) {
      };
      this.$getIndent = function(line2) {
        return line2.match(/^\s*/)[0];
      };
      this.createWorker = function(session) {
        return null;
      };
      this.createModeDelegates = function(mapping) {
        this.$embeds = [];
        this.$modes = {};
        for (var i2 in mapping) {
          if (mapping[i2]) {
            var Mode3 = mapping[i2];
            var id2 = Mode3.prototype.$id;
            var mode = config2.$modes[id2];
            if (!mode)
              config2.$modes[id2] = mode = new Mode3();
            if (!config2.$modes[i2])
              config2.$modes[i2] = mode;
            this.$embeds.push(i2);
            this.$modes[i2] = mode;
          }
        }
        var delegations = [
          "toggleBlockComment",
          "toggleCommentLines",
          "getNextLineIndent",
          "checkOutdent",
          "autoOutdent",
          "transformAction",
          "getCompletions"
        ];
        var _loop_1 = function(i3) {
          (function(scope) {
            var functionName = delegations[i3];
            var defaultHandler = scope[functionName];
            scope[delegations[i3]] = function() {
              return this.$delegator(functionName, arguments, defaultHandler);
            };
          })(this_1);
        };
        var this_1 = this;
        for (var i2 = 0; i2 < delegations.length; i2++) {
          _loop_1(i2);
        }
      };
      this.$delegator = function(method4, args, defaultHandler) {
        var state = args[0] || "start";
        if (typeof state != "string") {
          if (Array.isArray(state[2])) {
            var language = state[2][state[2].length - 1];
            var mode = this.$modes[language];
            if (mode)
              return mode[method4].apply(mode, [state[1]].concat([].slice.call(args, 1)));
          }
          state = state[0] || "start";
        }
        for (var i2 = 0; i2 < this.$embeds.length; i2++) {
          if (!this.$modes[this.$embeds[i2]])
            continue;
          var split2 = state.split(this.$embeds[i2]);
          if (!split2[0] && split2[1]) {
            args[0] = split2[1];
            var mode = this.$modes[this.$embeds[i2]];
            return mode[method4].apply(mode, args);
          }
        }
        var ret = defaultHandler.apply(this, args);
        return defaultHandler ? ret : void 0;
      };
      this.transformAction = function(state, action, editor2, session, param) {
        if (this.$behaviour) {
          var behaviours = this.$behaviour.getBehaviours();
          for (var key in behaviours) {
            if (behaviours[key][action]) {
              var ret = behaviours[key][action].apply(this, arguments);
              if (ret) {
                return ret;
              }
            }
          }
        }
      };
      this.getKeywords = function(append3) {
        if (!this.completionKeywords) {
          var rules2 = this.$tokenizer["rules"];
          var completionKeywords = [];
          for (var rule in rules2) {
            var ruleItr = rules2[rule];
            for (var r2 = 0, l2 = ruleItr.length; r2 < l2; r2++) {
              if (typeof ruleItr[r2].token === "string") {
                if (/keyword|support|storage/.test(ruleItr[r2].token))
                  completionKeywords.push(ruleItr[r2].regex);
              } else if (typeof ruleItr[r2].token === "object") {
                for (var a2 = 0, aLength = ruleItr[r2].token.length; a2 < aLength; a2++) {
                  if (/keyword|support|storage/.test(ruleItr[r2].token[a2])) {
                    var rule = ruleItr[r2].regex.match(/\(.+?\)/g)[a2];
                    completionKeywords.push(rule.substr(1, rule.length - 2));
                  }
                }
              }
            }
          }
          this.completionKeywords = completionKeywords;
        }
        if (!append3)
          return this.$keywordList;
        return completionKeywords.concat(this.$keywordList || []);
      };
      this.$createKeywordList = function() {
        if (!this.$highlightRules)
          this.getTokenizer();
        return this.$keywordList = this.$highlightRules.$keywordList || [];
      };
      this.getCompletions = function(state, session, pos, prefix) {
        var keywords = this.$keywordList || this.$createKeywordList();
        return keywords.map(function(word) {
          return {
            name: word,
            value: word,
            score: 0,
            meta: "keyword"
          };
        });
      };
      this.$id = "ace/mode/text";
    }).call(Mode2.prototype);
    exports3.Mode = Mode2;
  });
  ace.define("ace/line_widgets", ["require", "exports", "module", "ace/lib/dom"], function(require2, exports3, module3) {
    var dom = require2("./lib/dom");
    var LineWidgets = (
      /** @class */
      function() {
        function LineWidgets2(session) {
          this.session = session;
          this.session.widgetManager = this;
          this.session.getRowLength = this.getRowLength;
          this.session.$getWidgetScreenLength = this.$getWidgetScreenLength;
          this.updateOnChange = this.updateOnChange.bind(this);
          this.renderWidgets = this.renderWidgets.bind(this);
          this.measureWidgets = this.measureWidgets.bind(this);
          this.session._changedWidgets = [];
          this.$onChangeEditor = this.$onChangeEditor.bind(this);
          this.session.on("change", this.updateOnChange);
          this.session.on("changeFold", this.updateOnFold);
          this.session.on("changeEditor", this.$onChangeEditor);
        }
        LineWidgets2.prototype.getRowLength = function(row) {
          var h3;
          if (this.lineWidgets)
            h3 = this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;
          else
            h3 = 0;
          if (!this["$useWrapMode"] || !this["$wrapData"][row]) {
            return 1 + h3;
          } else {
            return this["$wrapData"][row].length + 1 + h3;
          }
        };
        LineWidgets2.prototype.$getWidgetScreenLength = function() {
          var screenRows = 0;
          this.lineWidgets.forEach(function(w2) {
            if (w2 && w2.rowCount && !w2.hidden)
              screenRows += w2.rowCount;
          });
          return screenRows;
        };
        LineWidgets2.prototype.$onChangeEditor = function(e2) {
          this.attach(e2.editor);
        };
        LineWidgets2.prototype.attach = function(editor2) {
          if (editor2 && editor2.widgetManager && editor2.widgetManager != this)
            editor2.widgetManager.detach();
          if (this.editor == editor2)
            return;
          this.detach();
          this.editor = editor2;
          if (editor2) {
            editor2.widgetManager = this;
            editor2.renderer.on("beforeRender", this.measureWidgets);
            editor2.renderer.on("afterRender", this.renderWidgets);
          }
        };
        LineWidgets2.prototype.detach = function(e2) {
          var editor2 = this.editor;
          if (!editor2)
            return;
          this.editor = null;
          editor2.widgetManager = null;
          editor2.renderer.off("beforeRender", this.measureWidgets);
          editor2.renderer.off("afterRender", this.renderWidgets);
          var lineWidgets = this.session.lineWidgets;
          lineWidgets && lineWidgets.forEach(function(w2) {
            if (w2 && w2.el && w2.el.parentNode) {
              w2._inDocument = false;
              w2.el.parentNode.removeChild(w2.el);
            }
          });
        };
        LineWidgets2.prototype.updateOnFold = function(e2, session) {
          var lineWidgets = session.lineWidgets;
          if (!lineWidgets || !e2.action)
            return;
          var fold = e2.data;
          var start2 = fold.start.row;
          var end2 = fold.end.row;
          var hide = e2.action == "add";
          for (var i2 = start2 + 1; i2 < end2; i2++) {
            if (lineWidgets[i2])
              lineWidgets[i2].hidden = hide;
          }
          if (lineWidgets[end2]) {
            if (hide) {
              if (!lineWidgets[start2])
                lineWidgets[start2] = lineWidgets[end2];
              else
                lineWidgets[end2].hidden = hide;
            } else {
              if (lineWidgets[start2] == lineWidgets[end2])
                lineWidgets[start2] = void 0;
              lineWidgets[end2].hidden = hide;
            }
          }
        };
        LineWidgets2.prototype.updateOnChange = function(delta) {
          var lineWidgets = this.session.lineWidgets;
          if (!lineWidgets)
            return;
          var startRow = delta.start.row;
          var len = delta.end.row - startRow;
          if (len === 0)
            ;
          else if (delta.action == "remove") {
            var removed = lineWidgets.splice(startRow + 1, len);
            if (!lineWidgets[startRow] && removed[removed.length - 1]) {
              lineWidgets[startRow] = removed.pop();
            }
            removed.forEach(function(w2) {
              w2 && this.removeLineWidget(w2);
            }, this);
            this.$updateRows();
          } else {
            var args = new Array(len);
            if (lineWidgets[startRow] && lineWidgets[startRow].column != null) {
              if (delta.start.column > lineWidgets[startRow].column)
                startRow++;
            }
            args.unshift(startRow, 0);
            lineWidgets.splice.apply(lineWidgets, args);
            this.$updateRows();
          }
        };
        LineWidgets2.prototype.$updateRows = function() {
          var lineWidgets = this.session.lineWidgets;
          if (!lineWidgets)
            return;
          var noWidgets = true;
          lineWidgets.forEach(function(w2, i2) {
            if (w2) {
              noWidgets = false;
              w2.row = i2;
              while (w2.$oldWidget) {
                w2.$oldWidget.row = i2;
                w2 = w2.$oldWidget;
              }
            }
          });
          if (noWidgets)
            this.session.lineWidgets = null;
        };
        LineWidgets2.prototype.$registerLineWidget = function(w2) {
          if (!this.session.lineWidgets)
            this.session.lineWidgets = new Array(this.session.getLength());
          var old = this.session.lineWidgets[w2.row];
          if (old) {
            w2.$oldWidget = old;
            if (old.el && old.el.parentNode) {
              old.el.parentNode.removeChild(old.el);
              old._inDocument = false;
            }
          }
          this.session.lineWidgets[w2.row] = w2;
          return w2;
        };
        LineWidgets2.prototype.addLineWidget = function(w2) {
          this.$registerLineWidget(w2);
          w2.session = this.session;
          if (!this.editor)
            return w2;
          var renderer = this.editor.renderer;
          if (w2.html && !w2.el) {
            w2.el = dom.createElement("div");
            w2.el.innerHTML = w2.html;
          }
          if (w2.text && !w2.el) {
            w2.el = dom.createElement("div");
            w2.el.textContent = w2.text;
          }
          if (w2.el) {
            dom.addCssClass(w2.el, "ace_lineWidgetContainer");
            if (w2.className) {
              dom.addCssClass(w2.el, w2.className);
            }
            w2.el.style.position = "absolute";
            w2.el.style.zIndex = "5";
            renderer.container.appendChild(w2.el);
            w2._inDocument = true;
            if (!w2.coverGutter) {
              w2.el.style.zIndex = "3";
            }
            if (w2.pixelHeight == null) {
              w2.pixelHeight = w2.el.offsetHeight;
            }
          }
          if (w2.rowCount == null) {
            w2.rowCount = w2.pixelHeight / renderer.layerConfig.lineHeight;
          }
          var fold = this.session.getFoldAt(w2.row, 0);
          w2.$fold = fold;
          if (fold) {
            var lineWidgets = this.session.lineWidgets;
            if (w2.row == fold.end.row && !lineWidgets[fold.start.row])
              lineWidgets[fold.start.row] = w2;
            else
              w2.hidden = true;
          }
          this.session._emit("changeFold", { data: { start: { row: w2.row } } });
          this.$updateRows();
          this.renderWidgets(null, renderer);
          this.onWidgetChanged(w2);
          return w2;
        };
        LineWidgets2.prototype.removeLineWidget = function(w2) {
          w2._inDocument = false;
          w2.session = null;
          if (w2.el && w2.el.parentNode)
            w2.el.parentNode.removeChild(w2.el);
          if (w2.editor && w2.editor.destroy)
            try {
              w2.editor.destroy();
            } catch (e2) {
            }
          if (this.session.lineWidgets) {
            var w1 = this.session.lineWidgets[w2.row];
            if (w1 == w2) {
              this.session.lineWidgets[w2.row] = w2.$oldWidget;
              if (w2.$oldWidget)
                this.onWidgetChanged(w2.$oldWidget);
            } else {
              while (w1) {
                if (w1.$oldWidget == w2) {
                  w1.$oldWidget = w2.$oldWidget;
                  break;
                }
                w1 = w1.$oldWidget;
              }
            }
          }
          this.session._emit("changeFold", { data: { start: { row: w2.row } } });
          this.$updateRows();
        };
        LineWidgets2.prototype.getWidgetsAtRow = function(row) {
          var lineWidgets = this.session.lineWidgets;
          var w2 = lineWidgets && lineWidgets[row];
          var list2 = [];
          while (w2) {
            list2.push(w2);
            w2 = w2.$oldWidget;
          }
          return list2;
        };
        LineWidgets2.prototype.onWidgetChanged = function(w2) {
          this.session._changedWidgets.push(w2);
          this.editor && this.editor.renderer.updateFull();
        };
        LineWidgets2.prototype.measureWidgets = function(e2, renderer) {
          var changedWidgets = this.session._changedWidgets;
          var config2 = renderer.layerConfig;
          if (!changedWidgets || !changedWidgets.length)
            return;
          var min2 = Infinity;
          for (var i2 = 0; i2 < changedWidgets.length; i2++) {
            var w2 = changedWidgets[i2];
            if (!w2 || !w2.el)
              continue;
            if (w2.session != this.session)
              continue;
            if (!w2._inDocument) {
              if (this.session.lineWidgets[w2.row] != w2)
                continue;
              w2._inDocument = true;
              renderer.container.appendChild(w2.el);
            }
            w2.h = w2.el.offsetHeight;
            if (!w2.fixedWidth) {
              w2.w = w2.el.offsetWidth;
              w2.screenWidth = Math.ceil(w2.w / config2.characterWidth);
            }
            var rowCount = w2.h / config2.lineHeight;
            if (w2.coverLine) {
              rowCount -= this.session.getRowLineCount(w2.row);
              if (rowCount < 0)
                rowCount = 0;
            }
            if (w2.rowCount != rowCount) {
              w2.rowCount = rowCount;
              if (w2.row < min2)
                min2 = w2.row;
            }
          }
          if (min2 != Infinity) {
            this.session._emit("changeFold", { data: { start: { row: min2 } } });
            this.session.lineWidgetWidth = null;
          }
          this.session._changedWidgets = [];
        };
        LineWidgets2.prototype.renderWidgets = function(e2, renderer) {
          var config2 = renderer.layerConfig;
          var lineWidgets = this.session.lineWidgets;
          if (!lineWidgets)
            return;
          var first = Math.min(this.firstRow, config2.firstRow);
          var last = Math.max(this.lastRow, config2.lastRow, lineWidgets.length);
          while (first > 0 && !lineWidgets[first])
            first--;
          this.firstRow = config2.firstRow;
          this.lastRow = config2.lastRow;
          renderer.$cursorLayer.config = config2;
          for (var i2 = first; i2 <= last; i2++) {
            var w2 = lineWidgets[i2];
            if (!w2 || !w2.el)
              continue;
            if (w2.hidden) {
              w2.el.style.top = -100 - (w2.pixelHeight || 0) + "px";
              continue;
            }
            if (!w2._inDocument) {
              w2._inDocument = true;
              renderer.container.appendChild(w2.el);
            }
            var top2 = renderer.$cursorLayer.getPixelPosition({ row: i2, column: 0 }, true).top;
            if (!w2.coverLine)
              top2 += config2.lineHeight * this.session.getRowLineCount(w2.row);
            w2.el.style.top = top2 - config2.offset + "px";
            var left2 = w2.coverGutter ? 0 : renderer.gutterWidth;
            if (!w2.fixedWidth)
              left2 -= renderer.scrollLeft;
            w2.el.style.left = left2 + "px";
            if (w2.fullWidth && w2.screenWidth) {
              w2.el.style.minWidth = config2.width + 2 * config2.padding + "px";
            }
            if (w2.fixedWidth) {
              w2.el.style.right = renderer.scrollBar.getWidth() + "px";
            } else {
              w2.el.style.right = "";
            }
          }
        };
        return LineWidgets2;
      }()
    );
    exports3.LineWidgets = LineWidgets;
  });
  ace.define("ace/apply_delta", ["require", "exports", "module"], function(require2, exports3, module3) {
    exports3.applyDelta = function(docLines, delta, doNotValidate) {
      var row = delta.start.row;
      var startColumn = delta.start.column;
      var line2 = docLines[row] || "";
      switch (delta.action) {
        case "insert":
          var lines = delta.lines;
          if (lines.length === 1) {
            docLines[row] = line2.substring(0, startColumn) + delta.lines[0] + line2.substring(startColumn);
          } else {
            var args = [row, 1].concat(delta.lines);
            docLines.splice.apply(docLines, args);
            docLines[row] = line2.substring(0, startColumn) + docLines[row];
            docLines[row + delta.lines.length - 1] += line2.substring(startColumn);
          }
          break;
        case "remove":
          var endColumn = delta.end.column;
          var endRow = delta.end.row;
          if (row === endRow) {
            docLines[row] = line2.substring(0, startColumn) + line2.substring(endColumn);
          } else {
            docLines.splice(row, endRow - row + 1, line2.substring(0, startColumn) + docLines[endRow].substring(endColumn));
          }
          break;
      }
    };
  });
  ace.define("ace/anchor", ["require", "exports", "module", "ace/lib/oop", "ace/lib/event_emitter"], function(require2, exports3, module3) {
    var oop = require2("./lib/oop");
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var Anchor = (
      /** @class */
      function() {
        function Anchor2(doc, row, column2) {
          this.$onChange = this.onChange.bind(this);
          this.attach(doc);
          if (typeof row != "number")
            this.setPosition(row.row, row.column);
          else
            this.setPosition(row, column2);
        }
        Anchor2.prototype.getPosition = function() {
          return this.$clipPositionToDocument(this.row, this.column);
        };
        Anchor2.prototype.getDocument = function() {
          return this.document;
        };
        Anchor2.prototype.onChange = function(delta) {
          if (delta.start.row == delta.end.row && delta.start.row != this.row)
            return;
          if (delta.start.row > this.row)
            return;
          var point2 = $getTransformedPoint(delta, { row: this.row, column: this.column }, this.$insertRight);
          this.setPosition(point2.row, point2.column, true);
        };
        Anchor2.prototype.setPosition = function(row, column2, noClip) {
          var pos;
          if (noClip) {
            pos = {
              row,
              column: column2
            };
          } else {
            pos = this.$clipPositionToDocument(row, column2);
          }
          if (this.row == pos.row && this.column == pos.column)
            return;
          var old = {
            row: this.row,
            column: this.column
          };
          this.row = pos.row;
          this.column = pos.column;
          this._signal("change", {
            old,
            value: pos
          });
        };
        Anchor2.prototype.detach = function() {
          this.document.off("change", this.$onChange);
        };
        Anchor2.prototype.attach = function(doc) {
          this.document = doc || this.document;
          this.document.on("change", this.$onChange);
        };
        Anchor2.prototype.$clipPositionToDocument = function(row, column2) {
          var pos = {};
          if (row >= this.document.getLength()) {
            pos.row = Math.max(0, this.document.getLength() - 1);
            pos.column = this.document.getLine(pos.row).length;
          } else if (row < 0) {
            pos.row = 0;
            pos.column = 0;
          } else {
            pos.row = row;
            pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column2));
          }
          if (column2 < 0)
            pos.column = 0;
          return pos;
        };
        return Anchor2;
      }()
    );
    Anchor.prototype.$insertRight = false;
    oop.implement(Anchor.prototype, EventEmitter2);
    function $pointsInOrder(point1, point2, equalPointsInOrder) {
      var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column;
      return point1.row < point2.row || point1.row == point2.row && bColIsAfter;
    }
    function $getTransformedPoint(delta, point2, moveIfEqual) {
      var deltaIsInsert = delta.action == "insert";
      var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row);
      var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column);
      var deltaStart = delta.start;
      var deltaEnd = deltaIsInsert ? deltaStart : delta.end;
      if ($pointsInOrder(point2, deltaStart, moveIfEqual)) {
        return {
          row: point2.row,
          column: point2.column
        };
      }
      if ($pointsInOrder(deltaEnd, point2, !moveIfEqual)) {
        return {
          row: point2.row + deltaRowShift,
          column: point2.column + (point2.row == deltaEnd.row ? deltaColShift : 0)
        };
      }
      return {
        row: deltaStart.row,
        column: deltaStart.column
      };
    }
    exports3.Anchor = Anchor;
  });
  ace.define("ace/document", ["require", "exports", "module", "ace/lib/oop", "ace/apply_delta", "ace/lib/event_emitter", "ace/range", "ace/anchor"], function(require2, exports3, module3) {
    var oop = require2("./lib/oop");
    var applyDelta = require2("./apply_delta").applyDelta;
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var Range2 = require2("./range").Range;
    var Anchor = require2("./anchor").Anchor;
    var Document = (
      /** @class */
      function() {
        function Document2(textOrLines) {
          this.$lines = [""];
          if (textOrLines.length === 0) {
            this.$lines = [""];
          } else if (Array.isArray(textOrLines)) {
            this.insertMergedLines({ row: 0, column: 0 }, textOrLines);
          } else {
            this.insert({ row: 0, column: 0 }, textOrLines);
          }
        }
        Document2.prototype.setValue = function(text2) {
          var len = this.getLength() - 1;
          this.remove(new Range2(0, 0, len, this.getLine(len).length));
          this.insert({ row: 0, column: 0 }, text2 || "");
        };
        Document2.prototype.getValue = function() {
          return this.getAllLines().join(this.getNewLineCharacter());
        };
        Document2.prototype.createAnchor = function(row, column2) {
          return new Anchor(this, row, column2);
        };
        Document2.prototype.$detectNewLine = function(text2) {
          var match5 = text2.match(/^.*?(\r\n|\r|\n)/m);
          this.$autoNewLine = match5 ? match5[1] : "\n";
          this._signal("changeNewLineMode");
        };
        Document2.prototype.getNewLineCharacter = function() {
          switch (this.$newLineMode) {
            case "windows":
              return "\r\n";
            case "unix":
              return "\n";
            default:
              return this.$autoNewLine || "\n";
          }
        };
        Document2.prototype.setNewLineMode = function(newLineMode) {
          if (this.$newLineMode === newLineMode)
            return;
          this.$newLineMode = newLineMode;
          this._signal("changeNewLineMode");
        };
        Document2.prototype.getNewLineMode = function() {
          return this.$newLineMode;
        };
        Document2.prototype.isNewLine = function(text2) {
          return text2 == "\r\n" || text2 == "\r" || text2 == "\n";
        };
        Document2.prototype.getLine = function(row) {
          return this.$lines[row] || "";
        };
        Document2.prototype.getLines = function(firstRow, lastRow) {
          return this.$lines.slice(firstRow, lastRow + 1);
        };
        Document2.prototype.getAllLines = function() {
          return this.getLines(0, this.getLength());
        };
        Document2.prototype.getLength = function() {
          return this.$lines.length;
        };
        Document2.prototype.getTextRange = function(range3) {
          return this.getLinesForRange(range3).join(this.getNewLineCharacter());
        };
        Document2.prototype.getLinesForRange = function(range3) {
          var lines;
          if (range3.start.row === range3.end.row) {
            lines = [this.getLine(range3.start.row).substring(range3.start.column, range3.end.column)];
          } else {
            lines = this.getLines(range3.start.row, range3.end.row);
            lines[0] = (lines[0] || "").substring(range3.start.column);
            var l2 = lines.length - 1;
            if (range3.end.row - range3.start.row == l2)
              lines[l2] = lines[l2].substring(0, range3.end.column);
          }
          return lines;
        };
        Document2.prototype.insertLines = function(row, lines) {
          console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead.");
          return this.insertFullLines(row, lines);
        };
        Document2.prototype.removeLines = function(firstRow, lastRow) {
          console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead.");
          return this.removeFullLines(firstRow, lastRow);
        };
        Document2.prototype.insertNewLine = function(position2) {
          console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.");
          return this.insertMergedLines(position2, ["", ""]);
        };
        Document2.prototype.insert = function(position2, text2) {
          if (this.getLength() <= 1)
            this.$detectNewLine(text2);
          return this.insertMergedLines(position2, this.$split(text2));
        };
        Document2.prototype.insertInLine = function(position2, text2) {
          var start2 = this.clippedPos(position2.row, position2.column);
          var end2 = this.pos(position2.row, position2.column + text2.length);
          this.applyDelta({
            start: start2,
            end: end2,
            action: "insert",
            lines: [text2]
          }, true);
          return this.clonePos(end2);
        };
        Document2.prototype.clippedPos = function(row, column2) {
          var length2 = this.getLength();
          if (row === void 0) {
            row = length2;
          } else if (row < 0) {
            row = 0;
          } else if (row >= length2) {
            row = length2 - 1;
            column2 = void 0;
          }
          var line2 = this.getLine(row);
          if (column2 == void 0)
            column2 = line2.length;
          column2 = Math.min(Math.max(column2, 0), line2.length);
          return { row, column: column2 };
        };
        Document2.prototype.clonePos = function(pos) {
          return { row: pos.row, column: pos.column };
        };
        Document2.prototype.pos = function(row, column2) {
          return { row, column: column2 };
        };
        Document2.prototype.$clipPosition = function(position2) {
          var length2 = this.getLength();
          if (position2.row >= length2) {
            position2.row = Math.max(0, length2 - 1);
            position2.column = this.getLine(length2 - 1).length;
          } else {
            position2.row = Math.max(0, position2.row);
            position2.column = Math.min(Math.max(position2.column, 0), this.getLine(position2.row).length);
          }
          return position2;
        };
        Document2.prototype.insertFullLines = function(row, lines) {
          row = Math.min(Math.max(row, 0), this.getLength());
          var column2 = 0;
          if (row < this.getLength()) {
            lines = lines.concat([""]);
            column2 = 0;
          } else {
            lines = [""].concat(lines);
            row--;
            column2 = this.$lines[row].length;
          }
          this.insertMergedLines({ row, column: column2 }, lines);
        };
        Document2.prototype.insertMergedLines = function(position2, lines) {
          var start2 = this.clippedPos(position2.row, position2.column);
          var end2 = {
            row: start2.row + lines.length - 1,
            column: (lines.length == 1 ? start2.column : 0) + lines[lines.length - 1].length
          };
          this.applyDelta({
            start: start2,
            end: end2,
            action: "insert",
            lines
          });
          return this.clonePos(end2);
        };
        Document2.prototype.remove = function(range3) {
          var start2 = this.clippedPos(range3.start.row, range3.start.column);
          var end2 = this.clippedPos(range3.end.row, range3.end.column);
          this.applyDelta({
            start: start2,
            end: end2,
            action: "remove",
            lines: this.getLinesForRange({ start: start2, end: end2 })
          });
          return this.clonePos(start2);
        };
        Document2.prototype.removeInLine = function(row, startColumn, endColumn) {
          var start2 = this.clippedPos(row, startColumn);
          var end2 = this.clippedPos(row, endColumn);
          this.applyDelta({
            start: start2,
            end: end2,
            action: "remove",
            lines: this.getLinesForRange({ start: start2, end: end2 })
          }, true);
          return this.clonePos(start2);
        };
        Document2.prototype.removeFullLines = function(firstRow, lastRow) {
          firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1);
          lastRow = Math.min(Math.max(0, lastRow), this.getLength() - 1);
          var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0;
          var deleteLastNewLine = lastRow < this.getLength() - 1;
          var startRow = deleteFirstNewLine ? firstRow - 1 : firstRow;
          var startCol = deleteFirstNewLine ? this.getLine(startRow).length : 0;
          var endRow = deleteLastNewLine ? lastRow + 1 : lastRow;
          var endCol = deleteLastNewLine ? 0 : this.getLine(endRow).length;
          var range3 = new Range2(startRow, startCol, endRow, endCol);
          var deletedLines = this.$lines.slice(firstRow, lastRow + 1);
          this.applyDelta({
            start: range3.start,
            end: range3.end,
            action: "remove",
            lines: this.getLinesForRange(range3)
          });
          return deletedLines;
        };
        Document2.prototype.removeNewLine = function(row) {
          if (row < this.getLength() - 1 && row >= 0) {
            this.applyDelta({
              start: this.pos(row, this.getLine(row).length),
              end: this.pos(row + 1, 0),
              action: "remove",
              lines: ["", ""]
            });
          }
        };
        Document2.prototype.replace = function(range3, text2) {
          if (!(range3 instanceof Range2))
            range3 = Range2.fromPoints(range3.start, range3.end);
          if (text2.length === 0 && range3.isEmpty())
            return range3.start;
          if (text2 == this.getTextRange(range3))
            return range3.end;
          this.remove(range3);
          var end2;
          if (text2) {
            end2 = this.insert(range3.start, text2);
          } else {
            end2 = range3.start;
          }
          return end2;
        };
        Document2.prototype.applyDeltas = function(deltas) {
          for (var i2 = 0; i2 < deltas.length; i2++) {
            this.applyDelta(deltas[i2]);
          }
        };
        Document2.prototype.revertDeltas = function(deltas) {
          for (var i2 = deltas.length - 1; i2 >= 0; i2--) {
            this.revertDelta(deltas[i2]);
          }
        };
        Document2.prototype.applyDelta = function(delta, doNotValidate) {
          var isInsert = delta.action == "insert";
          if (isInsert ? delta.lines.length <= 1 && !delta.lines[0] : !Range2.comparePoints(delta.start, delta.end)) {
            return;
          }
          if (isInsert && delta.lines.length > 2e4) {
            this.$splitAndapplyLargeDelta(delta, 2e4);
          } else {
            applyDelta(this.$lines, delta, doNotValidate);
            this._signal("change", delta);
          }
        };
        Document2.prototype.$safeApplyDelta = function(delta) {
          var docLength = this.$lines.length;
          if (delta.action == "remove" && delta.start.row < docLength && delta.end.row < docLength || delta.action == "insert" && delta.start.row <= docLength) {
            this.applyDelta(delta);
          }
        };
        Document2.prototype.$splitAndapplyLargeDelta = function(delta, MAX) {
          var lines = delta.lines;
          var l2 = lines.length - MAX + 1;
          var row = delta.start.row;
          var column2 = delta.start.column;
          for (var from2 = 0, to2 = 0; from2 < l2; from2 = to2) {
            to2 += MAX - 1;
            var chunk = lines.slice(from2, to2);
            chunk.push("");
            this.applyDelta({
              start: this.pos(row + from2, column2),
              end: this.pos(row + to2, column2 = 0),
              action: delta.action,
              lines: chunk
            }, true);
          }
          delta.lines = lines.slice(from2);
          delta.start.row = row + from2;
          delta.start.column = column2;
          this.applyDelta(delta, true);
        };
        Document2.prototype.revertDelta = function(delta) {
          this.$safeApplyDelta({
            start: this.clonePos(delta.start),
            end: this.clonePos(delta.end),
            action: delta.action == "insert" ? "remove" : "insert",
            lines: delta.lines.slice()
          });
        };
        Document2.prototype.indexToPosition = function(index2, startRow) {
          var lines = this.$lines || this.getAllLines();
          var newlineLength = this.getNewLineCharacter().length;
          for (var i2 = startRow || 0, l2 = lines.length; i2 < l2; i2++) {
            index2 -= lines[i2].length + newlineLength;
            if (index2 < 0)
              return { row: i2, column: index2 + lines[i2].length + newlineLength };
          }
          return { row: l2 - 1, column: index2 + lines[l2 - 1].length + newlineLength };
        };
        Document2.prototype.positionToIndex = function(pos, startRow) {
          var lines = this.$lines || this.getAllLines();
          var newlineLength = this.getNewLineCharacter().length;
          var index2 = 0;
          var row = Math.min(pos.row, lines.length);
          for (var i2 = startRow || 0; i2 < row; ++i2)
            index2 += lines[i2].length + newlineLength;
          return index2 + pos.column;
        };
        Document2.prototype.$split = function(text2) {
          return text2.split(/\r\n|\r|\n/);
        };
        return Document2;
      }()
    );
    Document.prototype.$autoNewLine = "";
    Document.prototype.$newLineMode = "auto";
    oop.implement(Document.prototype, EventEmitter2);
    exports3.Document = Document;
  });
  ace.define("ace/background_tokenizer", ["require", "exports", "module", "ace/lib/oop", "ace/lib/event_emitter"], function(require2, exports3, module3) {
    var oop = require2("./lib/oop");
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var BackgroundTokenizer = (
      /** @class */
      function() {
        function BackgroundTokenizer2(tokenizer, session) {
          this.running = false;
          this.lines = [];
          this.states = [];
          this.currentLine = 0;
          this.tokenizer = tokenizer;
          var self2 = this;
          this.$worker = function() {
            if (!self2.running) {
              return;
            }
            var workerStart = /* @__PURE__ */ new Date();
            var currentLine = self2.currentLine;
            var endLine = -1;
            var doc = self2.doc;
            var startLine = currentLine;
            while (self2.lines[currentLine])
              currentLine++;
            var len = doc.getLength();
            var processedLines = 0;
            self2.running = false;
            while (currentLine < len) {
              self2.$tokenizeRow(currentLine);
              endLine = currentLine;
              do {
                currentLine++;
              } while (self2.lines[currentLine]);
              processedLines++;
              if (processedLines % 5 === 0 && /* @__PURE__ */ new Date() - workerStart > 20) {
                self2.running = setTimeout(self2.$worker, 20);
                break;
              }
            }
            self2.currentLine = currentLine;
            if (endLine == -1)
              endLine = currentLine;
            if (startLine <= endLine)
              self2.fireUpdateEvent(startLine, endLine);
          };
        }
        BackgroundTokenizer2.prototype.setTokenizer = function(tokenizer) {
          this.tokenizer = tokenizer;
          this.lines = [];
          this.states = [];
          this.start(0);
        };
        BackgroundTokenizer2.prototype.setDocument = function(doc) {
          this.doc = doc;
          this.lines = [];
          this.states = [];
          this.stop();
        };
        BackgroundTokenizer2.prototype.fireUpdateEvent = function(firstRow, lastRow) {
          var data = {
            first: firstRow,
            last: lastRow
          };
          this._signal("update", { data });
        };
        BackgroundTokenizer2.prototype.start = function(startRow) {
          this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength());
          this.lines.splice(this.currentLine, this.lines.length);
          this.states.splice(this.currentLine, this.states.length);
          this.stop();
          this.running = setTimeout(this.$worker, 700);
        };
        BackgroundTokenizer2.prototype.scheduleStart = function() {
          if (!this.running)
            this.running = setTimeout(this.$worker, 700);
        };
        BackgroundTokenizer2.prototype.$updateOnChange = function(delta) {
          var startRow = delta.start.row;
          var len = delta.end.row - startRow;
          if (len === 0) {
            this.lines[startRow] = null;
          } else if (delta.action == "remove") {
            this.lines.splice(startRow, len + 1, null);
            this.states.splice(startRow, len + 1, null);
          } else {
            var args = Array(len + 1);
            args.unshift(startRow, 1);
            this.lines.splice.apply(this.lines, args);
            this.states.splice.apply(this.states, args);
          }
          this.currentLine = Math.min(startRow, this.currentLine, this.doc.getLength());
          this.stop();
        };
        BackgroundTokenizer2.prototype.stop = function() {
          if (this.running)
            clearTimeout(this.running);
          this.running = false;
        };
        BackgroundTokenizer2.prototype.getTokens = function(row) {
          return this.lines[row] || this.$tokenizeRow(row);
        };
        BackgroundTokenizer2.prototype.getState = function(row) {
          if (this.currentLine == row)
            this.$tokenizeRow(row);
          return this.states[row] || "start";
        };
        BackgroundTokenizer2.prototype.$tokenizeRow = function(row) {
          var line2 = this.doc.getLine(row);
          var state = this.states[row - 1];
          var data = this.tokenizer.getLineTokens(line2, state, row);
          if (this.states[row] + "" !== data.state + "") {
            this.states[row] = data.state;
            this.lines[row + 1] = null;
            if (this.currentLine > row + 1)
              this.currentLine = row + 1;
          } else if (this.currentLine == row) {
            this.currentLine = row + 1;
          }
          return this.lines[row] = data.tokens;
        };
        BackgroundTokenizer2.prototype.cleanup = function() {
          this.running = false;
          this.lines = [];
          this.states = [];
          this.currentLine = 0;
          this.removeAllListeners();
        };
        return BackgroundTokenizer2;
      }()
    );
    oop.implement(BackgroundTokenizer.prototype, EventEmitter2);
    exports3.BackgroundTokenizer = BackgroundTokenizer;
  });
  ace.define("ace/search_highlight", ["require", "exports", "module", "ace/lib/lang", "ace/range"], function(require2, exports3, module3) {
    var lang2 = require2("./lib/lang");
    var Range2 = require2("./range").Range;
    var SearchHighlight = (
      /** @class */
      function() {
        function SearchHighlight2(regExp, clazz, type4) {
          if (type4 === void 0) {
            type4 = "text";
          }
          this.setRegexp(regExp);
          this.clazz = clazz;
          this.type = type4;
          this.docLen = 0;
        }
        SearchHighlight2.prototype.setRegexp = function(regExp) {
          if (this.regExp + "" == regExp + "")
            return;
          this.regExp = regExp;
          this.cache = [];
        };
        SearchHighlight2.prototype.update = function(html2, markerLayer, session, config2) {
          if (!this.regExp)
            return;
          var start2 = config2.firstRow;
          var end2 = config2.lastRow;
          var renderedMarkerRanges = {};
          var _search = session.$editor && session.$editor.$search;
          var mtSearch = _search && _search.$isMultilineSearch(session.$editor.getLastSearchOptions());
          for (var i2 = start2; i2 <= end2; i2++) {
            var ranges = this.cache[i2];
            if (ranges == null || session.getValue().length != this.docLen) {
              if (mtSearch) {
                ranges = [];
                var match5 = _search.$multiLineForward(session, this.regExp, i2, end2);
                if (match5) {
                  var end_row = match5.endRow <= end2 ? match5.endRow - 1 : end2;
                  if (end_row > i2)
                    i2 = end_row;
                  ranges.push(new Range2(match5.startRow, match5.startCol, match5.endRow, match5.endCol));
                }
                if (ranges.length > this.MAX_RANGES)
                  ranges = ranges.slice(0, this.MAX_RANGES);
              } else {
                ranges = lang2.getMatchOffsets(session.getLine(i2), this.regExp);
                if (ranges.length > this.MAX_RANGES)
                  ranges = ranges.slice(0, this.MAX_RANGES);
                ranges = ranges.map(function(match7) {
                  return new Range2(i2, match7.offset, i2, match7.offset + match7.length);
                });
              }
              this.cache[i2] = ranges.length ? ranges : "";
            }
            if (ranges.length === 0)
              continue;
            for (var j2 = ranges.length; j2--; ) {
              var rangeToAddMarkerTo = ranges[j2].toScreenRange(session);
              var rangeAsString = rangeToAddMarkerTo.toString();
              if (renderedMarkerRanges[rangeAsString])
                continue;
              renderedMarkerRanges[rangeAsString] = true;
              markerLayer.drawSingleLineMarker(html2, rangeToAddMarkerTo, this.clazz, config2);
            }
          }
          this.docLen = session.getValue().length;
        };
        return SearchHighlight2;
      }()
    );
    SearchHighlight.prototype.MAX_RANGES = 500;
    exports3.SearchHighlight = SearchHighlight;
  });
  ace.define("ace/undomanager", ["require", "exports", "module", "ace/range"], function(require2, exports3, module3) {
    var UndoManager = (
      /** @class */
      function() {
        function UndoManager2() {
          this.$keepRedoStack;
          this.$maxRev = 0;
          this.$fromUndo = false;
          this.$undoDepth = Infinity;
          this.reset();
        }
        UndoManager2.prototype.addSession = function(session) {
          this.$session = session;
        };
        UndoManager2.prototype.add = function(delta, allowMerge, session) {
          if (this.$fromUndo)
            return;
          if (delta == this.$lastDelta)
            return;
          if (!this.$keepRedoStack)
            this.$redoStack.length = 0;
          if (allowMerge === false || !this.lastDeltas) {
            this.lastDeltas = [];
            var undoStackLength = this.$undoStack.length;
            if (undoStackLength > this.$undoDepth - 1) {
              this.$undoStack.splice(0, undoStackLength - this.$undoDepth + 1);
            }
            this.$undoStack.push(this.lastDeltas);
            delta.id = this.$rev = ++this.$maxRev;
          }
          if (delta.action == "remove" || delta.action == "insert")
            this.$lastDelta = delta;
          this.lastDeltas.push(delta);
        };
        UndoManager2.prototype.addSelection = function(selection, rev) {
          this.selections.push({
            value: selection,
            rev: rev || this.$rev
          });
        };
        UndoManager2.prototype.startNewGroup = function() {
          this.lastDeltas = null;
          return this.$rev;
        };
        UndoManager2.prototype.markIgnored = function(from2, to2) {
          if (to2 == null)
            to2 = this.$rev + 1;
          var stack = this.$undoStack;
          for (var i2 = stack.length; i2--; ) {
            var delta = stack[i2][0];
            if (delta.id <= from2)
              break;
            if (delta.id < to2)
              delta.ignore = true;
          }
          this.lastDeltas = null;
        };
        UndoManager2.prototype.getSelection = function(rev, after) {
          var stack = this.selections;
          for (var i2 = stack.length; i2--; ) {
            var selection = stack[i2];
            if (selection.rev < rev) {
              if (after)
                selection = stack[i2 + 1];
              return selection;
            }
          }
        };
        UndoManager2.prototype.getRevision = function() {
          return this.$rev;
        };
        UndoManager2.prototype.getDeltas = function(from2, to2) {
          if (to2 == null)
            to2 = this.$rev + 1;
          var stack = this.$undoStack;
          var end2 = null, start2 = 0;
          for (var i2 = stack.length; i2--; ) {
            var delta = stack[i2][0];
            if (delta.id < to2 && !end2)
              end2 = i2 + 1;
            if (delta.id <= from2) {
              start2 = i2 + 1;
              break;
            }
          }
          return stack.slice(start2, end2);
        };
        UndoManager2.prototype.getChangedRanges = function(from2, to2) {
          if (to2 == null)
            to2 = this.$rev + 1;
        };
        UndoManager2.prototype.getChangedLines = function(from2, to2) {
          if (to2 == null)
            to2 = this.$rev + 1;
        };
        UndoManager2.prototype.undo = function(session, dontSelect) {
          this.lastDeltas = null;
          var stack = this.$undoStack;
          if (!rearrangeUndoStack(stack, stack.length))
            return;
          if (!session)
            session = this.$session;
          if (this.$redoStackBaseRev !== this.$rev && this.$redoStack.length)
            this.$redoStack = [];
          this.$fromUndo = true;
          var deltaSet = stack.pop();
          var undoSelectionRange = null;
          if (deltaSet) {
            undoSelectionRange = session.undoChanges(deltaSet, dontSelect);
            this.$redoStack.push(deltaSet);
            this.$syncRev();
          }
          this.$fromUndo = false;
          return undoSelectionRange;
        };
        UndoManager2.prototype.redo = function(session, dontSelect) {
          this.lastDeltas = null;
          if (!session)
            session = this.$session;
          this.$fromUndo = true;
          if (this.$redoStackBaseRev != this.$rev) {
            var diff2 = this.getDeltas(this.$redoStackBaseRev, this.$rev + 1);
            rebaseRedoStack(this.$redoStack, diff2);
            this.$redoStackBaseRev = this.$rev;
            this.$redoStack.forEach(function(x2) {
              x2[0].id = ++this.$maxRev;
            }, this);
          }
          var deltaSet = this.$redoStack.pop();
          var redoSelectionRange = null;
          if (deltaSet) {
            redoSelectionRange = session.redoChanges(deltaSet, dontSelect);
            this.$undoStack.push(deltaSet);
            this.$syncRev();
          }
          this.$fromUndo = false;
          return redoSelectionRange;
        };
        UndoManager2.prototype.$syncRev = function() {
          var stack = this.$undoStack;
          var nextDelta = stack[stack.length - 1];
          var id2 = nextDelta && nextDelta[0].id || 0;
          this.$redoStackBaseRev = id2;
          this.$rev = id2;
        };
        UndoManager2.prototype.reset = function() {
          this.lastDeltas = null;
          this.$lastDelta = null;
          this.$undoStack = [];
          this.$redoStack = [];
          this.$rev = 0;
          this.mark = 0;
          this.$redoStackBaseRev = this.$rev;
          this.selections = [];
        };
        UndoManager2.prototype.canUndo = function() {
          return this.$undoStack.length > 0;
        };
        UndoManager2.prototype.canRedo = function() {
          return this.$redoStack.length > 0;
        };
        UndoManager2.prototype.bookmark = function(rev) {
          if (rev == void 0)
            rev = this.$rev;
          this.mark = rev;
        };
        UndoManager2.prototype.isAtBookmark = function() {
          return this.$rev === this.mark;
        };
        UndoManager2.prototype.toJSON = function() {
          return {
            $redoStack: this.$redoStack,
            $undoStack: this.$undoStack
          };
        };
        UndoManager2.prototype.fromJSON = function(json) {
          this.reset();
          this.$undoStack = json.$undoStack;
          this.$redoStack = json.$redoStack;
        };
        UndoManager2.prototype.$prettyPrint = function(delta) {
          if (delta)
            return stringifyDelta(delta);
          return stringifyDelta(this.$undoStack) + "\n---\n" + stringifyDelta(this.$redoStack);
        };
        return UndoManager2;
      }()
    );
    UndoManager.prototype.hasUndo = UndoManager.prototype.canUndo;
    UndoManager.prototype.hasRedo = UndoManager.prototype.canRedo;
    UndoManager.prototype.isClean = UndoManager.prototype.isAtBookmark;
    UndoManager.prototype.markClean = UndoManager.prototype.bookmark;
    function rearrangeUndoStack(stack, pos) {
      for (var i2 = pos; i2--; ) {
        var deltaSet = stack[i2];
        if (deltaSet && !deltaSet[0].ignore) {
          while (i2 < pos - 1) {
            var swapped = swapGroups(stack[i2], stack[i2 + 1]);
            stack[i2] = swapped[0];
            stack[i2 + 1] = swapped[1];
            i2++;
          }
          return true;
        }
      }
    }
    var Range2 = require2("./range").Range;
    var cmp = Range2.comparePoints;
    Range2.comparePoints;
    function clonePos(pos) {
      return { row: pos.row, column: pos.column };
    }
    function cloneDelta(d2) {
      return {
        start: clonePos(d2.start),
        end: clonePos(d2.end),
        action: d2.action,
        lines: d2.lines.slice()
      };
    }
    function stringifyDelta(d2) {
      d2 = d2 || this;
      if (Array.isArray(d2)) {
        return d2.map(stringifyDelta).join("\n");
      }
      var type4 = "";
      if (d2.action) {
        type4 = d2.action == "insert" ? "+" : "-";
        type4 += "[" + d2.lines + "]";
      } else if (d2.value) {
        if (Array.isArray(d2.value)) {
          type4 = d2.value.map(stringifyRange).join("\n");
        } else {
          type4 = stringifyRange(d2.value);
        }
      }
      if (d2.start) {
        type4 += stringifyRange(d2);
      }
      if (d2.id || d2.rev) {
        type4 += "	(" + (d2.id || d2.rev) + ")";
      }
      return type4;
    }
    function stringifyRange(r2) {
      return r2.start.row + ":" + r2.start.column + "=>" + r2.end.row + ":" + r2.end.column;
    }
    function swap2(d1, d2) {
      var i1 = d1.action == "insert";
      var i2 = d2.action == "insert";
      if (i1 && i2) {
        if (cmp(d2.start, d1.end) >= 0) {
          shift(d2, d1, -1);
        } else if (cmp(d2.start, d1.start) <= 0) {
          shift(d1, d2, 1);
        } else {
          return null;
        }
      } else if (i1 && !i2) {
        if (cmp(d2.start, d1.end) >= 0) {
          shift(d2, d1, -1);
        } else if (cmp(d2.end, d1.start) <= 0) {
          shift(d1, d2, -1);
        } else {
          return null;
        }
      } else if (!i1 && i2) {
        if (cmp(d2.start, d1.start) >= 0) {
          shift(d2, d1, 1);
        } else if (cmp(d2.start, d1.start) <= 0) {
          shift(d1, d2, 1);
        } else {
          return null;
        }
      } else if (!i1 && !i2) {
        if (cmp(d2.start, d1.start) >= 0) {
          shift(d2, d1, 1);
        } else if (cmp(d2.end, d1.start) <= 0) {
          shift(d1, d2, -1);
        } else {
          return null;
        }
      }
      return [d2, d1];
    }
    function swapGroups(ds1, ds2) {
      for (var i2 = ds1.length; i2--; ) {
        for (var j2 = 0; j2 < ds2.length; j2++) {
          if (!swap2(ds1[i2], ds2[j2])) {
            while (i2 < ds1.length) {
              while (j2--) {
                swap2(ds2[j2], ds1[i2]);
              }
              j2 = ds2.length;
              i2++;
            }
            return [ds1, ds2];
          }
        }
      }
      ds1.selectionBefore = ds2.selectionBefore = ds1.selectionAfter = ds2.selectionAfter = null;
      return [ds2, ds1];
    }
    function xform(d1, c1) {
      var i1 = d1.action == "insert";
      var i2 = c1.action == "insert";
      if (i1 && i2) {
        if (cmp(d1.start, c1.start) < 0) {
          shift(c1, d1, 1);
        } else {
          shift(d1, c1, 1);
        }
      } else if (i1 && !i2) {
        if (cmp(d1.start, c1.end) >= 0) {
          shift(d1, c1, -1);
        } else if (cmp(d1.start, c1.start) <= 0) {
          shift(c1, d1, 1);
        } else {
          shift(d1, Range2.fromPoints(c1.start, d1.start), -1);
          shift(c1, d1, 1);
        }
      } else if (!i1 && i2) {
        if (cmp(c1.start, d1.end) >= 0) {
          shift(c1, d1, -1);
        } else if (cmp(c1.start, d1.start) <= 0) {
          shift(d1, c1, 1);
        } else {
          shift(c1, Range2.fromPoints(d1.start, c1.start), -1);
          shift(d1, c1, 1);
        }
      } else if (!i1 && !i2) {
        if (cmp(c1.start, d1.end) >= 0) {
          shift(c1, d1, -1);
        } else if (cmp(c1.end, d1.start) <= 0) {
          shift(d1, c1, -1);
        } else {
          var before, after;
          if (cmp(d1.start, c1.start) < 0) {
            before = d1;
            d1 = splitDelta(d1, c1.start);
          }
          if (cmp(d1.end, c1.end) > 0) {
            after = splitDelta(d1, c1.end);
          }
          shiftPos(c1.end, d1.start, d1.end, -1);
          if (after && !before) {
            d1.lines = after.lines;
            d1.start = after.start;
            d1.end = after.end;
            after = d1;
          }
          return [c1, before, after].filter(Boolean);
        }
      }
      return [c1, d1];
    }
    function shift(d1, d2, dir) {
      shiftPos(d1.start, d2.start, d2.end, dir);
      shiftPos(d1.end, d2.start, d2.end, dir);
    }
    function shiftPos(pos, start2, end2, dir) {
      if (pos.row == (dir == 1 ? start2 : end2).row) {
        pos.column += dir * (end2.column - start2.column);
      }
      pos.row += dir * (end2.row - start2.row);
    }
    function splitDelta(c2, pos) {
      var lines = c2.lines;
      var end2 = c2.end;
      c2.end = clonePos(pos);
      var rowsBefore = c2.end.row - c2.start.row;
      var otherLines = lines.splice(rowsBefore, lines.length);
      var col = rowsBefore ? pos.column : pos.column - c2.start.column;
      lines.push(otherLines[0].substring(0, col));
      otherLines[0] = otherLines[0].substr(col);
      var rest = {
        start: clonePos(pos),
        end: end2,
        lines: otherLines,
        action: c2.action
      };
      return rest;
    }
    function moveDeltasByOne(redoStack, d2) {
      d2 = cloneDelta(d2);
      for (var j2 = redoStack.length; j2--; ) {
        var deltaSet = redoStack[j2];
        for (var i2 = 0; i2 < deltaSet.length; i2++) {
          var x2 = deltaSet[i2];
          var xformed = xform(x2, d2);
          d2 = xformed[0];
          if (xformed.length != 2) {
            if (xformed[2]) {
              deltaSet.splice(i2 + 1, 1, xformed[1], xformed[2]);
              i2++;
            } else if (!xformed[1]) {
              deltaSet.splice(i2, 1);
              i2--;
            }
          }
        }
        if (!deltaSet.length) {
          redoStack.splice(j2, 1);
        }
      }
      return redoStack;
    }
    function rebaseRedoStack(redoStack, deltaSets) {
      for (var i2 = 0; i2 < deltaSets.length; i2++) {
        var deltas = deltaSets[i2];
        for (var j2 = 0; j2 < deltas.length; j2++) {
          moveDeltasByOne(redoStack, deltas[j2]);
        }
      }
    }
    exports3.UndoManager = UndoManager;
  });
  ace.define("ace/edit_session/fold_line", ["require", "exports", "module", "ace/range"], function(require2, exports3, module3) {
    var Range2 = require2("../range").Range;
    var FoldLine = (
      /** @class */
      function() {
        function FoldLine2(foldData, folds) {
          this.foldData = foldData;
          if (Array.isArray(folds)) {
            this.folds = folds;
          } else {
            folds = this.folds = [folds];
          }
          var last = folds[folds.length - 1];
          this.range = new Range2(folds[0].start.row, folds[0].start.column, last.end.row, last.end.column);
          this.start = this.range.start;
          this.end = this.range.end;
          this.folds.forEach(function(fold) {
            fold.setFoldLine(this);
          }, this);
        }
        FoldLine2.prototype.shiftRow = function(shift) {
          this.start.row += shift;
          this.end.row += shift;
          this.folds.forEach(function(fold) {
            fold.start.row += shift;
            fold.end.row += shift;
          });
        };
        FoldLine2.prototype.addFold = function(fold) {
          if (fold.sameRow) {
            if (fold.start.row < this.startRow || fold.endRow > this.endRow) {
              throw new Error("Can't add a fold to this FoldLine as it has no connection");
            }
            this.folds.push(fold);
            this.folds.sort(function(a2, b2) {
              return -a2.range.compareEnd(b2.start.row, b2.start.column);
            });
            if (this.range.compareEnd(fold.start.row, fold.start.column) > 0) {
              this.end.row = fold.end.row;
              this.end.column = fold.end.column;
            } else if (this.range.compareStart(fold.end.row, fold.end.column) < 0) {
              this.start.row = fold.start.row;
              this.start.column = fold.start.column;
            }
          } else if (fold.start.row == this.end.row) {
            this.folds.push(fold);
            this.end.row = fold.end.row;
            this.end.column = fold.end.column;
          } else if (fold.end.row == this.start.row) {
            this.folds.unshift(fold);
            this.start.row = fold.start.row;
            this.start.column = fold.start.column;
          } else {
            throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");
          }
          fold.foldLine = this;
        };
        FoldLine2.prototype.containsRow = function(row) {
          return row >= this.start.row && row <= this.end.row;
        };
        FoldLine2.prototype.walk = function(callback2, endRow, endColumn) {
          var lastEnd = 0, folds = this.folds, fold, cmp, stop, isNewRow = true;
          if (endRow == null) {
            endRow = this.end.row;
            endColumn = this.end.column;
          }
          for (var i2 = 0; i2 < folds.length; i2++) {
            fold = folds[i2];
            cmp = fold.range.compareStart(endRow, endColumn);
            if (cmp == -1) {
              callback2(null, endRow, endColumn, lastEnd, isNewRow);
              return;
            }
            stop = callback2(null, fold.start.row, fold.start.column, lastEnd, isNewRow);
            stop = !stop && callback2(fold.placeholder, fold.start.row, fold.start.column, lastEnd);
            if (stop || cmp === 0) {
              return;
            }
            isNewRow = !fold.sameRow;
            lastEnd = fold.end.column;
          }
          callback2(null, endRow, endColumn, lastEnd, isNewRow);
        };
        FoldLine2.prototype.getNextFoldTo = function(row, column2) {
          var fold, cmp;
          for (var i2 = 0; i2 < this.folds.length; i2++) {
            fold = this.folds[i2];
            cmp = fold.range.compareEnd(row, column2);
            if (cmp == -1) {
              return {
                fold,
                kind: "after"
              };
            } else if (cmp === 0) {
              return {
                fold,
                kind: "inside"
              };
            }
          }
          return null;
        };
        FoldLine2.prototype.addRemoveChars = function(row, column2, len) {
          var ret = this.getNextFoldTo(row, column2), fold, folds;
          if (ret) {
            fold = ret.fold;
            if (ret.kind == "inside" && fold.start.column != column2 && fold.start.row != row) {
              window.console && window.console.log(row, column2, fold);
            } else if (fold.start.row == row) {
              folds = this.folds;
              var i2 = folds.indexOf(fold);
              if (i2 === 0) {
                this.start.column += len;
              }
              for (i2; i2 < folds.length; i2++) {
                fold = folds[i2];
                fold.start.column += len;
                if (!fold.sameRow) {
                  return;
                }
                fold.end.column += len;
              }
              this.end.column += len;
            }
          }
        };
        FoldLine2.prototype.split = function(row, column2) {
          var pos = this.getNextFoldTo(row, column2);
          if (!pos || pos.kind == "inside")
            return null;
          var fold = pos.fold;
          var folds = this.folds;
          var foldData = this.foldData;
          var i2 = folds.indexOf(fold);
          var foldBefore = folds[i2 - 1];
          this.end.row = foldBefore.end.row;
          this.end.column = foldBefore.end.column;
          folds = folds.splice(i2, folds.length - i2);
          var newFoldLine = new FoldLine2(foldData, folds);
          foldData.splice(foldData.indexOf(this) + 1, 0, newFoldLine);
          return newFoldLine;
        };
        FoldLine2.prototype.merge = function(foldLineNext) {
          var folds = foldLineNext.folds;
          for (var i2 = 0; i2 < folds.length; i2++) {
            this.addFold(folds[i2]);
          }
          var foldData = this.foldData;
          foldData.splice(foldData.indexOf(foldLineNext), 1);
        };
        FoldLine2.prototype.toString = function() {
          var ret = [this.range.toString() + ": ["];
          this.folds.forEach(function(fold) {
            ret.push("  " + fold.toString());
          });
          ret.push("]");
          return ret.join("\n");
        };
        FoldLine2.prototype.idxToPosition = function(idx) {
          var lastFoldEndColumn = 0;
          for (var i2 = 0; i2 < this.folds.length; i2++) {
            var fold = this.folds[i2];
            idx -= fold.start.column - lastFoldEndColumn;
            if (idx < 0) {
              return {
                row: fold.start.row,
                column: fold.start.column + idx
              };
            }
            idx -= fold.placeholder.length;
            if (idx < 0) {
              return fold.start;
            }
            lastFoldEndColumn = fold.end.column;
          }
          return {
            row: this.end.row,
            column: this.end.column + idx
          };
        };
        return FoldLine2;
      }()
    );
    exports3.FoldLine = FoldLine;
  });
  ace.define("ace/range_list", ["require", "exports", "module", "ace/range"], function(require2, exports3, module3) {
    var Range2 = require2("./range").Range;
    var comparePoints = Range2.comparePoints;
    var RangeList = (
      /** @class */
      function() {
        function RangeList2() {
          this.ranges = [];
          this.$bias = 1;
        }
        RangeList2.prototype.pointIndex = function(pos, excludeEdges, startIndex) {
          var list2 = this.ranges;
          for (var i2 = startIndex || 0; i2 < list2.length; i2++) {
            var range3 = list2[i2];
            var cmpEnd = comparePoints(pos, range3.end);
            if (cmpEnd > 0)
              continue;
            var cmpStart = comparePoints(pos, range3.start);
            if (cmpEnd === 0)
              return excludeEdges && cmpStart !== 0 ? -i2 - 2 : i2;
            if (cmpStart > 0 || cmpStart === 0 && !excludeEdges)
              return i2;
            return -i2 - 1;
          }
          return -i2 - 1;
        };
        RangeList2.prototype.add = function(range3) {
          var excludeEdges = !range3.isEmpty();
          var startIndex = this.pointIndex(range3.start, excludeEdges);
          if (startIndex < 0)
            startIndex = -startIndex - 1;
          var endIndex = this.pointIndex(range3.end, excludeEdges, startIndex);
          if (endIndex < 0)
            endIndex = -endIndex - 1;
          else
            endIndex++;
          return this.ranges.splice(startIndex, endIndex - startIndex, range3);
        };
        RangeList2.prototype.addList = function(list2) {
          var removed = [];
          for (var i2 = list2.length; i2--; ) {
            removed.push.apply(removed, this.add(list2[i2]));
          }
          return removed;
        };
        RangeList2.prototype.substractPoint = function(pos) {
          var i2 = this.pointIndex(pos);
          if (i2 >= 0)
            return this.ranges.splice(i2, 1);
        };
        RangeList2.prototype.merge = function() {
          var removed = [];
          var list2 = this.ranges;
          list2 = list2.sort(function(a2, b2) {
            return comparePoints(a2.start, b2.start);
          });
          var next2 = list2[0], range3;
          for (var i2 = 1; i2 < list2.length; i2++) {
            range3 = next2;
            next2 = list2[i2];
            var cmp = comparePoints(range3.end, next2.start);
            if (cmp < 0)
              continue;
            if (cmp == 0 && !range3.isEmpty() && !next2.isEmpty())
              continue;
            if (comparePoints(range3.end, next2.end) < 0) {
              range3.end.row = next2.end.row;
              range3.end.column = next2.end.column;
            }
            list2.splice(i2, 1);
            removed.push(next2);
            next2 = range3;
            i2--;
          }
          this.ranges = list2;
          return removed;
        };
        RangeList2.prototype.contains = function(row, column2) {
          return this.pointIndex({ row, column: column2 }) >= 0;
        };
        RangeList2.prototype.containsPoint = function(pos) {
          return this.pointIndex(pos) >= 0;
        };
        RangeList2.prototype.rangeAtPoint = function(pos) {
          var i2 = this.pointIndex(pos);
          if (i2 >= 0)
            return this.ranges[i2];
        };
        RangeList2.prototype.clipRows = function(startRow, endRow) {
          var list2 = this.ranges;
          if (list2[0].start.row > endRow || list2[list2.length - 1].start.row < startRow)
            return [];
          var startIndex = this.pointIndex({ row: startRow, column: 0 });
          if (startIndex < 0)
            startIndex = -startIndex - 1;
          var endIndex = this.pointIndex({ row: endRow, column: 0 }, startIndex);
          if (endIndex < 0)
            endIndex = -endIndex - 1;
          var clipped = [];
          for (var i2 = startIndex; i2 < endIndex; i2++) {
            clipped.push(list2[i2]);
          }
          return clipped;
        };
        RangeList2.prototype.removeAll = function() {
          return this.ranges.splice(0, this.ranges.length);
        };
        RangeList2.prototype.attach = function(session) {
          if (this.session)
            this.detach();
          this.session = session;
          this.onChange = this.$onChange.bind(this);
          this.session.on("change", this.onChange);
        };
        RangeList2.prototype.detach = function() {
          if (!this.session)
            return;
          this.session.removeListener("change", this.onChange);
          this.session = null;
        };
        RangeList2.prototype.$onChange = function(delta) {
          var start2 = delta.start;
          var end2 = delta.end;
          var startRow = start2.row;
          var endRow = end2.row;
          var ranges = this.ranges;
          for (var i2 = 0, n2 = ranges.length; i2 < n2; i2++) {
            var r2 = ranges[i2];
            if (r2.end.row >= startRow)
              break;
          }
          if (delta.action == "insert") {
            var lineDif = endRow - startRow;
            var colDiff = -start2.column + end2.column;
            for (; i2 < n2; i2++) {
              var r2 = ranges[i2];
              if (r2.start.row > startRow)
                break;
              if (r2.start.row == startRow && r2.start.column >= start2.column) {
                if (r2.start.column == start2.column && this.$bias <= 0)
                  ;
                else {
                  r2.start.column += colDiff;
                  r2.start.row += lineDif;
                }
              }
              if (r2.end.row == startRow && r2.end.column >= start2.column) {
                if (r2.end.column == start2.column && this.$bias < 0) {
                  continue;
                }
                if (r2.end.column == start2.column && colDiff > 0 && i2 < n2 - 1) {
                  if (r2.end.column > r2.start.column && r2.end.column == ranges[i2 + 1].start.column)
                    r2.end.column -= colDiff;
                }
                r2.end.column += colDiff;
                r2.end.row += lineDif;
              }
            }
          } else {
            var lineDif = startRow - endRow;
            var colDiff = start2.column - end2.column;
            for (; i2 < n2; i2++) {
              var r2 = ranges[i2];
              if (r2.start.row > endRow)
                break;
              if (r2.end.row < endRow && (startRow < r2.end.row || startRow == r2.end.row && start2.column < r2.end.column)) {
                r2.end.row = startRow;
                r2.end.column = start2.column;
              } else if (r2.end.row == endRow) {
                if (r2.end.column <= end2.column) {
                  if (lineDif || r2.end.column > start2.column) {
                    r2.end.column = start2.column;
                    r2.end.row = start2.row;
                  }
                } else {
                  r2.end.column += colDiff;
                  r2.end.row += lineDif;
                }
              } else if (r2.end.row > endRow) {
                r2.end.row += lineDif;
              }
              if (r2.start.row < endRow && (startRow < r2.start.row || startRow == r2.start.row && start2.column < r2.start.column)) {
                r2.start.row = startRow;
                r2.start.column = start2.column;
              } else if (r2.start.row == endRow) {
                if (r2.start.column <= end2.column) {
                  if (lineDif || r2.start.column > start2.column) {
                    r2.start.column = start2.column;
                    r2.start.row = start2.row;
                  }
                } else {
                  r2.start.column += colDiff;
                  r2.start.row += lineDif;
                }
              } else if (r2.start.row > endRow) {
                r2.start.row += lineDif;
              }
            }
          }
          if (lineDif != 0 && i2 < n2) {
            for (; i2 < n2; i2++) {
              var r2 = ranges[i2];
              r2.start.row += lineDif;
              r2.end.row += lineDif;
            }
          }
        };
        return RangeList2;
      }()
    );
    RangeList.prototype.comparePoints = comparePoints;
    exports3.RangeList = RangeList;
  });
  ace.define("ace/edit_session/fold", ["require", "exports", "module", "ace/range_list"], function(require2, exports3, module3) {
    var __extends2 = this && this.__extends || /* @__PURE__ */ function() {
      var extendStatics = function(d2, b2) {
        extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
          d3.__proto__ = b3;
        } || function(d3, b3) {
          for (var p2 in b3)
            if (Object.prototype.hasOwnProperty.call(b3, p2))
              d3[p2] = b3[p2];
        };
        return extendStatics(d2, b2);
      };
      return function(d2, b2) {
        if (typeof b2 !== "function" && b2 !== null)
          throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
        extendStatics(d2, b2);
        function __() {
          this.constructor = d2;
        }
        d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
      };
    }();
    var RangeList = require2("../range_list").RangeList;
    var Fold = (
      /** @class */
      function(_super) {
        __extends2(Fold2, _super);
        function Fold2(range3, placeholder) {
          var _this = _super.call(this) || this;
          _this.foldLine = null;
          _this.placeholder = placeholder;
          _this.range = range3;
          _this.start = range3.start;
          _this.end = range3.end;
          _this.sameRow = range3.start.row == range3.end.row;
          _this.subFolds = _this.ranges = [];
          return _this;
        }
        Fold2.prototype.toString = function() {
          return '"' + this.placeholder + '" ' + this.range.toString();
        };
        Fold2.prototype.setFoldLine = function(foldLine) {
          this.foldLine = foldLine;
          this.subFolds.forEach(function(fold) {
            fold.setFoldLine(foldLine);
          });
        };
        Fold2.prototype.clone = function() {
          var range3 = this.range.clone();
          var fold = new Fold2(range3, this.placeholder);
          this.subFolds.forEach(function(subFold) {
            fold.subFolds.push(subFold.clone());
          });
          fold.collapseChildren = this.collapseChildren;
          return fold;
        };
        Fold2.prototype.addSubFold = function(fold) {
          if (this.range.isEqual(fold))
            return;
          consumeRange(fold, this.start);
          var row = fold.start.row, column2 = fold.start.column;
          for (var i2 = 0, cmp = -1; i2 < this.subFolds.length; i2++) {
            cmp = this.subFolds[i2].range.compare(row, column2);
            if (cmp != 1)
              break;
          }
          var afterStart = this.subFolds[i2];
          var firstConsumed = 0;
          if (cmp == 0) {
            if (afterStart.range.containsRange(fold))
              return afterStart.addSubFold(fold);
            else
              firstConsumed = 1;
          }
          var row = fold.range.end.row, column2 = fold.range.end.column;
          for (var j2 = i2, cmp = -1; j2 < this.subFolds.length; j2++) {
            cmp = this.subFolds[j2].range.compare(row, column2);
            if (cmp != 1)
              break;
          }
          if (cmp == 0)
            j2++;
          var consumedFolds = this.subFolds.splice(i2, j2 - i2, fold);
          var last = cmp == 0 ? consumedFolds.length - 1 : consumedFolds.length;
          for (var k2 = firstConsumed; k2 < last; k2++) {
            fold.addSubFold(consumedFolds[k2]);
          }
          fold.setFoldLine(this.foldLine);
          return fold;
        };
        Fold2.prototype.restoreRange = function(range3) {
          return restoreRange(range3, this.start);
        };
        return Fold2;
      }(RangeList)
    );
    function consumePoint(point2, anchor) {
      point2.row -= anchor.row;
      if (point2.row == 0)
        point2.column -= anchor.column;
    }
    function consumeRange(range3, anchor) {
      consumePoint(range3.start, anchor);
      consumePoint(range3.end, anchor);
    }
    function restorePoint(point2, anchor) {
      if (point2.row == 0)
        point2.column += anchor.column;
      point2.row += anchor.row;
    }
    function restoreRange(range3, anchor) {
      restorePoint(range3.start, anchor);
      restorePoint(range3.end, anchor);
    }
    exports3.Fold = Fold;
  });
  ace.define("ace/edit_session/folding", ["require", "exports", "module", "ace/range", "ace/edit_session/fold_line", "ace/edit_session/fold", "ace/token_iterator", "ace/mouse/mouse_event"], function(require2, exports3, module3) {
    var Range2 = require2("../range").Range;
    var FoldLine = require2("./fold_line").FoldLine;
    var Fold = require2("./fold").Fold;
    var TokenIterator = require2("../token_iterator").TokenIterator;
    var MouseEvent2 = require2("../mouse/mouse_event").MouseEvent;
    function Folding() {
      this.getFoldAt = function(row, column2, side) {
        var foldLine = this.getFoldLine(row);
        if (!foldLine)
          return null;
        var folds = foldLine.folds;
        for (var i2 = 0; i2 < folds.length; i2++) {
          var range3 = folds[i2].range;
          if (range3.contains(row, column2)) {
            if (side == 1 && range3.isEnd(row, column2) && !range3.isEmpty()) {
              continue;
            } else if (side == -1 && range3.isStart(row, column2) && !range3.isEmpty()) {
              continue;
            }
            return folds[i2];
          }
        }
      };
      this.getFoldsInRange = function(range3) {
        var start2 = range3.start;
        var end2 = range3.end;
        var foldLines = this.$foldData;
        var foundFolds = [];
        start2.column += 1;
        end2.column -= 1;
        for (var i2 = 0; i2 < foldLines.length; i2++) {
          var cmp = foldLines[i2].range.compareRange(range3);
          if (cmp == 2) {
            continue;
          } else if (cmp == -2) {
            break;
          }
          var folds = foldLines[i2].folds;
          for (var j2 = 0; j2 < folds.length; j2++) {
            var fold = folds[j2];
            cmp = fold.range.compareRange(range3);
            if (cmp == -2) {
              break;
            } else if (cmp == 2) {
              continue;
            } else if (cmp == 42) {
              break;
            }
            foundFolds.push(fold);
          }
        }
        start2.column -= 1;
        end2.column += 1;
        return foundFolds;
      };
      this.getFoldsInRangeList = function(ranges) {
        if (Array.isArray(ranges)) {
          var folds = [];
          ranges.forEach(function(range3) {
            folds = folds.concat(this.getFoldsInRange(range3));
          }, this);
        } else {
          var folds = this.getFoldsInRange(ranges);
        }
        return folds;
      };
      this.getAllFolds = function() {
        var folds = [];
        var foldLines = this.$foldData;
        for (var i2 = 0; i2 < foldLines.length; i2++)
          for (var j2 = 0; j2 < foldLines[i2].folds.length; j2++)
            folds.push(foldLines[i2].folds[j2]);
        return folds;
      };
      this.getFoldStringAt = function(row, column2, trim2, foldLine) {
        foldLine = foldLine || this.getFoldLine(row);
        if (!foldLine)
          return null;
        var lastFold = {
          end: { column: 0 }
        };
        var str, fold;
        for (var i2 = 0; i2 < foldLine.folds.length; i2++) {
          fold = foldLine.folds[i2];
          var cmp = fold.range.compareEnd(row, column2);
          if (cmp == -1) {
            str = this.getLine(fold.start.row).substring(lastFold.end.column, fold.start.column);
            break;
          } else if (cmp === 0) {
            return null;
          }
          lastFold = fold;
        }
        if (!str)
          str = this.getLine(fold.start.row).substring(lastFold.end.column);
        if (trim2 == -1)
          return str.substring(0, column2 - lastFold.end.column);
        else if (trim2 == 1)
          return str.substring(column2 - lastFold.end.column);
        else
          return str;
      };
      this.getFoldLine = function(docRow, startFoldLine) {
        var foldData = this.$foldData;
        var i2 = 0;
        if (startFoldLine)
          i2 = foldData.indexOf(startFoldLine);
        if (i2 == -1)
          i2 = 0;
        for (i2; i2 < foldData.length; i2++) {
          var foldLine = foldData[i2];
          if (foldLine.start.row <= docRow && foldLine.end.row >= docRow) {
            return foldLine;
          } else if (foldLine.end.row > docRow) {
            return null;
          }
        }
        return null;
      };
      this.getNextFoldLine = function(docRow, startFoldLine) {
        var foldData = this.$foldData;
        var i2 = 0;
        if (startFoldLine)
          i2 = foldData.indexOf(startFoldLine);
        if (i2 == -1)
          i2 = 0;
        for (i2; i2 < foldData.length; i2++) {
          var foldLine = foldData[i2];
          if (foldLine.end.row >= docRow) {
            return foldLine;
          }
        }
        return null;
      };
      this.getFoldedRowCount = function(first, last) {
        var foldData = this.$foldData, rowCount = last - first + 1;
        for (var i2 = 0; i2 < foldData.length; i2++) {
          var foldLine = foldData[i2], end2 = foldLine.end.row, start2 = foldLine.start.row;
          if (end2 >= last) {
            if (start2 < last) {
              if (start2 >= first)
                rowCount -= last - start2;
              else
                rowCount = 0;
            }
            break;
          } else if (end2 >= first) {
            if (start2 >= first)
              rowCount -= end2 - start2;
            else
              rowCount -= end2 - first + 1;
          }
        }
        return rowCount;
      };
      this.$addFoldLine = function(foldLine) {
        this.$foldData.push(foldLine);
        this.$foldData.sort(function(a2, b2) {
          return a2.start.row - b2.start.row;
        });
        return foldLine;
      };
      this.addFold = function(placeholder, range3) {
        var foldData = this.$foldData;
        var added = false;
        var fold;
        if (placeholder instanceof Fold)
          fold = placeholder;
        else {
          fold = new Fold(range3, placeholder);
          fold.collapseChildren = range3.collapseChildren;
        }
        this.$clipRangeToDocument(fold.range);
        var startRow = fold.start.row;
        var startColumn = fold.start.column;
        var endRow = fold.end.row;
        var endColumn = fold.end.column;
        var startFold = this.getFoldAt(startRow, startColumn, 1);
        var endFold = this.getFoldAt(endRow, endColumn, -1);
        if (startFold && endFold == startFold)
          return startFold.addSubFold(fold);
        if (startFold && !startFold.range.isStart(startRow, startColumn))
          this.removeFold(startFold);
        if (endFold && !endFold.range.isEnd(endRow, endColumn))
          this.removeFold(endFold);
        var folds = this.getFoldsInRange(fold.range);
        if (folds.length > 0) {
          this.removeFolds(folds);
          if (!fold.collapseChildren) {
            folds.forEach(function(subFold) {
              fold.addSubFold(subFold);
            });
          }
        }
        for (var i2 = 0; i2 < foldData.length; i2++) {
          var foldLine = foldData[i2];
          if (endRow == foldLine.start.row) {
            foldLine.addFold(fold);
            added = true;
            break;
          } else if (startRow == foldLine.end.row) {
            foldLine.addFold(fold);
            added = true;
            if (!fold.sameRow) {
              var foldLineNext = foldData[i2 + 1];
              if (foldLineNext && foldLineNext.start.row == endRow) {
                foldLine.merge(foldLineNext);
                break;
              }
            }
            break;
          } else if (endRow <= foldLine.start.row) {
            break;
          }
        }
        if (!added)
          foldLine = this.$addFoldLine(new FoldLine(this.$foldData, fold));
        if (this.$useWrapMode)
          this.$updateWrapData(foldLine.start.row, foldLine.start.row);
        else
          this.$updateRowLengthCache(foldLine.start.row, foldLine.start.row);
        this.$modified = true;
        this._signal("changeFold", { data: fold, action: "add" });
        return fold;
      };
      this.addFolds = function(folds) {
        folds.forEach(function(fold) {
          this.addFold(fold);
        }, this);
      };
      this.removeFold = function(fold) {
        var foldLine = fold.foldLine;
        var startRow = foldLine.start.row;
        var endRow = foldLine.end.row;
        var foldLines = this.$foldData;
        var folds = foldLine.folds;
        if (folds.length == 1) {
          foldLines.splice(foldLines.indexOf(foldLine), 1);
        } else if (foldLine.range.isEnd(fold.end.row, fold.end.column)) {
          folds.pop();
          foldLine.end.row = folds[folds.length - 1].end.row;
          foldLine.end.column = folds[folds.length - 1].end.column;
        } else if (foldLine.range.isStart(fold.start.row, fold.start.column)) {
          folds.shift();
          foldLine.start.row = folds[0].start.row;
          foldLine.start.column = folds[0].start.column;
        } else if (fold.sameRow) {
          folds.splice(folds.indexOf(fold), 1);
        } else {
          var newFoldLine = foldLine.split(fold.start.row, fold.start.column);
          folds = newFoldLine.folds;
          folds.shift();
          newFoldLine.start.row = folds[0].start.row;
          newFoldLine.start.column = folds[0].start.column;
        }
        if (!this.$updating) {
          if (this.$useWrapMode)
            this.$updateWrapData(startRow, endRow);
          else
            this.$updateRowLengthCache(startRow, endRow);
        }
        this.$modified = true;
        this._signal("changeFold", { data: fold, action: "remove" });
      };
      this.removeFolds = function(folds) {
        var cloneFolds = [];
        for (var i2 = 0; i2 < folds.length; i2++) {
          cloneFolds.push(folds[i2]);
        }
        cloneFolds.forEach(function(fold) {
          this.removeFold(fold);
        }, this);
        this.$modified = true;
      };
      this.expandFold = function(fold) {
        this.removeFold(fold);
        fold.subFolds.forEach(function(subFold) {
          fold.restoreRange(subFold);
          this.addFold(subFold);
        }, this);
        if (fold.collapseChildren > 0) {
          this.foldAll(fold.start.row + 1, fold.end.row, fold.collapseChildren - 1);
        }
        fold.subFolds = [];
      };
      this.expandFolds = function(folds) {
        folds.forEach(function(fold) {
          this.expandFold(fold);
        }, this);
      };
      this.unfold = function(location2, expandInner) {
        var range3, folds;
        if (location2 == null) {
          range3 = new Range2(0, 0, this.getLength(), 0);
          if (expandInner == null)
            expandInner = true;
        } else if (typeof location2 == "number") {
          range3 = new Range2(location2, 0, location2, this.getLine(location2).length);
        } else if ("row" in location2) {
          range3 = Range2.fromPoints(location2, location2);
        } else if (Array.isArray(location2)) {
          folds = [];
          location2.forEach(function(range4) {
            folds = folds.concat(this.unfold(range4));
          }, this);
          return folds;
        } else {
          range3 = location2;
        }
        folds = this.getFoldsInRangeList(range3);
        var outermostFolds = folds;
        while (folds.length == 1 && Range2.comparePoints(folds[0].start, range3.start) < 0 && Range2.comparePoints(folds[0].end, range3.end) > 0) {
          this.expandFolds(folds);
          folds = this.getFoldsInRangeList(range3);
        }
        if (expandInner != false) {
          this.removeFolds(folds);
        } else {
          this.expandFolds(folds);
        }
        if (outermostFolds.length)
          return outermostFolds;
      };
      this.isRowFolded = function(docRow, startFoldRow) {
        return !!this.getFoldLine(docRow, startFoldRow);
      };
      this.getRowFoldEnd = function(docRow, startFoldRow) {
        var foldLine = this.getFoldLine(docRow, startFoldRow);
        return foldLine ? foldLine.end.row : docRow;
      };
      this.getRowFoldStart = function(docRow, startFoldRow) {
        var foldLine = this.getFoldLine(docRow, startFoldRow);
        return foldLine ? foldLine.start.row : docRow;
      };
      this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
        if (startRow == null)
          startRow = foldLine.start.row;
        if (startColumn == null)
          startColumn = 0;
        if (endRow == null)
          endRow = foldLine.end.row;
        if (endColumn == null)
          endColumn = this.getLine(endRow).length;
        var doc = this.doc;
        var textLine = "";
        foldLine.walk(function(placeholder, row, column2, lastColumn) {
          if (row < startRow)
            return;
          if (row == startRow) {
            if (column2 < startColumn)
              return;
            lastColumn = Math.max(startColumn, lastColumn);
          }
          if (placeholder != null) {
            textLine += placeholder;
          } else {
            textLine += doc.getLine(row).substring(lastColumn, column2);
          }
        }, endRow, endColumn);
        return textLine;
      };
      this.getDisplayLine = function(row, endColumn, startRow, startColumn) {
        var foldLine = this.getFoldLine(row);
        if (!foldLine) {
          var line2;
          line2 = this.doc.getLine(row);
          return line2.substring(startColumn || 0, endColumn || line2.length);
        } else {
          return this.getFoldDisplayLine(foldLine, row, endColumn, startRow, startColumn);
        }
      };
      this.$cloneFoldData = function() {
        var fd2 = [];
        fd2 = this.$foldData.map(function(foldLine) {
          var folds = foldLine.folds.map(function(fold) {
            return fold.clone();
          });
          return new FoldLine(fd2, folds);
        });
        return fd2;
      };
      this.toggleFold = function(tryToUnfold) {
        var selection = this.selection;
        var range3 = selection.getRange();
        var fold;
        var bracketPos;
        if (range3.isEmpty()) {
          var cursor = range3.start;
          fold = this.getFoldAt(cursor.row, cursor.column);
          if (fold) {
            this.expandFold(fold);
            return;
          } else if (tryToUnfold) {
            var foldLine = this.getFoldLine(cursor.row);
            if (foldLine)
              this.expandFolds(foldLine.folds);
            return;
          } else if (bracketPos = this.findMatchingBracket(cursor)) {
            if (range3.comparePoint(bracketPos) == 1) {
              range3.end = bracketPos;
            } else {
              range3.start = bracketPos;
              range3.start.column++;
              range3.end.column--;
            }
          } else if (bracketPos = this.findMatchingBracket({ row: cursor.row, column: cursor.column + 1 })) {
            if (range3.comparePoint(bracketPos) == 1)
              range3.end = bracketPos;
            else
              range3.start = bracketPos;
            range3.start.column++;
          } else {
            range3 = this.getCommentFoldRange(cursor.row, cursor.column) || range3;
          }
        } else {
          var folds = this.getFoldsInRange(range3);
          if (tryToUnfold && folds.length) {
            this.expandFolds(folds);
            return;
          } else if (folds.length == 1) {
            fold = folds[0];
          }
        }
        if (!fold)
          fold = this.getFoldAt(range3.start.row, range3.start.column);
        if (fold && fold.range.toString() == range3.toString()) {
          this.expandFold(fold);
          return;
        }
        var placeholder = "...";
        if (!range3.isMultiLine()) {
          placeholder = this.getTextRange(range3);
          if (placeholder.length < 4)
            return;
          placeholder = placeholder.trim().substring(0, 2) + "..";
        }
        this.addFold(placeholder, range3);
      };
      this.getCommentFoldRange = function(row, column2, dir) {
        var iterator2 = new TokenIterator(this, row, column2);
        var token2 = iterator2.getCurrentToken();
        var type4 = token2 && token2.type;
        if (token2 && /^comment|string/.test(type4)) {
          type4 = type4.match(/comment|string/)[0];
          if (type4 == "comment")
            type4 += "|doc-start|\\.doc";
          var re2 = new RegExp(type4);
          var range3 = new Range2();
          if (dir != 1) {
            do {
              token2 = iterator2.stepBackward();
            } while (token2 && re2.test(token2.type));
            token2 = iterator2.stepForward();
          }
          range3.start.row = iterator2.getCurrentTokenRow();
          range3.start.column = iterator2.getCurrentTokenColumn() + token2.value.length;
          iterator2 = new TokenIterator(this, row, column2);
          var initState = this.getState(iterator2.$row);
          if (dir != -1) {
            var lastRow = -1;
            do {
              token2 = iterator2.stepForward();
              if (lastRow == -1) {
                var state = this.getState(iterator2.$row);
                if (initState.toString() !== state.toString())
                  lastRow = iterator2.$row;
              } else if (iterator2.$row > lastRow) {
                break;
              }
            } while (token2 && re2.test(token2.type));
            token2 = iterator2.stepBackward();
          } else
            token2 = iterator2.getCurrentToken();
          range3.end.row = iterator2.getCurrentTokenRow();
          range3.end.column = iterator2.getCurrentTokenColumn();
          if (range3.start.row == range3.end.row && range3.start.column > range3.end.column)
            return;
          return range3;
        }
      };
      this.foldAll = function(startRow, endRow, depth, test2) {
        if (depth == void 0)
          depth = 1e5;
        var foldWidgets = this.foldWidgets;
        if (!foldWidgets)
          return;
        endRow = endRow || this.getLength();
        startRow = startRow || 0;
        for (var row = startRow; row < endRow; row++) {
          if (foldWidgets[row] == null)
            foldWidgets[row] = this.getFoldWidget(row);
          if (foldWidgets[row] != "start")
            continue;
          if (test2 && !test2(row))
            continue;
          var range3 = this.getFoldWidgetRange(row);
          if (range3 && range3.isMultiLine() && range3.end.row <= endRow && range3.start.row >= startRow) {
            row = range3.end.row;
            range3.collapseChildren = depth;
            this.addFold("...", range3);
          }
        }
      };
      this.foldToLevel = function(level) {
        this.foldAll();
        while (level-- > 0)
          this.unfold(null, false);
      };
      this.foldAllComments = function() {
        var session = this;
        this.foldAll(null, null, null, function(row) {
          var tokens2 = session.getTokens(row);
          for (var i2 = 0; i2 < tokens2.length; i2++) {
            var token2 = tokens2[i2];
            if (token2.type == "text" && /^\s+$/.test(token2.value))
              continue;
            if (/comment/.test(token2.type))
              return true;
            return false;
          }
        });
      };
      this.$foldStyles = {
        "manual": 1,
        "markbegin": 1,
        "markbeginend": 1
      };
      this.$foldStyle = "markbegin";
      this.setFoldStyle = function(style2) {
        if (!this.$foldStyles[style2])
          throw new Error("invalid fold style: " + style2 + "[" + Object.keys(this.$foldStyles).join(", ") + "]");
        if (this.$foldStyle == style2)
          return;
        this.$foldStyle = style2;
        if (style2 == "manual")
          this.unfold();
        var mode = this.$foldMode;
        this.$setFolding(null);
        this.$setFolding(mode);
      };
      this.$setFolding = function(foldMode) {
        if (this.$foldMode == foldMode)
          return;
        this.$foldMode = foldMode;
        this.off("change", this.$updateFoldWidgets);
        this.off("tokenizerUpdate", this.$tokenizerUpdateFoldWidgets);
        this._signal("changeAnnotation");
        if (!foldMode || this.$foldStyle == "manual") {
          this.foldWidgets = null;
          return;
        }
        this.foldWidgets = [];
        this.getFoldWidget = foldMode.getFoldWidget.bind(foldMode, this, this.$foldStyle);
        this.getFoldWidgetRange = foldMode.getFoldWidgetRange.bind(foldMode, this, this.$foldStyle);
        this.$updateFoldWidgets = this.updateFoldWidgets.bind(this);
        this.$tokenizerUpdateFoldWidgets = this.tokenizerUpdateFoldWidgets.bind(this);
        this.on("change", this.$updateFoldWidgets);
        this.on("tokenizerUpdate", this.$tokenizerUpdateFoldWidgets);
      };
      this.getParentFoldRangeData = function(row, ignoreCurrent) {
        var fw = this.foldWidgets;
        if (!fw || ignoreCurrent && fw[row])
          return {};
        var i2 = row - 1, firstRange;
        while (i2 >= 0) {
          var c2 = fw[i2];
          if (c2 == null)
            c2 = fw[i2] = this.getFoldWidget(i2);
          if (c2 == "start") {
            var range3 = this.getFoldWidgetRange(i2);
            if (!firstRange)
              firstRange = range3;
            if (range3 && range3.end.row >= row)
              break;
          }
          i2--;
        }
        return {
          range: i2 !== -1 && range3,
          firstRange
        };
      };
      this.onFoldWidgetClick = function(row, e2) {
        if (e2 instanceof MouseEvent2)
          e2 = e2.domEvent;
        var options = {
          children: e2.shiftKey,
          all: e2.ctrlKey || e2.metaKey,
          siblings: e2.altKey
        };
        var range3 = this.$toggleFoldWidget(row, options);
        if (!range3) {
          var el2 = e2.target || e2.srcElement;
          if (el2 && /ace_fold-widget/.test(el2.className))
            el2.className += " ace_invalid";
        }
      };
      this.$toggleFoldWidget = function(row, options) {
        if (!this.getFoldWidget)
          return;
        var type4 = this.getFoldWidget(row);
        var line2 = this.getLine(row);
        var dir = type4 === "end" ? -1 : 1;
        var fold = this.getFoldAt(row, dir === -1 ? 0 : line2.length, dir);
        if (fold) {
          if (options.children || options.all)
            this.removeFold(fold);
          else
            this.expandFold(fold);
          return fold;
        }
        var range3 = this.getFoldWidgetRange(row, true);
        if (range3 && !range3.isMultiLine()) {
          fold = this.getFoldAt(range3.start.row, range3.start.column, 1);
          if (fold && range3.isEqual(fold.range)) {
            this.removeFold(fold);
            return fold;
          }
        }
        if (options.siblings) {
          var data = this.getParentFoldRangeData(row);
          if (data.range) {
            var startRow = data.range.start.row + 1;
            var endRow = data.range.end.row;
          }
          this.foldAll(startRow, endRow, options.all ? 1e4 : 0);
        } else if (options.children) {
          endRow = range3 ? range3.end.row : this.getLength();
          this.foldAll(row + 1, endRow, options.all ? 1e4 : 0);
        } else if (range3) {
          if (options.all)
            range3.collapseChildren = 1e4;
          this.addFold("...", range3);
        }
        return range3;
      };
      this.toggleFoldWidget = function(toggleParent) {
        var row = this.selection.getCursor().row;
        row = this.getRowFoldStart(row);
        var range3 = this.$toggleFoldWidget(row, {});
        if (range3)
          return;
        var data = this.getParentFoldRangeData(row, true);
        range3 = data.range || data.firstRange;
        if (range3) {
          row = range3.start.row;
          var fold = this.getFoldAt(row, this.getLine(row).length, 1);
          if (fold) {
            this.removeFold(fold);
          } else {
            this.addFold("...", range3);
          }
        }
      };
      this.updateFoldWidgets = function(delta) {
        var firstRow = delta.start.row;
        var len = delta.end.row - firstRow;
        if (len === 0) {
          this.foldWidgets[firstRow] = null;
        } else if (delta.action == "remove") {
          this.foldWidgets.splice(firstRow, len + 1, null);
        } else {
          var args = Array(len + 1);
          args.unshift(firstRow, 1);
          this.foldWidgets.splice.apply(this.foldWidgets, args);
        }
      };
      this.tokenizerUpdateFoldWidgets = function(e2) {
        var rows = e2.data;
        if (rows.first != rows.last) {
          if (this.foldWidgets.length > rows.first)
            this.foldWidgets.splice(rows.first, this.foldWidgets.length);
        }
      };
    }
    exports3.Folding = Folding;
  });
  ace.define("ace/edit_session/bracket_match", ["require", "exports", "module", "ace/token_iterator", "ace/range"], function(require2, exports3, module3) {
    var TokenIterator = require2("../token_iterator").TokenIterator;
    var Range2 = require2("../range").Range;
    function BracketMatch() {
      this.findMatchingBracket = function(position2, chr) {
        if (position2.column == 0)
          return null;
        var charBeforeCursor = chr || this.getLine(position2.row).charAt(position2.column - 1);
        if (charBeforeCursor == "")
          return null;
        var match5 = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/);
        if (!match5)
          return null;
        if (match5[1])
          return this.$findClosingBracket(match5[1], position2);
        else
          return this.$findOpeningBracket(match5[2], position2);
      };
      this.getBracketRange = function(pos) {
        var line2 = this.getLine(pos.row);
        var before = true, range3;
        var chr = line2.charAt(pos.column - 1);
        var match5 = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
        if (!match5) {
          chr = line2.charAt(pos.column);
          pos = { row: pos.row, column: pos.column + 1 };
          match5 = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
          before = false;
        }
        if (!match5)
          return null;
        if (match5[1]) {
          var bracketPos = this.$findClosingBracket(match5[1], pos);
          if (!bracketPos)
            return null;
          range3 = Range2.fromPoints(pos, bracketPos);
          if (!before) {
            range3.end.column++;
            range3.start.column--;
          }
          range3.cursor = range3.end;
        } else {
          var bracketPos = this.$findOpeningBracket(match5[2], pos);
          if (!bracketPos)
            return null;
          range3 = Range2.fromPoints(bracketPos, pos);
          if (!before) {
            range3.start.column++;
            range3.end.column--;
          }
          range3.cursor = range3.start;
        }
        return range3;
      };
      this.getMatchingBracketRanges = function(pos, isBackwards) {
        var line2 = this.getLine(pos.row);
        var bracketsRegExp = /([\(\[\{])|([\)\]\}])/;
        var chr = !isBackwards && line2.charAt(pos.column - 1);
        var match5 = chr && chr.match(bracketsRegExp);
        if (!match5) {
          chr = (isBackwards === void 0 || isBackwards) && line2.charAt(pos.column);
          pos = {
            row: pos.row,
            column: pos.column + 1
          };
          match5 = chr && chr.match(bracketsRegExp);
        }
        if (!match5)
          return null;
        var startRange = new Range2(pos.row, pos.column - 1, pos.row, pos.column);
        var bracketPos = match5[1] ? this.$findClosingBracket(match5[1], pos) : this.$findOpeningBracket(match5[2], pos);
        if (!bracketPos)
          return [startRange];
        var endRange = new Range2(bracketPos.row, bracketPos.column, bracketPos.row, bracketPos.column + 1);
        return [startRange, endRange];
      };
      this.$brackets = {
        ")": "(",
        "(": ")",
        "]": "[",
        "[": "]",
        "{": "}",
        "}": "{",
        "<": ">",
        ">": "<"
      };
      this.$findOpeningBracket = function(bracket, position2, typeRe) {
        var openBracket = this.$brackets[bracket];
        var depth = 1;
        var iterator2 = new TokenIterator(this, position2.row, position2.column);
        var token2 = iterator2.getCurrentToken();
        if (!token2)
          token2 = iterator2.stepForward();
        if (!token2)
          return;
        if (!typeRe) {
          typeRe = new RegExp("(\\.?" + token2.type.replace(".", "\\.").replace("rparen", ".paren").replace(/\b(?:end)\b/, "(?:start|begin|end)").replace(/-close\b/, "-(close|open)") + ")+");
        }
        var valueIndex = position2.column - iterator2.getCurrentTokenColumn() - 2;
        var value2 = token2.value;
        while (true) {
          while (valueIndex >= 0) {
            var chr = value2.charAt(valueIndex);
            if (chr == openBracket) {
              depth -= 1;
              if (depth == 0) {
                return {
                  row: iterator2.getCurrentTokenRow(),
                  column: valueIndex + iterator2.getCurrentTokenColumn()
                };
              }
            } else if (chr == bracket) {
              depth += 1;
            }
            valueIndex -= 1;
          }
          do {
            token2 = iterator2.stepBackward();
          } while (token2 && !typeRe.test(token2.type));
          if (token2 == null)
            break;
          value2 = token2.value;
          valueIndex = value2.length - 1;
        }
        return null;
      };
      this.$findClosingBracket = function(bracket, position2, typeRe) {
        var closingBracket = this.$brackets[bracket];
        var depth = 1;
        var iterator2 = new TokenIterator(this, position2.row, position2.column);
        var token2 = iterator2.getCurrentToken();
        if (!token2)
          token2 = iterator2.stepForward();
        if (!token2)
          return;
        if (!typeRe) {
          typeRe = new RegExp("(\\.?" + token2.type.replace(".", "\\.").replace("lparen", ".paren").replace(/\b(?:start|begin)\b/, "(?:start|begin|end)").replace(/-open\b/, "-(close|open)") + ")+");
        }
        var valueIndex = position2.column - iterator2.getCurrentTokenColumn();
        while (true) {
          var value2 = token2.value;
          var valueLength = value2.length;
          while (valueIndex < valueLength) {
            var chr = value2.charAt(valueIndex);
            if (chr == closingBracket) {
              depth -= 1;
              if (depth == 0) {
                return {
                  row: iterator2.getCurrentTokenRow(),
                  column: valueIndex + iterator2.getCurrentTokenColumn()
                };
              }
            } else if (chr == bracket) {
              depth += 1;
            }
            valueIndex += 1;
          }
          do {
            token2 = iterator2.stepForward();
          } while (token2 && !typeRe.test(token2.type));
          if (token2 == null)
            break;
          valueIndex = 0;
        }
        return null;
      };
      this.getMatchingTags = function(pos) {
        var iterator2 = new TokenIterator(this, pos.row, pos.column);
        var token2 = this.$findTagName(iterator2);
        if (!token2)
          return;
        var prevToken = iterator2.stepBackward();
        if (prevToken.value === "<") {
          return this.$findClosingTag(iterator2, token2);
        } else {
          return this.$findOpeningTag(iterator2, token2);
        }
      };
      this.$findTagName = function(iterator2) {
        var token2 = iterator2.getCurrentToken();
        var found = false;
        var backward = false;
        if (token2 && token2.type.indexOf("tag-name") === -1) {
          do {
            if (backward)
              token2 = iterator2.stepBackward();
            else
              token2 = iterator2.stepForward();
            if (token2) {
              if (token2.value === "/>") {
                backward = true;
              } else if (token2.type.indexOf("tag-name") !== -1) {
                found = true;
              }
            }
          } while (token2 && !found);
        }
        return token2;
      };
      this.$findClosingTag = function(iterator2, token2) {
        var prevToken;
        var currentTag = token2.value;
        var tag = token2.value;
        var depth = 0;
        var openTagStart = new Range2(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + 1);
        token2 = iterator2.stepForward();
        var openTagName = new Range2(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + token2.value.length);
        var foundOpenTagEnd = false;
        do {
          prevToken = token2;
          if (prevToken.type.indexOf("tag-close") !== -1 && !foundOpenTagEnd) {
            var openTagEnd = new Range2(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + 1);
            foundOpenTagEnd = true;
          }
          token2 = iterator2.stepForward();
          if (token2) {
            if (token2.value === ">" && !foundOpenTagEnd) {
              var openTagEnd = new Range2(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + 1);
              foundOpenTagEnd = true;
            }
            if (token2.type.indexOf("tag-name") !== -1) {
              currentTag = token2.value;
              if (tag === currentTag) {
                if (prevToken.value === "<") {
                  depth++;
                } else if (prevToken.value === "</") {
                  depth--;
                  if (depth < 0) {
                    iterator2.stepBackward();
                    var closeTagStart = new Range2(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + 2);
                    token2 = iterator2.stepForward();
                    var closeTagName = new Range2(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + token2.value.length);
                    if (token2.type.indexOf("tag-close") === -1) {
                      token2 = iterator2.stepForward();
                    }
                    if (token2 && token2.value === ">") {
                      var closeTagEnd = new Range2(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + 1);
                    } else {
                      return;
                    }
                  }
                }
              }
            } else if (tag === currentTag && token2.value === "/>") {
              depth--;
              if (depth < 0) {
                var closeTagStart = new Range2(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + 2);
                var closeTagName = closeTagStart;
                var closeTagEnd = closeTagName;
                var openTagEnd = new Range2(openTagName.end.row, openTagName.end.column, openTagName.end.row, openTagName.end.column + 1);
              }
            }
          }
        } while (token2 && depth >= 0);
        if (openTagStart && openTagEnd && closeTagStart && closeTagEnd && openTagName && closeTagName) {
          return {
            openTag: new Range2(openTagStart.start.row, openTagStart.start.column, openTagEnd.end.row, openTagEnd.end.column),
            closeTag: new Range2(closeTagStart.start.row, closeTagStart.start.column, closeTagEnd.end.row, closeTagEnd.end.column),
            openTagName,
            closeTagName
          };
        }
      };
      this.$findOpeningTag = function(iterator2, token2) {
        var prevToken = iterator2.getCurrentToken();
        var tag = token2.value;
        var depth = 0;
        var startRow = iterator2.getCurrentTokenRow();
        var startColumn = iterator2.getCurrentTokenColumn();
        var endColumn = startColumn + 2;
        var closeTagStart = new Range2(startRow, startColumn, startRow, endColumn);
        iterator2.stepForward();
        var closeTagName = new Range2(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + token2.value.length);
        if (token2.type.indexOf("tag-close") === -1) {
          token2 = iterator2.stepForward();
        }
        if (!token2 || token2.value !== ">")
          return;
        var closeTagEnd = new Range2(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + 1);
        iterator2.stepBackward();
        iterator2.stepBackward();
        do {
          token2 = prevToken;
          startRow = iterator2.getCurrentTokenRow();
          startColumn = iterator2.getCurrentTokenColumn();
          endColumn = startColumn + token2.value.length;
          prevToken = iterator2.stepBackward();
          if (token2) {
            if (token2.type.indexOf("tag-name") !== -1) {
              if (tag === token2.value) {
                if (prevToken.value === "<") {
                  depth++;
                  if (depth > 0) {
                    var openTagName = new Range2(startRow, startColumn, startRow, endColumn);
                    var openTagStart = new Range2(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + 1);
                    do {
                      token2 = iterator2.stepForward();
                    } while (token2 && token2.value !== ">");
                    var openTagEnd = new Range2(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + 1);
                  }
                } else if (prevToken.value === "</") {
                  depth--;
                }
              }
            } else if (token2.value === "/>") {
              var stepCount = 0;
              var tmpToken = prevToken;
              while (tmpToken) {
                if (tmpToken.type.indexOf("tag-name") !== -1 && tmpToken.value === tag) {
                  depth--;
                  break;
                } else if (tmpToken.value === "<") {
                  break;
                }
                tmpToken = iterator2.stepBackward();
                stepCount++;
              }
              for (var i2 = 0; i2 < stepCount; i2++) {
                iterator2.stepForward();
              }
            }
          }
        } while (prevToken && depth <= 0);
        if (openTagStart && openTagEnd && closeTagStart && closeTagEnd && openTagName && closeTagName) {
          return {
            openTag: new Range2(openTagStart.start.row, openTagStart.start.column, openTagEnd.end.row, openTagEnd.end.column),
            closeTag: new Range2(closeTagStart.start.row, closeTagStart.start.column, closeTagEnd.end.row, closeTagEnd.end.column),
            openTagName,
            closeTagName
          };
        }
      };
    }
    exports3.BracketMatch = BracketMatch;
  });
  ace.define("ace/edit_session", ["require", "exports", "module", "ace/lib/oop", "ace/lib/lang", "ace/bidihandler", "ace/config", "ace/lib/event_emitter", "ace/selection", "ace/mode/text", "ace/range", "ace/line_widgets", "ace/document", "ace/background_tokenizer", "ace/search_highlight", "ace/undomanager", "ace/edit_session/folding", "ace/edit_session/bracket_match"], function(require2, exports3, module3) {
    var oop = require2("./lib/oop");
    var lang2 = require2("./lib/lang");
    var BidiHandler = require2("./bidihandler").BidiHandler;
    var config2 = require2("./config");
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var Selection = require2("./selection").Selection;
    var TextMode = require2("./mode/text").Mode;
    var Range2 = require2("./range").Range;
    var LineWidgets = require2("./line_widgets").LineWidgets;
    var Document = require2("./document").Document;
    var BackgroundTokenizer = require2("./background_tokenizer").BackgroundTokenizer;
    var SearchHighlight = require2("./search_highlight").SearchHighlight;
    var UndoManager = require2("./undomanager").UndoManager;
    var EditSession = (
      /** @class */
      function() {
        function EditSession2(text2, mode) {
          this.doc;
          this.$breakpoints = [];
          this.$decorations = [];
          this.$frontMarkers = {};
          this.$backMarkers = {};
          this.$markerId = 1;
          this.$undoSelect = true;
          this.$editor = null;
          this.prevOp = {};
          this.$foldData = [];
          this.id = "session" + ++EditSession2.$uid;
          this.$foldData.toString = function() {
            return this.join("\n");
          };
          this.$gutterCustomWidgets = {};
          this.bgTokenizer = new BackgroundTokenizer(new TextMode().getTokenizer(), this);
          var _self = this;
          this.bgTokenizer.on("update", function(e2) {
            _self._signal("tokenizerUpdate", e2);
          });
          this.on("changeFold", this.onChangeFold.bind(this));
          this.$onChange = this.onChange.bind(this);
          if (typeof text2 != "object" || !text2.getLine)
            text2 = new Document(
              /**@type{string}*/
              text2
            );
          this.setDocument(text2);
          this.selection = new Selection(this);
          this.$onSelectionChange = this.onSelectionChange.bind(this);
          this.selection.on("changeSelection", this.$onSelectionChange);
          this.selection.on("changeCursor", this.$onSelectionChange);
          this.$bidiHandler = new BidiHandler(this);
          config2.resetOptions(this);
          this.setMode(mode);
          config2._signal("session", this);
          this.destroyed = false;
          this.$initOperationListeners();
        }
        EditSession2.prototype.$initOperationListeners = function() {
          var _this = this;
          this.curOp = null;
          this.on("change", function() {
            if (!_this.curOp) {
              _this.startOperation();
              _this.curOp.selectionBefore = _this.$lastSel;
            }
            _this.curOp.docChanged = true;
          }, true);
          this.on("changeSelection", function() {
            if (!_this.curOp) {
              _this.startOperation();
              _this.curOp.selectionBefore = _this.$lastSel;
            }
            _this.curOp.selectionChanged = true;
          }, true);
          this.$operationResetTimer = lang2.delayedCall(this.endOperation.bind(this, true));
        };
        EditSession2.prototype.startOperation = function(commandEvent) {
          if (this.curOp) {
            if (!commandEvent || this.curOp.command) {
              return;
            }
            this.prevOp = this.curOp;
          }
          if (!commandEvent) {
            commandEvent = {};
          }
          this.$operationResetTimer.schedule();
          this.curOp = {
            command: commandEvent.command || {},
            args: commandEvent.args
          };
          this.curOp.selectionBefore = this.selection.toJSON();
          this._signal("startOperation", commandEvent);
        };
        EditSession2.prototype.endOperation = function(e2) {
          if (this.curOp) {
            if (e2 && e2.returnValue === false) {
              this.curOp = null;
              this._signal("endOperation", e2);
              return;
            }
            if (e2 == true && this.curOp.command && this.curOp.command.name == "mouse") {
              return;
            }
            var currentSelection = this.selection.toJSON();
            this.curOp.selectionAfter = currentSelection;
            this.$lastSel = this.selection.toJSON();
            this.getUndoManager().addSelection(currentSelection);
            this._signal("beforeEndOperation");
            this.prevOp = this.curOp;
            this.curOp = null;
            this._signal("endOperation", e2);
          }
        };
        EditSession2.prototype.setDocument = function(doc) {
          if (this.doc)
            this.doc.off("change", this.$onChange);
          this.doc = doc;
          doc.on("change", this.$onChange, true);
          this.bgTokenizer.setDocument(this.getDocument());
          this.resetCaches();
        };
        EditSession2.prototype.getDocument = function() {
          return this.doc;
        };
        Object.defineProperty(EditSession2.prototype, "widgetManager", {
          get: function() {
            var widgetManager = new LineWidgets(this);
            this.widgetManager = widgetManager;
            if (this.$editor)
              widgetManager.attach(this.$editor);
            return widgetManager;
          },
          set: function(value2) {
            Object.defineProperty(this, "widgetManager", {
              writable: true,
              enumerable: true,
              configurable: true,
              value: value2
            });
          },
          enumerable: false,
          configurable: true
        });
        EditSession2.prototype.$resetRowCache = function(docRow) {
          if (!docRow) {
            this.$docRowCache = [];
            this.$screenRowCache = [];
            return;
          }
          var l2 = this.$docRowCache.length;
          var i2 = this.$getRowCacheIndex(this.$docRowCache, docRow) + 1;
          if (l2 > i2) {
            this.$docRowCache.splice(i2, l2);
            this.$screenRowCache.splice(i2, l2);
          }
        };
        EditSession2.prototype.$getRowCacheIndex = function(cacheArray, val) {
          var low = 0;
          var hi2 = cacheArray.length - 1;
          while (low <= hi2) {
            var mid = low + hi2 >> 1;
            var c2 = cacheArray[mid];
            if (val > c2)
              low = mid + 1;
            else if (val < c2)
              hi2 = mid - 1;
            else
              return mid;
          }
          return low - 1;
        };
        EditSession2.prototype.resetCaches = function() {
          this.$modified = true;
          this.$wrapData = [];
          this.$rowLengthCache = [];
          this.$resetRowCache(0);
          if (!this.destroyed)
            this.bgTokenizer.start(0);
        };
        EditSession2.prototype.onChangeFold = function(e2) {
          var fold = e2.data;
          this.$resetRowCache(fold.start.row);
        };
        EditSession2.prototype.onChange = function(delta) {
          this.$modified = true;
          this.$bidiHandler.onChange(delta);
          this.$resetRowCache(delta.start.row);
          var removedFolds = this.$updateInternalDataOnChange(delta);
          if (!this.$fromUndo && this.$undoManager) {
            if (removedFolds && removedFolds.length) {
              this.$undoManager.add({
                action: "removeFolds",
                folds: removedFolds
              }, this.mergeUndoDeltas);
              this.mergeUndoDeltas = true;
            }
            this.$undoManager.add(delta, this.mergeUndoDeltas);
            this.mergeUndoDeltas = true;
            this.$informUndoManager.schedule();
          }
          this.bgTokenizer.$updateOnChange(delta);
          this._signal("change", delta);
        };
        EditSession2.prototype.onSelectionChange = function() {
          this._signal("changeSelection");
        };
        EditSession2.prototype.setValue = function(text2) {
          this.doc.setValue(text2);
          this.selection.moveTo(0, 0);
          this.$resetRowCache(0);
          this.setUndoManager(this.$undoManager);
          this.getUndoManager().reset();
        };
        EditSession2.fromJSON = function(session) {
          if (typeof session == "string")
            session = JSON.parse(session);
          var undoManager = new UndoManager();
          undoManager.$undoStack = session.history.undo;
          undoManager.$redoStack = session.history.redo;
          undoManager.mark = session.history.mark;
          undoManager.$rev = session.history.rev;
          var editSession = new EditSession2(session.value);
          session.folds.forEach(function(fold) {
            editSession.addFold("...", Range2.fromPoints(fold.start, fold.end));
          });
          editSession.setAnnotations(session.annotations);
          editSession.setBreakpoints(session.breakpoints);
          editSession.setMode(session.mode);
          editSession.setScrollLeft(session.scrollLeft);
          editSession.setScrollTop(session.scrollTop);
          editSession.setUndoManager(undoManager);
          editSession.selection.fromJSON(session.selection);
          return editSession;
        };
        EditSession2.prototype.toJSON = function() {
          return {
            annotations: this.$annotations,
            breakpoints: this.$breakpoints,
            folds: this.getAllFolds().map(function(fold) {
              return fold.range;
            }),
            history: this.getUndoManager(),
            mode: this.$mode.$id,
            scrollLeft: this.$scrollLeft,
            scrollTop: this.$scrollTop,
            selection: this.selection.toJSON(),
            value: this.doc.getValue()
          };
        };
        EditSession2.prototype.toString = function() {
          return this.doc.getValue();
        };
        EditSession2.prototype.getSelection = function() {
          return this.selection;
        };
        EditSession2.prototype.getState = function(row) {
          return this.bgTokenizer.getState(row);
        };
        EditSession2.prototype.getTokens = function(row) {
          return this.bgTokenizer.getTokens(row);
        };
        EditSession2.prototype.getTokenAt = function(row, column2) {
          var tokens2 = this.bgTokenizer.getTokens(row);
          var token2, c2 = 0;
          if (column2 == null) {
            var i2 = tokens2.length - 1;
            c2 = this.getLine(row).length;
          } else {
            for (var i2 = 0; i2 < tokens2.length; i2++) {
              c2 += tokens2[i2].value.length;
              if (c2 >= column2)
                break;
            }
          }
          token2 = tokens2[i2];
          if (!token2)
            return null;
          token2.index = i2;
          token2.start = c2 - token2.value.length;
          return token2;
        };
        EditSession2.prototype.setUndoManager = function(undoManager) {
          this.$undoManager = undoManager;
          if (this.$informUndoManager)
            this.$informUndoManager.cancel();
          if (undoManager) {
            var self2 = this;
            undoManager.addSession(this);
            this.$syncInformUndoManager = function() {
              self2.$informUndoManager.cancel();
              self2.mergeUndoDeltas = false;
            };
            this.$informUndoManager = lang2.delayedCall(this.$syncInformUndoManager);
          } else {
            this.$syncInformUndoManager = function() {
            };
          }
        };
        EditSession2.prototype.markUndoGroup = function() {
          if (this.$syncInformUndoManager)
            this.$syncInformUndoManager();
        };
        EditSession2.prototype.getUndoManager = function() {
          return this.$undoManager || this.$defaultUndoManager;
        };
        EditSession2.prototype.getTabString = function() {
          if (this.getUseSoftTabs()) {
            return lang2.stringRepeat(" ", this.getTabSize());
          } else {
            return "	";
          }
        };
        EditSession2.prototype.setUseSoftTabs = function(val) {
          this.setOption("useSoftTabs", val);
        };
        EditSession2.prototype.getUseSoftTabs = function() {
          return this.$useSoftTabs && !this.$mode.$indentWithTabs;
        };
        EditSession2.prototype.setTabSize = function(tabSize) {
          this.setOption("tabSize", tabSize);
        };
        EditSession2.prototype.getTabSize = function() {
          return this.$tabSize;
        };
        EditSession2.prototype.isTabStop = function(position2) {
          return this.$useSoftTabs && position2.column % this.$tabSize === 0;
        };
        EditSession2.prototype.setNavigateWithinSoftTabs = function(navigateWithinSoftTabs) {
          this.setOption("navigateWithinSoftTabs", navigateWithinSoftTabs);
        };
        EditSession2.prototype.getNavigateWithinSoftTabs = function() {
          return this.$navigateWithinSoftTabs;
        };
        EditSession2.prototype.setOverwrite = function(overwrite) {
          this.setOption("overwrite", overwrite);
        };
        EditSession2.prototype.getOverwrite = function() {
          return this.$overwrite;
        };
        EditSession2.prototype.toggleOverwrite = function() {
          this.setOverwrite(!this.$overwrite);
        };
        EditSession2.prototype.addGutterDecoration = function(row, className) {
          if (!this.$decorations[row])
            this.$decorations[row] = "";
          this.$decorations[row] += " " + className;
          this._signal("changeBreakpoint", {});
        };
        EditSession2.prototype.removeGutterCustomWidget = function(row) {
          if (this.$editor) {
            this.$editor.renderer.$gutterLayer.$removeCustomWidget(row);
          }
        };
        EditSession2.prototype.addGutterCustomWidget = function(row, attributes2) {
          if (this.$editor) {
            this.$editor.renderer.$gutterLayer.$addCustomWidget(row, attributes2);
          }
        };
        EditSession2.prototype.removeGutterDecoration = function(row, className) {
          this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, "");
          this._signal("changeBreakpoint", {});
        };
        EditSession2.prototype.getBreakpoints = function() {
          return this.$breakpoints;
        };
        EditSession2.prototype.setBreakpoints = function(rows) {
          this.$breakpoints = [];
          for (var i2 = 0; i2 < rows.length; i2++) {
            this.$breakpoints[rows[i2]] = "ace_breakpoint";
          }
          this._signal("changeBreakpoint", {});
        };
        EditSession2.prototype.clearBreakpoints = function() {
          this.$breakpoints = [];
          this._signal("changeBreakpoint", {});
        };
        EditSession2.prototype.setBreakpoint = function(row, className) {
          if (className === void 0)
            className = "ace_breakpoint";
          if (className)
            this.$breakpoints[row] = className;
          else
            delete this.$breakpoints[row];
          this._signal("changeBreakpoint", {});
        };
        EditSession2.prototype.clearBreakpoint = function(row) {
          delete this.$breakpoints[row];
          this._signal("changeBreakpoint", {});
        };
        EditSession2.prototype.addMarker = function(range3, clazz, type4, inFront) {
          var id2 = this.$markerId++;
          var marker = {
            range: range3,
            type: type4 || "line",
            renderer: typeof type4 == "function" ? type4 : null,
            clazz,
            inFront: !!inFront,
            id: id2
          };
          if (inFront) {
            this.$frontMarkers[id2] = marker;
            this._signal("changeFrontMarker");
          } else {
            this.$backMarkers[id2] = marker;
            this._signal("changeBackMarker");
          }
          return id2;
        };
        EditSession2.prototype.addDynamicMarker = function(marker, inFront) {
          if (!marker.update)
            return;
          var id2 = this.$markerId++;
          marker.id = id2;
          marker.inFront = !!inFront;
          if (inFront) {
            this.$frontMarkers[id2] = marker;
            this._signal("changeFrontMarker");
          } else {
            this.$backMarkers[id2] = marker;
            this._signal("changeBackMarker");
          }
          return marker;
        };
        EditSession2.prototype.removeMarker = function(markerId) {
          var marker = this.$frontMarkers[markerId] || this.$backMarkers[markerId];
          if (!marker)
            return;
          var markers = marker.inFront ? this.$frontMarkers : this.$backMarkers;
          delete markers[markerId];
          this._signal(marker.inFront ? "changeFrontMarker" : "changeBackMarker");
        };
        EditSession2.prototype.getMarkers = function(inFront) {
          return inFront ? this.$frontMarkers : this.$backMarkers;
        };
        EditSession2.prototype.highlight = function(re2) {
          if (!this.$searchHighlight) {
            var highlight = new SearchHighlight(null, "ace_selected-word", "text");
            this.$searchHighlight = this.addDynamicMarker(highlight);
          }
          this.$searchHighlight.setRegexp(re2);
        };
        EditSession2.prototype.highlightLines = function(startRow, endRow, clazz, inFront) {
          if (typeof endRow != "number") {
            clazz = endRow;
            endRow = startRow;
          }
          if (!clazz)
            clazz = "ace_step";
          var range3 = new Range2(startRow, 0, endRow, Infinity);
          range3.id = this.addMarker(range3, clazz, "fullLine", inFront);
          return range3;
        };
        EditSession2.prototype.setAnnotations = function(annotations) {
          this.$annotations = annotations;
          this._signal("changeAnnotation", {});
        };
        EditSession2.prototype.getAnnotations = function() {
          return this.$annotations || [];
        };
        EditSession2.prototype.clearAnnotations = function() {
          this.setAnnotations([]);
        };
        EditSession2.prototype.$detectNewLine = function(text2) {
          var match5 = text2.match(/^.*?(\r?\n)/m);
          if (match5) {
            this.$autoNewLine = match5[1];
          } else {
            this.$autoNewLine = "\n";
          }
        };
        EditSession2.prototype.getWordRange = function(row, column2) {
          var line2 = this.getLine(row);
          var inToken = false;
          if (column2 > 0)
            inToken = !!line2.charAt(column2 - 1).match(this.tokenRe);
          if (!inToken)
            inToken = !!line2.charAt(column2).match(this.tokenRe);
          if (inToken)
            var re2 = this.tokenRe;
          else if (/^\s+$/.test(line2.slice(column2 - 1, column2 + 1)))
            var re2 = /\s/;
          else
            var re2 = this.nonTokenRe;
          var start2 = column2;
          if (start2 > 0) {
            do {
              start2--;
            } while (start2 >= 0 && line2.charAt(start2).match(re2));
            start2++;
          }
          var end2 = column2;
          while (end2 < line2.length && line2.charAt(end2).match(re2)) {
            end2++;
          }
          return new Range2(row, start2, row, end2);
        };
        EditSession2.prototype.getAWordRange = function(row, column2) {
          var wordRange = this.getWordRange(row, column2);
          var line2 = this.getLine(wordRange.end.row);
          while (line2.charAt(wordRange.end.column).match(/[ \t]/)) {
            wordRange.end.column += 1;
          }
          return wordRange;
        };
        EditSession2.prototype.setNewLineMode = function(newLineMode) {
          this.doc.setNewLineMode(newLineMode);
        };
        EditSession2.prototype.getNewLineMode = function() {
          return this.doc.getNewLineMode();
        };
        EditSession2.prototype.setUseWorker = function(useWorker) {
          this.setOption("useWorker", useWorker);
        };
        EditSession2.prototype.getUseWorker = function() {
          return this.$useWorker;
        };
        EditSession2.prototype.onReloadTokenizer = function(e2) {
          var rows = e2.data;
          this.bgTokenizer.start(rows.first);
          this._signal("tokenizerUpdate", e2);
        };
        EditSession2.prototype.setMode = function(mode, cb2) {
          if (mode && typeof mode === "object") {
            if (mode.getTokenizer)
              return this.$onChangeMode(mode);
            var options = mode;
            var path = options.path;
          } else {
            path = /**@type{string}*/
            mode || "ace/mode/text";
          }
          if (!this.$modes["ace/mode/text"])
            this.$modes["ace/mode/text"] = new TextMode();
          if (this.$modes[path] && !options) {
            this.$onChangeMode(this.$modes[path]);
            cb2 && cb2();
            return;
          }
          this.$modeId = path;
          config2.loadModule(["mode", path], (function(m2) {
            if (this.destroyed) {
              return;
            }
            if (this.$modeId !== path)
              return cb2 && cb2();
            if (this.$modes[path] && !options) {
              this.$onChangeMode(this.$modes[path]);
            } else if (m2 && m2.Mode) {
              m2 = new m2.Mode(options);
              if (!options) {
                this.$modes[path] = m2;
                m2.$id = path;
              }
              this.$onChangeMode(m2);
            }
            cb2 && cb2();
          }).bind(this));
          if (!this.$mode)
            this.$onChangeMode(this.$modes["ace/mode/text"], true);
        };
        EditSession2.prototype.$onChangeMode = function(mode, $isPlaceholder) {
          if (!$isPlaceholder)
            this.$modeId = mode.$id;
          if (this.$mode === mode)
            return;
          var oldMode = this.$mode;
          this.$mode = mode;
          this.$stopWorker();
          if (this.$useWorker)
            this.$startWorker();
          var tokenizer = mode.getTokenizer();
          if (tokenizer.on !== void 0) {
            var onReloadTokenizer = this.onReloadTokenizer.bind(this);
            tokenizer.on("update", onReloadTokenizer);
          }
          this.bgTokenizer.setTokenizer(tokenizer);
          this.bgTokenizer.setDocument(this.getDocument());
          this.tokenRe = mode.tokenRe;
          this.nonTokenRe = mode.nonTokenRe;
          if (!$isPlaceholder) {
            if (mode.attachToSession)
              mode.attachToSession(this);
            this.$options.wrapMethod.set.call(this, this.$wrapMethod);
            this.$setFolding(mode.foldingRules);
            this.bgTokenizer.start(0);
            this._emit("changeMode", { oldMode, mode });
          }
        };
        EditSession2.prototype.$stopWorker = function() {
          if (this.$worker) {
            this.$worker.terminate();
            this.$worker = null;
          }
        };
        EditSession2.prototype.$startWorker = function() {
          try {
            this.$worker = this.$mode.createWorker(this);
          } catch (e2) {
            config2.warn("Could not load worker", e2);
            this.$worker = null;
          }
        };
        EditSession2.prototype.getMode = function() {
          return this.$mode;
        };
        EditSession2.prototype.setScrollTop = function(scrollTop) {
          if (this.$scrollTop === scrollTop || isNaN(scrollTop))
            return;
          this.$scrollTop = scrollTop;
          this._signal("changeScrollTop", scrollTop);
        };
        EditSession2.prototype.getScrollTop = function() {
          return this.$scrollTop;
        };
        EditSession2.prototype.setScrollLeft = function(scrollLeft) {
          if (this.$scrollLeft === scrollLeft || isNaN(scrollLeft))
            return;
          this.$scrollLeft = scrollLeft;
          this._signal("changeScrollLeft", scrollLeft);
        };
        EditSession2.prototype.getScrollLeft = function() {
          return this.$scrollLeft;
        };
        EditSession2.prototype.getScreenWidth = function() {
          this.$computeWidth();
          if (this.lineWidgets)
            return Math.max(this.getLineWidgetMaxWidth(), this.screenWidth);
          return this.screenWidth;
        };
        EditSession2.prototype.getLineWidgetMaxWidth = function() {
          if (this.lineWidgetsWidth != null)
            return this.lineWidgetsWidth;
          var width = 0;
          this.lineWidgets.forEach(function(w2) {
            if (w2 && w2.screenWidth > width)
              width = w2.screenWidth;
          });
          return this.lineWidgetWidth = width;
        };
        EditSession2.prototype.$computeWidth = function(force) {
          if (this.$modified || force) {
            this.$modified = false;
            if (this.$useWrapMode)
              return this.screenWidth = this.$wrapLimit;
            var lines = this.doc.getAllLines();
            var cache2 = this.$rowLengthCache;
            var longestScreenLine = 0;
            var foldIndex = 0;
            var foldLine = this.$foldData[foldIndex];
            var foldStart = foldLine ? foldLine.start.row : Infinity;
            var len = lines.length;
            for (var i2 = 0; i2 < len; i2++) {
              if (i2 > foldStart) {
                i2 = foldLine.end.row + 1;
                if (i2 >= len)
                  break;
                foldLine = this.$foldData[foldIndex++];
                foldStart = foldLine ? foldLine.start.row : Infinity;
              }
              if (cache2[i2] == null)
                cache2[i2] = this.$getStringScreenWidth(lines[i2])[0];
              if (cache2[i2] > longestScreenLine)
                longestScreenLine = cache2[i2];
            }
            this.screenWidth = longestScreenLine;
          }
        };
        EditSession2.prototype.getLine = function(row) {
          return this.doc.getLine(row);
        };
        EditSession2.prototype.getLines = function(firstRow, lastRow) {
          return this.doc.getLines(firstRow, lastRow);
        };
        EditSession2.prototype.getLength = function() {
          return this.doc.getLength();
        };
        EditSession2.prototype.getTextRange = function(range3) {
          return this.doc.getTextRange(range3 || this.selection.getRange());
        };
        EditSession2.prototype.insert = function(position2, text2) {
          return this.doc.insert(position2, text2);
        };
        EditSession2.prototype.remove = function(range3) {
          return this.doc.remove(range3);
        };
        EditSession2.prototype.removeFullLines = function(firstRow, lastRow) {
          return this.doc.removeFullLines(firstRow, lastRow);
        };
        EditSession2.prototype.undoChanges = function(deltas, dontSelect) {
          if (!deltas.length)
            return;
          this.$fromUndo = true;
          for (var i2 = deltas.length - 1; i2 != -1; i2--) {
            var delta = deltas[i2];
            if (delta.action == "insert" || delta.action == "remove") {
              this.doc.revertDelta(delta);
            } else if (delta.folds) {
              this.addFolds(delta.folds);
            }
          }
          if (!dontSelect && this.$undoSelect) {
            if (deltas.selectionBefore)
              this.selection.fromJSON(deltas.selectionBefore);
            else
              this.selection.setRange(this.$getUndoSelection(deltas, true));
          }
          this.$fromUndo = false;
        };
        EditSession2.prototype.redoChanges = function(deltas, dontSelect) {
          if (!deltas.length)
            return;
          this.$fromUndo = true;
          for (var i2 = 0; i2 < deltas.length; i2++) {
            var delta = deltas[i2];
            if (delta.action == "insert" || delta.action == "remove") {
              this.doc.$safeApplyDelta(delta);
            }
          }
          if (!dontSelect && this.$undoSelect) {
            if (deltas.selectionAfter)
              this.selection.fromJSON(deltas.selectionAfter);
            else
              this.selection.setRange(this.$getUndoSelection(deltas, false));
          }
          this.$fromUndo = false;
        };
        EditSession2.prototype.setUndoSelect = function(enable) {
          this.$undoSelect = enable;
        };
        EditSession2.prototype.$getUndoSelection = function(deltas, isUndo) {
          function isInsert(delta2) {
            return isUndo ? delta2.action !== "insert" : delta2.action === "insert";
          }
          var range3, point2;
          for (var i2 = 0; i2 < deltas.length; i2++) {
            var delta = deltas[i2];
            if (!delta.start)
              continue;
            if (!range3) {
              if (isInsert(delta)) {
                range3 = Range2.fromPoints(delta.start, delta.end);
              } else {
                range3 = Range2.fromPoints(delta.start, delta.start);
              }
              continue;
            }
            if (isInsert(delta)) {
              point2 = delta.start;
              if (range3.compare(point2.row, point2.column) == -1) {
                range3.setStart(point2);
              }
              point2 = delta.end;
              if (range3.compare(point2.row, point2.column) == 1) {
                range3.setEnd(point2);
              }
            } else {
              point2 = delta.start;
              if (range3.compare(point2.row, point2.column) == -1) {
                range3 = Range2.fromPoints(delta.start, delta.start);
              }
            }
          }
          return range3;
        };
        EditSession2.prototype.replace = function(range3, text2) {
          return this.doc.replace(range3, text2);
        };
        EditSession2.prototype.moveText = function(fromRange, toPosition, copy2) {
          var text2 = this.getTextRange(fromRange);
          var folds = this.getFoldsInRange(fromRange);
          var toRange = Range2.fromPoints(toPosition, toPosition);
          if (!copy2) {
            this.remove(fromRange);
            var rowDiff = fromRange.start.row - fromRange.end.row;
            var collDiff = rowDiff ? -fromRange.end.column : fromRange.start.column - fromRange.end.column;
            if (collDiff) {
              if (toRange.start.row == fromRange.end.row && toRange.start.column > fromRange.end.column)
                toRange.start.column += collDiff;
              if (toRange.end.row == fromRange.end.row && toRange.end.column > fromRange.end.column)
                toRange.end.column += collDiff;
            }
            if (rowDiff && toRange.start.row >= fromRange.end.row) {
              toRange.start.row += rowDiff;
              toRange.end.row += rowDiff;
            }
          }
          toRange.end = this.insert(toRange.start, text2);
          if (folds.length) {
            var oldStart = fromRange.start;
            var newStart = toRange.start;
            var rowDiff = newStart.row - oldStart.row;
            var collDiff = newStart.column - oldStart.column;
            this.addFolds(folds.map(function(x2) {
              x2 = x2.clone();
              if (x2.start.row == oldStart.row)
                x2.start.column += collDiff;
              if (x2.end.row == oldStart.row)
                x2.end.column += collDiff;
              x2.start.row += rowDiff;
              x2.end.row += rowDiff;
              return x2;
            }));
          }
          return toRange;
        };
        EditSession2.prototype.indentRows = function(startRow, endRow, indentString) {
          indentString = indentString.replace(/\t/g, this.getTabString());
          for (var row = startRow; row <= endRow; row++)
            this.doc.insertInLine({ row, column: 0 }, indentString);
        };
        EditSession2.prototype.outdentRows = function(range3) {
          var rowRange = range3.collapseRows();
          var deleteRange = new Range2(0, 0, 0, 0);
          var size2 = this.getTabSize();
          for (var i2 = rowRange.start.row; i2 <= rowRange.end.row; ++i2) {
            var line2 = this.getLine(i2);
            deleteRange.start.row = i2;
            deleteRange.end.row = i2;
            for (var j2 = 0; j2 < size2; ++j2)
              if (line2.charAt(j2) != " ")
                break;
            if (j2 < size2 && line2.charAt(j2) == "	") {
              deleteRange.start.column = j2;
              deleteRange.end.column = j2 + 1;
            } else {
              deleteRange.start.column = 0;
              deleteRange.end.column = j2;
            }
            this.remove(deleteRange);
          }
        };
        EditSession2.prototype.$moveLines = function(firstRow, lastRow, dir) {
          firstRow = this.getRowFoldStart(firstRow);
          lastRow = this.getRowFoldEnd(lastRow);
          if (dir < 0) {
            var row = this.getRowFoldStart(firstRow + dir);
            if (row < 0)
              return 0;
            var diff2 = row - firstRow;
          } else if (dir > 0) {
            var row = this.getRowFoldEnd(lastRow + dir);
            if (row > this.doc.getLength() - 1)
              return 0;
            var diff2 = row - lastRow;
          } else {
            firstRow = this.$clipRowToDocument(firstRow);
            lastRow = this.$clipRowToDocument(lastRow);
            var diff2 = lastRow - firstRow + 1;
          }
          var range3 = new Range2(firstRow, 0, lastRow, Number.MAX_VALUE);
          var folds = this.getFoldsInRange(range3).map(function(x2) {
            x2 = x2.clone();
            x2.start.row += diff2;
            x2.end.row += diff2;
            return x2;
          });
          var lines = dir == 0 ? this.doc.getLines(firstRow, lastRow) : this.doc.removeFullLines(firstRow, lastRow);
          this.doc.insertFullLines(firstRow + diff2, lines);
          folds.length && this.addFolds(folds);
          return diff2;
        };
        EditSession2.prototype.moveLinesUp = function(firstRow, lastRow) {
          return this.$moveLines(firstRow, lastRow, -1);
        };
        EditSession2.prototype.moveLinesDown = function(firstRow, lastRow) {
          return this.$moveLines(firstRow, lastRow, 1);
        };
        EditSession2.prototype.duplicateLines = function(firstRow, lastRow) {
          return this.$moveLines(firstRow, lastRow, 0);
        };
        EditSession2.prototype.$clipRowToDocument = function(row) {
          return Math.max(0, Math.min(row, this.doc.getLength() - 1));
        };
        EditSession2.prototype.$clipColumnToRow = function(row, column2) {
          if (column2 < 0)
            return 0;
          return Math.min(this.doc.getLine(row).length, column2);
        };
        EditSession2.prototype.$clipPositionToDocument = function(row, column2) {
          column2 = Math.max(0, column2);
          if (row < 0) {
            row = 0;
            column2 = 0;
          } else {
            var len = this.doc.getLength();
            if (row >= len) {
              row = len - 1;
              column2 = this.doc.getLine(len - 1).length;
            } else {
              column2 = Math.min(this.doc.getLine(row).length, column2);
            }
          }
          return {
            row,
            column: column2
          };
        };
        EditSession2.prototype.$clipRangeToDocument = function(range3) {
          if (range3.start.row < 0) {
            range3.start.row = 0;
            range3.start.column = 0;
          } else {
            range3.start.column = this.$clipColumnToRow(range3.start.row, range3.start.column);
          }
          var len = this.doc.getLength() - 1;
          if (range3.end.row > len) {
            range3.end.row = len;
            range3.end.column = this.doc.getLine(len).length;
          } else {
            range3.end.column = this.$clipColumnToRow(range3.end.row, range3.end.column);
          }
          return range3;
        };
        EditSession2.prototype.setUseWrapMode = function(useWrapMode) {
          if (useWrapMode != this.$useWrapMode) {
            this.$useWrapMode = useWrapMode;
            this.$modified = true;
            this.$resetRowCache(0);
            if (useWrapMode) {
              var len = this.getLength();
              this.$wrapData = Array(len);
              this.$updateWrapData(0, len - 1);
            }
            this._signal("changeWrapMode");
          }
        };
        EditSession2.prototype.getUseWrapMode = function() {
          return this.$useWrapMode;
        };
        EditSession2.prototype.setWrapLimitRange = function(min2, max2) {
          if (this.$wrapLimitRange.min !== min2 || this.$wrapLimitRange.max !== max2) {
            this.$wrapLimitRange = { min: min2, max: max2 };
            this.$modified = true;
            this.$bidiHandler.markAsDirty();
            if (this.$useWrapMode)
              this._signal("changeWrapMode");
          }
        };
        EditSession2.prototype.adjustWrapLimit = function(desiredLimit, $printMargin) {
          var limits = this.$wrapLimitRange;
          if (limits.max < 0)
            limits = { min: $printMargin, max: $printMargin };
          var wrapLimit = this.$constrainWrapLimit(desiredLimit, limits.min, limits.max);
          if (wrapLimit != this.$wrapLimit && wrapLimit > 1) {
            this.$wrapLimit = wrapLimit;
            this.$modified = true;
            if (this.$useWrapMode) {
              this.$updateWrapData(0, this.getLength() - 1);
              this.$resetRowCache(0);
              this._signal("changeWrapLimit");
            }
            return true;
          }
          return false;
        };
        EditSession2.prototype.$constrainWrapLimit = function(wrapLimit, min2, max2) {
          if (min2)
            wrapLimit = Math.max(min2, wrapLimit);
          if (max2)
            wrapLimit = Math.min(max2, wrapLimit);
          return wrapLimit;
        };
        EditSession2.prototype.getWrapLimit = function() {
          return this.$wrapLimit;
        };
        EditSession2.prototype.setWrapLimit = function(limit2) {
          this.setWrapLimitRange(limit2, limit2);
        };
        EditSession2.prototype.getWrapLimitRange = function() {
          return {
            min: this.$wrapLimitRange.min,
            max: this.$wrapLimitRange.max
          };
        };
        EditSession2.prototype.$updateInternalDataOnChange = function(delta) {
          var useWrapMode = this.$useWrapMode;
          var action = delta.action;
          var start2 = delta.start;
          var end2 = delta.end;
          var firstRow = start2.row;
          var lastRow = end2.row;
          var len = lastRow - firstRow;
          var removedFolds = null;
          this.$updating = true;
          if (len != 0) {
            if (action === "remove") {
              this[useWrapMode ? "$wrapData" : "$rowLengthCache"].splice(firstRow, len);
              var foldLines = this.$foldData;
              removedFolds = this.getFoldsInRange(delta);
              this.removeFolds(removedFolds);
              var foldLine = this.getFoldLine(end2.row);
              var idx = 0;
              if (foldLine) {
                foldLine.addRemoveChars(end2.row, end2.column, start2.column - end2.column);
                foldLine.shiftRow(-len);
                var foldLineBefore = this.getFoldLine(firstRow);
                if (foldLineBefore && foldLineBefore !== foldLine) {
                  foldLineBefore.merge(foldLine);
                  foldLine = foldLineBefore;
                }
                idx = foldLines.indexOf(foldLine) + 1;
              }
              for (idx; idx < foldLines.length; idx++) {
                var foldLine = foldLines[idx];
                if (foldLine.start.row >= end2.row) {
                  foldLine.shiftRow(-len);
                }
              }
              lastRow = firstRow;
            } else {
              var args = Array(len);
              args.unshift(firstRow, 0);
              var arr = useWrapMode ? this.$wrapData : this.$rowLengthCache;
              arr.splice.apply(arr, args);
              var foldLines = this.$foldData;
              var foldLine = this.getFoldLine(firstRow);
              var idx = 0;
              if (foldLine) {
                var cmp = foldLine.range.compareInside(start2.row, start2.column);
                if (cmp == 0) {
                  foldLine = foldLine.split(start2.row, start2.column);
                  if (foldLine) {
                    foldLine.shiftRow(len);
                    foldLine.addRemoveChars(lastRow, 0, end2.column - start2.column);
                  }
                } else if (cmp == -1) {
                  foldLine.addRemoveChars(firstRow, 0, end2.column - start2.column);
                  foldLine.shiftRow(len);
                }
                idx = foldLines.indexOf(foldLine) + 1;
              }
              for (idx; idx < foldLines.length; idx++) {
                var foldLine = foldLines[idx];
                if (foldLine.start.row >= firstRow) {
                  foldLine.shiftRow(len);
                }
              }
            }
          } else {
            len = Math.abs(delta.start.column - delta.end.column);
            if (action === "remove") {
              removedFolds = this.getFoldsInRange(delta);
              this.removeFolds(removedFolds);
              len = -len;
            }
            var foldLine = this.getFoldLine(firstRow);
            if (foldLine) {
              foldLine.addRemoveChars(firstRow, start2.column, len);
            }
          }
          if (useWrapMode && this.$wrapData.length != this.doc.getLength()) {
            console.error("doc.getLength() and $wrapData.length have to be the same!");
          }
          this.$updating = false;
          if (useWrapMode)
            this.$updateWrapData(firstRow, lastRow);
          else
            this.$updateRowLengthCache(firstRow, lastRow);
          return removedFolds;
        };
        EditSession2.prototype.$updateRowLengthCache = function(firstRow, lastRow) {
          this.$rowLengthCache[firstRow] = null;
          this.$rowLengthCache[lastRow] = null;
        };
        EditSession2.prototype.$updateWrapData = function(firstRow, lastRow) {
          var lines = this.doc.getAllLines();
          var tabSize = this.getTabSize();
          var wrapData = this.$wrapData;
          var wrapLimit = this.$wrapLimit;
          var tokens2;
          var foldLine;
          var row = firstRow;
          lastRow = Math.min(lastRow, lines.length - 1);
          while (row <= lastRow) {
            foldLine = this.getFoldLine(row, foldLine);
            if (!foldLine) {
              tokens2 = this.$getDisplayTokens(lines[row]);
              wrapData[row] = this.$computeWrapSplits(tokens2, wrapLimit, tabSize);
              row++;
            } else {
              tokens2 = [];
              foldLine.walk((function(placeholder, row2, column2, lastColumn) {
                var walkTokens;
                if (placeholder != null) {
                  walkTokens = this.$getDisplayTokens(placeholder, tokens2.length);
                  walkTokens[0] = PLACEHOLDER_START;
                  for (var i2 = 1; i2 < walkTokens.length; i2++) {
                    walkTokens[i2] = PLACEHOLDER_BODY;
                  }
                } else {
                  walkTokens = this.$getDisplayTokens(lines[row2].substring(lastColumn, column2), tokens2.length);
                }
                tokens2 = tokens2.concat(walkTokens);
              }).bind(this), foldLine.end.row, lines[foldLine.end.row].length + 1);
              wrapData[foldLine.start.row] = this.$computeWrapSplits(tokens2, wrapLimit, tabSize);
              row = foldLine.end.row + 1;
            }
          }
        };
        EditSession2.prototype.$computeWrapSplits = function(tokens2, wrapLimit, tabSize) {
          if (tokens2.length == 0) {
            return [];
          }
          var splits = [];
          var displayLength = tokens2.length;
          var lastSplit = 0, lastDocSplit = 0;
          var isCode = this.$wrapAsCode;
          var indentedSoftWrap = this.$indentedSoftWrap;
          var maxIndent = wrapLimit <= Math.max(2 * tabSize, 8) || indentedSoftWrap === false ? 0 : Math.floor(wrapLimit / 2);
          function getWrapIndent() {
            var indentation = 0;
            if (maxIndent === 0)
              return indentation;
            if (indentedSoftWrap) {
              for (var i2 = 0; i2 < tokens2.length; i2++) {
                var token2 = tokens2[i2];
                if (token2 == SPACE)
                  indentation += 1;
                else if (token2 == TAB)
                  indentation += tabSize;
                else if (token2 == TAB_SPACE)
                  continue;
                else
                  break;
              }
            }
            if (isCode && indentedSoftWrap !== false)
              indentation += tabSize;
            return Math.min(indentation, maxIndent);
          }
          function addSplit(screenPos) {
            var len = screenPos - lastSplit;
            for (var i2 = lastSplit; i2 < screenPos; i2++) {
              var ch2 = tokens2[i2];
              if (ch2 === 12 || ch2 === 2)
                len -= 1;
            }
            if (!splits.length) {
              indent = getWrapIndent();
              splits.indent = indent;
            }
            lastDocSplit += len;
            splits.push(lastDocSplit);
            lastSplit = screenPos;
          }
          var indent = 0;
          while (displayLength - lastSplit > wrapLimit - indent) {
            var split2 = lastSplit + wrapLimit - indent;
            if (tokens2[split2 - 1] >= SPACE && tokens2[split2] >= SPACE) {
              addSplit(split2);
              continue;
            }
            if (tokens2[split2] == PLACEHOLDER_START || tokens2[split2] == PLACEHOLDER_BODY) {
              for (split2; split2 != lastSplit - 1; split2--) {
                if (tokens2[split2] == PLACEHOLDER_START) {
                  break;
                }
              }
              if (split2 > lastSplit) {
                addSplit(split2);
                continue;
              }
              split2 = lastSplit + wrapLimit;
              for (split2; split2 < tokens2.length; split2++) {
                if (tokens2[split2] != PLACEHOLDER_BODY) {
                  break;
                }
              }
              if (split2 == tokens2.length) {
                break;
              }
              addSplit(split2);
              continue;
            }
            var minSplit = Math.max(split2 - (wrapLimit - (wrapLimit >> 2)), lastSplit - 1);
            while (split2 > minSplit && tokens2[split2] < PLACEHOLDER_START) {
              split2--;
            }
            if (isCode) {
              while (split2 > minSplit && tokens2[split2] < PLACEHOLDER_START) {
                split2--;
              }
              while (split2 > minSplit && tokens2[split2] == PUNCTUATION) {
                split2--;
              }
            } else {
              while (split2 > minSplit && tokens2[split2] < SPACE) {
                split2--;
              }
            }
            if (split2 > minSplit) {
              addSplit(++split2);
              continue;
            }
            split2 = lastSplit + wrapLimit;
            if (tokens2[split2] == CHAR_EXT)
              split2--;
            addSplit(split2 - indent);
          }
          return splits;
        };
        EditSession2.prototype.$getDisplayTokens = function(str, offset2) {
          var arr = [];
          var tabSize;
          offset2 = offset2 || 0;
          for (var i2 = 0; i2 < str.length; i2++) {
            var c2 = str.charCodeAt(i2);
            if (c2 == 9) {
              tabSize = this.getScreenTabSize(arr.length + offset2);
              arr.push(TAB);
              for (var n2 = 1; n2 < tabSize; n2++) {
                arr.push(TAB_SPACE);
              }
            } else if (c2 == 32) {
              arr.push(SPACE);
            } else if (c2 > 39 && c2 < 48 || c2 > 57 && c2 < 64) {
              arr.push(PUNCTUATION);
            } else if (c2 >= 4352 && isFullWidth(c2)) {
              arr.push(CHAR, CHAR_EXT);
            } else {
              arr.push(CHAR);
            }
          }
          return arr;
        };
        EditSession2.prototype.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {
          if (maxScreenColumn == 0)
            return [0, 0];
          if (maxScreenColumn == null)
            maxScreenColumn = Infinity;
          screenColumn = screenColumn || 0;
          var c2, column2;
          for (column2 = 0; column2 < str.length; column2++) {
            c2 = str.charCodeAt(column2);
            if (c2 == 9) {
              screenColumn += this.getScreenTabSize(screenColumn);
            } else if (c2 >= 4352 && isFullWidth(c2)) {
              screenColumn += 2;
            } else {
              screenColumn += 1;
            }
            if (screenColumn > maxScreenColumn) {
              break;
            }
          }
          return [screenColumn, column2];
        };
        EditSession2.prototype.getRowLength = function(row) {
          var h3 = 1;
          if (this.lineWidgets)
            h3 += this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;
          if (!this.$useWrapMode || !this.$wrapData[row])
            return h3;
          else
            return this.$wrapData[row].length + h3;
        };
        EditSession2.prototype.getRowLineCount = function(row) {
          if (!this.$useWrapMode || !this.$wrapData[row]) {
            return 1;
          } else {
            return this.$wrapData[row].length + 1;
          }
        };
        EditSession2.prototype.getRowWrapIndent = function(screenRow) {
          if (this.$useWrapMode) {
            var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE);
            var splits = this.$wrapData[pos.row];
            return splits.length && splits[0] < pos.column ? splits.indent : 0;
          } else {
            return 0;
          }
        };
        EditSession2.prototype.getScreenLastRowColumn = function(screenRow) {
          var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE);
          return this.documentToScreenColumn(pos.row, pos.column);
        };
        EditSession2.prototype.getDocumentLastRowColumn = function(docRow, docColumn) {
          var screenRow = this.documentToScreenRow(docRow, docColumn);
          return this.getScreenLastRowColumn(screenRow);
        };
        EditSession2.prototype.getDocumentLastRowColumnPosition = function(docRow, docColumn) {
          var screenRow = this.documentToScreenRow(docRow, docColumn);
          return this.screenToDocumentPosition(screenRow, Number.MAX_VALUE / 10);
        };
        EditSession2.prototype.getRowSplitData = function(row) {
          if (!this.$useWrapMode) {
            return void 0;
          } else {
            return this.$wrapData[row];
          }
        };
        EditSession2.prototype.getScreenTabSize = function(screenColumn) {
          return this.$tabSize - (screenColumn % this.$tabSize | 0);
        };
        EditSession2.prototype.screenToDocumentRow = function(screenRow, screenColumn) {
          return this.screenToDocumentPosition(screenRow, screenColumn).row;
        };
        EditSession2.prototype.screenToDocumentColumn = function(screenRow, screenColumn) {
          return this.screenToDocumentPosition(screenRow, screenColumn).column;
        };
        EditSession2.prototype.screenToDocumentPosition = function(screenRow, screenColumn, offsetX) {
          if (screenRow < 0)
            return { row: 0, column: 0 };
          var line2;
          var docRow = 0;
          var docColumn = 0;
          var column2;
          var row = 0;
          var rowLength = 0;
          var rowCache = this.$screenRowCache;
          var i2 = this.$getRowCacheIndex(rowCache, screenRow);
          var l2 = rowCache.length;
          if (l2 && i2 >= 0) {
            var row = rowCache[i2];
            var docRow = this.$docRowCache[i2];
            var doCache = screenRow > rowCache[l2 - 1];
          } else {
            var doCache = !l2;
          }
          var maxRow = this.getLength() - 1;
          var foldLine = this.getNextFoldLine(docRow);
          var foldStart = foldLine ? foldLine.start.row : Infinity;
          while (row <= screenRow) {
            rowLength = this.getRowLength(docRow);
            if (row + rowLength > screenRow || docRow >= maxRow) {
              break;
            } else {
              row += rowLength;
              docRow++;
              if (docRow > foldStart) {
                docRow = foldLine.end.row + 1;
                foldLine = this.getNextFoldLine(docRow, foldLine);
                foldStart = foldLine ? foldLine.start.row : Infinity;
              }
            }
            if (doCache) {
              this.$docRowCache.push(docRow);
              this.$screenRowCache.push(row);
            }
          }
          if (foldLine && foldLine.start.row <= docRow) {
            line2 = this.getFoldDisplayLine(foldLine);
            docRow = foldLine.start.row;
          } else if (row + rowLength <= screenRow || docRow > maxRow) {
            return {
              row: maxRow,
              column: this.getLine(maxRow).length
            };
          } else {
            line2 = this.getLine(docRow);
            foldLine = null;
          }
          var wrapIndent = 0, splitIndex = Math.floor(screenRow - row);
          if (this.$useWrapMode) {
            var splits = this.$wrapData[docRow];
            if (splits) {
              column2 = splits[splitIndex];
              if (splitIndex > 0 && splits.length) {
                wrapIndent = splits.indent;
                docColumn = splits[splitIndex - 1] || splits[splits.length - 1];
                line2 = line2.substring(docColumn);
              }
            }
          }
          if (offsetX !== void 0 && this.$bidiHandler.isBidiRow(row + splitIndex, docRow, splitIndex))
            screenColumn = this.$bidiHandler.offsetToCol(offsetX);
          docColumn += this.$getStringScreenWidth(line2, screenColumn - wrapIndent)[1];
          if (this.$useWrapMode && docColumn >= column2)
            docColumn = column2 - 1;
          if (foldLine)
            return foldLine.idxToPosition(docColumn);
          return { row: docRow, column: docColumn };
        };
        EditSession2.prototype.documentToScreenPosition = function(docRow, docColumn) {
          if (typeof docColumn === "undefined")
            var pos = this.$clipPositionToDocument(
              /**@type{Point}*/
              docRow.row,
              /**@type{Point}*/
              docRow.column
            );
          else
            pos = this.$clipPositionToDocument(
              /**@type{number}*/
              docRow,
              docColumn
            );
          docRow = pos.row;
          docColumn = pos.column;
          var screenRow = 0;
          var foldStartRow = null;
          var fold = null;
          fold = this.getFoldAt(docRow, docColumn, 1);
          if (fold) {
            docRow = fold.start.row;
            docColumn = fold.start.column;
          }
          var rowEnd, row = 0;
          var rowCache = this.$docRowCache;
          var i2 = this.$getRowCacheIndex(rowCache, docRow);
          var l2 = rowCache.length;
          if (l2 && i2 >= 0) {
            var row = rowCache[i2];
            var screenRow = this.$screenRowCache[i2];
            var doCache = docRow > rowCache[l2 - 1];
          } else {
            var doCache = !l2;
          }
          var foldLine = this.getNextFoldLine(row);
          var foldStart = foldLine ? foldLine.start.row : Infinity;
          while (row < docRow) {
            if (row >= foldStart) {
              rowEnd = foldLine.end.row + 1;
              if (rowEnd > docRow)
                break;
              foldLine = this.getNextFoldLine(rowEnd, foldLine);
              foldStart = foldLine ? foldLine.start.row : Infinity;
            } else {
              rowEnd = row + 1;
            }
            screenRow += this.getRowLength(row);
            row = rowEnd;
            if (doCache) {
              this.$docRowCache.push(row);
              this.$screenRowCache.push(screenRow);
            }
          }
          var textLine = "";
          if (foldLine && row >= foldStart) {
            textLine = this.getFoldDisplayLine(foldLine, docRow, docColumn);
            foldStartRow = foldLine.start.row;
          } else {
            textLine = this.getLine(docRow).substring(0, docColumn);
            foldStartRow = docRow;
          }
          var wrapIndent = 0;
          if (this.$useWrapMode) {
            var wrapRow = this.$wrapData[foldStartRow];
            if (wrapRow) {
              var screenRowOffset = 0;
              while (textLine.length >= wrapRow[screenRowOffset]) {
                screenRow++;
                screenRowOffset++;
              }
              textLine = textLine.substring(wrapRow[screenRowOffset - 1] || 0, textLine.length);
              wrapIndent = screenRowOffset > 0 ? wrapRow.indent : 0;
            }
          }
          if (this.lineWidgets && this.lineWidgets[row] && this.lineWidgets[row].rowsAbove)
            screenRow += this.lineWidgets[row].rowsAbove;
          return {
            row: screenRow,
            column: wrapIndent + this.$getStringScreenWidth(textLine)[0]
          };
        };
        EditSession2.prototype.documentToScreenColumn = function(row, docColumn) {
          return this.documentToScreenPosition(row, docColumn).column;
        };
        EditSession2.prototype.documentToScreenRow = function(docRow, docColumn) {
          return this.documentToScreenPosition(docRow, docColumn).row;
        };
        EditSession2.prototype.getScreenLength = function() {
          var screenRows = 0;
          var fold = null;
          if (!this.$useWrapMode) {
            screenRows = this.getLength();
            var foldData = this.$foldData;
            for (var i2 = 0; i2 < foldData.length; i2++) {
              fold = foldData[i2];
              screenRows -= fold.end.row - fold.start.row;
            }
          } else {
            var lastRow = this.$wrapData.length;
            var row = 0, i2 = 0;
            var fold = this.$foldData[i2++];
            var foldStart = fold ? fold.start.row : Infinity;
            while (row < lastRow) {
              var splits = this.$wrapData[row];
              screenRows += splits ? splits.length + 1 : 1;
              row++;
              if (row > foldStart) {
                row = fold.end.row + 1;
                fold = this.$foldData[i2++];
                foldStart = fold ? fold.start.row : Infinity;
              }
            }
          }
          if (this.lineWidgets)
            screenRows += this.$getWidgetScreenLength();
          return screenRows;
        };
        EditSession2.prototype.$setFontMetrics = function(fm) {
          if (!this.$enableVarChar)
            return;
          this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {
            if (maxScreenColumn === 0)
              return [0, 0];
            if (!maxScreenColumn)
              maxScreenColumn = Infinity;
            screenColumn = screenColumn || 0;
            var c2, column2;
            for (column2 = 0; column2 < str.length; column2++) {
              c2 = str.charAt(column2);
              if (c2 === "	") {
                screenColumn += this.getScreenTabSize(screenColumn);
              } else {
                screenColumn += fm.getCharacterWidth(c2);
              }
              if (screenColumn > maxScreenColumn) {
                break;
              }
            }
            return [screenColumn, column2];
          };
        };
        EditSession2.prototype.getPrecedingCharacter = function() {
          var pos = this.selection.getCursor();
          if (pos.column === 0) {
            return pos.row === 0 ? "" : this.doc.getNewLineCharacter();
          }
          var currentLine = this.getLine(pos.row);
          return currentLine[pos.column - 1];
        };
        EditSession2.prototype.destroy = function() {
          if (!this.destroyed) {
            this.bgTokenizer.setDocument(null);
            this.bgTokenizer.cleanup();
            this.destroyed = true;
          }
          this.endOperation();
          this.$stopWorker();
          this.removeAllListeners();
          if (this.doc) {
            this.doc.off("change", this.$onChange);
          }
          if (this.selection) {
            this.selection.off("changeCursor", this.$onSelectionChange);
            this.selection.off("changeSelection", this.$onSelectionChange);
          }
          this.selection.detach();
        };
        return EditSession2;
      }()
    );
    EditSession.$uid = 0;
    EditSession.prototype.$modes = config2.$modes;
    EditSession.prototype.getValue = EditSession.prototype.toString;
    EditSession.prototype.$defaultUndoManager = {
      undo: function() {
      },
      redo: function() {
      },
      hasUndo: function() {
      },
      hasRedo: function() {
      },
      reset: function() {
      },
      add: function() {
      },
      addSelection: function() {
      },
      startNewGroup: function() {
      },
      addSession: function() {
      }
    };
    EditSession.prototype.$overwrite = false;
    EditSession.prototype.$mode = null;
    EditSession.prototype.$modeId = null;
    EditSession.prototype.$scrollTop = 0;
    EditSession.prototype.$scrollLeft = 0;
    EditSession.prototype.$wrapLimit = 80;
    EditSession.prototype.$useWrapMode = false;
    EditSession.prototype.$wrapLimitRange = {
      min: null,
      max: null
    };
    EditSession.prototype.lineWidgets = null;
    EditSession.prototype.isFullWidth = isFullWidth;
    oop.implement(EditSession.prototype, EventEmitter2);
    var CHAR = 1, CHAR_EXT = 2, PLACEHOLDER_START = 3, PLACEHOLDER_BODY = 4, PUNCTUATION = 9, SPACE = 10, TAB = 11, TAB_SPACE = 12;
    function isFullWidth(c2) {
      if (c2 < 4352)
        return false;
      return c2 >= 4352 && c2 <= 4447 || c2 >= 4515 && c2 <= 4519 || c2 >= 4602 && c2 <= 4607 || c2 >= 9001 && c2 <= 9002 || c2 >= 11904 && c2 <= 11929 || c2 >= 11931 && c2 <= 12019 || c2 >= 12032 && c2 <= 12245 || c2 >= 12272 && c2 <= 12283 || c2 >= 12288 && c2 <= 12350 || c2 >= 12353 && c2 <= 12438 || c2 >= 12441 && c2 <= 12543 || c2 >= 12549 && c2 <= 12589 || c2 >= 12593 && c2 <= 12686 || c2 >= 12688 && c2 <= 12730 || c2 >= 12736 && c2 <= 12771 || c2 >= 12784 && c2 <= 12830 || c2 >= 12832 && c2 <= 12871 || c2 >= 12880 && c2 <= 13054 || c2 >= 13056 && c2 <= 19903 || c2 >= 19968 && c2 <= 42124 || c2 >= 42128 && c2 <= 42182 || c2 >= 43360 && c2 <= 43388 || c2 >= 44032 && c2 <= 55203 || c2 >= 55216 && c2 <= 55238 || c2 >= 55243 && c2 <= 55291 || c2 >= 63744 && c2 <= 64255 || c2 >= 65040 && c2 <= 65049 || c2 >= 65072 && c2 <= 65106 || c2 >= 65108 && c2 <= 65126 || c2 >= 65128 && c2 <= 65131 || c2 >= 65281 && c2 <= 65376 || c2 >= 65504 && c2 <= 65510;
    }
    require2("./edit_session/folding").Folding.call(EditSession.prototype);
    require2("./edit_session/bracket_match").BracketMatch.call(EditSession.prototype);
    config2.defineOptions(EditSession.prototype, "session", {
      wrap: {
        set: function(value2) {
          if (!value2 || value2 == "off")
            value2 = false;
          else if (value2 == "free")
            value2 = true;
          else if (value2 == "printMargin")
            value2 = -1;
          else if (typeof value2 == "string")
            value2 = parseInt(value2, 10) || false;
          if (this.$wrap == value2)
            return;
          this.$wrap = value2;
          if (!value2) {
            this.setUseWrapMode(false);
          } else {
            var col = typeof value2 == "number" ? value2 : null;
            this.setWrapLimitRange(col, col);
            this.setUseWrapMode(true);
          }
        },
        get: function() {
          if (this.getUseWrapMode()) {
            if (this.$wrap == -1)
              return "printMargin";
            if (!this.getWrapLimitRange().min)
              return "free";
            return this.$wrap;
          }
          return "off";
        },
        handlesSet: true
      },
      wrapMethod: {
        set: function(val) {
          val = val == "auto" ? this.$mode.type != "text" : val != "text";
          if (val != this.$wrapAsCode) {
            this.$wrapAsCode = val;
            if (this.$useWrapMode) {
              this.$useWrapMode = false;
              this.setUseWrapMode(true);
            }
          }
        },
        initialValue: "auto"
      },
      indentedSoftWrap: {
        set: function() {
          if (this.$useWrapMode) {
            this.$useWrapMode = false;
            this.setUseWrapMode(true);
          }
        },
        initialValue: true
      },
      firstLineNumber: {
        set: function() {
          this._signal("changeBreakpoint");
        },
        initialValue: 1
      },
      useWorker: {
        set: function(useWorker) {
          this.$useWorker = useWorker;
          this.$stopWorker();
          if (useWorker)
            this.$startWorker();
        },
        initialValue: true
      },
      useSoftTabs: { initialValue: true },
      tabSize: {
        set: function(tabSize) {
          tabSize = parseInt(tabSize);
          if (tabSize > 0 && this.$tabSize !== tabSize) {
            this.$modified = true;
            this.$rowLengthCache = [];
            this.$tabSize = tabSize;
            this._signal("changeTabSize");
          }
        },
        initialValue: 4,
        handlesSet: true
      },
      navigateWithinSoftTabs: { initialValue: false },
      foldStyle: {
        set: function(val) {
          this.setFoldStyle(val);
        },
        handlesSet: true
      },
      overwrite: {
        set: function(val) {
          this._signal("changeOverwrite");
        },
        initialValue: false
      },
      newLineMode: {
        set: function(val) {
          this.doc.setNewLineMode(val);
        },
        get: function() {
          return this.doc.getNewLineMode();
        },
        handlesSet: true
      },
      mode: {
        set: function(val) {
          this.setMode(val);
        },
        get: function() {
          return this.$modeId;
        },
        handlesSet: true
      }
    });
    exports3.EditSession = EditSession;
  });
  ace.define("ace/search", ["require", "exports", "module", "ace/lib/lang", "ace/lib/oop", "ace/range"], function(require2, exports3, module3) {
    var lang2 = require2("./lib/lang");
    var oop = require2("./lib/oop");
    var Range2 = require2("./range").Range;
    var Search2 = (
      /** @class */
      function() {
        function Search3() {
          this.$options = {};
        }
        Search3.prototype.set = function(options) {
          oop.mixin(this.$options, options);
          return this;
        };
        Search3.prototype.getOptions = function() {
          return lang2.copyObject(this.$options);
        };
        Search3.prototype.setOptions = function(options) {
          this.$options = options;
        };
        Search3.prototype.find = function(session) {
          var options = this.$options;
          var iterator2 = this.$matchIterator(session, options);
          if (!iterator2)
            return false;
          var firstRange = null;
          iterator2.forEach(function(sr, sc2, er, ec2) {
            firstRange = new Range2(sr, sc2, er, ec2);
            if (sc2 == ec2 && options.start && /**@type{Range}*/
            options.start.start && options.skipCurrent != false && firstRange.isEqual(
              /**@type{Range}*/
              options.start
            )) {
              firstRange = null;
              return false;
            }
            return true;
          });
          return firstRange;
        };
        Search3.prototype.findAll = function(session) {
          var options = this.$options;
          if (!options.needle)
            return [];
          this.$assembleRegExp(options);
          var range3 = options.range;
          var lines = range3 ? session.getLines(range3.start.row, range3.end.row) : session.doc.getAllLines();
          var ranges = [];
          var re2 = options.re;
          if (options.$isMultiLine) {
            var len = re2.length;
            var maxRow = lines.length - len;
            var prevRange;
            outer:
              for (var row = re2.offset || 0; row <= maxRow; row++) {
                for (var j2 = 0; j2 < len; j2++)
                  if (lines[row + j2].search(re2[j2]) == -1)
                    continue outer;
                var startLine = lines[row];
                var line2 = lines[row + len - 1];
                var startIndex = startLine.length - startLine.match(re2[0])[0].length;
                var endIndex = line2.match(re2[len - 1])[0].length;
                if (prevRange && prevRange.end.row === row && prevRange.end.column > startIndex) {
                  continue;
                }
                ranges.push(prevRange = new Range2(row, startIndex, row + len - 1, endIndex));
                if (len > 2)
                  row = row + len - 2;
              }
          } else {
            for (var matches, i2 = 0; i2 < lines.length; i2++) {
              if (this.$isMultilineSearch(options)) {
                var lng = lines.length - 1;
                matches = this.$multiLineForward(session, re2, i2, lng);
                if (matches) {
                  var end_row = matches.endRow <= lng ? matches.endRow - 1 : lng;
                  if (end_row > i2)
                    i2 = end_row;
                  ranges.push(new Range2(matches.startRow, matches.startCol, matches.endRow, matches.endCol));
                }
              } else {
                matches = lang2.getMatchOffsets(lines[i2], re2);
                for (var j2 = 0; j2 < matches.length; j2++) {
                  var match5 = matches[j2];
                  ranges.push(new Range2(i2, match5.offset, i2, match5.offset + match5.length));
                }
              }
            }
          }
          if (range3) {
            var startColumn = range3.start.column;
            var endColumn = range3.end.column;
            var i2 = 0, j2 = ranges.length - 1;
            while (i2 < j2 && ranges[i2].start.column < startColumn && ranges[i2].start.row == 0)
              i2++;
            var endRow = range3.end.row - range3.start.row;
            while (i2 < j2 && ranges[j2].end.column > endColumn && ranges[j2].end.row == endRow)
              j2--;
            ranges = ranges.slice(i2, j2 + 1);
            for (i2 = 0, j2 = ranges.length; i2 < j2; i2++) {
              ranges[i2].start.row += range3.start.row;
              ranges[i2].end.row += range3.start.row;
            }
          }
          return ranges;
        };
        Search3.prototype.parseReplaceString = function(replaceString) {
          var CharCode = {
            DollarSign: 36,
            Ampersand: 38,
            Digit0: 48,
            Digit1: 49,
            Digit9: 57,
            Backslash: 92,
            n: 110,
            t: 116
          };
          var replacement = "";
          for (var i2 = 0, len = replaceString.length; i2 < len; i2++) {
            var chCode = replaceString.charCodeAt(i2);
            if (chCode === CharCode.Backslash) {
              i2++;
              if (i2 >= len) {
                replacement += "\\";
                break;
              }
              var nextChCode = replaceString.charCodeAt(i2);
              switch (nextChCode) {
                case CharCode.Backslash:
                  replacement += "\\";
                  break;
                case CharCode.n:
                  replacement += "\n";
                  break;
                case CharCode.t:
                  replacement += "	";
                  break;
              }
              continue;
            }
            if (chCode === CharCode.DollarSign) {
              i2++;
              if (i2 >= len) {
                replacement += "$";
                break;
              }
              var nextChCode_1 = replaceString.charCodeAt(i2);
              if (nextChCode_1 === CharCode.DollarSign) {
                replacement += "$$";
                continue;
              }
              if (nextChCode_1 === CharCode.Digit0 || nextChCode_1 === CharCode.Ampersand) {
                replacement += "$&";
                continue;
              }
              if (CharCode.Digit1 <= nextChCode_1 && nextChCode_1 <= CharCode.Digit9) {
                replacement += "$" + replaceString[i2];
                continue;
              }
            }
            replacement += replaceString[i2];
          }
          return replacement || replaceString;
        };
        Search3.prototype.replace = function(input2, replacement) {
          var options = this.$options;
          var re2 = this.$assembleRegExp(options);
          if (options.$isMultiLine)
            return replacement;
          if (!re2)
            return;
          var mtSearch = this.$isMultilineSearch(options);
          if (mtSearch)
            input2 = input2.replace(/\r\n|\r|\n/g, "\n");
          var match5 = re2.exec(input2);
          if (!match5 || !mtSearch && match5[0].length != input2.length)
            return null;
          replacement = options.regExp ? this.parseReplaceString(replacement) : replacement.replace(/\$/g, "$$$$");
          replacement = input2.replace(re2, replacement);
          if (options.preserveCase) {
            replacement = replacement.split("");
            for (var i2 = Math.min(input2.length, input2.length); i2--; ) {
              var ch2 = input2[i2];
              if (ch2 && ch2.toLowerCase() != ch2)
                replacement[i2] = replacement[i2].toUpperCase();
              else
                replacement[i2] = replacement[i2].toLowerCase();
            }
            replacement = replacement.join("");
          }
          return replacement;
        };
        Search3.prototype.$assembleRegExp = function(options, $disableFakeMultiline) {
          if (options.needle instanceof RegExp)
            return options.re = options.needle;
          var needle = options.needle;
          if (!options.needle)
            return options.re = false;
          if (!options.regExp)
            needle = lang2.escapeRegExp(needle);
          var modifier = options.caseSensitive ? "gm" : "gmi";
          try {
            new RegExp(needle, "u");
            options.$supportsUnicodeFlag = true;
            modifier += "u";
          } catch (e2) {
            options.$supportsUnicodeFlag = false;
          }
          if (options.wholeWord)
            needle = addWordBoundary(needle, options);
          options.$isMultiLine = !$disableFakeMultiline && /[\n\r]/.test(needle);
          if (options.$isMultiLine)
            return options.re = this.$assembleMultilineRegExp(needle, modifier);
          try {
            var re2 = new RegExp(needle, modifier);
          } catch (e2) {
            re2 = false;
          }
          return options.re = re2;
        };
        Search3.prototype.$assembleMultilineRegExp = function(needle, modifier) {
          var parts = needle.replace(/\r\n|\r|\n/g, "$\n^").split("\n");
          var re2 = [];
          for (var i2 = 0; i2 < parts.length; i2++)
            try {
              re2.push(new RegExp(parts[i2], modifier));
            } catch (e2) {
              return false;
            }
          return re2;
        };
        Search3.prototype.$isMultilineSearch = function(options) {
          return options.re && /\\r\\n|\\r|\\n/.test(options.re.source) && options.regExp && !options.$isMultiLine;
        };
        Search3.prototype.$multiLineForward = function(session, re2, start2, last) {
          var line2, chunk = chunkEnd(session, start2);
          for (var row = start2; row <= last; ) {
            for (var i2 = 0; i2 < chunk; i2++) {
              if (row > last)
                break;
              var next2 = session.getLine(row++);
              line2 = line2 == null ? next2 : line2 + "\n" + next2;
            }
            var match5 = re2.exec(line2);
            re2.lastIndex = 0;
            if (match5) {
              var beforeMatch = line2.slice(0, match5.index).split("\n");
              var matchedText = match5[0].split("\n");
              var startRow = start2 + beforeMatch.length - 1;
              var startCol = beforeMatch[beforeMatch.length - 1].length;
              var endRow = startRow + matchedText.length - 1;
              var endCol = matchedText.length == 1 ? startCol + matchedText[0].length : matchedText[matchedText.length - 1].length;
              return {
                startRow,
                startCol,
                endRow,
                endCol
              };
            }
          }
          return null;
        };
        Search3.prototype.$multiLineBackward = function(session, re2, endIndex, start2, first) {
          var line2, chunk = chunkEnd(session, start2), endMargin = session.getLine(start2).length - endIndex;
          for (var row = start2; row >= first; ) {
            for (var i2 = 0; i2 < chunk && row >= first; i2++) {
              var next2 = session.getLine(row--);
              line2 = line2 == null ? next2 : next2 + "\n" + line2;
            }
            var match5 = multiLineBackwardMatch(line2, re2, endMargin);
            if (match5) {
              var beforeMatch = line2.slice(0, match5.index).split("\n");
              var matchedText = match5[0].split("\n");
              var startRow = row + beforeMatch.length;
              var startCol = beforeMatch[beforeMatch.length - 1].length;
              var endRow = startRow + matchedText.length - 1;
              var endCol = matchedText.length == 1 ? startCol + matchedText[0].length : matchedText[matchedText.length - 1].length;
              return {
                startRow,
                startCol,
                endRow,
                endCol
              };
            }
          }
          return null;
        };
        Search3.prototype.$matchIterator = function(session, options) {
          var re2 = this.$assembleRegExp(options);
          if (!re2)
            return false;
          var mtSearch = this.$isMultilineSearch(options);
          var mtForward = this.$multiLineForward;
          var mtBackward = this.$multiLineBackward;
          var backwards = options.backwards == true;
          var skipCurrent = options.skipCurrent != false;
          var supportsUnicodeFlag = re2.unicode;
          var range3 = options.range;
          var start2 = options.start;
          if (!start2)
            start2 = range3 ? range3[backwards ? "end" : "start"] : session.selection.getRange();
          if (start2.start)
            start2 = start2[skipCurrent != backwards ? "end" : "start"];
          var firstRow = range3 ? range3.start.row : 0;
          var lastRow = range3 ? range3.end.row : session.getLength() - 1;
          if (backwards) {
            var forEach2 = function(callback2) {
              var row = start2.row;
              if (forEachInLine(row, start2.column, callback2))
                return;
              for (row--; row >= firstRow; row--)
                if (forEachInLine(row, Number.MAX_VALUE, callback2))
                  return;
              if (options.wrap == false)
                return;
              for (row = lastRow, firstRow = start2.row; row >= firstRow; row--)
                if (forEachInLine(row, Number.MAX_VALUE, callback2))
                  return;
            };
          } else {
            var forEach2 = function(callback2) {
              var row = start2.row;
              if (forEachInLine(row, start2.column, callback2))
                return;
              for (row = row + 1; row <= lastRow; row++)
                if (forEachInLine(row, 0, callback2))
                  return;
              if (options.wrap == false)
                return;
              for (row = firstRow, lastRow = start2.row; row <= lastRow; row++)
                if (forEachInLine(row, 0, callback2))
                  return;
            };
          }
          if (options.$isMultiLine) {
            var len = re2.length;
            var forEachInLine = function(row, offset2, callback2) {
              var startRow = backwards ? row - len + 1 : row;
              if (startRow < 0 || startRow + len > session.getLength())
                return;
              var line2 = session.getLine(startRow);
              var startIndex = line2.search(re2[0]);
              if (!backwards && startIndex < offset2 || startIndex === -1)
                return;
              for (var i2 = 1; i2 < len; i2++) {
                line2 = session.getLine(startRow + i2);
                if (line2.search(re2[i2]) == -1)
                  return;
              }
              var endIndex = line2.match(re2[len - 1])[0].length;
              if (backwards && endIndex > offset2)
                return;
              if (callback2(startRow, startIndex, startRow + len - 1, endIndex))
                return true;
            };
          } else if (backwards) {
            var forEachInLine = function(row, endIndex, callback2) {
              if (mtSearch) {
                var pos = mtBackward(session, re2, endIndex, row, firstRow);
                if (!pos)
                  return false;
                if (callback2(pos.startRow, pos.startCol, pos.endRow, pos.endCol))
                  return true;
              } else {
                var line2 = session.getLine(row);
                var matches = [];
                var m2, last = 0;
                re2.lastIndex = 0;
                while (m2 = re2.exec(line2)) {
                  var length2 = m2[0].length;
                  last = m2.index;
                  if (!length2) {
                    if (last >= line2.length)
                      break;
                    re2.lastIndex = last += lang2.skipEmptyMatch(line2, last, supportsUnicodeFlag);
                  }
                  if (m2.index + length2 > endIndex)
                    break;
                  matches.push(m2.index, length2);
                }
                for (var i2 = matches.length - 1; i2 >= 0; i2 -= 2) {
                  var column2 = matches[i2 - 1];
                  var length2 = matches[i2];
                  if (callback2(row, column2, row, column2 + length2))
                    return true;
                }
              }
            };
          } else {
            var forEachInLine = function(row, startIndex, callback2) {
              re2.lastIndex = startIndex;
              if (mtSearch) {
                var pos = mtForward(session, re2, row, lastRow);
                if (pos) {
                  var end_row = pos.endRow <= lastRow ? pos.endRow - 1 : lastRow;
                  if (end_row > row)
                    row = end_row;
                }
                if (!pos)
                  return false;
                if (callback2(pos.startRow, pos.startCol, pos.endRow, pos.endCol))
                  return true;
              } else {
                var line2 = session.getLine(row);
                var last;
                var m2;
                while (m2 = re2.exec(line2)) {
                  var length2 = m2[0].length;
                  last = m2.index;
                  if (callback2(row, last, row, last + length2))
                    return true;
                  if (!length2) {
                    re2.lastIndex = last += lang2.skipEmptyMatch(line2, last, supportsUnicodeFlag);
                    if (last >= line2.length)
                      return false;
                  }
                }
              }
            };
          }
          return { forEach: forEach2 };
        };
        return Search3;
      }()
    );
    function addWordBoundary(needle, options) {
      var supportsLookbehind = lang2.supportsLookbehind();
      function wordBoundary(c2, firstChar2) {
        if (firstChar2 === void 0) {
          firstChar2 = true;
        }
        var wordRegExp = supportsLookbehind && options.$supportsUnicodeFlag ? new RegExp("[\\p{L}\\p{N}_]", "u") : new RegExp("\\w");
        if (wordRegExp.test(c2) || options.regExp) {
          if (supportsLookbehind && options.$supportsUnicodeFlag) {
            if (firstChar2)
              return "(?<=^|[^\\p{L}\\p{N}_])";
            return "(?=[^\\p{L}\\p{N}_]|$)";
          }
          return "\\b";
        }
        return "";
      }
      var needleArray = Array.from(needle);
      var firstChar = needleArray[0];
      var lastChar = needleArray[needleArray.length - 1];
      return wordBoundary(firstChar) + needle + wordBoundary(lastChar, false);
    }
    function multiLineBackwardMatch(line2, re2, endMargin) {
      var match5 = null;
      var from2 = 0;
      while (from2 <= line2.length) {
        re2.lastIndex = from2;
        var newMatch = re2.exec(line2);
        if (!newMatch)
          break;
        var end2 = newMatch.index + newMatch[0].length;
        if (end2 > line2.length - endMargin)
          break;
        if (!match5 || end2 > match5.index + match5[0].length)
          match5 = newMatch;
        from2 = newMatch.index + 1;
      }
      return match5;
    }
    function chunkEnd(session, start2) {
      var base = 5e3, startPosition = { row: start2, column: 0 }, startIndex = session.doc.positionToIndex(startPosition), targetIndex = startIndex + base, targetPosition = session.doc.indexToPosition(targetIndex), targetLine = targetPosition.row;
      return targetLine + 1;
    }
    exports3.Search = Search2;
  });
  ace.define("ace/keyboard/hash_handler", ["require", "exports", "module", "ace/lib/keys", "ace/lib/useragent"], function(require2, exports3, module3) {
    var __extends2 = this && this.__extends || /* @__PURE__ */ function() {
      var extendStatics = function(d2, b2) {
        extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
          d3.__proto__ = b3;
        } || function(d3, b3) {
          for (var p2 in b3)
            if (Object.prototype.hasOwnProperty.call(b3, p2))
              d3[p2] = b3[p2];
        };
        return extendStatics(d2, b2);
      };
      return function(d2, b2) {
        if (typeof b2 !== "function" && b2 !== null)
          throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
        extendStatics(d2, b2);
        function __() {
          this.constructor = d2;
        }
        d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
      };
    }();
    var keyUtil = require2("../lib/keys");
    var useragent = require2("../lib/useragent");
    var KEY_MODS = keyUtil.KEY_MODS;
    var MultiHashHandler = (
      /** @class */
      function() {
        function MultiHashHandler2(config2, platform2) {
          this.$init(config2, platform2, false);
        }
        MultiHashHandler2.prototype.$init = function(config2, platform2, $singleCommand) {
          this.platform = platform2 || (useragent.isMac ? "mac" : "win");
          this.commands = {};
          this.commandKeyBinding = {};
          this.addCommands(config2);
          this.$singleCommand = $singleCommand;
        };
        MultiHashHandler2.prototype.addCommand = function(command) {
          if (this.commands[command.name])
            this.removeCommand(command);
          this.commands[command.name] = command;
          if (command.bindKey)
            this._buildKeyHash(command);
        };
        MultiHashHandler2.prototype.removeCommand = function(command, keepCommand) {
          var name2 = command && (typeof command === "string" ? command : command.name);
          command = this.commands[name2];
          if (!keepCommand)
            delete this.commands[name2];
          var ckb = this.commandKeyBinding;
          for (var keyId in ckb) {
            var cmdGroup = ckb[keyId];
            if (cmdGroup == command) {
              delete ckb[keyId];
            } else if (Array.isArray(cmdGroup)) {
              var i2 = cmdGroup.indexOf(command);
              if (i2 != -1) {
                cmdGroup.splice(i2, 1);
                if (cmdGroup.length == 1)
                  ckb[keyId] = cmdGroup[0];
              }
            }
          }
        };
        MultiHashHandler2.prototype.bindKey = function(key, command, position2) {
          if (typeof key == "object" && key) {
            if (position2 == void 0)
              position2 = key.position;
            key = key[this.platform];
          }
          if (!key)
            return;
          if (typeof command == "function")
            return this.addCommand({ exec: command, bindKey: key, name: command.name || /**@type{string}*/
            key });
          key.split("|").forEach(function(keyPart) {
            var chain2 = "";
            if (keyPart.indexOf(" ") != -1) {
              var parts = keyPart.split(/\s+/);
              keyPart = parts.pop();
              parts.forEach(function(keyPart2) {
                var binding2 = this.parseKeys(keyPart2);
                var id3 = KEY_MODS[binding2.hashId] + binding2.key;
                chain2 += (chain2 ? " " : "") + id3;
                this._addCommandToBinding(chain2, "chainKeys");
              }, this);
              chain2 += " ";
            }
            var binding = this.parseKeys(keyPart);
            var id2 = KEY_MODS[binding.hashId] + binding.key;
            this._addCommandToBinding(chain2 + id2, command, position2);
          }, this);
        };
        MultiHashHandler2.prototype._addCommandToBinding = function(keyId, command, position2) {
          var ckb = this.commandKeyBinding, i2;
          if (!command) {
            delete ckb[keyId];
          } else if (!ckb[keyId] || this.$singleCommand) {
            ckb[keyId] = command;
          } else {
            if (!Array.isArray(ckb[keyId])) {
              ckb[keyId] = [ckb[keyId]];
            } else if ((i2 = ckb[keyId].indexOf(command)) != -1) {
              ckb[keyId].splice(i2, 1);
            }
            if (typeof position2 != "number") {
              position2 = getPosition2(command);
            }
            var commands = ckb[keyId];
            for (i2 = 0; i2 < commands.length; i2++) {
              var other = commands[i2];
              var otherPos = getPosition2(other);
              if (otherPos > position2)
                break;
            }
            commands.splice(i2, 0, command);
          }
        };
        MultiHashHandler2.prototype.addCommands = function(commands) {
          commands && Object.keys(commands).forEach(function(name2) {
            var command = commands[name2];
            if (!command)
              return;
            if (typeof command === "string")
              return this.bindKey(command, name2);
            if (typeof command === "function")
              command = { exec: command };
            if (typeof command !== "object")
              return;
            if (!command.name)
              command.name = name2;
            this.addCommand(command);
          }, this);
        };
        MultiHashHandler2.prototype.removeCommands = function(commands) {
          Object.keys(commands).forEach(function(name2) {
            this.removeCommand(commands[name2]);
          }, this);
        };
        MultiHashHandler2.prototype.bindKeys = function(keyList) {
          Object.keys(keyList).forEach(function(key) {
            this.bindKey(key, keyList[key]);
          }, this);
        };
        MultiHashHandler2.prototype._buildKeyHash = function(command) {
          this.bindKey(command.bindKey, command);
        };
        MultiHashHandler2.prototype.parseKeys = function(keys2) {
          var parts = keys2.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(x2) {
            return x2;
          });
          var key = parts.pop();
          var keyCode = keyUtil[key];
          if (keyUtil.FUNCTION_KEYS[keyCode])
            key = keyUtil.FUNCTION_KEYS[keyCode].toLowerCase();
          else if (!parts.length)
            return { key, hashId: -1 };
          else if (parts.length == 1 && parts[0] == "shift")
            return { key: key.toUpperCase(), hashId: -1 };
          var hashId = 0;
          for (var i2 = parts.length; i2--; ) {
            var modifier = keyUtil.KEY_MODS[parts[i2]];
            if (modifier == null) {
              if (typeof console != "undefined")
                console.error("invalid modifier " + parts[i2] + " in " + keys2);
              return false;
            }
            hashId |= modifier;
          }
          return { key, hashId };
        };
        MultiHashHandler2.prototype.findKeyCommand = function(hashId, keyString) {
          var key = KEY_MODS[hashId] + keyString;
          return this.commandKeyBinding[key];
        };
        MultiHashHandler2.prototype.handleKeyboard = function(data, hashId, keyString, keyCode) {
          if (keyCode < 0)
            return;
          var key = KEY_MODS[hashId] + keyString;
          var command = this.commandKeyBinding[key];
          if (data.$keyChain) {
            data.$keyChain += " " + key;
            command = this.commandKeyBinding[data.$keyChain] || command;
          }
          if (command) {
            if (command == "chainKeys" || command[command.length - 1] == "chainKeys") {
              data.$keyChain = data.$keyChain || key;
              return { command: "null" };
            }
          }
          if (data.$keyChain) {
            if ((!hashId || hashId == 4) && keyString.length == 1)
              data.$keyChain = data.$keyChain.slice(0, -key.length - 1);
            else if (hashId == -1 || keyCode > 0)
              data.$keyChain = "";
          }
          return { command };
        };
        MultiHashHandler2.prototype.getStatusText = function(editor2, data) {
          return data.$keyChain || "";
        };
        return MultiHashHandler2;
      }()
    );
    function getPosition2(command) {
      return typeof command == "object" && command.bindKey && command.bindKey.position || (command.isDefault ? -100 : 0);
    }
    var HashHandler = (
      /** @class */
      function(_super) {
        __extends2(HashHandler2, _super);
        function HashHandler2(config2, platform2) {
          var _this = _super.call(this, config2, platform2) || this;
          _this.$singleCommand = true;
          return _this;
        }
        return HashHandler2;
      }(MultiHashHandler)
    );
    HashHandler.call = function(thisArg, config2, platform2) {
      MultiHashHandler.prototype.$init.call(thisArg, config2, platform2, true);
    };
    MultiHashHandler.call = function(thisArg, config2, platform2) {
      MultiHashHandler.prototype.$init.call(thisArg, config2, platform2, false);
    };
    exports3.HashHandler = HashHandler;
    exports3.MultiHashHandler = MultiHashHandler;
  });
  ace.define("ace/commands/command_manager", ["require", "exports", "module", "ace/lib/oop", "ace/keyboard/hash_handler", "ace/lib/event_emitter"], function(require2, exports3, module3) {
    var __extends2 = this && this.__extends || /* @__PURE__ */ function() {
      var extendStatics = function(d2, b2) {
        extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
          d3.__proto__ = b3;
        } || function(d3, b3) {
          for (var p2 in b3)
            if (Object.prototype.hasOwnProperty.call(b3, p2))
              d3[p2] = b3[p2];
        };
        return extendStatics(d2, b2);
      };
      return function(d2, b2) {
        if (typeof b2 !== "function" && b2 !== null)
          throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
        extendStatics(d2, b2);
        function __() {
          this.constructor = d2;
        }
        d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
      };
    }();
    var oop = require2("../lib/oop");
    var MultiHashHandler = require2("../keyboard/hash_handler").MultiHashHandler;
    var EventEmitter2 = require2("../lib/event_emitter").EventEmitter;
    var CommandManager = (
      /** @class */
      function(_super) {
        __extends2(CommandManager2, _super);
        function CommandManager2(platform2, commands) {
          var _this = _super.call(this, commands, platform2) || this;
          _this.byName = _this.commands;
          _this.setDefaultHandler("exec", function(e2) {
            if (!e2.args) {
              return e2.command.exec(e2.editor, {}, e2.event, true);
            }
            return e2.command.exec(e2.editor, e2.args, e2.event, false);
          });
          return _this;
        }
        CommandManager2.prototype.exec = function(command, editor2, args) {
          if (Array.isArray(command)) {
            for (var i2 = command.length; i2--; ) {
              if (this.exec(command[i2], editor2, args))
                return true;
            }
            return false;
          }
          if (typeof command === "string")
            command = this.commands[command];
          var e2 = { editor: editor2, command, args };
          if (!this.canExecute(command, editor2)) {
            this._signal("commandUnavailable", e2);
            return false;
          }
          e2.returnValue = this._emit("exec", e2);
          this._signal("afterExec", e2);
          return e2.returnValue === false ? false : true;
        };
        CommandManager2.prototype.canExecute = function(command, editor2) {
          if (typeof command === "string")
            command = this.commands[command];
          if (!command)
            return false;
          if (editor2 && editor2.$readOnly && !command.readOnly)
            return false;
          if (this.$checkCommandState != false && command.isAvailable && !command.isAvailable(editor2))
            return false;
          return true;
        };
        CommandManager2.prototype.toggleRecording = function(editor2) {
          if (this.$inReplay)
            return;
          editor2 && editor2._emit("changeStatus");
          if (this.recording) {
            this.macro.pop();
            this.off("exec", this.$addCommandToMacro);
            if (!this.macro.length)
              this.macro = this.oldMacro;
            return this.recording = false;
          }
          if (!this.$addCommandToMacro) {
            this.$addCommandToMacro = (function(e2) {
              this.macro.push([e2.command, e2.args]);
            }).bind(this);
          }
          this.oldMacro = this.macro;
          this.macro = [];
          this.on("exec", this.$addCommandToMacro);
          return this.recording = true;
        };
        CommandManager2.prototype.replay = function(editor2) {
          if (this.$inReplay || !this.macro)
            return;
          if (this.recording)
            return this.toggleRecording(editor2);
          try {
            this.$inReplay = true;
            this.macro.forEach(function(x2) {
              if (typeof x2 == "string")
                this.exec(x2, editor2);
              else
                this.exec(x2[0], editor2, x2[1]);
            }, this);
          } finally {
            this.$inReplay = false;
          }
        };
        CommandManager2.prototype.trimMacro = function(m2) {
          return m2.map(function(x2) {
            if (typeof x2[0] != "string")
              x2[0] = x2[0].name;
            if (!x2[1])
              x2 = x2[0];
            return x2;
          });
        };
        return CommandManager2;
      }(MultiHashHandler)
    );
    oop.implement(CommandManager.prototype, EventEmitter2);
    exports3.CommandManager = CommandManager;
  });
  ace.define("ace/commands/default_commands", ["require", "exports", "module", "ace/lib/lang", "ace/config", "ace/range"], function(require2, exports3, module3) {
    var lang2 = require2("../lib/lang");
    var config2 = require2("../config");
    var Range2 = require2("../range").Range;
    function bindKey(win2, mac) {
      return { win: win2, mac };
    }
    exports3.commands = [
      {
        name: "showSettingsMenu",
        description: "Show settings menu",
        bindKey: bindKey("Ctrl-,", "Command-,"),
        exec: function(editor2) {
          config2.loadModule("ace/ext/settings_menu", function(module4) {
            module4.init(editor2);
            editor2.showSettingsMenu();
          });
        },
        readOnly: true
      },
      {
        name: "goToNextError",
        description: "Go to next error",
        bindKey: bindKey("Alt-E", "F4"),
        exec: function(editor2) {
          config2.loadModule("ace/ext/error_marker", function(module4) {
            module4.showErrorMarker(editor2, 1);
          });
        },
        scrollIntoView: "animate",
        readOnly: true
      },
      {
        name: "goToPreviousError",
        description: "Go to previous error",
        bindKey: bindKey("Alt-Shift-E", "Shift-F4"),
        exec: function(editor2) {
          config2.loadModule("ace/ext/error_marker", function(module4) {
            module4.showErrorMarker(editor2, -1);
          });
        },
        scrollIntoView: "animate",
        readOnly: true
      },
      {
        name: "selectall",
        description: "Select all",
        bindKey: bindKey("Ctrl-A", "Command-A"),
        exec: function(editor2) {
          editor2.selectAll();
        },
        readOnly: true
      },
      {
        name: "centerselection",
        description: "Center selection",
        bindKey: bindKey(null, "Ctrl-L"),
        exec: function(editor2) {
          editor2.centerSelection();
        },
        readOnly: true
      },
      {
        name: "gotoline",
        description: "Go to line...",
        bindKey: bindKey("Ctrl-L", "Command-L"),
        exec: function(editor2, line2) {
          if (typeof line2 === "number" && !isNaN(line2))
            editor2.gotoLine(line2);
          editor2.prompt({ $type: "gotoLine" });
        },
        readOnly: true
      },
      {
        name: "fold",
        bindKey: bindKey("Alt-L|Ctrl-F1", "Command-Alt-L|Command-F1"),
        exec: function(editor2) {
          editor2.session.toggleFold(false);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "center",
        readOnly: true
      },
      {
        name: "unfold",
        bindKey: bindKey("Alt-Shift-L|Ctrl-Shift-F1", "Command-Alt-Shift-L|Command-Shift-F1"),
        exec: function(editor2) {
          editor2.session.toggleFold(true);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "center",
        readOnly: true
      },
      {
        name: "toggleFoldWidget",
        description: "Toggle fold widget",
        bindKey: bindKey("F2", "F2"),
        exec: function(editor2) {
          editor2.session.toggleFoldWidget();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "center",
        readOnly: true
      },
      {
        name: "toggleParentFoldWidget",
        description: "Toggle parent fold widget",
        bindKey: bindKey("Alt-F2", "Alt-F2"),
        exec: function(editor2) {
          editor2.session.toggleFoldWidget(true);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "center",
        readOnly: true
      },
      {
        name: "foldall",
        description: "Fold all",
        bindKey: bindKey(null, "Ctrl-Command-Option-0"),
        exec: function(editor2) {
          editor2.session.foldAll();
        },
        scrollIntoView: "center",
        readOnly: true
      },
      {
        name: "foldAllComments",
        description: "Fold all comments",
        bindKey: bindKey(null, "Ctrl-Command-Option-0"),
        exec: function(editor2) {
          editor2.session.foldAllComments();
        },
        scrollIntoView: "center",
        readOnly: true
      },
      {
        name: "foldOther",
        description: "Fold other",
        bindKey: bindKey("Alt-0", "Command-Option-0"),
        exec: function(editor2) {
          editor2.session.foldAll();
          editor2.session.unfold(editor2.selection.getAllRanges());
        },
        scrollIntoView: "center",
        readOnly: true
      },
      {
        name: "unfoldall",
        description: "Unfold all",
        bindKey: bindKey("Alt-Shift-0", "Command-Option-Shift-0"),
        exec: function(editor2) {
          editor2.session.unfold();
        },
        scrollIntoView: "center",
        readOnly: true
      },
      {
        name: "findnext",
        description: "Find next",
        bindKey: bindKey("Ctrl-K", "Command-G"),
        exec: function(editor2) {
          editor2.findNext();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "center",
        readOnly: true
      },
      {
        name: "findprevious",
        description: "Find previous",
        bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
        exec: function(editor2) {
          editor2.findPrevious();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "center",
        readOnly: true
      },
      {
        name: "selectOrFindNext",
        description: "Select or find next",
        bindKey: bindKey("Alt-K", "Ctrl-G"),
        exec: function(editor2) {
          if (editor2.selection.isEmpty())
            editor2.selection.selectWord();
          else
            editor2.findNext();
        },
        readOnly: true
      },
      {
        name: "selectOrFindPrevious",
        description: "Select or find previous",
        bindKey: bindKey("Alt-Shift-K", "Ctrl-Shift-G"),
        exec: function(editor2) {
          if (editor2.selection.isEmpty())
            editor2.selection.selectWord();
          else
            editor2.findPrevious();
        },
        readOnly: true
      },
      {
        name: "find",
        description: "Find",
        bindKey: bindKey("Ctrl-F", "Command-F"),
        exec: function(editor2) {
          config2.loadModule("ace/ext/searchbox", function(e2) {
            e2.Search(editor2);
          });
        },
        readOnly: true
      },
      {
        name: "overwrite",
        description: "Overwrite",
        bindKey: "Insert",
        exec: function(editor2) {
          editor2.toggleOverwrite();
        },
        readOnly: true
      },
      {
        name: "selecttostart",
        description: "Select to start",
        bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Home|Command-Shift-Up"),
        exec: function(editor2) {
          editor2.getSelection().selectFileStart();
        },
        multiSelectAction: "forEach",
        readOnly: true,
        scrollIntoView: "animate",
        aceCommandGroup: "fileJump"
      },
      {
        name: "gotostart",
        description: "Go to start",
        bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
        exec: function(editor2) {
          editor2.navigateFileStart();
        },
        multiSelectAction: "forEach",
        readOnly: true,
        scrollIntoView: "animate",
        aceCommandGroup: "fileJump"
      },
      {
        name: "selectup",
        description: "Select up",
        bindKey: bindKey("Shift-Up", "Shift-Up|Ctrl-Shift-P"),
        exec: function(editor2) {
          editor2.getSelection().selectUp();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "golineup",
        description: "Go line up",
        bindKey: bindKey("Up", "Up|Ctrl-P"),
        exec: function(editor2, args) {
          editor2.navigateUp(args.times);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "selecttoend",
        description: "Select to end",
        bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-End|Command-Shift-Down"),
        exec: function(editor2) {
          editor2.getSelection().selectFileEnd();
        },
        multiSelectAction: "forEach",
        readOnly: true,
        scrollIntoView: "animate",
        aceCommandGroup: "fileJump"
      },
      {
        name: "gotoend",
        description: "Go to end",
        bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"),
        exec: function(editor2) {
          editor2.navigateFileEnd();
        },
        multiSelectAction: "forEach",
        readOnly: true,
        scrollIntoView: "animate",
        aceCommandGroup: "fileJump"
      },
      {
        name: "selectdown",
        description: "Select down",
        bindKey: bindKey("Shift-Down", "Shift-Down|Ctrl-Shift-N"),
        exec: function(editor2) {
          editor2.getSelection().selectDown();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "golinedown",
        description: "Go line down",
        bindKey: bindKey("Down", "Down|Ctrl-N"),
        exec: function(editor2, args) {
          editor2.navigateDown(args.times);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "selectwordleft",
        description: "Select word left",
        bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"),
        exec: function(editor2) {
          editor2.getSelection().selectWordLeft();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "gotowordleft",
        description: "Go to word left",
        bindKey: bindKey("Ctrl-Left", "Option-Left"),
        exec: function(editor2) {
          editor2.navigateWordLeft();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "selecttolinestart",
        description: "Select to line start",
        bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left|Ctrl-Shift-A"),
        exec: function(editor2) {
          editor2.getSelection().selectLineStart();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "gotolinestart",
        description: "Go to line start",
        bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"),
        exec: function(editor2) {
          editor2.navigateLineStart();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "selectleft",
        description: "Select left",
        bindKey: bindKey("Shift-Left", "Shift-Left|Ctrl-Shift-B"),
        exec: function(editor2) {
          editor2.getSelection().selectLeft();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "gotoleft",
        description: "Go to left",
        bindKey: bindKey("Left", "Left|Ctrl-B"),
        exec: function(editor2, args) {
          editor2.navigateLeft(args.times);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "selectwordright",
        description: "Select word right",
        bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"),
        exec: function(editor2) {
          editor2.getSelection().selectWordRight();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "gotowordright",
        description: "Go to word right",
        bindKey: bindKey("Ctrl-Right", "Option-Right"),
        exec: function(editor2) {
          editor2.navigateWordRight();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "selecttolineend",
        description: "Select to line end",
        bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right|Shift-End|Ctrl-Shift-E"),
        exec: function(editor2) {
          editor2.getSelection().selectLineEnd();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "gotolineend",
        description: "Go to line end",
        bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"),
        exec: function(editor2) {
          editor2.navigateLineEnd();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "selectright",
        description: "Select right",
        bindKey: bindKey("Shift-Right", "Shift-Right"),
        exec: function(editor2) {
          editor2.getSelection().selectRight();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "gotoright",
        description: "Go to right",
        bindKey: bindKey("Right", "Right|Ctrl-F"),
        exec: function(editor2, args) {
          editor2.navigateRight(args.times);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "selectpagedown",
        description: "Select page down",
        bindKey: "Shift-PageDown",
        exec: function(editor2) {
          editor2.selectPageDown();
        },
        readOnly: true
      },
      {
        name: "pagedown",
        description: "Page down",
        bindKey: bindKey(null, "Option-PageDown"),
        exec: function(editor2) {
          editor2.scrollPageDown();
        },
        readOnly: true
      },
      {
        name: "gotopagedown",
        description: "Go to page down",
        bindKey: bindKey("PageDown", "PageDown|Ctrl-V"),
        exec: function(editor2) {
          editor2.gotoPageDown();
        },
        readOnly: true
      },
      {
        name: "selectpageup",
        description: "Select page up",
        bindKey: "Shift-PageUp",
        exec: function(editor2) {
          editor2.selectPageUp();
        },
        readOnly: true
      },
      {
        name: "pageup",
        description: "Page up",
        bindKey: bindKey(null, "Option-PageUp"),
        exec: function(editor2) {
          editor2.scrollPageUp();
        },
        readOnly: true
      },
      {
        name: "gotopageup",
        description: "Go to page up",
        bindKey: "PageUp",
        exec: function(editor2) {
          editor2.gotoPageUp();
        },
        readOnly: true
      },
      {
        name: "scrollup",
        description: "Scroll up",
        bindKey: bindKey("Ctrl-Up", null),
        exec: function(e2) {
          e2.renderer.scrollBy(0, -2 * e2.renderer.layerConfig.lineHeight);
        },
        readOnly: true
      },
      {
        name: "scrolldown",
        description: "Scroll down",
        bindKey: bindKey("Ctrl-Down", null),
        exec: function(e2) {
          e2.renderer.scrollBy(0, 2 * e2.renderer.layerConfig.lineHeight);
        },
        readOnly: true
      },
      {
        name: "selectlinestart",
        description: "Select line start",
        bindKey: "Shift-Home",
        exec: function(editor2) {
          editor2.getSelection().selectLineStart();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "selectlineend",
        description: "Select line end",
        bindKey: "Shift-End",
        exec: function(editor2) {
          editor2.getSelection().selectLineEnd();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "togglerecording",
        description: "Toggle recording",
        bindKey: bindKey("Ctrl-Alt-E", "Command-Option-E"),
        exec: function(editor2) {
          editor2.commands.toggleRecording(editor2);
        },
        readOnly: true
      },
      {
        name: "replaymacro",
        description: "Replay macro",
        bindKey: bindKey("Ctrl-Shift-E", "Command-Shift-E"),
        exec: function(editor2) {
          editor2.commands.replay(editor2);
        },
        readOnly: true
      },
      {
        name: "jumptomatching",
        description: "Jump to matching",
        bindKey: bindKey("Ctrl-\\|Ctrl-P", "Command-\\"),
        exec: function(editor2) {
          editor2.jumpToMatching();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "animate",
        readOnly: true
      },
      {
        name: "selecttomatching",
        description: "Select to matching",
        bindKey: bindKey("Ctrl-Shift-\\|Ctrl-Shift-P", "Command-Shift-\\"),
        exec: function(editor2) {
          editor2.jumpToMatching(true);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "animate",
        readOnly: true
      },
      {
        name: "expandToMatching",
        description: "Expand to matching",
        bindKey: bindKey("Ctrl-Shift-M", "Ctrl-Shift-M"),
        exec: function(editor2) {
          editor2.jumpToMatching(true, true);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "animate",
        readOnly: true
      },
      {
        name: "passKeysToBrowser",
        description: "Pass keys to browser",
        bindKey: bindKey(null, null),
        exec: function() {
        },
        passEvent: true,
        readOnly: true
      },
      {
        name: "copy",
        description: "Copy",
        exec: function(editor2) {
        },
        readOnly: true
      },
      {
        name: "cut",
        description: "Cut",
        exec: function(editor2) {
          var cutLine = editor2.$copyWithEmptySelection && editor2.selection.isEmpty();
          var range3 = cutLine ? editor2.selection.getLineRange() : editor2.selection.getRange();
          editor2._emit("cut", range3);
          if (!range3.isEmpty())
            editor2.session.remove(range3);
          editor2.clearSelection();
        },
        scrollIntoView: "cursor",
        multiSelectAction: "forEach"
      },
      {
        name: "paste",
        description: "Paste",
        exec: function(editor2, args) {
          editor2.$handlePaste(args);
        },
        scrollIntoView: "cursor"
      },
      {
        name: "removeline",
        description: "Remove line",
        bindKey: bindKey("Ctrl-D", "Command-D"),
        exec: function(editor2) {
          editor2.removeLines();
        },
        scrollIntoView: "cursor",
        multiSelectAction: "forEachLine"
      },
      {
        name: "duplicateSelection",
        description: "Duplicate selection",
        bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"),
        exec: function(editor2) {
          editor2.duplicateSelection();
        },
        scrollIntoView: "cursor",
        multiSelectAction: "forEach"
      },
      {
        name: "sortlines",
        description: "Sort lines",
        bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"),
        exec: function(editor2) {
          editor2.sortLines();
        },
        scrollIntoView: "selection",
        multiSelectAction: "forEachLine"
      },
      {
        name: "togglecomment",
        description: "Toggle comment",
        bindKey: bindKey("Ctrl-/", "Command-/"),
        exec: function(editor2) {
          editor2.toggleCommentLines();
        },
        multiSelectAction: "forEachLine",
        scrollIntoView: "selectionPart"
      },
      {
        name: "toggleBlockComment",
        description: "Toggle block comment",
        bindKey: bindKey("Ctrl-Shift-/", "Command-Shift-/"),
        exec: function(editor2) {
          editor2.toggleBlockComment();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "selectionPart"
      },
      {
        name: "modifyNumberUp",
        description: "Modify number up",
        bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"),
        exec: function(editor2) {
          editor2.modifyNumber(1);
        },
        scrollIntoView: "cursor",
        multiSelectAction: "forEach"
      },
      {
        name: "modifyNumberDown",
        description: "Modify number down",
        bindKey: bindKey("Ctrl-Shift-Down", "Alt-Shift-Down"),
        exec: function(editor2) {
          editor2.modifyNumber(-1);
        },
        scrollIntoView: "cursor",
        multiSelectAction: "forEach"
      },
      {
        name: "replace",
        description: "Replace",
        bindKey: bindKey("Ctrl-H", "Command-Option-F"),
        exec: function(editor2) {
          config2.loadModule("ace/ext/searchbox", function(e2) {
            e2.Search(editor2, true);
          });
        }
      },
      {
        name: "undo",
        description: "Undo",
        bindKey: bindKey("Ctrl-Z", "Command-Z"),
        exec: function(editor2) {
          editor2.undo();
        }
      },
      {
        name: "redo",
        description: "Redo",
        bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"),
        exec: function(editor2) {
          editor2.redo();
        }
      },
      {
        name: "copylinesup",
        description: "Copy lines up",
        bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"),
        exec: function(editor2) {
          editor2.copyLinesUp();
        },
        scrollIntoView: "cursor"
      },
      {
        name: "movelinesup",
        description: "Move lines up",
        bindKey: bindKey("Alt-Up", "Option-Up"),
        exec: function(editor2) {
          editor2.moveLinesUp();
        },
        scrollIntoView: "cursor"
      },
      {
        name: "copylinesdown",
        description: "Copy lines down",
        bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"),
        exec: function(editor2) {
          editor2.copyLinesDown();
        },
        scrollIntoView: "cursor"
      },
      {
        name: "movelinesdown",
        description: "Move lines down",
        bindKey: bindKey("Alt-Down", "Option-Down"),
        exec: function(editor2) {
          editor2.moveLinesDown();
        },
        scrollIntoView: "cursor"
      },
      {
        name: "del",
        description: "Delete",
        bindKey: bindKey("Delete", "Delete|Ctrl-D|Shift-Delete"),
        exec: function(editor2) {
          editor2.remove("right");
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "backspace",
        description: "Backspace",
        bindKey: bindKey("Shift-Backspace|Backspace", "Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),
        exec: function(editor2) {
          editor2.remove("left");
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "cut_or_delete",
        description: "Cut or delete",
        bindKey: bindKey("Shift-Delete", null),
        exec: function(editor2) {
          if (editor2.selection.isEmpty()) {
            editor2.remove("left");
          } else {
            return false;
          }
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "removetolinestart",
        description: "Remove to line start",
        bindKey: bindKey("Alt-Backspace", "Command-Backspace"),
        exec: function(editor2) {
          editor2.removeToLineStart();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "removetolineend",
        description: "Remove to line end",
        bindKey: bindKey("Alt-Delete", "Ctrl-K|Command-Delete"),
        exec: function(editor2) {
          editor2.removeToLineEnd();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "removetolinestarthard",
        description: "Remove to line start hard",
        bindKey: bindKey("Ctrl-Shift-Backspace", null),
        exec: function(editor2) {
          var range3 = editor2.selection.getRange();
          range3.start.column = 0;
          editor2.session.remove(range3);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "removetolineendhard",
        description: "Remove to line end hard",
        bindKey: bindKey("Ctrl-Shift-Delete", null),
        exec: function(editor2) {
          var range3 = editor2.selection.getRange();
          range3.end.column = Number.MAX_VALUE;
          editor2.session.remove(range3);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "removewordleft",
        description: "Remove word left",
        bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"),
        exec: function(editor2) {
          editor2.removeWordLeft();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "removewordright",
        description: "Remove word right",
        bindKey: bindKey("Ctrl-Delete", "Alt-Delete"),
        exec: function(editor2) {
          editor2.removeWordRight();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "outdent",
        description: "Outdent",
        bindKey: bindKey("Shift-Tab", "Shift-Tab"),
        exec: function(editor2) {
          editor2.blockOutdent();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "selectionPart"
      },
      {
        name: "indent",
        description: "Indent",
        bindKey: bindKey("Tab", "Tab"),
        exec: function(editor2) {
          editor2.indent();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "selectionPart"
      },
      {
        name: "blockoutdent",
        description: "Block outdent",
        bindKey: bindKey("Ctrl-[", "Ctrl-["),
        exec: function(editor2) {
          editor2.blockOutdent();
        },
        multiSelectAction: "forEachLine",
        scrollIntoView: "selectionPart"
      },
      {
        name: "blockindent",
        description: "Block indent",
        bindKey: bindKey("Ctrl-]", "Ctrl-]"),
        exec: function(editor2) {
          editor2.blockIndent();
        },
        multiSelectAction: "forEachLine",
        scrollIntoView: "selectionPart"
      },
      {
        name: "insertstring",
        description: "Insert string",
        exec: function(editor2, str) {
          editor2.insert(str);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "inserttext",
        description: "Insert text",
        exec: function(editor2, args) {
          editor2.insert(lang2.stringRepeat(args.text || "", args.times || 1));
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "splitline",
        description: "Split line",
        bindKey: bindKey(null, "Ctrl-O"),
        exec: function(editor2) {
          editor2.splitLine();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "transposeletters",
        description: "Transpose letters",
        bindKey: bindKey("Alt-Shift-X", "Ctrl-T"),
        exec: function(editor2) {
          editor2.transposeLetters();
        },
        multiSelectAction: function(editor2) {
          editor2.transposeSelections(1);
        },
        scrollIntoView: "cursor"
      },
      {
        name: "touppercase",
        description: "To uppercase",
        bindKey: bindKey("Ctrl-U", "Ctrl-U"),
        exec: function(editor2) {
          editor2.toUpperCase();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "tolowercase",
        description: "To lowercase",
        bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"),
        exec: function(editor2) {
          editor2.toLowerCase();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "autoindent",
        description: "Auto Indent",
        bindKey: bindKey(null, null),
        exec: function(editor2) {
          editor2.autoIndent();
        },
        scrollIntoView: "animate"
      },
      {
        name: "expandtoline",
        description: "Expand to line",
        bindKey: bindKey("Ctrl-Shift-L", "Command-Shift-L"),
        exec: function(editor2) {
          var range3 = editor2.selection.getRange();
          range3.start.column = range3.end.column = 0;
          range3.end.row++;
          editor2.selection.setRange(range3, false);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "openlink",
        bindKey: bindKey("Ctrl+F3", "F3"),
        exec: function(editor2) {
          editor2.openLink();
        }
      },
      {
        name: "joinlines",
        description: "Join lines",
        bindKey: bindKey(null, null),
        exec: function(editor2) {
          var isBackwards = editor2.selection.isBackwards();
          var selectionStart = isBackwards ? editor2.selection.getSelectionLead() : editor2.selection.getSelectionAnchor();
          var selectionEnd = isBackwards ? editor2.selection.getSelectionAnchor() : editor2.selection.getSelectionLead();
          var firstLineEndCol = editor2.session.doc.getLine(selectionStart.row).length;
          var selectedText = editor2.session.doc.getTextRange(editor2.selection.getRange());
          var selectedCount = selectedText.replace(/\n\s*/, " ").length;
          var insertLine = editor2.session.doc.getLine(selectionStart.row);
          for (var i3 = selectionStart.row + 1; i3 <= selectionEnd.row + 1; i3++) {
            var curLine = lang2.stringTrimLeft(lang2.stringTrimRight(editor2.session.doc.getLine(i3)));
            if (curLine.length !== 0) {
              curLine = " " + curLine;
            }
            insertLine += curLine;
          }
          if (selectionEnd.row + 1 < editor2.session.doc.getLength() - 1) {
            insertLine += editor2.session.doc.getNewLineCharacter();
          }
          editor2.clearSelection();
          editor2.session.doc.replace(new Range2(selectionStart.row, 0, selectionEnd.row + 2, 0), insertLine);
          if (selectedCount > 0) {
            editor2.selection.moveCursorTo(selectionStart.row, selectionStart.column);
            editor2.selection.selectTo(selectionStart.row, selectionStart.column + selectedCount);
          } else {
            firstLineEndCol = editor2.session.doc.getLine(selectionStart.row).length > firstLineEndCol ? firstLineEndCol + 1 : firstLineEndCol;
            editor2.selection.moveCursorTo(selectionStart.row, firstLineEndCol);
          }
        },
        multiSelectAction: "forEach",
        readOnly: true
      },
      {
        name: "invertSelection",
        description: "Invert selection",
        bindKey: bindKey(null, null),
        exec: function(editor2) {
          var endRow = editor2.session.doc.getLength() - 1;
          var endCol = editor2.session.doc.getLine(endRow).length;
          var ranges = editor2.selection.rangeList.ranges;
          var newRanges = [];
          if (ranges.length < 1) {
            ranges = [editor2.selection.getRange()];
          }
          for (var i3 = 0; i3 < ranges.length; i3++) {
            if (i3 == ranges.length - 1) {
              if (!(ranges[i3].end.row === endRow && ranges[i3].end.column === endCol)) {
                newRanges.push(new Range2(ranges[i3].end.row, ranges[i3].end.column, endRow, endCol));
              }
            }
            if (i3 === 0) {
              if (!(ranges[i3].start.row === 0 && ranges[i3].start.column === 0)) {
                newRanges.push(new Range2(0, 0, ranges[i3].start.row, ranges[i3].start.column));
              }
            } else {
              newRanges.push(new Range2(ranges[i3 - 1].end.row, ranges[i3 - 1].end.column, ranges[i3].start.row, ranges[i3].start.column));
            }
          }
          editor2.exitMultiSelectMode();
          editor2.clearSelection();
          for (var i3 = 0; i3 < newRanges.length; i3++) {
            editor2.selection.addRange(newRanges[i3], false);
          }
        },
        readOnly: true,
        scrollIntoView: "none"
      },
      {
        name: "addLineAfter",
        description: "Add new line after the current line",
        exec: function(editor2) {
          editor2.selection.clearSelection();
          editor2.navigateLineEnd();
          editor2.insert("\n");
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "addLineBefore",
        description: "Add new line before the current line",
        exec: function(editor2) {
          editor2.selection.clearSelection();
          var cursor = editor2.getCursorPosition();
          editor2.selection.moveTo(cursor.row - 1, Number.MAX_VALUE);
          editor2.insert("\n");
          if (cursor.row === 0)
            editor2.navigateUp();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "openCommandPallete",
        exec: function(editor2) {
          console.warn("This is an obsolete command. Please use `openCommandPalette` instead.");
          editor2.prompt({ $type: "commands" });
        },
        readOnly: true
      },
      {
        name: "openCommandPalette",
        description: "Open command palette",
        bindKey: bindKey("F1", "F1"),
        exec: function(editor2) {
          editor2.prompt({ $type: "commands" });
        },
        readOnly: true
      },
      {
        name: "modeSelect",
        description: "Change language mode...",
        bindKey: bindKey(null, null),
        exec: function(editor2) {
          editor2.prompt({ $type: "modes" });
        },
        readOnly: true
      }
    ];
    for (var i2 = 1; i2 < 9; i2++) {
      exports3.commands.push({
        name: "foldToLevel" + i2,
        description: "Fold To Level " + i2,
        level: i2,
        exec: function(editor2) {
          editor2.session.foldToLevel(this.level);
        },
        scrollIntoView: "center",
        readOnly: true
      });
    }
  });
  ace.define("ace/keyboard/gutter_handler", ["require", "exports", "module", "ace/lib/keys", "ace/mouse/default_gutter_handler"], function(require2, exports3, module3) {
    var keys2 = require2("../lib/keys");
    var GutterTooltip = require2("../mouse/default_gutter_handler").GutterTooltip;
    var GutterKeyboardHandler = (
      /** @class */
      function() {
        function GutterKeyboardHandler2(editor2) {
          this.editor = editor2;
          this.gutterLayer = editor2.renderer.$gutterLayer;
          this.element = editor2.renderer.$gutter;
          this.lines = editor2.renderer.$gutterLayer.$lines;
          this.activeRowIndex = null;
          this.activeLane = null;
          this.annotationTooltip = new GutterTooltip(this.editor);
        }
        GutterKeyboardHandler2.prototype.addListener = function() {
          this.element.addEventListener("keydown", this.$onGutterKeyDown.bind(this));
          this.element.addEventListener("focusout", this.$blurGutter.bind(this));
          this.editor.on("mousewheel", this.$blurGutter.bind(this));
        };
        GutterKeyboardHandler2.prototype.removeListener = function() {
          this.element.removeEventListener("keydown", this.$onGutterKeyDown.bind(this));
          this.element.removeEventListener("focusout", this.$blurGutter.bind(this));
          this.editor.off("mousewheel", this.$blurGutter.bind(this));
        };
        GutterKeyboardHandler2.prototype.$onGutterKeyDown = function(e2) {
          if (this.annotationTooltip.isOpen) {
            e2.preventDefault();
            if (e2.keyCode === keys2["escape"])
              this.annotationTooltip.hideTooltip();
            return;
          }
          if (e2.target === this.element) {
            if (e2.keyCode != keys2["enter"]) {
              return;
            }
            e2.preventDefault();
            var row = this.editor.getCursorPosition().row;
            if (!this.editor.isRowVisible(row))
              this.editor.scrollToLine(row, true, true);
            setTimeout(
              (function() {
                var index2 = this.$rowToRowIndex(this.gutterLayer.$cursorCell.row);
                var nearestFoldLaneWidgetIndex = this.$findNearestFoldLaneWidget(index2);
                var nearestAnnotationIndex = this.$findNearestAnnotation(index2);
                if (nearestFoldLaneWidgetIndex === null && nearestAnnotationIndex === null)
                  return;
                var futureActiveRowIndex = this.$findClosestNumber(nearestFoldLaneWidgetIndex, nearestAnnotationIndex, index2);
                if (futureActiveRowIndex === nearestFoldLaneWidgetIndex) {
                  this.activeLane = "fold";
                  this.activeRowIndex = nearestFoldLaneWidgetIndex;
                  if (this.$isCustomWidgetVisible(nearestFoldLaneWidgetIndex)) {
                    this.$focusCustomWidget(this.activeRowIndex);
                    return;
                  } else {
                    this.$focusFoldWidget(this.activeRowIndex);
                    return;
                  }
                } else {
                  this.activeRowIndex = nearestAnnotationIndex;
                  this.activeLane = "annotation";
                  this.$focusAnnotation(this.activeRowIndex);
                  return;
                }
              }).bind(this),
              10
            );
            return;
          }
          this.$handleGutterKeyboardInteraction(e2);
          setTimeout((function() {
            this.editor._signal("gutterkeydown", new GutterKeyboardEvent(e2, this));
          }).bind(this), 10);
        };
        GutterKeyboardHandler2.prototype.$handleGutterKeyboardInteraction = function(e2) {
          if (e2.keyCode === keys2["tab"]) {
            e2.preventDefault();
            return;
          }
          if (e2.keyCode === keys2["escape"]) {
            e2.preventDefault();
            this.$blurGutter();
            this.element.focus();
            this.lane = null;
            return;
          }
          if (e2.keyCode === keys2["up"]) {
            e2.preventDefault();
            switch (this.activeLane) {
              case "fold":
                this.$moveFoldWidgetUp();
                break;
              case "annotation":
                this.$moveAnnotationUp();
                break;
            }
            return;
          }
          if (e2.keyCode === keys2["down"]) {
            e2.preventDefault();
            switch (this.activeLane) {
              case "fold":
                this.$moveFoldWidgetDown();
                break;
              case "annotation":
                this.$moveAnnotationDown();
                break;
            }
            return;
          }
          if (e2.keyCode === keys2["left"]) {
            e2.preventDefault();
            this.$switchLane("annotation");
            return;
          }
          if (e2.keyCode === keys2["right"]) {
            e2.preventDefault();
            this.$switchLane("fold");
            return;
          }
          if (e2.keyCode === keys2["enter"] || e2.keyCode === keys2["space"]) {
            e2.preventDefault();
            switch (this.activeLane) {
              case "fold":
                var row = this.$rowIndexToRow(this.activeRowIndex);
                var customWidget = this.editor.session.$gutterCustomWidgets[row];
                if (customWidget) {
                  if (customWidget.callbacks && customWidget.callbacks.onClick) {
                    customWidget.callbacks.onClick(e2, row);
                  }
                } else if (this.gutterLayer.session.foldWidgets[row] === "start") {
                  this.editor.session.onFoldWidgetClick(this.$rowIndexToRow(this.activeRowIndex), e2);
                  setTimeout(
                    (function() {
                      if (this.$rowIndexToRow(this.activeRowIndex) !== row) {
                        this.$blurFoldWidget(this.activeRowIndex);
                        this.activeRowIndex = this.$rowToRowIndex(row);
                        this.$focusFoldWidget(this.activeRowIndex);
                      }
                    }).bind(this),
                    10
                  );
                  break;
                } else if (this.gutterLayer.session.foldWidgets[this.$rowIndexToRow(this.activeRowIndex)] === "end") {
                  break;
                }
                return;
              case "annotation":
                var gutterElement = this.lines.cells[this.activeRowIndex].element.childNodes[2];
                var rect = gutterElement.getBoundingClientRect();
                var style2 = this.annotationTooltip.getElement().style;
                style2.left = rect.right + "px";
                style2.top = rect.bottom + "px";
                this.annotationTooltip.showTooltip(this.$rowIndexToRow(this.activeRowIndex));
                break;
            }
            return;
          }
        };
        GutterKeyboardHandler2.prototype.$blurGutter = function() {
          if (this.activeRowIndex !== null) {
            switch (this.activeLane) {
              case "fold":
                this.$blurFoldWidget(this.activeRowIndex);
                this.$blurCustomWidget(this.activeRowIndex);
                break;
              case "annotation":
                this.$blurAnnotation(this.activeRowIndex);
                break;
            }
          }
          if (this.annotationTooltip.isOpen)
            this.annotationTooltip.hideTooltip();
          return;
        };
        GutterKeyboardHandler2.prototype.$isFoldWidgetVisible = function(index2) {
          var isRowFullyVisible = this.editor.isRowFullyVisible(this.$rowIndexToRow(index2));
          var isIconVisible = this.$getFoldWidget(index2).style.display !== "none";
          return isRowFullyVisible && isIconVisible;
        };
        GutterKeyboardHandler2.prototype.$isCustomWidgetVisible = function(index2) {
          var isRowFullyVisible = this.editor.isRowFullyVisible(this.$rowIndexToRow(index2));
          var isIconVisible = !!this.$getCustomWidget(index2);
          return isRowFullyVisible && isIconVisible;
        };
        GutterKeyboardHandler2.prototype.$isAnnotationVisible = function(index2) {
          var isRowFullyVisible = this.editor.isRowFullyVisible(this.$rowIndexToRow(index2));
          var isIconVisible = this.$getAnnotation(index2).style.display !== "none";
          return isRowFullyVisible && isIconVisible;
        };
        GutterKeyboardHandler2.prototype.$getFoldWidget = function(index2) {
          var cell = this.lines.get(index2);
          var element2 = cell.element;
          return element2.childNodes[1];
        };
        GutterKeyboardHandler2.prototype.$getCustomWidget = function(index2) {
          var cell = this.lines.get(index2);
          var element2 = cell.element;
          return element2.childNodes[3];
        };
        GutterKeyboardHandler2.prototype.$getAnnotation = function(index2) {
          var cell = this.lines.get(index2);
          var element2 = cell.element;
          return element2.childNodes[2];
        };
        GutterKeyboardHandler2.prototype.$findNearestFoldLaneWidget = function(index2) {
          if (this.$isCustomWidgetVisible(index2))
            return index2;
          if (this.$isFoldWidgetVisible(index2))
            return index2;
          var i2 = 0;
          while (index2 - i2 > 0 || index2 + i2 < this.lines.getLength() - 1) {
            i2++;
            if (index2 - i2 >= 0 && this.$isCustomWidgetVisible(index2 - i2))
              return index2 - i2;
            if (index2 + i2 <= this.lines.getLength() - 1 && this.$isCustomWidgetVisible(index2 + i2))
              return index2 + i2;
            if (index2 - i2 >= 0 && this.$isFoldWidgetVisible(index2 - i2))
              return index2 - i2;
            if (index2 + i2 <= this.lines.getLength() - 1 && this.$isFoldWidgetVisible(index2 + i2))
              return index2 + i2;
          }
          return null;
        };
        GutterKeyboardHandler2.prototype.$findNearestAnnotation = function(index2) {
          if (this.$isAnnotationVisible(index2))
            return index2;
          var i2 = 0;
          while (index2 - i2 > 0 || index2 + i2 < this.lines.getLength() - 1) {
            i2++;
            if (index2 - i2 >= 0 && this.$isAnnotationVisible(index2 - i2))
              return index2 - i2;
            if (index2 + i2 <= this.lines.getLength() - 1 && this.$isAnnotationVisible(index2 + i2))
              return index2 + i2;
          }
          return null;
        };
        GutterKeyboardHandler2.prototype.$focusFoldWidget = function(index2) {
          if (index2 == null)
            return;
          var foldWidget = this.$getFoldWidget(index2);
          foldWidget.classList.add(this.editor.renderer.keyboardFocusClassName);
          foldWidget.focus();
        };
        GutterKeyboardHandler2.prototype.$focusCustomWidget = function(index2) {
          if (index2 == null)
            return;
          var customWidget = this.$getCustomWidget(index2);
          if (customWidget) {
            customWidget.classList.add(this.editor.renderer.keyboardFocusClassName);
            customWidget.focus();
          }
        };
        GutterKeyboardHandler2.prototype.$focusAnnotation = function(index2) {
          if (index2 == null)
            return;
          var annotation = this.$getAnnotation(index2);
          annotation.classList.add(this.editor.renderer.keyboardFocusClassName);
          annotation.focus();
        };
        GutterKeyboardHandler2.prototype.$blurFoldWidget = function(index2) {
          var foldWidget = this.$getFoldWidget(index2);
          foldWidget.classList.remove(this.editor.renderer.keyboardFocusClassName);
          foldWidget.blur();
        };
        GutterKeyboardHandler2.prototype.$blurCustomWidget = function(index2) {
          var customWidget = this.$getCustomWidget(index2);
          if (customWidget) {
            customWidget.classList.remove(this.editor.renderer.keyboardFocusClassName);
            customWidget.blur();
          }
        };
        GutterKeyboardHandler2.prototype.$blurAnnotation = function(index2) {
          var annotation = this.$getAnnotation(index2);
          annotation.classList.remove(this.editor.renderer.keyboardFocusClassName);
          annotation.blur();
        };
        GutterKeyboardHandler2.prototype.$moveFoldWidgetUp = function() {
          var index2 = this.activeRowIndex;
          while (index2 > 0) {
            index2--;
            if (this.$isFoldWidgetVisible(index2) || this.$isCustomWidgetVisible(index2)) {
              this.$blurFoldWidget(this.activeRowIndex);
              this.$blurCustomWidget(this.activeRowIndex);
              this.activeRowIndex = index2;
              if (this.$isFoldWidgetVisible(index2)) {
                this.$focusFoldWidget(this.activeRowIndex);
              } else {
                this.$focusCustomWidget(this.activeRowIndex);
              }
              return;
            }
          }
          return;
        };
        GutterKeyboardHandler2.prototype.$moveFoldWidgetDown = function() {
          var index2 = this.activeRowIndex;
          while (index2 < this.lines.getLength() - 1) {
            index2++;
            if (this.$isFoldWidgetVisible(index2) || this.$isCustomWidgetVisible(index2)) {
              this.$blurFoldWidget(this.activeRowIndex);
              this.$blurCustomWidget(this.activeRowIndex);
              this.activeRowIndex = index2;
              if (this.$isFoldWidgetVisible(index2)) {
                this.$focusFoldWidget(this.activeRowIndex);
              } else {
                this.$focusCustomWidget(this.activeRowIndex);
              }
              return;
            }
          }
          return;
        };
        GutterKeyboardHandler2.prototype.$moveAnnotationUp = function() {
          var index2 = this.activeRowIndex;
          while (index2 > 0) {
            index2--;
            if (this.$isAnnotationVisible(index2)) {
              this.$blurAnnotation(this.activeRowIndex);
              this.activeRowIndex = index2;
              this.$focusAnnotation(this.activeRowIndex);
              return;
            }
          }
          return;
        };
        GutterKeyboardHandler2.prototype.$moveAnnotationDown = function() {
          var index2 = this.activeRowIndex;
          while (index2 < this.lines.getLength() - 1) {
            index2++;
            if (this.$isAnnotationVisible(index2)) {
              this.$blurAnnotation(this.activeRowIndex);
              this.activeRowIndex = index2;
              this.$focusAnnotation(this.activeRowIndex);
              return;
            }
          }
          return;
        };
        GutterKeyboardHandler2.prototype.$findClosestNumber = function(num1, num2, target) {
          if (num1 === null)
            return num2;
          if (num2 === null)
            return num1;
          return Math.abs(target - num1) <= Math.abs(target - num2) ? num1 : num2;
        };
        GutterKeyboardHandler2.prototype.$switchLane = function(desinationLane) {
          switch (desinationLane) {
            case "annotation":
              if (this.activeLane === "annotation") {
                break;
              }
              var annotationIndex = this.$findNearestAnnotation(this.activeRowIndex);
              if (annotationIndex == null) {
                break;
              }
              this.activeLane = "annotation";
              this.$blurFoldWidget(this.activeRowIndex);
              this.$blurCustomWidget(this.activeRowIndex);
              this.activeRowIndex = annotationIndex;
              this.$focusAnnotation(this.activeRowIndex);
              break;
            case "fold":
              if (this.activeLane === "fold") {
                break;
              }
              var foldLaneWidgetIndex = this.$findNearestFoldLaneWidget(this.activeRowIndex);
              if (foldLaneWidgetIndex === null) {
                break;
              }
              this.activeLane = "fold";
              this.$blurAnnotation(this.activeRowIndex);
              this.activeRowIndex = foldLaneWidgetIndex;
              if (this.$isCustomWidgetVisible(foldLaneWidgetIndex)) {
                this.$focusCustomWidget(this.activeRowIndex);
              } else {
                this.$focusFoldWidget(this.activeRowIndex);
              }
              break;
          }
          return;
        };
        GutterKeyboardHandler2.prototype.$rowIndexToRow = function(index2) {
          var cell = this.lines.get(index2);
          if (cell)
            return cell.row;
          return null;
        };
        GutterKeyboardHandler2.prototype.$rowToRowIndex = function(row) {
          for (var i2 = 0; i2 < this.lines.getLength(); i2++) {
            var cell = this.lines.get(i2);
            if (cell.row == row)
              return i2;
          }
          return null;
        };
        return GutterKeyboardHandler2;
      }()
    );
    exports3.GutterKeyboardHandler = GutterKeyboardHandler;
    var GutterKeyboardEvent = (
      /** @class */
      function() {
        function GutterKeyboardEvent2(domEvent, gutterKeyboardHandler) {
          this.gutterKeyboardHandler = gutterKeyboardHandler;
          this.domEvent = domEvent;
        }
        GutterKeyboardEvent2.prototype.getKey = function() {
          return keys2.keyCodeToString(this.domEvent.keyCode);
        };
        GutterKeyboardEvent2.prototype.getRow = function() {
          return this.gutterKeyboardHandler.$rowIndexToRow(this.gutterKeyboardHandler.activeRowIndex);
        };
        GutterKeyboardEvent2.prototype.isInAnnotationLane = function() {
          return this.gutterKeyboardHandler.activeLane === "annotation";
        };
        GutterKeyboardEvent2.prototype.isInFoldLane = function() {
          return this.gutterKeyboardHandler.activeLane === "fold";
        };
        return GutterKeyboardEvent2;
      }()
    );
    exports3.GutterKeyboardEvent = GutterKeyboardEvent;
  });
  ace.define("ace/editor", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/lib/lang", "ace/lib/useragent", "ace/keyboard/textinput", "ace/mouse/mouse_handler", "ace/mouse/fold_handler", "ace/keyboard/keybinding", "ace/edit_session", "ace/search", "ace/range", "ace/lib/event_emitter", "ace/commands/command_manager", "ace/commands/default_commands", "ace/config", "ace/token_iterator", "ace/keyboard/gutter_handler", "ace/config", "ace/clipboard", "ace/lib/keys", "ace/lib/event", "ace/tooltip"], function(require2, exports3, module3) {
    var __values = this && this.__values || function(o2) {
      var s2 = typeof Symbol === "function" && Symbol.iterator, m2 = s2 && o2[s2], i2 = 0;
      if (m2)
        return m2.call(o2);
      if (o2 && typeof o2.length === "number")
        return {
          next: function() {
            if (o2 && i2 >= o2.length)
              o2 = void 0;
            return { value: o2 && o2[i2++], done: !o2 };
          }
        };
      throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined.");
    };
    var oop = require2("./lib/oop");
    var dom = require2("./lib/dom");
    var lang2 = require2("./lib/lang");
    var useragent = require2("./lib/useragent");
    var TextInput = require2("./keyboard/textinput").TextInput;
    var MouseHandler = require2("./mouse/mouse_handler").MouseHandler;
    var FoldHandler = require2("./mouse/fold_handler").FoldHandler;
    var KeyBinding = require2("./keyboard/keybinding").KeyBinding;
    var EditSession = require2("./edit_session").EditSession;
    var Search2 = require2("./search").Search;
    var Range2 = require2("./range").Range;
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var CommandManager = require2("./commands/command_manager").CommandManager;
    var defaultCommands = require2("./commands/default_commands").commands;
    var config2 = require2("./config");
    var TokenIterator = require2("./token_iterator").TokenIterator;
    var GutterKeyboardHandler = require2("./keyboard/gutter_handler").GutterKeyboardHandler;
    var nls = require2("./config").nls;
    var clipboard = require2("./clipboard");
    var keys2 = require2("./lib/keys");
    var event = require2("./lib/event");
    var HoverTooltip = require2("./tooltip").HoverTooltip;
    var Editor2 = (
      /** @class */
      function() {
        function Editor3(renderer, session, options) {
          this.id = "editor" + ++Editor3.$uid;
          this.session;
          this.$toDestroy = [];
          var container = renderer.getContainerElement();
          this.container = container;
          this.renderer = renderer;
          this.commands = new CommandManager(useragent.isMac ? "mac" : "win", defaultCommands);
          if (typeof document == "object") {
            this.textInput = new TextInput(renderer.getTextAreaContainer(), this);
            this.renderer.textarea = this.textInput.getElement();
            this.$mouseHandler = new MouseHandler(this);
            new FoldHandler(this);
          }
          this.keyBinding = new KeyBinding(this);
          this.$search = new Search2().set({
            wrap: true
          });
          this.$historyTracker = this.$historyTracker.bind(this);
          this.commands.on("exec", this.$historyTracker);
          this.$initOperationListeners();
          this._$emitInputEvent = lang2.delayedCall((function() {
            this._signal("input", {});
            if (this.session && !this.session.destroyed)
              this.session.bgTokenizer.scheduleStart();
          }).bind(this));
          this.on("change", function(_24, _self) {
            _self._$emitInputEvent.schedule(31);
          });
          this.setSession(session || options && options.session || new EditSession(""));
          config2.resetOptions(this);
          if (options)
            this.setOptions(options);
          config2._signal("editor", this);
        }
        Editor3.prototype.$initOperationListeners = function() {
          this.commands.on("exec", this.startOperation.bind(this), true);
          this.commands.on("afterExec", this.endOperation.bind(this), true);
        };
        Editor3.prototype.startOperation = function(commandEvent) {
          this.session.startOperation(commandEvent);
        };
        Editor3.prototype.endOperation = function(e2) {
          this.session.endOperation(e2);
        };
        Editor3.prototype.onStartOperation = function(commandEvent) {
          this.curOp = this.session.curOp;
          this.curOp.scrollTop = this.renderer.scrollTop;
          this.prevOp = this.session.prevOp;
          if (!commandEvent) {
            this.previousCommand = null;
          }
        };
        Editor3.prototype.onEndOperation = function(e2) {
          if (this.curOp && this.session) {
            if (e2 && e2.returnValue === false) {
              this.curOp = null;
              return;
            }
            this._signal("beforeEndOperation");
            if (!this.curOp)
              return;
            var command = this.curOp.command;
            var scrollIntoView = command && command.scrollIntoView;
            if (scrollIntoView) {
              switch (scrollIntoView) {
                case "center-animate":
                  scrollIntoView = "animate";
                case "center":
                  this.renderer.scrollCursorIntoView(null, 0.5);
                  break;
                case "animate":
                case "cursor":
                  this.renderer.scrollCursorIntoView();
                  break;
                case "selectionPart":
                  var range3 = this.selection.getRange();
                  var config3 = this.renderer.layerConfig;
                  if (range3.start.row >= config3.lastRow || range3.end.row <= config3.firstRow) {
                    this.renderer.scrollSelectionIntoView(this.selection.anchor, this.selection.lead);
                  }
                  break;
              }
              if (scrollIntoView == "animate")
                this.renderer.animateScrolling(this.curOp.scrollTop);
            }
            this.$lastSel = this.session.selection.toJSON();
            this.prevOp = this.curOp;
            this.curOp = null;
          }
        };
        Editor3.prototype.$historyTracker = function(e2) {
          if (!this.$mergeUndoDeltas)
            return;
          var prev2 = this.prevOp;
          var mergeableCommands = this.$mergeableCommands;
          var shouldMerge = prev2.command && e2.command.name == prev2.command.name;
          if (e2.command.name == "insertstring") {
            var text2 = e2.args;
            if (this.mergeNextCommand === void 0)
              this.mergeNextCommand = true;
            shouldMerge = shouldMerge && this.mergeNextCommand && (!/\s/.test(text2) || /\s/.test(prev2.args));
            this.mergeNextCommand = true;
          } else {
            shouldMerge = shouldMerge && mergeableCommands.indexOf(e2.command.name) !== -1;
          }
          if (this.$mergeUndoDeltas != "always" && Date.now() - this.sequenceStartTime > 2e3) {
            shouldMerge = false;
          }
          if (shouldMerge)
            this.session.mergeUndoDeltas = true;
          else if (mergeableCommands.indexOf(e2.command.name) !== -1)
            this.sequenceStartTime = Date.now();
        };
        Editor3.prototype.setKeyboardHandler = function(keyboardHandler, cb2) {
          if (keyboardHandler && typeof keyboardHandler === "string" && keyboardHandler != "ace") {
            this.$keybindingId = keyboardHandler;
            var _self = this;
            config2.loadModule(["keybinding", keyboardHandler], function(module4) {
              if (_self.$keybindingId == keyboardHandler)
                _self.keyBinding.setKeyboardHandler(module4 && module4.handler);
              cb2 && cb2();
            });
          } else {
            this.$keybindingId = null;
            this.keyBinding.setKeyboardHandler(keyboardHandler);
            cb2 && cb2();
          }
        };
        Editor3.prototype.getKeyboardHandler = function() {
          return this.keyBinding.getKeyboardHandler();
        };
        Editor3.prototype.setSession = function(session) {
          if (this.session == session)
            return;
          if (this.curOp)
            this.endOperation();
          this.curOp = {};
          var oldSession = this.session;
          if (oldSession) {
            this.session.off("change", this.$onDocumentChange);
            this.session.off("changeMode", this.$onChangeMode);
            this.session.off("tokenizerUpdate", this.$onTokenizerUpdate);
            this.session.off("changeTabSize", this.$onChangeTabSize);
            this.session.off("changeWrapLimit", this.$onChangeWrapLimit);
            this.session.off("changeWrapMode", this.$onChangeWrapMode);
            this.session.off("changeFold", this.$onChangeFold);
            this.session.off("changeFrontMarker", this.$onChangeFrontMarker);
            this.session.off("changeBackMarker", this.$onChangeBackMarker);
            this.session.off("changeBreakpoint", this.$onChangeBreakpoint);
            this.session.off("changeAnnotation", this.$onChangeAnnotation);
            this.session.off("changeOverwrite", this.$onCursorChange);
            this.session.off("changeScrollTop", this.$onScrollTopChange);
            this.session.off("changeScrollLeft", this.$onScrollLeftChange);
            this.session.off("startOperation", this.$onStartOperation);
            this.session.off("endOperation", this.$onEndOperation);
            var selection = this.session.getSelection();
            selection.off("changeCursor", this.$onCursorChange);
            selection.off("changeSelection", this.$onSelectionChange);
          }
          this.session = session;
          if (session) {
            this.$onDocumentChange = this.onDocumentChange.bind(this);
            session.on("change", this.$onDocumentChange);
            this.renderer.setSession(session);
            this.$onChangeMode = this.onChangeMode.bind(this);
            session.on("changeMode", this.$onChangeMode);
            this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this);
            session.on("tokenizerUpdate", this.$onTokenizerUpdate);
            this.$onChangeTabSize = this.renderer.onChangeTabSize.bind(this.renderer);
            session.on("changeTabSize", this.$onChangeTabSize);
            this.$onChangeWrapLimit = this.onChangeWrapLimit.bind(this);
            session.on("changeWrapLimit", this.$onChangeWrapLimit);
            this.$onChangeWrapMode = this.onChangeWrapMode.bind(this);
            session.on("changeWrapMode", this.$onChangeWrapMode);
            this.$onChangeFold = this.onChangeFold.bind(this);
            session.on("changeFold", this.$onChangeFold);
            this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this);
            this.session.on("changeFrontMarker", this.$onChangeFrontMarker);
            this.$onChangeBackMarker = this.onChangeBackMarker.bind(this);
            this.session.on("changeBackMarker", this.$onChangeBackMarker);
            this.$onChangeBreakpoint = this.onChangeBreakpoint.bind(this);
            this.session.on("changeBreakpoint", this.$onChangeBreakpoint);
            this.$onChangeAnnotation = this.onChangeAnnotation.bind(this);
            this.session.on("changeAnnotation", this.$onChangeAnnotation);
            this.$onCursorChange = this.onCursorChange.bind(this);
            this.session.on("changeOverwrite", this.$onCursorChange);
            this.$onScrollTopChange = this.onScrollTopChange.bind(this);
            this.session.on("changeScrollTop", this.$onScrollTopChange);
            this.$onScrollLeftChange = this.onScrollLeftChange.bind(this);
            this.session.on("changeScrollLeft", this.$onScrollLeftChange);
            this.selection = session.getSelection();
            this.selection.on("changeCursor", this.$onCursorChange);
            this.$onSelectionChange = this.onSelectionChange.bind(this);
            this.selection.on("changeSelection", this.$onSelectionChange);
            this.$onStartOperation = this.onStartOperation.bind(this);
            this.session.on("startOperation", this.$onStartOperation);
            this.$onEndOperation = this.onEndOperation.bind(this);
            this.session.on("endOperation", this.$onEndOperation);
            this.onChangeMode();
            this.onCursorChange();
            this.onScrollTopChange();
            this.onScrollLeftChange();
            this.onSelectionChange();
            this.onChangeFrontMarker();
            this.onChangeBackMarker();
            this.onChangeBreakpoint();
            this.onChangeAnnotation();
            this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
            this.renderer.updateFull();
          } else {
            this.selection = null;
            this.renderer.setSession(session);
          }
          this._signal("changeSession", {
            session,
            oldSession
          });
          this.curOp = null;
          oldSession && oldSession._signal("changeEditor", { oldEditor: this });
          if (oldSession)
            oldSession.$editor = null;
          session && session._signal("changeEditor", { editor: this });
          if (session)
            session.$editor = this;
          if (session && !session.destroyed)
            session.bgTokenizer.scheduleStart();
        };
        Editor3.prototype.getSession = function() {
          return this.session;
        };
        Editor3.prototype.setValue = function(val, cursorPos) {
          this.session.doc.setValue(val);
          if (!cursorPos)
            this.selectAll();
          else if (cursorPos == 1)
            this.navigateFileEnd();
          else if (cursorPos == -1)
            this.navigateFileStart();
          return val;
        };
        Editor3.prototype.getValue = function() {
          return this.session.getValue();
        };
        Editor3.prototype.getSelection = function() {
          return this.selection;
        };
        Editor3.prototype.resize = function(force) {
          this.renderer.onResize(force);
        };
        Editor3.prototype.setTheme = function(theme2, cb2) {
          this.renderer.setTheme(theme2, cb2);
        };
        Editor3.prototype.getTheme = function() {
          return this.renderer.getTheme();
        };
        Editor3.prototype.setStyle = function(style2, incluude) {
          this.renderer.setStyle(style2, incluude);
        };
        Editor3.prototype.unsetStyle = function(style2) {
          this.renderer.unsetStyle(style2);
        };
        Editor3.prototype.getFontSize = function() {
          return this.getOption("fontSize") || dom.computedStyle(this.container).fontSize;
        };
        Editor3.prototype.setFontSize = function(size2) {
          this.setOption("fontSize", size2);
        };
        Editor3.prototype.$highlightBrackets = function() {
          if (this.$highlightPending) {
            return;
          }
          var self2 = this;
          this.$highlightPending = true;
          setTimeout(function() {
            self2.$highlightPending = false;
            var session = self2.session;
            if (!session || session.destroyed)
              return;
            if (session.$bracketHighlight) {
              session.$bracketHighlight.markerIds.forEach(function(id2) {
                session.removeMarker(id2);
              });
              session.$bracketHighlight = null;
            }
            var pos = self2.getCursorPosition();
            var handler = self2.getKeyboardHandler();
            var isBackwards = handler && handler.$getDirectionForHighlight && handler.$getDirectionForHighlight(self2);
            var ranges = session.getMatchingBracketRanges(pos, isBackwards);
            if (!ranges) {
              var iterator2 = new TokenIterator(session, pos.row, pos.column);
              var token2 = iterator2.getCurrentToken();
              if (token2 && /\b(?:tag-open|tag-name)/.test(token2.type)) {
                var tagNamesRanges = session.getMatchingTags(pos);
                if (tagNamesRanges) {
                  ranges = [
                    tagNamesRanges.openTagName.isEmpty() ? tagNamesRanges.openTag : tagNamesRanges.openTagName,
                    tagNamesRanges.closeTagName.isEmpty() ? tagNamesRanges.closeTag : tagNamesRanges.closeTagName
                  ];
                }
              }
            }
            if (!ranges && session.$mode.getMatching)
              ranges = session.$mode.getMatching(self2.session);
            if (!ranges) {
              if (self2.getHighlightIndentGuides())
                self2.renderer.$textLayer.$highlightIndentGuide();
              return;
            }
            var markerType = "ace_bracket";
            if (!Array.isArray(ranges)) {
              ranges = [ranges];
            } else if (ranges.length == 1) {
              markerType = "ace_error_bracket";
            }
            if (ranges.length == 2) {
              if (Range2.comparePoints(ranges[0].end, ranges[1].start) == 0)
                ranges = [Range2.fromPoints(ranges[0].start, ranges[1].end)];
              else if (Range2.comparePoints(ranges[0].start, ranges[1].end) == 0)
                ranges = [Range2.fromPoints(ranges[1].start, ranges[0].end)];
            }
            session.$bracketHighlight = {
              ranges,
              markerIds: ranges.map(function(range3) {
                return session.addMarker(range3, markerType, "text");
              })
            };
            if (self2.getHighlightIndentGuides())
              self2.renderer.$textLayer.$highlightIndentGuide();
          }, 50);
        };
        Editor3.prototype.focus = function() {
          this.textInput.focus();
        };
        Editor3.prototype.isFocused = function() {
          return this.textInput.isFocused();
        };
        Editor3.prototype.blur = function() {
          this.textInput.blur();
        };
        Editor3.prototype.onFocus = function(e2) {
          if (this.$isFocused)
            return;
          this.$isFocused = true;
          this.renderer.showCursor();
          this.renderer.visualizeFocus();
          this._emit("focus", e2);
        };
        Editor3.prototype.onBlur = function(e2) {
          if (!this.$isFocused)
            return;
          this.$isFocused = false;
          this.renderer.hideCursor();
          this.renderer.visualizeBlur();
          this._emit("blur", e2);
        };
        Editor3.prototype.$cursorChange = function() {
          this.renderer.updateCursor();
          this.$highlightBrackets();
          this.$updateHighlightActiveLine();
        };
        Editor3.prototype.onDocumentChange = function(delta) {
          var wrap2 = this.session.$useWrapMode;
          var lastRow = delta.start.row == delta.end.row ? delta.end.row : Infinity;
          this.renderer.updateLines(delta.start.row, lastRow, wrap2);
          this._signal("change", delta);
          this.$cursorChange();
        };
        Editor3.prototype.onTokenizerUpdate = function(e2) {
          var rows = e2.data;
          this.renderer.updateLines(rows.first, rows.last);
        };
        Editor3.prototype.onScrollTopChange = function() {
          this.renderer.scrollToY(this.session.getScrollTop());
        };
        Editor3.prototype.onScrollLeftChange = function() {
          this.renderer.scrollToX(this.session.getScrollLeft());
        };
        Editor3.prototype.onCursorChange = function() {
          this.$cursorChange();
          this._signal("changeSelection");
        };
        Editor3.prototype.$updateHighlightActiveLine = function() {
          var session = this.getSession();
          var highlight;
          if (this.$highlightActiveLine) {
            if (this.$selectionStyle != "line" || !this.selection.isMultiLine())
              highlight = this.getCursorPosition();
            if (this.renderer.theme && this.renderer.theme.$selectionColorConflict && !this.selection.isEmpty())
              highlight = false;
            if (this.renderer.$maxLines && this.session.getLength() === 1 && !(this.renderer.$minLines > 1))
              highlight = false;
          }
          if (session.$highlightLineMarker && !highlight) {
            session.removeMarker(session.$highlightLineMarker.id);
            session.$highlightLineMarker = null;
          } else if (!session.$highlightLineMarker && highlight) {
            var range3 = new Range2(highlight.row, highlight.column, highlight.row, Infinity);
            range3.id = session.addMarker(range3, "ace_active-line", "screenLine");
            session.$highlightLineMarker = range3;
          } else if (highlight) {
            session.$highlightLineMarker.start.row = highlight.row;
            session.$highlightLineMarker.end.row = highlight.row;
            session.$highlightLineMarker.start.column = highlight.column;
            session._signal("changeBackMarker");
          }
        };
        Editor3.prototype.onSelectionChange = function(e2) {
          var session = this.session;
          if (session.$selectionMarker) {
            session.removeMarker(session.$selectionMarker);
          }
          session.$selectionMarker = null;
          if (!this.selection.isEmpty()) {
            var range3 = this.selection.getRange();
            var style2 = this.getSelectionStyle();
            session.$selectionMarker = session.addMarker(range3, "ace_selection", style2);
          } else {
            this.$updateHighlightActiveLine();
          }
          var re2 = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp();
          this.session.highlight(re2);
          this._signal("changeSelection");
        };
        Editor3.prototype.$getSelectionHighLightRegexp = function() {
          var session = this.session;
          var selection = this.getSelectionRange();
          if (selection.isEmpty() || selection.isMultiLine())
            return;
          var startColumn = selection.start.column;
          var endColumn = selection.end.column;
          var line2 = session.getLine(selection.start.row);
          var needle = line2.substring(startColumn, endColumn);
          if (needle.length > 5e3 || !/[\w\d]/.test(needle))
            return;
          var re2 = this.$search.$assembleRegExp({
            wholeWord: true,
            caseSensitive: true,
            needle
          });
          var wordWithBoundary = line2.substring(startColumn - 1, endColumn + 1);
          if (!re2.test(wordWithBoundary))
            return;
          return re2;
        };
        Editor3.prototype.onChangeFrontMarker = function() {
          this.renderer.updateFrontMarkers();
        };
        Editor3.prototype.onChangeBackMarker = function() {
          this.renderer.updateBackMarkers();
        };
        Editor3.prototype.onChangeBreakpoint = function() {
          this.renderer.updateBreakpoints();
        };
        Editor3.prototype.onChangeAnnotation = function() {
          this.renderer.setAnnotations(this.session.getAnnotations());
        };
        Editor3.prototype.onChangeMode = function(e2) {
          this.renderer.updateText();
          this._emit("changeMode", e2);
        };
        Editor3.prototype.onChangeWrapLimit = function() {
          this.renderer.updateFull();
        };
        Editor3.prototype.onChangeWrapMode = function() {
          this.renderer.onResize(true);
        };
        Editor3.prototype.onChangeFold = function() {
          this.$updateHighlightActiveLine();
          this.renderer.updateFull();
        };
        Editor3.prototype.getSelectedText = function() {
          return this.session.getTextRange(this.getSelectionRange());
        };
        Editor3.prototype.getCopyText = function() {
          var text2 = this.getSelectedText();
          var nl2 = this.session.doc.getNewLineCharacter();
          var copyLine = false;
          if (!text2 && this.$copyWithEmptySelection) {
            copyLine = true;
            var ranges = this.selection.getAllRanges();
            for (var i2 = 0; i2 < ranges.length; i2++) {
              var range3 = ranges[i2];
              if (i2 && ranges[i2 - 1].start.row == range3.start.row)
                continue;
              text2 += this.session.getLine(range3.start.row) + nl2;
            }
          }
          var e2 = { text: text2 };
          this._signal("copy", e2);
          clipboard.lineMode = copyLine ? e2.text : false;
          return e2.text;
        };
        Editor3.prototype.onCopy = function() {
          this.commands.exec("copy", this);
        };
        Editor3.prototype.onCut = function() {
          this.commands.exec("cut", this);
        };
        Editor3.prototype.onPaste = function(text2, event2) {
          var e2 = { text: text2, event: event2 };
          this.commands.exec("paste", this, e2);
        };
        Editor3.prototype.$handlePaste = function(e2) {
          if (typeof e2 == "string")
            e2 = { text: e2 };
          this._signal("paste", e2);
          var text2 = e2.text;
          var lineMode = text2 === clipboard.lineMode;
          var session = this.session;
          if (!this.inMultiSelectMode || this.inVirtualSelectionMode) {
            if (lineMode)
              session.insert({ row: this.selection.lead.row, column: 0 }, text2);
            else
              this.insert(text2);
          } else if (lineMode) {
            this.selection.rangeList.ranges.forEach(function(range4) {
              session.insert({ row: range4.start.row, column: 0 }, text2);
            });
          } else {
            var lines = text2.split(/\r\n|\r|\n/);
            var ranges = this.selection.rangeList.ranges;
            var isFullLine = lines.length == 2 && (!lines[0] || !lines[1]);
            if (lines.length != ranges.length || isFullLine)
              return this.commands.exec("insertstring", this, text2);
            for (var i2 = ranges.length; i2--; ) {
              var range3 = ranges[i2];
              if (!range3.isEmpty())
                session.remove(range3);
              session.insert(range3.start, lines[i2]);
            }
          }
        };
        Editor3.prototype.execCommand = function(command, args) {
          return this.commands.exec(command, this, args);
        };
        Editor3.prototype.insert = function(text2, pasted) {
          var session = this.session;
          var mode = session.getMode();
          var cursor = this.getCursorPosition();
          if (this.getBehavioursEnabled() && !pasted) {
            var transform2 = mode.transformAction(session.getState(cursor.row), "insertion", this, session, text2);
            if (transform2) {
              if (text2 !== transform2.text) {
                if (!this.inVirtualSelectionMode) {
                  this.session.mergeUndoDeltas = false;
                  this.mergeNextCommand = false;
                }
              }
              text2 = transform2.text;
            }
          }
          if (text2 == "	")
            text2 = this.session.getTabString();
          if (!this.selection.isEmpty()) {
            var range3 = this.getSelectionRange();
            cursor = this.session.remove(range3);
            this.clearSelection();
          } else if (this.session.getOverwrite() && text2.indexOf("\n") == -1) {
            var range3 = Range2.fromPoints(cursor, cursor);
            range3.end.column += text2.length;
            this.session.remove(range3);
          }
          if (text2 == "\n" || text2 == "\r\n") {
            var line2 = session.getLine(cursor.row);
            if (cursor.column > line2.search(/\S|$/)) {
              var d2 = line2.substr(cursor.column).search(/\S|$/);
              session.doc.removeInLine(cursor.row, cursor.column, cursor.column + d2);
            }
          }
          this.clearSelection();
          var start2 = cursor.column;
          var lineState = session.getState(cursor.row);
          var line2 = session.getLine(cursor.row);
          var shouldOutdent = mode.checkOutdent(lineState, line2, text2);
          session.insert(cursor, text2);
          if (transform2 && transform2.selection) {
            if (transform2.selection.length == 2) {
              this.selection.setSelectionRange(new Range2(cursor.row, start2 + transform2.selection[0], cursor.row, start2 + transform2.selection[1]));
            } else {
              this.selection.setSelectionRange(new Range2(cursor.row + transform2.selection[0], transform2.selection[1], cursor.row + transform2.selection[2], transform2.selection[3]));
            }
          }
          if (this.$enableAutoIndent) {
            if (session.getDocument().isNewLine(text2)) {
              var lineIndent = mode.getNextLineIndent(lineState, line2.slice(0, cursor.column), session.getTabString());
              session.insert({ row: cursor.row + 1, column: 0 }, lineIndent);
            }
            if (shouldOutdent)
              mode.autoOutdent(lineState, session, cursor.row);
          }
        };
        Editor3.prototype.autoIndent = function() {
          var session = this.session;
          var mode = session.getMode();
          var ranges = this.selection.isEmpty() ? [new Range2(0, 0, session.doc.getLength() - 1, 0)] : this.selection.getAllRanges();
          var prevLineState = "";
          var prevLine = "";
          var lineIndent = "";
          var tab2 = session.getTabString();
          for (var i2 = 0; i2 < ranges.length; i2++) {
            var startRow = ranges[i2].start.row;
            var endRow = ranges[i2].end.row;
            for (var row = startRow; row <= endRow; row++) {
              if (row > 0) {
                prevLineState = session.getState(row - 1);
                prevLine = session.getLine(row - 1);
                lineIndent = mode.getNextLineIndent(prevLineState, prevLine, tab2);
              }
              var line2 = session.getLine(row);
              var currIndent = mode.$getIndent(line2);
              if (lineIndent !== currIndent) {
                if (currIndent.length > 0) {
                  var range3 = new Range2(row, 0, row, currIndent.length);
                  session.remove(range3);
                }
                if (lineIndent.length > 0) {
                  session.insert({ row, column: 0 }, lineIndent);
                }
              }
              mode.autoOutdent(prevLineState, session, row);
            }
          }
        };
        Editor3.prototype.onTextInput = function(text2, composition) {
          if (!composition)
            return this.keyBinding.onTextInput(text2);
          this.startOperation({ command: { name: "insertstring" } });
          var applyComposition = this.applyComposition.bind(this, text2, composition);
          if (this.selection.rangeCount)
            this.forEachSelection(applyComposition);
          else
            applyComposition();
          this.endOperation();
        };
        Editor3.prototype.applyComposition = function(text2, composition) {
          if (composition.extendLeft || composition.extendRight) {
            var r2 = this.selection.getRange();
            r2.start.column -= composition.extendLeft;
            r2.end.column += composition.extendRight;
            if (r2.start.column < 0) {
              r2.start.row--;
              r2.start.column += this.session.getLine(r2.start.row).length + 1;
            }
            this.selection.setRange(r2);
            if (!text2 && !r2.isEmpty())
              this.remove();
          }
          if (text2 || !this.selection.isEmpty())
            this.insert(text2, true);
          if (composition.restoreStart || composition.restoreEnd) {
            var r2 = this.selection.getRange();
            r2.start.column -= composition.restoreStart;
            r2.end.column -= composition.restoreEnd;
            this.selection.setRange(r2);
          }
        };
        Editor3.prototype.onCommandKey = function(e2, hashId, keyCode) {
          return this.keyBinding.onCommandKey(e2, hashId, keyCode);
        };
        Editor3.prototype.setOverwrite = function(overwrite) {
          this.session.setOverwrite(overwrite);
        };
        Editor3.prototype.getOverwrite = function() {
          return this.session.getOverwrite();
        };
        Editor3.prototype.toggleOverwrite = function() {
          this.session.toggleOverwrite();
        };
        Editor3.prototype.setScrollSpeed = function(speed) {
          this.setOption("scrollSpeed", speed);
        };
        Editor3.prototype.getScrollSpeed = function() {
          return this.getOption("scrollSpeed");
        };
        Editor3.prototype.setDragDelay = function(dragDelay) {
          this.setOption("dragDelay", dragDelay);
        };
        Editor3.prototype.getDragDelay = function() {
          return this.getOption("dragDelay");
        };
        Editor3.prototype.setSelectionStyle = function(val) {
          this.setOption("selectionStyle", val);
        };
        Editor3.prototype.getSelectionStyle = function() {
          return this.getOption("selectionStyle");
        };
        Editor3.prototype.setHighlightActiveLine = function(shouldHighlight) {
          this.setOption("highlightActiveLine", shouldHighlight);
        };
        Editor3.prototype.getHighlightActiveLine = function() {
          return this.getOption("highlightActiveLine");
        };
        Editor3.prototype.setHighlightGutterLine = function(shouldHighlight) {
          this.setOption("highlightGutterLine", shouldHighlight);
        };
        Editor3.prototype.getHighlightGutterLine = function() {
          return this.getOption("highlightGutterLine");
        };
        Editor3.prototype.setHighlightSelectedWord = function(shouldHighlight) {
          this.setOption("highlightSelectedWord", shouldHighlight);
        };
        Editor3.prototype.getHighlightSelectedWord = function() {
          return this.$highlightSelectedWord;
        };
        Editor3.prototype.setAnimatedScroll = function(shouldAnimate) {
          this.renderer.setAnimatedScroll(shouldAnimate);
        };
        Editor3.prototype.getAnimatedScroll = function() {
          return this.renderer.getAnimatedScroll();
        };
        Editor3.prototype.setShowInvisibles = function(showInvisibles) {
          this.renderer.setShowInvisibles(showInvisibles);
        };
        Editor3.prototype.getShowInvisibles = function() {
          return this.renderer.getShowInvisibles();
        };
        Editor3.prototype.setDisplayIndentGuides = function(display) {
          this.renderer.setDisplayIndentGuides(display);
        };
        Editor3.prototype.getDisplayIndentGuides = function() {
          return this.renderer.getDisplayIndentGuides();
        };
        Editor3.prototype.setHighlightIndentGuides = function(highlight) {
          this.renderer.setHighlightIndentGuides(highlight);
        };
        Editor3.prototype.getHighlightIndentGuides = function() {
          return this.renderer.getHighlightIndentGuides();
        };
        Editor3.prototype.setShowPrintMargin = function(showPrintMargin) {
          this.renderer.setShowPrintMargin(showPrintMargin);
        };
        Editor3.prototype.getShowPrintMargin = function() {
          return this.renderer.getShowPrintMargin();
        };
        Editor3.prototype.setPrintMarginColumn = function(showPrintMargin) {
          this.renderer.setPrintMarginColumn(showPrintMargin);
        };
        Editor3.prototype.getPrintMarginColumn = function() {
          return this.renderer.getPrintMarginColumn();
        };
        Editor3.prototype.setReadOnly = function(readOnly) {
          this.setOption("readOnly", readOnly);
        };
        Editor3.prototype.getReadOnly = function() {
          return this.getOption("readOnly");
        };
        Editor3.prototype.setBehavioursEnabled = function(enabled) {
          this.setOption("behavioursEnabled", enabled);
        };
        Editor3.prototype.getBehavioursEnabled = function() {
          return this.getOption("behavioursEnabled");
        };
        Editor3.prototype.setWrapBehavioursEnabled = function(enabled) {
          this.setOption("wrapBehavioursEnabled", enabled);
        };
        Editor3.prototype.getWrapBehavioursEnabled = function() {
          return this.getOption("wrapBehavioursEnabled");
        };
        Editor3.prototype.setShowFoldWidgets = function(show) {
          this.setOption("showFoldWidgets", show);
        };
        Editor3.prototype.getShowFoldWidgets = function() {
          return this.getOption("showFoldWidgets");
        };
        Editor3.prototype.setFadeFoldWidgets = function(fade) {
          this.setOption("fadeFoldWidgets", fade);
        };
        Editor3.prototype.getFadeFoldWidgets = function() {
          return this.getOption("fadeFoldWidgets");
        };
        Editor3.prototype.remove = function(dir) {
          if (this.selection.isEmpty()) {
            if (dir == "left")
              this.selection.selectLeft();
            else
              this.selection.selectRight();
          }
          var range3 = this.getSelectionRange();
          if (this.getBehavioursEnabled()) {
            var session = this.session;
            var state = session.getState(range3.start.row);
            var new_range = session.getMode().transformAction(state, "deletion", this, session, range3);
            if (range3.end.column === 0) {
              var text2 = session.getTextRange(range3);
              if (text2[text2.length - 1] == "\n") {
                var line2 = session.getLine(range3.end.row);
                if (/^\s+$/.test(line2)) {
                  range3.end.column = line2.length;
                }
              }
            }
            if (new_range)
              range3 = new_range;
          }
          this.session.remove(range3);
          this.clearSelection();
        };
        Editor3.prototype.removeWordRight = function() {
          if (this.selection.isEmpty())
            this.selection.selectWordRight();
          this.session.remove(this.getSelectionRange());
          this.clearSelection();
        };
        Editor3.prototype.removeWordLeft = function() {
          if (this.selection.isEmpty())
            this.selection.selectWordLeft();
          this.session.remove(this.getSelectionRange());
          this.clearSelection();
        };
        Editor3.prototype.removeToLineStart = function() {
          if (this.selection.isEmpty())
            this.selection.selectLineStart();
          if (this.selection.isEmpty())
            this.selection.selectLeft();
          this.session.remove(this.getSelectionRange());
          this.clearSelection();
        };
        Editor3.prototype.removeToLineEnd = function() {
          if (this.selection.isEmpty())
            this.selection.selectLineEnd();
          var range3 = this.getSelectionRange();
          if (range3.start.column == range3.end.column && range3.start.row == range3.end.row) {
            range3.end.column = 0;
            range3.end.row++;
          }
          this.session.remove(range3);
          this.clearSelection();
        };
        Editor3.prototype.splitLine = function() {
          if (!this.selection.isEmpty()) {
            this.session.remove(this.getSelectionRange());
            this.clearSelection();
          }
          var cursor = this.getCursorPosition();
          this.insert("\n");
          this.moveCursorToPosition(cursor);
        };
        Editor3.prototype.setGhostText = function(text2, position2) {
          this.renderer.setGhostText(text2, position2);
        };
        Editor3.prototype.removeGhostText = function() {
          this.renderer.removeGhostText();
        };
        Editor3.prototype.transposeLetters = function() {
          if (!this.selection.isEmpty()) {
            return;
          }
          var cursor = this.getCursorPosition();
          var column2 = cursor.column;
          if (column2 === 0)
            return;
          var line2 = this.session.getLine(cursor.row);
          var swap2, range3;
          if (column2 < line2.length) {
            swap2 = line2.charAt(column2) + line2.charAt(column2 - 1);
            range3 = new Range2(cursor.row, column2 - 1, cursor.row, column2 + 1);
          } else {
            swap2 = line2.charAt(column2 - 1) + line2.charAt(column2 - 2);
            range3 = new Range2(cursor.row, column2 - 2, cursor.row, column2);
          }
          this.session.replace(range3, swap2);
          this.session.selection.moveToPosition(range3.end);
        };
        Editor3.prototype.toLowerCase = function() {
          var originalRange = this.getSelectionRange();
          if (this.selection.isEmpty()) {
            this.selection.selectWord();
          }
          var range3 = this.getSelectionRange();
          var text2 = this.session.getTextRange(range3);
          this.session.replace(range3, text2.toLowerCase());
          this.selection.setSelectionRange(originalRange);
        };
        Editor3.prototype.toUpperCase = function() {
          var originalRange = this.getSelectionRange();
          if (this.selection.isEmpty()) {
            this.selection.selectWord();
          }
          var range3 = this.getSelectionRange();
          var text2 = this.session.getTextRange(range3);
          this.session.replace(range3, text2.toUpperCase());
          this.selection.setSelectionRange(originalRange);
        };
        Editor3.prototype.indent = function() {
          var session = this.session;
          var range3 = this.getSelectionRange();
          if (range3.start.row < range3.end.row) {
            var rows = this.$getSelectedRows();
            session.indentRows(rows.first, rows.last, "	");
            return;
          } else if (range3.start.column < range3.end.column) {
            var text2 = session.getTextRange(range3);
            if (!/^\s+$/.test(text2)) {
              var rows = this.$getSelectedRows();
              session.indentRows(rows.first, rows.last, "	");
              return;
            }
          }
          var line2 = session.getLine(range3.start.row);
          var position2 = range3.start;
          var size2 = session.getTabSize();
          var column2 = session.documentToScreenColumn(position2.row, position2.column);
          if (this.session.getUseSoftTabs()) {
            var count = size2 - column2 % size2;
            var indentString = lang2.stringRepeat(" ", count);
          } else {
            var count = column2 % size2;
            while (line2[range3.start.column - 1] == " " && count) {
              range3.start.column--;
              count--;
            }
            this.selection.setSelectionRange(range3);
            indentString = "	";
          }
          return this.insert(indentString);
        };
        Editor3.prototype.blockIndent = function() {
          var rows = this.$getSelectedRows();
          this.session.indentRows(rows.first, rows.last, "	");
        };
        Editor3.prototype.blockOutdent = function() {
          var selection = this.session.getSelection();
          this.session.outdentRows(selection.getRange());
        };
        Editor3.prototype.sortLines = function() {
          var rows = this.$getSelectedRows();
          var session = this.session;
          var lines = [];
          for (var i2 = rows.first; i2 <= rows.last; i2++)
            lines.push(session.getLine(i2));
          lines.sort(function(a2, b2) {
            if (a2.toLowerCase() < b2.toLowerCase())
              return -1;
            if (a2.toLowerCase() > b2.toLowerCase())
              return 1;
            return 0;
          });
          var deleteRange = new Range2(0, 0, 0, 0);
          for (var i2 = rows.first; i2 <= rows.last; i2++) {
            var line2 = session.getLine(i2);
            deleteRange.start.row = i2;
            deleteRange.end.row = i2;
            deleteRange.end.column = line2.length;
            session.replace(deleteRange, lines[i2 - rows.first]);
          }
        };
        Editor3.prototype.toggleCommentLines = function() {
          var state = this.session.getState(this.getCursorPosition().row);
          var rows = this.$getSelectedRows();
          this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last);
        };
        Editor3.prototype.toggleBlockComment = function() {
          var cursor = this.getCursorPosition();
          var state = this.session.getState(cursor.row);
          var range3 = this.getSelectionRange();
          this.session.getMode().toggleBlockComment(state, this.session, range3, cursor);
        };
        Editor3.prototype.getNumberAt = function(row, column2) {
          var _numberRx = /[\-]?[0-9]+(?:\.[0-9]+)?/g;
          _numberRx.lastIndex = 0;
          var s2 = this.session.getLine(row);
          while (_numberRx.lastIndex < column2) {
            var m2 = _numberRx.exec(s2);
            if (m2.index <= column2 && m2.index + m2[0].length >= column2) {
              var number4 = {
                value: m2[0],
                start: m2.index,
                end: m2.index + m2[0].length
              };
              return number4;
            }
          }
          return null;
        };
        Editor3.prototype.modifyNumber = function(amount) {
          var row = this.selection.getCursor().row;
          var column2 = this.selection.getCursor().column;
          var charRange = new Range2(row, column2 - 1, row, column2);
          var c2 = this.session.getTextRange(charRange);
          if (!isNaN(parseFloat(c2)) && isFinite(c2)) {
            var nr = this.getNumberAt(row, column2);
            if (nr) {
              var fp = nr.value.indexOf(".") >= 0 ? nr.start + nr.value.indexOf(".") + 1 : nr.end;
              var decimals = nr.start + nr.value.length - fp;
              var t2 = parseFloat(nr.value);
              t2 *= Math.pow(10, decimals);
              if (fp !== nr.end && column2 < fp) {
                amount *= Math.pow(10, nr.end - column2 - 1);
              } else {
                amount *= Math.pow(10, nr.end - column2);
              }
              t2 += amount;
              t2 /= Math.pow(10, decimals);
              var nnr = t2.toFixed(decimals);
              var replaceRange = new Range2(row, nr.start, row, nr.end);
              this.session.replace(replaceRange, nnr);
              this.moveCursorTo(row, Math.max(nr.start + 1, column2 + nnr.length - nr.value.length));
            }
          } else {
            this.toggleWord();
          }
        };
        Editor3.prototype.toggleWord = function() {
          var row = this.selection.getCursor().row;
          var column2 = this.selection.getCursor().column;
          this.selection.selectWord();
          var currentState = this.getSelectedText();
          var currWordStart = this.selection.getWordRange().start.column;
          var wordParts = currentState.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g, "$1 ").split(/\s/);
          var delta = column2 - currWordStart - 1;
          if (delta < 0)
            delta = 0;
          var curLength = 0, itLength = 0;
          var that = this;
          if (currentState.match(/[A-Za-z0-9_]+/)) {
            wordParts.forEach(function(item2, i3) {
              itLength = curLength + item2.length;
              if (delta >= curLength && delta <= itLength) {
                currentState = item2;
                that.selection.clearSelection();
                that.moveCursorTo(row, curLength + currWordStart);
                that.selection.selectTo(row, itLength + currWordStart);
              }
              curLength = itLength;
            });
          }
          var wordPairs = this.$toggleWordPairs;
          var reg;
          for (var i2 = 0; i2 < wordPairs.length; i2++) {
            var item = wordPairs[i2];
            for (var j2 = 0; j2 <= 1; j2++) {
              var negate = +!j2;
              var firstCondition = currentState.match(new RegExp("^\\s?_?(" + lang2.escapeRegExp(item[j2]) + ")\\s?$", "i"));
              if (firstCondition) {
                var secondCondition = currentState.match(new RegExp("([_]|^|\\s)(" + lang2.escapeRegExp(firstCondition[1]) + ")($|\\s)", "g"));
                if (secondCondition) {
                  reg = currentState.replace(new RegExp(lang2.escapeRegExp(item[j2]), "i"), function(result) {
                    var res = item[negate];
                    if (result.toUpperCase() == result) {
                      res = res.toUpperCase();
                    } else if (result.charAt(0).toUpperCase() == result.charAt(0)) {
                      res = res.substr(0, 0) + item[negate].charAt(0).toUpperCase() + res.substr(1);
                    }
                    return res;
                  });
                  this.insert(reg);
                  reg = "";
                }
              }
            }
          }
        };
        Editor3.prototype.findLinkAt = function(row, column2) {
          var e_1, _a2;
          var line2 = this.session.getLine(row);
          var wordParts = line2.split(/((?:https?|ftp):\/\/[\S]+)/);
          var columnPosition = column2;
          if (columnPosition < 0)
            columnPosition = 0;
          var previousPosition = 0, currentPosition = 0, match5;
          try {
            for (var wordParts_1 = __values(wordParts), wordParts_1_1 = wordParts_1.next(); !wordParts_1_1.done; wordParts_1_1 = wordParts_1.next()) {
              var item = wordParts_1_1.value;
              currentPosition = previousPosition + item.length;
              if (columnPosition >= previousPosition && columnPosition <= currentPosition) {
                if (item.match(/((?:https?|ftp):\/\/[\S]+)/)) {
                  match5 = item.replace(/[\s:.,'";}\]]+$/, "");
                  break;
                }
              }
              previousPosition = currentPosition;
            }
          } catch (e_1_1) {
            e_1 = { error: e_1_1 };
          } finally {
            try {
              if (wordParts_1_1 && !wordParts_1_1.done && (_a2 = wordParts_1.return))
                _a2.call(wordParts_1);
            } finally {
              if (e_1)
                throw e_1.error;
            }
          }
          return match5;
        };
        Editor3.prototype.openLink = function() {
          var cursor = this.selection.getCursor();
          var url2 = this.findLinkAt(cursor.row, cursor.column);
          if (url2)
            window.open(url2, "_blank");
          return url2 != null;
        };
        Editor3.prototype.removeLines = function() {
          var rows = this.$getSelectedRows();
          this.session.removeFullLines(rows.first, rows.last);
          this.clearSelection();
        };
        Editor3.prototype.duplicateSelection = function() {
          var sel = this.selection;
          var doc = this.session;
          var range3 = sel.getRange();
          var reverse = sel.isBackwards();
          if (range3.isEmpty()) {
            var row = range3.start.row;
            doc.duplicateLines(row, row);
          } else {
            var point2 = reverse ? range3.start : range3.end;
            var endPoint = doc.insert(point2, doc.getTextRange(range3));
            range3.start = point2;
            range3.end = endPoint;
            sel.setSelectionRange(range3, reverse);
          }
        };
        Editor3.prototype.moveLinesDown = function() {
          this.$moveLines(1, false);
        };
        Editor3.prototype.moveLinesUp = function() {
          this.$moveLines(-1, false);
        };
        Editor3.prototype.moveText = function(range3, toPosition, copy2) {
          return this.session.moveText(range3, toPosition, copy2);
        };
        Editor3.prototype.copyLinesUp = function() {
          this.$moveLines(-1, true);
        };
        Editor3.prototype.copyLinesDown = function() {
          this.$moveLines(1, true);
        };
        Editor3.prototype.$moveLines = function(dir, copy2) {
          var rows, moved;
          var selection = this.selection;
          if (!selection.inMultiSelectMode || this.inVirtualSelectionMode) {
            var range3 = selection.toOrientedRange();
            rows = this.$getSelectedRows(range3);
            moved = this.session.$moveLines(rows.first, rows.last, copy2 ? 0 : dir);
            if (copy2 && dir == -1)
              moved = 0;
            range3.moveBy(moved, 0);
            selection.fromOrientedRange(range3);
          } else {
            var ranges = selection.rangeList.ranges;
            selection.rangeList.detach(this.session);
            this.inVirtualSelectionMode = true;
            var diff2 = 0;
            var totalDiff = 0;
            var l2 = ranges.length;
            for (var i2 = 0; i2 < l2; i2++) {
              var rangeIndex = i2;
              ranges[i2].moveBy(diff2, 0);
              rows = this.$getSelectedRows(ranges[i2]);
              var first = rows.first;
              var last = rows.last;
              while (++i2 < l2) {
                if (totalDiff)
                  ranges[i2].moveBy(totalDiff, 0);
                var subRows = this.$getSelectedRows(ranges[i2]);
                if (copy2 && subRows.first != last)
                  break;
                else if (!copy2 && subRows.first > last + 1)
                  break;
                last = subRows.last;
              }
              i2--;
              diff2 = this.session.$moveLines(first, last, copy2 ? 0 : dir);
              if (copy2 && dir == -1)
                rangeIndex = i2 + 1;
              while (rangeIndex <= i2) {
                ranges[rangeIndex].moveBy(diff2, 0);
                rangeIndex++;
              }
              if (!copy2)
                diff2 = 0;
              totalDiff += diff2;
            }
            selection.fromOrientedRange(selection.ranges[0]);
            selection.rangeList.attach(this.session);
            this.inVirtualSelectionMode = false;
          }
        };
        Editor3.prototype.$getSelectedRows = function(range3) {
          range3 = (range3 || this.getSelectionRange()).collapseRows();
          return {
            first: this.session.getRowFoldStart(range3.start.row),
            last: this.session.getRowFoldEnd(range3.end.row)
          };
        };
        Editor3.prototype.onCompositionStart = function(compositionState) {
          this.renderer.showComposition(compositionState);
        };
        Editor3.prototype.onCompositionUpdate = function(text2) {
          this.renderer.setCompositionText(text2);
        };
        Editor3.prototype.onCompositionEnd = function() {
          this.renderer.hideComposition();
        };
        Editor3.prototype.getFirstVisibleRow = function() {
          return this.renderer.getFirstVisibleRow();
        };
        Editor3.prototype.getLastVisibleRow = function() {
          return this.renderer.getLastVisibleRow();
        };
        Editor3.prototype.isRowVisible = function(row) {
          return row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow();
        };
        Editor3.prototype.isRowFullyVisible = function(row) {
          return row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow();
        };
        Editor3.prototype.$getVisibleRowCount = function() {
          return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1;
        };
        Editor3.prototype.$moveByPage = function(dir, select2) {
          var renderer = this.renderer;
          var config3 = this.renderer.layerConfig;
          var rows = dir * Math.floor(config3.height / config3.lineHeight);
          if (select2 === true) {
            this.selection.$moveSelection(function() {
              this.moveCursorBy(rows, 0);
            });
          } else if (select2 === false) {
            this.selection.moveCursorBy(rows, 0);
            this.selection.clearSelection();
          }
          var scrollTop = renderer.scrollTop;
          renderer.scrollBy(0, rows * config3.lineHeight);
          if (select2 != null)
            renderer.scrollCursorIntoView(null, 0.5);
          renderer.animateScrolling(scrollTop);
        };
        Editor3.prototype.selectPageDown = function() {
          this.$moveByPage(1, true);
        };
        Editor3.prototype.selectPageUp = function() {
          this.$moveByPage(-1, true);
        };
        Editor3.prototype.gotoPageDown = function() {
          this.$moveByPage(1, false);
        };
        Editor3.prototype.gotoPageUp = function() {
          this.$moveByPage(-1, false);
        };
        Editor3.prototype.scrollPageDown = function() {
          this.$moveByPage(1);
        };
        Editor3.prototype.scrollPageUp = function() {
          this.$moveByPage(-1);
        };
        Editor3.prototype.scrollToRow = function(row) {
          this.renderer.scrollToRow(row);
        };
        Editor3.prototype.scrollToLine = function(line2, center, animate, callback2) {
          this.renderer.scrollToLine(line2, center, animate, callback2);
        };
        Editor3.prototype.centerSelection = function() {
          var range3 = this.getSelectionRange();
          var pos = {
            row: Math.floor(range3.start.row + (range3.end.row - range3.start.row) / 2),
            column: Math.floor(range3.start.column + (range3.end.column - range3.start.column) / 2)
          };
          this.renderer.alignCursor(pos, 0.5);
        };
        Editor3.prototype.getCursorPosition = function() {
          return this.selection.getCursor();
        };
        Editor3.prototype.getCursorPositionScreen = function() {
          return this.session.documentToScreenPosition(this.getCursorPosition());
        };
        Editor3.prototype.getSelectionRange = function() {
          return this.selection.getRange();
        };
        Editor3.prototype.selectAll = function() {
          this.selection.selectAll();
        };
        Editor3.prototype.clearSelection = function() {
          this.selection.clearSelection();
        };
        Editor3.prototype.moveCursorTo = function(row, column2) {
          this.selection.moveCursorTo(row, column2);
        };
        Editor3.prototype.moveCursorToPosition = function(pos) {
          this.selection.moveCursorToPosition(pos);
        };
        Editor3.prototype.jumpToMatching = function(select2, expand) {
          var cursor = this.getCursorPosition();
          var iterator2 = new TokenIterator(this.session, cursor.row, cursor.column);
          var prevToken = iterator2.getCurrentToken();
          var tokenCount = 0;
          if (prevToken && prevToken.type.indexOf("tag-name") !== -1) {
            prevToken = iterator2.stepBackward();
          }
          var token2 = prevToken || iterator2.stepForward();
          if (!token2)
            return;
          var matchType;
          var found = false;
          var depth = {};
          var i2 = cursor.column - token2.start;
          var bracketType;
          var brackets = {
            ")": "(",
            "(": "(",
            "]": "[",
            "[": "[",
            "{": "{",
            "}": "{"
          };
          do {
            if (token2.value.match(/[{}()\[\]]/g)) {
              for (; i2 < token2.value.length && !found; i2++) {
                if (!brackets[token2.value[i2]]) {
                  continue;
                }
                bracketType = brackets[token2.value[i2]] + "." + token2.type.replace("rparen", "lparen");
                if (isNaN(depth[bracketType])) {
                  depth[bracketType] = 0;
                }
                switch (token2.value[i2]) {
                  case "(":
                  case "[":
                  case "{":
                    depth[bracketType]++;
                    break;
                  case ")":
                  case "]":
                  case "}":
                    depth[bracketType]--;
                    if (depth[bracketType] === -1) {
                      matchType = "bracket";
                      found = true;
                    }
                    break;
                }
              }
            } else if (token2.type.indexOf("tag-name") !== -1) {
              if (isNaN(depth[token2.value])) {
                depth[token2.value] = 0;
              }
              if (prevToken.value === "<" && tokenCount > 1) {
                depth[token2.value]++;
              } else if (prevToken.value === "</") {
                depth[token2.value]--;
              }
              if (depth[token2.value] === -1) {
                matchType = "tag";
                found = true;
              }
            }
            if (!found) {
              prevToken = token2;
              tokenCount++;
              token2 = iterator2.stepForward();
              i2 = 0;
            }
          } while (token2 && !found);
          if (!matchType)
            return;
          var range3, pos;
          if (matchType === "bracket") {
            range3 = this.session.getBracketRange(cursor);
            if (!range3) {
              range3 = new Range2(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + i2 - 1, iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + i2 - 1);
              pos = range3.start;
              if (expand || pos.row === cursor.row && Math.abs(pos.column - cursor.column) < 2)
                range3 = this.session.getBracketRange(pos);
            }
          } else if (matchType === "tag") {
            if (!token2 || token2.type.indexOf("tag-name") === -1)
              return;
            range3 = new Range2(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() - 2, iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() - 2);
            if (range3.compare(cursor.row, cursor.column) === 0) {
              var tagsRanges = this.session.getMatchingTags(cursor);
              if (tagsRanges) {
                if (tagsRanges.openTag.contains(cursor.row, cursor.column)) {
                  range3 = tagsRanges.closeTag;
                  pos = range3.start;
                } else {
                  range3 = tagsRanges.openTag;
                  if (tagsRanges.closeTag.start.row === cursor.row && tagsRanges.closeTag.start.column === cursor.column)
                    pos = range3.end;
                  else
                    pos = range3.start;
                }
              }
            }
            pos = pos || range3.start;
          }
          pos = range3 && range3.cursor || pos;
          if (pos) {
            if (select2) {
              if (range3 && expand) {
                this.selection.setRange(range3);
              } else if (range3 && range3.isEqual(this.getSelectionRange())) {
                this.clearSelection();
              } else {
                this.selection.selectTo(pos.row, pos.column);
              }
            } else {
              this.selection.moveTo(pos.row, pos.column);
            }
          }
        };
        Editor3.prototype.gotoLine = function(lineNumber, column2, animate) {
          this.selection.clearSelection();
          this.session.unfold({ row: lineNumber - 1, column: column2 || 0 });
          this.exitMultiSelectMode && this.exitMultiSelectMode();
          this.moveCursorTo(lineNumber - 1, column2 || 0);
          if (!this.isRowFullyVisible(lineNumber - 1))
            this.scrollToLine(lineNumber - 1, true, animate);
        };
        Editor3.prototype.navigateTo = function(row, column2) {
          this.selection.moveTo(row, column2);
        };
        Editor3.prototype.navigateUp = function(times) {
          if (this.selection.isMultiLine() && !this.selection.isBackwards()) {
            var selectionStart = this.selection.anchor.getPosition();
            return this.moveCursorToPosition(selectionStart);
          }
          this.selection.clearSelection();
          this.selection.moveCursorBy(-times || -1, 0);
        };
        Editor3.prototype.navigateDown = function(times) {
          if (this.selection.isMultiLine() && this.selection.isBackwards()) {
            var selectionEnd = this.selection.anchor.getPosition();
            return this.moveCursorToPosition(selectionEnd);
          }
          this.selection.clearSelection();
          this.selection.moveCursorBy(times || 1, 0);
        };
        Editor3.prototype.navigateLeft = function(times) {
          if (!this.selection.isEmpty()) {
            var selectionStart = this.getSelectionRange().start;
            this.moveCursorToPosition(selectionStart);
          } else {
            times = times || 1;
            while (times--) {
              this.selection.moveCursorLeft();
            }
          }
          this.clearSelection();
        };
        Editor3.prototype.navigateRight = function(times) {
          if (!this.selection.isEmpty()) {
            var selectionEnd = this.getSelectionRange().end;
            this.moveCursorToPosition(selectionEnd);
          } else {
            times = times || 1;
            while (times--) {
              this.selection.moveCursorRight();
            }
          }
          this.clearSelection();
        };
        Editor3.prototype.navigateLineStart = function() {
          this.selection.moveCursorLineStart();
          this.clearSelection();
        };
        Editor3.prototype.navigateLineEnd = function() {
          this.selection.moveCursorLineEnd();
          this.clearSelection();
        };
        Editor3.prototype.navigateFileEnd = function() {
          this.selection.moveCursorFileEnd();
          this.clearSelection();
        };
        Editor3.prototype.navigateFileStart = function() {
          this.selection.moveCursorFileStart();
          this.clearSelection();
        };
        Editor3.prototype.navigateWordRight = function() {
          this.selection.moveCursorWordRight();
          this.clearSelection();
        };
        Editor3.prototype.navigateWordLeft = function() {
          this.selection.moveCursorWordLeft();
          this.clearSelection();
        };
        Editor3.prototype.replace = function(replacement, options) {
          if (options)
            this.$search.set(options);
          var range3 = this.$search.find(this.session);
          var replaced = 0;
          if (!range3)
            return replaced;
          if (this.$tryReplace(range3, replacement)) {
            replaced = 1;
          }
          this.selection.setSelectionRange(range3);
          this.renderer.scrollSelectionIntoView(range3.start, range3.end);
          return replaced;
        };
        Editor3.prototype.replaceAll = function(replacement, options) {
          if (options) {
            this.$search.set(options);
          }
          var ranges = this.$search.findAll(this.session);
          var replaced = 0;
          if (!ranges.length)
            return replaced;
          var selection = this.getSelectionRange();
          this.selection.moveTo(0, 0);
          for (var i2 = ranges.length - 1; i2 >= 0; --i2) {
            if (this.$tryReplace(ranges[i2], replacement)) {
              replaced++;
            }
          }
          this.selection.setSelectionRange(selection);
          return replaced;
        };
        Editor3.prototype.$tryReplace = function(range3, replacement) {
          var input2 = this.session.getTextRange(range3);
          replacement = this.$search.replace(input2, replacement);
          if (replacement !== null) {
            range3.end = this.session.replace(range3, replacement);
            return range3;
          } else {
            return null;
          }
        };
        Editor3.prototype.getLastSearchOptions = function() {
          return this.$search.getOptions();
        };
        Editor3.prototype.find = function(needle, options, animate) {
          if (!options)
            options = {};
          if (typeof needle == "string" || needle instanceof RegExp)
            options.needle = needle;
          else if (typeof needle == "object")
            oop.mixin(options, needle);
          var range3 = this.selection.getRange();
          if (options.needle == null) {
            needle = this.session.getTextRange(range3) || this.$search.$options.needle;
            if (!needle) {
              range3 = this.session.getWordRange(range3.start.row, range3.start.column);
              needle = this.session.getTextRange(range3);
            }
            this.$search.set({ needle });
          }
          this.$search.set(options);
          if (!options.start)
            this.$search.set({ start: range3 });
          var newRange = this.$search.find(this.session);
          if (options.preventScroll)
            return newRange;
          if (newRange) {
            this.revealRange(newRange, animate);
            return newRange;
          }
          if (options.backwards)
            range3.start = range3.end;
          else
            range3.end = range3.start;
          this.selection.setRange(range3);
        };
        Editor3.prototype.findNext = function(options, animate) {
          this.find({ skipCurrent: true, backwards: false }, options, animate);
        };
        Editor3.prototype.findPrevious = function(options, animate) {
          this.find(options, { skipCurrent: true, backwards: true }, animate);
        };
        Editor3.prototype.revealRange = function(range3, animate) {
          this.session.unfold(range3);
          this.selection.setSelectionRange(range3);
          var scrollTop = this.renderer.scrollTop;
          this.renderer.scrollSelectionIntoView(range3.start, range3.end, 0.5);
          if (animate !== false)
            this.renderer.animateScrolling(scrollTop);
        };
        Editor3.prototype.undo = function() {
          this.session.getUndoManager().undo(this.session);
          this.renderer.scrollCursorIntoView(null, 0.5);
        };
        Editor3.prototype.redo = function() {
          this.session.getUndoManager().redo(this.session);
          this.renderer.scrollCursorIntoView(null, 0.5);
        };
        Editor3.prototype.destroy = function() {
          this.destroyed = true;
          if (this.$toDestroy) {
            this.$toDestroy.forEach(function(el2) {
              el2.destroy();
            });
            this.$toDestroy = [];
          }
          if (this.$mouseHandler)
            this.$mouseHandler.destroy();
          this.renderer.destroy();
          this._signal("destroy", this);
          if (this.session)
            this.session.destroy();
          if (this._$emitInputEvent)
            this._$emitInputEvent.cancel();
          this.removeAllListeners();
        };
        Editor3.prototype.setAutoScrollEditorIntoView = function(enable) {
          if (!enable)
            return;
          var rect;
          var self2 = this;
          var shouldScroll = false;
          if (!this.$scrollAnchor)
            this.$scrollAnchor = document.createElement("div");
          var scrollAnchor = this.$scrollAnchor;
          scrollAnchor.style.cssText = "position:absolute";
          this.container.insertBefore(scrollAnchor, this.container.firstChild);
          var onChangeSelection = this.on("changeSelection", function() {
            shouldScroll = true;
          });
          var onBeforeRender = this.renderer.on("beforeRender", function() {
            if (shouldScroll)
              rect = self2.renderer.container.getBoundingClientRect();
          });
          var onAfterRender = this.renderer.on("afterRender", function() {
            if (shouldScroll && rect && (self2.isFocused() || self2.searchBox && self2.searchBox.isFocused())) {
              var renderer = self2.renderer;
              var pos = renderer.$cursorLayer.$pixelPos;
              var config3 = renderer.layerConfig;
              var top2 = pos.top - config3.offset;
              if (pos.top >= 0 && top2 + rect.top < 0) {
                shouldScroll = true;
              } else if (pos.top < config3.height && pos.top + rect.top + config3.lineHeight > window.innerHeight) {
                shouldScroll = false;
              } else {
                shouldScroll = null;
              }
              if (shouldScroll != null) {
                scrollAnchor.style.top = top2 + "px";
                scrollAnchor.style.left = pos.left + "px";
                scrollAnchor.style.height = config3.lineHeight + "px";
                scrollAnchor.scrollIntoView(shouldScroll);
              }
              shouldScroll = rect = null;
            }
          });
          this.setAutoScrollEditorIntoView = function(enable2) {
            if (enable2)
              return;
            delete this.setAutoScrollEditorIntoView;
            this.off("changeSelection", onChangeSelection);
            this.renderer.off("afterRender", onAfterRender);
            this.renderer.off("beforeRender", onBeforeRender);
          };
        };
        Editor3.prototype.$resetCursorStyle = function() {
          var style2 = this.$cursorStyle || "ace";
          var cursorLayer = this.renderer.$cursorLayer;
          if (!cursorLayer)
            return;
          cursorLayer.setSmoothBlinking(/smooth/.test(style2));
          cursorLayer.isBlinking = !this.$readOnly && style2 != "wide";
          dom.setCssClass(cursorLayer.element, "ace_slim-cursors", /slim/.test(style2));
        };
        Editor3.prototype.prompt = function(message, options, callback2) {
          var editor2 = this;
          config2.loadModule("ace/ext/prompt", function(module4) {
            module4.prompt(editor2, message, options, callback2);
          });
        };
        return Editor3;
      }()
    );
    Editor2.$uid = 0;
    Editor2.prototype.curOp = null;
    Editor2.prototype.prevOp = {};
    Editor2.prototype.$mergeableCommands = ["backspace", "del", "insertstring"];
    Editor2.prototype.$toggleWordPairs = [
      ["first", "last"],
      ["true", "false"],
      ["yes", "no"],
      ["width", "height"],
      ["top", "bottom"],
      ["right", "left"],
      ["on", "off"],
      ["x", "y"],
      ["get", "set"],
      ["max", "min"],
      ["horizontal", "vertical"],
      ["show", "hide"],
      ["add", "remove"],
      ["up", "down"],
      ["before", "after"],
      ["even", "odd"],
      ["in", "out"],
      ["inside", "outside"],
      ["next", "previous"],
      ["increase", "decrease"],
      ["attach", "detach"],
      ["&&", "||"],
      ["==", "!="]
    ];
    oop.implement(Editor2.prototype, EventEmitter2);
    config2.defineOptions(Editor2.prototype, "editor", {
      selectionStyle: {
        set: function(style2) {
          this.onSelectionChange();
          this._signal("changeSelectionStyle", { data: style2 });
        },
        initialValue: "line"
      },
      highlightActiveLine: {
        set: function() {
          this.$updateHighlightActiveLine();
        },
        initialValue: true
      },
      highlightSelectedWord: {
        set: function(shouldHighlight) {
          this.$onSelectionChange();
        },
        initialValue: true
      },
      readOnly: {
        set: function(readOnly) {
          var _this = this;
          this.textInput.setReadOnly(readOnly);
          if (this.destroyed)
            return;
          this.$resetCursorStyle();
          if (!this.$readOnlyCallback) {
            this.$readOnlyCallback = function(e2) {
              var shouldShow = false;
              if (e2 && e2.type == "keydown") {
                if (e2 && e2.key && !e2.ctrlKey && !e2.metaKey) {
                  if (e2.key == " ")
                    e2.preventDefault();
                  shouldShow = e2.key.length == 1;
                }
                if (!shouldShow)
                  return;
              } else if (e2 && e2.type !== "exec") {
                shouldShow = true;
              }
              if (shouldShow) {
                if (!_this.hoverTooltip) {
                  _this.hoverTooltip = new HoverTooltip();
                }
                var domNode = dom.createElement("div");
                domNode.textContent = nls("editor.tooltip.disable-editing", "Editing is disabled");
                if (!_this.hoverTooltip.isOpen) {
                  _this.hoverTooltip.showForRange(_this, _this.getSelectionRange(), domNode);
                }
              } else if (_this.hoverTooltip && _this.hoverTooltip.isOpen) {
                _this.hoverTooltip.hide();
              }
            };
          }
          var textArea = this.textInput.getElement();
          if (readOnly) {
            event.addListener(textArea, "keydown", this.$readOnlyCallback, this);
            this.commands.on("exec", this.$readOnlyCallback);
            this.commands.on("commandUnavailable", this.$readOnlyCallback);
          } else {
            event.removeListener(textArea, "keydown", this.$readOnlyCallback);
            this.commands.off("exec", this.$readOnlyCallback);
            this.commands.off("commandUnavailable", this.$readOnlyCallback);
            if (this.hoverTooltip) {
              this.hoverTooltip.destroy();
              this.hoverTooltip = null;
            }
          }
        },
        initialValue: false
      },
      copyWithEmptySelection: {
        set: function(value2) {
          this.textInput.setCopyWithEmptySelection(value2);
        },
        initialValue: false
      },
      cursorStyle: {
        set: function(val) {
          this.$resetCursorStyle();
        },
        values: ["ace", "slim", "smooth", "wide"],
        initialValue: "ace"
      },
      mergeUndoDeltas: {
        values: [false, true, "always"],
        initialValue: true
      },
      behavioursEnabled: { initialValue: true },
      wrapBehavioursEnabled: { initialValue: true },
      enableAutoIndent: { initialValue: true },
      autoScrollEditorIntoView: {
        set: function(val) {
          this.setAutoScrollEditorIntoView(val);
        }
      },
      keyboardHandler: {
        set: function(val) {
          this.setKeyboardHandler(val);
        },
        get: function() {
          return this.$keybindingId;
        },
        handlesSet: true
      },
      value: {
        set: function(val) {
          this.session.setValue(val);
        },
        get: function() {
          return this.getValue();
        },
        handlesSet: true,
        hidden: true
      },
      session: {
        set: function(val) {
          this.setSession(val);
        },
        get: function() {
          return this.session;
        },
        handlesSet: true,
        hidden: true
      },
      showLineNumbers: {
        set: function(show) {
          this.renderer.$gutterLayer.setShowLineNumbers(show);
          this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER);
          if (show && this.$relativeLineNumbers)
            relativeNumberRenderer.attach(this);
          else
            relativeNumberRenderer.detach(this);
        },
        initialValue: true
      },
      relativeLineNumbers: {
        set: function(value2) {
          if (this.$showLineNumbers && value2)
            relativeNumberRenderer.attach(this);
          else
            relativeNumberRenderer.detach(this);
        }
      },
      placeholder: {
        set: function(message) {
          if (!this.$updatePlaceholder) {
            this.$updatePlaceholder = (function() {
              var hasValue2 = this.session && (this.renderer.$composition || this.session.getLength() > 1 || this.session.getLine(0).length > 0);
              if (hasValue2 && this.renderer.placeholderNode) {
                this.renderer.off("afterRender", this.$updatePlaceholder);
                dom.removeCssClass(this.container, "ace_hasPlaceholder");
                this.renderer.placeholderNode.remove();
                this.renderer.placeholderNode = null;
              } else if (!hasValue2 && !this.renderer.placeholderNode) {
                this.renderer.on("afterRender", this.$updatePlaceholder);
                dom.addCssClass(this.container, "ace_hasPlaceholder");
                var el2 = dom.createElement("div");
                el2.className = "ace_placeholder";
                el2.textContent = this.$placeholder || "";
                this.renderer.placeholderNode = el2;
                this.renderer.content.appendChild(this.renderer.placeholderNode);
              } else if (!hasValue2 && this.renderer.placeholderNode) {
                this.renderer.placeholderNode.textContent = this.$placeholder || "";
              }
            }).bind(this);
            this.on("input", this.$updatePlaceholder);
          }
          this.$updatePlaceholder();
        }
      },
      enableKeyboardAccessibility: {
        set: function(value2) {
          var blurCommand = {
            name: "blurTextInput",
            description: "Set focus to the editor content div to allow tabbing through the page",
            bindKey: "Esc",
            exec: function(editor2) {
              editor2.blur();
              editor2.renderer.scroller.focus();
            },
            readOnly: true
          };
          var focusOnEnterKeyup = function(e2) {
            if (e2.target == this.renderer.scroller && e2.keyCode === keys2["enter"]) {
              e2.preventDefault();
              var row = this.getCursorPosition().row;
              if (!this.isRowVisible(row))
                this.scrollToLine(row, true, true);
              this.focus();
            }
          };
          var gutterKeyboardHandler;
          if (value2) {
            this.renderer.enableKeyboardAccessibility = true;
            this.renderer.keyboardFocusClassName = "ace_keyboard-focus";
            this.textInput.getElement().setAttribute("tabindex", -1);
            this.textInput.setNumberOfExtraLines(useragent.isWin ? 3 : 0);
            this.renderer.scroller.setAttribute("tabindex", 0);
            this.renderer.scroller.setAttribute("role", "group");
            this.renderer.scroller.setAttribute("aria-roledescription", nls("editor.scroller.aria-roledescription", "editor"));
            this.renderer.scroller.classList.add(this.renderer.keyboardFocusClassName);
            this.renderer.scroller.setAttribute("aria-label", nls("editor.scroller.aria-label", "Editor content, press Enter to start editing, press Escape to exit"));
            this.renderer.scroller.addEventListener("keyup", focusOnEnterKeyup.bind(this));
            this.commands.addCommand(blurCommand);
            this.renderer.$gutter.setAttribute("tabindex", 0);
            this.renderer.$gutter.setAttribute("aria-hidden", false);
            this.renderer.$gutter.setAttribute("role", "group");
            this.renderer.$gutter.setAttribute("aria-roledescription", nls("editor.gutter.aria-roledescription", "editor gutter"));
            this.renderer.$gutter.setAttribute("aria-label", nls("editor.gutter.aria-label", "Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit"));
            this.renderer.$gutter.classList.add(this.renderer.keyboardFocusClassName);
            this.renderer.content.setAttribute("aria-hidden", true);
            if (!gutterKeyboardHandler)
              gutterKeyboardHandler = new GutterKeyboardHandler(this);
            gutterKeyboardHandler.addListener();
            this.textInput.setAriaOptions({
              setLabel: true
            });
          } else {
            this.renderer.enableKeyboardAccessibility = false;
            this.textInput.getElement().setAttribute("tabindex", 0);
            this.textInput.setNumberOfExtraLines(0);
            this.renderer.scroller.setAttribute("tabindex", -1);
            this.renderer.scroller.removeAttribute("role");
            this.renderer.scroller.removeAttribute("aria-roledescription");
            this.renderer.scroller.classList.remove(this.renderer.keyboardFocusClassName);
            this.renderer.scroller.removeAttribute("aria-label");
            this.renderer.scroller.removeEventListener("keyup", focusOnEnterKeyup.bind(this));
            this.commands.removeCommand(blurCommand);
            this.renderer.content.removeAttribute("aria-hidden");
            this.renderer.$gutter.setAttribute("tabindex", -1);
            this.renderer.$gutter.setAttribute("aria-hidden", true);
            this.renderer.$gutter.removeAttribute("role");
            this.renderer.$gutter.removeAttribute("aria-roledescription");
            this.renderer.$gutter.removeAttribute("aria-label");
            this.renderer.$gutter.classList.remove(this.renderer.keyboardFocusClassName);
            if (gutterKeyboardHandler)
              gutterKeyboardHandler.removeListener();
          }
        },
        initialValue: false
      },
      textInputAriaLabel: {
        set: function(val) {
          this.$textInputAriaLabel = val;
        },
        initialValue: ""
      },
      enableMobileMenu: {
        set: function(val) {
          this.$enableMobileMenu = val;
        },
        initialValue: true
      },
      customScrollbar: "renderer",
      hScrollBarAlwaysVisible: "renderer",
      vScrollBarAlwaysVisible: "renderer",
      highlightGutterLine: "renderer",
      animatedScroll: "renderer",
      showInvisibles: "renderer",
      showPrintMargin: "renderer",
      printMarginColumn: "renderer",
      printMargin: "renderer",
      fadeFoldWidgets: "renderer",
      showFoldWidgets: "renderer",
      displayIndentGuides: "renderer",
      highlightIndentGuides: "renderer",
      showGutter: "renderer",
      fontSize: "renderer",
      fontFamily: "renderer",
      maxLines: "renderer",
      minLines: "renderer",
      scrollPastEnd: "renderer",
      fixedWidthGutter: "renderer",
      theme: "renderer",
      hasCssTransforms: "renderer",
      maxPixelHeight: "renderer",
      useTextareaForIME: "renderer",
      useResizeObserver: "renderer",
      useSvgGutterIcons: "renderer",
      showFoldedAnnotations: "renderer",
      scrollSpeed: "$mouseHandler",
      dragDelay: "$mouseHandler",
      dragEnabled: "$mouseHandler",
      focusTimeout: "$mouseHandler",
      tooltipFollowsMouse: "$mouseHandler",
      firstLineNumber: "session",
      overwrite: "session",
      newLineMode: "session",
      useWorker: "session",
      useSoftTabs: "session",
      navigateWithinSoftTabs: "session",
      tabSize: "session",
      wrap: "session",
      indentedSoftWrap: "session",
      foldStyle: "session",
      mode: "session"
    });
    var relativeNumberRenderer = {
      getText: function(session, row) {
        return (Math.abs(session.selection.lead.row - row) || row + 1 + (row < 9 ? "·" : "")) + "";
      },
      getWidth: function(session, lastLineNumber, config3) {
        return Math.max(lastLineNumber.toString().length, (config3.lastRow + 1).toString().length, 2) * config3.characterWidth;
      },
      update: function(e2, editor2) {
        editor2.renderer.$loop.schedule(editor2.renderer.CHANGE_GUTTER);
      },
      attach: function(editor2) {
        editor2.renderer.$gutterLayer.$renderer = this;
        editor2.on("changeSelection", this.update);
        this.update(null, editor2);
      },
      detach: function(editor2) {
        if (editor2.renderer.$gutterLayer.$renderer == this)
          editor2.renderer.$gutterLayer.$renderer = null;
        editor2.off("changeSelection", this.update);
        this.update(null, editor2);
      }
    };
    exports3.Editor = Editor2;
  });
  ace.define("ace/layer/lines", ["require", "exports", "module", "ace/lib/dom"], function(require2, exports3, module3) {
    var dom = require2("../lib/dom");
    var Lines = (
      /** @class */
      function() {
        function Lines2(element2, canvasHeight) {
          this.element = element2;
          this.canvasHeight = canvasHeight || 5e5;
          this.element.style.height = this.canvasHeight * 2 + "px";
          this.cells = [];
          this.cellCache = [];
          this.$offsetCoefficient = 0;
        }
        Lines2.prototype.moveContainer = function(config2) {
          dom.translate(this.element, 0, -(config2.firstRowScreen * config2.lineHeight % this.canvasHeight) - config2.offset * this.$offsetCoefficient);
        };
        Lines2.prototype.pageChanged = function(oldConfig, newConfig) {
          return Math.floor(oldConfig.firstRowScreen * oldConfig.lineHeight / this.canvasHeight) !== Math.floor(newConfig.firstRowScreen * newConfig.lineHeight / this.canvasHeight);
        };
        Lines2.prototype.computeLineTop = function(row, config2, session) {
          var screenTop = config2.firstRowScreen * config2.lineHeight;
          var screenPage = Math.floor(screenTop / this.canvasHeight);
          var lineTop = session.documentToScreenRow(row, 0) * config2.lineHeight;
          return lineTop - screenPage * this.canvasHeight;
        };
        Lines2.prototype.computeLineHeight = function(row, config2, session) {
          return config2.lineHeight * session.getRowLineCount(row);
        };
        Lines2.prototype.getLength = function() {
          return this.cells.length;
        };
        Lines2.prototype.get = function(index2) {
          return this.cells[index2];
        };
        Lines2.prototype.shift = function() {
          this.$cacheCell(this.cells.shift());
        };
        Lines2.prototype.pop = function() {
          this.$cacheCell(this.cells.pop());
        };
        Lines2.prototype.push = function(cell) {
          if (Array.isArray(cell)) {
            this.cells.push.apply(this.cells, cell);
            var fragment = dom.createFragment(this.element);
            for (var i2 = 0; i2 < cell.length; i2++) {
              fragment.appendChild(cell[i2].element);
            }
            this.element.appendChild(fragment);
          } else {
            this.cells.push(cell);
            this.element.appendChild(cell.element);
          }
        };
        Lines2.prototype.unshift = function(cell) {
          if (Array.isArray(cell)) {
            this.cells.unshift.apply(this.cells, cell);
            var fragment = dom.createFragment(this.element);
            for (var i2 = 0; i2 < cell.length; i2++) {
              fragment.appendChild(cell[i2].element);
            }
            if (this.element.firstChild)
              this.element.insertBefore(fragment, this.element.firstChild);
            else
              this.element.appendChild(fragment);
          } else {
            this.cells.unshift(cell);
            this.element.insertAdjacentElement("afterbegin", cell.element);
          }
        };
        Lines2.prototype.last = function() {
          if (this.cells.length)
            return this.cells[this.cells.length - 1];
          else
            return null;
        };
        Lines2.prototype.$cacheCell = function(cell) {
          if (!cell)
            return;
          cell.element.remove();
          this.cellCache.push(cell);
        };
        Lines2.prototype.createCell = function(row, config2, session, initElement) {
          var cell = this.cellCache.pop();
          if (!cell) {
            var element2 = dom.createElement("div");
            if (initElement)
              initElement(element2);
            this.element.appendChild(element2);
            cell = {
              element: element2,
              text: "",
              row
            };
          }
          cell.row = row;
          return cell;
        };
        return Lines2;
      }()
    );
    exports3.Lines = Lines;
  });
  ace.define("ace/layer/gutter", ["require", "exports", "module", "ace/lib/dom", "ace/lib/oop", "ace/lib/lang", "ace/lib/event_emitter", "ace/layer/lines", "ace/config"], function(require2, exports3, module3) {
    var dom = require2("../lib/dom");
    var oop = require2("../lib/oop");
    var lang2 = require2("../lib/lang");
    var EventEmitter2 = require2("../lib/event_emitter").EventEmitter;
    var Lines = require2("./lines").Lines;
    var nls = require2("../config").nls;
    var Gutter = (
      /** @class */
      function() {
        function Gutter2(parentEl) {
          this.element = dom.createElement("div");
          this.element.className = "ace_layer ace_gutter-layer";
          parentEl.appendChild(this.element);
          this.setShowFoldWidgets(this.$showFoldWidgets);
          this.gutterWidth = 0;
          this.$annotations = [];
          this.$updateAnnotations = this.$updateAnnotations.bind(this);
          this.$lines = new Lines(this.element);
          this.$lines.$offsetCoefficient = 1;
        }
        Gutter2.prototype.setSession = function(session) {
          if (this.session)
            this.session.off("change", this.$updateAnnotations);
          this.session = session;
          if (session)
            session.on("change", this.$updateAnnotations);
        };
        Gutter2.prototype.addGutterDecoration = function(row, className) {
          if (window.console)
            console.warn && console.warn("deprecated use session.addGutterDecoration");
          this.session.addGutterDecoration(row, className);
        };
        Gutter2.prototype.removeGutterDecoration = function(row, className) {
          if (window.console)
            console.warn && console.warn("deprecated use session.removeGutterDecoration");
          this.session.removeGutterDecoration(row, className);
        };
        Gutter2.prototype.setAnnotations = function(annotations) {
          this.$annotations = [];
          for (var i2 = 0; i2 < annotations.length; i2++) {
            var annotation = annotations[i2];
            var row = annotation.row;
            var rowInfo = this.$annotations[row];
            if (!rowInfo)
              rowInfo = this.$annotations[row] = { text: [], type: [], displayText: [] };
            var annoText = annotation.text;
            var displayAnnoText = annotation.text;
            var annoType = annotation.type;
            annoText = annoText ? lang2.escapeHTML(annoText) : annotation.html || "";
            displayAnnoText = displayAnnoText ? displayAnnoText : annotation.html || "";
            if (rowInfo.text.indexOf(annoText) === -1) {
              rowInfo.text.push(annoText);
              rowInfo.type.push(annoType);
              rowInfo.displayText.push(displayAnnoText);
            }
            var className = annotation.className;
            if (className) {
              rowInfo.className = className;
            } else if (annoType === "error") {
              rowInfo.className = " ace_error";
            } else if (annoType === "security" && !/\bace_error\b/.test(rowInfo.className)) {
              rowInfo.className = " ace_security";
            } else if (annoType === "warning" && !/\bace_(error|security)\b/.test(rowInfo.className)) {
              rowInfo.className = " ace_warning";
            } else if (annoType === "info" && !rowInfo.className) {
              rowInfo.className = " ace_info";
            } else if (annoType === "hint" && !rowInfo.className) {
              rowInfo.className = " ace_hint";
            }
          }
        };
        Gutter2.prototype.$updateAnnotations = function(delta) {
          if (!this.$annotations.length)
            return;
          var firstRow = delta.start.row;
          var len = delta.end.row - firstRow;
          if (len === 0)
            ;
          else if (delta.action == "remove") {
            this.$annotations.splice(firstRow, len + 1, null);
          } else {
            var args = new Array(len + 1);
            args.unshift(firstRow, 1);
            this.$annotations.splice.apply(this.$annotations, args);
          }
        };
        Gutter2.prototype.update = function(config2) {
          this.config = config2;
          var session = this.session;
          var firstRow = config2.firstRow;
          var lastRow = Math.min(
            config2.lastRow + config2.gutterOffset,
            // needed to compensate for hor scollbar
            session.getLength() - 1
          );
          this.oldLastRow = lastRow;
          this.config = config2;
          this.$lines.moveContainer(config2);
          this.$updateCursorRow();
          var fold = session.getNextFoldLine(firstRow);
          var foldStart = fold ? fold.start.row : Infinity;
          var cell = null;
          var index2 = -1;
          var row = firstRow;
          while (true) {
            if (row > foldStart) {
              row = fold.end.row + 1;
              fold = session.getNextFoldLine(row, fold);
              foldStart = fold ? fold.start.row : Infinity;
            }
            if (row > lastRow) {
              while (this.$lines.getLength() > index2 + 1)
                this.$lines.pop();
              break;
            }
            cell = this.$lines.get(++index2);
            if (cell) {
              cell.row = row;
            } else {
              cell = this.$lines.createCell(row, config2, this.session, onCreateCell);
              this.$lines.push(cell);
            }
            this.$renderCell(cell, config2, fold, row);
            row++;
          }
          this._signal("afterRender");
          this.$updateGutterWidth(config2);
        };
        Gutter2.prototype.$updateGutterWidth = function(config2) {
          var session = this.session;
          var gutterRenderer = session.gutterRenderer || this.$renderer;
          var firstLineNumber = session.$firstLineNumber;
          var lastLineText = this.$lines.last() ? this.$lines.last().text : "";
          if (this.$fixedWidth || session.$useWrapMode)
            lastLineText = session.getLength() + firstLineNumber - 1;
          var gutterWidth = gutterRenderer ? gutterRenderer.getWidth(session, lastLineText, config2) : lastLineText.toString().length * config2.characterWidth;
          var padding = this.$padding || this.$computePadding();
          gutterWidth += padding.left + padding.right;
          if (gutterWidth !== this.gutterWidth && !isNaN(gutterWidth)) {
            this.gutterWidth = gutterWidth;
            this.element.parentNode.style.width = this.element.style.width = Math.ceil(this.gutterWidth) + "px";
            this._signal("changeGutterWidth", gutterWidth);
          }
        };
        Gutter2.prototype.$updateCursorRow = function() {
          if (!this.$highlightGutterLine)
            return;
          var position2 = this.session.selection.getCursor();
          if (this.$cursorRow === position2.row)
            return;
          this.$cursorRow = position2.row;
        };
        Gutter2.prototype.updateLineHighlight = function() {
          if (!this.$highlightGutterLine)
            return;
          var row = this.session.selection.cursor.row;
          this.$cursorRow = row;
          if (this.$cursorCell && this.$cursorCell.row == row)
            return;
          if (this.$cursorCell)
            this.$cursorCell.element.className = this.$cursorCell.element.className.replace("ace_gutter-active-line ", "");
          var cells = this.$lines.cells;
          this.$cursorCell = null;
          for (var i2 = 0; i2 < cells.length; i2++) {
            var cell = cells[i2];
            if (cell.row >= this.$cursorRow) {
              if (cell.row > this.$cursorRow) {
                var fold = this.session.getFoldLine(this.$cursorRow);
                if (i2 > 0 && fold && fold.start.row == cells[i2 - 1].row)
                  cell = cells[i2 - 1];
                else
                  break;
              }
              cell.element.className = "ace_gutter-active-line " + cell.element.className;
              this.$cursorCell = cell;
              break;
            }
          }
        };
        Gutter2.prototype.scrollLines = function(config2) {
          var oldConfig = this.config;
          this.config = config2;
          this.$updateCursorRow();
          if (this.$lines.pageChanged(oldConfig, config2))
            return this.update(config2);
          this.$lines.moveContainer(config2);
          var lastRow = Math.min(
            config2.lastRow + config2.gutterOffset,
            // needed to compensate for hor scollbar
            this.session.getLength() - 1
          );
          var oldLastRow = this.oldLastRow;
          this.oldLastRow = lastRow;
          if (!oldConfig || oldLastRow < config2.firstRow)
            return this.update(config2);
          if (lastRow < oldConfig.firstRow)
            return this.update(config2);
          if (oldConfig.firstRow < config2.firstRow)
            for (var row = this.session.getFoldedRowCount(oldConfig.firstRow, config2.firstRow - 1); row > 0; row--)
              this.$lines.shift();
          if (oldLastRow > lastRow)
            for (var row = this.session.getFoldedRowCount(lastRow + 1, oldLastRow); row > 0; row--)
              this.$lines.pop();
          if (config2.firstRow < oldConfig.firstRow) {
            this.$lines.unshift(this.$renderLines(config2, config2.firstRow, oldConfig.firstRow - 1));
          }
          if (lastRow > oldLastRow) {
            this.$lines.push(this.$renderLines(config2, oldLastRow + 1, lastRow));
          }
          this.updateLineHighlight();
          this._signal("afterRender");
          this.$updateGutterWidth(config2);
        };
        Gutter2.prototype.$renderLines = function(config2, firstRow, lastRow) {
          var fragment = [];
          var row = firstRow;
          var foldLine = this.session.getNextFoldLine(row);
          var foldStart = foldLine ? foldLine.start.row : Infinity;
          while (true) {
            if (row > foldStart) {
              row = foldLine.end.row + 1;
              foldLine = this.session.getNextFoldLine(row, foldLine);
              foldStart = foldLine ? foldLine.start.row : Infinity;
            }
            if (row > lastRow)
              break;
            var cell = this.$lines.createCell(row, config2, this.session, onCreateCell);
            this.$renderCell(cell, config2, foldLine, row);
            fragment.push(cell);
            row++;
          }
          return fragment;
        };
        Gutter2.prototype.$renderCell = function(cell, config2, fold, row) {
          var element2 = cell.element;
          var session = this.session;
          var textNode = element2.childNodes[0];
          var foldWidget = element2.childNodes[1];
          var annotationNode = element2.childNodes[2];
          var customWidget = element2.childNodes[3];
          var annotationIconNode = annotationNode.firstChild;
          var firstLineNumber = session.$firstLineNumber;
          var breakpoints = session.$breakpoints;
          var decorations = session.$decorations;
          var gutterRenderer = session.gutterRenderer || this.$renderer;
          var foldWidgets = this.$showFoldWidgets && session.foldWidgets;
          var foldStart = fold ? fold.start.row : Number.MAX_VALUE;
          var lineHeight2 = config2.lineHeight + "px";
          var className = this.$useSvgGutterIcons ? "ace_gutter-cell_svg-icons " : "ace_gutter-cell ";
          var iconClassName = this.$useSvgGutterIcons ? "ace_icon_svg" : "ace_icon";
          var rowText = (gutterRenderer ? gutterRenderer.getText(session, row) : row + firstLineNumber).toString();
          if (this.$highlightGutterLine) {
            if (row == this.$cursorRow || fold && row < this.$cursorRow && row >= foldStart && this.$cursorRow <= fold.end.row) {
              className += "ace_gutter-active-line ";
              if (this.$cursorCell != cell) {
                if (this.$cursorCell)
                  this.$cursorCell.element.className = this.$cursorCell.element.className.replace("ace_gutter-active-line ", "");
                this.$cursorCell = cell;
              }
            }
          }
          if (breakpoints[row])
            className += breakpoints[row];
          if (decorations[row])
            className += decorations[row];
          if (this.$annotations[row] && row !== foldStart)
            className += this.$annotations[row].className;
          if (foldWidgets) {
            var c2 = foldWidgets[row];
            if (c2 == null)
              c2 = foldWidgets[row] = session.getFoldWidget(row);
          }
          if (c2) {
            var foldClass = "ace_fold-widget ace_" + c2;
            var isClosedFold = c2 == "start" && row == foldStart && row < fold.end.row;
            if (isClosedFold) {
              foldClass += " ace_closed";
              var foldAnnotationClass = "";
              var annotationInFold = false;
              for (var i2 = row + 1; i2 <= fold.end.row; i2++) {
                if (!this.$annotations[i2])
                  continue;
                if (this.$annotations[i2].className === " ace_error") {
                  annotationInFold = true;
                  foldAnnotationClass = " ace_error_fold";
                  break;
                }
                if (this.$annotations[i2].className === " ace_security") {
                  annotationInFold = true;
                  foldAnnotationClass = " ace_security_fold";
                } else if (this.$annotations[i2].className === " ace_warning" && foldAnnotationClass !== " ace_security_fold") {
                  annotationInFold = true;
                  foldAnnotationClass = " ace_warning_fold";
                }
              }
              className += foldAnnotationClass;
            } else
              foldClass += " ace_open";
            if (foldWidget.className != foldClass)
              foldWidget.className = foldClass;
            dom.setStyle(foldWidget.style, "height", lineHeight2);
            dom.setStyle(foldWidget.style, "display", "inline-block");
            foldWidget.setAttribute("role", "button");
            foldWidget.setAttribute("tabindex", "-1");
            var foldRange = session.getFoldWidgetRange(row);
            if (foldRange)
              foldWidget.setAttribute("aria-label", nls("gutter.code-folding.range.aria-label", "Toggle code folding, rows $0 through $1", [
                foldRange.start.row + 1,
                foldRange.end.row + 1
              ]));
            else {
              if (fold)
                foldWidget.setAttribute("aria-label", nls("gutter.code-folding.closed.aria-label", "Toggle code folding, rows $0 through $1", [
                  fold.start.row + 1,
                  fold.end.row + 1
                ]));
              else
                foldWidget.setAttribute("aria-label", nls("gutter.code-folding.open.aria-label", "Toggle code folding, row $0", [row + 1]));
            }
            if (isClosedFold) {
              foldWidget.setAttribute("aria-expanded", "false");
              foldWidget.setAttribute("title", nls("gutter.code-folding.closed.title", "Unfold code"));
            } else {
              foldWidget.setAttribute("aria-expanded", "true");
              foldWidget.setAttribute("title", nls("gutter.code-folding.open.title", "Fold code"));
            }
          } else {
            if (foldWidget) {
              dom.setStyle(foldWidget.style, "display", "none");
              foldWidget.setAttribute("tabindex", "0");
              foldWidget.removeAttribute("role");
              foldWidget.removeAttribute("aria-label");
            }
          }
          var customWidgetAttributes = this.session.$gutterCustomWidgets[row];
          if (customWidgetAttributes) {
            this.$addCustomWidget(row, customWidgetAttributes, cell);
          } else if (customWidget) {
            this.$removeCustomWidget(row, cell);
          }
          if (annotationInFold && this.$showFoldedAnnotations) {
            annotationNode.className = "ace_gutter_annotation";
            annotationIconNode.className = iconClassName;
            annotationIconNode.className += foldAnnotationClass;
            dom.setStyle(annotationIconNode.style, "height", lineHeight2);
            dom.setStyle(annotationNode.style, "display", "block");
            dom.setStyle(annotationNode.style, "height", lineHeight2);
            var ariaLabel;
            switch (foldAnnotationClass) {
              case " ace_error_fold":
                ariaLabel = nls("gutter.annotation.aria-label.error", "Error, read annotations row $0", [rowText]);
                break;
              case " ace_security_fold":
                ariaLabel = nls("gutter.annotation.aria-label.security", "Security finding, read annotations row $0", [rowText]);
                break;
              case " ace_warning_fold":
                ariaLabel = nls("gutter.annotation.aria-label.warning", "Warning, read annotations row $0", [rowText]);
                break;
            }
            annotationNode.setAttribute("aria-label", ariaLabel);
            annotationNode.setAttribute("tabindex", "-1");
            annotationNode.setAttribute("role", "button");
          } else if (this.$annotations[row]) {
            annotationNode.className = "ace_gutter_annotation";
            annotationIconNode.className = iconClassName;
            if (this.$useSvgGutterIcons)
              annotationIconNode.className += this.$annotations[row].className;
            else
              element2.classList.add(this.$annotations[row].className.replace(" ", ""));
            dom.setStyle(annotationIconNode.style, "height", lineHeight2);
            dom.setStyle(annotationNode.style, "display", "block");
            dom.setStyle(annotationNode.style, "height", lineHeight2);
            var ariaLabel;
            switch (this.$annotations[row].className) {
              case " ace_error":
                ariaLabel = nls("gutter.annotation.aria-label.error", "Error, read annotations row $0", [rowText]);
                break;
              case " ace_security":
                ariaLabel = nls("gutter.annotation.aria-label.security", "Security finding, read annotations row $0", [rowText]);
                break;
              case " ace_warning":
                ariaLabel = nls("gutter.annotation.aria-label.warning", "Warning, read annotations row $0", [rowText]);
                break;
              case " ace_info":
                ariaLabel = nls("gutter.annotation.aria-label.info", "Info, read annotations row $0", [rowText]);
                break;
              case " ace_hint":
                ariaLabel = nls("gutter.annotation.aria-label.hint", "Suggestion, read annotations row $0", [rowText]);
                break;
            }
            annotationNode.setAttribute("aria-label", ariaLabel);
            annotationNode.setAttribute("tabindex", "-1");
            annotationNode.setAttribute("role", "button");
          } else {
            dom.setStyle(annotationNode.style, "display", "none");
            annotationNode.removeAttribute("aria-label");
            annotationNode.removeAttribute("role");
            annotationNode.setAttribute("tabindex", "0");
          }
          if (rowText !== textNode.data) {
            textNode.data = rowText;
          }
          if (element2.className != className)
            element2.className = className;
          dom.setStyle(cell.element.style, "height", this.$lines.computeLineHeight(row, config2, session) + "px");
          dom.setStyle(cell.element.style, "top", this.$lines.computeLineTop(row, config2, session) + "px");
          cell.text = rowText;
          if (annotationNode.style.display === "none" && foldWidget.style.display === "none" && !customWidgetAttributes)
            cell.element.setAttribute("aria-hidden", true);
          else
            cell.element.setAttribute("aria-hidden", false);
          return cell;
        };
        Gutter2.prototype.setHighlightGutterLine = function(highlightGutterLine) {
          this.$highlightGutterLine = highlightGutterLine;
        };
        Gutter2.prototype.setShowLineNumbers = function(show) {
          this.$renderer = !show && {
            getWidth: function() {
              return 0;
            },
            getText: function() {
              return "";
            }
          };
        };
        Gutter2.prototype.getShowLineNumbers = function() {
          return this.$showLineNumbers;
        };
        Gutter2.prototype.setShowFoldWidgets = function(show) {
          if (show)
            dom.addCssClass(this.element, "ace_folding-enabled");
          else
            dom.removeCssClass(this.element, "ace_folding-enabled");
          this.$showFoldWidgets = show;
          this.$padding = null;
        };
        Gutter2.prototype.getShowFoldWidgets = function() {
          return this.$showFoldWidgets;
        };
        Gutter2.prototype.$hideFoldWidget = function(row, cell) {
          var rowCell = cell || this.$getGutterCell(row);
          if (rowCell && rowCell.element) {
            var foldWidget = rowCell.element.childNodes[1];
            if (foldWidget) {
              dom.setStyle(foldWidget.style, "display", "none");
            }
          }
        };
        Gutter2.prototype.$showFoldWidget = function(row, cell) {
          var rowCell = cell || this.$getGutterCell(row);
          if (rowCell && rowCell.element) {
            var foldWidget = rowCell.element.childNodes[1];
            if (foldWidget && this.session.foldWidgets && this.session.foldWidgets[rowCell.row]) {
              dom.setStyle(foldWidget.style, "display", "inline-block");
            }
          }
        };
        Gutter2.prototype.$getGutterCell = function(row) {
          var cells = this.$lines.cells;
          var visibileRow = this.session.documentToScreenRow(row, 0);
          return cells[row - this.config.firstRowScreen - (row - visibileRow)];
        };
        Gutter2.prototype.$addCustomWidget = function(row, _a2, cell) {
          var className = _a2.className, label = _a2.label, title = _a2.title, callbacks = _a2.callbacks;
          this.session.$gutterCustomWidgets[row] = { className, label, title, callbacks };
          this.$hideFoldWidget(row, cell);
          var rowCell = cell || this.$getGutterCell(row);
          if (rowCell && rowCell.element) {
            var customWidget = rowCell.element.querySelector(".ace_custom-widget");
            if (customWidget) {
              customWidget.remove();
            }
            customWidget = dom.createElement("span");
            customWidget.className = "ace_custom-widget ".concat(className);
            customWidget.setAttribute("tabindex", "-1");
            customWidget.setAttribute("role", "button");
            customWidget.setAttribute("aria-label", label);
            customWidget.setAttribute("title", title);
            dom.setStyle(customWidget.style, "display", "inline-block");
            dom.setStyle(customWidget.style, "height", "inherit");
            if (callbacks && callbacks.onClick) {
              customWidget.addEventListener("click", function(e2) {
                callbacks.onClick(e2, row);
                e2.stopPropagation();
              });
            }
            rowCell.element.appendChild(customWidget);
          }
        };
        Gutter2.prototype.$removeCustomWidget = function(row, cell) {
          delete this.session.$gutterCustomWidgets[row];
          this.$showFoldWidget(row, cell);
          var rowCell = cell || this.$getGutterCell(row);
          if (rowCell && rowCell.element) {
            var customWidget = rowCell.element.querySelector(".ace_custom-widget");
            if (customWidget) {
              rowCell.element.removeChild(customWidget);
            }
          }
        };
        Gutter2.prototype.$computePadding = function() {
          if (!this.element.firstChild)
            return { left: 0, right: 0 };
          var style2 = dom.computedStyle(
            /**@type{Element}*/
            this.element.firstChild
          );
          this.$padding = {};
          this.$padding.left = (parseInt(style2.borderLeftWidth) || 0) + (parseInt(style2.paddingLeft) || 0) + 1;
          this.$padding.right = (parseInt(style2.borderRightWidth) || 0) + (parseInt(style2.paddingRight) || 0);
          return this.$padding;
        };
        Gutter2.prototype.getRegion = function(point2) {
          var padding = this.$padding || this.$computePadding();
          var rect = this.element.getBoundingClientRect();
          if (point2.x < padding.left + rect.left)
            return "markers";
          if (this.$showFoldWidgets && point2.x > rect.right - padding.right)
            return "foldWidgets";
        };
        return Gutter2;
      }()
    );
    Gutter.prototype.$fixedWidth = false;
    Gutter.prototype.$highlightGutterLine = true;
    Gutter.prototype.$renderer = "";
    Gutter.prototype.$showLineNumbers = true;
    Gutter.prototype.$showFoldWidgets = true;
    oop.implement(Gutter.prototype, EventEmitter2);
    function onCreateCell(element2) {
      var textNode = document.createTextNode("");
      element2.appendChild(textNode);
      var foldWidget = dom.createElement("span");
      element2.appendChild(foldWidget);
      var annotationNode = dom.createElement("span");
      element2.appendChild(annotationNode);
      var annotationIconNode = dom.createElement("span");
      annotationNode.appendChild(annotationIconNode);
      return element2;
    }
    exports3.Gutter = Gutter;
  });
  ace.define("ace/layer/marker", ["require", "exports", "module", "ace/range", "ace/lib/dom"], function(require2, exports3, module3) {
    var Range2 = require2("../range").Range;
    var dom = require2("../lib/dom");
    var Marker = (
      /** @class */
      function() {
        function Marker2(parentEl) {
          this.element = dom.createElement("div");
          this.element.className = "ace_layer ace_marker-layer";
          parentEl.appendChild(this.element);
        }
        Marker2.prototype.setPadding = function(padding) {
          this.$padding = padding;
        };
        Marker2.prototype.setSession = function(session) {
          this.session = session;
        };
        Marker2.prototype.setMarkers = function(markers) {
          this.markers = markers;
        };
        Marker2.prototype.elt = function(className, css) {
          var x2 = this.i != -1 && this.element.childNodes[this.i];
          if (!x2) {
            x2 = document.createElement("div");
            this.element.appendChild(x2);
            this.i = -1;
          } else {
            this.i++;
          }
          x2.style.cssText = css;
          x2.className = className;
        };
        Marker2.prototype.update = function(config2) {
          if (!config2)
            return;
          this.config = config2;
          this.i = 0;
          var html2;
          for (var key in this.markers) {
            var marker = this.markers[key];
            if (!marker.range) {
              marker.update(html2, this, this.session, config2);
              continue;
            }
            var range3 = marker.range.clipRows(config2.firstRow, config2.lastRow);
            if (range3.isEmpty())
              continue;
            range3 = range3.toScreenRange(this.session);
            if (marker.renderer) {
              var top2 = this.$getTop(range3.start.row, config2);
              var left2 = this.$padding + range3.start.column * config2.characterWidth;
              marker.renderer(html2, range3, left2, top2, config2);
            } else if (marker.type == "fullLine") {
              this.drawFullLineMarker(html2, range3, marker.clazz, config2);
            } else if (marker.type == "screenLine") {
              this.drawScreenLineMarker(html2, range3, marker.clazz, config2);
            } else if (range3.isMultiLine()) {
              if (marker.type == "text")
                this.drawTextMarker(html2, range3, marker.clazz, config2);
              else
                this.drawMultiLineMarker(html2, range3, marker.clazz, config2);
            } else {
              this.drawSingleLineMarker(html2, range3, marker.clazz + " ace_start ace_br15", config2);
            }
          }
          if (this.i != -1) {
            while (this.i < this.element.childElementCount)
              this.element.removeChild(this.element.lastChild);
          }
        };
        Marker2.prototype.$getTop = function(row, layerConfig) {
          return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;
        };
        Marker2.prototype.drawTextMarker = function(stringBuilder, range3, clazz, layerConfig, extraStyle) {
          var session = this.session;
          var start2 = range3.start.row;
          var end2 = range3.end.row;
          var row = start2;
          var prev2 = 0;
          var curr = 0;
          var next2 = session.getScreenLastRowColumn(row);
          var lineRange = new Range2(row, range3.start.column, row, curr);
          for (; row <= end2; row++) {
            lineRange.start.row = lineRange.end.row = row;
            lineRange.start.column = row == start2 ? range3.start.column : session.getRowWrapIndent(row);
            lineRange.end.column = next2;
            prev2 = curr;
            curr = next2;
            next2 = row + 1 < end2 ? session.getScreenLastRowColumn(row + 1) : row == end2 ? 0 : range3.end.column;
            this.drawSingleLineMarker(stringBuilder, lineRange, clazz + (row == start2 ? " ace_start" : "") + " ace_br" + getBorderClass(row == start2 || row == start2 + 1 && range3.start.column, prev2 < curr, curr > next2, row == end2), layerConfig, row == end2 ? 0 : 1, extraStyle);
          }
        };
        Marker2.prototype.drawMultiLineMarker = function(stringBuilder, range3, clazz, config2, extraStyle) {
          var padding = this.$padding;
          var height = config2.lineHeight;
          var top2 = this.$getTop(range3.start.row, config2);
          var left2 = padding + range3.start.column * config2.characterWidth;
          extraStyle = extraStyle || "";
          if (this.session.$bidiHandler.isBidiRow(range3.start.row)) {
            var range1 = range3.clone();
            range1.end.row = range1.start.row;
            range1.end.column = this.session.getLine(range1.start.row).length;
            this.drawBidiSingleLineMarker(stringBuilder, range1, clazz + " ace_br1 ace_start", config2, null, extraStyle);
          } else {
            this.elt(clazz + " ace_br1 ace_start", "height:" + height + "px;right:" + padding + "px;top:" + top2 + "px;left:" + left2 + "px;" + (extraStyle || ""));
          }
          if (this.session.$bidiHandler.isBidiRow(range3.end.row)) {
            var range1 = range3.clone();
            range1.start.row = range1.end.row;
            range1.start.column = 0;
            this.drawBidiSingleLineMarker(stringBuilder, range1, clazz + " ace_br12", config2, null, extraStyle);
          } else {
            top2 = this.$getTop(range3.end.row, config2);
            var width = range3.end.column * config2.characterWidth;
            this.elt(clazz + " ace_br12", "height:" + height + "px;width:" + width + "px;top:" + top2 + "px;left:" + padding + "px;" + (extraStyle || ""));
          }
          height = (range3.end.row - range3.start.row - 1) * config2.lineHeight;
          if (height <= 0)
            return;
          top2 = this.$getTop(range3.start.row + 1, config2);
          var radiusClass = (range3.start.column ? 1 : 0) | (range3.end.column ? 0 : 8);
          this.elt(clazz + (radiusClass ? " ace_br" + radiusClass : ""), "height:" + height + "px;right:" + padding + "px;top:" + top2 + "px;left:" + padding + "px;" + (extraStyle || ""));
        };
        Marker2.prototype.drawSingleLineMarker = function(stringBuilder, range3, clazz, config2, extraLength, extraStyle) {
          if (this.session.$bidiHandler.isBidiRow(range3.start.row))
            return this.drawBidiSingleLineMarker(stringBuilder, range3, clazz, config2, extraLength, extraStyle);
          var height = config2.lineHeight;
          var width = (range3.end.column + (extraLength || 0) - range3.start.column) * config2.characterWidth;
          var top2 = this.$getTop(range3.start.row, config2);
          var left2 = this.$padding + range3.start.column * config2.characterWidth;
          this.elt(clazz, "height:" + height + "px;width:" + width + "px;top:" + top2 + "px;left:" + left2 + "px;" + (extraStyle || ""));
        };
        Marker2.prototype.drawBidiSingleLineMarker = function(stringBuilder, range3, clazz, config2, extraLength, extraStyle) {
          var height = config2.lineHeight, top2 = this.$getTop(range3.start.row, config2), padding = this.$padding;
          var selections = this.session.$bidiHandler.getSelections(range3.start.column, range3.end.column);
          selections.forEach(function(selection) {
            this.elt(clazz, "height:" + height + "px;width:" + (selection.width + (extraLength || 0)) + "px;top:" + top2 + "px;left:" + (padding + selection.left) + "px;" + (extraStyle || ""));
          }, this);
        };
        Marker2.prototype.drawFullLineMarker = function(stringBuilder, range3, clazz, config2, extraStyle) {
          var top2 = this.$getTop(range3.start.row, config2);
          var height = config2.lineHeight;
          if (range3.start.row != range3.end.row)
            height += this.$getTop(range3.end.row, config2) - top2;
          this.elt(clazz, "height:" + height + "px;top:" + top2 + "px;left:0;right:0;" + (extraStyle || ""));
        };
        Marker2.prototype.drawScreenLineMarker = function(stringBuilder, range3, clazz, config2, extraStyle) {
          var top2 = this.$getTop(range3.start.row, config2);
          var height = config2.lineHeight;
          this.elt(clazz, "height:" + height + "px;top:" + top2 + "px;left:0;right:0;" + (extraStyle || ""));
        };
        return Marker2;
      }()
    );
    Marker.prototype.$padding = 0;
    function getBorderClass(tl2, tr, br, bl2) {
      return (tl2 ? 1 : 0) | (tr ? 2 : 0) | (br ? 4 : 0) | (bl2 ? 8 : 0);
    }
    exports3.Marker = Marker;
  });
  ace.define("ace/layer/text_util", ["require", "exports", "module"], function(require2, exports3, module3) {
    var textTokens = /* @__PURE__ */ new Set(["text", "rparen", "lparen"]);
    exports3.isTextToken = function(tokenType) {
      return textTokens.has(tokenType);
    };
  });
  ace.define("ace/layer/text", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/lib/lang", "ace/layer/lines", "ace/lib/event_emitter", "ace/config", "ace/layer/text_util"], function(require2, exports3, module3) {
    var oop = require2("../lib/oop");
    var dom = require2("../lib/dom");
    var lang2 = require2("../lib/lang");
    var Lines = require2("./lines").Lines;
    var EventEmitter2 = require2("../lib/event_emitter").EventEmitter;
    var nls = require2("../config").nls;
    var isTextToken = require2("./text_util").isTextToken;
    var Text2 = (
      /** @class */
      function() {
        function Text3(parentEl) {
          this.dom = dom;
          this.element = this.dom.createElement("div");
          this.element.className = "ace_layer ace_text-layer";
          parentEl.appendChild(this.element);
          this.$updateEolChar = this.$updateEolChar.bind(this);
          this.$lines = new Lines(this.element);
        }
        Text3.prototype.$updateEolChar = function() {
          var doc = this.session.doc;
          var unixMode = doc.getNewLineCharacter() == "\n" && doc.getNewLineMode() != "windows";
          var EOL_CHAR = unixMode ? this.EOL_CHAR_LF : this.EOL_CHAR_CRLF;
          if (this.EOL_CHAR != EOL_CHAR) {
            this.EOL_CHAR = EOL_CHAR;
            return true;
          }
        };
        Text3.prototype.setPadding = function(padding) {
          this.$padding = padding;
          this.element.style.margin = "0 " + padding + "px";
        };
        Text3.prototype.getLineHeight = function() {
          return this.$fontMetrics.$characterSize.height || 0;
        };
        Text3.prototype.getCharacterWidth = function() {
          return this.$fontMetrics.$characterSize.width || 0;
        };
        Text3.prototype.$setFontMetrics = function(measure) {
          this.$fontMetrics = measure;
          this.$fontMetrics.on(
            "changeCharacterSize",
            (function(e2) {
              this._signal("changeCharacterSize", e2);
            }).bind(this)
          );
          this.$pollSizeChanges();
        };
        Text3.prototype.checkForSizeChanges = function() {
          this.$fontMetrics.checkForSizeChanges();
        };
        Text3.prototype.$pollSizeChanges = function() {
          return this.$pollSizeChangesTimer = this.$fontMetrics.$pollSizeChanges();
        };
        Text3.prototype.setSession = function(session) {
          this.session = session;
          if (session)
            this.$computeTabString();
        };
        Text3.prototype.setShowInvisibles = function(showInvisibles) {
          if (this.showInvisibles == showInvisibles)
            return false;
          this.showInvisibles = showInvisibles;
          if (typeof showInvisibles == "string") {
            this.showSpaces = /tab/i.test(showInvisibles);
            this.showTabs = /space/i.test(showInvisibles);
            this.showEOL = /eol/i.test(showInvisibles);
          } else {
            this.showSpaces = this.showTabs = this.showEOL = showInvisibles;
          }
          this.$computeTabString();
          return true;
        };
        Text3.prototype.setDisplayIndentGuides = function(display) {
          if (this.displayIndentGuides == display)
            return false;
          this.displayIndentGuides = display;
          this.$computeTabString();
          return true;
        };
        Text3.prototype.setHighlightIndentGuides = function(highlight) {
          if (this.$highlightIndentGuides === highlight)
            return false;
          this.$highlightIndentGuides = highlight;
          return highlight;
        };
        Text3.prototype.$computeTabString = function() {
          var tabSize = this.session.getTabSize();
          this.tabSize = tabSize;
          var tabStr = this.$tabStrings = [0];
          for (var i2 = 1; i2 < tabSize + 1; i2++) {
            if (this.showTabs) {
              var span = this.dom.createElement("span");
              span.className = "ace_invisible ace_invisible_tab";
              span.textContent = lang2.stringRepeat(this.TAB_CHAR, i2);
              tabStr.push(span);
            } else {
              tabStr.push(this.dom.createTextNode(lang2.stringRepeat(" ", i2), this.element));
            }
          }
          if (this.displayIndentGuides) {
            this.$indentGuideRe = /\s\S| \t|\t |\s$/;
            var className = "ace_indent-guide";
            var spaceClass = this.showSpaces ? " ace_invisible ace_invisible_space" : "";
            var spaceContent = this.showSpaces ? lang2.stringRepeat(this.SPACE_CHAR, this.tabSize) : lang2.stringRepeat(" ", this.tabSize);
            var tabClass = this.showTabs ? " ace_invisible ace_invisible_tab" : "";
            var tabContent = this.showTabs ? lang2.stringRepeat(this.TAB_CHAR, this.tabSize) : spaceContent;
            var span = this.dom.createElement("span");
            span.className = className + spaceClass;
            span.textContent = spaceContent;
            this.$tabStrings[" "] = span;
            var span = this.dom.createElement("span");
            span.className = className + tabClass;
            span.textContent = tabContent;
            this.$tabStrings["	"] = span;
          }
        };
        Text3.prototype.updateLines = function(config2, firstRow, lastRow) {
          if (this.config.lastRow != config2.lastRow || this.config.firstRow != config2.firstRow) {
            return this.update(config2);
          }
          this.config = config2;
          var first = Math.max(firstRow, config2.firstRow);
          var last = Math.min(lastRow, config2.lastRow);
          var lineElements = this.element.childNodes;
          var lineElementsIdx = 0;
          for (var row = config2.firstRow; row < first; row++) {
            var foldLine = this.session.getFoldLine(row);
            if (foldLine) {
              if (foldLine.containsRow(first)) {
                first = foldLine.start.row;
                break;
              } else {
                row = foldLine.end.row;
              }
            }
            lineElementsIdx++;
          }
          var heightChanged = false;
          var row = first;
          var foldLine = this.session.getNextFoldLine(row);
          var foldStart = foldLine ? foldLine.start.row : Infinity;
          while (true) {
            if (row > foldStart) {
              row = foldLine.end.row + 1;
              foldLine = this.session.getNextFoldLine(row, foldLine);
              foldStart = foldLine ? foldLine.start.row : Infinity;
            }
            if (row > last)
              break;
            var lineElement = lineElements[lineElementsIdx++];
            if (lineElement) {
              this.dom.removeChildren(lineElement);
              this.$renderLine(lineElement, row, row == foldStart ? foldLine : false);
              if (heightChanged)
                lineElement.style.top = this.$lines.computeLineTop(row, config2, this.session) + "px";
              var height = config2.lineHeight * this.session.getRowLength(row) + "px";
              if (lineElement.style.height != height) {
                heightChanged = true;
                lineElement.style.height = height;
              }
            }
            row++;
          }
          if (heightChanged) {
            while (lineElementsIdx < this.$lines.cells.length) {
              var cell = this.$lines.cells[lineElementsIdx++];
              cell.element.style.top = this.$lines.computeLineTop(cell.row, config2, this.session) + "px";
            }
          }
        };
        Text3.prototype.scrollLines = function(config2) {
          var oldConfig = this.config;
          this.config = config2;
          if (this.$lines.pageChanged(oldConfig, config2))
            return this.update(config2);
          this.$lines.moveContainer(config2);
          var lastRow = config2.lastRow;
          var oldLastRow = oldConfig ? oldConfig.lastRow : -1;
          if (!oldConfig || oldLastRow < config2.firstRow)
            return this.update(config2);
          if (lastRow < oldConfig.firstRow)
            return this.update(config2);
          if (!oldConfig || oldConfig.lastRow < config2.firstRow)
            return this.update(config2);
          if (config2.lastRow < oldConfig.firstRow)
            return this.update(config2);
          if (oldConfig.firstRow < config2.firstRow)
            for (var row = this.session.getFoldedRowCount(oldConfig.firstRow, config2.firstRow - 1); row > 0; row--)
              this.$lines.shift();
          if (oldConfig.lastRow > config2.lastRow)
            for (var row = this.session.getFoldedRowCount(config2.lastRow + 1, oldConfig.lastRow); row > 0; row--)
              this.$lines.pop();
          if (config2.firstRow < oldConfig.firstRow) {
            this.$lines.unshift(this.$renderLinesFragment(config2, config2.firstRow, oldConfig.firstRow - 1));
          }
          if (config2.lastRow > oldConfig.lastRow) {
            this.$lines.push(this.$renderLinesFragment(config2, oldConfig.lastRow + 1, config2.lastRow));
          }
          this.$highlightIndentGuide();
        };
        Text3.prototype.$renderLinesFragment = function(config2, firstRow, lastRow) {
          var fragment = [];
          var row = firstRow;
          var foldLine = this.session.getNextFoldLine(row);
          var foldStart = foldLine ? foldLine.start.row : Infinity;
          while (true) {
            if (row > foldStart) {
              row = foldLine.end.row + 1;
              foldLine = this.session.getNextFoldLine(row, foldLine);
              foldStart = foldLine ? foldLine.start.row : Infinity;
            }
            if (row > lastRow)
              break;
            var line2 = this.$lines.createCell(row, config2, this.session);
            var lineEl = line2.element;
            this.dom.removeChildren(lineEl);
            dom.setStyle(lineEl.style, "height", this.$lines.computeLineHeight(row, config2, this.session) + "px");
            dom.setStyle(lineEl.style, "top", this.$lines.computeLineTop(row, config2, this.session) + "px");
            this.$renderLine(lineEl, row, row == foldStart ? foldLine : false);
            if (this.$useLineGroups()) {
              lineEl.className = "ace_line_group";
            } else {
              lineEl.className = "ace_line";
            }
            fragment.push(line2);
            row++;
          }
          return fragment;
        };
        Text3.prototype.update = function(config2) {
          this.$lines.moveContainer(config2);
          this.config = config2;
          var firstRow = config2.firstRow;
          var lastRow = config2.lastRow;
          var lines = this.$lines;
          while (lines.getLength())
            lines.pop();
          lines.push(this.$renderLinesFragment(config2, firstRow, lastRow));
        };
        Text3.prototype.$renderToken = function(parent, screenColumn, token2, value2) {
          var self2 = this;
          var re2 = /(\t)|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\uFEFF\uFFF9-\uFFFC\u2066\u2067\u2068\u202A\u202B\u202D\u202E\u202C\u2069\u2060\u2061\u2062\u2063\u2064\u206A\u206B\u206B\u206C\u206D\u206E\u206F]+)|(\u3000)|([\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g;
          var valueFragment = this.dom.createFragment(this.element);
          var m2;
          var i2 = 0;
          while (m2 = re2.exec(value2)) {
            var tab2 = m2[1];
            var simpleSpace = m2[2];
            var controlCharacter = m2[3];
            var cjkSpace = m2[4];
            var cjk = m2[5];
            if (!self2.showSpaces && simpleSpace)
              continue;
            var before = i2 != m2.index ? value2.slice(i2, m2.index) : "";
            i2 = m2.index + m2[0].length;
            if (before) {
              valueFragment.appendChild(this.dom.createTextNode(before, this.element));
            }
            if (tab2) {
              var tabSize = self2.session.getScreenTabSize(screenColumn + m2.index);
              var text2 = self2.$tabStrings[tabSize].cloneNode(true);
              text2["charCount"] = 1;
              valueFragment.appendChild(text2);
              screenColumn += tabSize - 1;
            } else if (simpleSpace) {
              if (self2.showSpaces) {
                var span = this.dom.createElement("span");
                span.className = "ace_invisible ace_invisible_space";
                span.textContent = lang2.stringRepeat(self2.SPACE_CHAR, simpleSpace.length);
                valueFragment.appendChild(span);
              } else {
                valueFragment.appendChild(this.dom.createTextNode(simpleSpace, this.element));
              }
            } else if (controlCharacter) {
              var span = this.dom.createElement("span");
              span.className = "ace_invisible ace_invisible_space ace_invalid";
              span.textContent = lang2.stringRepeat(self2.SPACE_CHAR, controlCharacter.length);
              valueFragment.appendChild(span);
            } else if (cjkSpace) {
              screenColumn += 1;
              var span = this.dom.createElement("span");
              span.style.width = self2.config.characterWidth * 2 + "px";
              span.className = self2.showSpaces ? "ace_cjk ace_invisible ace_invisible_space" : "ace_cjk";
              span.textContent = self2.showSpaces ? self2.SPACE_CHAR : cjkSpace;
              valueFragment.appendChild(span);
            } else if (cjk) {
              screenColumn += 1;
              var span = this.dom.createElement("span");
              span.style.width = self2.config.characterWidth * 2 + "px";
              span.className = "ace_cjk";
              span.textContent = cjk;
              valueFragment.appendChild(span);
            }
          }
          valueFragment.appendChild(this.dom.createTextNode(i2 ? value2.slice(i2) : value2, this.element));
          if (!isTextToken(token2.type)) {
            var classes = "ace_" + token2.type.replace(/\./g, " ace_");
            var span = this.dom.createElement("span");
            if (token2.type == "fold") {
              span.style.width = token2.value.length * this.config.characterWidth + "px";
              span.setAttribute("title", nls("inline-fold.closed.title", "Unfold code"));
            }
            span.className = classes;
            span.appendChild(valueFragment);
            parent.appendChild(span);
          } else {
            parent.appendChild(valueFragment);
          }
          return screenColumn + value2.length;
        };
        Text3.prototype.renderIndentGuide = function(parent, value2, max2) {
          var cols = value2.search(this.$indentGuideRe);
          if (cols <= 0 || cols >= max2)
            return value2;
          if (value2[0] == " ") {
            cols -= cols % this.tabSize;
            var count = cols / this.tabSize;
            for (var i2 = 0; i2 < count; i2++) {
              parent.appendChild(this.$tabStrings[" "].cloneNode(true));
            }
            this.$highlightIndentGuide();
            return value2.substr(cols);
          } else if (value2[0] == "	") {
            for (var i2 = 0; i2 < cols; i2++) {
              parent.appendChild(this.$tabStrings["	"].cloneNode(true));
            }
            this.$highlightIndentGuide();
            return value2.substr(cols);
          }
          this.$highlightIndentGuide();
          return value2;
        };
        Text3.prototype.$highlightIndentGuide = function() {
          if (!this.$highlightIndentGuides || !this.displayIndentGuides)
            return;
          this.$highlightIndentGuideMarker = {
            indentLevel: void 0,
            start: void 0,
            end: void 0,
            dir: void 0
          };
          var lines = this.session.doc.$lines;
          if (!lines)
            return;
          var cursor = this.session.selection.getCursor();
          var initialIndent = /^\s*/.exec(this.session.doc.getLine(cursor.row))[0].length;
          var elementIndentLevel = Math.floor(initialIndent / this.tabSize);
          this.$highlightIndentGuideMarker = {
            indentLevel: elementIndentLevel,
            start: cursor.row
          };
          var bracketHighlight = this.session.$bracketHighlight;
          if (bracketHighlight) {
            var ranges = this.session.$bracketHighlight.ranges;
            for (var i2 = 0; i2 < ranges.length; i2++) {
              if (cursor.row !== ranges[i2].start.row) {
                this.$highlightIndentGuideMarker.end = ranges[i2].start.row + 1;
                if (cursor.row > ranges[i2].start.row) {
                  this.$highlightIndentGuideMarker.dir = -1;
                } else {
                  this.$highlightIndentGuideMarker.dir = 1;
                }
                break;
              }
            }
          }
          if (!this.$highlightIndentGuideMarker.end) {
            if (lines[cursor.row] !== "" && cursor.column === lines[cursor.row].length) {
              this.$highlightIndentGuideMarker.dir = 1;
              for (var i2 = cursor.row + 1; i2 < lines.length; i2++) {
                var line2 = lines[i2];
                var currentIndent = /^\s*/.exec(line2)[0].length;
                if (line2 !== "") {
                  this.$highlightIndentGuideMarker.end = i2;
                  if (currentIndent <= initialIndent)
                    break;
                }
              }
            }
          }
          this.$renderHighlightIndentGuide();
        };
        Text3.prototype.$clearActiveIndentGuide = function() {
          var activeIndentGuides = this.element.querySelectorAll(".ace_indent-guide-active");
          for (var i2 = 0; i2 < activeIndentGuides.length; i2++) {
            activeIndentGuides[i2].classList.remove("ace_indent-guide-active");
          }
        };
        Text3.prototype.$setIndentGuideActive = function(cell, indentLevel) {
          var line2 = this.session.doc.getLine(cell.row);
          if (line2 !== "") {
            var element2 = cell.element;
            if (cell.element.classList && cell.element.classList.contains("ace_line_group")) {
              if (cell.element.childNodes.length > 0) {
                element2 = cell.element.childNodes[0];
              } else {
                return;
              }
            }
            var childNodes = element2.childNodes;
            if (childNodes) {
              var node2 = childNodes[indentLevel - 1];
              if (node2 && node2.classList && node2.classList.contains("ace_indent-guide"))
                node2.classList.add("ace_indent-guide-active");
            }
          }
        };
        Text3.prototype.$renderHighlightIndentGuide = function() {
          if (!this.$lines)
            return;
          var cells = this.$lines.cells;
          this.$clearActiveIndentGuide();
          var indentLevel = this.$highlightIndentGuideMarker.indentLevel;
          if (indentLevel !== 0) {
            if (this.$highlightIndentGuideMarker.dir === 1) {
              for (var i2 = 0; i2 < cells.length; i2++) {
                var cell = cells[i2];
                if (this.$highlightIndentGuideMarker.end && cell.row >= this.$highlightIndentGuideMarker.start + 1) {
                  if (cell.row >= this.$highlightIndentGuideMarker.end)
                    break;
                  this.$setIndentGuideActive(cell, indentLevel);
                }
              }
            } else {
              for (var i2 = cells.length - 1; i2 >= 0; i2--) {
                var cell = cells[i2];
                if (this.$highlightIndentGuideMarker.end && cell.row < this.$highlightIndentGuideMarker.start) {
                  if (cell.row < this.$highlightIndentGuideMarker.end)
                    break;
                  this.$setIndentGuideActive(cell, indentLevel);
                }
              }
            }
          }
        };
        Text3.prototype.$createLineElement = function(parent) {
          var lineEl = this.dom.createElement("div");
          lineEl.className = "ace_line";
          lineEl.style.height = this.config.lineHeight + "px";
          return lineEl;
        };
        Text3.prototype.$renderWrappedLine = function(parent, tokens2, splits) {
          var chars2 = 0;
          var split2 = 0;
          var splitChars = splits[0];
          var screenColumn = 0;
          var lineEl = this.$createLineElement();
          parent.appendChild(lineEl);
          for (var i2 = 0; i2 < tokens2.length; i2++) {
            var token2 = tokens2[i2];
            var value2 = token2.value;
            if (i2 == 0 && this.displayIndentGuides) {
              chars2 = value2.length;
              value2 = this.renderIndentGuide(lineEl, value2, splitChars);
              if (!value2)
                continue;
              chars2 -= value2.length;
            }
            if (chars2 + value2.length < splitChars) {
              screenColumn = this.$renderToken(lineEl, screenColumn, token2, value2);
              chars2 += value2.length;
            } else {
              while (chars2 + value2.length >= splitChars) {
                screenColumn = this.$renderToken(lineEl, screenColumn, token2, value2.substring(0, splitChars - chars2));
                value2 = value2.substring(splitChars - chars2);
                chars2 = splitChars;
                lineEl = this.$createLineElement();
                parent.appendChild(lineEl);
                var text2 = this.dom.createTextNode(lang2.stringRepeat(" ", splits.indent), this.element);
                text2["charCount"] = 0;
                lineEl.appendChild(text2);
                split2++;
                screenColumn = 0;
                splitChars = splits[split2] || Number.MAX_VALUE;
              }
              if (value2.length != 0) {
                chars2 += value2.length;
                screenColumn = this.$renderToken(lineEl, screenColumn, token2, value2);
              }
            }
          }
          if (splits[splits.length - 1] > this.MAX_LINE_LENGTH)
            this.$renderOverflowMessage(lineEl, screenColumn, null, "", true);
        };
        Text3.prototype.$renderSimpleLine = function(parent, tokens2) {
          var screenColumn = 0;
          for (var i2 = 0; i2 < tokens2.length; i2++) {
            var token2 = tokens2[i2];
            var value2 = token2.value;
            if (i2 == 0 && this.displayIndentGuides) {
              value2 = this.renderIndentGuide(parent, value2);
              if (!value2)
                continue;
            }
            if (screenColumn + value2.length > this.MAX_LINE_LENGTH)
              return this.$renderOverflowMessage(parent, screenColumn, token2, value2);
            screenColumn = this.$renderToken(parent, screenColumn, token2, value2);
          }
        };
        Text3.prototype.$renderOverflowMessage = function(parent, screenColumn, token2, value2, hide) {
          token2 && this.$renderToken(parent, screenColumn, token2, value2.slice(0, this.MAX_LINE_LENGTH - screenColumn));
          var overflowEl = this.dom.createElement("span");
          overflowEl.className = "ace_inline_button ace_keyword ace_toggle_wrap";
          overflowEl.textContent = hide ? "<hide>" : "<click to see more...>";
          parent.appendChild(overflowEl);
        };
        Text3.prototype.$renderLine = function(parent, row, foldLine) {
          if (!foldLine && foldLine != false)
            foldLine = this.session.getFoldLine(row);
          if (foldLine)
            var tokens2 = this.$getFoldLineTokens(row, foldLine);
          else
            var tokens2 = this.session.getTokens(row);
          var lastLineEl = parent;
          if (tokens2.length) {
            var splits = this.session.getRowSplitData(row);
            if (splits && splits.length) {
              this.$renderWrappedLine(parent, tokens2, splits);
              var lastLineEl = parent.lastChild;
            } else {
              var lastLineEl = parent;
              if (this.$useLineGroups()) {
                lastLineEl = this.$createLineElement();
                parent.appendChild(lastLineEl);
              }
              this.$renderSimpleLine(lastLineEl, tokens2);
            }
          } else if (this.$useLineGroups()) {
            lastLineEl = this.$createLineElement();
            parent.appendChild(lastLineEl);
          }
          if (this.showEOL && lastLineEl) {
            if (foldLine)
              row = foldLine.end.row;
            var invisibleEl = this.dom.createElement("span");
            invisibleEl.className = "ace_invisible ace_invisible_eol";
            invisibleEl.textContent = row == this.session.getLength() - 1 ? this.EOF_CHAR : this.EOL_CHAR;
            lastLineEl.appendChild(invisibleEl);
          }
        };
        Text3.prototype.$getFoldLineTokens = function(row, foldLine) {
          var session = this.session;
          var renderTokens = [];
          function addTokens(tokens3, from2, to2) {
            var idx = 0, col = 0;
            while (col + tokens3[idx].value.length < from2) {
              col += tokens3[idx].value.length;
              idx++;
              if (idx == tokens3.length)
                return;
            }
            if (col != from2) {
              var value2 = tokens3[idx].value.substring(from2 - col);
              if (value2.length > to2 - from2)
                value2 = value2.substring(0, to2 - from2);
              renderTokens.push({
                type: tokens3[idx].type,
                value: value2
              });
              col = from2 + value2.length;
              idx += 1;
            }
            while (col < to2 && idx < tokens3.length) {
              var value2 = tokens3[idx].value;
              if (value2.length + col > to2) {
                renderTokens.push({
                  type: tokens3[idx].type,
                  value: value2.substring(0, to2 - col)
                });
              } else
                renderTokens.push(tokens3[idx]);
              col += value2.length;
              idx += 1;
            }
          }
          var tokens2 = session.getTokens(row);
          foldLine.walk(function(placeholder, row2, column2, lastColumn, isNewRow) {
            if (placeholder != null) {
              renderTokens.push({
                type: "fold",
                value: placeholder
              });
            } else {
              if (isNewRow)
                tokens2 = session.getTokens(row2);
              if (tokens2.length)
                addTokens(tokens2, lastColumn, column2);
            }
          }, foldLine.end.row, this.session.getLine(foldLine.end.row).length);
          return renderTokens;
        };
        Text3.prototype.$useLineGroups = function() {
          return this.session.getUseWrapMode();
        };
        return Text3;
      }()
    );
    Text2.prototype.EOF_CHAR = "¶";
    Text2.prototype.EOL_CHAR_LF = "¬";
    Text2.prototype.EOL_CHAR_CRLF = "¤";
    Text2.prototype.EOL_CHAR = Text2.prototype.EOL_CHAR_LF;
    Text2.prototype.TAB_CHAR = "—";
    Text2.prototype.SPACE_CHAR = "·";
    Text2.prototype.$padding = 0;
    Text2.prototype.MAX_LINE_LENGTH = 1e4;
    Text2.prototype.showInvisibles = false;
    Text2.prototype.showSpaces = false;
    Text2.prototype.showTabs = false;
    Text2.prototype.showEOL = false;
    Text2.prototype.displayIndentGuides = true;
    Text2.prototype.$highlightIndentGuides = true;
    Text2.prototype.$tabStrings = [];
    Text2.prototype.destroy = {};
    Text2.prototype.onChangeTabSize = Text2.prototype.$computeTabString;
    oop.implement(Text2.prototype, EventEmitter2);
    exports3.Text = Text2;
  });
  ace.define("ace/layer/cursor", ["require", "exports", "module", "ace/lib/dom"], function(require2, exports3, module3) {
    var dom = require2("../lib/dom");
    var Cursor = (
      /** @class */
      function() {
        function Cursor2(parentEl) {
          this.element = dom.createElement("div");
          this.element.className = "ace_layer ace_cursor-layer";
          parentEl.appendChild(this.element);
          this.isVisible = false;
          this.isBlinking = true;
          this.blinkInterval = 1e3;
          this.smoothBlinking = false;
          this.cursors = [];
          this.cursor = this.addCursor();
          dom.addCssClass(this.element, "ace_hidden-cursors");
          this.$updateCursors = this.$updateOpacity.bind(this);
        }
        Cursor2.prototype.$updateOpacity = function(val) {
          var cursors = this.cursors;
          for (var i2 = cursors.length; i2--; )
            dom.setStyle(cursors[i2].style, "opacity", val ? "" : "0");
        };
        Cursor2.prototype.$startCssAnimation = function() {
          var cursors = this.cursors;
          for (var i2 = cursors.length; i2--; )
            cursors[i2].style.animationDuration = this.blinkInterval + "ms";
          this.$isAnimating = true;
          setTimeout((function() {
            if (this.$isAnimating) {
              dom.addCssClass(this.element, "ace_animate-blinking");
            }
          }).bind(this));
        };
        Cursor2.prototype.$stopCssAnimation = function() {
          this.$isAnimating = false;
          dom.removeCssClass(this.element, "ace_animate-blinking");
        };
        Cursor2.prototype.setPadding = function(padding) {
          this.$padding = padding;
        };
        Cursor2.prototype.setSession = function(session) {
          this.session = session;
        };
        Cursor2.prototype.setBlinking = function(blinking) {
          if (blinking != this.isBlinking) {
            this.isBlinking = blinking;
            this.restartTimer();
          }
        };
        Cursor2.prototype.setBlinkInterval = function(blinkInterval) {
          if (blinkInterval != this.blinkInterval) {
            this.blinkInterval = blinkInterval;
            this.restartTimer();
          }
        };
        Cursor2.prototype.setSmoothBlinking = function(smoothBlinking) {
          if (smoothBlinking != this.smoothBlinking) {
            this.smoothBlinking = smoothBlinking;
            dom.setCssClass(this.element, "ace_smooth-blinking", smoothBlinking);
            this.$updateCursors(true);
            this.restartTimer();
          }
        };
        Cursor2.prototype.addCursor = function() {
          var el2 = dom.createElement("div");
          el2.className = "ace_cursor";
          this.element.appendChild(el2);
          this.cursors.push(el2);
          return el2;
        };
        Cursor2.prototype.removeCursor = function() {
          if (this.cursors.length > 1) {
            var el2 = this.cursors.pop();
            el2.parentNode.removeChild(el2);
            return el2;
          }
        };
        Cursor2.prototype.hideCursor = function() {
          this.isVisible = false;
          dom.addCssClass(this.element, "ace_hidden-cursors");
          this.restartTimer();
        };
        Cursor2.prototype.showCursor = function() {
          this.isVisible = true;
          dom.removeCssClass(this.element, "ace_hidden-cursors");
          this.restartTimer();
        };
        Cursor2.prototype.restartTimer = function() {
          var update = this.$updateCursors;
          clearInterval(this.intervalId);
          clearTimeout(this.timeoutId);
          this.$stopCssAnimation();
          if (this.smoothBlinking) {
            this.$isSmoothBlinking = false;
            dom.removeCssClass(this.element, "ace_smooth-blinking");
          }
          update(true);
          if (!this.isBlinking || !this.blinkInterval || !this.isVisible) {
            this.$stopCssAnimation();
            return;
          }
          if (this.smoothBlinking) {
            this.$isSmoothBlinking = true;
            setTimeout((function() {
              if (this.$isSmoothBlinking) {
                dom.addCssClass(this.element, "ace_smooth-blinking");
              }
            }).bind(this));
          }
          if (dom.HAS_CSS_ANIMATION) {
            this.$startCssAnimation();
          } else {
            var blink = (
              /**@this{Cursor}*/
              (function() {
                this.timeoutId = setTimeout(function() {
                  update(false);
                }, 0.6 * this.blinkInterval);
              }).bind(this)
            );
            this.intervalId = setInterval(function() {
              update(true);
              blink();
            }, this.blinkInterval);
            blink();
          }
        };
        Cursor2.prototype.getPixelPosition = function(position2, onScreen) {
          if (!this.config || !this.session)
            return { left: 0, top: 0 };
          if (!position2)
            position2 = this.session.selection.getCursor();
          var pos = this.session.documentToScreenPosition(position2);
          var cursorLeft = this.$padding + (this.session.$bidiHandler.isBidiRow(pos.row, position2.row) ? this.session.$bidiHandler.getPosLeft(pos.column) : pos.column * this.config.characterWidth);
          var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) * this.config.lineHeight;
          return { left: cursorLeft, top: cursorTop };
        };
        Cursor2.prototype.isCursorInView = function(pixelPos, config2) {
          return pixelPos.top >= 0 && pixelPos.top < config2.maxHeight;
        };
        Cursor2.prototype.update = function(config2) {
          this.config = config2;
          var selections = this.session.$selectionMarkers;
          var i2 = 0, cursorIndex = 0;
          if (selections === void 0 || selections.length === 0) {
            selections = [{ cursor: null }];
          }
          for (var i2 = 0, n2 = selections.length; i2 < n2; i2++) {
            var pixelPos = this.getPixelPosition(selections[i2].cursor, true);
            if ((pixelPos.top > config2.height + config2.offset || pixelPos.top < 0) && i2 > 1) {
              continue;
            }
            var element2 = this.cursors[cursorIndex++] || this.addCursor();
            var style2 = element2.style;
            if (!this.drawCursor) {
              if (!this.isCursorInView(pixelPos, config2)) {
                dom.setStyle(style2, "display", "none");
              } else {
                dom.setStyle(style2, "display", "block");
                dom.translate(element2, pixelPos.left, pixelPos.top);
                dom.setStyle(style2, "width", Math.round(config2.characterWidth) + "px");
                dom.setStyle(style2, "height", config2.lineHeight + "px");
              }
            } else {
              this.drawCursor(element2, pixelPos, config2, selections[i2], this.session);
            }
          }
          while (this.cursors.length > cursorIndex)
            this.removeCursor();
          var overwrite = this.session.getOverwrite();
          this.$setOverwrite(overwrite);
          this.$pixelPos = pixelPos;
          this.restartTimer();
        };
        Cursor2.prototype.$setOverwrite = function(overwrite) {
          if (overwrite != this.overwrite) {
            this.overwrite = overwrite;
            if (overwrite)
              dom.addCssClass(this.element, "ace_overwrite-cursors");
            else
              dom.removeCssClass(this.element, "ace_overwrite-cursors");
          }
        };
        Cursor2.prototype.destroy = function() {
          clearInterval(this.intervalId);
          clearTimeout(this.timeoutId);
        };
        return Cursor2;
      }()
    );
    Cursor.prototype.$padding = 0;
    Cursor.prototype.drawCursor = null;
    exports3.Cursor = Cursor;
  });
  ace.define("ace/scrollbar", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/lib/event", "ace/lib/event_emitter"], function(require2, exports3, module3) {
    var __extends2 = this && this.__extends || /* @__PURE__ */ function() {
      var extendStatics = function(d2, b2) {
        extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
          d3.__proto__ = b3;
        } || function(d3, b3) {
          for (var p2 in b3)
            if (Object.prototype.hasOwnProperty.call(b3, p2))
              d3[p2] = b3[p2];
        };
        return extendStatics(d2, b2);
      };
      return function(d2, b2) {
        if (typeof b2 !== "function" && b2 !== null)
          throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
        extendStatics(d2, b2);
        function __() {
          this.constructor = d2;
        }
        d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
      };
    }();
    var oop = require2("./lib/oop");
    var dom = require2("./lib/dom");
    var event = require2("./lib/event");
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var MAX_SCROLL_H = 32768;
    var Scrollbar = (
      /** @class */
      function() {
        function Scrollbar2(parent, classSuffix) {
          this.element = dom.createElement("div");
          this.element.className = "ace_scrollbar ace_scrollbar" + classSuffix;
          this.inner = dom.createElement("div");
          this.inner.className = "ace_scrollbar-inner";
          this.inner.textContent = " ";
          this.element.appendChild(this.inner);
          parent.appendChild(this.element);
          this.setVisible(false);
          this.skipEvent = false;
          event.addListener(this.element, "scroll", this.onScroll.bind(this));
          event.addListener(this.element, "mousedown", event.preventDefault);
        }
        Scrollbar2.prototype.setVisible = function(isVisible2) {
          this.element.style.display = isVisible2 ? "" : "none";
          this.isVisible = isVisible2;
          this.coeff = 1;
        };
        return Scrollbar2;
      }()
    );
    oop.implement(Scrollbar.prototype, EventEmitter2);
    var VScrollBar = (
      /** @class */
      function(_super) {
        __extends2(VScrollBar2, _super);
        function VScrollBar2(parent, renderer) {
          var _this = _super.call(this, parent, "-v") || this;
          _this.scrollTop = 0;
          _this.scrollHeight = 0;
          renderer.$scrollbarWidth = _this.width = dom.scrollbarWidth(parent.ownerDocument);
          _this.inner.style.width = _this.element.style.width = (_this.width || 15) + 5 + "px";
          _this.$minWidth = 0;
          return _this;
        }
        VScrollBar2.prototype.onScroll = function() {
          if (!this.skipEvent) {
            this.scrollTop = this.element.scrollTop;
            if (this.coeff != 1) {
              var h3 = this.element.clientHeight / this.scrollHeight;
              this.scrollTop = this.scrollTop * (1 - h3) / (this.coeff - h3);
            }
            this._emit("scroll", { data: this.scrollTop });
          }
          this.skipEvent = false;
        };
        VScrollBar2.prototype.getWidth = function() {
          return Math.max(this.isVisible ? this.width : 0, this.$minWidth || 0);
        };
        VScrollBar2.prototype.setHeight = function(height) {
          this.element.style.height = height + "px";
        };
        VScrollBar2.prototype.setScrollHeight = function(height) {
          this.scrollHeight = height;
          if (height > MAX_SCROLL_H) {
            this.coeff = MAX_SCROLL_H / height;
            height = MAX_SCROLL_H;
          } else if (this.coeff != 1) {
            this.coeff = 1;
          }
          this.inner.style.height = height + "px";
        };
        VScrollBar2.prototype.setScrollTop = function(scrollTop) {
          if (this.scrollTop != scrollTop) {
            this.skipEvent = true;
            this.scrollTop = scrollTop;
            this.element.scrollTop = scrollTop * this.coeff;
          }
        };
        return VScrollBar2;
      }(Scrollbar)
    );
    VScrollBar.prototype.setInnerHeight = VScrollBar.prototype.setScrollHeight;
    var HScrollBar = (
      /** @class */
      function(_super) {
        __extends2(HScrollBar2, _super);
        function HScrollBar2(parent, renderer) {
          var _this = _super.call(this, parent, "-h") || this;
          _this.scrollLeft = 0;
          _this.height = renderer.$scrollbarWidth;
          _this.inner.style.height = _this.element.style.height = (_this.height || 15) + 5 + "px";
          return _this;
        }
        HScrollBar2.prototype.onScroll = function() {
          if (!this.skipEvent) {
            this.scrollLeft = this.element.scrollLeft;
            this._emit("scroll", { data: this.scrollLeft });
          }
          this.skipEvent = false;
        };
        HScrollBar2.prototype.getHeight = function() {
          return this.isVisible ? this.height : 0;
        };
        HScrollBar2.prototype.setWidth = function(width) {
          this.element.style.width = width + "px";
        };
        HScrollBar2.prototype.setInnerWidth = function(width) {
          this.inner.style.width = width + "px";
        };
        HScrollBar2.prototype.setScrollWidth = function(width) {
          this.inner.style.width = width + "px";
        };
        HScrollBar2.prototype.setScrollLeft = function(scrollLeft) {
          if (this.scrollLeft != scrollLeft) {
            this.skipEvent = true;
            this.scrollLeft = this.element.scrollLeft = scrollLeft;
          }
        };
        return HScrollBar2;
      }(Scrollbar)
    );
    exports3.ScrollBar = VScrollBar;
    exports3.ScrollBarV = VScrollBar;
    exports3.ScrollBarH = HScrollBar;
    exports3.VScrollBar = VScrollBar;
    exports3.HScrollBar = HScrollBar;
  });
  ace.define("ace/scrollbar_custom", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/lib/event", "ace/lib/event_emitter"], function(require2, exports3, module3) {
    var __extends2 = this && this.__extends || /* @__PURE__ */ function() {
      var extendStatics = function(d2, b2) {
        extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
          d3.__proto__ = b3;
        } || function(d3, b3) {
          for (var p2 in b3)
            if (Object.prototype.hasOwnProperty.call(b3, p2))
              d3[p2] = b3[p2];
        };
        return extendStatics(d2, b2);
      };
      return function(d2, b2) {
        if (typeof b2 !== "function" && b2 !== null)
          throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
        extendStatics(d2, b2);
        function __() {
          this.constructor = d2;
        }
        d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
      };
    }();
    var oop = require2("./lib/oop");
    var dom = require2("./lib/dom");
    var event = require2("./lib/event");
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    dom.importCssString(".ace_editor>.ace_sb-v div, .ace_editor>.ace_sb-h div{\n  position: absolute;\n  background: rgba(128, 128, 128, 0.6);\n  -moz-box-sizing: border-box;\n  box-sizing: border-box;\n  border: 1px solid #bbb;\n  border-radius: 2px;\n  z-index: 8;\n}\n.ace_editor>.ace_sb-v, .ace_editor>.ace_sb-h {\n  position: absolute;\n  z-index: 6;\n  background: none;\n  overflow: hidden!important;\n}\n.ace_editor>.ace_sb-v {\n  z-index: 6;\n  right: 0;\n  top: 0;\n  width: 12px;\n}\n.ace_editor>.ace_sb-v div {\n  z-index: 8;\n  right: 0;\n  width: 100%;\n}\n.ace_editor>.ace_sb-h {\n  bottom: 0;\n  left: 0;\n  height: 12px;\n}\n.ace_editor>.ace_sb-h div {\n  bottom: 0;\n  height: 100%;\n}\n.ace_editor>.ace_sb_grabbed {\n  z-index: 8;\n  background: #000;\n}", "ace_scrollbar.css", false);
    var ScrollBar2 = (
      /** @class */
      function() {
        function ScrollBar3(parent, classSuffix) {
          this.element = dom.createElement("div");
          this.element.className = "ace_sb" + classSuffix;
          this.inner = dom.createElement("div");
          this.inner.className = "";
          this.element.appendChild(this.inner);
          this.VScrollWidth = 12;
          this.HScrollHeight = 12;
          parent.appendChild(this.element);
          this.setVisible(false);
          this.skipEvent = false;
          event.addMultiMouseDownListener(this.element, [500, 300, 300], this, "onMouseDown");
        }
        ScrollBar3.prototype.setVisible = function(isVisible2) {
          this.element.style.display = isVisible2 ? "" : "none";
          this.isVisible = isVisible2;
          this.coeff = 1;
        };
        return ScrollBar3;
      }()
    );
    oop.implement(ScrollBar2.prototype, EventEmitter2);
    var VScrollBar = (
      /** @class */
      function(_super) {
        __extends2(VScrollBar2, _super);
        function VScrollBar2(parent, renderer) {
          var _this = _super.call(this, parent, "-v") || this;
          _this.scrollTop = 0;
          _this.scrollHeight = 0;
          _this.parent = parent;
          _this.width = _this.VScrollWidth;
          _this.renderer = renderer;
          _this.inner.style.width = _this.element.style.width = (_this.width || 15) + "px";
          _this.$minWidth = 0;
          return _this;
        }
        VScrollBar2.prototype.onMouseDown = function(eType, e2) {
          if (eType !== "mousedown")
            return;
          if (event.getButton(e2) !== 0 || e2.detail === 2) {
            return;
          }
          if (e2.target === this.inner) {
            var self2 = this;
            var mousePageY = e2.clientY;
            var onMouseMove = function(e3) {
              mousePageY = e3.clientY;
            };
            var onMouseUp = function() {
              clearInterval(timerId);
            };
            var startY = e2.clientY;
            var startTop = this.thumbTop;
            var onScrollInterval = function() {
              if (mousePageY === void 0)
                return;
              var scrollTop = self2.scrollTopFromThumbTop(startTop + mousePageY - startY);
              if (scrollTop === self2.scrollTop)
                return;
              self2._emit("scroll", { data: scrollTop });
            };
            event.capture(this.inner, onMouseMove, onMouseUp);
            var timerId = setInterval(onScrollInterval, 20);
            return event.preventDefault(e2);
          }
          var top2 = e2.clientY - this.element.getBoundingClientRect().top - this.thumbHeight / 2;
          this._emit("scroll", { data: this.scrollTopFromThumbTop(top2) });
          return event.preventDefault(e2);
        };
        VScrollBar2.prototype.getHeight = function() {
          return this.height;
        };
        VScrollBar2.prototype.scrollTopFromThumbTop = function(thumbTop) {
          var scrollTop = thumbTop * (this.pageHeight - this.viewHeight) / (this.slideHeight - this.thumbHeight);
          scrollTop = scrollTop >> 0;
          if (scrollTop < 0) {
            scrollTop = 0;
          } else if (scrollTop > this.pageHeight - this.viewHeight) {
            scrollTop = this.pageHeight - this.viewHeight;
          }
          return scrollTop;
        };
        VScrollBar2.prototype.getWidth = function() {
          return Math.max(this.isVisible ? this.width : 0, this.$minWidth || 0);
        };
        VScrollBar2.prototype.setHeight = function(height) {
          this.height = Math.max(0, height);
          this.slideHeight = this.height;
          this.viewHeight = this.height;
          this.setScrollHeight(this.pageHeight, true);
        };
        VScrollBar2.prototype.setScrollHeight = function(height, force) {
          if (this.pageHeight === height && !force)
            return;
          this.pageHeight = height;
          this.thumbHeight = this.slideHeight * this.viewHeight / this.pageHeight;
          if (this.thumbHeight > this.slideHeight)
            this.thumbHeight = this.slideHeight;
          if (this.thumbHeight < 15)
            this.thumbHeight = 15;
          this.inner.style.height = this.thumbHeight + "px";
          if (this.scrollTop > this.pageHeight - this.viewHeight) {
            this.scrollTop = this.pageHeight - this.viewHeight;
            if (this.scrollTop < 0)
              this.scrollTop = 0;
            this._emit("scroll", { data: this.scrollTop });
          }
        };
        VScrollBar2.prototype.setScrollTop = function(scrollTop) {
          this.scrollTop = scrollTop;
          if (scrollTop < 0)
            scrollTop = 0;
          this.thumbTop = scrollTop * (this.slideHeight - this.thumbHeight) / (this.pageHeight - this.viewHeight);
          this.inner.style.top = this.thumbTop + "px";
        };
        return VScrollBar2;
      }(ScrollBar2)
    );
    VScrollBar.prototype.setInnerHeight = VScrollBar.prototype.setScrollHeight;
    var HScrollBar = (
      /** @class */
      function(_super) {
        __extends2(HScrollBar2, _super);
        function HScrollBar2(parent, renderer) {
          var _this = _super.call(this, parent, "-h") || this;
          _this.scrollLeft = 0;
          _this.scrollWidth = 0;
          _this.height = _this.HScrollHeight;
          _this.inner.style.height = _this.element.style.height = (_this.height || 12) + "px";
          _this.renderer = renderer;
          return _this;
        }
        HScrollBar2.prototype.onMouseDown = function(eType, e2) {
          if (eType !== "mousedown")
            return;
          if (event.getButton(e2) !== 0 || e2.detail === 2) {
            return;
          }
          if (e2.target === this.inner) {
            var self2 = this;
            var mousePageX = e2.clientX;
            var onMouseMove = function(e3) {
              mousePageX = e3.clientX;
            };
            var onMouseUp = function() {
              clearInterval(timerId);
            };
            var startX = e2.clientX;
            var startLeft = this.thumbLeft;
            var onScrollInterval = function() {
              if (mousePageX === void 0)
                return;
              var scrollLeft = self2.scrollLeftFromThumbLeft(startLeft + mousePageX - startX);
              if (scrollLeft === self2.scrollLeft)
                return;
              self2._emit("scroll", { data: scrollLeft });
            };
            event.capture(this.inner, onMouseMove, onMouseUp);
            var timerId = setInterval(onScrollInterval, 20);
            return event.preventDefault(e2);
          }
          var left2 = e2.clientX - this.element.getBoundingClientRect().left - this.thumbWidth / 2;
          this._emit("scroll", { data: this.scrollLeftFromThumbLeft(left2) });
          return event.preventDefault(e2);
        };
        HScrollBar2.prototype.getHeight = function() {
          return this.isVisible ? this.height : 0;
        };
        HScrollBar2.prototype.scrollLeftFromThumbLeft = function(thumbLeft) {
          var scrollLeft = thumbLeft * (this.pageWidth - this.viewWidth) / (this.slideWidth - this.thumbWidth);
          scrollLeft = scrollLeft >> 0;
          if (scrollLeft < 0) {
            scrollLeft = 0;
          } else if (scrollLeft > this.pageWidth - this.viewWidth) {
            scrollLeft = this.pageWidth - this.viewWidth;
          }
          return scrollLeft;
        };
        HScrollBar2.prototype.setWidth = function(width) {
          this.width = Math.max(0, width);
          this.element.style.width = this.width + "px";
          this.slideWidth = this.width;
          this.viewWidth = this.width;
          this.setScrollWidth(this.pageWidth, true);
        };
        HScrollBar2.prototype.setScrollWidth = function(width, force) {
          if (this.pageWidth === width && !force)
            return;
          this.pageWidth = width;
          this.thumbWidth = this.slideWidth * this.viewWidth / this.pageWidth;
          if (this.thumbWidth > this.slideWidth)
            this.thumbWidth = this.slideWidth;
          if (this.thumbWidth < 15)
            this.thumbWidth = 15;
          this.inner.style.width = this.thumbWidth + "px";
          if (this.scrollLeft > this.pageWidth - this.viewWidth) {
            this.scrollLeft = this.pageWidth - this.viewWidth;
            if (this.scrollLeft < 0)
              this.scrollLeft = 0;
            this._emit("scroll", { data: this.scrollLeft });
          }
        };
        HScrollBar2.prototype.setScrollLeft = function(scrollLeft) {
          this.scrollLeft = scrollLeft;
          if (scrollLeft < 0)
            scrollLeft = 0;
          this.thumbLeft = scrollLeft * (this.slideWidth - this.thumbWidth) / (this.pageWidth - this.viewWidth);
          this.inner.style.left = this.thumbLeft + "px";
        };
        return HScrollBar2;
      }(ScrollBar2)
    );
    HScrollBar.prototype.setInnerWidth = HScrollBar.prototype.setScrollWidth;
    exports3.ScrollBar = VScrollBar;
    exports3.ScrollBarV = VScrollBar;
    exports3.ScrollBarH = HScrollBar;
    exports3.VScrollBar = VScrollBar;
    exports3.HScrollBar = HScrollBar;
  });
  ace.define("ace/renderloop", ["require", "exports", "module", "ace/lib/event"], function(require2, exports3, module3) {
    var event = require2("./lib/event");
    var RenderLoop = (
      /** @class */
      function() {
        function RenderLoop2(onRender, win2) {
          this.onRender = onRender;
          this.pending = false;
          this.changes = 0;
          this.$recursionLimit = 2;
          this.window = win2 || window;
          var _self = this;
          this._flush = function(ts) {
            _self.pending = false;
            var changes = _self.changes;
            if (changes) {
              event.blockIdle(100);
              _self.changes = 0;
              _self.onRender(changes);
            }
            if (_self.changes) {
              if (_self.$recursionLimit-- < 0)
                return;
              _self.schedule();
            } else {
              _self.$recursionLimit = 2;
            }
          };
        }
        RenderLoop2.prototype.schedule = function(change) {
          this.changes = this.changes | change;
          if (this.changes && !this.pending) {
            event.nextFrame(this._flush);
            this.pending = true;
          }
        };
        RenderLoop2.prototype.clear = function(change) {
          var changes = this.changes;
          this.changes = 0;
          return changes;
        };
        return RenderLoop2;
      }()
    );
    exports3.RenderLoop = RenderLoop;
  });
  ace.define("ace/layer/font_metrics", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/lib/lang", "ace/lib/event", "ace/lib/useragent", "ace/lib/event_emitter"], function(require2, exports3, module3) {
    var oop = require2("../lib/oop");
    var dom = require2("../lib/dom");
    var lang2 = require2("../lib/lang");
    var event = require2("../lib/event");
    var useragent = require2("../lib/useragent");
    var EventEmitter2 = require2("../lib/event_emitter").EventEmitter;
    var CHAR_COUNT = 512;
    var USE_OBSERVER = typeof ResizeObserver == "function";
    var L2 = 200;
    var FontMetrics = (
      /** @class */
      function() {
        function FontMetrics2(parentEl) {
          this.el = dom.createElement("div");
          this.$setMeasureNodeStyles(this.el.style, true);
          this.$main = dom.createElement("div");
          this.$setMeasureNodeStyles(this.$main.style);
          this.$measureNode = dom.createElement("div");
          this.$setMeasureNodeStyles(this.$measureNode.style);
          this.el.appendChild(this.$main);
          this.el.appendChild(this.$measureNode);
          parentEl.appendChild(this.el);
          this.$measureNode.textContent = lang2.stringRepeat("X", CHAR_COUNT);
          this.$characterSize = { width: 0, height: 0 };
          if (USE_OBSERVER)
            this.$addObserver();
          else
            this.checkForSizeChanges();
        }
        FontMetrics2.prototype.$setMeasureNodeStyles = function(style2, isRoot) {
          style2.width = style2.height = "auto";
          style2.left = style2.top = "0px";
          style2.visibility = "hidden";
          style2.position = "absolute";
          style2.whiteSpace = "pre";
          if (useragent.isIE < 8) {
            style2["font-family"] = "inherit";
          } else {
            style2.font = "inherit";
          }
          style2.overflow = isRoot ? "hidden" : "visible";
        };
        FontMetrics2.prototype.checkForSizeChanges = function(size2) {
          if (size2 === void 0)
            size2 = this.$measureSizes();
          if (size2 && (this.$characterSize.width !== size2.width || this.$characterSize.height !== size2.height)) {
            this.$measureNode.style.fontWeight = "bold";
            var boldSize = this.$measureSizes();
            this.$measureNode.style.fontWeight = "";
            this.$characterSize = size2;
            this.charSizes = /* @__PURE__ */ Object.create(null);
            this.allowBoldFonts = boldSize && boldSize.width === size2.width && boldSize.height === size2.height;
            this._emit("changeCharacterSize", { data: size2 });
          }
        };
        FontMetrics2.prototype.$addObserver = function() {
          var self2 = this;
          this.$observer = new window.ResizeObserver(function(e2) {
            self2.checkForSizeChanges();
          });
          this.$observer.observe(this.$measureNode);
        };
        FontMetrics2.prototype.$pollSizeChanges = function() {
          if (this.$pollSizeChangesTimer || this.$observer)
            return this.$pollSizeChangesTimer;
          var self2 = this;
          return this.$pollSizeChangesTimer = event.onIdle(function cb2() {
            self2.checkForSizeChanges();
            event.onIdle(cb2, 500);
          }, 500);
        };
        FontMetrics2.prototype.setPolling = function(val) {
          if (val) {
            this.$pollSizeChanges();
          } else if (this.$pollSizeChangesTimer) {
            clearInterval(this.$pollSizeChangesTimer);
            this.$pollSizeChangesTimer = 0;
          }
        };
        FontMetrics2.prototype.$measureSizes = function(node2) {
          var size2 = {
            height: (node2 || this.$measureNode).clientHeight,
            width: (node2 || this.$measureNode).clientWidth / CHAR_COUNT
          };
          if (size2.width === 0 || size2.height === 0)
            return null;
          return size2;
        };
        FontMetrics2.prototype.$measureCharWidth = function(ch2) {
          this.$main.textContent = lang2.stringRepeat(ch2, CHAR_COUNT);
          var rect = this.$main.getBoundingClientRect();
          return rect.width / CHAR_COUNT;
        };
        FontMetrics2.prototype.getCharacterWidth = function(ch2) {
          var w2 = this.charSizes[ch2];
          if (w2 === void 0) {
            w2 = this.charSizes[ch2] = this.$measureCharWidth(ch2) / this.$characterSize.width;
          }
          return w2;
        };
        FontMetrics2.prototype.destroy = function() {
          clearInterval(this.$pollSizeChangesTimer);
          if (this.$observer)
            this.$observer.disconnect();
          if (this.el && this.el.parentNode)
            this.el.parentNode.removeChild(this.el);
        };
        FontMetrics2.prototype.$getZoom = function(element2) {
          if (!element2 || !element2.parentElement)
            return 1;
          return (Number(window.getComputedStyle(element2)["zoom"]) || 1) * this.$getZoom(element2.parentElement);
        };
        FontMetrics2.prototype.$initTransformMeasureNodes = function() {
          var t2 = function(t3, l2) {
            return ["div", {
              style: "position: absolute;top:" + t3 + "px;left:" + l2 + "px;"
            }];
          };
          this.els = dom.buildDom([t2(0, 0), t2(L2, 0), t2(0, L2), t2(L2, L2)], this.el);
        };
        FontMetrics2.prototype.transformCoordinates = function(clientPos, elPos) {
          if (clientPos) {
            var zoom = this.$getZoom(this.el);
            clientPos = mul(1 / zoom, clientPos);
          }
          function solve(l1, l2, r2) {
            var det = l1[1] * l2[0] - l1[0] * l2[1];
            return [
              (-l2[1] * r2[0] + l2[0] * r2[1]) / det,
              (+l1[1] * r2[0] - l1[0] * r2[1]) / det
            ];
          }
          function sub(a3, b3) {
            return [a3[0] - b3[0], a3[1] - b3[1]];
          }
          function add2(a3, b3) {
            return [a3[0] + b3[0], a3[1] + b3[1]];
          }
          function mul(a3, b3) {
            return [a3 * b3[0], a3 * b3[1]];
          }
          if (!this.els)
            this.$initTransformMeasureNodes();
          function p2(el2) {
            var r2 = el2.getBoundingClientRect();
            return [r2.left, r2.top];
          }
          var a2 = p2(this.els[0]);
          var b2 = p2(this.els[1]);
          var c2 = p2(this.els[2]);
          var d2 = p2(this.els[3]);
          var h3 = solve(sub(d2, b2), sub(d2, c2), sub(add2(b2, c2), add2(d2, a2)));
          var m1 = mul(1 + h3[0], sub(b2, a2));
          var m2 = mul(1 + h3[1], sub(c2, a2));
          if (elPos) {
            var x2 = elPos;
            var k2 = h3[0] * x2[0] / L2 + h3[1] * x2[1] / L2 + 1;
            var ut = add2(mul(x2[0], m1), mul(x2[1], m2));
            return add2(mul(1 / k2 / L2, ut), a2);
          }
          var u2 = sub(clientPos, a2);
          var f2 = solve(sub(m1, mul(h3[0], u2)), sub(m2, mul(h3[1], u2)), u2);
          return mul(L2, f2);
        };
        return FontMetrics2;
      }()
    );
    FontMetrics.prototype.$characterSize = { width: 0, height: 0 };
    oop.implement(FontMetrics.prototype, EventEmitter2);
    exports3.FontMetrics = FontMetrics;
  });
  ace.define("ace/css/editor-css", ["require", "exports", "module"], function(require2, exports3, module3) {
    module3.exports = `
.ace_br1 {border-top-left-radius    : 3px;}
.ace_br2 {border-top-right-radius   : 3px;}
.ace_br3 {border-top-left-radius    : 3px; border-top-right-radius:    3px;}
.ace_br4 {border-bottom-right-radius: 3px;}
.ace_br5 {border-top-left-radius    : 3px; border-bottom-right-radius: 3px;}
.ace_br6 {border-top-right-radius   : 3px; border-bottom-right-radius: 3px;}
.ace_br7 {border-top-left-radius    : 3px; border-top-right-radius:    3px; border-bottom-right-radius: 3px;}
.ace_br8 {border-bottom-left-radius : 3px;}
.ace_br9 {border-top-left-radius    : 3px; border-bottom-left-radius:  3px;}
.ace_br10{border-top-right-radius   : 3px; border-bottom-left-radius:  3px;}
.ace_br11{border-top-left-radius    : 3px; border-top-right-radius:    3px; border-bottom-left-radius:  3px;}
.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius:  3px;}
.ace_br13{border-top-left-radius    : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius:  3px;}
.ace_br14{border-top-right-radius   : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius:  3px;}
.ace_br15{border-top-left-radius    : 3px; border-top-right-radius:    3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}


.ace_editor {
    position: relative;
    overflow: hidden;
    padding: 0;
    font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Source Code Pro', 'source-code-pro', monospace;
    direction: ltr;
    text-align: left;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    forced-color-adjust: none;
}

.ace_scroller {
    position: absolute;
    overflow: hidden;
    top: 0;
    bottom: 0;
    background-color: inherit;
    -ms-user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    user-select: none;
    cursor: text;
}

.ace_content {
    position: absolute;
    box-sizing: border-box;
    min-width: 100%;
    contain: style size layout;
    font-variant-ligatures: no-common-ligatures;
}
.ace_invisible {
    font-variant-ligatures: none;
}

.ace_keyboard-focus:focus {
    box-shadow: inset 0 0 0 2px #5E9ED6;
    outline: none;
}

.ace_dragging .ace_scroller:before{
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    content: '';
    background: rgba(250, 250, 250, 0.01);
    z-index: 1000;
}
.ace_dragging.ace_dark .ace_scroller:before{
    background: rgba(0, 0, 0, 0.01);
}

.ace_gutter {
    position: absolute;
    overflow : hidden;
    width: auto;
    top: 0;
    bottom: 0;
    left: 0;
    cursor: default;
    z-index: 4;
    -ms-user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    user-select: none;
    contain: style size layout;
}

.ace_gutter-active-line {
    position: absolute;
    left: 0;
    right: 0;
}

.ace_scroller.ace_scroll-left:after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;
    pointer-events: none;
}

.ace_gutter-cell, .ace_gutter-cell_svg-icons {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding-left: 19px;
    padding-right: 6px;
    background-repeat: no-repeat;
}

.ace_gutter-cell_svg-icons .ace_gutter_annotation {
    margin-left: -14px;
    float: left;
}

.ace_gutter-cell .ace_gutter_annotation {
    margin-left: -19px;
    float: left;
}

.ace_gutter-cell.ace_error, .ace_icon.ace_error, .ace_icon.ace_error_fold, .ace_gutter-cell.ace_security, .ace_icon.ace_security, .ace_icon.ace_security_fold {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==");
    background-repeat: no-repeat;
    background-position: 2px center;
}

.ace_gutter-cell.ace_warning, .ace_icon.ace_warning, .ace_icon.ace_warning_fold {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==");
    background-repeat: no-repeat;
    background-position: 2px center;
}

.ace_gutter-cell.ace_info, .ace_icon.ace_info, .ace_gutter-cell.ace_hint, .ace_icon.ace_hint {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=");
    background-repeat: no-repeat;
    background-position: 2px center;
}

.ace_dark .ace_gutter-cell.ace_info, .ace_dark .ace_icon.ace_info, .ace_dark .ace_gutter-cell.ace_hint, .ace_dark .ace_icon.ace_hint {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC");
}

.ace_icon_svg.ace_error {
    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJyZWQiIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIj4KPGNpcmNsZSBmaWxsPSJub25lIiBjeD0iOCIgY3k9IjgiIHI9IjciIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPGxpbmUgeDE9IjExIiB5MT0iNSIgeDI9IjUiIHkyPSIxMSIvPgo8bGluZSB4MT0iMTEiIHkxPSIxMSIgeDI9IjUiIHkyPSI1Ii8+CjwvZz4KPC9zdmc+");
    background-color: crimson;
}
.ace_icon_svg.ace_security {
    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0iZGFya29yYW5nZSIgZmlsbD0ibm9uZSIgc2hhcGUtcmVuZGVyaW5nPSJnZW9tZXRyaWNQcmVjaXNpb24iPgogICAgICAgIDxwYXRoIGNsYXNzPSJzdHJva2UtbGluZWpvaW4tcm91bmQiIGQ9Ik04IDE0LjgzMDdDOCAxNC44MzA3IDIgMTIuOTA0NyAyIDguMDg5OTJWMy4yNjU0OEM1LjMxIDMuMjY1NDggNy45ODk5OSAxLjM0OTE4IDcuOTg5OTkgMS4zNDkxOEM3Ljk4OTk5IDEuMzQ5MTggMTAuNjkgMy4yNjU0OCAxNCAzLjI2NTQ4VjguMDg5OTJDMTQgMTIuOTA0NyA4IDE0LjgzMDcgOCAxNC44MzA3WiIvPgogICAgICAgIDxwYXRoIGQ9Ik0yIDguMDg5OTJWMy4yNjU0OEM1LjMxIDMuMjY1NDggNy45ODk5OSAxLjM0OTE4IDcuOTg5OTkgMS4zNDkxOCIvPgogICAgICAgIDxwYXRoIGQ9Ik0xMy45OSA4LjA4OTkyVjMuMjY1NDhDMTAuNjggMy4yNjU0OCA4IDEuMzQ5MTggOCAxLjM0OTE4Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTggNFY5Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTggMTBWMTIiLz4KICAgIDwvZz4KPC9zdmc+");
    background-color: crimson;
}
.ace_icon_svg.ace_warning {
    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJkYXJrb3JhbmdlIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+Cjxwb2x5Z29uIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGZpbGw9Im5vbmUiIHBvaW50cz0iOCAxIDE1IDE1IDEgMTUgOCAxIi8+CjxyZWN0IHg9IjgiIHk9IjEyIiB3aWR0aD0iMC4wMSIgaGVpZ2h0PSIwLjAxIi8+CjxsaW5lIHgxPSI4IiB5MT0iNiIgeDI9IjgiIHkyPSIxMCIvPgo8L2c+Cjwvc3ZnPg==");
    background-color: darkorange;
}
.ace_icon_svg.ace_info {
    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJibHVlIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CjxjaXJjbGUgZmlsbD0ibm9uZSIgY3g9IjgiIGN5PSI4IiByPSI3IiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjxwb2x5bGluZSBwb2ludHM9IjggMTEgOCA4Ii8+Cjxwb2x5bGluZSBwb2ludHM9IjkgOCA2IDgiLz4KPGxpbmUgeDE9IjEwIiB5MT0iMTEiIHgyPSI2IiB5Mj0iMTEiLz4KPHJlY3QgeD0iOCIgeT0iNSIgd2lkdGg9IjAuMDEiIGhlaWdodD0iMC4wMSIvPgo8L2c+Cjwvc3ZnPg==");
    background-color: royalblue;
}
.ace_icon_svg.ace_hint {
    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0ic2lsdmVyIiBmaWxsPSJub25lIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTYgMTRIMTAiLz4KICAgICAgICA8cGF0aCBkPSJNOCAxMUg5QzkgOS40NzAwMiAxMiA4LjU0MDAyIDEyIDUuNzYwMDJDMTIuMDIgNC40MDAwMiAxMS4zOSAzLjM2MDAyIDEwLjQzIDIuNjcwMDJDOSAxLjY0MDAyIDcuMDAwMDEgMS42NDAwMiA1LjU3MDAxIDIuNjcwMDJDNC42MTAwMSAzLjM2MDAyIDMuOTggNC40MDAwMiA0IDUuNzYwMDJDNCA4LjU0MDAyIDcuMDAwMDEgOS40NzAwMiA3LjAwMDAxIDExSDhaIi8+CiAgICA8L2c+Cjwvc3ZnPg==");
    background-color: silver;
}

.ace_icon_svg.ace_error_fold {
    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSI+CiAgPHBhdGggZD0ibSAxOC45Mjk4NTEsNy44Mjk4MDc2IGMgMC4xNDYzNTMsNi4zMzc0NjA0IC02LjMyMzE0Nyw3Ljc3Nzg0NDQgLTcuNDc3OTEyLDcuNzc3ODQ0NCAtMi4xMDcyNzI2LC0wLjEyODc1IDUuMTE3Njc4LDAuMzU2MjQ5IDUuMDUxNjk4LC03Ljg3MDA2MTggLTAuNjA0NjcyLC04LjAwMzk3MzQ5IC03LjA3NzI3MDYsLTcuNTYzMTE4OSAtNC44NTczLC03LjQzMDM5NTU2IDEuNjA2LC0wLjExNTE0MjI1IDYuODk3NDg1LDEuMjYyNTQ1OTYgNy4yODM1MTQsNy41MjI2MTI5NiB6IiBmaWxsPSJjcmltc29uIiBzdHJva2Utd2lkdGg9IjIiLz4KICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0ibSA4LjExNDc1NjIsMi4wNTI5ODI4IGMgMy4zNDkxNjk4LDAgNi4wNjQxMzI4LDIuNjc2ODYyNyA2LjA2NDEzMjgsNS45Nzg5NTMgMCwzLjMwMjExMjIgLTIuNzE0OTYzLDUuOTc4OTIwMiAtNi4wNjQxMzI4LDUuOTc4OTIwMiAtMy4zNDkxNDczLDAgLTYuMDY0MTc3MiwtMi42NzY4MDggLTYuMDY0MTc3MiwtNS45Nzg5MjAyIDAuMDA1MzksLTMuMjk5ODg2MSAyLjcxNzI2NTYsLTUuOTczNjQwOCA2LjA2NDE3NzIsLTUuOTc4OTUzIHogbSAwLC0xLjczNTgyNzE5IGMgLTQuMzIxNDgzNiwwIC03LjgyNDc0MDM4LDMuNDU0MDE4NDkgLTcuODI0NzQwMzgsNy43MTQ3ODAxOSAwLDQuMjYwNzI4MiAzLjUwMzI1Njc4LDcuNzE0NzQ1MiA3LjgyNDc0MDM4LDcuNzE0NzQ1MiA0LjMyMTQ0OTgsMCA3LjgyNDY5OTgsLTMuNDU0MDE3IDcuODI0Njk5OCwtNy43MTQ3NDUyIDAsLTIuMDQ2MDkxNCAtMC44MjQzOTIsLTQuMDA4MzY3MiAtMi4yOTE3NTYsLTUuNDU1MTc0NiBDIDEyLjE4MDIyNSwxLjEyOTk2NDggMTAuMTkwMDEzLDAuMzE3MTU1NjEgOC4xMTQ3NTYyLDAuMzE3MTU1NjEgWiBNIDYuOTM3NDU2Myw4LjI0MDU5ODUgNC42NzE4Njg1LDEwLjQ4NTg1MiA2LjAwODY4MTQsMTEuODc2NzI4IDguMzE3MDAzNSw5LjYwMDc5MTEgMTAuNjI1MzM3LDExLjg3NjcyOCAxMS45NjIxMzgsMTAuNDg1ODUyIDkuNjk2NTUwOCw4LjI0MDU5ODUgMTEuOTYyMTM4LDYuMDA2ODA2NiAxMC41NzMyNDYsNC42Mzc0MzM1IDguMzE3MDAzNSw2Ljg3MzQyOTcgNi4wNjA3NjA3LDQuNjM3NDMzNSA0LjY3MTg2ODUsNi4wMDY4MDY2IFoiIGZpbGw9ImNyaW1zb24iIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4=");
    background-color: crimson;
}
.ace_icon_svg.ace_security_fold {
    -webkit-mask-image: url("data:image/svg+xml;base64,CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTcgMTQiIGZpbGw9Im5vbmUiPgogICAgPHBhdGggZD0iTTEwLjAwMDEgMTMuNjk5MkMxMC4wMDAxIDEzLjY5OTIgMTEuOTI0MSAxMy40NzYzIDEzIDEyLjY5OTJDMTQuNDEzOSAxMS42NzgxIDE2IDEwLjUgMTYuMTI1MSA2LjgxMTI2VjIuNTg5ODdDMTYuMTI1MSAyLjU0NzY4IDE2LjEyMjEgMi41MDYxOSAxNi4xMTY0IDIuNDY1NTlWMS43MTQ4NUgxNS4yNDE0TDE1LjIzMDcgMS43MTQ4NEwxNC42MjUxIDEuNjk5MjJWNi44MTEyM0MxNC42MjUxIDguNTEwNjEgMTQuNjI1MSA5LjQ2NDYxIDEyLjc4MjQgMTEuNzIxQzEyLjE1ODYgMTIuNDg0OCAxMC4wMDAxIDEzLjY5OTIgMTAuMDAwMSAxMy42OTkyWiIgZmlsbD0iY3JpbXNvbiIgc3Ryb2tlLXdpZHRoPSIyIi8+CiAgICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTcuMzM2MDkgMC4zNjc0NzVDNy4wMzIxNCAwLjE1MjY1MiA2LjYyNTQ4IDAuMTUzNjE0IDYuMzIyNTMgMC4zNjk5OTdMNi4zMDg2OSAwLjM3OTU1NEM2LjI5NTUzIDAuMzg4NTg4IDYuMjczODggMC40MDMyNjYgNi4yNDQxNyAwLjQyMjc4OUM2LjE4NDcxIDAuNDYxODYgNi4wOTMyMSAwLjUyMDE3MSA1Ljk3MzEzIDAuNTkxMzczQzUuNzMyNTEgMC43MzQwNTkgNS4zNzk5IDAuOTI2ODY0IDQuOTQyNzkgMS4xMjAwOUM0LjA2MTQ0IDEuNTA5NyAyLjg3NTQxIDEuODgzNzcgMS41ODk4NCAxLjg4Mzc3SDAuNzE0ODQ0VjIuNzU4NzdWNi45ODAxNUMwLjcxNDg0NCA5LjQ5Mzc0IDIuMjg4NjYgMTEuMTk3MyAzLjcwMjU0IDEyLjIxODVDNC40MTg0NSAxMi43MzU1IDUuMTI4NzQgMTMuMTA1MyA1LjY1NzMzIDEzLjM0NTdDNS45MjI4NCAxMy40NjY0IDYuMTQ1NjYgMTMuNTU1OSA2LjMwNDY1IDEzLjYxNjFDNi4zODQyMyAxMy42NDYyIDYuNDQ4MDUgMTMuNjY5IDYuNDkzNDkgMTMuNjg0OEM2LjUxNjIyIDEzLjY5MjcgNi41MzQzOCAxMy42OTg5IDYuNTQ3NjQgMTMuNzAzM0w2LjU2MzgyIDEzLjcwODdMNi41NjkwOCAxMy43MTA0TDYuNTcwOTkgMTMuNzExTDYuODM5ODQgMTMuNzUzM0w2LjU3MjQyIDEzLjcxMTVDNi43NDYzMyAxMy43NjczIDYuOTMzMzUgMTMuNzY3MyA3LjEwNzI3IDEzLjcxMTVMNy4xMDg3IDEzLjcxMUw3LjExMDYxIDEzLjcxMDRMNy4xMTU4NyAxMy43MDg3TDcuMTMyMDUgMTMuNzAzM0M3LjE0NTMxIDEzLjY5ODkgNy4xNjM0NiAxMy42OTI3IDcuMTg2MTkgMTMuNjg0OEM3LjIzMTY0IDEzLjY2OSA3LjI5NTQ2IDEzLjY0NjIgNy4zNzUwMyAxMy42MTYxQzcuNTM0MDMgMTMuNTU1OSA3Ljc1Njg1IDEzLjQ2NjQgOC4wMjIzNiAxMy4zNDU3QzguNTUwOTUgMTMuMTA1MyA5LjI2MTIzIDEyLjczNTUgOS45NzcxNSAxMi4yMTg1QzExLjM5MSAxMS4xOTczIDEyLjk2NDggOS40OTM3NyAxMi45NjQ4IDYuOTgwMThWMi43NTg4QzEyLjk2NDggMi43MTY2IDEyLjk2MTkgMi42NzUxMSAxMi45NTYxIDIuNjM0NTFWMS44ODM3N0gxMi4wODExQzEyLjA3NzUgMS44ODM3NyAxMi4wNzQgMS44ODM3NyAxMi4wNzA0IDEuODgzNzdDMTAuNzk3OSAxLjg4MDA0IDkuNjE5NjIgMS41MTEwMiA4LjczODk0IDEuMTI0ODZDOC43MzUzNCAxLjEyMzI3IDguNzMxNzQgMS4xMjE2OCA4LjcyODE0IDEuMTIwMDlDOC4yOTEwMyAwLjkyNjg2NCA3LjkzODQyIDAuNzM0MDU5IDcuNjk3NzkgMC41OTEzNzNDNy41Nzc3MiAwLjUyMDE3MSA3LjQ4NjIyIDAuNDYxODYgNy40MjY3NiAwLjQyMjc4OUM3LjM5NzA1IDAuNDAzMjY2IDcuMzc1MzkgMC4zODg1ODggNy4zNjIyNCAwLjM3OTU1NEw3LjM0ODk2IDAuMzcwMzVDNy4zNDg5NiAwLjM3MDM1IDcuMzQ4NDcgMC4zNzAwMiA3LjM0NTYzIDAuMzc0MDU0TDcuMzM3NzkgMC4zNjg2NTlMNy4zMzYwOSAwLjM2NzQ3NVpNOC4wMzQ3MSAyLjcyNjkxQzguODYwNCAzLjA5MDYzIDkuOTYwNjYgMy40NjMwOSAxMS4yMDYxIDMuNTg5MDdWNi45ODAxNUgxMS4yMTQ4QzExLjIxNDggOC42Nzk1MyAxMC4xNjM3IDkuOTI1MDcgOC45NTI1NCAxMC43OTk4QzguMzU1OTUgMTEuMjMwNiA3Ljc1Mzc0IDExLjU0NTQgNy4yOTc5NiAxMS43NTI3QzcuMTE2NzEgMTEuODM1MSA2Ljk2MDYyIDExLjg5OTYgNi44Mzk4NCAxMS45NDY5QzYuNzE5MDYgMTEuODk5NiA2LjU2Mjk3IDExLjgzNTEgNi4zODE3MyAxMS43NTI3QzUuOTI1OTUgMTEuNTQ1NCA1LjMyMzczIDExLjIzMDYgNC43MjcxNSAxMC43OTk4QzMuNTE2MDMgOS45MjUwNyAyLjQ2NDg0IDguNjc5NTUgMi40NjQ4NCA2Ljk4MDE4VjMuNTg5MDlDMy43MTczOCAzLjQ2MjM5IDQuODIzMDggMy4wODYzOSA1LjY1MDMzIDIuNzIwNzFDNi4xNDIyOCAyLjUwMzI0IDYuNTQ0ODUgMi4yODUzNyA2LjgzMjU0IDIuMTE2MjRDNy4xMjE4MSAyLjI4NTM1IDcuNTI3IDIuNTAzNTIgOC4wMjE5NiAyLjcyMTMxQzguMDI2MiAyLjcyMzE3IDguMDMwNDUgMi43MjUwNCA4LjAzNDcxIDIuNzI2OTFaTTUuOTY0ODQgMy40MDE0N1Y3Ljc3NjQ3SDcuNzE0ODRWMy40MDE0N0g1Ljk2NDg0Wk01Ljk2NDg0IDEwLjQwMTVWOC42NTE0N0g3LjcxNDg0VjEwLjQwMTVINS45NjQ4NFoiIGZpbGw9ImNyaW1zb24iIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4=");
    background-color: crimson;
}
.ace_icon_svg.ace_warning_fold {
    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNC43NzY5IDE0LjczMzdMOC42NTE5MiAyLjQ4MzY5QzguMzI5NDYgMS44Mzg3NyA3LjQwOTEzIDEuODM4NzcgNy4wODY2NyAyLjQ4MzY5TDAuOTYxNjY5IDE0LjczMzdDMC42NzA3NzUgMTUuMzE1NSAxLjA5MzgzIDE2IDEuNzQ0MjkgMTZIMTMuOTk0M0MxNC42NDQ4IDE2IDE1LjA2NzggMTUuMzE1NSAxNC43NzY5IDE0LjczMzdaTTMuMTYwMDcgMTQuMjVMNy44NjkyOSA0LjgzMTU2TDEyLjU3ODUgMTQuMjVIMy4xNjAwN1pNOC43NDQyOSAxMS42MjVWMTMuMzc1SDYuOTk0MjlWMTEuNjI1SDguNzQ0MjlaTTYuOTk0MjkgMTAuNzVWNy4yNUg4Ljc0NDI5VjEwLjc1SDYuOTk0MjlaIiBmaWxsPSIjRUM3MjExIi8+CjxwYXRoIGQ9Ik0xMS4xOTkxIDIuOTUyMzhDMTAuODgwOSAyLjMxNDY3IDEwLjM1MzcgMS44MDUyNiA5LjcwNTUgMS41MDlMMTEuMDQxIDEuMDY5NzhDMTEuNjg4MyAwLjk0OTgxNCAxMi4zMzcgMS4yNzI2MyAxMi42MzE3IDEuODYxNDFMMTcuNjEzNiAxMS44MTYxQzE4LjM1MjcgMTMuMjkyOSAxNy41OTM4IDE1LjA4MDQgMTYuMDE4IDE1LjU3NDVDMTYuNDA0NCAxNC40NTA3IDE2LjMyMzEgMTMuMjE4OCAxNS43OTI0IDEyLjE1NTVMMTEuMTk5MSAyLjk1MjM4WiIgZmlsbD0iI0VDNzIxMSIvPgo8L3N2Zz4=");
    background-color: darkorange;
}

.ace_scrollbar {
    contain: strict;
    position: absolute;
    right: 0;
    bottom: 0;
    z-index: 6;
}

.ace_scrollbar-inner {
    position: absolute;
    cursor: text;
    left: 0;
    top: 0;
}

.ace_scrollbar-v{
    overflow-x: hidden;
    overflow-y: scroll;
    top: 0;
}

.ace_scrollbar-h {
    overflow-x: scroll;
    overflow-y: hidden;
    left: 0;
}

.ace_print-margin {
    position: absolute;
    height: 100%;
}

.ace_text-input {
    position: absolute;
    z-index: 0;
    width: 0.5em;
    height: 1em;
    opacity: 0;
    background: transparent;
    -moz-appearance: none;
    appearance: none;
    border: none;
    resize: none;
    outline: none;
    overflow: hidden;
    font: inherit;
    padding: 0 1px;
    margin: 0 -1px;
    contain: strict;
    -ms-user-select: text;
    -moz-user-select: text;
    -webkit-user-select: text;
    user-select: text;
    /*with \`pre-line\` chrome inserts &nbsp; instead of space*/
    white-space: pre!important;
}
.ace_text-input.ace_composition {
    background: transparent;
    color: inherit;
    z-index: 1000;
    opacity: 1;
}
.ace_composition_placeholder { color: transparent }
.ace_composition_marker { 
    border-bottom: 1px solid;
    position: absolute;
    border-radius: 0;
    margin-top: 1px;
}

[ace_nocontext=true] {
    transform: none!important;
    filter: none!important;
    clip-path: none!important;
    mask : none!important;
    contain: none!important;
    perspective: none!important;
    mix-blend-mode: initial!important;
    z-index: auto;
}

.ace_layer {
    z-index: 1;
    position: absolute;
    overflow: hidden;
    /* workaround for chrome bug https://github.com/ajaxorg/ace/issues/2312*/
    word-wrap: normal;
    white-space: pre;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
    /* setting pointer-events: auto; on node under the mouse, which changes
        during scroll, will break mouse wheel scrolling in Safari */
    pointer-events: none;
}

.ace_gutter-layer {
    position: relative;
    width: auto;
    text-align: right;
    pointer-events: auto;
    height: 1000000px;
    contain: style size layout;
}

.ace_text-layer {
    font: inherit !important;
    position: absolute;
    height: 1000000px;
    width: 1000000px;
    contain: style size layout;
}

.ace_text-layer > .ace_line, .ace_text-layer > .ace_line_group {
    contain: style size layout;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
}

.ace_hidpi .ace_text-layer,
.ace_hidpi .ace_gutter-layer,
.ace_hidpi .ace_content,
.ace_hidpi .ace_gutter {
    contain: strict;
}
.ace_hidpi .ace_text-layer > .ace_line, 
.ace_hidpi .ace_text-layer > .ace_line_group {
    contain: strict;
}

.ace_cjk {
    display: inline-block;
    text-align: center;
}

.ace_cursor-layer {
    z-index: 4;
}

.ace_cursor {
    z-index: 4;
    position: absolute;
    box-sizing: border-box;
    border-left: 2px solid;
    /* workaround for smooth cursor repaintng whole screen in chrome */
    transform: translatez(0);
}

.ace_multiselect .ace_cursor {
    border-left-width: 1px;
}

.ace_slim-cursors .ace_cursor {
    border-left-width: 1px;
}

.ace_overwrite-cursors .ace_cursor {
    border-left-width: 0;
    border-bottom: 1px solid;
}

.ace_hidden-cursors .ace_cursor {
    opacity: 0.2;
}

.ace_hasPlaceholder .ace_hidden-cursors .ace_cursor {
    opacity: 0;
}

.ace_smooth-blinking .ace_cursor {
    transition: opacity 0.18s;
}

.ace_animate-blinking .ace_cursor {
    animation-duration: 1000ms;
    animation-timing-function: step-end;
    animation-name: blink-ace-animate;
    animation-iteration-count: infinite;
}

.ace_animate-blinking.ace_smooth-blinking .ace_cursor {
    animation-duration: 1000ms;
    animation-timing-function: ease-in-out;
    animation-name: blink-ace-animate-smooth;
}
    
@keyframes blink-ace-animate {
    from, to { opacity: 1; }
    60% { opacity: 0; }
}

@keyframes blink-ace-animate-smooth {
    from, to { opacity: 1; }
    45% { opacity: 1; }
    60% { opacity: 0; }
    85% { opacity: 0; }
}

.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {
    position: absolute;
    z-index: 3;
}

.ace_marker-layer .ace_selection {
    position: absolute;
    z-index: 5;
}

.ace_marker-layer .ace_bracket {
    position: absolute;
    z-index: 6;
}

.ace_marker-layer .ace_error_bracket {
    position: absolute;
    border-bottom: 1px solid #DE5555;
    border-radius: 0;
}

.ace_marker-layer .ace_active-line {
    position: absolute;
    z-index: 2;
}

.ace_marker-layer .ace_selected-word {
    position: absolute;
    z-index: 4;
    box-sizing: border-box;
}

.ace_line .ace_fold {
    box-sizing: border-box;

    display: inline-block;
    height: 11px;
    margin-top: -2px;
    vertical-align: middle;

    background-image:
        url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),
        url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=");
    background-repeat: no-repeat, repeat-x;
    background-position: center center, top left;
    color: transparent;

    border: 1px solid black;
    border-radius: 2px;

    cursor: pointer;
    pointer-events: auto;
}

.ace_dark .ace_fold {
}

.ace_fold:hover{
    background-image:
        url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),
        url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC");
}

.ace_tooltip {
    background-color: #f5f5f5;
    border: 1px solid gray;
    border-radius: 1px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    color: black;
    padding: 3px 4px;
    position: fixed;
    z-index: 999999;
    box-sizing: border-box;
    cursor: default;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: normal;
    font-style: normal;
    font-weight: normal;
    letter-spacing: normal;
    pointer-events: none;
    overflow: auto;
    max-width: min(33em, 66vw);
    overscroll-behavior: contain;
}
.ace_tooltip pre {
    white-space: pre-wrap;
}

.ace_tooltip.ace_dark {
    background-color: #636363;
    color: #fff;
}

.ace_tooltip:focus {
    outline: 1px solid #5E9ED6;
}

.ace_icon {
    display: inline-block;
    width: 18px;
    vertical-align: top;
}

.ace_icon_svg {
    display: inline-block;
    width: 12px;
    vertical-align: top;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-size: 12px;
    -webkit-mask-position: center;
}

.ace_folding-enabled > .ace_gutter-cell, .ace_folding-enabled > .ace_gutter-cell_svg-icons {
    padding-right: 13px;
}

.ace_fold-widget, .ace_custom-widget {
    box-sizing: border-box;

    margin: 0 -12px 0 1px;
    display: none;
    width: 11px;
    vertical-align: top;

    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==");
    background-repeat: no-repeat;
    background-position: center;

    border-radius: 3px;
    
    border: 1px solid transparent;
    cursor: pointer;
    pointer-events: auto;
}

.ace_custom-widget {
    background: none;
}

.ace_folding-enabled .ace_fold-widget {
    display: inline-block;   
}

.ace_fold-widget.ace_end {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==");
}

.ace_fold-widget.ace_closed {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==");
}

.ace_fold-widget:hover {
    border: 1px solid rgba(0, 0, 0, 0.3);
    background-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
}

.ace_fold-widget:active {
    border: 1px solid rgba(0, 0, 0, 0.4);
    background-color: rgba(0, 0, 0, 0.05);
    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
}
/**
 * Dark version for fold widgets
 */
.ace_dark .ace_fold-widget {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");
}
.ace_dark .ace_fold-widget.ace_end {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");
}
.ace_dark .ace_fold-widget.ace_closed {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");
}
.ace_dark .ace_fold-widget:hover {
    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.1);
}
.ace_dark .ace_fold-widget:active {
    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
}

.ace_inline_button {
    border: 1px solid lightgray;
    display: inline-block;
    margin: -1px 8px;
    padding: 0 5px;
    pointer-events: auto;
    cursor: pointer;
}
.ace_inline_button:hover {
    border-color: gray;
    background: rgba(200,200,200,0.2);
    display: inline-block;
    pointer-events: auto;
}

.ace_fold-widget.ace_invalid {
    background-color: #FFB4B4;
    border-color: #DE5555;
}

.ace_fade-fold-widgets .ace_fold-widget {
    transition: opacity 0.4s ease 0.05s;
    opacity: 0;
}

.ace_fade-fold-widgets:hover .ace_fold-widget {
    transition: opacity 0.05s ease 0.05s;
    opacity:1;
}

.ace_underline {
    text-decoration: underline;
}

.ace_bold {
    font-weight: bold;
}

.ace_nobold .ace_bold {
    font-weight: normal;
}

.ace_italic {
    font-style: italic;
}


.ace_error-marker {
    background-color: rgba(255, 0, 0,0.2);
    position: absolute;
    z-index: 9;
}

.ace_highlight-marker {
    background-color: rgba(255, 255, 0,0.2);
    position: absolute;
    z-index: 8;
}

.ace_mobile-menu {
    position: absolute;
    line-height: 1.5;
    border-radius: 4px;
    -ms-user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    user-select: none;
    background: white;
    box-shadow: 1px 3px 2px grey;
    border: 1px solid #dcdcdc;
    color: black;
}
.ace_dark > .ace_mobile-menu {
    background: #333;
    color: #ccc;
    box-shadow: 1px 3px 2px grey;
    border: 1px solid #444;

}
.ace_mobile-button {
    padding: 2px;
    cursor: pointer;
    overflow: hidden;
}
.ace_mobile-button:hover {
    background-color: #eee;
    opacity:1;
}
.ace_mobile-button:active {
    background-color: #ddd;
}

.ace_placeholder {
    position: relative;
    font-family: arial;
    transform: scale(0.9);
    transform-origin: left;
    white-space: pre;
    opacity: 0.7;
    margin: 0 10px;
    z-index: 1;
}

.ace_ghost_text {
    opacity: 0.5;
    font-style: italic;
}

.ace_ghost_text_container > div {
    white-space: pre;
}

.ghost_text_line_wrapped::after {
    content: "↩";
    position: absolute;
}

.ace_lineWidgetContainer.ace_ghost_text {
    margin: 0px 4px
}

.ace_screenreader-only {
    position:absolute;
    left:-10000px;
    top:auto;
    width:1px;
    height:1px;
    overflow:hidden;
}

.ace_hidden_token {
    display: none;
}`;
  });
  ace.define("ace/layer/decorators", ["require", "exports", "module", "ace/lib/dom", "ace/lib/oop", "ace/lib/event_emitter"], function(require2, exports3, module3) {
    var dom = require2("../lib/dom");
    var oop = require2("../lib/oop");
    var EventEmitter2 = require2("../lib/event_emitter").EventEmitter;
    var Decorator = (
      /** @class */
      function() {
        function Decorator2(scrollbarV, renderer) {
          this.renderer = renderer;
          this.pixelRatio = 1;
          this.maxHeight = renderer.layerConfig.maxHeight;
          this.lineHeight = renderer.layerConfig.lineHeight;
          this.minDecorationHeight = 2 * this.pixelRatio | 0;
          this.halfMinDecorationHeight = this.minDecorationHeight / 2 | 0;
          this.colors = {};
          this.colors.dark = {
            "error": "rgba(255, 18, 18, 1)",
            "warning": "rgba(18, 136, 18, 1)",
            "info": "rgba(18, 18, 136, 1)"
          };
          this.colors.light = {
            "error": "rgb(255,51,51)",
            "warning": "rgb(32,133,72)",
            "info": "rgb(35,68,138)"
          };
          this.setScrollBarV(scrollbarV);
        }
        Decorator2.prototype.$createCanvas = function() {
          this.canvas = dom.createElement("canvas");
          this.canvas.style.top = "0px";
          this.canvas.style.right = "0px";
          this.canvas.style.zIndex = "7";
          this.canvas.style.position = "absolute";
        };
        Decorator2.prototype.setScrollBarV = function(scrollbarV) {
          this.$createCanvas();
          this.scrollbarV = scrollbarV;
          scrollbarV.element.appendChild(this.canvas);
          this.setDimensions();
        };
        Decorator2.prototype.$updateDecorators = function(config2) {
          if (typeof this.canvas.getContext !== "function") {
            return;
          }
          var colors2 = this.renderer.theme.isDark === true ? this.colors.dark : this.colors.light;
          this.setDimensions(config2);
          var ctx = this.canvas.getContext("2d");
          function compare(a2, b2) {
            if (a2.priority < b2.priority)
              return -1;
            if (a2.priority > b2.priority)
              return 1;
            return 0;
          }
          var annotations = this.renderer.session.$annotations;
          ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
          if (annotations) {
            var priorities2 = {
              "info": 1,
              "warning": 2,
              "error": 3
            };
            annotations.forEach(function(item) {
              item["priority"] = priorities2[item.type] || null;
            });
            annotations = annotations.sort(compare);
            for (var i2 = 0; i2 < annotations.length; i2++) {
              var row = annotations[i2].row;
              var offset1 = this.getVerticalOffsetForRow(row);
              var offset2 = offset1 + this.lineHeight;
              var y1 = Math.round(this.heightRatio * offset1);
              var y2 = Math.round(this.heightRatio * offset2);
              var ycenter = Math.round((y1 + y2) / 2);
              var halfHeight = y2 - ycenter;
              if (halfHeight < this.halfMinDecorationHeight) {
                halfHeight = this.halfMinDecorationHeight;
              }
              if (ycenter - halfHeight < 0) {
                ycenter = halfHeight;
              }
              if (ycenter + halfHeight > this.canvasHeight) {
                ycenter = this.canvasHeight - halfHeight;
              }
              var from2 = ycenter - halfHeight;
              var to2 = ycenter + halfHeight;
              var zoneHeight = to2 - from2;
              ctx.fillStyle = colors2[annotations[i2].type] || null;
              ctx.fillRect(0, from2, Math.round(this.oneZoneWidth - 1), zoneHeight);
            }
          }
          var cursor = this.renderer.session.selection.getCursor();
          if (cursor) {
            var currentY = Math.round(this.getVerticalOffsetForRow(cursor.row) * this.heightRatio);
            ctx.fillStyle = "rgba(0, 0, 0, 0.5)";
            ctx.fillRect(0, currentY, this.canvasWidth, 2);
          }
        };
        Decorator2.prototype.getVerticalOffsetForRow = function(row) {
          row = row | 0;
          var offset2 = this.renderer.session.documentToScreenRow(row, 0) * this.lineHeight;
          return offset2;
        };
        Decorator2.prototype.setDimensions = function(config2) {
          config2 = config2 || this.renderer.layerConfig;
          this.maxHeight = config2.maxHeight;
          this.lineHeight = config2.lineHeight;
          this.canvasHeight = config2.height;
          this.canvasWidth = this.scrollbarV.width || this.canvasWidth;
          this.setZoneWidth();
          this.canvas.width = this.canvasWidth;
          this.canvas.height = this.canvasHeight;
          if (this.maxHeight < this.canvasHeight) {
            this.heightRatio = 1;
          } else {
            this.heightRatio = this.canvasHeight / this.maxHeight;
          }
        };
        Decorator2.prototype.setZoneWidth = function() {
          this.oneZoneWidth = this.canvasWidth;
        };
        Decorator2.prototype.destroy = function() {
          this.canvas.parentNode.removeChild(this.canvas);
        };
        return Decorator2;
      }()
    );
    oop.implement(Decorator.prototype, EventEmitter2);
    exports3.Decorator = Decorator;
  });
  ace.define("ace/virtual_renderer", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/lib/lang", "ace/config", "ace/layer/gutter", "ace/layer/marker", "ace/layer/text", "ace/layer/cursor", "ace/scrollbar", "ace/scrollbar", "ace/scrollbar_custom", "ace/scrollbar_custom", "ace/renderloop", "ace/layer/font_metrics", "ace/lib/event_emitter", "ace/css/editor-css", "ace/layer/decorators", "ace/lib/useragent", "ace/layer/text_util"], function(require2, exports3, module3) {
    var oop = require2("./lib/oop");
    var dom = require2("./lib/dom");
    var lang2 = require2("./lib/lang");
    var config2 = require2("./config");
    var GutterLayer = require2("./layer/gutter").Gutter;
    var MarkerLayer = require2("./layer/marker").Marker;
    var TextLayer = require2("./layer/text").Text;
    var CursorLayer = require2("./layer/cursor").Cursor;
    var HScrollBar = require2("./scrollbar").HScrollBar;
    var VScrollBar = require2("./scrollbar").VScrollBar;
    var HScrollBarCustom = require2("./scrollbar_custom").HScrollBar;
    var VScrollBarCustom = require2("./scrollbar_custom").VScrollBar;
    var RenderLoop = require2("./renderloop").RenderLoop;
    var FontMetrics = require2("./layer/font_metrics").FontMetrics;
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var editorCss = require2("./css/editor-css");
    var Decorator = require2("./layer/decorators").Decorator;
    var useragent = require2("./lib/useragent");
    var isTextToken = require2("./layer/text_util").isTextToken;
    dom.importCssString(editorCss, "ace_editor.css", false);
    var VirtualRenderer = (
      /** @class */
      function() {
        function VirtualRenderer2(container, theme2) {
          var _self = this;
          this.container = container || dom.createElement("div");
          dom.addCssClass(this.container, "ace_editor");
          if (dom.HI_DPI)
            dom.addCssClass(this.container, "ace_hidpi");
          this.setTheme(theme2);
          if (config2.get("useStrictCSP") == null)
            config2.set("useStrictCSP", false);
          this.$gutter = dom.createElement("div");
          this.$gutter.className = "ace_gutter";
          this.container.appendChild(this.$gutter);
          this.$gutter.setAttribute("aria-hidden", "true");
          this.scroller = dom.createElement("div");
          this.scroller.className = "ace_scroller";
          this.container.appendChild(this.scroller);
          this.content = dom.createElement("div");
          this.content.className = "ace_content";
          this.scroller.appendChild(this.content);
          this.$gutterLayer = new GutterLayer(this.$gutter);
          this.$gutterLayer.on("changeGutterWidth", this.onGutterResize.bind(this));
          this.$markerBack = new MarkerLayer(this.content);
          var textLayer = this.$textLayer = new TextLayer(this.content);
          this.canvas = textLayer.element;
          this.$markerFront = new MarkerLayer(this.content);
          this.$cursorLayer = new CursorLayer(this.content);
          this.$horizScroll = false;
          this.$vScroll = false;
          this.scrollBar = this.scrollBarV = new VScrollBar(this.container, this);
          this.scrollBarH = new HScrollBar(this.container, this);
          this.scrollBarV.on("scroll", function(e2) {
            if (!_self.$scrollAnimation)
              _self.session.setScrollTop(e2.data - _self.scrollMargin.top);
          });
          this.scrollBarH.on("scroll", function(e2) {
            if (!_self.$scrollAnimation)
              _self.session.setScrollLeft(e2.data - _self.scrollMargin.left);
          });
          this.scrollTop = 0;
          this.scrollLeft = 0;
          this.cursorPos = {
            row: 0,
            column: 0
          };
          this.$fontMetrics = new FontMetrics(this.container);
          this.$textLayer.$setFontMetrics(this.$fontMetrics);
          this.$textLayer.on("changeCharacterSize", function(e2) {
            _self.updateCharacterSize();
            _self.onResize(true, _self.gutterWidth, _self.$size.width, _self.$size.height);
            _self._signal("changeCharacterSize", e2);
          });
          this.$size = {
            width: 0,
            height: 0,
            scrollerHeight: 0,
            scrollerWidth: 0,
            $dirty: true
          };
          this.layerConfig = {
            width: 1,
            padding: 0,
            firstRow: 0,
            firstRowScreen: 0,
            lastRow: 0,
            lineHeight: 0,
            characterWidth: 0,
            minHeight: 1,
            maxHeight: 1,
            offset: 0,
            height: 1,
            gutterOffset: 1
          };
          this.scrollMargin = {
            left: 0,
            right: 0,
            top: 0,
            bottom: 0,
            v: 0,
            h: 0
          };
          this.margin = {
            left: 0,
            right: 0,
            top: 0,
            bottom: 0,
            v: 0,
            h: 0
          };
          this.$keepTextAreaAtCursor = !useragent.isIOS;
          this.$loop = new RenderLoop(this.$renderChanges.bind(this), this.container.ownerDocument.defaultView);
          this.$loop.schedule(this.CHANGE_FULL);
          this.updateCharacterSize();
          this.setPadding(4);
          this.$addResizeObserver();
          config2.resetOptions(this);
          config2._signal("renderer", this);
        }
        VirtualRenderer2.prototype.updateCharacterSize = function() {
          if (this.$textLayer.allowBoldFonts != this.$allowBoldFonts) {
            this.$allowBoldFonts = this.$textLayer.allowBoldFonts;
            this.setStyle("ace_nobold", !this.$allowBoldFonts);
          }
          this.layerConfig.characterWidth = this.characterWidth = this.$textLayer.getCharacterWidth();
          this.layerConfig.lineHeight = this.lineHeight = this.$textLayer.getLineHeight();
          this.$updatePrintMargin();
          dom.setStyle(this.scroller.style, "line-height", this.lineHeight + "px");
        };
        VirtualRenderer2.prototype.setSession = function(session) {
          if (this.session)
            this.session.doc.off("changeNewLineMode", this.onChangeNewLineMode);
          this.session = session;
          if (session && this.scrollMargin.top && session.getScrollTop() <= 0)
            session.setScrollTop(-this.scrollMargin.top);
          this.$cursorLayer.setSession(session);
          this.$markerBack.setSession(session);
          this.$markerFront.setSession(session);
          this.$gutterLayer.setSession(session);
          this.$textLayer.setSession(session);
          if (!session)
            return;
          this.$loop.schedule(this.CHANGE_FULL);
          this.session.$setFontMetrics(this.$fontMetrics);
          this.scrollBarH.scrollLeft = this.scrollBarV.scrollTop = null;
          this.onChangeNewLineMode = this.onChangeNewLineMode.bind(this);
          this.onChangeNewLineMode();
          this.session.doc.on("changeNewLineMode", this.onChangeNewLineMode);
        };
        VirtualRenderer2.prototype.updateLines = function(firstRow, lastRow, force) {
          if (lastRow === void 0)
            lastRow = Infinity;
          if (!this.$changedLines) {
            this.$changedLines = {
              firstRow,
              lastRow
            };
          } else {
            if (this.$changedLines.firstRow > firstRow)
              this.$changedLines.firstRow = firstRow;
            if (this.$changedLines.lastRow < lastRow)
              this.$changedLines.lastRow = lastRow;
          }
          if (this.$changedLines.lastRow < this.layerConfig.firstRow) {
            if (force)
              this.$changedLines.lastRow = this.layerConfig.lastRow;
            else
              return;
          }
          if (this.$changedLines.firstRow > this.layerConfig.lastRow)
            return;
          this.$loop.schedule(this.CHANGE_LINES);
        };
        VirtualRenderer2.prototype.onChangeNewLineMode = function() {
          this.$loop.schedule(this.CHANGE_TEXT);
          this.$textLayer.$updateEolChar();
          this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR);
        };
        VirtualRenderer2.prototype.onChangeTabSize = function() {
          this.$loop.schedule(this.CHANGE_TEXT | this.CHANGE_MARKER);
          this.$textLayer.onChangeTabSize();
        };
        VirtualRenderer2.prototype.updateText = function() {
          this.$loop.schedule(this.CHANGE_TEXT);
        };
        VirtualRenderer2.prototype.updateFull = function(force) {
          if (force)
            this.$renderChanges(this.CHANGE_FULL, true);
          else
            this.$loop.schedule(this.CHANGE_FULL);
        };
        VirtualRenderer2.prototype.updateFontSize = function() {
          this.$textLayer.checkForSizeChanges();
        };
        VirtualRenderer2.prototype.$updateSizeAsync = function() {
          if (this.$loop.pending)
            this.$size.$dirty = true;
          else
            this.onResize();
        };
        VirtualRenderer2.prototype.onResize = function(force, gutterWidth, width, height) {
          if (this.resizing > 2)
            return;
          else if (this.resizing > 0)
            this.resizing++;
          else
            this.resizing = force ? 1 : 0;
          var el2 = this.container;
          if (!height)
            height = el2.clientHeight || el2.scrollHeight;
          if (!height && this.$maxLines && this.lineHeight > 1) {
            if (!el2.style.height || el2.style.height == "0px") {
              el2.style.height = "1px";
              height = el2.clientHeight || el2.scrollHeight;
            }
          }
          if (!width)
            width = el2.clientWidth || el2.scrollWidth;
          var changes = this.$updateCachedSize(force, gutterWidth, width, height);
          if (this.$resizeTimer)
            this.$resizeTimer.cancel();
          if (!this.$size.scrollerHeight || !width && !height)
            return this.resizing = 0;
          if (force)
            this.$gutterLayer.$padding = null;
          if (force)
            this.$renderChanges(changes | this.$changes, true);
          else
            this.$loop.schedule(changes | this.$changes);
          if (this.resizing)
            this.resizing = 0;
          this.scrollBarH.scrollLeft = this.scrollBarV.scrollTop = null;
          if (this.$customScrollbar) {
            this.$updateCustomScrollbar(true);
          }
        };
        VirtualRenderer2.prototype.$updateCachedSize = function(force, gutterWidth, width, height) {
          height -= this.$extraHeight || 0;
          var changes = 0;
          var size2 = this.$size;
          var oldSize = {
            width: size2.width,
            height: size2.height,
            scrollerHeight: size2.scrollerHeight,
            scrollerWidth: size2.scrollerWidth
          };
          if (height && (force || size2.height != height)) {
            size2.height = height;
            changes |= this.CHANGE_SIZE;
            size2.scrollerHeight = size2.height;
            if (this.$horizScroll)
              size2.scrollerHeight -= this.scrollBarH.getHeight();
            this.scrollBarV.setHeight(size2.scrollerHeight);
            this.scrollBarV.element.style.bottom = this.scrollBarH.getHeight() + "px";
            changes = changes | this.CHANGE_SCROLL;
          }
          if (width && (force || size2.width != width)) {
            changes |= this.CHANGE_SIZE;
            size2.width = width;
            if (gutterWidth == null)
              gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0;
            this.gutterWidth = gutterWidth;
            dom.setStyle(this.scrollBarH.element.style, "left", gutterWidth + "px");
            dom.setStyle(this.scroller.style, "left", gutterWidth + this.margin.left + "px");
            size2.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBarV.getWidth() - this.margin.h);
            dom.setStyle(this.$gutter.style, "left", this.margin.left + "px");
            var right = this.scrollBarV.getWidth() + "px";
            dom.setStyle(this.scrollBarH.element.style, "right", right);
            dom.setStyle(this.scroller.style, "right", right);
            dom.setStyle(this.scroller.style, "bottom", this.scrollBarH.getHeight());
            this.scrollBarH.setWidth(size2.scrollerWidth);
            if (this.session && this.session.getUseWrapMode() && this.adjustWrapLimit() || force) {
              changes |= this.CHANGE_FULL;
            }
          }
          size2.$dirty = !width || !height;
          if (changes)
            this._signal("resize", oldSize);
          return changes;
        };
        VirtualRenderer2.prototype.onGutterResize = function(width) {
          var gutterWidth = this.$showGutter ? width : 0;
          if (gutterWidth != this.gutterWidth)
            this.$changes |= this.$updateCachedSize(true, gutterWidth, this.$size.width, this.$size.height);
          if (this.session.getUseWrapMode() && this.adjustWrapLimit()) {
            this.$loop.schedule(this.CHANGE_FULL);
          } else if (this.$size.$dirty) {
            this.$loop.schedule(this.CHANGE_FULL);
          } else {
            this.$computeLayerConfig();
          }
        };
        VirtualRenderer2.prototype.adjustWrapLimit = function() {
          var availableWidth = this.$size.scrollerWidth - this.$padding * 2;
          var limit2 = Math.floor(availableWidth / this.characterWidth);
          return this.session.adjustWrapLimit(limit2, this.$showPrintMargin && this.$printMarginColumn);
        };
        VirtualRenderer2.prototype.setAnimatedScroll = function(shouldAnimate) {
          this.setOption("animatedScroll", shouldAnimate);
        };
        VirtualRenderer2.prototype.getAnimatedScroll = function() {
          return this.$animatedScroll;
        };
        VirtualRenderer2.prototype.setShowInvisibles = function(showInvisibles) {
          this.setOption("showInvisibles", showInvisibles);
          this.session.$bidiHandler.setShowInvisibles(showInvisibles);
        };
        VirtualRenderer2.prototype.getShowInvisibles = function() {
          return this.getOption("showInvisibles");
        };
        VirtualRenderer2.prototype.getDisplayIndentGuides = function() {
          return this.getOption("displayIndentGuides");
        };
        VirtualRenderer2.prototype.setDisplayIndentGuides = function(display) {
          this.setOption("displayIndentGuides", display);
        };
        VirtualRenderer2.prototype.getHighlightIndentGuides = function() {
          return this.getOption("highlightIndentGuides");
        };
        VirtualRenderer2.prototype.setHighlightIndentGuides = function(highlight) {
          this.setOption("highlightIndentGuides", highlight);
        };
        VirtualRenderer2.prototype.setShowPrintMargin = function(showPrintMargin) {
          this.setOption("showPrintMargin", showPrintMargin);
        };
        VirtualRenderer2.prototype.getShowPrintMargin = function() {
          return this.getOption("showPrintMargin");
        };
        VirtualRenderer2.prototype.setPrintMarginColumn = function(printMarginColumn) {
          this.setOption("printMarginColumn", printMarginColumn);
        };
        VirtualRenderer2.prototype.getPrintMarginColumn = function() {
          return this.getOption("printMarginColumn");
        };
        VirtualRenderer2.prototype.getShowGutter = function() {
          return this.getOption("showGutter");
        };
        VirtualRenderer2.prototype.setShowGutter = function(show) {
          return this.setOption("showGutter", show);
        };
        VirtualRenderer2.prototype.getFadeFoldWidgets = function() {
          return this.getOption("fadeFoldWidgets");
        };
        VirtualRenderer2.prototype.setFadeFoldWidgets = function(show) {
          this.setOption("fadeFoldWidgets", show);
        };
        VirtualRenderer2.prototype.setHighlightGutterLine = function(shouldHighlight) {
          this.setOption("highlightGutterLine", shouldHighlight);
        };
        VirtualRenderer2.prototype.getHighlightGutterLine = function() {
          return this.getOption("highlightGutterLine");
        };
        VirtualRenderer2.prototype.$updatePrintMargin = function() {
          if (!this.$showPrintMargin && !this.$printMarginEl)
            return;
          if (!this.$printMarginEl) {
            var containerEl = dom.createElement("div");
            containerEl.className = "ace_layer ace_print-margin-layer";
            this.$printMarginEl = dom.createElement("div");
            this.$printMarginEl.className = "ace_print-margin";
            containerEl.appendChild(this.$printMarginEl);
            this.content.insertBefore(containerEl, this.content.firstChild);
          }
          var style2 = this.$printMarginEl.style;
          style2.left = Math.round(this.characterWidth * this.$printMarginColumn + this.$padding) + "px";
          style2.visibility = this.$showPrintMargin ? "visible" : "hidden";
          if (this.session && this.session.$wrap == -1)
            this.adjustWrapLimit();
        };
        VirtualRenderer2.prototype.getContainerElement = function() {
          return this.container;
        };
        VirtualRenderer2.prototype.getMouseEventTarget = function() {
          return this.scroller;
        };
        VirtualRenderer2.prototype.getTextAreaContainer = function() {
          return this.container;
        };
        VirtualRenderer2.prototype.$moveTextAreaToCursor = function() {
          if (this.$isMousePressed)
            return;
          var style2 = this.textarea.style;
          var composition = this.$composition;
          if (!this.$keepTextAreaAtCursor && !composition) {
            dom.translate(this.textarea, -100, 0);
            return;
          }
          var pixelPos = this.$cursorLayer.$pixelPos;
          if (!pixelPos)
            return;
          if (composition && composition.markerRange)
            pixelPos = this.$cursorLayer.getPixelPosition(composition.markerRange.start, true);
          var config3 = this.layerConfig;
          var posTop = pixelPos.top;
          var posLeft = pixelPos.left;
          posTop -= config3.offset;
          var h3 = composition && composition.useTextareaForIME || useragent.isMobile ? this.lineHeight : 1;
          if (posTop < 0 || posTop > config3.height - h3) {
            dom.translate(this.textarea, 0, 0);
            return;
          }
          var w2 = 1;
          var maxTop = this.$size.height - h3;
          if (!composition) {
            posTop += this.lineHeight;
          } else {
            if (composition.useTextareaForIME) {
              var val = this.textarea.value;
              w2 = this.characterWidth * this.session.$getStringScreenWidth(val)[0];
            } else {
              posTop += this.lineHeight + 2;
            }
          }
          posLeft -= this.scrollLeft;
          if (posLeft > this.$size.scrollerWidth - w2)
            posLeft = this.$size.scrollerWidth - w2;
          posLeft += this.gutterWidth + this.margin.left;
          dom.setStyle(style2, "height", h3 + "px");
          dom.setStyle(style2, "width", w2 + "px");
          dom.translate(this.textarea, Math.min(posLeft, this.$size.scrollerWidth - w2), Math.min(posTop, maxTop));
        };
        VirtualRenderer2.prototype.getFirstVisibleRow = function() {
          return this.layerConfig.firstRow;
        };
        VirtualRenderer2.prototype.getFirstFullyVisibleRow = function() {
          return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1);
        };
        VirtualRenderer2.prototype.getLastFullyVisibleRow = function() {
          var config3 = this.layerConfig;
          var lastRow = config3.lastRow;
          var top2 = this.session.documentToScreenRow(lastRow, 0) * config3.lineHeight;
          if (top2 - this.session.getScrollTop() > config3.height - config3.lineHeight)
            return lastRow - 1;
          return lastRow;
        };
        VirtualRenderer2.prototype.getLastVisibleRow = function() {
          return this.layerConfig.lastRow;
        };
        VirtualRenderer2.prototype.setPadding = function(padding) {
          this.$padding = padding;
          this.$textLayer.setPadding(padding);
          this.$cursorLayer.setPadding(padding);
          this.$markerFront.setPadding(padding);
          this.$markerBack.setPadding(padding);
          this.$loop.schedule(this.CHANGE_FULL);
          this.$updatePrintMargin();
        };
        VirtualRenderer2.prototype.setScrollMargin = function(top2, bottom2, left2, right) {
          var sm = this.scrollMargin;
          sm.top = top2 | 0;
          sm.bottom = bottom2 | 0;
          sm.right = right | 0;
          sm.left = left2 | 0;
          sm.v = sm.top + sm.bottom;
          sm.h = sm.left + sm.right;
          if (sm.top && this.scrollTop <= 0 && this.session)
            this.session.setScrollTop(-sm.top);
          this.updateFull();
        };
        VirtualRenderer2.prototype.setMargin = function(top2, bottom2, left2, right) {
          var sm = this.margin;
          sm.top = top2 | 0;
          sm.bottom = bottom2 | 0;
          sm.right = right | 0;
          sm.left = left2 | 0;
          sm.v = sm.top + sm.bottom;
          sm.h = sm.left + sm.right;
          this.$updateCachedSize(true, this.gutterWidth, this.$size.width, this.$size.height);
          this.updateFull();
        };
        VirtualRenderer2.prototype.getHScrollBarAlwaysVisible = function() {
          return this.$hScrollBarAlwaysVisible;
        };
        VirtualRenderer2.prototype.setHScrollBarAlwaysVisible = function(alwaysVisible) {
          this.setOption("hScrollBarAlwaysVisible", alwaysVisible);
        };
        VirtualRenderer2.prototype.getVScrollBarAlwaysVisible = function() {
          return this.$vScrollBarAlwaysVisible;
        };
        VirtualRenderer2.prototype.setVScrollBarAlwaysVisible = function(alwaysVisible) {
          this.setOption("vScrollBarAlwaysVisible", alwaysVisible);
        };
        VirtualRenderer2.prototype.$updateScrollBarV = function() {
          var scrollHeight = this.layerConfig.maxHeight;
          var scrollerHeight = this.$size.scrollerHeight;
          if (!this.$maxLines && this.$scrollPastEnd) {
            scrollHeight -= (scrollerHeight - this.lineHeight) * this.$scrollPastEnd;
            if (this.scrollTop > scrollHeight - scrollerHeight) {
              scrollHeight = this.scrollTop + scrollerHeight;
              this.scrollBarV.scrollTop = null;
            }
          }
          this.scrollBarV.setScrollHeight(scrollHeight + this.scrollMargin.v);
          this.scrollBarV.setScrollTop(this.scrollTop + this.scrollMargin.top);
        };
        VirtualRenderer2.prototype.$updateScrollBarH = function() {
          this.scrollBarH.setScrollWidth(this.layerConfig.width + 2 * this.$padding + this.scrollMargin.h);
          this.scrollBarH.setScrollLeft(this.scrollLeft + this.scrollMargin.left);
        };
        VirtualRenderer2.prototype.freeze = function() {
          this.$frozen = true;
        };
        VirtualRenderer2.prototype.unfreeze = function() {
          this.$frozen = false;
        };
        VirtualRenderer2.prototype.$renderChanges = function(changes, force) {
          if (this.$changes) {
            changes |= this.$changes;
            this.$changes = 0;
          }
          if (!this.session || !this.container.offsetWidth || this.$frozen || !changes && !force) {
            this.$changes |= changes;
            return;
          }
          if (this.$size.$dirty) {
            this.$changes |= changes;
            return this.onResize(true);
          }
          if (!this.lineHeight) {
            this.$textLayer.checkForSizeChanges();
          }
          this._signal("beforeRender", changes);
          if (this.session && this.session.$bidiHandler)
            this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);
          var config3 = this.layerConfig;
          if (changes & this.CHANGE_FULL || changes & this.CHANGE_SIZE || changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES || changes & this.CHANGE_SCROLL || changes & this.CHANGE_H_SCROLL) {
            changes |= this.$computeLayerConfig() | this.$loop.clear();
            if (config3.firstRow != this.layerConfig.firstRow && config3.firstRowScreen == this.layerConfig.firstRowScreen) {
              var st = this.scrollTop + (config3.firstRow - Math.max(this.layerConfig.firstRow, 0)) * this.lineHeight;
              if (st > 0) {
                this.scrollTop = st;
                changes = changes | this.CHANGE_SCROLL;
                changes |= this.$computeLayerConfig() | this.$loop.clear();
              }
            }
            config3 = this.layerConfig;
            this.$updateScrollBarV();
            if (changes & this.CHANGE_H_SCROLL)
              this.$updateScrollBarH();
            dom.translate(this.content, -this.scrollLeft, -config3.offset);
            var width = config3.width + 2 * this.$padding + "px";
            var height = config3.minHeight + "px";
            dom.setStyle(this.content.style, "width", width);
            dom.setStyle(this.content.style, "height", height);
          }
          if (changes & this.CHANGE_H_SCROLL) {
            dom.translate(this.content, -this.scrollLeft, -config3.offset);
            this.scroller.className = this.scrollLeft <= 0 ? "ace_scroller " : "ace_scroller ace_scroll-left ";
            if (this.enableKeyboardAccessibility)
              this.scroller.className += this.keyboardFocusClassName;
          }
          if (changes & this.CHANGE_FULL) {
            this.$changedLines = null;
            this.$textLayer.update(config3);
            if (this.$showGutter)
              this.$gutterLayer.update(config3);
            if (this.$customScrollbar) {
              this.$scrollDecorator.$updateDecorators(config3);
            }
            this.$markerBack.update(config3);
            this.$markerFront.update(config3);
            this.$cursorLayer.update(config3);
            this.$moveTextAreaToCursor();
            this._signal("afterRender", changes);
            return;
          }
          if (changes & this.CHANGE_SCROLL) {
            this.$changedLines = null;
            if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES)
              this.$textLayer.update(config3);
            else
              this.$textLayer.scrollLines(config3);
            if (this.$showGutter) {
              if (changes & this.CHANGE_GUTTER || changes & this.CHANGE_LINES)
                this.$gutterLayer.update(config3);
              else
                this.$gutterLayer.scrollLines(config3);
            }
            if (this.$customScrollbar) {
              this.$scrollDecorator.$updateDecorators(config3);
            }
            this.$markerBack.update(config3);
            this.$markerFront.update(config3);
            this.$cursorLayer.update(config3);
            this.$moveTextAreaToCursor();
            this._signal("afterRender", changes);
            return;
          }
          if (changes & this.CHANGE_TEXT) {
            this.$changedLines = null;
            this.$textLayer.update(config3);
            if (this.$showGutter)
              this.$gutterLayer.update(config3);
            if (this.$customScrollbar) {
              this.$scrollDecorator.$updateDecorators(config3);
            }
          } else if (changes & this.CHANGE_LINES) {
            if (this.$updateLines() || changes & this.CHANGE_GUTTER && this.$showGutter)
              this.$gutterLayer.update(config3);
            if (this.$customScrollbar) {
              this.$scrollDecorator.$updateDecorators(config3);
            }
          } else if (changes & this.CHANGE_TEXT || changes & this.CHANGE_GUTTER) {
            if (this.$showGutter)
              this.$gutterLayer.update(config3);
            if (this.$customScrollbar) {
              this.$scrollDecorator.$updateDecorators(config3);
            }
          } else if (changes & this.CHANGE_CURSOR) {
            if (this.$highlightGutterLine)
              this.$gutterLayer.updateLineHighlight(config3);
            if (this.$customScrollbar) {
              this.$scrollDecorator.$updateDecorators(config3);
            }
          }
          if (changes & this.CHANGE_CURSOR) {
            this.$cursorLayer.update(config3);
            this.$moveTextAreaToCursor();
          }
          if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) {
            this.$markerFront.update(config3);
          }
          if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_BACK)) {
            this.$markerBack.update(config3);
          }
          this._signal("afterRender", changes);
        };
        VirtualRenderer2.prototype.$autosize = function() {
          var height = this.session.getScreenLength() * this.lineHeight;
          var maxHeight = this.$maxLines * this.lineHeight;
          var desiredHeight = Math.min(maxHeight, Math.max((this.$minLines || 1) * this.lineHeight, height)) + this.scrollMargin.v + (this.$extraHeight || 0);
          if (this.$horizScroll)
            desiredHeight += this.scrollBarH.getHeight();
          if (this.$maxPixelHeight && desiredHeight > this.$maxPixelHeight)
            desiredHeight = this.$maxPixelHeight;
          var hideScrollbars = desiredHeight <= 2 * this.lineHeight;
          var vScroll = !hideScrollbars && height > maxHeight;
          if (desiredHeight != this.desiredHeight || this.$size.height != this.desiredHeight || vScroll != this.$vScroll) {
            if (vScroll != this.$vScroll) {
              this.$vScroll = vScroll;
              this.scrollBarV.setVisible(vScroll);
            }
            var w2 = this.container.clientWidth;
            this.container.style.height = desiredHeight + "px";
            this.$updateCachedSize(true, this.$gutterWidth, w2, desiredHeight);
            this.desiredHeight = desiredHeight;
            this._signal("autosize");
          }
        };
        VirtualRenderer2.prototype.$computeLayerConfig = function() {
          var session = this.session;
          var size2 = this.$size;
          var hideScrollbars = size2.height <= 2 * this.lineHeight;
          var screenLines = this.session.getScreenLength();
          var maxHeight = screenLines * this.lineHeight;
          var longestLine = this.$getLongestLine();
          var horizScroll = !hideScrollbars && (this.$hScrollBarAlwaysVisible || size2.scrollerWidth - longestLine - 2 * this.$padding < 0);
          var hScrollChanged = this.$horizScroll !== horizScroll;
          if (hScrollChanged) {
            this.$horizScroll = horizScroll;
            this.scrollBarH.setVisible(horizScroll);
          }
          var vScrollBefore = this.$vScroll;
          if (this.$maxLines && this.lineHeight > 1) {
            this.$autosize();
            hideScrollbars = size2.height <= 2 * this.lineHeight;
          }
          var minHeight = size2.scrollerHeight + this.lineHeight;
          var scrollPastEnd = !this.$maxLines && this.$scrollPastEnd ? (size2.scrollerHeight - this.lineHeight) * this.$scrollPastEnd : 0;
          maxHeight += scrollPastEnd;
          var sm = this.scrollMargin;
          this.session.setScrollTop(Math.max(-sm.top, Math.min(this.scrollTop, maxHeight - size2.scrollerHeight + sm.bottom)));
          this.session.setScrollLeft(Math.max(-sm.left, Math.min(this.scrollLeft, longestLine + 2 * this.$padding - size2.scrollerWidth + sm.right)));
          var vScroll = !hideScrollbars && (this.$vScrollBarAlwaysVisible || size2.scrollerHeight - maxHeight + scrollPastEnd < 0 || this.scrollTop > sm.top);
          var vScrollChanged = vScrollBefore !== vScroll;
          if (vScrollChanged) {
            this.$vScroll = vScroll;
            this.scrollBarV.setVisible(vScroll);
          }
          var offset2 = this.scrollTop % this.lineHeight;
          var lineCount = Math.ceil(minHeight / this.lineHeight) - 1;
          var firstRow = Math.max(0, Math.round((this.scrollTop - offset2) / this.lineHeight));
          var lastRow = firstRow + lineCount;
          var firstRowScreen, firstRowHeight;
          var lineHeight2 = this.lineHeight;
          firstRow = session.screenToDocumentRow(firstRow, 0);
          var foldLine = session.getFoldLine(firstRow);
          if (foldLine) {
            firstRow = foldLine.start.row;
          }
          firstRowScreen = session.documentToScreenRow(firstRow, 0);
          firstRowHeight = session.getRowLength(firstRow) * lineHeight2;
          lastRow = Math.min(session.screenToDocumentRow(lastRow, 0), session.getLength() - 1);
          minHeight = size2.scrollerHeight + session.getRowLength(lastRow) * lineHeight2 + firstRowHeight;
          offset2 = this.scrollTop - firstRowScreen * lineHeight2;
          if (offset2 < 0 && firstRowScreen > 0) {
            firstRowScreen = Math.max(0, firstRowScreen + Math.floor(offset2 / lineHeight2));
            offset2 = this.scrollTop - firstRowScreen * lineHeight2;
          }
          var changes = 0;
          if (this.layerConfig.width != longestLine || hScrollChanged)
            changes = this.CHANGE_H_SCROLL;
          if (hScrollChanged || vScrollChanged) {
            changes |= this.$updateCachedSize(true, this.gutterWidth, size2.width, size2.height);
            this._signal("scrollbarVisibilityChanged");
            if (vScrollChanged)
              longestLine = this.$getLongestLine();
          }
          this.layerConfig = {
            width: longestLine,
            padding: this.$padding,
            firstRow,
            firstRowScreen,
            lastRow,
            lineHeight: lineHeight2,
            characterWidth: this.characterWidth,
            minHeight,
            maxHeight,
            offset: offset2,
            gutterOffset: lineHeight2 ? Math.max(0, Math.ceil((offset2 + size2.height - size2.scrollerHeight) / lineHeight2)) : 0,
            height: this.$size.scrollerHeight
          };
          if (this.session.$bidiHandler)
            this.session.$bidiHandler.setContentWidth(longestLine - this.$padding);
          return changes;
        };
        VirtualRenderer2.prototype.$updateLines = function() {
          if (!this.$changedLines)
            return;
          var firstRow = this.$changedLines.firstRow;
          var lastRow = this.$changedLines.lastRow;
          this.$changedLines = null;
          var layerConfig = this.layerConfig;
          if (firstRow > layerConfig.lastRow + 1) {
            return;
          }
          if (lastRow < layerConfig.firstRow) {
            return;
          }
          if (lastRow === Infinity) {
            if (this.$showGutter)
              this.$gutterLayer.update(layerConfig);
            this.$textLayer.update(layerConfig);
            return;
          }
          this.$textLayer.updateLines(layerConfig, firstRow, lastRow);
          return true;
        };
        VirtualRenderer2.prototype.$getLongestLine = function() {
          var charCount = this.session.getScreenWidth();
          if (this.showInvisibles && !this.session.$useWrapMode)
            charCount += 1;
          if (this.$textLayer && charCount > this.$textLayer.MAX_LINE_LENGTH)
            charCount = this.$textLayer.MAX_LINE_LENGTH + 30;
          return Math.max(this.$size.scrollerWidth - 2 * this.$padding, Math.round(charCount * this.characterWidth));
        };
        VirtualRenderer2.prototype.updateFrontMarkers = function() {
          this.$markerFront.setMarkers(this.session.getMarkers(true));
          this.$loop.schedule(this.CHANGE_MARKER_FRONT);
        };
        VirtualRenderer2.prototype.updateBackMarkers = function() {
          this.$markerBack.setMarkers(this.session.getMarkers());
          this.$loop.schedule(this.CHANGE_MARKER_BACK);
        };
        VirtualRenderer2.prototype.addGutterDecoration = function(row, className) {
          this.$gutterLayer.addGutterDecoration(row, className);
        };
        VirtualRenderer2.prototype.removeGutterDecoration = function(row, className) {
          this.$gutterLayer.removeGutterDecoration(row, className);
        };
        VirtualRenderer2.prototype.updateBreakpoints = function(rows) {
          this._rows = rows;
          this.$loop.schedule(this.CHANGE_GUTTER);
        };
        VirtualRenderer2.prototype.setAnnotations = function(annotations) {
          this.$gutterLayer.setAnnotations(annotations);
          this.$loop.schedule(this.CHANGE_GUTTER);
        };
        VirtualRenderer2.prototype.updateCursor = function() {
          this.$loop.schedule(this.CHANGE_CURSOR);
        };
        VirtualRenderer2.prototype.hideCursor = function() {
          this.$cursorLayer.hideCursor();
        };
        VirtualRenderer2.prototype.showCursor = function() {
          this.$cursorLayer.showCursor();
        };
        VirtualRenderer2.prototype.scrollSelectionIntoView = function(anchor, lead, offset2) {
          this.scrollCursorIntoView(anchor, offset2);
          this.scrollCursorIntoView(lead, offset2);
        };
        VirtualRenderer2.prototype.scrollCursorIntoView = function(cursor, offset2, $viewMargin) {
          if (this.$size.scrollerHeight === 0)
            return;
          var pos = this.$cursorLayer.getPixelPosition(cursor);
          var newLeft = pos.left;
          var newTop = pos.top;
          var topMargin = $viewMargin && $viewMargin.top || 0;
          var bottomMargin = $viewMargin && $viewMargin.bottom || 0;
          if (this.$scrollAnimation) {
            this.$stopAnimation = true;
          }
          var currentTop = this.$scrollAnimation ? this.session.getScrollTop() : this.scrollTop;
          if (currentTop + topMargin > newTop) {
            if (offset2 && currentTop + topMargin > newTop + this.lineHeight)
              newTop -= offset2 * this.$size.scrollerHeight;
            if (newTop === 0)
              newTop = -this.scrollMargin.top;
            this.session.setScrollTop(newTop);
          } else if (currentTop + this.$size.scrollerHeight - bottomMargin < newTop + this.lineHeight) {
            if (offset2 && currentTop + this.$size.scrollerHeight - bottomMargin < newTop - this.lineHeight)
              newTop += offset2 * this.$size.scrollerHeight;
            this.session.setScrollTop(newTop + this.lineHeight + bottomMargin - this.$size.scrollerHeight);
          }
          var currentLeft = this.scrollLeft;
          var twoCharsWidth = 2 * this.layerConfig.characterWidth;
          if (newLeft - twoCharsWidth < currentLeft) {
            newLeft -= twoCharsWidth;
            if (newLeft < this.$padding + twoCharsWidth) {
              newLeft = -this.scrollMargin.left;
            }
            this.session.setScrollLeft(newLeft);
          } else {
            newLeft += twoCharsWidth;
            if (currentLeft + this.$size.scrollerWidth < newLeft + this.characterWidth) {
              this.session.setScrollLeft(Math.round(newLeft + this.characterWidth - this.$size.scrollerWidth));
            } else if (currentLeft <= this.$padding && newLeft - currentLeft < this.characterWidth) {
              this.session.setScrollLeft(0);
            }
          }
        };
        VirtualRenderer2.prototype.getScrollTop = function() {
          return this.session.getScrollTop();
        };
        VirtualRenderer2.prototype.getScrollLeft = function() {
          return this.session.getScrollLeft();
        };
        VirtualRenderer2.prototype.getScrollTopRow = function() {
          return this.scrollTop / this.lineHeight;
        };
        VirtualRenderer2.prototype.getScrollBottomRow = function() {
          return Math.max(0, Math.floor((this.scrollTop + this.$size.scrollerHeight) / this.lineHeight) - 1);
        };
        VirtualRenderer2.prototype.scrollToRow = function(row) {
          this.session.setScrollTop(row * this.lineHeight);
        };
        VirtualRenderer2.prototype.alignCursor = function(cursor, alignment) {
          if (typeof cursor == "number")
            cursor = { row: cursor, column: 0 };
          var pos = this.$cursorLayer.getPixelPosition(cursor);
          var h3 = this.$size.scrollerHeight - this.lineHeight;
          var offset2 = pos.top - h3 * (alignment || 0);
          this.session.setScrollTop(offset2);
          return offset2;
        };
        VirtualRenderer2.prototype.$calcSteps = function(fromValue, toValue2) {
          var i2 = 0;
          var l2 = this.STEPS;
          var steps = [];
          var func = function(t2, x_min, dx) {
            return dx * (Math.pow(t2 - 1, 3) + 1) + x_min;
          };
          for (i2 = 0; i2 < l2; ++i2)
            steps.push(func(i2 / this.STEPS, fromValue, toValue2 - fromValue));
          return steps;
        };
        VirtualRenderer2.prototype.scrollToLine = function(line2, center, animate, callback2) {
          var pos = this.$cursorLayer.getPixelPosition({ row: line2, column: 0 });
          var offset2 = pos.top;
          if (center)
            offset2 -= this.$size.scrollerHeight / 2;
          var initialScroll = this.scrollTop;
          this.session.setScrollTop(offset2);
          if (animate !== false)
            this.animateScrolling(initialScroll, callback2);
        };
        VirtualRenderer2.prototype.animateScrolling = function(fromValue, callback2) {
          var toValue2 = this.scrollTop;
          if (!this.$animatedScroll)
            return;
          var _self = this;
          if (fromValue == toValue2)
            return;
          if (this.$scrollAnimation) {
            var oldSteps = this.$scrollAnimation.steps;
            if (oldSteps.length) {
              fromValue = oldSteps[0];
              if (fromValue == toValue2)
                return;
            }
          }
          var steps = _self.$calcSteps(fromValue, toValue2);
          this.$scrollAnimation = { from: fromValue, to: toValue2, steps };
          clearInterval(this.$timer);
          _self.session.setScrollTop(steps.shift());
          _self.session.$scrollTop = toValue2;
          function endAnimation() {
            _self.$timer = clearInterval(_self.$timer);
            _self.$scrollAnimation = null;
            _self.$stopAnimation = false;
            callback2 && callback2();
          }
          this.$timer = setInterval(function() {
            if (_self.$stopAnimation) {
              endAnimation();
              return;
            }
            if (!_self.session)
              return clearInterval(_self.$timer);
            if (steps.length) {
              _self.session.setScrollTop(steps.shift());
              _self.session.$scrollTop = toValue2;
            } else if (toValue2 != null) {
              _self.session.$scrollTop = -1;
              _self.session.setScrollTop(toValue2);
              toValue2 = null;
            } else {
              endAnimation();
            }
          }, 10);
        };
        VirtualRenderer2.prototype.scrollToY = function(scrollTop) {
          if (this.scrollTop !== scrollTop) {
            this.$loop.schedule(this.CHANGE_SCROLL);
            this.scrollTop = scrollTop;
          }
        };
        VirtualRenderer2.prototype.scrollToX = function(scrollLeft) {
          if (this.scrollLeft !== scrollLeft)
            this.scrollLeft = scrollLeft;
          this.$loop.schedule(this.CHANGE_H_SCROLL);
        };
        VirtualRenderer2.prototype.scrollTo = function(x2, y2) {
          this.session.setScrollTop(y2);
          this.session.setScrollLeft(x2);
        };
        VirtualRenderer2.prototype.scrollBy = function(deltaX, deltaY) {
          deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY);
          deltaX && this.session.setScrollLeft(this.session.getScrollLeft() + deltaX);
        };
        VirtualRenderer2.prototype.isScrollableBy = function(deltaX, deltaY) {
          if (deltaY < 0 && this.session.getScrollTop() >= 1 - this.scrollMargin.top)
            return true;
          if (deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight - this.layerConfig.maxHeight < -1 + this.scrollMargin.bottom)
            return true;
          if (deltaX < 0 && this.session.getScrollLeft() >= 1 - this.scrollMargin.left)
            return true;
          if (deltaX > 0 && this.session.getScrollLeft() + this.$size.scrollerWidth - this.layerConfig.width < -1 + this.scrollMargin.right)
            return true;
        };
        VirtualRenderer2.prototype.pixelToScreenCoordinates = function(x2, y2) {
          var canvasPos;
          if (this.$hasCssTransforms) {
            canvasPos = { top: 0, left: 0 };
            var p2 = this.$fontMetrics.transformCoordinates([x2, y2]);
            x2 = p2[1] - this.gutterWidth - this.margin.left;
            y2 = p2[0];
          } else {
            canvasPos = this.scroller.getBoundingClientRect();
          }
          var offsetX = x2 + this.scrollLeft - canvasPos.left - this.$padding;
          var offset2 = offsetX / this.characterWidth;
          var row = Math.floor((y2 + this.scrollTop - canvasPos.top) / this.lineHeight);
          var col = this.$blockCursor ? Math.floor(offset2) : Math.round(offset2);
          return { row, column: col, side: offset2 - col > 0 ? 1 : -1, offsetX };
        };
        VirtualRenderer2.prototype.screenToTextCoordinates = function(x2, y2) {
          var canvasPos;
          if (this.$hasCssTransforms) {
            canvasPos = { top: 0, left: 0 };
            var p2 = this.$fontMetrics.transformCoordinates([x2, y2]);
            x2 = p2[1] - this.gutterWidth - this.margin.left;
            y2 = p2[0];
          } else {
            canvasPos = this.scroller.getBoundingClientRect();
          }
          var offsetX = x2 + this.scrollLeft - canvasPos.left - this.$padding;
          var offset2 = offsetX / this.characterWidth;
          var col = this.$blockCursor ? Math.floor(offset2) : Math.round(offset2);
          var row = Math.floor((y2 + this.scrollTop - canvasPos.top) / this.lineHeight);
          return this.session.screenToDocumentPosition(row, Math.max(col, 0), offsetX);
        };
        VirtualRenderer2.prototype.textToScreenCoordinates = function(row, column2) {
          var canvasPos = this.scroller.getBoundingClientRect();
          var pos = this.session.documentToScreenPosition(row, column2);
          var x2 = this.$padding + (this.session.$bidiHandler.isBidiRow(pos.row, row) ? this.session.$bidiHandler.getPosLeft(pos.column) : Math.round(pos.column * this.characterWidth));
          var y2 = pos.row * this.lineHeight;
          return {
            pageX: canvasPos.left + x2 - this.scrollLeft,
            pageY: canvasPos.top + y2 - this.scrollTop
          };
        };
        VirtualRenderer2.prototype.visualizeFocus = function() {
          dom.addCssClass(this.container, "ace_focus");
        };
        VirtualRenderer2.prototype.visualizeBlur = function() {
          dom.removeCssClass(this.container, "ace_focus");
        };
        VirtualRenderer2.prototype.showComposition = function(composition) {
          this.$composition = composition;
          if (!composition.cssText) {
            composition.cssText = this.textarea.style.cssText;
          }
          if (composition.useTextareaForIME == void 0)
            composition.useTextareaForIME = this.$useTextareaForIME;
          if (this.$useTextareaForIME) {
            dom.addCssClass(this.textarea, "ace_composition");
            this.textarea.style.cssText = "";
            this.$moveTextAreaToCursor();
            this.$cursorLayer.element.style.display = "none";
          } else {
            composition.markerId = this.session.addMarker(composition.markerRange, "ace_composition_marker", "text");
          }
        };
        VirtualRenderer2.prototype.setCompositionText = function(text2) {
          var cursor = this.session.selection.cursor;
          this.addToken(text2, "composition_placeholder", cursor.row, cursor.column);
          this.$moveTextAreaToCursor();
        };
        VirtualRenderer2.prototype.hideComposition = function() {
          if (!this.$composition)
            return;
          if (this.$composition.markerId)
            this.session.removeMarker(this.$composition.markerId);
          dom.removeCssClass(this.textarea, "ace_composition");
          this.textarea.style.cssText = this.$composition.cssText;
          var cursor = this.session.selection.cursor;
          this.removeExtraToken(cursor.row, cursor.column);
          this.$composition = null;
          this.$cursorLayer.element.style.display = "";
        };
        VirtualRenderer2.prototype.setGhostText = function(text2, position2) {
          var cursor = this.session.selection.cursor;
          var insertPosition = position2 || { row: cursor.row, column: cursor.column };
          this.removeGhostText();
          var textChunks = this.$calculateWrappedTextChunks(text2, insertPosition);
          this.addToken(textChunks[0].text, "ghost_text", insertPosition.row, insertPosition.column);
          this.$ghostText = {
            text: text2,
            position: {
              row: insertPosition.row,
              column: insertPosition.column
            }
          };
          var widgetDiv = dom.createElement("div");
          if (textChunks.length > 1) {
            var hiddenTokens = this.hideTokensAfterPosition(insertPosition.row, insertPosition.column);
            var lastLineDiv;
            textChunks.slice(1).forEach(function(el3) {
              var chunkDiv = dom.createElement("div");
              var chunkSpan = dom.createElement("span");
              chunkSpan.className = "ace_ghost_text";
              if (el3.wrapped)
                chunkDiv.className = "ghost_text_line_wrapped";
              if (el3.text.length === 0)
                el3.text = " ";
              chunkSpan.appendChild(dom.createTextNode(el3.text));
              chunkDiv.appendChild(chunkSpan);
              widgetDiv.appendChild(chunkDiv);
              lastLineDiv = chunkDiv;
            });
            hiddenTokens.forEach(function(token2) {
              var element2 = dom.createElement("span");
              if (!isTextToken(token2.type))
                element2.className = "ace_" + token2.type.replace(/\./g, " ace_");
              element2.appendChild(dom.createTextNode(token2.value));
              lastLineDiv.appendChild(element2);
            });
            this.$ghostTextWidget = {
              el: widgetDiv,
              row: insertPosition.row,
              column: insertPosition.column,
              className: "ace_ghost_text_container"
            };
            this.session.widgetManager.addLineWidget(this.$ghostTextWidget);
            var pixelPosition = this.$cursorLayer.getPixelPosition(insertPosition, true);
            var el2 = this.container;
            var height = el2.getBoundingClientRect().height;
            var ghostTextHeight = textChunks.length * this.lineHeight;
            var fitsY = ghostTextHeight < height - pixelPosition.top;
            if (fitsY)
              return;
            if (ghostTextHeight < height) {
              this.scrollBy(0, (textChunks.length - 1) * this.lineHeight);
            } else {
              this.scrollToRow(insertPosition.row);
            }
          }
        };
        VirtualRenderer2.prototype.$calculateWrappedTextChunks = function(text2, position2) {
          var availableWidth = this.$size.scrollerWidth - this.$padding * 2;
          var limit2 = Math.floor(availableWidth / this.characterWidth) - 2;
          limit2 = limit2 <= 0 ? 60 : limit2;
          var textLines = text2.split(/\r?\n/);
          var textChunks = [];
          for (var i2 = 0; i2 < textLines.length; i2++) {
            var displayTokens = this.session.$getDisplayTokens(textLines[i2], position2.column);
            var wrapSplits = this.session.$computeWrapSplits(displayTokens, limit2, this.session.$tabSize);
            if (wrapSplits.length > 0) {
              var start2 = 0;
              wrapSplits.push(textLines[i2].length);
              for (var j2 = 0; j2 < wrapSplits.length; j2++) {
                var textSlice = textLines[i2].slice(start2, wrapSplits[j2]);
                textChunks.push({ text: textSlice, wrapped: true });
                start2 = wrapSplits[j2];
              }
            } else {
              textChunks.push({ text: textLines[i2], wrapped: false });
            }
          }
          return textChunks;
        };
        VirtualRenderer2.prototype.removeGhostText = function() {
          if (!this.$ghostText)
            return;
          var position2 = this.$ghostText.position;
          this.removeExtraToken(position2.row, position2.column);
          if (this.$ghostTextWidget) {
            this.session.widgetManager.removeLineWidget(this.$ghostTextWidget);
            this.$ghostTextWidget = null;
          }
          this.$ghostText = null;
        };
        VirtualRenderer2.prototype.addToken = function(text2, type4, row, column2) {
          var session = this.session;
          session.bgTokenizer.lines[row] = null;
          var newToken = { type: type4, value: text2 };
          var tokens2 = session.getTokens(row);
          if (column2 == null || !tokens2.length) {
            tokens2.push(newToken);
          } else {
            var l2 = 0;
            for (var i2 = 0; i2 < tokens2.length; i2++) {
              var token2 = tokens2[i2];
              l2 += token2.value.length;
              if (column2 <= l2) {
                var diff2 = token2.value.length - (l2 - column2);
                var before = token2.value.slice(0, diff2);
                var after = token2.value.slice(diff2);
                tokens2.splice(i2, 1, { type: token2.type, value: before }, newToken, { type: token2.type, value: after });
                break;
              }
            }
          }
          this.updateLines(row, row);
        };
        VirtualRenderer2.prototype.hideTokensAfterPosition = function(row, column2) {
          var tokens2 = this.session.getTokens(row);
          var l2 = 0;
          var hasPassedCursor = false;
          var hiddenTokens = [];
          for (var i2 = 0; i2 < tokens2.length; i2++) {
            var token2 = tokens2[i2];
            l2 += token2.value.length;
            if (token2.type === "ghost_text")
              continue;
            if (hasPassedCursor) {
              hiddenTokens.push({ type: token2.type, value: token2.value });
              token2.type = "hidden_token";
              continue;
            }
            if (l2 === column2) {
              hasPassedCursor = true;
            }
          }
          this.updateLines(row, row);
          return hiddenTokens;
        };
        VirtualRenderer2.prototype.removeExtraToken = function(row, column2) {
          this.session.bgTokenizer.lines[row] = null;
          this.updateLines(row, row);
        };
        VirtualRenderer2.prototype.setTheme = function(theme2, cb2) {
          var _self = this;
          this.$themeId = theme2;
          _self._dispatchEvent("themeChange", { theme: theme2 });
          if (!theme2 || typeof theme2 == "string") {
            var moduleName = theme2 || this.$options.theme.initialValue;
            config2.loadModule(["theme", moduleName], afterLoad);
          } else {
            afterLoad(theme2);
          }
          function afterLoad(module4) {
            if (_self.$themeId != theme2)
              return cb2 && cb2();
            if (!module4 || !module4.cssClass)
              throw new Error("couldn't load module " + theme2 + " or it didn't call define");
            if (module4.$id)
              _self.$themeId = module4.$id;
            dom.importCssString(module4.cssText, module4.cssClass, _self.container);
            if (_self.theme)
              dom.removeCssClass(_self.container, _self.theme.cssClass);
            var padding = "padding" in module4 ? module4.padding : "padding" in (_self.theme || {}) ? 4 : _self.$padding;
            if (_self.$padding && padding != _self.$padding)
              _self.setPadding(padding);
            _self.$theme = module4.cssClass;
            _self.theme = module4;
            dom.addCssClass(_self.container, module4.cssClass);
            dom.setCssClass(_self.container, "ace_dark", module4.isDark);
            if (_self.$size) {
              _self.$size.width = 0;
              _self.$updateSizeAsync();
            }
            _self._dispatchEvent("themeLoaded", { theme: module4 });
            cb2 && cb2();
            if (useragent.isSafari && _self.scroller) {
              _self.scroller.style.background = "red";
              _self.scroller.style.background = "";
            }
          }
        };
        VirtualRenderer2.prototype.getTheme = function() {
          return this.$themeId;
        };
        VirtualRenderer2.prototype.setStyle = function(style2, include) {
          dom.setCssClass(this.container, style2, include !== false);
        };
        VirtualRenderer2.prototype.unsetStyle = function(style2) {
          dom.removeCssClass(this.container, style2);
        };
        VirtualRenderer2.prototype.setCursorStyle = function(style2) {
          dom.setStyle(this.scroller.style, "cursor", style2);
        };
        VirtualRenderer2.prototype.setMouseCursor = function(cursorStyle) {
          dom.setStyle(this.scroller.style, "cursor", cursorStyle);
        };
        VirtualRenderer2.prototype.attachToShadowRoot = function() {
          dom.importCssString(editorCss, "ace_editor.css", this.container);
        };
        VirtualRenderer2.prototype.destroy = function() {
          this.freeze();
          this.$fontMetrics.destroy();
          this.$cursorLayer.destroy();
          this.removeAllListeners();
          this.container.textContent = "";
          this.setOption("useResizeObserver", false);
        };
        VirtualRenderer2.prototype.$updateCustomScrollbar = function(val) {
          var _self = this;
          this.$horizScroll = this.$vScroll = null;
          this.scrollBarV.element.remove();
          this.scrollBarH.element.remove();
          if (val === true) {
            this.scrollBarV = new VScrollBarCustom(this.container, this);
            this.scrollBarH = new HScrollBarCustom(this.container, this);
            this.scrollBarV.setHeight(this.$size.scrollerHeight);
            this.scrollBarH.setWidth(this.$size.scrollerWidth);
            this.scrollBarV.addEventListener("scroll", function(e2) {
              if (!_self.$scrollAnimation)
                _self.session.setScrollTop(e2.data - _self.scrollMargin.top);
            });
            this.scrollBarH.addEventListener("scroll", function(e2) {
              if (!_self.$scrollAnimation)
                _self.session.setScrollLeft(e2.data - _self.scrollMargin.left);
            });
            if (!this.$scrollDecorator) {
              this.$scrollDecorator = new Decorator(this.scrollBarV, this);
              this.$scrollDecorator.$updateDecorators();
            } else {
              this.$scrollDecorator.setScrollBarV(this.scrollBarV);
              this.$scrollDecorator.$updateDecorators();
            }
          } else {
            this.scrollBarV = new VScrollBar(this.container, this);
            this.scrollBarH = new HScrollBar(this.container, this);
            this.scrollBarV.addEventListener("scroll", function(e2) {
              if (!_self.$scrollAnimation)
                _self.session.setScrollTop(e2.data - _self.scrollMargin.top);
            });
            this.scrollBarH.addEventListener("scroll", function(e2) {
              if (!_self.$scrollAnimation)
                _self.session.setScrollLeft(e2.data - _self.scrollMargin.left);
            });
          }
        };
        VirtualRenderer2.prototype.$addResizeObserver = function() {
          if (!window.ResizeObserver || this.$resizeObserver)
            return;
          var self2 = this;
          this.$resizeTimer = lang2.delayedCall(function() {
            if (!self2.destroyed)
              self2.onResize();
          }, 50);
          this.$resizeObserver = new window.ResizeObserver(function(e2) {
            var w2 = e2[0].contentRect.width;
            var h3 = e2[0].contentRect.height;
            if (Math.abs(self2.$size.width - w2) > 1 || Math.abs(self2.$size.height - h3) > 1) {
              self2.$resizeTimer.delay();
            } else {
              self2.$resizeTimer.cancel();
            }
          });
          this.$resizeObserver.observe(this.container);
        };
        return VirtualRenderer2;
      }()
    );
    VirtualRenderer.prototype.CHANGE_CURSOR = 1;
    VirtualRenderer.prototype.CHANGE_MARKER = 2;
    VirtualRenderer.prototype.CHANGE_GUTTER = 4;
    VirtualRenderer.prototype.CHANGE_SCROLL = 8;
    VirtualRenderer.prototype.CHANGE_LINES = 16;
    VirtualRenderer.prototype.CHANGE_TEXT = 32;
    VirtualRenderer.prototype.CHANGE_SIZE = 64;
    VirtualRenderer.prototype.CHANGE_MARKER_BACK = 128;
    VirtualRenderer.prototype.CHANGE_MARKER_FRONT = 256;
    VirtualRenderer.prototype.CHANGE_FULL = 512;
    VirtualRenderer.prototype.CHANGE_H_SCROLL = 1024;
    VirtualRenderer.prototype.$changes = 0;
    VirtualRenderer.prototype.$padding = null;
    VirtualRenderer.prototype.$frozen = false;
    VirtualRenderer.prototype.STEPS = 8;
    oop.implement(VirtualRenderer.prototype, EventEmitter2);
    config2.defineOptions(VirtualRenderer.prototype, "renderer", {
      useResizeObserver: {
        set: function(value2) {
          if (!value2 && this.$resizeObserver) {
            this.$resizeObserver.disconnect();
            this.$resizeTimer.cancel();
            this.$resizeTimer = this.$resizeObserver = null;
          } else if (value2 && !this.$resizeObserver) {
            this.$addResizeObserver();
          }
        }
      },
      animatedScroll: { initialValue: false },
      showInvisibles: {
        set: function(value2) {
          if (this.$textLayer.setShowInvisibles(value2))
            this.$loop.schedule(this.CHANGE_TEXT);
        },
        initialValue: false
      },
      showPrintMargin: {
        set: function() {
          this.$updatePrintMargin();
        },
        initialValue: true
      },
      printMarginColumn: {
        set: function() {
          this.$updatePrintMargin();
        },
        initialValue: 80
      },
      printMargin: {
        set: function(val) {
          if (typeof val == "number")
            this.$printMarginColumn = val;
          this.$showPrintMargin = !!val;
          this.$updatePrintMargin();
        },
        get: function() {
          return this.$showPrintMargin && this.$printMarginColumn;
        }
      },
      showGutter: {
        set: function(show) {
          this.$gutter.style.display = show ? "block" : "none";
          this.$loop.schedule(this.CHANGE_FULL);
          this.onGutterResize();
        },
        initialValue: true
      },
      useSvgGutterIcons: {
        set: function(value2) {
          this.$gutterLayer.$useSvgGutterIcons = value2;
        },
        initialValue: false
      },
      showFoldedAnnotations: {
        set: function(value2) {
          this.$gutterLayer.$showFoldedAnnotations = value2;
        },
        initialValue: false
      },
      fadeFoldWidgets: {
        set: function(show) {
          dom.setCssClass(this.$gutter, "ace_fade-fold-widgets", show);
        },
        initialValue: false
      },
      showFoldWidgets: {
        set: function(show) {
          this.$gutterLayer.setShowFoldWidgets(show);
          this.$loop.schedule(this.CHANGE_GUTTER);
        },
        initialValue: true
      },
      displayIndentGuides: {
        set: function(show) {
          if (this.$textLayer.setDisplayIndentGuides(show))
            this.$loop.schedule(this.CHANGE_TEXT);
        },
        initialValue: true
      },
      highlightIndentGuides: {
        set: function(show) {
          if (this.$textLayer.setHighlightIndentGuides(show) == true) {
            this.$textLayer.$highlightIndentGuide();
          } else {
            this.$textLayer.$clearActiveIndentGuide(this.$textLayer.$lines.cells);
          }
        },
        initialValue: true
      },
      highlightGutterLine: {
        set: function(shouldHighlight) {
          this.$gutterLayer.setHighlightGutterLine(shouldHighlight);
          this.$loop.schedule(this.CHANGE_GUTTER);
        },
        initialValue: true
      },
      hScrollBarAlwaysVisible: {
        set: function(val) {
          if (!this.$hScrollBarAlwaysVisible || !this.$horizScroll)
            this.$loop.schedule(this.CHANGE_SCROLL);
        },
        initialValue: false
      },
      vScrollBarAlwaysVisible: {
        set: function(val) {
          if (!this.$vScrollBarAlwaysVisible || !this.$vScroll)
            this.$loop.schedule(this.CHANGE_SCROLL);
        },
        initialValue: false
      },
      fontSize: {
        set: function(size2) {
          if (typeof size2 == "number")
            size2 = size2 + "px";
          this.container.style.fontSize = size2;
          this.updateFontSize();
        },
        initialValue: 12
      },
      fontFamily: {
        set: function(name2) {
          this.container.style.fontFamily = name2;
          this.updateFontSize();
        }
      },
      maxLines: {
        set: function(val) {
          this.updateFull();
        }
      },
      minLines: {
        set: function(val) {
          if (!(this.$minLines < 562949953421311))
            this.$minLines = 0;
          this.updateFull();
        }
      },
      maxPixelHeight: {
        set: function(val) {
          this.updateFull();
        },
        initialValue: 0
      },
      scrollPastEnd: {
        set: function(val) {
          val = +val || 0;
          if (this.$scrollPastEnd == val)
            return;
          this.$scrollPastEnd = val;
          this.$loop.schedule(this.CHANGE_SCROLL);
        },
        initialValue: 0,
        handlesSet: true
      },
      fixedWidthGutter: {
        set: function(val) {
          this.$gutterLayer.$fixedWidth = !!val;
          this.$loop.schedule(this.CHANGE_GUTTER);
        }
      },
      customScrollbar: {
        set: function(val) {
          this.$updateCustomScrollbar(val);
        },
        initialValue: false
      },
      theme: {
        set: function(val) {
          this.setTheme(val);
        },
        get: function() {
          return this.$themeId || this.theme;
        },
        initialValue: "./theme/textmate",
        handlesSet: true
      },
      hasCssTransforms: {},
      useTextareaForIME: {
        initialValue: !useragent.isMobile && !useragent.isIE
      }
    });
    exports3.VirtualRenderer = VirtualRenderer;
  });
  ace.define("ace/worker/worker_client", ["require", "exports", "module", "ace/lib/oop", "ace/lib/net", "ace/lib/event_emitter", "ace/config"], function(require2, exports3, module3) {
    var oop = require2("../lib/oop");
    var net = require2("../lib/net");
    var EventEmitter2 = require2("../lib/event_emitter").EventEmitter;
    var config2 = require2("../config");
    function $workerBlob(workerUrl) {
      var script = "importScripts('" + net.qualifyURL(workerUrl) + "');";
      try {
        return new Blob([script], { "type": "application/javascript" });
      } catch (e2) {
        var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;
        var blobBuilder = new BlobBuilder();
        blobBuilder.append(script);
        return blobBuilder.getBlob("application/javascript");
      }
    }
    function createWorker(workerUrl) {
      if (typeof Worker == "undefined")
        return { postMessage: function() {
        }, terminate: function() {
        } };
      if (config2.get("loadWorkerFromBlob")) {
        var blob = $workerBlob(workerUrl);
        var URL2 = window.URL || window.webkitURL;
        var blobURL = URL2.createObjectURL(blob);
        return new Worker(blobURL);
      }
      return new Worker(workerUrl);
    }
    var WorkerClient = function(worker) {
      if (!worker.postMessage)
        worker = this.$createWorkerFromOldConfig.apply(this, arguments);
      this.$worker = worker;
      this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this);
      this.changeListener = this.changeListener.bind(this);
      this.onMessage = this.onMessage.bind(this);
      this.callbackId = 1;
      this.callbacks = {};
      this.$worker.onmessage = this.onMessage;
    };
    (function() {
      oop.implement(this, EventEmitter2);
      this.$createWorkerFromOldConfig = function(topLevelNamespaces, mod2, classname, workerUrl, importScripts) {
        if (require2.nameToUrl && !require2.toUrl)
          require2.toUrl = require2.nameToUrl;
        if (config2.get("packaged") || !require2.toUrl) {
          workerUrl = workerUrl || config2.moduleUrl(mod2, "worker");
        } else {
          var normalizePath = this.$normalizePath;
          workerUrl = workerUrl || normalizePath(require2.toUrl("ace/worker/worker.js", null, "_"));
          var tlns = {};
          topLevelNamespaces.forEach(function(ns) {
            tlns[ns] = normalizePath(require2.toUrl(ns, null, "_").replace(/(\.js)?(\?.*)?$/, ""));
          });
        }
        this.$worker = createWorker(workerUrl);
        if (importScripts) {
          this.send("importScripts", importScripts);
        }
        this.$worker.postMessage({
          init: true,
          tlns,
          module: mod2,
          classname
        });
        return this.$worker;
      };
      this.onMessage = function(e2) {
        var msg = e2.data;
        switch (msg.type) {
          case "event":
            this._signal(msg.name, { data: msg.data });
            break;
          case "call":
            var callback2 = this.callbacks[msg.id];
            if (callback2) {
              callback2(msg.data);
              delete this.callbacks[msg.id];
            }
            break;
          case "error":
            this.reportError(msg.data);
            break;
          case "log":
            window.console && console.log && console.log.apply(console, msg.data);
            break;
        }
      };
      this.reportError = function(err) {
        window.console && console.error && console.error(err);
      };
      this.$normalizePath = function(path) {
        return net.qualifyURL(path);
      };
      this.terminate = function() {
        this._signal("terminate", {});
        this.deltaQueue = null;
        this.$worker.terminate();
        this.$worker.onerror = function(e2) {
          e2.preventDefault();
        };
        this.$worker = null;
        if (this.$doc)
          this.$doc.off("change", this.changeListener);
        this.$doc = null;
      };
      this.send = function(cmd, args) {
        this.$worker.postMessage({ command: cmd, args });
      };
      this.call = function(cmd, args, callback2) {
        if (callback2) {
          var id2 = this.callbackId++;
          this.callbacks[id2] = callback2;
          args.push(id2);
        }
        this.send(cmd, args);
      };
      this.emit = function(event, data) {
        try {
          if (data.data && data.data.err)
            data.data.err = { message: data.data.err.message, stack: data.data.err.stack, code: data.data.err.code };
          this.$worker && this.$worker.postMessage({ event, data: { data: data.data } });
        } catch (ex) {
          console.error(ex.stack);
        }
      };
      this.attachToDocument = function(doc) {
        if (this.$doc)
          this.terminate();
        this.$doc = doc;
        this.call("setValue", [doc.getValue()]);
        doc.on("change", this.changeListener, true);
      };
      this.changeListener = function(delta) {
        if (!this.deltaQueue) {
          this.deltaQueue = [];
          setTimeout(this.$sendDeltaQueue, 0);
        }
        if (delta.action == "insert")
          this.deltaQueue.push(delta.start, delta.lines);
        else
          this.deltaQueue.push(delta.start, delta.end);
      };
      this.$sendDeltaQueue = function() {
        var q2 = this.deltaQueue;
        if (!q2)
          return;
        this.deltaQueue = null;
        if (q2.length > 50 && q2.length > this.$doc.getLength() >> 1) {
          this.call("setValue", [this.$doc.getValue()]);
        } else
          this.emit("change", { data: q2 });
      };
    }).call(WorkerClient.prototype);
    var UIWorkerClient = function(topLevelNamespaces, mod2, classname) {
      var main2 = null;
      var emitSync = false;
      var sender = Object.create(EventEmitter2);
      var messageBuffer = [];
      var workerClient = new WorkerClient({
        messageBuffer,
        terminate: function() {
        },
        postMessage: function(e2) {
          messageBuffer.push(e2);
          if (!main2)
            return;
          if (emitSync)
            setTimeout(processNext);
          else
            processNext();
        }
      });
      workerClient.setEmitSync = function(val) {
        emitSync = val;
      };
      var processNext = function() {
        var msg = messageBuffer.shift();
        if (msg.command)
          main2[msg.command].apply(main2, msg.args);
        else if (msg.event)
          sender._signal(msg.event, msg.data);
      };
      sender.postMessage = function(msg) {
        workerClient.onMessage({ data: msg });
      };
      sender.callback = function(data, callbackId) {
        this.postMessage({ type: "call", id: callbackId, data });
      };
      sender.emit = function(name2, data) {
        this.postMessage({ type: "event", name: name2, data });
      };
      config2.loadModule(["worker", mod2], function(Main) {
        main2 = new Main[classname](sender);
        while (messageBuffer.length)
          processNext();
      });
      return workerClient;
    };
    exports3.UIWorkerClient = UIWorkerClient;
    exports3.WorkerClient = WorkerClient;
    exports3.createWorker = createWorker;
  });
  ace.define("ace/placeholder", ["require", "exports", "module", "ace/range", "ace/lib/event_emitter", "ace/lib/oop"], function(require2, exports3, module3) {
    var Range2 = require2("./range").Range;
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var oop = require2("./lib/oop");
    var PlaceHolder = (
      /** @class */
      function() {
        function PlaceHolder2(session, length2, pos, others, mainClass, othersClass) {
          var _self = this;
          this.length = length2;
          this.session = session;
          this.doc = session.getDocument();
          this.mainClass = mainClass;
          this.othersClass = othersClass;
          this.$onUpdate = this.onUpdate.bind(this);
          this.doc.on("change", this.$onUpdate, true);
          this.$others = others;
          this.$onCursorChange = function() {
            setTimeout(function() {
              _self.onCursorChange();
            });
          };
          this.$pos = pos;
          var undoStack = session.getUndoManager().$undoStack || session.getUndoManager()["$undostack"] || { length: -1 };
          this.$undoStackDepth = undoStack.length;
          this.setup();
          session.selection.on("changeCursor", this.$onCursorChange);
        }
        PlaceHolder2.prototype.setup = function() {
          var _self = this;
          var doc = this.doc;
          var session = this.session;
          this.selectionBefore = session.selection.toJSON();
          if (session.selection.inMultiSelectMode)
            session.selection.toSingleRange();
          this.pos = doc.createAnchor(this.$pos.row, this.$pos.column);
          var pos = this.pos;
          pos.$insertRight = true;
          pos.detach();
          pos.markerId = session.addMarker(new Range2(pos.row, pos.column, pos.row, pos.column + this.length), this.mainClass, null, false);
          this.others = [];
          this.$others.forEach(function(other) {
            var anchor = doc.createAnchor(other.row, other.column);
            anchor.$insertRight = true;
            anchor.detach();
            _self.others.push(anchor);
          });
          session.setUndoSelect(false);
        };
        PlaceHolder2.prototype.showOtherMarkers = function() {
          if (this.othersActive)
            return;
          var session = this.session;
          var _self = this;
          this.othersActive = true;
          this.others.forEach(function(anchor) {
            anchor.markerId = session.addMarker(new Range2(anchor.row, anchor.column, anchor.row, anchor.column + _self.length), _self.othersClass, null, false);
          });
        };
        PlaceHolder2.prototype.hideOtherMarkers = function() {
          if (!this.othersActive)
            return;
          this.othersActive = false;
          for (var i2 = 0; i2 < this.others.length; i2++) {
            this.session.removeMarker(this.others[i2].markerId);
          }
        };
        PlaceHolder2.prototype.onUpdate = function(delta) {
          if (this.$updating)
            return this.updateAnchors(delta);
          var range3 = delta;
          if (range3.start.row !== range3.end.row)
            return;
          if (range3.start.row !== this.pos.row)
            return;
          this.$updating = true;
          var lengthDiff = delta.action === "insert" ? range3.end.column - range3.start.column : range3.start.column - range3.end.column;
          var inMainRange = range3.start.column >= this.pos.column && range3.start.column <= this.pos.column + this.length + 1;
          var distanceFromStart = range3.start.column - this.pos.column;
          this.updateAnchors(delta);
          if (inMainRange)
            this.length += lengthDiff;
          if (inMainRange && !this.session.$fromUndo) {
            if (delta.action === "insert") {
              for (var i2 = this.others.length - 1; i2 >= 0; i2--) {
                var otherPos = this.others[i2];
                var newPos = { row: otherPos.row, column: otherPos.column + distanceFromStart };
                this.doc.insertMergedLines(newPos, delta.lines);
              }
            } else if (delta.action === "remove") {
              for (var i2 = this.others.length - 1; i2 >= 0; i2--) {
                var otherPos = this.others[i2];
                var newPos = { row: otherPos.row, column: otherPos.column + distanceFromStart };
                this.doc.remove(new Range2(newPos.row, newPos.column, newPos.row, newPos.column - lengthDiff));
              }
            }
          }
          this.$updating = false;
          this.updateMarkers();
        };
        PlaceHolder2.prototype.updateAnchors = function(delta) {
          this.pos.onChange(delta);
          for (var i2 = this.others.length; i2--; )
            this.others[i2].onChange(delta);
          this.updateMarkers();
        };
        PlaceHolder2.prototype.updateMarkers = function() {
          if (this.$updating)
            return;
          var _self = this;
          var session = this.session;
          var updateMarker = function(pos, className) {
            session.removeMarker(pos.markerId);
            pos.markerId = session.addMarker(new Range2(pos.row, pos.column, pos.row, pos.column + _self.length), className, null, false);
          };
          updateMarker(this.pos, this.mainClass);
          for (var i2 = this.others.length; i2--; )
            updateMarker(this.others[i2], this.othersClass);
        };
        PlaceHolder2.prototype.onCursorChange = function(event) {
          if (this.$updating || !this.session)
            return;
          var pos = this.session.selection.getCursor();
          if (pos.row === this.pos.row && pos.column >= this.pos.column && pos.column <= this.pos.column + this.length) {
            this.showOtherMarkers();
            this._emit("cursorEnter", event);
          } else {
            this.hideOtherMarkers();
            this._emit("cursorLeave", event);
          }
        };
        PlaceHolder2.prototype.detach = function() {
          this.session.removeMarker(this.pos && this.pos.markerId);
          this.hideOtherMarkers();
          this.doc.off("change", this.$onUpdate);
          this.session.selection.off("changeCursor", this.$onCursorChange);
          this.session.setUndoSelect(true);
          this.session = null;
        };
        PlaceHolder2.prototype.cancel = function() {
          if (this.$undoStackDepth === -1)
            return;
          var undoManager = this.session.getUndoManager();
          var undosRequired = (undoManager.$undoStack || undoManager["$undostack"]).length - this.$undoStackDepth;
          for (var i2 = 0; i2 < undosRequired; i2++) {
            undoManager.undo(this.session, true);
          }
          if (this.selectionBefore)
            this.session.selection.fromJSON(this.selectionBefore);
        };
        return PlaceHolder2;
      }()
    );
    oop.implement(PlaceHolder.prototype, EventEmitter2);
    exports3.PlaceHolder = PlaceHolder;
  });
  ace.define("ace/mouse/multi_select_handler", ["require", "exports", "module", "ace/lib/event", "ace/lib/useragent"], function(require2, exports3, module3) {
    var event = require2("../lib/event");
    var useragent = require2("../lib/useragent");
    function isSamePoint(p1, p2) {
      return p1.row == p2.row && p1.column == p2.column;
    }
    function onMouseDown(e2) {
      var ev = e2.domEvent;
      var alt = ev.altKey;
      var shift = ev.shiftKey;
      var ctrl = ev.ctrlKey;
      var accel = e2.getAccelKey();
      var button2 = e2.getButton();
      if (ctrl && useragent.isMac)
        button2 = ev.button;
      if (e2.editor.inMultiSelectMode && button2 == 2) {
        e2.editor.textInput.onContextMenu(e2.domEvent);
        return;
      }
      if (!ctrl && !alt && !accel) {
        if (button2 === 0 && e2.editor.inMultiSelectMode)
          e2.editor.exitMultiSelectMode();
        return;
      }
      if (button2 !== 0)
        return;
      var editor2 = e2.editor;
      var selection = editor2.selection;
      var isMultiSelect = editor2.inMultiSelectMode;
      var pos = e2.getDocumentPosition();
      var cursor = selection.getCursor();
      var inSelection = e2.inSelection() || selection.isEmpty() && isSamePoint(pos, cursor);
      var mouseX = e2.x, mouseY = e2.y;
      var onMouseSelection = function(e3) {
        mouseX = e3.clientX;
        mouseY = e3.clientY;
      };
      var session = editor2.session;
      var screenAnchor = editor2.renderer.pixelToScreenCoordinates(mouseX, mouseY);
      var screenCursor = screenAnchor;
      var selectionMode;
      if (editor2.$mouseHandler.$enableJumpToDef) {
        if (ctrl && alt || accel && alt)
          selectionMode = shift ? "block" : "add";
        else if (alt && editor2.$blockSelectEnabled)
          selectionMode = "block";
      } else {
        if (accel && !alt) {
          selectionMode = "add";
          if (!isMultiSelect && shift)
            return;
        } else if (alt && editor2.$blockSelectEnabled) {
          selectionMode = "block";
        }
      }
      if (selectionMode && useragent.isMac && ev.ctrlKey) {
        editor2.$mouseHandler.cancelContextMenu();
      }
      if (selectionMode == "add") {
        if (!isMultiSelect && inSelection)
          return;
        if (!isMultiSelect) {
          var range3 = selection.toOrientedRange();
          editor2.addSelectionMarker(range3);
        }
        var oldRange = selection.rangeList.rangeAtPoint(pos);
        editor2.inVirtualSelectionMode = true;
        if (shift) {
          oldRange = null;
          range3 = selection.ranges[0] || range3;
          editor2.removeSelectionMarker(range3);
        }
        editor2.once("mouseup", function() {
          var tmpSel = selection.toOrientedRange();
          if (oldRange && tmpSel.isEmpty() && isSamePoint(oldRange.cursor, tmpSel.cursor))
            selection.substractPoint(tmpSel.cursor);
          else {
            if (shift) {
              selection.substractPoint(range3.cursor);
            } else if (range3) {
              editor2.removeSelectionMarker(range3);
              selection.addRange(range3);
            }
            selection.addRange(tmpSel);
          }
          editor2.inVirtualSelectionMode = false;
        });
      } else if (selectionMode == "block") {
        e2.stop();
        editor2.inVirtualSelectionMode = true;
        var initialRange;
        var rectSel = [];
        var blockSelect = function() {
          var newCursor = editor2.renderer.pixelToScreenCoordinates(mouseX, mouseY);
          var cursor2 = session.screenToDocumentPosition(newCursor.row, newCursor.column, newCursor.offsetX);
          if (isSamePoint(screenCursor, newCursor) && isSamePoint(cursor2, selection.lead))
            return;
          screenCursor = newCursor;
          editor2.selection.moveToPosition(cursor2);
          editor2.renderer.scrollCursorIntoView();
          editor2.removeSelectionMarkers(rectSel);
          rectSel = selection.rectangularRangeBlock(screenCursor, screenAnchor);
          if (editor2.$mouseHandler.$clickSelection && rectSel.length == 1 && rectSel[0].isEmpty())
            rectSel[0] = editor2.$mouseHandler.$clickSelection.clone();
          rectSel.forEach(editor2.addSelectionMarker, editor2);
          editor2.updateSelectionMarkers();
        };
        if (isMultiSelect && !accel) {
          selection.toSingleRange();
        } else if (!isMultiSelect && accel) {
          initialRange = selection.toOrientedRange();
          editor2.addSelectionMarker(initialRange);
        }
        if (shift)
          screenAnchor = session.documentToScreenPosition(selection.lead);
        else
          selection.moveToPosition(pos);
        screenCursor = { row: -1, column: -1 };
        var onMouseSelectionEnd = function(e3) {
          blockSelect();
          clearInterval(timerId);
          editor2.removeSelectionMarkers(rectSel);
          if (!rectSel.length)
            rectSel = [selection.toOrientedRange()];
          if (initialRange) {
            editor2.removeSelectionMarker(initialRange);
            selection.toSingleRange(initialRange);
          }
          for (var i2 = 0; i2 < rectSel.length; i2++)
            selection.addRange(rectSel[i2]);
          editor2.inVirtualSelectionMode = false;
          editor2.$mouseHandler.$clickSelection = null;
        };
        var onSelectionInterval = blockSelect;
        event.capture(editor2.container, onMouseSelection, onMouseSelectionEnd);
        var timerId = setInterval(function() {
          onSelectionInterval();
        }, 20);
        return e2.preventDefault();
      }
    }
    exports3.onMouseDown = onMouseDown;
  });
  ace.define("ace/commands/multi_select_commands", ["require", "exports", "module", "ace/keyboard/hash_handler"], function(require2, exports3, module3) {
    exports3.defaultCommands = [{
      name: "addCursorAbove",
      description: "Add cursor above",
      exec: function(editor2) {
        editor2.selectMoreLines(-1);
      },
      bindKey: { win: "Ctrl-Alt-Up", mac: "Ctrl-Alt-Up" },
      scrollIntoView: "cursor",
      readOnly: true
    }, {
      name: "addCursorBelow",
      description: "Add cursor below",
      exec: function(editor2) {
        editor2.selectMoreLines(1);
      },
      bindKey: { win: "Ctrl-Alt-Down", mac: "Ctrl-Alt-Down" },
      scrollIntoView: "cursor",
      readOnly: true
    }, {
      name: "addCursorAboveSkipCurrent",
      description: "Add cursor above (skip current)",
      exec: function(editor2) {
        editor2.selectMoreLines(-1, true);
      },
      bindKey: { win: "Ctrl-Alt-Shift-Up", mac: "Ctrl-Alt-Shift-Up" },
      scrollIntoView: "cursor",
      readOnly: true
    }, {
      name: "addCursorBelowSkipCurrent",
      description: "Add cursor below (skip current)",
      exec: function(editor2) {
        editor2.selectMoreLines(1, true);
      },
      bindKey: { win: "Ctrl-Alt-Shift-Down", mac: "Ctrl-Alt-Shift-Down" },
      scrollIntoView: "cursor",
      readOnly: true
    }, {
      name: "selectMoreBefore",
      description: "Select more before",
      exec: function(editor2) {
        editor2.selectMore(-1);
      },
      bindKey: { win: "Ctrl-Alt-Left", mac: "Ctrl-Alt-Left" },
      scrollIntoView: "cursor",
      readOnly: true
    }, {
      name: "selectMoreAfter",
      description: "Select more after",
      exec: function(editor2) {
        editor2.selectMore(1);
      },
      bindKey: { win: "Ctrl-Alt-Right", mac: "Ctrl-Alt-Right" },
      scrollIntoView: "cursor",
      readOnly: true
    }, {
      name: "selectNextBefore",
      description: "Select next before",
      exec: function(editor2) {
        editor2.selectMore(-1, true);
      },
      bindKey: { win: "Ctrl-Alt-Shift-Left", mac: "Ctrl-Alt-Shift-Left" },
      scrollIntoView: "cursor",
      readOnly: true
    }, {
      name: "selectNextAfter",
      description: "Select next after",
      exec: function(editor2) {
        editor2.selectMore(1, true);
      },
      bindKey: { win: "Ctrl-Alt-Shift-Right", mac: "Ctrl-Alt-Shift-Right" },
      scrollIntoView: "cursor",
      readOnly: true
    }, {
      name: "toggleSplitSelectionIntoLines",
      description: "Split selection into lines",
      exec: function(editor2) {
        if (editor2.multiSelect.rangeCount > 1)
          editor2.multiSelect.joinSelections();
        else
          editor2.multiSelect.splitIntoLines();
      },
      bindKey: { win: "Ctrl-Alt-L", mac: "Ctrl-Alt-L" },
      readOnly: true
    }, {
      name: "splitSelectionIntoLines",
      description: "Split into lines",
      exec: function(editor2) {
        editor2.multiSelect.splitIntoLines();
      },
      readOnly: true
    }, {
      name: "alignCursors",
      description: "Align cursors",
      exec: function(editor2) {
        editor2.alignCursors();
      },
      bindKey: { win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A" },
      scrollIntoView: "cursor"
    }, {
      name: "findAll",
      description: "Find all",
      exec: function(editor2) {
        editor2.findAll();
      },
      bindKey: { win: "Ctrl-Alt-K", mac: "Ctrl-Alt-G" },
      scrollIntoView: "cursor",
      readOnly: true
    }];
    exports3.multiSelectCommands = [{
      name: "singleSelection",
      description: "Single selection",
      bindKey: "esc",
      exec: function(editor2) {
        editor2.exitMultiSelectMode();
      },
      scrollIntoView: "cursor",
      readOnly: true,
      isAvailable: function(editor2) {
        return editor2 && editor2.inMultiSelectMode;
      }
    }];
    var HashHandler = require2("../keyboard/hash_handler").HashHandler;
    exports3.keyboardHandler = new HashHandler(exports3.multiSelectCommands);
  });
  ace.define("ace/multi_select", ["require", "exports", "module", "ace/range_list", "ace/range", "ace/selection", "ace/mouse/multi_select_handler", "ace/lib/event", "ace/lib/lang", "ace/commands/multi_select_commands", "ace/search", "ace/edit_session", "ace/editor", "ace/config"], function(require2, exports3, module3) {
    var RangeList = require2("./range_list").RangeList;
    var Range2 = require2("./range").Range;
    var Selection = require2("./selection").Selection;
    var onMouseDown = require2("./mouse/multi_select_handler").onMouseDown;
    var event = require2("./lib/event");
    var lang2 = require2("./lib/lang");
    var commands = require2("./commands/multi_select_commands");
    exports3.commands = commands.defaultCommands.concat(commands.multiSelectCommands);
    var Search2 = require2("./search").Search;
    var search2 = new Search2();
    function find2(session, needle, dir) {
      search2.$options.wrap = true;
      search2.$options.needle = needle;
      search2.$options.backwards = dir == -1;
      return search2.find(session);
    }
    var EditSession = require2("./edit_session").EditSession;
    (function() {
      this.getSelectionMarkers = function() {
        return this.$selectionMarkers;
      };
    }).call(EditSession.prototype);
    (function() {
      this.ranges = null;
      this.rangeList = null;
      this.addRange = function(range3, $blockChangeEvents) {
        if (!range3)
          return;
        if (!this.inMultiSelectMode && this.rangeCount === 0) {
          var oldRange = this.toOrientedRange();
          this.rangeList.add(oldRange);
          this.rangeList.add(range3);
          if (this.rangeList.ranges.length != 2) {
            this.rangeList.removeAll();
            return $blockChangeEvents || this.fromOrientedRange(range3);
          }
          this.rangeList.removeAll();
          this.rangeList.add(oldRange);
          this.$onAddRange(oldRange);
        }
        if (!range3.cursor)
          range3.cursor = range3.end;
        var removed = this.rangeList.add(range3);
        this.$onAddRange(range3);
        if (removed.length)
          this.$onRemoveRange(removed);
        if (this.rangeCount > 1 && !this.inMultiSelectMode) {
          this._signal("multiSelect");
          this.inMultiSelectMode = true;
          this.session.$undoSelect = false;
          this.rangeList.attach(this.session);
        }
        return $blockChangeEvents || this.fromOrientedRange(range3);
      };
      this.toSingleRange = function(range3) {
        range3 = range3 || this.ranges[0];
        var removed = this.rangeList.removeAll();
        if (removed.length)
          this.$onRemoveRange(removed);
        range3 && this.fromOrientedRange(range3);
      };
      this.substractPoint = function(pos) {
        var removed = this.rangeList.substractPoint(pos);
        if (removed) {
          this.$onRemoveRange(removed);
          return removed[0];
        }
      };
      this.mergeOverlappingRanges = function() {
        var removed = this.rangeList.merge();
        if (removed.length)
          this.$onRemoveRange(removed);
      };
      this.$onAddRange = function(range3) {
        this.rangeCount = this.rangeList.ranges.length;
        this.ranges.unshift(range3);
        this._signal("addRange", { range: range3 });
      };
      this.$onRemoveRange = function(removed) {
        this.rangeCount = this.rangeList.ranges.length;
        if (this.rangeCount == 1 && this.inMultiSelectMode) {
          var lastRange = this.rangeList.ranges.pop();
          removed.push(lastRange);
          this.rangeCount = 0;
        }
        for (var i2 = removed.length; i2--; ) {
          var index2 = this.ranges.indexOf(removed[i2]);
          this.ranges.splice(index2, 1);
        }
        this._signal("removeRange", { ranges: removed });
        if (this.rangeCount === 0 && this.inMultiSelectMode) {
          this.inMultiSelectMode = false;
          this._signal("singleSelect");
          this.session.$undoSelect = true;
          this.rangeList.detach(this.session);
        }
        lastRange = lastRange || this.ranges[0];
        if (lastRange && !lastRange.isEqual(this.getRange()))
          this.fromOrientedRange(lastRange);
      };
      this.$initRangeList = function() {
        if (this.rangeList)
          return;
        this.rangeList = new RangeList();
        this.ranges = [];
        this.rangeCount = 0;
      };
      this.getAllRanges = function() {
        return this.rangeCount ? this.rangeList.ranges.concat() : [this.getRange()];
      };
      this.splitIntoLines = function() {
        var ranges = this.ranges.length ? this.ranges : [this.getRange()];
        var newRanges = [];
        for (var i2 = 0; i2 < ranges.length; i2++) {
          var range3 = ranges[i2];
          var row = range3.start.row;
          var endRow = range3.end.row;
          if (row === endRow) {
            newRanges.push(range3.clone());
          } else {
            newRanges.push(new Range2(row, range3.start.column, row, this.session.getLine(row).length));
            while (++row < endRow)
              newRanges.push(this.getLineRange(row, true));
            newRanges.push(new Range2(endRow, 0, endRow, range3.end.column));
          }
          if (i2 == 0 && !this.isBackwards())
            newRanges = newRanges.reverse();
        }
        this.toSingleRange();
        for (var i2 = newRanges.length; i2--; )
          this.addRange(newRanges[i2]);
      };
      this.joinSelections = function() {
        var ranges = this.rangeList.ranges;
        var lastRange = ranges[ranges.length - 1];
        var range3 = Range2.fromPoints(ranges[0].start, lastRange.end);
        this.toSingleRange();
        this.setSelectionRange(range3, lastRange.cursor == lastRange.start);
      };
      this.toggleBlockSelection = function() {
        if (this.rangeCount > 1) {
          var ranges = this.rangeList.ranges;
          var lastRange = ranges[ranges.length - 1];
          var range3 = Range2.fromPoints(ranges[0].start, lastRange.end);
          this.toSingleRange();
          this.setSelectionRange(range3, lastRange.cursor == lastRange.start);
        } else {
          var cursor = this.session.documentToScreenPosition(this.cursor);
          var anchor = this.session.documentToScreenPosition(this.anchor);
          var rectSel = this.rectangularRangeBlock(cursor, anchor);
          rectSel.forEach(this.addRange, this);
        }
      };
      this.rectangularRangeBlock = function(screenCursor, screenAnchor, includeEmptyLines) {
        var rectSel = [];
        var xBackwards = screenCursor.column < screenAnchor.column;
        if (xBackwards) {
          var startColumn = screenCursor.column;
          var endColumn = screenAnchor.column;
          var startOffsetX = screenCursor.offsetX;
          var endOffsetX = screenAnchor.offsetX;
        } else {
          var startColumn = screenAnchor.column;
          var endColumn = screenCursor.column;
          var startOffsetX = screenAnchor.offsetX;
          var endOffsetX = screenCursor.offsetX;
        }
        var yBackwards = screenCursor.row < screenAnchor.row;
        if (yBackwards) {
          var startRow = screenCursor.row;
          var endRow = screenAnchor.row;
        } else {
          var startRow = screenAnchor.row;
          var endRow = screenCursor.row;
        }
        if (startColumn < 0)
          startColumn = 0;
        if (startRow < 0)
          startRow = 0;
        if (startRow == endRow)
          includeEmptyLines = true;
        var docEnd;
        for (var row = startRow; row <= endRow; row++) {
          var range3 = Range2.fromPoints(this.session.screenToDocumentPosition(row, startColumn, startOffsetX), this.session.screenToDocumentPosition(row, endColumn, endOffsetX));
          if (range3.isEmpty()) {
            if (docEnd && isSamePoint(range3.end, docEnd))
              break;
            docEnd = range3.end;
          }
          range3.cursor = xBackwards ? range3.start : range3.end;
          rectSel.push(range3);
        }
        if (yBackwards)
          rectSel.reverse();
        if (!includeEmptyLines) {
          var end2 = rectSel.length - 1;
          while (rectSel[end2].isEmpty() && end2 > 0)
            end2--;
          if (end2 > 0) {
            var start2 = 0;
            while (rectSel[start2].isEmpty())
              start2++;
          }
          for (var i2 = end2; i2 >= start2; i2--) {
            if (rectSel[i2].isEmpty())
              rectSel.splice(i2, 1);
          }
        }
        return rectSel;
      };
    }).call(Selection.prototype);
    var Editor2 = require2("./editor").Editor;
    (function() {
      this.updateSelectionMarkers = function() {
        this.renderer.updateCursor();
        this.renderer.updateBackMarkers();
      };
      this.addSelectionMarker = function(orientedRange) {
        if (!orientedRange.cursor)
          orientedRange.cursor = orientedRange.end;
        var style2 = this.getSelectionStyle();
        orientedRange.marker = this.session.addMarker(orientedRange, "ace_selection", style2);
        this.session.$selectionMarkers.push(orientedRange);
        this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
        return orientedRange;
      };
      this.removeSelectionMarker = function(range3) {
        if (!range3.marker)
          return;
        this.session.removeMarker(range3.marker);
        var index2 = this.session.$selectionMarkers.indexOf(range3);
        if (index2 != -1)
          this.session.$selectionMarkers.splice(index2, 1);
        this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
      };
      this.removeSelectionMarkers = function(ranges) {
        var markerList = this.session.$selectionMarkers;
        for (var i2 = ranges.length; i2--; ) {
          var range3 = ranges[i2];
          if (!range3.marker)
            continue;
          this.session.removeMarker(range3.marker);
          var index2 = markerList.indexOf(range3);
          if (index2 != -1)
            markerList.splice(index2, 1);
        }
        this.session.selectionMarkerCount = markerList.length;
      };
      this.$onAddRange = function(e2) {
        this.addSelectionMarker(e2.range);
        this.renderer.updateCursor();
        this.renderer.updateBackMarkers();
      };
      this.$onRemoveRange = function(e2) {
        this.removeSelectionMarkers(e2.ranges);
        this.renderer.updateCursor();
        this.renderer.updateBackMarkers();
      };
      this.$onMultiSelect = function(e2) {
        if (this.inMultiSelectMode)
          return;
        this.inMultiSelectMode = true;
        this.setStyle("ace_multiselect");
        this.keyBinding.addKeyboardHandler(commands.keyboardHandler);
        this.commands.setDefaultHandler("exec", this.$onMultiSelectExec);
        this.renderer.updateCursor();
        this.renderer.updateBackMarkers();
      };
      this.$onSingleSelect = function(e2) {
        if (this.session.multiSelect.inVirtualMode)
          return;
        this.inMultiSelectMode = false;
        this.unsetStyle("ace_multiselect");
        this.keyBinding.removeKeyboardHandler(commands.keyboardHandler);
        this.commands.removeDefaultHandler("exec", this.$onMultiSelectExec);
        this.renderer.updateCursor();
        this.renderer.updateBackMarkers();
        this._emit("changeSelection");
      };
      this.$onMultiSelectExec = function(e2) {
        var command = e2.command;
        var editor2 = e2.editor;
        if (!editor2.multiSelect)
          return;
        if (!command.multiSelectAction) {
          var result = command.exec(editor2, e2.args || {});
          editor2.multiSelect.addRange(editor2.multiSelect.toOrientedRange());
          editor2.multiSelect.mergeOverlappingRanges();
        } else if (command.multiSelectAction == "forEach") {
          result = editor2.forEachSelection(command, e2.args);
        } else if (command.multiSelectAction == "forEachLine") {
          result = editor2.forEachSelection(command, e2.args, true);
        } else if (command.multiSelectAction == "single") {
          editor2.exitMultiSelectMode();
          result = command.exec(editor2, e2.args || {});
        } else {
          result = command.multiSelectAction(editor2, e2.args || {});
        }
        return result;
      };
      this.forEachSelection = function(cmd, args, options) {
        if (this.inVirtualSelectionMode)
          return;
        var keepOrder = options && options.keepOrder;
        var $byLines = options == true || options && options.$byLines;
        var session = this.session;
        var selection = this.selection;
        var rangeList = selection.rangeList;
        var ranges = (keepOrder ? selection : rangeList).ranges;
        var result;
        if (!ranges.length)
          return cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {});
        var reg = selection._eventRegistry;
        selection._eventRegistry = {};
        var tmpSel = new Selection(session);
        this.inVirtualSelectionMode = true;
        for (var i2 = ranges.length; i2--; ) {
          if ($byLines) {
            while (i2 > 0 && ranges[i2].start.row == ranges[i2 - 1].end.row)
              i2--;
          }
          tmpSel.fromOrientedRange(ranges[i2]);
          tmpSel.index = i2;
          this.selection = session.selection = tmpSel;
          var cmdResult = cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {});
          if (!result && cmdResult !== void 0)
            result = cmdResult;
          tmpSel.toOrientedRange(ranges[i2]);
        }
        tmpSel.detach();
        this.selection = session.selection = selection;
        this.inVirtualSelectionMode = false;
        selection._eventRegistry = reg;
        selection.mergeOverlappingRanges();
        if (selection.ranges[0])
          selection.fromOrientedRange(selection.ranges[0]);
        var anim = this.renderer.$scrollAnimation;
        this.onCursorChange();
        this.onSelectionChange();
        if (anim && anim.from == anim.to)
          this.renderer.animateScrolling(anim.from);
        return result;
      };
      this.exitMultiSelectMode = function() {
        if (!this.inMultiSelectMode || this.inVirtualSelectionMode)
          return;
        this.multiSelect.toSingleRange();
      };
      this.getSelectedText = function() {
        var text2 = "";
        if (this.inMultiSelectMode && !this.inVirtualSelectionMode) {
          var ranges = this.multiSelect.rangeList.ranges;
          var buf = [];
          for (var i2 = 0; i2 < ranges.length; i2++) {
            buf.push(this.session.getTextRange(ranges[i2]));
          }
          var nl2 = this.session.getDocument().getNewLineCharacter();
          text2 = buf.join(nl2);
          if (text2.length == (buf.length - 1) * nl2.length)
            text2 = "";
        } else if (!this.selection.isEmpty()) {
          text2 = this.session.getTextRange(this.getSelectionRange());
        }
        return text2;
      };
      this.$checkMultiselectChange = function(e2, anchor) {
        if (this.inMultiSelectMode && !this.inVirtualSelectionMode) {
          var range3 = this.multiSelect.ranges[0];
          if (this.multiSelect.isEmpty() && anchor == this.multiSelect.anchor)
            return;
          var pos = anchor == this.multiSelect.anchor ? range3.cursor == range3.start ? range3.end : range3.start : range3.cursor;
          if (pos.row != anchor.row || this.session.$clipPositionToDocument(pos.row, pos.column).column != anchor.column)
            this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange());
          else
            this.multiSelect.mergeOverlappingRanges();
        }
      };
      this.findAll = function(needle, options, additive) {
        options = options || {};
        options.needle = needle || options.needle;
        if (options.needle == void 0) {
          var range3 = this.selection.isEmpty() ? this.selection.getWordRange() : this.selection.getRange();
          options.needle = this.session.getTextRange(range3);
        }
        this.$search.set(options);
        var ranges = this.$search.findAll(this.session);
        if (!ranges.length)
          return 0;
        var selection = this.multiSelect;
        if (!additive)
          selection.toSingleRange(ranges[0]);
        for (var i2 = ranges.length; i2--; )
          selection.addRange(ranges[i2], true);
        if (range3 && selection.rangeList.rangeAtPoint(range3.start))
          selection.addRange(range3, true);
        return ranges.length;
      };
      this.selectMoreLines = function(dir, skip2) {
        var range3 = this.selection.toOrientedRange();
        var isBackwards = range3.cursor == range3.end;
        var screenLead = this.session.documentToScreenPosition(range3.cursor);
        if (this.selection.$desiredColumn)
          screenLead.column = this.selection.$desiredColumn;
        var lead = this.session.screenToDocumentPosition(screenLead.row + dir, screenLead.column);
        if (!range3.isEmpty()) {
          var screenAnchor = this.session.documentToScreenPosition(isBackwards ? range3.end : range3.start);
          var anchor = this.session.screenToDocumentPosition(screenAnchor.row + dir, screenAnchor.column);
        } else {
          var anchor = lead;
        }
        if (isBackwards) {
          var newRange = Range2.fromPoints(lead, anchor);
          newRange.cursor = newRange.start;
        } else {
          var newRange = Range2.fromPoints(anchor, lead);
          newRange.cursor = newRange.end;
        }
        newRange.desiredColumn = screenLead.column;
        if (!this.selection.inMultiSelectMode) {
          this.selection.addRange(range3);
        } else {
          if (skip2)
            var toRemove = range3.cursor;
        }
        this.selection.addRange(newRange);
        if (toRemove)
          this.selection.substractPoint(toRemove);
      };
      this.transposeSelections = function(dir) {
        var session = this.session;
        var sel = session.multiSelect;
        var all3 = sel.ranges;
        for (var i2 = all3.length; i2--; ) {
          var range3 = all3[i2];
          if (range3.isEmpty()) {
            var tmp_1 = session.getWordRange(range3.start.row, range3.start.column);
            range3.start.row = tmp_1.start.row;
            range3.start.column = tmp_1.start.column;
            range3.end.row = tmp_1.end.row;
            range3.end.column = tmp_1.end.column;
          }
        }
        sel.mergeOverlappingRanges();
        var words = [];
        for (var i2 = all3.length; i2--; ) {
          var range3 = all3[i2];
          words.unshift(session.getTextRange(range3));
        }
        if (dir < 0)
          words.unshift(words.pop());
        else
          words.push(words.shift());
        for (var i2 = all3.length; i2--; ) {
          var range3 = all3[i2];
          var tmp = range3.clone();
          session.replace(range3, words[i2]);
          range3.start.row = tmp.start.row;
          range3.start.column = tmp.start.column;
        }
        sel.fromOrientedRange(sel.ranges[0]);
      };
      this.selectMore = function(dir, skip2, stopAtFirst) {
        var session = this.session;
        var sel = session.multiSelect;
        var range3 = sel.toOrientedRange();
        if (range3.isEmpty()) {
          range3 = session.getWordRange(range3.start.row, range3.start.column);
          range3.cursor = dir == -1 ? range3.start : range3.end;
          this.multiSelect.addRange(range3);
          if (stopAtFirst)
            return;
        }
        var needle = session.getTextRange(range3);
        var newRange = find2(session, needle, dir);
        if (newRange) {
          newRange.cursor = dir == -1 ? newRange.start : newRange.end;
          this.session.unfold(newRange);
          this.multiSelect.addRange(newRange);
          this.renderer.scrollCursorIntoView(null, 0.5);
        }
        if (skip2)
          this.multiSelect.substractPoint(range3.cursor);
      };
      this.alignCursors = function() {
        var session = this.session;
        var sel = session.multiSelect;
        var ranges = sel.ranges;
        var row = -1;
        var sameRowRanges = ranges.filter(function(r2) {
          if (r2.cursor.row == row)
            return true;
          row = r2.cursor.row;
        });
        if (!ranges.length || sameRowRanges.length == ranges.length - 1) {
          var range3 = this.selection.getRange();
          var fr = range3.start.row, lr = range3.end.row;
          var guessRange = fr == lr;
          if (guessRange) {
            var max2 = this.session.getLength();
            var line2;
            do {
              line2 = this.session.getLine(lr);
            } while (/[=:]/.test(line2) && ++lr < max2);
            do {
              line2 = this.session.getLine(fr);
            } while (/[=:]/.test(line2) && --fr > 0);
            if (fr < 0)
              fr = 0;
            if (lr >= max2)
              lr = max2 - 1;
          }
          var lines = this.session.removeFullLines(fr, lr);
          lines = this.$reAlignText(lines, guessRange);
          this.session.insert({ row: fr, column: 0 }, lines.join("\n") + "\n");
          if (!guessRange) {
            range3.start.column = 0;
            range3.end.column = lines[lines.length - 1].length;
          }
          this.selection.setRange(range3);
        } else {
          sameRowRanges.forEach(function(r2) {
            sel.substractPoint(r2.cursor);
          });
          var maxCol = 0;
          var minSpace = Infinity;
          var spaceOffsets = ranges.map(function(r2) {
            var p2 = r2.cursor;
            var line3 = session.getLine(p2.row);
            var spaceOffset = line3.substr(p2.column).search(/\S/g);
            if (spaceOffset == -1)
              spaceOffset = 0;
            if (p2.column > maxCol)
              maxCol = p2.column;
            if (spaceOffset < minSpace)
              minSpace = spaceOffset;
            return spaceOffset;
          });
          ranges.forEach(function(r2, i2) {
            var p2 = r2.cursor;
            var l2 = maxCol - p2.column;
            var d2 = spaceOffsets[i2] - minSpace;
            if (l2 > d2)
              session.insert(p2, lang2.stringRepeat(" ", l2 - d2));
            else
              session.remove(new Range2(p2.row, p2.column, p2.row, p2.column - l2 + d2));
            r2.start.column = r2.end.column = maxCol;
            r2.start.row = r2.end.row = p2.row;
            r2.cursor = r2.end;
          });
          sel.fromOrientedRange(ranges[0]);
          this.renderer.updateCursor();
          this.renderer.updateBackMarkers();
        }
      };
      this.$reAlignText = function(lines, forceLeft) {
        var isLeftAligned = true, isRightAligned = true;
        var startW, textW, endW;
        return lines.map(function(line2) {
          var m2 = line2.match(/(\s*)(.*?)(\s*)([=:].*)/);
          if (!m2)
            return [line2];
          if (startW == null) {
            startW = m2[1].length;
            textW = m2[2].length;
            endW = m2[3].length;
            return m2;
          }
          if (startW + textW + endW != m2[1].length + m2[2].length + m2[3].length)
            isRightAligned = false;
          if (startW != m2[1].length)
            isLeftAligned = false;
          if (startW > m2[1].length)
            startW = m2[1].length;
          if (textW < m2[2].length)
            textW = m2[2].length;
          if (endW > m2[3].length)
            endW = m2[3].length;
          return m2;
        }).map(forceLeft ? alignLeft : isLeftAligned ? isRightAligned ? alignRight : alignLeft : unAlign);
        function spaces(n2) {
          return lang2.stringRepeat(" ", n2);
        }
        function alignLeft(m2) {
          return !m2[2] ? m2[0] : spaces(startW) + m2[2] + spaces(textW - m2[2].length + endW) + m2[4].replace(/^([=:])\s+/, "$1 ");
        }
        function alignRight(m2) {
          return !m2[2] ? m2[0] : spaces(startW + textW - m2[2].length) + m2[2] + spaces(endW) + m2[4].replace(/^([=:])\s+/, "$1 ");
        }
        function unAlign(m2) {
          return !m2[2] ? m2[0] : spaces(startW) + m2[2] + spaces(endW) + m2[4].replace(/^([=:])\s+/, "$1 ");
        }
      };
    }).call(Editor2.prototype);
    function isSamePoint(p1, p2) {
      return p1.row == p2.row && p1.column == p2.column;
    }
    exports3.onSessionChange = function(e2) {
      var session = e2.session;
      if (session && !session.multiSelect) {
        session.$selectionMarkers = [];
        session.selection.$initRangeList();
        session.multiSelect = session.selection;
      }
      this.multiSelect = session && session.multiSelect;
      var oldSession = e2.oldSession;
      if (oldSession) {
        oldSession.multiSelect.off("addRange", this.$onAddRange);
        oldSession.multiSelect.off("removeRange", this.$onRemoveRange);
        oldSession.multiSelect.off("multiSelect", this.$onMultiSelect);
        oldSession.multiSelect.off("singleSelect", this.$onSingleSelect);
        oldSession.multiSelect.lead.off("change", this.$checkMultiselectChange);
        oldSession.multiSelect.anchor.off("change", this.$checkMultiselectChange);
      }
      if (session) {
        session.multiSelect.on("addRange", this.$onAddRange);
        session.multiSelect.on("removeRange", this.$onRemoveRange);
        session.multiSelect.on("multiSelect", this.$onMultiSelect);
        session.multiSelect.on("singleSelect", this.$onSingleSelect);
        session.multiSelect.lead.on("change", this.$checkMultiselectChange);
        session.multiSelect.anchor.on("change", this.$checkMultiselectChange);
      }
      if (session && this.inMultiSelectMode != session.selection.inMultiSelectMode) {
        if (session.selection.inMultiSelectMode)
          this.$onMultiSelect();
        else
          this.$onSingleSelect();
      }
    };
    function MultiSelect(editor2) {
      if (editor2.$multiselectOnSessionChange)
        return;
      editor2.$onAddRange = editor2.$onAddRange.bind(editor2);
      editor2.$onRemoveRange = editor2.$onRemoveRange.bind(editor2);
      editor2.$onMultiSelect = editor2.$onMultiSelect.bind(editor2);
      editor2.$onSingleSelect = editor2.$onSingleSelect.bind(editor2);
      editor2.$multiselectOnSessionChange = exports3.onSessionChange.bind(editor2);
      editor2.$checkMultiselectChange = editor2.$checkMultiselectChange.bind(editor2);
      editor2.$multiselectOnSessionChange(editor2);
      editor2.on("changeSession", editor2.$multiselectOnSessionChange);
      editor2.on("mousedown", onMouseDown);
      editor2.commands.addCommands(commands.defaultCommands);
      addAltCursorListeners(editor2);
    }
    function addAltCursorListeners(editor2) {
      if (!editor2.textInput)
        return;
      var el2 = editor2.textInput.getElement();
      var altCursor = false;
      event.addListener(el2, "keydown", function(e2) {
        var altDown = e2.keyCode == 18 && !(e2.ctrlKey || e2.shiftKey || e2.metaKey);
        if (editor2.$blockSelectEnabled && altDown) {
          if (!altCursor) {
            editor2.renderer.setMouseCursor("crosshair");
            altCursor = true;
          }
        } else if (altCursor) {
          reset();
        }
      }, editor2);
      event.addListener(el2, "keyup", reset, editor2);
      event.addListener(el2, "blur", reset, editor2);
      function reset(e2) {
        if (altCursor) {
          editor2.renderer.setMouseCursor("");
          altCursor = false;
        }
      }
    }
    exports3.MultiSelect = MultiSelect;
    require2("./config").defineOptions(Editor2.prototype, "editor", {
      enableMultiselect: {
        set: function(val) {
          MultiSelect(this);
          if (val) {
            this.on("mousedown", onMouseDown);
          } else {
            this.off("mousedown", onMouseDown);
          }
        },
        value: true
      },
      enableBlockSelect: {
        set: function(val) {
          this.$blockSelectEnabled = val;
        },
        value: true
      }
    });
  });
  ace.define("ace/mode/folding/fold_mode", ["require", "exports", "module", "ace/range"], function(require2, exports3, module3) {
    var Range2 = require2("../../range").Range;
    var FoldMode = exports3.FoldMode = function() {
    };
    (function() {
      this.foldingStartMarker = null;
      this.foldingStopMarker = null;
      this.getFoldWidget = function(session, foldStyle, row) {
        var line2 = session.getLine(row);
        if (this.foldingStartMarker.test(line2))
          return "start";
        if (foldStyle == "markbeginend" && this.foldingStopMarker && this.foldingStopMarker.test(line2))
          return "end";
        return "";
      };
      this.getFoldWidgetRange = function(session, foldStyle, row) {
        return null;
      };
      this.indentationBlock = function(session, row, column2) {
        var re2 = /\S/;
        var line2 = session.getLine(row);
        var startLevel = line2.search(re2);
        if (startLevel == -1)
          return;
        var startColumn = column2 || line2.length;
        var maxRow = session.getLength();
        var startRow = row;
        var endRow = row;
        while (++row < maxRow) {
          var level = session.getLine(row).search(re2);
          if (level == -1)
            continue;
          if (level <= startLevel) {
            var token2 = session.getTokenAt(row, 0);
            if (!token2 || token2.type !== "string")
              break;
          }
          endRow = row;
        }
        if (endRow > startRow) {
          var endColumn = session.getLine(endRow).length;
          return new Range2(startRow, startColumn, endRow, endColumn);
        }
      };
      this.openingBracketBlock = function(session, bracket, row, column2, typeRe) {
        var start2 = { row, column: column2 + 1 };
        var end2 = session.$findClosingBracket(bracket, start2, typeRe);
        if (!end2)
          return;
        var fw = session.foldWidgets[end2.row];
        if (fw == null)
          fw = session.getFoldWidget(end2.row);
        if (fw == "start" && end2.row > start2.row) {
          end2.row--;
          end2.column = session.getLine(end2.row).length;
        }
        return Range2.fromPoints(start2, end2);
      };
      this.closingBracketBlock = function(session, bracket, row, column2, typeRe) {
        var end2 = { row, column: column2 };
        var start2 = session.$findOpeningBracket(bracket, end2);
        if (!start2)
          return;
        start2.column++;
        end2.column--;
        return Range2.fromPoints(start2, end2);
      };
    }).call(FoldMode.prototype);
  });
  ace.define("ace/ext/error_marker", ["require", "exports", "module", "ace/lib/dom", "ace/range", "ace/config"], function(require2, exports3, module3) {
    var dom = require2("../lib/dom");
    var Range2 = require2("../range").Range;
    var nls = require2("../config").nls;
    function binarySearch2(array4, needle, comparator) {
      var first = 0;
      var last = array4.length - 1;
      while (first <= last) {
        var mid = first + last >> 1;
        var c2 = comparator(needle, array4[mid]);
        if (c2 > 0)
          first = mid + 1;
        else if (c2 < 0)
          last = mid - 1;
        else
          return mid;
      }
      return -(first + 1);
    }
    function findAnnotations(session, row, dir) {
      var annotations = session.getAnnotations().sort(Range2.comparePoints);
      if (!annotations.length)
        return;
      var i2 = binarySearch2(annotations, { row, column: -1 }, Range2.comparePoints);
      if (i2 < 0)
        i2 = -i2 - 1;
      if (i2 >= annotations.length)
        i2 = dir > 0 ? 0 : annotations.length - 1;
      else if (i2 === 0 && dir < 0)
        i2 = annotations.length - 1;
      var annotation = annotations[i2];
      if (!annotation || !dir)
        return;
      if (annotation.row === row) {
        do {
          annotation = annotations[i2 += dir];
        } while (annotation && annotation.row === row);
        if (!annotation)
          return annotations.slice();
      }
      var matched = [];
      row = annotation.row;
      do {
        matched[dir < 0 ? "unshift" : "push"](annotation);
        annotation = annotations[i2 += dir];
      } while (annotation && annotation.row == row);
      return matched.length && matched;
    }
    exports3.showErrorMarker = function(editor2, dir) {
      var session = editor2.session;
      var pos = editor2.getCursorPosition();
      var row = pos.row;
      var oldWidget = session.widgetManager.getWidgetsAtRow(row).filter(function(w3) {
        return w3.type == "errorMarker";
      })[0];
      if (oldWidget) {
        oldWidget.destroy();
      } else {
        row -= dir;
      }
      var annotations = findAnnotations(session, row, dir);
      var gutterAnno;
      if (annotations) {
        var annotation = annotations[0];
        pos.column = (annotation.pos && typeof annotation.column != "number" ? annotation.pos.sc : annotation.column) || 0;
        pos.row = annotation.row;
        gutterAnno = editor2.renderer.$gutterLayer.$annotations[pos.row];
      } else if (oldWidget) {
        return;
      } else {
        gutterAnno = {
          displayText: [nls("error-marker.good-state", "Looks good!")],
          className: "ace_ok"
        };
      }
      editor2.session.unfold(pos.row);
      editor2.selection.moveToPosition(pos);
      var w2 = {
        row: pos.row,
        fixedWidth: true,
        coverGutter: true,
        el: dom.createElement("div"),
        type: "errorMarker"
      };
      var el2 = w2.el.appendChild(dom.createElement("div"));
      var arrow = w2.el.appendChild(dom.createElement("div"));
      arrow.className = "error_widget_arrow " + gutterAnno.className;
      var left2 = editor2.renderer.$cursorLayer.getPixelPosition(pos).left;
      arrow.style.left = left2 + editor2.renderer.gutterWidth - 5 + "px";
      w2.el.className = "error_widget_wrapper";
      el2.className = "error_widget " + gutterAnno.className;
      gutterAnno.displayText.forEach(function(annoTextLine, i2) {
        el2.appendChild(dom.createTextNode(annoTextLine));
        if (i2 < gutterAnno.displayText.length - 1) {
          el2.appendChild(dom.createElement("br"));
        }
      });
      el2.appendChild(dom.createElement("div"));
      var kb2 = function(_24, hashId, keyString) {
        if (hashId === 0 && (keyString === "esc" || keyString === "return")) {
          w2.destroy();
          return { command: "null" };
        }
      };
      w2.destroy = function() {
        if (editor2.$mouseHandler.isMousePressed)
          return;
        editor2.keyBinding.removeKeyboardHandler(kb2);
        session.widgetManager.removeLineWidget(w2);
        editor2.off("changeSelection", w2.destroy);
        editor2.off("changeSession", w2.destroy);
        editor2.off("mouseup", w2.destroy);
        editor2.off("change", w2.destroy);
      };
      editor2.keyBinding.addKeyboardHandler(kb2);
      editor2.on("changeSelection", w2.destroy);
      editor2.on("changeSession", w2.destroy);
      editor2.on("mouseup", w2.destroy);
      editor2.on("change", w2.destroy);
      editor2.session.widgetManager.addLineWidget(w2);
      w2.el.onmousedown = editor2.focus.bind(editor2);
      editor2.renderer.scrollCursorIntoView(null, 0.5, { bottom: w2.el.offsetHeight });
    };
    dom.importCssString("\n    .error_widget_wrapper {\n        background: inherit;\n        color: inherit;\n        border:none\n    }\n    .error_widget {\n        border-top: solid 2px;\n        border-bottom: solid 2px;\n        margin: 5px 0;\n        padding: 10px 40px;\n        white-space: pre-wrap;\n    }\n    .error_widget.ace_error, .error_widget_arrow.ace_error{\n        border-color: #ff5a5a\n    }\n    .error_widget.ace_warning, .error_widget_arrow.ace_warning{\n        border-color: #F1D817\n    }\n    .error_widget.ace_info, .error_widget_arrow.ace_info{\n        border-color: #5a5a5a\n    }\n    .error_widget.ace_ok, .error_widget_arrow.ace_ok{\n        border-color: #5aaa5a\n    }\n    .error_widget_arrow {\n        position: absolute;\n        border: solid 5px;\n        border-top-color: transparent!important;\n        border-right-color: transparent!important;\n        border-left-color: transparent!important;\n        top: -5px;\n    }\n", "error_marker.css", false);
  });
  ace.define("ace/ace", ["require", "exports", "module", "ace/lib/dom", "ace/range", "ace/editor", "ace/edit_session", "ace/undomanager", "ace/virtual_renderer", "ace/worker/worker_client", "ace/keyboard/hash_handler", "ace/placeholder", "ace/multi_select", "ace/mode/folding/fold_mode", "ace/theme/textmate", "ace/ext/error_marker", "ace/config", "ace/loader_build"], function(require2, exports3, module3) {
    require2("./loader_build")(exports3);
    var dom = require2("./lib/dom");
    var Range2 = require2("./range").Range;
    var Editor2 = require2("./editor").Editor;
    var EditSession = require2("./edit_session").EditSession;
    var UndoManager = require2("./undomanager").UndoManager;
    var Renderer = require2("./virtual_renderer").VirtualRenderer;
    require2("./worker/worker_client");
    require2("./keyboard/hash_handler");
    require2("./placeholder");
    require2("./multi_select");
    require2("./mode/folding/fold_mode");
    require2("./theme/textmate");
    require2("./ext/error_marker");
    exports3.config = require2("./config");
    exports3.edit = function(el2, options) {
      if (typeof el2 == "string") {
        var _id = el2;
        el2 = document.getElementById(_id);
        if (!el2)
          throw new Error("ace.edit can't find div #" + _id);
      }
      if (el2 && el2.env && el2.env.editor instanceof Editor2)
        return el2.env.editor;
      var value2 = "";
      if (el2 && /input|textarea/i.test(el2.tagName)) {
        var oldNode = el2;
        value2 = oldNode.value;
        el2 = dom.createElement("pre");
        oldNode.parentNode.replaceChild(el2, oldNode);
      } else if (el2) {
        value2 = el2.textContent;
        el2.innerHTML = "";
      }
      var doc = exports3.createEditSession(value2);
      var editor2 = new Editor2(new Renderer(el2), doc, options);
      var env2 = {
        document: doc,
        editor: editor2,
        onResize: editor2.resize.bind(editor2, null)
      };
      if (oldNode)
        env2.textarea = oldNode;
      editor2.on("destroy", function() {
        env2.editor.container.env = null;
      });
      editor2.container.env = editor2.env = env2;
      return editor2;
    };
    exports3.createEditSession = function(text2, mode) {
      var doc = new EditSession(text2, mode);
      doc.setUndoManager(new UndoManager());
      return doc;
    };
    exports3.Range = Range2;
    exports3.Editor = Editor2;
    exports3.EditSession = EditSession;
    exports3.UndoManager = UndoManager;
    exports3.VirtualRenderer = Renderer;
    var version2 = exports3.config.version;
    exports3.version = version2;
  });
  (function() {
    ace.require(["ace/ace"], function(a2) {
      if (a2) {
        a2.config.init(true);
        a2.define = ace.define;
      }
      var global2 = /* @__PURE__ */ function() {
        return this;
      }();
      if (!global2 && typeof window != "undefined")
        global2 = window;
      if (!global2 && typeof self != "undefined")
        global2 = self;
      if (!global2.ace)
        global2.ace = a2;
      for (var key in a2)
        if (a2.hasOwnProperty(key))
          global2.ace[key] = a2[key];
      global2.ace["default"] = global2.ace;
      if (module2) {
        module2.exports = global2.ace;
      }
    });
  })();
})(ace$3);
var aceExports = ace$3.exports;
var lodash_isequal = { exports: {} };
lodash_isequal.exports;
(function(module2, exports2) {
  var LARGE_ARRAY_SIZE2 = 200;
  var HASH_UNDEFINED2 = "__lodash_hash_undefined__";
  var COMPARE_PARTIAL_FLAG2 = 1, COMPARE_UNORDERED_FLAG2 = 2;
  var MAX_SAFE_INTEGER2 = 9007199254740991;
  var argsTag2 = "[object Arguments]", arrayTag2 = "[object Array]", asyncTag2 = "[object AsyncFunction]", boolTag2 = "[object Boolean]", dateTag2 = "[object Date]", errorTag2 = "[object Error]", funcTag2 = "[object Function]", genTag2 = "[object GeneratorFunction]", mapTag2 = "[object Map]", numberTag2 = "[object Number]", nullTag2 = "[object Null]", objectTag2 = "[object Object]", promiseTag2 = "[object Promise]", proxyTag2 = "[object Proxy]", regexpTag2 = "[object RegExp]", setTag2 = "[object Set]", stringTag2 = "[object String]", symbolTag2 = "[object Symbol]", undefinedTag2 = "[object Undefined]", weakMapTag2 = "[object WeakMap]";
  var arrayBufferTag2 = "[object ArrayBuffer]", dataViewTag2 = "[object DataView]", float32Tag2 = "[object Float32Array]", float64Tag2 = "[object Float64Array]", int8Tag2 = "[object Int8Array]", int16Tag2 = "[object Int16Array]", int32Tag2 = "[object Int32Array]", uint8Tag2 = "[object Uint8Array]", uint8ClampedTag2 = "[object Uint8ClampedArray]", uint16Tag2 = "[object Uint16Array]", uint32Tag2 = "[object Uint32Array]";
  var reRegExpChar2 = /[\\^$.*+?()[\]{}|]/g;
  var reIsHostCtor2 = /^\[object .+?Constructor\]$/;
  var reIsUint2 = /^(?:0|[1-9]\d*)$/;
  var typedArrayTags2 = {};
  typedArrayTags2[float32Tag2] = typedArrayTags2[float64Tag2] = typedArrayTags2[int8Tag2] = typedArrayTags2[int16Tag2] = typedArrayTags2[int32Tag2] = typedArrayTags2[uint8Tag2] = typedArrayTags2[uint8ClampedTag2] = typedArrayTags2[uint16Tag2] = typedArrayTags2[uint32Tag2] = true;
  typedArrayTags2[argsTag2] = typedArrayTags2[arrayTag2] = typedArrayTags2[arrayBufferTag2] = typedArrayTags2[boolTag2] = typedArrayTags2[dataViewTag2] = typedArrayTags2[dateTag2] = typedArrayTags2[errorTag2] = typedArrayTags2[funcTag2] = typedArrayTags2[mapTag2] = typedArrayTags2[numberTag2] = typedArrayTags2[objectTag2] = typedArrayTags2[regexpTag2] = typedArrayTags2[setTag2] = typedArrayTags2[stringTag2] = typedArrayTags2[weakMapTag2] = false;
  var freeGlobal2 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
  var freeSelf2 = typeof self == "object" && self && self.Object === Object && self;
  var root2 = freeGlobal2 || freeSelf2 || Function("return this")();
  var freeExports2 = exports2 && !exports2.nodeType && exports2;
  var freeModule2 = freeExports2 && true && module2 && !module2.nodeType && module2;
  var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
  var freeProcess2 = moduleExports2 && freeGlobal2.process;
  var nodeUtil2 = function() {
    try {
      return freeProcess2 && freeProcess2.binding && freeProcess2.binding("util");
    } catch (e2) {
    }
  }();
  var nodeIsTypedArray2 = nodeUtil2 && nodeUtil2.isTypedArray;
  function arrayFilter2(array4, predicate) {
    var index2 = -1, length2 = array4 == null ? 0 : array4.length, resIndex = 0, result = [];
    while (++index2 < length2) {
      var value2 = array4[index2];
      if (predicate(value2, index2, array4)) {
        result[resIndex++] = value2;
      }
    }
    return result;
  }
  function arrayPush2(array4, values) {
    var index2 = -1, length2 = values.length, offset2 = array4.length;
    while (++index2 < length2) {
      array4[offset2 + index2] = values[index2];
    }
    return array4;
  }
  function arraySome2(array4, predicate) {
    var index2 = -1, length2 = array4 == null ? 0 : array4.length;
    while (++index2 < length2) {
      if (predicate(array4[index2], index2, array4)) {
        return true;
      }
    }
    return false;
  }
  function baseTimes2(n2, iteratee) {
    var index2 = -1, result = Array(n2);
    while (++index2 < n2) {
      result[index2] = iteratee(index2);
    }
    return result;
  }
  function baseUnary2(func) {
    return function(value2) {
      return func(value2);
    };
  }
  function cacheHas2(cache2, key) {
    return cache2.has(key);
  }
  function getValue2(object4, key) {
    return object4 == null ? void 0 : object4[key];
  }
  function mapToArray2(map2) {
    var index2 = -1, result = Array(map2.size);
    map2.forEach(function(value2, key) {
      result[++index2] = [key, value2];
    });
    return result;
  }
  function overArg2(func, transform2) {
    return function(arg) {
      return func(transform2(arg));
    };
  }
  function setToArray2(set2) {
    var index2 = -1, result = Array(set2.size);
    set2.forEach(function(value2) {
      result[++index2] = value2;
    });
    return result;
  }
  var arrayProto2 = Array.prototype, funcProto2 = Function.prototype, objectProto2 = Object.prototype;
  var coreJsData2 = root2["__core-js_shared__"];
  var funcToString2 = funcProto2.toString;
  var hasOwnProperty2 = objectProto2.hasOwnProperty;
  var maskSrcKey2 = function() {
    var uid2 = /[^.]+$/.exec(coreJsData2 && coreJsData2.keys && coreJsData2.keys.IE_PROTO || "");
    return uid2 ? "Symbol(src)_1." + uid2 : "";
  }();
  var nativeObjectToString2 = objectProto2.toString;
  var reIsNative2 = RegExp(
    "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
  );
  var Buffer2 = moduleExports2 ? root2.Buffer : void 0, Symbol2 = root2.Symbol, Uint8Array2 = root2.Uint8Array, propertyIsEnumerable2 = objectProto2.propertyIsEnumerable, splice2 = arrayProto2.splice, symToStringTag2 = Symbol2 ? Symbol2.toStringTag : void 0;
  var nativeGetSymbols2 = Object.getOwnPropertySymbols, nativeIsBuffer2 = Buffer2 ? Buffer2.isBuffer : void 0, nativeKeys2 = overArg2(Object.keys, Object);
  var DataView2 = getNative2(root2, "DataView"), Map2 = getNative2(root2, "Map"), Promise2 = getNative2(root2, "Promise"), Set2 = getNative2(root2, "Set"), WeakMap2 = getNative2(root2, "WeakMap"), nativeCreate2 = getNative2(Object, "create");
  var dataViewCtorString2 = toSource2(DataView2), mapCtorString2 = toSource2(Map2), promiseCtorString2 = toSource2(Promise2), setCtorString2 = toSource2(Set2), weakMapCtorString2 = toSource2(WeakMap2);
  var symbolProto2 = Symbol2 ? Symbol2.prototype : void 0, symbolValueOf2 = symbolProto2 ? symbolProto2.valueOf : void 0;
  function Hash2(entries) {
    var index2 = -1, length2 = entries == null ? 0 : entries.length;
    this.clear();
    while (++index2 < length2) {
      var entry = entries[index2];
      this.set(entry[0], entry[1]);
    }
  }
  function hashClear2() {
    this.__data__ = nativeCreate2 ? nativeCreate2(null) : {};
    this.size = 0;
  }
  function hashDelete2(key) {
    var result = this.has(key) && delete this.__data__[key];
    this.size -= result ? 1 : 0;
    return result;
  }
  function hashGet2(key) {
    var data = this.__data__;
    if (nativeCreate2) {
      var result = data[key];
      return result === HASH_UNDEFINED2 ? void 0 : result;
    }
    return hasOwnProperty2.call(data, key) ? data[key] : void 0;
  }
  function hashHas2(key) {
    var data = this.__data__;
    return nativeCreate2 ? data[key] !== void 0 : hasOwnProperty2.call(data, key);
  }
  function hashSet2(key, value2) {
    var data = this.__data__;
    this.size += this.has(key) ? 0 : 1;
    data[key] = nativeCreate2 && value2 === void 0 ? HASH_UNDEFINED2 : value2;
    return this;
  }
  Hash2.prototype.clear = hashClear2;
  Hash2.prototype["delete"] = hashDelete2;
  Hash2.prototype.get = hashGet2;
  Hash2.prototype.has = hashHas2;
  Hash2.prototype.set = hashSet2;
  function ListCache2(entries) {
    var index2 = -1, length2 = entries == null ? 0 : entries.length;
    this.clear();
    while (++index2 < length2) {
      var entry = entries[index2];
      this.set(entry[0], entry[1]);
    }
  }
  function listCacheClear2() {
    this.__data__ = [];
    this.size = 0;
  }
  function listCacheDelete2(key) {
    var data = this.__data__, index2 = assocIndexOf2(data, key);
    if (index2 < 0) {
      return false;
    }
    var lastIndex = data.length - 1;
    if (index2 == lastIndex) {
      data.pop();
    } else {
      splice2.call(data, index2, 1);
    }
    --this.size;
    return true;
  }
  function listCacheGet2(key) {
    var data = this.__data__, index2 = assocIndexOf2(data, key);
    return index2 < 0 ? void 0 : data[index2][1];
  }
  function listCacheHas2(key) {
    return assocIndexOf2(this.__data__, key) > -1;
  }
  function listCacheSet2(key, value2) {
    var data = this.__data__, index2 = assocIndexOf2(data, key);
    if (index2 < 0) {
      ++this.size;
      data.push([key, value2]);
    } else {
      data[index2][1] = value2;
    }
    return this;
  }
  ListCache2.prototype.clear = listCacheClear2;
  ListCache2.prototype["delete"] = listCacheDelete2;
  ListCache2.prototype.get = listCacheGet2;
  ListCache2.prototype.has = listCacheHas2;
  ListCache2.prototype.set = listCacheSet2;
  function MapCache2(entries) {
    var index2 = -1, length2 = entries == null ? 0 : entries.length;
    this.clear();
    while (++index2 < length2) {
      var entry = entries[index2];
      this.set(entry[0], entry[1]);
    }
  }
  function mapCacheClear2() {
    this.size = 0;
    this.__data__ = {
      "hash": new Hash2(),
      "map": new (Map2 || ListCache2)(),
      "string": new Hash2()
    };
  }
  function mapCacheDelete2(key) {
    var result = getMapData2(this, key)["delete"](key);
    this.size -= result ? 1 : 0;
    return result;
  }
  function mapCacheGet2(key) {
    return getMapData2(this, key).get(key);
  }
  function mapCacheHas2(key) {
    return getMapData2(this, key).has(key);
  }
  function mapCacheSet2(key, value2) {
    var data = getMapData2(this, key), size2 = data.size;
    data.set(key, value2);
    this.size += data.size == size2 ? 0 : 1;
    return this;
  }
  MapCache2.prototype.clear = mapCacheClear2;
  MapCache2.prototype["delete"] = mapCacheDelete2;
  MapCache2.prototype.get = mapCacheGet2;
  MapCache2.prototype.has = mapCacheHas2;
  MapCache2.prototype.set = mapCacheSet2;
  function SetCache2(values) {
    var index2 = -1, length2 = values == null ? 0 : values.length;
    this.__data__ = new MapCache2();
    while (++index2 < length2) {
      this.add(values[index2]);
    }
  }
  function setCacheAdd2(value2) {
    this.__data__.set(value2, HASH_UNDEFINED2);
    return this;
  }
  function setCacheHas2(value2) {
    return this.__data__.has(value2);
  }
  SetCache2.prototype.add = SetCache2.prototype.push = setCacheAdd2;
  SetCache2.prototype.has = setCacheHas2;
  function Stack2(entries) {
    var data = this.__data__ = new ListCache2(entries);
    this.size = data.size;
  }
  function stackClear2() {
    this.__data__ = new ListCache2();
    this.size = 0;
  }
  function stackDelete2(key) {
    var data = this.__data__, result = data["delete"](key);
    this.size = data.size;
    return result;
  }
  function stackGet2(key) {
    return this.__data__.get(key);
  }
  function stackHas2(key) {
    return this.__data__.has(key);
  }
  function stackSet2(key, value2) {
    var data = this.__data__;
    if (data instanceof ListCache2) {
      var pairs = data.__data__;
      if (!Map2 || pairs.length < LARGE_ARRAY_SIZE2 - 1) {
        pairs.push([key, value2]);
        this.size = ++data.size;
        return this;
      }
      data = this.__data__ = new MapCache2(pairs);
    }
    data.set(key, value2);
    this.size = data.size;
    return this;
  }
  Stack2.prototype.clear = stackClear2;
  Stack2.prototype["delete"] = stackDelete2;
  Stack2.prototype.get = stackGet2;
  Stack2.prototype.has = stackHas2;
  Stack2.prototype.set = stackSet2;
  function arrayLikeKeys2(value2, inherited) {
    var isArr = isArray3(value2), isArg = !isArr && isArguments2(value2), isBuff = !isArr && !isArg && isBuffer2(value2), isType = !isArr && !isArg && !isBuff && isTypedArray2(value2), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes2(value2.length, String) : [], length2 = result.length;
    for (var key in value2) {
      if (hasOwnProperty2.call(value2, key) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
      (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
      isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
      isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
      isIndex2(key, length2)))) {
        result.push(key);
      }
    }
    return result;
  }
  function assocIndexOf2(array4, key) {
    var length2 = array4.length;
    while (length2--) {
      if (eq2(array4[length2][0], key)) {
        return length2;
      }
    }
    return -1;
  }
  function baseGetAllKeys2(object4, keysFunc, symbolsFunc) {
    var result = keysFunc(object4);
    return isArray3(object4) ? result : arrayPush2(result, symbolsFunc(object4));
  }
  function baseGetTag2(value2) {
    if (value2 == null) {
      return value2 === void 0 ? undefinedTag2 : nullTag2;
    }
    return symToStringTag2 && symToStringTag2 in Object(value2) ? getRawTag2(value2) : objectToString2(value2);
  }
  function baseIsArguments2(value2) {
    return isObjectLike2(value2) && baseGetTag2(value2) == argsTag2;
  }
  function baseIsEqual2(value2, other, bitmask, customizer, stack) {
    if (value2 === other) {
      return true;
    }
    if (value2 == null || other == null || !isObjectLike2(value2) && !isObjectLike2(other)) {
      return value2 !== value2 && other !== other;
    }
    return baseIsEqualDeep2(value2, other, bitmask, customizer, baseIsEqual2, stack);
  }
  function baseIsEqualDeep2(object4, other, bitmask, customizer, equalFunc, stack) {
    var objIsArr = isArray3(object4), othIsArr = isArray3(other), objTag = objIsArr ? arrayTag2 : getTag2(object4), othTag = othIsArr ? arrayTag2 : getTag2(other);
    objTag = objTag == argsTag2 ? objectTag2 : objTag;
    othTag = othTag == argsTag2 ? objectTag2 : othTag;
    var objIsObj = objTag == objectTag2, othIsObj = othTag == objectTag2, isSameTag = objTag == othTag;
    if (isSameTag && isBuffer2(object4)) {
      if (!isBuffer2(other)) {
        return false;
      }
      objIsArr = true;
      objIsObj = false;
    }
    if (isSameTag && !objIsObj) {
      stack || (stack = new Stack2());
      return objIsArr || isTypedArray2(object4) ? equalArrays2(object4, other, bitmask, customizer, equalFunc, stack) : equalByTag2(object4, other, objTag, bitmask, customizer, equalFunc, stack);
    }
    if (!(bitmask & COMPARE_PARTIAL_FLAG2)) {
      var objIsWrapped = objIsObj && hasOwnProperty2.call(object4, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty2.call(other, "__wrapped__");
      if (objIsWrapped || othIsWrapped) {
        var objUnwrapped = objIsWrapped ? object4.value() : object4, othUnwrapped = othIsWrapped ? other.value() : other;
        stack || (stack = new Stack2());
        return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
      }
    }
    if (!isSameTag) {
      return false;
    }
    stack || (stack = new Stack2());
    return equalObjects2(object4, other, bitmask, customizer, equalFunc, stack);
  }
  function baseIsNative2(value2) {
    if (!isObject2(value2) || isMasked2(value2)) {
      return false;
    }
    var pattern4 = isFunction2(value2) ? reIsNative2 : reIsHostCtor2;
    return pattern4.test(toSource2(value2));
  }
  function baseIsTypedArray2(value2) {
    return isObjectLike2(value2) && isLength2(value2.length) && !!typedArrayTags2[baseGetTag2(value2)];
  }
  function baseKeys2(object4) {
    if (!isPrototype2(object4)) {
      return nativeKeys2(object4);
    }
    var result = [];
    for (var key in Object(object4)) {
      if (hasOwnProperty2.call(object4, key) && key != "constructor") {
        result.push(key);
      }
    }
    return result;
  }
  function equalArrays2(array4, other, bitmask, customizer, equalFunc, stack) {
    var isPartial = bitmask & COMPARE_PARTIAL_FLAG2, arrLength = array4.length, othLength = other.length;
    if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
      return false;
    }
    var stacked = stack.get(array4);
    if (stacked && stack.get(other)) {
      return stacked == other;
    }
    var index2 = -1, result = true, seen2 = bitmask & COMPARE_UNORDERED_FLAG2 ? new SetCache2() : void 0;
    stack.set(array4, other);
    stack.set(other, array4);
    while (++index2 < arrLength) {
      var arrValue = array4[index2], othValue = other[index2];
      if (customizer) {
        var compared = isPartial ? customizer(othValue, arrValue, index2, other, array4, stack) : customizer(arrValue, othValue, index2, array4, other, stack);
      }
      if (compared !== void 0) {
        if (compared) {
          continue;
        }
        result = false;
        break;
      }
      if (seen2) {
        if (!arraySome2(other, function(othValue2, othIndex) {
          if (!cacheHas2(seen2, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
            return seen2.push(othIndex);
          }
        })) {
          result = false;
          break;
        }
      } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
        result = false;
        break;
      }
    }
    stack["delete"](array4);
    stack["delete"](other);
    return result;
  }
  function equalByTag2(object4, other, tag, bitmask, customizer, equalFunc, stack) {
    switch (tag) {
      case dataViewTag2:
        if (object4.byteLength != other.byteLength || object4.byteOffset != other.byteOffset) {
          return false;
        }
        object4 = object4.buffer;
        other = other.buffer;
      case arrayBufferTag2:
        if (object4.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object4), new Uint8Array2(other))) {
          return false;
        }
        return true;
      case boolTag2:
      case dateTag2:
      case numberTag2:
        return eq2(+object4, +other);
      case errorTag2:
        return object4.name == other.name && object4.message == other.message;
      case regexpTag2:
      case stringTag2:
        return object4 == other + "";
      case mapTag2:
        var convert2 = mapToArray2;
      case setTag2:
        var isPartial = bitmask & COMPARE_PARTIAL_FLAG2;
        convert2 || (convert2 = setToArray2);
        if (object4.size != other.size && !isPartial) {
          return false;
        }
        var stacked = stack.get(object4);
        if (stacked) {
          return stacked == other;
        }
        bitmask |= COMPARE_UNORDERED_FLAG2;
        stack.set(object4, other);
        var result = equalArrays2(convert2(object4), convert2(other), bitmask, customizer, equalFunc, stack);
        stack["delete"](object4);
        return result;
      case symbolTag2:
        if (symbolValueOf2) {
          return symbolValueOf2.call(object4) == symbolValueOf2.call(other);
        }
    }
    return false;
  }
  function equalObjects2(object4, other, bitmask, customizer, equalFunc, stack) {
    var isPartial = bitmask & COMPARE_PARTIAL_FLAG2, objProps = getAllKeys2(object4), objLength = objProps.length, othProps = getAllKeys2(other), othLength = othProps.length;
    if (objLength != othLength && !isPartial) {
      return false;
    }
    var index2 = objLength;
    while (index2--) {
      var key = objProps[index2];
      if (!(isPartial ? key in other : hasOwnProperty2.call(other, key))) {
        return false;
      }
    }
    var stacked = stack.get(object4);
    if (stacked && stack.get(other)) {
      return stacked == other;
    }
    var result = true;
    stack.set(object4, other);
    stack.set(other, object4);
    var skipCtor = isPartial;
    while (++index2 < objLength) {
      key = objProps[index2];
      var objValue = object4[key], othValue = other[key];
      if (customizer) {
        var compared = isPartial ? customizer(othValue, objValue, key, other, object4, stack) : customizer(objValue, othValue, key, object4, other, stack);
      }
      if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
        result = false;
        break;
      }
      skipCtor || (skipCtor = key == "constructor");
    }
    if (result && !skipCtor) {
      var objCtor = object4.constructor, othCtor = other.constructor;
      if (objCtor != othCtor && ("constructor" in object4 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
        result = false;
      }
    }
    stack["delete"](object4);
    stack["delete"](other);
    return result;
  }
  function getAllKeys2(object4) {
    return baseGetAllKeys2(object4, keys2, getSymbols2);
  }
  function getMapData2(map2, key) {
    var data = map2.__data__;
    return isKeyable2(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
  }
  function getNative2(object4, key) {
    var value2 = getValue2(object4, key);
    return baseIsNative2(value2) ? value2 : void 0;
  }
  function getRawTag2(value2) {
    var isOwn = hasOwnProperty2.call(value2, symToStringTag2), tag = value2[symToStringTag2];
    try {
      value2[symToStringTag2] = void 0;
      var unmasked = true;
    } catch (e2) {
    }
    var result = nativeObjectToString2.call(value2);
    if (unmasked) {
      if (isOwn) {
        value2[symToStringTag2] = tag;
      } else {
        delete value2[symToStringTag2];
      }
    }
    return result;
  }
  var getSymbols2 = !nativeGetSymbols2 ? stubArray2 : function(object4) {
    if (object4 == null) {
      return [];
    }
    object4 = Object(object4);
    return arrayFilter2(nativeGetSymbols2(object4), function(symbol) {
      return propertyIsEnumerable2.call(object4, symbol);
    });
  };
  var getTag2 = baseGetTag2;
  if (DataView2 && getTag2(new DataView2(new ArrayBuffer(1))) != dataViewTag2 || Map2 && getTag2(new Map2()) != mapTag2 || Promise2 && getTag2(Promise2.resolve()) != promiseTag2 || Set2 && getTag2(new Set2()) != setTag2 || WeakMap2 && getTag2(new WeakMap2()) != weakMapTag2) {
    getTag2 = function(value2) {
      var result = baseGetTag2(value2), Ctor = result == objectTag2 ? value2.constructor : void 0, ctorString = Ctor ? toSource2(Ctor) : "";
      if (ctorString) {
        switch (ctorString) {
          case dataViewCtorString2:
            return dataViewTag2;
          case mapCtorString2:
            return mapTag2;
          case promiseCtorString2:
            return promiseTag2;
          case setCtorString2:
            return setTag2;
          case weakMapCtorString2:
            return weakMapTag2;
        }
      }
      return result;
    };
  }
  function isIndex2(value2, length2) {
    length2 = length2 == null ? MAX_SAFE_INTEGER2 : length2;
    return !!length2 && (typeof value2 == "number" || reIsUint2.test(value2)) && (value2 > -1 && value2 % 1 == 0 && value2 < length2);
  }
  function isKeyable2(value2) {
    var type4 = typeof value2;
    return type4 == "string" || type4 == "number" || type4 == "symbol" || type4 == "boolean" ? value2 !== "__proto__" : value2 === null;
  }
  function isMasked2(func) {
    return !!maskSrcKey2 && maskSrcKey2 in func;
  }
  function isPrototype2(value2) {
    var Ctor = value2 && value2.constructor, proto2 = typeof Ctor == "function" && Ctor.prototype || objectProto2;
    return value2 === proto2;
  }
  function objectToString2(value2) {
    return nativeObjectToString2.call(value2);
  }
  function toSource2(func) {
    if (func != null) {
      try {
        return funcToString2.call(func);
      } catch (e2) {
      }
      try {
        return func + "";
      } catch (e2) {
      }
    }
    return "";
  }
  function eq2(value2, other) {
    return value2 === other || value2 !== value2 && other !== other;
  }
  var isArguments2 = baseIsArguments2(/* @__PURE__ */ function() {
    return arguments;
  }()) ? baseIsArguments2 : function(value2) {
    return isObjectLike2(value2) && hasOwnProperty2.call(value2, "callee") && !propertyIsEnumerable2.call(value2, "callee");
  };
  var isArray3 = Array.isArray;
  function isArrayLike2(value2) {
    return value2 != null && isLength2(value2.length) && !isFunction2(value2);
  }
  var isBuffer2 = nativeIsBuffer2 || stubFalse2;
  function isEqual2(value2, other) {
    return baseIsEqual2(value2, other);
  }
  function isFunction2(value2) {
    if (!isObject2(value2)) {
      return false;
    }
    var tag = baseGetTag2(value2);
    return tag == funcTag2 || tag == genTag2 || tag == asyncTag2 || tag == proxyTag2;
  }
  function isLength2(value2) {
    return typeof value2 == "number" && value2 > -1 && value2 % 1 == 0 && value2 <= MAX_SAFE_INTEGER2;
  }
  function isObject2(value2) {
    var type4 = typeof value2;
    return value2 != null && (type4 == "object" || type4 == "function");
  }
  function isObjectLike2(value2) {
    return value2 != null && typeof value2 == "object";
  }
  var isTypedArray2 = nodeIsTypedArray2 ? baseUnary2(nodeIsTypedArray2) : baseIsTypedArray2;
  function keys2(object4) {
    return isArrayLike2(object4) ? arrayLikeKeys2(object4) : baseKeys2(object4);
  }
  function stubArray2() {
    return [];
  }
  function stubFalse2() {
    return false;
  }
  module2.exports = isEqual2;
})(lodash_isequal, lodash_isequal.exports);
var lodash_isequalExports = lodash_isequal.exports;
var editorOptions$1 = {};
Object.defineProperty(editorOptions$1, "__esModule", { value: true });
editorOptions$1.getAceInstance = editorOptions$1.debounce = editorOptions$1.editorEvents = editorOptions$1.editorOptions = void 0;
var editorOptions = [
  "minLines",
  "maxLines",
  "readOnly",
  "highlightActiveLine",
  "tabSize",
  "enableBasicAutocompletion",
  "enableLiveAutocompletion",
  "enableSnippets"
];
editorOptions$1.editorOptions = editorOptions;
var editorEvents = [
  "onChange",
  "onFocus",
  "onInput",
  "onBlur",
  "onCopy",
  "onPaste",
  "onSelectionChange",
  "onCursorChange",
  "onScroll",
  "handleOptions",
  "updateRef"
];
editorOptions$1.editorEvents = editorEvents;
var getAceInstance = function() {
  var ace2;
  if (typeof window === "undefined") {
    commonjsGlobal.window = {};
    ace2 = aceExports;
    delete commonjsGlobal.window;
  } else if (window.ace) {
    ace2 = window.ace;
    ace2.acequire = window.ace.require || window.ace.acequire;
  } else {
    ace2 = aceExports;
  }
  return ace2;
};
editorOptions$1.getAceInstance = getAceInstance;
var debounce = function(fn, delay2) {
  var timer = null;
  return function() {
    var context = this;
    var args = arguments;
    clearTimeout(timer);
    timer = setTimeout(function() {
      fn.apply(context, args);
    }, delay2);
  };
};
editorOptions$1.debounce = debounce;
var __extends$3 = commonjsGlobal && commonjsGlobal.__extends || /* @__PURE__ */ function() {
  var extendStatics = function(d2, b2) {
    extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
      d3.__proto__ = b3;
    } || function(d3, b3) {
      for (var p2 in b3)
        if (Object.prototype.hasOwnProperty.call(b3, p2))
          d3[p2] = b3[p2];
    };
    return extendStatics(d2, b2);
  };
  return function(d2, b2) {
    if (typeof b2 !== "function" && b2 !== null)
      throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
    extendStatics(d2, b2);
    function __() {
      this.constructor = d2;
    }
    d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
  };
}();
var __assign$2 = commonjsGlobal && commonjsGlobal.__assign || function() {
  __assign$2 = Object.assign || function(t2) {
    for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
      s2 = arguments[i2];
      for (var p2 in s2)
        if (Object.prototype.hasOwnProperty.call(s2, p2))
          t2[p2] = s2[p2];
    }
    return t2;
  };
  return __assign$2.apply(this, arguments);
};
Object.defineProperty(ace$4, "__esModule", { value: true });
var ace_builds_1$1 = aceExports;
var PropTypes$3 = propTypesExports;
var React$3 = reactExports;
var isEqual$1 = lodash_isequalExports;
var editorOptions_1$1 = editorOptions$1;
var ace$2 = (0, editorOptions_1$1.getAceInstance)();
var ReactAce = (
  /** @class */
  function(_super) {
    __extends$3(ReactAce2, _super);
    function ReactAce2(props) {
      var _this = _super.call(this, props) || this;
      editorOptions_1$1.editorEvents.forEach(function(method4) {
        _this[method4] = _this[method4].bind(_this);
      });
      _this.debounce = editorOptions_1$1.debounce;
      return _this;
    }
    ReactAce2.prototype.isInShadow = function(node2) {
      var parent = node2 && node2.parentNode;
      while (parent) {
        if (parent.toString() === "[object ShadowRoot]") {
          return true;
        }
        parent = parent.parentNode;
      }
      return false;
    };
    ReactAce2.prototype.componentDidMount = function() {
      var _this = this;
      var _a2 = this.props, className = _a2.className, onBeforeLoad = _a2.onBeforeLoad, onValidate = _a2.onValidate, mode = _a2.mode, focus = _a2.focus, theme2 = _a2.theme, fontSize = _a2.fontSize, lineHeight2 = _a2.lineHeight, value2 = _a2.value, defaultValue2 = _a2.defaultValue, showGutter = _a2.showGutter, wrapEnabled = _a2.wrapEnabled, showPrintMargin = _a2.showPrintMargin, _b2 = _a2.scrollMargin, scrollMargin = _b2 === void 0 ? [0, 0, 0, 0] : _b2, keyboardHandler = _a2.keyboardHandler, onLoad = _a2.onLoad, commands = _a2.commands, annotations = _a2.annotations, markers = _a2.markers, placeholder = _a2.placeholder;
      this.editor = ace$2.edit(this.refEditor);
      if (onBeforeLoad) {
        onBeforeLoad(ace$2);
      }
      var editorProps = Object.keys(this.props.editorProps);
      for (var i2 = 0; i2 < editorProps.length; i2++) {
        this.editor[editorProps[i2]] = this.props.editorProps[editorProps[i2]];
      }
      if (this.props.debounceChangePeriod) {
        this.onChange = this.debounce(this.onChange, this.props.debounceChangePeriod);
      }
      this.editor.renderer.setScrollMargin(scrollMargin[0], scrollMargin[1], scrollMargin[2], scrollMargin[3]);
      if (this.isInShadow(this.refEditor)) {
        this.editor.renderer.attachToShadowRoot();
      }
      this.editor.getSession().setMode(typeof mode === "string" ? "ace/mode/".concat(mode) : mode);
      if (theme2 && theme2 !== "")
        this.editor.setTheme("ace/theme/".concat(theme2));
      this.editor.setFontSize(typeof fontSize === "number" ? "".concat(fontSize, "px") : fontSize);
      if (lineHeight2) {
        this.editor.container.style.lineHeight = typeof lineHeight2 === "number" ? "".concat(lineHeight2, "px") : "".concat(lineHeight2);
        this.editor.renderer.updateFontSize();
      }
      this.editor.getSession().setValue(!defaultValue2 ? value2 || "" : defaultValue2);
      if (this.props.navigateToFileEnd) {
        this.editor.navigateFileEnd();
      }
      this.editor.renderer.setShowGutter(showGutter);
      this.editor.getSession().setUseWrapMode(wrapEnabled);
      this.editor.setShowPrintMargin(showPrintMargin);
      this.editor.on("focus", this.onFocus);
      this.editor.on("blur", this.onBlur);
      this.editor.on("copy", this.onCopy);
      this.editor.on("paste", this.onPaste);
      this.editor.on("change", this.onChange);
      this.editor.on("input", this.onInput);
      if (placeholder) {
        this.updatePlaceholder();
      }
      this.editor.getSession().selection.on("changeSelection", this.onSelectionChange);
      this.editor.getSession().selection.on("changeCursor", this.onCursorChange);
      if (onValidate) {
        this.editor.getSession().on("changeAnnotation", function() {
          var annotations2 = _this.editor.getSession().getAnnotations();
          _this.props.onValidate(annotations2);
        });
      }
      this.editor.session.on("changeScrollTop", this.onScroll);
      this.editor.getSession().setAnnotations(annotations || []);
      if (markers && markers.length > 0) {
        this.handleMarkers(markers);
      }
      var availableOptions = this.editor.$options;
      editorOptions_1$1.editorOptions.forEach(function(option) {
        if (availableOptions.hasOwnProperty(option)) {
          _this.editor.setOption(option, _this.props[option]);
        } else if (_this.props[option]) {
          console.warn("ReactAce: editor option ".concat(option, " was activated but not found. Did you need to import a related tool or did you possibly mispell the option?"));
        }
      });
      this.handleOptions(this.props);
      if (Array.isArray(commands)) {
        commands.forEach(function(command) {
          if (typeof command.exec === "string") {
            _this.editor.commands.bindKey(command.bindKey, command.exec);
          } else {
            _this.editor.commands.addCommand(command);
          }
        });
      }
      if (keyboardHandler) {
        this.editor.setKeyboardHandler("ace/keyboard/" + keyboardHandler);
      }
      if (className) {
        this.refEditor.className += " " + className;
      }
      if (onLoad) {
        onLoad(this.editor);
      }
      this.editor.resize();
      if (focus) {
        this.editor.focus();
      }
    };
    ReactAce2.prototype.componentDidUpdate = function(prevProps) {
      var oldProps = prevProps;
      var nextProps = this.props;
      for (var i2 = 0; i2 < editorOptions_1$1.editorOptions.length; i2++) {
        var option = editorOptions_1$1.editorOptions[i2];
        if (nextProps[option] !== oldProps[option]) {
          this.editor.setOption(option, nextProps[option]);
        }
      }
      if (nextProps.className !== oldProps.className) {
        var appliedClasses = this.refEditor.className;
        var appliedClassesArray_1 = appliedClasses.trim().split(" ");
        var oldClassesArray = oldProps.className.trim().split(" ");
        oldClassesArray.forEach(function(oldClass) {
          var index2 = appliedClassesArray_1.indexOf(oldClass);
          appliedClassesArray_1.splice(index2, 1);
        });
        this.refEditor.className = " " + nextProps.className + " " + appliedClassesArray_1.join(" ");
      }
      var valueChanged = this.editor && nextProps.value != null && this.editor.getValue() !== nextProps.value;
      if (valueChanged) {
        this.silent = true;
        var pos = this.editor.session.selection.toJSON();
        this.editor.setValue(nextProps.value, nextProps.cursorStart);
        this.editor.session.selection.fromJSON(pos);
        this.silent = false;
      }
      if (nextProps.placeholder !== oldProps.placeholder) {
        this.updatePlaceholder();
      }
      if (nextProps.mode !== oldProps.mode) {
        this.editor.getSession().setMode(typeof nextProps.mode === "string" ? "ace/mode/".concat(nextProps.mode) : nextProps.mode);
      }
      if (nextProps.theme !== oldProps.theme) {
        this.editor.setTheme("ace/theme/" + nextProps.theme);
      }
      if (nextProps.keyboardHandler !== oldProps.keyboardHandler) {
        if (nextProps.keyboardHandler) {
          this.editor.setKeyboardHandler("ace/keyboard/" + nextProps.keyboardHandler);
        } else {
          this.editor.setKeyboardHandler(null);
        }
      }
      if (nextProps.fontSize !== oldProps.fontSize) {
        this.editor.setFontSize(typeof nextProps.fontSize === "number" ? "".concat(nextProps.fontSize, "px") : nextProps.fontSize);
      }
      if (nextProps.lineHeight !== oldProps.lineHeight) {
        this.editor.container.style.lineHeight = typeof nextProps.lineHeight === "number" ? "".concat(nextProps.lineHeight, "px") : nextProps.lineHeight;
        this.editor.renderer.updateFontSize();
      }
      if (nextProps.wrapEnabled !== oldProps.wrapEnabled) {
        this.editor.getSession().setUseWrapMode(nextProps.wrapEnabled);
      }
      if (nextProps.showPrintMargin !== oldProps.showPrintMargin) {
        this.editor.setShowPrintMargin(nextProps.showPrintMargin);
      }
      if (nextProps.showGutter !== oldProps.showGutter) {
        this.editor.renderer.setShowGutter(nextProps.showGutter);
      }
      if (!isEqual$1(nextProps.setOptions, oldProps.setOptions)) {
        this.handleOptions(nextProps);
      }
      if (valueChanged || !isEqual$1(nextProps.annotations, oldProps.annotations)) {
        this.editor.getSession().setAnnotations(nextProps.annotations || []);
      }
      if (!isEqual$1(nextProps.markers, oldProps.markers) && Array.isArray(nextProps.markers)) {
        this.handleMarkers(nextProps.markers);
      }
      if (!isEqual$1(nextProps.scrollMargin, oldProps.scrollMargin)) {
        this.handleScrollMargins(nextProps.scrollMargin);
      }
      if (prevProps.height !== this.props.height || prevProps.width !== this.props.width) {
        this.editor.resize();
      }
      if (this.props.focus && !prevProps.focus) {
        this.editor.focus();
      }
    };
    ReactAce2.prototype.handleScrollMargins = function(margins) {
      if (margins === void 0) {
        margins = [0, 0, 0, 0];
      }
      this.editor.renderer.setScrollMargin(margins[0], margins[1], margins[2], margins[3]);
    };
    ReactAce2.prototype.componentWillUnmount = function() {
      if (this.editor) {
        this.editor.destroy();
        this.editor = null;
      }
    };
    ReactAce2.prototype.onChange = function(event) {
      if (this.props.onChange && !this.silent) {
        var value2 = this.editor.getValue();
        this.props.onChange(value2, event);
      }
    };
    ReactAce2.prototype.onSelectionChange = function(event) {
      if (this.props.onSelectionChange) {
        var value2 = this.editor.getSelection();
        this.props.onSelectionChange(value2, event);
      }
    };
    ReactAce2.prototype.onCursorChange = function(event) {
      if (this.props.onCursorChange) {
        var value2 = this.editor.getSelection();
        this.props.onCursorChange(value2, event);
      }
    };
    ReactAce2.prototype.onInput = function(event) {
      if (this.props.onInput) {
        this.props.onInput(event);
      }
      if (this.props.placeholder) {
        this.updatePlaceholder();
      }
    };
    ReactAce2.prototype.onFocus = function(event) {
      if (this.props.onFocus) {
        this.props.onFocus(event, this.editor);
      }
    };
    ReactAce2.prototype.onBlur = function(event) {
      if (this.props.onBlur) {
        this.props.onBlur(event, this.editor);
      }
    };
    ReactAce2.prototype.onCopy = function(_a2) {
      var text2 = _a2.text;
      if (this.props.onCopy) {
        this.props.onCopy(text2);
      }
    };
    ReactAce2.prototype.onPaste = function(_a2) {
      var text2 = _a2.text;
      if (this.props.onPaste) {
        this.props.onPaste(text2);
      }
    };
    ReactAce2.prototype.onScroll = function() {
      if (this.props.onScroll) {
        this.props.onScroll(this.editor);
      }
    };
    ReactAce2.prototype.handleOptions = function(props) {
      var setOptions2 = Object.keys(props.setOptions);
      for (var y2 = 0; y2 < setOptions2.length; y2++) {
        this.editor.setOption(setOptions2[y2], props.setOptions[setOptions2[y2]]);
      }
    };
    ReactAce2.prototype.handleMarkers = function(markers) {
      var _this = this;
      var currentMarkers = this.editor.getSession().getMarkers(true);
      for (var i2 in currentMarkers) {
        if (currentMarkers.hasOwnProperty(i2)) {
          this.editor.getSession().removeMarker(currentMarkers[i2].id);
        }
      }
      currentMarkers = this.editor.getSession().getMarkers(false);
      for (var i2 in currentMarkers) {
        if (currentMarkers.hasOwnProperty(i2) && currentMarkers[i2].clazz !== "ace_active-line" && currentMarkers[i2].clazz !== "ace_selected-word") {
          this.editor.getSession().removeMarker(currentMarkers[i2].id);
        }
      }
      markers.forEach(function(_a2) {
        var startRow = _a2.startRow, startCol = _a2.startCol, endRow = _a2.endRow, endCol = _a2.endCol, className = _a2.className, type4 = _a2.type, _b2 = _a2.inFront, inFront = _b2 === void 0 ? false : _b2;
        var range3 = new ace_builds_1$1.Range(startRow, startCol, endRow, endCol);
        _this.editor.getSession().addMarker(range3, className, type4, inFront);
      });
    };
    ReactAce2.prototype.updatePlaceholder = function() {
      var editor2 = this.editor;
      var placeholder = this.props.placeholder;
      var showPlaceholder = !editor2.session.getValue().length;
      var node2 = editor2.renderer.placeholderNode;
      if (!showPlaceholder && node2) {
        editor2.renderer.scroller.removeChild(editor2.renderer.placeholderNode);
        editor2.renderer.placeholderNode = null;
      } else if (showPlaceholder && !node2) {
        node2 = editor2.renderer.placeholderNode = document.createElement("div");
        node2.textContent = placeholder || "";
        node2.className = "ace_comment ace_placeholder";
        node2.style.padding = "0 9px";
        node2.style.position = "absolute";
        node2.style.zIndex = "3";
        editor2.renderer.scroller.appendChild(node2);
      } else if (showPlaceholder && node2) {
        node2.textContent = placeholder;
      }
    };
    ReactAce2.prototype.updateRef = function(item) {
      this.refEditor = item;
    };
    ReactAce2.prototype.render = function() {
      var _a2 = this.props, name2 = _a2.name, width = _a2.width, height = _a2.height, style2 = _a2.style;
      var divStyle = __assign$2({ width, height }, style2);
      return React$3.createElement("div", { ref: this.updateRef, id: name2, style: divStyle });
    };
    ReactAce2.propTypes = {
      mode: PropTypes$3.oneOfType([PropTypes$3.string, PropTypes$3.object]),
      focus: PropTypes$3.bool,
      theme: PropTypes$3.string,
      name: PropTypes$3.string,
      className: PropTypes$3.string,
      height: PropTypes$3.string,
      width: PropTypes$3.string,
      fontSize: PropTypes$3.oneOfType([PropTypes$3.number, PropTypes$3.string]),
      lineHeight: PropTypes$3.oneOfType([PropTypes$3.number, PropTypes$3.string]),
      showGutter: PropTypes$3.bool,
      onChange: PropTypes$3.func,
      onCopy: PropTypes$3.func,
      onPaste: PropTypes$3.func,
      onFocus: PropTypes$3.func,
      onInput: PropTypes$3.func,
      onBlur: PropTypes$3.func,
      onScroll: PropTypes$3.func,
      value: PropTypes$3.string,
      defaultValue: PropTypes$3.string,
      onLoad: PropTypes$3.func,
      onSelectionChange: PropTypes$3.func,
      onCursorChange: PropTypes$3.func,
      onBeforeLoad: PropTypes$3.func,
      onValidate: PropTypes$3.func,
      minLines: PropTypes$3.number,
      maxLines: PropTypes$3.number,
      readOnly: PropTypes$3.bool,
      highlightActiveLine: PropTypes$3.bool,
      tabSize: PropTypes$3.number,
      showPrintMargin: PropTypes$3.bool,
      cursorStart: PropTypes$3.number,
      debounceChangePeriod: PropTypes$3.number,
      editorProps: PropTypes$3.object,
      setOptions: PropTypes$3.object,
      style: PropTypes$3.object,
      scrollMargin: PropTypes$3.array,
      annotations: PropTypes$3.array,
      markers: PropTypes$3.array,
      keyboardHandler: PropTypes$3.string,
      wrapEnabled: PropTypes$3.bool,
      enableSnippets: PropTypes$3.bool,
      enableBasicAutocompletion: PropTypes$3.oneOfType([
        PropTypes$3.bool,
        PropTypes$3.array
      ]),
      enableLiveAutocompletion: PropTypes$3.oneOfType([
        PropTypes$3.bool,
        PropTypes$3.array
      ]),
      navigateToFileEnd: PropTypes$3.bool,
      commands: PropTypes$3.array,
      placeholder: PropTypes$3.string
    };
    ReactAce2.defaultProps = {
      name: "ace-editor",
      focus: false,
      mode: "",
      theme: "",
      height: "500px",
      width: "500px",
      fontSize: 12,
      enableSnippets: false,
      showGutter: true,
      onChange: null,
      onPaste: null,
      onLoad: null,
      onScroll: null,
      minLines: null,
      maxLines: null,
      readOnly: false,
      highlightActiveLine: true,
      showPrintMargin: true,
      tabSize: 4,
      cursorStart: 1,
      editorProps: {},
      style: {},
      scrollMargin: [0, 0, 0, 0],
      setOptions: {},
      wrapEnabled: false,
      enableBasicAutocompletion: false,
      enableLiveAutocompletion: false,
      placeholder: null,
      navigateToFileEnd: true
    };
    return ReactAce2;
  }(React$3.Component)
);
ace$4.default = ReactAce;
var diff$2 = {};
var split = {};
var extSplit = { exports: {} };
(function(module2, exports2) {
  ace.define("ace/split", ["require", "exports", "module", "ace/lib/oop", "ace/lib/lang", "ace/lib/event_emitter", "ace/editor", "ace/virtual_renderer", "ace/edit_session"], function(require2, exports3, module3) {
    var oop = require2("./lib/oop");
    require2("./lib/lang");
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var Editor2 = require2("./editor").Editor;
    var Renderer = require2("./virtual_renderer").VirtualRenderer;
    var EditSession = require2("./edit_session").EditSession;
    var Split;
    Split = function(container, theme2, splits) {
      this.BELOW = 1;
      this.BESIDE = 0;
      this.$container = container;
      this.$theme = theme2;
      this.$splits = 0;
      this.$editorCSS = "";
      this.$editors = [];
      this.$orientation = this.BESIDE;
      this.setSplits(splits || 1);
      this.$cEditor = this.$editors[0];
      this.on("focus", (function(editor2) {
        this.$cEditor = editor2;
      }).bind(this));
    };
    (function() {
      oop.implement(this, EventEmitter2);
      this.$createEditor = function() {
        var el2 = document.createElement("div");
        el2.className = this.$editorCSS;
        el2.style.cssText = "position: absolute; top:0px; bottom:0px";
        this.$container.appendChild(el2);
        var editor2 = new Editor2(new Renderer(el2, this.$theme));
        editor2.on("focus", (function() {
          this._emit("focus", editor2);
        }).bind(this));
        this.$editors.push(editor2);
        editor2.setFontSize(this.$fontSize);
        return editor2;
      };
      this.setSplits = function(splits) {
        var editor2;
        if (splits < 1) {
          throw "The number of splits have to be > 0!";
        }
        if (splits == this.$splits) {
          return;
        } else if (splits > this.$splits) {
          while (this.$splits < this.$editors.length && this.$splits < splits) {
            editor2 = this.$editors[this.$splits];
            this.$container.appendChild(editor2.container);
            editor2.setFontSize(this.$fontSize);
            this.$splits++;
          }
          while (this.$splits < splits) {
            this.$createEditor();
            this.$splits++;
          }
        } else {
          while (this.$splits > splits) {
            editor2 = this.$editors[this.$splits - 1];
            this.$container.removeChild(editor2.container);
            this.$splits--;
          }
        }
        this.resize();
      };
      this.getSplits = function() {
        return this.$splits;
      };
      this.getEditor = function(idx) {
        return this.$editors[idx];
      };
      this.getCurrentEditor = function() {
        return this.$cEditor;
      };
      this.focus = function() {
        this.$cEditor.focus();
      };
      this.blur = function() {
        this.$cEditor.blur();
      };
      this.setTheme = function(theme2) {
        this.$editors.forEach(function(editor2) {
          editor2.setTheme(theme2);
        });
      };
      this.setKeyboardHandler = function(keybinding) {
        this.$editors.forEach(function(editor2) {
          editor2.setKeyboardHandler(keybinding);
        });
      };
      this.forEach = function(callback2, scope) {
        this.$editors.forEach(callback2, scope);
      };
      this.$fontSize = "";
      this.setFontSize = function(size2) {
        this.$fontSize = size2;
        this.forEach(function(editor2) {
          editor2.setFontSize(size2);
        });
      };
      this.$cloneSession = function(session) {
        var s2 = new EditSession(session.getDocument(), session.getMode());
        var undoManager = session.getUndoManager();
        s2.setUndoManager(undoManager);
        s2.setTabSize(session.getTabSize());
        s2.setUseSoftTabs(session.getUseSoftTabs());
        s2.setOverwrite(session.getOverwrite());
        s2.setBreakpoints(session.getBreakpoints());
        s2.setUseWrapMode(session.getUseWrapMode());
        s2.setUseWorker(session.getUseWorker());
        s2.setWrapLimitRange(session.$wrapLimitRange.min, session.$wrapLimitRange.max);
        s2.$foldData = session.$cloneFoldData();
        return s2;
      };
      this.setSession = function(session, idx) {
        var editor2;
        if (idx == null) {
          editor2 = this.$cEditor;
        } else {
          editor2 = this.$editors[idx];
        }
        var isUsed = this.$editors.some(function(editor3) {
          return editor3.session === session;
        });
        if (isUsed) {
          session = this.$cloneSession(session);
        }
        editor2.setSession(session);
        return session;
      };
      this.getOrientation = function() {
        return this.$orientation;
      };
      this.setOrientation = function(orientation) {
        if (this.$orientation == orientation) {
          return;
        }
        this.$orientation = orientation;
        this.resize();
      };
      this.resize = function() {
        var width = this.$container.clientWidth;
        var height = this.$container.clientHeight;
        var editor2;
        if (this.$orientation == this.BESIDE) {
          var editorWidth = width / this.$splits;
          for (var i2 = 0; i2 < this.$splits; i2++) {
            editor2 = this.$editors[i2];
            editor2.container.style.width = editorWidth + "px";
            editor2.container.style.top = "0px";
            editor2.container.style.left = i2 * editorWidth + "px";
            editor2.container.style.height = height + "px";
            editor2.resize();
          }
        } else {
          var editorHeight = height / this.$splits;
          for (var i2 = 0; i2 < this.$splits; i2++) {
            editor2 = this.$editors[i2];
            editor2.container.style.width = width + "px";
            editor2.container.style.top = i2 * editorHeight + "px";
            editor2.container.style.left = "0px";
            editor2.container.style.height = editorHeight + "px";
            editor2.resize();
          }
        }
      };
    }).call(Split.prototype);
    exports3.Split = Split;
  });
  ace.define("ace/ext/split", ["require", "exports", "module", "ace/ext/split", "ace/split"], function(require2, exports3, module3) {
    module3.exports = require2("../split");
  });
  (function() {
    ace.require(["ace/ext/split"], function(m2) {
      if (module2) {
        module2.exports = m2;
      }
    });
  })();
})(extSplit);
var extSplitExports = extSplit.exports;
var FUNC_ERROR_TEXT = "Expected a function";
var HASH_UNDEFINED = "__lodash_hash_undefined__";
var funcTag = "[object Function]", genTag = "[object GeneratorFunction]", symbolTag = "[object Symbol]";
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, reLeadingDot = /^\./, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
var reEscapeChar = /\\(\\)?/g;
var reIsHostCtor = /^\[object .+?Constructor\]$/;
var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
var root$2 = freeGlobal || freeSelf || Function("return this")();
function getValue(object4, key) {
  return object4 == null ? void 0 : object4[key];
}
function isHostObject(value2) {
  var result = false;
  if (value2 != null && typeof value2.toString != "function") {
    try {
      result = !!(value2 + "");
    } catch (e2) {
    }
  }
  return result;
}
var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype;
var coreJsData = root$2["__core-js_shared__"];
var maskSrcKey = function() {
  var uid2 = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
  return uid2 ? "Symbol(src)_1." + uid2 : "";
}();
var funcToString = funcProto.toString;
var hasOwnProperty$2 = objectProto.hasOwnProperty;
var objectToString = objectProto.toString;
var reIsNative = RegExp(
  "^" + funcToString.call(hasOwnProperty$2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
var Symbol$1 = root$2.Symbol, splice$1 = arrayProto.splice;
var Map$1 = getNative(root$2, "Map"), nativeCreate = getNative(Object, "create");
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0;
function Hash(entries) {
  var index2 = -1, length2 = entries ? entries.length : 0;
  this.clear();
  while (++index2 < length2) {
    var entry = entries[index2];
    this.set(entry[0], entry[1]);
  }
}
function hashClear() {
  this.__data__ = nativeCreate ? nativeCreate(null) : {};
}
function hashDelete(key) {
  return this.has(key) && delete this.__data__[key];
}
function hashGet(key) {
  var data = this.__data__;
  if (nativeCreate) {
    var result = data[key];
    return result === HASH_UNDEFINED ? void 0 : result;
  }
  return hasOwnProperty$2.call(data, key) ? data[key] : void 0;
}
function hashHas(key) {
  var data = this.__data__;
  return nativeCreate ? data[key] !== void 0 : hasOwnProperty$2.call(data, key);
}
function hashSet(key, value2) {
  var data = this.__data__;
  data[key] = nativeCreate && value2 === void 0 ? HASH_UNDEFINED : value2;
  return this;
}
Hash.prototype.clear = hashClear;
Hash.prototype["delete"] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
function ListCache(entries) {
  var index2 = -1, length2 = entries ? entries.length : 0;
  this.clear();
  while (++index2 < length2) {
    var entry = entries[index2];
    this.set(entry[0], entry[1]);
  }
}
function listCacheClear() {
  this.__data__ = [];
}
function listCacheDelete(key) {
  var data = this.__data__, index2 = assocIndexOf(data, key);
  if (index2 < 0) {
    return false;
  }
  var lastIndex = data.length - 1;
  if (index2 == lastIndex) {
    data.pop();
  } else {
    splice$1.call(data, index2, 1);
  }
  return true;
}
function listCacheGet(key) {
  var data = this.__data__, index2 = assocIndexOf(data, key);
  return index2 < 0 ? void 0 : data[index2][1];
}
function listCacheHas(key) {
  return assocIndexOf(this.__data__, key) > -1;
}
function listCacheSet(key, value2) {
  var data = this.__data__, index2 = assocIndexOf(data, key);
  if (index2 < 0) {
    data.push([key, value2]);
  } else {
    data[index2][1] = value2;
  }
  return this;
}
ListCache.prototype.clear = listCacheClear;
ListCache.prototype["delete"] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
function MapCache(entries) {
  var index2 = -1, length2 = entries ? entries.length : 0;
  this.clear();
  while (++index2 < length2) {
    var entry = entries[index2];
    this.set(entry[0], entry[1]);
  }
}
function mapCacheClear() {
  this.__data__ = {
    "hash": new Hash(),
    "map": new (Map$1 || ListCache)(),
    "string": new Hash()
  };
}
function mapCacheDelete(key) {
  return getMapData(this, key)["delete"](key);
}
function mapCacheGet(key) {
  return getMapData(this, key).get(key);
}
function mapCacheHas(key) {
  return getMapData(this, key).has(key);
}
function mapCacheSet(key, value2) {
  getMapData(this, key).set(key, value2);
  return this;
}
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype["delete"] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
function assocIndexOf(array4, key) {
  var length2 = array4.length;
  while (length2--) {
    if (eq(array4[length2][0], key)) {
      return length2;
    }
  }
  return -1;
}
function baseGet(object4, path) {
  path = isKey(path, object4) ? [path] : castPath(path);
  var index2 = 0, length2 = path.length;
  while (object4 != null && index2 < length2) {
    object4 = object4[toKey(path[index2++])];
  }
  return index2 && index2 == length2 ? object4 : void 0;
}
function baseIsNative(value2) {
  if (!isObject$2(value2) || isMasked(value2)) {
    return false;
  }
  var pattern4 = isFunction$2(value2) || isHostObject(value2) ? reIsNative : reIsHostCtor;
  return pattern4.test(toSource(value2));
}
function baseToString(value2) {
  if (typeof value2 == "string") {
    return value2;
  }
  if (isSymbol(value2)) {
    return symbolToString ? symbolToString.call(value2) : "";
  }
  var result = value2 + "";
  return result == "0" && 1 / value2 == -Infinity ? "-0" : result;
}
function castPath(value2) {
  return isArray$3(value2) ? value2 : stringToPath(value2);
}
function getMapData(map2, key) {
  var data = map2.__data__;
  return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
}
function getNative(object4, key) {
  var value2 = getValue(object4, key);
  return baseIsNative(value2) ? value2 : void 0;
}
function isKey(value2, object4) {
  if (isArray$3(value2)) {
    return false;
  }
  var type4 = typeof value2;
  if (type4 == "number" || type4 == "symbol" || type4 == "boolean" || value2 == null || isSymbol(value2)) {
    return true;
  }
  return reIsPlainProp.test(value2) || !reIsDeepProp.test(value2) || object4 != null && value2 in Object(object4);
}
function isKeyable(value2) {
  var type4 = typeof value2;
  return type4 == "string" || type4 == "number" || type4 == "symbol" || type4 == "boolean" ? value2 !== "__proto__" : value2 === null;
}
function isMasked(func) {
  return !!maskSrcKey && maskSrcKey in func;
}
var stringToPath = memoize(function(string3) {
  string3 = toString$4(string3);
  var result = [];
  if (reLeadingDot.test(string3)) {
    result.push("");
  }
  string3.replace(rePropName, function(match5, number4, quote, string4) {
    result.push(quote ? string4.replace(reEscapeChar, "$1") : number4 || match5);
  });
  return result;
});
function toKey(value2) {
  if (typeof value2 == "string" || isSymbol(value2)) {
    return value2;
  }
  var result = value2 + "";
  return result == "0" && 1 / value2 == -Infinity ? "-0" : result;
}
function toSource(func) {
  if (func != null) {
    try {
      return funcToString.call(func);
    } catch (e2) {
    }
    try {
      return func + "";
    } catch (e2) {
    }
  }
  return "";
}
function memoize(func, resolver2) {
  if (typeof func != "function" || resolver2 && typeof resolver2 != "function") {
    throw new TypeError(FUNC_ERROR_TEXT);
  }
  var memoized = function() {
    var args = arguments, key = resolver2 ? resolver2.apply(this, args) : args[0], cache2 = memoized.cache;
    if (cache2.has(key)) {
      return cache2.get(key);
    }
    var result = func.apply(this, args);
    memoized.cache = cache2.set(key, result);
    return result;
  };
  memoized.cache = new (memoize.Cache || MapCache)();
  return memoized;
}
memoize.Cache = MapCache;
function eq(value2, other) {
  return value2 === other || value2 !== value2 && other !== other;
}
var isArray$3 = Array.isArray;
function isFunction$2(value2) {
  var tag = isObject$2(value2) ? objectToString.call(value2) : "";
  return tag == funcTag || tag == genTag;
}
function isObject$2(value2) {
  var type4 = typeof value2;
  return !!value2 && (type4 == "object" || type4 == "function");
}
function isObjectLike(value2) {
  return !!value2 && typeof value2 == "object";
}
function isSymbol(value2) {
  return typeof value2 == "symbol" || isObjectLike(value2) && objectToString.call(value2) == symbolTag;
}
function toString$4(value2) {
  return value2 == null ? "" : baseToString(value2);
}
function get$4(object4, path, defaultValue2) {
  var result = object4 == null ? void 0 : baseGet(object4, path);
  return result === void 0 ? defaultValue2 : result;
}
var lodash_get = get$4;
var __extends$2 = commonjsGlobal && commonjsGlobal.__extends || /* @__PURE__ */ function() {
  var extendStatics = function(d2, b2) {
    extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
      d3.__proto__ = b3;
    } || function(d3, b3) {
      for (var p2 in b3)
        if (Object.prototype.hasOwnProperty.call(b3, p2))
          d3[p2] = b3[p2];
    };
    return extendStatics(d2, b2);
  };
  return function(d2, b2) {
    if (typeof b2 !== "function" && b2 !== null)
      throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
    extendStatics(d2, b2);
    function __() {
      this.constructor = d2;
    }
    d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
  };
}();
var __assign$1 = commonjsGlobal && commonjsGlobal.__assign || function() {
  __assign$1 = Object.assign || function(t2) {
    for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
      s2 = arguments[i2];
      for (var p2 in s2)
        if (Object.prototype.hasOwnProperty.call(s2, p2))
          t2[p2] = s2[p2];
    }
    return t2;
  };
  return __assign$1.apply(this, arguments);
};
Object.defineProperty(split, "__esModule", { value: true });
var editorOptions_1 = editorOptions$1;
var ace$1 = (0, editorOptions_1.getAceInstance)();
var ace_builds_1 = aceExports;
var ext_split_1 = extSplitExports;
var PropTypes$2 = propTypesExports;
var React$2 = reactExports;
var isEqual = lodash_isequalExports;
var get$3 = lodash_get;
var SplitComponent = (
  /** @class */
  function(_super) {
    __extends$2(SplitComponent2, _super);
    function SplitComponent2(props) {
      var _this = _super.call(this, props) || this;
      editorOptions_1.editorEvents.forEach(function(method4) {
        _this[method4] = _this[method4].bind(_this);
      });
      _this.debounce = editorOptions_1.debounce;
      return _this;
    }
    SplitComponent2.prototype.isInShadow = function(node2) {
      var parent = node2 && node2.parentNode;
      while (parent) {
        if (parent.toString() === "[object ShadowRoot]") {
          return true;
        }
        parent = parent.parentNode;
      }
      return false;
    };
    SplitComponent2.prototype.componentDidMount = function() {
      var _this = this;
      var _a2 = this.props, className = _a2.className, onBeforeLoad = _a2.onBeforeLoad, mode = _a2.mode, focus = _a2.focus, theme2 = _a2.theme, fontSize = _a2.fontSize, value2 = _a2.value, defaultValue2 = _a2.defaultValue, cursorStart = _a2.cursorStart, showGutter = _a2.showGutter, wrapEnabled = _a2.wrapEnabled, showPrintMargin = _a2.showPrintMargin, _b2 = _a2.scrollMargin, scrollMargin = _b2 === void 0 ? [0, 0, 0, 0] : _b2, keyboardHandler = _a2.keyboardHandler, onLoad = _a2.onLoad, commands = _a2.commands, annotations = _a2.annotations, markers = _a2.markers, splits = _a2.splits;
      this.editor = ace$1.edit(this.refEditor);
      if (this.isInShadow(this.refEditor)) {
        this.editor.renderer.attachToShadowRoot();
      }
      this.editor.setTheme("ace/theme/".concat(theme2));
      if (onBeforeLoad) {
        onBeforeLoad(ace$1);
      }
      var editorProps = Object.keys(this.props.editorProps);
      var split2 = new ext_split_1.Split(this.editor.container, "ace/theme/".concat(theme2), splits);
      this.editor.env.split = split2;
      this.splitEditor = split2.getEditor(0);
      this.split = split2;
      this.editor.setShowPrintMargin(false);
      this.editor.renderer.setShowGutter(false);
      var availableOptions = this.splitEditor.$options;
      if (this.props.debounceChangePeriod) {
        this.onChange = this.debounce(this.onChange, this.props.debounceChangePeriod);
      }
      split2.forEach(function(editor2, index2) {
        for (var i2 = 0; i2 < editorProps.length; i2++) {
          editor2[editorProps[i2]] = _this.props.editorProps[editorProps[i2]];
        }
        var defaultValueForEditor = get$3(defaultValue2, index2);
        var valueForEditor = get$3(value2, index2, "");
        editor2.session.setUndoManager(new ace$1.UndoManager());
        editor2.setTheme("ace/theme/".concat(theme2));
        editor2.renderer.setScrollMargin(scrollMargin[0], scrollMargin[1], scrollMargin[2], scrollMargin[3]);
        editor2.getSession().setMode("ace/mode/".concat(mode));
        editor2.setFontSize(fontSize);
        editor2.renderer.setShowGutter(showGutter);
        editor2.getSession().setUseWrapMode(wrapEnabled);
        editor2.setShowPrintMargin(showPrintMargin);
        editor2.on("focus", _this.onFocus);
        editor2.on("blur", _this.onBlur);
        editor2.on("input", _this.onInput);
        editor2.on("copy", _this.onCopy);
        editor2.on("paste", _this.onPaste);
        editor2.on("change", _this.onChange);
        editor2.getSession().selection.on("changeSelection", _this.onSelectionChange);
        editor2.getSession().selection.on("changeCursor", _this.onCursorChange);
        editor2.session.on("changeScrollTop", _this.onScroll);
        editor2.setValue(defaultValueForEditor === void 0 ? valueForEditor : defaultValueForEditor, cursorStart);
        var newAnnotations = get$3(annotations, index2, []);
        var newMarkers = get$3(markers, index2, []);
        editor2.getSession().setAnnotations(newAnnotations);
        if (newMarkers && newMarkers.length > 0) {
          _this.handleMarkers(newMarkers, editor2);
        }
        for (var i2 = 0; i2 < editorOptions_1.editorOptions.length; i2++) {
          var option = editorOptions_1.editorOptions[i2];
          if (availableOptions.hasOwnProperty(option)) {
            editor2.setOption(option, _this.props[option]);
          } else if (_this.props[option]) {
            console.warn("ReaceAce: editor option ".concat(option, " was activated but not found. Did you need to import a related tool or did you possibly mispell the option?"));
          }
        }
        _this.handleOptions(_this.props, editor2);
        if (Array.isArray(commands)) {
          commands.forEach(function(command) {
            if (typeof command.exec === "string") {
              editor2.commands.bindKey(command.bindKey, command.exec);
            } else {
              editor2.commands.addCommand(command);
            }
          });
        }
        if (keyboardHandler) {
          editor2.setKeyboardHandler("ace/keyboard/" + keyboardHandler);
        }
      });
      if (className) {
        this.refEditor.className += " " + className;
      }
      if (focus) {
        this.splitEditor.focus();
      }
      var sp = this.editor.env.split;
      sp.setOrientation(this.props.orientation === "below" ? sp.BELOW : sp.BESIDE);
      sp.resize(true);
      if (onLoad) {
        onLoad(sp);
      }
    };
    SplitComponent2.prototype.componentDidUpdate = function(prevProps) {
      var _this = this;
      var oldProps = prevProps;
      var nextProps = this.props;
      var split2 = this.editor.env.split;
      if (nextProps.splits !== oldProps.splits) {
        split2.setSplits(nextProps.splits);
      }
      if (nextProps.orientation !== oldProps.orientation) {
        split2.setOrientation(nextProps.orientation === "below" ? split2.BELOW : split2.BESIDE);
      }
      split2.forEach(function(editor2, index2) {
        if (nextProps.mode !== oldProps.mode) {
          editor2.getSession().setMode("ace/mode/" + nextProps.mode);
        }
        if (nextProps.keyboardHandler !== oldProps.keyboardHandler) {
          if (nextProps.keyboardHandler) {
            editor2.setKeyboardHandler("ace/keyboard/" + nextProps.keyboardHandler);
          } else {
            editor2.setKeyboardHandler(null);
          }
        }
        if (nextProps.fontSize !== oldProps.fontSize) {
          editor2.setFontSize(nextProps.fontSize);
        }
        if (nextProps.wrapEnabled !== oldProps.wrapEnabled) {
          editor2.getSession().setUseWrapMode(nextProps.wrapEnabled);
        }
        if (nextProps.showPrintMargin !== oldProps.showPrintMargin) {
          editor2.setShowPrintMargin(nextProps.showPrintMargin);
        }
        if (nextProps.showGutter !== oldProps.showGutter) {
          editor2.renderer.setShowGutter(nextProps.showGutter);
        }
        for (var i2 = 0; i2 < editorOptions_1.editorOptions.length; i2++) {
          var option = editorOptions_1.editorOptions[i2];
          if (nextProps[option] !== oldProps[option]) {
            editor2.setOption(option, nextProps[option]);
          }
        }
        if (!isEqual(nextProps.setOptions, oldProps.setOptions)) {
          _this.handleOptions(nextProps, editor2);
        }
        var nextValue = get$3(nextProps.value, index2, "");
        if (editor2.getValue() !== nextValue) {
          _this.silent = true;
          var pos = editor2.session.selection.toJSON();
          editor2.setValue(nextValue, nextProps.cursorStart);
          editor2.session.selection.fromJSON(pos);
          _this.silent = false;
        }
        var newAnnotations = get$3(nextProps.annotations, index2, []);
        var oldAnnotations = get$3(oldProps.annotations, index2, []);
        if (!isEqual(newAnnotations, oldAnnotations)) {
          editor2.getSession().setAnnotations(newAnnotations);
        }
        var newMarkers = get$3(nextProps.markers, index2, []);
        var oldMarkers = get$3(oldProps.markers, index2, []);
        if (!isEqual(newMarkers, oldMarkers) && Array.isArray(newMarkers)) {
          _this.handleMarkers(newMarkers, editor2);
        }
      });
      if (nextProps.className !== oldProps.className) {
        var appliedClasses = this.refEditor.className;
        var appliedClassesArray_1 = appliedClasses.trim().split(" ");
        var oldClassesArray = oldProps.className.trim().split(" ");
        oldClassesArray.forEach(function(oldClass) {
          var index2 = appliedClassesArray_1.indexOf(oldClass);
          appliedClassesArray_1.splice(index2, 1);
        });
        this.refEditor.className = " " + nextProps.className + " " + appliedClassesArray_1.join(" ");
      }
      if (nextProps.theme !== oldProps.theme) {
        split2.setTheme("ace/theme/" + nextProps.theme);
      }
      if (nextProps.focus && !oldProps.focus) {
        this.splitEditor.focus();
      }
      if (nextProps.height !== this.props.height || nextProps.width !== this.props.width) {
        this.editor.resize();
      }
    };
    SplitComponent2.prototype.componentWillUnmount = function() {
      this.editor.destroy();
      this.editor = null;
    };
    SplitComponent2.prototype.onChange = function(event) {
      if (this.props.onChange && !this.silent) {
        var value_1 = [];
        this.editor.env.split.forEach(function(editor2) {
          value_1.push(editor2.getValue());
        });
        this.props.onChange(value_1, event);
      }
    };
    SplitComponent2.prototype.onSelectionChange = function(event) {
      if (this.props.onSelectionChange) {
        var value_2 = [];
        this.editor.env.split.forEach(function(editor2) {
          value_2.push(editor2.getSelection());
        });
        this.props.onSelectionChange(value_2, event);
      }
    };
    SplitComponent2.prototype.onCursorChange = function(event) {
      if (this.props.onCursorChange) {
        var value_3 = [];
        this.editor.env.split.forEach(function(editor2) {
          value_3.push(editor2.getSelection());
        });
        this.props.onCursorChange(value_3, event);
      }
    };
    SplitComponent2.prototype.onFocus = function(event) {
      if (this.props.onFocus) {
        this.props.onFocus(event);
      }
    };
    SplitComponent2.prototype.onInput = function(event) {
      if (this.props.onInput) {
        this.props.onInput(event);
      }
    };
    SplitComponent2.prototype.onBlur = function(event) {
      if (this.props.onBlur) {
        this.props.onBlur(event);
      }
    };
    SplitComponent2.prototype.onCopy = function(text2) {
      if (this.props.onCopy) {
        this.props.onCopy(text2);
      }
    };
    SplitComponent2.prototype.onPaste = function(text2) {
      if (this.props.onPaste) {
        this.props.onPaste(text2);
      }
    };
    SplitComponent2.prototype.onScroll = function() {
      if (this.props.onScroll) {
        this.props.onScroll(this.editor);
      }
    };
    SplitComponent2.prototype.handleOptions = function(props, editor2) {
      var setOptions2 = Object.keys(props.setOptions);
      for (var y2 = 0; y2 < setOptions2.length; y2++) {
        editor2.setOption(setOptions2[y2], props.setOptions[setOptions2[y2]]);
      }
    };
    SplitComponent2.prototype.handleMarkers = function(markers, editor2) {
      var currentMarkers = editor2.getSession().getMarkers(true);
      for (var i2 in currentMarkers) {
        if (currentMarkers.hasOwnProperty(i2)) {
          editor2.getSession().removeMarker(currentMarkers[i2].id);
        }
      }
      currentMarkers = editor2.getSession().getMarkers(false);
      for (var i2 in currentMarkers) {
        if (currentMarkers.hasOwnProperty(i2)) {
          editor2.getSession().removeMarker(currentMarkers[i2].id);
        }
      }
      markers.forEach(function(_a2) {
        var startRow = _a2.startRow, startCol = _a2.startCol, endRow = _a2.endRow, endCol = _a2.endCol, className = _a2.className, type4 = _a2.type, _b2 = _a2.inFront, inFront = _b2 === void 0 ? false : _b2;
        var range3 = new ace_builds_1.Range(startRow, startCol, endRow, endCol);
        editor2.getSession().addMarker(range3, className, type4, inFront);
      });
    };
    SplitComponent2.prototype.updateRef = function(item) {
      this.refEditor = item;
    };
    SplitComponent2.prototype.render = function() {
      var _a2 = this.props, name2 = _a2.name, width = _a2.width, height = _a2.height, style2 = _a2.style;
      var divStyle = __assign$1({ width, height }, style2);
      return React$2.createElement("div", { ref: this.updateRef, id: name2, style: divStyle });
    };
    SplitComponent2.propTypes = {
      className: PropTypes$2.string,
      debounceChangePeriod: PropTypes$2.number,
      defaultValue: PropTypes$2.arrayOf(PropTypes$2.string),
      focus: PropTypes$2.bool,
      fontSize: PropTypes$2.oneOfType([PropTypes$2.number, PropTypes$2.string]),
      height: PropTypes$2.string,
      mode: PropTypes$2.string,
      name: PropTypes$2.string,
      onBlur: PropTypes$2.func,
      onChange: PropTypes$2.func,
      onCopy: PropTypes$2.func,
      onFocus: PropTypes$2.func,
      onInput: PropTypes$2.func,
      onLoad: PropTypes$2.func,
      onPaste: PropTypes$2.func,
      onScroll: PropTypes$2.func,
      orientation: PropTypes$2.string,
      showGutter: PropTypes$2.bool,
      splits: PropTypes$2.number,
      theme: PropTypes$2.string,
      value: PropTypes$2.arrayOf(PropTypes$2.string),
      width: PropTypes$2.string,
      onSelectionChange: PropTypes$2.func,
      onCursorChange: PropTypes$2.func,
      onBeforeLoad: PropTypes$2.func,
      minLines: PropTypes$2.number,
      maxLines: PropTypes$2.number,
      readOnly: PropTypes$2.bool,
      highlightActiveLine: PropTypes$2.bool,
      tabSize: PropTypes$2.number,
      showPrintMargin: PropTypes$2.bool,
      cursorStart: PropTypes$2.number,
      editorProps: PropTypes$2.object,
      setOptions: PropTypes$2.object,
      style: PropTypes$2.object,
      scrollMargin: PropTypes$2.array,
      annotations: PropTypes$2.array,
      markers: PropTypes$2.array,
      keyboardHandler: PropTypes$2.string,
      wrapEnabled: PropTypes$2.bool,
      enableBasicAutocompletion: PropTypes$2.oneOfType([
        PropTypes$2.bool,
        PropTypes$2.array
      ]),
      enableLiveAutocompletion: PropTypes$2.oneOfType([
        PropTypes$2.bool,
        PropTypes$2.array
      ]),
      commands: PropTypes$2.array
    };
    SplitComponent2.defaultProps = {
      name: "ace-editor",
      focus: false,
      orientation: "beside",
      splits: 2,
      mode: "",
      theme: "",
      height: "500px",
      width: "500px",
      value: [],
      fontSize: 12,
      showGutter: true,
      onChange: null,
      onPaste: null,
      onLoad: null,
      onScroll: null,
      minLines: null,
      maxLines: null,
      readOnly: false,
      highlightActiveLine: true,
      showPrintMargin: true,
      tabSize: 4,
      cursorStart: 1,
      editorProps: {},
      style: {},
      scrollMargin: [0, 0, 0, 0],
      setOptions: {},
      wrapEnabled: false,
      enableBasicAutocompletion: false,
      enableLiveAutocompletion: false
    };
    return SplitComponent2;
  }(React$2.Component)
);
split.default = SplitComponent;
var diffMatchPatch = { exports: {} };
(function(module2) {
  var diff_match_patch = function() {
    this.Diff_Timeout = 1;
    this.Diff_EditCost = 4;
    this.Match_Threshold = 0.5;
    this.Match_Distance = 1e3;
    this.Patch_DeleteThreshold = 0.5;
    this.Patch_Margin = 4;
    this.Match_MaxBits = 32;
  };
  var DIFF_DELETE = -1;
  var DIFF_INSERT = 1;
  var DIFF_EQUAL = 0;
  diff_match_patch.Diff = function(op, text2) {
    return [op, text2];
  };
  diff_match_patch.prototype.diff_main = function(text1, text2, opt_checklines, opt_deadline) {
    if (typeof opt_deadline == "undefined") {
      if (this.Diff_Timeout <= 0) {
        opt_deadline = Number.MAX_VALUE;
      } else {
        opt_deadline = (/* @__PURE__ */ new Date()).getTime() + this.Diff_Timeout * 1e3;
      }
    }
    var deadline = opt_deadline;
    if (text1 == null || text2 == null) {
      throw new Error("Null input. (diff_main)");
    }
    if (text1 == text2) {
      if (text1) {
        return [new diff_match_patch.Diff(DIFF_EQUAL, text1)];
      }
      return [];
    }
    if (typeof opt_checklines == "undefined") {
      opt_checklines = true;
    }
    var checklines = opt_checklines;
    var commonlength = this.diff_commonPrefix(text1, text2);
    var commonprefix = text1.substring(0, commonlength);
    text1 = text1.substring(commonlength);
    text2 = text2.substring(commonlength);
    commonlength = this.diff_commonSuffix(text1, text2);
    var commonsuffix = text1.substring(text1.length - commonlength);
    text1 = text1.substring(0, text1.length - commonlength);
    text2 = text2.substring(0, text2.length - commonlength);
    var diffs = this.diff_compute_(text1, text2, checklines, deadline);
    if (commonprefix) {
      diffs.unshift(new diff_match_patch.Diff(DIFF_EQUAL, commonprefix));
    }
    if (commonsuffix) {
      diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, commonsuffix));
    }
    this.diff_cleanupMerge(diffs);
    return diffs;
  };
  diff_match_patch.prototype.diff_compute_ = function(text1, text2, checklines, deadline) {
    var diffs;
    if (!text1) {
      return [new diff_match_patch.Diff(DIFF_INSERT, text2)];
    }
    if (!text2) {
      return [new diff_match_patch.Diff(DIFF_DELETE, text1)];
    }
    var longtext = text1.length > text2.length ? text1 : text2;
    var shorttext = text1.length > text2.length ? text2 : text1;
    var i2 = longtext.indexOf(shorttext);
    if (i2 != -1) {
      diffs = [
        new diff_match_patch.Diff(DIFF_INSERT, longtext.substring(0, i2)),
        new diff_match_patch.Diff(DIFF_EQUAL, shorttext),
        new diff_match_patch.Diff(
          DIFF_INSERT,
          longtext.substring(i2 + shorttext.length)
        )
      ];
      if (text1.length > text2.length) {
        diffs[0][0] = diffs[2][0] = DIFF_DELETE;
      }
      return diffs;
    }
    if (shorttext.length == 1) {
      return [
        new diff_match_patch.Diff(DIFF_DELETE, text1),
        new diff_match_patch.Diff(DIFF_INSERT, text2)
      ];
    }
    var hm = this.diff_halfMatch_(text1, text2);
    if (hm) {
      var text1_a = hm[0];
      var text1_b = hm[1];
      var text2_a = hm[2];
      var text2_b = hm[3];
      var mid_common = hm[4];
      var diffs_a = this.diff_main(text1_a, text2_a, checklines, deadline);
      var diffs_b = this.diff_main(text1_b, text2_b, checklines, deadline);
      return diffs_a.concat(
        [new diff_match_patch.Diff(DIFF_EQUAL, mid_common)],
        diffs_b
      );
    }
    if (checklines && text1.length > 100 && text2.length > 100) {
      return this.diff_lineMode_(text1, text2, deadline);
    }
    return this.diff_bisect_(text1, text2, deadline);
  };
  diff_match_patch.prototype.diff_lineMode_ = function(text1, text2, deadline) {
    var a2 = this.diff_linesToChars_(text1, text2);
    text1 = a2.chars1;
    text2 = a2.chars2;
    var linearray = a2.lineArray;
    var diffs = this.diff_main(text1, text2, false, deadline);
    this.diff_charsToLines_(diffs, linearray);
    this.diff_cleanupSemantic(diffs);
    diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, ""));
    var pointer = 0;
    var count_delete = 0;
    var count_insert = 0;
    var text_delete = "";
    var text_insert = "";
    while (pointer < diffs.length) {
      switch (diffs[pointer][0]) {
        case DIFF_INSERT:
          count_insert++;
          text_insert += diffs[pointer][1];
          break;
        case DIFF_DELETE:
          count_delete++;
          text_delete += diffs[pointer][1];
          break;
        case DIFF_EQUAL:
          if (count_delete >= 1 && count_insert >= 1) {
            diffs.splice(
              pointer - count_delete - count_insert,
              count_delete + count_insert
            );
            pointer = pointer - count_delete - count_insert;
            var subDiff = this.diff_main(text_delete, text_insert, false, deadline);
            for (var j2 = subDiff.length - 1; j2 >= 0; j2--) {
              diffs.splice(pointer, 0, subDiff[j2]);
            }
            pointer = pointer + subDiff.length;
          }
          count_insert = 0;
          count_delete = 0;
          text_delete = "";
          text_insert = "";
          break;
      }
      pointer++;
    }
    diffs.pop();
    return diffs;
  };
  diff_match_patch.prototype.diff_bisect_ = function(text1, text2, deadline) {
    var text1_length = text1.length;
    var text2_length = text2.length;
    var max_d = Math.ceil((text1_length + text2_length) / 2);
    var v_offset = max_d;
    var v_length = 2 * max_d;
    var v1 = new Array(v_length);
    var v2 = new Array(v_length);
    for (var x2 = 0; x2 < v_length; x2++) {
      v1[x2] = -1;
      v2[x2] = -1;
    }
    v1[v_offset + 1] = 0;
    v2[v_offset + 1] = 0;
    var delta = text1_length - text2_length;
    var front = delta % 2 != 0;
    var k1start = 0;
    var k1end = 0;
    var k2start = 0;
    var k2end = 0;
    for (var d2 = 0; d2 < max_d; d2++) {
      if ((/* @__PURE__ */ new Date()).getTime() > deadline) {
        break;
      }
      for (var k1 = -d2 + k1start; k1 <= d2 - k1end; k1 += 2) {
        var k1_offset = v_offset + k1;
        var x1;
        if (k1 == -d2 || k1 != d2 && v1[k1_offset - 1] < v1[k1_offset + 1]) {
          x1 = v1[k1_offset + 1];
        } else {
          x1 = v1[k1_offset - 1] + 1;
        }
        var y1 = x1 - k1;
        while (x1 < text1_length && y1 < text2_length && text1.charAt(x1) == text2.charAt(y1)) {
          x1++;
          y1++;
        }
        v1[k1_offset] = x1;
        if (x1 > text1_length) {
          k1end += 2;
        } else if (y1 > text2_length) {
          k1start += 2;
        } else if (front) {
          var k2_offset = v_offset + delta - k1;
          if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) {
            var x22 = text1_length - v2[k2_offset];
            if (x1 >= x22) {
              return this.diff_bisectSplit_(text1, text2, x1, y1, deadline);
            }
          }
        }
      }
      for (var k2 = -d2 + k2start; k2 <= d2 - k2end; k2 += 2) {
        var k2_offset = v_offset + k2;
        var x22;
        if (k2 == -d2 || k2 != d2 && v2[k2_offset - 1] < v2[k2_offset + 1]) {
          x22 = v2[k2_offset + 1];
        } else {
          x22 = v2[k2_offset - 1] + 1;
        }
        var y2 = x22 - k2;
        while (x22 < text1_length && y2 < text2_length && text1.charAt(text1_length - x22 - 1) == text2.charAt(text2_length - y2 - 1)) {
          x22++;
          y2++;
        }
        v2[k2_offset] = x22;
        if (x22 > text1_length) {
          k2end += 2;
        } else if (y2 > text2_length) {
          k2start += 2;
        } else if (!front) {
          var k1_offset = v_offset + delta - k2;
          if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) {
            var x1 = v1[k1_offset];
            var y1 = v_offset + x1 - k1_offset;
            x22 = text1_length - x22;
            if (x1 >= x22) {
              return this.diff_bisectSplit_(text1, text2, x1, y1, deadline);
            }
          }
        }
      }
    }
    return [
      new diff_match_patch.Diff(DIFF_DELETE, text1),
      new diff_match_patch.Diff(DIFF_INSERT, text2)
    ];
  };
  diff_match_patch.prototype.diff_bisectSplit_ = function(text1, text2, x2, y2, deadline) {
    var text1a = text1.substring(0, x2);
    var text2a = text2.substring(0, y2);
    var text1b = text1.substring(x2);
    var text2b = text2.substring(y2);
    var diffs = this.diff_main(text1a, text2a, false, deadline);
    var diffsb = this.diff_main(text1b, text2b, false, deadline);
    return diffs.concat(diffsb);
  };
  diff_match_patch.prototype.diff_linesToChars_ = function(text1, text2) {
    var lineArray = [];
    var lineHash = {};
    lineArray[0] = "";
    function diff_linesToCharsMunge_(text3) {
      var chars3 = "";
      var lineStart = 0;
      var lineEnd = -1;
      var lineArrayLength = lineArray.length;
      while (lineEnd < text3.length - 1) {
        lineEnd = text3.indexOf("\n", lineStart);
        if (lineEnd == -1) {
          lineEnd = text3.length - 1;
        }
        var line2 = text3.substring(lineStart, lineEnd + 1);
        if (lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line2) : lineHash[line2] !== void 0) {
          chars3 += String.fromCharCode(lineHash[line2]);
        } else {
          if (lineArrayLength == maxLines) {
            line2 = text3.substring(lineStart);
            lineEnd = text3.length;
          }
          chars3 += String.fromCharCode(lineArrayLength);
          lineHash[line2] = lineArrayLength;
          lineArray[lineArrayLength++] = line2;
        }
        lineStart = lineEnd + 1;
      }
      return chars3;
    }
    var maxLines = 4e4;
    var chars1 = diff_linesToCharsMunge_(text1);
    maxLines = 65535;
    var chars2 = diff_linesToCharsMunge_(text2);
    return { chars1, chars2, lineArray };
  };
  diff_match_patch.prototype.diff_charsToLines_ = function(diffs, lineArray) {
    for (var i2 = 0; i2 < diffs.length; i2++) {
      var chars2 = diffs[i2][1];
      var text2 = [];
      for (var j2 = 0; j2 < chars2.length; j2++) {
        text2[j2] = lineArray[chars2.charCodeAt(j2)];
      }
      diffs[i2][1] = text2.join("");
    }
  };
  diff_match_patch.prototype.diff_commonPrefix = function(text1, text2) {
    if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {
      return 0;
    }
    var pointermin = 0;
    var pointermax = Math.min(text1.length, text2.length);
    var pointermid = pointermax;
    var pointerstart = 0;
    while (pointermin < pointermid) {
      if (text1.substring(pointerstart, pointermid) == text2.substring(pointerstart, pointermid)) {
        pointermin = pointermid;
        pointerstart = pointermin;
      } else {
        pointermax = pointermid;
      }
      pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
    }
    return pointermid;
  };
  diff_match_patch.prototype.diff_commonSuffix = function(text1, text2) {
    if (!text1 || !text2 || text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) {
      return 0;
    }
    var pointermin = 0;
    var pointermax = Math.min(text1.length, text2.length);
    var pointermid = pointermax;
    var pointerend = 0;
    while (pointermin < pointermid) {
      if (text1.substring(text1.length - pointermid, text1.length - pointerend) == text2.substring(text2.length - pointermid, text2.length - pointerend)) {
        pointermin = pointermid;
        pointerend = pointermin;
      } else {
        pointermax = pointermid;
      }
      pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
    }
    return pointermid;
  };
  diff_match_patch.prototype.diff_commonOverlap_ = function(text1, text2) {
    var text1_length = text1.length;
    var text2_length = text2.length;
    if (text1_length == 0 || text2_length == 0) {
      return 0;
    }
    if (text1_length > text2_length) {
      text1 = text1.substring(text1_length - text2_length);
    } else if (text1_length < text2_length) {
      text2 = text2.substring(0, text1_length);
    }
    var text_length = Math.min(text1_length, text2_length);
    if (text1 == text2) {
      return text_length;
    }
    var best = 0;
    var length2 = 1;
    while (true) {
      var pattern4 = text1.substring(text_length - length2);
      var found = text2.indexOf(pattern4);
      if (found == -1) {
        return best;
      }
      length2 += found;
      if (found == 0 || text1.substring(text_length - length2) == text2.substring(0, length2)) {
        best = length2;
        length2++;
      }
    }
  };
  diff_match_patch.prototype.diff_halfMatch_ = function(text1, text2) {
    if (this.Diff_Timeout <= 0) {
      return null;
    }
    var longtext = text1.length > text2.length ? text1 : text2;
    var shorttext = text1.length > text2.length ? text2 : text1;
    if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
      return null;
    }
    var dmp = this;
    function diff_halfMatchI_(longtext2, shorttext2, i2) {
      var seed = longtext2.substring(i2, i2 + Math.floor(longtext2.length / 4));
      var j2 = -1;
      var best_common = "";
      var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
      while ((j2 = shorttext2.indexOf(seed, j2 + 1)) != -1) {
        var prefixLength = dmp.diff_commonPrefix(
          longtext2.substring(i2),
          shorttext2.substring(j2)
        );
        var suffixLength = dmp.diff_commonSuffix(
          longtext2.substring(0, i2),
          shorttext2.substring(0, j2)
        );
        if (best_common.length < suffixLength + prefixLength) {
          best_common = shorttext2.substring(j2 - suffixLength, j2) + shorttext2.substring(j2, j2 + prefixLength);
          best_longtext_a = longtext2.substring(0, i2 - suffixLength);
          best_longtext_b = longtext2.substring(i2 + prefixLength);
          best_shorttext_a = shorttext2.substring(0, j2 - suffixLength);
          best_shorttext_b = shorttext2.substring(j2 + prefixLength);
        }
      }
      if (best_common.length * 2 >= longtext2.length) {
        return [
          best_longtext_a,
          best_longtext_b,
          best_shorttext_a,
          best_shorttext_b,
          best_common
        ];
      } else {
        return null;
      }
    }
    var hm1 = diff_halfMatchI_(
      longtext,
      shorttext,
      Math.ceil(longtext.length / 4)
    );
    var hm2 = diff_halfMatchI_(
      longtext,
      shorttext,
      Math.ceil(longtext.length / 2)
    );
    var hm;
    if (!hm1 && !hm2) {
      return null;
    } else if (!hm2) {
      hm = hm1;
    } else if (!hm1) {
      hm = hm2;
    } else {
      hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
    }
    var text1_a, text1_b, text2_a, text2_b;
    if (text1.length > text2.length) {
      text1_a = hm[0];
      text1_b = hm[1];
      text2_a = hm[2];
      text2_b = hm[3];
    } else {
      text2_a = hm[0];
      text2_b = hm[1];
      text1_a = hm[2];
      text1_b = hm[3];
    }
    var mid_common = hm[4];
    return [text1_a, text1_b, text2_a, text2_b, mid_common];
  };
  diff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {
    var changes = false;
    var equalities = [];
    var equalitiesLength = 0;
    var lastEquality = null;
    var pointer = 0;
    var length_insertions1 = 0;
    var length_deletions1 = 0;
    var length_insertions2 = 0;
    var length_deletions2 = 0;
    while (pointer < diffs.length) {
      if (diffs[pointer][0] == DIFF_EQUAL) {
        equalities[equalitiesLength++] = pointer;
        length_insertions1 = length_insertions2;
        length_deletions1 = length_deletions2;
        length_insertions2 = 0;
        length_deletions2 = 0;
        lastEquality = diffs[pointer][1];
      } else {
        if (diffs[pointer][0] == DIFF_INSERT) {
          length_insertions2 += diffs[pointer][1].length;
        } else {
          length_deletions2 += diffs[pointer][1].length;
        }
        if (lastEquality && lastEquality.length <= Math.max(length_insertions1, length_deletions1) && lastEquality.length <= Math.max(
          length_insertions2,
          length_deletions2
        )) {
          diffs.splice(
            equalities[equalitiesLength - 1],
            0,
            new diff_match_patch.Diff(DIFF_DELETE, lastEquality)
          );
          diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
          equalitiesLength--;
          equalitiesLength--;
          pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
          length_insertions1 = 0;
          length_deletions1 = 0;
          length_insertions2 = 0;
          length_deletions2 = 0;
          lastEquality = null;
          changes = true;
        }
      }
      pointer++;
    }
    if (changes) {
      this.diff_cleanupMerge(diffs);
    }
    this.diff_cleanupSemanticLossless(diffs);
    pointer = 1;
    while (pointer < diffs.length) {
      if (diffs[pointer - 1][0] == DIFF_DELETE && diffs[pointer][0] == DIFF_INSERT) {
        var deletion = diffs[pointer - 1][1];
        var insertion = diffs[pointer][1];
        var overlap_length1 = this.diff_commonOverlap_(deletion, insertion);
        var overlap_length2 = this.diff_commonOverlap_(insertion, deletion);
        if (overlap_length1 >= overlap_length2) {
          if (overlap_length1 >= deletion.length / 2 || overlap_length1 >= insertion.length / 2) {
            diffs.splice(pointer, 0, new diff_match_patch.Diff(
              DIFF_EQUAL,
              insertion.substring(0, overlap_length1)
            ));
            diffs[pointer - 1][1] = deletion.substring(0, deletion.length - overlap_length1);
            diffs[pointer + 1][1] = insertion.substring(overlap_length1);
            pointer++;
          }
        } else {
          if (overlap_length2 >= deletion.length / 2 || overlap_length2 >= insertion.length / 2) {
            diffs.splice(pointer, 0, new diff_match_patch.Diff(
              DIFF_EQUAL,
              deletion.substring(0, overlap_length2)
            ));
            diffs[pointer - 1][0] = DIFF_INSERT;
            diffs[pointer - 1][1] = insertion.substring(0, insertion.length - overlap_length2);
            diffs[pointer + 1][0] = DIFF_DELETE;
            diffs[pointer + 1][1] = deletion.substring(overlap_length2);
            pointer++;
          }
        }
        pointer++;
      }
      pointer++;
    }
  };
  diff_match_patch.prototype.diff_cleanupSemanticLossless = function(diffs) {
    function diff_cleanupSemanticScore_(one2, two) {
      if (!one2 || !two) {
        return 6;
      }
      var char1 = one2.charAt(one2.length - 1);
      var char2 = two.charAt(0);
      var nonAlphaNumeric1 = char1.match(diff_match_patch.nonAlphaNumericRegex_);
      var nonAlphaNumeric2 = char2.match(diff_match_patch.nonAlphaNumericRegex_);
      var whitespace1 = nonAlphaNumeric1 && char1.match(diff_match_patch.whitespaceRegex_);
      var whitespace22 = nonAlphaNumeric2 && char2.match(diff_match_patch.whitespaceRegex_);
      var lineBreak1 = whitespace1 && char1.match(diff_match_patch.linebreakRegex_);
      var lineBreak2 = whitespace22 && char2.match(diff_match_patch.linebreakRegex_);
      var blankLine1 = lineBreak1 && one2.match(diff_match_patch.blanklineEndRegex_);
      var blankLine2 = lineBreak2 && two.match(diff_match_patch.blanklineStartRegex_);
      if (blankLine1 || blankLine2) {
        return 5;
      } else if (lineBreak1 || lineBreak2) {
        return 4;
      } else if (nonAlphaNumeric1 && !whitespace1 && whitespace22) {
        return 3;
      } else if (whitespace1 || whitespace22) {
        return 2;
      } else if (nonAlphaNumeric1 || nonAlphaNumeric2) {
        return 1;
      }
      return 0;
    }
    var pointer = 1;
    while (pointer < diffs.length - 1) {
      if (diffs[pointer - 1][0] == DIFF_EQUAL && diffs[pointer + 1][0] == DIFF_EQUAL) {
        var equality1 = diffs[pointer - 1][1];
        var edit = diffs[pointer][1];
        var equality2 = diffs[pointer + 1][1];
        var commonOffset = this.diff_commonSuffix(equality1, edit);
        if (commonOffset) {
          var commonString = edit.substring(edit.length - commonOffset);
          equality1 = equality1.substring(0, equality1.length - commonOffset);
          edit = commonString + edit.substring(0, edit.length - commonOffset);
          equality2 = commonString + equality2;
        }
        var bestEquality1 = equality1;
        var bestEdit = edit;
        var bestEquality2 = equality2;
        var bestScore = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2);
        while (edit.charAt(0) === equality2.charAt(0)) {
          equality1 += edit.charAt(0);
          edit = edit.substring(1) + equality2.charAt(0);
          equality2 = equality2.substring(1);
          var score = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2);
          if (score >= bestScore) {
            bestScore = score;
            bestEquality1 = equality1;
            bestEdit = edit;
            bestEquality2 = equality2;
          }
        }
        if (diffs[pointer - 1][1] != bestEquality1) {
          if (bestEquality1) {
            diffs[pointer - 1][1] = bestEquality1;
          } else {
            diffs.splice(pointer - 1, 1);
            pointer--;
          }
          diffs[pointer][1] = bestEdit;
          if (bestEquality2) {
            diffs[pointer + 1][1] = bestEquality2;
          } else {
            diffs.splice(pointer + 1, 1);
            pointer--;
          }
        }
      }
      pointer++;
    }
  };
  diff_match_patch.nonAlphaNumericRegex_ = /[^a-zA-Z0-9]/;
  diff_match_patch.whitespaceRegex_ = /\s/;
  diff_match_patch.linebreakRegex_ = /[\r\n]/;
  diff_match_patch.blanklineEndRegex_ = /\n\r?\n$/;
  diff_match_patch.blanklineStartRegex_ = /^\r?\n\r?\n/;
  diff_match_patch.prototype.diff_cleanupEfficiency = function(diffs) {
    var changes = false;
    var equalities = [];
    var equalitiesLength = 0;
    var lastEquality = null;
    var pointer = 0;
    var pre_ins = false;
    var pre_del = false;
    var post_ins = false;
    var post_del = false;
    while (pointer < diffs.length) {
      if (diffs[pointer][0] == DIFF_EQUAL) {
        if (diffs[pointer][1].length < this.Diff_EditCost && (post_ins || post_del)) {
          equalities[equalitiesLength++] = pointer;
          pre_ins = post_ins;
          pre_del = post_del;
          lastEquality = diffs[pointer][1];
        } else {
          equalitiesLength = 0;
          lastEquality = null;
        }
        post_ins = post_del = false;
      } else {
        if (diffs[pointer][0] == DIFF_DELETE) {
          post_del = true;
        } else {
          post_ins = true;
        }
        if (lastEquality && (pre_ins && pre_del && post_ins && post_del || lastEquality.length < this.Diff_EditCost / 2 && pre_ins + pre_del + post_ins + post_del == 3)) {
          diffs.splice(
            equalities[equalitiesLength - 1],
            0,
            new diff_match_patch.Diff(DIFF_DELETE, lastEquality)
          );
          diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
          equalitiesLength--;
          lastEquality = null;
          if (pre_ins && pre_del) {
            post_ins = post_del = true;
            equalitiesLength = 0;
          } else {
            equalitiesLength--;
            pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
            post_ins = post_del = false;
          }
          changes = true;
        }
      }
      pointer++;
    }
    if (changes) {
      this.diff_cleanupMerge(diffs);
    }
  };
  diff_match_patch.prototype.diff_cleanupMerge = function(diffs) {
    diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, ""));
    var pointer = 0;
    var count_delete = 0;
    var count_insert = 0;
    var text_delete = "";
    var text_insert = "";
    var commonlength;
    while (pointer < diffs.length) {
      switch (diffs[pointer][0]) {
        case DIFF_INSERT:
          count_insert++;
          text_insert += diffs[pointer][1];
          pointer++;
          break;
        case DIFF_DELETE:
          count_delete++;
          text_delete += diffs[pointer][1];
          pointer++;
          break;
        case DIFF_EQUAL:
          if (count_delete + count_insert > 1) {
            if (count_delete !== 0 && count_insert !== 0) {
              commonlength = this.diff_commonPrefix(text_insert, text_delete);
              if (commonlength !== 0) {
                if (pointer - count_delete - count_insert > 0 && diffs[pointer - count_delete - count_insert - 1][0] == DIFF_EQUAL) {
                  diffs[pointer - count_delete - count_insert - 1][1] += text_insert.substring(0, commonlength);
                } else {
                  diffs.splice(0, 0, new diff_match_patch.Diff(
                    DIFF_EQUAL,
                    text_insert.substring(0, commonlength)
                  ));
                  pointer++;
                }
                text_insert = text_insert.substring(commonlength);
                text_delete = text_delete.substring(commonlength);
              }
              commonlength = this.diff_commonSuffix(text_insert, text_delete);
              if (commonlength !== 0) {
                diffs[pointer][1] = text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1];
                text_insert = text_insert.substring(0, text_insert.length - commonlength);
                text_delete = text_delete.substring(0, text_delete.length - commonlength);
              }
            }
            pointer -= count_delete + count_insert;
            diffs.splice(pointer, count_delete + count_insert);
            if (text_delete.length) {
              diffs.splice(
                pointer,
                0,
                new diff_match_patch.Diff(DIFF_DELETE, text_delete)
              );
              pointer++;
            }
            if (text_insert.length) {
              diffs.splice(
                pointer,
                0,
                new diff_match_patch.Diff(DIFF_INSERT, text_insert)
              );
              pointer++;
            }
            pointer++;
          } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {
            diffs[pointer - 1][1] += diffs[pointer][1];
            diffs.splice(pointer, 1);
          } else {
            pointer++;
          }
          count_insert = 0;
          count_delete = 0;
          text_delete = "";
          text_insert = "";
          break;
      }
    }
    if (diffs[diffs.length - 1][1] === "") {
      diffs.pop();
    }
    var changes = false;
    pointer = 1;
    while (pointer < diffs.length - 1) {
      if (diffs[pointer - 1][0] == DIFF_EQUAL && diffs[pointer + 1][0] == DIFF_EQUAL) {
        if (diffs[pointer][1].substring(diffs[pointer][1].length - diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {
          diffs[pointer][1] = diffs[pointer - 1][1] + diffs[pointer][1].substring(0, diffs[pointer][1].length - diffs[pointer - 1][1].length);
          diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
          diffs.splice(pointer - 1, 1);
          changes = true;
        } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) == diffs[pointer + 1][1]) {
          diffs[pointer - 1][1] += diffs[pointer + 1][1];
          diffs[pointer][1] = diffs[pointer][1].substring(diffs[pointer + 1][1].length) + diffs[pointer + 1][1];
          diffs.splice(pointer + 1, 1);
          changes = true;
        }
      }
      pointer++;
    }
    if (changes) {
      this.diff_cleanupMerge(diffs);
    }
  };
  diff_match_patch.prototype.diff_xIndex = function(diffs, loc) {
    var chars1 = 0;
    var chars2 = 0;
    var last_chars1 = 0;
    var last_chars2 = 0;
    var x2;
    for (x2 = 0; x2 < diffs.length; x2++) {
      if (diffs[x2][0] !== DIFF_INSERT) {
        chars1 += diffs[x2][1].length;
      }
      if (diffs[x2][0] !== DIFF_DELETE) {
        chars2 += diffs[x2][1].length;
      }
      if (chars1 > loc) {
        break;
      }
      last_chars1 = chars1;
      last_chars2 = chars2;
    }
    if (diffs.length != x2 && diffs[x2][0] === DIFF_DELETE) {
      return last_chars2;
    }
    return last_chars2 + (loc - last_chars1);
  };
  diff_match_patch.prototype.diff_prettyHtml = function(diffs) {
    var html2 = [];
    var pattern_amp = /&/g;
    var pattern_lt = /</g;
    var pattern_gt = />/g;
    var pattern_para = /\n/g;
    for (var x2 = 0; x2 < diffs.length; x2++) {
      var op = diffs[x2][0];
      var data = diffs[x2][1];
      var text2 = data.replace(pattern_amp, "&amp;").replace(pattern_lt, "&lt;").replace(pattern_gt, "&gt;").replace(pattern_para, "&para;<br>");
      switch (op) {
        case DIFF_INSERT:
          html2[x2] = '<ins style="background:#e6ffe6;">' + text2 + "</ins>";
          break;
        case DIFF_DELETE:
          html2[x2] = '<del style="background:#ffe6e6;">' + text2 + "</del>";
          break;
        case DIFF_EQUAL:
          html2[x2] = "<span>" + text2 + "</span>";
          break;
      }
    }
    return html2.join("");
  };
  diff_match_patch.prototype.diff_text1 = function(diffs) {
    var text2 = [];
    for (var x2 = 0; x2 < diffs.length; x2++) {
      if (diffs[x2][0] !== DIFF_INSERT) {
        text2[x2] = diffs[x2][1];
      }
    }
    return text2.join("");
  };
  diff_match_patch.prototype.diff_text2 = function(diffs) {
    var text2 = [];
    for (var x2 = 0; x2 < diffs.length; x2++) {
      if (diffs[x2][0] !== DIFF_DELETE) {
        text2[x2] = diffs[x2][1];
      }
    }
    return text2.join("");
  };
  diff_match_patch.prototype.diff_levenshtein = function(diffs) {
    var levenshtein = 0;
    var insertions = 0;
    var deletions = 0;
    for (var x2 = 0; x2 < diffs.length; x2++) {
      var op = diffs[x2][0];
      var data = diffs[x2][1];
      switch (op) {
        case DIFF_INSERT:
          insertions += data.length;
          break;
        case DIFF_DELETE:
          deletions += data.length;
          break;
        case DIFF_EQUAL:
          levenshtein += Math.max(insertions, deletions);
          insertions = 0;
          deletions = 0;
          break;
      }
    }
    levenshtein += Math.max(insertions, deletions);
    return levenshtein;
  };
  diff_match_patch.prototype.diff_toDelta = function(diffs) {
    var text2 = [];
    for (var x2 = 0; x2 < diffs.length; x2++) {
      switch (diffs[x2][0]) {
        case DIFF_INSERT:
          text2[x2] = "+" + encodeURI(diffs[x2][1]);
          break;
        case DIFF_DELETE:
          text2[x2] = "-" + diffs[x2][1].length;
          break;
        case DIFF_EQUAL:
          text2[x2] = "=" + diffs[x2][1].length;
          break;
      }
    }
    return text2.join("	").replace(/%20/g, " ");
  };
  diff_match_patch.prototype.diff_fromDelta = function(text1, delta) {
    var diffs = [];
    var diffsLength = 0;
    var pointer = 0;
    var tokens2 = delta.split(/\t/g);
    for (var x2 = 0; x2 < tokens2.length; x2++) {
      var param = tokens2[x2].substring(1);
      switch (tokens2[x2].charAt(0)) {
        case "+":
          try {
            diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_INSERT, decodeURI(param));
          } catch (ex) {
            throw new Error("Illegal escape in diff_fromDelta: " + param);
          }
          break;
        case "-":
        case "=":
          var n2 = parseInt(param, 10);
          if (isNaN(n2) || n2 < 0) {
            throw new Error("Invalid number in diff_fromDelta: " + param);
          }
          var text2 = text1.substring(pointer, pointer += n2);
          if (tokens2[x2].charAt(0) == "=") {
            diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_EQUAL, text2);
          } else {
            diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_DELETE, text2);
          }
          break;
        default:
          if (tokens2[x2]) {
            throw new Error("Invalid diff operation in diff_fromDelta: " + tokens2[x2]);
          }
      }
    }
    if (pointer != text1.length) {
      throw new Error("Delta length (" + pointer + ") does not equal source text length (" + text1.length + ").");
    }
    return diffs;
  };
  diff_match_patch.prototype.match_main = function(text2, pattern4, loc) {
    if (text2 == null || pattern4 == null || loc == null) {
      throw new Error("Null input. (match_main)");
    }
    loc = Math.max(0, Math.min(loc, text2.length));
    if (text2 == pattern4) {
      return 0;
    } else if (!text2.length) {
      return -1;
    } else if (text2.substring(loc, loc + pattern4.length) == pattern4) {
      return loc;
    } else {
      return this.match_bitap_(text2, pattern4, loc);
    }
  };
  diff_match_patch.prototype.match_bitap_ = function(text2, pattern4, loc) {
    if (pattern4.length > this.Match_MaxBits) {
      throw new Error("Pattern too long for this browser.");
    }
    var s2 = this.match_alphabet_(pattern4);
    var dmp = this;
    function match_bitapScore_(e2, x2) {
      var accuracy = e2 / pattern4.length;
      var proximity = Math.abs(loc - x2);
      if (!dmp.Match_Distance) {
        return proximity ? 1 : accuracy;
      }
      return accuracy + proximity / dmp.Match_Distance;
    }
    var score_threshold = this.Match_Threshold;
    var best_loc = text2.indexOf(pattern4, loc);
    if (best_loc != -1) {
      score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);
      best_loc = text2.lastIndexOf(pattern4, loc + pattern4.length);
      if (best_loc != -1) {
        score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);
      }
    }
    var matchmask = 1 << pattern4.length - 1;
    best_loc = -1;
    var bin_min, bin_mid;
    var bin_max = pattern4.length + text2.length;
    var last_rd;
    for (var d2 = 0; d2 < pattern4.length; d2++) {
      bin_min = 0;
      bin_mid = bin_max;
      while (bin_min < bin_mid) {
        if (match_bitapScore_(d2, loc + bin_mid) <= score_threshold) {
          bin_min = bin_mid;
        } else {
          bin_max = bin_mid;
        }
        bin_mid = Math.floor((bin_max - bin_min) / 2 + bin_min);
      }
      bin_max = bin_mid;
      var start2 = Math.max(1, loc - bin_mid + 1);
      var finish = Math.min(loc + bin_mid, text2.length) + pattern4.length;
      var rd2 = Array(finish + 2);
      rd2[finish + 1] = (1 << d2) - 1;
      for (var j2 = finish; j2 >= start2; j2--) {
        var charMatch = s2[text2.charAt(j2 - 1)];
        if (d2 === 0) {
          rd2[j2] = (rd2[j2 + 1] << 1 | 1) & charMatch;
        } else {
          rd2[j2] = (rd2[j2 + 1] << 1 | 1) & charMatch | ((last_rd[j2 + 1] | last_rd[j2]) << 1 | 1) | last_rd[j2 + 1];
        }
        if (rd2[j2] & matchmask) {
          var score = match_bitapScore_(d2, j2 - 1);
          if (score <= score_threshold) {
            score_threshold = score;
            best_loc = j2 - 1;
            if (best_loc > loc) {
              start2 = Math.max(1, 2 * loc - best_loc);
            } else {
              break;
            }
          }
        }
      }
      if (match_bitapScore_(d2 + 1, loc) > score_threshold) {
        break;
      }
      last_rd = rd2;
    }
    return best_loc;
  };
  diff_match_patch.prototype.match_alphabet_ = function(pattern4) {
    var s2 = {};
    for (var i2 = 0; i2 < pattern4.length; i2++) {
      s2[pattern4.charAt(i2)] = 0;
    }
    for (var i2 = 0; i2 < pattern4.length; i2++) {
      s2[pattern4.charAt(i2)] |= 1 << pattern4.length - i2 - 1;
    }
    return s2;
  };
  diff_match_patch.prototype.patch_addContext_ = function(patch2, text2) {
    if (text2.length == 0) {
      return;
    }
    if (patch2.start2 === null) {
      throw Error("patch not initialized");
    }
    var pattern4 = text2.substring(patch2.start2, patch2.start2 + patch2.length1);
    var padding = 0;
    while (text2.indexOf(pattern4) != text2.lastIndexOf(pattern4) && pattern4.length < this.Match_MaxBits - this.Patch_Margin - this.Patch_Margin) {
      padding += this.Patch_Margin;
      pattern4 = text2.substring(
        patch2.start2 - padding,
        patch2.start2 + patch2.length1 + padding
      );
    }
    padding += this.Patch_Margin;
    var prefix = text2.substring(patch2.start2 - padding, patch2.start2);
    if (prefix) {
      patch2.diffs.unshift(new diff_match_patch.Diff(DIFF_EQUAL, prefix));
    }
    var suffix = text2.substring(
      patch2.start2 + patch2.length1,
      patch2.start2 + patch2.length1 + padding
    );
    if (suffix) {
      patch2.diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, suffix));
    }
    patch2.start1 -= prefix.length;
    patch2.start2 -= prefix.length;
    patch2.length1 += prefix.length + suffix.length;
    patch2.length2 += prefix.length + suffix.length;
  };
  diff_match_patch.prototype.patch_make = function(a2, opt_b, opt_c) {
    var text1, diffs;
    if (typeof a2 == "string" && typeof opt_b == "string" && typeof opt_c == "undefined") {
      text1 = /** @type {string} */
      a2;
      diffs = this.diff_main(
        text1,
        /** @type {string} */
        opt_b,
        true
      );
      if (diffs.length > 2) {
        this.diff_cleanupSemantic(diffs);
        this.diff_cleanupEfficiency(diffs);
      }
    } else if (a2 && typeof a2 == "object" && typeof opt_b == "undefined" && typeof opt_c == "undefined") {
      diffs = /** @type {!Array.<!diff_match_patch.Diff>} */
      a2;
      text1 = this.diff_text1(diffs);
    } else if (typeof a2 == "string" && opt_b && typeof opt_b == "object" && typeof opt_c == "undefined") {
      text1 = /** @type {string} */
      a2;
      diffs = /** @type {!Array.<!diff_match_patch.Diff>} */
      opt_b;
    } else if (typeof a2 == "string" && typeof opt_b == "string" && opt_c && typeof opt_c == "object") {
      text1 = /** @type {string} */
      a2;
      diffs = /** @type {!Array.<!diff_match_patch.Diff>} */
      opt_c;
    } else {
      throw new Error("Unknown call format to patch_make.");
    }
    if (diffs.length === 0) {
      return [];
    }
    var patches = [];
    var patch2 = new diff_match_patch.patch_obj();
    var patchDiffLength = 0;
    var char_count1 = 0;
    var char_count2 = 0;
    var prepatch_text = text1;
    var postpatch_text = text1;
    for (var x2 = 0; x2 < diffs.length; x2++) {
      var diff_type = diffs[x2][0];
      var diff_text = diffs[x2][1];
      if (!patchDiffLength && diff_type !== DIFF_EQUAL) {
        patch2.start1 = char_count1;
        patch2.start2 = char_count2;
      }
      switch (diff_type) {
        case DIFF_INSERT:
          patch2.diffs[patchDiffLength++] = diffs[x2];
          patch2.length2 += diff_text.length;
          postpatch_text = postpatch_text.substring(0, char_count2) + diff_text + postpatch_text.substring(char_count2);
          break;
        case DIFF_DELETE:
          patch2.length1 += diff_text.length;
          patch2.diffs[patchDiffLength++] = diffs[x2];
          postpatch_text = postpatch_text.substring(0, char_count2) + postpatch_text.substring(char_count2 + diff_text.length);
          break;
        case DIFF_EQUAL:
          if (diff_text.length <= 2 * this.Patch_Margin && patchDiffLength && diffs.length != x2 + 1) {
            patch2.diffs[patchDiffLength++] = diffs[x2];
            patch2.length1 += diff_text.length;
            patch2.length2 += diff_text.length;
          } else if (diff_text.length >= 2 * this.Patch_Margin) {
            if (patchDiffLength) {
              this.patch_addContext_(patch2, prepatch_text);
              patches.push(patch2);
              patch2 = new diff_match_patch.patch_obj();
              patchDiffLength = 0;
              prepatch_text = postpatch_text;
              char_count1 = char_count2;
            }
          }
          break;
      }
      if (diff_type !== DIFF_INSERT) {
        char_count1 += diff_text.length;
      }
      if (diff_type !== DIFF_DELETE) {
        char_count2 += diff_text.length;
      }
    }
    if (patchDiffLength) {
      this.patch_addContext_(patch2, prepatch_text);
      patches.push(patch2);
    }
    return patches;
  };
  diff_match_patch.prototype.patch_deepCopy = function(patches) {
    var patchesCopy = [];
    for (var x2 = 0; x2 < patches.length; x2++) {
      var patch2 = patches[x2];
      var patchCopy = new diff_match_patch.patch_obj();
      patchCopy.diffs = [];
      for (var y2 = 0; y2 < patch2.diffs.length; y2++) {
        patchCopy.diffs[y2] = new diff_match_patch.Diff(patch2.diffs[y2][0], patch2.diffs[y2][1]);
      }
      patchCopy.start1 = patch2.start1;
      patchCopy.start2 = patch2.start2;
      patchCopy.length1 = patch2.length1;
      patchCopy.length2 = patch2.length2;
      patchesCopy[x2] = patchCopy;
    }
    return patchesCopy;
  };
  diff_match_patch.prototype.patch_apply = function(patches, text2) {
    if (patches.length == 0) {
      return [text2, []];
    }
    patches = this.patch_deepCopy(patches);
    var nullPadding = this.patch_addPadding(patches);
    text2 = nullPadding + text2 + nullPadding;
    this.patch_splitMax(patches);
    var delta = 0;
    var results = [];
    for (var x2 = 0; x2 < patches.length; x2++) {
      var expected_loc = patches[x2].start2 + delta;
      var text1 = this.diff_text1(patches[x2].diffs);
      var start_loc;
      var end_loc = -1;
      if (text1.length > this.Match_MaxBits) {
        start_loc = this.match_main(
          text2,
          text1.substring(0, this.Match_MaxBits),
          expected_loc
        );
        if (start_loc != -1) {
          end_loc = this.match_main(
            text2,
            text1.substring(text1.length - this.Match_MaxBits),
            expected_loc + text1.length - this.Match_MaxBits
          );
          if (end_loc == -1 || start_loc >= end_loc) {
            start_loc = -1;
          }
        }
      } else {
        start_loc = this.match_main(text2, text1, expected_loc);
      }
      if (start_loc == -1) {
        results[x2] = false;
        delta -= patches[x2].length2 - patches[x2].length1;
      } else {
        results[x2] = true;
        delta = start_loc - expected_loc;
        var text22;
        if (end_loc == -1) {
          text22 = text2.substring(start_loc, start_loc + text1.length);
        } else {
          text22 = text2.substring(start_loc, end_loc + this.Match_MaxBits);
        }
        if (text1 == text22) {
          text2 = text2.substring(0, start_loc) + this.diff_text2(patches[x2].diffs) + text2.substring(start_loc + text1.length);
        } else {
          var diffs = this.diff_main(text1, text22, false);
          if (text1.length > this.Match_MaxBits && this.diff_levenshtein(diffs) / text1.length > this.Patch_DeleteThreshold) {
            results[x2] = false;
          } else {
            this.diff_cleanupSemanticLossless(diffs);
            var index1 = 0;
            var index2;
            for (var y2 = 0; y2 < patches[x2].diffs.length; y2++) {
              var mod2 = patches[x2].diffs[y2];
              if (mod2[0] !== DIFF_EQUAL) {
                index2 = this.diff_xIndex(diffs, index1);
              }
              if (mod2[0] === DIFF_INSERT) {
                text2 = text2.substring(0, start_loc + index2) + mod2[1] + text2.substring(start_loc + index2);
              } else if (mod2[0] === DIFF_DELETE) {
                text2 = text2.substring(0, start_loc + index2) + text2.substring(start_loc + this.diff_xIndex(
                  diffs,
                  index1 + mod2[1].length
                ));
              }
              if (mod2[0] !== DIFF_DELETE) {
                index1 += mod2[1].length;
              }
            }
          }
        }
      }
    }
    text2 = text2.substring(nullPadding.length, text2.length - nullPadding.length);
    return [text2, results];
  };
  diff_match_patch.prototype.patch_addPadding = function(patches) {
    var paddingLength = this.Patch_Margin;
    var nullPadding = "";
    for (var x2 = 1; x2 <= paddingLength; x2++) {
      nullPadding += String.fromCharCode(x2);
    }
    for (var x2 = 0; x2 < patches.length; x2++) {
      patches[x2].start1 += paddingLength;
      patches[x2].start2 += paddingLength;
    }
    var patch2 = patches[0];
    var diffs = patch2.diffs;
    if (diffs.length == 0 || diffs[0][0] != DIFF_EQUAL) {
      diffs.unshift(new diff_match_patch.Diff(DIFF_EQUAL, nullPadding));
      patch2.start1 -= paddingLength;
      patch2.start2 -= paddingLength;
      patch2.length1 += paddingLength;
      patch2.length2 += paddingLength;
    } else if (paddingLength > diffs[0][1].length) {
      var extraLength = paddingLength - diffs[0][1].length;
      diffs[0][1] = nullPadding.substring(diffs[0][1].length) + diffs[0][1];
      patch2.start1 -= extraLength;
      patch2.start2 -= extraLength;
      patch2.length1 += extraLength;
      patch2.length2 += extraLength;
    }
    patch2 = patches[patches.length - 1];
    diffs = patch2.diffs;
    if (diffs.length == 0 || diffs[diffs.length - 1][0] != DIFF_EQUAL) {
      diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, nullPadding));
      patch2.length1 += paddingLength;
      patch2.length2 += paddingLength;
    } else if (paddingLength > diffs[diffs.length - 1][1].length) {
      var extraLength = paddingLength - diffs[diffs.length - 1][1].length;
      diffs[diffs.length - 1][1] += nullPadding.substring(0, extraLength);
      patch2.length1 += extraLength;
      patch2.length2 += extraLength;
    }
    return nullPadding;
  };
  diff_match_patch.prototype.patch_splitMax = function(patches) {
    var patch_size = this.Match_MaxBits;
    for (var x2 = 0; x2 < patches.length; x2++) {
      if (patches[x2].length1 <= patch_size) {
        continue;
      }
      var bigpatch = patches[x2];
      patches.splice(x2--, 1);
      var start1 = bigpatch.start1;
      var start2 = bigpatch.start2;
      var precontext = "";
      while (bigpatch.diffs.length !== 0) {
        var patch2 = new diff_match_patch.patch_obj();
        var empty2 = true;
        patch2.start1 = start1 - precontext.length;
        patch2.start2 = start2 - precontext.length;
        if (precontext !== "") {
          patch2.length1 = patch2.length2 = precontext.length;
          patch2.diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, precontext));
        }
        while (bigpatch.diffs.length !== 0 && patch2.length1 < patch_size - this.Patch_Margin) {
          var diff_type = bigpatch.diffs[0][0];
          var diff_text = bigpatch.diffs[0][1];
          if (diff_type === DIFF_INSERT) {
            patch2.length2 += diff_text.length;
            start2 += diff_text.length;
            patch2.diffs.push(bigpatch.diffs.shift());
            empty2 = false;
          } else if (diff_type === DIFF_DELETE && patch2.diffs.length == 1 && patch2.diffs[0][0] == DIFF_EQUAL && diff_text.length > 2 * patch_size) {
            patch2.length1 += diff_text.length;
            start1 += diff_text.length;
            empty2 = false;
            patch2.diffs.push(new diff_match_patch.Diff(diff_type, diff_text));
            bigpatch.diffs.shift();
          } else {
            diff_text = diff_text.substring(
              0,
              patch_size - patch2.length1 - this.Patch_Margin
            );
            patch2.length1 += diff_text.length;
            start1 += diff_text.length;
            if (diff_type === DIFF_EQUAL) {
              patch2.length2 += diff_text.length;
              start2 += diff_text.length;
            } else {
              empty2 = false;
            }
            patch2.diffs.push(new diff_match_patch.Diff(diff_type, diff_text));
            if (diff_text == bigpatch.diffs[0][1]) {
              bigpatch.diffs.shift();
            } else {
              bigpatch.diffs[0][1] = bigpatch.diffs[0][1].substring(diff_text.length);
            }
          }
        }
        precontext = this.diff_text2(patch2.diffs);
        precontext = precontext.substring(precontext.length - this.Patch_Margin);
        var postcontext = this.diff_text1(bigpatch.diffs).substring(0, this.Patch_Margin);
        if (postcontext !== "") {
          patch2.length1 += postcontext.length;
          patch2.length2 += postcontext.length;
          if (patch2.diffs.length !== 0 && patch2.diffs[patch2.diffs.length - 1][0] === DIFF_EQUAL) {
            patch2.diffs[patch2.diffs.length - 1][1] += postcontext;
          } else {
            patch2.diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, postcontext));
          }
        }
        if (!empty2) {
          patches.splice(++x2, 0, patch2);
        }
      }
    }
  };
  diff_match_patch.prototype.patch_toText = function(patches) {
    var text2 = [];
    for (var x2 = 0; x2 < patches.length; x2++) {
      text2[x2] = patches[x2];
    }
    return text2.join("");
  };
  diff_match_patch.prototype.patch_fromText = function(textline) {
    var patches = [];
    if (!textline) {
      return patches;
    }
    var text2 = textline.split("\n");
    var textPointer = 0;
    var patchHeader = /^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;
    while (textPointer < text2.length) {
      var m2 = text2[textPointer].match(patchHeader);
      if (!m2) {
        throw new Error("Invalid patch string: " + text2[textPointer]);
      }
      var patch2 = new diff_match_patch.patch_obj();
      patches.push(patch2);
      patch2.start1 = parseInt(m2[1], 10);
      if (m2[2] === "") {
        patch2.start1--;
        patch2.length1 = 1;
      } else if (m2[2] == "0") {
        patch2.length1 = 0;
      } else {
        patch2.start1--;
        patch2.length1 = parseInt(m2[2], 10);
      }
      patch2.start2 = parseInt(m2[3], 10);
      if (m2[4] === "") {
        patch2.start2--;
        patch2.length2 = 1;
      } else if (m2[4] == "0") {
        patch2.length2 = 0;
      } else {
        patch2.start2--;
        patch2.length2 = parseInt(m2[4], 10);
      }
      textPointer++;
      while (textPointer < text2.length) {
        var sign2 = text2[textPointer].charAt(0);
        try {
          var line2 = decodeURI(text2[textPointer].substring(1));
        } catch (ex) {
          throw new Error("Illegal escape in patch_fromText: " + line2);
        }
        if (sign2 == "-") {
          patch2.diffs.push(new diff_match_patch.Diff(DIFF_DELETE, line2));
        } else if (sign2 == "+") {
          patch2.diffs.push(new diff_match_patch.Diff(DIFF_INSERT, line2));
        } else if (sign2 == " ") {
          patch2.diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, line2));
        } else if (sign2 == "@") {
          break;
        } else if (sign2 === "")
          ;
        else {
          throw new Error('Invalid patch mode "' + sign2 + '" in: ' + line2);
        }
        textPointer++;
      }
    }
    return patches;
  };
  diff_match_patch.patch_obj = function() {
    this.diffs = [];
    this.start1 = null;
    this.start2 = null;
    this.length1 = 0;
    this.length2 = 0;
  };
  diff_match_patch.patch_obj.prototype.toString = function() {
    var coords1, coords2;
    if (this.length1 === 0) {
      coords1 = this.start1 + ",0";
    } else if (this.length1 == 1) {
      coords1 = this.start1 + 1;
    } else {
      coords1 = this.start1 + 1 + "," + this.length1;
    }
    if (this.length2 === 0) {
      coords2 = this.start2 + ",0";
    } else if (this.length2 == 1) {
      coords2 = this.start2 + 1;
    } else {
      coords2 = this.start2 + 1 + "," + this.length2;
    }
    var text2 = ["@@ -" + coords1 + " +" + coords2 + " @@\n"];
    var op;
    for (var x2 = 0; x2 < this.diffs.length; x2++) {
      switch (this.diffs[x2][0]) {
        case DIFF_INSERT:
          op = "+";
          break;
        case DIFF_DELETE:
          op = "-";
          break;
        case DIFF_EQUAL:
          op = " ";
          break;
      }
      text2[x2 + 1] = op + encodeURI(this.diffs[x2][1]) + "\n";
    }
    return text2.join("").replace(/%20/g, " ");
  };
  module2.exports = diff_match_patch;
  module2.exports["diff_match_patch"] = diff_match_patch;
  module2.exports["DIFF_DELETE"] = DIFF_DELETE;
  module2.exports["DIFF_INSERT"] = DIFF_INSERT;
  module2.exports["DIFF_EQUAL"] = DIFF_EQUAL;
})(diffMatchPatch);
var diffMatchPatchExports = diffMatchPatch.exports;
const DiffMatchPatch$1 = /* @__PURE__ */ getDefaultExportFromCjs(diffMatchPatchExports);
var __extends$1 = commonjsGlobal && commonjsGlobal.__extends || /* @__PURE__ */ function() {
  var extendStatics = function(d2, b2) {
    extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
      d3.__proto__ = b3;
    } || function(d3, b3) {
      for (var p2 in b3)
        if (Object.prototype.hasOwnProperty.call(b3, p2))
          d3[p2] = b3[p2];
    };
    return extendStatics(d2, b2);
  };
  return function(d2, b2) {
    if (typeof b2 !== "function" && b2 !== null)
      throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
    extendStatics(d2, b2);
    function __() {
      this.constructor = d2;
    }
    d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
  };
}();
Object.defineProperty(diff$2, "__esModule", { value: true });
var PropTypes$1 = propTypesExports;
var React$1 = reactExports;
var split_1$1 = split;
var DiffMatchPatch = diffMatchPatchExports;
var DiffComponent = (
  /** @class */
  function(_super) {
    __extends$1(DiffComponent2, _super);
    function DiffComponent2(props) {
      var _this = _super.call(this, props) || this;
      _this.state = {
        value: _this.props.value
      };
      _this.onChange = _this.onChange.bind(_this);
      _this.diff = _this.diff.bind(_this);
      return _this;
    }
    DiffComponent2.prototype.componentDidUpdate = function() {
      var value2 = this.props.value;
      if (value2 !== this.state.value) {
        this.setState({ value: value2 });
      }
    };
    DiffComponent2.prototype.onChange = function(value2) {
      this.setState({
        value: value2
      });
      if (this.props.onChange) {
        this.props.onChange(value2);
      }
    };
    DiffComponent2.prototype.diff = function() {
      var dmp = new DiffMatchPatch();
      var lhString = this.state.value[0];
      var rhString = this.state.value[1];
      if (lhString.length === 0 && rhString.length === 0) {
        return [];
      }
      var diff2 = dmp.diff_main(lhString, rhString);
      dmp.diff_cleanupSemantic(diff2);
      var diffedLines = this.generateDiffedLines(diff2);
      var codeEditorSettings = this.setCodeMarkers(diffedLines);
      return codeEditorSettings;
    };
    DiffComponent2.prototype.generateDiffedLines = function(diff2) {
      var C2 = {
        DIFF_EQUAL: 0,
        DIFF_DELETE: -1,
        DIFF_INSERT: 1
      };
      var diffedLines = {
        left: [],
        right: []
      };
      var cursor = {
        left: 1,
        right: 1
      };
      diff2.forEach(function(chunk) {
        var chunkType = chunk[0];
        var text2 = chunk[1];
        var lines = text2.split("\n").length - 1;
        if (text2.length === 0) {
          return;
        }
        var firstChar = text2[0];
        var lastChar = text2[text2.length - 1];
        var linesToHighlight = 0;
        switch (chunkType) {
          case C2.DIFF_EQUAL:
            cursor.left += lines;
            cursor.right += lines;
            break;
          case C2.DIFF_DELETE:
            if (firstChar === "\n") {
              cursor.left++;
              lines--;
            }
            linesToHighlight = lines;
            if (linesToHighlight === 0) {
              diffedLines.right.push({
                startLine: cursor.right,
                endLine: cursor.right
              });
            }
            if (lastChar === "\n") {
              linesToHighlight -= 1;
            }
            diffedLines.left.push({
              startLine: cursor.left,
              endLine: cursor.left + linesToHighlight
            });
            cursor.left += lines;
            break;
          case C2.DIFF_INSERT:
            if (firstChar === "\n") {
              cursor.right++;
              lines--;
            }
            linesToHighlight = lines;
            if (linesToHighlight === 0) {
              diffedLines.left.push({
                startLine: cursor.left,
                endLine: cursor.left
              });
            }
            if (lastChar === "\n") {
              linesToHighlight -= 1;
            }
            diffedLines.right.push({
              startLine: cursor.right,
              endLine: cursor.right + linesToHighlight
            });
            cursor.right += lines;
            break;
          default:
            throw new Error("Diff type was not defined.");
        }
      });
      return diffedLines;
    };
    DiffComponent2.prototype.setCodeMarkers = function(diffedLines) {
      if (diffedLines === void 0) {
        diffedLines = { left: [], right: [] };
      }
      var codeEditorSettings = [];
      var newMarkerSet = {
        left: [],
        right: []
      };
      for (var i2 = 0; i2 < diffedLines.left.length; i2++) {
        var markerObj = {
          startRow: diffedLines.left[i2].startLine - 1,
          endRow: diffedLines.left[i2].endLine,
          type: "text",
          className: "codeMarker"
        };
        newMarkerSet.left.push(markerObj);
      }
      for (var i2 = 0; i2 < diffedLines.right.length; i2++) {
        var markerObj = {
          startRow: diffedLines.right[i2].startLine - 1,
          endRow: diffedLines.right[i2].endLine,
          type: "text",
          className: "codeMarker"
        };
        newMarkerSet.right.push(markerObj);
      }
      codeEditorSettings[0] = newMarkerSet.left;
      codeEditorSettings[1] = newMarkerSet.right;
      return codeEditorSettings;
    };
    DiffComponent2.prototype.render = function() {
      var markers = this.diff();
      return React$1.createElement(split_1$1.default, { name: this.props.name, className: this.props.className, focus: this.props.focus, orientation: this.props.orientation, splits: this.props.splits, mode: this.props.mode, theme: this.props.theme, height: this.props.height, width: this.props.width, fontSize: this.props.fontSize, showGutter: this.props.showGutter, onChange: this.onChange, onPaste: this.props.onPaste, onLoad: this.props.onLoad, onScroll: this.props.onScroll, minLines: this.props.minLines, maxLines: this.props.maxLines, readOnly: this.props.readOnly, highlightActiveLine: this.props.highlightActiveLine, showPrintMargin: this.props.showPrintMargin, tabSize: this.props.tabSize, cursorStart: this.props.cursorStart, editorProps: this.props.editorProps, style: this.props.style, scrollMargin: this.props.scrollMargin, setOptions: this.props.setOptions, wrapEnabled: this.props.wrapEnabled, enableBasicAutocompletion: this.props.enableBasicAutocompletion, enableLiveAutocompletion: this.props.enableLiveAutocompletion, value: this.state.value, markers });
    };
    DiffComponent2.propTypes = {
      cursorStart: PropTypes$1.number,
      editorProps: PropTypes$1.object,
      enableBasicAutocompletion: PropTypes$1.bool,
      enableLiveAutocompletion: PropTypes$1.bool,
      focus: PropTypes$1.bool,
      fontSize: PropTypes$1.number,
      height: PropTypes$1.string,
      highlightActiveLine: PropTypes$1.bool,
      maxLines: PropTypes$1.number,
      minLines: PropTypes$1.number,
      mode: PropTypes$1.string,
      name: PropTypes$1.string,
      className: PropTypes$1.string,
      onLoad: PropTypes$1.func,
      onPaste: PropTypes$1.func,
      onScroll: PropTypes$1.func,
      onChange: PropTypes$1.func,
      orientation: PropTypes$1.string,
      readOnly: PropTypes$1.bool,
      scrollMargin: PropTypes$1.array,
      setOptions: PropTypes$1.object,
      showGutter: PropTypes$1.bool,
      showPrintMargin: PropTypes$1.bool,
      splits: PropTypes$1.number,
      style: PropTypes$1.object,
      tabSize: PropTypes$1.number,
      theme: PropTypes$1.string,
      value: PropTypes$1.array,
      width: PropTypes$1.string,
      wrapEnabled: PropTypes$1.bool
    };
    DiffComponent2.defaultProps = {
      cursorStart: 1,
      editorProps: {},
      enableBasicAutocompletion: false,
      enableLiveAutocompletion: false,
      focus: false,
      fontSize: 12,
      height: "500px",
      highlightActiveLine: true,
      maxLines: null,
      minLines: null,
      mode: "",
      name: "ace-editor",
      onLoad: null,
      onScroll: null,
      onPaste: null,
      onChange: null,
      orientation: "beside",
      readOnly: false,
      scrollMargin: [0, 0, 0, 0],
      setOptions: {},
      showGutter: true,
      showPrintMargin: true,
      splits: 2,
      style: {},
      tabSize: 4,
      theme: "github",
      value: ["", ""],
      width: "500px",
      wrapEnabled: true
    };
    return DiffComponent2;
  }(React$1.Component)
);
diff$2.default = DiffComponent;
Object.defineProperty(lib, "__esModule", { value: true });
lib.diff = lib.split = void 0;
var ace_1 = ace$4;
var diff_1 = diff$2;
lib.diff = diff_1.default;
var split_1 = split;
lib.split = split_1.default;
var _default$1 = lib.default = ace_1.default;
var modeJavascript = { exports: {} };
(function(module2, exports2) {
  ace.define("ace/mode/jsdoc_comment_highlight_rules", ["require", "exports", "module", "ace/lib/oop", "ace/mode/text_highlight_rules"], function(require2, exports3, module3) {
    var oop = require2("../lib/oop");
    var TextHighlightRules = require2("./text_highlight_rules").TextHighlightRules;
    var JsDocCommentHighlightRules = function() {
      this.$rules = {
        "start": [
          {
            token: ["comment.doc.tag", "comment.doc.text", "lparen.doc"],
            regex: "(@(?:param|member|typedef|property|namespace|var|const|callback))(\\s*)({)",
            push: [
              {
                token: "lparen.doc",
                regex: "{",
                push: [
                  {
                    include: "doc-syntax"
                  },
                  {
                    token: "rparen.doc",
                    regex: "}|(?=$)",
                    next: "pop"
                  }
                ]
              },
              {
                token: ["rparen.doc", "text.doc", "variable.parameter.doc", "lparen.doc", "variable.parameter.doc", "rparen.doc"],
                regex: /(})(\s*)(?:([\w=:\/\.]+)|(?:(\[)([\w=:\/\.\-\'\" ]+)(\])))/,
                next: "pop"
              },
              {
                token: "rparen.doc",
                regex: "}|(?=$)",
                next: "pop"
              },
              {
                include: "doc-syntax"
              },
              {
                defaultToken: "text.doc"
              }
            ]
          },
          {
            token: ["comment.doc.tag", "text.doc", "lparen.doc"],
            regex: "(@(?:returns?|yields|type|this|suppress|public|protected|private|package|modifies|implements|external|exception|throws|enum|define|extends))(\\s*)({)",
            push: [
              {
                token: "lparen.doc",
                regex: "{",
                push: [
                  {
                    include: "doc-syntax"
                  },
                  {
                    token: "rparen.doc",
                    regex: "}|(?=$)",
                    next: "pop"
                  }
                ]
              },
              {
                token: "rparen.doc",
                regex: "}|(?=$)",
                next: "pop"
              },
              {
                include: "doc-syntax"
              },
              {
                defaultToken: "text.doc"
              }
            ]
          },
          {
            token: ["comment.doc.tag", "text.doc", "variable.parameter.doc"],
            regex: '(@(?:alias|memberof|instance|module|name|lends|namespace|external|this|template|requires|param|implements|function|extends|typedef|mixes|constructor|var|memberof\\!|event|listens|exports|class|constructs|interface|emits|fires|throws|const|callback|borrows|augments))(\\s+)(\\w[\\w#.:/~"\\-]*)?'
          },
          {
            token: ["comment.doc.tag", "text.doc", "variable.parameter.doc"],
            regex: "(@method)(\\s+)(\\w[\\w.\\(\\)]*)"
          },
          {
            token: "comment.doc.tag",
            regex: "@access\\s+(?:private|public|protected)"
          },
          {
            token: "comment.doc.tag",
            regex: "@kind\\s+(?:class|constant|event|external|file|function|member|mixin|module|namespace|typedef)"
          },
          {
            token: "comment.doc.tag",
            regex: "@\\w+(?=\\s|$)"
          },
          JsDocCommentHighlightRules.getTagRule(),
          {
            defaultToken: "comment.doc.body",
            caseInsensitive: true
          }
        ],
        "doc-syntax": [{
          token: "operator.doc",
          regex: /[|:]/
        }, {
          token: "paren.doc",
          regex: /[\[\]]/
        }]
      };
      this.normalizeRules();
    };
    oop.inherits(JsDocCommentHighlightRules, TextHighlightRules);
    JsDocCommentHighlightRules.getTagRule = function(start2) {
      return {
        token: "comment.doc.tag.storage.type",
        regex: "\\b(?:TODO|FIXME|XXX|HACK)\\b"
      };
    };
    JsDocCommentHighlightRules.getStartRule = function(start2) {
      return {
        token: "comment.doc",
        // doc comment
        regex: /\/\*\*(?!\/)/,
        next: start2
      };
    };
    JsDocCommentHighlightRules.getEndRule = function(start2) {
      return {
        token: "comment.doc",
        // closing comment
        regex: "\\*\\/",
        next: start2
      };
    };
    exports3.JsDocCommentHighlightRules = JsDocCommentHighlightRules;
  });
  ace.define("ace/mode/javascript_highlight_rules", ["require", "exports", "module", "ace/lib/oop", "ace/mode/jsdoc_comment_highlight_rules", "ace/mode/text_highlight_rules"], function(require2, exports3, module3) {
    var oop = require2("../lib/oop");
    var DocCommentHighlightRules = require2("./jsdoc_comment_highlight_rules").JsDocCommentHighlightRules;
    var TextHighlightRules = require2("./text_highlight_rules").TextHighlightRules;
    var identifierRe = "[a-zA-Z\\$_¡-][a-zA-Z\\d\\$_¡-]*";
    var JavaScriptHighlightRules = function(options) {
      var keywords = {
        "variable.language": "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Symbol|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document",
        // Pseudo
        "keyword": "const|yield|import|get|set|async|await|break|case|catch|continue|default|delete|do|else|finally|for|if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static|constructor",
        "storage.type": "const|let|var|function",
        "constant.language": "null|Infinity|NaN|undefined",
        "support.function": "alert",
        "constant.language.boolean": "true|false"
      };
      var keywordMapper = this.createKeywordMapper(keywords, "identifier");
      var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
      var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|u{[0-9a-fA-F]{1,6}}|[0-2][0-7]{0,2}|3[0-7][0-7]?|[4-7][0-7]?|.)";
      var anonymousFunctionRe = "(function)(\\s*)(\\*?)";
      var functionCallStartRule = {
        token: ["identifier", "text", "paren.lparen"],
        regex: "(\\b(?!" + Object.values(keywords).join("|") + "\\b)" + identifierRe + ")(\\s*)(\\()"
      };
      this.$rules = {
        "no_regex": [
          DocCommentHighlightRules.getStartRule("doc-start"),
          comments("no_regex"),
          functionCallStartRule,
          {
            token: "string",
            regex: "'(?=.)",
            next: "qstring"
          },
          {
            token: "string",
            regex: '"(?=.)',
            next: "qqstring"
          },
          {
            token: "constant.numeric",
            // hexadecimal, octal and binary
            regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
          },
          {
            token: "constant.numeric",
            // decimal integers and floats
            regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
          },
          {
            token: [
              "entity.name.function",
              "text",
              "keyword.operator",
              "text",
              "storage.type",
              "text",
              "storage.type",
              "text",
              "paren.lparen"
            ],
            regex: "(" + identifierRe + ")(\\s*)(=)(\\s*)" + anonymousFunctionRe + "(\\s*)(\\()",
            next: "function_arguments"
          },
          {
            token: [
              "storage.type",
              "text",
              "storage.type",
              "text",
              "text",
              "entity.name.function",
              "text",
              "paren.lparen"
            ],
            regex: "(function)(?:(?:(\\s*)(\\*)(\\s*))|(\\s+))(" + identifierRe + ")(\\s*)(\\()",
            next: "function_arguments"
          },
          {
            token: [
              "entity.name.function",
              "text",
              "punctuation.operator",
              "text",
              "storage.type",
              "text",
              "storage.type",
              "text",
              "paren.lparen"
            ],
            regex: "(" + identifierRe + ")(\\s*)(:)(\\s*)" + anonymousFunctionRe + "(\\s*)(\\()",
            next: "function_arguments"
          },
          {
            token: [
              "text",
              "text",
              "storage.type",
              "text",
              "storage.type",
              "text",
              "paren.lparen"
            ],
            regex: "(:)(\\s*)" + anonymousFunctionRe + "(\\s*)(\\()",
            next: "function_arguments"
          },
          {
            token: "keyword",
            regex: `from(?=\\s*('|"))`
          },
          {
            token: "keyword",
            regex: "(?:" + kwBeforeRe + ")\\b",
            next: "start"
          },
          {
            token: "support.constant",
            regex: /that\b/
          },
          {
            token: ["storage.type", "punctuation.operator", "support.function.firebug"],
            regex: /(console)(\.)(warn|info|log|error|debug|time|trace|timeEnd|assert)\b/
          },
          {
            token: keywordMapper,
            regex: identifierRe
          },
          {
            token: "punctuation.operator",
            regex: /[.](?![.])/,
            next: "property"
          },
          {
            token: "storage.type",
            regex: /=>/,
            next: "start"
          },
          {
            token: "keyword.operator",
            regex: /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
            next: "start"
          },
          {
            token: "punctuation.operator",
            regex: /[?:,;.]/,
            next: "start"
          },
          {
            token: "paren.lparen",
            regex: /[\[({]/,
            next: "start"
          },
          {
            token: "paren.rparen",
            regex: /[\])}]/
          },
          {
            token: "comment",
            regex: /^#!.*$/
          }
        ],
        property: [
          {
            token: "text",
            regex: "\\s+"
          },
          {
            token: "keyword.operator",
            regex: /=/
          },
          {
            token: [
              "storage.type",
              "text",
              "storage.type",
              "text",
              "paren.lparen"
            ],
            regex: anonymousFunctionRe + "(\\s*)(\\()",
            next: "function_arguments"
          },
          {
            token: [
              "storage.type",
              "text",
              "storage.type",
              "text",
              "text",
              "entity.name.function",
              "text",
              "paren.lparen"
            ],
            regex: "(function)(?:(?:(\\s*)(\\*)(\\s*))|(\\s+))(\\w+)(\\s*)(\\()",
            next: "function_arguments"
          },
          {
            token: "punctuation.operator",
            regex: /[.](?![.])/
          },
          {
            token: "support.function",
            regex: "prototype"
          },
          {
            token: "support.function",
            regex: /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|lter|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward|rEach)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
          },
          {
            token: "support.function.dom",
            regex: /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
          },
          {
            token: "support.constant",
            regex: /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
          },
          {
            token: "identifier",
            regex: identifierRe
          },
          {
            regex: "",
            token: "empty",
            next: "no_regex"
          }
        ],
        "start": [
          DocCommentHighlightRules.getStartRule("doc-start"),
          comments("start"),
          {
            token: "string.regexp",
            regex: "\\/",
            next: "regex"
          },
          {
            token: "text",
            regex: "\\s+|^$",
            next: "start"
          },
          {
            token: "empty",
            regex: "",
            next: "no_regex"
          }
        ],
        "regex": [
          {
            token: "regexp.keyword.operator",
            regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
          },
          {
            token: "string.regexp",
            regex: "/[sxngimy]*",
            next: "no_regex"
          },
          {
            token: "invalid",
            regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
          },
          {
            token: "constant.language.escape",
            regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
          },
          {
            token: "constant.language.delimiter",
            regex: /\|/
          },
          {
            token: "constant.language.escape",
            regex: /\[\^?/,
            next: "regex_character_class"
          },
          {
            token: "empty",
            regex: "$",
            next: "no_regex"
          },
          {
            defaultToken: "string.regexp"
          }
        ],
        "regex_character_class": [
          {
            token: "regexp.charclass.keyword.operator",
            regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
          },
          {
            token: "constant.language.escape",
            regex: "]",
            next: "regex"
          },
          {
            token: "constant.language.escape",
            regex: "-"
          },
          {
            token: "empty",
            regex: "$",
            next: "no_regex"
          },
          {
            defaultToken: "string.regexp.charachterclass"
          }
        ],
        "default_parameter": [
          {
            token: "string",
            regex: "'(?=.)",
            push: [
              {
                token: "string",
                regex: "'|$",
                next: "pop"
              },
              {
                include: "qstring"
              }
            ]
          },
          {
            token: "string",
            regex: '"(?=.)',
            push: [
              {
                token: "string",
                regex: '"|$',
                next: "pop"
              },
              {
                include: "qqstring"
              }
            ]
          },
          {
            token: "constant.language",
            regex: "null|Infinity|NaN|undefined"
          },
          {
            token: "constant.numeric",
            // hexadecimal, octal and binary
            regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
          },
          {
            token: "constant.numeric",
            // decimal integers and floats
            regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
          },
          {
            token: "punctuation.operator",
            regex: ",",
            next: "function_arguments"
          },
          {
            token: "text",
            regex: "\\s+"
          },
          {
            token: "punctuation.operator",
            regex: "$"
          },
          {
            token: "empty",
            regex: "",
            next: "no_regex"
          }
        ],
        "function_arguments": [
          comments("function_arguments"),
          {
            token: "variable.parameter",
            regex: identifierRe
          },
          {
            token: "punctuation.operator",
            regex: ","
          },
          {
            token: "text",
            regex: "\\s+"
          },
          {
            token: "punctuation.operator",
            regex: "$"
          },
          {
            token: "empty",
            regex: "",
            next: "no_regex"
          }
        ],
        "qqstring": [
          {
            token: "constant.language.escape",
            regex: escapedRe
          },
          {
            token: "string",
            regex: "\\\\$",
            consumeLineEnd: true
          },
          {
            token: "string",
            regex: '"|$',
            next: "no_regex"
          },
          {
            defaultToken: "string"
          }
        ],
        "qstring": [
          {
            token: "constant.language.escape",
            regex: escapedRe
          },
          {
            token: "string",
            regex: "\\\\$",
            consumeLineEnd: true
          },
          {
            token: "string",
            regex: "'|$",
            next: "no_regex"
          },
          {
            defaultToken: "string"
          }
        ]
      };
      if (!options || !options.noES6) {
        this.$rules.no_regex.unshift({
          regex: "[{}]",
          onMatch: function(val, state, stack) {
            this.next = val == "{" ? this.nextState : "";
            if (val == "{" && stack.length) {
              stack.unshift("start", state);
            } else if (val == "}" && stack.length) {
              stack.shift();
              this.next = stack.shift();
              if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
                return "paren.quasi.end";
            }
            return val == "{" ? "paren.lparen" : "paren.rparen";
          },
          nextState: "start"
        }, {
          token: "string.quasi.start",
          regex: /`/,
          push: [{
            token: "constant.language.escape",
            regex: escapedRe
          }, {
            token: "paren.quasi.start",
            regex: /\${/,
            push: "start"
          }, {
            token: "string.quasi.end",
            regex: /`/,
            next: "pop"
          }, {
            defaultToken: "string.quasi"
          }]
        }, {
          token: ["variable.parameter", "text"],
          regex: "(" + identifierRe + ")(\\s*)(?=\\=>)"
        }, {
          token: "paren.lparen",
          regex: "(\\()(?=[^\\(]+\\s*=>)",
          next: "function_arguments"
        }, {
          token: "variable.language",
          regex: "(?:(?:(?:Weak)?(?:Set|Map))|Promise)\\b"
        });
        this.$rules["function_arguments"].unshift({
          token: "keyword.operator",
          regex: "=",
          next: "default_parameter"
        }, {
          token: "keyword.operator",
          regex: "\\.{3}"
        });
        this.$rules["property"].unshift({
          token: "support.function",
          regex: "(findIndex|repeat|startsWith|endsWith|includes|isSafeInteger|trunc|cbrt|log2|log10|sign|then|catch|finally|resolve|reject|race|any|all|allSettled|keys|entries|isInteger)\\b(?=\\()"
        }, {
          token: "constant.language",
          regex: "(?:MAX_SAFE_INTEGER|MIN_SAFE_INTEGER|EPSILON)\\b"
        });
        if (!options || options.jsx != false)
          JSX.call(this);
      }
      this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("no_regex")]);
      this.normalizeRules();
    };
    oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
    function JSX() {
      var tagRegex = identifierRe.replace("\\d", "\\d\\-");
      var jsxTag = {
        onMatch: function(val, state, stack) {
          var offset2 = val.charAt(1) == "/" ? 2 : 1;
          if (offset2 == 1) {
            if (state != this.nextState)
              stack.unshift(this.next, this.nextState, 0);
            else
              stack.unshift(this.next);
            stack[2]++;
          } else if (offset2 == 2) {
            if (state == this.nextState) {
              stack[1]--;
              if (!stack[1] || stack[1] < 0) {
                stack.shift();
                stack.shift();
              }
            }
          }
          return [{
            type: "meta.tag.punctuation." + (offset2 == 1 ? "" : "end-") + "tag-open.xml",
            value: val.slice(0, offset2)
          }, {
            type: "meta.tag.tag-name.xml",
            value: val.substr(offset2)
          }];
        },
        regex: "</?(?:" + tagRegex + "|(?=>))",
        next: "jsxAttributes",
        nextState: "jsx"
      };
      this.$rules.start.unshift(jsxTag);
      var jsxJsRule = {
        regex: "{",
        token: "paren.quasi.start",
        push: "start"
      };
      this.$rules.jsx = [
        jsxJsRule,
        jsxTag,
        { include: "reference" },
        { defaultToken: "string.xml" }
      ];
      this.$rules.jsxAttributes = [
        {
          token: "meta.tag.punctuation.tag-close.xml",
          regex: "/?>",
          onMatch: function(value2, currentState, stack) {
            if (currentState == stack[0])
              stack.shift();
            if (value2.length == 2) {
              if (stack[0] == this.nextState)
                stack[1]--;
              if (!stack[1] || stack[1] < 0) {
                stack.splice(0, 2);
              }
            }
            this.next = stack[0] || "start";
            return [{ type: this.token, value: value2 }];
          },
          nextState: "jsx"
        },
        jsxJsRule,
        comments("jsxAttributes"),
        {
          token: "entity.other.attribute-name.xml",
          regex: tagRegex
        },
        {
          token: "keyword.operator.attribute-equals.xml",
          regex: "="
        },
        {
          token: "text.tag-whitespace.xml",
          regex: "\\s+"
        },
        {
          token: "string.attribute-value.xml",
          regex: "'",
          stateName: "jsx_attr_q",
          push: [
            { token: "string.attribute-value.xml", regex: "'", next: "pop" },
            { include: "reference" },
            { defaultToken: "string.attribute-value.xml" }
          ]
        },
        {
          token: "string.attribute-value.xml",
          regex: '"',
          stateName: "jsx_attr_qq",
          push: [
            { token: "string.attribute-value.xml", regex: '"', next: "pop" },
            { include: "reference" },
            { defaultToken: "string.attribute-value.xml" }
          ]
        },
        jsxTag
      ];
      this.$rules.reference = [{
        token: "constant.language.escape.reference.xml",
        regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
      }];
    }
    function comments(next2) {
      return [
        {
          token: "comment",
          // multi line comment
          regex: /\/\*/,
          next: [
            DocCommentHighlightRules.getTagRule(),
            { token: "comment", regex: "\\*\\/", next: next2 || "pop" },
            { defaultToken: "comment", caseInsensitive: true }
          ]
        },
        {
          token: "comment",
          regex: "\\/\\/",
          next: [
            DocCommentHighlightRules.getTagRule(),
            { token: "comment", regex: "$|^", next: next2 || "pop" },
            { defaultToken: "comment", caseInsensitive: true }
          ]
        }
      ];
    }
    exports3.JavaScriptHighlightRules = JavaScriptHighlightRules;
  });
  ace.define("ace/mode/matching_brace_outdent", ["require", "exports", "module", "ace/range"], function(require2, exports3, module3) {
    var Range2 = require2("../range").Range;
    var MatchingBraceOutdent = function() {
    };
    (function() {
      this.checkOutdent = function(line2, input2) {
        if (!/^\s+$/.test(line2))
          return false;
        return /^\s*\}/.test(input2);
      };
      this.autoOutdent = function(doc, row) {
        var line2 = doc.getLine(row);
        var match5 = line2.match(/^(\s*\})/);
        if (!match5)
          return 0;
        var column2 = match5[1].length;
        var openBracePos = doc.findMatchingBracket({ row, column: column2 });
        if (!openBracePos || openBracePos.row == row)
          return 0;
        var indent = this.$getIndent(doc.getLine(openBracePos.row));
        doc.replace(new Range2(row, 0, row, column2 - 1), indent);
      };
      this.$getIndent = function(line2) {
        return line2.match(/^\s*/)[0];
      };
    }).call(MatchingBraceOutdent.prototype);
    exports3.MatchingBraceOutdent = MatchingBraceOutdent;
  });
  ace.define("ace/mode/behaviour/xml", ["require", "exports", "module", "ace/lib/oop", "ace/mode/behaviour", "ace/token_iterator"], function(require2, exports3, module3) {
    var oop = require2("../../lib/oop");
    var Behaviour = require2("../behaviour").Behaviour;
    var TokenIterator = require2("../../token_iterator").TokenIterator;
    function is2(token2, type4) {
      return token2 && token2.type.lastIndexOf(type4 + ".xml") > -1;
    }
    var XmlBehaviour = function() {
      this.add("string_dquotes", "insertion", function(state, action, editor2, session, text2) {
        if (text2 == '"' || text2 == "'") {
          var quote = text2;
          var selected = session.doc.getTextRange(editor2.getSelectionRange());
          if (selected !== "" && selected !== "'" && selected != '"' && editor2.getWrapBehavioursEnabled()) {
            return {
              text: quote + selected + quote,
              selection: false
            };
          }
          var cursor = editor2.getCursorPosition();
          var line2 = session.doc.getLine(cursor.row);
          var rightChar = line2.substring(cursor.column, cursor.column + 1);
          var iterator2 = new TokenIterator(session, cursor.row, cursor.column);
          var token2 = iterator2.getCurrentToken();
          if (rightChar == quote && (is2(token2, "attribute-value") || is2(token2, "string"))) {
            return {
              text: "",
              selection: [1, 1]
            };
          }
          if (!token2)
            token2 = iterator2.stepBackward();
          if (!token2)
            return;
          while (is2(token2, "tag-whitespace") || is2(token2, "whitespace")) {
            token2 = iterator2.stepBackward();
          }
          var rightSpace = !rightChar || rightChar.match(/\s/);
          if (is2(token2, "attribute-equals") && (rightSpace || rightChar == ">") || is2(token2, "decl-attribute-equals") && (rightSpace || rightChar == "?")) {
            return {
              text: quote + quote,
              selection: [1, 1]
            };
          }
        }
      });
      this.add("string_dquotes", "deletion", function(state, action, editor2, session, range3) {
        var selected = session.doc.getTextRange(range3);
        if (!range3.isMultiLine() && (selected == '"' || selected == "'")) {
          var line2 = session.doc.getLine(range3.start.row);
          var rightChar = line2.substring(range3.start.column + 1, range3.start.column + 2);
          if (rightChar == selected) {
            range3.end.column++;
            return range3;
          }
        }
      });
      this.add("autoclosing", "insertion", function(state, action, editor2, session, text2) {
        if (text2 == ">") {
          var position2 = editor2.getSelectionRange().start;
          var iterator2 = new TokenIterator(session, position2.row, position2.column);
          var token2 = iterator2.getCurrentToken() || iterator2.stepBackward();
          if (!token2 || !(is2(token2, "tag-name") || is2(token2, "tag-whitespace") || is2(token2, "attribute-name") || is2(token2, "attribute-equals") || is2(token2, "attribute-value")))
            return;
          if (is2(token2, "reference.attribute-value"))
            return;
          if (is2(token2, "attribute-value")) {
            var tokenEndColumn = iterator2.getCurrentTokenColumn() + token2.value.length;
            if (position2.column < tokenEndColumn)
              return;
            if (position2.column == tokenEndColumn) {
              var nextToken = iterator2.stepForward();
              if (nextToken && is2(nextToken, "attribute-value"))
                return;
              iterator2.stepBackward();
            }
          }
          if (/^\s*>/.test(session.getLine(position2.row).slice(position2.column)))
            return;
          while (!is2(token2, "tag-name")) {
            token2 = iterator2.stepBackward();
            if (token2.value == "<") {
              token2 = iterator2.stepForward();
              break;
            }
          }
          var tokenRow = iterator2.getCurrentTokenRow();
          var tokenColumn = iterator2.getCurrentTokenColumn();
          if (is2(iterator2.stepBackward(), "end-tag-open"))
            return;
          var element2 = token2.value;
          if (tokenRow == position2.row)
            element2 = element2.substring(0, position2.column - tokenColumn);
          if (this.voidElements && this.voidElements.hasOwnProperty(element2.toLowerCase()))
            return;
          return {
            text: "></" + element2 + ">",
            selection: [1, 1]
          };
        }
      });
      this.add("autoindent", "insertion", function(state, action, editor2, session, text2) {
        if (text2 == "\n") {
          var cursor = editor2.getCursorPosition();
          var line2 = session.getLine(cursor.row);
          var iterator2 = new TokenIterator(session, cursor.row, cursor.column);
          var token2 = iterator2.getCurrentToken();
          if (is2(token2, "") && token2.type.indexOf("tag-close") !== -1) {
            if (token2.value == "/>")
              return;
            while (token2 && token2.type.indexOf("tag-name") === -1) {
              token2 = iterator2.stepBackward();
            }
            if (!token2) {
              return;
            }
            var tag = token2.value;
            var row = iterator2.getCurrentTokenRow();
            token2 = iterator2.stepBackward();
            if (!token2 || token2.type.indexOf("end-tag") !== -1) {
              return;
            }
            if (this.voidElements && !this.voidElements[tag] || !this.voidElements) {
              var nextToken = session.getTokenAt(cursor.row, cursor.column + 1);
              var line2 = session.getLine(row);
              var nextIndent = this.$getIndent(line2);
              var indent = nextIndent + session.getTabString();
              if (nextToken && nextToken.value === "</") {
                return {
                  text: "\n" + indent + "\n" + nextIndent,
                  selection: [1, indent.length, 1, indent.length]
                };
              } else {
                return {
                  text: "\n" + indent
                };
              }
            }
          }
        }
      });
    };
    oop.inherits(XmlBehaviour, Behaviour);
    exports3.XmlBehaviour = XmlBehaviour;
  });
  ace.define("ace/mode/behaviour/javascript", ["require", "exports", "module", "ace/lib/oop", "ace/token_iterator", "ace/mode/behaviour/cstyle", "ace/mode/behaviour/xml"], function(require2, exports3, module3) {
    var oop = require2("../../lib/oop");
    var TokenIterator = require2("../../token_iterator").TokenIterator;
    var CstyleBehaviour = require2("../behaviour/cstyle").CstyleBehaviour;
    var XmlBehaviour = require2("../behaviour/xml").XmlBehaviour;
    var JavaScriptBehaviour = function() {
      var xmlBehaviours = new XmlBehaviour({ closeCurlyBraces: true }).getBehaviours();
      this.addBehaviours(xmlBehaviours);
      this.inherit(CstyleBehaviour);
      this.add("autoclosing-fragment", "insertion", function(state, action, editor2, session, text2) {
        if (text2 == ">") {
          var position2 = editor2.getSelectionRange().start;
          var iterator2 = new TokenIterator(session, position2.row, position2.column);
          var token2 = iterator2.getCurrentToken() || iterator2.stepBackward();
          if (!token2)
            return;
          if (token2.value == "<") {
            return {
              text: "></>",
              selection: [1, 1]
            };
          }
        }
      });
    };
    oop.inherits(JavaScriptBehaviour, CstyleBehaviour);
    exports3.JavaScriptBehaviour = JavaScriptBehaviour;
  });
  ace.define("ace/mode/folding/xml", ["require", "exports", "module", "ace/lib/oop", "ace/range", "ace/mode/folding/fold_mode"], function(require2, exports3, module3) {
    var oop = require2("../../lib/oop");
    var Range2 = require2("../../range").Range;
    var BaseFoldMode = require2("./fold_mode").FoldMode;
    var FoldMode = exports3.FoldMode = function(voidElements2, optionalEndTags) {
      BaseFoldMode.call(this);
      this.voidElements = voidElements2 || {};
      this.optionalEndTags = oop.mixin({}, this.voidElements);
      if (optionalEndTags)
        oop.mixin(this.optionalEndTags, optionalEndTags);
    };
    oop.inherits(FoldMode, BaseFoldMode);
    var Tag2 = function() {
      this.tagName = "";
      this.closing = false;
      this.selfClosing = false;
      this.start = { row: 0, column: 0 };
      this.end = { row: 0, column: 0 };
    };
    function is2(token2, type4) {
      return token2 && token2.type && token2.type.lastIndexOf(type4 + ".xml") > -1;
    }
    (function() {
      this.getFoldWidget = function(session, foldStyle, row) {
        var tag = this._getFirstTagInLine(session, row);
        if (!tag)
          return this.getCommentFoldWidget(session, row);
        if (tag.closing || !tag.tagName && tag.selfClosing)
          return foldStyle === "markbeginend" ? "end" : "";
        if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
          return "";
        if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
          return "";
        return "start";
      };
      this.getCommentFoldWidget = function(session, row) {
        if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
          return "start";
        return "";
      };
      this._getFirstTagInLine = function(session, row) {
        var tokens2 = session.getTokens(row);
        var tag = new Tag2();
        for (var i2 = 0; i2 < tokens2.length; i2++) {
          var token2 = tokens2[i2];
          if (is2(token2, "tag-open")) {
            tag.end.column = tag.start.column + token2.value.length;
            tag.closing = is2(token2, "end-tag-open");
            token2 = tokens2[++i2];
            if (!token2)
              return null;
            tag.tagName = token2.value;
            if (token2.value === "") {
              token2 = tokens2[++i2];
              if (!token2)
                return null;
              tag.tagName = token2.value;
            }
            tag.end.column += token2.value.length;
            for (i2++; i2 < tokens2.length; i2++) {
              token2 = tokens2[i2];
              tag.end.column += token2.value.length;
              if (is2(token2, "tag-close")) {
                tag.selfClosing = token2.value == "/>";
                break;
              }
            }
            return tag;
          } else if (is2(token2, "tag-close")) {
            tag.selfClosing = token2.value == "/>";
            return tag;
          }
          tag.start.column += token2.value.length;
        }
        return null;
      };
      this._findEndTagInLine = function(session, row, tagName, startColumn) {
        var tokens2 = session.getTokens(row);
        var column2 = 0;
        for (var i2 = 0; i2 < tokens2.length; i2++) {
          var token2 = tokens2[i2];
          column2 += token2.value.length;
          if (column2 < startColumn - 1)
            continue;
          if (is2(token2, "end-tag-open")) {
            token2 = tokens2[i2 + 1];
            if (is2(token2, "tag-name") && token2.value === "") {
              token2 = tokens2[i2 + 2];
            }
            if (token2 && token2.value == tagName)
              return true;
          }
        }
        return false;
      };
      this.getFoldWidgetRange = function(session, foldStyle, row) {
        var firstTag = this._getFirstTagInLine(session, row);
        if (!firstTag) {
          return this.getCommentFoldWidget(session, row) && session.getCommentFoldRange(row, session.getLine(row).length);
        }
        var tags2 = session.getMatchingTags({ row, column: 0 });
        if (tags2) {
          return new Range2(tags2.openTag.end.row, tags2.openTag.end.column, tags2.closeTag.start.row, tags2.closeTag.start.column);
        }
      };
    }).call(FoldMode.prototype);
  });
  ace.define("ace/mode/folding/cstyle", ["require", "exports", "module", "ace/lib/oop", "ace/range", "ace/mode/folding/fold_mode"], function(require2, exports3, module3) {
    var oop = require2("../../lib/oop");
    var Range2 = require2("../../range").Range;
    var BaseFoldMode = require2("./fold_mode").FoldMode;
    var FoldMode = exports3.FoldMode = function(commentRegex) {
      if (commentRegex) {
        this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
        this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
      }
    };
    oop.inherits(FoldMode, BaseFoldMode);
    (function() {
      this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
      this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
      this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
      this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
      this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
      this._getFoldWidgetBase = this.getFoldWidget;
      this.getFoldWidget = function(session, foldStyle, row) {
        var line2 = session.getLine(row);
        if (this.singleLineBlockCommentRe.test(line2)) {
          if (!this.startRegionRe.test(line2) && !this.tripleStarBlockCommentRe.test(line2))
            return "";
        }
        var fw = this._getFoldWidgetBase(session, foldStyle, row);
        if (!fw && this.startRegionRe.test(line2))
          return "start";
        return fw;
      };
      this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
        var line2 = session.getLine(row);
        if (this.startRegionRe.test(line2))
          return this.getCommentRegionBlock(session, line2, row);
        var match5 = line2.match(this.foldingStartMarker);
        if (match5) {
          var i2 = match5.index;
          if (match5[1])
            return this.openingBracketBlock(session, match5[1], row, i2);
          var range3 = session.getCommentFoldRange(row, i2 + match5[0].length, 1);
          if (range3 && !range3.isMultiLine()) {
            if (forceMultiline) {
              range3 = this.getSectionRange(session, row);
            } else if (foldStyle != "all")
              range3 = null;
          }
          return range3;
        }
        if (foldStyle === "markbegin")
          return;
        var match5 = line2.match(this.foldingStopMarker);
        if (match5) {
          var i2 = match5.index + match5[0].length;
          if (match5[1])
            return this.closingBracketBlock(session, match5[1], row, i2);
          return session.getCommentFoldRange(row, i2, -1);
        }
      };
      this.getSectionRange = function(session, row) {
        var line2 = session.getLine(row);
        var startIndent = line2.search(/\S/);
        var startRow = row;
        var startColumn = line2.length;
        row = row + 1;
        var endRow = row;
        var maxRow = session.getLength();
        while (++row < maxRow) {
          line2 = session.getLine(row);
          var indent = line2.search(/\S/);
          if (indent === -1)
            continue;
          if (startIndent > indent)
            break;
          var subRange = this.getFoldWidgetRange(session, "all", row);
          if (subRange) {
            if (subRange.start.row <= startRow) {
              break;
            } else if (subRange.isMultiLine()) {
              row = subRange.end.row;
            } else if (startIndent == indent) {
              break;
            }
          }
          endRow = row;
        }
        return new Range2(startRow, startColumn, endRow, session.getLine(endRow).length);
      };
      this.getCommentRegionBlock = function(session, line2, row) {
        var startColumn = line2.search(/\s*$/);
        var maxRow = session.getLength();
        var startRow = row;
        var re2 = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
        var depth = 1;
        while (++row < maxRow) {
          line2 = session.getLine(row);
          var m2 = re2.exec(line2);
          if (!m2)
            continue;
          if (m2[1])
            depth--;
          else
            depth++;
          if (!depth)
            break;
        }
        var endRow = row;
        if (endRow > startRow) {
          return new Range2(startRow, startColumn, endRow, line2.length);
        }
      };
    }).call(FoldMode.prototype);
  });
  ace.define("ace/mode/folding/javascript", ["require", "exports", "module", "ace/lib/oop", "ace/mode/folding/xml", "ace/mode/folding/cstyle"], function(require2, exports3, module3) {
    var oop = require2("../../lib/oop");
    var XmlFoldMode = require2("./xml").FoldMode;
    var CFoldMode = require2("./cstyle").FoldMode;
    var FoldMode = exports3.FoldMode = function(commentRegex) {
      if (commentRegex) {
        this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
        this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
      }
      this.xmlFoldMode = new XmlFoldMode();
    };
    oop.inherits(FoldMode, CFoldMode);
    (function() {
      this.getFoldWidgetRangeBase = this.getFoldWidgetRange;
      this.getFoldWidgetBase = this.getFoldWidget;
      this.getFoldWidget = function(session, foldStyle, row) {
        var fw = this.getFoldWidgetBase(session, foldStyle, row);
        if (!fw) {
          return this.xmlFoldMode.getFoldWidget(session, foldStyle, row);
        }
        return fw;
      };
      this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
        var range3 = this.getFoldWidgetRangeBase(session, foldStyle, row, forceMultiline);
        if (range3)
          return range3;
        return this.xmlFoldMode.getFoldWidgetRange(session, foldStyle, row);
      };
    }).call(FoldMode.prototype);
  });
  ace.define("ace/mode/javascript", ["require", "exports", "module", "ace/lib/oop", "ace/mode/text", "ace/mode/javascript_highlight_rules", "ace/mode/matching_brace_outdent", "ace/worker/worker_client", "ace/mode/behaviour/javascript", "ace/mode/folding/javascript"], function(require2, exports3, module3) {
    var oop = require2("../lib/oop");
    var TextMode = require2("./text").Mode;
    var JavaScriptHighlightRules = require2("./javascript_highlight_rules").JavaScriptHighlightRules;
    var MatchingBraceOutdent = require2("./matching_brace_outdent").MatchingBraceOutdent;
    var WorkerClient = require2("../worker/worker_client").WorkerClient;
    var JavaScriptBehaviour = require2("./behaviour/javascript").JavaScriptBehaviour;
    var JavaScriptFoldMode = require2("./folding/javascript").FoldMode;
    var Mode2 = function() {
      this.HighlightRules = JavaScriptHighlightRules;
      this.$outdent = new MatchingBraceOutdent();
      this.$behaviour = new JavaScriptBehaviour();
      this.foldingRules = new JavaScriptFoldMode();
    };
    oop.inherits(Mode2, TextMode);
    (function() {
      this.lineCommentStart = "//";
      this.blockComment = { start: "/*", end: "*/" };
      this.$quotes = { '"': '"', "'": "'", "`": "`" };
      this.$pairQuotesAfter = {
        "`": /\w/
      };
      this.getNextLineIndent = function(state, line2, tab2) {
        var indent = this.$getIndent(line2);
        var tokenizedLine = this.getTokenizer().getLineTokens(line2, state);
        var tokens2 = tokenizedLine.tokens;
        var endState = tokenizedLine.state;
        if (tokens2.length && tokens2[tokens2.length - 1].type == "comment") {
          return indent;
        }
        if (state == "start" || state == "no_regex") {
          var match5 = line2.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
          if (match5) {
            indent += tab2;
          }
        } else if (state == "doc-start") {
          if (endState == "start" || endState == "no_regex") {
            return "";
          }
        }
        return indent;
      };
      this.checkOutdent = function(state, line2, input2) {
        return this.$outdent.checkOutdent(line2, input2);
      };
      this.autoOutdent = function(state, doc, row) {
        this.$outdent.autoOutdent(doc, row);
      };
      this.createWorker = function(session) {
        var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
        worker.attachToDocument(session.getDocument());
        worker.on("annotate", function(results) {
          session.setAnnotations(results.data);
        });
        worker.on("terminate", function() {
          session.clearAnnotations();
        });
        return worker;
      };
      this.$id = "ace/mode/javascript";
      this.snippetFileId = "ace/snippets/javascript";
    }).call(Mode2.prototype);
    exports3.Mode = Mode2;
  });
  (function() {
    ace.require(["ace/mode/javascript"], function(m2) {
      if (module2) {
        module2.exports = m2;
      }
    });
  })();
})(modeJavascript);
var themeMonokai = { exports: {} };
(function(module2, exports2) {
  ace.define("ace/theme/monokai-css", ["require", "exports", "module"], function(require2, exports3, module3) {
    module3.exports = ".ace-monokai .ace_gutter {\n  background: #2F3129;\n  color: #8F908A\n}\n\n.ace-monokai .ace_print-margin {\n  width: 1px;\n  background: #555651\n}\n\n.ace-monokai {\n  background-color: #272822;\n  color: #F8F8F2\n}\n\n.ace-monokai .ace_cursor {\n  color: #F8F8F0\n}\n\n.ace-monokai .ace_marker-layer .ace_selection {\n  background: #49483E\n}\n\n.ace-monokai.ace_multiselect .ace_selection.ace_start {\n  box-shadow: 0 0 3px 0px #272822;\n}\n\n.ace-monokai .ace_marker-layer .ace_step {\n  background: rgb(102, 82, 0)\n}\n\n.ace-monokai .ace_marker-layer .ace_bracket {\n  margin: -1px 0 0 -1px;\n  border: 1px solid #49483E\n}\n\n.ace-monokai .ace_marker-layer .ace_active-line {\n  background: #202020\n}\n\n.ace-monokai .ace_gutter-active-line {\n  background-color: #272727\n}\n\n.ace-monokai .ace_marker-layer .ace_selected-word {\n  border: 1px solid #49483E\n}\n\n.ace-monokai .ace_invisible {\n  color: #52524d\n}\n\n.ace-monokai .ace_entity.ace_name.ace_tag,\n.ace-monokai .ace_keyword,\n.ace-monokai .ace_meta.ace_tag,\n.ace-monokai .ace_storage {\n  color: #F92672\n}\n\n.ace-monokai .ace_punctuation,\n.ace-monokai .ace_punctuation.ace_tag {\n  color: #fff\n}\n\n.ace-monokai .ace_constant.ace_character,\n.ace-monokai .ace_constant.ace_language,\n.ace-monokai .ace_constant.ace_numeric,\n.ace-monokai .ace_constant.ace_other {\n  color: #AE81FF\n}\n\n.ace-monokai .ace_invalid {\n  color: #F8F8F0;\n  background-color: #F92672\n}\n\n.ace-monokai .ace_invalid.ace_deprecated {\n  color: #F8F8F0;\n  background-color: #AE81FF\n}\n\n.ace-monokai .ace_support.ace_constant,\n.ace-monokai .ace_support.ace_function {\n  color: #66D9EF\n}\n\n.ace-monokai .ace_fold {\n  background-color: #A6E22E;\n  border-color: #F8F8F2\n}\n\n.ace-monokai .ace_storage.ace_type,\n.ace-monokai .ace_support.ace_class,\n.ace-monokai .ace_support.ace_type {\n  font-style: italic;\n  color: #66D9EF\n}\n\n.ace-monokai .ace_entity.ace_name.ace_function,\n.ace-monokai .ace_entity.ace_other,\n.ace-monokai .ace_entity.ace_other.ace_attribute-name,\n.ace-monokai .ace_variable {\n  color: #A6E22E\n}\n\n.ace-monokai .ace_variable.ace_parameter {\n  font-style: italic;\n  color: #FD971F\n}\n\n.ace-monokai .ace_string {\n  color: #E6DB74\n}\n\n.ace-monokai .ace_comment {\n  color: #75715E\n}\n\n.ace-monokai .ace_indent-guide {\n  background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ0FD0ZXBzd/wPAAjVAoxeSgNeAAAAAElFTkSuQmCC) right repeat-y\n}\n\n.ace-monokai .ace_indent-guide-active {\n  background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQIW2PQ1dX9zzBz5sz/ABCcBFFentLlAAAAAElFTkSuQmCC) right repeat-y;\n}\n";
  });
  ace.define("ace/theme/monokai", ["require", "exports", "module", "ace/theme/monokai-css", "ace/lib/dom"], function(require2, exports3, module3) {
    exports3.isDark = true;
    exports3.cssClass = "ace-monokai";
    exports3.cssText = require2("./monokai-css");
    var dom = require2("../lib/dom");
    dom.importCssString(exports3.cssText, exports3.cssClass, false);
  });
  (function() {
    ace.require(["ace/theme/monokai"], function(m2) {
      if (module2) {
        module2.exports = m2;
      }
    });
  })();
})(themeMonokai);
var extLanguage_tools = { exports: {} };
(function(module2, exports2) {
  ace.define("ace/snippets", ["require", "exports", "module", "ace/lib/dom", "ace/lib/oop", "ace/lib/event_emitter", "ace/lib/lang", "ace/range", "ace/range_list", "ace/keyboard/hash_handler", "ace/tokenizer", "ace/clipboard", "ace/editor"], function(require2, exports3, module3) {
    var dom = require2("./lib/dom");
    var oop = require2("./lib/oop");
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var lang2 = require2("./lib/lang");
    var Range2 = require2("./range").Range;
    var RangeList = require2("./range_list").RangeList;
    var HashHandler = require2("./keyboard/hash_handler").HashHandler;
    var Tokenizer = require2("./tokenizer").Tokenizer;
    var clipboard = require2("./clipboard");
    var VARIABLES = {
      CURRENT_WORD: function(editor2) {
        return editor2.session.getTextRange(editor2.session.getWordRange());
      },
      SELECTION: function(editor2, name2, indentation) {
        var text2 = editor2.session.getTextRange();
        if (indentation)
          return text2.replace(/\n\r?([ \t]*\S)/g, "\n" + indentation + "$1");
        return text2;
      },
      CURRENT_LINE: function(editor2) {
        return editor2.session.getLine(editor2.getCursorPosition().row);
      },
      PREV_LINE: function(editor2) {
        return editor2.session.getLine(editor2.getCursorPosition().row - 1);
      },
      LINE_INDEX: function(editor2) {
        return editor2.getCursorPosition().row;
      },
      LINE_NUMBER: function(editor2) {
        return editor2.getCursorPosition().row + 1;
      },
      SOFT_TABS: function(editor2) {
        return editor2.session.getUseSoftTabs() ? "YES" : "NO";
      },
      TAB_SIZE: function(editor2) {
        return editor2.session.getTabSize();
      },
      CLIPBOARD: function(editor2) {
        return clipboard.getText && clipboard.getText();
      },
      FILENAME: function(editor2) {
        return /[^/\\]*$/.exec(this.FILEPATH(editor2))[0];
      },
      FILENAME_BASE: function(editor2) {
        return /[^/\\]*$/.exec(this.FILEPATH(editor2))[0].replace(/\.[^.]*$/, "");
      },
      DIRECTORY: function(editor2) {
        return this.FILEPATH(editor2).replace(/[^/\\]*$/, "");
      },
      FILEPATH: function(editor2) {
        return "/not implemented.txt";
      },
      WORKSPACE_NAME: function() {
        return "Unknown";
      },
      FULLNAME: function() {
        return "Unknown";
      },
      BLOCK_COMMENT_START: function(editor2) {
        var mode = editor2.session.$mode || {};
        return mode.blockComment && mode.blockComment.start || "";
      },
      BLOCK_COMMENT_END: function(editor2) {
        var mode = editor2.session.$mode || {};
        return mode.blockComment && mode.blockComment.end || "";
      },
      LINE_COMMENT: function(editor2) {
        var mode = editor2.session.$mode || {};
        return mode.lineCommentStart || "";
      },
      CURRENT_YEAR: date4.bind(null, { year: "numeric" }),
      CURRENT_YEAR_SHORT: date4.bind(null, { year: "2-digit" }),
      CURRENT_MONTH: date4.bind(null, { month: "numeric" }),
      CURRENT_MONTH_NAME: date4.bind(null, { month: "long" }),
      CURRENT_MONTH_NAME_SHORT: date4.bind(null, { month: "short" }),
      CURRENT_DATE: date4.bind(null, { day: "2-digit" }),
      CURRENT_DAY_NAME: date4.bind(null, { weekday: "long" }),
      CURRENT_DAY_NAME_SHORT: date4.bind(null, { weekday: "short" }),
      CURRENT_HOUR: date4.bind(null, { hour: "2-digit", hour12: false }),
      CURRENT_MINUTE: date4.bind(null, { minute: "2-digit" }),
      CURRENT_SECOND: date4.bind(null, { second: "2-digit" })
    };
    VARIABLES.SELECTED_TEXT = VARIABLES.SELECTION;
    function date4(dateFormat) {
      var str = (/* @__PURE__ */ new Date()).toLocaleString("en-us", dateFormat);
      return str.length == 1 ? "0" + str : str;
    }
    var SnippetManager = (
      /** @class */
      function() {
        function SnippetManager2() {
          this.snippetMap = {};
          this.snippetNameMap = {};
          this.variables = VARIABLES;
        }
        SnippetManager2.prototype.getTokenizer = function() {
          return SnippetManager2["$tokenizer"] || this.createTokenizer();
        };
        SnippetManager2.prototype.createTokenizer = function() {
          function TabstopToken(str) {
            str = str.substr(1);
            if (/^\d+$/.test(str))
              return [{ tabstopId: parseInt(str, 10) }];
            return [{ text: str }];
          }
          function escape2(ch2) {
            return "(?:[^\\\\" + ch2 + "]|\\\\.)";
          }
          var formatMatcher = {
            regex: "/(" + escape2("/") + "+)/",
            onMatch: function(val, state, stack) {
              var ts = stack[0];
              ts.fmtString = true;
              ts.guard = val.slice(1, -1);
              ts.flag = "";
              return "";
            },
            next: "formatString"
          };
          SnippetManager2["$tokenizer"] = new Tokenizer({
            start: [
              { regex: /\\./, onMatch: function(val, state, stack) {
                var ch2 = val[1];
                if (ch2 == "}" && stack.length) {
                  val = ch2;
                } else if ("`$\\".indexOf(ch2) != -1) {
                  val = ch2;
                }
                return [val];
              } },
              { regex: /}/, onMatch: function(val, state, stack) {
                return [stack.length ? stack.shift() : val];
              } },
              { regex: /\$(?:\d+|\w+)/, onMatch: TabstopToken },
              { regex: /\$\{[\dA-Z_a-z]+/, onMatch: function(str, state, stack) {
                var t2 = TabstopToken(str.substr(1));
                stack.unshift(t2[0]);
                return t2;
              }, next: "snippetVar" },
              { regex: /\n/, token: "newline", merge: false }
            ],
            snippetVar: [
              { regex: "\\|" + escape2("\\|") + "*\\|", onMatch: function(val, state, stack) {
                var choices = val.slice(1, -1).replace(/\\[,|\\]|,/g, function(operator) {
                  return operator.length == 2 ? operator[1] : "\0";
                }).split("\0").map(function(value2) {
                  return { value: value2 };
                });
                stack[0].choices = choices;
                return [choices[0]];
              }, next: "start" },
              formatMatcher,
              { regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "start" }
            ],
            formatString: [
              { regex: /:/, onMatch: function(val, state, stack) {
                if (stack.length && stack[0].expectElse) {
                  stack[0].expectElse = false;
                  stack[0].ifEnd = { elseEnd: stack[0] };
                  return [stack[0].ifEnd];
                }
                return ":";
              } },
              { regex: /\\./, onMatch: function(val, state, stack) {
                var ch2 = val[1];
                if (ch2 == "}" && stack.length)
                  val = ch2;
                else if ("`$\\".indexOf(ch2) != -1)
                  val = ch2;
                else if (ch2 == "n")
                  val = "\n";
                else if (ch2 == "t")
                  val = "	";
                else if ("ulULE".indexOf(ch2) != -1)
                  val = { changeCase: ch2, local: ch2 > "a" };
                return [val];
              } },
              { regex: "/\\w*}", onMatch: function(val, state, stack) {
                var next2 = stack.shift();
                if (next2)
                  next2.flag = val.slice(1, -1);
                this.next = next2 && next2.tabstopId ? "start" : "";
                return [next2 || val];
              }, next: "start" },
              { regex: /\$(?:\d+|\w+)/, onMatch: function(val, state, stack) {
                return [{ text: val.slice(1) }];
              } },
              { regex: /\${\w+/, onMatch: function(val, state, stack) {
                var token2 = { text: val.slice(2) };
                stack.unshift(token2);
                return [token2];
              }, next: "formatStringVar" },
              { regex: /\n/, token: "newline", merge: false },
              { regex: /}/, onMatch: function(val, state, stack) {
                var next2 = stack.shift();
                this.next = next2 && next2.tabstopId ? "start" : "";
                return [next2 || val];
              }, next: "start" }
            ],
            formatStringVar: [
              { regex: /:\/\w+}/, onMatch: function(val, state, stack) {
                var ts = stack[0];
                ts.formatFunction = val.slice(2, -1);
                return [stack.shift()];
              }, next: "formatString" },
              formatMatcher,
              { regex: /:[\?\-+]?/, onMatch: function(val, state, stack) {
                if (val[1] == "+")
                  stack[0].ifEnd = stack[0];
                if (val[1] == "?")
                  stack[0].expectElse = true;
              }, next: "formatString" },
              { regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "formatString" }
            ]
          });
          return SnippetManager2["$tokenizer"];
        };
        SnippetManager2.prototype.tokenizeTmSnippet = function(str, startState) {
          return this.getTokenizer().getLineTokens(str, startState).tokens.map(function(x2) {
            return x2.value || x2;
          });
        };
        SnippetManager2.prototype.getVariableValue = function(editor2, name2, indentation) {
          if (/^\d+$/.test(name2))
            return (this.variables.__ || {})[name2] || "";
          if (/^[A-Z]\d+$/.test(name2))
            return (this.variables[name2[0] + "__"] || {})[name2.substr(1)] || "";
          name2 = name2.replace(/^TM_/, "");
          if (!this.variables.hasOwnProperty(name2))
            return "";
          var value2 = this.variables[name2];
          if (typeof value2 == "function")
            value2 = this.variables[name2](editor2, name2, indentation);
          return value2 == null ? "" : value2;
        };
        SnippetManager2.prototype.tmStrFormat = function(str, ch2, editor2) {
          if (!ch2.fmt)
            return str;
          var flag = ch2.flag || "";
          var re2 = ch2.guard;
          re2 = new RegExp(re2, flag.replace(/[^gim]/g, ""));
          var fmtTokens = typeof ch2.fmt == "string" ? this.tokenizeTmSnippet(ch2.fmt, "formatString") : ch2.fmt;
          var _self = this;
          var formatted = str.replace(re2, function() {
            var oldArgs = _self.variables.__;
            _self.variables.__ = [].slice.call(arguments);
            var fmtParts = _self.resolveVariables(fmtTokens, editor2);
            var gChangeCase = "E";
            for (var i2 = 0; i2 < fmtParts.length; i2++) {
              var ch3 = fmtParts[i2];
              if (typeof ch3 == "object") {
                fmtParts[i2] = "";
                if (ch3.changeCase && ch3.local) {
                  var next2 = fmtParts[i2 + 1];
                  if (next2 && typeof next2 == "string") {
                    if (ch3.changeCase == "u")
                      fmtParts[i2] = next2[0].toUpperCase();
                    else
                      fmtParts[i2] = next2[0].toLowerCase();
                    fmtParts[i2 + 1] = next2.substr(1);
                  }
                } else if (ch3.changeCase) {
                  gChangeCase = ch3.changeCase;
                }
              } else if (gChangeCase == "U") {
                fmtParts[i2] = ch3.toUpperCase();
              } else if (gChangeCase == "L") {
                fmtParts[i2] = ch3.toLowerCase();
              }
            }
            _self.variables.__ = oldArgs;
            return fmtParts.join("");
          });
          return formatted;
        };
        SnippetManager2.prototype.tmFormatFunction = function(str, ch2, editor2) {
          if (ch2.formatFunction == "upcase")
            return str.toUpperCase();
          if (ch2.formatFunction == "downcase")
            return str.toLowerCase();
          return str;
        };
        SnippetManager2.prototype.resolveVariables = function(snippet2, editor2) {
          var result = [];
          var indentation = "";
          var afterNewLine = true;
          for (var i2 = 0; i2 < snippet2.length; i2++) {
            var ch2 = snippet2[i2];
            if (typeof ch2 == "string") {
              result.push(ch2);
              if (ch2 == "\n") {
                afterNewLine = true;
                indentation = "";
              } else if (afterNewLine) {
                indentation = /^\t*/.exec(ch2)[0];
                afterNewLine = /\S/.test(ch2);
              }
              continue;
            }
            if (!ch2)
              continue;
            afterNewLine = false;
            if (ch2.fmtString) {
              var j2 = snippet2.indexOf(ch2, i2 + 1);
              if (j2 == -1)
                j2 = snippet2.length;
              ch2.fmt = snippet2.slice(i2 + 1, j2);
              i2 = j2;
            }
            if (ch2.text) {
              var value2 = this.getVariableValue(editor2, ch2.text, indentation) + "";
              if (ch2.fmtString)
                value2 = this.tmStrFormat(value2, ch2, editor2);
              if (ch2.formatFunction)
                value2 = this.tmFormatFunction(value2, ch2, editor2);
              if (value2 && !ch2.ifEnd) {
                result.push(value2);
                gotoNext(ch2);
              } else if (!value2 && ch2.ifEnd) {
                gotoNext(ch2.ifEnd);
              }
            } else if (ch2.elseEnd) {
              gotoNext(ch2.elseEnd);
            } else if (ch2.tabstopId != null) {
              result.push(ch2);
            } else if (ch2.changeCase != null) {
              result.push(ch2);
            }
          }
          function gotoNext(ch3) {
            var i1 = snippet2.indexOf(ch3, i2 + 1);
            if (i1 != -1)
              i2 = i1;
          }
          return result;
        };
        SnippetManager2.prototype.getDisplayTextForSnippet = function(editor2, snippetText) {
          var processedSnippet = processSnippetText.call(this, editor2, snippetText);
          return processedSnippet.text;
        };
        SnippetManager2.prototype.insertSnippetForSelection = function(editor2, snippetText, options) {
          if (options === void 0) {
            options = {};
          }
          var processedSnippet = processSnippetText.call(this, editor2, snippetText, options);
          var range3 = editor2.getSelectionRange();
          var end2 = editor2.session.replace(range3, processedSnippet.text);
          var tabstopManager = new TabstopManager(editor2);
          var selectionId = editor2.inVirtualSelectionMode && editor2.selection.index;
          tabstopManager.addTabstops(processedSnippet.tabstops, range3.start, end2, selectionId);
        };
        SnippetManager2.prototype.insertSnippet = function(editor2, snippetText, options) {
          if (options === void 0) {
            options = {};
          }
          var self2 = this;
          if (editor2.inVirtualSelectionMode)
            return self2.insertSnippetForSelection(editor2, snippetText, options);
          editor2.forEachSelection(function() {
            self2.insertSnippetForSelection(editor2, snippetText, options);
          }, null, { keepOrder: true });
          if (editor2.tabstopManager)
            editor2.tabstopManager.tabNext();
        };
        SnippetManager2.prototype.$getScope = function(editor2) {
          var scope = editor2.session.$mode.$id || "";
          scope = scope.split("/").pop();
          if (scope === "html" || scope === "php") {
            if (scope === "php" && !editor2.session.$mode.inlinePhp)
              scope = "html";
            var c2 = editor2.getCursorPosition();
            var state = editor2.session.getState(c2.row);
            if (typeof state === "object") {
              state = state[0];
            }
            if (state.substring) {
              if (state.substring(0, 3) == "js-")
                scope = "javascript";
              else if (state.substring(0, 4) == "css-")
                scope = "css";
              else if (state.substring(0, 4) == "php-")
                scope = "php";
            }
          }
          return scope;
        };
        SnippetManager2.prototype.getActiveScopes = function(editor2) {
          var scope = this.$getScope(editor2);
          var scopes = [scope];
          var snippetMap = this.snippetMap;
          if (snippetMap[scope] && snippetMap[scope].includeScopes) {
            scopes.push.apply(scopes, snippetMap[scope].includeScopes);
          }
          scopes.push("_");
          return scopes;
        };
        SnippetManager2.prototype.expandWithTab = function(editor2, options) {
          var self2 = this;
          var result = editor2.forEachSelection(function() {
            return self2.expandSnippetForSelection(editor2, options);
          }, null, { keepOrder: true });
          if (result && editor2.tabstopManager)
            editor2.tabstopManager.tabNext();
          return result;
        };
        SnippetManager2.prototype.expandSnippetForSelection = function(editor2, options) {
          var cursor = editor2.getCursorPosition();
          var line2 = editor2.session.getLine(cursor.row);
          var before = line2.substring(0, cursor.column);
          var after = line2.substr(cursor.column);
          var snippetMap = this.snippetMap;
          var snippet2;
          this.getActiveScopes(editor2).some(function(scope) {
            var snippets = snippetMap[scope];
            if (snippets)
              snippet2 = this.findMatchingSnippet(snippets, before, after);
            return !!snippet2;
          }, this);
          if (!snippet2)
            return false;
          if (options && options.dryRun)
            return true;
          editor2.session.doc.removeInLine(cursor.row, cursor.column - snippet2.replaceBefore.length, cursor.column + snippet2.replaceAfter.length);
          this.variables.M__ = snippet2.matchBefore;
          this.variables.T__ = snippet2.matchAfter;
          this.insertSnippetForSelection(editor2, snippet2.content);
          this.variables.M__ = this.variables.T__ = null;
          return true;
        };
        SnippetManager2.prototype.findMatchingSnippet = function(snippetList, before, after) {
          for (var i2 = snippetList.length; i2--; ) {
            var s2 = snippetList[i2];
            if (s2.startRe && !s2.startRe.test(before))
              continue;
            if (s2.endRe && !s2.endRe.test(after))
              continue;
            if (!s2.startRe && !s2.endRe)
              continue;
            s2.matchBefore = s2.startRe ? s2.startRe.exec(before) : [""];
            s2.matchAfter = s2.endRe ? s2.endRe.exec(after) : [""];
            s2.replaceBefore = s2.triggerRe ? s2.triggerRe.exec(before)[0] : "";
            s2.replaceAfter = s2.endTriggerRe ? s2.endTriggerRe.exec(after)[0] : "";
            return s2;
          }
        };
        SnippetManager2.prototype.register = function(snippets, scope) {
          var snippetMap = this.snippetMap;
          var snippetNameMap = this.snippetNameMap;
          var self2 = this;
          if (!snippets)
            snippets = [];
          function wrapRegexp(src) {
            if (src && !/^\^?\(.*\)\$?$|^\\b$/.test(src))
              src = "(?:" + src + ")";
            return src || "";
          }
          function guardedRegexp(re2, guard, opening) {
            re2 = wrapRegexp(re2);
            guard = wrapRegexp(guard);
            {
              re2 = guard + re2;
              if (re2 && re2[re2.length - 1] != "$")
                re2 = re2 + "$";
            }
            return new RegExp(re2);
          }
          function addSnippet(s2) {
            if (!s2.scope)
              s2.scope = scope || "_";
            scope = s2.scope;
            if (!snippetMap[scope]) {
              snippetMap[scope] = [];
              snippetNameMap[scope] = {};
            }
            var map2 = snippetNameMap[scope];
            if (s2.name) {
              var old = map2[s2.name];
              if (old)
                self2.unregister(old);
              map2[s2.name] = s2;
            }
            snippetMap[scope].push(s2);
            if (s2.prefix)
              s2.tabTrigger = s2.prefix;
            if (!s2.content && s2.body)
              s2.content = Array.isArray(s2.body) ? s2.body.join("\n") : s2.body;
            if (s2.tabTrigger && !s2.trigger) {
              if (!s2.guard && /^\w/.test(s2.tabTrigger))
                s2.guard = "\\b";
              s2.trigger = lang2.escapeRegExp(s2.tabTrigger);
            }
            if (!s2.trigger && !s2.guard && !s2.endTrigger && !s2.endGuard)
              return;
            s2.startRe = guardedRegexp(s2.trigger, s2.guard);
            s2.triggerRe = new RegExp(s2.trigger);
            s2.endRe = guardedRegexp(s2.endTrigger, s2.endGuard);
            s2.endTriggerRe = new RegExp(s2.endTrigger);
          }
          if (Array.isArray(snippets)) {
            snippets.forEach(addSnippet);
          } else {
            Object.keys(snippets).forEach(function(key) {
              addSnippet(snippets[key]);
            });
          }
          this._signal("registerSnippets", { scope });
        };
        SnippetManager2.prototype.unregister = function(snippets, scope) {
          var snippetMap = this.snippetMap;
          var snippetNameMap = this.snippetNameMap;
          function removeSnippet(s2) {
            var nameMap = snippetNameMap[s2.scope || scope];
            if (nameMap && nameMap[s2.name]) {
              delete nameMap[s2.name];
              var map2 = snippetMap[s2.scope || scope];
              var i2 = map2 && map2.indexOf(s2);
              if (i2 >= 0)
                map2.splice(i2, 1);
            }
          }
          if (snippets.content)
            removeSnippet(snippets);
          else if (Array.isArray(snippets))
            snippets.forEach(removeSnippet);
        };
        SnippetManager2.prototype.parseSnippetFile = function(str) {
          str = str.replace(/\r/g, "");
          var list2 = [], snippet2 = {};
          var re2 = /^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;
          var m2;
          while (m2 = re2.exec(str)) {
            if (m2[1]) {
              try {
                snippet2 = JSON.parse(m2[1]);
                list2.push(snippet2);
              } catch (e2) {
              }
            }
            if (m2[4]) {
              snippet2.content = m2[4].replace(/^\t/gm, "");
              list2.push(snippet2);
              snippet2 = {};
            } else {
              var key = m2[2], val = m2[3];
              if (key == "regex") {
                var guardRe = /\/((?:[^\/\\]|\\.)*)|$/g;
                snippet2.guard = guardRe.exec(val)[1];
                snippet2.trigger = guardRe.exec(val)[1];
                snippet2.endTrigger = guardRe.exec(val)[1];
                snippet2.endGuard = guardRe.exec(val)[1];
              } else if (key == "snippet") {
                snippet2.tabTrigger = val.match(/^\S*/)[0];
                if (!snippet2.name)
                  snippet2.name = val;
              } else if (key) {
                snippet2[key] = val;
              }
            }
          }
          return list2;
        };
        SnippetManager2.prototype.getSnippetByName = function(name2, editor2) {
          var snippetMap = this.snippetNameMap;
          var snippet2;
          this.getActiveScopes(editor2).some(function(scope) {
            var snippets = snippetMap[scope];
            if (snippets)
              snippet2 = snippets[name2];
            return !!snippet2;
          }, this);
          return snippet2;
        };
        return SnippetManager2;
      }()
    );
    oop.implement(SnippetManager.prototype, EventEmitter2);
    var processSnippetText = function(editor2, snippetText, options) {
      if (options === void 0) {
        options = {};
      }
      var cursor = editor2.getCursorPosition();
      var line2 = editor2.session.getLine(cursor.row);
      var tabString = editor2.session.getTabString();
      var indentString = line2.match(/^\s*/)[0];
      if (cursor.column < indentString.length)
        indentString = indentString.slice(0, cursor.column);
      snippetText = snippetText.replace(/\r/g, "");
      var tokens2 = this.tokenizeTmSnippet(snippetText);
      tokens2 = this.resolveVariables(tokens2, editor2);
      tokens2 = tokens2.map(function(x2) {
        if (x2 == "\n" && !options.excludeExtraIndent)
          return x2 + indentString;
        if (typeof x2 == "string")
          return x2.replace(/\t/g, tabString);
        return x2;
      });
      var tabstops = [];
      tokens2.forEach(function(p3, i3) {
        if (typeof p3 != "object")
          return;
        var id3 = p3.tabstopId;
        var ts2 = tabstops[id3];
        if (!ts2) {
          ts2 = tabstops[id3] = [];
          ts2.index = id3;
          ts2.value = "";
          ts2.parents = {};
        }
        if (ts2.indexOf(p3) !== -1)
          return;
        if (p3.choices && !ts2.choices)
          ts2.choices = p3.choices;
        ts2.push(p3);
        var i12 = tokens2.indexOf(p3, i3 + 1);
        if (i12 === -1)
          return;
        var value3 = tokens2.slice(i3 + 1, i12);
        var isNested = value3.some(function(t2) {
          return typeof t2 === "object";
        });
        if (isNested && !ts2.value) {
          ts2.value = value3;
        } else if (value3.length && (!ts2.value || typeof ts2.value !== "string")) {
          ts2.value = value3.join("");
        }
      });
      tabstops.forEach(function(ts2) {
        ts2.length = 0;
      });
      var expanding = {};
      function copyValue(val) {
        var copy2 = [];
        for (var i3 = 0; i3 < val.length; i3++) {
          var p3 = val[i3];
          if (typeof p3 == "object") {
            if (expanding[p3.tabstopId])
              continue;
            var j2 = val.lastIndexOf(p3, i3 - 1);
            p3 = copy2[j2] || { tabstopId: p3.tabstopId };
          }
          copy2[i3] = p3;
        }
        return copy2;
      }
      for (var i2 = 0; i2 < tokens2.length; i2++) {
        var p2 = tokens2[i2];
        if (typeof p2 != "object")
          continue;
        var id2 = p2.tabstopId;
        var ts = tabstops[id2];
        var i1 = tokens2.indexOf(p2, i2 + 1);
        if (expanding[id2]) {
          if (expanding[id2] === p2) {
            delete expanding[id2];
            Object.keys(expanding).forEach(function(parentId) {
              ts.parents[parentId] = true;
            });
          }
          continue;
        }
        expanding[id2] = p2;
        var value2 = ts.value;
        if (typeof value2 !== "string")
          value2 = copyValue(value2);
        else if (p2.fmt)
          value2 = this.tmStrFormat(value2, p2, editor2);
        tokens2.splice.apply(tokens2, [i2 + 1, Math.max(0, i1 - i2)].concat(value2, p2));
        if (ts.indexOf(p2) === -1)
          ts.push(p2);
      }
      var row = 0, column2 = 0;
      var text2 = "";
      tokens2.forEach(function(t2) {
        if (typeof t2 === "string") {
          var lines = t2.split("\n");
          if (lines.length > 1) {
            column2 = lines[lines.length - 1].length;
            row += lines.length - 1;
          } else
            column2 += t2.length;
          text2 += t2;
        } else if (t2) {
          if (!t2.start)
            t2.start = { row, column: column2 };
          else
            t2.end = { row, column: column2 };
        }
      });
      return {
        text: text2,
        tabstops,
        tokens: tokens2
      };
    };
    var TabstopManager = (
      /** @class */
      function() {
        function TabstopManager2(editor2) {
          this.index = 0;
          this.ranges = [];
          this.tabstops = [];
          if (editor2.tabstopManager)
            return editor2.tabstopManager;
          editor2.tabstopManager = this;
          this.$onChange = this.onChange.bind(this);
          this.$onChangeSelection = lang2.delayedCall(this.onChangeSelection.bind(this)).schedule;
          this.$onChangeSession = this.onChangeSession.bind(this);
          this.$onAfterExec = this.onAfterExec.bind(this);
          this.attach(editor2);
        }
        TabstopManager2.prototype.attach = function(editor2) {
          this.$openTabstops = null;
          this.selectedTabstop = null;
          this.editor = editor2;
          this.session = editor2.session;
          this.editor.on("change", this.$onChange);
          this.editor.on("changeSelection", this.$onChangeSelection);
          this.editor.on("changeSession", this.$onChangeSession);
          this.editor.commands.on("afterExec", this.$onAfterExec);
          this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
        };
        TabstopManager2.prototype.detach = function() {
          this.tabstops.forEach(this.removeTabstopMarkers, this);
          this.ranges.length = 0;
          this.tabstops.length = 0;
          this.selectedTabstop = null;
          this.editor.off("change", this.$onChange);
          this.editor.off("changeSelection", this.$onChangeSelection);
          this.editor.off("changeSession", this.$onChangeSession);
          this.editor.commands.off("afterExec", this.$onAfterExec);
          this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
          this.editor.tabstopManager = null;
          this.session = null;
          this.editor = null;
        };
        TabstopManager2.prototype.onChange = function(delta) {
          var isRemove = delta.action[0] == "r";
          var selectedTabstop = this.selectedTabstop || {};
          var parents = selectedTabstop.parents || {};
          var tabstops = this.tabstops.slice();
          for (var i2 = 0; i2 < tabstops.length; i2++) {
            var ts = tabstops[i2];
            var active3 = ts == selectedTabstop || parents[ts.index];
            ts.rangeList.$bias = active3 ? 0 : 1;
            if (delta.action == "remove" && ts !== selectedTabstop) {
              var parentActive = ts.parents && ts.parents[selectedTabstop.index];
              var startIndex = ts.rangeList.pointIndex(delta.start, parentActive);
              startIndex = startIndex < 0 ? -startIndex - 1 : startIndex + 1;
              var endIndex = ts.rangeList.pointIndex(delta.end, parentActive);
              endIndex = endIndex < 0 ? -endIndex - 1 : endIndex - 1;
              var toRemove = ts.rangeList.ranges.slice(startIndex, endIndex);
              for (var j2 = 0; j2 < toRemove.length; j2++)
                this.removeRange(toRemove[j2]);
            }
            ts.rangeList.$onChange(delta);
          }
          var session = this.session;
          if (!this.$inChange && isRemove && session.getLength() == 1 && !session.getValue())
            this.detach();
        };
        TabstopManager2.prototype.updateLinkedFields = function() {
          var ts = this.selectedTabstop;
          if (!ts || !ts.hasLinkedRanges || !ts.firstNonLinked)
            return;
          this.$inChange = true;
          var session = this.session;
          var text2 = session.getTextRange(ts.firstNonLinked);
          for (var i2 = 0; i2 < ts.length; i2++) {
            var range3 = ts[i2];
            if (!range3.linked)
              continue;
            var original2 = range3.original;
            var fmt = exports3.snippetManager.tmStrFormat(text2, original2, this.editor);
            session.replace(range3, fmt);
          }
          this.$inChange = false;
        };
        TabstopManager2.prototype.onAfterExec = function(e2) {
          if (e2.command && !e2.command.readOnly)
            this.updateLinkedFields();
        };
        TabstopManager2.prototype.onChangeSelection = function() {
          if (!this.editor)
            return;
          var lead = this.editor.selection.lead;
          var anchor = this.editor.selection.anchor;
          var isEmpty2 = this.editor.selection.isEmpty();
          for (var i2 = 0; i2 < this.ranges.length; i2++) {
            if (this.ranges[i2].linked)
              continue;
            var containsLead = this.ranges[i2].contains(lead.row, lead.column);
            var containsAnchor = isEmpty2 || this.ranges[i2].contains(anchor.row, anchor.column);
            if (containsLead && containsAnchor)
              return;
          }
          this.detach();
        };
        TabstopManager2.prototype.onChangeSession = function() {
          this.detach();
        };
        TabstopManager2.prototype.tabNext = function(dir) {
          var max2 = this.tabstops.length;
          var index2 = this.index + (dir || 1);
          index2 = Math.min(Math.max(index2, 1), max2);
          if (index2 == max2)
            index2 = 0;
          this.selectTabstop(index2);
          this.updateTabstopMarkers();
          if (index2 === 0) {
            this.detach();
          }
        };
        TabstopManager2.prototype.selectTabstop = function(index2) {
          this.$openTabstops = null;
          var ts = this.tabstops[this.index];
          if (ts)
            this.addTabstopMarkers(ts);
          this.index = index2;
          ts = this.tabstops[this.index];
          if (!ts || !ts.length)
            return;
          this.selectedTabstop = ts;
          var range3 = ts.firstNonLinked || ts;
          if (ts.choices)
            range3.cursor = range3.start;
          if (!this.editor.inVirtualSelectionMode) {
            var sel = this.editor.multiSelect;
            sel.toSingleRange(range3);
            for (var i2 = 0; i2 < ts.length; i2++) {
              if (ts.hasLinkedRanges && ts[i2].linked)
                continue;
              sel.addRange(ts[i2].clone(), true);
            }
          } else {
            this.editor.selection.fromOrientedRange(range3);
          }
          this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
          if (this.selectedTabstop && this.selectedTabstop.choices)
            this.editor.execCommand("startAutocomplete", { matches: this.selectedTabstop.choices });
        };
        TabstopManager2.prototype.addTabstops = function(tabstops, start2, end2) {
          var useLink2 = this.useLink || !this.editor.getOption("enableMultiselect");
          if (!this.$openTabstops)
            this.$openTabstops = [];
          if (!tabstops[0]) {
            var p2 = Range2.fromPoints(end2, end2);
            moveRelative(p2.start, start2);
            moveRelative(p2.end, start2);
            tabstops[0] = [p2];
            tabstops[0].index = 0;
          }
          var i2 = this.index;
          var arg = [i2 + 1, 0];
          var ranges = this.ranges;
          var snippetId = this.snippetId = (this.snippetId || 0) + 1;
          tabstops.forEach(function(ts, index2) {
            var dest = this.$openTabstops[index2] || ts;
            dest.snippetId = snippetId;
            for (var i3 = 0; i3 < ts.length; i3++) {
              var p3 = ts[i3];
              var range3 = Range2.fromPoints(p3.start, p3.end || p3.start);
              movePoint2(range3.start, start2);
              movePoint2(range3.end, start2);
              range3.original = p3;
              range3.tabstop = dest;
              ranges.push(range3);
              if (dest != ts)
                dest.unshift(range3);
              else
                dest[i3] = range3;
              if (p3.fmtString || dest.firstNonLinked && useLink2) {
                range3.linked = true;
                dest.hasLinkedRanges = true;
              } else if (!dest.firstNonLinked)
                dest.firstNonLinked = range3;
            }
            if (!dest.firstNonLinked)
              dest.hasLinkedRanges = false;
            if (dest === ts) {
              arg.push(dest);
              this.$openTabstops[index2] = dest;
            }
            this.addTabstopMarkers(dest);
            dest.rangeList = dest.rangeList || new RangeList();
            dest.rangeList.$bias = 0;
            dest.rangeList.addList(dest);
          }, this);
          if (arg.length > 2) {
            if (this.tabstops.length)
              arg.push(arg.splice(2, 1)[0]);
            this.tabstops.splice.apply(this.tabstops, arg);
          }
        };
        TabstopManager2.prototype.addTabstopMarkers = function(ts) {
          var session = this.session;
          ts.forEach(function(range3) {
            if (!range3.markerId)
              range3.markerId = session.addMarker(range3, "ace_snippet-marker", "text");
          });
        };
        TabstopManager2.prototype.removeTabstopMarkers = function(ts) {
          var session = this.session;
          ts.forEach(function(range3) {
            session.removeMarker(range3.markerId);
            range3.markerId = null;
          });
        };
        TabstopManager2.prototype.updateTabstopMarkers = function() {
          if (!this.selectedTabstop)
            return;
          var currentSnippetId = this.selectedTabstop.snippetId;
          if (this.selectedTabstop.index === 0) {
            currentSnippetId--;
          }
          this.tabstops.forEach(function(ts) {
            if (ts.snippetId === currentSnippetId)
              this.addTabstopMarkers(ts);
            else
              this.removeTabstopMarkers(ts);
          }, this);
        };
        TabstopManager2.prototype.removeRange = function(range3) {
          var i2 = range3.tabstop.indexOf(range3);
          if (i2 != -1)
            range3.tabstop.splice(i2, 1);
          i2 = this.ranges.indexOf(range3);
          if (i2 != -1)
            this.ranges.splice(i2, 1);
          i2 = range3.tabstop.rangeList.ranges.indexOf(range3);
          if (i2 != -1)
            range3.tabstop.splice(i2, 1);
          this.session.removeMarker(range3.markerId);
          if (!range3.tabstop.length) {
            i2 = this.tabstops.indexOf(range3.tabstop);
            if (i2 != -1)
              this.tabstops.splice(i2, 1);
            if (!this.tabstops.length)
              this.detach();
          }
        };
        return TabstopManager2;
      }()
    );
    TabstopManager.prototype.keyboardHandler = new HashHandler();
    TabstopManager.prototype.keyboardHandler.bindKeys({
      "Tab": function(editor2) {
        if (exports3.snippetManager && exports3.snippetManager.expandWithTab(editor2))
          return;
        editor2.tabstopManager.tabNext(1);
        editor2.renderer.scrollCursorIntoView();
      },
      "Shift-Tab": function(editor2) {
        editor2.tabstopManager.tabNext(-1);
        editor2.renderer.scrollCursorIntoView();
      },
      "Esc": function(editor2) {
        editor2.tabstopManager.detach();
      }
    });
    var movePoint2 = function(point2, diff2) {
      if (point2.row == 0)
        point2.column += diff2.column;
      point2.row += diff2.row;
    };
    var moveRelative = function(point2, start2) {
      if (point2.row == start2.row)
        point2.column -= start2.column;
      point2.row -= start2.row;
    };
    dom.importCssString("\n.ace_snippet-marker {\n    -moz-box-sizing: border-box;\n    box-sizing: border-box;\n    background: rgba(194, 193, 208, 0.09);\n    border: 1px dotted rgba(211, 208, 235, 0.62);\n    position: absolute;\n}", "snippets.css", false);
    exports3.snippetManager = new SnippetManager();
    var Editor2 = require2("./editor").Editor;
    (function() {
      this.insertSnippet = function(content2, options) {
        return exports3.snippetManager.insertSnippet(this, content2, options);
      };
      this.expandSnippet = function(options) {
        return exports3.snippetManager.expandWithTab(this, options);
      };
    }).call(Editor2.prototype);
  });
  ace.define("ace/autocomplete/popup", ["require", "exports", "module", "ace/virtual_renderer", "ace/editor", "ace/range", "ace/lib/event", "ace/lib/lang", "ace/lib/dom", "ace/config", "ace/lib/useragent"], function(require2, exports3, module3) {
    var Renderer = require2("../virtual_renderer").VirtualRenderer;
    var Editor2 = require2("../editor").Editor;
    var Range2 = require2("../range").Range;
    var event = require2("../lib/event");
    var lang2 = require2("../lib/lang");
    var dom = require2("../lib/dom");
    var nls = require2("../config").nls;
    var userAgent = require2("./../lib/useragent");
    var getAriaId = function(index2) {
      return "suggest-aria-id:".concat(index2);
    };
    var popupAriaRole = userAgent.isSafari ? "menu" : "listbox";
    var optionAriaRole = userAgent.isSafari ? "menuitem" : "option";
    var ariaActiveState = userAgent.isSafari ? "aria-current" : "aria-selected";
    var $singleLineEditor = function(el2) {
      var renderer = new Renderer(el2);
      renderer.$maxLines = 4;
      var editor2 = new Editor2(renderer);
      editor2.setHighlightActiveLine(false);
      editor2.setShowPrintMargin(false);
      editor2.renderer.setShowGutter(false);
      editor2.renderer.setHighlightGutterLine(false);
      editor2.$mouseHandler.$focusTimeout = 0;
      editor2.$highlightTagPending = true;
      return editor2;
    };
    var AcePopup = (
      /** @class */
      /* @__PURE__ */ function() {
        function AcePopup2(parentNode) {
          var el2 = dom.createElement("div");
          var popup = $singleLineEditor(el2);
          if (parentNode) {
            parentNode.appendChild(el2);
          }
          el2.style.display = "none";
          popup.renderer.content.style.cursor = "default";
          popup.renderer.setStyle("ace_autocomplete");
          popup.renderer.$textLayer.element.setAttribute("role", popupAriaRole);
          popup.renderer.$textLayer.element.setAttribute("aria-roledescription", nls("autocomplete.popup.aria-roledescription", "Autocomplete suggestions"));
          popup.renderer.$textLayer.element.setAttribute("aria-label", nls("autocomplete.popup.aria-label", "Autocomplete suggestions"));
          popup.renderer.textarea.setAttribute("aria-hidden", "true");
          popup.setOption("displayIndentGuides", false);
          popup.setOption("dragDelay", 150);
          var noop4 = function() {
          };
          popup.focus = noop4;
          popup.$isFocused = true;
          popup.renderer.$cursorLayer.restartTimer = noop4;
          popup.renderer.$cursorLayer.element.style.opacity = "0";
          popup.renderer.$maxLines = 8;
          popup.renderer.$keepTextAreaAtCursor = false;
          popup.setHighlightActiveLine(false);
          popup.session.highlight("");
          popup.session.$searchHighlight.clazz = "ace_highlight-marker";
          popup.on("mousedown", function(e2) {
            var pos = e2.getDocumentPosition();
            popup.selection.moveToPosition(pos);
            selectionMarker.start.row = selectionMarker.end.row = pos.row;
            e2.stop();
          });
          var lastMouseEvent;
          var hoverMarker = new Range2(-1, 0, -1, Infinity);
          var selectionMarker = new Range2(-1, 0, -1, Infinity);
          selectionMarker.id = popup.session.addMarker(selectionMarker, "ace_active-line", "fullLine");
          popup.setSelectOnHover = function(val) {
            if (!val) {
              hoverMarker.id = popup.session.addMarker(hoverMarker, "ace_line-hover", "fullLine");
            } else if (hoverMarker.id) {
              popup.session.removeMarker(hoverMarker.id);
              hoverMarker.id = null;
            }
          };
          popup.setSelectOnHover(false);
          popup.on("mousemove", function(e2) {
            if (!lastMouseEvent) {
              lastMouseEvent = e2;
              return;
            }
            if (lastMouseEvent.x == e2.x && lastMouseEvent.y == e2.y) {
              return;
            }
            lastMouseEvent = e2;
            lastMouseEvent.scrollTop = popup.renderer.scrollTop;
            popup.isMouseOver = true;
            var row = lastMouseEvent.getDocumentPosition().row;
            if (hoverMarker.start.row != row) {
              if (!hoverMarker.id)
                popup.setRow(row);
              setHoverMarker(row);
            }
          });
          popup.renderer.on("beforeRender", function() {
            if (lastMouseEvent && hoverMarker.start.row != -1) {
              lastMouseEvent.$pos = null;
              var row = lastMouseEvent.getDocumentPosition().row;
              if (!hoverMarker.id)
                popup.setRow(row);
              setHoverMarker(row, true);
            }
          });
          popup.renderer.on("afterRender", function() {
            var t2 = popup.renderer.$textLayer;
            for (var row = t2.config.firstRow, l2 = t2.config.lastRow; row <= l2; row++) {
              var popupRowElement = (
                /** @type {HTMLElement|null} */
                t2.element.childNodes[row - t2.config.firstRow]
              );
              popupRowElement.setAttribute("role", optionAriaRole);
              popupRowElement.setAttribute("aria-roledescription", nls("autocomplete.popup.item.aria-roledescription", "item"));
              popupRowElement.setAttribute("aria-setsize", popup.data.length);
              popupRowElement.setAttribute("aria-describedby", "doc-tooltip");
              popupRowElement.setAttribute("aria-posinset", row + 1);
              var rowData = popup.getData(row);
              if (rowData) {
                var ariaLabel = "".concat(rowData.caption || rowData.value).concat(rowData.meta ? ", ".concat(rowData.meta) : "");
                popupRowElement.setAttribute("aria-label", ariaLabel);
              }
              var highlightedSpans = popupRowElement.querySelectorAll(".ace_completion-highlight");
              highlightedSpans.forEach(function(span) {
                span.setAttribute("role", "mark");
              });
            }
          });
          popup.renderer.on("afterRender", function() {
            var row = popup.getRow();
            var t2 = popup.renderer.$textLayer;
            var selected = (
              /** @type {HTMLElement|null} */
              t2.element.childNodes[row - t2.config.firstRow]
            );
            var el3 = document.activeElement;
            if (selected !== popup.selectedNode && popup.selectedNode) {
              dom.removeCssClass(popup.selectedNode, "ace_selected");
              popup.selectedNode.removeAttribute(ariaActiveState);
              popup.selectedNode.removeAttribute("id");
            }
            el3.removeAttribute("aria-activedescendant");
            popup.selectedNode = selected;
            if (selected) {
              var ariaId = getAriaId(row);
              dom.addCssClass(selected, "ace_selected");
              selected.id = ariaId;
              t2.element.setAttribute("aria-activedescendant", ariaId);
              el3.setAttribute("aria-activedescendant", ariaId);
              selected.setAttribute(ariaActiveState, "true");
            }
          });
          var hideHoverMarker = function() {
            setHoverMarker(-1);
          };
          var setHoverMarker = function(row, suppressRedraw) {
            if (row !== hoverMarker.start.row) {
              hoverMarker.start.row = hoverMarker.end.row = row;
              if (!suppressRedraw)
                popup.session._emit("changeBackMarker");
              popup._emit("changeHoverMarker");
            }
          };
          popup.getHoveredRow = function() {
            return hoverMarker.start.row;
          };
          event.addListener(popup.container, "mouseout", function() {
            popup.isMouseOver = false;
            hideHoverMarker();
          });
          popup.on("hide", hideHoverMarker);
          popup.on("changeSelection", hideHoverMarker);
          popup.session.doc.getLength = function() {
            return popup.data.length;
          };
          popup.session.doc.getLine = function(i2) {
            var data = popup.data[i2];
            if (typeof data == "string")
              return data;
            return data && data.value || "";
          };
          var bgTokenizer = popup.session.bgTokenizer;
          bgTokenizer.$tokenizeRow = function(row) {
            var data = popup.data[row];
            var tokens2 = [];
            if (!data)
              return tokens2;
            if (typeof data == "string")
              data = { value: data };
            var caption = data.caption || data.value || data.name;
            function addToken(value2, className) {
              value2 && tokens2.push({
                type: (data.className || "") + (className || ""),
                value: value2
              });
            }
            var lower = caption.toLowerCase();
            var filterText = (popup.filterText || "").toLowerCase();
            var lastIndex = 0;
            var lastI = 0;
            for (var i2 = 0; i2 <= filterText.length; i2++) {
              if (i2 != lastI && (data.matchMask & 1 << i2 || i2 == filterText.length)) {
                var sub = filterText.slice(lastI, i2);
                lastI = i2;
                var index2 = lower.indexOf(sub, lastIndex);
                if (index2 == -1)
                  continue;
                addToken(caption.slice(lastIndex, index2), "");
                lastIndex = index2 + sub.length;
                addToken(caption.slice(index2, lastIndex), "completion-highlight");
              }
            }
            addToken(caption.slice(lastIndex, caption.length), "");
            tokens2.push({ type: "completion-spacer", value: " " });
            if (data.meta)
              tokens2.push({ type: "completion-meta", value: data.meta });
            if (data.message)
              tokens2.push({ type: "completion-message", value: data.message });
            return tokens2;
          };
          bgTokenizer.$updateOnChange = noop4;
          bgTokenizer.start = noop4;
          popup.session.$computeWidth = function() {
            return this.screenWidth = 0;
          };
          popup.isOpen = false;
          popup.isTopdown = false;
          popup.autoSelect = true;
          popup.filterText = "";
          popup.isMouseOver = false;
          popup.data = [];
          popup.setData = function(list2, filterText) {
            popup.filterText = filterText || "";
            popup.setValue(lang2.stringRepeat("\n", list2.length), -1);
            popup.data = list2 || [];
            popup.setRow(0);
          };
          popup.getData = function(row) {
            return popup.data[row];
          };
          popup.getRow = function() {
            return selectionMarker.start.row;
          };
          popup.setRow = function(line2) {
            line2 = Math.max(this.autoSelect ? 0 : -1, Math.min(this.data.length - 1, line2));
            if (selectionMarker.start.row != line2) {
              popup.selection.clearSelection();
              selectionMarker.start.row = selectionMarker.end.row = line2 || 0;
              popup.session._emit("changeBackMarker");
              popup.moveCursorTo(line2 || 0, 0);
              if (popup.isOpen)
                popup._signal("select");
            }
          };
          popup.on("changeSelection", function() {
            if (popup.isOpen)
              popup.setRow(popup.selection.lead.row);
            popup.renderer.scrollCursorIntoView();
          });
          popup.hide = function() {
            this.container.style.display = "none";
            popup.anchorPos = null;
            popup.anchor = null;
            if (popup.isOpen) {
              popup.isOpen = false;
              this._signal("hide");
            }
          };
          popup.tryShow = function(pos, lineHeight2, anchor, forceShow) {
            if (!forceShow && popup.isOpen && popup.anchorPos && popup.anchor && popup.anchorPos.top === pos.top && popup.anchorPos.left === pos.left && popup.anchor === anchor) {
              return true;
            }
            var el3 = this.container;
            var scrollBarSize = this.renderer.scrollBar.width || 10;
            var screenHeight = window.innerHeight - scrollBarSize;
            var screenWidth = window.innerWidth - scrollBarSize;
            var renderer = this.renderer;
            var maxH = renderer.$maxLines * lineHeight2 * 1.4;
            var dims = { top: 0, bottom: 0 };
            var spaceBelow = screenHeight - pos.top - 3 * this.$borderSize - lineHeight2;
            var spaceAbove = pos.top - 3 * this.$borderSize;
            if (!anchor) {
              if (spaceAbove <= spaceBelow || spaceBelow >= maxH) {
                anchor = "bottom";
              } else {
                anchor = "top";
              }
            }
            if (anchor === "top") {
              dims.bottom = pos.top - this.$borderSize;
              dims.top = dims.bottom - maxH;
            } else if (anchor === "bottom") {
              dims.top = pos.top + lineHeight2 + this.$borderSize;
              dims.bottom = dims.top + maxH;
            }
            var fitsX = dims.top >= 0 && dims.bottom <= screenHeight;
            if (!forceShow && !fitsX) {
              return false;
            }
            if (!fitsX) {
              if (anchor === "top") {
                renderer.$maxPixelHeight = spaceAbove;
              } else {
                renderer.$maxPixelHeight = spaceBelow;
              }
            } else {
              renderer.$maxPixelHeight = null;
            }
            if (anchor === "top") {
              el3.style.top = "";
              el3.style.bottom = screenHeight + scrollBarSize - dims.bottom + "px";
              popup.isTopdown = false;
            } else {
              el3.style.top = dims.top + "px";
              el3.style.bottom = "";
              popup.isTopdown = true;
            }
            el3.style.display = "";
            var left2 = pos.left;
            if (left2 + el3.offsetWidth > screenWidth)
              left2 = screenWidth - el3.offsetWidth;
            el3.style.left = left2 + "px";
            el3.style.right = "";
            if (!popup.isOpen) {
              popup.isOpen = true;
              this._signal("show");
              lastMouseEvent = null;
            }
            popup.anchorPos = pos;
            popup.anchor = anchor;
            return true;
          };
          popup.show = function(pos, lineHeight2, topdownOnly) {
            this.tryShow(pos, lineHeight2, topdownOnly ? "bottom" : void 0, true);
          };
          popup.goTo = function(where) {
            var row = this.getRow();
            var max2 = this.session.getLength() - 1;
            switch (where) {
              case "up":
                row = row <= 0 ? max2 : row - 1;
                break;
              case "down":
                row = row >= max2 ? -1 : row + 1;
                break;
              case "start":
                row = 0;
                break;
              case "end":
                row = max2;
                break;
            }
            this.setRow(row);
          };
          popup.getTextLeftOffset = function() {
            return this.$borderSize + this.renderer.$padding + this.$imageSize;
          };
          popup.$imageSize = 0;
          popup.$borderSize = 1;
          return popup;
        }
        return AcePopup2;
      }()
    );
    dom.importCssString('\n.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n    background-color: #CAD6FA;\n    z-index: 1;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n    background-color: #3a674e;\n}\n.ace_editor.ace_autocomplete .ace_line-hover {\n    border: 1px solid #abbffe;\n    margin-top: -1px;\n    background: rgba(233,233,253,0.4);\n    position: absolute;\n    z-index: 2;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_line-hover {\n    border: 1px solid rgba(109, 150, 13, 0.8);\n    background: rgba(58, 103, 78, 0.62);\n}\n.ace_completion-meta {\n    opacity: 0.5;\n    margin-left: 0.9em;\n}\n.ace_completion-message {\n    margin-left: 0.9em;\n    color: blue;\n}\n.ace_editor.ace_autocomplete .ace_completion-highlight{\n    color: #2d69c7;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{\n    color: #93ca12;\n}\n.ace_editor.ace_autocomplete {\n    width: 300px;\n    z-index: 200000;\n    border: 1px lightgray solid;\n    position: fixed;\n    box-shadow: 2px 3px 5px rgba(0,0,0,.2);\n    line-height: 1.4;\n    background: #fefefe;\n    color: #111;\n}\n.ace_dark.ace_editor.ace_autocomplete {\n    border: 1px #484747 solid;\n    box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);\n    line-height: 1.4;\n    background: #25282c;\n    color: #c1c1c1;\n}\n.ace_autocomplete .ace_text-layer  {\n    width: calc(100% - 8px);\n}\n.ace_autocomplete .ace_line {\n    display: flex;\n    align-items: center;\n}\n.ace_autocomplete .ace_line > * {\n    min-width: 0;\n    flex: 0 0 auto;\n}\n.ace_autocomplete .ace_line .ace_ {\n    flex: 0 1 auto;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n.ace_autocomplete .ace_completion-spacer {\n    flex: 1;\n}\n.ace_autocomplete.ace_loading:after  {\n    content: "";\n    position: absolute;\n    top: 0px;\n    height: 2px;\n    width: 8%;\n    background: blue;\n    z-index: 100;\n    animation: ace_progress 3s infinite linear;\n    animation-delay: 300ms;\n    transform: translateX(-100%) scaleX(1);\n}\n@keyframes ace_progress {\n    0% { transform: translateX(-100%) scaleX(1) }\n    50% { transform: translateX(625%) scaleX(2) } \n    100% { transform: translateX(1500%) scaleX(3) } \n}\n@media (prefers-reduced-motion) {\n    .ace_autocomplete.ace_loading:after {\n        transform: translateX(625%) scaleX(2);\n        animation: none;\n     }\n}\n', "autocompletion.css", false);
    exports3.AcePopup = AcePopup;
    exports3.$singleLineEditor = $singleLineEditor;
    exports3.getAriaId = getAriaId;
  });
  ace.define("ace/autocomplete/inline_screenreader", ["require", "exports", "module"], function(require2, exports3, module3) {
    var AceInlineScreenReader = (
      /** @class */
      function() {
        function AceInlineScreenReader2(editor2) {
          this.editor = editor2;
          this.screenReaderDiv = document.createElement("div");
          this.screenReaderDiv.classList.add("ace_screenreader-only");
          this.editor.container.appendChild(this.screenReaderDiv);
        }
        AceInlineScreenReader2.prototype.setScreenReaderContent = function(content2) {
          if (!this.popup && this.editor.completer && /**@type{import("../autocomplete").Autocomplete}*/
          this.editor.completer.popup) {
            this.popup = /**@type{import("../autocomplete").Autocomplete}*/
            this.editor.completer.popup;
            this.popup.renderer.on("afterRender", (function() {
              var row = this.popup.getRow();
              var t2 = this.popup.renderer.$textLayer;
              var selected = t2.element.childNodes[row - t2.config.firstRow];
              if (selected) {
                var idString = "doc-tooltip ";
                for (var lineIndex = 0; lineIndex < this._lines.length; lineIndex++) {
                  idString += "ace-inline-screenreader-line-".concat(lineIndex, " ");
                }
                selected.setAttribute("aria-describedby", idString);
              }
            }).bind(this));
          }
          while (this.screenReaderDiv.firstChild) {
            this.screenReaderDiv.removeChild(this.screenReaderDiv.firstChild);
          }
          this._lines = content2.split(/\r\n|\r|\n/);
          var codeElement = this.createCodeBlock();
          this.screenReaderDiv.appendChild(codeElement);
        };
        AceInlineScreenReader2.prototype.destroy = function() {
          this.screenReaderDiv.remove();
        };
        AceInlineScreenReader2.prototype.createCodeBlock = function() {
          var container = document.createElement("pre");
          container.setAttribute("id", "ace-inline-screenreader");
          for (var lineIndex = 0; lineIndex < this._lines.length; lineIndex++) {
            var codeElement = document.createElement("code");
            codeElement.setAttribute("id", "ace-inline-screenreader-line-".concat(lineIndex));
            var line2 = document.createTextNode(this._lines[lineIndex]);
            codeElement.appendChild(line2);
            container.appendChild(codeElement);
          }
          return container;
        };
        return AceInlineScreenReader2;
      }()
    );
    exports3.AceInlineScreenReader = AceInlineScreenReader;
  });
  ace.define("ace/autocomplete/inline", ["require", "exports", "module", "ace/snippets", "ace/autocomplete/inline_screenreader"], function(require2, exports3, module3) {
    var snippetManager = require2("../snippets").snippetManager;
    var AceInlineScreenReader = require2("./inline_screenreader").AceInlineScreenReader;
    var AceInline = (
      /** @class */
      function() {
        function AceInline2() {
          this.editor = null;
        }
        AceInline2.prototype.show = function(editor2, completion, prefix) {
          prefix = prefix || "";
          if (editor2 && this.editor && this.editor !== editor2) {
            this.hide();
            this.editor = null;
            this.inlineScreenReader = null;
          }
          if (!editor2 || !completion) {
            return false;
          }
          if (!this.inlineScreenReader) {
            this.inlineScreenReader = new AceInlineScreenReader(editor2);
          }
          var displayText = completion.snippet ? snippetManager.getDisplayTextForSnippet(editor2, completion.snippet) : completion.value;
          if (completion.hideInlinePreview || !displayText || !displayText.startsWith(prefix)) {
            return false;
          }
          this.editor = editor2;
          this.inlineScreenReader.setScreenReaderContent(displayText);
          displayText = displayText.slice(prefix.length);
          if (displayText === "") {
            editor2.removeGhostText();
          } else {
            editor2.setGhostText(displayText);
          }
          return true;
        };
        AceInline2.prototype.isOpen = function() {
          if (!this.editor) {
            return false;
          }
          return !!this.editor.renderer.$ghostText;
        };
        AceInline2.prototype.hide = function() {
          if (!this.editor) {
            return false;
          }
          this.editor.removeGhostText();
          return true;
        };
        AceInline2.prototype.destroy = function() {
          this.hide();
          this.editor = null;
          if (this.inlineScreenReader) {
            this.inlineScreenReader.destroy();
            this.inlineScreenReader = null;
          }
        };
        return AceInline2;
      }()
    );
    exports3.AceInline = AceInline;
  });
  ace.define("ace/autocomplete/util", ["require", "exports", "module"], function(require2, exports3, module3) {
    exports3.parForEach = function(array4, fn, callback2) {
      var completed = 0;
      var arLength = array4.length;
      if (arLength === 0)
        callback2();
      for (var i2 = 0; i2 < arLength; i2++) {
        fn(array4[i2], function(result, err) {
          completed++;
          if (completed === arLength)
            callback2(result, err);
        });
      }
    };
    var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;
    exports3.retrievePrecedingIdentifier = function(text2, pos, regex2) {
      regex2 = regex2 || ID_REGEX;
      var buf = [];
      for (var i2 = pos - 1; i2 >= 0; i2--) {
        if (regex2.test(text2[i2]))
          buf.push(text2[i2]);
        else
          break;
      }
      return buf.reverse().join("");
    };
    exports3.retrieveFollowingIdentifier = function(text2, pos, regex2) {
      regex2 = regex2 || ID_REGEX;
      var buf = [];
      for (var i2 = pos; i2 < text2.length; i2++) {
        if (regex2.test(text2[i2]))
          buf.push(text2[i2]);
        else
          break;
      }
      return buf;
    };
    exports3.getCompletionPrefix = function(editor2) {
      var pos = editor2.getCursorPosition();
      var line2 = editor2.session.getLine(pos.row);
      var prefix;
      editor2.completers.forEach((function(completer) {
        if (completer.identifierRegexps) {
          completer.identifierRegexps.forEach((function(identifierRegex) {
            if (!prefix && identifierRegex)
              prefix = this.retrievePrecedingIdentifier(line2, pos.column, identifierRegex);
          }).bind(this));
        }
      }).bind(this));
      return prefix || this.retrievePrecedingIdentifier(line2, pos.column);
    };
    exports3.triggerAutocomplete = function(editor2, previousChar) {
      var previousChar = previousChar == null ? editor2.session.getPrecedingCharacter() : previousChar;
      return editor2.completers.some(function(completer) {
        if (completer.triggerCharacters && Array.isArray(completer.triggerCharacters)) {
          return completer.triggerCharacters.includes(previousChar);
        }
      });
    };
  });
  ace.define("ace/autocomplete", ["require", "exports", "module", "ace/keyboard/hash_handler", "ace/autocomplete/popup", "ace/autocomplete/inline", "ace/autocomplete/popup", "ace/autocomplete/util", "ace/lib/lang", "ace/lib/dom", "ace/snippets", "ace/config", "ace/lib/event", "ace/lib/scroll"], function(require2, exports3, module3) {
    var HashHandler = require2("./keyboard/hash_handler").HashHandler;
    var AcePopup = require2("./autocomplete/popup").AcePopup;
    var AceInline = require2("./autocomplete/inline").AceInline;
    var getAriaId = require2("./autocomplete/popup").getAriaId;
    var util2 = require2("./autocomplete/util");
    var lang2 = require2("./lib/lang");
    var dom = require2("./lib/dom");
    var snippetManager = require2("./snippets").snippetManager;
    var config2 = require2("./config");
    var event = require2("./lib/event");
    var preventParentScroll = require2("./lib/scroll").preventParentScroll;
    var destroyCompleter = function(e2, editor2) {
      editor2.completer && editor2.completer.destroy();
    };
    var Autocomplete3 = (
      /** @class */
      function() {
        function Autocomplete4() {
          this.autoInsert = false;
          this.autoSelect = true;
          this.autoShown = false;
          this.exactMatch = false;
          this.inlineEnabled = false;
          this.keyboardHandler = new HashHandler();
          this.keyboardHandler.bindKeys(this.commands);
          this.parentNode = null;
          this.setSelectOnHover = false;
          this.hasSeen = /* @__PURE__ */ new Set();
          this.showLoadingState = false;
          this.stickySelectionDelay = 500;
          this.blurListener = this.blurListener.bind(this);
          this.changeListener = this.changeListener.bind(this);
          this.mousedownListener = this.mousedownListener.bind(this);
          this.mousewheelListener = this.mousewheelListener.bind(this);
          this.onLayoutChange = this.onLayoutChange.bind(this);
          this.changeTimer = lang2.delayedCall((function() {
            this.updateCompletions(true);
          }).bind(this));
          this.tooltipTimer = lang2.delayedCall(this.updateDocTooltip.bind(this), 50);
          this.popupTimer = lang2.delayedCall(this.$updatePopupPosition.bind(this), 50);
          this.stickySelectionTimer = lang2.delayedCall((function() {
            this.stickySelection = true;
          }).bind(this), this.stickySelectionDelay);
          this.$firstOpenTimer = lang2.delayedCall(
            /**@this{Autocomplete}*/
            (function() {
              var initialPosition = this.completionProvider && this.completionProvider.initialPosition;
              if (this.autoShown || this.popup && this.popup.isOpen || !initialPosition || this.editor.completers.length === 0)
                return;
              this.completions = new FilteredList(Autocomplete4.completionsForLoading);
              this.openPopup(this.editor, initialPosition.prefix, false);
              this.popup.renderer.setStyle("ace_loading", true);
            }).bind(this),
            this.stickySelectionDelay
          );
        }
        Object.defineProperty(Autocomplete4, "completionsForLoading", {
          get: function() {
            return [{
              caption: config2.nls("autocomplete.loading", "Loading..."),
              value: ""
            }];
          },
          enumerable: false,
          configurable: true
        });
        Autocomplete4.prototype.$init = function() {
          this.popup = new AcePopup(this.parentNode || document.body || document.documentElement);
          this.popup.on("click", (function(e2) {
            this.insertMatch();
            e2.stop();
          }).bind(this));
          this.popup.focus = this.editor.focus.bind(this.editor);
          this.popup.on("show", this.$onPopupShow.bind(this));
          this.popup.on("hide", this.$onHidePopup.bind(this));
          this.popup.on("select", this.$onPopupChange.bind(this));
          event.addListener(this.popup.container, "mouseout", this.mouseOutListener.bind(this));
          this.popup.on("changeHoverMarker", this.tooltipTimer.bind(null, null));
          this.popup.renderer.on("afterRender", this.$onPopupRender.bind(this));
          return this.popup;
        };
        Autocomplete4.prototype.$initInline = function() {
          if (!this.inlineEnabled || this.inlineRenderer)
            return;
          this.inlineRenderer = new AceInline();
          return this.inlineRenderer;
        };
        Autocomplete4.prototype.getPopup = function() {
          return this.popup || this.$init();
        };
        Autocomplete4.prototype.$onHidePopup = function() {
          if (this.inlineRenderer) {
            this.inlineRenderer.hide();
          }
          this.hideDocTooltip();
          this.stickySelectionTimer.cancel();
          this.popupTimer.cancel();
          this.stickySelection = false;
        };
        Autocomplete4.prototype.$seen = function(completion) {
          if (!this.hasSeen.has(completion) && completion && completion.completer && completion.completer.onSeen && typeof completion.completer.onSeen === "function") {
            completion.completer.onSeen(this.editor, completion);
            this.hasSeen.add(completion);
          }
        };
        Autocomplete4.prototype.$onPopupChange = function(hide) {
          if (this.inlineRenderer && this.inlineEnabled) {
            var completion = hide ? null : this.popup.getData(this.popup.getRow());
            this.$updateGhostText(completion);
            if (this.popup.isMouseOver && this.setSelectOnHover) {
              this.tooltipTimer.call(null, null);
              return;
            }
            this.popupTimer.schedule();
            this.tooltipTimer.schedule();
          } else {
            this.popupTimer.call(null, null);
            this.tooltipTimer.call(null, null);
          }
        };
        Autocomplete4.prototype.$updateGhostText = function(completion) {
          var row = this.base.row;
          var column2 = this.base.column;
          var cursorColumn = this.editor.getCursorPosition().column;
          var prefix = this.editor.session.getLine(row).slice(column2, cursorColumn);
          if (!this.inlineRenderer.show(this.editor, completion, prefix)) {
            this.inlineRenderer.hide();
          } else {
            this.$seen(completion);
          }
        };
        Autocomplete4.prototype.$onPopupRender = function() {
          var inlineEnabled = this.inlineRenderer && this.inlineEnabled;
          if (this.completions && this.completions.filtered && this.completions.filtered.length > 0) {
            for (var i2 = this.popup.getFirstVisibleRow(); i2 <= this.popup.getLastVisibleRow(); i2++) {
              var completion = this.popup.getData(i2);
              if (completion && (!inlineEnabled || completion.hideInlinePreview)) {
                this.$seen(completion);
              }
            }
          }
        };
        Autocomplete4.prototype.$onPopupShow = function(hide) {
          this.$onPopupChange(hide);
          this.stickySelection = false;
          if (this.stickySelectionDelay >= 0)
            this.stickySelectionTimer.schedule(this.stickySelectionDelay);
        };
        Autocomplete4.prototype.observeLayoutChanges = function() {
          if (this.$elements || !this.editor)
            return;
          window.addEventListener("resize", this.onLayoutChange, { passive: true });
          window.addEventListener("wheel", this.mousewheelListener);
          var el2 = this.editor.container.parentNode;
          var elements = [];
          while (el2) {
            elements.push(el2);
            el2.addEventListener("scroll", this.onLayoutChange, { passive: true });
            el2 = el2.parentNode;
          }
          this.$elements = elements;
        };
        Autocomplete4.prototype.unObserveLayoutChanges = function() {
          var _this = this;
          window.removeEventListener("resize", this.onLayoutChange, { passive: true });
          window.removeEventListener("wheel", this.mousewheelListener);
          this.$elements && this.$elements.forEach(function(el2) {
            el2.removeEventListener("scroll", _this.onLayoutChange, { passive: true });
          });
          this.$elements = null;
        };
        Autocomplete4.prototype.onLayoutChange = function() {
          if (!this.popup.isOpen)
            return this.unObserveLayoutChanges();
          this.$updatePopupPosition();
          this.updateDocTooltip();
        };
        Autocomplete4.prototype.$updatePopupPosition = function() {
          var editor2 = this.editor;
          var renderer = editor2.renderer;
          var lineHeight2 = renderer.layerConfig.lineHeight;
          var pos = renderer.$cursorLayer.getPixelPosition(this.base, true);
          pos.left -= this.popup.getTextLeftOffset();
          var rect = editor2.container.getBoundingClientRect();
          pos.top += rect.top - renderer.layerConfig.offset;
          pos.left += rect.left - editor2.renderer.scrollLeft;
          pos.left += renderer.gutterWidth;
          var posGhostText = {
            top: pos.top,
            left: pos.left
          };
          if (renderer.$ghostText && renderer.$ghostTextWidget) {
            if (this.base.row === renderer.$ghostText.position.row) {
              posGhostText.top += renderer.$ghostTextWidget.el.offsetHeight;
            }
          }
          var editorContainerBottom = editor2.container.getBoundingClientRect().bottom - lineHeight2;
          var lowestPosition = editorContainerBottom < posGhostText.top ? { top: editorContainerBottom, left: posGhostText.left } : posGhostText;
          if (this.popup.tryShow(lowestPosition, lineHeight2, "bottom")) {
            return;
          }
          if (this.popup.tryShow(pos, lineHeight2, "top")) {
            return;
          }
          this.popup.show(pos, lineHeight2);
        };
        Autocomplete4.prototype.openPopup = function(editor2, prefix, keepPopupPosition) {
          this.$firstOpenTimer.cancel();
          if (!this.popup)
            this.$init();
          if (this.inlineEnabled && !this.inlineRenderer)
            this.$initInline();
          this.popup.autoSelect = this.autoSelect;
          this.popup.setSelectOnHover(this.setSelectOnHover);
          var oldRow = this.popup.getRow();
          var previousSelectedItem = this.popup.data[oldRow];
          this.popup.setData(this.completions.filtered, this.completions.filterText);
          if (this.editor.textInput.setAriaOptions) {
            this.editor.textInput.setAriaOptions({
              activeDescendant: getAriaId(this.popup.getRow()),
              inline: this.inlineEnabled
            });
          }
          editor2.keyBinding.addKeyboardHandler(this.keyboardHandler);
          var newRow;
          if (this.stickySelection)
            newRow = this.popup.data.indexOf(previousSelectedItem);
          if (!newRow || newRow === -1)
            newRow = 0;
          this.popup.setRow(this.autoSelect ? newRow : -1);
          if (newRow === oldRow && previousSelectedItem !== this.completions.filtered[newRow])
            this.$onPopupChange();
          var inlineEnabled = this.inlineRenderer && this.inlineEnabled;
          if (newRow === oldRow && inlineEnabled) {
            var completion = this.popup.getData(this.popup.getRow());
            this.$updateGhostText(completion);
          }
          if (!keepPopupPosition) {
            this.popup.setTheme(editor2.getTheme());
            this.popup.setFontSize(editor2.getFontSize());
            this.$updatePopupPosition();
            if (this.tooltipNode) {
              this.updateDocTooltip();
            }
          }
          this.changeTimer.cancel();
          this.observeLayoutChanges();
        };
        Autocomplete4.prototype.detach = function() {
          if (this.editor) {
            this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
            this.editor.off("changeSelection", this.changeListener);
            this.editor.off("blur", this.blurListener);
            this.editor.off("mousedown", this.mousedownListener);
            this.editor.off("mousewheel", this.mousewheelListener);
          }
          this.$firstOpenTimer.cancel();
          this.changeTimer.cancel();
          this.hideDocTooltip();
          if (this.completionProvider) {
            this.completionProvider.detach();
          }
          if (this.popup && this.popup.isOpen)
            this.popup.hide();
          if (this.popup && this.popup.renderer) {
            this.popup.renderer.off("afterRender", this.$onPopupRender);
          }
          if (this.base)
            this.base.detach();
          this.activated = false;
          this.completionProvider = this.completions = this.base = null;
          this.unObserveLayoutChanges();
        };
        Autocomplete4.prototype.changeListener = function(e2) {
          var cursor = this.editor.selection.lead;
          if (cursor.row != this.base.row || cursor.column < this.base.column) {
            this.detach();
          }
          if (this.activated)
            this.changeTimer.schedule();
          else
            this.detach();
        };
        Autocomplete4.prototype.blurListener = function(e2) {
          var el2 = document.activeElement;
          var text2 = this.editor.textInput.getElement();
          var fromTooltip = e2.relatedTarget && this.tooltipNode && this.tooltipNode.contains(e2.relatedTarget);
          var container = this.popup && this.popup.container;
          if (el2 != text2 && el2.parentNode != container && !fromTooltip && el2 != this.tooltipNode && e2.relatedTarget != text2) {
            this.detach();
          }
        };
        Autocomplete4.prototype.mousedownListener = function(e2) {
          this.detach();
        };
        Autocomplete4.prototype.mousewheelListener = function(e2) {
          if (this.popup && !this.popup.isMouseOver)
            this.detach();
        };
        Autocomplete4.prototype.mouseOutListener = function(e2) {
          if (this.popup.isOpen)
            this.$updatePopupPosition();
        };
        Autocomplete4.prototype.goTo = function(where) {
          this.popup.goTo(where);
        };
        Autocomplete4.prototype.insertMatch = function(data, options) {
          if (!data)
            data = this.popup.getData(this.popup.getRow());
          if (!data)
            return false;
          if (data.value === "")
            return this.detach();
          var completions = this.completions;
          var result = this.getCompletionProvider().insertMatch(this.editor, data, completions.filterText, options);
          if (this.completions == completions)
            this.detach();
          return result;
        };
        Autocomplete4.prototype.showPopup = function(editor2, options) {
          if (this.editor)
            this.detach();
          this.activated = true;
          this.editor = editor2;
          if (editor2.completer != this) {
            if (editor2.completer)
              editor2.completer.detach();
            editor2.completer = this;
          }
          editor2.on("changeSelection", this.changeListener);
          editor2.on("blur", this.blurListener);
          editor2.on("mousedown", this.mousedownListener);
          editor2.on("mousewheel", this.mousewheelListener);
          this.updateCompletions(false, options);
        };
        Autocomplete4.prototype.getCompletionProvider = function(initialPosition) {
          if (!this.completionProvider)
            this.completionProvider = new CompletionProvider(initialPosition);
          return this.completionProvider;
        };
        Autocomplete4.prototype.gatherCompletions = function(editor2, callback2) {
          return this.getCompletionProvider().gatherCompletions(editor2, callback2);
        };
        Autocomplete4.prototype.updateCompletions = function(keepPopupPosition, options) {
          if (keepPopupPosition && this.base && this.completions) {
            var pos = this.editor.getCursorPosition();
            var prefix = this.editor.session.getTextRange({ start: this.base, end: pos });
            if (prefix == this.completions.filterText)
              return;
            this.completions.setFilter(prefix);
            if (!this.completions.filtered.length)
              return this.detach();
            if (this.completions.filtered.length == 1 && this.completions.filtered[0].value == prefix && !this.completions.filtered[0].snippet)
              return this.detach();
            this.openPopup(this.editor, prefix, keepPopupPosition);
            return;
          }
          if (options && options.matches) {
            var pos = this.editor.getSelectionRange().start;
            this.base = this.editor.session.doc.createAnchor(pos.row, pos.column);
            this.base.$insertRight = true;
            this.completions = new FilteredList(options.matches);
            this.getCompletionProvider().completions = this.completions;
            return this.openPopup(this.editor, "", keepPopupPosition);
          }
          var session = this.editor.getSession();
          var pos = this.editor.getCursorPosition();
          var prefix = util2.getCompletionPrefix(this.editor);
          this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);
          this.base.$insertRight = true;
          var completionOptions = {
            exactMatch: this.exactMatch,
            ignoreCaption: this.ignoreCaption
          };
          this.getCompletionProvider({
            prefix,
            pos
          }).provideCompletions(
            this.editor,
            completionOptions,
            (function(err, completions, finished) {
              var filtered = completions.filtered;
              var prefix2 = util2.getCompletionPrefix(this.editor);
              this.$firstOpenTimer.cancel();
              if (finished) {
                if (!filtered.length) {
                  var emptyMessage = !this.autoShown && this.emptyMessage;
                  if (typeof emptyMessage == "function")
                    emptyMessage = this.emptyMessage(prefix2);
                  if (emptyMessage) {
                    var completionsForEmpty = [
                      {
                        caption: emptyMessage,
                        value: ""
                      }
                    ];
                    this.completions = new FilteredList(completionsForEmpty);
                    this.openPopup(this.editor, prefix2, keepPopupPosition);
                    this.popup.renderer.setStyle("ace_loading", false);
                    this.popup.renderer.setStyle("ace_empty-message", true);
                    return;
                  }
                  return this.detach();
                }
                if (filtered.length == 1 && filtered[0].value == prefix2 && !filtered[0].snippet)
                  return this.detach();
                if (this.autoInsert && !this.autoShown && filtered.length == 1)
                  return this.insertMatch(filtered[0]);
              }
              this.completions = !finished && this.showLoadingState ? new FilteredList(Autocomplete4.completionsForLoading.concat(filtered), completions.filterText) : completions;
              this.openPopup(this.editor, prefix2, keepPopupPosition);
              this.popup.renderer.setStyle("ace_empty-message", false);
              this.popup.renderer.setStyle("ace_loading", !finished);
            }).bind(this)
          );
          if (this.showLoadingState && !this.autoShown && !(this.popup && this.popup.isOpen)) {
            this.$firstOpenTimer.delay(this.stickySelectionDelay / 2);
          }
        };
        Autocomplete4.prototype.cancelContextMenu = function() {
          this.editor.$mouseHandler.cancelContextMenu();
        };
        Autocomplete4.prototype.updateDocTooltip = function() {
          var popup = this.popup;
          var all3 = this.completions && this.completions.filtered;
          var selected = all3 && (all3[popup.getHoveredRow()] || all3[popup.getRow()]);
          var doc = null;
          if (!selected || !this.editor || !this.popup.isOpen)
            return this.hideDocTooltip();
          var completersLength = this.editor.completers.length;
          for (var i2 = 0; i2 < completersLength; i2++) {
            var completer = this.editor.completers[i2];
            if (completer.getDocTooltip && selected.completerId === completer.id) {
              doc = completer.getDocTooltip(selected);
              break;
            }
          }
          if (!doc && typeof selected != "string")
            doc = selected;
          if (typeof doc == "string")
            doc = { docText: doc };
          if (!doc || !(doc.docHTML || doc.docText))
            return this.hideDocTooltip();
          this.showDocTooltip(doc);
        };
        Autocomplete4.prototype.showDocTooltip = function(item) {
          if (!this.tooltipNode) {
            this.tooltipNode = dom.createElement("div");
            this.tooltipNode.style.margin = "0";
            this.tooltipNode.style.pointerEvents = "auto";
            this.tooltipNode.style.overscrollBehavior = "contain";
            this.tooltipNode.tabIndex = -1;
            this.tooltipNode.onblur = this.blurListener.bind(this);
            this.tooltipNode.onclick = this.onTooltipClick.bind(this);
            this.tooltipNode.id = "doc-tooltip";
            this.tooltipNode.setAttribute("role", "tooltip");
            this.tooltipNode.addEventListener("wheel", preventParentScroll);
          }
          var theme2 = this.editor.renderer.theme;
          this.tooltipNode.className = "ace_tooltip ace_doc-tooltip " + (theme2.isDark ? "ace_dark " : "") + (theme2.cssClass || "");
          var tooltipNode = this.tooltipNode;
          if (item.docHTML) {
            tooltipNode.innerHTML = item.docHTML;
          } else if (item.docText) {
            tooltipNode.textContent = item.docText;
          }
          if (!tooltipNode.parentNode)
            this.popup.container.appendChild(this.tooltipNode);
          var popup = this.popup;
          var rect = popup.container.getBoundingClientRect();
          var targetWidth = 400;
          var targetHeight = 300;
          var scrollBarSize = popup.renderer.scrollBar.width || 10;
          var leftSize = rect.left;
          var rightSize = window.innerWidth - rect.right - scrollBarSize;
          var topSize = popup.isTopdown ? rect.top : window.innerHeight - scrollBarSize - rect.bottom;
          var scores = [
            Math.min(rightSize / targetWidth, 1),
            Math.min(leftSize / targetWidth, 1),
            Math.min(topSize / targetHeight * 0.9)
          ];
          var max2 = Math.max.apply(Math, scores);
          var tooltipStyle = tooltipNode.style;
          tooltipStyle.display = "block";
          if (max2 == scores[0]) {
            tooltipStyle.left = rect.right + 1 + "px";
            tooltipStyle.right = "";
            tooltipStyle.maxWidth = targetWidth * max2 + "px";
            tooltipStyle.top = rect.top + "px";
            tooltipStyle.bottom = "";
            tooltipStyle.maxHeight = Math.min(window.innerHeight - scrollBarSize - rect.top, targetHeight) + "px";
          } else if (max2 == scores[1]) {
            tooltipStyle.right = window.innerWidth - rect.left + "px";
            tooltipStyle.left = "";
            tooltipStyle.maxWidth = targetWidth * max2 + "px";
            tooltipStyle.top = rect.top + "px";
            tooltipStyle.bottom = "";
            tooltipStyle.maxHeight = Math.min(window.innerHeight - scrollBarSize - rect.top, targetHeight) + "px";
          } else if (max2 == scores[2]) {
            tooltipStyle.left = window.innerWidth - rect.left + "px";
            tooltipStyle.maxWidth = Math.min(targetWidth, window.innerWidth) + "px";
            if (popup.isTopdown) {
              tooltipStyle.top = rect.bottom + "px";
              tooltipStyle.left = rect.left + "px";
              tooltipStyle.right = "";
              tooltipStyle.bottom = "";
              tooltipStyle.maxHeight = Math.min(window.innerHeight - scrollBarSize - rect.bottom, targetHeight) + "px";
            } else {
              tooltipStyle.top = popup.container.offsetTop - tooltipNode.offsetHeight + "px";
              tooltipStyle.left = rect.left + "px";
              tooltipStyle.right = "";
              tooltipStyle.bottom = "";
              tooltipStyle.maxHeight = Math.min(popup.container.offsetTop, targetHeight) + "px";
            }
          }
        };
        Autocomplete4.prototype.hideDocTooltip = function() {
          this.tooltipTimer.cancel();
          if (!this.tooltipNode)
            return;
          var el2 = this.tooltipNode;
          if (!this.editor.isFocused() && document.activeElement == el2)
            this.editor.focus();
          this.tooltipNode = null;
          if (el2.parentNode)
            el2.parentNode.removeChild(el2);
        };
        Autocomplete4.prototype.onTooltipClick = function(e2) {
          var a2 = e2.target;
          while (a2 && a2 != this.tooltipNode) {
            if (a2.nodeName == "A" && a2.href) {
              a2.rel = "noreferrer";
              a2.target = "_blank";
              break;
            }
            a2 = a2.parentNode;
          }
        };
        Autocomplete4.prototype.destroy = function() {
          this.detach();
          if (this.popup) {
            this.popup.destroy();
            var el2 = this.popup.container;
            if (el2 && el2.parentNode)
              el2.parentNode.removeChild(el2);
          }
          if (this.editor && this.editor.completer == this) {
            this.editor.off("destroy", destroyCompleter);
            this.editor.completer = null;
          }
          this.inlineRenderer = this.popup = this.editor = null;
        };
        Autocomplete4.for = function(editor2) {
          if (editor2.completer instanceof Autocomplete4) {
            return editor2.completer;
          }
          if (editor2.completer) {
            editor2.completer.destroy();
            editor2.completer = null;
          }
          if (config2.get("sharedPopups")) {
            if (!Autocomplete4["$sharedInstance"])
              Autocomplete4["$sharedInstance"] = new Autocomplete4();
            editor2.completer = Autocomplete4["$sharedInstance"];
          } else {
            editor2.completer = new Autocomplete4();
            editor2.once("destroy", destroyCompleter);
          }
          return editor2.completer;
        };
        return Autocomplete4;
      }()
    );
    Autocomplete3.prototype.commands = {
      "Up": function(editor2) {
        editor2.completer.goTo("up");
      },
      "Down": function(editor2) {
        editor2.completer.goTo("down");
      },
      "Ctrl-Up|Ctrl-Home": function(editor2) {
        editor2.completer.goTo("start");
      },
      "Ctrl-Down|Ctrl-End": function(editor2) {
        editor2.completer.goTo("end");
      },
      "Esc": function(editor2) {
        editor2.completer.detach();
      },
      "Return": function(editor2) {
        return editor2.completer.insertMatch();
      },
      "Shift-Return": function(editor2) {
        editor2.completer.insertMatch(null, { deleteSuffix: true });
      },
      "Tab": function(editor2) {
        var result = editor2.completer.insertMatch();
        if (!result && !editor2.tabstopManager)
          editor2.completer.goTo("down");
        else
          return result;
      },
      "Backspace": function(editor2) {
        editor2.execCommand("backspace");
        var prefix = util2.getCompletionPrefix(editor2);
        if (!prefix && editor2.completer)
          editor2.completer.detach();
      },
      "PageUp": function(editor2) {
        editor2.completer.popup.gotoPageUp();
      },
      "PageDown": function(editor2) {
        editor2.completer.popup.gotoPageDown();
      }
    };
    Autocomplete3.startCommand = {
      name: "startAutocomplete",
      exec: function(editor2, options) {
        var completer = Autocomplete3.for(editor2);
        completer.autoInsert = false;
        completer.autoSelect = true;
        completer.autoShown = false;
        completer.showPopup(editor2, options);
        completer.cancelContextMenu();
      },
      bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
    };
    var CompletionProvider = (
      /** @class */
      function() {
        function CompletionProvider2(initialPosition) {
          this.initialPosition = initialPosition;
          this.active = true;
        }
        CompletionProvider2.prototype.insertByIndex = function(editor2, index2, options) {
          if (!this.completions || !this.completions.filtered) {
            return false;
          }
          return this.insertMatch(editor2, this.completions.filtered[index2], options);
        };
        CompletionProvider2.prototype.insertMatch = function(editor2, data, options) {
          if (!data)
            return false;
          editor2.startOperation({ command: { name: "insertMatch" } });
          if (data.completer && data.completer.insertMatch) {
            data.completer.insertMatch(editor2, data);
          } else {
            if (!this.completions)
              return false;
            var replaceBefore = this.completions.filterText.length;
            var replaceAfter = 0;
            if (data.range && data.range.start.row === data.range.end.row) {
              replaceBefore -= this.initialPosition.prefix.length;
              replaceBefore += this.initialPosition.pos.column - data.range.start.column;
              replaceAfter += data.range.end.column - this.initialPosition.pos.column;
            }
            if (replaceBefore || replaceAfter) {
              var ranges;
              if (editor2.selection.getAllRanges) {
                ranges = editor2.selection.getAllRanges();
              } else {
                ranges = [editor2.getSelectionRange()];
              }
              for (var i2 = 0, range3; range3 = ranges[i2]; i2++) {
                range3.start.column -= replaceBefore;
                range3.end.column += replaceAfter;
                editor2.session.remove(range3);
              }
            }
            if (data.snippet) {
              snippetManager.insertSnippet(editor2, data.snippet);
            } else {
              this.$insertString(editor2, data);
            }
            if (data.completer && data.completer.onInsert && typeof data.completer.onInsert == "function") {
              data.completer.onInsert(editor2, data);
            }
            if (data.command && data.command === "startAutocomplete") {
              editor2.execCommand(data.command);
            }
          }
          editor2.endOperation();
          return true;
        };
        CompletionProvider2.prototype.$insertString = function(editor2, data) {
          var text2 = data.value || data;
          editor2.execCommand("insertstring", text2);
        };
        CompletionProvider2.prototype.gatherCompletions = function(editor2, callback2) {
          var session = editor2.getSession();
          var pos = editor2.getCursorPosition();
          var prefix = util2.getCompletionPrefix(editor2);
          var matches = [];
          this.completers = editor2.completers;
          var total = editor2.completers.length;
          editor2.completers.forEach(function(completer, i2) {
            completer.getCompletions(editor2, session, pos, prefix, function(err, results) {
              if (completer.hideInlinePreview)
                results = results.map(function(result) {
                  return Object.assign(result, { hideInlinePreview: completer.hideInlinePreview });
                });
              if (!err && results)
                matches = matches.concat(results);
              callback2(null, {
                prefix: util2.getCompletionPrefix(editor2),
                matches,
                finished: --total === 0
              });
            });
          });
          return true;
        };
        CompletionProvider2.prototype.provideCompletions = function(editor2, options, callback2) {
          var processResults = (function(results2) {
            var prefix = results2.prefix;
            var matches = results2.matches;
            this.completions = new FilteredList(matches);
            if (options.exactMatch)
              this.completions.exactMatch = true;
            if (options.ignoreCaption)
              this.completions.ignoreCaption = true;
            this.completions.setFilter(prefix);
            if (results2.finished || this.completions.filtered.length)
              callback2(null, this.completions, results2.finished);
          }).bind(this);
          var isImmediate = true;
          var immediateResults = null;
          this.gatherCompletions(editor2, (function(err, results2) {
            if (!this.active) {
              return;
            }
            if (err) {
              callback2(err, [], true);
              this.detach();
            }
            var prefix = results2.prefix;
            if (prefix.indexOf(results2.prefix) !== 0)
              return;
            if (isImmediate) {
              immediateResults = results2;
              return;
            }
            processResults(results2);
          }).bind(this));
          isImmediate = false;
          if (immediateResults) {
            var results = immediateResults;
            immediateResults = null;
            processResults(results);
          }
        };
        CompletionProvider2.prototype.detach = function() {
          this.active = false;
          this.completers && this.completers.forEach(function(completer) {
            if (typeof completer.cancel === "function") {
              completer.cancel();
            }
          });
        };
        return CompletionProvider2;
      }()
    );
    var FilteredList = (
      /** @class */
      function() {
        function FilteredList2(array4, filterText) {
          this.all = array4;
          this.filtered = array4;
          this.filterText = filterText || "";
          this.exactMatch = false;
          this.ignoreCaption = false;
        }
        FilteredList2.prototype.setFilter = function(str) {
          if (str.length > this.filterText && str.lastIndexOf(this.filterText, 0) === 0)
            var matches = this.filtered;
          else
            var matches = this.all;
          this.filterText = str;
          matches = this.filterCompletions(matches, this.filterText);
          matches = matches.sort(function(a2, b2) {
            return b2.exactMatch - a2.exactMatch || b2.$score - a2.$score || (a2.caption || a2.value).localeCompare(b2.caption || b2.value);
          });
          var prev2 = null;
          matches = matches.filter(function(item) {
            var caption = item.snippet || item.caption || item.value;
            if (caption === prev2)
              return false;
            prev2 = caption;
            return true;
          });
          this.filtered = matches;
        };
        FilteredList2.prototype.filterCompletions = function(items, needle) {
          var results = [];
          var upper = needle.toUpperCase();
          var lower = needle.toLowerCase();
          loop:
            for (var i2 = 0, item; item = items[i2]; i2++) {
              if (item.skipFilter) {
                item.$score = item.score;
                results.push(item);
                continue;
              }
              var caption = !this.ignoreCaption && item.caption || item.value || item.snippet;
              if (!caption)
                continue;
              var lastIndex = -1;
              var matchMask = 0;
              var penalty = 0;
              var index2, distance2;
              if (this.exactMatch) {
                if (needle !== caption.substr(0, needle.length))
                  continue loop;
              } else {
                var fullMatchIndex = caption.toLowerCase().indexOf(lower);
                if (fullMatchIndex > -1) {
                  penalty = fullMatchIndex;
                } else {
                  for (var j2 = 0; j2 < needle.length; j2++) {
                    var i1 = caption.indexOf(lower[j2], lastIndex + 1);
                    var i22 = caption.indexOf(upper[j2], lastIndex + 1);
                    index2 = i1 >= 0 ? i22 < 0 || i1 < i22 ? i1 : i22 : i22;
                    if (index2 < 0)
                      continue loop;
                    distance2 = index2 - lastIndex - 1;
                    if (distance2 > 0) {
                      if (lastIndex === -1)
                        penalty += 10;
                      penalty += distance2;
                      matchMask = matchMask | 1 << j2;
                    }
                    lastIndex = index2;
                  }
                }
              }
              item.matchMask = matchMask;
              item.exactMatch = penalty ? 0 : 1;
              item.$score = (item.score || 0) - penalty;
              results.push(item);
            }
          return results;
        };
        return FilteredList2;
      }()
    );
    exports3.Autocomplete = Autocomplete3;
    exports3.CompletionProvider = CompletionProvider;
    exports3.FilteredList = FilteredList;
  });
  ace.define("ace/marker_group", ["require", "exports", "module"], function(require2, exports3, module3) {
    var MarkerGroup = (
      /** @class */
      function() {
        function MarkerGroup2(session, options) {
          if (options)
            this.markerType = options.markerType;
          this.markers = [];
          this.session = session;
          session.addDynamicMarker(this);
        }
        MarkerGroup2.prototype.getMarkerAtPosition = function(pos) {
          return this.markers.find(function(marker) {
            return marker.range.contains(pos.row, pos.column);
          });
        };
        MarkerGroup2.prototype.markersComparator = function(a2, b2) {
          return a2.range.start.row - b2.range.start.row;
        };
        MarkerGroup2.prototype.setMarkers = function(markers) {
          this.markers = markers.sort(this.markersComparator).slice(0, this.MAX_MARKERS);
          this.session._signal("changeBackMarker");
        };
        MarkerGroup2.prototype.update = function(html2, markerLayer, session, config2) {
          if (!this.markers || !this.markers.length)
            return;
          var visibleRangeStartRow = config2.firstRow, visibleRangeEndRow = config2.lastRow;
          var foldLine;
          var markersOnOneLine = 0;
          var lastRow = 0;
          for (var i2 = 0; i2 < this.markers.length; i2++) {
            var marker = this.markers[i2];
            if (marker.range.end.row < visibleRangeStartRow)
              continue;
            if (marker.range.start.row > visibleRangeEndRow)
              continue;
            if (marker.range.start.row === lastRow) {
              markersOnOneLine++;
            } else {
              lastRow = marker.range.start.row;
              markersOnOneLine = 0;
            }
            if (markersOnOneLine > 200) {
              continue;
            }
            var markerVisibleRange = marker.range.clipRows(visibleRangeStartRow, visibleRangeEndRow);
            if (markerVisibleRange.start.row === markerVisibleRange.end.row && markerVisibleRange.start.column === markerVisibleRange.end.column) {
              continue;
            }
            var screenRange = markerVisibleRange.toScreenRange(session);
            if (screenRange.isEmpty()) {
              foldLine = session.getNextFoldLine(markerVisibleRange.end.row, foldLine);
              if (foldLine && foldLine.end.row > markerVisibleRange.end.row) {
                visibleRangeStartRow = foldLine.end.row;
              }
              continue;
            }
            if (this.markerType === "fullLine") {
              markerLayer.drawFullLineMarker(html2, screenRange, marker.className, config2);
            } else if (screenRange.isMultiLine()) {
              if (this.markerType === "line")
                markerLayer.drawMultiLineMarker(html2, screenRange, marker.className, config2);
              else
                markerLayer.drawTextMarker(html2, screenRange, marker.className, config2);
            } else {
              markerLayer.drawSingleLineMarker(html2, screenRange, marker.className + " ace_br15", config2);
            }
          }
        };
        return MarkerGroup2;
      }()
    );
    MarkerGroup.prototype.MAX_MARKERS = 1e4;
    exports3.MarkerGroup = MarkerGroup;
  });
  ace.define("ace/autocomplete/text_completer", ["require", "exports", "module", "ace/range"], function(require2, exports3, module3) {
    var Range2 = require2("../range").Range;
    var splitRegex = /[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;
    function getWordIndex(doc, pos) {
      var textBefore = doc.getTextRange(Range2.fromPoints({
        row: 0,
        column: 0
      }, pos));
      return textBefore.split(splitRegex).length - 1;
    }
    function wordDistance(doc, pos) {
      var prefixPos = getWordIndex(doc, pos);
      var words = doc.getValue().split(splitRegex);
      var wordScores = /* @__PURE__ */ Object.create(null);
      var currentWord = words[prefixPos];
      words.forEach(function(word, idx) {
        if (!word || word === currentWord)
          return;
        var distance2 = Math.abs(prefixPos - idx);
        var score = words.length - distance2;
        if (wordScores[word]) {
          wordScores[word] = Math.max(score, wordScores[word]);
        } else {
          wordScores[word] = score;
        }
      });
      return wordScores;
    }
    exports3.getCompletions = function(editor2, session, pos, prefix, callback2) {
      var wordScore = wordDistance(session, pos);
      var wordList = Object.keys(wordScore);
      callback2(null, wordList.map(function(word) {
        return {
          caption: word,
          value: word,
          score: wordScore[word],
          meta: "local"
        };
      }));
    };
  });
  ace.define("ace/ext/language_tools", ["require", "exports", "module", "ace/snippets", "ace/autocomplete", "ace/config", "ace/lib/lang", "ace/autocomplete/util", "ace/marker_group", "ace/autocomplete/text_completer", "ace/editor", "ace/config"], function(require2, exports3, module3) {
    var snippetManager = require2("../snippets").snippetManager;
    var Autocomplete3 = require2("../autocomplete").Autocomplete;
    var config2 = require2("../config");
    var lang2 = require2("../lib/lang");
    var util2 = require2("../autocomplete/util");
    var MarkerGroup = require2("../marker_group").MarkerGroup;
    var textCompleter = require2("../autocomplete/text_completer");
    var keyWordCompleter = {
      getCompletions: function(editor2, session, pos, prefix, callback2) {
        if (session.$mode.completer) {
          return session.$mode.completer.getCompletions(editor2, session, pos, prefix, callback2);
        }
        var state = editor2.session.getState(pos.row);
        var completions = session.$mode.getCompletions(state, session, pos, prefix);
        completions = completions.map(function(el2) {
          el2.completerId = keyWordCompleter.id;
          return el2;
        });
        callback2(null, completions);
      },
      id: "keywordCompleter"
    };
    var transformSnippetTooltip = function(str) {
      var record = {};
      return str.replace(/\${(\d+)(:(.*?))?}/g, function(_24, p1, p2, p3) {
        return record[p1] = p3 || "";
      }).replace(/\$(\d+?)/g, function(_24, p1) {
        return record[p1];
      });
    };
    var snippetCompleter = {
      getCompletions: function(editor2, session, pos, prefix, callback2) {
        var scopes = [];
        var token2 = session.getTokenAt(pos.row, pos.column);
        if (token2 && token2.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/))
          scopes.push("html-tag");
        else
          scopes = snippetManager.getActiveScopes(editor2);
        var snippetMap = snippetManager.snippetMap;
        var completions = [];
        scopes.forEach(function(scope) {
          var snippets = snippetMap[scope] || [];
          for (var i2 = snippets.length; i2--; ) {
            var s2 = snippets[i2];
            var caption = s2.name || s2.tabTrigger;
            if (!caption)
              continue;
            completions.push({
              caption,
              snippet: s2.content,
              meta: s2.tabTrigger && !s2.name ? s2.tabTrigger + "⇥ " : "snippet",
              completerId: snippetCompleter.id
            });
          }
        }, this);
        callback2(null, completions);
      },
      getDocTooltip: function(item) {
        if (item.snippet && !item.docHTML) {
          item.docHTML = [
            "<b>",
            lang2.escapeHTML(item.caption),
            "</b>",
            "<hr></hr>",
            lang2.escapeHTML(transformSnippetTooltip(item.snippet))
          ].join("");
        }
      },
      id: "snippetCompleter"
    };
    var completers = [snippetCompleter, textCompleter, keyWordCompleter];
    exports3.setCompleters = function(val) {
      completers.length = 0;
      if (val)
        completers.push.apply(completers, val);
    };
    exports3.addCompleter = function(completer) {
      completers.push(completer);
    };
    exports3.textCompleter = textCompleter;
    exports3.keyWordCompleter = keyWordCompleter;
    exports3.snippetCompleter = snippetCompleter;
    var expandSnippet = {
      name: "expandSnippet",
      exec: function(editor2) {
        return snippetManager.expandWithTab(editor2);
      },
      bindKey: "Tab"
    };
    var onChangeMode = function(e2, editor2) {
      loadSnippetsForMode(editor2.session.$mode);
    };
    var loadSnippetsForMode = function(mode) {
      if (typeof mode == "string")
        mode = config2.$modes[mode];
      if (!mode)
        return;
      if (!snippetManager.files)
        snippetManager.files = {};
      loadSnippetFile(mode.$id, mode.snippetFileId);
      if (mode.modes)
        mode.modes.forEach(loadSnippetsForMode);
    };
    var loadSnippetFile = function(id2, snippetFilePath) {
      if (!snippetFilePath || !id2 || snippetManager.files[id2])
        return;
      snippetManager.files[id2] = {};
      config2.loadModule(snippetFilePath, function(m2) {
        if (!m2)
          return;
        snippetManager.files[id2] = m2;
        if (!m2.snippets && m2.snippetText)
          m2.snippets = snippetManager.parseSnippetFile(m2.snippetText);
        snippetManager.register(m2.snippets || [], m2.scope);
        if (m2.includeScopes) {
          snippetManager.snippetMap[m2.scope].includeScopes = m2.includeScopes;
          m2.includeScopes.forEach(function(x2) {
            loadSnippetsForMode("ace/mode/" + x2);
          });
        }
      });
    };
    var doLiveAutocomplete = function(e2) {
      var editor2 = e2.editor;
      var hasCompleter = editor2.completer && editor2.completer.activated;
      if (e2.command.name === "backspace") {
        if (hasCompleter && !util2.getCompletionPrefix(editor2))
          editor2.completer.detach();
      } else if (e2.command.name === "insertstring" && !hasCompleter) {
        lastExecEvent = e2;
        var delay2 = e2.editor.$liveAutocompletionDelay;
        if (delay2) {
          liveAutocompleteTimer.delay(delay2);
        } else {
          showLiveAutocomplete(e2);
        }
      }
    };
    var lastExecEvent;
    var liveAutocompleteTimer = lang2.delayedCall(function() {
      showLiveAutocomplete(lastExecEvent);
    }, 0);
    var showLiveAutocomplete = function(e2) {
      var editor2 = e2.editor;
      var prefix = util2.getCompletionPrefix(editor2);
      var previousChar = e2.args;
      var triggerAutocomplete = util2.triggerAutocomplete(editor2, previousChar);
      if (prefix && prefix.length >= editor2.$liveAutocompletionThreshold || triggerAutocomplete) {
        var completer = Autocomplete3.for(editor2);
        completer.autoShown = true;
        completer.showPopup(editor2);
      }
    };
    var Editor2 = require2("../editor").Editor;
    require2("../config").defineOptions(Editor2.prototype, "editor", {
      enableBasicAutocompletion: {
        set: function(val) {
          if (val) {
            Autocomplete3.for(this);
            if (!this.completers)
              this.completers = Array.isArray(val) ? val : completers;
            this.commands.addCommand(Autocomplete3.startCommand);
          } else {
            this.commands.removeCommand(Autocomplete3.startCommand);
          }
        },
        value: false
      },
      enableLiveAutocompletion: {
        set: function(val) {
          if (val) {
            if (!this.completers)
              this.completers = Array.isArray(val) ? val : completers;
            this.commands.on("afterExec", doLiveAutocomplete);
          } else {
            this.commands.off("afterExec", doLiveAutocomplete);
          }
        },
        value: false
      },
      liveAutocompletionDelay: {
        initialValue: 0
      },
      liveAutocompletionThreshold: {
        initialValue: 0
      },
      enableSnippets: {
        set: function(val) {
          if (val) {
            this.commands.addCommand(expandSnippet);
            this.on("changeMode", onChangeMode);
            onChangeMode(null, this);
          } else {
            this.commands.removeCommand(expandSnippet);
            this.off("changeMode", onChangeMode);
          }
        },
        value: false
      }
    });
    exports3.MarkerGroup = MarkerGroup;
  });
  (function() {
    ace.require(["ace/ext/language_tools"], function(m2) {
      if (module2) {
        module2.exports = m2;
      }
    });
  })();
})(extLanguage_tools);
const colors = {
  color: getComputedStyle(document.body).getPropertyValue("color")
};
const MultilevelData = ({ options: propOptions, onChange }) => {
  var _a2;
  const { t: t2 } = useTranslation();
  const [options, setOptions2] = reactExports.useState(propOptions ?? {});
  const [editingKey, setEditingKey] = reactExports.useState();
  const [expandKeys, setExpandKeys] = reactExports.useState(
    (_a2 = options.data) == null ? void 0 : _a2.map((d2) => d2.value)
  );
  const patchOptions = (patches) => {
    const newOptions = {
      ...options,
      ...patches
    };
    setOptions2(newOptions);
    onChange == null ? void 0 : onChange(newOptions);
  };
  const buildTreeDataSource = (data2) => {
    const ret = [];
    for (const md2 of data2) {
      const td2 = {
        selectable: false,
        checkable: false,
        disableCheckbox: true,
        title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            ColorPicker$1,
            {
              color: md2.color ?? colors.color,
              onChange: (c2) => {
                md2.color = buildColorValueString(c2);
                patchOptions({ ...options });
              }
            }
          ),
          editingKey == md2.value ? /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              size: "sm",
              value: md2.label,
              variant: "flat",
              onBlur: () => {
                setEditingKey(void 0);
              },
              onValueChange: (v2) => {
                md2.label = v2;
                patchOptions({ ...options });
              }
            }
          ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              radius: "sm",
              size: "sm",
              variant: "light",
              onPress: () => {
                setEditingKey(md2.value);
              },
              children: md2.label
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              radius: "sm",
              size: "sm",
              variant: "light",
              onPress: () => {
                md2.children ?? (md2.children = []);
                md2.children.push({
                  value: uuidv4(),
                  label: buildUntitledLabel(
                    t2("Untitled"),
                    md2.children.map((c2) => c2.label)
                  )
                });
                patchOptions({ ...options });
                const newExpandedKeys = expandKeys ?? [];
                if (!newExpandedKeys.includes(md2.value)) {
                  newExpandedKeys.push(md2.value);
                }
                setExpandKeys([...newExpandedKeys]);
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$m, { className: "text-small" })
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "danger",
              radius: "sm",
              size: "sm",
              variant: "light",
              onPress: () => {
                data2.splice(data2.indexOf(md2), 1);
                patchOptions({ ...options });
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-small" })
            }
          )
        ] }),
        key: md2.value,
        children: md2.children ? buildTreeDataSource(md2.children) : void 0
      };
      ret.push(td2);
    }
    return ret;
  };
  const data = options.data ? buildTreeDataSource(options.data) : [];
  console.log(options);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Button,
      {
        size: "sm",
        variant: "light",
        onPress: () => {
          options.data ?? (options.data = []);
          patchOptions({
            data: options.data.concat([
              {
                value: uuidv4(),
                label: buildUntitledLabel(
                  t2("Untitled"),
                  options.data.map((c2) => c2.label)
                )
              }
            ])
          });
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$m, { className: "text-small" }),
          t2("Add root data")
        ]
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Tree$1,
      {
        showLine: true,
        checkable: false,
        expandedKeys: expandKeys,
        selectable: false,
        treeData: data,
        onExpand: (keys2, { expanded }) => {
          setExpandKeys(
            expanded ? _$2.union(expandKeys, keys2) : _$2.intersection(expandKeys, keys2)
          );
        }
      }
    )
  ] });
};
MultilevelData.displayName = "MultilevelData";
const ExternalLink = ({ href, children, ...otherProps }) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Button,
    {
      color: "primary",
      href,
      variant: "light",
      ...otherProps,
      onPress: (e2) => {
        BApi$1.gui.openUrlInDefaultBrowser({ url: href });
      },
      children: [
        children,
        /* @__PURE__ */ jsxRuntimeExports.jsx(TbExternalLink, { className: "text-base" })
      ]
    }
  );
};
ExternalLink.displayName = "ExternalLink";
const qqGroupImg = "/assets/qq-group-D_wH-SpU.png";
const FeatureStatusTip = ({ name: name2, status, className, url: url2 }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  console.log(name2);
  const renderText2 = reactExports.useCallback(() => {
    let i18nKey;
    switch (status) {
      case "developing":
        i18nKey = "FeatureRequestTip.Developing";
        break;
      case "deprecated":
        i18nKey = "FeatureRequestTip.Deprecated";
        break;
      case "deprecating":
        i18nKey = "FeatureRequestTip.Deprecating";
        break;
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(Trans, { i18nKey, values: { name: name2 }, children: [
      "The",
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold px-1", children: "name" }),
      "feature is under development. You can urge the author or make suggestions on",
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        ExternalLink,
        {
          className: "px-1",
          href: "https://github.com/anobaka/InsideWorld",
          children: "Github"
        }
      ),
      "or",
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Chip,
        {
          className: "cursor-pointer",
          classNames: { content: "px-0" },
          color: "primary",
          variant: "light",
          onClick: () => {
            createPortal(Modal, {
              defaultVisible: true,
              title: t2("Join QQ group"),
              children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { alt: "Qrcode for qq group", src: qqGroupImg }),
              footer: {
                actions: ["ok"]
              }
            });
          },
          children: "QQ group"
        }
      ),
      "."
    ] });
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `italic opacity-80 whitespace-break-spaces ${className}`, children: [
    renderText2(),
    url2 && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      t2("For more information, you can visit:"),
      /* @__PURE__ */ jsxRuntimeExports.jsx(ExternalLink, { className: "px-1", href: url2, children: url2 })
    ] })
  ] });
};
FeatureStatusTip.displayName = "FeatureStatusTip";
const NotSet = (props) => {
  const { t: t2 } = useTranslation();
  const { onClick, size: size2 } = props;
  if (onClick) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { radius: "sm", size: size2, variant: "light", onClick, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "opacity-40", children: t2("Click to set") }) });
  } else {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "opacity-40", children: t2("Not set") });
  }
};
NotSet.displayName = "NotSet";
const log$K = buildLogger("StringValueRenderer");
const StringValueRenderer = (props) => {
  const { value: propsValue, multiline, variant, editor: editor2 } = props;
  const { t: t2 } = useTranslation();
  const [editing, setEditing] = reactExports.useState(false);
  const [value2, setValue] = reactExports.useState(propsValue);
  useUpdateEffect(() => {
    setValue(propsValue);
  }, [propsValue]);
  const startEditing = editor2 ? () => {
    log$K("Start editing");
    setEditing(true);
  } : void 0;
  if (!editing) {
    if (value2 == void 0 || value2.length == 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { onClick: startEditing });
    }
  }
  const completeEditing = () => {
    var _a2;
    (_a2 = editor2 == null ? void 0 : editor2.onValueChange) == null ? void 0 : _a2.call(editor2, value2, value2);
    setEditing(false);
  };
  if (variant == "light" && !editing) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { onClick: startEditing, children: value2 });
  }
  if (editing) {
    if (multiline) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(textarea_default, { size: props.size, autoFocus: true, value: value2, onBlur: completeEditing, onValueChange: setValue });
    } else {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(input_default, { size: props.size, autoFocus: true, value: value2, onBlur: completeEditing, onValueChange: setValue });
    }
  } else {
    if (multiline) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        "pre",
        {
          dangerouslySetInnerHTML: { __html: value2 },
          className: "whitespace-pre-wrap",
          onClick: startEditing
        }
      );
    } else {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { onClick: startEditing, children: value2 });
    }
  }
};
StringValueRenderer.displayName = "StringValueRenderer";
const NumberValueEditor = ({
  value: value2,
  onValueChange,
  label,
  placeholder,
  size: size2,
  ...props
}) => {
  var _a2;
  const valueRef = reactExports.useRef(value2);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    input_default,
    {
      size: size2,
      autoFocus: true,
      defaultValue: (_a2 = valueRef.current) == null ? void 0 : _a2.toString(),
      label,
      placeholder,
      onBlur: () => {
        onValueChange == null ? void 0 : onValueChange(valueRef.current, valueRef.current);
      },
      onKeyDown: (e2) => {
        if (e2.key === "Enter") {
          onValueChange == null ? void 0 : onValueChange(valueRef.current, valueRef.current);
        }
      },
      onValueChange: (v2) => {
        var _a3;
        const nStr = (_a3 = v2 == null ? void 0 : v2.match(/[\d,]+(\.\d+)?/)) == null ? void 0 : _a3[0];
        const n2 = Number(nStr);
        valueRef.current = Number.isNaN(n2) ? void 0 : n2;
      }
    }
  );
};
NumberValueEditor.displayName = "NumberValueEditor";
const log$J = buildLogger("NumberValueRenderer");
const NumberValueRenderer = (props) => {
  const { value: value2, precision, editor: editor2, variant, suffix, as: as2, size: size2, ...otherProps } = props;
  log$J(props);
  const [editing, setEditing] = reactExports.useState(false);
  const startEditing = editor2 ? () => setEditing(true) : void 0;
  if (editing) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      NumberValueEditor,
      {
        value: value2,
        onValueChange: (dbValue, bizValue) => {
          var _a2;
          (_a2 = editor2 == null ? void 0 : editor2.onValueChange) == null ? void 0 : _a2.call(editor2, dbValue, bizValue);
          setEditing(false);
        }
      }
    );
  }
  if (value2 == void 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { onClick: startEditing });
  }
  if (variant == "light" || as2 == "number") {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { onClick: startEditing, children: [
      value2,
      suffix
    ] });
  } else {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(progress_default, { size: size2, value: value2, onClick: startEditing });
  }
};
NumberValueRenderer.displayName = "NumberValueRenderer";
const BooleanValueRenderer = ({
  value: value2,
  variant,
  editor: editor2,
  size: size2,
  ...props
}) => {
  const { t: t2 } = useTranslation();
  const v2 = variant ?? "default";
  switch (v2) {
    case "default":
    case "light":
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        checkbox_default,
        {
          disableAnimation: !editor2,
          isSelected: value2,
          size: size2,
          onValueChange: (v22) => {
            var _a2;
            return (_a2 = editor2 == null ? void 0 : editor2.onValueChange) == null ? void 0 : _a2.call(editor2, v22, v22);
          }
        }
      );
    case "switch":
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        switch_default,
        {
          disableAnimation: !editor2,
          isSelected: value2,
          size: size2,
          onValueChange: (v22) => {
            var _a2;
            return (_a2 = editor2 == null ? void 0 : editor2.onValueChange) == null ? void 0 : _a2.call(editor2, v22, v22);
          }
        }
      );
  }
};
BooleanValueRenderer.displayName = "BooleanValueRenderer";
const LinkValueRenderer = ({
  value: value2,
  editor: editor2,
  variant,
  size: size2,
  ...props
}) => {
  const { t: t2 } = useTranslation();
  const [editingValue, setEditingValue] = reactExports.useState();
  const renderInner = () => {
    if (value2 == null ? void 0 : value2.url) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(ExternalLink, { href: value2.url, children: value2.text ?? value2.url });
    } else {
      if ((value2 == null ? void 0 : value2.text) != void 0 && value2.text.length > 0) {
        return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: value2.text });
      }
    }
    return null;
  };
  const inner = renderInner();
  if (editor2) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-2", children: [
      inner,
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        PopoverComponent,
        {
          isKeyboardDismissDisabled: true,
          isOpen: !!editingValue,
          shouldCloseOnBlur: false,
          trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, size: "sm", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$T, { className: "text-base" }) }),
          onOpenChange: (isOpen) => {
            if (isOpen) {
              setEditingValue({ ...value2 });
            }
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                label: t2("Text"),
                size: size2,
                value: editingValue == null ? void 0 : editingValue.text,
                onValueChange: (text2) => {
                  setEditingValue({
                    ...editingValue,
                    text: text2
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                label: t2("Link"),
                size: size2,
                value: editingValue == null ? void 0 : editingValue.url,
                onValueChange: (url2) => {
                  setEditingValue({
                    ...editingValue,
                    url: url2
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 justify-center", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: "primary",
                  size: size2,
                  onClick: () => {
                    var _a2;
                    (_a2 = editor2 == null ? void 0 : editor2.onValueChange) == null ? void 0 : _a2.call(editor2, editingValue, editingValue);
                    setEditingValue(void 0);
                  },
                  children: t2("Submit")
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  size: size2,
                  onClick: () => {
                    setEditingValue(void 0);
                  },
                  children: t2("Cancel")
                }
              )
            ] })
          ] })
        }
      )
    ] });
  } else {
    return inner;
  }
};
LinkValueRenderer.displayName = "LinkValueRenderer";
const log$I = buildLogger("DateTimeValueRenderer");
const DateTimeValueRenderer = (props) => {
  const { value: propsValue, format: format2, as: as2, variant, editor: editor2, size: size2 } = props;
  log$I(props);
  const [editing, setEditing] = reactExports.useState(false);
  const [value2, setValue] = reactExports.useState(propsValue);
  reactExports.useEffect(() => {
    setValue(propsValue);
  }, [propsValue]);
  const startEditing = editor2 ? () => {
    setEditing(true);
  } : void 0;
  const f2 = format2 == void 0 ? as2 == "datetime" ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD" : format2;
  if (!editing) {
    if (value2 == void 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { onClick: startEditing });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { onClick: startEditing, children: value2 == null ? void 0 : value2.format(f2) });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    DateInput,
    {
      granularity: as2 == "datetime" ? "second" : "day",
      isReadOnly: !editor2,
      value: value2,
      size: size2,
      onBlur: () => {
        var _a2;
        log$I("onBlur", value2);
        (_a2 = editor2 == null ? void 0 : editor2.onValueChange) == null ? void 0 : _a2.call(editor2, value2);
        setEditing(false);
      },
      onChange: (d2) => {
        log$I("OnChange", d2);
        setValue(d2);
      },
      onKeyDown: (e2) => {
        var _a2;
        if (e2.key == "Enter") {
          log$I("onEnter", value2);
          (_a2 = editor2 == null ? void 0 : editor2.onValueChange) == null ? void 0 : _a2.call(editor2, value2, value2);
          setEditing(false);
        }
      }
    }
  );
};
DateTimeValueRenderer.displayName = "DateTimeValueRenderer";
function LuCalendarClock(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5" }, "child": [] }, { "tag": "path", "attr": { "d": "M16 2v4" }, "child": [] }, { "tag": "path", "attr": { "d": "M8 2v4" }, "child": [] }, { "tag": "path", "attr": { "d": "M3 10h5" }, "child": [] }, { "tag": "path", "attr": { "d": "M17.5 17.5 16 16.25V14" }, "child": [] }, { "tag": "path", "attr": { "d": "M22 16a6 6 0 1 1-12 0 6 6 0 0 1 12 0Z" }, "child": [] }] })(props);
}
function LuCalendarDays(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "rect", "attr": { "width": "18", "height": "18", "x": "3", "y": "4", "rx": "2", "ry": "2" }, "child": [] }, { "tag": "line", "attr": { "x1": "16", "x2": "16", "y1": "2", "y2": "6" }, "child": [] }, { "tag": "line", "attr": { "x1": "8", "x2": "8", "y1": "2", "y2": "6" }, "child": [] }, { "tag": "line", "attr": { "x1": "3", "x2": "21", "y1": "10", "y2": "10" }, "child": [] }, { "tag": "path", "attr": { "d": "M8 14h.01" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 14h.01" }, "child": [] }, { "tag": "path", "attr": { "d": "M16 14h.01" }, "child": [] }, { "tag": "path", "attr": { "d": "M8 18h.01" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 18h.01" }, "child": [] }, { "tag": "path", "attr": { "d": "M16 18h.01" }, "child": [] }] })(props);
}
function LuLink(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }, "child": [] }, { "tag": "path", "attr": { "d": "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" }, "child": [] }] })(props);
}
function LuRegex(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M17 3v10" }, "child": [] }, { "tag": "path", "attr": { "d": "m12.67 5.5 8.66 5" }, "child": [] }, { "tag": "path", "attr": { "d": "m12.67 10.5 8.66-5" }, "child": [] }, { "tag": "path", "attr": { "d": "M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z" }, "child": [] }] })(props);
}
function LuRuler(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z" }, "child": [] }, { "tag": "path", "attr": { "d": "m14.5 12.5 2-2" }, "child": [] }, { "tag": "path", "attr": { "d": "m11.5 9.5 2-2" }, "child": [] }, { "tag": "path", "attr": { "d": "m8.5 6.5 2-2" }, "child": [] }, { "tag": "path", "attr": { "d": "m17.5 15.5 2-2" }, "child": [] }] })(props);
}
function LuTags(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M9 5H2v7l6.29 6.29c.94.94 2.48.94 3.42 0l3.58-3.58c.94-.94.94-2.48 0-3.42L9 5Z" }, "child": [] }, { "tag": "path", "attr": { "d": "M6 9.01V9" }, "child": [] }, { "tag": "path", "attr": { "d": "m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19" }, "child": [] }] })(props);
}
function PiEmpty(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 256 256", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M198.24,62.63l15.68-17.25a8,8,0,0,0-11.84-10.76L186.4,51.86A95.95,95.95,0,0,0,57.76,193.37L42.08,210.62a8,8,0,1,0,11.84,10.76L69.6,204.14A95.95,95.95,0,0,0,198.24,62.63ZM48,128A80,80,0,0,1,175.6,63.75l-107,117.73A79.63,79.63,0,0,1,48,128Zm80,80a79.55,79.55,0,0,1-47.6-15.75l107-117.73A79.95,79.95,0,0,1,128,208Z" }, "child": [] }] })(props);
}
function PiImages(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 256 256", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M216,40H72A16,16,0,0,0,56,56V72H40A16,16,0,0,0,24,88V200a16,16,0,0,0,16,16H184a16,16,0,0,0,16-16V184h16a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM72,56H216v62.75l-10.07-10.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L72,109.37ZM184,200H40V88H56v80a16,16,0,0,0,16,16H184Zm32-32H72V132l36-36,49.66,49.66a8,8,0,0,0,11.31,0L194.63,120,216,141.38V168ZM160,84a12,12,0,1,1,12,12A12,12,0,0,1,160,84Z" }, "child": [] }] })(props);
}
function PiTreeView(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 256 256", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M176,152h32a16,16,0,0,0,16-16V104a16,16,0,0,0-16-16H176a16,16,0,0,0-16,16v8H88V80h8a16,16,0,0,0,16-16V32A16,16,0,0,0,96,16H64A16,16,0,0,0,48,32V64A16,16,0,0,0,64,80h8V192a24,24,0,0,0,24,24h64v8a16,16,0,0,0,16,16h32a16,16,0,0,0,16-16V192a16,16,0,0,0-16-16H176a16,16,0,0,0-16,16v8H96a8,8,0,0,1-8-8V128h72v8A16,16,0,0,0,176,152ZM64,32H96V64H64ZM176,192h32v32H176Zm0-88h32v32H176Z" }, "child": [] }] })(props);
}
const StandardValueTypeIconMap = {
  [StandardValueType.String]: MdOutlineTextFormat,
  [StandardValueType.ListString]: MdOutlineTextSnippet,
  [StandardValueType.Decimal]: TbNumber123,
  [StandardValueType.Link]: LuLink,
  [StandardValueType.Boolean]: MdOutlineCheckBox,
  [StandardValueType.DateTime]: LuCalendarDays,
  [StandardValueType.Time]: MdOutlineAccessTime,
  [StandardValueType.ListListString]: PiTreeView,
  [StandardValueType.ListTag]: LuTags
};
const Icon = ({ valueType, ...props }) => {
  const ValueIcon = StandardValueTypeIconMap[valueType];
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueIcon, { className: "text-base", ...props });
};
Icon.displayName = "Icon";
const log$H = buildLogger("ChoiceValueEditor");
const ChoiceValueEditor = (props) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const { multiple, getDataSource, value: propsValue, onValueChange } = props;
  const [dataSource, setDataSource] = reactExports.useState([]);
  const [keyword, setKeyword] = reactExports.useState("");
  const [value2, setValue] = reactExports.useState(propsValue ?? []);
  log$H(props);
  reactExports.useEffect(() => {
    loadData();
  }, []);
  const loadData = async () => {
    const data = await getDataSource() ?? [];
    if (data.length > 0) {
      setDataSource(data);
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      size: dataSource.length > 10 ? "xl" : "lg",
      title: t2("Select data"),
      onOk: async () => {
        const validValues = value2.filter(
          (v2) => dataSource.some((d2) => d2.value == v2)
        );
        onValueChange == null ? void 0 : onValueChange(
          validValues,
          validValues.map((v2) => {
            var _a2;
            return (_a2 = dataSource.find((x2) => x2.value == v2)) == null ? void 0 : _a2.label;
          }).filter((x2) => x2)
        );
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            size: "sm",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1h, { className: "text-small" }),
            value: keyword,
            onValueChange: (v2) => {
              setKeyword(v2);
            }
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: dataSource.length == 0 ? t2("No choices available, please check your configurations") : dataSource.filter(
          (d2) => keyword.length == 0 || d2.label.toLowerCase().includes(keyword.toLowerCase())
        ).map((d2) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: value2.includes(d2.value) ? "primary" : "default",
              size: "sm",
              onClick: () => {
                if (multiple) {
                  log$H(
                    "value",
                    value2,
                    "select",
                    d2.value,
                    "includes",
                    value2.includes(d2.value)
                  );
                  if (value2.includes(d2.value)) {
                    setValue(value2.filter((v2) => v2 !== d2.value));
                  } else {
                    setValue([...value2 || [], d2.value]);
                  }
                } else {
                  setValue([d2.value]);
                }
              },
              children: d2.label
            }
          );
        }) })
      ]
    }
  );
};
ChoiceValueEditor.displayName = "ChoiceValueEditor";
const filterMultilevelData = (data, keyword) => {
  if (!keyword) {
    return data;
  }
  const result = [];
  for (const d2 of data) {
    if (d2.label.toLowerCase().includes(keyword)) {
      result.push(d2);
    } else {
      if (d2.children && d2.children.length > 0) {
        const children = filterMultilevelData(d2.children, keyword);
        if (children.length > 0) {
          result.push({
            ...d2,
            children
          });
        }
      }
    }
  }
  return result;
};
const findNodeChainInMultilevelData = (data, value2) => {
  for (const d2 of data) {
    if (d2.value === value2) {
      return [d2];
    } else {
      if (d2.children && d2.children.length > 0) {
        const children = findNodeChainInMultilevelData(d2.children, value2);
        if (children !== void 0) {
          if ((children == null ? void 0 : children.length) > 0) {
            return [d2, ...children];
          }
        }
      }
    }
  }
  return;
};
const convertFromApiValue = (value2, type4) => {
  if (value2 == void 0) {
    return void 0;
  }
  switch (type4) {
    case StandardValueType.String:
    case StandardValueType.ListString:
    case StandardValueType.Decimal:
    case StandardValueType.Link:
    case StandardValueType.Boolean:
    case StandardValueType.ListListString:
    case StandardValueType.ListTag:
      return value2;
    case StandardValueType.DateTime:
      return dayjs(value2);
    case StandardValueType.Time:
      return dayjs.duration(value2);
  }
};
const Serialization = {
  LowLevelSeparator: ",",
  HighLevelSeparator: ";",
  EscapeChar: "\\"
};
const deserializeStandardValue = (value2, type4) => {
  if (value2 == void 0) {
    return void 0;
  }
  switch (type4) {
    case StandardValueType.String:
      return value2;
    case StandardValueType.ListString:
      return splitStringWithEscapeChar(
        value2,
        Serialization.LowLevelSeparator,
        Serialization.EscapeChar
      );
    case StandardValueType.Decimal: {
      const d2 = parseFloat(value2);
      if (Number.isNaN(d2)) {
        return void 0;
      }
      return d2;
    }
    case StandardValueType.Link: {
      const parts = splitStringWithEscapeChar(
        value2,
        Serialization.LowLevelSeparator,
        Serialization.EscapeChar
      );
      if (parts) {
        return {
          text: parts[0],
          url: parts[1]
        };
      }
      return void 0;
    }
    case StandardValueType.Boolean: {
      if (value2 === "True") {
        return true;
      } else if (value2 === "False") {
        return false;
      }
      return void 0;
    }
    case StandardValueType.ListListString: {
      const parts = splitStringWithEscapeChar(
        value2,
        Serialization.HighLevelSeparator,
        Serialization.EscapeChar
      );
      if (parts) {
        return parts.map(
          (p2) => splitStringWithEscapeChar(
            p2,
            Serialization.LowLevelSeparator,
            Serialization.EscapeChar
          )
        );
      }
      return void 0;
    }
    case StandardValueType.ListTag: {
      const parts = splitStringWithEscapeChar(
        value2,
        Serialization.HighLevelSeparator,
        Serialization.EscapeChar
      );
      if (parts) {
        return parts.map((p2) => {
          const tagSegments = splitStringWithEscapeChar(
            p2,
            Serialization.LowLevelSeparator,
            Serialization.EscapeChar
          );
          if (tagSegments) {
            return {
              group: tagSegments[0],
              name: tagSegments[1]
            };
          }
          return null;
        }).filter((p2) => p2 != null);
      }
      return void 0;
    }
    case StandardValueType.DateTime: {
      return dayjs(parseInt(value2, 10));
    }
    case StandardValueType.Time:
      return dayjs.duration(parseInt(value2, 10));
  }
};
const serializeStandardValue = (value2, type4) => {
  if (value2 == void 0) {
    return void 0;
  }
  switch (type4) {
    case StandardValueType.String:
      return value2;
    case StandardValueType.ListString:
      return joinWithEscapeChar(
        value2,
        Serialization.LowLevelSeparator,
        Serialization.EscapeChar
      );
    case StandardValueType.Decimal:
      return value2.toString();
    case StandardValueType.Link: {
      const lv = value2;
      if (!lv) {
        return void 0;
      }
      return joinWithEscapeChar(
        [lv.text, lv.url],
        Serialization.LowLevelSeparator,
        Serialization.EscapeChar
      );
    }
    case StandardValueType.Boolean: {
      return value2 ? "True" : "False";
    }
    case StandardValueType.ListListString: {
      return joinWithEscapeChar(
        value2.map(
          (p2) => joinWithEscapeChar(
            p2,
            Serialization.LowLevelSeparator,
            Serialization.EscapeChar
          )
        ),
        Serialization.HighLevelSeparator,
        Serialization.EscapeChar
      );
    }
    case StandardValueType.ListTag: {
      const tvs = value2;
      if (!tvs) {
        return void 0;
      }
      return joinWithEscapeChar(
        tvs.map(
          (tv2) => joinWithEscapeChar(
            [tv2.group, tv2.name],
            Serialization.LowLevelSeparator,
            Serialization.EscapeChar
          )
        ),
        Serialization.HighLevelSeparator,
        Serialization.EscapeChar
      );
    }
    case StandardValueType.DateTime: {
      const dt = value2;
      return dt.valueOf().toString();
    }
    case StandardValueType.Time: {
      const dur = value2;
      return dur.asMilliseconds().toString();
    }
  }
};
const buildDefaultSelectable = () => {
  return (data, depth, index2) => data.children == void 0 || data.children.length == 0;
};
const log$G = buildLogger("MultilevelValueEditor");
const MultilevelValueEditor = (props) => {
  const { t: t2 } = useTranslation();
  const {
    getDataSource,
    selectable = buildDefaultSelectable(),
    value: propsValue,
    onValueChange,
    onCancel,
    multiple
  } = props;
  log$G(props);
  const [dataSource, setDataSource] = reactExports.useState([]);
  const [keyword, setKeyword] = reactExports.useState("");
  const [value2, setValue] = reactExports.useState(propsValue ?? []);
  reactExports.useEffect(() => {
    loadData();
  }, []);
  useUpdateEffect(() => {
    loadData();
  }, [getDataSource]);
  reactExports.useEffect(() => {
    setValue(propsValue ?? []);
  }, [propsValue]);
  const loadData = async () => {
    const data = await (getDataSource == null ? void 0 : getDataSource()) ?? [];
    if (data.length > 0) {
      setDataSource(data);
    }
  };
  const renderTreeNodes = reactExports.useCallback(
    (data) => {
      const leaves = data.filter((d2) => !d2.children || d2.children.length == 0);
      const branches = data.filter((d2) => d2.children && d2.children.length > 0);
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        "div",
        {
          className: "flex flex-col gap-1 rounded p-2 grow",
          style: { background: "var(--bakaui-overlap-background)" },
          children: [
            leaves.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: leaves.map(({ value: nodeValue, color: color2, label }, idx) => {
              const isSelected = value2.includes(nodeValue);
              const style2 = {};
              if (color2) {
                style2.color = color2;
                if (!isSelected) {
                  style2.backgroundColor = autoBackgroundColor(color2);
                }
              }
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: isSelected ? "primary" : "default",
                  size: "sm",
                  style: style2,
                  onPress: () => {
                    if (multiple) {
                      if (isSelected) {
                        setValue(value2.filter((v2) => v2 !== nodeValue));
                      } else {
                        setValue([...value2, nodeValue]);
                      }
                    } else {
                      setValue([nodeValue]);
                    }
                  },
                  children: label
                },
                idx
              );
            }) }),
            branches.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
              "div",
              {
                className: "grid items-center gap-1 grow",
                style: { gridTemplateColumns: "auto auto minmax(0, 1fr)" },
                children: branches.map(({ value: value22, label, color: color2, children }, idx) => {
                  const style2 = {};
                  if (color2) {
                    style2.color = color2;
                  }
                  return /* @__PURE__ */ jsxRuntimeExports.jsxs(React$5.Fragment, { children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", style: style2, children: label }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1a, { className: "text-small" }),
                    renderTreeNodes(children)
                  ] }, idx);
                })
              }
            )
          ]
        }
      );
    },
    [value2]
  );
  const filteredData = filterMultilevelData(dataSource, keyword);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      size: dataSource.length > 10 ? "xl" : "lg",
      title: t2("Select data"),
      onClose: onCancel,
      onOk: async () => {
        const bv = value2.map(
          (v2) => {
            var _a2;
            return (_a2 = findNodeChainInMultilevelData(dataSource, v2)) == null ? void 0 : _a2.map((x2) => x2.label);
          }
        ).filter((x2) => x2);
        onValueChange == null ? void 0 : onValueChange(value2, bv);
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1 max-h-full min-h-0", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            size: "sm",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1h, { className: "text-small" }),
            value: keyword,
            onValueChange: (v2) => {
              setKeyword(v2);
            }
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1 w-full min-h-0 overflow-y-auto", children: filteredData.length > 0 ? renderTreeNodes(filteredData) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "m-2 flex items-center justify-center", children: t2("No data") }) })
      ] })
    }
  );
};
MultilevelValueEditor.displayName = "MultilevelValueEditor";
const log$F = buildLogger("ChoiceValueRenderer");
const ChoiceValueRenderer = (props) => {
  const { value: value2, editor: editor2, variant, getDataSource, multiple, valueAttributes, size: size2 } = props;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  log$F(props);
  const onClickValues = editor2 ? async () => {
    createPortal(ChoiceValueEditor, {
      value: editor2 == null ? void 0 : editor2.value,
      getDataSource: getDataSource ?? (async () => []),
      onValueChange: editor2 == null ? void 0 : editor2.onValueChange,
      multiple: multiple ?? false
    });
  } : void 0;
  reactExports.useEffect(() => {
    if (props.defaultEditing) {
      onClickValues == null ? void 0 : onClickValues();
    }
  }, []);
  const validValues = (value2 == null ? void 0 : value2.map((v2) => v2 != void 0)) || [];
  if (validValues.length == 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { onClick: onClickValues });
  }
  if (variant == "light") {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { onClick: onClickValues, children: value2 == null ? void 0 : value2.map((v2, i2) => {
      var _a2;
      const styles2 = {};
      styles2.color = (_a2 = valueAttributes == null ? void 0 : valueAttributes[i2]) == null ? void 0 : _a2.color;
      if (styles2.color) {
        styles2.backgroundColor = autoBackgroundColor(styles2.color);
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        i2 != 0 && ",",
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: styles2, children: v2 })
      ] });
    }) });
  } else {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", onClick: onClickValues, children: value2 == null ? void 0 : value2.map((v2, i2) => {
      var _a2;
      const styles2 = {};
      styles2.color = (_a2 = valueAttributes == null ? void 0 : valueAttributes[i2]) == null ? void 0 : _a2.color;
      if (styles2.color) {
        styles2.backgroundColor = autoBackgroundColor(styles2.color);
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Chip,
        {
          className: "h-auto whitespace-break-spaces py-1",
          radius: "sm",
          size: size2,
          style: styles2,
          children: v2
        }
      );
    }) });
  }
};
ChoiceValueRenderer.displayName = "ChoiceValueRenderer";
const FormulaValueRenderer = ({
  value: value2,
  variant,
  editor: editor2,
  size: size2,
  ...props
}) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("Not supported") });
};
FormulaValueRenderer.displayName = "FormulaValueRenderer";
var imagePromiseFactory = function(_ref) {
  var _ref$decode = _ref.decode, decode2 = _ref$decode === void 0 ? true : _ref$decode, _ref$crossOrigin = _ref.crossOrigin, crossOrigin = _ref$crossOrigin === void 0 ? "" : _ref$crossOrigin;
  return function(src) {
    return new Promise(function(resolve2, reject) {
      var i2 = new Image();
      if (crossOrigin)
        i2.crossOrigin = crossOrigin;
      i2.onload = function() {
        decode2 && i2.decode ? i2.decode().then(resolve2)["catch"](reject) : resolve2();
      };
      i2.onerror = reject;
      i2.src = src;
    });
  };
};
function ownKeys$1(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    enumerableOnly && (symbols = symbols.filter(function(sym) {
      return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
    })), keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$2(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = null != arguments[i2] ? arguments[i2] : {};
    i2 % 2 ? ownKeys$1(Object(source2), true).forEach(function(key) {
      _defineProperty$3(target, key, source2[key]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2)) : ownKeys$1(Object(source2)).forEach(function(key) {
      Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
    });
  }
  return target;
}
var removeBlankArrayElements = function removeBlankArrayElements2(a2) {
  return a2.filter(function(x2) {
    return x2;
  });
};
var stringToArray = function stringToArray2(x2) {
  return Array.isArray(x2) ? x2 : [x2];
};
var cache = {};
var promiseFind = function promiseFind2(arr, promiseFactory) {
  var done = false;
  return new Promise(function(resolve2, reject) {
    var queueNext = function queueNext2(src) {
      return promiseFactory(src).then(function() {
        done = true;
        resolve2(src);
      });
    };
    arr.reduce(function(p2, src) {
      return p2["catch"](function() {
        if (!done)
          return queueNext(src);
      });
    }, queueNext(arr.shift()))["catch"](reject);
  });
};
function useImage(_ref) {
  var srcList = _ref.srcList, _ref$imgPromise = _ref.imgPromise, imgPromise = _ref$imgPromise === void 0 ? imagePromiseFactory({
    decode: true
  }) : _ref$imgPromise, _ref$useSuspense = _ref.useSuspense, useSuspense = _ref$useSuspense === void 0 ? true : _ref$useSuspense;
  var _useState = reactExports.useState(false), setIsSettled = _useState[1];
  var sourceList = removeBlankArrayElements(stringToArray(srcList));
  var sourceKey = sourceList.join("");
  if (!cache[sourceKey]) {
    cache[sourceKey] = {
      promise: promiseFind(sourceList, imgPromise),
      cache: "pending",
      error: null
    };
  }
  if (cache[sourceKey].cache === "resolved") {
    return {
      src: cache[sourceKey].src,
      isLoading: false,
      error: null
    };
  }
  if (cache[sourceKey].cache === "rejected") {
    if (useSuspense)
      throw cache[sourceKey].error;
    return {
      isLoading: false,
      error: cache[sourceKey].error,
      src: void 0
    };
  }
  cache[sourceKey].promise.then(function(src) {
    cache[sourceKey] = _objectSpread$2(_objectSpread$2({}, cache[sourceKey]), {}, {
      cache: "resolved",
      src
    });
    if (!useSuspense)
      setIsSettled(sourceKey);
  })["catch"](function(error2) {
    cache[sourceKey] = _objectSpread$2(_objectSpread$2({}, cache[sourceKey]), {}, {
      cache: "rejected",
      error: error2
    });
    if (!useSuspense)
      setIsSettled(sourceKey);
  });
  if (useSuspense)
    throw cache[sourceKey].promise;
  return {
    isLoading: true,
    src: void 0,
    error: null
  };
}
var _excluded$3 = ["decode", "src", "loader", "unloader", "container", "loaderContainer", "unloaderContainer", "imgPromise", "crossorigin", "useSuspense"];
function ownKeys(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    enumerableOnly && (symbols = symbols.filter(function(sym) {
      return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
    })), keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$1(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = null != arguments[i2] ? arguments[i2] : {};
    i2 % 2 ? ownKeys(Object(source2), true).forEach(function(key) {
      _defineProperty$3(target, key, source2[key]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2)) : ownKeys(Object(source2)).forEach(function(key) {
      Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
    });
  }
  return target;
}
var passthroughContainer = function passthroughContainer2(x2) {
  return x2;
};
function Img(_ref) {
  var _ref$decode = _ref.decode, decode2 = _ref$decode === void 0 ? true : _ref$decode, _ref$src = _ref.src, srcList = _ref$src === void 0 ? [] : _ref$src, _ref$loader = _ref.loader, loader = _ref$loader === void 0 ? null : _ref$loader, _ref$unloader = _ref.unloader, unloader = _ref$unloader === void 0 ? null : _ref$unloader, _ref$container = _ref.container, container = _ref$container === void 0 ? passthroughContainer : _ref$container, _ref$loaderContainer = _ref.loaderContainer, loaderContainer = _ref$loaderContainer === void 0 ? passthroughContainer : _ref$loaderContainer, _ref$unloaderContaine = _ref.unloaderContainer, unloaderContainer = _ref$unloaderContaine === void 0 ? passthroughContainer : _ref$unloaderContaine, imgPromise = _ref.imgPromise, crossorigin = _ref.crossorigin, _ref$useSuspense = _ref.useSuspense, useSuspense = _ref$useSuspense === void 0 ? false : _ref$useSuspense, imgProps = _objectWithoutPropertiesLoose$2(_ref, _excluded$3);
  imgPromise = imgPromise || imagePromiseFactory({
    decode: decode2,
    crossOrigin: crossorigin
  });
  var _useImage = useImage({
    srcList,
    imgPromise,
    useSuspense
  }), src = _useImage.src, isLoading = _useImage.isLoading;
  if (src)
    return container(/* @__PURE__ */ React$5.createElement("img", _objectSpread$1({
      src
    }, imgProps)));
  if (!useSuspense && isLoading)
    return loaderContainer(loader);
  if (!useSuspense && unloader)
    return unloaderContainer(unloader);
  return null;
}
const FileSystemSelectorButton = ({
  fileSystemSelectorProps,
  children,
  ...buttonProps
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [path, setPath2] = reactExports.useState(
    fileSystemSelectorProps.defaultSelectedPath
  );
  let label = path;
  if (!path) {
    if (!children) {
      if (fileSystemSelectorProps.targetType === "folder") {
        label = t2("Select folder");
      } else if (fileSystemSelectorProps.targetType === "file") {
        label = t2("Select file");
      } else {
        label = t2("Select file system entries");
      }
    } else {
      label = children;
    }
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Button,
    {
      color: "primary",
      size: "sm",
      variant: "light",
      ...buttonProps,
      onPress: () => {
        createPortal(FileSystemSelectorModal, {
          ...fileSystemSelectorProps,
          onSelected: (entry) => {
            setPath2(entry.path);
            if (fileSystemSelectorProps.onSelected) {
              fileSystemSelectorProps.onSelected(entry);
            }
          }
        });
      },
      children: label
    }
  );
};
FileSystemSelectorButton.displayName = "FileSystemSelectorButton";
function _extends() {
  _extends = Object.assign ? Object.assign.bind() : function(target) {
    for (var i2 = 1; i2 < arguments.length; i2++) {
      var source2 = arguments[i2];
      for (var key in source2) {
        if (Object.prototype.hasOwnProperty.call(source2, key)) {
          target[key] = source2[key];
        }
      }
    }
    return target;
  };
  return _extends.apply(this, arguments);
}
function _objectWithoutPropertiesLoose(source2, excluded) {
  if (source2 == null)
    return {};
  var target = {};
  var sourceKeys = Object.keys(source2);
  var key, i2;
  for (i2 = 0; i2 < sourceKeys.length; i2++) {
    key = sourceKeys[i2];
    if (excluded.indexOf(key) >= 0)
      continue;
    target[key] = source2[key];
  }
  return target;
}
var isMenuOpen = function isMenuOpen2(state) {
  return !!state && state[0] === "o";
};
var batchedUpdates = reactDomExports.unstable_batchedUpdates || function(callback2) {
  return callback2();
};
var floatEqual = function floatEqual2(a2, b2, diff2) {
  if (diff2 === void 0) {
    diff2 = 1e-4;
  }
  return Math.abs(a2 - b2) < diff2;
};
var getTransition = function getTransition2(transition3, name2) {
  return transition3 === true || !!(transition3 && transition3[name2]);
};
var safeCall = function safeCall2(fn, arg) {
  return typeof fn === "function" ? fn(arg) : fn;
};
var mergeProps = function mergeProps2(target, source2) {
  source2 && Object.keys(source2).forEach(function(key) {
    var targetProp = target[key];
    var sourceProp = source2[key];
    if (typeof sourceProp === "function" && targetProp) {
      target[key] = function() {
        sourceProp.apply(void 0, arguments);
        targetProp.apply(void 0, arguments);
      };
    } else {
      target[key] = sourceProp;
    }
  });
  return target;
};
var parsePadding = function parsePadding2(paddingStr) {
  if (typeof paddingStr !== "string")
    return {
      top: 0,
      right: 0,
      bottom: 0,
      left: 0
    };
  var padding = paddingStr.trim().split(/\s+/, 4).map(parseFloat);
  var top2 = !isNaN(padding[0]) ? padding[0] : 0;
  var right = !isNaN(padding[1]) ? padding[1] : top2;
  return {
    top: top2,
    right,
    bottom: !isNaN(padding[2]) ? padding[2] : top2,
    left: !isNaN(padding[3]) ? padding[3] : right
  };
};
var getScrollAncestor = function getScrollAncestor2(node2) {
  while (node2) {
    node2 = node2.parentNode;
    if (!node2 || node2 === document.body || !node2.parentNode)
      return;
    var _getComputedStyle = getComputedStyle(node2), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
    if (/auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX))
      return node2;
  }
};
function commonProps(isDisabled, isHovering) {
  return {
    "aria-disabled": isDisabled || void 0,
    tabIndex: isHovering ? 0 : -1
  };
}
function indexOfNode(nodeList, node2) {
  for (var i2 = 0; i2 < nodeList.length; i2++) {
    if (nodeList[i2] === node2)
      return i2;
  }
  return -1;
}
var useBEM = function useBEM2(_ref) {
  var block = _ref.block, element2 = _ref.element, modifiers = _ref.modifiers, className = _ref.className;
  return reactExports.useMemo(function() {
    var blockElement = element2 ? block + "__" + element2 : block;
    var classString = blockElement;
    modifiers && Object.keys(modifiers).forEach(function(name2) {
      var value2 = modifiers[name2];
      if (value2)
        classString += " " + blockElement + "--" + (value2 === true ? name2 : name2 + "-" + value2);
    });
    var expandedClassName = typeof className === "function" ? className(modifiers) : className;
    if (typeof expandedClassName === "string") {
      expandedClassName = expandedClassName.trim();
      if (expandedClassName)
        classString += " " + expandedClassName;
    }
    return classString;
  }, [block, element2, modifiers, className]);
};
var menuContainerClass = "szh-menu-container";
var menuClass = "szh-menu";
var menuArrowClass = "arrow";
var menuItemClass = "item";
var HoverItemContext = /* @__PURE__ */ reactExports.createContext();
var MenuListItemContext = /* @__PURE__ */ reactExports.createContext({});
var MenuListContext = /* @__PURE__ */ reactExports.createContext({});
var EventHandlersContext = /* @__PURE__ */ reactExports.createContext({});
var RadioGroupContext = /* @__PURE__ */ reactExports.createContext({});
var SettingsContext = /* @__PURE__ */ reactExports.createContext({});
var Keys = /* @__PURE__ */ Object.freeze({
  ENTER: "Enter",
  ESC: "Escape",
  SPACE: " ",
  HOME: "Home",
  END: "End",
  LEFT: "ArrowLeft",
  RIGHT: "ArrowRight",
  UP: "ArrowUp",
  DOWN: "ArrowDown"
});
var HoverActionTypes = /* @__PURE__ */ Object.freeze({
  RESET: 0,
  SET: 1,
  UNSET: 2,
  INCREASE: 3,
  DECREASE: 4,
  FIRST: 5,
  LAST: 6,
  SET_INDEX: 7
});
var CloseReason = /* @__PURE__ */ Object.freeze({
  CLICK: "click",
  CANCEL: "cancel",
  BLUR: "blur",
  SCROLL: "scroll"
});
var FocusPositions = /* @__PURE__ */ Object.freeze({
  FIRST: "first",
  LAST: "last"
});
var MenuStateMap = /* @__PURE__ */ Object.freeze({
  entering: "opening",
  entered: "open",
  exiting: "closing",
  exited: "closed"
});
var positionAbsolute = "absolute";
var roleNone = "presentation";
var roleMenuitem = "menuitem";
var dummyItemProps = {
  "aria-hidden": true,
  role: roleMenuitem
};
var MenuContainer = function MenuContainer2(_ref) {
  var className = _ref.className, containerRef = _ref.containerRef, containerProps = _ref.containerProps, children = _ref.children, isOpen = _ref.isOpen, skipOpen = _ref.skipOpen, theming = _ref.theming, transition3 = _ref.transition, onClose = _ref.onClose;
  var itemTransition = getTransition(transition3, "item");
  var onKeyDown = function onKeyDown2(_ref2) {
    var key = _ref2.key;
    switch (key) {
      case Keys.ESC:
        safeCall(onClose, {
          key,
          reason: CloseReason.CANCEL
        });
        break;
    }
  };
  var onBlur = function onBlur2(e2) {
    if (isOpen && !e2.currentTarget.contains(e2.relatedTarget || document.activeElement)) {
      safeCall(onClose, {
        reason: CloseReason.BLUR
      });
      if (skipOpen) {
        skipOpen.current = true;
        setTimeout(function() {
          return skipOpen.current = false;
        }, 300);
      }
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", _extends({}, mergeProps({
    onKeyDown,
    onBlur
  }, containerProps), {
    className: useBEM({
      block: menuContainerClass,
      modifiers: reactExports.useMemo(function() {
        return {
          theme: theming,
          itemTransition
        };
      }, [theming, itemTransition]),
      className
    }),
    style: _extends({
      position: "absolute"
    }, containerProps == null ? void 0 : containerProps.style),
    ref: containerRef,
    children
  }));
};
var createSubmenuCtx = function createSubmenuCtx2() {
  var timer, count = 0;
  return {
    toggle: function toggle2(isOpen) {
      isOpen ? count++ : count--;
      count = Math.max(count, 0);
    },
    on: function on2(closeDelay, pending, settled) {
      if (count) {
        if (!timer)
          timer = setTimeout(function() {
            timer = 0;
            pending();
          }, closeDelay);
      } else {
        settled == null ? void 0 : settled();
      }
    },
    off: function off() {
      if (timer) {
        clearTimeout(timer);
        timer = 0;
      }
    }
  };
};
var useItems = function useItems2(menuRef, focusRef) {
  var _useState = reactExports.useState(), hoverItem = _useState[0], setHoverItem = _useState[1];
  var stateRef = reactExports.useRef({
    items: [],
    hoverIndex: -1,
    sorted: false
  });
  var mutableState = stateRef.current;
  var updateItems = reactExports.useCallback(function(item, isMounted) {
    var items = mutableState.items;
    if (!item) {
      mutableState.items = [];
    } else if (isMounted) {
      items.push(item);
    } else {
      var index2 = items.indexOf(item);
      if (index2 > -1) {
        items.splice(index2, 1);
        if (item.contains(document.activeElement)) {
          focusRef.current.focus();
          setHoverItem();
        }
      }
    }
    mutableState.hoverIndex = -1;
    mutableState.sorted = false;
  }, [mutableState, focusRef]);
  var dispatch = reactExports.useCallback(function(actionType, item, nextIndex) {
    var items = mutableState.items, hoverIndex = mutableState.hoverIndex;
    var sortItems = function sortItems2() {
      if (mutableState.sorted)
        return;
      var orderedNodes = menuRef.current.querySelectorAll(".szh-menu__item");
      items.sort(function(a2, b2) {
        return indexOfNode(orderedNodes, a2) - indexOfNode(orderedNodes, b2);
      });
      mutableState.sorted = true;
    };
    var index2 = -1, newItem = void 0;
    switch (actionType) {
      case HoverActionTypes.RESET:
        break;
      case HoverActionTypes.SET:
        newItem = item;
        break;
      case HoverActionTypes.UNSET:
        newItem = function newItem2(prevItem) {
          return prevItem === item ? void 0 : prevItem;
        };
        break;
      case HoverActionTypes.FIRST:
        sortItems();
        index2 = 0;
        newItem = items[index2];
        break;
      case HoverActionTypes.LAST:
        sortItems();
        index2 = items.length - 1;
        newItem = items[index2];
        break;
      case HoverActionTypes.SET_INDEX:
        sortItems();
        index2 = nextIndex;
        newItem = items[index2];
        break;
      case HoverActionTypes.INCREASE:
        sortItems();
        index2 = hoverIndex;
        if (index2 < 0)
          index2 = items.indexOf(item);
        index2++;
        if (index2 >= items.length)
          index2 = 0;
        newItem = items[index2];
        break;
      case HoverActionTypes.DECREASE:
        sortItems();
        index2 = hoverIndex;
        if (index2 < 0)
          index2 = items.indexOf(item);
        index2--;
        if (index2 < 0)
          index2 = items.length - 1;
        newItem = items[index2];
        break;
    }
    if (!newItem)
      index2 = -1;
    setHoverItem(newItem);
    mutableState.hoverIndex = index2;
  }, [menuRef, mutableState]);
  return {
    hoverItem,
    dispatch,
    updateItems
  };
};
var getPositionHelpers = function getPositionHelpers2(containerRef, menuRef, menuScroll, boundingBoxPadding) {
  var menuRect = menuRef.current.getBoundingClientRect();
  var containerRect = containerRef.current.getBoundingClientRect();
  var boundingRect = menuScroll === window ? {
    left: 0,
    top: 0,
    right: document.documentElement.clientWidth,
    bottom: window.innerHeight
  } : menuScroll.getBoundingClientRect();
  var padding = parsePadding(boundingBoxPadding);
  var getLeftOverflow = function getLeftOverflow2(x2) {
    return x2 + containerRect.left - boundingRect.left - padding.left;
  };
  var getRightOverflow = function getRightOverflow2(x2) {
    return x2 + containerRect.left + menuRect.width - boundingRect.right + padding.right;
  };
  var getTopOverflow = function getTopOverflow2(y2) {
    return y2 + containerRect.top - boundingRect.top - padding.top;
  };
  var getBottomOverflow = function getBottomOverflow2(y2) {
    return y2 + containerRect.top + menuRect.height - boundingRect.bottom + padding.bottom;
  };
  var confineHorizontally = function confineHorizontally2(x2) {
    var leftOverflow = getLeftOverflow(x2);
    if (leftOverflow < 0) {
      x2 -= leftOverflow;
    } else {
      var rightOverflow = getRightOverflow(x2);
      if (rightOverflow > 0) {
        x2 -= rightOverflow;
        leftOverflow = getLeftOverflow(x2);
        if (leftOverflow < 0)
          x2 -= leftOverflow;
      }
    }
    return x2;
  };
  var confineVertically = function confineVertically2(y2) {
    var topOverflow = getTopOverflow(y2);
    if (topOverflow < 0) {
      y2 -= topOverflow;
    } else {
      var bottomOverflow = getBottomOverflow(y2);
      if (bottomOverflow > 0) {
        y2 -= bottomOverflow;
        topOverflow = getTopOverflow(y2);
        if (topOverflow < 0)
          y2 -= topOverflow;
      }
    }
    return y2;
  };
  return {
    menuRect,
    containerRect,
    getLeftOverflow,
    getRightOverflow,
    getTopOverflow,
    getBottomOverflow,
    confineHorizontally,
    confineVertically
  };
};
var placeArrowVertical = function placeArrowVertical2(_ref) {
  var arrowRef = _ref.arrowRef, menuY = _ref.menuY, anchorRect = _ref.anchorRect, containerRect = _ref.containerRect, menuRect = _ref.menuRect;
  var y2 = anchorRect.top - containerRect.top - menuY + anchorRect.height / 2;
  var offset2 = arrowRef.current.offsetHeight * 1.25;
  y2 = Math.max(offset2, y2);
  y2 = Math.min(y2, menuRect.height - offset2);
  return y2;
};
var placeLeftorRight = function placeLeftorRight2(_ref) {
  var anchorRect = _ref.anchorRect, containerRect = _ref.containerRect, menuRect = _ref.menuRect, placeLeftorRightY = _ref.placeLeftorRightY, placeLeftX = _ref.placeLeftX, placeRightX = _ref.placeRightX, getLeftOverflow = _ref.getLeftOverflow, getRightOverflow = _ref.getRightOverflow, confineHorizontally = _ref.confineHorizontally, confineVertically = _ref.confineVertically, arrowRef = _ref.arrowRef, arrow = _ref.arrow, direction = _ref.direction, position2 = _ref.position;
  var computedDirection = direction;
  var y2 = placeLeftorRightY;
  if (position2 !== "initial") {
    y2 = confineVertically(y2);
    if (position2 === "anchor") {
      y2 = Math.min(y2, anchorRect.bottom - containerRect.top);
      y2 = Math.max(y2, anchorRect.top - containerRect.top - menuRect.height);
    }
  }
  var x2, leftOverflow, rightOverflow;
  if (computedDirection === "left") {
    x2 = placeLeftX;
    if (position2 !== "initial") {
      leftOverflow = getLeftOverflow(x2);
      if (leftOverflow < 0) {
        rightOverflow = getRightOverflow(placeRightX);
        if (rightOverflow <= 0 || -leftOverflow > rightOverflow) {
          x2 = placeRightX;
          computedDirection = "right";
        }
      }
    }
  } else {
    x2 = placeRightX;
    if (position2 !== "initial") {
      rightOverflow = getRightOverflow(x2);
      if (rightOverflow > 0) {
        leftOverflow = getLeftOverflow(placeLeftX);
        if (leftOverflow >= 0 || -leftOverflow < rightOverflow) {
          x2 = placeLeftX;
          computedDirection = "left";
        }
      }
    }
  }
  if (position2 === "auto")
    x2 = confineHorizontally(x2);
  var arrowY = arrow ? placeArrowVertical({
    menuY: y2,
    arrowRef,
    anchorRect,
    containerRect,
    menuRect
  }) : void 0;
  return {
    arrowY,
    x: x2,
    y: y2,
    computedDirection
  };
};
var placeArrowHorizontal = function placeArrowHorizontal2(_ref) {
  var arrowRef = _ref.arrowRef, menuX = _ref.menuX, anchorRect = _ref.anchorRect, containerRect = _ref.containerRect, menuRect = _ref.menuRect;
  var x2 = anchorRect.left - containerRect.left - menuX + anchorRect.width / 2;
  var offset2 = arrowRef.current.offsetWidth * 1.25;
  x2 = Math.max(offset2, x2);
  x2 = Math.min(x2, menuRect.width - offset2);
  return x2;
};
var placeToporBottom = function placeToporBottom2(_ref) {
  var anchorRect = _ref.anchorRect, containerRect = _ref.containerRect, menuRect = _ref.menuRect, placeToporBottomX = _ref.placeToporBottomX, placeTopY = _ref.placeTopY, placeBottomY = _ref.placeBottomY, getTopOverflow = _ref.getTopOverflow, getBottomOverflow = _ref.getBottomOverflow, confineHorizontally = _ref.confineHorizontally, confineVertically = _ref.confineVertically, arrowRef = _ref.arrowRef, arrow = _ref.arrow, direction = _ref.direction, position2 = _ref.position;
  var computedDirection = direction === "top" ? "top" : "bottom";
  var x2 = placeToporBottomX;
  if (position2 !== "initial") {
    x2 = confineHorizontally(x2);
    if (position2 === "anchor") {
      x2 = Math.min(x2, anchorRect.right - containerRect.left);
      x2 = Math.max(x2, anchorRect.left - containerRect.left - menuRect.width);
    }
  }
  var y2, topOverflow, bottomOverflow;
  if (computedDirection === "top") {
    y2 = placeTopY;
    if (position2 !== "initial") {
      topOverflow = getTopOverflow(y2);
      if (topOverflow < 0) {
        bottomOverflow = getBottomOverflow(placeBottomY);
        if (bottomOverflow <= 0 || -topOverflow > bottomOverflow) {
          y2 = placeBottomY;
          computedDirection = "bottom";
        }
      }
    }
  } else {
    y2 = placeBottomY;
    if (position2 !== "initial") {
      bottomOverflow = getBottomOverflow(y2);
      if (bottomOverflow > 0) {
        topOverflow = getTopOverflow(placeTopY);
        if (topOverflow >= 0 || -topOverflow < bottomOverflow) {
          y2 = placeTopY;
          computedDirection = "top";
        }
      }
    }
  }
  if (position2 === "auto")
    y2 = confineVertically(y2);
  var arrowX = arrow ? placeArrowHorizontal({
    menuX: x2,
    arrowRef,
    anchorRect,
    containerRect,
    menuRect
  }) : void 0;
  return {
    arrowX,
    x: x2,
    y: y2,
    computedDirection
  };
};
var positionMenu = function positionMenu2(_ref) {
  var arrow = _ref.arrow, align = _ref.align, direction = _ref.direction, offsetX = _ref.offsetX, offsetY = _ref.offsetY, position2 = _ref.position, anchorRect = _ref.anchorRect, arrowRef = _ref.arrowRef, positionHelpers = _ref.positionHelpers;
  var menuRect = positionHelpers.menuRect, containerRect = positionHelpers.containerRect;
  var horizontalOffset = offsetX;
  var verticalOffset = offsetY;
  if (arrow) {
    if (direction === "left" || direction === "right") {
      horizontalOffset += arrowRef.current.offsetWidth;
    } else {
      verticalOffset += arrowRef.current.offsetHeight;
    }
  }
  var placeLeftX = anchorRect.left - containerRect.left - menuRect.width - horizontalOffset;
  var placeRightX = anchorRect.right - containerRect.left + horizontalOffset;
  var placeTopY = anchorRect.top - containerRect.top - menuRect.height - verticalOffset;
  var placeBottomY = anchorRect.bottom - containerRect.top + verticalOffset;
  var placeToporBottomX, placeLeftorRightY;
  if (align === "end") {
    placeToporBottomX = anchorRect.right - containerRect.left - menuRect.width;
    placeLeftorRightY = anchorRect.bottom - containerRect.top - menuRect.height;
  } else if (align === "center") {
    placeToporBottomX = anchorRect.left - containerRect.left - (menuRect.width - anchorRect.width) / 2;
    placeLeftorRightY = anchorRect.top - containerRect.top - (menuRect.height - anchorRect.height) / 2;
  } else {
    placeToporBottomX = anchorRect.left - containerRect.left;
    placeLeftorRightY = anchorRect.top - containerRect.top;
  }
  placeToporBottomX += horizontalOffset;
  placeLeftorRightY += verticalOffset;
  var options = _extends({}, positionHelpers, {
    anchorRect,
    placeLeftX,
    placeRightX,
    placeLeftorRightY,
    placeTopY,
    placeBottomY,
    placeToporBottomX,
    arrowRef,
    arrow,
    direction,
    position: position2
  });
  switch (direction) {
    case "left":
    case "right":
      return placeLeftorRight(options);
    case "top":
    case "bottom":
    default:
      return placeToporBottom(options);
  }
};
var useIsomorphicLayoutEffect$1 = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined" ? reactExports.useLayoutEffect : reactExports.useEffect;
function setRef(ref, instance2) {
  typeof ref === "function" ? ref(instance2) : ref.current = instance2;
}
var useCombinedRef = function useCombinedRef2(refA, refB) {
  return reactExports.useMemo(function() {
    if (!refA)
      return refB;
    if (!refB)
      return refA;
    return function(instance2) {
      setRef(refA, instance2);
      setRef(refB, instance2);
    };
  }, [refA, refB]);
};
var _excluded$2 = ["ariaLabel", "menuClassName", "menuStyle", "arrowClassName", "arrowStyle", "anchorPoint", "anchorRef", "containerRef", "containerProps", "focusProps", "externalRef", "parentScrollingRef", "arrow", "align", "direction", "position", "overflow", "setDownOverflow", "repositionFlag", "captureFocus", "state", "endTransition", "isDisabled", "menuItemFocus", "offsetX", "offsetY", "children", "onClose"];
var MenuList = function MenuList2(_ref) {
  var ariaLabel = _ref.ariaLabel, menuClassName = _ref.menuClassName, menuStyle = _ref.menuStyle, arrowClassName = _ref.arrowClassName, arrowStyle = _ref.arrowStyle, anchorPoint = _ref.anchorPoint, anchorRef = _ref.anchorRef, containerRef = _ref.containerRef, containerProps = _ref.containerProps, focusProps = _ref.focusProps, externalRef = _ref.externalRef, parentScrollingRef = _ref.parentScrollingRef, arrow = _ref.arrow, _ref$align = _ref.align, align = _ref$align === void 0 ? "start" : _ref$align, _ref$direction = _ref.direction, direction = _ref$direction === void 0 ? "bottom" : _ref$direction, _ref$position = _ref.position, position2 = _ref$position === void 0 ? "auto" : _ref$position, _ref$overflow = _ref.overflow, overflow = _ref$overflow === void 0 ? "visible" : _ref$overflow, setDownOverflow = _ref.setDownOverflow, repositionFlag = _ref.repositionFlag, _ref$captureFocus = _ref.captureFocus, captureFocus = _ref$captureFocus === void 0 ? true : _ref$captureFocus, state = _ref.state, endTransition = _ref.endTransition, isDisabled = _ref.isDisabled, menuItemFocus = _ref.menuItemFocus, _ref$offsetX = _ref.offsetX, offsetX = _ref$offsetX === void 0 ? 0 : _ref$offsetX, _ref$offsetY = _ref.offsetY, offsetY = _ref$offsetY === void 0 ? 0 : _ref$offsetY, children = _ref.children, onClose = _ref.onClose, restProps = _objectWithoutPropertiesLoose(_ref, _excluded$2);
  var _useState = reactExports.useState({
    x: 0,
    y: 0
  }), menuPosition = _useState[0], setMenuPosition = _useState[1];
  var _useState2 = reactExports.useState({}), arrowPosition = _useState2[0], setArrowPosition = _useState2[1];
  var _useState3 = reactExports.useState(), overflowData = _useState3[0], setOverflowData = _useState3[1];
  var _useState4 = reactExports.useState(direction), expandedDirection = _useState4[0], setExpandedDirection = _useState4[1];
  var _useState5 = reactExports.useState(createSubmenuCtx), submenuCtx = _useState5[0];
  var _useReducer = reactExports.useReducer(function(c2) {
    return c2 + 1;
  }, 1), reposSubmenu = _useReducer[0], forceReposSubmenu = _useReducer[1];
  var _useContext = reactExports.useContext(SettingsContext), transition3 = _useContext.transition, boundingBoxRef = _useContext.boundingBoxRef, boundingBoxPadding = _useContext.boundingBoxPadding, rootMenuRef = _useContext.rootMenuRef, rootAnchorRef = _useContext.rootAnchorRef, scrollNodesRef = _useContext.scrollNodesRef, reposition = _useContext.reposition, viewScroll = _useContext.viewScroll, submenuCloseDelay = _useContext.submenuCloseDelay;
  var _useContext2 = reactExports.useContext(MenuListContext), parentSubmenuCtx = _useContext2.submenuCtx, _useContext2$reposSub = _useContext2.reposSubmenu, reposFlag = _useContext2$reposSub === void 0 ? repositionFlag : _useContext2$reposSub;
  var menuRef = reactExports.useRef(null);
  var focusRef = reactExports.useRef();
  var arrowRef = reactExports.useRef();
  var prevOpen = reactExports.useRef(false);
  var latestMenuSize = reactExports.useRef({
    width: 0,
    height: 0
  });
  var latestHandlePosition = reactExports.useRef(function() {
  });
  var _useItems = useItems(menuRef, focusRef), hoverItem = _useItems.hoverItem, dispatch = _useItems.dispatch, updateItems = _useItems.updateItems;
  var isOpen = isMenuOpen(state);
  var openTransition = getTransition(transition3, "open");
  var closeTransition = getTransition(transition3, "close");
  var scrollNodes = scrollNodesRef.current;
  var onKeyDown = function onKeyDown2(e2) {
    switch (e2.key) {
      case Keys.HOME:
        dispatch(HoverActionTypes.FIRST);
        break;
      case Keys.END:
        dispatch(HoverActionTypes.LAST);
        break;
      case Keys.UP:
        dispatch(HoverActionTypes.DECREASE, hoverItem);
        break;
      case Keys.DOWN:
        dispatch(HoverActionTypes.INCREASE, hoverItem);
        break;
      case Keys.SPACE:
        if (e2.target && e2.target.className.indexOf(menuClass) !== -1) {
          e2.preventDefault();
        }
        return;
      default:
        return;
    }
    e2.preventDefault();
    e2.stopPropagation();
  };
  var onAnimationEnd = function onAnimationEnd2() {
    if (state === "closing") {
      setOverflowData();
    }
    safeCall(endTransition);
  };
  var onPointerMove = function onPointerMove2(e2) {
    e2.stopPropagation();
    submenuCtx.on(submenuCloseDelay, function() {
      dispatch(HoverActionTypes.RESET);
      focusRef.current.focus();
    });
  };
  var onPointerLeave = function onPointerLeave2(e2) {
    if (e2.target === e2.currentTarget)
      submenuCtx.off();
  };
  var handlePosition = reactExports.useCallback(function(noOverflowCheck) {
    var _anchorRef$current;
    var anchorRect = anchorRef ? (_anchorRef$current = anchorRef.current) == null ? void 0 : _anchorRef$current.getBoundingClientRect() : anchorPoint ? {
      left: anchorPoint.x,
      right: anchorPoint.x,
      top: anchorPoint.y,
      bottom: anchorPoint.y,
      width: 0,
      height: 0
    } : null;
    if (!anchorRect) {
      return;
    }
    if (!scrollNodes.menu) {
      scrollNodes.menu = (boundingBoxRef ? boundingBoxRef.current : getScrollAncestor(rootMenuRef.current)) || window;
    }
    var positionHelpers = getPositionHelpers(containerRef, menuRef, scrollNodes.menu, boundingBoxPadding);
    var _positionMenu = positionMenu({
      arrow,
      align,
      direction,
      offsetX,
      offsetY,
      position: position2,
      anchorRect,
      arrowRef,
      positionHelpers
    }), arrowX = _positionMenu.arrowX, arrowY = _positionMenu.arrowY, x2 = _positionMenu.x, y2 = _positionMenu.y, computedDirection = _positionMenu.computedDirection;
    var menuRect = positionHelpers.menuRect;
    var menuHeight = menuRect.height;
    if (!noOverflowCheck && overflow !== "visible") {
      var getTopOverflow = positionHelpers.getTopOverflow, getBottomOverflow = positionHelpers.getBottomOverflow;
      var height, _overflowAmt;
      var prevHeight = latestMenuSize.current.height;
      var bottomOverflow = getBottomOverflow(y2);
      if (bottomOverflow > 0 || floatEqual(bottomOverflow, 0) && floatEqual(menuHeight, prevHeight)) {
        height = menuHeight - bottomOverflow;
        _overflowAmt = bottomOverflow;
      } else {
        var topOverflow = getTopOverflow(y2);
        if (topOverflow < 0 || floatEqual(topOverflow, 0) && floatEqual(menuHeight, prevHeight)) {
          height = menuHeight + topOverflow;
          _overflowAmt = 0 - topOverflow;
          if (height >= 0)
            y2 -= topOverflow;
        }
      }
      if (height >= 0) {
        menuHeight = height;
        setOverflowData({
          height,
          overflowAmt: _overflowAmt
        });
      } else {
        setOverflowData();
      }
    }
    if (arrow)
      setArrowPosition({
        x: arrowX,
        y: arrowY
      });
    setMenuPosition({
      x: x2,
      y: y2
    });
    setExpandedDirection(computedDirection);
    latestMenuSize.current = {
      width: menuRect.width,
      height: menuHeight
    };
  }, [arrow, align, boundingBoxPadding, direction, offsetX, offsetY, position2, overflow, anchorPoint, anchorRef, containerRef, boundingBoxRef, rootMenuRef, scrollNodes]);
  useIsomorphicLayoutEffect$1(function() {
    if (isOpen) {
      handlePosition();
      if (prevOpen.current)
        forceReposSubmenu();
    }
    prevOpen.current = isOpen;
    latestHandlePosition.current = handlePosition;
  }, [isOpen, handlePosition, reposFlag]);
  useIsomorphicLayoutEffect$1(function() {
    if (overflowData && !setDownOverflow)
      menuRef.current.scrollTop = 0;
  }, [overflowData, setDownOverflow]);
  useIsomorphicLayoutEffect$1(function() {
    return updateItems;
  }, [updateItems]);
  reactExports.useEffect(function() {
    var menuScroll = scrollNodes.menu;
    if (!isOpen || !menuScroll)
      return;
    menuScroll = menuScroll.addEventListener ? menuScroll : window;
    if (!scrollNodes.anchors) {
      scrollNodes.anchors = [];
      var anchorScroll = getScrollAncestor(rootAnchorRef && rootAnchorRef.current);
      while (anchorScroll && anchorScroll !== menuScroll) {
        scrollNodes.anchors.push(anchorScroll);
        anchorScroll = getScrollAncestor(anchorScroll);
      }
    }
    var scroll = viewScroll;
    if (scrollNodes.anchors.length && scroll === "initial")
      scroll = "auto";
    if (scroll === "initial")
      return;
    var handleScroll = function handleScroll2() {
      if (scroll === "auto") {
        batchedUpdates(function() {
          return handlePosition(true);
        });
      } else {
        safeCall(onClose, {
          reason: CloseReason.SCROLL
        });
      }
    };
    var scrollObservers = scrollNodes.anchors.concat(viewScroll !== "initial" ? menuScroll : []);
    scrollObservers.forEach(function(o2) {
      return o2.addEventListener("scroll", handleScroll);
    });
    return function() {
      return scrollObservers.forEach(function(o2) {
        return o2.removeEventListener("scroll", handleScroll);
      });
    };
  }, [rootAnchorRef, scrollNodes, isOpen, onClose, viewScroll, handlePosition]);
  var hasOverflow = !!overflowData && overflowData.overflowAmt > 0;
  reactExports.useEffect(function() {
    if (hasOverflow || !isOpen || !parentScrollingRef)
      return;
    var handleScroll = function handleScroll2() {
      return batchedUpdates(handlePosition);
    };
    var parentScroll = parentScrollingRef.current;
    parentScroll.addEventListener("scroll", handleScroll);
    return function() {
      return parentScroll.removeEventListener("scroll", handleScroll);
    };
  }, [isOpen, hasOverflow, parentScrollingRef, handlePosition]);
  reactExports.useEffect(function() {
    if (typeof ResizeObserver !== "function" || reposition === "initial")
      return;
    var resizeObserver2 = new ResizeObserver(function(_ref2) {
      var entry = _ref2[0];
      var borderBoxSize = entry.borderBoxSize, target = entry.target;
      var width, height;
      if (borderBoxSize) {
        var _ref3 = borderBoxSize[0] || borderBoxSize, inlineSize = _ref3.inlineSize, blockSize = _ref3.blockSize;
        width = inlineSize;
        height = blockSize;
      } else {
        var borderRect = target.getBoundingClientRect();
        width = borderRect.width;
        height = borderRect.height;
      }
      if (width === 0 || height === 0)
        return;
      if (floatEqual(width, latestMenuSize.current.width, 1) && floatEqual(height, latestMenuSize.current.height, 1))
        return;
      reactDomExports.flushSync(function() {
        latestHandlePosition.current();
        forceReposSubmenu();
      });
    });
    var observeTarget = menuRef.current;
    resizeObserver2.observe(observeTarget, {
      box: "border-box"
    });
    return function() {
      return resizeObserver2.unobserve(observeTarget);
    };
  }, [reposition]);
  reactExports.useEffect(function() {
    if (!isOpen) {
      dispatch(HoverActionTypes.RESET);
      if (!closeTransition)
        setOverflowData();
      return;
    }
    var _ref4 = menuItemFocus || {}, position22 = _ref4.position, alwaysUpdate = _ref4.alwaysUpdate;
    var setItemFocus = function setItemFocus2() {
      if (position22 === FocusPositions.FIRST) {
        dispatch(HoverActionTypes.FIRST);
      } else if (position22 === FocusPositions.LAST) {
        dispatch(HoverActionTypes.LAST);
      } else if (position22 >= -1) {
        dispatch(HoverActionTypes.SET_INDEX, void 0, position22);
      }
    };
    if (alwaysUpdate) {
      setItemFocus();
    } else if (captureFocus) {
      var id2 = setTimeout(function() {
        if (!menuRef.current.contains(document.activeElement)) {
          focusRef.current.focus();
          setItemFocus();
        }
      }, openTransition ? 170 : 100);
      return function() {
        return clearTimeout(id2);
      };
    }
  }, [isOpen, openTransition, closeTransition, captureFocus, menuItemFocus, dispatch]);
  var itemContext = reactExports.useMemo(function() {
    return {
      isParentOpen: isOpen,
      submenuCtx,
      dispatch,
      updateItems
    };
  }, [isOpen, submenuCtx, dispatch, updateItems]);
  var maxHeight, overflowAmt;
  if (overflowData) {
    setDownOverflow ? overflowAmt = overflowData.overflowAmt : maxHeight = overflowData.height;
  }
  var listContext = reactExports.useMemo(function() {
    return {
      reposSubmenu,
      submenuCtx,
      overflow,
      overflowAmt,
      parentMenuRef: menuRef,
      parentDir: expandedDirection
    };
  }, [reposSubmenu, submenuCtx, overflow, overflowAmt, expandedDirection]);
  var overflowStyle = maxHeight >= 0 ? {
    maxHeight,
    overflow
  } : void 0;
  var modifiers = reactExports.useMemo(function() {
    return {
      state,
      dir: expandedDirection
    };
  }, [state, expandedDirection]);
  var arrowModifiers = reactExports.useMemo(function() {
    return {
      dir: expandedDirection
    };
  }, [expandedDirection]);
  var _arrowClass = useBEM({
    block: menuClass,
    element: menuArrowClass,
    modifiers: arrowModifiers,
    className: arrowClassName
  });
  var menu2 = /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", _extends({
    role: "menu",
    "aria-label": ariaLabel
  }, commonProps(isDisabled), mergeProps({
    onPointerEnter: parentSubmenuCtx == null ? void 0 : parentSubmenuCtx.off,
    onPointerMove,
    onPointerLeave,
    onKeyDown,
    onAnimationEnd
  }, restProps), {
    ref: useCombinedRef(externalRef, menuRef),
    className: useBEM({
      block: menuClass,
      modifiers,
      className: menuClassName
    }),
    style: _extends({}, menuStyle, overflowStyle, {
      margin: 0,
      display: state === "closed" ? "none" : void 0,
      position: positionAbsolute,
      left: menuPosition.x,
      top: menuPosition.y
    }),
    children: [/* @__PURE__ */ jsxRuntimeExports.jsx("li", _extends({
      tabIndex: -1,
      style: {
        position: positionAbsolute,
        left: 0,
        top: 0,
        display: "block",
        outline: "none"
      },
      ref: focusRef
    }, dummyItemProps, focusProps)), arrow && /* @__PURE__ */ jsxRuntimeExports.jsx("li", _extends({
      className: _arrowClass,
      style: _extends({
        display: "block",
        position: positionAbsolute,
        left: arrowPosition.x,
        top: arrowPosition.y
      }, arrowStyle),
      ref: arrowRef
    }, dummyItemProps)), /* @__PURE__ */ jsxRuntimeExports.jsx(MenuListContext.Provider, {
      value: listContext,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(MenuListItemContext.Provider, {
        value: itemContext,
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(HoverItemContext.Provider, {
          value: hoverItem,
          children: safeCall(children, modifiers)
        })
      })
    })]
  }));
  return containerProps ? /* @__PURE__ */ jsxRuntimeExports.jsx(MenuContainer, _extends({}, containerProps, {
    isOpen,
    children: menu2
  })) : menu2;
};
var _excluded$1 = ["aria-label", "className", "containerProps", "initialMounted", "unmountOnClose", "transition", "transitionTimeout", "boundingBoxRef", "boundingBoxPadding", "reposition", "submenuOpenDelay", "submenuCloseDelay", "skipOpen", "viewScroll", "portal", "theming", "onItemClick"];
var ControlledMenu = /* @__PURE__ */ reactExports.forwardRef(function ControlledMenu2(_ref, externalRef) {
  var ariaLabel = _ref["aria-label"], className = _ref.className, containerProps = _ref.containerProps, initialMounted = _ref.initialMounted, unmountOnClose = _ref.unmountOnClose, transition3 = _ref.transition, transitionTimeout = _ref.transitionTimeout, boundingBoxRef = _ref.boundingBoxRef, boundingBoxPadding = _ref.boundingBoxPadding, _ref$reposition = _ref.reposition, reposition = _ref$reposition === void 0 ? "auto" : _ref$reposition, _ref$submenuOpenDelay = _ref.submenuOpenDelay, submenuOpenDelay = _ref$submenuOpenDelay === void 0 ? 300 : _ref$submenuOpenDelay, _ref$submenuCloseDela = _ref.submenuCloseDelay, submenuCloseDelay = _ref$submenuCloseDela === void 0 ? 150 : _ref$submenuCloseDela, skipOpen = _ref.skipOpen, _ref$viewScroll = _ref.viewScroll, viewScroll = _ref$viewScroll === void 0 ? "initial" : _ref$viewScroll, portal = _ref.portal, theming = _ref.theming, onItemClick = _ref.onItemClick, restProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
  var containerRef = reactExports.useRef(null);
  var scrollNodesRef = reactExports.useRef({});
  var anchorRef = restProps.anchorRef, state = restProps.state, onClose = restProps.onClose;
  var settings = reactExports.useMemo(function() {
    return {
      initialMounted,
      unmountOnClose,
      transition: transition3,
      transitionTimeout,
      boundingBoxRef,
      boundingBoxPadding,
      rootMenuRef: containerRef,
      rootAnchorRef: anchorRef,
      scrollNodesRef,
      reposition,
      viewScroll,
      submenuOpenDelay,
      submenuCloseDelay
    };
  }, [initialMounted, unmountOnClose, transition3, transitionTimeout, anchorRef, boundingBoxRef, boundingBoxPadding, reposition, viewScroll, submenuOpenDelay, submenuCloseDelay]);
  var eventHandlers = reactExports.useMemo(function() {
    return {
      handleClick: function handleClick(event, isCheckorRadio) {
        if (!event.stopPropagation)
          safeCall(onItemClick, event);
        var keepOpen = event.keepOpen;
        if (keepOpen === void 0) {
          keepOpen = isCheckorRadio && event.key === Keys.SPACE;
        }
        if (!keepOpen) {
          safeCall(onClose, {
            value: event.value,
            key: event.key,
            reason: CloseReason.CLICK
          });
        }
      },
      handleClose: function handleClose(key) {
        safeCall(onClose, {
          key,
          reason: CloseReason.CLICK
        });
      }
    };
  }, [onItemClick, onClose]);
  if (!state)
    return null;
  var menuList = /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsContext.Provider, {
    value: settings,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx(EventHandlersContext.Provider, {
      value: eventHandlers,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(MenuList, _extends({}, restProps, {
        ariaLabel: ariaLabel || "Menu",
        externalRef,
        containerRef,
        containerProps: {
          className,
          containerRef,
          containerProps,
          skipOpen,
          theming,
          transition: transition3,
          onClose
        }
      }))
    })
  });
  if (portal === true && typeof document !== "undefined") {
    return /* @__PURE__ */ reactDomExports.createPortal(menuList, document.body);
  } else if (portal) {
    return portal.target ? /* @__PURE__ */ reactDomExports.createPortal(menuList, portal.target) : portal.stablePosition ? null : menuList;
  }
  return menuList;
});
var PRE_ENTER = 0;
var ENTERING = 1;
var ENTERED = 2;
var PRE_EXIT = 3;
var EXITING = 4;
var EXITED = 5;
var UNMOUNTED = 6;
var STATES = ["preEnter", "entering", "entered", "preExit", "exiting", "exited", "unmounted"];
var startOrEnd = function startOrEnd2(unmounted) {
  return unmounted ? UNMOUNTED : EXITED;
};
var updateState = function updateState2(state, setState, latestState, timeoutId, onChange) {
  clearTimeout(timeoutId.current);
  setState(state);
  latestState.current = state;
  onChange && onChange({
    state: STATES[state]
  });
};
var useTransition = function useTransition2(_temp) {
  var _ref = _temp === void 0 ? {} : _temp, _ref$enter = _ref.enter, enter = _ref$enter === void 0 ? true : _ref$enter, _ref$exit = _ref.exit, exit2 = _ref$exit === void 0 ? true : _ref$exit, preEnter = _ref.preEnter, preExit = _ref.preExit, timeout = _ref.timeout, initialEntered = _ref.initialEntered, mountOnEnter = _ref.mountOnEnter, unmountOnExit = _ref.unmountOnExit, onChange = _ref.onChange;
  var _useState = reactExports.useState(initialEntered ? ENTERED : startOrEnd(mountOnEnter)), state = _useState[0], setState = _useState[1];
  var latestState = reactExports.useRef(state);
  var timeoutId = reactExports.useRef();
  var enterTimeout, exitTimeout;
  if (typeof timeout === "object") {
    enterTimeout = timeout.enter;
    exitTimeout = timeout.exit;
  } else {
    enterTimeout = exitTimeout = timeout;
  }
  var endTransition = reactExports.useCallback(function() {
    var newState;
    switch (latestState.current) {
      case ENTERING:
      case PRE_ENTER:
        newState = ENTERED;
        break;
      case EXITING:
      case PRE_EXIT:
        newState = startOrEnd(unmountOnExit);
        break;
    }
    if (newState !== void 0) {
      updateState(newState, setState, latestState, timeoutId, onChange);
    }
  }, [onChange, unmountOnExit]);
  var toggle2 = reactExports.useCallback(function(toEnter) {
    var transitState = function transitState2(newState) {
      updateState(newState, setState, latestState, timeoutId, onChange);
      switch (newState) {
        case ENTERING:
          if (enterTimeout >= 0)
            timeoutId.current = setTimeout(endTransition, enterTimeout);
          break;
        case EXITING:
          if (exitTimeout >= 0)
            timeoutId.current = setTimeout(endTransition, exitTimeout);
          break;
        case PRE_ENTER:
        case PRE_EXIT:
          timeoutId.current = setTimeout(function() {
            return transitState2(newState + 1);
          }, 0);
          break;
      }
    };
    var enterStage = latestState.current <= ENTERED;
    if (typeof toEnter !== "boolean")
      toEnter = !enterStage;
    if (toEnter) {
      if (!enterStage) {
        transitState(enter ? preEnter ? PRE_ENTER : ENTERING : ENTERED);
      }
    } else {
      if (enterStage) {
        transitState(exit2 ? preExit ? PRE_EXIT : EXITING : startOrEnd(unmountOnExit));
      }
    }
  }, [endTransition, onChange, enter, exit2, preEnter, preExit, enterTimeout, exitTimeout, unmountOnExit]);
  reactExports.useEffect(function() {
    return function() {
      return clearTimeout(timeoutId.current);
    };
  }, []);
  return [STATES[state], toggle2, endTransition];
};
var useMenuState = function useMenuState2(_temp) {
  var _ref = {}, initialOpen = _ref.initialOpen, initialMounted = _ref.initialMounted, unmountOnClose = _ref.unmountOnClose, transition3 = _ref.transition, _ref$transitionTimeou = _ref.transitionTimeout, transitionTimeout = _ref$transitionTimeou === void 0 ? 500 : _ref$transitionTimeou;
  var _useTransition = useTransition({
    initialEntered: initialOpen,
    mountOnEnter: !initialMounted,
    unmountOnExit: unmountOnClose,
    timeout: transitionTimeout,
    enter: getTransition(transition3, "open"),
    exit: getTransition(transition3, "close")
  }), state = _useTransition[0], toggleMenu = _useTransition[1], endTransition = _useTransition[2];
  return [{
    state: MenuStateMap[state],
    endTransition
  }, toggleMenu];
};
var withHovering = function withHovering2(name2, WrappedComponent) {
  var Component2 = /* @__PURE__ */ reactExports.memo(WrappedComponent);
  var WithHovering = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
    var itemRef = reactExports.useRef(null);
    return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, _extends({}, props, {
      itemRef,
      externalRef: ref,
      isHovering: reactExports.useContext(HoverItemContext) === itemRef.current
    }));
  });
  WithHovering.displayName = "WithHovering(" + name2 + ")";
  return WithHovering;
};
var useItemEffect = function useItemEffect2(isDisabled, itemRef, updateItems) {
  useIsomorphicLayoutEffect$1(function() {
    if (isDisabled)
      return;
    var item = itemRef.current;
    updateItems(item, true);
    return function() {
      updateItems(item);
    };
  }, [isDisabled, itemRef, updateItems]);
};
var useItemState = function useItemState2(itemRef, focusRef, isHovering, isDisabled) {
  var _useContext = reactExports.useContext(SettingsContext), submenuCloseDelay = _useContext.submenuCloseDelay;
  var _useContext2 = reactExports.useContext(MenuListItemContext), isParentOpen = _useContext2.isParentOpen, submenuCtx = _useContext2.submenuCtx, dispatch = _useContext2.dispatch, updateItems = _useContext2.updateItems;
  var setHover = function setHover2() {
    !isHovering && !isDisabled && dispatch(HoverActionTypes.SET, itemRef.current);
  };
  var unsetHover = function unsetHover2() {
    !isDisabled && dispatch(HoverActionTypes.UNSET, itemRef.current);
  };
  var onBlur = function onBlur2(e2) {
    if (isHovering && !e2.currentTarget.contains(e2.relatedTarget))
      unsetHover();
  };
  var onPointerMove = function onPointerMove2(e2) {
    if (!isDisabled) {
      e2.stopPropagation();
      submenuCtx.on(submenuCloseDelay, setHover, setHover);
    }
  };
  var onPointerLeave = function onPointerLeave2(_24, keepHover) {
    submenuCtx.off();
    !keepHover && unsetHover();
  };
  useItemEffect(isDisabled, itemRef, updateItems);
  reactExports.useEffect(function() {
    if (isHovering && isParentOpen) {
      focusRef.current && focusRef.current.focus();
    }
  }, [focusRef, isHovering, isParentOpen]);
  return {
    setHover,
    onBlur,
    onPointerMove,
    onPointerLeave
  };
};
var _excluded = ["className", "value", "href", "type", "checked", "disabled", "children", "onClick", "isHovering", "itemRef", "externalRef"], _excluded2 = ["setHover"];
var MenuItem = /* @__PURE__ */ withHovering("MenuItem", function MenuItem2(_ref) {
  var className = _ref.className, value2 = _ref.value, href = _ref.href, type4 = _ref.type, checked = _ref.checked, disabled = _ref.disabled, children = _ref.children, onClick = _ref.onClick, isHovering = _ref.isHovering, itemRef = _ref.itemRef, externalRef = _ref.externalRef, restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
  var isDisabled = !!disabled;
  var _useItemState = useItemState(itemRef, itemRef, isHovering, isDisabled), setHover = _useItemState.setHover, restStateProps = _objectWithoutPropertiesLoose(_useItemState, _excluded2);
  var eventHandlers = reactExports.useContext(EventHandlersContext);
  var radioGroup2 = reactExports.useContext(RadioGroupContext);
  var isRadio = type4 === "radio";
  var isCheckBox = type4 === "checkbox";
  var isAnchor = !!href && !isDisabled && !isRadio && !isCheckBox;
  var isChecked = isRadio ? radioGroup2.value === value2 : isCheckBox ? !!checked : false;
  var handleClick = function handleClick2(e2) {
    if (isDisabled) {
      e2.stopPropagation();
      e2.preventDefault();
      return;
    }
    var event = {
      value: value2,
      syntheticEvent: e2
    };
    if (e2.key !== void 0)
      event.key = e2.key;
    if (isCheckBox)
      event.checked = !isChecked;
    if (isRadio)
      event.name = radioGroup2.name;
    safeCall(onClick, event);
    if (isRadio)
      safeCall(radioGroup2.onRadioChange, event);
    eventHandlers.handleClick(event, isCheckBox || isRadio);
  };
  var handleKeyDown = function handleKeyDown2(e2) {
    if (!isHovering)
      return;
    switch (e2.key) {
      case Keys.ENTER:
      case Keys.SPACE:
        isAnchor ? e2.key === Keys.SPACE && itemRef.current.click() : handleClick(e2);
    }
  };
  var modifiers = reactExports.useMemo(function() {
    return {
      type: type4,
      disabled: isDisabled,
      hover: isHovering,
      checked: isChecked,
      anchor: isAnchor
    };
  }, [type4, isDisabled, isHovering, isChecked, isAnchor]);
  var mergedProps = mergeProps(_extends({}, restStateProps, {
    onPointerDown: setHover,
    onKeyDown: handleKeyDown,
    onClick: handleClick
  }), restProps);
  var menuItemProps = _extends({
    role: isRadio ? "menuitemradio" : isCheckBox ? "menuitemcheckbox" : roleMenuitem,
    "aria-checked": isRadio || isCheckBox ? isChecked : void 0
  }, commonProps(isDisabled, isHovering), mergedProps, {
    ref: useCombinedRef(externalRef, itemRef),
    className: useBEM({
      block: menuClass,
      element: menuItemClass,
      modifiers,
      className
    }),
    children: reactExports.useMemo(function() {
      return safeCall(children, modifiers);
    }, [children, modifiers])
  });
  return isAnchor ? /* @__PURE__ */ jsxRuntimeExports.jsx("li", {
    role: roleNone,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", _extends({
      href
    }, menuItemProps))
  }) : /* @__PURE__ */ jsxRuntimeExports.jsx("li", _extends({}, menuItemProps));
});
var SelectionMode$1 = /* @__PURE__ */ ((SelectionMode2) => {
  SelectionMode2[SelectionMode2["Normal"] = 1] = "Normal";
  SelectionMode2[SelectionMode2["Ctrl"] = 2] = "Ctrl";
  SelectionMode2[SelectionMode2["Shift"] = 3] = "Shift";
  return SelectionMode2;
})(SelectionMode$1 || {});
const EventListener = (props) => {
  const { t: t2 } = useTranslation();
  const propsRef = reactExports.useRef(props);
  const selectionModeRef = reactExports.useRef(
    1
    /* Normal */
  );
  const shiftHoldingRef = reactExports.useRef(false);
  reactExports.useEffect(() => {
    if (typeof window === "undefined") {
      return;
    }
    window.addEventListener("keydown", onKeyDown);
    window.addEventListener("keyup", onKeyUp);
    window.addEventListener("click", onClick);
    return () => {
      window.removeEventListener("keydown", onKeyDown);
      window.removeEventListener("keyup", onKeyUp);
      window.removeEventListener("click", onClick);
    };
  }, []);
  const changeSelectionMode = (mode) => {
    if (selectionModeRef.current != mode) {
      selectionModeRef.current = mode;
      propsRef.current.onSelectionModeChange(mode);
    }
  };
  const onClick = reactExports.useCallback((evt) => {
    var _a2, _b2;
    console.log(1);
    (_b2 = (_a2 = propsRef.current).onClick) == null ? void 0 : _b2.call(_a2, evt);
  }, []);
  const onKeyDown = reactExports.useCallback((e2) => {
    var _a2, _b2, _c2, _d;
    switch (e2.key) {
      case "Control":
        changeSelectionMode(
          2
          /* Ctrl */
        );
        break;
      case "Shift":
        changeSelectionMode(
          3
          /* Shift */
        );
        shiftHoldingRef.current = true;
        break;
      case "Delete":
        (_b2 = (_a2 = propsRef.current).onDelete) == null ? void 0 : _b2.call(_a2);
        break;
      default:
        (_d = (_c2 = propsRef.current).onKeyDown) == null ? void 0 : _d.call(_c2, e2.key, e2);
        break;
    }
  }, []);
  const onKeyUp = reactExports.useCallback((e2) => {
    switch (e2.key) {
      case "Control":
        changeSelectionMode(
          1
          /* Normal */
        );
        break;
      case "Shift":
        changeSelectionMode(
          1
          /* Normal */
        );
        shiftHoldingRef.current = false;
        break;
    }
  }, []);
  return null;
};
EventListener.displayName = "EventListener";
function n$2(n2) {
  for (var r2 = arguments.length, t2 = Array(r2 > 1 ? r2 - 1 : 0), e2 = 1; e2 < r2; e2++)
    t2[e2 - 1] = arguments[e2];
  throw Error("[Immer] minified error nr: " + n2 + (t2.length ? " " + t2.map(function(n3) {
    return "'" + n3 + "'";
  }).join(",") : "") + ". Find the full error at: https://bit.ly/3cXEKWf");
}
function r$1(n2) {
  return !!n2 && !!n2[Q$2];
}
function t$3(n2) {
  var r2;
  return !!n2 && (function(n3) {
    if (!n3 || "object" != typeof n3)
      return false;
    var r3 = Object.getPrototypeOf(n3);
    if (null === r3)
      return true;
    var t2 = Object.hasOwnProperty.call(r3, "constructor") && r3.constructor;
    return t2 === Object || "function" == typeof t2 && Function.toString.call(t2) === Z$2;
  }(n2) || Array.isArray(n2) || !!n2[L$2] || !!(null === (r2 = n2.constructor) || void 0 === r2 ? void 0 : r2[L$2]) || s$2(n2) || v$1(n2));
}
function i$1(n2, r2, t2) {
  void 0 === t2 && (t2 = false), 0 === o$1(n2) ? (t2 ? Object.keys : nn)(n2).forEach(function(e2) {
    t2 && "symbol" == typeof e2 || r2(e2, n2[e2], n2);
  }) : n2.forEach(function(t3, e2) {
    return r2(e2, t3, n2);
  });
}
function o$1(n2) {
  var r2 = n2[Q$2];
  return r2 ? r2.i > 3 ? r2.i - 4 : r2.i : Array.isArray(n2) ? 1 : s$2(n2) ? 2 : v$1(n2) ? 3 : 0;
}
function u$4(n2, r2) {
  return 2 === o$1(n2) ? n2.has(r2) : Object.prototype.hasOwnProperty.call(n2, r2);
}
function a$1(n2, r2) {
  return 2 === o$1(n2) ? n2.get(r2) : n2[r2];
}
function f$2(n2, r2, t2) {
  var e2 = o$1(n2);
  2 === e2 ? n2.set(r2, t2) : 3 === e2 ? n2.add(t2) : n2[r2] = t2;
}
function c$2(n2, r2) {
  return n2 === r2 ? 0 !== n2 || 1 / n2 == 1 / r2 : n2 != n2 && r2 != r2;
}
function s$2(n2) {
  return X$2 && n2 instanceof Map;
}
function v$1(n2) {
  return q && n2 instanceof Set;
}
function p$3(n2) {
  return n2.o || n2.t;
}
function l$4(n2) {
  if (Array.isArray(n2))
    return Array.prototype.slice.call(n2);
  var r2 = rn(n2);
  delete r2[Q$2];
  for (var t2 = nn(r2), e2 = 0; e2 < t2.length; e2++) {
    var i2 = t2[e2], o2 = r2[i2];
    false === o2.writable && (o2.writable = true, o2.configurable = true), (o2.get || o2.set) && (r2[i2] = { configurable: true, writable: true, enumerable: o2.enumerable, value: n2[i2] });
  }
  return Object.create(Object.getPrototypeOf(n2), r2);
}
function d$1(n2, e2) {
  return void 0 === e2 && (e2 = false), y$3(n2) || r$1(n2) || !t$3(n2) || (o$1(n2) > 1 && (n2.set = n2.add = n2.clear = n2.delete = h$1), Object.freeze(n2), e2 && i$1(n2, function(n3, r2) {
    return d$1(r2, true);
  }, true)), n2;
}
function h$1() {
  n$2(2);
}
function y$3(n2) {
  return null == n2 || "object" != typeof n2 || Object.isFrozen(n2);
}
function b(r2) {
  var t2 = tn[r2];
  return t2 || n$2(18, r2), t2;
}
function _$1() {
  return U$3;
}
function j$1(n2, r2) {
  r2 && (b("Patches"), n2.u = [], n2.s = [], n2.v = r2);
}
function g$1(n2) {
  O$2(n2), n2.p.forEach(S$2), n2.p = null;
}
function O$2(n2) {
  n2 === U$3 && (U$3 = n2.l);
}
function w$2(n2) {
  return U$3 = { p: [], l: U$3, h: n2, m: true, _: 0 };
}
function S$2(n2) {
  var r2 = n2[Q$2];
  0 === r2.i || 1 === r2.i ? r2.j() : r2.g = true;
}
function P$3(r2, e2) {
  e2._ = e2.p.length;
  var i2 = e2.p[0], o2 = void 0 !== r2 && r2 !== i2;
  return e2.h.O || b("ES5").S(e2, r2, o2), o2 ? (i2[Q$2].P && (g$1(e2), n$2(4)), t$3(r2) && (r2 = M$3(e2, r2), e2.l || x$3(e2, r2)), e2.u && b("Patches").M(i2[Q$2].t, r2, e2.u, e2.s)) : r2 = M$3(e2, i2, []), g$1(e2), e2.u && e2.v(e2.u, e2.s), r2 !== H$2 ? r2 : void 0;
}
function M$3(n2, r2, t2) {
  if (y$3(r2))
    return r2;
  var e2 = r2[Q$2];
  if (!e2)
    return i$1(r2, function(i2, o3) {
      return A$2(n2, e2, r2, i2, o3, t2);
    }, true), r2;
  if (e2.A !== n2)
    return r2;
  if (!e2.P)
    return x$3(n2, e2.t, true), e2.t;
  if (!e2.I) {
    e2.I = true, e2.A._--;
    var o2 = 4 === e2.i || 5 === e2.i ? e2.o = l$4(e2.k) : e2.o, u2 = o2, a2 = false;
    3 === e2.i && (u2 = new Set(o2), o2.clear(), a2 = true), i$1(u2, function(r3, i2) {
      return A$2(n2, e2, o2, r3, i2, t2, a2);
    }), x$3(n2, o2, false), t2 && n2.u && b("Patches").N(e2, t2, n2.u, n2.s);
  }
  return e2.o;
}
function A$2(e2, i2, o2, a2, c2, s2, v2) {
  if (r$1(c2)) {
    var p2 = M$3(e2, c2, s2 && i2 && 3 !== i2.i && !u$4(i2.R, a2) ? s2.concat(a2) : void 0);
    if (f$2(o2, a2, p2), !r$1(p2))
      return;
    e2.m = false;
  } else
    v2 && o2.add(c2);
  if (t$3(c2) && !y$3(c2)) {
    if (!e2.h.D && e2._ < 1)
      return;
    M$3(e2, c2), i2 && i2.A.l || x$3(e2, c2);
  }
}
function x$3(n2, r2, t2) {
  void 0 === t2 && (t2 = false), !n2.l && n2.h.D && n2.m && d$1(r2, t2);
}
function z$1(n2, r2) {
  var t2 = n2[Q$2];
  return (t2 ? p$3(t2) : n2)[r2];
}
function I$2(n2, r2) {
  if (r2 in n2)
    for (var t2 = Object.getPrototypeOf(n2); t2; ) {
      var e2 = Object.getOwnPropertyDescriptor(t2, r2);
      if (e2)
        return e2;
      t2 = Object.getPrototypeOf(t2);
    }
}
function k$2(n2) {
  n2.P || (n2.P = true, n2.l && k$2(n2.l));
}
function E$2(n2) {
  n2.o || (n2.o = l$4(n2.t));
}
function N$2(n2, r2, t2) {
  var e2 = s$2(r2) ? b("MapSet").F(r2, t2) : v$1(r2) ? b("MapSet").T(r2, t2) : n2.O ? function(n3, r3) {
    var t3 = Array.isArray(n3), e3 = { i: t3 ? 1 : 0, A: r3 ? r3.A : _$1(), P: false, I: false, R: {}, l: r3, t: n3, k: null, o: null, j: null, C: false }, i2 = e3, o2 = en;
    t3 && (i2 = [e3], o2 = on);
    var u2 = Proxy.revocable(i2, o2), a2 = u2.revoke, f2 = u2.proxy;
    return e3.k = f2, e3.j = a2, f2;
  }(r2, t2) : b("ES5").J(r2, t2);
  return (t2 ? t2.A : _$1()).p.push(e2), e2;
}
function R$2(e2) {
  return r$1(e2) || n$2(22, e2), function n2(r2) {
    if (!t$3(r2))
      return r2;
    var e3, u2 = r2[Q$2], c2 = o$1(r2);
    if (u2) {
      if (!u2.P && (u2.i < 4 || !b("ES5").K(u2)))
        return u2.t;
      u2.I = true, e3 = D$1(r2, c2), u2.I = false;
    } else
      e3 = D$1(r2, c2);
    return i$1(e3, function(r3, t2) {
      u2 && a$1(u2.t, r3) === t2 || f$2(e3, r3, n2(t2));
    }), 3 === c2 ? new Set(e3) : e3;
  }(e2);
}
function D$1(n2, r2) {
  switch (r2) {
    case 2:
      return new Map(n2);
    case 3:
      return Array.from(n2);
  }
  return l$4(n2);
}
var G$1, U$3, W$3 = "undefined" != typeof Symbol && "symbol" == typeof Symbol("x"), X$2 = "undefined" != typeof Map, q = "undefined" != typeof Set, B$2 = "undefined" != typeof Proxy && void 0 !== Proxy.revocable && "undefined" != typeof Reflect, H$2 = W$3 ? Symbol.for("immer-nothing") : ((G$1 = {})["immer-nothing"] = true, G$1), L$2 = W$3 ? Symbol.for("immer-draftable") : "__$immer_draftable", Q$2 = W$3 ? Symbol.for("immer-state") : "__$immer_state", Z$2 = "" + Object.prototype.constructor, nn = "undefined" != typeof Reflect && Reflect.ownKeys ? Reflect.ownKeys : void 0 !== Object.getOwnPropertySymbols ? function(n2) {
  return Object.getOwnPropertyNames(n2).concat(Object.getOwnPropertySymbols(n2));
} : Object.getOwnPropertyNames, rn = Object.getOwnPropertyDescriptors || function(n2) {
  var r2 = {};
  return nn(n2).forEach(function(t2) {
    r2[t2] = Object.getOwnPropertyDescriptor(n2, t2);
  }), r2;
}, tn = {}, en = { get: function(n2, r2) {
  if (r2 === Q$2)
    return n2;
  var e2 = p$3(n2);
  if (!u$4(e2, r2))
    return function(n3, r3, t2) {
      var e3, i3 = I$2(r3, t2);
      return i3 ? "value" in i3 ? i3.value : null === (e3 = i3.get) || void 0 === e3 ? void 0 : e3.call(n3.k) : void 0;
    }(n2, e2, r2);
  var i2 = e2[r2];
  return n2.I || !t$3(i2) ? i2 : i2 === z$1(n2.t, r2) ? (E$2(n2), n2.o[r2] = N$2(n2.A.h, i2, n2)) : i2;
}, has: function(n2, r2) {
  return r2 in p$3(n2);
}, ownKeys: function(n2) {
  return Reflect.ownKeys(p$3(n2));
}, set: function(n2, r2, t2) {
  var e2 = I$2(p$3(n2), r2);
  if (null == e2 ? void 0 : e2.set)
    return e2.set.call(n2.k, t2), true;
  if (!n2.P) {
    var i2 = z$1(p$3(n2), r2), o2 = null == i2 ? void 0 : i2[Q$2];
    if (o2 && o2.t === t2)
      return n2.o[r2] = t2, n2.R[r2] = false, true;
    if (c$2(t2, i2) && (void 0 !== t2 || u$4(n2.t, r2)))
      return true;
    E$2(n2), k$2(n2);
  }
  return n2.o[r2] === t2 && (void 0 !== t2 || r2 in n2.o) || Number.isNaN(t2) && Number.isNaN(n2.o[r2]) || (n2.o[r2] = t2, n2.R[r2] = true), true;
}, deleteProperty: function(n2, r2) {
  return void 0 !== z$1(n2.t, r2) || r2 in n2.t ? (n2.R[r2] = false, E$2(n2), k$2(n2)) : delete n2.R[r2], n2.o && delete n2.o[r2], true;
}, getOwnPropertyDescriptor: function(n2, r2) {
  var t2 = p$3(n2), e2 = Reflect.getOwnPropertyDescriptor(t2, r2);
  return e2 ? { writable: true, configurable: 1 !== n2.i || "length" !== r2, enumerable: e2.enumerable, value: t2[r2] } : e2;
}, defineProperty: function() {
  n$2(11);
}, getPrototypeOf: function(n2) {
  return Object.getPrototypeOf(n2.t);
}, setPrototypeOf: function() {
  n$2(12);
} }, on = {};
i$1(en, function(n2, r2) {
  on[n2] = function() {
    return arguments[0] = arguments[0][0], r2.apply(this, arguments);
  };
}), on.deleteProperty = function(r2, t2) {
  return on.set.call(this, r2, t2, void 0);
}, on.set = function(r2, t2, e2) {
  return en.set.call(this, r2[0], t2, e2, r2[0]);
};
var un = function() {
  function e2(r2) {
    var e3 = this;
    this.O = B$2, this.D = true, this.produce = function(r3, i3, o2) {
      if ("function" == typeof r3 && "function" != typeof i3) {
        var u2 = i3;
        i3 = r3;
        var a2 = e3;
        return function(n2) {
          var r4 = this;
          void 0 === n2 && (n2 = u2);
          for (var t2 = arguments.length, e4 = Array(t2 > 1 ? t2 - 1 : 0), o3 = 1; o3 < t2; o3++)
            e4[o3 - 1] = arguments[o3];
          return a2.produce(n2, function(n3) {
            var t3;
            return (t3 = i3).call.apply(t3, [r4, n3].concat(e4));
          });
        };
      }
      var f2;
      if ("function" != typeof i3 && n$2(6), void 0 !== o2 && "function" != typeof o2 && n$2(7), t$3(r3)) {
        var c2 = w$2(e3), s2 = N$2(e3, r3, void 0), v2 = true;
        try {
          f2 = i3(s2), v2 = false;
        } finally {
          v2 ? g$1(c2) : O$2(c2);
        }
        return "undefined" != typeof Promise && f2 instanceof Promise ? f2.then(function(n2) {
          return j$1(c2, o2), P$3(n2, c2);
        }, function(n2) {
          throw g$1(c2), n2;
        }) : (j$1(c2, o2), P$3(f2, c2));
      }
      if (!r3 || "object" != typeof r3) {
        if (void 0 === (f2 = i3(r3)) && (f2 = r3), f2 === H$2 && (f2 = void 0), e3.D && d$1(f2, true), o2) {
          var p2 = [], l2 = [];
          b("Patches").M(r3, f2, p2, l2), o2(p2, l2);
        }
        return f2;
      }
      n$2(21, r3);
    }, this.produceWithPatches = function(n2, r3) {
      if ("function" == typeof n2)
        return function(r4) {
          for (var t3 = arguments.length, i4 = Array(t3 > 1 ? t3 - 1 : 0), o3 = 1; o3 < t3; o3++)
            i4[o3 - 1] = arguments[o3];
          return e3.produceWithPatches(r4, function(r5) {
            return n2.apply(void 0, [r5].concat(i4));
          });
        };
      var t2, i3, o2 = e3.produce(n2, r3, function(n3, r4) {
        t2 = n3, i3 = r4;
      });
      return "undefined" != typeof Promise && o2 instanceof Promise ? o2.then(function(n3) {
        return [n3, t2, i3];
      }) : [o2, t2, i3];
    }, "boolean" == typeof (null == r2 ? void 0 : r2.useProxies) && this.setUseProxies(r2.useProxies), "boolean" == typeof (null == r2 ? void 0 : r2.autoFreeze) && this.setAutoFreeze(r2.autoFreeze);
  }
  var i2 = e2.prototype;
  return i2.createDraft = function(e3) {
    t$3(e3) || n$2(8), r$1(e3) && (e3 = R$2(e3));
    var i3 = w$2(this), o2 = N$2(this, e3, void 0);
    return o2[Q$2].C = true, O$2(i3), o2;
  }, i2.finishDraft = function(r2, t2) {
    var e3 = r2 && r2[Q$2];
    var i3 = e3.A;
    return j$1(i3, t2), P$3(void 0, i3);
  }, i2.setAutoFreeze = function(n2) {
    this.D = n2;
  }, i2.setUseProxies = function(r2) {
    r2 && !B$2 && n$2(20), this.O = r2;
  }, i2.applyPatches = function(n2, t2) {
    var e3;
    for (e3 = t2.length - 1; e3 >= 0; e3--) {
      var i3 = t2[e3];
      if (0 === i3.path.length && "replace" === i3.op) {
        n2 = i3.value;
        break;
      }
    }
    e3 > -1 && (t2 = t2.slice(e3 + 1));
    var o2 = b("Patches").$;
    return r$1(n2) ? o2(n2, t2) : this.produce(n2, function(n3) {
      return o2(n3, t2);
    });
  }, e2;
}(), an = new un();
an.produce;
an.produceWithPatches.bind(an);
an.setAutoFreeze.bind(an);
an.setUseProxies.bind(an);
an.applyPatches.bind(an);
an.createDraft.bind(an);
an.finishDraft.bind(an);
const DefaultMaxChildrenHeight = 600;
const MainLineHeight = 35;
const ChildrenIndent = 15;
var EntryProperty = /* @__PURE__ */ ((EntryProperty2) => {
  EntryProperty2[EntryProperty2["ChildrenCount"] = 1] = "ChildrenCount";
  EntryProperty2[EntryProperty2["Size"] = 3] = "Size";
  return EntryProperty2;
})(EntryProperty || {});
var EntryStatus = /* @__PURE__ */ ((EntryStatus2) => {
  EntryStatus2[EntryStatus2["Default"] = 0] = "Default";
  EntryStatus2[EntryStatus2["Loading"] = 1] = "Loading";
  EntryStatus2[EntryStatus2["Error"] = 2] = "Error";
  return EntryStatus2;
})(EntryStatus || {});
var IwFsEntryAction = /* @__PURE__ */ ((IwFsEntryAction2) => {
  IwFsEntryAction2[IwFsEntryAction2["Decompress"] = 1] = "Decompress";
  IwFsEntryAction2[IwFsEntryAction2["Play"] = 2] = "Play";
  return IwFsEntryAction2;
})(IwFsEntryAction || {});
const _Entry = class _Entry {
  constructor(init2) {
    __publicField(this, "id");
    __publicField(this, _c, true);
    __publicField(this, "root");
    __publicField(this, "properties");
    __publicField(this, "children");
    __publicField(this, "parent");
    __publicField(this, "_tmpFilter", {});
    __publicField(this, "_filteredChildren", []);
    __publicField(this, "_childrenCount");
    __publicField(this, "initializationStatus", 0);
    __publicField(this, "expanded", false);
    __publicField(this, "selected", false);
    __publicField(this, "passwordsForDecompressing", []);
    __publicField(this, "renaming", false);
    __publicField(this, "newName");
    __publicField(this, "type", IwFsType.Unknown);
    __publicField(this, "path");
    __publicField(this, "name");
    __publicField(this, "meaningfulName");
    __publicField(this, "size");
    __publicField(this, "ext");
    __publicField(this, "creationTime");
    __publicField(this, "lastWriteTime");
    __publicField(this, "treeCache", {});
    // directoryCount?: number = undefined;
    // fileCount?: number = undefined;
    // duration?: number = undefined;
    __publicField(this, "task");
    __publicField(this, "_ref");
    __publicField(this, "errors", {});
    __publicField(this, "childrenWidth");
    Object.assign(this, init2);
    this.id = uuidv4();
    if (this.parent) {
      this.root = this.parent.root;
      this.childrenWidth = this.parent.childrenWidth - ChildrenIndent;
      this.root.nodeMap[this.path] = this;
    }
    if (!this.properties) {
      this.properties = Object.keys(EntryProperty).filter((item) => !isNaN(Number(item))).map((n2) => parseInt(n2, 10));
    }
  }
  get isRoot() {
    return !this.parent;
  }
  expireFilteredChildren() {
    var _a2;
    this._tmpFilter = {};
    this._filteredChildren = ((_a2 = this.children) == null ? void 0 : _a2.slice()) || [];
  }
  /**
   * Performance optimization
   */
  get filteredChildren() {
    if (this._tmpFilter != this.root.filter) {
      this._tmpFilter = this.root.filter;
      this.refreshFilteredChildren();
    }
    return this._filteredChildren;
  }
  async dispose() {
  }
  refreshFilteredChildren() {
    const { keyword, types: types2, custom: custom2 } = this._tmpFilter;
    const lowerCasedKeyword = keyword == null ? void 0 : keyword.toLowerCase();
    this._filteredChildren = (this.children ?? []).filter((c2) => {
      if (!(lowerCasedKeyword == void 0 || c2.name.toLowerCase().includes(lowerCasedKeyword))) {
        return false;
      }
      if (types2 && !types2.includes(c2.type) && c2.type != IwFsType.Directory) {
        return false;
      }
      if (custom2 != void 0) {
        const r2 = custom2(c2);
        if (!r2) {
          return false;
        }
      }
      return true;
    });
  }
  get childrenCount() {
    var _a2;
    return ((_a2 = this.children) == null ? void 0 : _a2.length) ?? this._childrenCount;
  }
  set childrenCount(value2) {
    if (this.children) {
      return;
    }
    this._childrenCount = value2;
  }
  async addChildByPath(path, render3) {
    if (this.children) {
      const childData = (await BApi$1.file.getIwFsEntry({ path })).data;
      const child = new _Entry({
        ...childData,
        parent: this
      });
      this.children ?? (this.children = []);
      this.children.push(child);
      this.children = this.children.slice().sort((a2, b2) => a2.name.localeCompare(b2.name));
      this.refreshFilteredChildren();
    } else {
      if (this.childrenCount != void 0) {
        this.childrenCount += 1;
      }
    }
    if (render3) {
      this.renderChildren();
    }
  }
  clearChildren() {
    if (this.children) {
      for (const c2 of this.children) {
        delete this.root.nodeMap[c2.path];
      }
      this.children = void 0;
      this._filteredChildren = [];
      this.renderChildren();
    }
  }
  async replaceChildByPath(prevPath, newPath, render3) {
    var _a2;
    (_a2 = this.root.nodeMap[prevPath]) == null ? void 0 : _a2.delete(false);
    await this.addChildByPath(newPath, render3);
  }
  get status() {
    if (this.initializationStatus == 1) {
      return 1;
    }
    const eKeys = Object.keys(this.errors);
    if (eKeys.length > 0) {
      return 2;
    }
    return 0;
  }
  get actions() {
    const actions = [];
    if (!this.isDirectoryOrDrive && this.type != IwFsType.CompressedFilePart) {
      actions.push(
        1
        /* Decompress */
      );
    }
    if (this.childrenCount != void 0 && this.childrenCount > 0) {
      actions.push(
        2
        /* Play */
      );
    }
    return actions;
  }
  get visible() {
    return this._ref != void 0;
  }
  async initialize() {
    var _a2, _b2;
    if (this.initializationStatus != 0) {
      return;
    }
    if (this.type == IwFsType.Drive) {
      this.initializationStatus = 2;
      return;
    }
    (_a2 = this.ref) == null ? void 0 : _a2.setLoading(true);
    this.initializationStatus = 1;
    try {
      for (const property2 of this.properties) {
        switch (property2) {
          case 1: {
            {
              const info2 = await BApi$1.file.getIwFsInfo(
                { path: this.path, type: this.type },
                { showErrorToast: () => false }
              );
              if (info2.code) {
                this.errors[
                  1
                  /* InitializationFailed */
                ] = info2.message;
              } else {
                Object.assign(this, info2.data);
              }
            }
            break;
          }
        }
      }
    } catch (e2) {
      this.errors[
        1
        /* InitializationFailed */
      ] = e2.message;
    } finally {
      this.initializationStatus = 2;
      (_b2 = this.ref) == null ? void 0 : _b2.setLoading(false);
    }
  }
  delete(render3) {
    const { parent, root: root2 } = this;
    console.log(`[${this.path}] Deleting`);
    delete root2.nodeMap[this.path];
    if (parent) {
      if (parent.children) {
        parent.children = parent.children.filter((c2) => c2 != this);
        parent.refreshFilteredChildren();
      } else {
        if (parent.childrenCount != void 0) {
          parent.childrenCount -= 1;
        }
      }
      if (render3) {
        parent.renderChildren();
      }
    }
  }
  get pathSegments() {
    return this.path.split(BusinessConstants.pathSeparator);
  }
  /**
   * @deprecated The method should not be used
   */
  get isDecompressionCandidateInMultiSelection() {
    return !this.isDirectoryOrDrive;
  }
  get expandable() {
    return this.type == IwFsType.Drive || this.type == IwFsType.Directory && (this.childrenCount == void 0 || this.childrenCount > 0);
  }
  get isMedia() {
    return this.type == IwFsType.Audio || this.type == IwFsType.Video;
  }
  get isDirectory() {
    return this.type == IwFsType.Directory;
  }
  get isDirectoryOrDrive() {
    return this.type == IwFsType.Directory || this.type == IwFsType.Drive;
  }
  get isDrive() {
    return this.type == IwFsType.Drive;
  }
  /**
   * @deprecated The method should not be used
   */
  get fileSystemInfoIsLoaded() {
    return this.childrenCount != void 0;
  }
  get ref() {
    return this._ref;
  }
  set ref(ref) {
    this._ref = ref;
  }
  renderChildren() {
    var _a2, _b2;
    (_a2 = this._ref) == null ? void 0 : _a2.renderChildren();
    (_b2 = this.parent) == null ? void 0 : _b2.renderChildren();
  }
  /**
   * @return rendered
   */
  recalculateChildrenWidth() {
    var _a2;
    const dom = (_a2 = this.ref) == null ? void 0 : _a2.dom;
    if (dom) {
      const childrenWidth = dom.parentElement.clientWidth - (this.isRoot ? 0 : ChildrenIndent);
      if (childrenWidth != this.childrenWidth) {
        this.childrenWidth = childrenWidth;
        this.forceUpdate();
        if (this.children) {
          for (const c2 of this.children) {
            c2.recalculateChildrenWidth();
          }
        }
        return true;
      }
    }
    return false;
  }
  select(select2) {
    this.simpleRefCall("select", "selected", select2);
  }
  highlight(highlight) {
    this.simpleRefCall("highlight", "highlighted", highlight);
  }
  expand(refresh) {
    if (this._ref) {
      this._ref.expand(refresh);
    }
  }
  collapse() {
    if (this._ref) {
      this._ref.collapse();
    }
  }
  get dom() {
    var _a2;
    return (_a2 = this._ref) == null ? void 0 : _a2.dom;
  }
  get childrenHeight() {
    var _a2, _b2, _c2, _d, _e;
    const { ref } = this;
    if (!ref) {
      return 0;
    }
    if (this.isRoot) {
      const parentHeight = ((_b2 = (_a2 = ref.dom) == null ? void 0 : _a2.parentElement) == null ? void 0 : _b2.clientHeight) ?? 0;
      return parentHeight;
    }
    let height = 0;
    if (((_c2 = this.filteredChildren) == null ? void 0 : _c2.length) > 0 && this.expanded) {
      for (const te2 of this.filteredChildren) {
        height += te2.totalHeight;
      }
    }
    const maxChildrenHeight = this.isRoot ? ((_e = (_d = ref.dom) == null ? void 0 : _d.parentElement) == null ? void 0 : _e.clientHeight) ?? 0 : DefaultMaxChildrenHeight;
    return Math.min(maxChildrenHeight, height);
  }
  get totalHeight() {
    return MainLineHeight + this.childrenHeight;
  }
  forceUpdate() {
    var _a2;
    (_a2 = this._ref) == null ? void 0 : _a2.forceUpdate();
  }
  simpleRefCall(method4, fallbackProperty, value2) {
    console.log(this._ref, method4, this);
    if (this._ref) {
      this._ref[method4](value2);
    } else {
      this[fallbackProperty] = value2;
    }
  }
};
_c = L$2;
let Entry = _Entry;
const useIconsStore = create$1((set2, get5) => ({
  icons: {},
  add: (icons) => set2((state) => {
    const newIcons = { ...state.icons };
    Object.keys(icons).forEach((e2) => {
      newIcons[e2] = icons[e2];
    });
    return { icons: newIcons };
  })
}));
const buildCacheKey = (type4, path) => {
  let suffix = "";
  switch (type4) {
    case IconType.UnknownFile:
    case IconType.Directory:
      break;
    case IconType.Dynamic: {
      if (!path) {
        return void 0;
      }
      if (path.endsWith(".exe") || path.endsWith(".app")) {
        suffix = path;
        break;
      }
      const filename2 = _$2.last(splitPathIntoSegments(path));
      const filenameSegments = filename2.split(".");
      const ext = filenameSegments[filenameSegments.length - 1];
      if (ext == void 0) {
        type4 = IconType.UnknownFile;
      } else {
        suffix = `.${ext}`;
      }
      break;
    }
  }
  return `${type4}-${suffix}`;
};
const FileSystemEntryIcon = ({
  path,
  type: type4,
  size: size2 = 14,
  disableCache
}) => {
  const cacheKey = buildCacheKey(type4, path);
  const { icons, add: add2 } = useIconsStore();
  const iconCache = cacheKey == void 0 ? void 0 : icons[cacheKey];
  const iconImgDataRef = reactExports.useRef(disableCache ? void 0 : iconCache === void 0 ? void 0 : iconCache);
  const forceUpdate = useUpdate();
  reactExports.useEffect(() => {
    if (iconImgDataRef.current === void 0 && cacheKey != void 0) {
      BApi$1.file.getIconData({
        type: type4,
        path
      }).then((r2) => {
        add2({ [cacheKey]: r2.data });
        iconImgDataRef.current = r2.data;
        forceUpdate();
      });
    }
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "div",
    {
      className: "file-system-entry-icon",
      style: {
        width: size2,
        height: size2,
        minWidth: size2,
        minHeight: size2
      },
      children: iconImgDataRef.current ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { alt: "", src: iconImgDataRef.current }) : type4 == IconType.Directory ? /* @__PURE__ */ jsxRuntimeExports.jsx(MdFolder, { style: {
        color: "#ccc",
        fontSize: size2
      } }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
        MdInsertDriveFile,
        {
          style: {
            color: "#ccc",
            fontSize: size2
          },
          title: instance.t("Unknown file type")
        }
      )
    }
  );
};
FileSystemEntryIcon.displayName = "FileSystemEntryIcon";
const FileSystemEntryChangeExampleItem = (props) => {
  const {
    type: type4,
    editable = false,
    layer: layer2 = 0,
    text: text2 = "",
    path,
    onChange,
    isDirectory = false,
    hideIcon,
    className
  } = props;
  const style2 = {
    paddingLeft: `${layer2 * 24}px`
  };
  const renderInner = () => {
    switch (type4) {
      case "error":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Chip,
          {
            className: "px-0 whitespace-normal h-auto",
            classNames: { content: "px-0" },
            color: "danger",
            size: "sm",
            variant: "light",
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
              !hideIcon && /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, { style: { fontSize: "18px" } }),
              text2
            ] })
          }
        ) });
      case "others":
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(FileSystemEntryIcon, { size: 20, type: IconType.UnknownFile }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Chip,
            {
              className: "px-0 whitespace-break-spaces",
              classNames: { content: "px-0" },
              size: "sm",
              variant: "light",
              children: text2
            }
          )
        ] });
      case "added": {
        if (editable) {
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                className: "px-0",
                classNames: { content: "px-0" },
                color: "success",
                size: "sm",
                variant: "light",
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(FileSystemEntryIcon, { size: 20, type: IconType.Directory })
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                radius: "none",
                defaultValue: text2,
                size: "sm",
                onValueChange: (v2) => {
                  onChange == null ? void 0 : onChange(v2);
                }
              }
            )
          ] });
        } else {
          return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Chip,
            {
              className: "px-0",
              classNames: { content: "px-0" },
              color: "success",
              size: "sm",
              variant: "light",
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                !hideIcon && /* @__PURE__ */ jsxRuntimeExports.jsx(
                  FileSystemEntryIcon,
                  {
                    path,
                    size: 20,
                    type: isDirectory ? IconType.Directory : path ? IconType.Dynamic : IconType.UnknownFile
                  }
                ),
                text2
              ] })
            }
          ) });
        }
      }
      case "deleted":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Chip,
          {
            className: "line-through px-0 whitespace-normal h-auto",
            classNames: { content: "px-0" },
            color: "danger",
            size: "sm",
            variant: "light",
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
              !hideIcon && /* @__PURE__ */ jsxRuntimeExports.jsx(
                FileSystemEntryIcon,
                {
                  path,
                  size: 20,
                  type: isDirectory ? IconType.Directory : path ? IconType.Dynamic : IconType.UnknownFile
                }
              ),
              text2
            ] })
          }
        ) });
      case "default":
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(FileSystemEntryIcon, { size: 20, type: IconType.Directory }),
          text2
        ] });
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${className} flex items-center gap-2`, style: style2, children: renderInner() });
};
FileSystemEntryChangeExampleItem.displayName = "FileSystemEntryChangeExampleItem";
const FileSystemEntryChangeExampleMiscellaneousItem = ({
  indent,
  parent
}) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    FileSystemEntryChangeExampleItem,
    {
      className: "opacity-60",
      layer: indent,
      text: parent ? `${t2("Other files in {{parent}}", { parent })}...` : `${t2("Other files")}...`,
      type: "others"
    }
  );
};
FileSystemEntryChangeExampleMiscellaneousItem.displayName = "FileSystemEntryChangeExampleMiscellaneousItem";
const ExtractModal = ({ entries = [], onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const [targetEntries, setTargetEntries] = reactExports.useState([]);
  reactExports.useEffect(() => {
    const directoryEntries = _$2.sortBy(
      _$2.sortBy(
        entries.filter((entry) => entry.isDirectory),
        (e2) => e2.path
      ),
      (x2) => x2.path.length
    );
    const outerDirectoryEntries = [];
    const outerDirectoryPaths = /* @__PURE__ */ new Set();
    for (const de2 of directoryEntries) {
      let skip2 = false;
      for (const odp of outerDirectoryPaths) {
        if (de2.path.startsWith(odp)) {
          skip2 = true;
        }
      }
      if (!skip2) {
        outerDirectoryPaths.add(`${de2.path}/`);
        outerDirectoryEntries.push(de2);
      }
    }
    setTargetEntries(outerDirectoryEntries);
  }, [entries]);
  const groups2 = _$2.groupBy(targetEntries, (e2) => {
    var _a2;
    return (_a2 = e2.parent) == null ? void 0 : _a2.path;
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          children: `${t2("Extract")}(Enter)`,
          autoFocus: true
        }
      },
      size: "xl",
      title: t2("Extract {{count}} directories", {
        count: entries.length
      }),
      onDestroyed,
      onOk: async () => {
        for (const e2 of targetEntries) {
          await BApi$1.file.extractAndRemoveDirectory({ directory: e2.path });
        }
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: Object.keys(groups2).map((parent) => {
        const innerEntries = groups2[parent] ?? [];
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            FileSystemEntryChangeExampleItem,
            {
              isDirectory: true,
              text: parent ?? ".",
              type: "default"
            }
          ),
          innerEntries.map((e2, i2) => {
            if (e2.isDirectoryOrDrive) {
              return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  FileSystemEntryChangeExampleItem,
                  {
                    isDirectory: e2.isDirectory,
                    layer: 1,
                    path: e2.path,
                    text: e2.name,
                    type: "deleted"
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  FileSystemEntryChangeExampleItem,
                  {
                    isDirectory: false,
                    layer: 2,
                    text: `${t2("Other files")}...`,
                    type: "deleted"
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  FileSystemEntryChangeExampleItem,
                  {
                    isDirectory: false,
                    layer: 1,
                    text: `${t2("Other files in {{parent}}", { parent: e2.name })}...`,
                    type: "added"
                  }
                )
              ] });
            } else {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                FileSystemEntryChangeExampleItem,
                {
                  isDirectory: e2.isDirectory,
                  layer: 1,
                  path: e2.path,
                  text: e2.name,
                  type: "default"
                }
              );
            }
          }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            FileSystemEntryChangeExampleMiscellaneousItem,
            {
              indent: 1,
              parent
            }
          )
        ] });
      }) })
    }
  );
};
ExtractModal.displayName = "ExtractModal";
const WrapModal = ({ entries = [], onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const groupsRef = reactExports.useRef(_$2.groupBy(entries, (e2) => {
    var _a2;
    return (_a2 = e2.parent) == null ? void 0 : _a2.path;
  }));
  const [newParentNames, setNewParentNames] = reactExports.useState(
    _$2.mapValues(groupsRef.current, (g2) => g2[0].meaningfulName)
  );
  reactExports.useEffect(() => {
  }, []);
  console.log(newParentNames);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          children: `${t2("Wrap")}(Enter)`,
          autoFocus: true,
          disabled: _$2.values(newParentNames).some((x2) => !x2 || x2.length == 0)
        }
      },
      size: "xl",
      title: t2("Wrapping {{count}} file entries", {
        count: entries.length
      }),
      onDestroyed,
      onOk: async () => {
        await Promise.all(
          _$2.keys(groupsRef.current).map(async (p2) => {
            const innerEntries = groupsRef.current[p2];
            const parentEntry = innerEntries[0].parent;
            const d2 = [parentEntry.path, newParentNames[p2]].join(
              BusinessConstants.pathSeparator
            );
            await BApi$1.file.moveEntries({
              destDir: d2,
              entryPaths: innerEntries.map((e2) => e2.path)
            });
          })
        );
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: Object.keys(groupsRef.current).map((parent) => {
        const innerEntries = groupsRef.current[parent] ?? [];
        const newParentName = newParentNames[parent] ?? "";
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            FileSystemEntryChangeExampleItem,
            {
              isDirectory: true,
              text: parent ?? ".",
              type: "default"
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            FileSystemEntryChangeExampleItem,
            {
              editable: true,
              isDirectory: true,
              layer: 1,
              text: newParentName,
              type: "added",
              onChange: (v2) => {
                setNewParentNames((old) => ({ ...old, [parent]: v2 }));
              }
            }
          ),
          innerEntries.map((e2, i2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              FileSystemEntryChangeExampleItem,
              {
                isDirectory: e2.isDirectory,
                layer: 2,
                path: e2.path,
                text: e2.name,
                type: "added"
              }
            );
          }),
          innerEntries.map((e2, i2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              FileSystemEntryChangeExampleItem,
              {
                isDirectory: e2.isDirectory,
                layer: 1,
                path: e2.path,
                text: e2.name,
                type: "deleted"
              }
            );
          }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            FileSystemEntryChangeExampleMiscellaneousItem,
            {
              indent: 1,
              parent
            }
          )
        ] });
      }) })
    }
  );
};
WrapModal.displayName = "WrapModal";
const log$E = buildLogger("DeleteConfirmationModal");
const _mergeItems = (entries, entryRestSegmentsMap, path) => {
  const prefixes = [];
  const ret = [];
  const groups2 = _$2.groupBy(
    entries,
    (e2) => entryRestSegmentsMap.get(e2.path).shift()
  );
  const keys2 = _$2.sortBy(_$2.keys(groups2), (x2) => x2);
  for (const key of keys2) {
    const childrenEntries = groups2[key].filter(
      (x2) => entryRestSegmentsMap.get(x2.path).length > 0
    );
    const pathSegment2 = [...prefixes, key].join("/");
    const newPath = [path, pathSegment2].filter((x2) => x2 != void 0).join("/");
    if (childrenEntries.length == 1) {
      ret.push({
        pathSegment: pathSegment2,
        isDirectory: childrenEntries[0].isDirectory,
        path: newPath,
        willBeDeleted: entryRestSegmentsMap.has(newPath)
      });
    } else {
      ret.push({
        pathSegment: pathSegment2,
        children: _mergeItems(childrenEntries, entryRestSegmentsMap, newPath),
        isDirectory: true,
        path: newPath,
        willBeDeleted: entryRestSegmentsMap.has(newPath)
      });
    }
  }
  return ret;
};
const mergeItems = (entries, rootPath) => {
  const entryRestSegmentsMap = entries.reduce((s2, t2) => {
    s2.set(
      t2.path,
      splitPathIntoSegments(
        rootPath == void 0 ? t2.path : t2.path.replace(rootPath, "")
      )
    );
    return s2;
  }, /* @__PURE__ */ new Map());
  const list2 = _mergeItems(entries, entryRestSegmentsMap, rootPath);
  if (rootPath == void 0) {
    return list2;
  } else {
    return [
      {
        pathSegment: rootPath,
        children: list2,
        isDirectory: true,
        path: rootPath,
        willBeDeleted: false
      }
    ];
  }
};
const renderItem = (item, layer2) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      FileSystemEntryChangeExampleItem,
      {
        isDirectory: item.isDirectory,
        layer: layer2,
        text: item.pathSegment,
        type: item.willBeDeleted ? "deleted" : "default"
      }
    ),
    item.children && item.children.map((x2) => renderItem(x2, layer2 + 1))
  ] });
};
const DeleteConfirmationModal = ({
  entries = [],
  onDestroyed,
  rootPath
}) => {
  const { t: t2 } = useTranslation();
  const items = mergeItems(entries, rootPath);
  log$E(rootPath, entries, items);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          children: `${t2("Delete")}(Enter)`,
          color: "danger",
          autoFocus: true
        }
      },
      size: "xl",
      title: t2("Sure to delete?"),
      onDestroyed,
      onOk: async () => await BApi$1.file.removeFiles({ paths: entries.map((p2) => p2.path) }),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
        items.map((item) => renderItem(item, 0)),
        rootPath && /* @__PURE__ */ jsxRuntimeExports.jsx(
          FileSystemEntryChangeExampleMiscellaneousItem,
          {
            indent: 1,
            parent: rootPath
          }
        )
      ] })
    }
  );
};
DeleteConfirmationModal.displayName = "DeleteConfirmationModal";
const DeleteItemsWithSameNamesModal = ({
  entries,
  workingDirectory,
  onDestroyed,
  ...dialogProps
}) => {
  const [deletingAllPaths, setDeletingAllPaths] = reactExports.useState();
  const { t: t2 } = useTranslation();
  reactExports.useEffect(() => {
    BApi$1.file.getSameNameEntriesInWorkingDirectory({
      workingDir: workingDirectory,
      entryPaths: entries.map((e2) => e2.path)
    }).then((t22) => {
      setDeletingAllPaths(t22.data || []);
    });
    return () => {
    };
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          children: `${t2("Delete")}(Enter)`,
          color: "danger",
          autoFocus: true,
          disabled: !deletingAllPaths || deletingAllPaths.length == 0
        }
      },
      size: "xl",
      title: t2("Delete items with the same names"),
      onDestroyed,
      onOk: async () => {
        if (!deletingAllPaths || deletingAllPaths.length == 0) {
          toast.error("Nothing to delete");
          return false;
        } else {
          const rsp = await BApi$1.file.removeSameNameEntryInWorkingDirectory({
            workingDir: workingDirectory,
            entryPaths: entries.map((e2) => e2.path)
          });
          return rsp;
        }
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-2", children: t2(
          "Removing all filesystem entries in {{workingDirectory}} that have the same names as the {{count}} selected filesystem entries",
          {
            count: entries.length,
            workingDirectory
          }
        ) }),
        deletingAllPaths ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            FileSystemEntryChangeExampleItem,
            {
              text: workingDirectory,
              type: "default"
            }
          ),
          deletingAllPaths.map((d2, i2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              FileSystemEntryChangeExampleItem,
              {
                isDirectory: d2.isDirectory,
                layer: 1,
                path: d2.path,
                text: d2.name,
                type: "deleted"
              }
            );
          })
        ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, {}),
          t2("Discovering files with same name")
        ] })
      ]
    }
  );
};
DeleteItemsWithSameNamesModal.displayName = "DeleteItemsWithSameNamesModal";
const GroupModal = ({ entries = [], groupInternal, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const [preview, setPreview] = reactExports.useState();
  const forceUpdate = useUpdate();
  const similarityThresholdRef = reactExports.useRef(1);
  const [caculating, setCaculating] = reactExports.useState(true);
  const caculate = () => {
    setCaculating(true);
    BApi$1.file.previewFileSystemEntriesGroupResult({
      paths: entries.map((e2) => e2.path),
      groupInternal,
      similarityThreshold: similarityThresholdRef.current
    }).then((x2) => {
      setPreview(x2.data);
    }).finally(() => {
      setCaculating(false);
    });
  };
  reactExports.useEffect(() => {
    caculate();
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          children: `${t2("Group")}(Enter)`,
          autoFocus: true,
          disabled: !preview || preview.length == 0
        }
      },
      size: "xl",
      title: t2(groupInternal ? "Group internal items" : "Group {{count}} items", {
        count: entries.length
      }),
      onDestroyed,
      onOk: async () => {
        await BApi$1.file.groupFileSystemEntries({
          paths: entries.map((e2) => e2.path),
          groupInternal,
          similarityThreshold: similarityThresholdRef.current
        });
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          slider_default,
          {
            defaultValue: similarityThresholdRef.current,
            isDisabled: caculating,
            maxValue: 1,
            minValue: 0,
            size: "sm",
            step: 0.01,
            onChange: (v2) => {
              similarityThresholdRef.current = v2;
              forceUpdate();
            },
            onChangeEnd: (v2) => {
              caculate();
            },
            renderValue: (v2) => {
              const p2 = Math.round(similarityThresholdRef.current * 100);
              if (p2 == 0) {
                return `${t2("All items will be stored in one folder")}`;
              }
              if (p2 == 100) {
                return `${t2("Items with exactly the same name (excluding file extensions) will be stored in the same folder")}`;
              }
              return `${p2}%`;
            },
            label: t2("Similarity threshold")
          }
        ),
        preview ? preview.map((p2) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(FileSystemEntryChangeExampleItem, { isDirectory: true, text: p2.rootPath, type: "default" }),
            p2.groups && p2.groups.length > 0 ? p2.groups.map((g2) => {
              return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  FileSystemEntryChangeExampleItem,
                  {
                    isDirectory: true,
                    layer: 1,
                    text: g2.directoryName,
                    type: "added"
                  }
                ),
                g2.filenames.map((f2) => {
                  return /* @__PURE__ */ jsxRuntimeExports.jsx(FileSystemEntryChangeExampleItem, { layer: 2, text: f2, type: "added" });
                }),
                g2.filenames.map((f2) => {
                  return /* @__PURE__ */ jsxRuntimeExports.jsx(FileSystemEntryChangeExampleItem, { layer: 1, text: f2, type: "deleted" });
                })
              ] });
            }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
              FileSystemEntryChangeExampleItem,
              {
                layer: 1,
                text: t2(
                  "Nothing to group. Please check if the folder contains any files; subfolders cannot be grouped"
                ),
                type: "error"
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(FileSystemEntryChangeExampleMiscellaneousItem, { indent: 1, parent: p2.rootPath })
          ] });
        }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, {}),
          t2("Calculating changes...")
        ] })
      ] })
    }
  );
};
GroupModal.displayName = "GroupModal";
const PositionType$3 = FileNameModifierPosition;
const PositionTypeOptions$2 = fileNameModifierPositions.map((opt) => ({
  label: "FileNameModifier.PositionType." + FileNameModifierPosition[opt.value],
  value: opt.value
}));
const InsertOperationFields = ({ operation, t: t2, onChange }) => {
  var _a2;
  const handleChangeField = (key, value2) => onChange({ ...operation, [key]: value2 });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        className: "w-[240px]",
        isRequired: !operation.text && !(operation.position === PositionType$3.BeforeText || operation.position === PositionType$3.AfterText && operation.targetText),
        label: t2("FileNameModifier.Label.Text"),
        placeholder: t2("FileNameModifier.Placeholder.Text"),
        size: "sm",
        value: operation.text || "",
        onValueChange: (e2) => handleChangeField("text", e2)
      }
    ),
    (operation.position === PositionType$3.BeforeText || operation.position === PositionType$3.AfterText) && /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        className: "w-[240px]",
        isRequired: !operation.targetText,
        label: t2("FileNameModifier.Label.TargetText"),
        placeholder: t2("FileNameModifier.Placeholder.TargetText"),
        size: "sm",
        value: operation.targetText || "",
        onValueChange: (e2) => handleChangeField("targetText", e2)
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Select,
      {
        className: "w-[160px]",
        dataSource: PositionTypeOptions$2.map((opt) => ({
          label: t2(opt.label),
          value: opt.value
        })),
        isRequired: !operation.position,
        label: t2("FileNameModifier.Label.PositionType"),
        placeholder: t2("FileNameModifier.Placeholder.PositionType"),
        selectedKeys: [((_a2 = operation.position) == null ? void 0 : _a2.toString()) || ""],
        size: "sm",
        onSelectionChange: (keys2) => {
          const key = parseInt(Array.from(keys2)[0]);
          if (key !== operation.position) {
            handleChangeField("position", key);
          }
        }
      }
    ),
    operation.position === PositionType$3.AtPosition && /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        className: "w-[120px]",
        isRequired: true,
        label: t2("FileNameModifier.Label.PositionIndex"),
        placeholder: t2("FileNameModifier.Placeholder.PositionIndex"),
        size: "sm",
        value: operation.positionIndex,
        onValueChange: (e2) => handleChangeField("positionIndex", e2)
      }
    )
  ] });
};
const ReplaceOperationFields = ({ operation, t: t2, onChange }) => {
  const handleChangeField = (key, value2) => onChange({ ...operation, [key]: value2 });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    [
      ["text", "Text"],
      ["targetText", "TargetText"]
    ].map(([key, label]) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        className: "w-[180px]",
        isRequired: !operation.text && !operation.targetText,
        label: t2(`FileNameModifier.Label.${label}`),
        placeholder: t2(`FileNameModifier.Placeholder.${label}`),
        size: "sm",
        value: operation[key] || "",
        onValueChange: (e2) => handleChangeField(key, e2)
      },
      key
    )),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        checkbox_default,
        {
          checked: operation.replaceEntire,
          onChange: (e2) => handleChangeField("replaceEntire", e2.target.checked)
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-gray-500", children: t2("FileNameModifier.ReplaceEntire") })
    ] })
  ] });
};
const PositionType$2 = FileNameModifierPosition;
const PositionTypeOptions$1 = fileNameModifierPositions.map((opt) => ({
  label: "FileNameModifier.PositionType." + FileNameModifierPosition[opt.value],
  value: opt.value
}));
const AddDateTimeOperationFields = ({
  operation,
  t: t2,
  onChange
}) => {
  var _a2;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        className: "w-[180px]",
        isRequired: !operation.dateTimeFormat,
        label: t2("FileNameModifier.Label.DateTimeFormat"),
        placeholder: t2("FileNameModifier.Placeholder.DateTimeFormat"),
        size: "sm",
        value: operation.dateTimeFormat || "",
        onValueChange: (e2) => onChange({ ...operation, dateTimeFormat: e2 })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Select,
      {
        className: "w-[160px]",
        dataSource: PositionTypeOptions$1.map((opt) => ({
          label: t2(opt.label),
          value: opt.value
        })),
        isRequired: true,
        label: t2("FileNameModifier.Label.PositionType"),
        placeholder: t2("FileNameModifier.Placeholder.PositionType"),
        selectedKeys: [((_a2 = operation.position) == null ? void 0 : _a2.toString()) || ""],
        size: "sm",
        onSelectionChange: (keys2) => {
          const key = parseInt(Array.from(keys2)[0]);
          if (key !== operation.position) {
            onChange({ ...operation, position: key });
          }
        }
      }
    ),
    operation.position === PositionType$2.AtPosition && /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        className: "w-[120px]",
        isRequired: true,
        label: t2("FileNameModifier.Label.PositionIndex"),
        placeholder: t2("FileNameModifier.Placeholder.PositionIndex"),
        size: "sm",
        value: operation.positionIndex,
        onValueChange: (e2) => onChange({ ...operation, positionIndex: e2 })
      }
    ),
    (operation.position === PositionType$2.BeforeText || operation.position === PositionType$2.AfterText) && /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        className: "w-[240px]",
        isRequired: !operation.targetText,
        label: t2("FileNameModifier.Label.TargetText"),
        placeholder: t2("FileNameModifier.Placeholder.TargetText"),
        size: "sm",
        value: operation.targetText || "",
        onValueChange: (e2) => onChange({ ...operation, targetText: e2 })
      }
    )
  ] });
};
const PositionType$1 = FileNameModifierPosition;
const PositionTypeOptions = fileNameModifierPositions.map((opt) => ({
  label: "FileNameModifier.PositionType." + FileNameModifierPosition[opt.value],
  value: opt.value
}));
const DeleteOperationFields = ({ operation, t: t2, onChange }) => {
  var _a2;
  const handleChangeField = (key, value2) => onChange({ ...operation, [key]: value2 });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    [
      ["deleteCount", "DeleteCount", 120],
      ["deleteStartPosition", "DeleteStartPosition", 120]
    ].map(([key, label, w2]) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        className: `w-[${w2}px]`,
        isRequired: operation[key] == null,
        label: t2(`FileNameModifier.Label.${label}`),
        placeholder: t2(`FileNameModifier.Placeholder.${label}`),
        size: "sm",
        value: operation[key],
        onValueChange: (e2) => handleChangeField(key, e2)
      },
      key
    )),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        className: "w-[180px]",
        isRequired: false,
        label: t2("FileNameModifier.Label.MatchText"),
        placeholder: t2("FileNameModifier.Placeholder.MatchText"),
        size: "sm",
        value: operation.targetText || "",
        onValueChange: (e2) => handleChangeField("targetText", e2)
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Select,
      {
        className: "w-[140px]",
        dataSource: PositionTypeOptions.map((opt) => ({
          label: t2(opt.label),
          value: opt.value
        })),
        isRequired: !operation.position,
        label: t2("FileNameModifier.Label.PositionType"),
        placeholder: t2("FileNameModifier.Placeholder.PositionType"),
        selectedKeys: [((_a2 = operation.position) == null ? void 0 : _a2.toString()) || ""],
        size: "sm",
        onSelectionChange: (keys2) => {
          const key = parseInt(Array.from(keys2)[0]);
          if (key !== operation.position) {
            handleChangeField("position", key);
          }
        }
      }
    ),
    operation.position === PositionType$1.AtPosition && /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        className: "w-[120px]",
        isRequired: true,
        label: t2("FileNameModifier.Label.PositionIndex"),
        placeholder: t2("FileNameModifier.Placeholder.PositionIndex"),
        size: "sm",
        value: operation.positionIndex,
        onValueChange: (e2) => handleChangeField("positionIndex", e2)
      }
    )
  ] });
};
const CaseTypeOptions = fileNameModifierCaseTypes.map((opt) => ({
  label: "FileNameModifier.CaseType." + FileNameModifierCaseType[opt.value],
  value: opt.value
}));
const ChangeCaseOperationFields = ({
  operation,
  t: t2,
  onChange
}) => {
  var _a2;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Select,
    {
      className: "w-[180px]",
      dataSource: CaseTypeOptions.map((opt) => ({
        label: t2(opt.label),
        value: opt.value
      })),
      isRequired: !operation.caseType,
      label: t2("FileNameModifier.Label.CaseType"),
      placeholder: t2("FileNameModifier.Placeholder.CaseType"),
      selectedKeys: [((_a2 = operation.caseType) == null ? void 0 : _a2.toString()) || ""],
      size: "sm",
      onSelectionChange: (keys2) => {
        const key = parseInt(Array.from(keys2)[0]);
        if (key !== operation.caseType) {
          onChange({ ...operation, caseType: key });
        }
      }
    }
  );
};
const PositionType = FileNameModifierPosition;
const AddAlphabetSequenceOperationFields = ({
  operation,
  t: t2,
  onChange
}) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
  /* @__PURE__ */ jsxRuntimeExports.jsx(
    input_default,
    {
      className: "w-[100px]",
      isRequired: !operation.alphabetStartChar,
      label: t2("FileNameModifier.Label.StartChar"),
      maxLength: 1,
      placeholder: t2("FileNameModifier.Placeholder.StartChar"),
      size: "sm",
      value: operation.alphabetStartChar,
      onValueChange: (e2) => onChange({ ...operation, alphabetStartChar: e2 })
    }
  ),
  /* @__PURE__ */ jsxRuntimeExports.jsx(
    number_input_default,
    {
      className: "w-[100px]",
      isRequired: operation.alphabetCount == null,
      label: t2("FileNameModifier.Label.Count"),
      placeholder: t2("FileNameModifier.Placeholder.Count"),
      size: "sm",
      value: operation.alphabetCount,
      onValueChange: (e2) => onChange({ ...operation, alphabetCount: e2 })
    }
  ),
  operation.position === PositionType.AtPosition && /* @__PURE__ */ jsxRuntimeExports.jsx(
    number_input_default,
    {
      className: "w-[120px]",
      isRequired: true,
      label: t2("FileNameModifier.Label.PositionIndex"),
      placeholder: t2("FileNameModifier.Placeholder.PositionIndex"),
      size: "sm",
      value: operation.positionIndex,
      onValueChange: (e2) => onChange({ ...operation, positionIndex: e2 })
    }
  )
] });
const OperationType = FileNameModifierOperationType;
fileNameModifierPositions.map((opt) => ({
  label: "FileNameModifier.PositionType." + FileNameModifierPosition[opt.value],
  value: opt.value
}));
const TargetTypeOptions = fileNameModifierFileNameTargets.map((opt) => ({
  label: "FileNameModifier.Target." + FileNameModifierFileNameTarget[opt.value],
  value: opt.value
}));
const OperationCard = ({
  operation,
  index: index2,
  onChange,
  onDelete,
  onMoveUp,
  onMoveDown,
  onCopy,
  errors
}) => {
  var _a2, _b2;
  const { t: t2 } = useTranslation();
  const handleChange = (key, value2) => {
    onChange({ ...operation, [key]: value2 });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { className: "mb-2 p-3 operation-card", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Select,
        {
          className: "w-[240px]",
          dataSource: TargetTypeOptions.map((opt) => ({
            label: t2(opt.label),
            value: opt.value
          })),
          isRequired: true,
          label: t2("FileNameModifier.TargetType"),
          placeholder: t2("FileNameModifier.TargetTypePlaceholder"),
          selectedKeys: [((_a2 = operation.target) == null ? void 0 : _a2.toString()) || ""],
          onSelectionChange: (keys2) => {
            const key = parseInt(Array.from(keys2)[0]);
            if (key !== operation.target) {
              handleChange("target", key);
            }
          }
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Select,
        {
          className: "w-[180px]",
          dataSource: fileNameModifierOperationTypes.map((opt) => ({
            label: t2(`FileNameModifier.OperationType.${opt.label}`),
            value: opt.value
          })),
          isRequired: true,
          label: t2("FileNameModifier.OperationType"),
          placeholder: t2("FileNameModifier.OperationTypePlaceholder"),
          selectedKeys: [((_b2 = operation.operation) == null ? void 0 : _b2.toString()) || ""],
          onSelectionChange: (keys2) => {
            const key = Array.from(keys2)[0];
            const keyInt = parseInt(key);
            if (keyInt && keyInt !== operation.operation) {
              handleChange("operation", keyInt);
            }
          }
        }
      )
    ] }),
    errors && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-red-500 text-xs mb-1", children: errors }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-2 items-center", children: [
      operation.operation === OperationType.Insert && /* @__PURE__ */ jsxRuntimeExports.jsx(
        InsertOperationFields,
        {
          operation,
          t: t2,
          onChange
        }
      ),
      operation.operation === OperationType.Replace && /* @__PURE__ */ jsxRuntimeExports.jsx(
        ReplaceOperationFields,
        {
          operation,
          t: t2,
          onChange
        }
      ),
      operation.operation === OperationType.AddDateTime && /* @__PURE__ */ jsxRuntimeExports.jsx(
        AddDateTimeOperationFields,
        {
          operation,
          t: t2,
          onChange
        }
      ),
      operation.operation === OperationType.Delete && /* @__PURE__ */ jsxRuntimeExports.jsx(
        DeleteOperationFields,
        {
          operation,
          t: t2,
          onChange
        }
      ),
      operation.operation === OperationType.ChangeCase && /* @__PURE__ */ jsxRuntimeExports.jsx(
        ChangeCaseOperationFields,
        {
          operation,
          t: t2,
          onChange
        }
      ),
      operation.operation === OperationType.AddAlphabetSequence && /* @__PURE__ */ jsxRuntimeExports.jsx(
        AddAlphabetSequenceOperationFields,
        {
          operation,
          t: t2,
          onChange
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "primary", radius: "md", size: "sm", variant: "flat", children: index2 + 1 }),
      onMoveUp && /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          size: "sm",
          variant: "light",
          onClick: () => onMoveUp(),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineUp, { className: "text-lg" })
        }
      ),
      onMoveDown && /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          size: "sm",
          variant: "light",
          onClick: () => onMoveDown(),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDown, { className: "text-lg" })
        }
      ),
      onCopy && /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, size: "sm", variant: "light", onClick: onCopy, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCopy, { className: "text-lg" }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "danger",
          size: "sm",
          variant: "light",
          onClick: onDelete,
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-lg" })
        }
      )
    ] })
  ] });
};
const PreviewItem = ({
  result,
  showFullPaths,
  commonPrefix: commonPrefix2
}) => {
  const originalDisplay = showFullPaths ? result.originalPath : result.originalFileName;
  const modifiedDisplay = showFullPaths ? result.modifiedPath : result.modifiedFileName;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: "flex items-center gap-1 flex-wrap",
      style: { fontSize: "12px" },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "opacity-60", title: originalDisplay, children: originalDisplay }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { className: "opacity-80", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineRightCircle, { className: "text-base" }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-blue-600", title: modifiedDisplay, children: result.modifiedFileName })
      ]
    }
  );
};
const PreviewList = ({
  results,
  showFullPaths,
  commonPrefix: commonPrefix2
}) => {
  const { t: t2 } = useTranslation();
  if (!results.length) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-gray-400 text-center py-5", children: t2("FileNameModifier.NoPreviewResults") });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "preview-list min-h-0 max-h-full overflow-y-auto", children: results.map((result, idx) => /* @__PURE__ */ jsxRuntimeExports.jsx(
    PreviewItem,
    {
      commonPrefix: commonPrefix2,
      result,
      showFullPaths
    },
    idx
  )) });
};
function useFileNameModifier(initialFilePaths = []) {
  const [operations, setOperations] = reactExports.useState([]);
  const [filePaths, setFilePaths] = reactExports.useState(initialFilePaths);
  const [previewResults, setPreviewResults] = reactExports.useState([]);
  const [error2, setError] = reactExports.useState("");
  reactExports.useEffect(() => {
    if (initialFilePaths.length > 0 && filePaths.length === 0) {
      setFilePaths(initialFilePaths);
    }
  }, [initialFilePaths, filePaths.length]);
  return {
    operations,
    setOperations,
    filePaths,
    setFilePaths,
    previewResults,
    setPreviewResults,
    error: error2,
    setError
    // ... 其它操作方法
  };
}
const defaultOperation = {
  target: 2,
  // FileNameWithoutExtension
  operation: 1,
  position: 1,
  positionIndex: 0,
  targetText: "",
  text: "",
  deleteCount: 0,
  deleteStartPosition: 0,
  caseType: 1,
  dateTimeFormat: "",
  alphabetStartChar: "A",
  alphabetCount: 0,
  replaceEntire: false
};
function validateOperation(op) {
  if (!op.target)
    return "FileNameModifier.Error.TargetRequired";
  if (!op.operation)
    return "FileNameModifier.Error.OperationTypeRequired";
  switch (op.operation) {
    case 1:
      if (!op.text && !op.targetText)
        return "FileNameModifier.Error.InsertTextRequired";
      break;
    case 2:
      if (!op.dateTimeFormat)
        return "FileNameModifier.Error.DateTimeFormatRequired";
      break;
    case 3:
      if (op.deleteCount == null || op.deleteStartPosition == null || !op.position)
        return "FileNameModifier.Error.DeleteParamsRequired";
      break;
    case 4:
      if (!op.text && !op.targetText)
        return "FileNameModifier.Error.ReplaceTextRequired";
      break;
    case 5:
      if (!op.caseType)
        return "FileNameModifier.Error.CaseTypeRequired";
      break;
    case 6:
      if (!op.alphabetStartChar || op.alphabetCount == null)
        return "FileNameModifier.Error.AlphabetParamsRequired";
      break;
    case 7:
      break;
    default:
      return "FileNameModifier.Error.UnknownOperationType";
  }
  return "";
}
const FileNameModifier = ({
  initialFilePaths = [],
  onClose
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const {
    operations,
    setOperations,
    filePaths,
    setFilePaths,
    previewResults,
    setPreviewResults,
    error: error2,
    setError
  } = useFileNameModifier(initialFilePaths);
  const [expandedItems, setExpandedItems] = reactExports.useState(/* @__PURE__ */ new Set());
  const [showTextarea, setShowTextarea] = reactExports.useState(false);
  const [showFullPaths, setShowFullPaths] = reactExports.useState(false);
  const [modifying, setModifying] = reactExports.useState(false);
  const handleOperationChange = (idx, op) => {
    setOperations((ops) => ops.map((item, i2) => i2 === idx ? op : item));
  };
  const handleOperationDelete = (idx) => {
    setOperations((ops) => ops.filter((_24, i2) => i2 !== idx));
  };
  const handleOperationMoveUp = (idx) => {
    setOperations((ops) => {
      if (idx === 0)
        return ops;
      const next2 = [...ops];
      if (next2[idx] && next2[idx - 1]) {
        const temp = {
          ...next2[idx - 1]
        };
        next2[idx - 1] = {
          ...next2[idx]
        };
        next2[idx] = temp;
      }
      return next2;
    });
  };
  const handleOperationMoveDown = (idx) => {
    setOperations((ops) => {
      if (idx === ops.length - 1)
        return ops;
      const next2 = [...ops];
      if (next2[idx] && next2[idx + 1]) {
        const temp = {
          ...next2[idx + 1]
        };
        next2[idx + 1] = {
          ...next2[idx]
        };
        next2[idx] = temp;
      }
      return next2;
    });
  };
  const handleOperationCopy = (idx) => {
    setOperations((ops) => {
      const next2 = [...ops];
      const copy2 = {
        ...ops[idx]
      };
      next2.splice(idx + 1, 0, copy2);
      return next2;
    });
  };
  const handleConfirmPaths = () => {
    const paths = filePaths.join("\n").split("\n").map((f2) => f2.trim()).filter(Boolean);
    setFilePaths(paths);
    setShowTextarea(false);
  };
  const handleShowFileListEdit = () => {
    setShowTextarea(true);
  };
  const handleDeduplicatePaths = () => {
    setFilePaths(
      (paths) => Array.from(new Set(paths.map((f2) => f2.trim()).filter(Boolean)))
    );
  };
  const commonPrefix2 = "";
  const debounceTimer = reactExports.useRef(null);
  reactExports.useEffect(() => {
    if (debounceTimer.current)
      clearTimeout(debounceTimer.current);
    if (filePaths.length === 0) {
      return;
    }
    const validOperations = operations.filter((op) => !validateOperation(op));
    debounceTimer.current = setTimeout(() => {
      (async () => {
        try {
          setError("");
          const rsp = await BApi$1.fileNameModifier.previewFileNameModification({
            filePaths,
            operations: validOperations
          });
          let modifiedPaths = rsp.data ?? [];
          const results = filePaths.map((originalPath, i2) => {
            const modifiedPath = modifiedPaths[i2] || originalPath;
            const getFileName = (p2) => p2.split(/[\\/]/).pop() || "";
            return {
              originalPath,
              modifiedPath,
              originalFileName: getFileName(originalPath),
              modifiedFileName: getFileName(modifiedPath),
              commonPrefix: "",
              originalRelative: "",
              modifiedRelative: ""
            };
          });
          setPreviewResults(results);
        } catch (e2) {
          setError((e2 == null ? void 0 : e2.message) || t2("FileNameModifier.PreviewFailed"));
        }
      })();
    }, 300);
  }, [filePaths, operations]);
  const handleExecuteModification = async () => {
    const validOperations = operations.filter((op) => !validateOperation(op));
    if (validOperations.length === 0) {
      setError(t2("FileNameModifier.Error.NoValidOperation"));
      return;
    }
    try {
      setModifying(true);
      setError("");
      const rsp = await BApi$1.fileNameModifier.modifyFileNames({
        filePaths,
        operations: validOperations
      });
      const result = rsp.data ?? [];
      createPortal(Modal, {
        defaultVisible: true,
        title: t2("FileNameModifier.ModificationResult"),
        size: "xl",
        footer: {
          actions: ["cancel"]
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-green-600 font-semibold mr-4", children: t2("FileNameModifier.ModificationSuccessCount", {
              count: result.filter((r2) => r2.success).length
            }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-red-600 font-semibold", children: t2("FileNameModifier.ModificationFailCount", {
              count: result.filter((r2) => !r2.success).length
            }) })
          ] }),
          result.filter((r2) => !r2.success).length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-h-48 overflow-y-auto border rounded p-2 bg-background border border-default", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold mb-1", children: t2("FileNameModifier.ModificationFailList") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "text-xs", children: result.filter((r2) => !r2.success).map((item) => /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "mb-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-foreground", children: item.oldPath }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-red-500 ml-2", children: [
                t2("FileNameModifier.ModificationFailReason"),
                ": ",
                item.error
              ] })
            ] }, item.oldPath)) })
          ] })
        ] })
      });
      setModifying(false);
    } catch (e2) {
      setModifying(false);
      setError((e2 == null ? void 0 : e2.message) || t2("FileNameModifier.ModificationFailed"));
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col min-h-0 grow md:flex-row gap-4", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { className: "flex-1 flex flex-col min-w-0 p-4", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("h5", { className: "font-semibold mb-2", children: t2("FileNameModifier.OperationsList") }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 overflow-y-auto rounded p-2", children: [
        operations.map((op, idx) => /* @__PURE__ */ jsxRuntimeExports.jsx(
          OperationCard,
          {
            "aria-label": t2("FileNameModifier.OperationCardAria", {
              index: idx + 1
            }),
            errors: validateOperation(op) ? t2(validateOperation(op)) : "",
            index: idx,
            operation: op,
            onChange: (op2) => handleOperationChange(idx, op2),
            onCopy: () => handleOperationCopy(idx),
            onDelete: () => handleOperationDelete(idx),
            onMoveDown: idx < operations.length - 1 ? () => handleOperationMoveDown(idx) : void 0,
            onMoveUp: idx > 0 ? () => handleOperationMoveUp(idx) : void 0
          },
          idx
        )),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            "aria-label": t2("FileNameModifier.AddOperation"),
            className: "w-full mt-2",
            variant: "light",
            onClick: () => setOperations((ops) => [...ops, { ...defaultOperation }]),
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-lg" }),
              t2("FileNameModifier.AddOperation")
            ]
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            "aria-label": t2("FileNameModifier.ExecuteModification"),
            color: "primary",
            isLoading: modifying,
            variant: "solid",
            onClick: handleExecuteModification,
            children: t2("FileNameModifier.ExecuteModification")
          }
        ) }),
        error2 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-red-500 text-xs mt-2", children: error2 })
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { className: "flex-1 flex flex-col min-w-0 p-4", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-2 flex justify-between items-center", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("h5", { className: "font-semibold mb-0 flex items-center gap-1", children: [
          showTextarea ? t2("FileNameModifier.EditFileList") : t2("FileNameModifier.PreviewResults"),
          !showTextarea && /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Button,
            {
              "aria-label": showFullPaths ? t2("FileNameModifier.HideFullPaths") : t2("FileNameModifier.ShowFullPaths"),
              className: "text-xs",
              size: "sm",
              variant: "light",
              onClick: () => setShowFullPaths(!showFullPaths),
              children: [
                showFullPaths ? /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEyeInvisible, { className: "text-base" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEye, { className: "text-base" }),
                showFullPaths ? t2("FileNameModifier.HideFullPaths") : t2("FileNameModifier.ShowFullPaths")
              ]
            }
          )
        ] }),
        !showTextarea && /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            "aria-label": t2("FileNameModifier.EditFileList"),
            size: "sm",
            variant: "light",
            onClick: handleShowFileListEdit,
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-base" }),
              t2("FileNameModifier.EditFileList")
            ]
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 rounded min-h-0", children: showTextarea ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col min-h-0", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          textarea_default,
          {
            "aria-label": t2("FileNameModifier.FilePathsTextarea"),
            maxRows: 15,
            minRows: 10,
            placeholder: t2("FileNameModifier.FilePathsPlaceholder"),
            value: filePaths.join("\n"),
            onValueChange: (e2) => setFilePaths(e2.split("\n"))
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex flex-wrap gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              "aria-label": t2("FileNameModifier.ConfirmPaths"),
              color: "primary",
              size: "sm",
              variant: "solid",
              onClick: handleConfirmPaths,
              children: t2("FileNameModifier.ConfirmPaths")
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              "aria-label": t2("FileNameModifier.Deduplicate"),
              color: "secondary",
              size: "sm",
              variant: "light",
              onClick: handleDeduplicatePaths,
              children: t2("FileNameModifier.Deduplicate")
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              "aria-label": t2("FileNameModifier.Cancel"),
              size: "sm",
              variant: "flat",
              onClick: () => setShowTextarea(false),
              children: t2("FileNameModifier.Cancel")
            }
          )
        ] })
      ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
        PreviewList,
        {
          commonPrefix: commonPrefix2,
          results: previewResults,
          showFullPaths
        }
      ) })
    ] })
  ] });
};
const BetaChip = ({
  className,
  size: size2 = "sm",
  variant = "flat",
  color: color2 = "warning",
  tooltipContent,
  showTooltip = true
}) => {
  const { t: t2 } = useTranslation();
  const defaultTooltipContent = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    t2(
      "This feature is in beta and may be unstable. Please report any issues you encounter."
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
    t2("BetaFeature.BackupWarning")
  ] });
  const chip2 = /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { className, color: color2, size: size2, variant, children: t2("Beta") });
  if (!showTooltip) {
    return chip2;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      color: "foreground",
      content: tooltipContent || defaultTooltipContent,
      placement: "top",
      children: chip2
    }
  );
};
BetaChip.displayName = "BetaChip";
const FileNameModifierModal = ({
  onClose,
  initialFilePaths = []
}) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: null,
      size: "xl",
      title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        t2("FileNameModifier.Title"),
        /* @__PURE__ */ jsxRuntimeExports.jsx(BetaChip, {})
      ] }),
      onClose,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(FileNameModifier, { initialFilePaths, onClose })
    }
  );
};
const getFileIcon = (item) => {
  if (item.isDirectory) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$F, { className: "text-lg" });
  } else {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$N, { className: "text-lg" });
  }
};
function PathAutocomplete({
  value: propsValue,
  defaultValue: defaultValue2,
  onChange,
  onSelectionChange,
  pathType = "folder",
  maxResults = 10,
  debounceDelay = 300,
  ...autocompleteProps
}) {
  const [autocompleteItems, setAutocompleteItems] = reactExports.useState([]);
  const [isLoading, setIsLoading] = reactExports.useState(false);
  const [value2, setValue] = reactExports.useState(propsValue ?? defaultValue2);
  const valueRef = reactExports.useRef(value2);
  const isFirstRender = reactExports.useRef(true);
  const searchPaths = reactExports.useCallback(
    (prefix) => {
      setIsLoading(true);
      const reqPrefix = prefix && prefix.length >= 1 ? prefix : void 0;
      BApi$1.file.searchFileSystemEntries({
        prefix: reqPrefix,
        maxResults
      }).then((response) => {
        if (response.data) {
          let filteredItems = response.data;
          if (pathType === "folder") {
            filteredItems = response.data.filter(
              (item) => item.isDirectory
            );
          }
          setAutocompleteItems(filteredItems);
        }
      }).finally(() => {
        setIsLoading(false);
      });
    },
    [pathType, maxResults]
  );
  useDebounce(
    () => {
      if (isFirstRender.current) {
        isFirstRender.current = false;
        return;
      }
      searchPaths(value2);
    },
    debounceDelay,
    [value2]
  );
  useUpdateEffect(() => {
    valueRef.current = value2;
  }, [value2]);
  useUpdateEffect(() => {
    setValue(propsValue);
  }, [propsValue]);
  useUpdateEffect(() => {
    searchPaths(valueRef.current);
  }, [pathType, maxResults]);
  const handleInputChange = (inputValue) => {
    const item = autocompleteItems.find((it) => it.path === inputValue);
    setValue(inputValue);
    onChange == null ? void 0 : onChange(
      inputValue,
      item ? item.isDirectory ? "folder" : "file" : void 0
    );
  };
  const handleSelectionChange = (key) => {
    if (key) {
      const selectedPath = key;
      const item = autocompleteItems.find((it) => it.path === selectedPath);
      const type4 = item.isDirectory ? "folder" : "file";
      setValue(selectedPath);
      onChange == null ? void 0 : onChange(selectedPath, type4);
      onSelectionChange == null ? void 0 : onSelectionChange(selectedPath, type4);
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    autocomplete_default,
    {
      ...autocompleteProps,
      allowsCustomValue: true,
      inputValue: value2,
      isLoading,
      items: autocompleteItems,
      onInputChange: handleInputChange,
      onOpenChange: (isOpen) => {
        if (isOpen && autocompleteItems.length == 0) {
          searchPaths(value2);
        }
      },
      onSelectionChange: handleSelectionChange,
      children: (item) => /* @__PURE__ */ jsxRuntimeExports.jsx(
        listbox_item_base_default,
        {
          startContent: getFileIcon(item),
          title: item.path
        },
        item.path
      )
    }
  );
}
const CustomPathSelectorInner = (props) => {
  var _a2;
  const { onSelect, mlPaths } = props;
  const { t: t2 } = useTranslation();
  const fsOptions = useFileSystemOptionsStore((state) => state);
  const paths = ((_a2 = fsOptions.data) == null ? void 0 : _a2.recentMovingDestinations) ?? [];
  const [manualPath, setManualPath] = reactExports.useState("");
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap items-center gap-1", children: paths.map((p2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-0", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "default",
            size: "sm",
            variant: "light",
            onPress: () => {
              navigator.clipboard.writeText(p2);
              toast.success(t2("Path copied to clipboard"));
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCopy, { className: "text-lg" })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "danger",
            size: "sm",
            variant: "light",
            onPress: async () => {
              await fsOptions.patch({
                recentMovingDestinations: paths.filter((p22) => p22 !== p22)
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-lg" })
          }
        )
      ] }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          color: mlPaths.has(p2) ? "success" : "primary",
          size: "sm",
          variant: "light",
          onClick: () => onSelect(p2),
          children: p2
        },
        p2
      ) }) }, p2);
    }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        PathAutocomplete,
        {
          pathType: "folder",
          placeholder: t2("Manually enter a path"),
          size: "sm",
          value: manualPath,
          onChange: setManualPath
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "success",
          size: "sm",
          variant: "flat",
          onPress: () => onSelect(manualPath),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheck, { className: "text-lg" })
        }
      )
    ] })
  ] });
};
const MediaLibraryPathSelectorInner = (props) => {
  const { t: t2 } = useTranslation();
  const { onSelect } = props;
  const [mediaLibraries, setMediaLibraries] = reactExports.useState([]);
  reactExports.useEffect(() => {
    BApi$1.mediaLibraryV2.getAllMediaLibraryV2().then((r2) => {
      var _a2;
      setMediaLibraries(r2.data ?? []);
      props.onPathsLoaded(new Set(((_a2 = r2.data) == null ? void 0 : _a2.flatMap((ml2) => ml2.paths ?? [])) ?? []));
    });
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid gap-x-2 items-center", style: { gridTemplateColumns: "auto 1fr" }, children: mediaLibraries.map((ml2) => {
    var _a2;
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { variant: "light", children: ml2.name }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: (_a2 = ml2.paths) == null ? void 0 : _a2.map((p2) => {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "default",
            size: "sm",
            variant: "light",
            onPress: () => {
              navigator.clipboard.writeText(p2);
              toast.success(t2("Path copied to clipboard"));
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCopy, { className: "text-lg" })
          }
        ) }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "success",
            size: "sm",
            variant: "light",
            onPress: () => onSelect(p2, ml2.id),
            children: p2
          },
          p2
        ) });
      }) })
    ] });
  }) });
};
const FolderSelectorInner = ({ sources, onSelect: propsOnSelect }) => {
  const { t: t2 } = useTranslation();
  const [mlPaths, setMlPaths] = reactExports.useState(/* @__PURE__ */ new Set());
  const onSelect = async (path) => {
    await BApi$1.options.addLatestMovingDestination(path);
    propsOnSelect(path);
  };
  const onPathsLoaded = (paths) => {
    setMlPaths(paths);
  };
  const renderSourceInner = (source2) => {
    switch (source2) {
      case "media library":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          MediaLibraryPathSelectorInner,
          {
            onSelect,
            onPathsLoaded
          }
        );
      case "custom":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(CustomPathSelectorInner, { onSelect, mlPaths });
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(accordion_default, { hideIndicator: true, selectedKeys: sources.map((s2) => s2), variant: "splitted", children: sources.map((s2) => {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(accordion_item_base_default, { "aria-label": t2(s2), title: t2(s2), children: renderSourceInner(s2) }, s2);
  }) });
};
const FolderSelector = (props) => {
  const { t: t2 } = useTranslation();
  const { sources, onSelect: propsOnSelect, onDestroyed } = props;
  const [visible, setVisible] = reactExports.useState(true);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      footer: false,
      size: "lg",
      visible,
      onClose: () => setVisible(false),
      title: t2("Select Path"),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        FolderSelectorInner,
        {
          sources,
          onSelect: async (path) => {
            propsOnSelect(path);
            setVisible(false);
          }
        }
      )
    }
  );
};
function CgNotes(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none" }, "child": [{ "tag": "path", "attr": { "d": "M6 6C6 5.44772 6.44772 5 7 5H17C17.5523 5 18 5.44772 18 6C18 6.55228 17.5523 7 17 7H7C6.44771 7 6 6.55228 6 6Z", "fill": "currentColor" }, "child": [] }, { "tag": "path", "attr": { "d": "M6 10C6 9.44771 6.44772 9 7 9H17C17.5523 9 18 9.44771 18 10C18 10.5523 17.5523 11 17 11H7C6.44771 11 6 10.5523 6 10Z", "fill": "currentColor" }, "child": [] }, { "tag": "path", "attr": { "d": "M7 13C6.44772 13 6 13.4477 6 14C6 14.5523 6.44771 15 7 15H17C17.5523 15 18 14.5523 18 14C18 13.4477 17.5523 13 17 13H7Z", "fill": "currentColor" }, "child": [] }, { "tag": "path", "attr": { "d": "M6 18C6 17.4477 6.44772 17 7 17H11C11.5523 17 12 17.4477 12 18C12 18.5523 11.5523 19 11 19H7C6.44772 19 6 18.5523 6 18Z", "fill": "currentColor" }, "child": [] }, { "tag": "path", "attr": { "fillRule": "evenodd", "clipRule": "evenodd", "d": "M2 4C2 2.34315 3.34315 1 5 1H19C20.6569 1 22 2.34315 22 4V20C22 21.6569 20.6569 23 19 23H5C3.34315 23 2 21.6569 2 20V4ZM5 3H19C19.5523 3 20 3.44771 20 4V20C20 20.5523 19.5523 21 19 21H5C4.44772 21 4 20.5523 4 20V4C4 3.44772 4.44771 3 5 3Z", "fill": "currentColor" }, "child": [] }] })(props);
}
function ImMoveUp(props) {
  return GenIcon({ "attr": { "version": "1.1", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M11 8v6h1v-6h2.5l-3-3-3 3z" }, "child": [] }, { "tag": "path", "attr": { "d": "M1 3h1.5v1h-1.5v-1z" }, "child": [] }, { "tag": "path", "attr": { "d": "M3 3h1.5v1h-1.5v-1z" }, "child": [] }, { "tag": "path", "attr": { "d": "M5 3h1v1.5h-1v-1.5z" }, "child": [] }, { "tag": "path", "attr": { "d": "M1 6.5h1v1.5h-1v-1.5z" }, "child": [] }, { "tag": "path", "attr": { "d": "M2.5 7h1.5v1h-1.5v-1z" }, "child": [] }, { "tag": "path", "attr": { "d": "M4.5 7h1.5v1h-1.5v-1z" }, "child": [] }, { "tag": "path", "attr": { "d": "M1 4.5h1v1.5h-1v-1.5z" }, "child": [] }, { "tag": "path", "attr": { "d": "M5 5h1v1.5h-1v-1.5z" }, "child": [] }, { "tag": "path", "attr": { "d": "M5 11v3h-3v-3h3zM6 10h-5v5h5v-5z" }, "child": [] }] })(props);
}
function ImEmbed(props) {
  return GenIcon({ "attr": { "version": "1.1", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M9 11.5l1.5 1.5 5-5-5-5-1.5 1.5 3.5 3.5z" }, "child": [] }, { "tag": "path", "attr": { "d": "M7 4.5l-1.5-1.5-5 5 5 5 1.5-1.5-3.5-3.5z" }, "child": [] }] })(props);
}
const DetectCompressedFilesModal = ({ paths = [], onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const [visible, setVisible] = reactExports.useState(true);
  const [detecting, setDetecting] = reactExports.useState(false);
  const includeUnknownFilesRef = reactExports.useRef(false);
  const unknownFilesMinMbRef = reactExports.useRef(0);
  const [includeUnknownFiles, setIncludeUnknownFiles] = reactExports.useState(
    includeUnknownFilesRef.current
  );
  const [unknownFilesMinMb, setUnknownFilesMinMb] = reactExports.useState(
    unknownFilesMinMbRef.current
  );
  const [onFailureContinue, setOnFailureContinue] = reactExports.useState(true);
  const abortDetectingRef = reactExports.useRef(null);
  const abortDecompressingRef = reactExports.useRef(null);
  const [globalOperation, setGlobalOperation] = reactExports.useState({
    decompressToNewFolder: true,
    deleteAfterDecompression: false,
    moveToParent: false,
    overwriteExistFiles: false
  });
  const [operationMap, setOperationMap] = reactExports.useState({});
  const { createPortal } = useBakabaseContext();
  const [results, setResults] = reactExports.useState([]);
  const tableRef = reactExports.useRef(null);
  const cache2 = reactExports.useMemo(
    () => new CellMeasurerCache({
      fixedWidth: true,
      defaultHeight: 150,
      minHeight: 50
    }),
    []
  );
  reactExports.useEffect(() => {
    if (results.length > 0) {
      cache2.clearAll();
      if (tableRef.current) {
        tableRef.current.recomputeRowHeights();
        tableRef.current.forceUpdateGrid();
      }
    }
  }, [results, cache2]);
  const startDetecting = reactExports.useCallback(async () => {
    if (!paths || paths.length === 0)
      return;
    setDetecting(true);
    setResults([]);
    const controller = new AbortController();
    abortDetectingRef.current = controller;
    try {
      const url2 = BApi$1.file.detectCompressedFilesUrl();
      const resp = await fetch(url2, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({
          paths,
          includeUnknownFiles: includeUnknownFilesRef.current,
          unknownFilesMinMb: includeUnknownFilesRef.current ? unknownFilesMinMbRef.current : void 0
        }),
        signal: controller.signal
      });
      if (!resp.ok || !resp.body) {
        throw new Error(`Request failed: ${resp.status}`);
      }
      const reader = resp.body.getReader();
      const decoder = new TextDecoder();
      let buffer = "";
      while (true) {
        const { value: value2, done } = await reader.read();
        if (done)
          break;
        buffer += decoder.decode(value2, { stream: true });
        let idx;
        while ((idx = buffer.indexOf("\n")) >= 0) {
          const line2 = buffer.slice(0, idx).trim();
          buffer = buffer.slice(idx + 1);
          if (!line2)
            continue;
          const result = JSON.parse(line2);
          setResults((prev2) => {
            const idx2 = prev2.findIndex((r2) => r2.key === result.key);
            const next2 = [...prev2];
            if (idx2 >= 0) {
              const existed = next2[idx2] || {};
              const mapped = {
                ...Object.fromEntries(
                  Object.entries(result).filter(
                    ([k2, v2]) => k2 !== "status" && k2 !== "message" && v2 !== null && v2 !== void 0 && v2 !== ""
                  )
                )
              };
              if (result.status !== void 0) {
                mapped.detectionStatus = result.status;
              }
              if (result.message !== void 0 && result.message !== "") {
                mapped.detectionMessage = result.message;
              }
              next2[idx2] = {
                ...existed,
                ...mapped
              };
              cache2.clear(idx2, 0);
            } else {
              const mapped = {
                ...result,
                detectionMessage: result.message,
                detectionStatus: result.status,
                index: next2.length
              };
              next2.push(mapped);
            }
            return next2;
          });
          setTimeout(() => {
            if (tableRef.current) {
              tableRef.current.recomputeRowHeights();
              tableRef.current.forceUpdate();
            }
          }, 0);
        }
      }
    } catch (e2) {
      toast.danger(e2 instanceof Error ? e2.message : "Unknown error");
    } finally {
      setDetecting(false);
      abortDetectingRef.current = null;
    }
  }, [paths, cache2]);
  const stopDetecting = reactExports.useCallback(() => {
    var _a2;
    (_a2 = abortDetectingRef.current) == null ? void 0 : _a2.abort();
    abortDetectingRef.current = null;
    setDetecting(false);
  }, []);
  const close = reactExports.useCallback(() => {
    stopDetecting();
    setVisible(false);
  }, [stopDetecting]);
  const startDecompressing = reactExports.useCallback(async () => {
    const detectedItems2 = results.filter(
      (r2) => r2.detectionStatus === CompressedFileDetectionResultStatus.Complete
    );
    if (detectedItems2.length === 0)
      return;
    const dangerousItems = detectedItems2.filter((item) => {
      const op = operationMap[item.key] ?? globalOperation;
      return op.moveToParent && !op.decompressToNewFolder;
    });
    if (dangerousItems.length > 0) {
      const confirmed = await new Promise((resolve2) => {
        createPortal(Modal, {
          defaultVisible: true,
          size: "lg",
          title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 text-warning", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineWarning, { className: "text-2xl" }),
            t2("Warning")
          ] }),
          footer: {
            actions: ["ok", "cancel"],
            okProps: {
              children: t2("Continue anyway"),
              color: "danger"
            },
            cancelProps: {
              children: t2("Cancel"),
              color: "default",
              variant: "light"
            }
          },
          onOk: () => {
            resolve2(true);
          },
          onClose: () => {
            resolve2(false);
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-base", children: t2(
              "You have set 'Move to parent directory' without 'Extract to new directory' for {{count}} item(s). This is a dangerous combination that may cause unexpected behavior:",
              { count: dangerousItems.length }
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "list-disc list-inside space-y-1 text-sm text-danger", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("All file system entries in the same directory will be moved to parent folder") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("Pending compressed files may be moved before decompression, causing failures") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("The final file structure may be completely messed up") })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-primary-50 dark:bg-primary-900/20 border-l-4 border-primary p-3 rounded", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-sm text-foreground-600", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-semibold", children: t2("Tip:") }),
              " ",
              t2("However, for some cases we recommend users to make this choice. Please make sure you clearly understand what will happen.")
            ] }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-base font-semibold", children: t2("Are you sure you want to continue?") })
          ] })
        });
      });
      if (!confirmed) {
        return;
      }
    }
    const controller = new AbortController();
    abortDecompressingRef.current = controller;
    try {
      const url2 = BApi$1.file.decompressCompressedFilesUrl();
      const items = detectedItems2.map((item) => {
        const op = operationMap[item.key] ?? globalOperation;
        return {
          key: item.key,
          directory: item.directory,
          files: item.files,
          password: item.password,
          decompressToNewFolder: op.decompressToNewFolder,
          deleteAfterDecompression: op.deleteAfterDecompression,
          moveToParent: op.moveToParent,
          overwriteExistFiles: op.overwriteExistFiles
        };
      });
      const resp = await fetch(url2, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({
          items,
          onFailureContinue
        }),
        signal: controller.signal
      });
      if (!resp.ok || !resp.body) {
        throw new Error(`Request failed: ${resp.status}`);
      }
      const reader = resp.body.getReader();
      const decoder = new TextDecoder();
      let buffer = "";
      while (true) {
        const { value: value2, done } = await reader.read();
        if (done)
          break;
        buffer += decoder.decode(value2, { stream: true });
        let idx;
        while ((idx = buffer.indexOf("\n")) >= 0) {
          const line2 = buffer.slice(0, idx).trim();
          buffer = buffer.slice(idx + 1);
          if (!line2)
            continue;
          const update = JSON.parse(line2);
          setResults((prev2) => {
            const idx2 = prev2.findIndex((r2) => r2.key === update.key);
            if (idx2 >= 0) {
              const next2 = [...prev2];
              const mapped = {
                ...Object.fromEntries(
                  Object.entries(update).filter(
                    ([k2, v2]) => k2 !== "status" && k2 !== "percentage" && k2 !== "message" && v2 !== null && v2 !== void 0 && v2 !== ""
                  )
                )
              };
              if (update.status !== void 0) {
                mapped.decompressionStatus = update.status;
              }
              if (update.percentage !== void 0) {
                mapped.decompressionPercentage = update.percentage;
              }
              if (update.message !== void 0 && update.message !== "") {
                mapped.decompressionMessage = update.message;
              }
              next2[idx2] = {
                ...next2[idx2],
                ...mapped
              };
              cache2.clear(idx2, 0);
              return next2;
            }
            return prev2;
          });
          setTimeout(() => {
            if (tableRef.current) {
              tableRef.current.recomputeRowHeights();
              tableRef.current.forceUpdate();
            }
          }, 0);
        }
      }
      toast.success(t2("Decompression task completed"));
    } catch (e2) {
      if (e2 instanceof Error && e2.name !== "AbortError") {
        toast.danger(e2.message);
      }
    } finally {
      abortDecompressingRef.current = null;
    }
  }, [results, operationMap, globalOperation, onFailureContinue, t2, cache2]);
  reactExports.useEffect(() => {
    return () => stopDetecting();
  }, []);
  const renderDetectionStatus = reactExports.useCallback((result) => {
    switch (result.detectionStatus) {
      case CompressedFileDetectionResultStatus.Init:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "default", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFieldTime, { className: "text-lg" }) });
      case CompressedFileDetectionResultStatus.Inprogress:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "primary", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { color: "primary", labelColor: "foreground", size: "sm" }),
          result.decompressionPercentage !== void 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
            result.decompressionPercentage,
            "%"
          ] })
        ] }) });
      case CompressedFileDetectionResultStatus.Complete:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheckCircle, { className: "text-lg" }) });
      case CompressedFileDetectionResultStatus.Error:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "danger", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineWarning, { className: "text-lg" }) });
    }
  }, []);
  const renderDecompressionStatus = reactExports.useCallback((result) => {
    switch (result.decompressionStatus) {
      case DecompressionStatus.Pending:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "default", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFieldTime, { className: "text-lg" }) });
      case DecompressionStatus.Decompressing:
        return (
          // <Chip color="default" variant="light">
          //   <Spinner color="default" labelColor="foreground" size="sm" />
          // </Chip>
          /* @__PURE__ */ jsxRuntimeExports.jsx(circular_progress_default, { size: "sm", showValueLabel: true, value: result.decompressionPercentage })
        );
      case DecompressionStatus.Success:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheckCircle, { className: "text-lg" }) });
      case DecompressionStatus.Error:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "danger", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineWarning, { className: "text-lg" }) });
    }
  }, []);
  const renderOperations = reactExports.useCallback(
    (decompressToNewFolder, setDecompressToNewFolder, deleteAfterDecompression, setDeleteAfterDecompression, moveToParent, setMoveToParent, overwriteExistFiles, setOverwriteExistFiles, showTooltip) => {
      const decompressToNewFolderBtn = /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          className: decompressToNewFolder ? "" : "opacity-30",
          color: decompressToNewFolder ? "primary" : "default",
          size: "sm",
          variant: "light",
          onPress: () => setDecompressToNewFolder(!decompressToNewFolder),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolderAdd, { className: "text-xl" })
        }
      );
      const deleteAfterDecompressionBtn = /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          className: deleteAfterDecompression ? "" : "opacity-30",
          color: deleteAfterDecompression ? "danger" : "default",
          size: "sm",
          variant: "light",
          onPress: () => setDeleteAfterDecompression(!deleteAfterDecompression),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-xl" })
        }
      );
      const moveToParentBtn = /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          className: moveToParent ? "" : "opacity-30",
          color: moveToParent ? "success" : "default",
          size: "sm",
          variant: "light",
          onPress: () => setMoveToParent(!moveToParent),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(ImMoveUp, { className: "text-xl" })
        }
      );
      const overwriteExistFilesBtn = /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          className: overwriteExistFiles ? "" : "opacity-30",
          color: overwriteExistFiles ? "warning" : "default",
          size: "sm",
          variant: "light",
          onPress: () => setOverwriteExistFiles(!overwriteExistFiles),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFileSync, { className: "text-xl" })
        }
      );
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-0", children: showTooltip ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { className: "max-w-[320px]", color: "primary", content: t2("Extract to new directory(we will use file name without extension as the new directory name)"), children: decompressToNewFolderBtn }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { className: "max-w-[320px]", color: "danger", content: t2("Delete the source file after decompression"), children: deleteAfterDecompressionBtn }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { className: "max-w-[320px]", color: "success", content: t2("Move all files and folders located in the extraction target directory to the parent directory of the compressed file. Note that any files or folders not contained in the compressed file, but present in the directory where the compressed file is being extracted, will also be moved to the parent directory."), children: moveToParentBtn }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { className: "max-w-[320px]", color: "warning", content: t2("Overwrite existing files"), children: overwriteExistFilesBtn })
      ] }) : [decompressToNewFolderBtn, deleteAfterDecompressionBtn, moveToParentBtn, overwriteExistFilesBtn] });
    },
    []
  );
  console.log(results);
  const detectedItems = results.filter(
    (r2) => r2.detectionStatus == CompressedFileDetectionResultStatus.Complete
  );
  const someNotDecompressToNewFolder = _$2.values(operationMap).some((a2) => !a2.decompressToNewFolder);
  const someNotDeleteAfterDecompression = _$2.values(operationMap).some((a2) => !a2.deleteAfterDecompression);
  const someNotMoveToParent = _$2.values(operationMap).some((a2) => !a2.moveToParent);
  const someNotOverwriteExistFiles = _$2.values(operationMap).some((a2) => !a2.overwriteExistFiles);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      className: "max-w-[95vw] max-h-[90vh]",
      footer: false,
      size: "xl",
      title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        t2("Compressed files handling"),
        /* @__PURE__ */ jsxRuntimeExports.jsx(BetaChip, {})
      ] }),
      visible,
      onClose: () => {
        var _a2;
        if (detecting || abortDecompressingRef.current) {
          if (!confirm(t2("A task is running. Close and cancel it?")))
            return;
          stopDetecting();
          (_a2 = abortDecompressingRef.current) == null ? void 0 : _a2.abort();
          abortDecompressingRef.current = null;
        }
        close();
      },
      onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              checkbox_default,
              {
                isSelected: includeUnknownFiles,
                size: "sm",
                onValueChange: (selected) => {
                  includeUnknownFilesRef.current = selected;
                  setIncludeUnknownFiles(selected);
                  if (!selected) {
                    unknownFilesMinMbRef.current = void 0;
                    setUnknownFilesMinMb(void 0);
                  } else if (unknownFilesMinMbRef.current === void 0) {
                    const defaultValue2 = 10;
                    unknownFilesMinMbRef.current = defaultValue2;
                    setUnknownFilesMinMb(defaultValue2);
                  }
                },
                children: t2("Include unknown extensions")
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              number_input_default,
              {
                isClearable: true,
                className: "w-[400px]",
                isDisabled: !includeUnknownFiles,
                label: t2("Unknown extensions min size (MB)"),
                placeholder: t2("Optional"),
                size: "sm",
                value: unknownFilesMinMb,
                onValueChange: (v2) => {
                  unknownFilesMinMbRef.current = v2;
                  setUnknownFilesMinMb(v2);
                  if (v2 === void 0) {
                    includeUnknownFilesRef.current = false;
                    setIncludeUnknownFiles(false);
                  } else if (!includeUnknownFilesRef.current) {
                    includeUnknownFilesRef.current = true;
                    setIncludeUnknownFiles(true);
                  }
                }
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: !detecting ? /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              onPress: () => {
                startDetecting();
              },
              children: t2("Detect compressed files")
            }
          ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { color: "danger", variant: "light", onPress: stopDetecting, children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1i, { className: "text-lg" }),
            t2("Stop")
          ] }) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow h-[65vh] max-h-[65vh] border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AutoSizer, { children: ({ height, width }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Table,
          {
            ref: tableRef,
            deferredMeasurementCache: cache2,
            headerClassName: "bg-default-100 dark:bg-default-50/10 font-medium border-b border-divider text-sm",
            headerHeight: 40,
            height,
            noRowsRenderer: () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full text-gray-500", children: t2("No compressed files detected") }),
            rowClassName: ({ index: index2 }) => index2 >= 0 ? "transition-colors hover:bg-primary-50/30 dark:hover:bg-primary-900/20 border-b border-divider/50" : "",
            rowCount: results.length,
            rowGetter: ({ index: index2 }) => results[index2],
            rowHeight: cache2.rowHeight,
            width,
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Column,
                {
                  cellRenderer: ({ rowData }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center px-2 py-2", children: rowData.index + 1 }),
                  dataKey: "index",
                  headerClassName: "flex items-center justify-center",
                  label: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-8 flex items-center justify-center", children: t2("#") }),
                  width: 60
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Column,
                {
                  cellRenderer: ({ rowData: result, parent, rowIndex }) => {
                    var _a2, _b2;
                    return /* @__PURE__ */ jsxRuntimeExports.jsx(
                      CellMeasurer,
                      {
                        cache: cache2,
                        columnIndex: 0,
                        parent,
                        rowIndex,
                        children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
                          "div",
                          {
                            className: "flex flex-col gap-0.5 py-2 px-2 overflow-hidden",
                            style: { width: "100%" },
                            children: [
                              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                                /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolder, { className: "text-lg" }),
                                result.directory
                              ] }) }),
                              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start", children: [
                                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEnter, { className: "text-lg scale-x-[-1]" }) }) }),
                                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1 max-h-[100px] overflow-y-auto", children: (_a2 = result.files) == null ? void 0 : _a2.map((f2, fileIdx) => {
                                    var _a3;
                                    return /* @__PURE__ */ jsxRuntimeExports.jsx(
                                      Chip,
                                      {
                                        color: result.status === CompressedFileDetectionResultStatus.Error ? "danger" : "default",
                                        size: "sm",
                                        variant: "light",
                                        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                                          /* @__PURE__ */ jsxRuntimeExports.jsx(
                                            FileSystemEntryIcon,
                                            {
                                              path: `${result.directory}/${f2}`,
                                              size: 18,
                                              type: IconType.Dynamic
                                            }
                                          ),
                                          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: f2 }),
                                          typeof ((_a3 = result.fileSizes) == null ? void 0 : _a3[fileIdx]) === "number" && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "light", children: humanFileSize(result.fileSizes[fileIdx] ?? 0, false, 2) })
                                        ] })
                                      },
                                      f2
                                    );
                                  }) }),
                                  result.status === CompressedFileDetectionResultStatus.Complete && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineRightCircle, { className: "text-lg" }) }),
                                    ((_b2 = operationMap[result.key] ?? globalOperation) == null ? void 0 : _b2.decompressToNewFolder) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                                      /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineCreateNewFolder, { className: "text-lg" }),
                                      result.decompressToDirName
                                    ] }) }) }),
                                    result.contentSampleGroups && result.contentSampleGroups.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-1 items-center", children: [
                                      "/",
                                      result.contentSampleGroups.map(
                                        (g2, gi2) => {
                                          var _a3, _b3, _c2;
                                          const restFileCount = g2.count - (((_a3 = g2.samples) == null ? void 0 : _a3.length) ?? 0);
                                          const sampleFilesText = (_b3 = g2.samples) == null ? void 0 : _b3.join(", ");
                                          return /* @__PURE__ */ jsxRuntimeExports.jsx(
                                            Chip,
                                            {
                                              size: "sm",
                                              variant: "flat",
                                              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                                                /* @__PURE__ */ jsxRuntimeExports.jsx(
                                                  FileSystemEntryIcon,
                                                  {
                                                    size: 18,
                                                    type: g2.isFile ? IconType.Dynamic : IconType.Directory
                                                  }
                                                ),
                                                restFileCount > 0 ? t2(
                                                  "{{sampleFilesText}} and {{restFileCount}} more"
                                                ) : sampleFilesText
                                              ] })
                                            },
                                            ((_c2 = g2.samples) == null ? void 0 : _c2[0]) ?? gi2
                                          );
                                        }
                                      )
                                    ] })
                                  ] })
                                ] })
                              ] })
                            ]
                          }
                        )
                      },
                      result.key
                    );
                  },
                  dataKey: "files",
                  flexGrow: 1,
                  headerClassName: "flex items-center justify-start",
                  label: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-8 flex items-center", children: t2("Files") }),
                  width: width * 0.4
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Column,
                {
                  cellRenderer: ({ rowData: result }) => {
                    var _a2, _b2;
                    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center px-2 py-2", children: [
                      result.password && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheckCircle, { className: "text-lg" }), children: result.password }),
                      (_a2 = result.candidatePasswords) == null ? void 0 : _a2.map((cp) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", children: cp }, cp)),
                      (_b2 = result.wrongPasswords) == null ? void 0 : _b2.map((wp) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { className: "line-through", size: "sm", variant: "light", children: wp }, wp))
                    ] });
                  },
                  dataKey: "password",
                  headerClassName: "flex items-center justify-start",
                  label: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-8 flex items-center", children: t2("Password") }),
                  width: 150
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Column,
                {
                  cellRenderer: ({ rowData: result }) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center px-2 py-2", children: [
                    renderDetectionStatus(result),
                    result.detectionMessage && /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Button,
                      {
                        isIconOnly: true,
                        size: "sm",
                        variant: "light",
                        onPress: () => {
                          createPortal(Modal, {
                            defaultVisible: true,
                            size: "xl",
                            title: t2("Message"),
                            children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "whitespace-pre-wrap", children: result.detectionMessage })
                          });
                        },
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(CgNotes, { className: "text-lg" })
                      }
                    )
                  ] }),
                  dataKey: "detectionStatus",
                  headerClassName: "flex items-center justify-center",
                  label: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-8 flex items-center justify-center", children: t2("Detection") }),
                  width: 120
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Column,
                {
                  cellRenderer: ({ rowData: result }) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center px-2 py-2", children: [
                    renderDecompressionStatus(result),
                    result.decompressionMessage && /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Button,
                      {
                        isIconOnly: true,
                        size: "sm",
                        variant: "light",
                        onPress: () => {
                          createPortal(Modal, {
                            defaultVisible: true,
                            size: "xl",
                            title: t2("Message"),
                            children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "whitespace-pre-wrap", children: result.decompressionMessage })
                          });
                        },
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(CgNotes, { className: "text-lg" })
                      }
                    )
                  ] }),
                  dataKey: "decompressionStatus",
                  headerClassName: "flex items-center justify-center",
                  label: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-8 flex items-center justify-center", children: t2("Decompression") }),
                  width: 120
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Column,
                {
                  cellRenderer: ({ rowData: result }) => {
                    var _a2, _b2, _c2, _d;
                    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 px-2 py-2", children: [
                      result.detectionStatus === CompressedFileDetectionResultStatus.Complete && renderOperations(
                        ((_a2 = operationMap[result.key]) == null ? void 0 : _a2.decompressToNewFolder) ?? globalOperation.decompressToNewFolder,
                        (v2) => {
                          setOperationMap((prev2) => ({
                            ...prev2,
                            [result.key]: { ...prev2[result.key], decompressToNewFolder: v2 }
                          }));
                        },
                        ((_b2 = operationMap[result.key]) == null ? void 0 : _b2.deleteAfterDecompression) ?? globalOperation.deleteAfterDecompression,
                        (v2) => {
                          setOperationMap((prev2) => ({
                            ...prev2,
                            [result.key]: { ...prev2[result.key], deleteAfterDecompression: v2 }
                          }));
                        },
                        ((_c2 = operationMap[result.key]) == null ? void 0 : _c2.moveToParent) ?? globalOperation.moveToParent,
                        (v2) => {
                          setOperationMap((prev2) => ({
                            ...prev2,
                            [result.key]: { ...prev2[result.key], moveToParent: v2 }
                          }));
                        },
                        ((_d = operationMap[result.key]) == null ? void 0 : _d.overwriteExistFiles) ?? globalOperation.overwriteExistFiles,
                        (v2) => {
                          setOperationMap((prev2) => ({
                            ...prev2,
                            [result.key]: { ...prev2[result.key], overwriteExistFiles: v2 }
                          }));
                        },
                        false
                      ),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        Button,
                        {
                          isIconOnly: true,
                          size: "sm",
                          variant: "light",
                          onPress: () => {
                            BApi$1.tool.openFileOrDirectory({
                              path: result.directory
                            });
                          },
                          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolderOpen, { className: "text-lg" })
                        }
                      )
                    ] });
                  },
                  dataKey: "operations",
                  headerClassName: "flex items-center justify-start",
                  label: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-8 flex items-center gap-2 px-2", children: renderOperations(
                    someNotDecompressToNewFolder ? false : globalOperation.decompressToNewFolder,
                    (v2) => {
                      setGlobalOperation((prev2) => ({ ...prev2, decompressToNewFolder: v2 }));
                      setOperationMap((prev2) => {
                        for (const key in prev2) {
                          prev2[key] = { ...prev2[key], decompressToNewFolder: v2 };
                        }
                        return prev2;
                      });
                    },
                    someNotDeleteAfterDecompression ? false : globalOperation.deleteAfterDecompression,
                    (v2) => {
                      setGlobalOperation((prev2) => ({ ...prev2, deleteAfterDecompression: v2 }));
                      setOperationMap((prev2) => {
                        for (const key in prev2) {
                          prev2[key] = { ...prev2[key], deleteAfterDecompression: v2 };
                        }
                        return prev2;
                      });
                    },
                    someNotMoveToParent ? false : globalOperation.moveToParent,
                    (v2) => {
                      setGlobalOperation((prev2) => ({ ...prev2, moveToParent: v2 }));
                      setOperationMap((prev2) => {
                        for (const key in prev2) {
                          prev2[key] = { ...prev2[key], moveToParent: v2 };
                        }
                        return prev2;
                      });
                    },
                    someNotOverwriteExistFiles ? false : globalOperation.overwriteExistFiles,
                    (v2) => {
                      setGlobalOperation((prev2) => ({ ...prev2, overwriteExistFiles: v2 }));
                      setOperationMap((prev2) => {
                        for (const key in prev2) {
                          prev2[key] = { ...prev2[key], overwriteExistFiles: v2 };
                        }
                        return prev2;
                      });
                    },
                    true
                  ) }),
                  width: 260
                }
              )
            ]
          }
        ) }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 ", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              checked: onFailureContinue,
              size: "sm",
              type: "checkbox",
              onChange: (e2) => setOnFailureContinue(e2.currentTarget.checked),
              children: t2("Continue on failure")
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              className: detecting || detectedItems.length == 0 ? "cursor-not-allowed" : "",
              color: "primary",
              isDisabled: detecting || detectedItems.length == 0,
              onPress: () => {
                startDecompressing();
              },
              children: detecting ? t2("Waiting for detection to complete...") : detectedItems.length == 0 ? t2("No compressed files detected") : t2("Decompress all successfully detected")
            }
          ) })
        ] })
      ] })
    }
  );
};
DetectCompressedFilesModal.displayName = "DetectCompressedFilesModal";
const ContextMenu = ({ selectedEntries, capabilities, root: root2 }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const items = [];
  console.log(selectedEntries);
  if (selectedEntries.length > 0) {
    const decompressableEntries = selectedEntries.filter(
      (x2) => x2.actions.includes(IwFsEntryAction.Decompress)
    );
    const expandableEntries = selectedEntries.filter((x2) => x2.expandable && !x2.expanded);
    const collapsableEntries = selectedEntries.filter((x2) => x2.expandable && x2.expanded);
    const directoryEntries = selectedEntries.filter((e2) => e2.type == IwFsType.Directory);
    if (expandableEntries.length > 0) {
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Z, { className: "text-base" }),
        label: t2(selectedEntries.length == 1 ? "Expand" : "Expand selected"),
        onClick: () => {
          for (const entry of expandableEntries) {
            entry.expand(false);
          }
        }
      });
    }
    if (collapsableEntries.length > 0) {
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Z, { className: "text-base" }),
        label: t2(selectedEntries.length == 1 ? "Collapse" : "Collapse selected"),
        onClick: () => {
          for (const entry of collapsableEntries) {
            entry.collapse();
          }
        }
      });
    }
    if ((capabilities == null ? void 0 : capabilities.includes("decompress")) && decompressableEntries.length > 0) {
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Z, { className: "text-base" }),
        label: t2("Decompress {{count}} files", {
          count: decompressableEntries.length
        }),
        onClick: () => {
          BApi$1.file.decompressFiles({
            paths: decompressableEntries.map((e2) => e2.path)
          });
        }
      });
    }
    if ((capabilities == null ? void 0 : capabilities.includes("extract")) && directoryEntries.length > 0) {
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$2, { className: "text-base" }),
        label: t2("Extract {{count}} directories", {
          count: directoryEntries.length
        }),
        onClick: () => {
          createPortal(ExtractModal, { entries: selectedEntries });
        }
      });
    }
    if (capabilities == null ? void 0 : capabilities.includes("wrap")) {
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$u, { className: "text-base" }),
        label: t2("Wrap {{count}} items using directory", {
          count: selectedEntries.length
        }),
        onClick: () => {
          createPortal(WrapModal, { entries: selectedEntries });
        }
      });
    }
    if (capabilities == null ? void 0 : capabilities.includes("delete")) {
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" }),
        label: t2("Delete {{count}} items", {
          count: selectedEntries.length
        }),
        onClick: () => {
          createPortal(DeleteConfirmationModal, {
            entries: selectedEntries,
            rootPath: root2 == null ? void 0 : root2.path
          });
        }
      });
    }
    if (capabilities == null ? void 0 : capabilities.includes("delete-all-same-name")) {
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$X, { className: "text-base" }),
        label: t2("Delete items with the same names"),
        onClick: () => {
          createPortal(DeleteItemsWithSameNamesModal, {
            entries: selectedEntries,
            workingDirectory: selectedEntries[0].root.path
          });
        }
      });
    }
    if (capabilities == null ? void 0 : capabilities.includes("move")) {
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$f, { className: "text-base" }),
        label: t2("Move {{count}} items", {
          count: selectedEntries.length
        }),
        onClick: () => {
          createPortal(FolderSelector, {
            onSelect: (path) => {
              return BApi$1.file.moveEntries({
                destDir: path,
                entryPaths: selectedEntries.map((e2) => e2.path)
              });
            },
            sources: ["media library", "custom"]
          });
        }
      });
    }
    if (capabilities == null ? void 0 : capabilities.includes("group")) {
      const fileEntries = selectedEntries.filter((x2) => !x2.isDirectoryOrDrive);
      if (fileEntries.length > 1) {
        items.push({
          icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$C, { className: "text-base" }),
          label: t2("Auto group {{count}} selected files", {
            count: fileEntries.length
          }),
          onClick: () => {
            createPortal(GroupModal, {
              entries: fileEntries,
              groupInternal: false
            });
          }
        });
      }
      const directoryEntries2 = selectedEntries.filter((e2) => e2.isDirectory);
      if (directoryEntries2.length > 0) {
        items.push({
          icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$C, { className: "text-base" }),
          label: t2("Auto group internal items in {{count}} selected directories", {
            count: directoryEntries2.length
          }),
          onClick: () => {
            createPortal(GroupModal, {
              entries: selectedEntries,
              groupInternal: true
            });
          }
        });
      }
    }
    if (capabilities == null ? void 0 : capabilities.includes("decompress")) {
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFileZip, { className: "text-base" }),
        label: t2("Use bulk decompression tool"),
        onClick: () => {
          createPortal(DetectCompressedFilesModal, { paths: selectedEntries.map((e2) => e2.path) });
        }
      });
    }
    items.push({
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Z, { className: "text-base" }),
      label: t2("Copy {{count}} names", {
        count: selectedEntries.length
      }),
      onClick: () => {
        navigator.clipboard.writeText(selectedEntries.map((e2) => e2.name).join("\n")).then(() => {
          toast.success(t2("Copied"));
        }).catch((e2) => {
          toast.danger(`${t2("Failed to copy")}. ${e2}`);
        });
      }
    });
    items.push({
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Z, { className: "text-base" }),
      label: t2("Copy {{count}} paths", {
        count: selectedEntries.length
      }),
      onClick: () => {
        navigator.clipboard.writeText(selectedEntries.map((e2) => e2.path).join("\n")).then(() => {
          toast.success(t2("Copied"));
        }).catch((e2) => {
          toast.danger(`${t2("Failed to copy")}. ${e2}`);
        });
      }
    });
    items.push({
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(MdDriveFileRenameOutline, { className: "text-base" }),
      // 可换为更合适的icon
      label: t2("Batch rename {{count}} items", {
        count: selectedEntries.length
      }),
      onClick: () => {
        createPortal(FileNameModifierModal, {
          initialFilePaths: selectedEntries.map((e2) => e2.path)
        });
      }
    });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: items.map((i2) => {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(MenuItem, { onClick: i2.onClick, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
      i2.icon,
      i2.label
    ] }) });
  }) });
};
ContextMenu.displayName = "ContextMenu";
const FileSystemTreeEntryCapabilityMap = {
  select: {
    shortcut: { nameI18nKey: "Shortcut.LeftClick", mouseButton: 0 },
    nameI18NKey: "Capability.select"
  },
  "multi-select": {
    shortcut: { nameI18nKey: "Shortcut.CtrlClick", mouseButton: 0, modifiers: ["Control"] },
    nameI18NKey: "Capability.multi-select"
  },
  "range-select": {
    shortcut: { nameI18nKey: "Shortcut.ShiftClick", mouseButton: 0, modifiers: ["Shift"] },
    nameI18NKey: "Capability.range-select"
  },
  wrap: {
    shortcut: { key: "w", nameI18nKey: "Shortcut.W" },
    nameI18NKey: "Capability.wrap"
  },
  extract: {
    shortcut: { key: "e", nameI18nKey: "Shortcut.E" },
    nameI18NKey: "Capability.extract"
  },
  move: {
    shortcut: { key: "m", nameI18nKey: "Shortcut.M" },
    nameI18NKey: "Capability.move"
  },
  delete: {
    shortcut: { key: "Delete", nameI18nKey: "Shortcut.Delete" },
    nameI18NKey: "Capability.delete"
  },
  rename: {
    shortcut: { key: "F2", nameI18nKey: "Shortcut.F2" },
    nameI18NKey: "Capability.rename"
  },
  decompress: {
    shortcut: { key: "d", nameI18nKey: "Shortcut.D" },
    nameI18NKey: "Capability.decompress"
  },
  "delete-all-same-name": {
    nameI18NKey: "Capability.delete-all-same-name"
  },
  group: {
    shortcut: { key: "g", nameI18nKey: "Shortcut.G" },
    nameI18NKey: "Capability.group"
  },
  play: {
    nameI18NKey: "Capability.play"
  },
  "play-first-file": {
    shortcut: { key: " ", nameI18nKey: "Shortcut.Space" },
    nameI18NKey: "Capability.play-first-file"
  }
};
function RiKeyboardLine(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M3 17H21V19H3V17ZM3 11H6V14H3V11ZM8 11H11V14H8V11ZM3 5H6V8H3V5ZM13 5H16V8H13V5ZM18 5H21V8H18V5ZM13 11H16V14H13V11ZM18 11H21V14H18V11ZM8 5H11V8H8V5Z" }, "child": [] }] })(props);
}
function RiFormula(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M10 2C7.79086 2 6 3.79086 6 6V9H3V11H6V18C6 19.1046 5.10457 20 4 20H3V22H4C6.20914 22 8 20.2091 8 18V11H11V9H8V6C8 4.89543 8.89543 4 10 4H11V2H10ZM15.2022 16.9971L11.8907 21H14.4864L16.5 18.5659L18.5137 21H21.1093L17.7979 16.9971L21.1046 13H18.5089L16.5 15.4283L14.4912 13H11.8955L15.2022 16.9971Z" }, "child": [] }] })(props);
}
const log$D = buildLogger("Shortcuts");
const Shortcuts = ({ capabilities, className }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  log$D("shortcuts for capabilities", capabilities);
  const shortcuts = reactExports.useMemo(() => {
    if (!capabilities || capabilities.length === 0)
      return [];
    return capabilities.map((c2) => {
      const def = FileSystemTreeEntryCapabilityMap[c2];
      const shortcut = def == null ? void 0 : def.shortcut;
      if (!shortcut)
        return void 0;
      return {
        label: t2(def.nameI18NKey),
        shortcut: t2(def.shortcut.nameI18nKey)
      };
    }).filter((x2) => !!x2);
  }, [capabilities, t2]);
  if (!shortcuts.length)
    return null;
  const openModal = () => {
    createPortal(Modal, {
      defaultVisible: true,
      size: "sm",
      title: t2("Shortcuts"),
      footer: { actions: ["cancel"] },
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2", children: shortcuts.map((s2, idx) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm", children: s2.label }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(kbd_default, { children: s2.shortcut })
      ] }, idx)) })
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Shortcuts"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, className, variant: "light", onPress: openModal, children: /* @__PURE__ */ jsxRuntimeExports.jsx(RiKeyboardLine, { className: "text-lg" }) }) });
};
Shortcuts.displayName = "Shortcuts";
var deepDiff = { exports: {} };
(function(module2, exports2) {
  (function(root2, factory) {
    var deepDiff2 = factory(root2);
    {
      module2.exports = deepDiff2;
    }
  })(commonjsGlobal, function(root2) {
    var validKinds = ["N", "E", "A", "D"];
    function inherits2(ctor, superCtor) {
      ctor.super_ = superCtor;
      ctor.prototype = Object.create(superCtor.prototype, {
        constructor: {
          value: ctor,
          enumerable: false,
          writable: true,
          configurable: true
        }
      });
    }
    function Diff(kind, path) {
      Object.defineProperty(this, "kind", {
        value: kind,
        enumerable: true
      });
      if (path && path.length) {
        Object.defineProperty(this, "path", {
          value: path,
          enumerable: true
        });
      }
    }
    function DiffEdit(path, origin2, value2) {
      DiffEdit.super_.call(this, "E", path);
      Object.defineProperty(this, "lhs", {
        value: origin2,
        enumerable: true
      });
      Object.defineProperty(this, "rhs", {
        value: value2,
        enumerable: true
      });
    }
    inherits2(DiffEdit, Diff);
    function DiffNew(path, value2) {
      DiffNew.super_.call(this, "N", path);
      Object.defineProperty(this, "rhs", {
        value: value2,
        enumerable: true
      });
    }
    inherits2(DiffNew, Diff);
    function DiffDeleted(path, value2) {
      DiffDeleted.super_.call(this, "D", path);
      Object.defineProperty(this, "lhs", {
        value: value2,
        enumerable: true
      });
    }
    inherits2(DiffDeleted, Diff);
    function DiffArray(path, index2, item) {
      DiffArray.super_.call(this, "A", path);
      Object.defineProperty(this, "index", {
        value: index2,
        enumerable: true
      });
      Object.defineProperty(this, "item", {
        value: item,
        enumerable: true
      });
    }
    inherits2(DiffArray, Diff);
    function arrayRemove(arr, from2, to2) {
      var rest = arr.slice(from2 + 1 || arr.length);
      arr.length = from2 < 0 ? arr.length + from2 : from2;
      arr.push.apply(arr, rest);
      return arr;
    }
    function realTypeOf(subject) {
      var type4 = typeof subject;
      if (type4 !== "object") {
        return type4;
      }
      if (subject === Math) {
        return "math";
      } else if (subject === null) {
        return "null";
      } else if (Array.isArray(subject)) {
        return "array";
      } else if (Object.prototype.toString.call(subject) === "[object Date]") {
        return "date";
      } else if (typeof subject.toString === "function" && /^\/.*\//.test(subject.toString())) {
        return "regexp";
      }
      return "object";
    }
    function hashThisString(string3) {
      var hash = 0;
      if (string3.length === 0) {
        return hash;
      }
      for (var i2 = 0; i2 < string3.length; i2++) {
        var char2 = string3.charCodeAt(i2);
        hash = (hash << 5) - hash + char2;
        hash = hash & hash;
      }
      return hash;
    }
    function getOrderIndependentHash(object4) {
      var accum = 0;
      var type4 = realTypeOf(object4);
      if (type4 === "array") {
        object4.forEach(function(item) {
          accum += getOrderIndependentHash(item);
        });
        var arrayString = "[type: array, hash: " + accum + "]";
        return accum + hashThisString(arrayString);
      }
      if (type4 === "object") {
        for (var key in object4) {
          if (object4.hasOwnProperty(key)) {
            var keyValueString = "[ type: object, key: " + key + ", value hash: " + getOrderIndependentHash(object4[key]) + "]";
            accum += hashThisString(keyValueString);
          }
        }
        return accum;
      }
      var stringToHash = "[ type: " + type4 + " ; value: " + object4 + "]";
      return accum + hashThisString(stringToHash);
    }
    function deepDiff2(lhs, rhs, changes, prefilter, path, key, stack, orderIndependent) {
      changes = changes || [];
      path = path || [];
      stack = stack || [];
      var currentPath = path.slice(0);
      if (typeof key !== "undefined" && key !== null) {
        if (prefilter) {
          if (typeof prefilter === "function" && prefilter(currentPath, key)) {
            return;
          } else if (typeof prefilter === "object") {
            if (prefilter.prefilter && prefilter.prefilter(currentPath, key)) {
              return;
            }
            if (prefilter.normalize) {
              var alt = prefilter.normalize(currentPath, key, lhs, rhs);
              if (alt) {
                lhs = alt[0];
                rhs = alt[1];
              }
            }
          }
        }
        currentPath.push(key);
      }
      if (realTypeOf(lhs) === "regexp" && realTypeOf(rhs) === "regexp") {
        lhs = lhs.toString();
        rhs = rhs.toString();
      }
      var ltype = typeof lhs;
      var rtype = typeof rhs;
      var i2, j2, k2, other;
      var ldefined = ltype !== "undefined" || stack && stack.length > 0 && stack[stack.length - 1].lhs && Object.getOwnPropertyDescriptor(stack[stack.length - 1].lhs, key);
      var rdefined = rtype !== "undefined" || stack && stack.length > 0 && stack[stack.length - 1].rhs && Object.getOwnPropertyDescriptor(stack[stack.length - 1].rhs, key);
      if (!ldefined && rdefined) {
        changes.push(new DiffNew(currentPath, rhs));
      } else if (!rdefined && ldefined) {
        changes.push(new DiffDeleted(currentPath, lhs));
      } else if (realTypeOf(lhs) !== realTypeOf(rhs)) {
        changes.push(new DiffEdit(currentPath, lhs, rhs));
      } else if (realTypeOf(lhs) === "date" && lhs - rhs !== 0) {
        changes.push(new DiffEdit(currentPath, lhs, rhs));
      } else if (ltype === "object" && lhs !== null && rhs !== null) {
        for (i2 = stack.length - 1; i2 > -1; --i2) {
          if (stack[i2].lhs === lhs) {
            other = true;
            break;
          }
        }
        if (!other) {
          stack.push({ lhs, rhs });
          if (Array.isArray(lhs)) {
            if (orderIndependent) {
              lhs.sort(function(a2, b2) {
                return getOrderIndependentHash(a2) - getOrderIndependentHash(b2);
              });
              rhs.sort(function(a2, b2) {
                return getOrderIndependentHash(a2) - getOrderIndependentHash(b2);
              });
            }
            i2 = rhs.length - 1;
            j2 = lhs.length - 1;
            while (i2 > j2) {
              changes.push(new DiffArray(currentPath, i2, new DiffNew(void 0, rhs[i2--])));
            }
            while (j2 > i2) {
              changes.push(new DiffArray(currentPath, j2, new DiffDeleted(void 0, lhs[j2--])));
            }
            for (; i2 >= 0; --i2) {
              deepDiff2(lhs[i2], rhs[i2], changes, prefilter, currentPath, i2, stack, orderIndependent);
            }
          } else {
            var akeys = Object.keys(lhs);
            var pkeys = Object.keys(rhs);
            for (i2 = 0; i2 < akeys.length; ++i2) {
              k2 = akeys[i2];
              other = pkeys.indexOf(k2);
              if (other >= 0) {
                deepDiff2(lhs[k2], rhs[k2], changes, prefilter, currentPath, k2, stack, orderIndependent);
                pkeys[other] = null;
              } else {
                deepDiff2(lhs[k2], void 0, changes, prefilter, currentPath, k2, stack, orderIndependent);
              }
            }
            for (i2 = 0; i2 < pkeys.length; ++i2) {
              k2 = pkeys[i2];
              if (k2) {
                deepDiff2(void 0, rhs[k2], changes, prefilter, currentPath, k2, stack, orderIndependent);
              }
            }
          }
          stack.length = stack.length - 1;
        } else if (lhs !== rhs) {
          changes.push(new DiffEdit(currentPath, lhs, rhs));
        }
      } else if (lhs !== rhs) {
        if (!(ltype === "number" && isNaN(lhs) && isNaN(rhs))) {
          changes.push(new DiffEdit(currentPath, lhs, rhs));
        }
      }
    }
    function observableDiff(lhs, rhs, observer, prefilter, orderIndependent) {
      var changes = [];
      deepDiff2(lhs, rhs, changes, prefilter, null, null, null, orderIndependent);
      if (observer) {
        for (var i2 = 0; i2 < changes.length; ++i2) {
          observer(changes[i2]);
        }
      }
      return changes;
    }
    function orderIndependentDeepDiff(lhs, rhs, changes, prefilter, path, key, stack) {
      return deepDiff2(lhs, rhs, changes, prefilter, path, key, stack, true);
    }
    function accumulateDiff(lhs, rhs, prefilter, accum) {
      var observer = accum ? function(difference) {
        if (difference) {
          accum.push(difference);
        }
      } : void 0;
      var changes = observableDiff(lhs, rhs, observer, prefilter);
      return accum ? accum : changes.length ? changes : void 0;
    }
    function accumulateOrderIndependentDiff(lhs, rhs, prefilter, accum) {
      var observer = accum ? function(difference) {
        if (difference) {
          accum.push(difference);
        }
      } : void 0;
      var changes = observableDiff(lhs, rhs, observer, prefilter, true);
      return accum ? accum : changes.length ? changes : void 0;
    }
    function applyArrayChange(arr, index2, change) {
      if (change.path && change.path.length) {
        var it = arr[index2], i2, u2 = change.path.length - 1;
        for (i2 = 0; i2 < u2; i2++) {
          it = it[change.path[i2]];
        }
        switch (change.kind) {
          case "A":
            applyArrayChange(it[change.path[i2]], change.index, change.item);
            break;
          case "D":
            delete it[change.path[i2]];
            break;
          case "E":
          case "N":
            it[change.path[i2]] = change.rhs;
            break;
        }
      } else {
        switch (change.kind) {
          case "A":
            applyArrayChange(arr[index2], change.index, change.item);
            break;
          case "D":
            arr = arrayRemove(arr, index2);
            break;
          case "E":
          case "N":
            arr[index2] = change.rhs;
            break;
        }
      }
      return arr;
    }
    function applyChange(target, source2, change) {
      if (typeof change === "undefined" && source2 && ~validKinds.indexOf(source2.kind)) {
        change = source2;
      }
      if (target && change && change.kind) {
        var it = target, i2 = -1, last = change.path ? change.path.length - 1 : 0;
        while (++i2 < last) {
          if (typeof it[change.path[i2]] === "undefined") {
            it[change.path[i2]] = typeof change.path[i2 + 1] !== "undefined" && typeof change.path[i2 + 1] === "number" ? [] : {};
          }
          it = it[change.path[i2]];
        }
        switch (change.kind) {
          case "A":
            if (change.path && typeof it[change.path[i2]] === "undefined") {
              it[change.path[i2]] = [];
            }
            applyArrayChange(change.path ? it[change.path[i2]] : it, change.index, change.item);
            break;
          case "D":
            delete it[change.path[i2]];
            break;
          case "E":
          case "N":
            it[change.path[i2]] = change.rhs;
            break;
        }
      }
    }
    function revertArrayChange(arr, index2, change) {
      if (change.path && change.path.length) {
        var it = arr[index2], i2, u2 = change.path.length - 1;
        for (i2 = 0; i2 < u2; i2++) {
          it = it[change.path[i2]];
        }
        switch (change.kind) {
          case "A":
            revertArrayChange(it[change.path[i2]], change.index, change.item);
            break;
          case "D":
            it[change.path[i2]] = change.lhs;
            break;
          case "E":
            it[change.path[i2]] = change.lhs;
            break;
          case "N":
            delete it[change.path[i2]];
            break;
        }
      } else {
        switch (change.kind) {
          case "A":
            revertArrayChange(arr[index2], change.index, change.item);
            break;
          case "D":
            arr[index2] = change.lhs;
            break;
          case "E":
            arr[index2] = change.lhs;
            break;
          case "N":
            arr = arrayRemove(arr, index2);
            break;
        }
      }
      return arr;
    }
    function revertChange(target, source2, change) {
      if (target && source2 && change && change.kind) {
        var it = target, i2, u2;
        u2 = change.path.length - 1;
        for (i2 = 0; i2 < u2; i2++) {
          if (typeof it[change.path[i2]] === "undefined") {
            it[change.path[i2]] = {};
          }
          it = it[change.path[i2]];
        }
        switch (change.kind) {
          case "A":
            revertArrayChange(it[change.path[i2]], change.index, change.item);
            break;
          case "D":
            it[change.path[i2]] = change.lhs;
            break;
          case "E":
            it[change.path[i2]] = change.lhs;
            break;
          case "N":
            delete it[change.path[i2]];
            break;
        }
      }
    }
    function applyDiff(target, source2, filter3) {
      if (target && source2) {
        var onChange = function(change) {
          if (!filter3 || filter3(target, source2, change)) {
            applyChange(target, source2, change);
          }
        };
        observableDiff(target, source2, onChange);
      }
    }
    Object.defineProperties(accumulateDiff, {
      diff: {
        value: accumulateDiff,
        enumerable: true
      },
      orderIndependentDiff: {
        value: accumulateOrderIndependentDiff,
        enumerable: true
      },
      observableDiff: {
        value: observableDiff,
        enumerable: true
      },
      orderIndependentObservableDiff: {
        value: orderIndependentDeepDiff,
        enumerable: true
      },
      orderIndepHash: {
        value: getOrderIndependentHash,
        enumerable: true
      },
      applyDiff: {
        value: applyDiff,
        enumerable: true
      },
      applyChange: {
        value: applyChange,
        enumerable: true
      },
      revertChange: {
        value: revertChange,
        enumerable: true
      },
      isConflict: {
        value: function() {
          return typeof $conflict !== "undefined";
        },
        enumerable: true
      }
    });
    accumulateDiff.DeepDiff = accumulateDiff;
    if (root2) {
      root2.DeepDiff = accumulateDiff;
    }
    return accumulateDiff;
  });
})(deepDiff);
var deepDiffExports = deepDiff.exports;
const diff$1 = /* @__PURE__ */ getDefaultExportFromCjs(deepDiffExports);
const OperationButton = reactExports.forwardRef(({
  onClick,
  children,
  size: size2 = "sm",
  variant = "light",
  className,
  ...props
}, ref) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Button,
    {
      ref,
      className: `w-auto h-auto p-1 min-w-fit opacity-70 hover:opacity-100 ${className ?? ""}`,
      size: size2,
      variant,
      onClick: (e2) => {
        e2.stopPropagation();
        onClick == null ? void 0 : onClick(e2);
      },
      ...props,
      children
    }
  );
});
OperationButton.displayName = "OperationButton";
var __defProp$2 = Object.defineProperty;
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
var __defNormalProp$2 = (obj, key, value2) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value: value2 }) : obj[key] = value2;
var __spreadValues$2 = (a2, b2) => {
  for (var prop in b2 || (b2 = {}))
    if (__hasOwnProp$2.call(b2, prop))
      __defNormalProp$2(a2, prop, b2[prop]);
  if (__getOwnPropSymbols$2)
    for (var prop of __getOwnPropSymbols$2(b2)) {
      if (__propIsEnum$2.call(b2, prop))
        __defNormalProp$2(a2, prop, b2[prop]);
    }
  return a2;
};
var __objRest$2 = (source2, exclude) => {
  var target = {};
  for (var prop in source2)
    if (__hasOwnProp$2.call(source2, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source2[prop];
  if (source2 != null && __getOwnPropSymbols$2)
    for (var prop of __getOwnPropSymbols$2(source2)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source2, prop))
        target[prop] = source2[prop];
    }
  return target;
};
function throttleAnimationFrame(func) {
  let wait = false;
  return () => {
    if (!wait) {
      wait = true;
      requestAnimationFrame(() => {
        func();
        wait = false;
      });
    }
  };
}
var antiOverflowAlgo = ({
  fontSizePx,
  minFontSizePx,
  fontSizePrecisionPx,
  updateFontSizePx,
  breakPredicate: breakPred
}) => {
  const maxIterCount = Math.ceil(1 / fontSizePrecisionPx);
  let iterCount = 0;
  while (fontSizePx > minFontSizePx && iterCount < maxIterCount) {
    if (breakPred())
      break;
    fontSizePx = updateFontSizePx(fontSizePx - fontSizePrecisionPx);
    iterCount++;
  }
};
var getContentWidth = (element2) => {
  const computedStyle = getComputedStyle(element2);
  return element2.clientWidth - parseFloat(computedStyle.paddingLeft) - parseFloat(computedStyle.paddingRight);
};
var getContentHeight = (element2) => {
  const computedStyle = getComputedStyle(element2);
  return element2.clientHeight - parseFloat(computedStyle.paddingTop) - parseFloat(computedStyle.paddingBottom);
};
var multilineAlgo = (opts2) => {
  opts2.innerEl.style.whiteSpace = "nowrap";
  onelineAlgo(opts2);
  if (opts2.innerEl.scrollWidth > getContentWidth(opts2.containerEl)) {
    opts2.innerEl.style.whiteSpace = "normal";
  }
};
var onelineAlgo = ({
  innerEl,
  containerEl,
  fontSizePx,
  minFontSizePx,
  maxFontSizePx,
  fontSizePrecisionPx,
  updateFontSizePx
}) => {
  const maxIterCount = 10;
  let iterCount = 0;
  let prevOverflowFactor = 1;
  while (iterCount < maxIterCount) {
    const w0 = innerEl.scrollWidth;
    const w1 = getContentWidth(containerEl);
    const canGrow = fontSizePx < maxFontSizePx && w0 < w1;
    const canShrink = fontSizePx > minFontSizePx && w0 > w1;
    const overflowFactor = w0 / w1;
    if (prevOverflowFactor === overflowFactor) {
      break;
    }
    if (!(canGrow || canShrink)) {
      break;
    }
    const updatePx = fontSizePx / overflowFactor - fontSizePx;
    const prevFontSizePx = fontSizePx;
    fontSizePx = updateFontSizePx(fontSizePx + updatePx);
    if (Math.abs(fontSizePx - prevFontSizePx) <= fontSizePrecisionPx) {
      break;
    }
    prevOverflowFactor = overflowFactor;
    iterCount++;
  }
  antiOverflowAlgo({
    fontSizePx,
    minFontSizePx,
    updateFontSizePx,
    fontSizePrecisionPx,
    breakPredicate: () => innerEl.scrollWidth <= getContentWidth(containerEl)
  });
};
var boxAlgo = ({
  innerEl,
  containerEl,
  fontSizePx,
  minFontSizePx,
  maxFontSizePx,
  fontSizePrecisionPx,
  updateFontSizePx
}) => {
  const maxIterCount = 100;
  fontSizePx = updateFontSizePx((maxFontSizePx - minFontSizePx) * 0.5);
  let updatePx = (maxFontSizePx - minFontSizePx) * 0.25;
  let iterCount = 0;
  while (updatePx > fontSizePrecisionPx && iterCount < maxIterCount) {
    const w0 = innerEl.scrollWidth;
    const w1 = getContentWidth(containerEl);
    const h0 = innerEl.scrollHeight;
    const h12 = getContentHeight(containerEl);
    if (w0 === w1 && h0 === h12)
      break;
    if (fontSizePx < maxFontSizePx && w0 <= w1 && h0 <= h12) {
      fontSizePx = updateFontSizePx(fontSizePx + updatePx);
    } else if (fontSizePx > minFontSizePx && (w0 > w1 || h0 > h12)) {
      fontSizePx = updateFontSizePx(fontSizePx - updatePx);
    }
    updatePx *= 0.5;
    iterCount++;
  }
  antiOverflowAlgo({
    fontSizePx,
    minFontSizePx,
    updateFontSizePx,
    fontSizePrecisionPx,
    breakPredicate: () => innerEl.scrollWidth <= getContentWidth(containerEl) && innerEl.scrollHeight <= getContentHeight(containerEl)
  });
};
function updateTextSize({
  innerEl,
  containerEl,
  mode = "multiline",
  minFontSizePx = 8,
  maxFontSizePx = 160,
  fontSizePrecisionPx = 0.1
}) {
  performance.now();
  if (!isFinite(minFontSizePx)) {
    throw new Error(`Invalid minFontSizePx (${minFontSizePx})`);
  }
  if (!isFinite(minFontSizePx)) {
    throw new Error(`Invalid maxFontSizePx (${maxFontSizePx})`);
  }
  if (!isFinite(fontSizePrecisionPx) || fontSizePrecisionPx === 0) {
    throw new Error(`Invalid fontSizePrecisionPx (${fontSizePrecisionPx})`);
  }
  if (containerEl.children.length > 1) {
    console.warn(
      `AutoTextSize has ${containerEl.children.length - 1} siblings. This may interfere with the algorithm.`
    );
  }
  const containerStyles = {
    // Necessary to correctly compute the dimensions `innerEl`.
    display: "flex",
    alignItems: "start"
  };
  const innerStyles = {
    display: "block"
    // Necessary to compute dimensions.
  };
  if (mode === "oneline") {
    innerStyles.whiteSpace = "nowrap";
  } else if (mode === "multiline") {
    innerStyles.wordBreak = "break-word";
  } else if (mode === "box") {
    innerStyles.whiteSpace = "pre-wrap";
    innerStyles.wordBreak = "break-word";
  } else if (mode === "boxoneline") {
    innerStyles.whiteSpace = "nowrap";
  }
  Object.assign(containerEl.style, containerStyles);
  Object.assign(innerEl.style, innerStyles);
  const fontSizeStr = window.getComputedStyle(innerEl, null).getPropertyValue("font-size");
  let fontSizePx = parseFloat(fontSizeStr);
  const updateFontSizePx = (px2) => {
    px2 = Math.min(Math.max(px2, minFontSizePx), maxFontSizePx);
    fontSizePx = px2;
    innerEl.style.fontSize = `${fontSizePx}px`;
    return fontSizePx;
  };
  if (fontSizePx > maxFontSizePx || fontSizePx < minFontSizePx) {
    updateFontSizePx(fontSizePx);
  }
  const algoOpts = {
    innerEl,
    containerEl,
    fontSizePx,
    minFontSizePx,
    maxFontSizePx,
    fontSizePrecisionPx,
    updateFontSizePx
  };
  if (mode === "oneline") {
    onelineAlgo(algoOpts);
  } else if (mode === "multiline") {
    multilineAlgo(algoOpts);
  } else if (mode === "box") {
    boxAlgo(algoOpts);
  } else if (mode === "boxoneline") {
    boxAlgo(algoOpts);
  }
}
function autoTextSize({
  innerEl,
  containerEl,
  mode,
  minFontSizePx,
  maxFontSizePx,
  fontSizePrecisionPx
}) {
  let containerDimensions = void 0;
  const throttledUpdateTextSize = throttleAnimationFrame(() => {
    updateTextSize({
      innerEl,
      containerEl,
      mode,
      maxFontSizePx,
      minFontSizePx,
      fontSizePrecisionPx
    });
    containerDimensions = [
      getContentWidth(containerEl),
      getContentHeight(containerEl)
    ];
  });
  const resizeObserver2 = new ResizeObserver(() => {
    const prevContainerDimensions = containerDimensions;
    containerDimensions = [
      getContentWidth(containerEl),
      getContentHeight(containerEl)
    ];
    if ((prevContainerDimensions == null ? void 0 : prevContainerDimensions[0]) !== containerDimensions[0] || (prevContainerDimensions == null ? void 0 : prevContainerDimensions[1]) !== containerDimensions[1]) {
      throttledUpdateTextSize();
    }
  });
  resizeObserver2.observe(containerEl);
  throttledUpdateTextSize.disconnect = () => resizeObserver2.disconnect();
  return throttledUpdateTextSize;
}
function AutoTextSize(_a2) {
  var _b2 = _a2, {
    mode,
    minFontSizePx,
    maxFontSizePx,
    fontSizePrecisionPx,
    as: Comp = "div",
    children
  } = _b2, rest = __objRest$2(_b2, [
    "mode",
    "minFontSizePx",
    "maxFontSizePx",
    "fontSizePrecisionPx",
    "as",
    // TODO: The `...rest` props are not typed to reflect another `as`.
    "children"
  ]);
  const updateTextSizeRef = reactExports.useRef();
  reactExports.useEffect(() => {
    var _a22;
    return (_a22 = updateTextSizeRef.current) == null ? void 0 : _a22.call(updateTextSizeRef);
  }, [children]);
  const refCallback = reactExports.useCallback(
    (innerEl) => {
      var _a22;
      (_a22 = updateTextSizeRef.current) == null ? void 0 : _a22.disconnect();
      const containerEl = innerEl == null ? void 0 : innerEl.parentElement;
      if (!innerEl || !containerEl)
        return;
      updateTextSizeRef.current = autoTextSize({
        innerEl,
        containerEl,
        mode,
        minFontSizePx,
        maxFontSizePx,
        fontSizePrecisionPx
      });
    },
    [mode, minFontSizePx, maxFontSizePx, fontSizePrecisionPx]
  );
  return /* @__PURE__ */ React$5.createElement(Comp, __spreadValues$2({ ref: refCallback }, rest), children);
}
const log$C = buildLogger("EditableText");
const EditableText = reactExports.memo((props) => {
  const { path, name: name2, isDirectory, disabled = false } = props;
  const propsRef = reactExports.useRef(props);
  const [editing, setEditing] = reactExports.useState(false);
  const editingRef = reactExports.useRef(editing);
  const nodeRef = reactExports.useRef(null);
  const inputRef = reactExports.useRef(null);
  const [value2, setValue] = reactExports.useState(name2);
  const valueRef = reactExports.useRef(value2);
  useTraceUpdate(props, "EditableText");
  log$C("Rendering", props);
  reactExports.useEffect(() => {
    return () => {
    };
  }, []);
  useUpdateEffect(() => {
    editingRef.current = editing;
    if (editing) {
      const selection = isDirectory ? valueRef.current : getFileNameWithoutExtension(valueRef.current);
      createSelection(inputRef.current, 0, selection.length);
    }
  }, [editing]);
  useUpdateEffect(() => {
    valueRef.current = value2;
  }, [value2]);
  useUpdateEffect(() => {
    if (!editingRef.current) {
      setValue(name2);
    }
  }, [name2]);
  const enterEditingModeKeyDownHandler = reactExports.useCallback((e2) => {
    if (disabled || editingRef.current) {
      return;
    }
    if (e2.key == "F2") {
      setEditing(true);
      e2.stopPropagation();
    }
  }, []);
  const inputKeyDownHandler = reactExports.useCallback((e2) => {
    log$C("Key down", e2.key, e2.ctrlKey, e2.shiftKey, e2.altKey, e2.metaKey, e2);
    switch (e2.key) {
      case "Enter":
        submit();
        break;
      case "Escape":
        cancel2();
        break;
      case "Delete":
        break;
      default:
        return;
    }
  }, []);
  const cancel2 = reactExports.useCallback(() => {
    if (editingRef.current) {
      setEditing(false);
      forceFocus(nodeRef.current);
      setValue(propsRef.current.name);
    }
  }, []);
  const submit = reactExports.useCallback(async () => {
    if (valueRef.current && valueRef.current != propsRef.current.name) {
      const rsp = await BApi$1.file.renameFile({
        fullname: path,
        newName: valueRef.current
      });
      if (!rsp.code) {
        setValue(valueRef.current);
      }
      setEditing(false);
    } else {
      cancel2();
    }
  }, []);
  log$C(props, valueRef.current, editingRef.current);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "div",
    {
      ref: (r2) => {
        if (r2) {
          nodeRef.current = r2;
          let e2 = r2.parentElement;
          while (e2) {
            if (e2.className.includes("entry-keydown-listener")) {
              e2.removeEventListener("keydown", enterEditingModeKeyDownHandler);
              e2.addEventListener("keydown", enterEditingModeKeyDownHandler);
              break;
            } else {
              e2 = e2.parentElement;
            }
          }
        }
      },
      className: "fp-te-et",
      style: editing ? { flex: 1 } : void 0,
      onKeyDown: enterEditingModeKeyDownHandler,
      children: editing ? /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          ref: inputRef,
          className: "w-full",
          "data-focus": false,
          radius: "none",
          onDoubleClick: (e2) => {
            log$C("onDoubleClick", e2);
            e2.stopPropagation();
            e2.preventDefault();
          },
          size: "sm",
          value: value2,
          onBlur: submit,
          onClick: (e2) => {
            log$C("onClick", e2);
            e2.stopPropagation();
            e2.preventDefault();
          },
          onKeyDown: inputKeyDownHandler,
          onValueChange: (v2) => {
            setValue(v2);
          }
        }
      ) : /* @__PURE__ */ jsxRuntimeExports.jsx(AutoTextSize, { maxFontSizePx: 14, children: value2 })
    }
  );
});
function PasswordSelector(props) {
  const { onSelect, afterClose } = props;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [passwords, setPasswords] = reactExports.useState([]);
  const [visible, setVisible] = reactExports.useState(true);
  const [order2, setOrder] = reactExports.useState(PasswordSearchOrder.Latest);
  const initialize = reactExports.useCallback(async () => {
    const rsp = await BApi$1.password.getAllPasswords();
    setPasswords(rsp.data || []);
  }, []);
  reactExports.useEffect(() => {
    initialize();
  }, []);
  const close = reactExports.useCallback(() => {
    setVisible(false);
  }, []);
  const renderPasswords = reactExports.useCallback(() => {
    const filtered = passwords.sort(
      (a2, b2) => order2 === PasswordSearchOrder.Latest ? b2.lastUsedAt.localeCompare(a2.lastUsedAt) : b2.usedTimes - a2.usedTimes
    );
    return filtered.map((p2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        "div",
        {
          className: "password",
          onClick: () => {
            onSelect(p2.text);
            close();
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "top", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text", children: p2.text }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  color: "danger",
                  size: "sm",
                  variant: "light",
                  onPress: () => {
                    createPortal(Modal, {
                      defaultVisible: true,
                      title: t2("Delete password from history?"),
                      children: t2(
                        "Are you sure you want to delete this password from history?"
                      ),
                      onOk: () => BApi$1.password.deletePassword(p2.text)
                    });
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdDelete, { className: "text-base" })
                }
              )
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "info", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "last-used-at", children: p2.lastUsedAt }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(badge_default, { count: p2.usedTimes })
            ] })
          ]
        }
      );
    });
  }, [passwords, order2]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      v2: true,
      afterClose,
      className: "password-selector-dialog",
      closeMode: ["close", "mask", "esc"],
      footerActions: ["cancel"],
      title: t2("Passwords"),
      visible,
      width: "auto",
      onCancel: close,
      onClose: close,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "orders", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "title", children: t2("Order") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "content", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            radio_default.Group,
            {
              dataSource: [
                {
                  label: t2("Used recently"),
                  value: PasswordSearchOrder.Latest
                },
                {
                  label: t2("Used frequently"),
                  value: PasswordSearchOrder.Frequency
                }
              ],
              value: order2,
              onChange: (v2) => {
                setOrder(v2);
              }
            }
          ) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "passwords", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "title", children: t2("Passwords") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "content", children: renderPasswords() })
        ] })
      ]
    }
  );
}
PasswordSelector.show = (props) => createPortalOfComponent(PasswordSelector, props);
const QuickPasswordCount = 5;
const loadTopNPasswords = async (type4) => {
  const rsp = await BApi$1.password.searchPasswords({
    // @ts-ignore
    order: type4,
    pageSize: QuickPasswordCount
  });
  return rsp.data || [];
};
const DecompressBalloon = (props) => {
  const { trigger, entry, passwords = [] } = props;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const customPasswordRef = reactExports.useRef();
  const [recentPasswords, setRecentPasswords] = reactExports.useState([]);
  const [frequentlyUsedPasswords, setFrequentlyUsedPasswords] = reactExports.useState([]);
  const decompress = reactExports.useCallback((path, password) => {
    toast.default(t2("Start decompressing"));
    return BApi$1.file.decompressFiles({
      paths: [path],
      password
    });
  }, []);
  const onBalloonVisible = reactExports.useCallback(async () => {
    setRecentPasswords(await loadTopNPasswords(PasswordSearchOrder.Latest));
    setFrequentlyUsedPasswords(await loadTopNPasswords(PasswordSearchOrder.Frequency));
  }, []);
  const openPasswordSelector = reactExports.useCallback(() => {
    PasswordSelector.show({
      onSelect: (password) => {
        decompress(entry.path, password);
      }
    });
  }, []);
  const renderTopNPasswords = reactExports.useCallback(
    (type4) => {
      let label;
      let passwords2;
      switch (type4) {
        case PasswordSearchOrder.Latest:
          label = "recently used";
          passwords2 = recentPasswords;
          break;
        case PasswordSearchOrder.Frequency:
          label = "frequently used";
          passwords2 = frequentlyUsedPasswords;
          break;
      }
      if (passwords2.length > 0) {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "secondary", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "tip", children: [
            t2(`Alternatively, you can choose a password from ${label} passwords:`),
            passwords2.length === 5 && /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                className: "show-more",
                color: "primary",
                size: "sm",
                variant: "light",
                onClick: openPasswordSelector,
                children: t2("Show more")
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "passwords", children: passwords2.map((p2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                size: "sm",
                onClick: () => {
                  decompress(entry.path, p2.text);
                },
                onClose: () => {
                  createPortal(Modal, {
                    defaultVisible: true,
                    title: t2("Delete password from history?"),
                    children: t2(
                      "Are you sure you want to delete this password from history?"
                    ),
                    onOk: () => BApi$1.password.deletePassword(p2.text)
                  });
                },
                children: p2.text
              },
              p2.text
            );
          }) })
        ] });
      }
      return;
    },
    [recentPasswords, frequentlyUsedPasswords]
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      autoFocus: false,
      className: "fp-te-db",
      content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "common-tip", children: t2(
          "Contents will be decompressed to the same directory as the compressed file."
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "password-guides", children: [
          passwords.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "default", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Trans,
            {
              i18nKey: "fp.te.db.defaultPassword",
              values: {
                password: passwords[0]
              },
              children: [
                "By default, we will use ",
                /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", size: "sm", variant: "light", children: "password" }),
                "  as password."
              ]
            }
          ) }),
          passwords.length > 1 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "secondary", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "tip", children: t2(
              "Alternatively, you can choose a password from the following candidates:"
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "passwords", children: passwords.slice(1).map((password) => /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                size: "sm",
                variant: "flat",
                onClick: () => {
                  decompress(entry.path, password);
                },
                children: password
              },
              password
            )) })
          ] }),
          renderTopNPasswords(PasswordSearchOrder.Latest),
          renderTopNPasswords(PasswordSearchOrder.Frequency),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "secondary", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "tip", children: t2("Or you can use a custom password:") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                isClearable: true,
                endContent: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    size: "sm",
                    variant: "flat",
                    onClick: () => {
                      if (customPasswordRef.current) {
                        decompress(entry.path, customPasswordRef.current);
                      } else {
                        toast.danger(instance.t("Password can not be empty"));
                      }
                    },
                    children: t2("Use custom password to decompress")
                  }
                ),
                placeholder: instance.t("Password"),
                size: "sm",
                style: { width: "100%" },
                onKeyDown: (e2) => {
                  e2.stopPropagation();
                },
                onValueChange: (v2) => {
                  customPasswordRef.current = v2;
                }
              }
            )
          ] })
        ] })
      ] }),
      delay: 500,
      placement: "left",
      onClick: () => {
      },
      onOpenChange: (v2) => {
        if (v2) {
          onBalloonVisible();
        }
      },
      children: React$5.cloneElement(trigger, {
        onContextMenu: () => {
        },
        onClick: () => {
          if (trigger.props.onClick) {
            trigger.props.onClick();
          }
          decompress(entry.path);
        }
      })
    }
  );
};
DecompressBalloon.displayName = "DecompressBalloon";
const RightOperations = ({ entry, capabilities }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const { actions } = entry;
  const isDecompressible = (capabilities == null ? void 0 : capabilities.includes("decompress")) && actions.includes(IwFsEntryAction.Decompress);
  const isWrappable = (capabilities == null ? void 0 : capabilities.includes("wrap")) && entry.isDirectory;
  const isMovable = capabilities == null ? void 0 : capabilities.includes("move");
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    isDecompressible && /* @__PURE__ */ jsxRuntimeExports.jsx(
      DecompressBalloon,
      {
        entry,
        passwords: entry.passwordsForDecompressing,
        trigger: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { size: "sm", variant: "ghost", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$K, { className: "text-sm" }),
          t2("Decompress")
        ] })
      },
      "decompress"
    ),
    isWrappable && /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Button,
      {
        size: "sm",
        variant: "ghost",
        onClick: () => {
          createPortal(WrapModal, {
            entries: [entry]
          });
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$19, { className: "text-sm" }),
          t2("Wrap")
        ]
      },
      "wrap"
    ),
    isMovable && /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Button,
      {
        size: "sm",
        variant: "ghost",
        onClick: (e2) => {
          createPortal(FolderSelector, {
            sources: ["media library", "custom"],
            onSelect: (path) => {
              return BApi$1.file.moveEntries({
                destDir: path,
                entryPaths: [entry.path]
              });
            }
          });
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$f, { className: "text-sm" }),
          t2("Move")
        ]
      },
      "move"
    )
  ] });
};
RightOperations.displayName = "RightOperations";
const AUDIO_EXTENSIONS = /\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i;
const VIDEO_EXTENSIONS = /\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i;
const HLS_EXTENSIONS = /\.(m3u8)($|\?)/i;
const DASH_EXTENSIONS = /\.(mpd)($|\?)/i;
const MATCH_URL_MUX = /stream\.mux\.com\/(?!\w+\.m3u8)(\w+)/;
const MATCH_URL_YOUTUBE = /(?:youtu\.be\/|youtube(?:-nocookie|education)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//;
const MATCH_URL_VIMEO = /vimeo\.com\/(?!progressive_redirect).+/;
const MATCH_URL_WISTIA = /(?:wistia\.(?:com|net)|wi\.st)\/(?:medias|embed)\/(?:iframe\/)?([^?]+)/;
const MATCH_URL_SPOTIFY = /open\.spotify\.com\/(\w+)\/(\w+)/i;
const MATCH_URL_TWITCH = /(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+|(videos?\/|\?video=)\d+)($|\?)/;
const MATCH_URL_TIKTOK = /tiktok\.com\/(?:@[^/]+\/video\/)?(\d+)(?:\/([\w-]+))?/;
const canPlayFile = (url2, test2) => {
  if (Array.isArray(url2)) {
    for (const item of url2) {
      if (typeof item === "string" && canPlayFile(item, test2)) {
        return true;
      }
      if (canPlayFile(item.src, test2)) {
        return true;
      }
    }
    return false;
  }
  return test2(url2);
};
const canPlay = {
  html: (url2) => canPlayFile(url2, (u2) => AUDIO_EXTENSIONS.test(u2) || VIDEO_EXTENSIONS.test(u2)),
  hls: (url2) => canPlayFile(url2, (u2) => HLS_EXTENSIONS.test(u2)),
  dash: (url2) => canPlayFile(url2, (u2) => DASH_EXTENSIONS.test(u2)),
  mux: (url2) => MATCH_URL_MUX.test(url2),
  youtube: (url2) => MATCH_URL_YOUTUBE.test(url2),
  vimeo: (url2) => MATCH_URL_VIMEO.test(url2) && !VIDEO_EXTENSIONS.test(url2) && !HLS_EXTENSIONS.test(url2),
  wistia: (url2) => MATCH_URL_WISTIA.test(url2),
  spotify: (url2) => MATCH_URL_SPOTIFY.test(url2),
  twitch: (url2) => MATCH_URL_TWITCH.test(url2),
  tiktok: (url2) => MATCH_URL_TIKTOK.test(url2)
};
const HtmlPlayer = React$5.forwardRef((props, ref) => {
  const Media = AUDIO_EXTENSIONS.test(`${props.src}`) ? "audio" : "video";
  return /* @__PURE__ */ React$5.createElement(Media, { ...props, ref }, props.children);
});
var HtmlPlayer_default = HtmlPlayer;
const Players = [
  {
    key: "hls",
    name: "hls.js",
    canPlay: canPlay.hls,
    canEnablePIP: () => true,
    player: reactExports.lazy(
      () => __vitePreload(() => import(
        /* webpackChunkName: 'reactPlayerHls' */
        "./react-B_L_SoWM.js"
      ), true ? __vite__mapDeps([0,1,2,3]) : void 0)
    )
  },
  {
    key: "dash",
    name: "dash.js",
    canPlay: canPlay.dash,
    canEnablePIP: () => true,
    player: reactExports.lazy(
      () => __vitePreload(() => import(
        /* webpackChunkName: 'reactPlayerDash' */
        "./react-Bc3bwpW9.js"
      ), true ? __vite__mapDeps([4,1]) : void 0)
    )
  },
  {
    key: "mux",
    name: "Mux",
    canPlay: canPlay.mux,
    canEnablePIP: () => true,
    player: reactExports.lazy(
      () => __vitePreload(() => import(
        /* webpackChunkName: 'reactPlayerMux' */
        "./index-B2-TlsHd.js"
      ), true ? __vite__mapDeps([5,3,1,2]) : void 0)
    )
  },
  {
    key: "youtube",
    name: "YouTube",
    canPlay: canPlay.youtube,
    player: reactExports.lazy(
      () => __vitePreload(() => import(
        /* webpackChunkName: 'reactPlayerYouTube' */
        "./react-E2k9ZPSW.js"
      ), true ? __vite__mapDeps([]) : void 0)
    )
  },
  {
    key: "vimeo",
    name: "Vimeo",
    canPlay: canPlay.vimeo,
    player: reactExports.lazy(
      () => __vitePreload(() => import(
        /* webpackChunkName: 'reactPlayerVimeo' */
        "./react-D0f4vfuP.js"
      ), true ? __vite__mapDeps([]) : void 0)
    )
  },
  {
    key: "wistia",
    name: "Wistia",
    canPlay: canPlay.wistia,
    canEnablePIP: () => true,
    player: reactExports.lazy(
      () => __vitePreload(() => import(
        /* webpackChunkName: 'reactPlayerWistia' */
        "./react-CAkixedh.js"
      ), true ? __vite__mapDeps([]) : void 0)
    )
  },
  {
    key: "spotify",
    name: "Spotify",
    canPlay: canPlay.spotify,
    canEnablePIP: () => false,
    player: reactExports.lazy(
      () => __vitePreload(() => import(
        /* webpackChunkName: 'reactPlayerSpotify' */
        "./react-DFeqzHFL.js"
      ), true ? __vite__mapDeps([]) : void 0)
    )
  },
  {
    key: "twitch",
    name: "Twitch",
    canPlay: canPlay.twitch,
    canEnablePIP: () => false,
    player: reactExports.lazy(
      () => __vitePreload(() => import(
        /* webpackChunkName: 'reactPlayerTwitch' */
        "./react-DpyaFQuv.js"
      ), true ? __vite__mapDeps([]) : void 0)
    )
  },
  {
    key: "tiktok",
    name: "TikTok",
    canPlay: canPlay.tiktok,
    canEnablePIP: () => false,
    player: reactExports.lazy(
      () => __vitePreload(() => import(
        /* webpackChunkName: 'reactPlayerTiktok' */
        "./react-OngOK75K.js"
      ), true ? __vite__mapDeps([]) : void 0)
    )
  },
  {
    key: "html",
    name: "html",
    canPlay: canPlay.html,
    canEnablePIP: () => true,
    player: HtmlPlayer_default
  }
];
var players_default = Players;
const defaultProps$1 = {
  // Falsy values don't need to be defined
  //
  // native video attrs
  // src: undefined,
  // preload: undefined,
  // crossOrigin: undefined,
  // autoPlay: false,
  // muted: false,
  // loop: false,
  // controls: false,
  // playsInline: false,
  width: "320px",
  height: "180px",
  // native video props
  volume: 1,
  playbackRate: 1,
  // custom props
  // playing: undefined,
  // pip: false,
  // light: false,
  // fallback: null,
  previewTabIndex: 0,
  previewAriaLabel: "",
  oEmbedUrl: "https://noembed.com/embed?url={url}"
};
const Player = React$5.forwardRef((props, ref) => {
  const { playing, pip } = props;
  const Player2 = props.activePlayer;
  const playerRef = reactExports.useRef(null);
  const startOnPlayRef = reactExports.useRef(true);
  reactExports.useEffect(() => {
    var _a2, _b2;
    if (!playerRef.current)
      return;
    if (playerRef.current.paused && playing === true) {
      playerRef.current.play();
    }
    if (!playerRef.current.paused && playing === false) {
      playerRef.current.pause();
    }
    playerRef.current.playbackRate = (_a2 = props.playbackRate) != null ? _a2 : 1;
    playerRef.current.volume = (_b2 = props.volume) != null ? _b2 : 1;
  });
  reactExports.useEffect(() => {
    var _a2, _b2, _c2, _d, _e;
    if (!playerRef.current || !globalThis.document)
      return;
    if (pip && !document.pictureInPictureElement) {
      try {
        (_b2 = (_a2 = playerRef.current).requestPictureInPicture) == null ? void 0 : _b2.call(_a2);
      } catch (err) {
      }
    }
    if (!pip && document.pictureInPictureElement) {
      try {
        (_d = (_c2 = playerRef.current).exitPictureInPicture) == null ? void 0 : _d.call(_c2);
        (_e = document.exitPictureInPicture) == null ? void 0 : _e.call(document);
      } catch (err) {
      }
    }
  }, [pip]);
  const handleLoadStart = (event) => {
    var _a2, _b2;
    startOnPlayRef.current = true;
    (_a2 = props.onReady) == null ? void 0 : _a2.call(props);
    (_b2 = props.onLoadStart) == null ? void 0 : _b2.call(props, event);
  };
  const handlePlay = (event) => {
    var _a2, _b2;
    if (startOnPlayRef.current) {
      startOnPlayRef.current = false;
      (_a2 = props.onStart) == null ? void 0 : _a2.call(props, event);
    }
    (_b2 = props.onPlay) == null ? void 0 : _b2.call(props, event);
  };
  if (!Player2) {
    return null;
  }
  const eventProps = {};
  for (const key in props) {
    if (key.startsWith("on")) {
      eventProps[key] = props[key];
    }
  }
  return /* @__PURE__ */ React$5.createElement(
    Player2,
    {
      ...eventProps,
      style: props.style,
      className: props.className,
      slot: props.slot,
      ref: reactExports.useCallback(
        (node2) => {
          playerRef.current = node2;
          if (typeof ref === "function") {
            ref(node2);
          } else if (ref !== null) {
            ref.current = node2;
          }
        },
        [ref]
      ),
      src: props.src,
      crossOrigin: props.crossOrigin,
      preload: props.preload,
      controls: props.controls,
      muted: props.muted,
      autoPlay: props.autoPlay,
      loop: props.loop,
      playsInline: props.playsInline,
      config: props.config,
      onLoadStart: handleLoadStart,
      onPlay: handlePlay
    },
    props.children
  );
});
Player.displayName = "Player";
var Player_default = Player;
const Preview = reactExports.lazy(() => __vitePreload(() => import(
  /* webpackChunkName: 'reactPlayerPreview' */
  "./Preview-qvNHHv2C.js"
), true ? __vite__mapDeps([]) : void 0));
const customPlayers = [];
const createReactPlayer = (players, playerFallback) => {
  const getActivePlayer = (src) => {
    for (const player of [...customPlayers, ...players]) {
      if (src && player.canPlay(src)) {
        return player;
      }
    }
    if (playerFallback) {
      return playerFallback;
    }
    return null;
  };
  const ReactPlayer = React$5.forwardRef((_props, ref) => {
    const props = { ...defaultProps$1, ..._props };
    const { src, slot, className, style: style2, width, height, fallback: fallback2, wrapper } = props;
    const [showPreview, setShowPreview] = reactExports.useState(!!props.light);
    reactExports.useEffect(() => {
      if (props.light) {
        setShowPreview(true);
      } else {
        setShowPreview(false);
      }
    }, [props.light]);
    const handleClickPreview = (e2) => {
      var _a2;
      setShowPreview(false);
      (_a2 = props.onClickPreview) == null ? void 0 : _a2.call(props, e2);
    };
    const renderPreview = (src2) => {
      if (!src2)
        return null;
      const { light: light2, playIcon, previewTabIndex, oEmbedUrl, previewAriaLabel } = props;
      return /* @__PURE__ */ React$5.createElement(
        Preview,
        {
          src: src2,
          light: light2,
          playIcon,
          previewTabIndex,
          previewAriaLabel,
          oEmbedUrl,
          onClickPreview: handleClickPreview
        }
      );
    };
    const renderActivePlayer = (src2) => {
      var _a2, _b2;
      const player = getActivePlayer(src2);
      if (!player)
        return null;
      const { style: style22, width: width2, height: height2, wrapper: wrapper2 } = props;
      const config2 = (_a2 = props.config) == null ? void 0 : _a2[player.key];
      return /* @__PURE__ */ React$5.createElement(
        Player_default,
        {
          ...props,
          ref,
          activePlayer: (_b2 = player.player) != null ? _b2 : player,
          slot: wrapper2 ? void 0 : slot,
          className: wrapper2 ? void 0 : className,
          style: wrapper2 ? { display: "block", width: "100%", height: "100%" } : { display: "block", width: width2, height: height2, ...style22 },
          config: config2
        }
      );
    };
    const Wrapper2 = wrapper == null ? ForwardChildren : wrapper;
    const UniversalSuspense = fallback2 === false ? ForwardChildren : reactExports.Suspense;
    return /* @__PURE__ */ React$5.createElement(Wrapper2, { slot, className, style: { width, height, ...style2 } }, /* @__PURE__ */ React$5.createElement(UniversalSuspense, { fallback: fallback2 }, showPreview ? renderPreview(src) : renderActivePlayer(src)));
  });
  ReactPlayer.displayName = "ReactPlayer";
  ReactPlayer.addCustomPlayer = (player) => {
    customPlayers.push(player);
  };
  ReactPlayer.removeCustomPlayers = () => {
    customPlayers.length = 0;
  };
  ReactPlayer.canPlay = (src) => {
    if (src) {
      for (const Player2 of [...customPlayers, ...players]) {
        if (Player2.canPlay(src)) {
          return true;
        }
      }
    }
    return false;
  };
  ReactPlayer.canEnablePIP = (src) => {
    var _a2;
    if (src) {
      for (const Player2 of [...customPlayers, ...players]) {
        if (Player2.canPlay(src) && ((_a2 = Player2.canEnablePIP) == null ? void 0 : _a2.call(Player2))) {
          return true;
        }
      }
    }
    return false;
  };
  return ReactPlayer;
};
const ForwardChildren = ({ children }) => children;
const fallback = players_default[players_default.length - 1];
var src_default = createReactPlayer(players_default, fallback);
//! moment.js
//! version : 2.30.1
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
var hookCallback;
function hooks() {
  return hookCallback.apply(null, arguments);
}
function setHookCallback(callback2) {
  hookCallback = callback2;
}
function isArray$2(input2) {
  return input2 instanceof Array || Object.prototype.toString.call(input2) === "[object Array]";
}
function isObject$1(input2) {
  return input2 != null && Object.prototype.toString.call(input2) === "[object Object]";
}
function hasOwnProp(a2, b2) {
  return Object.prototype.hasOwnProperty.call(a2, b2);
}
function isObjectEmpty(obj) {
  if (Object.getOwnPropertyNames) {
    return Object.getOwnPropertyNames(obj).length === 0;
  } else {
    var k2;
    for (k2 in obj) {
      if (hasOwnProp(obj, k2)) {
        return false;
      }
    }
    return true;
  }
}
function isUndefined$1(input2) {
  return input2 === void 0;
}
function isNumber$1(input2) {
  return typeof input2 === "number" || Object.prototype.toString.call(input2) === "[object Number]";
}
function isDate$1(input2) {
  return input2 instanceof Date || Object.prototype.toString.call(input2) === "[object Date]";
}
function map(arr, fn) {
  var res = [], i2, arrLen = arr.length;
  for (i2 = 0; i2 < arrLen; ++i2) {
    res.push(fn(arr[i2], i2));
  }
  return res;
}
function extend$3(a2, b2) {
  for (var i2 in b2) {
    if (hasOwnProp(b2, i2)) {
      a2[i2] = b2[i2];
    }
  }
  if (hasOwnProp(b2, "toString")) {
    a2.toString = b2.toString;
  }
  if (hasOwnProp(b2, "valueOf")) {
    a2.valueOf = b2.valueOf;
  }
  return a2;
}
function createUTC(input2, format2, locale2, strict) {
  return createLocalOrUTC(input2, format2, locale2, strict, true).utc();
}
function defaultParsingFlags() {
  return {
    empty: false,
    unusedTokens: [],
    unusedInput: [],
    overflow: -2,
    charsLeftOver: 0,
    nullInput: false,
    invalidEra: null,
    invalidMonth: null,
    invalidFormat: false,
    userInvalidated: false,
    iso: false,
    parsedDateParts: [],
    era: null,
    meridiem: null,
    rfc2822: false,
    weekdayMismatch: false
  };
}
function getParsingFlags(m2) {
  if (m2._pf == null) {
    m2._pf = defaultParsingFlags();
  }
  return m2._pf;
}
var some;
if (Array.prototype.some) {
  some = Array.prototype.some;
} else {
  some = function(fun) {
    var t2 = Object(this), len = t2.length >>> 0, i2;
    for (i2 = 0; i2 < len; i2++) {
      if (i2 in t2 && fun.call(this, t2[i2], i2, t2)) {
        return true;
      }
    }
    return false;
  };
}
function isValid2(m2) {
  var flags = null, parsedParts = false, isNowValid = m2._d && !isNaN(m2._d.getTime());
  if (isNowValid) {
    flags = getParsingFlags(m2);
    parsedParts = some.call(flags.parsedDateParts, function(i2) {
      return i2 != null;
    });
    isNowValid = flags.overflow < 0 && !flags.empty && !flags.invalidEra && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts);
    if (m2._strict) {
      isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === void 0;
    }
  }
  if (Object.isFrozen == null || !Object.isFrozen(m2)) {
    m2._isValid = isNowValid;
  } else {
    return isNowValid;
  }
  return m2._isValid;
}
function createInvalid(flags) {
  var m2 = createUTC(NaN);
  if (flags != null) {
    extend$3(getParsingFlags(m2), flags);
  } else {
    getParsingFlags(m2).userInvalidated = true;
  }
  return m2;
}
var momentProperties = hooks.momentProperties = [], updateInProgress = false;
function copyConfig(to2, from2) {
  var i2, prop, val, momentPropertiesLen = momentProperties.length;
  if (!isUndefined$1(from2._isAMomentObject)) {
    to2._isAMomentObject = from2._isAMomentObject;
  }
  if (!isUndefined$1(from2._i)) {
    to2._i = from2._i;
  }
  if (!isUndefined$1(from2._f)) {
    to2._f = from2._f;
  }
  if (!isUndefined$1(from2._l)) {
    to2._l = from2._l;
  }
  if (!isUndefined$1(from2._strict)) {
    to2._strict = from2._strict;
  }
  if (!isUndefined$1(from2._tzm)) {
    to2._tzm = from2._tzm;
  }
  if (!isUndefined$1(from2._isUTC)) {
    to2._isUTC = from2._isUTC;
  }
  if (!isUndefined$1(from2._offset)) {
    to2._offset = from2._offset;
  }
  if (!isUndefined$1(from2._pf)) {
    to2._pf = getParsingFlags(from2);
  }
  if (!isUndefined$1(from2._locale)) {
    to2._locale = from2._locale;
  }
  if (momentPropertiesLen > 0) {
    for (i2 = 0; i2 < momentPropertiesLen; i2++) {
      prop = momentProperties[i2];
      val = from2[prop];
      if (!isUndefined$1(val)) {
        to2[prop] = val;
      }
    }
  }
  return to2;
}
function Moment(config2) {
  copyConfig(this, config2);
  this._d = new Date(config2._d != null ? config2._d.getTime() : NaN);
  if (!this.isValid()) {
    this._d = /* @__PURE__ */ new Date(NaN);
  }
  if (updateInProgress === false) {
    updateInProgress = true;
    hooks.updateOffset(this);
    updateInProgress = false;
  }
}
function isMoment(obj) {
  return obj instanceof Moment || obj != null && obj._isAMomentObject != null;
}
function warn2(msg) {
  if (hooks.suppressDeprecationWarnings === false && typeof console !== "undefined" && console.warn) {
    console.warn("Deprecation warning: " + msg);
  }
}
function deprecate(msg, fn) {
  var firstTime = true;
  return extend$3(function() {
    if (hooks.deprecationHandler != null) {
      hooks.deprecationHandler(null, msg);
    }
    if (firstTime) {
      var args = [], arg, i2, key, argLen = arguments.length;
      for (i2 = 0; i2 < argLen; i2++) {
        arg = "";
        if (typeof arguments[i2] === "object") {
          arg += "\n[" + i2 + "] ";
          for (key in arguments[0]) {
            if (hasOwnProp(arguments[0], key)) {
              arg += key + ": " + arguments[0][key] + ", ";
            }
          }
          arg = arg.slice(0, -2);
        } else {
          arg = arguments[i2];
        }
        args.push(arg);
      }
      warn2(
        msg + "\nArguments: " + Array.prototype.slice.call(args).join("") + "\n" + new Error().stack
      );
      firstTime = false;
    }
    return fn.apply(this, arguments);
  }, fn);
}
var deprecations$1 = {};
function deprecateSimple(name2, msg) {
  if (hooks.deprecationHandler != null) {
    hooks.deprecationHandler(name2, msg);
  }
  if (!deprecations$1[name2]) {
    warn2(msg);
    deprecations$1[name2] = true;
  }
}
hooks.suppressDeprecationWarnings = false;
hooks.deprecationHandler = null;
function isFunction$1(input2) {
  return typeof Function !== "undefined" && input2 instanceof Function || Object.prototype.toString.call(input2) === "[object Function]";
}
function set(config2) {
  var prop, i2;
  for (i2 in config2) {
    if (hasOwnProp(config2, i2)) {
      prop = config2[i2];
      if (isFunction$1(prop)) {
        this[i2] = prop;
      } else {
        this["_" + i2] = prop;
      }
    }
  }
  this._config = config2;
  this._dayOfMonthOrdinalParseLenient = new RegExp(
    (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + "|" + /\d{1,2}/.source
  );
}
function mergeConfigs(parentConfig, childConfig) {
  var res = extend$3({}, parentConfig), prop;
  for (prop in childConfig) {
    if (hasOwnProp(childConfig, prop)) {
      if (isObject$1(parentConfig[prop]) && isObject$1(childConfig[prop])) {
        res[prop] = {};
        extend$3(res[prop], parentConfig[prop]);
        extend$3(res[prop], childConfig[prop]);
      } else if (childConfig[prop] != null) {
        res[prop] = childConfig[prop];
      } else {
        delete res[prop];
      }
    }
  }
  for (prop in parentConfig) {
    if (hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject$1(parentConfig[prop])) {
      res[prop] = extend$3({}, res[prop]);
    }
  }
  return res;
}
function Locale(config2) {
  if (config2 != null) {
    this.set(config2);
  }
}
var keys$1;
if (Object.keys) {
  keys$1 = Object.keys;
} else {
  keys$1 = function(obj) {
    var i2, res = [];
    for (i2 in obj) {
      if (hasOwnProp(obj, i2)) {
        res.push(i2);
      }
    }
    return res;
  };
}
var defaultCalendar = {
  sameDay: "[Today at] LT",
  nextDay: "[Tomorrow at] LT",
  nextWeek: "dddd [at] LT",
  lastDay: "[Yesterday at] LT",
  lastWeek: "[Last] dddd [at] LT",
  sameElse: "L"
};
function calendar(key, mom, now2) {
  var output2 = this._calendar[key] || this._calendar["sameElse"];
  return isFunction$1(output2) ? output2.call(mom, now2) : output2;
}
function zeroFill(number4, targetLength, forceSign) {
  var absNumber = "" + Math.abs(number4), zerosToFill = targetLength - absNumber.length, sign2 = number4 >= 0;
  return (sign2 ? forceSign ? "+" : "" : "-") + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
}
var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, formatFunctions = {}, formatTokenFunctions = {};
function addFormatToken(token2, padded, ordinal2, callback2) {
  var func = callback2;
  if (typeof callback2 === "string") {
    func = function() {
      return this[callback2]();
    };
  }
  if (token2) {
    formatTokenFunctions[token2] = func;
  }
  if (padded) {
    formatTokenFunctions[padded[0]] = function() {
      return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
    };
  }
  if (ordinal2) {
    formatTokenFunctions[ordinal2] = function() {
      return this.localeData().ordinal(
        func.apply(this, arguments),
        token2
      );
    };
  }
}
function removeFormattingTokens(input2) {
  if (input2.match(/\[[\s\S]/)) {
    return input2.replace(/^\[|\]$/g, "");
  }
  return input2.replace(/\\/g, "");
}
function makeFormatFunction(format2) {
  var array4 = format2.match(formattingTokens), i2, length2;
  for (i2 = 0, length2 = array4.length; i2 < length2; i2++) {
    if (formatTokenFunctions[array4[i2]]) {
      array4[i2] = formatTokenFunctions[array4[i2]];
    } else {
      array4[i2] = removeFormattingTokens(array4[i2]);
    }
  }
  return function(mom) {
    var output2 = "", i3;
    for (i3 = 0; i3 < length2; i3++) {
      output2 += isFunction$1(array4[i3]) ? array4[i3].call(mom, format2) : array4[i3];
    }
    return output2;
  };
}
function formatMoment(m2, format2) {
  if (!m2.isValid()) {
    return m2.localeData().invalidDate();
  }
  format2 = expandFormat(format2, m2.localeData());
  formatFunctions[format2] = formatFunctions[format2] || makeFormatFunction(format2);
  return formatFunctions[format2](m2);
}
function expandFormat(format2, locale2) {
  var i2 = 5;
  function replaceLongDateFormatTokens(input2) {
    return locale2.longDateFormat(input2) || input2;
  }
  localFormattingTokens.lastIndex = 0;
  while (i2 >= 0 && localFormattingTokens.test(format2)) {
    format2 = format2.replace(
      localFormattingTokens,
      replaceLongDateFormatTokens
    );
    localFormattingTokens.lastIndex = 0;
    i2 -= 1;
  }
  return format2;
}
var defaultLongDateFormat = {
  LTS: "h:mm:ss A",
  LT: "h:mm A",
  L: "MM/DD/YYYY",
  LL: "MMMM D, YYYY",
  LLL: "MMMM D, YYYY h:mm A",
  LLLL: "dddd, MMMM D, YYYY h:mm A"
};
function longDateFormat(key) {
  var format2 = this._longDateFormat[key], formatUpper = this._longDateFormat[key.toUpperCase()];
  if (format2 || !formatUpper) {
    return format2;
  }
  this._longDateFormat[key] = formatUpper.match(formattingTokens).map(function(tok) {
    if (tok === "MMMM" || tok === "MM" || tok === "DD" || tok === "dddd") {
      return tok.slice(1);
    }
    return tok;
  }).join("");
  return this._longDateFormat[key];
}
var defaultInvalidDate = "Invalid date";
function invalidDate() {
  return this._invalidDate;
}
var defaultOrdinal = "%d", defaultDayOfMonthOrdinalParse = /\d{1,2}/;
function ordinal(number4) {
  return this._ordinal.replace("%d", number4);
}
var defaultRelativeTime = {
  future: "in %s",
  past: "%s ago",
  s: "a few seconds",
  ss: "%d seconds",
  m: "a minute",
  mm: "%d minutes",
  h: "an hour",
  hh: "%d hours",
  d: "a day",
  dd: "%d days",
  w: "a week",
  ww: "%d weeks",
  M: "a month",
  MM: "%d months",
  y: "a year",
  yy: "%d years"
};
function relativeTime(number4, withoutSuffix, string3, isFuture) {
  var output2 = this._relativeTime[string3];
  return isFunction$1(output2) ? output2(number4, withoutSuffix, string3, isFuture) : output2.replace(/%d/i, number4);
}
function pastFuture(diff2, output2) {
  var format2 = this._relativeTime[diff2 > 0 ? "future" : "past"];
  return isFunction$1(format2) ? format2(output2) : format2.replace(/%s/i, output2);
}
var aliases = {
  D: "date",
  dates: "date",
  date: "date",
  d: "day",
  days: "day",
  day: "day",
  e: "weekday",
  weekdays: "weekday",
  weekday: "weekday",
  E: "isoWeekday",
  isoweekdays: "isoWeekday",
  isoweekday: "isoWeekday",
  DDD: "dayOfYear",
  dayofyears: "dayOfYear",
  dayofyear: "dayOfYear",
  h: "hour",
  hours: "hour",
  hour: "hour",
  ms: "millisecond",
  milliseconds: "millisecond",
  millisecond: "millisecond",
  m: "minute",
  minutes: "minute",
  minute: "minute",
  M: "month",
  months: "month",
  month: "month",
  Q: "quarter",
  quarters: "quarter",
  quarter: "quarter",
  s: "second",
  seconds: "second",
  second: "second",
  gg: "weekYear",
  weekyears: "weekYear",
  weekyear: "weekYear",
  GG: "isoWeekYear",
  isoweekyears: "isoWeekYear",
  isoweekyear: "isoWeekYear",
  w: "week",
  weeks: "week",
  week: "week",
  W: "isoWeek",
  isoweeks: "isoWeek",
  isoweek: "isoWeek",
  y: "year",
  years: "year",
  year: "year"
};
function normalizeUnits(units) {
  return typeof units === "string" ? aliases[units] || aliases[units.toLowerCase()] : void 0;
}
function normalizeObjectUnits(inputObject) {
  var normalizedInput = {}, normalizedProp, prop;
  for (prop in inputObject) {
    if (hasOwnProp(inputObject, prop)) {
      normalizedProp = normalizeUnits(prop);
      if (normalizedProp) {
        normalizedInput[normalizedProp] = inputObject[prop];
      }
    }
  }
  return normalizedInput;
}
var priorities = {
  date: 9,
  day: 11,
  weekday: 11,
  isoWeekday: 11,
  dayOfYear: 4,
  hour: 13,
  millisecond: 16,
  minute: 14,
  month: 8,
  quarter: 7,
  second: 15,
  weekYear: 1,
  isoWeekYear: 1,
  week: 5,
  isoWeek: 5,
  year: 1
};
function getPrioritizedUnits(unitsObj) {
  var units = [], u2;
  for (u2 in unitsObj) {
    if (hasOwnProp(unitsObj, u2)) {
      units.push({ unit: u2, priority: priorities[u2] });
    }
  }
  units.sort(function(a2, b2) {
    return a2.priority - b2.priority;
  });
  return units;
}
var match1 = /\d/, match2 = /\d\d/, match3 = /\d{3}/, match4 = /\d{4}/, match6 = /[+-]?\d{6}/, match1to2 = /\d\d?/, match3to4 = /\d\d\d\d?/, match5to6 = /\d\d\d\d\d\d?/, match1to3 = /\d{1,3}/, match1to4 = /\d{1,4}/, match1to6 = /[+-]?\d{1,6}/, matchUnsigned = /\d+/, matchSigned = /[+-]?\d+/, matchOffset = /Z|[+-]\d\d:?\d\d/gi, matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, match1to2NoLeadingZero = /^[1-9]\d?/, match1to2HasZero = /^([1-9]\d|\d)/, regexes;
regexes = {};
function addRegexToken(token2, regex2, strictRegex) {
  regexes[token2] = isFunction$1(regex2) ? regex2 : function(isStrict, localeData2) {
    return isStrict && strictRegex ? strictRegex : regex2;
  };
}
function getParseRegexForToken(token2, config2) {
  if (!hasOwnProp(regexes, token2)) {
    return new RegExp(unescapeFormat(token2));
  }
  return regexes[token2](config2._strict, config2._locale);
}
function unescapeFormat(s2) {
  return regexEscape(
    s2.replace("\\", "").replace(
      /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,
      function(matched, p1, p2, p3, p4) {
        return p1 || p2 || p3 || p4;
      }
    )
  );
}
function regexEscape(s2) {
  return s2.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
}
function absFloor(number4) {
  if (number4 < 0) {
    return Math.ceil(number4) || 0;
  } else {
    return Math.floor(number4);
  }
}
function toInt(argumentForCoercion) {
  var coercedNumber = +argumentForCoercion, value2 = 0;
  if (coercedNumber !== 0 && isFinite(coercedNumber)) {
    value2 = absFloor(coercedNumber);
  }
  return value2;
}
var tokens = {};
function addParseToken(token2, callback2) {
  var i2, func = callback2, tokenLen;
  if (typeof token2 === "string") {
    token2 = [token2];
  }
  if (isNumber$1(callback2)) {
    func = function(input2, array4) {
      array4[callback2] = toInt(input2);
    };
  }
  tokenLen = token2.length;
  for (i2 = 0; i2 < tokenLen; i2++) {
    tokens[token2[i2]] = func;
  }
}
function addWeekParseToken(token2, callback2) {
  addParseToken(token2, function(input2, array4, config2, token3) {
    config2._w = config2._w || {};
    callback2(input2, config2._w, config2, token3);
  });
}
function addTimeToArrayFromToken(token2, input2, config2) {
  if (input2 != null && hasOwnProp(tokens, token2)) {
    tokens[token2](input2, config2._a, config2, token2);
  }
}
function isLeapYear(year) {
  return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
}
var YEAR = 0, MONTH = 1, DATE$1 = 2, HOUR = 3, MINUTE = 4, SECOND = 5, MILLISECOND = 6, WEEK = 7, WEEKDAY = 8;
addFormatToken("Y", 0, 0, function() {
  var y2 = this.year();
  return y2 <= 9999 ? zeroFill(y2, 4) : "+" + y2;
});
addFormatToken(0, ["YY", 2], 0, function() {
  return this.year() % 100;
});
addFormatToken(0, ["YYYY", 4], 0, "year");
addFormatToken(0, ["YYYYY", 5], 0, "year");
addFormatToken(0, ["YYYYYY", 6, true], 0, "year");
addRegexToken("Y", matchSigned);
addRegexToken("YY", match1to2, match2);
addRegexToken("YYYY", match1to4, match4);
addRegexToken("YYYYY", match1to6, match6);
addRegexToken("YYYYYY", match1to6, match6);
addParseToken(["YYYYY", "YYYYYY"], YEAR);
addParseToken("YYYY", function(input2, array4) {
  array4[YEAR] = input2.length === 2 ? hooks.parseTwoDigitYear(input2) : toInt(input2);
});
addParseToken("YY", function(input2, array4) {
  array4[YEAR] = hooks.parseTwoDigitYear(input2);
});
addParseToken("Y", function(input2, array4) {
  array4[YEAR] = parseInt(input2, 10);
});
function daysInYear(year) {
  return isLeapYear(year) ? 366 : 365;
}
hooks.parseTwoDigitYear = function(input2) {
  return toInt(input2) + (toInt(input2) > 68 ? 1900 : 2e3);
};
var getSetYear = makeGetSet("FullYear", true);
function getIsLeapYear() {
  return isLeapYear(this.year());
}
function makeGetSet(unit2, keepTime) {
  return function(value2) {
    if (value2 != null) {
      set$1(this, unit2, value2);
      hooks.updateOffset(this, keepTime);
      return this;
    } else {
      return get4(this, unit2);
    }
  };
}
function get4(mom, unit2) {
  if (!mom.isValid()) {
    return NaN;
  }
  var d2 = mom._d, isUTC = mom._isUTC;
  switch (unit2) {
    case "Milliseconds":
      return isUTC ? d2.getUTCMilliseconds() : d2.getMilliseconds();
    case "Seconds":
      return isUTC ? d2.getUTCSeconds() : d2.getSeconds();
    case "Minutes":
      return isUTC ? d2.getUTCMinutes() : d2.getMinutes();
    case "Hours":
      return isUTC ? d2.getUTCHours() : d2.getHours();
    case "Date":
      return isUTC ? d2.getUTCDate() : d2.getDate();
    case "Day":
      return isUTC ? d2.getUTCDay() : d2.getDay();
    case "Month":
      return isUTC ? d2.getUTCMonth() : d2.getMonth();
    case "FullYear":
      return isUTC ? d2.getUTCFullYear() : d2.getFullYear();
    default:
      return NaN;
  }
}
function set$1(mom, unit2, value2) {
  var d2, isUTC, year, month, date4;
  if (!mom.isValid() || isNaN(value2)) {
    return;
  }
  d2 = mom._d;
  isUTC = mom._isUTC;
  switch (unit2) {
    case "Milliseconds":
      return void (isUTC ? d2.setUTCMilliseconds(value2) : d2.setMilliseconds(value2));
    case "Seconds":
      return void (isUTC ? d2.setUTCSeconds(value2) : d2.setSeconds(value2));
    case "Minutes":
      return void (isUTC ? d2.setUTCMinutes(value2) : d2.setMinutes(value2));
    case "Hours":
      return void (isUTC ? d2.setUTCHours(value2) : d2.setHours(value2));
    case "Date":
      return void (isUTC ? d2.setUTCDate(value2) : d2.setDate(value2));
    case "FullYear":
      break;
    default:
      return;
  }
  year = value2;
  month = mom.month();
  date4 = mom.date();
  date4 = date4 === 29 && month === 1 && !isLeapYear(year) ? 28 : date4;
  void (isUTC ? d2.setUTCFullYear(year, month, date4) : d2.setFullYear(year, month, date4));
}
function stringGet(units) {
  units = normalizeUnits(units);
  if (isFunction$1(this[units])) {
    return this[units]();
  }
  return this;
}
function stringSet(units, value2) {
  if (typeof units === "object") {
    units = normalizeObjectUnits(units);
    var prioritized = getPrioritizedUnits(units), i2, prioritizedLen = prioritized.length;
    for (i2 = 0; i2 < prioritizedLen; i2++) {
      this[prioritized[i2].unit](units[prioritized[i2].unit]);
    }
  } else {
    units = normalizeUnits(units);
    if (isFunction$1(this[units])) {
      return this[units](value2);
    }
  }
  return this;
}
function mod(n2, x2) {
  return (n2 % x2 + x2) % x2;
}
var indexOf;
if (Array.prototype.indexOf) {
  indexOf = Array.prototype.indexOf;
} else {
  indexOf = function(o2) {
    var i2;
    for (i2 = 0; i2 < this.length; ++i2) {
      if (this[i2] === o2) {
        return i2;
      }
    }
    return -1;
  };
}
function daysInMonth(year, month) {
  if (isNaN(year) || isNaN(month)) {
    return NaN;
  }
  var modMonth = mod(month, 12);
  year += (month - modMonth) / 12;
  return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2;
}
addFormatToken("M", ["MM", 2], "Mo", function() {
  return this.month() + 1;
});
addFormatToken("MMM", 0, 0, function(format2) {
  return this.localeData().monthsShort(this, format2);
});
addFormatToken("MMMM", 0, 0, function(format2) {
  return this.localeData().months(this, format2);
});
addRegexToken("M", match1to2, match1to2NoLeadingZero);
addRegexToken("MM", match1to2, match2);
addRegexToken("MMM", function(isStrict, locale2) {
  return locale2.monthsShortRegex(isStrict);
});
addRegexToken("MMMM", function(isStrict, locale2) {
  return locale2.monthsRegex(isStrict);
});
addParseToken(["M", "MM"], function(input2, array4) {
  array4[MONTH] = toInt(input2) - 1;
});
addParseToken(["MMM", "MMMM"], function(input2, array4, config2, token2) {
  var month = config2._locale.monthsParse(input2, token2, config2._strict);
  if (month != null) {
    array4[MONTH] = month;
  } else {
    getParsingFlags(config2).invalidMonth = input2;
  }
});
var defaultLocaleMonths = "January_February_March_April_May_June_July_August_September_October_November_December".split(
  "_"
), defaultLocaleMonthsShort = "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"), MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, defaultMonthsShortRegex = matchWord, defaultMonthsRegex = matchWord;
function localeMonths(m2, format2) {
  if (!m2) {
    return isArray$2(this._months) ? this._months : this._months["standalone"];
  }
  return isArray$2(this._months) ? this._months[m2.month()] : this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format2) ? "format" : "standalone"][m2.month()];
}
function localeMonthsShort(m2, format2) {
  if (!m2) {
    return isArray$2(this._monthsShort) ? this._monthsShort : this._monthsShort["standalone"];
  }
  return isArray$2(this._monthsShort) ? this._monthsShort[m2.month()] : this._monthsShort[MONTHS_IN_FORMAT.test(format2) ? "format" : "standalone"][m2.month()];
}
function handleStrictParse(monthName, format2, strict) {
  var i2, ii2, mom, llc = monthName.toLocaleLowerCase();
  if (!this._monthsParse) {
    this._monthsParse = [];
    this._longMonthsParse = [];
    this._shortMonthsParse = [];
    for (i2 = 0; i2 < 12; ++i2) {
      mom = createUTC([2e3, i2]);
      this._shortMonthsParse[i2] = this.monthsShort(
        mom,
        ""
      ).toLocaleLowerCase();
      this._longMonthsParse[i2] = this.months(mom, "").toLocaleLowerCase();
    }
  }
  if (strict) {
    if (format2 === "MMM") {
      ii2 = indexOf.call(this._shortMonthsParse, llc);
      return ii2 !== -1 ? ii2 : null;
    } else {
      ii2 = indexOf.call(this._longMonthsParse, llc);
      return ii2 !== -1 ? ii2 : null;
    }
  } else {
    if (format2 === "MMM") {
      ii2 = indexOf.call(this._shortMonthsParse, llc);
      if (ii2 !== -1) {
        return ii2;
      }
      ii2 = indexOf.call(this._longMonthsParse, llc);
      return ii2 !== -1 ? ii2 : null;
    } else {
      ii2 = indexOf.call(this._longMonthsParse, llc);
      if (ii2 !== -1) {
        return ii2;
      }
      ii2 = indexOf.call(this._shortMonthsParse, llc);
      return ii2 !== -1 ? ii2 : null;
    }
  }
}
function localeMonthsParse(monthName, format2, strict) {
  var i2, mom, regex2;
  if (this._monthsParseExact) {
    return handleStrictParse.call(this, monthName, format2, strict);
  }
  if (!this._monthsParse) {
    this._monthsParse = [];
    this._longMonthsParse = [];
    this._shortMonthsParse = [];
  }
  for (i2 = 0; i2 < 12; i2++) {
    mom = createUTC([2e3, i2]);
    if (strict && !this._longMonthsParse[i2]) {
      this._longMonthsParse[i2] = new RegExp(
        "^" + this.months(mom, "").replace(".", "") + "$",
        "i"
      );
      this._shortMonthsParse[i2] = new RegExp(
        "^" + this.monthsShort(mom, "").replace(".", "") + "$",
        "i"
      );
    }
    if (!strict && !this._monthsParse[i2]) {
      regex2 = "^" + this.months(mom, "") + "|^" + this.monthsShort(mom, "");
      this._monthsParse[i2] = new RegExp(regex2.replace(".", ""), "i");
    }
    if (strict && format2 === "MMMM" && this._longMonthsParse[i2].test(monthName)) {
      return i2;
    } else if (strict && format2 === "MMM" && this._shortMonthsParse[i2].test(monthName)) {
      return i2;
    } else if (!strict && this._monthsParse[i2].test(monthName)) {
      return i2;
    }
  }
}
function setMonth(mom, value2) {
  if (!mom.isValid()) {
    return mom;
  }
  if (typeof value2 === "string") {
    if (/^\d+$/.test(value2)) {
      value2 = toInt(value2);
    } else {
      value2 = mom.localeData().monthsParse(value2);
      if (!isNumber$1(value2)) {
        return mom;
      }
    }
  }
  var month = value2, date4 = mom.date();
  date4 = date4 < 29 ? date4 : Math.min(date4, daysInMonth(mom.year(), month));
  void (mom._isUTC ? mom._d.setUTCMonth(month, date4) : mom._d.setMonth(month, date4));
  return mom;
}
function getSetMonth(value2) {
  if (value2 != null) {
    setMonth(this, value2);
    hooks.updateOffset(this, true);
    return this;
  } else {
    return get4(this, "Month");
  }
}
function getDaysInMonth() {
  return daysInMonth(this.year(), this.month());
}
function monthsShortRegex(isStrict) {
  if (this._monthsParseExact) {
    if (!hasOwnProp(this, "_monthsRegex")) {
      computeMonthsParse.call(this);
    }
    if (isStrict) {
      return this._monthsShortStrictRegex;
    } else {
      return this._monthsShortRegex;
    }
  } else {
    if (!hasOwnProp(this, "_monthsShortRegex")) {
      this._monthsShortRegex = defaultMonthsShortRegex;
    }
    return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex;
  }
}
function monthsRegex(isStrict) {
  if (this._monthsParseExact) {
    if (!hasOwnProp(this, "_monthsRegex")) {
      computeMonthsParse.call(this);
    }
    if (isStrict) {
      return this._monthsStrictRegex;
    } else {
      return this._monthsRegex;
    }
  } else {
    if (!hasOwnProp(this, "_monthsRegex")) {
      this._monthsRegex = defaultMonthsRegex;
    }
    return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex;
  }
}
function computeMonthsParse() {
  function cmpLenRev(a2, b2) {
    return b2.length - a2.length;
  }
  var shortPieces = [], longPieces = [], mixedPieces = [], i2, mom, shortP, longP;
  for (i2 = 0; i2 < 12; i2++) {
    mom = createUTC([2e3, i2]);
    shortP = regexEscape(this.monthsShort(mom, ""));
    longP = regexEscape(this.months(mom, ""));
    shortPieces.push(shortP);
    longPieces.push(longP);
    mixedPieces.push(longP);
    mixedPieces.push(shortP);
  }
  shortPieces.sort(cmpLenRev);
  longPieces.sort(cmpLenRev);
  mixedPieces.sort(cmpLenRev);
  this._monthsRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
  this._monthsShortRegex = this._monthsRegex;
  this._monthsStrictRegex = new RegExp(
    "^(" + longPieces.join("|") + ")",
    "i"
  );
  this._monthsShortStrictRegex = new RegExp(
    "^(" + shortPieces.join("|") + ")",
    "i"
  );
}
function createDate(y2, m2, d2, h3, M2, s2, ms) {
  var date4;
  if (y2 < 100 && y2 >= 0) {
    date4 = new Date(y2 + 400, m2, d2, h3, M2, s2, ms);
    if (isFinite(date4.getFullYear())) {
      date4.setFullYear(y2);
    }
  } else {
    date4 = new Date(y2, m2, d2, h3, M2, s2, ms);
  }
  return date4;
}
function createUTCDate(y2) {
  var date4, args;
  if (y2 < 100 && y2 >= 0) {
    args = Array.prototype.slice.call(arguments);
    args[0] = y2 + 400;
    date4 = new Date(Date.UTC.apply(null, args));
    if (isFinite(date4.getUTCFullYear())) {
      date4.setUTCFullYear(y2);
    }
  } else {
    date4 = new Date(Date.UTC.apply(null, arguments));
  }
  return date4;
}
function firstWeekOffset(year, dow, doy) {
  var fwd = 7 + dow - doy, fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
  return -fwdlw + fwd - 1;
}
function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
  var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset(year, dow, doy), dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, resYear, resDayOfYear;
  if (dayOfYear <= 0) {
    resYear = year - 1;
    resDayOfYear = daysInYear(resYear) + dayOfYear;
  } else if (dayOfYear > daysInYear(year)) {
    resYear = year + 1;
    resDayOfYear = dayOfYear - daysInYear(year);
  } else {
    resYear = year;
    resDayOfYear = dayOfYear;
  }
  return {
    year: resYear,
    dayOfYear: resDayOfYear
  };
}
function weekOfYear(mom, dow, doy) {
  var weekOffset = firstWeekOffset(mom.year(), dow, doy), week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, resWeek, resYear;
  if (week < 1) {
    resYear = mom.year() - 1;
    resWeek = week + weeksInYear(resYear, dow, doy);
  } else if (week > weeksInYear(mom.year(), dow, doy)) {
    resWeek = week - weeksInYear(mom.year(), dow, doy);
    resYear = mom.year() + 1;
  } else {
    resYear = mom.year();
    resWeek = week;
  }
  return {
    week: resWeek,
    year: resYear
  };
}
function weeksInYear(year, dow, doy) {
  var weekOffset = firstWeekOffset(year, dow, doy), weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
  return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
}
addFormatToken("w", ["ww", 2], "wo", "week");
addFormatToken("W", ["WW", 2], "Wo", "isoWeek");
addRegexToken("w", match1to2, match1to2NoLeadingZero);
addRegexToken("ww", match1to2, match2);
addRegexToken("W", match1to2, match1to2NoLeadingZero);
addRegexToken("WW", match1to2, match2);
addWeekParseToken(
  ["w", "ww", "W", "WW"],
  function(input2, week, config2, token2) {
    week[token2.substr(0, 1)] = toInt(input2);
  }
);
function localeWeek(mom) {
  return weekOfYear(mom, this._week.dow, this._week.doy).week;
}
var defaultLocaleWeek = {
  dow: 0,
  // Sunday is the first day of the week.
  doy: 6
  // The week that contains Jan 6th is the first week of the year.
};
function localeFirstDayOfWeek() {
  return this._week.dow;
}
function localeFirstDayOfYear() {
  return this._week.doy;
}
function getSetWeek(input2) {
  var week = this.localeData().week(this);
  return input2 == null ? week : this.add((input2 - week) * 7, "d");
}
function getSetISOWeek(input2) {
  var week = weekOfYear(this, 1, 4).week;
  return input2 == null ? week : this.add((input2 - week) * 7, "d");
}
addFormatToken("d", 0, "do", "day");
addFormatToken("dd", 0, 0, function(format2) {
  return this.localeData().weekdaysMin(this, format2);
});
addFormatToken("ddd", 0, 0, function(format2) {
  return this.localeData().weekdaysShort(this, format2);
});
addFormatToken("dddd", 0, 0, function(format2) {
  return this.localeData().weekdays(this, format2);
});
addFormatToken("e", 0, 0, "weekday");
addFormatToken("E", 0, 0, "isoWeekday");
addRegexToken("d", match1to2);
addRegexToken("e", match1to2);
addRegexToken("E", match1to2);
addRegexToken("dd", function(isStrict, locale2) {
  return locale2.weekdaysMinRegex(isStrict);
});
addRegexToken("ddd", function(isStrict, locale2) {
  return locale2.weekdaysShortRegex(isStrict);
});
addRegexToken("dddd", function(isStrict, locale2) {
  return locale2.weekdaysRegex(isStrict);
});
addWeekParseToken(["dd", "ddd", "dddd"], function(input2, week, config2, token2) {
  var weekday = config2._locale.weekdaysParse(input2, token2, config2._strict);
  if (weekday != null) {
    week.d = weekday;
  } else {
    getParsingFlags(config2).invalidWeekday = input2;
  }
});
addWeekParseToken(["d", "e", "E"], function(input2, week, config2, token2) {
  week[token2] = toInt(input2);
});
function parseWeekday(input2, locale2) {
  if (typeof input2 !== "string") {
    return input2;
  }
  if (!isNaN(input2)) {
    return parseInt(input2, 10);
  }
  input2 = locale2.weekdaysParse(input2);
  if (typeof input2 === "number") {
    return input2;
  }
  return null;
}
function parseIsoWeekday(input2, locale2) {
  if (typeof input2 === "string") {
    return locale2.weekdaysParse(input2) % 7 || 7;
  }
  return isNaN(input2) ? null : input2;
}
function shiftWeekdays(ws, n2) {
  return ws.slice(n2, 7).concat(ws.slice(0, n2));
}
var defaultLocaleWeekdays = "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), defaultLocaleWeekdaysShort = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"), defaultLocaleWeekdaysMin = "Su_Mo_Tu_We_Th_Fr_Sa".split("_"), defaultWeekdaysRegex = matchWord, defaultWeekdaysShortRegex = matchWord, defaultWeekdaysMinRegex = matchWord;
function localeWeekdays(m2, format2) {
  var weekdays = isArray$2(this._weekdays) ? this._weekdays : this._weekdays[m2 && m2 !== true && this._weekdays.isFormat.test(format2) ? "format" : "standalone"];
  return m2 === true ? shiftWeekdays(weekdays, this._week.dow) : m2 ? weekdays[m2.day()] : weekdays;
}
function localeWeekdaysShort(m2) {
  return m2 === true ? shiftWeekdays(this._weekdaysShort, this._week.dow) : m2 ? this._weekdaysShort[m2.day()] : this._weekdaysShort;
}
function localeWeekdaysMin(m2) {
  return m2 === true ? shiftWeekdays(this._weekdaysMin, this._week.dow) : m2 ? this._weekdaysMin[m2.day()] : this._weekdaysMin;
}
function handleStrictParse$1(weekdayName, format2, strict) {
  var i2, ii2, mom, llc = weekdayName.toLocaleLowerCase();
  if (!this._weekdaysParse) {
    this._weekdaysParse = [];
    this._shortWeekdaysParse = [];
    this._minWeekdaysParse = [];
    for (i2 = 0; i2 < 7; ++i2) {
      mom = createUTC([2e3, 1]).day(i2);
      this._minWeekdaysParse[i2] = this.weekdaysMin(
        mom,
        ""
      ).toLocaleLowerCase();
      this._shortWeekdaysParse[i2] = this.weekdaysShort(
        mom,
        ""
      ).toLocaleLowerCase();
      this._weekdaysParse[i2] = this.weekdays(mom, "").toLocaleLowerCase();
    }
  }
  if (strict) {
    if (format2 === "dddd") {
      ii2 = indexOf.call(this._weekdaysParse, llc);
      return ii2 !== -1 ? ii2 : null;
    } else if (format2 === "ddd") {
      ii2 = indexOf.call(this._shortWeekdaysParse, llc);
      return ii2 !== -1 ? ii2 : null;
    } else {
      ii2 = indexOf.call(this._minWeekdaysParse, llc);
      return ii2 !== -1 ? ii2 : null;
    }
  } else {
    if (format2 === "dddd") {
      ii2 = indexOf.call(this._weekdaysParse, llc);
      if (ii2 !== -1) {
        return ii2;
      }
      ii2 = indexOf.call(this._shortWeekdaysParse, llc);
      if (ii2 !== -1) {
        return ii2;
      }
      ii2 = indexOf.call(this._minWeekdaysParse, llc);
      return ii2 !== -1 ? ii2 : null;
    } else if (format2 === "ddd") {
      ii2 = indexOf.call(this._shortWeekdaysParse, llc);
      if (ii2 !== -1) {
        return ii2;
      }
      ii2 = indexOf.call(this._weekdaysParse, llc);
      if (ii2 !== -1) {
        return ii2;
      }
      ii2 = indexOf.call(this._minWeekdaysParse, llc);
      return ii2 !== -1 ? ii2 : null;
    } else {
      ii2 = indexOf.call(this._minWeekdaysParse, llc);
      if (ii2 !== -1) {
        return ii2;
      }
      ii2 = indexOf.call(this._weekdaysParse, llc);
      if (ii2 !== -1) {
        return ii2;
      }
      ii2 = indexOf.call(this._shortWeekdaysParse, llc);
      return ii2 !== -1 ? ii2 : null;
    }
  }
}
function localeWeekdaysParse(weekdayName, format2, strict) {
  var i2, mom, regex2;
  if (this._weekdaysParseExact) {
    return handleStrictParse$1.call(this, weekdayName, format2, strict);
  }
  if (!this._weekdaysParse) {
    this._weekdaysParse = [];
    this._minWeekdaysParse = [];
    this._shortWeekdaysParse = [];
    this._fullWeekdaysParse = [];
  }
  for (i2 = 0; i2 < 7; i2++) {
    mom = createUTC([2e3, 1]).day(i2);
    if (strict && !this._fullWeekdaysParse[i2]) {
      this._fullWeekdaysParse[i2] = new RegExp(
        "^" + this.weekdays(mom, "").replace(".", "\\.?") + "$",
        "i"
      );
      this._shortWeekdaysParse[i2] = new RegExp(
        "^" + this.weekdaysShort(mom, "").replace(".", "\\.?") + "$",
        "i"
      );
      this._minWeekdaysParse[i2] = new RegExp(
        "^" + this.weekdaysMin(mom, "").replace(".", "\\.?") + "$",
        "i"
      );
    }
    if (!this._weekdaysParse[i2]) {
      regex2 = "^" + this.weekdays(mom, "") + "|^" + this.weekdaysShort(mom, "") + "|^" + this.weekdaysMin(mom, "");
      this._weekdaysParse[i2] = new RegExp(regex2.replace(".", ""), "i");
    }
    if (strict && format2 === "dddd" && this._fullWeekdaysParse[i2].test(weekdayName)) {
      return i2;
    } else if (strict && format2 === "ddd" && this._shortWeekdaysParse[i2].test(weekdayName)) {
      return i2;
    } else if (strict && format2 === "dd" && this._minWeekdaysParse[i2].test(weekdayName)) {
      return i2;
    } else if (!strict && this._weekdaysParse[i2].test(weekdayName)) {
      return i2;
    }
  }
}
function getSetDayOfWeek(input2) {
  if (!this.isValid()) {
    return input2 != null ? this : NaN;
  }
  var day = get4(this, "Day");
  if (input2 != null) {
    input2 = parseWeekday(input2, this.localeData());
    return this.add(input2 - day, "d");
  } else {
    return day;
  }
}
function getSetLocaleDayOfWeek(input2) {
  if (!this.isValid()) {
    return input2 != null ? this : NaN;
  }
  var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
  return input2 == null ? weekday : this.add(input2 - weekday, "d");
}
function getSetISODayOfWeek(input2) {
  if (!this.isValid()) {
    return input2 != null ? this : NaN;
  }
  if (input2 != null) {
    var weekday = parseIsoWeekday(input2, this.localeData());
    return this.day(this.day() % 7 ? weekday : weekday - 7);
  } else {
    return this.day() || 7;
  }
}
function weekdaysRegex(isStrict) {
  if (this._weekdaysParseExact) {
    if (!hasOwnProp(this, "_weekdaysRegex")) {
      computeWeekdaysParse.call(this);
    }
    if (isStrict) {
      return this._weekdaysStrictRegex;
    } else {
      return this._weekdaysRegex;
    }
  } else {
    if (!hasOwnProp(this, "_weekdaysRegex")) {
      this._weekdaysRegex = defaultWeekdaysRegex;
    }
    return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex;
  }
}
function weekdaysShortRegex(isStrict) {
  if (this._weekdaysParseExact) {
    if (!hasOwnProp(this, "_weekdaysRegex")) {
      computeWeekdaysParse.call(this);
    }
    if (isStrict) {
      return this._weekdaysShortStrictRegex;
    } else {
      return this._weekdaysShortRegex;
    }
  } else {
    if (!hasOwnProp(this, "_weekdaysShortRegex")) {
      this._weekdaysShortRegex = defaultWeekdaysShortRegex;
    }
    return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
  }
}
function weekdaysMinRegex(isStrict) {
  if (this._weekdaysParseExact) {
    if (!hasOwnProp(this, "_weekdaysRegex")) {
      computeWeekdaysParse.call(this);
    }
    if (isStrict) {
      return this._weekdaysMinStrictRegex;
    } else {
      return this._weekdaysMinRegex;
    }
  } else {
    if (!hasOwnProp(this, "_weekdaysMinRegex")) {
      this._weekdaysMinRegex = defaultWeekdaysMinRegex;
    }
    return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
  }
}
function computeWeekdaysParse() {
  function cmpLenRev(a2, b2) {
    return b2.length - a2.length;
  }
  var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], i2, mom, minp, shortp, longp;
  for (i2 = 0; i2 < 7; i2++) {
    mom = createUTC([2e3, 1]).day(i2);
    minp = regexEscape(this.weekdaysMin(mom, ""));
    shortp = regexEscape(this.weekdaysShort(mom, ""));
    longp = regexEscape(this.weekdays(mom, ""));
    minPieces.push(minp);
    shortPieces.push(shortp);
    longPieces.push(longp);
    mixedPieces.push(minp);
    mixedPieces.push(shortp);
    mixedPieces.push(longp);
  }
  minPieces.sort(cmpLenRev);
  shortPieces.sort(cmpLenRev);
  longPieces.sort(cmpLenRev);
  mixedPieces.sort(cmpLenRev);
  this._weekdaysRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
  this._weekdaysShortRegex = this._weekdaysRegex;
  this._weekdaysMinRegex = this._weekdaysRegex;
  this._weekdaysStrictRegex = new RegExp(
    "^(" + longPieces.join("|") + ")",
    "i"
  );
  this._weekdaysShortStrictRegex = new RegExp(
    "^(" + shortPieces.join("|") + ")",
    "i"
  );
  this._weekdaysMinStrictRegex = new RegExp(
    "^(" + minPieces.join("|") + ")",
    "i"
  );
}
function hFormat() {
  return this.hours() % 12 || 12;
}
function kFormat() {
  return this.hours() || 24;
}
addFormatToken("H", ["HH", 2], 0, "hour");
addFormatToken("h", ["hh", 2], 0, hFormat);
addFormatToken("k", ["kk", 2], 0, kFormat);
addFormatToken("hmm", 0, 0, function() {
  return "" + hFormat.apply(this) + zeroFill(this.minutes(), 2);
});
addFormatToken("hmmss", 0, 0, function() {
  return "" + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);
});
addFormatToken("Hmm", 0, 0, function() {
  return "" + this.hours() + zeroFill(this.minutes(), 2);
});
addFormatToken("Hmmss", 0, 0, function() {
  return "" + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);
});
function meridiem(token2, lowercase) {
  addFormatToken(token2, 0, 0, function() {
    return this.localeData().meridiem(
      this.hours(),
      this.minutes(),
      lowercase
    );
  });
}
meridiem("a", true);
meridiem("A", false);
function matchMeridiem(isStrict, locale2) {
  return locale2._meridiemParse;
}
addRegexToken("a", matchMeridiem);
addRegexToken("A", matchMeridiem);
addRegexToken("H", match1to2, match1to2HasZero);
addRegexToken("h", match1to2, match1to2NoLeadingZero);
addRegexToken("k", match1to2, match1to2NoLeadingZero);
addRegexToken("HH", match1to2, match2);
addRegexToken("hh", match1to2, match2);
addRegexToken("kk", match1to2, match2);
addRegexToken("hmm", match3to4);
addRegexToken("hmmss", match5to6);
addRegexToken("Hmm", match3to4);
addRegexToken("Hmmss", match5to6);
addParseToken(["H", "HH"], HOUR);
addParseToken(["k", "kk"], function(input2, array4, config2) {
  var kInput = toInt(input2);
  array4[HOUR] = kInput === 24 ? 0 : kInput;
});
addParseToken(["a", "A"], function(input2, array4, config2) {
  config2._isPm = config2._locale.isPM(input2);
  config2._meridiem = input2;
});
addParseToken(["h", "hh"], function(input2, array4, config2) {
  array4[HOUR] = toInt(input2);
  getParsingFlags(config2).bigHour = true;
});
addParseToken("hmm", function(input2, array4, config2) {
  var pos = input2.length - 2;
  array4[HOUR] = toInt(input2.substr(0, pos));
  array4[MINUTE] = toInt(input2.substr(pos));
  getParsingFlags(config2).bigHour = true;
});
addParseToken("hmmss", function(input2, array4, config2) {
  var pos1 = input2.length - 4, pos2 = input2.length - 2;
  array4[HOUR] = toInt(input2.substr(0, pos1));
  array4[MINUTE] = toInt(input2.substr(pos1, 2));
  array4[SECOND] = toInt(input2.substr(pos2));
  getParsingFlags(config2).bigHour = true;
});
addParseToken("Hmm", function(input2, array4, config2) {
  var pos = input2.length - 2;
  array4[HOUR] = toInt(input2.substr(0, pos));
  array4[MINUTE] = toInt(input2.substr(pos));
});
addParseToken("Hmmss", function(input2, array4, config2) {
  var pos1 = input2.length - 4, pos2 = input2.length - 2;
  array4[HOUR] = toInt(input2.substr(0, pos1));
  array4[MINUTE] = toInt(input2.substr(pos1, 2));
  array4[SECOND] = toInt(input2.substr(pos2));
});
function localeIsPM(input2) {
  return (input2 + "").toLowerCase().charAt(0) === "p";
}
var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i, getSetHour = makeGetSet("Hours", true);
function localeMeridiem(hours2, minutes2, isLower) {
  if (hours2 > 11) {
    return isLower ? "pm" : "PM";
  } else {
    return isLower ? "am" : "AM";
  }
}
var baseConfig = {
  calendar: defaultCalendar,
  longDateFormat: defaultLongDateFormat,
  invalidDate: defaultInvalidDate,
  ordinal: defaultOrdinal,
  dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
  relativeTime: defaultRelativeTime,
  months: defaultLocaleMonths,
  monthsShort: defaultLocaleMonthsShort,
  week: defaultLocaleWeek,
  weekdays: defaultLocaleWeekdays,
  weekdaysMin: defaultLocaleWeekdaysMin,
  weekdaysShort: defaultLocaleWeekdaysShort,
  meridiemParse: defaultLocaleMeridiemParse
};
var locales = {}, localeFamilies = {}, globalLocale;
function commonPrefix(arr1, arr2) {
  var i2, minl = Math.min(arr1.length, arr2.length);
  for (i2 = 0; i2 < minl; i2 += 1) {
    if (arr1[i2] !== arr2[i2]) {
      return i2;
    }
  }
  return minl;
}
function normalizeLocale(key) {
  return key ? key.toLowerCase().replace("_", "-") : key;
}
function chooseLocale(names2) {
  var i2 = 0, j2, next2, locale2, split2;
  while (i2 < names2.length) {
    split2 = normalizeLocale(names2[i2]).split("-");
    j2 = split2.length;
    next2 = normalizeLocale(names2[i2 + 1]);
    next2 = next2 ? next2.split("-") : null;
    while (j2 > 0) {
      locale2 = loadLocale(split2.slice(0, j2).join("-"));
      if (locale2) {
        return locale2;
      }
      if (next2 && next2.length >= j2 && commonPrefix(split2, next2) >= j2 - 1) {
        break;
      }
      j2--;
    }
    i2++;
  }
  return globalLocale;
}
function isLocaleNameSane(name2) {
  return !!(name2 && name2.match("^[^/\\\\]*$"));
}
function loadLocale(name2) {
  var oldLocale = null, aliasedRequire;
  if (locales[name2] === void 0 && typeof module !== "undefined" && module && module.exports && isLocaleNameSane(name2)) {
    try {
      oldLocale = globalLocale._abbr;
      aliasedRequire = require;
      aliasedRequire("./locale/" + name2);
      getSetGlobalLocale(oldLocale);
    } catch (e2) {
      locales[name2] = null;
    }
  }
  return locales[name2];
}
function getSetGlobalLocale(key, values) {
  var data;
  if (key) {
    if (isUndefined$1(values)) {
      data = getLocale(key);
    } else {
      data = defineLocale(key, values);
    }
    if (data) {
      globalLocale = data;
    } else {
      if (typeof console !== "undefined" && console.warn) {
        console.warn(
          "Locale " + key + " not found. Did you forget to load it?"
        );
      }
    }
  }
  return globalLocale._abbr;
}
function defineLocale(name2, config2) {
  if (config2 !== null) {
    var locale2, parentConfig = baseConfig;
    config2.abbr = name2;
    if (locales[name2] != null) {
      deprecateSimple(
        "defineLocaleOverride",
        "use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."
      );
      parentConfig = locales[name2]._config;
    } else if (config2.parentLocale != null) {
      if (locales[config2.parentLocale] != null) {
        parentConfig = locales[config2.parentLocale]._config;
      } else {
        locale2 = loadLocale(config2.parentLocale);
        if (locale2 != null) {
          parentConfig = locale2._config;
        } else {
          if (!localeFamilies[config2.parentLocale]) {
            localeFamilies[config2.parentLocale] = [];
          }
          localeFamilies[config2.parentLocale].push({
            name: name2,
            config: config2
          });
          return null;
        }
      }
    }
    locales[name2] = new Locale(mergeConfigs(parentConfig, config2));
    if (localeFamilies[name2]) {
      localeFamilies[name2].forEach(function(x2) {
        defineLocale(x2.name, x2.config);
      });
    }
    getSetGlobalLocale(name2);
    return locales[name2];
  } else {
    delete locales[name2];
    return null;
  }
}
function updateLocale(name2, config2) {
  if (config2 != null) {
    var locale2, tmpLocale, parentConfig = baseConfig;
    if (locales[name2] != null && locales[name2].parentLocale != null) {
      locales[name2].set(mergeConfigs(locales[name2]._config, config2));
    } else {
      tmpLocale = loadLocale(name2);
      if (tmpLocale != null) {
        parentConfig = tmpLocale._config;
      }
      config2 = mergeConfigs(parentConfig, config2);
      if (tmpLocale == null) {
        config2.abbr = name2;
      }
      locale2 = new Locale(config2);
      locale2.parentLocale = locales[name2];
      locales[name2] = locale2;
    }
    getSetGlobalLocale(name2);
  } else {
    if (locales[name2] != null) {
      if (locales[name2].parentLocale != null) {
        locales[name2] = locales[name2].parentLocale;
        if (name2 === getSetGlobalLocale()) {
          getSetGlobalLocale(name2);
        }
      } else if (locales[name2] != null) {
        delete locales[name2];
      }
    }
  }
  return locales[name2];
}
function getLocale(key) {
  var locale2;
  if (key && key._locale && key._locale._abbr) {
    key = key._locale._abbr;
  }
  if (!key) {
    return globalLocale;
  }
  if (!isArray$2(key)) {
    locale2 = loadLocale(key);
    if (locale2) {
      return locale2;
    }
    key = [key];
  }
  return chooseLocale(key);
}
function listLocales() {
  return keys$1(locales);
}
function checkOverflow(m2) {
  var overflow, a2 = m2._a;
  if (a2 && getParsingFlags(m2).overflow === -2) {
    overflow = a2[MONTH] < 0 || a2[MONTH] > 11 ? MONTH : a2[DATE$1] < 1 || a2[DATE$1] > daysInMonth(a2[YEAR], a2[MONTH]) ? DATE$1 : a2[HOUR] < 0 || a2[HOUR] > 24 || a2[HOUR] === 24 && (a2[MINUTE] !== 0 || a2[SECOND] !== 0 || a2[MILLISECOND] !== 0) ? HOUR : a2[MINUTE] < 0 || a2[MINUTE] > 59 ? MINUTE : a2[SECOND] < 0 || a2[SECOND] > 59 ? SECOND : a2[MILLISECOND] < 0 || a2[MILLISECOND] > 999 ? MILLISECOND : -1;
    if (getParsingFlags(m2)._overflowDayOfYear && (overflow < YEAR || overflow > DATE$1)) {
      overflow = DATE$1;
    }
    if (getParsingFlags(m2)._overflowWeeks && overflow === -1) {
      overflow = WEEK;
    }
    if (getParsingFlags(m2)._overflowWeekday && overflow === -1) {
      overflow = WEEKDAY;
    }
    getParsingFlags(m2).overflow = overflow;
  }
  return m2;
}
var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, tzRegex = /Z|[+-]\d\d(?::?\d\d)?/, isoDates = [
  ["YYYYYY-MM-DD", /[+-]\d{6}-\d\d-\d\d/],
  ["YYYY-MM-DD", /\d{4}-\d\d-\d\d/],
  ["GGGG-[W]WW-E", /\d{4}-W\d\d-\d/],
  ["GGGG-[W]WW", /\d{4}-W\d\d/, false],
  ["YYYY-DDD", /\d{4}-\d{3}/],
  ["YYYY-MM", /\d{4}-\d\d/, false],
  ["YYYYYYMMDD", /[+-]\d{10}/],
  ["YYYYMMDD", /\d{8}/],
  ["GGGG[W]WWE", /\d{4}W\d{3}/],
  ["GGGG[W]WW", /\d{4}W\d{2}/, false],
  ["YYYYDDD", /\d{7}/],
  ["YYYYMM", /\d{6}/, false],
  ["YYYY", /\d{4}/, false]
], isoTimes = [
  ["HH:mm:ss.SSSS", /\d\d:\d\d:\d\d\.\d+/],
  ["HH:mm:ss,SSSS", /\d\d:\d\d:\d\d,\d+/],
  ["HH:mm:ss", /\d\d:\d\d:\d\d/],
  ["HH:mm", /\d\d:\d\d/],
  ["HHmmss.SSSS", /\d\d\d\d\d\d\.\d+/],
  ["HHmmss,SSSS", /\d\d\d\d\d\d,\d+/],
  ["HHmmss", /\d\d\d\d\d\d/],
  ["HHmm", /\d\d\d\d/],
  ["HH", /\d\d/]
], aspNetJsonRegex = /^\/?Date\((-?\d+)/i, rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/, obsOffsets = {
  UT: 0,
  GMT: 0,
  EDT: -4 * 60,
  EST: -5 * 60,
  CDT: -5 * 60,
  CST: -6 * 60,
  MDT: -6 * 60,
  MST: -7 * 60,
  PDT: -7 * 60,
  PST: -8 * 60
};
function configFromISO(config2) {
  var i2, l2, string3 = config2._i, match5 = extendedIsoRegex.exec(string3) || basicIsoRegex.exec(string3), allowTime, dateFormat, timeFormat, tzFormat, isoDatesLen = isoDates.length, isoTimesLen = isoTimes.length;
  if (match5) {
    getParsingFlags(config2).iso = true;
    for (i2 = 0, l2 = isoDatesLen; i2 < l2; i2++) {
      if (isoDates[i2][1].exec(match5[1])) {
        dateFormat = isoDates[i2][0];
        allowTime = isoDates[i2][2] !== false;
        break;
      }
    }
    if (dateFormat == null) {
      config2._isValid = false;
      return;
    }
    if (match5[3]) {
      for (i2 = 0, l2 = isoTimesLen; i2 < l2; i2++) {
        if (isoTimes[i2][1].exec(match5[3])) {
          timeFormat = (match5[2] || " ") + isoTimes[i2][0];
          break;
        }
      }
      if (timeFormat == null) {
        config2._isValid = false;
        return;
      }
    }
    if (!allowTime && timeFormat != null) {
      config2._isValid = false;
      return;
    }
    if (match5[4]) {
      if (tzRegex.exec(match5[4])) {
        tzFormat = "Z";
      } else {
        config2._isValid = false;
        return;
      }
    }
    config2._f = dateFormat + (timeFormat || "") + (tzFormat || "");
    configFromStringAndFormat(config2);
  } else {
    config2._isValid = false;
  }
}
function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
  var result = [
    untruncateYear(yearStr),
    defaultLocaleMonthsShort.indexOf(monthStr),
    parseInt(dayStr, 10),
    parseInt(hourStr, 10),
    parseInt(minuteStr, 10)
  ];
  if (secondStr) {
    result.push(parseInt(secondStr, 10));
  }
  return result;
}
function untruncateYear(yearStr) {
  var year = parseInt(yearStr, 10);
  if (year <= 49) {
    return 2e3 + year;
  } else if (year <= 999) {
    return 1900 + year;
  }
  return year;
}
function preprocessRFC2822(s2) {
  return s2.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, "");
}
function checkWeekday(weekdayStr, parsedInput, config2) {
  if (weekdayStr) {
    var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), weekdayActual = new Date(
      parsedInput[0],
      parsedInput[1],
      parsedInput[2]
    ).getDay();
    if (weekdayProvided !== weekdayActual) {
      getParsingFlags(config2).weekdayMismatch = true;
      config2._isValid = false;
      return false;
    }
  }
  return true;
}
function calculateOffset(obsOffset, militaryOffset, numOffset) {
  if (obsOffset) {
    return obsOffsets[obsOffset];
  } else if (militaryOffset) {
    return 0;
  } else {
    var hm = parseInt(numOffset, 10), m2 = hm % 100, h3 = (hm - m2) / 100;
    return h3 * 60 + m2;
  }
}
function configFromRFC2822(config2) {
  var match5 = rfc2822.exec(preprocessRFC2822(config2._i)), parsedArray;
  if (match5) {
    parsedArray = extractFromRFC2822Strings(
      match5[4],
      match5[3],
      match5[2],
      match5[5],
      match5[6],
      match5[7]
    );
    if (!checkWeekday(match5[1], parsedArray, config2)) {
      return;
    }
    config2._a = parsedArray;
    config2._tzm = calculateOffset(match5[8], match5[9], match5[10]);
    config2._d = createUTCDate.apply(null, config2._a);
    config2._d.setUTCMinutes(config2._d.getUTCMinutes() - config2._tzm);
    getParsingFlags(config2).rfc2822 = true;
  } else {
    config2._isValid = false;
  }
}
function configFromString(config2) {
  var matched = aspNetJsonRegex.exec(config2._i);
  if (matched !== null) {
    config2._d = /* @__PURE__ */ new Date(+matched[1]);
    return;
  }
  configFromISO(config2);
  if (config2._isValid === false) {
    delete config2._isValid;
  } else {
    return;
  }
  configFromRFC2822(config2);
  if (config2._isValid === false) {
    delete config2._isValid;
  } else {
    return;
  }
  if (config2._strict) {
    config2._isValid = false;
  } else {
    hooks.createFromInputFallback(config2);
  }
}
hooks.createFromInputFallback = deprecate(
  "value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",
  function(config2) {
    config2._d = /* @__PURE__ */ new Date(config2._i + (config2._useUTC ? " UTC" : ""));
  }
);
function defaults$1(a2, b2, c2) {
  if (a2 != null) {
    return a2;
  }
  if (b2 != null) {
    return b2;
  }
  return c2;
}
function currentDateArray(config2) {
  var nowValue = new Date(hooks.now());
  if (config2._useUTC) {
    return [
      nowValue.getUTCFullYear(),
      nowValue.getUTCMonth(),
      nowValue.getUTCDate()
    ];
  }
  return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
}
function configFromArray(config2) {
  var i2, date4, input2 = [], currentDate, expectedWeekday, yearToUse;
  if (config2._d) {
    return;
  }
  currentDate = currentDateArray(config2);
  if (config2._w && config2._a[DATE$1] == null && config2._a[MONTH] == null) {
    dayOfYearFromWeekInfo(config2);
  }
  if (config2._dayOfYear != null) {
    yearToUse = defaults$1(config2._a[YEAR], currentDate[YEAR]);
    if (config2._dayOfYear > daysInYear(yearToUse) || config2._dayOfYear === 0) {
      getParsingFlags(config2)._overflowDayOfYear = true;
    }
    date4 = createUTCDate(yearToUse, 0, config2._dayOfYear);
    config2._a[MONTH] = date4.getUTCMonth();
    config2._a[DATE$1] = date4.getUTCDate();
  }
  for (i2 = 0; i2 < 3 && config2._a[i2] == null; ++i2) {
    config2._a[i2] = input2[i2] = currentDate[i2];
  }
  for (; i2 < 7; i2++) {
    config2._a[i2] = input2[i2] = config2._a[i2] == null ? i2 === 2 ? 1 : 0 : config2._a[i2];
  }
  if (config2._a[HOUR] === 24 && config2._a[MINUTE] === 0 && config2._a[SECOND] === 0 && config2._a[MILLISECOND] === 0) {
    config2._nextDay = true;
    config2._a[HOUR] = 0;
  }
  config2._d = (config2._useUTC ? createUTCDate : createDate).apply(
    null,
    input2
  );
  expectedWeekday = config2._useUTC ? config2._d.getUTCDay() : config2._d.getDay();
  if (config2._tzm != null) {
    config2._d.setUTCMinutes(config2._d.getUTCMinutes() - config2._tzm);
  }
  if (config2._nextDay) {
    config2._a[HOUR] = 24;
  }
  if (config2._w && typeof config2._w.d !== "undefined" && config2._w.d !== expectedWeekday) {
    getParsingFlags(config2).weekdayMismatch = true;
  }
}
function dayOfYearFromWeekInfo(config2) {
  var w2, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;
  w2 = config2._w;
  if (w2.GG != null || w2.W != null || w2.E != null) {
    dow = 1;
    doy = 4;
    weekYear = defaults$1(
      w2.GG,
      config2._a[YEAR],
      weekOfYear(createLocal(), 1, 4).year
    );
    week = defaults$1(w2.W, 1);
    weekday = defaults$1(w2.E, 1);
    if (weekday < 1 || weekday > 7) {
      weekdayOverflow = true;
    }
  } else {
    dow = config2._locale._week.dow;
    doy = config2._locale._week.doy;
    curWeek = weekOfYear(createLocal(), dow, doy);
    weekYear = defaults$1(w2.gg, config2._a[YEAR], curWeek.year);
    week = defaults$1(w2.w, curWeek.week);
    if (w2.d != null) {
      weekday = w2.d;
      if (weekday < 0 || weekday > 6) {
        weekdayOverflow = true;
      }
    } else if (w2.e != null) {
      weekday = w2.e + dow;
      if (w2.e < 0 || w2.e > 6) {
        weekdayOverflow = true;
      }
    } else {
      weekday = dow;
    }
  }
  if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
    getParsingFlags(config2)._overflowWeeks = true;
  } else if (weekdayOverflow != null) {
    getParsingFlags(config2)._overflowWeekday = true;
  } else {
    temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
    config2._a[YEAR] = temp.year;
    config2._dayOfYear = temp.dayOfYear;
  }
}
hooks.ISO_8601 = function() {
};
hooks.RFC_2822 = function() {
};
function configFromStringAndFormat(config2) {
  if (config2._f === hooks.ISO_8601) {
    configFromISO(config2);
    return;
  }
  if (config2._f === hooks.RFC_2822) {
    configFromRFC2822(config2);
    return;
  }
  config2._a = [];
  getParsingFlags(config2).empty = true;
  var string3 = "" + config2._i, i2, parsedInput, tokens2, token2, skipped, stringLength = string3.length, totalParsedInputLength = 0, era, tokenLen;
  tokens2 = expandFormat(config2._f, config2._locale).match(formattingTokens) || [];
  tokenLen = tokens2.length;
  for (i2 = 0; i2 < tokenLen; i2++) {
    token2 = tokens2[i2];
    parsedInput = (string3.match(getParseRegexForToken(token2, config2)) || [])[0];
    if (parsedInput) {
      skipped = string3.substr(0, string3.indexOf(parsedInput));
      if (skipped.length > 0) {
        getParsingFlags(config2).unusedInput.push(skipped);
      }
      string3 = string3.slice(
        string3.indexOf(parsedInput) + parsedInput.length
      );
      totalParsedInputLength += parsedInput.length;
    }
    if (formatTokenFunctions[token2]) {
      if (parsedInput) {
        getParsingFlags(config2).empty = false;
      } else {
        getParsingFlags(config2).unusedTokens.push(token2);
      }
      addTimeToArrayFromToken(token2, parsedInput, config2);
    } else if (config2._strict && !parsedInput) {
      getParsingFlags(config2).unusedTokens.push(token2);
    }
  }
  getParsingFlags(config2).charsLeftOver = stringLength - totalParsedInputLength;
  if (string3.length > 0) {
    getParsingFlags(config2).unusedInput.push(string3);
  }
  if (config2._a[HOUR] <= 12 && getParsingFlags(config2).bigHour === true && config2._a[HOUR] > 0) {
    getParsingFlags(config2).bigHour = void 0;
  }
  getParsingFlags(config2).parsedDateParts = config2._a.slice(0);
  getParsingFlags(config2).meridiem = config2._meridiem;
  config2._a[HOUR] = meridiemFixWrap(
    config2._locale,
    config2._a[HOUR],
    config2._meridiem
  );
  era = getParsingFlags(config2).era;
  if (era !== null) {
    config2._a[YEAR] = config2._locale.erasConvertYear(era, config2._a[YEAR]);
  }
  configFromArray(config2);
  checkOverflow(config2);
}
function meridiemFixWrap(locale2, hour, meridiem2) {
  var isPm;
  if (meridiem2 == null) {
    return hour;
  }
  if (locale2.meridiemHour != null) {
    return locale2.meridiemHour(hour, meridiem2);
  } else if (locale2.isPM != null) {
    isPm = locale2.isPM(meridiem2);
    if (isPm && hour < 12) {
      hour += 12;
    }
    if (!isPm && hour === 12) {
      hour = 0;
    }
    return hour;
  } else {
    return hour;
  }
}
function configFromStringAndArray(config2) {
  var tempConfig, bestMoment, scoreToBeat, i2, currentScore, validFormatFound, bestFormatIsValid = false, configfLen = config2._f.length;
  if (configfLen === 0) {
    getParsingFlags(config2).invalidFormat = true;
    config2._d = /* @__PURE__ */ new Date(NaN);
    return;
  }
  for (i2 = 0; i2 < configfLen; i2++) {
    currentScore = 0;
    validFormatFound = false;
    tempConfig = copyConfig({}, config2);
    if (config2._useUTC != null) {
      tempConfig._useUTC = config2._useUTC;
    }
    tempConfig._f = config2._f[i2];
    configFromStringAndFormat(tempConfig);
    if (isValid2(tempConfig)) {
      validFormatFound = true;
    }
    currentScore += getParsingFlags(tempConfig).charsLeftOver;
    currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
    getParsingFlags(tempConfig).score = currentScore;
    if (!bestFormatIsValid) {
      if (scoreToBeat == null || currentScore < scoreToBeat || validFormatFound) {
        scoreToBeat = currentScore;
        bestMoment = tempConfig;
        if (validFormatFound) {
          bestFormatIsValid = true;
        }
      }
    } else {
      if (currentScore < scoreToBeat) {
        scoreToBeat = currentScore;
        bestMoment = tempConfig;
      }
    }
  }
  extend$3(config2, bestMoment || tempConfig);
}
function configFromObject(config2) {
  if (config2._d) {
    return;
  }
  var i2 = normalizeObjectUnits(config2._i), dayOrDate = i2.day === void 0 ? i2.date : i2.day;
  config2._a = map(
    [i2.year, i2.month, dayOrDate, i2.hour, i2.minute, i2.second, i2.millisecond],
    function(obj) {
      return obj && parseInt(obj, 10);
    }
  );
  configFromArray(config2);
}
function createFromConfig(config2) {
  var res = new Moment(checkOverflow(prepareConfig(config2)));
  if (res._nextDay) {
    res.add(1, "d");
    res._nextDay = void 0;
  }
  return res;
}
function prepareConfig(config2) {
  var input2 = config2._i, format2 = config2._f;
  config2._locale = config2._locale || getLocale(config2._l);
  if (input2 === null || format2 === void 0 && input2 === "") {
    return createInvalid({ nullInput: true });
  }
  if (typeof input2 === "string") {
    config2._i = input2 = config2._locale.preparse(input2);
  }
  if (isMoment(input2)) {
    return new Moment(checkOverflow(input2));
  } else if (isDate$1(input2)) {
    config2._d = input2;
  } else if (isArray$2(format2)) {
    configFromStringAndArray(config2);
  } else if (format2) {
    configFromStringAndFormat(config2);
  } else {
    configFromInput(config2);
  }
  if (!isValid2(config2)) {
    config2._d = null;
  }
  return config2;
}
function configFromInput(config2) {
  var input2 = config2._i;
  if (isUndefined$1(input2)) {
    config2._d = new Date(hooks.now());
  } else if (isDate$1(input2)) {
    config2._d = new Date(input2.valueOf());
  } else if (typeof input2 === "string") {
    configFromString(config2);
  } else if (isArray$2(input2)) {
    config2._a = map(input2.slice(0), function(obj) {
      return parseInt(obj, 10);
    });
    configFromArray(config2);
  } else if (isObject$1(input2)) {
    configFromObject(config2);
  } else if (isNumber$1(input2)) {
    config2._d = new Date(input2);
  } else {
    hooks.createFromInputFallback(config2);
  }
}
function createLocalOrUTC(input2, format2, locale2, strict, isUTC) {
  var c2 = {};
  if (format2 === true || format2 === false) {
    strict = format2;
    format2 = void 0;
  }
  if (locale2 === true || locale2 === false) {
    strict = locale2;
    locale2 = void 0;
  }
  if (isObject$1(input2) && isObjectEmpty(input2) || isArray$2(input2) && input2.length === 0) {
    input2 = void 0;
  }
  c2._isAMomentObject = true;
  c2._useUTC = c2._isUTC = isUTC;
  c2._l = locale2;
  c2._i = input2;
  c2._f = format2;
  c2._strict = strict;
  return createFromConfig(c2);
}
function createLocal(input2, format2, locale2, strict) {
  return createLocalOrUTC(input2, format2, locale2, strict, false);
}
var prototypeMin = deprecate(
  "moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",
  function() {
    var other = createLocal.apply(null, arguments);
    if (this.isValid() && other.isValid()) {
      return other < this ? this : other;
    } else {
      return createInvalid();
    }
  }
), prototypeMax = deprecate(
  "moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",
  function() {
    var other = createLocal.apply(null, arguments);
    if (this.isValid() && other.isValid()) {
      return other > this ? this : other;
    } else {
      return createInvalid();
    }
  }
);
function pickBy(fn, moments) {
  var res, i2;
  if (moments.length === 1 && isArray$2(moments[0])) {
    moments = moments[0];
  }
  if (!moments.length) {
    return createLocal();
  }
  res = moments[0];
  for (i2 = 1; i2 < moments.length; ++i2) {
    if (!moments[i2].isValid() || moments[i2][fn](res)) {
      res = moments[i2];
    }
  }
  return res;
}
function min() {
  var args = [].slice.call(arguments, 0);
  return pickBy("isBefore", args);
}
function max() {
  var args = [].slice.call(arguments, 0);
  return pickBy("isAfter", args);
}
var now = function() {
  return Date.now ? Date.now() : +/* @__PURE__ */ new Date();
};
var ordering = [
  "year",
  "quarter",
  "month",
  "week",
  "day",
  "hour",
  "minute",
  "second",
  "millisecond"
];
function isDurationValid(m2) {
  var key, unitHasDecimal = false, i2, orderLen = ordering.length;
  for (key in m2) {
    if (hasOwnProp(m2, key) && !(indexOf.call(ordering, key) !== -1 && (m2[key] == null || !isNaN(m2[key])))) {
      return false;
    }
  }
  for (i2 = 0; i2 < orderLen; ++i2) {
    if (m2[ordering[i2]]) {
      if (unitHasDecimal) {
        return false;
      }
      if (parseFloat(m2[ordering[i2]]) !== toInt(m2[ordering[i2]])) {
        unitHasDecimal = true;
      }
    }
  }
  return true;
}
function isValid$1() {
  return this._isValid;
}
function createInvalid$1() {
  return createDuration(NaN);
}
function Duration(duration2) {
  var normalizedInput = normalizeObjectUnits(duration2), years2 = normalizedInput.year || 0, quarters = normalizedInput.quarter || 0, months2 = normalizedInput.month || 0, weeks2 = normalizedInput.week || normalizedInput.isoWeek || 0, days2 = normalizedInput.day || 0, hours2 = normalizedInput.hour || 0, minutes2 = normalizedInput.minute || 0, seconds2 = normalizedInput.second || 0, milliseconds2 = normalizedInput.millisecond || 0;
  this._isValid = isDurationValid(normalizedInput);
  this._milliseconds = +milliseconds2 + seconds2 * 1e3 + // 1000
  minutes2 * 6e4 + // 1000 * 60
  hours2 * 1e3 * 60 * 60;
  this._days = +days2 + weeks2 * 7;
  this._months = +months2 + quarters * 3 + years2 * 12;
  this._data = {};
  this._locale = getLocale();
  this._bubble();
}
function isDuration(obj) {
  return obj instanceof Duration;
}
function absRound(number4) {
  if (number4 < 0) {
    return Math.round(-1 * number4) * -1;
  } else {
    return Math.round(number4);
  }
}
function compareArrays(array1, array22, dontConvert) {
  var len = Math.min(array1.length, array22.length), lengthDiff = Math.abs(array1.length - array22.length), diffs = 0, i2;
  for (i2 = 0; i2 < len; i2++) {
    if (toInt(array1[i2]) !== toInt(array22[i2])) {
      diffs++;
    }
  }
  return diffs + lengthDiff;
}
function offset(token2, separator) {
  addFormatToken(token2, 0, 0, function() {
    var offset2 = this.utcOffset(), sign2 = "+";
    if (offset2 < 0) {
      offset2 = -offset2;
      sign2 = "-";
    }
    return sign2 + zeroFill(~~(offset2 / 60), 2) + separator + zeroFill(~~offset2 % 60, 2);
  });
}
offset("Z", ":");
offset("ZZ", "");
addRegexToken("Z", matchShortOffset);
addRegexToken("ZZ", matchShortOffset);
addParseToken(["Z", "ZZ"], function(input2, array4, config2) {
  config2._useUTC = true;
  config2._tzm = offsetFromString(matchShortOffset, input2);
});
var chunkOffset = /([\+\-]|\d\d)/gi;
function offsetFromString(matcher, string3) {
  var matches = (string3 || "").match(matcher), chunk, parts, minutes2;
  if (matches === null) {
    return null;
  }
  chunk = matches[matches.length - 1] || [];
  parts = (chunk + "").match(chunkOffset) || ["-", 0, 0];
  minutes2 = +(parts[1] * 60) + toInt(parts[2]);
  return minutes2 === 0 ? 0 : parts[0] === "+" ? minutes2 : -minutes2;
}
function cloneWithOffset(input2, model) {
  var res, diff2;
  if (model._isUTC) {
    res = model.clone();
    diff2 = (isMoment(input2) || isDate$1(input2) ? input2.valueOf() : createLocal(input2).valueOf()) - res.valueOf();
    res._d.setTime(res._d.valueOf() + diff2);
    hooks.updateOffset(res, false);
    return res;
  } else {
    return createLocal(input2).local();
  }
}
function getDateOffset(m2) {
  return -Math.round(m2._d.getTimezoneOffset());
}
hooks.updateOffset = function() {
};
function getSetOffset(input2, keepLocalTime, keepMinutes) {
  var offset2 = this._offset || 0, localAdjust;
  if (!this.isValid()) {
    return input2 != null ? this : NaN;
  }
  if (input2 != null) {
    if (typeof input2 === "string") {
      input2 = offsetFromString(matchShortOffset, input2);
      if (input2 === null) {
        return this;
      }
    } else if (Math.abs(input2) < 16 && !keepMinutes) {
      input2 = input2 * 60;
    }
    if (!this._isUTC && keepLocalTime) {
      localAdjust = getDateOffset(this);
    }
    this._offset = input2;
    this._isUTC = true;
    if (localAdjust != null) {
      this.add(localAdjust, "m");
    }
    if (offset2 !== input2) {
      if (!keepLocalTime || this._changeInProgress) {
        addSubtract(
          this,
          createDuration(input2 - offset2, "m"),
          1,
          false
        );
      } else if (!this._changeInProgress) {
        this._changeInProgress = true;
        hooks.updateOffset(this, true);
        this._changeInProgress = null;
      }
    }
    return this;
  } else {
    return this._isUTC ? offset2 : getDateOffset(this);
  }
}
function getSetZone(input2, keepLocalTime) {
  if (input2 != null) {
    if (typeof input2 !== "string") {
      input2 = -input2;
    }
    this.utcOffset(input2, keepLocalTime);
    return this;
  } else {
    return -this.utcOffset();
  }
}
function setOffsetToUTC(keepLocalTime) {
  return this.utcOffset(0, keepLocalTime);
}
function setOffsetToLocal(keepLocalTime) {
  if (this._isUTC) {
    this.utcOffset(0, keepLocalTime);
    this._isUTC = false;
    if (keepLocalTime) {
      this.subtract(getDateOffset(this), "m");
    }
  }
  return this;
}
function setOffsetToParsedOffset() {
  if (this._tzm != null) {
    this.utcOffset(this._tzm, false, true);
  } else if (typeof this._i === "string") {
    var tZone = offsetFromString(matchOffset, this._i);
    if (tZone != null) {
      this.utcOffset(tZone);
    } else {
      this.utcOffset(0, true);
    }
  }
  return this;
}
function hasAlignedHourOffset(input2) {
  if (!this.isValid()) {
    return false;
  }
  input2 = input2 ? createLocal(input2).utcOffset() : 0;
  return (this.utcOffset() - input2) % 60 === 0;
}
function isDaylightSavingTime() {
  return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset();
}
function isDaylightSavingTimeShifted() {
  if (!isUndefined$1(this._isDSTShifted)) {
    return this._isDSTShifted;
  }
  var c2 = {}, other;
  copyConfig(c2, this);
  c2 = prepareConfig(c2);
  if (c2._a) {
    other = c2._isUTC ? createUTC(c2._a) : createLocal(c2._a);
    this._isDSTShifted = this.isValid() && compareArrays(c2._a, other.toArray()) > 0;
  } else {
    this._isDSTShifted = false;
  }
  return this._isDSTShifted;
}
function isLocal() {
  return this.isValid() ? !this._isUTC : false;
}
function isUtcOffset() {
  return this.isValid() ? this._isUTC : false;
}
function isUtc() {
  return this.isValid() ? this._isUTC && this._offset === 0 : false;
}
var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
function createDuration(input2, key) {
  var duration2 = input2, match5 = null, sign2, ret, diffRes;
  if (isDuration(input2)) {
    duration2 = {
      ms: input2._milliseconds,
      d: input2._days,
      M: input2._months
    };
  } else if (isNumber$1(input2) || !isNaN(+input2)) {
    duration2 = {};
    if (key) {
      duration2[key] = +input2;
    } else {
      duration2.milliseconds = +input2;
    }
  } else if (match5 = aspNetRegex.exec(input2)) {
    sign2 = match5[1] === "-" ? -1 : 1;
    duration2 = {
      y: 0,
      d: toInt(match5[DATE$1]) * sign2,
      h: toInt(match5[HOUR]) * sign2,
      m: toInt(match5[MINUTE]) * sign2,
      s: toInt(match5[SECOND]) * sign2,
      ms: toInt(absRound(match5[MILLISECOND] * 1e3)) * sign2
      // the millisecond decimal point is included in the match
    };
  } else if (match5 = isoRegex.exec(input2)) {
    sign2 = match5[1] === "-" ? -1 : 1;
    duration2 = {
      y: parseIso(match5[2], sign2),
      M: parseIso(match5[3], sign2),
      w: parseIso(match5[4], sign2),
      d: parseIso(match5[5], sign2),
      h: parseIso(match5[6], sign2),
      m: parseIso(match5[7], sign2),
      s: parseIso(match5[8], sign2)
    };
  } else if (duration2 == null) {
    duration2 = {};
  } else if (typeof duration2 === "object" && ("from" in duration2 || "to" in duration2)) {
    diffRes = momentsDifference(
      createLocal(duration2.from),
      createLocal(duration2.to)
    );
    duration2 = {};
    duration2.ms = diffRes.milliseconds;
    duration2.M = diffRes.months;
  }
  ret = new Duration(duration2);
  if (isDuration(input2) && hasOwnProp(input2, "_locale")) {
    ret._locale = input2._locale;
  }
  if (isDuration(input2) && hasOwnProp(input2, "_isValid")) {
    ret._isValid = input2._isValid;
  }
  return ret;
}
createDuration.fn = Duration.prototype;
createDuration.invalid = createInvalid$1;
function parseIso(inp, sign2) {
  var res = inp && parseFloat(inp.replace(",", "."));
  return (isNaN(res) ? 0 : res) * sign2;
}
function positiveMomentsDifference(base, other) {
  var res = {};
  res.months = other.month() - base.month() + (other.year() - base.year()) * 12;
  if (base.clone().add(res.months, "M").isAfter(other)) {
    --res.months;
  }
  res.milliseconds = +other - +base.clone().add(res.months, "M");
  return res;
}
function momentsDifference(base, other) {
  var res;
  if (!(base.isValid() && other.isValid())) {
    return { milliseconds: 0, months: 0 };
  }
  other = cloneWithOffset(other, base);
  if (base.isBefore(other)) {
    res = positiveMomentsDifference(base, other);
  } else {
    res = positiveMomentsDifference(other, base);
    res.milliseconds = -res.milliseconds;
    res.months = -res.months;
  }
  return res;
}
function createAdder(direction, name2) {
  return function(val, period) {
    var dur, tmp;
    if (period !== null && !isNaN(+period)) {
      deprecateSimple(
        name2,
        "moment()." + name2 + "(period, number) is deprecated. Please use moment()." + name2 + "(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."
      );
      tmp = val;
      val = period;
      period = tmp;
    }
    dur = createDuration(val, period);
    addSubtract(this, dur, direction);
    return this;
  };
}
function addSubtract(mom, duration2, isAdding, updateOffset) {
  var milliseconds2 = duration2._milliseconds, days2 = absRound(duration2._days), months2 = absRound(duration2._months);
  if (!mom.isValid()) {
    return;
  }
  updateOffset = updateOffset == null ? true : updateOffset;
  if (months2) {
    setMonth(mom, get4(mom, "Month") + months2 * isAdding);
  }
  if (days2) {
    set$1(mom, "Date", get4(mom, "Date") + days2 * isAdding);
  }
  if (milliseconds2) {
    mom._d.setTime(mom._d.valueOf() + milliseconds2 * isAdding);
  }
  if (updateOffset) {
    hooks.updateOffset(mom, days2 || months2);
  }
}
var add$1 = createAdder(1, "add"), subtract$1 = createAdder(-1, "subtract");
function isString$1(input2) {
  return typeof input2 === "string" || input2 instanceof String;
}
function isMomentInput(input2) {
  return isMoment(input2) || isDate$1(input2) || isString$1(input2) || isNumber$1(input2) || isNumberOrStringArray(input2) || isMomentInputObject(input2) || input2 === null || input2 === void 0;
}
function isMomentInputObject(input2) {
  var objectTest = isObject$1(input2) && !isObjectEmpty(input2), propertyTest = false, properties2 = [
    "years",
    "year",
    "y",
    "months",
    "month",
    "M",
    "days",
    "day",
    "d",
    "dates",
    "date",
    "D",
    "hours",
    "hour",
    "h",
    "minutes",
    "minute",
    "m",
    "seconds",
    "second",
    "s",
    "milliseconds",
    "millisecond",
    "ms"
  ], i2, property2, propertyLen = properties2.length;
  for (i2 = 0; i2 < propertyLen; i2 += 1) {
    property2 = properties2[i2];
    propertyTest = propertyTest || hasOwnProp(input2, property2);
  }
  return objectTest && propertyTest;
}
function isNumberOrStringArray(input2) {
  var arrayTest = isArray$2(input2), dataTypeTest = false;
  if (arrayTest) {
    dataTypeTest = input2.filter(function(item) {
      return !isNumber$1(item) && isString$1(input2);
    }).length === 0;
  }
  return arrayTest && dataTypeTest;
}
function isCalendarSpec(input2) {
  var objectTest = isObject$1(input2) && !isObjectEmpty(input2), propertyTest = false, properties2 = [
    "sameDay",
    "nextDay",
    "lastDay",
    "nextWeek",
    "lastWeek",
    "sameElse"
  ], i2, property2;
  for (i2 = 0; i2 < properties2.length; i2 += 1) {
    property2 = properties2[i2];
    propertyTest = propertyTest || hasOwnProp(input2, property2);
  }
  return objectTest && propertyTest;
}
function getCalendarFormat(myMoment, now2) {
  var diff2 = myMoment.diff(now2, "days", true);
  return diff2 < -6 ? "sameElse" : diff2 < -1 ? "lastWeek" : diff2 < 0 ? "lastDay" : diff2 < 1 ? "sameDay" : diff2 < 2 ? "nextDay" : diff2 < 7 ? "nextWeek" : "sameElse";
}
function calendar$1(time2, formats2) {
  if (arguments.length === 1) {
    if (!arguments[0]) {
      time2 = void 0;
      formats2 = void 0;
    } else if (isMomentInput(arguments[0])) {
      time2 = arguments[0];
      formats2 = void 0;
    } else if (isCalendarSpec(arguments[0])) {
      formats2 = arguments[0];
      time2 = void 0;
    }
  }
  var now2 = time2 || createLocal(), sod = cloneWithOffset(now2, this).startOf("day"), format2 = hooks.calendarFormat(this, sod) || "sameElse", output2 = formats2 && (isFunction$1(formats2[format2]) ? formats2[format2].call(this, now2) : formats2[format2]);
  return this.format(
    output2 || this.localeData().calendar(format2, this, createLocal(now2))
  );
}
function clone2() {
  return new Moment(this);
}
function isAfter$1(input2, units) {
  var localInput = isMoment(input2) ? input2 : createLocal(input2);
  if (!(this.isValid() && localInput.isValid())) {
    return false;
  }
  units = normalizeUnits(units) || "millisecond";
  if (units === "millisecond") {
    return this.valueOf() > localInput.valueOf();
  } else {
    return localInput.valueOf() < this.clone().startOf(units).valueOf();
  }
}
function isBefore(input2, units) {
  var localInput = isMoment(input2) ? input2 : createLocal(input2);
  if (!(this.isValid() && localInput.isValid())) {
    return false;
  }
  units = normalizeUnits(units) || "millisecond";
  if (units === "millisecond") {
    return this.valueOf() < localInput.valueOf();
  } else {
    return this.clone().endOf(units).valueOf() < localInput.valueOf();
  }
}
function isBetween(from2, to2, units, inclusivity) {
  var localFrom = isMoment(from2) ? from2 : createLocal(from2), localTo = isMoment(to2) ? to2 : createLocal(to2);
  if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
    return false;
  }
  inclusivity = inclusivity || "()";
  return (inclusivity[0] === "(" ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) && (inclusivity[1] === ")" ? this.isBefore(localTo, units) : !this.isAfter(localTo, units));
}
function isSame(input2, units) {
  var localInput = isMoment(input2) ? input2 : createLocal(input2), inputMs;
  if (!(this.isValid() && localInput.isValid())) {
    return false;
  }
  units = normalizeUnits(units) || "millisecond";
  if (units === "millisecond") {
    return this.valueOf() === localInput.valueOf();
  } else {
    inputMs = localInput.valueOf();
    return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
  }
}
function isSameOrAfter(input2, units) {
  return this.isSame(input2, units) || this.isAfter(input2, units);
}
function isSameOrBefore(input2, units) {
  return this.isSame(input2, units) || this.isBefore(input2, units);
}
function diff(input2, units, asFloat) {
  var that, zoneDelta, output2;
  if (!this.isValid()) {
    return NaN;
  }
  that = cloneWithOffset(input2, this);
  if (!that.isValid()) {
    return NaN;
  }
  zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
  units = normalizeUnits(units);
  switch (units) {
    case "year":
      output2 = monthDiff(this, that) / 12;
      break;
    case "month":
      output2 = monthDiff(this, that);
      break;
    case "quarter":
      output2 = monthDiff(this, that) / 3;
      break;
    case "second":
      output2 = (this - that) / 1e3;
      break;
    case "minute":
      output2 = (this - that) / 6e4;
      break;
    case "hour":
      output2 = (this - that) / 36e5;
      break;
    case "day":
      output2 = (this - that - zoneDelta) / 864e5;
      break;
    case "week":
      output2 = (this - that - zoneDelta) / 6048e5;
      break;
    default:
      output2 = this - that;
  }
  return asFloat ? output2 : absFloor(output2);
}
function monthDiff(a2, b2) {
  if (a2.date() < b2.date()) {
    return -monthDiff(b2, a2);
  }
  var wholeMonthDiff = (b2.year() - a2.year()) * 12 + (b2.month() - a2.month()), anchor = a2.clone().add(wholeMonthDiff, "months"), anchor2, adjust;
  if (b2 - anchor < 0) {
    anchor2 = a2.clone().add(wholeMonthDiff - 1, "months");
    adjust = (b2 - anchor) / (anchor - anchor2);
  } else {
    anchor2 = a2.clone().add(wholeMonthDiff + 1, "months");
    adjust = (b2 - anchor) / (anchor2 - anchor);
  }
  return -(wholeMonthDiff + adjust) || 0;
}
hooks.defaultFormat = "YYYY-MM-DDTHH:mm:ssZ";
hooks.defaultFormatUtc = "YYYY-MM-DDTHH:mm:ss[Z]";
function toString$3() {
  return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ");
}
function toISOString(keepOffset) {
  if (!this.isValid()) {
    return null;
  }
  var utc = keepOffset !== true, m2 = utc ? this.clone().utc() : this;
  if (m2.year() < 0 || m2.year() > 9999) {
    return formatMoment(
      m2,
      utc ? "YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"
    );
  }
  if (isFunction$1(Date.prototype.toISOString)) {
    if (utc) {
      return this.toDate().toISOString();
    } else {
      return new Date(this.valueOf() + this.utcOffset() * 60 * 1e3).toISOString().replace("Z", formatMoment(m2, "Z"));
    }
  }
  return formatMoment(
    m2,
    utc ? "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYY-MM-DD[T]HH:mm:ss.SSSZ"
  );
}
function inspect() {
  if (!this.isValid()) {
    return "moment.invalid(/* " + this._i + " */)";
  }
  var func = "moment", zone = "", prefix, year, datetime, suffix;
  if (!this.isLocal()) {
    func = this.utcOffset() === 0 ? "moment.utc" : "moment.parseZone";
    zone = "Z";
  }
  prefix = "[" + func + '("]';
  year = 0 <= this.year() && this.year() <= 9999 ? "YYYY" : "YYYYYY";
  datetime = "-MM-DD[T]HH:mm:ss.SSS";
  suffix = zone + '[")]';
  return this.format(prefix + year + datetime + suffix);
}
function format(inputString) {
  if (!inputString) {
    inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
  }
  var output2 = formatMoment(this, inputString);
  return this.localeData().postformat(output2);
}
function from(time2, withoutSuffix) {
  if (this.isValid() && (isMoment(time2) && time2.isValid() || createLocal(time2).isValid())) {
    return createDuration({ to: this, from: time2 }).locale(this.locale()).humanize(!withoutSuffix);
  } else {
    return this.localeData().invalidDate();
  }
}
function fromNow(withoutSuffix) {
  return this.from(createLocal(), withoutSuffix);
}
function to(time2, withoutSuffix) {
  if (this.isValid() && (isMoment(time2) && time2.isValid() || createLocal(time2).isValid())) {
    return createDuration({ from: this, to: time2 }).locale(this.locale()).humanize(!withoutSuffix);
  } else {
    return this.localeData().invalidDate();
  }
}
function toNow(withoutSuffix) {
  return this.to(createLocal(), withoutSuffix);
}
function locale(key) {
  var newLocaleData;
  if (key === void 0) {
    return this._locale._abbr;
  } else {
    newLocaleData = getLocale(key);
    if (newLocaleData != null) {
      this._locale = newLocaleData;
    }
    return this;
  }
}
var lang = deprecate(
  "moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",
  function(key) {
    if (key === void 0) {
      return this.localeData();
    } else {
      return this.locale(key);
    }
  }
);
function localeData() {
  return this._locale;
}
var MS_PER_SECOND = 1e3, MS_PER_MINUTE = 60 * MS_PER_SECOND, MS_PER_HOUR = 60 * MS_PER_MINUTE, MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
function mod$1(dividend, divisor) {
  return (dividend % divisor + divisor) % divisor;
}
function localStartOfDate(y2, m2, d2) {
  if (y2 < 100 && y2 >= 0) {
    return new Date(y2 + 400, m2, d2) - MS_PER_400_YEARS;
  } else {
    return new Date(y2, m2, d2).valueOf();
  }
}
function utcStartOfDate(y2, m2, d2) {
  if (y2 < 100 && y2 >= 0) {
    return Date.UTC(y2 + 400, m2, d2) - MS_PER_400_YEARS;
  } else {
    return Date.UTC(y2, m2, d2);
  }
}
function startOf(units) {
  var time2, startOfDate;
  units = normalizeUnits(units);
  if (units === void 0 || units === "millisecond" || !this.isValid()) {
    return this;
  }
  startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  switch (units) {
    case "year":
      time2 = startOfDate(this.year(), 0, 1);
      break;
    case "quarter":
      time2 = startOfDate(
        this.year(),
        this.month() - this.month() % 3,
        1
      );
      break;
    case "month":
      time2 = startOfDate(this.year(), this.month(), 1);
      break;
    case "week":
      time2 = startOfDate(
        this.year(),
        this.month(),
        this.date() - this.weekday()
      );
      break;
    case "isoWeek":
      time2 = startOfDate(
        this.year(),
        this.month(),
        this.date() - (this.isoWeekday() - 1)
      );
      break;
    case "day":
    case "date":
      time2 = startOfDate(this.year(), this.month(), this.date());
      break;
    case "hour":
      time2 = this._d.valueOf();
      time2 -= mod$1(
        time2 + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
        MS_PER_HOUR
      );
      break;
    case "minute":
      time2 = this._d.valueOf();
      time2 -= mod$1(time2, MS_PER_MINUTE);
      break;
    case "second":
      time2 = this._d.valueOf();
      time2 -= mod$1(time2, MS_PER_SECOND);
      break;
  }
  this._d.setTime(time2);
  hooks.updateOffset(this, true);
  return this;
}
function endOf(units) {
  var time2, startOfDate;
  units = normalizeUnits(units);
  if (units === void 0 || units === "millisecond" || !this.isValid()) {
    return this;
  }
  startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  switch (units) {
    case "year":
      time2 = startOfDate(this.year() + 1, 0, 1) - 1;
      break;
    case "quarter":
      time2 = startOfDate(
        this.year(),
        this.month() - this.month() % 3 + 3,
        1
      ) - 1;
      break;
    case "month":
      time2 = startOfDate(this.year(), this.month() + 1, 1) - 1;
      break;
    case "week":
      time2 = startOfDate(
        this.year(),
        this.month(),
        this.date() - this.weekday() + 7
      ) - 1;
      break;
    case "isoWeek":
      time2 = startOfDate(
        this.year(),
        this.month(),
        this.date() - (this.isoWeekday() - 1) + 7
      ) - 1;
      break;
    case "day":
    case "date":
      time2 = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
      break;
    case "hour":
      time2 = this._d.valueOf();
      time2 += MS_PER_HOUR - mod$1(
        time2 + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
        MS_PER_HOUR
      ) - 1;
      break;
    case "minute":
      time2 = this._d.valueOf();
      time2 += MS_PER_MINUTE - mod$1(time2, MS_PER_MINUTE) - 1;
      break;
    case "second":
      time2 = this._d.valueOf();
      time2 += MS_PER_SECOND - mod$1(time2, MS_PER_SECOND) - 1;
      break;
  }
  this._d.setTime(time2);
  hooks.updateOffset(this, true);
  return this;
}
function valueOf() {
  return this._d.valueOf() - (this._offset || 0) * 6e4;
}
function unix() {
  return Math.floor(this.valueOf() / 1e3);
}
function toDate() {
  return new Date(this.valueOf());
}
function toArray$1() {
  var m2 = this;
  return [
    m2.year(),
    m2.month(),
    m2.date(),
    m2.hour(),
    m2.minute(),
    m2.second(),
    m2.millisecond()
  ];
}
function toObject() {
  var m2 = this;
  return {
    years: m2.year(),
    months: m2.month(),
    date: m2.date(),
    hours: m2.hours(),
    minutes: m2.minutes(),
    seconds: m2.seconds(),
    milliseconds: m2.milliseconds()
  };
}
function toJSON() {
  return this.isValid() ? this.toISOString() : null;
}
function isValid$2() {
  return isValid2(this);
}
function parsingFlags() {
  return extend$3({}, getParsingFlags(this));
}
function invalidAt() {
  return getParsingFlags(this).overflow;
}
function creationData() {
  return {
    input: this._i,
    format: this._f,
    locale: this._locale,
    isUTC: this._isUTC,
    strict: this._strict
  };
}
addFormatToken("N", 0, 0, "eraAbbr");
addFormatToken("NN", 0, 0, "eraAbbr");
addFormatToken("NNN", 0, 0, "eraAbbr");
addFormatToken("NNNN", 0, 0, "eraName");
addFormatToken("NNNNN", 0, 0, "eraNarrow");
addFormatToken("y", ["y", 1], "yo", "eraYear");
addFormatToken("y", ["yy", 2], 0, "eraYear");
addFormatToken("y", ["yyy", 3], 0, "eraYear");
addFormatToken("y", ["yyyy", 4], 0, "eraYear");
addRegexToken("N", matchEraAbbr);
addRegexToken("NN", matchEraAbbr);
addRegexToken("NNN", matchEraAbbr);
addRegexToken("NNNN", matchEraName);
addRegexToken("NNNNN", matchEraNarrow);
addParseToken(
  ["N", "NN", "NNN", "NNNN", "NNNNN"],
  function(input2, array4, config2, token2) {
    var era = config2._locale.erasParse(input2, token2, config2._strict);
    if (era) {
      getParsingFlags(config2).era = era;
    } else {
      getParsingFlags(config2).invalidEra = input2;
    }
  }
);
addRegexToken("y", matchUnsigned);
addRegexToken("yy", matchUnsigned);
addRegexToken("yyy", matchUnsigned);
addRegexToken("yyyy", matchUnsigned);
addRegexToken("yo", matchEraYearOrdinal);
addParseToken(["y", "yy", "yyy", "yyyy"], YEAR);
addParseToken(["yo"], function(input2, array4, config2, token2) {
  var match5;
  if (config2._locale._eraYearOrdinalRegex) {
    match5 = input2.match(config2._locale._eraYearOrdinalRegex);
  }
  if (config2._locale.eraYearOrdinalParse) {
    array4[YEAR] = config2._locale.eraYearOrdinalParse(input2, match5);
  } else {
    array4[YEAR] = parseInt(input2, 10);
  }
});
function localeEras(m2, format2) {
  var i2, l2, date4, eras = this._eras || getLocale("en")._eras;
  for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) {
    switch (typeof eras[i2].since) {
      case "string":
        date4 = hooks(eras[i2].since).startOf("day");
        eras[i2].since = date4.valueOf();
        break;
    }
    switch (typeof eras[i2].until) {
      case "undefined":
        eras[i2].until = Infinity;
        break;
      case "string":
        date4 = hooks(eras[i2].until).startOf("day").valueOf();
        eras[i2].until = date4.valueOf();
        break;
    }
  }
  return eras;
}
function localeErasParse(eraName, format2, strict) {
  var i2, l2, eras = this.eras(), name2, abbr, narrow;
  eraName = eraName.toUpperCase();
  for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) {
    name2 = eras[i2].name.toUpperCase();
    abbr = eras[i2].abbr.toUpperCase();
    narrow = eras[i2].narrow.toUpperCase();
    if (strict) {
      switch (format2) {
        case "N":
        case "NN":
        case "NNN":
          if (abbr === eraName) {
            return eras[i2];
          }
          break;
        case "NNNN":
          if (name2 === eraName) {
            return eras[i2];
          }
          break;
        case "NNNNN":
          if (narrow === eraName) {
            return eras[i2];
          }
          break;
      }
    } else if ([name2, abbr, narrow].indexOf(eraName) >= 0) {
      return eras[i2];
    }
  }
}
function localeErasConvertYear(era, year) {
  var dir = era.since <= era.until ? 1 : -1;
  if (year === void 0) {
    return hooks(era.since).year();
  } else {
    return hooks(era.since).year() + (year - era.offset) * dir;
  }
}
function getEraName() {
  var i2, l2, val, eras = this.localeData().eras();
  for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) {
    val = this.clone().startOf("day").valueOf();
    if (eras[i2].since <= val && val <= eras[i2].until) {
      return eras[i2].name;
    }
    if (eras[i2].until <= val && val <= eras[i2].since) {
      return eras[i2].name;
    }
  }
  return "";
}
function getEraNarrow() {
  var i2, l2, val, eras = this.localeData().eras();
  for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) {
    val = this.clone().startOf("day").valueOf();
    if (eras[i2].since <= val && val <= eras[i2].until) {
      return eras[i2].narrow;
    }
    if (eras[i2].until <= val && val <= eras[i2].since) {
      return eras[i2].narrow;
    }
  }
  return "";
}
function getEraAbbr() {
  var i2, l2, val, eras = this.localeData().eras();
  for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) {
    val = this.clone().startOf("day").valueOf();
    if (eras[i2].since <= val && val <= eras[i2].until) {
      return eras[i2].abbr;
    }
    if (eras[i2].until <= val && val <= eras[i2].since) {
      return eras[i2].abbr;
    }
  }
  return "";
}
function getEraYear() {
  var i2, l2, dir, val, eras = this.localeData().eras();
  for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) {
    dir = eras[i2].since <= eras[i2].until ? 1 : -1;
    val = this.clone().startOf("day").valueOf();
    if (eras[i2].since <= val && val <= eras[i2].until || eras[i2].until <= val && val <= eras[i2].since) {
      return (this.year() - hooks(eras[i2].since).year()) * dir + eras[i2].offset;
    }
  }
  return this.year();
}
function erasNameRegex(isStrict) {
  if (!hasOwnProp(this, "_erasNameRegex")) {
    computeErasParse.call(this);
  }
  return isStrict ? this._erasNameRegex : this._erasRegex;
}
function erasAbbrRegex(isStrict) {
  if (!hasOwnProp(this, "_erasAbbrRegex")) {
    computeErasParse.call(this);
  }
  return isStrict ? this._erasAbbrRegex : this._erasRegex;
}
function erasNarrowRegex(isStrict) {
  if (!hasOwnProp(this, "_erasNarrowRegex")) {
    computeErasParse.call(this);
  }
  return isStrict ? this._erasNarrowRegex : this._erasRegex;
}
function matchEraAbbr(isStrict, locale2) {
  return locale2.erasAbbrRegex(isStrict);
}
function matchEraName(isStrict, locale2) {
  return locale2.erasNameRegex(isStrict);
}
function matchEraNarrow(isStrict, locale2) {
  return locale2.erasNarrowRegex(isStrict);
}
function matchEraYearOrdinal(isStrict, locale2) {
  return locale2._eraYearOrdinalRegex || matchUnsigned;
}
function computeErasParse() {
  var abbrPieces = [], namePieces = [], narrowPieces = [], mixedPieces = [], i2, l2, erasName, erasAbbr, erasNarrow, eras = this.eras();
  for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) {
    erasName = regexEscape(eras[i2].name);
    erasAbbr = regexEscape(eras[i2].abbr);
    erasNarrow = regexEscape(eras[i2].narrow);
    namePieces.push(erasName);
    abbrPieces.push(erasAbbr);
    narrowPieces.push(erasNarrow);
    mixedPieces.push(erasName);
    mixedPieces.push(erasAbbr);
    mixedPieces.push(erasNarrow);
  }
  this._erasRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
  this._erasNameRegex = new RegExp("^(" + namePieces.join("|") + ")", "i");
  this._erasAbbrRegex = new RegExp("^(" + abbrPieces.join("|") + ")", "i");
  this._erasNarrowRegex = new RegExp(
    "^(" + narrowPieces.join("|") + ")",
    "i"
  );
}
addFormatToken(0, ["gg", 2], 0, function() {
  return this.weekYear() % 100;
});
addFormatToken(0, ["GG", 2], 0, function() {
  return this.isoWeekYear() % 100;
});
function addWeekYearFormatToken(token2, getter) {
  addFormatToken(0, [token2, token2.length], 0, getter);
}
addWeekYearFormatToken("gggg", "weekYear");
addWeekYearFormatToken("ggggg", "weekYear");
addWeekYearFormatToken("GGGG", "isoWeekYear");
addWeekYearFormatToken("GGGGG", "isoWeekYear");
addRegexToken("G", matchSigned);
addRegexToken("g", matchSigned);
addRegexToken("GG", match1to2, match2);
addRegexToken("gg", match1to2, match2);
addRegexToken("GGGG", match1to4, match4);
addRegexToken("gggg", match1to4, match4);
addRegexToken("GGGGG", match1to6, match6);
addRegexToken("ggggg", match1to6, match6);
addWeekParseToken(
  ["gggg", "ggggg", "GGGG", "GGGGG"],
  function(input2, week, config2, token2) {
    week[token2.substr(0, 2)] = toInt(input2);
  }
);
addWeekParseToken(["gg", "GG"], function(input2, week, config2, token2) {
  week[token2] = hooks.parseTwoDigitYear(input2);
});
function getSetWeekYear(input2) {
  return getSetWeekYearHelper.call(
    this,
    input2,
    this.week(),
    this.weekday() + this.localeData()._week.dow,
    this.localeData()._week.dow,
    this.localeData()._week.doy
  );
}
function getSetISOWeekYear(input2) {
  return getSetWeekYearHelper.call(
    this,
    input2,
    this.isoWeek(),
    this.isoWeekday(),
    1,
    4
  );
}
function getISOWeeksInYear() {
  return weeksInYear(this.year(), 1, 4);
}
function getISOWeeksInISOWeekYear() {
  return weeksInYear(this.isoWeekYear(), 1, 4);
}
function getWeeksInYear() {
  var weekInfo = this.localeData()._week;
  return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
}
function getWeeksInWeekYear() {
  var weekInfo = this.localeData()._week;
  return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);
}
function getSetWeekYearHelper(input2, week, weekday, dow, doy) {
  var weeksTarget;
  if (input2 == null) {
    return weekOfYear(this, dow, doy).year;
  } else {
    weeksTarget = weeksInYear(input2, dow, doy);
    if (week > weeksTarget) {
      week = weeksTarget;
    }
    return setWeekAll.call(this, input2, week, weekday, dow, doy);
  }
}
function setWeekAll(weekYear, week, weekday, dow, doy) {
  var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), date4 = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
  this.year(date4.getUTCFullYear());
  this.month(date4.getUTCMonth());
  this.date(date4.getUTCDate());
  return this;
}
addFormatToken("Q", 0, "Qo", "quarter");
addRegexToken("Q", match1);
addParseToken("Q", function(input2, array4) {
  array4[MONTH] = (toInt(input2) - 1) * 3;
});
function getSetQuarter(input2) {
  return input2 == null ? Math.ceil((this.month() + 1) / 3) : this.month((input2 - 1) * 3 + this.month() % 3);
}
addFormatToken("D", ["DD", 2], "Do", "date");
addRegexToken("D", match1to2, match1to2NoLeadingZero);
addRegexToken("DD", match1to2, match2);
addRegexToken("Do", function(isStrict, locale2) {
  return isStrict ? locale2._dayOfMonthOrdinalParse || locale2._ordinalParse : locale2._dayOfMonthOrdinalParseLenient;
});
addParseToken(["D", "DD"], DATE$1);
addParseToken("Do", function(input2, array4) {
  array4[DATE$1] = toInt(input2.match(match1to2)[0]);
});
var getSetDayOfMonth = makeGetSet("Date", true);
addFormatToken("DDD", ["DDDD", 3], "DDDo", "dayOfYear");
addRegexToken("DDD", match1to3);
addRegexToken("DDDD", match3);
addParseToken(["DDD", "DDDD"], function(input2, array4, config2) {
  config2._dayOfYear = toInt(input2);
});
function getSetDayOfYear(input2) {
  var dayOfYear = Math.round(
    (this.clone().startOf("day") - this.clone().startOf("year")) / 864e5
  ) + 1;
  return input2 == null ? dayOfYear : this.add(input2 - dayOfYear, "d");
}
addFormatToken("m", ["mm", 2], 0, "minute");
addRegexToken("m", match1to2, match1to2HasZero);
addRegexToken("mm", match1to2, match2);
addParseToken(["m", "mm"], MINUTE);
var getSetMinute = makeGetSet("Minutes", false);
addFormatToken("s", ["ss", 2], 0, "second");
addRegexToken("s", match1to2, match1to2HasZero);
addRegexToken("ss", match1to2, match2);
addParseToken(["s", "ss"], SECOND);
var getSetSecond = makeGetSet("Seconds", false);
addFormatToken("S", 0, 0, function() {
  return ~~(this.millisecond() / 100);
});
addFormatToken(0, ["SS", 2], 0, function() {
  return ~~(this.millisecond() / 10);
});
addFormatToken(0, ["SSS", 3], 0, "millisecond");
addFormatToken(0, ["SSSS", 4], 0, function() {
  return this.millisecond() * 10;
});
addFormatToken(0, ["SSSSS", 5], 0, function() {
  return this.millisecond() * 100;
});
addFormatToken(0, ["SSSSSS", 6], 0, function() {
  return this.millisecond() * 1e3;
});
addFormatToken(0, ["SSSSSSS", 7], 0, function() {
  return this.millisecond() * 1e4;
});
addFormatToken(0, ["SSSSSSSS", 8], 0, function() {
  return this.millisecond() * 1e5;
});
addFormatToken(0, ["SSSSSSSSS", 9], 0, function() {
  return this.millisecond() * 1e6;
});
addRegexToken("S", match1to3, match1);
addRegexToken("SS", match1to3, match2);
addRegexToken("SSS", match1to3, match3);
var token, getSetMillisecond;
for (token = "SSSS"; token.length <= 9; token += "S") {
  addRegexToken(token, matchUnsigned);
}
function parseMs(input2, array4) {
  array4[MILLISECOND] = toInt(("0." + input2) * 1e3);
}
for (token = "S"; token.length <= 9; token += "S") {
  addParseToken(token, parseMs);
}
getSetMillisecond = makeGetSet("Milliseconds", false);
addFormatToken("z", 0, 0, "zoneAbbr");
addFormatToken("zz", 0, 0, "zoneName");
function getZoneAbbr() {
  return this._isUTC ? "UTC" : "";
}
function getZoneName() {
  return this._isUTC ? "Coordinated Universal Time" : "";
}
var proto = Moment.prototype;
proto.add = add$1;
proto.calendar = calendar$1;
proto.clone = clone2;
proto.diff = diff;
proto.endOf = endOf;
proto.format = format;
proto.from = from;
proto.fromNow = fromNow;
proto.to = to;
proto.toNow = toNow;
proto.get = stringGet;
proto.invalidAt = invalidAt;
proto.isAfter = isAfter$1;
proto.isBefore = isBefore;
proto.isBetween = isBetween;
proto.isSame = isSame;
proto.isSameOrAfter = isSameOrAfter;
proto.isSameOrBefore = isSameOrBefore;
proto.isValid = isValid$2;
proto.lang = lang;
proto.locale = locale;
proto.localeData = localeData;
proto.max = prototypeMax;
proto.min = prototypeMin;
proto.parsingFlags = parsingFlags;
proto.set = stringSet;
proto.startOf = startOf;
proto.subtract = subtract$1;
proto.toArray = toArray$1;
proto.toObject = toObject;
proto.toDate = toDate;
proto.toISOString = toISOString;
proto.inspect = inspect;
if (typeof Symbol !== "undefined" && Symbol.for != null) {
  proto[Symbol.for("nodejs.util.inspect.custom")] = function() {
    return "Moment<" + this.format() + ">";
  };
}
proto.toJSON = toJSON;
proto.toString = toString$3;
proto.unix = unix;
proto.valueOf = valueOf;
proto.creationData = creationData;
proto.eraName = getEraName;
proto.eraNarrow = getEraNarrow;
proto.eraAbbr = getEraAbbr;
proto.eraYear = getEraYear;
proto.year = getSetYear;
proto.isLeapYear = getIsLeapYear;
proto.weekYear = getSetWeekYear;
proto.isoWeekYear = getSetISOWeekYear;
proto.quarter = proto.quarters = getSetQuarter;
proto.month = getSetMonth;
proto.daysInMonth = getDaysInMonth;
proto.week = proto.weeks = getSetWeek;
proto.isoWeek = proto.isoWeeks = getSetISOWeek;
proto.weeksInYear = getWeeksInYear;
proto.weeksInWeekYear = getWeeksInWeekYear;
proto.isoWeeksInYear = getISOWeeksInYear;
proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;
proto.date = getSetDayOfMonth;
proto.day = proto.days = getSetDayOfWeek;
proto.weekday = getSetLocaleDayOfWeek;
proto.isoWeekday = getSetISODayOfWeek;
proto.dayOfYear = getSetDayOfYear;
proto.hour = proto.hours = getSetHour;
proto.minute = proto.minutes = getSetMinute;
proto.second = proto.seconds = getSetSecond;
proto.millisecond = proto.milliseconds = getSetMillisecond;
proto.utcOffset = getSetOffset;
proto.utc = setOffsetToUTC;
proto.local = setOffsetToLocal;
proto.parseZone = setOffsetToParsedOffset;
proto.hasAlignedHourOffset = hasAlignedHourOffset;
proto.isDST = isDaylightSavingTime;
proto.isLocal = isLocal;
proto.isUtcOffset = isUtcOffset;
proto.isUtc = isUtc;
proto.isUTC = isUtc;
proto.zoneAbbr = getZoneAbbr;
proto.zoneName = getZoneName;
proto.dates = deprecate(
  "dates accessor is deprecated. Use date instead.",
  getSetDayOfMonth
);
proto.months = deprecate(
  "months accessor is deprecated. Use month instead",
  getSetMonth
);
proto.years = deprecate(
  "years accessor is deprecated. Use year instead",
  getSetYear
);
proto.zone = deprecate(
  "moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",
  getSetZone
);
proto.isDSTShifted = deprecate(
  "isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",
  isDaylightSavingTimeShifted
);
function createUnix(input2) {
  return createLocal(input2 * 1e3);
}
function createInZone() {
  return createLocal.apply(null, arguments).parseZone();
}
function preParsePostFormat(string3) {
  return string3;
}
var proto$1 = Locale.prototype;
proto$1.calendar = calendar;
proto$1.longDateFormat = longDateFormat;
proto$1.invalidDate = invalidDate;
proto$1.ordinal = ordinal;
proto$1.preparse = preParsePostFormat;
proto$1.postformat = preParsePostFormat;
proto$1.relativeTime = relativeTime;
proto$1.pastFuture = pastFuture;
proto$1.set = set;
proto$1.eras = localeEras;
proto$1.erasParse = localeErasParse;
proto$1.erasConvertYear = localeErasConvertYear;
proto$1.erasAbbrRegex = erasAbbrRegex;
proto$1.erasNameRegex = erasNameRegex;
proto$1.erasNarrowRegex = erasNarrowRegex;
proto$1.months = localeMonths;
proto$1.monthsShort = localeMonthsShort;
proto$1.monthsParse = localeMonthsParse;
proto$1.monthsRegex = monthsRegex;
proto$1.monthsShortRegex = monthsShortRegex;
proto$1.week = localeWeek;
proto$1.firstDayOfYear = localeFirstDayOfYear;
proto$1.firstDayOfWeek = localeFirstDayOfWeek;
proto$1.weekdays = localeWeekdays;
proto$1.weekdaysMin = localeWeekdaysMin;
proto$1.weekdaysShort = localeWeekdaysShort;
proto$1.weekdaysParse = localeWeekdaysParse;
proto$1.weekdaysRegex = weekdaysRegex;
proto$1.weekdaysShortRegex = weekdaysShortRegex;
proto$1.weekdaysMinRegex = weekdaysMinRegex;
proto$1.isPM = localeIsPM;
proto$1.meridiem = localeMeridiem;
function get$1(format2, index2, field, setter) {
  var locale2 = getLocale(), utc = createUTC().set(setter, index2);
  return locale2[field](utc, format2);
}
function listMonthsImpl(format2, index2, field) {
  if (isNumber$1(format2)) {
    index2 = format2;
    format2 = void 0;
  }
  format2 = format2 || "";
  if (index2 != null) {
    return get$1(format2, index2, field, "month");
  }
  var i2, out = [];
  for (i2 = 0; i2 < 12; i2++) {
    out[i2] = get$1(format2, i2, field, "month");
  }
  return out;
}
function listWeekdaysImpl(localeSorted, format2, index2, field) {
  if (typeof localeSorted === "boolean") {
    if (isNumber$1(format2)) {
      index2 = format2;
      format2 = void 0;
    }
    format2 = format2 || "";
  } else {
    format2 = localeSorted;
    index2 = format2;
    localeSorted = false;
    if (isNumber$1(format2)) {
      index2 = format2;
      format2 = void 0;
    }
    format2 = format2 || "";
  }
  var locale2 = getLocale(), shift = localeSorted ? locale2._week.dow : 0, i2, out = [];
  if (index2 != null) {
    return get$1(format2, (index2 + shift) % 7, field, "day");
  }
  for (i2 = 0; i2 < 7; i2++) {
    out[i2] = get$1(format2, (i2 + shift) % 7, field, "day");
  }
  return out;
}
function listMonths(format2, index2) {
  return listMonthsImpl(format2, index2, "months");
}
function listMonthsShort(format2, index2) {
  return listMonthsImpl(format2, index2, "monthsShort");
}
function listWeekdays(localeSorted, format2, index2) {
  return listWeekdaysImpl(localeSorted, format2, index2, "weekdays");
}
function listWeekdaysShort(localeSorted, format2, index2) {
  return listWeekdaysImpl(localeSorted, format2, index2, "weekdaysShort");
}
function listWeekdaysMin(localeSorted, format2, index2) {
  return listWeekdaysImpl(localeSorted, format2, index2, "weekdaysMin");
}
getSetGlobalLocale("en", {
  eras: [
    {
      since: "0001-01-01",
      until: Infinity,
      offset: 1,
      name: "Anno Domini",
      narrow: "AD",
      abbr: "AD"
    },
    {
      since: "0000-12-31",
      until: -Infinity,
      offset: 1,
      name: "Before Christ",
      narrow: "BC",
      abbr: "BC"
    }
  ],
  dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
  ordinal: function(number4) {
    var b2 = number4 % 10, output2 = toInt(number4 % 100 / 10) === 1 ? "th" : b2 === 1 ? "st" : b2 === 2 ? "nd" : b2 === 3 ? "rd" : "th";
    return number4 + output2;
  }
});
hooks.lang = deprecate(
  "moment.lang is deprecated. Use moment.locale instead.",
  getSetGlobalLocale
);
hooks.langData = deprecate(
  "moment.langData is deprecated. Use moment.localeData instead.",
  getLocale
);
var mathAbs = Math.abs;
function abs() {
  var data = this._data;
  this._milliseconds = mathAbs(this._milliseconds);
  this._days = mathAbs(this._days);
  this._months = mathAbs(this._months);
  data.milliseconds = mathAbs(data.milliseconds);
  data.seconds = mathAbs(data.seconds);
  data.minutes = mathAbs(data.minutes);
  data.hours = mathAbs(data.hours);
  data.months = mathAbs(data.months);
  data.years = mathAbs(data.years);
  return this;
}
function addSubtract$1(duration2, input2, value2, direction) {
  var other = createDuration(input2, value2);
  duration2._milliseconds += direction * other._milliseconds;
  duration2._days += direction * other._days;
  duration2._months += direction * other._months;
  return duration2._bubble();
}
function add$1$1(input2, value2) {
  return addSubtract$1(this, input2, value2, 1);
}
function subtract$1$1(input2, value2) {
  return addSubtract$1(this, input2, value2, -1);
}
function absCeil(number4) {
  if (number4 < 0) {
    return Math.floor(number4);
  } else {
    return Math.ceil(number4);
  }
}
function bubble() {
  var milliseconds2 = this._milliseconds, days2 = this._days, months2 = this._months, data = this._data, seconds2, minutes2, hours2, years2, monthsFromDays;
  if (!(milliseconds2 >= 0 && days2 >= 0 && months2 >= 0 || milliseconds2 <= 0 && days2 <= 0 && months2 <= 0)) {
    milliseconds2 += absCeil(monthsToDays(months2) + days2) * 864e5;
    days2 = 0;
    months2 = 0;
  }
  data.milliseconds = milliseconds2 % 1e3;
  seconds2 = absFloor(milliseconds2 / 1e3);
  data.seconds = seconds2 % 60;
  minutes2 = absFloor(seconds2 / 60);
  data.minutes = minutes2 % 60;
  hours2 = absFloor(minutes2 / 60);
  data.hours = hours2 % 24;
  days2 += absFloor(hours2 / 24);
  monthsFromDays = absFloor(daysToMonths(days2));
  months2 += monthsFromDays;
  days2 -= absCeil(monthsToDays(monthsFromDays));
  years2 = absFloor(months2 / 12);
  months2 %= 12;
  data.days = days2;
  data.months = months2;
  data.years = years2;
  return this;
}
function daysToMonths(days2) {
  return days2 * 4800 / 146097;
}
function monthsToDays(months2) {
  return months2 * 146097 / 4800;
}
function as(units) {
  if (!this.isValid()) {
    return NaN;
  }
  var days2, months2, milliseconds2 = this._milliseconds;
  units = normalizeUnits(units);
  if (units === "month" || units === "quarter" || units === "year") {
    days2 = this._days + milliseconds2 / 864e5;
    months2 = this._months + daysToMonths(days2);
    switch (units) {
      case "month":
        return months2;
      case "quarter":
        return months2 / 3;
      case "year":
        return months2 / 12;
    }
  } else {
    days2 = this._days + Math.round(monthsToDays(this._months));
    switch (units) {
      case "week":
        return days2 / 7 + milliseconds2 / 6048e5;
      case "day":
        return days2 + milliseconds2 / 864e5;
      case "hour":
        return days2 * 24 + milliseconds2 / 36e5;
      case "minute":
        return days2 * 1440 + milliseconds2 / 6e4;
      case "second":
        return days2 * 86400 + milliseconds2 / 1e3;
      case "millisecond":
        return Math.floor(days2 * 864e5) + milliseconds2;
      default:
        throw new Error("Unknown unit " + units);
    }
  }
}
function makeAs(alias) {
  return function() {
    return this.as(alias);
  };
}
var asMilliseconds = makeAs("ms"), asSeconds = makeAs("s"), asMinutes = makeAs("m"), asHours = makeAs("h"), asDays = makeAs("d"), asWeeks = makeAs("w"), asMonths = makeAs("M"), asQuarters = makeAs("Q"), asYears = makeAs("y"), valueOf$1 = asMilliseconds;
function clone$1() {
  return createDuration(this);
}
function get$2(units) {
  units = normalizeUnits(units);
  return this.isValid() ? this[units + "s"]() : NaN;
}
function makeGetter(name2) {
  return function() {
    return this.isValid() ? this._data[name2] : NaN;
  };
}
var milliseconds = makeGetter("milliseconds"), seconds = makeGetter("seconds"), minutes = makeGetter("minutes"), hours = makeGetter("hours"), days = makeGetter("days"), months = makeGetter("months"), years = makeGetter("years");
function weeks() {
  return absFloor(this.days() / 7);
}
var round = Math.round, thresholds = {
  ss: 44,
  // a few seconds to seconds
  s: 45,
  // seconds to minute
  m: 45,
  // minutes to hour
  h: 22,
  // hours to day
  d: 26,
  // days to month/week
  w: null,
  // weeks to month
  M: 11
  // months to year
};
function substituteTimeAgo(string3, number4, withoutSuffix, isFuture, locale2) {
  return locale2.relativeTime(number4 || 1, !!withoutSuffix, string3, isFuture);
}
function relativeTime$1(posNegDuration, withoutSuffix, thresholds2, locale2) {
  var duration2 = createDuration(posNegDuration).abs(), seconds2 = round(duration2.as("s")), minutes2 = round(duration2.as("m")), hours2 = round(duration2.as("h")), days2 = round(duration2.as("d")), months2 = round(duration2.as("M")), weeks2 = round(duration2.as("w")), years2 = round(duration2.as("y")), a2 = seconds2 <= thresholds2.ss && ["s", seconds2] || seconds2 < thresholds2.s && ["ss", seconds2] || minutes2 <= 1 && ["m"] || minutes2 < thresholds2.m && ["mm", minutes2] || hours2 <= 1 && ["h"] || hours2 < thresholds2.h && ["hh", hours2] || days2 <= 1 && ["d"] || days2 < thresholds2.d && ["dd", days2];
  if (thresholds2.w != null) {
    a2 = a2 || weeks2 <= 1 && ["w"] || weeks2 < thresholds2.w && ["ww", weeks2];
  }
  a2 = a2 || months2 <= 1 && ["M"] || months2 < thresholds2.M && ["MM", months2] || years2 <= 1 && ["y"] || ["yy", years2];
  a2[2] = withoutSuffix;
  a2[3] = +posNegDuration > 0;
  a2[4] = locale2;
  return substituteTimeAgo.apply(null, a2);
}
function getSetRelativeTimeRounding(roundingFunction) {
  if (roundingFunction === void 0) {
    return round;
  }
  if (typeof roundingFunction === "function") {
    round = roundingFunction;
    return true;
  }
  return false;
}
function getSetRelativeTimeThreshold(threshold, limit2) {
  if (thresholds[threshold] === void 0) {
    return false;
  }
  if (limit2 === void 0) {
    return thresholds[threshold];
  }
  thresholds[threshold] = limit2;
  if (threshold === "s") {
    thresholds.ss = limit2 - 1;
  }
  return true;
}
function humanize(argWithSuffix, argThresholds) {
  if (!this.isValid()) {
    return this.localeData().invalidDate();
  }
  var withSuffix = false, th2 = thresholds, locale2, output2;
  if (typeof argWithSuffix === "object") {
    argThresholds = argWithSuffix;
    argWithSuffix = false;
  }
  if (typeof argWithSuffix === "boolean") {
    withSuffix = argWithSuffix;
  }
  if (typeof argThresholds === "object") {
    th2 = Object.assign({}, thresholds, argThresholds);
    if (argThresholds.s != null && argThresholds.ss == null) {
      th2.ss = argThresholds.s - 1;
    }
  }
  locale2 = this.localeData();
  output2 = relativeTime$1(this, !withSuffix, th2, locale2);
  if (withSuffix) {
    output2 = locale2.pastFuture(+this, output2);
  }
  return locale2.postformat(output2);
}
var abs$1 = Math.abs;
function sign(x2) {
  return (x2 > 0) - (x2 < 0) || +x2;
}
function toISOString$1() {
  if (!this.isValid()) {
    return this.localeData().invalidDate();
  }
  var seconds2 = abs$1(this._milliseconds) / 1e3, days2 = abs$1(this._days), months2 = abs$1(this._months), minutes2, hours2, years2, s2, total = this.asSeconds(), totalSign, ymSign, daysSign, hmsSign;
  if (!total) {
    return "P0D";
  }
  minutes2 = absFloor(seconds2 / 60);
  hours2 = absFloor(minutes2 / 60);
  seconds2 %= 60;
  minutes2 %= 60;
  years2 = absFloor(months2 / 12);
  months2 %= 12;
  s2 = seconds2 ? seconds2.toFixed(3).replace(/\.?0+$/, "") : "";
  totalSign = total < 0 ? "-" : "";
  ymSign = sign(this._months) !== sign(total) ? "-" : "";
  daysSign = sign(this._days) !== sign(total) ? "-" : "";
  hmsSign = sign(this._milliseconds) !== sign(total) ? "-" : "";
  return totalSign + "P" + (years2 ? ymSign + years2 + "Y" : "") + (months2 ? ymSign + months2 + "M" : "") + (days2 ? daysSign + days2 + "D" : "") + (hours2 || minutes2 || seconds2 ? "T" : "") + (hours2 ? hmsSign + hours2 + "H" : "") + (minutes2 ? hmsSign + minutes2 + "M" : "") + (seconds2 ? hmsSign + s2 + "S" : "");
}
var proto$2 = Duration.prototype;
proto$2.isValid = isValid$1;
proto$2.abs = abs;
proto$2.add = add$1$1;
proto$2.subtract = subtract$1$1;
proto$2.as = as;
proto$2.asMilliseconds = asMilliseconds;
proto$2.asSeconds = asSeconds;
proto$2.asMinutes = asMinutes;
proto$2.asHours = asHours;
proto$2.asDays = asDays;
proto$2.asWeeks = asWeeks;
proto$2.asMonths = asMonths;
proto$2.asQuarters = asQuarters;
proto$2.asYears = asYears;
proto$2.valueOf = valueOf$1;
proto$2._bubble = bubble;
proto$2.clone = clone$1;
proto$2.get = get$2;
proto$2.milliseconds = milliseconds;
proto$2.seconds = seconds;
proto$2.minutes = minutes;
proto$2.hours = hours;
proto$2.days = days;
proto$2.weeks = weeks;
proto$2.months = months;
proto$2.years = years;
proto$2.humanize = humanize;
proto$2.toISOString = toISOString$1;
proto$2.toString = toISOString$1;
proto$2.toJSON = toISOString$1;
proto$2.locale = locale;
proto$2.localeData = localeData;
proto$2.toIsoString = deprecate(
  "toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",
  toISOString$1
);
proto$2.lang = lang;
addFormatToken("X", 0, 0, "unix");
addFormatToken("x", 0, 0, "valueOf");
addRegexToken("x", matchSigned);
addRegexToken("X", matchTimestamp);
addParseToken("X", function(input2, array4, config2) {
  config2._d = new Date(parseFloat(input2) * 1e3);
});
addParseToken("x", function(input2, array4, config2) {
  config2._d = new Date(toInt(input2));
});
//! moment.js
hooks.version = "2.30.1";
setHookCallback(createLocal);
hooks.fn = proto;
hooks.min = min;
hooks.max = max;
hooks.now = now;
hooks.utc = createUTC;
hooks.unix = createUnix;
hooks.months = listMonths;
hooks.isDate = isDate$1;
hooks.locale = getSetGlobalLocale;
hooks.invalid = createInvalid;
hooks.duration = createDuration;
hooks.isMoment = isMoment;
hooks.weekdays = listWeekdays;
hooks.parseZone = createInZone;
hooks.localeData = getLocale;
hooks.isDuration = isDuration;
hooks.monthsShort = listMonthsShort;
hooks.weekdaysMin = listWeekdaysMin;
hooks.defineLocale = defineLocale;
hooks.updateLocale = updateLocale;
hooks.locales = listLocales;
hooks.weekdaysShort = listWeekdaysShort;
hooks.normalizeUnits = normalizeUnits;
hooks.relativeTimeRounding = getSetRelativeTimeRounding;
hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
hooks.calendarFormat = getCalendarFormat;
hooks.prototype = proto;
hooks.HTML5_FMT = {
  DATETIME_LOCAL: "YYYY-MM-DDTHH:mm",
  // <input type="datetime-local" />
  DATETIME_LOCAL_SECONDS: "YYYY-MM-DDTHH:mm:ss",
  // <input type="datetime-local" step="1" />
  DATETIME_LOCAL_MS: "YYYY-MM-DDTHH:mm:ss.SSS",
  // <input type="datetime-local" step="0.001" />
  DATE: "YYYY-MM-DD",
  // <input type="date" />
  TIME: "HH:mm",
  // <input type="time" />
  TIME_SECONDS: "HH:mm:ss",
  // <input type="time" step="1" />
  TIME_MS: "HH:mm:ss.SSS",
  // <input type="time" step="0.001" />
  WEEK: "GGGG-[W]WW",
  // <input type="week" />
  MONTH: "YYYY-MM"
  // <input type="month" />
};
const has = Object.prototype.hasOwnProperty;
class QueueEvent extends Event {
  constructor(name2, detail) {
    super(name2);
    this.detail = detail;
  }
}
class Queue extends EventTarget {
  constructor(options = {}) {
    super();
    const { concurrency = Infinity, timeout = 0, autostart = false, results = null } = options;
    this.concurrency = concurrency;
    this.timeout = timeout;
    this.autostart = autostart;
    this.results = results;
    this.pending = 0;
    this.session = 0;
    this.running = false;
    this.jobs = [];
    this.timers = [];
    this.addEventListener("error", this._errorHandler);
  }
  _errorHandler(evt) {
    this.end(evt.detail.error);
  }
  pop() {
    return this.jobs.pop();
  }
  shift() {
    return this.jobs.shift();
  }
  indexOf(searchElement, fromIndex) {
    return this.jobs.indexOf(searchElement, fromIndex);
  }
  lastIndexOf(searchElement, fromIndex) {
    if (fromIndex !== void 0)
      return this.jobs.lastIndexOf(searchElement, fromIndex);
    return this.jobs.lastIndexOf(searchElement);
  }
  slice(start2, end2) {
    this.jobs = this.jobs.slice(start2, end2);
    return this;
  }
  reverse() {
    this.jobs.reverse();
    return this;
  }
  push(...workers) {
    const methodResult = this.jobs.push(...workers);
    if (this.autostart)
      this._start();
    return methodResult;
  }
  unshift(...workers) {
    const methodResult = this.jobs.unshift(...workers);
    if (this.autostart)
      this._start();
    return methodResult;
  }
  splice(start2, deleteCount, ...workers) {
    this.jobs.splice(start2, deleteCount, ...workers);
    if (this.autostart)
      this._start();
    return this;
  }
  get length() {
    return this.pending + this.jobs.length;
  }
  start(callback2) {
    if (this.running)
      throw new Error("already started");
    let awaiter;
    if (callback2) {
      this._addCallbackToEndEvent(callback2);
    } else {
      awaiter = this._createPromiseToEndEvent();
    }
    this._start();
    return awaiter;
  }
  _start() {
    this.running = true;
    if (this.pending >= this.concurrency) {
      return;
    }
    if (this.jobs.length === 0) {
      if (this.pending === 0) {
        this.done();
      }
      return;
    }
    const job = this.jobs.shift();
    const session = this.session;
    const timeout = job !== void 0 && has.call(job, "timeout") ? job.timeout : this.timeout;
    let once = true;
    let timeoutId = null;
    let didTimeout = false;
    let resultIndex = null;
    const next2 = (error2, ...result) => {
      if (once && this.session === session) {
        once = false;
        this.pending--;
        if (timeoutId !== null) {
          this.timers = this.timers.filter((tID) => tID !== timeoutId);
          clearTimeout(timeoutId);
        }
        if (error2) {
          this.dispatchEvent(new QueueEvent("error", { error: error2, job }));
        } else if (!didTimeout) {
          if (resultIndex !== null && this.results !== null) {
            this.results[resultIndex] = [...result];
          }
          this.dispatchEvent(new QueueEvent("success", { result: [...result], job }));
        }
        if (this.session === session) {
          if (this.pending === 0 && this.jobs.length === 0) {
            this.done();
          } else if (this.running) {
            this._start();
          }
        }
      }
    };
    if (timeout) {
      timeoutId = setTimeout(() => {
        didTimeout = true;
        this.dispatchEvent(new QueueEvent("timeout", { next: next2, job }));
        next2();
      }, timeout);
      this.timers.push(timeoutId);
    }
    if (this.results != null) {
      resultIndex = this.results.length;
      this.results[resultIndex] = null;
    }
    this.pending++;
    this.dispatchEvent(new QueueEvent("start", { job }));
    job.promise = job(next2);
    if (job.promise !== void 0 && typeof job.promise.then === "function") {
      job.promise.then(function(result) {
        return next2(void 0, result);
      }).catch(function(err) {
        return next2(err || true);
      });
    }
    if (this.running && this.jobs.length > 0) {
      this._start();
    }
  }
  stop() {
    this.running = false;
  }
  end(error2) {
    this.clearTimers();
    this.jobs.length = 0;
    this.pending = 0;
    this.done(error2);
  }
  clearTimers() {
    this.timers.forEach((timer) => {
      clearTimeout(timer);
    });
    this.timers = [];
  }
  _addCallbackToEndEvent(cb2) {
    const onend = (evt) => {
      this.removeEventListener("end", onend);
      cb2(evt.detail.error, this.results);
    };
    this.addEventListener("end", onend);
  }
  _createPromiseToEndEvent() {
    return new Promise((resolve2, reject) => {
      this._addCallbackToEndEvent((error2, results) => {
        if (error2)
          reject(error2);
        else
          resolve2(results);
      });
    });
  }
  done(error2) {
    this.session++;
    this.running = false;
    this.dispatchEvent(new QueueEvent("end", { error: error2 }));
  }
}
function bind(fn, thisArg) {
  return function wrap2() {
    return fn.apply(thisArg, arguments);
  };
}
const { toString: toString$2 } = Object.prototype;
const { getPrototypeOf } = Object;
const { iterator, toStringTag } = Symbol;
const kindOf = /* @__PURE__ */ ((cache2) => (thing) => {
  const str = toString$2.call(thing);
  return cache2[str] || (cache2[str] = str.slice(8, -1).toLowerCase());
})(/* @__PURE__ */ Object.create(null));
const kindOfTest = (type4) => {
  type4 = type4.toLowerCase();
  return (thing) => kindOf(thing) === type4;
};
const typeOfTest = (type4) => (thing) => typeof thing === type4;
const { isArray: isArray$1 } = Array;
const isUndefined = typeOfTest("undefined");
function isBuffer(val) {
  return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
}
const isArrayBuffer = kindOfTest("ArrayBuffer");
function isArrayBufferView(val) {
  let result;
  if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
    result = ArrayBuffer.isView(val);
  } else {
    result = val && val.buffer && isArrayBuffer(val.buffer);
  }
  return result;
}
const isString = typeOfTest("string");
const isFunction = typeOfTest("function");
const isNumber = typeOfTest("number");
const isObject = (thing) => thing !== null && typeof thing === "object";
const isBoolean = (thing) => thing === true || thing === false;
const isPlainObject$2 = (val) => {
  if (kindOf(val) !== "object") {
    return false;
  }
  const prototype2 = getPrototypeOf(val);
  return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
};
const isEmptyObject = (val) => {
  if (!isObject(val) || isBuffer(val)) {
    return false;
  }
  try {
    return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
  } catch (e2) {
    return false;
  }
};
const isDate = kindOfTest("Date");
const isFile = kindOfTest("File");
const isBlob = kindOfTest("Blob");
const isFileList = kindOfTest("FileList");
const isStream = (val) => isObject(val) && isFunction(val.pipe);
const isFormData = (thing) => {
  let kind;
  return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
  kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
};
const isURLSearchParams = kindOfTest("URLSearchParams");
const [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
const trim$1 = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
function forEach(obj, fn, { allOwnKeys = false } = {}) {
  if (obj === null || typeof obj === "undefined") {
    return;
  }
  let i2;
  let l2;
  if (typeof obj !== "object") {
    obj = [obj];
  }
  if (isArray$1(obj)) {
    for (i2 = 0, l2 = obj.length; i2 < l2; i2++) {
      fn.call(null, obj[i2], i2, obj);
    }
  } else {
    if (isBuffer(obj)) {
      return;
    }
    const keys2 = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
    const len = keys2.length;
    let key;
    for (i2 = 0; i2 < len; i2++) {
      key = keys2[i2];
      fn.call(null, obj[key], key, obj);
    }
  }
}
function findKey(obj, key) {
  if (isBuffer(obj)) {
    return null;
  }
  key = key.toLowerCase();
  const keys2 = Object.keys(obj);
  let i2 = keys2.length;
  let _key;
  while (i2-- > 0) {
    _key = keys2[i2];
    if (key === _key.toLowerCase()) {
      return _key;
    }
  }
  return null;
}
const _global = (() => {
  if (typeof globalThis !== "undefined")
    return globalThis;
  return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
})();
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
function merge$1() {
  const { caseless } = isContextDefined(this) && this || {};
  const result = {};
  const assignValue2 = (val, key) => {
    const targetKey = caseless && findKey(result, key) || key;
    if (isPlainObject$2(result[targetKey]) && isPlainObject$2(val)) {
      result[targetKey] = merge$1(result[targetKey], val);
    } else if (isPlainObject$2(val)) {
      result[targetKey] = merge$1({}, val);
    } else if (isArray$1(val)) {
      result[targetKey] = val.slice();
    } else {
      result[targetKey] = val;
    }
  };
  for (let i2 = 0, l2 = arguments.length; i2 < l2; i2++) {
    arguments[i2] && forEach(arguments[i2], assignValue2);
  }
  return result;
}
const extend$2 = (a2, b2, thisArg, { allOwnKeys } = {}) => {
  forEach(b2, (val, key) => {
    if (thisArg && isFunction(val)) {
      a2[key] = bind(val, thisArg);
    } else {
      a2[key] = val;
    }
  }, { allOwnKeys });
  return a2;
};
const stripBOM = (content2) => {
  if (content2.charCodeAt(0) === 65279) {
    content2 = content2.slice(1);
  }
  return content2;
};
const inherits = (constructor, superConstructor, props, descriptors2) => {
  constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
  constructor.prototype.constructor = constructor;
  Object.defineProperty(constructor, "super", {
    value: superConstructor.prototype
  });
  props && Object.assign(constructor.prototype, props);
};
const toFlatObject = (sourceObj, destObj, filter3, propFilter) => {
  let props;
  let i2;
  let prop;
  const merged = {};
  destObj = destObj || {};
  if (sourceObj == null)
    return destObj;
  do {
    props = Object.getOwnPropertyNames(sourceObj);
    i2 = props.length;
    while (i2-- > 0) {
      prop = props[i2];
      if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
        destObj[prop] = sourceObj[prop];
        merged[prop] = true;
      }
    }
    sourceObj = filter3 !== false && getPrototypeOf(sourceObj);
  } while (sourceObj && (!filter3 || filter3(sourceObj, destObj)) && sourceObj !== Object.prototype);
  return destObj;
};
const endsWith = (str, searchString, position2) => {
  str = String(str);
  if (position2 === void 0 || position2 > str.length) {
    position2 = str.length;
  }
  position2 -= searchString.length;
  const lastIndex = str.indexOf(searchString, position2);
  return lastIndex !== -1 && lastIndex === position2;
};
const toArray = (thing) => {
  if (!thing)
    return null;
  if (isArray$1(thing))
    return thing;
  let i2 = thing.length;
  if (!isNumber(i2))
    return null;
  const arr = new Array(i2);
  while (i2-- > 0) {
    arr[i2] = thing[i2];
  }
  return arr;
};
const isTypedArray = /* @__PURE__ */ ((TypedArray) => {
  return (thing) => {
    return TypedArray && thing instanceof TypedArray;
  };
})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
const forEachEntry = (obj, fn) => {
  const generator = obj && obj[iterator];
  const _iterator = generator.call(obj);
  let result;
  while ((result = _iterator.next()) && !result.done) {
    const pair = result.value;
    fn.call(obj, pair[0], pair[1]);
  }
};
const matchAll = (regExp, str) => {
  let matches;
  const arr = [];
  while ((matches = regExp.exec(str)) !== null) {
    arr.push(matches);
  }
  return arr;
};
const isHTMLForm = kindOfTest("HTMLFormElement");
const toCamelCase = (str) => {
  return str.toLowerCase().replace(
    /[-_\s]([a-z\d])(\w*)/g,
    function replacer(m2, p1, p2) {
      return p1.toUpperCase() + p2;
    }
  );
};
const hasOwnProperty$1 = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
const isRegExp = kindOfTest("RegExp");
const reduceDescriptors = (obj, reducer2) => {
  const descriptors2 = Object.getOwnPropertyDescriptors(obj);
  const reducedDescriptors = {};
  forEach(descriptors2, (descriptor, name2) => {
    let ret;
    if ((ret = reducer2(descriptor, name2, obj)) !== false) {
      reducedDescriptors[name2] = ret || descriptor;
    }
  });
  Object.defineProperties(obj, reducedDescriptors);
};
const freezeMethods = (obj) => {
  reduceDescriptors(obj, (descriptor, name2) => {
    if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name2) !== -1) {
      return false;
    }
    const value2 = obj[name2];
    if (!isFunction(value2))
      return;
    descriptor.enumerable = false;
    if ("writable" in descriptor) {
      descriptor.writable = false;
      return;
    }
    if (!descriptor.set) {
      descriptor.set = () => {
        throw Error("Can not rewrite read-only method '" + name2 + "'");
      };
    }
  });
};
const toObjectSet = (arrayOrString, delimiter2) => {
  const obj = {};
  const define = (arr) => {
    arr.forEach((value2) => {
      obj[value2] = true;
    });
  };
  isArray$1(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter2));
  return obj;
};
const noop$1 = () => {
};
const toFiniteNumber = (value2, defaultValue2) => {
  return value2 != null && Number.isFinite(value2 = +value2) ? value2 : defaultValue2;
};
function isSpecCompliantForm(thing) {
  return !!(thing && isFunction(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
}
const toJSONObject = (obj) => {
  const stack = new Array(10);
  const visit2 = (source2, i2) => {
    if (isObject(source2)) {
      if (stack.indexOf(source2) >= 0) {
        return;
      }
      if (isBuffer(source2)) {
        return source2;
      }
      if (!("toJSON" in source2)) {
        stack[i2] = source2;
        const target = isArray$1(source2) ? [] : {};
        forEach(source2, (value2, key) => {
          const reducedValue = visit2(value2, i2 + 1);
          !isUndefined(reducedValue) && (target[key] = reducedValue);
        });
        stack[i2] = void 0;
        return target;
      }
    }
    return source2;
  };
  return visit2(obj, 0);
};
const isAsyncFn = kindOfTest("AsyncFunction");
const isThenable = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
  if (setImmediateSupported) {
    return setImmediate;
  }
  return postMessageSupported ? ((token2, callbacks) => {
    _global.addEventListener("message", ({ source: source2, data }) => {
      if (source2 === _global && data === token2) {
        callbacks.length && callbacks.shift()();
      }
    }, false);
    return (cb2) => {
      callbacks.push(cb2);
      _global.postMessage(token2, "*");
    };
  })(`axios@${Math.random()}`, []) : (cb2) => setTimeout(cb2);
})(
  typeof setImmediate === "function",
  isFunction(_global.postMessage)
);
const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
const utils$1 = {
  isArray: isArray$1,
  isArrayBuffer,
  isBuffer,
  isFormData,
  isArrayBufferView,
  isString,
  isNumber,
  isBoolean,
  isObject,
  isPlainObject: isPlainObject$2,
  isEmptyObject,
  isReadableStream,
  isRequest,
  isResponse,
  isHeaders,
  isUndefined,
  isDate,
  isFile,
  isBlob,
  isRegExp,
  isFunction,
  isStream,
  isURLSearchParams,
  isTypedArray,
  isFileList,
  forEach,
  merge: merge$1,
  extend: extend$2,
  trim: trim$1,
  stripBOM,
  inherits,
  toFlatObject,
  kindOf,
  kindOfTest,
  endsWith,
  toArray,
  forEachEntry,
  matchAll,
  isHTMLForm,
  hasOwnProperty: hasOwnProperty$1,
  hasOwnProp: hasOwnProperty$1,
  // an alias to avoid ESLint no-prototype-builtins detection
  reduceDescriptors,
  freezeMethods,
  toObjectSet,
  toCamelCase,
  noop: noop$1,
  toFiniteNumber,
  findKey,
  global: _global,
  isContextDefined,
  isSpecCompliantForm,
  toJSONObject,
  isAsyncFn,
  isThenable,
  setImmediate: _setImmediate,
  asap,
  isIterable
};
function AxiosError$1(message, code2, config2, request2, response) {
  Error.call(this);
  if (Error.captureStackTrace) {
    Error.captureStackTrace(this, this.constructor);
  } else {
    this.stack = new Error().stack;
  }
  this.message = message;
  this.name = "AxiosError";
  code2 && (this.code = code2);
  config2 && (this.config = config2);
  request2 && (this.request = request2);
  if (response) {
    this.response = response;
    this.status = response.status ? response.status : null;
  }
}
utils$1.inherits(AxiosError$1, Error, {
  toJSON: function toJSON2() {
    return {
      // Standard
      message: this.message,
      name: this.name,
      // Microsoft
      description: this.description,
      number: this.number,
      // Mozilla
      fileName: this.fileName,
      lineNumber: this.lineNumber,
      columnNumber: this.columnNumber,
      stack: this.stack,
      // Axios
      config: utils$1.toJSONObject(this.config),
      code: this.code,
      status: this.status
    };
  }
});
const prototype$1 = AxiosError$1.prototype;
const descriptors = {};
[
  "ERR_BAD_OPTION_VALUE",
  "ERR_BAD_OPTION",
  "ECONNABORTED",
  "ETIMEDOUT",
  "ERR_NETWORK",
  "ERR_FR_TOO_MANY_REDIRECTS",
  "ERR_DEPRECATED",
  "ERR_BAD_RESPONSE",
  "ERR_BAD_REQUEST",
  "ERR_CANCELED",
  "ERR_NOT_SUPPORT",
  "ERR_INVALID_URL"
  // eslint-disable-next-line func-names
].forEach((code2) => {
  descriptors[code2] = { value: code2 };
});
Object.defineProperties(AxiosError$1, descriptors);
Object.defineProperty(prototype$1, "isAxiosError", { value: true });
AxiosError$1.from = (error2, code2, config2, request2, response, customProps) => {
  const axiosError = Object.create(prototype$1);
  utils$1.toFlatObject(error2, axiosError, function filter3(obj) {
    return obj !== Error.prototype;
  }, (prop) => {
    return prop !== "isAxiosError";
  });
  AxiosError$1.call(axiosError, error2.message, code2, config2, request2, response);
  axiosError.cause = error2;
  axiosError.name = error2.name;
  customProps && Object.assign(axiosError, customProps);
  return axiosError;
};
const httpAdapter = null;
function isVisitable(thing) {
  return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
}
function removeBrackets(key) {
  return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
}
function renderKey(path, key, dots) {
  if (!path)
    return key;
  return path.concat(key).map(function each2(token2, i2) {
    token2 = removeBrackets(token2);
    return !dots && i2 ? "[" + token2 + "]" : token2;
  }).join(dots ? "." : "");
}
function isFlatArray(arr) {
  return utils$1.isArray(arr) && !arr.some(isVisitable);
}
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter2(prop) {
  return /^is[A-Z]/.test(prop);
});
function toFormData$1(obj, formData, options) {
  if (!utils$1.isObject(obj)) {
    throw new TypeError("target must be an object");
  }
  formData = formData || new FormData();
  options = utils$1.toFlatObject(options, {
    metaTokens: true,
    dots: false,
    indexes: false
  }, false, function defined2(option, source2) {
    return !utils$1.isUndefined(source2[option]);
  });
  const metaTokens = options.metaTokens;
  const visitor = options.visitor || defaultVisitor;
  const dots = options.dots;
  const indexes = options.indexes;
  const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
  const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
  if (!utils$1.isFunction(visitor)) {
    throw new TypeError("visitor must be a function");
  }
  function convertValue(value2) {
    if (value2 === null)
      return "";
    if (utils$1.isDate(value2)) {
      return value2.toISOString();
    }
    if (utils$1.isBoolean(value2)) {
      return value2.toString();
    }
    if (!useBlob && utils$1.isBlob(value2)) {
      throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
    }
    if (utils$1.isArrayBuffer(value2) || utils$1.isTypedArray(value2)) {
      return useBlob && typeof Blob === "function" ? new Blob([value2]) : Buffer.from(value2);
    }
    return value2;
  }
  function defaultVisitor(value2, key, path) {
    let arr = value2;
    if (value2 && !path && typeof value2 === "object") {
      if (utils$1.endsWith(key, "{}")) {
        key = metaTokens ? key : key.slice(0, -2);
        value2 = JSON.stringify(value2);
      } else if (utils$1.isArray(value2) && isFlatArray(value2) || (utils$1.isFileList(value2) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value2))) {
        key = removeBrackets(key);
        arr.forEach(function each2(el2, index2) {
          !(utils$1.isUndefined(el2) || el2 === null) && formData.append(
            // eslint-disable-next-line no-nested-ternary
            indexes === true ? renderKey([key], index2, dots) : indexes === null ? key : key + "[]",
            convertValue(el2)
          );
        });
        return false;
      }
    }
    if (isVisitable(value2)) {
      return true;
    }
    formData.append(renderKey(path, key, dots), convertValue(value2));
    return false;
  }
  const stack = [];
  const exposedHelpers = Object.assign(predicates, {
    defaultVisitor,
    convertValue,
    isVisitable
  });
  function build(value2, path) {
    if (utils$1.isUndefined(value2))
      return;
    if (stack.indexOf(value2) !== -1) {
      throw Error("Circular reference detected in " + path.join("."));
    }
    stack.push(value2);
    utils$1.forEach(value2, function each2(el2, key) {
      const result = !(utils$1.isUndefined(el2) || el2 === null) && visitor.call(
        formData,
        el2,
        utils$1.isString(key) ? key.trim() : key,
        path,
        exposedHelpers
      );
      if (result === true) {
        build(el2, path ? path.concat(key) : [key]);
      }
    });
    stack.pop();
  }
  if (!utils$1.isObject(obj)) {
    throw new TypeError("data must be an object");
  }
  build(obj);
  return formData;
}
function encode$1(str) {
  const charMap = {
    "!": "%21",
    "'": "%27",
    "(": "%28",
    ")": "%29",
    "~": "%7E",
    "%20": "+",
    "%00": "\0"
  };
  return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match5) {
    return charMap[match5];
  });
}
function AxiosURLSearchParams(params, options) {
  this._pairs = [];
  params && toFormData$1(params, this, options);
}
const prototype = AxiosURLSearchParams.prototype;
prototype.append = function append2(name2, value2) {
  this._pairs.push([name2, value2]);
};
prototype.toString = function toString2(encoder) {
  const _encode = encoder ? function(value2) {
    return encoder.call(this, value2, encode$1);
  } : encode$1;
  return this._pairs.map(function each2(pair) {
    return _encode(pair[0]) + "=" + _encode(pair[1]);
  }, "").join("&");
};
function encode(val) {
  return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
}
function buildURL(url2, params, options) {
  if (!params) {
    return url2;
  }
  const _encode = options && options.encode || encode;
  if (utils$1.isFunction(options)) {
    options = {
      serialize: options
    };
  }
  const serializeFn = options && options.serialize;
  let serializedParams;
  if (serializeFn) {
    serializedParams = serializeFn(params, options);
  } else {
    serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
  }
  if (serializedParams) {
    const hashmarkIndex = url2.indexOf("#");
    if (hashmarkIndex !== -1) {
      url2 = url2.slice(0, hashmarkIndex);
    }
    url2 += (url2.indexOf("?") === -1 ? "?" : "&") + serializedParams;
  }
  return url2;
}
class InterceptorManager {
  constructor() {
    this.handlers = [];
  }
  /**
   * Add a new interceptor to the stack
   *
   * @param {Function} fulfilled The function to handle `then` for a `Promise`
   * @param {Function} rejected The function to handle `reject` for a `Promise`
   *
   * @return {Number} An ID used to remove interceptor later
   */
  use(fulfilled, rejected, options) {
    this.handlers.push({
      fulfilled,
      rejected,
      synchronous: options ? options.synchronous : false,
      runWhen: options ? options.runWhen : null
    });
    return this.handlers.length - 1;
  }
  /**
   * Remove an interceptor from the stack
   *
   * @param {Number} id The ID that was returned by `use`
   *
   * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
   */
  eject(id2) {
    if (this.handlers[id2]) {
      this.handlers[id2] = null;
    }
  }
  /**
   * Clear all interceptors from the stack
   *
   * @returns {void}
   */
  clear() {
    if (this.handlers) {
      this.handlers = [];
    }
  }
  /**
   * Iterate over all the registered interceptors
   *
   * This method is particularly useful for skipping over any
   * interceptors that may have become `null` calling `eject`.
   *
   * @param {Function} fn The function to call for each interceptor
   *
   * @returns {void}
   */
  forEach(fn) {
    utils$1.forEach(this.handlers, function forEachHandler(h3) {
      if (h3 !== null) {
        fn(h3);
      }
    });
  }
}
const transitionalDefaults = {
  silentJSONParsing: true,
  forcedJSONParsing: true,
  clarifyTimeoutError: false
};
const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
const platform$1 = {
  isBrowser: true,
  classes: {
    URLSearchParams: URLSearchParams$1,
    FormData: FormData$1,
    Blob: Blob$1
  },
  protocols: ["http", "https", "file", "blob", "url", "data"]
};
const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
const _navigator = typeof navigator === "object" && navigator || void 0;
const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
const hasStandardBrowserWebWorkerEnv = (() => {
  return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
  self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
})();
const origin = hasBrowserEnv && window.location.href || "http://localhost";
const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  hasBrowserEnv,
  hasStandardBrowserEnv,
  hasStandardBrowserWebWorkerEnv,
  navigator: _navigator,
  origin
}, Symbol.toStringTag, { value: "Module" }));
const platform = {
  ...utils,
  ...platform$1
};
function toURLEncodedForm(data, options) {
  return toFormData$1(data, new platform.classes.URLSearchParams(), {
    visitor: function(value2, key, path, helpers) {
      if (platform.isNode && utils$1.isBuffer(value2)) {
        this.append(key, value2.toString("base64"));
        return false;
      }
      return helpers.defaultVisitor.apply(this, arguments);
    },
    ...options
  });
}
function parsePropPath(name2) {
  return utils$1.matchAll(/\w+|\[(\w*)]/g, name2).map((match5) => {
    return match5[0] === "[]" ? "" : match5[1] || match5[0];
  });
}
function arrayToObject(arr) {
  const obj = {};
  const keys2 = Object.keys(arr);
  let i2;
  const len = keys2.length;
  let key;
  for (i2 = 0; i2 < len; i2++) {
    key = keys2[i2];
    obj[key] = arr[key];
  }
  return obj;
}
function formDataToJSON(formData) {
  function buildPath(path, value2, target, index2) {
    let name2 = path[index2++];
    if (name2 === "__proto__")
      return true;
    const isNumericKey = Number.isFinite(+name2);
    const isLast = index2 >= path.length;
    name2 = !name2 && utils$1.isArray(target) ? target.length : name2;
    if (isLast) {
      if (utils$1.hasOwnProp(target, name2)) {
        target[name2] = [target[name2], value2];
      } else {
        target[name2] = value2;
      }
      return !isNumericKey;
    }
    if (!target[name2] || !utils$1.isObject(target[name2])) {
      target[name2] = [];
    }
    const result = buildPath(path, value2, target[name2], index2);
    if (result && utils$1.isArray(target[name2])) {
      target[name2] = arrayToObject(target[name2]);
    }
    return !isNumericKey;
  }
  if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
    const obj = {};
    utils$1.forEachEntry(formData, (name2, value2) => {
      buildPath(parsePropPath(name2), value2, obj, 0);
    });
    return obj;
  }
  return null;
}
function stringifySafely(rawValue, parser, encoder) {
  if (utils$1.isString(rawValue)) {
    try {
      (parser || JSON.parse)(rawValue);
      return utils$1.trim(rawValue);
    } catch (e2) {
      if (e2.name !== "SyntaxError") {
        throw e2;
      }
    }
  }
  return (encoder || JSON.stringify)(rawValue);
}
const defaults = {
  transitional: transitionalDefaults,
  adapter: ["xhr", "http", "fetch"],
  transformRequest: [function transformRequest(data, headers) {
    const contentType = headers.getContentType() || "";
    const hasJSONContentType = contentType.indexOf("application/json") > -1;
    const isObjectPayload = utils$1.isObject(data);
    if (isObjectPayload && utils$1.isHTMLForm(data)) {
      data = new FormData(data);
    }
    const isFormData2 = utils$1.isFormData(data);
    if (isFormData2) {
      return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
    }
    if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
      return data;
    }
    if (utils$1.isArrayBufferView(data)) {
      return data.buffer;
    }
    if (utils$1.isURLSearchParams(data)) {
      headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
      return data.toString();
    }
    let isFileList2;
    if (isObjectPayload) {
      if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
        return toURLEncodedForm(data, this.formSerializer).toString();
      }
      if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
        const _FormData = this.env && this.env.FormData;
        return toFormData$1(
          isFileList2 ? { "files[]": data } : data,
          _FormData && new _FormData(),
          this.formSerializer
        );
      }
    }
    if (isObjectPayload || hasJSONContentType) {
      headers.setContentType("application/json", false);
      return stringifySafely(data);
    }
    return data;
  }],
  transformResponse: [function transformResponse(data) {
    const transitional2 = this.transitional || defaults.transitional;
    const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
    const JSONRequested = this.responseType === "json";
    if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
      return data;
    }
    if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
      const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
      const strictJSONParsing = !silentJSONParsing && JSONRequested;
      try {
        return JSON.parse(data);
      } catch (e2) {
        if (strictJSONParsing) {
          if (e2.name === "SyntaxError") {
            throw AxiosError$1.from(e2, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
          }
          throw e2;
        }
      }
    }
    return data;
  }],
  /**
   * A timeout in milliseconds to abort a request. If set to 0 (default) a
   * timeout is not created.
   */
  timeout: 0,
  xsrfCookieName: "XSRF-TOKEN",
  xsrfHeaderName: "X-XSRF-TOKEN",
  maxContentLength: -1,
  maxBodyLength: -1,
  env: {
    FormData: platform.classes.FormData,
    Blob: platform.classes.Blob
  },
  validateStatus: function validateStatus(status) {
    return status >= 200 && status < 300;
  },
  headers: {
    common: {
      "Accept": "application/json, text/plain, */*",
      "Content-Type": void 0
    }
  }
};
utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method4) => {
  defaults.headers[method4] = {};
});
const ignoreDuplicateOf = utils$1.toObjectSet([
  "age",
  "authorization",
  "content-length",
  "content-type",
  "etag",
  "expires",
  "from",
  "host",
  "if-modified-since",
  "if-unmodified-since",
  "last-modified",
  "location",
  "max-forwards",
  "proxy-authorization",
  "referer",
  "retry-after",
  "user-agent"
]);
const parseHeaders = (rawHeaders) => {
  const parsed = {};
  let key;
  let val;
  let i2;
  rawHeaders && rawHeaders.split("\n").forEach(function parser(line2) {
    i2 = line2.indexOf(":");
    key = line2.substring(0, i2).trim().toLowerCase();
    val = line2.substring(i2 + 1).trim();
    if (!key || parsed[key] && ignoreDuplicateOf[key]) {
      return;
    }
    if (key === "set-cookie") {
      if (parsed[key]) {
        parsed[key].push(val);
      } else {
        parsed[key] = [val];
      }
    } else {
      parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
    }
  });
  return parsed;
};
const $internals = Symbol("internals");
function normalizeHeader(header) {
  return header && String(header).trim().toLowerCase();
}
function normalizeValue(value2) {
  if (value2 === false || value2 == null) {
    return value2;
  }
  return utils$1.isArray(value2) ? value2.map(normalizeValue) : String(value2);
}
function parseTokens(str) {
  const tokens2 = /* @__PURE__ */ Object.create(null);
  const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
  let match5;
  while (match5 = tokensRE.exec(str)) {
    tokens2[match5[1]] = match5[2];
  }
  return tokens2;
}
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
function matchHeaderValue(context, value2, header, filter3, isHeaderNameFilter) {
  if (utils$1.isFunction(filter3)) {
    return filter3.call(this, value2, header);
  }
  if (isHeaderNameFilter) {
    value2 = header;
  }
  if (!utils$1.isString(value2))
    return;
  if (utils$1.isString(filter3)) {
    return value2.indexOf(filter3) !== -1;
  }
  if (utils$1.isRegExp(filter3)) {
    return filter3.test(value2);
  }
}
function formatHeader(header) {
  return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w2, char2, str) => {
    return char2.toUpperCase() + str;
  });
}
function buildAccessors(obj, header) {
  const accessorName = utils$1.toCamelCase(" " + header);
  ["get", "set", "has"].forEach((methodName) => {
    Object.defineProperty(obj, methodName + accessorName, {
      value: function(arg1, arg2, arg3) {
        return this[methodName].call(this, header, arg1, arg2, arg3);
      },
      configurable: true
    });
  });
}
let AxiosHeaders$1 = class AxiosHeaders {
  constructor(headers) {
    headers && this.set(headers);
  }
  set(header, valueOrRewrite, rewrite) {
    const self2 = this;
    function setHeader(_value, _header, _rewrite) {
      const lHeader = normalizeHeader(_header);
      if (!lHeader) {
        throw new Error("header name must be a non-empty string");
      }
      const key = utils$1.findKey(self2, lHeader);
      if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
        self2[key || _header] = normalizeValue(_value);
      }
    }
    const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
    if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
      setHeaders(header, valueOrRewrite);
    } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
      setHeaders(parseHeaders(header), valueOrRewrite);
    } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
      let obj = {}, dest, key;
      for (const entry of header) {
        if (!utils$1.isArray(entry)) {
          throw TypeError("Object iterator must return a key-value pair");
        }
        obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
      }
      setHeaders(obj, valueOrRewrite);
    } else {
      header != null && setHeader(valueOrRewrite, header, rewrite);
    }
    return this;
  }
  get(header, parser) {
    header = normalizeHeader(header);
    if (header) {
      const key = utils$1.findKey(this, header);
      if (key) {
        const value2 = this[key];
        if (!parser) {
          return value2;
        }
        if (parser === true) {
          return parseTokens(value2);
        }
        if (utils$1.isFunction(parser)) {
          return parser.call(this, value2, key);
        }
        if (utils$1.isRegExp(parser)) {
          return parser.exec(value2);
        }
        throw new TypeError("parser must be boolean|regexp|function");
      }
    }
  }
  has(header, matcher) {
    header = normalizeHeader(header);
    if (header) {
      const key = utils$1.findKey(this, header);
      return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
    }
    return false;
  }
  delete(header, matcher) {
    const self2 = this;
    let deleted = false;
    function deleteHeader(_header) {
      _header = normalizeHeader(_header);
      if (_header) {
        const key = utils$1.findKey(self2, _header);
        if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
          delete self2[key];
          deleted = true;
        }
      }
    }
    if (utils$1.isArray(header)) {
      header.forEach(deleteHeader);
    } else {
      deleteHeader(header);
    }
    return deleted;
  }
  clear(matcher) {
    const keys2 = Object.keys(this);
    let i2 = keys2.length;
    let deleted = false;
    while (i2--) {
      const key = keys2[i2];
      if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
        delete this[key];
        deleted = true;
      }
    }
    return deleted;
  }
  normalize(format2) {
    const self2 = this;
    const headers = {};
    utils$1.forEach(this, (value2, header) => {
      const key = utils$1.findKey(headers, header);
      if (key) {
        self2[key] = normalizeValue(value2);
        delete self2[header];
        return;
      }
      const normalized = format2 ? formatHeader(header) : String(header).trim();
      if (normalized !== header) {
        delete self2[header];
      }
      self2[normalized] = normalizeValue(value2);
      headers[normalized] = true;
    });
    return this;
  }
  concat(...targets) {
    return this.constructor.concat(this, ...targets);
  }
  toJSON(asStrings) {
    const obj = /* @__PURE__ */ Object.create(null);
    utils$1.forEach(this, (value2, header) => {
      value2 != null && value2 !== false && (obj[header] = asStrings && utils$1.isArray(value2) ? value2.join(", ") : value2);
    });
    return obj;
  }
  [Symbol.iterator]() {
    return Object.entries(this.toJSON())[Symbol.iterator]();
  }
  toString() {
    return Object.entries(this.toJSON()).map(([header, value2]) => header + ": " + value2).join("\n");
  }
  getSetCookie() {
    return this.get("set-cookie") || [];
  }
  get [Symbol.toStringTag]() {
    return "AxiosHeaders";
  }
  static from(thing) {
    return thing instanceof this ? thing : new this(thing);
  }
  static concat(first, ...targets) {
    const computed = new this(first);
    targets.forEach((target) => computed.set(target));
    return computed;
  }
  static accessor(header) {
    const internals = this[$internals] = this[$internals] = {
      accessors: {}
    };
    const accessors = internals.accessors;
    const prototype2 = this.prototype;
    function defineAccessor(_header) {
      const lHeader = normalizeHeader(_header);
      if (!accessors[lHeader]) {
        buildAccessors(prototype2, _header);
        accessors[lHeader] = true;
      }
    }
    utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
    return this;
  }
};
AxiosHeaders$1.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value: value2 }, key) => {
  let mapped = key[0].toUpperCase() + key.slice(1);
  return {
    get: () => value2,
    set(headerValue) {
      this[mapped] = headerValue;
    }
  };
});
utils$1.freezeMethods(AxiosHeaders$1);
function transformData(fns, response) {
  const config2 = this || defaults;
  const context = response || config2;
  const headers = AxiosHeaders$1.from(context.headers);
  let data = context.data;
  utils$1.forEach(fns, function transform2(fn) {
    data = fn.call(config2, data, headers.normalize(), response ? response.status : void 0);
  });
  headers.normalize();
  return data;
}
function isCancel$1(value2) {
  return !!(value2 && value2.__CANCEL__);
}
function CanceledError$1(message, config2, request2) {
  AxiosError$1.call(this, message == null ? "canceled" : message, AxiosError$1.ERR_CANCELED, config2, request2);
  this.name = "CanceledError";
}
utils$1.inherits(CanceledError$1, AxiosError$1, {
  __CANCEL__: true
});
function settle(resolve2, reject, response) {
  const validateStatus2 = response.config.validateStatus;
  if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
    resolve2(response);
  } else {
    reject(new AxiosError$1(
      "Request failed with status code " + response.status,
      [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
      response.config,
      response.request,
      response
    ));
  }
}
function parseProtocol(url2) {
  const match5 = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url2);
  return match5 && match5[1] || "";
}
function speedometer(samplesCount, min2) {
  samplesCount = samplesCount || 10;
  const bytes = new Array(samplesCount);
  const timestamps = new Array(samplesCount);
  let head = 0;
  let tail = 0;
  let firstSampleTS;
  min2 = min2 !== void 0 ? min2 : 1e3;
  return function push2(chunkLength) {
    const now2 = Date.now();
    const startedAt = timestamps[tail];
    if (!firstSampleTS) {
      firstSampleTS = now2;
    }
    bytes[head] = chunkLength;
    timestamps[head] = now2;
    let i2 = tail;
    let bytesCount = 0;
    while (i2 !== head) {
      bytesCount += bytes[i2++];
      i2 = i2 % samplesCount;
    }
    head = (head + 1) % samplesCount;
    if (head === tail) {
      tail = (tail + 1) % samplesCount;
    }
    if (now2 - firstSampleTS < min2) {
      return;
    }
    const passed = startedAt && now2 - startedAt;
    return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
  };
}
function throttle(fn, freq) {
  let timestamp = 0;
  let threshold = 1e3 / freq;
  let lastArgs;
  let timer;
  const invoke = (args, now2 = Date.now()) => {
    timestamp = now2;
    lastArgs = null;
    if (timer) {
      clearTimeout(timer);
      timer = null;
    }
    fn(...args);
  };
  const throttled2 = (...args) => {
    const now2 = Date.now();
    const passed = now2 - timestamp;
    if (passed >= threshold) {
      invoke(args, now2);
    } else {
      lastArgs = args;
      if (!timer) {
        timer = setTimeout(() => {
          timer = null;
          invoke(lastArgs);
        }, threshold - passed);
      }
    }
  };
  const flush = () => lastArgs && invoke(lastArgs);
  return [throttled2, flush];
}
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
  let bytesNotified = 0;
  const _speedometer = speedometer(50, 250);
  return throttle((e2) => {
    const loaded = e2.loaded;
    const total = e2.lengthComputable ? e2.total : void 0;
    const progressBytes = loaded - bytesNotified;
    const rate = _speedometer(progressBytes);
    const inRange2 = loaded <= total;
    bytesNotified = loaded;
    const data = {
      loaded,
      total,
      progress: total ? loaded / total : void 0,
      bytes: progressBytes,
      rate: rate ? rate : void 0,
      estimated: rate && total && inRange2 ? (total - loaded) / rate : void 0,
      event: e2,
      lengthComputable: total != null,
      [isDownloadStream ? "download" : "upload"]: true
    };
    listener(data);
  }, freq);
};
const progressEventDecorator = (total, throttled2) => {
  const lengthComputable = total != null;
  return [(loaded) => throttled2[0]({
    lengthComputable,
    total,
    loaded
  }), throttled2[1]];
};
const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url2) => {
  url2 = new URL(url2, platform.origin);
  return origin2.protocol === url2.protocol && origin2.host === url2.host && (isMSIE || origin2.port === url2.port);
})(
  new URL(platform.origin),
  platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
) : () => true;
const cookies = platform.hasStandardBrowserEnv ? (
  // Standard browser envs support document.cookie
  {
    write(name2, value2, expires, path, domain, secure) {
      const cookie = [name2 + "=" + encodeURIComponent(value2)];
      utils$1.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
      utils$1.isString(path) && cookie.push("path=" + path);
      utils$1.isString(domain) && cookie.push("domain=" + domain);
      secure === true && cookie.push("secure");
      document.cookie = cookie.join("; ");
    },
    read(name2) {
      const match5 = document.cookie.match(new RegExp("(^|;\\s*)(" + name2 + ")=([^;]*)"));
      return match5 ? decodeURIComponent(match5[3]) : null;
    },
    remove(name2) {
      this.write(name2, "", Date.now() - 864e5);
    }
  }
) : (
  // Non-standard browser env (web workers, react-native) lack needed support.
  {
    write() {
    },
    read() {
      return null;
    },
    remove() {
    }
  }
);
function isAbsoluteURL(url2) {
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url2);
}
function combineURLs(baseURL, relativeURL) {
  return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
}
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
  if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
    return combineURLs(baseURL, requestedURL);
  }
  return requestedURL;
}
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
function mergeConfig$1(config1, config2) {
  config2 = config2 || {};
  const config3 = {};
  function getMergedValue(target, source2, prop, caseless) {
    if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source2)) {
      return utils$1.merge.call({ caseless }, target, source2);
    } else if (utils$1.isPlainObject(source2)) {
      return utils$1.merge({}, source2);
    } else if (utils$1.isArray(source2)) {
      return source2.slice();
    }
    return source2;
  }
  function mergeDeepProperties(a2, b2, prop, caseless) {
    if (!utils$1.isUndefined(b2)) {
      return getMergedValue(a2, b2, prop, caseless);
    } else if (!utils$1.isUndefined(a2)) {
      return getMergedValue(void 0, a2, prop, caseless);
    }
  }
  function valueFromConfig2(a2, b2) {
    if (!utils$1.isUndefined(b2)) {
      return getMergedValue(void 0, b2);
    }
  }
  function defaultToConfig2(a2, b2) {
    if (!utils$1.isUndefined(b2)) {
      return getMergedValue(void 0, b2);
    } else if (!utils$1.isUndefined(a2)) {
      return getMergedValue(void 0, a2);
    }
  }
  function mergeDirectKeys(a2, b2, prop) {
    if (prop in config2) {
      return getMergedValue(a2, b2);
    } else if (prop in config1) {
      return getMergedValue(void 0, a2);
    }
  }
  const mergeMap = {
    url: valueFromConfig2,
    method: valueFromConfig2,
    data: valueFromConfig2,
    baseURL: defaultToConfig2,
    transformRequest: defaultToConfig2,
    transformResponse: defaultToConfig2,
    paramsSerializer: defaultToConfig2,
    timeout: defaultToConfig2,
    timeoutMessage: defaultToConfig2,
    withCredentials: defaultToConfig2,
    withXSRFToken: defaultToConfig2,
    adapter: defaultToConfig2,
    responseType: defaultToConfig2,
    xsrfCookieName: defaultToConfig2,
    xsrfHeaderName: defaultToConfig2,
    onUploadProgress: defaultToConfig2,
    onDownloadProgress: defaultToConfig2,
    decompress: defaultToConfig2,
    maxContentLength: defaultToConfig2,
    maxBodyLength: defaultToConfig2,
    beforeRedirect: defaultToConfig2,
    transport: defaultToConfig2,
    httpAgent: defaultToConfig2,
    httpsAgent: defaultToConfig2,
    cancelToken: defaultToConfig2,
    socketPath: defaultToConfig2,
    responseEncoding: defaultToConfig2,
    validateStatus: mergeDirectKeys,
    headers: (a2, b2, prop) => mergeDeepProperties(headersToObject(a2), headersToObject(b2), prop, true)
  };
  utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
    const merge2 = mergeMap[prop] || mergeDeepProperties;
    const configValue = merge2(config1[prop], config2[prop], prop);
    utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config3[prop] = configValue);
  });
  return config3;
}
const resolveConfig = (config2) => {
  const newConfig = mergeConfig$1({}, config2);
  let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
  newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config2.params, config2.paramsSerializer);
  if (auth) {
    headers.set(
      "Authorization",
      "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
    );
  }
  let contentType;
  if (utils$1.isFormData(data)) {
    if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
      headers.setContentType(void 0);
    } else if ((contentType = headers.getContentType()) !== false) {
      const [type4, ...tokens2] = contentType ? contentType.split(";").map((token2) => token2.trim()).filter(Boolean) : [];
      headers.setContentType([type4 || "multipart/form-data", ...tokens2].join("; "));
    }
  }
  if (platform.hasStandardBrowserEnv) {
    withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
    if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
      const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
      if (xsrfValue) {
        headers.set(xsrfHeaderName, xsrfValue);
      }
    }
  }
  return newConfig;
};
const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
const xhrAdapter = isXHRAdapterSupported && function(config2) {
  return new Promise(function dispatchXhrRequest(resolve2, reject) {
    const _config = resolveConfig(config2);
    let requestData = _config.data;
    const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
    let { responseType, onUploadProgress, onDownloadProgress } = _config;
    let onCanceled;
    let uploadThrottled, downloadThrottled;
    let flushUpload, flushDownload;
    function done() {
      flushUpload && flushUpload();
      flushDownload && flushDownload();
      _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
      _config.signal && _config.signal.removeEventListener("abort", onCanceled);
    }
    let request2 = new XMLHttpRequest();
    request2.open(_config.method.toUpperCase(), _config.url, true);
    request2.timeout = _config.timeout;
    function onloadend() {
      if (!request2) {
        return;
      }
      const responseHeaders = AxiosHeaders$1.from(
        "getAllResponseHeaders" in request2 && request2.getAllResponseHeaders()
      );
      const responseData = !responseType || responseType === "text" || responseType === "json" ? request2.responseText : request2.response;
      const response = {
        data: responseData,
        status: request2.status,
        statusText: request2.statusText,
        headers: responseHeaders,
        config: config2,
        request: request2
      };
      settle(function _resolve2(value2) {
        resolve2(value2);
        done();
      }, function _reject(err) {
        reject(err);
        done();
      }, response);
      request2 = null;
    }
    if ("onloadend" in request2) {
      request2.onloadend = onloadend;
    } else {
      request2.onreadystatechange = function handleLoad() {
        if (!request2 || request2.readyState !== 4) {
          return;
        }
        if (request2.status === 0 && !(request2.responseURL && request2.responseURL.indexOf("file:") === 0)) {
          return;
        }
        setTimeout(onloadend);
      };
    }
    request2.onabort = function handleAbort() {
      if (!request2) {
        return;
      }
      reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config2, request2));
      request2 = null;
    };
    request2.onerror = function handleError() {
      reject(new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config2, request2));
      request2 = null;
    };
    request2.ontimeout = function handleTimeout() {
      let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
      const transitional2 = _config.transitional || transitionalDefaults;
      if (_config.timeoutErrorMessage) {
        timeoutErrorMessage = _config.timeoutErrorMessage;
      }
      reject(new AxiosError$1(
        timeoutErrorMessage,
        transitional2.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
        config2,
        request2
      ));
      request2 = null;
    };
    requestData === void 0 && requestHeaders.setContentType(null);
    if ("setRequestHeader" in request2) {
      utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
        request2.setRequestHeader(key, val);
      });
    }
    if (!utils$1.isUndefined(_config.withCredentials)) {
      request2.withCredentials = !!_config.withCredentials;
    }
    if (responseType && responseType !== "json") {
      request2.responseType = _config.responseType;
    }
    if (onDownloadProgress) {
      [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
      request2.addEventListener("progress", downloadThrottled);
    }
    if (onUploadProgress && request2.upload) {
      [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
      request2.upload.addEventListener("progress", uploadThrottled);
      request2.upload.addEventListener("loadend", flushUpload);
    }
    if (_config.cancelToken || _config.signal) {
      onCanceled = (cancel2) => {
        if (!request2) {
          return;
        }
        reject(!cancel2 || cancel2.type ? new CanceledError$1(null, config2, request2) : cancel2);
        request2.abort();
        request2 = null;
      };
      _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
      if (_config.signal) {
        _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
      }
    }
    const protocol = parseProtocol(_config.url);
    if (protocol && platform.protocols.indexOf(protocol) === -1) {
      reject(new AxiosError$1("Unsupported protocol " + protocol + ":", AxiosError$1.ERR_BAD_REQUEST, config2));
      return;
    }
    request2.send(requestData || null);
  });
};
const composeSignals = (signals, timeout) => {
  const { length: length2 } = signals = signals ? signals.filter(Boolean) : [];
  if (timeout || length2) {
    let controller = new AbortController();
    let aborted;
    const onabort = function(reason) {
      if (!aborted) {
        aborted = true;
        unsubscribe();
        const err = reason instanceof Error ? reason : this.reason;
        controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
      }
    };
    let timer = timeout && setTimeout(() => {
      timer = null;
      onabort(new AxiosError$1(`timeout ${timeout} of ms exceeded`, AxiosError$1.ETIMEDOUT));
    }, timeout);
    const unsubscribe = () => {
      if (signals) {
        timer && clearTimeout(timer);
        timer = null;
        signals.forEach((signal2) => {
          signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
        });
        signals = null;
      }
    };
    signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
    const { signal } = controller;
    signal.unsubscribe = () => utils$1.asap(unsubscribe);
    return signal;
  }
};
const streamChunk = function* (chunk, chunkSize) {
  let len = chunk.byteLength;
  if (len < chunkSize) {
    yield chunk;
    return;
  }
  let pos = 0;
  let end2;
  while (pos < len) {
    end2 = pos + chunkSize;
    yield chunk.slice(pos, end2);
    pos = end2;
  }
};
const readBytes = async function* (iterable, chunkSize) {
  for await (const chunk of readStream(iterable)) {
    yield* streamChunk(chunk, chunkSize);
  }
};
const readStream = async function* (stream) {
  if (stream[Symbol.asyncIterator]) {
    yield* stream;
    return;
  }
  const reader = stream.getReader();
  try {
    for (; ; ) {
      const { done, value: value2 } = await reader.read();
      if (done) {
        break;
      }
      yield value2;
    }
  } finally {
    await reader.cancel();
  }
};
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
  const iterator2 = readBytes(stream, chunkSize);
  let bytes = 0;
  let done;
  let _onFinish = (e2) => {
    if (!done) {
      done = true;
      onFinish && onFinish(e2);
    }
  };
  return new ReadableStream({
    async pull(controller) {
      try {
        const { done: done2, value: value2 } = await iterator2.next();
        if (done2) {
          _onFinish();
          controller.close();
          return;
        }
        let len = value2.byteLength;
        if (onProgress) {
          let loadedBytes = bytes += len;
          onProgress(loadedBytes);
        }
        controller.enqueue(new Uint8Array(value2));
      } catch (err) {
        _onFinish(err);
        throw err;
      }
    },
    cancel(reason) {
      _onFinish(reason);
      return iterator2.return();
    }
  }, {
    highWaterMark: 2
  });
};
const isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
const test = (fn, ...args) => {
  try {
    return !!fn(...args);
  } catch (e2) {
    return false;
  }
};
const supportsRequestStream = isReadableStreamSupported && test(() => {
  let duplexAccessed = false;
  const hasContentType = new Request(platform.origin, {
    body: new ReadableStream(),
    method: "POST",
    get duplex() {
      duplexAccessed = true;
      return "half";
    }
  }).headers.has("Content-Type");
  return duplexAccessed && !hasContentType;
});
const DEFAULT_CHUNK_SIZE = 64 * 1024;
const supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
const resolvers = {
  stream: supportsResponseStream && ((res) => res.body)
};
isFetchSupported && ((res) => {
  ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type4) => {
    !resolvers[type4] && (resolvers[type4] = utils$1.isFunction(res[type4]) ? (res2) => res2[type4]() : (_24, config2) => {
      throw new AxiosError$1(`Response type '${type4}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config2);
    });
  });
})(new Response());
const getBodyLength = async (body) => {
  if (body == null) {
    return 0;
  }
  if (utils$1.isBlob(body)) {
    return body.size;
  }
  if (utils$1.isSpecCompliantForm(body)) {
    const _request = new Request(platform.origin, {
      method: "POST",
      body
    });
    return (await _request.arrayBuffer()).byteLength;
  }
  if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
    return body.byteLength;
  }
  if (utils$1.isURLSearchParams(body)) {
    body = body + "";
  }
  if (utils$1.isString(body)) {
    return (await encodeText(body)).byteLength;
  }
};
const resolveBodyLength = async (headers, body) => {
  const length2 = utils$1.toFiniteNumber(headers.getContentLength());
  return length2 == null ? getBodyLength(body) : length2;
};
const fetchAdapter = isFetchSupported && (async (config2) => {
  let {
    url: url2,
    method: method4,
    data,
    signal,
    cancelToken,
    timeout,
    onDownloadProgress,
    onUploadProgress,
    responseType,
    headers,
    withCredentials = "same-origin",
    fetchOptions
  } = resolveConfig(config2);
  responseType = responseType ? (responseType + "").toLowerCase() : "text";
  let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
  let request2;
  const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
    composedSignal.unsubscribe();
  });
  let requestContentLength;
  try {
    if (onUploadProgress && supportsRequestStream && method4 !== "get" && method4 !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
      let _request = new Request(url2, {
        method: "POST",
        body: data,
        duplex: "half"
      });
      let contentTypeHeader;
      if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
        headers.setContentType(contentTypeHeader);
      }
      if (_request.body) {
        const [onProgress, flush] = progressEventDecorator(
          requestContentLength,
          progressEventReducer(asyncDecorator(onUploadProgress))
        );
        data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
      }
    }
    if (!utils$1.isString(withCredentials)) {
      withCredentials = withCredentials ? "include" : "omit";
    }
    const isCredentialsSupported = "credentials" in Request.prototype;
    request2 = new Request(url2, {
      ...fetchOptions,
      signal: composedSignal,
      method: method4.toUpperCase(),
      headers: headers.normalize().toJSON(),
      body: data,
      duplex: "half",
      credentials: isCredentialsSupported ? withCredentials : void 0
    });
    let response = await fetch(request2, fetchOptions);
    const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
    if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
      const options = {};
      ["status", "statusText", "headers"].forEach((prop) => {
        options[prop] = response[prop];
      });
      const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
      const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
        responseContentLength,
        progressEventReducer(asyncDecorator(onDownloadProgress), true)
      ) || [];
      response = new Response(
        trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
          flush && flush();
          unsubscribe && unsubscribe();
        }),
        options
      );
    }
    responseType = responseType || "text";
    let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config2);
    !isStreamResponse && unsubscribe && unsubscribe();
    return await new Promise((resolve2, reject) => {
      settle(resolve2, reject, {
        data: responseData,
        headers: AxiosHeaders$1.from(response.headers),
        status: response.status,
        statusText: response.statusText,
        config: config2,
        request: request2
      });
    });
  } catch (err) {
    unsubscribe && unsubscribe();
    if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
      throw Object.assign(
        new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config2, request2),
        {
          cause: err.cause || err
        }
      );
    }
    throw AxiosError$1.from(err, err && err.code, config2, request2);
  }
});
const knownAdapters = {
  http: httpAdapter,
  xhr: xhrAdapter,
  fetch: fetchAdapter
};
utils$1.forEach(knownAdapters, (fn, value2) => {
  if (fn) {
    try {
      Object.defineProperty(fn, "name", { value: value2 });
    } catch (e2) {
    }
    Object.defineProperty(fn, "adapterName", { value: value2 });
  }
});
const renderReason = (reason) => `- ${reason}`;
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
const adapters = {
  getAdapter: (adapters2) => {
    adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
    const { length: length2 } = adapters2;
    let nameOrAdapter;
    let adapter;
    const rejectedReasons = {};
    for (let i2 = 0; i2 < length2; i2++) {
      nameOrAdapter = adapters2[i2];
      let id2;
      adapter = nameOrAdapter;
      if (!isResolvedHandle(nameOrAdapter)) {
        adapter = knownAdapters[(id2 = String(nameOrAdapter)).toLowerCase()];
        if (adapter === void 0) {
          throw new AxiosError$1(`Unknown adapter '${id2}'`);
        }
      }
      if (adapter) {
        break;
      }
      rejectedReasons[id2 || "#" + i2] = adapter;
    }
    if (!adapter) {
      const reasons = Object.entries(rejectedReasons).map(
        ([id2, state]) => `adapter ${id2} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
      );
      let s2 = length2 ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
      throw new AxiosError$1(
        `There is no suitable adapter to dispatch the request ` + s2,
        "ERR_NOT_SUPPORT"
      );
    }
    return adapter;
  },
  adapters: knownAdapters
};
function throwIfCancellationRequested(config2) {
  if (config2.cancelToken) {
    config2.cancelToken.throwIfRequested();
  }
  if (config2.signal && config2.signal.aborted) {
    throw new CanceledError$1(null, config2);
  }
}
function dispatchRequest(config2) {
  throwIfCancellationRequested(config2);
  config2.headers = AxiosHeaders$1.from(config2.headers);
  config2.data = transformData.call(
    config2,
    config2.transformRequest
  );
  if (["post", "put", "patch"].indexOf(config2.method) !== -1) {
    config2.headers.setContentType("application/x-www-form-urlencoded", false);
  }
  const adapter = adapters.getAdapter(config2.adapter || defaults.adapter);
  return adapter(config2).then(function onAdapterResolution(response) {
    throwIfCancellationRequested(config2);
    response.data = transformData.call(
      config2,
      config2.transformResponse,
      response
    );
    response.headers = AxiosHeaders$1.from(response.headers);
    return response;
  }, function onAdapterRejection(reason) {
    if (!isCancel$1(reason)) {
      throwIfCancellationRequested(config2);
      if (reason && reason.response) {
        reason.response.data = transformData.call(
          config2,
          config2.transformResponse,
          reason.response
        );
        reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
      }
    }
    return Promise.reject(reason);
  });
}
const VERSION$1 = "1.11.0";
const validators$1 = {};
["object", "boolean", "number", "function", "string", "symbol"].forEach((type4, i2) => {
  validators$1[type4] = function validator2(thing) {
    return typeof thing === type4 || "a" + (i2 < 1 ? "n " : " ") + type4;
  };
});
const deprecatedWarnings = {};
validators$1.transitional = function transitional(validator2, version2, message) {
  function formatMessage(opt, desc) {
    return "[Axios v" + VERSION$1 + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
  }
  return (value2, opt, opts2) => {
    if (validator2 === false) {
      throw new AxiosError$1(
        formatMessage(opt, " has been removed" + (version2 ? " in " + version2 : "")),
        AxiosError$1.ERR_DEPRECATED
      );
    }
    if (version2 && !deprecatedWarnings[opt]) {
      deprecatedWarnings[opt] = true;
      console.warn(
        formatMessage(
          opt,
          " has been deprecated since v" + version2 + " and will be removed in the near future"
        )
      );
    }
    return validator2 ? validator2(value2, opt, opts2) : true;
  };
};
validators$1.spelling = function spelling(correctSpelling) {
  return (value2, opt) => {
    console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
    return true;
  };
};
function assertOptions(options, schema, allowUnknown) {
  if (typeof options !== "object") {
    throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
  }
  const keys2 = Object.keys(options);
  let i2 = keys2.length;
  while (i2-- > 0) {
    const opt = keys2[i2];
    const validator2 = schema[opt];
    if (validator2) {
      const value2 = options[opt];
      const result = value2 === void 0 || validator2(value2, opt, options);
      if (result !== true) {
        throw new AxiosError$1("option " + opt + " must be " + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
      }
      continue;
    }
    if (allowUnknown !== true) {
      throw new AxiosError$1("Unknown option " + opt, AxiosError$1.ERR_BAD_OPTION);
    }
  }
}
const validator = {
  assertOptions,
  validators: validators$1
};
const validators = validator.validators;
let Axios$1 = class Axios {
  constructor(instanceConfig) {
    this.defaults = instanceConfig || {};
    this.interceptors = {
      request: new InterceptorManager(),
      response: new InterceptorManager()
    };
  }
  /**
   * Dispatch a request
   *
   * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
   * @param {?Object} config
   *
   * @returns {Promise} The Promise to be fulfilled
   */
  async request(configOrUrl, config2) {
    try {
      return await this._request(configOrUrl, config2);
    } catch (err) {
      if (err instanceof Error) {
        let dummy = {};
        Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
        const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
        try {
          if (!err.stack) {
            err.stack = stack;
          } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
            err.stack += "\n" + stack;
          }
        } catch (e2) {
        }
      }
      throw err;
    }
  }
  _request(configOrUrl, config2) {
    if (typeof configOrUrl === "string") {
      config2 = config2 || {};
      config2.url = configOrUrl;
    } else {
      config2 = configOrUrl || {};
    }
    config2 = mergeConfig$1(this.defaults, config2);
    const { transitional: transitional2, paramsSerializer, headers } = config2;
    if (transitional2 !== void 0) {
      validator.assertOptions(transitional2, {
        silentJSONParsing: validators.transitional(validators.boolean),
        forcedJSONParsing: validators.transitional(validators.boolean),
        clarifyTimeoutError: validators.transitional(validators.boolean)
      }, false);
    }
    if (paramsSerializer != null) {
      if (utils$1.isFunction(paramsSerializer)) {
        config2.paramsSerializer = {
          serialize: paramsSerializer
        };
      } else {
        validator.assertOptions(paramsSerializer, {
          encode: validators.function,
          serialize: validators.function
        }, true);
      }
    }
    if (config2.allowAbsoluteUrls !== void 0)
      ;
    else if (this.defaults.allowAbsoluteUrls !== void 0) {
      config2.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
    } else {
      config2.allowAbsoluteUrls = true;
    }
    validator.assertOptions(config2, {
      baseUrl: validators.spelling("baseURL"),
      withXsrfToken: validators.spelling("withXSRFToken")
    }, true);
    config2.method = (config2.method || this.defaults.method || "get").toLowerCase();
    let contextHeaders = headers && utils$1.merge(
      headers.common,
      headers[config2.method]
    );
    headers && utils$1.forEach(
      ["delete", "get", "head", "post", "put", "patch", "common"],
      (method4) => {
        delete headers[method4];
      }
    );
    config2.headers = AxiosHeaders$1.concat(contextHeaders, headers);
    const requestInterceptorChain = [];
    let synchronousRequestInterceptors = true;
    this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
      if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config2) === false) {
        return;
      }
      synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
      requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
    });
    const responseInterceptorChain = [];
    this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
      responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
    });
    let promise;
    let i2 = 0;
    let len;
    if (!synchronousRequestInterceptors) {
      const chain2 = [dispatchRequest.bind(this), void 0];
      chain2.unshift(...requestInterceptorChain);
      chain2.push(...responseInterceptorChain);
      len = chain2.length;
      promise = Promise.resolve(config2);
      while (i2 < len) {
        promise = promise.then(chain2[i2++], chain2[i2++]);
      }
      return promise;
    }
    len = requestInterceptorChain.length;
    let newConfig = config2;
    i2 = 0;
    while (i2 < len) {
      const onFulfilled = requestInterceptorChain[i2++];
      const onRejected = requestInterceptorChain[i2++];
      try {
        newConfig = onFulfilled(newConfig);
      } catch (error2) {
        onRejected.call(this, error2);
        break;
      }
    }
    try {
      promise = dispatchRequest.call(this, newConfig);
    } catch (error2) {
      return Promise.reject(error2);
    }
    i2 = 0;
    len = responseInterceptorChain.length;
    while (i2 < len) {
      promise = promise.then(responseInterceptorChain[i2++], responseInterceptorChain[i2++]);
    }
    return promise;
  }
  getUri(config2) {
    config2 = mergeConfig$1(this.defaults, config2);
    const fullPath = buildFullPath(config2.baseURL, config2.url, config2.allowAbsoluteUrls);
    return buildURL(fullPath, config2.params, config2.paramsSerializer);
  }
};
utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method4) {
  Axios$1.prototype[method4] = function(url2, config2) {
    return this.request(mergeConfig$1(config2 || {}, {
      method: method4,
      url: url2,
      data: (config2 || {}).data
    }));
  };
});
utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method4) {
  function generateHTTPMethod(isForm) {
    return function httpMethod(url2, data, config2) {
      return this.request(mergeConfig$1(config2 || {}, {
        method: method4,
        headers: isForm ? {
          "Content-Type": "multipart/form-data"
        } : {},
        url: url2,
        data
      }));
    };
  }
  Axios$1.prototype[method4] = generateHTTPMethod();
  Axios$1.prototype[method4 + "Form"] = generateHTTPMethod(true);
});
let CancelToken$1 = class CancelToken {
  constructor(executor) {
    if (typeof executor !== "function") {
      throw new TypeError("executor must be a function.");
    }
    let resolvePromise;
    this.promise = new Promise(function promiseExecutor(resolve2) {
      resolvePromise = resolve2;
    });
    const token2 = this;
    this.promise.then((cancel2) => {
      if (!token2._listeners)
        return;
      let i2 = token2._listeners.length;
      while (i2-- > 0) {
        token2._listeners[i2](cancel2);
      }
      token2._listeners = null;
    });
    this.promise.then = (onfulfilled) => {
      let _resolve2;
      const promise = new Promise((resolve2) => {
        token2.subscribe(resolve2);
        _resolve2 = resolve2;
      }).then(onfulfilled);
      promise.cancel = function reject() {
        token2.unsubscribe(_resolve2);
      };
      return promise;
    };
    executor(function cancel2(message, config2, request2) {
      if (token2.reason) {
        return;
      }
      token2.reason = new CanceledError$1(message, config2, request2);
      resolvePromise(token2.reason);
    });
  }
  /**
   * Throws a `CanceledError` if cancellation has been requested.
   */
  throwIfRequested() {
    if (this.reason) {
      throw this.reason;
    }
  }
  /**
   * Subscribe to the cancel signal
   */
  subscribe(listener) {
    if (this.reason) {
      listener(this.reason);
      return;
    }
    if (this._listeners) {
      this._listeners.push(listener);
    } else {
      this._listeners = [listener];
    }
  }
  /**
   * Unsubscribe from the cancel signal
   */
  unsubscribe(listener) {
    if (!this._listeners) {
      return;
    }
    const index2 = this._listeners.indexOf(listener);
    if (index2 !== -1) {
      this._listeners.splice(index2, 1);
    }
  }
  toAbortSignal() {
    const controller = new AbortController();
    const abort = (err) => {
      controller.abort(err);
    };
    this.subscribe(abort);
    controller.signal.unsubscribe = () => this.unsubscribe(abort);
    return controller.signal;
  }
  /**
   * Returns an object that contains a new `CancelToken` and a function that, when called,
   * cancels the `CancelToken`.
   */
  static source() {
    let cancel2;
    const token2 = new CancelToken(function executor(c2) {
      cancel2 = c2;
    });
    return {
      token: token2,
      cancel: cancel2
    };
  }
};
function spread$1(callback2) {
  return function wrap2(arr) {
    return callback2.apply(null, arr);
  };
}
function isAxiosError$1(payload) {
  return utils$1.isObject(payload) && payload.isAxiosError === true;
}
const HttpStatusCode$1 = {
  Continue: 100,
  SwitchingProtocols: 101,
  Processing: 102,
  EarlyHints: 103,
  Ok: 200,
  Created: 201,
  Accepted: 202,
  NonAuthoritativeInformation: 203,
  NoContent: 204,
  ResetContent: 205,
  PartialContent: 206,
  MultiStatus: 207,
  AlreadyReported: 208,
  ImUsed: 226,
  MultipleChoices: 300,
  MovedPermanently: 301,
  Found: 302,
  SeeOther: 303,
  NotModified: 304,
  UseProxy: 305,
  Unused: 306,
  TemporaryRedirect: 307,
  PermanentRedirect: 308,
  BadRequest: 400,
  Unauthorized: 401,
  PaymentRequired: 402,
  Forbidden: 403,
  NotFound: 404,
  MethodNotAllowed: 405,
  NotAcceptable: 406,
  ProxyAuthenticationRequired: 407,
  RequestTimeout: 408,
  Conflict: 409,
  Gone: 410,
  LengthRequired: 411,
  PreconditionFailed: 412,
  PayloadTooLarge: 413,
  UriTooLong: 414,
  UnsupportedMediaType: 415,
  RangeNotSatisfiable: 416,
  ExpectationFailed: 417,
  ImATeapot: 418,
  MisdirectedRequest: 421,
  UnprocessableEntity: 422,
  Locked: 423,
  FailedDependency: 424,
  TooEarly: 425,
  UpgradeRequired: 426,
  PreconditionRequired: 428,
  TooManyRequests: 429,
  RequestHeaderFieldsTooLarge: 431,
  UnavailableForLegalReasons: 451,
  InternalServerError: 500,
  NotImplemented: 501,
  BadGateway: 502,
  ServiceUnavailable: 503,
  GatewayTimeout: 504,
  HttpVersionNotSupported: 505,
  VariantAlsoNegotiates: 506,
  InsufficientStorage: 507,
  LoopDetected: 508,
  NotExtended: 510,
  NetworkAuthenticationRequired: 511
};
Object.entries(HttpStatusCode$1).forEach(([key, value2]) => {
  HttpStatusCode$1[value2] = key;
});
function createInstance(defaultConfig2) {
  const context = new Axios$1(defaultConfig2);
  const instance2 = bind(Axios$1.prototype.request, context);
  utils$1.extend(instance2, Axios$1.prototype, context, { allOwnKeys: true });
  utils$1.extend(instance2, context, null, { allOwnKeys: true });
  instance2.create = function create2(instanceConfig) {
    return createInstance(mergeConfig$1(defaultConfig2, instanceConfig));
  };
  return instance2;
}
const axios = createInstance(defaults);
axios.Axios = Axios$1;
axios.CanceledError = CanceledError$1;
axios.CancelToken = CancelToken$1;
axios.isCancel = isCancel$1;
axios.VERSION = VERSION$1;
axios.toFormData = toFormData$1;
axios.AxiosError = AxiosError$1;
axios.Cancel = axios.CanceledError;
axios.all = function all(promises) {
  return Promise.all(promises);
};
axios.spread = spread$1;
axios.isAxiosError = isAxiosError$1;
axios.mergeConfig = mergeConfig$1;
axios.AxiosHeaders = AxiosHeaders$1;
axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
axios.getAdapter = adapters.getAdapter;
axios.HttpStatusCode = HttpStatusCode$1;
axios.default = axios;
const {
  Axios: Axios2,
  AxiosError,
  CanceledError,
  isCancel,
  CancelToken: CancelToken2,
  VERSION,
  all: all$1,
  Cancel,
  isAxiosError,
  spread,
  toFormData,
  AxiosHeaders: AxiosHeaders2,
  HttpStatusCode,
  formToJSON,
  getAdapter,
  mergeConfig
} = axios;
const ColorPicker = ({
  color: propColor,
  onChange = (hex3) => {
  },
  panelOffset = { top: 0, left: "60px" }
}) => {
  const [color2, setColor] = reactExports.useState(propColor);
  const [colorPickerVisible, setColorPickerVisible] = reactExports.useState(false);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { position: "relative", width: 26, height: 26 }, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        style: {
          padding: "5px",
          background: "#fff",
          borderRadius: "1px",
          boxShadow: "0 0 0 1px rgba(0,0,0,.1)",
          display: "inline-block",
          cursor: "pointer"
        },
        onClick: () => setColorPickerVisible(true),
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            style: {
              width: "16px",
              height: "16px",
              borderRadius: "2px",
              background: color2
            }
          }
        )
      }
    ),
    colorPickerVisible ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { position: "absolute", ...panelOffset, zIndex: "20" }, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        "div",
        {
          style: {
            position: "fixed",
            top: "0px",
            right: "0px",
            bottom: "0px",
            left: "0px"
          },
          onClick: () => setColorPickerVisible(false)
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        SketchPicker,
        {
          color: { hex: color2 },
          onChange: (v2) => {
            setColor(v2.hex);
            onChange(v2.hex);
          }
        }
      )
    ] }) : null
  ] });
};
ColorPicker.displayName = "ColorPicker";
const TextReader = (props) => {
  var _a2;
  const { file, style: style2 = {}, onLoad, className } = props;
  const [previewData, setPreviewData] = reactExports.useState();
  const [fontSize, setFontSize] = reactExports.useState(14);
  const [background, setBackground] = reactExports.useState("white");
  const [color2, setColor] = reactExports.useState("black");
  const [colorPickerVisible, setColorPickerVisible] = reactExports.useState(false);
  reactExports.useEffect(() => {
    if (file) {
      axios.request({
        url: `${envConfig.apiEndpoint}/file/play?fullname=${encodeURIComponent(file)}`
      }).then((a2) => {
        if (a2.status == 200) {
          const text2 = a2.data;
          const pd2 = {
            title: getFileNameWithoutExtension(file),
            paragraphs: void 0
          };
          const paragraphs = text2 == null ? void 0 : text2.split("\n").map((x2) => x2.trim()).filter((b2) => (b2 == null ? void 0 : b2.length) > 0);
          if ((paragraphs == null ? void 0 : paragraphs.length) > 0) {
            pd2.paragraphs = paragraphs;
          }
          setPreviewData(pd2);
        }
      });
    } else {
      onLoad();
    }
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: `text-reader ${className || ""}`,
      style: { ...style2, background, color: color2 },
      onLoad,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "configurations", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label", children: instance.t("Font size") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "value", children: /* @__PURE__ */ jsxRuntimeExports.jsx(number_input_default, { value: fontSize, onChange: (v2) => setFontSize(v2) }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label", children: instance.t("Font color") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "value", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ColorPicker, { color: color2, onChange: (v2) => setColor(v2) }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label", children: instance.t("Background color") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "value", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ColorPicker, { color: background, onChange: (v2) => setBackground(v2) }) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "content", children: [
          (previewData == null ? void 0 : previewData.title) && /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { children: previewData.title }),
          ((_a2 = previewData == null ? void 0 : previewData.sections) == null ? void 0 : _a2.map((s2, i2) => {
            var _a3;
            return /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: `s-${i2}`, children: [
              s2.title && /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { children: s2.title }),
              (_a3 = s2.paragraphs) == null ? void 0 : _a3.map((p2, j2) => {
                return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `p-${j2}`, style: { fontSize }, children: p2 });
              })
            ] });
          })) || /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-content", children: instance.t("No content") })
        ] })
      ]
    }
  );
};
TextReader.displayName = "TextReader";
({
  maxWidth: document.body.clientWidth * 0.9,
  maxHeight: document.body.clientHeight * 0.9,
  width: document.body.clientHeight * 0.9,
  height: document.body.clientHeight * 0.9
});
const compressedFileExtensions = ["rar", "zip", "7z"];
let Node$1 = class Node2 {
  constructor() {
    __publicField(this, "label");
    __publicField(this, "children", []);
    __publicField(this, "key");
    __publicField(this, "parent");
    __publicField(this, "type");
    __publicField(this, "isCompressedFileContent");
    __publicField(this, "startSeconds");
    __publicField(this, "endSeconds");
    /**
     * Compressed file contents will be scanned only once whether it is scanned successfully or not unless we cancelled it manually.
     */
    __publicField(this, "loadingInfoAsync");
  }
  get playable() {
    return this.type == "file" || this.type == "compressed-file" && !this.isCompressedFileContent;
  }
};
function compressTree(node2) {
  if (node2.children.length == 1 && node2.children[0].type == "directory") {
    const child = node2.children[0];
    node2.type = child.children.length > 0 ? "directory" : getFileType(child.key);
    node2.label = node2.label ? `${node2.label}${BusinessConstants.pathSeparator}${child.label}` : child.label;
    node2.key = child.key;
    node2.children = child.children;
    node2.startSeconds = child.startSeconds;
    node2.endSeconds = child.endSeconds;
    compressTree(node2);
  } else {
    if (node2.children.length > 1) {
      for (const child of node2.children) {
        compressTree(child);
      }
    }
  }
}
const buildNodeKey = (path, compressedFileKey) => {
  return compressedFileKey ? `${compressedFileKey}!${path}` : path;
};
function buildNodeMap(nodes) {
  const data = {};
  for (const node2 of nodes) {
    data[node2.key] = node2;
    if (node2.children.length > 0) {
      Object.assign(data, buildNodeMap(node2.children));
    }
  }
  return data;
}
function getFileType(path) {
  const ext = path.split(".").pop();
  if (ext) {
    if (compressedFileExtensions.includes(ext)) {
      return "compressed-file";
    }
  }
  return "file";
}
function buildBranches(propsEntries, compressedFileNode) {
  const root2 = new Node$1();
  for (const pe2 of propsEntries) {
    const { path } = pe2;
    const segments = splitPathIntoSegments(path);
    let node2 = root2;
    let currentPath = "";
    for (let i2 = 0; i2 < segments.length; i2++) {
      const segment = segments[i2];
      if (currentPath) {
        currentPath += BusinessConstants.pathSeparator;
      }
      currentPath += segment;
      let child = node2.children.find((a2) => a2.label == segment);
      if (!child) {
        child = new Node$1();
        const key = buildNodeKey(currentPath, compressedFileNode == null ? void 0 : compressedFileNode.key);
        child.label = segment;
        child.key = key;
        if (i2 == segments.length - 1) {
          child.type = "unknown";
          if (pe2.startTime) {
            child.startSeconds = hooks.duration(pe2.startTime).asSeconds();
          }
          if (pe2.endTime) {
            child.endSeconds = hooks.duration(pe2.endTime).asSeconds();
          }
        } else {
          child.type = "directory";
        }
        child.isCompressedFileContent = !!compressedFileNode;
        child.parent = node2;
        node2.children.push(child);
      }
      node2 = child;
    }
  }
  for (const node2 of root2.children) {
    compressTree(node2);
  }
  return root2.children;
}
function expandTreeToLeaves(node2) {
  if (node2.children.length == 0) {
    return [node2];
  } else {
    const result = [];
    for (const child of node2.children) {
      result.push(...expandTreeToLeaves(child));
    }
    return result;
  }
}
const MediaPlayer = (props) => {
  const {
    defaultActiveIndex = 0,
    files: propFiles = [],
    interval = 1e3,
    afterClose = () => {
    },
    renderOperations = () => {
    },
    autoPlay = false,
    ...otherProps
  } = props;
  useTraceUpdate(props, "[MediaPlayer]");
  const { t: t2 } = useTranslation();
  const forceUpdate = useUpdate();
  const log3 = buildLogger("MediaPlayer");
  const [visible, setVisible] = reactExports.useState(true);
  const imageRef = reactExports.useRef(null);
  const [fileTree, setFileTree] = reactExports.useState();
  const fileTreeRef = reactExports.useRef(fileTree);
  const nodeMapRef = reactExports.useRef({});
  const videoSizeRef = reactExports.useRef();
  const mediaContainerRef = reactExports.useRef(null);
  const [extensionsMediaTypes, setExtensionsMediaTypes] = reactExports.useState(/* @__PURE__ */ new Map());
  const [playing, setPlaying] = reactExports.useState(autoPlay);
  const playerRef = reactExports.useRef(null);
  const [progress2, setProgress] = reactExports.useState(0);
  const progressRef = reactExports.useRef(0);
  const progressIntervalRef = reactExports.useRef();
  const activeDtRef = reactExports.useRef();
  const autoGoToNextHandleRef = reactExports.useRef();
  const [fileListVisible, setFileListVisible] = reactExports.useState(false);
  const [treeLeaves, setTreeLeaves] = reactExports.useState([]);
  const [activeIndex, setActiveIndex] = reactExports.useState(defaultActiveIndex);
  const activeNode = treeLeaves[activeIndex];
  const compressedFileEntriesRequestQueueRef = reactExports.useRef(
    new Queue({
      concurrency: 5,
      autostart: true
    })
  );
  useUpdateEffect(() => {
    fileTreeRef.current = fileTree;
    setTreeLeaves(fileTree ? expandTreeToLeaves(fileTree) : []);
  }, [fileTree]);
  useUpdateEffect(() => {
    log3("treeLeaves changed", treeLeaves);
  }, [treeLeaves]);
  const [currentInitialized, setCurrentInitialized] = reactExports.useState(false);
  useUpdateEffect(() => {
    progressRef.current = progress2;
  }, [progress2]);
  reactExports.useEffect(() => {
  }, [fileListVisible]);
  reactExports.useEffect(() => {
    const branches = buildBranches(propFiles);
    const tree = new Node$1();
    tree.children = branches;
    setFileTree(tree);
    nodeMapRef.current = buildNodeMap(branches);
    BApi$1.api.getAllExtensionMediaTypes().then((t22) => {
      const map2 = Object.keys(t22.data).reduce((s2, ext) => {
        s2[ext] = t22.data[ext];
        return s2;
      }, /* @__PURE__ */ new Map());
      setExtensionsMediaTypes(map2);
      console.log("[MediaPlayer]Extension-Media-Type initialized", map2);
    });
    return () => {
      console.log("unmounting");
      clearProgressHandler();
    };
  }, []);
  const getMediaType = reactExports.useCallback(
    (file) => {
      const segments = file.split(".");
      if (segments.length == 1) {
        return MediaType.Unknown;
      } else {
        return extensionsMediaTypes[`.${segments[segments.length - 1]}`] ?? MediaType.Unknown;
      }
    },
    [extensionsMediaTypes]
  );
  const gotoPrevNode = reactExports.useCallback(() => {
    if (activeIndex > 0) {
      setActiveIndex(activeIndex - 1);
    }
  }, [activeIndex, treeLeaves]);
  const gotoNextNode = reactExports.useCallback(() => {
    if (activeIndex < treeLeaves.length - 1) {
      setActiveIndex(activeIndex + 1);
    }
  }, [activeIndex, treeLeaves]);
  const clearProgressHandler = () => {
    clearInterval(progressIntervalRef.current);
    clearTimeout(autoGoToNextHandleRef.current);
  };
  useUpdateEffect(() => {
    console.log("current initialized", currentInitialized);
  }, [currentInitialized]);
  reactExports.useEffect(() => {
    setPlaying(autoPlay);
    setProgress(0);
    setCurrentInitialized(false);
    clearProgressHandler();
  }, [activeNode]);
  const close = () => {
    setVisible(false);
    afterClose();
  };
  const tryAutoGotoNextNode = () => {
    if (autoPlay) {
      clearProgressHandler();
      activeDtRef.current = /* @__PURE__ */ new Date();
      progressIntervalRef.current = setInterval(() => {
        const raw = ((/* @__PURE__ */ new Date()).getTime() - activeDtRef.current.getTime()) / interval * 100;
        const percentage = Math.floor(raw);
        if (percentage != progressRef.current) {
          setProgress(percentage);
        }
      }, 100);
      autoGoToNextHandleRef.current = setTimeout(
        () => {
          gotoNextNode();
        },
        Math.max(interval, 1e3)
      );
    }
  };
  const renderMedia = () => {
    var _a2, _b2;
    if (!activeNode) {
      return;
    }
    const type4 = getMediaType(activeNode.key);
    switch (type4) {
      case MediaType.Audio:
      case MediaType.Video:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          src_default,
          {
            ref: (player) => {
              playerRef.current = player;
            },
            controls: true,
            className: "media",
            config: {
              file: {
                attributes: {
                  crossOrigin: "anonymous"
                }
              }
            },
            height: (_a2 = videoSizeRef.current) == null ? void 0 : _a2.height,
            playing,
            url: `${envConfig.apiEndpoint}/file/play?fullname=${encodeURIComponent(activeNode.key)}`,
            width: (_b2 = videoSizeRef.current) == null ? void 0 : _b2.width,
            onDuration: (d2) => {
            },
            onEnded: () => {
              tryAutoGotoNextNode();
            },
            onPause: () => {
              log3("Video pause");
              setPlaying(false);
            },
            onPlay: () => {
              log3("Video play");
              setPlaying(true);
            },
            onProgress: ({ played, playedSeconds, loaded, loadedSeconds }) => {
              if (activeNode.endSeconds && playedSeconds > activeNode.endSeconds) {
                tryAutoGotoNextNode();
              }
            },
            onReady: (reactPlayer) => {
              const internalPlayer = reactPlayer.getInternalPlayer();
              const width = internalPlayer.videoWidth;
              const height = internalPlayer.videoHeight;
              if (width > 0 && height > 0) {
                videoSizeRef.current = {
                  width: Math.min(
                    width,
                    mediaContainerRef.current.clientWidth
                  ),
                  height: Math.min(
                    height,
                    mediaContainerRef.current.clientHeight
                  )
                };
              }
              log3("Video ready", reactPlayer, `${width}x${height}`);
              setCurrentInitialized(true);
            },
            onSeek: () => {
              log3("Video seek");
            },
            onStart: () => {
              log3("Video start");
              if (activeNode.startSeconds) {
                playerRef.current.seekTo(activeNode.startSeconds);
              }
            }
          }
        );
      case MediaType.Image:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          "img",
          {
            ref: imageRef,
            className: "media",
            crossOrigin: "anonymous",
            src: `${envConfig.apiEndpoint}/file/play?fullname=${encodeURIComponent(activeNode.key)}`,
            onLoad: () => {
              setCurrentInitialized(true);
              tryAutoGotoNextNode();
            }
          }
        );
      case MediaType.Text:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          TextReader,
          {
            className: "media",
            file: activeNode.key,
            style: { padding: "20px" },
            onLoad: () => {
              setCurrentInitialized(true);
              tryAutoGotoNextNode();
            }
          }
        );
      default:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: "unsupported media",
            onLoad: () => {
              setCurrentInitialized(true);
              tryAutoGotoNextNode();
            },
            children: t2("Unsupported")
          }
        );
    }
  };
  const renderFile = (path) => {
    const compressedFileInnerFileSeparator = "!";
    const tmpSegments = path.split(compressedFileInnerFileSeparator);
    const segments = [];
    for (let i2 = 0; i2 < tmpSegments.length; i2++) {
      const s2 = tmpSegments[i2];
      if (!compressedFileExtensions.some((e2) => s2.endsWith(e2))) {
        const inner = tmpSegments[i2 + 1];
        segments.push(
          inner ? `${s2}${compressedFileInnerFileSeparator}${inner}` : s2
        );
        i2++;
      } else {
        segments.push(s2);
      }
    }
    let mainPath;
    let subPath;
    if (segments.length > 0) {
      mainPath = segments[0];
    }
    if (segments.length > 1) {
      subPath = segments[1];
    }
    if (segments.length > 2) {
      return `Unsupported path: ${path}`;
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "file", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "icon", children: /* @__PURE__ */ jsxRuntimeExports.jsx(FileSystemEntryIcon, { path, type: IconType.Dynamic }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "path", children: [
        mainPath,
        subPath && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(MdInventory, { size: "small" }),
          subPath
        ] })
      ] })
    ] });
  };
  const clearIceTreeMark = reactExports.useCallback((node2) => {
    delete node2["pos"];
    delete node2["isLeaf"];
    delete node2["isLastChild"];
    delete node2["level"];
    if (node2.children.length > 0) {
      node2.children.forEach(clearIceTreeMark);
    }
  }, []);
  const onNodeLoaded = reactExports.useCallback(async (node2) => {
    const skipCheckingContents = node2.loadingInfoAsync || node2.isCompressedFileContent || node2.children.length > 0;
    if (node2.type != "unknown" && skipCheckingContents) {
      return;
    } else {
      compressedFileEntriesRequestQueueRef.current.push(async () => {
        const cts = new AbortController();
        node2.loadingInfoAsync = cts;
        if (node2.type == "unknown") {
          log3("Loading info for", node2.key);
          const infoRsp = await BApi$1.file.getIwFsEntry({ path: node2.key });
          const info2 = infoRsp.data;
          if (info2) {
            if (info2.type == IwFsType.Directory) {
              node2.type = "directory";
            } else {
              const ext = node2.key.split(".").pop();
              if (ext && compressedFileExtensions.includes(ext)) {
                node2.type = "compressed-file";
              } else {
                node2.type = "file";
              }
            }
          }
        }
        if (!skipCheckingContents && node2.type == "compressed-file") {
          log3("Loading compressed file entries for", node2.key);
          const rsp = await BApi$1.file.getCompressedFileEntries(
            { compressedFilePath: node2.key },
            { signal: cts.signal }
          );
          const files = rsp.data || [];
          log3("Compressed file entries loaded", node2.key, files.length);
          if (files.length > 0) {
            const subTrees = buildBranches(
              files.map((f2) => ({ path: f2.path })),
              node2
            );
            const newNodeMap = buildNodeMap(subTrees);
            Object.assign(nodeMapRef.current, newNodeMap);
            node2.children = subTrees;
            clearIceTreeMark(fileTreeRef.current);
          }
        }
        forceUpdate();
      });
    }
  }, []);
  log3("Rendering", treeLeaves, activeIndex, activeNode);
  if (visible) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        className: "media-player",
        onClick: (e2) => {
        },
        onDoubleClick: (e2) => {
          console.log("[MediaPlayer]Double clicked");
          e2.stopPropagation();
          e2.preventDefault();
        },
        onKeyDown: (e2) => {
          console.log(e2, e2.key);
          switch (e2.key) {
            case "ArrowLeft":
              gotoPrevNode();
              break;
            case "ArrowRight":
              gotoNextNode();
              break;
            case "F5":
            case "R": {
              if (e2.ctrlKey) {
                return;
              }
              break;
            }
            case "Escape": {
              close();
              return;
            }
          }
          e2.stopPropagation();
          e2.preventDefault();
        },
        ...otherProps,
        ref: (r2) => forceFocus(r2),
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: fileListVisible ? /* @__PURE__ */ jsxRuntimeExports.jsx(
            Drawer,
            {
              visible: true,
              placement: "left",
              style: { zIndex: 1005 },
              width: 400,
              onClose: () => setFileListVisible(false),
              children: fileTree && /* @__PURE__ */ jsxRuntimeExports.jsx(
                Tree,
                {
                  isLabelBlock: true,
                  showLine: true,
                  useVirtual: true,
                  dataSource: fileTree.children,
                  expandedKeys: Object.keys(nodeMapRef.current),
                  labelRender: (iceNode) => {
                    const { label, key } = iceNode;
                    const data = nodeMapRef.current[key];
                    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                      "div",
                      {
                        ref: (r2) => {
                          if (r2) {
                            onNodeLoaded(data);
                          } else {
                            log3("Unloading", data.key);
                          }
                        },
                        style: {
                          width: 200,
                          whiteSpace: "nowrap",
                          overflow: "hidden",
                          textOverflow: "ellipsis",
                          display: "flex",
                          alignItems: "center",
                          gap: 5
                        },
                        title: label,
                        children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx(
                            FileSystemEntryIcon,
                            {
                              path: data.key,
                              size: 20,
                              type: data.type == "directory" ? IconType.Directory : IconType.Dynamic
                            }
                          ),
                          /* @__PURE__ */ jsxRuntimeExports.jsx(
                            "span",
                            {
                              style: {
                                whiteSpace: "nowrap",
                                overflow: "hidden",
                                textOverflow: "ellipsis"
                              },
                              children: label
                            }
                          )
                        ]
                      },
                      data.key
                    );
                  },
                  style: {
                    maxHeight: "90vh",
                    overflow: "auto"
                  }
                }
              )
            }
          ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: "file-list-portal",
              onClick: () => {
                setFileListVisible(true);
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { size: "xl", type: "list" })
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            "div",
            {
              ref: (r2) => mediaContainerRef.current = r2,
              className: "media-container",
              tabIndex: 0,
              onClick: () => {
                console.log("container clicked");
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  "div",
                  {
                    className: "mask",
                    onClick: () => {
                      console.log("mask clicked");
                      if (fileListVisible) {
                        setFileListVisible(false);
                      } else {
                        close();
                      }
                    }
                  }
                ),
                renderMedia()
              ]
            }
          ),
          activeNode && /* @__PURE__ */ jsxRuntimeExports.jsxs(
            "div",
            {
              className: "label",
              onClick: () => {
                console.log("label clicked");
              },
              children: [
                renderFile(activeNode.key),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
                  "(",
                  treeLeaves.indexOf(activeNode) + 1,
                  " / ",
                  treeLeaves.length,
                  ")"
                ] }),
                renderOperations && currentInitialized && renderOperations(
                  activeNode.key,
                  getMediaType(activeNode.key),
                  playing,
                  playerRef.current,
                  imageRef.current
                )
              ]
            }
          ),
          autoPlay && progress2 && /* @__PURE__ */ jsxRuntimeExports.jsx(progress_default, { percent: progress2, size: "small", textRender: () => "" }),
          activeIndex > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "left", onClick: gotoPrevNode, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { size: "xl", type: "arrow-left" }) }),
          activeIndex < treeLeaves.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "right", onClick: gotoNextNode, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { size: "xl", type: "arrow-right" }) })
        ]
      }
    );
  }
  return null;
};
MediaPlayer.show = (props) => createPortalOfComponent(MediaPlayer, props);
const TailingOperations = (props) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const { entry, capabilities } = props;
  const isExtractable = (capabilities == null ? void 0 : capabilities.includes("extract")) && entry.isDirectory && entry.childrenCount && entry.childrenCount > 0;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      OperationButton,
      {
        isIconOnly: true,
        onClick: (e2) => {
          e2.stopPropagation();
          BApi$1.tool.openFileOrDirectory({
            path: entry.path,
            openInDirectory: entry.type != IwFsType.Directory
          });
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$G, { className: "text-base" })
      }
    ),
    isExtractable && /* @__PURE__ */ jsxRuntimeExports.jsx(
      Tooltip$1,
      {
        content: `(E)${t2("Extract children to parent and delete current directory")}`,
        placement: "top",
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            className: "w-auto h-auto p-1 min-w-fit opacity-60 hover:opacity-100",
            variant: "light",
            onClick: (e2) => {
              e2.stopPropagation();
              createPortal(ExtractModal, {
                entries: [entry]
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$2, { className: "text-base" })
          }
        )
      }
    ),
    entry.isDirectoryOrDrive && /* @__PURE__ */ jsxRuntimeExports.jsx(
      OperationButton,
      {
        isIconOnly: true,
        onClick: (e2) => {
          var _a2;
          (_a2 = entry.ref) == null ? void 0 : _a2.expand(true);
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$7, { className: "text-base" })
      }
    )
  ] });
};
TailingOperations.displayName = "TailingOperations";
const LeftIcon = ({ loading, entry, expandable }) => {
  const renderInner = reactExports.useCallback(() => {
    if (loading) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1i, { className: "text-base" });
    } else {
      switch (entry.status) {
        case EntryStatus.Default:
          if (expandable && entry.expandable) {
            if (entry.expanded) {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                OperationButton,
                {
                  isIconOnly: true,
                  onClick: (e2) => {
                    var _a2;
                    (_a2 = entry.ref) == null ? void 0 : _a2.collapse();
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$t, { className: "text-large" })
                }
              );
            } else {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                OperationButton,
                {
                  isIconOnly: true,
                  onClick: (e2) => {
                    var _a2;
                    (_a2 = entry.ref) == null ? void 0 : _a2.expand();
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$l, { className: "text-large" })
                }
              );
            }
          }
          break;
        case EntryStatus.Loading:
          break;
        case EntryStatus.Error:
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            Tooltip$1,
            {
              content: /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { style: { color: "red" }, children: Object.keys(entry.errors).map((e2) => {
                return /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: entry.errors[e2] }, e2);
              }) }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "danger", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon, { className: "text-base" }) })
            }
          );
      }
    }
    return null;
  }, [entry, loading, expandable]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "item", children: renderInner() });
};
LeftIcon.displayName = "LeftIcon";
const BTaskStopButton = (props) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const stop = async () => {
    const rsp = await BApi$1.backgroundTask.stopBackgroundTask(props.id, {
      confirm: false
    });
    if (rsp.code == 202) {
      createPortal(Modal, {
        defaultVisible: true,
        title: t2("Stop Task"),
        children: rsp.message ?? t2("Sure to stop the task?"),
        onOk: async () => await BApi$1.backgroundTask.stopBackgroundTask(props.id, {
          confirm: true
        })
      });
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { ...props, onPress: props.onPress ?? stop, children: props.children ?? t2("Stop") });
};
BTaskStopButton.displayName = "BTaskStopButton";
const TreeEntry = (props) => {
  var _a2, _b2;
  const {
    style: propsStyle,
    entry: propsEntry,
    filter: filter3,
    switchSelective,
    onDoubleClick,
    capabilities,
    onChildrenLoaded,
    onContextMenu = (e2, entry2) => {
    },
    onLoadFail = (rsp, entry2) => {
    },
    expandable = true,
    afterPlayedFirstFile
  } = props;
  const { t: t2 } = useTranslation();
  const forceUpdate = useUpdate();
  const { createPortal } = useBakabaseContext();
  const [entry, setEntry] = reactExports.useState(propsEntry);
  const entryRef = reactExports.useRef(entry);
  const log3 = buildLogger(entryRef.current.path);
  const loadingChildrenRef = reactExports.useRef(false);
  const childrenStylesRef = reactExports.useRef({});
  const domRef = reactExports.useRef(null);
  const hashRef = reactExports.useRef(uuidv4());
  const [loading, setLoading] = reactExports.useState(false);
  const pendingRenderingRef = reactExports.useRef(false);
  useUpdateEffect(() => {
    setEntry(propsEntry);
  }, [propsEntry]);
  reactExports.useEffect(() => {
    loadingChildrenRef.current = loading;
  }, [loading]);
  const currentEntryDomRef = reactExports.useRef();
  const initialize = reactExports.useCallback(async (e2) => {
    e2.path = standardizePath(e2.path);
    log3("Initializing", e2);
    if (entryRef.current) {
      log3("Disposing previous entry", entryRef.current);
      await entryRef.current.dispose();
    }
    entryRef.current = e2;
    entryRef.current.ref = {
      select: (selected) => {
        var _a3, _b3;
        if (((_a3 = entryRef.current) == null ? void 0 : _a3.selected) != selected) {
          entryRef.current.selected = selected;
          if (selected) {
            log3("Focus");
            (_b3 = currentEntryDomRef.current) == null ? void 0 : _b3.focus();
          }
          forceUpdate();
        }
      },
      get dom() {
        return domRef.current;
      },
      forceUpdate,
      renderChildren,
      get filteredChildren() {
        return entryRef.current.filteredChildren;
      },
      expand,
      collapse,
      scrollTo: (path) => {
        var _a3;
        const row = entryRef.current.filteredChildren.findIndex((e22) => e22.path == path);
        log3("scrolling to", path, row, virtualListRef.current);
        (_a3 = virtualListRef.current) == null ? void 0 : _a3.scrollToRow(row);
      },
      setLoading,
      playFirstFile
    };
    log3(
      "initializing, status: ",
      EntryStatus[entryRef.current.status],
      "expanded:",
      entryRef.current.expanded,
      `children size:${entryRef.current.childrenWidth}x${entryRef.current.childrenHeight}`,
      "filtered children",
      entryRef.current.filteredChildren
    );
    await entryRef.current.initialize();
    if (entryRef.current.expanded) {
      log3("Expanding");
      const rendered = await expand();
      if (!rendered) {
        entryRef.current.renderChildren();
      }
    }
    if (!entryRef.current.recalculateChildrenWidth()) {
      forceUpdate();
    }
    log3("Initialized");
  }, []);
  reactExports.useEffect(() => {
    initialize(entry);
    const resizeObserver2 = new ResizeObserver((c2) => {
      var _a3;
      if (domRef.current) {
        log3("Size changed", domRef.current, (_a3 = domRef.current) == null ? void 0 : _a3.clientWidth);
        entryRef.current.childrenWidth = domRef.current.clientWidth - (entryRef.current.isRoot ? 0 : 15);
        forceUpdate();
      }
    });
    resizeObserver2.observe(domRef.current);
    return () => {
      resizeObserver2.disconnect();
    };
  }, []);
  useUpdateEffect(() => {
    initialize(entry);
  }, [entry]);
  const renderFileSystemInfo = reactExports.useCallback(() => {
    const en2 = entryRef.current;
    if (en2.type != IwFsType.Invalid) {
      const elements = [];
      if (en2.childrenCount != void 0 && en2.isDirectoryOrDrive && en2.properties.includes(EntryProperty.ChildrenCount)) {
        elements.push(
          /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { color: "secondary", size: "sm", variant: "light", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$N, { className: "text-sm" }),
            en2.childrenCount
          ] }, "children-count")
        );
      }
      if (en2.size != void 0 && en2.size > 0 && en2.properties.includes(EntryProperty.Size)) {
        elements.push(
          /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "secondary", size: "sm", variant: "light", children: humanFileSize(en2.size, false) }, "size")
        );
      }
      if (elements.length > 0) {
        return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center", children: elements });
      }
    }
    return;
  }, []);
  const virtualListRowHeightCallback = reactExports.useCallback(
    ({ index: index2 }) => {
      const child = entryRef.current.filteredChildren[index2];
      if (child) {
        const h3 = child.totalHeight;
        log3(
          `[VirtualListRowHeight] Getting row height of [${child == null ? void 0 : child.name}]:${h3}, with children height:[${child.childrenHeight}]`
        );
        return h3;
      } else {
        log3(`[VirtualListRowHeight] Getting row height of [${index2}]:Unknown`);
        return 0;
      }
    },
    [entryRef.current.children, entryRef.current.expanded]
  );
  const virtualListRowRendererCallback = reactExports.useCallback(
    ({ index: index2, style: style2, isVisible: isVisible2, isScrolling }) => {
      if (entryRef.current.filteredChildren.length <= index2) {
        log3(
          `[VirtualListRowRenderer] Rendering a child with overflow index: ${index2} >= count of children: ${entryRef.current.filteredChildren.length}, ignoring`
        );
        return;
      }
      const e2 = entryRef.current.filteredChildren[index2];
      log3(
        `[VirtualListRowRenderer]Rendering children row:[${e2.name}]`,
        `height:[${style2.height}]`,
        `children height:[${e2.childrenHeight}]`,
        "status:",
        EntryStatus[e2.status]
      );
      const prevStyle = childrenStylesRef.current[e2.path];
      const differences = deepDiffExports.diff(prevStyle, style2);
      if (differences) {
        childrenStylesRef.current[e2.path] = style2;
        style2.id = uuidv4();
      }
      const s2 = childrenStylesRef.current[e2.path];
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        MemoTreeEntryPage,
        {
          afterPlayedFirstFile,
          capabilities,
          entry: e2,
          expandable: e2.expandable,
          filter: filter3,
          style: s2,
          switchSelective,
          onContextMenu,
          onDoubleClick,
          onLoadFail
        },
        e2.id
      );
    },
    [entryRef.current.children, entryRef.current.expanded, onDoubleClick]
  );
  const domCallback = reactExports.useCallback((node2) => {
    domRef.current = node2;
  }, []);
  const virtualListRef = reactExports.useRef();
  const renderChildren = reactExports.useCallback(() => {
    var _a3, _b3;
    log3("Rendering children", entryRef.current, entryRef.current.filteredChildren);
    pendingRenderingRef.current = true;
    if ((_a3 = domRef.current) == null ? void 0 : _a3.parentElement) {
      const newWidth = domRef.current.parentElement.clientWidth + (entryRef.current.isRoot ? 0 : -15);
      const newHeight = entryRef.current.childrenHeight;
      log3(`Recalculated children size: ${newWidth}x${newHeight}`);
      for (let i2 = 0; i2 < entryRef.current.filteredChildren.length; i2++) {
        (_b3 = virtualListRef.current) == null ? void 0 : _b3.recomputeRowHeights(i2);
      }
      forceUpdate();
    }
    if (entryRef.current.filteredChildren.length == 0) {
      triggerChildrenLoaded();
    }
  }, []);
  const collapse = reactExports.useCallback(() => {
    if (entryRef.current.expanded) {
      entryRef.current.expanded = false;
      entryRef.current.renderChildren();
    }
  }, []);
  const expand = async (refresh = false) => {
    var _a3, _b3;
    if (!entryRef.current.expandable) {
      return false;
    }
    if (refresh) {
      entryRef.current.clearChildren();
      log3("Clear children");
    }
    if (!entryRef.current.expanded || !entryRef.current.children) {
      if (!entryRef.current.children) {
        if (loadingChildrenRef.current) {
          return false;
        }
        loadingChildrenRef.current = true;
        setLoading(true);
        const rsp = await BApi$1.file.getChildrenIwFsInfo(
          { root: entryRef.current.path },
          { showErrorToast: () => false }
        );
        log3(`Loaded ${(_b3 = (_a3 = rsp.data) == null ? void 0 : _a3.entries) == null ? void 0 : _b3.length} children`);
        setLoading(false);
        if (rsp.code) {
          onLoadFail(rsp, entryRef.current);
          return false;
        }
        if (rsp.data) {
          const { entries = [] } = rsp.data || {};
          entryRef.current.children = entries.map(
            (e2) => new Entry({
              ...e2,
              parent: entryRef.current,
              properties: entryRef.current.properties
            })
          );
        }
      }
      entryRef.current.expanded = true;
      entryRef.current.expireFilteredChildren();
      entryRef.current.renderChildren();
      return true;
    }
    return false;
  };
  const triggerChildrenLoaded = reactExports.useCallback(() => {
    log3("Trigger onChildrenLoaded", entryRef.current);
    onChildrenLoaded == null ? void 0 : onChildrenLoaded(entryRef.current);
  }, []);
  useUpdateEffect(() => {
    entryRef.current.root.patchFilter(filter3);
    forceUpdate();
  }, [filter3]);
  const { actions } = entryRef.current;
  const renderTaskError = () => {
    if (entryRef.current.task && entryRef.current.task.error) {
      const text2 = `${entryRef.current.task.name}:${entryRef.current.task.error}`;
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          color: "danger",
          isIconOnly: !entryRef.current.task.briefError,
          size: "sm",
          variant: "light",
          onPress: () => {
            createPortal(Modal, {
              defaultVisible: true,
              size: "xl",
              title: t2("Error"),
              children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: text2 })
            });
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$_, { className: "text-base" }),
            entryRef.current.task.briefError
          ]
        }
      );
    }
    return;
  };
  const play2 = reactExports.useCallback((entry2) => {
    if (entry2.type == IwFsType.Directory) {
      BApi$1.file.getAllFiles({
        path: entry2.path
      }).then((x2) => {
        if (!x2.code) {
          if (!x2.data || x2.data.length == 0) {
            return toast.default(t2("No files to preview"));
          }
          MediaPlayer.show({
            files: x2.data.map((a2) => ({
              path: a2
            })),
            defaultActiveIndex: 0
          });
        }
      });
    } else {
      MediaPlayer.show({
        files: [{ path: entry2.path }],
        defaultActiveIndex: 0
      });
    }
  }, []);
  const playFirstFile = reactExports.useCallback(async () => {
    if (!((entryRef.current.childrenCount && entryRef.current.childrenCount > 0 || !entryRef.current.isDirectoryOrDrive) && (capabilities == null ? void 0 : capabilities.includes("play-first-file")))) {
      return;
    }
    const rsp = await BApi$1.file.getFirstFileByExtension({
      path: entryRef.current.path
    });
    const files = rsp.data ?? [];
    if (files.length == 0) {
      toast.danger(t2("No files under this path"));
    } else {
      if (files.length == 1) {
        await BApi$1.tool.openFile({ path: files[0] });
        afterPlayedFirstFile == null ? void 0 : afterPlayedFirstFile(entryRef.current);
      } else {
        const modal2 = createPortal(Modal, {
          size: "lg",
          defaultVisible: true,
          title: t2("Multiple file types are found"),
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Please select one to open") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: files.map((x2) => {
              const segments = x2.split(".");
              return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { className: "max-w-[600px]", content: x2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  onPress: async () => {
                    await BApi$1.tool.openFile({ path: x2 });
                    afterPlayedFirstFile == null ? void 0 : afterPlayedFirstFile(entryRef.current);
                    modal2.destroy();
                  },
                  children: segments[segments.length - 1]
                }
              ) });
            }) })
          ] }),
          footer: {
            actions: ["cancel"]
          }
        });
      }
    }
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      ref: domCallback,
      className: `tree-entry ${entryRef.current.isRoot ? "h-full" : ""}`,
      style: propsStyle,
      tabIndex: 0,
      onDoubleClick: (e2) => {
        e2.stopPropagation();
        log3("Double clicked", entryRef.current);
        onDoubleClick == null ? void 0 : onDoubleClick(e2, entryRef.current);
      },
      children: [
        !entryRef.current.isRoot && /* @__PURE__ */ jsxRuntimeExports.jsxs(
          "div",
          {
            className: "entry-main-container",
            onClick: (e2) => {
              e2.stopPropagation();
            },
            children: [
              entryRef.current.type == IwFsType.Invalid && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "invalid-cover" }),
              entryRef.current.task && !entryRef.current.task.error && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "running-task-cover", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "progress", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bar", style: { width: `${entryRef.current.task.percentage}%` } }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" }),
                  " ",
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "percentage", children: [
                    entryRef.current.task.name,
                    " ",
                    entryRef.current.task.status == BTaskStatus.NotStarted ? t2("Waiting") : `${entryRef.current.task.percentage}%`
                  ] })
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "stop", children: /* @__PURE__ */ jsxRuntimeExports.jsx(BTaskStopButton, { color: "warning", id: entryRef.current.task.id, size: "small" }) })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs(
                "div",
                {
                  ref: (r2) => {
                    currentEntryDomRef.current = r2;
                  },
                  className: `entry-main entry-keydown-listener ${((_a2 = entryRef.current) == null ? void 0 : _a2.selected) ? "selected" : ""} ${entryRef.current.expanded ? "expanded" : ""}`,
                  tabIndex: 0,
                  onClick: () => {
                    var _a3, _b3, _c2;
                    const r2 = !switchSelective || switchSelective(entryRef.current);
                    log3(
                      `Trying ${((_a3 = entryRef.current) == null ? void 0 : _a3.selected) ? "unselect" : "select"} ${(_b3 = entryRef.current) == null ? void 0 : _b3.name}, and get blocked: ${!r2}`
                    );
                    if (r2) {
                      entryRef.current.selected = !((_c2 = entryRef.current) == null ? void 0 : _c2.selected);
                      forceUpdate();
                    }
                  },
                  onContextMenu: (e2) => {
                    if (!entryRef.current.selected) {
                      if (!switchSelective || switchSelective(entryRef.current)) {
                        entryRef.current.selected = true;
                        forceUpdate();
                      }
                    }
                    onContextMenu(e2, entryRef.current);
                  },
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "left", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "things-before-name", children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx(LeftIcon, { entry: entryRef.current, expandable, loading }),
                        entryRef.current && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "item", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          FileSystemEntryIcon,
                          {
                            path: entryRef.current.path,
                            size: 18,
                            type: entry.isDirectoryOrDrive ? IconType.Directory : IconType.Dynamic
                          }
                        ) })
                      ] }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        EditableText,
                        {
                          disabled: entry.isDrive || !(capabilities == null ? void 0 : capabilities.includes("rename")) || entry.status == EntryStatus.Error,
                          isDirectory: entry.isDirectoryOrDrive,
                          name: entry.name,
                          path: entry.path
                        }
                      ),
                      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
                        actions.includes(IwFsEntryAction.Play) && (capabilities == null ? void 0 : capabilities.includes("play")) && /* @__PURE__ */ jsxRuntimeExports.jsx(
                          OperationButton,
                          {
                            isIconOnly: true,
                            color: "primary",
                            onClick: (e2) => {
                              play2(entryRef.current);
                            },
                            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1d, { className: "text-base" })
                          }
                        ),
                        " ",
                        (entry.childrenCount && entry.childrenCount > 0 || !entry.isDirectoryOrDrive) && (capabilities == null ? void 0 : capabilities.includes("play-first-file")) && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Quick preview using the default application"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          OperationButton,
                          {
                            isIconOnly: true,
                            onClick: async (e2) => {
                              e2.stopPropagation();
                              playFirstFile();
                            },
                            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlayCircle, { className: "text-base" })
                          }
                        ) }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx(TailingOperations, { capabilities, entry }),
                        renderFileSystemInfo(),
                        renderTaskError()
                      ] })
                    ] }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RightOperations, { capabilities, entry: entryRef.current }) })
                  ]
                }
              )
            ]
          }
        ),
        entryRef.current.expanded && (((_b2 = entryRef.current.filteredChildren) == null ? void 0 : _b2.length) > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `entry-children ${entryRef.current.isRoot ? "root" : ""}`, children: entryRef.current.childrenHeight > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
          List,
          {
            ref: (r2) => {
              log3("VirtualList ref", r2);
              virtualListRef.current = r2;
              if (r2) {
                if (pendingRenderingRef.current) {
                  pendingRenderingRef.current = false;
                  triggerChildrenLoaded();
                }
              }
            },
            height: entryRef.current.childrenHeight,
            overscanRowCount: 5,
            renderHash: hashRef.current,
            rowCount: entryRef.current.filteredChildren.length,
            rowHeight: virtualListRowHeightCallback,
            rowRenderer: virtualListRowRendererCallback,
            width: entryRef.current.childrenWidth
          }
        ) }) : loading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center items-center py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-center items-center gap-2 opacity-70 py-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, {}),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("No content") })
        ] }))
      ]
    }
  );
};
const MemoTreeEntryPage = React$5.memo(TreeEntry);
const log$B = buildLogger("RootEntry");
class RenderingQueue {
  constructor() {
    __publicField(this, "_queue", []);
  }
  push(path, type4) {
    this._queue.push({
      path,
      type: type4
    });
  }
  deQueueAll() {
    const q2 = this._queue;
    this._queue = [];
    return q2;
  }
  shrink() {
    const map2 = {};
    for (const i2 in this._queue) {
      const item = this._queue[i2];
      if (item.path in map2) {
        map2[item.path] |= item.type;
      } else {
        map2[item.path] = item.type;
      }
    }
    this._queue = Object.keys(map2).map((x2) => ({
      path: x2,
      type: map2[x2]
    }));
  }
  get length() {
    return this._queue.length;
  }
}
class RootEntry extends Entry {
  constructor(path) {
    super({ path });
    __publicField(this, "nodeMap", {});
    __publicField(this, "filter", {});
    __publicField(this, "_fsWatcher");
    __publicField(this, "_processingFsEvents", false);
    __publicField(this, "_resizeObserver");
    __publicField(this, "_initialized", false);
    this.root = this;
    this.expanded = true;
    this.type = IwFsType.Directory;
    this.nodeMap[this.path] = this;
  }
  patchFilter(filter3) {
    this.filter = {
      ...this.filter || {},
      ...filter3 || {}
    };
  }
  async _compareBTasks(renderingQueue) {
    const self2 = this;
    const bTasks = useBTasksStore.getState().tasks;
    const targetTasks = bTasks.filter(
      (x2) => x2.resourceType == BTaskResourceType.FileSystemEntry && (x2.status == BTaskStatus.Running || x2.status == BTaskStatus.Paused || x2.status == BTaskStatus.Error || x2.status == BTaskStatus.NotStarted || x2.status == BTaskStatus.Completed || x2.status == BTaskStatus.Cancelled)
    );
    const targetTasksMap = _$2.flatMap(
      targetTasks,
      (t2) => (t2.resourceKeys ?? []).map((k2) => ({
        path: k2,
        task: t2
      }))
    ).reduce((s2, t2) => {
      if (t2.path in s2) {
        s2[t2.path].push(t2.task);
      } else {
        s2[t2.path] = [t2.task];
      }
      return s2;
    }, {});
    for (const path of Object.keys(self2.nodeMap)) {
      const node2 = self2.nodeMap[path];
      const prevTask = node2.task;
      const incomingTasks = (targetTasksMap[path] ?? []).sort(
        (a2, b2) => {
          var _a2;
          return -((_a2 = a2.createdAt) == null ? void 0 : _a2.localeCompare(b2.createdAt));
        }
      );
      let task = incomingTasks[0];
      if (task) {
        if (task.status == BTaskStatus.Completed || task.status == BTaskStatus.Cancelled) {
          task = void 0;
        }
      }
      const differences = diff$1(prevTask, task);
      if (differences) {
        log$B("TaskChanged", differences, "current: ", task, "previous: ", prevTask);
        renderingQueue.push(
          path,
          1
          /* ForceUpdate */
        );
        node2.task = task;
      }
    }
  }
  async _consumeFsEvents(renderingQueue) {
    const self2 = this;
    const data = useIwFsEntryChangeEventsStore.getState();
    const dispatchers = {
      addRange: useIwFsEntryChangeEventsStore.getState().addRange,
      clear: useIwFsEntryChangeEventsStore.getState().clear
      // ... 其它 action如有
    };
    const { events: events2 } = data;
    if (events2.length > 0) {
      log$B("handling events", events2, self2);
      dispatchers.clear();
      for (let i2 = 0; i2 < events2.length; i2++) {
        const evt = events2[i2];
        const changedEntryPath = evt.type == IwFsEntryChangeType.Renamed ? evt.prevPath : evt.path;
        const changedEntry = self2.nodeMap[changedEntryPath];
        const segments = splitPathIntoSegments(evt.path);
        const parentPath = segments.slice(0, segments.length - 1).join(BusinessConstants.pathSeparator);
        const parent = self2.nodeMap[parentPath];
        log$B(
          "Try to locate parent",
          "path:",
          parentPath,
          "parent:",
          parent,
          "nodeMap:",
          self2.nodeMap
        );
        log$B(
          `File system entry changed: [${IwFsEntryChangeType[evt.type]}]${evt.path}`,
          "Event: ",
          evt,
          "Entry: ",
          changedEntry
        );
        if (!changedEntry) {
          if (parent) {
            switch (evt.type) {
              case IwFsEntryChangeType.Created:
                await parent.addChildByPath(evt.path, false);
                log$B("Add to children", evt.path, parent.children);
                renderingQueue.push(
                  parent.path,
                  2
                  /* Children */
                );
                break;
              case IwFsEntryChangeType.Renamed:
                break;
              case IwFsEntryChangeType.Changed:
                break;
              case IwFsEntryChangeType.Deleted:
                if (parent.childrenCount != void 0) {
                  parent.childrenCount -= 1;
                }
                renderingQueue.push(
                  parent.path,
                  1
                  /* ForceUpdate */
                );
                break;
            }
          }
        } else {
          switch (evt.type) {
            case IwFsEntryChangeType.Created:
              break;
            case IwFsEntryChangeType.Renamed:
              if (parent) {
                await parent.replaceChildByPath(evt.prevPath, evt.path, false);
                renderingQueue.push(
                  parent.path,
                  2
                  /* Children */
                );
              }
              break;
            case IwFsEntryChangeType.Changed:
              break;
            case IwFsEntryChangeType.Deleted:
              if (parent) {
                changedEntry.delete(false);
                renderingQueue.push(
                  parent.path,
                  2
                  /* Children */
                );
              }
              break;
          }
        }
      }
    }
  }
  async initialize() {
    var _a2, _b2;
    if (!this._initialized) {
      this._initialized = true;
      log$B("Initializing...", this);
      await this._stop();
      if (this.path) {
        log$B("Start watching", this.path, this);
        await BApi$1.file.startWatchingChangesInFileProcessorWorkspace(
          { path: this.path },
          { showErrorToast: () => false }
        );
        const renderingQueue = new RenderingQueue();
        const self2 = this;
        this._fsWatcher = setInterval(async () => {
          if (self2._processingFsEvents) {
            return;
          }
          self2._processingFsEvents = true;
          await self2._consumeFsEvents(renderingQueue);
          await self2._compareBTasks(renderingQueue);
          const originalRenderingTimes = renderingQueue.length;
          renderingQueue.shrink();
          let actualRenderingTimes = 0;
          const rq = renderingQueue.deQueueAll();
          for (let i2 = 0; i2 < rq.length; i2++) {
            const { path, type: type4 } = rq[i2];
            const entry = self2.nodeMap[path];
            if (entry) {
              if (type4 & 2) {
                entry.renderChildren();
                actualRenderingTimes++;
              }
              if (type4 & 1) {
                entry.forceUpdate();
                actualRenderingTimes++;
              }
            }
          }
          if (actualRenderingTimes != originalRenderingTimes) {
            log$B(
              `Reduced ${originalRenderingTimes - actualRenderingTimes} rendering times totally`,
              rq
            );
          }
          self2._processingFsEvents = false;
        }, 500);
      }
      this.childrenWidth = ((_b2 = (_a2 = this._ref) == null ? void 0 : _a2.dom.parentElement) == null ? void 0 : _b2.clientWidth) ?? 0;
      this._resizeObserver = new ResizeObserver((c2) => {
        const parent = c2[0];
        log$B("Size of parent changed", parent);
        this.recalculateChildrenWidth();
      });
      this._resizeObserver.observe(this._ref.dom);
    }
  }
  async _stop() {
    log$B("Stopping watcher", this, this.path, this._fsWatcher);
    clearInterval(this._fsWatcher);
    await BApi$1.file.stopWatchingChangesInFileProcessorWorkspace();
    useIwFsEntryChangeEventsStore.getState().clear();
  }
  async dispose() {
    await this._stop();
  }
}
const log$A = buildLogger("RootTreeEntry");
const RootTreeEntry = reactExports.forwardRef(
  ({
    rootPath,
    onDoubleClick,
    filter: filter3,
    onSelected,
    selectable,
    onInitialized,
    defaultSelectedPath,
    expandable = false,
    capabilities,
    afterPlayedFirstFile
  }, ref) => {
    const { t: t2 } = useTranslation();
    const forceUpdate = useUpdate();
    const { createPortal } = useBakabaseContext();
    const initializedRootPathRef = reactExports.useRef();
    const inputBlurHandlerRef = reactExports.useRef();
    const [root2, setRoot] = reactExports.useState();
    const rootRef = reactExports.useRef(root2);
    const [inputValue, setInputValue] = reactExports.useState(rootPath);
    const [selectedEntries, setSelectedEntries] = reactExports.useState([]);
    const selectedEntriesRef = reactExports.useRef(selectedEntries);
    const selectionModeRef = reactExports.useRef(SelectionMode$1.Normal);
    const shiftSelectionStartRef = reactExports.useRef();
    const defaultSelectedPathInitializedRef = reactExports.useRef(false);
    const [historyRootPaths, setHistoryRootPaths] = reactExports.useState([]);
    const historyRootPathsRef = reactExports.useRef(historyRootPaths);
    const [filterInputValue, setFilterInputValue] = reactExports.useState();
    const [menuProps, toggleMenu] = useMenuState();
    const [anchorPoint, setAnchorPoint] = reactExports.useState({
      x: 0,
      y: 0
    });
    const contextMenuEntryRef = reactExports.useRef();
    const onSelectedRef = reactExports.useRef(onSelected);
    useUpdateEffect(() => {
      onSelectedRef.current = onSelected;
    }, [onSelected]);
    useUpdateEffect(() => {
      var _a2;
      selectedEntriesRef.current = selectedEntries;
      log$A("Trigger onSelected", selectedEntriesRef.current);
      (_a2 = onSelectedRef.current) == null ? void 0 : _a2.call(onSelectedRef, selectedEntriesRef.current);
    }, [selectedEntries]);
    const initialize = reactExports.useCallback(async (path, addToHistory = true) => {
      let finalPath = standardizePath(path);
      if (finalPath != void 0 && finalPath.length > 0) {
        const isFile2 = (await BApi$1.file.checkPathIsFile({ path: finalPath })).data;
        if (isFile2) {
          finalPath = getStandardParentPath(finalPath);
        }
      }
      shiftSelectionStartRef.current = void 0;
      if (addToHistory && rootRef.current) {
        const history = historyRootPathsRef.current;
        if (history.length == 0 || history[history.length - 1] != rootRef.current.path) {
          setHistoryRootPaths([...history, rootRef.current.path]);
        }
      }
      log$A("initialize", finalPath, historyRootPathsRef.current);
      setRoot(new RootEntry(finalPath));
    }, []);
    reactExports.useEffect(() => {
      initialize(rootPath);
      return () => {
        var _a2;
        log$A("Disposing", rootRef);
        (_a2 = rootRef == null ? void 0 : rootRef.current) == null ? void 0 : _a2.dispose();
      };
    }, []);
    useUpdateEffect(() => {
      var _a2;
      (_a2 = rootRef.current) == null ? void 0 : _a2.patchFilter(filter3);
    }, [filter3]);
    useUpdateEffect(() => {
      var _a2;
      setInputValue(root2 == null ? void 0 : root2.path);
      rootRef.current = root2;
      (_a2 = rootRef.current) == null ? void 0 : _a2.patchFilter(filter3);
      log$A("root changed", root2);
    }, [root2]);
    useUpdateEffect(() => {
      historyRootPathsRef.current = historyRootPaths;
    }, [historyRootPaths]);
    reactExports.useImperativeHandle(ref, () => {
      return {
        root: root2
      };
    }, [root2]);
    const ignoreClickEvent = reactExports.useCallback((target) => {
      let e2 = target;
      while (e2) {
        if (e2.role == "dialog" || e2.role == "menuitem") {
          console.log("return");
          return true;
        }
        e2 = e2.parentElement;
      }
      return false;
    }, []);
    if (!root2) {
      return null;
    }
    const filteredChildrenCount = (root2 == null ? void 0 : root2.filteredChildren.length) ?? 0;
    const childrenCount = (root2 == null ? void 0 : root2.childrenCount) ?? 0;
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        className: "flex flex-col gap-1 max-h-full min-h-0 grow",
        onClick: (evt) => {
          if (ignoreClickEvent(evt.target)) {
            return;
          }
          for (const se2 of selectedEntriesRef.current) {
            se2.select(false);
          }
          setSelectedEntries([]);
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            ControlledMenu,
            {
              ...menuProps,
              anchorPoint,
              className: "file-processor-page-context-menu",
              onClose: () => {
                contextMenuEntryRef.current = void 0;
                toggleMenu(false);
              },
              onContextMenu: (e2) => {
                e2.preventDefault();
                e2.stopPropagation();
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                ContextMenu,
                {
                  capabilities,
                  contextMenuEntry: contextMenuEntryRef.current,
                  root: root2,
                  selectedEntries
                }
              )
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            EventListener,
            {
              onClick: (evt) => {
                if (ignoreClickEvent(evt.target)) {
                  return;
                }
                for (const se2 of selectedEntriesRef.current) {
                  se2.select(false);
                }
                setSelectedEntries([]);
              },
              onDelete: () => {
                var _a2;
                if (selectedEntriesRef.current.length > 0 && (capabilities == null ? void 0 : capabilities.includes("delete"))) {
                  createPortal(DeleteConfirmationModal, {
                    entries: selectedEntriesRef.current,
                    rootPath: (_a2 = rootRef.current) == null ? void 0 : _a2.path
                  });
                }
              },
              onKeyDown: (key, evt) => {
                var _a2;
                log$A("event listener", "key down", key, evt);
                const c2 = _$2.keys(FileSystemTreeEntryCapabilityMap).find(
                  (k2) => {
                    var _a3;
                    return ((_a3 = FileSystemTreeEntryCapabilityMap[k2].shortcut) == null ? void 0 : _a3.key) == key;
                  }
                );
                if (c2) {
                  evt.stopPropagation();
                  evt.preventDefault();
                  if (capabilities == null ? void 0 : capabilities.includes(c2)) {
                    switch (c2) {
                      case "wrap":
                        if (selectedEntriesRef.current.length > 0) {
                          createPortal(WrapModal, {
                            entries: selectedEntriesRef.current
                          });
                        }
                        break;
                      case "extract":
                        if (selectedEntriesRef.current.length > 0) {
                          createPortal(ExtractModal, {
                            entries: selectedEntriesRef.current
                          });
                        }
                        break;
                      case "move":
                        if (selectedEntriesRef.current.length > 0) {
                          createPortal(FolderSelector, {
                            onSelect: (path) => {
                              return BApi$1.file.moveEntries({
                                destDir: path,
                                entryPaths: selectedEntriesRef.current.map((e2) => e2.path)
                              });
                            },
                            sources: ["media library", "custom"]
                          });
                        }
                        break;
                      case "delete":
                        break;
                      case "rename":
                        break;
                      case "decompress":
                        if (selectedEntriesRef.current.length > 0) {
                          BApi$1.file.decompressFiles({
                            paths: selectedEntriesRef.current.map((e2) => e2.path)
                          });
                        }
                        break;
                      case "delete-all-same-name":
                        break;
                      case "group":
                        break;
                      case "play":
                        break;
                      case "play-first-file":
                        if (selectedEntriesRef.current.length == 1) {
                          (_a2 = selectedEntriesRef.current[0].ref) == null ? void 0 : _a2.playFirstFile();
                        }
                        break;
                    }
                  }
                } else {
                  switch (key) {
                    case "a": {
                      if (evt.ctrlKey) {
                        let parent;
                        for (const se2 of selectedEntriesRef.current) {
                          if (se2.parent) {
                            if (!parent || parent.path.startsWith(se2.parent.path)) {
                              parent = se2.parent;
                            }
                          }
                        }
                        parent ?? (parent = rootRef.current);
                        log$A("Select all filtered children of entry", parent);
                        if (parent) {
                          const newSelectedEntries = [];
                          for (const c22 of parent.filteredChildren) {
                            newSelectedEntries.push(c22);
                            c22.select(true);
                          }
                          const others = selectedEntriesRef.current.filter(
                            (s2) => !newSelectedEntries.includes(s2)
                          );
                          for (const o2 of others) {
                            o2.select(false);
                          }
                          setSelectedEntries(newSelectedEntries);
                        }
                      }
                    }
                  }
                }
              },
              onSelectionModeChange: (m2) => {
                selectionModeRef.current = m2;
                forceUpdate();
              }
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                isDisabled: historyRootPaths.length == 0,
                radius: "none",
                size: "sm",
                variant: "light",
                onClick: () => {
                  const newRoot = historyRootPathsRef.current.pop();
                  setHistoryRootPaths([...historyRootPathsRef.current]);
                  initialize(newRoot, false);
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$15, { className: "text-base" })
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                isDisabled: !(root2 == null ? void 0 : root2.path),
                radius: "none",
                size: "sm",
                variant: "light",
                onClick: () => {
                  if (root2) {
                    const newRootPath = getStandardParentPath(root2.path);
                    if (newRootPath) {
                      initialize(newRootPath);
                    }
                  }
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$13, { className: "text-base" })
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                className: "grow",
                classNames: {
                  inputWrapper: "pl-0"
                },
                endContent: /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { size: "sm", variant: "light", children: [
                  selectedEntries.length,
                  " /",
                  " ",
                  filteredChildrenCount == childrenCount ? childrenCount : `${filteredChildrenCount} / ${childrenCount}`
                ] }),
                placeholder: t2("You can type a path here"),
                radius: "none",
                size: "sm",
                startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    isIconOnly: true,
                    isDisabled: !(root2 == null ? void 0 : root2.path),
                    radius: "none",
                    size: "sm",
                    onClick: () => {
                      BApi$1.tool.openFileOrDirectory({ path: root2 == null ? void 0 : root2.path });
                    },
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$F, { className: "text-base" })
                  }
                ),
                value: inputValue,
                onKeyDown: (evt) => {
                  evt.stopPropagation();
                },
                onValueChange: (v2) => {
                  const path = standardizePath(v2);
                  setInputValue(path);
                  clearInterval(inputBlurHandlerRef.current);
                  inputBlurHandlerRef.current = setTimeout(() => {
                    initialize(path);
                  }, 1e3);
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                className: "w-1/4",
                placeholder: t2("Filter"),
                radius: "none",
                size: "sm",
                startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1h, { className: "text-base" }),
                value: filterInputValue,
                onValueChange: (v2) => setFilterInputValue(v2)
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsxs(
              Button,
              {
                className: "px-6",
                radius: "none",
                size: "sm",
                onClick: () => {
                  BApi$1.file.openRecycleBin();
                },
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$G, { className: "text-base" }),
                  t2("Recycle bin")
                ]
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(Shortcuts, { capabilities })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            MemoTreeEntryPage,
            {
              afterPlayedFirstFile,
              capabilities,
              entry: root2,
              expandable,
              filter: {
                keyword: filterInputValue
              },
              switchSelective: (e2) => {
                if (selectable == "disabled") {
                  return false;
                }
                if (selectable == "single" || selectionModeRef.current == SelectionMode$1.Normal) {
                  shiftSelectionStartRef.current = e2;
                  if (selectedEntriesRef.current.includes(e2)) {
                    if (selectedEntriesRef.current.length > 1) {
                      for (const se2 of selectedEntriesRef.current.filter((x2) => x2 != e2)) {
                        se2.select(false);
                      }
                      setSelectedEntries([e2]);
                      return false;
                    } else {
                      setSelectedEntries([]);
                      return true;
                    }
                  } else {
                    for (const se2 of selectedEntriesRef.current) {
                      se2.select(false);
                    }
                    setSelectedEntries([e2]);
                    return true;
                  }
                }
                switch (selectionModeRef.current) {
                  case SelectionMode$1.Ctrl: {
                    shiftSelectionStartRef.current = e2;
                    if (selectedEntriesRef.current.includes(e2)) {
                      selectedEntriesRef.current = selectedEntriesRef.current.filter((x2) => x2 != e2);
                    } else {
                      selectedEntriesRef.current.push(e2);
                    }
                    setSelectedEntries([...selectedEntriesRef.current]);
                    return true;
                  }
                  case SelectionMode$1.Shift: {
                    shiftSelectionStartRef.current ?? (shiftSelectionStartRef.current = e2.parent.filteredChildren[0]);
                    let startParent = shiftSelectionStartRef.current.parent;
                    const startParentSet = /* @__PURE__ */ new Set();
                    while (startParent) {
                      startParentSet.add(startParent);
                      startParent = startParent.parent;
                    }
                    let endParent = e2.parent;
                    while (endParent) {
                      if (startParentSet.has(endParent)) {
                        break;
                      }
                      endParent = endParent.parent;
                    }
                    const buildPreorderTraversal = (entry, result) => {
                      result.push(entry);
                      if (entry.expanded && entry.filteredChildren) {
                        for (const child of entry.filteredChildren) {
                          buildPreorderTraversal(child, result);
                        }
                      }
                    };
                    const preorderTraversal = [];
                    buildPreorderTraversal(endParent, preorderTraversal);
                    const startIdx = preorderTraversal.indexOf(shiftSelectionStartRef.current);
                    const endIdx = preorderTraversal.indexOf(e2);
                    const minIdx = Math.min(startIdx, endIdx);
                    const maxIdx = Math.max(startIdx, endIdx);
                    const newSelectedEntries = preorderTraversal.slice(minIdx, maxIdx + 1);
                    for (let i2 = minIdx; i2 <= maxIdx; i2++) {
                      const en2 = preorderTraversal[i2];
                      en2.select(true);
                    }
                    for (const se2 of selectedEntriesRef.current) {
                      if (!newSelectedEntries.includes(se2)) {
                        se2.select(false);
                      }
                    }
                    setSelectedEntries(newSelectedEntries);
                    return false;
                  }
                }
                return true;
              },
              onChildrenLoaded: (e2) => {
                var _a2, _b2;
                if (!defaultSelectedPathInitializedRef.current) {
                  defaultSelectedPathInitializedRef.current = true;
                  const standardDefaultSelectedPath = standardizePath(defaultSelectedPath);
                  if (standardDefaultSelectedPath != void 0 && standardDefaultSelectedPath.length > 0) {
                    const selectedRow = (_a2 = e2.filteredChildren) == null ? void 0 : _a2.findIndex(
                      (c2) => c2.path == standardDefaultSelectedPath
                    );
                    if (selectedRow > -1) {
                      const selected = e2.filteredChildren[selectedRow];
                      selected.select(true);
                      const scrollToRow = Math.min(e2.filteredChildren.length - 1, selectedRow + 2);
                      (_b2 = e2.ref) == null ? void 0 : _b2.scrollTo(e2.filteredChildren[scrollToRow].path);
                      setSelectedEntries([selected]);
                    }
                  }
                }
                log$A("12312321321321321", e2);
                if (initializedRootPathRef.current != e2.path) {
                  initializedRootPathRef.current = e2.path;
                  onInitialized == null ? void 0 : onInitialized(e2 == null ? void 0 : e2.path);
                }
                forceUpdate();
              },
              onContextMenu: (evt, entry) => {
                evt.preventDefault();
                setAnchorPoint({
                  x: evt.clientX,
                  y: evt.clientY
                });
                contextMenuEntryRef.current = entry;
                toggleMenu(true);
              },
              onDoubleClick: (evt, en2) => {
                if (!onDoubleClick || onDoubleClick(evt, en2)) {
                  if (en2.isDirectoryOrDrive) {
                    initialize(en2.path);
                  }
                }
              }
            }
          ) })
        ]
      }
    );
  }
);
const log$z = buildLogger("FileSystemSelector");
const Panel = (props) => {
  const { t: t2 } = useTranslation();
  useUpdate();
  const {
    startPath,
    targetType,
    onSelected,
    onCancel,
    filter: propsFilter = (e2) => true,
    defaultSelectedPath
  } = props;
  const [selected, setSelected] = reactExports.useState();
  const [currentDirPath, setCurrentDirPath] = reactExports.useState();
  const rootRef = reactExports.useRef(null);
  reactExports.useEffect(() => {
  }, []);
  const filter3 = (e2, mode) => {
    log$z("filter", e2, mode, targetType);
    if (!e2.path) {
      return false;
    }
    if (targetType) {
      switch (targetType) {
        case "file":
          if (![
            IwFsType.Audio,
            IwFsType.CompressedFilePart,
            IwFsType.CompressedFileEntry,
            IwFsType.Image,
            IwFsType.Unknown,
            IwFsType.Video
          ].includes(e2.type)) {
            if (mode == "select") {
              return false;
            } else {
              if (e2.type != IwFsType.Directory && e2.type != IwFsType.Drive) {
                return false;
              }
            }
          }
          break;
        case "folder":
          if (e2.type != IwFsType.Directory && e2.type != IwFsType.Drive) {
            return false;
          }
          break;
      }
    }
    if (propsFilter && !propsFilter(e2)) {
      return false;
    }
    return true;
  };
  log$z("selected", selected);
  const trySelectRootOrClearSelection = () => {
    var _a2;
    if (((_a2 = rootRef.current) == null ? void 0 : _a2.root) && filter3(rootRef.current.root, "select")) {
      setSelected(rootRef.current.root);
    } else {
      setSelected(void 0);
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 grow max-h-full", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      RootTreeEntry,
      {
        ref: (r2) => {
          rootRef.current = r2;
          log$z("ref", r2);
        },
        capabilities: ["rename", "select"],
        defaultSelectedPath,
        filter: {
          custom: (e2) => filter3(e2, "visible")
        },
        rootPath: startPath,
        selectable: "single",
        onInitialized: () => {
          var _a2, _b2;
          log$z("onInitialized", (_a2 = rootRef.current) == null ? void 0 : _a2.root);
          if ((_b2 = rootRef.current) == null ? void 0 : _b2.root) {
            trySelectRootOrClearSelection();
            if (rootRef.current.root.isDirectory) {
              setCurrentDirPath(rootRef.current.root.path);
            }
          }
        },
        onSelected: (es) => {
          const e2 = es[0];
          log$z(rootRef.current);
          if (e2) {
            if (filter3(e2, "select")) {
              setSelected(e2);
            } else {
              setSelected(void 0);
            }
          } else {
            trySelectRootOrClearSelection();
          }
        }
      }
    ),
    selected && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", radius: "sm", size: "sm", variant: "light", children: t2("Selected") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Chip,
        {
          className: "whitespace-break-spaces h-auto",
          color: "success",
          radius: "sm",
          size: "sm",
          variant: "light",
          children: selected.path
        }
      )
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between mb-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          isDisabled: !currentDirPath,
          onClick: () => {
            BApi$1.file.createDirectory({ parent: currentDirPath });
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$H, { className: "text-base" }),
            t2("New Folder")
          ]
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            disabled: !selected,
            onClick: () => {
              onSelected == null ? void 0 : onSelected(selected);
            },
            children: t2("OK")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            onClick: () => {
              onCancel == null ? void 0 : onCancel();
            },
            children: t2("Cancel")
          }
        )
      ] })
    ] })
  ] });
};
Panel.displayName = "Panel";
const FileSystemSelectorModal = (props) => {
  const { t: t2 } = useTranslation();
  const { ...fsProps } = props;
  const [visible, setVisible] = reactExports.useState(true);
  const close = () => {
    setVisible(false);
  };
  let title = "Select file system entries";
  if (props.targetType != void 0) {
    switch (props.targetType) {
      case "file":
        title = "Select file";
        break;
      case "folder":
        title = "Select folder";
        break;
    }
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      className: "h-full",
      footer: false,
      size: "xl",
      title: t2(title),
      visible,
      onClose: close,
      onDestroyed: props.onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Panel,
        {
          ...fsProps,
          onCancel: () => {
            close();
            if (fsProps.onCancel) {
              fsProps.onCancel();
            }
          },
          onSelected: (e2) => {
            close();
            if (fsProps.onSelected) {
              fsProps.onSelected(e2);
            }
          }
        }
      )
    }
  );
};
FileSystemSelectorModal.displayName = "FileSystemSelectorModal";
const AttachmentValueRenderer = ({
  value: value2,
  variant,
  editor: editor2,
  size: size2,
  ...props
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const v2 = variant ?? "default";
  const editable = !!editor2;
  switch (v2) {
    case "default":
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
        value2 == null ? void 0 : value2.map((v22) => {
          splitPathIntoSegments(v22);
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(
            "div",
            {
              className: "flex flex-col gap-1 max-w-[100px] relative group",
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Img,
                  {
                    alt: "",
                    loader: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1i, { className: "text-2xl" }),
                    src: [
                      `${envConfig.apiEndpoint}/tool/thumbnail?path=${encodeURIComponent(v22)}`
                    ],
                    style: {
                      maxWidth: 100,
                      maxHeight: 100
                    },
                    title: v22,
                    unloader: /* @__PURE__ */ jsxRuntimeExports.jsx(MdAttachFile, { className: "text-2xl" })
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    isIconOnly: true,
                    color: "danger",
                    style: { transform: "translate(50%, -50%)", zIndex: 1 },
                    onClick: () => {
                      var _a2;
                      const newValue = value2.filter((e2) => e2 != v22);
                      (_a2 = editor2 == null ? void 0 : editor2.onValueChange) == null ? void 0 : _a2.call(editor2, newValue, newValue);
                    },
                    size: size2,
                    className: "top-0 right-0 absolute hidden group-hover:block",
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-lg" })
                  }
                )
              ]
            }
          );
        }),
        editable && /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: "flex items-center justify-center w-[80px] h-[80px] border-1 rounded",
            style: { borderColor: "var(--bakaui-overlap-background)" },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                color: "primary",
                size: size2,
                variant: "light",
                onClick: () => {
                  createPortal(FileSystemSelectorModal, {
                    targetType: "file",
                    onSelected: (entry) => {
                      var _a2;
                      const newValue = (value2 ?? []).concat([entry.path]);
                      (_a2 = editor2 == null ? void 0 : editor2.onValueChange) == null ? void 0 : _a2.call(editor2, newValue, newValue);
                    }
                  });
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$O, { className: "text-lg" })
              }
            )
          }
        )
      ] });
    case "light":
      if (!value2 || value2.length == 0) {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, {});
      } else {
        return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "break-all", children: value2.join(",") });
      }
  }
};
AttachmentValueRenderer.displayName = "AttachmentValueRenderer";
buildLogger("RatingValueRenderer");
const RatingValueRenderer = (props) => {
  const { value: propsValue, editor: editor2, variant, allowHalf = true, size: size2 } = props;
  const [value2, setValue] = reactExports.useState(propsValue);
  const { t: t2 } = useTranslation();
  const [editing, setEditing] = reactExports.useState(false);
  useUpdateEffect(() => {
    setValue(propsValue);
  }, [propsValue]);
  const startEditing = editor2 ? () => setEditing(true) : void 0;
  const changeValue = (v2) => {
    var _a2;
    setValue(v2);
    setEditing(false);
    (_a2 = editor2 == null ? void 0 : editor2.onValueChange) == null ? void 0 : _a2.call(editor2, v2, v2);
  };
  if (editing) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      NumberValueEditor,
      {
        placeholder: t2("Set rating"),
        value: value2,
        size: size2,
        onValueChange: (dv, bv) => changeValue(dv)
      }
    );
  } else {
    if (variant == "light") {
      if (value2 != void 0 && value2 > 0) {
        return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { onClick: startEditing, children: value2 });
      } else {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { onClick: startEditing });
      }
    } else {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Rate$1,
          {
            allowHalf,
            value: value2,
            onChange: (r2) => {
              if (value2 == void 0) {
                setValue(r2);
              }
              setEditing(true);
            }
          }
        ),
        value2
      ] });
    }
  }
};
RatingValueRenderer.displayName = "RatingValueRenderer";
const MultilevelValueRenderer = ({
  value: value2,
  editor: editor2,
  variant,
  getDataSource,
  multiple,
  defaultEditing,
  valueAttributes,
  size: size2,
  ...props
}) => {
  var _a2, _b2;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  console.log("[MultilevelValueRenderer]", value2, variant);
  reactExports.useEffect(() => {
    if (defaultEditing) {
      showEditor();
    }
  }, []);
  const showEditor = () => {
    createPortal(MultilevelValueEditor, {
      getDataSource,
      onValueChange: editor2 == null ? void 0 : editor2.onValueChange,
      multiple,
      value: editor2 == null ? void 0 : editor2.value
    });
  };
  if (value2 == void 0 || value2.length == 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { onClick: editor2 && showEditor });
  }
  if (variant == "light") {
    const label = [];
    if (value2) {
      for (let i2 = 0; i2 < value2.length; i2++) {
        const arr = value2[i2];
        if (arr) {
          if (i2 != 0) {
            label.push(";");
          }
          for (let j2 = 0; j2 < arr.length; j2++) {
            if (j2 != 0) {
              label.push("/");
            }
            const style2 = {};
            const color2 = (_b2 = (_a2 = valueAttributes == null ? void 0 : valueAttributes[i2]) == null ? void 0 : _a2[j2]) == null ? void 0 : _b2.color;
            if (color2) {
              style2.color = color2;
              style2.backgroundColor = autoBackgroundColor(color2);
            }
            label.push(/* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: style2, children: arr[j2] }));
          }
        }
      }
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        radius: "sm",
        size: size2,
        variant: "light",
        onPress: editor2 ? showEditor : void 0,
        children: label
      }
    );
  } else {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(card_default, { isPressable: !!editor2, onPress: editor2 ? showEditor : void 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { className: "flex flex-wrap gap-1", children: value2 == null ? void 0 : value2.map((v2, i2) => {
      var _a3, _b3;
      const label = [];
      for (let j2 = 0; j2 < v2.length; j2++) {
        if (j2 != 0) {
          label.push("/");
        }
        const style2 = {};
        const color2 = (_b3 = (_a3 = valueAttributes == null ? void 0 : valueAttributes[i2]) == null ? void 0 : _a3[j2]) == null ? void 0 : _b3.color;
        if (color2) {
          style2.color = color2;
          style2.backgroundColor = autoBackgroundColor(color2);
        }
        label.push(/* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: style2, children: v2[j2] }));
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: size2, variant: "flat", children: label });
    }) }) });
  }
};
MultilevelValueRenderer.displayName = "MultilevelValueRenderer";
buildLogger("TagsValueRenderer");
const TagsValueRenderer = (props) => {
  const { createPortal } = useBakabaseContext();
  const { value: value2, editor: editor2, variant, getDataSource, valueAttributes, size: size2 } = props;
  const simpleLabels = value2 == null ? void 0 : value2.map((v2) => {
    if (v2.group != void 0 && v2.group.length > 0) {
      return `${v2.group}:${v2.name}`;
    }
    return v2.name;
  });
  const showEditor = () => {
    createPortal(MultilevelValueEditor, {
      value: editor2 == null ? void 0 : editor2.value,
      multiple: true,
      getDataSource: async () => {
        const ds = await (getDataSource == null ? void 0 : getDataSource()) || [];
        const data = [];
        for (const d2 of ds) {
          if (d2.group == void 0 || d2.group.length == 0) {
            data.push({
              value: d2.value,
              label: d2.name
            });
          } else {
            let group = data.find((x2) => x2.label == d2.group);
            if (!group) {
              group = {
                value: uuidv4(),
                label: d2.group,
                children: []
              };
              data.push(group);
            }
            group.children.push({
              value: d2.value,
              label: d2.name
            });
          }
        }
        return data;
      },
      onValueChange: (dbValue, bizValue) => {
        var _a2;
        if (dbValue) {
          const bv = [];
          for (const b2 of bizValue) {
            if (b2.length == 1) {
              bv.push({
                name: b2[0]
              });
            } else {
              bv.push({
                name: b2[1],
                group: b2[0]
              });
            }
          }
          (_a2 = editor2 == null ? void 0 : editor2.onValueChange) == null ? void 0 : _a2.call(editor2, dbValue, bv);
        }
      }
    });
  };
  const startEditing = editor2 ? showEditor : void 0;
  if (!value2 || value2.length == 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { onClick: startEditing, size: size2 });
  }
  if (variant == "light") {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { onClick: startEditing, children: simpleLabels == null ? void 0 : simpleLabels.map((l2, i2) => {
      var _a2;
      const styles2 = {};
      styles2.color = (_a2 = valueAttributes == null ? void 0 : valueAttributes[i2]) == null ? void 0 : _a2.color;
      if (styles2.color) {
        styles2.backgroundColor = autoBackgroundColor(styles2.color);
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        i2 != 0 && ",",
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: styles2, children: l2 })
      ] });
    }) });
  } else {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", onClick: startEditing, children: simpleLabels == null ? void 0 : simpleLabels.map((l2, i2) => {
      var _a2;
      const styles2 = {};
      styles2.color = (_a2 = valueAttributes == null ? void 0 : valueAttributes[i2]) == null ? void 0 : _a2.color;
      if (styles2.color) {
        styles2.backgroundColor = autoBackgroundColor(styles2.color);
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: size2, style: styles2, children: l2 });
    }) });
  }
};
TagsValueRenderer.displayName = "TagsValueRenderer";
const TimeValueRenderer = ({
  value: value2,
  format: format2,
  variant,
  editor: editor2,
  size: size2,
  ...props
}) => {
  const [editing, setEditing] = reactExports.useState(false);
  const editingValueRef = reactExports.useRef();
  const f2 = format2 == void 0 ? "HH:mm:ss" : format2;
  const startEditing = editor2 ? () => {
    editingValueRef.current = value2;
    setEditing(true);
  } : void 0;
  if (editing) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      TimeInput,
      {
        isReadOnly: !editor2,
        value: value2,
        size: size2,
        onBlur: (x2) => {
          var _a2;
          (_a2 = editor2 == null ? void 0 : editor2.onValueChange) == null ? void 0 : _a2.call(
            editor2,
            editingValueRef.current,
            editingValueRef.current
          );
          setEditing(false);
        },
        onChange: (x2) => editingValueRef.current = x2
      }
    );
  }
  if (value2 == void 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { onClick: startEditing, size: size2 });
  } else {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { onClick: startEditing, children: value2 == null ? void 0 : value2.format(f2) });
  }
};
TimeValueRenderer.displayName = "TimeValueRenderer";
buildLogger("StandardValueRenderer");
const StandardValueRenderer = (props) => {
  const { value: value2, type: type4, variant = "default", propertyType } = props;
  switch (type4) {
    case StandardValueType.String:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        StringValueRenderer,
        {
          multiline: propertyType == PropertyType.MultilineText,
          value: value2,
          variant
        }
      );
    case StandardValueType.ListString: {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        TagsValueRenderer,
        {
          value: value2 == null ? void 0 : value2.map((v2) => ({ name: v2 })),
          variant
        }
      );
    }
    case StandardValueType.Decimal:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        NumberValueRenderer,
        {
          as: propertyType == void 0 || propertyType == PropertyType.Rating || propertyType == PropertyType.Number ? "number" : "progress",
          value: value2,
          variant
        }
      );
    case StandardValueType.Link:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(LinkValueRenderer, { value: value2, variant });
    case StandardValueType.Boolean:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(BooleanValueRenderer, { value: value2, variant });
    case StandardValueType.DateTime: {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        DateTimeValueRenderer,
        {
          as: propertyType == void 0 || propertyType == PropertyType.DateTime ? "datetime" : "date",
          format: propertyType == void 0 || propertyType == PropertyType.DateTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD",
          value: value2,
          variant
        }
      );
    }
    case StandardValueType.Time: {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(TimeValueRenderer, { format: "HH:mm:ss", value: value2, variant });
    }
    case StandardValueType.ListListString: {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(MultilevelValueRenderer, { value: value2, variant });
    }
    case StandardValueType.ListTag:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(TagsValueRenderer, { value: value2, variant });
  }
};
function useCombinedRefs() {
  for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
    refs[_key] = arguments[_key];
  }
  return reactExports.useMemo(
    () => (node2) => {
      refs.forEach((ref) => ref(node2));
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    refs
  );
}
const canUseDOM2 = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
function isWindow2(element2) {
  const elementString = Object.prototype.toString.call(element2);
  return elementString === "[object Window]" || // In Electron context the Window object serializes to [object global]
  elementString === "[object global]";
}
function isNode(node2) {
  return "nodeType" in node2;
}
function getWindow$1(target) {
  var _target$ownerDocument, _target$ownerDocument2;
  if (!target) {
    return window;
  }
  if (isWindow2(target)) {
    return target;
  }
  if (!isNode(target)) {
    return window;
  }
  return (_target$ownerDocument = (_target$ownerDocument2 = target.ownerDocument) == null ? void 0 : _target$ownerDocument2.defaultView) != null ? _target$ownerDocument : window;
}
function isDocument(node2) {
  const {
    Document
  } = getWindow$1(node2);
  return node2 instanceof Document;
}
function isHTMLElement(node2) {
  if (isWindow2(node2)) {
    return false;
  }
  return node2 instanceof getWindow$1(node2).HTMLElement;
}
function isSVGElement(node2) {
  return node2 instanceof getWindow$1(node2).SVGElement;
}
function getOwnerDocument(target) {
  if (!target) {
    return document;
  }
  if (isWindow2(target)) {
    return target.document;
  }
  if (!isNode(target)) {
    return document;
  }
  if (isDocument(target)) {
    return target;
  }
  if (isHTMLElement(target) || isSVGElement(target)) {
    return target.ownerDocument;
  }
  return document;
}
const useIsomorphicLayoutEffect = canUseDOM2 ? reactExports.useLayoutEffect : reactExports.useEffect;
function useEvent(handler) {
  const handlerRef = reactExports.useRef(handler);
  useIsomorphicLayoutEffect(() => {
    handlerRef.current = handler;
  });
  return reactExports.useCallback(function() {
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    return handlerRef.current == null ? void 0 : handlerRef.current(...args);
  }, []);
}
function useInterval() {
  const intervalRef = reactExports.useRef(null);
  const set2 = reactExports.useCallback((listener, duration2) => {
    intervalRef.current = setInterval(listener, duration2);
  }, []);
  const clear = reactExports.useCallback(() => {
    if (intervalRef.current !== null) {
      clearInterval(intervalRef.current);
      intervalRef.current = null;
    }
  }, []);
  return [set2, clear];
}
function useLatestValue(value2, dependencies) {
  if (dependencies === void 0) {
    dependencies = [value2];
  }
  const valueRef = reactExports.useRef(value2);
  useIsomorphicLayoutEffect(() => {
    if (valueRef.current !== value2) {
      valueRef.current = value2;
    }
  }, dependencies);
  return valueRef;
}
function useLazyMemo(callback2, dependencies) {
  const valueRef = reactExports.useRef();
  return reactExports.useMemo(
    () => {
      const newValue = callback2(valueRef.current);
      valueRef.current = newValue;
      return newValue;
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [...dependencies]
  );
}
function useNodeRef(onChange) {
  const onChangeHandler = useEvent(onChange);
  const node2 = reactExports.useRef(null);
  const setNodeRef = reactExports.useCallback(
    (element2) => {
      if (element2 !== node2.current) {
        onChangeHandler == null ? void 0 : onChangeHandler(element2, node2.current);
      }
      node2.current = element2;
    },
    //eslint-disable-next-line
    []
  );
  return [node2, setNodeRef];
}
function usePrevious2(value2) {
  const ref = reactExports.useRef();
  reactExports.useEffect(() => {
    ref.current = value2;
  }, [value2]);
  return ref.current;
}
let ids = {};
function useUniqueId(prefix, value2) {
  return reactExports.useMemo(() => {
    if (value2) {
      return value2;
    }
    const id2 = ids[prefix] == null ? 0 : ids[prefix] + 1;
    ids[prefix] = id2;
    return prefix + "-" + id2;
  }, [prefix, value2]);
}
function createAdjustmentFn(modifier) {
  return function(object4) {
    for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
      adjustments[_key - 1] = arguments[_key];
    }
    return adjustments.reduce((accumulator, adjustment) => {
      const entries = Object.entries(adjustment);
      for (const [key, valueAdjustment] of entries) {
        const value2 = accumulator[key];
        if (value2 != null) {
          accumulator[key] = value2 + modifier * valueAdjustment;
        }
      }
      return accumulator;
    }, {
      ...object4
    });
  };
}
const add = /* @__PURE__ */ createAdjustmentFn(1);
const subtract = /* @__PURE__ */ createAdjustmentFn(-1);
function hasViewportRelativeCoordinates(event) {
  return "clientX" in event && "clientY" in event;
}
function isKeyboardEvent(event) {
  if (!event) {
    return false;
  }
  const {
    KeyboardEvent: KeyboardEvent2
  } = getWindow$1(event.target);
  return KeyboardEvent2 && event instanceof KeyboardEvent2;
}
function isTouchEvent$1(event) {
  if (!event) {
    return false;
  }
  const {
    TouchEvent
  } = getWindow$1(event.target);
  return TouchEvent && event instanceof TouchEvent;
}
function getEventCoordinates(event) {
  if (isTouchEvent$1(event)) {
    if (event.touches && event.touches.length) {
      const {
        clientX: x2,
        clientY: y2
      } = event.touches[0];
      return {
        x: x2,
        y: y2
      };
    } else if (event.changedTouches && event.changedTouches.length) {
      const {
        clientX: x2,
        clientY: y2
      } = event.changedTouches[0];
      return {
        x: x2,
        y: y2
      };
    }
  }
  if (hasViewportRelativeCoordinates(event)) {
    return {
      x: event.clientX,
      y: event.clientY
    };
  }
  return null;
}
const CSS$1 = /* @__PURE__ */ Object.freeze({
  Translate: {
    toString(transform2) {
      if (!transform2) {
        return;
      }
      const {
        x: x2,
        y: y2
      } = transform2;
      return "translate3d(" + (x2 ? Math.round(x2) : 0) + "px, " + (y2 ? Math.round(y2) : 0) + "px, 0)";
    }
  },
  Scale: {
    toString(transform2) {
      if (!transform2) {
        return;
      }
      const {
        scaleX,
        scaleY
      } = transform2;
      return "scaleX(" + scaleX + ") scaleY(" + scaleY + ")";
    }
  },
  Transform: {
    toString(transform2) {
      if (!transform2) {
        return;
      }
      return [CSS$1.Translate.toString(transform2), CSS$1.Scale.toString(transform2)].join(" ");
    }
  },
  Transition: {
    toString(_ref) {
      let {
        property: property2,
        duration: duration2,
        easing
      } = _ref;
      return property2 + " " + duration2 + "ms " + easing;
    }
  }
});
const SELECTOR = "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";
function findFirstFocusableNode(element2) {
  if (element2.matches(SELECTOR)) {
    return element2;
  }
  return element2.querySelector(SELECTOR);
}
const hiddenStyles = {
  display: "none"
};
function HiddenText(_ref) {
  let {
    id: id2,
    value: value2
  } = _ref;
  return React$5.createElement("div", {
    id: id2,
    style: hiddenStyles
  }, value2);
}
function LiveRegion(_ref) {
  let {
    id: id2,
    announcement,
    ariaLiveType = "assertive"
  } = _ref;
  const visuallyHidden = {
    position: "fixed",
    top: 0,
    left: 0,
    width: 1,
    height: 1,
    margin: -1,
    border: 0,
    padding: 0,
    overflow: "hidden",
    clip: "rect(0 0 0 0)",
    clipPath: "inset(100%)",
    whiteSpace: "nowrap"
  };
  return React$5.createElement("div", {
    id: id2,
    style: visuallyHidden,
    role: "status",
    "aria-live": ariaLiveType,
    "aria-atomic": true
  }, announcement);
}
function useAnnouncement() {
  const [announcement, setAnnouncement] = reactExports.useState("");
  const announce = reactExports.useCallback((value2) => {
    if (value2 != null) {
      setAnnouncement(value2);
    }
  }, []);
  return {
    announce,
    announcement
  };
}
const DndMonitorContext = /* @__PURE__ */ reactExports.createContext(null);
function useDndMonitor(listener) {
  const registerListener = reactExports.useContext(DndMonitorContext);
  reactExports.useEffect(() => {
    if (!registerListener) {
      throw new Error("useDndMonitor must be used within a children of <DndContext>");
    }
    const unsubscribe = registerListener(listener);
    return unsubscribe;
  }, [listener, registerListener]);
}
function useDndMonitorProvider() {
  const [listeners] = reactExports.useState(() => /* @__PURE__ */ new Set());
  const registerListener = reactExports.useCallback((listener) => {
    listeners.add(listener);
    return () => listeners.delete(listener);
  }, [listeners]);
  const dispatch = reactExports.useCallback((_ref) => {
    let {
      type: type4,
      event
    } = _ref;
    listeners.forEach((listener) => {
      var _listener$type;
      return (_listener$type = listener[type4]) == null ? void 0 : _listener$type.call(listener, event);
    });
  }, [listeners]);
  return [dispatch, registerListener];
}
const defaultScreenReaderInstructions = {
  draggable: "\n    To pick up a draggable item, press the space bar.\n    While dragging, use the arrow keys to move the item.\n    Press space again to drop the item in its new position, or press escape to cancel.\n  "
};
const defaultAnnouncements = {
  onDragStart(_ref) {
    let {
      active: active3
    } = _ref;
    return "Picked up draggable item " + active3.id + ".";
  },
  onDragOver(_ref2) {
    let {
      active: active3,
      over
    } = _ref2;
    if (over) {
      return "Draggable item " + active3.id + " was moved over droppable area " + over.id + ".";
    }
    return "Draggable item " + active3.id + " is no longer over a droppable area.";
  },
  onDragEnd(_ref3) {
    let {
      active: active3,
      over
    } = _ref3;
    if (over) {
      return "Draggable item " + active3.id + " was dropped over droppable area " + over.id;
    }
    return "Draggable item " + active3.id + " was dropped.";
  },
  onDragCancel(_ref4) {
    let {
      active: active3
    } = _ref4;
    return "Dragging was cancelled. Draggable item " + active3.id + " was dropped.";
  }
};
function Accessibility(_ref) {
  let {
    announcements = defaultAnnouncements,
    container,
    hiddenTextDescribedById,
    screenReaderInstructions = defaultScreenReaderInstructions
  } = _ref;
  const {
    announce,
    announcement
  } = useAnnouncement();
  const liveRegionId = useUniqueId("DndLiveRegion");
  const [mounted, setMounted] = reactExports.useState(false);
  reactExports.useEffect(() => {
    setMounted(true);
  }, []);
  useDndMonitor(reactExports.useMemo(() => ({
    onDragStart(_ref2) {
      let {
        active: active3
      } = _ref2;
      announce(announcements.onDragStart({
        active: active3
      }));
    },
    onDragMove(_ref3) {
      let {
        active: active3,
        over
      } = _ref3;
      if (announcements.onDragMove) {
        announce(announcements.onDragMove({
          active: active3,
          over
        }));
      }
    },
    onDragOver(_ref4) {
      let {
        active: active3,
        over
      } = _ref4;
      announce(announcements.onDragOver({
        active: active3,
        over
      }));
    },
    onDragEnd(_ref5) {
      let {
        active: active3,
        over
      } = _ref5;
      announce(announcements.onDragEnd({
        active: active3,
        over
      }));
    },
    onDragCancel(_ref6) {
      let {
        active: active3,
        over
      } = _ref6;
      announce(announcements.onDragCancel({
        active: active3,
        over
      }));
    }
  }), [announce, announcements]));
  if (!mounted) {
    return null;
  }
  const markup = React$5.createElement(React$5.Fragment, null, React$5.createElement(HiddenText, {
    id: hiddenTextDescribedById,
    value: screenReaderInstructions.draggable
  }), React$5.createElement(LiveRegion, {
    id: liveRegionId,
    announcement
  }));
  return container ? reactDomExports.createPortal(markup, container) : markup;
}
var Action;
(function(Action2) {
  Action2["DragStart"] = "dragStart";
  Action2["DragMove"] = "dragMove";
  Action2["DragEnd"] = "dragEnd";
  Action2["DragCancel"] = "dragCancel";
  Action2["DragOver"] = "dragOver";
  Action2["RegisterDroppable"] = "registerDroppable";
  Action2["SetDroppableDisabled"] = "setDroppableDisabled";
  Action2["UnregisterDroppable"] = "unregisterDroppable";
})(Action || (Action = {}));
function noop3() {
}
function useSensor(sensor, options) {
  return reactExports.useMemo(
    () => ({
      sensor,
      options: options != null ? options : {}
    }),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [sensor, options]
  );
}
function useSensors() {
  for (var _len = arguments.length, sensors = new Array(_len), _key = 0; _key < _len; _key++) {
    sensors[_key] = arguments[_key];
  }
  return reactExports.useMemo(
    () => [...sensors].filter((sensor) => sensor != null),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [...sensors]
  );
}
const defaultCoordinates = /* @__PURE__ */ Object.freeze({
  x: 0,
  y: 0
});
function distanceBetween(p1, p2) {
  return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
}
function sortCollisionsAsc(_ref, _ref2) {
  let {
    data: {
      value: a2
    }
  } = _ref;
  let {
    data: {
      value: b2
    }
  } = _ref2;
  return a2 - b2;
}
function sortCollisionsDesc(_ref3, _ref4) {
  let {
    data: {
      value: a2
    }
  } = _ref3;
  let {
    data: {
      value: b2
    }
  } = _ref4;
  return b2 - a2;
}
function cornersOfRectangle(_ref5) {
  let {
    left: left2,
    top: top2,
    height,
    width
  } = _ref5;
  return [{
    x: left2,
    y: top2
  }, {
    x: left2 + width,
    y: top2
  }, {
    x: left2,
    y: top2 + height
  }, {
    x: left2 + width,
    y: top2 + height
  }];
}
function getFirstCollision(collisions, property2) {
  if (!collisions || collisions.length === 0) {
    return null;
  }
  const [firstCollision] = collisions;
  return firstCollision[property2];
}
function centerOfRectangle(rect, left2, top2) {
  if (left2 === void 0) {
    left2 = rect.left;
  }
  if (top2 === void 0) {
    top2 = rect.top;
  }
  return {
    x: left2 + rect.width * 0.5,
    y: top2 + rect.height * 0.5
  };
}
const closestCenter = (_ref) => {
  let {
    collisionRect,
    droppableRects,
    droppableContainers
  } = _ref;
  const centerRect = centerOfRectangle(collisionRect, collisionRect.left, collisionRect.top);
  const collisions = [];
  for (const droppableContainer of droppableContainers) {
    const {
      id: id2
    } = droppableContainer;
    const rect = droppableRects.get(id2);
    if (rect) {
      const distBetween = distanceBetween(centerOfRectangle(rect), centerRect);
      collisions.push({
        id: id2,
        data: {
          droppableContainer,
          value: distBetween
        }
      });
    }
  }
  return collisions.sort(sortCollisionsAsc);
};
const closestCorners = (_ref) => {
  let {
    collisionRect,
    droppableRects,
    droppableContainers
  } = _ref;
  const corners = cornersOfRectangle(collisionRect);
  const collisions = [];
  for (const droppableContainer of droppableContainers) {
    const {
      id: id2
    } = droppableContainer;
    const rect = droppableRects.get(id2);
    if (rect) {
      const rectCorners = cornersOfRectangle(rect);
      const distances = corners.reduce((accumulator, corner, index2) => {
        return accumulator + distanceBetween(rectCorners[index2], corner);
      }, 0);
      const effectiveDistance = Number((distances / 4).toFixed(4));
      collisions.push({
        id: id2,
        data: {
          droppableContainer,
          value: effectiveDistance
        }
      });
    }
  }
  return collisions.sort(sortCollisionsAsc);
};
function getIntersectionRatio(entry, target) {
  const top2 = Math.max(target.top, entry.top);
  const left2 = Math.max(target.left, entry.left);
  const right = Math.min(target.left + target.width, entry.left + entry.width);
  const bottom2 = Math.min(target.top + target.height, entry.top + entry.height);
  const width = right - left2;
  const height = bottom2 - top2;
  if (left2 < right && top2 < bottom2) {
    const targetArea = target.width * target.height;
    const entryArea = entry.width * entry.height;
    const intersectionArea = width * height;
    const intersectionRatio = intersectionArea / (targetArea + entryArea - intersectionArea);
    return Number(intersectionRatio.toFixed(4));
  }
  return 0;
}
const rectIntersection = (_ref) => {
  let {
    collisionRect,
    droppableRects,
    droppableContainers
  } = _ref;
  const collisions = [];
  for (const droppableContainer of droppableContainers) {
    const {
      id: id2
    } = droppableContainer;
    const rect = droppableRects.get(id2);
    if (rect) {
      const intersectionRatio = getIntersectionRatio(rect, collisionRect);
      if (intersectionRatio > 0) {
        collisions.push({
          id: id2,
          data: {
            droppableContainer,
            value: intersectionRatio
          }
        });
      }
    }
  }
  return collisions.sort(sortCollisionsDesc);
};
function adjustScale(transform2, rect1, rect2) {
  return {
    ...transform2,
    scaleX: rect1 && rect2 ? rect1.width / rect2.width : 1,
    scaleY: rect1 && rect2 ? rect1.height / rect2.height : 1
  };
}
function getRectDelta(rect1, rect2) {
  return rect1 && rect2 ? {
    x: rect1.left - rect2.left,
    y: rect1.top - rect2.top
  } : defaultCoordinates;
}
function createRectAdjustmentFn(modifier) {
  return function adjustClientRect(rect) {
    for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
      adjustments[_key - 1] = arguments[_key];
    }
    return adjustments.reduce((acc, adjustment) => ({
      ...acc,
      top: acc.top + modifier * adjustment.y,
      bottom: acc.bottom + modifier * adjustment.y,
      left: acc.left + modifier * adjustment.x,
      right: acc.right + modifier * adjustment.x
    }), {
      ...rect
    });
  };
}
const getAdjustedRect = /* @__PURE__ */ createRectAdjustmentFn(1);
function parseTransform(transform2) {
  if (transform2.startsWith("matrix3d(")) {
    const transformArray = transform2.slice(9, -1).split(/, /);
    return {
      x: +transformArray[12],
      y: +transformArray[13],
      scaleX: +transformArray[0],
      scaleY: +transformArray[5]
    };
  } else if (transform2.startsWith("matrix(")) {
    const transformArray = transform2.slice(7, -1).split(/, /);
    return {
      x: +transformArray[4],
      y: +transformArray[5],
      scaleX: +transformArray[0],
      scaleY: +transformArray[3]
    };
  }
  return null;
}
function inverseTransform(rect, transform2, transformOrigin) {
  const parsedTransform = parseTransform(transform2);
  if (!parsedTransform) {
    return rect;
  }
  const {
    scaleX,
    scaleY,
    x: translateX,
    y: translateY
  } = parsedTransform;
  const x2 = rect.left - translateX - (1 - scaleX) * parseFloat(transformOrigin);
  const y2 = rect.top - translateY - (1 - scaleY) * parseFloat(transformOrigin.slice(transformOrigin.indexOf(" ") + 1));
  const w2 = scaleX ? rect.width / scaleX : rect.width;
  const h3 = scaleY ? rect.height / scaleY : rect.height;
  return {
    width: w2,
    height: h3,
    top: y2,
    right: x2 + w2,
    bottom: y2 + h3,
    left: x2
  };
}
const defaultOptions = {
  ignoreTransform: false
};
function getClientRect(element2, options) {
  if (options === void 0) {
    options = defaultOptions;
  }
  let rect = element2.getBoundingClientRect();
  if (options.ignoreTransform) {
    const {
      transform: transform2,
      transformOrigin
    } = getWindow$1(element2).getComputedStyle(element2);
    if (transform2) {
      rect = inverseTransform(rect, transform2, transformOrigin);
    }
  }
  const {
    top: top2,
    left: left2,
    width,
    height,
    bottom: bottom2,
    right
  } = rect;
  return {
    top: top2,
    left: left2,
    width,
    height,
    bottom: bottom2,
    right
  };
}
function getTransformAgnosticClientRect(element2) {
  return getClientRect(element2, {
    ignoreTransform: true
  });
}
function getWindowClientRect(element2) {
  const width = element2.innerWidth;
  const height = element2.innerHeight;
  return {
    top: 0,
    left: 0,
    right: width,
    bottom: height,
    width,
    height
  };
}
function isFixed(node2, computedStyle) {
  if (computedStyle === void 0) {
    computedStyle = getWindow$1(node2).getComputedStyle(node2);
  }
  return computedStyle.position === "fixed";
}
function isScrollable$1(element2, computedStyle) {
  if (computedStyle === void 0) {
    computedStyle = getWindow$1(element2).getComputedStyle(element2);
  }
  const overflowRegex = /(auto|scroll|overlay)/;
  const properties2 = ["overflow", "overflowX", "overflowY"];
  return properties2.some((property2) => {
    const value2 = computedStyle[property2];
    return typeof value2 === "string" ? overflowRegex.test(value2) : false;
  });
}
function getScrollableAncestors(element2, limit2) {
  const scrollParents = [];
  function findScrollableAncestors(node2) {
    if (limit2 != null && scrollParents.length >= limit2) {
      return scrollParents;
    }
    if (!node2) {
      return scrollParents;
    }
    if (isDocument(node2) && node2.scrollingElement != null && !scrollParents.includes(node2.scrollingElement)) {
      scrollParents.push(node2.scrollingElement);
      return scrollParents;
    }
    if (!isHTMLElement(node2) || isSVGElement(node2)) {
      return scrollParents;
    }
    if (scrollParents.includes(node2)) {
      return scrollParents;
    }
    const computedStyle = getWindow$1(element2).getComputedStyle(node2);
    if (node2 !== element2) {
      if (isScrollable$1(node2, computedStyle)) {
        scrollParents.push(node2);
      }
    }
    if (isFixed(node2, computedStyle)) {
      return scrollParents;
    }
    return findScrollableAncestors(node2.parentNode);
  }
  if (!element2) {
    return scrollParents;
  }
  return findScrollableAncestors(element2);
}
function getFirstScrollableAncestor(node2) {
  const [firstScrollableAncestor] = getScrollableAncestors(node2, 1);
  return firstScrollableAncestor != null ? firstScrollableAncestor : null;
}
function getScrollableElement(element2) {
  if (!canUseDOM2 || !element2) {
    return null;
  }
  if (isWindow2(element2)) {
    return element2;
  }
  if (!isNode(element2)) {
    return null;
  }
  if (isDocument(element2) || element2 === getOwnerDocument(element2).scrollingElement) {
    return window;
  }
  if (isHTMLElement(element2)) {
    return element2;
  }
  return null;
}
function getScrollXCoordinate(element2) {
  if (isWindow2(element2)) {
    return element2.scrollX;
  }
  return element2.scrollLeft;
}
function getScrollYCoordinate(element2) {
  if (isWindow2(element2)) {
    return element2.scrollY;
  }
  return element2.scrollTop;
}
function getScrollCoordinates(element2) {
  return {
    x: getScrollXCoordinate(element2),
    y: getScrollYCoordinate(element2)
  };
}
var Direction;
(function(Direction2) {
  Direction2[Direction2["Forward"] = 1] = "Forward";
  Direction2[Direction2["Backward"] = -1] = "Backward";
})(Direction || (Direction = {}));
function isDocumentScrollingElement(element2) {
  if (!canUseDOM2 || !element2) {
    return false;
  }
  return element2 === document.scrollingElement;
}
function getScrollPosition(scrollingContainer) {
  const minScroll = {
    x: 0,
    y: 0
  };
  const dimensions = isDocumentScrollingElement(scrollingContainer) ? {
    height: window.innerHeight,
    width: window.innerWidth
  } : {
    height: scrollingContainer.clientHeight,
    width: scrollingContainer.clientWidth
  };
  const maxScroll = {
    x: scrollingContainer.scrollWidth - dimensions.width,
    y: scrollingContainer.scrollHeight - dimensions.height
  };
  const isTop = scrollingContainer.scrollTop <= minScroll.y;
  const isLeft = scrollingContainer.scrollLeft <= minScroll.x;
  const isBottom = scrollingContainer.scrollTop >= maxScroll.y;
  const isRight = scrollingContainer.scrollLeft >= maxScroll.x;
  return {
    isTop,
    isLeft,
    isBottom,
    isRight,
    maxScroll,
    minScroll
  };
}
const defaultThreshold = {
  x: 0.2,
  y: 0.2
};
function getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, _ref, acceleration, thresholdPercentage) {
  let {
    top: top2,
    left: left2,
    right,
    bottom: bottom2
  } = _ref;
  if (acceleration === void 0) {
    acceleration = 10;
  }
  if (thresholdPercentage === void 0) {
    thresholdPercentage = defaultThreshold;
  }
  const {
    isTop,
    isBottom,
    isLeft,
    isRight
  } = getScrollPosition(scrollContainer);
  const direction = {
    x: 0,
    y: 0
  };
  const speed = {
    x: 0,
    y: 0
  };
  const threshold = {
    height: scrollContainerRect.height * thresholdPercentage.y,
    width: scrollContainerRect.width * thresholdPercentage.x
  };
  if (!isTop && top2 <= scrollContainerRect.top + threshold.height) {
    direction.y = Direction.Backward;
    speed.y = acceleration * Math.abs((scrollContainerRect.top + threshold.height - top2) / threshold.height);
  } else if (!isBottom && bottom2 >= scrollContainerRect.bottom - threshold.height) {
    direction.y = Direction.Forward;
    speed.y = acceleration * Math.abs((scrollContainerRect.bottom - threshold.height - bottom2) / threshold.height);
  }
  if (!isRight && right >= scrollContainerRect.right - threshold.width) {
    direction.x = Direction.Forward;
    speed.x = acceleration * Math.abs((scrollContainerRect.right - threshold.width - right) / threshold.width);
  } else if (!isLeft && left2 <= scrollContainerRect.left + threshold.width) {
    direction.x = Direction.Backward;
    speed.x = acceleration * Math.abs((scrollContainerRect.left + threshold.width - left2) / threshold.width);
  }
  return {
    direction,
    speed
  };
}
function getScrollElementRect(element2) {
  if (element2 === document.scrollingElement) {
    const {
      innerWidth: innerWidth2,
      innerHeight: innerHeight2
    } = window;
    return {
      top: 0,
      left: 0,
      right: innerWidth2,
      bottom: innerHeight2,
      width: innerWidth2,
      height: innerHeight2
    };
  }
  const {
    top: top2,
    left: left2,
    right,
    bottom: bottom2
  } = element2.getBoundingClientRect();
  return {
    top: top2,
    left: left2,
    right,
    bottom: bottom2,
    width: element2.clientWidth,
    height: element2.clientHeight
  };
}
function getScrollOffsets(scrollableAncestors) {
  return scrollableAncestors.reduce((acc, node2) => {
    return add(acc, getScrollCoordinates(node2));
  }, defaultCoordinates);
}
function getScrollXOffset(scrollableAncestors) {
  return scrollableAncestors.reduce((acc, node2) => {
    return acc + getScrollXCoordinate(node2);
  }, 0);
}
function getScrollYOffset(scrollableAncestors) {
  return scrollableAncestors.reduce((acc, node2) => {
    return acc + getScrollYCoordinate(node2);
  }, 0);
}
function scrollIntoViewIfNeeded(element2, measure) {
  if (measure === void 0) {
    measure = getClientRect;
  }
  if (!element2) {
    return;
  }
  const {
    top: top2,
    left: left2,
    bottom: bottom2,
    right
  } = measure(element2);
  const firstScrollableAncestor = getFirstScrollableAncestor(element2);
  if (!firstScrollableAncestor) {
    return;
  }
  if (bottom2 <= 0 || right <= 0 || top2 >= window.innerHeight || left2 >= window.innerWidth) {
    element2.scrollIntoView({
      block: "center",
      inline: "center"
    });
  }
}
const properties = [["x", ["left", "right"], getScrollXOffset], ["y", ["top", "bottom"], getScrollYOffset]];
class Rect {
  constructor(rect, element2) {
    this.rect = void 0;
    this.width = void 0;
    this.height = void 0;
    this.top = void 0;
    this.bottom = void 0;
    this.right = void 0;
    this.left = void 0;
    const scrollableAncestors = getScrollableAncestors(element2);
    const scrollOffsets = getScrollOffsets(scrollableAncestors);
    this.rect = {
      ...rect
    };
    this.width = rect.width;
    this.height = rect.height;
    for (const [axis, keys2, getScrollOffset2] of properties) {
      for (const key of keys2) {
        Object.defineProperty(this, key, {
          get: () => {
            const currentOffsets = getScrollOffset2(scrollableAncestors);
            const scrollOffsetsDeltla = scrollOffsets[axis] - currentOffsets;
            return this.rect[key] + scrollOffsetsDeltla;
          },
          enumerable: true
        });
      }
    }
    Object.defineProperty(this, "rect", {
      enumerable: false
    });
  }
}
class Listeners {
  constructor(target) {
    this.target = void 0;
    this.listeners = [];
    this.removeAll = () => {
      this.listeners.forEach((listener) => {
        var _this$target;
        return (_this$target = this.target) == null ? void 0 : _this$target.removeEventListener(...listener);
      });
    };
    this.target = target;
  }
  add(eventName, handler, options) {
    var _this$target2;
    (_this$target2 = this.target) == null ? void 0 : _this$target2.addEventListener(eventName, handler, options);
    this.listeners.push([eventName, handler, options]);
  }
}
function getEventListenerTarget(target) {
  const {
    EventTarget: EventTarget2
  } = getWindow$1(target);
  return target instanceof EventTarget2 ? target : getOwnerDocument(target);
}
function hasExceededDistance(delta, measurement) {
  const dx = Math.abs(delta.x);
  const dy = Math.abs(delta.y);
  if (typeof measurement === "number") {
    return Math.sqrt(dx ** 2 + dy ** 2) > measurement;
  }
  if ("x" in measurement && "y" in measurement) {
    return dx > measurement.x && dy > measurement.y;
  }
  if ("x" in measurement) {
    return dx > measurement.x;
  }
  if ("y" in measurement) {
    return dy > measurement.y;
  }
  return false;
}
var EventName;
(function(EventName2) {
  EventName2["Click"] = "click";
  EventName2["DragStart"] = "dragstart";
  EventName2["Keydown"] = "keydown";
  EventName2["ContextMenu"] = "contextmenu";
  EventName2["Resize"] = "resize";
  EventName2["SelectionChange"] = "selectionchange";
  EventName2["VisibilityChange"] = "visibilitychange";
})(EventName || (EventName = {}));
function preventDefault(event) {
  event.preventDefault();
}
function stopPropagation(event) {
  event.stopPropagation();
}
var KeyboardCode;
(function(KeyboardCode2) {
  KeyboardCode2["Space"] = "Space";
  KeyboardCode2["Down"] = "ArrowDown";
  KeyboardCode2["Right"] = "ArrowRight";
  KeyboardCode2["Left"] = "ArrowLeft";
  KeyboardCode2["Up"] = "ArrowUp";
  KeyboardCode2["Esc"] = "Escape";
  KeyboardCode2["Enter"] = "Enter";
  KeyboardCode2["Tab"] = "Tab";
})(KeyboardCode || (KeyboardCode = {}));
const defaultKeyboardCodes = {
  start: [KeyboardCode.Space, KeyboardCode.Enter],
  cancel: [KeyboardCode.Esc],
  end: [KeyboardCode.Space, KeyboardCode.Enter, KeyboardCode.Tab]
};
const defaultKeyboardCoordinateGetter = (event, _ref) => {
  let {
    currentCoordinates
  } = _ref;
  switch (event.code) {
    case KeyboardCode.Right:
      return {
        ...currentCoordinates,
        x: currentCoordinates.x + 25
      };
    case KeyboardCode.Left:
      return {
        ...currentCoordinates,
        x: currentCoordinates.x - 25
      };
    case KeyboardCode.Down:
      return {
        ...currentCoordinates,
        y: currentCoordinates.y + 25
      };
    case KeyboardCode.Up:
      return {
        ...currentCoordinates,
        y: currentCoordinates.y - 25
      };
  }
  return void 0;
};
class KeyboardSensor {
  constructor(props) {
    this.props = void 0;
    this.autoScrollEnabled = false;
    this.referenceCoordinates = void 0;
    this.listeners = void 0;
    this.windowListeners = void 0;
    this.props = props;
    const {
      event: {
        target
      }
    } = props;
    this.props = props;
    this.listeners = new Listeners(getOwnerDocument(target));
    this.windowListeners = new Listeners(getWindow$1(target));
    this.handleKeyDown = this.handleKeyDown.bind(this);
    this.handleCancel = this.handleCancel.bind(this);
    this.attach();
  }
  attach() {
    this.handleStart();
    this.windowListeners.add(EventName.Resize, this.handleCancel);
    this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);
    setTimeout(() => this.listeners.add(EventName.Keydown, this.handleKeyDown));
  }
  handleStart() {
    const {
      activeNode,
      onStart
    } = this.props;
    const node2 = activeNode.node.current;
    if (node2) {
      scrollIntoViewIfNeeded(node2);
    }
    onStart(defaultCoordinates);
  }
  handleKeyDown(event) {
    if (isKeyboardEvent(event)) {
      const {
        active: active3,
        context,
        options
      } = this.props;
      const {
        keyboardCodes = defaultKeyboardCodes,
        coordinateGetter = defaultKeyboardCoordinateGetter,
        scrollBehavior = "smooth"
      } = options;
      const {
        code: code2
      } = event;
      if (keyboardCodes.end.includes(code2)) {
        this.handleEnd(event);
        return;
      }
      if (keyboardCodes.cancel.includes(code2)) {
        this.handleCancel(event);
        return;
      }
      const {
        collisionRect
      } = context.current;
      const currentCoordinates = collisionRect ? {
        x: collisionRect.left,
        y: collisionRect.top
      } : defaultCoordinates;
      if (!this.referenceCoordinates) {
        this.referenceCoordinates = currentCoordinates;
      }
      const newCoordinates = coordinateGetter(event, {
        active: active3,
        context: context.current,
        currentCoordinates
      });
      if (newCoordinates) {
        const coordinatesDelta = subtract(newCoordinates, currentCoordinates);
        const scrollDelta = {
          x: 0,
          y: 0
        };
        const {
          scrollableAncestors
        } = context.current;
        for (const scrollContainer of scrollableAncestors) {
          const direction = event.code;
          const {
            isTop,
            isRight,
            isLeft,
            isBottom,
            maxScroll,
            minScroll
          } = getScrollPosition(scrollContainer);
          const scrollElementRect = getScrollElementRect(scrollContainer);
          const clampedCoordinates = {
            x: Math.min(direction === KeyboardCode.Right ? scrollElementRect.right - scrollElementRect.width / 2 : scrollElementRect.right, Math.max(direction === KeyboardCode.Right ? scrollElementRect.left : scrollElementRect.left + scrollElementRect.width / 2, newCoordinates.x)),
            y: Math.min(direction === KeyboardCode.Down ? scrollElementRect.bottom - scrollElementRect.height / 2 : scrollElementRect.bottom, Math.max(direction === KeyboardCode.Down ? scrollElementRect.top : scrollElementRect.top + scrollElementRect.height / 2, newCoordinates.y))
          };
          const canScrollX = direction === KeyboardCode.Right && !isRight || direction === KeyboardCode.Left && !isLeft;
          const canScrollY = direction === KeyboardCode.Down && !isBottom || direction === KeyboardCode.Up && !isTop;
          if (canScrollX && clampedCoordinates.x !== newCoordinates.x) {
            const newScrollCoordinates = scrollContainer.scrollLeft + coordinatesDelta.x;
            const canScrollToNewCoordinates = direction === KeyboardCode.Right && newScrollCoordinates <= maxScroll.x || direction === KeyboardCode.Left && newScrollCoordinates >= minScroll.x;
            if (canScrollToNewCoordinates && !coordinatesDelta.y) {
              scrollContainer.scrollTo({
                left: newScrollCoordinates,
                behavior: scrollBehavior
              });
              return;
            }
            if (canScrollToNewCoordinates) {
              scrollDelta.x = scrollContainer.scrollLeft - newScrollCoordinates;
            } else {
              scrollDelta.x = direction === KeyboardCode.Right ? scrollContainer.scrollLeft - maxScroll.x : scrollContainer.scrollLeft - minScroll.x;
            }
            if (scrollDelta.x) {
              scrollContainer.scrollBy({
                left: -scrollDelta.x,
                behavior: scrollBehavior
              });
            }
            break;
          } else if (canScrollY && clampedCoordinates.y !== newCoordinates.y) {
            const newScrollCoordinates = scrollContainer.scrollTop + coordinatesDelta.y;
            const canScrollToNewCoordinates = direction === KeyboardCode.Down && newScrollCoordinates <= maxScroll.y || direction === KeyboardCode.Up && newScrollCoordinates >= minScroll.y;
            if (canScrollToNewCoordinates && !coordinatesDelta.x) {
              scrollContainer.scrollTo({
                top: newScrollCoordinates,
                behavior: scrollBehavior
              });
              return;
            }
            if (canScrollToNewCoordinates) {
              scrollDelta.y = scrollContainer.scrollTop - newScrollCoordinates;
            } else {
              scrollDelta.y = direction === KeyboardCode.Down ? scrollContainer.scrollTop - maxScroll.y : scrollContainer.scrollTop - minScroll.y;
            }
            if (scrollDelta.y) {
              scrollContainer.scrollBy({
                top: -scrollDelta.y,
                behavior: scrollBehavior
              });
            }
            break;
          }
        }
        this.handleMove(event, add(subtract(newCoordinates, this.referenceCoordinates), scrollDelta));
      }
    }
  }
  handleMove(event, coordinates) {
    const {
      onMove
    } = this.props;
    event.preventDefault();
    onMove(coordinates);
  }
  handleEnd(event) {
    const {
      onEnd
    } = this.props;
    event.preventDefault();
    this.detach();
    onEnd();
  }
  handleCancel(event) {
    const {
      onCancel
    } = this.props;
    event.preventDefault();
    this.detach();
    onCancel();
  }
  detach() {
    this.listeners.removeAll();
    this.windowListeners.removeAll();
  }
}
KeyboardSensor.activators = [{
  eventName: "onKeyDown",
  handler: (event, _ref, _ref2) => {
    let {
      keyboardCodes = defaultKeyboardCodes,
      onActivation
    } = _ref;
    let {
      active: active3
    } = _ref2;
    const {
      code: code2
    } = event.nativeEvent;
    if (keyboardCodes.start.includes(code2)) {
      const activator = active3.activatorNode.current;
      if (activator && event.target !== activator) {
        return false;
      }
      event.preventDefault();
      onActivation == null ? void 0 : onActivation({
        event: event.nativeEvent
      });
      return true;
    }
    return false;
  }
}];
function isDistanceConstraint(constraint) {
  return Boolean(constraint && "distance" in constraint);
}
function isDelayConstraint(constraint) {
  return Boolean(constraint && "delay" in constraint);
}
class AbstractPointerSensor {
  constructor(props, events2, listenerTarget) {
    var _getEventCoordinates;
    if (listenerTarget === void 0) {
      listenerTarget = getEventListenerTarget(props.event.target);
    }
    this.props = void 0;
    this.events = void 0;
    this.autoScrollEnabled = true;
    this.document = void 0;
    this.activated = false;
    this.initialCoordinates = void 0;
    this.timeoutId = null;
    this.listeners = void 0;
    this.documentListeners = void 0;
    this.windowListeners = void 0;
    this.props = props;
    this.events = events2;
    const {
      event
    } = props;
    const {
      target
    } = event;
    this.props = props;
    this.events = events2;
    this.document = getOwnerDocument(target);
    this.documentListeners = new Listeners(this.document);
    this.listeners = new Listeners(listenerTarget);
    this.windowListeners = new Listeners(getWindow$1(target));
    this.initialCoordinates = (_getEventCoordinates = getEventCoordinates(event)) != null ? _getEventCoordinates : defaultCoordinates;
    this.handleStart = this.handleStart.bind(this);
    this.handleMove = this.handleMove.bind(this);
    this.handleEnd = this.handleEnd.bind(this);
    this.handleCancel = this.handleCancel.bind(this);
    this.handleKeydown = this.handleKeydown.bind(this);
    this.removeTextSelection = this.removeTextSelection.bind(this);
    this.attach();
  }
  attach() {
    const {
      events: events2,
      props: {
        options: {
          activationConstraint,
          bypassActivationConstraint
        }
      }
    } = this;
    this.listeners.add(events2.move.name, this.handleMove, {
      passive: false
    });
    this.listeners.add(events2.end.name, this.handleEnd);
    if (events2.cancel) {
      this.listeners.add(events2.cancel.name, this.handleCancel);
    }
    this.windowListeners.add(EventName.Resize, this.handleCancel);
    this.windowListeners.add(EventName.DragStart, preventDefault);
    this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);
    this.windowListeners.add(EventName.ContextMenu, preventDefault);
    this.documentListeners.add(EventName.Keydown, this.handleKeydown);
    if (activationConstraint) {
      if (bypassActivationConstraint != null && bypassActivationConstraint({
        event: this.props.event,
        activeNode: this.props.activeNode,
        options: this.props.options
      })) {
        return this.handleStart();
      }
      if (isDelayConstraint(activationConstraint)) {
        this.timeoutId = setTimeout(this.handleStart, activationConstraint.delay);
        this.handlePending(activationConstraint);
        return;
      }
      if (isDistanceConstraint(activationConstraint)) {
        this.handlePending(activationConstraint);
        return;
      }
    }
    this.handleStart();
  }
  detach() {
    this.listeners.removeAll();
    this.windowListeners.removeAll();
    setTimeout(this.documentListeners.removeAll, 50);
    if (this.timeoutId !== null) {
      clearTimeout(this.timeoutId);
      this.timeoutId = null;
    }
  }
  handlePending(constraint, offset2) {
    const {
      active: active3,
      onPending
    } = this.props;
    onPending(active3, constraint, this.initialCoordinates, offset2);
  }
  handleStart() {
    const {
      initialCoordinates
    } = this;
    const {
      onStart
    } = this.props;
    if (initialCoordinates) {
      this.activated = true;
      this.documentListeners.add(EventName.Click, stopPropagation, {
        capture: true
      });
      this.removeTextSelection();
      this.documentListeners.add(EventName.SelectionChange, this.removeTextSelection);
      onStart(initialCoordinates);
    }
  }
  handleMove(event) {
    var _getEventCoordinates2;
    const {
      activated,
      initialCoordinates,
      props
    } = this;
    const {
      onMove,
      options: {
        activationConstraint
      }
    } = props;
    if (!initialCoordinates) {
      return;
    }
    const coordinates = (_getEventCoordinates2 = getEventCoordinates(event)) != null ? _getEventCoordinates2 : defaultCoordinates;
    const delta = subtract(initialCoordinates, coordinates);
    if (!activated && activationConstraint) {
      if (isDistanceConstraint(activationConstraint)) {
        if (activationConstraint.tolerance != null && hasExceededDistance(delta, activationConstraint.tolerance)) {
          return this.handleCancel();
        }
        if (hasExceededDistance(delta, activationConstraint.distance)) {
          return this.handleStart();
        }
      }
      if (isDelayConstraint(activationConstraint)) {
        if (hasExceededDistance(delta, activationConstraint.tolerance)) {
          return this.handleCancel();
        }
      }
      this.handlePending(activationConstraint, delta);
      return;
    }
    if (event.cancelable) {
      event.preventDefault();
    }
    onMove(coordinates);
  }
  handleEnd() {
    const {
      onAbort,
      onEnd
    } = this.props;
    this.detach();
    if (!this.activated) {
      onAbort(this.props.active);
    }
    onEnd();
  }
  handleCancel() {
    const {
      onAbort,
      onCancel
    } = this.props;
    this.detach();
    if (!this.activated) {
      onAbort(this.props.active);
    }
    onCancel();
  }
  handleKeydown(event) {
    if (event.code === KeyboardCode.Esc) {
      this.handleCancel();
    }
  }
  removeTextSelection() {
    var _this$document$getSel;
    (_this$document$getSel = this.document.getSelection()) == null ? void 0 : _this$document$getSel.removeAllRanges();
  }
}
const events$1 = {
  cancel: {
    name: "pointercancel"
  },
  move: {
    name: "pointermove"
  },
  end: {
    name: "pointerup"
  }
};
class PointerSensor extends AbstractPointerSensor {
  constructor(props) {
    const {
      event
    } = props;
    const listenerTarget = getOwnerDocument(event.target);
    super(props, events$1, listenerTarget);
  }
}
PointerSensor.activators = [{
  eventName: "onPointerDown",
  handler: (_ref, _ref2) => {
    let {
      nativeEvent: event
    } = _ref;
    let {
      onActivation
    } = _ref2;
    if (!event.isPrimary || event.button !== 0) {
      return false;
    }
    onActivation == null ? void 0 : onActivation({
      event
    });
    return true;
  }
}];
const events$1$1 = {
  move: {
    name: "mousemove"
  },
  end: {
    name: "mouseup"
  }
};
var MouseButton;
(function(MouseButton2) {
  MouseButton2[MouseButton2["RightClick"] = 2] = "RightClick";
})(MouseButton || (MouseButton = {}));
class MouseSensor extends AbstractPointerSensor {
  constructor(props) {
    super(props, events$1$1, getOwnerDocument(props.event.target));
  }
}
MouseSensor.activators = [{
  eventName: "onMouseDown",
  handler: (_ref, _ref2) => {
    let {
      nativeEvent: event
    } = _ref;
    let {
      onActivation
    } = _ref2;
    if (event.button === MouseButton.RightClick) {
      return false;
    }
    onActivation == null ? void 0 : onActivation({
      event
    });
    return true;
  }
}];
const events$2 = {
  cancel: {
    name: "touchcancel"
  },
  move: {
    name: "touchmove"
  },
  end: {
    name: "touchend"
  }
};
class TouchSensor extends AbstractPointerSensor {
  constructor(props) {
    super(props, events$2);
  }
  static setup() {
    window.addEventListener(events$2.move.name, noop4, {
      capture: false,
      passive: false
    });
    return function teardown() {
      window.removeEventListener(events$2.move.name, noop4);
    };
    function noop4() {
    }
  }
}
TouchSensor.activators = [{
  eventName: "onTouchStart",
  handler: (_ref, _ref2) => {
    let {
      nativeEvent: event
    } = _ref;
    let {
      onActivation
    } = _ref2;
    const {
      touches
    } = event;
    if (touches.length > 1) {
      return false;
    }
    onActivation == null ? void 0 : onActivation({
      event
    });
    return true;
  }
}];
var AutoScrollActivator;
(function(AutoScrollActivator2) {
  AutoScrollActivator2[AutoScrollActivator2["Pointer"] = 0] = "Pointer";
  AutoScrollActivator2[AutoScrollActivator2["DraggableRect"] = 1] = "DraggableRect";
})(AutoScrollActivator || (AutoScrollActivator = {}));
var TraversalOrder;
(function(TraversalOrder2) {
  TraversalOrder2[TraversalOrder2["TreeOrder"] = 0] = "TreeOrder";
  TraversalOrder2[TraversalOrder2["ReversedTreeOrder"] = 1] = "ReversedTreeOrder";
})(TraversalOrder || (TraversalOrder = {}));
function useAutoScroller(_ref) {
  let {
    acceleration,
    activator = AutoScrollActivator.Pointer,
    canScroll,
    draggingRect,
    enabled,
    interval = 5,
    order: order2 = TraversalOrder.TreeOrder,
    pointerCoordinates,
    scrollableAncestors,
    scrollableAncestorRects,
    delta,
    threshold
  } = _ref;
  const scrollIntent = useScrollIntent({
    delta,
    disabled: !enabled
  });
  const [setAutoScrollInterval, clearAutoScrollInterval] = useInterval();
  const scrollSpeed = reactExports.useRef({
    x: 0,
    y: 0
  });
  const scrollDirection = reactExports.useRef({
    x: 0,
    y: 0
  });
  const rect = reactExports.useMemo(() => {
    switch (activator) {
      case AutoScrollActivator.Pointer:
        return pointerCoordinates ? {
          top: pointerCoordinates.y,
          bottom: pointerCoordinates.y,
          left: pointerCoordinates.x,
          right: pointerCoordinates.x
        } : null;
      case AutoScrollActivator.DraggableRect:
        return draggingRect;
    }
  }, [activator, draggingRect, pointerCoordinates]);
  const scrollContainerRef = reactExports.useRef(null);
  const autoScroll = reactExports.useCallback(() => {
    const scrollContainer = scrollContainerRef.current;
    if (!scrollContainer) {
      return;
    }
    const scrollLeft = scrollSpeed.current.x * scrollDirection.current.x;
    const scrollTop = scrollSpeed.current.y * scrollDirection.current.y;
    scrollContainer.scrollBy(scrollLeft, scrollTop);
  }, []);
  const sortedScrollableAncestors = reactExports.useMemo(() => order2 === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors, [order2, scrollableAncestors]);
  reactExports.useEffect(
    () => {
      if (!enabled || !scrollableAncestors.length || !rect) {
        clearAutoScrollInterval();
        return;
      }
      for (const scrollContainer of sortedScrollableAncestors) {
        if ((canScroll == null ? void 0 : canScroll(scrollContainer)) === false) {
          continue;
        }
        const index2 = scrollableAncestors.indexOf(scrollContainer);
        const scrollContainerRect = scrollableAncestorRects[index2];
        if (!scrollContainerRect) {
          continue;
        }
        const {
          direction,
          speed
        } = getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, rect, acceleration, threshold);
        for (const axis of ["x", "y"]) {
          if (!scrollIntent[axis][direction[axis]]) {
            speed[axis] = 0;
            direction[axis] = 0;
          }
        }
        if (speed.x > 0 || speed.y > 0) {
          clearAutoScrollInterval();
          scrollContainerRef.current = scrollContainer;
          setAutoScrollInterval(autoScroll, interval);
          scrollSpeed.current = speed;
          scrollDirection.current = direction;
          return;
        }
      }
      scrollSpeed.current = {
        x: 0,
        y: 0
      };
      scrollDirection.current = {
        x: 0,
        y: 0
      };
      clearAutoScrollInterval();
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [
      acceleration,
      autoScroll,
      canScroll,
      clearAutoScrollInterval,
      enabled,
      interval,
      // eslint-disable-next-line react-hooks/exhaustive-deps
      JSON.stringify(rect),
      // eslint-disable-next-line react-hooks/exhaustive-deps
      JSON.stringify(scrollIntent),
      setAutoScrollInterval,
      scrollableAncestors,
      sortedScrollableAncestors,
      scrollableAncestorRects,
      // eslint-disable-next-line react-hooks/exhaustive-deps
      JSON.stringify(threshold)
    ]
  );
}
const defaultScrollIntent = {
  x: {
    [Direction.Backward]: false,
    [Direction.Forward]: false
  },
  y: {
    [Direction.Backward]: false,
    [Direction.Forward]: false
  }
};
function useScrollIntent(_ref2) {
  let {
    delta,
    disabled
  } = _ref2;
  const previousDelta = usePrevious2(delta);
  return useLazyMemo((previousIntent) => {
    if (disabled || !previousDelta || !previousIntent) {
      return defaultScrollIntent;
    }
    const direction = {
      x: Math.sign(delta.x - previousDelta.x),
      y: Math.sign(delta.y - previousDelta.y)
    };
    return {
      x: {
        [Direction.Backward]: previousIntent.x[Direction.Backward] || direction.x === -1,
        [Direction.Forward]: previousIntent.x[Direction.Forward] || direction.x === 1
      },
      y: {
        [Direction.Backward]: previousIntent.y[Direction.Backward] || direction.y === -1,
        [Direction.Forward]: previousIntent.y[Direction.Forward] || direction.y === 1
      }
    };
  }, [disabled, delta, previousDelta]);
}
function useCachedNode(draggableNodes, id2) {
  const draggableNode = id2 != null ? draggableNodes.get(id2) : void 0;
  const node2 = draggableNode ? draggableNode.node.current : null;
  return useLazyMemo((cachedNode) => {
    var _ref;
    if (id2 == null) {
      return null;
    }
    return (_ref = node2 != null ? node2 : cachedNode) != null ? _ref : null;
  }, [node2, id2]);
}
function useCombineActivators(sensors, getSyntheticHandler) {
  return reactExports.useMemo(() => sensors.reduce((accumulator, sensor) => {
    const {
      sensor: Sensor
    } = sensor;
    const sensorActivators = Sensor.activators.map((activator) => ({
      eventName: activator.eventName,
      handler: getSyntheticHandler(activator.handler, sensor)
    }));
    return [...accumulator, ...sensorActivators];
  }, []), [sensors, getSyntheticHandler]);
}
var MeasuringStrategy;
(function(MeasuringStrategy2) {
  MeasuringStrategy2[MeasuringStrategy2["Always"] = 0] = "Always";
  MeasuringStrategy2[MeasuringStrategy2["BeforeDragging"] = 1] = "BeforeDragging";
  MeasuringStrategy2[MeasuringStrategy2["WhileDragging"] = 2] = "WhileDragging";
})(MeasuringStrategy || (MeasuringStrategy = {}));
var MeasuringFrequency;
(function(MeasuringFrequency2) {
  MeasuringFrequency2["Optimized"] = "optimized";
})(MeasuringFrequency || (MeasuringFrequency = {}));
const defaultValue = /* @__PURE__ */ new Map();
function useDroppableMeasuring(containers, _ref) {
  let {
    dragging,
    dependencies,
    config: config2
  } = _ref;
  const [queue, setQueue] = reactExports.useState(null);
  const {
    frequency,
    measure,
    strategy
  } = config2;
  const containersRef = reactExports.useRef(containers);
  const disabled = isDisabled();
  const disabledRef = useLatestValue(disabled);
  const measureDroppableContainers = reactExports.useCallback(function(ids2) {
    if (ids2 === void 0) {
      ids2 = [];
    }
    if (disabledRef.current) {
      return;
    }
    setQueue((value2) => {
      if (value2 === null) {
        return ids2;
      }
      return value2.concat(ids2.filter((id2) => !value2.includes(id2)));
    });
  }, [disabledRef]);
  const timeoutId = reactExports.useRef(null);
  const droppableRects = useLazyMemo((previousValue) => {
    if (disabled && !dragging) {
      return defaultValue;
    }
    if (!previousValue || previousValue === defaultValue || containersRef.current !== containers || queue != null) {
      const map2 = /* @__PURE__ */ new Map();
      for (let container of containers) {
        if (!container) {
          continue;
        }
        if (queue && queue.length > 0 && !queue.includes(container.id) && container.rect.current) {
          map2.set(container.id, container.rect.current);
          continue;
        }
        const node2 = container.node.current;
        const rect = node2 ? new Rect(measure(node2), node2) : null;
        container.rect.current = rect;
        if (rect) {
          map2.set(container.id, rect);
        }
      }
      return map2;
    }
    return previousValue;
  }, [containers, queue, dragging, disabled, measure]);
  reactExports.useEffect(() => {
    containersRef.current = containers;
  }, [containers]);
  reactExports.useEffect(
    () => {
      if (disabled) {
        return;
      }
      measureDroppableContainers();
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [dragging, disabled]
  );
  reactExports.useEffect(
    () => {
      if (queue && queue.length > 0) {
        setQueue(null);
      }
    },
    //eslint-disable-next-line react-hooks/exhaustive-deps
    [JSON.stringify(queue)]
  );
  reactExports.useEffect(
    () => {
      if (disabled || typeof frequency !== "number" || timeoutId.current !== null) {
        return;
      }
      timeoutId.current = setTimeout(() => {
        measureDroppableContainers();
        timeoutId.current = null;
      }, frequency);
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [frequency, disabled, measureDroppableContainers, ...dependencies]
  );
  return {
    droppableRects,
    measureDroppableContainers,
    measuringScheduled: queue != null
  };
  function isDisabled() {
    switch (strategy) {
      case MeasuringStrategy.Always:
        return false;
      case MeasuringStrategy.BeforeDragging:
        return dragging;
      default:
        return !dragging;
    }
  }
}
function useInitialValue(value2, computeFn) {
  return useLazyMemo((previousValue) => {
    if (!value2) {
      return null;
    }
    if (previousValue) {
      return previousValue;
    }
    return typeof computeFn === "function" ? computeFn(value2) : value2;
  }, [computeFn, value2]);
}
function useInitialRect(node2, measure) {
  return useInitialValue(node2, measure);
}
function useMutationObserver$1(_ref) {
  let {
    callback: callback2,
    disabled
  } = _ref;
  const handleMutations = useEvent(callback2);
  const mutationObserver = reactExports.useMemo(() => {
    if (disabled || typeof window === "undefined" || typeof window.MutationObserver === "undefined") {
      return void 0;
    }
    const {
      MutationObserver: MutationObserver2
    } = window;
    return new MutationObserver2(handleMutations);
  }, [handleMutations, disabled]);
  reactExports.useEffect(() => {
    return () => mutationObserver == null ? void 0 : mutationObserver.disconnect();
  }, [mutationObserver]);
  return mutationObserver;
}
function useResizeObserver(_ref) {
  let {
    callback: callback2,
    disabled
  } = _ref;
  const handleResize = useEvent(callback2);
  const resizeObserver2 = reactExports.useMemo(
    () => {
      if (disabled || typeof window === "undefined" || typeof window.ResizeObserver === "undefined") {
        return void 0;
      }
      const {
        ResizeObserver: ResizeObserver2
      } = window;
      return new ResizeObserver2(handleResize);
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [disabled]
  );
  reactExports.useEffect(() => {
    return () => resizeObserver2 == null ? void 0 : resizeObserver2.disconnect();
  }, [resizeObserver2]);
  return resizeObserver2;
}
function defaultMeasure(element2) {
  return new Rect(getClientRect(element2), element2);
}
function useRect$1(element2, measure, fallbackRect) {
  if (measure === void 0) {
    measure = defaultMeasure;
  }
  const [rect, setRect] = reactExports.useState(null);
  function measureRect() {
    setRect((currentRect) => {
      if (!element2) {
        return null;
      }
      if (element2.isConnected === false) {
        var _ref;
        return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null;
      }
      const newRect = measure(element2);
      if (JSON.stringify(currentRect) === JSON.stringify(newRect)) {
        return currentRect;
      }
      return newRect;
    });
  }
  const mutationObserver = useMutationObserver$1({
    callback(records) {
      if (!element2) {
        return;
      }
      for (const record of records) {
        const {
          type: type4,
          target
        } = record;
        if (type4 === "childList" && target instanceof HTMLElement && target.contains(element2)) {
          measureRect();
          break;
        }
      }
    }
  });
  const resizeObserver2 = useResizeObserver({
    callback: measureRect
  });
  useIsomorphicLayoutEffect(() => {
    measureRect();
    if (element2) {
      resizeObserver2 == null ? void 0 : resizeObserver2.observe(element2);
      mutationObserver == null ? void 0 : mutationObserver.observe(document.body, {
        childList: true,
        subtree: true
      });
    } else {
      resizeObserver2 == null ? void 0 : resizeObserver2.disconnect();
      mutationObserver == null ? void 0 : mutationObserver.disconnect();
    }
  }, [element2]);
  return rect;
}
function useRectDelta(rect) {
  const initialRect = useInitialValue(rect);
  return getRectDelta(rect, initialRect);
}
const defaultValue$1 = [];
function useScrollableAncestors(node2) {
  const previousNode = reactExports.useRef(node2);
  const ancestors = useLazyMemo((previousValue) => {
    if (!node2) {
      return defaultValue$1;
    }
    if (previousValue && previousValue !== defaultValue$1 && node2 && previousNode.current && node2.parentNode === previousNode.current.parentNode) {
      return previousValue;
    }
    return getScrollableAncestors(node2);
  }, [node2]);
  reactExports.useEffect(() => {
    previousNode.current = node2;
  }, [node2]);
  return ancestors;
}
function useScrollOffsets(elements) {
  const [scrollCoordinates, setScrollCoordinates] = reactExports.useState(null);
  const prevElements = reactExports.useRef(elements);
  const handleScroll = reactExports.useCallback((event) => {
    const scrollingElement = getScrollableElement(event.target);
    if (!scrollingElement) {
      return;
    }
    setScrollCoordinates((scrollCoordinates2) => {
      if (!scrollCoordinates2) {
        return null;
      }
      scrollCoordinates2.set(scrollingElement, getScrollCoordinates(scrollingElement));
      return new Map(scrollCoordinates2);
    });
  }, []);
  reactExports.useEffect(() => {
    const previousElements = prevElements.current;
    if (elements !== previousElements) {
      cleanup2(previousElements);
      const entries = elements.map((element2) => {
        const scrollableElement = getScrollableElement(element2);
        if (scrollableElement) {
          scrollableElement.addEventListener("scroll", handleScroll, {
            passive: true
          });
          return [scrollableElement, getScrollCoordinates(scrollableElement)];
        }
        return null;
      }).filter((entry) => entry != null);
      setScrollCoordinates(entries.length ? new Map(entries) : null);
      prevElements.current = elements;
    }
    return () => {
      cleanup2(elements);
      cleanup2(previousElements);
    };
    function cleanup2(elements2) {
      elements2.forEach((element2) => {
        const scrollableElement = getScrollableElement(element2);
        scrollableElement == null ? void 0 : scrollableElement.removeEventListener("scroll", handleScroll);
      });
    }
  }, [handleScroll, elements]);
  return reactExports.useMemo(() => {
    if (elements.length) {
      return scrollCoordinates ? Array.from(scrollCoordinates.values()).reduce((acc, coordinates) => add(acc, coordinates), defaultCoordinates) : getScrollOffsets(elements);
    }
    return defaultCoordinates;
  }, [elements, scrollCoordinates]);
}
function useScrollOffsetsDelta(scrollOffsets, dependencies) {
  if (dependencies === void 0) {
    dependencies = [];
  }
  const initialScrollOffsets = reactExports.useRef(null);
  reactExports.useEffect(
    () => {
      initialScrollOffsets.current = null;
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    dependencies
  );
  reactExports.useEffect(() => {
    const hasScrollOffsets = scrollOffsets !== defaultCoordinates;
    if (hasScrollOffsets && !initialScrollOffsets.current) {
      initialScrollOffsets.current = scrollOffsets;
    }
    if (!hasScrollOffsets && initialScrollOffsets.current) {
      initialScrollOffsets.current = null;
    }
  }, [scrollOffsets]);
  return initialScrollOffsets.current ? subtract(scrollOffsets, initialScrollOffsets.current) : defaultCoordinates;
}
function useSensorSetup(sensors) {
  reactExports.useEffect(
    () => {
      if (!canUseDOM2) {
        return;
      }
      const teardownFns = sensors.map((_ref) => {
        let {
          sensor
        } = _ref;
        return sensor.setup == null ? void 0 : sensor.setup();
      });
      return () => {
        for (const teardown of teardownFns) {
          teardown == null ? void 0 : teardown();
        }
      };
    },
    // TO-DO: Sensors length could theoretically change which would not be a valid dependency
    // eslint-disable-next-line react-hooks/exhaustive-deps
    sensors.map((_ref2) => {
      let {
        sensor
      } = _ref2;
      return sensor;
    })
  );
}
function useSyntheticListeners(listeners, id2) {
  return reactExports.useMemo(() => {
    return listeners.reduce((acc, _ref) => {
      let {
        eventName,
        handler
      } = _ref;
      acc[eventName] = (event) => {
        handler(event, id2);
      };
      return acc;
    }, {});
  }, [listeners, id2]);
}
function useWindowRect(element2) {
  return reactExports.useMemo(() => element2 ? getWindowClientRect(element2) : null, [element2]);
}
const defaultValue$2 = [];
function useRects(elements, measure) {
  if (measure === void 0) {
    measure = getClientRect;
  }
  const [firstElement] = elements;
  const windowRect = useWindowRect(firstElement ? getWindow$1(firstElement) : null);
  const [rects, setRects] = reactExports.useState(defaultValue$2);
  function measureRects() {
    setRects(() => {
      if (!elements.length) {
        return defaultValue$2;
      }
      return elements.map((element2) => isDocumentScrollingElement(element2) ? windowRect : new Rect(measure(element2), element2));
    });
  }
  const resizeObserver2 = useResizeObserver({
    callback: measureRects
  });
  useIsomorphicLayoutEffect(() => {
    resizeObserver2 == null ? void 0 : resizeObserver2.disconnect();
    measureRects();
    elements.forEach((element2) => resizeObserver2 == null ? void 0 : resizeObserver2.observe(element2));
  }, [elements]);
  return rects;
}
function getMeasurableNode(node2) {
  if (!node2) {
    return null;
  }
  if (node2.children.length > 1) {
    return node2;
  }
  const firstChild = node2.children[0];
  return isHTMLElement(firstChild) ? firstChild : node2;
}
function useDragOverlayMeasuring(_ref) {
  let {
    measure
  } = _ref;
  const [rect, setRect] = reactExports.useState(null);
  const handleResize = reactExports.useCallback((entries) => {
    for (const {
      target
    } of entries) {
      if (isHTMLElement(target)) {
        setRect((rect2) => {
          const newRect = measure(target);
          return rect2 ? {
            ...rect2,
            width: newRect.width,
            height: newRect.height
          } : newRect;
        });
        break;
      }
    }
  }, [measure]);
  const resizeObserver2 = useResizeObserver({
    callback: handleResize
  });
  const handleNodeChange = reactExports.useCallback((element2) => {
    const node2 = getMeasurableNode(element2);
    resizeObserver2 == null ? void 0 : resizeObserver2.disconnect();
    if (node2) {
      resizeObserver2 == null ? void 0 : resizeObserver2.observe(node2);
    }
    setRect(node2 ? measure(node2) : null);
  }, [measure, resizeObserver2]);
  const [nodeRef, setRef2] = useNodeRef(handleNodeChange);
  return reactExports.useMemo(() => ({
    nodeRef,
    rect,
    setRef: setRef2
  }), [rect, nodeRef, setRef2]);
}
const defaultSensors = [{
  sensor: PointerSensor,
  options: {}
}, {
  sensor: KeyboardSensor,
  options: {}
}];
const defaultData = {
  current: {}
};
const defaultMeasuringConfiguration = {
  draggable: {
    measure: getTransformAgnosticClientRect
  },
  droppable: {
    measure: getTransformAgnosticClientRect,
    strategy: MeasuringStrategy.WhileDragging,
    frequency: MeasuringFrequency.Optimized
  },
  dragOverlay: {
    measure: getClientRect
  }
};
class DroppableContainersMap extends Map {
  get(id2) {
    var _super$get;
    return id2 != null ? (_super$get = super.get(id2)) != null ? _super$get : void 0 : void 0;
  }
  toArray() {
    return Array.from(this.values());
  }
  getEnabled() {
    return this.toArray().filter((_ref) => {
      let {
        disabled
      } = _ref;
      return !disabled;
    });
  }
  getNodeFor(id2) {
    var _this$get$node$curren, _this$get;
    return (_this$get$node$curren = (_this$get = this.get(id2)) == null ? void 0 : _this$get.node.current) != null ? _this$get$node$curren : void 0;
  }
}
const defaultPublicContext = {
  activatorEvent: null,
  active: null,
  activeNode: null,
  activeNodeRect: null,
  collisions: null,
  containerNodeRect: null,
  draggableNodes: /* @__PURE__ */ new Map(),
  droppableRects: /* @__PURE__ */ new Map(),
  droppableContainers: /* @__PURE__ */ new DroppableContainersMap(),
  over: null,
  dragOverlay: {
    nodeRef: {
      current: null
    },
    rect: null,
    setRef: noop3
  },
  scrollableAncestors: [],
  scrollableAncestorRects: [],
  measuringConfiguration: defaultMeasuringConfiguration,
  measureDroppableContainers: noop3,
  windowRect: null,
  measuringScheduled: false
};
const defaultInternalContext = {
  activatorEvent: null,
  activators: [],
  active: null,
  activeNodeRect: null,
  ariaDescribedById: {
    draggable: ""
  },
  dispatch: noop3,
  draggableNodes: /* @__PURE__ */ new Map(),
  over: null,
  measureDroppableContainers: noop3
};
const InternalContext = /* @__PURE__ */ reactExports.createContext(defaultInternalContext);
const PublicContext = /* @__PURE__ */ reactExports.createContext(defaultPublicContext);
function getInitialState() {
  return {
    draggable: {
      active: null,
      initialCoordinates: {
        x: 0,
        y: 0
      },
      nodes: /* @__PURE__ */ new Map(),
      translate: {
        x: 0,
        y: 0
      }
    },
    droppable: {
      containers: new DroppableContainersMap()
    }
  };
}
function reducer(state, action) {
  switch (action.type) {
    case Action.DragStart:
      return {
        ...state,
        draggable: {
          ...state.draggable,
          initialCoordinates: action.initialCoordinates,
          active: action.active
        }
      };
    case Action.DragMove:
      if (state.draggable.active == null) {
        return state;
      }
      return {
        ...state,
        draggable: {
          ...state.draggable,
          translate: {
            x: action.coordinates.x - state.draggable.initialCoordinates.x,
            y: action.coordinates.y - state.draggable.initialCoordinates.y
          }
        }
      };
    case Action.DragEnd:
    case Action.DragCancel:
      return {
        ...state,
        draggable: {
          ...state.draggable,
          active: null,
          initialCoordinates: {
            x: 0,
            y: 0
          },
          translate: {
            x: 0,
            y: 0
          }
        }
      };
    case Action.RegisterDroppable: {
      const {
        element: element2
      } = action;
      const {
        id: id2
      } = element2;
      const containers = new DroppableContainersMap(state.droppable.containers);
      containers.set(id2, element2);
      return {
        ...state,
        droppable: {
          ...state.droppable,
          containers
        }
      };
    }
    case Action.SetDroppableDisabled: {
      const {
        id: id2,
        key,
        disabled
      } = action;
      const element2 = state.droppable.containers.get(id2);
      if (!element2 || key !== element2.key) {
        return state;
      }
      const containers = new DroppableContainersMap(state.droppable.containers);
      containers.set(id2, {
        ...element2,
        disabled
      });
      return {
        ...state,
        droppable: {
          ...state.droppable,
          containers
        }
      };
    }
    case Action.UnregisterDroppable: {
      const {
        id: id2,
        key
      } = action;
      const element2 = state.droppable.containers.get(id2);
      if (!element2 || key !== element2.key) {
        return state;
      }
      const containers = new DroppableContainersMap(state.droppable.containers);
      containers.delete(id2);
      return {
        ...state,
        droppable: {
          ...state.droppable,
          containers
        }
      };
    }
    default: {
      return state;
    }
  }
}
function RestoreFocus(_ref) {
  let {
    disabled
  } = _ref;
  const {
    active: active3,
    activatorEvent,
    draggableNodes
  } = reactExports.useContext(InternalContext);
  const previousActivatorEvent = usePrevious2(activatorEvent);
  const previousActiveId = usePrevious2(active3 == null ? void 0 : active3.id);
  reactExports.useEffect(() => {
    if (disabled) {
      return;
    }
    if (!activatorEvent && previousActivatorEvent && previousActiveId != null) {
      if (!isKeyboardEvent(previousActivatorEvent)) {
        return;
      }
      if (document.activeElement === previousActivatorEvent.target) {
        return;
      }
      const draggableNode = draggableNodes.get(previousActiveId);
      if (!draggableNode) {
        return;
      }
      const {
        activatorNode,
        node: node2
      } = draggableNode;
      if (!activatorNode.current && !node2.current) {
        return;
      }
      requestAnimationFrame(() => {
        for (const element2 of [activatorNode.current, node2.current]) {
          if (!element2) {
            continue;
          }
          const focusableNode = findFirstFocusableNode(element2);
          if (focusableNode) {
            focusableNode.focus();
            break;
          }
        }
      });
    }
  }, [activatorEvent, disabled, draggableNodes, previousActiveId, previousActivatorEvent]);
  return null;
}
function applyModifiers(modifiers, _ref) {
  let {
    transform: transform2,
    ...args
  } = _ref;
  return modifiers != null && modifiers.length ? modifiers.reduce((accumulator, modifier) => {
    return modifier({
      transform: accumulator,
      ...args
    });
  }, transform2) : transform2;
}
function useMeasuringConfiguration(config2) {
  return reactExports.useMemo(
    () => ({
      draggable: {
        ...defaultMeasuringConfiguration.draggable,
        ...config2 == null ? void 0 : config2.draggable
      },
      droppable: {
        ...defaultMeasuringConfiguration.droppable,
        ...config2 == null ? void 0 : config2.droppable
      },
      dragOverlay: {
        ...defaultMeasuringConfiguration.dragOverlay,
        ...config2 == null ? void 0 : config2.dragOverlay
      }
    }),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [config2 == null ? void 0 : config2.draggable, config2 == null ? void 0 : config2.droppable, config2 == null ? void 0 : config2.dragOverlay]
  );
}
function useLayoutShiftScrollCompensation(_ref) {
  let {
    activeNode,
    measure,
    initialRect,
    config: config2 = true
  } = _ref;
  const initialized = reactExports.useRef(false);
  const {
    x: x2,
    y: y2
  } = typeof config2 === "boolean" ? {
    x: config2,
    y: config2
  } : config2;
  useIsomorphicLayoutEffect(() => {
    const disabled = !x2 && !y2;
    if (disabled || !activeNode) {
      initialized.current = false;
      return;
    }
    if (initialized.current || !initialRect) {
      return;
    }
    const node2 = activeNode == null ? void 0 : activeNode.node.current;
    if (!node2 || node2.isConnected === false) {
      return;
    }
    const rect = measure(node2);
    const rectDelta = getRectDelta(rect, initialRect);
    if (!x2) {
      rectDelta.x = 0;
    }
    if (!y2) {
      rectDelta.y = 0;
    }
    initialized.current = true;
    if (Math.abs(rectDelta.x) > 0 || Math.abs(rectDelta.y) > 0) {
      const firstScrollableAncestor = getFirstScrollableAncestor(node2);
      if (firstScrollableAncestor) {
        firstScrollableAncestor.scrollBy({
          top: rectDelta.y,
          left: rectDelta.x
        });
      }
    }
  }, [activeNode, x2, y2, initialRect, measure]);
}
const ActiveDraggableContext = /* @__PURE__ */ reactExports.createContext({
  ...defaultCoordinates,
  scaleX: 1,
  scaleY: 1
});
var Status;
(function(Status2) {
  Status2[Status2["Uninitialized"] = 0] = "Uninitialized";
  Status2[Status2["Initializing"] = 1] = "Initializing";
  Status2[Status2["Initialized"] = 2] = "Initialized";
})(Status || (Status = {}));
const DndContext = /* @__PURE__ */ reactExports.memo(function DndContext2(_ref) {
  var _sensorContext$curren, _dragOverlay$nodeRef$, _dragOverlay$rect, _over$rect;
  let {
    id: id2,
    accessibility,
    autoScroll = true,
    children,
    sensors = defaultSensors,
    collisionDetection = rectIntersection,
    measuring,
    modifiers,
    ...props
  } = _ref;
  const store = reactExports.useReducer(reducer, void 0, getInitialState);
  const [state, dispatch] = store;
  const [dispatchMonitorEvent, registerMonitorListener] = useDndMonitorProvider();
  const [status, setStatus] = reactExports.useState(Status.Uninitialized);
  const isInitialized = status === Status.Initialized;
  const {
    draggable: {
      active: activeId,
      nodes: draggableNodes,
      translate
    },
    droppable: {
      containers: droppableContainers
    }
  } = state;
  const node2 = activeId != null ? draggableNodes.get(activeId) : null;
  const activeRects = reactExports.useRef({
    initial: null,
    translated: null
  });
  const active3 = reactExports.useMemo(() => {
    var _node$data;
    return activeId != null ? {
      id: activeId,
      // It's possible for the active node to unmount while dragging
      data: (_node$data = node2 == null ? void 0 : node2.data) != null ? _node$data : defaultData,
      rect: activeRects
    } : null;
  }, [activeId, node2]);
  const activeRef = reactExports.useRef(null);
  const [activeSensor, setActiveSensor] = reactExports.useState(null);
  const [activatorEvent, setActivatorEvent] = reactExports.useState(null);
  const latestProps = useLatestValue(props, Object.values(props));
  const draggableDescribedById = useUniqueId("DndDescribedBy", id2);
  const enabledDroppableContainers = reactExports.useMemo(() => droppableContainers.getEnabled(), [droppableContainers]);
  const measuringConfiguration = useMeasuringConfiguration(measuring);
  const {
    droppableRects,
    measureDroppableContainers,
    measuringScheduled
  } = useDroppableMeasuring(enabledDroppableContainers, {
    dragging: isInitialized,
    dependencies: [translate.x, translate.y],
    config: measuringConfiguration.droppable
  });
  const activeNode = useCachedNode(draggableNodes, activeId);
  const activationCoordinates = reactExports.useMemo(() => activatorEvent ? getEventCoordinates(activatorEvent) : null, [activatorEvent]);
  const autoScrollOptions = getAutoScrollerOptions();
  const initialActiveNodeRect = useInitialRect(activeNode, measuringConfiguration.draggable.measure);
  useLayoutShiftScrollCompensation({
    activeNode: activeId != null ? draggableNodes.get(activeId) : null,
    config: autoScrollOptions.layoutShiftCompensation,
    initialRect: initialActiveNodeRect,
    measure: measuringConfiguration.draggable.measure
  });
  const activeNodeRect = useRect$1(activeNode, measuringConfiguration.draggable.measure, initialActiveNodeRect);
  const containerNodeRect = useRect$1(activeNode ? activeNode.parentElement : null);
  const sensorContext = reactExports.useRef({
    activatorEvent: null,
    active: null,
    activeNode,
    collisionRect: null,
    collisions: null,
    droppableRects,
    draggableNodes,
    draggingNode: null,
    draggingNodeRect: null,
    droppableContainers,
    over: null,
    scrollableAncestors: [],
    scrollAdjustedTranslate: null
  });
  const overNode = droppableContainers.getNodeFor((_sensorContext$curren = sensorContext.current.over) == null ? void 0 : _sensorContext$curren.id);
  const dragOverlay = useDragOverlayMeasuring({
    measure: measuringConfiguration.dragOverlay.measure
  });
  const draggingNode = (_dragOverlay$nodeRef$ = dragOverlay.nodeRef.current) != null ? _dragOverlay$nodeRef$ : activeNode;
  const draggingNodeRect = isInitialized ? (_dragOverlay$rect = dragOverlay.rect) != null ? _dragOverlay$rect : activeNodeRect : null;
  const usesDragOverlay = Boolean(dragOverlay.nodeRef.current && dragOverlay.rect);
  const nodeRectDelta = useRectDelta(usesDragOverlay ? null : activeNodeRect);
  const windowRect = useWindowRect(draggingNode ? getWindow$1(draggingNode) : null);
  const scrollableAncestors = useScrollableAncestors(isInitialized ? overNode != null ? overNode : activeNode : null);
  const scrollableAncestorRects = useRects(scrollableAncestors);
  const modifiedTranslate = applyModifiers(modifiers, {
    transform: {
      x: translate.x - nodeRectDelta.x,
      y: translate.y - nodeRectDelta.y,
      scaleX: 1,
      scaleY: 1
    },
    activatorEvent,
    active: active3,
    activeNodeRect,
    containerNodeRect,
    draggingNodeRect,
    over: sensorContext.current.over,
    overlayNodeRect: dragOverlay.rect,
    scrollableAncestors,
    scrollableAncestorRects,
    windowRect
  });
  const pointerCoordinates = activationCoordinates ? add(activationCoordinates, translate) : null;
  const scrollOffsets = useScrollOffsets(scrollableAncestors);
  const scrollAdjustment = useScrollOffsetsDelta(scrollOffsets);
  const activeNodeScrollDelta = useScrollOffsetsDelta(scrollOffsets, [activeNodeRect]);
  const scrollAdjustedTranslate = add(modifiedTranslate, scrollAdjustment);
  const collisionRect = draggingNodeRect ? getAdjustedRect(draggingNodeRect, modifiedTranslate) : null;
  const collisions = active3 && collisionRect ? collisionDetection({
    active: active3,
    collisionRect,
    droppableRects,
    droppableContainers: enabledDroppableContainers,
    pointerCoordinates
  }) : null;
  const overId = getFirstCollision(collisions, "id");
  const [over, setOver] = reactExports.useState(null);
  const appliedTranslate = usesDragOverlay ? modifiedTranslate : add(modifiedTranslate, activeNodeScrollDelta);
  const transform2 = adjustScale(appliedTranslate, (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect);
  const activeSensorRef = reactExports.useRef(null);
  const instantiateSensor = reactExports.useCallback(
    (event, _ref2) => {
      let {
        sensor: Sensor,
        options
      } = _ref2;
      if (activeRef.current == null) {
        return;
      }
      const activeNode2 = draggableNodes.get(activeRef.current);
      if (!activeNode2) {
        return;
      }
      const activatorEvent2 = event.nativeEvent;
      const sensorInstance = new Sensor({
        active: activeRef.current,
        activeNode: activeNode2,
        event: activatorEvent2,
        options,
        // Sensors need to be instantiated with refs for arguments that change over time
        // otherwise they are frozen in time with the stale arguments
        context: sensorContext,
        onAbort(id3) {
          const draggableNode = draggableNodes.get(id3);
          if (!draggableNode) {
            return;
          }
          const {
            onDragAbort
          } = latestProps.current;
          const event2 = {
            id: id3
          };
          onDragAbort == null ? void 0 : onDragAbort(event2);
          dispatchMonitorEvent({
            type: "onDragAbort",
            event: event2
          });
        },
        onPending(id3, constraint, initialCoordinates, offset2) {
          const draggableNode = draggableNodes.get(id3);
          if (!draggableNode) {
            return;
          }
          const {
            onDragPending
          } = latestProps.current;
          const event2 = {
            id: id3,
            constraint,
            initialCoordinates,
            offset: offset2
          };
          onDragPending == null ? void 0 : onDragPending(event2);
          dispatchMonitorEvent({
            type: "onDragPending",
            event: event2
          });
        },
        onStart(initialCoordinates) {
          const id3 = activeRef.current;
          if (id3 == null) {
            return;
          }
          const draggableNode = draggableNodes.get(id3);
          if (!draggableNode) {
            return;
          }
          const {
            onDragStart
          } = latestProps.current;
          const event2 = {
            activatorEvent: activatorEvent2,
            active: {
              id: id3,
              data: draggableNode.data,
              rect: activeRects
            }
          };
          reactDomExports.unstable_batchedUpdates(() => {
            onDragStart == null ? void 0 : onDragStart(event2);
            setStatus(Status.Initializing);
            dispatch({
              type: Action.DragStart,
              initialCoordinates,
              active: id3
            });
            dispatchMonitorEvent({
              type: "onDragStart",
              event: event2
            });
            setActiveSensor(activeSensorRef.current);
            setActivatorEvent(activatorEvent2);
          });
        },
        onMove(coordinates) {
          dispatch({
            type: Action.DragMove,
            coordinates
          });
        },
        onEnd: createHandler(Action.DragEnd),
        onCancel: createHandler(Action.DragCancel)
      });
      activeSensorRef.current = sensorInstance;
      function createHandler(type4) {
        return async function handler() {
          const {
            active: active4,
            collisions: collisions2,
            over: over2,
            scrollAdjustedTranslate: scrollAdjustedTranslate2
          } = sensorContext.current;
          let event2 = null;
          if (active4 && scrollAdjustedTranslate2) {
            const {
              cancelDrop
            } = latestProps.current;
            event2 = {
              activatorEvent: activatorEvent2,
              active: active4,
              collisions: collisions2,
              delta: scrollAdjustedTranslate2,
              over: over2
            };
            if (type4 === Action.DragEnd && typeof cancelDrop === "function") {
              const shouldCancel = await Promise.resolve(cancelDrop(event2));
              if (shouldCancel) {
                type4 = Action.DragCancel;
              }
            }
          }
          activeRef.current = null;
          reactDomExports.unstable_batchedUpdates(() => {
            dispatch({
              type: type4
            });
            setStatus(Status.Uninitialized);
            setOver(null);
            setActiveSensor(null);
            setActivatorEvent(null);
            activeSensorRef.current = null;
            const eventName = type4 === Action.DragEnd ? "onDragEnd" : "onDragCancel";
            if (event2) {
              const handler2 = latestProps.current[eventName];
              handler2 == null ? void 0 : handler2(event2);
              dispatchMonitorEvent({
                type: eventName,
                event: event2
              });
            }
          });
        };
      }
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [draggableNodes]
  );
  const bindActivatorToSensorInstantiator = reactExports.useCallback((handler, sensor) => {
    return (event, active4) => {
      const nativeEvent = event.nativeEvent;
      const activeDraggableNode = draggableNodes.get(active4);
      if (
        // Another sensor is already instantiating
        activeRef.current !== null || // No active draggable
        !activeDraggableNode || // Event has already been captured
        nativeEvent.dndKit || nativeEvent.defaultPrevented
      ) {
        return;
      }
      const activationContext = {
        active: activeDraggableNode
      };
      const shouldActivate = handler(event, sensor.options, activationContext);
      if (shouldActivate === true) {
        nativeEvent.dndKit = {
          capturedBy: sensor.sensor
        };
        activeRef.current = active4;
        instantiateSensor(event, sensor);
      }
    };
  }, [draggableNodes, instantiateSensor]);
  const activators = useCombineActivators(sensors, bindActivatorToSensorInstantiator);
  useSensorSetup(sensors);
  useIsomorphicLayoutEffect(() => {
    if (activeNodeRect && status === Status.Initializing) {
      setStatus(Status.Initialized);
    }
  }, [activeNodeRect, status]);
  reactExports.useEffect(
    () => {
      const {
        onDragMove
      } = latestProps.current;
      const {
        active: active4,
        activatorEvent: activatorEvent2,
        collisions: collisions2,
        over: over2
      } = sensorContext.current;
      if (!active4 || !activatorEvent2) {
        return;
      }
      const event = {
        active: active4,
        activatorEvent: activatorEvent2,
        collisions: collisions2,
        delta: {
          x: scrollAdjustedTranslate.x,
          y: scrollAdjustedTranslate.y
        },
        over: over2
      };
      reactDomExports.unstable_batchedUpdates(() => {
        onDragMove == null ? void 0 : onDragMove(event);
        dispatchMonitorEvent({
          type: "onDragMove",
          event
        });
      });
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [scrollAdjustedTranslate.x, scrollAdjustedTranslate.y]
  );
  reactExports.useEffect(
    () => {
      const {
        active: active4,
        activatorEvent: activatorEvent2,
        collisions: collisions2,
        droppableContainers: droppableContainers2,
        scrollAdjustedTranslate: scrollAdjustedTranslate2
      } = sensorContext.current;
      if (!active4 || activeRef.current == null || !activatorEvent2 || !scrollAdjustedTranslate2) {
        return;
      }
      const {
        onDragOver
      } = latestProps.current;
      const overContainer = droppableContainers2.get(overId);
      const over2 = overContainer && overContainer.rect.current ? {
        id: overContainer.id,
        rect: overContainer.rect.current,
        data: overContainer.data,
        disabled: overContainer.disabled
      } : null;
      const event = {
        active: active4,
        activatorEvent: activatorEvent2,
        collisions: collisions2,
        delta: {
          x: scrollAdjustedTranslate2.x,
          y: scrollAdjustedTranslate2.y
        },
        over: over2
      };
      reactDomExports.unstable_batchedUpdates(() => {
        setOver(over2);
        onDragOver == null ? void 0 : onDragOver(event);
        dispatchMonitorEvent({
          type: "onDragOver",
          event
        });
      });
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [overId]
  );
  useIsomorphicLayoutEffect(() => {
    sensorContext.current = {
      activatorEvent,
      active: active3,
      activeNode,
      collisionRect,
      collisions,
      droppableRects,
      draggableNodes,
      draggingNode,
      draggingNodeRect,
      droppableContainers,
      over,
      scrollableAncestors,
      scrollAdjustedTranslate
    };
    activeRects.current = {
      initial: draggingNodeRect,
      translated: collisionRect
    };
  }, [active3, activeNode, collisions, collisionRect, draggableNodes, draggingNode, draggingNodeRect, droppableRects, droppableContainers, over, scrollableAncestors, scrollAdjustedTranslate]);
  useAutoScroller({
    ...autoScrollOptions,
    delta: translate,
    draggingRect: collisionRect,
    pointerCoordinates,
    scrollableAncestors,
    scrollableAncestorRects
  });
  const publicContext = reactExports.useMemo(() => {
    const context = {
      active: active3,
      activeNode,
      activeNodeRect,
      activatorEvent,
      collisions,
      containerNodeRect,
      dragOverlay,
      draggableNodes,
      droppableContainers,
      droppableRects,
      over,
      measureDroppableContainers,
      scrollableAncestors,
      scrollableAncestorRects,
      measuringConfiguration,
      measuringScheduled,
      windowRect
    };
    return context;
  }, [active3, activeNode, activeNodeRect, activatorEvent, collisions, containerNodeRect, dragOverlay, draggableNodes, droppableContainers, droppableRects, over, measureDroppableContainers, scrollableAncestors, scrollableAncestorRects, measuringConfiguration, measuringScheduled, windowRect]);
  const internalContext = reactExports.useMemo(() => {
    const context = {
      activatorEvent,
      activators,
      active: active3,
      activeNodeRect,
      ariaDescribedById: {
        draggable: draggableDescribedById
      },
      dispatch,
      draggableNodes,
      over,
      measureDroppableContainers
    };
    return context;
  }, [activatorEvent, activators, active3, activeNodeRect, dispatch, draggableDescribedById, draggableNodes, over, measureDroppableContainers]);
  return React$5.createElement(DndMonitorContext.Provider, {
    value: registerMonitorListener
  }, React$5.createElement(InternalContext.Provider, {
    value: internalContext
  }, React$5.createElement(PublicContext.Provider, {
    value: publicContext
  }, React$5.createElement(ActiveDraggableContext.Provider, {
    value: transform2
  }, children)), React$5.createElement(RestoreFocus, {
    disabled: (accessibility == null ? void 0 : accessibility.restoreFocus) === false
  })), React$5.createElement(Accessibility, {
    ...accessibility,
    hiddenTextDescribedById: draggableDescribedById
  }));
  function getAutoScrollerOptions() {
    const activeSensorDisablesAutoscroll = (activeSensor == null ? void 0 : activeSensor.autoScrollEnabled) === false;
    const autoScrollGloballyDisabled = typeof autoScroll === "object" ? autoScroll.enabled === false : autoScroll === false;
    const enabled = isInitialized && !activeSensorDisablesAutoscroll && !autoScrollGloballyDisabled;
    if (typeof autoScroll === "object") {
      return {
        ...autoScroll,
        enabled
      };
    }
    return {
      enabled
    };
  }
});
const NullContext = /* @__PURE__ */ reactExports.createContext(null);
const defaultRole = "button";
const ID_PREFIX$1 = "Draggable";
function useDraggable(_ref) {
  let {
    id: id2,
    data,
    disabled = false,
    attributes: attributes2
  } = _ref;
  const key = useUniqueId(ID_PREFIX$1);
  const {
    activators,
    activatorEvent,
    active: active3,
    activeNodeRect,
    ariaDescribedById,
    draggableNodes,
    over
  } = reactExports.useContext(InternalContext);
  const {
    role = defaultRole,
    roleDescription = "draggable",
    tabIndex = 0
  } = attributes2 != null ? attributes2 : {};
  const isDragging2 = (active3 == null ? void 0 : active3.id) === id2;
  const transform2 = reactExports.useContext(isDragging2 ? ActiveDraggableContext : NullContext);
  const [node2, setNodeRef] = useNodeRef();
  const [activatorNode, setActivatorNodeRef] = useNodeRef();
  const listeners = useSyntheticListeners(activators, id2);
  const dataRef = useLatestValue(data);
  useIsomorphicLayoutEffect(
    () => {
      draggableNodes.set(id2, {
        id: id2,
        key,
        node: node2,
        activatorNode,
        data: dataRef
      });
      return () => {
        const node3 = draggableNodes.get(id2);
        if (node3 && node3.key === key) {
          draggableNodes.delete(id2);
        }
      };
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [draggableNodes, id2]
  );
  const memoizedAttributes = reactExports.useMemo(() => ({
    role,
    tabIndex,
    "aria-disabled": disabled,
    "aria-pressed": isDragging2 && role === defaultRole ? true : void 0,
    "aria-roledescription": roleDescription,
    "aria-describedby": ariaDescribedById.draggable
  }), [disabled, role, tabIndex, isDragging2, roleDescription, ariaDescribedById.draggable]);
  return {
    active: active3,
    activatorEvent,
    activeNodeRect,
    attributes: memoizedAttributes,
    isDragging: isDragging2,
    listeners: disabled ? void 0 : listeners,
    node: node2,
    over,
    setNodeRef,
    setActivatorNodeRef,
    transform: transform2
  };
}
function useDndContext() {
  return reactExports.useContext(PublicContext);
}
const ID_PREFIX$1$1 = "Droppable";
const defaultResizeObserverConfig = {
  timeout: 25
};
function useDroppable(_ref) {
  let {
    data,
    disabled = false,
    id: id2,
    resizeObserverConfig
  } = _ref;
  const key = useUniqueId(ID_PREFIX$1$1);
  const {
    active: active3,
    dispatch,
    over,
    measureDroppableContainers
  } = reactExports.useContext(InternalContext);
  const previous2 = reactExports.useRef({
    disabled
  });
  const resizeObserverConnected = reactExports.useRef(false);
  const rect = reactExports.useRef(null);
  const callbackId = reactExports.useRef(null);
  const {
    disabled: resizeObserverDisabled,
    updateMeasurementsFor,
    timeout: resizeObserverTimeout
  } = {
    ...defaultResizeObserverConfig,
    ...resizeObserverConfig
  };
  const ids2 = useLatestValue(updateMeasurementsFor != null ? updateMeasurementsFor : id2);
  const handleResize = reactExports.useCallback(
    () => {
      if (!resizeObserverConnected.current) {
        resizeObserverConnected.current = true;
        return;
      }
      if (callbackId.current != null) {
        clearTimeout(callbackId.current);
      }
      callbackId.current = setTimeout(() => {
        measureDroppableContainers(Array.isArray(ids2.current) ? ids2.current : [ids2.current]);
        callbackId.current = null;
      }, resizeObserverTimeout);
    },
    //eslint-disable-next-line react-hooks/exhaustive-deps
    [resizeObserverTimeout]
  );
  const resizeObserver2 = useResizeObserver({
    callback: handleResize,
    disabled: resizeObserverDisabled || !active3
  });
  const handleNodeChange = reactExports.useCallback((newElement, previousElement) => {
    if (!resizeObserver2) {
      return;
    }
    if (previousElement) {
      resizeObserver2.unobserve(previousElement);
      resizeObserverConnected.current = false;
    }
    if (newElement) {
      resizeObserver2.observe(newElement);
    }
  }, [resizeObserver2]);
  const [nodeRef, setNodeRef] = useNodeRef(handleNodeChange);
  const dataRef = useLatestValue(data);
  reactExports.useEffect(() => {
    if (!resizeObserver2 || !nodeRef.current) {
      return;
    }
    resizeObserver2.disconnect();
    resizeObserverConnected.current = false;
    resizeObserver2.observe(nodeRef.current);
  }, [nodeRef, resizeObserver2]);
  reactExports.useEffect(
    () => {
      dispatch({
        type: Action.RegisterDroppable,
        element: {
          id: id2,
          key,
          disabled,
          node: nodeRef,
          rect,
          data: dataRef
        }
      });
      return () => dispatch({
        type: Action.UnregisterDroppable,
        key,
        id: id2
      });
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [id2]
  );
  reactExports.useEffect(() => {
    if (disabled !== previous2.current.disabled) {
      dispatch({
        type: Action.SetDroppableDisabled,
        id: id2,
        key,
        disabled
      });
      previous2.current.disabled = disabled;
    }
  }, [id2, key, disabled, dispatch]);
  return {
    active: active3,
    rect,
    isOver: (over == null ? void 0 : over.id) === id2,
    node: nodeRef,
    over,
    setNodeRef
  };
}
function arrayMove(array4, from2, to2) {
  const newArray = array4.slice();
  newArray.splice(to2 < 0 ? newArray.length + to2 : to2, 0, newArray.splice(from2, 1)[0]);
  return newArray;
}
function getSortedRects(items, rects) {
  return items.reduce((accumulator, id2, index2) => {
    const rect = rects.get(id2);
    if (rect) {
      accumulator[index2] = rect;
    }
    return accumulator;
  }, Array(items.length));
}
function isValidIndex(index2) {
  return index2 !== null && index2 >= 0;
}
function itemsEqual(a2, b2) {
  if (a2 === b2) {
    return true;
  }
  if (a2.length !== b2.length) {
    return false;
  }
  for (let i2 = 0; i2 < a2.length; i2++) {
    if (a2[i2] !== b2[i2]) {
      return false;
    }
  }
  return true;
}
function normalizeDisabled(disabled) {
  if (typeof disabled === "boolean") {
    return {
      draggable: disabled,
      droppable: disabled
    };
  }
  return disabled;
}
const rectSortingStrategy = (_ref) => {
  let {
    rects,
    activeIndex,
    overIndex,
    index: index2
  } = _ref;
  const newRects = arrayMove(rects, overIndex, activeIndex);
  const oldRect = rects[index2];
  const newRect = newRects[index2];
  if (!newRect || !oldRect) {
    return null;
  }
  return {
    x: newRect.left - oldRect.left,
    y: newRect.top - oldRect.top,
    scaleX: newRect.width / oldRect.width,
    scaleY: newRect.height / oldRect.height
  };
};
const defaultScale$1 = {
  scaleX: 1,
  scaleY: 1
};
const verticalListSortingStrategy = (_ref) => {
  var _rects$activeIndex;
  let {
    activeIndex,
    activeNodeRect: fallbackActiveRect,
    index: index2,
    rects,
    overIndex
  } = _ref;
  const activeNodeRect = (_rects$activeIndex = rects[activeIndex]) != null ? _rects$activeIndex : fallbackActiveRect;
  if (!activeNodeRect) {
    return null;
  }
  if (index2 === activeIndex) {
    const overIndexRect = rects[overIndex];
    if (!overIndexRect) {
      return null;
    }
    return {
      x: 0,
      y: activeIndex < overIndex ? overIndexRect.top + overIndexRect.height - (activeNodeRect.top + activeNodeRect.height) : overIndexRect.top - activeNodeRect.top,
      ...defaultScale$1
    };
  }
  const itemGap = getItemGap$1(rects, index2, activeIndex);
  if (index2 > activeIndex && index2 <= overIndex) {
    return {
      x: 0,
      y: -activeNodeRect.height - itemGap,
      ...defaultScale$1
    };
  }
  if (index2 < activeIndex && index2 >= overIndex) {
    return {
      x: 0,
      y: activeNodeRect.height + itemGap,
      ...defaultScale$1
    };
  }
  return {
    x: 0,
    y: 0,
    ...defaultScale$1
  };
};
function getItemGap$1(clientRects, index2, activeIndex) {
  const currentRect = clientRects[index2];
  const previousRect = clientRects[index2 - 1];
  const nextRect = clientRects[index2 + 1];
  if (!currentRect) {
    return 0;
  }
  if (activeIndex < index2) {
    return previousRect ? currentRect.top - (previousRect.top + previousRect.height) : nextRect ? nextRect.top - (currentRect.top + currentRect.height) : 0;
  }
  return nextRect ? nextRect.top - (currentRect.top + currentRect.height) : previousRect ? currentRect.top - (previousRect.top + previousRect.height) : 0;
}
const ID_PREFIX = "Sortable";
const Context = /* @__PURE__ */ React$5.createContext({
  activeIndex: -1,
  containerId: ID_PREFIX,
  disableTransforms: false,
  items: [],
  overIndex: -1,
  useDragOverlay: false,
  sortedRects: [],
  strategy: rectSortingStrategy,
  disabled: {
    draggable: false,
    droppable: false
  }
});
function SortableContext$1(_ref) {
  let {
    children,
    id: id2,
    items: userDefinedItems,
    strategy = rectSortingStrategy,
    disabled: disabledProp = false
  } = _ref;
  const {
    active: active3,
    dragOverlay,
    droppableRects,
    over,
    measureDroppableContainers
  } = useDndContext();
  const containerId = useUniqueId(ID_PREFIX, id2);
  const useDragOverlay = Boolean(dragOverlay.rect !== null);
  const items = reactExports.useMemo(() => userDefinedItems.map((item) => typeof item === "object" && "id" in item ? item.id : item), [userDefinedItems]);
  const isDragging2 = active3 != null;
  const activeIndex = active3 ? items.indexOf(active3.id) : -1;
  const overIndex = over ? items.indexOf(over.id) : -1;
  const previousItemsRef = reactExports.useRef(items);
  const itemsHaveChanged = !itemsEqual(items, previousItemsRef.current);
  const disableTransforms = overIndex !== -1 && activeIndex === -1 || itemsHaveChanged;
  const disabled = normalizeDisabled(disabledProp);
  useIsomorphicLayoutEffect(() => {
    if (itemsHaveChanged && isDragging2) {
      measureDroppableContainers(items);
    }
  }, [itemsHaveChanged, items, isDragging2, measureDroppableContainers]);
  reactExports.useEffect(() => {
    previousItemsRef.current = items;
  }, [items]);
  const contextValue = reactExports.useMemo(
    () => ({
      activeIndex,
      containerId,
      disabled,
      disableTransforms,
      items,
      overIndex,
      useDragOverlay,
      sortedRects: getSortedRects(items, droppableRects),
      strategy
    }),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [activeIndex, containerId, disabled.draggable, disabled.droppable, disableTransforms, items, overIndex, droppableRects, useDragOverlay, strategy]
  );
  return React$5.createElement(Context.Provider, {
    value: contextValue
  }, children);
}
const defaultNewIndexGetter = (_ref) => {
  let {
    id: id2,
    items,
    activeIndex,
    overIndex
  } = _ref;
  return arrayMove(items, activeIndex, overIndex).indexOf(id2);
};
const defaultAnimateLayoutChanges = (_ref2) => {
  let {
    containerId,
    isSorting,
    wasDragging,
    index: index2,
    items,
    newIndex,
    previousItems,
    previousContainerId,
    transition: transition3
  } = _ref2;
  if (!transition3 || !wasDragging) {
    return false;
  }
  if (previousItems !== items && index2 === newIndex) {
    return false;
  }
  if (isSorting) {
    return true;
  }
  return newIndex !== index2 && containerId === previousContainerId;
};
const defaultTransition = {
  duration: 200,
  easing: "ease"
};
const transitionProperty = "transform";
const disabledTransition = /* @__PURE__ */ CSS$1.Transition.toString({
  property: transitionProperty,
  duration: 0,
  easing: "linear"
});
const defaultAttributes = {
  roleDescription: "sortable"
};
function useDerivedTransform(_ref) {
  let {
    disabled,
    index: index2,
    node: node2,
    rect
  } = _ref;
  const [derivedTransform, setDerivedtransform] = reactExports.useState(null);
  const previousIndex = reactExports.useRef(index2);
  useIsomorphicLayoutEffect(() => {
    if (!disabled && index2 !== previousIndex.current && node2.current) {
      const initial = rect.current;
      if (initial) {
        const current = getClientRect(node2.current, {
          ignoreTransform: true
        });
        const delta = {
          x: initial.left - current.left,
          y: initial.top - current.top,
          scaleX: initial.width / current.width,
          scaleY: initial.height / current.height
        };
        if (delta.x || delta.y) {
          setDerivedtransform(delta);
        }
      }
    }
    if (index2 !== previousIndex.current) {
      previousIndex.current = index2;
    }
  }, [disabled, index2, node2, rect]);
  reactExports.useEffect(() => {
    if (derivedTransform) {
      setDerivedtransform(null);
    }
  }, [derivedTransform]);
  return derivedTransform;
}
function useSortable(_ref) {
  let {
    animateLayoutChanges = defaultAnimateLayoutChanges,
    attributes: userDefinedAttributes,
    disabled: localDisabled,
    data: customData,
    getNewIndex = defaultNewIndexGetter,
    id: id2,
    strategy: localStrategy,
    resizeObserverConfig,
    transition: transition3 = defaultTransition
  } = _ref;
  const {
    items,
    containerId,
    activeIndex,
    disabled: globalDisabled,
    disableTransforms,
    sortedRects,
    overIndex,
    useDragOverlay,
    strategy: globalStrategy
  } = reactExports.useContext(Context);
  const disabled = normalizeLocalDisabled(localDisabled, globalDisabled);
  const index2 = items.indexOf(id2);
  const data = reactExports.useMemo(() => ({
    sortable: {
      containerId,
      index: index2,
      items
    },
    ...customData
  }), [containerId, customData, index2, items]);
  const itemsAfterCurrentSortable = reactExports.useMemo(() => items.slice(items.indexOf(id2)), [items, id2]);
  const {
    rect,
    node: node2,
    isOver,
    setNodeRef: setDroppableNodeRef
  } = useDroppable({
    id: id2,
    data,
    disabled: disabled.droppable,
    resizeObserverConfig: {
      updateMeasurementsFor: itemsAfterCurrentSortable,
      ...resizeObserverConfig
    }
  });
  const {
    active: active3,
    activatorEvent,
    activeNodeRect,
    attributes: attributes2,
    setNodeRef: setDraggableNodeRef,
    listeners,
    isDragging: isDragging2,
    over,
    setActivatorNodeRef,
    transform: transform2
  } = useDraggable({
    id: id2,
    data,
    attributes: {
      ...defaultAttributes,
      ...userDefinedAttributes
    },
    disabled: disabled.draggable
  });
  const setNodeRef = useCombinedRefs(setDroppableNodeRef, setDraggableNodeRef);
  const isSorting = Boolean(active3);
  const displaceItem = isSorting && !disableTransforms && isValidIndex(activeIndex) && isValidIndex(overIndex);
  const shouldDisplaceDragSource = !useDragOverlay && isDragging2;
  const dragSourceDisplacement = shouldDisplaceDragSource && displaceItem ? transform2 : null;
  const strategy = localStrategy != null ? localStrategy : globalStrategy;
  const finalTransform = displaceItem ? dragSourceDisplacement != null ? dragSourceDisplacement : strategy({
    rects: sortedRects,
    activeNodeRect,
    activeIndex,
    overIndex,
    index: index2
  }) : null;
  const newIndex = isValidIndex(activeIndex) && isValidIndex(overIndex) ? getNewIndex({
    id: id2,
    items,
    activeIndex,
    overIndex
  }) : index2;
  const activeId = active3 == null ? void 0 : active3.id;
  const previous2 = reactExports.useRef({
    activeId,
    items,
    newIndex,
    containerId
  });
  const itemsHaveChanged = items !== previous2.current.items;
  const shouldAnimateLayoutChanges = animateLayoutChanges({
    active: active3,
    containerId,
    isDragging: isDragging2,
    isSorting,
    id: id2,
    index: index2,
    items,
    newIndex: previous2.current.newIndex,
    previousItems: previous2.current.items,
    previousContainerId: previous2.current.containerId,
    transition: transition3,
    wasDragging: previous2.current.activeId != null
  });
  const derivedTransform = useDerivedTransform({
    disabled: !shouldAnimateLayoutChanges,
    index: index2,
    node: node2,
    rect
  });
  reactExports.useEffect(() => {
    if (isSorting && previous2.current.newIndex !== newIndex) {
      previous2.current.newIndex = newIndex;
    }
    if (containerId !== previous2.current.containerId) {
      previous2.current.containerId = containerId;
    }
    if (items !== previous2.current.items) {
      previous2.current.items = items;
    }
  }, [isSorting, newIndex, containerId, items]);
  reactExports.useEffect(() => {
    if (activeId === previous2.current.activeId) {
      return;
    }
    if (activeId && !previous2.current.activeId) {
      previous2.current.activeId = activeId;
      return;
    }
    const timeoutId = setTimeout(() => {
      previous2.current.activeId = activeId;
    }, 50);
    return () => clearTimeout(timeoutId);
  }, [activeId]);
  return {
    active: active3,
    activeIndex,
    attributes: attributes2,
    data,
    rect,
    index: index2,
    newIndex,
    items,
    isOver,
    isSorting,
    isDragging: isDragging2,
    listeners,
    node: node2,
    overIndex,
    over,
    setNodeRef,
    setActivatorNodeRef,
    setDroppableNodeRef,
    setDraggableNodeRef,
    transform: derivedTransform != null ? derivedTransform : finalTransform,
    transition: getTransition3()
  };
  function getTransition3() {
    if (
      // Temporarily disable transitions for a single frame to set up derived transforms
      derivedTransform || // Or to prevent items jumping to back to their "new" position when items change
      itemsHaveChanged && previous2.current.newIndex === index2
    ) {
      return disabledTransition;
    }
    if (shouldDisplaceDragSource && !isKeyboardEvent(activatorEvent) || !transition3) {
      return void 0;
    }
    if (isSorting || shouldAnimateLayoutChanges) {
      return CSS$1.Transition.toString({
        ...transition3,
        property: transitionProperty
      });
    }
    return void 0;
  }
}
function normalizeLocalDisabled(localDisabled, globalDisabled) {
  var _localDisabled$dragga, _localDisabled$droppa;
  if (typeof localDisabled === "boolean") {
    return {
      draggable: localDisabled,
      // Backwards compatibility
      droppable: false
    };
  }
  return {
    draggable: (_localDisabled$dragga = localDisabled == null ? void 0 : localDisabled.draggable) != null ? _localDisabled$dragga : globalDisabled.draggable,
    droppable: (_localDisabled$droppa = localDisabled == null ? void 0 : localDisabled.droppable) != null ? _localDisabled$droppa : globalDisabled.droppable
  };
}
function hasSortableData(entry) {
  if (!entry) {
    return false;
  }
  const data = entry.data.current;
  if (data && "sortable" in data && typeof data.sortable === "object" && "containerId" in data.sortable && "items" in data.sortable && "index" in data.sortable) {
    return true;
  }
  return false;
}
const directions = [KeyboardCode.Down, KeyboardCode.Right, KeyboardCode.Up, KeyboardCode.Left];
const sortableKeyboardCoordinates = (event, _ref) => {
  let {
    context: {
      active: active3,
      collisionRect,
      droppableRects,
      droppableContainers,
      over,
      scrollableAncestors
    }
  } = _ref;
  if (directions.includes(event.code)) {
    event.preventDefault();
    if (!active3 || !collisionRect) {
      return;
    }
    const filteredContainers = [];
    droppableContainers.getEnabled().forEach((entry) => {
      if (!entry || entry != null && entry.disabled) {
        return;
      }
      const rect = droppableRects.get(entry.id);
      if (!rect) {
        return;
      }
      switch (event.code) {
        case KeyboardCode.Down:
          if (collisionRect.top < rect.top) {
            filteredContainers.push(entry);
          }
          break;
        case KeyboardCode.Up:
          if (collisionRect.top > rect.top) {
            filteredContainers.push(entry);
          }
          break;
        case KeyboardCode.Left:
          if (collisionRect.left > rect.left) {
            filteredContainers.push(entry);
          }
          break;
        case KeyboardCode.Right:
          if (collisionRect.left < rect.left) {
            filteredContainers.push(entry);
          }
          break;
      }
    });
    const collisions = closestCorners({
      collisionRect,
      droppableRects,
      droppableContainers: filteredContainers
    });
    let closestId = getFirstCollision(collisions, "id");
    if (closestId === (over == null ? void 0 : over.id) && collisions.length > 1) {
      closestId = collisions[1].id;
    }
    if (closestId != null) {
      const activeDroppable = droppableContainers.get(active3.id);
      const newDroppable = droppableContainers.get(closestId);
      const newRect = newDroppable ? droppableRects.get(newDroppable.id) : null;
      const newNode = newDroppable == null ? void 0 : newDroppable.node.current;
      if (newNode && newRect && activeDroppable && newDroppable) {
        const newScrollAncestors = getScrollableAncestors(newNode);
        const hasDifferentScrollAncestors = newScrollAncestors.some((element2, index2) => scrollableAncestors[index2] !== element2);
        const hasSameContainer = isSameContainer(activeDroppable, newDroppable);
        const isAfterActive = isAfter(activeDroppable, newDroppable);
        const offset2 = hasDifferentScrollAncestors || !hasSameContainer ? {
          x: 0,
          y: 0
        } : {
          x: isAfterActive ? collisionRect.width - newRect.width : 0,
          y: isAfterActive ? collisionRect.height - newRect.height : 0
        };
        const rectCoordinates = {
          x: newRect.left,
          y: newRect.top
        };
        const newCoordinates = offset2.x && offset2.y ? rectCoordinates : subtract(rectCoordinates, offset2);
        return newCoordinates;
      }
    }
  }
  return void 0;
};
function isSameContainer(a2, b2) {
  if (!hasSortableData(a2) || !hasSortableData(b2)) {
    return false;
  }
  return a2.data.current.sortable.containerId === b2.data.current.sortable.containerId;
}
function isAfter(a2, b2) {
  if (!hasSortableData(a2) || !hasSortableData(b2)) {
    return false;
  }
  if (!isSameContainer(a2, b2)) {
    return false;
  }
  return a2.data.current.sortable.index < b2.data.current.sortable.index;
}
const DragHandle = (props) => {
  const { style: style2 = {}, className, ...otherProps } = props || {};
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    chip_default,
    {
      className: `drag-handle ${className || ""} cursor-pointer`,
      size: "sm",
      style: { cursor: "all-scroll", ...style2 },
      title: t2("Drag to sort"),
      variant: "light",
      ...otherProps || {},
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDrag, { className: "text-lg" })
    }
  );
};
DragHandle.displayName = "DragHandle";
function SortableChoice({
  id: id2,
  choice: propsChoice,
  onRemove,
  onChange,
  style: propsStyle,
  checkUsage,
  onEnterKeyDown
}) {
  const { t: t2 } = useTranslation();
  const { attributes: attributes2, listeners, setNodeRef, transform: transform2, transition: transition3 } = useSortable({ id: id2 });
  const { createPortal } = useBakabaseContext();
  const [choice, setChoice] = reactExports.useState(propsChoice);
  reactExports.useEffect(() => {
  }, []);
  useUpdateEffect(() => {
    onChange == null ? void 0 : onChange(choice);
  }, [choice]);
  const style2 = {
    transform: CSS$1.Transform.toString(transform2),
    transition: transition3,
    ...propsStyle
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: setNodeRef, className: "flex gap-1 items-center", style: style2, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(DragHandle, { ...listeners, ...attributes2 }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      ColorPicker$1,
      {
        color: choice.color ?? colors.color,
        onChange: (color2) => {
          setChoice({
            ...choice,
            color: buildColorValueString(color2)
          });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        autoFocus: !choice.label,
        size: "sm",
        value: choice == null ? void 0 : choice.label,
        onKeyDown: (e2) => {
          if (e2.key === "Enter") {
            onEnterKeyDown == null ? void 0 : onEnterKeyDown();
          }
        },
        onValueChange: (label) => {
          setChoice({
            ...choice,
            label
          });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          radius: "sm",
          size: "sm",
          title: t2("Hide in view"),
          variant: "light",
          onClick: () => {
            setChoice({
              ...choice,
              hide: !choice.hide
            });
          },
          children: choice.hide ? /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-base" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1d, { className: "text-base" })
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "danger",
          radius: "sm",
          size: "sm",
          variant: "light",
          onClick: async () => {
            if (checkUsage) {
              const count = await checkUsage(choice.value);
              if (count > 0) {
                createPortal(Modal, {
                  defaultVisible: true,
                  size: "sm",
                  title: t2(
                    "Value is being referenced in {{count}} places",
                    { count }
                  ),
                  children: t2("Sure to delete?"),
                  onOk: async () => {
                    onRemove == null ? void 0 : onRemove(choice);
                  }
                });
                return;
              }
            }
            onRemove == null ? void 0 : onRemove(choice);
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" })
        }
      )
    ] })
  ] });
}
const lineHeight = 35;
function ChoiceList({
  choices: propsChoices,
  onChange,
  className,
  checkUsage
}) {
  const { t: t2 } = useTranslation();
  const [choices, setChoices] = reactExports.useState(propsChoices || []);
  const [editInBulkPopupVisible, setEditInBulkPopupVisible] = reactExports.useState(false);
  const [editInBulkText, setEditInBulkText] = reactExports.useState("");
  const [bulkEditSummaries, setBulkEditSummaries] = reactExports.useState([]);
  const calculateBulkEditSummaryTimeoutRef = reactExports.useRef();
  const sensors = useSensors(
    useSensor(PointerSensor),
    useSensor(KeyboardSensor, {
      coordinateGetter: sortableKeyboardCoordinates
    })
  );
  const virtualListRef = reactExports.useRef();
  reactExports.useEffect(() => {
    onChange == null ? void 0 : onChange(choices);
  }, [choices]);
  const buildChoicesFromBulkText = (text2) => {
    return text2.split("\n").map((c2) => {
      const str = c2.trim();
      if (str.length == 0) {
        return null;
      }
      const t22 = choices.find((x2) => x2.label == str);
      if (t22) {
        return t22;
      }
      return {
        label: str,
        value: uuidv4()
      };
    }).filter((x2) => x2 != null);
  };
  const calculateBulkEditSummary = (text2) => {
    const ctxChoices = buildChoicesFromBulkText(text2);
    const addedChoicesCount = ctxChoices.filter(
      (x2) => !choices.includes(x2)
    ).length;
    const sameChoicesCount = ctxChoices.filter(
      (x2) => choices.includes(x2)
    ).length;
    const deletedChoicesCount = choices.length - sameChoicesCount;
    if (deletedChoicesCount > 0 || addedChoicesCount > 0) {
      const tips = [
        deletedChoicesCount > 0 ? t2("{{count}} data will be deleted", {
          count: deletedChoicesCount
        }) : "",
        addedChoicesCount > 0 ? t2("{{count}} data will be added", {
          count: addedChoicesCount
        }) : ""
      ];
      setBulkEditSummaries(tips.filter((t22) => t22));
    } else {
      setBulkEditSummaries([]);
    }
  };
  const addChoice = () => {
    const newChoices = [...choices, { label: "", value: uuidv4() }];
    setChoices(newChoices);
    setTimeout(() => {
      var _a2;
      (_a2 = virtualListRef.current) == null ? void 0 : _a2.scrollToRow(newChoices.length - 1);
    }, 100);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-between items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Button,
      {
        size: "sm",
        variant: "light",
        onClick: () => {
          choices.sort(
            (a2, b2) => (a2.label || "").localeCompare(b2.label || "")
          );
          setChoices([...choices]);
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(MdSort, { className: "text-base" }),
          t2("Sort by alphabet")
        ]
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 mb-2 flex flex-col gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      DndContext,
      {
        collisionDetection: closestCenter,
        sensors,
        onDragEnd: handleDragEnd,
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          SortableContext$1,
          {
            items: choices == null ? void 0 : choices.map((c2) => ({ ...c2, id: c2.value })),
            strategy: verticalListSortingStrategy,
            children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { height: Math.min(choices.length, 6) * lineHeight }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AutoSizer, { children: ({ width, height }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
              List,
              {
                ref: virtualListRef,
                height,
                rowCount: choices.length,
                rowHeight: lineHeight,
                rowRenderer: (ctx) => {
                  const { key, index: index2, style: style2 } = ctx;
                  const sc2 = choices[index2];
                  return /* @__PURE__ */ jsxRuntimeExports.jsx(
                    SortableChoice,
                    {
                      choice: sc2,
                      style: style2,
                      onChange: (t22) => {
                        choices[index2] = t22;
                        setChoices([...choices]);
                      },
                      onEnterKeyDown: () => {
                        addChoice();
                      },
                      onRemove: (t22) => {
                        choices.splice(index2, 1);
                        setChoices([...choices]);
                      },
                      checkUsage,
                      id: sc2.value
                    },
                    sc2.value
                  );
                },
                width
              }
            ) }) })
          }
        )
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          size: "sm",
          onClick: () => {
            addChoice();
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(MdAddCircle, { className: "text-base" }),
            t2("Add a choice")
          ]
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        PopoverComponent,
        {
          placement: "right",
          size: "lg",
          style: { zIndex: 100 },
          trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "sm", variant: "light", children: t2("Add or delete in bulk") }),
          visible: editInBulkPopupVisible,
          onVisibleChange: (v2) => {
            if (v2) {
              const text2 = choices.map((t22) => t22.label).join("\n");
              setEditInBulkText(text2);
            }
            setEditInBulkPopupVisible(v2);
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 m-2 ", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-base", children: t2("Add or delete choices in bulk") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-sm opacity-70", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Choices will be separated by line breaks.") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "Once you click the submit button, new choices will be added to the list, and missing choices will be deleted."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "Be cautions: once you modify the text in one line, it will be treated as a new choice, and the original choice will be deleted."
              ) })
            ] }),
            bulkEditSummaries.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2 text-sm", children: bulkEditSummaries.map((s2) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "light", children: s2 })) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              textarea_default,
              {
                onValueChange: (v2) => {
                  setEditInBulkText(v2);
                  calculateBulkEditSummaryTimeoutRef.current && clearTimeout(calculateBulkEditSummaryTimeoutRef.current);
                  calculateBulkEditSummaryTimeoutRef.current = setTimeout(() => {
                    calculateBulkEditSummary(v2);
                    calculateBulkEditSummaryTimeoutRef.current = void 0;
                  }, 1e3);
                },
                value: editInBulkText,
                maxRows: 16
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-end items-center", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  size: "sm",
                  variant: "light",
                  onClick: () => {
                    setEditInBulkPopupVisible(false);
                  },
                  children: t2("Cancel")
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: "primary",
                  isLoading: !!calculateBulkEditSummaryTimeoutRef.current,
                  size: "sm",
                  onClick: () => {
                    setChoices(buildChoicesFromBulkText(editInBulkText));
                    setEditInBulkPopupVisible(false);
                  },
                  children: t2("Submit")
                }
              )
            ] })
          ] })
        }
      )
    ] })
  ] });
  function handleDragEnd(event) {
    const { active: active3, over } = event;
    if (active3.value !== over.value) {
      setChoices((items) => {
        const oldIndex = items.indexOf(active3.value);
        const newIndex = items.indexOf(over.value);
        return arrayMove(items, oldIndex, newIndex);
      });
    }
  }
}
function SortableTag({
  id: id2,
  tag: propsTag,
  onRemove,
  onChange,
  style: propsStyle,
  checkUsage
}) {
  const { t: t2 } = useTranslation();
  const { attributes: attributes2, listeners, setNodeRef, transform: transform2, transition: transition3 } = useSortable({ id: id2 });
  const { createPortal } = useBakabaseContext();
  const [tag, setTag2] = reactExports.useState(propsTag);
  reactExports.useEffect(() => {
  }, []);
  useUpdateEffect(() => {
    onChange == null ? void 0 : onChange(tag);
  }, [tag]);
  const style2 = {
    transform: CSS$1.Transform.toString(transform2),
    transition: transition3,
    ...propsStyle
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: setNodeRef, className: "flex gap-1 items-center", style: style2, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(DragHandle, { ...listeners, ...attributes2 }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      ColorPicker$1,
      {
        color: tag.color ?? colors.color,
        onChange: (color2) => {
          setTag2({
            ...tag,
            color: buildColorValueString(color2)
          });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        placeholder: t2("Group of tag, optional"),
        size: "sm",
        value: tag == null ? void 0 : tag.group,
        onValueChange: (group) => {
          setTag2({
            ...tag,
            group
          });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        placeholder: t2("Name of tag, required"),
        size: "sm",
        value: tag == null ? void 0 : tag.name,
        onValueChange: (name2) => {
          setTag2({
            ...tag,
            name: name2
          });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          radius: "sm",
          size: "sm",
          title: t2("Hide in view"),
          variant: "light",
          onClick: () => {
            setTag2({
              ...tag,
              hide: !tag.hide
            });
          },
          children: tag.hide ? /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-base" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1d, { className: "text-base" })
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "danger",
          radius: "sm",
          size: "sm",
          variant: "light",
          onClick: async () => {
            if (checkUsage) {
              const count = await checkUsage(tag.value);
              if (count > 0) {
                createPortal(Modal, {
                  defaultVisible: true,
                  size: "sm",
                  title: t2(
                    "Value is being referenced in {{count}} places",
                    { count }
                  ),
                  children: t2("Sure to delete?"),
                  onOk: async () => {
                    onRemove == null ? void 0 : onRemove(tag);
                  }
                });
                return;
              }
            }
            onRemove == null ? void 0 : onRemove(tag);
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" })
        }
      )
    ] })
  ] });
}
const LineHeight = 35;
const GroupAndNameSeparator = ":";
function TagList({
  tags: propsTags,
  onChange,
  className,
  checkUsage
}) {
  const { t: t2 } = useTranslation();
  const [tags2, setTags] = reactExports.useState(propsTags || []);
  const [editInBulkPopupVisible, setEditInBulkPopupVisible] = reactExports.useState(false);
  const [editInBulkText, setEditInBulkText] = reactExports.useState("");
  const [bulkEditSummaries, setBulkEditSummaries] = reactExports.useState([]);
  const calculateBulkEditSummaryTimeoutRef = reactExports.useRef();
  const sensors = useSensors(
    useSensor(PointerSensor),
    useSensor(KeyboardSensor, {
      coordinateGetter: sortableKeyboardCoordinates
    })
  );
  const virtualListRef = reactExports.useRef();
  reactExports.useEffect(() => {
    onChange == null ? void 0 : onChange(tags2);
  }, [tags2]);
  const buildTagsFromBulkText = (text2) => {
    return text2.split("\n").map((c2) => {
      const str = c2.trim();
      if (str.length == 0) {
        return null;
      }
      const segments = str.split(GroupAndNameSeparator);
      let name2 = "";
      let group;
      if (segments.length == 1) {
        name2 = segments[0];
      } else {
        group = segments[0];
        name2 = segments[1];
      }
      const t22 = tags2.find((x2) => x2.name == name2 && x2.group == group);
      if (t22) {
        return t22;
      }
      return {
        group,
        name: name2,
        value: uuidv4()
      };
    }).filter((x2) => x2 != null);
  };
  const calculateBulkEditSummary = (text2) => {
    const ctxTags = buildTagsFromBulkText(text2);
    const addedTagsCount = ctxTags.filter((x2) => !tags2.includes(x2)).length;
    const sameTagsCount = ctxTags.filter((x2) => tags2.includes(x2)).length;
    const deletedTagsCount = tags2.length - sameTagsCount;
    if (deletedTagsCount > 0 || addedTagsCount > 0) {
      const tips = [
        deletedTagsCount > 0 ? t2("{{count}} data will be deleted", {
          count: deletedTagsCount
        }) : "",
        addedTagsCount > 0 ? t2("{{count}} data will be added", { count: addedTagsCount }) : ""
      ];
      setBulkEditSummaries(tips.filter((t22) => t22));
    } else {
      setBulkEditSummaries([]);
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-between items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Button,
      {
        size: "sm",
        variant: "light",
        onPress: () => {
          tags2.sort((a2, b2) => {
            const sa2 = a2.group ? `${a2.group}:${b2.name}` : b2.name;
            const sb2 = b2.group ? `${b2.group}:${b2.name}` : b2.name;
            return (sa2 ?? "").localeCompare(sb2 ?? "");
          });
          setTags([...tags2]);
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(MdSort, { className: "text-base" }),
          t2("Sort by alphabet")
        ]
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 mb-2 flex flex-col gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      DndContext,
      {
        collisionDetection: closestCenter,
        sensors,
        onDragEnd: handleDragEnd,
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          SortableContext$1,
          {
            items: tags2 == null ? void 0 : tags2.map((c2) => ({
              ...c2,
              id: c2.value
            })),
            strategy: verticalListSortingStrategy,
            children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { height: Math.min(tags2.length, 6) * LineHeight }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AutoSizer, { children: ({ width, height }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
              List,
              {
                ref: virtualListRef,
                height,
                rowCount: tags2.length,
                rowHeight: LineHeight,
                rowRenderer: (ctx) => {
                  const { key, index: index2, style: style2 } = ctx;
                  const sc2 = tags2[index2];
                  return /* @__PURE__ */ jsxRuntimeExports.jsx(
                    SortableTag,
                    {
                      checkUsage,
                      id: sc2.value,
                      style: style2,
                      tag: sc2,
                      onChange: (t22) => {
                        tags2[index2] = t22;
                        setTags([...tags2]);
                      },
                      onRemove: (t22) => {
                        tags2.splice(index2, 1);
                        setTags([...tags2]);
                      }
                    },
                    sc2.value
                  );
                },
                width
              }
            ) }) })
          }
        )
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          size: "sm",
          onClick: () => {
            const newTags = [...tags2, { value: uuidv4() }];
            setTags(newTags);
            setTimeout(() => {
              var _a2;
              (_a2 = virtualListRef.current) == null ? void 0 : _a2.scrollToRow(newTags.length - 1);
            }, 100);
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(MdAddCircle, { className: "text-base" }),
            t2("Add a choice")
          ]
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        PopoverComponent,
        {
          placement: "right",
          size: "lg",
          style: { zIndex: 100 },
          trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "sm", variant: "light", children: t2("Add or delete in bulk") }),
          visible: editInBulkPopupVisible,
          onVisibleChange: (v2) => {
            if (v2) {
              const text2 = tags2.map((t22) => {
                let s2 = "";
                if (t22.group != void 0 && t22.group.length > 0) {
                  s2 += t22.group + GroupAndNameSeparator;
                }
                s2 += t22.name;
                return s2;
              }).join("\n");
              setEditInBulkText(text2);
            }
            setEditInBulkPopupVisible(v2);
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 m-2 ", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-base", children: t2("Add or delete tags in bulk") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-sm opacity-70", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "Colon can be added between group and name, and tags will be separated by line breaks."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "Once you click the submit button, new tags will be added to the list, and missing tags will be deleted."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "Be cautions: once you modify the text in one line, it will be treated as a new tag, and the original tag will be deleted."
              ) })
            ] }),
            bulkEditSummaries.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2 text-sm", children: bulkEditSummaries.map((s2) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "light", children: s2 })) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              textarea_default,
              {
                onValueChange: (v2) => {
                  setEditInBulkText(v2);
                  calculateBulkEditSummaryTimeoutRef.current && clearTimeout(calculateBulkEditSummaryTimeoutRef.current);
                  calculateBulkEditSummaryTimeoutRef.current = setTimeout(() => {
                    calculateBulkEditSummary(v2);
                    calculateBulkEditSummaryTimeoutRef.current = void 0;
                  }, 1e3);
                },
                value: editInBulkText,
                maxRows: 16
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-end items-center", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  size: "sm",
                  variant: "light",
                  onClick: () => {
                    setEditInBulkPopupVisible(false);
                  },
                  children: t2("Cancel")
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: "primary",
                  isLoading: !!calculateBulkEditSummaryTimeoutRef.current,
                  size: "sm",
                  onClick: () => {
                    setTags(buildTagsFromBulkText(editInBulkText));
                    setEditInBulkPopupVisible(false);
                  },
                  children: t2("Submit")
                }
              )
            ] })
          ] })
        }
      )
    ] })
  ] });
  function handleDragEnd(event) {
    const { active: active3, over } = event;
    if (active3.value !== over.value) {
      setTags((items) => {
        const oldIndex = items.indexOf(active3.value);
        const newIndex = items.indexOf(over.value);
        return arrayMove(items, oldIndex, newIndex);
      });
    }
  }
}
const optimizeOptions = (options) => {
  if (!options) {
    return {};
  }
  if (options.choices) {
    options.choices = options.choices.map((c2) => {
      var _a2;
      return {
        ...c2,
        label: (_a2 = c2.label) == null ? void 0 : _a2.trim()
      };
    });
  }
  if (options.tags) {
    options.tags = options.tags.map((t2) => {
      var _a2, _b2;
      return {
        ...t2,
        name: (_a2 = t2.name) == null ? void 0 : _a2.trim(),
        group: (_b2 = t2.group) == null ? void 0 : _b2.trim()
      };
    });
  }
  return {
    ...options,
    choices: options.choices || [],
    tags: options.tags || []
  };
};
function GrInstallOption(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeWidth": "2", "d": "M12,18 L12,8 L12,18 Z M12,23 C18.0751322,23 23,18.0751322 23,12 C23,5.92486775 18.0751322,1 12,1 C5.92486775,1 1,5.92486775 1,12 C1,18.0751322 5.92486775,23 12,23 Z M17,12 L12,7 L7,12", "transform": "matrix(1 0 0 -1 0 24)" }, "child": [] }] })(props);
}
function GrResume(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeWidth": "2", "d": "M1,20 L6,20 L6,4 L1,4 L1,20 Z M11,19.0000002 L22,12 L11,5 L11,19.0000002 Z" }, "child": [] }] })(props);
}
function GrTextWrap(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeWidth": "2", "d": "M17,10 L24,10 L17,10 L17,10 Z M1,14 L14,14 L14,2 L1,2 L1,14 Z M6,6 C6,6.5525 5.5525,7 5,7 C4.4475,7 4,6.5525 4,6 C4,5.4475 4.4475,5 5,5 C5.5525,5 6,5.4475 6,6 M17,6 L24,6 L17,6 L17,6 Z M17,2 L24,2 L17,2 L17,2 Z M17,14 L24,14 L17,14 L17,14 Z M0,18 L24,18 L0,18 L0,18 Z M0,22 L24,22 L0,22 L0,22 Z M14,14 L14,13 L10,8 L7,11 L6,10 L2,14 L14,14 Z" }, "child": [] }] })(props);
}
function FaImages(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 576 512" }, "child": [{ "tag": "path", "attr": { "d": "M160 32c-35.3 0-64 28.7-64 64V320c0 35.3 28.7 64 64 64H512c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H160zM396 138.7l96 144c4.9 7.4 5.4 16.8 1.2 24.6S480.9 320 472 320H328 280 200c-9.2 0-17.6-5.3-21.6-13.6s-2.9-18.2 2.9-25.4l64-80c4.6-5.7 11.4-9 18.7-9s14.2 3.3 18.7 9l17.3 21.6 56-84C360.5 132 368 128 376 128s15.5 4 20 10.7zM192 128a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zM48 120c0-13.3-10.7-24-24-24S0 106.7 0 120V344c0 75.1 60.9 136 136 136H456c13.3 0 24-10.7 24-24s-10.7-24-24-24H136c-48.6 0-88-39.4-88-88V120z" }, "child": [] }] })(props);
}
function FaMagnet(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M0 160v96C0 379.7 100.3 480 224 480s224-100.3 224-224V160H320v96c0 53-43 96-96 96s-96-43-96-96V160H0zm0-32H128V64c0-17.7-14.3-32-32-32H32C14.3 32 0 46.3 0 64v64zm320 0H448V64c0-17.7-14.3-32-32-32H352c-17.7 0-32 14.3-32 32v64z" }, "child": [] }] })(props);
}
function FaRankingStar(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 640 512" }, "child": [{ "tag": "path", "attr": { "d": "M353.8 54.1L330.2 6.3c-3.9-8.3-16.1-8.6-20.4 0L286.2 54.1l-52.3 7.5c-9.3 1.4-13.3 12.9-6.4 19.8l38 37-9 52.1c-1.4 9.3 8.2 16.5 16.8 12.2l46.9-24.8 46.6 24.4c8.6 4.3 18.3-2.9 16.8-12.2l-9-52.1 38-36.6c6.8-6.8 2.9-18.3-6.4-19.8l-52.3-7.5zM256 256c-17.7 0-32 14.3-32 32V480c0 17.7 14.3 32 32 32H384c17.7 0 32-14.3 32-32V288c0-17.7-14.3-32-32-32H256zM32 320c-17.7 0-32 14.3-32 32V480c0 17.7 14.3 32 32 32H160c17.7 0 32-14.3 32-32V352c0-17.7-14.3-32-32-32H32zm416 96v64c0 17.7 14.3 32 32 32H608c17.7 0 32-14.3 32-32V416c0-17.7-14.3-32-32-32H480c-17.7 0-32 14.3-32 32z" }, "child": [] }] })(props);
}
function FaRegCircleCheck(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-111 111-47-47c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l64 64c9.4 9.4 24.6 9.4 33.9 0L369 209z" }, "child": [] }] })(props);
}
function FaRegCirclePause(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M464 256A208 208 0 1 0 48 256a208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zm224-72V328c0 13.3-10.7 24-24 24s-24-10.7-24-24V184c0-13.3 10.7-24 24-24s24 10.7 24 24zm112 0V328c0 13.3-10.7 24-24 24s-24-10.7-24-24V184c0-13.3 10.7-24 24-24s24 10.7 24 24z" }, "child": [] }] })(props);
}
function FaRegStar(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 576 512" }, "child": [{ "tag": "path", "attr": { "d": "M287.9 0c9.2 0 17.6 5.2 21.6 13.5l68.6 141.3 153.2 22.6c9 1.3 16.5 7.6 19.3 16.3s.5 18.1-5.9 24.5L433.6 328.4l26.2 155.6c1.5 9-2.2 18.1-9.7 23.5s-17.3 6-25.3 1.7l-137-73.2L151 509.1c-8.1 4.3-17.9 3.7-25.3-1.7s-11.2-14.5-9.7-23.5l26.2-155.6L31.1 218.2c-6.5-6.4-8.7-15.9-5.9-24.5s10.3-14.9 19.3-16.3l153.2-22.6L266.3 13.5C270.4 5.2 278.7 0 287.9 0zm0 79L235.4 187.2c-3.5 7.1-10.2 12.1-18.1 13.3L99 217.9 184.9 303c5.5 5.5 8.1 13.3 6.8 21L171.4 443.7l105.2-56.2c7.1-3.8 15.6-3.8 22.6 0l105.2 56.2L384.2 324.1c-1.3-7.7 1.2-15.5 6.8-21l85.9-85.1L358.6 200.5c-7.8-1.2-14.6-6.1-18.1-13.3L287.9 79z" }, "child": [] }] })(props);
}
function CiCircleList(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "g", "attr": { "id": "Circle_List" }, "child": [{ "tag": "g", "attr": {}, "child": [{ "tag": "path", "attr": { "d": "M20.438,6.062h-9a.5.5,0,0,1,0-1h9a.5.5,0,0,1,0,1Z" }, "child": [] }, { "tag": "path", "attr": { "d": "M20.438,12.5h-9a.5.5,0,0,1,0-1h9a.5.5,0,0,1,0,1Z" }, "child": [] }, { "tag": "path", "attr": { "d": "M20.438,18.935h-9a.5.5,0,1,1,0-1h9a.5.5,0,0,1,0,1Z" }, "child": [] }, { "tag": "path", "attr": { "d": "M5.562,8.062a2.5,2.5,0,1,1,2.5-2.5A2.5,2.5,0,0,1,5.562,8.062Zm0-4a1.5,1.5,0,1,0,1.5,1.5A1.5,1.5,0,0,0,5.562,4.062Z" }, "child": [] }, { "tag": "path", "attr": { "d": "M5.562,14.5a2.5,2.5,0,1,1,2.5-2.5A2.5,2.5,0,0,1,5.562,14.5Zm0-4a1.5,1.5,0,1,0,1.5,1.5A1.5,1.5,0,0,0,5.562,10.5Z" }, "child": [] }, { "tag": "path", "attr": { "d": "M5.562,20.938a2.5,2.5,0,1,1,2.5-2.5A2.5,2.5,0,0,1,5.562,20.938Zm0-4a1.5,1.5,0,1,0,1.5,1.5A1.5,1.5,0,0,0,5.562,16.938Z" }, "child": [] }] }] }] })(props);
}
function CiCircleMore(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "g", "attr": { "id": "Circle_More" }, "child": [{ "tag": "g", "attr": {}, "child": [{ "tag": "circle", "attr": { "cx": "12.001", "cy": "12", "r": "1" }, "child": [] }, { "tag": "circle", "attr": { "cx": "16.001", "cy": "12", "r": "1" }, "child": [] }, { "tag": "circle", "attr": { "cx": "8.001", "cy": "12", "r": "1" }, "child": [] }, { "tag": "path", "attr": { "d": "M12,21.932A9.934,9.934,0,1,1,21.934,12,9.944,9.944,0,0,1,12,21.932ZM12,3.065A8.934,8.934,0,1,0,20.934,12,8.944,8.944,0,0,0,12,3.065Z" }, "child": [] }] }] }] })(props);
}
function CiFilter(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "g", "attr": { "id": "Filter" }, "child": [{ "tag": "path", "attr": { "d": "M14.037,20.937a1.015,1.015,0,0,1-.518-.145l-3.334-2a2.551,2.551,0,0,1-1.233-2.176V12.091a1.526,1.526,0,0,0-.284-.891L4.013,4.658a1.01,1.01,0,0,1,.822-1.6h14.33a1.009,1.009,0,0,1,.822,1.6h0L15.332,11.2a1.527,1.527,0,0,0-.285.891v7.834a1.013,1.013,0,0,1-1.01,1.012ZM4.835,4.063,9.482,10.62a2.515,2.515,0,0,1,.47,1.471v4.524a1.543,1.543,0,0,0,.747,1.318l3.334,2,.014-7.843a2.516,2.516,0,0,1,.471-1.471l4.654-6.542,0,0Z" }, "child": [] }] }] })(props);
}
const PropertyTypeIconMap = {
  [PropertyType.SingleLineText]: MdOutlineTextFormat,
  [PropertyType.MultilineText]: GrTextWrap,
  [PropertyType.SingleChoice]: TbSelect,
  [PropertyType.MultipleChoice]: CiCircleList,
  [PropertyType.Multilevel]: PiTreeView,
  [PropertyType.Number]: TbNumber123,
  [PropertyType.Percentage]: MdOutlinePercent,
  [PropertyType.Rating]: FaRegStar,
  [PropertyType.Boolean]: MdOutlineCheckBox,
  [PropertyType.Link]: LuLink,
  [PropertyType.Attachment]: PiImages,
  [PropertyType.Formula]: RiFormula,
  [PropertyType.Time]: MdOutlineAccessTime,
  [PropertyType.Date]: LuCalendarDays,
  [PropertyType.DateTime]: LuCalendarClock,
  [PropertyType.Tags]: LuTags
};
const PropertyTypeIcon = ({
  type: type4,
  textVariant = "default",
  ...props
}) => {
  const { t: t2 } = useTranslation();
  const Icon2 = type4 ? PropertyTypeIconMap[type4] : AiOutlineQuestionCircle;
  const typeName = type4 ? t2(PropertyType[type4]) : t2("Unknown");
  switch (textVariant) {
    case "none":
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Icon2, { className: "text-base", ...props });
    case "default":
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Icon2, { className: "text-base", ...props }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: typeName })
      ] });
    case "tooltip":
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { color: "foreground", content: typeName, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon2, { className: "text-base", ...props }) });
  }
};
PropertyTypeIcon.displayName = "PropertyTypeIcon";
const UnderDevelopmentGroupKey = "UnderDevelopment";
const PropertyTypeGroup = {
  Text: [
    PropertyType.SingleLineText,
    PropertyType.MultilineText,
    PropertyType.Link
  ],
  Number: [PropertyType.Number, PropertyType.Percentage, PropertyType.Rating],
  Option: [
    PropertyType.SingleChoice,
    PropertyType.MultipleChoice,
    PropertyType.Multilevel
  ],
  DateTime: [PropertyType.DateTime, PropertyType.Date, PropertyType.Time],
  Other: [PropertyType.Attachment, PropertyType.Boolean, PropertyType.Tags],
  [UnderDevelopmentGroupKey]: [PropertyType.Formula]
};
const NumberPrecisions = [0, 1, 2, 3, 4].map((x2) => ({
  value: x2,
  label: Number(1).toFixed(x2)
}));
const RatingMaxValueDataSource = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map((x2) => ({
  value: x2,
  label: x2
}));
buildLogger("ModalContent");
const ModalContent = ({ validValueTypes, value: value2, onChange }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  useUpdate();
  const [typeGroupsVisible, settypeGroupsVisible] = reactExports.useState(false);
  const typePopoverDomRef = reactExports.useRef(null);
  const [property2, setProperty3] = reactExports.useState(
    JSON.parse(
      JSON.stringify({
        ...value2 || {},
        options: optimizeOptions(value2 == null ? void 0 : value2.options)
      })
    )
  );
  const checkValueUsage = property2.id ? async (value22) => {
    const rsp = await BApi$1.customProperty.getCustomPropertyValueUsage(
      property2.id,
      { value: value22 }
    );
    return rsp.data;
  } : void 0;
  const renderOptions = () => {
    if (property2.type != void 0) {
      switch (property2.type) {
        case PropertyType.SingleLineText:
        case PropertyType.MultilineText:
          break;
        case PropertyType.SingleChoice:
        case PropertyType.MultipleChoice: {
          const options = property2.options;
          const multiple = property2.type === PropertyType.MultipleChoice;
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              ChoiceList,
              {
                checkUsage: checkValueUsage,
                choices: options == null ? void 0 : options.choices,
                className: "mt-4",
                onChange: (choices) => {
                  patchProperty({
                    options: {
                      ...options,
                      choices
                    }
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Select,
              {
                className: "mt-2",
                dataSource: options == null ? void 0 : options.choices,
                label: t2("Default value"),
                selectedKeys: (options == null ? void 0 : options.defaultValue) ? multiple ? options.defaultValue : [options.defaultValue] : void 0,
                selectionMode: multiple ? "multiple" : "single",
                size: "sm",
                onSelectionChange: (c2) => {
                  const array4 = Array.from(c2.values());
                  patchProperty({
                    options: {
                      ...options,
                      defaultValue: multiple ? array4 : array4[0]
                    }
                  });
                }
              }
            )
          ] });
        }
        case PropertyType.Number: {
          const options = property2.options ?? {};
          const previewValue = 80;
          const previewValueStr = Number(previewValue).toFixed(
            (options == null ? void 0 : options.precision) || 0
          );
          options.precision ?? (options.precision = 0);
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Select,
              {
                dataSource: NumberPrecisions,
                label: t2("Precision"),
                selectedKeys: [options.precision.toString()],
                onSelectionChange: (c2) => {
                  patchProperty({
                    options: {
                      ...options,
                      precision: c2.values().next().value
                    }
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                disabled: true,
                label: t2("Preview"),
                value: previewValueStr
              }
            )
          ] });
        }
        case PropertyType.Percentage: {
          const options = property2.options ?? {};
          const previewValue = 80;
          const previewValueStr = `${Number(previewValue).toFixed((options == null ? void 0 : options.precision) || 0)}%`;
          options.precision ?? (options.precision = 0);
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Select,
              {
                dataSource: NumberPrecisions,
                label: t2("Precision"),
                selectedKeys: [options.precision.toString()],
                onSelectionChange: (c2) => {
                  patchProperty({
                    options: {
                      ...options,
                      precision: c2.values().next().value
                    }
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              switch_default,
              {
                isSelected: options == null ? void 0 : options.showProgressbar,
                size: "sm",
                onValueChange: (c2) => {
                  patchProperty({
                    options: {
                      ...options,
                      showProgressbar: c2
                    }
                  });
                },
                children: t2("Show progressbar")
              }
            ),
            (options == null ? void 0 : options.showProgressbar) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Preview") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                progress_default,
                {
                  className: "max-w-[70%]",
                  label: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-[color:var(--bakaui-color)]", children: previewValueStr }),
                  value: previewValue
                }
              )
            ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                disabled: true,
                label: t2("Preview"),
                value: previewValueStr
              }
            )
          ] });
        }
        case PropertyType.Rating: {
          const options = property2.options ?? {};
          options.maxValue ?? (options.maxValue = 5);
          return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Select,
            {
              dataSource: RatingMaxValueDataSource,
              label: t2("Max value"),
              selectedKeys: [options.maxValue.toString()],
              onSelectionChange: (c2) => {
                patchProperty({
                  options: {
                    ...options,
                    maxValue: c2.values().next().value
                  }
                });
              }
            }
          ) });
        }
        case PropertyType.Boolean: {
          break;
        }
        case PropertyType.Link:
        case PropertyType.Attachment:
          break;
        case PropertyType.Date:
          break;
        case PropertyType.DateTime:
          break;
        case PropertyType.Time:
          break;
        case PropertyType.Formula: {
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              radio_group_default,
              {
                label: t2("Formula syntax"),
                orientation: "horizontal",
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: "buenos-aires", children: "Javascript" })
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              _default$1,
              {
                wrapEnabled: true,
                editorProps: { $blockScrolling: true },
                mode: "javascript",
                name: "UNIQUE_ID_OF_DIV",
                theme: "monokai",
                onChange: (v2) => {
                  console.log(v2);
                }
              }
            )
          ] });
        }
        case PropertyType.Multilevel: {
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            MultilevelData,
            {
              options: property2.options,
              onChange: (options) => {
                patchProperty({
                  options
                });
              }
            }
          );
        }
        case PropertyType.Tags: {
          const options = property2.options;
          return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            TagList,
            {
              checkUsage: checkValueUsage,
              className: "mt-4",
              tags: options == null ? void 0 : options.tags,
              onChange: (tags2) => {
                patchProperty({
                  options: {
                    ...options,
                    tags: tags2
                  }
                });
              }
            }
          ) });
        }
      }
    }
    return;
  };
  const renderPropertyTypeButton = () => {
    const btn = /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        color: "default",
        size: "lg",
        onClick: () => {
          settypeGroupsVisible(true);
        },
        children: property2.type == void 0 ? t2("Select a type") : /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyTypeIcon, { textVariant: "default", type: property2.type })
      }
    );
    if (property2 && property2.id != void 0 && property2.id > 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Click to change type"), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: btn }) }) });
    } else {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: btn });
    }
  };
  const patchProperty = (patches) => {
    const newProperties = {
      ...property2,
      ...patches
    };
    setProperty3(newProperties);
    if (newProperties.name == void 0 || newProperties.name.length == 0 || newProperties.type == void 0 || !(newProperties.type > 0)) {
      onChange == null ? void 0 : onChange(void 0);
    } else {
      onChange == null ? void 0 : onChange(newProperties);
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        PopoverComponent,
        {
          isDismissable: true,
          showArrow: true,
          closeMode: ["mask", "esc"],
          placement: "right",
          trigger: renderPropertyTypeButton(),
          visible: typeGroupsVisible,
          onOpenChange: (isOpen) => {
            settypeGroupsVisible(isOpen);
          },
          onVisibleChange: (visible) => {
            settypeGroupsVisible(visible);
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: typePopoverDomRef, className: "p-2 flex flex-col gap-2", children: Object.keys(PropertyTypeGroup).map((group) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsxs(
              "div",
              {
                className: "pb-2 mb-2 border-b-1 last:mb-0 last:border-b-0 last:pb-0",
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-2 font-bold", children: t2(group) }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-3 gap-x-2 text-sm leading-5", children: PropertyTypeGroup[group].map((type4) => {
                    if (group == UnderDevelopmentGroupKey) {
                      return /* @__PURE__ */ jsxRuntimeExports.jsx(
                        Tooltip$1,
                        {
                          content: /* @__PURE__ */ jsxRuntimeExports.jsx(
                            FeatureStatusTip,
                            {
                              name: t2(PropertyType[type4]),
                              status: "developing"
                            }
                          ),
                          children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                            Button,
                            {
                              className: "justify-start",
                              disabled: (validValueTypes == null ? void 0 : validValueTypes.includes(type4)) === false,
                              variant: "light",
                              children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                                PropertyTypeIcon,
                                {
                                  textVariant: "default",
                                  type: type4
                                }
                              )
                            }
                          )
                        }
                      );
                    }
                    return /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Button,
                      {
                        className: "justify-start",
                        disabled: (validValueTypes == null ? void 0 : validValueTypes.includes(type4)) === false,
                        variant: "light",
                        onClick: () => {
                          if (property2.id != void 0 && property2.id > 0) {
                            BApi$1.customProperty.getCustomPropertyConversionRules().then((r2) => {
                              var _a2, _b2;
                              const rules2 = ((_b2 = (_a2 = r2.data) == null ? void 0 : _a2[property2.type]) == null ? void 0 : _b2[type4]) ?? [];
                              createPortal(Modal, {
                                defaultVisible: true,
                                title: t2(
                                  "You are changing property type"
                                ),
                                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                                    "Changing the property type may cause the loss of existing data. Click 'continue' to check."
                                  ) }),
                                  rules2.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2", children: [
                                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-bold", children: t2(
                                      "Following rule(s) will be applied"
                                    ) }),
                                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                                      "div",
                                      {
                                        className: "flex flex-wrap gap-2 items-center mt-1",
                                        children: rules2.map((r22) => {
                                          if (r22.description == null) {
                                            return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", children: r22.name });
                                          }
                                          return /* @__PURE__ */ jsxRuntimeExports.jsx(
                                            Tooltip$1,
                                            {
                                              content: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: r22.description }),
                                              children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", children: r22.name })
                                            }
                                          );
                                        })
                                      }
                                    )
                                  ] })
                                ] }),
                                footer: {
                                  actions: ["ok", "cancel"],
                                  okProps: {
                                    children: t2("Continue")
                                  }
                                },
                                onOk: async () => {
                                  var _a3;
                                  const rsp = await BApi$1.customProperty.previewCustomPropertyTypeConversion(
                                    property2.id,
                                    type4
                                  );
                                  if (rsp.data) {
                                    const changes = ((_a3 = rsp.data) == null ? void 0 : _a3.changes) || [];
                                    const { dataCount, toType, fromType } = rsp.data;
                                    createPortal(Modal, {
                                      defaultVisible: true,
                                      title: t2("Final check"),
                                      size: changes.length > 0 ? "lg" : void 0,
                                      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-base", children: changes.length > 0 ? t2(
                                          "Found {{count}} data, and {{changedDataCount}} data will be modified or deleted",
                                          {
                                            count: dataCount,
                                            changedDataCount: changes.length
                                          }
                                        ) : t2(
                                          "Found {{count}} data, and all of them will be retained",
                                          { count: dataCount }
                                        ) }),
                                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-bold", children: t2(
                                          "Be careful, this process is irreversible"
                                        ) }),
                                        changes.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { children: [
                                          /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
                                            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2(
                                              "Source value"
                                            ) }),
                                            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2(
                                              "Converted value"
                                            ) })
                                          ] }),
                                          /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: changes.map((c2) => {
                                            return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
                                              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                                                StandardValueRenderer,
                                                {
                                                  type: fromType,
                                                  value: deserializeStandardValue(
                                                    c2.serializedFromValue ?? null,
                                                    fromType
                                                  ),
                                                  variant: "light"
                                                }
                                              ) }),
                                              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                                                StandardValueRenderer,
                                                {
                                                  type: toType,
                                                  value: deserializeStandardValue(
                                                    c2.serializedToValue ?? null,
                                                    toType
                                                  ),
                                                  variant: "light"
                                                }
                                              ) })
                                            ] });
                                          }) })
                                        ] })
                                      ] }),
                                      onOk: async () => {
                                        await BApi$1.customProperty.changeCustomPropertyType(
                                          property2.id,
                                          type4
                                        );
                                        await BApi$1.customProperty.getCustomPropertyByKeys({
                                          ids: [property2.id]
                                        }).then((r22) => {
                                          patchProperty(r22.data[0]);
                                        });
                                      },
                                      footer: {
                                        actions: ["ok", "cancel"],
                                        okProps: {
                                          children: t2("Convert")
                                        }
                                      }
                                    });
                                  }
                                }
                              });
                            });
                          } else {
                            patchProperty({
                              ...property2,
                              type: type4
                            });
                          }
                          settypeGroupsVisible(false);
                        },
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          PropertyTypeIcon,
                          {
                            textVariant: "default",
                            type: type4
                          }
                        )
                      }
                    );
                  }) })
                ]
              }
            );
          }) })
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          className: "flex-1",
          label: t2("Name"),
          size: "sm",
          value: property2.name,
          onValueChange: (name2) => patchProperty({
            ...property2,
            name: name2
          })
        }
      )
    ] }),
    renderOptions()
  ] });
};
ModalContent.displayName = "ModalContent";
const log$y = buildLogger("PropertyModal");
const PropertyModal = ({
  value: value2,
  onSaved,
  validValueTypes,
  ...props
}) => {
  const { t: t2 } = useTranslation();
  const [visible, setVisible] = reactExports.useState(true);
  const [property2, setProperty3] = reactExports.useState();
  const close = () => {
    setVisible(false);
  };
  log$y(property2);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          isDisabled: !property2
        }
      },
      size: "lg",
      title: t2("Custom property"),
      visible,
      onClose: close,
      onOk: async () => {
        if (!property2) {
          throw new Error("Property is required");
        }
        const model = {
          ...property2,
          // todo: this serialization is a hardcode
          options: JSON.stringify(property2.options)
        };
        const isUpdate = property2.id != void 0 && property2.id > 0;
        const rsp = isUpdate ? await BApi$1.customProperty.putCustomProperty(property2.id, model) : await BApi$1.customProperty.addCustomProperty(model);
        if (!rsp.code) {
          onSaved == null ? void 0 : onSaved(rsp.data);
          close();
        }
      },
      ...props,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        ModalContent,
        {
          validValueTypes,
          value: value2,
          onChange: (v2) => setProperty3(v2)
        }
      )
    }
  );
};
PropertyModal.displayName = "PropertyModal";
const property = "_property_j4j5r_1";
const line1 = "_line1_j4j5r_4";
const left = "_left_j4j5r_7";
const type3 = "_type_j4j5r_12";
const bottom = "_bottom_j4j5r_19";
const styles$3 = {
  property,
  line1,
  left,
  type: type3,
  bottom
};
const Label = ({ property: property2, showPool }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex items-center", children: [
    showPool && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: t2(`PropertyPool.${PropertyPool[property2.pool]}`) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyTypeIcon, { textVariant: "none", type: property2.type }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: property2.name })
  ] });
};
Label.displayName = "Label";
const Property = ({
  property: property2,
  onClick,
  editablePortal = "edit-icon",
  onSaved,
  onRemoved,
  onDialogDestroyed,
  disabled,
  ...props
}) => {
  const { t: t2 } = useTranslation();
  const [removeConfirmingDialogVisible, setRemoveConfirmingDialogVisible] = reactExports.useState(false);
  const { createPortal } = useBakabaseContext();
  const editable = property2.pool == PropertyPool.Custom && props.editable;
  const removable = property2.pool == PropertyPool.Custom && props.removable;
  const renderBottom = () => {
    if (property2.pool != PropertyPool.Custom) {
      return null;
    }
    const categories = property2.categories || [];
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${styles$3.bottom} mt-1 pt-1 flex flex-wrap gap-2`, children: [
      categories.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
        Tooltip$1,
        {
          content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1 max-w-[600px]", children: categories.map((c2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: c2.name }, c2.id);
          }) }),
          placement: "bottom",
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$x, { className: "text-sm" }),
            categories.length
          ] })
        }
      ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
        Tooltip$1,
        {
          content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("No category bound") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("You can bind properties in category page") })
          ] }),
          placement: "bottom",
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$V, { className: "text-sm" })
        }
      ),
      property2.valueCount != void 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
        Tooltip$1,
        {
          content: t2("{{count}} values", {
            count: property2.valueCount
          }),
          placement: "bottom",
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Y, { className: "text-sm" }),
            property2.valueCount
          ] })
        }
      )
    ] });
  };
  const showDetail = () => {
    createPortal(PropertyModal, {
      value: {
        ...property2,
        type: property2.type
      },
      onSaved: (p2) => onSaved == null ? void 0 : onSaved({
        ...p2
      }),
      onDestroyed: onDialogDestroyed
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: `${styles$3.property} group px-2 py-1 rounded ${disabled ? "cursor-not-allowed opacity-60" : "cursor-pointer hover:bg-[var(--bakaui-overlap-background)]"}`,
      onClick: () => {
        if (disabled) {
          return;
        }
        if (editable && editablePortal == "click") {
          showDetail();
        }
        onClick == null ? void 0 : onClick();
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Modal,
          {
            title: t2("Delete a property"),
            visible: removeConfirmingDialogVisible,
            onClose: () => setRemoveConfirmingDialogVisible(false),
            onOk: async () => {
              await BApi$1.customProperty.removeCustomProperty(property2.id);
              onRemoved == null ? void 0 : onRemoved();
            },
            children: t2("This operation can not be undone, are you sure?")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${styles$3.line1} flex item-center justify-between gap-1`, children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${styles$3.left}`, children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: t2(`${PropertyPool[property2.pool]}`) }),
              property2.name
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Tooltip$1,
              {
                color: "foreground",
                content: t2(PropertyType[property2.type]),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$3.type, children: /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyTypeIcon, { textVariant: "none", type: property2.type }) })
              }
            )
          ] }),
          property2.pool == PropertyPool.Custom && /* @__PURE__ */ jsxRuntimeExports.jsxs(
            "div",
            {
              className: "ml-1 flex gap-0.5 items-center invisible group-hover:visible",
              children: [
                editable && editablePortal == "edit-icon" && /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    isIconOnly: true,
                    className: "text-base",
                    color: "default",
                    size: "sm",
                    variant: "light",
                    onPress: () => {
                      showDetail();
                    },
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdEdit, { className: "text-base" })
                  }
                ),
                removable && /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    isIconOnly: true,
                    className: "text-base",
                    color: "danger",
                    size: "sm",
                    variant: "light",
                    onPress: async () => {
                      setRemoveConfirmingDialogVisible(true);
                    },
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdDelete, { className: "text-base" })
                  }
                )
              ]
            }
          )
        ] }),
        renderBottom()
      ]
    },
    property2.id
  );
};
Property.displayName = "Property";
const PropertyPoolIcon = ({ pool }) => {
  const { t: t2 } = useTranslation();
  let color2 = "default";
  switch (pool) {
    case PropertyPool.Internal:
      color2 = "default";
      break;
    case PropertyPool.Reserved:
      color2 = "secondary";
      break;
    case PropertyPool.Custom:
      color2 = "primary";
      break;
    default:
      color2 = "warning";
      break;
  }
  const poolName = pool ? t2(`PropertyPool.${PropertyPool[pool]}`) : t2("Unknown");
  const poolAbbreviation = pool ? t2(`PropertyPool.Abbreviation.${PropertyPool[pool]}`) : "?";
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { color: "foreground", content: poolName, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: color2, size: "sm", variant: "flat", children: poolAbbreviation }) });
};
PropertyPoolIcon.displayName = "PropertyPoolIcon";
const PropertyExtra = ({ property: property2 }) => {
  var _a2, _b2, _c2;
  const { t: t2 } = useTranslation();
  const components2 = [];
  switch (property2.type) {
    case PropertyType.SingleLineText:
      break;
    case PropertyType.MultilineText:
      break;
    case PropertyType.SingleChoice:
    case PropertyType.MultipleChoice: {
      const options = property2.options;
      if (options) {
        components2.push(
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center text-sm", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(TbSelect, { className: "text-base" }),
            ((_a2 = options.choices) == null ? void 0 : _a2.length) ?? 0
          ] }, "choices-count")
        );
      }
      break;
    }
    case PropertyType.Number:
    case PropertyType.Percentage: {
      const options = property2.options;
      if (options) {
        components2.push(
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center text-sm", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(LuRuler, { className: "text-base" }),
            options.precision ?? 0
          ] }, "number-count")
        );
      }
      break;
    }
    case PropertyType.Rating: {
      const options = property2.options;
      if (options) {
        components2.push(
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center text-sm", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineStar, { className: "text-base" }),
            options.maxValue ?? 5
          ] }, "rating-count")
        );
      }
      break;
    }
    case PropertyType.Boolean:
      break;
    case PropertyType.Link:
      break;
    case PropertyType.Attachment:
      break;
    case PropertyType.Date:
      break;
    case PropertyType.DateTime:
      break;
    case PropertyType.Time:
      break;
    case PropertyType.Formula:
      break;
    case PropertyType.Multilevel: {
      const options = property2.options;
      if (options) {
        components2.push(
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center text-sm", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(TbSelect, { className: "text-base" }),
            ((_b2 = options.data) == null ? void 0 : _b2.length) ?? 0
          ] }, "multilevel-count")
        );
      }
      break;
    }
    case PropertyType.Tags: {
      const options = property2.options;
      if (options) {
        components2.push(
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center text-sm", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(TbSelect, { className: "text-base" }),
            ((_c2 = options.tags) == null ? void 0 : _c2.length) ?? 0
          ] }, "tags-count")
        );
      }
      break;
    }
  }
  if (property2.pool == PropertyPool.Custom && property2.valueCount && property2.valueCount > 0) {
    components2.push(
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Tooltip$1,
        {
          content: t2("{{count}} resource(s) have set this property value.", {
            count: property2.valueCount
          }),
          placement: "bottom",
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center text-sm", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Y, { className: "text-base" }),
            property2.valueCount
          ] })
        },
        "value-count"
      )
    );
  }
  if (components2.length == 0) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: components2 });
};
const V2 = ({
  property: property2,
  hidePool,
  hideType,
  onClick,
  onSaved,
  onRemoved,
  onDialogDestroyed,
  isSelected,
  disabled,
  ...props
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const editable = property2.pool == PropertyPool.Custom && props.editable;
  const removable = property2.pool == PropertyPool.Custom && props.removable;
  const selected = isSelected === true;
  const showDetail = () => {
    createPortal(PropertyModal, {
      value: {
        ...property2,
        type: property2.type
      },
      onSaved: (p2) => onSaved == null ? void 0 : onSaved({
        ...p2
      }),
      onDestroyed: onDialogDestroyed
    });
  };
  const actions = [];
  if (editable) {
    actions.push(
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          size: "sm",
          variant: "light",
          onPress: () => {
            showDetail();
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-base" })
        }
      )
    );
  }
  if (removable) {
    actions.push(
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "danger",
          size: "sm",
          variant: "light",
          onPress: () => {
            createPortal(Modal, {
              defaultVisible: true,
              title: t2("Delete a property"),
              children: t2(
                "This operation can not be undone, are you sure?"
              ),
              onOk: async () => {
                await BApi$1.customProperty.removeCustomProperty(property2.id);
                onRemoved == null ? void 0 : onRemoved();
              }
            });
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-base" })
        }
      )
    );
  }
  const card2 = /* @__PURE__ */ jsxRuntimeExports.jsx(card_default, { isPressable: !disabled, onPress: onClick, className: disabled ? "cursor-not-allowed opacity-60" : "", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(card_body_default, { className: "flex flex-col gap-1", children: [
    (!hidePool || !hideType) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
      !hideType && /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyTypeIcon, { type: property2.type }),
      !hidePool && /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyPoolIcon, { pool: property2.pool })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-base text-left", children: property2.name }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyExtra, { property: property2 })
    ] })
  ] }) });
  const cardWithSelection = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `relative ${selected ? "ring-2 ring-green-500 rounded-lg" : ""}`, "aria-selected": selected, children: [
    selected && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pointer-events-none absolute -top-1.5 -right-1.5 bg-green-500 text-white rounded-full w-5 h-5 flex items-center justify-center text-xs shadow z-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheck, {}) }),
    card2
  ] });
  if (actions.length > 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      Tooltip$1,
      {
        content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: actions }),
        children: cardWithSelection
      }
    );
  }
  return cardWithSelection;
};
V2.displayName = "V2";
const log$x = buildLogger("PropertySelector");
const PropertySelector = (props) => {
  var _a2;
  log$x("props", props);
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const {
    selection: propsSelection,
    onSubmit: propsOnSubmit,
    multiple = true,
    pool,
    types: types2,
    valueTypes: valueTypes2,
    addable,
    editable,
    removable,
    title,
    onDestroyed,
    isDisabled,
    v2
  } = props;
  const [properties2, setProperties] = reactExports.useState([]);
  const [selection, setSelection] = reactExports.useState(propsSelection || []);
  const [visible, setVisible] = reactExports.useState(true);
  const uiOptionsStore = useUiOptionsStore();
  const loadProperties = async () => {
    const psr = (await BApi$1.property.getPropertiesByPool(pool)).data || [];
    setProperties(psr);
  };
  reactExports.useEffect(() => {
    loadProperties();
  }, []);
  const renderProperty = (property2) => {
    const selected = selection.some((s2) => s2.id == property2.id && s2.pool == property2.pool);
    const disabled = isDisabled == null ? void 0 : isDisabled(property2);
    if (v2) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        V2,
        {
          disabled,
          editable,
          isSelected: selected,
          property: property2,
          removable,
          onClick: async () => {
            if (disabled) {
              return;
            }
            if (multiple) {
              if (selected) {
                setSelection(
                  selection.filter((s2) => s2.id != property2.id || s2.pool != property2.pool)
                );
              } else {
                setSelection([
                  ...selection,
                  {
                    id: property2.id,
                    pool: property2.pool
                  }
                ]);
              }
            } else {
              if (selected) {
                setSelection([]);
              } else {
                const ns = [
                  {
                    id: property2.id,
                    pool: property2.pool
                  }
                ];
                setSelection(ns);
                await onSubmit(ns);
              }
            }
          },
          onSaved: loadProperties
        },
        `${property2.id}-${property2.pool}`
      );
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      Property,
      {
        disabled: isDisabled == null ? void 0 : isDisabled(property2),
        editable,
        property: property2,
        removable,
        onClick: async () => {
          if (multiple) {
            if (selected) {
              setSelection(selection.filter((s2) => s2.id != property2.id || s2.pool != property2.pool));
            } else {
              setSelection([
                ...selection,
                {
                  id: property2.id,
                  pool: property2.pool
                }
              ]);
            }
          } else {
            if (selected) {
              setSelection([]);
            } else {
              const ns = [
                {
                  id: property2.id,
                  pool: property2.pool
                }
              ];
              setSelection(ns);
              await onSubmit(ns);
            }
          }
        },
        onSaved: loadProperties
      },
      `${property2.id}-${property2.pool}`
    );
  };
  const onSubmit = async (selection2) => {
    if (selection2.length > 0) {
      await BApi$1.options.addLatestUsedProperty(selection2);
    }
    if (propsOnSubmit) {
      await propsOnSubmit(
        selection2.map((s2) => properties2.find((p2) => p2.id == s2.id && p2.pool == s2.pool)).filter((x2) => x2 != void 0)
      );
    }
    setVisible(false);
  };
  const renderFilter = () => {
    const filters = [];
    if (pool != PropertyPool.All) {
      Object.keys(PropertyPool).forEach((k2) => {
        const v3 = parseInt(k2, 10);
        if (Number.isNaN(v3)) {
          return;
        }
        if (pool & v3) {
          switch (v3) {
            case PropertyPool.Internal:
            case PropertyPool.Reserved:
            case PropertyPool.Custom:
              filters.push(
                /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", children: t2(PropertyPool[v3]) }, "pool")
              );
              break;
          }
        }
      });
    }
    if (valueTypes2) {
      filters.push(
        ...valueTypes2.map((vt) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", children: t2(StandardValueType[vt]) }, vt))
      );
    }
    if (types2) {
      filters.push(
        ...types2.map((pt) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", children: t2(PropertyType[pt]) }, pt))
      );
    }
    if (filters.length > 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-1 items-center flex-wrap", children: [
        t2("Filtering"),
        /* @__PURE__ */ jsxRuntimeExports.jsx(spacer_default, {}),
        filters
      ] });
    } else {
      return null;
    }
  };
  const filteredProperties = properties2.filter((p2) => {
    if (valueTypes2 && !valueTypes2.includes(p2.dbValueType)) {
      return false;
    }
    if (types2 && !types2.includes(p2.type)) {
      return false;
    }
    return true;
  });
  const sortedFilteredProperties = filteredProperties.sort((a2, b2) => {
    var _a3;
    const latestUsedProperties = ((_a3 = uiOptionsStore.data) == null ? void 0 : _a3.latestUsedProperties) ?? [];
    let aIndex = latestUsedProperties.findIndex((l2) => l2.id === a2.id && l2.pool === a2.pool);
    if (aIndex == -1) {
      aIndex = Number.MAX_SAFE_INTEGER;
    }
    let bIndex = latestUsedProperties.findIndex((l2) => l2.id === b2.id && l2.pool === b2.pool);
    if (bIndex == -1) {
      bIndex = Number.MAX_SAFE_INTEGER;
    }
    return aIndex - bIndex;
  });
  console.log(
    filteredProperties,
    (_a2 = uiOptionsStore.data) == null ? void 0 : _a2.latestUsedProperties,
    sortedFilteredProperties
  );
  const selectedProperties = selection.map((s2) => sortedFilteredProperties.find((p2) => p2.id == s2.id && p2.pool == s2.pool)).filter((x2) => x2).map((x2) => x2);
  const unselectedProperties = sortedFilteredProperties.filter(
    (p2) => !selection.some((s2) => s2.id == p2.id && s2.pool == p2.pool)
  );
  const propertyCount = selectedProperties.length + unselectedProperties.length;
  const renderProperties = () => {
    if (propertyCount == 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center gap-2 mt-6", children: [
        t2("No properties available"),
        addable && /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            size: "sm",
            onPress: () => {
              createPortal(PropertyModal, {
                onSaved: loadProperties,
                validValueTypes: valueTypes2 == null ? void 0 : valueTypes2.map((v3) => v3)
              });
            },
            children: t2("Add a property")
          }
        )
      ] });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: "text-base",
            children: `${t2("Selected")}(${selectedProperties.length})`
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-2 items-start", children: selectedProperties.map((p2) => renderProperty(p2)) })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: "text-base",
            children: `${t2("Not selected")}(${unselectedProperties.length})`
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-2 items-start", children: unselectedProperties.map((p2) => renderProperty(p2)) })
      ] })
    ] });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      footer: multiple && propertyCount > 0 ? true : /* @__PURE__ */ jsxRuntimeExports.jsx(spacer_default, {}),
      size: "2xl",
      title: title ?? t2(multiple ? "Select properties" : "Select a property"),
      visible,
      onClose: () => {
        setVisible(false);
      },
      onDestroyed,
      onOk: async () => {
        await onSubmit(selection);
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
        renderFilter(),
        /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
        renderProperties(),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: addable && /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            className: "mt-2",
            color: "primary",
            size: "sm",
            onPress: () => {
              createPortal(PropertyModal, {
                onSaved: loadProperties,
                validValueTypes: valueTypes2 == null ? void 0 : valueTypes2.map((v3) => v3)
              });
            },
            children: t2("Add a property")
          }
        ) })
      ] })
    }
  );
};
const log$w = buildLogger("PropertyValueRenderer");
const PropertyValueRenderer = (props) => {
  var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
  const {
    property: property2,
    variant = "default",
    onValueChange,
    dbValue,
    bizValue,
    defaultEditing,
    size: size2 = "md"
  } = props;
  const { t: t2 } = useTranslation();
  let bv = deserializeStandardValue(bizValue ?? null, property2.bizValueType);
  const dv = deserializeStandardValue(dbValue ?? null, property2.dbValueType);
  log$w(props, bv, dv);
  const simpleOnValueChange = onValueChange ? (dv2, bv2) => {
    const sdv = serializeStandardValue(dv2 ?? null, property2.dbValueType);
    const sbv = serializeStandardValue(bv2 ?? null, property2.bizValueType);
    log$w("OnValueChange:Serialization:dv", dv2, sdv);
    log$w("OnValueChange:Serialization:bv", bv2, sbv);
    return onValueChange(sdv, sbv);
  } : void 0;
  const simpleEditor = simpleOnValueChange ? {
    value: dv,
    onValueChange: simpleOnValueChange
  } : void 0;
  switch (property2.type) {
    case PropertyType.SingleLineText: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        StringValueRenderer,
        {
          defaultEditing,
          editor: simpleEditor,
          value: typedBv,
          variant,
          size: size2
        }
      );
    }
    case PropertyType.MultilineText: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      bv ?? (bv = dv);
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        StringValueRenderer,
        {
          multiline: true,
          defaultEditing,
          editor: simpleEditor,
          value: typedBv,
          variant,
          size: size2
        }
      );
    }
    case PropertyType.SingleChoice: {
      const typedDv = dv;
      const oc2 = onValueChange == void 0 ? void 0 : (dbValue2, bizValue2) => {
        onValueChange(
          dbValue2 && dbValue2.length > 0 ? serializeStandardValue(dbValue2[0], StandardValueType.String) : void 0,
          bizValue2 && bizValue2.length > 0 ? serializeStandardValue(
            bizValue2[0],
            StandardValueType.String
          ) : void 0
        );
      };
      const editor2 = oc2 ? {
        value: typedDv == void 0 ? void 0 : [typedDv],
        onValueChange: oc2
      } : void 0;
      const typedBv = bv ?? ((_b2 = (((_a2 = property2.options) == null ? void 0 : _a2.choices) ?? []).find((x2) => x2.value == typedDv)) == null ? void 0 : _b2.label);
      const vas = _$2.sortBy(
        ((_d = (_c2 = property2.options) == null ? void 0 : _c2.choices) == null ? void 0 : _d.filter((o2) => dv == null ? void 0 : dv.includes(o2.value))) ?? [],
        (x2) => x2.value == typedDv
      );
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        ChoiceValueRenderer,
        {
          defaultEditing,
          editor: editor2,
          getDataSource: async () => {
            var _a3;
            return ((_a3 = property2.options) == null ? void 0 : _a3.choices) ?? [];
          },
          value: typedBv == void 0 ? void 0 : [typedBv],
          valueAttributes: vas,
          variant,
          size: size2
        }
      );
    }
    case PropertyType.MultipleChoice: {
      const typedDv = dv;
      const typedBv = bv ?? (((_e = property2.options) == null ? void 0 : _e.choices) ?? []).filter((x2) => typedDv == null ? void 0 : typedDv.includes(x2.value)).map((x2) => x2.label);
      const vas = _$2.sortBy(
        ((_g = (_f = property2.options) == null ? void 0 : _f.choices) == null ? void 0 : _g.filter((o2) => dv == null ? void 0 : dv.includes(o2.value))) ?? [],
        (x2) => typedDv == null ? void 0 : typedDv.findIndex((d2) => d2 == x2.value)
      );
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        ChoiceValueRenderer,
        {
          multiple: true,
          defaultEditing,
          editor: simpleEditor,
          getDataSource: async () => {
            var _a3;
            return ((_a3 = property2.options) == null ? void 0 : _a3.choices) ?? [];
          },
          value: typedBv,
          valueAttributes: vas,
          variant,
          size: size2
        }
      );
    }
    case PropertyType.Number: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        NumberValueRenderer,
        {
          as: "number",
          defaultEditing,
          editor: simpleEditor,
          value: typedBv,
          variant
        }
      );
    }
    case PropertyType.Percentage: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        NumberValueRenderer,
        {
          as: "progress",
          defaultEditing,
          editor: simpleEditor,
          suffix: "%",
          value: typedBv,
          variant,
          size: size2
        }
      );
    }
    case PropertyType.Rating: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        RatingValueRenderer,
        {
          defaultEditing,
          editor: simpleEditor,
          value: typedBv,
          variant,
          size: size2
        }
      );
    }
    case PropertyType.Boolean: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        BooleanValueRenderer,
        {
          defaultEditing,
          editor: simpleEditor,
          value: typedBv,
          variant,
          size: size2
        }
      );
    }
    case PropertyType.Link: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        LinkValueRenderer,
        {
          defaultEditing,
          editor: simpleEditor,
          value: typedBv,
          variant,
          size: size2
        }
      );
    }
    case PropertyType.Attachment: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        AttachmentValueRenderer,
        {
          defaultEditing,
          editor: simpleEditor,
          value: typedBv,
          variant,
          size: size2
        }
      );
    }
    case PropertyType.Date:
    case PropertyType.DateTime: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        DateTimeValueRenderer,
        {
          as: property2.type == PropertyType.DateTime ? "datetime" : "date",
          defaultEditing,
          editor: simpleEditor,
          value: typedBv,
          variant,
          size: size2
        }
      );
    }
    case PropertyType.Time: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        TimeValueRenderer,
        {
          defaultEditing,
          editor: simpleEditor,
          value: typedBv,
          variant,
          size: size2
        }
      );
    }
    case PropertyType.Formula: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        FormulaValueRenderer,
        {
          defaultEditing,
          editor: simpleEditor,
          value: typedBv,
          variant,
          size: size2
        }
      );
    }
    case PropertyType.Multilevel: {
      const typedDv = dv;
      const tbv = typedDv == null ? void 0 : typedDv.map(
        (v2) => {
          var _a3;
          return findNodeChainInMultilevelData(((_a3 = property2 == null ? void 0 : property2.options) == null ? void 0 : _a3.data) || [], v2);
        }
      ).filter((x2) => x2 != void 0);
      const typedBv = bv ?? (tbv == null ? void 0 : tbv.map((x2) => x2.map((y2) => y2.label)));
      const vas = tbv == null ? void 0 : tbv.map((v2) => v2.map((x2) => ({ color: x2.color })));
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        MultilevelValueRenderer,
        {
          defaultEditing,
          editor: simpleEditor,
          getDataSource: async () => {
            var _a3;
            return ((_a3 = property2 == null ? void 0 : property2.options) == null ? void 0 : _a3.data) || [];
          },
          multiple: ((_h = property2 == null ? void 0 : property2.options) == null ? void 0 : _h.valueIsSingleton) ?? true,
          value: typedBv,
          valueAttributes: vas,
          variant,
          size: size2
        }
      );
    }
    case PropertyType.Tags: {
      const typedDv = dv;
      const typedBv = bv ?? (((_i = property2.options) == null ? void 0 : _i.tags) || []).filter((x2) => dv == null ? void 0 : dv.includes(x2.value)).map((x2) => ({
        group: x2.group,
        name: x2.name
      }));
      const vas = _$2.sortBy(
        ((_k = (_j = property2.options) == null ? void 0 : _j.tags) == null ? void 0 : _k.filter((o2) => typedDv == null ? void 0 : typedDv.includes(o2.value))) ?? [],
        (x2) => typedDv == null ? void 0 : typedDv.findIndex((d2) => d2 == x2.value)
      );
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        TagsValueRenderer,
        {
          defaultEditing,
          editor: simpleEditor,
          getDataSource: async () => {
            var _a3;
            return ((_a3 = property2 == null ? void 0 : property2.options) == null ? void 0 : _a3.tags) || [];
          },
          value: typedBv,
          valueAttributes: vas,
          variant,
          size: size2
        }
      );
    }
  }
};
PropertyValueRenderer.displayName = "PropertyValueRenderer";
const log$v = buildLogger("Filter");
const Filter = ({
  filter: propsFilter,
  onRemove,
  onChange,
  isReadonly,
  isNew,
  disableTooltipOperations,
  removeBackground
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [filter3, setFilter] = reactExports.useState(propsFilter);
  reactExports.useEffect(() => {
    if (isNew) {
      changeProperty();
    }
  }, []);
  useUpdateEffect(() => {
    setFilter(propsFilter);
  }, [propsFilter]);
  const changeFilter = (newFilter) => {
    setFilter(newFilter);
    onChange == null ? void 0 : onChange(newFilter);
    if (newFilter.propertyPool && newFilter.propertyId && newFilter.operation) {
      BApi$1.options.addRecentResourceFilter({
        propertyPool: newFilter.propertyPool,
        propertyId: newFilter.propertyId,
        operation: newFilter.operation,
        dbValue: newFilter.dbValue
      });
    }
  };
  log$v(propsFilter, filter3);
  const changeProperty = () => {
    createPortal(PropertySelector, {
      v2: true,
      selection: filter3.propertyId == void 0 ? void 0 : [
        {
          id: filter3.propertyId,
          pool: filter3.propertyPool
        }
      ],
      onSubmit: async (selectedProperties) => {
        const property2 = selectedProperties[0];
        const availableOperations = (await BApi$1.resource.getSearchOperationsForProperty({
          propertyPool: property2.pool,
          propertyId: property2.id
        })).data || [];
        const nf2 = {
          ...filter3,
          propertyId: property2.id,
          propertyPool: property2.pool,
          dbValue: void 0,
          bizValue: void 0,
          property: property2,
          availableOperations,
          operation: availableOperations[0]
        };
        refreshValue(nf2);
      },
      multiple: false,
      pool: PropertyPool.All,
      addable: false,
      editable: false
    });
  };
  const renderOperations = () => {
    if (isReadonly) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "secondary", size: "sm", variant: "light", children: filter3.operation == void 0 ? t2("Condition") : t2(`SearchOperation.${SearchOperation[filter3.operation]}`) });
    }
    if (filter3.propertyId == void 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Please select a property first"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          className: "min-w-fit pl-2 pr-2 cursor-not-allowed",
          color: "secondary",
          size: "sm",
          variant: "light",
          children: filter3.operation == void 0 ? t2("Condition") : t2(`SearchOperation.${SearchOperation[filter3.operation]}`)
        }
      ) });
    }
    const operations = filter3.availableOperations ?? [];
    log$v(operations);
    if (operations.length == 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Can not operate on this property"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          className: "min-w-fit pl-2 pr-2 cursor-not-allowed",
          color: "secondary",
          size: "sm",
          variant: "light",
          children: filter3.operation == void 0 ? t2("Condition") : t2(`SearchOperation.${SearchOperation[filter3.operation]}`)
        }
      ) });
    } else {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { placement: "bottom-start", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            className: "min-w-fit pl-2 pr-2",
            color: "secondary",
            size: "sm",
            variant: "light",
            children: filter3.operation == void 0 ? t2("Condition") : t2(`SearchOperation.${SearchOperation[filter3.operation]}`)
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_menu_default, { children: operations.map((operation) => {
          const descriptionKey = `SearchOperation.${SearchOperation[operation]}.description`;
          const description = t2(descriptionKey);
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            menu_item_base_default,
            {
              description: description == descriptionKey ? void 0 : description,
              onClick: () => {
                refreshValue({
                  ...filter3,
                  operation
                });
              },
              children: t2(`SearchOperation.${SearchOperation[operation]}`)
            },
            operation
          );
        }) })
      ] });
    }
  };
  log$v("rendering filter", filter3);
  const refreshValue = (filter22) => {
    if (!filter22.propertyPool || !filter22.propertyId || !filter22.operation) {
      filter22.valueProperty = void 0;
      filter22.dbValue = void 0;
      filter22.bizValue = void 0;
      changeFilter({
        ...filter22
      });
    } else {
      BApi$1.resource.getFilterValueProperty(filter22).then((r2) => {
        const p2 = r2.data;
        filter22.valueProperty = p2;
        changeFilter({
          ...filter22
        });
      });
    }
  };
  const renderValue = () => {
    if (!filter3.valueProperty) {
      return null;
    }
    if (filter3.operation == SearchOperation.IsNull || filter3.operation == SearchOperation.IsNotNull) {
      return null;
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      PropertyValueRenderer,
      {
        bizValue: filter3.bizValue,
        dbValue: filter3.dbValue,
        defaultEditing: filter3.dbValue == void 0,
        property: filter3.valueProperty,
        size: "sm",
        variant: "light",
        onValueChange: isReadonly ? void 0 : (dbValue, bizValue) => {
          changeFilter({
            ...filter3,
            dbValue,
            bizValue
          });
        }
      }
    );
  };
  const renderInner = () => {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        className: `flex rounded p-1 items-center ${filter3.disabled ? "" : "group/filter-operations"} relative rounded`,
        style: removeBackground ? void 0 : { backgroundColor: "var(--bakaui-overlap-background)" },
        children: [
          filter3.disabled && /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: "absolute top-0 left-0 w-full h-full flex items-center justify-center z-20 group/filter-disable-cover rounded cursor-not-allowed",
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineFilterAltOff, { className: "text-lg text-warning" })
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `flex items-center ${filter3.disabled ? "opacity-60" : ""}`, children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "", children: isReadonly ? /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "light", children: filter3.property ? filter3.property.name ?? t2("Unknown property") : t2("Property") }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                className: "min-w-fit pl-2 pr-2",
                color: "success",
                size: "sm",
                variant: "light",
                onPress: isReadonly ? void 0 : changeProperty,
                children: filter3.property ? filter3.property.name ?? t2("Unknown property") : t2("Property")
              }
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "", children: renderOperations() }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pr-2", children: renderValue() })
          ] })
        ]
      }
    );
  };
  if (disableTooltipOperations) {
    return renderInner();
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      showArrow: true,
      closeDelay: 0,
      content: /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: filter3.disabled ? "success" : "warning",
            size: "sm",
            variant: "light",
            onPress: () => {
              changeFilter({
                ...filter3,
                disabled: !filter3.disabled
              });
            },
            children: filter3.disabled ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineFilterAlt, { className: "text-lg" }),
              t2("Enable filter")
            ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineFilterAltOff, { className: "text-lg" }),
              t2("Disable filter")
            ] })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "danger",
            size: "sm",
            variant: "light",
            onPress: onRemove,
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineClose, { className: "text-base" }),
              t2("Delete filter")
            ]
          }
        )
      ] }) }),
      isDisabled: isReadonly,
      offset: 0,
      placement: "top",
      children: renderInner()
    }
  );
};
Filter.displayName = "Filter";
buildLogger("RecentFilters");
const RecentFilters = ({ onSelectFilter }) => {
  const { t: t2 } = useTranslation();
  const [recentFilters, setRecentFilters] = reactExports.useState(
    []
  );
  const loadRecentFilters = async () => {
    try {
      const response = await BApi$1.options.getRecentResourceFilters();
      setRecentFilters(response.data || []);
    } catch (error2) {
      console.error("Failed to load recent filters:", error2);
    }
  };
  reactExports.useEffect(() => {
    loadRecentFilters();
  }, []);
  if (recentFilters.length === 0) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid-cols-2 gap-1", children: recentFilters.map((filter3, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Apply this filter to the current search"), placement: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(button_default$1, { className: "flex items-center justify-between gap-1", variant: "light", size: "sm", color: "primary", onPress: () => onSelectFilter == null ? void 0 : onSelectFilter(filter3), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(Filter, { isReadonly: true, filter: filter3, removeBackground: true }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineRightCircle, { className: "text-lg" })
  ] }, index2) })) });
};
RecentFilters.displayName = "RecentFilters";
const FilterModal = ({ filter: filter3, onSubmit, isNew }) => {
  const { t: t2 } = useTranslation();
  const filterRef = reactExports.useRef(filter3);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      size: "sm",
      title: t2("Configure filter"),
      onOk: async () => {
        onSubmit(filterRef.current);
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Filter,
        {
          isNew,
          disableTooltipOperations: true,
          filter: filter3,
          onChange: (f2) => {
            filterRef.current = f2;
          }
        }
      ) })
    }
  );
};
const log$u = buildLogger("FilterGroup");
const FilterGroup = ({
  group: propsGroup,
  onRemove,
  onChange,
  isRoot = false
}) => {
  const { t: t2 } = useTranslation();
  useUpdate();
  const { createPortal } = useBakabaseContext();
  const [group, setGroup] = React$5.useState(propsGroup);
  const groupRef = reactExports.useRef(group);
  reactExports.useEffect(() => {
  }, []);
  const changeGroup = reactExports.useCallback(
    (newGroup) => {
      setGroup(newGroup);
      onChange == null ? void 0 : onChange(newGroup);
    },
    [onChange]
  );
  useUpdateEffect(() => {
    groupRef.current = group;
  }, [group]);
  useUpdateEffect(() => {
    setGroup(propsGroup);
  }, [propsGroup]);
  const { filters, groups: groups2, combinator } = group;
  const conditionElements = (filters || []).map((f2, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
    Filter,
    {
      filter: f2,
      onChange: (tf2) => {
        changeGroup({
          ...group,
          filters: (group.filters || []).map((fil) => fil === f2 ? tf2 : fil)
        });
      },
      onRemove: () => {
        changeGroup({
          ...group,
          filters: (group.filters || []).filter((fil) => fil !== f2)
        });
      }
    },
    `f-${i2}`
  )).concat(
    (groups2 || []).map((g2, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      FilterGroup,
      {
        group: g2,
        onChange: (tg2) => {
          changeGroup({
            ...group,
            groups: (group.groups || []).map((gr) => gr === g2 ? tg2 : gr)
          });
        },
        onRemove: () => {
          changeGroup({
            ...group,
            groups: (group.groups || []).filter((gr) => gr !== g2)
          });
        }
      },
      `g-${i2}`
    ))
  );
  const allElements = conditionElements.reduce((acc, el2, i2) => {
    acc.push(el2);
    if (i2 < conditionElements.length - 1) {
      acc.push(
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            className: "min-w-fit pl-2 pr-2",
            color: "default",
            size: "sm",
            variant: "light",
            onClick: () => {
              changeGroup({
                ...group,
                combinator: GroupCombinator.And == group.combinator ? GroupCombinator.Or : GroupCombinator.And
              });
            },
            children: t2(`Combinator.${GroupCombinator[combinator]}`)
          },
          `c-${i2}`
        )
      );
    }
    return acc;
  }, []);
  const renderGroup = () => {
    log$u("render group");
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        className: `${styles$4.filterGroup} p-1 ${isRoot ? styles$4.root : ""} ${styles$4.removable} relative`,
        children: [
          group.disabled && /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: "absolute top-0 left-0 w-full h-full flex items-center justify-center z-20 group/group-disable-cover rounded cursor-not-allowed",
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineFilterAltOff, { className: "text-lg text-warning" })
            }
          ),
          allElements,
          !(isRoot && !group && (!filters || filters.length == 0)) && /* @__PURE__ */ jsxRuntimeExports.jsx(
            PopoverComponent,
            {
              showArrow: true,
              placement: "bottom",
              style: { zIndex: 10 },
              trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, size: "sm", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TbFilterPlus, { className: "text-lg" }) }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs(
                    Button,
                    {
                      size: "sm",
                      onPress: () => {
                        createPortal(
                          FilterModal,
                          {
                            isNew: true,
                            filter: { disabled: false },
                            onSubmit: (filter3) => {
                              changeGroup({
                                ...groupRef.current,
                                filters: [...groupRef.current.filters || [], filter3]
                              });
                            }
                          }
                        );
                      },
                      children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$J, { className: "text-base" }),
                        t2("Filter")
                      ]
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsxs(
                    Button,
                    {
                      size: "sm",
                      onPress: () => {
                        changeGroup({
                          ...groupRef.current,
                          groups: [
                            ...groupRef.current.groups || [],
                            {
                              combinator: GroupCombinator.And,
                              disabled: false
                            }
                          ]
                        });
                      },
                      children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$16, { className: "text-base" }),
                        t2("Filter group")
                      ]
                    }
                  )
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Recent filters") }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    RecentFilters,
                    {
                      onSelectFilter: (filter3) => {
                        changeGroup({
                          ...groupRef.current,
                          filters: [...groupRef.current.filters || [], filter3]
                        });
                      }
                    }
                  )
                ] })
              ] })
            }
          )
        ]
      }
    );
  };
  return isRoot ? renderGroup() : /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "warning",
            size: "sm",
            variant: "light",
            onPress: () => {
              changeGroup({
                ...group,
                disabled: !group.disabled
              });
            },
            children: group.disabled ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineFilterAlt, { className: "text-lg" }),
              t2("Enable group")
            ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineFilterAltOff, { className: "text-lg" }),
              t2("Disable group")
            ] })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "danger",
            size: "sm",
            variant: "light",
            onPress: onRemove,
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" }),
              t2("Delete group")
            ]
          }
        )
      ] }),
      children: renderGroup()
    }
  );
};
buildLogger("FilterGroupsPanel");
function FilterGroupsPanel({ group: propsGroup, onChange }) {
  const { t: t2 } = useTranslation();
  const [group, setGroup] = reactExports.useState(
    propsGroup ?? {
      combinator: GroupCombinator.And,
      disabled: false
    }
  );
  reactExports.useEffect(() => {
  }, []);
  useUpdateEffect(() => {
    setGroup(
      propsGroup ?? {
        combinator: GroupCombinator.And,
        disabled: false
      }
    );
  }, [propsGroup]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group flex flex-wrap gap-2 item-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    FilterGroup,
    {
      isRoot: true,
      group,
      onChange: (group2) => {
        setGroup(group2);
        onChange == null ? void 0 : onChange(group2);
      }
    }
  ) });
}
function FaSortAmountDownAlt(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M240 96h64a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16h-64a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm0 128h128a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16H240a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm256 192H240a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h256a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm-256-64h192a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16H240a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm-64 0h-48V48a16 16 0 0 0-16-16H80a16 16 0 0 0-16 16v304H16c-14.19 0-21.37 17.24-11.29 27.31l80 96a16 16 0 0 0 22.62 0l80-96C197.35 369.26 190.22 352 176 352z" }, "child": [] }] })(props);
}
function FaSortAmountDown(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M304 416h-64a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm-128-64h-48V48a16 16 0 0 0-16-16H80a16 16 0 0 0-16 16v304H16c-14.19 0-21.37 17.24-11.29 27.31l80 96a16 16 0 0 0 22.62 0l80-96C197.35 369.26 190.22 352 176 352zm256-192H240a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h192a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm-64 128H240a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h128a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM496 32H240a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h256a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z" }, "child": [] }] })(props);
}
function FaSort(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 320 512" }, "child": [{ "tag": "path", "attr": { "d": "M41 288h238c21.4 0 32.1 25.9 17 41L177 448c-9.4 9.4-24.6 9.4-33.9 0L24 329c-15.1-15.1-4.4-41 17-41zm255-105L177 64c-9.4-9.4-24.6-9.4-33.9 0L24 183c-15.1 15.1-4.4 41 17 41h238c21.4 0 32.1-25.9 17-41z" }, "child": [] }] })(props);
}
const directionDataSource = [
  {
    label: "Asc",
    asc: true
  },
  {
    label: "Desc",
    asc: false
  }
];
const OrderSelector = ({
  value: propsValue,
  onChange,
  ...otherProps
}) => {
  const { t: t2 } = useTranslation();
  const [value2, setValue] = reactExports.useState(propsValue);
  useUpdateEffect(() => {
    setValue(propsValue);
  }, [propsValue]);
  const orderDataSourceRef = reactExports.useRef(
    resourceSearchSortableProperties.reduce((s2, x2) => {
      directionDataSource.forEach((y2) => {
        s2.push({
          label: /* @__PURE__ */ jsxRuntimeExports.jsxs(
            "div",
            {
              style: {
                display: "flex",
                alignItems: "center",
                gap: 5
              },
              title: t2(y2.label),
              children: [
                y2.asc ? /* @__PURE__ */ jsxRuntimeExports.jsx(FaSortAmountDownAlt, { className: "text-lg" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(FaSortAmountDown, { className: "text-lg" }),
                t2(x2.label)
              ]
            }
          ),
          value: `${x2.value}-${y2.asc}`,
          textValue: `${t2(x2.label)}${y2.asc ? "⬆️" : "⬇️"}`
        });
      });
      return s2;
    }, [])
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    Select,
    {
      "aria-label": t2("Orders"),
      selectedKeys: (value2 || []).map((a2) => `${a2.property}-${a2.asc}`),
      selectionMode: "single",
      size: "sm",
      style: {
        maxWidth: 500,
        minWidth: 200
      },
      onSelectionChange: (arr) => {
        const set2 = arr;
        const orderAscMap = {};
        for (const v2 of set2.values()) {
          const vl = v2.split("-");
          orderAscMap[parseInt(vl[0], 10)] = vl[1] === "true";
        }
        const orders2 = [];
        for (const k2 in orderAscMap) {
          orders2.push({
            property: parseInt(k2, 10),
            asc: orderAscMap[k2]
          });
        }
        setValue(orders2);
        onChange == null ? void 0 : onChange(orders2);
      },
      placeholder: t2("Select orders"),
      dataSource: orderDataSourceRef.current,
      ...otherProps
    }
  ) });
};
OrderSelector.displayName = "OrderSelector";
const quickFilterMap = {
  // [ResourceProperty.MediaLibrary]: SearchOperation.In,
  [ResourceProperty.Filename]: SearchOperation.Contains,
  [ResourceProperty.MediaLibraryV2]: SearchOperation.In
};
const QuickFilter = ({ onAdded }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [loading, setLoading] = reactExports.useState(true);
  const [properties2, setProperties] = reactExports.useState([]);
  reactExports.useEffect(() => {
    BApi$1.property.getPropertiesByPool(PropertyPool.Internal).then((r2) => {
      setProperties(
        (r2.data || []).filter((x2) => x2.id in quickFilterMap).sort((a2, b2) => {
          return b2.id - a2.id;
        })
      );
      setLoading(false);
    });
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Quick filter") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2 flex-wrap", children: loading ? /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" }) : properties2.map((p2) => {
      const operation = quickFilterMap[p2.id];
      const pool = PropertyPool.Internal;
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          size: "sm",
          onClick: async () => {
            const vp = (await BApi$1.resource.getFilterValueProperty({
              propertyPool: pool,
              propertyId: p2.id,
              operation
            })).data;
            const availableOperations = (await BApi$1.resource.getSearchOperationsForProperty({
              propertyPool: pool,
              propertyId: p2.id
            })).data ?? [];
            const newFilter = {
              propertyId: p2.id,
              operation,
              propertyPool: p2.pool,
              property: p2,
              valueProperty: vp,
              availableOperations,
              disabled: false
            };
            onAdded(newFilter);
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1h, { className: "text-base" }),
            p2.name
          ]
        }
      );
    }) })
  ] });
};
QuickFilter.displayName = "QuickFilter";
const addFilterGroup = (form2, group) => {
  if (!group) {
    group = {
      combinator: GroupCombinator.And,
      // GroupCombinator.And
      disabled: false,
      filters: [],
      groups: []
    };
  }
  if (!form2.group) {
    form2.group = group;
  } else {
    if (!form2.group.groups) {
      form2.group.groups = [];
    }
    form2.group.groups.push(group);
  }
  return form2;
};
const addFilter = (form2, filter3) => {
  if (!filter3) {
    filter3 = {
      disabled: false,
      availableOperations: []
    };
  }
  if (!form2.group) {
    form2.group = {
      combinator: GroupCombinator.And,
      // GroupCombinator.And
      disabled: false,
      filters: [],
      groups: []
    };
  }
  if (!form2.group.filters) {
    form2.group.filters = [];
  }
  form2.group.filters.push(filter3);
  return filter3;
};
function FilterPortal({
  searchForm,
  onChange
}) {
  var _a2;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    PopoverComponent,
    {
      showArrow: true,
      placement: "bottom",
      style: { zIndex: 10 },
      trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TbFilterPlus, { className: "text-lg" }) }),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        "div",
        {
          className: "grid items-center gap-2 my-3 mx-1",
          style: { gridTemplateColumns: "auto auto" },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              QuickFilter,
              {
                onAdded: (newFilter) => {
                  const filter3 = newFilter;
                  createPortal(
                    FilterModal,
                    {
                      filter: filter3,
                      onSubmit: (filter22) => {
                        addFilter(searchForm, filter22);
                        onChange();
                      }
                    }
                  );
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
            /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "horizontal" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Advance filter") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs(
                Button,
                {
                  size: "sm",
                  onPress: () => {
                    createPortal(
                      FilterModal,
                      {
                        isNew: true,
                        filter: { disabled: false },
                        onSubmit: (filter3) => {
                          addFilter(searchForm, filter3);
                          onChange();
                        }
                      }
                    );
                  },
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$J, { className: "text-base" }),
                    t2("Filter")
                  ]
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsxs(
                Button,
                {
                  size: "sm",
                  onPress: () => {
                    addFilterGroup(searchForm);
                    onChange();
                  },
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$16, { className: "text-base" }),
                    t2("Filter group")
                  ]
                }
              )
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
            /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "horizontal" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Special filters") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              checkbox_group_default,
              {
                size: "sm",
                value: (_a2 = searchForm.tags) == null ? void 0 : _a2.map((t22) => t22.toString()),
                onChange: (ts) => {
                  searchForm.tags = ts.map((t22) => parseInt(t22, 10));
                  onChange();
                },
                children: resourceTags.map((rt) => {
                  return /* @__PURE__ */ jsxRuntimeExports.jsx(checkbox_default, { value: rt.value.toString(), children: t2(`ResourceTag.${rt.label}`) }, rt.value);
                })
              }
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
            /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Recent filters") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              RecentFilters,
              {
                onSelectFilter: (newFilter) => {
                  addFilter(searchForm, newFilter);
                  onChange();
                }
              }
            ) })
          ]
        }
      )
    }
  );
}
function _objectSpread(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? Object(arguments[r2]) : {}, o2 = Object.keys(t2);
    "function" == typeof Object.getOwnPropertySymbols && o2.push.apply(o2, Object.getOwnPropertySymbols(t2).filter(function(e3) {
      return Object.getOwnPropertyDescriptor(t2, e3).enumerable;
    })), o2.forEach(function(r3) {
      _defineProperty$3(e2, r3, t2[r3]);
    });
  }
  return e2;
}
var invariant = function(condition, format2, a2, b2, c2, d2, e2, f2) {
  if (!condition) {
    var error2;
    if (format2 === void 0) {
      error2 = new Error(
        "Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings."
      );
    } else {
      var args = [a2, b2, c2, d2, e2, f2];
      var argIndex = 0;
      error2 = new Error(
        format2.replace(/%s/g, function() {
          return args[argIndex++];
        })
      );
      error2.name = "Invariant Violation";
    }
    error2.framesToPop = 1;
    throw error2;
  }
};
var browser = invariant;
const invariant$1 = /* @__PURE__ */ getDefaultExportFromCjs(browser);
var Manager = function() {
  function Manager2() {
    _classCallCheck$a(this, Manager2);
    _defineProperty$3(this, "refs", {});
  }
  _createClass$8(Manager2, [{
    key: "add",
    value: function add2(collection, ref) {
      if (!this.refs[collection]) {
        this.refs[collection] = [];
      }
      this.refs[collection].push(ref);
    }
  }, {
    key: "remove",
    value: function remove(collection, ref) {
      var index2 = this.getIndex(collection, ref);
      if (index2 !== -1) {
        this.refs[collection].splice(index2, 1);
      }
    }
  }, {
    key: "isActive",
    value: function isActive2() {
      return this.active;
    }
  }, {
    key: "getActive",
    value: function getActive() {
      var _this = this;
      return this.refs[this.active.collection].find(function(_ref) {
        var node2 = _ref.node;
        return node2.sortableInfo.index == _this.active.index;
      });
    }
  }, {
    key: "getIndex",
    value: function getIndex(collection, ref) {
      return this.refs[collection].indexOf(ref);
    }
  }, {
    key: "getOrderedRefs",
    value: function getOrderedRefs() {
      var collection = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.active.collection;
      return this.refs[collection].sort(sortByIndex);
    }
  }]);
  return Manager2;
}();
function sortByIndex(_ref2, _ref3) {
  var index1 = _ref2.node.sortableInfo.index;
  var index2 = _ref3.node.sortableInfo.index;
  return index1 - index2;
}
function omit(obj, keysToOmit) {
  return Object.keys(obj).reduce(function(acc, key) {
    if (keysToOmit.indexOf(key) === -1) {
      acc[key] = obj[key];
    }
    return acc;
  }, {});
}
var events = {
  end: ["touchend", "touchcancel", "mouseup"],
  move: ["touchmove", "mousemove"],
  start: ["touchstart", "mousedown"]
};
var vendorPrefix = function() {
  if (typeof window === "undefined" || typeof document === "undefined") {
    return "";
  }
  var styles2 = window.getComputedStyle(document.documentElement, "") || ["-moz-hidden-iframe"];
  var pre = (Array.prototype.slice.call(styles2).join("").match(/-(moz|webkit|ms)-/) || styles2.OLink === "" && ["", "o"])[1];
  switch (pre) {
    case "ms":
      return "ms";
    default:
      return pre && pre.length ? pre[0].toUpperCase() + pre.substr(1) : "";
  }
}();
function setInlineStyles(node2, styles2) {
  Object.keys(styles2).forEach(function(key) {
    node2.style[key] = styles2[key];
  });
}
function setTranslate3d(node2, translate) {
  node2.style["".concat(vendorPrefix, "Transform")] = translate == null ? "" : "translate3d(".concat(translate.x, "px,").concat(translate.y, "px,0)");
}
function setTransitionDuration(node2, duration2) {
  node2.style["".concat(vendorPrefix, "TransitionDuration")] = duration2 == null ? "" : "".concat(duration2, "ms");
}
function closest(el2, fn) {
  while (el2) {
    if (fn(el2)) {
      return el2;
    }
    el2 = el2.parentNode;
  }
  return null;
}
function limit(min2, max2, value2) {
  return Math.max(min2, Math.min(value2, max2));
}
function getPixelValue(stringValue) {
  if (stringValue.substr(-2) === "px") {
    return parseFloat(stringValue);
  }
  return 0;
}
function getElementMargin(element2) {
  var style2 = window.getComputedStyle(element2);
  return {
    bottom: getPixelValue(style2.marginBottom),
    left: getPixelValue(style2.marginLeft),
    right: getPixelValue(style2.marginRight),
    top: getPixelValue(style2.marginTop)
  };
}
function provideDisplayName(prefix, Component$$1) {
  var componentName = Component$$1.displayName || Component$$1.name;
  return componentName ? "".concat(prefix, "(").concat(componentName, ")") : prefix;
}
function getScrollAdjustedBoundingClientRect(node2, scrollDelta) {
  var boundingClientRect = node2.getBoundingClientRect();
  return {
    top: boundingClientRect.top + scrollDelta.top,
    left: boundingClientRect.left + scrollDelta.left
  };
}
function getPosition(event) {
  if (event.touches && event.touches.length) {
    return {
      x: event.touches[0].pageX,
      y: event.touches[0].pageY
    };
  } else if (event.changedTouches && event.changedTouches.length) {
    return {
      x: event.changedTouches[0].pageX,
      y: event.changedTouches[0].pageY
    };
  } else {
    return {
      x: event.pageX,
      y: event.pageY
    };
  }
}
function isTouchEvent(event) {
  return event.touches && event.touches.length || event.changedTouches && event.changedTouches.length;
}
function getEdgeOffset(node2, parent) {
  var offset2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
    left: 0,
    top: 0
  };
  if (!node2) {
    return void 0;
  }
  var nodeOffset = {
    left: offset2.left + node2.offsetLeft,
    top: offset2.top + node2.offsetTop
  };
  if (node2.parentNode === parent) {
    return nodeOffset;
  }
  return getEdgeOffset(node2.parentNode, parent, nodeOffset);
}
function getTargetIndex(newIndex, prevIndex, oldIndex) {
  if (newIndex < oldIndex && newIndex > prevIndex) {
    return newIndex - 1;
  } else if (newIndex > oldIndex && newIndex < prevIndex) {
    return newIndex + 1;
  } else {
    return newIndex;
  }
}
function getLockPixelOffset(_ref) {
  var lockOffset = _ref.lockOffset, width = _ref.width, height = _ref.height;
  var offsetX = lockOffset;
  var offsetY = lockOffset;
  var unit2 = "px";
  if (typeof lockOffset === "string") {
    var match5 = /^[+-]?\d*(?:\.\d*)?(px|%)$/.exec(lockOffset);
    invariant$1(match5 !== null, 'lockOffset value should be a number or a string of a number followed by "px" or "%". Given %s', lockOffset);
    offsetX = parseFloat(lockOffset);
    offsetY = parseFloat(lockOffset);
    unit2 = match5[1];
  }
  invariant$1(isFinite(offsetX) && isFinite(offsetY), "lockOffset value should be a finite. Given %s", lockOffset);
  if (unit2 === "%") {
    offsetX = offsetX * width / 100;
    offsetY = offsetY * height / 100;
  }
  return {
    x: offsetX,
    y: offsetY
  };
}
function getLockPixelOffsets(_ref2) {
  var height = _ref2.height, width = _ref2.width, lockOffset = _ref2.lockOffset;
  var offsets = Array.isArray(lockOffset) ? lockOffset : [lockOffset, lockOffset];
  invariant$1(offsets.length === 2, "lockOffset prop of SortableContainer should be a single value or an array of exactly two values. Given %s", lockOffset);
  var _offsets = _slicedToArray(offsets, 2), minLockOffset = _offsets[0], maxLockOffset = _offsets[1];
  return [getLockPixelOffset({
    height,
    lockOffset: minLockOffset,
    width
  }), getLockPixelOffset({
    height,
    lockOffset: maxLockOffset,
    width
  })];
}
function isScrollable(el2) {
  var computedStyle = window.getComputedStyle(el2);
  var overflowRegex = /(auto|scroll)/;
  var properties2 = ["overflow", "overflowX", "overflowY"];
  return properties2.find(function(property2) {
    return overflowRegex.test(computedStyle[property2]);
  });
}
function getScrollingParent(el2) {
  if (!(el2 instanceof HTMLElement)) {
    return null;
  } else if (isScrollable(el2)) {
    return el2;
  } else {
    return getScrollingParent(el2.parentNode);
  }
}
function getContainerGridGap(element2) {
  var style2 = window.getComputedStyle(element2);
  if (style2.display === "grid") {
    return {
      x: getPixelValue(style2.gridColumnGap),
      y: getPixelValue(style2.gridRowGap)
    };
  }
  return {
    x: 0,
    y: 0
  };
}
var KEYCODE = {
  ESC: 27,
  SPACE: 32,
  LEFT: 37,
  UP: 38,
  RIGHT: 39,
  DOWN: 40
};
var NodeType = {
  Anchor: "A",
  Button: "BUTTON",
  Canvas: "CANVAS",
  Input: "INPUT",
  Option: "OPTION",
  Textarea: "TEXTAREA",
  Select: "SELECT"
};
function cloneNode(node2) {
  var selector = "input, textarea, select, canvas, [contenteditable]";
  var fields = node2.querySelectorAll(selector);
  var clonedNode = node2.cloneNode(true);
  var clonedFields = _toConsumableArray(clonedNode.querySelectorAll(selector));
  clonedFields.forEach(function(field, i2) {
    if (field.type !== "file") {
      field.value = fields[i2].value;
    }
    if (field.type === "radio" && field.name) {
      field.name = "__sortableClone__".concat(field.name);
    }
    if (field.tagName === NodeType.Canvas && fields[i2].width > 0 && fields[i2].height > 0) {
      var destCtx = field.getContext("2d");
      destCtx.drawImage(fields[i2], 0, 0);
    }
  });
  return clonedNode;
}
function isSortableHandle(node2) {
  return node2.sortableHandle != null;
}
var AutoScroller = function() {
  function AutoScroller2(container, onScrollCallback) {
    _classCallCheck$a(this, AutoScroller2);
    this.container = container;
    this.onScrollCallback = onScrollCallback;
  }
  _createClass$8(AutoScroller2, [{
    key: "clear",
    value: function clear() {
      if (this.interval == null) {
        return;
      }
      clearInterval(this.interval);
      this.interval = null;
    }
  }, {
    key: "update",
    value: function update(_ref) {
      var _this = this;
      var translate = _ref.translate, minTranslate = _ref.minTranslate, maxTranslate = _ref.maxTranslate, width = _ref.width, height = _ref.height;
      var direction = {
        x: 0,
        y: 0
      };
      var speed = {
        x: 1,
        y: 1
      };
      var acceleration = {
        x: 10,
        y: 10
      };
      var _this$container = this.container, scrollTop = _this$container.scrollTop, scrollLeft = _this$container.scrollLeft, scrollHeight = _this$container.scrollHeight, scrollWidth = _this$container.scrollWidth, clientHeight = _this$container.clientHeight, clientWidth = _this$container.clientWidth;
      var isTop = scrollTop === 0;
      var isBottom = scrollHeight - scrollTop - clientHeight === 0;
      var isLeft = scrollLeft === 0;
      var isRight = scrollWidth - scrollLeft - clientWidth === 0;
      if (translate.y >= maxTranslate.y - height / 2 && !isBottom) {
        direction.y = 1;
        speed.y = acceleration.y * Math.abs((maxTranslate.y - height / 2 - translate.y) / height);
      } else if (translate.x >= maxTranslate.x - width / 2 && !isRight) {
        direction.x = 1;
        speed.x = acceleration.x * Math.abs((maxTranslate.x - width / 2 - translate.x) / width);
      } else if (translate.y <= minTranslate.y + height / 2 && !isTop) {
        direction.y = -1;
        speed.y = acceleration.y * Math.abs((translate.y - height / 2 - minTranslate.y) / height);
      } else if (translate.x <= minTranslate.x + width / 2 && !isLeft) {
        direction.x = -1;
        speed.x = acceleration.x * Math.abs((translate.x - width / 2 - minTranslate.x) / width);
      }
      if (this.interval) {
        this.clear();
        this.isAutoScrolling = false;
      }
      if (direction.x !== 0 || direction.y !== 0) {
        this.interval = setInterval(function() {
          _this.isAutoScrolling = true;
          var offset2 = {
            left: speed.x * direction.x,
            top: speed.y * direction.y
          };
          _this.container.scrollTop += offset2.top;
          _this.container.scrollLeft += offset2.left;
          _this.onScrollCallback(offset2);
        }, 5);
      }
    }
  }]);
  return AutoScroller2;
}();
function defaultGetHelperDimensions(_ref) {
  var node2 = _ref.node;
  return {
    height: node2.offsetHeight,
    width: node2.offsetWidth
  };
}
function defaultShouldCancelStart(event) {
  var interactiveElements = [NodeType.Input, NodeType.Textarea, NodeType.Select, NodeType.Option, NodeType.Button];
  if (interactiveElements.indexOf(event.target.tagName) !== -1) {
    return true;
  }
  if (closest(event.target, function(el2) {
    return el2.contentEditable === "true";
  })) {
    return true;
  }
  return false;
}
var propTypes = {
  axis: PropTypes$4.oneOf(["x", "y", "xy"]),
  contentWindow: PropTypes$4.any,
  disableAutoscroll: PropTypes$4.bool,
  distance: PropTypes$4.number,
  getContainer: PropTypes$4.func,
  getHelperDimensions: PropTypes$4.func,
  helperClass: PropTypes$4.string,
  helperContainer: PropTypes$4.oneOfType([PropTypes$4.func, typeof HTMLElement === "undefined" ? PropTypes$4.any : PropTypes$4.instanceOf(HTMLElement)]),
  hideSortableGhost: PropTypes$4.bool,
  keyboardSortingTransitionDuration: PropTypes$4.number,
  lockAxis: PropTypes$4.string,
  lockOffset: PropTypes$4.oneOfType([PropTypes$4.number, PropTypes$4.string, PropTypes$4.arrayOf(PropTypes$4.oneOfType([PropTypes$4.number, PropTypes$4.string]))]),
  lockToContainerEdges: PropTypes$4.bool,
  onSortEnd: PropTypes$4.func,
  onSortMove: PropTypes$4.func,
  onSortOver: PropTypes$4.func,
  onSortStart: PropTypes$4.func,
  pressDelay: PropTypes$4.number,
  pressThreshold: PropTypes$4.number,
  keyCodes: PropTypes$4.shape({
    lift: PropTypes$4.arrayOf(PropTypes$4.number),
    drop: PropTypes$4.arrayOf(PropTypes$4.number),
    cancel: PropTypes$4.arrayOf(PropTypes$4.number),
    up: PropTypes$4.arrayOf(PropTypes$4.number),
    down: PropTypes$4.arrayOf(PropTypes$4.number)
  }),
  shouldCancelStart: PropTypes$4.func,
  transitionDuration: PropTypes$4.number,
  updateBeforeSortStart: PropTypes$4.func,
  useDragHandle: PropTypes$4.bool,
  useWindowAsScrollContainer: PropTypes$4.bool
};
var defaultKeyCodes = {
  lift: [KEYCODE.SPACE],
  drop: [KEYCODE.SPACE],
  cancel: [KEYCODE.ESC],
  up: [KEYCODE.UP, KEYCODE.LEFT],
  down: [KEYCODE.DOWN, KEYCODE.RIGHT]
};
var defaultProps = {
  axis: "y",
  disableAutoscroll: false,
  distance: 0,
  getHelperDimensions: defaultGetHelperDimensions,
  hideSortableGhost: true,
  lockOffset: "50%",
  lockToContainerEdges: false,
  pressDelay: 0,
  pressThreshold: 5,
  keyCodes: defaultKeyCodes,
  shouldCancelStart: defaultShouldCancelStart,
  transitionDuration: 300,
  useWindowAsScrollContainer: false
};
var omittedProps = Object.keys(propTypes);
function validateProps(props) {
  invariant$1(!(props.distance && props.pressDelay), "Attempted to set both `pressDelay` and `distance` on SortableContainer, you may only use one or the other, not both at the same time.");
}
function _finallyRethrows(body, finalizer) {
  try {
    var result = body();
  } catch (e2) {
    return finalizer(true, e2);
  }
  if (result && result.then) {
    return result.then(finalizer.bind(null, false), finalizer.bind(null, true));
  }
  return finalizer(false, value);
}
var SortableContext = reactExports.createContext({
  manager: {}
});
function sortableContainer(WrappedComponent) {
  var _class, _temp;
  var config2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
    withRef: false
  };
  return _temp = _class = function(_React$Component) {
    _inherits$a(WithSortableContainer, _React$Component);
    function WithSortableContainer(props) {
      var _this;
      _classCallCheck$a(this, WithSortableContainer);
      _this = _possibleConstructorReturn$a(this, _getPrototypeOf(WithSortableContainer).call(this, props));
      _defineProperty$3(_assertThisInitialized(_assertThisInitialized(_this)), "state", {});
      _defineProperty$3(_assertThisInitialized(_assertThisInitialized(_this)), "handleStart", function(event) {
        var _this$props = _this.props, distance2 = _this$props.distance, shouldCancelStart = _this$props.shouldCancelStart;
        if (event.button === 2 || shouldCancelStart(event)) {
          return;
        }
        _this.touched = true;
        _this.position = getPosition(event);
        var node2 = closest(event.target, function(el2) {
          return el2.sortableInfo != null;
        });
        if (node2 && node2.sortableInfo && _this.nodeIsChild(node2) && !_this.state.sorting) {
          var useDragHandle = _this.props.useDragHandle;
          var _node$sortableInfo = node2.sortableInfo, index2 = _node$sortableInfo.index, collection = _node$sortableInfo.collection, disabled = _node$sortableInfo.disabled;
          if (disabled) {
            return;
          }
          if (useDragHandle && !closest(event.target, isSortableHandle)) {
            return;
          }
          _this.manager.active = {
            collection,
            index: index2
          };
          if (!isTouchEvent(event) && event.target.tagName === NodeType.Anchor) {
            event.preventDefault();
          }
          if (!distance2) {
            if (_this.props.pressDelay === 0) {
              _this.handlePress(event);
            } else {
              _this.pressTimer = setTimeout(function() {
                return _this.handlePress(event);
              }, _this.props.pressDelay);
            }
          }
        }
      });
      _defineProperty$3(_assertThisInitialized(_assertThisInitialized(_this)), "nodeIsChild", function(node2) {
        return node2.sortableInfo.manager === _this.manager;
      });
      _defineProperty$3(_assertThisInitialized(_assertThisInitialized(_this)), "handleMove", function(event) {
        var _this$props2 = _this.props, distance2 = _this$props2.distance, pressThreshold = _this$props2.pressThreshold;
        if (!_this.state.sorting && _this.touched && !_this._awaitingUpdateBeforeSortStart) {
          var position2 = getPosition(event);
          var delta = {
            x: _this.position.x - position2.x,
            y: _this.position.y - position2.y
          };
          var combinedDelta = Math.abs(delta.x) + Math.abs(delta.y);
          _this.delta = delta;
          if (!distance2 && (!pressThreshold || combinedDelta >= pressThreshold)) {
            clearTimeout(_this.cancelTimer);
            _this.cancelTimer = setTimeout(_this.cancel, 0);
          } else if (distance2 && combinedDelta >= distance2 && _this.manager.isActive()) {
            _this.handlePress(event);
          }
        }
      });
      _defineProperty$3(_assertThisInitialized(_assertThisInitialized(_this)), "handleEnd", function() {
        _this.touched = false;
        _this.cancel();
      });
      _defineProperty$3(_assertThisInitialized(_assertThisInitialized(_this)), "cancel", function() {
        var distance2 = _this.props.distance;
        var sorting = _this.state.sorting;
        if (!sorting) {
          if (!distance2) {
            clearTimeout(_this.pressTimer);
          }
          _this.manager.active = null;
        }
      });
      _defineProperty$3(_assertThisInitialized(_assertThisInitialized(_this)), "handlePress", function(event) {
        try {
          var active3 = _this.manager.getActive();
          var _temp6 = function() {
            if (active3) {
              var _temp7 = function _temp72() {
                var index2 = _node.sortableInfo.index;
                var margin = getElementMargin(_node);
                var gridGap = getContainerGridGap(_this.container);
                var containerBoundingRect = _this.scrollContainer.getBoundingClientRect();
                var dimensions = _getHelperDimensions({
                  index: index2,
                  node: _node,
                  collection: _collection
                });
                _this.node = _node;
                _this.margin = margin;
                _this.gridGap = gridGap;
                _this.width = dimensions.width;
                _this.height = dimensions.height;
                _this.marginOffset = {
                  x: _this.margin.left + _this.margin.right + _this.gridGap.x,
                  y: Math.max(_this.margin.top, _this.margin.bottom, _this.gridGap.y)
                };
                _this.boundingClientRect = _node.getBoundingClientRect();
                _this.containerBoundingRect = containerBoundingRect;
                _this.index = index2;
                _this.newIndex = index2;
                _this.axis = {
                  x: _axis.indexOf("x") >= 0,
                  y: _axis.indexOf("y") >= 0
                };
                _this.offsetEdge = getEdgeOffset(_node, _this.container);
                if (_isKeySorting) {
                  _this.initialOffset = getPosition(_objectSpread({}, event, {
                    pageX: _this.boundingClientRect.left,
                    pageY: _this.boundingClientRect.top
                  }));
                } else {
                  _this.initialOffset = getPosition(event);
                }
                _this.initialScroll = {
                  left: _this.scrollContainer.scrollLeft,
                  top: _this.scrollContainer.scrollTop
                };
                _this.initialWindowScroll = {
                  left: window.pageXOffset,
                  top: window.pageYOffset
                };
                _this.helper = _this.helperContainer.appendChild(cloneNode(_node));
                setInlineStyles(_this.helper, {
                  boxSizing: "border-box",
                  height: "".concat(_this.height, "px"),
                  left: "".concat(_this.boundingClientRect.left - margin.left, "px"),
                  pointerEvents: "none",
                  position: "fixed",
                  top: "".concat(_this.boundingClientRect.top - margin.top, "px"),
                  width: "".concat(_this.width, "px")
                });
                if (_isKeySorting) {
                  _this.helper.focus();
                }
                if (_hideSortableGhost) {
                  _this.sortableGhost = _node;
                  setInlineStyles(_node, {
                    opacity: 0,
                    visibility: "hidden"
                  });
                }
                _this.minTranslate = {};
                _this.maxTranslate = {};
                if (_isKeySorting) {
                  var _ref = _useWindowAsScrollContainer ? {
                    top: 0,
                    left: 0,
                    width: _this.contentWindow.innerWidth,
                    height: _this.contentWindow.innerHeight
                  } : _this.containerBoundingRect, containerTop = _ref.top, containerLeft = _ref.left, containerWidth = _ref.width, containerHeight = _ref.height;
                  var containerBottom = containerTop + containerHeight;
                  var containerRight = containerLeft + containerWidth;
                  if (_this.axis.x) {
                    _this.minTranslate.x = containerLeft - _this.boundingClientRect.left;
                    _this.maxTranslate.x = containerRight - (_this.boundingClientRect.left + _this.width);
                  }
                  if (_this.axis.y) {
                    _this.minTranslate.y = containerTop - _this.boundingClientRect.top;
                    _this.maxTranslate.y = containerBottom - (_this.boundingClientRect.top + _this.height);
                  }
                } else {
                  if (_this.axis.x) {
                    _this.minTranslate.x = (_useWindowAsScrollContainer ? 0 : containerBoundingRect.left) - _this.boundingClientRect.left - _this.width / 2;
                    _this.maxTranslate.x = (_useWindowAsScrollContainer ? _this.contentWindow.innerWidth : containerBoundingRect.left + containerBoundingRect.width) - _this.boundingClientRect.left - _this.width / 2;
                  }
                  if (_this.axis.y) {
                    _this.minTranslate.y = (_useWindowAsScrollContainer ? 0 : containerBoundingRect.top) - _this.boundingClientRect.top - _this.height / 2;
                    _this.maxTranslate.y = (_useWindowAsScrollContainer ? _this.contentWindow.innerHeight : containerBoundingRect.top + containerBoundingRect.height) - _this.boundingClientRect.top - _this.height / 2;
                  }
                }
                if (_helperClass) {
                  _helperClass.split(" ").forEach(function(className) {
                    return _this.helper.classList.add(className);
                  });
                }
                _this.listenerNode = event.touches ? event.target : _this.contentWindow;
                if (_isKeySorting) {
                  _this.listenerNode.addEventListener("wheel", _this.handleKeyEnd, true);
                  _this.listenerNode.addEventListener("mousedown", _this.handleKeyEnd, true);
                  _this.listenerNode.addEventListener("keydown", _this.handleKeyDown);
                } else {
                  events.move.forEach(function(eventName) {
                    return _this.listenerNode.addEventListener(eventName, _this.handleSortMove, false);
                  });
                  events.end.forEach(function(eventName) {
                    return _this.listenerNode.addEventListener(eventName, _this.handleSortEnd, false);
                  });
                }
                _this.setState({
                  sorting: true,
                  sortingIndex: index2
                });
                if (_onSortStart) {
                  _onSortStart({
                    node: _node,
                    index: index2,
                    collection: _collection,
                    isKeySorting: _isKeySorting,
                    nodes: _this.manager.getOrderedRefs(),
                    helper: _this.helper
                  }, event);
                }
                if (_isKeySorting) {
                  _this.keyMove(0);
                }
              };
              var _this$props3 = _this.props, _axis = _this$props3.axis, _getHelperDimensions = _this$props3.getHelperDimensions, _helperClass = _this$props3.helperClass, _hideSortableGhost = _this$props3.hideSortableGhost, updateBeforeSortStart = _this$props3.updateBeforeSortStart, _onSortStart = _this$props3.onSortStart, _useWindowAsScrollContainer = _this$props3.useWindowAsScrollContainer;
              var _node = active3.node, _collection = active3.collection;
              var _isKeySorting = _this.manager.isKeySorting;
              var _temp8 = function() {
                if (typeof updateBeforeSortStart === "function") {
                  _this._awaitingUpdateBeforeSortStart = true;
                  var _temp9 = _finallyRethrows(function() {
                    var index2 = _node.sortableInfo.index;
                    return Promise.resolve(updateBeforeSortStart({
                      collection: _collection,
                      index: index2,
                      node: _node,
                      isKeySorting: _isKeySorting
                    }, event)).then(function() {
                    });
                  }, function(_wasThrown, _result) {
                    _this._awaitingUpdateBeforeSortStart = false;
                    if (_wasThrown)
                      throw _result;
                    return _result;
                  });
                  if (_temp9 && _temp9.then)
                    return _temp9.then(function() {
                    });
                }
              }();
              return _temp8 && _temp8.then ? _temp8.then(_temp7) : _temp7(_temp8);
            }
          }();
          return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function() {
          }) : void 0);
        } catch (e2) {
          return Promise.reject(e2);
        }
      });
      _defineProperty$3(_assertThisInitialized(_assertThisInitialized(_this)), "handleSortMove", function(event) {
        var onSortMove = _this.props.onSortMove;
        if (typeof event.preventDefault === "function" && event.cancelable) {
          event.preventDefault();
        }
        _this.updateHelperPosition(event);
        _this.animateNodes();
        _this.autoscroll();
        if (onSortMove) {
          onSortMove(event);
        }
      });
      _defineProperty$3(_assertThisInitialized(_assertThisInitialized(_this)), "handleSortEnd", function(event) {
        var _this$props4 = _this.props, hideSortableGhost = _this$props4.hideSortableGhost, onSortEnd = _this$props4.onSortEnd;
        var _this$manager = _this.manager, collection = _this$manager.active.collection, isKeySorting = _this$manager.isKeySorting;
        var nodes = _this.manager.getOrderedRefs();
        if (_this.listenerNode) {
          if (isKeySorting) {
            _this.listenerNode.removeEventListener("wheel", _this.handleKeyEnd, true);
            _this.listenerNode.removeEventListener("mousedown", _this.handleKeyEnd, true);
            _this.listenerNode.removeEventListener("keydown", _this.handleKeyDown);
          } else {
            events.move.forEach(function(eventName) {
              return _this.listenerNode.removeEventListener(eventName, _this.handleSortMove);
            });
            events.end.forEach(function(eventName) {
              return _this.listenerNode.removeEventListener(eventName, _this.handleSortEnd);
            });
          }
        }
        _this.helper.parentNode.removeChild(_this.helper);
        if (hideSortableGhost && _this.sortableGhost) {
          setInlineStyles(_this.sortableGhost, {
            opacity: "",
            visibility: ""
          });
        }
        for (var i2 = 0, len = nodes.length; i2 < len; i2++) {
          var _node2 = nodes[i2];
          var el2 = _node2.node;
          _node2.edgeOffset = null;
          _node2.boundingClientRect = null;
          setTranslate3d(el2, null);
          setTransitionDuration(el2, null);
          _node2.translate = null;
        }
        _this.autoScroller.clear();
        _this.manager.active = null;
        _this.manager.isKeySorting = false;
        _this.setState({
          sorting: false,
          sortingIndex: null
        });
        if (typeof onSortEnd === "function") {
          onSortEnd({
            collection,
            newIndex: _this.newIndex,
            oldIndex: _this.index,
            isKeySorting,
            nodes
          }, event);
        }
        _this.touched = false;
      });
      _defineProperty$3(_assertThisInitialized(_assertThisInitialized(_this)), "autoscroll", function() {
        var disableAutoscroll = _this.props.disableAutoscroll;
        var isKeySorting = _this.manager.isKeySorting;
        if (disableAutoscroll) {
          _this.autoScroller.clear();
          return;
        }
        if (isKeySorting) {
          var translate = _objectSpread({}, _this.translate);
          var scrollX = 0;
          var scrollY = 0;
          if (_this.axis.x) {
            translate.x = Math.min(_this.maxTranslate.x, Math.max(_this.minTranslate.x, _this.translate.x));
            scrollX = _this.translate.x - translate.x;
          }
          if (_this.axis.y) {
            translate.y = Math.min(_this.maxTranslate.y, Math.max(_this.minTranslate.y, _this.translate.y));
            scrollY = _this.translate.y - translate.y;
          }
          _this.translate = translate;
          setTranslate3d(_this.helper, _this.translate);
          _this.scrollContainer.scrollLeft += scrollX;
          _this.scrollContainer.scrollTop += scrollY;
          return;
        }
        _this.autoScroller.update({
          height: _this.height,
          maxTranslate: _this.maxTranslate,
          minTranslate: _this.minTranslate,
          translate: _this.translate,
          width: _this.width
        });
      });
      _defineProperty$3(_assertThisInitialized(_assertThisInitialized(_this)), "onAutoScroll", function(offset2) {
        _this.translate.x += offset2.left;
        _this.translate.y += offset2.top;
        _this.animateNodes();
      });
      _defineProperty$3(_assertThisInitialized(_assertThisInitialized(_this)), "handleKeyDown", function(event) {
        var keyCode = event.keyCode;
        var _this$props5 = _this.props, shouldCancelStart = _this$props5.shouldCancelStart, _this$props5$keyCodes = _this$props5.keyCodes, customKeyCodes = _this$props5$keyCodes === void 0 ? {} : _this$props5$keyCodes;
        var keyCodes = _objectSpread({}, defaultKeyCodes, customKeyCodes);
        if (_this.manager.active && !_this.manager.isKeySorting || !_this.manager.active && (!keyCodes.lift.includes(keyCode) || shouldCancelStart(event) || !_this.isValidSortingTarget(event))) {
          return;
        }
        event.stopPropagation();
        event.preventDefault();
        if (keyCodes.lift.includes(keyCode) && !_this.manager.active) {
          _this.keyLift(event);
        } else if (keyCodes.drop.includes(keyCode) && _this.manager.active) {
          _this.keyDrop(event);
        } else if (keyCodes.cancel.includes(keyCode)) {
          _this.newIndex = _this.manager.active.index;
          _this.keyDrop(event);
        } else if (keyCodes.up.includes(keyCode)) {
          _this.keyMove(-1);
        } else if (keyCodes.down.includes(keyCode)) {
          _this.keyMove(1);
        }
      });
      _defineProperty$3(_assertThisInitialized(_assertThisInitialized(_this)), "keyLift", function(event) {
        var target = event.target;
        var node2 = closest(target, function(el2) {
          return el2.sortableInfo != null;
        });
        var _node$sortableInfo2 = node2.sortableInfo, index2 = _node$sortableInfo2.index, collection = _node$sortableInfo2.collection;
        _this.initialFocusedNode = target;
        _this.manager.isKeySorting = true;
        _this.manager.active = {
          index: index2,
          collection
        };
        _this.handlePress(event);
      });
      _defineProperty$3(_assertThisInitialized(_assertThisInitialized(_this)), "keyMove", function(shift) {
        var nodes = _this.manager.getOrderedRefs();
        var lastIndex = nodes[nodes.length - 1].node.sortableInfo.index;
        var newIndex = _this.newIndex + shift;
        var prevIndex = _this.newIndex;
        if (newIndex < 0 || newIndex > lastIndex) {
          return;
        }
        _this.prevIndex = prevIndex;
        _this.newIndex = newIndex;
        var targetIndex = getTargetIndex(_this.newIndex, _this.prevIndex, _this.index);
        var target = nodes.find(function(_ref2) {
          var node2 = _ref2.node;
          return node2.sortableInfo.index === targetIndex;
        });
        var targetNode = target.node;
        var scrollDelta = _this.containerScrollDelta;
        var targetBoundingClientRect = target.boundingClientRect || getScrollAdjustedBoundingClientRect(targetNode, scrollDelta);
        var targetTranslate = target.translate || {
          x: 0,
          y: 0
        };
        var targetPosition = {
          top: targetBoundingClientRect.top + targetTranslate.y - scrollDelta.top,
          left: targetBoundingClientRect.left + targetTranslate.x - scrollDelta.left
        };
        var shouldAdjustForSize = prevIndex < newIndex;
        var sizeAdjustment = {
          x: shouldAdjustForSize && _this.axis.x ? targetNode.offsetWidth - _this.width : 0,
          y: shouldAdjustForSize && _this.axis.y ? targetNode.offsetHeight - _this.height : 0
        };
        _this.handleSortMove({
          pageX: targetPosition.left + sizeAdjustment.x,
          pageY: targetPosition.top + sizeAdjustment.y,
          ignoreTransition: shift === 0
        });
      });
      _defineProperty$3(_assertThisInitialized(_assertThisInitialized(_this)), "keyDrop", function(event) {
        _this.handleSortEnd(event);
        if (_this.initialFocusedNode) {
          _this.initialFocusedNode.focus();
        }
      });
      _defineProperty$3(_assertThisInitialized(_assertThisInitialized(_this)), "handleKeyEnd", function(event) {
        if (_this.manager.active) {
          _this.keyDrop(event);
        }
      });
      _defineProperty$3(_assertThisInitialized(_assertThisInitialized(_this)), "isValidSortingTarget", function(event) {
        var useDragHandle = _this.props.useDragHandle;
        var target = event.target;
        var node2 = closest(target, function(el2) {
          return el2.sortableInfo != null;
        });
        return node2 && node2.sortableInfo && !node2.sortableInfo.disabled && (useDragHandle ? isSortableHandle(target) : target.sortableInfo);
      });
      var manager = new Manager();
      validateProps(props);
      _this.manager = manager;
      _this.wrappedInstance = reactExports.createRef();
      _this.sortableContextValue = {
        manager
      };
      _this.events = {
        end: _this.handleEnd,
        move: _this.handleMove,
        start: _this.handleStart
      };
      return _this;
    }
    _createClass$8(WithSortableContainer, [{
      key: "componentDidMount",
      value: function componentDidMount() {
        var _this2 = this;
        var useWindowAsScrollContainer = this.props.useWindowAsScrollContainer;
        var container = this.getContainer();
        Promise.resolve(container).then(function(containerNode) {
          _this2.container = containerNode;
          _this2.document = _this2.container.ownerDocument || document;
          var contentWindow = _this2.props.contentWindow || _this2.document.defaultView || window;
          _this2.contentWindow = typeof contentWindow === "function" ? contentWindow() : contentWindow;
          _this2.scrollContainer = useWindowAsScrollContainer ? _this2.document.scrollingElement || _this2.document.documentElement : getScrollingParent(_this2.container) || _this2.container;
          _this2.autoScroller = new AutoScroller(_this2.scrollContainer, _this2.onAutoScroll);
          Object.keys(_this2.events).forEach(function(key) {
            return events[key].forEach(function(eventName) {
              return _this2.container.addEventListener(eventName, _this2.events[key], false);
            });
          });
          _this2.container.addEventListener("keydown", _this2.handleKeyDown);
        });
      }
    }, {
      key: "componentWillUnmount",
      value: function componentWillUnmount() {
        var _this3 = this;
        if (this.helper && this.helper.parentNode) {
          this.helper.parentNode.removeChild(this.helper);
        }
        if (!this.container) {
          return;
        }
        Object.keys(this.events).forEach(function(key) {
          return events[key].forEach(function(eventName) {
            return _this3.container.removeEventListener(eventName, _this3.events[key]);
          });
        });
        this.container.removeEventListener("keydown", this.handleKeyDown);
      }
    }, {
      key: "updateHelperPosition",
      value: function updateHelperPosition(event) {
        var _this$props6 = this.props, lockAxis = _this$props6.lockAxis, lockOffset = _this$props6.lockOffset, lockToContainerEdges = _this$props6.lockToContainerEdges, transitionDuration = _this$props6.transitionDuration, _this$props6$keyboard = _this$props6.keyboardSortingTransitionDuration, keyboardSortingTransitionDuration = _this$props6$keyboard === void 0 ? transitionDuration : _this$props6$keyboard;
        var isKeySorting = this.manager.isKeySorting;
        var ignoreTransition = event.ignoreTransition;
        var offset2 = getPosition(event);
        var translate = {
          x: offset2.x - this.initialOffset.x,
          y: offset2.y - this.initialOffset.y
        };
        translate.y -= window.pageYOffset - this.initialWindowScroll.top;
        translate.x -= window.pageXOffset - this.initialWindowScroll.left;
        this.translate = translate;
        if (lockToContainerEdges) {
          var _getLockPixelOffsets = getLockPixelOffsets({
            height: this.height,
            lockOffset,
            width: this.width
          }), _getLockPixelOffsets2 = _slicedToArray(_getLockPixelOffsets, 2), minLockOffset = _getLockPixelOffsets2[0], maxLockOffset = _getLockPixelOffsets2[1];
          var minOffset = {
            x: this.width / 2 - minLockOffset.x,
            y: this.height / 2 - minLockOffset.y
          };
          var maxOffset = {
            x: this.width / 2 - maxLockOffset.x,
            y: this.height / 2 - maxLockOffset.y
          };
          translate.x = limit(this.minTranslate.x + minOffset.x, this.maxTranslate.x - maxOffset.x, translate.x);
          translate.y = limit(this.minTranslate.y + minOffset.y, this.maxTranslate.y - maxOffset.y, translate.y);
        }
        if (lockAxis === "x") {
          translate.y = 0;
        } else if (lockAxis === "y") {
          translate.x = 0;
        }
        if (isKeySorting && keyboardSortingTransitionDuration && !ignoreTransition) {
          setTransitionDuration(this.helper, keyboardSortingTransitionDuration);
        }
        setTranslate3d(this.helper, translate);
      }
    }, {
      key: "animateNodes",
      value: function animateNodes() {
        var _this$props7 = this.props, transitionDuration = _this$props7.transitionDuration, hideSortableGhost = _this$props7.hideSortableGhost, onSortOver = _this$props7.onSortOver;
        var containerScrollDelta = this.containerScrollDelta, windowScrollDelta = this.windowScrollDelta;
        var nodes = this.manager.getOrderedRefs();
        var sortingOffset = {
          left: this.offsetEdge.left + this.translate.x + containerScrollDelta.left,
          top: this.offsetEdge.top + this.translate.y + containerScrollDelta.top
        };
        var isKeySorting = this.manager.isKeySorting;
        var prevIndex = this.newIndex;
        this.newIndex = null;
        for (var i2 = 0, len = nodes.length; i2 < len; i2++) {
          var _node3 = nodes[i2].node;
          var index2 = _node3.sortableInfo.index;
          var width = _node3.offsetWidth;
          var height = _node3.offsetHeight;
          var offset2 = {
            height: this.height > height ? height / 2 : this.height / 2,
            width: this.width > width ? width / 2 : this.width / 2
          };
          var mustShiftBackward = isKeySorting && index2 > this.index && index2 <= prevIndex;
          var mustShiftForward = isKeySorting && index2 < this.index && index2 >= prevIndex;
          var translate = {
            x: 0,
            y: 0
          };
          var edgeOffset = nodes[i2].edgeOffset;
          if (!edgeOffset) {
            edgeOffset = getEdgeOffset(_node3, this.container);
            nodes[i2].edgeOffset = edgeOffset;
            if (isKeySorting) {
              nodes[i2].boundingClientRect = getScrollAdjustedBoundingClientRect(_node3, containerScrollDelta);
            }
          }
          var nextNode = i2 < nodes.length - 1 && nodes[i2 + 1];
          var prevNode = i2 > 0 && nodes[i2 - 1];
          if (nextNode && !nextNode.edgeOffset) {
            nextNode.edgeOffset = getEdgeOffset(nextNode.node, this.container);
            if (isKeySorting) {
              nextNode.boundingClientRect = getScrollAdjustedBoundingClientRect(nextNode.node, containerScrollDelta);
            }
          }
          if (index2 === this.index) {
            if (hideSortableGhost) {
              this.sortableGhost = _node3;
              setInlineStyles(_node3, {
                opacity: 0,
                visibility: "hidden"
              });
            }
            continue;
          }
          if (transitionDuration) {
            setTransitionDuration(_node3, transitionDuration);
          }
          if (this.axis.x) {
            if (this.axis.y) {
              if (mustShiftForward || index2 < this.index && (sortingOffset.left + windowScrollDelta.left - offset2.width <= edgeOffset.left && sortingOffset.top + windowScrollDelta.top <= edgeOffset.top + offset2.height || sortingOffset.top + windowScrollDelta.top + offset2.height <= edgeOffset.top)) {
                translate.x = this.width + this.marginOffset.x;
                if (edgeOffset.left + translate.x > this.containerBoundingRect.width - offset2.width) {
                  if (nextNode) {
                    translate.x = nextNode.edgeOffset.left - edgeOffset.left;
                    translate.y = nextNode.edgeOffset.top - edgeOffset.top;
                  }
                }
                if (this.newIndex === null) {
                  this.newIndex = index2;
                }
              } else if (mustShiftBackward || index2 > this.index && (sortingOffset.left + windowScrollDelta.left + offset2.width >= edgeOffset.left && sortingOffset.top + windowScrollDelta.top + offset2.height >= edgeOffset.top || sortingOffset.top + windowScrollDelta.top + offset2.height >= edgeOffset.top + height)) {
                translate.x = -(this.width + this.marginOffset.x);
                if (edgeOffset.left + translate.x < this.containerBoundingRect.left + offset2.width) {
                  if (prevNode) {
                    translate.x = prevNode.edgeOffset.left - edgeOffset.left;
                    translate.y = prevNode.edgeOffset.top - edgeOffset.top;
                  }
                }
                this.newIndex = index2;
              }
            } else {
              if (mustShiftBackward || index2 > this.index && sortingOffset.left + windowScrollDelta.left + offset2.width >= edgeOffset.left) {
                translate.x = -(this.width + this.marginOffset.x);
                this.newIndex = index2;
              } else if (mustShiftForward || index2 < this.index && sortingOffset.left + windowScrollDelta.left <= edgeOffset.left + offset2.width) {
                translate.x = this.width + this.marginOffset.x;
                if (this.newIndex == null) {
                  this.newIndex = index2;
                }
              }
            }
          } else if (this.axis.y) {
            if (mustShiftBackward || index2 > this.index && sortingOffset.top + windowScrollDelta.top + offset2.height >= edgeOffset.top) {
              translate.y = -(this.height + this.marginOffset.y);
              this.newIndex = index2;
            } else if (mustShiftForward || index2 < this.index && sortingOffset.top + windowScrollDelta.top <= edgeOffset.top + offset2.height) {
              translate.y = this.height + this.marginOffset.y;
              if (this.newIndex == null) {
                this.newIndex = index2;
              }
            }
          }
          setTranslate3d(_node3, translate);
          nodes[i2].translate = translate;
        }
        if (this.newIndex == null) {
          this.newIndex = this.index;
        }
        if (isKeySorting) {
          this.newIndex = prevIndex;
        }
        var oldIndex = isKeySorting ? this.prevIndex : prevIndex;
        if (onSortOver && this.newIndex !== oldIndex) {
          onSortOver({
            collection: this.manager.active.collection,
            index: this.index,
            newIndex: this.newIndex,
            oldIndex,
            isKeySorting,
            nodes,
            helper: this.helper
          });
        }
      }
    }, {
      key: "getWrappedInstance",
      value: function getWrappedInstance() {
        invariant$1(config2.withRef, "To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableContainer() call");
        return this.wrappedInstance.current;
      }
    }, {
      key: "getContainer",
      value: function getContainer2() {
        var getContainer22 = this.props.getContainer;
        if (typeof getContainer22 !== "function") {
          return reactDomExports.findDOMNode(this);
        }
        return getContainer22(config2.withRef ? this.getWrappedInstance() : void 0);
      }
    }, {
      key: "render",
      value: function render3() {
        var ref = config2.withRef ? this.wrappedInstance : null;
        return reactExports.createElement(SortableContext.Provider, {
          value: this.sortableContextValue
        }, reactExports.createElement(WrappedComponent, _extends$h({
          ref
        }, omit(this.props, omittedProps))));
      }
    }, {
      key: "helperContainer",
      get: function get5() {
        var helperContainer = this.props.helperContainer;
        if (typeof helperContainer === "function") {
          return helperContainer();
        }
        return this.props.helperContainer || this.document.body;
      }
    }, {
      key: "containerScrollDelta",
      get: function get5() {
        var useWindowAsScrollContainer = this.props.useWindowAsScrollContainer;
        if (useWindowAsScrollContainer) {
          return {
            left: 0,
            top: 0
          };
        }
        return {
          left: this.scrollContainer.scrollLeft - this.initialScroll.left,
          top: this.scrollContainer.scrollTop - this.initialScroll.top
        };
      }
    }, {
      key: "windowScrollDelta",
      get: function get5() {
        return {
          left: this.contentWindow.pageXOffset - this.initialWindowScroll.left,
          top: this.contentWindow.pageYOffset - this.initialWindowScroll.top
        };
      }
    }]);
    return WithSortableContainer;
  }(reactExports.Component), _defineProperty$3(_class, "displayName", provideDisplayName("sortableList", WrappedComponent)), _defineProperty$3(_class, "defaultProps", defaultProps), _defineProperty$3(_class, "propTypes", propTypes), _temp;
}
var propTypes$1 = {
  index: PropTypes$4.number.isRequired,
  collection: PropTypes$4.oneOfType([PropTypes$4.number, PropTypes$4.string]),
  disabled: PropTypes$4.bool
};
var omittedProps$1 = Object.keys(propTypes$1);
function sortableElement(WrappedComponent) {
  var _class, _temp;
  var config2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
    withRef: false
  };
  return _temp = _class = function(_React$Component) {
    _inherits$a(WithSortableElement, _React$Component);
    function WithSortableElement() {
      var _getPrototypeOf2;
      var _this;
      _classCallCheck$a(this, WithSortableElement);
      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
      _this = _possibleConstructorReturn$a(this, (_getPrototypeOf2 = _getPrototypeOf(WithSortableElement)).call.apply(_getPrototypeOf2, [this].concat(args)));
      _defineProperty$3(_assertThisInitialized(_assertThisInitialized(_this)), "wrappedInstance", reactExports.createRef());
      return _this;
    }
    _createClass$8(WithSortableElement, [{
      key: "componentDidMount",
      value: function componentDidMount() {
        this.register();
      }
    }, {
      key: "componentDidUpdate",
      value: function componentDidUpdate(prevProps) {
        if (this.node) {
          if (prevProps.index !== this.props.index) {
            this.node.sortableInfo.index = this.props.index;
          }
          if (prevProps.disabled !== this.props.disabled) {
            this.node.sortableInfo.disabled = this.props.disabled;
          }
        }
        if (prevProps.collection !== this.props.collection) {
          this.unregister(prevProps.collection);
          this.register();
        }
      }
    }, {
      key: "componentWillUnmount",
      value: function componentWillUnmount() {
        this.unregister();
      }
    }, {
      key: "register",
      value: function register2() {
        var _this$props = this.props, collection = _this$props.collection, disabled = _this$props.disabled, index2 = _this$props.index;
        var node2 = reactDomExports.findDOMNode(this);
        node2.sortableInfo = {
          collection,
          disabled,
          index: index2,
          manager: this.context.manager
        };
        this.node = node2;
        this.ref = {
          node: node2
        };
        this.context.manager.add(collection, this.ref);
      }
    }, {
      key: "unregister",
      value: function unregister() {
        var collection = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props.collection;
        this.context.manager.remove(collection, this.ref);
      }
    }, {
      key: "getWrappedInstance",
      value: function getWrappedInstance() {
        invariant$1(config2.withRef, "To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableElement() call");
        return this.wrappedInstance.current;
      }
    }, {
      key: "render",
      value: function render3() {
        var ref = config2.withRef ? this.wrappedInstance : null;
        return reactExports.createElement(WrappedComponent, _extends$h({
          ref
        }, omit(this.props, omittedProps$1)));
      }
    }]);
    return WithSortableElement;
  }(reactExports.Component), _defineProperty$3(_class, "displayName", provideDisplayName("sortableElement", WrappedComponent)), _defineProperty$3(_class, "contextType", SortableContext), _defineProperty$3(_class, "propTypes", propTypes$1), _defineProperty$3(_class, "defaultProps", {
    collection: 0
  }), _temp;
}
const ItemTypeIcon = {
  [PlaylistItemType.Resource]: MdVideoLibrary,
  [PlaylistItemType.Video]: MdVideoFile,
  [PlaylistItemType.Image]: MdImage,
  [PlaylistItemType.Audio]: MdAudiotrack
};
const renderDuration = (item) => {
  if (item.type === PlaylistItemType.Audio || item.type === PlaylistItemType.Video) {
    let duration2 = item.startTime ?? "";
    if (item.endTime) {
      duration2 += ` ~ ${item.endTime}`;
    }
    return duration2;
  }
  return "";
};
const SortablePlaylistItem = sortableElement(
  ({ item, resource: resource2, onRemove }) => {
    const { t: t2 } = useTranslation();
    const renderName = reactExports.useCallback(() => {
      switch (item.type) {
        case PlaylistItemType.Resource:
          return /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "sm", variant: "light", children: (resource2 == null ? void 0 : resource2.displayName) ?? t2("Unknown Resource") });
        case PlaylistItemType.Video:
        case PlaylistItemType.Image:
        case PlaylistItemType.Audio:
          return item.file;
      }
    }, [item.file, resource2]);
    const handleOpenFile = reactExports.useCallback(() => {
      if (resource2) {
        BApi$1.tool.openFileOrDirectory({
          path: item.file ?? resource2.path,
          openInDirectory: item.file ? true : resource2.isFile
        });
      }
    }, [item.file, resource2]);
    const handleRemove = reactExports.useCallback(() => {
      onRemove(item);
    }, [item, onRemove]);
    getDisplayFilename();
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(DragHandle, {}),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center text-gray-400", children: React$5.createElement(ItemTypeIcon[item.type], { size: "small" }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          color: "primary",
          disabled: !resource2,
          variant: "light",
          onPress: handleOpenFile,
          children: (resource2 == null ? void 0 : resource2.displayName) || "Unknown Resource"
        }
      ) }),
      renderName(),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center text-sm text-gray-500", children: renderDuration(item) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "danger",
          size: "sm",
          variant: "light",
          onPress: handleRemove,
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-lg" })
        }
      ) })
    ] });
  }
);
const SortablePlaylistItemList = sortableContainer(
  ({ items, resources, onRemove }) => {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-0", children: items.map((item, index2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        SortablePlaylistItem,
        {
          index: index2,
          item,
          resource: resources[item.resourceId],
          onRemove
        },
        index2
      );
    }) });
  }
);
const Detail = ({ id: id2, onChange }) => {
  const { t: t2 } = useTranslation();
  const [playlist, setPlaylist] = reactExports.useState(null);
  const [resourceMap, setResourceMap] = reactExports.useState({});
  const [loading, setLoading] = reactExports.useState(true);
  const [error2, setError] = reactExports.useState(null);
  reactExports.useEffect(() => {
    let isMounted = true;
    const loadPlaylistData = async () => {
      var _a2;
      try {
        setLoading(true);
        setError(null);
        const playlistResponse = await BApi$1.playlist.getPlaylist(id2);
        const pl2 = playlistResponse.data;
        if (!isMounted)
          return;
        if (!pl2) {
          setError("Playlist data is empty");
          return;
        }
        setPlaylist(pl2);
        const resourceIds = (((_a2 = pl2.items) == null ? void 0 : _a2.map((item) => item.resourceId)) ?? []).filter((resourceId) => resourceId != null);
        const distinctResourceIds = [...new Set(resourceIds)];
        if (distinctResourceIds.length > 0) {
          const resourcesResponse = await BApi$1.resource.getResourcesByKeys({
            ids: distinctResourceIds
          });
          if (!isMounted)
            return;
          const resourceMap2 = (resourcesResponse.data || []).reduce((acc, resource2) => {
            acc[resource2.id] = resource2;
            return acc;
          }, {});
          setResourceMap(resourceMap2);
        }
      } catch (err) {
        if (!isMounted)
          return;
        setError(
          err instanceof Error ? err.message : "Failed to load playlist"
        );
      } finally {
        if (isMounted) {
          setLoading(false);
        }
      }
    };
    loadPlaylistData();
    return () => {
      isMounted = false;
    };
  }, [id2]);
  const patchPlaylist = reactExports.useCallback(
    (patches = {}) => {
      if (!playlist)
        return;
      const updatedPlaylist = {
        ...playlist,
        ...patches
      };
      setPlaylist(updatedPlaylist);
      onChange(updatedPlaylist);
    },
    [playlist, onChange]
  );
  const handleRemoveItem = reactExports.useCallback(
    (itemToRemove) => {
      if (!(playlist == null ? void 0 : playlist.items))
        return;
      patchPlaylist({
        items: playlist.items.filter((item) => item !== itemToRemove)
      });
    },
    [playlist == null ? void 0 : playlist.items, patchPlaylist]
  );
  const handleSortEnd = reactExports.useCallback(
    ({ newIndex, oldIndex }) => {
      if (!(playlist == null ? void 0 : playlist.items))
        return;
      const items = [...playlist.items];
      const [movedItem] = items.splice(oldIndex, 1);
      items.splice(newIndex, 0, movedItem);
      patchPlaylist({ items });
    },
    [playlist == null ? void 0 : playlist.items, patchPlaylist]
  );
  const handleNameChange = reactExports.useCallback(
    (name2) => {
      patchPlaylist({ name: name2 });
    },
    [patchPlaylist]
  );
  const handleIntervalChange = reactExports.useCallback(
    (interval) => {
      patchPlaylist({ interval });
    },
    [patchPlaylist]
  );
  if (loading) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center items-center py-5 text-gray-500", children: "Loading playlist..." }) });
  }
  if (error2) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-center items-center py-5 px-4 text-red-600 bg-red-50 rounded border border-red-200", children: [
      "Error: ",
      error2
    ] }) });
  }
  if (!playlist) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center items-center py-5 px-4 text-red-600 bg-red-50 rounded border border-red-200", children: "Playlist not found" }) });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-4 space-y-4", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          fullWidth: false,
          label: t2("Name"),
          size: "sm",
          value: playlist.name || "",
          onValueChange: handleNameChange
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        number_input_default,
        {
          endContent: instance.t("ms"),
          fullWidth: false,
          label: t2("Interval"),
          min: 0,
          size: "sm",
          value: playlist.interval || 0,
          onValueChange: handleIntervalChange
        }
      )
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      SortablePlaylistItemList,
      {
        useDragHandle: true,
        items: (playlist == null ? void 0 : playlist.items) ?? [],
        resources: resourceMap,
        onRemove: handleRemoveItem,
        onSortEnd: handleSortEnd
      }
    ) })
  ] });
};
Detail.displayName = "Detail";
const Collection = ({ addingResourceId }) => {
  const [playlists, setPlaylists] = reactExports.useState([]);
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  reactExports.useEffect(() => {
    loadPlaylists();
  }, []);
  const loadPlaylists = reactExports.useCallback(() => {
    BApi$1.playlist.getAllPlaylists().then((a2) => {
      setPlaylists(a2.data || []);
    });
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full", children: [
    playlists.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-8 text-center", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-default-400 text-lg mb-2", children: t2("No playlists found") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-default-300 text-sm", children: t2("Create your first playlist to get started") })
    ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: playlists.map((pl2, i2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 justify-between hover:bg-default-50 rounded-medium transition-colors", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "primary",
            size: "sm",
            variant: "light",
            onPress: () => {
              const dialog = createPortal(Modal, {
                defaultVisible: true,
                title: t2("Details of {{name}}", {
                  name: pl2.name
                }),
                size: "lg",
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Detail,
                  {
                    id: pl2.id,
                    onChange: (p2) => {
                      Object.assign(pl2, p2);
                      console.log(playlists, pl2, p2);
                      setPlaylists([...playlists]);
                    }
                  }
                ),
                onOk: () => BApi$1.playlist.putPlaylist(pl2.id, pl2).then((a2) => {
                  if (!a2.code) {
                    dialog.destroy();
                    return a2;
                  }
                  throw new Error(a2.message);
                })
              });
            },
            children: [
              pl2.name,
              " (",
              (pl2.items || []).length,
              ")"
            ]
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center", children: [
          addingResourceId && /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Button,
            {
              size: "sm",
              variant: "bordered",
              onPress: () => {
                pl2.items ?? (pl2.items = []);
                pl2.items.push({
                  resourceId: addingResourceId,
                  type: PlaylistItemType.Resource
                });
                BApi$1.playlist.putPlaylist(pl2.id, pl2).then(() => {
                  loadPlaylists();
                });
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-lg" }),
                t2("Add it here")
              ]
            }
          ),
          pl2.items && pl2.items.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "success",
              size: "sm",
              variant: "light",
              onPress: () => {
                BApi$1.playlist.getPlaylistFiles(pl2.id).then((a2) => {
                  if (a2.data) {
                    if (a2.data.length > 0) {
                      const files = [];
                      for (let x2 = 0; x2 < pl2.items.length; x2++) {
                        const item = pl2.items[x2];
                        const currentItemFiles = a2.data[x2];
                        if (currentItemFiles) {
                          for (const file of a2.data[x2]) {
                            files.push({
                              path: file,
                              startTime: item.startTime,
                              endTime: item.endTime
                            });
                          }
                        }
                      }
                      const mpProps = {
                        files,
                        interval: pl2.interval,
                        autoPlay: true,
                        style: {
                          zIndex: 1001
                        }
                      };
                      MediaPlayer.show(mpProps);
                    } else {
                      toast.danger(t2("No playable contents"));
                    }
                  }
                });
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlayCircle, { className: "text-lg" })
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "danger",
              size: "sm",
              variant: "light",
              onPress: () => {
                createPortal(Modal, {
                  defaultVisible: true,
                  title: t2("Sure to delete?"),
                  children: t2(
                    "Are you sure you want to delete this playlist?"
                  ),
                  onOk: () => BApi$1.playlist.deletePlaylist(pl2.id).then((a2) => {
                    if (!a2.code) {
                      loadPlaylists();
                      return a2;
                    }
                    throw new Error(a2.message);
                  })
                });
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-lg" })
            }
          )
        ] })
      ] }) }, pl2.id || i2),
      i2 < playlists.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {})
    ] })) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { className: "mt-1" }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        color: "primary",
        size: "sm",
        variant: "solid",
        onPress: () => {
          let name2;
          createPortal(Modal, {
            defaultVisible: true,
            title: t2("Creating playlist"),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                label: t2("Playlist Name"),
                placeholder: t2("Enter playlist name"),
                onValueChange: (v2) => {
                  name2 = v2;
                }
              }
            ),
            onOk: async () => {
              if (!name2) {
                toast.danger(t2("Name can not be empty"));
                throw new Error("Name can not be empty");
              }
              const a2 = await BApi$1.playlist.addPlaylist({
                name: name2
              });
              if (!a2.code) {
                loadPlaylists();
              }
            }
          });
        },
        children: t2("Create")
      }
    ) })
  ] });
};
Collection.displayName = "Collection";
function BiCarousel(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M4 19h2c0 1.103.897 2 2 2h8c1.103 0 2-.897 2-2h2c1.103 0 2-.897 2-2V7c0-1.103-.897-2-2-2h-2c0-1.103-.897-2-2-2H8c-1.103 0-2 .897-2 2H4c-1.103 0-2 .897-2 2v10c0 1.103.897 2 2 2zM20 7v10h-2V7h2zM8 5h8l.001 14H8V5zM4 7h2v10H4V7z" }, "child": [] }] })(props);
}
function BiCollapseVertical(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M12 7.59 7.05 2.64 5.64 4.05 12 10.41l6.36-6.36-1.41-1.41L12 7.59zM5.64 19.95l1.41 1.41L12 16.41l4.95 4.95 1.41-1.41L12 13.59l-6.36 6.36z" }, "child": [] }] })(props);
}
function BiExpandVertical(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m12 19.24-4.95-4.95-1.41 1.42L12 22.07l6.36-6.36-1.41-1.42L12 19.24zM5.64 8.29l1.41 1.42L12 4.76l4.95 4.95 1.41-1.42L12 1.93 5.64 8.29z" }, "child": [] }] })(props);
}
buildLogger("MiscellaneousOptions");
const MinResourceColCount = 3;
const DefaultResourceColCount = 6;
const MaxResourceColCount = 12;
const MiscellaneousOptions = ({ rearrangeResources }) => {
  var _a2, _b2, _c2;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const uiOptionsStore = useUiOptionsStore();
  const resourceUiOptions = (_a2 = uiOptionsStore.data) == null ? void 0 : _a2.resource;
  const currentColCount = (resourceUiOptions == null ? void 0 : resourceUiOptions.colCount) ?? DefaultResourceColCount;
  const [propertyMap, setPropertyMap] = reactExports.useState({});
  const navigate = useNavigate();
  const loadProperties = async () => {
    const psr = (await BApi$1.property.getPropertiesByPool(PropertyPool.All)).data || [];
    const ps = _$2.mapValues(
      _$2.groupBy(psr, (x2) => x2.pool),
      (v2) => _$2.keyBy(v2, (x2) => x2.id)
    );
    setPropertyMap(ps);
  };
  reactExports.useEffect(() => {
    loadProperties();
  }, []);
  const [visible, setVisible] = reactExports.useState(false);
  const patchOptions = async (options) => {
    await uiOptionsStore.patch({ resource: { ...resourceUiOptions, ...options } });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, size: "sm", variant: "light", onPress: () => setVisible(true), children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSetting, { className: "text-xl" }) }),
    visible && /* @__PURE__ */ jsxRuntimeExports.jsx(
      Modal,
      {
        footer: false,
        size: "lg",
        title: t2("Display options"),
        visible,
        onClose: () => setVisible(false),
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm", children: t2("Column count") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(button_group_default, { children: Array.from(
              { length: MaxResourceColCount - MinResourceColCount + 1 },
              (_24, idx) => idx + MinResourceColCount
            ).map((num) => /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                className: "min-w-0 px-6",
                color: currentColCount === num ? "primary" : "default",
                size: "sm",
                onPress: () => patchOptions({ colCount: num }),
                children: num
              },
              num
            )) }) })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              isSelected: (resourceUiOptions == null ? void 0 : resourceUiOptions.coverFit) === CoverFit.Cover,
              onValueChange: (checked) => patchOptions({ coverFit: checked ? CoverFit.Cover : CoverFit.Contain }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$E, { className: "text-base" }),
                t2("Fill cover")
              ] })
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              isSelected: !!(resourceUiOptions == null ? void 0 : resourceUiOptions.showBiggerCoverWhileHover),
              onValueChange: (checked) => patchOptions({ showBiggerCoverWhileHover: checked }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1c, { className: "text-base" }),
                t2("Show larger cover on mouse hover")
              ] })
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              isSelected: !(resourceUiOptions == null ? void 0 : resourceUiOptions.disableMediaPreviewer),
              onValueChange: (checked) => patchOptions({ disableMediaPreviewer: !checked }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$n, { className: "text-base" }),
                t2("Preview files of a resource on mouse hover")
              ] })
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              isSelected: !!(resourceUiOptions == null ? void 0 : resourceUiOptions.autoSelectFirstPlayableFile),
              onValueChange: (checked) => patchOptions({ autoSelectFirstPlayableFile: checked }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$n, { className: "text-base" }),
                t2("Auto-select first file if multiple playable files exist")
              ] })
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              checkbox_default,
              {
                isSelected: resourceUiOptions == null ? void 0 : resourceUiOptions.inlineDisplayName,
                onValueChange: (checked) => patchOptions({ inlineDisplayName: checked }),
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(ImEmbed, { className: "text-base" }),
                  t2("Inline display name and tags")
                ] })
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-60 text-sm", children: t2(
              "Inline the display name and tags will place them inside the bottom area of the resource cover, rather than below the cover."
            ) })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              checkbox_default,
              {
                isSelected: !(resourceUiOptions == null ? void 0 : resourceUiOptions.disableCache),
                onValueChange: (checked) => patchOptions({ disableCache: !checked }),
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Y, { className: "text-base" }),
                  t2("Use cache")
                ] })
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "opacity-60 text-sm", children: t2(
                "Enabling cache can improve loading speed, but your covers and playable files will not be updated in time unless you clear or disable cache manually."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: "primary",
                  size: "sm",
                  variant: "light",
                  onClick: () => {
                    navigate("/cache");
                  },
                  children: t2("Manage cache")
                }
              )
            ] })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              isSelected: !(resourceUiOptions == null ? void 0 : resourceUiOptions.disableCoverCarousel),
              onValueChange: (checked) => patchOptions({ disableCoverCarousel: !checked }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(BiCarousel, { className: "text-base" }),
                t2("Cover carousel")
              ] })
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              isSelected: !!(resourceUiOptions == null ? void 0 : resourceUiOptions.displayResourceId),
              onValueChange: (checked) => patchOptions({ displayResourceId: checked }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFieldNumber, { className: "text-base" }),
                t2("Display resource ID")
              ] })
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$17, { className: "text-base" }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm", children: t2("Display properties") }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-sm text-default-500", children: [
                t2("Selected"),
                ": ",
                ((_b2 = resourceUiOptions == null ? void 0 : resourceUiOptions.displayProperties) == null ? void 0 : _b2.length) ?? 0
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  size: "sm",
                  variant: "flat",
                  onPress: () => {
                    const selection = ((resourceUiOptions == null ? void 0 : resourceUiOptions.displayProperties) ?? []).map((k2) => ({
                      id: k2.id,
                      pool: k2.pool
                    }));
                    createPortal(PropertySelector, {
                      selection,
                      multiple: true,
                      pool: PropertyPool.All,
                      onSubmit: async (selected) => {
                        patchOptions({
                          displayProperties: selected.map((p2) => ({ id: p2.id, pool: p2.pool }))
                        });
                      }
                    });
                  },
                  children: t2("Select properties")
                }
              )
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center flex-wrap gap-1", children: (_c2 = resourceUiOptions == null ? void 0 : resourceUiOptions.displayProperties) == null ? void 0 : _c2.map((p2) => {
              var _a3;
              const property2 = (_a3 = propertyMap[p2.pool]) == null ? void 0 : _a3[p2.id];
              if (!property2) {
                return null;
              }
              return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                property2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { property: property2, showPool: true }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { children: t2("Unknown property") }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    isIconOnly: true,
                    color: "danger",
                    size: "sm",
                    variant: "light",
                    onPress: () => {
                      var _a4;
                      patchOptions({
                        displayProperties: (_a4 = resourceUiOptions == null ? void 0 : resourceUiOptions.displayProperties) == null ? void 0 : _a4.filter(
                          (pp) => pp.id !== p2.id && pp.pool !== p2.pool
                        )
                      });
                    },
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1j, {})
                  }
                )
              ] }, `${p2.pool}-${p2.id}`);
            }) })
          ] })
        ] })
      }
    )
  ] });
};
MiscellaneousOptions.displayName = "MiscellaneousOptions";
function ResourceKeywordAutocomplete({
  value: value2,
  onValueChange,
  onSelectionChange,
  maxResults = 10,
  debounceDelay = 300,
  ...autocompleteProps
}) {
  const [isLoading, setIsLoading] = reactExports.useState(false);
  const [candidates, setCandidates] = reactExports.useState([]);
  const valueRef = reactExports.useRef(value2);
  const searchKeywords = reactExports.useCallback(
    (prefix) => {
      setIsLoading(true);
      if (prefix && prefix.length > 0) {
        BApi$1.resource.getResourceSearchKeywordRecommendation({
          keyword: prefix,
          maxCount: maxResults
        }).then((ret) => {
          setCandidates(ret.data ?? []);
        }).finally(() => setIsLoading(false));
      } else {
        setCandidates([]);
        setIsLoading(false);
      }
    },
    [maxResults]
  );
  useDebounce(
    () => {
      if (valueRef.current !== value2) {
        searchKeywords(value2 ?? "");
      }
    },
    debounceDelay,
    [value2]
  );
  useUpdateEffect(() => {
    valueRef.current = value2;
  }, [value2]);
  const handleSelectionChange = (key) => {
    if (key) {
      const selected = key;
      onValueChange == null ? void 0 : onValueChange(selected);
      onSelectionChange == null ? void 0 : onSelectionChange(selected);
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    autocomplete_default,
    {
      "aria-label": "Resource Keyword",
      ...autocompleteProps,
      allowsCustomValue: true,
      inputValue: value2 ?? "",
      isLoading,
      items: candidates.map((k2) => ({ label: k2, value: k2 })),
      onInputChange: (inputValue) => {
        onValueChange == null ? void 0 : onValueChange(inputValue);
      },
      onOpenChange: (isOpen) => {
        if (isOpen && candidates.length === 0) {
          searchKeywords(value2 ?? "");
        }
      },
      onSelectionChange: handleSelectionChange,
      children: (item) => /* @__PURE__ */ jsxRuntimeExports.jsx(listbox_item_base_default, { title: item.label, children: item.label }, item.value)
    }
  );
}
const DefaultMaxResourceColCount = 10;
const defaultSearchForm = () => ({
  page: 1,
  pageSize: 0
});
const log$t = buildLogger("FilterPanel");
const FilterPanel = (props) => {
  const {
    maxResourceColCount = DefaultMaxResourceColCount,
    selectedResourceIds,
    onSearch,
    searchForm: propsSearchForm,
    multiSelection = false,
    rearrangeResources,
    onSelectAllChange,
    resourceCount,
    totalFilteredResourceCount
  } = props;
  useTraceUpdate(props, "FilterPanel");
  const isFirstRender = reactExports.useRef(true);
  reactExports.useEffect(() => {
    if (isFirstRender.current) {
      log$t("🔵 first time render");
      isFirstRender.current = false;
    } else {
      log$t("🟡 update render");
    }
  });
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [selectedAll, setSelectedAll] = reactExports.useState(false);
  const [searchForm, setSearchForm] = reactExports.useState(propsSearchForm || defaultSearchForm());
  const [searching, setSearching] = reactExports.useState(false);
  const [selectingAllFilteredResources, setSelectingAllFilteredResources] = reactExports.useState(false);
  useUpdateEffect(() => {
    setSearchForm(propsSearchForm || defaultSearchForm());
  }, [propsSearchForm]);
  useUpdateEffect(() => {
    console.log("Search form changed", searchForm);
  }, [searchForm]);
  const search2 = async (patches, newTab = false) => {
    if (onSearch) {
      setSearching(true);
      try {
        await onSearch(patches, newTab);
      } catch (e2) {
        console.error(e2);
      } finally {
        setSearching(false);
      }
    }
  };
  console.log("resource page filter panel rerender", searchForm);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${styles$5.filterPanel} flex flex-col gap-2`, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-4", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        ResourceKeywordAutocomplete,
        {
          isClearable: true,
          className: "w-1/4 min-w-[200px]",
          placeholder: t2("Search everything"),
          startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1h, { className: "text-xl" }),
          value: searchForm.keyword,
          onKeyDown: (e2) => {
            if (e2.key == "Enter") {
              search2({
                ...searchForm,
                page: 1
              });
            }
          },
          onValueChange: (v2) => {
            setSearchForm({
              ...searchForm,
              keyword: v2
            });
          }
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        FilterPortal,
        {
          searchForm,
          onChange: () => {
            setSearchForm({
              ...searchForm
            });
          }
        }
      ),
      " "
    ] }),
    searchForm.group && (searchForm.group.filters && searchForm.group.filters.length > 0 || searchForm.group.groups && searchForm.group.groups.length > 0) && /* @__PURE__ */ jsxRuntimeExports.jsx(
      FilterGroupsPanel,
      {
        group: searchForm.group,
        onChange: (v2) => {
          setSearchForm({
            ...searchForm,
            group: v2
          });
        }
      }
    ),
    searchForm.tags && searchForm.tags.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1 mb-2", children: searchForm.tags.map((tag, i2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Chip,
        {
          isCloseable: true,
          size: "sm",
          onClose: () => {
            var _a2;
            setSearchForm({
              ...searchForm,
              tags: (_a2 = searchForm.tags) == null ? void 0 : _a2.filter((t22) => t22 != tag)
            });
          },
          children: t2(`ResourceTag.${ResourceTag[tag]}`)
        },
        i2
      );
    }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "primary",
            isLoading: searching,
            size: "sm",
            onPress: async () => {
              await search2({
                ...searchForm,
                page: 1
              });
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSearch, { className: "text-base" }),
              t2("Search")
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            isLoading: searching,
            size: "sm",
            onPress: async () => {
              await search2(
                {
                  ...searchForm,
                  page: 1
                },
                true
              );
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineExport, { className: "text-base" }),
              t2("View in new tab")
            ]
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        multiSelection && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$c, { className: "text-base" }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(PopoverComponent, { color: "success", trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" }), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Hold down Ctrl to select multiple resources.") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("You can perform more actions by right-clicking on the resource.") })
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Tooltip$1,
          {
            content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              t2("Resources loaded in current page"),
              selectingAllFilteredResources ? /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" }) : totalFilteredResourceCount != resourceCount && /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: "primary",
                  size: "sm",
                  variant: "light",
                  onPress: async () => {
                    setSelectedAll(true);
                    setSelectingAllFilteredResources(true);
                    try {
                      const ret = onSelectAllChange(true, true);
                      if (!!ret && typeof ret.then === "function") {
                        await ret;
                      }
                    } finally {
                      setSelectingAllFilteredResources(false);
                    }
                  },
                  children: t2(
                    "Select all {{count}} filtered resources (including those not currently loaded).",
                    { count: totalFilteredResourceCount }
                  )
                }
              )
            ] }),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              checkbox_default,
              {
                isSelected: selectedAll && selectedResourceIds && (selectedResourceIds == null ? void 0 : selectedResourceIds.length) > 0,
                size: "sm",
                onValueChange: (isSelected) => {
                  onSelectAllChange(isSelected);
                  setSelectedAll(isSelected);
                },
                children: selectedAll ? t2("{{count}} items selected", {
                  count: selectedResourceIds == null ? void 0 : selectedResourceIds.length
                }) : t2("Select all")
              }
            )
          }
        ),
        totalFilteredResourceCount && totalFilteredResourceCount > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Loaded resources"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "light", children: resourceCount }) }),
          "/",
          /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("All filtered resources"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "secondary", size: "sm", variant: "light", children: totalFilteredResourceCount }) })
        ] }) : null,
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          OrderSelector,
          {
            className: "mr-2",
            value: searchForm.orders,
            onChange: (orders2) => {
              const nf2 = {
                ...searchForm,
                orders: orders2
              };
              setSearchForm(nf2);
              search2(nf2);
            }
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          PopoverComponent,
          {
            className: "min-w-[160px]",
            trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "default",
                size: "sm",
                startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(MdPlaylistPlay, { className: "text-xl" }),
                children: t2("Playlist")
              }
            ),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(Collection, {})
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(MiscellaneousOptions, { rearrangeResources })
      ] })
    ] })
  ] });
};
FilterPanel.displayName = "FilterPanel";
const resource = "_resource_11wzk_1";
const coverRectangle = "_coverRectangle_11wzk_1";
const absoluteRectangle = "_absoluteRectangle_11wzk_9";
const play = "_play_11wzk_16";
const info = "_info_11wzk_67";
const limitedContent = "_limitedContent_11wzk_74";
const styles$2 = {
  resource,
  coverRectangle,
  absoluteRectangle,
  play,
  info,
  limitedContent
};
function TiChevronRightOutline(props) {
  return GenIcon({ "attr": { "version": "1.2", "baseProfile": "tiny", "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M10 20c-.802 0-1.555-.312-2.122-.879-.566-.566-.878-1.32-.878-2.121s.312-1.555.879-2.122l2.878-2.878-2.878-2.879c-.567-.566-.879-1.32-.879-2.121s.312-1.555.879-2.122c1.133-1.132 3.109-1.133 4.243.001l7.121 7.121-7.122 7.121c-.566.567-1.319.879-2.121.879zm0-14c-.268 0-.518.104-.707.292-.189.19-.293.441-.293.708s.104.518.293.707l4.292 4.293-4.292 4.293c-.189.189-.293.439-.293.707s.104.518.293.707c.378.379 1.037.378 1.414.001l5.708-5.708-5.708-5.707c-.189-.189-.439-.293-.707-.293z" }, "child": [] }] })(props);
}
function TiFlowChildren(props) {
  return GenIcon({ "attr": { "version": "1.2", "baseProfile": "tiny", "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M17 16c-1.305 0-2.403.837-2.816 2h-3.184c-1.654 0-3-1.346-3-3v-3.025c.838.634 1.87 1.025 3 1.025h3.184c.413 1.163 1.512 2 2.816 2 1.657 0 3-1.343 3-3s-1.343-3-3-3c-1.305 0-2.403.837-2.816 2h-3.184c-1.654 0-3-1.346-3-3v-.184c1.163-.413 2-1.512 2-2.816 0-1.657-1.343-3-3-3s-3 1.343-3 3c0 1.304.837 2.403 2 2.816v7.184c0 2.757 2.243 5 5 5h3.184c.413 1.163 1.512 2 2.816 2 1.657 0 3-1.343 3-3s-1.343-3-3-3zm0-5c.552 0 1 .449 1 1s-.448 1-1 1-1-.449-1-1 .448-1 1-1zm-10-7c.552 0 1 .449 1 1s-.448 1-1 1-1-.449-1-1 .448-1 1-1zm10 16c-.552 0-1-.449-1-1s.448-1 1-1 1 .449 1 1-.448 1-1 1z" }, "child": [] }] })(props);
}
const log$s = buildLogger("ChildrenModal");
const ChildrenModal = ({
  resourceId,
  onDestroyed
}) => {
  const { t: t2 } = useTranslation();
  const [children, setChildren] = reactExports.useState([]);
  const [loading, setLoading] = reactExports.useState(false);
  const [error2, setError] = reactExports.useState(null);
  const searchChildren = async () => {
    var _a2;
    if (!resourceId)
      return;
    setLoading(true);
    setError(null);
    try {
      const searchForm = {
        group: {
          combinator: SearchCombinator.And,
          disabled: false,
          filters: [
            {
              propertyPool: PropertyPool.Internal,
              propertyId: InternalProperty.ParentResource,
              // ParentResource 属性ID
              operation: SearchOperation.Equals,
              dbValue: resourceId.toString(),
              disabled: false
            }
          ]
        },
        page: 1,
        pageSize: 1e3
        // 获取更多子资源
      };
      const response = await BApi$1.resource.searchResources(searchForm, {
        saveSearch: false
      });
      setChildren(response.data || []);
      log$s("Found children:", ((_a2 = response.data) == null ? void 0 : _a2.length) || 0);
    } catch (err) {
      console.error("Failed to search children:", err);
      setError(t2("Failed to load children"));
    } finally {
      setLoading(false);
    }
  };
  reactExports.useEffect(() => {
    if (resourceId) {
      searchChildren();
    }
  }, [resourceId]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: false,
      size: "xl",
      title: t2("Resource Children"),
      onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4", children: loading ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-center items-center h-32", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "lg" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2", children: t2("Loading children...") })
      ] }) : error2 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center text-red-500 p-4", children: error2 }) : children.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center text-gray-500 p-4", children: t2("No children found") }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Found {{count}} children", {
          count: children.length
        }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-6 gap-4", children: children.map((child) => /* @__PURE__ */ jsxRuntimeExports.jsx(
          ResourceMemo,
          {
            mode: "default",
            resource: child,
            selected: false,
            selectedResourceIds: [],
            onSelected: () => {
            },
            onSelectedResourcesChanged: () => {
            }
          },
          child.id
        )) })
      ] }) })
    }
  );
};
const dateTimes = [
  {
    key: "fileCreateDt",
    label: "File Add Date"
  },
  {
    key: "fileModifyDt",
    label: "File Modify Date"
  },
  {
    key: "createDt",
    label: "Resource Create Date"
  },
  {
    key: "updateDt",
    label: "Resource Update Date"
  }
];
const BasicInfo = ({ resource: resource2 }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "div",
    {
      className: "grid justify-evenly gap-y-1",
      style: { gridTemplateColumns: "repeat(2, auto)" },
      children: dateTimes.map((dateTime, i2) => {
        const label = t2(dateTime.label);
        const value2 = dayjs(resource2[dateTime.key]).format(
          "YYYY-MM-DD HH:mm:ss"
        );
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs opacity-60", children: label }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: value2 })
        ] }, i2);
      })
    }
  );
};
BasicInfo.displayName = "BasicInfo";
const BriefProperty = ({ property: property2, fields }) => {
  const { t: t2 } = useTranslation();
  fields ?? (fields = ["pool", "type", "name"]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: property2 ? fields.map((f2) => {
    switch (f2) {
      case "pool":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyPoolIcon, { pool: property2.pool });
      case "type":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyTypeIcon, { type: property2.type });
      case "name":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: property2.name });
    }
  }) : t2("Unknown property") });
};
BriefProperty.displayName = "BriefProperty";
const log$r = buildLogger("PropertyContainer");
const PropertyContainer = (props) => {
  useUpdate();
  log$r(props);
  const {
    valueScopePriority,
    onValueScopePriorityChange,
    values,
    property: property2,
    onValueChange,
    hidePropertyName = false,
    classNames: classNames2,
    isLinked: propsIsLinked,
    categoryId
  } = props;
  const { t: t2 } = useTranslation();
  const [isLinked, setIsLinked] = React$5.useState(propsIsLinked);
  propertyValueScopes.map((s2) => {
    return {
      key: s2.value,
      scope: s2.value,
      value: values == null ? void 0 : values.find((x2) => x2.scope == s2.value)
    };
  });
  let bizValue;
  let dbValue;
  let scope;
  for (const s2 of valueScopePriority) {
    const value2 = values == null ? void 0 : values.find((v2) => v2.scope == s2);
    if (value2) {
      const dv = value2.aliasAppliedBizValue ?? value2.bizValue;
      if (dv) {
        bizValue = dv;
        dbValue = value2.value;
        scope = s2;
        break;
      }
    }
  }
  scope ?? (scope = valueScopePriority[0]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    !hidePropertyName && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `flex ${classNames2 == null ? void 0 : classNames2.name}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { fields: ["pool", "name"], property: property2 }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `flex items-center gap-2 break-all ${classNames2 == null ? void 0 : classNames2.value}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      PropertyValueRenderer,
      {
        bizValue: serializeStandardValue(bizValue, property2.bizValueType),
        dbValue: serializeStandardValue(dbValue, property2.dbValueType),
        property: property2,
        variant: "default",
        onValueChange
      }
    ) })
  ] });
};
PropertyContainer.displayName = "PropertyContainer";
const log$q = buildLogger("Properties");
const Properties = (props) => {
  const {
    resource: resource2,
    className,
    reload,
    restrictedPropertyPool,
    restrictedPropertyIds,
    propertyInnerDirection = "hoz",
    hidePropertyName = false,
    propertyClassNames,
    noPropertyContent,
    sortable = false
  } = props;
  const { t: t2 } = useTranslation();
  const forceUpdate = useUpdate();
  const cps = resource2.properties;
  const resourceOptions = useResourceOptionsStore((state) => state.data);
  const [valueScopePriority, setValueScopePriority] = reactExports.useState([]);
  const [builtinPropertyMap, setBuiltinPropertyMap] = reactExports.useState({});
  const [customPropertyMap, setCustomPropertyMap] = reactExports.useState({});
  const [showInvisibleProperties, setShowInvisibleProperties] = reactExports.useState(false);
  reactExports.useEffect(() => {
    const c2 = resourceOptions.propertyValueScopePriority;
    const vsp = c2 && c2.length > 0 ? c2.slice() : propertyValueScopes.map((s2) => s2.value);
    for (const scope of propertyValueScopes) {
      if (!vsp.includes(scope.value)) {
        if (scope.value == PropertyValueScope.Manual) {
          vsp.splice(0, 0, scope.value);
        } else {
          vsp.push(scope.value);
        }
      }
    }
    setValueScopePriority(vsp);
  }, [resourceOptions.propertyValueScopePriority]);
  reactExports.useEffect(() => {
    var _a2;
    BApi$1.property.getPropertiesByPool(PropertyPool.Reserved | PropertyPool.Internal).then((r2) => {
      const ps = r2.data || [];
      setBuiltinPropertyMap(
        ps.reduce((s2, t22) => {
          s2[t22.id] = t22;
          return s2;
        }, {})
      );
    });
    if (restrictedPropertyPool == void 0 || restrictedPropertyPool == PropertyPool.Custom) {
      const customPropertyMap2 = ((_a2 = resource2.properties) == null ? void 0 : _a2[PropertyPool.Custom]) || {};
      const customPropertyIds = Object.keys(customPropertyMap2).map(
        (x2) => parseInt(x2, 10)
      );
      if (customPropertyIds.length > 0) {
        BApi$1.customProperty.getCustomPropertyByKeys({ ids: customPropertyIds }).then((r2) => {
          const ps = r2.data || [];
          setCustomPropertyMap(
            ps.reduce((s2, t22) => {
              s2[t22.id] = t22;
              return s2;
            }, {})
          );
        });
      }
    }
  }, []);
  if (!cps || Object.keys(cps).length == 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-60", children: t2(
      "There is no property bound yet, you can bind properties to media library template or category(deprecated) first."
    ) });
  }
  const onValueChange = async (propertyId, isCustomProperty, value2) => {
    await BApi$1.resource.putResourcePropertyValue(resource2.id, {
      value: value2,
      isCustomProperty,
      propertyId
    });
    reload();
  };
  log$q(props, "reserved property map", builtinPropertyMap);
  const buildRenderContext = () => {
    const renderContext2 = [];
    Object.keys(resource2.properties ?? {}).forEach((propertyPoolStr) => {
      var _a2;
      const pp = parseInt(propertyPoolStr, 10);
      if (restrictedPropertyPool != void 0 && restrictedPropertyPool != pp) {
        return;
      }
      const propertyMap = ((_a2 = resource2.properties) == null ? void 0 : _a2[pp]) ?? {};
      Object.keys(propertyMap).forEach((idStr) => {
        const pId = parseInt(idStr, 10);
        if (restrictedPropertyIds != void 0 && !restrictedPropertyIds.includes(pId)) {
          return;
        }
        const sp = propertyMap[pId];
        let property2;
        switch (pp) {
          case PropertyPool.Internal:
            break;
          case PropertyPool.Reserved:
            property2 = builtinPropertyMap[pId];
            break;
          case PropertyPool.Custom: {
            const p2 = customPropertyMap == null ? void 0 : customPropertyMap[pId];
            property2 = p2;
            break;
          }
        }
        if (property2) {
          renderContext2.push({
            property: property2,
            propertyPool: pp,
            propertyValues: sp,
            visible: sp.visible ?? false,
            order: sp.order
          });
        }
      });
    });
    return renderContext2.sort((a2, b2) => a2.order - b2.order);
  };
  const renderProperty = (pCtx) => {
    const { property: property2, propertyValues, propertyPool } = pCtx;
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      PropertyContainer,
      {
        categoryId: resource2.categoryId,
        classNames: propertyClassNames,
        hidePropertyName,
        isLinked: pCtx.visible,
        property: property2,
        valueScopePriority,
        values: propertyValues.values,
        onValueChange: (sdv, sbv) => {
          var _a2;
          const dv = deserializeStandardValue(
            sdv ?? null,
            property2.dbValueType
          );
          const bv = deserializeStandardValue(
            sbv ?? null,
            property2.bizValueType
          );
          log$q(
            "OnValueChange",
            "dv",
            dv,
            "bv",
            bv,
            "sdv",
            sdv,
            "sbv",
            sbv,
            property2
          );
          let manualValue = (_a2 = propertyValues.values) == null ? void 0 : _a2.find(
            (v2) => v2.scope == PropertyValueScope.Manual
          );
          if (!manualValue) {
            manualValue = {
              scope: PropertyValueScope.Manual
            };
            (propertyValues.values ?? (propertyValues.values = [])).push(manualValue);
          }
          manualValue.bizValue = bv;
          manualValue.aliasAppliedBizValue = bv;
          manualValue.value = dv;
          forceUpdate();
          onValueChange(
            property2.id,
            property2.pool == PropertyPool.Custom,
            sdv
          );
        },
        onValueScopePriorityChange: reload
      },
      `${propertyPool}-${property2.id}`
    );
  };
  const renderContext = buildRenderContext();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
    propertyInnerDirection == "hoz" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        className: `grid gap-x-4 gap-y-1 ${className} items-center overflow-visible`,
        style: { gridTemplateColumns: "max(120px) minmax(0, 1fr)" },
        children: renderContext.filter((x2) => showInvisibleProperties || x2.visible).map((pCtx) => {
          return renderProperty(pCtx);
        })
      }
    ) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-4", children: renderContext.filter((x2) => showInvisibleProperties || x2.visible).map((pCtx) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2", children: renderProperty(pCtx) });
    }) }),
    renderContext.length == 0 ? noPropertyContent : null,
    !showInvisibleProperties && renderContext.some((r2) => !r2.visible) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center my-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        color: "primary",
        size: "sm",
        variant: "light",
        onClick: () => {
          setShowInvisibleProperties(true);
        },
        children: t2(
          "Show properties not bound to media library templates or categories(deprecated)"
        )
      }
    ) })
  ] });
};
Properties.displayName = "Properties";
const MediaPreviewer = (props) => {
  const { t: t2 } = useTranslation();
  const { resourceId } = props;
  const [items, setItems] = reactExports.useState([]);
  const itemsRef = reactExports.useRef(items);
  const [status, setStatus] = reactExports.useState(
    0
    /* Initializing */
  );
  const statusRef = reactExports.useRef(status);
  const [mouseOffsetX, setMouseOffsetX] = reactExports.useState();
  const mouseOffsetXRef = reactExports.useRef(mouseOffsetX);
  const [currentFrame, setCurrentFrame] = reactExports.useState(-1);
  const currentFrameRef = reactExports.useRef(currentFrame);
  const [currentItem, setCurrentItem] = reactExports.useState();
  const currentItemRef = reactExports.useRef(currentItem);
  const autoPlayTimeoutRef = reactExports.useRef();
  const mediaRef = reactExports.useRef(null);
  const reactPlayerRef = reactExports.useRef(null);
  const videoInitializedRef = reactExports.useRef(false);
  const isControlled = reactExports.useCallback(
    () => mouseOffsetXRef.current != void 0,
    []
  );
  const setPlayerRef = reactExports.useCallback((player) => {
    if (!player)
      return;
    reactPlayerRef.current = player;
    console.log(player);
  }, []);
  useUpdateEffect(() => {
    statusRef.current = status;
    switch (status) {
      case 0:
        break;
      case 1:
        break;
      case 2:
        resume();
        break;
      case 3:
        pauseAutomatically();
        break;
    }
  }, [status]);
  useUpdateEffect(() => {
    var _a2;
    mouseOffsetXRef.current = mouseOffsetX;
    if (mouseOffsetX != void 0) {
      const percent2 = ((_a2 = progressBarRef.current) == null ? void 0 : _a2.clientWidth) ? mouseOffsetX * 100 / progressBarRef.current.clientWidth : 0;
      const totalFrameCount2 = items.reduce(
        (prev2, curr) => prev2 + curr.duration,
        0
      );
      const cf2 = Math.ceil(totalFrameCount2 * percent2 / 100);
      if (cf2 != currentFrameRef.current) {
        setCurrentFrame(cf2);
      }
    }
  }, [mouseOffsetX]);
  reactExports.useEffect(() => {
    BApi$1.resource.getResourceDataForPreviewer(resourceId, {
      showErrorToast: (r2) => (r2.code >= 404 || r2.code < 200) && r2.code != 404
    }).then((rsp) => {
      var _a2;
      if (rsp.data && ((_a2 = rsp.data) == null ? void 0 : _a2.length) > 0) {
        const newItems = [];
        let prevFrame = 0;
        for (const d2 of rsp.data) {
          const item = {
            duration: d2.duration,
            filePath: d2.filePath,
            type: d2.type,
            startFrame: prevFrame,
            endFrame: prevFrame + d2.duration - 1
          };
          newItems.push(item);
          prevFrame = item.endFrame + 1;
        }
        setItems(newItems);
        setStatus(
          2
          /* Playing */
        );
        setCurrentFrame(0);
      } else {
        setStatus(
          4
          /* NothingToPreview */
        );
      }
    });
  }, []);
  reactExports.useEffect(() => {
    itemsRef.current = items;
  }, [items]);
  reactExports.useEffect(() => {
    currentFrameRef.current = currentFrame;
    const item = itemsRef.current.find(
      (item2) => item2.startFrame <= currentFrame && item2.endFrame >= currentFrame
    );
    if (item) {
      if (mouseOffsetXRef.current != void 0) {
        if (item == currentItemRef.current) {
          if (reactPlayerRef.current) {
            console.log("seeking video", reactPlayerRef.current);
            reactPlayerRef.current.currentTime = currentFrame - item.startFrame;
          }
        } else {
          setCurrentItem(item);
        }
      } else {
        if (item.startFrame == currentFrame) {
          setStatus(
            2
            /* Playing */
          );
          setCurrentItem(item);
        }
      }
    }
  }, [currentFrame]);
  useUpdateEffect(() => {
    videoInitializedRef.current = false;
    currentItemRef.current = currentItem;
  }, [currentItem]);
  const progressBarRef = reactExports.useRef(null);
  const totalFrameCount = items.reduce((prev2, curr) => prev2 + curr.duration, 0);
  let percentProgress = mouseOffsetX != void 0 ? progressBarRef.current ? mouseOffsetX * 100 / progressBarRef.current.clientWidth : 0 : totalFrameCount == 0 ? 0 : (currentFrame + 1) * 100 / totalFrameCount;
  const renderMedia = () => {
    var _a2, _b2;
    if (currentItem) {
      switch (currentItem.type) {
        case MediaType.Image:
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            "img",
            {
              src: `${envConfig.apiEndpoint}/file/play?fullname=${encodeURIComponent(currentItem.filePath)}`,
              onLoad: () => {
                clearTimeout(autoPlayTimeoutRef.current);
                if (currentFrame < totalFrameCount && statusRef.current == 2) {
                  autoPlayTimeoutRef.current = setTimeout(() => {
                    setCurrentFrame(currentFrame + 1);
                  }, 1e3);
                }
              }
            }
          );
        case MediaType.Video: {
          const playing = status == 2 && !isControlled();
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            src_default,
            {
              ref: setPlayerRef,
              muted: true,
              controls: false,
              height: (_a2 = mediaRef.current) == null ? void 0 : _a2.clientHeight,
              playing,
              src: `${envConfig.apiEndpoint}/file/play?fullname=${encodeURIComponent(currentItem.filePath)}`,
              width: (_b2 = mediaRef.current) == null ? void 0 : _b2.clientWidth,
              onCanPlay: () => {
                if (!videoInitializedRef.current && reactPlayerRef.current) {
                  if (isControlled()) {
                    const seekTo = currentFrame - currentItem.startFrame;
                    if (seekTo > 0) {
                      reactPlayerRef.current.currentTime = seekTo;
                    }
                  }
                  videoInitializedRef.current = true;
                }
              },
              onEnded: () => {
                if (!isControlled()) {
                  const nextItem = items.find(
                    (item) => item.startFrame > currentItem.startFrame
                  );
                  if (nextItem) {
                    setCurrentFrame(nextItem.startFrame);
                  } else {
                    setCurrentFrame(currentItem.endFrame);
                  }
                }
              },
              onLoadedMetadata: () => {
              },
              onTimeUpdate: () => {
                if (!isControlled() && reactPlayerRef.current) {
                  const frame2 = Math.ceil(reactPlayerRef.current.currentTime);
                  const nextFrame = frame2 + currentItem.startFrame - 1;
                  if (nextFrame != currentFrame) {
                    setCurrentFrame(nextFrame);
                  }
                }
              }
            }
          );
        }
        case MediaType.Audio:
        case MediaType.Text:
        case MediaType.Unknown:
        default:
          return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Unsupported") });
      }
    }
    return;
  };
  const pauseAutomatically = reactExports.useCallback(() => {
    clearTimeout(autoPlayTimeoutRef.current);
    autoPlayTimeoutRef.current = void 0;
  }, []);
  const resume = reactExports.useCallback(() => {
    var _a2;
    if (!autoPlayTimeoutRef.current) {
      if (((_a2 = currentItemRef.current) == null ? void 0 : _a2.type) == MediaType.Image) {
        autoPlayTimeoutRef.current = setTimeout(() => {
          const totalFrameCount2 = itemsRef.current.reduce(
            (prev2, curr) => prev2 + curr.duration,
            0
          );
          if (currentFrameRef.current < totalFrameCount2) {
            setCurrentFrame(currentFrameRef.current + 1);
          }
        }, 1e3);
      }
    }
  }, []);
  const renderCore = () => {
    switch (status) {
      case 4:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "nothing-to-preview", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mask" }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-2xl" }) })
        ] });
      case 0:
      case 1:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "loading", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mask" }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1i, { className: "text-2xl" }) })
        ] });
      case 2:
      case 3:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "playing", children: [
          status == 3 && /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: "paused-cover",
              onClick: () => {
                setStatus(
                  2
                  /* Playing */
                );
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdAccessTime, { className: "text-3xl" })
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              ref: mediaRef,
              className: "media",
              onClick: () => {
                setStatus(
                  3
                  /* Paused */
                );
              },
              children: renderMedia()
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              ref: progressBarRef,
              className: "progress-bar",
              onMouseLeave: () => {
                if (mouseOffsetXRef.current != void 0) {
                  mouseOffsetXRef.current = void 0;
                  setMouseOffsetX(void 0);
                }
                resume();
              },
              onMouseMove: (e2) => {
                if (!progressBarRef.current) {
                  return;
                }
                const { left: left2 } = progressBarRef.current.getBoundingClientRect();
                const offsetX = Math.ceil(e2.clientX - left2);
                if (offsetX != mouseOffsetX) {
                  setMouseOffsetX(offsetX);
                }
                pauseAutomatically();
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bar", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                "div",
                {
                  className: "progress",
                  style: { width: `${percentProgress}%` }
                }
              ) })
            }
          )
        ] });
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "media-previewer", children: renderCore() });
};
const FallbackCover = ({ id: id2, afterClearingCache }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("ResourceCover.CoverTips.Tooltip"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    Button,
    {
      isIconOnly: true,
      size: "sm",
      variant: "light",
      onPress: async (e2) => {
        const cacheExists = (await BApi$1.cache.checkResourceCacheExistence(id2, ResourceCacheType.Covers)).data ?? false;
        createPortal(Modal, {
          defaultVisible: true,
          size: "lg",
          title: t2("ResourceCover.CoverTips.Title"),
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-6", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium", children: t2("ResourceCover.CoverTips.S1.Title") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm mb-1", children: t2("ResourceCover.CoverTips.S1.Happens") }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "list-disc pl-5 text-sm", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("ResourceCover.CoverTips.S1.When.NotImage") }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("ResourceCover.CoverTips.S1.When.NoImageInFolder") })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm mt-1", children: t2("ResourceCover.CoverTips.S1.Todo") }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("ol", { className: "list-decimal pl-5 text-sm", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("ResourceCover.CoverTips.S1.Todo.ManualSet") }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("ResourceCover.CoverTips.S1.Todo.FFmpeg") }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("ResourceCover.CoverTips.S1.Todo.Enhancers") }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("ResourceCover.CoverTips.S1.Todo.Cache") })
              ] })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium", children: t2("ResourceCover.CoverTips.S2.Title") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm mb-1", children: t2("ResourceCover.CoverTips.S2.Happens") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "list-disc pl-5 text-sm", children: /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("ResourceCover.CoverTips.S2.When.CacheDeleted") }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm mt-1", children: t2("ResourceCover.CoverTips.S2.Todo") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("ol", { className: "list-decimal pl-5 text-sm", children: /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("ResourceCover.CoverTips.S2.Todo.DisableCache") }) })
            ] }),
            cacheExists && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium", children: t2("Cover cache") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: "secondary",
                  size: "sm",
                  variant: "flat",
                  onPress: async () => {
                    try {
                      await BApi$1.cache.deleteResourceCacheByResourceIdAndCacheType(
                        id2,
                        ResourceCacheType.Covers
                      );
                      await BApi$1.resource.discoverResourceCover(id2);
                      afterClearingCache == null ? void 0 : afterClearingCache();
                      toast.success(t2("Cover cache has been reset"));
                    } catch (err) {
                      toast.danger("Failed");
                    }
                  },
                  children: t2("Reset cover cache of current resource")
                }
              )
            ] })
          ] }),
          footer: { actions: ["ok"] }
        });
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdBrokenImage, { className: "text-2xl" })
    }
  ) });
};
const ResourceCover = React$5.forwardRef((props, ref) => {
  var _a2, _b2;
  const {
    resource: resource2,
    onClick: propsOnClick,
    showBiggerOnHover = true,
    useCache = false,
    disableMediaPreviewer = false,
    biggerCoverPlacement,
    coverFit = CoverFit.Contain,
    disableCarousel = false
  } = props;
  const { t: t2 } = useTranslation();
  const log3 = buildLogger(`ResourceCover:${resource2.id}|${resource2.path}`);
  const forceUpdate = useUpdate();
  const [urls2, setUrls] = reactExports.useState();
  const [previewerVisible, setPreviewerVisible] = reactExports.useState(false);
  const previewerHoverTimerRef = reactExports.useRef();
  const disableCacheRef = reactExports.useRef(useCache);
  const appContext = useAppContextStore((state) => state);
  const { createPortal } = useBakabaseContext();
  const containerRef = reactExports.useRef(null);
  const maxCoverRawSizeRef = reactExports.useRef({
    w: 0,
    h: 0
  });
  const [failureUrls, setFailureUrls] = reactExports.useState(/* @__PURE__ */ new Set());
  useUpdateEffect(() => {
    forceUpdate();
  }, [coverFit]);
  reactExports.useEffect(() => {
  }, [urls2]);
  reactExports.useEffect(() => {
    disableCacheRef.current = useCache;
  }, [useCache]);
  const loadCover = reactExports.useCallback(
    (disableBrowserCache) => {
      const serverAddresses = appContext.apiEndpoints ?? [envConfig.apiEndpoint];
      const urls22 = [];
      const cps = resource2.coverPaths ?? [];
      if (cps.length == 0) {
        if (useCache) {
          if (resource2.cache && resource2.cache.cachedTypes.includes(ResourceCacheType.Covers)) {
            if (resource2.cache.coverPaths && resource2.cache.coverPaths.length > 0) {
              cps.push(...resource2.cache.coverPaths);
            } else {
              cps.push(resource2.path);
            }
          }
        }
      }
      const resourceServerAddresses = serverAddresses.length == 1 ? serverAddresses : serverAddresses.slice(1);
      const serverAddress = resourceServerAddresses[Math.floor(Math.random() * resourceServerAddresses.length)];
      log3("cps", cps, "cache", resource2.cache);
      if (cps.length > 0) {
        urls22.push(
          ...cps.map(
            (coverPath) => `${serverAddress}/tool/thumbnail?path=${encodeURIComponent(coverPath)}`
          )
        );
      } else {
        urls22.push(`${serverAddress}/resource/${resource2.id}/cover`);
      }
      if (disableBrowserCache) {
        for (let i2 = 0; i2 < urls22.length; i2++) {
          urls22[i2] += urls22[i2].includes("?") ? `&v=${uuidv4()}` : `?v=${uuidv4()}`;
        }
      }
      setUrls(urls22);
    },
    [resource2, useCache]
  );
  useUpdateEffect(() => {
    loadCover(false);
  }, [resource2, loadCover]);
  reactExports.useEffect(() => {
    loadCover(false);
    const resizeObserver2 = new ResizeObserver(() => {
      forceUpdate();
    });
    resizeObserver2.observe(containerRef.current);
    return () => resizeObserver2.disconnect();
  }, []);
  reactExports.useImperativeHandle(ref, () => {
    return {
      load: loadCover
    };
  }, [loadCover]);
  const onClick = reactExports.useCallback(() => {
    if (propsOnClick) {
      propsOnClick();
    }
  }, [propsOnClick]);
  const renderCover = reactExports.useCallback(() => {
    if (urls2) {
      let dynamicClassNames = [];
      if (containerRef.current && maxCoverRawSizeRef.current) {
        if (maxCoverRawSizeRef.current.w > containerRef.current.clientWidth) {
          dynamicClassNames.push("w-full");
        }
        if (maxCoverRawSizeRef.current.h > containerRef.current.clientHeight) {
          dynamicClassNames.push("h-full");
        }
        dynamicClassNames.push(coverFit == CoverFit.Cover ? "object-cover" : "object-contain");
      }
      const dynamicClassName = dynamicClassNames.join(" ");
      const renderingUrls = disableCarousel ? urls2.slice(0, 1) : urls2;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Carousel,
        {
          autoplay: renderingUrls && renderingUrls.length > 1,
          dots: urls2 && urls2.length > 1,
          children: renderingUrls == null ? void 0 : renderingUrls.map((url2) => {
            var _a3, _b3;
            return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              "div",
              {
                className: "flex items-center justify-center",
                style: {
                  width: (_a3 = containerRef.current) == null ? void 0 : _a3.clientWidth,
                  height: (_b3 = containerRef.current) == null ? void 0 : _b3.clientHeight
                },
                children: failureUrls.has(url2) ? /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackCover, { afterClearingCache: () => loadCover(true), id: resource2.id }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
                  image_default,
                  {
                    removeWrapper: true,
                    className: `${dynamicClassName} max-w-full max-h-full`,
                    loading: "eager",
                    src: url2,
                    onError: () => {
                      failureUrls.add(url2);
                      setFailureUrls(new Set(failureUrls));
                      log3("failed to load url", url2);
                    },
                    onLoad: (e2) => {
                      const img = e2.target;
                      if (img) {
                        if (!maxCoverRawSizeRef.current) {
                          maxCoverRawSizeRef.current = {
                            w: img.naturalWidth,
                            h: img.naturalHeight
                          };
                        } else {
                          maxCoverRawSizeRef.current.w = Math.max(
                            maxCoverRawSizeRef.current.w,
                            img.naturalWidth
                          );
                          maxCoverRawSizeRef.current.h = Math.max(
                            maxCoverRawSizeRef.current.h,
                            img.naturalHeight
                          );
                        }
                      }
                    }
                  },
                  url2
                )
              }
            ) }, url2);
          })
        },
        renderingUrls.join(",")
      );
    }
    return null;
  }, [urls2, coverFit, disableCarousel]);
  const renderContainer = () => {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        ref: containerRef,
        className: "resource-cover-container relative overflow-hidden",
        onClick,
        onMouseLeave: () => {
          if (!disableMediaPreviewer) {
            clearTimeout(previewerHoverTimerRef.current);
            previewerHoverTimerRef.current = void 0;
            if (previewerVisible) {
              setPreviewerVisible(false);
            }
          }
        },
        onMouseOver: (e2) => {
          if (!disableMediaPreviewer) {
            if (!previewerHoverTimerRef.current) {
              previewerHoverTimerRef.current = setTimeout(() => {
                setPreviewerVisible(true);
              }, 1e3);
            }
          }
        },
        children: [
          previewerVisible && /* @__PURE__ */ jsxRuntimeExports.jsx(MediaPreviewer, { resourceId: resource2.id }),
          renderCover()
        ]
      }
    );
  };
  let tooltipWidth;
  let tooltipHeight;
  if (showBiggerOnHover && typeof window !== "undefined") {
    const containerWidth = ((_a2 = containerRef.current) == null ? void 0 : _a2.clientWidth) ?? 100;
    const containerHeight = ((_b2 = containerRef.current) == null ? void 0 : _b2.clientHeight) ?? 100;
    if (maxCoverRawSizeRef.current.w > containerWidth && maxCoverRawSizeRef.current.h > containerHeight) {
      const tooltipScale = Math.min(
        window.innerWidth * 0.6 / maxCoverRawSizeRef.current.w,
        window.innerHeight * 0.6 / maxCoverRawSizeRef.current.h
      );
      tooltipWidth = maxCoverRawSizeRef.current.w * tooltipScale;
      tooltipHeight = maxCoverRawSizeRef.current.h * tooltipScale;
    }
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      content: /* @__PURE__ */ jsxRuntimeExports.jsx(
        "div",
        {
          style: {
            width: tooltipWidth,
            height: tooltipHeight
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Carousel,
            {
              adaptiveHeight: true,
              autoplay: urls2 && urls2.length > 1,
              dots: urls2 && urls2.length > 1,
              children: urls2 == null ? void 0 : urls2.map((url2) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                "div",
                {
                  className: "flex items-center justify-center",
                  style: {
                    maxWidth: tooltipWidth,
                    maxHeight: tooltipHeight
                  },
                  children: failureUrls.has(url2) ? /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackCover, { afterClearingCache: () => loadCover(true), id: resource2.id }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
                    image_default,
                    {
                      removeWrapper: true,
                      alt: "",
                      loading: "eager",
                      src: url2,
                      style: {
                        maxWidth: tooltipWidth,
                        maxHeight: tooltipHeight
                      },
                      onError: () => {
                        failureUrls.add(url2);
                        setFailureUrls(new Set(failureUrls));
                      },
                      onLoad: (e2) => {
                      }
                    },
                    url2
                  )
                }
              ) }, url2))
            }
          )
        }
      ),
      isDisabled: tooltipWidth == void 0,
      placement: biggerCoverPlacement,
      children: renderContainer()
    }
  );
});
const ResourceCoverMemo = React$5.memo(ResourceCover);
ResourceCoverMemo.displayName = "ResourceCover";
buildLogger("PropertyValueScopePicker");
const PropertyValueScopePicker = (props) => {
  const { t: t2 } = useTranslation();
  const { resource: resource2 } = props;
  const resourceOptions = useResourceOptionsStore((state) => state.data);
  const [propertyMap, setPropertyMap] = reactExports.useState({});
  const [visibleScopes, setVisibleScopes] = reactExports.useState(
    propertyValueScopes.map((s2) => s2.value)
  );
  const init2 = reactExports.useCallback(async () => {
    const properties2 = (await BApi$1.property.getPropertiesByPool(
      PropertyPool.Custom | PropertyPool.Reserved
    )).data ?? [];
    const propertyMap2 = {};
    properties2.forEach((p2) => {
      if (!propertyMap2[p2.pool]) {
        propertyMap2[p2.pool] = {};
      }
      propertyMap2[p2.pool][p2.id] = p2;
    });
    setPropertyMap(propertyMap2);
  }, []);
  reactExports.useEffect(() => {
    init2();
  }, []);
  const renderHeader = () => {
    const columns = [
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Property") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Display value") }),
      ...visibleScopes.map((scope) => {
        const priority = resourceOptions.propertyValueScopePriority ?? [];
        const index2 = priority.findIndex((p2) => p2 == scope);
        return /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            size: "sm",
            onClick: () => {
              const arr = index2 > -1 ? priority.filter((p2) => p2 != scope) : [...priority, scope];
              BApi$1.options.patchResourceOptions({
                propertyValueScopePriority: arr
              });
            },
            children: [
              t2(`PropertyValueScope.${PropertyValueScope[scope]}`),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Tooltip$1,
                {
                  content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                      "The numbers represent the priority of property dimensions, and the property values will be displayed according to the priority of the dimensions."
                    ) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$_, { className: "text-base" }),
                      t2("indicates this scope is not enabled")
                    ] })
                  ] }),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "light", children: index2 == -1 ? /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$_, { className: "text-base" }) : index2 + 1 })
                }
              )
            ]
          }
        ) }, scope);
      })
    ];
    return columns;
  };
  const renderRows = () => {
    const ps = resource2.properties ?? {};
    const rows = [];
    const priority = resourceOptions.propertyValueScopePriority ?? [];
    Object.keys(ps).forEach((pool) => {
      const propertyValueMap = ps[pool];
      Object.keys(propertyValueMap).forEach((id2) => {
        var _a2;
        const propertyValues = propertyValueMap[id2];
        const row = [];
        row.push(
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: propertyValues.name }) }) }, "Property")
        );
        let finalValue;
        let finalScope;
        if (propertyValues.values) {
          for (const scope of priority) {
            const t22 = propertyValues.values.find((v2) => v2.scope == scope);
            if (t22 == null ? void 0 : t22.value) {
              finalValue = t22.aliasAppliedBizValue;
              finalScope = scope;
              break;
            }
          }
        }
        const property2 = (_a2 = propertyMap[pool]) == null ? void 0 : _a2[id2];
        row.push(
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: property2 && /* @__PURE__ */ jsxRuntimeExports.jsx(
            PropertyValueRenderer,
            {
              bizValue: serializeStandardValue(
                finalValue,
                propertyValues.bizValueType
              ),
              property: property2,
              variant: "light"
            }
          ) }, "Display value")
        );
        visibleScopes.forEach((scope) => {
          var _a3, _b2;
          const value2 = (_b2 = (_a3 = propertyValues.values) == null ? void 0 : _a3.find(
            (v2) => v2.scope == scope
          )) == null ? void 0 : _b2.aliasAppliedBizValue;
          const isHidden = priority.findIndex((p2) => p2 == scope) == -1;
          let className = "";
          const style2 = {};
          row.push(
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              table_cell_default,
              {
                className,
                style: style2,
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `relative ${isHidden ? "opacity-60" : ""}`, children: [
                  scope == finalScope && /* @__PURE__ */ jsxRuntimeExports.jsx(
                    RefIcon$10,
                    {
                      className: "absolute top-0 right-0 text-[var(--bakaui-success)]"
                    }
                  ),
                  property2 && /* @__PURE__ */ jsxRuntimeExports.jsx(
                    PropertyValueRenderer,
                    {
                      bizValue: serializeStandardValue(
                        value2,
                        propertyValues.bizValueType
                      ),
                      property: property2,
                      variant: "light"
                    }
                  )
                ] })
              },
              `scope-${scope}`
            )
          );
        });
        rows.push(/* @__PURE__ */ jsxRuntimeExports.jsx(table_row_default, { children: row }, id2));
      });
    });
    return rows;
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: false,
      size: "full",
      title: t2("Setup priority of property value scopes"),
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            t2("Visible scopes"),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Tooltip$1,
              {
                content: t2(
                  "This filter is used for quick check and does not change the priority of property value scopes."
                ),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" })
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: propertyValueScopes.map((s2) => {
            const isVisible2 = visibleScopes.includes(s2.value);
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                className: "cursor-pointer",
                color: isVisible2 ? "primary" : "default",
                radius: "sm",
                size: "sm",
                onClick: () => {
                  if (isVisible2) {
                    setVisibleScopes(visibleScopes.filter((v2) => v2 != s2.value));
                  } else {
                    setVisibleScopes([...visibleScopes, s2.value]);
                  }
                },
                children: t2(`PropertyValueScope.${PropertyValueScope[s2.value]}`)
              }
            );
          }) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "You can click on the scope button to change the priority of the property value scopes."
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { removeWrapper: true, children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_header_default, { children: renderHeader() }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: renderRows() })
        ] })
      ]
    }
  );
};
PropertyValueScopePicker.displayName = "PropertyValueScopePicker";
let e = { data: "" }, t$2 = (t2) => "object" == typeof window ? ((t2 ? t2.querySelector("#_goober") : window._goober) || Object.assign((t2 || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : t2 || e, l$3 = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, a = /\/\*[^]*?\*\/|  +/g, n$1 = /\n+/g, o = (e2, t2) => {
  let r2 = "", l2 = "", a2 = "";
  for (let n2 in e2) {
    let c2 = e2[n2];
    "@" == n2[0] ? "i" == n2[1] ? r2 = n2 + " " + c2 + ";" : l2 += "f" == n2[1] ? o(c2, n2) : n2 + "{" + o(c2, "k" == n2[1] ? "" : t2) + "}" : "object" == typeof c2 ? l2 += o(c2, t2 ? t2.replace(/([^,])+/g, (e3) => n2.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g, (t3) => /&/.test(t3) ? t3.replace(/&/g, e3) : e3 ? e3 + " " + t3 : t3)) : n2) : null != c2 && (n2 = /^--/.test(n2) ? n2 : n2.replace(/[A-Z]/g, "-$&").toLowerCase(), a2 += o.p ? o.p(n2, c2) : n2 + ":" + c2 + ";");
  }
  return r2 + (t2 && a2 ? t2 + "{" + a2 + "}" : a2) + l2;
}, c$1 = {}, s$1 = (e2) => {
  if ("object" == typeof e2) {
    let t2 = "";
    for (let r2 in e2)
      t2 += r2 + s$1(e2[r2]);
    return t2;
  }
  return e2;
}, i = (e2, t2, r2, i2, p2) => {
  let u2 = s$1(e2), d2 = c$1[u2] || (c$1[u2] = ((e3) => {
    let t3 = 0, r3 = 11;
    for (; t3 < e3.length; )
      r3 = 101 * r3 + e3.charCodeAt(t3++) >>> 0;
    return "go" + r3;
  })(u2));
  if (!c$1[d2]) {
    let t3 = u2 !== e2 ? e2 : ((e3) => {
      let t4, r3, o2 = [{}];
      for (; t4 = l$3.exec(e3.replace(a, "")); )
        t4[4] ? o2.shift() : t4[3] ? (r3 = t4[3].replace(n$1, " ").trim(), o2.unshift(o2[0][r3] = o2[0][r3] || {})) : o2[0][t4[1]] = t4[2].replace(n$1, " ").trim();
      return o2[0];
    })(e2);
    c$1[d2] = o(p2 ? { ["@keyframes " + d2]: t3 } : t3, r2 ? "" : "." + d2);
  }
  let f2 = r2 && c$1.g ? c$1.g : null;
  return r2 && (c$1.g = c$1[d2]), ((e3, t3, r3, l2) => {
    l2 ? t3.data = t3.data.replace(l2, e3) : -1 === t3.data.indexOf(e3) && (t3.data = r3 ? e3 + t3.data : t3.data + e3);
  })(c$1[d2], t2, i2, f2), d2;
}, p$2 = (e2, t2, r2) => e2.reduce((e3, l2, a2) => {
  let n2 = t2[a2];
  if (n2 && n2.call) {
    let e4 = n2(r2), t3 = e4 && e4.props && e4.props.className || /^go/.test(e4) && e4;
    n2 = t3 ? "." + t3 : e4 && "object" == typeof e4 ? e4.props ? "" : o(e4, "") : false === e4 ? "" : e4;
  }
  return e3 + l2 + (null == n2 ? "" : n2);
}, "");
function u$3(e2) {
  let r2 = this || {}, l2 = e2.call ? e2(r2.p) : e2;
  return i(l2.unshift ? l2.raw ? p$2(l2, [].slice.call(arguments, 1), r2.p) : l2.reduce((e3, t2) => Object.assign(e3, t2 && t2.call ? t2(r2.p) : t2), {}) : l2, t$2(r2.target), r2.g, r2.o, r2.k);
}
let d, f$1, g;
u$3.bind({ g: 1 });
let h = u$3.bind({ k: 1 });
function m(e2, t2, r2, l2) {
  o.p = t2, d = e2, f$1 = r2, g = l2;
}
function j(e2, t2) {
  let r2 = this || {};
  return function() {
    let l2 = arguments;
    function a2(n2, o2) {
      let c2 = Object.assign({}, n2), s2 = c2.className || a2.className;
      r2.p = Object.assign({ theme: f$1 && f$1() }, c2), r2.o = / *go\d+/.test(s2), c2.className = u$3.apply(r2, l2) + (s2 ? " " + s2 : "");
      let i2 = e2;
      return e2[0] && (i2 = c2.as || e2, delete c2.as), g && i2[0] && g(c2), d(i2, c2);
    }
    return a2;
  };
}
var W$2 = (e2) => typeof e2 == "function", f = (e2, t2) => W$2(e2) ? e2(t2) : e2;
var F$1 = /* @__PURE__ */ (() => {
  let e2 = 0;
  return () => (++e2).toString();
})(), A$1 = /* @__PURE__ */ (() => {
  let e2;
  return () => {
    if (e2 === void 0 && typeof window < "u") {
      let t2 = matchMedia("(prefers-reduced-motion: reduce)");
      e2 = !t2 || t2.matches;
    }
    return e2;
  };
})();
var Y$2 = 20;
var U$2 = (e2, t2) => {
  switch (t2.type) {
    case 0:
      return { ...e2, toasts: [t2.toast, ...e2.toasts].slice(0, Y$2) };
    case 1:
      return { ...e2, toasts: e2.toasts.map((o2) => o2.id === t2.toast.id ? { ...o2, ...t2.toast } : o2) };
    case 2:
      let { toast: r2 } = t2;
      return U$2(e2, { type: e2.toasts.find((o2) => o2.id === r2.id) ? 1 : 0, toast: r2 });
    case 3:
      let { toastId: s2 } = t2;
      return { ...e2, toasts: e2.toasts.map((o2) => o2.id === s2 || s2 === void 0 ? { ...o2, dismissed: true, visible: false } : o2) };
    case 4:
      return t2.toastId === void 0 ? { ...e2, toasts: [] } : { ...e2, toasts: e2.toasts.filter((o2) => o2.id !== t2.toastId) };
    case 5:
      return { ...e2, pausedAt: t2.time };
    case 6:
      let a2 = t2.time - (e2.pausedAt || 0);
      return { ...e2, pausedAt: void 0, toasts: e2.toasts.map((o2) => ({ ...o2, pauseDuration: o2.pauseDuration + a2 })) };
  }
}, P$2 = [], y$2 = { toasts: [], pausedAt: void 0 }, u$2 = (e2) => {
  y$2 = U$2(y$2, e2), P$2.forEach((t2) => {
    t2(y$2);
  });
};
var J$2 = (e2, t2 = "blank", r2) => ({ createdAt: Date.now(), visible: true, dismissed: false, type: t2, ariaProps: { role: "status", "aria-live": "polite" }, message: e2, pauseDuration: 0, ...r2, id: (r2 == null ? void 0 : r2.id) || F$1() }), x$2 = (e2) => (t2, r2) => {
  let s2 = J$2(t2, e2, r2);
  return u$2({ type: 2, toast: s2 }), s2.id;
}, c = (e2, t2) => x$2("blank")(e2, t2);
c.error = x$2("error");
c.success = x$2("success");
c.loading = x$2("loading");
c.custom = x$2("custom");
c.dismiss = (e2) => {
  u$2({ type: 3, toastId: e2 });
};
c.remove = (e2) => u$2({ type: 4, toastId: e2 });
c.promise = (e2, t2, r2) => {
  let s2 = c.loading(t2.loading, { ...r2, ...r2 == null ? void 0 : r2.loading });
  return typeof e2 == "function" && (e2 = e2()), e2.then((a2) => {
    let o2 = t2.success ? f(t2.success, a2) : void 0;
    return o2 ? c.success(o2, { id: s2, ...r2, ...r2 == null ? void 0 : r2.success }) : c.dismiss(s2), a2;
  }).catch((a2) => {
    let o2 = t2.error ? f(t2.error, a2) : void 0;
    o2 ? c.error(o2, { id: s2, ...r2, ...r2 == null ? void 0 : r2.error }) : c.dismiss(s2);
  }), e2;
};
var oe = h`
from {
  transform: scale(0) rotate(45deg);
	opacity: 0;
}
to {
 transform: scale(1) rotate(45deg);
  opacity: 1;
}`, re$1 = h`
from {
  transform: scale(0);
  opacity: 0;
}
to {
  transform: scale(1);
  opacity: 1;
}`, se = h`
from {
  transform: scale(0) rotate(90deg);
	opacity: 0;
}
to {
  transform: scale(1) rotate(90deg);
	opacity: 1;
}`, k$1 = j("div")`
  width: 20px;
  opacity: 0;
  height: 20px;
  border-radius: 10px;
  background: ${(e2) => e2.primary || "#ff4b4b"};
  position: relative;
  transform: rotate(45deg);

  animation: ${oe} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
    forwards;
  animation-delay: 100ms;

  &:after,
  &:before {
    content: '';
    animation: ${re$1} 0.15s ease-out forwards;
    animation-delay: 150ms;
    position: absolute;
    border-radius: 3px;
    opacity: 0;
    background: ${(e2) => e2.secondary || "#fff"};
    bottom: 9px;
    left: 4px;
    height: 2px;
    width: 12px;
  }

  &:before {
    animation: ${se} 0.15s ease-out forwards;
    animation-delay: 180ms;
    transform: rotate(90deg);
  }
`;
var ne = h`
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
`, V$2 = j("div")`
  width: 12px;
  height: 12px;
  box-sizing: border-box;
  border: 2px solid;
  border-radius: 100%;
  border-color: ${(e2) => e2.secondary || "#e0e0e0"};
  border-right-color: ${(e2) => e2.primary || "#616161"};
  animation: ${ne} 1s linear infinite;
`;
var pe = h`
from {
  transform: scale(0) rotate(45deg);
	opacity: 0;
}
to {
  transform: scale(1) rotate(45deg);
	opacity: 1;
}`, de = h`
0% {
	height: 0;
	width: 0;
	opacity: 0;
}
40% {
  height: 0;
	width: 6px;
	opacity: 1;
}
100% {
  opacity: 1;
  height: 10px;
}`, _23 = j("div")`
  width: 20px;
  opacity: 0;
  height: 20px;
  border-radius: 10px;
  background: ${(e2) => e2.primary || "#61d345"};
  position: relative;
  transform: rotate(45deg);

  animation: ${pe} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
    forwards;
  animation-delay: 100ms;
  &:after {
    content: '';
    box-sizing: border-box;
    animation: ${de} 0.2s ease-out forwards;
    opacity: 0;
    animation-delay: 200ms;
    position: absolute;
    border-right: 2px solid;
    border-bottom: 2px solid;
    border-color: ${(e2) => e2.secondary || "#fff"};
    bottom: 6px;
    left: 6px;
    height: 10px;
    width: 6px;
  }
`;
var ue = j("div")`
  position: absolute;
`, le = j("div")`
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 20px;
  min-height: 20px;
`, fe = h`
from {
  transform: scale(0.6);
  opacity: 0.4;
}
to {
  transform: scale(1);
  opacity: 1;
}`, Te = j("div")`
  position: relative;
  transform: scale(0.6);
  opacity: 0.4;
  min-width: 20px;
  animation: ${fe} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
    forwards;
`, M$2 = ({ toast: e2 }) => {
  let { icon: t2, type: r2, iconTheme: s2 } = e2;
  return t2 !== void 0 ? typeof t2 == "string" ? reactExports.createElement(Te, null, t2) : t2 : r2 === "blank" ? null : reactExports.createElement(le, null, reactExports.createElement(V$2, { ...s2 }), r2 !== "loading" && reactExports.createElement(ue, null, r2 === "error" ? reactExports.createElement(k$1, { ...s2 }) : reactExports.createElement(_23, { ...s2 })));
};
var ye = (e2) => `
0% {transform: translate3d(0,${e2 * -200}%,0) scale(.6); opacity:.5;}
100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
`, ge = (e2) => `
0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
100% {transform: translate3d(0,${e2 * -150}%,-1px) scale(.6); opacity:0;}
`, he = "0%{opacity:0;} 100%{opacity:1;}", xe = "0%{opacity:1;} 100%{opacity:0;}", be = j("div")`
  display: flex;
  align-items: center;
  background: #fff;
  color: #363636;
  line-height: 1.3;
  will-change: transform;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);
  max-width: 350px;
  pointer-events: auto;
  padding: 8px 10px;
  border-radius: 8px;
`, Se = j("div")`
  display: flex;
  justify-content: center;
  margin: 4px 10px;
  color: inherit;
  flex: 1 1 auto;
  white-space: pre-line;
`, Ae = (e2, t2) => {
  let s2 = e2.includes("top") ? 1 : -1, [a2, o2] = A$1() ? [he, xe] : [ye(s2), ge(s2)];
  return { animation: t2 ? `${h(a2)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards` : `${h(o2)} 0.4s forwards cubic-bezier(.06,.71,.55,1)` };
};
reactExports.memo(({ toast: e2, position: t2, style: r2, children: s2 }) => {
  let a2 = e2.height ? Ae(e2.position || t2 || "top-center", e2.visible) : { opacity: 0 }, o2 = reactExports.createElement(M$2, { toast: e2 }), n2 = reactExports.createElement(Se, { ...e2.ariaProps }, f(e2.message, e2));
  return reactExports.createElement(be, { className: e2.className, style: { ...a2, ...r2, ...e2.style } }, typeof s2 == "function" ? s2({ icon: o2, message: n2 }) : reactExports.createElement(reactExports.Fragment, null, o2, n2));
});
m(reactExports.createElement);
u$3`
  z-index: 9999;
  > * {
    pointer-events: auto;
  }
`;
var Vt = c;
const splitIntoDirs = (paths, prefix) => {
  const groups2 = [];
  const stdPrefix = standardizePath(prefix);
  for (const path of paths) {
    const stdPath = standardizePath(path);
    const relativePath = stdPath.replace(stdPrefix, "");
    const segments = splitPathIntoSegments(relativePath);
    const relativeDir = segments.slice(0, segments.length - 1).join(BusinessConstants.pathSeparator);
    let dir = groups2.find((g2) => g2.relativePath == relativeDir);
    if (!dir) {
      dir = {
        relativePath: relativeDir,
        groups: []
      };
      groups2.push(dir);
    }
    console.log(paths, path, stdPrefix, relativePath, segments);
    const extension2 = segments[segments.length - 1].split(".").pop();
    let group = dir.groups.find((g2) => g2.extension == extension2);
    if (!group) {
      group = {
        extension: extension2,
        files: []
      };
      dir.groups.push(group);
    }
    group.files.push({
      name: segments[segments.length - 1],
      path
    });
  }
  return groups2;
};
const DefaultVisibleFileCount = 5;
const PlayableFiles = reactExports.forwardRef(function PlayableFiles2({ autoInitialize, resource: resource2, PortalComponent, afterPlaying }, ref) {
  var _a2;
  const { t: t2 } = useTranslation();
  const log3 = buildLogger(`ResourcePlayableFiles:${resource2.id}|${resource2.path}`);
  const uiOptionsStore = useUiOptionsStore();
  const resourceUiOptions = (_a2 = uiOptionsStore.data) == null ? void 0 : _a2.resource;
  const useCache = !(resourceUiOptions == null ? void 0 : resourceUiOptions.disableCache);
  const [portalCtx, setPortalCtx] = reactExports.useState();
  const [dirs, setDirs] = reactExports.useState();
  const [modalVisible, setModalVisible] = reactExports.useState(false);
  const initialize = reactExports.useCallback(async () => {
    var _a3, _b2, _c2, _d;
    if (useCache) {
      if ((_b2 = (_a3 = resource2.cache) == null ? void 0 : _a3.cachedTypes) == null ? void 0 : _b2.includes(ResourceCacheType.PlayableFiles)) {
        log3("Set playable files via cache");
        setPortalCtx({
          files: ((_c2 = resource2.cache) == null ? void 0 : _c2.playableFilePaths) ?? [],
          hasMore: ((_d = resource2.cache) == null ? void 0 : _d.hasMorePlayableFiles) ?? false
        });
        return;
      }
    }
    log3("Set playable files via api");
    await BApi$1.resource.getResourcePlayableFiles(resource2.id).then((a2) => {
      setPortalCtx({
        files: a2.data || [],
        hasMore: false
      });
      if (!resource2.isFile) {
        setDirs(splitIntoDirs(a2.data || [], resource2.path));
      }
    });
  }, [useCache]);
  reactExports.useImperativeHandle(
    ref,
    () => ({
      initialize
    }),
    [initialize]
  );
  reactExports.useEffect(() => {
    if (autoInitialize) {
      initialize();
    }
  }, []);
  const play2 = (file) => BApi$1.resource.playResourceFile(resource2.id, {
    file
  }).then((a2) => {
    if (!a2.code) {
      Vt.success(t2("Opened"));
      afterPlaying == null ? void 0 : afterPlaying();
    }
  });
  if ((portalCtx == null ? void 0 : portalCtx.files) && portalCtx.files.length > 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        PortalComponent,
        {
          onClick: () => {
            if (portalCtx.files.length == 1 && !portalCtx.hasMore) {
              play2(portalCtx.files[0]);
            } else if ((resourceUiOptions == null ? void 0 : resourceUiOptions.autoSelectFirstPlayableFile) && portalCtx.files.length > 0) {
              play2(portalCtx.files[0]);
            } else {
              if (dirs) {
                setModalVisible(true);
              }
            }
          }
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Modal,
        {
          footer: false,
          size: "lg",
          title: t2("Please select a file to play"),
          visible: modalVisible,
          onClose: () => {
            setModalVisible(false);
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2 pb-2", children: dirs == null ? void 0 : dirs.map((d2) => {
              return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                dirs.length > 1 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$F, { className: "text-base" }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "light", children: d2.relativePath })
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex gap-1 flex-col", children: d2.groups.map((g2) => {
                  const showCount = g2.showAll ? g2.files.length : Math.min(DefaultVisibleFileCount, g2.files.length);
                  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-center gap-1", children: [
                    d2.groups.length > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: g2.extension }),
                    g2.files.slice(0, showCount).map((file) => {
                      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                        Button,
                        {
                          className: "whitespace-break-spaces py-2 h-auto text-left",
                          radius: "sm",
                          size: "sm",
                          onPress: () => {
                            play2(file.path);
                          },
                          children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$n, { className: "text-base" }),
                            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "break-all overflow-hidden text-ellipsis", children: file.name })
                          ]
                        },
                        file.path
                      );
                    }),
                    g2.files.length > DefaultVisibleFileCount && !g2.showAll && /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Button,
                      {
                        color: "primary",
                        size: "sm",
                        variant: "light",
                        onPress: () => {
                          g2.showAll = true;
                          setDirs([...dirs]);
                        },
                        children: t2("Show all {{count}} files", {
                          count: g2.files.length
                        })
                      }
                    )
                  ] }, g2.extension);
                }) })
              ] }, d2.relativePath);
            }) }),
            !(resourceUiOptions == null ? void 0 : resourceUiOptions.autoSelectFirstPlayableFile) && (portalCtx == null ? void 0 : portalCtx.files.length) > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-3 border-t mt-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "primary",
                size: "sm",
                variant: "flat",
                onPress: async () => {
                  await uiOptionsStore.patch({
                    resource: {
                      ...resourceUiOptions,
                      autoSelectFirstPlayableFile: true
                    }
                  });
                  setModalVisible(false);
                  Vt.success(
                    t2(
                      "Auto-select first playable file has been enabled. You can change this in the resource page settings."
                    )
                  );
                },
                children: t2("Auto-select first file if multiple playable files exist")
              }
            ) })
          ]
        }
      )
    ] });
  }
  return null;
});
PlayableFiles.displayName = "PlayableFiles";
const SortableBlock = ({ id: id2, name: name2, idx }) => {
  const { attributes: attributes2, listeners, setNodeRef, transform: transform2, transition: transition3 } = useSortable({ id: id2 });
  const style2 = {
    transform: CSS$1.Transform.toString(transform2),
    transition: transition3
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: setNodeRef, style: style2, ...attributes2, ...listeners, children: /* @__PURE__ */ jsxRuntimeExports.jsx(card_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(chip_default, { size: "sm", children: idx + 1 }),
    name2
  ] }) }) }) });
};
SortableBlock.displayName = "SortableBlock";
const BlockSort = ({ blocks, onSorted }) => {
  const [items, setItems] = reactExports.useState(blocks.map((block) => block.id));
  const sensors = useSensors(
    useSensor(PointerSensor),
    useSensor(KeyboardSensor, {
      coordinateGetter: sortableKeyboardCoordinates
    })
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-y-2 gap-x-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    DndContext,
    {
      collisionDetection: closestCenter,
      sensors,
      onDragEnd: handleDragEnd,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(SortableContext$1, { items, children: items.map((id2, idx) => /* @__PURE__ */ jsxRuntimeExports.jsx(
        SortableBlock,
        {
          id: id2,
          idx,
          name: blocks.find((b2) => b2.id == id2).name
        },
        id2
      )) })
    }
  ) });
  function handleDragEnd(event) {
    const { active: active3, over } = event;
    if (active3.id !== over.id) {
      setItems((items2) => {
        const oldIndex = items2.indexOf(active3.id);
        const newIndex = items2.indexOf(over.id);
        const newBlocks = arrayMove(items2, oldIndex, newIndex);
        onSorted == null ? void 0 : onSorted(newBlocks);
        return newBlocks;
      });
    }
  }
};
BlockSort.displayName = "BlockSort";
const CategoryPropertySortModal = ({
  properties: properties2,
  onDestroyed,
  categoryId,
  onClose
}) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel"],
        cancelProps: {
          text: t2("Close")
        }
      },
      size: "xl",
      title: t2("Adjust orders of properties"),
      onClose,
      onDestroyed,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "You can adjust orders or properties by dragging and dropping them"
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          BlockSort,
          {
            blocks: properties2,
            onSorted: async (ids2) => {
              await BApi$1.category.sortCustomPropertiesInCategory(categoryId, {
                orderedPropertyIds: ids2
              });
              Vt.success(t2("Saved"));
            }
          }
        )
      ]
    }
  );
};
CategoryPropertySortModal.displayName = "CategoryPropertySortModal";
const CustomPropertySortModal = ({ properties: properties2, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel"],
        cancelProps: {
          text: t2("Close")
        }
      },
      size: "xl",
      title: t2("Adjust orders of properties"),
      onDestroyed,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "You can adjust orders or properties by dragging and dropping them"
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          BlockSort,
          {
            blocks: properties2,
            onSorted: async (ids2) => {
              await BApi$1.customProperty.sortCustomProperties({ ids: ids2 });
              Vt.success(t2("Saved"));
            }
          }
        )
      ]
    }
  );
};
CustomPropertySortModal.displayName = "CustomPropertySortModal";
const DetailDialog = ({ id: id2, onRemoved, ...props }) => {
  var _a2;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [resource2, setResource] = reactExports.useState();
  const uiOptions = useUiOptionsStore((state) => state.data);
  const loadResource = async () => {
    var _a3;
    const r2 = await BApi$1.resource.getResourcesByKeys({
      ids: [id2],
      additionalItems: ResourceAdditionalItem.All
    });
    const d2 = ((_a3 = r2.data || []) == null ? void 0 : _a3[0]) ?? {};
    if (d2.properties) {
      Object.values(d2.properties).forEach((a2) => {
        Object.values(a2).forEach((b2) => {
          if (b2.values) {
            for (const v2 of b2.values) {
              v2.bizValue = convertFromApiValue(v2.bizValue, b2.bizValueType);
              v2.aliasAppliedBizValue = convertFromApiValue(
                v2.aliasAppliedBizValue,
                b2.bizValueType
              );
              v2.value = convertFromApiValue(v2.value, b2.dbValueType);
            }
          }
        });
      });
    }
    setResource(d2);
  };
  reactExports.useEffect(() => {
    loadResource();
  }, []);
  console.log(resource2);
  const hideTimeInfo = !!((_a2 = uiOptions.resource) == null ? void 0 : _a2.hideResourceTimeInfo);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: false,
      size: "xl",
      title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: resource2 == null ? void 0 : resource2.displayName }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          PopoverComponent,
          {
            shouldCloseOnBlur: true,
            placement: "left-start",
            trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                size: "sm",
                variant: "light",
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$e, { className: "text-base" })
              }
            ),
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
              listbox_default,
              {
                "aria-label": "Actions",
                onAction: (key) => {
                  var _a3;
                  switch (key) {
                    case "AdjustPropertyScopePriority": {
                      createPortal(PropertyValueScopePicker, {
                        resource: resource2
                      });
                      break;
                    }
                    case "SortPropertiesInCategory": {
                      const propertyMap = ((_a3 = resource2 == null ? void 0 : resource2.properties) == null ? void 0 : _a3[PropertyPool.Custom]) ?? {};
                      const properties2 = _$2.keys(propertyMap).map((x2) => {
                        const id22 = parseInt(x2, 10);
                        const p2 = propertyMap[id22];
                        if (p2.visible) {
                          return {
                            id: id22,
                            name: p2.name
                          };
                        }
                        return null;
                      }).filter((x2) => x2 != null);
                      createPortal(CategoryPropertySortModal, {
                        categoryId: resource2.categoryId,
                        properties: properties2,
                        onDestroyed: loadResource
                      });
                      break;
                    }
                    case "SortPropertiesGlobally": {
                      BApi$1.customProperty.getAllCustomProperties().then((r2) => {
                        const properties2 = (r2.data || []).sort(
                          (a2, b2) => a2.order - b2.order
                        );
                        createPortal(CustomPropertySortModal, {
                          properties: properties2,
                          onDestroyed: loadResource
                        });
                      });
                    }
                  }
                },
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    listbox_item_base_default,
                    {
                      startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$16, { className: "text-small" }),
                      children: t2("Adjust the display priority of property scopes")
                    },
                    "AdjustPropertyScopePriority"
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    listbox_item_base_default,
                    {
                      startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$j, { className: "text-small" }),
                      children: t2(
                        "Adjust orders of linked properties for current category"
                      )
                    },
                    "SortPropertiesInCategory"
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    listbox_item_base_default,
                    {
                      startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$j, { className: "text-small" }),
                      children: t2("Adjust orders of properties globally")
                    },
                    "SortPropertiesGlobally"
                  )
                ]
              }
            )
          }
        )
      ] }),
      onDestroyed: props.onDestroyed,
      children: resource2 && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-4", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "min-w-[400px] w-[400px] max-w-[400px] flex flex-col gap-4", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              "div",
              {
                className: "h-[400px] max-h-[400px] overflow-hidden rounded flex items-center justify-center border-1",
                style: { borderColor: "var(--bakaui-overlap-background)" },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  ResourceCoverMemo,
                  {
                    resource: resource2,
                    showBiggerOnHover: false,
                    useCache: false
                  }
                )
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Properties,
              {
                hidePropertyName: true,
                propertyInnerDirection: "ver",
                reload: loadResource,
                resource: resource2,
                restrictedPropertyIds: [ReservedProperty.Rating],
                restrictedPropertyPool: PropertyPool.Reserved
              }
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between relative", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                "div",
                {
                  className: "absolute flex justify-center left-0 right-0 w-full ",
                  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(button_group_default, { size: "sm", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      PlayableFiles,
                      {
                        autoInitialize: true,
                        PortalComponent: ({ onClick }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { color: "primary", onPress: onClick, children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$n, {}),
                          t2("Play")
                        ] }),
                        resource: resource2
                      }
                    ),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs(
                      Button,
                      {
                        color: "default",
                        onPress: () => {
                          BApi$1.resource.openResourceDirectory({
                            id: resource2.id
                          });
                        },
                        children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$G, {}),
                          t2("Open")
                        ]
                      }
                    ),
                    resource2.hasChildren && /* @__PURE__ */ jsxRuntimeExports.jsxs(
                      Button,
                      {
                        color: "default",
                        onPress: () => {
                          createPortal(ChildrenModal, {
                            resourceId: resource2.id
                          });
                        },
                        children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx(TiFlowChildren, { className: "text-lg" }),
                          t2("View Children")
                        ]
                      }
                    )
                  ] })
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  className: hideTimeInfo ? "opacity-20" : void 0,
                  color: "default",
                  size: "sm",
                  variant: "light",
                  onPress: () => {
                    BApi$1.options.patchUiOptions({
                      ...uiOptions,
                      resource: {
                        ...uiOptions.resource,
                        hideResourceTimeInfo: !hideTimeInfo
                      }
                    });
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdCalendarMonth, { className: "text-lg" })
                }
              ) })
            ] }),
            !hideTimeInfo && /* @__PURE__ */ jsxRuntimeExports.jsx(BasicInfo, { resource: resource2 })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-auto relative grow", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Properties,
              {
                noPropertyContent: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  "div",
                  {
                    className: "flex flex-col items-center gap-2 justify-center",
                    children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-4/5", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$V, { className: "text-base mr-1" }),
                      t2(
                        "No custom property bound. You can bind them in media library template"
                      )
                    ] })
                  }
                ),
                propertyClassNames: {
                  name: "justify-end"
                },
                reload: loadResource,
                resource: resource2,
                restrictedPropertyPool: PropertyPool.Custom
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1 mt-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Properties,
                {
                  propertyClassNames: {
                    name: "justify-end"
                  },
                  reload: loadResource,
                  resource: resource2,
                  restrictedPropertyIds: [ReservedProperty.Cover],
                  restrictedPropertyPool: PropertyPool.Reserved
                }
              ),
              resource2.playedAt && /* @__PURE__ */ jsxRuntimeExports.jsxs(
                "div",
                {
                  className: "grid gap-x-4 gap-y-1 undefined items-center overflow-visible",
                  style: {
                    gridTemplateColumns: "calc(120px) minmax(0, 1fr)"
                  },
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Chip,
                      {
                        className: "text-right justify-self-end",
                        color: "default",
                        radius: "sm",
                        size: "sm",
                        children: t2("Last played at")
                      }
                    ),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                      resource2.playedAt,
                      /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Mark as not played"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                        Button,
                        {
                          isIconOnly: true,
                          size: "sm",
                          variant: "light",
                          onPress: () => {
                            BApi$1.resource.markResourceAsNotPlayed(resource2.id).then((r2) => {
                              if (!r2.code) {
                                loadResource();
                              }
                            });
                          },
                          children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                            RefIcon$_,
                            {
                              className: "text-base opacity-60"
                            }
                          )
                        }
                      ) })
                    ] })
                  ]
                }
              )
            ] })
          ] })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Properties,
          {
            propertyInnerDirection: "ver",
            reload: loadResource,
            resource: resource2,
            restrictedPropertyIds: [ReservedProperty.Introduction],
            restrictedPropertyPool: PropertyPool.Reserved
          }
        ) })
      ] })
    }
  );
};
DetailDialog.displayName = "DetailDialog";
function defaultCategoryEnhancerTargetOptions(descriptor) {
  const eto = {
    target: descriptor.id
  };
  if (descriptor.optionsItems != void 0)
    ;
  return eto;
}
const DynamicTargetLabel = () => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      content: t2(
        "This is not a fixed enhancement target, which will be replaced with other content when data is collected"
      ),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$19, { className: "text-sm" })
    }
  );
};
DynamicTargetLabel.displayName = "DynamicTargetLabel";
[
  PropertyType.Multilevel,
  PropertyType.MultipleChoice,
  PropertyType.SingleChoice,
  PropertyType.Tags
];
const PropertyTip = ({
  // onAllowAddingNewDataDynamicallyEnabled,
  onPropertyBoundToCategory,
  property: property2,
  category
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const renderTips = () => {
    var _a2;
    const tips2 = [];
    if (((_a2 = category.customPropertyIds) == null ? void 0 : _a2.includes(property2.id)) != true && property2.pool == PropertyPool.Custom) {
      tips2.push(
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          t2(
            "This property is not bound to the category, its data will not be displayed."
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              size: "sm",
              variant: "light",
              onClick: () => {
                createPortal(Modal, {
                  title: t2(
                    "Bind property {{propertyName}} to category {{categoryName}}",
                    {
                      propertyName: property2.name,
                      categoryName: category.name
                    }
                  ),
                  defaultVisible: true,
                  onOk: async () => {
                    await BApi$1.category.bindCustomPropertyToCategory(
                      category.id,
                      property2.id
                    );
                    onPropertyBoundToCategory == null ? void 0 : onPropertyBoundToCategory();
                  }
                });
              },
              children: t2("Bind now")
            }
          )
        ] }, 2)
      );
    }
    return tips2;
  };
  const tips = renderTips();
  if (tips.length) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: tips }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      RefIcon$R,
      {
        className: "text-small cursor-pointer",
        style: { color: "var(--bakaui-warning)" }
      }
    ) });
  }
  return null;
};
PropertyTip.displayName = "PropertyTip";
const AutoMatchMultilevelString = ({ autoMatch, onChange }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "By default, an empty layer will be created if we meet an empty value in multilevel data."
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "If checked, this kind of data will be matched with the most similar multilevel value in the database."
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "For example, assume we already have a multilevel data: a->b->c, then for the incoming data: ->->c, the values of 1st and 2nd layers of which are empty."
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "If this option is checked, we'll save ->->c as a->b->c, otherwise the incoming value ->->c will be saved."
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "This option may cause unexpected behaviors, make sure you have enough confidence to merge the produced data into data in db before check it."
        ) })
      ] }),
      placement: "left",
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        checkbox_default,
        {
          isSelected: autoMatch,
          size: "sm",
          onValueChange: (c2) => {
            onChange == null ? void 0 : onChange(c2);
          },
          children: t2("Auto match on empty values")
        }
      )
    }
  ) });
};
AutoMatchMultilevelString.displayName = "AutoMatchMultilevelString";
const AutoBindProperty = ({ autoBindProperty, onChange }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "If this option is checked, a property with the same name and type of the target will be bound automatically."
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "If there isn't such a property, a new property will be created and bound to this target."
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "If this option is checked in default options of a dynamic target, all unlisted dynamic targets will be bound to properties of the same type with the same name."
        ) })
      ] }),
      placement: "left",
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        checkbox_default,
        {
          isSelected: autoBindProperty,
          size: "sm",
          onValueChange: onChange,
          children: t2("Auto bind property")
        }
      )
    }
  ) });
};
AutoBindProperty.displayName = "AutoBindProperty";
const CoverSelectOrder$1 = ({
  coverSelectOrder = CoverSelectOrder$2.FilenameAscending,
  onChange
}) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    radio_group_default,
    {
      orientation: "horizontal",
      size: "sm",
      value: coverSelectOrder.toString(),
      onValueChange: (c2) => {
        onChange == null ? void 0 : onChange(parseInt(c2, 10));
      },
      children: Object.keys(CoverSelectOrder$2).filter((x2) => !Number.isNaN(parseInt(x2, 10))).map((x2) => {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: x2, children: t2(`CoverSelectOrder.${CoverSelectOrder$2[parseInt(x2, 10)]}`) });
      })
    }
  );
};
CoverSelectOrder$1.displayName = "CoverSelectOrder";
const TargetOptions$1 = ({
  options: propsOptions,
  optionsItems,
  onChange
}) => {
  const [options, setOptions2] = reactExports.useState(propsOptions ?? {});
  reactExports.useEffect(() => {
    setOptions2(propsOptions ?? {});
  }, [propsOptions]);
  const patchOptions = (patches, triggerChange = true) => {
    const no = {
      ...options,
      ...patches
    };
    setOptions2(no);
    if (triggerChange) {
      onChange == null ? void 0 : onChange(no);
    }
  };
  const finalOptions = propsOptions ?? options;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: optionsItems == null ? void 0 : optionsItems.map((item, index2) => {
    switch (item) {
      case EnhancerTargetOptionsItem.AutoMatchMultilevelString:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          AutoMatchMultilevelString,
          {
            autoMatch: finalOptions.autoMatchMultilevelString ?? false,
            onChange: (o2) => patchOptions({ autoMatchMultilevelString: o2 })
          },
          item
        );
      case EnhancerTargetOptionsItem.AutoBindProperty:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          AutoBindProperty,
          {
            autoBindProperty: finalOptions.autoBindProperty ?? false,
            onChange: (o2) => patchOptions({ autoBindProperty: o2 })
          },
          item
        );
      case EnhancerTargetOptionsItem.CoverSelectOrder:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          CoverSelectOrder$1,
          {
            coverSelectOrder: finalOptions.coverSelectOrder,
            onChange: (o2) => patchOptions({ coverSelectOrder: o2 })
          },
          item
        );
    }
  }) });
};
TargetOptions$1.displayName = "TargetOptions";
const IntegrateWithSpecialTextLabel = ({ type: type4 }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  let tooltipContent = "";
  switch (type4) {
    case SpecialTextType.DateTime:
      tooltipContent = t2(
        "Data will be attempted to be converted into date&time data according to relevant conversions."
      );
      break;
    case SpecialTextType.Useless:
    case SpecialTextType.Language:
    case SpecialTextType.Wrapper:
    case SpecialTextType.Standardization:
    case SpecialTextType.Volume:
    case SpecialTextType.Trim:
      tooltipContent = t2("Data will be processed with special texts.");
      break;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        tooltipContent,
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          link_default,
          {
            className: "active:no-underline cursor-pointer",
            size: "sm",
            onClick: (e2) => {
              e2.preventDefault();
              e2.stopPropagation();
              createPortal(Modal, {
                title: t2("We are leaving current page"),
                children: t2("Are you sure?"),
                defaultVisible: true,
                onOk: () => {
                  window.location.href = "/text";
                }
              });
            },
            children: t2("Click to check special texts")
          }
        )
      ] }),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: t2("Integrate with special text") })
    }
  );
};
IntegrateWithSpecialTextLabel.displayName = "IntegrateWithSpecialTextLabel";
const StdValueSpecialTextIntegrationMap$1 = {
  [StandardValueType.DateTime]: SpecialTextType.DateTime
};
const log$p = buildLogger("TargetRow");
const TargetRow$1 = (props) => {
  var _a2;
  const { t: t2 } = useTranslation();
  const {
    target,
    dynamicTarget,
    options: propsOptions,
    onDeleted,
    otherDynamicTargetsInGroup,
    propertyMap,
    descriptor,
    category,
    onPropertyChanged,
    onCategoryChanged,
    enhancer,
    onChange
  } = props;
  const [options, setOptions2] = reactExports.useState(
    propsOptions ?? defaultCategoryEnhancerTargetOptions(descriptor)
  );
  const [dynamicTargetError, setDynamicTargetError] = reactExports.useState();
  const dynamicTargetInputValueRef = reactExports.useRef();
  const [editingDynamicTarget, setEditingDynamicTarget] = reactExports.useState(false);
  const { createPortal } = useBakabaseContext();
  const validateDynamicTarget = (newTarget) => {
    let error2;
    if (otherDynamicTargetsInGroup == null ? void 0 : otherDynamicTargetsInGroup.includes(newTarget)) {
      error2 = t2("Duplicate dynamic target is found");
    }
    if (newTarget.length == 0) {
      error2 = t2("This field is required");
    }
    if (dynamicTargetError != error2) {
      setDynamicTargetError(error2);
    }
    return error2 == void 0;
  };
  useUpdateEffect(() => {
    setOptions2(propsOptions ?? defaultCategoryEnhancerTargetOptions(descriptor));
  }, [propsOptions]);
  const patchTargetOptions = async (patches) => {
    const newOptions = {
      ...options,
      ...patches
    };
    setOptions2(newOptions);
    await BApi$1.category.patchCategoryEnhancerTargetOptions(
      category.id,
      enhancer.id,
      {
        target,
        dynamicTarget
      },
      patches
    );
    onChange == null ? void 0 : onChange(newOptions);
  };
  const unbindProperty = async () => {
    await BApi$1.category.unbindCategoryEnhancerTargetProperty(category.id, enhancer.id, {
      target,
      dynamicTarget
    });
    options.propertyId = void 0;
    setOptions2({ ...options });
    onChange == null ? void 0 : onChange(options);
  };
  const dt = options.dynamicTarget ?? dynamicTarget;
  const targetLabel = descriptor.isDynamic ? dt ?? t2("Default") : descriptor.name;
  const isDefaultTargetOfDynamic = descriptor.isDynamic && dt == void 0;
  const integratedSpecialTextType = StdValueSpecialTextIntegrationMap$1[descriptor.valueType];
  let property2;
  if (options.propertyPool != void 0 && options.propertyId != void 0) {
    property2 = (_a2 = propertyMap == null ? void 0 : propertyMap[options.propertyPool]) == null ? void 0 : _a2[options.propertyId];
  }
  const noPropertyBound = !options.autoBindProperty && (!options.propertyId || !options.propertyPool);
  log$p(props, options, propsOptions, property2);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `flex items-center gap-1 ${noPropertyBound ? "opacity-60" : ""}`, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-5/12", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
      noPropertyBound && /* @__PURE__ */ jsxRuntimeExports.jsx(
        Tooltip$1,
        {
          content: t2(
            "Target will not be applied because there is no property to store it."
          ),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$V, { className: "text-base text-warning" })
        }
      ),
      descriptor.isDynamic && !isDefaultTargetOfDynamic ? editingDynamicTarget ? /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          defaultValue: dynamicTargetInputValueRef.current,
          errorMessage: dynamicTargetError,
          isInvalid: dynamicTargetError != void 0,
          size: "sm",
          onBlur: () => {
            if (dynamicTargetInputValueRef.current != void 0 && dynamicTargetInputValueRef.current.length > 0) {
              patchTargetOptions({
                dynamicTarget: dynamicTargetInputValueRef.current
              });
            }
            dynamicTargetInputValueRef.current = void 0;
            setEditingDynamicTarget(false);
          },
          onValueChange: (v2) => {
            if (validateDynamicTarget(v2)) {
              dynamicTargetInputValueRef.current = v2;
            }
          }
        }
      ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          variant: "light",
          onClick: () => {
            dynamicTargetInputValueRef.current = dt;
            setEditingDynamicTarget(true);
          },
          children: [
            targetLabel ?? t2("Click to specify target"),
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$T, { className: "text-base" })
          ]
        }
      ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Chip,
          {
            variant: "light",
            children: targetLabel
          }
        ),
        integratedSpecialTextType && /* @__PURE__ */ jsxRuntimeExports.jsx(IntegrateWithSpecialTextLabel, { type: integratedSpecialTextType }),
        descriptor.description && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: descriptor.description, placement: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "text-base" }) })
      ] })
    ] }) }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-1/4", children: isDefaultTargetOfDynamic ? /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { variant: "light", children: "/" }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          color: property2 ? "success" : "primary",
          isDisabled: options == null ? void 0 : options.autoBindProperty,
          variant: "light",
          onClick: () => {
            createPortal(PropertySelector, {
              addable: true,
              editable: true,
              pool: PropertyPool.Custom | PropertyPool.Reserved,
              multiple: false,
              selection: property2 ? [property2] : [],
              onSubmit: async (properties2) => {
                patchTargetOptions({
                  propertyId: properties2[0].id,
                  propertyPool: properties2[0].pool
                });
                onPropertyChanged == null ? void 0 : onPropertyChanged();
              }
            });
          },
          children: property2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { property: property2 }) : t2("Select a property")
        }
      ),
      property2 && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          PropertyTip,
          {
            property: property2,
            category,
            onPropertyBoundToCategory: onCategoryChanged
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Unbind"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "danger",
            variant: "light",
            onClick: () => {
              unbindProperty();
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$V, { className: "text-base" })
          }
        ) })
      ] })
    ] }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-1/4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      TargetOptions$1,
      {
        options,
        optionsItems: descriptor.optionsItems,
        onChange: patchTargetOptions
      }
    ) }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-1/12", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: descriptor.isDynamic && !isDefaultTargetOfDynamic && /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        isIconOnly: true,
        color: "danger",
        size: "sm",
        variant: "light",
        onClick: () => {
          BApi$1.category.deleteCategoryEnhancerTargetOptions(category.id, enhancer.id, {
            target,
            dynamicTarget: dt
          });
          onDeleted == null ? void 0 : onDeleted();
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" })
      }
    ) }) })
  ] });
};
TargetRow$1.displayName = "TargetRow";
const log$o = buildLogger("DynamicTargets");
const DynamicTargets$1 = (props) => {
  const { t: t2 } = useTranslation();
  const forceUpdate = useUpdate();
  const {
    propertyMap,
    options: propsOptions,
    category,
    enhancer,
    onPropertyChanged,
    onCategoryChanged
  } = props;
  const dynamicTargetDescriptors = enhancer.targets.filter((x2) => x2.isDynamic);
  const [groups2, setGroups] = reactExports.useState([]);
  const [options, setOptions2] = reactExports.useState(propsOptions ?? {});
  const optionsRef = reactExports.useRef(options);
  reactExports.useEffect(() => {
  }, []);
  useUpdateEffect(() => {
    setOptions2(propsOptions ?? {});
  }, [propsOptions]);
  reactExports.useEffect(() => {
    optionsRef.current = options;
    updateGroups();
  }, [options]);
  const updateGroups = () => {
    const newGroups = dynamicTargetDescriptors.map((descriptor) => {
      var _a2, _b2;
      const subOptions = ((_b2 = (_a2 = optionsRef.current) == null ? void 0 : _a2.targetOptions) == null ? void 0 : _b2.filter(
        (x2) => x2.target == descriptor.id
      )) || [];
      let defaultOptions2 = subOptions.find((x2) => x2.dynamicTarget == void 0);
      if (defaultOptions2 == void 0) {
        defaultOptions2 = defaultCategoryEnhancerTargetOptions(descriptor);
      } else {
        const defaultIdx = subOptions.findIndex((x2) => x2 == defaultOptions2);
        subOptions.splice(defaultIdx, 1);
      }
      subOptions.splice(0, 0, defaultOptions2);
      return {
        descriptor,
        subOptions
      };
    });
    setGroups(newGroups);
    log$o("updateGroups", newGroups);
  };
  const createNewOptions = (descriptor, otherOptions) => {
    var _a2, _b2;
    const options2 = defaultCategoryEnhancerTargetOptions(descriptor);
    let maxNo = 0;
    if (otherOptions != void 0) {
      const regex2 = new RegExp(
        String.raw`^${t2("Target")}(?<no>\d+)$`,
        "g"
      );
      for (const o2 of otherOptions) {
        if (o2.dynamicTarget != void 0) {
          regex2.lastIndex = 0;
          const match5 = (_b2 = (_a2 = regex2.exec(o2.dynamicTarget)) == null ? void 0 : _a2.groups) == null ? void 0 : _b2.no;
          if (match5 != void 0) {
            const no = parseInt(match5, 10);
            if (no > maxNo) {
              maxNo = no;
            }
          }
        }
      }
    }
    options2.dynamicTarget = `${t2("Target")}${maxNo + 1}`;
    return options2;
  };
  log$o("rendering", options, groups2);
  return groups2.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-y-2", children: groups2.map((g2) => {
    const { descriptor, subOptions } = g2;
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { removeWrapper: true, "aria-label": "Dynamic target", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs(table_column_default, { width: "41.666667%", children: [
            descriptor.name,
            " ",
            /* @__PURE__ */ jsxRuntimeExports.jsx(DynamicTargetLabel, {})
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: "25%", children: t2("Save as property") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: "25%", children: t2("Other options") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Operations") })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, {})
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-y-2", children: subOptions.map((data, i2) => {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            TargetRow$1,
            {
              category,
              descriptor,
              dynamicTarget: data.dynamicTarget,
              enhancer,
              options: data,
              propertyMap,
              target: data.target,
              onCategoryChanged,
              onChange: (newOptions) => {
                Object.assign(data, newOptions);
                forceUpdate();
              },
              onDeleted: () => {
                var _a2, _b2;
                const idx = (_a2 = options.targetOptions) == null ? void 0 : _a2.findIndex(
                  (x2) => x2 == data
                );
                if (idx != void 0) {
                  (_b2 = options.targetOptions) == null ? void 0 : _b2.splice(idx, 1);
                  setOptions2({ ...options });
                }
              },
              onPropertyChanged
            },
            i2
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "horizontal" })
        ] });
      }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          color: "success",
          size: "sm",
          variant: "light",
          onClick: async () => {
            const newTargetOptions = createNewOptions(
              descriptor,
              subOptions
            );
            await BApi$1.category.patchCategoryEnhancerTargetOptions(
              category.id,
              enhancer.id,
              {
                target: descriptor.id,
                dynamicTarget: newTargetOptions.dynamicTarget
              },
              newTargetOptions
            );
            options.targetOptions ?? (options.targetOptions = []);
            options.targetOptions.push(newTargetOptions);
            setOptions2({ ...options });
            console.log("updating options", options);
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$m, { className: "text-sm" }),
            t2("Specify dynamic target")
          ]
        }
      )
    ] });
  }) }) : null;
};
DynamicTargets$1.displayName = "DynamicTargets";
const FixedTargets$1 = (props) => {
  const { t: t2 } = useTranslation();
  const {
    propertyMap,
    options,
    category,
    enhancer,
    onPropertyChanged,
    onCategoryChanged
  } = props;
  const fixedTargets = enhancer.targets.filter((t22) => !t22.isDynamic);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { removeWrapper: true, "aria-label": "Fixed targets", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: "41.666667%", children: t2("Enhancement target") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: "25%", children: t2("Save as property") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: "25%", children: t2("Other options") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Operations") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, {})
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-y-2", children: fixedTargets.map((target, i2) => {
      var _a2;
      const targetOptions = (_a2 = options == null ? void 0 : options.targetOptions) == null ? void 0 : _a2.find(
        (x2) => x2.target == target.id
      );
      const targetDescriptor = enhancer.targets.find(
        (x2) => x2.id == target.id
      );
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          TargetRow$1,
          {
            category,
            descriptor: targetDescriptor,
            enhancer,
            options: targetOptions,
            propertyMap,
            target: target.id,
            onCategoryChanged,
            onPropertyChanged
          },
          `${target.id}-${targetOptions == null ? void 0 : targetOptions.dynamicTarget}`
        ),
        fixedTargets.length - 1 !== i2 && /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "horizontal" })
      ] });
    }) })
  ] });
};
FixedTargets$1.displayName = "FixedTargets";
const log$n = buildLogger("RegexEnhancerOptions");
const extractCaptureGroups$1 = (expressions) => expressions.reduce((s2, t2) => {
  s2.push(...findCapturingGroupsInRegex(t2));
  return s2;
}, []);
const RegexEnhancerOptions = ({
  options: propsOptions,
  enhancer,
  propertyMap,
  category,
  onPropertyChanged,
  onCategoryChanged
}) => {
  var _a2, _b2, _c2;
  const { t: t2 } = useTranslation();
  const enhancerOptions = useEnhancerOptionsStore((state) => state.data);
  const [tmpEnhancerOptions, setTmpEnhancerOptions] = reactExports.useState(
    enhancerOptions || {}
  );
  const tmpEnhancerOptionsRef = reactExports.useRef(tmpEnhancerOptions);
  const [options, setOptions2] = reactExports.useState(propsOptions);
  const optionsRef = reactExports.useRef(options);
  useUpdate();
  useUpdateEffect(() => {
    optionsRef.current = propsOptions;
    addCaptureGroupsToOptions();
  }, [propsOptions]);
  useUpdateEffect(() => {
    optionsRef.current = options;
  }, [options]);
  reactExports.useEffect(() => {
    log$n("new enhancer options", enhancerOptions);
    setTmpEnhancerOptions(JSON.parse(JSON.stringify(enhancerOptions || {})));
  }, [enhancerOptions]);
  useUpdateEffect(() => {
    tmpEnhancerOptionsRef.current = tmpEnhancerOptions;
    addCaptureGroupsToOptions();
  }, [tmpEnhancerOptions]);
  const addCaptureGroupsToOptions = () => {
    var _a3, _b3, _c3, _d, _e, _f, _g;
    const newOptions = {};
    const expressions2 = ((_b3 = (_a3 = tmpEnhancerOptionsRef.current) == null ? void 0 : _a3.regexEnhancer) == null ? void 0 : _b3.expressions) || [];
    const captureGroups2 = extractCaptureGroups$1(expressions2);
    log$n(captureGroups2, (_c3 = optionsRef.current) == null ? void 0 : _c3.targetOptions);
    if ((_e = (_d = optionsRef.current) == null ? void 0 : _d.targetOptions) == null ? void 0 : _e.length) {
      newOptions.targetOptions = optionsRef.current.targetOptions.filter(
        (x2) => x2.dynamicTarget == void 0 || captureGroups2.includes(x2.dynamicTarget)
      );
    }
    for (const cg2 of captureGroups2) {
      newOptions.targetOptions ?? (newOptions.targetOptions = []);
      if (!((_g = (_f = optionsRef.current) == null ? void 0 : _f.targetOptions) == null ? void 0 : _g.find(
        (x2) => x2.target == RegexEnhancerTarget.CaptureGroups && x2.dynamicTarget == cg2
      ))) {
        newOptions.targetOptions.push({
          target: RegexEnhancerTarget.CaptureGroups,
          dynamicTarget: cg2
        });
      }
    }
    log$n(newOptions);
    setOptions2({ ...newOptions });
  };
  const expressions = ((_a2 = tmpEnhancerOptions == null ? void 0 : tmpEnhancerOptions.regexEnhancer) == null ? void 0 : _a2.expressions) || [];
  const captureGroups = extractCaptureGroups$1(expressions);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      textarea_default,
      {
        description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          captureGroups.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
            t2("Available capture groups:"),
            captureGroups.map((g2) => {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "light", children: g2 });
            })
          ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
            "No named capture groups were found, so the enhancement will not take effect."
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
            "You can set multiple regex expressions(separated by new line) to match the file or folder name of each resource."
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
            "Text matched by multiple capture groups with the same name will be merged into a list and deduplicated."
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
            "After setting regex expressions, you must go to category page to configure regex enhancer for each category."
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
            "You need to use the same name(index-based group name will be ignored) as the capture group for the dynamic enhancement target, otherwise the resource may not be enhanced."
          ) })
        ] }),
        label: t2("Regex expressions"),
        maxRows: 10,
        minRows: 3,
        value: (_c2 = (_b2 = tmpEnhancerOptions == null ? void 0 : tmpEnhancerOptions.regexEnhancer) == null ? void 0 : _b2.expressions) == null ? void 0 : _c2.join("\n"),
        onBlur: () => {
          BApi$1.options.patchEnhancerOptions(tmpEnhancerOptions).then((r2) => {
            if (!r2.code) {
              Vt.success(t2("Successfully saved"));
            }
          });
        },
        onValueChange: (v2) => {
          setTmpEnhancerOptions({
            ...tmpEnhancerOptions,
            regexEnhancer: {
              ...(tmpEnhancerOptions == null ? void 0 : tmpEnhancerOptions.regexEnhancer) || {},
              expressions: v2.split("\n")
            }
          });
        }
      }
    ) }),
    options && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-y-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      DynamicTargets$1,
      {
        category,
        enhancer,
        options,
        propertyMap,
        onCategoryChanged,
        onPropertyChanged
      }
    ) })
  ] });
};
RegexEnhancerOptions.displayName = "RegexEnhancerOptions";
const CategoryEnhancerOptionsDialog = ({
  enhancer,
  categoryId,
  onDestroyed
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  useUpdate();
  const [category, setCategory] = reactExports.useState({
    id: 0,
    name: "",
    customPropertyIds: []
  });
  const [options, setOptions2] = reactExports.useState();
  const [propertyMap, setPropertyMap] = reactExports.useState({});
  const init2 = async () => {
    await loadCategory();
    await loadAllProperties();
    await loadOptions();
  };
  reactExports.useEffect(() => {
    init2();
  }, []);
  const loadOptions = async () => {
    const { data } = await BApi$1.category.getCategoryEnhancerOptions(
      categoryId,
      enhancer.id
    );
    setOptions2((data == null ? void 0 : data.options) || {});
  };
  const loadCategory = async () => {
    var _a2, _b2, _c2, _d, _e, _f;
    const r2 = await BApi$1.category.getCategory(
      categoryId,
      // @ts-ignore
      {
        additionalItems: CategoryAdditionalItem.EnhancerOptions | CategoryAdditionalItem.CustomProperties
      }
    );
    setCategory({
      id: ((_a2 = r2.data) == null ? void 0 : _a2.id) ?? 0,
      name: ((_b2 = r2.data) == null ? void 0 : _b2.name) ?? "",
      customPropertyIds: (((_c2 = r2.data) == null ? void 0 : _c2.customProperties) ?? []).map((p2) => p2.id)
    });
    const ceo = ((_f = (_e = (_d = r2.data) == null ? void 0 : _d.enhancerOptions) == null ? void 0 : _e.find(
      (x2) => x2.enhancerId == enhancer.id
    )) == null ? void 0 : _f.options) ?? {};
    setOptions2(ceo);
  };
  const loadAllProperties = async () => {
    const psr = (await BApi$1.property.getPropertiesByPool(PropertyPool.All)).data || [];
    const ps = psr.reduce(
      (s2, t22) => {
        const pt = t22.pool;
        s2[pt] ?? (s2[pt] = {});
        s2[pt][t22.id] = t22;
        return s2;
      },
      {}
    );
    setPropertyMap(ps);
  };
  console.log(options);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel"]
      },
      size: "full",
      title: t2(
        "Configure enhancer:{{enhancerName}} for category:{{categoryName}}",
        {
          enhancerName: enhancer.name,
          categoryName: category.name
        }
      ),
      onDestroyed,
      children: enhancer.id == EnhancerId.Regex ? /* @__PURE__ */ jsxRuntimeExports.jsx(
        RegexEnhancerOptions,
        {
          category,
          enhancer,
          options,
          propertyMap,
          onCategoryChanged: loadCategory,
          onPropertyChanged: loadAllProperties
        }
      ) : options && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-y-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          FixedTargets$1,
          {
            category,
            enhancer,
            options,
            propertyMap,
            onCategoryChanged: loadCategory,
            onPropertyChanged: loadAllProperties
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          DynamicTargets$1,
          {
            category,
            enhancer,
            options,
            propertyMap,
            onCategoryChanged: loadCategory,
            onPropertyChanged: loadAllProperties
          }
        )
      ] })
    }
  );
};
CategoryEnhancerOptionsDialog.show = (props) => createPortalOfComponent(CategoryEnhancerOptionsDialog, props);
function ResourceEnhancementsDialog({ resourceId, ...props }) {
  const [enhancements, setEnhancements] = reactExports.useState([]);
  const [resource2, setResource] = reactExports.useState({
    path: "",
    categoryId: 0
  });
  const { t: t2 } = useTranslation();
  const [enhancing, setEnhancing] = reactExports.useState(false);
  const [applyingContext, setApplyingContext] = reactExports.useState(false);
  reactExports.useEffect(() => {
    loadEnhancements();
    BApi$1.resource.getResourcesByKeys({ ids: [resourceId] }).then((r2) => {
      var _a2, _b2;
      const data = r2.data || [];
      setResource({
        path: ((_a2 = data[0]) == null ? void 0 : _a2.path) || "",
        categoryId: ((_b2 = data[0]) == null ? void 0 : _b2.categoryId) ?? 0
      });
    });
  }, []);
  const loadEnhancements = reactExports.useCallback(async () => {
    var _a2;
    const r2 = await BApi$1.resource.getResourceEnhancements(resourceId, {
      additionalItem: EnhancementAdditionalItem.GeneratedPropertyValue
    });
    const data = r2.data || [];
    for (const d2 of data) {
      (_a2 = d2.dynamicTargets) == null ? void 0 : _a2.forEach((dt) => {
        var _a3;
        (_a3 = dt.enhancements) == null ? void 0 : _a3.forEach((e2) => {
          e2.value = convertFromApiValue(e2.value, e2.valueType);
          const v2 = e2.customPropertyValue;
          const p2 = e2.property;
          if (p2 && v2) {
            v2.value = convertFromApiValue(v2.value, p2.dbValueType);
            v2.bizValue = convertFromApiValue(v2.bizValue, p2.bizValueType);
          }
        });
      });
    }
    setEnhancements(data);
  }, []);
  console.log(enhancements);
  const renderConvertedValue = (e2) => {
    if (!e2 || e2.propertyPool == void 0 || e2.propertyId == void 0 || e2.property == void 0) {
      return;
    }
    const { property: property2 } = e2;
    switch (e2.propertyPool) {
      case PropertyPool.Reserved: {
        const rv = e2.reservedPropertyValue;
        if (!rv) {
          return;
        }
        let bizRv;
        let dbRv;
        switch (e2.propertyId) {
          case ReservedProperty.Introduction:
            bizRv = rv.introduction;
            dbRv = rv.introduction;
            break;
          case ReservedProperty.Rating:
            bizRv = rv.rating;
            dbRv = rv.rating;
            break;
          case ReservedProperty.Cover:
            bizRv = rv.coverPaths;
            dbRv = rv.coverPaths;
            break;
          case ReservedProperty.PlayedAt:
            bizRv = new dayjs_minExports.Dayjs(rv.playedAt);
            dbRv = new dayjs_minExports.Dayjs(rv.playedAt);
            break;
          default:
            return t2("Unsupported reserved property type: {{type}}", {
              type: e2.propertyId
            });
        }
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          PropertyValueRenderer,
          {
            bizValue: serializeStandardValue(bizRv, property2.bizValueType),
            dbValue: serializeStandardValue(dbRv, property2.dbValueType),
            property: property2,
            variant: "light"
          }
        );
      }
      case PropertyPool.Custom: {
        const pv = e2.customPropertyValue;
        if (!pv) {
          return;
        }
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          PropertyValueRenderer,
          {
            bizValue: serializeStandardValue(
              pv.bizValue,
              property2.bizValueType
            ),
            dbValue: serializeStandardValue(pv.value, property2.dbValueType),
            property: property2,
            variant: "light"
          }
        );
      }
      case PropertyPool.Internal:
      case PropertyPool.All:
        return t2("Unsupported property type: {{type}}", {
          type: e2.propertyPool
        });
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok"]
      },
      size: "full",
      title: t2("Enhancement records"),
      onDestroyed: props.onDestroyed,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Path of resource") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(snippet_default, { size: "sm", symbol: "", children: resource2.path })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Tabs,
          {
            isVertical: true,
            "aria-label": "Enhancers",
            classNames: {
              panel: "grow min-w-0"
            },
            variant: "bordered",
            children: enhancements.map((e2) => {
              var _a2;
              const { targets } = e2;
              return /* @__PURE__ */ jsxRuntimeExports.jsxs(Tab, { title: e2.enhancer.name, children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        Chip,
                        {
                          color: "secondary",
                          radius: "sm",
                          variant: "light",
                          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                            t2("Data created at"),
                            /* @__PURE__ */ jsxRuntimeExports.jsx(
                              Tooltip$1,
                              {
                                className: "max-w-[500px]",
                                color: "secondary",
                                content: t2(
                                  "The data has been created, indicating that the enhancer has completed the data retrieval process, which is typically done by accessing third-party sites or executing specific internal logic. You can check the status of the data retrieval in the table below. Frequent repeated data retrieval attempts may result in access denial from third-party services."
                                ),
                                placement: "top",
                                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" })
                              }
                            )
                          ] })
                        }
                      ),
                      e2.contextCreatedAt ?? t2("None")
                    ] }),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        Chip,
                        {
                          color: "secondary",
                          radius: "sm",
                          variant: "light",
                          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                            t2("Data applied at"),
                            /* @__PURE__ */ jsxRuntimeExports.jsx(
                              Tooltip$1,
                              {
                                className: "max-w-[500px]",
                                color: "secondary",
                                content: t2(
                                  "The application of data indicates that the retrieved data has been successfully converted into attribute values. This step is conducted entirely within the program, without involving any third-party data exchange."
                                ),
                                placement: "top",
                                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" })
                              }
                            )
                          ] })
                        }
                      ),
                      e2.contextAppliedAt ?? t2("None")
                    ] }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Tooltip$1,
                      {
                        className: "max-w-[500px]",
                        color: "secondary",
                        content: t2(
                          "Retrieve data then apply data. To reduce the possibility of access denial from third-party services, it is recommended to apply data only after all data has been retrieved. Configuring enhancer options in category won't affect the data retrieval process, it only affects the data applying process."
                        ),
                        children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
                          Button,
                          {
                            color: e2.status == EnhancementRecordStatus.ContextApplied || e2.status == EnhancementRecordStatus.ContextCreated ? "warning" : "primary",
                            isLoading: enhancing,
                            size: "sm",
                            variant: "light",
                            onClick: () => {
                              setEnhancing(true);
                              BApi$1.resource.enhanceResourceByEnhancer(resourceId, e2.enhancer.id).then(() => {
                                loadEnhancements();
                                setEnhancing(false);
                              });
                            },
                            children: [
                              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$7, { className: "text-base" }),
                              t2(
                                e2.status == EnhancementRecordStatus.ContextApplied ? "Re-enhance now" : "Enhance now"
                              )
                            ]
                          }
                        )
                      }
                    ),
                    (e2.status == EnhancementRecordStatus.ContextApplied || e2.status == EnhancementRecordStatus.ContextCreated) && /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Tooltip$1,
                      {
                        color: "secondary",
                        content: t2(
                          "Apply the data to property values of the resource."
                        ),
                        children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
                          Button,
                          {
                            color: "primary",
                            isLoading: applyingContext,
                            size: "sm",
                            variant: "light",
                            onClick: () => {
                              setApplyingContext(true);
                              BApi$1.resource.applyEnhancementContextDataForResourceByEnhancer(
                                resourceId,
                                e2.enhancer.id
                              ).then(() => {
                                loadEnhancements();
                                setApplyingContext(false);
                              });
                            },
                            children: [
                              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$18, { className: "text-base" }),
                              t2("Apply data")
                            ]
                          }
                        )
                      }
                    )
                  ] }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      color: "primary",
                      size: "sm",
                      variant: "light",
                      onClick: () => {
                        CategoryEnhancerOptionsDialog.show({
                          categoryId: resource2.categoryId,
                          enhancer: e2.enhancer
                        });
                      },
                      children: t2("Check configuration")
                    }
                  ) })
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-y-2 min-w-0", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                    targets.every((x2) => !x2.enhancement) && /* @__PURE__ */ jsxRuntimeExports.jsxs(
                      Chip,
                      {
                        className: "opacity-60",
                        radius: "sm",
                        size: "sm",
                        variant: "light",
                        children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, { className: "text-sm mr-1" }),
                          t2(
                            "No data retrieved for fixed targets, please check configuration if necessary"
                          )
                        ]
                      }
                    ),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isStriped: true, className: "break-all", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Target") }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Raw data") }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Generated custom property value") })
                      ] }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: targets.map((e22) => {
                        var _a3;
                        return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: e22.targetName }),
                          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: JSON.stringify((_a3 = e22.enhancement) == null ? void 0 : _a3.value) }),
                          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: renderConvertedValue(e22.enhancement) })
                        ] });
                      }) })
                    ] })
                  ] }),
                  (_a2 = e2.dynamicTargets) == null ? void 0 : _a2.map((dt) => {
                    var _a3, _b2;
                    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                      (!dt.enhancements || dt.enhancements.length == 0) && /* @__PURE__ */ jsxRuntimeExports.jsxs(
                        Chip,
                        {
                          className: "opacity-60",
                          radius: "sm",
                          size: "sm",
                          variant: "light",
                          children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx(
                              RefIcon$R,
                              {
                                className: "text-sm mr-1"
                              }
                            ),
                            t2(
                              "No data retrieved for dynamic targets, please check configuration if necessary"
                            )
                          ]
                        }
                      ),
                      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isStriped: true, className: "break-all", children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsxs(table_column_default, { children: [
                            dt.targetName,
                            "(",
                            ((_a3 = dt.enhancements) == null ? void 0 : _a3.length) ?? 0,
                            ")"
                          ] }),
                          /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Raw data") }),
                          /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Generated custom property value") })
                        ] }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: (_b2 = dt.enhancements) == null ? void 0 : _b2.map((e22) => {
                          return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: e22.dynamicTarget }),
                            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: JSON.stringify(e22.value) }),
                            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: renderConvertedValue(e22) })
                          ] });
                        }) })
                      ] })
                    ] });
                  })
                ] })
              ] }, e2.enhancer.id);
            })
          }
        )
      ]
    }
  );
}
ResourceEnhancementsDialog.show = (props) => createPortalOfComponent(ResourceEnhancementsDialog, props);
const modeTips = {
  [CoverSaveMode.Prepend]: "As the first cover",
  [CoverSaveMode.Replace]: "Current covers will be discard"
};
const CoverSaveButton = (props) => {
  const { t: t2 } = useTranslation();
  const { disabledReason, getDataURL, resourceId } = props;
  const resourceOptions = useResourceOptionsStore((state) => state.data);
  const { saveMode } = resourceOptions.coverOptions ?? {};
  const externalDisabled = !!disabledReason;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 p-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Please select mode") }),
        coverSaveModes.map((c2) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: saveMode == c2.value ? "primary" : "default",
                size: "sm",
                onClick: () => {
                  BApi$1.options.patchResourceOptions({
                    ...resourceOptions,
                    coverOptions: {
                      ...resourceOptions.coverOptions,
                      saveMode: c2.value
                    }
                  });
                },
                children: t2(c2.label)
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(modeTips[c2.value]) })
          ] });
        })
      ] }),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isDisabled: externalDisabled,
          size: "sm",
          onClick: () => {
            if (saveMode != void 0) {
              BApi$1.resource.saveCover(resourceId, {
                base64String: getDataURL(),
                saveMode
              }).then((r2) => {
                Vt.success(t2("Saved"));
              });
            }
          },
          children: externalDisabled ? disabledReason : saveMode == void 0 ? t2("Please select cover save mode first") : saveMode == CoverSaveMode.Prepend ? t2("Prepend to covers") : t2("Replace cover")
        }
      )
    }
  );
};
CoverSaveButton.displayName = "CoverSaveButton";
dayjs.extend(duration);
const ShowResourceMediaPlayer = (resourceId, resourcePath, onSaveAsNewCover, t2, isSingleFileResource) => {
  console.log("Showing resource media player");
  BApi$1.file.getAllFiles({
    path: resourcePath
  }).then((a2) => {
    if (!a2.code && a2.data) {
      if (a2.data.length == 0) {
        return toast.info(t2("No files to preview"));
      }
      const files = a2.data;
      MediaPlayer.show({
        id: "media-player",
        files: files.map((f2) => ({
          path: f2
        })),
        defaultActiveIndex: 0,
        renderOperations: (filePath, mediaType, playing, reactPlayer, image2) => {
          console.log(filePath, mediaType, playing, reactPlayer);
          console.log(reactPlayer, reactPlayer == null ? void 0 : reactPlayer.getDuration());
          const components2 = [
            // (
            //   <Button
            //     type={'normal'}
            //     onClick={() => {
            //       FavoritesSelector.show({
            //         resourceIds: [resourceId],
            //       });
            //     }}
            //   >
            //     <CustomIcon type={'star'} />
            //     {t<string>('Add resource to favorites')}
            //   </Button>
            // ),
          ];
          switch (mediaType) {
            case MediaType.Video: {
              components2.push(
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  CoverSaveButton,
                  {
                    disabledReason: playing ? t2("Available when video is paused") : void 0,
                    getDataURL: () => {
                      const frame2 = captureVideoFrame(
                        reactPlayer.getInternalPlayer(),
                        "jpeg",
                        1
                      );
                      if (frame2) {
                        return frame2.dataUri;
                      } else {
                        const msg = t2("Failed to capture video frame");
                        toast.error(msg);
                        throw new Error(msg);
                      }
                    },
                    resourceId
                  }
                )
              );
            }
            case MediaType.Image: {
              if (image2) {
                components2.push(
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    CoverSaveButton,
                    {
                      getDataURL: () => {
                        let canvas = document.createElement("canvas");
                        canvas.width = image2.width;
                        canvas.height = image2.height;
                        let ctx = canvas.getContext("2d");
                        ctx.drawImage(image2, 0, 0);
                        return canvas.toDataURL();
                      },
                      resourceId
                    }
                  )
                );
              }
              break;
            }
          }
          return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "operations", children: components2 });
        }
      });
    }
  });
};
ShowResourceMediaPlayer.displayName = "ShowResourceMediaPlayer";
const Operations = ({ resource: resource2, coverRef, reload }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    PopoverComponent,
    {
      style: {
        zIndex: 20
      },
      trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          className: "absolute top-1 right-1 z-10 opacity-0 group-hover/resource:opacity-100",
          size: "sm",
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$k, { className: "text-lg" })
        }
      ),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-3 gap-1 py-1 rounded", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: resource2.pinned ? "warning" : "default",
            size: "sm",
            title: resource2.pinned ? t2("Unpin") : t2("Pin"),
            onClick: () => {
              BApi$1.resource.pinResource(resource2.id, { pin: !resource2.pinned }).then((r2) => {
                reload == null ? void 0 : reload();
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$i, { className: "text-lg" })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            title: t2("Open folder"),
            onClick: () => BApi$1.tool.openFileOrDirectory({
              path: resource2.path,
              openInDirectory: resource2.isFile
            }),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$G, { className: "text-lg" })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            title: t2("Enhancements"),
            onClick: () => {
              BApi$1.resource.getResourceEnhancements(resource2.id, {
                additionalItem: EnhancementAdditionalItem.GeneratedPropertyValue
              }).then((t22) => {
                createPortal(ResourceEnhancementsDialog, {
                  resourceId: resource2.id,
                  // @ts-ignore
                  enhancements: t22.data || []
                });
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$I, { className: "text-lg" })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            title: t2("Preview"),
            onClick: () => {
              ShowResourceMediaPlayer(
                resource2.id,
                resource2.path,
                (base64String) => {
                  coverRef == null ? void 0 : coverRef.save(base64String);
                },
                t2,
                resource2.isFile
              );
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePicture, { className: "text-lg" })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            title: t2("Add to playlist"),
            onClick: () => {
              createPortal(Modal, {
                defaultVisible: true,
                title: t2("Add to playlist"),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(Collection, { addingResourceId: resource2.id }),
                style: { minWidth: 600 },
                footer: {
                  actions: ["cancel"]
                }
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1, { className: "text-lg" })
          }
        )
      ] })
    }
  );
};
Operations.displayName = "Operations";
const log$m = buildLogger("TaskCover");
const TaskCover = ({ resource: resource2, reload, onTasksChange }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const forceUpdate = useUpdate();
  const tasksRef = reactExports.useRef([]);
  reactExports.useEffect(() => {
    const unsubscribe = useBTasksStore.subscribe(() => {
      var _a2;
      const tasks = ((_a2 = useBTasksStore.getState().tasks) == null ? void 0 : _a2.filter(
        (t22) => {
          var _a3;
          return t22.resourceType == BTaskResourceType.Resource && ((_a3 = t22.resourceKeys) == null ? void 0 : _a3.some((x2) => x2 == resource2.id)) && (t22.status == BTaskStatus.Running || t22.status == BTaskStatus.Paused || t22.status == BTaskStatus.Error || t22.status == BTaskStatus.NotStarted || t22.status == BTaskStatus.Completed);
        }
      )) ?? [];
      if (tasks.length > 0 || tasksRef.current.length > 0) {
        const taskIds = _$2.uniq(tasks.concat(tasksRef.current).map((t22) => t22.id));
        const actions = /* @__PURE__ */ new Set();
        for (const taskId of taskIds) {
          const task = tasks.find((t22) => t22.id == taskId);
          const prevTask = tasksRef.current.find((t22) => t22.id == taskId);
          const differences = diff$1(prevTask, task);
          if (differences) {
            log$m(
              "TaskChanged",
              differences,
              "current: ",
              task,
              "previous: ",
              prevTask
            );
            actions.add(
              1
              /* Update */
            );
            if ((prevTask == null ? void 0 : prevTask.status) != (task == null ? void 0 : task.status) && (task == null ? void 0 : task.status) == BTaskStatus.Completed) {
              log$m("need reload");
              actions.add(
                2
                /* Reload */
              );
            }
          }
        }
        if (actions.has(
          1
          /* Update */
        )) {
          forceUpdate();
        }
        if (actions.has(
          2
          /* Reload */
        )) {
          reload == null ? void 0 : reload();
        }
        if (actions.size > 0) {
          onTasksChange == null ? void 0 : onTasksChange(tasks);
        }
        tasksRef.current = tasks;
      }
    });
    return () => {
      unsubscribe();
    };
  }, []);
  const displayingTask = _$2.sortBy(tasksRef.current, (x2) => {
    switch (x2.status) {
      case BTaskStatus.Error:
        return -1;
      case BTaskStatus.Running:
        return 0;
      case BTaskStatus.Paused:
        return 1;
      case BTaskStatus.NotStarted:
        return 2;
      case BTaskStatus.Completed:
      case BTaskStatus.Cancelled:
        return 999;
    }
  }).filter(
    (t22) => t22.status == BTaskStatus.Running || t22.status == BTaskStatus.Paused || t22.status == BTaskStatus.Error || t22.status == BTaskStatus.NotStarted
  )[0];
  if (!displayingTask) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: "absolute top-0 left-0 z-20 w-full h-full flex flex-col items-center justify-center gap-3",
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: "absolute top-0 left-0 bg-black opacity-80 w-full h-full"
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-bold z-20", children: displayingTask.name }),
        displayingTask.error ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "font-bold z-20 flex items-center group", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Chip,
            {
              className: "cursor-pointer",
              color: "danger",
              variant: "light",
              onClick: () => createPortal(Modal, {
                defaultVisible: true,
                title: t2("Error"),
                size: "xl",
                children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: displayingTask.error })
              }),
              children: t2("Error")
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "danger",
              size: "sm",
              variant: "light",
              onClick: () => {
                BApi$1.backgroundTask.cleanBackgroundTask(displayingTask.id);
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$_, { className: "text-sm" })
            }
          )
        ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-bold z-20", children: displayingTask.status == BTaskStatus.NotStarted ? t2("Waiting") : `${displayingTask.percentage}%` }),
        displayingTask.error ? null : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-bold z-20", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          BTaskStopButton,
          {
            color: "danger",
            id: displayingTask.id,
            size: "sm"
          }
        ) })
      ]
    }
  );
};
TaskCover.displayName = "TaskCover";
const DeprecatedChip = ({
  className,
  size: size2 = "sm",
  variant = "flat",
  color: color2 = "danger",
  tooltipContent,
  showTooltip = true
}) => {
  const { t: t2 } = useTranslation();
  const defaultTooltipContent = t2(
    "This feature is deprecated and may be removed in future versions. Please consider using the recommended alternative."
  );
  const chip2 = /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { className, color: color2, size: size2, variant, children: t2("Deprecated") });
  if (!showTooltip) {
    return chip2;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      color: "foreground",
      content: tooltipContent || defaultTooltipContent,
      placement: "top",
      children: chip2
    }
  );
};
DeprecatedChip.displayName = "DeprecatedChip";
buildLogger("MediaLibraryPathSelectorV2");
const MediaLibraryPathSelectorV2 = (props) => {
  const { t: t2 } = useTranslation();
  const { onSelect, confirmation } = props;
  const { createPortal } = useBakabaseContext();
  const [visible, setVisible] = reactExports.useState(true);
  const [categories, setCategories] = reactExports.useState([]);
  const [keyword, setKeyword] = reactExports.useState();
  const fsOptions = useFileSystemOptionsStore((state) => state.data);
  const init2 = async () => {
    var _a2;
    const mls = (await BApi$1.mediaLibrary.getAllMediaLibraries({
      additionalItems: MediaLibraryAdditionalItem.Category
    })).data ?? [];
    const data = {};
    for (const ml2 of mls) {
      const paths = (_a2 = ml2.pathConfigurations) == null ? void 0 : _a2.map((pc2) => pc2.path).filter((x2) => x2 != null);
      if (paths && paths.length > 0) {
        if (!(ml2.categoryId in data)) {
          data[ml2.categoryId] = {
            id: ml2.categoryId,
            name: ml2.category.name,
            libraries: []
          };
        }
        const { libraries } = data[ml2.categoryId];
        libraries.push({
          id: ml2.id,
          name: ml2.name,
          paths
        });
      }
    }
    const mlv2s = (await BApi$1.mediaLibraryV2.getAllMediaLibraryV2()).data ?? [];
    if (mlv2s.length > 0) {
      data[0] = {
        id: 0,
        name: t2("/"),
        libraries: mlv2s.map((ml2) => ({
          id: ml2.id,
          name: ml2.name,
          paths: ml2.paths
        }))
      };
    }
    setCategories(Object.values(data));
  };
  reactExports.useEffect(() => {
    init2();
    return () => {
    };
  }, []);
  const recentlySelectedPaths = ((fsOptions == null ? void 0 : fsOptions.recentMovingDestinations) || []).map(
    (a2) => standardizePath(a2)
  );
  const lowerCasedKeyword = (keyword == null ? void 0 : keyword.toLowerCase()) ?? "";
  const filteredCategories = keyword != void 0 && (keyword == null ? void 0 : keyword.length) > 0 ? categories.map((a2) => {
    if (a2.name.toLowerCase().indexOf(lowerCasedKeyword) > -1) {
      return a2;
    } else {
      const filteredLibraries = (a2.libraries || []).map((b2) => {
        if (b2.name.toLowerCase().indexOf(lowerCasedKeyword) > -1) {
          return b2;
        } else {
          const filteredPaths = b2.paths.filter((c2) => {
            return c2.toLowerCase().indexOf(lowerCasedKeyword) > -1;
          });
          return {
            ...b2,
            paths: filteredPaths
          };
        }
      }).filter((b2) => b2.paths.length > 0);
      return {
        ...a2,
        libraries: filteredLibraries
      };
    }
  }).filter((c2) => c2.libraries.length > 0) : categories;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      footer: false,
      size: "lg",
      title: t2("Select a path"),
      visible,
      onClose: () => {
        setVisible(false);
      },
      onDestroyed: props.onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            placeholder: t2("Quick filter"),
            size: "sm",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1h, { className: "text-base" }),
            value: keyword,
            onValueChange: (v2) => setKeyword(v2)
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "py-2", children: filteredCategories.map((c2, ic2) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs(
              "div",
              {
                className: "grid gap-1 items-center",
                style: { gridTemplateColumns: "20% auto" },
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flexi items-center gap-1", children: [
                    c2.name,
                    c2.id != 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(DeprecatedChip, {})
                  ] }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: c2.libraries.map((l2, il2) => {
                    return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsxs(
                        "div",
                        {
                          className: "grid gap-1 items-center",
                          style: { gridTemplateColumns: "20% auto" },
                          children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: l2.name }),
                            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: l2.paths.map((path) => {
                              const selectedRecently = recentlySelectedPaths.indexOf(
                                standardizePath(path)
                              ) > -1;
                              return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                                Button,
                                {
                                  color: selectedRecently ? "success" : "primary",
                                  size: "sm",
                                  variant: "light",
                                  onPress: () => {
                                    if (confirmation) {
                                      createPortal(Modal, {
                                        defaultVisible: true,
                                        title: t2(
                                          "Are you sure to select this path?"
                                        ),
                                        children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
                                          "div",
                                          {
                                            className: "flex items-center gap-2",
                                            children: [
                                              /* @__PURE__ */ jsxRuntimeExports.jsx(
                                                Chip,
                                                {
                                                  color: "primary",
                                                  radius: "sm",
                                                  children: c2.name
                                                }
                                              ),
                                              /* @__PURE__ */ jsxRuntimeExports.jsx(
                                                RefIcon$1a,
                                                {
                                                  className: "text-base"
                                                }
                                              ),
                                              /* @__PURE__ */ jsxRuntimeExports.jsx(
                                                Chip,
                                                {
                                                  color: "secondary",
                                                  radius: "sm",
                                                  children: l2.name
                                                }
                                              ),
                                              /* @__PURE__ */ jsxRuntimeExports.jsx(
                                                RefIcon$1a,
                                                {
                                                  className: "text-base"
                                                }
                                              ),
                                              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", children: path })
                                            ]
                                          }
                                        ),
                                        onOk: async () => {
                                          onSelect == null ? void 0 : onSelect(l2.id, path, c2.id != 0);
                                          setVisible(false);
                                        }
                                      });
                                    } else {
                                      onSelect == null ? void 0 : onSelect(l2.id, path, c2.id != 0);
                                      setVisible(false);
                                    }
                                  },
                                  children: [
                                    path,
                                    selectedRecently && /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$B, { className: "text-sm" })
                                  ]
                                }
                              );
                            }) })
                          ]
                        }
                      ),
                      il2 != c2.libraries.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "horizontal" })
                    ] });
                  }) })
                ]
              }
            ),
            ic2 != filteredCategories.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "horizontal" })
          ] });
        }) })
      ] })
    }
  );
};
MediaLibraryPathSelectorV2.displayName = "MediaLibraryPathSelectorV2";
buildLogger("MediaLibrarySelectorV2");
const MediaLibrarySelectorV2 = (props) => {
  const { t: t2 } = useTranslation();
  const { onSelect, confirmation } = props;
  const { createPortal } = useBakabaseContext();
  const [visible, setVisible] = reactExports.useState(true);
  const [categories, setCategories] = reactExports.useState([]);
  const [keyword, setKeyword] = reactExports.useState();
  const resourceOptions = useResourceOptionsStore((state) => state.data);
  const init2 = async () => {
    var _a2;
    const mls = (await BApi$1.mediaLibrary.getAllMediaLibraries({
      additionalItems: MediaLibraryAdditionalItem.Category
    })).data ?? [];
    const data = {};
    for (const ml2 of mls) {
      const paths = (_a2 = ml2.pathConfigurations) == null ? void 0 : _a2.map((pc2) => pc2.path).filter((x2) => x2 != null);
      if (paths && paths.length > 0) {
        if (!(ml2.categoryId in data)) {
          data[ml2.categoryId] = {
            id: ml2.categoryId,
            name: ml2.category.name,
            libraries: []
          };
        }
        const { libraries } = data[ml2.categoryId];
        libraries.push({
          id: ml2.id,
          name: ml2.name,
          paths
        });
      }
    }
    const mlv2s = (await BApi$1.mediaLibraryV2.getAllMediaLibraryV2()).data ?? [];
    if (mlv2s.length > 0) {
      data[0] = {
        id: 0,
        name: t2("/"),
        libraries: mlv2s.map((ml2) => ({
          id: ml2.id,
          name: ml2.name,
          paths: [ml2.path]
        }))
      };
    }
    setCategories(Object.values(data));
  };
  reactExports.useEffect(() => {
    init2();
  }, []);
  const recentlySelectedIds = (resourceOptions == null ? void 0 : resourceOptions.idsOfMediaLibraryRecentlyMovedTo) || [];
  const lowerCasedKeyword = (keyword == null ? void 0 : keyword.toLowerCase()) ?? "";
  const filteredCategories = keyword != void 0 && (keyword == null ? void 0 : keyword.length) > 0 ? categories.map((a2) => {
    if (a2.name.toLowerCase().indexOf(lowerCasedKeyword) > -1) {
      return a2;
    } else {
      const filteredLibraries = (a2.libraries || []).filter((b2) => {
        return b2.name.toLowerCase().includes(lowerCasedKeyword);
      });
      return {
        ...a2,
        libraries: filteredLibraries
      };
    }
  }).filter((c2) => c2.libraries.length > 0) : categories;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      footer: false,
      size: "lg",
      title: t2("Select a media library"),
      visible,
      onClose: () => {
        setVisible(false);
      },
      onDestroyed: props.onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            placeholder: t2("Quick filter"),
            size: "sm",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1h, { className: "text-base" }),
            value: keyword,
            onValueChange: (v2) => setKeyword(v2)
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "py-2", children: filteredCategories.map((c2, ic2) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs(
              "div",
              {
                className: "grid gap-12 items-center",
                style: { gridTemplateColumns: "30% auto" },
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                    c2.name,
                    c2.id != 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: t2("Deprecated") })
                  ] }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: c2.libraries.map((l2, il2) => {
                    const selectedRecently = recentlySelectedIds.includes(
                      l2.id
                    );
                    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                      Button,
                      {
                        color: selectedRecently ? "success" : "primary",
                        size: "sm",
                        variant: "light",
                        onClick: () => {
                          if (confirmation) {
                            createPortal(Modal, {
                              defaultVisible: true,
                              title: t2(
                                "Are you sure to select this media library?"
                              ),
                              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                                /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "primary", radius: "sm", children: c2.name }),
                                /* @__PURE__ */ jsxRuntimeExports.jsx(
                                  RefIcon$1a,
                                  {
                                    className: "text-base"
                                  }
                                ),
                                /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", children: l2.name })
                              ] }),
                              onOk: async () => {
                                onSelect == null ? void 0 : onSelect(l2.id, c2.id != 0);
                                setVisible(false);
                              }
                            });
                          } else {
                            onSelect == null ? void 0 : onSelect(l2.id, c2.id != 0);
                            setVisible(false);
                          }
                        },
                        children: [
                          l2.name,
                          selectedRecently && /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$B, { className: "text-sm" })
                        ]
                      }
                    );
                  }) })
                ]
              }
            ),
            ic2 != filteredCategories.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "horizontal" })
          ] });
        }) })
      ] })
    }
  );
};
MediaLibrarySelectorV2.displayName = "MediaLibrarySelectorV2";
function $0d86e9c8f07f9a7b$export$79c0c687a5963b0a(opts2, dispatch) {
  let { cursor, getKey: getKey3 } = opts2;
  return {
    setSelectedKeys(selectedKeys) {
      dispatch((state) => ({
        ...state,
        selectedKeys
      }));
    },
    setFilterText(filterText) {
      dispatch((state) => ({
        ...state,
        filterText
      }));
    },
    insert(index2, ...values) {
      dispatch((state) => $0d86e9c8f07f9a7b$var$insert(state, index2, ...values));
    },
    insertBefore(key, ...values) {
      dispatch((state) => {
        let index2 = state.items.findIndex((item) => (getKey3 === null || getKey3 === void 0 ? void 0 : getKey3(item)) === key);
        if (index2 === -1) {
          if (state.items.length === 0)
            index2 = 0;
          else
            return state;
        }
        return $0d86e9c8f07f9a7b$var$insert(state, index2, ...values);
      });
    },
    insertAfter(key, ...values) {
      dispatch((state) => {
        let index2 = state.items.findIndex((item) => (getKey3 === null || getKey3 === void 0 ? void 0 : getKey3(item)) === key);
        if (index2 === -1) {
          if (state.items.length === 0)
            index2 = 0;
          else
            return state;
        }
        return $0d86e9c8f07f9a7b$var$insert(state, index2 + 1, ...values);
      });
    },
    prepend(...values) {
      dispatch((state) => $0d86e9c8f07f9a7b$var$insert(state, 0, ...values));
    },
    append(...values) {
      dispatch((state) => $0d86e9c8f07f9a7b$var$insert(state, state.items.length, ...values));
    },
    remove(...keys2) {
      dispatch((state) => {
        let keySet = new Set(keys2);
        let items = state.items.filter((item) => !keySet.has(getKey3(item)));
        let selection = "all";
        if (state.selectedKeys !== "all") {
          selection = new Set(state.selectedKeys);
          for (let key of keys2)
            selection.delete(key);
        }
        if (cursor == null && items.length === 0)
          selection = /* @__PURE__ */ new Set();
        return {
          ...state,
          items,
          selectedKeys: selection
        };
      });
    },
    removeSelectedItems() {
      dispatch((state) => {
        if (state.selectedKeys === "all")
          return {
            ...state,
            items: [],
            selectedKeys: /* @__PURE__ */ new Set()
          };
        let selectedKeys = state.selectedKeys;
        let items = state.items.filter((item) => !selectedKeys.has(getKey3(item)));
        return {
          ...state,
          items,
          selectedKeys: /* @__PURE__ */ new Set()
        };
      });
    },
    move(key, toIndex) {
      dispatch((state) => {
        let index2 = state.items.findIndex((item2) => getKey3(item2) === key);
        if (index2 === -1)
          return state;
        let copy2 = state.items.slice();
        let [item] = copy2.splice(index2, 1);
        copy2.splice(toIndex, 0, item);
        return {
          ...state,
          items: copy2
        };
      });
    },
    moveBefore(key, keys2) {
      dispatch((state) => {
        let toIndex = state.items.findIndex((item) => getKey3(item) === key);
        if (toIndex === -1)
          return state;
        let keyArray = Array.isArray(keys2) ? keys2 : [
          ...keys2
        ];
        let indices = keyArray.map((key2) => state.items.findIndex((item) => getKey3(item) === key2)).sort((a2, b2) => a2 - b2);
        return $0d86e9c8f07f9a7b$var$move(state, indices, toIndex);
      });
    },
    moveAfter(key, keys2) {
      dispatch((state) => {
        let toIndex = state.items.findIndex((item) => getKey3(item) === key);
        if (toIndex === -1)
          return state;
        let keyArray = Array.isArray(keys2) ? keys2 : [
          ...keys2
        ];
        let indices = keyArray.map((key2) => state.items.findIndex((item) => getKey3(item) === key2)).sort((a2, b2) => a2 - b2);
        return $0d86e9c8f07f9a7b$var$move(state, indices, toIndex + 1);
      });
    },
    update(key, newValue) {
      dispatch((state) => {
        let index2 = state.items.findIndex((item) => getKey3(item) === key);
        if (index2 === -1)
          return state;
        return {
          ...state,
          items: [
            ...state.items.slice(0, index2),
            newValue,
            ...state.items.slice(index2 + 1)
          ]
        };
      });
    }
  };
}
function $0d86e9c8f07f9a7b$var$insert(state, index2, ...values) {
  return {
    ...state,
    items: [
      ...state.items.slice(0, index2),
      ...values,
      ...state.items.slice(index2)
    ]
  };
}
function $0d86e9c8f07f9a7b$var$move(state, indices, toIndex) {
  toIndex -= indices.filter((index2) => index2 < toIndex).length;
  let moves = indices.map((from2) => ({
    from: from2,
    to: toIndex++
  }));
  for (let i2 = 0; i2 < moves.length; i2++) {
    let a2 = moves[i2].from;
    for (let j2 = i2; j2 < moves.length; j2++) {
      let b2 = moves[j2].from;
      if (b2 > a2)
        moves[j2].from--;
    }
  }
  for (let i2 = 0; i2 < moves.length; i2++) {
    let a2 = moves[i2];
    for (let j2 = moves.length - 1; j2 > i2; j2--) {
      let b2 = moves[j2];
      if (b2.from < a2.to)
        a2.to++;
      else
        b2.from++;
    }
  }
  let copy2 = state.items.slice();
  for (let move2 of moves) {
    let [item] = copy2.splice(move2.from, 1);
    copy2.splice(move2.to, 0, item);
  }
  return {
    ...state,
    items: copy2
  };
}
function $f86e6c1ec7da6ebb$var$reducer(data, action) {
  let selectedKeys;
  switch (data.state) {
    case "idle":
    case "error":
      switch (action.type) {
        case "loading":
        case "loadingMore":
        case "sorting":
        case "filtering":
          var _action_filterText, _action_sortDescriptor;
          return {
            ...data,
            filterText: (_action_filterText = action.filterText) !== null && _action_filterText !== void 0 ? _action_filterText : data.filterText,
            state: action.type,
            // Reset items to an empty list if loading, but not when sorting.
            items: action.type === "loading" ? [] : data.items,
            sortDescriptor: (_action_sortDescriptor = action.sortDescriptor) !== null && _action_sortDescriptor !== void 0 ? _action_sortDescriptor : data.sortDescriptor,
            abortController: action.abortController
          };
        case "update":
          var _action_updater;
          return {
            ...data,
            ...(_action_updater = action.updater) === null || _action_updater === void 0 ? void 0 : _action_updater.call(action, data)
          };
        case "success":
        case "error":
          return data;
        default:
          throw new Error(`Invalid action "${action.type}" in state "${data.state}"`);
      }
    case "loading":
    case "sorting":
    case "filtering":
      switch (action.type) {
        case "success":
          if (action.abortController !== data.abortController)
            return data;
          var _action_selectedKeys;
          selectedKeys = (_action_selectedKeys = action.selectedKeys) !== null && _action_selectedKeys !== void 0 ? _action_selectedKeys : data.selectedKeys;
          var _action_filterText1, _action_items, _action_sortDescriptor1;
          return {
            ...data,
            filterText: (_action_filterText1 = action.filterText) !== null && _action_filterText1 !== void 0 ? _action_filterText1 : data.filterText,
            state: "idle",
            items: [
              ...(_action_items = action.items) !== null && _action_items !== void 0 ? _action_items : []
            ],
            selectedKeys: selectedKeys === "all" ? "all" : new Set(selectedKeys),
            sortDescriptor: (_action_sortDescriptor1 = action.sortDescriptor) !== null && _action_sortDescriptor1 !== void 0 ? _action_sortDescriptor1 : data.sortDescriptor,
            abortController: void 0,
            cursor: action.cursor
          };
        case "error":
          if (action.abortController !== data.abortController)
            return data;
          return {
            ...data,
            state: "error",
            error: action.error,
            abortController: void 0
          };
        case "loading":
        case "loadingMore":
        case "sorting":
        case "filtering":
          var _data_abortController;
          (_data_abortController = data.abortController) === null || _data_abortController === void 0 ? void 0 : _data_abortController.abort();
          var _action_filterText2;
          return {
            ...data,
            filterText: (_action_filterText2 = action.filterText) !== null && _action_filterText2 !== void 0 ? _action_filterText2 : data.filterText,
            state: action.type,
            // Reset items to an empty list if loading, but not when sorting.
            items: action.type === "loading" ? [] : data.items,
            abortController: action.abortController
          };
        case "update":
          var _action_updater1;
          return {
            ...data,
            ...(_action_updater1 = action.updater) === null || _action_updater1 === void 0 ? void 0 : _action_updater1.call(action, data)
          };
        default:
          throw new Error(`Invalid action "${action.type}" in state "${data.state}"`);
      }
    case "loadingMore":
      switch (action.type) {
        case "success":
          var _action_selectedKeys1;
          selectedKeys = data.selectedKeys === "all" || action.selectedKeys === "all" ? "all" : /* @__PURE__ */ new Set([
            ...data.selectedKeys,
            ...(_action_selectedKeys1 = action.selectedKeys) !== null && _action_selectedKeys1 !== void 0 ? _action_selectedKeys1 : []
          ]);
          var _action_items1, _action_sortDescriptor2;
          return {
            ...data,
            state: "idle",
            items: [
              ...data.items,
              ...(_action_items1 = action.items) !== null && _action_items1 !== void 0 ? _action_items1 : []
            ],
            selectedKeys,
            sortDescriptor: (_action_sortDescriptor2 = action.sortDescriptor) !== null && _action_sortDescriptor2 !== void 0 ? _action_sortDescriptor2 : data.sortDescriptor,
            abortController: void 0,
            cursor: action.cursor
          };
        case "error":
          if (action.abortController !== data.abortController)
            return data;
          return {
            ...data,
            state: "error",
            error: action.error
          };
        case "loading":
        case "sorting":
        case "filtering":
          var _data_abortController1;
          (_data_abortController1 = data.abortController) === null || _data_abortController1 === void 0 ? void 0 : _data_abortController1.abort();
          var _action_filterText3;
          return {
            ...data,
            filterText: (_action_filterText3 = action.filterText) !== null && _action_filterText3 !== void 0 ? _action_filterText3 : data.filterText,
            state: action.type,
            // Reset items to an empty list if loading, but not when sorting.
            items: action.type === "loading" ? [] : data.items,
            abortController: action.abortController
          };
        case "loadingMore":
          var _action_abortController;
          (_action_abortController = action.abortController) === null || _action_abortController === void 0 ? void 0 : _action_abortController.abort();
          return data;
        case "update":
          var _action_updater2;
          return {
            ...data,
            ...(_action_updater2 = action.updater) === null || _action_updater2 === void 0 ? void 0 : _action_updater2.call(action, data)
          };
        default:
          throw new Error(`Invalid action "${action.type}" in state "${data.state}"`);
      }
    default:
      throw new Error(`Invalid state "${data.state}"`);
  }
}
function $f86e6c1ec7da6ebb$export$bc3384a35de93d66(options) {
  const { load, sort, initialSelectedKeys, initialSortDescriptor, getKey: getKey3 = (item) => item.id || item.key, initialFilterText = "" } = options;
  let [data, dispatch] = reactExports.useReducer($f86e6c1ec7da6ebb$var$reducer, {
    state: "idle",
    error: void 0,
    items: [],
    selectedKeys: initialSelectedKeys === "all" ? "all" : new Set(initialSelectedKeys),
    sortDescriptor: initialSortDescriptor,
    filterText: initialFilterText
  });
  const dispatchFetch = async (action, fn) => {
    let abortController = new AbortController();
    try {
      dispatch({
        ...action,
        abortController
      });
      var _action_filterText;
      let previousFilterText = (_action_filterText = action.filterText) !== null && _action_filterText !== void 0 ? _action_filterText : data.filterText;
      var _action_sortDescriptor;
      let response = await fn({
        items: data.items.slice(),
        selectedKeys: data.selectedKeys,
        sortDescriptor: (_action_sortDescriptor = action.sortDescriptor) !== null && _action_sortDescriptor !== void 0 ? _action_sortDescriptor : data.sortDescriptor,
        signal: abortController.signal,
        cursor: action.type === "loadingMore" ? data.cursor : void 0,
        filterText: previousFilterText,
        loadingState: data.state
      });
      var _response_filterText;
      let filterText = (_response_filterText = response.filterText) !== null && _response_filterText !== void 0 ? _response_filterText : previousFilterText;
      dispatch({
        type: "success",
        ...response,
        abortController
      });
      if (filterText && filterText !== previousFilterText && !abortController.signal.aborted)
        dispatchFetch({
          type: "filtering",
          filterText
        }, load);
    } catch (e2) {
      dispatch({
        type: "error",
        error: e2,
        abortController
      });
    }
  };
  let didDispatchInitialFetch = reactExports.useRef(false);
  reactExports.useEffect(() => {
    if (!didDispatchInitialFetch.current) {
      dispatchFetch({
        type: "loading"
      }, load);
      didDispatchInitialFetch.current = true;
    }
  }, []);
  return {
    items: data.items,
    selectedKeys: data.selectedKeys,
    sortDescriptor: data.sortDescriptor,
    isLoading: data.state === "loading" || data.state === "loadingMore" || data.state === "sorting" || data.state === "filtering",
    loadingState: data.state,
    error: data.error,
    filterText: data.filterText,
    getItem(key) {
      return data.items.find((item) => getKey3(item) === key);
    },
    reload() {
      dispatchFetch({
        type: "loading"
      }, load);
    },
    loadMore() {
      if (data.state === "loading" || data.state === "loadingMore" || data.state === "filtering" || data.cursor == null)
        return;
      dispatchFetch({
        type: "loadingMore"
      }, load);
    },
    sort(sortDescriptor) {
      dispatchFetch({
        type: "sorting",
        sortDescriptor
      }, sort || load);
    },
    ...$0d86e9c8f07f9a7b$export$79c0c687a5963b0a({
      ...options,
      getKey: getKey3,
      cursor: data.cursor
    }, (fn) => {
      dispatch({
        type: "update",
        updater: fn
      });
    }),
    setFilterText(filterText) {
      dispatchFetch({
        type: "filtering",
        filterText
      }, load);
    }
  };
}
const log$l = buildLogger("ToResourceSelector");
const ToResourceSelector = ({ onSelect, fromResourcePath }) => {
  const { t: t2 } = useTranslation();
  const targetResourceCandidates = $f86e6c1ec7da6ebb$export$bc3384a35de93d66({
    async load({ signal, filterText }) {
      if (filterText != void 0 && filterText.length > 0) {
        const trim2 = filterText.trim();
        const res = await BApi$1.resource.searchResourcePaths(
          { keyword: trim2 },
          { signal }
        );
        const data = res.data || [];
        const isOverflow = data.length > 20;
        const listItems = data.slice(0, 20).map((d2) => ({
          id: d2.id,
          path: d2.path,
          fileName: d2.fileName
        }));
        if (isOverflow) {
          listItems.push({
            id: 0,
            fileName: t2(
              "20 results can be shown at most, please refine your search"
            )
          });
        }
        return {
          items: listItems
        };
      } else {
        return {
          items: []
        };
      }
    },
    initialFilterText: fromResourcePath
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      autocomplete_default,
      {
        fullWidth: true,
        isRequired: true,
        description: t2(
          "You may need modify the default keyword to search the expected resources"
        ),
        inputValue: targetResourceCandidates.filterText,
        isLoading: targetResourceCandidates.isLoading,
        items: targetResourceCandidates.items,
        label: t2(
          "Input keyword of the resource path to select the target resource"
        ),
        listboxProps: {
          emptyContent: t2("Can not find any resource")
        },
        radius: "none",
        size: "sm",
        onInputChange: targetResourceCandidates.setFilterText,
        onSelectionChange: (key) => {
          log$l(key);
          const id2 = parseInt(key, 10);
          if (id2) {
            onSelect(id2);
          }
        },
        children: (rc2) => {
          const isFromResource = fromResourcePath == rc2.path;
          const isDisabled = rc2.id == 0 || isFromResource;
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            listbox_item_base_default,
            {
              className: `${isDisabled ? "opacity-60" : ""}`,
              isDisabled,
              startContent: isFromResource ? /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: t2("Current path") }) : void 0,
              title: rc2.path,
              children: rc2.fileName
            },
            rc2.id
          );
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Button,
      {
        size: "sm",
        variant: "light",
        onClick: () => {
          targetResourceCandidates.setFilterText(fromResourcePath);
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$h, { className: "text-base" }),
          t2("Reset keyword to path of from resource")
        ]
      }
    )
  ] });
};
ToResourceSelector.displayName = "ToResourceSelector";
const AnimatedArrow = ({
  color: color2 = "#999",
  direction = "right",
  className
}) => {
  const spans = [];
  let rotate2 = -90;
  switch (direction) {
    case "left":
      rotate2 = 90;
      break;
    case "right":
      break;
    case "up":
      rotate2 = 180;
      break;
    case "down":
      rotate2 = 0;
      break;
  }
  for (let i2 = 0; i2 < 3; i2++) {
    spans.push(/* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { borderColor: color2 } }, i2));
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `animated-arrow ${className}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "arrow", style: { transform: `rotate(${rotate2}deg)` }, children: spans }) });
};
AnimatedArrow.displayName = "AnimatedArrow";
const PageSize$2 = 100;
const defaultInputModelItem = {
  keepMediaLibrary: true,
  deleteSourceResource: false
};
const defaultInputModel = {
  items: [],
  keepMediaLibraryForAll: true,
  deleteAllSourceResources: false
};
const addItem = (inputModel, item) => {
  var _a2;
  if (!((_a2 = inputModel.items) == null ? void 0 : _a2.includes(item))) {
    inputModel.items ?? (inputModel.items = []);
    inputModel.items.push(item);
  }
};
const log$k = buildLogger("ResourceTransferModal");
const validateInputModel = (inputModel) => {
  const items = [];
  if (inputModel.items) {
    for (const item of inputModel.items) {
      if (item && item.fromId != void 0 && item.toId != void 0) {
        items.push({
          fromId: item.fromId,
          toId: item.toId,
          keepMediaLibrary: item.keepMediaLibrary ?? defaultInputModelItem.keepMediaLibrary,
          deleteSourceResource: item.deleteSourceResource ?? defaultInputModelItem.deleteSourceResource
        });
      }
    }
  }
  if (items.length > 0) {
    return {
      items,
      keepMediaLibraryForAll: inputModel.keepMediaLibraryForAll ?? defaultInputModel.keepMediaLibraryForAll,
      deleteAllSourceResources: inputModel.deleteAllSourceResources ?? defaultInputModel.deleteAllSourceResources
    };
  }
  return void 0;
};
const ResourceTransferModal = ({ fromResources, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const [page, setPage] = reactExports.useState(1);
  const [resources, setResources] = reactExports.useState([]);
  const [inputModel, setInputModel] = reactExports.useState({
    ...defaultInputModel
  });
  const [resourcePool, setResourcePool] = reactExports.useState({});
  const [filterForm, setFilterForm] = reactExports.useState({});
  const [deletedSourceResourceIds, setDeletedSourceResourceIds] = reactExports.useState([]);
  reactExports.useEffect(() => {
    const resources2 = fromResources.filter(
      (x2) => {
        var _a2, _b2;
        return !deletedSourceResourceIds.includes(x2.id) && (!filterForm.showUnfinishedOnly || ((_b2 = (_a2 = inputModel.items) == null ? void 0 : _a2.find((i2) => i2.fromId == x2.id)) == null ? void 0 : _b2.toId) == void 0) && (filterForm.pathKeyword == void 0 || filterForm.pathKeyword.length == 0 || x2.path.toLowerCase().includes(filterForm.pathKeyword));
      }
    ).slice((page - 1) * PageSize$2, page * PageSize$2);
    setResources(resources2);
  }, [page, fromResources, filterForm, inputModel, deletedSourceResourceIds]);
  const TPagination = reactExports.useCallback(({ page: page2 }) => {
    const total = Math.ceil(fromResources.length / PageSize$2);
    if (total > 1) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        pagination_default,
        {
          page: page2,
          size: "sm",
          total,
          onChange: (page3) => setPage(page3)
        }
      );
    }
    return null;
  }, []);
  log$k(inputModel, !!validateInputModel(inputModel));
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      className: "max-h-[90%]",
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          isDisabled: !validateInputModel(inputModel)
        }
      },
      size: "full",
      title: t2("Transfer data of resources"),
      onDestroyed,
      onOk: async () => {
        log$k("Transferring resources", inputModel);
        const dto = validateInputModel(inputModel);
        if (dto) {
          const rsp = await BApi$1.resource.transferResourceData(dto);
          if (!rsp.code) {
            for (const item of dto.items) {
              if (dto.deleteAllSourceResources || item.deleteSourceResource) {
                deletedSourceResourceIds.push(item.fromId);
              }
            }
            setDeletedSourceResourceIds([...deletedSourceResourceIds]);
          }
        } else {
          Vt.error(t2("Invalid data"));
        }
        if (deletedSourceResourceIds.length != fromResources.length) {
          throw new Error("Prevent closing");
        }
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1 max-h-full grow overflow-hidden", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                className: "w-[360px]",
                placeholder: t2("Path keyword"),
                size: "sm",
                startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1h, { className: "text-base" }),
                value: filterForm.pathKeyword,
                onValueChange: (v2) => {
                  setFilterForm({
                    ...filterForm,
                    pathKeyword: standardizePath(v2 == null ? void 0 : v2.toLowerCase())
                  });
                }
              }
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              checkbox_default,
              {
                isSelected: filterForm.showUnfinishedOnly,
                size: "sm",
                onValueChange: (c2) => {
                  setFilterForm({
                    ...filterForm,
                    showUnfinishedOnly: c2
                  });
                },
                children: t2("Show unfinished only")
              }
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "secondary", size: "sm", variant: "light", children: t2("Finished") }),
              fromResources.filter(
                (r2) => {
                  var _a2, _b2;
                  return ((_b2 = (_a2 = inputModel.items) == null ? void 0 : _a2.find((i2) => i2.fromId == r2.id)) == null ? void 0 : _b2.toId) != void 0;
                }
              ).length,
              "/",
              fromResources.length
            ] })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Tooltip$1,
            {
              color: "secondary",
              content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                t2(
                  "Following properties will not be transferred"
                ),
                [
                  "Parent association",
                  "Path",
                  "FileCreatedAt",
                  "FileModifiedAt"
                ].map((x2) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: t2(`Property.${x2}`) }))
              ] }) }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" })
            }
          ) }) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow overflow-y-auto", children: resources.length == 0 ? t2("No resources to be transferred") : /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isCompact: true, removeWrapper: true, children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 100, children: t2("#") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 200, children: t2("Source resource") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 60, children: "-" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 200, children: t2("Resource will be overwritten") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Operations") })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: resources.map((x2, i2) => {
            var _a2;
            const item = ((_a2 = inputModel.items) == null ? void 0 : _a2.find(
              (y2) => (y2 == null ? void 0 : y2.fromId) == x2.id
            )) || {
              ...defaultInputModelItem,
              fromId: x2.id
            };
            const toResource = resourcePool[item.toId ?? 0];
            return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                Chip,
                {
                  color: item.toId == void 0 ? "default" : "success",
                  radius: "sm",
                  children: i2 + 1
                }
              ) }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceMemo, { resource: x2 }),
                (inputModel.deleteAllSourceResources || item.deleteSourceResource) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute top-0 right-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  RefIcon$W,
                  {
                    className: "text-3xl text-danger"
                  }
                ) })
              ] }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatedArrow, {}) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: item.toId ? toResource ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceMemo, { resource: toResource }) : t2("Unknown resource") : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-warning", children: t2(
                "Please select a target resource on the right side"
              ) }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { className: "flex flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col gap-2", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  ToResourceSelector,
                  {
                    fromResourcePath: x2.path,
                    onSelect: (id2) => {
                      item.toId = id2;
                      BApi$1.resource.getResourcesByKeys({
                        ids: [id2],
                        additionalItems: ResourceAdditionalItem.All
                      }).then((res) => {
                        var _a3;
                        const r2 = (_a3 = res.data) == null ? void 0 : _a3[0];
                        if (r2) {
                          setResourcePool({
                            ...resourcePool,
                            [id2]: r2
                          });
                        }
                      });
                      addItem(inputModel, item);
                      setInputModel({ ...inputModel });
                    }
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  checkbox_default,
                  {
                    isDisabled: inputModel.deleteAllSourceResources,
                    isSelected: inputModel.deleteAllSourceResources || item.deleteSourceResource,
                    onValueChange: (v2) => {
                      console.log(item);
                      item.deleteSourceResource = v2;
                      addItem(inputModel, item);
                      console.log(inputModel);
                      setInputModel({ ...inputModel });
                    },
                    children: t2("Delete source resource (data only)")
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  checkbox_default,
                  {
                    isDisabled: inputModel.keepMediaLibraryForAll,
                    isSelected: inputModel.keepMediaLibraryForAll || item.keepMediaLibrary,
                    onValueChange: (v2) => {
                      item.keepMediaLibrary = v2;
                      addItem(inputModel, item);
                      setInputModel({ ...inputModel });
                    },
                    children: t2(
                      "Keep associated media library information for target resource"
                    )
                  }
                )
              ] }) })
            ] });
          }) })
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs(
              checkbox_default,
              {
                isSelected: inputModel.deleteAllSourceResources,
                size: "sm",
                onValueChange: (v2) => {
                  setInputModel({
                    ...inputModel,
                    deleteAllSourceResources: v2
                  });
                },
                children: [
                  t2("Delete source resource (data only)"),
                  "(",
                  t2("For all {{count}} items", {
                    count: fromResources.length
                  }),
                  ")"
                ]
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Tooltip$1,
              {
                color: "secondary",
                content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                    "Category and media library of target resource will be remained by default."
                  ) }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                    "By disable this options, the category and media library of target resource will be replaced with data from source resource."
                  ) })
                ] }),
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
                  checkbox_default,
                  {
                    isSelected: inputModel.keepMediaLibraryForAll,
                    size: "sm",
                    onValueChange: (v2) => {
                      setInputModel({
                        ...inputModel,
                        keepMediaLibraryForAll: v2
                      });
                    },
                    children: [
                      t2(
                        "Keep associated media library information for target resource"
                      ),
                      "(",
                      t2("For all {{count}} items", {
                        count: fromResources.length
                      }),
                      ")"
                    ]
                  }
                )
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(TPagination, { page })
        ] })
      ] })
    }
  );
};
ResourceTransferModal.displayName = "ResourceTransferModal";
const log$j = buildLogger("ResourceContextMenuItems");
const ContextMenuItems = ({
  selectedResourceIds,
  onSelectedResourcesChanged
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      MenuItem,
      {
        onClick: () => {
          log$j("inner", "click");
          createPortal(MediaLibraryPathSelectorV2, {
            confirmation: true,
            onSelect: (id2, path, isLegacyMediaLibrary) => {
              if (selectedResourceIds.length > 0) {
                BApi$1.resource.moveResources({
                  ids: selectedResourceIds,
                  path,
                  mediaLibraryId: id2,
                  isLegacyMediaLibrary
                }).then((r2) => {
                });
              }
            }
          });
        },
        onClickCapture: () => {
          log$j("inner", "click capture");
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$M, { className: "text-base" }),
          selectedResourceIds.length > 1 ? t2(
            "Move {{count}} resources to media library (Including file system entries)",
            { count: selectedResourceIds.length }
          ) : t2(
            "Move to media library (Including file system entries)"
          )
        ] })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      MenuItem,
      {
        onClick: () => {
          log$j("inner", "click");
          createPortal(MediaLibrarySelectorV2, {
            confirmation: true,
            onSelect: async (id2, isLegacyMediaLibrary) => {
              await BApi$1.resource.moveResources({
                ids: selectedResourceIds,
                mediaLibraryId: id2,
                isLegacyMediaLibrary
              }).then((r2) => {
                onSelectedResourcesChanged == null ? void 0 : onSelectedResourcesChanged(selectedResourceIds);
              });
            }
          });
        },
        onClickCapture: () => {
          log$j("inner", "click capture");
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$18, { className: "text-base" }),
          selectedResourceIds.length > 1 ? t2(
            "Move {{count}} resources to media library (Data only)",
            { count: selectedResourceIds.length }
          ) : t2("Move to media library (Data only)")
        ] })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      MenuItem,
      {
        onClick: () => {
          log$j("inner", "click");
          BApi$1.resource.getResourcesByKeys({
            ids: selectedResourceIds,
            additionalItems: ResourceAdditionalItem.All
          }).then((r2) => {
            const resources = r2.data || [];
            createPortal(ResourceTransferModal, {
              fromResources: resources
            });
          });
        },
        onClickCapture: () => {
          log$j("inner", "click capture");
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$f, { className: "text-base" }),
          selectedResourceIds.length > 1 ? t2("Transfer data of {{count}} resources", {
            count: selectedResourceIds.length
          }) : t2("Transfer resource data")
        ] })
      }
    ),
    selectedResourceIds.length > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(
      MenuItem,
      {
        onClick: () => {
          log$j("inner", "click");
          createPortal(Modal, {
            defaultVisible: true,
            title: t2("We are leaving current page"),
            onOk: async () => {
              const navigate = useNavigate();
              navigate("/bulkmodification2");
            }
          });
        },
        onClickCapture: () => {
          log$j("inner", "click capture");
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 text-secondary", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Q, { className: "text-base" }),
          t2("Bulk modification")
        ] })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      MenuItem,
      {
        onClick: () => {
          log$j("inner", "click");
          let deleteFiles = false;
          createPortal(Modal, {
            defaultVisible: true,
            title: t2("Delete {{count}} resources", {
              count: selectedResourceIds.length
            }),
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                checkbox_default,
                {
                  onValueChange: (s2) => deleteFiles = s2,
                  children: t2("Delete files also")
                }
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-80", children: t2(
                "Resource will be shown again after next synchronization if you leave files undeleted."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-6 font-bold", children: t2(
                "Are you sure you want to delete {{count}} resources?",
                { count: selectedResourceIds.length }
              ) })
            ] }),
            onOk: async () => {
              await BApi$1.resource.deleteResourcesByKeys({
                ids: selectedResourceIds,
                deleteFiles
              });
            }
          });
        },
        onClickCapture: () => {
          log$j("inner", "click capture");
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 text-danger", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" }),
          selectedResourceIds.length > 1 ? t2("Delete {{count}} resources", {
            count: selectedResourceIds.length
          }) : t2("Delete resource")
        ] })
      }
    )
  ] });
};
ContextMenuItems.displayName = "ContextMenuItems";
const Resource = React$5.forwardRef((props, ref) => {
  var _a2, _b2, _c2, _d;
  const {
    resource: resource2,
    onTagClick = (propertyId, value2) => {
    },
    queue,
    ct = new AbortController().signal,
    biggerCoverPlacement,
    style: propStyle = {},
    selected = false,
    mode = "default",
    onSelected = (id2) => {
    },
    selectedResourceIds: propsSelectedResourceIds,
    onSelectedResourcesChanged,
    debug
  } = props;
  const { createPortal } = useBakabaseContext();
  const { t: t2 } = useTranslation();
  const log3 = buildLogger(`Resource:${resource2.id}|${resource2.path}`);
  const renderedTimes = reactExports.useRef(0);
  renderedTimes.current += 1;
  const tasksRef = reactExports.useRef();
  const uiOptions = useUiOptionsStore((state) => state.data);
  const forceUpdate = useUpdate();
  const playableFilesRef = reactExports.useRef(null);
  const [contextMenuIsOpen, setContextMenuIsOpen] = reactExports.useState(false);
  const [contextMenuAnchorPoint, setContextMenuAnchorPoint] = reactExports.useState({
    x: 0,
    y: 0
  });
  const hasActiveTask = ((_a2 = tasksRef.current) == null ? void 0 : _a2.some(
    (x2) => x2.status == BTaskStatus.Paused || x2.status == BTaskStatus.Running
  )) == true;
  reactExports.useImperativeHandle(ref, () => {
    return {
      id: resource2.id,
      reload,
      select: (selected2) => {
      }
    };
  }, []);
  useTraceUpdate(props, `[${resource2.fileName}]`);
  const displayPropertyKeys = ((_b2 = uiOptions.resource) == null ? void 0 : _b2.displayProperties) ?? [];
  const initialize = reactExports.useCallback(async (ct2) => {
    if (playableFilesRef.current) {
      await playableFilesRef.current.initialize();
    }
  }, []);
  reactExports.useEffect(() => {
    if (queue) {
      queue.push(async () => await initialize(ct));
    } else {
      initialize(ct);
    }
  }, []);
  const reload = reactExports.useCallback(async (ct2) => {
    var _a3, _b3;
    const newResourceRsp = await BApi$1.resource.getResourcesByKeys({
      ids: [resource2.id],
      additionalItems: ResourceAdditionalItem.All
    });
    if (!newResourceRsp.code) {
      const nr = (newResourceRsp.data || [])[0];
      if (nr) {
        Object.keys(nr).forEach((k2) => {
          resource2[k2] = nr[k2];
        });
        (_a3 = coverRef.current) == null ? void 0 : _a3.load(true);
        (_b3 = playableFilesRef.current) == null ? void 0 : _b3.initialize();
        forceUpdate();
      }
    } else {
      throw new Error(newResourceRsp.message);
    }
  }, []);
  const coverRef = reactExports.useRef();
  const onCoverClick = reactExports.useCallback(() => {
    createPortal(DetailDialog, {
      id: resource2.id,
      onDestroyed: () => {
        reload();
      }
    });
  }, []);
  const renderCover = () => {
    var _a3, _b3, _c3, _d2, _e, _f, _g, _h;
    const elementId = `resource-${resource2.id}`;
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$2.coverRectangle, id: elementId, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$2.absoluteRectangle, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        ResourceCoverMemo,
        {
          ref: coverRef,
          biggerCoverPlacement,
          coverFit: (_a3 = uiOptions.resource) == null ? void 0 : _a3.coverFit,
          disableCarousel: (_b3 = uiOptions == null ? void 0 : uiOptions.resource) == null ? void 0 : _b3.disableCoverCarousel,
          disableMediaPreviewer: (_c3 = uiOptions == null ? void 0 : uiOptions.resource) == null ? void 0 : _c3.disableMediaPreviewer,
          resource: resource2,
          showBiggerOnHover: (_d2 = uiOptions == null ? void 0 : uiOptions.resource) == null ? void 0 : _d2.showBiggerCoverWhileHover,
          useCache: !((_e = uiOptions == null ? void 0 : uiOptions.resource) == null ? void 0 : _e.disableCache),
          onClick: onCoverClick
        }
      ) }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute top-1 left-1 flex gap-1 items-center", children: [
        resource2.tags.includes(ResourceTag.Pinned) && /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$i, {}),
        resource2.tags.includes(ResourceTag.IsParent) && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("This is a parent resource"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$19, { className: "" }) }),
        resource2.tags.includes(ResourceTag.PathDoesNotExist) && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("File does not exist"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$L, { className: "text-warning" }) }),
        resource2.tags.includes(ResourceTag.UnknownMediaLibrary) && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Unknown media library"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$V, { className: "text-warning" }) }),
        resource2.playedAt && /* @__PURE__ */ jsxRuntimeExports.jsx(
          Tooltip$1,
          {
            content: t2("Last played at {{dt}}", {
              dt: resource2.playedAt
            }),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$B, {})
          }
        ),
        ((_f = uiOptions.resource) == null ? void 0 : _f.displayResourceId) && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Resource ID"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: resource2.id }) }),
        debug && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSync, { className: "text-base" }),
          renderedTimes.current
        ] }) })
      ] }),
      (displayPropertyKeys.length > 0 || ((_g = uiOptions.resource) == null ? void 0 : _g.inlineDisplayName)) && /* @__PURE__ */ jsxRuntimeExports.jsxs(
        "div",
        {
          className: "inline-flex flex-col gap-1 absolute bottom-0 right-0 items-end max-w-full max-h-full w-fit",
          children: [
            displayPropertyKeys.map((dpk) => {
              var _a4, _b4, _c4, _d3, _e2;
              const style22 = {};
              let bizValue;
              let bizValueType;
              try {
                switch (dpk.pool) {
                  case PropertyPool.Internal:
                    switch (dpk.id) {
                      case ResourceProperty.MediaLibrary:
                      case ResourceProperty.MediaLibraryV2:
                        if (resource2.mediaLibraryColor) {
                          style22.color = resource2.mediaLibraryColor;
                          style22.backgroundColor = autoBackgroundColor(resource2.mediaLibraryColor);
                        }
                        bizValue = resource2.mediaLibraryName;
                        bizValueType = StandardValueType.String;
                        break;
                      case ResourceProperty.Category:
                        bizValue = (_a4 = resource2.category) == null ? void 0 : _a4.name;
                        bizValueType = StandardValueType.String;
                        break;
                      case ResourceProperty.CreatedAt:
                        bizValue = hooks(resource2.createdAt).format("YYYY-MM-DD");
                        bizValueType = StandardValueType.String;
                        break;
                      case ResourceProperty.PlayedAt:
                        if (resource2.playedAt) {
                          bizValue = resource2.playedAt;
                          bizValueType = StandardValueType.String;
                        }
                        break;
                      case ResourceProperty.FileCreatedAt:
                        bizValue = hooks(resource2.fileCreatedAt).format("YYYY-MM-DD");
                        bizValueType = StandardValueType.String;
                        break;
                      case ResourceProperty.FileModifiedAt:
                        bizValue = hooks(resource2.fileModifiedAt).format("YYYY-MM-DD");
                        bizValueType = StandardValueType.String;
                        break;
                    }
                    break;
                  case PropertyPool.Reserved:
                  case PropertyPool.Custom:
                    const property2 = (_c4 = (_b4 = resource2.properties) == null ? void 0 : _b4[dpk.pool]) == null ? void 0 : _c4[dpk.id];
                    bizValue = (_e2 = (_d3 = property2 == null ? void 0 : property2.values) == null ? void 0 : _d3.find((x2) => x2.bizValue)) == null ? void 0 : _e2.bizValue;
                    bizValueType = property2 == null ? void 0 : property2.bizValueType;
                    break;
                }
              } catch (error2) {
                log3("error occurred while rendering display property", error2);
              }
              if (bizValue == void 0 || bizValueType == void 0) {
                return null;
              }
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                Chip,
                {
                  className: "h-auto w-fit",
                  radius: "sm",
                  size: "sm",
                  style: style22,
                  variant: "flat",
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(StandardValueRenderer, { type: bizValueType, value: bizValue, variant: "light" })
                },
                `${dpk.pool}-${dpk.id}`
              );
            }),
            ((_h = uiOptions.resource) == null ? void 0 : _h.inlineDisplayName) && renderDisplayNameAndTags(true)
          ]
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        PlayableFiles,
        {
          ref: playableFilesRef,
          PortalComponent: ({ onClick }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${styles$2.play} z-1`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Play"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              onPress: onClick,
              isIconOnly: true,
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$n, { className: "text-2xl" })
            }
          ) }) }),
          afterPlaying: reload,
          resource: resource2
        }
      )
    ] });
  };
  let firstTagsValue;
  let firstTagsValuePropertyId;
  {
    const customPropertyValues = ((_c2 = resource2.properties) == null ? void 0 : _c2[PropertyPool.Custom]) || {};
    Object.keys(customPropertyValues).find((idStr) => {
      var _a3;
      const id2 = parseInt(idStr, 10);
      const p2 = customPropertyValues[id2];
      if (p2.bizValueType == StandardValueType.ListTag) {
        const values = (_a3 = p2.values) == null ? void 0 : _a3.find((v2) => {
          var _a4;
          return ((_a4 = v2.aliasAppliedBizValue) == null ? void 0 : _a4.length) > 0;
        });
        if (values && displayPropertyKeys.some((dpk) => dpk.pool == PropertyPool.Custom && dpk.id == id2)) {
          firstTagsValue = values.aliasAppliedBizValue.map((id22, i2) => {
            const bvs = values.aliasAppliedBizValue;
            const bv = bvs == null ? void 0 : bvs[i2];
            return {
              value: id22,
              ...bv
            };
          });
          firstTagsValuePropertyId = id2;
          return true;
        }
      }
      return false;
    });
  }
  const style2 = {
    ...propStyle
  };
  if (selected) {
    style2.borderWidth = 2;
    style2.borderColor = "var(--bakaui-success)";
  }
  const selectedResourceIds = (propsSelectedResourceIds ?? []).slice();
  if (!selectedResourceIds.includes(resource2.id)) {
    selectedResourceIds.push(resource2.id);
  }
  const renderDisplayNameAndTags = (highContrastBackground = false) => {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        className: `${highContrastBackground ? "bg-default/70 text-default-700" : ""} px-1 rounded`,
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$2.info, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `select-text ${styles$2.limitedContent}`, children: resource2.displayName }) }),
          firstTagsValue && firstTagsValue.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$2.info, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: `select-text ${styles$2.limitedContent} flex flex-wrap opacity-70 leading-3 gap-px`,
              children: firstTagsValue.map((v2) => {
                return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                  link_default,
                  {
                    className: "text-xs cursor-pointer",
                    color: "foreground",
                    underline: "none",
                    onPress: (e2) => {
                      onTagClick == null ? void 0 : onTagClick(firstTagsValuePropertyId, v2);
                    },
                    size: "sm",
                    children: [
                      "#",
                      v2.group == void 0 ? "" : `${v2.group}:`,
                      v2.name
                    ]
                  },
                  `${v2.group}:${v2.name}`
                );
              })
            }
          ) })
        ]
      }
    );
  };
  log3("render", resource2);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: `flex flex-col p-1 rounded relative border-1 border-default-200 group/resource ${styles$2.resource} ${props.className}`,
      "data-id": resource2.id,
      role: "resource",
      style: style2,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Operations, { coverRef: coverRef.current, reload, resource: resource2 }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          TaskCover,
          {
            reload,
            resource: resource2,
            onTasksChange: (tasks) => tasksRef.current = tasks
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          "div",
          {
            onClick: () => {
              log3("outer", "click");
            },
            onContextMenu: (e2) => {
              if (typeof document.hasFocus === "function" && !document.hasFocus())
                return;
              e2.preventDefault();
              setContextMenuAnchorPoint({
                x: e2.clientX,
                y: e2.clientY
              });
              setContextMenuIsOpen(true);
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                ControlledMenu,
                {
                  anchorPoint: contextMenuAnchorPoint,
                  direction: "right",
                  state: contextMenuIsOpen ? "open" : "closed",
                  onClick: (e2) => {
                    e2.preventDefault();
                    e2.stopPropagation();
                  },
                  onClose: () => setContextMenuIsOpen(false),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                    ContextMenuItems,
                    {
                      selectedResourceIds,
                      onSelectedResourcesChanged
                    }
                  )
                },
                resource2.id
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsxs(
                "div",
                {
                  className: "relative",
                  onClickCapture: (e2) => {
                    log3("outer", "click capture");
                    if (mode == "select" && !hasActiveTask) {
                      onSelected(resource2.id);
                      e2.preventDefault();
                      e2.stopPropagation();
                    }
                  },
                  children: [
                    renderCover(),
                    !((_d = uiOptions.resource) == null ? void 0 : _d.inlineDisplayName) && renderDisplayNameAndTags(false)
                  ]
                }
              )
            ]
          }
        )
      ]
    },
    resource2.id
  );
});
const ResourceMemo = React$5.memo(Resource);
ResourceMemo.displayName = "Resource";
const PageSize$1 = 50;
const log$i = buildLogger("ResourceTabContent");
const ResourceTabContent = React$5.forwardRef((props, ref) => {
  const { t: t2 } = useTranslation();
  useUpdate();
  const [pageable, setPageable] = reactExports.useState();
  const pageableRef = reactExports.useRef(pageable);
  const [resources, setResources] = reactExports.useState([]);
  const resourcesRef = reactExports.useRef(resources);
  const uiOptionsStore = useUiOptionsStore();
  const uiOptions = uiOptionsStore.data;
  const resourceOptions = useResourceOptionsStore();
  const resourceOptionsInitializedRef = reactExports.useRef(false);
  const [columnCount, setColumnCount] = reactExports.useState(0);
  const [searchForm, setSearchForm] = reactExports.useState();
  const searchFormRef = reactExports.useRef(searchForm);
  const [searching, setSearching] = reactExports.useState(true);
  const searchingRef = reactExports.useRef(false);
  const [selectedIds, setSelectedIds] = reactExports.useState([]);
  const selectedIdsRef = reactExports.useRef(selectedIds);
  const [multiSelection, setMultiSelection] = reactExports.useState(false);
  const multiSelectionRef = reactExports.useRef(multiSelection);
  const resourcesComponentRef = reactExports.useRef();
  const rearrangeResources = reactExports.useCallback(() => {
    var _a2;
    (_a2 = resourcesComponentRef.current) == null ? void 0 : _a2.rearrange();
  }, []);
  const reloadResources = reactExports.useCallback((ids2) => {
    BApi$1.resource.getResourcesByKeys({ ids: ids2 }).then((r2) => {
      for (const res of r2.data || []) {
        const idx = resources.findIndex((x2) => x2.id == res.id);
        if (idx > -1) {
          resources[idx] = res;
        }
      }
      setResources([...resources]);
    });
  }, []);
  const onSearch = reactExports.useCallback(async (f2, newTab) => {
    var _a2;
    if (newTab) {
      (_a2 = props.searchInNewTab) == null ? void 0 : _a2.call(props, { page: 1, pageSize: 50, ...f2 });
    } else {
      search2(
        {
          ...f2,
          page: 1
        },
        "replace",
        false,
        true
      );
    }
  }, []);
  const onSelectAllChange = reactExports.useCallback(async (selected, includeNotLoaded) => {
    if (selected) {
      if (includeNotLoaded) {
        const r2 = await BApi$1.resource.searchAllResourceIds(
          searchFormRef.current ?? { page: 1, pageSize: 1e8 }
        );
        const ids2 = r2.data || [];
        setSelectedIds(ids2);
      } else {
        setSelectedIds(resourcesRef.current.map((r2) => r2.id));
      }
    } else {
      setSelectedIds([]);
    }
  }, []);
  const { createPortal } = useBakabaseContext();
  const initStartPageRef = reactExports.useRef(1);
  log$i("render");
  reactExports.useEffect(() => {
    if (resourceOptionsInitializedRef.current) {
      return;
    }
    if (resourceOptions.initialized) {
      BApi$1.resource.getSavedSearch({ id: props.searchId }).then((r2) => {
        const sf2 = r2.data;
        resourceOptionsInitializedRef.current = true;
        setSearchForm(sf2.search);
        log$i("Initial search form", sf2);
        search2(sf2.search, "replace");
      });
    }
  }, [resourceOptions.initialized]);
  const onKeyDown = reactExports.useCallback((e2) => {
    if (e2.key == "Control" && !multiSelectionRef.current) {
      setMultiSelection(true);
    }
  }, []);
  const onKeyUp = reactExports.useCallback((e2) => {
    if (e2.key == "Control" && multiSelectionRef.current) {
      setMultiSelection(false);
    }
  }, []);
  const onClick = reactExports.useCallback((e2) => {
    if (!multiSelectionRef.current) {
      if (selectedIdsRef.current.length != 0) {
        setSelectedIds([]);
      }
    }
  }, []);
  reactExports.useEffect(() => {
    return () => {
      window.removeEventListener("keydown", onKeyDown);
      window.removeEventListener("keyup", onKeyUp);
      window.removeEventListener("click", onClick);
    };
  }, []);
  const prevActivated = usePrevious$1(props.activated);
  reactExports.useEffect(() => {
    if (typeof window === "undefined") {
      return;
    }
    if (props.activated == prevActivated) {
      return;
    }
    if (props.activated) {
      window.addEventListener("keydown", onKeyDown);
      window.addEventListener("keyup", onKeyUp);
      window.addEventListener("click", onClick);
    } else {
      window.removeEventListener("keydown", onKeyDown);
      window.removeEventListener("keyup", onKeyUp);
      window.removeEventListener("click", onClick);
    }
  }, [props.activated]);
  reactExports.useEffect(() => {
    multiSelectionRef.current = multiSelection;
  }, [multiSelection]);
  reactExports.useEffect(() => {
    var _a2;
    if (uiOptionsStore.initialized) {
      const c2 = ((_a2 = uiOptions == null ? void 0 : uiOptions.resource) == null ? void 0 : _a2.colCount) ? uiOptions.resource.colCount : BusinessConstants.DefaultResourceColumnCount;
      if (!uiOptions.resource || uiOptions.resource.colCount == 0) {
        BApi$1.options.patchUiOptions({
          resource: {
            ...uiOptions.resource || {},
            colCount: c2
          }
        });
      }
      if (columnCount == 0 || columnCount != c2) {
        setColumnCount(c2);
      }
    }
  }, [uiOptions]);
  reactExports.useEffect(() => {
    searchFormRef.current = searchForm;
  }, [searchForm]);
  reactExports.useEffect(() => {
    searchingRef.current = searching;
  }, [searching]);
  reactExports.useEffect(() => {
    pageableRef.current = pageable;
  }, [pageable]);
  reactExports.useEffect(() => {
    resourcesRef.current = resources;
  }, [resources]);
  if (selectedIdsRef.current !== selectedIds) {
    selectedIdsRef.current = selectedIds;
    log$i("SelectedIds", selectedIds);
  }
  const pageContainerRef = reactExports.useRef();
  const search2 = reactExports.useCallback(
    async (partialForm, renderMode, replaceSearchCriteria = false, save = true) => {
      console.trace();
      const baseForm = replaceSearchCriteria ? {} : searchFormRef.current;
      const newForm = {
        ...baseForm,
        ...partialForm,
        pageSize: PageSize$1
      };
      setSearchForm(newForm);
      log$i("Search resources", newForm);
      const dto = newForm;
      if (resourcesRef.current.length == 0 || renderMode == "replace") {
        initStartPageRef.current = newForm.page ?? 1;
      }
      if (renderMode == "replace") {
        setResources([]);
      }
      setSearching(true);
      const rsp = await BApi$1.resource.searchResources(dto, {
        saveSearch: save,
        searchId: props.searchId
      });
      if (renderMode == "replace") {
        setPageable({
          page: rsp.pageIndex,
          pageSize: PageSize$1,
          totalCount: rsp.totalCount
        });
      }
      setSearchForm({
        ...newForm,
        page: rsp.pageIndex
      });
      const newResources = rsp.data || [];
      switch (renderMode) {
        case "append":
          setResources([...resourcesRef.current, ...newResources]);
          break;
        case "prepend":
          setResources([...newResources, ...resourcesRef.current]);
          break;
        default:
          setResources(newResources);
          break;
      }
      setSearching(false);
    },
    []
  );
  const onSelect = reactExports.useCallback((id2) => {
    const selected = selectedIdsRef.current.includes(id2);
    if (selected) {
      setSelectedIds(selectedIdsRef.current.filter((x2) => x2 != id2));
    } else {
      setSelectedIds([...selectedIdsRef.current, id2]);
    }
  }, []);
  const onSelectedResourcesChanged = reactExports.useCallback((ids2) => {
    BApi$1.resource.getResourcesByKeys({ ids: ids2, additionalItems: ResourceAdditionalItem.All }).then((res) => {
      const rs = res.data || [];
      for (const r2 of rs) {
        const idx = resourcesRef.current.findIndex((x2) => x2.id == r2.id);
        if (idx > -1) {
          resourcesRef.current[idx] = r2;
        }
      }
      setResources([...resourcesRef.current]);
    });
  }, []);
  const renderCell = reactExports.useCallback(
    ({ columnIndex, key, parent, rowIndex, style: style2, measure }) => {
      const index2 = rowIndex * columnCount + columnIndex;
      if (index2 >= resources.length) {
        return null;
      }
      const resource2 = resources[index2];
      const selected = selectedIdsRef.current.includes(resource2.id);
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        "div",
        {
          onLoad: measure,
          className: "relative p-0.5",
          style: {
            ...style2
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            ResourceMemo,
            {
              biggerCoverPlacement: index2 % columnCount < columnCount / 2 ? "right" : "left",
              mode: multiSelection ? "select" : "default",
              resource: resource2,
              selected,
              selectedResourceIds: selectedIdsRef.current,
              onSelected: onSelect,
              onSelectedResourcesChanged
            }
          )
        },
        resource2.id
      );
    },
    [resources, multiSelection, columnCount]
  );
  reactExports.useImperativeHandle(ref, () => ({
    getCurrentSearch: () => searchFormRef.current
  }));
  log$i(searchForm == null ? void 0 : searchForm.page, pageable == null ? void 0 : pageable.page, `initialized: ${resourceOptionsInitializedRef.current}`);
  if (!resourceOptionsInitializedRef.current) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      ref: (r2) => {
        pageContainerRef.current = r2 == null ? void 0 : r2.parentElement;
      },
      className: `flex flex-col h-full max-h-full relative`,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          FilterPanel,
          {
            multiSelection,
            rearrangeResources,
            reloadResources,
            resourceCount: resources.length,
            searchForm,
            selectedResourceIds: selectedIds,
            totalFilteredResourceCount: pageable == null ? void 0 : pageable.totalCount,
            onSearch,
            onSelectAllChange
          }
        ),
        columnCount > 0 && resources.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          pageable && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-end py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            pagination_default,
            {
              showControls: true,
              boundaries: 3,
              page: pageable.page,
              size: "sm",
              total: pageable.pageSize == void 0 ? 0 : Math.ceil(pageable.totalCount / pageable.pageSize),
              onChange: (p2) => {
                search2(
                  {
                    page: p2
                  },
                  "replace"
                );
              }
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Resources,
            {
              ref: (r2) => {
                resourcesComponentRef.current = r2;
              },
              cellCount: resources.length,
              columnCount,
              renderCell,
              onScroll: (e2) => {
                var _a2, _b2, _c2;
                if (!props.activated) {
                  return;
                }
                if (e2.scrollHeight < e2.scrollTop + e2.clientHeight + 200 && !searchingRef.current) {
                  searchingRef.current = true;
                  const totalPage = Math.ceil(((pageable == null ? void 0 : pageable.totalCount) ?? 0) / PageSize$1);
                  if (((_a2 = searchFormRef.current) == null ? void 0 : _a2.page) != void 0 && searchFormRef.current.page < totalPage) {
                    search2(
                      {
                        page: searchFormRef.current.page + 1
                      },
                      "append",
                      false,
                      false
                    );
                  }
                }
                const items = (_b2 = pageContainerRef.current) == null ? void 0 : _b2.querySelectorAll("div[role='resource']");
                if (items && items.length > 0) {
                  const x2 = e2.clientWidth / 2;
                  const y2 = e2.scrollTop + e2.clientHeight / 2;
                  log$i("on Scroll", `center: ${x2},${y2}`);
                  let closest2 = items[0];
                  let minDis = Number.MAX_VALUE;
                  for (const item of items) {
                    const parent = item.parentElement;
                    const ix = parent.offsetLeft + parent.clientWidth / 2;
                    const iy = parent.offsetTop + parent.clientHeight / 2;
                    const dis = Math.abs((ix - x2) ** 2 + (iy - y2) ** 2);
                    if (dis < minDis) {
                      minDis = dis;
                      closest2 = item;
                    }
                  }
                  const centerResourceId = parseInt(closest2.getAttribute("data-id"), 10);
                  const pageOffset = Math.floor(
                    resources.findIndex((r2) => r2.id == centerResourceId) / PageSize$1
                  );
                  const currentPage = pageOffset + initStartPageRef.current;
                  log$i(
                    "on Scroll",
                    "center item",
                    centerResourceId,
                    closest2,
                    "page offset",
                    pageOffset,
                    "active page",
                    currentPage
                  );
                  if (currentPage != ((_c2 = pageableRef.current) == null ? void 0 : _c2.page)) {
                    setPageable({
                      ...pageableRef.current,
                      page: currentPage
                    });
                    BApi$1.options.patchResourceOptions({
                      searchCriteria: searchFormRef.current
                    });
                  }
                }
              },
              onScrollToTop: () => {
              }
            }
          )
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: "mt-10 flex items-center gap-2 justify-center left-0 w-full bottom-0",
            style: { position: resources.length == 0 ? "relative" : "absolute" },
            children: searching ? /* @__PURE__ */ jsxRuntimeExports.jsx(card_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { className: "w-[120px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { label: t2("Searching...") }) }) }) : resources.length == 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-2 flex items-center gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$V, { className: "text-base" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { variant: "light", children: t2("Resource Not Found. You can try the following solutions:") })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                  t2("1. Please check if the search criteria is correct."),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      color: "primary",
                      radius: "sm",
                      size: "sm",
                      variant: "light",
                      onClick: () => {
                        search2({ page: 1 }, "replace", true);
                      },
                      children: t2("Reset search criteria")
                    }
                  )
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                  t2(
                    "2. Please ensure that media libraries are created, bound to a template, and fully synchronized."
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(link_default, { isBlock: true, href: "#/media-library", size: "sm", underline: "none", children: t2("Go to media library page") })
                ] })
              ] })
            ] })
          }
        )
      ]
    }
  );
});
ResourceTabContent.displayName = "ResourceTabContent";
const ResourcePage2 = () => {
  const { t: t2 } = useTranslation();
  const [savedSearches, setSavedSearches] = reactExports.useState([]);
  const [editingId, setEditingId] = reactExports.useState(null);
  const [editingName, setEditingName] = reactExports.useState("");
  const [activeSearchId, setActiveSearchId] = reactExports.useState();
  const resourceOptions = useResourceOptionsStore();
  const optionsInitialized = reactExports.useRef(false);
  const activatedSearchIds = reactExports.useRef(/* @__PURE__ */ new Set());
  const inputRef = reactExports.useRef(null);
  reactExports.useEffect(() => {
    if (editingId && inputRef.current) {
      inputRef.current.focus();
      inputRef.current.select();
    }
  }, [editingId]);
  const changeTab = reactExports.useCallback((searchId) => {
    activatedSearchIds.current.add(searchId);
    setActiveSearchId(searchId);
  }, []);
  reactExports.useEffect(() => {
    if (optionsInitialized.current) {
      return;
    }
    if (resourceOptions.initialized) {
      const ss1 = resourceOptions.data.savedSearches ?? [];
      if (ss1.length == 0) {
        searchInNewTab({ page: 1, pageSize: 50 });
      } else {
        setSavedSearches(ss1);
        changeTab(ss1[0].id);
      }
      optionsInitialized.current = true;
    }
  }, [resourceOptions.initialized]);
  const searchInNewTab = async (f2) => {
    const nrs = {
      search: f2
      // id: uuidv4().slice(0, 6),
    };
    const newSearch = (await BApi$1.resource.saveNewResourceSearch(nrs)).data;
    setSavedSearches((prev2) => [...prev2, newSearch]);
    changeTab(newSearch.id);
  };
  const beginRename = (id2) => {
    const current = savedSearches.find((x2) => x2.id == id2);
    setEditingId(id2);
    setEditingName((current == null ? void 0 : current.name) ?? "");
  };
  const commitRename = async () => {
    if (editingId == null)
      return;
    const name2 = editingName.trim();
    if (!name2) {
      setEditingId(null);
      return;
    }
    setSavedSearches((prev2) => {
      const next2 = prev2.slice();
      const editingSearch = next2.find((x2) => x2.id == editingId);
      if (editingSearch) {
        editingSearch.name = name2;
      }
      return next2;
    });
    try {
      await BApi$1.resource.putSavedSearchName(name2, { id: editingId });
    } finally {
      setEditingId(null);
    }
  };
  const removeSaved = async (id2) => {
    var _a2;
    await BApi$1.resource.deleteSavedSearch({ id: id2 });
    const idx = savedSearches.findIndex((x2) => x2.id == id2);
    const prev2 = savedSearches[idx - 1];
    const next2 = savedSearches[idx + 1];
    setSavedSearches((prev22) => prev22.filter((s2) => s2.id != id2));
    changeTab((_a2 = prev2 ?? next2) == null ? void 0 : _a2.id);
  };
  console.log("saved searches", savedSearches);
  if (!resourceOptions.initialized) {
    return null;
  }
  const ss = savedSearches.slice();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full max-h-full ", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      tabs_default,
      {
        classNames: { panel: "grow py-0 px-0", tabList: ss.length == 1 ? "hidden" : "" },
        destroyInactiveTabPanel: false,
        selectedKey: activeSearchId,
        variant: "underlined",
        onSelectionChange: (key) => {
          changeTab(key);
        },
        children: ss.map((s2, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
          tab_item_base_default,
          {
            className: "w-auto",
            title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
              activeSearchId == s2.id || activeSearchId == void 0 && i2 == 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: editingId == s2.id ? /* @__PURE__ */ jsxRuntimeExports.jsx(
                input_default,
                {
                  ref: inputRef,
                  size: "sm",
                  className: "max-w-xs w-auto min-w-auto",
                  value: editingName,
                  onValueChange: (v2) => setEditingName(v2),
                  onBlur: () => {
                    if (editingId == s2.id)
                      commitRename();
                  },
                  onKeyDown: (e2) => {
                    if (e2.key === "Enter") {
                      e2.preventDefault();
                      commitRename();
                    }
                    if (e2.key === "Escape") {
                      e2.preventDefault();
                      setEditingId(null);
                    }
                  }
                }
              ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
                "div",
                {
                  className: "max-w-xs w-auto min-w-auto outline-none",
                  onClick: (e2) => {
                    if (activeSearchId == s2.id && editingId != s2.id) {
                      e2.preventDefault();
                      beginRename(s2.id);
                    }
                  },
                  children: s2.name
                },
                s2.id
              ) }) : s2.name,
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                button_default$1,
                {
                  isIconOnly: true,
                  variant: "light",
                  onPress: () => {
                    removeSaved(s2.id);
                  },
                  size: "sm",
                  className: "opacity-60",
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineClose, { className: "text-sm" })
                }
              )
            ] })
          },
          s2.id
        ))
      }
    ),
    ss.map((s2) => {
      const isActive2 = s2.id == activeSearchId;
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `grow ${isActive2 ? "" : "hidden"}`, children: activatedSearchIds.current.has(s2.id) && /* @__PURE__ */ jsxRuntimeExports.jsx(
        ResourceTabContent,
        {
          activated: isActive2,
          searchId: s2.id,
          searchInNewTab
        }
      ) }, s2.id);
    })
  ] });
};
function IoIosSync(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M492 257.1c-2.6-2.6-6-4-9.6-4-3.6 0-7 1.4-9.6 4l-13 13c4.3-61.8-19.5-122.5-65.3-165C356.9 70.2 307.7 51 256.1 51c-26.7 0-52.8 5.1-77.4 15.1-25.5 10.4-48.3 25.6-67.7 45.3-13.2 13.4-24.6 28.5-33.6 44.8-1.9 3.4-2.3 7.4-1.2 11.1 1.1 3.7 3.8 6.8 7.2 8.5 2 1 4.2 1.5 6.4 1.5 5.2 0 9.9-2.8 12.4-7.3 7.9-14.3 17.8-27.5 29.4-39.1 16.8-16.8 36.3-29.8 58.1-38.7 21.1-8.6 43.4-12.9 66.2-12.9 22.9 0 45.2 4.3 66.3 12.9 21.8 8.9 41.4 21.9 58.2 38.8 20.3 20.4 35.4 45.6 43.8 73 7 22.9 9.2 47.3 6.6 71.2l-18.9-18.5c-2.5-2.4-5.8-3.8-9.3-3.8-3.5 0-6.9 1.4-9.4 3.9-5.2 5.2-5.2 13.6 0 18.8l42.8 42.9c1.9 1.9 4.4 2.9 7 2.9 2.6 0 5.1-1 7-2.9l42.1-42.2c5.2-5.3 5.2-13.9-.1-19.2zM428.6 335.9c-2-1-4.2-1.5-6.4-1.5-5.2 0-9.9 2.8-12.4 7.3-7.9 14.3-17.8 27.5-29.4 39.1-16.8 16.8-36.3 29.9-58.2 38.7-21.1 8.6-43.4 12.9-66.3 12.9s-45.2-4.3-66.2-12.9c-21.8-8.9-41.4-21.9-58.2-38.7-37.6-37.8-56-90.9-50.3-143.9l18.4 18.5c2.4 2.4 5.6 3.7 9 3.7 3.4 0 6.6-1.3 9-3.7l1.3-1.3c4.9-4.9 4.9-13 0-17.9l-42.9-43c-1.9-1.9-4.4-2.9-7-2.9-2.6 0-5.1 1-7 2.9l-42 42.3c-5.3 5.3-5.3 13.9 0 19.2 2.6 2.6 6 4 9.6 4 3.6 0 7-1.4 9.6-4l13-13.1c-1.8 25.8 1.3 52 9 76.5 9.9 31.4 26.8 59.3 50.3 82.8 19.5 19.6 42.2 34.7 67.6 45.1 24.5 10 50.4 15 76.9 15 26.5 0 52.4-5.1 76.9-15 25.4-10.3 48.1-25.5 67.6-45.1 13.5-13.5 25-28.8 34.2-45.4 1.9-3.4 2.3-7.4 1.2-11.1-1.2-3.7-3.8-6.8-7.3-8.5z" }, "child": [] }] })(props);
}
function BsController(props) {
  return GenIcon({ "attr": { "fill": "currentColor", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M11.5 6.027a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0m-1.5 1.5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1m2.5-.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0m-1.5 1.5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1m-6.5-3h1v1h1v1h-1v1h-1v-1h-1v-1h1z" }, "child": [] }, { "tag": "path", "attr": { "d": "M3.051 3.26a.5.5 0 0 1 .354-.613l1.932-.518a.5.5 0 0 1 .62.39c.655-.079 1.35-.117 2.043-.117.72 0 1.443.041 2.12.126a.5.5 0 0 1 .622-.399l1.932.518a.5.5 0 0 1 .306.729q.211.136.373.297c.408.408.78 1.05 1.095 1.772.32.733.599 1.591.805 2.466s.34 1.78.364 2.606c.024.816-.059 1.602-.328 2.21a1.42 1.42 0 0 1-1.445.83c-.636-.067-1.115-.394-1.513-.773-.245-.232-.496-.526-.739-.808-.126-.148-.25-.292-.368-.423-.728-.804-1.597-1.527-3.224-1.527s-2.496.723-3.224 1.527c-.119.131-.242.275-.368.423-.243.282-.494.575-.739.808-.398.38-.877.706-1.513.773a1.42 1.42 0 0 1-1.445-.83c-.27-.608-.352-1.395-.329-2.21.024-.826.16-1.73.365-2.606.206-.875.486-1.733.805-2.466.315-.722.687-1.364 1.094-1.772a2.3 2.3 0 0 1 .433-.335l-.028-.079zm2.036.412c-.877.185-1.469.443-1.733.708-.276.276-.587.783-.885 1.465a14 14 0 0 0-.748 2.295 12.4 12.4 0 0 0-.339 2.406c-.022.755.062 1.368.243 1.776a.42.42 0 0 0 .426.24c.327-.034.61-.199.929-.502.212-.202.4-.423.615-.674.133-.156.276-.323.44-.504C4.861 9.969 5.978 9.027 8 9.027s3.139.942 3.965 1.855c.164.181.307.348.44.504.214.251.403.472.615.674.318.303.601.468.929.503a.42.42 0 0 0 .426-.241c.18-.408.265-1.02.243-1.776a12.4 12.4 0 0 0-.339-2.406 14 14 0 0 0-.748-2.295c-.298-.682-.61-1.19-.885-1.465-.264-.265-.856-.523-1.733-.708-.85-.179-1.877-.27-2.913-.27s-2.063.091-2.913.27" }, "child": [] }] })(props);
}
function BsFileEarmark(props) {
  return GenIcon({ "attr": { "fill": "currentColor", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5z" }, "child": [] }] })(props);
}
function BsFolder(props) {
  return GenIcon({ "attr": { "fill": "currentColor", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.826a2 2 0 0 1-1.991-1.819l-.637-7a2 2 0 0 1 .342-1.31zM2.19 4a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91h10.348a1 1 0 0 0 .995-.91l.637-7A1 1 0 0 0 13.81 4zm4.69-1.707A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139q.323-.119.684-.12h5.396z" }, "child": [] }] })(props);
}
function BsRegex(props) {
  return GenIcon({ "attr": { "fill": "currentColor", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "d": "M3.05 3.05a7 7 0 0 0 0 9.9.5.5 0 0 1-.707.707 8 8 0 0 1 0-11.314.5.5 0 1 1 .707.707m9.9-.707a.5.5 0 0 1 .707 0 8 8 0 0 1 0 11.314.5.5 0 0 1-.707-.707 7 7 0 0 0 0-9.9.5.5 0 0 1 0-.707M6 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0m5-6.5a.5.5 0 0 0-1 0v2.117L8.257 5.57a.5.5 0 0 0-.514.858L9.528 7.5 7.743 8.571a.5.5 0 1 0 .514.858L10 8.383V10.5a.5.5 0 1 0 1 0V8.383l1.743 1.046a.5.5 0 0 0 .514-.858L11.472 7.5l1.785-1.071a.5.5 0 1 0-.514-.858L11 6.617z" }, "child": [] }] })(props);
}
const SyncTaskPrefix$1 = "SyncMediaLibrary_";
const BuildTaskId$1 = (id2) => `${SyncTaskPrefix$1}${id2}`;
const SyncStatus = ({ id: id2, onSyncCompleted }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const bTasks = useBTasksStore((state) => state.tasks);
  const taskId = BuildTaskId$1(id2);
  const task = bTasks == null ? void 0 : bTasks.find((d2) => d2.id == taskId);
  const prevStatusRef = reactExports.useRef(task == null ? void 0 : task.status);
  const data = task == null ? void 0 : task.data;
  reactExports.useEffect(() => {
    if (prevStatusRef.current != void 0 && prevStatusRef.current != BTaskStatus.Completed && (task == null ? void 0 : task.status) == BTaskStatus.Completed) {
      onSyncCompleted == null ? void 0 : onSyncCompleted();
    }
    prevStatusRef.current = task == null ? void 0 : task.status;
  }, [onSyncCompleted, task]);
  const elementTypes = [];
  if (task) {
    switch (task.status) {
      case BTaskStatus.NotStarted:
      case BTaskStatus.Running:
        elementTypes.push("progress");
        elementTypes.push("pause");
        elementTypes.push("cancel");
        break;
      case BTaskStatus.Paused:
        elementTypes.push("progress");
        elementTypes.push("start");
        elementTypes.push("cancel");
        break;
      case BTaskStatus.Error:
        elementTypes.push("progress");
        elementTypes.push("error");
        elementTypes.push("start");
        break;
      case BTaskStatus.Completed:
        elementTypes.push("completed");
        elementTypes.push("start");
        elementTypes.push("result");
        break;
      case BTaskStatus.Cancelled:
        elementTypes.push("start");
        break;
    }
  } else {
    elementTypes.push("start");
  }
  const components2 = elementTypes.map((et) => {
    switch (et) {
      case "progress":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(circular_progress_default, { showValueLabel: true, size: "sm", value: task.percentage });
      case "cancel":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "danger",
            size: "sm",
            variant: "light",
            onPress: async () => {
              await BApi$1.backgroundTask.stopBackgroundTask(taskId);
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineStopCircle, { className: "text-lg" })
          }
        );
      case "pause":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "warning",
            size: "sm",
            variant: "light",
            onPress: async () => {
              await BApi$1.backgroundTask.pauseBackgroundTask(taskId);
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(FaRegCirclePause, { className: "text-lg" })
          }
        );
      case "resume":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "secondary",
            size: "sm",
            variant: "light",
            onPress: async () => {
              await BApi$1.backgroundTask.resumeBackgroundTask(taskId);
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(GrResume, { className: "text-lg" })
          }
        );
      case "start":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Tooltip$1,
          {
            content: t2(
              "Once synced, you can search for resources in the media library"
            ),
            placement: "top",
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                color: "secondary",
                size: "sm",
                variant: "light",
                onPress: async () => {
                  await BApi$1.mediaLibraryV2.syncMediaLibraryV2(id2);
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSync, { className: "text-lg" })
              }
            )
          }
        );
      case "error":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "danger",
            size: "sm",
            variant: "light",
            onPress: async () => {
              createPortal(Modal, {
                defaultVisible: true,
                size: "xl",
                children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: task.error }),
                footer: {
                  actions: ["cancel"]
                }
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineWarning, { className: "text-lg" })
          }
        );
      case "completed":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(FaRegCircleCheck, { className: "text-lg" }) });
      case "result": {
        if (!data) {
          return null;
        }
        const items = [
          {
            value: dayjs.duration(
              Math.ceil(hooks.duration(task.elapsed).asSeconds()) * 1e3
            ).format("HH:mm:ss"),
            tip: void 0,
            icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFieldTime, { className: "text-base" })
          },
          {
            value: data == null ? void 0 : data.added,
            tip: "Added",
            icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-base" })
          },
          {
            value: data == null ? void 0 : data.deleted,
            tip: "Deleted",
            icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineMinusCircle, { className: "text-base" })
          },
          {
            value: data == null ? void 0 : data.updated,
            tip: "Updated",
            icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSync, { className: "text-base" })
          }
        ];
        return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: items.map((item, idx) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            Chip,
            {
              radius: "sm",
              size: "sm",
              startContent: item.icon,
              title: item.tip,
              variant: "light",
              children: item.value
            },
            idx
          );
        }) });
      }
      default:
        return null;
    }
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center", children: components2 });
};
SyncStatus.displayName = "SyncStatus";
function extractExtensions$1(text2) {
  return Array.from(
    new Set(
      text2.replace(/\n/g, " ").split(" ").map((x2) => {
        let trimmed = x2.trim();
        while (true) {
          const n2 = trimmed.replace(/^\.+|\.+$/g, "");
          if (n2.length == trimmed.length) {
            break;
          } else {
            trimmed = n2;
          }
        }
        return trimmed;
      }).filter((x2) => x2.length > 0).map((x2) => `.${x2}`)
    )
  );
}
const ExtensionsInput = ({
  label,
  placeholder,
  defaultValue: defaultValue2,
  onValueChange
}) => {
  const { t: t2 } = useTranslation();
  const [text2, setText] = reactExports.useState(defaultValue2 == null ? void 0 : defaultValue2.join(" "));
  const [extensions2, setExtensions] = reactExports.useState(
    defaultValue2
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      textarea_default,
      {
        fullWidth: true,
        isClearable: true,
        isMultiline: true,
        label: label ?? t2("Extensions"),
        minRows: 4,
        placeholder: placeholder ?? t2("Separate by space or newline"),
        value: text2,
        onValueChange: (v2) => {
          setText(v2);
          const newExtensions = extractExtensions$1(v2);
          setExtensions(newExtensions);
          onValueChange == null ? void 0 : onValueChange(newExtensions);
        }
      }
    ),
    extensions2 && extensions2.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 flex flex-wrap gap-1", children: extensions2.map((ext, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: ext }, i2)) })
  ] });
};
const PlayerSelectorModal = ({ players: propPlayers, onSubmit }) => {
  const { t: t2 } = useTranslation();
  const [players, setPlayers] = reactExports.useState(
    (propPlayers ?? []).map((p2) => ({ ...p2, pathType: "file" }))
  );
  const addPlayer = () => {
    setPlayers([
      ...players,
      {
        executablePath: "",
        command: "{0}",
        extensions: []
      }
    ]);
  };
  const removePlayer = (index2) => {
    const newPlayers = [...players];
    newPlayers.splice(index2, 1);
    setPlayers(newPlayers);
  };
  const updatePlayer = (index2, updates) => {
    const newPlayers = [...players];
    newPlayers[index2] = { ...newPlayers[index2], ...updates };
    setPlayers(newPlayers);
  };
  const validatePlayers = () => {
    return players.every(
      (player) => player.executablePath.trim() !== "" && player.pathType == "file"
    );
  };
  const handleSubmit = () => {
    if (validatePlayers()) {
      onSubmit == null ? void 0 : onSubmit(players);
    }
  };
  const hasInvalidPlayers = players.some(
    (player) => player.executablePath.trim() === "" || player.pathType != "file"
  );
  console.log(players);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      okProps: {
        isDisabled: hasInvalidPlayers
      },
      size: "xl",
      onOk: handleSubmit,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-lg font-semibold", children: t2("Configure Players") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              size: "sm",
              startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlus, {}),
              onPress: addPlayer,
              children: t2("Add Player")
            }
          )
        ] }),
        players.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center text-gray-500 py-8", children: t2(
          "No players configured. Click 'Add Player' to get started."
        ) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-4", children: players.map((player, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
          "div",
          {
            className: "border rounded-lg p-4 flex flex-col gap-3",
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: "font-medium", children: t2(`Player ${index2 + 1}`) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    isIconOnly: true,
                    color: "danger",
                    size: "sm",
                    variant: "light",
                    onPress: () => removePlayer(index2),
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-lg" })
                  }
                )
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-1 gap-3", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  PathAutocomplete,
                  {
                    isRequired: true,
                    errorMessage: player.executablePath.trim() === "" ? t2("Executable path is required") : "",
                    isInvalid: player.executablePath.trim() === "",
                    label: t2("Executable Path"),
                    pathType: "file",
                    placeholder: t2("Path to the player executable"),
                    value: player.executablePath,
                    onChange: (value2, type4) => updatePlayer(index2, {
                      executablePath: value2,
                      pathType: type4
                    })
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  input_default,
                  {
                    description: t2(
                      "Use {0} as placeholder for the file path"
                    ),
                    label: t2("Command"),
                    placeholder: "{0}",
                    value: player.command,
                    onValueChange: (value2) => updatePlayer(index2, { command: value2 })
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  ExtensionsInput,
                  {
                    defaultValue: player.extensions,
                    label: t2("Supported file extensions"),
                    onValueChange: (extensions2) => updatePlayer(index2, { extensions: extensions2 })
                  }
                )
              ] })
            ]
          },
          index2
        )) }),
        hasInvalidPlayers && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-red-500 text-sm mt-2", children: t2("Please fill in all executable paths before saving.") })
      ] })
    }
  );
};
PlayerSelectorModal.displayName = "PlayerSelectorModal";
const SyncTaskPrefix = "SyncMediaLibrary_";
const BuildTaskId = (id2) => `${SyncTaskPrefix}${id2}`;
const OutdatedModal = reactExports.forwardRef(({}, ref) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [mediaLibraries, setMediaLibraries] = reactExports.useState([]);
  const bTasks = useBTasksStore((state) => state.tasks);
  reactExports.useImperativeHandle(
    ref,
    () => ({
      check: async () => {
        var _a2;
        const data = ((_a2 = await BApi$1.mediaLibraryV2.getOutdatedMediaLibrariesV2()) == null ? void 0 : _a2.data) ?? [];
        setMediaLibraries(data);
      }
    }),
    []
  );
  const unhandledMediaLibraries = mediaLibraries.filter((ml2) => {
    const taskId = BuildTaskId(ml2.id);
    var hasUnfinishedTask = bTasks.some(
      (x2) => x2.id == taskId && (x2.status == BTaskStatus.Paused || x2.status == BTaskStatus.NotStarted || x2.status == BTaskStatus.Running)
    );
    return !hasUnfinishedTask;
  });
  const mlIds = unhandledMediaLibraries.map((ml2) => ml2.id);
  const close = reactExports.useCallback(() => {
    setMediaLibraries([]);
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      footer: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            onPress: async () => {
              for (const uml of unhandledMediaLibraries) {
                await BApi$1.mediaLibraryV2.syncMediaLibraryV2(uml.id);
              }
              close();
            },
            children: t2("Sync now")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "default", onPress: close, children: t2("Later") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "warning",
            onPress: () => {
              createPortal(Modal, {
                defaultVisible: true,
                title: t2("Mark as synced"),
                children: t2("Are you sure you want to mark these libraries as synced?"),
                onOk: async () => {
                  await BApi$1.mediaLibraryV2.markMediaLibraryV2AsSynced(mlIds);
                  toast.success(t2("Marked as synced"));
                  close();
                }
              });
            },
            children: t2("Mark as synced")
          }
        )
      ] }),
      visible: unhandledMediaLibraries.length > 0,
      onClose: close,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Following media libraries may be outdated and should be synchronized:") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: unhandledMediaLibraries.map((ml2) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { children: ml2.name }, ml2.id)) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Resource will be displayed only after synchronization is complete.") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Would you like to synchronize now, or do it later manually?") })
      ] })
    }
  );
});
function SiKodi(props) {
  return GenIcon({ "attr": { "role": "img", "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M12.03.047c-.226 0-.452.107-.669.324-.922.922-1.842 1.845-2.763 2.768-.233.233-.455.48-.703.695-.31.267-.405.583-.399.988.02 1.399.008 2.799.008 4.198 0 1.453-.002 2.907 0 4.36 0 .11.002.223.03.327.087.337.303.393.546.15 1.31-1.31 2.618-2.622 3.928-3.933l4.449-4.453c.43-.431.43-.905 0-1.336L12.697.37c-.216-.217-.442-.324-.668-.324zm7.224 7.23c-.223 0-.445.104-.65.309L14.82 11.37c-.428.429-.427.895 0 1.322l3.76 3.766c.44.44.908.44 1.346.002 1.215-1.216 2.427-2.433 3.644-3.647.182-.18.353-.364.43-.615v-.33c-.077-.251-.246-.436-.428-.617-1.224-1.22-2.443-2.445-3.666-3.668-.205-.205-.429-.307-.652-.307zM4.18 7.611c-.086.014-.145.094-.207.157L.209 11.572c-.28.284-.278.677.004.96l2.043 2.046c.59.59 1.177 1.182 1.767 1.772.169.168.33.139.416-.084.044-.114.062-.242.063-.364.004-1.283.004-2.567.004-3.851h-.002V8.184c0-.085-.01-.169-.022-.252-.019-.135-.072-.258-.207-.309a.186.186 0 0 0-.095-.012zm7.908 6.838c-.224 0-.447.106-.656.315L7.66 18.537c-.433.434-.433.899.002 1.334 1.215 1.216 2.43 2.43 3.643 3.649.18.18.361.354.611.433h.33c.244-.069.423-.226.598-.402 1.222-1.23 2.45-2.453 3.676-3.68.43-.43.427-.905-.004-1.338l-3.772-3.773c-.208-.208-.432-.311-.656-.31z" }, "child": [] }] })(props);
}
const DLsite = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFkAAAAZCAMAAABtjXLxAAAAt1BMVEUAAAAFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoP8yAAFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoP8yAD8yAAFKoMFKoMFKoP8yAAFKoP8yAD8yAD8yAD8yAAFKoP8yAAFKoP8yAAFKoP8yABxWlg8AAAAO3RSTlMAMPBgoNGQ4AjmD8XAtSUC8xr9+bCYPSrqpoNQTDXYu/6ynIltWEUgzK17eGTn2mRPSTPQxpqJfX0WCvdznL4AAAIjSURBVEjHldRpg5owEAbgMcISbhAVRcBrPVb37t30//+ukpFggoHa9wtxkIcEMgDDzLwsBZEBlqAzH+v1Mz9ahBALOsOaeNP75I8/VThNGGOkXxaZ0HvkNZe//p/MXOde+cvdsqDpv+VnLn+v5ehwiPvkbGOLB9InTycuP//z5eXbb5QxHlxCd8bRevVPgSwPINxZDDPtlGOvqo4r36iya8vhm5jcah7LMoDj43DZJR9sdpGH/PjQkumYXUP2igz0iONAL1OT9ch0yeQke0WGKY4f9fKZ6WVC/Gq4FeSonvVBkaHk47lWDme8NtoUbRnPpghGWQBhYTAeX5Wx6GrlAt/NAkArb/ALwRVxnn0q8gMfm1p5eFnOjRzhgvAeOdTZ4B9u5+xp5R+89HYrE3wYOKO9WcfCn4qMr9/QyrichSrbQt5jjy3U7SHLwap7bxjX9Q5Fr1pCznllq8pMlp969vMS+/MqG7L8iS2mytFVDjMcuqCTnYiX0ls5wi5K+I4sBnLSRg58hnnXyeEcdzNV5bK527j+BGPygfRFOp+91QX2QcjDOgDF1hTLUWS8nRk33VvmIcCvbDQLhCzFjlGWg/sCs2vJ71iN3Ll4RYyYryOuBC0Z26hb9qElh0eGsQCcUp2g05LLFLpl02nLEMyEDLHJpJxAkaOMQrfsI6zKEI+FDHSbNDNegCRb/iNeqpftpxygLWOKiZVYgIlPLmGJvayhv5Y94zAKuFkxAAAAAElFTkSuQmCC";
const Bangumi = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIcAAAAjCAYAAAC+ahnyAAAKRElEQVR42uzXSWhTURTGcYcuGumiC0VQ1IXSlWMRFHFZcKcuRVfqQg3oWkRcxaJSCBa1aG0QSRWr1lonHKJGFIeNglarUuhI0zkd6Ljpv+VbHB4paUpCSrkXfrzkcd65J/ccAm+RW265tYBW/PL1nSjvDZYtTuGZQlxAbrqLycEqrJy+wrUoq8NRhLc4MMv4LajEYyxPdzFn8Qd1qMdF16KsD8g5RLEtSdxeRFCDTekuYi2a0IkOxLDRtSfrw5GHatQif4YYP6KowOpMFBFEj1HqWjNvBmQrPqPEc38ZivERAfgysXkBYuhHXJ8LXFvm1YCcwFcc1PcVCOEL/JncuBxDMohi147U19RbBWe3NMWzX5JC7DV8wz5U4ROK5tjz3NkEbcYARmRYBUQQxXt5p3svcR8B7E6Q7zw+4DXe6Or1Sl6gFhU4hXXeH4Bbeua58cx4Kk9Qjbu4hP3ISVDfHgRxT/E18sjjgXLdwGlsT5DrpOqvUnwZfEnO+4hi72h/v+77cFV1hVEpYQnhIX7gu0RQihBuogTHsN6zZz6u4DZCcjjpcKiYCRk3xoxRGTGG5YzJtcv+AxkD0m/EjT75jx0m31H0oNvoQqfR4RFDu4SRZ/IF0Ga0osVoNpqk0Thucm3APzQYh5Kc9Ro19y/qpdAMzW+jzvglP+OT7Zt5bFXVFsYT2oKCDNqGBxqkPJTHYC19UAcKz0IfahlsH2J9oGKROhYH0DgrFQecLVVTsCClBcGCKCJDYlAUBxIHBhMFqVAQi2AqdQCMUOr3x+8mKytXzmmKidF7kl8ud6+z993Dt9da+5wyfeamyKdho2ED4SfLJayfwiesefsgYZwnGsQRw+co+lW3o6pQ6n4rIBahvenEcjzLYgtlVfCyqBQfI5qfjHhKTZa+0Ylnlahg1803VCKELVZAkEV7mRHxGAG9hdeaI+ZCuShj7DucgNaL42ivxAno5RAbcaqoNhRTfqJ4H7FtgfniWULJU3jsz2GTmEkfnmF+P4sICF40uclaJ6ChgV6DsNFoqBJtAup8LBoMpU14gufbSsfLHID9ZjEnW+/D7x4X9EwAEX0P60QHcoE3nPeZLloG5A/vi91QKx7kd/qIHcb71Ih+AX07TWzm3u2IIwXbJOeBlop4U7elWGXEU+La7kgq8IURUB62250HWihaBC3McCsMFqBLCE/zi6mzX5zWjES41IWvlSZG7nDh6/KAto4XH7nwdQW2nCjhq0NAe4NY/L1QLTpjm+U80IwQYy1xIayM8iR2c43hQp/bGOFUi/7OPg7RbEVAK0WcOJlQstmQSbXAXdFoeCrEANfaOiYEJKDQCjH3KJTDbJK9Q3ifwzCE9qbY/IddER/Qt4nG+/xMbG0l4sUHLv+5NcRYl+F96mAK5Wlir/FAX4t/Bb3v4L5a2CX6YrvX5T+v2rqEhY0mfM31ySYecpsR0GhsDyOmrTAvzI4d6RZ5n+jcxDoHI5NCbGxsJu+Z+LuH/KcBRod4ivilS6ALsOU5D1QTlIyRWP9g2Gm8RoXYZygOMd8LXAI9j/JTWLzdhsGu7t0R8cBAvylcAv22eUf2hdgO20RGUEfjiN+NhqKAOglivatTZo7CvzrbLgZU6zGxutGRbZI2W/6hiAvo32TjgQ7hYo9nkj51p69JIRZzUcQDwSOU9yc8/Qi1IjlEKK5zpGN7THwHe8USV7ez2GLC1+IoXmO9O32Nw/aoO4FVhPEao+zkM8CkgDrjbB0m7nRsC52tgt2fiEv0tBJlrs67Jv7WOdsFAX07UexydQqxjXfJc3WIhDuN8f0Ce8Qp2Ja45HlaiPle4Y7vr5lj7Tcugc5wdR9wp69Mvync8X0dyWs3PGQt7BT9w3iN99xEFgQ9SUO9ts4L2M4Rh0x5nUgM8Vr5Z9fehWYn2fLlYd5aujrV9Lmt+MrZ8kKFADwQPET5EJc8V4tWAW3lMVbLAGzPueR5nqvbFdHvg2i5yJf2BGYS8Blij2FG2Mfkh92ElYscGCVyRba4gDxjhb2fielBUrvM2erFzWKE+B/tXUR7/xX5Yrurs4a+ncwkNEKDGBAwnn+Ib117E7FNsuVQyjhz6V8OfRsmhoprGV+jOMLEdhQtxGrRAIdZuKs59eVaaK9Q7HYPD5fQt56i3nigOpHiTzfu+Y/3GkUu9/mIzd+bOalDNN+InoHiYGCNzeRGc3Tc1cy2doo+tDfb2RaFGM8Trk6NaINtDmXN4S7aasdEe/sRQ4PFeh/YKrrTXpXzQi+4cfVCFAfgDWfvgvDs0+crsb0k6g1Ph3/1S9xs4iR9z9l5mGvvYrHZhZYgfhXb2MVdaSfL3kP/UkK8E/Je8CZj70nmfrAJ/fLCbW/aG8tYDzdxrNWEkC60k+2O7/X2KIyXWuTE473GTHHAsIHk+3z3+uJr5rjJr+gzcPVZfAqgjDjbT5x6lLbasFDnUedo/EekMOm+P0NFBu2khvzjpPOpM5C23RNPRCJ7tLGZuqliuTjiwlO0I3NqyLEOEmeIdr4/5rczxZnOHk/7gyA9Sj/OxRaZr26U9xaDjb1X7F15My8mtd4IY7toHZuZv95Ct2eHt7VYsLcRiYTGHS4cXB+byb+eMO5goasD4B1E1Idx60SCbbfh/mkdRJJIhqHiFjHG3ZfHZ2uRJs4W3Y39LJElBoo4kSCuEidgP11cJ/LFlWKkuEzkw6WmrUzo6/qQTHkH03e+/73/znJ/M04mB8UropNvm8WcLSaKhSzo/aI39pPEBDFZ/FsUilJxs5gvuop46k0S14sTREsxR5xEO/8UBeISMVq8glhGiStErunTBha9WORTli+KKC9HGOV8f+1vKxCeOawWS5vIMlFp3vp6YXQXw8Q8FqiCxVvKQvYQqWKVuJMdf5PIRhBTRS8WfgJ1C0QfvMezZpcniU5iOOJ7UzyIQNqJNNOvNfbfvsxfEdHE4ssxvBDHaJGDINaJ1eL/LHQK9w1HQOfgHVaKaeIdcSr3XIotV4wRlWKTWCCuERniNhbyIvGkGIJAcsScKILINd6i6HfHgeeIreixFUdHcS27eLy4AVEsY/F6EOfnw0xEcgb17xSpxu1PxnN0ou6LeJEkcS7eZQphbK2YLmZFQojpVw0ho5zv0cXB78bE8ceII108zMKPEStEAWWVYgQJ6FjxhBjMTn9dPCLeFl1pa6S4XYzlewvE1JbvA0QhISWF9rrhTUY4caxxn8kIJeqFh7kltqLHXiC9xQLCwnKRz8KNx362eF7cSNi4TwwjT3iIhDQBMY3Es6QgjjKRZBLfcWIUAntG3MPJKE1M9+IgpOSa0JFsPEnfSJ5BG/mx1TzGF4tfRUK6BNdfLAqxX0youUv0IzeZSq6ymFNKHKKYQFkfxDFLJNJOX9q/msW8AbEVIJQS06di4zGKzLG1GCQYxAOxlfwDLtz9cySbZ4qzyB0KzT3tRBELPAIuEdnUby2eFkMIE10QTIlINCJ8XKSTf2RQNx1vFfsvqrErdsWuP8n1GzoJaRomxDB7AAAAAElFTkSuQmCC";
const ExHentai = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAACXBIWXMAAAsTAAALEwEAmpwYAAAE7mlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgNzkuYjBmOGJlOSwgMjAyMS8xMi8wOC0xOToxMToyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIzLjIgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyMi0xMS0xN1QxNzowMzowNSswODowMCIgeG1wOk1ldGFkYXRhRGF0ZT0iMjAyMi0xMS0xN1QxNzowMzowNSswODowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjItMTEtMTdUMTc6MDM6MDUrMDg6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmYxYmIyYjJhLWMzMDUtNGQ0Yi05ZjE2LWI4NTI4ZGVjNjhiYyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpmMWJiMmIyYS1jMzA1LTRkNGItOWYxNi1iODUyOGRlYzY4YmMiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpmMWJiMmIyYS1jMzA1LTRkNGItOWYxNi1iODUyOGRlYzY4YmMiIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmYxYmIyYjJhLWMzMDUtNGQ0Yi05ZjE2LWI4NTI4ZGVjNjhiYyIgc3RFdnQ6d2hlbj0iMjAyMi0xMS0xN1QxNzowMzowNSswODowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDIzLjIgKFdpbmRvd3MpIi8+IDwvcmRmOlNlcT4gPC94bXBNTTpIaXN0b3J5PiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Ps76qPkAAAToSURBVFiF7VhbbxtFFD5zW6/vdmJbtuNUBKESmYSoIgghISJagRCCX8Qv4P/0ARXlBSEhpEqobfAD4qFJnDgkTh3Hji+7M7M8TDyeXW9sp01KH3Ke7N0z3/n2zLnNIM/z4F0S/H8TCModoVlyR2iWUP3rxw8fAECv3VZ/PSmlEOB5gTSMpdOrD7c2fvhu9asvY5m0+ap31v7719+ePf659mTbGQwAwLLt6jePNr7/9qOvH7GoDQBuf/DXL9sBHQD46WVNgbzDHnq1XwcAKcT0BU6v/2q/3m+fexOanpTDi173pHnWOFJPegDdk+bwoielVE9kmE44oZlU5hLPC+CofZ+uE07IikUBwOn19RNMKWEUIWQuiKXTC8uVaDqFCAlgIYQwpcy2MSHKJCaE2TamY5BQnXBChDEAAOgrpXSpmK2UU4UCtZi5wIrHK+vVTKk40vdzwpgwSiOW+jAasQijCOPpOuGETDdiSrOV8sqnm5X1qhWP+xZYLFUoZCtlwijcgoxBvVHcAQDCKFUoVNar97e+iKV9uQ0IEcYIo6EeuklCpmCMI/FYIp9bvLcccPhti+GhQC4ghAl5y2zALIwIIV9CeZ7kXHJ+XcTAh+kQVn9Dw9yUqR6iFNPrRC5CquRoKDPJ1ZPJQhCwSw00X71R5cuT8k13bVapDNgNd4Au8Kd7+yrLEMYquVRBEy7njnOJixC1LMKoYo8wxqNvMBuFaqLOYBBoJgExPGR4wpPe+fFx/UUNAFQdYnYkUy5ll8qRRGLY7bYODlv1A+64AEAtlq0sZZfKgBCmhDCmN1rjYEppJAIAfDisv6idHx970pu06yNklnDJeat+CPD0dHdPVepoJr2y+QlhLIXQ+fFJ/dnOP7//4VxcKMYffP4ZYSy+kKWWRSOWJqRxWvW6wpdCnDWOWvVDnS5Xtg6TqRSi3TjqnDQRvky9VKFg2dHF95btZKLbbB7s1GpPttXwFEuno8mkeoUpJYyRkQ2NU3++Y4BLybkOrCs9FAguKYQZjM2Xu2eNxqDTFY476HTPGg09Pzi9vnolhcCEEEJ9zvbjTErA7js8oAXqASYEU2puWaZUspMJYjE7mciUSplSUW+ZenWZgIL7+jQhmFJMzHjwbdmVdchsrpPjRzSTXlqrJnI5KxZL5HJLa9V+p6ODWr0ijEnOheuKkTGNkykVA0HdbhwpTp4//+cdP1Tapwr5SDyeKuQrG2vxxayZ9qlCHhDijsOHzjiDRjj3Hnys037vz+cATzsnTWUxEGHzjh9mYaQWs5PJ/PsrgcI46HQlF8J1NSGNs/pwSxdGyfnp7h7CaNIuvN74QTAmjKmR1xSEsSelJ6WuwhonUyqqJzGARD4XicfwFR3p9scPhAKlDxMCRqoHk8lY+Mbjh+cpS2Ynl5y7g4EOFCmEOxhIzs2JwLRr9K/AIfU1xo+RAR9JKYXL+dBRf/nQES73ruisMMNDQkxZeUsy7/gxFmPID45QN0to+vgxXjA6BiULeWr5jlQ3TGj6+KFFHRQBNmPZ7O0SEq47JiREq37QPvo39CgtOc9WKsXV+5Nw84TwpE44IfNUf0krLO2n3X7MkeShOibIOG4wIXji/uDaMqsMhuqYMvbQwnIF5rtBu/L2w2gU+nYs0ChwmI7vA+b57Lcp6O4mf4bcEZold4RmyX/ZNBBgOWF93AAAAABJRU5ErkJggg==";
const Bakabase = "/assets/bakabase-WV9_LjRj.png";
const EnhancerIcon = ({ id: id2 }) => {
  switch (id2) {
    case EnhancerId.Bakabase:
      return /* @__PURE__ */ jsxRuntimeExports.jsx("img", { alt: "", className: "max-h-[16px]", height: 16, src: Bakabase });
    case EnhancerId.ExHentai:
      return /* @__PURE__ */ jsxRuntimeExports.jsx("img", { alt: "", className: "max-h-[16px]", height: 16, src: ExHentai });
    case EnhancerId.Bangumi:
      return /* @__PURE__ */ jsxRuntimeExports.jsx("img", { alt: "", className: "max-h-[16px]", height: 16, src: Bangumi });
    case EnhancerId.DLsite:
      return /* @__PURE__ */ jsxRuntimeExports.jsx("img", { alt: "", className: "max-h-[16px]", height: 16, src: DLsite });
    case EnhancerId.Regex:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(BsRegex, { className: "text-base" });
    case EnhancerId.Kodi:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(SiKodi, { className: "text-base" });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$6, { className: "text-base" });
};
EnhancerIcon.displayName = "EnhancerIcon";
const log$h = buildLogger("TargetNotSetupTip");
const isSet = (options, isDefaultOfDynamic) => {
  return (options != void 0 && (options.propertyId != void 0 && options.propertyId > 0 || options.autoBindProperty || isDefaultOfDynamic)) ?? false;
};
const TargetNotSetupTip = ({ options, enhancer }) => {
  var _a2;
  const { t: t2 } = useTranslation();
  if ((options == null ? void 0 : options.active) != true) {
    return null;
  }
  const tom = ((_a2 = options == null ? void 0 : options.options) == null ? void 0 : _a2.targetOptions) ?? [];
  const setTargets = [];
  for (const target of enhancer.targets) {
    if (target.isDynamic) {
      const tos = tom.filter((x2) => x2.target == target.id);
      let bad = false;
      for (const to2 of tos) {
        if (!isSet(to2, to2.dynamicTarget == void 0)) {
          bad = true;
          break;
        }
      }
      if (!bad) {
        setTargets.push(target.id);
      }
    } else {
      const to2 = tom.find((x2) => x2.target == target.id);
      if (isSet(to2, false)) {
        setTargets.push(target.id);
      }
    }
  }
  const status = setTargets.length == 0 ? 3 : setTargets.length == enhancer.targets.length ? 1 : 2;
  log$h(options, enhancer, status, setTargets);
  switch (status) {
    case 1:
      return null;
    case 2:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Tooltip$1,
        {
          content: t2(
            "Some of targets are not mapped to a property, corresponding data will not be enhanced."
          ),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            RefIcon$R,
            {
              className: "text-small",
              style: { color: "var(--bakaui-warning)" }
            }
          )
        }
      );
    case 3:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Tooltip$1,
        {
          content: t2(
            "None of targets is mapped to a property, so no data will be enhanced."
          ),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            RefIcon$R,
            {
              className: "text-small",
              style: { color: "var(--bakaui-danger)" }
            }
          )
        }
      );
  }
};
TargetNotSetupTip.displayName = "TargetNotSetupTip";
const validate$5 = (form2) => {
  if (!form2.name || form2.name.length == 0) {
    return;
  }
  if (!form2.resourceType || !form2.resourceLayer) {
    return;
  }
  return form2;
};
const PresetTemplateBuilder = ({ onDestroyed, onSubmitted }) => {
  const { t: t2 } = useTranslation();
  const [dataPool, setDataPool] = reactExports.useState();
  const [form2, setForm] = reactExports.useState({});
  reactExports.useEffect(() => {
    BApi$1.mediaLibraryTemplate.getMediaLibraryTemplatePresetDataPool().then((r2) => {
      setDataPool(r2.data);
    });
  }, []);
  const propertyMap = _$2.keyBy((dataPool == null ? void 0 : dataPool.properties) ?? [], (x2) => x2.id);
  const resourceTypeGroups = _$2.groupBy(
    (dataPool == null ? void 0 : dataPool.resourceTypes) || [],
    (t22) => Math.floor(t22.type / 1e3)
  );
  const recommendProperties = (dataPool == null ? void 0 : dataPool.resourceTypePresetPropertyIds[form2.resourceType ?? 0]) || [];
  const recommendEnhancerIds = (dataPool == null ? void 0 : dataPool.resourceTypeEnhancerIds[form2.resourceType ?? 0]) || [];
  const validForm = validate$5(form2);
  console.log(form2, validForm, recommendProperties, recommendEnhancerIds);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          isDisabled: !validForm
        }
      },
      size: "full",
      title: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Preset media library template builder") }) }),
      onDestroyed,
      onOk: async () => {
        const r2 = await BApi$1.mediaLibraryTemplate.addMediaLibraryTemplateFromPresetBuilder(
          // @ts-ignore
          validForm
        );
        if (!r2.code) {
          onSubmitted == null ? void 0 : onSubmitted(r2.data);
        }
      },
      children: dataPool ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
        "div",
        {
          className: "grid gap-x-4 gap-y-2 items-center",
          style: { gridTemplateColumns: "auto 1fr" },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: t2("Resource type") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2", children: _$2.keys(resourceTypeGroups).map((type4) => {
              const resourceTypes = resourceTypeGroups[type4];
              return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                "div",
                {
                  className: "grid gap-2 items-center",
                  style: { gridTemplateColumns: "auto 1fr" },
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDoubleRight, { className: "text-base" }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1 flex-wrap", children: resourceTypes.map((tn2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
                      Button,
                      {
                        color: form2.resourceType == tn2.type ? "primary" : "default",
                        size: "sm",
                        onPress: () => {
                          if (form2.resourceType != tn2.type) {
                            setForm({
                              name: form2.name,
                              resourceType: tn2.type,
                              properties: dataPool.resourceTypePresetPropertyIds[tn2.type] || [],
                              enhancerIds: dataPool.resourceTypeEnhancerIds[tn2.type] || [],
                              resourceLayer: 1
                            });
                          }
                        },
                        children: [
                          tn2.name,
                          tn2.description && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: tn2.description, children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" }) })
                        ]
                      }
                    )) })
                  ]
                }
              );
            }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
            /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: t2("Properties") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1 flex-wrap", children: dataPool.properties.map((p2) => {
              var _a2;
              return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                Button,
                {
                  color: ((_a2 = form2.properties) == null ? void 0 : _a2.includes(p2.id)) ? "primary" : "default",
                  size: "sm",
                  variant: recommendProperties.includes(p2.id) ? "solid" : "flat",
                  onPress: () => {
                    const newProperties = form2.properties ? [...form2.properties] : [];
                    if (newProperties.includes(p2.id)) {
                      _$2.remove(newProperties, (t22) => t22 === p2.id);
                    } else {
                      newProperties.push(p2.id);
                    }
                    setForm({
                      ...form2,
                      properties: newProperties
                    });
                  },
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      BriefProperty,
                      {
                        fields: ["type", "name"],
                        property: {
                          pool: PropertyPool.Custom,
                          name: p2.name,
                          type: p2.type
                        }
                      }
                    ),
                    recommendProperties.includes(p2.id) && /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineLike, { className: "text-base" })
                  ]
                }
              );
            }) }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
            /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              t2("Resource layer"),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Tooltip$1,
                {
                  content: t2(
                    "You can configure how many levels deep the resource path should be under the media library path, and you can assign the intermediate directories as property values of the resource"
                  ),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" })
                }
              )
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-center", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", variant: "light", children: t2("Media library") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "warning", variant: "light", children: "/" }),
              form2.resourceLayer && form2.resourceLayer > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: _$2.range(0, form2.resourceLayer - 1).map((lp, idx) => {
                var _a2;
                return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Select,
                    {
                      className: "min-w-[200px]",
                      dataSource: (_a2 = form2.properties) == null ? void 0 : _a2.map((p2) => ({
                        label: propertyMap == null ? void 0 : propertyMap[p2].name,
                        value: p2
                      })),
                      label: t2("The {{layer}}th layer", {
                        layer: idx + 1
                      }),
                      size: "sm",
                      value: lp,
                      isClearable: true,
                      placeholder: t2("Not configured for now"),
                      onSelectionChange: (keys2) => {
                        const keyStr = Array.from(keys2)[0];
                        form2.layeredProperties[idx] = keyStr ? parseInt(keyStr, 10) : void 0;
                        setForm({
                          ...form2,
                          layeredProperties: form2.layeredProperties.slice()
                        });
                      }
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      isIconOnly: true,
                      color: "danger",
                      size: "sm",
                      variant: "light",
                      onPress: () => {
                        const lps = (form2.layeredProperties ?? []).slice();
                        lps.splice(idx, 1);
                        setForm({
                          ...form2,
                          layeredProperties: lps,
                          resourceLayer: lps.length + 1
                        });
                      },
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-base" })
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "warning", variant: "light", children: "/" })
                ] });
              }) }) : null,
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  color: "primary",
                  size: "sm",
                  variant: "light",
                  onPress: () => {
                    const lps = form2.layeredProperties ?? [];
                    lps.push(void 0);
                    setForm({
                      ...form2,
                      layeredProperties: lps,
                      resourceLayer: lps.length + 1
                    });
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-base" })
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", variant: "light", children: t2("Resource") })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
            /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: t2("Enhancers") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1 flex-wrap", children: dataPool.enhancers.map((e2) => {
              var _a2;
              return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                Button,
                {
                  color: ((_a2 = form2.enhancerIds) == null ? void 0 : _a2.includes(e2.id)) ? "primary" : "default",
                  size: "sm",
                  variant: recommendEnhancerIds.includes(e2.id) ? "solid" : "flat",
                  onPress: () => {
                    const newEnhancerIds = form2.enhancerIds ? [...form2.enhancerIds] : [];
                    if (newEnhancerIds.includes(e2.id)) {
                      _$2.remove(newEnhancerIds, (p2) => p2 === e2.id);
                    } else {
                      newEnhancerIds.push(e2.id);
                    }
                    setForm({
                      ...form2,
                      enhancerIds: newEnhancerIds
                    });
                  },
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(EnhancerIcon, { id: e2.id }),
                    e2.name,
                    recommendEnhancerIds.includes(e2.id) && /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineLike, { className: "text-base" })
                  ]
                }
              );
            }) }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: t2("Name") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                isRequired: true,
                className: "w-[320px]",
                fullWidth: false,
                placeholder: t2("Set a name for this template"),
                value: form2.name,
                onValueChange: (name2) => setForm({
                  ...form2,
                  name: name2
                })
              }
            ) })
          ]
        }
      ) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center gap-2 text-lg grow", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "md" }),
        t2("Initializing")
      ] })
    }
  );
};
PresetTemplateBuilder.displayName = "PresetTemplateBuilder";
function IoDuplicateOutline(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "rect", "attr": { "width": "336", "height": "336", "x": "128", "y": "128", "fill": "none", "strokeLinejoin": "round", "strokeWidth": "32", "rx": "57", "ry": "57" }, "child": [] }, { "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32", "d": "m383.5 128 .5-24a56.16 56.16 0 0 0-56-56H112a64.19 64.19 0 0 0-64 64v216a56.16 56.16 0 0 0 56 56h24m168-168v160m80-80H216" }, "child": [] }] })(props);
}
function IoGitBranchOutline(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "circle", "attr": { "cx": "160", "cy": "96", "r": "48", "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32" }, "child": [] }, { "tag": "circle", "attr": { "cx": "160", "cy": "416", "r": "48", "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32" }, "child": [] }, { "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32", "d": "M160 368V144" }, "child": [] }, { "tag": "circle", "attr": { "cx": "352", "cy": "160", "r": "48", "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32" }, "child": [] }, { "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32", "d": "M352 208c0 128-192 48-192 160" }, "child": [] }] })(props);
}
function IoLayersOutline(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32", "d": "m434.8 137.65-149.36-68.1c-16.19-7.4-42.69-7.4-58.88 0L77.3 137.65c-17.6 8-17.6 21.09 0 29.09l148 67.5c16.89 7.7 44.69 7.7 61.58 0l148-67.5c17.52-8 17.52-21.1-.08-29.09zM160 308.52l-82.7 37.11c-17.6 8-17.6 21.1 0 29.1l148 67.5c16.89 7.69 44.69 7.69 61.58 0l148-67.5c17.6-8 17.6-21.1 0-29.1l-79.94-38.47" }, "child": [] }, { "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32", "d": "m160 204.48-82.8 37.16c-17.6 8-17.6 21.1 0 29.1l148 67.49c16.89 7.7 44.69 7.7 61.58 0l148-67.49c17.7-8 17.7-21.1.1-29.1L352 204.48" }, "child": [] }] })(props);
}
function IoLocate(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "48", "d": "M256 96V56m0 400v-40m0-304a144 144 0 1 0 144 144 144 144 0 0 0-144-144zm160 144h40m-400 0h40" }, "child": [] }] })(props);
}
function IoPlayCircleOutline(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeMiterlimit": "10", "strokeWidth": "32", "d": "M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z" }, "child": [] }, { "tag": "path", "attr": { "d": "m216.32 334.44 114.45-69.14a10.89 10.89 0 0 0 0-18.6l-114.45-69.14a10.78 10.78 0 0 0-16.32 9.31v138.26a10.78 10.78 0 0 0 16.32 9.31z" }, "child": [] }] })(props);
}
function IoRocketOutline(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32", "d": "M461.81 53.81a4.4 4.4 0 0 0-3.3-3.39c-54.38-13.3-180 34.09-248.13 102.17a294.9 294.9 0 0 0-33.09 39.08c-21-1.9-42-.3-59.88 7.5-50.49 22.2-65.18 80.18-69.28 105.07a9 9 0 0 0 9.8 10.4l81.07-8.9a180.29 180.29 0 0 0 1.1 18.3 18.15 18.15 0 0 0 5.3 11.09l31.39 31.39a18.15 18.15 0 0 0 11.1 5.3 179.91 179.91 0 0 0 18.19 1.1l-8.89 81a9 9 0 0 0 10.39 9.79c24.9-4 83-18.69 105.07-69.17 7.8-17.9 9.4-38.79 7.6-59.69a293.91 293.91 0 0 0 39.19-33.09c68.38-68 115.47-190.86 102.37-247.95zM298.66 213.67a42.7 42.7 0 1 1 60.38 0 42.65 42.65 0 0 1-60.38 0z" }, "child": [] }, { "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32", "d": "M109.64 352a45.06 45.06 0 0 0-26.35 12.84C65.67 382.52 64 448 64 448s65.52-1.67 83.15-19.31A44.73 44.73 0 0 0 160 402.32" }, "child": [] }] })(props);
}
function IoSync(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32", "d": "M434.67 285.59v-29.8c0-98.73-80.24-178.79-179.2-178.79a179 179 0 0 0-140.14 67.36m-38.53 82v29.8C76.8 355 157 435 256 435a180.45 180.45 0 0 0 140-66.92" }, "child": [] }, { "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32", "d": "m32 256 44-44 46 44m358 0-44 44-46-44" }, "child": [] }] })(props);
}
function VscDebugAll(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 16 16", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M7.29333 9.00631L6.41333 9.88552C6.27949 9.34717 5.96917 8.86905 5.53181 8.52735C5.09445 8.18564 4.55521 8 4 8C3.44479 8 2.90555 8.18564 2.46819 8.52735C2.03083 8.86905 1.72051 9.34717 1.58667 9.88552L0.706667 9.00631L0 9.71234L1.14667 10.858L1 11.0045V12.0036H0V13.0027H1V13.056C1.051 13.3815 1.14283 13.6993 1.27333 14.0018L0 15.294L0.706667 16L1.80667 14.901C2.06838 15.2346 2.40078 15.5062 2.78001 15.6962C3.15924 15.8862 3.57587 15.99 4 16C4.42413 15.99 4.84076 15.8862 5.21999 15.6962C5.59922 15.5062 5.93162 15.2346 6.19333 14.901L7.29333 16L8 15.294L6.72667 14.0018C6.85879 13.6929 6.95065 13.3683 7 13.036V12.9694H8V12.0036H7V11.0045L6.85333 10.858L8 9.71234L7.29333 9.00631ZM4 9.00631C4.39782 9.00631 4.77936 9.16421 5.06066 9.44526C5.34196 9.72631 5.5 10.1075 5.5 10.505H2.5C2.5 10.1075 2.65804 9.72631 2.93934 9.44526C3.22064 9.16421 3.60218 9.00631 4 9.00631ZM6 13.0027C5.95116 13.5161 5.72476 13.9965 5.35974 14.3612C4.99472 14.7259 4.5139 14.9521 4 15.0009C3.4861 14.9521 3.00528 14.7259 2.64026 14.3612C2.27524 13.9965 2.04884 13.5161 2 13.0027V11.5041H6V13.0027Z" }, "child": [] }, { "tag": "path", "attr": { "fillRule": "evenodd", "clipRule": "evenodd", "d": "M3.77951 2L2.99951 2.41V7H3.99951V3.35L11.5995 8.42L9 10.1507V11.3497L12.7795 8.83V8L3.77951 2ZM9 13.3497V12.1482L14.5995 8.42006L6.99951 3.35006V2.14673L15.7795 8.00006V8.83006L9 13.3497Z" }, "child": [] }] })(props);
}
const Block2 = ({
  leftIcon,
  title,
  description,
  descriptionPlacement = "right",
  rightIcon,
  onRightIconPress,
  children
}) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        leftIcon ?? /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineBlock, { className: "text-lg" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-base", children: title }),
        rightIcon && onRightIconPress ? /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "secondary",
            size: "sm",
            variant: "light",
            onPress: onRightIconPress,
            children: rightIcon
          }
        ) : rightIcon,
        descriptionPlacement == "right" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-60", children: description })
      ] }),
      descriptionPlacement == "bottom" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-60", children: description })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { className: "h-auto", orientation: "vertical" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow pl-4", children })
    ] })
  ] });
};
Block2.displayName = "Block";
var PathFilterFsType = /* @__PURE__ */ ((PathFilterFsType2) => {
  PathFilterFsType2[PathFilterFsType2["File"] = 1] = "File";
  PathFilterFsType2[PathFilterFsType2["Directory"] = 2] = "Directory";
  return PathFilterFsType2;
})(PathFilterFsType || {});
const PathFilterFsTypeBlock = ({ type: type4 }) => {
  const { t: t2 } = useTranslation();
  switch (type4) {
    case PathFilterFsType.File:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(BsFileEarmark, {}),
        t2(PathFilterFsType[type4])
      ] });
    case PathFilterFsType.Directory:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(BsFolder, {}),
        t2(PathFilterFsType[type4])
      ] });
  }
};
PathFilterFsTypeBlock.displayName = "PathFilterFsTypeBlock";
const Demonstrator$4 = ({ filter: filter3 }) => {
  const { t: t2 } = useTranslation();
  const renderPositioner = () => {
    switch (filter3.positioner) {
      case PathPositioner.Layer:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(IoLayersOutline, { className: "text-base" }),
          t2("Layer")
        ] });
      case PathPositioner.Regex:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(BsRegex, { className: "text-base" }),
          t2("Regex")
        ] });
      default:
        return t2("Not supported");
    }
  };
  const renderLayerOrRegex = () => {
    switch (filter3.positioner) {
      case PathPositioner.Layer:
        return filter3.layer == void 0 ? t2("Not set") : filter3.layer == 0 ? t2("Directory of media library") : t2("The {{layer}} layer", { layer: filter3.layer });
      case PathPositioner.Regex:
        return filter3.regex ?? t2("Not set");
      default:
        return t2("Not supported");
    }
  };
  const renderFsTypeBlocks = () => {
    if (filter3.fsType) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(PathFilterFsTypeBlock, { type: filter3.fsType });
    } else {
      return pathFilterFsTypes.map((t22) => /* @__PURE__ */ jsxRuntimeExports.jsx(PathFilterFsTypeBlock, { type: t22.value }));
    }
  };
  const renderExtensions = () => {
    var _a2;
    const texts = (((_a2 = filter3.extensionGroups) == null ? void 0 : _a2.map((x2) => x2.name)) ?? []).concat(
      filter3.extensions ?? []
    );
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: texts.map((t22) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: t22 });
    }) });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
      t2("Through"),
      renderPositioner()
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: renderLayerOrRegex() }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: renderFsTypeBlocks() }),
    filter3.fsType == PathFilterFsType.File && renderExtensions()
  ] });
};
Demonstrator$4.displayName = "Demonstrator";
const ExtensionGroupSelect = ({ value: value2 = [], onSelectionChange }) => {
  const { t: t2 } = useTranslation();
  const [extensionGroups, setExtensionGroups] = reactExports.useState([]);
  reactExports.useEffect(() => {
    BApi$1.extensionGroup.getAllExtensionGroups().then((res) => {
      setExtensionGroups(res.data ?? []);
    });
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Select,
    {
      dataSource: extensionGroups == null ? void 0 : extensionGroups.map((l2) => ({
        label: l2.name,
        value: l2.id.toString()
      })),
      label: t2("Limit file extension groups"),
      placeholder: t2("Select from extension groups"),
      selectedKeys: (value2 ?? []).map((x2) => x2.toString()),
      selectionMode: "multiple",
      onSelectionChange: (keys2) => {
        onSelectionChange == null ? void 0 : onSelectionChange(
          Array.from(keys2).map((k2) => parseInt(k2, 10))
        );
      }
    }
  );
};
ExtensionGroupSelect.displayName = "ExtensionGroupSelect";
const PathFilterModal = ({ filter: propsFilter, onSubmit, onDestroyed }) => {
  var _a2;
  const { t: t2 } = useTranslation();
  const [filter3, setFilter] = reactExports.useState(
    propsFilter ?? { positioner: PathPositioner.Layer }
  );
  const renderFsItem = (type4) => {
    switch (type4) {
      case PathFilterFsType.File:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex items-center gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(BsFileEarmark, {}),
          t2("File")
        ] });
      case PathFilterFsType.Directory:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex items-center gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(BsFolder, {}),
          t2("Folder")
        ] });
    }
  };
  const renderPositioner = () => {
    switch (filter3.positioner) {
      case PathPositioner.Layer:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Select,
          {
            isRequired: true,
            dataSource: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map((l2) => ({
              label: l2,
              value: l2.toString()
            })),
            description: t2("Layer 0 is directory of media library"),
            label: t2("Layer"),
            selectedKeys: filter3.layer == void 0 ? void 0 : [filter3.layer.toString()],
            onSelectionChange: (keys2) => {
              const layer2 = parseInt(Array.from(keys2)[0], 10);
              setFilter({
                ...filter3,
                layer: layer2
              });
            }
          }
        );
      case PathPositioner.Regex:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            isRequired: true,
            label: t2("Regex"),
            placeholder: t2("Regex to match sub path"),
            value: filter3.regex,
            onValueChange: (v2) => {
              setFilter({
                ...filter3,
                regex: v2
              });
            }
          }
        );
      default:
        return t2("Not supported");
    }
  };
  const isValid3 = () => {
    switch (filter3.positioner) {
      case PathPositioner.Layer:
        return filter3.layer != void 0 && filter3.layer >= 0;
      case PathPositioner.Regex:
        return filter3.regex != void 0 && filter3.regex.length > 0;
      default:
        return false;
    }
  };
  console.log(
    filter3,
    pathFilterFsTypes.map((t22) => ({
      label: renderFsItem(t22.value),
      value: t22.value.toString(),
      textValue: t22.label
    }))
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          isDisabled: !isValid3()
        }
      },
      size: "lg",
      onDestroyed,
      onOk: async () => await (onSubmit == null ? void 0 : onSubmit(filter3)),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          radio_group_default,
          {
            isRequired: true,
            label: t2("Positioning"),
            orientation: "horizontal",
            value: (_a2 = filter3.positioner) == null ? void 0 : _a2.toString(),
            onValueChange: (v2) => {
              const nv = parseInt(v2, 10);
              if (filter3.positioner != nv) {
                setFilter({
                  positioner: nv
                });
              }
            },
            children: pathPositioners.map((p2) => /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: p2.value.toString(), children: t2(p2.label) }))
          }
        ),
        filter3.positioner && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          renderPositioner(),
          /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { className: "my-4" }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Select,
            {
              dataSource: pathFilterFsTypes.map((t22) => ({
                label: renderFsItem(t22.value),
                value: t22.value.toString(),
                textValue: t22.label
              })),
              disallowEmptySelection: false,
              endContent: /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  color: "danger",
                  size: "sm",
                  variant: "light",
                  onPress: () => {
                    setFilter({
                      ...filter3,
                      fsType: void 0
                    });
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-base" })
                }
              ),
              label: t2("Limit path type"),
              placeholder: t2("No limited"),
              renderValue: (items) => {
                return items.map(
                  (t22) => renderFsItem(
                    parseInt(t22.data.value, 10)
                  )
                );
              },
              selectedKeys: filter3.fsType ? [filter3.fsType.toString()] : [],
              selectionMode: "single",
              onSelectionChange: (keys2) => {
                const fsType = parseInt(
                  Array.from(keys2)[0],
                  10
                );
                setFilter({
                  ...filter3,
                  fsType
                });
              }
            }
          ),
          (filter3.fsType == void 0 || filter3.fsType == PathFilterFsType.File) && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              ExtensionGroupSelect,
              {
                value: filter3.extensionGroupIds,
                onSelectionChange: (ids2) => {
                  setFilter({
                    ...filter3,
                    extensionGroupIds: ids2
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              ExtensionsInput,
              {
                defaultValue: filter3.extensions,
                label: t2("Limit file extensions"),
                onValueChange: (v2) => {
                  setFilter({
                    ...filter3,
                    extensions: v2
                  });
                }
              }
            )
          ] })
        ] })
      ] })
    }
  );
};
PathFilterModal.displayName = "PathFilterModal";
const PlayableFileSelectorModal = ({
  selection: propSelection,
  onSubmit
}) => {
  const { t: t2 } = useTranslation();
  const [selection, setSelection] = reactExports.useState(propSelection ?? {});
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { defaultVisible: true, size: "xl", onOk: () => onSubmit == null ? void 0 : onSubmit(selection), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      ExtensionGroupSelect,
      {
        value: selection.extensionGroupIds,
        onSelectionChange: (ids2) => {
          setSelection({
            ...selection,
            extensionGroupIds: ids2
          });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      ExtensionsInput,
      {
        defaultValue: selection.extensions,
        label: t2("Limit file extensions"),
        onValueChange: (v2) => {
          setSelection({
            ...selection,
            extensions: v2
          });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "text-sm font-medium", children: t2("Maximum file count") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        number_input_default,
        {
          label: t2("Leave empty for no limit"),
          minValue: 1,
          value: selection.maxFileCount,
          onValueChange: (v2) => {
            setSelection({
              ...selection,
              maxFileCount: v2
            });
          }
        }
      )
    ] })
  ] }) });
};
PlayableFileSelectorModal.displayName = "PlayableFileSelectorModal";
const Demonstrator$3 = ({ locator }) => {
  const { t: t2 } = useTranslation();
  const renderPositioner = () => {
    switch (locator.positioner) {
      case PathPositioner.Layer:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(IoLayersOutline, { className: "text-base" }),
          t2("Layer")
        ] });
      case PathPositioner.Regex:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(BsRegex, { className: "text-base" }),
          t2("Regex")
        ] });
      default:
        return t2("Not supported");
    }
  };
  const renderLayerOrRegex = () => {
    switch (locator.positioner) {
      case PathPositioner.Layer:
        const basePathType = locator.basePathType ?? PathPropertyExtractorBasePathType.MediaLibrary;
        if (locator.layer == void 0) {
          return t2("Not set");
        }
        if (locator.layer === 0) {
          return t2("Self");
        }
        if (locator.layer > 0) {
          return t2("The {{n}}th layer after {{basePathType}}", {
            basePathType: t2(
              PathPropertyExtractorBasePathType[basePathType]
            ),
            n: locator.layer
          });
        } else {
          return t2("The {{n}}th layer before {{basePathType}}", {
            basePathType: t2(
              PathPropertyExtractorBasePathType[basePathType]
            ),
            n: Math.abs(locator.layer)
          });
        }
      case PathPositioner.Regex:
        return locator.regex ?? t2("Not set");
      default:
        return t2("Not supported");
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: renderPositioner() }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: renderLayerOrRegex() })
  ] });
};
Demonstrator$3.displayName = "Demonstrator";
const PathPropertyExtractorModal = ({ locators: propsLocators, onSubmit, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const forceUpdate = useUpdate();
  const [locators, setLocators] = reactExports.useState(
    propsLocators ?? []
  );
  const renderPositioner = (locator) => {
    switch (locator.positioner) {
      case PathPositioner.Layer: {
        let layers = [];
        const basePathType = locator.basePathType ?? PathPropertyExtractorBasePathType.MediaLibrary;
        switch (basePathType) {
          case PathPropertyExtractorBasePathType.MediaLibrary:
            layers = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5];
            break;
          case PathPropertyExtractorBasePathType.Resource:
            layers = [0, -1, -2, -3, -4, -5, -6, -7, -8, -9];
            break;
        }
        return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Select,
          {
            isRequired: true,
            dataSource: layers.map((l2) => ({
              label: l2,
              value: l2.toString()
            })),
            description: t2(
              "Layer 0 is {{basePathType}}, negative means before {{basePathType}}, positive means after {{basePathType}}",
              {
                basePathType: t2(
                  PathPropertyExtractorBasePathType[basePathType]
                )
              }
            ),
            label: t2("Layer"),
            selectedKeys: locator.layer == void 0 ? void 0 : [locator.layer.toString()],
            onSelectionChange: (keys2) => {
              locator.layer = parseInt(Array.from(keys2)[0], 10);
              forceUpdate();
            }
          }
        ) });
      }
      case PathPositioner.Regex:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            isRequired: true,
            label: t2("Regex"),
            placeholder: t2("Regex to match sub path"),
            value: locator.regex,
            onValueChange: (v2) => {
              locator.regex = v2;
              forceUpdate();
            }
          }
        );
      default:
        return t2("Not supported");
    }
  };
  const isValid3 = () => {
    return locators.every((locator) => {
      switch (locator.positioner) {
        case PathPositioner.Layer:
          return locator.layer != void 0;
        case PathPositioner.Regex:
          return locator.regex != void 0 && locator.regex.length > 0;
        default:
          return false;
      }
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          isDisabled: !isValid3()
        }
      },
      size: "lg",
      title: t2("Extract property values from resource path"),
      onDestroyed,
      onOk: () => onSubmit == null ? void 0 : onSubmit(locators),
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2 min-h-0 overflow-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          accordion_default,
          {
            selectedKeys: locators.map((l2, i2) => i2.toString()),
            variant: "splitted",
            children: locators.map((locator, i2) => {
              var _a2;
              const basePathType = locator.basePathType ?? PathPropertyExtractorBasePathType.MediaLibrary;
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                accordion_item_base_default,
                {
                  title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                    t2("Rule"),
                    " ",
                    i2 + 1,
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Button,
                      {
                        isIconOnly: true,
                        color: "danger",
                        size: "sm",
                        variant: "light",
                        onPress: () => {
                          locators.splice(i2, 1);
                          forceUpdate();
                        },
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-base" })
                      }
                    )
                  ] }),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      radio_group_default,
                      {
                        isRequired: true,
                        label: t2("Positioning"),
                        orientation: "horizontal",
                        value: (_a2 = locator.positioner) == null ? void 0 : _a2.toString(),
                        onValueChange: (v2) => {
                          const nv = parseInt(v2, 10);
                          if (locator.positioner != nv) {
                            locators[i2] = { positioner: nv };
                            forceUpdate();
                          }
                        },
                        children: pathPositioners.map((p2) => /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: p2.value.toString(), children: t2(p2.label) }))
                      }
                    ),
                    locator.positioner === PathPositioner.Layer && /* @__PURE__ */ jsxRuntimeExports.jsx(
                      radio_group_default,
                      {
                        isRequired: true,
                        label: t2("Based on"),
                        orientation: "horizontal",
                        value: basePathType == null ? void 0 : basePathType.toString(),
                        onValueChange: (v2) => {
                          const nv = parseInt(v2, 10);
                          if (basePathType != nv) {
                            locators[i2].basePathType = nv;
                            locators[i2].layer = void 0;
                            forceUpdate();
                          }
                        },
                        children: [
                          {
                            label: t2("Based on media library"),
                            value: PathPropertyExtractorBasePathType.MediaLibrary
                          },
                          {
                            label: t2("Based on resource"),
                            value: PathPropertyExtractorBasePathType.Resource
                          }
                        ].map((p2) => /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: p2.value.toString(), children: p2.label }))
                      }
                    ),
                    locator.positioner && renderPositioner(locator)
                  ] })
                },
                i2
              );
            })
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Button,
            {
              color: "primary",
              size: "sm",
              onPress: () => {
                setLocators([...locators, { positioner: PathPositioner.Layer }]);
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-base" }),
                t2("Add a rule")
              ]
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
            "For layer-based rules, level 0 represents the current directory; for regex rules, the text to be matched starts from the next level under the current directory up to the resource path portion."
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
            "All rules will be run independently, and the results will be merged"
          ) })
        ] })
      ]
    }
  );
};
PathPropertyExtractorModal.displayName = "Modal";
const BriefEnhancer = ({ enhancer }) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(EnhancerIcon, { id: enhancer.id }),
    enhancer.name,
    enhancer.id == EnhancerId.Kodi && /* @__PURE__ */ jsxRuntimeExports.jsx(BetaChip, {}),
    enhancer.id == EnhancerId.Tmdb && /* @__PURE__ */ jsxRuntimeExports.jsx(BetaChip, {}),
    enhancer.id == EnhancerId.Av && /* @__PURE__ */ jsxRuntimeExports.jsx(BetaChip, {})
  ] });
};
BriefEnhancer.displayName = "BriefEnhancer";
const EnhancerSelectorModal = ({
  selectedIds: propSelectedIds,
  onSubmit
}) => {
  const { t: t2 } = useTranslation();
  const [enhancers, setEnhancers] = reactExports.useState([]);
  const [selectedIds, setSelectedIds] = reactExports.useState(
    propSelectedIds ?? []
  );
  const MAX_VISIBLE_TARGETS = 5;
  reactExports.useEffect(() => {
    BApi$1.enhancer.getAllEnhancerDescriptors().then((r2) => {
      setEnhancers(r2.data || []);
    });
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      classNames: { base: "max-w-[80vw]" },
      size: "2xl",
      onOk: () => onSubmit == null ? void 0 : onSubmit(selectedIds),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-4 gap-2", children: enhancers.map((e2) => {
        const isSelected = selectedIds.includes(e2.id);
        const visibleTargets = e2.targets.slice(0, MAX_VISIBLE_TARGETS);
        const hiddenTargets = e2.targets.slice(MAX_VISIBLE_TARGETS);
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(
          card_default,
          {
            isPressable: true,
            onPress: () => {
              if (isSelected) {
                setSelectedIds(selectedIds.filter((id2) => id2 !== e2.id));
              } else {
                setSelectedIds([...selectedIds, e2.id]);
              }
            },
            className: `relative ${isSelected ? "border-2 border-success bg-success/10" : ""}`,
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs(card_body_default, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-base flex items-center gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(BriefEnhancer, { enhancer: e2 }),
                  isSelected && /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Chip,
                    {
                      color: "success",
                      radius: "sm",
                      size: "sm",
                      variant: "light",
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheckCircle, { className: "text-lg" })
                    }
                  )
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-60", children: e2.description }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "font-bold", children: [
                    t2("Enhance properties"),
                    ": "
                  ] }),
                  visibleTargets.map((target) => {
                    if (target.description) {
                      return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: target.description, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                        Chip,
                        {
                          color: "default",
                          radius: "sm",
                          size: "sm",
                          variant: "flat",
                          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
                            target.name,
                            /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineQuestionCircle, { className: "text-base" })
                          ] })
                        }
                      ) }, `${e2.id}-${target.name}`);
                    }
                    return /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Chip,
                      {
                        color: "default",
                        radius: "sm",
                        size: "sm",
                        variant: "flat",
                        children: target.name
                      },
                      `${e2.id}-${target.name}`
                    );
                  }),
                  hiddenTargets.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Tooltip$1,
                    {
                      content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-w-[360px] flex flex-wrap gap-1", children: hiddenTargets.map((target) => /* @__PURE__ */ jsxRuntimeExports.jsx(
                        Chip,
                        {
                          color: "default",
                          radius: "sm",
                          size: "sm",
                          variant: "flat",
                          children: target.name
                        },
                        `${e2.id}-hidden-${target.name}`
                      )) }),
                      children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { color: "primary", radius: "sm", size: "sm", variant: "flat", children: [
                        "+",
                        hiddenTargets.length,
                        " ",
                        t2("more")
                      ] })
                    }
                  )
                ] })
              ] }),
              isSelected && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute top-2 right-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", radius: "sm", size: "sm", variant: "solid", children: t2("Selected") }) })
            ]
          },
          e2.id
        );
      }) })
    }
  );
};
EnhancerSelectorModal.displayName = "EnhancerSelectorModal";
function createEnhancerTargetOptions(descriptor) {
  const eto = {
    target: descriptor.id
  };
  if (descriptor.optionsItems != void 0)
    ;
  return eto;
}
const CoverSelectOrder = ({
  coverSelectOrder,
  onChange,
  isDisabled
}) => {
  const { t: t2 } = useTranslation();
  console.log(coverSelectOrder);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    radio_group_default,
    {
      isDisabled,
      orientation: "horizontal",
      size: "sm",
      value: coverSelectOrder == null ? void 0 : coverSelectOrder.toString(),
      onValueChange: (c2) => {
        onChange == null ? void 0 : onChange(parseInt(c2, 10));
      },
      children: Object.keys(CoverSelectOrder$2).filter((x2) => !Number.isNaN(parseInt(x2, 10))).map((x2) => {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: x2, children: t2(`CoverSelectOrder.${CoverSelectOrder$2[parseInt(x2, 10)]}`) });
      })
    }
  );
};
CoverSelectOrder.displayName = "CoverSelectOrder";
const TargetOptions = ({
  options: propsOptions,
  optionsItems,
  onChange,
  isDisabled
}) => {
  const { t: t2 } = useTranslation();
  const [options, setOptions2] = reactExports.useState(propsOptions ?? {});
  reactExports.useEffect(() => {
    setOptions2(propsOptions ?? {});
  }, [propsOptions]);
  const patchOptions = (patches, triggerChange = true) => {
    const no = {
      ...options,
      ...patches
    };
    setOptions2(no);
    if (triggerChange) {
      onChange == null ? void 0 : onChange(no);
    }
  };
  const finalOptions = propsOptions ?? options;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: optionsItems == null ? void 0 : optionsItems.map((item, index2) => {
    switch (item) {
      case EnhancerTargetOptionsItem.CoverSelectOrder:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          CoverSelectOrder,
          {
            coverSelectOrder: finalOptions.coverSelectOrder,
            isDisabled,
            onChange: (o2) => patchOptions({ coverSelectOrder: o2 })
          },
          item
        );
      default:
        return null;
    }
  }) });
};
TargetOptions.displayName = "TargetOptions";
const PropertyMatcher = ({
  matchedProperty,
  type: type4,
  name: name2,
  options,
  isClearable,
  onValueChanged: propsOnValueChanged
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [property2, setProperty3] = reactExports.useState();
  const [isFindingBestMatch, setIsFindingBestMatch] = reactExports.useState(false);
  reactExports.useEffect(() => {
    setProperty3(matchedProperty);
  }, [matchedProperty]);
  const onValueChange = reactExports.useCallback(
    (property22) => {
      setProperty3(property22);
      console.log(property22);
      propsOnValueChanged == null ? void 0 : propsOnValueChanged(property22);
    },
    [propsOnValueChanged]
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex items-center gap-1", children: [
    property2 && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          size: "sm",
          variant: "light",
          onPress: () => {
            createPortal(PropertySelector, {
              pool: PropertyPool.Custom | PropertyPool.Reserved,
              multiple: false,
              onSubmit: async (selection) => {
                onValueChange(selection[0]);
              },
              v2: true
            });
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { property: property2 })
        }
      ),
      isClearable && /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "warning",
          size: "sm",
          variant: "light",
          onPress: () => {
            onValueChange();
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDisconnect, { className: "text-base" })
        }
      )
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Automatically match property"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        isIconOnly: true,
        color: "primary",
        isLoading: isFindingBestMatch,
        size: "sm",
        variant: "light",
        onPress: async () => {
          if (name2 == void 0 || name2.length == 0) {
            createPortal(
              Modal,
              {
                defaultVisible: true,
                title: t2("No proper property name provided"),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2", children: t2("Please provide a property name") }),
                footer: {
                  actions: ["cancel"]
                }
              }
            );
            return;
          }
          setIsFindingBestMatch(true);
          try {
            const candidate = await BApi$1.property.findBestMatchingProperty({
              type: type4,
              name: name2
            });
            if (candidate.data) {
              onValueChange(candidate.data);
            } else {
              const modal2 = createPortal(Modal, {
                defaultVisible: true,
                title: t2("No proper property found"),
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
                  t2("You can"),
                  ":",
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsxs(
                      card_default,
                      {
                        isPressable: true,
                        className: "flex flex-col items-center gap-2 justify-center py-2",
                        onPress: async () => {
                          const r2 = await BApi$1.customProperty.addCustomProperty({
                            name: name2,
                            type: type4,
                            options: options ? JSON.stringify(options) : void 0
                          });
                          if (r2.code) {
                            throw new Error(r2.message);
                          }
                          const np = r2.data;
                          onValueChange(np);
                          modal2.destroy();
                        },
                        children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx(MdAutoFixHigh, { className: "text-2xl" }),
                          t2("Automatically create a new property")
                        ]
                      }
                    ),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs(
                      card_default,
                      {
                        isPressable: true,
                        className: "flex flex-col items-center gap-2 justify-center py-2",
                        onPress: () => {
                          modal2.destroy();
                          createPortal(PropertySelector, {
                            pool: PropertyPool.Custom | PropertyPool.Reserved,
                            multiple: false,
                            onSubmit: async (selection) => {
                              onValueChange(selection[0]);
                            },
                            v2: true
                          });
                        },
                        children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSearch, { className: "text-2xl" }),
                          t2("Select manually")
                        ]
                      }
                    )
                  ] })
                ] }),
                footer: false
              });
            }
          } finally {
            setIsFindingBestMatch(false);
          }
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(IoLocate, { className: "text-base" })
      }
    ) })
  ] });
};
PropertyMatcher.displayName = "PropertyMatcher";
const StdValueSpecialTextIntegrationMap = {
  [StandardValueType.DateTime]: SpecialTextType.DateTime
};
const log$g = buildLogger("TargetRow");
const TargetRow = (props) => {
  var _a2;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const {
    dynamicTarget,
    options: propsOptions,
    onDeleted,
    otherDynamicTargetsInGroup,
    propertyMap,
    descriptor,
    onPropertyChanged,
    onChange,
    dynamicTargetCandidates
  } = props;
  const [options, setOptions2] = reactExports.useState(
    propsOptions ?? createEnhancerTargetOptions(descriptor)
  );
  const [dynamicTargetError, setDynamicTargetError] = reactExports.useState();
  const dynamicTargetInputValueRef = reactExports.useRef();
  const [editingDynamicTarget, setEditingDynamicTarget] = reactExports.useState(false);
  const validateDynamicTarget = (newTarget) => {
    let error2;
    if (otherDynamicTargetsInGroup == null ? void 0 : otherDynamicTargetsInGroup.includes(newTarget)) {
      error2 = t2("Duplicate dynamic target is found");
    }
    if (newTarget.length == 0) {
      error2 = t2("This field is required");
    }
    if (dynamicTargetError != error2) {
      setDynamicTargetError(error2);
    }
    return error2 == void 0;
  };
  useUpdateEffect(() => {
    setOptions2(propsOptions ?? createEnhancerTargetOptions(descriptor));
  }, [propsOptions]);
  const patchTargetOptions = async (patches) => {
    const newOptions = {
      ...options,
      ...patches
    };
    setOptions2(newOptions);
    log$g("Patch target options", newOptions);
    if (!newOptions.autoBindProperty && (newOptions.propertyPool == void 0 || newOptions.propertyId == void 0)) {
      return;
    }
    onChange == null ? void 0 : onChange(newOptions);
  };
  const dt = options.dynamicTarget ?? dynamicTarget;
  const targetLabel = descriptor.isDynamic ? dt ?? t2("Default") : descriptor.name;
  const isDefaultTargetOfDynamic = descriptor.isDynamic && dt == void 0;
  const integratedSpecialTextType = StdValueSpecialTextIntegrationMap[descriptor.valueType];
  let property2;
  if (options.propertyPool != void 0 && options.propertyId != void 0) {
    property2 = (_a2 = propertyMap == null ? void 0 : propertyMap[options.propertyPool]) == null ? void 0 : _a2[options.propertyId];
  }
  const noPropertyBound = !options.autoBindProperty && (!options.propertyId || !options.propertyPool);
  log$g(props, options, propsOptions, property2);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-[80px] flex justify-center", children: isDefaultTargetOfDynamic ? "-" : noPropertyBound ? /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "warning", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineClose, { className: "text-lg text-warning" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheckCircle, { className: "text-lg" }) }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-4/12", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: descriptor.isDynamic && !isDefaultTargetOfDynamic ? editingDynamicTarget ? /* @__PURE__ */ jsxRuntimeExports.jsx(
      autocomplete_default,
      {
        allowsCustomValue: true,
        isRequired: true,
        defaultInputValue: dynamicTargetInputValueRef.current,
        errorMessage: dynamicTargetError,
        isInvalid: dynamicTargetError != void 0,
        items: (dynamicTargetCandidates == null ? void 0 : dynamicTargetCandidates.map((k2) => ({ label: k2, value: k2 }))) ?? [],
        size: "sm",
        onBlur: () => {
          if (dynamicTargetInputValueRef.current != void 0 && dynamicTargetInputValueRef.current.length > 0) {
            patchTargetOptions({
              dynamicTarget: dynamicTargetInputValueRef.current
            });
          }
          dynamicTargetInputValueRef.current = void 0;
          setEditingDynamicTarget(false);
        },
        onInputChange: (v2) => {
          if (validateDynamicTarget(v2)) {
            dynamicTargetInputValueRef.current = v2;
          }
        },
        children: (c2) => /* @__PURE__ */ jsxRuntimeExports.jsx(listbox_item_base_default, { children: c2.label }, c2.value)
      }
    ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Button,
      {
        variant: "light",
        onClick: () => {
          dynamicTargetInputValueRef.current = dt;
          setEditingDynamicTarget(true);
        },
        children: [
          targetLabel ?? t2("Click to specify target"),
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$T, { className: "text-base" })
        ]
      }
    ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        BriefProperty,
        {
          fields: ["name", "type"],
          property: {
            type: descriptor.propertyType,
            name: descriptor.name
          }
        }
      ),
      integratedSpecialTextType && /* @__PURE__ */ jsxRuntimeExports.jsx(IntegrateWithSpecialTextLabel, { type: integratedSpecialTextType }),
      descriptor.description && /* @__PURE__ */ jsxRuntimeExports.jsx(
        Tooltip$1,
        {
          className: "max-w-[400px]",
          color: "secondary",
          content: descriptor.description,
          placement: "right",
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" })
        }
      )
    ] }) }) }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-1/4", children: isDefaultTargetOfDynamic ? /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { variant: "light", children: "/" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      PropertyMatcher,
      {
        isClearable: true,
        matchedProperty: property2,
        name: descriptor.isDynamic ? options.dynamicTarget : descriptor.name,
        type: descriptor.propertyType,
        onValueChanged: (property22) => {
          if (!property22) {
            onDeleted == null ? void 0 : onDeleted();
            return;
          }
          patchTargetOptions({
            propertyId: property22.id,
            propertyPool: property22.pool
          });
          onPropertyChanged == null ? void 0 : onPropertyChanged();
        }
      }
    ) }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-1/4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      TargetOptions,
      {
        isDisabled: !options.autoBindProperty && (!options.propertyId || !options.propertyPool),
        options,
        optionsItems: descriptor.optionsItems,
        onChange: patchTargetOptions
      }
    ) }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-1/12", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: descriptor.isDynamic && !isDefaultTargetOfDynamic && /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        isIconOnly: true,
        color: "danger",
        size: "sm",
        variant: "light",
        onPress: () => {
          onDeleted == null ? void 0 : onDeleted();
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" })
      }
    ) }) })
  ] });
};
TargetRow.displayName = "TargetRow";
const OtherOptionsTip = () => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(PopoverComponent, { trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" }), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-bold text-base", children: t2("Auto bind property") }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "If this option is checked, a property with the same name and type of the target will be bound automatically."
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "If there isn't such a property, a new property will be created and bound to this target."
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "If this option is checked in default options of a dynamic target, all unlisted dynamic targets will be bound to properties of the same type with the same name."
        ) })
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-bold text-base", children: t2("Auto match on empty values") }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "By default, an empty layer will be created if we meet an empty value in multilevel data."
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "If checked, this kind of data will be matched with the most similar multilevel value in the database."
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "For example, assume we already have a multilevel data: a->b->c, then for the incoming data: ->->c, the values of 1st and 2nd layers of which are empty."
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "If this option is checked, we'll save ->->c as a->b->c, otherwise the incoming value ->->c will be saved."
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "This option may cause unexpected behaviors, make sure you have enough confidence to merge the produced data into data in db before check it."
        ) })
      ] })
    ] })
  ] }) });
};
OtherOptionsTip.displayName = "OtherOptionsTip";
const PropertiesMatcher = ({
  properties: properties2,
  onValueChanged: propsOnValueChanged
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [isFindingBestMatch, setIsFindingBestMatch] = reactExports.useState(false);
  const onValueChange = reactExports.useCallback(
    (properties22) => {
      console.log(properties22);
      propsOnValueChanged == null ? void 0 : propsOnValueChanged(properties22);
    },
    [propsOnValueChanged]
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Automatically match property"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    Button,
    {
      isIconOnly: true,
      color: "primary",
      size: "sm",
      variant: "light",
      isLoading: isFindingBestMatch,
      onPress: async () => {
        setIsFindingBestMatch(true);
        try {
          const results = await Promise.all(
            properties2.map(
              (property2) => BApi$1.property.findBestMatchingProperty({
                type: property2.type,
                name: property2.name
              })
            )
          );
          const ret = results.map(
            (r2) => r2.data
          );
          const missingIndexes = ret.map((p2, idx) => p2 ? -1 : idx).filter((idx) => idx !== -1);
          if (missingIndexes.length === 0) {
            onValueChange(ret);
            return;
          }
          const modal2 = createPortal(Modal, {
            defaultVisible: true,
            title: t2("Some properties cannot be matched"),
            size: "lg",
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: t2("Auto matched") }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap items-center gap-1 text-sm", children: ret.map((p2, idx) => p2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { property: p2 }, `matched-${idx}`) : null) })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: t2("Missing") }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap items-center gap-1 text-sm text-warning-500", children: missingIndexes.map((idx) => /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { property: properties2[idx] }, `missing-${idx}`)) })
              ] }),
              t2("You can"),
              ":",
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs(
                  card_default,
                  {
                    isPressable: true,
                    className: "relative flex flex-col items-center gap-2 justify-center py-3 border-2 border-primary-500 bg-primary-50 hover:bg-primary-100 shadow-sm",
                    onPress: async () => {
                      const models = missingIndexes.map((idx) => {
                        const p2 = properties2[idx];
                        return {
                          name: p2.name,
                          type: p2.type,
                          options: p2.options ? JSON.stringify(p2.options) : void 0
                        };
                      });
                      const r2 = await BApi$1.customProperty.addCustomPropertyBatch(models);
                      if (r2.code) {
                        throw new Error(r2.message);
                      }
                      const created = r2.data || [];
                      created.forEach((cp, i2) => {
                        const idx = missingIndexes[i2];
                        ret[idx] = cp;
                      });
                      onValueChange(ret);
                      modal2.destroy();
                    },
                    children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-1 right-1 rounded-full bg-primary-500 text-white text-[10px] px-2 py-0.5", children: t2("Recommended") }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(MdAutoFixHigh, { className: "text-2xl text-primary-600" }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm font-medium text-primary-700 text-center px-2", children: t2("Automatically create missing properties") })
                    ]
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsxs(
                  card_default,
                  {
                    isPressable: missingIndexes.length > 0,
                    className: `relative flex flex-col items-center gap-2 justify-center py-2 border border-default-200 bg-content1 text-default-600 hover:bg-content2 ${missingIndexes.length === 0 ? "opacity-50 pointer-events-none" : ""}`,
                    onPress: () => {
                      onValueChange(ret);
                      modal2.destroy();
                    },
                    children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSearch, { className: "text-2xl text-default-500" }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-700 text-center px-2", children: t2("Keep matched properties, handle missing ones manually") })
                    ]
                  }
                )
              ] })
            ] }),
            footer: {
              actions: ["cancel"]
            }
          });
        } finally {
          setIsFindingBestMatch(false);
        }
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(IoLocate, { className: "text-base" })
    }
  ) });
};
PropertiesMatcher.displayName = "PropertiesMatcher";
const log$f = buildLogger("DynamicTargets");
const buildGroups = (descriptors2, optionsList, candidateTargetsMap) => {
  return descriptors2.map((descriptor) => {
    const subOptions = (optionsList == null ? void 0 : optionsList.filter((x2) => x2.target == descriptor.id)) || [];
    let defaultOptions2 = subOptions.find((x2) => x2.dynamicTarget == void 0);
    if (defaultOptions2 == void 0) {
      defaultOptions2 = createEnhancerTargetOptions(descriptor);
    } else {
      const defaultIdx = subOptions.findIndex((x2) => x2 == defaultOptions2);
      subOptions.splice(defaultIdx, 1);
    }
    subOptions.splice(0, 0, defaultOptions2);
    return {
      descriptor,
      subOptions,
      candidateTargets: candidateTargetsMap == null ? void 0 : candidateTargetsMap[descriptor.id]
    };
  });
};
const DynamicTargets = (props) => {
  const { t: t2 } = useTranslation();
  useUpdate();
  const { propertyMap, optionsList, enhancer, onPropertyChanged, onChange, candidateTargetsMap } = props;
  const dynamicTargetDescriptors = enhancer.targets.filter((x2) => x2.isDynamic);
  const [groups2, setGroups] = reactExports.useState([]);
  reactExports.useEffect(() => {
    setGroups(buildGroups(dynamicTargetDescriptors, optionsList, candidateTargetsMap));
  }, [candidateTargetsMap]);
  const updateGroups = (groups22) => {
    setGroups([...groups22]);
    const ol2 = _$2.flatMap(groups22, (g2) => g2.subOptions);
    onChange == null ? void 0 : onChange(ol2);
  };
  log$f("rendering", optionsList, groups2);
  return groups2.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-y-2", children: groups2.map((g2) => {
    const { descriptor, subOptions, candidateTargets } = g2;
    const notEmptyTargets = subOptions.filter((x2) => x2.dynamicTarget != void 0);
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { removeWrapper: true, "aria-label": "Dynamic target", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { align: "center", width: 80, children: t2("Configured") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(table_column_default, { width: "33.3333%", children: [
            descriptor.name,
            " ",
            /* @__PURE__ */ jsxRuntimeExports.jsx(PopoverComponent, { trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$19, { className: "text-base" }), children: t2(
              "This is not a fixed enhancement target, which will be replaced with other content when data is collected"
            ) })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: "25%", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            t2("Bind property"),
            notEmptyTargets.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
              PropertiesMatcher,
              {
                properties: notEmptyTargets.map((td2) => ({
                  type: descriptor.propertyType,
                  name: td2.dynamicTarget
                })),
                onValueChanged: (ps) => {
                  var _a2;
                  for (let i2 = 0; i2 < ps.length; i2++) {
                    const p2 = ps[i2];
                    if (p2) {
                      subOptions[i2] = {
                        ...subOptions[i2],
                        propertyId: p2.id,
                        propertyPool: p2.pool,
                        target: descriptor.id
                      };
                      if (propertyMap) {
                        const pMap = propertyMap[_a2 = p2.pool] ?? (propertyMap[_a2] = {});
                        if (!(p2.id in pMap)) {
                          pMap[p2.id] = p2;
                        }
                      }
                    }
                  }
                  updateGroups(groups2);
                }
              }
            )
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: "25%", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            t2("Other options"),
            /* @__PURE__ */ jsxRuntimeExports.jsx(OtherOptionsTip, {})
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Operations") })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, {})
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-y-2", children: subOptions.map((data, i2) => {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            TargetRow,
            {
              descriptor,
              dynamicTarget: data.dynamicTarget,
              dynamicTargetCandidates: candidateTargets,
              options: data,
              propertyMap,
              onChange: (newOptions) => {
                subOptions[i2] = newOptions;
                updateGroups(groups2);
              },
              onDeleted: () => {
                subOptions == null ? void 0 : subOptions.splice(i2, 1);
                updateGroups(groups2);
              },
              onPropertyChanged
            },
            i2
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "horizontal" })
        ] });
      }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          color: "success",
          size: "sm",
          variant: "light",
          onPress: () => {
            const currentTargets = subOptions.filter((x2) => x2.dynamicTarget != void 0).map((x2) => x2.dynamicTarget);
            const nextTarget = generateNextWithPrefix(t2("Target"), currentTargets);
            const newOptions = createEnhancerTargetOptions(descriptor);
            newOptions.dynamicTarget = nextTarget;
            subOptions.push(newOptions);
            setGroups([...groups2]);
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$m, { className: "text-sm" }),
            t2("Specify dynamic target")
          ]
        }
      )
    ] });
  }) }) : null;
};
DynamicTargets.displayName = "DynamicTargets";
const FixedTargets = (props) => {
  const { t: t2 } = useTranslation();
  const {
    optionsList: propsOptionsList,
    propertyMap,
    enhancer,
    onPropertyChanged,
    onChange
  } = props;
  const [optionsList, setOptionsList] = reactExports.useState(
    propsOptionsList || []
  );
  const fixedTargets = enhancer.targets.filter((t22) => !t22.isDynamic);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { removeWrapper: true, "aria-label": "Fixed targets", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { align: "center", width: 80, children: t2("Configured") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: "33.3333%", children: t2("Enhancement target") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: "25%", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          t2("Bind property"),
          enhancer.targets && enhancer.targets.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
            PropertiesMatcher,
            {
              properties: enhancer.targets.map((td2) => ({
                type: td2.propertyType,
                name: td2.name
              })),
              onValueChanged: (ps) => {
                var _a2;
                for (let i2 = 0; i2 < ps.length; i2++) {
                  const p2 = ps[i2];
                  if (p2) {
                    const td2 = enhancer.targets[i2];
                    let to2 = optionsList.find((x2) => x2.target == td2.id);
                    if (!to2) {
                      to2 = { target: enhancer.targets[i2].id };
                      optionsList.push(to2);
                    }
                    to2.propertyId = p2.id;
                    to2.propertyPool = p2.pool;
                    if (propertyMap) {
                      const pMap = propertyMap[_a2 = p2.pool] ?? (propertyMap[_a2] = {});
                      if (!(p2.id in pMap)) {
                        pMap[p2.id] = p2;
                      }
                    }
                  }
                }
                setOptionsList(optionsList);
                onChange == null ? void 0 : onChange(optionsList);
              }
            }
          )
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: "25%", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          t2("Other options"),
          /* @__PURE__ */ jsxRuntimeExports.jsx(OtherOptionsTip, {})
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Operations") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, {})
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-y-2", children: fixedTargets.map((target, i2) => {
      const toIdx = optionsList.findIndex((x2) => x2.target == target.id);
      const to2 = optionsList[toIdx];
      const targetDescriptor = enhancer.targets.find(
        (x2) => x2.id == target.id
      );
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          TargetRow,
          {
            descriptor: targetDescriptor,
            options: to2,
            propertyMap,
            onChange: (o2) => {
              const newOptionsList = [...optionsList];
              if (toIdx == -1) {
                newOptionsList.push(o2);
              } else {
                newOptionsList[toIdx] = o2;
              }
              setOptionsList(newOptionsList);
              onChange == null ? void 0 : onChange(newOptionsList);
            },
            onDeleted: () => {
              const newOptionsList = [...optionsList];
              if (toIdx != -1) {
                newOptionsList.splice(toIdx, 1);
              }
              setOptionsList(newOptionsList);
              onChange == null ? void 0 : onChange(newOptionsList);
            },
            onPropertyChanged
          },
          `${target.id}-${to2 == null ? void 0 : to2.dynamicTarget}`
        ),
        fixedTargets.length - 1 !== i2 && /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "horizontal" })
      ] });
    }) })
  ] });
};
FixedTargets.displayName = "FixedTargets";
const extractCaptureGroups = (expressions) => expressions.reduce((s2, t2) => {
  s2.push(...findCapturingGroupsInRegex(t2));
  return s2;
}, []);
function EnhancerOptionsModal({
  enhancer,
  options: propsOptions,
  onSubmit,
  onDestroyed
}) {
  var _a2, _b2, _c2, _d;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  useUpdate();
  const navigate = useNavigate();
  const [options, setOptions2] = reactExports.useState(propsOptions ?? {});
  const [propertyMap, setPropertyMap] = reactExports.useState({});
  const [allEnhancers, setAllEnhancers] = reactExports.useState([]);
  const init2 = async () => {
    await Promise.all([loadAllProperties(), loadEnhancers()]);
  };
  reactExports.useEffect(() => {
    init2();
  }, []);
  const loadAllProperties = async () => {
    const psr = (await BApi$1.property.getPropertiesByPool(PropertyPool.All)).data || [];
    const ps = _$2.mapValues(
      _$2.groupBy(psr, (x2) => x2.pool),
      (v2) => _$2.keyBy(v2, (x2) => x2.id)
    );
    setPropertyMap(ps);
  };
  const loadEnhancers = async () => {
    const r2 = await BApi$1.enhancer.getAllEnhancerDescriptors();
    setAllEnhancers(r2.data || []);
  };
  const renderKeywordProperty = () => {
    var _a3, _b3;
    if (!enhancer.tags.includes(EnhancerTag.UseKeyword)) {
      return null;
    }
    if (!options.keywordProperty) {
      options.keywordProperty = {
        pool: PropertyPool.Internal,
        id: InternalProperty.Filename,
        scope: PropertyValueScope.Synchronization
      };
    }
    const currentProperty = (_a3 = propertyMap == null ? void 0 : propertyMap[options.keywordProperty.pool]) == null ? void 0 : _a3[options.keywordProperty.id];
    const keywordPropertyScope = (_b3 = options.keywordProperty) == null ? void 0 : _b3.scope;
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: " w-[300px]", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-small", children: t2("Property value used during enhancement") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-default-400", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
              "Generally, this enhancer will use file/folder name of resource to perform enhancement and its not necessary to change this."
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
              "In some cases, you can change the property value used during enhancement to perform enhancement on other property values."
            ) })
          ] })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            size: "sm",
            variant: "light",
            onPress: async () => {
              createPortal(PropertySelector, {
                pool: PropertyPool.All,
                multiple: false,
                isDisabled: (p2) => p2.pool == PropertyPool.Internal && p2.id != InternalProperty.Filename,
                onSubmit: async (selection) => {
                  const p2 = selection[0];
                  if (p2) {
                    setOptions2({
                      ...options,
                      keywordProperty: { pool: p2.pool, id: p2.id, scope: PropertyValueScope.Manual }
                    });
                  }
                  return Promise.resolve();
                },
                v2: true
              });
            },
            children: currentProperty ? /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { property: currentProperty }) : t2("Select property")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Select,
          {
            className: "w-auto",
            dataSource: propertyValueScopes.map((e2) => ({
              label: `${t2(`PropertyValueScope.${e2.label}`)}`,
              value: e2.value.toString()
            })),
            description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "Property value scope usually means who the property value is generated by."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("For internal options, property value scope will be ignored.") })
            ] }),
            label: t2("Property value scope"),
            selectedKeys: keywordPropertyScope == void 0 ? [] : [keywordPropertyScope.toString()],
            size: "sm",
            onSelectionChange: (keys2) => {
              const arr = Array.from(keys2);
              const vals = arr.map((o2) => parseInt(o2, 10));
              const selected = vals[0];
              if (selected === PropertyValueScope.Manual) {
                createPortal(Modal, {
                  defaultVisible: true,
                  title: t2("Manual property value scope has been selected"),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                    "Manual property value scope means the property values are generated by yourself, and these values are typically not yet available at the time of enhancement."
                  ) }),
                  footer: {
                    actions: ["cancel"],
                    cancelProps: {
                      children: t2("I've understood")
                    }
                  }
                });
              }
              setOptions2({
                ...options,
                keywordProperty: { ...options.keywordProperty, scope: vals[0] }
              });
            }
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: " w-[300px]", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-small", children: t2("Pretreat property value") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-default-400", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("If checked, the property value will be pretreated before enhancement.") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
              t2(
                "You can configure the special texts to be pretreated in special text page under data menu."
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: "primary",
                  size: "sm",
                  variant: "light",
                  onPress: () => {
                    createPortal(Modal, {
                      defaultVisible: true,
                      title: t2("About to leave current page"),
                      children: t2("Sure?"),
                      onOk: async () => {
                        navigate("/text");
                      }
                    });
                  },
                  children: t2("Click to check special texts")
                }
              )
            ] })
          ] })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          switch_default,
          {
            isSelected: options.pretreatKeyword ?? false,
            size: "sm",
            onValueChange: (v2) => {
              setOptions2({ ...options, pretreatKeyword: v2 });
            }
          }
        )
      ] })
    ] });
  };
  const expressions = (options == null ? void 0 : options.expressions) || [];
  const captureGroups = extractCaptureGroups(expressions);
  const prerequisiteEnhancers = (_a2 = options.requirements) == null ? void 0 : _a2.map((r2) => r2.toString());
  let candidateTargetsMap = {};
  if (enhancer.id == EnhancerId.Regex) {
    candidateTargetsMap[RegexEnhancerTarget.CaptureGroups] = captureGroups;
  }
  const hasDynamicTargets = (_b2 = enhancer.targets) == null ? void 0 : _b2.some((t22) => t22.isDynamic);
  const hasFixedTargets = (_c2 = enhancer.targets) == null ? void 0 : _c2.some((t22) => !t22.isDynamic);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel", "ok"]
      },
      size: "xl",
      title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
        t2("Configure enhancer"),
        /* @__PURE__ */ jsxRuntimeExports.jsx(BriefEnhancer, { enhancer })
      ] }),
      onDestroyed,
      onOk: async () => {
        await (onSubmit == null ? void 0 : onSubmit(options));
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-y-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Select,
            {
              isClearable: true,
              dataSource: allEnhancers.map((e2) => ({ label: e2.name, value: e2.id.toString() })),
              description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                  "You can perform chained enhancement by customizing the execution order of the enhancers."
                ) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Generally, you can just leave it as empty.") })
              ] }),
              label: t2("Run after enhancers"),
              selectedKeys: prerequisiteEnhancers && prerequisiteEnhancers.length > 0 ? prerequisiteEnhancers : void 0,
              selectionMode: "multiple",
              size: "sm",
              onSelectionChange: (keys2) => {
                const arr = Array.from(keys2);
                const vals = arr.map((o2) => parseInt(o2, 10));
                setOptions2({ ...options, requirements: vals });
              }
            }
          ),
          renderKeywordProperty(),
          enhancer.tags.includes(EnhancerTag.UseRegex) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            textarea_default,
            {
              description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                captureGroups.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                  t2("Available capture groups:"),
                  captureGroups.map((g2) => {
                    return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "light", children: g2 });
                  })
                ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                  "No named capture groups were found, so the enhancement will not take effect."
                ) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                  "You can set multiple regex expressions(separated by new line) to match the file or folder name of each resource."
                ) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                  "Text matched by multiple capture groups with the same name will be merged into a list and deduplicated."
                ) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                  "After setting regex expressions, you must go to category page to configure regex enhancer for each category."
                ) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                  "You need to use the same name(index-based group name will be ignored) as the capture group for the dynamic enhancement target, otherwise the resource may not be enhanced."
                ) })
              ] }),
              label: t2("Regex expressions"),
              maxRows: 10,
              minRows: 3,
              value: (_d = options == null ? void 0 : options.expressions) == null ? void 0 : _d.join("\n"),
              onValueChange: (v2) => {
                setOptions2({ ...options, expressions: v2.split("\n") });
              }
            }
          ) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-base", children: [
            t2("Enhance properties"),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-400", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Please select at least one property to enhance.") }) })
          ] }),
          options && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-y-4", children: [
            hasFixedTargets && /* @__PURE__ */ jsxRuntimeExports.jsx(
              FixedTargets,
              {
                enhancer,
                optionsList: options.targetOptions,
                propertyMap,
                onChange: (list2) => {
                  setOptions2({
                    ...options,
                    targetOptions: list2
                  });
                },
                onPropertyChanged: loadAllProperties
              }
            ),
            hasDynamicTargets && /* @__PURE__ */ jsxRuntimeExports.jsx(
              DynamicTargets,
              {
                candidateTargetsMap,
                enhancer,
                optionsList: options.targetOptions,
                propertyMap,
                onChange: (list2) => {
                  setOptions2({
                    ...options,
                    targetOptions: list2
                  });
                },
                onPropertyChanged: loadAllProperties
              }
            )
          ] })
        ] })
      ]
    }
  );
}
var reactDomServerLegacy_browser_production_min = {};
/**
 * @license React
 * react-dom-server-legacy.browser.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;
function l$2(a2) {
  for (var b2 = "https://reactjs.org/docs/error-decoder.html?invariant=" + a2, c2 = 1; c2 < arguments.length; c2++)
    b2 += "&args[]=" + encodeURIComponent(arguments[c2]);
  return "Minified React error #" + a2 + "; visit " + b2 + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";
}
var p$1 = Object.prototype.hasOwnProperty, fa$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]*$/, ha$1 = {}, ia$1 = {};
function ja$1(a2) {
  if (p$1.call(ia$1, a2))
    return true;
  if (p$1.call(ha$1, a2))
    return false;
  if (fa$1.test(a2))
    return ia$1[a2] = true;
  ha$1[a2] = true;
  return false;
}
function r(a2, b2, c2, d2, f2, e2, g2) {
  this.acceptsBooleans = 2 === b2 || 3 === b2 || 4 === b2;
  this.attributeName = d2;
  this.attributeNamespace = f2;
  this.mustUseProperty = c2;
  this.propertyName = a2;
  this.type = b2;
  this.sanitizeURL = e2;
  this.removeEmptyString = g2;
}
var t$1 = {};
"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a2) {
  t$1[a2] = new r(a2, 0, false, a2, null, false, false);
});
[["acceptCharset", "accept-charset"], ["className", "class"], ["htmlFor", "for"], ["httpEquiv", "http-equiv"]].forEach(function(a2) {
  var b2 = a2[0];
  t$1[b2] = new r(b2, 1, false, a2[1], null, false, false);
});
["contentEditable", "draggable", "spellCheck", "value"].forEach(function(a2) {
  t$1[a2] = new r(a2, 2, false, a2.toLowerCase(), null, false, false);
});
["autoReverse", "externalResourcesRequired", "focusable", "preserveAlpha"].forEach(function(a2) {
  t$1[a2] = new r(a2, 2, false, a2, null, false, false);
});
"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(a2) {
  t$1[a2] = new r(a2, 3, false, a2.toLowerCase(), null, false, false);
});
["checked", "multiple", "muted", "selected"].forEach(function(a2) {
  t$1[a2] = new r(a2, 3, true, a2, null, false, false);
});
["capture", "download"].forEach(function(a2) {
  t$1[a2] = new r(a2, 4, false, a2, null, false, false);
});
["cols", "rows", "size", "span"].forEach(function(a2) {
  t$1[a2] = new r(a2, 6, false, a2, null, false, false);
});
["rowSpan", "start"].forEach(function(a2) {
  t$1[a2] = new r(a2, 5, false, a2.toLowerCase(), null, false, false);
});
var ka$1 = /[\-:]([a-z])/g;
function la$1(a2) {
  return a2[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(a2) {
  var b2 = a2.replace(
    ka$1,
    la$1
  );
  t$1[b2] = new r(b2, 1, false, a2, null, false, false);
});
"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a2) {
  var b2 = a2.replace(ka$1, la$1);
  t$1[b2] = new r(b2, 1, false, a2, "http://www.w3.org/1999/xlink", false, false);
});
["xml:base", "xml:lang", "xml:space"].forEach(function(a2) {
  var b2 = a2.replace(ka$1, la$1);
  t$1[b2] = new r(b2, 1, false, a2, "http://www.w3.org/XML/1998/namespace", false, false);
});
["tabIndex", "crossOrigin"].forEach(function(a2) {
  t$1[a2] = new r(a2, 1, false, a2.toLowerCase(), null, false, false);
});
t$1.xlinkHref = new r("xlinkHref", 1, false, "xlink:href", "http://www.w3.org/1999/xlink", true, false);
["src", "href", "action", "formAction"].forEach(function(a2) {
  t$1[a2] = new r(a2, 1, false, a2.toLowerCase(), null, true, true);
});
var u$1 = {
  animationIterationCount: true,
  aspectRatio: true,
  borderImageOutset: true,
  borderImageSlice: true,
  borderImageWidth: true,
  boxFlex: true,
  boxFlexGroup: true,
  boxOrdinalGroup: true,
  columnCount: true,
  columns: true,
  flex: true,
  flexGrow: true,
  flexPositive: true,
  flexShrink: true,
  flexNegative: true,
  flexOrder: true,
  gridArea: true,
  gridRow: true,
  gridRowEnd: true,
  gridRowSpan: true,
  gridRowStart: true,
  gridColumn: true,
  gridColumnEnd: true,
  gridColumnSpan: true,
  gridColumnStart: true,
  fontWeight: true,
  lineClamp: true,
  lineHeight: true,
  opacity: true,
  order: true,
  orphans: true,
  tabSize: true,
  widows: true,
  zIndex: true,
  zoom: true,
  fillOpacity: true,
  floodOpacity: true,
  stopOpacity: true,
  strokeDasharray: true,
  strokeDashoffset: true,
  strokeMiterlimit: true,
  strokeOpacity: true,
  strokeWidth: true
}, ma = ["Webkit", "ms", "Moz", "O"];
Object.keys(u$1).forEach(function(a2) {
  ma.forEach(function(b2) {
    b2 = b2 + a2.charAt(0).toUpperCase() + a2.substring(1);
    u$1[b2] = u$1[a2];
  });
});
var na = /["'&<>]/;
function v(a2) {
  if ("boolean" === typeof a2 || "number" === typeof a2)
    return "" + a2;
  a2 = "" + a2;
  var b2 = na.exec(a2);
  if (b2) {
    var c2 = "", d2, f2 = 0;
    for (d2 = b2.index; d2 < a2.length; d2++) {
      switch (a2.charCodeAt(d2)) {
        case 34:
          b2 = "&quot;";
          break;
        case 38:
          b2 = "&amp;";
          break;
        case 39:
          b2 = "&#x27;";
          break;
        case 60:
          b2 = "&lt;";
          break;
        case 62:
          b2 = "&gt;";
          break;
        default:
          continue;
      }
      f2 !== d2 && (c2 += a2.substring(f2, d2));
      f2 = d2 + 1;
      c2 += b2;
    }
    a2 = f2 !== d2 ? c2 + a2.substring(f2, d2) : c2;
  }
  return a2;
}
var oa$1 = /([A-Z])/g, pa$1 = /^ms-/, qa$1 = Array.isArray;
function w$1(a2, b2) {
  return { insertionMode: a2, selectedValue: b2 };
}
function ra$1(a2, b2, c2) {
  switch (b2) {
    case "select":
      return w$1(1, null != c2.value ? c2.value : c2.defaultValue);
    case "svg":
      return w$1(2, null);
    case "math":
      return w$1(3, null);
    case "foreignObject":
      return w$1(1, null);
    case "table":
      return w$1(4, null);
    case "thead":
    case "tbody":
    case "tfoot":
      return w$1(5, null);
    case "colgroup":
      return w$1(7, null);
    case "tr":
      return w$1(6, null);
  }
  return 4 <= a2.insertionMode || 0 === a2.insertionMode ? w$1(1, null) : a2;
}
var sa$1 = /* @__PURE__ */ new Map();
function ta$1(a2, b2, c2) {
  if ("object" !== typeof c2)
    throw Error(l$2(62));
  b2 = true;
  for (var d2 in c2)
    if (p$1.call(c2, d2)) {
      var f2 = c2[d2];
      if (null != f2 && "boolean" !== typeof f2 && "" !== f2) {
        if (0 === d2.indexOf("--")) {
          var e2 = v(d2);
          f2 = v(("" + f2).trim());
        } else {
          e2 = d2;
          var g2 = sa$1.get(e2);
          void 0 !== g2 ? e2 = g2 : (g2 = v(e2.replace(oa$1, "-$1").toLowerCase().replace(pa$1, "-ms-")), sa$1.set(e2, g2), e2 = g2);
          f2 = "number" === typeof f2 ? 0 === f2 || p$1.call(u$1, d2) ? "" + f2 : f2 + "px" : v(("" + f2).trim());
        }
        b2 ? (b2 = false, a2.push(' style="', e2, ":", f2)) : a2.push(";", e2, ":", f2);
      }
    }
  b2 || a2.push('"');
}
function x$1(a2, b2, c2, d2) {
  switch (c2) {
    case "style":
      ta$1(a2, b2, d2);
      return;
    case "defaultValue":
    case "defaultChecked":
    case "innerHTML":
    case "suppressContentEditableWarning":
    case "suppressHydrationWarning":
      return;
  }
  if (!(2 < c2.length) || "o" !== c2[0] && "O" !== c2[0] || "n" !== c2[1] && "N" !== c2[1]) {
    if (b2 = t$1.hasOwnProperty(c2) ? t$1[c2] : null, null !== b2) {
      switch (typeof d2) {
        case "function":
        case "symbol":
          return;
        case "boolean":
          if (!b2.acceptsBooleans)
            return;
      }
      c2 = b2.attributeName;
      switch (b2.type) {
        case 3:
          d2 && a2.push(" ", c2, '=""');
          break;
        case 4:
          true === d2 ? a2.push(" ", c2, '=""') : false !== d2 && a2.push(" ", c2, '="', v(d2), '"');
          break;
        case 5:
          isNaN(d2) || a2.push(" ", c2, '="', v(d2), '"');
          break;
        case 6:
          !isNaN(d2) && 1 <= d2 && a2.push(" ", c2, '="', v(d2), '"');
          break;
        default:
          b2.sanitizeURL && (d2 = "" + d2), a2.push(" ", c2, '="', v(d2), '"');
      }
    } else if (ja$1(c2)) {
      switch (typeof d2) {
        case "function":
        case "symbol":
          return;
        case "boolean":
          if (b2 = c2.toLowerCase().slice(0, 5), "data-" !== b2 && "aria-" !== b2)
            return;
      }
      a2.push(" ", c2, '="', v(d2), '"');
    }
  }
}
function y$1(a2, b2, c2) {
  if (null != b2) {
    if (null != c2)
      throw Error(l$2(60));
    if ("object" !== typeof b2 || !("__html" in b2))
      throw Error(l$2(61));
    b2 = b2.__html;
    null !== b2 && void 0 !== b2 && a2.push("" + b2);
  }
}
function ua$1(a2) {
  var b2 = "";
  aa$1.Children.forEach(a2, function(a3) {
    null != a3 && (b2 += a3);
  });
  return b2;
}
function va$1(a2, b2, c2, d2) {
  a2.push(A(c2));
  var f2 = c2 = null, e2;
  for (e2 in b2)
    if (p$1.call(b2, e2)) {
      var g2 = b2[e2];
      if (null != g2)
        switch (e2) {
          case "children":
            c2 = g2;
            break;
          case "dangerouslySetInnerHTML":
            f2 = g2;
            break;
          default:
            x$1(a2, d2, e2, g2);
        }
    }
  a2.push(">");
  y$1(a2, f2, c2);
  return "string" === typeof c2 ? (a2.push(v(c2)), null) : c2;
}
var wa$1 = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/, xa$1 = /* @__PURE__ */ new Map();
function A(a2) {
  var b2 = xa$1.get(a2);
  if (void 0 === b2) {
    if (!wa$1.test(a2))
      throw Error(l$2(65, a2));
    b2 = "<" + a2;
    xa$1.set(a2, b2);
  }
  return b2;
}
function ya$1(a2, b2, c2, d2, f2) {
  switch (b2) {
    case "select":
      a2.push(A("select"));
      var e2 = null, g2 = null;
      for (n2 in c2)
        if (p$1.call(c2, n2)) {
          var h3 = c2[n2];
          if (null != h3)
            switch (n2) {
              case "children":
                e2 = h3;
                break;
              case "dangerouslySetInnerHTML":
                g2 = h3;
                break;
              case "defaultValue":
              case "value":
                break;
              default:
                x$1(a2, d2, n2, h3);
            }
        }
      a2.push(">");
      y$1(a2, g2, e2);
      return e2;
    case "option":
      g2 = f2.selectedValue;
      a2.push(A("option"));
      var k2 = h3 = null, m2 = null;
      var n2 = null;
      for (e2 in c2)
        if (p$1.call(c2, e2)) {
          var q2 = c2[e2];
          if (null != q2)
            switch (e2) {
              case "children":
                h3 = q2;
                break;
              case "selected":
                m2 = q2;
                break;
              case "dangerouslySetInnerHTML":
                n2 = q2;
                break;
              case "value":
                k2 = q2;
              default:
                x$1(a2, d2, e2, q2);
            }
        }
      if (null != g2)
        if (c2 = null !== k2 ? "" + k2 : ua$1(h3), qa$1(g2))
          for (d2 = 0; d2 < g2.length; d2++) {
            if ("" + g2[d2] === c2) {
              a2.push(' selected=""');
              break;
            }
          }
        else
          "" + g2 === c2 && a2.push(' selected=""');
      else
        m2 && a2.push(' selected=""');
      a2.push(">");
      y$1(a2, n2, h3);
      return h3;
    case "textarea":
      a2.push(A("textarea"));
      n2 = g2 = e2 = null;
      for (h3 in c2)
        if (p$1.call(c2, h3) && (k2 = c2[h3], null != k2))
          switch (h3) {
            case "children":
              n2 = k2;
              break;
            case "value":
              e2 = k2;
              break;
            case "defaultValue":
              g2 = k2;
              break;
            case "dangerouslySetInnerHTML":
              throw Error(l$2(91));
            default:
              x$1(
                a2,
                d2,
                h3,
                k2
              );
          }
      null === e2 && null !== g2 && (e2 = g2);
      a2.push(">");
      if (null != n2) {
        if (null != e2)
          throw Error(l$2(92));
        if (qa$1(n2) && 1 < n2.length)
          throw Error(l$2(93));
        e2 = "" + n2;
      }
      "string" === typeof e2 && "\n" === e2[0] && a2.push("\n");
      null !== e2 && a2.push(v("" + e2));
      return null;
    case "input":
      a2.push(A("input"));
      k2 = n2 = h3 = e2 = null;
      for (g2 in c2)
        if (p$1.call(c2, g2) && (m2 = c2[g2], null != m2))
          switch (g2) {
            case "children":
            case "dangerouslySetInnerHTML":
              throw Error(l$2(399, "input"));
            case "defaultChecked":
              k2 = m2;
              break;
            case "defaultValue":
              h3 = m2;
              break;
            case "checked":
              n2 = m2;
              break;
            case "value":
              e2 = m2;
              break;
            default:
              x$1(a2, d2, g2, m2);
          }
      null !== n2 ? x$1(a2, d2, "checked", n2) : null !== k2 && x$1(a2, d2, "checked", k2);
      null !== e2 ? x$1(a2, d2, "value", e2) : null !== h3 && x$1(a2, d2, "value", h3);
      a2.push("/>");
      return null;
    case "menuitem":
      a2.push(A("menuitem"));
      for (var C2 in c2)
        if (p$1.call(c2, C2) && (e2 = c2[C2], null != e2))
          switch (C2) {
            case "children":
            case "dangerouslySetInnerHTML":
              throw Error(l$2(400));
            default:
              x$1(a2, d2, C2, e2);
          }
      a2.push(">");
      return null;
    case "title":
      a2.push(A("title"));
      e2 = null;
      for (q2 in c2)
        if (p$1.call(c2, q2) && (g2 = c2[q2], null != g2))
          switch (q2) {
            case "children":
              e2 = g2;
              break;
            case "dangerouslySetInnerHTML":
              throw Error(l$2(434));
            default:
              x$1(a2, d2, q2, g2);
          }
      a2.push(">");
      return e2;
    case "listing":
    case "pre":
      a2.push(A(b2));
      g2 = e2 = null;
      for (k2 in c2)
        if (p$1.call(c2, k2) && (h3 = c2[k2], null != h3))
          switch (k2) {
            case "children":
              e2 = h3;
              break;
            case "dangerouslySetInnerHTML":
              g2 = h3;
              break;
            default:
              x$1(a2, d2, k2, h3);
          }
      a2.push(">");
      if (null != g2) {
        if (null != e2)
          throw Error(l$2(60));
        if ("object" !== typeof g2 || !("__html" in g2))
          throw Error(l$2(61));
        c2 = g2.__html;
        null !== c2 && void 0 !== c2 && ("string" === typeof c2 && 0 < c2.length && "\n" === c2[0] ? a2.push("\n", c2) : a2.push("" + c2));
      }
      "string" === typeof e2 && "\n" === e2[0] && a2.push("\n");
      return e2;
    case "area":
    case "base":
    case "br":
    case "col":
    case "embed":
    case "hr":
    case "img":
    case "keygen":
    case "link":
    case "meta":
    case "param":
    case "source":
    case "track":
    case "wbr":
      a2.push(A(b2));
      for (var D2 in c2)
        if (p$1.call(c2, D2) && (e2 = c2[D2], null != e2))
          switch (D2) {
            case "children":
            case "dangerouslySetInnerHTML":
              throw Error(l$2(399, b2));
            default:
              x$1(a2, d2, D2, e2);
          }
      a2.push("/>");
      return null;
    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 va$1(
        a2,
        c2,
        b2,
        d2
      );
    case "html":
      return 0 === f2.insertionMode && a2.push("<!DOCTYPE html>"), va$1(a2, c2, b2, d2);
    default:
      if (-1 === b2.indexOf("-") && "string" !== typeof c2.is)
        return va$1(a2, c2, b2, d2);
      a2.push(A(b2));
      g2 = e2 = null;
      for (m2 in c2)
        if (p$1.call(c2, m2) && (h3 = c2[m2], null != h3))
          switch (m2) {
            case "children":
              e2 = h3;
              break;
            case "dangerouslySetInnerHTML":
              g2 = h3;
              break;
            case "style":
              ta$1(a2, d2, h3);
              break;
            case "suppressContentEditableWarning":
            case "suppressHydrationWarning":
              break;
            default:
              ja$1(m2) && "function" !== typeof h3 && "symbol" !== typeof h3 && a2.push(" ", m2, '="', v(h3), '"');
          }
      a2.push(">");
      y$1(a2, g2, e2);
      return e2;
  }
}
function za$1(a2, b2, c2) {
  a2.push('<!--$?--><template id="');
  if (null === c2)
    throw Error(l$2(395));
  a2.push(c2);
  return a2.push('"></template>');
}
function Aa$1(a2, b2, c2, d2) {
  switch (c2.insertionMode) {
    case 0:
    case 1:
      return a2.push('<div hidden id="'), a2.push(b2.segmentPrefix), b2 = d2.toString(16), a2.push(b2), a2.push('">');
    case 2:
      return a2.push('<svg aria-hidden="true" style="display:none" id="'), a2.push(b2.segmentPrefix), b2 = d2.toString(16), a2.push(b2), a2.push('">');
    case 3:
      return a2.push('<math aria-hidden="true" style="display:none" id="'), a2.push(b2.segmentPrefix), b2 = d2.toString(16), a2.push(b2), a2.push('">');
    case 4:
      return a2.push('<table hidden id="'), a2.push(b2.segmentPrefix), b2 = d2.toString(16), a2.push(b2), a2.push('">');
    case 5:
      return a2.push('<table hidden><tbody id="'), a2.push(b2.segmentPrefix), b2 = d2.toString(16), a2.push(b2), a2.push('">');
    case 6:
      return a2.push('<table hidden><tr id="'), a2.push(b2.segmentPrefix), b2 = d2.toString(16), a2.push(b2), a2.push('">');
    case 7:
      return a2.push('<table hidden><colgroup id="'), a2.push(b2.segmentPrefix), b2 = d2.toString(16), a2.push(b2), a2.push('">');
    default:
      throw Error(l$2(397));
  }
}
function Ba$1(a2, b2) {
  switch (b2.insertionMode) {
    case 0:
    case 1:
      return a2.push("</div>");
    case 2:
      return a2.push("</svg>");
    case 3:
      return a2.push("</math>");
    case 4:
      return a2.push("</table>");
    case 5:
      return a2.push("</tbody></table>");
    case 6:
      return a2.push("</tr></table>");
    case 7:
      return a2.push("</colgroup></table>");
    default:
      throw Error(l$2(397));
  }
}
var Ca$1 = /[<\u2028\u2029]/g;
function Da$1(a2) {
  return JSON.stringify(a2).replace(Ca$1, function(a3) {
    switch (a3) {
      case "<":
        return "\\u003c";
      case "\u2028":
        return "\\u2028";
      case "\u2029":
        return "\\u2029";
      default:
        throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no longer in sync. This is a bug in React");
    }
  });
}
function Ea$1(a2, b2) {
  b2 = void 0 === b2 ? "" : b2;
  return { bootstrapChunks: [], startInlineScript: "<script>", placeholderPrefix: b2 + "P:", segmentPrefix: b2 + "S:", boundaryPrefix: b2 + "B:", idPrefix: b2, nextSuspenseID: 0, sentCompleteSegmentFunction: false, sentCompleteBoundaryFunction: false, sentClientRenderFunction: false, generateStaticMarkup: a2 };
}
function Fa$1(a2, b2, c2, d2) {
  if (c2.generateStaticMarkup)
    return a2.push(v(b2)), false;
  "" === b2 ? a2 = d2 : (d2 && a2.push("<!-- -->"), a2.push(v(b2)), a2 = true);
  return a2;
}
var B$1 = Object.assign, Ga$1 = Symbol.for("react.element"), Ha$1 = Symbol.for("react.portal"), Ia$1 = Symbol.for("react.fragment"), Ja$1 = Symbol.for("react.strict_mode"), Ka$1 = Symbol.for("react.profiler"), La$1 = Symbol.for("react.provider"), Ma$1 = Symbol.for("react.context"), Na$1 = Symbol.for("react.forward_ref"), Oa$1 = Symbol.for("react.suspense"), Pa$1 = Symbol.for("react.suspense_list"), Qa$1 = Symbol.for("react.memo"), Ra$1 = Symbol.for("react.lazy"), Sa$1 = Symbol.for("react.scope"), Ta$1 = Symbol.for("react.debug_trace_mode"), Ua$1 = Symbol.for("react.legacy_hidden"), Va$1 = Symbol.for("react.default_value"), Wa$1 = Symbol.iterator;
function Xa$1(a2) {
  if (null == a2)
    return null;
  if ("function" === typeof a2)
    return a2.displayName || a2.name || null;
  if ("string" === typeof a2)
    return a2;
  switch (a2) {
    case Ia$1:
      return "Fragment";
    case Ha$1:
      return "Portal";
    case Ka$1:
      return "Profiler";
    case Ja$1:
      return "StrictMode";
    case Oa$1:
      return "Suspense";
    case Pa$1:
      return "SuspenseList";
  }
  if ("object" === typeof a2)
    switch (a2.$$typeof) {
      case Ma$1:
        return (a2.displayName || "Context") + ".Consumer";
      case La$1:
        return (a2._context.displayName || "Context") + ".Provider";
      case Na$1:
        var b2 = a2.render;
        a2 = a2.displayName;
        a2 || (a2 = b2.displayName || b2.name || "", a2 = "" !== a2 ? "ForwardRef(" + a2 + ")" : "ForwardRef");
        return a2;
      case Qa$1:
        return b2 = a2.displayName || null, null !== b2 ? b2 : Xa$1(a2.type) || "Memo";
      case Ra$1:
        b2 = a2._payload;
        a2 = a2._init;
        try {
          return Xa$1(a2(b2));
        } catch (c2) {
        }
    }
  return null;
}
var Ya$1 = {};
function Za$1(a2, b2) {
  a2 = a2.contextTypes;
  if (!a2)
    return Ya$1;
  var c2 = {}, d2;
  for (d2 in a2)
    c2[d2] = b2[d2];
  return c2;
}
var E$1 = null;
function F(a2, b2) {
  if (a2 !== b2) {
    a2.context._currentValue2 = a2.parentValue;
    a2 = a2.parent;
    var c2 = b2.parent;
    if (null === a2) {
      if (null !== c2)
        throw Error(l$2(401));
    } else {
      if (null === c2)
        throw Error(l$2(401));
      F(a2, c2);
    }
    b2.context._currentValue2 = b2.value;
  }
}
function $a$1(a2) {
  a2.context._currentValue2 = a2.parentValue;
  a2 = a2.parent;
  null !== a2 && $a$1(a2);
}
function ab$1(a2) {
  var b2 = a2.parent;
  null !== b2 && ab$1(b2);
  a2.context._currentValue2 = a2.value;
}
function bb$1(a2, b2) {
  a2.context._currentValue2 = a2.parentValue;
  a2 = a2.parent;
  if (null === a2)
    throw Error(l$2(402));
  a2.depth === b2.depth ? F(a2, b2) : bb$1(a2, b2);
}
function cb$1(a2, b2) {
  var c2 = b2.parent;
  if (null === c2)
    throw Error(l$2(402));
  a2.depth === c2.depth ? F(a2, c2) : cb$1(a2, c2);
  b2.context._currentValue2 = b2.value;
}
function G(a2) {
  var b2 = E$1;
  b2 !== a2 && (null === b2 ? ab$1(a2) : null === a2 ? $a$1(b2) : b2.depth === a2.depth ? F(b2, a2) : b2.depth > a2.depth ? bb$1(b2, a2) : cb$1(b2, a2), E$1 = a2);
}
var db$1 = { isMounted: function() {
  return false;
}, enqueueSetState: function(a2, b2) {
  a2 = a2._reactInternals;
  null !== a2.queue && a2.queue.push(b2);
}, enqueueReplaceState: function(a2, b2) {
  a2 = a2._reactInternals;
  a2.replace = true;
  a2.queue = [b2];
}, enqueueForceUpdate: function() {
} };
function eb$1(a2, b2, c2, d2) {
  var f2 = void 0 !== a2.state ? a2.state : null;
  a2.updater = db$1;
  a2.props = c2;
  a2.state = f2;
  var e2 = { queue: [], replace: false };
  a2._reactInternals = e2;
  var g2 = b2.contextType;
  a2.context = "object" === typeof g2 && null !== g2 ? g2._currentValue2 : d2;
  g2 = b2.getDerivedStateFromProps;
  "function" === typeof g2 && (g2 = g2(c2, f2), f2 = null === g2 || void 0 === g2 ? f2 : B$1({}, f2, g2), a2.state = f2);
  if ("function" !== typeof b2.getDerivedStateFromProps && "function" !== typeof a2.getSnapshotBeforeUpdate && ("function" === typeof a2.UNSAFE_componentWillMount || "function" === typeof a2.componentWillMount))
    if (b2 = a2.state, "function" === typeof a2.componentWillMount && a2.componentWillMount(), "function" === typeof a2.UNSAFE_componentWillMount && a2.UNSAFE_componentWillMount(), b2 !== a2.state && db$1.enqueueReplaceState(a2, a2.state, null), null !== e2.queue && 0 < e2.queue.length)
      if (b2 = e2.queue, g2 = e2.replace, e2.queue = null, e2.replace = false, g2 && 1 === b2.length)
        a2.state = b2[0];
      else {
        e2 = g2 ? b2[0] : a2.state;
        f2 = true;
        for (g2 = g2 ? 1 : 0; g2 < b2.length; g2++) {
          var h3 = b2[g2];
          h3 = "function" === typeof h3 ? h3.call(a2, e2, c2, d2) : h3;
          null != h3 && (f2 ? (f2 = false, e2 = B$1({}, e2, h3)) : B$1(e2, h3));
        }
        a2.state = e2;
      }
    else
      e2.queue = null;
}
var fb$1 = { id: 1, overflow: "" };
function gb$1(a2, b2, c2) {
  var d2 = a2.id;
  a2 = a2.overflow;
  var f2 = 32 - H$1(d2) - 1;
  d2 &= ~(1 << f2);
  c2 += 1;
  var e2 = 32 - H$1(b2) + f2;
  if (30 < e2) {
    var g2 = f2 - f2 % 5;
    e2 = (d2 & (1 << g2) - 1).toString(32);
    d2 >>= g2;
    f2 -= g2;
    return { id: 1 << 32 - H$1(b2) + f2 | c2 << f2 | d2, overflow: e2 + a2 };
  }
  return { id: 1 << e2 | c2 << f2 | d2, overflow: a2 };
}
var H$1 = Math.clz32 ? Math.clz32 : hb$1, ib$1 = Math.log, jb$1 = Math.LN2;
function hb$1(a2) {
  a2 >>>= 0;
  return 0 === a2 ? 32 : 31 - (ib$1(a2) / jb$1 | 0) | 0;
}
function kb$1(a2, b2) {
  return a2 === b2 && (0 !== a2 || 1 / a2 === 1 / b2) || a2 !== a2 && b2 !== b2;
}
var lb$1 = "function" === typeof Object.is ? Object.is : kb$1, I$1 = null, ob$1 = null, J$1 = null, K$1 = null, L$1 = false, M$1 = false, N$1 = 0, O$1 = null, P$1 = 0;
function Q$1() {
  if (null === I$1)
    throw Error(l$2(321));
  return I$1;
}
function pb$1() {
  if (0 < P$1)
    throw Error(l$2(312));
  return { memoizedState: null, queue: null, next: null };
}
function qb$1() {
  null === K$1 ? null === J$1 ? (L$1 = false, J$1 = K$1 = pb$1()) : (L$1 = true, K$1 = J$1) : null === K$1.next ? (L$1 = false, K$1 = K$1.next = pb$1()) : (L$1 = true, K$1 = K$1.next);
  return K$1;
}
function rb$1() {
  ob$1 = I$1 = null;
  M$1 = false;
  J$1 = null;
  P$1 = 0;
  K$1 = O$1 = null;
}
function sb$1(a2, b2) {
  return "function" === typeof b2 ? b2(a2) : b2;
}
function tb$1(a2, b2, c2) {
  I$1 = Q$1();
  K$1 = qb$1();
  if (L$1) {
    var d2 = K$1.queue;
    b2 = d2.dispatch;
    if (null !== O$1 && (c2 = O$1.get(d2), void 0 !== c2)) {
      O$1.delete(d2);
      d2 = K$1.memoizedState;
      do
        d2 = a2(d2, c2.action), c2 = c2.next;
      while (null !== c2);
      K$1.memoizedState = d2;
      return [d2, b2];
    }
    return [K$1.memoizedState, b2];
  }
  a2 = a2 === sb$1 ? "function" === typeof b2 ? b2() : b2 : void 0 !== c2 ? c2(b2) : b2;
  K$1.memoizedState = a2;
  a2 = K$1.queue = { last: null, dispatch: null };
  a2 = a2.dispatch = ub$1.bind(null, I$1, a2);
  return [K$1.memoizedState, a2];
}
function vb$1(a2, b2) {
  I$1 = Q$1();
  K$1 = qb$1();
  b2 = void 0 === b2 ? null : b2;
  if (null !== K$1) {
    var c2 = K$1.memoizedState;
    if (null !== c2 && null !== b2) {
      var d2 = c2[1];
      a:
        if (null === d2)
          d2 = false;
        else {
          for (var f2 = 0; f2 < d2.length && f2 < b2.length; f2++)
            if (!lb$1(b2[f2], d2[f2])) {
              d2 = false;
              break a;
            }
          d2 = true;
        }
      if (d2)
        return c2[0];
    }
  }
  a2 = a2();
  K$1.memoizedState = [a2, b2];
  return a2;
}
function ub$1(a2, b2, c2) {
  if (25 <= P$1)
    throw Error(l$2(301));
  if (a2 === I$1)
    if (M$1 = true, a2 = { action: c2, next: null }, null === O$1 && (O$1 = /* @__PURE__ */ new Map()), c2 = O$1.get(b2), void 0 === c2)
      O$1.set(b2, a2);
    else {
      for (b2 = c2; null !== b2.next; )
        b2 = b2.next;
      b2.next = a2;
    }
}
function wb$1() {
  throw Error(l$2(394));
}
function R$1() {
}
var xb$1 = { readContext: function(a2) {
  return a2._currentValue2;
}, useContext: function(a2) {
  Q$1();
  return a2._currentValue2;
}, useMemo: vb$1, useReducer: tb$1, useRef: function(a2) {
  I$1 = Q$1();
  K$1 = qb$1();
  var b2 = K$1.memoizedState;
  return null === b2 ? (a2 = { current: a2 }, K$1.memoizedState = a2) : b2;
}, useState: function(a2) {
  return tb$1(sb$1, a2);
}, useInsertionEffect: R$1, useLayoutEffect: function() {
}, useCallback: function(a2, b2) {
  return vb$1(function() {
    return a2;
  }, b2);
}, useImperativeHandle: R$1, useEffect: R$1, useDebugValue: R$1, useDeferredValue: function(a2) {
  Q$1();
  return a2;
}, useTransition: function() {
  Q$1();
  return [
    false,
    wb$1
  ];
}, useId: function() {
  var a2 = ob$1.treeContext;
  var b2 = a2.overflow;
  a2 = a2.id;
  a2 = (a2 & ~(1 << 32 - H$1(a2) - 1)).toString(32) + b2;
  var c2 = S$1;
  if (null === c2)
    throw Error(l$2(404));
  b2 = N$1++;
  a2 = ":" + c2.idPrefix + "R" + a2;
  0 < b2 && (a2 += "H" + b2.toString(32));
  return a2 + ":";
}, useMutableSource: function(a2, b2) {
  Q$1();
  return b2(a2._source);
}, useSyncExternalStore: function(a2, b2, c2) {
  if (void 0 === c2)
    throw Error(l$2(407));
  return c2();
} }, S$1 = null, yb$1 = aa$1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;
function zb$1(a2) {
  console.error(a2);
  return null;
}
function T$1() {
}
function Ab$1(a2, b2, c2, d2, f2, e2, g2, h3, k2) {
  var m2 = [], n2 = /* @__PURE__ */ new Set();
  b2 = { destination: null, responseState: b2, progressiveChunkSize: void 0 === d2 ? 12800 : d2, status: 0, fatalError: null, nextSegmentId: 0, allPendingTasks: 0, pendingRootTasks: 0, completedRootSegment: null, abortableTasks: n2, pingedTasks: m2, clientRenderedBoundaries: [], completedBoundaries: [], partialBoundaries: [], onError: void 0 === f2 ? zb$1 : f2, onAllReady: T$1, onShellReady: void 0 === g2 ? T$1 : g2, onShellError: T$1, onFatalError: T$1 };
  c2 = U$1(b2, 0, null, c2, false, false);
  c2.parentFlushed = true;
  a2 = Bb$1(b2, a2, null, c2, n2, Ya$1, null, fb$1);
  m2.push(a2);
  return b2;
}
function Bb$1(a2, b2, c2, d2, f2, e2, g2, h3) {
  a2.allPendingTasks++;
  null === c2 ? a2.pendingRootTasks++ : c2.pendingTasks++;
  var k2 = { node: b2, ping: function() {
    var b3 = a2.pingedTasks;
    b3.push(k2);
    1 === b3.length && Cb$1(a2);
  }, blockedBoundary: c2, blockedSegment: d2, abortSet: f2, legacyContext: e2, context: g2, treeContext: h3 };
  f2.add(k2);
  return k2;
}
function U$1(a2, b2, c2, d2, f2, e2) {
  return { status: 0, id: -1, index: b2, parentFlushed: false, chunks: [], children: [], formatContext: d2, boundary: c2, lastPushedText: f2, textEmbedded: e2 };
}
function V$1(a2, b2) {
  a2 = a2.onError(b2);
  if (null != a2 && "string" !== typeof a2)
    throw Error('onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "' + typeof a2 + '" instead');
  return a2;
}
function W$1(a2, b2) {
  var c2 = a2.onShellError;
  c2(b2);
  c2 = a2.onFatalError;
  c2(b2);
  null !== a2.destination ? (a2.status = 2, a2.destination.destroy(b2)) : (a2.status = 1, a2.fatalError = b2);
}
function Db$1(a2, b2, c2, d2, f2) {
  I$1 = {};
  ob$1 = b2;
  N$1 = 0;
  for (a2 = c2(d2, f2); M$1; )
    M$1 = false, N$1 = 0, P$1 += 1, K$1 = null, a2 = c2(d2, f2);
  rb$1();
  return a2;
}
function Eb$1(a2, b2, c2, d2) {
  var f2 = c2.render(), e2 = d2.childContextTypes;
  if (null !== e2 && void 0 !== e2) {
    var g2 = b2.legacyContext;
    if ("function" !== typeof c2.getChildContext)
      d2 = g2;
    else {
      c2 = c2.getChildContext();
      for (var h3 in c2)
        if (!(h3 in e2))
          throw Error(l$2(108, Xa$1(d2) || "Unknown", h3));
      d2 = B$1({}, g2, c2);
    }
    b2.legacyContext = d2;
    X$1(a2, b2, f2);
    b2.legacyContext = g2;
  } else
    X$1(a2, b2, f2);
}
function Fb(a2, b2) {
  if (a2 && a2.defaultProps) {
    b2 = B$1({}, b2);
    a2 = a2.defaultProps;
    for (var c2 in a2)
      void 0 === b2[c2] && (b2[c2] = a2[c2]);
    return b2;
  }
  return b2;
}
function Gb$1(a2, b2, c2, d2, f2) {
  if ("function" === typeof c2)
    if (c2.prototype && c2.prototype.isReactComponent) {
      f2 = Za$1(c2, b2.legacyContext);
      var e2 = c2.contextType;
      e2 = new c2(d2, "object" === typeof e2 && null !== e2 ? e2._currentValue2 : f2);
      eb$1(e2, c2, d2, f2);
      Eb$1(a2, b2, e2, c2);
    } else {
      e2 = Za$1(c2, b2.legacyContext);
      f2 = Db$1(a2, b2, c2, d2, e2);
      var g2 = 0 !== N$1;
      if ("object" === typeof f2 && null !== f2 && "function" === typeof f2.render && void 0 === f2.$$typeof)
        eb$1(f2, c2, d2, e2), Eb$1(a2, b2, f2, c2);
      else if (g2) {
        d2 = b2.treeContext;
        b2.treeContext = gb$1(d2, 1, 0);
        try {
          X$1(a2, b2, f2);
        } finally {
          b2.treeContext = d2;
        }
      } else
        X$1(a2, b2, f2);
    }
  else if ("string" === typeof c2) {
    f2 = b2.blockedSegment;
    e2 = ya$1(f2.chunks, c2, d2, a2.responseState, f2.formatContext);
    f2.lastPushedText = false;
    g2 = f2.formatContext;
    f2.formatContext = ra$1(g2, c2, d2);
    Hb$1(a2, b2, e2);
    f2.formatContext = g2;
    switch (c2) {
      case "area":
      case "base":
      case "br":
      case "col":
      case "embed":
      case "hr":
      case "img":
      case "input":
      case "keygen":
      case "link":
      case "meta":
      case "param":
      case "source":
      case "track":
      case "wbr":
        break;
      default:
        f2.chunks.push("</", c2, ">");
    }
    f2.lastPushedText = false;
  } else {
    switch (c2) {
      case Ua$1:
      case Ta$1:
      case Ja$1:
      case Ka$1:
      case Ia$1:
        X$1(a2, b2, d2.children);
        return;
      case Pa$1:
        X$1(a2, b2, d2.children);
        return;
      case Sa$1:
        throw Error(l$2(343));
      case Oa$1:
        a: {
          c2 = b2.blockedBoundary;
          f2 = b2.blockedSegment;
          e2 = d2.fallback;
          d2 = d2.children;
          g2 = /* @__PURE__ */ new Set();
          var h3 = { id: null, rootSegmentID: -1, parentFlushed: false, pendingTasks: 0, forceClientRender: false, completedSegments: [], byteSize: 0, fallbackAbortableTasks: g2, errorDigest: null }, k2 = U$1(a2, f2.chunks.length, h3, f2.formatContext, false, false);
          f2.children.push(k2);
          f2.lastPushedText = false;
          var m2 = U$1(a2, 0, null, f2.formatContext, false, false);
          m2.parentFlushed = true;
          b2.blockedBoundary = h3;
          b2.blockedSegment = m2;
          try {
            if (Hb$1(
              a2,
              b2,
              d2
            ), a2.responseState.generateStaticMarkup || m2.lastPushedText && m2.textEmbedded && m2.chunks.push("<!-- -->"), m2.status = 1, Y$1(h3, m2), 0 === h3.pendingTasks)
              break a;
          } catch (n2) {
            m2.status = 4, h3.forceClientRender = true, h3.errorDigest = V$1(a2, n2);
          } finally {
            b2.blockedBoundary = c2, b2.blockedSegment = f2;
          }
          b2 = Bb$1(a2, e2, c2, k2, g2, b2.legacyContext, b2.context, b2.treeContext);
          a2.pingedTasks.push(b2);
        }
        return;
    }
    if ("object" === typeof c2 && null !== c2)
      switch (c2.$$typeof) {
        case Na$1:
          d2 = Db$1(a2, b2, c2.render, d2, f2);
          if (0 !== N$1) {
            c2 = b2.treeContext;
            b2.treeContext = gb$1(c2, 1, 0);
            try {
              X$1(a2, b2, d2);
            } finally {
              b2.treeContext = c2;
            }
          } else
            X$1(a2, b2, d2);
          return;
        case Qa$1:
          c2 = c2.type;
          d2 = Fb(c2, d2);
          Gb$1(a2, b2, c2, d2, f2);
          return;
        case La$1:
          f2 = d2.children;
          c2 = c2._context;
          d2 = d2.value;
          e2 = c2._currentValue2;
          c2._currentValue2 = d2;
          g2 = E$1;
          E$1 = d2 = { parent: g2, depth: null === g2 ? 0 : g2.depth + 1, context: c2, parentValue: e2, value: d2 };
          b2.context = d2;
          X$1(a2, b2, f2);
          a2 = E$1;
          if (null === a2)
            throw Error(l$2(403));
          d2 = a2.parentValue;
          a2.context._currentValue2 = d2 === Va$1 ? a2.context._defaultValue : d2;
          a2 = E$1 = a2.parent;
          b2.context = a2;
          return;
        case Ma$1:
          d2 = d2.children;
          d2 = d2(c2._currentValue2);
          X$1(a2, b2, d2);
          return;
        case Ra$1:
          f2 = c2._init;
          c2 = f2(c2._payload);
          d2 = Fb(c2, d2);
          Gb$1(
            a2,
            b2,
            c2,
            d2,
            void 0
          );
          return;
      }
    throw Error(l$2(130, null == c2 ? c2 : typeof c2, ""));
  }
}
function X$1(a2, b2, c2) {
  b2.node = c2;
  if ("object" === typeof c2 && null !== c2) {
    switch (c2.$$typeof) {
      case Ga$1:
        Gb$1(a2, b2, c2.type, c2.props, c2.ref);
        return;
      case Ha$1:
        throw Error(l$2(257));
      case Ra$1:
        var d2 = c2._init;
        c2 = d2(c2._payload);
        X$1(a2, b2, c2);
        return;
    }
    if (qa$1(c2)) {
      Ib$1(a2, b2, c2);
      return;
    }
    null === c2 || "object" !== typeof c2 ? d2 = null : (d2 = Wa$1 && c2[Wa$1] || c2["@@iterator"], d2 = "function" === typeof d2 ? d2 : null);
    if (d2 && (d2 = d2.call(c2))) {
      c2 = d2.next();
      if (!c2.done) {
        var f2 = [];
        do
          f2.push(c2.value), c2 = d2.next();
        while (!c2.done);
        Ib$1(a2, b2, f2);
      }
      return;
    }
    a2 = Object.prototype.toString.call(c2);
    throw Error(l$2(31, "[object Object]" === a2 ? "object with keys {" + Object.keys(c2).join(", ") + "}" : a2));
  }
  "string" === typeof c2 ? (d2 = b2.blockedSegment, d2.lastPushedText = Fa$1(b2.blockedSegment.chunks, c2, a2.responseState, d2.lastPushedText)) : "number" === typeof c2 && (d2 = b2.blockedSegment, d2.lastPushedText = Fa$1(b2.blockedSegment.chunks, "" + c2, a2.responseState, d2.lastPushedText));
}
function Ib$1(a2, b2, c2) {
  for (var d2 = c2.length, f2 = 0; f2 < d2; f2++) {
    var e2 = b2.treeContext;
    b2.treeContext = gb$1(e2, d2, f2);
    try {
      Hb$1(a2, b2, c2[f2]);
    } finally {
      b2.treeContext = e2;
    }
  }
}
function Hb$1(a2, b2, c2) {
  var d2 = b2.blockedSegment.formatContext, f2 = b2.legacyContext, e2 = b2.context;
  try {
    return X$1(a2, b2, c2);
  } catch (k2) {
    if (rb$1(), "object" === typeof k2 && null !== k2 && "function" === typeof k2.then) {
      c2 = k2;
      var g2 = b2.blockedSegment, h3 = U$1(a2, g2.chunks.length, null, g2.formatContext, g2.lastPushedText, true);
      g2.children.push(h3);
      g2.lastPushedText = false;
      a2 = Bb$1(a2, b2.node, b2.blockedBoundary, h3, b2.abortSet, b2.legacyContext, b2.context, b2.treeContext).ping;
      c2.then(a2, a2);
      b2.blockedSegment.formatContext = d2;
      b2.legacyContext = f2;
      b2.context = e2;
      G(e2);
    } else
      throw b2.blockedSegment.formatContext = d2, b2.legacyContext = f2, b2.context = e2, G(e2), k2;
  }
}
function Jb$1(a2) {
  var b2 = a2.blockedBoundary;
  a2 = a2.blockedSegment;
  a2.status = 3;
  Kb$1(this, b2, a2);
}
function Lb$1(a2, b2, c2) {
  var d2 = a2.blockedBoundary;
  a2.blockedSegment.status = 3;
  null === d2 ? (b2.allPendingTasks--, 2 !== b2.status && (b2.status = 2, null !== b2.destination && b2.destination.push(null))) : (d2.pendingTasks--, d2.forceClientRender || (d2.forceClientRender = true, a2 = void 0 === c2 ? Error(l$2(432)) : c2, d2.errorDigest = b2.onError(a2), d2.parentFlushed && b2.clientRenderedBoundaries.push(d2)), d2.fallbackAbortableTasks.forEach(function(a3) {
    return Lb$1(a3, b2, c2);
  }), d2.fallbackAbortableTasks.clear(), b2.allPendingTasks--, 0 === b2.allPendingTasks && (d2 = b2.onAllReady, d2()));
}
function Y$1(a2, b2) {
  if (0 === b2.chunks.length && 1 === b2.children.length && null === b2.children[0].boundary) {
    var c2 = b2.children[0];
    c2.id = b2.id;
    c2.parentFlushed = true;
    1 === c2.status && Y$1(a2, c2);
  } else
    a2.completedSegments.push(b2);
}
function Kb$1(a2, b2, c2) {
  if (null === b2) {
    if (c2.parentFlushed) {
      if (null !== a2.completedRootSegment)
        throw Error(l$2(389));
      a2.completedRootSegment = c2;
    }
    a2.pendingRootTasks--;
    0 === a2.pendingRootTasks && (a2.onShellError = T$1, b2 = a2.onShellReady, b2());
  } else
    b2.pendingTasks--, b2.forceClientRender || (0 === b2.pendingTasks ? (c2.parentFlushed && 1 === c2.status && Y$1(b2, c2), b2.parentFlushed && a2.completedBoundaries.push(b2), b2.fallbackAbortableTasks.forEach(Jb$1, a2), b2.fallbackAbortableTasks.clear()) : c2.parentFlushed && 1 === c2.status && (Y$1(b2, c2), 1 === b2.completedSegments.length && b2.parentFlushed && a2.partialBoundaries.push(b2)));
  a2.allPendingTasks--;
  0 === a2.allPendingTasks && (a2 = a2.onAllReady, a2());
}
function Cb$1(a2) {
  if (2 !== a2.status) {
    var b2 = E$1, c2 = yb$1.current;
    yb$1.current = xb$1;
    var d2 = S$1;
    S$1 = a2.responseState;
    try {
      var f2 = a2.pingedTasks, e2;
      for (e2 = 0; e2 < f2.length; e2++) {
        var g2 = f2[e2];
        var h3 = a2, k2 = g2.blockedSegment;
        if (0 === k2.status) {
          G(g2.context);
          try {
            X$1(h3, g2, g2.node), h3.responseState.generateStaticMarkup || k2.lastPushedText && k2.textEmbedded && k2.chunks.push("<!-- -->"), g2.abortSet.delete(g2), k2.status = 1, Kb$1(h3, g2.blockedBoundary, k2);
          } catch (z2) {
            if (rb$1(), "object" === typeof z2 && null !== z2 && "function" === typeof z2.then) {
              var m2 = g2.ping;
              z2.then(m2, m2);
            } else {
              g2.abortSet.delete(g2);
              k2.status = 4;
              var n2 = g2.blockedBoundary, q2 = z2, C2 = V$1(h3, q2);
              null === n2 ? W$1(h3, q2) : (n2.pendingTasks--, n2.forceClientRender || (n2.forceClientRender = true, n2.errorDigest = C2, n2.parentFlushed && h3.clientRenderedBoundaries.push(n2)));
              h3.allPendingTasks--;
              if (0 === h3.allPendingTasks) {
                var D2 = h3.onAllReady;
                D2();
              }
            }
          } finally {
          }
        }
      }
      f2.splice(0, e2);
      null !== a2.destination && Mb$1(a2, a2.destination);
    } catch (z2) {
      V$1(a2, z2), W$1(a2, z2);
    } finally {
      S$1 = d2, yb$1.current = c2, c2 === xb$1 && G(b2);
    }
  }
}
function Z$1(a2, b2, c2) {
  c2.parentFlushed = true;
  switch (c2.status) {
    case 0:
      var d2 = c2.id = a2.nextSegmentId++;
      c2.lastPushedText = false;
      c2.textEmbedded = false;
      a2 = a2.responseState;
      b2.push('<template id="');
      b2.push(a2.placeholderPrefix);
      a2 = d2.toString(16);
      b2.push(a2);
      return b2.push('"></template>');
    case 1:
      c2.status = 2;
      var f2 = true;
      d2 = c2.chunks;
      var e2 = 0;
      c2 = c2.children;
      for (var g2 = 0; g2 < c2.length; g2++) {
        for (f2 = c2[g2]; e2 < f2.index; e2++)
          b2.push(d2[e2]);
        f2 = Nb$1(a2, b2, f2);
      }
      for (; e2 < d2.length - 1; e2++)
        b2.push(d2[e2]);
      e2 < d2.length && (f2 = b2.push(d2[e2]));
      return f2;
    default:
      throw Error(l$2(390));
  }
}
function Nb$1(a2, b2, c2) {
  var d2 = c2.boundary;
  if (null === d2)
    return Z$1(a2, b2, c2);
  d2.parentFlushed = true;
  if (d2.forceClientRender)
    return a2.responseState.generateStaticMarkup || (d2 = d2.errorDigest, b2.push("<!--$!-->"), b2.push("<template"), d2 && (b2.push(' data-dgst="'), d2 = v(d2), b2.push(d2), b2.push('"')), b2.push("></template>")), Z$1(a2, b2, c2), a2 = a2.responseState.generateStaticMarkup ? true : b2.push("<!--/$-->"), a2;
  if (0 < d2.pendingTasks) {
    d2.rootSegmentID = a2.nextSegmentId++;
    0 < d2.completedSegments.length && a2.partialBoundaries.push(d2);
    var f2 = a2.responseState;
    var e2 = f2.nextSuspenseID++;
    f2 = f2.boundaryPrefix + e2.toString(16);
    d2 = d2.id = f2;
    za$1(b2, a2.responseState, d2);
    Z$1(a2, b2, c2);
    return b2.push("<!--/$-->");
  }
  if (d2.byteSize > a2.progressiveChunkSize)
    return d2.rootSegmentID = a2.nextSegmentId++, a2.completedBoundaries.push(d2), za$1(b2, a2.responseState, d2.id), Z$1(a2, b2, c2), b2.push("<!--/$-->");
  a2.responseState.generateStaticMarkup || b2.push("<!--$-->");
  c2 = d2.completedSegments;
  if (1 !== c2.length)
    throw Error(l$2(391));
  Nb$1(a2, b2, c2[0]);
  a2 = a2.responseState.generateStaticMarkup ? true : b2.push("<!--/$-->");
  return a2;
}
function Ob$1(a2, b2, c2) {
  Aa$1(b2, a2.responseState, c2.formatContext, c2.id);
  Nb$1(a2, b2, c2);
  return Ba$1(b2, c2.formatContext);
}
function Pb$1(a2, b2, c2) {
  for (var d2 = c2.completedSegments, f2 = 0; f2 < d2.length; f2++)
    Qb$1(a2, b2, c2, d2[f2]);
  d2.length = 0;
  a2 = a2.responseState;
  d2 = c2.id;
  c2 = c2.rootSegmentID;
  b2.push(a2.startInlineScript);
  a2.sentCompleteBoundaryFunction ? b2.push('$RC("') : (a2.sentCompleteBoundaryFunction = true, b2.push('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("'));
  if (null === d2)
    throw Error(l$2(395));
  c2 = c2.toString(16);
  b2.push(d2);
  b2.push('","');
  b2.push(a2.segmentPrefix);
  b2.push(c2);
  return b2.push('")<\/script>');
}
function Qb$1(a2, b2, c2, d2) {
  if (2 === d2.status)
    return true;
  var f2 = d2.id;
  if (-1 === f2) {
    if (-1 === (d2.id = c2.rootSegmentID))
      throw Error(l$2(392));
    return Ob$1(a2, b2, d2);
  }
  Ob$1(a2, b2, d2);
  a2 = a2.responseState;
  b2.push(a2.startInlineScript);
  a2.sentCompleteSegmentFunction ? b2.push('$RS("') : (a2.sentCompleteSegmentFunction = true, b2.push('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("'));
  b2.push(a2.segmentPrefix);
  f2 = f2.toString(16);
  b2.push(f2);
  b2.push('","');
  b2.push(a2.placeholderPrefix);
  b2.push(f2);
  return b2.push('")<\/script>');
}
function Mb$1(a2, b2) {
  try {
    var c2 = a2.completedRootSegment;
    if (null !== c2 && 0 === a2.pendingRootTasks) {
      Nb$1(a2, b2, c2);
      a2.completedRootSegment = null;
      var d2 = a2.responseState.bootstrapChunks;
      for (c2 = 0; c2 < d2.length - 1; c2++)
        b2.push(d2[c2]);
      c2 < d2.length && b2.push(d2[c2]);
    }
    var f2 = a2.clientRenderedBoundaries, e2;
    for (e2 = 0; e2 < f2.length; e2++) {
      var g2 = f2[e2];
      d2 = b2;
      var h3 = a2.responseState, k2 = g2.id, m2 = g2.errorDigest, n2 = g2.errorMessage, q2 = g2.errorComponentStack;
      d2.push(h3.startInlineScript);
      h3.sentClientRenderFunction ? d2.push('$RX("') : (h3.sentClientRenderFunction = true, d2.push('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("'));
      if (null === k2)
        throw Error(l$2(395));
      d2.push(k2);
      d2.push('"');
      if (m2 || n2 || q2) {
        d2.push(",");
        var C2 = Da$1(m2 || "");
        d2.push(C2);
      }
      if (n2 || q2) {
        d2.push(",");
        var D2 = Da$1(n2 || "");
        d2.push(D2);
      }
      if (q2) {
        d2.push(",");
        var z2 = Da$1(q2);
        d2.push(z2);
      }
      if (!d2.push(")<\/script>")) {
        a2.destination = null;
        e2++;
        f2.splice(0, e2);
        return;
      }
    }
    f2.splice(0, e2);
    var ba2 = a2.completedBoundaries;
    for (e2 = 0; e2 < ba2.length; e2++)
      if (!Pb$1(a2, b2, ba2[e2])) {
        a2.destination = null;
        e2++;
        ba2.splice(0, e2);
        return;
      }
    ba2.splice(0, e2);
    var ca2 = a2.partialBoundaries;
    for (e2 = 0; e2 < ca2.length; e2++) {
      var mb2 = ca2[e2];
      a: {
        f2 = a2;
        g2 = b2;
        var da2 = mb2.completedSegments;
        for (h3 = 0; h3 < da2.length; h3++)
          if (!Qb$1(f2, g2, mb2, da2[h3])) {
            h3++;
            da2.splice(0, h3);
            var nb2 = false;
            break a;
          }
        da2.splice(0, h3);
        nb2 = true;
      }
      if (!nb2) {
        a2.destination = null;
        e2++;
        ca2.splice(0, e2);
        return;
      }
    }
    ca2.splice(0, e2);
    var ea2 = a2.completedBoundaries;
    for (e2 = 0; e2 < ea2.length; e2++)
      if (!Pb$1(a2, b2, ea2[e2])) {
        a2.destination = null;
        e2++;
        ea2.splice(0, e2);
        return;
      }
    ea2.splice(0, e2);
  } finally {
    0 === a2.allPendingTasks && 0 === a2.pingedTasks.length && 0 === a2.clientRenderedBoundaries.length && 0 === a2.completedBoundaries.length && b2.push(null);
  }
}
function Rb$1(a2, b2) {
  try {
    var c2 = a2.abortableTasks;
    c2.forEach(function(c3) {
      return Lb$1(c3, a2, b2);
    });
    c2.clear();
    null !== a2.destination && Mb$1(a2, a2.destination);
  } catch (d2) {
    V$1(a2, d2), W$1(a2, d2);
  }
}
function Sb$1() {
}
function Tb$1(a2, b2, c2, d2) {
  var f2 = false, e2 = null, g2 = "", h3 = { push: function(a3) {
    null !== a3 && (g2 += a3);
    return true;
  }, destroy: function(a3) {
    f2 = true;
    e2 = a3;
  } }, k2 = false;
  a2 = Ab$1(a2, Ea$1(c2, b2 ? b2.identifierPrefix : void 0), { insertionMode: 1, selectedValue: null }, Infinity, Sb$1, void 0, function() {
    k2 = true;
  });
  Cb$1(a2);
  Rb$1(a2, d2);
  if (1 === a2.status)
    a2.status = 2, h3.destroy(a2.fatalError);
  else if (2 !== a2.status && null === a2.destination) {
    a2.destination = h3;
    try {
      Mb$1(a2, h3);
    } catch (m2) {
      V$1(a2, m2), W$1(a2, m2);
    }
  }
  if (f2)
    throw e2;
  if (!k2)
    throw Error(l$2(426));
  return g2;
}
reactDomServerLegacy_browser_production_min.renderToNodeStream = function() {
  throw Error(l$2(207));
};
reactDomServerLegacy_browser_production_min.renderToStaticMarkup = function(a2, b2) {
  return Tb$1(a2, b2, true, 'The server used "renderToStaticMarkup" which does not support Suspense. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server');
};
reactDomServerLegacy_browser_production_min.renderToStaticNodeStream = function() {
  throw Error(l$2(208));
};
reactDomServerLegacy_browser_production_min.renderToString = function(a2, b2) {
  return Tb$1(a2, b2, false, 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server');
};
reactDomServerLegacy_browser_production_min.version = "18.3.1";
var reactDomServer_browser_production_min = {};
/**
 * @license React
 * react-dom-server.browser.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 = reactExports;
function k(a2) {
  for (var b2 = "https://reactjs.org/docs/error-decoder.html?invariant=" + a2, c2 = 1; c2 < arguments.length; c2++)
    b2 += "&args[]=" + encodeURIComponent(arguments[c2]);
  return "Minified React error #" + a2 + "; visit " + b2 + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";
}
var l$1 = null, n = 0;
function p(a2, b2) {
  if (0 !== b2.length)
    if (512 < b2.length)
      0 < n && (a2.enqueue(new Uint8Array(l$1.buffer, 0, n)), l$1 = new Uint8Array(512), n = 0), a2.enqueue(b2);
    else {
      var c2 = l$1.length - n;
      c2 < b2.length && (0 === c2 ? a2.enqueue(l$1) : (l$1.set(b2.subarray(0, c2), n), a2.enqueue(l$1), b2 = b2.subarray(c2)), l$1 = new Uint8Array(512), n = 0);
      l$1.set(b2, n);
      n += b2.length;
    }
}
function t(a2, b2) {
  p(a2, b2);
  return true;
}
function ba(a2) {
  l$1 && 0 < n && (a2.enqueue(new Uint8Array(l$1.buffer, 0, n)), l$1 = null, n = 0);
}
var ca = new TextEncoder();
function u(a2) {
  return ca.encode(a2);
}
function w(a2) {
  return ca.encode(a2);
}
function da(a2, b2) {
  "function" === typeof a2.error ? a2.error(b2) : a2.close();
}
var x = Object.prototype.hasOwnProperty, ea = /^[: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]*$/, fa = {}, ha = {};
function ia(a2) {
  if (x.call(ha, a2))
    return true;
  if (x.call(fa, a2))
    return false;
  if (ea.test(a2))
    return ha[a2] = true;
  fa[a2] = true;
  return false;
}
function y(a2, b2, c2, d2, f2, e2, g2) {
  this.acceptsBooleans = 2 === b2 || 3 === b2 || 4 === b2;
  this.attributeName = d2;
  this.attributeNamespace = f2;
  this.mustUseProperty = c2;
  this.propertyName = a2;
  this.type = b2;
  this.sanitizeURL = e2;
  this.removeEmptyString = g2;
}
var z = {};
"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a2) {
  z[a2] = new y(a2, 0, false, a2, null, false, false);
});
[["acceptCharset", "accept-charset"], ["className", "class"], ["htmlFor", "for"], ["httpEquiv", "http-equiv"]].forEach(function(a2) {
  var b2 = a2[0];
  z[b2] = new y(b2, 1, false, a2[1], null, false, false);
});
["contentEditable", "draggable", "spellCheck", "value"].forEach(function(a2) {
  z[a2] = new y(a2, 2, false, a2.toLowerCase(), null, false, false);
});
["autoReverse", "externalResourcesRequired", "focusable", "preserveAlpha"].forEach(function(a2) {
  z[a2] = new y(a2, 2, false, a2, null, false, false);
});
"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(a2) {
  z[a2] = new y(a2, 3, false, a2.toLowerCase(), null, false, false);
});
["checked", "multiple", "muted", "selected"].forEach(function(a2) {
  z[a2] = new y(a2, 3, true, a2, null, false, false);
});
["capture", "download"].forEach(function(a2) {
  z[a2] = new y(a2, 4, false, a2, null, false, false);
});
["cols", "rows", "size", "span"].forEach(function(a2) {
  z[a2] = new y(a2, 6, false, a2, null, false, false);
});
["rowSpan", "start"].forEach(function(a2) {
  z[a2] = new y(a2, 5, false, a2.toLowerCase(), null, false, false);
});
var ja = /[\-:]([a-z])/g;
function ka(a2) {
  return a2[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(a2) {
  var b2 = a2.replace(
    ja,
    ka
  );
  z[b2] = new y(b2, 1, false, a2, null, false, false);
});
"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a2) {
  var b2 = a2.replace(ja, ka);
  z[b2] = new y(b2, 1, false, a2, "http://www.w3.org/1999/xlink", false, false);
});
["xml:base", "xml:lang", "xml:space"].forEach(function(a2) {
  var b2 = a2.replace(ja, ka);
  z[b2] = new y(b2, 1, false, a2, "http://www.w3.org/XML/1998/namespace", false, false);
});
["tabIndex", "crossOrigin"].forEach(function(a2) {
  z[a2] = new y(a2, 1, false, a2.toLowerCase(), null, false, false);
});
z.xlinkHref = new y("xlinkHref", 1, false, "xlink:href", "http://www.w3.org/1999/xlink", true, false);
["src", "href", "action", "formAction"].forEach(function(a2) {
  z[a2] = new y(a2, 1, false, a2.toLowerCase(), null, true, true);
});
var B = {
  animationIterationCount: true,
  aspectRatio: true,
  borderImageOutset: true,
  borderImageSlice: true,
  borderImageWidth: true,
  boxFlex: true,
  boxFlexGroup: true,
  boxOrdinalGroup: true,
  columnCount: true,
  columns: true,
  flex: true,
  flexGrow: true,
  flexPositive: true,
  flexShrink: true,
  flexNegative: true,
  flexOrder: true,
  gridArea: true,
  gridRow: true,
  gridRowEnd: true,
  gridRowSpan: true,
  gridRowStart: true,
  gridColumn: true,
  gridColumnEnd: true,
  gridColumnSpan: true,
  gridColumnStart: true,
  fontWeight: true,
  lineClamp: true,
  lineHeight: true,
  opacity: true,
  order: true,
  orphans: true,
  tabSize: true,
  widows: true,
  zIndex: true,
  zoom: true,
  fillOpacity: true,
  floodOpacity: true,
  stopOpacity: true,
  strokeDasharray: true,
  strokeDashoffset: true,
  strokeMiterlimit: true,
  strokeOpacity: true,
  strokeWidth: true
}, la = ["Webkit", "ms", "Moz", "O"];
Object.keys(B).forEach(function(a2) {
  la.forEach(function(b2) {
    b2 = b2 + a2.charAt(0).toUpperCase() + a2.substring(1);
    B[b2] = B[a2];
  });
});
var oa = /["'&<>]/;
function C(a2) {
  if ("boolean" === typeof a2 || "number" === typeof a2)
    return "" + a2;
  a2 = "" + a2;
  var b2 = oa.exec(a2);
  if (b2) {
    var c2 = "", d2, f2 = 0;
    for (d2 = b2.index; d2 < a2.length; d2++) {
      switch (a2.charCodeAt(d2)) {
        case 34:
          b2 = "&quot;";
          break;
        case 38:
          b2 = "&amp;";
          break;
        case 39:
          b2 = "&#x27;";
          break;
        case 60:
          b2 = "&lt;";
          break;
        case 62:
          b2 = "&gt;";
          break;
        default:
          continue;
      }
      f2 !== d2 && (c2 += a2.substring(f2, d2));
      f2 = d2 + 1;
      c2 += b2;
    }
    a2 = f2 !== d2 ? c2 + a2.substring(f2, d2) : c2;
  }
  return a2;
}
var pa = /([A-Z])/g, qa = /^ms-/, ra = Array.isArray, sa = w("<script>"), ta = w("<\/script>"), ua = w('<script src="'), va = w('<script type="module" src="'), wa = w('" async=""><\/script>'), xa = /(<\/|<)(s)(cript)/gi;
function ya(a2, b2, c2, d2) {
  return "" + b2 + ("s" === c2 ? "\\u0073" : "\\u0053") + d2;
}
function za(a2, b2, c2, d2, f2) {
  a2 = void 0 === a2 ? "" : a2;
  b2 = void 0 === b2 ? sa : w('<script nonce="' + C(b2) + '">');
  var e2 = [];
  void 0 !== c2 && e2.push(b2, u(("" + c2).replace(xa, ya)), ta);
  if (void 0 !== d2)
    for (c2 = 0; c2 < d2.length; c2++)
      e2.push(ua, u(C(d2[c2])), wa);
  if (void 0 !== f2)
    for (d2 = 0; d2 < f2.length; d2++)
      e2.push(va, u(C(f2[d2])), wa);
  return { bootstrapChunks: e2, startInlineScript: b2, placeholderPrefix: w(a2 + "P:"), segmentPrefix: w(a2 + "S:"), boundaryPrefix: a2 + "B:", idPrefix: a2, nextSuspenseID: 0, sentCompleteSegmentFunction: false, sentCompleteBoundaryFunction: false, sentClientRenderFunction: false };
}
function D(a2, b2) {
  return { insertionMode: a2, selectedValue: b2 };
}
function Aa(a2) {
  return D("http://www.w3.org/2000/svg" === a2 ? 2 : "http://www.w3.org/1998/Math/MathML" === a2 ? 3 : 0, null);
}
function Ba(a2, b2, c2) {
  switch (b2) {
    case "select":
      return D(1, null != c2.value ? c2.value : c2.defaultValue);
    case "svg":
      return D(2, null);
    case "math":
      return D(3, null);
    case "foreignObject":
      return D(1, null);
    case "table":
      return D(4, null);
    case "thead":
    case "tbody":
    case "tfoot":
      return D(5, null);
    case "colgroup":
      return D(7, null);
    case "tr":
      return D(6, null);
  }
  return 4 <= a2.insertionMode || 0 === a2.insertionMode ? D(1, null) : a2;
}
var Ca = w("<!-- -->");
function Da(a2, b2, c2, d2) {
  if ("" === b2)
    return d2;
  d2 && a2.push(Ca);
  a2.push(u(C(b2)));
  return true;
}
var Ea = /* @__PURE__ */ new Map(), Fa = w(' style="'), Ga = w(":"), Ha = w(";");
function Ia(a2, b2, c2) {
  if ("object" !== typeof c2)
    throw Error(k(62));
  b2 = true;
  for (var d2 in c2)
    if (x.call(c2, d2)) {
      var f2 = c2[d2];
      if (null != f2 && "boolean" !== typeof f2 && "" !== f2) {
        if (0 === d2.indexOf("--")) {
          var e2 = u(C(d2));
          f2 = u(C(("" + f2).trim()));
        } else {
          e2 = d2;
          var g2 = Ea.get(e2);
          void 0 !== g2 ? e2 = g2 : (g2 = w(C(e2.replace(pa, "-$1").toLowerCase().replace(qa, "-ms-"))), Ea.set(e2, g2), e2 = g2);
          f2 = "number" === typeof f2 ? 0 === f2 || x.call(B, d2) ? u("" + f2) : u(f2 + "px") : u(C(("" + f2).trim()));
        }
        b2 ? (b2 = false, a2.push(Fa, e2, Ga, f2)) : a2.push(Ha, e2, Ga, f2);
      }
    }
  b2 || a2.push(E);
}
var H = w(" "), I = w('="'), E = w('"'), Ja = w('=""');
function J(a2, b2, c2, d2) {
  switch (c2) {
    case "style":
      Ia(a2, b2, d2);
      return;
    case "defaultValue":
    case "defaultChecked":
    case "innerHTML":
    case "suppressContentEditableWarning":
    case "suppressHydrationWarning":
      return;
  }
  if (!(2 < c2.length) || "o" !== c2[0] && "O" !== c2[0] || "n" !== c2[1] && "N" !== c2[1]) {
    if (b2 = z.hasOwnProperty(c2) ? z[c2] : null, null !== b2) {
      switch (typeof d2) {
        case "function":
        case "symbol":
          return;
        case "boolean":
          if (!b2.acceptsBooleans)
            return;
      }
      c2 = u(b2.attributeName);
      switch (b2.type) {
        case 3:
          d2 && a2.push(H, c2, Ja);
          break;
        case 4:
          true === d2 ? a2.push(H, c2, Ja) : false !== d2 && a2.push(H, c2, I, u(C(d2)), E);
          break;
        case 5:
          isNaN(d2) || a2.push(H, c2, I, u(C(d2)), E);
          break;
        case 6:
          !isNaN(d2) && 1 <= d2 && a2.push(H, c2, I, u(C(d2)), E);
          break;
        default:
          b2.sanitizeURL && (d2 = "" + d2), a2.push(H, c2, I, u(C(d2)), E);
      }
    } else if (ia(c2)) {
      switch (typeof d2) {
        case "function":
        case "symbol":
          return;
        case "boolean":
          if (b2 = c2.toLowerCase().slice(0, 5), "data-" !== b2 && "aria-" !== b2)
            return;
      }
      a2.push(H, u(c2), I, u(C(d2)), E);
    }
  }
}
var K = w(">"), Ka = w("/>");
function L(a2, b2, c2) {
  if (null != b2) {
    if (null != c2)
      throw Error(k(60));
    if ("object" !== typeof b2 || !("__html" in b2))
      throw Error(k(61));
    b2 = b2.__html;
    null !== b2 && void 0 !== b2 && a2.push(u("" + b2));
  }
}
function La(a2) {
  var b2 = "";
  aa.Children.forEach(a2, function(a3) {
    null != a3 && (b2 += a3);
  });
  return b2;
}
var Ma = w(' selected=""');
function Na(a2, b2, c2, d2) {
  a2.push(M(c2));
  var f2 = c2 = null, e2;
  for (e2 in b2)
    if (x.call(b2, e2)) {
      var g2 = b2[e2];
      if (null != g2)
        switch (e2) {
          case "children":
            c2 = g2;
            break;
          case "dangerouslySetInnerHTML":
            f2 = g2;
            break;
          default:
            J(a2, d2, e2, g2);
        }
    }
  a2.push(K);
  L(a2, f2, c2);
  return "string" === typeof c2 ? (a2.push(u(C(c2))), null) : c2;
}
var Oa = w("\n"), Pa = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/, Qa = /* @__PURE__ */ new Map();
function M(a2) {
  var b2 = Qa.get(a2);
  if (void 0 === b2) {
    if (!Pa.test(a2))
      throw Error(k(65, a2));
    b2 = w("<" + a2);
    Qa.set(a2, b2);
  }
  return b2;
}
var Ra = w("<!DOCTYPE html>");
function Sa(a2, b2, c2, d2, f2) {
  switch (b2) {
    case "select":
      a2.push(M("select"));
      var e2 = null, g2 = null;
      for (r2 in c2)
        if (x.call(c2, r2)) {
          var h3 = c2[r2];
          if (null != h3)
            switch (r2) {
              case "children":
                e2 = h3;
                break;
              case "dangerouslySetInnerHTML":
                g2 = h3;
                break;
              case "defaultValue":
              case "value":
                break;
              default:
                J(a2, d2, r2, h3);
            }
        }
      a2.push(K);
      L(a2, g2, e2);
      return e2;
    case "option":
      g2 = f2.selectedValue;
      a2.push(M("option"));
      var m2 = h3 = null, q2 = null;
      var r2 = null;
      for (e2 in c2)
        if (x.call(c2, e2)) {
          var v2 = c2[e2];
          if (null != v2)
            switch (e2) {
              case "children":
                h3 = v2;
                break;
              case "selected":
                q2 = v2;
                break;
              case "dangerouslySetInnerHTML":
                r2 = v2;
                break;
              case "value":
                m2 = v2;
              default:
                J(a2, d2, e2, v2);
            }
        }
      if (null != g2)
        if (c2 = null !== m2 ? "" + m2 : La(h3), ra(g2))
          for (d2 = 0; d2 < g2.length; d2++) {
            if ("" + g2[d2] === c2) {
              a2.push(Ma);
              break;
            }
          }
        else
          "" + g2 === c2 && a2.push(Ma);
      else
        q2 && a2.push(Ma);
      a2.push(K);
      L(a2, r2, h3);
      return h3;
    case "textarea":
      a2.push(M("textarea"));
      r2 = g2 = e2 = null;
      for (h3 in c2)
        if (x.call(c2, h3) && (m2 = c2[h3], null != m2))
          switch (h3) {
            case "children":
              r2 = m2;
              break;
            case "value":
              e2 = m2;
              break;
            case "defaultValue":
              g2 = m2;
              break;
            case "dangerouslySetInnerHTML":
              throw Error(k(91));
            default:
              J(a2, d2, h3, m2);
          }
      null === e2 && null !== g2 && (e2 = g2);
      a2.push(K);
      if (null != r2) {
        if (null != e2)
          throw Error(k(92));
        if (ra(r2) && 1 < r2.length)
          throw Error(k(93));
        e2 = "" + r2;
      }
      "string" === typeof e2 && "\n" === e2[0] && a2.push(Oa);
      null !== e2 && a2.push(u(C("" + e2)));
      return null;
    case "input":
      a2.push(M("input"));
      m2 = r2 = h3 = e2 = null;
      for (g2 in c2)
        if (x.call(c2, g2) && (q2 = c2[g2], null != q2))
          switch (g2) {
            case "children":
            case "dangerouslySetInnerHTML":
              throw Error(k(399, "input"));
            case "defaultChecked":
              m2 = q2;
              break;
            case "defaultValue":
              h3 = q2;
              break;
            case "checked":
              r2 = q2;
              break;
            case "value":
              e2 = q2;
              break;
            default:
              J(a2, d2, g2, q2);
          }
      null !== r2 ? J(
        a2,
        d2,
        "checked",
        r2
      ) : null !== m2 && J(a2, d2, "checked", m2);
      null !== e2 ? J(a2, d2, "value", e2) : null !== h3 && J(a2, d2, "value", h3);
      a2.push(Ka);
      return null;
    case "menuitem":
      a2.push(M("menuitem"));
      for (var A2 in c2)
        if (x.call(c2, A2) && (e2 = c2[A2], null != e2))
          switch (A2) {
            case "children":
            case "dangerouslySetInnerHTML":
              throw Error(k(400));
            default:
              J(a2, d2, A2, e2);
          }
      a2.push(K);
      return null;
    case "title":
      a2.push(M("title"));
      e2 = null;
      for (v2 in c2)
        if (x.call(c2, v2) && (g2 = c2[v2], null != g2))
          switch (v2) {
            case "children":
              e2 = g2;
              break;
            case "dangerouslySetInnerHTML":
              throw Error(k(434));
            default:
              J(a2, d2, v2, g2);
          }
      a2.push(K);
      return e2;
    case "listing":
    case "pre":
      a2.push(M(b2));
      g2 = e2 = null;
      for (m2 in c2)
        if (x.call(c2, m2) && (h3 = c2[m2], null != h3))
          switch (m2) {
            case "children":
              e2 = h3;
              break;
            case "dangerouslySetInnerHTML":
              g2 = h3;
              break;
            default:
              J(a2, d2, m2, h3);
          }
      a2.push(K);
      if (null != g2) {
        if (null != e2)
          throw Error(k(60));
        if ("object" !== typeof g2 || !("__html" in g2))
          throw Error(k(61));
        c2 = g2.__html;
        null !== c2 && void 0 !== c2 && ("string" === typeof c2 && 0 < c2.length && "\n" === c2[0] ? a2.push(Oa, u(c2)) : a2.push(u("" + c2)));
      }
      "string" === typeof e2 && "\n" === e2[0] && a2.push(Oa);
      return e2;
    case "area":
    case "base":
    case "br":
    case "col":
    case "embed":
    case "hr":
    case "img":
    case "keygen":
    case "link":
    case "meta":
    case "param":
    case "source":
    case "track":
    case "wbr":
      a2.push(M(b2));
      for (var F2 in c2)
        if (x.call(c2, F2) && (e2 = c2[F2], null != e2))
          switch (F2) {
            case "children":
            case "dangerouslySetInnerHTML":
              throw Error(k(399, b2));
            default:
              J(a2, d2, F2, e2);
          }
      a2.push(Ka);
      return null;
    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 Na(a2, c2, b2, d2);
    case "html":
      return 0 === f2.insertionMode && a2.push(Ra), Na(a2, c2, b2, d2);
    default:
      if (-1 === b2.indexOf("-") && "string" !== typeof c2.is)
        return Na(a2, c2, b2, d2);
      a2.push(M(b2));
      g2 = e2 = null;
      for (q2 in c2)
        if (x.call(c2, q2) && (h3 = c2[q2], null != h3))
          switch (q2) {
            case "children":
              e2 = h3;
              break;
            case "dangerouslySetInnerHTML":
              g2 = h3;
              break;
            case "style":
              Ia(a2, d2, h3);
              break;
            case "suppressContentEditableWarning":
            case "suppressHydrationWarning":
              break;
            default:
              ia(q2) && "function" !== typeof h3 && "symbol" !== typeof h3 && a2.push(H, u(q2), I, u(C(h3)), E);
          }
      a2.push(K);
      L(a2, g2, e2);
      return e2;
  }
}
var Ta = w("</"), Ua = w(">"), Va = w('<template id="'), Wa = w('"></template>'), Xa = w("<!--$-->"), Ya = w('<!--$?--><template id="'), Za = w('"></template>'), $a = w("<!--$!-->"), ab = w("<!--/$-->"), bb = w("<template"), cb = w('"'), db = w(' data-dgst="');
w(' data-msg="');
w(' data-stck="');
var eb = w("></template>");
function fb(a2, b2, c2) {
  p(a2, Ya);
  if (null === c2)
    throw Error(k(395));
  p(a2, c2);
  return t(a2, Za);
}
var gb = w('<div hidden id="'), hb = w('">'), ib = w("</div>"), jb = w('<svg aria-hidden="true" style="display:none" id="'), kb = w('">'), lb = w("</svg>"), mb = w('<math aria-hidden="true" style="display:none" id="'), nb = w('">'), ob = w("</math>"), pb = w('<table hidden id="'), qb = w('">'), rb = w("</table>"), sb = w('<table hidden><tbody id="'), tb = w('">'), ub = w("</tbody></table>"), vb = w('<table hidden><tr id="'), wb = w('">'), xb = w("</tr></table>"), yb = w('<table hidden><colgroup id="'), zb = w('">'), Ab = w("</colgroup></table>");
function Bb(a2, b2, c2, d2) {
  switch (c2.insertionMode) {
    case 0:
    case 1:
      return p(a2, gb), p(a2, b2.segmentPrefix), p(a2, u(d2.toString(16))), t(a2, hb);
    case 2:
      return p(a2, jb), p(a2, b2.segmentPrefix), p(a2, u(d2.toString(16))), t(a2, kb);
    case 3:
      return p(a2, mb), p(a2, b2.segmentPrefix), p(a2, u(d2.toString(16))), t(a2, nb);
    case 4:
      return p(a2, pb), p(a2, b2.segmentPrefix), p(a2, u(d2.toString(16))), t(a2, qb);
    case 5:
      return p(a2, sb), p(a2, b2.segmentPrefix), p(a2, u(d2.toString(16))), t(a2, tb);
    case 6:
      return p(a2, vb), p(a2, b2.segmentPrefix), p(a2, u(d2.toString(16))), t(a2, wb);
    case 7:
      return p(
        a2,
        yb
      ), p(a2, b2.segmentPrefix), p(a2, u(d2.toString(16))), t(a2, zb);
    default:
      throw Error(k(397));
  }
}
function Cb(a2, b2) {
  switch (b2.insertionMode) {
    case 0:
    case 1:
      return t(a2, ib);
    case 2:
      return t(a2, lb);
    case 3:
      return t(a2, ob);
    case 4:
      return t(a2, rb);
    case 5:
      return t(a2, ub);
    case 6:
      return t(a2, xb);
    case 7:
      return t(a2, Ab);
    default:
      throw Error(k(397));
  }
}
var Db = w('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("'), Eb = w('$RS("'), Gb = w('","'), Hb = w('")<\/script>'), Ib = w('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("'), Jb = w('$RC("'), Kb = w('","'), Lb = w('")<\/script>'), Mb = w('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("'), Nb = w('$RX("'), Ob = w('"'), Pb = w(")<\/script>"), Qb = w(","), Rb = /[<\u2028\u2029]/g;
function Sb(a2) {
  return JSON.stringify(a2).replace(Rb, function(a3) {
    switch (a3) {
      case "<":
        return "\\u003c";
      case "\u2028":
        return "\\u2028";
      case "\u2029":
        return "\\u2029";
      default:
        throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no longer in sync. This is a bug in React");
    }
  });
}
var N = Object.assign, Tb = Symbol.for("react.element"), Ub = Symbol.for("react.portal"), Vb = Symbol.for("react.fragment"), Wb = Symbol.for("react.strict_mode"), Xb = Symbol.for("react.profiler"), Yb = Symbol.for("react.provider"), Zb = Symbol.for("react.context"), $b = Symbol.for("react.forward_ref"), ac = Symbol.for("react.suspense"), bc = Symbol.for("react.suspense_list"), cc = Symbol.for("react.memo"), dc = Symbol.for("react.lazy"), ec = Symbol.for("react.scope"), fc = Symbol.for("react.debug_trace_mode"), gc = Symbol.for("react.legacy_hidden"), hc = Symbol.for("react.default_value"), ic = Symbol.iterator;
function jc(a2) {
  if (null == a2)
    return null;
  if ("function" === typeof a2)
    return a2.displayName || a2.name || null;
  if ("string" === typeof a2)
    return a2;
  switch (a2) {
    case Vb:
      return "Fragment";
    case Ub:
      return "Portal";
    case Xb:
      return "Profiler";
    case Wb:
      return "StrictMode";
    case ac:
      return "Suspense";
    case bc:
      return "SuspenseList";
  }
  if ("object" === typeof a2)
    switch (a2.$$typeof) {
      case Zb:
        return (a2.displayName || "Context") + ".Consumer";
      case Yb:
        return (a2._context.displayName || "Context") + ".Provider";
      case $b:
        var b2 = a2.render;
        a2 = a2.displayName;
        a2 || (a2 = b2.displayName || b2.name || "", a2 = "" !== a2 ? "ForwardRef(" + a2 + ")" : "ForwardRef");
        return a2;
      case cc:
        return b2 = a2.displayName || null, null !== b2 ? b2 : jc(a2.type) || "Memo";
      case dc:
        b2 = a2._payload;
        a2 = a2._init;
        try {
          return jc(a2(b2));
        } catch (c2) {
        }
    }
  return null;
}
var kc = {};
function lc(a2, b2) {
  a2 = a2.contextTypes;
  if (!a2)
    return kc;
  var c2 = {}, d2;
  for (d2 in a2)
    c2[d2] = b2[d2];
  return c2;
}
var O = null;
function P(a2, b2) {
  if (a2 !== b2) {
    a2.context._currentValue = a2.parentValue;
    a2 = a2.parent;
    var c2 = b2.parent;
    if (null === a2) {
      if (null !== c2)
        throw Error(k(401));
    } else {
      if (null === c2)
        throw Error(k(401));
      P(a2, c2);
    }
    b2.context._currentValue = b2.value;
  }
}
function mc(a2) {
  a2.context._currentValue = a2.parentValue;
  a2 = a2.parent;
  null !== a2 && mc(a2);
}
function nc(a2) {
  var b2 = a2.parent;
  null !== b2 && nc(b2);
  a2.context._currentValue = a2.value;
}
function oc(a2, b2) {
  a2.context._currentValue = a2.parentValue;
  a2 = a2.parent;
  if (null === a2)
    throw Error(k(402));
  a2.depth === b2.depth ? P(a2, b2) : oc(a2, b2);
}
function pc(a2, b2) {
  var c2 = b2.parent;
  if (null === c2)
    throw Error(k(402));
  a2.depth === c2.depth ? P(a2, c2) : pc(a2, c2);
  b2.context._currentValue = b2.value;
}
function Q(a2) {
  var b2 = O;
  b2 !== a2 && (null === b2 ? nc(a2) : null === a2 ? mc(b2) : b2.depth === a2.depth ? P(b2, a2) : b2.depth > a2.depth ? oc(b2, a2) : pc(b2, a2), O = a2);
}
var qc = { isMounted: function() {
  return false;
}, enqueueSetState: function(a2, b2) {
  a2 = a2._reactInternals;
  null !== a2.queue && a2.queue.push(b2);
}, enqueueReplaceState: function(a2, b2) {
  a2 = a2._reactInternals;
  a2.replace = true;
  a2.queue = [b2];
}, enqueueForceUpdate: function() {
} };
function rc(a2, b2, c2, d2) {
  var f2 = void 0 !== a2.state ? a2.state : null;
  a2.updater = qc;
  a2.props = c2;
  a2.state = f2;
  var e2 = { queue: [], replace: false };
  a2._reactInternals = e2;
  var g2 = b2.contextType;
  a2.context = "object" === typeof g2 && null !== g2 ? g2._currentValue : d2;
  g2 = b2.getDerivedStateFromProps;
  "function" === typeof g2 && (g2 = g2(c2, f2), f2 = null === g2 || void 0 === g2 ? f2 : N({}, f2, g2), a2.state = f2);
  if ("function" !== typeof b2.getDerivedStateFromProps && "function" !== typeof a2.getSnapshotBeforeUpdate && ("function" === typeof a2.UNSAFE_componentWillMount || "function" === typeof a2.componentWillMount))
    if (b2 = a2.state, "function" === typeof a2.componentWillMount && a2.componentWillMount(), "function" === typeof a2.UNSAFE_componentWillMount && a2.UNSAFE_componentWillMount(), b2 !== a2.state && qc.enqueueReplaceState(a2, a2.state, null), null !== e2.queue && 0 < e2.queue.length)
      if (b2 = e2.queue, g2 = e2.replace, e2.queue = null, e2.replace = false, g2 && 1 === b2.length)
        a2.state = b2[0];
      else {
        e2 = g2 ? b2[0] : a2.state;
        f2 = true;
        for (g2 = g2 ? 1 : 0; g2 < b2.length; g2++) {
          var h3 = b2[g2];
          h3 = "function" === typeof h3 ? h3.call(a2, e2, c2, d2) : h3;
          null != h3 && (f2 ? (f2 = false, e2 = N({}, e2, h3)) : N(e2, h3));
        }
        a2.state = e2;
      }
    else
      e2.queue = null;
}
var sc = { id: 1, overflow: "" };
function tc(a2, b2, c2) {
  var d2 = a2.id;
  a2 = a2.overflow;
  var f2 = 32 - uc(d2) - 1;
  d2 &= ~(1 << f2);
  c2 += 1;
  var e2 = 32 - uc(b2) + f2;
  if (30 < e2) {
    var g2 = f2 - f2 % 5;
    e2 = (d2 & (1 << g2) - 1).toString(32);
    d2 >>= g2;
    f2 -= g2;
    return { id: 1 << 32 - uc(b2) + f2 | c2 << f2 | d2, overflow: e2 + a2 };
  }
  return { id: 1 << e2 | c2 << f2 | d2, overflow: a2 };
}
var uc = Math.clz32 ? Math.clz32 : vc, wc = Math.log, xc = Math.LN2;
function vc(a2) {
  a2 >>>= 0;
  return 0 === a2 ? 32 : 31 - (wc(a2) / xc | 0) | 0;
}
function yc(a2, b2) {
  return a2 === b2 && (0 !== a2 || 1 / a2 === 1 / b2) || a2 !== a2 && b2 !== b2;
}
var zc = "function" === typeof Object.is ? Object.is : yc, R = null, Ac = null, Bc = null, S = null, T = false, Cc = false, U = 0, V = null, Dc = 0;
function W() {
  if (null === R)
    throw Error(k(321));
  return R;
}
function Ec() {
  if (0 < Dc)
    throw Error(k(312));
  return { memoizedState: null, queue: null, next: null };
}
function Fc() {
  null === S ? null === Bc ? (T = false, Bc = S = Ec()) : (T = true, S = Bc) : null === S.next ? (T = false, S = S.next = Ec()) : (T = true, S = S.next);
  return S;
}
function Gc() {
  Ac = R = null;
  Cc = false;
  Bc = null;
  Dc = 0;
  S = V = null;
}
function Hc(a2, b2) {
  return "function" === typeof b2 ? b2(a2) : b2;
}
function Ic(a2, b2, c2) {
  R = W();
  S = Fc();
  if (T) {
    var d2 = S.queue;
    b2 = d2.dispatch;
    if (null !== V && (c2 = V.get(d2), void 0 !== c2)) {
      V.delete(d2);
      d2 = S.memoizedState;
      do
        d2 = a2(d2, c2.action), c2 = c2.next;
      while (null !== c2);
      S.memoizedState = d2;
      return [d2, b2];
    }
    return [S.memoizedState, b2];
  }
  a2 = a2 === Hc ? "function" === typeof b2 ? b2() : b2 : void 0 !== c2 ? c2(b2) : b2;
  S.memoizedState = a2;
  a2 = S.queue = { last: null, dispatch: null };
  a2 = a2.dispatch = Jc.bind(null, R, a2);
  return [S.memoizedState, a2];
}
function Kc(a2, b2) {
  R = W();
  S = Fc();
  b2 = void 0 === b2 ? null : b2;
  if (null !== S) {
    var c2 = S.memoizedState;
    if (null !== c2 && null !== b2) {
      var d2 = c2[1];
      a:
        if (null === d2)
          d2 = false;
        else {
          for (var f2 = 0; f2 < d2.length && f2 < b2.length; f2++)
            if (!zc(b2[f2], d2[f2])) {
              d2 = false;
              break a;
            }
          d2 = true;
        }
      if (d2)
        return c2[0];
    }
  }
  a2 = a2();
  S.memoizedState = [a2, b2];
  return a2;
}
function Jc(a2, b2, c2) {
  if (25 <= Dc)
    throw Error(k(301));
  if (a2 === R)
    if (Cc = true, a2 = { action: c2, next: null }, null === V && (V = /* @__PURE__ */ new Map()), c2 = V.get(b2), void 0 === c2)
      V.set(b2, a2);
    else {
      for (b2 = c2; null !== b2.next; )
        b2 = b2.next;
      b2.next = a2;
    }
}
function Lc() {
  throw Error(k(394));
}
function Mc() {
}
var Oc = { readContext: function(a2) {
  return a2._currentValue;
}, useContext: function(a2) {
  W();
  return a2._currentValue;
}, useMemo: Kc, useReducer: Ic, useRef: function(a2) {
  R = W();
  S = Fc();
  var b2 = S.memoizedState;
  return null === b2 ? (a2 = { current: a2 }, S.memoizedState = a2) : b2;
}, useState: function(a2) {
  return Ic(Hc, a2);
}, useInsertionEffect: Mc, useLayoutEffect: function() {
}, useCallback: function(a2, b2) {
  return Kc(function() {
    return a2;
  }, b2);
}, useImperativeHandle: Mc, useEffect: Mc, useDebugValue: Mc, useDeferredValue: function(a2) {
  W();
  return a2;
}, useTransition: function() {
  W();
  return [false, Lc];
}, useId: function() {
  var a2 = Ac.treeContext;
  var b2 = a2.overflow;
  a2 = a2.id;
  a2 = (a2 & ~(1 << 32 - uc(a2) - 1)).toString(32) + b2;
  var c2 = Nc;
  if (null === c2)
    throw Error(k(404));
  b2 = U++;
  a2 = ":" + c2.idPrefix + "R" + a2;
  0 < b2 && (a2 += "H" + b2.toString(32));
  return a2 + ":";
}, useMutableSource: function(a2, b2) {
  W();
  return b2(a2._source);
}, useSyncExternalStore: function(a2, b2, c2) {
  if (void 0 === c2)
    throw Error(k(407));
  return c2();
} }, Nc = null, Pc = aa.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;
function Qc(a2) {
  console.error(a2);
  return null;
}
function X() {
}
function Rc(a2, b2, c2, d2, f2, e2, g2, h3, m2) {
  var q2 = [], r2 = /* @__PURE__ */ new Set();
  b2 = { destination: null, responseState: b2, progressiveChunkSize: void 0 === d2 ? 12800 : d2, status: 0, fatalError: null, nextSegmentId: 0, allPendingTasks: 0, pendingRootTasks: 0, completedRootSegment: null, abortableTasks: r2, pingedTasks: q2, clientRenderedBoundaries: [], completedBoundaries: [], partialBoundaries: [], onError: void 0 === f2 ? Qc : f2, onAllReady: void 0 === e2 ? X : e2, onShellReady: void 0 === g2 ? X : g2, onShellError: void 0 === h3 ? X : h3, onFatalError: void 0 === m2 ? X : m2 };
  c2 = Sc(b2, 0, null, c2, false, false);
  c2.parentFlushed = true;
  a2 = Tc(b2, a2, null, c2, r2, kc, null, sc);
  q2.push(a2);
  return b2;
}
function Tc(a2, b2, c2, d2, f2, e2, g2, h3) {
  a2.allPendingTasks++;
  null === c2 ? a2.pendingRootTasks++ : c2.pendingTasks++;
  var m2 = { node: b2, ping: function() {
    var b3 = a2.pingedTasks;
    b3.push(m2);
    1 === b3.length && Uc(a2);
  }, blockedBoundary: c2, blockedSegment: d2, abortSet: f2, legacyContext: e2, context: g2, treeContext: h3 };
  f2.add(m2);
  return m2;
}
function Sc(a2, b2, c2, d2, f2, e2) {
  return { status: 0, id: -1, index: b2, parentFlushed: false, chunks: [], children: [], formatContext: d2, boundary: c2, lastPushedText: f2, textEmbedded: e2 };
}
function Y(a2, b2) {
  a2 = a2.onError(b2);
  if (null != a2 && "string" !== typeof a2)
    throw Error('onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "' + typeof a2 + '" instead');
  return a2;
}
function Vc(a2, b2) {
  var c2 = a2.onShellError;
  c2(b2);
  c2 = a2.onFatalError;
  c2(b2);
  null !== a2.destination ? (a2.status = 2, da(a2.destination, b2)) : (a2.status = 1, a2.fatalError = b2);
}
function Wc(a2, b2, c2, d2, f2) {
  R = {};
  Ac = b2;
  U = 0;
  for (a2 = c2(d2, f2); Cc; )
    Cc = false, U = 0, Dc += 1, S = null, a2 = c2(d2, f2);
  Gc();
  return a2;
}
function Xc(a2, b2, c2, d2) {
  var f2 = c2.render(), e2 = d2.childContextTypes;
  if (null !== e2 && void 0 !== e2) {
    var g2 = b2.legacyContext;
    if ("function" !== typeof c2.getChildContext)
      d2 = g2;
    else {
      c2 = c2.getChildContext();
      for (var h3 in c2)
        if (!(h3 in e2))
          throw Error(k(108, jc(d2) || "Unknown", h3));
      d2 = N({}, g2, c2);
    }
    b2.legacyContext = d2;
    Z(a2, b2, f2);
    b2.legacyContext = g2;
  } else
    Z(a2, b2, f2);
}
function Yc(a2, b2) {
  if (a2 && a2.defaultProps) {
    b2 = N({}, b2);
    a2 = a2.defaultProps;
    for (var c2 in a2)
      void 0 === b2[c2] && (b2[c2] = a2[c2]);
    return b2;
  }
  return b2;
}
function Zc(a2, b2, c2, d2, f2) {
  if ("function" === typeof c2)
    if (c2.prototype && c2.prototype.isReactComponent) {
      f2 = lc(c2, b2.legacyContext);
      var e2 = c2.contextType;
      e2 = new c2(d2, "object" === typeof e2 && null !== e2 ? e2._currentValue : f2);
      rc(e2, c2, d2, f2);
      Xc(a2, b2, e2, c2);
    } else {
      e2 = lc(c2, b2.legacyContext);
      f2 = Wc(a2, b2, c2, d2, e2);
      var g2 = 0 !== U;
      if ("object" === typeof f2 && null !== f2 && "function" === typeof f2.render && void 0 === f2.$$typeof)
        rc(f2, c2, d2, e2), Xc(a2, b2, f2, c2);
      else if (g2) {
        d2 = b2.treeContext;
        b2.treeContext = tc(d2, 1, 0);
        try {
          Z(a2, b2, f2);
        } finally {
          b2.treeContext = d2;
        }
      } else
        Z(a2, b2, f2);
    }
  else if ("string" === typeof c2) {
    f2 = b2.blockedSegment;
    e2 = Sa(f2.chunks, c2, d2, a2.responseState, f2.formatContext);
    f2.lastPushedText = false;
    g2 = f2.formatContext;
    f2.formatContext = Ba(g2, c2, d2);
    $c(a2, b2, e2);
    f2.formatContext = g2;
    switch (c2) {
      case "area":
      case "base":
      case "br":
      case "col":
      case "embed":
      case "hr":
      case "img":
      case "input":
      case "keygen":
      case "link":
      case "meta":
      case "param":
      case "source":
      case "track":
      case "wbr":
        break;
      default:
        f2.chunks.push(Ta, u(c2), Ua);
    }
    f2.lastPushedText = false;
  } else {
    switch (c2) {
      case gc:
      case fc:
      case Wb:
      case Xb:
      case Vb:
        Z(a2, b2, d2.children);
        return;
      case bc:
        Z(a2, b2, d2.children);
        return;
      case ec:
        throw Error(k(343));
      case ac:
        a: {
          c2 = b2.blockedBoundary;
          f2 = b2.blockedSegment;
          e2 = d2.fallback;
          d2 = d2.children;
          g2 = /* @__PURE__ */ new Set();
          var h3 = { id: null, rootSegmentID: -1, parentFlushed: false, pendingTasks: 0, forceClientRender: false, completedSegments: [], byteSize: 0, fallbackAbortableTasks: g2, errorDigest: null }, m2 = Sc(a2, f2.chunks.length, h3, f2.formatContext, false, false);
          f2.children.push(m2);
          f2.lastPushedText = false;
          var q2 = Sc(a2, 0, null, f2.formatContext, false, false);
          q2.parentFlushed = true;
          b2.blockedBoundary = h3;
          b2.blockedSegment = q2;
          try {
            if ($c(
              a2,
              b2,
              d2
            ), q2.lastPushedText && q2.textEmbedded && q2.chunks.push(Ca), q2.status = 1, ad(h3, q2), 0 === h3.pendingTasks)
              break a;
          } catch (r2) {
            q2.status = 4, h3.forceClientRender = true, h3.errorDigest = Y(a2, r2);
          } finally {
            b2.blockedBoundary = c2, b2.blockedSegment = f2;
          }
          b2 = Tc(a2, e2, c2, m2, g2, b2.legacyContext, b2.context, b2.treeContext);
          a2.pingedTasks.push(b2);
        }
        return;
    }
    if ("object" === typeof c2 && null !== c2)
      switch (c2.$$typeof) {
        case $b:
          d2 = Wc(a2, b2, c2.render, d2, f2);
          if (0 !== U) {
            c2 = b2.treeContext;
            b2.treeContext = tc(c2, 1, 0);
            try {
              Z(a2, b2, d2);
            } finally {
              b2.treeContext = c2;
            }
          } else
            Z(a2, b2, d2);
          return;
        case cc:
          c2 = c2.type;
          d2 = Yc(c2, d2);
          Zc(a2, b2, c2, d2, f2);
          return;
        case Yb:
          f2 = d2.children;
          c2 = c2._context;
          d2 = d2.value;
          e2 = c2._currentValue;
          c2._currentValue = d2;
          g2 = O;
          O = d2 = { parent: g2, depth: null === g2 ? 0 : g2.depth + 1, context: c2, parentValue: e2, value: d2 };
          b2.context = d2;
          Z(a2, b2, f2);
          a2 = O;
          if (null === a2)
            throw Error(k(403));
          d2 = a2.parentValue;
          a2.context._currentValue = d2 === hc ? a2.context._defaultValue : d2;
          a2 = O = a2.parent;
          b2.context = a2;
          return;
        case Zb:
          d2 = d2.children;
          d2 = d2(c2._currentValue);
          Z(a2, b2, d2);
          return;
        case dc:
          f2 = c2._init;
          c2 = f2(c2._payload);
          d2 = Yc(c2, d2);
          Zc(a2, b2, c2, d2, void 0);
          return;
      }
    throw Error(k(
      130,
      null == c2 ? c2 : typeof c2,
      ""
    ));
  }
}
function Z(a2, b2, c2) {
  b2.node = c2;
  if ("object" === typeof c2 && null !== c2) {
    switch (c2.$$typeof) {
      case Tb:
        Zc(a2, b2, c2.type, c2.props, c2.ref);
        return;
      case Ub:
        throw Error(k(257));
      case dc:
        var d2 = c2._init;
        c2 = d2(c2._payload);
        Z(a2, b2, c2);
        return;
    }
    if (ra(c2)) {
      bd(a2, b2, c2);
      return;
    }
    null === c2 || "object" !== typeof c2 ? d2 = null : (d2 = ic && c2[ic] || c2["@@iterator"], d2 = "function" === typeof d2 ? d2 : null);
    if (d2 && (d2 = d2.call(c2))) {
      c2 = d2.next();
      if (!c2.done) {
        var f2 = [];
        do
          f2.push(c2.value), c2 = d2.next();
        while (!c2.done);
        bd(a2, b2, f2);
      }
      return;
    }
    a2 = Object.prototype.toString.call(c2);
    throw Error(k(31, "[object Object]" === a2 ? "object with keys {" + Object.keys(c2).join(", ") + "}" : a2));
  }
  "string" === typeof c2 ? (d2 = b2.blockedSegment, d2.lastPushedText = Da(b2.blockedSegment.chunks, c2, a2.responseState, d2.lastPushedText)) : "number" === typeof c2 && (d2 = b2.blockedSegment, d2.lastPushedText = Da(b2.blockedSegment.chunks, "" + c2, a2.responseState, d2.lastPushedText));
}
function bd(a2, b2, c2) {
  for (var d2 = c2.length, f2 = 0; f2 < d2; f2++) {
    var e2 = b2.treeContext;
    b2.treeContext = tc(e2, d2, f2);
    try {
      $c(a2, b2, c2[f2]);
    } finally {
      b2.treeContext = e2;
    }
  }
}
function $c(a2, b2, c2) {
  var d2 = b2.blockedSegment.formatContext, f2 = b2.legacyContext, e2 = b2.context;
  try {
    return Z(a2, b2, c2);
  } catch (m2) {
    if (Gc(), "object" === typeof m2 && null !== m2 && "function" === typeof m2.then) {
      c2 = m2;
      var g2 = b2.blockedSegment, h3 = Sc(a2, g2.chunks.length, null, g2.formatContext, g2.lastPushedText, true);
      g2.children.push(h3);
      g2.lastPushedText = false;
      a2 = Tc(a2, b2.node, b2.blockedBoundary, h3, b2.abortSet, b2.legacyContext, b2.context, b2.treeContext).ping;
      c2.then(a2, a2);
      b2.blockedSegment.formatContext = d2;
      b2.legacyContext = f2;
      b2.context = e2;
      Q(e2);
    } else
      throw b2.blockedSegment.formatContext = d2, b2.legacyContext = f2, b2.context = e2, Q(e2), m2;
  }
}
function cd(a2) {
  var b2 = a2.blockedBoundary;
  a2 = a2.blockedSegment;
  a2.status = 3;
  dd(this, b2, a2);
}
function ed(a2, b2, c2) {
  var d2 = a2.blockedBoundary;
  a2.blockedSegment.status = 3;
  null === d2 ? (b2.allPendingTasks--, 2 !== b2.status && (b2.status = 2, null !== b2.destination && b2.destination.close())) : (d2.pendingTasks--, d2.forceClientRender || (d2.forceClientRender = true, a2 = void 0 === c2 ? Error(k(432)) : c2, d2.errorDigest = b2.onError(a2), d2.parentFlushed && b2.clientRenderedBoundaries.push(d2)), d2.fallbackAbortableTasks.forEach(function(a3) {
    return ed(a3, b2, c2);
  }), d2.fallbackAbortableTasks.clear(), b2.allPendingTasks--, 0 === b2.allPendingTasks && (d2 = b2.onAllReady, d2()));
}
function ad(a2, b2) {
  if (0 === b2.chunks.length && 1 === b2.children.length && null === b2.children[0].boundary) {
    var c2 = b2.children[0];
    c2.id = b2.id;
    c2.parentFlushed = true;
    1 === c2.status && ad(a2, c2);
  } else
    a2.completedSegments.push(b2);
}
function dd(a2, b2, c2) {
  if (null === b2) {
    if (c2.parentFlushed) {
      if (null !== a2.completedRootSegment)
        throw Error(k(389));
      a2.completedRootSegment = c2;
    }
    a2.pendingRootTasks--;
    0 === a2.pendingRootTasks && (a2.onShellError = X, b2 = a2.onShellReady, b2());
  } else
    b2.pendingTasks--, b2.forceClientRender || (0 === b2.pendingTasks ? (c2.parentFlushed && 1 === c2.status && ad(b2, c2), b2.parentFlushed && a2.completedBoundaries.push(b2), b2.fallbackAbortableTasks.forEach(cd, a2), b2.fallbackAbortableTasks.clear()) : c2.parentFlushed && 1 === c2.status && (ad(b2, c2), 1 === b2.completedSegments.length && b2.parentFlushed && a2.partialBoundaries.push(b2)));
  a2.allPendingTasks--;
  0 === a2.allPendingTasks && (a2 = a2.onAllReady, a2());
}
function Uc(a2) {
  if (2 !== a2.status) {
    var b2 = O, c2 = Pc.current;
    Pc.current = Oc;
    var d2 = Nc;
    Nc = a2.responseState;
    try {
      var f2 = a2.pingedTasks, e2;
      for (e2 = 0; e2 < f2.length; e2++) {
        var g2 = f2[e2];
        var h3 = a2, m2 = g2.blockedSegment;
        if (0 === m2.status) {
          Q(g2.context);
          try {
            Z(h3, g2, g2.node), m2.lastPushedText && m2.textEmbedded && m2.chunks.push(Ca), g2.abortSet.delete(g2), m2.status = 1, dd(h3, g2.blockedBoundary, m2);
          } catch (G2) {
            if (Gc(), "object" === typeof G2 && null !== G2 && "function" === typeof G2.then) {
              var q2 = g2.ping;
              G2.then(q2, q2);
            } else {
              g2.abortSet.delete(g2);
              m2.status = 4;
              var r2 = g2.blockedBoundary, v2 = G2, A2 = Y(h3, v2);
              null === r2 ? Vc(h3, v2) : (r2.pendingTasks--, r2.forceClientRender || (r2.forceClientRender = true, r2.errorDigest = A2, r2.parentFlushed && h3.clientRenderedBoundaries.push(r2)));
              h3.allPendingTasks--;
              if (0 === h3.allPendingTasks) {
                var F2 = h3.onAllReady;
                F2();
              }
            }
          } finally {
          }
        }
      }
      f2.splice(0, e2);
      null !== a2.destination && fd(a2, a2.destination);
    } catch (G2) {
      Y(a2, G2), Vc(a2, G2);
    } finally {
      Nc = d2, Pc.current = c2, c2 === Oc && Q(b2);
    }
  }
}
function gd(a2, b2, c2) {
  c2.parentFlushed = true;
  switch (c2.status) {
    case 0:
      var d2 = c2.id = a2.nextSegmentId++;
      c2.lastPushedText = false;
      c2.textEmbedded = false;
      a2 = a2.responseState;
      p(b2, Va);
      p(b2, a2.placeholderPrefix);
      a2 = u(d2.toString(16));
      p(b2, a2);
      return t(b2, Wa);
    case 1:
      c2.status = 2;
      var f2 = true;
      d2 = c2.chunks;
      var e2 = 0;
      c2 = c2.children;
      for (var g2 = 0; g2 < c2.length; g2++) {
        for (f2 = c2[g2]; e2 < f2.index; e2++)
          p(b2, d2[e2]);
        f2 = hd(a2, b2, f2);
      }
      for (; e2 < d2.length - 1; e2++)
        p(b2, d2[e2]);
      e2 < d2.length && (f2 = t(b2, d2[e2]));
      return f2;
    default:
      throw Error(k(390));
  }
}
function hd(a2, b2, c2) {
  var d2 = c2.boundary;
  if (null === d2)
    return gd(a2, b2, c2);
  d2.parentFlushed = true;
  if (d2.forceClientRender)
    d2 = d2.errorDigest, t(b2, $a), p(b2, bb), d2 && (p(b2, db), p(b2, u(C(d2))), p(b2, cb)), t(b2, eb), gd(a2, b2, c2);
  else if (0 < d2.pendingTasks) {
    d2.rootSegmentID = a2.nextSegmentId++;
    0 < d2.completedSegments.length && a2.partialBoundaries.push(d2);
    var f2 = a2.responseState;
    var e2 = f2.nextSuspenseID++;
    f2 = w(f2.boundaryPrefix + e2.toString(16));
    d2 = d2.id = f2;
    fb(b2, a2.responseState, d2);
    gd(a2, b2, c2);
  } else if (d2.byteSize > a2.progressiveChunkSize)
    d2.rootSegmentID = a2.nextSegmentId++, a2.completedBoundaries.push(d2), fb(b2, a2.responseState, d2.id), gd(a2, b2, c2);
  else {
    t(b2, Xa);
    c2 = d2.completedSegments;
    if (1 !== c2.length)
      throw Error(k(391));
    hd(a2, b2, c2[0]);
  }
  return t(b2, ab);
}
function id(a2, b2, c2) {
  Bb(b2, a2.responseState, c2.formatContext, c2.id);
  hd(a2, b2, c2);
  return Cb(b2, c2.formatContext);
}
function jd(a2, b2, c2) {
  for (var d2 = c2.completedSegments, f2 = 0; f2 < d2.length; f2++)
    kd(a2, b2, c2, d2[f2]);
  d2.length = 0;
  a2 = a2.responseState;
  d2 = c2.id;
  c2 = c2.rootSegmentID;
  p(b2, a2.startInlineScript);
  a2.sentCompleteBoundaryFunction ? p(b2, Jb) : (a2.sentCompleteBoundaryFunction = true, p(b2, Ib));
  if (null === d2)
    throw Error(k(395));
  c2 = u(c2.toString(16));
  p(b2, d2);
  p(b2, Kb);
  p(b2, a2.segmentPrefix);
  p(b2, c2);
  return t(b2, Lb);
}
function kd(a2, b2, c2, d2) {
  if (2 === d2.status)
    return true;
  var f2 = d2.id;
  if (-1 === f2) {
    if (-1 === (d2.id = c2.rootSegmentID))
      throw Error(k(392));
    return id(a2, b2, d2);
  }
  id(a2, b2, d2);
  a2 = a2.responseState;
  p(b2, a2.startInlineScript);
  a2.sentCompleteSegmentFunction ? p(b2, Eb) : (a2.sentCompleteSegmentFunction = true, p(b2, Db));
  p(b2, a2.segmentPrefix);
  f2 = u(f2.toString(16));
  p(b2, f2);
  p(b2, Gb);
  p(b2, a2.placeholderPrefix);
  p(b2, f2);
  return t(b2, Hb);
}
function fd(a2, b2) {
  l$1 = new Uint8Array(512);
  n = 0;
  try {
    var c2 = a2.completedRootSegment;
    if (null !== c2 && 0 === a2.pendingRootTasks) {
      hd(a2, b2, c2);
      a2.completedRootSegment = null;
      var d2 = a2.responseState.bootstrapChunks;
      for (c2 = 0; c2 < d2.length - 1; c2++)
        p(b2, d2[c2]);
      c2 < d2.length && t(b2, d2[c2]);
    }
    var f2 = a2.clientRenderedBoundaries, e2;
    for (e2 = 0; e2 < f2.length; e2++) {
      var g2 = f2[e2];
      d2 = b2;
      var h3 = a2.responseState, m2 = g2.id, q2 = g2.errorDigest, r2 = g2.errorMessage, v2 = g2.errorComponentStack;
      p(d2, h3.startInlineScript);
      h3.sentClientRenderFunction ? p(d2, Nb) : (h3.sentClientRenderFunction = true, p(
        d2,
        Mb
      ));
      if (null === m2)
        throw Error(k(395));
      p(d2, m2);
      p(d2, Ob);
      if (q2 || r2 || v2)
        p(d2, Qb), p(d2, u(Sb(q2 || "")));
      if (r2 || v2)
        p(d2, Qb), p(d2, u(Sb(r2 || "")));
      v2 && (p(d2, Qb), p(d2, u(Sb(v2))));
      if (!t(d2, Pb))
        ;
    }
    f2.splice(0, e2);
    var A2 = a2.completedBoundaries;
    for (e2 = 0; e2 < A2.length; e2++)
      if (!jd(a2, b2, A2[e2]))
        ;
    A2.splice(0, e2);
    ba(b2);
    l$1 = new Uint8Array(512);
    n = 0;
    var F2 = a2.partialBoundaries;
    for (e2 = 0; e2 < F2.length; e2++) {
      var G2 = F2[e2];
      a: {
        f2 = a2;
        g2 = b2;
        var ma2 = G2.completedSegments;
        for (h3 = 0; h3 < ma2.length; h3++)
          if (!kd(
            f2,
            g2,
            G2,
            ma2[h3]
          )) {
            h3++;
            ma2.splice(0, h3);
            var Fb2 = false;
            break a;
          }
        ma2.splice(0, h3);
        Fb2 = true;
      }
      if (!Fb2) {
        a2.destination = null;
        e2++;
        F2.splice(0, e2);
        return;
      }
    }
    F2.splice(0, e2);
    var na2 = a2.completedBoundaries;
    for (e2 = 0; e2 < na2.length; e2++)
      if (!jd(a2, b2, na2[e2]))
        ;
    na2.splice(0, e2);
  } finally {
    ba(b2), 0 === a2.allPendingTasks && 0 === a2.pingedTasks.length && 0 === a2.clientRenderedBoundaries.length && 0 === a2.completedBoundaries.length && b2.close();
  }
}
function ld(a2, b2) {
  try {
    var c2 = a2.abortableTasks;
    c2.forEach(function(c3) {
      return ed(c3, a2, b2);
    });
    c2.clear();
    null !== a2.destination && fd(a2, a2.destination);
  } catch (d2) {
    Y(a2, d2), Vc(a2, d2);
  }
}
reactDomServer_browser_production_min.renderToReadableStream = function(a2, b2) {
  return new Promise(function(c2, d2) {
    var f2, e2, g2 = new Promise(function(a3, b3) {
      e2 = a3;
      f2 = b3;
    }), h3 = Rc(a2, za(b2 ? b2.identifierPrefix : void 0, b2 ? b2.nonce : void 0, b2 ? b2.bootstrapScriptContent : void 0, b2 ? b2.bootstrapScripts : void 0, b2 ? b2.bootstrapModules : void 0), Aa(b2 ? b2.namespaceURI : void 0), b2 ? b2.progressiveChunkSize : void 0, b2 ? b2.onError : void 0, e2, function() {
      var a3 = new ReadableStream({ type: "bytes", pull: function(a4) {
        if (1 === h3.status)
          h3.status = 2, da(a4, h3.fatalError);
        else if (2 !== h3.status && null === h3.destination) {
          h3.destination = a4;
          try {
            fd(h3, a4);
          } catch (A2) {
            Y(h3, A2), Vc(h3, A2);
          }
        }
      }, cancel: function() {
        ld(h3);
      } }, { highWaterMark: 0 });
      a3.allReady = g2;
      c2(a3);
    }, function(a3) {
      g2.catch(function() {
      });
      d2(a3);
    }, f2);
    if (b2 && b2.signal) {
      var m2 = b2.signal, q2 = function() {
        ld(h3, m2.reason);
        m2.removeEventListener("abort", q2);
      };
      m2.addEventListener("abort", q2);
    }
    Uc(h3);
  });
};
reactDomServer_browser_production_min.version = "18.3.1";
var l, s;
{
  l = reactDomServerLegacy_browser_production_min;
  s = reactDomServer_browser_production_min;
}
l.version;
var renderToString = l.renderToString;
l.renderToStaticMarkup;
l.renderToNodeStream;
l.renderToStaticNodeStream;
s.renderToReadableStream;
var reactContenteditable = {};
var fastDeepEqual = function equal(a2, b2) {
  if (a2 === b2)
    return true;
  if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") {
    if (a2.constructor !== b2.constructor)
      return false;
    var length2, i2, keys2;
    if (Array.isArray(a2)) {
      length2 = a2.length;
      if (length2 != b2.length)
        return false;
      for (i2 = length2; i2-- !== 0; )
        if (!equal(a2[i2], b2[i2]))
          return false;
      return true;
    }
    if (a2.constructor === RegExp)
      return a2.source === b2.source && a2.flags === b2.flags;
    if (a2.valueOf !== Object.prototype.valueOf)
      return a2.valueOf() === b2.valueOf();
    if (a2.toString !== Object.prototype.toString)
      return a2.toString() === b2.toString();
    keys2 = Object.keys(a2);
    length2 = keys2.length;
    if (length2 !== Object.keys(b2).length)
      return false;
    for (i2 = length2; i2-- !== 0; )
      if (!Object.prototype.hasOwnProperty.call(b2, keys2[i2]))
        return false;
    for (i2 = length2; i2-- !== 0; ) {
      var key = keys2[i2];
      if (!equal(a2[key], b2[key]))
        return false;
    }
    return true;
  }
  return a2 !== a2 && b2 !== b2;
};
var __extends = commonjsGlobal && commonjsGlobal.__extends || /* @__PURE__ */ function() {
  var extendStatics = function(d2, b2) {
    extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
      d3.__proto__ = b3;
    } || function(d3, b3) {
      for (var p2 in b3)
        if (Object.prototype.hasOwnProperty.call(b3, p2))
          d3[p2] = b3[p2];
    };
    return extendStatics(d2, b2);
  };
  return function(d2, b2) {
    if (typeof b2 !== "function" && b2 !== null)
      throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
    extendStatics(d2, b2);
    function __() {
      this.constructor = d2;
    }
    d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
  };
}();
var __assign = commonjsGlobal && commonjsGlobal.__assign || function() {
  __assign = Object.assign || function(t2) {
    for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
      s2 = arguments[i2];
      for (var p2 in s2)
        if (Object.prototype.hasOwnProperty.call(s2, p2))
          t2[p2] = s2[p2];
    }
    return t2;
  };
  return __assign.apply(this, arguments);
};
var __createBinding = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function(o2, m2, k2, k22) {
  if (k22 === void 0)
    k22 = k2;
  var desc = Object.getOwnPropertyDescriptor(m2, k2);
  if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
    desc = { enumerable: true, get: function() {
      return m2[k2];
    } };
  }
  Object.defineProperty(o2, k22, desc);
} : function(o2, m2, k2, k22) {
  if (k22 === void 0)
    k22 = k2;
  o2[k22] = m2[k2];
});
var __setModuleDefault = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function(o2, v2) {
  Object.defineProperty(o2, "default", { enumerable: true, value: v2 });
} : function(o2, v2) {
  o2["default"] = v2;
});
var __importStar = commonjsGlobal && commonjsGlobal.__importStar || function(mod2) {
  if (mod2 && mod2.__esModule)
    return mod2;
  var result = {};
  if (mod2 != null) {
    for (var k2 in mod2)
      if (k2 !== "default" && Object.prototype.hasOwnProperty.call(mod2, k2))
        __createBinding(result, mod2, k2);
  }
  __setModuleDefault(result, mod2);
  return result;
};
var __rest = commonjsGlobal && commonjsGlobal.__rest || function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
};
var __importDefault$2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {
  return mod2 && mod2.__esModule ? mod2 : { "default": mod2 };
};
Object.defineProperty(reactContenteditable, "__esModule", { value: true });
var React = __importStar(reactExports);
var fast_deep_equal_1 = __importDefault$2(fastDeepEqual);
var PropTypes = __importStar(propTypesExports);
function normalizeHtml(str) {
  return str && str.replace(/&nbsp;|\u202F|\u00A0/g, " ").replace(/<br \/>/g, "<br>");
}
function replaceCaret(el2) {
  var target = document.createTextNode("");
  el2.appendChild(target);
  var isTargetFocused = document.activeElement === el2;
  if (target !== null && target.nodeValue !== null && isTargetFocused) {
    var sel = window.getSelection();
    if (sel !== null) {
      var range3 = document.createRange();
      range3.setStart(target, target.nodeValue.length);
      range3.collapse(true);
      sel.removeAllRanges();
      sel.addRange(range3);
    }
    if (el2 instanceof HTMLElement)
      el2.focus();
  }
}
var ContentEditable = (
  /** @class */
  function(_super) {
    __extends(ContentEditable2, _super);
    function ContentEditable2() {
      var _this = _super !== null && _super.apply(this, arguments) || this;
      _this.lastHtml = _this.props.html;
      _this.el = typeof _this.props.innerRef === "function" ? { current: null } : React.createRef();
      _this.getEl = function() {
        return (_this.props.innerRef && typeof _this.props.innerRef !== "function" ? _this.props.innerRef : _this.el).current;
      };
      _this.emitChange = function(originalEvt) {
        var el2 = _this.getEl();
        if (!el2)
          return;
        var html2 = el2.innerHTML;
        if (_this.props.onChange && html2 !== _this.lastHtml) {
          var evt = Object.assign({}, originalEvt, {
            target: {
              value: html2
            }
          });
          _this.props.onChange(evt);
        }
        _this.lastHtml = html2;
      };
      return _this;
    }
    ContentEditable2.prototype.render = function() {
      var _this = this;
      var _a2 = this.props, tagName = _a2.tagName, html2 = _a2.html, innerRef = _a2.innerRef, props = __rest(_a2, ["tagName", "html", "innerRef"]);
      return React.createElement(tagName || "div", __assign(__assign({}, props), { ref: typeof innerRef === "function" ? function(current) {
        innerRef(current);
        _this.el.current = current;
      } : innerRef || this.el, onInput: this.emitChange, onBlur: this.props.onBlur || this.emitChange, onKeyUp: this.props.onKeyUp || this.emitChange, onKeyDown: this.props.onKeyDown || this.emitChange, contentEditable: !this.props.disabled, dangerouslySetInnerHTML: { __html: html2 } }), this.props.children);
    };
    ContentEditable2.prototype.shouldComponentUpdate = function(nextProps) {
      var props = this.props;
      var el2 = this.getEl();
      if (!el2)
        return true;
      if (normalizeHtml(nextProps.html) !== normalizeHtml(el2.innerHTML)) {
        return true;
      }
      return props.disabled !== nextProps.disabled || props.tagName !== nextProps.tagName || props.className !== nextProps.className || props.innerRef !== nextProps.innerRef || props.placeholder !== nextProps.placeholder || !(0, fast_deep_equal_1.default)(props.style, nextProps.style);
    };
    ContentEditable2.prototype.componentDidUpdate = function() {
      var el2 = this.getEl();
      if (!el2)
        return;
      if (this.props.html !== el2.innerHTML) {
        el2.innerHTML = this.props.html;
      }
      this.lastHtml = this.props.html;
      replaceCaret(el2);
    };
    ContentEditable2.propTypes = {
      html: PropTypes.string.isRequired,
      onChange: PropTypes.func,
      disabled: PropTypes.bool,
      tagName: PropTypes.string,
      className: PropTypes.string,
      style: PropTypes.object,
      innerRef: PropTypes.oneOfType([
        PropTypes.object,
        PropTypes.func
      ])
    };
    return ContentEditable2;
  }(React.Component)
);
var _default = reactContenteditable.default = ContentEditable;
var ResourceDisplayNameTemplateSegmentType = /* @__PURE__ */ ((ResourceDisplayNameTemplateSegmentType2) => {
  ResourceDisplayNameTemplateSegmentType2[ResourceDisplayNameTemplateSegmentType2["Text"] = 1] = "Text";
  ResourceDisplayNameTemplateSegmentType2[ResourceDisplayNameTemplateSegmentType2["Wrapper"] = 2] = "Wrapper";
  ResourceDisplayNameTemplateSegmentType2[ResourceDisplayNameTemplateSegmentType2["Property"] = 3] = "Property";
  return ResourceDisplayNameTemplateSegmentType2;
})(ResourceDisplayNameTemplateSegmentType || {});
const VariableWrapper$1 = {
  left: "{",
  right: "}"
};
const extractResourceDisplayNameTemplate$1 = (template2, variables, wrappers) => {
  const wrappedVariables = variables.map(
    (v2) => `${VariableWrapper$1.left}${v2}${VariableWrapper$1.right}`
  );
  const segments = [];
  console.log(wrappedVariables, wrappers);
  for (let i2 = 0; i2 < template2.length; i2++) {
    const c2 = template2[i2];
    let matched = false;
    if (c2 == "{") {
      for (const wv of wrappedVariables) {
        if (template2.startsWith(wv, i2)) {
          segments.push({
            text: wv,
            type: ResourceDisplayNameTemplateSegmentType.Property
          });
          i2 += wv.length - 1;
          matched = true;
          break;
        }
      }
    }
    if (!matched) {
      if (wrappers.some((w2) => w2.left == c2 || w2.right == c2)) {
        segments.push({
          text: c2,
          type: ResourceDisplayNameTemplateSegmentType.Wrapper
        });
      } else {
        const prevPart = segments[segments.length - 1];
        if ((prevPart == null ? void 0 : prevPart.type) == ResourceDisplayNameTemplateSegmentType.Text) {
          prevPart.text += c2;
        } else {
          segments.push({
            text: c2,
            type: ResourceDisplayNameTemplateSegmentType.Text
          });
        }
      }
    }
  }
  return segments;
};
const renderDisplayNameSegment$1 = (p2) => {
  switch (p2.type) {
    case ResourceDisplayNameTemplateSegmentType.Text:
      return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p2.text });
    case ResourceDisplayNameTemplateSegmentType.Wrapper:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        "span",
        {
          style: { color: "var(--bakaui-secondary)" },
          children: p2.text
        }
      );
    case ResourceDisplayNameTemplateSegmentType.Property:
      return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { color: "var(--bakaui-primary)" }, children: p2.text });
  }
};
const DisplayNameTemplateEditorModal = ({
  template: template2,
  properties: properties2,
  onSubmit,
  ...props
}) => {
  const { t: t2 } = useTranslation();
  useUpdate();
  const { createPortal } = useBakabaseContext();
  const [visible, setVisible] = reactExports.useState(true);
  const [wrappers, setWrappers] = reactExports.useState([]);
  const [variables, setVariables] = reactExports.useState([]);
  const [templateHtml, setTemplateHtml] = reactExports.useState("");
  const templateRef = reactExports.useRef("");
  const init2 = reactExports.useCallback(async () => {
    var _a2;
    const tr = await BApi$1.specialText.getAllSpecialTexts();
    const texts = ((_a2 = tr.data) == null ? void 0 : _a2[SpecialTextType.Wrapper]) || [];
    const wrappers2 = texts.map((text2) => {
      return {
        left: text2.value1,
        right: text2.value2
      };
    });
    setWrappers(wrappers2);
    const builtinPropertyNames = builtinPropertyForDisplayNames.map(
      (v2) => t2(`BuiltinPropertyForDisplayName.${v2.label}`)
    );
    const customPropertyNames = (properties2 == null ? void 0 : properties2.map((cp) => cp.name)) ?? [];
    setVariables(builtinPropertyNames.concat(customPropertyNames));
    templateRef.current = template2 ?? "";
    setTemplateHtml(template2 ? buildTemplateHtml(template2) : "");
  }, []);
  reactExports.useEffect(() => {
    init2();
  }, []);
  const close = () => {
    setVisible(false);
  };
  const buildTemplateHtml = (template22) => {
    const parts = extractResourceDisplayNameTemplate$1(
      template22,
      variables,
      wrappers
    );
    const components2 = parts.map((p2) => renderDisplayNameSegment$1(p2));
    const html2 = renderToString(/* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: components2 }));
    console.log(parts, html2);
    return html2;
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      size: "xl",
      title: t2("Edit display name template for resources"),
      onClose: close,
      onDestroyed: props.onDestroyed,
      onOk: () => onSubmit == null ? void 0 : onSubmit(templateRef.current),
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "text-base" }),
              " ",
              t2(
                "You can use any combination of text and following properties in template, and you can add more properties in category configuration."
              )
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-center", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "text-base" }),
              " ",
              /* @__PURE__ */ jsxRuntimeExports.jsxs(
                Trans,
                {
                  i18nKey: "category.displayNameTemplate.propertyExample",
                  values: {
                    // samplePropertyName: propertiesRef.current[0]?.name ?? t<string>('Name'),
                    samplePropertyName: (variables == null ? void 0 : variables[0]) ?? t2("Name")
                  },
                  children: [
                    "To add a property value as a variable in the template, you can use the following format: ",
                    /* @__PURE__ */ jsxRuntimeExports.jsx(code_default, { children: "{name of property}" }),
                    ". For example, ",
                    /* @__PURE__ */ jsxRuntimeExports.jsx(code_default, { children: "{samplePropertyName}" }),
                    " will be replaced with the value of the property named ",
                    /* @__PURE__ */ jsxRuntimeExports.jsx(code_default, { children: "sampleName" })
                  ]
                }
              )
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "text-base" }),
              " ",
              t2(
                "Be careful if you have multiple properties with same name, only a random one will be replaced."
              )
            ] })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1 mt-2", children: variables == null ? void 0 : variables.map((p2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              size: "sm",
              onClick: () => {
                templateRef.current += `{${p2}}`;
                setTemplateHtml(buildTemplateHtml(templateRef.current));
              },
              children: p2
            },
            p2
          )) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "text-base" }),
            " ",
            t2(
              "You can safely use any of following text wrappers to wrap the properties, and wrappers surrounding the property with empty value will be removed automatically."
            ),
            t2(
              "You can check and set the wrappers in special text configuration."
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1 mt-2", children: wrappers.map((w2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { size: "sm", children: [
            w2.left,
            " ",
            w2.right
          ] }, w2.left)) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "text-base" }),
          " ",
          t2(
            "If you leave the template with empty value, the file name will be the display name."
          )
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Display name template") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            _default,
            {
              autoFocus: true,
              className: "border-1 rounded mt-1 p-2",
              html: templateHtml,
              tagName: "pre",
              onChange: (v2) => {
                templateRef.current = v2.currentTarget.textContent || "";
                setTemplateHtml(buildTemplateHtml(templateRef.current));
              }
            },
            "0"
          )
        ] })
      ]
    }
  );
};
DisplayNameTemplateEditorModal.displayName = "DisplayNameTemplateEditorModal";
const levelColorMap = {
  0: "default",
  // Trace
  1: "default",
  // Debug
  2: "default",
  // Information
  3: "warning",
  // Warning
  4: "danger",
  // Error
  5: "danger",
  // Critical
  6: "default"
  // None
};
const ValidateModal = ({ templateId, ...props }) => {
  const { t: t2 } = useTranslation();
  const [visible, setVisible] = React$5.useState(true);
  const [rootPath, setRootPath] = React$5.useState();
  const [limit2, setLimit] = React$5.useState(3);
  const [keyword, setKeyword] = React$5.useState("");
  const [running, setRunning] = React$5.useState(false);
  const [traces, setTraces] = React$5.useState([]);
  const abortRef = React$5.useRef(null);
  const close = reactExports.useCallback(() => {
    stop();
    setVisible(false);
  }, []);
  const start2 = async () => {
    if (!rootPath)
      return;
    setRunning(true);
    setTraces([]);
    const controller = new AbortController();
    abortRef.current = controller;
    try {
      const url2 = `${envConfig.apiEndpoint}/media-library-template/${templateId}/validate`;
      const resp = await fetch(url2, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({
          rootPath,
          limitResourcesCount: limit2,
          resourceKeyword: keyword || void 0
        }),
        signal: controller.signal
      });
      if (!resp.ok || !resp.body) {
        throw new Error(`Request failed: ${resp.status}`);
      }
      const reader = resp.body.getReader();
      const decoder = new TextDecoder();
      let buffer = "";
      while (true) {
        const { value: value2, done } = await reader.read();
        if (done)
          break;
        buffer += decoder.decode(value2, { stream: true });
        let idx;
        while ((idx = buffer.indexOf("\n")) >= 0) {
          const line2 = buffer.slice(0, idx).trim();
          buffer = buffer.slice(idx + 1);
          if (!line2)
            continue;
          try {
            const obj = JSON.parse(line2);
            setTraces((prev2) => [...prev2, obj]);
          } catch {
          }
        }
      }
      if (buffer.trim().length > 0) {
        try {
          const obj = JSON.parse(buffer.trim());
          setTraces((prev2) => [...prev2, obj]);
        } catch {
        }
      }
    } catch (e2) {
    } finally {
      setRunning(false);
      abortRef.current = null;
    }
  };
  const stop = () => {
    var _a2;
    (_a2 = abortRef.current) == null ? void 0 : _a2.abort();
    abortRef.current = null;
    setRunning(false);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      visible,
      className: "max-w-[80vw]",
      footer: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        !running ? /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", isDisabled: !rootPath, onPress: start2, children: t2("Start") }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "danger", variant: "light", onPress: stop, children: t2("Stop") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onPress: close, children: t2("Close") })
      ] }),
      size: "xl",
      title: t2("Validate media library template"),
      onClose: close,
      onDestroyed: props.onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid gap-2", style: { gridTemplateColumns: "160px 1fr" }, children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "self-center text-sm opacity-80", children: t2("Root path") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              placeholder: t2("Pick a directory or file path"),
              value: rootPath,
              onValueChange: setRootPath
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "self-center text-sm opacity-80", children: t2("Limit resources count") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              type: "number",
              value: (limit2 ?? 0).toString(),
              onValueChange: (v2) => setLimit(v2 ? parseInt(v2, 10) : void 0)
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "self-center text-sm opacity-80", children: t2("Resource keyword") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(input_default, { placeholder: t2("Optional"), value: keyword, onValueChange: setKeyword })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-[420px] overflow-auto rounded border-small p-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid gap-2", style: { gridTemplateColumns: "auto 1fr" }, children: [
          traces.map((tr, idx) => /* @__PURE__ */ jsxRuntimeExports.jsxs(React$5.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "default", size: "sm", variant: "flat", children: hooks(tr.time).format("HH:mm:ss.SSS") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: levelColorMap[tr.level] || "default", size: "sm", variant: "flat", children: tr.topic })
            ] }),
            tr.contexts && tr.contexts.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
              "div",
              {
                className: "grid gap-x-4 items-center text-xs",
                style: { gridTemplateColumns: "auto 1fr" },
                children: tr.contexts.map((c2, i2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-70 break-all text-right", children: c2.key }, `${idx}-k-${i2}`),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "break-all", children: c2.value != void 0 && JSON.stringify(c2.value) }, `${idx}-v-${i2}`)
                ] }))
              }
            ) || /* @__PURE__ */ jsxRuntimeExports.jsx("div", {})
          ] }, idx)),
          running && /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { color: "default", size: "sm", label: t2("Validating...") })
        ] }) })
      ] })
    }
  );
};
ValidateModal.displayName = "ValidateModal";
const DeleteEnhancementsModal = ({ title, description, onOk, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const [deleteEmptyOnly, setDeleteEmptyOnly] = React$5.useState(false);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      title,
      onDestroyed,
      onOk: async () => await onOk(deleteEmptyOnly),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
        description && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-warning", children: description }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(checkbox_default, { size: "sm", onValueChange: (v2) => setDeleteEmptyOnly(v2), children: t2("Delete empty records only") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Tooltip$1,
            {
              className: "max-w-[600px]",
              color: "secondary",
              content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                  "When the enhancement is successfully executed but no data available for enhancement is retrieved, an empty enhancement record is generated."
                ) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                  "Enhancement will only be executed when there are no existing enhancement records, so in some cases, you may only need to delete the empty enhancement records."
                ) })
              ] }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" })
            }
          )
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "This operation cannot be undone. Would you like to proceed?"
        ) })
      ] })
    }
  );
};
DeleteEnhancementsModal.displayName = "DeleteEnhancementsModal";
const Template = ({
  template: template2,
  onChange,
  enhancersCache,
  propertyMapCache,
  templatesCache
}) => {
  var _a2, _b2, _c2, _d, _e, _f, _g, _h;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const forceUpdate = useUpdate();
  const navigate = useNavigate();
  const [enhancers, setEnhancers] = React$5.useState(enhancersCache ?? []);
  const [propertyMap, setPropertyMap] = React$5.useState(propertyMapCache ?? {});
  const [templates2, setTemplates] = React$5.useState(
    templatesCache ?? []
  );
  reactExports.useEffect(() => {
    if (!enhancersCache) {
      BApi$1.enhancer.getAllEnhancerDescriptors().then((r2) => {
        setEnhancers(r2.data ?? []);
      });
    }
    if (!propertyMapCache) {
      loadProperties();
    }
    if (!templatesCache) {
      BApi$1.mediaLibraryTemplate.getAllMediaLibraryTemplates().then((r2) => {
        setTemplates(r2.data ?? []);
      });
    }
  }, []);
  useUpdateEffect(() => {
    setEnhancers(enhancersCache ?? []);
  }, [enhancersCache]);
  useUpdateEffect(() => {
    setPropertyMap(propertyMapCache ?? {});
  }, [propertyMapCache]);
  useUpdateEffect(() => {
    setTemplates(templatesCache ?? []);
  }, [templatesCache]);
  const loadProperties = async () => {
    const psr = (await BApi$1.property.getPropertiesByPool(PropertyPool.All)).data || [];
    const ps = _$2.mapValues(
      _$2.groupBy(psr, (x2) => x2.pool),
      (v2) => _$2.keyBy(v2, (x2) => x2.id)
    );
    setPropertyMap(ps);
  };
  const putTemplate = async (tpl) => {
    const r2 = await BApi$1.mediaLibraryTemplate.putMediaLibraryTemplate(tpl.id, tpl);
    if (!r2.code) {
      toast.success(t2("Saved successfully"));
      onChange == null ? void 0 : onChange();
      forceUpdate();
      return;
    }
    throw new Error(r2.message);
  };
  const renderChildSelector = (tpl) => {
    const willCauseLoopKeys = new Set(
      templates2.filter((t1) => {
        return willCauseCircleReference(
          tpl,
          t1.id,
          templates2,
          (x2) => x2.id,
          (x2) => x2.childTemplateId,
          (x2, k2) => x2.childTemplateId = k2
        );
      }).map((x2) => x2.id.toString())
    );
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex items-center gap-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Select,
        {
          className: "min-w-[320px]",
          dataSource: templates2.map((t1) => {
            const hasLoop = willCauseLoopKeys.has(t1.id.toString());
            return {
              label: `[#${t1.id}] ${t1.name}${hasLoop ? ` (${t2("Loop detected")})` : ""}`,
              value: t1.id.toString()
            };
          }),
          disabledKeys: willCauseLoopKeys,
          fullWidth: false,
          label: `${t2("Child template")} (${t2("optional")})`,
          placeholder: t2("Select a child template"),
          selectedKeys: tpl.childTemplateId ? [tpl.childTemplateId.toString()] : [],
          size: "sm",
          onSelectionChange: (keys2) => {
            const id2 = parseInt(Array.from(keys2)[0], 10);
            tpl.childTemplateId = id2;
            putTemplate(tpl);
          }
        }
      ),
      tpl.childTemplateId && /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "danger",
          variant: "light",
          onPress: () => {
            tpl.childTemplateId = void 0;
            tpl.child = void 0;
            putTemplate(tpl);
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-base" })
        }
      )
    ] });
  };
  console.log("template", template2);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Block2,
      {
        description: t2("Determine which files or folders will be considered as resources"),
        leftIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(IoLocate, { className: "text-large" }),
        rightIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-large" }),
        title: `1. ${t2("Resource filter")}`,
        onRightIconPress: () => {
          createPortal(PathFilterModal, {
            onSubmit: async (f2) => {
              (template2.resourceFilters ?? (template2.resourceFilters = [])).push(f2);
              await putTemplate(template2);
              forceUpdate();
            }
          });
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: (_a2 = template2.resourceFilters) == null ? void 0 : _a2.map((f2, i2) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(CiFilter, { className: "text-base" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$4, { filter: f2 }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                color: "default",
                size: "sm",
                variant: "light",
                onPress: () => {
                  createPortal(PathFilterModal, {
                    filter: f2,
                    onSubmit: async (nf2) => {
                      Object.assign(f2, nf2);
                      await putTemplate(template2);
                      forceUpdate();
                    }
                  });
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-base" })
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                color: "danger",
                size: "sm",
                variant: "light",
                onPress: () => {
                  createPortal(Modal, {
                    defaultVisible: true,
                    title: t2("Delete resource filter"),
                    children: t2("Sure to delete?"),
                    onOk: async () => {
                      var _a3;
                      (_a3 = template2.resourceFilters) == null ? void 0 : _a3.splice(i2, 1);
                      await putTemplate(template2);
                      forceUpdate();
                    }
                  });
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-base" })
              }
            )
          ] });
        }) })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Block2,
      {
        description: t2("Determine which files be considered as playable files"),
        leftIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(IoPlayCircleOutline, { className: "text-large" }),
        rightIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-base" }),
        title: `2. ${t2("Playable(Runnable) files")}`,
        onRightIconPress: () => {
          createPortal(PlayableFileSelectorModal, {
            selection: template2.playableFileLocator,
            onSubmit: async (selection) => {
              template2.playableFileLocator = selection;
              await putTemplate(template2);
              forceUpdate();
            }
          });
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          (_c2 = (_b2 = template2.playableFileLocator) == null ? void 0 : _b2.extensionGroups) == null ? void 0 : _c2.map((group) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: group == null ? void 0 : group.name });
          }),
          (_e = (_d = template2.playableFileLocator) == null ? void 0 : _d.extensions) == null ? void 0 : _e.map((ext) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "flat", children: ext });
          }),
          ((_f = template2.playableFileLocator) == null ? void 0 : _f.maxFileCount) && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "warning", size: "sm", variant: "flat", children: t2("Max: {{count}}", {
            count: template2.playableFileLocator.maxFileCount
          }) })
        ] })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Block2,
      {
        description: t2("You can configure which properties your resource includes"),
        leftIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(TbDatabase, { className: "text-large" }),
        rightIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-large" }),
        title: `3. ${t2("Properties")}`,
        onRightIconPress: () => {
          createPortal(PropertySelector, {
            v2: true,
            selection: template2.properties,
            pool: PropertyPool.Reserved | PropertyPool.Custom,
            editable: true,
            addable: true,
            onSubmit: async (properties2) => {
              template2.properties = properties2.map((p2) => ({
                pool: p2.pool,
                id: p2.id,
                property: p2,
                valueLocators: []
              }));
              await putTemplate(template2);
              forceUpdate();
            }
          });
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap items-center gap-1", children: (_g = template2.properties) == null ? void 0 : _g.map((p2, i2) => {
          var _a3;
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { fields: ["name", "pool", "type"], property: p2.property }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: (_a3 = p2.valueLocators) == null ? void 0 : _a3.map((v2) => {
                return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "bordered", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$3, { locator: v2 }) });
              }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    isIconOnly: true,
                    size: "sm",
                    variant: "light",
                    onPress: () => {
                      createPortal(PathPropertyExtractorModal, {
                        locators: p2.valueLocators,
                        onSubmit: async (vls) => {
                          p2.valueLocators = vls;
                          await putTemplate(template2);
                          forceUpdate();
                        }
                      });
                    },
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(IoLocate, { className: "text-base" })
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    isIconOnly: true,
                    color: "danger",
                    size: "sm",
                    variant: "light",
                    onPress: () => {
                      createPortal(Modal, {
                        defaultVisible: true,
                        title: t2("Delete resource filter"),
                        children: t2("Sure to delete?"),
                        onOk: async () => {
                          var _a4;
                          (_a4 = template2.properties) == null ? void 0 : _a4.splice(i2, 1);
                          await putTemplate(template2);
                          forceUpdate();
                        }
                      });
                    },
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-base" })
                  }
                )
              ] })
            ] }, `${p2.pool}-${p2.id}`),
            i2 < template2.properties.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-[1px] h-[12px] bg-divider" })
          ] });
        }) })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Block2,
      {
        description: t2(
          "You can use enhancers to automatically populate resource information or files"
        ),
        leftIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(IoRocketOutline, { className: "text-large" }),
        rightIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-large" }),
        title: `4. ${t2("Enhancers")}`,
        onRightIconPress: () => {
          var _a3;
          createPortal(EnhancerSelectorModal, {
            selectedIds: (_a3 = template2.enhancers) == null ? void 0 : _a3.map((e2) => e2.enhancerId),
            onSubmit: async (ids2) => {
              template2.enhancers = ids2.map((id2) => {
                var _a4;
                return {
                  enhancerId: id2,
                  ...(_a4 = template2.enhancers) == null ? void 0 : _a4.find((x2) => x2.enhancerId == id2)
                };
              });
              await putTemplate(template2);
              forceUpdate();
            }
          });
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: (_h = template2.enhancers) == null ? void 0 : _h.map((e2, i2) => {
          var _a3, _b3;
          const enhancer = enhancers.find((x2) => x2.id == e2.enhancerId);
          if (!enhancer) {
            return t2("Unknown enhancer");
          }
          const keywordProperty = e2.keywordProperty ? (_a3 = propertyMap[e2.keywordProperty.pool]) == null ? void 0 : _a3[e2.keywordProperty.id] : void 0;
          return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(BriefEnhancer, { enhancer }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  size: "sm",
                  variant: "light",
                  onPress: async () => {
                    createPortal(EnhancerOptionsModal, {
                      enhancer,
                      options: JSON.parse(JSON.stringify(e2)),
                      onSubmit: async (options) => {
                        const updatedTemplate = JSON.parse(JSON.stringify(template2));
                        Object.assign(updatedTemplate.enhancers[i2], options);
                        await putTemplate(updatedTemplate);
                        Object.assign(template2, updatedTemplate);
                        const referencedPairs = [];
                        (template2.enhancers ?? []).forEach((enh) => {
                          (enh.targetOptions ?? []).forEach((to2) => {
                            const targetDescriptor = enhancer.targets.find(
                              (x2) => x2.id == to2.target
                            );
                            if ((targetDescriptor == null ? void 0 : targetDescriptor.isDynamic) && to2.dynamicTarget == void 0) {
                              return;
                            }
                            if (to2 && !to2.autoBindProperty && to2.propertyPool != void 0 && to2.propertyPool > 0 && to2.propertyId != void 0) {
                              referencedPairs.push({
                                pool: to2.propertyPool,
                                id: to2.propertyId
                              });
                            }
                          });
                        });
                        const uniqPairs = _$2.uniqBy(referencedPairs, (p2) => `${p2.pool}:${p2.id}`);
                        const boundKeySet = new Set(
                          (template2.properties ?? []).map((p2) => `${p2.pool}:${p2.id}`)
                        );
                        const unboundPairs = uniqPairs.filter(
                          (p2) => !boundKeySet.has(`${p2.pool}:${p2.id}`)
                        );
                        if (unboundPairs.length > 0) {
                          const psr = (await BApi$1.property.getPropertiesByPool(PropertyPool.All)).data || [];
                          const ps = _$2.mapValues(
                            _$2.groupBy(psr, (x2) => x2.pool),
                            (v2) => _$2.keyBy(v2, (x2) => x2.id)
                          );
                          const propsToBind = unboundPairs.map((p2) => ps[p2.pool][p2.id]).filter((x2) => !!x2);
                          if (propsToBind.length > 0) {
                            createPortal(Modal, {
                              defaultVisible: true,
                              title: t2("Bind referenced properties to current template?"),
                              children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 flex-wrap", children: propsToBind.map((p2) => /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { property: p2 }, `${p2.pool}:${p2.id}`)) }),
                              onOk: async () => {
                                template2.properties ?? (template2.properties = []);
                                propsToBind.forEach((pr) => {
                                  template2.properties.push({
                                    pool: pr.pool,
                                    id: pr.id,
                                    property: pr,
                                    valueLocators: []
                                  });
                                });
                                await putTemplate(template2);
                                setPropertyMap(ps);
                                forceUpdate();
                              }
                            });
                          } else {
                            setPropertyMap(ps);
                          }
                        }
                        forceUpdate();
                      }
                    });
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-base" })
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CiCircleMore, { className: "text-base" }) }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs(
                  dropdown_menu_default,
                  {
                    "aria-label": "Enhancer operations",
                    selectionMode: "single",
                    onSelectionChange: (keys2) => {
                      const key = Array.from(keys2 ?? [])[0];
                      if (key === "deleteEnhancements") {
                        createPortal(DeleteEnhancementsModal, {
                          title: t2("Enhancement.DeleteAllByEnhancerForTemplate", {
                            templateName: template2.name
                          }),
                          description: t2(
                            "Enhancement.DeleteAllByEnhancerForTemplate.ScopeWarning"
                          ),
                          onOk: async (deleteEmptyOnly) => {
                            await BApi$1.mediaLibraryTemplate.deleteEnhancementsByMediaLibraryTemplateAndEnhancer(
                              template2.id,
                              e2.enhancerId,
                              { deleteEmptyOnly }
                            );
                            toast.success(t2("Saved"));
                          }
                        });
                      } else if (key === "removeEnhancer") {
                        createPortal(Modal, {
                          defaultVisible: true,
                          title: t2("Delete resource filter"),
                          children: t2("Sure to delete?"),
                          onOk: async () => {
                            var _a4;
                            (_a4 = template2.enhancers) == null ? void 0 : _a4.splice(i2, 1);
                            await putTemplate(template2);
                            forceUpdate();
                          }
                        });
                      }
                    },
                    children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        menu_item_base_default,
                        {
                          className: "text-warning",
                          startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineDelete, { className: "text-lg" }),
                          children: t2("MediaLibrary.DeleteEnhancements")
                        },
                        "deleteEnhancements"
                      ),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        menu_item_base_default,
                        {
                          className: "text-danger",
                          startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineDelete, { className: "text-lg" }),
                          children: t2("MediaLibraryTemplate.RemoveEnhancer")
                        },
                        "removeEnhancer"
                      )
                    ]
                  }
                )
              ] })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs(
              "div",
              {
                className: "grid gap-x-2 text-xs opacity-100",
                style: { gridTemplateColumns: "auto 1fr" },
                children: [
                  e2.requirements && e2.requirements.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(IoGitBranchOutline, { className: "text-lg" }),
                      t2("Prerequisite enhancers")
                    ] }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: e2.requirements.map((r2) => /* @__PURE__ */ jsxRuntimeExports.jsx(BriefEnhancer, { enhancer: enhancers.find((x2) => x2.id == r2) })) })
                  ] }),
                  e2.keywordProperty && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Tooltip$1,
                      {
                        color: "secondary",
                        content: t2(
                          "The property used to generate the keyword for enhancers that need it. Default is file/folder name."
                        ),
                        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx(IoLocate, { className: "text-lg" }),
                          t2("Keyword property")
                        ] })
                      }
                    ),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { property: keywordProperty }),
                      e2.keywordProperty.pool != PropertyPool.Internal && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: t2(
                        `PropertyValueScope.${PropertyValueScope[e2.keywordProperty.scope]}`
                      ) })
                    ] })
                  ] }),
                  e2.pretreatKeyword && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Tooltip$1,
                      {
                        color: "secondary",
                        content: t2("Whether to pretreat the keyword before using it."),
                        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineCleaningServices, { className: "text-lg" }),
                          t2("Pretreat keyword")
                        ] })
                      }
                    ),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(checkbox_default, { isSelected: true, size: "sm" }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        Button,
                        {
                          color: "primary",
                          size: "sm",
                          variant: "light",
                          onPress: () => {
                            createPortal(Modal, {
                              defaultVisible: true,
                              title: t2("About to leave current page"),
                              children: t2("Sure?"),
                              onOk: async () => {
                                navigate("/text");
                              }
                            });
                          },
                          children: t2("Configure special texts for pretreatment")
                        }
                      )
                    ] })
                  ] }),
                  e2.expressions && e2.expressions.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(LuRegex, { className: "text-lg" }),
                      t2("Expressions")
                    ] }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: e2.expressions.map((x2) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: x2 })) })
                  ] })
                ]
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: e2.targetOptions ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap items-center gap-1", children: (_b3 = enhancer == null ? void 0 : enhancer.targets) == null ? void 0 : _b3.map((target, tIdx) => {
              var _a4, _b4, _c3;
              const tos = e2.targetOptions.filter((x2) => x2.target == target.id);
              if (!tos || tos.length == 0) {
                return null;
              }
              if (target.isDynamic) {
                const mainOptions = tos.find((x2) => x2.dynamicTarget == void 0);
                const otherOptions = tos.filter((x2) => x2 != mainOptions);
                return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: target.name }),
                    target.description && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: target.description, children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" }) }),
                    (mainOptions == null ? void 0 : mainOptions.autoBindProperty) && t2("Auto bind property"),
                    (mainOptions == null ? void 0 : mainOptions.autoMatchMultilevelString) && t2("Auto match multilevel string")
                  ] }),
                  otherOptions.map((to2) => {
                    var _a5;
                    const property2 = to2.propertyPool != void 0 && to2.propertyId != void 0 ? (_a5 = propertyMap[to2.propertyPool]) == null ? void 0 : _a5[to2.propertyId] : void 0;
                    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSisternode, { className: "text-base" }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: to2.dynamicTarget }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(TiChevronRightOutline, { className: "text-base" }),
                      to2.autoBindProperty ? t2("Auto bind property") : property2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { property: property2 }) : t2("Unknown property"),
                      to2.autoMatchMultilevelString && t2("Auto match multilevel string")
                    ] });
                  }),
                  tIdx < ((_a4 = enhancer == null ? void 0 : enhancer.targets) == null ? void 0 : _a4.length) - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-[1px] h-full bg-divider" })
                ] });
              } else {
                const to2 = tos[0];
                const property2 = to2.propertyPool != void 0 && to2.propertyId != void 0 ? (_b4 = propertyMap[to2.propertyPool]) == null ? void 0 : _b4[to2.propertyId] : void 0;
                return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                    target.description ? /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: target.description, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: target.name }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: target.name }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(TiChevronRightOutline, { className: "text-base" }),
                    to2.autoBindProperty ? t2("Auto bind property") : property2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { property: property2 }) : t2("Unknown property"),
                    to2.autoMatchMultilevelString && t2("Auto match multilevel string")
                  ] }),
                  tIdx < ((_c3 = enhancer == null ? void 0 : enhancer.targets) == null ? void 0 : _c3.length) - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-[1px] h-[12px] bg-divider" })
                ] });
              }
            }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-60", children: t2(
              "This enhancer won't have any effect since no target property is mapped. You need to configure at least one target property to let enhancer save data to."
            ) }) })
          ] });
        }) })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Block2,
      {
        description: t2("You can customize the display name of the resource"),
        leftIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineSubtitles, { className: "text-large" }),
        rightIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-large" }),
        title: `5. ${t2("Display name template")}`,
        onRightIconPress: () => {
          var _a3;
          createPortal(DisplayNameTemplateEditorModal, {
            properties: ((_a3 = template2.properties) == null ? void 0 : _a3.map((p2) => p2.property)) ?? [],
            template: template2.displayNameTemplate,
            onSubmit: async (templateStr) => {
              template2.displayNameTemplate = templateStr;
              await putTemplate(template2);
              forceUpdate();
            }
          });
        },
        children: template2.displayNameTemplate
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Block2,
      {
        description: t2(
          "You can create cascading resources through sub-templates, where the rules of the sub-template will use the path of the resource determined by the current template as the root directory."
        ),
        descriptionPlacement: "bottom",
        leftIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(TiFlowChildren, { className: "text-large" }),
        title: `6. ${t2("Subresource")}`,
        children: renderChildSelector(template2)
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Block2,
      {
        description: t2("Validate your template on sample resources and see live traces."),
        leftIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineFactCheck, { className: "text-large" }),
        title: `7. ${t2("Validate")}`,
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Button,
            {
              color: "success",
              size: "sm",
              variant: "flat",
              onPress: () => createPortal(ValidateModal, { templateId: template2.id }),
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(VscDebugAll, { className: "text-lg" }),
                t2("Validate")
              ]
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs opacity-70", children: t2(
            "Run a quick validation to check resource discovery, properties, playable files, enhancers and display names."
          ) })
        ] })
      }
    )
  ] });
};
Template.displayName = "Template";
const TemplateModal = ({ id: id2, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  useUpdate();
  const [template2, setTemplate] = reactExports.useState();
  reactExports.useEffect(() => {
    BApi$1.mediaLibraryTemplate.getMediaLibraryTemplate(id2).then((r2) => {
      if (!r2.code) {
        setTemplate(r2.data);
      }
    });
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: false,
      size: "full",
      title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        t2("Editing media library template"),
        " ",
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Chip,
          {
            className: "font-bold",
            color: "success",
            size: "lg",
            variant: "light",
            children: template2 == null ? void 0 : template2.name
          }
        )
      ] }),
      onDestroyed,
      children: template2 && /* @__PURE__ */ jsxRuntimeExports.jsx(Template, { template: template2 })
    }
  );
};
TemplateModal.displayName = "TemplateModal";
const DeleteEnhancementsByEnhancerSelectorModal = ({
  mediaLibraryId,
  mediaLibraryName,
  template: template2,
  onCompleted,
  onDestroyed
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [loading, setLoading] = reactExports.useState(true);
  const [enhancerMap, setEnhancerMap] = reactExports.useState({});
  const [countMap, setCountMap] = reactExports.useState({});
  const enhancerIdsFromTemplate = reactExports.useMemo(() => {
    return ((template2 == null ? void 0 : template2.enhancers) ?? []).map((e2) => e2.enhancerId);
  }, [template2]);
  reactExports.useEffect(() => {
    let mounted = true;
    const load = async () => {
      try {
        const er = await BApi$1.enhancer.getAllEnhancerDescriptors();
        const arr = er.data ?? [];
        const map2 = {};
        arr.forEach((d2) => {
          map2[d2.id] = { id: d2.id, name: d2.name };
        });
        if (mounted)
          setEnhancerMap(map2);
      } finally {
        if (mounted)
          setLoading(false);
      }
    };
    load();
    const loadCounts = async () => {
      if (!mediaLibraryId || enhancerIdsFromTemplate.length === 0)
        return;
      try {
        const r2 = await BApi$1.mediaLibrary.getEnhancedResourceCountsByMediaLibrary(
          mediaLibraryId,
          { enhancerIds: enhancerIdsFromTemplate }
        );
      } catch {
        setCountMap({});
      }
    };
    loadCounts();
    return () => {
      mounted = false;
    };
  }, []);
  const handleClickEnhancer = (enhancerId) => {
    var _a2;
    ((_a2 = enhancerMap[enhancerId]) == null ? void 0 : _a2.name) ?? `#${enhancerId}`;
    createPortal(DeleteEnhancementsModal, {
      title: t2(
        "Delete all enhancement records of this enhancer for category {{categoryName}}",
        { categoryName: mediaLibraryName }
      ),
      onOk: async (deleteEmptyOnly) => {
        await BApi$1.mediaLibrary.deleteEnhancementsByMediaLibraryAndEnhancer(
          mediaLibraryId,
          enhancerId,
          { deleteEmptyOnly }
        );
        onCompleted == null ? void 0 : onCompleted();
      }
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      title: t2("Enhancement.DeleteByEnhancer.SelectEnhancerTitle"),
      onDestroyed,
      footer: { actions: ["cancel"] },
      children: loading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, {}) }) : enhancerIdsFromTemplate.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-500", children: t2("Enhancement.DeleteByEnhancer.NoEnhancerInTemplate") }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2", children: enhancerIdsFromTemplate.map((id2) => /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onPress: () => handleClickEnhancer(id2), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between w-full", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(BriefEnhancer, { enhancer: enhancerMap[id2] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "flat", children: t2("Enhancement.EnhancedResourceCount", { count: countMap[id2] ?? 0 }) })
      ] }) }, id2)) })
    }
  );
};
DeleteEnhancementsByEnhancerSelectorModal.displayName = "DeleteEnhancementsByEnhancerSelectorModal";
function EditableValue({
  onSubmit,
  Viewer,
  viewerProps,
  Editor: Editor2,
  editorProps,
  className,
  trigger = "edit-button",
  ...commonProps2
}) {
  const [editing, setEditing] = reactExports.useState(false);
  const [isSubmitting, setIsSubmitting] = reactExports.useState(false);
  const initValueRef = reactExports.useRef(commonProps2.value ?? commonProps2.defaultValue);
  const [value2, setValue] = reactExports.useState(initValueRef.current);
  console.log(viewerProps, commonProps2, value2);
  useUpdateEffect(() => {
    setValue(commonProps2.value);
  }, [commonProps2.value]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `flex items-center gap-2 ${className}`, children: editing ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Editor2,
      {
        ...editorProps,
        ...commonProps2,
        value: value2,
        onValueChange: (v2) => setValue(v2)
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        isIconOnly: true,
        color: "success",
        isLoading: isSubmitting,
        size: "sm",
        variant: "light",
        onPress: () => {
          const func = onSubmit == null ? void 0 : onSubmit(value2);
          if (isPromise(func)) {
            setIsSubmitting(true);
            func.finally(() => {
              setIsSubmitting(false);
              setEditing(false);
            });
          }
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheck, { className: "text-base" })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        isIconOnly: true,
        color: "danger",
        size: "sm",
        variant: "light",
        onPress: () => {
          setValue(initValueRef.current);
          setEditing(false);
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineClose, { className: "text-base" })
      }
    )
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Viewer,
      {
        ...viewerProps,
        ...commonProps2,
        value: value2,
        isReadOnly: true,
        onClick: () => {
          if (trigger == "viewer") {
            setEditing(true);
          }
        }
      }
    ),
    trigger == "edit-button" && /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        isIconOnly: true,
        size: "sm",
        variant: "light",
        onPress: () => {
          setEditing(true);
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-base" })
      }
    )
  ] }) });
}
const HandleUnknownResourcesModal = ({ onHandled, mediaLibraryId }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [unknownResources, setUnknownResources] = reactExports.useState([]);
  const [loading, setLoading] = reactExports.useState(true);
  const init2 = async () => {
    const r2 = await BApi$1.resource.getUnknownResources({ mediaLibraryId });
    setUnknownResources(r2.data || []);
    setLoading(false);
  };
  reactExports.useEffect(() => {
    init2();
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      title: t2("Choose a method to handle unknown resources"),
      size: "lg",
      footer: false,
      children: loading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center items-center h-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, {}) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4 mb-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
            "When the system fails to find the file or folder corresponding to the resource path, the resource is marked as an unknown resource."
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
            "In most cases, this is caused by changes in the names of files or folders."
          ) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2 justify-around", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            card_default,
            {
              isHoverable: true,
              isPressable: true,
              className: "w-[300px]",
              onPress: () => {
                createPortal(ResourceTransferModal, {
                  fromResources: unknownResources,
                  onDestroyed: () => {
                    onHandled == null ? void 0 : onHandled();
                  }
                });
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs(card_header_default, { className: "flex gap-3 text-lg", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$7, { className: "text-success" }),
                  t2("Transfer data")
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
                /* @__PURE__ */ jsxRuntimeExports.jsxs(card_body_default, { children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                    "You can transfer the data of unknown resources to existing resources."
                  ) }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                    "You can also transfer the data of some of unknown resources to existing resources first, and then delete the remaining unknown resources."
                  ) })
                ] })
              ]
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            card_default,
            {
              isHoverable: true,
              isPressable: true,
              className: "w-[300px]",
              onPress: () => {
                createPortal(Modal, {
                  defaultVisible: true,
                  title: t2(
                    "Delete {{count}} unknown resources permanently",
                    { count: unknownResources.length }
                  ),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                    "Be careful, this operation can not be undone"
                  ) }),
                  onOk: async () => {
                    await BApi$1.resource.deleteUnknownResources({ mediaLibraryId });
                    init2();
                    onHandled == null ? void 0 : onHandled();
                  }
                });
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs(card_header_default, { className: "flex gap-3 text-lg", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-danger" }),
                  t2(
                    "Delete {{count}} unknown resources permanently",
                    { count: unknownResources.length }
                  )
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
                /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                  "You can delete all unknown resources permanently."
                ) }) })
              ]
            }
          )
        ] })
      ] })
    }
  );
};
HandleUnknownResourcesModal.displayName = "HandleUnknownResourcesModal";
var SortBy = /* @__PURE__ */ ((SortBy2) => {
  SortBy2[SortBy2["Path"] = 1] = "Path";
  SortBy2[SortBy2["Template"] = 2] = "Template";
  return SortBy2;
})(SortBy || {});
const MediaLibraryPage = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const navigate = useNavigate();
  const [mediaLibraries, setMediaLibraries] = reactExports.useState([]);
  const [templates2, setTemplates] = reactExports.useState([]);
  const templatesRef = reactExports.useRef({});
  const [sortBy, setSortBy] = reactExports.useState(
    1
    /* Path */
  );
  const forceUpdate = useUpdate();
  const outdatedModalRef = reactExports.useRef(null);
  const [unknownResourceCounts, setUnknownResourceCounts] = reactExports.useState();
  const resourceOptionsStore = useResourceOptionsStore();
  const resourceOptions = resourceOptionsStore.data;
  const loadMediaLibraries = async () => {
    const r2 = await BApi$1.mediaLibraryV2.getAllMediaLibraryV2();
    const list2 = r2.data ?? [];
    setMediaLibraries(list2);
    const unknown = await BApi$1.resource.getUnknownResourcesCount();
    setUnknownResourceCounts(unknown.data);
    return list2;
  };
  const loadTemplates = async () => {
    const r2 = await BApi$1.mediaLibraryTemplate.getAllMediaLibraryTemplates();
    const tpls = r2.data ?? [];
    setTemplates(tpls);
    templatesRef.current = tpls.reduce((s2, t22) => {
      s2[t22.id] = t22;
      return s2;
    }, {});
  };
  reactExports.useEffect(() => {
    Promise.all([loadTemplates(), loadMediaLibraries()]).then(() => {
      var _a2;
      (_a2 = outdatedModalRef.current) == null ? void 0 : _a2.check();
    });
  }, []);
  useUpdateEffect(() => {
    switch (sortBy) {
      case 1:
        mediaLibraries.sort((a2, b2) => (a2.paths[0] ?? "").localeCompare(b2.paths[0] ?? ""));
        break;
      case 2:
        mediaLibraries.sort(
          (a2, b2) => {
            var _a2, _b2;
            return (((_a2 = templatesRef.current[a2.templateId ?? 0]) == null ? void 0 : _a2.name) ?? "").localeCompare(
              ((_b2 = templatesRef.current[b2.templateId ?? 0]) == null ? void 0 : _b2.name) ?? ""
            );
          }
        );
        break;
    }
    forceUpdate();
  }, [sortBy, mediaLibraries]);
  const renderPath = (ml2) => {
    const paths = ml2.paths ?? [];
    if (paths.length == 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "primary",
          size: "sm",
          variant: "light",
          onPress: () => {
            ml2.paths.push("");
            forceUpdate();
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-lg" })
        }
      );
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: paths.map((p2, idx) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          EditableValue,
          {
            className: "grow",
            Viewer: ({ value: value2, ...props }) => value2 ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
              Button,
              {
                className: "justify-start",
                color: "default",
                size: "sm",
                variant: "flat",
                onPress: () => BApi$1.tool.openFileOrDirectory({ path: p2 }),
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolderOpen, { className: "text-lg" }),
                  value2
                ]
              },
              idx
            ) : null,
            Editor: ({ onValueChange, ...props }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
              PathAutocomplete,
              {
                maxResults: 100,
                label: paths.length > 1 ? `${t2("MediaLibrary.Path")}${idx + 1}` : t2("MediaLibrary.Path"),
                pathType: "folder",
                placeholder: t2("MediaLibrary.PathPlaceholder"),
                size: "sm",
                onSelectionChange: onValueChange,
                ...props
              }
            ),
            onSubmit: async (v2) => {
              var _a2;
              paths[idx] = v2 ?? "";
              ml2.paths = paths;
              await BApi$1.mediaLibraryV2.patchMediaLibraryV2(ml2.id, {
                paths
              });
              (_a2 = outdatedModalRef.current) == null ? void 0 : _a2.check();
              forceUpdate();
            },
            defaultValue: p2
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "primary",
            size: "sm",
            variant: "light",
            onPress: () => {
              ml2.paths.push("");
              forceUpdate();
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-lg" })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "danger",
            size: "sm",
            variant: "light",
            onPress: () => {
              createPortal(Modal, {
                defaultVisible: true,
                title: t2("Remove folder from media library?"),
                children: t2("This operation will not affect the files in the directory."),
                onOk: async () => {
                  var _a2;
                  const newPaths = (_a2 = ml2.paths) == null ? void 0 : _a2.filter((x2) => x2 != p2);
                  const rsp = await BApi$1.mediaLibraryV2.patchMediaLibraryV2(ml2.id, {
                    paths: newPaths
                  });
                  if (!rsp.code) {
                    ml2.paths = newPaths;
                    forceUpdate();
                  }
                }
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-lg" })
          }
        )
      ] }, p2);
    }) });
  };
  const mediaLibraryUnknownResourcesCounts = (unknownResourceCounts == null ? void 0 : unknownResourceCounts.unknownPathCountByMediaLibraryId) ?? {};
  const renderTable = () => {
    if (mediaLibraries.length === 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 grow justify-center", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(PiEmpty, { className: "text-2xl" }),
        t2("MediaLibrary.NoMediaLibrariesFound")
      ] });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { removeWrapper: true, className: "mt-2 overflow-x-auto", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("MediaLibrary.Name") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("MediaLibrary.Path") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("MediaLibrary.Template") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("MediaLibrary.Players") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: "200", children: t2("Operations") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: mediaLibraries.map((row, i2) => {
        const ml2 = row;
        const template2 = templates2.find((t22) => t22.id == ml2.templateId);
        const getCssVariable = (variableName) => {
          if (typeof document === "undefined")
            return "";
          return getComputedStyle(document.documentElement).getPropertyValue(variableName);
        };
        const textColor = getCssVariable("--theme-text") || "#222";
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              EditableValue,
              {
                Editor: input_default,
                Viewer: ({ value: value2, ...props }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    size: "sm",
                    style: { color: ml2.color ?? textColor },
                    variant: "light",
                    className: "whitespace-break-spaces h-auto text-left",
                    ...props,
                    children: value2
                  }
                ),
                editorProps: {
                  size: "sm",
                  isRequired: true
                },
                trigger: "viewer",
                value: ml2.name,
                onSubmit: async (v2) => {
                  if (v2 == void 0 || v2.length == 0) {
                    toast.danger(t2("Name cannot be empty"));
                    return;
                  }
                  const rsp = await BApi$1.mediaLibraryV2.patchMediaLibraryV2(ml2.id, {
                    name: v2
                  });
                  if (!rsp.code) {
                    ml2.name = v2;
                    forceUpdate();
                  }
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              ColorPicker$1,
              {
                color: ml2.color ?? textColor,
                onChange: async (color2) => {
                  const strColor = buildColorValueString(color2);
                  await BApi$1.mediaLibraryV2.putMediaLibraryV2(ml2.id, {
                    ...ml2,
                    color: strColor
                  });
                  ml2.color = strColor;
                  forceUpdate();
                }
              }
            )
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: renderPath(ml2) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            EditableValue,
            {
              Editor: ({ onValueChange, value: value2, ...props }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
                Select,
                {
                  isRequired: true,
                  dataSource: templates2.map(
                    (t22) => ({
                      textValue: `#${t22.id} ${t22.name}`,
                      label: `#${t22.id} ${t22.name}`,
                      value: t22.id
                    })
                  ).concat([
                    {
                      label: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineImport, { className: "text-lg" }),
                        t2("MediaLibrary.CreateNewTemplate")
                      ] }),
                      value: -1,
                      textValue: t2("MediaLibrary.CreateNewTemplate")
                    }
                  ]),
                  isInvalid: value2 == void 0 || value2 <= 0,
                  label: t2("MediaLibrary.Template"),
                  placeholder: t2("MediaLibrary.TemplatePlaceholder"),
                  selectedKeys: value2 ? [value2.toString()] : void 0,
                  size: "sm",
                  onSelectionChange: (keys2) => {
                    const arr = Array.from(keys2);
                    if (arr.length > 0) {
                      const idStr = arr[0];
                      const value22 = parseInt(idStr, 10);
                      if (value22 == -1) {
                        createPortal(PresetTemplateBuilder, {
                          onSubmitted: async (id2) => {
                            onValueChange == null ? void 0 : onValueChange(id2);
                            await loadTemplates();
                          }
                        });
                      } else {
                        onValueChange == null ? void 0 : onValueChange(value22);
                        forceUpdate();
                      }
                    }
                  }
                }
              ),
              Viewer: ({ value: value2 }) => value2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  className: "text-left",
                  isDisabled: !template2,
                  radius: "sm",
                  size: "sm",
                  startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(TbTemplate, { className: "text-base" }),
                  variant: "light",
                  onPress: () => {
                    if (ml2.templateId) {
                      createPortal(TemplateModal, {
                        id: ml2.templateId,
                        onDestroyed: loadTemplates
                      });
                    }
                  },
                  children: (template2 == null ? void 0 : template2.name) ?? t2("MediaLibrary.Unknown")
                }
              ) : /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "light", color: "danger", children: t2("Media library template must be set") }),
              className: "grow",
              editorProps: {
                // size: "sm",
              },
              value: ml2.templateId,
              onSubmit: async (v2) => {
                var _a2;
                if (v2 == void 0 || v2 <= 0) {
                  toast.danger(t2("Template cannot be empty"));
                  return;
                }
                if (ml2.templateId != v2) {
                  ml2.templateId = v2;
                  const rsp = await BApi$1.mediaLibraryV2.patchMediaLibraryV2(ml2.id, {
                    templateId: v2
                  });
                  if (!rsp.code) {
                    (_a2 = outdatedModalRef.current) == null ? void 0 : _a2.check();
                    forceUpdate();
                  }
                }
              }
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Setup custom players"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                radius: "sm",
                size: "sm",
                variant: "light",
                onPress: () => {
                  createPortal(PlayerSelectorModal, {
                    players: ml2.players,
                    onSubmit: async (players) => {
                      await BApi$1.mediaLibraryV2.putMediaLibraryV2(ml2.id, {
                        ...ml2,
                        players
                      });
                      await loadMediaLibraries();
                    }
                  });
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(BsController, { className: "text-lg" })
              }
            ) }),
            ml2.players && ml2.players.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: ml2.players.map((player, index2) => {
              var _a2;
              const executablePathSegments = splitPathIntoSegments(
                player.executablePath
              );
              return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 text-xs", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium truncate", children: executablePathSegments[executablePathSegments.length - 1] }),
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-gray-500", children: [
                    t2("Command"),
                    ": ",
                    player.command
                  ] })
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-1", children: [
                  (_a2 = player.extensions) == null ? void 0 : _a2.map((ext) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "flat", children: ext }, ext)),
                  player.extensions && player.extensions.length > 3 && /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { color: "secondary", size: "sm", variant: "flat", children: [
                    "+",
                    player.extensions.length - 3
                  ] })
                ] })
              ] }, index2);
            }) })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: ml2.resourceCount > 0 ? t2("{{count}} resource(s) loaded in this media library.", {
              count: ml2.resourceCount
            }) : t2("No resource loaded in this media library, you can click the synchronize button to load resources."), placement: "top", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                color: "success",
                size: "sm",
                startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineProduct, { className: "text-lg" }),
                variant: "light",
                children: ml2.resourceCount
              }
            ) }),
            mediaLibraryUnknownResourcesCounts[ml2.id] > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Handle {{count}} unknown resources in this media library", { count: mediaLibraryUnknownResourcesCounts[ml2.id] }), placement: "top", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                radius: "sm",
                size: "sm",
                color: "warning",
                variant: "light",
                onPress: async () => {
                  createPortal(HandleUnknownResourcesModal, {
                    mediaLibraryId: ml2.id,
                    onHandled: () => loadMediaLibraries()
                  });
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFileUnknown, { className: "text-lg" })
              }
            ) }),
            ml2.resourceCount > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("MediaLibrary.SearchResources"), placement: "top", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                className: "",
                radius: "sm",
                size: "sm",
                variant: "light",
                onPress: () => {
                  createPortal(Modal, {
                    title: t2("MediaLibrary.Confirm"),
                    children: t2("MediaLibrary.LeavePageConfirm"),
                    defaultVisible: true,
                    onOk: async () => {
                      const valuePropertyResponse = await BApi$1.resource.getFilterValueProperty({
                        propertyPool: PropertyPool.Internal,
                        propertyId: InternalProperty.MediaLibraryV2,
                        operation: SearchOperation.Equals
                      });
                      const searchForm = {
                        group: {
                          combinator: 1,
                          disabled: false,
                          filters: [
                            {
                              propertyPool: PropertyPool.Internal,
                              propertyId: InternalProperty.MediaLibraryV2,
                              operation: SearchOperation.Equals,
                              dbValue: ml2.id.toString(),
                              bizValue: ml2.name,
                              valueProperty: valuePropertyResponse.data,
                              disabled: false
                            }
                          ]
                        },
                        page: 1,
                        pageSize: 100
                      };
                      const query = encodeURIComponent(JSON.stringify(searchForm));
                      navigate(`/resource2?query=${query}`);
                    },
                    footer: {
                      actions: ["ok", "cancel"],
                      okProps: {
                        children: t2("MediaLibrary.Continue")
                      },
                      cancelProps: {
                        children: t2("MediaLibrary.Cancel")
                      }
                    }
                  });
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSearch, { className: "text-lg" })
              }
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              SyncStatus,
              {
                id: ml2.id,
                onSyncCompleted: () => {
                  loadMediaLibraries();
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, radius: "sm", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CiCircleMore, { className: "text-lg" }) }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs(
                dropdown_menu_default,
                {
                  "aria-label": "More operations",
                  selectionMode: "single",
                  onSelectionChange: (keys2) => {
                    const key = Array.from(keys2 ?? [])[0];
                    if (key === "deleteEnhancements") {
                      createPortal(DeleteEnhancementsByEnhancerSelectorModal, {
                        mediaLibraryId: ml2.id,
                        mediaLibraryName: ml2.name,
                        template: template2,
                        onCompleted: async () => {
                          var _a2;
                          toast.success(t2("Saved"));
                          (_a2 = outdatedModalRef.current) == null ? void 0 : _a2.check();
                        }
                      });
                    } else if (key === "moveResourcesToOtherMediaLibrary") {
                      createPortal(MediaLibrarySelectorV2, {
                        confirmation: true,
                        onSelect: async (toId, isLegacy) => {
                          if (isLegacy) {
                            toast.danger(t2("Only media library v2 is supported"));
                            return;
                          }
                          if (toId === ml2.id) {
                            toast.warning(t2("Cannot move resources to the same media library"));
                            return;
                          }
                          try {
                            const valuePropertyResponse = await BApi$1.resource.getFilterValueProperty({
                              propertyPool: PropertyPool.Internal,
                              propertyId: InternalProperty.MediaLibraryV2,
                              operation: SearchOperation.Equals
                            });
                            const searchForm = {
                              group: {
                                combinator: 1,
                                disabled: false,
                                filters: [
                                  {
                                    propertyPool: PropertyPool.Internal,
                                    propertyId: InternalProperty.MediaLibraryV2,
                                    operation: SearchOperation.Equals,
                                    dbValue: ml2.id.toString(),
                                    bizValue: ml2.name,
                                    valueProperty: valuePropertyResponse.data,
                                    disabled: false
                                  }
                                ]
                              },
                              page: 1,
                              pageSize: 1e6
                            };
                            const idsResp = await BApi$1.resource.searchAllResourceIds(searchForm);
                            const ids2 = idsResp.data || [];
                            if (ids2.length > 0) {
                              await BApi$1.resource.moveResources({
                                ids: ids2,
                                mediaLibraryId: toId,
                                isLegacyMediaLibrary: false
                              });
                            }
                            createPortal(Modal, {
                              defaultVisible: true,
                              title: t2("MediaLibrary.Confirm"),
                              children: t2("Move resources completed. Delete the source media library?"),
                              onOk: async () => {
                                await BApi$1.mediaLibraryV2.deleteMediaLibraryV2(ml2.id);
                                await loadMediaLibraries();
                              },
                              onClose: async () => {
                                await loadMediaLibraries();
                              },
                              footer: {
                                actions: ["ok", "cancel"],
                                okProps: { children: t2("Delete"), color: "danger" },
                                cancelProps: { children: t2("Keep it"), color: "default" }
                              }
                            });
                          } catch (e2) {
                            toast.danger(t2("Operation failed"));
                          }
                        }
                      });
                    } else if (key === "deleteMediaLibrary") {
                      createPortal(Modal, {
                        defaultVisible: true,
                        title: t2("MediaLibrary.Confirm"),
                        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                          t2("MediaLibrary.DeleteConfirm"),
                          /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
                          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-danger", children: t2("Be careful, this operation can not be undone") })
                        ] }),
                        onOk: async () => {
                          await BApi$1.mediaLibraryV2.deleteMediaLibraryV2(ml2.id);
                          loadMediaLibraries();
                        },
                        footer: {
                          actions: ["ok", "cancel"],
                          okProps: {
                            children: t2("Delete"),
                            color: "danger",
                            autoFocus: true
                          },
                          cancelProps: {
                            children: t2("MediaLibrary.Cancel")
                          }
                        }
                      });
                    }
                  },
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      menu_item_base_default,
                      {
                        className: "text-warning",
                        startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineDelete, { className: "text-lg" }),
                        children: t2("MediaLibrary.DeleteEnhancements")
                      },
                      "deleteEnhancements"
                    ),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      menu_item_base_default,
                      {
                        className: "text-primary",
                        startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineImport, { className: "text-lg" }),
                        children: t2("Move resources to another media library")
                      },
                      "moveResourcesToOtherMediaLibrary"
                    ),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      menu_item_base_default,
                      {
                        className: "text-danger",
                        startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineDelete, { className: "text-lg" }),
                        children: t2("Delete this media library")
                      },
                      "deleteMediaLibrary"
                    )
                  ]
                }
              )
            ] })
          ] }) })
        ] }, ml2.id);
      }) })
    ] });
  };
  const unknownMediaLibraryResourceCount = (unknownResourceCounts == null ? void 0 : unknownResourceCounts.unknownMediaLibraryCount) ?? 0;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(OutdatedModal, { ref: (r2) => outdatedModalRef.current = r2 }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "primary",
            size: "sm",
            onPress: async () => {
              const no = mediaLibraries.map((ml2) => ml2.name.split(" ")).filter((x2) => x2.length > 1).map((x2) => parseInt(x2[1], 10)).reduce((a2, b2) => Math.max(a2, b2), 0) + 1;
              const name2 = `${t2("Media library")} ${no}`;
              await BApi$1.mediaLibraryV2.addMediaLibraryV2({
                name: name2,
                paths: []
              });
              await loadMediaLibraries();
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-lg" }),
              t2("MediaLibrary.Add")
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "secondary",
            size: "sm",
            onPress: () => {
              BApi$1.mediaLibraryV2.syncAllMediaLibrariesV2();
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(IoIosSync, { className: "text-lg" }),
              t2("MediaLibrary.SynchronizeAll")
            ]
          }
        ),
        unknownMediaLibraryResourceCount > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            isIconOnly: true,
            radius: "sm",
            size: "sm",
            variant: "light",
            onPress: async () => {
              createPortal(HandleUnknownResourcesModal, {
                onHandled: () => loadMediaLibraries()
              });
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFileUnknown, { className: "text-lg" }),
              t2("Handle {{count}} unknown resources", { count: unknownMediaLibraryResourceCount })
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Tooltip$1,
          {
            content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-md space-y-2 text-sm p-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "By default, when a folder path changes, the resource data will be created as a new resource."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "If you enable this feature, a hidden .bakabase.json file will be generated inside folder resources to store their resource IDs."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "During synchronization, if a folder path changes but contains a .bakabase.json with any matching resource IDs, the resource data will be preserved instead of creating a new resource."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "Since a path can be added to multiple media libraries, resources under each path will be tracked per media library."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "Only supports resources in new version (V2) media libraries. Legacy resources (category-based media libraries) are not supported."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-warning", children: t2(
                "Enabling this feature will increase synchronization time as marker files need to be generated and verified."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold text-warning", children: t2(
                "This feature will work after a complete GenerateResourceMarker task finishes."
              ) })
            ] }),
            placement: "bottom-start",
            closeDelay: 200,
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm font-medium", children: [
                t2("Keep resources on path change"),
                /* @__PURE__ */ jsxRuntimeExports.jsx(BetaChip, {})
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                switch_default,
                {
                  size: "sm",
                  isSelected: (resourceOptions == null ? void 0 : resourceOptions.keepResourcesOnPathChange) ?? false,
                  onValueChange: async (v2) => {
                    if (!v2) {
                      const tasks = useBTasksStore.getState().tasks;
                      const keepResourcesTask = tasks.find(
                        (t22) => t22.id === "GenerateResourceMarker" && (t22.status === BTaskStatus.Running || t22.status === BTaskStatus.Paused)
                      );
                      if (keepResourcesTask) {
                        const shouldContinue = await new Promise((resolve2) => {
                          createPortal(Modal, {
                            defaultVisible: true,
                            title: t2("Confirm disabling resource markers"),
                            size: "md",
                            footer: {
                              actions: ["cancel", "ok"],
                              okProps: {
                                text: t2("Confirm and stop task"),
                                color: "danger"
                              },
                              cancelProps: {
                                text: t2("Cancel")
                              }
                            },
                            onOk: () => resolve2(true),
                            onClose: () => resolve2(false),
                            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
                              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                                "The GenerateResourceMarker task is currently running."
                              ) }),
                              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                                "Disabling this feature will stop the task. Are you sure you want to continue?"
                              ) })
                            ] })
                          });
                        });
                        if (!shouldContinue) {
                          return;
                        }
                        try {
                          await BApi$1.backgroundTask.stopBackgroundTask("GenerateResourceMarker", { confirm: true });
                        } catch (e2) {
                          console.error("Failed to stop task:", e2);
                        }
                      }
                      const deleteMarkers = await new Promise((resolve2) => {
                        createPortal(Modal, {
                          defaultVisible: true,
                          title: t2("Delete marker files?"),
                          size: "md",
                          footer: {
                            actions: ["cancel", "ok"],
                            okProps: {
                              text: t2("Delete markers"),
                              color: "warning"
                            },
                            cancelProps: {
                              text: t2("Keep markers")
                            }
                          },
                          onOk: () => resolve2(true),
                          onClose: () => resolve2(false),
                          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                              "Do you want to delete all .bakabase.json marker files?"
                            ) }),
                            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm opacity-70", children: t2(
                              "If you keep them, existing markers will remain in the folders."
                            ) })
                          ] })
                        });
                      });
                      await BApi$1.options.patchResourceOptions({
                        keepResourcesOnPathChange: false
                      });
                      if (deleteMarkers) {
                        await new Promise((resolve2) => {
                          const DeletionProgressModal = () => {
                            const [progressState, setProgressState] = reactExports.useState({
                              percentage: 0,
                              total: 0,
                              processed: 0,
                              deleted: 0,
                              failed: 0,
                              currentPath: ""
                            });
                            const [visible, setVisible] = reactExports.useState(true);
                            const [showStopConfirm, setShowStopConfirm] = reactExports.useState(false);
                            const [isStopping, setIsStopping] = reactExports.useState(false);
                            const [isCancelled, setIsCancelled] = reactExports.useState(false);
                            const abortControllerRef = reactExports.useRef(null);
                            reactExports.useEffect(() => {
                              const abortController = new AbortController();
                              abortControllerRef.current = abortController;
                              const startDeletion = async () => {
                                try {
                                  const url2 = `${envConfig.apiEndpoint}/options/resource/delete-markers`;
                                  const resp = await fetch(url2, {
                                    method: "POST",
                                    signal: abortController.signal
                                  });
                                  if (!resp.ok || !resp.body) {
                                    throw new Error(`Request failed: ${resp.status}`);
                                  }
                                  const reader = resp.body.getReader();
                                  const decoder = new TextDecoder();
                                  let buffer = "";
                                  while (true) {
                                    const { value: value2, done } = await reader.read();
                                    if (done)
                                      break;
                                    buffer += decoder.decode(value2, { stream: true });
                                    let idx;
                                    while ((idx = buffer.indexOf("\n")) >= 0) {
                                      const line2 = buffer.slice(0, idx).trim();
                                      buffer = buffer.slice(idx + 1);
                                      if (!line2)
                                        continue;
                                      try {
                                        const obj = JSON.parse(line2);
                                        if (obj.type === "progress" || obj.type === "complete") {
                                          setProgressState({
                                            percentage: obj.percentage || 0,
                                            total: obj.total || 0,
                                            processed: obj.processed || obj.total || 0,
                                            deleted: obj.deleted || 0,
                                            failed: obj.failed || 0,
                                            currentPath: obj.currentResourcePath || ""
                                          });
                                        } else if (obj.type === "cancelled") {
                                          setIsCancelled(true);
                                          toast.warning(t2("Operation stopped. Some marker files may remain and need to be deleted manually."));
                                        } else if (obj.type === "error") {
                                          toast.danger(obj.message || "Error deleting markers");
                                        }
                                      } catch {
                                      }
                                    }
                                  }
                                } catch (e2) {
                                  if (e2.name !== "AbortError") {
                                    toast.danger(t2("Failed to delete markers"));
                                  } else if (isStopping) {
                                    setIsCancelled(true);
                                  }
                                } finally {
                                  setVisible(false);
                                  setTimeout(() => resolve2(), 500);
                                }
                              };
                              startDeletion();
                              return () => {
                                abortController.abort();
                              };
                            }, []);
                            const handleStopClick = () => {
                              setShowStopConfirm(true);
                            };
                            const handleConfirmStop = () => {
                              setIsStopping(true);
                              setShowStopConfirm(false);
                              if (abortControllerRef.current) {
                                abortControllerRef.current.abort();
                              }
                            };
                            return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                              /* @__PURE__ */ jsxRuntimeExports.jsx(
                                Modal,
                                {
                                  visible,
                                  title: t2("Deleting resource markers"),
                                  size: "md",
                                  isDismissable: false,
                                  hideCloseButton: true,
                                  footer: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                                    Button,
                                    {
                                      color: "danger",
                                      variant: "light",
                                      onClick: handleStopClick,
                                      isDisabled: isStopping || isCancelled,
                                      children: isStopping ? t2("Stopping...") : t2("Stop")
                                    }
                                  ) }),
                                  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4 py-4", children: [
                                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3", children: [
                                      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-primary" }),
                                      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1", children: [
                                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium", children: t2("Processing {{processed}} of {{total}} resources", {
                                          processed: progressState.processed,
                                          total: progressState.total
                                        }) }),
                                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-500", children: t2("Deleted: {{deleted}}, Failed: {{failed}}", {
                                          deleted: progressState.deleted,
                                          failed: progressState.failed
                                        }) })
                                      ] }),
                                      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xl font-bold", children: [
                                        progressState.percentage,
                                        "%"
                                      ] })
                                    ] }),
                                    progressState.currentPath && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-gray-500 truncate", children: progressState.currentPath }),
                                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full bg-gray-200 rounded-full h-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                                      "div",
                                      {
                                        className: "bg-primary h-2 rounded-full transition-all duration-300",
                                        style: { width: `${progressState.percentage}%` }
                                      }
                                    ) })
                                  ] })
                                }
                              ),
                              /* @__PURE__ */ jsxRuntimeExports.jsx(
                                Modal,
                                {
                                  visible: showStopConfirm,
                                  title: t2("Stop deletion operation?"),
                                  size: "md",
                                  onClose: () => setShowStopConfirm(false),
                                  footer: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-end gap-2", children: [
                                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                                      Button,
                                      {
                                        variant: "light",
                                        onClick: () => setShowStopConfirm(false),
                                        children: t2("Cancel")
                                      }
                                    ),
                                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                                      Button,
                                      {
                                        color: "danger",
                                        onClick: handleConfirmStop,
                                        children: t2("Stop operation")
                                      }
                                    )
                                  ] }),
                                  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
                                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-warning font-semibold", children: t2("Warning") }),
                                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("If you stop this operation now, you will need to delete the remaining marker files manually.") }),
                                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-[var(--bakaui-overlap-background)] p-3 rounded", children: [
                                      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium mb-2", children: t2("Marker file information:") }),
                                      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-sm space-y-1", children: [
                                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("File name: {{filename}}", { filename: ".bakabase.json" }) }),
                                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Location: Inside folder resources") }),
                                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Attribute: Hidden file") })
                                      ] })
                                    ] }),
                                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-600", children: t2("You can search for and delete these files using your file manager or terminal.") })
                                  ] })
                                }
                              )
                            ] });
                          };
                          createPortal(DeletionProgressModal, {});
                        });
                      }
                    } else {
                      await BApi$1.options.patchResourceOptions({
                        keepResourcesOnPathChange: true
                      });
                    }
                    toast.success(t2("Saved"));
                  }
                }
              )
            ] })
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          color: "warning",
          size: "sm",
          variant: "flat",
          onPress: () => setSortBy(
            1 == sortBy ? 2 : 1
            /* Path */
          ),
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(FaSort, { className: "text-base" }),
            t2("MediaLibrary.SortBy", {
              sortBy: t2(`MediaLibrary.SortBy.${SortBy[sortBy]}`)
            })
          ]
        }
      ) })
    ] }),
    renderTable()
  ] });
};
MediaLibraryPage.displayName = "MediaLibraryPage";
function GoShareAndroid(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M20 5.5a3.498 3.498 0 0 1-6.062 2.385l-5.112 3.021a3.498 3.498 0 0 1 0 2.188l5.112 3.021a3.5 3.5 0 1 1-.764 1.29l-5.112-3.02a3.499 3.499 0 1 1-3.843-5.642 3.499 3.499 0 0 1 3.843.872l5.112-3.021A3.5 3.5 0 1 1 20 5.5Zm-1.5 13a2 2 0 1 0-3.999-.001 2 2 0 0 0 3.999.001Zm0-13a2 2 0 1 0-3.999-.001A2 2 0 0 0 18.5 5.5ZM5.5 14a2 2 0 1 0 .001-3.999A2 2 0 0 0 5.5 14Z" }, "child": [] }] })(props);
}
const MissingDataMessage = "The current template contains data missing from the application. Please configure how to handle this data before proceeding with the import.";
const findProperExtensionGroup = (extensionGroup, extensionGroups) => {
  const candidates = extensionGroups.filter(
    (eg2) => _$2.xor(extensionGroup.extensions, eg2.extensions).length === 0
  );
  const best = candidates.find((eg2) => eg2.name === extensionGroup.name);
  return best ?? candidates[0];
};
const validate$4 = (propertyConversionMap, extensionGroupConversionMap, configuration) => {
  if (!configuration || !configuration.noNeedToConfigure) {
    return true;
  }
  if (configuration.uniqueExtensionGroups && configuration.uniqueExtensionGroups.length > _$2.keys(extensionGroupConversionMap).length) {
    return false;
  }
  if (configuration.uniqueCustomProperties && configuration.uniqueCustomProperties.length > _$2.keys(propertyConversionMap).length) {
    return false;
  }
  return true;
};
const ImportModal = ({ onImported }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [shareCode, setShareCode] = reactExports.useState();
  const [configuration, setConfiguration] = reactExports.useState();
  const [propertyConversionsMap, setPropertyConversionsMap] = reactExports.useState();
  const [extensionGroupConversionsMap, setExtensionGroupConversionsMap] = reactExports.useState();
  const [propertyMap, setPropertyMap] = reactExports.useState(
    void 0
  );
  const [extensionGroups, setExtensionGroups] = reactExports.useState(void 0);
  const initDataForImport = async () => {
    if (!propertyMap) {
      const pr = await BApi$1.property.getPropertiesByPool(
        PropertyPool.Custom | PropertyPool.Reserved
      );
      const pm = (pr.data ?? []).reduce((s2, t22) => {
        var _a2;
        const m2 = s2[_a2 = t22.pool] ?? (s2[_a2] = {});
        m2[t22.id] = t22;
        return s2;
      }, {});
      setPropertyMap(pm);
    }
    if (!extensionGroups) {
      const eg2 = await BApi$1.extensionGroup.getAllExtensionGroups();
      setExtensionGroups(eg2.data ?? []);
    }
  };
  const $import = async () => {
    const model = {
      shareCode,
      customPropertyConversionsMap: propertyConversionsMap,
      extensionGroupConversionsMap,
      automaticallyCreateMissingData: false
    };
    return await BApi$1.mediaLibraryTemplate.importMediaLibraryTemplate(model);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          isDisabled: !shareCode && !validate$4(
            propertyConversionsMap,
            extensionGroupConversionsMap,
            configuration
          ),
          children: t2("Import")
        }
      },
      size: "lg",
      title: t2("Import media library template"),
      onOk: async () => {
        if (!configuration) {
          const importConfigurationResp = await BApi$1.mediaLibraryTemplate.getMediaLibraryTemplateImportConfiguration(
            shareCode
          );
          if (importConfigurationResp.code) {
            const msg = `${t2("Failed to get media library template import configuration")}:${importConfigurationResp.message}`;
            Vt.error(msg);
            throw new Error(msg);
          } else {
            setConfiguration(importConfigurationResp.data);
            if (!importConfigurationResp.data.noNeedToConfigure) {
              await initDataForImport();
              throw new Error(t2(MissingDataMessage));
            }
          }
        }
        const importResult = await $import();
        if (importResult.code) {
          const msg = `${t2("Failed to import media library template")}:${importResult.message}`;
          Vt.error(msg);
          throw new Error(msg);
        } else {
          onImported == null ? void 0 : onImported();
        }
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            textarea_default,
            {
              isRequired: true,
              isDisabled: !!configuration,
              label: t2("Share code"),
              placeholder: t2("Paste share code here"),
              value: shareCode,
              onValueChange: setShareCode
            }
          ),
          configuration && /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Button,
            {
              className: "mt-2",
              color: "default",
              size: "sm",
              onPress: () => {
                setShareCode("");
                setConfiguration(void 0);
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(IoSync, {}),
                t2("Change share code")
              ]
            }
          )
        ] }),
        configuration && !configuration.noNeedToConfigure && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(alert_default, { color: "warning", title: t2(MissingDataMessage) }) }),
          configuration.uniqueCustomProperties && configuration.uniqueCustomProperties.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 text-lg font-bold", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(TbSectionSign, { className: "" }),
              t2("New properties"),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                PropertiesMatcher,
                {
                  properties: configuration.uniqueCustomProperties.map(
                    (p2) => ({ type: p2.type, name: p2.name })
                  ),
                  onValueChanged: (ps) => {
                    const pcm = propertyConversionsMap ?? {};
                    for (let i2 = 0; i2 < configuration.uniqueCustomProperties.length; i2++) {
                      const p2 = ps[i2];
                      if (p2) {
                        pcm[i2] = {
                          toPropertyId: p2.id,
                          toPropertyPool: p2.pool,
                          toProperty: p2
                        };
                      }
                    }
                    setPropertyConversionsMap(pcm);
                  }
                }
              )
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              "div",
              {
                className: "inline-grid gap-1 items-center",
                style: { gridTemplateColumns: "auto auto auto auto" },
                children: configuration.uniqueCustomProperties.map((p2, pIdx) => {
                  var _a2, _b2;
                  const conversion = propertyConversionsMap == null ? void 0 : propertyConversionsMap[pIdx];
                  const property2 = (conversion == null ? void 0 : conversion.toPropertyPool) && (conversion == null ? void 0 : conversion.toPropertyId) ? (_a2 = propertyMap == null ? void 0 : propertyMap[conversion.toPropertyPool]) == null ? void 0 : _a2[conversion.toPropertyId] : void 0;
                  const isSet2 = !!property2;
                  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Chip,
                      {
                        color: isSet2 ? "success" : "danger",
                        size: "sm",
                        variant: "light",
                        children: isSet2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheckCircle, { className: "text-base" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCloseCircle, { className: "text-base" })
                      }
                    ) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                      BriefProperty,
                      {
                        fields: ["name", "type"],
                        property: p2
                      }
                    ) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(TiChevronRightOutline, { className: "text-base" }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      PropertyMatcher,
                      {
                        matchedProperty: (_b2 = propertyConversionsMap == null ? void 0 : propertyConversionsMap[pIdx]) == null ? void 0 : _b2.toProperty,
                        name: p2.name,
                        options: p2.options,
                        type: p2.type,
                        onValueChanged: (property22) => {
                          if (!property22) {
                            throw new Error(
                              "Property should not be undefined"
                            );
                          }
                          setPropertyMap({
                            ...propertyMap,
                            [property22.pool]: {
                              ...propertyMap[property22.pool],
                              [property22.id]: property22
                            }
                          });
                          setPropertyConversionsMap({
                            ...propertyConversionsMap,
                            [pIdx]: {
                              toPropertyPool: property22.pool,
                              toPropertyId: property22.id
                            }
                          });
                        }
                      }
                    )
                  ] });
                })
              }
            ) })
          ] }),
          configuration.uniqueExtensionGroups && configuration.uniqueExtensionGroups.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 text-lg font-bold", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(TbSectionSign, { className: "" }),
              t2("New extension groups")
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              "div",
              {
                className: "inline-grid gap-1 items-center",
                style: { gridTemplateColumns: "auto auto auto auto auto" },
                children: configuration.uniqueExtensionGroups.map((eg2, egIdx) => {
                  var _a2;
                  const conversion = extensionGroupConversionsMap == null ? void 0 : extensionGroupConversionsMap[egIdx];
                  const leg = (conversion == null ? void 0 : conversion.toExtensionGroupId) ? extensionGroups == null ? void 0 : extensionGroups.find(
                    (g2) => g2.id == conversion.toExtensionGroupId
                  ) : void 0;
                  const isSet2 = !!leg;
                  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Chip,
                      {
                        color: isSet2 ? "success" : "danger",
                        size: "sm",
                        variant: "light",
                        children: isSet2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheckCircle, { className: "text-base" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCloseCircle, { className: "text-base" })
                      }
                    ) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center flex-wrap gap-1", children: [
                      eg2.name,
                      (_a2 = eg2.extensions) == null ? void 0 : _a2.map((e2) => {
                        return /* @__PURE__ */ jsxRuntimeExports.jsx(
                          Chip,
                          {
                            radius: "sm",
                            size: "sm",
                            variant: "flat",
                            children: e2
                          }
                        );
                      })
                    ] }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(TiChevronRightOutline, { className: "text-base" }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Automatically process"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Button,
                      {
                        isIconOnly: true,
                        color: "primary",
                        variant: "light",
                        onPress: async () => {
                          const candidate = findProperExtensionGroup(
                            eg2,
                            extensionGroups ?? []
                          );
                          if (candidate) {
                            setExtensionGroupConversionsMap({
                              ...extensionGroupConversionsMap,
                              [egIdx]: {
                                toExtensionGroupId: candidate.id
                              }
                            });
                          } else {
                            createPortal(Modal, {
                              defaultVisible: true,
                              title: t2(
                                "No proper extension group found"
                              ),
                              children: t2(
                                "Should we create a new extension group for this?"
                              ),
                              onOk: async () => {
                                const r2 = await BApi$1.extensionGroup.addExtensionGroup(
                                  {
                                    name: eg2.name,
                                    extensions: eg2.extensions
                                  }
                                );
                                if (r2.code) {
                                  throw new Error(r2.message);
                                } else {
                                  const newEg = r2.data;
                                  setExtensionGroups([
                                    ...extensionGroups,
                                    newEg
                                  ]);
                                  setExtensionGroupConversionsMap({
                                    ...extensionGroupConversionsMap,
                                    [egIdx]: {
                                      toExtensionGroupId: newEg.id
                                    }
                                  });
                                }
                              }
                            });
                          }
                        },
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdAutoFixHigh, { className: "text-base" })
                      }
                    ) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "min-w-[240px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Select,
                      {
                        fullWidth: true,
                        isMultiline: true,
                        dataSource: extensionGroups == null ? void 0 : extensionGroups.map((x2) => ({
                          label: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: x2.name }),
                            x2.extensions && x2.extensions.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
                              "div",
                              {
                                className: "flex items-center gap-1 flex-wrap",
                                children: x2.extensions.map((e2) => {
                                  return /* @__PURE__ */ jsxRuntimeExports.jsx(
                                    Chip,
                                    {
                                      radius: "sm",
                                      size: "sm",
                                      variant: "flat",
                                      children: e2
                                    }
                                  );
                                })
                              }
                            )
                          ] }),
                          textValue: x2.name,
                          value: x2.id.toString()
                        })),
                        multiple: false,
                        placeholder: t2(
                          "Select an extension group manually"
                        ),
                        selectedKeys: (conversion == null ? void 0 : conversion.toExtensionGroupId) ? [conversion.toExtensionGroupId.toString()] : void 0,
                        size: "sm",
                        variant: "bordered",
                        onSelectionChange: (selection) => {
                          const id2 = parseInt(
                            Array.from(selection)[0],
                            10
                          );
                          setExtensionGroupConversionsMap({
                            ...extensionGroupConversionsMap,
                            [egIdx]: {
                              ...conversion,
                              toExtensionGroupId: id2
                            }
                          });
                        }
                      }
                    ) })
                  ] });
                })
              }
            ) })
          ] })
        ] })
      ]
    }
  );
};
ImportModal.displayName = "ImportModal";
const AddModal = ({ onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [name2, setName] = reactExports.useState();
  const [visible, setVisible] = reactExports.useState(true);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel", "ok"],
        okProps: {
          isDisabled: name2 == void 0 || name2.length == 0
        }
      },
      size: "md",
      title: t2("Add a media library template"),
      visible,
      onDestroyed,
      onOk: async () => {
        const r2 = await BApi$1.mediaLibraryTemplate.addMediaLibraryTemplate({
          name: name2
        });
        if (r2.code) {
          throw new Error(r2.message);
        }
        setVisible(false);
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            isRequired: true,
            label: t2("Template name"),
            placeholder: t2("Enter template name"),
            value: name2,
            onValueChange: setName
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Trans, { i18nKey: "media-library-template.use-preset-template-builder", children: [
          "We recommend using our",
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              size: "sm",
              variant: "light",
              onPress: () => {
                setVisible(false);
                createPortal(PresetTemplateBuilder, {
                  onSubmitted: onDestroyed
                });
              },
              children: t2("Preset template builder")
            }
          ),
          "the first time you create a media library template."
        ] }) })
      ] })
    }
  );
};
AddModal.displayName = "AddModal";
const MediaLibraryTemplatePage = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const forceUpdate = useUpdate();
  const [templates2, setTemplates] = reactExports.useState([]);
  const [enhancers, setEnhancers] = reactExports.useState([]);
  const [propertyMap, setPropertyMap] = reactExports.useState({});
  const [searchForm, setSearchForm] = reactExports.useState({});
  const [expandedTemplateIds, setExpandedTemplateIds] = reactExports.useState([]);
  const loadProperties = async () => {
    const psr = (await BApi$1.property.getPropertiesByPool(PropertyPool.All)).data || [];
    const ps = _$2.mapValues(
      _$2.groupBy(psr, (x2) => x2.pool),
      (v2) => _$2.keyBy(v2, (x2) => x2.id)
    );
    setPropertyMap(ps);
  };
  const loadTemplates = async () => {
    const r2 = await BApi$1.mediaLibraryTemplate.getAllMediaLibraryTemplates();
    const templates22 = r2.data || [];
    if (!r2.code) {
      setTemplates(templates22);
      return templates22;
    }
    return [];
  };
  const loadTemplate = async (id2) => {
    const r2 = await BApi$1.mediaLibraryTemplate.getMediaLibraryTemplate(id2);
    if (!r2.code) {
      setTemplates(templates2.map((t22) => {
        var _a2;
        return t22.id == ((_a2 = r2.data) == null ? void 0 : _a2.id) ? r2.data : t22;
      }));
    }
  };
  reactExports.useEffect(() => {
    BApi$1.enhancer.getAllEnhancerDescriptors().then((r2) => {
      setEnhancers(r2.data || []);
    });
    loadProperties();
    loadTemplates().then(
      (tpls) => setExpandedTemplateIds(tpls.map((tpl) => tpl.id.toString()))
    );
  }, []);
  const putTemplate = async (tpl) => {
    const r2 = await BApi$1.mediaLibraryTemplate.putMediaLibraryTemplate(
      tpl.id,
      tpl
    );
    if (!r2.code) {
      Vt.success(t2("Saved successfully"));
      await loadTemplate(tpl.id);
    }
  };
  const filteredTemplates = templates2.filter((tpl) => {
    if (!searchForm.keyword || searchForm.keyword.length == 0) {
      return true;
    }
    const keyword = searchForm.keyword.toLowerCase();
    return tpl.name.toLowerCase().includes(keyword) || tpl.author && tpl.author.toLowerCase().includes(keyword) || tpl.description && tpl.description.toLowerCase().includes(keyword);
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 justify-between", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "primary",
            size: "sm",
            onPress: () => createPortal(AddModal, { onDestroyed: loadTemplates }),
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-base" }),
              t2("Create a template")
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          autocomplete_default,
          {
            endContent: filteredTemplates.length == templates2.length ? filteredTemplates.length : `${filteredTemplates.length}/${templates2.length}`,
            fullWidth: false,
            inputValue: searchForm.keyword,
            placeholder: t2("Search templates"),
            size: "sm",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSearch, { className: "text-base" }),
            onInputChange: (keyword) => setSearchForm({
              ...searchForm,
              keyword
            }),
            children: templates2 == null ? void 0 : templates2.map((tpl) => /* @__PURE__ */ jsxRuntimeExports.jsx(listbox_item_base_default, { children: tpl.name }, tpl.id))
          }
        ) }),
        templates2.length > 0 ? expandedTemplateIds.length < templates2.length ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "default",
            size: "sm",
            onPress: () => setExpandedTemplateIds(
              templates2.map((tpl) => tpl.id.toString())
            ),
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(BiExpandVertical, { className: "text-base" }),
              t2("Expand all")
            ]
          }
        ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "default",
            size: "sm",
            onPress: () => setExpandedTemplateIds([]),
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(BiCollapseVertical, { className: "text-base" }),
              t2("Collapse all")
            ]
          }
        ) : null
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          color: "default",
          size: "sm",
          onPress: () => {
            createPortal(ImportModal, {
              onImported: async () => {
                await loadProperties();
                await loadTemplates();
              }
            });
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$z, {}),
            t2("Import a template")
          ]
        }
      ) })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 grow", children: templates2.length == 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        className: "flex items-center gap-2 w-full h-full justify-center",
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(PiEmpty, { className: "text-2xl" }),
          t2(
            "No templates found. You can create a template or import one from a share code."
          )
        ]
      }
    ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
      accordion_default,
      {
        className: "px-0",
        selectedKeys: expandedTemplateIds,
        variant: "splitted",
        onSelectionChange: (keys2) => {
          const ids2 = Array.from(keys2).map((k2) => k2);
          setExpandedTemplateIds(ids2);
        },
        children: filteredTemplates.map((tpl) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            accordion_item_base_default,
            {
              id: tpl.id.toString(),
              title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { className: "", size: "sm", variant: "flat", children: [
                    "#",
                    tpl.id
                  ] }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-bold", children: tpl.name }),
                  tpl.author && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-60", children: tpl.author }),
                  tpl.description && /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Tooltip$1,
                    {
                      content: tpl.description,
                      placement: "bottom",
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" })
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      isIconOnly: true,
                      size: "sm",
                      variant: "light",
                      onPress: () => {
                        let { name: name2, author, description } = tpl;
                        createPortal(Modal, {
                          defaultVisible: true,
                          title: t2("Edit template"),
                          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx(
                              input_default,
                              {
                                isRequired: true,
                                defaultValue: name2,
                                label: t2("Name"),
                                placeholder: t2(
                                  "Enter template name"
                                ),
                                onValueChange: (v2) => {
                                  name2 = v2;
                                }
                              }
                            ),
                            /* @__PURE__ */ jsxRuntimeExports.jsx(
                              input_default,
                              {
                                defaultValue: author,
                                label: `${t2("Author")}${t2("(optional)")}`,
                                placeholder: t2("Enter author name"),
                                onValueChange: (v2) => {
                                  author = v2;
                                }
                              }
                            ),
                            /* @__PURE__ */ jsxRuntimeExports.jsx(
                              textarea_default,
                              {
                                defaultValue: description,
                                label: `${t2("Description")}${t2("(optional)")}`,
                                placeholder: t2("Enter description"),
                                onValueChange: (v2) => {
                                  description = v2;
                                }
                              }
                            )
                          ] }),
                          size: "lg",
                          onOk: async () => {
                            tpl.name = name2;
                            tpl.author = author;
                            tpl.description = description;
                            await putTemplate(tpl);
                            forceUpdate();
                          }
                        });
                      },
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-base" })
                    }
                  )
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { className: "opacity-60", variant: "light", children: tpl.createdAt }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      isIconOnly: true,
                      size: "sm",
                      variant: "light",
                      onPress: async () => {
                        const r2 = await BApi$1.mediaLibraryTemplate.getMediaLibraryTemplateShareCode(
                          tpl.id
                        );
                        if (!r2.code && r2.data) {
                          const shareText = r2.data;
                          await navigator.clipboard.writeText(shareText);
                          createPortal(Modal, {
                            defaultVisible: true,
                            title: t2("Share code has been copied"),
                            children: t2(
                              "Share code has been copied to your clipboard, you can send it to your friends. (ctrl+v)"
                            ),
                            footer: {
                              actions: ["ok"],
                              okProps: {
                                children: t2("I got it")
                              }
                            }
                          });
                        }
                      },
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx(GoShareAndroid, { className: "text-large" })
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      isIconOnly: true,
                      color: "default",
                      size: "sm",
                      variant: "light",
                      onPress: () => {
                        createPortal(Modal, {
                          defaultVisible: true,
                          title: t2("Duplicate current template"),
                          // children: (
                          //
                          // ),
                          onOk: async () => {
                            const r2 = await BApi$1.mediaLibraryTemplate.duplicateMediaLibraryTemplate(
                              tpl.id
                            );
                            if (!r2.code) {
                              loadTemplates();
                            }
                          }
                        });
                      },
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx(IoDuplicateOutline, { className: "text-base" })
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      isIconOnly: true,
                      color: "danger",
                      size: "sm",
                      variant: "light",
                      onPress: () => {
                        createPortal(Modal, {
                          defaultVisible: true,
                          title: t2("Deleting template {{name}}", {
                            name: tpl.name
                          }),
                          children: t2(
                            "This action cannot be undone. Are you sure you want to delete this template?"
                          ),
                          onOk: async () => {
                            const r2 = await BApi$1.mediaLibraryTemplate.deleteMediaLibraryTemplate(
                              tpl.id
                            );
                            if (!r2.code) {
                              loadTemplates();
                            }
                          }
                        });
                      },
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdDeleteOutline, { className: "text-large" })
                    }
                  )
                ] })
              ] }),
              children: propertyMap && enhancers && templates2 && /* @__PURE__ */ jsxRuntimeExports.jsx(
                Template,
                {
                  enhancersCache: enhancers,
                  propertyMapCache: propertyMap,
                  template: tpl,
                  templatesCache: templates2,
                  onChange: async () => {
                    await loadTemplate(tpl.id);
                  }
                }
              )
            },
            tpl.id
          );
        })
      }
    ) })
  ] });
};
MediaLibraryTemplatePage.displayName = "MediaLibraryTemplatePage";
const SimpleLabel = (props) => {
  const { children, status = "default", className, ...otherProps } = props;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "span",
    {
      className: `simple-label ${status} ${className || ""}`,
      ...otherProps,
      children
    }
  );
};
SimpleLabel.displayName = "SimpleLabel";
const TypeLabelProps = {
  [ComponentDescriptorType.Fixed]: {
    status: "default",
    label: "Reserved"
  },
  [ComponentDescriptorType.Instance]: {
    status: "info",
    label: "Custom"
  }
};
const ComponentCard = (props) => {
  var _a2, _b2;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const {
    descriptor: propsDescriptor,
    selected,
    onDeleted,
    ...otherProps
  } = props;
  const [descriptor, setDescriptor] = reactExports.useState(propsDescriptor);
  const labelProps = TypeLabelProps[descriptor.type];
  const domRef = reactExports.useRef();
  reactExports.useEffect(() => {
    setDescriptor(propsDescriptor);
  }, [propsDescriptor]);
  console.log("Rendering", props);
  const renderExtra = () => {
    var _a3;
    switch (descriptor.componentType) {
      case ComponentType.Enhancer: {
        if (((_a3 = descriptor.targets) == null ? void 0 : _a3.length) > 0) {
          const descriptions = descriptor.targets.map(
            (t22) => extractEnhancerTargetDescription(t22)
          );
          const descriptionGroups = descriptions.reduce((s2, t22) => {
            let g2 = s2.find((g22) => g22.type == t22.type);
            if (g2 == void 0) {
              g2 = {
                type: t22.type,
                keys: []
              };
              s2.push(g2);
            }
            g2.keys.push(t22.key);
            return s2;
          }, []);
          return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "target-groups", children: descriptionGroups.map((t22, i2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group", children: [
              t22.type,
              t22.keys.map((k2) => /* @__PURE__ */ jsxRuntimeExports.jsx(SimpleLabel, { status: "default", children: k2 }, k2))
            ] }, t22.type);
          }) });
        }
        return;
      }
      default:
        return;
    }
  };
  const categories = (descriptor == null ? void 0 : descriptor.associatedCategories) ?? [];
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: `component-card ${selected ? "selected" : ""}`,
      ...otherProps,
      ref: domRef,
      children: [
        selected && /* @__PURE__ */ jsxRuntimeExports.jsx(MdCheckCircle, { className: "selected-icon text-xl" }),
        descriptor.type == ComponentDescriptorType.Instance && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "top-right-operations", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            button_default$1,
            {
              isIconOnly: true,
              color: "default",
              size: "sm",
              variant: "light",
              onPress: (e2) => {
                createPortal(ComponentDetailPage, {
                  componentType: descriptor.componentType,
                  componentKey: descriptor.id,
                  onClosed: (hasChanges) => {
                    if (hasChanges) {
                      BApi$1.component.getComponentDescriptorByKey({
                        key: descriptor.optionsId
                      }).then((a2) => {
                        setDescriptor(a2.data);
                      });
                    }
                  }
                });
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdEdit, { className: "text-base" })
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            button_default$1,
            {
              isIconOnly: true,
              color: "danger",
              size: "sm",
              variant: "light",
              onPress: (e2) => {
                createPortal(Modal, {
                  defaultVisible: true,
                  title: t2("Sure to delete?"),
                  children: t2(
                    "Are you sure you want to delete this component?"
                  ),
                  onOk: () => BApi$1.componentOptions.removeComponentOptions(descriptor.optionsId).then((a2) => {
                    if (!a2.code) {
                      if (onDeleted) {
                        onDeleted();
                      }
                    }
                  })
                });
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdDelete, { className: "text-base" })
            }
          )
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "top", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "name", children: [
            labelProps && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(SimpleLabel, { status: labelProps.status, children: t2(labelProps.label) }),
              " "
            ] }),
            t2(descriptor.name)
          ] }),
          descriptor.description && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "description", children: t2(descriptor.description) }),
          renderExtra()
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bottom", children: [
          categories.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "categories", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label", children: t2("Applied to {{count}} categories", {
            count: categories.length
          }) }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "versions", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              SimpleLabel,
              {
                className: `version ${((_a2 = descriptor.version) == null ? void 0 : _a2.length) > 0 ? "" : "empty"}`,
                status: "default",
                title: `${t2("Version")}:${t2("May be different in incoming versions of app")}`,
                children: descriptor.version
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              SimpleLabel,
              {
                className: `version ${((_b2 = descriptor.dataVersion) == null ? void 0 : _b2.length) > 0 ? "" : "empty"}`,
                title: `${t2("Data version")}:${t2("May be different after configuration change")}`,
                children: descriptor.dataVersion
              }
            )
          ] })
        ] })
      ]
    }
  );
};
ComponentCard.displayName = "ComponentCard";
const ComponentOptionsRenderPage = React$5.forwardRef((props, ref) => {
  const [Component2, setComponent] = reactExports.useState();
  const init2 = async () => {
    const a2 = await __vitePreload(() => import(
      /* @vite-ignore */
      `./${props.schema.title}Rjsf`
    ), true ? __vite__mapDeps([]) : void 0);
    setComponent(a2.default);
  };
  reactExports.useEffect(() => {
    init2();
    console.log("[ComponentOptionsRender]Initialized", props);
  }, []);
  return Component2 && /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...props, ref });
});
function ComponentDetailPage(props) {
  const {
    componentKey,
    componentType,
    onClosed = () => {
    },
    onDestroyed
  } = props;
  const { t: t2 } = useTranslation();
  const [descriptor, setDescriptor] = reactExports.useState();
  const [baseDescriptors, setBaseDescriptors] = reactExports.useState([]);
  const [baseDescriptor, setBaseDescriptor] = reactExports.useState(void 0);
  const [visible, setVisible] = reactExports.useState(true);
  const optionsFormRef = reactExports.useRef();
  const init2 = async () => {
    var _a2;
    let d2;
    if (componentKey !== void 0) {
      const rsp = await BApi$1.component.getComponentDescriptorByKey({
        key: componentKey.toString(),
        additionalItems: ComponentDescriptorAdditionalItem.AssociatedCategories
      });
      d2 = rsp.data;
    } else {
      d2 = {
        componentType
      };
    }
    setDescriptor(d2);
    if (d2 == null ? void 0 : d2.componentType) {
      const dsRsp = await BApi$1.component.getComponentDescriptors({
        type: d2.componentType
      });
      const baseDs = ((_a2 = dsRsp.data) == null ? void 0 : _a2.filter(
        (a2) => a2.type == ComponentDescriptorType.Configurable
      )) ?? [];
      setBaseDescriptors(baseDs);
      if (baseDs.length > 0) {
        const bd2 = baseDs.find((a2) => a2.id == (d2 == null ? void 0 : d2.id)) ?? baseDs.find((a2) => a2.componentType == (d2 == null ? void 0 : d2.componentType));
        setBaseDescriptor(bd2);
      }
    }
  };
  reactExports.useEffect(() => {
    init2();
    console.log("[CustomComponentDetail]Initialized", props);
  }, []);
  const optionsJsonSchema = (baseDescriptor == null ? void 0 : baseDescriptor.optionsJsonSchema) && JSON.parse(baseDescriptor.optionsJsonSchema);
  console.log(descriptor, baseDescriptor);
  const closeWithChangesRef = reactExports.useRef(false);
  const close = (closeWithChanges) => {
    console.log("close?");
    closeWithChangesRef.current = closeWithChanges;
    setVisible(false);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      size: "xl",
      title: componentType ? t2(ComponentType[componentType]) : t2("Component Detail"),
      visible,
      onClose: () => close(false),
      onDestroyed,
      onOk: () => new Promise((resolve2, reject) => {
        var _a2, _b2;
        if ((_a2 = optionsFormRef.current) == null ? void 0 : _a2.validateForm()) {
          if (!(((_b2 = descriptor == null ? void 0 : descriptor.name) == null ? void 0 : _b2.length) > 0)) {
            toast.danger(
              t2("{{key}} is not set", {
                key: t2("Name")
              })
            );
            reject();
            return;
          }
          if (!baseDescriptor) {
            toast.danger(t2("Please select a component type"));
            reject();
            return;
          }
          const data = {
            name: descriptor.name,
            componentAssemblyQualifiedTypeName: baseDescriptor.assemblyQualifiedTypeName,
            description: descriptor == null ? void 0 : descriptor.description,
            json: descriptor == null ? void 0 : descriptor.optionsJson
          };
          const invoke = (descriptor == null ? void 0 : descriptor.optionsId) && descriptor.optionsId > 0 ? BApi$1.componentOptions.putComponentOptions : BApi$1.componentOptions.addComponentOptions;
          const args = (descriptor == null ? void 0 : descriptor.optionsId) && descriptor.optionsId > 0 ? [descriptor.optionsId, data] : [data];
          console.log(args);
          invoke(...args).then((a2) => {
            if (a2.code) {
              reject();
            } else {
              resolve2();
              close(true);
            }
          }).catch((e2) => {
            reject(e2);
          });
        } else {
          reject();
        }
      }),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label", children: t2("Type") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "value", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "base-components", children: baseDescriptors.map((c2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              ComponentCard,
              {
                descriptor: c2,
                selected: c2 == baseDescriptor,
                onClick: () => {
                  setBaseDescriptor(c2);
                }
              },
              c2.id
            );
          }) }) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label", children: t2("Name") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "value", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              value: descriptor == null ? void 0 : descriptor.name,
              onValueChange: (v2) => {
                setDescriptor({
                  ...descriptor,
                  name: v2
                });
              }
            }
          ) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label", children: t2("Description") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "value", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            textarea_default,
            {
              placeholder: (baseDescriptor == null ? void 0 : baseDescriptor.description) ? t2(baseDescriptor == null ? void 0 : baseDescriptor.description) : void 0,
              value: descriptor == null ? void 0 : descriptor.description,
              onValueChange: (v2) => {
                setDescriptor({
                  ...descriptor || {},
                  description: v2
                });
              }
            }
          ) })
        ] }),
        optionsJsonSchema && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label", children: t2("Configuration") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "value", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            ComponentOptionsRenderPage,
            {
              ref: optionsFormRef,
              defaultValue: (descriptor == null ? void 0 : descriptor.optionsJson) ? JSON.parse(descriptor == null ? void 0 : descriptor.optionsJson) : void 0,
              schema: optionsJsonSchema,
              onChange: (v2) => {
                console.log("Options changed", v2);
                setDescriptor({
                  ...descriptor,
                  optionsJson: JSON.stringify(v2)
                });
              }
            }
          ) })
        ] })
      ] })
    }
  );
}
const ComponentTypeIcons = {
  [ComponentType.Enhancer]: MdFlashlightOn,
  [ComponentType.Player]: MdPlayCircle,
  [ComponentType.PlayableFileSelector]: MdSearch
};
const CustomComponentPage = () => {
  const { t: t2 } = useTranslation();
  const [allComponents, setAllComponents] = reactExports.useState([]);
  const [selectedComponent, setSelectedComponent] = reactExports.useState();
  const loadAllComponents = async () => {
    const rsp = await BApi$1.component.getComponentDescriptors({
      additionalItems: ComponentDescriptorAdditionalItem.AssociatedCategories
    });
    setAllComponents(rsp.data);
  };
  reactExports.useEffect(() => {
    loadAllComponents();
  }, []);
  const showDetail = (componentType, componentKey) => {
    setSelectedComponent({
      componentType,
      componentKey,
      onClosed: () => {
        setSelectedComponent(void 0);
      }
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "custom-component-page", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Modal,
      {
        defaultVisible: true,
        footer: { actions: ["cancel"] },
        size: "lg",
        title: t2("Custom components will be removed soon"),
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          alert_default,
          {
            color: "danger",
            title: t2(
              "Please note that the custom components will be removed soon. Please use the new media library template."
            )
          }
        )
      }
    ),
    selectedComponent && /* @__PURE__ */ jsxRuntimeExports.jsx(
      ComponentDetailPage,
      {
        ...selectedComponent,
        onClosed: (hasChanges) => {
          setSelectedComponent(void 0);
          if (hasChanges) {
            loadAllComponents();
          }
        }
      }
    ),
    componentTypes.filter((x2) => x2.value != ComponentType.Enhancer).map((ct) => {
      const components2 = allComponents.filter(
        (c2) => c2.componentType == ct.value && c2.type == ComponentDescriptorType.Instance
      );
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "component-type", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "type-name", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "name flex items-center gap-1", children: [
            React$5.createElement(ComponentTypeIcons[ct.value], {
              className: "text-xl"
            }),
            t2(ct.label)
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Button,
            {
              color: "primary",
              variant: "light",
              onClick: () => {
                showDetail(ct.value);
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$m, { className: "text-base" }),
                t2("Add")
              ]
            }
          )
        ] }),
        components2.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "components", children: components2.map((c2) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            ComponentCard,
            {
              descriptor: c2,
              onDeleted: () => {
                loadAllComponents();
              }
            },
            c2.id
          );
        }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-components", children: t2("Nothing here yet") })
      ] }, ct.value);
    })
  ] });
};
CustomComponentPage.displayName = "CustomComponentPage";
const TypeConversionExampleDialog = () => {
  const { t: t2 } = useTranslation();
  const [results, setResults] = reactExports.useState([]);
  const columns = [
    // <TableColumn>{t<string>('Type to be converted')}</TableColumn>,
    /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Value to be converted") }),
    ...propertyTypes.map((cpt) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2(PropertyType[cpt.value]) });
    })
  ];
  reactExports.useEffect(() => {
    BApi$1.customProperty.testCustomPropertyTypeConversion().then((r2) => {
      var _a2;
      setResults(((_a2 = r2.data) == null ? void 0 : _a2.results) ?? []);
    });
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel"],
        cancelProps: {
          children: t2("Close")
        }
      },
      size: "full",
      title: t2("Type conversion examples"),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { isVertical: true, disabledKeys: ["title"], children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tab, { title: t2("Source type") }, "title"),
        propertyTypes.map((cpt) => {
          const filteredResults = (results == null ? void 0 : results.filter((x2) => x2.type == cpt.value)) || [];
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            Tab,
            {
              className: "w-full",
              title: t2(PropertyType[cpt.value]),
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isCompact: true, isHeaderSticky: true, isStriped: true, removeWrapper: true, children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(table_header_default, { children: columns }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: filteredResults.map((td2, i2) => {
                  const cells = [
                    // <TableCell>{t<string>(PropertyType[td.type])}</TableCell>,
                    /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                      StandardValueRenderer,
                      {
                        propertyType: td2.type,
                        type: td2.bizValueType,
                        value: deserializeStandardValue(
                          td2.serializedBizValue ?? null,
                          td2.bizValueType
                        ),
                        variant: "default"
                      }
                    ) })
                  ];
                  propertyTypes.forEach((type4) => {
                    var _a2, _b2;
                    const o2 = (_b2 = (_a2 = filteredResults == null ? void 0 : filteredResults[i2]) == null ? void 0 : _a2.outputs) == null ? void 0 : _b2.find(
                      (o22) => o22.type == type4.value
                    );
                    if (o2) {
                      const deserializedValue = deserializeStandardValue(
                        o2.serializedBizValue ?? null,
                        o2.bizValueType
                      );
                      console.log(o2, deserializedValue);
                      cells.push(
                        /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          StandardValueRenderer,
                          {
                            propertyType: type4.value,
                            type: o2.bizValueType,
                            value: deserializedValue,
                            variant: "default"
                          }
                        ) })
                      );
                    } else {
                      cells.push(/* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: "/" }));
                    }
                  });
                  return /* @__PURE__ */ jsxRuntimeExports.jsx(table_row_default, { children: cells }, i2);
                }) })
              ] })
            },
            cpt.value
          );
        })
      ] }) })
    }
  );
};
TypeConversionExampleDialog.displayName = "TypeConversionExampleDialog";
const TypeConversionRuleOverviewDialog = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [rules2, setRules] = reactExports.useState();
  const columns = [
    // <TableColumn>{t<string>('Source type')}</TableColumn>,
    /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Target type") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Rules") })
  ];
  reactExports.useEffect(() => {
    BApi$1.customProperty.getCustomPropertyConversionRules().then((r2) => {
      setRules(r2.data);
    });
  }, []);
  const renderRows = (fromType) => {
    if (!rules2) {
      return [];
    }
    const targetMap = rules2[fromType];
    if (!targetMap) {
      return [];
    }
    const rows = [];
    Object.keys(targetMap).forEach((toTypeStr) => {
      const toType = parseInt(toTypeStr, 10);
      const rules22 = targetMap[toType];
      rows.push(
        /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: t2(PropertyType[toType]) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: rules22.map((r2) => {
            if (r2.description == null) {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", children: r2.name });
            }
            return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: r2.description }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              r2.name,
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-sm" })
            ] }) }) });
          }) }) })
        ] }, fromType)
      );
    });
    return rows;
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel"],
        cancelProps: {
          children: t2("Close")
        }
      },
      size: "xl",
      title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        t2("Type conversion rules"),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "secondary",
            size: "sm",
            variant: "light",
            onClick: () => {
              createPortal(TypeConversionExampleDialog, {});
            },
            children: t2("Check examples")
          }
        )
      ] }),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { isVertical: true, disabledKeys: ["title"], children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tab, { title: t2("Source type") }, "title"),
        propertyTypes.map((cpt) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            Tab,
            {
              className: "w-full",
              title: t2(PropertyType[cpt.value]),
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isCompact: true, isHeaderSticky: true, isStriped: true, removeWrapper: true, children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(table_header_default, { children: columns }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: renderRows(cpt.value) })
              ] })
            },
            cpt.value
          );
        })
      ] }) })
    }
  );
};
TypeConversionRuleOverviewDialog.displayName = "TypeConversionRuleOverviewDialog";
const CustomPropertyPage = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [properties2, setProperties] = reactExports.useState([]);
  const [keyword, setKeyword] = reactExports.useState("");
  const loadProperties = async () => {
    const rsp = await BApi$1.customProperty.getAllCustomProperties({
      additionalItems: CustomPropertyAdditionalItem.Category | CustomPropertyAdditionalItem.ValueCount
    });
    setProperties((rsp.data || []).sort((a2, b2) => a2.order - b2.order));
  };
  reactExports.useEffect(() => {
    loadProperties();
  }, []);
  const filteredProperties = properties2.filter(
    (p2) => keyword == void 0 || keyword.length == 0 || p2.name.toLowerCase().includes(keyword.toLowerCase())
  );
  const groupedFilteredProperties = filteredProperties.reduce(
    (s2, t22) => {
      var _a2;
      (s2[_a2 = t22.type] ?? (s2[_a2] = [])).push(t22);
      return s2;
    },
    {}
  );
  console.log("[CustomProperty] render", groupedFilteredProperties);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2 mb-4", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            size: "sm",
            onPress: () => {
              createPortal(PropertyModal, {
                onSaved: loadProperties
              });
            },
            children: t2("Add")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            size: "sm",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1h, { className: "text-small" }),
            value: keyword,
            onValueChange: (v2) => setKeyword(v2)
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "secondary",
            size: "sm",
            variant: "light",
            onPress: async () => {
              createPortal(TypeConversionRuleOverviewDialog, {});
            },
            children: t2("Check type conversion rules")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "default",
            size: "sm",
            variant: "light",
            onPress: async () => {
              createPortal(CustomPropertySortModal, {
                properties: properties2,
                onDestroyed: loadProperties
              });
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$b, { className: "text-base" }),
              t2("Adjust display orders")
            ]
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", {})
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        className: "grid gap-2 items-center",
        style: { gridTemplateColumns: "auto 1fr" },
        children: Object.keys(groupedFilteredProperties).map((k2) => {
          const ps = groupedFilteredProperties[k2].sort(
            (a2, b2) => a2.order - b2.order
          );
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-1 text-right", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyTypeIcon, { textVariant: "default", type: ps[0].type }) }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-start gap-2 flex-wrap", children: ps.map((p2) => {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                V2,
                {
                  editable: true,
                  hidePool: true,
                  hideType: true,
                  removable: true,
                  property: p2,
                  onDialogDestroyed: loadProperties,
                  onRemoved: () => {
                    loadProperties();
                  },
                  onSaved: loadProperties
                },
                p2.id
              );
            }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
            /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "horizontal" })
          ] });
        })
      }
    )
  ] });
};
CustomPropertyPage.displayName = "CustomPropertyPage";
const ExtensionGroupPage = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [groups2, setGroups] = reactExports.useState([]);
  const [editingGroup, setEditingGroup] = reactExports.useState(
    void 0
  );
  const [editingExtensionsText, setEditingExtensionsText] = reactExports.useState("");
  reactExports.useEffect(() => {
    BApi$1.extensionGroup.getAllExtensionGroups().then((r2) => {
      setGroups(r2.data || []);
    });
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Modal,
      {
        title: t2("Editing extension group"),
        visible: !!editingGroup,
        onClose: () => setEditingGroup(void 0),
        onOk: async () => {
          let r2;
          if (editingGroup.id == 0) {
            r2 = await BApi$1.extensionGroup.addExtensionGroup(editingGroup);
            if (!r2.code) {
              groups2.push(editingGroup);
            }
          } else {
            r2 = await BApi$1.extensionGroup.putExtensionGroup(
              editingGroup.id,
              editingGroup
            );
            groups2.splice(
              groups2.findIndex((x2) => x2 == editingGroup),
              1,
              editingGroup
            );
          }
          if (r2.code) {
            Vt.error(r2.message);
            throw new Error(r2.message);
          }
          setEditingGroup(void 0);
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              isRequired: true,
              label: t2("Name"),
              value: editingGroup == null ? void 0 : editingGroup.name,
              onValueChange: (v2) => {
                setEditingGroup({
                  ...editingGroup,
                  name: v2
                });
              }
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              textarea_default,
              {
                fullWidth: true,
                label: t2("Extensions"),
                minRows: 4,
                placeholder: t2("Separate by space or newline"),
                value: editingExtensionsText,
                onValueChange: (v2) => {
                  setEditingExtensionsText(v2);
                  setEditingGroup({
                    ...editingGroup,
                    extensions: extractExtensions(v2)
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 flex flex-wrap gap-1", children: editingGroup == null ? void 0 : editingGroup.extensions.map((ext, i2) => {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: ext });
            }) })
          ] })
        ]
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        color: "primary",
        size: "sm",
        onPress: () => {
          setEditingExtensionsText("");
          setEditingGroup({
            id: 0,
            name: "",
            extensions: []
          });
        },
        children: t2("Add a group")
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isStriped: true, removeWrapper: true, className: "mt-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Name") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Extensions") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Operations") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: groups2.map((eg2, i2) => {
        var _a2;
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: eg2.name }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: (_a2 = eg2.extensions) == null ? void 0 : _a2.map((ext, j2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                isCloseable: true,
                size: "sm",
                variant: "flat",
                onClose: async () => {
                  var _a3;
                  (_a3 = eg2.extensions) == null ? void 0 : _a3.splice(j2, 1);
                  await BApi$1.extensionGroup.putExtensionGroup(
                    eg2.id,
                    eg2
                  );
                  setGroups([...groups2]);
                },
                children: ext
              }
            );
          }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                color: "primary",
                size: "sm",
                variant: "light",
                onPress: () => {
                  setEditingExtensionsText(eg2.extensions.join(" "));
                  setEditingGroup(JSON.parse(JSON.stringify(eg2)));
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$T, { className: "text-base" })
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                color: "danger",
                size: "sm",
                variant: "light",
                onPress: () => {
                  createPortal(Modal, {
                    defaultVisible: true,
                    title: t2("Sure to delete?"),
                    children: t2(
                      "Be careful, this operation can not be undone"
                    ),
                    onOk: async () => {
                      await BApi$1.extensionGroup.deleteExtensionGroup(
                        eg2.id
                      );
                      groups2.splice(i2, 1);
                      setGroups(groups2.slice());
                    }
                  });
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" })
              }
            )
          ] }) })
        ] });
      }) })
    ] })
  ] });
};
ExtensionGroupPage.displayName = "ExtensionGroupPage";
function extractExtensions(text2) {
  const extensions2 = text2.replace(/\n/g, " ").split(" ").map((x2) => x2.trim().replace(/^\.+|\.+$/g, "")).filter((x2) => x2.length > 0).map((x2) => `.${x2}`);
  return Array.from(new Set(extensions2));
}
var config = {
  attributes: true,
  characterData: true,
  subtree: true,
  childList: true
};
function useMutationObserver(ref, callback2, options = config) {
  reactExports.useEffect(() => {
    if (ref.current) {
      const observer = new MutationObserver(callback2);
      observer.observe(ref.current, options);
      return () => {
        observer.disconnect();
      };
    }
  }, [callback2, options]);
}
var Observables = ({
  mutationObservables,
  resizeObservables,
  refresh
}) => {
  const [mutationsCounter, setMutationsCounter] = reactExports.useState(0);
  const ref = reactExports.useRef(document.documentElement || document.body);
  function refreshHighlightedRegionIfObservable(nodes) {
    const posibleNodes = Array.from(nodes);
    for (const node2 of posibleNodes) {
      if (mutationObservables) {
        if (!node2.attributes) {
          continue;
        }
        const found = mutationObservables.find(
          (observable) => node2.matches(observable)
        );
        if (found) {
          refresh(true);
        }
      }
    }
  }
  function incrementMutationsCounterIfObservable(nodes) {
    const posibleNodes = Array.from(nodes);
    for (const node2 of posibleNodes) {
      if (resizeObservables) {
        if (!node2.attributes) {
          continue;
        }
        const found = resizeObservables.find(
          (observable) => node2.matches(observable)
        );
        if (found)
          setMutationsCounter(mutationsCounter + 1);
      }
    }
  }
  useMutationObserver(
    ref,
    (mutationList) => {
      for (const mutation of mutationList) {
        if (mutation.addedNodes.length !== 0) {
          refreshHighlightedRegionIfObservable(mutation.addedNodes);
          incrementMutationsCounterIfObservable(mutation.addedNodes);
        }
        if (mutation.removedNodes.length !== 0) {
          refreshHighlightedRegionIfObservable(mutation.removedNodes);
          incrementMutationsCounterIfObservable(mutation.removedNodes);
        }
      }
    },
    { childList: true, subtree: true }
  );
  reactExports.useEffect(() => {
    if (!resizeObservables) {
      return;
    }
    const resizeObserver2 = new index$1(() => {
      refresh();
    });
    for (const observable of resizeObservables) {
      const element2 = document.querySelector(observable);
      if (element2) {
        resizeObserver2.observe(element2);
      }
    }
    return () => {
      resizeObserver2.disconnect();
    };
  }, [resizeObservables, mutationsCounter]);
  return null;
};
var Observables_default = Observables;
function getRect(element2) {
  let rect = initialState$1;
  if (element2) {
    const domRect = element2.getBoundingClientRect();
    rect = domRect;
  }
  return rect;
}
function useRect(ref, refresher) {
  const [dimensions, setDimensions] = reactExports.useState(initialState$1);
  const handleResize = reactExports.useCallback(() => {
    if (!(ref == null ? void 0 : ref.current))
      return;
    setDimensions(getRect(ref == null ? void 0 : ref.current));
  }, [ref == null ? void 0 : ref.current]);
  reactExports.useEffect(() => {
    handleResize();
    window.addEventListener("resize", handleResize);
    return () => window.removeEventListener("resize", handleResize);
  }, [ref == null ? void 0 : ref.current, refresher]);
  return dimensions;
}
var initialState$1 = {
  bottom: 0,
  height: 0,
  left: 0,
  right: 0,
  top: 0,
  width: 0,
  x: 0,
  y: 0
};
function smoothScroll(elem, options) {
  return new Promise((resolve2) => {
    if (!(elem instanceof Element)) {
      throw new TypeError("Argument 1 must be an Element");
    }
    let same = 0;
    let lastPos = null;
    const scrollOptions = Object.assign({ behavior: "smooth" }, options);
    elem.scrollIntoView(scrollOptions);
    requestAnimationFrame(check);
    function check() {
      const newPos = elem == null ? void 0 : elem.getBoundingClientRect().top;
      if (newPos === lastPos) {
        if (same++ > 2) {
          return resolve2(null);
        }
      } else {
        same = 0;
        lastPos = newPos;
      }
      requestAnimationFrame(check);
    }
  });
}
function safe(sum) {
  return sum < 0 ? 0 : sum;
}
function getInViewThreshold(threshold) {
  if (typeof threshold === "object" && threshold !== null) {
    return {
      thresholdX: threshold.x || 0,
      thresholdY: threshold.y || 0
    };
  }
  return {
    thresholdX: threshold || 0,
    thresholdY: threshold || 0
  };
}
function getWindow2() {
  const w2 = Math.max(
    document.documentElement.clientWidth,
    window.innerWidth || 0
  );
  const h3 = Math.max(
    document.documentElement.clientHeight,
    window.innerHeight || 0
  );
  return { w: w2, h: h3 };
}
function inView({
  top: top2,
  right,
  bottom: bottom2,
  left: left2,
  threshold
}) {
  const { w: windowWidth, h: windowHeight } = getWindow2();
  const { thresholdX, thresholdY } = getInViewThreshold(threshold);
  return top2 < 0 && bottom2 - top2 > windowHeight ? true : top2 >= 0 + thresholdY && left2 >= 0 + thresholdX && bottom2 <= windowHeight - thresholdY && right <= windowWidth - thresholdX;
}
var isOutsideX = (val, windowWidth) => {
  return val > windowWidth;
};
var isOutsideY = (val, windowHeight) => {
  return val > windowHeight;
};
function bestPositionOf(positions2, filters = []) {
  const compareFn = (a2, b2) => filters.includes(a2) ? 1 : filters.includes(b2) ? -1 : 0;
  return Object.keys(positions2).map((p2) => {
    return {
      position: p2,
      value: positions2[p2]
    };
  }).sort((a2, b2) => b2.value - a2.value).sort((a2, b2) => compareFn(a2.position, b2.position)).filter((p2) => p2.value > 0).map((p2) => p2.position);
}
var defaultPadding = 10;
function getPadding$1(padding = defaultPadding) {
  if (Array.isArray(padding)) {
    if (padding.length === 1) {
      return [padding[0], padding[0], padding[0], padding[0]];
    }
    if (padding.length === 2) {
      return [padding[1], padding[0], padding[1], padding[0]];
    }
    if (padding.length === 3) {
      return [padding[0], padding[1], padding[2], padding[1]];
    }
    if (padding.length > 3) {
      return [padding[0], padding[1], padding[2], padding[3]];
    }
    return [defaultPadding, defaultPadding];
  }
  return [padding, padding, padding, padding];
}
var defaultStyles$2 = {
  maskWrapper: () => ({
    opacity: 0.7,
    left: 0,
    top: 0,
    position: "fixed",
    zIndex: 99999,
    pointerEvents: "none",
    color: "#000"
  }),
  svgWrapper: ({ windowWidth, windowHeight, wpt, wpl }) => ({
    width: windowWidth,
    height: windowHeight,
    left: Number(wpl),
    top: Number(wpt),
    position: "fixed"
  }),
  maskArea: ({ x: x2, y: y2, width, height }) => ({
    x: x2,
    y: y2,
    width,
    height,
    fill: "black",
    rx: 0
  }),
  maskRect: ({ windowWidth, windowHeight, maskID }) => ({
    x: 0,
    y: 0,
    width: windowWidth,
    height: windowHeight,
    fill: "currentColor",
    mask: `url(#${maskID})`
  }),
  clickArea: ({ windowWidth, windowHeight, clipID }) => ({
    x: 0,
    y: 0,
    width: windowWidth,
    height: windowHeight,
    fill: "currentcolor",
    pointerEvents: "auto",
    clipPath: `url(#${clipID})`
  }),
  highlightedArea: ({ x: x2, y: y2, width, height }) => ({
    x: x2,
    y: y2,
    width,
    height,
    pointerEvents: "auto",
    fill: "transparent",
    display: "none"
  })
};
function stylesMatcher$2(styles2) {
  return (key, state) => {
    const base = defaultStyles$2[key](state);
    const custom2 = styles2[key];
    return custom2 ? custom2(base, state) : base;
  };
}
var Mask = ({
  padding = 10,
  wrapperPadding = 0,
  onClick,
  onClickHighlighted,
  styles: styles2 = {},
  sizes,
  className,
  highlightedAreaClassName,
  maskId,
  clipId
}) => {
  const maskID = maskId || uniqueId("mask__");
  const clipID = clipId || uniqueId("clip__");
  const getStyles = stylesMatcher$2(styles2);
  const [pt, pr, pb2, pl2] = getPadding$1(padding);
  const [wpt, wpr, wpb, wpl] = getPadding$1(wrapperPadding);
  const { w: w2, h: h3 } = getWindow2();
  const width = safe((sizes == null ? void 0 : sizes.width) + pl2 + pr);
  const height = safe((sizes == null ? void 0 : sizes.height) + pt + pb2);
  const top2 = safe((sizes == null ? void 0 : sizes.top) - pt - wpt);
  const left2 = safe((sizes == null ? void 0 : sizes.left) - pl2 - wpl);
  const windowWidth = w2 - wpl - wpr;
  const windowHeight = h3 - wpt - wpb;
  const maskAreaStyles = getStyles("maskArea", {
    x: left2,
    y: top2,
    width,
    height
  });
  const highlightedAreaStyles = getStyles("highlightedArea", {
    x: left2,
    y: top2,
    width,
    height
  });
  return /* @__PURE__ */ React$5.createElement(
    "div",
    {
      style: getStyles("maskWrapper", {}),
      onClick,
      className
    },
    /* @__PURE__ */ React$5.createElement(
      "svg",
      {
        width: windowWidth,
        height: windowHeight,
        xmlns: "http://www.w3.org/2000/svg",
        style: getStyles("svgWrapper", {
          windowWidth,
          windowHeight,
          wpt,
          wpl
        })
      },
      /* @__PURE__ */ React$5.createElement("defs", null, /* @__PURE__ */ React$5.createElement("mask", { id: maskID }, /* @__PURE__ */ React$5.createElement(
        "rect",
        {
          x: 0,
          y: 0,
          width: windowWidth,
          height: windowHeight,
          fill: "white"
        }
      ), /* @__PURE__ */ React$5.createElement(
        "rect",
        {
          style: maskAreaStyles,
          rx: maskAreaStyles.rx ? 1 : void 0
        }
      )), /* @__PURE__ */ React$5.createElement("clipPath", { id: clipID }, /* @__PURE__ */ React$5.createElement(
        "polygon",
        {
          points: `0 0, 0 ${windowHeight}, ${left2} ${windowHeight}, ${left2} ${top2}, ${left2 + width} ${top2}, ${left2 + width} ${top2 + height}, ${left2} ${top2 + height}, ${left2} ${windowHeight}, ${windowWidth} ${windowHeight}, ${windowWidth} 0`
        }
      ))),
      /* @__PURE__ */ React$5.createElement(
        "rect",
        {
          style: getStyles("maskRect", {
            windowWidth,
            windowHeight,
            maskID
          })
        }
      ),
      /* @__PURE__ */ React$5.createElement(
        "rect",
        {
          style: getStyles("clickArea", {
            windowWidth,
            windowHeight,
            top: top2,
            left: left2,
            width,
            height,
            clipID
          })
        }
      ),
      /* @__PURE__ */ React$5.createElement(
        "rect",
        {
          style: highlightedAreaStyles,
          className: highlightedAreaClassName,
          onClick: onClickHighlighted,
          rx: highlightedAreaStyles.rx ? 1 : void 0
        }
      )
    )
  );
};
var Mask_default = Mask;
function uniqueId(prefix) {
  return prefix + Math.random().toString(36).substring(2, 16);
}
var __defProp$1 = Object.defineProperty;
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
var __defNormalProp$1 = (obj, key, value2) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value: value2 }) : obj[key] = value2;
var __spreadValues$1 = (a2, b2) => {
  for (var prop in b2 || (b2 = {}))
    if (__hasOwnProp$1.call(b2, prop))
      __defNormalProp$1(a2, prop, b2[prop]);
  if (__getOwnPropSymbols$1)
    for (var prop of __getOwnPropSymbols$1(b2)) {
      if (__propIsEnum$1.call(b2, prop))
        __defNormalProp$1(a2, prop, b2[prop]);
    }
  return a2;
};
var __objRest$1 = (source2, exclude) => {
  var target = {};
  for (var prop in source2)
    if (__hasOwnProp$1.call(source2, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source2[prop];
  if (source2 != null && __getOwnPropSymbols$1)
    for (var prop of __getOwnPropSymbols$1(source2)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source2, prop))
        target[prop] = source2[prop];
    }
  return target;
};
var defaultStyles$1 = {
  popover: () => ({
    position: "fixed",
    maxWidth: 353,
    backgroundColor: "#fff",
    padding: "24px 30px",
    boxShadow: "0 0.5em 3em rgba(0, 0, 0, 0.3)",
    color: "inherit",
    zIndex: 1e5,
    transition: "transform 0.3s",
    top: 0,
    left: 0
  })
};
function stylesMatcher$1(styles2) {
  return (key, state) => {
    const base = defaultStyles$1[key](state);
    const custom2 = styles2[key];
    return custom2 ? custom2(base, state) : base;
  };
}
var Popover = (_a2) => {
  var _b2 = _a2, {
    children,
    position: providedPosition = "bottom",
    padding = 10,
    styles: styles2 = {},
    sizes,
    refresher
  } = _b2, props = __objRest$1(_b2, [
    "children",
    "position",
    "padding",
    "styles",
    "sizes",
    "refresher"
  ]);
  const helperRef = reactExports.useRef(null);
  const positionRef = reactExports.useRef("");
  const verticalAlignRef = reactExports.useRef("");
  const horizontalAlignRef = reactExports.useRef("");
  const { w: windowWidth, h: windowHeight } = getWindow2();
  const getStyles = stylesMatcher$1(styles2);
  const helperRect = useRect(helperRef, refresher);
  const { width: helperWidth, height: helperHeight } = helperRect;
  const [pt, pr, pb2, pl2] = getPadding$1(padding);
  const targetLeft = (sizes == null ? void 0 : sizes.left) - pl2;
  const targetTop = (sizes == null ? void 0 : sizes.top) - pt;
  const targetRight = (sizes == null ? void 0 : sizes.right) + pr;
  const targetBottom = (sizes == null ? void 0 : sizes.bottom) + pb2;
  const position2 = providedPosition && typeof providedPosition === "function" ? providedPosition(
    {
      width: helperWidth,
      height: helperHeight,
      windowWidth,
      windowHeight,
      top: targetTop,
      left: targetLeft,
      right: targetRight,
      bottom: targetBottom,
      x: sizes.x,
      y: sizes.y
    },
    helperRect
  ) : providedPosition;
  const available = {
    left: targetLeft,
    right: windowWidth - targetRight,
    top: targetTop,
    bottom: windowHeight - targetBottom
  };
  const couldPositionAt = (position22, isOutsideX2, isOutsideY2) => {
    switch (position22) {
      case "top":
        return available.top > helperHeight + pb2;
      case "right":
        return isOutsideX2 ? false : available.right > helperWidth + pl2;
      case "bottom":
        return isOutsideY2 ? false : available.bottom > helperHeight + pt;
      case "left":
        return available.left > helperWidth + pr;
      default:
        return false;
    }
  };
  const autoPosition = (coords, outX, outY) => {
    const positionsOrder = bestPositionOf(
      available,
      outY ? ["right", "left"] : outX ? ["top", "bottom"] : []
    );
    for (let j2 = 0; j2 < positionsOrder.length; j2++) {
      if (couldPositionAt(positionsOrder[j2], outX, outY)) {
        positionRef.current = positionsOrder[j2];
        return coords[positionsOrder[j2]];
      }
    }
    positionRef.current = "center";
    return coords.center;
  };
  const pos = (helperPosition) => {
    if (Array.isArray(helperPosition)) {
      const isOutX = isOutsideX(helperPosition[0], windowWidth);
      const isOutY = isOutsideY(helperPosition[1], windowHeight);
      positionRef.current = "custom";
      return [
        isOutX ? windowWidth / 2 - helperWidth / 2 : helperPosition[0],
        isOutY ? windowHeight / 2 - helperHeight / 2 : helperPosition[1]
      ];
    }
    const isHelperOutsideX = isOutsideX(targetLeft + helperWidth, windowWidth);
    const isHelperOutsideY = isOutsideY(
      targetBottom + helperHeight,
      windowHeight
    );
    const x2 = isHelperOutsideX ? Math.min(targetLeft, windowWidth - helperWidth) : Math.max(targetLeft, 0);
    const y2 = isHelperOutsideY ? helperHeight > available.bottom ? Math.max(targetBottom - helperHeight, 0) : Math.max(targetTop, 0) : targetTop;
    if (isHelperOutsideY) {
      if (helperHeight > available.bottom) {
        verticalAlignRef.current = "bottom";
      } else {
        verticalAlignRef.current = "top";
      }
    } else {
      verticalAlignRef.current = "top";
    }
    if (isHelperOutsideX) {
      horizontalAlignRef.current = "left";
    } else {
      horizontalAlignRef.current = "right";
    }
    const coords = {
      top: [x2 - pl2, targetTop - helperHeight - pb2],
      right: [targetRight + pl2, y2 - pt],
      bottom: [x2 - pl2, targetBottom + pt],
      left: [targetLeft - helperWidth - pr, y2 - pt],
      center: [
        windowWidth / 2 - helperWidth / 2,
        windowHeight / 2 - helperHeight / 2
      ]
    };
    if (helperPosition === "center" || couldPositionAt(helperPosition, isHelperOutsideX, isHelperOutsideY) && !isHelperOutsideX && !isHelperOutsideY) {
      positionRef.current = helperPosition;
      return coords[helperPosition];
    }
    return autoPosition(coords, isHelperOutsideX, isHelperOutsideY);
  };
  const p2 = pos(position2);
  return /* @__PURE__ */ React$5.createElement(
    "div",
    __spreadValues$1({
      className: "reactour__popover",
      style: __spreadValues$1({
        transform: `translate(${Math.round(p2[0])}px, ${Math.round(p2[1])}px)`
      }, getStyles("popover", {
        position: positionRef.current,
        verticalAlign: verticalAlignRef.current,
        horizontalAlign: horizontalAlignRef.current,
        helperRect,
        targetRect: sizes
      })),
      ref: helperRef
    }, props),
    children
  );
};
var Popover_default = Popover;
var __defProp2 = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp2 = (obj, key, value2) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value: value2 }) : obj[key] = value2;
var __spreadValues = (a2, b2) => {
  for (var prop in b2 || (b2 = {}))
    if (__hasOwnProp.call(b2, prop))
      __defNormalProp2(a2, prop, b2[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b2)) {
      if (__propIsEnum.call(b2, prop))
        __defNormalProp2(a2, prop, b2[prop]);
    }
  return a2;
};
var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
var __objRest = (source2, exclude) => {
  var target = {};
  for (var prop in source2)
    if (__hasOwnProp.call(source2, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source2[prop];
  if (source2 != null && __getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(source2)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source2, prop))
        target[prop] = source2[prop];
    }
  return target;
};
var initialState = {
  bottom: 0,
  height: 0,
  left: 0,
  right: 0,
  top: 0,
  width: 0,
  windowWidth: 0,
  windowHeight: 0,
  x: 0,
  y: 0
};
function useSizes(step, scrollOptions = {
  block: "center",
  behavior: "smooth",
  inViewThreshold: 0
}) {
  const [transition3, setTransition] = reactExports.useState(false);
  const [observing, setObserving] = reactExports.useState(false);
  const [isHighlightingObserved, setIsHighlightingObserved] = reactExports.useState(false);
  const [refresher, setRefresher] = reactExports.useState(null);
  const [dimensions, setDimensions] = reactExports.useState(initialState);
  const target = (step == null ? void 0 : step.selector) instanceof Element ? step == null ? void 0 : step.selector : document.querySelector(step == null ? void 0 : step.selector);
  const handleResize = reactExports.useCallback(() => {
    const _a2 = getHighlightedRect(
      target,
      step == null ? void 0 : step.highlightedSelectors,
      step == null ? void 0 : step.bypassElem
    ), { hasHighligtedElems } = _a2, newDimensions = __objRest(_a2, ["hasHighligtedElems"]);
    if (Object.entries(dimensions).some(
      ([key, value2]) => newDimensions[key] !== value2
    )) {
      setDimensions(newDimensions);
    }
  }, [target, step == null ? void 0 : step.highlightedSelectors, dimensions]);
  reactExports.useEffect(() => {
    handleResize();
    window.addEventListener("resize", handleResize);
    return () => window.removeEventListener("resize", handleResize);
  }, [target, step == null ? void 0 : step.highlightedSelectors, refresher]);
  reactExports.useEffect(() => {
    const isInView = inView(__spreadProps(__spreadValues({}, dimensions), {
      threshold: scrollOptions.inViewThreshold
    }));
    if (!isInView && target) {
      setTransition(true);
      smoothScroll(target, scrollOptions).then(() => {
        if (!observing)
          setRefresher(Date.now());
      }).finally(() => {
        setTransition(false);
      });
    }
  }, [dimensions]);
  const observableRefresher = reactExports.useCallback(() => {
    setObserving(true);
    const _a2 = getHighlightedRect(
      target,
      step == null ? void 0 : step.highlightedSelectors,
      step == null ? void 0 : step.bypassElem
    ), { hasHighligtedElems } = _a2, dimesions = __objRest(_a2, ["hasHighligtedElems"]);
    setIsHighlightingObserved(hasHighligtedElems);
    setDimensions(dimesions);
    setObserving(false);
  }, [target, step == null ? void 0 : step.highlightedSelectors, dimensions]);
  return {
    sizes: dimensions,
    transition: transition3,
    target,
    observableRefresher,
    isHighlightingObserved
  };
}
function getHighlightedRect(node2, highlightedSelectors = [], bypassElem = true) {
  let hasHighligtedElems = false;
  const { w: windowWidth, h: windowHeight } = getWindow2();
  if (!highlightedSelectors) {
    return __spreadProps(__spreadValues({}, getRect(node2)), {
      windowWidth,
      windowHeight,
      hasHighligtedElems: false
    });
  }
  let attrs = getRect(node2);
  let altAttrs = {
    bottom: 0,
    height: 0,
    left: windowWidth,
    right: 0,
    top: windowHeight,
    width: 0
  };
  for (const selector of highlightedSelectors) {
    const element2 = document.querySelector(selector);
    if (!element2 || element2.style.display === "none" || element2.style.visibility === "hidden") {
      continue;
    }
    const rect = getRect(element2);
    hasHighligtedElems = true;
    if (bypassElem || !node2) {
      if (rect.top < altAttrs.top) {
        altAttrs.top = rect.top;
      }
      if (rect.right > altAttrs.right) {
        altAttrs.right = rect.right;
      }
      if (rect.bottom > altAttrs.bottom) {
        altAttrs.bottom = rect.bottom;
      }
      if (rect.left < altAttrs.left) {
        altAttrs.left = rect.left;
      }
      altAttrs.width = altAttrs.right - altAttrs.left;
      altAttrs.height = altAttrs.bottom - altAttrs.top;
    } else {
      if (rect.top < attrs.top) {
        attrs.top = rect.top;
      }
      if (rect.right > attrs.right) {
        attrs.right = rect.right;
      }
      if (rect.bottom > attrs.bottom) {
        attrs.bottom = rect.bottom;
      }
      if (rect.left < attrs.left) {
        attrs.left = rect.left;
      }
      attrs.width = attrs.right - attrs.left;
      attrs.height = attrs.bottom - attrs.top;
    }
  }
  const bypassable = bypassElem || !node2 ? altAttrs.width > 0 && altAttrs.height > 0 : false;
  return {
    left: (bypassable ? altAttrs : attrs).left,
    top: (bypassable ? altAttrs : attrs).top,
    right: (bypassable ? altAttrs : attrs).right,
    bottom: (bypassable ? altAttrs : attrs).bottom,
    width: (bypassable ? altAttrs : attrs).width,
    height: (bypassable ? altAttrs : attrs).height,
    windowWidth,
    windowHeight,
    hasHighligtedElems,
    x: attrs.x,
    y: attrs.y
  };
}
var Keyboard = ({
  disableKeyboardNavigation,
  setCurrentStep,
  currentStep,
  setIsOpen,
  stepsLength,
  disable: disable2,
  rtl,
  clickProps,
  keyboardHandler
}) => {
  function keyDownHandler(e2) {
    e2.stopPropagation();
    if (disableKeyboardNavigation === true || disable2) {
      return;
    }
    let isEscDisabled, isRightDisabled, isLeftDisabled;
    if (disableKeyboardNavigation) {
      isEscDisabled = disableKeyboardNavigation.includes("esc");
      isRightDisabled = disableKeyboardNavigation.includes("right");
      isLeftDisabled = disableKeyboardNavigation.includes("left");
    }
    function next2() {
      setCurrentStep(Math.min(currentStep + 1, stepsLength - 1));
    }
    function prev2() {
      setCurrentStep(Math.max(currentStep - 1, 0));
    }
    if (keyboardHandler && typeof keyboardHandler === "function") {
      keyboardHandler(e2, clickProps, {
        isEscDisabled,
        isRightDisabled,
        isLeftDisabled
      });
    } else {
      if (e2.keyCode === 27 && !isEscDisabled) {
        e2.preventDefault();
        setIsOpen(false);
      }
      if (e2.keyCode === 39 && !isRightDisabled) {
        e2.preventDefault();
        if (rtl) {
          prev2();
        } else {
          next2();
        }
      }
      if (e2.keyCode === 37 && !isLeftDisabled) {
        e2.preventDefault();
        if (rtl) {
          next2();
        } else {
          prev2();
        }
      }
    }
  }
  reactExports.useEffect(() => {
    window.addEventListener("keydown", keyDownHandler, false);
    return () => {
      window.removeEventListener("keydown", keyDownHandler);
    };
  }, [disable2, setCurrentStep, currentStep]);
  return null;
};
var Keyboard_default = Keyboard;
var defaultStyles = {
  badge: () => ({
    position: "absolute",
    fontFamily: "monospace",
    background: "var(--reactour-accent,#007aff)",
    height: "1.875em",
    lineHeight: 2,
    paddingLeft: "0.8125em",
    paddingRight: "0.8125em",
    fontSize: "1em",
    borderRadius: "1.625em",
    color: "white",
    textAlign: "center",
    boxShadow: "0 0.25em 0.5em rgba(0, 0, 0, 0.3)",
    top: "-0.8125em",
    left: "-0.8125em"
  }),
  controls: () => ({
    display: "flex",
    marginTop: 24,
    alignItems: "center",
    justifyContent: "space-between"
  }),
  navigation: () => ({
    counterReset: "dot",
    display: "flex",
    justifyContent: "space-between",
    alignItems: "center",
    flexWrap: "wrap"
  }),
  button: ({ disabled }) => ({
    display: "block",
    padding: 0,
    border: 0,
    background: "none",
    cursor: disabled ? "not-allowed" : "pointer"
  }),
  arrow: ({ disabled }) => ({
    color: disabled ? "#caccce" : "#646464",
    width: 16,
    height: 12,
    flex: "0 0 16px"
    // '&:hover': {
    //   color: disabled ? '#caccce' : '#000',
    // },
  }),
  dot: ({ current, disabled, showNumber }) => ({
    counterIncrement: "dot",
    width: 8,
    height: 8,
    border: current ? "0" : "1px solid #caccce",
    borderRadius: "100%",
    padding: 0,
    display: "block",
    margin: 4,
    transition: "opacity 0.3s, transform 0.3s",
    cursor: disabled ? "not-allowed" : "pointer",
    transform: `scale(${current ? 1.25 : 1})`,
    color: current ? "var(--reactour-accent, #007aff)" : "#caccce",
    background: current ? "var(--reactour-accent, #007aff)" : "none"
    // '&:before': {
    //   content: 'counter(dot)',
    //   position: 'absolute',
    //   bottom: 'calc(100% + 0.25em)',
    //   left: '50%',
    //   opacity: 0,
    //   transform: 'translate(-50%, 1em)',
    //   transition: '0.3s',
    //   display: showNumber ? 'block' : 'none',
    // },
    // '&:hover': {
    //   backgroundColor: 'currentColor',
    //   '&:before': {
    //     opacity: 0.5,
    //     transform: 'translate(-50%, -2px)',
    //   },
    // },
  }),
  close: ({ disabled }) => ({
    position: "absolute",
    top: 22,
    right: 22,
    width: 9,
    height: 9,
    "--rt-close-btn": disabled ? "#caccce" : "#5e5e5e",
    "--rt-close-btn-disabled": disabled ? "#caccce" : "#000"
  }),
  svg: () => ({
    display: "block"
  })
};
function stylesMatcher(styles2) {
  return (key, state) => {
    const base = defaultStyles[key](state);
    const custom2 = styles2[key];
    return custom2 ? custom2(base, state) : base;
  };
}
var Badge = ({
  styles: styles2 = {},
  children
}) => {
  const getStyles = stylesMatcher(styles2);
  return /* @__PURE__ */ React$5.createElement("span", { style: getStyles("badge", {}) }, children);
};
var Badge_default = Badge;
var Close = (_a2) => {
  var _b2 = _a2, {
    styles: styles2 = {},
    onClick,
    disabled
  } = _b2, props = __objRest(_b2, [
    "styles",
    "onClick",
    "disabled"
  ]);
  const getStyles = stylesMatcher(styles2);
  return /* @__PURE__ */ React$5.createElement(
    "button",
    __spreadValues({
      className: "reactour__close-button",
      style: __spreadValues(__spreadValues({}, getStyles("button", {})), getStyles("close", { disabled })),
      onClick
    }, props),
    /* @__PURE__ */ React$5.createElement(
      "svg",
      {
        viewBox: "0 0 9.1 9.1",
        "aria-hidden": true,
        role: "presentation",
        style: __spreadValues({}, getStyles("svg", {}))
      },
      /* @__PURE__ */ React$5.createElement(
        "path",
        {
          fill: "currentColor",
          d: "M5.9 4.5l2.8-2.8c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0L4.5 3.1 1.7.3C1.3-.1.7-.1.3.3c-.4.4-.4 1 0 1.4l2.8 2.8L.3 7.4c-.4.4-.4 1 0 1.4.2.2.4.3.7.3s.5-.1.7-.3L4.5 6l2.8 2.8c.3.2.5.3.8.3s.5-.1.7-.3c.4-.4.4-1 0-1.4L5.9 4.5z"
        }
      )
    )
  );
};
var Close_default = Close;
var Content = ({
  content: content2,
  setCurrentStep,
  transition: transition3,
  isHighlightingObserved,
  currentStep,
  setIsOpen
}) => {
  return typeof content2 === "function" ? content2({
    setCurrentStep,
    transition: transition3,
    isHighlightingObserved,
    currentStep,
    setIsOpen
  }) : content2;
};
var Content_default = Content;
var Navigation$1 = ({
  styles: styles2 = {},
  steps,
  setCurrentStep,
  currentStep,
  setIsOpen,
  nextButton,
  prevButton,
  disableDots,
  hideDots,
  hideButtons,
  disableAll,
  rtl,
  Arrow: Arrow2 = DefaultArrow
}) => {
  const stepsLength = steps.length;
  const getStyles = stylesMatcher(styles2);
  const Button2 = ({
    onClick,
    kind = "next",
    children,
    hideArrow
  }) => {
    function clickHandler() {
      if (!disableAll) {
        if (onClick && typeof onClick === "function") {
          onClick();
        } else {
          if (kind === "next") {
            setCurrentStep(Math.min(currentStep + 1, stepsLength - 1));
          } else {
            setCurrentStep(Math.max(currentStep - 1, 0));
          }
        }
      }
    }
    return /* @__PURE__ */ React$5.createElement(
      "button",
      {
        style: getStyles("button", {
          kind,
          disabled: disableAll ? disableAll : kind === "next" ? stepsLength - 1 === currentStep : currentStep === 0
        }),
        onClick: clickHandler,
        "aria-label": `Go to ${kind} step`
      },
      !hideArrow ? /* @__PURE__ */ React$5.createElement(
        Arrow2,
        {
          styles: styles2,
          inverted: rtl ? kind === "prev" : kind === "next",
          disabled: disableAll ? disableAll : kind === "next" ? stepsLength - 1 === currentStep : currentStep === 0
        }
      ) : null,
      children
    );
  };
  return /* @__PURE__ */ React$5.createElement("div", { style: getStyles("controls", {}), dir: rtl ? "rtl" : "ltr" }, !hideButtons ? prevButton && typeof prevButton === "function" ? prevButton({
    Button: Button2,
    setCurrentStep,
    currentStep,
    stepsLength,
    setIsOpen,
    steps
  }) : /* @__PURE__ */ React$5.createElement(Button2, { kind: "prev" }) : null, !hideDots ? /* @__PURE__ */ React$5.createElement("div", { style: getStyles("navigation", {}) }, Array.from({ length: stepsLength }, (_24, i2) => i2).map((index2) => {
    var _a2;
    return /* @__PURE__ */ React$5.createElement(
      "button",
      {
        style: getStyles("dot", {
          current: index2 === currentStep,
          disabled: disableDots || disableAll
        }),
        onClick: () => {
          if (!disableDots && !disableAll)
            setCurrentStep(index2);
        },
        key: `navigation_dot_${index2}`,
        "aria-label": ((_a2 = steps[index2]) == null ? void 0 : _a2.navDotAriaLabel) || `Go to step ${index2 + 1}`
      }
    );
  })) : null, !hideButtons ? nextButton && typeof nextButton === "function" ? nextButton({
    Button: Button2,
    setCurrentStep,
    currentStep,
    stepsLength,
    setIsOpen,
    steps
  }) : /* @__PURE__ */ React$5.createElement(Button2, null) : null);
};
var Navigation_default = Navigation$1;
var DefaultArrow = ({
  styles: styles2 = {},
  inverted = false,
  disabled
}) => {
  const getStyles = stylesMatcher(styles2);
  return /* @__PURE__ */ React$5.createElement(
    "svg",
    {
      viewBox: "0 0 18.4 14.4",
      style: getStyles("arrow", { inverted, disabled })
    },
    /* @__PURE__ */ React$5.createElement(
      "path",
      {
        d: inverted ? "M17 7.2H1M10.8 1L17 7.2l-6.2 6.2" : "M1.4 7.2h16M7.6 1L1.4 7.2l6.2 6.2",
        fill: "none",
        stroke: "currentColor",
        strokeWidth: "2",
        strokeLinecap: "round",
        strokeMiterlimit: "10"
      }
    )
  );
};
var components = {
  Badge: Badge_default,
  Close: Close_default,
  Content: Content_default,
  Navigation: Navigation_default,
  Arrow: DefaultArrow
};
var defaultComponents = (comps) => __spreadValues(__spreadValues({}, components), comps);
var PopoverContent = ({
  styles: styles2,
  components: components2 = {},
  badgeContent,
  accessibilityOptions,
  disabledActions,
  onClickClose,
  steps,
  setCurrentStep,
  currentStep,
  transition: transition3,
  isHighlightingObserved,
  setIsOpen,
  nextButton,
  prevButton,
  disableDotsNavigation,
  rtl,
  showPrevNextButtons = true,
  showCloseButton = true,
  showNavigation = true,
  showBadge = true,
  showDots = true,
  meta,
  setMeta,
  setSteps
}) => {
  const step = steps[currentStep];
  const { Badge: Badge2, Close: Close2, Content: Content2, Navigation: Navigation2, Arrow: Arrow2 } = defaultComponents(components2);
  const badge2 = badgeContent && typeof badgeContent === "function" ? badgeContent({
    currentStep,
    totalSteps: steps.length,
    transition: transition3
  }) : currentStep + 1;
  function closeClickHandler() {
    if (!disabledActions) {
      if (onClickClose && typeof onClickClose === "function") {
        onClickClose({
          setCurrentStep,
          setIsOpen,
          currentStep,
          steps,
          meta,
          setMeta,
          setSteps
        });
      } else {
        setIsOpen(false);
      }
    }
  }
  return /* @__PURE__ */ React$5.createElement(React$5.Fragment, null, showBadge ? /* @__PURE__ */ React$5.createElement(Badge2, { styles: styles2 }, badge2) : null, showCloseButton ? /* @__PURE__ */ React$5.createElement(
    Close2,
    {
      styles: styles2,
      "aria-label": accessibilityOptions == null ? void 0 : accessibilityOptions.closeButtonAriaLabel,
      disabled: disabledActions,
      onClick: closeClickHandler
    }
  ) : null, /* @__PURE__ */ React$5.createElement(
    Content2,
    {
      content: step == null ? void 0 : step.content,
      setCurrentStep,
      currentStep,
      transition: transition3,
      isHighlightingObserved,
      setIsOpen
    }
  ), showNavigation ? /* @__PURE__ */ React$5.createElement(
    Navigation2,
    {
      setCurrentStep,
      currentStep,
      setIsOpen,
      steps,
      styles: styles2,
      "aria-hidden": !(accessibilityOptions == null ? void 0 : accessibilityOptions.showNavigationScreenReaders),
      nextButton,
      prevButton,
      disableDots: disableDotsNavigation,
      hideButtons: !showPrevNextButtons,
      hideDots: !showDots,
      disableAll: disabledActions,
      rtl,
      Arrow: Arrow2
    }
  ) : null);
};
var PopoverContent_default = PopoverContent;
var Tour = (_a2) => {
  var _b2 = _a2, {
    currentStep,
    setCurrentStep,
    setIsOpen,
    steps = [],
    setSteps,
    styles: globalStyles = {},
    scrollSmooth,
    afterOpen,
    beforeClose,
    padding = 10,
    position: position2,
    onClickMask,
    onClickHighlighted,
    keyboardHandler,
    className = "reactour__popover",
    maskClassName = "reactour__mask",
    highlightedMaskClassName,
    clipId,
    maskId,
    disableInteraction,
    disableKeyboardNavigation,
    inViewThreshold,
    disabledActions,
    setDisabledActions,
    disableWhenSelectorFalsy,
    rtl,
    accessibilityOptions = {
      closeButtonAriaLabel: "Close Tour",
      showNavigationScreenReaders: true
    },
    ContentComponent,
    Wrapper: Wrapper2,
    meta,
    setMeta,
    onTransition = () => {
      return "center";
    }
  } = _b2, popoverProps = __objRest(_b2, [
    "currentStep",
    "setCurrentStep",
    "setIsOpen",
    "steps",
    "setSteps",
    "styles",
    "scrollSmooth",
    "afterOpen",
    "beforeClose",
    "padding",
    "position",
    "onClickMask",
    "onClickHighlighted",
    "keyboardHandler",
    "className",
    "maskClassName",
    "highlightedMaskClassName",
    "clipId",
    "maskId",
    "disableInteraction",
    // disableFocusLock,
    "disableKeyboardNavigation",
    "inViewThreshold",
    "disabledActions",
    "setDisabledActions",
    "disableWhenSelectorFalsy",
    "rtl",
    "accessibilityOptions",
    "ContentComponent",
    "Wrapper",
    "meta",
    "setMeta",
    "onTransition"
  ]);
  var _a22;
  const step = steps[currentStep];
  const styles2 = __spreadValues(__spreadValues({}, globalStyles), step == null ? void 0 : step.styles);
  const {
    sizes,
    transition: transition3,
    observableRefresher,
    isHighlightingObserved,
    target
  } = useSizes(step, {
    block: "center",
    behavior: scrollSmooth ? "smooth" : "auto",
    inViewThreshold
  });
  reactExports.useEffect(() => {
    if (afterOpen && typeof afterOpen === "function") {
      afterOpen(target);
    }
    return () => {
      if (beforeClose && typeof beforeClose === "function") {
        beforeClose(target);
      }
    };
  }, []);
  const { maskPadding, popoverPadding, wrapperPadding } = getPadding(
    (_a22 = step == null ? void 0 : step.padding) != null ? _a22 : padding
  );
  const clickProps = {
    setCurrentStep,
    setIsOpen,
    currentStep,
    setSteps,
    steps,
    setMeta,
    meta
  };
  function maskClickHandler() {
    if (!disabledActions) {
      if (onClickMask && typeof onClickMask === "function") {
        onClickMask(clickProps);
      } else {
        setIsOpen(false);
      }
    }
  }
  const doDisableInteraction = typeof (step == null ? void 0 : step.stepInteraction) === "boolean" ? !(step == null ? void 0 : step.stepInteraction) : disableInteraction ? typeof disableInteraction === "boolean" ? disableInteraction : disableInteraction(clickProps) : false;
  reactExports.useEffect(() => {
    if ((step == null ? void 0 : step.action) && typeof (step == null ? void 0 : step.action) === "function") {
      step == null ? void 0 : step.action(target);
    }
    if ((step == null ? void 0 : step.disableActions) !== void 0) {
      setDisabledActions(step == null ? void 0 : step.disableActions);
    }
    return () => {
      if ((step == null ? void 0 : step.actionAfter) && typeof (step == null ? void 0 : step.actionAfter) === "function") {
        step == null ? void 0 : step.actionAfter(target);
      }
    };
  }, [step]);
  const popoverPosition = transition3 ? onTransition : (step == null ? void 0 : step.position) ? step == null ? void 0 : step.position : position2;
  const TourWrapper = Wrapper2 ? Wrapper2 : React$5.Fragment;
  return step ? /* @__PURE__ */ React$5.createElement(TourWrapper, null, /* @__PURE__ */ React$5.createElement(
    Observables_default,
    {
      mutationObservables: step == null ? void 0 : step.mutationObservables,
      resizeObservables: step == null ? void 0 : step.resizeObservables,
      refresh: observableRefresher
    }
  ), /* @__PURE__ */ React$5.createElement(
    Keyboard_default,
    {
      setCurrentStep,
      currentStep,
      setIsOpen,
      stepsLength: steps.length,
      disableKeyboardNavigation,
      disable: disabledActions,
      rtl,
      clickProps,
      keyboardHandler
    }
  ), (!disableWhenSelectorFalsy || target) && /* @__PURE__ */ React$5.createElement(
    Mask_default,
    {
      sizes: transition3 ? initialState2 : sizes,
      onClick: maskClickHandler,
      styles: __spreadValues({
        highlightedArea: (base) => __spreadProps(__spreadValues({}, base), {
          display: doDisableInteraction ? "block" : "none"
        })
      }, styles2),
      padding: transition3 ? 0 : maskPadding,
      highlightedAreaClassName: highlightedMaskClassName,
      className: maskClassName,
      onClickHighlighted: (e2) => {
        e2.preventDefault();
        e2.stopPropagation();
        if (onClickHighlighted)
          onClickHighlighted(e2, clickProps);
      },
      wrapperPadding,
      clipId,
      maskId
    }
  ), (!disableWhenSelectorFalsy || target) && /* @__PURE__ */ React$5.createElement(
    Popover_default,
    {
      sizes,
      styles: styles2,
      position: popoverPosition,
      padding: popoverPadding,
      "aria-labelledby": accessibilityOptions == null ? void 0 : accessibilityOptions.ariaLabelledBy,
      className,
      refresher: currentStep
    },
    ContentComponent ? /* @__PURE__ */ React$5.createElement(
      ContentComponent,
      __spreadValues({
        styles: styles2,
        setCurrentStep,
        currentStep,
        setIsOpen,
        steps,
        accessibilityOptions,
        disabledActions,
        transition: transition3,
        isHighlightingObserved,
        rtl
      }, popoverProps)
    ) : /* @__PURE__ */ React$5.createElement(
      PopoverContent_default,
      __spreadValues({
        styles: styles2,
        setCurrentStep,
        currentStep,
        setIsOpen,
        steps,
        setSteps,
        accessibilityOptions,
        disabledActions,
        transition: transition3,
        isHighlightingObserved,
        rtl,
        meta,
        setMeta
      }, popoverProps)
    )
  )) : null;
};
var Tour_default = Tour;
function getPadding(padding) {
  if (typeof padding === "object" && padding !== null) {
    return {
      maskPadding: padding.mask,
      popoverPadding: padding.popover,
      wrapperPadding: padding.wrapper
    };
  }
  return {
    maskPadding: padding,
    popoverPadding: padding,
    wrapperPadding: 0
  };
}
var initialState2 = {
  bottom: 0,
  height: 0,
  left: 0,
  right: 0,
  top: 0,
  width: 0,
  x: 0,
  y: 0
};
var defaultState = {
  isOpen: false,
  setIsOpen: () => false,
  currentStep: 0,
  setCurrentStep: () => 0,
  steps: [],
  setSteps: () => [],
  setMeta: () => "",
  disabledActions: false,
  setDisabledActions: () => false,
  components: {}
};
var TourContext = React$5.createContext(defaultState);
var TourProvider = (_a2) => {
  var _b2 = _a2, {
    children,
    defaultOpen = false,
    startAt = 0,
    steps: defaultSteps,
    setCurrentStep: customSetCurrentStep,
    currentStep: customCurrentStep
  } = _b2, props = __objRest(_b2, [
    "children",
    "defaultOpen",
    "startAt",
    "steps",
    "setCurrentStep",
    "currentStep"
  ]);
  const [isOpen, setIsOpen] = reactExports.useState(defaultOpen);
  const [currentStep, setCurrentStep] = reactExports.useState(startAt);
  const [steps, setSteps] = reactExports.useState(defaultSteps);
  const [meta, setMeta] = reactExports.useState("");
  const [disabledActions, setDisabledActions] = reactExports.useState(false);
  const value2 = __spreadValues({
    isOpen,
    setIsOpen,
    currentStep: customCurrentStep || currentStep,
    setCurrentStep: customSetCurrentStep && typeof customSetCurrentStep === "function" ? customSetCurrentStep : setCurrentStep,
    steps,
    setSteps,
    disabledActions,
    setDisabledActions,
    meta,
    setMeta
  }, props);
  return /* @__PURE__ */ React$5.createElement(TourContext.Provider, { value: value2 }, children, isOpen ? /* @__PURE__ */ React$5.createElement(Tour_default, __spreadValues({}, value2)) : null);
};
function useTour() {
  return reactExports.useContext(TourContext);
}
const validate$3 = (operation, options) => {
  if (operation == BulkModificationStringProcessOperation.Delete) {
    return;
  }
  if (!options) {
    return "Please provide valid options";
  }
  const {
    value: value2,
    count,
    index: index2,
    isPositioningDirectionReversed,
    isOperationDirectionReversed,
    find: find2
  } = options;
  switch (operation) {
    case BulkModificationStringProcessOperation.SetWithFixedValue:
    case BulkModificationStringProcessOperation.AddToStart:
    case BulkModificationStringProcessOperation.AddToEnd:
      if (!value2) {
        return "Value is required";
      }
      break;
    case BulkModificationStringProcessOperation.AddToAnyPosition:
      if (index2 == void 0 || index2 < 0 || !value2) {
        return "Value and index are required";
      }
      break;
    case BulkModificationStringProcessOperation.RemoveFromStart:
    case BulkModificationStringProcessOperation.RemoveFromEnd:
      if (count == void 0 || count < 0) {
        return "Count is required";
      }
      break;
    case BulkModificationStringProcessOperation.RemoveFromAnyPosition:
      if (count == void 0 || count < 0 || index2 == void 0 || index2 < 0) {
        return "Count and index are required";
      }
      break;
    case BulkModificationStringProcessOperation.ReplaceFromStart:
    case BulkModificationStringProcessOperation.ReplaceFromEnd:
    case BulkModificationStringProcessOperation.ReplaceFromAnyPosition:
    case BulkModificationStringProcessOperation.ReplaceWithRegex:
      if (!(find2 != void 0 && find2.length > 0) || !value2) {
        return "Find and replace are required";
      }
      break;
  }
  return;
};
const log$e = buildLogger("BulkModificationProcessValueDemonstrator");
const Demonstrator$2 = ({ variables, value: value2 }) => {
  var _a2;
  const { t: t2 } = useTranslation();
  log$e(value2, variables);
  if (!value2) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      Chip,
      {
        isDisabled: true,
        size: "sm",
        radius: "sm",
        children: t2("No set")
      }
    );
  }
  switch (value2.type) {
    case BulkModificationProcessorValueType.ManuallyInput:
      if (!value2.property) {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { isDisabled: true, color: "danger", radius: "sm", size: "sm", children: t2("Unable to get property information") });
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        PropertyValueRenderer,
        {
          bizValue: value2.followPropertyChanges ? void 0 : value2.value,
          dbValue: value2.followPropertyChanges ? value2.value : void 0,
          property: value2.property
        }
      );
    case BulkModificationProcessorValueType.Variable:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "secondary", radius: "sm", size: "sm", variant: "flat", children: t2(
          `BulkModificationProcessorValueType.${BulkModificationProcessorValueType[value2.type]}`
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: (_a2 = variables == null ? void 0 : variables.find((v2) => v2.key === value2.value)) == null ? void 0 : _a2.name })
      ] });
  }
};
Demonstrator$2.displayName = "Demonstrator";
const TypeMismatchTip = (props) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const { toType, fromType } = props;
  if (toType == fromType) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "We will automatically convert the value from {{fromType}} to {{toType}}.",
          {
            fromType: t2(`PropertyType.${PropertyType[fromType]}`),
            toType: t2(`PropertyType.${PropertyType[toType]}`)
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            size: "sm",
            variant: "light",
            onPress: () => {
              createPortal(TypeConversionRuleOverviewDialog, {});
            },
            children: t2("You can check type conversion rules here")
          }
        ) })
      ] }),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Chip,
        {
          className: "ml-2",
          classNames: {
            content: "flex items-center gap-1"
          },
          color: "warning",
          radius: "sm",
          size: "sm",
          variant: "light",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon, { className: "text-base" }),
            t2("Type transformation")
          ]
        }
      )
    }
  );
};
TypeMismatchTip.displayName = "TypeMismatchTip";
const log$d = buildLogger("BulkModificationProcessValueEditor");
const Editor$2 = (props) => {
  const {
    onChange,
    variables,
    value: propsValue,
    baseValueType,
    preferredProperty,
    availableValueTypes
  } = props;
  const { t: t2 } = useTranslation();
  const [
    propertyTypesForManuallySettingValue,
    setPropertyTypesForManuallySettingValue
  ] = reactExports.useState([]);
  const [value2, setValue] = reactExports.useState(
    propsValue ?? {
      type: (availableValueTypes == null ? void 0 : availableValueTypes[0]) ?? BulkModificationProcessorValueType.ManuallyInput
    }
  );
  const valueRef = reactExports.useRef(value2);
  const [error2, setError] = reactExports.useState();
  reactExports.useEffect(() => {
    valueRef.current = value2;
  }, [value2]);
  log$d(value2, preferredProperty, propertyTypesForManuallySettingValue);
  reactExports.useEffect(() => {
    BApi$1.property.getAvailablePropertyTypesForManuallySettingValue().then((r2) => {
      const pvs = r2.data || [];
      setPropertyTypesForManuallySettingValue(pvs);
    });
  }, []);
  const changeValue = reactExports.useCallback(
    (patches, triggerOnChange = true) => {
      var _a2, _b2, _c2;
      const nv = {
        ...valueRef.current,
        ...patches
      };
      switch (nv.type) {
        case BulkModificationProcessorValueType.ManuallyInput: {
          nv.editorPropertyType ?? (nv.editorPropertyType = (preferredProperty == null ? void 0 : preferredProperty.type) ?? ((_a2 = propertyTypesForManuallySettingValue == null ? void 0 : propertyTypesForManuallySettingValue[0]) == null ? void 0 : _a2.type) ?? baseValueType);
          if (!nv.property) {
            const pv = propertyTypesForManuallySettingValue.find(
              (pt) => pt.type == nv.editorPropertyType
            );
            const property2 = ((_b2 = pv == null ? void 0 : pv.properties) == null ? void 0 : _b2.find(
              (p2) => p2.id == nv.propertyId && p2.pool == nv.propertyPool
            )) ?? (preferredProperty == null ? void 0 : preferredProperty.type) == nv.editorPropertyType ? preferredProperty : (_c2 = pv == null ? void 0 : pv.properties) == null ? void 0 : _c2[0];
            if (property2) {
              nv.property = property2;
              nv.propertyId = property2.id;
              nv.propertyPool = property2.pool;
            }
          }
          break;
        }
        case BulkModificationProcessorValueType.Variable: {
          break;
        }
      }
      setValue(nv);
      if (triggerOnChange) {
        onChange == null ? void 0 : onChange(nv);
      }
    },
    [
      preferredProperty,
      propertyTypesForManuallySettingValue,
      baseValueType,
      onChange
    ]
  );
  reactExports.useEffect(() => {
    changeValue(valueRef.current, false);
  }, [changeValue, propertyTypesForManuallySettingValue]);
  const onFollowPropertyChanges = async (follow) => {
    var _a2, _b2;
    const { property: property2 } = value2;
    if (!property2) {
      return;
    }
    if (value2.value) {
      if (!value2.followPropertyChanges && follow) {
        value2.value = deserializeStandardValue(
          ((_a2 = await BApi$1.property.getPropertyDbValue(property2.pool, property2.id, {
            bizValue: value2.value
          })) == null ? void 0 : _a2.data) ?? null,
          property2.dbValueType
        );
      } else {
        if (value2.followPropertyChanges && !follow) {
          value2.value = deserializeStandardValue(
            ((_b2 = await BApi$1.property.getPropertyBizValue(
              property2.pool,
              property2.id,
              { dbValue: value2.value }
            )) == null ? void 0 : _b2.data) ?? null,
            property2.bizValueType
          );
        }
      }
    }
    value2.followPropertyChanges = follow;
    changeValue({ ...value2 });
  };
  const renderEditor = () => {
    if (!value2.editorPropertyType) {
      return null;
    }
    const pv = propertyTypesForManuallySettingValue.find(
      (pt) => pt.type == value2.editorPropertyType
    );
    if (!pv || !pv.isAvailable) {
      return null;
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      value2.property && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(spacer_default, { x: 2 }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          PropertyValueRenderer,
          {
            bizValue: value2.followPropertyChanges ? void 0 : value2.value,
            dbValue: value2.followPropertyChanges ? value2.value : void 0,
            property: value2.property,
            onValueChange: (dv, bv) => {
              changeValue({
                value: value2.followPropertyChanges ? dv : bv
              });
            }
          }
        )
      ] }),
      pv.isReferenceValueType && value2.property && /* @__PURE__ */ jsxRuntimeExports.jsx(
        Tooltip$1,
        {
          color: "secondary",
          content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 max-w-[400px]", children: [
            "By enabling this options data will be changed according to the changes in dynamic properties (single choice, multiple choice, multilevel data, etc.).",
            "For example, if you use the 'actor' from the multiple-choice data as the change result, then in the future, if you modify 'actor' to 'actor1', the current data will also be changed to 'actor1' after next time processing. However, if this options is not enabled, the current data will be changed to 'actor' after next time processing.",
            "For properties(such as text, numbers, dates, etc.) without reference values, there is no difference between statuses of this options."
          ].map((p2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: t2(p2) });
          }) }),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              defaultSelected: true,
              className: "ml-2",
              isSelected: value2.followPropertyChanges,
              onValueChange: onFollowPropertyChanges,
              children: t2("Follow property changes")
            }
          )
        }
      )
    ] });
  };
  const renderPropertyCandidates = () => {
    if (value2.editorPropertyType) {
      const pts = propertyTypesForManuallySettingValue.find(
        (pt) => pt.type == value2.editorPropertyType
      );
      if ((pts == null ? void 0 : pts.properties) && pts.isReferenceValueType) {
        const property2 = pts.properties.find(
          (p2) => p2.id == value2.propertyId && p2.pool == value2.propertyPool
        );
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              variant: "bordered",
              children: property2 ? `(${property2.poolName})${property2.name}` : t2("Choose a property")
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            dropdown_menu_default,
            {
              "aria-label": "Static Actions",
              selectionMode: "single",
              onSelectionChange: (keys2) => {
                const key = Array.from(keys2)[0];
                const segments = key.split("-");
                const pool = parseInt(segments[0], 10);
                const id2 = parseInt(segments[1], 10);
                changeValue({
                  propertyPool: pool,
                  propertyId: id2,
                  property: property2,
                  value: void 0,
                  followPropertyChanges: pts == null ? void 0 : pts.isReferenceValueType
                });
              },
              children: pts.properties.map((s2) => {
                return /* @__PURE__ */ jsxRuntimeExports.jsx(menu_item_base_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: `(${s2.poolName})${s2.name}` }) }, `${s2.pool}-${s2.id}`);
              })
            }
          )
        ] });
      }
    }
    return null;
  };
  const renderByValueType = (valueType) => {
    if (!valueType) {
      return null;
    }
    switch (valueType) {
      case BulkModificationProcessorValueType.ManuallyInput:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                variant: "bordered",
                children: value2.editorPropertyType ? `${t2("Use {{any}}", { any: `${t2(PropertyType[value2.editorPropertyType])} ${t2("editor")}` })}` : t2("Choose a property value editor")
              }
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              dropdown_menu_default,
              {
                "aria-label": "Static Actions",
                className: "max-h-[40vh] overflow-y-auto",
                selectionMode: "single",
                onSelectionChange: (keys2) => {
                  const editorPropertyType = parseInt(
                    Array.from(keys2)[0],
                    10
                  );
                  changeValue({
                    editorPropertyType,
                    property: void 0,
                    propertyId: void 0,
                    propertyPool: void 0,
                    value: void 0,
                    followPropertyChanges: void 0
                  });
                },
                children: propertyTypesForManuallySettingValue.map((pt) => {
                  return /* @__PURE__ */ jsxRuntimeExports.jsx(
                    menu_item_base_default,
                    {
                      className: pt.isAvailable ? "" : "text-gray-400 cursor-not-allowed",
                      isReadOnly: !pt.isAvailable,
                      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                        t2(`PropertyType.${PropertyType[pt.type]}`),
                        !pt.isAvailable && /* @__PURE__ */ jsxRuntimeExports.jsx(
                          Tooltip$1,
                          {
                            className: "max-w-[400px]",
                            color: "warning",
                            content: pt.unavailableReason,
                            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                              RefIcon$R,
                              {
                                className: "text-base"
                              }
                            )
                          }
                        )
                      ] })
                    },
                    pt.type
                  );
                })
              }
            )
          ] }),
          renderPropertyCandidates(),
          renderEditor()
        ] });
      case BulkModificationProcessorValueType.Variable:
        if (!variables || variables.length == 0) {
          return t2("No variables available");
        }
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Select,
          {
            isRequired: true,
            dataSource: variables.map((v2) => ({
              label: v2.name,
              value: v2.key
            })),
            placeholder: t2("Please select a variable"),
            selectedKeys: value2.value ? [value2.value] : void 0,
            selectionMode: "single",
            onSelectionChange: (keys2) => {
              const key = Array.from(keys2)[0];
              changeValue({
                value: key,
                editorPropertyType: void 0,
                property: void 0,
                propertyId: void 0,
                propertyPool: void 0,
                followPropertyChanges: void 0
              });
            }
          }
        );
    }
  };
  const renderTypeMismatchTip = () => {
    var _a2;
    let selectedType;
    switch (value2.type) {
      case BulkModificationProcessorValueType.ManuallyInput:
        selectedType = value2.editorPropertyType;
        break;
      case BulkModificationProcessorValueType.Variable:
        selectedType = (_a2 = variables == null ? void 0 : variables.find((v2) => v2.key == value2.value)) == null ? void 0 : _a2.property.type;
        break;
    }
    if (!selectedType) {
      return null;
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(TypeMismatchTip, { fromType: selectedType, toType: baseValueType });
  };
  const valueTypes2 = availableValueTypes ?? bulkModificationProcessorValueTypes.map((x2) => x2.value);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { isDisabled: valueTypes2.length == 1, children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            variant: "bordered",
            children: t2(
              `BulkModificationProcessorValueType.${BulkModificationProcessorValueType[value2.type]}`
            )
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          dropdown_menu_default,
          {
            "aria-label": "Static Actions",
            selectionMode: "single",
            variant: "flat",
            onSelectionChange: (keys2) => {
              const type4 = parseInt(
                Array.from(keys2)[0],
                10
              );
              changeValue({ type: type4 });
            },
            children: valueTypes2.map((s2) => {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(menu_item_base_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: t2(
                `BulkModificationProcessorValueType.${BulkModificationProcessorValueType[s2]}`
              ) }) }, s2);
            })
          }
        )
      ] }),
      renderByValueType(value2.type),
      renderTypeMismatchTip()
    ] }),
    error2 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-danger", children: t2(error2) })
  ] });
};
Editor$2.displayName = "Editor";
const I18NKeyMap = {
  operation: {
    backward: "Backward",
    forward: "Forward"
  },
  positioning: {
    backward: "Position.End",
    forward: "Position.Beginning"
  }
};
const DirectionSelector = ({ isReversed, onChange, subject }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Button,
    {
      color: "secondary",
      variant: "light",
      onClick: () => {
        onChange == null ? void 0 : onChange(!isReversed);
      },
      children: t2(
        isReversed ? I18NKeyMap[subject]["backward"] : I18NKeyMap[subject]["forward"]
      )
    }
  );
};
DirectionSelector.displayName = "DirectionSelector";
const log$c = buildLogger("StringProcessorEditor");
const Editor$1 = ({
  operation: propsOperation,
  options: propsOptions,
  onChange,
  variables,
  availableValueTypes,
  propertyType
}) => {
  const { t: t2 } = useTranslation();
  const [options, setOptions2] = reactExports.useState(
    propsOptions ?? {}
  );
  const [operation, setOperation] = reactExports.useState(
    propsOperation ?? BulkModificationStringProcessOperation.SetWithFixedValue
  );
  log$c("operation", operation, "options", options, typeof operation);
  reactExports.useEffect(() => {
    const error2 = validate$3(operation, options);
    onChange == null ? void 0 : onChange(
      operation,
      options,
      error2 == void 0 ? void 0 : t2(error2)
    );
  }, [options, operation]);
  const changeOptions = (patches) => {
    const newOptions = {
      ...options,
      ...patches
    };
    setOptions2(newOptions);
  };
  const changeOperation = (newOperation) => {
    setOperation(newOperation);
    const newOptions = {};
    setOptions2(newOptions);
  };
  const renderValueCell = () => {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      Editor$2,
      {
        availableValueTypes,
        baseValueType: propertyType,
        value: options.value,
        variables,
        onChange: (value2) => {
          changeOptions({ value: value2 });
        }
      }
    );
  };
  const renderSubOptions = (options2) => {
    log$c("renderOptions", operation, options2);
    if (!operation) {
      return null;
    }
    const components2 = [];
    switch (operation) {
      case BulkModificationStringProcessOperation.SetWithFixedValue:
        components2.push({
          label: t2("Value"),
          comp: renderValueCell()
        });
        break;
      case BulkModificationStringProcessOperation.Delete:
        break;
      case BulkModificationStringProcessOperation.AddToStart:
      case BulkModificationStringProcessOperation.AddToEnd:
        components2.push({
          label: t2("Value"),
          comp: renderValueCell()
        });
        break;
      case BulkModificationStringProcessOperation.AddToAnyPosition:
        components2.push({
          label: t2("Value"),
          comp: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1 whitespace-nowrap", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Trans,
            {
              i18nKey: "BulkModification.Processor.Editor.Operation.AddToAnyPosition",
              values: {
                value: options2.value
              },
              children: [
                "Add ",
                renderValueCell(),
                " to the ",
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  number_input_default,
                  {
                    className: "w-auto",
                    placeholder: t2("Starts from 0"),
                    style: { width: 100 },
                    value: options2.index,
                    onValueChange: (index2) => changeOptions({ index: index2 })
                  }
                ),
                "(th) character from ",
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  DirectionSelector,
                  {
                    isReversed: options2.isPositioningDirectionReversed,
                    subject: "positioning",
                    onChange: (v2) => changeOptions({ isPositioningDirectionReversed: v2 })
                  }
                )
              ]
            }
          ) })
        });
        break;
      case BulkModificationStringProcessOperation.RemoveFromStart:
      case BulkModificationStringProcessOperation.RemoveFromEnd:
        components2.push({
          label: t2("Count"),
          comp: /* @__PURE__ */ jsxRuntimeExports.jsx(
            number_input_default,
            {
              className: "w-auto",
              style: { width: 100 },
              value: options2.count,
              onValueChange: (count) => changeOptions({ count })
            }
          )
        });
        break;
      case BulkModificationStringProcessOperation.RemoveFromAnyPosition:
        components2.push({
          label: t2("Value"),
          comp: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1 whitespace-nowrap", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Trans,
            {
              i18nKey: "BulkModification.Processor.Editor.Operation.RemoveFromAnyPosition",
              values: {
                value: options2.value
              },
              children: [
                "Delete ",
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  number_input_default,
                  {
                    className: "w-auto",
                    style: { width: 100 },
                    value: options2.count,
                    onValueChange: (count) => changeOptions({ count })
                  }
                ),
                " characters ",
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  DirectionSelector,
                  {
                    isReversed: options2.isPositioningDirectionReversed,
                    subject: "operation",
                    onChange: (v2) => changeOptions({ isPositioningDirectionReversed: v2 })
                  }
                ),
                "from the  ",
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  number_input_default,
                  {
                    className: "w-auto",
                    placeholder: t2("Starts from 0"),
                    style: { width: 100 },
                    value: options2.index,
                    onValueChange: (index2) => changeOptions({ index: index2 })
                  }
                ),
                "(th) charater from ",
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  DirectionSelector,
                  {
                    isReversed: options2.isPositioningDirectionReversed,
                    subject: "positioning",
                    onChange: (v2) => changeOptions({ isPositioningDirectionReversed: v2 })
                  }
                )
              ]
            }
          ) })
        });
        break;
      case BulkModificationStringProcessOperation.ReplaceFromStart:
      case BulkModificationStringProcessOperation.ReplaceFromEnd:
      case BulkModificationStringProcessOperation.ReplaceFromAnyPosition:
      case BulkModificationStringProcessOperation.ReplaceWithRegex:
        components2.push({
          label: t2("Value"),
          comp: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1 whitespace-nowrap", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Trans,
            {
              i18nKey: "BulkModification.Processor.Editor.Operation.Replace",
              children: [
                "Replace ",
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  input_default,
                  {
                    value: options2.find,
                    onValueChange: (find2) => changeOptions({ find: find2 })
                  }
                ),
                " with ",
                renderValueCell()
              ]
            }
          ) })
        });
        break;
    }
    return components2.map((c2, i2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: c2.label }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: c2.comp })
      ] });
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: "grid items-center gap-2",
      style: { gridTemplateColumns: "auto minmax(0, 1fr)" },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Operation") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Select,
          {
            dataSource: bulkModificationStringProcessOperations.map((tpo) => ({
              label: t2(tpo.label),
              value: tpo.value
            })),
            selectedKeys: operation == void 0 ? void 0 : [operation.toString()],
            selectionMode: "single",
            onSelectionChange: (keys2) => {
              changeOperation(
                parseInt(
                  Array.from(keys2 || [])[0],
                  10
                )
              );
            }
          }
        ),
        renderSubOptions(options)
      ]
    }
  );
};
Editor$1.displayName = "Editor";
const log$b = buildLogger("StringValueProcessDemonstrator");
const Demonstrator$1 = (props) => {
  const { operation, options, variables } = props;
  const { t: t2 } = useTranslation();
  log$b(props);
  switch (operation) {
    case TextProcessingOperation.SetWithFixedValue: {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Trans,
          {
            i18nKey: "BulkModification.Processor.Demonstrator.Operation.SetDirectly",
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary" }),
              "with fixed value"
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Demonstrator$2,
          {
            value: options == null ? void 0 : options.value,
            variables
          }
        )
      ] });
    }
    case TextProcessingOperation.AddToStart:
    case TextProcessingOperation.AddToEnd:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.AddToStartOrEnd",
          values: {
            direction: operation == TextProcessingOperation.AddToStart ? t2("Position.Beginning") : t2("Position.End"),
            value: options == null ? void 0 : options.value
          },
          children: [
            "Add",
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Demonstrator$2,
              {
                value: options == null ? void 0 : options.value,
                variables
              }
            ),
            "to",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "primary", children: "beginning or end" })
          ]
        }
      );
    case TextProcessingOperation.AddToAnyPosition:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.AddToAnyPosition",
          values: {
            direction: (options == null ? void 0 : options.isPositioningDirectionReversed) ? t2("Position.End") : t2("Position.Beginning"),
            position: options == null ? void 0 : options.index,
            value: options == null ? void 0 : options.value
          },
          children: [
            "Add",
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Demonstrator$2,
              {
                value: options == null ? void 0 : options.value,
                variables
              }
            ),
            "to the",
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "secondary", children: options == null ? void 0 : options.index }),
            "position from the",
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: "end" })
          ]
        }
      );
    case TextProcessingOperation.RemoveFromStart:
    case TextProcessingOperation.RemoveFromEnd:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.RemoveFromStartOrEnd",
          values: {
            direction: operation == TextProcessingOperation.RemoveFromStart ? t2("Position.Beginning") : t2("Position.End"),
            count: options == null ? void 0 : options.count
          },
          children: [
            "Remove",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "secondary", children: options == null ? void 0 : options.count }),
            "characters from",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "primary", children: "beginning or end" })
          ]
        }
      ) });
    case TextProcessingOperation.RemoveFromAnyPosition: {
      const texts = {
        direction: (options == null ? void 0 : options.isPositioningDirectionReversed) ? t2("Position.End") : t2("Position.Beginning"),
        position: options == null ? void 0 : options.index,
        count: options == null ? void 0 : options.count,
        removeDirection: (options == null ? void 0 : options.isOperationDirectionReversed) ? t2("TextOperation.Backward") : t2("TextOperation.Forward")
      };
      return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.RemoveFromAnyPosition",
          values: texts,
          children: [
            "Delete",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "secondary", children: texts.count }),
            "characters",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "primary", children: texts.removeDirection }),
            "the",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "secondary", children: texts.position }),
            "character from the",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "primary", children: texts.direction })
          ]
        }
      ) });
    }
    case TextProcessingOperation.ReplaceFromStart:
    case TextProcessingOperation.ReplaceFromEnd: {
      const texts = {
        direction: operation == TextProcessingOperation.ReplaceFromEnd ? t2("Position.End") : t2("Position.Beginning"),
        find: options == null ? void 0 : options.find
      };
      return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.ReplaceFromStartOrEnd",
          values: texts,
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: "Replace" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "secondary", children: texts.find }),
            "with",
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Demonstrator$2,
              {
                value: options == null ? void 0 : options.value,
                variables
              }
            ),
            "from",
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: texts.direction })
          ]
        }
      ) });
    }
    case TextProcessingOperation.ReplaceFromAnyPosition: {
      const texts = {
        direction: (options == null ? void 0 : options.isPositioningDirectionReversed) ? t2("end") : t2("start"),
        find: options == null ? void 0 : options.find
      };
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.Replace",
          values: texts,
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: "Replace" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "secondary", children: texts.find }),
            "with",
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Demonstrator$2,
              {
                value: options == null ? void 0 : options.value,
                variables
              }
            )
          ]
        }
      );
    }
    case TextProcessingOperation.ReplaceWithRegex: {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.ReplaceWithRegex",
          values: {
            find: options == null ? void 0 : options.find
          },
          children: [
            "Use",
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: "regex" }),
            "to",
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: "replace" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "secondary", children: options == null ? void 0 : options.find }),
            "with",
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Demonstrator$2,
              {
                value: options == null ? void 0 : options.value,
                variables
              }
            )
          ]
        }
      );
    }
    case TextProcessingOperation.Delete: {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: t2("Delete") });
    }
    default:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: t2("Unsupported value") });
  }
};
Demonstrator$1.displayName = "Demonstrator";
const validate$2 = (operation, options) => {
  if (operation == BulkModificationListStringProcessOperation.Delete) {
    return;
  }
  if (!options) {
    return "Please provide valid options";
  }
  const { value: value2, valueType, isOperationDirectionReversed, modifyOptions } = options;
  switch (operation) {
    case BulkModificationListStringProcessOperation.SetWithFixedValue:
    case BulkModificationListStringProcessOperation.Append:
    case BulkModificationListStringProcessOperation.Prepend:
      if (!value2) {
        return "Value is required";
      }
      break;
    case BulkModificationListStringProcessOperation.Modify:
      if (modifyOptions == void 0) {
        return "Modify options are required";
      }
      if (modifyOptions.filterBy != BulkModificationProcessorOptionsItemsFilterBy.All && (modifyOptions.filterValue == void 0 || modifyOptions.filterValue.length == 0)) {
        return "Filter value is required";
      }
      if (modifyOptions.operation == void 0) {
        return "Operation is required";
      }
      return validate$3(
        modifyOptions.operation,
        modifyOptions.options
      );
  }
  return;
};
const log$a = buildLogger("ListProcessorEditor");
const Editor = ({
  property: property2,
  operation: propsOperation,
  options: propsOptions,
  onChange,
  variables,
  availableValueTypes
}) => {
  const { t: t2 } = useTranslation();
  const [options, setOptions2] = reactExports.useState(
    propsOptions ?? {}
  );
  const [operation, setOperation] = reactExports.useState(
    propsOperation ?? BulkModificationListStringProcessOperation.SetWithFixedValue
  );
  log$a("operation", operation, "options", options, typeof operation);
  reactExports.useEffect(() => {
    const error2 = validate$2(operation, options);
    onChange == null ? void 0 : onChange(
      operation,
      options,
      error2 == void 0 ? void 0 : t2(error2)
    );
  }, [options, operation]);
  const changeOptions = (patches) => {
    const newOptions = {
      ...options,
      ...patches
    };
    setOptions2(newOptions);
  };
  const changeOperation = (newOperation) => {
    setOperation(newOperation);
    const newOptions = {};
    setOptions2(newOptions);
  };
  const renderValueCell = (field = "value") => {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      Editor$2,
      {
        baseValueType: property2.type,
        preferredProperty: property2,
        value: options[field],
        variables,
        onChange: (value2) => changeOptions({
          value: value2
        })
      }
    );
  };
  const renderSubOptions = (options2) => {
    var _a2, _b2, _c2;
    log$a("renderOptions", operation, options2);
    if (!operation) {
      return null;
    }
    const components2 = [];
    switch (operation) {
      case BulkModificationListStringProcessOperation.SetWithFixedValue:
      case BulkModificationListStringProcessOperation.Append:
      case BulkModificationListStringProcessOperation.Prepend:
        components2.push({
          label: t2("Value"),
          comp: renderValueCell()
        });
        break;
      case BulkModificationListStringProcessOperation.Modify: {
        const filterBy = (_a2 = options2 == null ? void 0 : options2.modifyOptions) == null ? void 0 : _a2.filterBy;
        components2.push({
          label: t2("Filter by"),
          comp: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-2/5", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Select,
              {
                dataSource: bulkModificationProcessorOptionsItemsFilterBies.map(
                  (fb2) => ({
                    label: t2(fb2.label),
                    value: fb2.value
                  })
                ),
                selectionMode: "single",
                onSelectionChange: (keys2) => {
                  changeOptions({
                    modifyOptions: {
                      ...options2 == null ? void 0 : options2.modifyOptions,
                      filterBy: parseInt(
                        Array.from(keys2 || [])[0],
                        10
                      )
                    }
                  });
                }
              }
            ) }),
            filterBy != void 0 && (() => {
              switch (filterBy) {
                case BulkModificationProcessorOptionsItemsFilterBy.All:
                  return null;
                case BulkModificationProcessorOptionsItemsFilterBy.Containing:
                case BulkModificationProcessorOptionsItemsFilterBy.Matching:
                  return /* @__PURE__ */ jsxRuntimeExports.jsx(
                    input_default,
                    {
                      placeholder: t2(
                        filterBy == BulkModificationProcessorOptionsItemsFilterBy.Containing ? "Please input keyword" : "Please input a regular expression"
                      ),
                      onValueChange: (v2) => {
                        changeOptions({
                          modifyOptions: {
                            ...options2 == null ? void 0 : options2.modifyOptions,
                            filterValue: v2
                          }
                        });
                      }
                    }
                  );
              }
            })()
          ] })
        });
        components2.push({
          label: t2("For each filtered item"),
          comp: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Editor$1,
            {
              availableValueTypes,
              operation: (_b2 = options2 == null ? void 0 : options2.modifyOptions) == null ? void 0 : _b2.operation,
              propertyType: PropertyType.SingleLineText,
              options: (_c2 = options2 == null ? void 0 : options2.modifyOptions) == null ? void 0 : _c2.options,
              variables,
              onChange: (sOperation, sOptions, error2) => {
                changeOptions({
                  modifyOptions: {
                    ...options2 == null ? void 0 : options2.modifyOptions,
                    operation: sOperation,
                    options: sOptions
                  }
                });
              }
            }
          )
        });
        break;
      }
      case BulkModificationListStringProcessOperation.Delete:
        break;
    }
    return components2.map((c2, i2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: c2.label }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: c2.comp })
      ] });
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: "grid items-center gap-2",
      style: { gridTemplateColumns: "auto minmax(0, 1fr)" },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Operation") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Select,
          {
            dataSource: bulkModificationListStringProcessOperations.map((tpo) => ({
              label: t2(tpo.label),
              value: tpo.value
            })),
            selectedKeys: operation == void 0 ? void 0 : [operation.toString()],
            selectionMode: "single",
            onSelectionChange: (keys2) => {
              changeOperation(
                parseInt(
                  Array.from(keys2 || [])[0],
                  10
                )
              );
            }
          }
        ),
        renderSubOptions(options)
      ]
    }
  );
};
Editor.displayName = "Editor";
const log$9 = buildLogger("ListStringValueProcess");
const Demonstrator = (props) => {
  const { operation, options, variables, property: property2 } = props;
  const { t: t2 } = useTranslation();
  log$9(props);
  switch (operation) {
    case BulkModificationListStringProcessOperation.SetWithFixedValue: {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Trans,
          {
            i18nKey: "BulkModification.Processor.Demonstrator.Operation.SetDirectly",
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary" }),
              "with fixed value"
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Demonstrator$2,
          {
            property: property2,
            value: options == null ? void 0 : options.value,
            valueType: options == null ? void 0 : options.valueType,
            variables
          }
        )
      ] });
    }
    case BulkModificationListStringProcessOperation.AddToStart:
    case BulkModificationListStringProcessOperation.AddToEnd:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.AddToStartOrEnd",
          values: {
            direction: operation == BulkModificationListStringProcessOperation.AddToStart ? t2("Position.Beginning") : t2("Position.End"),
            value: options == null ? void 0 : options.value
          },
          children: [
            "Add",
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Demonstrator$2,
              {
                property: property2,
                value: options == null ? void 0 : options.value,
                valueType: options == null ? void 0 : options.valueType,
                variables
              }
            ),
            "to",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "primary", children: "beginning or end" })
          ]
        }
      );
    case BulkModificationListStringProcessOperation.AddToAnyPosition:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.AddToAnyPosition",
          values: {
            direction: (options == null ? void 0 : options.isPositioningDirectionReversed) ? t2("Position.End") : t2("Position.Beginning"),
            position: options == null ? void 0 : options.index,
            value: options == null ? void 0 : options.value
          },
          children: [
            "Add",
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Demonstrator$2,
              {
                property: property2,
                value: options == null ? void 0 : options.value,
                valueType: options == null ? void 0 : options.valueType,
                variables
              }
            ),
            "to the",
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "secondary", children: options == null ? void 0 : options.index }),
            "position from the",
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: "end" })
          ]
        }
      );
    case BulkModificationListStringProcessOperation.RemoveFromStart:
    case BulkModificationListStringProcessOperation.RemoveFromEnd:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.RemoveFromStartOrEnd",
          values: {
            direction: operation == BulkModificationListStringProcessOperation.RemoveFromStart ? t2("Position.Beginning") : t2("Position.End"),
            count: options == null ? void 0 : options.count
          },
          children: [
            "Remove",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "secondary", children: options == null ? void 0 : options.count }),
            "characters from",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "primary", children: "beginning or end" })
          ]
        }
      ) });
    case BulkModificationListStringProcessOperation.RemoveFromAnyPosition: {
      const texts = {
        direction: (options == null ? void 0 : options.isPositioningDirectionReversed) ? t2("Position.End") : t2("Position.Beginning"),
        position: options == null ? void 0 : options.index,
        count: options == null ? void 0 : options.count,
        removeDirection: (options == null ? void 0 : options.isOperationDirectionReversed) ? t2("TextOperation.Backward") : t2("TextOperation.Forward")
      };
      return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.RemoveFromAnyPosition",
          values: texts,
          children: [
            "Delete",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "secondary", children: texts.count }),
            "characters",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "primary", children: texts.removeDirection }),
            "the",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "secondary", children: texts.position }),
            "character from the",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "primary", children: texts.direction })
          ]
        }
      ) });
    }
    case BulkModificationListStringProcessOperation.ReplaceFromStart:
    case BulkModificationListStringProcessOperation.ReplaceFromEnd: {
      const texts = {
        direction: operation == BulkModificationListStringProcessOperation.ReplaceFromEnd ? t2("Position.End") : t2("Position.Beginning"),
        replace: options == null ? void 0 : options.replace,
        find: options == null ? void 0 : options.find
      };
      return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.ReplaceFromStartOrEnd",
          values: texts,
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: "Replace" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "secondary", children: texts.find }),
            "with",
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Demonstrator$2,
              {
                property: property2,
                value: options == null ? void 0 : options.replace,
                valueType: options == null ? void 0 : options.valueType,
                variables
              }
            ),
            "from",
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: texts.direction })
          ]
        }
      ) });
    }
    case BulkModificationListStringProcessOperation.ReplaceFromAnyPosition: {
      const texts = {
        direction: (options == null ? void 0 : options.isPositioningDirectionReversed) ? t2("end") : t2("start"),
        replace: options == null ? void 0 : options.replace,
        find: options == null ? void 0 : options.find
      };
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.Replace",
          values: texts,
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: "Replace" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "secondary", children: texts.find }),
            "with",
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Demonstrator$2,
              {
                property: property2,
                value: options == null ? void 0 : options.replace,
                valueType: options == null ? void 0 : options.valueType,
                variables
              }
            )
          ]
        }
      );
    }
    case BulkModificationListStringProcessOperation.ReplaceWithRegex: {
      const texts = {
        replace: options == null ? void 0 : options.replace,
        find: options == null ? void 0 : options.find
      };
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.ReplaceWithRegex",
          values: texts,
          children: [
            "Use",
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: "regex" }),
            "to",
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: "replace" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "secondary", children: texts.find }),
            "with",
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Demonstrator$2,
              {
                property: property2,
                value: options == null ? void 0 : options.replace,
                valueType: options == null ? void 0 : options.valueType,
                variables
              }
            )
          ]
        }
      );
    }
    case BulkModificationListStringProcessOperation.Delete: {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: t2("Delete") });
    }
    default:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: t2("Unsupported value") });
  }
};
Demonstrator.displayName = "Demonstrator";
const log$8 = buildLogger("ProcessStepModal");
const ProcessStepModal = ({
  property: property2,
  operation: propsOperation,
  options: propsOptions,
  onDestroyed,
  onSubmit,
  variables,
  availableValueTypes = [BulkModificationProcessorValueType.ManuallyInput]
}) => {
  const { t: t2 } = useTranslation();
  const [operation, setOperation] = reactExports.useState(
    propsOperation
  );
  const [options, setOptions2] = reactExports.useState(propsOptions);
  const [error2, setError] = reactExports.useState();
  log$8("property", property2, "operation", operation, "options", options);
  const renderOptions = () => {
    switch (property2.type) {
      case PropertyType.SingleLineText:
      case PropertyType.MultilineText:
      case PropertyType.Formula:
      case PropertyType.SingleChoice:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Editor$1,
          {
            availableValueTypes,
            operation,
            options,
            propertyType: property2.type,
            variables,
            onChange: (operation2, options2, error22) => {
              setOperation(operation2);
              setOptions2(options2);
              setError(error22);
            }
          }
        );
      case PropertyType.MultipleChoice:
      case PropertyType.Attachment:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Editor,
          {
            availableValueTypes,
            operation,
            options,
            property: property2,
            variables,
            onChange: (operation2, options2, error22) => {
              setOperation(operation2);
              setOptions2(options2);
              setError(error22);
            }
          }
        );
      case PropertyType.Number:
      case PropertyType.Percentage:
      case PropertyType.Rating:
        break;
      case PropertyType.Boolean:
        break;
      case PropertyType.Link:
        break;
      case PropertyType.Date:
      case PropertyType.DateTime:
      case PropertyType.Time:
        break;
      case PropertyType.Multilevel:
        break;
      case PropertyType.Tags:
        break;
    }
    return t2("Not supported");
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          isDisabled: !!error2
        }
      },
      size: "xl",
      onDestroyed,
      onOk: () => {
        if (operation != void 0) {
          log$8("onSubmit", "operation", operation, "options", options);
          onSubmit == null ? void 0 : onSubmit(operation, options);
        }
      },
      children: [
        renderOptions(),
        error2 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "whitespace-break-spaces text-danger", children: [
          t2("ERROR"),
          ": ",
          error2
        ] })
      ]
    }
  );
};
ProcessStepModal.displayName = "ProcessStepModal";
const ProcessStep = ({
  no,
  step: propsStep,
  property: property2,
  onChange,
  variables,
  editable,
  availableValueTypes,
  onDelete
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [step, setStep] = reactExports.useState(propsStep);
  useUpdateEffect(() => {
    setStep(propsStep);
  }, [propsStep]);
  const renderDemonstrator = () => {
    switch (property2.type) {
      case PropertyType.SingleLineText:
      case PropertyType.MultilineText:
      case PropertyType.Formula:
      case PropertyType.SingleChoice:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Demonstrator$1,
          {
            operation: step.operation,
            options: step.options,
            variables
          }
        );
      case PropertyType.MultipleChoice:
      case PropertyType.Attachment:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Demonstrator,
          {
            operation: step.operation,
            options: step.options,
            property: property2,
            variables
          }
        );
      case PropertyType.Number:
      case PropertyType.Percentage:
      case PropertyType.Rating:
        break;
      case PropertyType.Boolean:
        break;
      case PropertyType.Link:
        break;
      case PropertyType.Date:
      case PropertyType.DateTime:
      case PropertyType.Time:
        break;
      case PropertyType.Multilevel:
        break;
      case PropertyType.Tags:
        break;
    }
    return t2("Not supported");
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: `flex items-center flex-wrap gap-1 ${editable ? "cursor-pointer hover:bg-[var(--bakaui-overlap-background)] rounded" : ""}`,
      onClick: editable ? () => {
        createPortal(ProcessStepModal, {
          property: property2,
          availableValueTypes,
          onSubmit: (operation, options) => {
            const newStep = {
              ...step,
              operation,
              options
            };
            setStep(newStep);
            onChange == null ? void 0 : onChange(newStep);
          },
          variables,
          operation: step.operation,
          options: step.options
        });
      } : void 0,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: no }),
        renderDemonstrator(),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            className: "min-w-fit px-2",
            color: "danger",
            size: "sm",
            variant: "light",
            onClick: () => {
              createPortal(Modal, {
                defaultVisible: true,
                title: t2("Delete a process step"),
                children: t2(
                  "Are you sure you want to delete this process step?"
                ),
                onOk: async () => {
                  onDelete();
                }
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" })
          }
        )
      ]
    }
  );
};
ProcessStep.displayName = "ProcessStep";
const PropertyValueScopeSelectorLabel = () => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
    t2("Scope"),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Tooltip$1,
      {
        content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "A property may have multiple dimensional values, and you can choose one of the dimensions as the base data."
        ) }) }),
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" })
      }
    )
  ] });
};
PropertyValueScopeSelectorLabel.displayName = "PropertyValueScopeSelectorLabel";
const validate$1 = (v2) => !(!v2 || !v2.name || !v2.propertyId || !v2.propertyPool || v2.scope == void 0);
const log$7 = buildLogger("VariableModal");
const VariableModal = ({ variable: propsVariable, onDestroyed, onChange }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const bmInternals = useBulkModificationInternalsStore.getState();
  const [variable, setVariable] = reactExports.useState(propsVariable ?? {});
  useUpdateEffect(() => {
    setVariable(propsVariable ?? {});
  }, [propsVariable]);
  log$7(variable, propertyValueScopes);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel", "ok"],
        okProps: {
          isDisabled: !validate$1(variable)
        }
      },
      size: "xl",
      title: t2("Setting variable"),
      onDestroyed,
      onOk: () => {
        if (!validate$1(variable)) {
          throw new Error("Invalid variable");
        }
        onChange == null ? void 0 : onChange(variable);
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(card_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid items-center gap-2", style: { gridTemplateColumns: "auto 1fr" }, children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: t2("Property") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              size: "sm",
              variant: "flat",
              onClick: () => {
                createPortal(PropertySelector, {
                  pool: PropertyPool.All,
                  multiple: false,
                  selection: (variable == null ? void 0 : variable.property) ? [
                    {
                      pool: variable.property.pool,
                      id: variable.property.id
                    }
                  ] : void 0,
                  isDisabled: (p2) => {
                    var _a2;
                    return !((_a2 = bmInternals.supportedStandardValueTypes) == null ? void 0 : _a2.includes(p2.bizValueType));
                  },
                  onSubmit: async (ps) => {
                    const p2 = ps[0];
                    setVariable({
                      ...variable,
                      propertyPool: p2.pool,
                      propertyId: p2.id,
                      property: p2
                    });
                  }
                });
              },
              children: (variable == null ? void 0 : variable.property) ? /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { showPool: true, property: variable.property }) : t2("Select a property")
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyValueScopeSelectorLabel, {}) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Select,
            {
              disallowEmptySelection: true,
              dataSource: propertyValueScopes.map((s2) => ({
                label: t2(`PropertyValueScope.${s2.label}`),
                value: s2.value
              })),
              placeholder: t2("Select a scope for property value"),
              selectedKeys: (variable == null ? void 0 : variable.scope) == void 0 ? void 0 : [variable.scope.toString()],
              selectionMode: "single",
              size: "sm",
              onSelectionChange: (v2) => {
                const scope = Array.from(v2 ?? [])[0];
                setVariable({
                  ...variable,
                  scope
                });
              }
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: t2("Name") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              isClearable: true,
              isRequired: true,
              placeholder: t2("Set a name for this variable"),
              size: "sm",
              value: variable == null ? void 0 : variable.name,
              onValueChange: (v2) => {
                setVariable({
                  ...variable,
                  name: v2
                });
              }
            }
          ) })
        ] }) }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(card_header_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Preprocessing") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Tooltip$1,
              {
                content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                    "If a preprocessing procedure is set, the variables will be preprocessed first before being used."
                  ) }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("You can add multiple preprocessing steps.") })
                ] }),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" })
              }
            )
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(card_body_default, { children: [
            (variable == null ? void 0 : variable.preprocesses) && variable.preprocesses.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 mb-2", children: variable.preprocesses.map((step, i2) => {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                ProcessStep,
                {
                  editable: true,
                  no: i2 + 1,
                  property: variable.property,
                  step,
                  onChange: (newStep) => {
                    variable.preprocesses[i2] = newStep;
                    setVariable({
                      ...variable
                    });
                  },
                  onDelete: () => {
                    var _a2;
                    (_a2 = variable.preprocesses) == null ? void 0 : _a2.splice(i2, 1);
                    setVariable({
                      ...variable
                    });
                  }
                }
              );
            }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "secondary",
                isDisabled: !(variable == null ? void 0 : variable.property),
                size: "sm",
                variant: "ghost",
                onClick: () => {
                  if (variable == null ? void 0 : variable.property) {
                    createPortal(ProcessStepModal, {
                      property: variable.property,
                      onSubmit: (operation, options) => {
                        if (!variable.preprocesses) {
                          variable.preprocesses = [];
                        }
                        variable.preprocesses.push({
                          operation,
                          options
                        });
                        setVariable({
                          ...variable
                        });
                      }
                    });
                  }
                },
                children: t2("Add a preprocess")
              }
            ) })
          ] })
        ] })
      ]
    }
  );
};
VariableModal.displayName = "VariableModal";
const Variables = ({ variables: propsVariable, onChange }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [variables, setVariables] = reactExports.useState(
    propsVariable ?? []
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bulk-modification-variables", children: [
    variables.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1 mb-1", children: variables.map((v2, i2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Chip,
        {
          className: "cursor-pointer",
          radius: "sm",
          size: "sm",
          variant: "bordered",
          onClick: () => {
            createPortal(VariableModal, {
              variable: v2,
              onChange: (v22) => {
                variables[i2] = v22;
                const nvs = [...variables];
                setVariables(nvs);
                onChange == null ? void 0 : onChange(nvs);
              }
            });
          },
          onClose: () => {
            createPortal(Modal, {
              defaultVisible: true,
              title: t2("Delete variable"),
              children: t2(
                "Are you sure to delete variable {{name}}?",
                { name: v2.name }
              ),
              onOk: () => {
                const nvs = variables.filter((v22, idx) => idx != i2);
                setVariables(nvs);
                onChange == null ? void 0 : onChange(nvs);
              }
            });
          },
          children: v2.name
        }
      );
    }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        color: "primary",
        size: "sm",
        variant: "ghost",
        onClick: () => {
          createPortal(VariableModal, {
            onChange: (v2) => {
              const nvs = [...variables, v2];
              setVariables(nvs);
              onChange == null ? void 0 : onChange(nvs);
            }
          });
        },
        children: t2("Add")
      }
    )
  ] });
};
Variables.displayName = "Variables";
const validate = (p2) => !(!p2 || !p2.propertyId || !p2.propertyPool);
const AllBulkModificationValueTypes = [
  BulkModificationProcessorValueType.ManuallyInput,
  BulkModificationProcessorValueType.Variable
];
const ProcessModal = ({ onDestroyed, process: propsProcess, onSubmit, variables }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const bmInternals = useBulkModificationInternalsStore.getState();
  const [process2, setProcess] = reactExports.useState(propsProcess ?? {});
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel", "ok"],
        okProps: {
          isDisabled: !validate(process2)
        }
      },
      size: "xl",
      title: t2("Setting process"),
      onDestroyed,
      onOk: () => {
        if (!validate(process2)) {
          throw new Error("Invalid process");
        }
        onSubmit == null ? void 0 : onSubmit(process2);
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(card_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid items-center gap-2", style: { gridTemplateColumns: "auto 1fr" }, children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: t2("Property") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              size: "sm",
              variant: "light",
              onClick: () => {
                createPortal(PropertySelector, {
                  pool: PropertyPool.All,
                  isDisabled: (p2) => {
                    var _a2, _b2, _c2;
                    return ((_b2 = (_a2 = bmInternals.disabledPropertyKeys) == null ? void 0 : _a2[p2.pool]) == null ? void 0 : _b2.includes(p2.id)) || !((_c2 = bmInternals.supportedStandardValueTypes) == null ? void 0 : _c2.includes(p2.bizValueType));
                  },
                  multiple: false,
                  onSubmit: async (ps) => {
                    const p2 = ps[0];
                    setProcess({
                      ...process2,
                      propertyPool: p2.pool,
                      propertyId: p2.id,
                      property: p2
                    });
                  }
                });
              },
              children: (process2 == null ? void 0 : process2.property) ? /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { showPool: true, property: process2.property }) : t2("Select a property")
            }
          ) })
        ] }) }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(card_header_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Steps") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Tooltip$1,
              {
                content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("You can add multiple preprocessing steps.") }) }),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" })
              }
            )
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(card_body_default, { children: [
            (process2 == null ? void 0 : process2.steps) && process2.steps.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 mb-2", children: process2.steps.map((step, i2) => {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                ProcessStep,
                {
                  editable: true,
                  availableValueTypes: AllBulkModificationValueTypes,
                  no: `${i2 + 1}`,
                  property: process2.property,
                  step,
                  variables,
                  onChange: (newStep) => {
                    process2.steps[i2] = newStep;
                    setProcess({
                      ...process2
                    });
                  },
                  onDelete: () => {
                    var _a2;
                    (_a2 = process2.steps) == null ? void 0 : _a2.splice(i2, 1);
                    setProcess({
                      ...process2
                    });
                  }
                }
              );
            }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "secondary",
                isDisabled: !(process2 == null ? void 0 : process2.property),
                size: "sm",
                variant: "ghost",
                onClick: () => {
                  if (process2 == null ? void 0 : process2.property) {
                    createPortal(ProcessStepModal, {
                      property: process2.property,
                      variables,
                      availableValueTypes: AllBulkModificationValueTypes,
                      onSubmit: (operation, options) => {
                        if (!process2.steps) {
                          process2.steps = [];
                        }
                        process2.steps.push({
                          operation,
                          options
                        });
                        setProcess({
                          ...process2
                        });
                      }
                    });
                  }
                },
                children: t2("Add a preprocess")
              }
            ) })
          ] })
        ] })
      ]
    }
  );
};
ProcessModal.displayName = "ProcessModal";
const log$6 = buildLogger("Processes");
const Processes = ({
  processes: propsProcesses,
  onChange,
  variables
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [processes, setProcesses] = reactExports.useState(
    propsProcesses ?? []
  );
  reactExports.useEffect(() => {
  }, []);
  log$6(processes, variables);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grow", children: [
    processes.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 mb-2", children: processes.map((process2, i2) => {
      var _a2, _b2, _c2;
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(React$5.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          "div",
          {
            className: "flex gap-1 cursor-pointer hover:bg-[var(--bakaui-overlap-background)] rounded items-center",
            onClick: () => {
              createPortal(ProcessModal, {
                process: process2,
                variables,
                onSubmit: (p2) => {
                  processes[i2] = p2;
                  const nps = [...processes];
                  setProcesses(nps);
                  onChange == null ? void 0 : onChange(nps);
                }
              });
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: i2 + 1 }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Chip,
                    {
                      color: "secondary",
                      radius: "sm",
                      size: "sm",
                      variant: "flat",
                      children: (_a2 = process2.property) == null ? void 0 : _a2.poolName
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Chip,
                    {
                      color: "primary",
                      radius: "sm",
                      size: "sm",
                      variant: "light",
                      children: (_b2 = process2.property) == null ? void 0 : _b2.name
                    }
                  )
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    className: "min-w-fit px-2",
                    color: "danger",
                    size: "sm",
                    variant: "light",
                    onClick: () => {
                      createPortal(Modal, {
                        defaultVisible: true,
                        title: t2("Delete current process"),
                        children: t2(
                          "Are you sure you want to delete this process and all its process steps?"
                        ),
                        onOk: async () => {
                          const nps = processes.filter((_24, j2) => j2 !== i2);
                          setProcesses(nps);
                          onChange == null ? void 0 : onChange(nps);
                        }
                      });
                    },
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" })
                  }
                )
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-2 flex flex-col gap-1", children: (_c2 = process2.steps) == null ? void 0 : _c2.map((step, j2) => {
                log$6(step, variables);
                return /* @__PURE__ */ jsxRuntimeExports.jsx(
                  ProcessStep,
                  {
                    editable: false,
                    no: `${i2 + 1}.${j2 + 1}`,
                    property: process2.property,
                    step,
                    variables,
                    onDelete: () => {
                      var _a3;
                      (_a3 = process2.steps) == null ? void 0 : _a3.splice(i2, 1);
                      setProcesses([...processes]);
                      onChange == null ? void 0 : onChange(processes);
                    }
                  }
                );
              }) })
            ]
          }
        ),
        i2 != processes.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "horizontal" }) })
      ] }, i2);
    }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        color: "primary",
        size: "sm",
        variant: "ghost",
        onClick: () => {
          createPortal(ProcessModal, {
            variables,
            onSubmit: (p2) => {
              const nps = [...processes, p2];
              setProcesses(nps);
              onChange == null ? void 0 : onChange(nps);
            }
          });
        },
        children: t2("Add")
      }
    ) })
  ] });
};
Processes.displayName = "Processes";
const PageSize = 20;
const DiffsModal = ({ bmId, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const [keyword, setKeyword] = reactExports.useState();
  const [pageable, setPageable] = reactExports.useState({
    page: 0,
    total: 0
  });
  const [data, setData] = reactExports.useState();
  reactExports.useEffect(() => {
    search2(void 0, 1);
  }, []);
  const TPagination = () => {
    if (pageable.total > 1) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        pagination_default,
        {
          page: pageable.page,
          size: "sm",
          total: pageable.total,
          onChange: (page) => {
            search2(keyword, page);
          }
        }
      ) });
    }
    return null;
  };
  const search2 = (keyword2, page) => {
    setPageable({
      ...pageable,
      page
    });
    BApi$1.bulkModification.searchBulkModificationDiffs(bmId, {
      path: keyword2,
      pageIndex: page,
      pageSize: PageSize
    }).then((r2) => {
      setData(r2.data || []);
      setPageable({
        ...pageable,
        total: Math.ceil(r2.totalCount / PageSize)
      });
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal, { defaultVisible: true, size: "xl", onDestroyed, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-8", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          endContent: /* @__PURE__ */ jsxRuntimeExports.jsx(kbd_default, { keys: ["enter"] }),
          placeholder: t2("Search"),
          size: "sm",
          startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1h, { className: "text-base" }),
          value: keyword,
          onKeyDown: (e2) => {
            if (e2.key == "Enter") {
              search2(keyword, 1);
            }
          },
          onValueChange: (e2) => setKeyword(e2)
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(TPagination, {})
    ] }) }),
    data ? data.length == 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center mt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("No data") }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        "1.",
        " ",
        t2(
          "Please ensure that the calculation operation has been executed."
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        "2.",
        " ",
        t2(
          "If the calculation operation has been executed, there may be no resources that will be changed."
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        "3. ",
        t2("Please check the search criteria.")
      ] })
    ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { removeWrapper: true, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Resource") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Diffs") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: data.map((d2) => {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-w-[600px] break-all", children: d2.resourcePath }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: d2.diffs.map((diff2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Chip,
                  {
                    color: "secondary",
                    size: "sm",
                    variant: "flat",
                    children: diff2.property.poolName
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "primary", size: "sm", children: diff2.property.name })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  PropertyValueRenderer,
                  {
                    bizValue: diff2.value1,
                    property: diff2.property
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$14, { className: "text-base" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  PropertyValueRenderer,
                  {
                    bizValue: diff2.value2,
                    property: diff2.property
                  }
                )
              ] })
            ] });
          }) })
        ] });
      }) })
    ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center mt-12", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, {}) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(TPagination, {})
  ] });
};
DiffsModal.displayName = "DiffsModal";
const Blocks = [
  "Filters",
  "Variables",
  "Processes",
  "Changes",
  "FinalStep"
];
const log$5 = buildLogger("BulkModification");
const BulkModification = ({ bm, onChange }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const { isOpen, currentStep, steps, setIsOpen, setCurrentStep, setSteps } = useTour();
  const [calculatingDiffs, setCalculatingDiffs] = reactExports.useState(false);
  const reload = reactExports.useCallback(async () => {
    const r2 = await BApi$1.bulkModification.getBulkModification(bm.id);
    onChange(r2.data);
  }, [onChange]);
  log$5(bm);
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-start gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2 grow", children: Blocks.map((bk2, i2) => {
    var _a2;
    let blockInner;
    let blockTip;
    switch (bk2) {
      case "Filters":
        blockTip = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Select resources to be modified.") });
        blockInner = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            FilterGroupsPanel,
            {
              group: bm.filter,
              onChange: (g2) => {
                bm.filter = g2;
                BApi$1.bulkModification.patchBulkModification(bm.id, {
                  filter: g2
                });
              }
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "primary",
                size: "sm",
                variant: "ghost",
                onClick: () => {
                  BApi$1.bulkModification.filterResourcesInBulkModification(bm.id).then((r2) => {
                    reload();
                  });
                },
                children: t2("Filter(Verb)")
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "", children: t2("{{count}} resources have been filtered out", {
              count: ((_a2 = bm.filteredResourceIds) == null ? void 0 : _a2.length) || 0
            }) })
          ] })
        ] });
        break;
      case "Variables":
        blockTip = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "You can define and preprocess variables here, then use it in process steps."
        ) });
        blockInner = /* @__PURE__ */ jsxRuntimeExports.jsx(
          Variables,
          {
            variables: bm.variables,
            onChange: (vs) => {
              bm.variables = vs;
              BApi$1.bulkModification.patchBulkModification(bm.id, {
                variables: vs.map((v2) => ({
                  ...v2,
                  preprocesses: JSON.stringify(v2.preprocesses)
                }))
              }).then((r2) => {
                reload();
              });
            }
          }
        );
        break;
      case "Processes":
        blockTip = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "You can define process steps here, and use variables in steps, to modify all filtered resources."
        ) });
        blockInner = /* @__PURE__ */ jsxRuntimeExports.jsx(
          Processes,
          {
            processes: bm.processes,
            variables: bm.variables,
            onChange: (ps) => {
              bm.processes = ps;
              BApi$1.bulkModification.patchBulkModification(bm.id, {
                processes: ps.map((v2) => ({
                  ...v2,
                  steps: JSON.stringify(v2.steps)
                }))
              }).then((r2) => {
                reload();
              });
            }
          }
        );
        break;
      case "Changes":
        blockTip = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "Before applying bulk modification, you must calculate and check the changes here."
        ) });
        blockInner = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              isLoading: calculatingDiffs,
              size: "sm",
              variant: "bordered",
              onClick: () => {
                setCalculatingDiffs(true);
                BApi$1.bulkModification.previewBulkModification(bm.id).then((r2) => {
                  reload();
                }).finally(() => {
                  setCalculatingDiffs(false);
                });
              },
              children: t2("Calculate changes")
            }
          ),
          bm.resourceDiffCount > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              size: "sm",
              variant: "light",
              onClick: () => {
                createPortal(DiffsModal, {
                  bmId: bm.id
                });
              },
              children: t2("Check {{count}} diffs", {
                count: bm.resourceDiffCount
              })
            }
          )
        ] });
        break;
      case "FinalStep":
        blockInner = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              isDisabled: !bm.processes || bm.processes.length === 0 || bm.resourceDiffCount == 0,
              size: "sm",
              onClick: () => {
                createPortal(Modal, {
                  defaultVisible: true,
                  title: t2("Apply bulk modification"),
                  children: t2(
                    "Please check diffs before applying, and changed value may not be reverted perfectly in some situations,  are you sure to apply?"
                  ),
                  onOk: async () => {
                    await BApi$1.bulkModification.applyBulkModification(
                      bm.id
                    );
                    reload();
                  }
                });
              },
              children: t2("Apply changes")
            }
          ),
          bm.appliedAt && /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "warning",
              size: "sm",
              variant: "flat",
              onClick: () => {
                createPortal(Modal, {
                  defaultVisible: true,
                  title: t2("Revert bulk modification"),
                  children: t2(
                    "Are you sure to revert the bulk modification?"
                  ),
                  onOk: async () => {
                    await BApi$1.bulkModification.revertBulkModification(
                      bm.id
                    );
                    reload();
                  }
                });
              },
              children: t2("Revert changes")
            }
          )
        ] });
        break;
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-4 items-center", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-[120px] text-right", children: blockTip ? /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: blockTip, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Chip,
          {
            classNames: {
              content: "items-center flex gap-1"
            },
            radius: "sm",
            children: [
              t2(bk2),
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" })
            ]
          }
        ) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", children: t2(bk2) }) }),
        blockInner
      ] }),
      i2 != Blocks.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "horizontal" })
    ] });
  }) }) });
};
BulkModification.displayName = "BulkModification";
const BulkModification2Page = () => {
  var _a2;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const forceUpdate = useUpdate();
  const bmInternals = useBulkModificationInternalsStore.getState();
  const [expandedKeys, setExpandedKeys] = reactExports.useState(["4"]);
  const [bulkModifications, setBulkModifications] = reactExports.useState();
  const loadAllBulkModifications = reactExports.useCallback(async () => {
    const r2 = await BApi$1.bulkModification.getAllBulkModifications();
    const bms = r2.data || [];
    setBulkModifications(bms);
  }, []);
  reactExports.useEffect(() => {
    loadAllBulkModifications();
  }, []);
  console.log(expandedKeys);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          color: "primary",
          size: "sm",
          onPress: () => {
            BApi$1.bulkModification.addBulkModification().then((r2) => {
              loadAllBulkModifications();
            });
          },
          children: t2("Add a bulk modification")
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        t2("Under development, currently supported data types"),
        (_a2 = bmInternals.supportedStandardValueTypes) == null ? void 0 : _a2.map((x2) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: t2(`StandardValueType.${StandardValueType[x2]}`) });
        })
      ] })
    ] }),
    bulkModifications ? bulkModifications.length == 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: t2("No data") }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
      accordion_default,
      {
        className: "p-0 pt-1",
        selectedKeys: expandedKeys,
        selectionMode: "multiple",
        variant: "splitted",
        onSelectionChange: (keys2) => {
          if (!keys2) {
            setExpandedKeys([]);
          }
          setExpandedKeys(Array.from(keys2).map((x2) => x2));
        },
        children: bulkModifications.map((bm, i2) => {
          var _a3;
          const isExpanded = expandedKeys.includes(bm.id.toString());
          console.log(expandedKeys, isExpanded, bm.id.toString());
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            accordion_item_base_default,
            {
              title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                    bm.name,
                    isExpanded && /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Button,
                      {
                        isIconOnly: true,
                        size: "sm",
                        variant: "light",
                        onPress: (e2) => {
                          let newName = bm.name;
                          createPortal(Modal, {
                            defaultVisible: true,
                            size: "lg",
                            title: t2(
                              "Edit name of bulk modification"
                            ),
                            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                              input_default,
                              {
                                isRequired: true,
                                defaultValue: bm.name,
                                onValueChange: (v2) => newName = v2.trim()
                              }
                            ),
                            onOk: async () => {
                              if (newName.length == 0) {
                                Vt.error(
                                  t2("Name cannot be empty")
                                );
                                throw new Error("Name cannot be empty");
                              }
                              BApi$1.bulkModification.patchBulkModification(bm.id, {
                                name: newName
                              }).then((r2) => {
                                if (!r2.code) {
                                  bm.name = newName;
                                  forceUpdate();
                                }
                              });
                            }
                          });
                        },
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$T, { className: "text-base" })
                      }
                    )
                  ] }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", children: t2("{{count}} resources related", {
                    count: ((_a3 = bm.filteredResourceIds) == null ? void 0 : _a3.length) || 0
                  }) })
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Chip,
                    {
                      size: "sm",
                      variant: "light",
                      children: bm.createdAt
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      size: "sm",
                      variant: "bordered",
                      onClick: () => {
                        BApi$1.bulkModification.duplicateBulkModification(bm.id).then((r2) => {
                          loadAllBulkModifications();
                        });
                      },
                      children: t2("Duplicate")
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Tooltip$1,
                    {
                      content: t2(
                        `Click to ${bm.isActive ? "disable" : "enable"}`
                      ),
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                        Button,
                        {
                          color: bm.isActive ? "success" : "warning",
                          size: "sm",
                          variant: "light",
                          onClick: () => {
                            BApi$1.bulkModification.patchBulkModification(bm.id, {
                              isActive: !bm.isActive
                            }).then((r2) => {
                              loadAllBulkModifications();
                            });
                          },
                          children: t2(bm.isActive ? "Enabled" : "Disabled")
                        }
                      )
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      isIconOnly: true,
                      color: "danger",
                      size: "sm",
                      variant: "light",
                      onClick: () => {
                        createPortal(Modal, {
                          defaultVisible: true,
                          title: t2("Delete bulk modification"),
                          children: t2(
                            "Are you sure to delete this bulk modification?"
                          ),
                          onOk: async () => {
                            await BApi$1.bulkModification.deleteBulkModification(
                              bm.id
                            );
                            loadAllBulkModifications();
                          }
                        });
                      },
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" })
                    }
                  )
                ] })
              ] }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                BulkModification,
                {
                  bm,
                  onChange: (newBm) => setBulkModifications(
                    bulkModifications.map(
                      (b2) => b2.id == newBm.id ? newBm : b2
                    )
                  )
                }
              )
            },
            bm.id.toString()
          );
        })
      }
    ) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "lg" }) })
  ] });
};
BulkModification2Page.displayName = "BulkModification2Page";
const CachePage = () => {
  const { t: t2 } = useTranslation();
  const [cacheOverview, setCacheOverview] = reactExports.useState();
  const reload = async () => {
    const r2 = await BApi$1.cache.getCacheOverview();
    setCacheOverview(
      r2.data ?? {
        categoryCaches: [],
        mediaLibraryCaches: []
      }
    );
  };
  reactExports.useEffect(() => {
    reload();
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
    (cacheOverview == null ? void 0 : cacheOverview.mediaLibraryCaches) && cacheOverview.mediaLibraryCaches.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-4 gap-2", children: cacheOverview.mediaLibraryCaches.map((item, idx) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(card_header_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-md", children: item.mediaLibraryName }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-small text-default-500", children: [
            t2("Resource count"),
            ": ",
            item.resourceCount
          ] })
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
        /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { children: Object.keys(item.resourceCacheCountMap).map(
          (key, idx2) => {
            const type4 = parseInt(key, 10);
            return /* @__PURE__ */ jsxRuntimeExports.jsxs(
              "div",
              {
                className: "flex items-center gap-2",
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { radius: "sm", size: "sm", children: [
                    t2("Cached"),
                    " ",
                    t2(ResourceCacheType[type4])
                  ] }),
                  item.resourceCacheCountMap[type4],
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      isIconOnly: true,
                      color: "danger",
                      size: "sm",
                      variant: "light",
                      onClick: () => {
                        BApi$1.cache.deleteResourceCacheByMediaLibraryIdAndCacheType(
                          item.mediaLibraryId,
                          parseInt(key, 10)
                        ).then((r2) => {
                          if (!r2.code) {
                            reload();
                          }
                        });
                      },
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" })
                    }
                  )
                ]
              },
              idx2
            );
          }
        ) })
      ] }, idx);
    }) }),
    (cacheOverview == null ? void 0 : cacheOverview.categoryCaches) && cacheOverview.categoryCaches.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-4 gap-2", children: cacheOverview.categoryCaches.map((item, idx) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(card_header_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-md", children: [
            item.categoryName,
            /* @__PURE__ */ jsxRuntimeExports.jsx(DeprecatedChip, {})
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-small text-default-500", children: [
            t2("Resource count"),
            ": ",
            item.resourceCount
          ] })
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
        /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { children: Object.keys(item.resourceCacheCountMap).map(
          (key, idx2) => {
            const type4 = parseInt(key, 10);
            return /* @__PURE__ */ jsxRuntimeExports.jsxs(
              "div",
              {
                className: "flex items-center gap-2",
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { radius: "sm", size: "sm", children: [
                    t2("Cached"),
                    " ",
                    t2(ResourceCacheType[type4])
                  ] }),
                  item.resourceCacheCountMap[type4],
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      isIconOnly: true,
                      color: "danger",
                      size: "sm",
                      variant: "light",
                      onClick: () => {
                        BApi$1.cache.deleteResourceCacheByCategoryIdAndCacheType(
                          item.categoryId,
                          parseInt(key, 10)
                        ).then((r2) => {
                          if (!r2.code) {
                            reload();
                          }
                        });
                      },
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" })
                    }
                  )
                ]
              },
              idx2
            );
          }
        ) })
      ] }, idx);
    }) })
  ] }) });
};
CachePage.displayName = "CachePage";
const AliasPage = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [form2, setForm] = reactExports.useState({
    pageSize: 20,
    pageIndex: 0,
    additionalItems: AliasAdditionalItem.Candidates
  });
  const [aliases2, setAliases] = reactExports.useState([]);
  const [bulkOperationContext, setBulkOperationContext] = reactExports.useState({
    preferredTexts: []
  });
  const [totalCount, setTotalCount] = reactExports.useState(0);
  const [, forceUpdate] = reactExports.useReducer((x2) => x2 + 1, 0);
  reactExports.useEffect(() => {
    search2();
  }, []);
  const search2 = (pForm) => {
    const nf2 = {
      ...form2,
      ...pForm
    };
    setForm(nf2);
    BApi$1.alias.searchAliasGroups(nf2).then((a2) => {
      var _a2;
      const data = ((_a2 = a2.data) == null ? void 0 : _a2.map((x2) => ({
        originalText: x2.text,
        text: x2.text,
        preferred: x2.preferred ?? void 0,
        candidates: x2.candidates ?? void 0
      }))) ?? [];
      setAliases(data);
      setTotalCount(a2.totalCount);
      if (data.length === 0 && nf2.pageIndex > 0 && a2.totalCount > 0) {
        const lastPage = Math.max(0, Math.ceil(a2.totalCount / nf2.pageSize) - 1);
        search2({ pageIndex: lastPage });
      }
    });
  };
  const renderPagination = () => {
    const pageCount = Math.ceil(totalCount / form2.pageSize);
    if (pageCount > 1) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        pagination_default,
        {
          page: form2.pageIndex,
          size: "sm",
          total: pageCount,
          onChange: (p2) => search2({ pageIndex: p2 })
        }
      ) });
    }
    return;
  };
  const resetBulkOperationContext = () => {
    setBulkOperationContext({
      preferredTexts: []
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            placeholder: t2("Press enter to search"),
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1h, { className: "text-sm" }),
            value: form2.fuzzyText,
            onKeyDown: (e2) => {
              if (e2.key == "Enter") {
                search2();
              }
            },
            onValueChange: (v2) => setForm({
              ...form2,
              fuzzyText: v2
            })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-500", children: t2(
          "Alias is used to replace the original text of property values in UI, such as translations, etc."
        ) })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "primary",
            size: "sm",
            onClick: () => {
              let value2;
              createPortal(Modal, {
                defaultVisible: true,
                size: "lg",
                title: t2("Add an alias"),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  input_default,
                  {
                    classNames: {
                      input: "break-all"
                    },
                    onValueChange: (v2) => value2 = v2
                  }
                ),
                onOk: async () => {
                  await BApi$1.alias.addAlias({
                    text: value2
                  });
                  search2();
                }
              });
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$m, { className: "text-base" }),
              t2("Add an alias")
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "secondary",
            size: "sm",
            onClick: () => {
              createPortal(FileSystemSelectorModal, {
                onSelected: (e2) => {
                  const modal2 = createPortal(Modal, {
                    visible: true,
                    title: t2("Importing, please wait..."),
                    footer: false,
                    closeButton: false
                  });
                  BApi$1.alias.importAliases({ path: e2.path }).then((r2) => {
                    modal2.destroy();
                  });
                },
                targetType: "file",
                filter: (e2) => e2.isDirectoryOrDrive || e2.path.endsWith(".csv")
              });
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$2, { className: "text-base" }),
              t2("Import")
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            size: "sm",
            onPress: () => {
              BApi$1.gui.openUrlInDefaultBrowser({
                url: `${envConfig.apiEndpoint}/alias/xlsx`
              });
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, { className: "text-base" }),
              t2("Export")
            ]
          }
        )
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { className: "my-1" }),
    bulkOperationContext.preferredTexts.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(card_header_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-md flex items-center gap-2", children: [
        t2("Bulk operations"),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Tooltip$1,
          {
            classNames: {
              content: "max-w-md break-all whitespace-normal"
            },
            content: t2(
              "{{text}} will be the preferred text in merged groups, you can change the preferred text by clicking the text.",
              { text: bulkOperationContext.preferredTexts[0] }
            ),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "secondary",
                size: "sm",
                startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$u, { className: "text-sm" }),
                onClick: () => {
                  createPortal(Modal, {
                    defaultVisible: true,
                    title: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "break-all whitespace-normal", children: t2("Merging alias groups: {{texts}}", {
                      texts: bulkOperationContext.preferredTexts.join(", ")
                    }) }),
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "break-all whitespace-normal", children: t2(
                      "All selected alias groups will be merged into one, and the final preferred is {{preferred}}, are you sure?",
                      { preferred: bulkOperationContext.preferredTexts[0] }
                    ) }),
                    onOk: async () => {
                      await BApi$1.alias.mergeAliasGroups({
                        preferredTexts: bulkOperationContext.preferredTexts
                      });
                      resetBulkOperationContext();
                      search2();
                    }
                  });
                },
                children: t2("Merge")
              }
            )
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "danger",
            size: "sm",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-sm" }),
            onClick: () => {
              createPortal(Modal, {
                defaultVisible: true,
                title: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "break-all whitespace-normal", children: t2("Deleting alias groups: {{texts}}", {
                  texts: bulkOperationContext.preferredTexts.join(", ")
                }) }),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "break-all whitespace-normal", children: t2(
                  "All selected alias groups and its candidates will be delete and there is no way back, are you sure?"
                ) }),
                onOk: async () => {
                  await BApi$1.alias.deleteAliasGroups({
                    preferredTexts: bulkOperationContext.preferredTexts
                  });
                  resetBulkOperationContext();
                  search2();
                }
              });
            },
            children: t2("Delete")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "default",
            size: "sm",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$S, { className: "text-sm" }),
            onClick: () => {
              resetBulkOperationContext();
            },
            children: t2("Exit")
          }
        )
      ] }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
      /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: bulkOperationContext.preferredTexts.map((t22, i2) => {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Chip,
          {
            classNames: {
              base: "max-w-full",
              content: "break-all whitespace-normal"
            },
            color: i2 == 0 ? "primary" : "default",
            radius: "sm",
            size: "sm",
            className: "h-auto py-1",
            onClick: () => {
              bulkOperationContext.preferredTexts.splice(i2, 1);
              setBulkOperationContext({
                ...bulkOperationContext,
                preferredTexts: [t22, ...bulkOperationContext.preferredTexts]
              });
            },
            onClose: () => {
              const texts = bulkOperationContext.preferredTexts.filter((x2) => x2 != t22);
              if (texts.length == 0) {
                resetBulkOperationContext();
              } else {
                setBulkOperationContext({
                  ...bulkOperationContext,
                  preferredTexts: texts
                });
              }
            },
            children: t22
          },
          t22
        );
      }) }) })
    ] }) }),
    aliases2.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
      table_default,
      {
        isCompact: true,
        isStriped: true,
        removeWrapper: true,
        bottomContent: renderPagination(),
        color: "primary",
        selectedKeys: bulkOperationContext.preferredTexts.filter(
          (x2) => aliases2.some((a2) => a2.text == x2)
        ),
        selectionMode: "multiple",
        topContent: renderPagination(),
        onSelectionChange: (keys2) => {
          let selection;
          if (keys2 === "all") {
            selection = aliases2.map((a2) => a2.text);
          } else {
            selection = Array.from(keys2).map(String);
          }
          const notSelected = aliases2.map((x2) => x2.text).filter((x2) => !selection.includes(x2));
          const ns = Array.from(
            new Set(
              bulkOperationContext.preferredTexts.filter((x2) => !notSelected.includes(x2)).concat(selection)
            )
          );
          setBulkOperationContext({
            ...bulkOperationContext,
            preferredTexts: ns
          });
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Preferred") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Candidates") })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: aliases2.map((a2) => {
            var _a2;
            return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { className: "break-all max-w-xs", children: a2.originalText }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { className: "max-w-md", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                "div",
                {
                  className: "flex flex-wrap gap-1",
                  onClick: (e2) => {
                    e2.cancelable = true;
                    e2.stopPropagation();
                    e2.preventDefault();
                  },
                  children: (_a2 = a2.candidates) == null ? void 0 : _a2.map((c2) => {
                    return /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Tooltip$1,
                      {
                        content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          Button,
                          {
                            color: "success",
                            size: "sm",
                            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$5, { className: "text-sm" }),
                            variant: "light",
                            onClick: () => {
                              BApi$1.alias.patchAlias(
                                {
                                  isPreferred: true
                                },
                                { text: c2 }
                              ).then(() => {
                                search2();
                              });
                            },
                            children: t2("Set as preferred")
                          }
                        ) }),
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          Chip,
                          {
                            classNames: {
                              base: "max-w-full",
                              content: "break-all whitespace-normal"
                            },
                            radius: "sm",
                            onClose: () => {
                              createPortal(Modal, {
                                defaultVisible: true,
                                title: t2("Deleting an alias"),
                                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "break-all whitespace-normal", children: [
                                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("We are deleting") }),
                                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold my-2", children: c2 }),
                                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("There is no way back, are you sure?") })
                                ] }),
                                onOk: async () => {
                                  var _a3;
                                  await BApi$1.alias.deleteAlias({ text: c2 });
                                  a2.candidates = (_a3 = a2.candidates) == null ? void 0 : _a3.filter((x2) => x2 != c2);
                                  forceUpdate();
                                }
                              });
                            },
                            children: c2
                          }
                        )
                      },
                      c2
                    );
                  })
                }
              ) })
            ] }, a2.text);
          }) })
        ]
      }
    ) })
  ] });
};
AliasPage.displayName = "AliasPage";
const DetailPage = ({ value: propsValue, onChange }) => {
  const { t: t2 } = useTranslation();
  const [value2, setValue] = reactExports.useState(
    JSON.parse(JSON.stringify(propsValue))
  );
  const change = (patches) => {
    const nv = {
      ...value2,
      ...patches
    };
    setValue(nv);
    onChange(nv);
  };
  switch (value2.type) {
    case SpecialTextType.DateTime:
    case SpecialTextType.Volume:
    case SpecialTextType.Useless:
    case SpecialTextType.Trim:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          required: true,
          className: "w-full",
          placeholder: t2("Text"),
          value: value2.value1,
          onValueChange: (value1) => {
            change({ value1 });
          }
        },
        "0"
      );
    case SpecialTextType.Language:
    case SpecialTextType.Standardization:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            required: true,
            placeholder: t2("Source text"),
            value: value2.value1,
            onValueChange: (value1) => {
              change({ value1 });
            }
          },
          "0"
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            required: true,
            placeholder: t2("Convert to"),
            value: value2.value2,
            onValueChange: (value22) => {
              change({ value2: value22 });
            }
          },
          "1"
        )
      ] });
    case SpecialTextType.Wrapper:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            required: true,
            placeholder: t2("Left wrapper"),
            value: value2.value1,
            onValueChange: (value1) => {
              change({ value1 });
            }
          },
          "0"
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            required: true,
            placeholder: t2("Right wrapper"),
            value: value2.value2,
            onValueChange: (value22) => {
              change({ value2: value22 });
            }
          },
          "1"
        )
      ] });
    default:
      return null;
  }
};
DetailPage.displayName = "DetailPage";
const tagRenders = {
  Single: (t2) => t2.value1,
  Wrapper: (t2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    t2.value1,
    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "opacity-50", children: "..." }),
    t2.value2
  ] }),
  Value1ToValue2: (t2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1", children: [
    t2.value1,
    /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$14, { className: "text-small opacity-50" }),
    t2.value2
  ] })
};
const typeTagRendersMapping = {
  [SpecialTextType.Useless]: tagRenders.Single,
  [SpecialTextType.Language]: tagRenders.Value1ToValue2,
  [SpecialTextType.Wrapper]: tagRenders.Wrapper,
  [SpecialTextType.Standardization]: tagRenders.Value1ToValue2,
  [SpecialTextType.Volume]: tagRenders.Single,
  [SpecialTextType.Trim]: tagRenders.Single
};
const typeDescriptions = {
  [SpecialTextType.Useless]: "Ignore the part inside the wrapper that is successfully matched by the regular expression",
  [SpecialTextType.Language]: "Text will be parsed as [specific language] if it surrounded by [wrappers]",
  [SpecialTextType.Wrapper]: "Text wrapper, used to match and extract the text within the wrapper",
  [SpecialTextType.Standardization]: "Treat [text1] as [text2] during analyzation",
  [SpecialTextType.Volume]: "Extract volume information from this text group",
  [SpecialTextType.Trim]: "TBD, do not set it for now",
  [SpecialTextType.DateTime]: "Date and time parsing template, used to extract dates and times from text"
};
const usedInMapping = {
  [SpecialTextType.Useless]: ["Text pretreatment"],
  [SpecialTextType.Language]: ["Bakabase enhancer analysis"],
  [SpecialTextType.Wrapper]: [
    "Text pretreatment",
    "Resource display name template",
    "Exhentai enhancer analysis"
  ],
  [SpecialTextType.Standardization]: ["Text pretreatment"],
  [SpecialTextType.Volume]: ["Bakabase enhancer analysis"],
  [SpecialTextType.Trim]: ["Text pretreatment"],
  [SpecialTextType.DateTime]: [
    "Bakabase enhancer analysis",
    "Parsing or converting property value"
  ]
};
const TextPage = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [textsMap, setTextsMap] = reactExports.useState({});
  const [testInput, setTestInput] = reactExports.useState("");
  const [testResult, setTestResult] = reactExports.useState("");
  const [isRunning, setIsRunning] = reactExports.useState(false);
  const hasDiff = reactExports.useMemo(() => testInput !== testResult, [testInput, testResult]);
  const renderDiffChunks = (a2, b2) => {
    if (!a2 && !b2)
      return null;
    const dmp = new DiffMatchPatch$1();
    const diffs = dmp.diff_main(a2 || "", b2 || "");
    dmp.diff_cleanupSemantic(diffs);
    const left2 = [];
    const right = [];
    for (const [op, text2] of diffs) {
      if (op === 0) {
        left2.push(/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: text2 }));
        right.push(/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: text2 }));
      } else if (op === -1) {
        left2.push(/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "bg-danger-100 text-danger-600", children: text2 }));
      } else if (op === 1) {
        right.push(/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "bg-success-100 text-success-700", children: text2 }));
      }
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border border-default-200 rounded-md p-2 whitespace-pre-wrap break-words text-sm", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium mb-2", children: t2("Original") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: left2 })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border border-default-200 rounded-md p-2 whitespace-pre-wrap break-words text-sm", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium mb-2", children: t2("Pretreated") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: right })
      ] })
    ] });
  };
  reactExports.useEffect(() => {
    loadData();
  }, []);
  const loadData = () => {
    BApi$1.specialText.getAllSpecialTexts().then((t22) => {
      const data = t22.data || {};
      const ts = specialTextTypes.reduce((s2, t3) => {
        const list2 = data[t3.value] ?? [];
        list2.sort((a2, b2) => a2.value1.localeCompare(b2.value1));
        s2[t3.value] = list2.map((l2) => ({
          id: l2.id,
          value1: l2.value1,
          value2: l2.value2,
          type: l2.type
        }));
        return s2;
      }, {});
      setTextsMap(ts);
    });
  };
  const renderDetail = (c2) => {
    let text2 = c2;
    createPortal(Modal, {
      defaultVisible: true,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DetailPage, { value: c2, onChange: (t22) => text2 = t22 }) }),
      size: "lg",
      onOk: async () => {
        if (c2.id > 0) {
          await BApi$1.specialText.patchSpecialText(c2.id, text2);
        } else {
          await BApi$1.specialText.addSpecialText(text2);
        }
        await loadData();
      }
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-page", title: "Text", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isStriped: true, removeWrapper: true, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Type") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Applied to") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Texts") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Opt") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: Object.keys(textsMap).map((typeStr) => {
        const type4 = parseInt(typeStr, 10);
        const texts = textsMap[type4] ?? [];
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            t2(SpecialTextType[type4]),
            /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2(typeDescriptions[type4]), children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" }) })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex gap-1 flex-wrap", children: usedInMapping[type4].map((x2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                color: "default",
                radius: "sm",
                size: "sm",
                variant: "flat",
                children: t2(x2)
              }
            );
          }) }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: texts.map((c2) => {
            const renderer = typeTagRendersMapping[c2.type] ?? tagRenders.Single;
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                radius: "sm",
                variant: "bordered",
                onClose: () => {
                  createPortal(Modal, {
                    title: t2("Sure to delete?"),
                    defaultVisible: true,
                    onOk: async () => {
                      await BApi$1.specialText.deleteSpecialText(c2.id);
                      await loadData();
                    }
                  });
                },
                onClick: () => {
                  renderDetail(c2);
                },
                children: renderer(c2)
              },
              c2.id
            );
          }) }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              size: "sm",
              variant: "light",
              onClick: () => renderDetail({
                type: type4,
                id: 0,
                value1: ""
              }),
              children: t2("Add")
            }
          ) })
        ] });
      }) })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opt", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        color: "primary",
        size: "sm",
        variant: "light",
        onClick: () => {
          BApi$1.specialText.addSpecialTextPrefabs().then((a2) => {
            if (!a2.code) {
              loadData();
            }
          });
        },
        children: t2("Add prefabs")
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { className: "my-4" }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium mb-2", children: t2("Pretreatment test") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        textarea_default,
        {
          minRows: 3,
          placeholder: t2("Enter text"),
          value: testInput,
          onValueChange: (v2) => {
            setTestInput(v2);
            setTestResult("");
          }
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 flex items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          color: "primary",
          size: "sm",
          isLoading: isRunning,
          onClick: async () => {
            setIsRunning(true);
            try {
              const r2 = await BApi$1.specialText.pretreatText({ text: testInput });
              setTestResult(r2.data ?? "");
            } finally {
              setIsRunning(false);
            }
          },
          children: t2("Run pretreatment")
        }
      ) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-3", children: !testResult || !testInput ? null : hasDiff ? renderDiffChunks(testInput, testResult) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-default-500 text-sm", children: t2("No changes") }) })
    ] })
  ] });
};
TextPage.displayName = "TextPage";
const PlayHistoryPage = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [form2, setForm] = reactExports.useState({
    pageSize: 100,
    pageIndex: 0
  });
  const [playHistories, setPlayHistories] = reactExports.useState([]);
  const [totalCount, setTotalCount] = reactExports.useState(0);
  const [, forceUpdate] = reactExports.useReducer((x2) => x2 + 1, 0);
  reactExports.useEffect(() => {
    search2();
  }, []);
  const search2 = (pForm) => {
    const nf2 = {
      ...form2,
      ...pForm
    };
    setForm(nf2);
    BApi$1.playHistory.searchPlayHistories(nf2).then((a2) => {
      setPlayHistories(a2.data ?? []);
      setTotalCount(a2.totalCount);
    });
  };
  const renderPagination = () => {
    const pageCount = Math.ceil(totalCount / form2.pageSize);
    if (pageCount > 1) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        pagination_default,
        {
          page: form2.pageIndex,
          size: "sm",
          total: pageCount,
          onChange: (p2) => search2({ pageIndex: p2 })
        }
      ) });
    }
    return;
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "", children: playHistories.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
    table_default,
    {
      isCompact: true,
      isHeaderSticky: true,
      isStriped: true,
      removeWrapper: true,
      bottomContent: renderPagination(),
      topContent: renderPagination(),
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: "240", children: t2("Played at") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Item") })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: playHistories.map((a2) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: a2.playedAt }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: a2.item })
          ] }, a2.id);
        }) })
      ]
    }
  ) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("No play history") }) });
};
PlayHistoryPage.displayName = "PlayHistoryPage";
const OptionsCard = ({ header, children }) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(card_header_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xl", children: header }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        className: "grid gap-2 items-center",
        style: { gridTemplateColumns: "repeat(2, auto)" },
        children
      }
    ) })
  ] });
};
OptionsCard.displayName = "OptionsCard";
const Options = [true, false];
const BooleanOptions = ({
  subject,
  isSelected,
  onSelect,
  isSecondary
}) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: "inline-grid gap-2 items-center",
      style: { gridTemplateColumns: "1fr 50px 50px" },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: `flex items-center justify-end gap-1 ${isSecondary ? "opacity-80" : ""}`,
            children: subject
          }
        ),
        Options.map((o2) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              className: "justify-self-center",
              isSelected: isSelected === o2,
              size: "sm",
              onValueChange: (x2) => {
                if (x2) {
                  onSelect == null ? void 0 : onSelect(o2);
                } else {
                  onSelect == null ? void 0 : onSelect(void 0);
                }
              },
              children: t2(o2 ? "Yes" : "No")
            }
          );
        })
      ]
    }
  );
};
BooleanOptions.displayName = "BooleanOptions";
const SubjectLabels = {
  DeleteResourcesWithUnknownPath: "Delete resources with unknown path",
  DeleteResourcesWithUnknownMediaLibrary: "Delete resources with unknown media library",
  EnhancerReApply: "ReApply",
  EnhancerReEnhance: "ReEnhance"
};
const EnhancerOptions = ({
  enhancer,
  options,
  onChange,
  subject,
  isSecondary
}) => {
  const { t: t2 } = useTranslation();
  const enhancerChip = /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
    t2("Enhancer"),
    /* @__PURE__ */ jsxRuntimeExports.jsx(EnhancerIcon, { id: enhancer.id }),
    t2(enhancer.name)
  ] }) });
  const patchOptions = (patches) => {
    const newOptions = {
      ...options,
      ...patches
    };
    onChange == null ? void 0 : onChange(newOptions);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      BooleanOptions,
      {
        isSecondary,
        isSelected: options == null ? void 0 : options.reApply,
        subject: subject ?? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          enhancerChip,
          t2(SubjectLabels.EnhancerReApply)
        ] }),
        onSelect: (isSelected) => {
          patchOptions({ reApply: isSelected });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      BooleanOptions,
      {
        isSecondary,
        isSelected: options == null ? void 0 : options.reEnhance,
        subject: subject ?? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          enhancerChip,
          t2(SubjectLabels.EnhancerReEnhance)
        ] }),
        onSelect: (isSelected) => {
          patchOptions({ reEnhance: isSelected });
        }
      }
    )
  ] });
};
EnhancerOptions.displayName = "EnhancerOptions";
const GlobalOptions = ({ options, onChange }) => {
  const { t: t2 } = useTranslation();
  const patchOptions = (patches) => {
    const newOptions = {
      ...options,
      ...patches
    };
    onChange == null ? void 0 : onChange(newOptions);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(OptionsCard, { header: t2("Global"), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        isClearable: true,
        className: "w-[360px]",
        description: t2(
          "To reduce synchronization time, we will, by default, use 40% of your CPU's maximum thread count (rounded down) for syncing the media library"
        ),
        label: t2("Max threads"),
        minValue: 1,
        size: "sm",
        value: options == null ? void 0 : options.maxThreads,
        onClear: () => {
          patchOptions({ maxThreads: void 0 });
        },
        onValueChange: (maxThreads) => {
          patchOptions({ maxThreads });
        }
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      BooleanOptions,
      {
        isSelected: options == null ? void 0 : options.deleteResourcesWithUnknownMediaLibrary,
        subject: t2(
          SubjectLabels.DeleteResourcesWithUnknownMediaLibrary
        ),
        onSelect: (isSelected) => patchOptions({ deleteResourcesWithUnknownMediaLibrary: isSelected })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      BooleanOptions,
      {
        isSelected: options == null ? void 0 : options.deleteResourcesWithUnknownPath,
        subject: t2(SubjectLabels.DeleteResourcesWithUnknownPath),
        onSelect: (isSelected) => patchOptions({ deleteResourcesWithUnknownPath: isSelected })
      }
    ),
    enhancerIds.map((e2) => {
      var _a2;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        EnhancerOptions,
        {
          enhancer: {
            id: e2.value,
            name: e2.label
          },
          options: (_a2 = options == null ? void 0 : options.enhancerOptionsMap) == null ? void 0 : _a2[e2.value],
          onChange: (o2) => patchOptions({
            enhancerOptionsMap: {
              ...options == null ? void 0 : options.enhancerOptionsMap,
              [e2.value]: o2
            }
          })
        }
      );
    })
  ] });
};
GlobalOptions.displayName = "GlobalOptions";
const CategoryOptions = ({ category, onChange, options }) => {
  var _a2, _b2;
  const { t: t2 } = useTranslation();
  const patchOptions = (patches) => {
    const newOptions = {
      ...options,
      ...patches
    };
    onChange == null ? void 0 : onChange(newOptions);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    OptionsCard,
    {
      header: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 opacity-60", children: [
        category.name,
        /* @__PURE__ */ jsxRuntimeExports.jsx(DeprecatedChip, {})
      ] }),
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          BooleanOptions,
          {
            isSelected: options == null ? void 0 : options.deleteResourcesWithUnknownPath,
            subject: t2(SubjectLabels.DeleteResourcesWithUnknownPath),
            onSelect: (isSelected) => patchOptions({ deleteResourcesWithUnknownPath: isSelected })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
        (_a2 = category.mediaLibraries) == null ? void 0 : _a2.map((l2) => {
          var _a3, _b3;
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            BooleanOptions,
            {
              isSecondary: true,
              isSelected: (_b3 = (_a3 = options == null ? void 0 : options.mediaLibraryOptionsMap) == null ? void 0 : _a3[l2.id]) == null ? void 0 : _b3.deleteResourcesWithUnknownPath,
              subject: l2.name,
              onSelect: (isSelected) => {
                var _a4;
                return patchOptions({
                  mediaLibraryOptionsMap: {
                    ...options == null ? void 0 : options.mediaLibraryOptionsMap,
                    [l2.id]: {
                      ...(_a4 = options == null ? void 0 : options.mediaLibraryOptionsMap) == null ? void 0 : _a4[l2.id],
                      deleteResourcesWithUnknownPath: isSelected
                    }
                  }
                });
              }
            }
          );
        }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
        (_b2 = category.enhancers) == null ? void 0 : _b2.map((e2) => {
          var _a3, _b3;
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              EnhancerOptions,
              {
                enhancer: e2,
                options: (_a3 = options == null ? void 0 : options.enhancerOptionsMap) == null ? void 0 : _a3[e2.id],
                onChange: (o2) => patchOptions({
                  enhancerOptionsMap: {
                    ...options == null ? void 0 : options.enhancerOptionsMap,
                    [e2.id]: o2
                  }
                })
              }
            ),
            (_b3 = category.mediaLibraries) == null ? void 0 : _b3.map((l2) => {
              var _a4, _b4, _c2;
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                EnhancerOptions,
                {
                  isSecondary: true,
                  enhancer: e2,
                  options: (_c2 = (_b4 = (_a4 = options == null ? void 0 : options.mediaLibraryOptionsMap) == null ? void 0 : _a4[l2.id]) == null ? void 0 : _b4.enhancerOptionsMap) == null ? void 0 : _c2[e2.id],
                  subject: l2.name,
                  onChange: (o2) => {
                    var _a5, _b5, _c3;
                    return patchOptions({
                      mediaLibraryOptionsMap: {
                        ...options == null ? void 0 : options.mediaLibraryOptionsMap,
                        [l2.id]: {
                          ...(_a5 = options == null ? void 0 : options.mediaLibraryOptionsMap) == null ? void 0 : _a5[l2.id],
                          enhancerOptionsMap: {
                            ...(_c3 = (_b5 = options == null ? void 0 : options.mediaLibraryOptionsMap) == null ? void 0 : _b5[l2.id]) == null ? void 0 : _c3.enhancerOptionsMap,
                            [e2.id]: o2
                          }
                        }
                      }
                    });
                  }
                }
              );
            })
          ] });
        })
      ]
    }
  );
};
const MediaLibraryOptions = ({ mediaLibrary, onChange, options }) => {
  var _a2;
  const { t: t2 } = useTranslation();
  const patchOptions = (patches) => {
    const newOptions = {
      ...options,
      ...patches
    };
    onChange == null ? void 0 : onChange(newOptions);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(OptionsCard, { header: mediaLibrary.name, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      BooleanOptions,
      {
        isSelected: options == null ? void 0 : options.deleteResourcesWithUnknownPath,
        subject: t2(SubjectLabels.DeleteResourcesWithUnknownPath),
        onSelect: (isSelected) => patchOptions({ deleteResourcesWithUnknownPath: isSelected })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
    (_a2 = mediaLibrary.enhancers) == null ? void 0 : _a2.map((e2) => {
      var _a3;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        EnhancerOptions,
        {
          enhancer: e2,
          options: (_a3 = options == null ? void 0 : options.enhancerOptionsMap) == null ? void 0 : _a3[e2.id],
          onChange: (o2) => patchOptions({
            enhancerOptionsMap: {
              ...options == null ? void 0 : options.enhancerOptionsMap,
              [e2.id]: o2
            }
          })
        }
      ) });
    })
  ] });
};
MediaLibraryOptions.displayName = "MediaLibraryOptions";
const SynchronizationOptionsPage = () => {
  var _a2;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [categories, setCategories] = reactExports.useState([]);
  const synchronizationOptions = (_a2 = useResourceOptionsStore(
    (state) => state.data
  )) == null ? void 0 : _a2.synchronizationOptions;
  const [mediaLibraryV2s, setMediaLibraryV2s] = reactExports.useState([]);
  const [options, setOptions2] = reactExports.useState();
  reactExports.useEffect(() => {
    setOptions2(
      synchronizationOptions ? JSON.parse(JSON.stringify(synchronizationOptions)) : void 0
    );
  }, [synchronizationOptions]);
  const init2 = async () => {
    const enhancerName = enhancerIds.reduce((s2, t22) => {
      s2[t22.value] = t22.label;
      return s2;
    }, {});
    const categories2 = (await BApi$1.category.getAllCategories({
      additionalItems: CategoryAdditionalItem.EnhancerOptions
    })).data ?? [];
    const categoryMediaLibraryMap = _$2.groupBy(
      (await BApi$1.mediaLibrary.getAllMediaLibraries()).data ?? [],
      (x2) => x2.categoryId
    );
    const mediaLibrariesRsp = await BApi$1.mediaLibraryV2.getAllMediaLibraryV2({
      additionalItems: MediaLibraryV2AdditionalItem.Template
    });
    const mediaLibraries = (mediaLibrariesRsp.data ?? []).map((ml2) => {
      var _a3, _b2;
      return {
        ...ml2,
        enhancers: (_b2 = (_a3 = ml2.template) == null ? void 0 : _a3.enhancers) == null ? void 0 : _b2.map((e2) => ({
          id: e2.enhancerId,
          name: enhancerName[e2.enhancerId]
        }))
      };
    });
    const simpleCategories = categories2.map((c2) => {
      var _a3;
      const eIds = (_a3 = c2.enhancerOptions) == null ? void 0 : _a3.filter((x2) => x2.active).map((x2) => x2.enhancerId);
      const nc2 = {
        id: c2.id,
        name: c2.name,
        order: c2.order,
        enhancers: eIds == null ? void 0 : eIds.map((e2) => ({
          id: e2,
          name: enhancerName[e2]
        })),
        mediaLibraries: categoryMediaLibraryMap[c2.id]
      };
      return nc2;
    });
    setMediaLibraryV2s(mediaLibraries);
    setCategories(simpleCategories);
  };
  reactExports.useEffect(() => {
    init2();
  }, []);
  const saveOptions = async (options2) => {
    setOptions2(options2);
    await BApi$1.options.patchResourceOptions({
      synchronizationOptions: options2
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      alert_default,
      {
        color: "default",
        title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
            "You can customize media library synchronization behavior here. If you leave the option blank, we will attempt to apply the parent selection according to priority."
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              radius: "sm",
              size: "sm",
              variant: "light",
              onPress: () => {
                const data = [
                  {
                    label: "Priority",
                    description: "Media library > Category(Deprecated) > Global"
                  },
                  {
                    label: "Resources with unknown path",
                    description: "The resource path becomes unknown, usually because the file has been moved or the file name or parent folder name has been modified."
                  },
                  {
                    label: "Resources with unknown media library",
                    description: 'The media library becoming "unknown" is usually due to the deletion of the media library or category, but its internal resources are still retained.'
                  },
                  {
                    label: "ReApply in enhancer",
                    description: "The enhancer will reapply the data it has already acquired to the resources based on the latest configuration. This step is relatively quick since it does not attempt to retrieve new data."
                  },
                  {
                    label: "ReEnhance in enhancer",
                    description: "It will delete all acquired enhanced data and applied enhanced data. Then, the enhancer will automatically attempt to reacquire and apply the data."
                  }
                ];
                createPortal(Modal, {
                  defaultVisible: true,
                  title: t2("Configuration item instructions"),
                  size: "xl",
                  footer: {
                    actions: ["cancel"],
                    cancelProps: {
                      text: t2("Close")
                    }
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                    "div",
                    {
                      className: "grid gap-x-4 gap-y-2",
                      style: { gridTemplateColumns: "auto 1fr" },
                      children: data.map((d2) => {
                        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-bold text-right", children: t2(d2.label) }),
                          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-80", children: t2(d2.description) })
                        ] });
                      })
                    }
                  )
                });
              },
              children: t2("View configuration item instructions")
            }
          )
        ] })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalOptions, { options, onChange: saveOptions }),
    mediaLibraryV2s.map((ml2) => {
      var _a3;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        MediaLibraryOptions,
        {
          mediaLibrary: ml2,
          options: (_a3 = options == null ? void 0 : options.mediaLibraryOptionsMap) == null ? void 0 : _a3[ml2.id],
          onChange: (o2) => saveOptions({
            ...options,
            mediaLibraryOptionsMap: {
              ...options == null ? void 0 : options.mediaLibraryOptionsMap,
              [ml2.id]: o2
            }
          })
        }
      );
    }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
    categories.map((c2) => {
      var _a3;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        CategoryOptions,
        {
          category: c2,
          options: (_a3 = options == null ? void 0 : options.categoryOptionsMap) == null ? void 0 : _a3[c2.id],
          onChange: (o2) => saveOptions({
            ...options,
            categoryOptionsMap: {
              ...options == null ? void 0 : options.categoryOptionsMap,
              [c2.id]: o2
            }
          })
        }
      );
    })
  ] });
};
SynchronizationOptionsPage.displayName = "SynchronizationOptionsPage";
const Component = ({ id: id2 }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const context = useDependentComponentContextsStore(
    (state) => state.contexts
  ).find((a2) => a2.id == id2);
  const [latestVersion, setLatestVersion] = reactExports.useState();
  const [discovering, setDiscovering] = reactExports.useState(true);
  const [findingNewVersion, setFindingNewVersion] = reactExports.useState(false);
  const prevStatus = usePrevious$1(context == null ? void 0 : context.status);
  reactExports.useEffect(() => {
    if ((context == null ? void 0 : context.status) == DependentComponentStatus.Installed && prevStatus == DependentComponentStatus.Installing) {
      init2();
    }
  }, [context]);
  const init2 = reactExports.useCallback(async () => {
    try {
      await BApi$1.component.discoverDependentComponent({ id: id2 });
    } finally {
      setDiscovering(false);
    }
    if ((context == null ? void 0 : context.isRequired) || (context == null ? void 0 : context.status) == DependentComponentStatus.NotInstalled) {
      setFindingNewVersion(true);
      try {
        const latestVersionRsp = await BApi$1.component.getDependentComponentLatestVersion({ id: id2 });
        if (!latestVersionRsp.code) {
          setLatestVersion(latestVersionRsp.data);
        } else {
          setLatestVersion({
            canUpdate: false,
            error: latestVersionRsp.message
          });
        }
      } catch (e2) {
        setLatestVersion({
          canUpdate: false,
          error: e2.toString()
        });
      } finally {
        setFindingNewVersion(false);
      }
    } else {
      setLatestVersion(void 0);
    }
  }, []);
  reactExports.useEffect(() => {
    init2();
  }, []);
  console.log(context == null ? void 0 : context.name, latestVersion, discovering, context);
  const renderNewVersionInner = reactExports.useCallback(() => {
    const elements = [];
    if (latestVersion) {
      if (latestVersion.error) {
        elements.push(
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "danger",
              size: "sm",
              variant: "light",
              onPress: () => {
                createPortal(Modal, {
                  defaultVisible: true,
                  title: t2("Failed to get information of new version"),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: latestVersion.error }),
                  size: "lg"
                });
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdError, { className: "text-base" })
            }
          )
        );
      } else {
        if (latestVersion.canUpdate) {
          if ((context == null ? void 0 : context.status) != DependentComponentStatus.Installing) {
            elements.push(
              /* @__PURE__ */ jsxRuntimeExports.jsxs(
                Button,
                {
                  text: true,
                  size: "small",
                  type: "primary",
                  onClick: () => {
                    BApi$1.component.installDependentComponent({ id: id2 });
                  },
                  children: [
                    t2("Click to update to version"),
                    ":",
                    " ",
                    latestVersion.version
                  ]
                }
              )
            );
          }
        } else {
          elements.push(
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$10, { className: "text-base text-success" })
          );
        }
      }
    } else {
      if (findingNewVersion) {
        elements.push(
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Icon$1,
            {
              size: "small",
              title: t2("Checking new version"),
              type: "loading"
            }
          )
        );
      }
    }
    if (context && context.status == DependentComponentStatus.Installing) {
      elements.push(
        /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          t2("Updating"),
          ": ",
          context.installationProgress,
          "%",
          /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { size: "small", type: "loading" })
        ] })
      );
    }
    if (context == null ? void 0 : context.error) {
      elements.push(
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "danger",
            size: "sm",
            variant: "light",
            onPress: () => {
              createPortal(Modal, {
                defaultVisible: true,
                title: t2("Error"),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: context.error }),
                size: "lg"
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdError, { className: "text-base" })
          }
        )
      );
    }
    return elements;
  }, [latestVersion, context, discovering]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: "third-party-component",
      style: {
        display: "flex",
        gap: 10,
        alignItems: "center"
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "installed", children: discovering ? /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { size: "small", type: "loading" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
          Chip,
          {
            radius: "sm",
            size: "sm",
            title: (context == null ? void 0 : context.location) ?? void 0,
            children: (context == null ? void 0 : context.version) ?? t2("Not installed")
          }
        ) }),
        !discovering && /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: "new-version",
            style: {
              display: "flex",
              alignItems: "center",
              gap: 5
            },
            children: renderNewVersionInner()
          }
        )
      ]
    }
  );
};
Component.displayName = "Component";
const Dependency = () => {
  const { t: t2 } = useTranslation();
  const componentContexts = useDependentComponentContextsStore(
    (state) => state.contexts
  );
  const thirdPartyOptions = useThirdPartyOptionsStore((state) => state.data);
  const aiOptions = useAiOptionsStore((state) => state.data);
  reactExports.useEffect(() => {
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "settings", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { removeWrapper: true, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 200, children: t2("Dependent components") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: " " })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_body_default, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: componentContexts.map((c2, i2) => {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(
          table_row_default,
          {
            className: "hover:bg-[var(--bakaui-overlap-background)]",
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-1 items-center", children: [
                c2.name,
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  PopoverComponent,
                  {
                    showArrow: true,
                    placement: "right",
                    trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" }),
                    children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
                      "div",
                      {
                        className: "px-2 py-4 flex flex-col gap-2",
                        style: { userSelect: "text" },
                        children: [
                          c2.description && /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: c2.description }),
                          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                            t2("Default location"),
                            /* @__PURE__ */ jsxRuntimeExports.jsx(
                              snippet_default,
                              {
                                hideSymbol: true,
                                size: "sm",
                                variant: "bordered",
                                children: c2.defaultLocation
                              }
                            )
                          ] })
                        ]
                      }
                    )
                  }
                )
              ] }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Component, { id: c2.id }) })
            ]
          },
          i2
        );
      }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        table_row_default,
        {
          className: "hover:bg-[var(--bakaui-overlap-background)]",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: t2("curl executable") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              EditableValue,
              {
                Editor: ({ onValueChange, value: value2, ...props }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
                  PathAutocomplete,
                  {
                    ...props,
                    pathType: "file",
                    value: value2,
                    onChange: onValueChange
                  }
                ),
                Viewer: ({ value: value2, ...props }) => value2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(snippet_default, { symbol: /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: " " }), ...props, size: "sm", children: value2 }) : null,
                editorProps: {
                  placeholder: t2("path/to/curl.exe"),
                  size: "sm"
                },
                value: thirdPartyOptions.curlExecutable,
                onSubmit: async (v2) => await BApi$1.options.putThirdPartyOptions({
                  ...thirdPartyOptions,
                  curlExecutable: v2
                })
              }
            ) })
          ]
        },
        componentContexts.length
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        table_row_default,
        {
          className: "hover:bg-[var(--bakaui-overlap-background)]",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: t2("Ollama endpoint") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              EditableValue,
              {
                Editor: input_default,
                Viewer: ({ value: value2, ...props }) => value2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(snippet_default, { symbol: /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: " " }), ...props, size: "sm", children: value2 }) : null,
                editorProps: {
                  placeholder: t2("http://localhost:11434"),
                  size: "sm"
                },
                value: aiOptions.ollamaEndpoint,
                onSubmit: async (v2) => await BApi$1.options.putAiOptions({
                  ...aiOptions,
                  ollamaEndpoint: v2
                })
              }
            ) })
          ]
        },
        componentContexts.length + 1
      )
    ] })
  ] }) }) });
};
Dependency.displayName = "Dependency";
function ok$1() {
}
function unreachable() {
}
function stringify$1(values, options) {
  const settings = {};
  const input2 = values[values.length - 1] === "" ? [...values, ""] : values;
  return input2.join(
    (settings.padRight ? " " : "") + "," + (settings.padLeft === false ? "" : " ")
  ).trim();
}
const nameRe = /^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
const nameReJsx = /^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
const emptyOptions$2 = {};
function name(name2, options) {
  const settings = emptyOptions$2;
  const re2 = settings.jsx ? nameReJsx : nameRe;
  return re2.test(name2);
}
const re = /[ \t\n\f\r]/g;
function whitespace2(thing) {
  return typeof thing === "object" ? thing.type === "text" ? empty$1(thing.value) : false : empty$1(thing);
}
function empty$1(value2) {
  return value2.replace(re, "") === "";
}
class Schema {
  /**
   * @param {SchemaType['property']} property
   *   Property.
   * @param {SchemaType['normal']} normal
   *   Normal.
   * @param {Space | undefined} [space]
   *   Space.
   * @returns
   *   Schema.
   */
  constructor(property2, normal, space2) {
    this.normal = normal;
    this.property = property2;
    if (space2) {
      this.space = space2;
    }
  }
}
Schema.prototype.normal = {};
Schema.prototype.property = {};
Schema.prototype.space = void 0;
function merge(definitions, space2) {
  const property2 = {};
  const normal = {};
  for (const definition2 of definitions) {
    Object.assign(property2, definition2.property);
    Object.assign(normal, definition2.normal);
  }
  return new Schema(property2, normal, space2);
}
function normalize$1(value2) {
  return value2.toLowerCase();
}
class Info {
  /**
   * @param {string} property
   *   Property.
   * @param {string} attribute
   *   Attribute.
   * @returns
   *   Info.
   */
  constructor(property2, attribute) {
    this.attribute = attribute;
    this.property = property2;
  }
}
Info.prototype.attribute = "";
Info.prototype.booleanish = false;
Info.prototype.boolean = false;
Info.prototype.commaOrSpaceSeparated = false;
Info.prototype.commaSeparated = false;
Info.prototype.defined = false;
Info.prototype.mustUseProperty = false;
Info.prototype.number = false;
Info.prototype.overloadedBoolean = false;
Info.prototype.property = "";
Info.prototype.spaceSeparated = false;
Info.prototype.space = void 0;
let powers = 0;
const boolean2 = increment();
const booleanish = increment();
const overloadedBoolean = increment();
const number3 = increment();
const spaceSeparated = increment();
const commaSeparated = increment();
const commaOrSpaceSeparated = increment();
function increment() {
  return 2 ** ++powers;
}
const types = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  boolean: boolean2,
  booleanish,
  commaOrSpaceSeparated,
  commaSeparated,
  number: number3,
  overloadedBoolean,
  spaceSeparated
}, Symbol.toStringTag, { value: "Module" }));
const checks = (
  /** @type {ReadonlyArray<keyof typeof types>} */
  Object.keys(types)
);
class DefinedInfo extends Info {
  /**
   * @constructor
   * @param {string} property
   *   Property.
   * @param {string} attribute
   *   Attribute.
   * @param {number | null | undefined} [mask]
   *   Mask.
   * @param {Space | undefined} [space]
   *   Space.
   * @returns
   *   Info.
   */
  constructor(property2, attribute, mask, space2) {
    let index2 = -1;
    super(property2, attribute);
    mark(this, "space", space2);
    if (typeof mask === "number") {
      while (++index2 < checks.length) {
        const check = checks[index2];
        mark(this, checks[index2], (mask & types[check]) === types[check]);
      }
    }
  }
}
DefinedInfo.prototype.defined = true;
function mark(values, key, value2) {
  if (value2) {
    values[key] = value2;
  }
}
function create(definition2) {
  const properties2 = {};
  const normals = {};
  for (const [property2, value2] of Object.entries(definition2.properties)) {
    const info2 = new DefinedInfo(
      property2,
      definition2.transform(definition2.attributes || {}, property2),
      value2,
      definition2.space
    );
    if (definition2.mustUseProperty && definition2.mustUseProperty.includes(property2)) {
      info2.mustUseProperty = true;
    }
    properties2[property2] = info2;
    normals[normalize$1(property2)] = property2;
    normals[normalize$1(info2.attribute)] = property2;
  }
  return new Schema(properties2, normals, definition2.space);
}
const aria = create({
  properties: {
    ariaActiveDescendant: null,
    ariaAtomic: booleanish,
    ariaAutoComplete: null,
    ariaBusy: booleanish,
    ariaChecked: booleanish,
    ariaColCount: number3,
    ariaColIndex: number3,
    ariaColSpan: number3,
    ariaControls: spaceSeparated,
    ariaCurrent: null,
    ariaDescribedBy: spaceSeparated,
    ariaDetails: null,
    ariaDisabled: booleanish,
    ariaDropEffect: spaceSeparated,
    ariaErrorMessage: null,
    ariaExpanded: booleanish,
    ariaFlowTo: spaceSeparated,
    ariaGrabbed: booleanish,
    ariaHasPopup: null,
    ariaHidden: booleanish,
    ariaInvalid: null,
    ariaKeyShortcuts: null,
    ariaLabel: null,
    ariaLabelledBy: spaceSeparated,
    ariaLevel: number3,
    ariaLive: null,
    ariaModal: booleanish,
    ariaMultiLine: booleanish,
    ariaMultiSelectable: booleanish,
    ariaOrientation: null,
    ariaOwns: spaceSeparated,
    ariaPlaceholder: null,
    ariaPosInSet: number3,
    ariaPressed: booleanish,
    ariaReadOnly: booleanish,
    ariaRelevant: null,
    ariaRequired: booleanish,
    ariaRoleDescription: spaceSeparated,
    ariaRowCount: number3,
    ariaRowIndex: number3,
    ariaRowSpan: number3,
    ariaSelected: booleanish,
    ariaSetSize: number3,
    ariaSort: null,
    ariaValueMax: number3,
    ariaValueMin: number3,
    ariaValueNow: number3,
    ariaValueText: null,
    role: null
  },
  transform(_24, property2) {
    return property2 === "role" ? property2 : "aria-" + property2.slice(4).toLowerCase();
  }
});
function caseSensitiveTransform(attributes2, attribute) {
  return attribute in attributes2 ? attributes2[attribute] : attribute;
}
function caseInsensitiveTransform(attributes2, property2) {
  return caseSensitiveTransform(attributes2, property2.toLowerCase());
}
const html$2 = create({
  attributes: {
    acceptcharset: "accept-charset",
    classname: "class",
    htmlfor: "for",
    httpequiv: "http-equiv"
  },
  mustUseProperty: ["checked", "multiple", "muted", "selected"],
  properties: {
    // Standard Properties.
    abbr: null,
    accept: commaSeparated,
    acceptCharset: spaceSeparated,
    accessKey: spaceSeparated,
    action: null,
    allow: null,
    allowFullScreen: boolean2,
    allowPaymentRequest: boolean2,
    allowUserMedia: boolean2,
    alt: null,
    as: null,
    async: boolean2,
    autoCapitalize: null,
    autoComplete: spaceSeparated,
    autoFocus: boolean2,
    autoPlay: boolean2,
    blocking: spaceSeparated,
    capture: null,
    charSet: null,
    checked: boolean2,
    cite: null,
    className: spaceSeparated,
    cols: number3,
    colSpan: null,
    content: null,
    contentEditable: booleanish,
    controls: boolean2,
    controlsList: spaceSeparated,
    coords: number3 | commaSeparated,
    crossOrigin: null,
    data: null,
    dateTime: null,
    decoding: null,
    default: boolean2,
    defer: boolean2,
    dir: null,
    dirName: null,
    disabled: boolean2,
    download: overloadedBoolean,
    draggable: booleanish,
    encType: null,
    enterKeyHint: null,
    fetchPriority: null,
    form: null,
    formAction: null,
    formEncType: null,
    formMethod: null,
    formNoValidate: boolean2,
    formTarget: null,
    headers: spaceSeparated,
    height: number3,
    hidden: overloadedBoolean,
    high: number3,
    href: null,
    hrefLang: null,
    htmlFor: spaceSeparated,
    httpEquiv: spaceSeparated,
    id: null,
    imageSizes: null,
    imageSrcSet: null,
    inert: boolean2,
    inputMode: null,
    integrity: null,
    is: null,
    isMap: boolean2,
    itemId: null,
    itemProp: spaceSeparated,
    itemRef: spaceSeparated,
    itemScope: boolean2,
    itemType: spaceSeparated,
    kind: null,
    label: null,
    lang: null,
    language: null,
    list: null,
    loading: null,
    loop: boolean2,
    low: number3,
    manifest: null,
    max: null,
    maxLength: number3,
    media: null,
    method: null,
    min: null,
    minLength: number3,
    multiple: boolean2,
    muted: boolean2,
    name: null,
    nonce: null,
    noModule: boolean2,
    noValidate: boolean2,
    onAbort: null,
    onAfterPrint: null,
    onAuxClick: null,
    onBeforeMatch: null,
    onBeforePrint: null,
    onBeforeToggle: null,
    onBeforeUnload: null,
    onBlur: null,
    onCancel: null,
    onCanPlay: null,
    onCanPlayThrough: null,
    onChange: null,
    onClick: null,
    onClose: null,
    onContextLost: null,
    onContextMenu: null,
    onContextRestored: null,
    onCopy: null,
    onCueChange: null,
    onCut: null,
    onDblClick: null,
    onDrag: null,
    onDragEnd: null,
    onDragEnter: null,
    onDragExit: null,
    onDragLeave: null,
    onDragOver: null,
    onDragStart: null,
    onDrop: null,
    onDurationChange: null,
    onEmptied: null,
    onEnded: null,
    onError: null,
    onFocus: null,
    onFormData: null,
    onHashChange: null,
    onInput: null,
    onInvalid: null,
    onKeyDown: null,
    onKeyPress: null,
    onKeyUp: null,
    onLanguageChange: null,
    onLoad: null,
    onLoadedData: null,
    onLoadedMetadata: null,
    onLoadEnd: null,
    onLoadStart: null,
    onMessage: null,
    onMessageError: null,
    onMouseDown: null,
    onMouseEnter: null,
    onMouseLeave: null,
    onMouseMove: null,
    onMouseOut: null,
    onMouseOver: null,
    onMouseUp: null,
    onOffline: null,
    onOnline: null,
    onPageHide: null,
    onPageShow: null,
    onPaste: null,
    onPause: null,
    onPlay: null,
    onPlaying: null,
    onPopState: null,
    onProgress: null,
    onRateChange: null,
    onRejectionHandled: null,
    onReset: null,
    onResize: null,
    onScroll: null,
    onScrollEnd: null,
    onSecurityPolicyViolation: null,
    onSeeked: null,
    onSeeking: null,
    onSelect: null,
    onSlotChange: null,
    onStalled: null,
    onStorage: null,
    onSubmit: null,
    onSuspend: null,
    onTimeUpdate: null,
    onToggle: null,
    onUnhandledRejection: null,
    onUnload: null,
    onVolumeChange: null,
    onWaiting: null,
    onWheel: null,
    open: boolean2,
    optimum: number3,
    pattern: null,
    ping: spaceSeparated,
    placeholder: null,
    playsInline: boolean2,
    popover: null,
    popoverTarget: null,
    popoverTargetAction: null,
    poster: null,
    preload: null,
    readOnly: boolean2,
    referrerPolicy: null,
    rel: spaceSeparated,
    required: boolean2,
    reversed: boolean2,
    rows: number3,
    rowSpan: number3,
    sandbox: spaceSeparated,
    scope: null,
    scoped: boolean2,
    seamless: boolean2,
    selected: boolean2,
    shadowRootClonable: boolean2,
    shadowRootDelegatesFocus: boolean2,
    shadowRootMode: null,
    shape: null,
    size: number3,
    sizes: null,
    slot: null,
    span: number3,
    spellCheck: booleanish,
    src: null,
    srcDoc: null,
    srcLang: null,
    srcSet: null,
    start: number3,
    step: null,
    style: null,
    tabIndex: number3,
    target: null,
    title: null,
    translate: null,
    type: null,
    typeMustMatch: boolean2,
    useMap: null,
    value: booleanish,
    width: number3,
    wrap: null,
    writingSuggestions: null,
    // Legacy.
    // See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis
    align: null,
    // Several. Use CSS `text-align` instead,
    aLink: null,
    // `<body>`. Use CSS `a:active {color}` instead
    archive: spaceSeparated,
    // `<object>`. List of URIs to archives
    axis: null,
    // `<td>` and `<th>`. Use `scope` on `<th>`
    background: null,
    // `<body>`. Use CSS `background-image` instead
    bgColor: null,
    // `<body>` and table elements. Use CSS `background-color` instead
    border: number3,
    // `<table>`. Use CSS `border-width` instead,
    borderColor: null,
    // `<table>`. Use CSS `border-color` instead,
    bottomMargin: number3,
    // `<body>`
    cellPadding: null,
    // `<table>`
    cellSpacing: null,
    // `<table>`
    char: null,
    // Several table elements. When `align=char`, sets the character to align on
    charOff: null,
    // Several table elements. When `char`, offsets the alignment
    classId: null,
    // `<object>`
    clear: null,
    // `<br>`. Use CSS `clear` instead
    code: null,
    // `<object>`
    codeBase: null,
    // `<object>`
    codeType: null,
    // `<object>`
    color: null,
    // `<font>` and `<hr>`. Use CSS instead
    compact: boolean2,
    // Lists. Use CSS to reduce space between items instead
    declare: boolean2,
    // `<object>`
    event: null,
    // `<script>`
    face: null,
    // `<font>`. Use CSS instead
    frame: null,
    // `<table>`
    frameBorder: null,
    // `<iframe>`. Use CSS `border` instead
    hSpace: number3,
    // `<img>` and `<object>`
    leftMargin: number3,
    // `<body>`
    link: null,
    // `<body>`. Use CSS `a:link {color: *}` instead
    longDesc: null,
    // `<frame>`, `<iframe>`, and `<img>`. Use an `<a>`
    lowSrc: null,
    // `<img>`. Use a `<picture>`
    marginHeight: number3,
    // `<body>`
    marginWidth: number3,
    // `<body>`
    noResize: boolean2,
    // `<frame>`
    noHref: boolean2,
    // `<area>`. Use no href instead of an explicit `nohref`
    noShade: boolean2,
    // `<hr>`. Use background-color and height instead of borders
    noWrap: boolean2,
    // `<td>` and `<th>`
    object: null,
    // `<applet>`
    profile: null,
    // `<head>`
    prompt: null,
    // `<isindex>`
    rev: null,
    // `<link>`
    rightMargin: number3,
    // `<body>`
    rules: null,
    // `<table>`
    scheme: null,
    // `<meta>`
    scrolling: booleanish,
    // `<frame>`. Use overflow in the child context
    standby: null,
    // `<object>`
    summary: null,
    // `<table>`
    text: null,
    // `<body>`. Use CSS `color` instead
    topMargin: number3,
    // `<body>`
    valueType: null,
    // `<param>`
    version: null,
    // `<html>`. Use a doctype.
    vAlign: null,
    // Several. Use CSS `vertical-align` instead
    vLink: null,
    // `<body>`. Use CSS `a:visited {color}` instead
    vSpace: number3,
    // `<img>` and `<object>`
    // Non-standard Properties.
    allowTransparency: null,
    autoCorrect: null,
    autoSave: null,
    disablePictureInPicture: boolean2,
    disableRemotePlayback: boolean2,
    prefix: null,
    property: null,
    results: number3,
    security: null,
    unselectable: null
  },
  space: "html",
  transform: caseInsensitiveTransform
});
const svg$1 = create({
  attributes: {
    accentHeight: "accent-height",
    alignmentBaseline: "alignment-baseline",
    arabicForm: "arabic-form",
    baselineShift: "baseline-shift",
    capHeight: "cap-height",
    className: "class",
    clipPath: "clip-path",
    clipRule: "clip-rule",
    colorInterpolation: "color-interpolation",
    colorInterpolationFilters: "color-interpolation-filters",
    colorProfile: "color-profile",
    colorRendering: "color-rendering",
    crossOrigin: "crossorigin",
    dataType: "datatype",
    dominantBaseline: "dominant-baseline",
    enableBackground: "enable-background",
    fillOpacity: "fill-opacity",
    fillRule: "fill-rule",
    floodColor: "flood-color",
    floodOpacity: "flood-opacity",
    fontFamily: "font-family",
    fontSize: "font-size",
    fontSizeAdjust: "font-size-adjust",
    fontStretch: "font-stretch",
    fontStyle: "font-style",
    fontVariant: "font-variant",
    fontWeight: "font-weight",
    glyphName: "glyph-name",
    glyphOrientationHorizontal: "glyph-orientation-horizontal",
    glyphOrientationVertical: "glyph-orientation-vertical",
    hrefLang: "hreflang",
    horizAdvX: "horiz-adv-x",
    horizOriginX: "horiz-origin-x",
    horizOriginY: "horiz-origin-y",
    imageRendering: "image-rendering",
    letterSpacing: "letter-spacing",
    lightingColor: "lighting-color",
    markerEnd: "marker-end",
    markerMid: "marker-mid",
    markerStart: "marker-start",
    navDown: "nav-down",
    navDownLeft: "nav-down-left",
    navDownRight: "nav-down-right",
    navLeft: "nav-left",
    navNext: "nav-next",
    navPrev: "nav-prev",
    navRight: "nav-right",
    navUp: "nav-up",
    navUpLeft: "nav-up-left",
    navUpRight: "nav-up-right",
    onAbort: "onabort",
    onActivate: "onactivate",
    onAfterPrint: "onafterprint",
    onBeforePrint: "onbeforeprint",
    onBegin: "onbegin",
    onCancel: "oncancel",
    onCanPlay: "oncanplay",
    onCanPlayThrough: "oncanplaythrough",
    onChange: "onchange",
    onClick: "onclick",
    onClose: "onclose",
    onCopy: "oncopy",
    onCueChange: "oncuechange",
    onCut: "oncut",
    onDblClick: "ondblclick",
    onDrag: "ondrag",
    onDragEnd: "ondragend",
    onDragEnter: "ondragenter",
    onDragExit: "ondragexit",
    onDragLeave: "ondragleave",
    onDragOver: "ondragover",
    onDragStart: "ondragstart",
    onDrop: "ondrop",
    onDurationChange: "ondurationchange",
    onEmptied: "onemptied",
    onEnd: "onend",
    onEnded: "onended",
    onError: "onerror",
    onFocus: "onfocus",
    onFocusIn: "onfocusin",
    onFocusOut: "onfocusout",
    onHashChange: "onhashchange",
    onInput: "oninput",
    onInvalid: "oninvalid",
    onKeyDown: "onkeydown",
    onKeyPress: "onkeypress",
    onKeyUp: "onkeyup",
    onLoad: "onload",
    onLoadedData: "onloadeddata",
    onLoadedMetadata: "onloadedmetadata",
    onLoadStart: "onloadstart",
    onMessage: "onmessage",
    onMouseDown: "onmousedown",
    onMouseEnter: "onmouseenter",
    onMouseLeave: "onmouseleave",
    onMouseMove: "onmousemove",
    onMouseOut: "onmouseout",
    onMouseOver: "onmouseover",
    onMouseUp: "onmouseup",
    onMouseWheel: "onmousewheel",
    onOffline: "onoffline",
    onOnline: "ononline",
    onPageHide: "onpagehide",
    onPageShow: "onpageshow",
    onPaste: "onpaste",
    onPause: "onpause",
    onPlay: "onplay",
    onPlaying: "onplaying",
    onPopState: "onpopstate",
    onProgress: "onprogress",
    onRateChange: "onratechange",
    onRepeat: "onrepeat",
    onReset: "onreset",
    onResize: "onresize",
    onScroll: "onscroll",
    onSeeked: "onseeked",
    onSeeking: "onseeking",
    onSelect: "onselect",
    onShow: "onshow",
    onStalled: "onstalled",
    onStorage: "onstorage",
    onSubmit: "onsubmit",
    onSuspend: "onsuspend",
    onTimeUpdate: "ontimeupdate",
    onToggle: "ontoggle",
    onUnload: "onunload",
    onVolumeChange: "onvolumechange",
    onWaiting: "onwaiting",
    onZoom: "onzoom",
    overlinePosition: "overline-position",
    overlineThickness: "overline-thickness",
    paintOrder: "paint-order",
    panose1: "panose-1",
    pointerEvents: "pointer-events",
    referrerPolicy: "referrerpolicy",
    renderingIntent: "rendering-intent",
    shapeRendering: "shape-rendering",
    stopColor: "stop-color",
    stopOpacity: "stop-opacity",
    strikethroughPosition: "strikethrough-position",
    strikethroughThickness: "strikethrough-thickness",
    strokeDashArray: "stroke-dasharray",
    strokeDashOffset: "stroke-dashoffset",
    strokeLineCap: "stroke-linecap",
    strokeLineJoin: "stroke-linejoin",
    strokeMiterLimit: "stroke-miterlimit",
    strokeOpacity: "stroke-opacity",
    strokeWidth: "stroke-width",
    tabIndex: "tabindex",
    textAnchor: "text-anchor",
    textDecoration: "text-decoration",
    textRendering: "text-rendering",
    transformOrigin: "transform-origin",
    typeOf: "typeof",
    underlinePosition: "underline-position",
    underlineThickness: "underline-thickness",
    unicodeBidi: "unicode-bidi",
    unicodeRange: "unicode-range",
    unitsPerEm: "units-per-em",
    vAlphabetic: "v-alphabetic",
    vHanging: "v-hanging",
    vIdeographic: "v-ideographic",
    vMathematical: "v-mathematical",
    vectorEffect: "vector-effect",
    vertAdvY: "vert-adv-y",
    vertOriginX: "vert-origin-x",
    vertOriginY: "vert-origin-y",
    wordSpacing: "word-spacing",
    writingMode: "writing-mode",
    xHeight: "x-height",
    // These were camelcased in Tiny. Now lowercased in SVG 2
    playbackOrder: "playbackorder",
    timelineBegin: "timelinebegin"
  },
  properties: {
    about: commaOrSpaceSeparated,
    accentHeight: number3,
    accumulate: null,
    additive: null,
    alignmentBaseline: null,
    alphabetic: number3,
    amplitude: number3,
    arabicForm: null,
    ascent: number3,
    attributeName: null,
    attributeType: null,
    azimuth: number3,
    bandwidth: null,
    baselineShift: null,
    baseFrequency: null,
    baseProfile: null,
    bbox: null,
    begin: null,
    bias: number3,
    by: null,
    calcMode: null,
    capHeight: number3,
    className: spaceSeparated,
    clip: null,
    clipPath: null,
    clipPathUnits: null,
    clipRule: null,
    color: null,
    colorInterpolation: null,
    colorInterpolationFilters: null,
    colorProfile: null,
    colorRendering: null,
    content: null,
    contentScriptType: null,
    contentStyleType: null,
    crossOrigin: null,
    cursor: null,
    cx: null,
    cy: null,
    d: null,
    dataType: null,
    defaultAction: null,
    descent: number3,
    diffuseConstant: number3,
    direction: null,
    display: null,
    dur: null,
    divisor: number3,
    dominantBaseline: null,
    download: boolean2,
    dx: null,
    dy: null,
    edgeMode: null,
    editable: null,
    elevation: number3,
    enableBackground: null,
    end: null,
    event: null,
    exponent: number3,
    externalResourcesRequired: null,
    fill: null,
    fillOpacity: number3,
    fillRule: null,
    filter: null,
    filterRes: null,
    filterUnits: null,
    floodColor: null,
    floodOpacity: null,
    focusable: null,
    focusHighlight: null,
    fontFamily: null,
    fontSize: null,
    fontSizeAdjust: null,
    fontStretch: null,
    fontStyle: null,
    fontVariant: null,
    fontWeight: null,
    format: null,
    fr: null,
    from: null,
    fx: null,
    fy: null,
    g1: commaSeparated,
    g2: commaSeparated,
    glyphName: commaSeparated,
    glyphOrientationHorizontal: null,
    glyphOrientationVertical: null,
    glyphRef: null,
    gradientTransform: null,
    gradientUnits: null,
    handler: null,
    hanging: number3,
    hatchContentUnits: null,
    hatchUnits: null,
    height: null,
    href: null,
    hrefLang: null,
    horizAdvX: number3,
    horizOriginX: number3,
    horizOriginY: number3,
    id: null,
    ideographic: number3,
    imageRendering: null,
    initialVisibility: null,
    in: null,
    in2: null,
    intercept: number3,
    k: number3,
    k1: number3,
    k2: number3,
    k3: number3,
    k4: number3,
    kernelMatrix: commaOrSpaceSeparated,
    kernelUnitLength: null,
    keyPoints: null,
    // SEMI_COLON_SEPARATED
    keySplines: null,
    // SEMI_COLON_SEPARATED
    keyTimes: null,
    // SEMI_COLON_SEPARATED
    kerning: null,
    lang: null,
    lengthAdjust: null,
    letterSpacing: null,
    lightingColor: null,
    limitingConeAngle: number3,
    local: null,
    markerEnd: null,
    markerMid: null,
    markerStart: null,
    markerHeight: null,
    markerUnits: null,
    markerWidth: null,
    mask: null,
    maskContentUnits: null,
    maskUnits: null,
    mathematical: null,
    max: null,
    media: null,
    mediaCharacterEncoding: null,
    mediaContentEncodings: null,
    mediaSize: number3,
    mediaTime: null,
    method: null,
    min: null,
    mode: null,
    name: null,
    navDown: null,
    navDownLeft: null,
    navDownRight: null,
    navLeft: null,
    navNext: null,
    navPrev: null,
    navRight: null,
    navUp: null,
    navUpLeft: null,
    navUpRight: null,
    numOctaves: null,
    observer: null,
    offset: null,
    onAbort: null,
    onActivate: null,
    onAfterPrint: null,
    onBeforePrint: null,
    onBegin: null,
    onCancel: null,
    onCanPlay: null,
    onCanPlayThrough: null,
    onChange: null,
    onClick: null,
    onClose: null,
    onCopy: null,
    onCueChange: null,
    onCut: null,
    onDblClick: null,
    onDrag: null,
    onDragEnd: null,
    onDragEnter: null,
    onDragExit: null,
    onDragLeave: null,
    onDragOver: null,
    onDragStart: null,
    onDrop: null,
    onDurationChange: null,
    onEmptied: null,
    onEnd: null,
    onEnded: null,
    onError: null,
    onFocus: null,
    onFocusIn: null,
    onFocusOut: null,
    onHashChange: null,
    onInput: null,
    onInvalid: null,
    onKeyDown: null,
    onKeyPress: null,
    onKeyUp: null,
    onLoad: null,
    onLoadedData: null,
    onLoadedMetadata: null,
    onLoadStart: null,
    onMessage: null,
    onMouseDown: null,
    onMouseEnter: null,
    onMouseLeave: null,
    onMouseMove: null,
    onMouseOut: null,
    onMouseOver: null,
    onMouseUp: null,
    onMouseWheel: null,
    onOffline: null,
    onOnline: null,
    onPageHide: null,
    onPageShow: null,
    onPaste: null,
    onPause: null,
    onPlay: null,
    onPlaying: null,
    onPopState: null,
    onProgress: null,
    onRateChange: null,
    onRepeat: null,
    onReset: null,
    onResize: null,
    onScroll: null,
    onSeeked: null,
    onSeeking: null,
    onSelect: null,
    onShow: null,
    onStalled: null,
    onStorage: null,
    onSubmit: null,
    onSuspend: null,
    onTimeUpdate: null,
    onToggle: null,
    onUnload: null,
    onVolumeChange: null,
    onWaiting: null,
    onZoom: null,
    opacity: null,
    operator: null,
    order: null,
    orient: null,
    orientation: null,
    origin: null,
    overflow: null,
    overlay: null,
    overlinePosition: number3,
    overlineThickness: number3,
    paintOrder: null,
    panose1: null,
    path: null,
    pathLength: number3,
    patternContentUnits: null,
    patternTransform: null,
    patternUnits: null,
    phase: null,
    ping: spaceSeparated,
    pitch: null,
    playbackOrder: null,
    pointerEvents: null,
    points: null,
    pointsAtX: number3,
    pointsAtY: number3,
    pointsAtZ: number3,
    preserveAlpha: null,
    preserveAspectRatio: null,
    primitiveUnits: null,
    propagate: null,
    property: commaOrSpaceSeparated,
    r: null,
    radius: null,
    referrerPolicy: null,
    refX: null,
    refY: null,
    rel: commaOrSpaceSeparated,
    rev: commaOrSpaceSeparated,
    renderingIntent: null,
    repeatCount: null,
    repeatDur: null,
    requiredExtensions: commaOrSpaceSeparated,
    requiredFeatures: commaOrSpaceSeparated,
    requiredFonts: commaOrSpaceSeparated,
    requiredFormats: commaOrSpaceSeparated,
    resource: null,
    restart: null,
    result: null,
    rotate: null,
    rx: null,
    ry: null,
    scale: null,
    seed: null,
    shapeRendering: null,
    side: null,
    slope: null,
    snapshotTime: null,
    specularConstant: number3,
    specularExponent: number3,
    spreadMethod: null,
    spacing: null,
    startOffset: null,
    stdDeviation: null,
    stemh: null,
    stemv: null,
    stitchTiles: null,
    stopColor: null,
    stopOpacity: null,
    strikethroughPosition: number3,
    strikethroughThickness: number3,
    string: null,
    stroke: null,
    strokeDashArray: commaOrSpaceSeparated,
    strokeDashOffset: null,
    strokeLineCap: null,
    strokeLineJoin: null,
    strokeMiterLimit: number3,
    strokeOpacity: number3,
    strokeWidth: null,
    style: null,
    surfaceScale: number3,
    syncBehavior: null,
    syncBehaviorDefault: null,
    syncMaster: null,
    syncTolerance: null,
    syncToleranceDefault: null,
    systemLanguage: commaOrSpaceSeparated,
    tabIndex: number3,
    tableValues: null,
    target: null,
    targetX: number3,
    targetY: number3,
    textAnchor: null,
    textDecoration: null,
    textRendering: null,
    textLength: null,
    timelineBegin: null,
    title: null,
    transformBehavior: null,
    type: null,
    typeOf: commaOrSpaceSeparated,
    to: null,
    transform: null,
    transformOrigin: null,
    u1: null,
    u2: null,
    underlinePosition: number3,
    underlineThickness: number3,
    unicode: null,
    unicodeBidi: null,
    unicodeRange: null,
    unitsPerEm: number3,
    values: null,
    vAlphabetic: number3,
    vMathematical: number3,
    vectorEffect: null,
    vHanging: number3,
    vIdeographic: number3,
    version: null,
    vertAdvY: number3,
    vertOriginX: number3,
    vertOriginY: number3,
    viewBox: null,
    viewTarget: null,
    visibility: null,
    width: null,
    widths: null,
    wordSpacing: null,
    writingMode: null,
    x: null,
    x1: null,
    x2: null,
    xChannelSelector: null,
    xHeight: number3,
    y: null,
    y1: null,
    y2: null,
    yChannelSelector: null,
    z: null,
    zoomAndPan: null
  },
  space: "svg",
  transform: caseSensitiveTransform
});
const xlink = create({
  properties: {
    xLinkActuate: null,
    xLinkArcRole: null,
    xLinkHref: null,
    xLinkRole: null,
    xLinkShow: null,
    xLinkTitle: null,
    xLinkType: null
  },
  space: "xlink",
  transform(_24, property2) {
    return "xlink:" + property2.slice(5).toLowerCase();
  }
});
const xmlns = create({
  attributes: { xmlnsxlink: "xmlns:xlink" },
  properties: { xmlnsXLink: null, xmlns: null },
  space: "xmlns",
  transform: caseInsensitiveTransform
});
const xml = create({
  properties: { xmlBase: null, xmlLang: null, xmlSpace: null },
  space: "xml",
  transform(_24, property2) {
    return "xml:" + property2.slice(3).toLowerCase();
  }
});
const hastToReact = {
  classId: "classID",
  dataType: "datatype",
  itemId: "itemID",
  strokeDashArray: "strokeDasharray",
  strokeDashOffset: "strokeDashoffset",
  strokeLineCap: "strokeLinecap",
  strokeLineJoin: "strokeLinejoin",
  strokeMiterLimit: "strokeMiterlimit",
  typeOf: "typeof",
  xLinkActuate: "xlinkActuate",
  xLinkArcRole: "xlinkArcrole",
  xLinkHref: "xlinkHref",
  xLinkRole: "xlinkRole",
  xLinkShow: "xlinkShow",
  xLinkTitle: "xlinkTitle",
  xLinkType: "xlinkType",
  xmlnsXLink: "xmlnsXlink"
};
const cap$1 = /[A-Z]/g;
const dash = /-[a-z]/g;
const valid = /^data[-\w.:]+$/i;
function find(schema, value2) {
  const normal = normalize$1(value2);
  let property2 = value2;
  let Type2 = Info;
  if (normal in schema.normal) {
    return schema.property[schema.normal[normal]];
  }
  if (normal.length > 4 && normal.slice(0, 4) === "data" && valid.test(value2)) {
    if (value2.charAt(4) === "-") {
      const rest = value2.slice(5).replace(dash, camelcase);
      property2 = "data" + rest.charAt(0).toUpperCase() + rest.slice(1);
    } else {
      const rest = value2.slice(4);
      if (!dash.test(rest)) {
        let dashes = rest.replace(cap$1, kebab);
        if (dashes.charAt(0) !== "-") {
          dashes = "-" + dashes;
        }
        value2 = "data" + dashes;
      }
    }
    Type2 = DefinedInfo;
  }
  return new Type2(property2, value2);
}
function kebab($0) {
  return "-" + $0.toLowerCase();
}
function camelcase($0) {
  return $0.charAt(1).toUpperCase();
}
const html$1 = merge([aria, html$2, xlink, xmlns, xml], "html");
const svg = merge([aria, svg$1, xlink, xmlns, xml], "svg");
function stringify(values) {
  return values.join(" ").trim();
}
var cjs$1 = {};
var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
var NEWLINE_REGEX = /\n/g;
var WHITESPACE_REGEX = /^\s*/;
var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/;
var COLON_REGEX = /^:\s*/;
var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/;
var SEMICOLON_REGEX = /^[;\s]*/;
var TRIM_REGEX = /^\s+|\s+$/g;
var NEWLINE = "\n";
var FORWARD_SLASH = "/";
var ASTERISK = "*";
var EMPTY_STRING = "";
var TYPE_COMMENT = "comment";
var TYPE_DECLARATION = "declaration";
var inlineStyleParser = function(style2, options) {
  if (typeof style2 !== "string") {
    throw new TypeError("First argument must be a string");
  }
  if (!style2)
    return [];
  options = options || {};
  var lineno = 1;
  var column2 = 1;
  function updatePosition(str) {
    var lines = str.match(NEWLINE_REGEX);
    if (lines)
      lineno += lines.length;
    var i2 = str.lastIndexOf(NEWLINE);
    column2 = ~i2 ? str.length - i2 : column2 + str.length;
  }
  function position2() {
    var start2 = { line: lineno, column: column2 };
    return function(node2) {
      node2.position = new Position(start2);
      whitespace3();
      return node2;
    };
  }
  function Position(start2) {
    this.start = start2;
    this.end = { line: lineno, column: column2 };
    this.source = options.source;
  }
  Position.prototype.content = style2;
  function error2(msg) {
    var err = new Error(
      options.source + ":" + lineno + ":" + column2 + ": " + msg
    );
    err.reason = msg;
    err.filename = options.source;
    err.line = lineno;
    err.column = column2;
    err.source = style2;
    if (options.silent)
      ;
    else {
      throw err;
    }
  }
  function match5(re2) {
    var m2 = re2.exec(style2);
    if (!m2)
      return;
    var str = m2[0];
    updatePosition(str);
    style2 = style2.slice(str.length);
    return m2;
  }
  function whitespace3() {
    match5(WHITESPACE_REGEX);
  }
  function comments(rules2) {
    var c2;
    rules2 = rules2 || [];
    while (c2 = comment2()) {
      if (c2 !== false) {
        rules2.push(c2);
      }
    }
    return rules2;
  }
  function comment2() {
    var pos = position2();
    if (FORWARD_SLASH != style2.charAt(0) || ASTERISK != style2.charAt(1))
      return;
    var i2 = 2;
    while (EMPTY_STRING != style2.charAt(i2) && (ASTERISK != style2.charAt(i2) || FORWARD_SLASH != style2.charAt(i2 + 1))) {
      ++i2;
    }
    i2 += 2;
    if (EMPTY_STRING === style2.charAt(i2 - 1)) {
      return error2("End of comment missing");
    }
    var str = style2.slice(2, i2 - 2);
    column2 += 2;
    updatePosition(str);
    style2 = style2.slice(i2);
    column2 += 2;
    return pos({
      type: TYPE_COMMENT,
      comment: str
    });
  }
  function declaration2() {
    var pos = position2();
    var prop = match5(PROPERTY_REGEX);
    if (!prop)
      return;
    comment2();
    if (!match5(COLON_REGEX))
      return error2("property missing ':'");
    var val = match5(VALUE_REGEX);
    var ret = pos({
      type: TYPE_DECLARATION,
      property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),
      value: val ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING)) : EMPTY_STRING
    });
    match5(SEMICOLON_REGEX);
    return ret;
  }
  function declarations() {
    var decls = [];
    comments(decls);
    var decl;
    while (decl = declaration2()) {
      if (decl !== false) {
        decls.push(decl);
        comments(decls);
      }
    }
    return decls;
  }
  whitespace3();
  return declarations();
};
function trim(str) {
  return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
}
var __importDefault$1 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {
  return mod2 && mod2.__esModule ? mod2 : { "default": mod2 };
};
Object.defineProperty(cjs$1, "__esModule", { value: true });
cjs$1.default = StyleToObject;
var inline_style_parser_1 = __importDefault$1(inlineStyleParser);
function StyleToObject(style2, iterator2) {
  var styleObject = null;
  if (!style2 || typeof style2 !== "string") {
    return styleObject;
  }
  var declarations = (0, inline_style_parser_1.default)(style2);
  var hasIterator = typeof iterator2 === "function";
  declarations.forEach(function(declaration2) {
    if (declaration2.type !== "declaration") {
      return;
    }
    var property2 = declaration2.property, value2 = declaration2.value;
    if (hasIterator) {
      iterator2(property2, value2, declaration2);
    } else if (value2) {
      styleObject = styleObject || {};
      styleObject[property2] = value2;
    }
  });
  return styleObject;
}
var utilities = {};
Object.defineProperty(utilities, "__esModule", { value: true });
utilities.camelCase = void 0;
var CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/;
var HYPHEN_REGEX = /-([a-z])/g;
var NO_HYPHEN_REGEX = /^[^-]+$/;
var VENDOR_PREFIX_REGEX = /^-(webkit|moz|ms|o|khtml)-/;
var MS_VENDOR_PREFIX_REGEX = /^-(ms)-/;
var skipCamelCase = function(property2) {
  return !property2 || NO_HYPHEN_REGEX.test(property2) || CUSTOM_PROPERTY_REGEX.test(property2);
};
var capitalize = function(match5, character2) {
  return character2.toUpperCase();
};
var trimHyphen = function(match5, prefix) {
  return "".concat(prefix, "-");
};
var camelCase = function(property2, options) {
  if (options === void 0) {
    options = {};
  }
  if (skipCamelCase(property2)) {
    return property2;
  }
  property2 = property2.toLowerCase();
  if (options.reactCompat) {
    property2 = property2.replace(MS_VENDOR_PREFIX_REGEX, trimHyphen);
  } else {
    property2 = property2.replace(VENDOR_PREFIX_REGEX, trimHyphen);
  }
  return property2.replace(HYPHEN_REGEX, capitalize);
};
utilities.camelCase = camelCase;
var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {
  return mod2 && mod2.__esModule ? mod2 : { "default": mod2 };
};
var style_to_object_1 = __importDefault(cjs$1);
var utilities_1 = utilities;
function StyleToJS(style2, options) {
  var output2 = {};
  if (!style2 || typeof style2 !== "string") {
    return output2;
  }
  (0, style_to_object_1.default)(style2, function(property2, value2) {
    if (property2 && value2) {
      output2[(0, utilities_1.camelCase)(property2, options)] = value2;
    }
  });
  return output2;
}
StyleToJS.default = StyleToJS;
var cjs = StyleToJS;
const styleToJs = /* @__PURE__ */ getDefaultExportFromCjs(cjs);
const pointEnd = point$2("end");
const pointStart = point$2("start");
function point$2(type4) {
  return point2;
  function point2(node2) {
    const point3 = node2 && node2.position && node2.position[type4] || {};
    if (typeof point3.line === "number" && point3.line > 0 && typeof point3.column === "number" && point3.column > 0) {
      return {
        line: point3.line,
        column: point3.column,
        offset: typeof point3.offset === "number" && point3.offset > -1 ? point3.offset : void 0
      };
    }
  }
}
function position$1(node2) {
  const start2 = pointStart(node2);
  const end2 = pointEnd(node2);
  if (start2 && end2) {
    return { start: start2, end: end2 };
  }
}
function stringifyPosition(value2) {
  if (!value2 || typeof value2 !== "object") {
    return "";
  }
  if ("position" in value2 || "type" in value2) {
    return position(value2.position);
  }
  if ("start" in value2 || "end" in value2) {
    return position(value2);
  }
  if ("line" in value2 || "column" in value2) {
    return point$1(value2);
  }
  return "";
}
function point$1(point2) {
  return index(point2 && point2.line) + ":" + index(point2 && point2.column);
}
function position(pos) {
  return point$1(pos && pos.start) + "-" + point$1(pos && pos.end);
}
function index(value2) {
  return value2 && typeof value2 === "number" ? value2 : 1;
}
class VFileMessage extends Error {
  /**
   * Create a message for `reason`.
   *
   * > 🪦 **Note**: also has obsolete signatures.
   *
   * @overload
   * @param {string} reason
   * @param {Options | null | undefined} [options]
   * @returns
   *
   * @overload
   * @param {string} reason
   * @param {Node | NodeLike | null | undefined} parent
   * @param {string | null | undefined} [origin]
   * @returns
   *
   * @overload
   * @param {string} reason
   * @param {Point | Position | null | undefined} place
   * @param {string | null | undefined} [origin]
   * @returns
   *
   * @overload
   * @param {string} reason
   * @param {string | null | undefined} [origin]
   * @returns
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {Node | NodeLike | null | undefined} parent
   * @param {string | null | undefined} [origin]
   * @returns
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {Point | Position | null | undefined} place
   * @param {string | null | undefined} [origin]
   * @returns
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {string | null | undefined} [origin]
   * @returns
   *
   * @param {Error | VFileMessage | string} causeOrReason
   *   Reason for message, should use markdown.
   * @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
   *   Configuration (optional).
   * @param {string | null | undefined} [origin]
   *   Place in code where the message originates (example:
   *   `'my-package:my-rule'` or `'my-rule'`).
   * @returns
   *   Instance of `VFileMessage`.
   */
  // eslint-disable-next-line complexity
  constructor(causeOrReason, optionsOrParentOrPlace, origin2) {
    super();
    if (typeof optionsOrParentOrPlace === "string") {
      origin2 = optionsOrParentOrPlace;
      optionsOrParentOrPlace = void 0;
    }
    let reason = "";
    let options = {};
    let legacyCause = false;
    if (optionsOrParentOrPlace) {
      if ("line" in optionsOrParentOrPlace && "column" in optionsOrParentOrPlace) {
        options = { place: optionsOrParentOrPlace };
      } else if ("start" in optionsOrParentOrPlace && "end" in optionsOrParentOrPlace) {
        options = { place: optionsOrParentOrPlace };
      } else if ("type" in optionsOrParentOrPlace) {
        options = {
          ancestors: [optionsOrParentOrPlace],
          place: optionsOrParentOrPlace.position
        };
      } else {
        options = { ...optionsOrParentOrPlace };
      }
    }
    if (typeof causeOrReason === "string") {
      reason = causeOrReason;
    } else if (!options.cause && causeOrReason) {
      legacyCause = true;
      reason = causeOrReason.message;
      options.cause = causeOrReason;
    }
    if (!options.ruleId && !options.source && typeof origin2 === "string") {
      const index2 = origin2.indexOf(":");
      if (index2 === -1) {
        options.ruleId = origin2;
      } else {
        options.source = origin2.slice(0, index2);
        options.ruleId = origin2.slice(index2 + 1);
      }
    }
    if (!options.place && options.ancestors && options.ancestors) {
      const parent = options.ancestors[options.ancestors.length - 1];
      if (parent) {
        options.place = parent.position;
      }
    }
    const start2 = options.place && "start" in options.place ? options.place.start : options.place;
    this.ancestors = options.ancestors || void 0;
    this.cause = options.cause || void 0;
    this.column = start2 ? start2.column : void 0;
    this.fatal = void 0;
    this.file = "";
    this.message = reason;
    this.line = start2 ? start2.line : void 0;
    this.name = stringifyPosition(options.place) || "1:1";
    this.place = options.place || void 0;
    this.reason = this.message;
    this.ruleId = options.ruleId || void 0;
    this.source = options.source || void 0;
    this.stack = legacyCause && options.cause && typeof options.cause.stack === "string" ? options.cause.stack : "";
    this.actual = void 0;
    this.expected = void 0;
    this.note = void 0;
    this.url = void 0;
  }
}
VFileMessage.prototype.file = "";
VFileMessage.prototype.name = "";
VFileMessage.prototype.reason = "";
VFileMessage.prototype.message = "";
VFileMessage.prototype.stack = "";
VFileMessage.prototype.column = void 0;
VFileMessage.prototype.line = void 0;
VFileMessage.prototype.ancestors = void 0;
VFileMessage.prototype.cause = void 0;
VFileMessage.prototype.fatal = void 0;
VFileMessage.prototype.place = void 0;
VFileMessage.prototype.ruleId = void 0;
VFileMessage.prototype.source = void 0;
const own$3 = {}.hasOwnProperty;
const emptyMap = /* @__PURE__ */ new Map();
const cap = /[A-Z]/g;
const tableElements = /* @__PURE__ */ new Set(["table", "tbody", "thead", "tfoot", "tr"]);
const tableCellElement = /* @__PURE__ */ new Set(["td", "th"]);
const docs = "https://github.com/syntax-tree/hast-util-to-jsx-runtime";
function toJsxRuntime(tree, options) {
  if (!options || options.Fragment === void 0) {
    throw new TypeError("Expected `Fragment` in options");
  }
  const filePath = options.filePath || void 0;
  let create2;
  if (options.development) {
    if (typeof options.jsxDEV !== "function") {
      throw new TypeError(
        "Expected `jsxDEV` in options when `development: true`"
      );
    }
    create2 = developmentCreate(filePath, options.jsxDEV);
  } else {
    if (typeof options.jsx !== "function") {
      throw new TypeError("Expected `jsx` in production options");
    }
    if (typeof options.jsxs !== "function") {
      throw new TypeError("Expected `jsxs` in production options");
    }
    create2 = productionCreate(filePath, options.jsx, options.jsxs);
  }
  const state = {
    Fragment: options.Fragment,
    ancestors: [],
    components: options.components || {},
    create: create2,
    elementAttributeNameCase: options.elementAttributeNameCase || "react",
    evaluater: options.createEvaluater ? options.createEvaluater() : void 0,
    filePath,
    ignoreInvalidStyle: options.ignoreInvalidStyle || false,
    passKeys: options.passKeys !== false,
    passNode: options.passNode || false,
    schema: options.space === "svg" ? svg : html$1,
    stylePropertyNameCase: options.stylePropertyNameCase || "dom",
    tableCellAlignToStyle: options.tableCellAlignToStyle !== false
  };
  const result = one$1(state, tree, void 0);
  if (result && typeof result !== "string") {
    return result;
  }
  return state.create(
    tree,
    state.Fragment,
    { children: result || void 0 },
    void 0
  );
}
function one$1(state, node2, key) {
  if (node2.type === "element") {
    return element$1(state, node2, key);
  }
  if (node2.type === "mdxFlowExpression" || node2.type === "mdxTextExpression") {
    return mdxExpression(state, node2);
  }
  if (node2.type === "mdxJsxFlowElement" || node2.type === "mdxJsxTextElement") {
    return mdxJsxElement(state, node2, key);
  }
  if (node2.type === "mdxjsEsm") {
    return mdxEsm(state, node2);
  }
  if (node2.type === "root") {
    return root$1(state, node2, key);
  }
  if (node2.type === "text") {
    return text$3(state, node2);
  }
}
function element$1(state, node2, key) {
  const parentSchema = state.schema;
  let schema = parentSchema;
  if (node2.tagName.toLowerCase() === "svg" && parentSchema.space === "html") {
    schema = svg;
    state.schema = schema;
  }
  state.ancestors.push(node2);
  const type4 = findComponentFromName(state, node2.tagName, false);
  const props = createElementProps(state, node2);
  let children = createChildren(state, node2);
  if (tableElements.has(node2.tagName)) {
    children = children.filter(function(child) {
      return typeof child === "string" ? !whitespace2(child) : true;
    });
  }
  addNode(state, props, type4, node2);
  addChildren(props, children);
  state.ancestors.pop();
  state.schema = parentSchema;
  return state.create(node2, type4, props, key);
}
function mdxExpression(state, node2) {
  if (node2.data && node2.data.estree && state.evaluater) {
    const program = node2.data.estree;
    const expression = program.body[0];
    ok$1(expression.type === "ExpressionStatement");
    return (
      /** @type {Child | undefined} */
      state.evaluater.evaluateExpression(expression.expression)
    );
  }
  crashEstree(state, node2.position);
}
function mdxEsm(state, node2) {
  if (node2.data && node2.data.estree && state.evaluater) {
    return (
      /** @type {Child | undefined} */
      state.evaluater.evaluateProgram(node2.data.estree)
    );
  }
  crashEstree(state, node2.position);
}
function mdxJsxElement(state, node2, key) {
  const parentSchema = state.schema;
  let schema = parentSchema;
  if (node2.name === "svg" && parentSchema.space === "html") {
    schema = svg;
    state.schema = schema;
  }
  state.ancestors.push(node2);
  const type4 = node2.name === null ? state.Fragment : findComponentFromName(state, node2.name, true);
  const props = createJsxElementProps(state, node2);
  const children = createChildren(state, node2);
  addNode(state, props, type4, node2);
  addChildren(props, children);
  state.ancestors.pop();
  state.schema = parentSchema;
  return state.create(node2, type4, props, key);
}
function root$1(state, node2, key) {
  const props = {};
  addChildren(props, createChildren(state, node2));
  return state.create(node2, state.Fragment, props, key);
}
function text$3(_24, node2) {
  return node2.value;
}
function addNode(state, props, type4, node2) {
  if (typeof type4 !== "string" && type4 !== state.Fragment && state.passNode) {
    props.node = node2;
  }
}
function addChildren(props, children) {
  if (children.length > 0) {
    const value2 = children.length > 1 ? children : children[0];
    if (value2) {
      props.children = value2;
    }
  }
}
function productionCreate(_24, jsx, jsxs) {
  return create2;
  function create2(_25, type4, props, key) {
    const isStaticChildren = Array.isArray(props.children);
    const fn = isStaticChildren ? jsxs : jsx;
    return key ? fn(type4, props, key) : fn(type4, props);
  }
}
function developmentCreate(filePath, jsxDEV) {
  return create2;
  function create2(node2, type4, props, key) {
    const isStaticChildren = Array.isArray(props.children);
    const point2 = pointStart(node2);
    return jsxDEV(
      type4,
      props,
      key,
      isStaticChildren,
      {
        columnNumber: point2 ? point2.column - 1 : void 0,
        fileName: filePath,
        lineNumber: point2 ? point2.line : void 0
      },
      void 0
    );
  }
}
function createElementProps(state, node2) {
  const props = {};
  let alignValue;
  let prop;
  for (prop in node2.properties) {
    if (prop !== "children" && own$3.call(node2.properties, prop)) {
      const result = createProperty(state, prop, node2.properties[prop]);
      if (result) {
        const [key, value2] = result;
        if (state.tableCellAlignToStyle && key === "align" && typeof value2 === "string" && tableCellElement.has(node2.tagName)) {
          alignValue = value2;
        } else {
          props[key] = value2;
        }
      }
    }
  }
  if (alignValue) {
    const style2 = (
      /** @type {Style} */
      props.style || (props.style = {})
    );
    style2[state.stylePropertyNameCase === "css" ? "text-align" : "textAlign"] = alignValue;
  }
  return props;
}
function createJsxElementProps(state, node2) {
  const props = {};
  for (const attribute of node2.attributes) {
    if (attribute.type === "mdxJsxExpressionAttribute") {
      if (attribute.data && attribute.data.estree && state.evaluater) {
        const program = attribute.data.estree;
        const expression = program.body[0];
        ok$1(expression.type === "ExpressionStatement");
        const objectExpression = expression.expression;
        ok$1(objectExpression.type === "ObjectExpression");
        const property2 = objectExpression.properties[0];
        ok$1(property2.type === "SpreadElement");
        Object.assign(
          props,
          state.evaluater.evaluateExpression(property2.argument)
        );
      } else {
        crashEstree(state, node2.position);
      }
    } else {
      const name2 = attribute.name;
      let value2;
      if (attribute.value && typeof attribute.value === "object") {
        if (attribute.value.data && attribute.value.data.estree && state.evaluater) {
          const program = attribute.value.data.estree;
          const expression = program.body[0];
          ok$1(expression.type === "ExpressionStatement");
          value2 = state.evaluater.evaluateExpression(expression.expression);
        } else {
          crashEstree(state, node2.position);
        }
      } else {
        value2 = attribute.value === null ? true : attribute.value;
      }
      props[name2] = /** @type {Props[keyof Props]} */
      value2;
    }
  }
  return props;
}
function createChildren(state, node2) {
  const children = [];
  let index2 = -1;
  const countsByName = state.passKeys ? /* @__PURE__ */ new Map() : emptyMap;
  while (++index2 < node2.children.length) {
    const child = node2.children[index2];
    let key;
    if (state.passKeys) {
      const name2 = child.type === "element" ? child.tagName : child.type === "mdxJsxFlowElement" || child.type === "mdxJsxTextElement" ? child.name : void 0;
      if (name2) {
        const count = countsByName.get(name2) || 0;
        key = name2 + "-" + count;
        countsByName.set(name2, count + 1);
      }
    }
    const result = one$1(state, child, key);
    if (result !== void 0)
      children.push(result);
  }
  return children;
}
function createProperty(state, prop, value2) {
  const info2 = find(state.schema, prop);
  if (value2 === null || value2 === void 0 || typeof value2 === "number" && Number.isNaN(value2)) {
    return;
  }
  if (Array.isArray(value2)) {
    value2 = info2.commaSeparated ? stringify$1(value2) : stringify(value2);
  }
  if (info2.property === "style") {
    let styleObject = typeof value2 === "object" ? value2 : parseStyle(state, String(value2));
    if (state.stylePropertyNameCase === "css") {
      styleObject = transformStylesToCssCasing(styleObject);
    }
    return ["style", styleObject];
  }
  return [
    state.elementAttributeNameCase === "react" && info2.space ? hastToReact[info2.property] || info2.property : info2.attribute,
    value2
  ];
}
function parseStyle(state, value2) {
  try {
    return styleToJs(value2, { reactCompat: true });
  } catch (error2) {
    if (state.ignoreInvalidStyle) {
      return {};
    }
    const cause = (
      /** @type {Error} */
      error2
    );
    const message = new VFileMessage("Cannot parse `style` attribute", {
      ancestors: state.ancestors,
      cause,
      ruleId: "style",
      source: "hast-util-to-jsx-runtime"
    });
    message.file = state.filePath || void 0;
    message.url = docs + "#cannot-parse-style-attribute";
    throw message;
  }
}
function findComponentFromName(state, name$12, allowExpression) {
  let result;
  if (!allowExpression) {
    result = { type: "Literal", value: name$12 };
  } else if (name$12.includes(".")) {
    const identifiers = name$12.split(".");
    let index2 = -1;
    let node2;
    while (++index2 < identifiers.length) {
      const prop = name(identifiers[index2]) ? { type: "Identifier", name: identifiers[index2] } : { type: "Literal", value: identifiers[index2] };
      node2 = node2 ? {
        type: "MemberExpression",
        object: node2,
        property: prop,
        computed: Boolean(index2 && prop.type === "Literal"),
        optional: false
      } : prop;
    }
    result = node2;
  } else {
    result = name(name$12) && !/^[a-z]/.test(name$12) ? { type: "Identifier", name: name$12 } : { type: "Literal", value: name$12 };
  }
  if (result.type === "Literal") {
    const name2 = (
      /** @type {string | number} */
      result.value
    );
    return own$3.call(state.components, name2) ? state.components[name2] : name2;
  }
  if (state.evaluater) {
    return state.evaluater.evaluateExpression(result);
  }
  crashEstree(state);
}
function crashEstree(state, place) {
  const message = new VFileMessage(
    "Cannot handle MDX estrees without `createEvaluater`",
    {
      ancestors: state.ancestors,
      place,
      ruleId: "mdx-estree",
      source: "hast-util-to-jsx-runtime"
    }
  );
  message.file = state.filePath || void 0;
  message.url = docs + "#cannot-handle-mdx-estrees-without-createevaluater";
  throw message;
}
function transformStylesToCssCasing(domCasing) {
  const cssCasing = {};
  let from2;
  for (from2 in domCasing) {
    if (own$3.call(domCasing, from2)) {
      cssCasing[transformStyleToCssCasing(from2)] = domCasing[from2];
    }
  }
  return cssCasing;
}
function transformStyleToCssCasing(from2) {
  let to2 = from2.replace(cap, toDash);
  if (to2.slice(0, 3) === "ms-")
    to2 = "-" + to2;
  return to2;
}
function toDash($0) {
  return "-" + $0.toLowerCase();
}
const urlAttributes = {
  action: ["form"],
  cite: ["blockquote", "del", "ins", "q"],
  data: ["object"],
  formAction: ["button", "input"],
  href: ["a", "area", "base", "link"],
  icon: ["menuitem"],
  itemId: null,
  manifest: ["html"],
  ping: ["a", "area"],
  poster: ["video"],
  src: [
    "audio",
    "embed",
    "iframe",
    "img",
    "input",
    "script",
    "source",
    "track",
    "video"
  ]
};
const emptyOptions$1 = {};
function toString$1(value2, options) {
  const settings = emptyOptions$1;
  const includeImageAlt = typeof settings.includeImageAlt === "boolean" ? settings.includeImageAlt : true;
  const includeHtml = typeof settings.includeHtml === "boolean" ? settings.includeHtml : true;
  return one(value2, includeImageAlt, includeHtml);
}
function one(value2, includeImageAlt, includeHtml) {
  if (node(value2)) {
    if ("value" in value2) {
      return value2.type === "html" && !includeHtml ? "" : value2.value;
    }
    if (includeImageAlt && "alt" in value2 && value2.alt) {
      return value2.alt;
    }
    if ("children" in value2) {
      return all2(value2.children, includeImageAlt, includeHtml);
    }
  }
  if (Array.isArray(value2)) {
    return all2(value2, includeImageAlt, includeHtml);
  }
  return "";
}
function all2(values, includeImageAlt, includeHtml) {
  const result = [];
  let index2 = -1;
  while (++index2 < values.length) {
    result[index2] = one(values[index2], includeImageAlt, includeHtml);
  }
  return result.join("");
}
function node(value2) {
  return Boolean(value2 && typeof value2 === "object");
}
const element = document.createElement("i");
function decodeNamedCharacterReference(value2) {
  const characterReference2 = "&" + value2 + ";";
  element.innerHTML = characterReference2;
  const character2 = element.textContent;
  if (
    // @ts-expect-error: TypeScript is wrong that `textContent` on elements can
    // yield `null`.
    character2.charCodeAt(character2.length - 1) === 59 && value2 !== "semi"
  ) {
    return false;
  }
  return character2 === characterReference2 ? false : character2;
}
function splice(list2, start2, remove, items) {
  const end2 = list2.length;
  let chunkStart = 0;
  let parameters;
  if (start2 < 0) {
    start2 = -start2 > end2 ? 0 : end2 + start2;
  } else {
    start2 = start2 > end2 ? end2 : start2;
  }
  remove = remove > 0 ? remove : 0;
  if (items.length < 1e4) {
    parameters = Array.from(items);
    parameters.unshift(start2, remove);
    list2.splice(...parameters);
  } else {
    if (remove)
      list2.splice(start2, remove);
    while (chunkStart < items.length) {
      parameters = items.slice(chunkStart, chunkStart + 1e4);
      parameters.unshift(start2, 0);
      list2.splice(...parameters);
      chunkStart += 1e4;
      start2 += 1e4;
    }
  }
}
function push(list2, items) {
  if (list2.length > 0) {
    splice(list2, list2.length, 0, items);
    return list2;
  }
  return items;
}
const hasOwnProperty = {}.hasOwnProperty;
function combineExtensions(extensions2) {
  const all3 = {};
  let index2 = -1;
  while (++index2 < extensions2.length) {
    syntaxExtension(all3, extensions2[index2]);
  }
  return all3;
}
function syntaxExtension(all3, extension2) {
  let hook;
  for (hook in extension2) {
    const maybe = hasOwnProperty.call(all3, hook) ? all3[hook] : void 0;
    const left2 = maybe || (all3[hook] = {});
    const right = extension2[hook];
    let code2;
    if (right) {
      for (code2 in right) {
        if (!hasOwnProperty.call(left2, code2))
          left2[code2] = [];
        const value2 = right[code2];
        constructs(
          // @ts-expect-error Looks like a list.
          left2[code2],
          Array.isArray(value2) ? value2 : value2 ? [value2] : []
        );
      }
    }
  }
}
function constructs(existing, list2) {
  let index2 = -1;
  const before = [];
  while (++index2 < list2.length) {
    (list2[index2].add === "after" ? existing : before).push(list2[index2]);
  }
  splice(existing, 0, 0, before);
}
function decodeNumericCharacterReference(value2, base) {
  const code2 = Number.parseInt(value2, base);
  if (
    // C0 except for HT, LF, FF, CR, space.
    code2 < 9 || code2 === 11 || code2 > 13 && code2 < 32 || // Control character (DEL) of C0, and C1 controls.
    code2 > 126 && code2 < 160 || // Lone high surrogates and low surrogates.
    code2 > 55295 && code2 < 57344 || // Noncharacters.
    code2 > 64975 && code2 < 65008 || /* eslint-disable no-bitwise */
    (code2 & 65535) === 65535 || (code2 & 65535) === 65534 || /* eslint-enable no-bitwise */
    // Out of range
    code2 > 1114111
  ) {
    return "�";
  }
  return String.fromCodePoint(code2);
}
function normalizeIdentifier(value2) {
  return value2.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
}
const asciiAlpha = regexCheck(/[A-Za-z]/);
const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
const asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
function asciiControl(code2) {
  return (
    // Special whitespace codes (which have negative values), C0 and Control
    // character DEL
    code2 !== null && (code2 < 32 || code2 === 127)
  );
}
const asciiDigit = regexCheck(/\d/);
const asciiHexDigit = regexCheck(/[\dA-Fa-f]/);
const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);
function markdownLineEnding(code2) {
  return code2 !== null && code2 < -2;
}
function markdownLineEndingOrSpace(code2) {
  return code2 !== null && (code2 < 0 || code2 === 32);
}
function markdownSpace(code2) {
  return code2 === -2 || code2 === -1 || code2 === 32;
}
const unicodePunctuation = regexCheck(new RegExp("\\p{P}|\\p{S}", "u"));
const unicodeWhitespace = regexCheck(/\s/);
function regexCheck(regex2) {
  return check;
  function check(code2) {
    return code2 !== null && code2 > -1 && regex2.test(String.fromCharCode(code2));
  }
}
function normalizeUri(value2) {
  const result = [];
  let index2 = -1;
  let start2 = 0;
  let skip2 = 0;
  while (++index2 < value2.length) {
    const code2 = value2.charCodeAt(index2);
    let replace2 = "";
    if (code2 === 37 && asciiAlphanumeric(value2.charCodeAt(index2 + 1)) && asciiAlphanumeric(value2.charCodeAt(index2 + 2))) {
      skip2 = 2;
    } else if (code2 < 128) {
      if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code2))) {
        replace2 = String.fromCharCode(code2);
      }
    } else if (code2 > 55295 && code2 < 57344) {
      const next2 = value2.charCodeAt(index2 + 1);
      if (code2 < 56320 && next2 > 56319 && next2 < 57344) {
        replace2 = String.fromCharCode(code2, next2);
        skip2 = 1;
      } else {
        replace2 = "�";
      }
    } else {
      replace2 = String.fromCharCode(code2);
    }
    if (replace2) {
      result.push(value2.slice(start2, index2), encodeURIComponent(replace2));
      start2 = index2 + skip2 + 1;
      replace2 = "";
    }
    if (skip2) {
      index2 += skip2;
      skip2 = 0;
    }
  }
  return result.join("") + value2.slice(start2);
}
function factorySpace(effects2, ok2, type4, max2) {
  const limit2 = max2 ? max2 - 1 : Number.POSITIVE_INFINITY;
  let size2 = 0;
  return start2;
  function start2(code2) {
    if (markdownSpace(code2)) {
      effects2.enter(type4);
      return prefix(code2);
    }
    return ok2(code2);
  }
  function prefix(code2) {
    if (markdownSpace(code2) && size2++ < limit2) {
      effects2.consume(code2);
      return prefix;
    }
    effects2.exit(type4);
    return ok2(code2);
  }
}
const content$1 = {
  tokenize: initializeContent
};
function initializeContent(effects2) {
  const contentStart = effects2.attempt(this.parser.constructs.contentInitial, afterContentStartConstruct, paragraphInitial);
  let previous2;
  return contentStart;
  function afterContentStartConstruct(code2) {
    if (code2 === null) {
      effects2.consume(code2);
      return;
    }
    effects2.enter("lineEnding");
    effects2.consume(code2);
    effects2.exit("lineEnding");
    return factorySpace(effects2, contentStart, "linePrefix");
  }
  function paragraphInitial(code2) {
    effects2.enter("paragraph");
    return lineStart(code2);
  }
  function lineStart(code2) {
    const token2 = effects2.enter("chunkText", {
      contentType: "text",
      previous: previous2
    });
    if (previous2) {
      previous2.next = token2;
    }
    previous2 = token2;
    return data(code2);
  }
  function data(code2) {
    if (code2 === null) {
      effects2.exit("chunkText");
      effects2.exit("paragraph");
      effects2.consume(code2);
      return;
    }
    if (markdownLineEnding(code2)) {
      effects2.consume(code2);
      effects2.exit("chunkText");
      return lineStart;
    }
    effects2.consume(code2);
    return data;
  }
}
const document$2 = {
  tokenize: initializeDocument
};
const containerConstruct = {
  tokenize: tokenizeContainer
};
function initializeDocument(effects2) {
  const self2 = this;
  const stack = [];
  let continued = 0;
  let childFlow;
  let childToken;
  let lineStartOffset;
  return start2;
  function start2(code2) {
    if (continued < stack.length) {
      const item = stack[continued];
      self2.containerState = item[1];
      return effects2.attempt(item[0].continuation, documentContinue, checkNewContainers)(code2);
    }
    return checkNewContainers(code2);
  }
  function documentContinue(code2) {
    continued++;
    if (self2.containerState._closeFlow) {
      self2.containerState._closeFlow = void 0;
      if (childFlow) {
        closeFlow();
      }
      const indexBeforeExits = self2.events.length;
      let indexBeforeFlow = indexBeforeExits;
      let point2;
      while (indexBeforeFlow--) {
        if (self2.events[indexBeforeFlow][0] === "exit" && self2.events[indexBeforeFlow][1].type === "chunkFlow") {
          point2 = self2.events[indexBeforeFlow][1].end;
          break;
        }
      }
      exitContainers(continued);
      let index2 = indexBeforeExits;
      while (index2 < self2.events.length) {
        self2.events[index2][1].end = {
          ...point2
        };
        index2++;
      }
      splice(self2.events, indexBeforeFlow + 1, 0, self2.events.slice(indexBeforeExits));
      self2.events.length = index2;
      return checkNewContainers(code2);
    }
    return start2(code2);
  }
  function checkNewContainers(code2) {
    if (continued === stack.length) {
      if (!childFlow) {
        return documentContinued(code2);
      }
      if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) {
        return flowStart(code2);
      }
      self2.interrupt = Boolean(childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack);
    }
    self2.containerState = {};
    return effects2.check(containerConstruct, thereIsANewContainer, thereIsNoNewContainer)(code2);
  }
  function thereIsANewContainer(code2) {
    if (childFlow)
      closeFlow();
    exitContainers(continued);
    return documentContinued(code2);
  }
  function thereIsNoNewContainer(code2) {
    self2.parser.lazy[self2.now().line] = continued !== stack.length;
    lineStartOffset = self2.now().offset;
    return flowStart(code2);
  }
  function documentContinued(code2) {
    self2.containerState = {};
    return effects2.attempt(containerConstruct, containerContinue, flowStart)(code2);
  }
  function containerContinue(code2) {
    continued++;
    stack.push([self2.currentConstruct, self2.containerState]);
    return documentContinued(code2);
  }
  function flowStart(code2) {
    if (code2 === null) {
      if (childFlow)
        closeFlow();
      exitContainers(0);
      effects2.consume(code2);
      return;
    }
    childFlow = childFlow || self2.parser.flow(self2.now());
    effects2.enter("chunkFlow", {
      _tokenizer: childFlow,
      contentType: "flow",
      previous: childToken
    });
    return flowContinue(code2);
  }
  function flowContinue(code2) {
    if (code2 === null) {
      writeToChild(effects2.exit("chunkFlow"), true);
      exitContainers(0);
      effects2.consume(code2);
      return;
    }
    if (markdownLineEnding(code2)) {
      effects2.consume(code2);
      writeToChild(effects2.exit("chunkFlow"));
      continued = 0;
      self2.interrupt = void 0;
      return start2;
    }
    effects2.consume(code2);
    return flowContinue;
  }
  function writeToChild(token2, endOfFile) {
    const stream = self2.sliceStream(token2);
    if (endOfFile)
      stream.push(null);
    token2.previous = childToken;
    if (childToken)
      childToken.next = token2;
    childToken = token2;
    childFlow.defineSkip(token2.start);
    childFlow.write(stream);
    if (self2.parser.lazy[token2.start.line]) {
      let index2 = childFlow.events.length;
      while (index2--) {
        if (
          // The token starts before the line ending…
          childFlow.events[index2][1].start.offset < lineStartOffset && // …and either is not ended yet…
          (!childFlow.events[index2][1].end || // …or ends after it.
          childFlow.events[index2][1].end.offset > lineStartOffset)
        ) {
          return;
        }
      }
      const indexBeforeExits = self2.events.length;
      let indexBeforeFlow = indexBeforeExits;
      let seen2;
      let point2;
      while (indexBeforeFlow--) {
        if (self2.events[indexBeforeFlow][0] === "exit" && self2.events[indexBeforeFlow][1].type === "chunkFlow") {
          if (seen2) {
            point2 = self2.events[indexBeforeFlow][1].end;
            break;
          }
          seen2 = true;
        }
      }
      exitContainers(continued);
      index2 = indexBeforeExits;
      while (index2 < self2.events.length) {
        self2.events[index2][1].end = {
          ...point2
        };
        index2++;
      }
      splice(self2.events, indexBeforeFlow + 1, 0, self2.events.slice(indexBeforeExits));
      self2.events.length = index2;
    }
  }
  function exitContainers(size2) {
    let index2 = stack.length;
    while (index2-- > size2) {
      const entry = stack[index2];
      self2.containerState = entry[1];
      entry[0].exit.call(self2, effects2);
    }
    stack.length = size2;
  }
  function closeFlow() {
    childFlow.write([null]);
    childToken = void 0;
    childFlow = void 0;
    self2.containerState._closeFlow = void 0;
  }
}
function tokenizeContainer(effects2, ok2, nok) {
  return factorySpace(effects2, effects2.attempt(this.parser.constructs.document, ok2, nok), "linePrefix", this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4);
}
function classifyCharacter(code2) {
  if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {
    return 1;
  }
  if (unicodePunctuation(code2)) {
    return 2;
  }
}
function resolveAll(constructs2, events2, context) {
  const called = [];
  let index2 = -1;
  while (++index2 < constructs2.length) {
    const resolve2 = constructs2[index2].resolveAll;
    if (resolve2 && !called.includes(resolve2)) {
      events2 = resolve2(events2, context);
      called.push(resolve2);
    }
  }
  return events2;
}
const attention = {
  name: "attention",
  resolveAll: resolveAllAttention,
  tokenize: tokenizeAttention
};
function resolveAllAttention(events2, context) {
  let index2 = -1;
  let open;
  let group;
  let text2;
  let openingSequence;
  let closingSequence;
  let use;
  let nextEvents;
  let offset2;
  while (++index2 < events2.length) {
    if (events2[index2][0] === "enter" && events2[index2][1].type === "attentionSequence" && events2[index2][1]._close) {
      open = index2;
      while (open--) {
        if (events2[open][0] === "exit" && events2[open][1].type === "attentionSequence" && events2[open][1]._open && // If the markers are the same:
        context.sliceSerialize(events2[open][1]).charCodeAt(0) === context.sliceSerialize(events2[index2][1]).charCodeAt(0)) {
          if ((events2[open][1]._close || events2[index2][1]._open) && (events2[index2][1].end.offset - events2[index2][1].start.offset) % 3 && !((events2[open][1].end.offset - events2[open][1].start.offset + events2[index2][1].end.offset - events2[index2][1].start.offset) % 3)) {
            continue;
          }
          use = events2[open][1].end.offset - events2[open][1].start.offset > 1 && events2[index2][1].end.offset - events2[index2][1].start.offset > 1 ? 2 : 1;
          const start2 = {
            ...events2[open][1].end
          };
          const end2 = {
            ...events2[index2][1].start
          };
          movePoint(start2, -use);
          movePoint(end2, use);
          openingSequence = {
            type: use > 1 ? "strongSequence" : "emphasisSequence",
            start: start2,
            end: {
              ...events2[open][1].end
            }
          };
          closingSequence = {
            type: use > 1 ? "strongSequence" : "emphasisSequence",
            start: {
              ...events2[index2][1].start
            },
            end: end2
          };
          text2 = {
            type: use > 1 ? "strongText" : "emphasisText",
            start: {
              ...events2[open][1].end
            },
            end: {
              ...events2[index2][1].start
            }
          };
          group = {
            type: use > 1 ? "strong" : "emphasis",
            start: {
              ...openingSequence.start
            },
            end: {
              ...closingSequence.end
            }
          };
          events2[open][1].end = {
            ...openingSequence.start
          };
          events2[index2][1].start = {
            ...closingSequence.end
          };
          nextEvents = [];
          if (events2[open][1].end.offset - events2[open][1].start.offset) {
            nextEvents = push(nextEvents, [["enter", events2[open][1], context], ["exit", events2[open][1], context]]);
          }
          nextEvents = push(nextEvents, [["enter", group, context], ["enter", openingSequence, context], ["exit", openingSequence, context], ["enter", text2, context]]);
          nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events2.slice(open + 1, index2), context));
          nextEvents = push(nextEvents, [["exit", text2, context], ["enter", closingSequence, context], ["exit", closingSequence, context], ["exit", group, context]]);
          if (events2[index2][1].end.offset - events2[index2][1].start.offset) {
            offset2 = 2;
            nextEvents = push(nextEvents, [["enter", events2[index2][1], context], ["exit", events2[index2][1], context]]);
          } else {
            offset2 = 0;
          }
          splice(events2, open - 1, index2 - open + 3, nextEvents);
          index2 = open + nextEvents.length - offset2 - 2;
          break;
        }
      }
    }
  }
  index2 = -1;
  while (++index2 < events2.length) {
    if (events2[index2][1].type === "attentionSequence") {
      events2[index2][1].type = "data";
    }
  }
  return events2;
}
function tokenizeAttention(effects2, ok2) {
  const attentionMarkers2 = this.parser.constructs.attentionMarkers.null;
  const previous2 = this.previous;
  const before = classifyCharacter(previous2);
  let marker;
  return start2;
  function start2(code2) {
    marker = code2;
    effects2.enter("attentionSequence");
    return inside(code2);
  }
  function inside(code2) {
    if (code2 === marker) {
      effects2.consume(code2);
      return inside;
    }
    const token2 = effects2.exit("attentionSequence");
    const after = classifyCharacter(code2);
    const open = !after || after === 2 && before || attentionMarkers2.includes(code2);
    const close = !before || before === 2 && after || attentionMarkers2.includes(previous2);
    token2._open = Boolean(marker === 42 ? open : open && (before || !close));
    token2._close = Boolean(marker === 42 ? close : close && (after || !open));
    return ok2(code2);
  }
}
function movePoint(point2, offset2) {
  point2.column += offset2;
  point2.offset += offset2;
  point2._bufferIndex += offset2;
}
const autolink = {
  name: "autolink",
  tokenize: tokenizeAutolink
};
function tokenizeAutolink(effects2, ok2, nok) {
  let size2 = 0;
  return start2;
  function start2(code2) {
    effects2.enter("autolink");
    effects2.enter("autolinkMarker");
    effects2.consume(code2);
    effects2.exit("autolinkMarker");
    effects2.enter("autolinkProtocol");
    return open;
  }
  function open(code2) {
    if (asciiAlpha(code2)) {
      effects2.consume(code2);
      return schemeOrEmailAtext;
    }
    if (code2 === 64) {
      return nok(code2);
    }
    return emailAtext(code2);
  }
  function schemeOrEmailAtext(code2) {
    if (code2 === 43 || code2 === 45 || code2 === 46 || asciiAlphanumeric(code2)) {
      size2 = 1;
      return schemeInsideOrEmailAtext(code2);
    }
    return emailAtext(code2);
  }
  function schemeInsideOrEmailAtext(code2) {
    if (code2 === 58) {
      effects2.consume(code2);
      size2 = 0;
      return urlInside;
    }
    if ((code2 === 43 || code2 === 45 || code2 === 46 || asciiAlphanumeric(code2)) && size2++ < 32) {
      effects2.consume(code2);
      return schemeInsideOrEmailAtext;
    }
    size2 = 0;
    return emailAtext(code2);
  }
  function urlInside(code2) {
    if (code2 === 62) {
      effects2.exit("autolinkProtocol");
      effects2.enter("autolinkMarker");
      effects2.consume(code2);
      effects2.exit("autolinkMarker");
      effects2.exit("autolink");
      return ok2;
    }
    if (code2 === null || code2 === 32 || code2 === 60 || asciiControl(code2)) {
      return nok(code2);
    }
    effects2.consume(code2);
    return urlInside;
  }
  function emailAtext(code2) {
    if (code2 === 64) {
      effects2.consume(code2);
      return emailAtSignOrDot;
    }
    if (asciiAtext(code2)) {
      effects2.consume(code2);
      return emailAtext;
    }
    return nok(code2);
  }
  function emailAtSignOrDot(code2) {
    return asciiAlphanumeric(code2) ? emailLabel(code2) : nok(code2);
  }
  function emailLabel(code2) {
    if (code2 === 46) {
      effects2.consume(code2);
      size2 = 0;
      return emailAtSignOrDot;
    }
    if (code2 === 62) {
      effects2.exit("autolinkProtocol").type = "autolinkEmail";
      effects2.enter("autolinkMarker");
      effects2.consume(code2);
      effects2.exit("autolinkMarker");
      effects2.exit("autolink");
      return ok2;
    }
    return emailValue(code2);
  }
  function emailValue(code2) {
    if ((code2 === 45 || asciiAlphanumeric(code2)) && size2++ < 63) {
      const next2 = code2 === 45 ? emailValue : emailLabel;
      effects2.consume(code2);
      return next2;
    }
    return nok(code2);
  }
}
const blankLine = {
  partial: true,
  tokenize: tokenizeBlankLine
};
function tokenizeBlankLine(effects2, ok2, nok) {
  return start2;
  function start2(code2) {
    return markdownSpace(code2) ? factorySpace(effects2, after, "linePrefix")(code2) : after(code2);
  }
  function after(code2) {
    return code2 === null || markdownLineEnding(code2) ? ok2(code2) : nok(code2);
  }
}
const blockQuote = {
  continuation: {
    tokenize: tokenizeBlockQuoteContinuation
  },
  exit,
  name: "blockQuote",
  tokenize: tokenizeBlockQuoteStart
};
function tokenizeBlockQuoteStart(effects2, ok2, nok) {
  const self2 = this;
  return start2;
  function start2(code2) {
    if (code2 === 62) {
      const state = self2.containerState;
      if (!state.open) {
        effects2.enter("blockQuote", {
          _container: true
        });
        state.open = true;
      }
      effects2.enter("blockQuotePrefix");
      effects2.enter("blockQuoteMarker");
      effects2.consume(code2);
      effects2.exit("blockQuoteMarker");
      return after;
    }
    return nok(code2);
  }
  function after(code2) {
    if (markdownSpace(code2)) {
      effects2.enter("blockQuotePrefixWhitespace");
      effects2.consume(code2);
      effects2.exit("blockQuotePrefixWhitespace");
      effects2.exit("blockQuotePrefix");
      return ok2;
    }
    effects2.exit("blockQuotePrefix");
    return ok2(code2);
  }
}
function tokenizeBlockQuoteContinuation(effects2, ok2, nok) {
  const self2 = this;
  return contStart;
  function contStart(code2) {
    if (markdownSpace(code2)) {
      return factorySpace(effects2, contBefore, "linePrefix", self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code2);
    }
    return contBefore(code2);
  }
  function contBefore(code2) {
    return effects2.attempt(blockQuote, ok2, nok)(code2);
  }
}
function exit(effects2) {
  effects2.exit("blockQuote");
}
const characterEscape = {
  name: "characterEscape",
  tokenize: tokenizeCharacterEscape
};
function tokenizeCharacterEscape(effects2, ok2, nok) {
  return start2;
  function start2(code2) {
    effects2.enter("characterEscape");
    effects2.enter("escapeMarker");
    effects2.consume(code2);
    effects2.exit("escapeMarker");
    return inside;
  }
  function inside(code2) {
    if (asciiPunctuation(code2)) {
      effects2.enter("characterEscapeValue");
      effects2.consume(code2);
      effects2.exit("characterEscapeValue");
      effects2.exit("characterEscape");
      return ok2;
    }
    return nok(code2);
  }
}
const characterReference = {
  name: "characterReference",
  tokenize: tokenizeCharacterReference
};
function tokenizeCharacterReference(effects2, ok2, nok) {
  const self2 = this;
  let size2 = 0;
  let max2;
  let test2;
  return start2;
  function start2(code2) {
    effects2.enter("characterReference");
    effects2.enter("characterReferenceMarker");
    effects2.consume(code2);
    effects2.exit("characterReferenceMarker");
    return open;
  }
  function open(code2) {
    if (code2 === 35) {
      effects2.enter("characterReferenceMarkerNumeric");
      effects2.consume(code2);
      effects2.exit("characterReferenceMarkerNumeric");
      return numeric;
    }
    effects2.enter("characterReferenceValue");
    max2 = 31;
    test2 = asciiAlphanumeric;
    return value2(code2);
  }
  function numeric(code2) {
    if (code2 === 88 || code2 === 120) {
      effects2.enter("characterReferenceMarkerHexadecimal");
      effects2.consume(code2);
      effects2.exit("characterReferenceMarkerHexadecimal");
      effects2.enter("characterReferenceValue");
      max2 = 6;
      test2 = asciiHexDigit;
      return value2;
    }
    effects2.enter("characterReferenceValue");
    max2 = 7;
    test2 = asciiDigit;
    return value2(code2);
  }
  function value2(code2) {
    if (code2 === 59 && size2) {
      const token2 = effects2.exit("characterReferenceValue");
      if (test2 === asciiAlphanumeric && !decodeNamedCharacterReference(self2.sliceSerialize(token2))) {
        return nok(code2);
      }
      effects2.enter("characterReferenceMarker");
      effects2.consume(code2);
      effects2.exit("characterReferenceMarker");
      effects2.exit("characterReference");
      return ok2;
    }
    if (test2(code2) && size2++ < max2) {
      effects2.consume(code2);
      return value2;
    }
    return nok(code2);
  }
}
const nonLazyContinuation = {
  partial: true,
  tokenize: tokenizeNonLazyContinuation
};
const codeFenced = {
  concrete: true,
  name: "codeFenced",
  tokenize: tokenizeCodeFenced
};
function tokenizeCodeFenced(effects2, ok2, nok) {
  const self2 = this;
  const closeStart = {
    partial: true,
    tokenize: tokenizeCloseStart
  };
  let initialPrefix = 0;
  let sizeOpen = 0;
  let marker;
  return start2;
  function start2(code2) {
    return beforeSequenceOpen(code2);
  }
  function beforeSequenceOpen(code2) {
    const tail = self2.events[self2.events.length - 1];
    initialPrefix = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0;
    marker = code2;
    effects2.enter("codeFenced");
    effects2.enter("codeFencedFence");
    effects2.enter("codeFencedFenceSequence");
    return sequenceOpen(code2);
  }
  function sequenceOpen(code2) {
    if (code2 === marker) {
      sizeOpen++;
      effects2.consume(code2);
      return sequenceOpen;
    }
    if (sizeOpen < 3) {
      return nok(code2);
    }
    effects2.exit("codeFencedFenceSequence");
    return markdownSpace(code2) ? factorySpace(effects2, infoBefore, "whitespace")(code2) : infoBefore(code2);
  }
  function infoBefore(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      effects2.exit("codeFencedFence");
      return self2.interrupt ? ok2(code2) : effects2.check(nonLazyContinuation, atNonLazyBreak, after)(code2);
    }
    effects2.enter("codeFencedFenceInfo");
    effects2.enter("chunkString", {
      contentType: "string"
    });
    return info2(code2);
  }
  function info2(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      effects2.exit("chunkString");
      effects2.exit("codeFencedFenceInfo");
      return infoBefore(code2);
    }
    if (markdownSpace(code2)) {
      effects2.exit("chunkString");
      effects2.exit("codeFencedFenceInfo");
      return factorySpace(effects2, metaBefore, "whitespace")(code2);
    }
    if (code2 === 96 && code2 === marker) {
      return nok(code2);
    }
    effects2.consume(code2);
    return info2;
  }
  function metaBefore(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      return infoBefore(code2);
    }
    effects2.enter("codeFencedFenceMeta");
    effects2.enter("chunkString", {
      contentType: "string"
    });
    return meta(code2);
  }
  function meta(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      effects2.exit("chunkString");
      effects2.exit("codeFencedFenceMeta");
      return infoBefore(code2);
    }
    if (code2 === 96 && code2 === marker) {
      return nok(code2);
    }
    effects2.consume(code2);
    return meta;
  }
  function atNonLazyBreak(code2) {
    return effects2.attempt(closeStart, after, contentBefore)(code2);
  }
  function contentBefore(code2) {
    effects2.enter("lineEnding");
    effects2.consume(code2);
    effects2.exit("lineEnding");
    return contentStart;
  }
  function contentStart(code2) {
    return initialPrefix > 0 && markdownSpace(code2) ? factorySpace(effects2, beforeContentChunk, "linePrefix", initialPrefix + 1)(code2) : beforeContentChunk(code2);
  }
  function beforeContentChunk(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      return effects2.check(nonLazyContinuation, atNonLazyBreak, after)(code2);
    }
    effects2.enter("codeFlowValue");
    return contentChunk(code2);
  }
  function contentChunk(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      effects2.exit("codeFlowValue");
      return beforeContentChunk(code2);
    }
    effects2.consume(code2);
    return contentChunk;
  }
  function after(code2) {
    effects2.exit("codeFenced");
    return ok2(code2);
  }
  function tokenizeCloseStart(effects3, ok3, nok2) {
    let size2 = 0;
    return startBefore;
    function startBefore(code2) {
      effects3.enter("lineEnding");
      effects3.consume(code2);
      effects3.exit("lineEnding");
      return start3;
    }
    function start3(code2) {
      effects3.enter("codeFencedFence");
      return markdownSpace(code2) ? factorySpace(effects3, beforeSequenceClose, "linePrefix", self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code2) : beforeSequenceClose(code2);
    }
    function beforeSequenceClose(code2) {
      if (code2 === marker) {
        effects3.enter("codeFencedFenceSequence");
        return sequenceClose(code2);
      }
      return nok2(code2);
    }
    function sequenceClose(code2) {
      if (code2 === marker) {
        size2++;
        effects3.consume(code2);
        return sequenceClose;
      }
      if (size2 >= sizeOpen) {
        effects3.exit("codeFencedFenceSequence");
        return markdownSpace(code2) ? factorySpace(effects3, sequenceCloseAfter, "whitespace")(code2) : sequenceCloseAfter(code2);
      }
      return nok2(code2);
    }
    function sequenceCloseAfter(code2) {
      if (code2 === null || markdownLineEnding(code2)) {
        effects3.exit("codeFencedFence");
        return ok3(code2);
      }
      return nok2(code2);
    }
  }
}
function tokenizeNonLazyContinuation(effects2, ok2, nok) {
  const self2 = this;
  return start2;
  function start2(code2) {
    if (code2 === null) {
      return nok(code2);
    }
    effects2.enter("lineEnding");
    effects2.consume(code2);
    effects2.exit("lineEnding");
    return lineStart;
  }
  function lineStart(code2) {
    return self2.parser.lazy[self2.now().line] ? nok(code2) : ok2(code2);
  }
}
const codeIndented = {
  name: "codeIndented",
  tokenize: tokenizeCodeIndented
};
const furtherStart = {
  partial: true,
  tokenize: tokenizeFurtherStart
};
function tokenizeCodeIndented(effects2, ok2, nok) {
  const self2 = this;
  return start2;
  function start2(code2) {
    effects2.enter("codeIndented");
    return factorySpace(effects2, afterPrefix, "linePrefix", 4 + 1)(code2);
  }
  function afterPrefix(code2) {
    const tail = self2.events[self2.events.length - 1];
    return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? atBreak(code2) : nok(code2);
  }
  function atBreak(code2) {
    if (code2 === null) {
      return after(code2);
    }
    if (markdownLineEnding(code2)) {
      return effects2.attempt(furtherStart, atBreak, after)(code2);
    }
    effects2.enter("codeFlowValue");
    return inside(code2);
  }
  function inside(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      effects2.exit("codeFlowValue");
      return atBreak(code2);
    }
    effects2.consume(code2);
    return inside;
  }
  function after(code2) {
    effects2.exit("codeIndented");
    return ok2(code2);
  }
}
function tokenizeFurtherStart(effects2, ok2, nok) {
  const self2 = this;
  return furtherStart2;
  function furtherStart2(code2) {
    if (self2.parser.lazy[self2.now().line]) {
      return nok(code2);
    }
    if (markdownLineEnding(code2)) {
      effects2.enter("lineEnding");
      effects2.consume(code2);
      effects2.exit("lineEnding");
      return furtherStart2;
    }
    return factorySpace(effects2, afterPrefix, "linePrefix", 4 + 1)(code2);
  }
  function afterPrefix(code2) {
    const tail = self2.events[self2.events.length - 1];
    return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? ok2(code2) : markdownLineEnding(code2) ? furtherStart2(code2) : nok(code2);
  }
}
const codeText = {
  name: "codeText",
  previous,
  resolve: resolveCodeText,
  tokenize: tokenizeCodeText
};
function resolveCodeText(events2) {
  let tailExitIndex = events2.length - 4;
  let headEnterIndex = 3;
  let index2;
  let enter;
  if ((events2[headEnterIndex][1].type === "lineEnding" || events2[headEnterIndex][1].type === "space") && (events2[tailExitIndex][1].type === "lineEnding" || events2[tailExitIndex][1].type === "space")) {
    index2 = headEnterIndex;
    while (++index2 < tailExitIndex) {
      if (events2[index2][1].type === "codeTextData") {
        events2[headEnterIndex][1].type = "codeTextPadding";
        events2[tailExitIndex][1].type = "codeTextPadding";
        headEnterIndex += 2;
        tailExitIndex -= 2;
        break;
      }
    }
  }
  index2 = headEnterIndex - 1;
  tailExitIndex++;
  while (++index2 <= tailExitIndex) {
    if (enter === void 0) {
      if (index2 !== tailExitIndex && events2[index2][1].type !== "lineEnding") {
        enter = index2;
      }
    } else if (index2 === tailExitIndex || events2[index2][1].type === "lineEnding") {
      events2[enter][1].type = "codeTextData";
      if (index2 !== enter + 2) {
        events2[enter][1].end = events2[index2 - 1][1].end;
        events2.splice(enter + 2, index2 - enter - 2);
        tailExitIndex -= index2 - enter - 2;
        index2 = enter + 2;
      }
      enter = void 0;
    }
  }
  return events2;
}
function previous(code2) {
  return code2 !== 96 || this.events[this.events.length - 1][1].type === "characterEscape";
}
function tokenizeCodeText(effects2, ok2, nok) {
  let sizeOpen = 0;
  let size2;
  let token2;
  return start2;
  function start2(code2) {
    effects2.enter("codeText");
    effects2.enter("codeTextSequence");
    return sequenceOpen(code2);
  }
  function sequenceOpen(code2) {
    if (code2 === 96) {
      effects2.consume(code2);
      sizeOpen++;
      return sequenceOpen;
    }
    effects2.exit("codeTextSequence");
    return between(code2);
  }
  function between(code2) {
    if (code2 === null) {
      return nok(code2);
    }
    if (code2 === 32) {
      effects2.enter("space");
      effects2.consume(code2);
      effects2.exit("space");
      return between;
    }
    if (code2 === 96) {
      token2 = effects2.enter("codeTextSequence");
      size2 = 0;
      return sequenceClose(code2);
    }
    if (markdownLineEnding(code2)) {
      effects2.enter("lineEnding");
      effects2.consume(code2);
      effects2.exit("lineEnding");
      return between;
    }
    effects2.enter("codeTextData");
    return data(code2);
  }
  function data(code2) {
    if (code2 === null || code2 === 32 || code2 === 96 || markdownLineEnding(code2)) {
      effects2.exit("codeTextData");
      return between(code2);
    }
    effects2.consume(code2);
    return data;
  }
  function sequenceClose(code2) {
    if (code2 === 96) {
      effects2.consume(code2);
      size2++;
      return sequenceClose;
    }
    if (size2 === sizeOpen) {
      effects2.exit("codeTextSequence");
      effects2.exit("codeText");
      return ok2(code2);
    }
    token2.type = "codeTextData";
    return data(code2);
  }
}
class SpliceBuffer {
  /**
   * @param {ReadonlyArray<T> | null | undefined} [initial]
   *   Initial items (optional).
   * @returns
   *   Splice buffer.
   */
  constructor(initial) {
    this.left = initial ? [...initial] : [];
    this.right = [];
  }
  /**
   * Array access;
   * does not move the cursor.
   *
   * @param {number} index
   *   Index.
   * @return {T}
   *   Item.
   */
  get(index2) {
    if (index2 < 0 || index2 >= this.left.length + this.right.length) {
      throw new RangeError("Cannot access index `" + index2 + "` in a splice buffer of size `" + (this.left.length + this.right.length) + "`");
    }
    if (index2 < this.left.length)
      return this.left[index2];
    return this.right[this.right.length - index2 + this.left.length - 1];
  }
  /**
   * The length of the splice buffer, one greater than the largest index in the
   * array.
   */
  get length() {
    return this.left.length + this.right.length;
  }
  /**
   * Remove and return `list[0]`;
   * moves the cursor to `0`.
   *
   * @returns {T | undefined}
   *   Item, optional.
   */
  shift() {
    this.setCursor(0);
    return this.right.pop();
  }
  /**
   * Slice the buffer to get an array;
   * does not move the cursor.
   *
   * @param {number} start
   *   Start.
   * @param {number | null | undefined} [end]
   *   End (optional).
   * @returns {Array<T>}
   *   Array of items.
   */
  slice(start2, end2) {
    const stop = end2 === null || end2 === void 0 ? Number.POSITIVE_INFINITY : end2;
    if (stop < this.left.length) {
      return this.left.slice(start2, stop);
    }
    if (start2 > this.left.length) {
      return this.right.slice(this.right.length - stop + this.left.length, this.right.length - start2 + this.left.length).reverse();
    }
    return this.left.slice(start2).concat(this.right.slice(this.right.length - stop + this.left.length).reverse());
  }
  /**
   * Mimics the behavior of Array.prototype.splice() except for the change of
   * interface necessary to avoid segfaults when patching in very large arrays.
   *
   * This operation moves cursor is moved to `start` and results in the cursor
   * placed after any inserted items.
   *
   * @param {number} start
   *   Start;
   *   zero-based index at which to start changing the array;
   *   negative numbers count backwards from the end of the array and values
   *   that are out-of bounds are clamped to the appropriate end of the array.
   * @param {number | null | undefined} [deleteCount=0]
   *   Delete count (default: `0`);
   *   maximum number of elements to delete, starting from start.
   * @param {Array<T> | null | undefined} [items=[]]
   *   Items to include in place of the deleted items (default: `[]`).
   * @return {Array<T>}
   *   Any removed items.
   */
  splice(start2, deleteCount, items) {
    const count = deleteCount || 0;
    this.setCursor(Math.trunc(start2));
    const removed = this.right.splice(this.right.length - count, Number.POSITIVE_INFINITY);
    if (items)
      chunkedPush(this.left, items);
    return removed.reverse();
  }
  /**
   * Remove and return the highest-numbered item in the array, so
   * `list[list.length - 1]`;
   * Moves the cursor to `length`.
   *
   * @returns {T | undefined}
   *   Item, optional.
   */
  pop() {
    this.setCursor(Number.POSITIVE_INFINITY);
    return this.left.pop();
  }
  /**
   * Inserts a single item to the high-numbered side of the array;
   * moves the cursor to `length`.
   *
   * @param {T} item
   *   Item.
   * @returns {undefined}
   *   Nothing.
   */
  push(item) {
    this.setCursor(Number.POSITIVE_INFINITY);
    this.left.push(item);
  }
  /**
   * Inserts many items to the high-numbered side of the array.
   * Moves the cursor to `length`.
   *
   * @param {Array<T>} items
   *   Items.
   * @returns {undefined}
   *   Nothing.
   */
  pushMany(items) {
    this.setCursor(Number.POSITIVE_INFINITY);
    chunkedPush(this.left, items);
  }
  /**
   * Inserts a single item to the low-numbered side of the array;
   * Moves the cursor to `0`.
   *
   * @param {T} item
   *   Item.
   * @returns {undefined}
   *   Nothing.
   */
  unshift(item) {
    this.setCursor(0);
    this.right.push(item);
  }
  /**
   * Inserts many items to the low-numbered side of the array;
   * moves the cursor to `0`.
   *
   * @param {Array<T>} items
   *   Items.
   * @returns {undefined}
   *   Nothing.
   */
  unshiftMany(items) {
    this.setCursor(0);
    chunkedPush(this.right, items.reverse());
  }
  /**
   * Move the cursor to a specific position in the array. Requires
   * time proportional to the distance moved.
   *
   * If `n < 0`, the cursor will end up at the beginning.
   * If `n > length`, the cursor will end up at the end.
   *
   * @param {number} n
   *   Position.
   * @return {undefined}
   *   Nothing.
   */
  setCursor(n2) {
    if (n2 === this.left.length || n2 > this.left.length && this.right.length === 0 || n2 < 0 && this.left.length === 0)
      return;
    if (n2 < this.left.length) {
      const removed = this.left.splice(n2, Number.POSITIVE_INFINITY);
      chunkedPush(this.right, removed.reverse());
    } else {
      const removed = this.right.splice(this.left.length + this.right.length - n2, Number.POSITIVE_INFINITY);
      chunkedPush(this.left, removed.reverse());
    }
  }
}
function chunkedPush(list2, right) {
  let chunkStart = 0;
  if (right.length < 1e4) {
    list2.push(...right);
  } else {
    while (chunkStart < right.length) {
      list2.push(...right.slice(chunkStart, chunkStart + 1e4));
      chunkStart += 1e4;
    }
  }
}
function subtokenize(eventsArray) {
  const jumps = {};
  let index2 = -1;
  let event;
  let lineIndex;
  let otherIndex;
  let otherEvent;
  let parameters;
  let subevents;
  let more2;
  const events2 = new SpliceBuffer(eventsArray);
  while (++index2 < events2.length) {
    while (index2 in jumps) {
      index2 = jumps[index2];
    }
    event = events2.get(index2);
    if (index2 && event[1].type === "chunkFlow" && events2.get(index2 - 1)[1].type === "listItemPrefix") {
      subevents = event[1]._tokenizer.events;
      otherIndex = 0;
      if (otherIndex < subevents.length && subevents[otherIndex][1].type === "lineEndingBlank") {
        otherIndex += 2;
      }
      if (otherIndex < subevents.length && subevents[otherIndex][1].type === "content") {
        while (++otherIndex < subevents.length) {
          if (subevents[otherIndex][1].type === "content") {
            break;
          }
          if (subevents[otherIndex][1].type === "chunkText") {
            subevents[otherIndex][1]._isInFirstContentOfListItem = true;
            otherIndex++;
          }
        }
      }
    }
    if (event[0] === "enter") {
      if (event[1].contentType) {
        Object.assign(jumps, subcontent(events2, index2));
        index2 = jumps[index2];
        more2 = true;
      }
    } else if (event[1]._container) {
      otherIndex = index2;
      lineIndex = void 0;
      while (otherIndex--) {
        otherEvent = events2.get(otherIndex);
        if (otherEvent[1].type === "lineEnding" || otherEvent[1].type === "lineEndingBlank") {
          if (otherEvent[0] === "enter") {
            if (lineIndex) {
              events2.get(lineIndex)[1].type = "lineEndingBlank";
            }
            otherEvent[1].type = "lineEnding";
            lineIndex = otherIndex;
          }
        } else if (otherEvent[1].type === "linePrefix" || otherEvent[1].type === "listItemIndent")
          ;
        else {
          break;
        }
      }
      if (lineIndex) {
        event[1].end = {
          ...events2.get(lineIndex)[1].start
        };
        parameters = events2.slice(lineIndex, index2);
        parameters.unshift(event);
        events2.splice(lineIndex, index2 - lineIndex + 1, parameters);
      }
    }
  }
  splice(eventsArray, 0, Number.POSITIVE_INFINITY, events2.slice(0));
  return !more2;
}
function subcontent(events2, eventIndex) {
  const token2 = events2.get(eventIndex)[1];
  const context = events2.get(eventIndex)[2];
  let startPosition = eventIndex - 1;
  const startPositions = [];
  let tokenizer = token2._tokenizer;
  if (!tokenizer) {
    tokenizer = context.parser[token2.contentType](token2.start);
    if (token2._contentTypeTextTrailing) {
      tokenizer._contentTypeTextTrailing = true;
    }
  }
  const childEvents = tokenizer.events;
  const jumps = [];
  const gaps = {};
  let stream;
  let previous2;
  let index2 = -1;
  let current = token2;
  let adjust = 0;
  let start2 = 0;
  const breaks = [start2];
  while (current) {
    while (events2.get(++startPosition)[1] !== current) {
    }
    startPositions.push(startPosition);
    if (!current._tokenizer) {
      stream = context.sliceStream(current);
      if (!current.next) {
        stream.push(null);
      }
      if (previous2) {
        tokenizer.defineSkip(current.start);
      }
      if (current._isInFirstContentOfListItem) {
        tokenizer._gfmTasklistFirstContentOfListItem = true;
      }
      tokenizer.write(stream);
      if (current._isInFirstContentOfListItem) {
        tokenizer._gfmTasklistFirstContentOfListItem = void 0;
      }
    }
    previous2 = current;
    current = current.next;
  }
  current = token2;
  while (++index2 < childEvents.length) {
    if (
      // Find a void token that includes a break.
      childEvents[index2][0] === "exit" && childEvents[index2 - 1][0] === "enter" && childEvents[index2][1].type === childEvents[index2 - 1][1].type && childEvents[index2][1].start.line !== childEvents[index2][1].end.line
    ) {
      start2 = index2 + 1;
      breaks.push(start2);
      current._tokenizer = void 0;
      current.previous = void 0;
      current = current.next;
    }
  }
  tokenizer.events = [];
  if (current) {
    current._tokenizer = void 0;
    current.previous = void 0;
  } else {
    breaks.pop();
  }
  index2 = breaks.length;
  while (index2--) {
    const slice2 = childEvents.slice(breaks[index2], breaks[index2 + 1]);
    const start3 = startPositions.pop();
    jumps.push([start3, start3 + slice2.length - 1]);
    events2.splice(start3, 2, slice2);
  }
  jumps.reverse();
  index2 = -1;
  while (++index2 < jumps.length) {
    gaps[adjust + jumps[index2][0]] = adjust + jumps[index2][1];
    adjust += jumps[index2][1] - jumps[index2][0] - 1;
  }
  return gaps;
}
const content = {
  resolve: resolveContent,
  tokenize: tokenizeContent
};
const continuationConstruct = {
  partial: true,
  tokenize: tokenizeContinuation
};
function resolveContent(events2) {
  subtokenize(events2);
  return events2;
}
function tokenizeContent(effects2, ok2) {
  let previous2;
  return chunkStart;
  function chunkStart(code2) {
    effects2.enter("content");
    previous2 = effects2.enter("chunkContent", {
      contentType: "content"
    });
    return chunkInside(code2);
  }
  function chunkInside(code2) {
    if (code2 === null) {
      return contentEnd(code2);
    }
    if (markdownLineEnding(code2)) {
      return effects2.check(continuationConstruct, contentContinue, contentEnd)(code2);
    }
    effects2.consume(code2);
    return chunkInside;
  }
  function contentEnd(code2) {
    effects2.exit("chunkContent");
    effects2.exit("content");
    return ok2(code2);
  }
  function contentContinue(code2) {
    effects2.consume(code2);
    effects2.exit("chunkContent");
    previous2.next = effects2.enter("chunkContent", {
      contentType: "content",
      previous: previous2
    });
    previous2 = previous2.next;
    return chunkInside;
  }
}
function tokenizeContinuation(effects2, ok2, nok) {
  const self2 = this;
  return startLookahead;
  function startLookahead(code2) {
    effects2.exit("chunkContent");
    effects2.enter("lineEnding");
    effects2.consume(code2);
    effects2.exit("lineEnding");
    return factorySpace(effects2, prefixed, "linePrefix");
  }
  function prefixed(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      return nok(code2);
    }
    const tail = self2.events[self2.events.length - 1];
    if (!self2.parser.constructs.disable.null.includes("codeIndented") && tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4) {
      return ok2(code2);
    }
    return effects2.interrupt(self2.parser.constructs.flow, nok, ok2)(code2);
  }
}
function factoryDestination(effects2, ok2, nok, type4, literalType, literalMarkerType, rawType, stringType, max2) {
  const limit2 = max2 || Number.POSITIVE_INFINITY;
  let balance = 0;
  return start2;
  function start2(code2) {
    if (code2 === 60) {
      effects2.enter(type4);
      effects2.enter(literalType);
      effects2.enter(literalMarkerType);
      effects2.consume(code2);
      effects2.exit(literalMarkerType);
      return enclosedBefore;
    }
    if (code2 === null || code2 === 32 || code2 === 41 || asciiControl(code2)) {
      return nok(code2);
    }
    effects2.enter(type4);
    effects2.enter(rawType);
    effects2.enter(stringType);
    effects2.enter("chunkString", {
      contentType: "string"
    });
    return raw(code2);
  }
  function enclosedBefore(code2) {
    if (code2 === 62) {
      effects2.enter(literalMarkerType);
      effects2.consume(code2);
      effects2.exit(literalMarkerType);
      effects2.exit(literalType);
      effects2.exit(type4);
      return ok2;
    }
    effects2.enter(stringType);
    effects2.enter("chunkString", {
      contentType: "string"
    });
    return enclosed(code2);
  }
  function enclosed(code2) {
    if (code2 === 62) {
      effects2.exit("chunkString");
      effects2.exit(stringType);
      return enclosedBefore(code2);
    }
    if (code2 === null || code2 === 60 || markdownLineEnding(code2)) {
      return nok(code2);
    }
    effects2.consume(code2);
    return code2 === 92 ? enclosedEscape : enclosed;
  }
  function enclosedEscape(code2) {
    if (code2 === 60 || code2 === 62 || code2 === 92) {
      effects2.consume(code2);
      return enclosed;
    }
    return enclosed(code2);
  }
  function raw(code2) {
    if (!balance && (code2 === null || code2 === 41 || markdownLineEndingOrSpace(code2))) {
      effects2.exit("chunkString");
      effects2.exit(stringType);
      effects2.exit(rawType);
      effects2.exit(type4);
      return ok2(code2);
    }
    if (balance < limit2 && code2 === 40) {
      effects2.consume(code2);
      balance++;
      return raw;
    }
    if (code2 === 41) {
      effects2.consume(code2);
      balance--;
      return raw;
    }
    if (code2 === null || code2 === 32 || code2 === 40 || asciiControl(code2)) {
      return nok(code2);
    }
    effects2.consume(code2);
    return code2 === 92 ? rawEscape : raw;
  }
  function rawEscape(code2) {
    if (code2 === 40 || code2 === 41 || code2 === 92) {
      effects2.consume(code2);
      return raw;
    }
    return raw(code2);
  }
}
function factoryLabel(effects2, ok2, nok, type4, markerType, stringType) {
  const self2 = this;
  let size2 = 0;
  let seen2;
  return start2;
  function start2(code2) {
    effects2.enter(type4);
    effects2.enter(markerType);
    effects2.consume(code2);
    effects2.exit(markerType);
    effects2.enter(stringType);
    return atBreak;
  }
  function atBreak(code2) {
    if (size2 > 999 || code2 === null || code2 === 91 || code2 === 93 && !seen2 || // To do: remove in the future once we’ve switched from
    // `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,
    // which doesn’t need this.
    // Hidden footnotes hook.
    /* c8 ignore next 3 */
    code2 === 94 && !size2 && "_hiddenFootnoteSupport" in self2.parser.constructs) {
      return nok(code2);
    }
    if (code2 === 93) {
      effects2.exit(stringType);
      effects2.enter(markerType);
      effects2.consume(code2);
      effects2.exit(markerType);
      effects2.exit(type4);
      return ok2;
    }
    if (markdownLineEnding(code2)) {
      effects2.enter("lineEnding");
      effects2.consume(code2);
      effects2.exit("lineEnding");
      return atBreak;
    }
    effects2.enter("chunkString", {
      contentType: "string"
    });
    return labelInside(code2);
  }
  function labelInside(code2) {
    if (code2 === null || code2 === 91 || code2 === 93 || markdownLineEnding(code2) || size2++ > 999) {
      effects2.exit("chunkString");
      return atBreak(code2);
    }
    effects2.consume(code2);
    if (!seen2)
      seen2 = !markdownSpace(code2);
    return code2 === 92 ? labelEscape : labelInside;
  }
  function labelEscape(code2) {
    if (code2 === 91 || code2 === 92 || code2 === 93) {
      effects2.consume(code2);
      size2++;
      return labelInside;
    }
    return labelInside(code2);
  }
}
function factoryTitle(effects2, ok2, nok, type4, markerType, stringType) {
  let marker;
  return start2;
  function start2(code2) {
    if (code2 === 34 || code2 === 39 || code2 === 40) {
      effects2.enter(type4);
      effects2.enter(markerType);
      effects2.consume(code2);
      effects2.exit(markerType);
      marker = code2 === 40 ? 41 : code2;
      return begin;
    }
    return nok(code2);
  }
  function begin(code2) {
    if (code2 === marker) {
      effects2.enter(markerType);
      effects2.consume(code2);
      effects2.exit(markerType);
      effects2.exit(type4);
      return ok2;
    }
    effects2.enter(stringType);
    return atBreak(code2);
  }
  function atBreak(code2) {
    if (code2 === marker) {
      effects2.exit(stringType);
      return begin(marker);
    }
    if (code2 === null) {
      return nok(code2);
    }
    if (markdownLineEnding(code2)) {
      effects2.enter("lineEnding");
      effects2.consume(code2);
      effects2.exit("lineEnding");
      return factorySpace(effects2, atBreak, "linePrefix");
    }
    effects2.enter("chunkString", {
      contentType: "string"
    });
    return inside(code2);
  }
  function inside(code2) {
    if (code2 === marker || code2 === null || markdownLineEnding(code2)) {
      effects2.exit("chunkString");
      return atBreak(code2);
    }
    effects2.consume(code2);
    return code2 === 92 ? escape2 : inside;
  }
  function escape2(code2) {
    if (code2 === marker || code2 === 92) {
      effects2.consume(code2);
      return inside;
    }
    return inside(code2);
  }
}
function factoryWhitespace(effects2, ok2) {
  let seen2;
  return start2;
  function start2(code2) {
    if (markdownLineEnding(code2)) {
      effects2.enter("lineEnding");
      effects2.consume(code2);
      effects2.exit("lineEnding");
      seen2 = true;
      return start2;
    }
    if (markdownSpace(code2)) {
      return factorySpace(effects2, start2, seen2 ? "linePrefix" : "lineSuffix")(code2);
    }
    return ok2(code2);
  }
}
const definition = {
  name: "definition",
  tokenize: tokenizeDefinition
};
const titleBefore = {
  partial: true,
  tokenize: tokenizeTitleBefore
};
function tokenizeDefinition(effects2, ok2, nok) {
  const self2 = this;
  let identifier2;
  return start2;
  function start2(code2) {
    effects2.enter("definition");
    return before(code2);
  }
  function before(code2) {
    return factoryLabel.call(
      self2,
      effects2,
      labelAfter,
      // Note: we don’t need to reset the way `markdown-rs` does.
      nok,
      "definitionLabel",
      "definitionLabelMarker",
      "definitionLabelString"
    )(code2);
  }
  function labelAfter(code2) {
    identifier2 = normalizeIdentifier(self2.sliceSerialize(self2.events[self2.events.length - 1][1]).slice(1, -1));
    if (code2 === 58) {
      effects2.enter("definitionMarker");
      effects2.consume(code2);
      effects2.exit("definitionMarker");
      return markerAfter;
    }
    return nok(code2);
  }
  function markerAfter(code2) {
    return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects2, destinationBefore)(code2) : destinationBefore(code2);
  }
  function destinationBefore(code2) {
    return factoryDestination(
      effects2,
      destinationAfter,
      // Note: we don’t need to reset the way `markdown-rs` does.
      nok,
      "definitionDestination",
      "definitionDestinationLiteral",
      "definitionDestinationLiteralMarker",
      "definitionDestinationRaw",
      "definitionDestinationString"
    )(code2);
  }
  function destinationAfter(code2) {
    return effects2.attempt(titleBefore, after, after)(code2);
  }
  function after(code2) {
    return markdownSpace(code2) ? factorySpace(effects2, afterWhitespace, "whitespace")(code2) : afterWhitespace(code2);
  }
  function afterWhitespace(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      effects2.exit("definition");
      self2.parser.defined.push(identifier2);
      return ok2(code2);
    }
    return nok(code2);
  }
}
function tokenizeTitleBefore(effects2, ok2, nok) {
  return titleBefore2;
  function titleBefore2(code2) {
    return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects2, beforeMarker)(code2) : nok(code2);
  }
  function beforeMarker(code2) {
    return factoryTitle(effects2, titleAfter, nok, "definitionTitle", "definitionTitleMarker", "definitionTitleString")(code2);
  }
  function titleAfter(code2) {
    return markdownSpace(code2) ? factorySpace(effects2, titleAfterOptionalWhitespace, "whitespace")(code2) : titleAfterOptionalWhitespace(code2);
  }
  function titleAfterOptionalWhitespace(code2) {
    return code2 === null || markdownLineEnding(code2) ? ok2(code2) : nok(code2);
  }
}
const hardBreakEscape = {
  name: "hardBreakEscape",
  tokenize: tokenizeHardBreakEscape
};
function tokenizeHardBreakEscape(effects2, ok2, nok) {
  return start2;
  function start2(code2) {
    effects2.enter("hardBreakEscape");
    effects2.consume(code2);
    return after;
  }
  function after(code2) {
    if (markdownLineEnding(code2)) {
      effects2.exit("hardBreakEscape");
      return ok2(code2);
    }
    return nok(code2);
  }
}
const headingAtx = {
  name: "headingAtx",
  resolve: resolveHeadingAtx,
  tokenize: tokenizeHeadingAtx
};
function resolveHeadingAtx(events2, context) {
  let contentEnd = events2.length - 2;
  let contentStart = 3;
  let content2;
  let text2;
  if (events2[contentStart][1].type === "whitespace") {
    contentStart += 2;
  }
  if (contentEnd - 2 > contentStart && events2[contentEnd][1].type === "whitespace") {
    contentEnd -= 2;
  }
  if (events2[contentEnd][1].type === "atxHeadingSequence" && (contentStart === contentEnd - 1 || contentEnd - 4 > contentStart && events2[contentEnd - 2][1].type === "whitespace")) {
    contentEnd -= contentStart + 1 === contentEnd ? 2 : 4;
  }
  if (contentEnd > contentStart) {
    content2 = {
      type: "atxHeadingText",
      start: events2[contentStart][1].start,
      end: events2[contentEnd][1].end
    };
    text2 = {
      type: "chunkText",
      start: events2[contentStart][1].start,
      end: events2[contentEnd][1].end,
      contentType: "text"
    };
    splice(events2, contentStart, contentEnd - contentStart + 1, [["enter", content2, context], ["enter", text2, context], ["exit", text2, context], ["exit", content2, context]]);
  }
  return events2;
}
function tokenizeHeadingAtx(effects2, ok2, nok) {
  let size2 = 0;
  return start2;
  function start2(code2) {
    effects2.enter("atxHeading");
    return before(code2);
  }
  function before(code2) {
    effects2.enter("atxHeadingSequence");
    return sequenceOpen(code2);
  }
  function sequenceOpen(code2) {
    if (code2 === 35 && size2++ < 6) {
      effects2.consume(code2);
      return sequenceOpen;
    }
    if (code2 === null || markdownLineEndingOrSpace(code2)) {
      effects2.exit("atxHeadingSequence");
      return atBreak(code2);
    }
    return nok(code2);
  }
  function atBreak(code2) {
    if (code2 === 35) {
      effects2.enter("atxHeadingSequence");
      return sequenceFurther(code2);
    }
    if (code2 === null || markdownLineEnding(code2)) {
      effects2.exit("atxHeading");
      return ok2(code2);
    }
    if (markdownSpace(code2)) {
      return factorySpace(effects2, atBreak, "whitespace")(code2);
    }
    effects2.enter("atxHeadingText");
    return data(code2);
  }
  function sequenceFurther(code2) {
    if (code2 === 35) {
      effects2.consume(code2);
      return sequenceFurther;
    }
    effects2.exit("atxHeadingSequence");
    return atBreak(code2);
  }
  function data(code2) {
    if (code2 === null || code2 === 35 || markdownLineEndingOrSpace(code2)) {
      effects2.exit("atxHeadingText");
      return atBreak(code2);
    }
    effects2.consume(code2);
    return data;
  }
}
const htmlBlockNames = [
  "address",
  "article",
  "aside",
  "base",
  "basefont",
  "blockquote",
  "body",
  "caption",
  "center",
  "col",
  "colgroup",
  "dd",
  "details",
  "dialog",
  "dir",
  "div",
  "dl",
  "dt",
  "fieldset",
  "figcaption",
  "figure",
  "footer",
  "form",
  "frame",
  "frameset",
  "h1",
  "h2",
  "h3",
  "h4",
  "h5",
  "h6",
  "head",
  "header",
  "hr",
  "html",
  "iframe",
  "legend",
  "li",
  "link",
  "main",
  "menu",
  "menuitem",
  "nav",
  "noframes",
  "ol",
  "optgroup",
  "option",
  "p",
  "param",
  "search",
  "section",
  "summary",
  "table",
  "tbody",
  "td",
  "tfoot",
  "th",
  "thead",
  "title",
  "tr",
  "track",
  "ul"
];
const htmlRawNames = ["pre", "script", "style", "textarea"];
const htmlFlow = {
  concrete: true,
  name: "htmlFlow",
  resolveTo: resolveToHtmlFlow,
  tokenize: tokenizeHtmlFlow
};
const blankLineBefore = {
  partial: true,
  tokenize: tokenizeBlankLineBefore
};
const nonLazyContinuationStart = {
  partial: true,
  tokenize: tokenizeNonLazyContinuationStart
};
function resolveToHtmlFlow(events2) {
  let index2 = events2.length;
  while (index2--) {
    if (events2[index2][0] === "enter" && events2[index2][1].type === "htmlFlow") {
      break;
    }
  }
  if (index2 > 1 && events2[index2 - 2][1].type === "linePrefix") {
    events2[index2][1].start = events2[index2 - 2][1].start;
    events2[index2 + 1][1].start = events2[index2 - 2][1].start;
    events2.splice(index2 - 2, 2);
  }
  return events2;
}
function tokenizeHtmlFlow(effects2, ok2, nok) {
  const self2 = this;
  let marker;
  let closingTag;
  let buffer;
  let index2;
  let markerB;
  return start2;
  function start2(code2) {
    return before(code2);
  }
  function before(code2) {
    effects2.enter("htmlFlow");
    effects2.enter("htmlFlowData");
    effects2.consume(code2);
    return open;
  }
  function open(code2) {
    if (code2 === 33) {
      effects2.consume(code2);
      return declarationOpen;
    }
    if (code2 === 47) {
      effects2.consume(code2);
      closingTag = true;
      return tagCloseStart;
    }
    if (code2 === 63) {
      effects2.consume(code2);
      marker = 3;
      return self2.interrupt ? ok2 : continuationDeclarationInside;
    }
    if (asciiAlpha(code2)) {
      effects2.consume(code2);
      buffer = String.fromCharCode(code2);
      return tagName;
    }
    return nok(code2);
  }
  function declarationOpen(code2) {
    if (code2 === 45) {
      effects2.consume(code2);
      marker = 2;
      return commentOpenInside;
    }
    if (code2 === 91) {
      effects2.consume(code2);
      marker = 5;
      index2 = 0;
      return cdataOpenInside;
    }
    if (asciiAlpha(code2)) {
      effects2.consume(code2);
      marker = 4;
      return self2.interrupt ? ok2 : continuationDeclarationInside;
    }
    return nok(code2);
  }
  function commentOpenInside(code2) {
    if (code2 === 45) {
      effects2.consume(code2);
      return self2.interrupt ? ok2 : continuationDeclarationInside;
    }
    return nok(code2);
  }
  function cdataOpenInside(code2) {
    const value2 = "CDATA[";
    if (code2 === value2.charCodeAt(index2++)) {
      effects2.consume(code2);
      if (index2 === value2.length) {
        return self2.interrupt ? ok2 : continuation;
      }
      return cdataOpenInside;
    }
    return nok(code2);
  }
  function tagCloseStart(code2) {
    if (asciiAlpha(code2)) {
      effects2.consume(code2);
      buffer = String.fromCharCode(code2);
      return tagName;
    }
    return nok(code2);
  }
  function tagName(code2) {
    if (code2 === null || code2 === 47 || code2 === 62 || markdownLineEndingOrSpace(code2)) {
      const slash = code2 === 47;
      const name2 = buffer.toLowerCase();
      if (!slash && !closingTag && htmlRawNames.includes(name2)) {
        marker = 1;
        return self2.interrupt ? ok2(code2) : continuation(code2);
      }
      if (htmlBlockNames.includes(buffer.toLowerCase())) {
        marker = 6;
        if (slash) {
          effects2.consume(code2);
          return basicSelfClosing;
        }
        return self2.interrupt ? ok2(code2) : continuation(code2);
      }
      marker = 7;
      return self2.interrupt && !self2.parser.lazy[self2.now().line] ? nok(code2) : closingTag ? completeClosingTagAfter(code2) : completeAttributeNameBefore(code2);
    }
    if (code2 === 45 || asciiAlphanumeric(code2)) {
      effects2.consume(code2);
      buffer += String.fromCharCode(code2);
      return tagName;
    }
    return nok(code2);
  }
  function basicSelfClosing(code2) {
    if (code2 === 62) {
      effects2.consume(code2);
      return self2.interrupt ? ok2 : continuation;
    }
    return nok(code2);
  }
  function completeClosingTagAfter(code2) {
    if (markdownSpace(code2)) {
      effects2.consume(code2);
      return completeClosingTagAfter;
    }
    return completeEnd(code2);
  }
  function completeAttributeNameBefore(code2) {
    if (code2 === 47) {
      effects2.consume(code2);
      return completeEnd;
    }
    if (code2 === 58 || code2 === 95 || asciiAlpha(code2)) {
      effects2.consume(code2);
      return completeAttributeName;
    }
    if (markdownSpace(code2)) {
      effects2.consume(code2);
      return completeAttributeNameBefore;
    }
    return completeEnd(code2);
  }
  function completeAttributeName(code2) {
    if (code2 === 45 || code2 === 46 || code2 === 58 || code2 === 95 || asciiAlphanumeric(code2)) {
      effects2.consume(code2);
      return completeAttributeName;
    }
    return completeAttributeNameAfter(code2);
  }
  function completeAttributeNameAfter(code2) {
    if (code2 === 61) {
      effects2.consume(code2);
      return completeAttributeValueBefore;
    }
    if (markdownSpace(code2)) {
      effects2.consume(code2);
      return completeAttributeNameAfter;
    }
    return completeAttributeNameBefore(code2);
  }
  function completeAttributeValueBefore(code2) {
    if (code2 === null || code2 === 60 || code2 === 61 || code2 === 62 || code2 === 96) {
      return nok(code2);
    }
    if (code2 === 34 || code2 === 39) {
      effects2.consume(code2);
      markerB = code2;
      return completeAttributeValueQuoted;
    }
    if (markdownSpace(code2)) {
      effects2.consume(code2);
      return completeAttributeValueBefore;
    }
    return completeAttributeValueUnquoted(code2);
  }
  function completeAttributeValueQuoted(code2) {
    if (code2 === markerB) {
      effects2.consume(code2);
      markerB = null;
      return completeAttributeValueQuotedAfter;
    }
    if (code2 === null || markdownLineEnding(code2)) {
      return nok(code2);
    }
    effects2.consume(code2);
    return completeAttributeValueQuoted;
  }
  function completeAttributeValueUnquoted(code2) {
    if (code2 === null || code2 === 34 || code2 === 39 || code2 === 47 || code2 === 60 || code2 === 61 || code2 === 62 || code2 === 96 || markdownLineEndingOrSpace(code2)) {
      return completeAttributeNameAfter(code2);
    }
    effects2.consume(code2);
    return completeAttributeValueUnquoted;
  }
  function completeAttributeValueQuotedAfter(code2) {
    if (code2 === 47 || code2 === 62 || markdownSpace(code2)) {
      return completeAttributeNameBefore(code2);
    }
    return nok(code2);
  }
  function completeEnd(code2) {
    if (code2 === 62) {
      effects2.consume(code2);
      return completeAfter;
    }
    return nok(code2);
  }
  function completeAfter(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      return continuation(code2);
    }
    if (markdownSpace(code2)) {
      effects2.consume(code2);
      return completeAfter;
    }
    return nok(code2);
  }
  function continuation(code2) {
    if (code2 === 45 && marker === 2) {
      effects2.consume(code2);
      return continuationCommentInside;
    }
    if (code2 === 60 && marker === 1) {
      effects2.consume(code2);
      return continuationRawTagOpen;
    }
    if (code2 === 62 && marker === 4) {
      effects2.consume(code2);
      return continuationClose;
    }
    if (code2 === 63 && marker === 3) {
      effects2.consume(code2);
      return continuationDeclarationInside;
    }
    if (code2 === 93 && marker === 5) {
      effects2.consume(code2);
      return continuationCdataInside;
    }
    if (markdownLineEnding(code2) && (marker === 6 || marker === 7)) {
      effects2.exit("htmlFlowData");
      return effects2.check(blankLineBefore, continuationAfter, continuationStart)(code2);
    }
    if (code2 === null || markdownLineEnding(code2)) {
      effects2.exit("htmlFlowData");
      return continuationStart(code2);
    }
    effects2.consume(code2);
    return continuation;
  }
  function continuationStart(code2) {
    return effects2.check(nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code2);
  }
  function continuationStartNonLazy(code2) {
    effects2.enter("lineEnding");
    effects2.consume(code2);
    effects2.exit("lineEnding");
    return continuationBefore;
  }
  function continuationBefore(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      return continuationStart(code2);
    }
    effects2.enter("htmlFlowData");
    return continuation(code2);
  }
  function continuationCommentInside(code2) {
    if (code2 === 45) {
      effects2.consume(code2);
      return continuationDeclarationInside;
    }
    return continuation(code2);
  }
  function continuationRawTagOpen(code2) {
    if (code2 === 47) {
      effects2.consume(code2);
      buffer = "";
      return continuationRawEndTag;
    }
    return continuation(code2);
  }
  function continuationRawEndTag(code2) {
    if (code2 === 62) {
      const name2 = buffer.toLowerCase();
      if (htmlRawNames.includes(name2)) {
        effects2.consume(code2);
        return continuationClose;
      }
      return continuation(code2);
    }
    if (asciiAlpha(code2) && buffer.length < 8) {
      effects2.consume(code2);
      buffer += String.fromCharCode(code2);
      return continuationRawEndTag;
    }
    return continuation(code2);
  }
  function continuationCdataInside(code2) {
    if (code2 === 93) {
      effects2.consume(code2);
      return continuationDeclarationInside;
    }
    return continuation(code2);
  }
  function continuationDeclarationInside(code2) {
    if (code2 === 62) {
      effects2.consume(code2);
      return continuationClose;
    }
    if (code2 === 45 && marker === 2) {
      effects2.consume(code2);
      return continuationDeclarationInside;
    }
    return continuation(code2);
  }
  function continuationClose(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      effects2.exit("htmlFlowData");
      return continuationAfter(code2);
    }
    effects2.consume(code2);
    return continuationClose;
  }
  function continuationAfter(code2) {
    effects2.exit("htmlFlow");
    return ok2(code2);
  }
}
function tokenizeNonLazyContinuationStart(effects2, ok2, nok) {
  const self2 = this;
  return start2;
  function start2(code2) {
    if (markdownLineEnding(code2)) {
      effects2.enter("lineEnding");
      effects2.consume(code2);
      effects2.exit("lineEnding");
      return after;
    }
    return nok(code2);
  }
  function after(code2) {
    return self2.parser.lazy[self2.now().line] ? nok(code2) : ok2(code2);
  }
}
function tokenizeBlankLineBefore(effects2, ok2, nok) {
  return start2;
  function start2(code2) {
    effects2.enter("lineEnding");
    effects2.consume(code2);
    effects2.exit("lineEnding");
    return effects2.attempt(blankLine, ok2, nok);
  }
}
const htmlText = {
  name: "htmlText",
  tokenize: tokenizeHtmlText
};
function tokenizeHtmlText(effects2, ok2, nok) {
  const self2 = this;
  let marker;
  let index2;
  let returnState;
  return start2;
  function start2(code2) {
    effects2.enter("htmlText");
    effects2.enter("htmlTextData");
    effects2.consume(code2);
    return open;
  }
  function open(code2) {
    if (code2 === 33) {
      effects2.consume(code2);
      return declarationOpen;
    }
    if (code2 === 47) {
      effects2.consume(code2);
      return tagCloseStart;
    }
    if (code2 === 63) {
      effects2.consume(code2);
      return instruction;
    }
    if (asciiAlpha(code2)) {
      effects2.consume(code2);
      return tagOpen;
    }
    return nok(code2);
  }
  function declarationOpen(code2) {
    if (code2 === 45) {
      effects2.consume(code2);
      return commentOpenInside;
    }
    if (code2 === 91) {
      effects2.consume(code2);
      index2 = 0;
      return cdataOpenInside;
    }
    if (asciiAlpha(code2)) {
      effects2.consume(code2);
      return declaration2;
    }
    return nok(code2);
  }
  function commentOpenInside(code2) {
    if (code2 === 45) {
      effects2.consume(code2);
      return commentEnd;
    }
    return nok(code2);
  }
  function comment2(code2) {
    if (code2 === null) {
      return nok(code2);
    }
    if (code2 === 45) {
      effects2.consume(code2);
      return commentClose;
    }
    if (markdownLineEnding(code2)) {
      returnState = comment2;
      return lineEndingBefore(code2);
    }
    effects2.consume(code2);
    return comment2;
  }
  function commentClose(code2) {
    if (code2 === 45) {
      effects2.consume(code2);
      return commentEnd;
    }
    return comment2(code2);
  }
  function commentEnd(code2) {
    return code2 === 62 ? end2(code2) : code2 === 45 ? commentClose(code2) : comment2(code2);
  }
  function cdataOpenInside(code2) {
    const value2 = "CDATA[";
    if (code2 === value2.charCodeAt(index2++)) {
      effects2.consume(code2);
      return index2 === value2.length ? cdata : cdataOpenInside;
    }
    return nok(code2);
  }
  function cdata(code2) {
    if (code2 === null) {
      return nok(code2);
    }
    if (code2 === 93) {
      effects2.consume(code2);
      return cdataClose;
    }
    if (markdownLineEnding(code2)) {
      returnState = cdata;
      return lineEndingBefore(code2);
    }
    effects2.consume(code2);
    return cdata;
  }
  function cdataClose(code2) {
    if (code2 === 93) {
      effects2.consume(code2);
      return cdataEnd;
    }
    return cdata(code2);
  }
  function cdataEnd(code2) {
    if (code2 === 62) {
      return end2(code2);
    }
    if (code2 === 93) {
      effects2.consume(code2);
      return cdataEnd;
    }
    return cdata(code2);
  }
  function declaration2(code2) {
    if (code2 === null || code2 === 62) {
      return end2(code2);
    }
    if (markdownLineEnding(code2)) {
      returnState = declaration2;
      return lineEndingBefore(code2);
    }
    effects2.consume(code2);
    return declaration2;
  }
  function instruction(code2) {
    if (code2 === null) {
      return nok(code2);
    }
    if (code2 === 63) {
      effects2.consume(code2);
      return instructionClose;
    }
    if (markdownLineEnding(code2)) {
      returnState = instruction;
      return lineEndingBefore(code2);
    }
    effects2.consume(code2);
    return instruction;
  }
  function instructionClose(code2) {
    return code2 === 62 ? end2(code2) : instruction(code2);
  }
  function tagCloseStart(code2) {
    if (asciiAlpha(code2)) {
      effects2.consume(code2);
      return tagClose;
    }
    return nok(code2);
  }
  function tagClose(code2) {
    if (code2 === 45 || asciiAlphanumeric(code2)) {
      effects2.consume(code2);
      return tagClose;
    }
    return tagCloseBetween(code2);
  }
  function tagCloseBetween(code2) {
    if (markdownLineEnding(code2)) {
      returnState = tagCloseBetween;
      return lineEndingBefore(code2);
    }
    if (markdownSpace(code2)) {
      effects2.consume(code2);
      return tagCloseBetween;
    }
    return end2(code2);
  }
  function tagOpen(code2) {
    if (code2 === 45 || asciiAlphanumeric(code2)) {
      effects2.consume(code2);
      return tagOpen;
    }
    if (code2 === 47 || code2 === 62 || markdownLineEndingOrSpace(code2)) {
      return tagOpenBetween(code2);
    }
    return nok(code2);
  }
  function tagOpenBetween(code2) {
    if (code2 === 47) {
      effects2.consume(code2);
      return end2;
    }
    if (code2 === 58 || code2 === 95 || asciiAlpha(code2)) {
      effects2.consume(code2);
      return tagOpenAttributeName;
    }
    if (markdownLineEnding(code2)) {
      returnState = tagOpenBetween;
      return lineEndingBefore(code2);
    }
    if (markdownSpace(code2)) {
      effects2.consume(code2);
      return tagOpenBetween;
    }
    return end2(code2);
  }
  function tagOpenAttributeName(code2) {
    if (code2 === 45 || code2 === 46 || code2 === 58 || code2 === 95 || asciiAlphanumeric(code2)) {
      effects2.consume(code2);
      return tagOpenAttributeName;
    }
    return tagOpenAttributeNameAfter(code2);
  }
  function tagOpenAttributeNameAfter(code2) {
    if (code2 === 61) {
      effects2.consume(code2);
      return tagOpenAttributeValueBefore;
    }
    if (markdownLineEnding(code2)) {
      returnState = tagOpenAttributeNameAfter;
      return lineEndingBefore(code2);
    }
    if (markdownSpace(code2)) {
      effects2.consume(code2);
      return tagOpenAttributeNameAfter;
    }
    return tagOpenBetween(code2);
  }
  function tagOpenAttributeValueBefore(code2) {
    if (code2 === null || code2 === 60 || code2 === 61 || code2 === 62 || code2 === 96) {
      return nok(code2);
    }
    if (code2 === 34 || code2 === 39) {
      effects2.consume(code2);
      marker = code2;
      return tagOpenAttributeValueQuoted;
    }
    if (markdownLineEnding(code2)) {
      returnState = tagOpenAttributeValueBefore;
      return lineEndingBefore(code2);
    }
    if (markdownSpace(code2)) {
      effects2.consume(code2);
      return tagOpenAttributeValueBefore;
    }
    effects2.consume(code2);
    return tagOpenAttributeValueUnquoted;
  }
  function tagOpenAttributeValueQuoted(code2) {
    if (code2 === marker) {
      effects2.consume(code2);
      marker = void 0;
      return tagOpenAttributeValueQuotedAfter;
    }
    if (code2 === null) {
      return nok(code2);
    }
    if (markdownLineEnding(code2)) {
      returnState = tagOpenAttributeValueQuoted;
      return lineEndingBefore(code2);
    }
    effects2.consume(code2);
    return tagOpenAttributeValueQuoted;
  }
  function tagOpenAttributeValueUnquoted(code2) {
    if (code2 === null || code2 === 34 || code2 === 39 || code2 === 60 || code2 === 61 || code2 === 96) {
      return nok(code2);
    }
    if (code2 === 47 || code2 === 62 || markdownLineEndingOrSpace(code2)) {
      return tagOpenBetween(code2);
    }
    effects2.consume(code2);
    return tagOpenAttributeValueUnquoted;
  }
  function tagOpenAttributeValueQuotedAfter(code2) {
    if (code2 === 47 || code2 === 62 || markdownLineEndingOrSpace(code2)) {
      return tagOpenBetween(code2);
    }
    return nok(code2);
  }
  function end2(code2) {
    if (code2 === 62) {
      effects2.consume(code2);
      effects2.exit("htmlTextData");
      effects2.exit("htmlText");
      return ok2;
    }
    return nok(code2);
  }
  function lineEndingBefore(code2) {
    effects2.exit("htmlTextData");
    effects2.enter("lineEnding");
    effects2.consume(code2);
    effects2.exit("lineEnding");
    return lineEndingAfter;
  }
  function lineEndingAfter(code2) {
    return markdownSpace(code2) ? factorySpace(effects2, lineEndingAfterPrefix, "linePrefix", self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code2) : lineEndingAfterPrefix(code2);
  }
  function lineEndingAfterPrefix(code2) {
    effects2.enter("htmlTextData");
    return returnState(code2);
  }
}
const labelEnd = {
  name: "labelEnd",
  resolveAll: resolveAllLabelEnd,
  resolveTo: resolveToLabelEnd,
  tokenize: tokenizeLabelEnd
};
const resourceConstruct = {
  tokenize: tokenizeResource
};
const referenceFullConstruct = {
  tokenize: tokenizeReferenceFull
};
const referenceCollapsedConstruct = {
  tokenize: tokenizeReferenceCollapsed
};
function resolveAllLabelEnd(events2) {
  let index2 = -1;
  const newEvents = [];
  while (++index2 < events2.length) {
    const token2 = events2[index2][1];
    newEvents.push(events2[index2]);
    if (token2.type === "labelImage" || token2.type === "labelLink" || token2.type === "labelEnd") {
      const offset2 = token2.type === "labelImage" ? 4 : 2;
      token2.type = "data";
      index2 += offset2;
    }
  }
  if (events2.length !== newEvents.length) {
    splice(events2, 0, events2.length, newEvents);
  }
  return events2;
}
function resolveToLabelEnd(events2, context) {
  let index2 = events2.length;
  let offset2 = 0;
  let token2;
  let open;
  let close;
  let media;
  while (index2--) {
    token2 = events2[index2][1];
    if (open) {
      if (token2.type === "link" || token2.type === "labelLink" && token2._inactive) {
        break;
      }
      if (events2[index2][0] === "enter" && token2.type === "labelLink") {
        token2._inactive = true;
      }
    } else if (close) {
      if (events2[index2][0] === "enter" && (token2.type === "labelImage" || token2.type === "labelLink") && !token2._balanced) {
        open = index2;
        if (token2.type !== "labelLink") {
          offset2 = 2;
          break;
        }
      }
    } else if (token2.type === "labelEnd") {
      close = index2;
    }
  }
  const group = {
    type: events2[open][1].type === "labelLink" ? "link" : "image",
    start: {
      ...events2[open][1].start
    },
    end: {
      ...events2[events2.length - 1][1].end
    }
  };
  const label = {
    type: "label",
    start: {
      ...events2[open][1].start
    },
    end: {
      ...events2[close][1].end
    }
  };
  const text2 = {
    type: "labelText",
    start: {
      ...events2[open + offset2 + 2][1].end
    },
    end: {
      ...events2[close - 2][1].start
    }
  };
  media = [["enter", group, context], ["enter", label, context]];
  media = push(media, events2.slice(open + 1, open + offset2 + 3));
  media = push(media, [["enter", text2, context]]);
  media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events2.slice(open + offset2 + 4, close - 3), context));
  media = push(media, [["exit", text2, context], events2[close - 2], events2[close - 1], ["exit", label, context]]);
  media = push(media, events2.slice(close + 1));
  media = push(media, [["exit", group, context]]);
  splice(events2, open, events2.length, media);
  return events2;
}
function tokenizeLabelEnd(effects2, ok2, nok) {
  const self2 = this;
  let index2 = self2.events.length;
  let labelStart;
  let defined2;
  while (index2--) {
    if ((self2.events[index2][1].type === "labelImage" || self2.events[index2][1].type === "labelLink") && !self2.events[index2][1]._balanced) {
      labelStart = self2.events[index2][1];
      break;
    }
  }
  return start2;
  function start2(code2) {
    if (!labelStart) {
      return nok(code2);
    }
    if (labelStart._inactive) {
      return labelEndNok(code2);
    }
    defined2 = self2.parser.defined.includes(normalizeIdentifier(self2.sliceSerialize({
      start: labelStart.end,
      end: self2.now()
    })));
    effects2.enter("labelEnd");
    effects2.enter("labelMarker");
    effects2.consume(code2);
    effects2.exit("labelMarker");
    effects2.exit("labelEnd");
    return after;
  }
  function after(code2) {
    if (code2 === 40) {
      return effects2.attempt(resourceConstruct, labelEndOk, defined2 ? labelEndOk : labelEndNok)(code2);
    }
    if (code2 === 91) {
      return effects2.attempt(referenceFullConstruct, labelEndOk, defined2 ? referenceNotFull : labelEndNok)(code2);
    }
    return defined2 ? labelEndOk(code2) : labelEndNok(code2);
  }
  function referenceNotFull(code2) {
    return effects2.attempt(referenceCollapsedConstruct, labelEndOk, labelEndNok)(code2);
  }
  function labelEndOk(code2) {
    return ok2(code2);
  }
  function labelEndNok(code2) {
    labelStart._balanced = true;
    return nok(code2);
  }
}
function tokenizeResource(effects2, ok2, nok) {
  return resourceStart;
  function resourceStart(code2) {
    effects2.enter("resource");
    effects2.enter("resourceMarker");
    effects2.consume(code2);
    effects2.exit("resourceMarker");
    return resourceBefore;
  }
  function resourceBefore(code2) {
    return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects2, resourceOpen)(code2) : resourceOpen(code2);
  }
  function resourceOpen(code2) {
    if (code2 === 41) {
      return resourceEnd(code2);
    }
    return factoryDestination(effects2, resourceDestinationAfter, resourceDestinationMissing, "resourceDestination", "resourceDestinationLiteral", "resourceDestinationLiteralMarker", "resourceDestinationRaw", "resourceDestinationString", 32)(code2);
  }
  function resourceDestinationAfter(code2) {
    return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects2, resourceBetween)(code2) : resourceEnd(code2);
  }
  function resourceDestinationMissing(code2) {
    return nok(code2);
  }
  function resourceBetween(code2) {
    if (code2 === 34 || code2 === 39 || code2 === 40) {
      return factoryTitle(effects2, resourceTitleAfter, nok, "resourceTitle", "resourceTitleMarker", "resourceTitleString")(code2);
    }
    return resourceEnd(code2);
  }
  function resourceTitleAfter(code2) {
    return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects2, resourceEnd)(code2) : resourceEnd(code2);
  }
  function resourceEnd(code2) {
    if (code2 === 41) {
      effects2.enter("resourceMarker");
      effects2.consume(code2);
      effects2.exit("resourceMarker");
      effects2.exit("resource");
      return ok2;
    }
    return nok(code2);
  }
}
function tokenizeReferenceFull(effects2, ok2, nok) {
  const self2 = this;
  return referenceFull;
  function referenceFull(code2) {
    return factoryLabel.call(self2, effects2, referenceFullAfter, referenceFullMissing, "reference", "referenceMarker", "referenceString")(code2);
  }
  function referenceFullAfter(code2) {
    return self2.parser.defined.includes(normalizeIdentifier(self2.sliceSerialize(self2.events[self2.events.length - 1][1]).slice(1, -1))) ? ok2(code2) : nok(code2);
  }
  function referenceFullMissing(code2) {
    return nok(code2);
  }
}
function tokenizeReferenceCollapsed(effects2, ok2, nok) {
  return referenceCollapsedStart;
  function referenceCollapsedStart(code2) {
    effects2.enter("reference");
    effects2.enter("referenceMarker");
    effects2.consume(code2);
    effects2.exit("referenceMarker");
    return referenceCollapsedOpen;
  }
  function referenceCollapsedOpen(code2) {
    if (code2 === 93) {
      effects2.enter("referenceMarker");
      effects2.consume(code2);
      effects2.exit("referenceMarker");
      effects2.exit("reference");
      return ok2;
    }
    return nok(code2);
  }
}
const labelStartImage = {
  name: "labelStartImage",
  resolveAll: labelEnd.resolveAll,
  tokenize: tokenizeLabelStartImage
};
function tokenizeLabelStartImage(effects2, ok2, nok) {
  const self2 = this;
  return start2;
  function start2(code2) {
    effects2.enter("labelImage");
    effects2.enter("labelImageMarker");
    effects2.consume(code2);
    effects2.exit("labelImageMarker");
    return open;
  }
  function open(code2) {
    if (code2 === 91) {
      effects2.enter("labelMarker");
      effects2.consume(code2);
      effects2.exit("labelMarker");
      effects2.exit("labelImage");
      return after;
    }
    return nok(code2);
  }
  function after(code2) {
    return code2 === 94 && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code2) : ok2(code2);
  }
}
const labelStartLink = {
  name: "labelStartLink",
  resolveAll: labelEnd.resolveAll,
  tokenize: tokenizeLabelStartLink
};
function tokenizeLabelStartLink(effects2, ok2, nok) {
  const self2 = this;
  return start2;
  function start2(code2) {
    effects2.enter("labelLink");
    effects2.enter("labelMarker");
    effects2.consume(code2);
    effects2.exit("labelMarker");
    effects2.exit("labelLink");
    return after;
  }
  function after(code2) {
    return code2 === 94 && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code2) : ok2(code2);
  }
}
const lineEnding = {
  name: "lineEnding",
  tokenize: tokenizeLineEnding
};
function tokenizeLineEnding(effects2, ok2) {
  return start2;
  function start2(code2) {
    effects2.enter("lineEnding");
    effects2.consume(code2);
    effects2.exit("lineEnding");
    return factorySpace(effects2, ok2, "linePrefix");
  }
}
const thematicBreak$1 = {
  name: "thematicBreak",
  tokenize: tokenizeThematicBreak
};
function tokenizeThematicBreak(effects2, ok2, nok) {
  let size2 = 0;
  let marker;
  return start2;
  function start2(code2) {
    effects2.enter("thematicBreak");
    return before(code2);
  }
  function before(code2) {
    marker = code2;
    return atBreak(code2);
  }
  function atBreak(code2) {
    if (code2 === marker) {
      effects2.enter("thematicBreakSequence");
      return sequence(code2);
    }
    if (size2 >= 3 && (code2 === null || markdownLineEnding(code2))) {
      effects2.exit("thematicBreak");
      return ok2(code2);
    }
    return nok(code2);
  }
  function sequence(code2) {
    if (code2 === marker) {
      effects2.consume(code2);
      size2++;
      return sequence;
    }
    effects2.exit("thematicBreakSequence");
    return markdownSpace(code2) ? factorySpace(effects2, atBreak, "whitespace")(code2) : atBreak(code2);
  }
}
const list$1 = {
  continuation: {
    tokenize: tokenizeListContinuation
  },
  exit: tokenizeListEnd,
  name: "list",
  tokenize: tokenizeListStart
};
const listItemPrefixWhitespaceConstruct = {
  partial: true,
  tokenize: tokenizeListItemPrefixWhitespace
};
const indentConstruct = {
  partial: true,
  tokenize: tokenizeIndent
};
function tokenizeListStart(effects2, ok2, nok) {
  const self2 = this;
  const tail = self2.events[self2.events.length - 1];
  let initialSize = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0;
  let size2 = 0;
  return start2;
  function start2(code2) {
    const kind = self2.containerState.type || (code2 === 42 || code2 === 43 || code2 === 45 ? "listUnordered" : "listOrdered");
    if (kind === "listUnordered" ? !self2.containerState.marker || code2 === self2.containerState.marker : asciiDigit(code2)) {
      if (!self2.containerState.type) {
        self2.containerState.type = kind;
        effects2.enter(kind, {
          _container: true
        });
      }
      if (kind === "listUnordered") {
        effects2.enter("listItemPrefix");
        return code2 === 42 || code2 === 45 ? effects2.check(thematicBreak$1, nok, atMarker)(code2) : atMarker(code2);
      }
      if (!self2.interrupt || code2 === 49) {
        effects2.enter("listItemPrefix");
        effects2.enter("listItemValue");
        return inside(code2);
      }
    }
    return nok(code2);
  }
  function inside(code2) {
    if (asciiDigit(code2) && ++size2 < 10) {
      effects2.consume(code2);
      return inside;
    }
    if ((!self2.interrupt || size2 < 2) && (self2.containerState.marker ? code2 === self2.containerState.marker : code2 === 41 || code2 === 46)) {
      effects2.exit("listItemValue");
      return atMarker(code2);
    }
    return nok(code2);
  }
  function atMarker(code2) {
    effects2.enter("listItemMarker");
    effects2.consume(code2);
    effects2.exit("listItemMarker");
    self2.containerState.marker = self2.containerState.marker || code2;
    return effects2.check(
      blankLine,
      // Can’t be empty when interrupting.
      self2.interrupt ? nok : onBlank,
      effects2.attempt(listItemPrefixWhitespaceConstruct, endOfPrefix, otherPrefix)
    );
  }
  function onBlank(code2) {
    self2.containerState.initialBlankLine = true;
    initialSize++;
    return endOfPrefix(code2);
  }
  function otherPrefix(code2) {
    if (markdownSpace(code2)) {
      effects2.enter("listItemPrefixWhitespace");
      effects2.consume(code2);
      effects2.exit("listItemPrefixWhitespace");
      return endOfPrefix;
    }
    return nok(code2);
  }
  function endOfPrefix(code2) {
    self2.containerState.size = initialSize + self2.sliceSerialize(effects2.exit("listItemPrefix"), true).length;
    return ok2(code2);
  }
}
function tokenizeListContinuation(effects2, ok2, nok) {
  const self2 = this;
  self2.containerState._closeFlow = void 0;
  return effects2.check(blankLine, onBlank, notBlank);
  function onBlank(code2) {
    self2.containerState.furtherBlankLines = self2.containerState.furtherBlankLines || self2.containerState.initialBlankLine;
    return factorySpace(effects2, ok2, "listItemIndent", self2.containerState.size + 1)(code2);
  }
  function notBlank(code2) {
    if (self2.containerState.furtherBlankLines || !markdownSpace(code2)) {
      self2.containerState.furtherBlankLines = void 0;
      self2.containerState.initialBlankLine = void 0;
      return notInCurrentItem(code2);
    }
    self2.containerState.furtherBlankLines = void 0;
    self2.containerState.initialBlankLine = void 0;
    return effects2.attempt(indentConstruct, ok2, notInCurrentItem)(code2);
  }
  function notInCurrentItem(code2) {
    self2.containerState._closeFlow = true;
    self2.interrupt = void 0;
    return factorySpace(effects2, effects2.attempt(list$1, ok2, nok), "linePrefix", self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code2);
  }
}
function tokenizeIndent(effects2, ok2, nok) {
  const self2 = this;
  return factorySpace(effects2, afterPrefix, "listItemIndent", self2.containerState.size + 1);
  function afterPrefix(code2) {
    const tail = self2.events[self2.events.length - 1];
    return tail && tail[1].type === "listItemIndent" && tail[2].sliceSerialize(tail[1], true).length === self2.containerState.size ? ok2(code2) : nok(code2);
  }
}
function tokenizeListEnd(effects2) {
  effects2.exit(this.containerState.type);
}
function tokenizeListItemPrefixWhitespace(effects2, ok2, nok) {
  const self2 = this;
  return factorySpace(effects2, afterPrefix, "listItemPrefixWhitespace", self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 + 1);
  function afterPrefix(code2) {
    const tail = self2.events[self2.events.length - 1];
    return !markdownSpace(code2) && tail && tail[1].type === "listItemPrefixWhitespace" ? ok2(code2) : nok(code2);
  }
}
const setextUnderline = {
  name: "setextUnderline",
  resolveTo: resolveToSetextUnderline,
  tokenize: tokenizeSetextUnderline
};
function resolveToSetextUnderline(events2, context) {
  let index2 = events2.length;
  let content2;
  let text2;
  let definition2;
  while (index2--) {
    if (events2[index2][0] === "enter") {
      if (events2[index2][1].type === "content") {
        content2 = index2;
        break;
      }
      if (events2[index2][1].type === "paragraph") {
        text2 = index2;
      }
    } else {
      if (events2[index2][1].type === "content") {
        events2.splice(index2, 1);
      }
      if (!definition2 && events2[index2][1].type === "definition") {
        definition2 = index2;
      }
    }
  }
  const heading2 = {
    type: "setextHeading",
    start: {
      ...events2[content2][1].start
    },
    end: {
      ...events2[events2.length - 1][1].end
    }
  };
  events2[text2][1].type = "setextHeadingText";
  if (definition2) {
    events2.splice(text2, 0, ["enter", heading2, context]);
    events2.splice(definition2 + 1, 0, ["exit", events2[content2][1], context]);
    events2[content2][1].end = {
      ...events2[definition2][1].end
    };
  } else {
    events2[content2][1] = heading2;
  }
  events2.push(["exit", heading2, context]);
  return events2;
}
function tokenizeSetextUnderline(effects2, ok2, nok) {
  const self2 = this;
  let marker;
  return start2;
  function start2(code2) {
    let index2 = self2.events.length;
    let paragraph2;
    while (index2--) {
      if (self2.events[index2][1].type !== "lineEnding" && self2.events[index2][1].type !== "linePrefix" && self2.events[index2][1].type !== "content") {
        paragraph2 = self2.events[index2][1].type === "paragraph";
        break;
      }
    }
    if (!self2.parser.lazy[self2.now().line] && (self2.interrupt || paragraph2)) {
      effects2.enter("setextHeadingLine");
      marker = code2;
      return before(code2);
    }
    return nok(code2);
  }
  function before(code2) {
    effects2.enter("setextHeadingLineSequence");
    return inside(code2);
  }
  function inside(code2) {
    if (code2 === marker) {
      effects2.consume(code2);
      return inside;
    }
    effects2.exit("setextHeadingLineSequence");
    return markdownSpace(code2) ? factorySpace(effects2, after, "lineSuffix")(code2) : after(code2);
  }
  function after(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      effects2.exit("setextHeadingLine");
      return ok2(code2);
    }
    return nok(code2);
  }
}
const flow$1 = {
  tokenize: initializeFlow
};
function initializeFlow(effects2) {
  const self2 = this;
  const initial = effects2.attempt(
    // Try to parse a blank line.
    blankLine,
    atBlankEnding,
    // Try to parse initial flow (essentially, only code).
    effects2.attempt(this.parser.constructs.flowInitial, afterConstruct, factorySpace(effects2, effects2.attempt(this.parser.constructs.flow, afterConstruct, effects2.attempt(content, afterConstruct)), "linePrefix"))
  );
  return initial;
  function atBlankEnding(code2) {
    if (code2 === null) {
      effects2.consume(code2);
      return;
    }
    effects2.enter("lineEndingBlank");
    effects2.consume(code2);
    effects2.exit("lineEndingBlank");
    self2.currentConstruct = void 0;
    return initial;
  }
  function afterConstruct(code2) {
    if (code2 === null) {
      effects2.consume(code2);
      return;
    }
    effects2.enter("lineEnding");
    effects2.consume(code2);
    effects2.exit("lineEnding");
    self2.currentConstruct = void 0;
    return initial;
  }
}
const resolver = {
  resolveAll: createResolver()
};
const string$1 = initializeFactory("string");
const text$2 = initializeFactory("text");
function initializeFactory(field) {
  return {
    resolveAll: createResolver(field === "text" ? resolveAllLineSuffixes : void 0),
    tokenize: initializeText
  };
  function initializeText(effects2) {
    const self2 = this;
    const constructs2 = this.parser.constructs[field];
    const text2 = effects2.attempt(constructs2, start2, notText);
    return start2;
    function start2(code2) {
      return atBreak(code2) ? text2(code2) : notText(code2);
    }
    function notText(code2) {
      if (code2 === null) {
        effects2.consume(code2);
        return;
      }
      effects2.enter("data");
      effects2.consume(code2);
      return data;
    }
    function data(code2) {
      if (atBreak(code2)) {
        effects2.exit("data");
        return text2(code2);
      }
      effects2.consume(code2);
      return data;
    }
    function atBreak(code2) {
      if (code2 === null) {
        return true;
      }
      const list2 = constructs2[code2];
      let index2 = -1;
      if (list2) {
        while (++index2 < list2.length) {
          const item = list2[index2];
          if (!item.previous || item.previous.call(self2, self2.previous)) {
            return true;
          }
        }
      }
      return false;
    }
  }
}
function createResolver(extraResolver) {
  return resolveAllText;
  function resolveAllText(events2, context) {
    let index2 = -1;
    let enter;
    while (++index2 <= events2.length) {
      if (enter === void 0) {
        if (events2[index2] && events2[index2][1].type === "data") {
          enter = index2;
          index2++;
        }
      } else if (!events2[index2] || events2[index2][1].type !== "data") {
        if (index2 !== enter + 2) {
          events2[enter][1].end = events2[index2 - 1][1].end;
          events2.splice(enter + 2, index2 - enter - 2);
          index2 = enter + 2;
        }
        enter = void 0;
      }
    }
    return extraResolver ? extraResolver(events2, context) : events2;
  }
}
function resolveAllLineSuffixes(events2, context) {
  let eventIndex = 0;
  while (++eventIndex <= events2.length) {
    if ((eventIndex === events2.length || events2[eventIndex][1].type === "lineEnding") && events2[eventIndex - 1][1].type === "data") {
      const data = events2[eventIndex - 1][1];
      const chunks = context.sliceStream(data);
      let index2 = chunks.length;
      let bufferIndex = -1;
      let size2 = 0;
      let tabs2;
      while (index2--) {
        const chunk = chunks[index2];
        if (typeof chunk === "string") {
          bufferIndex = chunk.length;
          while (chunk.charCodeAt(bufferIndex - 1) === 32) {
            size2++;
            bufferIndex--;
          }
          if (bufferIndex)
            break;
          bufferIndex = -1;
        } else if (chunk === -2) {
          tabs2 = true;
          size2++;
        } else if (chunk === -1)
          ;
        else {
          index2++;
          break;
        }
      }
      if (context._contentTypeTextTrailing && eventIndex === events2.length) {
        size2 = 0;
      }
      if (size2) {
        const token2 = {
          type: eventIndex === events2.length || tabs2 || size2 < 2 ? "lineSuffix" : "hardBreakTrailing",
          start: {
            _bufferIndex: index2 ? bufferIndex : data.start._bufferIndex + bufferIndex,
            _index: data.start._index + index2,
            line: data.end.line,
            column: data.end.column - size2,
            offset: data.end.offset - size2
          },
          end: {
            ...data.end
          }
        };
        data.end = {
          ...token2.start
        };
        if (data.start.offset === data.end.offset) {
          Object.assign(data, token2);
        } else {
          events2.splice(eventIndex, 0, ["enter", token2, context], ["exit", token2, context]);
          eventIndex += 2;
        }
      }
      eventIndex++;
    }
  }
  return events2;
}
const document$1 = {
  [42]: list$1,
  [43]: list$1,
  [45]: list$1,
  [48]: list$1,
  [49]: list$1,
  [50]: list$1,
  [51]: list$1,
  [52]: list$1,
  [53]: list$1,
  [54]: list$1,
  [55]: list$1,
  [56]: list$1,
  [57]: list$1,
  [62]: blockQuote
};
const contentInitial = {
  [91]: definition
};
const flowInitial = {
  [-2]: codeIndented,
  [-1]: codeIndented,
  [32]: codeIndented
};
const flow = {
  [35]: headingAtx,
  [42]: thematicBreak$1,
  [45]: [setextUnderline, thematicBreak$1],
  [60]: htmlFlow,
  [61]: setextUnderline,
  [95]: thematicBreak$1,
  [96]: codeFenced,
  [126]: codeFenced
};
const string2 = {
  [38]: characterReference,
  [92]: characterEscape
};
const text$1 = {
  [-5]: lineEnding,
  [-4]: lineEnding,
  [-3]: lineEnding,
  [33]: labelStartImage,
  [38]: characterReference,
  [42]: attention,
  [60]: [autolink, htmlText],
  [91]: labelStartLink,
  [92]: [hardBreakEscape, characterEscape],
  [93]: labelEnd,
  [95]: attention,
  [96]: codeText
};
const insideSpan = {
  null: [attention, resolver]
};
const attentionMarkers = {
  null: [42, 95]
};
const disable = {
  null: []
};
const defaultConstructs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  attentionMarkers,
  contentInitial,
  disable,
  document: document$1,
  flow,
  flowInitial,
  insideSpan,
  string: string2,
  text: text$1
}, Symbol.toStringTag, { value: "Module" }));
function createTokenizer(parser, initialize, from2) {
  let point2 = {
    _bufferIndex: -1,
    _index: 0,
    line: from2 && from2.line || 1,
    column: from2 && from2.column || 1,
    offset: from2 && from2.offset || 0
  };
  const columnStart = {};
  const resolveAllConstructs = [];
  let chunks = [];
  let stack = [];
  const effects2 = {
    attempt: constructFactory(onsuccessfulconstruct),
    check: constructFactory(onsuccessfulcheck),
    consume,
    enter,
    exit: exit2,
    interrupt: constructFactory(onsuccessfulcheck, {
      interrupt: true
    })
  };
  const context = {
    code: null,
    containerState: {},
    defineSkip,
    events: [],
    now: now2,
    parser,
    previous: null,
    sliceSerialize,
    sliceStream,
    write
  };
  let state = initialize.tokenize.call(context, effects2);
  if (initialize.resolveAll) {
    resolveAllConstructs.push(initialize);
  }
  return context;
  function write(slice2) {
    chunks = push(chunks, slice2);
    main2();
    if (chunks[chunks.length - 1] !== null) {
      return [];
    }
    addResult(initialize, 0);
    context.events = resolveAll(resolveAllConstructs, context.events, context);
    return context.events;
  }
  function sliceSerialize(token2, expandTabs) {
    return serializeChunks(sliceStream(token2), expandTabs);
  }
  function sliceStream(token2) {
    return sliceChunks(chunks, token2);
  }
  function now2() {
    const {
      _bufferIndex,
      _index,
      line: line2,
      column: column2,
      offset: offset2
    } = point2;
    return {
      _bufferIndex,
      _index,
      line: line2,
      column: column2,
      offset: offset2
    };
  }
  function defineSkip(value2) {
    columnStart[value2.line] = value2.column;
    accountForPotentialSkip();
  }
  function main2() {
    let chunkIndex;
    while (point2._index < chunks.length) {
      const chunk = chunks[point2._index];
      if (typeof chunk === "string") {
        chunkIndex = point2._index;
        if (point2._bufferIndex < 0) {
          point2._bufferIndex = 0;
        }
        while (point2._index === chunkIndex && point2._bufferIndex < chunk.length) {
          go(chunk.charCodeAt(point2._bufferIndex));
        }
      } else {
        go(chunk);
      }
    }
  }
  function go(code2) {
    state = state(code2);
  }
  function consume(code2) {
    if (markdownLineEnding(code2)) {
      point2.line++;
      point2.column = 1;
      point2.offset += code2 === -3 ? 2 : 1;
      accountForPotentialSkip();
    } else if (code2 !== -1) {
      point2.column++;
      point2.offset++;
    }
    if (point2._bufferIndex < 0) {
      point2._index++;
    } else {
      point2._bufferIndex++;
      if (point2._bufferIndex === // Points w/ non-negative `_bufferIndex` reference
      // strings.
      /** @type {string} */
      chunks[point2._index].length) {
        point2._bufferIndex = -1;
        point2._index++;
      }
    }
    context.previous = code2;
  }
  function enter(type4, fields) {
    const token2 = fields || {};
    token2.type = type4;
    token2.start = now2();
    context.events.push(["enter", token2, context]);
    stack.push(token2);
    return token2;
  }
  function exit2(type4) {
    const token2 = stack.pop();
    token2.end = now2();
    context.events.push(["exit", token2, context]);
    return token2;
  }
  function onsuccessfulconstruct(construct, info2) {
    addResult(construct, info2.from);
  }
  function onsuccessfulcheck(_24, info2) {
    info2.restore();
  }
  function constructFactory(onreturn, fields) {
    return hook;
    function hook(constructs2, returnState, bogusState) {
      let listOfConstructs;
      let constructIndex;
      let currentConstruct;
      let info2;
      return Array.isArray(constructs2) ? (
        /* c8 ignore next 1 */
        handleListOfConstructs(constructs2)
      ) : "tokenize" in constructs2 ? (
        // Looks like a construct.
        handleListOfConstructs([
          /** @type {Construct} */
          constructs2
        ])
      ) : handleMapOfConstructs(constructs2);
      function handleMapOfConstructs(map2) {
        return start2;
        function start2(code2) {
          const left2 = code2 !== null && map2[code2];
          const all3 = code2 !== null && map2.null;
          const list2 = [
            // To do: add more extension tests.
            /* c8 ignore next 2 */
            ...Array.isArray(left2) ? left2 : left2 ? [left2] : [],
            ...Array.isArray(all3) ? all3 : all3 ? [all3] : []
          ];
          return handleListOfConstructs(list2)(code2);
        }
      }
      function handleListOfConstructs(list2) {
        listOfConstructs = list2;
        constructIndex = 0;
        if (list2.length === 0) {
          return bogusState;
        }
        return handleConstruct(list2[constructIndex]);
      }
      function handleConstruct(construct) {
        return start2;
        function start2(code2) {
          info2 = store();
          currentConstruct = construct;
          if (!construct.partial) {
            context.currentConstruct = construct;
          }
          if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) {
            return nok();
          }
          return construct.tokenize.call(
            // If we do have fields, create an object w/ `context` as its
            // prototype.
            // This allows a “live binding”, which is needed for `interrupt`.
            fields ? Object.assign(Object.create(context), fields) : context,
            effects2,
            ok2,
            nok
          )(code2);
        }
      }
      function ok2(code2) {
        onreturn(currentConstruct, info2);
        return returnState;
      }
      function nok(code2) {
        info2.restore();
        if (++constructIndex < listOfConstructs.length) {
          return handleConstruct(listOfConstructs[constructIndex]);
        }
        return bogusState;
      }
    }
  }
  function addResult(construct, from3) {
    if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {
      resolveAllConstructs.push(construct);
    }
    if (construct.resolve) {
      splice(context.events, from3, context.events.length - from3, construct.resolve(context.events.slice(from3), context));
    }
    if (construct.resolveTo) {
      context.events = construct.resolveTo(context.events, context);
    }
  }
  function store() {
    const startPoint = now2();
    const startPrevious = context.previous;
    const startCurrentConstruct = context.currentConstruct;
    const startEventsIndex = context.events.length;
    const startStack = Array.from(stack);
    return {
      from: startEventsIndex,
      restore
    };
    function restore() {
      point2 = startPoint;
      context.previous = startPrevious;
      context.currentConstruct = startCurrentConstruct;
      context.events.length = startEventsIndex;
      stack = startStack;
      accountForPotentialSkip();
    }
  }
  function accountForPotentialSkip() {
    if (point2.line in columnStart && point2.column < 2) {
      point2.column = columnStart[point2.line];
      point2.offset += columnStart[point2.line] - 1;
    }
  }
}
function sliceChunks(chunks, token2) {
  const startIndex = token2.start._index;
  const startBufferIndex = token2.start._bufferIndex;
  const endIndex = token2.end._index;
  const endBufferIndex = token2.end._bufferIndex;
  let view;
  if (startIndex === endIndex) {
    view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)];
  } else {
    view = chunks.slice(startIndex, endIndex);
    if (startBufferIndex > -1) {
      const head = view[0];
      if (typeof head === "string") {
        view[0] = head.slice(startBufferIndex);
      } else {
        view.shift();
      }
    }
    if (endBufferIndex > 0) {
      view.push(chunks[endIndex].slice(0, endBufferIndex));
    }
  }
  return view;
}
function serializeChunks(chunks, expandTabs) {
  let index2 = -1;
  const result = [];
  let atTab;
  while (++index2 < chunks.length) {
    const chunk = chunks[index2];
    let value2;
    if (typeof chunk === "string") {
      value2 = chunk;
    } else
      switch (chunk) {
        case -5: {
          value2 = "\r";
          break;
        }
        case -4: {
          value2 = "\n";
          break;
        }
        case -3: {
          value2 = "\r\n";
          break;
        }
        case -2: {
          value2 = expandTabs ? " " : "	";
          break;
        }
        case -1: {
          if (!expandTabs && atTab)
            continue;
          value2 = " ";
          break;
        }
        default: {
          value2 = String.fromCharCode(chunk);
        }
      }
    atTab = chunk === -2;
    result.push(value2);
  }
  return result.join("");
}
function parse(options) {
  const settings = options || {};
  const constructs2 = (
    /** @type {FullNormalizedExtension} */
    combineExtensions([defaultConstructs, ...settings.extensions || []])
  );
  const parser = {
    constructs: constructs2,
    content: create2(content$1),
    defined: [],
    document: create2(document$2),
    flow: create2(flow$1),
    lazy: {},
    string: create2(string$1),
    text: create2(text$2)
  };
  return parser;
  function create2(initial) {
    return creator;
    function creator(from2) {
      return createTokenizer(parser, initial, from2);
    }
  }
}
function postprocess(events2) {
  while (!subtokenize(events2)) {
  }
  return events2;
}
const search = /[\0\t\n\r]/g;
function preprocess() {
  let column2 = 1;
  let buffer = "";
  let start2 = true;
  let atCarriageReturn;
  return preprocessor;
  function preprocessor(value2, encoding, end2) {
    const chunks = [];
    let match5;
    let next2;
    let startPosition;
    let endPosition;
    let code2;
    value2 = buffer + (typeof value2 === "string" ? value2.toString() : new TextDecoder(encoding || void 0).decode(value2));
    startPosition = 0;
    buffer = "";
    if (start2) {
      if (value2.charCodeAt(0) === 65279) {
        startPosition++;
      }
      start2 = void 0;
    }
    while (startPosition < value2.length) {
      search.lastIndex = startPosition;
      match5 = search.exec(value2);
      endPosition = match5 && match5.index !== void 0 ? match5.index : value2.length;
      code2 = value2.charCodeAt(endPosition);
      if (!match5) {
        buffer = value2.slice(startPosition);
        break;
      }
      if (code2 === 10 && startPosition === endPosition && atCarriageReturn) {
        chunks.push(-3);
        atCarriageReturn = void 0;
      } else {
        if (atCarriageReturn) {
          chunks.push(-5);
          atCarriageReturn = void 0;
        }
        if (startPosition < endPosition) {
          chunks.push(value2.slice(startPosition, endPosition));
          column2 += endPosition - startPosition;
        }
        switch (code2) {
          case 0: {
            chunks.push(65533);
            column2++;
            break;
          }
          case 9: {
            next2 = Math.ceil(column2 / 4) * 4;
            chunks.push(-2);
            while (column2++ < next2)
              chunks.push(-1);
            break;
          }
          case 10: {
            chunks.push(-4);
            column2 = 1;
            break;
          }
          default: {
            atCarriageReturn = true;
            column2 = 1;
          }
        }
      }
      startPosition = endPosition + 1;
    }
    if (end2) {
      if (atCarriageReturn)
        chunks.push(-5);
      if (buffer)
        chunks.push(buffer);
      chunks.push(null);
    }
    return chunks;
  }
}
const characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
function decodeString(value2) {
  return value2.replace(characterEscapeOrReference, decode);
}
function decode($0, $1, $2) {
  if ($1) {
    return $1;
  }
  const head = $2.charCodeAt(0);
  if (head === 35) {
    const head2 = $2.charCodeAt(1);
    const hex3 = head2 === 120 || head2 === 88;
    return decodeNumericCharacterReference($2.slice(hex3 ? 2 : 1), hex3 ? 16 : 10);
  }
  return decodeNamedCharacterReference($2) || $0;
}
const own$2 = {}.hasOwnProperty;
function fromMarkdown(value2, encoding, options) {
  if (typeof encoding !== "string") {
    options = encoding;
    encoding = void 0;
  }
  return compiler(options)(postprocess(parse(options).document().write(preprocess()(value2, encoding, true))));
}
function compiler(options) {
  const config2 = {
    transforms: [],
    canContainEols: ["emphasis", "fragment", "heading", "paragraph", "strong"],
    enter: {
      autolink: opener(link2),
      autolinkProtocol: onenterdata,
      autolinkEmail: onenterdata,
      atxHeading: opener(heading2),
      blockQuote: opener(blockQuote2),
      characterEscape: onenterdata,
      characterReference: onenterdata,
      codeFenced: opener(codeFlow),
      codeFencedFenceInfo: buffer,
      codeFencedFenceMeta: buffer,
      codeIndented: opener(codeFlow, buffer),
      codeText: opener(codeText2, buffer),
      codeTextData: onenterdata,
      data: onenterdata,
      codeFlowValue: onenterdata,
      definition: opener(definition2),
      definitionDestinationString: buffer,
      definitionLabelString: buffer,
      definitionTitleString: buffer,
      emphasis: opener(emphasis2),
      hardBreakEscape: opener(hardBreak2),
      hardBreakTrailing: opener(hardBreak2),
      htmlFlow: opener(html2, buffer),
      htmlFlowData: onenterdata,
      htmlText: opener(html2, buffer),
      htmlTextData: onenterdata,
      image: opener(image2),
      label: buffer,
      link: opener(link2),
      listItem: opener(listItem2),
      listItemValue: onenterlistitemvalue,
      listOrdered: opener(list2, onenterlistordered),
      listUnordered: opener(list2),
      paragraph: opener(paragraph2),
      reference: onenterreference,
      referenceString: buffer,
      resourceDestinationString: buffer,
      resourceTitleString: buffer,
      setextHeading: opener(heading2),
      strong: opener(strong2),
      thematicBreak: opener(thematicBreak2)
    },
    exit: {
      atxHeading: closer(),
      atxHeadingSequence: onexitatxheadingsequence,
      autolink: closer(),
      autolinkEmail: onexitautolinkemail,
      autolinkProtocol: onexitautolinkprotocol,
      blockQuote: closer(),
      characterEscapeValue: onexitdata,
      characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,
      characterReferenceMarkerNumeric: onexitcharacterreferencemarker,
      characterReferenceValue: onexitcharacterreferencevalue,
      characterReference: onexitcharacterreference,
      codeFenced: closer(onexitcodefenced),
      codeFencedFence: onexitcodefencedfence,
      codeFencedFenceInfo: onexitcodefencedfenceinfo,
      codeFencedFenceMeta: onexitcodefencedfencemeta,
      codeFlowValue: onexitdata,
      codeIndented: closer(onexitcodeindented),
      codeText: closer(onexitcodetext),
      codeTextData: onexitdata,
      data: onexitdata,
      definition: closer(),
      definitionDestinationString: onexitdefinitiondestinationstring,
      definitionLabelString: onexitdefinitionlabelstring,
      definitionTitleString: onexitdefinitiontitlestring,
      emphasis: closer(),
      hardBreakEscape: closer(onexithardbreak),
      hardBreakTrailing: closer(onexithardbreak),
      htmlFlow: closer(onexithtmlflow),
      htmlFlowData: onexitdata,
      htmlText: closer(onexithtmltext),
      htmlTextData: onexitdata,
      image: closer(onexitimage),
      label: onexitlabel,
      labelText: onexitlabeltext,
      lineEnding: onexitlineending,
      link: closer(onexitlink),
      listItem: closer(),
      listOrdered: closer(),
      listUnordered: closer(),
      paragraph: closer(),
      referenceString: onexitreferencestring,
      resourceDestinationString: onexitresourcedestinationstring,
      resourceTitleString: onexitresourcetitlestring,
      resource: onexitresource,
      setextHeading: closer(onexitsetextheading),
      setextHeadingLineSequence: onexitsetextheadinglinesequence,
      setextHeadingText: onexitsetextheadingtext,
      strong: closer(),
      thematicBreak: closer()
    }
  };
  configure(config2, (options || {}).mdastExtensions || []);
  const data = {};
  return compile2;
  function compile2(events2) {
    let tree = {
      type: "root",
      children: []
    };
    const context = {
      stack: [tree],
      tokenStack: [],
      config: config2,
      enter,
      exit: exit2,
      buffer,
      resume,
      data
    };
    const listStack = [];
    let index2 = -1;
    while (++index2 < events2.length) {
      if (events2[index2][1].type === "listOrdered" || events2[index2][1].type === "listUnordered") {
        if (events2[index2][0] === "enter") {
          listStack.push(index2);
        } else {
          const tail = listStack.pop();
          index2 = prepareList(events2, tail, index2);
        }
      }
    }
    index2 = -1;
    while (++index2 < events2.length) {
      const handler = config2[events2[index2][0]];
      if (own$2.call(handler, events2[index2][1].type)) {
        handler[events2[index2][1].type].call(Object.assign({
          sliceSerialize: events2[index2][2].sliceSerialize
        }, context), events2[index2][1]);
      }
    }
    if (context.tokenStack.length > 0) {
      const tail = context.tokenStack[context.tokenStack.length - 1];
      const handler = tail[1] || defaultOnError;
      handler.call(context, void 0, tail[0]);
    }
    tree.position = {
      start: point(events2.length > 0 ? events2[0][1].start : {
        line: 1,
        column: 1,
        offset: 0
      }),
      end: point(events2.length > 0 ? events2[events2.length - 2][1].end : {
        line: 1,
        column: 1,
        offset: 0
      })
    };
    index2 = -1;
    while (++index2 < config2.transforms.length) {
      tree = config2.transforms[index2](tree) || tree;
    }
    return tree;
  }
  function prepareList(events2, start2, length2) {
    let index2 = start2 - 1;
    let containerBalance = -1;
    let listSpread = false;
    let listItem3;
    let lineIndex;
    let firstBlankLineIndex;
    let atMarker;
    while (++index2 <= length2) {
      const event = events2[index2];
      switch (event[1].type) {
        case "listUnordered":
        case "listOrdered":
        case "blockQuote": {
          if (event[0] === "enter") {
            containerBalance++;
          } else {
            containerBalance--;
          }
          atMarker = void 0;
          break;
        }
        case "lineEndingBlank": {
          if (event[0] === "enter") {
            if (listItem3 && !atMarker && !containerBalance && !firstBlankLineIndex) {
              firstBlankLineIndex = index2;
            }
            atMarker = void 0;
          }
          break;
        }
        case "linePrefix":
        case "listItemValue":
        case "listItemMarker":
        case "listItemPrefix":
        case "listItemPrefixWhitespace": {
          break;
        }
        default: {
          atMarker = void 0;
        }
      }
      if (!containerBalance && event[0] === "enter" && event[1].type === "listItemPrefix" || containerBalance === -1 && event[0] === "exit" && (event[1].type === "listUnordered" || event[1].type === "listOrdered")) {
        if (listItem3) {
          let tailIndex = index2;
          lineIndex = void 0;
          while (tailIndex--) {
            const tailEvent = events2[tailIndex];
            if (tailEvent[1].type === "lineEnding" || tailEvent[1].type === "lineEndingBlank") {
              if (tailEvent[0] === "exit")
                continue;
              if (lineIndex) {
                events2[lineIndex][1].type = "lineEndingBlank";
                listSpread = true;
              }
              tailEvent[1].type = "lineEnding";
              lineIndex = tailIndex;
            } else if (tailEvent[1].type === "linePrefix" || tailEvent[1].type === "blockQuotePrefix" || tailEvent[1].type === "blockQuotePrefixWhitespace" || tailEvent[1].type === "blockQuoteMarker" || tailEvent[1].type === "listItemIndent")
              ;
            else {
              break;
            }
          }
          if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) {
            listItem3._spread = true;
          }
          listItem3.end = Object.assign({}, lineIndex ? events2[lineIndex][1].start : event[1].end);
          events2.splice(lineIndex || index2, 0, ["exit", listItem3, event[2]]);
          index2++;
          length2++;
        }
        if (event[1].type === "listItemPrefix") {
          const item = {
            type: "listItem",
            _spread: false,
            start: Object.assign({}, event[1].start),
            // @ts-expect-error: we’ll add `end` in a second.
            end: void 0
          };
          listItem3 = item;
          events2.splice(index2, 0, ["enter", item, event[2]]);
          index2++;
          length2++;
          firstBlankLineIndex = void 0;
          atMarker = true;
        }
      }
    }
    events2[start2][1]._spread = listSpread;
    return length2;
  }
  function opener(create2, and) {
    return open;
    function open(token2) {
      enter.call(this, create2(token2), token2);
      if (and)
        and.call(this, token2);
    }
  }
  function buffer() {
    this.stack.push({
      type: "fragment",
      children: []
    });
  }
  function enter(node2, token2, errorHandler) {
    const parent = this.stack[this.stack.length - 1];
    const siblings = parent.children;
    siblings.push(node2);
    this.stack.push(node2);
    this.tokenStack.push([token2, errorHandler || void 0]);
    node2.position = {
      start: point(token2.start),
      // @ts-expect-error: `end` will be patched later.
      end: void 0
    };
  }
  function closer(and) {
    return close;
    function close(token2) {
      if (and)
        and.call(this, token2);
      exit2.call(this, token2);
    }
  }
  function exit2(token2, onExitError) {
    const node2 = this.stack.pop();
    const open = this.tokenStack.pop();
    if (!open) {
      throw new Error("Cannot close `" + token2.type + "` (" + stringifyPosition({
        start: token2.start,
        end: token2.end
      }) + "): it’s not open");
    } else if (open[0].type !== token2.type) {
      if (onExitError) {
        onExitError.call(this, token2, open[0]);
      } else {
        const handler = open[1] || defaultOnError;
        handler.call(this, token2, open[0]);
      }
    }
    node2.position.end = point(token2.end);
  }
  function resume() {
    return toString$1(this.stack.pop());
  }
  function onenterlistordered() {
    this.data.expectingFirstListItemValue = true;
  }
  function onenterlistitemvalue(token2) {
    if (this.data.expectingFirstListItemValue) {
      const ancestor = this.stack[this.stack.length - 2];
      ancestor.start = Number.parseInt(this.sliceSerialize(token2), 10);
      this.data.expectingFirstListItemValue = void 0;
    }
  }
  function onexitcodefencedfenceinfo() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.lang = data2;
  }
  function onexitcodefencedfencemeta() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.meta = data2;
  }
  function onexitcodefencedfence() {
    if (this.data.flowCodeInside)
      return;
    this.buffer();
    this.data.flowCodeInside = true;
  }
  function onexitcodefenced() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.value = data2.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, "");
    this.data.flowCodeInside = void 0;
  }
  function onexitcodeindented() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.value = data2.replace(/(\r?\n|\r)$/g, "");
  }
  function onexitdefinitionlabelstring(token2) {
    const label = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.label = label;
    node2.identifier = normalizeIdentifier(this.sliceSerialize(token2)).toLowerCase();
  }
  function onexitdefinitiontitlestring() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.title = data2;
  }
  function onexitdefinitiondestinationstring() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.url = data2;
  }
  function onexitatxheadingsequence(token2) {
    const node2 = this.stack[this.stack.length - 1];
    if (!node2.depth) {
      const depth = this.sliceSerialize(token2).length;
      node2.depth = depth;
    }
  }
  function onexitsetextheadingtext() {
    this.data.setextHeadingSlurpLineEnding = true;
  }
  function onexitsetextheadinglinesequence(token2) {
    const node2 = this.stack[this.stack.length - 1];
    node2.depth = this.sliceSerialize(token2).codePointAt(0) === 61 ? 1 : 2;
  }
  function onexitsetextheading() {
    this.data.setextHeadingSlurpLineEnding = void 0;
  }
  function onenterdata(token2) {
    const node2 = this.stack[this.stack.length - 1];
    const siblings = node2.children;
    let tail = siblings[siblings.length - 1];
    if (!tail || tail.type !== "text") {
      tail = text2();
      tail.position = {
        start: point(token2.start),
        // @ts-expect-error: we’ll add `end` later.
        end: void 0
      };
      siblings.push(tail);
    }
    this.stack.push(tail);
  }
  function onexitdata(token2) {
    const tail = this.stack.pop();
    tail.value += this.sliceSerialize(token2);
    tail.position.end = point(token2.end);
  }
  function onexitlineending(token2) {
    const context = this.stack[this.stack.length - 1];
    if (this.data.atHardBreak) {
      const tail = context.children[context.children.length - 1];
      tail.position.end = point(token2.end);
      this.data.atHardBreak = void 0;
      return;
    }
    if (!this.data.setextHeadingSlurpLineEnding && config2.canContainEols.includes(context.type)) {
      onenterdata.call(this, token2);
      onexitdata.call(this, token2);
    }
  }
  function onexithardbreak() {
    this.data.atHardBreak = true;
  }
  function onexithtmlflow() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.value = data2;
  }
  function onexithtmltext() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.value = data2;
  }
  function onexitcodetext() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.value = data2;
  }
  function onexitlink() {
    const node2 = this.stack[this.stack.length - 1];
    if (this.data.inReference) {
      const referenceType = this.data.referenceType || "shortcut";
      node2.type += "Reference";
      node2.referenceType = referenceType;
      delete node2.url;
      delete node2.title;
    } else {
      delete node2.identifier;
      delete node2.label;
    }
    this.data.referenceType = void 0;
  }
  function onexitimage() {
    const node2 = this.stack[this.stack.length - 1];
    if (this.data.inReference) {
      const referenceType = this.data.referenceType || "shortcut";
      node2.type += "Reference";
      node2.referenceType = referenceType;
      delete node2.url;
      delete node2.title;
    } else {
      delete node2.identifier;
      delete node2.label;
    }
    this.data.referenceType = void 0;
  }
  function onexitlabeltext(token2) {
    const string3 = this.sliceSerialize(token2);
    const ancestor = this.stack[this.stack.length - 2];
    ancestor.label = decodeString(string3);
    ancestor.identifier = normalizeIdentifier(string3).toLowerCase();
  }
  function onexitlabel() {
    const fragment = this.stack[this.stack.length - 1];
    const value2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    this.data.inReference = true;
    if (node2.type === "link") {
      const children = fragment.children;
      node2.children = children;
    } else {
      node2.alt = value2;
    }
  }
  function onexitresourcedestinationstring() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.url = data2;
  }
  function onexitresourcetitlestring() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.title = data2;
  }
  function onexitresource() {
    this.data.inReference = void 0;
  }
  function onenterreference() {
    this.data.referenceType = "collapsed";
  }
  function onexitreferencestring(token2) {
    const label = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.label = label;
    node2.identifier = normalizeIdentifier(this.sliceSerialize(token2)).toLowerCase();
    this.data.referenceType = "full";
  }
  function onexitcharacterreferencemarker(token2) {
    this.data.characterReferenceType = token2.type;
  }
  function onexitcharacterreferencevalue(token2) {
    const data2 = this.sliceSerialize(token2);
    const type4 = this.data.characterReferenceType;
    let value2;
    if (type4) {
      value2 = decodeNumericCharacterReference(data2, type4 === "characterReferenceMarkerNumeric" ? 10 : 16);
      this.data.characterReferenceType = void 0;
    } else {
      const result = decodeNamedCharacterReference(data2);
      value2 = result;
    }
    const tail = this.stack[this.stack.length - 1];
    tail.value += value2;
  }
  function onexitcharacterreference(token2) {
    const tail = this.stack.pop();
    tail.position.end = point(token2.end);
  }
  function onexitautolinkprotocol(token2) {
    onexitdata.call(this, token2);
    const node2 = this.stack[this.stack.length - 1];
    node2.url = this.sliceSerialize(token2);
  }
  function onexitautolinkemail(token2) {
    onexitdata.call(this, token2);
    const node2 = this.stack[this.stack.length - 1];
    node2.url = "mailto:" + this.sliceSerialize(token2);
  }
  function blockQuote2() {
    return {
      type: "blockquote",
      children: []
    };
  }
  function codeFlow() {
    return {
      type: "code",
      lang: null,
      meta: null,
      value: ""
    };
  }
  function codeText2() {
    return {
      type: "inlineCode",
      value: ""
    };
  }
  function definition2() {
    return {
      type: "definition",
      identifier: "",
      label: null,
      title: null,
      url: ""
    };
  }
  function emphasis2() {
    return {
      type: "emphasis",
      children: []
    };
  }
  function heading2() {
    return {
      type: "heading",
      // @ts-expect-error `depth` will be set later.
      depth: 0,
      children: []
    };
  }
  function hardBreak2() {
    return {
      type: "break"
    };
  }
  function html2() {
    return {
      type: "html",
      value: ""
    };
  }
  function image2() {
    return {
      type: "image",
      title: null,
      url: "",
      alt: null
    };
  }
  function link2() {
    return {
      type: "link",
      title: null,
      url: "",
      children: []
    };
  }
  function list2(token2) {
    return {
      type: "list",
      ordered: token2.type === "listOrdered",
      start: null,
      spread: token2._spread,
      children: []
    };
  }
  function listItem2(token2) {
    return {
      type: "listItem",
      spread: token2._spread,
      checked: null,
      children: []
    };
  }
  function paragraph2() {
    return {
      type: "paragraph",
      children: []
    };
  }
  function strong2() {
    return {
      type: "strong",
      children: []
    };
  }
  function text2() {
    return {
      type: "text",
      value: ""
    };
  }
  function thematicBreak2() {
    return {
      type: "thematicBreak"
    };
  }
}
function point(d2) {
  return {
    line: d2.line,
    column: d2.column,
    offset: d2.offset
  };
}
function configure(combined, extensions2) {
  let index2 = -1;
  while (++index2 < extensions2.length) {
    const value2 = extensions2[index2];
    if (Array.isArray(value2)) {
      configure(combined, value2);
    } else {
      extension(combined, value2);
    }
  }
}
function extension(combined, extension2) {
  let key;
  for (key in extension2) {
    if (own$2.call(extension2, key)) {
      switch (key) {
        case "canContainEols": {
          const right = extension2[key];
          if (right) {
            combined[key].push(...right);
          }
          break;
        }
        case "transforms": {
          const right = extension2[key];
          if (right) {
            combined[key].push(...right);
          }
          break;
        }
        case "enter":
        case "exit": {
          const right = extension2[key];
          if (right) {
            Object.assign(combined[key], right);
          }
          break;
        }
      }
    }
  }
}
function defaultOnError(left2, right) {
  if (left2) {
    throw new Error("Cannot close `" + left2.type + "` (" + stringifyPosition({
      start: left2.start,
      end: left2.end
    }) + "): a different token (`" + right.type + "`, " + stringifyPosition({
      start: right.start,
      end: right.end
    }) + ") is open");
  } else {
    throw new Error("Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({
      start: right.start,
      end: right.end
    }) + ") is still open");
  }
}
function remarkParse(options) {
  const self2 = this;
  self2.parser = parser;
  function parser(doc) {
    return fromMarkdown(doc, {
      ...self2.data("settings"),
      ...options,
      // Note: these options are not in the readme.
      // The goal is for them to be set by plugins on `data` instead of being
      // passed by users.
      extensions: self2.data("micromarkExtensions") || [],
      mdastExtensions: self2.data("fromMarkdownExtensions") || []
    });
  }
}
function blockquote(state, node2) {
  const result = {
    type: "element",
    tagName: "blockquote",
    properties: {},
    children: state.wrap(state.all(node2), true)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function hardBreak(state, node2) {
  const result = { type: "element", tagName: "br", properties: {}, children: [] };
  state.patch(node2, result);
  return [state.applyData(node2, result), { type: "text", value: "\n" }];
}
function code(state, node2) {
  const value2 = node2.value ? node2.value + "\n" : "";
  const properties2 = {};
  if (node2.lang) {
    properties2.className = ["language-" + node2.lang];
  }
  let result = {
    type: "element",
    tagName: "code",
    properties: properties2,
    children: [{ type: "text", value: value2 }]
  };
  if (node2.meta) {
    result.data = { meta: node2.meta };
  }
  state.patch(node2, result);
  result = state.applyData(node2, result);
  result = { type: "element", tagName: "pre", properties: {}, children: [result] };
  state.patch(node2, result);
  return result;
}
function strikethrough(state, node2) {
  const result = {
    type: "element",
    tagName: "del",
    properties: {},
    children: state.all(node2)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function emphasis(state, node2) {
  const result = {
    type: "element",
    tagName: "em",
    properties: {},
    children: state.all(node2)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function footnoteReference(state, node2) {
  const clobberPrefix = typeof state.options.clobberPrefix === "string" ? state.options.clobberPrefix : "user-content-";
  const id2 = String(node2.identifier).toUpperCase();
  const safeId = normalizeUri(id2.toLowerCase());
  const index2 = state.footnoteOrder.indexOf(id2);
  let counter;
  let reuseCounter = state.footnoteCounts.get(id2);
  if (reuseCounter === void 0) {
    reuseCounter = 0;
    state.footnoteOrder.push(id2);
    counter = state.footnoteOrder.length;
  } else {
    counter = index2 + 1;
  }
  reuseCounter += 1;
  state.footnoteCounts.set(id2, reuseCounter);
  const link2 = {
    type: "element",
    tagName: "a",
    properties: {
      href: "#" + clobberPrefix + "fn-" + safeId,
      id: clobberPrefix + "fnref-" + safeId + (reuseCounter > 1 ? "-" + reuseCounter : ""),
      dataFootnoteRef: true,
      ariaDescribedBy: ["footnote-label"]
    },
    children: [{ type: "text", value: String(counter) }]
  };
  state.patch(node2, link2);
  const sup = {
    type: "element",
    tagName: "sup",
    properties: {},
    children: [link2]
  };
  state.patch(node2, sup);
  return state.applyData(node2, sup);
}
function heading(state, node2) {
  const result = {
    type: "element",
    tagName: "h" + node2.depth,
    properties: {},
    children: state.all(node2)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function html(state, node2) {
  if (state.options.allowDangerousHtml) {
    const result = { type: "raw", value: node2.value };
    state.patch(node2, result);
    return state.applyData(node2, result);
  }
  return void 0;
}
function revert(state, node2) {
  const subtype = node2.referenceType;
  let suffix = "]";
  if (subtype === "collapsed") {
    suffix += "[]";
  } else if (subtype === "full") {
    suffix += "[" + (node2.label || node2.identifier) + "]";
  }
  if (node2.type === "imageReference") {
    return [{ type: "text", value: "![" + node2.alt + suffix }];
  }
  const contents = state.all(node2);
  const head = contents[0];
  if (head && head.type === "text") {
    head.value = "[" + head.value;
  } else {
    contents.unshift({ type: "text", value: "[" });
  }
  const tail = contents[contents.length - 1];
  if (tail && tail.type === "text") {
    tail.value += suffix;
  } else {
    contents.push({ type: "text", value: suffix });
  }
  return contents;
}
function imageReference(state, node2) {
  const id2 = String(node2.identifier).toUpperCase();
  const definition2 = state.definitionById.get(id2);
  if (!definition2) {
    return revert(state, node2);
  }
  const properties2 = { src: normalizeUri(definition2.url || ""), alt: node2.alt };
  if (definition2.title !== null && definition2.title !== void 0) {
    properties2.title = definition2.title;
  }
  const result = { type: "element", tagName: "img", properties: properties2, children: [] };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function image(state, node2) {
  const properties2 = { src: normalizeUri(node2.url) };
  if (node2.alt !== null && node2.alt !== void 0) {
    properties2.alt = node2.alt;
  }
  if (node2.title !== null && node2.title !== void 0) {
    properties2.title = node2.title;
  }
  const result = { type: "element", tagName: "img", properties: properties2, children: [] };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function inlineCode(state, node2) {
  const text2 = { type: "text", value: node2.value.replace(/\r?\n|\r/g, " ") };
  state.patch(node2, text2);
  const result = {
    type: "element",
    tagName: "code",
    properties: {},
    children: [text2]
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function linkReference(state, node2) {
  const id2 = String(node2.identifier).toUpperCase();
  const definition2 = state.definitionById.get(id2);
  if (!definition2) {
    return revert(state, node2);
  }
  const properties2 = { href: normalizeUri(definition2.url || "") };
  if (definition2.title !== null && definition2.title !== void 0) {
    properties2.title = definition2.title;
  }
  const result = {
    type: "element",
    tagName: "a",
    properties: properties2,
    children: state.all(node2)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function link(state, node2) {
  const properties2 = { href: normalizeUri(node2.url) };
  if (node2.title !== null && node2.title !== void 0) {
    properties2.title = node2.title;
  }
  const result = {
    type: "element",
    tagName: "a",
    properties: properties2,
    children: state.all(node2)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function listItem(state, node2, parent) {
  const results = state.all(node2);
  const loose = parent ? listLoose(parent) : listItemLoose(node2);
  const properties2 = {};
  const children = [];
  if (typeof node2.checked === "boolean") {
    const head = results[0];
    let paragraph2;
    if (head && head.type === "element" && head.tagName === "p") {
      paragraph2 = head;
    } else {
      paragraph2 = { type: "element", tagName: "p", properties: {}, children: [] };
      results.unshift(paragraph2);
    }
    if (paragraph2.children.length > 0) {
      paragraph2.children.unshift({ type: "text", value: " " });
    }
    paragraph2.children.unshift({
      type: "element",
      tagName: "input",
      properties: { type: "checkbox", checked: node2.checked, disabled: true },
      children: []
    });
    properties2.className = ["task-list-item"];
  }
  let index2 = -1;
  while (++index2 < results.length) {
    const child = results[index2];
    if (loose || index2 !== 0 || child.type !== "element" || child.tagName !== "p") {
      children.push({ type: "text", value: "\n" });
    }
    if (child.type === "element" && child.tagName === "p" && !loose) {
      children.push(...child.children);
    } else {
      children.push(child);
    }
  }
  const tail = results[results.length - 1];
  if (tail && (loose || tail.type !== "element" || tail.tagName !== "p")) {
    children.push({ type: "text", value: "\n" });
  }
  const result = { type: "element", tagName: "li", properties: properties2, children };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function listLoose(node2) {
  let loose = false;
  if (node2.type === "list") {
    loose = node2.spread || false;
    const children = node2.children;
    let index2 = -1;
    while (!loose && ++index2 < children.length) {
      loose = listItemLoose(children[index2]);
    }
  }
  return loose;
}
function listItemLoose(node2) {
  const spread2 = node2.spread;
  return spread2 === null || spread2 === void 0 ? node2.children.length > 1 : spread2;
}
function list(state, node2) {
  const properties2 = {};
  const results = state.all(node2);
  let index2 = -1;
  if (typeof node2.start === "number" && node2.start !== 1) {
    properties2.start = node2.start;
  }
  while (++index2 < results.length) {
    const child = results[index2];
    if (child.type === "element" && child.tagName === "li" && child.properties && Array.isArray(child.properties.className) && child.properties.className.includes("task-list-item")) {
      properties2.className = ["contains-task-list"];
      break;
    }
  }
  const result = {
    type: "element",
    tagName: node2.ordered ? "ol" : "ul",
    properties: properties2,
    children: state.wrap(results, true)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function paragraph(state, node2) {
  const result = {
    type: "element",
    tagName: "p",
    properties: {},
    children: state.all(node2)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function root(state, node2) {
  const result = { type: "root", children: state.wrap(state.all(node2)) };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function strong(state, node2) {
  const result = {
    type: "element",
    tagName: "strong",
    properties: {},
    children: state.all(node2)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function table(state, node2) {
  const rows = state.all(node2);
  const firstRow = rows.shift();
  const tableContent = [];
  if (firstRow) {
    const head = {
      type: "element",
      tagName: "thead",
      properties: {},
      children: state.wrap([firstRow], true)
    };
    state.patch(node2.children[0], head);
    tableContent.push(head);
  }
  if (rows.length > 0) {
    const body = {
      type: "element",
      tagName: "tbody",
      properties: {},
      children: state.wrap(rows, true)
    };
    const start2 = pointStart(node2.children[1]);
    const end2 = pointEnd(node2.children[node2.children.length - 1]);
    if (start2 && end2)
      body.position = { start: start2, end: end2 };
    tableContent.push(body);
  }
  const result = {
    type: "element",
    tagName: "table",
    properties: {},
    children: state.wrap(tableContent, true)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function tableRow(state, node2, parent) {
  const siblings = parent ? parent.children : void 0;
  const rowIndex = siblings ? siblings.indexOf(node2) : 1;
  const tagName = rowIndex === 0 ? "th" : "td";
  const align = parent && parent.type === "table" ? parent.align : void 0;
  const length2 = align ? align.length : node2.children.length;
  let cellIndex = -1;
  const cells = [];
  while (++cellIndex < length2) {
    const cell = node2.children[cellIndex];
    const properties2 = {};
    const alignValue = align ? align[cellIndex] : void 0;
    if (alignValue) {
      properties2.align = alignValue;
    }
    let result2 = { type: "element", tagName, properties: properties2, children: [] };
    if (cell) {
      result2.children = state.all(cell);
      state.patch(cell, result2);
      result2 = state.applyData(cell, result2);
    }
    cells.push(result2);
  }
  const result = {
    type: "element",
    tagName: "tr",
    properties: {},
    children: state.wrap(cells, true)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function tableCell(state, node2) {
  const result = {
    type: "element",
    tagName: "td",
    // Assume body cell.
    properties: {},
    children: state.all(node2)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
const tab = 9;
const space = 32;
function trimLines(value2) {
  const source2 = String(value2);
  const search2 = /\r?\n|\r/g;
  let match5 = search2.exec(source2);
  let last = 0;
  const lines = [];
  while (match5) {
    lines.push(
      trimLine(source2.slice(last, match5.index), last > 0, true),
      match5[0]
    );
    last = match5.index + match5[0].length;
    match5 = search2.exec(source2);
  }
  lines.push(trimLine(source2.slice(last), last > 0, false));
  return lines.join("");
}
function trimLine(value2, start2, end2) {
  let startIndex = 0;
  let endIndex = value2.length;
  if (start2) {
    let code2 = value2.codePointAt(startIndex);
    while (code2 === tab || code2 === space) {
      startIndex++;
      code2 = value2.codePointAt(startIndex);
    }
  }
  if (end2) {
    let code2 = value2.codePointAt(endIndex - 1);
    while (code2 === tab || code2 === space) {
      endIndex--;
      code2 = value2.codePointAt(endIndex - 1);
    }
  }
  return endIndex > startIndex ? value2.slice(startIndex, endIndex) : "";
}
function text(state, node2) {
  const result = { type: "text", value: trimLines(String(node2.value)) };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function thematicBreak(state, node2) {
  const result = {
    type: "element",
    tagName: "hr",
    properties: {},
    children: []
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
const handlers = {
  blockquote,
  break: hardBreak,
  code,
  delete: strikethrough,
  emphasis,
  footnoteReference,
  heading,
  html,
  imageReference,
  image,
  inlineCode,
  linkReference,
  link,
  listItem,
  list,
  paragraph,
  // @ts-expect-error: root is different, but hard to type.
  root,
  strong,
  table,
  tableCell,
  tableRow,
  text,
  thematicBreak,
  toml: ignore,
  yaml: ignore,
  definition: ignore,
  footnoteDefinition: ignore
};
function ignore() {
  return void 0;
}
const VOID = -1;
const PRIMITIVE = 0;
const ARRAY = 1;
const OBJECT = 2;
const DATE = 3;
const REGEXP = 4;
const MAP = 5;
const SET = 6;
const ERROR = 7;
const BIGINT = 8;
const env = typeof self === "object" ? self : globalThis;
const deserializer = ($, _24) => {
  const as2 = (out, index2) => {
    $.set(index2, out);
    return out;
  };
  const unpair = (index2) => {
    if ($.has(index2))
      return $.get(index2);
    const [type4, value2] = _24[index2];
    switch (type4) {
      case PRIMITIVE:
      case VOID:
        return as2(value2, index2);
      case ARRAY: {
        const arr = as2([], index2);
        for (const index3 of value2)
          arr.push(unpair(index3));
        return arr;
      }
      case OBJECT: {
        const object4 = as2({}, index2);
        for (const [key, index3] of value2)
          object4[unpair(key)] = unpair(index3);
        return object4;
      }
      case DATE:
        return as2(new Date(value2), index2);
      case REGEXP: {
        const { source: source2, flags } = value2;
        return as2(new RegExp(source2, flags), index2);
      }
      case MAP: {
        const map2 = as2(/* @__PURE__ */ new Map(), index2);
        for (const [key, index3] of value2)
          map2.set(unpair(key), unpair(index3));
        return map2;
      }
      case SET: {
        const set2 = as2(/* @__PURE__ */ new Set(), index2);
        for (const index3 of value2)
          set2.add(unpair(index3));
        return set2;
      }
      case ERROR: {
        const { name: name2, message } = value2;
        return as2(new env[name2](message), index2);
      }
      case BIGINT:
        return as2(BigInt(value2), index2);
      case "BigInt":
        return as2(Object(BigInt(value2)), index2);
      case "ArrayBuffer":
        return as2(new Uint8Array(value2).buffer, value2);
      case "DataView": {
        const { buffer } = new Uint8Array(value2);
        return as2(new DataView(buffer), value2);
      }
    }
    return as2(new env[type4](value2), index2);
  };
  return unpair;
};
const deserialize = (serialized) => deserializer(/* @__PURE__ */ new Map(), serialized)(0);
const EMPTY = "";
const { toString: toString3 } = {};
const { keys } = Object;
const typeOf = (value2) => {
  const type4 = typeof value2;
  if (type4 !== "object" || !value2)
    return [PRIMITIVE, type4];
  const asString = toString3.call(value2).slice(8, -1);
  switch (asString) {
    case "Array":
      return [ARRAY, EMPTY];
    case "Object":
      return [OBJECT, EMPTY];
    case "Date":
      return [DATE, EMPTY];
    case "RegExp":
      return [REGEXP, EMPTY];
    case "Map":
      return [MAP, EMPTY];
    case "Set":
      return [SET, EMPTY];
    case "DataView":
      return [ARRAY, asString];
  }
  if (asString.includes("Array"))
    return [ARRAY, asString];
  if (asString.includes("Error"))
    return [ERROR, asString];
  return [OBJECT, asString];
};
const shouldSkip = ([TYPE, type4]) => TYPE === PRIMITIVE && (type4 === "function" || type4 === "symbol");
const serializer = (strict, json, $, _24) => {
  const as2 = (out, value2) => {
    const index2 = _24.push(out) - 1;
    $.set(value2, index2);
    return index2;
  };
  const pair = (value2) => {
    if ($.has(value2))
      return $.get(value2);
    let [TYPE, type4] = typeOf(value2);
    switch (TYPE) {
      case PRIMITIVE: {
        let entry = value2;
        switch (type4) {
          case "bigint":
            TYPE = BIGINT;
            entry = value2.toString();
            break;
          case "function":
          case "symbol":
            if (strict)
              throw new TypeError("unable to serialize " + type4);
            entry = null;
            break;
          case "undefined":
            return as2([VOID], value2);
        }
        return as2([TYPE, entry], value2);
      }
      case ARRAY: {
        if (type4) {
          let spread2 = value2;
          if (type4 === "DataView") {
            spread2 = new Uint8Array(value2.buffer);
          } else if (type4 === "ArrayBuffer") {
            spread2 = new Uint8Array(value2);
          }
          return as2([type4, [...spread2]], value2);
        }
        const arr = [];
        const index2 = as2([TYPE, arr], value2);
        for (const entry of value2)
          arr.push(pair(entry));
        return index2;
      }
      case OBJECT: {
        if (type4) {
          switch (type4) {
            case "BigInt":
              return as2([type4, value2.toString()], value2);
            case "Boolean":
            case "Number":
            case "String":
              return as2([type4, value2.valueOf()], value2);
          }
        }
        if (json && "toJSON" in value2)
          return pair(value2.toJSON());
        const entries = [];
        const index2 = as2([TYPE, entries], value2);
        for (const key of keys(value2)) {
          if (strict || !shouldSkip(typeOf(value2[key])))
            entries.push([pair(key), pair(value2[key])]);
        }
        return index2;
      }
      case DATE:
        return as2([TYPE, value2.toISOString()], value2);
      case REGEXP: {
        const { source: source2, flags } = value2;
        return as2([TYPE, { source: source2, flags }], value2);
      }
      case MAP: {
        const entries = [];
        const index2 = as2([TYPE, entries], value2);
        for (const [key, entry] of value2) {
          if (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry))))
            entries.push([pair(key), pair(entry)]);
        }
        return index2;
      }
      case SET: {
        const entries = [];
        const index2 = as2([TYPE, entries], value2);
        for (const entry of value2) {
          if (strict || !shouldSkip(typeOf(entry)))
            entries.push(pair(entry));
        }
        return index2;
      }
    }
    const { message } = value2;
    return as2([TYPE, { name: type4, message }], value2);
  };
  return pair;
};
const serialize = (value2, { json, lossy } = {}) => {
  const _24 = [];
  return serializer(!(json || lossy), !!json, /* @__PURE__ */ new Map(), _24)(value2), _24;
};
const structuredClone$1 = typeof structuredClone === "function" ? (
  /* c8 ignore start */
  (any3, options) => options && ("json" in options || "lossy" in options) ? deserialize(serialize(any3, options)) : structuredClone(any3)
) : (any3, options) => deserialize(serialize(any3, options));
function defaultFootnoteBackContent(_24, rereferenceIndex) {
  const result = [{ type: "text", value: "↩" }];
  if (rereferenceIndex > 1) {
    result.push({
      type: "element",
      tagName: "sup",
      properties: {},
      children: [{ type: "text", value: String(rereferenceIndex) }]
    });
  }
  return result;
}
function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {
  return "Back to reference " + (referenceIndex + 1) + (rereferenceIndex > 1 ? "-" + rereferenceIndex : "");
}
function footer(state) {
  const clobberPrefix = typeof state.options.clobberPrefix === "string" ? state.options.clobberPrefix : "user-content-";
  const footnoteBackContent = state.options.footnoteBackContent || defaultFootnoteBackContent;
  const footnoteBackLabel = state.options.footnoteBackLabel || defaultFootnoteBackLabel;
  const footnoteLabel = state.options.footnoteLabel || "Footnotes";
  const footnoteLabelTagName = state.options.footnoteLabelTagName || "h2";
  const footnoteLabelProperties = state.options.footnoteLabelProperties || {
    className: ["sr-only"]
  };
  const listItems = [];
  let referenceIndex = -1;
  while (++referenceIndex < state.footnoteOrder.length) {
    const definition2 = state.footnoteById.get(
      state.footnoteOrder[referenceIndex]
    );
    if (!definition2) {
      continue;
    }
    const content2 = state.all(definition2);
    const id2 = String(definition2.identifier).toUpperCase();
    const safeId = normalizeUri(id2.toLowerCase());
    let rereferenceIndex = 0;
    const backReferences = [];
    const counts = state.footnoteCounts.get(id2);
    while (counts !== void 0 && ++rereferenceIndex <= counts) {
      if (backReferences.length > 0) {
        backReferences.push({ type: "text", value: " " });
      }
      let children = typeof footnoteBackContent === "string" ? footnoteBackContent : footnoteBackContent(referenceIndex, rereferenceIndex);
      if (typeof children === "string") {
        children = { type: "text", value: children };
      }
      backReferences.push({
        type: "element",
        tagName: "a",
        properties: {
          href: "#" + clobberPrefix + "fnref-" + safeId + (rereferenceIndex > 1 ? "-" + rereferenceIndex : ""),
          dataFootnoteBackref: "",
          ariaLabel: typeof footnoteBackLabel === "string" ? footnoteBackLabel : footnoteBackLabel(referenceIndex, rereferenceIndex),
          className: ["data-footnote-backref"]
        },
        children: Array.isArray(children) ? children : [children]
      });
    }
    const tail = content2[content2.length - 1];
    if (tail && tail.type === "element" && tail.tagName === "p") {
      const tailTail = tail.children[tail.children.length - 1];
      if (tailTail && tailTail.type === "text") {
        tailTail.value += " ";
      } else {
        tail.children.push({ type: "text", value: " " });
      }
      tail.children.push(...backReferences);
    } else {
      content2.push(...backReferences);
    }
    const listItem2 = {
      type: "element",
      tagName: "li",
      properties: { id: clobberPrefix + "fn-" + safeId },
      children: state.wrap(content2, true)
    };
    state.patch(definition2, listItem2);
    listItems.push(listItem2);
  }
  if (listItems.length === 0) {
    return;
  }
  return {
    type: "element",
    tagName: "section",
    properties: { dataFootnotes: true, className: ["footnotes"] },
    children: [
      {
        type: "element",
        tagName: footnoteLabelTagName,
        properties: {
          ...structuredClone$1(footnoteLabelProperties),
          id: "footnote-label"
        },
        children: [{ type: "text", value: footnoteLabel }]
      },
      { type: "text", value: "\n" },
      {
        type: "element",
        tagName: "ol",
        properties: {},
        children: state.wrap(listItems, true)
      },
      { type: "text", value: "\n" }
    ]
  };
}
const convert = (
  // Note: overloads in JSDoc can’t yet use different `@template`s.
  /**
   * @type {(
   *   (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
   *   (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
   *   (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &
   *   ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &
   *   ((test?: Test) => Check)
   * )}
   */
  /**
   * @param {Test} [test]
   * @returns {Check}
   */
  function(test2) {
    if (test2 === null || test2 === void 0) {
      return ok;
    }
    if (typeof test2 === "function") {
      return castFactory(test2);
    }
    if (typeof test2 === "object") {
      return Array.isArray(test2) ? anyFactory(test2) : propsFactory(test2);
    }
    if (typeof test2 === "string") {
      return typeFactory(test2);
    }
    throw new Error("Expected function, string, or object as test");
  }
);
function anyFactory(tests) {
  const checks2 = [];
  let index2 = -1;
  while (++index2 < tests.length) {
    checks2[index2] = convert(tests[index2]);
  }
  return castFactory(any3);
  function any3(...parameters) {
    let index3 = -1;
    while (++index3 < checks2.length) {
      if (checks2[index3].apply(this, parameters))
        return true;
    }
    return false;
  }
}
function propsFactory(check) {
  const checkAsRecord = (
    /** @type {Record<string, unknown>} */
    check
  );
  return castFactory(all3);
  function all3(node2) {
    const nodeAsRecord = (
      /** @type {Record<string, unknown>} */
      /** @type {unknown} */
      node2
    );
    let key;
    for (key in check) {
      if (nodeAsRecord[key] !== checkAsRecord[key])
        return false;
    }
    return true;
  }
}
function typeFactory(check) {
  return castFactory(type4);
  function type4(node2) {
    return node2 && node2.type === check;
  }
}
function castFactory(testFunction) {
  return check;
  function check(value2, index2, parent) {
    return Boolean(
      looksLikeANode(value2) && testFunction.call(
        this,
        value2,
        typeof index2 === "number" ? index2 : void 0,
        parent || void 0
      )
    );
  }
}
function ok() {
  return true;
}
function looksLikeANode(value2) {
  return value2 !== null && typeof value2 === "object" && "type" in value2;
}
function color(d2) {
  return d2;
}
const empty = [];
const CONTINUE = true;
const EXIT = false;
const SKIP = "skip";
function visitParents(tree, test2, visitor, reverse) {
  let check;
  if (typeof test2 === "function" && typeof visitor !== "function") {
    reverse = visitor;
    visitor = test2;
  } else {
    check = test2;
  }
  const is2 = convert(check);
  const step = reverse ? -1 : 1;
  factory(tree, void 0, [])();
  function factory(node2, index2, parents) {
    const value2 = (
      /** @type {Record<string, unknown>} */
      node2 && typeof node2 === "object" ? node2 : {}
    );
    if (typeof value2.type === "string") {
      const name2 = (
        // `hast`
        typeof value2.tagName === "string" ? value2.tagName : (
          // `xast`
          typeof value2.name === "string" ? value2.name : void 0
        )
      );
      Object.defineProperty(visit2, "name", {
        value: "node (" + color(node2.type + (name2 ? "<" + name2 + ">" : "")) + ")"
      });
    }
    return visit2;
    function visit2() {
      let result = empty;
      let subresult;
      let offset2;
      let grandparents;
      if (!test2 || is2(node2, index2, parents[parents.length - 1] || void 0)) {
        result = toResult(visitor(node2, parents));
        if (result[0] === EXIT) {
          return result;
        }
      }
      if ("children" in node2 && node2.children) {
        const nodeAsParent = (
          /** @type {UnistParent} */
          node2
        );
        if (nodeAsParent.children && result[0] !== SKIP) {
          offset2 = (reverse ? nodeAsParent.children.length : -1) + step;
          grandparents = parents.concat(nodeAsParent);
          while (offset2 > -1 && offset2 < nodeAsParent.children.length) {
            const child = nodeAsParent.children[offset2];
            subresult = factory(child, offset2, grandparents)();
            if (subresult[0] === EXIT) {
              return subresult;
            }
            offset2 = typeof subresult[1] === "number" ? subresult[1] : offset2 + step;
          }
        }
      }
      return result;
    }
  }
}
function toResult(value2) {
  if (Array.isArray(value2)) {
    return value2;
  }
  if (typeof value2 === "number") {
    return [CONTINUE, value2];
  }
  return value2 === null || value2 === void 0 ? empty : [value2];
}
function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
  let reverse;
  let test2;
  let visitor;
  if (typeof testOrVisitor === "function" && typeof visitorOrReverse !== "function") {
    test2 = void 0;
    visitor = testOrVisitor;
    reverse = visitorOrReverse;
  } else {
    test2 = testOrVisitor;
    visitor = visitorOrReverse;
    reverse = maybeReverse;
  }
  visitParents(tree, test2, overload, reverse);
  function overload(node2, parents) {
    const parent = parents[parents.length - 1];
    const index2 = parent ? parent.children.indexOf(node2) : void 0;
    return visitor(node2, index2, parent);
  }
}
const own$1 = {}.hasOwnProperty;
const emptyOptions = {};
function createState(tree, options) {
  const settings = options || emptyOptions;
  const definitionById = /* @__PURE__ */ new Map();
  const footnoteById = /* @__PURE__ */ new Map();
  const footnoteCounts = /* @__PURE__ */ new Map();
  const handlers$1 = { ...handlers, ...settings.handlers };
  const state = {
    all: all3,
    applyData,
    definitionById,
    footnoteById,
    footnoteCounts,
    footnoteOrder: [],
    handlers: handlers$1,
    one: one2,
    options: settings,
    patch,
    wrap: wrap$1
  };
  visit(tree, function(node2) {
    if (node2.type === "definition" || node2.type === "footnoteDefinition") {
      const map2 = node2.type === "definition" ? definitionById : footnoteById;
      const id2 = String(node2.identifier).toUpperCase();
      if (!map2.has(id2)) {
        map2.set(id2, node2);
      }
    }
  });
  return state;
  function one2(node2, parent) {
    const type4 = node2.type;
    const handle2 = state.handlers[type4];
    if (own$1.call(state.handlers, type4) && handle2) {
      return handle2(state, node2, parent);
    }
    if (state.options.passThrough && state.options.passThrough.includes(type4)) {
      if ("children" in node2) {
        const { children, ...shallow } = node2;
        const result = structuredClone$1(shallow);
        result.children = state.all(node2);
        return result;
      }
      return structuredClone$1(node2);
    }
    const unknown = state.options.unknownHandler || defaultUnknownHandler;
    return unknown(state, node2, parent);
  }
  function all3(parent) {
    const values = [];
    if ("children" in parent) {
      const nodes = parent.children;
      let index2 = -1;
      while (++index2 < nodes.length) {
        const result = state.one(nodes[index2], parent);
        if (result) {
          if (index2 && nodes[index2 - 1].type === "break") {
            if (!Array.isArray(result) && result.type === "text") {
              result.value = trimMarkdownSpaceStart(result.value);
            }
            if (!Array.isArray(result) && result.type === "element") {
              const head = result.children[0];
              if (head && head.type === "text") {
                head.value = trimMarkdownSpaceStart(head.value);
              }
            }
          }
          if (Array.isArray(result)) {
            values.push(...result);
          } else {
            values.push(result);
          }
        }
      }
    }
    return values;
  }
}
function patch(from2, to2) {
  if (from2.position)
    to2.position = position$1(from2);
}
function applyData(from2, to2) {
  let result = to2;
  if (from2 && from2.data) {
    const hName = from2.data.hName;
    const hChildren = from2.data.hChildren;
    const hProperties = from2.data.hProperties;
    if (typeof hName === "string") {
      if (result.type === "element") {
        result.tagName = hName;
      } else {
        const children = "children" in result ? result.children : [result];
        result = { type: "element", tagName: hName, properties: {}, children };
      }
    }
    if (result.type === "element" && hProperties) {
      Object.assign(result.properties, structuredClone$1(hProperties));
    }
    if ("children" in result && result.children && hChildren !== null && hChildren !== void 0) {
      result.children = hChildren;
    }
  }
  return result;
}
function defaultUnknownHandler(state, node2) {
  const data = node2.data || {};
  const result = "value" in node2 && !(own$1.call(data, "hProperties") || own$1.call(data, "hChildren")) ? { type: "text", value: node2.value } : {
    type: "element",
    tagName: "div",
    properties: {},
    children: state.all(node2)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function wrap$1(nodes, loose) {
  const result = [];
  let index2 = -1;
  if (loose) {
    result.push({ type: "text", value: "\n" });
  }
  while (++index2 < nodes.length) {
    if (index2)
      result.push({ type: "text", value: "\n" });
    result.push(nodes[index2]);
  }
  if (loose && nodes.length > 0) {
    result.push({ type: "text", value: "\n" });
  }
  return result;
}
function trimMarkdownSpaceStart(value2) {
  let index2 = 0;
  let code2 = value2.charCodeAt(index2);
  while (code2 === 9 || code2 === 32) {
    index2++;
    code2 = value2.charCodeAt(index2);
  }
  return value2.slice(index2);
}
function toHast(tree, options) {
  const state = createState(tree, options);
  const node2 = state.one(tree, void 0);
  const foot = footer(state);
  const result = Array.isArray(node2) ? { type: "root", children: node2 } : node2 || { type: "root", children: [] };
  if (foot) {
    result.children.push({ type: "text", value: "\n" }, foot);
  }
  return result;
}
function remarkRehype(destination, options) {
  if (destination && "run" in destination) {
    return async function(tree, file) {
      const hastTree = (
        /** @type {HastRoot} */
        toHast(tree, { file, ...options })
      );
      await destination.run(hastTree, file);
    };
  }
  return function(tree, file) {
    return (
      /** @type {HastRoot} */
      toHast(tree, { file, ...destination || options })
    );
  };
}
function bail(error2) {
  if (error2) {
    throw error2;
  }
}
var hasOwn = Object.prototype.hasOwnProperty;
var toStr = Object.prototype.toString;
var defineProperty = Object.defineProperty;
var gOPD = Object.getOwnPropertyDescriptor;
var isArray = function isArray2(arr) {
  if (typeof Array.isArray === "function") {
    return Array.isArray(arr);
  }
  return toStr.call(arr) === "[object Array]";
};
var isPlainObject$1 = function isPlainObject(obj) {
  if (!obj || toStr.call(obj) !== "[object Object]") {
    return false;
  }
  var hasOwnConstructor = hasOwn.call(obj, "constructor");
  var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, "isPrototypeOf");
  if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
    return false;
  }
  var key;
  for (key in obj) {
  }
  return typeof key === "undefined" || hasOwn.call(obj, key);
};
var setProperty = function setProperty2(target, options) {
  if (defineProperty && options.name === "__proto__") {
    defineProperty(target, options.name, {
      enumerable: true,
      configurable: true,
      value: options.newValue,
      writable: true
    });
  } else {
    target[options.name] = options.newValue;
  }
};
var getProperty = function getProperty2(obj, name2) {
  if (name2 === "__proto__") {
    if (!hasOwn.call(obj, name2)) {
      return void 0;
    } else if (gOPD) {
      return gOPD(obj, name2).value;
    }
  }
  return obj[name2];
};
var extend2 = function extend3() {
  var options, name2, src, copy2, copyIsArray, clone3;
  var target = arguments[0];
  var i2 = 1;
  var length2 = arguments.length;
  var deep = false;
  if (typeof target === "boolean") {
    deep = target;
    target = arguments[1] || {};
    i2 = 2;
  }
  if (target == null || typeof target !== "object" && typeof target !== "function") {
    target = {};
  }
  for (; i2 < length2; ++i2) {
    options = arguments[i2];
    if (options != null) {
      for (name2 in options) {
        src = getProperty(target, name2);
        copy2 = getProperty(options, name2);
        if (target !== copy2) {
          if (deep && copy2 && (isPlainObject$1(copy2) || (copyIsArray = isArray(copy2)))) {
            if (copyIsArray) {
              copyIsArray = false;
              clone3 = src && isArray(src) ? src : [];
            } else {
              clone3 = src && isPlainObject$1(src) ? src : {};
            }
            setProperty(target, { name: name2, newValue: extend3(deep, clone3, copy2) });
          } else if (typeof copy2 !== "undefined") {
            setProperty(target, { name: name2, newValue: copy2 });
          }
        }
      }
    }
  }
  return target;
};
const extend$1 = /* @__PURE__ */ getDefaultExportFromCjs(extend2);
function isPlainObject2(value2) {
  if (typeof value2 !== "object" || value2 === null) {
    return false;
  }
  const prototype2 = Object.getPrototypeOf(value2);
  return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(Symbol.toStringTag in value2) && !(Symbol.iterator in value2);
}
function trough() {
  const fns = [];
  const pipeline = { run, use };
  return pipeline;
  function run(...values) {
    let middlewareIndex = -1;
    const callback2 = values.pop();
    if (typeof callback2 !== "function") {
      throw new TypeError("Expected function as last argument, not " + callback2);
    }
    next2(null, ...values);
    function next2(error2, ...output2) {
      const fn = fns[++middlewareIndex];
      let index2 = -1;
      if (error2) {
        callback2(error2);
        return;
      }
      while (++index2 < values.length) {
        if (output2[index2] === null || output2[index2] === void 0) {
          output2[index2] = values[index2];
        }
      }
      values = output2;
      if (fn) {
        wrap(fn, next2)(...output2);
      } else {
        callback2(null, ...output2);
      }
    }
  }
  function use(middelware) {
    if (typeof middelware !== "function") {
      throw new TypeError(
        "Expected `middelware` to be a function, not " + middelware
      );
    }
    fns.push(middelware);
    return pipeline;
  }
}
function wrap(middleware, callback2) {
  let called;
  return wrapped;
  function wrapped(...parameters) {
    const fnExpectsCallback = middleware.length > parameters.length;
    let result;
    if (fnExpectsCallback) {
      parameters.push(done);
    }
    try {
      result = middleware.apply(this, parameters);
    } catch (error2) {
      const exception = (
        /** @type {Error} */
        error2
      );
      if (fnExpectsCallback && called) {
        throw exception;
      }
      return done(exception);
    }
    if (!fnExpectsCallback) {
      if (result && result.then && typeof result.then === "function") {
        result.then(then, done);
      } else if (result instanceof Error) {
        done(result);
      } else {
        then(result);
      }
    }
  }
  function done(error2, ...output2) {
    if (!called) {
      called = true;
      callback2(error2, ...output2);
    }
  }
  function then(value2) {
    done(null, value2);
  }
}
const minpath = { basename, dirname, extname, join, sep: "/" };
function basename(path, extname2) {
  if (extname2 !== void 0 && typeof extname2 !== "string") {
    throw new TypeError('"ext" argument must be a string');
  }
  assertPath$1(path);
  let start2 = 0;
  let end2 = -1;
  let index2 = path.length;
  let seenNonSlash;
  if (extname2 === void 0 || extname2.length === 0 || extname2.length > path.length) {
    while (index2--) {
      if (path.codePointAt(index2) === 47) {
        if (seenNonSlash) {
          start2 = index2 + 1;
          break;
        }
      } else if (end2 < 0) {
        seenNonSlash = true;
        end2 = index2 + 1;
      }
    }
    return end2 < 0 ? "" : path.slice(start2, end2);
  }
  if (extname2 === path) {
    return "";
  }
  let firstNonSlashEnd = -1;
  let extnameIndex = extname2.length - 1;
  while (index2--) {
    if (path.codePointAt(index2) === 47) {
      if (seenNonSlash) {
        start2 = index2 + 1;
        break;
      }
    } else {
      if (firstNonSlashEnd < 0) {
        seenNonSlash = true;
        firstNonSlashEnd = index2 + 1;
      }
      if (extnameIndex > -1) {
        if (path.codePointAt(index2) === extname2.codePointAt(extnameIndex--)) {
          if (extnameIndex < 0) {
            end2 = index2;
          }
        } else {
          extnameIndex = -1;
          end2 = firstNonSlashEnd;
        }
      }
    }
  }
  if (start2 === end2) {
    end2 = firstNonSlashEnd;
  } else if (end2 < 0) {
    end2 = path.length;
  }
  return path.slice(start2, end2);
}
function dirname(path) {
  assertPath$1(path);
  if (path.length === 0) {
    return ".";
  }
  let end2 = -1;
  let index2 = path.length;
  let unmatchedSlash;
  while (--index2) {
    if (path.codePointAt(index2) === 47) {
      if (unmatchedSlash) {
        end2 = index2;
        break;
      }
    } else if (!unmatchedSlash) {
      unmatchedSlash = true;
    }
  }
  return end2 < 0 ? path.codePointAt(0) === 47 ? "/" : "." : end2 === 1 && path.codePointAt(0) === 47 ? "//" : path.slice(0, end2);
}
function extname(path) {
  assertPath$1(path);
  let index2 = path.length;
  let end2 = -1;
  let startPart = 0;
  let startDot = -1;
  let preDotState = 0;
  let unmatchedSlash;
  while (index2--) {
    const code2 = path.codePointAt(index2);
    if (code2 === 47) {
      if (unmatchedSlash) {
        startPart = index2 + 1;
        break;
      }
      continue;
    }
    if (end2 < 0) {
      unmatchedSlash = true;
      end2 = index2 + 1;
    }
    if (code2 === 46) {
      if (startDot < 0) {
        startDot = index2;
      } else if (preDotState !== 1) {
        preDotState = 1;
      }
    } else if (startDot > -1) {
      preDotState = -1;
    }
  }
  if (startDot < 0 || end2 < 0 || // We saw a non-dot character immediately before the dot.
  preDotState === 0 || // The (right-most) trimmed path component is exactly `..`.
  preDotState === 1 && startDot === end2 - 1 && startDot === startPart + 1) {
    return "";
  }
  return path.slice(startDot, end2);
}
function join(...segments) {
  let index2 = -1;
  let joined;
  while (++index2 < segments.length) {
    assertPath$1(segments[index2]);
    if (segments[index2]) {
      joined = joined === void 0 ? segments[index2] : joined + "/" + segments[index2];
    }
  }
  return joined === void 0 ? "." : normalize(joined);
}
function normalize(path) {
  assertPath$1(path);
  const absolute2 = path.codePointAt(0) === 47;
  let value2 = normalizeString(path, !absolute2);
  if (value2.length === 0 && !absolute2) {
    value2 = ".";
  }
  if (value2.length > 0 && path.codePointAt(path.length - 1) === 47) {
    value2 += "/";
  }
  return absolute2 ? "/" + value2 : value2;
}
function normalizeString(path, allowAboveRoot) {
  let result = "";
  let lastSegmentLength = 0;
  let lastSlash = -1;
  let dots = 0;
  let index2 = -1;
  let code2;
  let lastSlashIndex;
  while (++index2 <= path.length) {
    if (index2 < path.length) {
      code2 = path.codePointAt(index2);
    } else if (code2 === 47) {
      break;
    } else {
      code2 = 47;
    }
    if (code2 === 47) {
      if (lastSlash === index2 - 1 || dots === 1)
        ;
      else if (lastSlash !== index2 - 1 && dots === 2) {
        if (result.length < 2 || lastSegmentLength !== 2 || result.codePointAt(result.length - 1) !== 46 || result.codePointAt(result.length - 2) !== 46) {
          if (result.length > 2) {
            lastSlashIndex = result.lastIndexOf("/");
            if (lastSlashIndex !== result.length - 1) {
              if (lastSlashIndex < 0) {
                result = "";
                lastSegmentLength = 0;
              } else {
                result = result.slice(0, lastSlashIndex);
                lastSegmentLength = result.length - 1 - result.lastIndexOf("/");
              }
              lastSlash = index2;
              dots = 0;
              continue;
            }
          } else if (result.length > 0) {
            result = "";
            lastSegmentLength = 0;
            lastSlash = index2;
            dots = 0;
            continue;
          }
        }
        if (allowAboveRoot) {
          result = result.length > 0 ? result + "/.." : "..";
          lastSegmentLength = 2;
        }
      } else {
        if (result.length > 0) {
          result += "/" + path.slice(lastSlash + 1, index2);
        } else {
          result = path.slice(lastSlash + 1, index2);
        }
        lastSegmentLength = index2 - lastSlash - 1;
      }
      lastSlash = index2;
      dots = 0;
    } else if (code2 === 46 && dots > -1) {
      dots++;
    } else {
      dots = -1;
    }
  }
  return result;
}
function assertPath$1(path) {
  if (typeof path !== "string") {
    throw new TypeError(
      "Path must be a string. Received " + JSON.stringify(path)
    );
  }
}
const minproc = { cwd };
function cwd() {
  return "/";
}
function isUrl(fileUrlOrPath) {
  return Boolean(
    fileUrlOrPath !== null && typeof fileUrlOrPath === "object" && "href" in fileUrlOrPath && fileUrlOrPath.href && "protocol" in fileUrlOrPath && fileUrlOrPath.protocol && // @ts-expect-error: indexing is fine.
    fileUrlOrPath.auth === void 0
  );
}
function urlToPath(path) {
  if (typeof path === "string") {
    path = new URL(path);
  } else if (!isUrl(path)) {
    const error2 = new TypeError(
      'The "path" argument must be of type string or an instance of URL. Received `' + path + "`"
    );
    error2.code = "ERR_INVALID_ARG_TYPE";
    throw error2;
  }
  if (path.protocol !== "file:") {
    const error2 = new TypeError("The URL must be of scheme file");
    error2.code = "ERR_INVALID_URL_SCHEME";
    throw error2;
  }
  return getPathFromURLPosix(path);
}
function getPathFromURLPosix(url2) {
  if (url2.hostname !== "") {
    const error2 = new TypeError(
      'File URL host must be "localhost" or empty on darwin'
    );
    error2.code = "ERR_INVALID_FILE_URL_HOST";
    throw error2;
  }
  const pathname = url2.pathname;
  let index2 = -1;
  while (++index2 < pathname.length) {
    if (pathname.codePointAt(index2) === 37 && pathname.codePointAt(index2 + 1) === 50) {
      const third = pathname.codePointAt(index2 + 2);
      if (third === 70 || third === 102) {
        const error2 = new TypeError(
          "File URL path must not include encoded / characters"
        );
        error2.code = "ERR_INVALID_FILE_URL_PATH";
        throw error2;
      }
    }
  }
  return decodeURIComponent(pathname);
}
const order = (
  /** @type {const} */
  [
    "history",
    "path",
    "basename",
    "stem",
    "extname",
    "dirname"
  ]
);
class VFile {
  /**
   * Create a new virtual file.
   *
   * `options` is treated as:
   *
   * *   `string` or `Uint8Array` — `{value: options}`
   * *   `URL` — `{path: options}`
   * *   `VFile` — shallow copies its data over to the new file
   * *   `object` — all fields are shallow copied over to the new file
   *
   * Path related fields are set in the following order (least specific to
   * most specific): `history`, `path`, `basename`, `stem`, `extname`,
   * `dirname`.
   *
   * You cannot set `dirname` or `extname` without setting either `history`,
   * `path`, `basename`, or `stem` too.
   *
   * @param {Compatible | null | undefined} [value]
   *   File value.
   * @returns
   *   New instance.
   */
  constructor(value2) {
    let options;
    if (!value2) {
      options = {};
    } else if (isUrl(value2)) {
      options = { path: value2 };
    } else if (typeof value2 === "string" || isUint8Array$1(value2)) {
      options = { value: value2 };
    } else {
      options = value2;
    }
    this.cwd = "cwd" in options ? "" : minproc.cwd();
    this.data = {};
    this.history = [];
    this.messages = [];
    this.value;
    this.map;
    this.result;
    this.stored;
    let index2 = -1;
    while (++index2 < order.length) {
      const field2 = order[index2];
      if (field2 in options && options[field2] !== void 0 && options[field2] !== null) {
        this[field2] = field2 === "history" ? [...options[field2]] : options[field2];
      }
    }
    let field;
    for (field in options) {
      if (!order.includes(field)) {
        this[field] = options[field];
      }
    }
  }
  /**
   * Get the basename (including extname) (example: `'index.min.js'`).
   *
   * @returns {string | undefined}
   *   Basename.
   */
  get basename() {
    return typeof this.path === "string" ? minpath.basename(this.path) : void 0;
  }
  /**
   * Set basename (including extname) (`'index.min.js'`).
   *
   * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
   * on windows).
   * Cannot be nullified (use `file.path = file.dirname` instead).
   *
   * @param {string} basename
   *   Basename.
   * @returns {undefined}
   *   Nothing.
   */
  set basename(basename2) {
    assertNonEmpty(basename2, "basename");
    assertPart(basename2, "basename");
    this.path = minpath.join(this.dirname || "", basename2);
  }
  /**
   * Get the parent path (example: `'~'`).
   *
   * @returns {string | undefined}
   *   Dirname.
   */
  get dirname() {
    return typeof this.path === "string" ? minpath.dirname(this.path) : void 0;
  }
  /**
   * Set the parent path (example: `'~'`).
   *
   * Cannot be set if there’s no `path` yet.
   *
   * @param {string | undefined} dirname
   *   Dirname.
   * @returns {undefined}
   *   Nothing.
   */
  set dirname(dirname2) {
    assertPath(this.basename, "dirname");
    this.path = minpath.join(dirname2 || "", this.basename);
  }
  /**
   * Get the extname (including dot) (example: `'.js'`).
   *
   * @returns {string | undefined}
   *   Extname.
   */
  get extname() {
    return typeof this.path === "string" ? minpath.extname(this.path) : void 0;
  }
  /**
   * Set the extname (including dot) (example: `'.js'`).
   *
   * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
   * on windows).
   * Cannot be set if there’s no `path` yet.
   *
   * @param {string | undefined} extname
   *   Extname.
   * @returns {undefined}
   *   Nothing.
   */
  set extname(extname2) {
    assertPart(extname2, "extname");
    assertPath(this.dirname, "extname");
    if (extname2) {
      if (extname2.codePointAt(0) !== 46) {
        throw new Error("`extname` must start with `.`");
      }
      if (extname2.includes(".", 1)) {
        throw new Error("`extname` cannot contain multiple dots");
      }
    }
    this.path = minpath.join(this.dirname, this.stem + (extname2 || ""));
  }
  /**
   * Get the full path (example: `'~/index.min.js'`).
   *
   * @returns {string}
   *   Path.
   */
  get path() {
    return this.history[this.history.length - 1];
  }
  /**
   * Set the full path (example: `'~/index.min.js'`).
   *
   * Cannot be nullified.
   * You can set a file URL (a `URL` object with a `file:` protocol) which will
   * be turned into a path with `url.fileURLToPath`.
   *
   * @param {URL | string} path
   *   Path.
   * @returns {undefined}
   *   Nothing.
   */
  set path(path) {
    if (isUrl(path)) {
      path = urlToPath(path);
    }
    assertNonEmpty(path, "path");
    if (this.path !== path) {
      this.history.push(path);
    }
  }
  /**
   * Get the stem (basename w/o extname) (example: `'index.min'`).
   *
   * @returns {string | undefined}
   *   Stem.
   */
  get stem() {
    return typeof this.path === "string" ? minpath.basename(this.path, this.extname) : void 0;
  }
  /**
   * Set the stem (basename w/o extname) (example: `'index.min'`).
   *
   * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
   * on windows).
   * Cannot be nullified (use `file.path = file.dirname` instead).
   *
   * @param {string} stem
   *   Stem.
   * @returns {undefined}
   *   Nothing.
   */
  set stem(stem) {
    assertNonEmpty(stem, "stem");
    assertPart(stem, "stem");
    this.path = minpath.join(this.dirname || "", stem + (this.extname || ""));
  }
  // Normal prototypal methods.
  /**
   * Create a fatal message for `reason` associated with the file.
   *
   * The `fatal` field of the message is set to `true` (error; file not usable)
   * and the `file` field is set to the current file path.
   * The message is added to the `messages` field on `file`.
   *
   * > 🪦 **Note**: also has obsolete signatures.
   *
   * @overload
   * @param {string} reason
   * @param {MessageOptions | null | undefined} [options]
   * @returns {never}
   *
   * @overload
   * @param {string} reason
   * @param {Node | NodeLike | null | undefined} parent
   * @param {string | null | undefined} [origin]
   * @returns {never}
   *
   * @overload
   * @param {string} reason
   * @param {Point | Position | null | undefined} place
   * @param {string | null | undefined} [origin]
   * @returns {never}
   *
   * @overload
   * @param {string} reason
   * @param {string | null | undefined} [origin]
   * @returns {never}
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {Node | NodeLike | null | undefined} parent
   * @param {string | null | undefined} [origin]
   * @returns {never}
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {Point | Position | null | undefined} place
   * @param {string | null | undefined} [origin]
   * @returns {never}
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {string | null | undefined} [origin]
   * @returns {never}
   *
   * @param {Error | VFileMessage | string} causeOrReason
   *   Reason for message, should use markdown.
   * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
   *   Configuration (optional).
   * @param {string | null | undefined} [origin]
   *   Place in code where the message originates (example:
   *   `'my-package:my-rule'` or `'my-rule'`).
   * @returns {never}
   *   Never.
   * @throws {VFileMessage}
   *   Message.
   */
  fail(causeOrReason, optionsOrParentOrPlace, origin2) {
    const message = this.message(causeOrReason, optionsOrParentOrPlace, origin2);
    message.fatal = true;
    throw message;
  }
  /**
   * Create an info message for `reason` associated with the file.
   *
   * The `fatal` field of the message is set to `undefined` (info; change
   * likely not needed) and the `file` field is set to the current file path.
   * The message is added to the `messages` field on `file`.
   *
   * > 🪦 **Note**: also has obsolete signatures.
   *
   * @overload
   * @param {string} reason
   * @param {MessageOptions | null | undefined} [options]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {string} reason
   * @param {Node | NodeLike | null | undefined} parent
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {string} reason
   * @param {Point | Position | null | undefined} place
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {string} reason
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {Node | NodeLike | null | undefined} parent
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {Point | Position | null | undefined} place
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @param {Error | VFileMessage | string} causeOrReason
   *   Reason for message, should use markdown.
   * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
   *   Configuration (optional).
   * @param {string | null | undefined} [origin]
   *   Place in code where the message originates (example:
   *   `'my-package:my-rule'` or `'my-rule'`).
   * @returns {VFileMessage}
   *   Message.
   */
  info(causeOrReason, optionsOrParentOrPlace, origin2) {
    const message = this.message(causeOrReason, optionsOrParentOrPlace, origin2);
    message.fatal = void 0;
    return message;
  }
  /**
   * Create a message for `reason` associated with the file.
   *
   * The `fatal` field of the message is set to `false` (warning; change may be
   * needed) and the `file` field is set to the current file path.
   * The message is added to the `messages` field on `file`.
   *
   * > 🪦 **Note**: also has obsolete signatures.
   *
   * @overload
   * @param {string} reason
   * @param {MessageOptions | null | undefined} [options]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {string} reason
   * @param {Node | NodeLike | null | undefined} parent
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {string} reason
   * @param {Point | Position | null | undefined} place
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {string} reason
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {Node | NodeLike | null | undefined} parent
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {Point | Position | null | undefined} place
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @param {Error | VFileMessage | string} causeOrReason
   *   Reason for message, should use markdown.
   * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
   *   Configuration (optional).
   * @param {string | null | undefined} [origin]
   *   Place in code where the message originates (example:
   *   `'my-package:my-rule'` or `'my-rule'`).
   * @returns {VFileMessage}
   *   Message.
   */
  message(causeOrReason, optionsOrParentOrPlace, origin2) {
    const message = new VFileMessage(
      // @ts-expect-error: the overloads are fine.
      causeOrReason,
      optionsOrParentOrPlace,
      origin2
    );
    if (this.path) {
      message.name = this.path + ":" + message.name;
      message.file = this.path;
    }
    message.fatal = false;
    this.messages.push(message);
    return message;
  }
  /**
   * Serialize the file.
   *
   * > **Note**: which encodings are supported depends on the engine.
   * > For info on Node.js, see:
   * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>.
   *
   * @param {string | null | undefined} [encoding='utf8']
   *   Character encoding to understand `value` as when it’s a `Uint8Array`
   *   (default: `'utf-8'`).
   * @returns {string}
   *   Serialized file.
   */
  toString(encoding) {
    if (this.value === void 0) {
      return "";
    }
    if (typeof this.value === "string") {
      return this.value;
    }
    const decoder = new TextDecoder(encoding || void 0);
    return decoder.decode(this.value);
  }
}
function assertPart(part, name2) {
  if (part && part.includes(minpath.sep)) {
    throw new Error(
      "`" + name2 + "` cannot be a path: did not expect `" + minpath.sep + "`"
    );
  }
}
function assertNonEmpty(part, name2) {
  if (!part) {
    throw new Error("`" + name2 + "` cannot be empty");
  }
}
function assertPath(path, name2) {
  if (!path) {
    throw new Error("Setting `" + name2 + "` requires `path` to be set too");
  }
}
function isUint8Array$1(value2) {
  return Boolean(
    value2 && typeof value2 === "object" && "byteLength" in value2 && "byteOffset" in value2
  );
}
const CallableInstance = (
  /**
   * @type {new <Parameters extends Array<unknown>, Result>(property: string | symbol) => (...parameters: Parameters) => Result}
   */
  /** @type {unknown} */
  /**
   * @this {Function}
   * @param {string | symbol} property
   * @returns {(...parameters: Array<unknown>) => unknown}
   */
  function(property2) {
    const self2 = this;
    const constr = self2.constructor;
    const proto2 = (
      /** @type {Record<string | symbol, Function>} */
      // Prototypes do exist.
      // type-coverage:ignore-next-line
      constr.prototype
    );
    const value2 = proto2[property2];
    const apply2 = function() {
      return value2.apply(apply2, arguments);
    };
    Object.setPrototypeOf(apply2, proto2);
    return apply2;
  }
);
const own = {}.hasOwnProperty;
class Processor extends CallableInstance {
  /**
   * Create a processor.
   */
  constructor() {
    super("copy");
    this.Compiler = void 0;
    this.Parser = void 0;
    this.attachers = [];
    this.compiler = void 0;
    this.freezeIndex = -1;
    this.frozen = void 0;
    this.namespace = {};
    this.parser = void 0;
    this.transformers = trough();
  }
  /**
   * Copy a processor.
   *
   * @deprecated
   *   This is a private internal method and should not be used.
   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
   *   New *unfrozen* processor ({@linkcode Processor}) that is
   *   configured to work the same as its ancestor.
   *   When the descendant processor is configured in the future it does not
   *   affect the ancestral processor.
   */
  copy() {
    const destination = (
      /** @type {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>} */
      new Processor()
    );
    let index2 = -1;
    while (++index2 < this.attachers.length) {
      const attacher = this.attachers[index2];
      destination.use(...attacher);
    }
    destination.data(extend$1(true, {}, this.namespace));
    return destination;
  }
  /**
   * Configure the processor with info available to all plugins.
   * Information is stored in an object.
   *
   * Typically, options can be given to a specific plugin, but sometimes it
   * makes sense to have information shared with several plugins.
   * For example, a list of HTML elements that are self-closing, which is
   * needed during all phases.
   *
   * > **Note**: setting information cannot occur on *frozen* processors.
   * > Call the processor first to create a new unfrozen processor.
   *
   * > **Note**: to register custom data in TypeScript, augment the
   * > {@linkcode Data} interface.
   *
   * @example
   *   This example show how to get and set info:
   *
   *   ```js
   *   import {unified} from 'unified'
   *
   *   const processor = unified().data('alpha', 'bravo')
   *
   *   processor.data('alpha') // => 'bravo'
   *
   *   processor.data() // => {alpha: 'bravo'}
   *
   *   processor.data({charlie: 'delta'})
   *
   *   processor.data() // => {charlie: 'delta'}
   *   ```
   *
   * @template {keyof Data} Key
   *
   * @overload
   * @returns {Data}
   *
   * @overload
   * @param {Data} dataset
   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
   *
   * @overload
   * @param {Key} key
   * @returns {Data[Key]}
   *
   * @overload
   * @param {Key} key
   * @param {Data[Key]} value
   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
   *
   * @param {Data | Key} [key]
   *   Key to get or set, or entire dataset to set, or nothing to get the
   *   entire dataset (optional).
   * @param {Data[Key]} [value]
   *   Value to set (optional).
   * @returns {unknown}
   *   The current processor when setting, the value at `key` when getting, or
   *   the entire dataset when getting without key.
   */
  data(key, value2) {
    if (typeof key === "string") {
      if (arguments.length === 2) {
        assertUnfrozen("data", this.frozen);
        this.namespace[key] = value2;
        return this;
      }
      return own.call(this.namespace, key) && this.namespace[key] || void 0;
    }
    if (key) {
      assertUnfrozen("data", this.frozen);
      this.namespace = key;
      return this;
    }
    return this.namespace;
  }
  /**
   * Freeze a processor.
   *
   * Frozen processors are meant to be extended and not to be configured
   * directly.
   *
   * When a processor is frozen it cannot be unfrozen.
   * New processors working the same way can be created by calling the
   * processor.
   *
   * It’s possible to freeze processors explicitly by calling `.freeze()`.
   * Processors freeze automatically when `.parse()`, `.run()`, `.runSync()`,
   * `.stringify()`, `.process()`, or `.processSync()` are called.
   *
   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
   *   The current processor.
   */
  freeze() {
    if (this.frozen) {
      return this;
    }
    const self2 = (
      /** @type {Processor} */
      /** @type {unknown} */
      this
    );
    while (++this.freezeIndex < this.attachers.length) {
      const [attacher, ...options] = this.attachers[this.freezeIndex];
      if (options[0] === false) {
        continue;
      }
      if (options[0] === true) {
        options[0] = void 0;
      }
      const transformer = attacher.call(self2, ...options);
      if (typeof transformer === "function") {
        this.transformers.use(transformer);
      }
    }
    this.frozen = true;
    this.freezeIndex = Number.POSITIVE_INFINITY;
    return this;
  }
  /**
   * Parse text to a syntax tree.
   *
   * > **Note**: `parse` freezes the processor if not already *frozen*.
   *
   * > **Note**: `parse` performs the parse phase, not the run phase or other
   * > phases.
   *
   * @param {Compatible | undefined} [file]
   *   file to parse (optional); typically `string` or `VFile`; any value
   *   accepted as `x` in `new VFile(x)`.
   * @returns {ParseTree extends undefined ? Node : ParseTree}
   *   Syntax tree representing `file`.
   */
  parse(file) {
    this.freeze();
    const realFile = vfile(file);
    const parser = this.parser || this.Parser;
    assertParser("parse", parser);
    return parser(String(realFile), realFile);
  }
  /**
   * Process the given file as configured on the processor.
   *
   * > **Note**: `process` freezes the processor if not already *frozen*.
   *
   * > **Note**: `process` performs the parse, run, and stringify phases.
   *
   * @overload
   * @param {Compatible | undefined} file
   * @param {ProcessCallback<VFileWithOutput<CompileResult>>} done
   * @returns {undefined}
   *
   * @overload
   * @param {Compatible | undefined} [file]
   * @returns {Promise<VFileWithOutput<CompileResult>>}
   *
   * @param {Compatible | undefined} [file]
   *   File (optional); typically `string` or `VFile`]; any value accepted as
   *   `x` in `new VFile(x)`.
   * @param {ProcessCallback<VFileWithOutput<CompileResult>> | undefined} [done]
   *   Callback (optional).
   * @returns {Promise<VFile> | undefined}
   *   Nothing if `done` is given.
   *   Otherwise a promise, rejected with a fatal error or resolved with the
   *   processed file.
   *
   *   The parsed, transformed, and compiled value is available at
   *   `file.value` (see note).
   *
   *   > **Note**: unified typically compiles by serializing: most
   *   > compilers return `string` (or `Uint8Array`).
   *   > Some compilers, such as the one configured with
   *   > [`rehype-react`][rehype-react], return other values (in this case, a
   *   > React tree).
   *   > If you’re using a compiler that doesn’t serialize, expect different
   *   > result values.
   *   >
   *   > To register custom results in TypeScript, add them to
   *   > {@linkcode CompileResultMap}.
   *
   *   [rehype-react]: https://github.com/rehypejs/rehype-react
   */
  process(file, done) {
    const self2 = this;
    this.freeze();
    assertParser("process", this.parser || this.Parser);
    assertCompiler("process", this.compiler || this.Compiler);
    return done ? executor(void 0, done) : new Promise(executor);
    function executor(resolve2, reject) {
      const realFile = vfile(file);
      const parseTree = (
        /** @type {HeadTree extends undefined ? Node : HeadTree} */
        /** @type {unknown} */
        self2.parse(realFile)
      );
      self2.run(parseTree, realFile, function(error2, tree, file2) {
        if (error2 || !tree || !file2) {
          return realDone(error2);
        }
        const compileTree = (
          /** @type {CompileTree extends undefined ? Node : CompileTree} */
          /** @type {unknown} */
          tree
        );
        const compileResult = self2.stringify(compileTree, file2);
        if (looksLikeAValue(compileResult)) {
          file2.value = compileResult;
        } else {
          file2.result = compileResult;
        }
        realDone(
          error2,
          /** @type {VFileWithOutput<CompileResult>} */
          file2
        );
      });
      function realDone(error2, file2) {
        if (error2 || !file2) {
          reject(error2);
        } else if (resolve2) {
          resolve2(file2);
        } else {
          done(void 0, file2);
        }
      }
    }
  }
  /**
   * Process the given file as configured on the processor.
   *
   * An error is thrown if asynchronous transforms are configured.
   *
   * > **Note**: `processSync` freezes the processor if not already *frozen*.
   *
   * > **Note**: `processSync` performs the parse, run, and stringify phases.
   *
   * @param {Compatible | undefined} [file]
   *   File (optional); typically `string` or `VFile`; any value accepted as
   *   `x` in `new VFile(x)`.
   * @returns {VFileWithOutput<CompileResult>}
   *   The processed file.
   *
   *   The parsed, transformed, and compiled value is available at
   *   `file.value` (see note).
   *
   *   > **Note**: unified typically compiles by serializing: most
   *   > compilers return `string` (or `Uint8Array`).
   *   > Some compilers, such as the one configured with
   *   > [`rehype-react`][rehype-react], return other values (in this case, a
   *   > React tree).
   *   > If you’re using a compiler that doesn’t serialize, expect different
   *   > result values.
   *   >
   *   > To register custom results in TypeScript, add them to
   *   > {@linkcode CompileResultMap}.
   *
   *   [rehype-react]: https://github.com/rehypejs/rehype-react
   */
  processSync(file) {
    let complete = false;
    let result;
    this.freeze();
    assertParser("processSync", this.parser || this.Parser);
    assertCompiler("processSync", this.compiler || this.Compiler);
    this.process(file, realDone);
    assertDone("processSync", "process", complete);
    return result;
    function realDone(error2, file2) {
      complete = true;
      bail(error2);
      result = file2;
    }
  }
  /**
   * Run *transformers* on a syntax tree.
   *
   * > **Note**: `run` freezes the processor if not already *frozen*.
   *
   * > **Note**: `run` performs the run phase, not other phases.
   *
   * @overload
   * @param {HeadTree extends undefined ? Node : HeadTree} tree
   * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done
   * @returns {undefined}
   *
   * @overload
   * @param {HeadTree extends undefined ? Node : HeadTree} tree
   * @param {Compatible | undefined} file
   * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done
   * @returns {undefined}
   *
   * @overload
   * @param {HeadTree extends undefined ? Node : HeadTree} tree
   * @param {Compatible | undefined} [file]
   * @returns {Promise<TailTree extends undefined ? Node : TailTree>}
   *
   * @param {HeadTree extends undefined ? Node : HeadTree} tree
   *   Tree to transform and inspect.
   * @param {(
   *   RunCallback<TailTree extends undefined ? Node : TailTree> |
   *   Compatible
   * )} [file]
   *   File associated with `node` (optional); any value accepted as `x` in
   *   `new VFile(x)`.
   * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} [done]
   *   Callback (optional).
   * @returns {Promise<TailTree extends undefined ? Node : TailTree> | undefined}
   *   Nothing if `done` is given.
   *   Otherwise, a promise rejected with a fatal error or resolved with the
   *   transformed tree.
   */
  run(tree, file, done) {
    assertNode(tree);
    this.freeze();
    const transformers = this.transformers;
    if (!done && typeof file === "function") {
      done = file;
      file = void 0;
    }
    return done ? executor(void 0, done) : new Promise(executor);
    function executor(resolve2, reject) {
      const realFile = vfile(file);
      transformers.run(tree, realFile, realDone);
      function realDone(error2, outputTree, file2) {
        const resultingTree = (
          /** @type {TailTree extends undefined ? Node : TailTree} */
          outputTree || tree
        );
        if (error2) {
          reject(error2);
        } else if (resolve2) {
          resolve2(resultingTree);
        } else {
          done(void 0, resultingTree, file2);
        }
      }
    }
  }
  /**
   * Run *transformers* on a syntax tree.
   *
   * An error is thrown if asynchronous transforms are configured.
   *
   * > **Note**: `runSync` freezes the processor if not already *frozen*.
   *
   * > **Note**: `runSync` performs the run phase, not other phases.
   *
   * @param {HeadTree extends undefined ? Node : HeadTree} tree
   *   Tree to transform and inspect.
   * @param {Compatible | undefined} [file]
   *   File associated with `node` (optional); any value accepted as `x` in
   *   `new VFile(x)`.
   * @returns {TailTree extends undefined ? Node : TailTree}
   *   Transformed tree.
   */
  runSync(tree, file) {
    let complete = false;
    let result;
    this.run(tree, file, realDone);
    assertDone("runSync", "run", complete);
    return result;
    function realDone(error2, tree2) {
      bail(error2);
      result = tree2;
      complete = true;
    }
  }
  /**
   * Compile a syntax tree.
   *
   * > **Note**: `stringify` freezes the processor if not already *frozen*.
   *
   * > **Note**: `stringify` performs the stringify phase, not the run phase
   * > or other phases.
   *
   * @param {CompileTree extends undefined ? Node : CompileTree} tree
   *   Tree to compile.
   * @param {Compatible | undefined} [file]
   *   File associated with `node` (optional); any value accepted as `x` in
   *   `new VFile(x)`.
   * @returns {CompileResult extends undefined ? Value : CompileResult}
   *   Textual representation of the tree (see note).
   *
   *   > **Note**: unified typically compiles by serializing: most compilers
   *   > return `string` (or `Uint8Array`).
   *   > Some compilers, such as the one configured with
   *   > [`rehype-react`][rehype-react], return other values (in this case, a
   *   > React tree).
   *   > If you’re using a compiler that doesn’t serialize, expect different
   *   > result values.
   *   >
   *   > To register custom results in TypeScript, add them to
   *   > {@linkcode CompileResultMap}.
   *
   *   [rehype-react]: https://github.com/rehypejs/rehype-react
   */
  stringify(tree, file) {
    this.freeze();
    const realFile = vfile(file);
    const compiler2 = this.compiler || this.Compiler;
    assertCompiler("stringify", compiler2);
    assertNode(tree);
    return compiler2(tree, realFile);
  }
  /**
   * Configure the processor to use a plugin, a list of usable values, or a
   * preset.
   *
   * If the processor is already using a plugin, the previous plugin
   * configuration is changed based on the options that are passed in.
   * In other words, the plugin is not added a second time.
   *
   * > **Note**: `use` cannot be called on *frozen* processors.
   * > Call the processor first to create a new unfrozen processor.
   *
   * @example
   *   There are many ways to pass plugins to `.use()`.
   *   This example gives an overview:
   *
   *   ```js
   *   import {unified} from 'unified'
   *
   *   unified()
   *     // Plugin with options:
   *     .use(pluginA, {x: true, y: true})
   *     // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):
   *     .use(pluginA, {y: false, z: true})
   *     // Plugins:
   *     .use([pluginB, pluginC])
   *     // Two plugins, the second with options:
   *     .use([pluginD, [pluginE, {}]])
   *     // Preset with plugins and settings:
   *     .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})
   *     // Settings only:
   *     .use({settings: {position: false}})
   *   ```
   *
   * @template {Array<unknown>} [Parameters=[]]
   * @template {Node | string | undefined} [Input=undefined]
   * @template [Output=Input]
   *
   * @overload
   * @param {Preset | null | undefined} [preset]
   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
   *
   * @overload
   * @param {PluggableList} list
   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
   *
   * @overload
   * @param {Plugin<Parameters, Input, Output>} plugin
   * @param {...(Parameters | [boolean])} parameters
   * @returns {UsePlugin<ParseTree, HeadTree, TailTree, CompileTree, CompileResult, Input, Output>}
   *
   * @param {PluggableList | Plugin | Preset | null | undefined} value
   *   Usable value.
   * @param {...unknown} parameters
   *   Parameters, when a plugin is given as a usable value.
   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
   *   Current processor.
   */
  use(value2, ...parameters) {
    const attachers = this.attachers;
    const namespace = this.namespace;
    assertUnfrozen("use", this.frozen);
    if (value2 === null || value2 === void 0)
      ;
    else if (typeof value2 === "function") {
      addPlugin(value2, parameters);
    } else if (typeof value2 === "object") {
      if (Array.isArray(value2)) {
        addList(value2);
      } else {
        addPreset(value2);
      }
    } else {
      throw new TypeError("Expected usable value, not `" + value2 + "`");
    }
    return this;
    function add2(value3) {
      if (typeof value3 === "function") {
        addPlugin(value3, []);
      } else if (typeof value3 === "object") {
        if (Array.isArray(value3)) {
          const [plugin, ...parameters2] = (
            /** @type {PluginTuple<Array<unknown>>} */
            value3
          );
          addPlugin(plugin, parameters2);
        } else {
          addPreset(value3);
        }
      } else {
        throw new TypeError("Expected usable value, not `" + value3 + "`");
      }
    }
    function addPreset(result) {
      if (!("plugins" in result) && !("settings" in result)) {
        throw new Error(
          "Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither"
        );
      }
      addList(result.plugins);
      if (result.settings) {
        namespace.settings = extend$1(true, namespace.settings, result.settings);
      }
    }
    function addList(plugins) {
      let index2 = -1;
      if (plugins === null || plugins === void 0)
        ;
      else if (Array.isArray(plugins)) {
        while (++index2 < plugins.length) {
          const thing = plugins[index2];
          add2(thing);
        }
      } else {
        throw new TypeError("Expected a list of plugins, not `" + plugins + "`");
      }
    }
    function addPlugin(plugin, parameters2) {
      let index2 = -1;
      let entryIndex = -1;
      while (++index2 < attachers.length) {
        if (attachers[index2][0] === plugin) {
          entryIndex = index2;
          break;
        }
      }
      if (entryIndex === -1) {
        attachers.push([plugin, ...parameters2]);
      } else if (parameters2.length > 0) {
        let [primary, ...rest] = parameters2;
        const currentPrimary = attachers[entryIndex][1];
        if (isPlainObject2(currentPrimary) && isPlainObject2(primary)) {
          primary = extend$1(true, currentPrimary, primary);
        }
        attachers[entryIndex] = [plugin, primary, ...rest];
      }
    }
  }
}
const unified = new Processor().freeze();
function assertParser(name2, value2) {
  if (typeof value2 !== "function") {
    throw new TypeError("Cannot `" + name2 + "` without `parser`");
  }
}
function assertCompiler(name2, value2) {
  if (typeof value2 !== "function") {
    throw new TypeError("Cannot `" + name2 + "` without `compiler`");
  }
}
function assertUnfrozen(name2, frozen) {
  if (frozen) {
    throw new Error(
      "Cannot call `" + name2 + "` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`."
    );
  }
}
function assertNode(node2) {
  if (!isPlainObject2(node2) || typeof node2.type !== "string") {
    throw new TypeError("Expected node, got `" + node2 + "`");
  }
}
function assertDone(name2, asyncName, complete) {
  if (!complete) {
    throw new Error(
      "`" + name2 + "` finished async. Use `" + asyncName + "` instead"
    );
  }
}
function vfile(value2) {
  return looksLikeAVFile(value2) ? value2 : new VFile(value2);
}
function looksLikeAVFile(value2) {
  return Boolean(
    value2 && typeof value2 === "object" && "message" in value2 && "messages" in value2
  );
}
function looksLikeAValue(value2) {
  return typeof value2 === "string" || isUint8Array(value2);
}
function isUint8Array(value2) {
  return Boolean(
    value2 && typeof value2 === "object" && "byteLength" in value2 && "byteOffset" in value2
  );
}
const changelog = "https://github.com/remarkjs/react-markdown/blob/main/changelog.md";
const emptyPlugins = [];
const emptyRemarkRehypeOptions = { allowDangerousHtml: true };
const safeProtocol = /^(https?|ircs?|mailto|xmpp)$/i;
const deprecations = [
  { from: "astPlugins", id: "remove-buggy-html-in-markdown-parser" },
  { from: "allowDangerousHtml", id: "remove-buggy-html-in-markdown-parser" },
  {
    from: "allowNode",
    id: "replace-allownode-allowedtypes-and-disallowedtypes",
    to: "allowElement"
  },
  {
    from: "allowedTypes",
    id: "replace-allownode-allowedtypes-and-disallowedtypes",
    to: "allowedElements"
  },
  { from: "className", id: "remove-classname" },
  {
    from: "disallowedTypes",
    id: "replace-allownode-allowedtypes-and-disallowedtypes",
    to: "disallowedElements"
  },
  { from: "escapeHtml", id: "remove-buggy-html-in-markdown-parser" },
  { from: "includeElementIndex", id: "#remove-includeelementindex" },
  {
    from: "includeNodeIndex",
    id: "change-includenodeindex-to-includeelementindex"
  },
  { from: "linkTarget", id: "remove-linktarget" },
  { from: "plugins", id: "change-plugins-to-remarkplugins", to: "remarkPlugins" },
  { from: "rawSourcePos", id: "#remove-rawsourcepos" },
  { from: "renderers", id: "change-renderers-to-components", to: "components" },
  { from: "source", id: "change-source-to-children", to: "children" },
  { from: "sourcePos", id: "#remove-sourcepos" },
  { from: "transformImageUri", id: "#add-urltransform", to: "urlTransform" },
  { from: "transformLinkUri", id: "#add-urltransform", to: "urlTransform" }
];
function Markdown(options) {
  const processor = createProcessor(options);
  const file = createFile(options);
  return post(processor.runSync(processor.parse(file), file), options);
}
function createProcessor(options) {
  const rehypePlugins = options.rehypePlugins || emptyPlugins;
  const remarkPlugins = options.remarkPlugins || emptyPlugins;
  const remarkRehypeOptions = options.remarkRehypeOptions ? { ...options.remarkRehypeOptions, ...emptyRemarkRehypeOptions } : emptyRemarkRehypeOptions;
  const processor = unified().use(remarkParse).use(remarkPlugins).use(remarkRehype, remarkRehypeOptions).use(rehypePlugins);
  return processor;
}
function createFile(options) {
  const children = options.children || "";
  const file = new VFile();
  if (typeof children === "string") {
    file.value = children;
  }
  return file;
}
function post(tree, options) {
  const allowedElements = options.allowedElements;
  const allowElement = options.allowElement;
  const components2 = options.components;
  const disallowedElements = options.disallowedElements;
  const skipHtml = options.skipHtml;
  const unwrapDisallowed = options.unwrapDisallowed;
  const urlTransform = options.urlTransform || defaultUrlTransform;
  for (const deprecation of deprecations) {
    if (Object.hasOwn(options, deprecation.from)) {
      unreachable(
        "Unexpected `" + deprecation.from + "` prop, " + (deprecation.to ? "use `" + deprecation.to + "` instead" : "remove it") + " (see <" + changelog + "#" + deprecation.id + "> for more info)"
      );
    }
  }
  visit(tree, transform2);
  return toJsxRuntime(tree, {
    Fragment: jsxRuntimeExports.Fragment,
    components: components2,
    ignoreInvalidStyle: true,
    jsx: jsxRuntimeExports.jsx,
    jsxs: jsxRuntimeExports.jsxs,
    passKeys: true,
    passNode: true
  });
  function transform2(node2, index2, parent) {
    if (node2.type === "raw" && parent && typeof index2 === "number") {
      if (skipHtml) {
        parent.children.splice(index2, 1);
      } else {
        parent.children[index2] = { type: "text", value: node2.value };
      }
      return index2;
    }
    if (node2.type === "element") {
      let key;
      for (key in urlAttributes) {
        if (Object.hasOwn(urlAttributes, key) && Object.hasOwn(node2.properties, key)) {
          const value2 = node2.properties[key];
          const test2 = urlAttributes[key];
          if (test2 === null || test2.includes(node2.tagName)) {
            node2.properties[key] = urlTransform(String(value2 || ""), key, node2);
          }
        }
      }
    }
    if (node2.type === "element") {
      let remove = allowedElements ? !allowedElements.includes(node2.tagName) : disallowedElements ? disallowedElements.includes(node2.tagName) : false;
      if (!remove && allowElement && typeof index2 === "number") {
        remove = !allowElement(node2, index2, parent);
      }
      if (remove && parent && typeof index2 === "number") {
        if (unwrapDisallowed && node2.children) {
          parent.children.splice(index2, 1, ...node2.children);
        } else {
          parent.children.splice(index2, 1);
        }
        return index2;
      }
    }
  }
}
function defaultUrlTransform(value2) {
  const colon = value2.indexOf(":");
  const questionMark = value2.indexOf("?");
  const numberSign = value2.indexOf("#");
  const slash = value2.indexOf("/");
  if (
    // If there is no protocol, it’s relative.
    colon === -1 || // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.
    slash !== -1 && colon > slash || questionMark !== -1 && colon > questionMark || numberSign !== -1 && colon > numberSign || // It is a protocol, it should be allowed.
    safeProtocol.test(value2.slice(0, colon))
  ) {
    return value2;
  }
  return "";
}
var DependentComponentIds = /* @__PURE__ */ ((DependentComponentIds2) => {
  DependentComponentIds2["FFMpeg"] = "364e3884-4c6f-446f-b72c-1ec84e8da2c2";
  DependentComponentIds2["Lux"] = "6cb4ac7f-f60d-45c9-86bc-a48918623654";
  DependentComponentIds2["BakabaseUpdater"] = "274f8ab5-a0a6-4415-8466-137d986d3ddb";
  return DependentComponentIds2;
})(DependentComponentIds || {});
const AppInfo = ({ appInfo }) => {
  var _a2;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [newVersion, setNewVersion] = reactExports.useState();
  const appUpdaterState = useAppUpdaterStateStore((state) => state);
  (_a2 = useDependentComponentContextsStore(
    (state) => state.contexts
  )) == null ? void 0 : _a2.find((s2) => s2.id == DependentComponentIds.BakabaseUpdater);
  const checkNewAppVersion = () => {
    BApi$1.updater.getNewAppVersion().then((a2) => {
      setNewVersion(a2.data || {});
    });
  };
  reactExports.useEffect(() => {
    checkNewAppVersion();
    return () => {
    };
  }, []);
  const renderNewVersion = () => {
    var _a3;
    switch (appUpdaterState.status) {
      case UpdaterStatus.UpToDate:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", variant: "light", color: "default", children: t2("Up-to-date") });
      case UpdaterStatus.Idle:
        if (newVersion) {
          if (newVersion.version) {
            return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", variant: "light", children: newVersion.version }),
              newVersion.changelog && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "vertical" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    color: "secondary",
                    size: "small",
                    variant: "light",
                    onPress: () => {
                      createPortal(Modal, {
                        size: "xl",
                        title: newVersion.version,
                        defaultVisible: true,
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(Markdown, { components: { a: (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(ExternalLink, { ...props, target: "_blank" }) }, children: newVersion.changelog }),
                        footer: { actions: ["cancel"] }
                      });
                    },
                    children: t2("Change log")
                  }
                )
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "vertical" }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: "success",
                  size: "small",
                  variant: "light",
                  onClick: () => {
                    BApi$1.updater.startUpdatingApp();
                  },
                  children: t2("Click to auto-update")
                }
              ),
              ((_a3 = newVersion.installers) == null ? void 0 : _a3.length) > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "vertical" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  PopoverComponent,
                  {
                    trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", size: "sm", variant: "light", children: t2(
                      "Auto-Update Fails? Click to download complete installers"
                    ) }),
                    children: newVersion.installers.map((i2) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(ExternalLink, { href: i2.url, children: [
                      i2.name,
                      "(",
                      bytesToSize(i2.size),
                      ")"
                    ] }) }, i2.url))
                  }
                )
              ] }) : void 0
            ] });
          } else {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", variant: "light", color: "default", children: t2("Up-to-date") });
          }
        } else {
          return t2("Failed to get latest version");
        }
      case UpdaterStatus.Running:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          progress_default,
          {
            showValueLabel: true,
            className: "w-[200px] pl-3",
            size: "sm",
            value: appUpdaterState.percentage,
            label: `${t2("Downloading")} ${(newVersion == null ? void 0 : newVersion.version) ?? ""}`
          }
        );
      case UpdaterStatus.PendingRestart:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            size: "small",
            color: "primary",
            onClick: () => {
              BApi$1.updater.restartAndUpdateApp();
            },
            children: t2("Restart to update")
          }
        );
      case UpdaterStatus.Failed:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          t2("Failed to update app"),
          ":",
          " ",
          t2(appUpdaterState.error),
          " ",
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              variant: "light",
              color: "primary",
              onClick: () => {
                BApi$1.updater.startUpdatingApp();
              },
              children: t2("Click here to retry")
            }
          )
        ] });
      default:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { type: "loading" });
    }
  };
  const buildAppInfoDataSource = () => [
    {
      label: "App Data Path",
      tip: "This is where core data files stored and DO NOT change them if not necessary.",
      value: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          color: "primary",
          variant: "light",
          onClick: () => BApi$1.tool.openFileOrDirectory({ path: appInfo.appDataPath }),
          children: appInfo.appDataPath
        }
      )
      // value: <Snippet hideSymbol>{appInfo.appDataPath}</Snippet>,
    },
    {
      label: "Temporary files path",
      tip: "It's a directory where temporary files stored, such as cover files, etc.",
      value: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          color: "primary",
          variant: "light",
          onClick: () => BApi$1.tool.openFileOrDirectory({ path: appInfo.tempFilesPath }),
          children: appInfo.tempFilesPath
        }
      )
    },
    {
      label: "Log Path",
      tip: "Detailed information which describing the running states of app. You can send log files to developer if the app is not running normally, and you can delete them also if everything is ok.",
      value: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          color: "primary",
          variant: "light",
          onClick: () => BApi$1.tool.openFileOrDirectory({ path: appInfo.logPath }),
          children: appInfo.logPath
        }
      )
    },
    {
      label: "Backup Path",
      tip: "A data backup will be created when using the new version of app first time, you can delete them if everything is ok.",
      value: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          color: "primary",
          variant: "light",
          onClick: () => BApi$1.tool.openFileOrDirectory({ path: appInfo.backupPath }),
          children: appInfo.backupPath
        }
      )
    },
    {
      label: "Core Version",
      value: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", variant: "light", children: appInfo.coreVersion })
    },
    {
      label: "Latest version",
      value: renderNewVersion()
    }
  ].map((x2) => ({ ...x2, label: t2(x2.label), tip: t2(x2.tip) }));
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "settings", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isCompact: true, removeWrapper: true, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 200, children: t2("System information") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: " " })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: buildAppInfoDataSource().map((c2, i2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        table_row_default,
        {
          className: "hover:bg-[var(--bakaui-overlap-background)]",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { display: "flex", alignItems: "center" }, children: c2.tip ? /* @__PURE__ */ jsxRuntimeExports.jsx(
              Tooltip$1,
              {
                color: "secondary",
                content: t2(c2.tip),
                placement: "top",
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                  t2(c2.label),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineQuestionCircle, { className: "text-base" })
                ] })
              }
            ) : t2(c2.label) }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: c2.value })
          ]
        },
        i2
      );
    }) })
  ] }) }) });
};
AppInfo.displayName = "AppInfo";
const github = "https://github.com/Bakabase/InsideWorld";
const urls = {
  Github: github
};
const contacts = [
  {
    label: "Github",
    value: (
      // <ExternalLink to={Urls.Github}>
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          color: "default",
          size: "sm",
          onClick: () => {
            BApi$1.gui.openUrlInDefaultBrowser({ url: urls.Github });
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$D, { className: "text-lg" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold", children: "Github" })
          ]
        }
      )
    )
  },
  {
    label: "QQ",
    value: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: qqGroupImg })
  }
  // {
  //   label: 'WeChat',
  //   value: <ExternalLink to={Urls.WeChatQrCode}>Github</ExternalLink>,
  // },
];
const ContactUs = () => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "settings", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isCompact: true, removeWrapper: true, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 200, children: t2("Contact us") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: " " })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: contacts.map((c2, i2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        table_row_default,
        {
          className: "hover:bg-[var(--bakaui-overlap-background)]",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: t2(c2.label) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: c2.value })
          ]
        },
        i2
      );
    }) })
  ] }) }) });
};
ContactUs.displayName = "ContactUs";
const Functional = ({
  applyPatches = () => {
  }
}) => {
  const { t: t2 } = useTranslation();
  const appOptions = useAppOptionsStore((state) => state.data);
  const uiOptions = useUiOptionsStore((state) => state.data);
  const functionSettings = [
    {
      label: "Startup page",
      renderCell: () => {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          radio_group_default,
          {
            orientation: "horizontal",
            size: "sm",
            value: String(uiOptions.startupPage),
            onValueChange: (v2) => {
              applyPatches(BApi$1.options.patchUiOptions, {
                startupPage: Number(v2)
              });
            },
            children: startupPages.map((s2) => {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: String(s2.value), children: t2(s2.label) }, s2.value);
            })
          }
        );
      }
    },
    {
      label: "Exit behavior",
      renderCell: () => {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          radio_group_default,
          {
            orientation: "horizontal",
            size: "sm",
            value: String(appOptions.closeBehavior),
            onValueChange: (v2) => {
              applyPatches(BApi$1.options.patchAppOptions, {
                closeBehavior: Number(v2)
              });
            },
            children: [
              CloseBehavior.Minimize,
              CloseBehavior.Exit,
              CloseBehavior.Prompt
            ].map((c2) => /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: String(c2), children: t2(CloseBehavior[c2]) }, c2))
          }
        );
      }
    }
  ];
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "settings", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { removeWrapper: true, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 200, children: t2("Functional configurations") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: " " })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: functionSettings.map((c2, i2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        table_row_default,
        {
          className: "hover:bg-[var(--bakaui-overlap-background)]",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { display: "flex", alignItems: "center" }, children: c2.tip ? /* @__PURE__ */ jsxRuntimeExports.jsx(
              tooltip_default,
              {
                color: "secondary",
                content: t2(c2.tip),
                placement: "top",
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                  t2(c2.label),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineQuestionCircle, { className: "text-base" })
                ] })
              }
            ) : t2(c2.label) }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: c2.renderCell() })
          ]
        },
        i2
      );
    }) })
  ] }) }) });
};
Functional.displayName = "Functional";
const Others = ({
  applyPatches = () => {
  }
}) => {
  var _a2, _b2;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const appOptions = useAppOptionsStore((state) => state.data);
  const networkOptions = useNetworkOptionsStore((state) => state.data);
  const appContext = useAppContextStore();
  const proxies = [
    {
      label: t2("Do not use proxy"),
      value: 0 .toString()
    },
    {
      label: t2("Use system proxy"),
      value: 1 .toString()
    },
    ...((_a2 = networkOptions.customProxies) == null ? void 0 : _a2.map((c2) => ({
      label: c2.address,
      value: c2.id
    }))) ?? []
  ];
  let selectedProxy;
  if (networkOptions == null ? void 0 : networkOptions.proxy) {
    const p2 = networkOptions.proxy;
    if (p2.mode == 2) {
      selectedProxy = p2.customProxyId;
    } else {
      selectedProxy = (_b2 = p2.mode) == null ? void 0 : _b2.toString();
    }
  }
  selectedProxy ?? (selectedProxy = 0 .toString());
  const otherSettings = [
    {
      label: "Proxy",
      tip: "You can set a proxy for network requests, such as socks5://127.0.0.1:18888",
      renderValue: () => {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { width: 300 }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Select,
            {
              dataSource: proxies,
              multiple: false,
              selectedKeys: selectedProxy == void 0 ? void 0 : [selectedProxy],
              size: "sm",
              onSelectionChange: (keys2) => {
                const key = Array.from(keys2)[0];
                const patches = {};
                if (key == 0 .toString()) {
                  patches.proxy = {
                    mode: 0,
                    customProxyId: void 0
                  };
                } else {
                  if (key == 1 .toString()) {
                    patches.proxy = {
                      mode: 1,
                      customProxyId: void 0
                    };
                  } else {
                    patches.proxy = {
                      mode: 2,
                      customProxyId: key
                    };
                  }
                }
                console.log(key, keys2, patches);
                BApi$1.options.patchNetworkOptions(patches).then((x2) => {
                  if (!x2.code) {
                    Vt.success(t2("Saved"));
                  }
                });
              }
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              size: "sm",
              onClick: () => {
                let p2;
                createPortal(Modal, {
                  defaultVisible: true,
                  size: "lg",
                  title: t2("Add a proxy"),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                    input_default,
                    {
                      placeholder: t2(
                        "You can set a proxy for network requests, such as socks5://127.0.0.1:18888"
                      ),
                      onValueChange: (v2) => p2 = v2
                    }
                  ),
                  onOk: async () => {
                    if (p2 == void 0 || p2.length == 0) {
                      Vt.error(t2("Invalid Data"));
                      throw new Error("Invalid data");
                    }
                    await BApi$1.options.patchNetworkOptions({
                      customProxies: [
                        ...networkOptions.customProxies ?? [],
                        { address: p2 }
                      ]
                    });
                  }
                });
              },
              children: t2("Add")
            }
          )
        ] });
      }
    },
    {
      label: "Enable pre-release channel",
      tip: "Prefer pre-release version which has new features but less stability",
      renderValue: () => {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          switch_default,
          {
            isSelected: appOptions.enablePreReleaseChannel,
            size: "sm",
            onValueChange: (checked) => {
              applyPatches(
                BApi$1.options.patchAppOptions,
                {
                  enablePreReleaseChannel: checked
                },
                () => {
                }
              );
            }
          }
        );
      }
    },
    {
      label: "Enable anonymous data tracking",
      tip: "We are using Microsoft Clarity to track anonymous data, which will help us to improve our product experience.",
      renderValue: () => {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          switch_default,
          {
            isSelected: appOptions.enableAnonymousDataTracking,
            size: "sm",
            onValueChange: (checked) => {
              applyPatches(
                BApi$1.options.patchAppOptions,
                {
                  enableAnonymousDataTracking: checked
                },
                () => {
                }
              );
            }
          }
        );
      }
    }
  ];
  switch (appContext.runtimeMode) {
    case RuntimeMode.Dev:
    case RuntimeMode.WinForms:
      otherSettings.push(
        ...[
          {
            label: "Listening port count",
            tip: "You can configure the number of listening ports. The more listening ports you set, the more it helps with parallel processing of interface‑related operations. It’s recommended not to exceed the number of CPU cores. In most cases, you can just ignore this setting. If you leave it as empty and listening ports are not specified, we'll use a default value.",
            renderValue: () => {
              const min2 = 0;
              const max2 = 3;
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                EditableValue,
                {
                  Editor: (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
                    number_input_default,
                    {
                      isClearable: true,
                      className: "max-w-[320px]",
                      description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                          "Current listening port count is {{port}}",
                          {
                            port: appOptions.autoListeningPortCount == 0 ? t2("Auto") : appOptions.autoListeningPortCount
                          }
                        ) }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                          "The configurable port range is {{min}}-{{max}}. And you can set it to 0 for auto count.",
                          {
                            min: min2,
                            max: max2
                          }
                        ) }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                          "Changes will take effect after restarting the application"
                        ) }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                          "Please be careful when setting this value, if you set it to a value that is already in use by another application, our application will not be able to start."
                        ) })
                      ] }),
                      formatOptions: { useGrouping: false },
                      max: max2,
                      min: min2,
                      placeholder: t2("Count"),
                      ...props
                    }
                  ),
                  Viewer: ({ value: value2, ...props }) => value2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Chip,
                    {
                      radius: "sm",
                      startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineNumber, { className: "text-base" }),
                      variant: "flat",
                      ...props,
                      children: value2
                    }
                  ) : null,
                  value: appOptions.autoListeningPortCount,
                  onSubmit: async (v2) => {
                    await BApi$1.options.patchAppOptions({
                      autoListeningPortCount: v2
                    });
                    Vt.success(t2("Saved"));
                  }
                }
              );
            }
          },
          {
            label: "Listening ports",
            tip: "You can set fixed listening ports.",
            renderValue: () => {
              const toText = (ports) => (ports == null ? void 0 : ports.length) ? ports.join(", ") : "";
              const parsePorts = (text2) => {
                const raw = (text2 ?? "").split(/[，,\s]+/).map((s2) => s2.trim()).filter((s2) => s2.length > 0);
                const nums = raw.map((s2) => Number.parseInt(s2, 10)).filter((n2) => Number.isFinite(n2) && n2 > 0 && n2 <= 65535);
                const seen2 = /* @__PURE__ */ new Set();
                const unique = [];
                for (const n2 of nums) {
                  if (!seen2.has(n2)) {
                    seen2.add(n2);
                    unique.push(n2);
                  }
                }
                return unique;
              };
              const max2 = 6;
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                EditableValue,
                {
                  Editor: (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
                    input_default,
                    {
                      isClearable: true,
                      className: "max-w-[420px]",
                      description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                          "Enter ports separated by commas, e.g. 34567, 34568"
                        ) }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                          "Changes will take effect after restarting the application"
                        ) }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                          "Please be careful when setting this value, if you set it to a value that is already in use by another application, our application will not be able to start."
                        ) })
                      ] }),
                      placeholder: t2("e.g. 34567, 34568"),
                      ...props
                    }
                  ),
                  Viewer: ({ value: value2 }) => {
                    const ports = parsePorts(value2);
                    if (ports && ports.length > 0) {
                      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-2", children: parsePorts(value2).map((p2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
                        Chip,
                        {
                          radius: "sm",
                          startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineNumber, { className: "text-base" }),
                          variant: "flat",
                          children: p2
                        },
                        p2
                      )) });
                    }
                    return null;
                  },
                  value: toText(appOptions.listeningPorts),
                  onSubmit: async (text2) => {
                    const ports = parsePorts(text2);
                    if (ports.length > max2) {
                      Vt.error(
                        t2(
                          "Too many ports. Up to {{max}} ports are supported.",
                          {
                            max: max2
                          }
                        )
                      );
                      throw new Error("invalid");
                    }
                    await BApi$1.options.patchAppOptions({
                      listeningPorts: ports
                    });
                    Vt.success(t2("Saved"));
                  }
                }
              );
            }
          }
        ]
      );
      break;
    case RuntimeMode.Docker:
      break;
  }
  if (appContext.apiEndpoints)
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "settings", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { removeWrapper: true, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 200, children: t2("Other settings") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: " " })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: otherSettings.map((c2, i2) => {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(
          table_row_default,
          {
            className: "hover:bg-[var(--bakaui-overlap-background)]",
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                "div",
                {
                  style: {
                    display: "flex",
                    alignItems: "center"
                  },
                  children: c2.tip ? /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Tooltip$1,
                    {
                      className: "max-w-[300px]",
                      color: "secondary",
                      content: t2(c2.tip),
                      placement: "top",
                      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                        t2(c2.label),
                        /* @__PURE__ */ jsxRuntimeExports.jsx(
                          AiOutlineQuestionCircle,
                          {
                            className: "text-base"
                          }
                        )
                      ] })
                    }
                  ) : t2(c2.label)
                }
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: c2.renderValue() })
            ]
          },
          i2
        );
      }) })
    ] }) }) });
};
Others.displayName = "Others";
const Development = () => {
  var _a2;
  const { t: t2 } = useTranslation();
  const appContext = useAppContextStore((state) => state);
  const apiDocumentUrl = appContext.apiEndpoint ? `${appContext.apiEndpoint}/swagger` : void 0;
  const items = [
    {
      label: "API endpoints",
      tip: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        t2("Listening addresses:"),
        appContext.listeningAddresses.map((addr) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: addr });
        })
      ] }),
      value: appContext.apiEndpoints && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1 items-center", children: (_a2 = appContext.apiEndpoints) == null ? void 0 : _a2.map((x2) => /* @__PURE__ */ jsxRuntimeExports.jsx(snippet_default, { size: "sm", symbol: /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: " " }), variant: "flat", children: x2 })) })
    },
    {
      label: "API document",
      value: apiDocumentUrl && /* @__PURE__ */ jsxRuntimeExports.jsx(ExternalLink, { href: apiDocumentUrl, children: apiDocumentUrl })
    }
  ];
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isCompact: true, removeWrapper: true, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 200, children: t2("Development") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: " " })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: items.map((c2, i2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        table_row_default,
        {
          className: "hover:bg-[var(--bakaui-overlap-background)]",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: c2.tip ? /* @__PURE__ */ jsxRuntimeExports.jsx(
              Tooltip$1,
              {
                color: "secondary",
                content: t2(c2.tip),
                placement: "top",
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                  t2(c2.label),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineQuestionCircle, { className: "text-base" })
                ] })
              }
            ) : t2(c2.label) }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: c2.value })
          ]
        },
        i2
      );
    }) })
  ] });
};
Development.displayName = "Development";
const ConfigurationPage = function(props) {
  const { t: t2 } = useTranslation();
  const [appInfo, setAppInfo] = reactExports.useState({});
  reactExports.useEffect(() => {
    BApi$1.app.getAppInfo().then((a2) => {
      setAppInfo(a2.data || {});
    });
  }, []);
  const applyPatches = (API, patches = {}, success = (rsp) => {
  }) => {
    API(patches).then((a2) => {
      if (!a2.code) {
        Vt.success(t2("Saved"));
        success(a2);
      }
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "configuration-page", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(Dependency, {}),
    /* @__PURE__ */ jsxRuntimeExports.jsx(Functional, { applyPatches }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(Others, { applyPatches }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(AppInfo, { appInfo }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(Development, {}),
    /* @__PURE__ */ jsxRuntimeExports.jsx(ContactUs, {})
  ] });
};
function ThirdPartyConfigurationPage() {
  const { t: t2 } = useTranslation();
  const applyPatches = (API, patches = {}, success = () => {
  }) => {
    API(patches).then((a2) => {
      if (!a2.code) {
        toast.success(t2("Saved"));
        success(a2);
      }
    });
  };
  const bilibiliOptions = useBilibiliOptionsStore((state) => state.data);
  const exhentaiOptions = useExHentaiOptionsStore((state) => state.data);
  const pixivOptions = usePixivOptionsStore((state) => state.data);
  const soulPlusOptions = useSoulPlusOptionsStore((state) => state.data);
  const bangumiOptions = useBangumiOptionsStore((state) => state.data);
  const cienOptions = useCienOptionsStore((state) => state.data);
  const dlsiteOptions = useDLsiteOptionsStore((state) => state.data);
  const fanboxOptions = useFanboxOptionsStore((state) => state.data);
  const fantiaOptions = useFantiaOptionsStore((state) => state.data);
  const patreonOptions = usePatreonOptionsStore((state) => state.data);
  const tmdbOptions = useTmdbOptionsStore((state) => state.data);
  const [tmpBilibiliOptions, setTmpBilibiliOptions] = reactExports.useState(
    bilibiliOptions || {}
  );
  const [tmpExHentaiOptions, setTmpExHentaiOptions] = reactExports.useState(
    exhentaiOptions || {}
  );
  const [tmpPixivOptions, setTmpPixivOptions] = reactExports.useState(
    pixivOptions || {}
  );
  const [tmpSoulPlusOptions, setTmpSoulPlusOptions] = reactExports.useState(
    soulPlusOptions || {}
  );
  const [tmpBangumiOptions, setTmpBangumiOptions] = reactExports.useState(
    bangumiOptions || {}
  );
  const [tmpCienOptions, setTmpCienOptions] = reactExports.useState(cienOptions || {});
  const [tmpDLsiteOptions, setTmpDLsiteOptions] = reactExports.useState(
    dlsiteOptions || {}
  );
  const [tmpFanboxOptions, setTmpFanboxOptions] = reactExports.useState(
    fanboxOptions || {}
  );
  const [tmpFantiaOptions, setTmpFantiaOptions] = reactExports.useState(
    fantiaOptions || {}
  );
  const [tmpPatreonOptions, setTmpPatreonOptions] = reactExports.useState(
    patreonOptions || {}
  );
  const [tmpTmdbOptions, setTmpTmdbOptions] = reactExports.useState(tmdbOptions || {});
  const [validatingCookies, setValidatingCookies] = reactExports.useState({});
  reactExports.useEffect(() => {
    setTmpBilibiliOptions(JSON.parse(JSON.stringify(bilibiliOptions || {})));
  }, [bilibiliOptions]);
  reactExports.useEffect(() => {
    setTmpExHentaiOptions(JSON.parse(JSON.stringify(exhentaiOptions || {})));
  }, [exhentaiOptions]);
  reactExports.useEffect(() => {
    setTmpPixivOptions(JSON.parse(JSON.stringify(pixivOptions || {})));
  }, [pixivOptions]);
  reactExports.useEffect(() => {
    setTmpSoulPlusOptions(JSON.parse(JSON.stringify(soulPlusOptions || {})));
  }, [soulPlusOptions]);
  reactExports.useEffect(() => {
    setTmpBangumiOptions(JSON.parse(JSON.stringify(bangumiOptions || {})));
  }, [bangumiOptions]);
  reactExports.useEffect(() => {
    setTmpCienOptions(JSON.parse(JSON.stringify(cienOptions || {})));
  }, [cienOptions]);
  reactExports.useEffect(() => {
    setTmpDLsiteOptions(JSON.parse(JSON.stringify(dlsiteOptions || {})));
  }, [dlsiteOptions]);
  reactExports.useEffect(() => {
    setTmpFanboxOptions(JSON.parse(JSON.stringify(fanboxOptions || {})));
  }, [fanboxOptions]);
  reactExports.useEffect(() => {
    setTmpFantiaOptions(JSON.parse(JSON.stringify(fantiaOptions || {})));
  }, [fantiaOptions]);
  reactExports.useEffect(() => {
    setTmpPatreonOptions(JSON.parse(JSON.stringify(patreonOptions || {})));
  }, [patreonOptions]);
  reactExports.useEffect(() => {
    setTmpTmdbOptions(JSON.parse(JSON.stringify(tmdbOptions || {})));
  }, [tmdbOptions]);
  const validateCookie = (thirdParty, cookie, target) => {
    setValidatingCookies((prev2) => ({ ...prev2, [thirdParty]: true }));
    BApi$1.tool.validateCookie({ cookie, target }).then((r2) => {
      if (r2.code) {
        toast.danger(`${t2("Invalid cookie")}:${r2.message}`);
      } else {
        toast.success(t2("Cookie is good"));
      }
    }).finally(() => {
      setValidatingCookies((prev2) => ({ ...prev2, [thirdParty]: false }));
    });
  };
  const renderDownloaderOptions = (options, setOptions2, saveApi, thirdPartyName) => {
    var _a2;
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        textarea_default,
        {
          label: t2("Cookie"),
          size: "sm",
          value: options.cookie || "",
          onValueChange: (v2) => {
            setOptions2({
              ...options,
              cookie: v2
            });
          }
        }
      ) }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            label: t2("Max Concurrency"),
            size: "sm",
            type: "number",
            value: String(options.maxConcurrency || 1),
            onValueChange: (v2) => {
              setOptions2({
                ...options,
                maxConcurrency: Number(v2) || 1
              });
            }
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            label: t2("Request Interval (ms)"),
            size: "sm",
            type: "number",
            value: String(options.requestInterval || 1e3),
            onValueChange: (v2) => {
              setOptions2({
                ...options,
                requestInterval: Number(v2) || 1e3
              });
            }
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          label: t2("Default Path"),
          size: "sm",
          value: options.defaultPath || "",
          onValueChange: (v2) => {
            setOptions2({
              ...options,
              defaultPath: v2
            });
          }
        }
      ) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          label: t2("Naming Convention"),
          size: "sm",
          value: options.namingConvention || "",
          onValueChange: (v2) => {
            setOptions2({
              ...options,
              namingConvention: v2
            });
          }
        }
      ) }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            label: t2("Max Retries"),
            size: "sm",
            type: "number",
            value: String(options.maxRetries || 0),
            onValueChange: (v2) => {
              setOptions2({
                ...options,
                maxRetries: Number(v2) || 0
              });
            }
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            label: t2("Request Timeout (ms)"),
            size: "sm",
            type: "number",
            value: String(options.requestTimeout || 0),
            onValueChange: (v2) => {
              setOptions2({
                ...options,
                requestTimeout: Number(v2) || 0
              });
            }
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "operations flex gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          button_default$1,
          {
            color: "primary",
            size: "sm",
            onPress: () => {
              applyPatches(saveApi, options);
            },
            children: t2("Save")
          }
        ),
        options.cookie && /* @__PURE__ */ jsxRuntimeExports.jsx(
          button_default$1,
          {
            disabled: !((_a2 = options.cookie) == null ? void 0 : _a2.length) || validatingCookies[thirdPartyName],
            isLoading: validatingCookies[thirdPartyName],
            size: "sm",
            onPress: () => {
              const validatorMap = {
                bilibili: CookieValidatorTarget.BiliBili,
                exhentai: CookieValidatorTarget.ExHentai,
                pixiv: CookieValidatorTarget.Pixiv
              };
              const target = validatorMap[thirdPartyName.toLowerCase()];
              if (target) {
                validateCookie(thirdPartyName, options.cookie, target);
              }
            },
            children: t2("Validate cookie")
          }
        )
      ] })
    ] });
  };
  const thirdPartySettings = reactExports.useMemo(
    () => [
      {
        key: "bilibili",
        label: "Bilibili",
        tip: "Configure Bilibili downloader settings including cookie authentication and download parameters.",
        content: renderDownloaderOptions(
          tmpBilibiliOptions,
          setTmpBilibiliOptions,
          BApi$1.options.patchBilibiliOptions,
          "bilibili"
        )
      },
      {
        key: "exhentai",
        label: "ExHentai",
        tip: "Configure ExHentai downloader settings. Cookie is required for authentication.",
        content: renderDownloaderOptions(
          tmpExHentaiOptions,
          setTmpExHentaiOptions,
          BApi$1.options.patchExHentaiOptions,
          "exhentai"
        )
      },
      {
        key: "pixiv",
        label: "Pixiv",
        tip: "Configure Pixiv downloader settings including authentication and download parameters.",
        content: renderDownloaderOptions(
          tmpPixivOptions,
          setTmpPixivOptions,
          BApi$1.options.patchPixivOptions,
          "pixiv"
        )
      },
      {
        key: "soulplus",
        label: "SoulPlus",
        tip: "Configure SoulPlus settings including cookie authentication and auto-buy threshold.",
        content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              label: t2("Cookie"),
              size: "sm",
              value: tmpSoulPlusOptions.cookie || "",
              onValueChange: (v2) => {
                setTmpSoulPlusOptions({
                  ...tmpSoulPlusOptions,
                  cookie: v2
                });
              }
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              label: t2("Auto Buy Threshold"),
              size: "sm",
              type: "number",
              value: String(tmpSoulPlusOptions.autoBuyThreshold || 0),
              onValueChange: (v2) => {
                setTmpSoulPlusOptions({
                  ...tmpSoulPlusOptions,
                  autoBuyThreshold: Number(v2) || 0
                });
              }
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "operations", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            button_default$1,
            {
              color: "primary",
              size: "sm",
              onPress: () => {
                applyPatches(
                  BApi$1.options.patchSoulPlusOptions,
                  tmpSoulPlusOptions
                );
              },
              children: t2("Save")
            }
          ) })
        ] })
      },
      {
        key: "bangumi",
        label: "Bangumi",
        tip: "Configure Bangumi settings including request parameters and authentication.",
        content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                label: t2("Max Concurrency"),
                size: "sm",
                type: "number",
                value: String(tmpBangumiOptions.maxConcurrency || 1),
                onValueChange: (v2) => {
                  setTmpBangumiOptions({
                    ...tmpBangumiOptions,
                    maxConcurrency: Number(v2) || 1
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                label: t2("Request Interval (ms)"),
                size: "sm",
                type: "number",
                value: String(tmpBangumiOptions.requestInterval || 1e3),
                onValueChange: (v2) => {
                  setTmpBangumiOptions({
                    ...tmpBangumiOptions,
                    requestInterval: Number(v2) || 1e3
                  });
                }
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              label: t2("Cookie"),
              size: "sm",
              value: tmpBangumiOptions.cookie || "",
              onValueChange: (v2) => {
                setTmpBangumiOptions({
                  ...tmpBangumiOptions,
                  cookie: v2
                });
              }
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                label: t2("User Agent"),
                size: "sm",
                value: tmpBangumiOptions.userAgent || "",
                onValueChange: (v2) => {
                  setTmpBangumiOptions({
                    ...tmpBangumiOptions,
                    userAgent: v2
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                label: t2("Referer"),
                size: "sm",
                value: tmpBangumiOptions.referer || "",
                onValueChange: (v2) => {
                  setTmpBangumiOptions({
                    ...tmpBangumiOptions,
                    referer: v2
                  });
                }
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "operations", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            button_default$1,
            {
              color: "primary",
              size: "sm",
              onPress: () => {
                applyPatches(
                  BApi$1.options.patchBangumiOptions,
                  tmpBangumiOptions
                );
              },
              children: t2("Save")
            }
          ) })
        ] })
      },
      {
        key: "cien",
        label: "Cien",
        tip: "Configure Cien downloader settings including authentication and download parameters.",
        content: renderDownloaderOptions(
          tmpCienOptions,
          setTmpCienOptions,
          BApi$1.options.patchCienOptions,
          "cien"
        )
      },
      {
        key: "dlsite",
        label: "DLsite",
        tip: "Configure DLsite downloader settings including authentication and download parameters.",
        content: renderDownloaderOptions(
          tmpDLsiteOptions,
          setTmpDLsiteOptions,
          BApi$1.options.patchDLsiteOptions,
          "dlsite"
        )
      },
      {
        key: "fanbox",
        label: "Fanbox",
        tip: "Configure Fanbox downloader settings including authentication and download parameters.",
        content: renderDownloaderOptions(
          tmpFanboxOptions,
          setTmpFanboxOptions,
          BApi$1.options.patchFanboxOptions,
          "fanbox"
        )
      },
      {
        key: "fantia",
        label: "Fantia",
        tip: "Configure Fantia downloader settings including authentication and download parameters.",
        content: renderDownloaderOptions(
          tmpFantiaOptions,
          setTmpFantiaOptions,
          BApi$1.options.patchFantiaOptions,
          "fantia"
        )
      },
      {
        key: "patreon",
        label: "Patreon",
        tip: "Configure Patreon downloader settings including authentication and download parameters.",
        content: renderDownloaderOptions(
          tmpPatreonOptions,
          setTmpPatreonOptions,
          BApi$1.options.patchPatreonOptions,
          "patreon"
        )
      },
      {
        key: "tmdb",
        label: "TMDB",
        tip: "Configure TMDB (The Movie Database) settings including API key and request parameters.",
        content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                label: t2("Max Concurrency"),
                size: "sm",
                type: "number",
                value: String(tmpTmdbOptions.maxConcurrency || 1),
                onValueChange: (v2) => {
                  setTmpTmdbOptions({
                    ...tmpTmdbOptions,
                    maxConcurrency: Number(v2) || 1
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                label: t2("Request Interval (ms)"),
                size: "sm",
                type: "number",
                value: String(tmpTmdbOptions.requestInterval || 1e3),
                onValueChange: (v2) => {
                  setTmpTmdbOptions({
                    ...tmpTmdbOptions,
                    requestInterval: Number(v2) || 1e3
                  });
                }
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              label: t2("API Key"),
              size: "sm",
              value: tmpTmdbOptions.apiKey || "",
              onValueChange: (v2) => {
                setTmpTmdbOptions({
                  ...tmpTmdbOptions,
                  apiKey: v2
                });
              }
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            textarea_default,
            {
              label: t2("Cookie"),
              size: "sm",
              value: tmpTmdbOptions.cookie || "",
              onValueChange: (v2) => {
                setTmpTmdbOptions({
                  ...tmpTmdbOptions,
                  cookie: v2
                });
              }
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                label: t2("User Agent"),
                size: "sm",
                value: tmpTmdbOptions.userAgent || "",
                onValueChange: (v2) => {
                  setTmpTmdbOptions({
                    ...tmpTmdbOptions,
                    userAgent: v2
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                label: t2("Referer"),
                size: "sm",
                value: tmpTmdbOptions.referer || "",
                onValueChange: (v2) => {
                  setTmpTmdbOptions({
                    ...tmpTmdbOptions,
                    referer: v2
                  });
                }
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "operations", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            button_default$1,
            {
              color: "primary",
              size: "sm",
              onPress: () => {
                applyPatches(BApi$1.options.patchTmdbOptions, tmpTmdbOptions);
              },
              children: t2("Save")
            }
          ) })
        ] })
      }
    ],
    [
      tmpBilibiliOptions,
      tmpExHentaiOptions,
      tmpPixivOptions,
      tmpSoulPlusOptions,
      tmpBangumiOptions,
      tmpCienOptions,
      tmpDLsiteOptions,
      tmpFanboxOptions,
      tmpFantiaOptions,
      tmpPatreonOptions,
      tmpTmdbOptions
    ]
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-6", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-32 shrink-0 sticky top-4 self-start border-small px-1 py-2 rounded-small border-default-200 dark:border-default-100", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      listbox_default,
      {
        "aria-label": "Third party list",
        selectionMode: "single",
        onAction: (key) => {
          const el2 = document.getElementById(`tp-${String(key)}`);
          if (el2) {
            el2.scrollIntoView({ behavior: "smooth", block: "start" });
          }
        },
        children: thirdPartySettings.map((s2) => /* @__PURE__ */ jsxRuntimeExports.jsx(listbox_item_base_default, { children: s2.label }, s2.key))
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 space-y-8", children: thirdPartySettings.map((s2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "scroll-mt-16", id: `tp-${s2.key}`, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 mb-2 text-lg font-semibold", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: s2.label }),
        s2.tip && /* @__PURE__ */ jsxRuntimeExports.jsx(
          tooltip_default,
          {
            color: "secondary",
            content: t2(s2.tip),
            placement: "top",
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineQuestionCircle, { className: "text-base" })
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: s2.content })
    ] }, s2.key)) })
  ] });
}
const BackgroundTaskPage = () => {
  const { t: t2 } = useTranslation();
  useTaskOptionsStore((state) => state.data);
  const bTasks = useBTasksStore((state) => state.tasks);
  const [editingOptions, setEditingOptions] = reactExports.useState({});
  const columns = [
    {
      key: "name",
      label: "Name"
    },
    {
      key: "status",
      label: "Status"
    },
    {
      key: "progress",
      label: "Progress"
    },
    {
      key: "startedAt",
      label: "Started At"
    },
    {
      key: "interval",
      label: "Interval"
    },
    {
      key: "nextTimeStartAt",
      label: "Next time start at"
    },
    {
      key: "elapsed",
      label: "Elapsed"
    },
    {
      key: "enableAfter",
      label: "Enable after"
    }
  ];
  reactExports.useEffect(() => {
  }, []);
  const patchOptions = async () => {
    await BApi.options.patchTaskOptions({
      tasks: bTasks.filter((t22) => t22.isPersistent).map((t22) => {
        var _a2, _b2;
        return {
          id: t22.id,
          interval: ((_a2 = editingOptions[t22.id]) == null ? void 0 : _a2.interval) ?? t22.interval,
          enableAfter: ((_b2 = editingOptions[t22.id]) == null ? void 0 : _b2.enableAfter) ?? t22.enableAfter
        };
      })
    });
    Vt.success(t2("Saved"));
    setEditingOptions({});
  };
  const renderInterval = (task) => {
    var _a2;
    if (!task.isPersistent) {
      return t2("Not supported");
    }
    const editingInterval = (_a2 = editingOptions[task.id]) == null ? void 0 : _a2.interval;
    if (editingInterval) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        TimeInput,
        {
          autoFocus: true,
          granularity: "second",
          size: "sm",
          value: dayjs.duration(
            hooks.duration(editingInterval).asMilliseconds()
          ),
          onBlur: () => {
            patchOptions();
          },
          onChange: (v2) => {
            setEditingOptions({
              ...editingOptions,
              [task.id]: {
                interval: v2.format("HH:mm:ss")
              }
            });
          }
        }
      );
    } else {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            onPress: () => {
              setEditingOptions({
                ...editingOptions,
                [task.id]: {
                  interval: task.interval ?? "00:05:00"
                }
              });
            },
            variant: "light",
            size: "sm",
            children: task.interval ? dayjs.duration(hooks.duration(task.interval).asMilliseconds()).format("HH:mm:ss") : t2("Not set")
          }
        ) }),
        task.interval && /* @__PURE__ */ jsxRuntimeExports.jsx(
          Tooltip$1,
          {
            content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
              t2("Will start at"),
              " ",
              dayjs(task.nextTimeStartAt).format("YYYY-MM-DD HH:mm:ss")
            ] }),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1f, { className: "text-base" })
          }
        )
      ] });
    }
  };
  const renderEnableAfter = (task) => {
    var _a2;
    if (!task.isPersistent) {
      return t2("Not supported");
    }
    const format2 = "YYYY-MM-DD HH:mm:ss";
    const editingEnableAfter = (_a2 = editingOptions[task.id]) == null ? void 0 : _a2.enableAfter;
    if (editingEnableAfter) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        DateInput,
        {
          autoFocus: true,
          granularity: "second",
          size: "sm",
          value: dayjs(editingEnableAfter),
          onBlur: () => {
            patchOptions();
          },
          onChange: (v2) => {
            setEditingOptions({
              ...editingOptions,
              [task.id]: {
                enableAfter: v2 == null ? void 0 : v2.format(format2)
              }
            });
          }
        }
      );
    } else {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          onPress: () => {
            const initValue = task.enableAfter ? dayjs(task.enableAfter) : dayjs().add(1, "h");
            setEditingOptions({
              ...editingOptions,
              [task.id]: {
                enableAfter: initValue.format(format2)
              }
            });
          },
          variant: task.enableAfter ? "light" : "flat",
          size: "sm",
          children: task.enableAfter ? dayjs(task.enableAfter).format(format2) : t2("Not set")
        }
      );
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    table_default,
    {
      isStriped: true,
      removeWrapper: true,
      "aria-label": "Example table with dynamic content",
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_header_default, { columns, children: (column2) => /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: column2.label }, column2.key) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: bTasks.map((task) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              task.name,
              task.description && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { color: "secondary", content: task.description, children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" }) })
            ] }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs(table_cell_default, { children: [
              t2(BTaskStatus[task.status]),
              task.error && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { color: "danger", content: task.error, children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, {}) }),
              task.reasonForUnableToStart && /* @__PURE__ */ jsxRuntimeExports.jsx(
                Tooltip$1,
                {
                  color: "warning",
                  content: task.reasonForUnableToStart,
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" })
                }
              )
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(progress_default, { color: "primary", size: "sm", value: task.percentage }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs(
                "div",
                {
                  className: "absolute top-0 left-0 flex items-center justify-center w-full h-full",
                  children: [
                    task.percentage,
                    "%"
                  ]
                }
              )
            ] }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: task.startedAt && dayjs(task.startedAt).format("YYYY-MM-DD HH:mm:ss") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: renderInterval(task) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: task.nextTimeStartAt && dayjs(task.nextTimeStartAt).format("YYYY-MM-DD HH:mm:ss") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: task.elapsed && dayjs.duration(hooks.duration(task.elapsed).asMilliseconds()).format("HH:mm:ss") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: renderEnableAfter(task) })
          ] }, task.id);
        }) })
      ]
    }
  );
};
BackgroundTaskPage.displayName = "BackgroundTaskPage";
function LogPage() {
  const { t: t2 } = useTranslation();
  const [logs, setLogs] = reactExports.useState([]);
  const [form2, setForm] = reactExports.useState({
    pageIndex: 1,
    pageSize: 100,
    startDt: void 0,
    endDt: void 0,
    level: void 0,
    logger: void 0,
    event: void 0,
    message: void 0
  });
  const [pageable, setPageable] = reactExports.useState({
    pageIndex: 1,
    totalCount: 0
  });
  const [dateRange, setDateRange] = reactExports.useState(
    null
  );
  const [expandedMsg, setExpandedMsg] = reactExports.useState(null);
  const { createPortal } = useBakabaseContext();
  reactExports.useEffect(() => {
    search2();
  }, [form2.pageIndex, form2.pageSize, form2.startDt, form2.endDt, form2.level, form2.logger, form2.event, form2.message]);
  const search2 = async () => {
    const d2 = await BApi$1.log.searchLogs(form2);
    setLogs(d2.data || []);
    setPageable({
      pageIndex: d2.pageIndex,
      totalCount: d2.totalCount
    });
  };
  const patchForm = (patches) => {
    setPageable((prev2) => ({ ...prev2, pageIndex: 1 }));
    setForm((prev2) => ({ ...prev2, ...patches, pageIndex: 1 }));
  };
  const handleDateRangeChange = (range3) => {
    setDateRange(range3);
    patchForm({
      startDt: (range3 == null ? void 0 : range3.start) ? range3.start.toDate().toISOString().slice(0, 19).replace("T", " ") : void 0,
      endDt: (range3 == null ? void 0 : range3.end) ? range3.end.toDate().toISOString().slice(0, 19).replace("T", " ") : void 0
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-4", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-4 items-center mb-4", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 min-w-[260px]", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium mr-2 min-w-[60px]", children: t2("Time") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          date_range_picker_default,
          {
            className: "flex-1",
            value: dateRange,
            onChange: handleDateRangeChange
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 min-w-[100px]", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium mr-2 min-w-[60px]", children: t2("Level") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          select_default,
          {
            className: "min-w-[100px]",
            placeholder: t2("All"),
            selectedKeys: form2.level !== void 0 ? /* @__PURE__ */ new Set([String(form2.level)]) : /* @__PURE__ */ new Set(),
            onSelectionChange: (keys2) => {
              const key = Array.from(keys2)[0];
              patchForm({ level: key ? Number(key) : void 0 });
            },
            children: Object.keys(LogLevel).filter((k2) => !isNaN(Number(k2))).map((k2) => /* @__PURE__ */ jsxRuntimeExports.jsx(listbox_item_base_default, { children: LogLevel[Number(k2)] }, k2))
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 min-w-[120px]", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium mr-2 min-w-[60px]", children: t2("Logger") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            className: "min-w-[120px]",
            placeholder: t2("Logger"),
            size: "sm",
            value: form2.logger,
            onChange: (e2) => patchForm({ logger: e2.target.value })
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 min-w-[120px]", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium mr-2 min-w-[60px]", children: t2("Event") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            className: "min-w-[120px]",
            placeholder: t2("Event"),
            size: "sm",
            value: form2.event,
            onChange: (e2) => patchForm({ event: e2.target.value })
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 min-w-[120px]", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium mr-2 min-w-[60px]", children: t2("Message") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            className: "min-w-[120px]",
            placeholder: t2("Message"),
            size: "sm",
            value: form2.message,
            onChange: (e2) => patchForm({ message: e2.target.value })
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1 ml-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        button_default$1,
        {
          size: "sm",
          type: "button",
          onClick: () => BApi$1.log.clearAllLog().then(() => setLogs([])),
          children: t2("Clear all")
        }
      ) })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs(
      table_default,
      {
        removeWrapper: true,
        "aria-label": "logs",
        className: "mb-4",
        selectionMode: "none",
        size: "sm",
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Time") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Level") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Logger") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Event") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Message") })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { items: logs, children: (item) => /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: item.dateTime ? item.dateTime.slice(5, 16) : "-" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              "span",
              {
                className: item.level === LogLevel.Error || item.level === LogLevel.Critical || item.level === LogLevel.Warning ? "text-red-600" : "text-blue-600",
                children: item.level === LogLevel.Information ? "Info" : LogLevel[item.level]
              }
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: item.logger }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: item.event }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { className: "max-w-[300px] truncate", children: item.message && item.message.length > 60 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("pre", { className: "inline", children: [
              item.message.slice(0, 60),
              "...",
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                button_default$1,
                {
                  color: "primary",
                  size: "sm",
                  variant: "light",
                  onPress: () => createPortal(Modal, {
                    size: "xl",
                    title: t2("Log"),
                    defaultVisible: true,
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "whitespace-pre-wrap break-all", children: item.message })
                  }),
                  children: t2("Expand")
                }
              )
            ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "inline", children: item.message }) })
          ] }, item.id || item.dateTime + item.logger + item.event) })
        ]
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      pagination_default,
      {
        page: pageable.pageIndex,
        total: pageable.totalCount,
        onChange: (page) => setForm((prev2) => ({ ...prev2, pageIndex: page }))
      }
    ) }),
    expandedMsg && /* @__PURE__ */ jsxRuntimeExports.jsx(
      Modal,
      {
        title: t2("Full Message"),
        onClose: () => setExpandedMsg(null),
        children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "whitespace-pre-wrap break-all", children: expandedMsg })
      }
    )
  ] });
}
const AddMediaLibraryInBulkDialog = ({
  categoryId,
  onSubmitted,
  onDestroyed
}) => {
  const { t: t2 } = useTranslation();
  const [nameAndPaths, setNameAndPaths] = reactExports.useState([]);
  const [visible, setVisible] = reactExports.useState(true);
  const close = () => {
    setVisible(false);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      size: "xl",
      title: t2("Add media libraries in bulk"),
      visible,
      onClose: close,
      onDestroyed,
      onOk: async () => {
        const model = {
          nameAndPaths: nameAndPaths.reduce(
            (s2, t22) => {
              s2[t22.name] = t22.paths;
              return s2;
            },
            {}
          )
        };
        const rsp = await BApi$1.mediaLibrary.addMediaLibrariesInBulk(
          categoryId,
          model
        );
        if (!rsp.code) {
          onSubmitted == null ? void 0 : onSubmitted();
          close();
        }
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
        nameAndPaths.map((item, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border rounded-lg p-4 space-y-3", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                className: "flex-1",
                placeholder: t2("Name"),
                value: item.name,
                onValueChange: (value2) => {
                  const newNameAndPaths = [...nameAndPaths];
                  newNameAndPaths[index2].name = value2;
                  setNameAndPaths(newNameAndPaths);
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                color: "danger",
                size: "sm",
                variant: "light",
                onPress: () => {
                  const newNameAndPaths = nameAndPaths.filter(
                    (_24, i2) => i2 !== index2
                  );
                  setNameAndPaths(newNameAndPaths);
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdDelete, { className: "text-base" })
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm font-medium", children: t2("Root paths") }),
            item.paths.map((path, pathIndex) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                input_default,
                {
                  className: "flex-1",
                  placeholder: t2("Root path"),
                  value: path,
                  onValueChange: (value2) => {
                    const newNameAndPaths = [...nameAndPaths];
                    newNameAndPaths[index2].paths[pathIndex] = value2;
                    setNameAndPaths(newNameAndPaths);
                  }
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  color: "danger",
                  size: "sm",
                  variant: "light",
                  onPress: () => {
                    const newNameAndPaths = [...nameAndPaths];
                    newNameAndPaths[index2].paths.splice(pathIndex, 1);
                    setNameAndPaths(newNameAndPaths);
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdDelete, { className: "text-base" })
                }
              )
            ] }, pathIndex)),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "primary",
                size: "sm",
                variant: "light",
                onPress: () => {
                  const newNameAndPaths = [...nameAndPaths];
                  newNameAndPaths[index2].paths.push("");
                  setNameAndPaths(newNameAndPaths);
                },
                children: t2("Add root path")
              }
            )
          ] })
        ] }, index2)),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            size: "sm",
            onPress: () => {
              setNameAndPaths([...nameAndPaths, { name: "", paths: [] }]);
            },
            children: t2("Add a media library")
          }
        )
      ] })
    }
  );
};
const VariableWrapper = {
  left: "{",
  right: "}"
};
const extractResourceDisplayNameTemplate = (template2, variables, wrappers) => {
  const wrappedVariables = variables.map(
    (v2) => `${VariableWrapper.left}${v2}${VariableWrapper.right}`
  );
  const segments = [];
  console.log(wrappedVariables, wrappers);
  for (let i2 = 0; i2 < template2.length; i2++) {
    const c2 = template2[i2];
    let matched = false;
    if (c2 == "{") {
      for (const wv of wrappedVariables) {
        if (template2.startsWith(wv, i2)) {
          segments.push({
            text: wv,
            type: ResourceDisplayNameTemplateSegmentType.Property
          });
          i2 += wv.length - 1;
          matched = true;
          break;
        }
      }
    }
    if (!matched) {
      if (wrappers.some((w2) => w2.left == c2 || w2.right == c2)) {
        segments.push({
          text: c2,
          type: ResourceDisplayNameTemplateSegmentType.Wrapper
        });
      } else {
        const prevPart = segments[segments.length - 1];
        if ((prevPart == null ? void 0 : prevPart.type) == ResourceDisplayNameTemplateSegmentType.Text) {
          prevPart.text += c2;
        } else {
          segments.push({
            text: c2,
            type: ResourceDisplayNameTemplateSegmentType.Text
          });
        }
      }
    }
  }
  return segments;
};
const renderDisplayNameSegment = (p2) => {
  switch (p2.type) {
    case ResourceDisplayNameTemplateSegmentType.Text:
      return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p2.text });
    case ResourceDisplayNameTemplateSegmentType.Wrapper:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        "span",
        {
          style: { color: "var(--bakaui-secondary)" },
          children: p2.text
        }
      );
    case ResourceDisplayNameTemplateSegmentType.Property:
      return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { color: "var(--bakaui-primary)" }, children: p2.text });
  }
};
const DisplayNameTemplateEditorDialog = ({
  categoryId,
  onSaved,
  ...props
}) => {
  const { t: t2 } = useTranslation();
  useUpdate();
  const { createPortal } = useBakabaseContext();
  const [visible, setVisible] = reactExports.useState(true);
  const [wrappers, setWrappers] = reactExports.useState([]);
  const [category, setCategory] = reactExports.useState();
  const [variables, setVariables] = reactExports.useState([]);
  const [templateHtml, setTemplateHtml] = reactExports.useState("");
  const templateRef = reactExports.useRef("");
  const init2 = reactExports.useCallback(async () => {
    var _a2, _b2;
    const tr = await BApi$1.specialText.getAllSpecialTexts();
    const texts = ((_a2 = tr.data) == null ? void 0 : _a2[SpecialTextType.Wrapper]) || [];
    const wrappers2 = texts.map((text2) => {
      return {
        left: text2.value1,
        right: text2.value2
      };
    });
    setWrappers(wrappers2);
    const cr = await BApi$1.category.getCategory(categoryId, {
      additionalItems: CategoryAdditionalItem.CustomProperties
    });
    const c2 = cr.data || { id: 0, name: "" };
    setCategory({
      id: c2.id,
      name: c2.name
    });
    const builtinPropertyNames = builtinPropertyForDisplayNames.map(
      (v2) => t2(`BuiltinPropertyForDisplayName.${v2.label}`)
    );
    const customPropertyNames = ((_b2 = c2.customProperties) == null ? void 0 : _b2.map((cp) => cp.name)) ?? [];
    setVariables(builtinPropertyNames.concat(customPropertyNames));
    templateRef.current = c2.resourceDisplayNameTemplate ?? "";
    setTemplateHtml(
      c2.resourceDisplayNameTemplate ? buildTemplateHtml(c2.resourceDisplayNameTemplate) : ""
    );
  }, []);
  reactExports.useEffect(() => {
    init2();
  }, []);
  const close = () => {
    setVisible(false);
  };
  const buildTemplateHtml = (template2) => {
    const parts = extractResourceDisplayNameTemplate(
      template2,
      variables,
      wrappers
    );
    const components2 = parts.map((p2) => renderDisplayNameSegment(p2));
    const html2 = renderToString(/* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: components2 }));
    console.log(parts, html2);
    return html2;
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      size: "xl",
      title: t2("Edit display name template for category {{name}}", {
        name: category == null ? void 0 : category.name
      }),
      onClose: close,
      onDestroyed: props.onDestroyed,
      onOk: async () => {
        await BApi$1.category.putCategoryResourceDisplayNameTemplate(
          categoryId,
          templateRef.current
        );
        onSaved == null ? void 0 : onSaved();
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "text-base" }),
              " ",
              t2(
                "You can use any combination of text and following properties in template, and you can add more properties in category configuration."
              )
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-center", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "text-base" }),
              " ",
              /* @__PURE__ */ jsxRuntimeExports.jsxs(
                Trans,
                {
                  i18nKey: "category.displayNameTemplate.propertyExample",
                  values: {
                    // samplePropertyName: propertiesRef.current[0]?.name ?? t<string>('Name'),
                    samplePropertyName: (variables == null ? void 0 : variables[0]) ?? t2("Name")
                  },
                  children: [
                    "To add a property value as a variable in the template, you can use the following format: ",
                    /* @__PURE__ */ jsxRuntimeExports.jsx(code_default, { children: "{name of property}" }),
                    ". For example, ",
                    /* @__PURE__ */ jsxRuntimeExports.jsx(code_default, { children: "{samplePropertyName}" }),
                    " will be replaced with the value of the property named ",
                    /* @__PURE__ */ jsxRuntimeExports.jsx(code_default, { children: "sampleName" })
                  ]
                }
              )
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "text-base" }),
              " ",
              t2(
                "Be careful if you have multiple properties with same name, only a random one will be replaced."
              )
            ] })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1 mt-2", children: variables == null ? void 0 : variables.map((p2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              size: "sm",
              onClick: () => {
                templateRef.current += `{${p2}}`;
                setTemplateHtml(buildTemplateHtml(templateRef.current));
              },
              children: p2
            },
            p2
          )) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "text-base" }),
            " ",
            t2(
              "You can safely use any of following text wrappers to wrap the properties, and wrappers surrounding the property with empty value will be removed automatically."
            ),
            t2(
              "You can check and set the wrappers in special text configuration."
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1 mt-2", children: wrappers.map((w2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { size: "sm", children: [
            w2.left,
            " ",
            w2.right
          ] }, w2.left)) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "text-base" }),
          " ",
          t2(
            "If you leave the template with empty value, the file name will be the display name."
          )
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Display name template") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            _default,
            {
              autoFocus: true,
              className: "border-1 rounded mt-1 p-2",
              html: templateHtml,
              tagName: "pre",
              onChange: (v2) => {
                templateRef.current = v2.currentTarget.textContent || "";
                setTemplateHtml(buildTemplateHtml(templateRef.current));
              }
            },
            "0"
          )
        ] }),
        templateRef.current.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            onClick: () => {
              BApi$1.category.previewCategoryDisplayNameTemplate(categoryId, {
                template: templateRef.current
              }).then((r2) => {
                const data = r2.data || [];
                createPortal(Modal, {
                  defaultVisible: true,
                  size: "xl",
                  footer: {
                    actions: ["ok"]
                  },
                  title: t2("Preview display names of resources"),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: data.map((d2) => {
                    var _a2;
                    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-2", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs opacity-60 mb-1", children: d2.resourcePath }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-base flex items-center", children: (_a2 = d2.segments) == null ? void 0 : _a2.map((s2) => {
                        const type4 = s2.type;
                        let feType;
                        switch (type4) {
                          case CategoryResourceDisplayNameSegmentType.StaticText:
                            feType = ResourceDisplayNameTemplateSegmentType.Text;
                            break;
                          case CategoryResourceDisplayNameSegmentType.Property:
                            feType = ResourceDisplayNameTemplateSegmentType.Property;
                            break;
                          case CategoryResourceDisplayNameSegmentType.LeftWrapper:
                          case CategoryResourceDisplayNameSegmentType.RightWrapper:
                            feType = ResourceDisplayNameTemplateSegmentType.Wrapper;
                            break;
                        }
                        const p2 = {
                          text: s2.text,
                          type: feType
                        };
                        return /* @__PURE__ */ jsxRuntimeExports.jsx(
                          Tooltip$1,
                          {
                            content: t2(
                              `CategoryResourceDisplayNameSegmentType.${CategoryResourceDisplayNameSegmentType[type4]}`
                            ),
                            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                              "div",
                              {
                                className: "cursor-pointer hover:font-bold",
                                children: renderDisplayNameSegment(p2)
                              }
                            )
                          }
                        );
                      }) })
                    ] });
                  }) })
                });
              });
            },
            children: t2("Click to preview")
          }
        ) })
      ]
    }
  );
};
DisplayNameTemplateEditorDialog.displayName = "DisplayNameTemplateEditorDialog";
const Tips = () => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: "flex items-start gap-2 border-small px-2 py-1 rounded-small border-default-200 opacity-80",
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "leading-normal block" }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "leading-normal", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
            "You can set conventions on each path segments to fill the properties of resources."
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
            "If your path layer isn't stable to root path but it is stable to resource, 'The xxx layer to the resource' is your better choice."
          ) })
        ] })
      ]
    }
  );
};
Tips.displayName = "Tips";
class PscMatcherValue {
  constructor(v2) {
    __publicField(this, "valueType");
    __publicField(this, "layer");
    __publicField(this, "regex");
    __publicField(this, "fixedText");
    Object.assign(this, v2);
  }
  static Layer(layer2) {
    return new PscMatcherValue({
      valueType: ResourceMatcherValueType.Layer,
      layer: layer2
    });
  }
  static Regex(regex2) {
    return new PscMatcherValue({
      valueType: ResourceMatcherValueType.Regex,
      regex: regex2
    });
  }
  static FixedText(fixedText) {
    return new PscMatcherValue({
      valueType: ResourceMatcherValueType.FixedText,
      fixedText
    });
  }
  static ToString(t2, value2) {
    switch (value2.valueType) {
      case ResourceMatcherValueType.FixedText:
        return t2("Fixed text: {{text}}", { text: value2.fixedText });
      case ResourceMatcherValueType.Regex:
        return t2("Regex: {{regex}}", { regex: value2.regex });
      case ResourceMatcherValueType.Layer:
        if (value2.layer && value2.layer < 0) {
          return t2("Layer: the {{layer}} layer to the last", {
            layer: -value2.layer
          });
        } else {
          return t2("Layer: the {{layer}} layer", {
            layer: value2.layer
          });
        }
    }
  }
  equals(other) {
    if (this.valueType !== other.valueType) {
      return false;
    }
    switch (this.valueType) {
      case ResourceMatcherValueType.Layer:
        return this.layer === other.layer;
      case ResourceMatcherValueType.Regex:
        return this.regex === other.regex;
      case ResourceMatcherValueType.FixedText:
        return this.fixedText === other.fixedText;
    }
    return false;
  }
  buildDisplayText(t2) {
    return PscMatcherValue.ToString(t2, this);
  }
}
const Errors = ({ errors, value: value2, onDeleteMatcherValue }) => {
  const { t: t2 } = useTranslation();
  if (errors && errors.length > 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        className: "px-2 py-1 border-small rounded-small border-default-200 flex flex-col gap-1 text-sm relative",
        children: errors.map((e2) => {
          var _a2, _b2;
          const v2 = (_b2 = (_a2 = value2 == null ? void 0 : value2.filter((v22) => v22.property.equals(e2.property))) == null ? void 0 : _a2[e2.valueIndex ?? 0]) == null ? void 0 : _b2.value;
          return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                color: "danger",
                radius: "sm",
                size: "sm",
                startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon, { className: "text-sm" }),
                children: e2.property.toString(t2, e2.valueIndex)
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsxs(
              Chip,
              {
                color: "danger",
                radius: "sm",
                size: "sm",
                variant: "light",
                onClose: e2.deletable ? () => {
                  onDeleteMatcherValue(e2.property, e2.valueIndex ?? 0);
                } : void 0,
                children: [
                  v2 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold mr-2", children: PscMatcherValue.ToString(t2, v2) }),
                  e2.message
                ]
              }
            )
          ] });
        })
      }
    );
  }
  return null;
};
Errors.displayName = "Errors";
var PscPropertyType = /* @__PURE__ */ ((PscPropertyType2) => {
  PscPropertyType2[PscPropertyType2["RootPath"] = 1] = "RootPath";
  PscPropertyType2[PscPropertyType2["Resource"] = 2] = "Resource";
  PscPropertyType2[PscPropertyType2["ParentResource"] = 3] = "ParentResource";
  PscPropertyType2[PscPropertyType2["Rating"] = 4] = "Rating";
  PscPropertyType2[PscPropertyType2["Introduction"] = 5] = "Introduction";
  PscPropertyType2[PscPropertyType2["CustomProperty"] = 100] = "CustomProperty";
  return PscPropertyType2;
})(PscPropertyType || {});
const _PscProperty = class _PscProperty {
  constructor(p2) {
    __publicField(this, "id");
    __publicField(this, "isCustom");
    __publicField(this, "name");
    __publicField(this, "equals", (other) => {
      return this.id === other.id && this.isCustom == other.isCustom;
    });
    Object.assign(this, p2);
  }
  get key() {
    return `${this.isCustom ? "c" : "r"}-${this.id}`;
  }
  get type() {
    if (this.isCustom) {
      return PscPropertyType.CustomProperty;
    } else {
      const rp = this.id;
      switch (rp) {
        case ResourceProperty.RootPath:
          return PscPropertyType.RootPath;
        case ResourceProperty.ParentResource:
          return PscPropertyType.ParentResource;
        case ResourceProperty.Resource:
          return PscPropertyType.Resource;
        case ResourceProperty.Rating:
          return PscPropertyType.Rating;
        case ResourceProperty.Introduction:
          return PscPropertyType.Introduction;
        default:
          return;
      }
    }
  }
  get isRootPath() {
    return !this.isCustom && this.id == ResourceProperty.RootPath;
  }
  get isResource() {
    return !this.isCustom && this.id == ResourceProperty.Resource;
  }
  toString(t2, index2) {
    return `${this.isCustom ? this.name : t2(ResourceProperty[this.id])}${index2 == void 0 ? "" : index2 + 1}`;
  }
  static fromPscType(type4) {
    switch (type4) {
      case PscPropertyType.Rating:
        return this.Rating;
      case PscPropertyType.Introduction:
        return this.Introduction;
      case PscPropertyType.RootPath:
        return this.RootPath;
      case PscPropertyType.Resource:
        return this.Resource;
      case PscPropertyType.ParentResource:
        return this.ParentResource;
      case PscPropertyType.CustomProperty:
        return this.CustomProperty;
    }
  }
};
__publicField(_PscProperty, "Resource", new _PscProperty({
  id: ResourceProperty.Resource,
  isCustom: false,
  name: ResourceProperty[ResourceProperty.Resource]
}));
__publicField(_PscProperty, "RootPath", new _PscProperty({
  id: ResourceProperty.RootPath,
  isCustom: false,
  name: ResourceProperty[ResourceProperty.RootPath]
}));
__publicField(_PscProperty, "ParentResource", new _PscProperty({
  id: ResourceProperty.ParentResource,
  isCustom: false,
  name: ResourceProperty[ResourceProperty.ParentResource]
}));
__publicField(_PscProperty, "Rating", new _PscProperty({
  id: ResourceProperty.Rating,
  isCustom: false,
  name: ResourceProperty[ResourceProperty.Rating]
}));
__publicField(_PscProperty, "Introduction", new _PscProperty({
  id: ResourceProperty.Introduction,
  isCustom: false,
  name: ResourceProperty[ResourceProperty.Introduction]
}));
__publicField(_PscProperty, "CustomProperty", new _PscProperty({
  id: ResourceProperty.CustomProperty,
  isCustom: true,
  name: ResourceProperty[ResourceProperty.CustomProperty]
}));
let PscProperty = _PscProperty;
const ByLayer = ({
  modeIsSelected,
  onSelectMode,
  onSelectLayer,
  selectedLayer,
  layers
}) => {
  const { t: t2 } = useTranslation();
  if (!layers || layers.length == 0) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    card_default,
    {
      isHoverable: true,
      isPressable: true,
      className: "mb-2 cursor-pointer w-full",
      onPress: () => {
        onSelectMode();
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(card_header_default, { className: "text-lg font-bold", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          radio_group_default,
          {
            value: modeIsSelected ? "layer" : "",
            onValueChange: onSelectMode,
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: "layer", children: t2("Set by {{thing}}", { thing: t2("layer") }) })
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center flex-wrap gap-1", children: layers.map((layer2) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              className: "",
              color: selectedLayer == layer2 ? "primary" : "default",
              size: "sm",
              variant: "bordered",
              onClick: () => {
                onSelectLayer(layer2);
              },
              children: layer2 < 0 ? t2("The {{layer}} layer to the resource", {
                layer: -layer2
              }) : t2("The {{layer}} layer after root path", {
                layer: layer2
              })
            },
            layer2
          );
        }) }) })
      ]
    }
  );
};
ByLayer.displayName = "ByLayer";
class PscMatchResult {
  constructor(init2) {
    __publicField(this, "type");
    __publicField(this, "layer");
    __publicField(this, "index");
    __publicField(this, "matches");
    Object.assign(this, init2);
  }
  static OfLayer(layer2, index2) {
    return new PscMatchResult({
      type: MatchResultType.Layer,
      layer: layer2,
      index: index2
    });
  }
  static OfRegex(matches) {
    return new PscMatchResult({
      type: MatchResultType.Regex,
      matches
    });
  }
}
class PscMatcher {
  constructor(init2) {
    __publicField(this, "propertyType");
    __publicField(this, "multiple");
    __publicField(this, "valueType");
    __publicField(this, "isRequired");
    __publicField(this, "order");
    __publicField(this, "prerequisites", [
      PscPropertyType.Resource,
      PscPropertyType.RootPath
    ]);
    __publicField(this, "checkOrder");
    Object.assign(this, init2);
  }
  /**
   * If regex value is applied, layer result will be returned if there is no matching group,
   * otherwise the matched groups will be returned
   * @param segments
   * @param value
   * @param startIndex starts from -1
   * @param endIndex ends to {@link segments.length}
   */
  static match(segments, value2, startIndex, endIndex) {
    let result;
    if (value2 !== void 0) {
      switch (value2.valueType) {
        case ResourceMatcherValueType.FixedText: {
          if (startIndex != void 0 && startIndex >= -1) {
            const subSegments = segments.slice(startIndex + 1);
            let str = "";
            for (let i2 = 0; i2 < subSegments.length; i2++) {
              str += subSegments[i2];
              if (str == value2.fixedText) {
                const layer2 = i2 + 1;
                result = PscMatchResult.OfLayer(layer2, startIndex + layer2);
                break;
              }
              str += "/";
            }
          }
          break;
        }
        case ResourceMatcherValueType.Layer: {
          if (value2.layer != void 0 && value2.layer != 0) {
            if (value2.layer > 0) {
              if (startIndex != void 0 && startIndex >= -1) {
                const idx = startIndex + value2.layer;
                if (idx < segments.length) {
                  result = PscMatchResult.OfLayer(
                    value2.layer,
                    value2.layer + startIndex
                  );
                }
              }
            } else {
              if (endIndex != void 0 && endIndex <= segments.length && endIndex + value2.layer >= 0) {
                result = PscMatchResult.OfLayer(
                  value2.layer,
                  value2.layer + endIndex
                );
              }
            }
          }
          break;
        }
        case ResourceMatcherValueType.Regex: {
          if (endIndex != void 0 && endIndex <= segments.length && startIndex != void 0 && startIndex >= -1 && endIndex > startIndex + 1) {
            const subPath = segments.slice(startIndex + 1, endIndex).join("/");
            const rr = getResultFromExecAll(value2.regex, subPath);
            if (rr) {
              if (rr.groups) {
                result = PscMatchResult.OfRegex(rr.groups);
              } else {
                const length2 = subPath.indexOf(rr.text) + rr.text.length;
                const matchedText = subPath.substring(0, length2);
                const layer2 = matchedText.split("/").length;
                result = PscMatchResult.OfLayer(layer2, layer2 + startIndex);
              }
            }
          }
          break;
        }
      }
      console.log(
        "[Matcher]Matching",
        segments,
        `from ${startIndex} to ${endIndex}`,
        "with",
        value2.toString(),
        "result:",
        result
      );
    }
    return result;
  }
  static matchAll(segments, values, rootIndex = -1, resourceIndex = -1, stopAtFirstMatch = false) {
    if (!values) {
      return [];
    }
    const results = [];
    for (let i2 = 0; i2 < values.length; i2++) {
      const value2 = values[i2];
      const result = this.match(segments, value2, rootIndex, resourceIndex);
      if (result) {
        results.push(result);
        if (stopAtFirstMatch) {
          break;
        }
      } else {
        results.push(void 0);
      }
    }
    return results;
  }
  static matchFirst(segments, values, rootIndex = -1, resourceIndex = -1) {
    var _a2;
    return (_a2 = this.matchAll(segments, values, rootIndex, resourceIndex, true)) == null ? void 0 : _a2[0];
  }
}
const RootPathMatcher = new PscMatcher({
  propertyType: PscPropertyType.RootPath,
  multiple: false,
  isRequired: true,
  order: 0,
  prerequisites: []
});
const ResourceMatcher = new PscMatcher({
  propertyType: PscPropertyType.Resource,
  multiple: false,
  isRequired: true,
  order: 2,
  prerequisites: []
});
const allMatchers = [
  RootPathMatcher,
  new PscMatcher({
    propertyType: PscPropertyType.ParentResource,
    multiple: false,
    order: 1
  }),
  ResourceMatcher,
  new PscMatcher({
    propertyType: PscPropertyType.Rating,
    multiple: false,
    order: 1
  }),
  new PscMatcher({
    propertyType: PscPropertyType.Introduction,
    multiple: false,
    order: 1
  }),
  new PscMatcher({
    propertyType: PscPropertyType.CustomProperty,
    multiple: true,
    order: 1
  })
];
const notSetCheckOrderMatchers = allMatchers.slice();
const setCheckOrderMatchers = [];
while (setCheckOrderMatchers.length < notSetCheckOrderMatchers.length) {
  const doneCount = setCheckOrderMatchers.length;
  for (const m2 of notSetCheckOrderMatchers) {
    if (!setCheckOrderMatchers.includes(m2)) {
      if (m2.prerequisites.length == 0) {
        setCheckOrderMatchers.push(m2);
      } else {
        if (m2.prerequisites.every(
          (p2) => setCheckOrderMatchers.some((m22) => m22.propertyType == p2)
        )) {
          setCheckOrderMatchers.push(m2);
        }
      }
    }
  }
  if (doneCount == setCheckOrderMatchers.length) {
    throw new Error("There is a loop in resource prerequisites");
  }
}
for (let i2 = 0; i2 < setCheckOrderMatchers.length; i2++) {
  setCheckOrderMatchers[i2].checkOrder = i2;
}
console.log("[AllPathSegmentMatchers]", allMatchers);
const matchersAfter = allMatchers.reduce((s2, t2) => {
  s2[t2.propertyType] = allMatchers.filter((m2) => m2.order > t2.order);
  return s2;
}, {});
const matchersBefore = allMatchers.reduce((s2, t2) => {
  s2[t2.propertyType] = allMatchers.filter((m2) => m2.order < t2.order);
  return s2;
}, {});
const buildSimpleMatcherOrders = (data) => Object.keys(data).reduce((s2, t2) => {
  var _a2;
  s2[PscPropertyType[t2]] = (_a2 = data[t2]) == null ? void 0 : _a2.map((m2) => PscPropertyType[m2.type]);
  return s2;
}, {});
console.log("[MatchersAfter]", buildSimpleMatcherOrders(matchersAfter));
console.log("[MatchersBefore]", buildSimpleMatcherOrders(matchersBefore));
class SimplePscContextItem {
  constructor(property2, valueIndex) {
    __publicField(this, "property");
    __publicField(this, "valueIndex");
    this.property = property2;
    this.valueIndex = valueIndex;
  }
  toString(t2) {
    return this.property.toString(t2, this.valueIndex);
  }
}
class Segment {
  constructor(init2) {
    __publicField(this, "text", "");
    __publicField(this, "matchResults", []);
    __publicField(this, "selectiveMatchers", []);
    /**
     * Not truly disabled, it displays as disabled
     */
    __publicField(this, "disabled", false);
    Object.assign(this, init2);
  }
}
class SelectiveMatcher {
  constructor(init2) {
    __publicField(this, "propertyType", 0);
    __publicField(this, "readonly", false);
    __publicField(this, "replaceCurrent", false);
    __publicField(this, "errors", []);
    __publicField(this, "matchModes", {
      oneClick: new CommonMatchMode(),
      regex: new RegexMatchMode(),
      layer: new LayerMatchMode()
    });
    Object.assign(this, init2);
  }
  get isConfigurable() {
    return !this.readonly && Object.keys(this.matchModes).some(
      (s2) => this.matchModes[s2].available
    );
  }
  get useSmc() {
    return this.isConfigurable && !this.matchModes.oneClick.available;
  }
  buildModesData() {
    const data = new SegmentMatcherConfigurationModesData();
    if (this.matchModes.regex.available) {
      data.regex = {
        text: this.matchModes.regex.text
      };
    }
    if (this.matchModes.layer.available) {
      data.layers = this.matchModes.layer.layers;
    }
    return data;
  }
}
class CommonMatchMode {
  constructor() {
    __publicField(this, "available", false);
    __publicField(this, "errors", []);
  }
}
class RegexMatchMode extends CommonMatchMode {
  constructor() {
    super(...arguments);
    __publicField(this, "text");
  }
}
class LayerMatchMode extends CommonMatchMode {
  constructor() {
    super(...arguments);
    __publicField(this, "layers", []);
  }
}
class SimpleGlobalMatchResult extends SimplePscContextItem {
  constructor(property2, valueIndex, matches) {
    super(property2, valueIndex);
    __publicField(this, "matches");
    this.matches = matches;
  }
}
class SimpleMatchResult extends SimplePscContextItem {
  constructor(property2, valueIndex, errors) {
    super(property2, valueIndex);
    __publicField(this, "errors", []);
    __publicField(this, "readonly", false);
    this.errors = errors || [];
  }
}
class SimpleGlobalError extends SimplePscContextItem {
  constructor(property2, valueIndex, message, deletable, preventSubmitting) {
    super(property2, valueIndex);
    __publicField(this, "message");
    __publicField(this, "deletable");
    __publicField(this, "preventSubmitting");
    this.message = message;
    this.deletable = deletable;
    this.preventSubmitting = preventSubmitting;
  }
  equals(other) {
    return this.property.equals(other.property) && this.valueIndex == other.valueIndex && this.message == other.message;
  }
}
class PscContext {
  constructor() {
    __publicField(this, "segments", []);
    __publicField(this, "globalErrors", []);
    __publicField(this, "globalMatches", []);
  }
  get preventSubmitting() {
    var _a2;
    const error2 = ((_a2 = this.globalErrors) == null ? void 0 : _a2.filter((e2) => e2.preventSubmitting).length) > 0 || this.segments.some(
      (s2) => {
        var _a3;
        return (_a3 = s2.matchResults) == null ? void 0 : _a3.some((t2) => t2.errors && t2.errors.length > 0);
      }
    );
    if (error2) {
      return true;
    }
    const missingProperties = allMatchers.filter(
      (a2) => a2.isRequired && !this.segments.some(
        (e2) => e2.matchResults.some((r2) => r2.property.type == a2.propertyType)
      )
    );
    return missingProperties.length > 0;
  }
}
function convertToPscValueFromPathConfigurationDto(pc2) {
  const value2 = [];
  if (pc2.path) {
    value2.push({
      value: new PscMatcherValue({
        valueType: ResourceMatcherValueType.FixedText,
        fixedText: pc2.path
      }),
      property: PscProperty.RootPath
    });
  }
  if (pc2.rpmValues) {
    for (const segment of pc2.rpmValues) {
      value2.push({
        value: new PscMatcherValue({
          valueType: segment.valueType,
          fixedText: segment.fixedText ?? void 0,
          regex: segment.regex ?? void 0,
          layer: segment.layer ?? void 0
        }),
        property: new PscProperty({
          isCustom: segment.isCustomProperty,
          id: segment.propertyId
        })
      });
    }
  }
  console.log("Convert dto value to component value", pc2, value2);
  return value2;
}
function convertToPathConfigurationDtoFromPscValue(pmvs) {
  var _a2, _b2;
  const rootPath = (_b2 = (_a2 = pmvs.filter((v2) => v2.property.isRootPath)[0]) == null ? void 0 : _a2.value) == null ? void 0 : _b2.fixedText;
  const dto = {
    path: rootPath,
    // regex: resourceRegex,
    rpmValues: pmvs.filter((v2) => !v2.property.isRootPath).map((v2) => {
      return {
        propertyId: v2.property.id,
        isCustomProperty: v2.property.isCustom,
        fixedText: v2.value.fixedText,
        layer: v2.value.layer,
        regex: v2.value.regex,
        valueType: v2.value.valueType
      };
    })
  };
  console.log("Convert component value to dto value", pmvs, dto);
  return dto;
}
function getResultFromExecAll(regex2, str) {
  const matches = execAll(regex2, str);
  if (matches) {
    const capturedMap = {};
    let firstMatch;
    let index2;
    for (const m2 of matches) {
      if (m2.groups) {
        Object.keys(m2.groups).forEach((key) => {
          const v2 = m2.groups[key];
          if (v2 != void 0 && v2.length > 0) {
            capturedMap[v2] = true;
          }
        });
      }
      for (let i2 = 1; i2 < m2.length; i2++) {
        const v2 = m2[i2];
        if (v2 != void 0 && v2.length > 0) {
          capturedMap[v2] = true;
        }
      }
      if (firstMatch == void 0) {
        const v2 = m2[0];
        if (v2 != void 0 && v2.length > 0) {
          firstMatch = v2;
          index2 = m2.index;
        }
      }
    }
    const values = Object.keys(capturedMap);
    const result = {};
    if (values.length == 0) {
      if (firstMatch == void 0) {
        return null;
      }
      result.text = firstMatch;
      result.index = index2;
    } else {
      result.groups = values;
    }
    return result;
  }
  return null;
}
const BuildPscContext = (segments, pmvs, visibleMatchers, configurableMatchers, t2, log3 = console.log) => {
  const data = new PscContext();
  data.segments = segments.map((s2) => new Segment({ text: s2 }));
  const allPropertyMatchResults = [];
  let rootSegmentIndex;
  let rootMatchResult;
  const rootPmv = pmvs.find((x2) => x2.property.isRootPath);
  if (rootPmv) {
    const rootMatcherValue = rootPmv.value;
    if (rootMatcherValue) {
      rootMatchResult = PscMatcher.match(
        segments,
        rootMatcherValue,
        -1,
        void 0
      );
      if (rootMatchResult) {
        rootSegmentIndex = rootMatchResult == null ? void 0 : rootMatchResult.index;
      }
    }
    allPropertyMatchResults.push({
      pmv: rootPmv,
      result: rootMatchResult
    });
  }
  let resourceSegmentIndex;
  let resourceMatchResult;
  const resourcePmv = pmvs.find((x2) => x2.property.isResource);
  if (resourcePmv) {
    const resourceMatcherValue = resourcePmv.value;
    if (resourceMatcherValue && rootSegmentIndex != void 0) {
      resourceMatchResult = PscMatcher.match(
        segments,
        resourceMatcherValue,
        rootSegmentIndex,
        segments.length
      );
      if (resourceMatchResult) {
        switch (resourceMatchResult.type) {
          case MatchResultType.Layer:
            resourceSegmentIndex = resourceMatchResult.index;
            break;
          case MatchResultType.Regex:
            data.globalErrors.push(
              new SimpleGlobalError(
                PscProperty.Resource,
                void 0,
                t2(
                  "Resource matcher can not have a regex result(make sure you are not setting groups in regex)"
                ),
                true,
                true
              )
            );
            break;
        }
      }
      allPropertyMatchResults.push({
        pmv: resourcePmv,
        result: resourceMatchResult
      });
    }
  }
  log3(
    `Root index: ${rootSegmentIndex}, resource index: ${resourceSegmentIndex}`
  );
  {
    const pmvIndexByPropertyMap = /* @__PURE__ */ new Map();
    const pmvIndexByPropertyKeyMapCounter = {};
    for (const pmv of pmvs) {
      const { key } = pmv.property;
      let index2 = pmvIndexByPropertyKeyMapCounter[key];
      if (index2 == void 0) {
        index2 = 0;
      }
      pmvIndexByPropertyKeyMapCounter[key] = index2 + 1;
      pmvIndexByPropertyMap.set(pmv, index2);
    }
    for (const pmv of pmvs) {
      const { key } = pmv.property;
      const count = pmvIndexByPropertyKeyMapCounter[key];
      if (count == 1) {
        pmvIndexByPropertyMap.delete(pmv);
      }
    }
    pmvs.filter((v2) => !v2.property.isResource && !v2.property.isRootPath).forEach((pmv) => {
      var _a2;
      let endIndex = resourceSegmentIndex == void 0 ? void 0 : resourceSegmentIndex + 1;
      if (((_a2 = pmv.value) == null ? void 0 : _a2.valueType) == ResourceMatcherValueType.Layer) {
        endIndex = endIndex == void 0 ? void 0 : endIndex - 1;
      }
      const result = PscMatcher.match(
        segments,
        pmv.value,
        rootSegmentIndex,
        endIndex
      );
      log3("Match result for", pmv, "result", result);
      allPropertyMatchResults.push({
        pmv,
        result,
        indexByProperty: pmvIndexByPropertyMap.get(pmv)
      });
    });
  }
  log3("All match results:", allPropertyMatchResults);
  for (const vm of visibleMatchers) {
    const propertyMatchResultsOfMatcher = allPropertyMatchResults.filter(
      (x2) => x2.pmv.property.type == vm.propertyType
    ) || [];
    if (vm.isRequired && propertyMatchResultsOfMatcher.length == 0) {
      data.globalErrors.push(
        new SimpleGlobalError(
          PscProperty.fromPscType(vm.propertyType),
          void 0,
          t2("Missing"),
          false,
          true
        )
      );
    }
    const missingPrerequisites = vm.prerequisites.filter(
      (p2) => allPropertyMatchResults.every((m2) => m2.pmv.property.type != p2)
    );
    let missingPrerequisitesTip;
    if (missingPrerequisites.length > 0) {
      missingPrerequisitesTip = t2(
        "[{{matchers}}] (is)are required to set this property",
        {
          matchers: missingPrerequisites.map((p2) => t2(PscPropertyType[p2])).join(",")
        }
      );
      if (propertyMatchResultsOfMatcher.length > 0) {
        propertyMatchResultsOfMatcher.forEach((r2) => {
          data.globalErrors.push(
            new SimpleGlobalError(
              r2.pmv.property,
              r2.indexByProperty,
              missingPrerequisitesTip,
              false,
              true
            )
          );
        });
      }
    }
    const orderCheckList = [
      matchersAfter[vm.propertyType].map((m2) => m2.propertyType),
      matchersBefore[vm.propertyType].map((m2) => m2.propertyType)
    ];
    log3(
      `Checking order for ${PscPropertyType[vm.propertyType]} with list`,
      orderCheckList
    );
    const getInvalidOrderMatcherTips = (segmentIndex) => {
      const errors = [];
      for (let direction = 0; direction < orderCheckList.length; direction++) {
        const propertyTypes2 = orderCheckList[direction];
        const invalidOrderResultLabels = [];
        for (const pt of propertyTypes2) {
          const pmrs = allPropertyMatchResults.filter((r2) => r2.pmv.property.type == pt) || [];
          for (const pmr of pmrs) {
            if (pmr.result) {
              const mr = pmr.result;
              const si2 = mr.index;
              if (si2 != void 0 && (direction == 0 && si2 <= segmentIndex || direction == 1 && si2 >= segmentIndex)) {
                invalidOrderResultLabels.push(
                  pmr.pmv.property.toString(t2, pmr.indexByProperty)
                );
              }
            }
          }
        }
        if (invalidOrderResultLabels.length > 0) {
          errors.push(
            t2(
              `{{target}} should come ${direction == 1 ? "after" : "before"} {{invalidMatchers}}`,
              {
                target: t2(PscPropertyType[vm.propertyType]),
                invalidMatchers: invalidOrderResultLabels.join(",")
              }
            )
          );
        }
      }
      return errors;
    };
    const readonly = !configurableMatchers.includes(vm);
    for (const pmr of propertyMatchResultsOfMatcher) {
      const r2 = pmr.result;
      log3(
        `Checking result ${pmr.indexByProperty} of ${pmr.pmv.property.toString(t2, pmr.indexByProperty)}`,
        r2
      );
      if (r2 == void 0) {
        data.globalErrors.push(
          new SimpleGlobalError(
            pmr.pmv.property,
            pmr.indexByProperty,
            t2("Match failed"),
            true,
            pmr.pmv.value.valueType != ResourceMatcherValueType.Regex
          )
        );
      } else {
        if (r2.type == MatchResultType.Layer) {
          if (r2.index != void 0) {
            const segmentIndex = r2.index;
            const segment = data.segments[segmentIndex];
            let mr = segment.matchResults.find(
              (a2) => a2.property.equals(pmr.pmv.property) && a2.valueIndex == pmr.indexByProperty
            );
            if (!mr) {
              mr = new SimpleMatchResult(pmr.pmv.property, pmr.indexByProperty);
              mr.readonly = readonly;
              segment.matchResults.push(mr);
            }
            const errors = getInvalidOrderMatcherTips(segmentIndex);
            for (const t22 of errors) {
              mr.errors.push(t22);
            }
          }
        } else {
          if (r2.type == MatchResultType.Regex) {
            data.globalMatches.push(
              new SimpleGlobalMatchResult(
                pmr.pmv.property,
                pmr.indexByProperty,
                r2.matches
              )
            );
          }
        }
      }
    }
    let resourceRegexTargetText = "";
    let commonRegexTargetText = "";
    if (rootSegmentIndex != void 0) {
      resourceRegexTargetText = segments.slice(rootSegmentIndex + 1).join("/");
      if (resourceSegmentIndex != void 0) {
        commonRegexTargetText = segments.slice(rootSegmentIndex + 1, resourceSegmentIndex + 1).join("/");
      }
    }
    log3(
      `Resource regex target: [${resourceRegexTargetText}], Common regex target: [${commonRegexTargetText}]`
    );
    for (let i2 = 0; i2 < segments.length; i2++) {
      const ds = data.segments[i2];
      const sm = new SelectiveMatcher({
        propertyType: vm.propertyType,
        readonly,
        replaceCurrent: !vm.multiple && propertyMatchResultsOfMatcher.length > 0
      });
      if (!readonly) {
        if (missingPrerequisites.length == 0) {
          if (vm.propertyType != PscPropertyType.RootPath) {
            const r2 = sm.matchModes.regex;
            if ((commonRegexTargetText == null ? void 0 : commonRegexTargetText.length) > 0 || vm.propertyType == PscPropertyType.Resource && (resourceRegexTargetText == null ? void 0 : resourceRegexTargetText.length) > 0) {
              r2.text = vm.propertyType == PscPropertyType.Resource ? resourceRegexTargetText : commonRegexTargetText;
              r2.available = true;
            } else {
              r2.errors.push(t2("Match target is not found"));
            }
          }
          const errors = getInvalidOrderMatcherTips(i2);
          if (vm.propertyType == PscPropertyType.RootPath) {
            const oc2 = sm.matchModes.oneClick;
            if (errors.length == 0) {
              oc2.available = true;
            } else {
              for (const t22 of errors) {
                sm.errors.push(t22);
              }
            }
          } else {
            const l2 = sm.matchModes.layer;
            if (errors.length == 0) {
              const layers = [];
              if (rootSegmentIndex != void 0 && rootSegmentIndex > -1) {
                layers.push(i2 - rootSegmentIndex);
                if (resourceSegmentIndex != void 0 && resourceSegmentIndex > -1 && vm.propertyType != PscPropertyType.Resource) {
                  layers.push(i2 - resourceSegmentIndex);
                }
              }
              l2.layers = layers;
              l2.available = true;
            } else {
              for (const t22 of errors) {
                l2.errors.push(t22);
              }
            }
          }
        } else {
          sm.errors.push(missingPrerequisitesTip);
        }
      } else {
        sm.errors.push(t2("Readonly"));
      }
      ds.selectiveMatchers.push(sm);
    }
  }
  data.segments.forEach((s2) => {
    s2.disabled = s2.selectiveMatchers.length == 0 || s2.selectiveMatchers.every((e2) => !e2.isConfigurable);
  });
  log3("Context", data);
  return data;
};
const ByRegex = ({
  onRegexChange,
  modeIsSelected,
  onSelectMode,
  regex: regex2,
  textToBeMatched,
  isResourceProperty
}) => {
  const { t: t2 } = useTranslation();
  const [testResult, setTestResult] = reactExports.useState();
  const [value2, setValue] = reactExports.useState(regex2);
  if (!textToBeMatched) {
    return null;
  }
  const renderTestResult = () => {
    if (testResult) {
      if (!testResult.success) {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1", children: [
          testResult.error && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                color: "danger",
                size: "sm",
                startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon, { className: "text-sm" }),
                variant: "light",
                children: testResult.error
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx("br", {})
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "danger", size: "sm", variant: "light", children: t2("Test failed, please check your regex") })
        ] });
      } else {
        let { tip } = testResult;
        let values;
        if (testResult.groups != void 0) {
          values = testResult.groups;
        } else {
          if (testResult.text != void 0 && testResult.text.length > 0) {
            const sub = textToBeMatched.substring(
              0,
              testResult.index + testResult.text.length
            );
            const segments = splitPathIntoSegments(sub);
            const match5 = splitPathIntoSegments(textToBeMatched)[segments.length - 1];
            values = match5 == void 0 ? [] : [match5];
          }
        }
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1", children: [
          tip && /* @__PURE__ */ jsxRuntimeExports.jsx(
            Chip,
            {
              color: "warning",
              size: "sm",
              startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "text-sm" }),
              variant: "light",
              children: tip
            }
          ),
          values && values.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-1 items-center", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-bold", children: t2("Match result") }),
            values.map((v2) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: v2 }))
          ] })
        ] });
      }
    }
    return;
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { isHoverable: true, className: "mb-2 cursor-pointer w-full", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(card_header_default, { className: "text-lg font-bold", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        radio_group_default,
        {
          value: modeIsSelected ? "regex" : "",
          onValueChange: onSelectMode,
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: "regex", children: t2("Set by {{thing}}", { thing: t2("regex") }) })
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Tooltip$1,
        {
          content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
            t2("/ is the directory separator always, not \\"),
            /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
            t2(
              "The whole matched text will be ignored if capturing groups are used"
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
            t2(
              "You should not use capturing groups on Resource property due to partial path is not available to match a file system entry"
            )
          ] }),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base ml-2" })
        }
      )
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("Text to be matched") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "light", children: textToBeMatched })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            isClearable: true,
            "aria-label": "please input",
            style: { width: "100%" },
            value: value2,
            onClear: () => {
              setValue(void 0);
            },
            onClick: () => {
              if (!modeIsSelected) {
                onSelectMode();
              }
            },
            onValueChange: (v2) => {
              setValue(v2);
            }
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            disabled: value2 == void 0,
            onClick: () => {
              if (value2) {
                try {
                  const v2 = getResultFromExecAll(
                    new RegExp(value2),
                    textToBeMatched
                  );
                  console.log(v2, isResourceProperty);
                  if (v2 && v2.groups && v2.groups.length > 0 && isResourceProperty) {
                    throw new Error(
                      t2(
                        "Capturing groups are not allowed on Resource property"
                      )
                    );
                  }
                  let tip;
                  if (v2) {
                    if (v2.groups && v2.groups.length > 0) {
                      tip = t2(
                        "Capturing groups are used, only matched text will be applied"
                      );
                    } else {
                      if (v2.text != void 0 && v2.text.length > 0) {
                        tip = t2(
                          "Whole segment will be applied if capturing group is not used"
                        );
                      }
                    }
                  } else {
                    tip = t2(
                      "No text was matched, but you can still save the regular expression."
                    );
                  }
                  setTestResult({
                    success: true,
                    ...v2,
                    tip
                  });
                  onRegexChange(value2);
                } catch (e2) {
                  setTestResult({
                    success: false,
                    error: e2.message
                  });
                }
              }
            },
            children: t2("Test")
          }
        )
      ] }),
      renderTestResult()
    ] }) })
  ] });
};
ByRegex.displayName = "ByRegex";
class SegmentMatcherConfigurationModesData {
  constructor(init2) {
    __publicField(this, "layers", []);
    __publicField(this, "regex");
    Object.assign(this, init2);
  }
  get isConfigurable() {
    var _a2;
    return this.layers.length > 0 || ((_a2 = this.regex) == null ? void 0 : _a2.text) != void 0;
  }
  get isFullConfigurable() {
    var _a2;
    return this.layers.length > 0 && ((_a2 = this.regex) == null ? void 0 : _a2.text) != void 0;
  }
}
const getDefaultValue = (modesData) => {
  if (modesData) {
    if (modesData.layers.length > 0) {
      return {
        layer: modesData.layers[0]
      };
    }
  }
  return;
};
const PathSegmentRenderOptions = {
  root: {
    color: "warning",
    tip: "Segment of root path"
  },
  resource: {
    color: "warning",
    tip: "Segment of resource"
  },
  current: {
    color: "primary",
    tip: "Current segment"
  }
};
const SegmentMatcherConfiguration = ({
  defaultValue: defaultValue2,
  modesData = new SegmentMatcherConfigurationModesData(),
  onSubmit,
  property: property2,
  segments,
  segmentMarkers,
  ...props
}) => {
  var _a2;
  const { t: t2 } = useTranslation();
  const defaultMode = modesData.layers.length > 0 ? "layer" : Object.keys(modesData)[0];
  const [mode, setMode] = reactExports.useState(defaultMode);
  const [value2, setValue] = reactExports.useState(
    defaultValue2 ?? getDefaultValue(modesData)
  );
  useUpdateEffect(() => {
    switch (mode) {
      case "layer":
        break;
      case "regex":
        setValue({
          ...value2 || {},
          layer: void 0
        });
        break;
    }
  }, [mode]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          isDisabled: !value2 || mode == "layer" && !value2.layer || mode == "regex" && !value2.regex
        }
      },
      size: "lg",
      title: t2("Configure [{{property}}] property for path segment", {
        property: property2.name
      }),
      onDestroyed: props.onDestroyed,
      onOk: async () => {
        onSubmit == null ? void 0 : onSubmit(
          new PscMatcherValue({
            ...value2,
            valueType: mode == "layer" ? ResourceMatcherValueType.Layer : ResourceMatcherValueType.Regex
          })
        );
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-bold", children: t2("Path segment") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1 mb-2", children: segments.map((segment, index2) => {
          const marker = segmentMarkers[index2];
          const options = PathSegmentRenderOptions[marker];
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            options != void 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2(options.tip), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: options.color, variant: "light", children: segment }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: segment }),
            index2 != segments.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "", children: "/" })
          ] });
        }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          ByLayer,
          {
            layers: modesData.layers,
            modeIsSelected: mode == "layer",
            selectedLayer: value2 == null ? void 0 : value2.layer,
            onSelectLayer: (layer2) => {
              if (mode != "layer") {
                setMode("layer");
              }
              setValue({
                ...value2,
                layer: layer2
              });
            },
            onSelectMode: () => {
              setMode("layer");
            }
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          ByRegex,
          {
            isResourceProperty: property2.id == ResourceProperty.Resource && !property2.isCustom,
            modeIsSelected: mode == "regex",
            regex: value2 == null ? void 0 : value2.regex,
            textToBeMatched: (_a2 = modesData.regex) == null ? void 0 : _a2.text,
            onRegexChange: (v2) => {
              setValue({
                ...value2,
                regex: v2
              });
            },
            onSelectMode: () => {
              setMode("regex");
            }
          }
        )
      ] })
    }
  );
};
SegmentMatcherConfiguration.displayName = "SegmentMatcherConfiguration";
const Segments = ({
  segments,
  isDirectory,
  value: value2,
  onChange,
  onDeleteMatcherValue,
  visibleMatchers
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const rootDomRef = reactExports.useRef(null);
  const buildMatchModeTip = (name2, icon, available, errors) => {
    const inner = /* @__PURE__ */ jsxRuntimeExports.jsx(
      Chip,
      {
        color: available ? "success" : "warning",
        radius: "sm",
        size: "sm",
        startContent: icon,
        variant: "faded",
        children: t2(available ? "{{mode}} mode is available" : "{{mode}} mode is unavailable", {
          mode: name2
        })
      }
    );
    if (available || errors.length == 0) {
      return inner;
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      Tooltip$1,
      {
        content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: errors.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e2) => /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: e2 })) }) }),
        children: inner
      }
    );
  };
  const buildSelectiveMatcherRightContent = (m2) => {
    const { layer: l2, regex: r2, oneClick: o2 } = m2.matchModes;
    const showReplace = m2.isConfigurable && m2.replaceCurrent;
    const firstLineNodes = [
      buildMatchModeTip(
        t2("Layer"),
        /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$d, { className: "text-sm" }),
        l2.available,
        l2.errors
      ),
      buildMatchModeTip(
        t2("Regex"),
        /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$P, { className: "text-sm" }),
        r2.available,
        r2.errors
      )
    ];
    if (showReplace) {
      firstLineNodes.push(
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Chip,
          {
            color: "warning",
            radius: "sm",
            size: "sm",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$g, { className: "text-sm" }),
            variant: "faded",
            children: t2("Selected value will be replaced")
          }
        )
      );
    }
    return firstLineNodes;
  };
  const selectMatcher = (c2, property2, newValue) => {
    let pvs = value2.filter((v2) => v2.property.equals(property2));
    const nv = value2.filter((v2) => !pvs.includes(v2));
    if (!c2.multiple) {
      pvs.splice(0, pvs.length);
    }
    const sameValue = pvs.find((v2) => {
      var _a2;
      return v2.property.equals(property2) && ((_a2 = v2.value) == null ? void 0 : _a2.equals(newValue));
    });
    if (!sameValue) {
      pvs.push({
        property: property2,
        value: newValue
      });
    }
    nv.push(...pvs);
    console.log("Changing value", nv, c2, property2, newValue, sameValue);
    onChange([...nv]);
  };
  const renderSegments = () => {
    if (segments.length > 0) {
      const elements = [];
      const rootPathSegmentIndex = segments.findIndex(
        (s2) => s2.matchResults.some((b2) => b2.property.isRootPath)
      );
      const resourceSegmentIndex = segments.findIndex(
        (s2) => s2.matchResults.some((b2) => b2.property.isResource)
      );
      for (let i2 = 0; i2 < segments.length; i2++) {
        if (i2 > 0) {
          elements.push(
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xl", style: { color: "var(--bakaui-warning)" }, children: "/" })
          );
        }
        const { text: text2, selectiveMatchers = [], matchResults = [], disabled } = segments[i2];
        const sc2 = /* @__PURE__ */ jsxRuntimeExports.jsxs(
          "div",
          {
            className: `${disabled ? "cursor-default opacity-60" : "cursor-pointer"} px-2 py-1 hover:bg-[var(--bakaui-default)] rounded`,
            children: [
              matchResults.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-start gap-1 flex-wrap", children: matchResults.map((mr) => {
                var _a2;
                const { property: property2, errors = [] } = mr;
                const hasError = errors.length > 0;
                const values = value2.filter((v22) => v22.property.equals(mr.property));
                const v2 = (_a2 = values[mr.valueIndex ?? 0]) == null ? void 0 : _a2.value;
                let colorKey = "primary";
                if (!mr.property.isCustom && (mr.property.id == ResourceProperty.Resource || mr.property.id == ResourceProperty.RootPath)) {
                  colorKey = "success";
                }
                if (hasError) {
                  colorKey = "danger";
                }
                const comp = /* @__PURE__ */ jsxRuntimeExports.jsxs(
                  Chip,
                  {
                    color: colorKey,
                    radius: "sm",
                    size: "sm",
                    variant: "bordered",
                    onClose: !mr.readonly ? () => {
                      onDeleteMatcherValue(mr.property, mr.valueIndex);
                    } : void 0,
                    children: [
                      hasError && /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon, { className: "text-sm" }),
                      property2.toString(t2, mr.valueIndex),
                      " ",
                      v2 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: PscMatcherValue.ToString(t2, v2) })
                    ]
                  }
                );
                if (hasError) {
                  return /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Tooltip$1,
                    {
                      content: errors.map((e2) => {
                        return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                          "div",
                          {
                            className: "error",
                            style: {
                              display: "flex",
                              alignItems: "center",
                              gap: 2,
                              color: "red"
                            },
                            children: [
                              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon, { className: "text-sm" }),
                              e2
                            ]
                          }
                        );
                      }),
                      placement: "top",
                      children: comp
                    }
                  );
                } else {
                  return comp;
                }
              }) }),
              rootDomRef.current && /* @__PURE__ */ jsxRuntimeExports.jsx(
                PopoverComponent,
                {
                  portalContainer: rootDomRef.current,
                  trigger: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-lg", children: text2 }),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-4", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-bold text-xl", children: t2("Mark this path segment as") }) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                      listbox_default,
                      {
                        disabledKeys: selectiveMatchers.filter((m2) => !m2.isConfigurable).map((m2) => selectiveMatchers.indexOf(m2)).map((x2) => x2.toString()),
                        variant: "bordered",
                        onAction: (k2) => {
                          console.log("on action", k2);
                          const m2 = selectiveMatchers[k2];
                          if (m2.isConfigurable) {
                            const o2 = m2.matchModes.oneClick;
                            if (o2.available) {
                              selectMatcher(
                                visibleMatchers.find((t22) => t22.propertyType == m2.propertyType),
                                PscProperty.fromPscType(m2.propertyType),
                                new PscMatcherValue({
                                  valueType: ResourceMatcherValueType.FixedText,
                                  fixedText: segments.map((s2) => s2.text).slice(0, i2 + 1).join(BusinessConstants.pathSeparator)
                                })
                              );
                            } else {
                              if (m2.useSmc) {
                                const props = {
                                  segments: segments.map((s2) => s2.text),
                                  segmentMarkers: {
                                    [rootPathSegmentIndex]: "root",
                                    [resourceSegmentIndex]: "resource",
                                    [i2]: "current"
                                  },
                                  modesData: m2.buildModesData()
                                };
                                switch (m2.propertyType) {
                                  case PscPropertyType.RootPath:
                                  case PscPropertyType.ParentResource:
                                  case PscPropertyType.Resource:
                                  case PscPropertyType.Rating:
                                  case PscPropertyType.Introduction: {
                                    const property2 = PscProperty.fromPscType(m2.propertyType);
                                    createPortal(SegmentMatcherConfiguration, {
                                      ...props,
                                      property: property2,
                                      onSubmit: (value22) => {
                                        selectMatcher(
                                          visibleMatchers.find(
                                            (t22) => t22.propertyType == m2.propertyType
                                          ),
                                          property2,
                                          value22
                                        );
                                      }
                                    });
                                    break;
                                  }
                                  case PscPropertyType.CustomProperty: {
                                    createPortal(PropertySelector, {
                                      pool: PropertyPool.Custom,
                                      multiple: false,
                                      addable: true,
                                      onSubmit: async (selection) => {
                                        const p2 = selection[0];
                                        const property2 = new PscProperty({
                                          id: p2.id,
                                          isCustom: true,
                                          name: p2.name
                                        });
                                        createPortal(SegmentMatcherConfiguration, {
                                          ...props,
                                          property: property2,
                                          onSubmit: (value22) => {
                                            selectMatcher(
                                              visibleMatchers.find(
                                                (t22) => t22.propertyType == m2.propertyType
                                              ),
                                              property2,
                                              value22
                                            );
                                          }
                                        });
                                      }
                                    });
                                    break;
                                  }
                                }
                              }
                            }
                          }
                        },
                        children: selectiveMatchers.map((m2, i22) => {
                          const rightContents = buildSelectiveMatcherRightContent(m2);
                          return /* @__PURE__ */ jsxRuntimeExports.jsx(
                            listbox_item_base_default,
                            {
                              description: m2.errors.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
                                "ul",
                                {
                                  className: "mt-1 flex flex-wrap gap-1",
                                  style: { color: "var(--bakaui-danger)" },
                                  children: m2.errors.map((e2) => /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: e2 }))
                                }
                              ),
                              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-4", children: [
                                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-base", children: t2(PscPropertyType[m2.propertyType]) }),
                                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: rightContents })
                              ] })
                            },
                            i22
                          );
                        })
                      }
                    ) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "italic opacity-60 mt-1", children: t2(
                      "Some properties may not able to set by layer, but you still can set it by regex."
                    ) })
                  ] })
                }
              )
            ]
          },
          i2
        );
        elements.push(sc2);
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap items-center gap-1", children: elements });
    }
  };
  if (segments.length == 0) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      ref: rootDomRef,
      className: "path-segments-container flex items-center gap-2 border-small px-2 py-1 rounded-small border-default-200",
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-[24px] h-[24px] flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          FileSystemEntryIcon,
          {
            path: segments.map((s2) => s2.text).join("/"),
            size: 24,
            type: isDirectory ? IconType.Directory : IconType.Dynamic
          }
        ) }),
        renderSegments()
      ]
    }
  );
};
Segments.displayName = "Segments";
const FileExtensionLoader = ({
  segments,
  value: value2,
  isDirectory,
  matchers: matchers2,
  onChange
}) => {
  var _a2, _b2;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [fileResource, setFileResource] = reactExports.useState();
  const [fileResourceExtensions, setFileResourceExtensions] = reactExports.useState();
  const [fileResourceExtensionCandidates, setFileResourceExtensionCandidates] = reactExports.useState([]);
  const [loadingFileResourceExtensions, setLoadingFileResourceExtensions] = reactExports.useState(false);
  const resourceMatcherMatchesLastLayerRef = reactExports.useRef(false);
  const fileSegments = (fileResource == null ? void 0 : fileResource.split(".")) ?? [];
  let currentFileExt;
  if ((fileSegments == null ? void 0 : fileSegments.length) > 1) {
    currentFileExt = `.${fileSegments[fileSegments.length - 1]}`;
  }
  reactExports.useEffect(() => {
    var _a3, _b3;
    if (!isDirectory) {
      if (matchers2.some(
        (a2) => a2.propertyType == PscPropertyType.Resource && !a2.readonly
      )) {
        const resourceMatcherValue = (_a3 = value2[ResourceProperty.Resource]) == null ? void 0 : _a3[0];
        if (resourceMatcherValue) {
          const rootMatch = PscMatcher.matchFirst(
            segments,
            value2.filter((v2) => v2.property.isRootPath && v2.value != void 0).map((v2) => v2.value)
          );
          const rootSegmentIndex2 = (rootMatch == null ? void 0 : rootMatch.index) ?? -1;
          const resourceSegmentIndex = ((_b3 = PscMatcher.match(
            segments,
            resourceMatcherValue,
            rootSegmentIndex2,
            segments.length
          )) == null ? void 0 : _b3.index) ?? -1;
          if (resourceSegmentIndex > -1) {
            const resourceMatcherMatchesLastLayer = resourceSegmentIndex == segments.length - 1;
            if (resourceMatcherMatchesLastLayer != resourceMatcherMatchesLastLayerRef.current) {
              resourceMatcherMatchesLastLayerRef.current = resourceMatcherMatchesLastLayer;
              if (resourceMatcherMatchesLastLayer) {
                setFileResource(segments.join("/"));
              } else {
                setFileResource(void 0);
              }
            }
          }
        }
      }
    }
  }, [value2]);
  useUpdateEffect(() => {
    if (fileResource == void 0) {
      setFileResourceExtensions(void 0);
      setFileResourceExtensionCandidates([]);
    }
  }, [fileResource]);
  if (fileResource == void 0) {
    return null;
  }
  const rootSegmentIndex = ((_b2 = PscMatcher == null ? void 0 : PscMatcher.match(
    segments,
    (_a2 = value2.find((v2) => v2.property.isRootPath)) == null ? void 0 : _a2.value,
    -1,
    void 0
  )) == null ? void 0 : _b2.index) ?? -1;
  const rootPathIsSelected = rootSegmentIndex > -1;
  const loaderBtn = /* @__PURE__ */ jsxRuntimeExports.jsx(
    Button,
    {
      color: "primary",
      isDisabled: !rootPathIsSelected,
      isLoading: loadingFileResourceExtensions,
      onClick: () => {
        setLoadingFileResourceExtensions(true);
        BApi$1.file.getFileExtensionCounts({
          sampleFile: fileResource,
          rootPath: segments.slice(0, rootSegmentIndex + 1).join(BusinessConstants.pathSeparator)
        }).then((a2) => {
          if (!a2.code) {
            const counts = a2.data ?? {};
            const list2 = Object.keys(counts).sort((x2, y2) => counts[y2] - counts[x2]).map((b2) => ({
              ext: b2,
              count: counts[b2]
            }));
            setFileResourceExtensions(list2);
            if (currentFileExt) {
              setFileResourceExtensionCandidates([currentFileExt]);
              const newRegex = buildLayerBasedPathRegexString(
                segments.length - rootSegmentIndex - 1,
                [currentFileExt]
              );
              const newValue = value2.filter(
                (x2) => !x2.property.equals(PscProperty.Resource)
              );
              newValue.push({
                property: PscProperty.Resource,
                value: PscMatcherValue.Regex(newRegex)
              });
              onChange(newValue);
            }
          }
        }).finally(() => {
          setLoadingFileResourceExtensions(false);
        });
      },
      children: t2("I need choose files with specific types as resources")
    }
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "file-resource-helper psc-block", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "title", children: t2("Match by file extensions") }),
    fileResourceExtensions == void 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(Message, { type: "warning", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        t2(
          "Please pay attention, you marked a file as a resource. We'll treat all files or folders with same path layer as resources by default. It may not be your actual design(if you chose a movie and its subtitle file has the same path layer, then the subtitle file will be another resource)."
        ),
        t2(
          "If you want to mark resources with specific file types, you can click button below to load all file types and select some of them."
        )
      ] }) }),
      rootPathIsSelected ? loaderBtn : /* @__PURE__ */ jsxRuntimeExports.jsx(PopoverComponent, { align: "t", trigger: loaderBtn, triggerType: "hover", children: t2("Please select root path first.") })
    ] }) : fileResourceExtensions.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(Message, { type: "notice", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        t2("You can mark resources by file types."),
        fileResourceExtensionCandidates.length > 0 ? `${t2("You selected {{count}} file types:", { count: fileResourceExtensionCandidates.length })}${fileResourceExtensionCandidates.join(", ")}` : t2(
          "None of file types has been selected, we'll treat all files or folders with same path layer as your file as resources."
        )
      ] }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(Tag.Group, { style: { marginTop: 5 }, children: fileResourceExtensions.map((e2) => {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Tag.Selectable,
          {
            checked: fileResourceExtensionCandidates.indexOf(e2.ext) > -1,
            size: "small",
            onChange: (c2) => {
              const candidates = fileResourceExtensionCandidates || [];
              const idx = candidates.indexOf(e2.ext);
              const apply2 = (candidates2) => {
                const newRegex = buildLayerBasedPathRegexString(
                  segments.length - rootSegmentIndex - 1,
                  candidates2
                );
                const newValue = value2.filter(
                  (x2) => !x2.property.equals(PscProperty.Resource)
                );
                newValue.push({
                  property: PscProperty.Resource,
                  value: PscMatcherValue.Regex(newRegex)
                });
                setFileResourceExtensionCandidates([...candidates2]);
              };
              if (idx == -1) {
                candidates.push(e2.ext);
              } else {
                if (e2.ext == currentFileExt) {
                  createPortal(Modal, {
                    defaultVisible: true,
                    title: t2(
                      "You are deselecting extension same as file you selected"
                    ),
                    children: t2(
                      "After your deselection, the current file will not be treat as a resource, and you need reset the Resource part from path segments, are you sure to remove file type: {{ext}}?",
                      { ext: currentFileExt }
                    ),
                    onOk: () => async () => {
                      candidates.splice(idx, 1);
                      apply2(candidates);
                    }
                  });
                  return;
                } else {
                  candidates.splice(idx, 1);
                }
              }
              apply2(candidates);
            },
            children: [
              e2.ext,
              " ",
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                badge_default,
                {
                  count: e2.count,
                  overflowCount: 99999999,
                  style: { backgroundColor: "#87d068" }
                }
              )
            ]
          }
        );
      }) })
    ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: t2("No known file type is found.") })
  ] });
};
FileExtensionLoader.displayName = "FileExtensionLoader";
const GlobalMatches = ({ matches, value: value2, onDeleteMatcherValue }) => {
  const { t: t2 } = useTranslation();
  if (matches.length > 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col mt-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-bold mb-1", children: t2("Global matches") }),
      matches.map((gm) => {
        var _a2, _b2;
        const v2 = (_b2 = (_a2 = value2 == null ? void 0 : value2.filter((v22) => v22.property.equals(gm.property))) == null ? void 0 : _a2[gm.valueIndex ?? 0]) == null ? void 0 : _b2.value;
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: gm.property.toString(t2, gm.valueIndex) }),
          v2 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: PscMatcherValue.ToString(t2, v2) }),
          t2("Matched {{count}} results", {
            count: gm.matches.length
          }),
          gm.matches.map((m2) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: m2 })),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "danger",
              size: "sm",
              variant: "light",
              onClick: () => {
                onDeleteMatcherValue(gm.property, gm.valueIndex);
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" })
            }
          )
        ] });
      })
    ] });
  }
  return null;
};
GlobalMatches.displayName = "GlobalMatches";
const Validate = ({ isDisabled, value: value2 }) => {
  const { t: t2 } = useTranslation();
  const [loading, setLoading] = reactExports.useState(false);
  const [result, setResult] = reactExports.useState();
  const buttonRef = reactExports.useRef(null);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        ref: buttonRef,
        color: "primary",
        disabled: isDisabled,
        isLoading: loading,
        size: "small",
        onClick: () => {
          setLoading(true);
          BApi$1.mediaLibrary.validatePathConfiguration(
            convertToPathConfigurationDtoFromPscValue(value2)
          ).then((t22) => {
            setResult(t22.data);
          }).finally(() => {
            setLoading(false);
          });
        },
        children: t2("Validate")
      }
    ),
    buttonRef.current && /* @__PURE__ */ jsxRuntimeExports.jsx(
      Modal,
      {
        footer: {
          actions: ["cancel"],
          cancelProps: {
            children: t2("Close")
          }
        },
        portalContainer: buttonRef.current,
        size: "xl",
        title: t2(
          "Found top {{count}} resources. (shows up to 100 results)",
          { count: ((result == null ? void 0 : result.resources) || []).length }
        ),
        visible: !!result,
        onClose: () => {
          setResult(void 0);
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx("section", { className: "mt-1", children: result && result.resources && result.resources.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1 flex flex-col gap-1", children: result.resources.map((e2, i2) => {
          var _a2, _b2, _c2, _d, _e;
          const {
            globalMatchedValues,
            isDirectory,
            segmentAndMatchedValues
          } = e2;
          console.log(globalMatchedValues);
          const segments = [];
          for (let j2 = 0; j2 < (segmentAndMatchedValues == null ? void 0 : segmentAndMatchedValues.length); j2++) {
            const ps = segmentAndMatchedValues[j2];
            const matchLabels = [];
            if (j2 == segmentAndMatchedValues.length - 1) {
              matchLabels.push(
                t2(ResourceProperty[ResourceProperty.Resource])
              );
            }
            if (((_a2 = ps.propertyKeys) == null ? void 0 : _a2.length) > 0) {
              for (const p2 of ps.propertyKeys) {
                if (p2.isCustom) {
                  const pName = (_c2 = (_b2 = result.customPropertyMap) == null ? void 0 : _b2[p2.id]) == null ? void 0 : _c2.name;
                  matchLabels.push(
                    pName ?? t2("Unknown property")
                  );
                } else {
                  matchLabels.push(t2(ResourceProperty[p2.id]));
                }
              }
            }
            segments.push(
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [
                matchLabels.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
                  "div",
                  {
                    className: `text-sm ${matchLabels.length > 1 ? "conflict" : ""}`,
                    style: {
                      color: matchLabels.length > 1 ? "var(--bakaui-danger)" : "var(--bakaui-primary)"
                    },
                    children: matchLabels.join(", ")
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm", children: ps.segmentText })
              ] })
            );
            if (j2 != e2.segmentAndMatchedValues.length - 1) {
              segments.push(
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  "span",
                  {
                    className: "",
                    style: { color: "var(--bakaui-warning)" },
                    children: "/"
                  }
                )
              );
            }
          }
          const globalMatchesElements = [];
          if (globalMatchedValues.length > 0) {
            for (const gmv of globalMatchedValues) {
              const { textValues, propertyKey } = gmv;
              const propertyLabel = propertyKey.isCustom ? ((_e = (_d = result.customPropertyMap) == null ? void 0 : _d[propertyKey.id]) == null ? void 0 : _e.name) ?? t2("Unknown property") : t2(ResourceProperty[propertyKey.id]);
              if ((textValues == null ? void 0 : textValues.length) > 0) {
                globalMatchesElements.push(
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm font-bold", children: propertyLabel }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: textValues.map((v2) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: v2 })) })
                  ] })
                );
              }
            }
          }
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(
            "div",
            {
              className: "flex items-center p-1 rounded border-default-200",
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mr-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: i2 + 1 }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grow flex flex-col gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(MdCheckCircle, { className: "text-base" }),
                    segments
                  ] }),
                  globalMatchesElements.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-start flex-wrap gap-1 border-default-200 pt-1", children: globalMatchesElements })
                ] })
              ]
            }
          );
        }) }) })
      }
    )
  ] });
};
Validate.displayName = "Validate";
const BottomOperations = ({ value: value2, hasError }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Validate, { isDisabled: hasError, value: value2 }) });
};
BottomOperations.displayName = "BottomOperations";
class PathSegmentConfigurationPropsMatcherOptions {
  constructor(init2) {
    __publicField(this, "propertyType");
    __publicField(this, "readonly", false);
    Object.assign(this, init2);
  }
}
const PathSegmentsConfigurationInner = React$5.forwardRef(
  (props, ref) => {
    useTraceUpdate(props, "PathSegmentsConfiguration");
    const {
      segments = [],
      isDirectory,
      matchers: matchers2 = [],
      defaultValue: defaultValue2,
      onChange = (v2) => {
      }
    } = props;
    const log3 = buildLogger("PathSegmentsConfiguration");
    log3("Rendering with props", props);
    const { t: t2 } = useTranslation();
    const forceUpdate = useUpdate();
    const { createPortal } = useBakabaseContext();
    const [value2, setValue] = reactExports.useState(
      defaultValue2 ?? []
    );
    const valueRef = reactExports.useRef(value2);
    const visibleMatchers = matchers2.map((a2) => allMatchers.find((b2) => b2.propertyType == a2.propertyType)).filter((x2) => x2).sort((a2, b2) => a2.checkOrder - b2.checkOrder);
    const configurableMatchers = matchers2.filter((a2) => !a2.readonly).map(
      (a2) => visibleMatchers.find((b2) => b2.propertyType == a2.propertyType)
    );
    const [customPropertyNameMap, setCustomPropertyNameMap] = reactExports.useState({});
    reactExports.useEffect(() => {
      valueRef.current = value2;
      log3("Changed:", JSON.parse(JSON.stringify(value2)));
      onChange(value2);
    }, [value2]);
    useUpdateEffect(() => {
      value2.forEach((v2) => {
        var _a2;
        if (v2.property.isCustom) {
          (_a2 = v2.property).name ?? (_a2.name = customPropertyNameMap[v2.property.id]);
        }
      });
      forceUpdate();
    }, [customPropertyNameMap]);
    reactExports.useEffect(() => {
      BApi$1.customProperty.getAllCustomProperties().then((x2) => {
        const data = x2.data ?? [];
        const pnMap = data.reduce((s2, t22) => {
          s2[t22.id] = t22.name;
          return s2;
        }, {});
        setCustomPropertyNameMap(pnMap);
      });
    }, []);
    reactExports.useImperativeHandle(
      ref,
      () => ({
        get context() {
          return BuildPscContext(
            segments,
            value2,
            visibleMatchers,
            configurableMatchers,
            t2,
            log3
          );
        }
      }),
      [segments, value2, visibleMatchers, configurableMatchers]
    );
    const onDeleteMatcherValue = (property2, valueIndex = 0) => {
      createPortal(Modal, {
        defaultVisible: true,
        title: t2("Sure to delete this property?"),
        onOk: () => {
          var _a2;
          const bad = (_a2 = value2 == null ? void 0 : value2.filter((v2) => v2.property.equals(property2))) == null ? void 0 : _a2[valueIndex ?? 0];
          setValue(value2.filter((v2) => v2 != bad));
        }
      });
    };
    const ctx = BuildPscContext(
      segments,
      value2,
      visibleMatchers,
      configurableMatchers,
      t2,
      log3
    );
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "path-segments-configuration flex flex-col gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(Tips, {}),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Errors,
        {
          errors: ctx.globalErrors,
          value: value2,
          onDeleteMatcherValue
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Segments,
        {
          isDirectory,
          segments: ctx.segments,
          value: value2,
          visibleMatchers,
          onChange: setValue,
          onDeleteMatcherValue
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        FileExtensionLoader,
        {
          isDirectory,
          matchers: matchers2,
          segments,
          value: value2,
          onChange: (v2) => setValue(v2)
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        GlobalMatches,
        {
          matches: ctx.globalMatches,
          value: value2,
          onDeleteMatcherValue
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(BottomOperations, { hasError: ctx.preventSubmitting, value: value2 })
    ] });
  }
);
const PathSegmentsConfiguration = React$5.memo(PathSegmentsConfigurationInner);
PathSegmentsConfiguration.displayName = "PathSegmentsConfiguration";
const log$4 = buildLogger("PathConfigurationDialog");
const PathConfigurationDialog = ({
  libraryId,
  pcIdx,
  onClosed,
  ...props
}) => {
  const { t: t2 } = useTranslation();
  useUpdate();
  const { createPortal } = useBakabaseContext();
  const [library, setLibrary] = reactExports.useState();
  const [customPropertyMap, setCustomPropertyMap] = reactExports.useState({});
  reactExports.useEffect(() => {
    log$4("Initialize with", props);
    loadLibrary();
    BApi$1.customProperty.getAllCustomProperties().then((r2) => {
      const ps = r2.data || [];
      setCustomPropertyMap(
        ps.reduce((s2, t22) => {
          s2[t22.id] = { name: t22.name };
          return s2;
        }, {})
      );
    });
  }, []);
  const loadLibrary = async () => {
    const r2 = await BApi$1.mediaLibrary.getMediaLibrary(libraryId, {
      additionalItems: MediaLibraryAdditionalItem.PathConfigurationBoundProperties
    });
    const l2 = r2.data;
    if (l2) {
      setLibrary({
        id: l2.id,
        name: l2.name,
        pathConfigurations: l2.pathConfigurations ?? []
      });
    }
  };
  if (!library) {
    return null;
  }
  const pc2 = library.pathConfigurations[pcIdx];
  const save = async (patches) => {
    const newPcs = library.pathConfigurations.slice();
    newPcs.splice(pcIdx, 1, { ...pc2, ...patches });
    log$4(
      `Saving ${pcIdx} of ${library.pathConfigurations.length} in ${library.name}`,
      pc2,
      newPcs
    );
    await BApi$1.mediaLibrary.patchMediaLibrary(library.id, {
      pathConfigurations: newPcs
    });
    await loadLibrary();
  };
  const showPsc = (segments, pc22, isDirectory) => {
    const simpleMatchers = {
      [PscPropertyType.RootPath]: true,
      [PscPropertyType.Resource]: false,
      [PscPropertyType.ParentResource]: false,
      [PscPropertyType.CustomProperty]: false,
      [PscPropertyType.Rating]: false,
      [PscPropertyType.Introduction]: false
    };
    const matchers2 = Object.keys(simpleMatchers).reduce((ts, t22) => {
      ts.push(
        new PathSegmentConfigurationPropsMatcherOptions({
          propertyType: parseInt(t22, 10),
          readonly: simpleMatchers[t22]
        })
      );
      return ts;
    }, []);
    let tmpValue = convertToPscValueFromPathConfigurationDto(pc22);
    createPortal(Modal, {
      defaultVisible: true,
      size: "xl",
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        PathSegmentsConfiguration,
        {
          defaultValue: tmpValue,
          isDirectory: isDirectory || false,
          matchers: matchers2,
          segments,
          onChange: (value2) => {
            tmpValue = value2;
          }
        }
      ),
      onOk: async () => {
        const dto = convertToPathConfigurationDtoFromPscValue(tmpValue);
        console.log(5555, dto);
        await save(dto);
        onClosed(dto);
      }
    });
  };
  const renderRpmValues = () => {
    const values = (pc2 == null ? void 0 : pc2.rpmValues) || [];
    if (values.length == 0) {
      return null;
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 my-1", children: values.map((s2, i2) => {
      let label = s2.propertyName;
      if (label == void 0 || label.length == 0) {
        label = t2("Unknown property");
      }
      let isDeletable = !s2.isResourceProperty;
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Chip,
          {
            color: s2.isResourceProperty ? "primary" : "default",
            radius: "sm",
            size: "sm",
            children: label
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "value select-text", children: PscMatcherValue.ToString(t2, {
          fixedText: s2.fixedText ?? void 0,
          layer: s2.layer ?? void 0,
          regex: s2.regex ?? void 0,
          valueType: s2.valueType
        }) }),
        isDeletable && /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "danger",
            size: "sm",
            variant: "light",
            onClick: () => {
              createPortal(Modal, {
                defaultVisible: true,
                title: t2(
                  "Deleting property locator for {{propertyName}}",
                  { propertyName: label }
                ),
                onOk: async () => {
                  var _a2;
                  (_a2 = pc2.rpmValues) == null ? void 0 : _a2.splice(i2, 1);
                  await BApi$1.mediaLibrary.patchMediaLibrary(libraryId, {
                    pathConfigurations: library.pathConfigurations
                  });
                  await loadLibrary();
                }
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" })
          }
        )
      ] });
    }) });
  };
  const rootPathIsSet = !!(pc2 == null ? void 0 : pc2.path);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel"]
      },
      size: "xl",
      title: t2("Path configuration"),
      onClose: () => {
        onClosed == null ? void 0 : onClosed(pc2);
      },
      onDestroyed: props.onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 shadow", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-base font-bold mb-1", children: t2("Root path") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                onClick: () => {
                  createPortal(FileSystemSelectorModal, {
                    startPath: pc2.path ?? void 0,
                    targetType: "folder",
                    onSelected: (e2) => {
                      save({ path: e2.path });
                    },
                    defaultSelectedPath: (pc2 == null ? void 0 : pc2.path) ?? void 0
                  });
                },
                variant: "light",
                color: "primary",
                children: (pc2 == null ? void 0 : pc2.path) ?? t2("Setup")
              }
            ),
            rootPathIsSet && /* @__PURE__ */ jsxRuntimeExports.jsx(
              RefIcon$G,
              {
                className: "text-base cursor-pointer ml-1",
                onClick: (e2) => {
                  e2.preventDefault();
                  e2.stopPropagation();
                  BApi$1.tool.openFileOrDirectory({ path: pc2.path });
                }
              }
            )
          ] })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-base font-bold", children: t2("Setup how to find resources and properties") }),
          (pc2 == null ? void 0 : pc2.path) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "opacity-60 italic", children: [
            t2(
              "To setup this item, you should pick up a file first within your root path."
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
            t2(
              "If you want to populate properties as many as possible, you should pick up a file with more layers in path."
            )
          ] }),
          renderRpmValues(),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "", children: (pc2 == null ? void 0 : pc2.path) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              variant: "light",
              onClick: () => {
                createPortal(FileSystemSelectorDialog, {
                  // targetType: 'folder',
                  startPath: pc2.path,
                  // targetType: 'file',
                  onSelected: (e2) => {
                    const std = standardizePath(e2.path);
                    const stdPrev = standardizePath(pc2.path);
                    if (stdPrev && std.startsWith(stdPrev)) {
                      const segments = splitPathIntoSegments(e2.path);
                      showPsc(segments, pc2, e2.isDirectory);
                    } else {
                      createPortal(Modal, {
                        defaultVisible: true,
                        title: t2("Error"),
                        children: t2(
                          "You cannot select a file outside the root folder. If you want to change the root folder of your library, you should click on your root folder."
                        ),
                        footer: {
                          actions: ["cancel"]
                        }
                      });
                    }
                  }
                });
              },
              children: t2("Setup")
            }
          ) : /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "warning", size: "sm", variant: "light", children: t2(
            "You need to set up root path before configuring this item"
          ) }) })
        ] })
      ] })
    }
  ) });
};
PathConfigurationDialog.displayName = "PathConfigurationDialog";
const AddRootPathsInBulkDialog = ({
  libraryId,
  onSubmitted,
  onDestroyed
}) => {
  const { t: t2 } = useTranslation();
  const [paths, setPaths] = reactExports.useState([]);
  const [visible, setVisible] = reactExports.useState(true);
  const close = () => {
    setVisible(false);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      size: "xl",
      title: t2("Add root paths in bulk"),
      visible,
      onClose: close,
      onDestroyed,
      onOk: async () => {
        const rsp = await BApi$1.mediaLibrary.addMediaLibraryRootPathsInBulk(
          libraryId,
          { rootPaths: paths }
        );
        if (!rsp.code) {
          onSubmitted == null ? void 0 : onSubmitted();
          close();
        }
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
        paths.map((path, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              className: "flex-1",
              placeholder: t2("Root path"),
              value: path,
              onValueChange: (value2) => {
                const newPaths = [...paths];
                newPaths[index2] = value2;
                setPaths(newPaths);
              }
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "danger",
              size: "sm",
              variant: "light",
              onPress: () => {
                const newPaths = paths.filter((_24, i2) => i2 !== index2);
                setPaths(newPaths);
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdDelete, { className: "text-base" })
            }
          )
        ] }, index2)),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            size: "sm",
            onPress: () => {
              setPaths([...paths, ""]);
            },
            children: t2("Add a root path")
          }
        )
      ] })
    }
  );
};
const SynchronizationConfirmModal = ({ onOk, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      size: "md",
      title: t2("Synchronize resource data"),
      onDestroyed,
      onOk,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "", children: t2(
          "All eligible files or folders under the specified root directory will be saved to the media library."
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-warning text-sm", children: t2(
          "Please note, if you modify the resource path (generally the file name), a new resource associated with the new path will be created after synchronization. You can transfer historical resource data to the new resource or directly delete the historical resource through the resource page."
        ) })
      ]
    }
  );
};
SynchronizationConfirmModal.displayName = "SynchronizationConfirmModal";
const SortableMediaLibrary = ({ library, loadAllMediaLibraries, reloadMediaLibrary }) => {
  var _a2, _b2, _c2;
  const { attributes: attributes2, listeners, setNodeRef, transform: transform2, transition: transition3 } = useSortable({
    id: library.id
  });
  buildLogger("SortableMediaLibrary");
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const style2 = {
    transform: CSS$1.Translate.toString({
      ...transform2,
      scaleY: 1
    }),
    transition: transition3
  };
  const forceUpdate = useUpdate();
  reactExports.useEffect(() => {
  }, []);
  const renderFilter = reactExports.useCallback((pc2) => {
    var _a3;
    const resourceValue = (_a3 = pc2.rpmValues) == null ? void 0 : _a3.find(
      (r2) => !r2.isCustomProperty && r2.propertyId == ResourceProperty.Resource
    );
    let valueComponent;
    if (resourceValue) {
      switch (resourceValue.valueType) {
        case ResourceMatcherValueType.Layer:
          valueComponent = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
            resourceValue.layer > 0 ? "The {{layer}} layer after root path" : "The {{layer}} layer to the resource",
            { layer: Math.abs(resourceValue.layer) }
          ) });
          break;
        case ResourceMatcherValueType.Regex:
          valueComponent = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: resourceValue.regex });
          break;
        case ResourceMatcherValueType.FixedText:
          valueComponent = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: resourceValue.fixedText });
          break;
      }
    }
    if (valueComponent) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "filter", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: t2(ResourceMatcherValueType[resourceValue.valueType]) }),
        valueComponent
      ] });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "unset filter", children: t2("Not set") });
  }, []);
  const renderCustomProperties = reactExports.useCallback((p2) => {
    var _a3;
    let properties2 = ((_a3 = p2.rpmValues) == null ? void 0 : _a3.filter((x2) => !x2.isResourceProperty).map((x2) => x2.propertyName)) ?? [];
    properties2 = properties2.filter((p22, i2) => properties2.indexOf(p22) === i2);
    return properties2.length > 0 ? properties2.map((n2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: n2 ?? t2("Unknown property") });
    }) : t2("Not set");
  }, []);
  const renderAddRootPathInBulkModal = () => {
    createPortal(AddRootPathsInBulkDialog, {
      libraryId: library.id,
      onSubmitted: () => loadAllMediaLibraries()
    });
  };
  const renderAddRootPathModal = () => {
    createPortal(Modal, {
      defaultVisible: true,
      size: "lg",
      title: t2("Add root path"),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          isRequired: true,
          label: t2("Path"),
          onValueChange: (v2) => {
            if (v2) {
              BApi$1.mediaLibrary.addMediaLibraryPathConfiguration(library.id, {
                path: v2
              }).then((b2) => {
                if (!b2.code) {
                  loadAllMediaLibraries();
                }
              });
            }
          }
        }
      )
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      ref: setNodeRef,
      className: "category-page-draggable-media-library libraries-grid",
      style: style2,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "library", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(DragHandle, { ...listeners, ...attributes2 }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs(
              "div",
              {
                className: "edit relative flex items-center gap-1",
                onClick: () => {
                  let n2 = library.name;
                  createPortal(Modal, {
                    defaultVisible: true,
                    size: "lg",
                    title: t2("Change name"),
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                      input_default,
                      {
                        defaultValue: n2,
                        style: { width: "100%" },
                        onValueChange: (v2) => {
                          n2 = v2;
                        }
                      }
                    ),
                    onOk: () => {
                      return new Promise((resolve2, reject) => {
                        if ((n2 == null ? void 0 : n2.length) > 0) {
                          BApi$1.mediaLibrary.patchMediaLibrary(library.id, {
                            name: n2
                          }).then((t22) => {
                            if (!t22.code) {
                              resolve2(t22);
                              library.name = n2;
                              forceUpdate();
                            } else {
                              reject();
                            }
                          });
                        } else {
                          toast.danger(t2("Invalid data"));
                        }
                      });
                    }
                  });
                },
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(AutoTextSize, { className: "cursor-pointer", maxFontSizePx: 14, children: library.name }),
                  library.resourceCount > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Count of resources"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { className: "p-0", color: "success", size: "sm", variant: "light", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$o, { className: "text-sm" }),
                    " ",
                    library.resourceCount
                  ] }) }) : ((_a2 = library.pathConfigurations) == null ? void 0 : _a2.length) > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Tooltip$1,
                    {
                      content: t2(
                        "Resource not found? Please try to perform the synchronization operation."
                      ),
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" })
                    }
                  )
                ]
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "pl-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Tooltip$1,
                {
                  color: "secondary",
                  content: t2("Sync current media library"),
                  placement: "top",
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      isIconOnly: true,
                      className: "w-auto min-w-fit px-1",
                      color: "secondary",
                      size: "sm",
                      variant: "light",
                      onClick: () => {
                        createPortal(SynchronizationConfirmModal, {
                          onOk: async () => await BApi$1.mediaLibrary.startSyncingMediaLibraryResources(library.id)
                        });
                      },
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$7, { className: "text-base" })
                    }
                  )
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    isIconOnly: true,
                    className: "w-auto min-w-fit px-1",
                    size: "sm",
                    variant: "light",
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                      RefIcon$m,
                      {
                        className: "text-base",
                        onClick: () => {
                          renderAddRootPathModal();
                        }
                      }
                    )
                  }
                ) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_menu_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
                  menu_item_base_default,
                  {
                    onClick: () => {
                      renderAddRootPathInBulkModal();
                    },
                    children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(MdPlaylistAdd, { className: "text-base" }),
                      t2("Add root paths in bulk")
                    ]
                  },
                  0
                ) })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { className: "category-page-media-library-more-operations-popup", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    isIconOnly: true,
                    className: "w-auto min-w-fit px-1",
                    size: "sm",
                    variant: "light",
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$3, { className: "text-base" })
                  }
                ) }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_menu_default, { children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs(
                    menu_item_base_default,
                    {
                      className: "warning",
                      onClick: () => {
                        createPortal(DeleteEnhancementsModal, {
                          title: t2(
                            "Deleting all enhancement records of resources under this media library"
                          ),
                          onOk: async (deleteEmptyOnly) => {
                            await BApi$1.mediaLibrary.deleteByEnhancementsMediaLibrary(library.id, {
                              deleteEmptyOnly
                            });
                          }
                        });
                      },
                      children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx(MdSearch, { className: "text-base" }),
                        t2("Delete all enhancement records")
                      ]
                    },
                    0
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsxs(
                    menu_item_base_default,
                    {
                      className: "warning",
                      onClick: () => {
                        createPortal(Modal, {
                          defaultVisible: true,
                          title: `${t2("Deleting")} ${library.name}`,
                          children: t2("Are you sure you want to delete this media library?"),
                          onOk: () => new Promise((resolve2, reject) => {
                            BApi$1.mediaLibrary.deleteMediaLibrary(library.id).then((a2) => {
                              if (!a2.code) {
                                loadAllMediaLibraries();
                                resolve2(a2);
                              }
                            });
                          })
                        });
                      },
                      children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx(MdDelete, { className: "text-base" }),
                        t2("Remove")
                      ]
                    },
                    1
                  )
                ] })
              ] })
            ] })
          ] })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "path-configurations", children: ((_b2 = library.pathConfigurations) == null ? void 0 : _b2.length) > 0 ? (_c2 = library.pathConfigurations) == null ? void 0 : _c2.map((p2, i2) => {
          var _a3, _b3;
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(
            "div",
            {
              className: "path-configuration item",
              onClick: () => {
                createPortal(PathConfigurationDialog, {
                  onClosed: (pc2) => {
                    Object.assign(library.pathConfigurations[i2], pc2);
                    loadAllMediaLibraries();
                  },
                  libraryId: library.id,
                  pcIdx: i2
                });
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p2.path }),
                  /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { color: "success", radius: "sm", size: "sm", variant: "light", children: [
                    (_b3 = (_a3 = library.fileSystemInformation) == null ? void 0 : _a3[p2.path]) == null ? void 0 : _b3.freeSpaceInGb,
                    "GB"
                  ] }),
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Button,
                      {
                        isIconOnly: true,
                        className: "w-auto min-w-fit px-1",
                        size: "sm",
                        variant: "light",
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          RefIcon$G,
                          {
                            className: "text-base",
                            onClick: (e2) => {
                              e2.preventDefault();
                              e2.stopPropagation();
                              BApi$1.tool.openFileOrDirectory({ path: p2.path });
                            }
                          }
                        )
                      }
                    ),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Button,
                      {
                        isIconOnly: true,
                        className: "w-auto min-w-fit px-1",
                        color: "danger",
                        size: "sm",
                        variant: "light",
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          RefIcon$W,
                          {
                            className: "text-base",
                            onClick: (e2) => {
                              createPortal(Modal, {
                                defaultVisible: true,
                                title: `${t2("Deleting")} ${p2.path}`,
                                onOk: async () => {
                                  const rsp = await BApi$1.mediaLibrary.removeMediaLibraryPathConfiguration(
                                    library.id,
                                    {
                                      index: i2
                                    }
                                  );
                                  if (rsp.code) {
                                    throw new Error(rsp.message);
                                  } else {
                                    loadAllMediaLibraries();
                                  }
                                }
                              });
                            }
                          }
                        )
                      }
                    )
                  ] })
                ] }),
                renderFilter(p2),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: renderCustomProperties(p2) })
              ]
            },
            i2
          );
        }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center", children: t2(
            "To get your resources loaded, you must add at least one root path containing your local resources to this media library"
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-4 justify-center", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "primary",
                size: "sm",
                onClick: () => {
                  renderAddRootPathModal();
                },
                children: t2("Add root path")
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "secondary",
                size: "sm",
                onClick: () => {
                  renderAddRootPathInBulkModal();
                },
                children: t2("Add root paths in bulk")
              }
            )
          ] })
        ] }) })
      ]
    }
  );
};
SortableMediaLibrary.displayName = "SortableMediaLibrary";
const SortableMediaLibraryList = ({
  libraries,
  loadAllMediaLibraries,
  forceUpdate,
  reloadMediaLibrary
}) => {
  const sensors = useSensors(
    useSensor(MouseSensor, {
      activationConstraint: {
        distance: 5
      }
    })
  );
  function handleDragEnd(e2) {
    const activeId = e2.active.id;
    const overId = e2.over.id;
    const oldIndex = libraries.findIndex((c2) => c2.id == activeId);
    const newIndex = libraries.findIndex((c2) => c2.id == overId);
    const ol2 = libraries[oldIndex];
    libraries.splice(oldIndex, 1);
    libraries.splice(newIndex, 0, ol2);
    const newIds = libraries.map((t2) => t2.id);
    for (let i2 = 0; i2 < newIds.length; i2++) {
      const id2 = newIds[i2];
      const l2 = libraries.find((a2) => a2.id == id2);
      if (l2) {
        l2.order = i2;
      }
    }
    forceUpdate();
    BApi$1.mediaLibrary.sortMediaLibrariesInCategory({
      ids: newIds
    }).then((t2) => {
      if (!t2.code) {
        for (let i2 = 0; i2 < libraries.length; i2++) {
          libraries[i2].order = i2;
        }
        loadAllMediaLibraries();
      }
    });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "libraries", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    DndContext,
    {
      collisionDetection: closestCorners,
      sensors,
      onDragCancel: (e2) => {
      },
      onDragEnd: (e2) => {
        handleDragEnd(e2);
      },
      onDragMove: (e2) => {
      },
      onDragOver: (e2) => {
      },
      onDragStart: ({ active: active3 }) => {
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        SortableContext$1,
        {
          items: libraries.map((g2) => g2.id),
          strategy: verticalListSortingStrategy,
          children: libraries.sort((a2, b2) => a2.order - b2.order).map((library, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
            SortableMediaLibrary,
            {
              library,
              loadAllMediaLibraries,
              reloadMediaLibrary
            },
            library.id
          ))
        }
      )
    }
  ) });
};
SortableMediaLibraryList.displayName = "SortableMediaLibraryList";
const BasicCategoryComponentSelector = ({
  componentType,
  value: propsValue = void 0,
  onChange,
  maxCount = 1
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [allCurrentTypeComponents, setAllCurrentTypeComponents] = reactExports.useState([]);
  const [value2, setValue] = reactExports.useState(propsValue ?? []);
  const adjustValue = (v2) => v2 == null ? void 0 : v2.filter((a2) => allCurrentTypeComponents.some((b2) => b2.id == a2));
  const adjustedPropsValueRef = reactExports.useRef();
  const loadAllComponents = async () => {
    const rsp = await BApi$1.component.getComponentDescriptors({
      type: componentType,
      additionalItems: ComponentDescriptorAdditionalItem.AssociatedCategories
    });
    console.log(
      rsp.data.filter((b2) => b2.type != ComponentDescriptorType.Configurable)
    );
    setAllCurrentTypeComponents(
      rsp.data.filter((b2) => b2.type != ComponentDescriptorType.Configurable)
    );
  };
  useUpdateEffect(() => {
    if (adjustedPropsValueRef.current != value2) {
      console.log(
        "[BasicCategoryComponent]OnChange",
        adjustedPropsValueRef.current,
        value2
      );
      onChange && onChange(value2);
    }
  }, [value2]);
  useUpdateEffect(() => {
    const av = adjustValue(propsValue);
    adjustedPropsValueRef.current = av;
    setValue(av);
    console.log(
      "[BasicCategoryComponent]On props value change",
      adjustedPropsValueRef.current,
      value2
    );
  }, [propsValue]);
  reactExports.useEffect(() => {
    loadAllComponents();
  }, []);
  console.log("BasicCategoryComponentSelector", allCurrentTypeComponents);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "basic-category-component-selector", children: [
    allCurrentTypeComponents == null ? void 0 : allCurrentTypeComponents.map((c2, i2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        ComponentCard,
        {
          descriptor: c2,
          selected: value2.indexOf(c2.id) > -1,
          onClick: () => {
            const newValue = (value2 == null ? void 0 : value2.slice()) ?? [];
            const idx = newValue.indexOf(c2.id);
            if (idx > -1) {
              newValue.splice(idx, 1);
            } else {
              newValue.splice(0, newValue.length - maxCount + 1);
              newValue.push(c2.id);
            }
            setValue(adjustValue(newValue));
          },
          onDeleted: () => {
            loadAllComponents();
          }
        }
      );
    }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        className: "add",
        onClick: () => {
          createPortal(ComponentDetailPage, {
            componentType,
            onClosed: (hasChanges) => {
              if (hasChanges) {
                loadAllComponents();
              }
            }
          });
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(MdAddCircle, {}),
          t2("Add")
        ]
      }
    )
  ] });
};
BasicCategoryComponentSelector.displayName = "BasicCategoryComponentSelector";
const CustomPropertyBinderModal = ({ category, onSaved, onDestroyed }) => {
  var _a2;
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    PropertySelector,
    {
      addable: true,
      multiple: true,
      pool: PropertyPool.Custom,
      selection: (_a2 = category.customProperties) == null ? void 0 : _a2.map((c2) => ({
        id: c2.id,
        pool: PropertyPool.Custom
      })),
      title: t2("Binding custom properties to category {{categoryName}}", {
        categoryName: category.name
      }),
      onDestroyed,
      onSubmit: async (properties2) => {
        const rsp = await BApi$1.category.bindCustomPropertiesToCategory(category.id, {
          customPropertyIds: properties2 == null ? void 0 : properties2.map((p2) => p2.id)
        });
        if (!rsp.code) {
          onSaved == null ? void 0 : onSaved();
        } else {
          throw rsp;
        }
      }
    }
  );
};
CustomPropertyBinderModal.displayName = "CustomPropertyBinderModal";
const EnhancerSelector = ({ categoryId, onDestroyed, onClose }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [enhancers, setEnhancers] = reactExports.useState([]);
  const [category, setCategory] = reactExports.useState();
  const [categoryEnhancerOptionsList, setCategoryEnhancerOptionsList] = reactExports.useState([]);
  const init2 = async () => {
    await BApi$1.enhancer.getAllEnhancerDescriptors().then((r2) => {
      const data = r2.data || [];
      setEnhancers(data);
    });
    await BApi$1.category.getCategory(categoryId, {
      additionalItems: CategoryAdditionalItem.EnhancerOptions | CategoryAdditionalItem.CustomProperties
    }).then((r2) => {
      var _a2;
      const data = r2.data;
      setCategory({
        id: data.id,
        name: data.name
      });
      setCategoryEnhancerOptionsList(
        ((_a2 = data.enhancerOptions) == null ? void 0 : _a2.map(
          (eo) => eo
        )) || []
      );
    });
  };
  reactExports.useEffect(() => {
    init2();
  }, []);
  const patchCategoryEnhancerOptions = (enhancerId, patches) => {
    let ceoIdx = categoryEnhancerOptionsList.findIndex(
      (x2) => x2.enhancerId == enhancerId
    );
    if (ceoIdx == -1) {
      categoryEnhancerOptionsList.push({
        categoryId,
        enhancerId,
        active: false,
        options: {}
      });
      ceoIdx = categoryEnhancerOptionsList.length - 1;
    }
    categoryEnhancerOptionsList[ceoIdx] = {
      ...categoryEnhancerOptionsList[ceoIdx],
      ...patches
    };
    setCategoryEnhancerOptionsList([...categoryEnhancerOptionsList]);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel"]
      },
      size: "xl",
      title: t2("Enhancers"),
      onClose,
      onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        "div",
        {
          className: "grid gap-4 flex-wrap justify-center justify-items-center",
          style: {
            gridTemplateColumns: "repeat(auto-fill, minmax(300px, 300px)"
          },
          children: enhancers.map((e2) => {
            const ceo = categoryEnhancerOptionsList.find(
              (x2) => x2.enhancerId == e2.id
            );
            return /* @__PURE__ */ jsxRuntimeExports.jsxs(
              "div",
              {
                className: "max-w-[280px] border-1 rounded-lg pl-3 pr-3 pt-2 pb-2 flex flex-col",
                style: { borderColor: "rgba(255, 255, 255, 0.3)" },
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-base font-bold flex items-center gap-2", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(EnhancerIcon, { id: e2.id }),
                    e2.name,
                    (e2.id == EnhancerId.Kodi || e2.id == EnhancerId.Av || e2.id == EnhancerId.Tmdb) && /* @__PURE__ */ jsxRuntimeExports.jsx(BetaChip, {})
                  ] }),
                  e2.description && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-60 grow break-all", children: e2.description }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 mb-2 grow", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: " italic", children: t2(
                      "This enhancer can produce the following property values"
                    ) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-x-3 gap-y-1 mt-1", children: e2.targets.map((target) => {
                      return /* @__PURE__ */ jsxRuntimeExports.jsx(
                        Tooltip$1,
                        {
                          content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: target.description }),
                            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                              t2("The value type of this target is"),
                              " ",
                              /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-bold", children: [
                                /* @__PURE__ */ jsxRuntimeExports.jsx(
                                  Icon,
                                  {
                                    className: "text-small",
                                    valueType: target.valueType
                                  }
                                ),
                                " ",
                                t2(
                                  `StandardValueType.${StandardValueType[target.valueType]}`
                                )
                              ] })
                            ] })
                          ] }),
                          children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
                            "div",
                            {
                              className: "flex items-center gap-1",
                              style: {
                                // color: 'var(--bakaui-primary)'
                              },
                              children: [
                                /* @__PURE__ */ jsxRuntimeExports.jsx(
                                  Icon,
                                  {
                                    className: "text-small",
                                    valueType: target.valueType
                                  }
                                ),
                                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "break-all", children: target.name })
                              ]
                            }
                          )
                        },
                        target.id
                      );
                    }) })
                  ] }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-1 mt-1", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1 mt-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                      PopoverComponent,
                      {
                        placement: "top",
                        trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$r, {}) }),
                        children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
                          listbox_default,
                          {
                            "aria-label": "Delete enhancement records",
                            onAction: (key) => {
                              switch (key) {
                                case "Category":
                                  createPortal(DeleteEnhancementsModal, {
                                    title: t2(
                                      "Delete all enhancement records of this enhancer for category {{categoryName}}",
                                      { categoryName: category.name }
                                    ),
                                    onOk: async (deleteEmptyOnly) => await BApi$1.category.deleteEnhancementsByCategoryAndEnhancer(
                                      category.id,
                                      e2.id,
                                      { deleteEmptyOnly }
                                    )
                                  });
                                  break;
                                case "All":
                                  createPortal(DeleteEnhancementsModal, {
                                    title: t2(
                                      "Delete all enhancement records of this enhancer"
                                    ),
                                    onOk: async (deleteEmptyOnly) => await BApi$1.enhancer.deleteEnhancementsByEnhancer(
                                      e2.id,
                                      { deleteEmptyOnly }
                                    )
                                  });
                                  break;
                                case "ApplyContext":
                                  createPortal(Modal, {
                                    defaultVisible: true,
                                    title: t2(
                                      "Re-apply all enhancement data of this enhancer for category {{categoryName}}",
                                      { categoryName: category == null ? void 0 : category.name }
                                    ),
                                    onOk: async () => await BApi$1.category.applyEnhancementContextDataByEnhancerAndCategory(
                                      category.id,
                                      e2.id
                                    )
                                  });
                                  break;
                                default:
                                  return;
                              }
                            },
                            children: [
                              /* @__PURE__ */ jsxRuntimeExports.jsx(
                                listbox_item_base_default,
                                {
                                  className: "text-danger",
                                  color: "danger",
                                  startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" }),
                                  children: t2(
                                    "Delete all enhancement records of this enhancer for category {{categoryName}}",
                                    { categoryName: category == null ? void 0 : category.name }
                                  )
                                },
                                "Category"
                              ),
                              /* @__PURE__ */ jsxRuntimeExports.jsx(
                                listbox_item_base_default,
                                {
                                  className: "text-danger",
                                  color: "danger",
                                  startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" }),
                                  children: t2(
                                    "Delete all enhancement records of this enhancer"
                                  )
                                },
                                "All"
                              ),
                              /* @__PURE__ */ jsxRuntimeExports.jsx(
                                listbox_item_base_default,
                                {
                                  className: "text-warning",
                                  color: "warning",
                                  startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$I, { className: "text-base" }),
                                  children: t2(
                                    "Re-apply all enhancement data of this enhancer for category {{categoryName}}",
                                    { categoryName: category == null ? void 0 : category.name }
                                  )
                                },
                                "ApplyContext"
                              )
                            ]
                          }
                        )
                      }
                    ) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 mt-1", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(TargetNotSetupTip, { enhancer: e2, options: ceo }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        Button,
                        {
                          color: "primary",
                          size: "sm",
                          variant: "light",
                          onClick: () => {
                            createPortal(CategoryEnhancerOptionsDialog, {
                              enhancer: e2,
                              categoryId,
                              onDestroyed: init2
                            });
                          },
                          children: t2("Setup")
                        }
                      ),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        checkbox_default,
                        {
                          isSelected: ceo == null ? void 0 : ceo.active,
                          size: "sm",
                          onValueChange: (c2) => {
                            BApi$1.category.patchCategoryEnhancerOptions(categoryId, e2.id, {
                              active: c2
                            }).then(() => {
                              patchCategoryEnhancerOptions(e2.id, { active: c2 });
                            });
                          },
                          children: t2("Enable")
                        }
                      )
                    ] })
                  ] })
                ]
              },
              e2.id
            );
          })
        }
      )
    }
  );
};
EnhancerSelector.show = (props) => createPortalOfComponent(EnhancerSelector, props);
const EditMode = {
  NameAndColor: 2
};
const ComponentTips = {
  [ComponentType.PlayableFileSelector]: "Determine which files will be treated as playable files",
  [ComponentType.Player]: "Specify a player to play playable files",
  [ComponentType.Enhancer]: "Expand properties of resources, such as publisher(property), publication date(property), tags(property), cover(file), etc"
};
const SortableCategory = ({
  category,
  loadAllCategories,
  loadAllMediaLibraries,
  reloadCategory,
  reloadMediaLibrary,
  libraries,
  forceUpdate,
  allComponents,
  enhancers
}) => {
  var _a2, _b2, _c2, _d;
  const { attributes: attributes2, listeners, setNodeRef, transform: transform2, transition: transition3 } = useSortable({ id: category.id });
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const style2 = {
    transform: CSS$1.Translate.toString({
      ...transform2,
      scaleY: 1
    }),
    transition: transition3
  };
  const [categoryColor, setCategoryColor] = reactExports.useState(void 0);
  const [colorPickerVisible, setColorPickerVisible] = reactExports.useState(false);
  const [editMode, setEditMode] = reactExports.useState();
  const [name2, setName] = reactExports.useState();
  const clearEditMode = () => {
    setEditMode(void 0);
  };
  const components2 = category.componentsData || [];
  const renderBasicComponentSelector = (componentType, componentKey = void 0) => {
    if (componentType == ComponentType.PlayableFileSelector || componentType == ComponentType.Player) {
      let newKey;
      createPortal(Modal, {
        defaultVisible: true,
        title: t2(ComponentType[componentType]),
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          BasicCategoryComponentSelector,
          {
            componentType,
            value: [componentKey],
            onChange: (componentKeys) => {
              newKey = (componentKeys || [])[0];
            }
          }
        ),
        onOk: () => new Promise((resolve2, reject) => {
          if (newKey) {
            if (componentType == ComponentType.PlayableFileSelector) {
              createPortal(Modal, {
                classNames: {
                  wrapper: "z-[10000]",
                  backdrop: "z-[10000]"
                  // body: 'z-10000',
                },
                defaultVisible: true,
                title: t2(
                  "Are you sure to change playable file selector?"
                ),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                  "Changing the playable file selector will clear all cached playable file information. The cache for these files will be rebuilt after the operation."
                ) }),
                onOk: async () => {
                  const rsp = await BApi$1.category.configureCategoryComponents(
                    category.id,
                    {
                      componentKeys: [newKey],
                      type: componentType
                    }
                  );
                  if (!rsp.code) {
                    reloadCategory(category.id);
                    resolve2(rsp);
                  } else {
                    reject();
                  }
                },
                onClose: () => {
                  reject();
                }
              });
            } else {
              return BApi$1.category.configureCategoryComponents(category.id, {
                componentKeys: [newKey],
                type: componentType
              }).then((a2) => {
                if (!a2.code) {
                  reloadCategory(category.id);
                  resolve2(a2);
                } else {
                  reject();
                }
              });
            }
          } else {
            reject();
          }
        })
      });
    }
  };
  const resourceCount = libraries.reduce((s2, t22) => s2 + t22.resourceCount, 0);
  const renderMediaLibraryAddModal = () => {
    let n2;
    createPortal(Modal, {
      defaultVisible: true,
      title: t2("Add a media library"),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          defaultValue: n2,
          placeholder: t2("Name of media library"),
          style: { width: "100%" },
          onValueChange: (v2) => {
            n2 = v2;
          }
        }
      ),
      onOk: async () => {
        if ((n2 == null ? void 0 : n2.length) > 0) {
          const r2 = await BApi$1.mediaLibrary.addMediaLibrary({
            categoryId: category.id,
            name: n2
          });
          if (!r2.code) {
            loadAllMediaLibraries();
          } else {
            throw new Error(r2.message);
          }
        } else {
          toast.error(t2("Invalid data"));
          throw new Error("Invalid data");
        }
      }
    });
  };
  const renderMediaLibraryAddInBulkModal = () => {
    createPortal(AddMediaLibraryInBulkDialog, {
      categoryId: category.id,
      onSubmitted: loadAllMediaLibraries
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      ref: setNodeRef,
      className: "category-page-draggable-category",
      id: `category-${category.id}`,
      style: style2,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "title-line", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "left", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(DragHandle, { ...listeners, ...attributes2 }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "name", children: editMode == EditMode.NameAndColor ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "editing", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(input_default, { value: name2, onValueChange: (v2) => setName(v2) }),
              " ",
              /* @__PURE__ */ jsxRuntimeExports.jsxs(
                "div",
                {
                  style: {
                    position: "relative",
                    width: 26,
                    height: 26
                  },
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      "div",
                      {
                        style: {
                          padding: "5px",
                          background: "#fff",
                          borderRadius: "1px",
                          boxShadow: "0 0 0 1px rgba(0,0,0,.1)",
                          display: "inline-block",
                          cursor: "pointer"
                        },
                        onClick: () => setColorPickerVisible(true),
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          "div",
                          {
                            style: {
                              width: "16px",
                              height: "16px",
                              borderRadius: "2px",
                              background: categoryColor == null ? void 0 : categoryColor.hex
                            }
                          }
                        )
                      }
                    ),
                    colorPickerVisible ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
                      "div",
                      {
                        style: {
                          position: "absolute",
                          top: "-80px",
                          left: "60px",
                          zIndex: "20"
                        },
                        children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx(
                            "div",
                            {
                              style: {
                                position: "fixed",
                                top: "0px",
                                right: "0px",
                                bottom: "0px",
                                left: "0px"
                              },
                              onClick: () => setColorPickerVisible(false)
                            }
                          ),
                          /* @__PURE__ */ jsxRuntimeExports.jsx(
                            SketchPicker,
                            {
                              color: categoryColor,
                              onChange: (v2) => {
                                setCategoryColor(v2);
                              }
                            }
                          )
                        ]
                      }
                    ) : null
                  ]
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  className: "submit",
                  color: "default",
                  size: "lg",
                  variant: "light",
                  onPress: () => {
                    BApi$1.category.patchCategory(category.id, {
                      name: name2,
                      color: categoryColor.hex
                    }).then((t22) => {
                      if (!t22.code) {
                        category.name = name2;
                        category.color = categoryColor.hex;
                        clearEditMode();
                      }
                    });
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdCheck, { className: "text-lg" })
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  className: "cancel",
                  color: "default",
                  size: "lg",
                  variant: "light",
                  onPress: clearEditMode,
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdClose, { className: "text-lg" })
                }
              )
            ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "editable", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "hover-area", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { color: category.color }, title: category.id, children: category.name }),
              " ",
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  size: "sm",
                  onClick: () => {
                    setName(category.name);
                    setCategoryColor({
                      hex: category.color
                    });
                    setEditMode(EditMode.NameAndColor);
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$T, { className: "text-base" })
                }
              )
            ] }) }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { placement: "bottom-start", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, size: "sm", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$3, { className: "text-base" }) }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs(
                dropdown_menu_default,
                {
                  "aria-label": "static actions",
                  onAction: (key) => {
                    switch (key) {
                      case "enhance-manually": {
                        break;
                      }
                      case "delete-enhancements": {
                        createPortal(DeleteEnhancementsModal, {
                          title: t2(
                            "Deleting all enhancement records of resources under this category"
                          ),
                          onOk: async (deleteEmptyOnly) => {
                            await BApi$1.category.deleteEnhancementsByCategory(
                              category.id,
                              { deleteEmptyOnly }
                            );
                          }
                        });
                        break;
                      }
                      case "delete-category": {
                        createPortal(Modal, {
                          defaultVisible: true,
                          title: `${t2("Deleting")} ${category.name}`,
                          children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                              "All related data will be deleted too, are you sure?"
                            ) }),
                            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                              "This operation cannot be undone. Would you like to proceed?"
                            ) })
                          ] }),
                          onOk: async () => {
                            const rsp = await BApi$1.category.deleteCategory(
                              category.id
                            );
                            if (!rsp.code) {
                              loadAllCategories();
                            }
                          }
                        });
                        break;
                      }
                    }
                  },
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      menu_item_base_default,
                      {
                        className: "text-danger",
                        color: "danger",
                        children: t2("Delete all enhancement records")
                      },
                      "delete-enhancements"
                    ),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      menu_item_base_default,
                      {
                        className: "text-danger",
                        color: "danger",
                        children: t2("Delete category")
                      },
                      "delete-category"
                    )
                  ]
                }
              )
            ] }),
            resourceCount > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Count of resources"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
              Chip,
              {
                color: "success",
                variant: "light",
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$o, { className: "text-base" }),
                  " ",
                  resourceCount
                ]
              }
            ) }) })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "right flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Tooltip$1,
              {
                color: "secondary",
                content: t2("Sync all media libraries in current category"),
                placement: "left",
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
                  Button,
                  {
                    color: "secondary",
                    size: "sm",
                    variant: "bordered",
                    onClick: () => {
                      createPortal(SynchronizationConfirmModal, {
                        onOk: async () => await BApi$1.category.startSyncingCategoryResources(
                          category.id
                        )
                      });
                    },
                    children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$7, { className: "text-base" }),
                      t2("Sync now")
                    ]
                  }
                )
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsxs(
              Button,
              {
                color: "default",
                size: "sm",
                variant: "bordered",
                onClick: () => {
                  let name22;
                  createPortal(Modal, {
                    defaultVisible: true,
                    title: t2("Duplicating a category"),
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                      input_default,
                      {
                        placeholder: t2(
                          "Please input a new name for the duplicated category"
                        ),
                        style: { width: 400 },
                        onValueChange: (v2) => name22 = v2
                      }
                    ),
                    onOk: async () => {
                      const rsp = await BApi$1.category.duplicateCategory(
                        category.id,
                        { name: name22 }
                      );
                      if (!rsp.code) {
                        loadAllCategories();
                        loadAllMediaLibraries();
                      }
                    }
                  });
                },
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Z, { className: "text-base" }),
                  t2("Duplicate")
                ]
              }
            )
          ] })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "configuration-line block", children: [
          componentTypes.filter((t22) => t22.value != ComponentType.Enhancer).map((type4) => {
            var _a3;
            const comp = components2.find((a2) => a2.componentType == type4.value);
            return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2(ComponentTips[type4.value]), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: t2(type4.label) }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: comp ? "default" : "primary",
                  size: "sm",
                  variant: "light",
                  onClick: () => {
                    renderBasicComponentSelector(
                      type4.value,
                      comp == null ? void 0 : comp.componentKey
                    );
                  },
                  children: t2(((_a3 = comp == null ? void 0 : comp.descriptor) == null ? void 0 : _a3.name) ?? "Click to set")
                }
              )
            ] }, type4.value);
          }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: t2("Priority on cover selection") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: category.coverSelectionOrder > 0 ? "default" : "primary",
                  size: "sm",
                  variant: "light",
                  children: category.coverSelectionOrder > 0 ? t2(CoverSelectOrder$2[category.coverSelectionOrder]) : t2("Click to set")
                }
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                dropdown_menu_default,
                {
                  disallowEmptySelection: true,
                  "aria-label": "Cover select order",
                  selectedKeys: [category.coverSelectionOrder],
                  selectionMode: "single",
                  variant: "flat",
                  onSelectionChange: (keys2) => {
                    const arr = Array.from(keys2 ?? []);
                    const order2 = arr == null ? void 0 : arr[0];
                    console.log(keys2);
                    BApi$1.category.patchCategory(category.id, { coverSelectionOrder: order2 }).then((t22) => {
                      if (!t22.code) {
                        category.coverSelectionOrder = order2;
                        forceUpdate();
                      }
                    });
                  },
                  children: coverSelectOrders.map((c2) => {
                    return /* @__PURE__ */ jsxRuntimeExports.jsx(menu_item_base_default, { children: t2(CoverSelectOrder$2[c2.value]) }, c2.value);
                  })
                }
              )
            ] })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "col-span-3", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2(ComponentTips[ComponentType.Enhancer]), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: t2("Enhancers") }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: ((_a2 = category.enhancerOptions) == null ? void 0 : _a2.filter((eo) => eo.active).length) > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: (_b2 = category.enhancerOptions) == null ? void 0 : _b2.filter((eo) => eo.active).map((e2, i2) => {
              const enhancer = enhancers == null ? void 0 : enhancers.find(
                (eh2) => eh2.id == e2.enhancerId
              );
              return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                Button,
                {
                  size: "sm",
                  variant: "flat",
                  onClick: () => {
                    createPortal(EnhancerSelector, {
                      categoryId: category.id,
                      onClose: () => reloadCategory(category.id)
                    });
                  },
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(EnhancerIcon, { id: e2.enhancerId }),
                    enhancer == null ? void 0 : enhancer.name
                  ]
                },
                e2.id
              );
            }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "primary",
                size: "sm",
                variant: "light",
                onClick: () => {
                  createPortal(EnhancerSelector, {
                    categoryId: category.id,
                    onClose: () => reloadCategory(category.id)
                  });
                },
                children: t2("Click to set")
              }
            ) })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "col-span-3", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Tooltip$1,
              {
                content: t2(
                  "Unassociated custom properties will not be displayed"
                ),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: t2("Custom properties") })
              }
            ),
            ((_c2 = category.customProperties) == null ? void 0 : _c2.length) > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: (_d = category.customProperties) == null ? void 0 : _d.map((e2, i2) => {
              return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                Button,
                {
                  size: "sm",
                  variant: "flat",
                  onClick: () => {
                    createPortal(CustomPropertyBinderModal, {
                      category,
                      onSaved: () => reloadCategory(category.id)
                    });
                  },
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyTypeIcon, { textVariant: "none", type: e2.type }),
                    e2.name
                  ]
                },
                e2.id
              );
            }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                className: "",
                color: "primary",
                size: "sm",
                variant: "light",
                onClick: () => {
                  createPortal(CustomPropertyBinderModal, {
                    category,
                    onSaved: () => reloadCategory(category.id)
                  });
                },
                children: t2("Click to set")
              }
            )
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "col-span-3", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Tooltip$1,
              {
                content: t2(
                  "You can set a display name template for resources. By default, file name will be used as display name"
                ),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: t2("Display name template") })
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: category.resourceDisplayNameTemplate == void 0 ? "primary" : "default",
                size: "sm",
                variant: "light",
                onClick: () => {
                  createPortal(DisplayNameTemplateEditorDialog, {
                    categoryId: category.id,
                    onSaved: () => reloadCategory(category.id)
                  });
                },
                children: category.resourceDisplayNameTemplate ?? t2("Click to set")
              }
            )
          ] }) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "libraries-line block", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "libraries-header", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "title-line ls", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "title", children: t2("Media libraries") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Tooltip$1,
                {
                  content: t2(
                    'Resources will not loaded automatically after modifying media libraries, you can click "sync button" at top-right of current page to load your resources immediately.'
                  ),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdWarning, {})
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { placement: "bottom-start", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, size: "sm", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$3, { className: "text-base" }) }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs(
                  dropdown_menu_default,
                  {
                    "aria-label": "static actions",
                    onAction: (key) => {
                      switch (key) {
                        case "add": {
                          renderMediaLibraryAddModal();
                          break;
                        }
                        case "add-in-bulk": {
                          renderMediaLibraryAddInBulkModal();
                          break;
                        }
                      }
                    },
                    children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        menu_item_base_default,
                        {
                          children: t2("Add a media library")
                        },
                        "add"
                      ),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        menu_item_base_default,
                        {
                          children: t2("Add in bulk")
                        },
                        "add-in-bulk"
                      )
                    ]
                  }
                )
              ] })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "path-configuration header", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "path", children: t2("Root path") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "filter", children: t2("Resource discovery") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "tags", children: t2("Generated properties") })
            ] })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "libraries", children: libraries.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
            SortableMediaLibraryList,
            {
              forceUpdate,
              libraries,
              loadAllMediaLibraries,
              reloadMediaLibrary
            }
          ) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center", children: t2(
              "You should set up a media library first to visit your resources"
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-4 justify-center", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: "primary",
                  size: "sm",
                  onClick: () => {
                    renderMediaLibraryAddModal();
                  },
                  children: t2("Set up now")
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: "secondary",
                  size: "sm",
                  onClick: () => {
                    renderMediaLibraryAddInBulkModal();
                  },
                  children: t2("Set up in bulk")
                }
              )
            ] })
          ] }) })
        ] })
      ]
    },
    category.id
  );
};
SortableCategory.displayName = "SortableCategory";
const SortableCategoryList = ({
  categories,
  libraries,
  loadAllMediaLibraries,
  loadAllCategories,
  allComponents,
  forceUpdate,
  enhancers,
  reloadCategory,
  reloadMediaLibrary
}) => {
  const sensors = useSensors(
    useSensor(MouseSensor, {
      activationConstraint: {
        distance: 5
      }
    })
  );
  async function onDragEnd(e2) {
    const activeId = e2.active.id;
    const overId = e2.over.id;
    const oldIndex = categories.findIndex((c2) => c2.id == activeId);
    const newIndex = categories.findIndex((c2) => c2.id == overId);
    const oc2 = categories[oldIndex];
    categories.splice(oldIndex, 1);
    categories.splice(newIndex, 0, oc2);
    forceUpdate();
    const newIds = categories.map((t2) => t2.id);
    await BApi$1.category.sortCategories({
      ids: newIds
    }).then((t2) => {
      if (!t2.code) {
        for (let i2 = 0; i2 < categories.length; i2++) {
          categories[i2].order = i2;
        }
        categories.sort((a2, b2) => a2.order - b2.order);
        loadAllCategories();
      }
    });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "categories", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    DndContext,
    {
      collisionDetection: closestCorners,
      sensors,
      onDragCancel: (e2) => {
      },
      onDragEnd: (e2) => {
        console.log("drag end", e2);
        onDragEnd(e2);
      },
      onDragMove: (e2) => {
      },
      onDragOver: (e2) => {
      },
      onDragStart: ({ active: active3 }) => {
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        SortableContext$1,
        {
          items: categories.map((g2) => g2.id),
          strategy: verticalListSortingStrategy,
          children: categories.map((c2, index2) => {
            const mls = libraries.filter((t2) => t2.categoryId == c2.id).sort((a2, b2) => a2.order - b2.order);
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              SortableCategory,
              {
                allComponents,
                category: c2,
                enhancers,
                forceUpdate,
                libraries: mls,
                loadAllCategories,
                loadAllMediaLibraries,
                reloadCategory,
                reloadMediaLibrary
              },
              c2.id
            );
          })
        }
      )
    }
  ) });
};
SortableCategoryList.displayName = "SortableCategoryList";
({
  status: BackgroundTaskStatus.Running
});
const MediaLibrarySynchronization = ({ onComplete }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const backgroundTasks = useBTasksStore((state) => state.tasks);
  const sortedTasks = backgroundTasks.slice().sort((a2, b2) => {
    var _a2;
    return (_a2 = b2.startedAt) == null ? void 0 : _a2.localeCompare(a2.startedAt);
  });
  const taskInfo = sortedTasks.find(
    (t22) => t22.name == "MediaLibraryService:Sync"
  );
  const prevTaskInfo = usePrevious$1(taskInfo);
  reactExports.useEffect(() => {
    if ((taskInfo == null ? void 0 : taskInfo.status) == BTaskStatus.Completed && (prevTaskInfo == null ? void 0 : prevTaskInfo.status) != BTaskStatus.Completed) {
      onComplete && onComplete();
    }
  }, [taskInfo]);
  reactExports.useEffect(() => {
  }, []);
  const isSyncing = (taskInfo == null ? void 0 : taskInfo.status) == BTaskStatus.Running;
  const failed = (taskInfo == null ? void 0 : taskInfo.status) == BTaskStatus.Error;
  const isComplete = (taskInfo == null ? void 0 : taskInfo.status) == BTaskStatus.Completed;
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "media-library-synchronization", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "main", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "top", children: [
      isSyncing ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "process", children: [
        t2(taskInfo == null ? void 0 : taskInfo.process),
        "(",
        taskInfo == null ? void 0 : taskInfo.percentage,
        "%)"
      ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          color: "secondary",
          size: "small",
          onClick: () => {
            createPortal(SynchronizationConfirmModal, {
              onOk: async () => await BApi$1.mediaLibrary.startSyncMediaLibrary()
            });
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$7, { className: "text-base" }),
            t2("Sync all media libraries")
          ]
        }
      ),
      (failed || isComplete) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "status", children: [
        failed && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: taskInfo == null ? void 0 : taskInfo.error }), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "failed", children: [
          t2("Failed"),
          " ",
          /* @__PURE__ */ jsxRuntimeExports.jsx(MdSync, { className: "text-base" })
        ] }) }),
        isComplete && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "complete", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(MdSync, { className: "text-base" }),
          " ",
          t2("Complete")
        ] })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opt" })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bottom", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "status", children: isSyncing && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "syncing", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      progress_default,
      {
        progressive: true,
        backgroundColor: "#d8d8d8",
        percent: taskInfo == null ? void 0 : taskInfo.percentage,
        size: "small",
        textRender: () => ""
      }
    ) }) }) })
  ] }) });
};
MediaLibrarySynchronization.displayName = "MediaLibrarySynchronization";
const CategoryPage = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [categories, setCategories] = reactExports.useState([]);
  const [libraries, setLibraries] = reactExports.useState([]);
  const categoriesLoadedRef = reactExports.useRef(false);
  const resourceOptions = useResourceOptionsStore((state) => state.data);
  const [allComponents, setAllComponents] = reactExports.useState([]);
  const [enhancers, setEnhancers] = reactExports.useState([]);
  const [loading, setLoading] = reactExports.useState(true);
  const [migrating, setMigrating] = reactExports.useState(false);
  const [, forceUpdate] = reactExports.useReducer((x2) => x2 + 1, 0);
  const loadAllCategories = (cb2 = () => {
  }) => {
    return BApi$1.category.getAllCategories({
      additionalItems: CategoryAdditionalItem.Validation | CategoryAdditionalItem.CustomProperties | CategoryAdditionalItem.EnhancerOptions
    }).then((rsp) => {
      var _a2;
      categoriesLoadedRef.current = true;
      (_a2 = rsp.data) == null ? void 0 : _a2.sort((a2, b2) => a2.order - b2.order);
      setCategories(rsp.data || []);
      cb2 && cb2();
    });
  };
  const loadAllMediaLibraries = (cb2 = () => {
  }) => {
    return BApi$1.mediaLibrary.getAllMediaLibraries({
      additionalItems: MediaLibraryAdditionalItem.Category | MediaLibraryAdditionalItem.FileSystemInfo | MediaLibraryAdditionalItem.PathConfigurationBoundProperties
    }).then((x2) => {
      var _a2;
      (_a2 = x2.data) == null ? void 0 : _a2.sort((a2, b2) => a2.order - b2.order);
      setLibraries(x2.data || []);
    });
  };
  async function init2() {
    setLoading(true);
    try {
      await loadAllCategories();
      await loadAllMediaLibraries();
      await BApi$1.component.getComponentDescriptors().then((a2) => {
        setAllComponents(a2.data || []);
      });
      const er = await BApi$1.enhancer.getAllEnhancerDescriptors();
      const enhancerData = er.data || [];
      setEnhancers(enhancerData);
    } finally {
      setLoading(false);
    }
  }
  const reloadCategory = async (id2) => {
    const c2 = (await BApi$1.category.getCategory(id2, {
      additionalItems: CategoryAdditionalItem.Validation | CategoryAdditionalItem.CustomProperties | CategoryAdditionalItem.EnhancerOptions
    })).data ?? {};
    const idx = categories.findIndex((x2) => x2.id == id2);
    categories[idx] = c2;
    setCategories([...categories]);
  };
  const reloadMediaLibrary = async (id2) => {
    const c2 = (await BApi$1.mediaLibrary.getMediaLibrary(id2, {
      additionalItems: MediaLibraryAdditionalItem.Category | MediaLibraryAdditionalItem.FileSystemInfo | MediaLibraryAdditionalItem.PathConfigurationBoundProperties
    })).data ?? {};
    const idx = libraries.findIndex((x2) => x2.id == id2);
    libraries[idx] = c2;
    setLibraries({ ...libraries });
  };
  reactExports.useEffect(() => {
    console.log("init");
    init2();
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "category-page", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Modal,
      {
        defaultVisible: true,
        footer: { actions: ["cancel"] },
        size: "lg",
        title: t2("Current media library feature will be removed soon"),
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            alert_default,
            {
              color: "danger",
              title: t2(
                "Please note that the categorization feature will be removed soon. Please switch to the new media library function as soon as possible."
              )
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            alert_default,
            {
              color: "warning",
              icon: /* @__PURE__ */ jsxRuntimeExports.jsx(TbPackageExport, { className: "text-lg" }),
              title: t2("You can migrate data button at top of the page to migrate data to the new media library.")
            }
          )
        ]
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "header mb-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "left", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            size: "small",
            onClick: () => {
              let name2 = "";
              createPortal(Modal, {
                defaultVisible: true,
                size: "md",
                title: t2("Create a category"),
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    input_default,
                    {
                      className: "w-full",
                      placeholder: t2("Please enter the name of the category"),
                      size: "md",
                      onValueChange: (v2) => {
                        name2 = v2;
                      }
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    FeatureStatusTip,
                    {
                      className: "mt-2",
                      name: t2("Setup wizard"),
                      status: "deprecated"
                    }
                  )
                ] }),
                onOk: async () => {
                  if (name2 == void 0 || name2.length == 0) {
                    throw new Error("Name is required");
                  }
                  await BApi$1.category.addCategory({
                    name: name2
                  });
                  loadAllCategories();
                }
              });
            },
            children: t2("Add")
          }
        ),
        categories.length > 1 && /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { className: "elevator", size: "small", children: t2("QuickJump") }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            dropdown_menu_default,
            {
              "aria-label": "Categories",
              selectionMode: "single",
              onSelectionChange: (keys2) => {
                var _a2;
                const arr = Array.from(keys2 ?? []);
                const id2 = arr == null ? void 0 : arr[0];
                (_a2 = document.getElementById(`category-${id2}`)) == null ? void 0 : _a2.scrollIntoView();
              },
              children: categories == null ? void 0 : categories.map((c2) => /* @__PURE__ */ jsxRuntimeExports.jsx(menu_item_base_default, { children: c2.name }, c2.id))
            }
          )
        ] })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "right", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "warning",
            isDisabled: migrating,
            size: "small",
            variant: "flat",
            onPress: async () => {
              try {
                setMigrating(true);
                await BApi$1.migration.migrateCategoriesMediaLibrariesAndResourcesToNewMediaLibrary();
              } finally {
                setMigrating(false);
              }
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(TbPackageExport, { className: "text-lg" }),
              migrating ? t2("Migrating...") : t2("Migrate data (one-click)")
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "primary",
            size: "small",
            variant: "light",
            onPress: () => {
              const navigate = useNavigate();
              navigate("/synchronizationoptions");
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$e, { className: "text-base" }),
              t2("Synchronization options")
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "default",
            size: "small",
            onClick: () => {
              createPortal(Modal, {
                defaultVisible: true,
                title: t2("Sort by name"),
                children: t2("We'll sort categories by name"),
                onOk: async () => {
                  const orderedCategoryIds = categories.slice().sort((a2, b2) => a2.name.localeCompare(b2.name)).map((a2) => a2.id);
                  const rsp = await BApi$1.category.sortCategories({
                    ids: orderedCategoryIds
                  });
                  if (!rsp.code) {
                    loadAllCategories();
                  }
                }
              });
            },
            children: t2("Sort by name")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "last-sync-time", children: [
          t2("Last sync time"),
          ":",
          " ",
          (resourceOptions == null ? void 0 : resourceOptions.lastSyncDt) ? dayjs(resourceOptions.lastSyncDt).format("YYYY-MM-DD HH:mm:ss") : t2("Never")
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(MediaLibrarySynchronization, { onComplete: () => loadAllMediaLibraries() })
      ] })
    ] }),
    loading && /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, {}),
    categories.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
      SortableCategoryList,
      {
        allComponents,
        categories,
        enhancers,
        forceUpdate,
        libraries,
        loadAllCategories,
        loadAllMediaLibraries,
        reloadCategory,
        reloadMediaLibrary
      }
    ) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 justify-center mt-10", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$V, { className: "text-base" }),
      t2(
        "Categories have not been created yet. To load your resources, please ensure that at least one category is created."
      )
    ] })
  ] });
};
CategoryPage.displayName = "CategoryPage";
const AfterFirstPlayOperationsModal = ({ entry, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [visible, setVisible] = reactExports.useState(true);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      visible,
      footer: false,
      onClose: () => setVisible(false),
      size: "lg",
      title: t2("We noticed that you played the first file in this path. Would you like to proceed with the following actions?"),
      style: { maxWidth: "85vw" },
      onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { variant: "flat", children: t2("Current Path") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(snippet_default, { symbol: false, size: "sm", children: entry.path })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid gap-3", style: { gridTemplateColumns: "auto auto" }, children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(card_default, { className: "border border-default-200 dark:border-default-100 rounded-md", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(card_body_default, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-2 font-medium", children: t2("You can move it to another path.") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              FolderSelectorInner,
              {
                sources: ["media library", "custom"],
                onSelect: async (path) => {
                  await BApi$1.file.moveEntries({ destDir: path, entryPaths: [entry.path] });
                  setVisible(false);
                }
              }
            )
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(card_default, { className: "border border-default-200 dark:border-default-100 rounded-md", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(card_body_default, { className: "flex flex-col gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-2 font-medium", children: t2("Or delete it?") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "danger",
                onPress: async () => {
                  createPortal(Modal, {
                    title: t2("Delete this file/folder?"),
                    defaultVisible: true,
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Are you sure you want to delete this file/folder?") }),
                    footer: {
                      actions: ["ok", "cancel"],
                      okProps: {
                        color: "danger"
                      }
                    },
                    onOk: async () => {
                      await BApi$1.file.removeFiles({ paths: [entry.path] });
                      setVisible(false);
                    }
                  });
                },
                children: t2("Delete")
              }
            )
          ] }) })
        ] })
      ] })
    }
  );
};
AfterFirstPlayOperationsModal.displayName = "AfterFirstPlayOperationsModal";
buildLogger("FileProcessor");
const FileProcessorPage = () => {
  var _a2, _b2, _c2;
  const { t: t2 } = useTranslation();
  const [, forceUpdate] = reactExports.useReducer((x2) => x2 + 1, 0);
  const [root2, setRoot] = reactExports.useState();
  const rootRef = reactExports.useRef();
  const [selectedEntries, setSelectedEntries] = reactExports.useState([]);
  const selectedEntriesRef = reactExports.useRef([]);
  const [allSelected, setAllSelected] = reactExports.useState(false);
  const optionsStore = useFileSystemOptionsStore((state) => state);
  const [rootPath, setRootPath] = reactExports.useState();
  const [rootPathInitialized, setRootPathInitialized] = reactExports.useState(false);
  const fpOptionsRef = reactExports.useRef((_a2 = optionsStore.data) == null ? void 0 : _a2.fileProcessor);
  const { createPortal } = useBakabaseContext();
  useUpdateEffect(() => {
    if (rootRef.current) {
      rootRef.current.dispose();
    }
    rootRef.current = root2;
    console.log("Root change to", root2);
  }, [root2]);
  reactExports.useEffect(() => {
    var _a3;
    if (!rootPathInitialized && optionsStore.initialized) {
      const p2 = (_a3 = optionsStore.data.fileProcessor) == null ? void 0 : _a3.workingDirectory;
      if (p2) {
        setRootPath(p2);
      }
      setRootPathInitialized(true);
    }
  }, [rootPathInitialized, optionsStore.initialized]);
  reactExports.useEffect(() => {
    var _a3;
    fpOptionsRef.current = (_a3 = optionsStore.data) == null ? void 0 : _a3.fileProcessor;
  }, [optionsStore]);
  reactExports.useEffect(() => {
    return () => {
      var _a3;
      (_a3 = rootRef.current) == null ? void 0 : _a3.dispose();
    };
  }, []);
  reactExports.useEffect(() => {
    var _a3;
    selectedEntriesRef.current = selectedEntries;
    console.log("SelectedEntries changed", selectedEntries);
    const filteredEntries = ((_a3 = rootRef.current) == null ? void 0 : _a3.filteredChildren) || [];
    console.log("Current selection", selectedEntries);
    if (selectedEntries.length == filteredEntries.length) {
      for (const se2 of selectedEntries) {
        let exist = false;
        for (const re2 of filteredEntries) {
          if (se2 == re2) {
            exist = true;
          }
        }
        if (!exist) {
          console.log(se2);
        }
      }
      if (selectedEntries.length > 0 && selectedEntries.every((e2) => filteredEntries.some((a2) => a2 == e2))) {
        console.log("all selected");
        setAllSelected(true);
      } else {
        setAllSelected(false);
      }
    } else {
      setAllSelected(false);
    }
  }, [selectedEntries]);
  reactExports.useEffect(() => {
    console.log("set all selected", allSelected);
  }, [allSelected]);
  console.log("root path", rootPath, "root ref", rootRef);
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "file-explorer-page", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "file-explorer flex flex-col gap-0", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        rootPath && /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { size: "sm", variant: "flat", onPress: () => {
          createPortal(DetectCompressedFilesModal, { paths: [rootPath] });
        }, children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(MdUnarchive, { className: "text-lg" }),
          t2("Bulk decompression all decompressed files in current folder")
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Tooltip$1,
          {
            content: t2("Usually this will work fine if you are categorizing files."),
            placement: "bottom",
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              checkbox_default,
              {
                size: "sm",
                isSelected: (_c2 = (_b2 = optionsStore.data) == null ? void 0 : _b2.fileProcessor) == null ? void 0 : _c2.showOperationsAfterPlayingFirstFile,
                onValueChange: (v2) => {
                  var _a3, _b3, _c3;
                  BApi$1.options.patchFileSystemOptions({
                    ...optionsStore.data,
                    fileProcessor: {
                      ...(_a3 = optionsStore.data) == null ? void 0 : _a3.fileProcessor,
                      showOperationsAfterPlayingFirstFile: v2,
                      workingDirectory: ((_c3 = (_b3 = optionsStore.data) == null ? void 0 : _b3.fileProcessor) == null ? void 0 : _c3.workingDirectory) ?? ""
                    }
                  });
                },
                children: t2("Show operations after playing first file")
              }
            )
          }
        )
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "root relative overflow-hidden min-h-0 grow", tabIndex: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute top-0 left-0 w-full h-full flex flex-col", children: rootPathInitialized && /* @__PURE__ */ jsxRuntimeExports.jsx(
      RootTreeEntry,
      {
        expandable: true,
        afterPlayedFirstFile: (entry) => {
          var _a3;
          if ((_a3 = fpOptionsRef.current) == null ? void 0 : _a3.showOperationsAfterPlayingFirstFile) {
            createPortal(AfterFirstPlayOperationsModal, {
              entry
            });
          }
        },
        capabilities: [
          "select",
          "multi-select",
          "range-select",
          "decompress",
          "wrap",
          "move",
          "extract",
          "delete",
          "rename",
          "delete-all-same-name",
          "group",
          "play-first-file"
        ],
        rootPath,
        selectable: "multiple",
        onDoubleClick: (evt, en2) => {
          if (!en2.isDirectoryOrDrive) {
            BApi$1.tool.openFile({ path: en2.path });
            return false;
          }
          return true;
        },
        onInitialized: (v2) => {
          if (v2 != void 0) {
            BApi$1.options.patchFileSystemOptions({
              fileProcessor: {
                ...fpOptionsRef.current ?? { showOperationsAfterPlayingFirstFile: false },
                workingDirectory: v2
              }
            });
            setRootPath(v2);
          }
        }
      }
    ) }) })
  ] }) });
};
FileProcessorPage.displayName = "FileProcessorPage";
const developingThirdPartyIds = [
  ThirdPartyId.Fantia,
  ThirdPartyId.Fanbox,
  ThirdPartyId.Cien,
  ThirdPartyId.Patreon
];
const isThirdPartyDeveloping = (thirdPartyId) => {
  return developingThirdPartyIds.includes(thirdPartyId);
};
const DevelopingChip = ({
  className,
  size: size2 = "sm",
  variant = "flat",
  color: color2 = "secondary",
  tooltipContent,
  showTooltip = true
}) => {
  const { t: t2 } = useTranslation();
  const defaultTooltipContent = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    t2(
      "This feature is currently in development and may not be fully functional."
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
    t2("DevelopingFeature.ExpectChanges")
  ] });
  const chip2 = /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { className, color: color2, size: size2, variant, children: t2("Developing") });
  if (!showTooltip) {
    return chip2;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      color: "foreground",
      content: tooltipContent || defaultTooltipContent,
      placement: "top",
      children: chip2
    }
  );
};
DevelopingChip.displayName = "DevelopingChip";
const CookieValidator = ({
  cookie,
  target,
  onChange = (v2) => {
  },
  description
}) => {
  const { t: t2 } = useTranslation();
  const [status, setStatus] = reactExports.useState();
  const renderStatus = () => {
    if (!status) {
      return null;
    }
    switch (status) {
      case "loading":
        return null;
      case "failed":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$_, { className: "text-base text-danger" });
      case "succeed":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$10, { className: "text-base text-success" });
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "cookie-validator", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      textarea_default,
      {
        description,
        label: t2("Cookie validator"),
        size: "sm",
        value: cookie,
        onValueChange: (v2) => {
          onChange(v2);
        }
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 mt-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          color: "primary",
          isDisabled: !cookie || !cookie.length,
          isLoading: status === "loading",
          size: "sm",
          variant: "flat",
          onClick: () => {
            if (cookie && cookie.length > 0) {
              setStatus("loading");
              BApi$1.tool.validateCookie({
                target,
                cookie
              }).then((a2) => {
                if (!a2.code) {
                  setStatus("succeed");
                } else {
                  setStatus("failed");
                }
              }).catch(() => {
                setStatus("failed");
              });
            }
          },
          children: t2("Validate")
        }
      ),
      renderStatus()
    ] })
  ] });
};
CookieValidator.displayName = "CookieValidator";
const DownloaderOptions = ({
  thirdPartyId,
  options,
  namingDefinition,
  onChange
}) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      CookieValidator,
      {
        cookie: (options == null ? void 0 : options.cookie) || "",
        description: t2("Cookie required for authentication"),
        target: thirdPartyId,
        onChange: (cookie) => {
          onChange({ cookie });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { className: "opacity-70", size: "sm", variant: "light", children: t2("Default download path") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: options && /* @__PURE__ */ jsxRuntimeExports.jsx(
        FileSystemSelectorButton,
        {
          fileSystemSelectorProps: {
            targetType: "folder",
            onSelected: (e2) => onChange({
              defaultPath: e2.path
            }),
            defaultSelectedPath: options == null ? void 0 : options.defaultPath
          }
        }
      ) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { className: "opacity-70", size: "sm", variant: "light", children: t2("Default path where downloads will be saved") })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        isRequired: true,
        description: t2("Maximum concurrent download threads"),
        label: t2("Max concurrency"),
        max: 100,
        min: 1,
        value: (options == null ? void 0 : options.maxConcurrency) || 1,
        onValueChange: (maxConcurrency) => {
          onChange({ maxConcurrency });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        isRequired: true,
        description: t2("Request interval help"),
        label: t2("Request interval (s)"),
        max: 60,
        min: 0,
        value: (options == null ? void 0 : options.requestInterval) || 0,
        onValueChange: (requestInterval) => {
          onChange({ requestInterval });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      textarea_default,
      {
        isRequired: true,
        description: namingDefinition ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Define how downloaded files should be named") }),
          namingDefinition.namingFields && namingDefinition.namingFields.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs mb-1", children: [
              t2("Available fields"),
              ":"
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: namingDefinition.namingFields.map((x2, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                color: "secondary",
                size: "sm",
                variant: "flat",
                onClick: () => {
                  const currentConvention = (options == null ? void 0 : options.namingConvention) || "";
                  const newConvention = currentConvention + `{${x2.name || x2.key}}`;
                  onChange({ namingConvention: newConvention });
                },
                children: x2.name || x2.key
              },
              index2
            )) })
          ] })
        ] }) : t2("Define how downloaded files should be named"),
        label: t2("Naming convention"),
        placeholder: namingDefinition == null ? void 0 : namingDefinition.defaultConvention,
        value: (options == null ? void 0 : options.namingConvention) || "",
        onValueChange: (namingConvention) => {
          onChange({ namingConvention });
        }
      }
    ) })
  ] });
};
DownloaderOptions.displayName = "DownloaderOptions";
const Pixiv = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAACi1BMVEUAAAAAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oBl/oCmPoEmPoEmfoDmPoAlvoAlPoAkPoAkvoBlvoAkfoDmfoAlfohpftWuvyFzv2t3v7N6/7a8P7Z8P7J6f6l2/15yf0/sfsKm/oBk/obo/tzxvzG6P74/P/////8/v/h8/6O0f0fpPsClvoBlfotqvuh2f3z+v/1+/+24f5xxfwoqPsZovsYofslpvtAsft5yfzO6/7+///2+/+Ezv0Hl/oCmfoaofuc1/37/f/g8v5wxfwaovsAk/oDl/pTufze8f4govsClfplwfzr9//6/f+74/4JmvoBlPoCl/oOm/qx4P73/P/d8v4io/sVnvqw3/7+/v+P0P0AjvoHmvq04f7T7v4Pm/oBmPoyq/vc8f644/79/v+U0/0UnPr5/P+Z1f1KtPz0+/92x/yS0/1hvfw7rvtKtvyBzP0AjPktqfv9//8Kmfrd8f5HtPyp3P0qqfuR0f3m9f8RnvoAj/o9rvspqPtPtvzn9v9SufwsqftpwvwqpvsPnvogpPt/y/2CzP0sqPtvxPxTuPxHtPvo9v8TnvoWnvqf2P0FmfqIzv0yqvuT0/0FmvpFsvv5/f+Jzv2Q0f0Imvo4rvvs+P+85P4Fl/oDkfpjwPzA5v4Qm/rC5v5owvwJm/oBkPrI6f6a1v0JmPqe2P2Q0v2Ay/2U1P224v7n9f9JtfwDlvqd1/3R7P6m2/1ItfwElvqR0v0AivkEkvobovtBsvtkwPyW1P0Pnfonofv6/v+Oz/0do/uX1f3U7v5CsvuJz/3e8v7f8v7t+P8UoPoGmvog9p7YAAAAFHRSTlMAAQMTbcHu/gJf5J79nfpi3vy97BUqMK0AAAABYktHRDM31XxeAAAAB3RJTUUH5gsRCDsh7XT9CgAAA11JREFUSMeVlvd7FEUYx+dSuJCEQGBmsnM7m7kVjYABIe+GFoJKW0A5ZVHQ0FswwCUcxQIEbBCOJl2NhCKhCNKiQsAKUpSigAr8Oc7FhNu9vWxy7w97z7P7fub7vu/cvO8ghHxpKD0js4sfe5i/S2ZGOkrzIWm+LNQ1G3u6tyA4uyvKkoTPl5aD/bm5HRAtHjlpPh/KQt1wXm5H68csNw93k+6oO87rMJ5WlTzcHaH0HrhT67do4B7pKAPnJ/1ICHG/zMcZqKdbgBYoTP4ECFMYSZDoiXolVJQqROVcK6SUFgquBYLUUdteyOnOmMr1p3o//UzRs3369O33XHF/rgbtKn7kWJ0NEM8PHFQC0gwj9oTSwUP4ULuIHQgOE8PLRgCUj3yh+MWXRo0eM3YcmDB+wkT15WQAZfyVSSGAV1+bbHHNUlVL41NefwNCUDRVC7qB4DTtzbegAqbP4DOpwmTOlCmz+Ow5MBfmzbdoIhDUFiyESqMCFr1dFQ+ZKPq0xVACS5bqYScQFNU1YCwrj8ByUeAom7piHqyEVYI6AMrfeRfgvfkRA97niqPQCl8NRgTWaNQGMG2trGLtuvUfuAGCP/xIplYmmAP4OAKfaOqGJApSYqME6jbpxBYSiy6HzZa+JRnAxFYwKqFYYzYgrC/dtl1TkwLU+tSUm7Gj9X1rlcLqzl0BKzmg7p4rY9rjBHB4ZoB6AnsTAExJe4C1LxbSZ4lA7Es7SX8e24gvBOskoPBVMqL6Lx1l9QDC+v56CTQ4Ns4LOBA9CCEzdMii7QCHHQD5KnrEgEY42ibgBo7x47TtEBOFRU98Lf/eJ09h0h7QEP3GClBWoCgFVBfq6fLKRjhz9slxSATANM+dH96kCs75t9au3t9BxITvL+jxM5UIgGEC1J282Hyp9vIPP0oexv0kfra1DVdIv1Q3/9oIrWbWXbn6m3C0Pxdw7fqNwpu//7H31qRbtadP3BaCMIy9gMOiiqiaTEHIPDSdOd2dgLpeApeFIluUrFGsUMzdwe0Av3M3BH9eV7CXxZtxWP/rHhhw/wEmHv7+eLtn4m/zn9J/H9Y8iu+Sy122e9tAYY+bmpqqHnsIxAaKbWQF/jePgGIjyz4USYt5CcihmPLYTXmwp3x1SPlykur15z/S+USr7Zl7DAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMi0xMS0xN1QwODo1OTozMyswMDowMIIwbsEAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjItMTEtMTdUMDg6NTk6MzMrMDA6MDDzbdZ9AAAAKHRFWHRkYXRlOnRpbWVzdGFtcAAyMDIyLTExLTE3VDA4OjU5OjMzKzAwOjAwpHj3ogAAAABJRU5ErkJggg==";
const Bilibili = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAdVBMVEX///8AodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodb///8ZuLwtAAAAJXRSTlMAAASg6qgO61/FYmMGD27H8xvP0Adtthn5+Enm50rkGLXRb8v0WPWOwgAAAAFiS0dEAIgFHUgAAAAHdElNRQfmCxIDHg0pvwEBAAAA1UlEQVQ4y7WS6w6CMAxGNxAEHYw7ykUQ6Pu/otvMkqJjYozfj6XpOdmytIR8CpVx3IPnUxTfO7qOqp5CAAAhMvxQNAIknGBlKA5nJDDVCSPMQ4YE3YteayWwmCdgSMJjJoU0g81kKSXMwgHygpRgTUm4OKuaGlJXAnFyEaeRC0OgK5H30I1Itl9o2rbRQNcroQVotaDrlYCfwr39gri2Q090b0Lf3Xot6Pq7b/5RsAxrkGulxj0OJp6OatyxfWFiUuQ2fi/sS5unau2neTHRZZ7k2v+cBx/cQTG/EQOuAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTExLTE4VDAzOjMwOjEzKzAwOjAwvZZQrAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0xMS0xOFQwMzozMDoxMyswMDowMMzL6BAAAAAodEVYdGRhdGU6dGltZXN0YW1wADIwMjItMTEtMThUMDM6MzA6MTMrMDA6MDCb3snPAAAAAElFTkSuQmCC";
const SoulPlus = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAGqUExURf///+6rq9k/P9Y0NNIfH9pHR9IeHtQmJtMjI+JsbOmPj+Jvb++xsfvp6fjb2/THx/CysumQkN9fX9c5OdEXF8wAANIcHPja2tAUFON0dONzc+FpafG3t/bU1Pvs7Pzx8dUvL9UsLOmTk/K9veuZmdMhIc8QEP339/TKyu2jo+aDg+JwcN9hYdtLS+2mpvG5ufG6uuaCguyhoeygoPPExPbT0+BjY/fZ2eqXl84ICNtKSv3z891UVPni4uNxcc8PD+qYmPzy8vK+vu6srPvq6vzv7/74+NxRUc0EBOaEhM4MDOqUlOFqauFnZ9UrK9xOTt5bW/XMzPPDw9AWFtc3N/K8vP75+fTJye6oqPro6PG4uPPCwtxSUvje3tpFRf329uiNjd5YWNtMTPCzs8wBAdc1NfPFxeeIiN5cXOyiouBlZfC1te6qqtYyMvfV1dAVFeBiYvjd3eR4eNYzM/C0tNpISO+vr88NDcwCAtEYGO+urtEaGvrn5+qWls8ODtxQUNg6OuiLi80FBeeFhfTGxtUuLttNTc0HB+mRkf77+9c2NuiOjuqVleFoaARArjoAAAABYktHRACIBR1IAAAAB3RJTUUH6QYHECcy4TxtZgAAAQpJREFUGNMVzQcjAgEYBuD3umQUiT7p5DKLuEg4JEdCUcloyIpKdrZkRcj8z3j+wAMwMhkrL1GUlpVXsEoVUFmlrtbU1GqJ6nRE9XpwDYyhkTc2Nbe0oq2dTDB3dFq6ugXOaOV7emEj9Nn78W9gUBwaHnGoMUrkHJPGJ1yTvBtT08CMx+ueJY15zufwB+ZdQHBhcUlLyyEeYjgSXYnBHDOtrhEJzvUNSb8Z3wK2rQmiqJ2NQ5EMUQph1U6advdo/wDsoUhH8B4jSLHMyenZuSF9cSnh6jqQvcmRz0W3d3TPPeAxSZR/omddgQovkcwr3op/hcWTlRIJmZyK7/iwfQa+vn+UQpFBLuXHL9oqOFMpSC1gAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDI1LTA2LTA3VDE2OjM5OjUwKzAwOjAwN80fUAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyNS0wNi0wN1QxNjozOTo1MCswMDowMEaQp+wAAAAodEVYdGRhdGU6dGltZXN0YW1wADIwMjUtMDYtMDdUMTY6Mzk6NTArMDA6MDARhYYzAAAAAElFTkSuQmCC";
const NameIcon = {
  [ThirdPartyId.ExHentai]: ExHentai,
  [ThirdPartyId.Pixiv]: Pixiv,
  [ThirdPartyId.Bilibili]: Bilibili,
  [ThirdPartyId.SoulPlus]: SoulPlus
};
const ThirdPartyIcon = ({ thirdPartyId, size: size2 }) => {
  const { t: t2 } = useTranslation();
  let sizeValue = 18;
  if (size2) {
    switch (size2) {
      case "sm":
        sizeValue = 18;
        break;
      case "md":
        sizeValue = 24;
        break;
      case "lg":
        sizeValue = 32;
        break;
    }
  }
  const style2 = {
    width: sizeValue,
    height: sizeValue,
    maxWidth: sizeValue,
    maxHeight: sizeValue
  };
  const img = NameIcon[thirdPartyId];
  if (!img) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineQuestionCircle, { style: style2 });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "img",
    {
      alt: t2(`ThirdPartyId.${ThirdPartyId[thirdPartyId]}`),
      src: img,
      style: style2
    }
  );
};
ThirdPartyIcon.displayName = "ThirdPartyIcon";
const ConfigurationsModal = ({ onSubmitted, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const [thirdPartyGroups, setThirdPartyGroups] = reactExports.useState({});
  const [downloaderOptions, setDownloaderOptions] = reactExports.useState({});
  const [tmpOptions, setTmpOptions] = reactExports.useState({});
  const [allNamingDefinitions, setAllNamingDefinitions] = reactExports.useState({});
  const [selectedTab, setSelectedTab] = reactExports.useState("");
  const loadOptionsForThirdParty = async (thirdPartyId) => {
    try {
      const definitions = thirdPartyGroups[thirdPartyId];
      if (!definitions || definitions.length === 0) {
        return;
      }
      const firstDefinition = definitions[0];
      const optionsRes = await BApi$1.downloadTask.getDownloaderOptions(
        thirdPartyId,
        { taskType: firstDefinition.taskType }
      );
      if (optionsRes.data) {
        setDownloaderOptions((prev2) => ({
          ...prev2,
          [thirdPartyId]: optionsRes.data
        }));
      }
    } catch (error2) {
      console.error(
        `Failed to reload options for third party ${thirdPartyId}:`,
        error2
      );
    }
  };
  reactExports.useEffect(() => {
    const loadData = async () => {
      try {
        const definitionsRes = await BApi$1.downloadTask.getAllDownloaderDefinitions();
        const definitions = definitionsRes.data || [];
        const groups2 = {};
        const namingMap = {};
        definitions.forEach((def) => {
          var _a2;
          if (!groups2[def.thirdPartyId]) {
            groups2[def.thirdPartyId] = [];
          }
          groups2[_a2 = def.thirdPartyId] ?? (groups2[_a2] = []);
          groups2[def.thirdPartyId].push(def);
          if (!namingMap[def.thirdPartyId]) {
            namingMap[def.thirdPartyId] = def;
          }
        });
        setThirdPartyGroups(groups2);
        setAllNamingDefinitions(namingMap);
        const thirdPartyIds = Object.keys(groups2).map(
          (id2) => parseInt(id2, 10)
        );
        if (thirdPartyIds.length > 0 && !selectedTab) {
          setSelectedTab(thirdPartyIds[0]);
        }
        const optionsPromises = thirdPartyIds.map(async (thirdPartyId) => {
          var _a2;
          try {
            const firstDefinition = (_a2 = groups2[thirdPartyId]) == null ? void 0 : _a2[0];
            if (!firstDefinition) {
              return null;
            }
            const optionsRes = await BApi$1.downloadTask.getDownloaderOptions(
              thirdPartyId,
              { taskType: firstDefinition.taskType }
            );
            return {
              thirdPartyId,
              options: optionsRes.data
            };
          } catch (error2) {
            console.error(
              `Failed to load options for third party ${thirdPartyId}:`,
              error2
            );
            return null;
          }
        });
        const optionsResults = await Promise.all(optionsPromises);
        const optionsMap = {};
        optionsResults.forEach((result) => {
          if (result && result.options) {
            optionsMap[result.thirdPartyId] = result.options;
          }
        });
        setDownloaderOptions(optionsMap);
      } catch (error2) {
        console.error("Failed to load downloader data:", error2);
      }
    };
    loadData();
  }, []);
  const handleSubmit = async () => {
    try {
      const updatePromises = Object.entries(tmpOptions).filter(([, options]) => options && Object.keys(options).length > 0).map(async ([thirdPartyIdStr, patchOptions]) => {
        var _a2;
        const thirdPartyId = parseInt(thirdPartyIdStr, 10);
        const firstDefinition = (_a2 = thirdPartyGroups[thirdPartyId]) == null ? void 0 : _a2[0];
        if (!firstDefinition) {
          return;
        }
        const currentOptions = downloaderOptions[thirdPartyId];
        const updatedOptions = {
          ...currentOptions,
          ...patchOptions
        };
        return BApi$1.downloadTask.putDownloaderOptions(
          thirdPartyId,
          updatedOptions,
          { taskType: firstDefinition.taskType }
        );
      });
      await Promise.all(updatePromises);
      onSubmitted == null ? void 0 : onSubmitted();
    } catch (error2) {
      console.error("Failed to save downloader options:", error2);
    }
  };
  const handleTabChange = async (tabKey) => {
    const thirdPartyId = parseInt(tabKey, 10);
    setSelectedTab(thirdPartyId);
    await loadOptionsForThirdParty(thirdPartyId);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      size: "xl",
      title: t2("Configurations"),
      onDestroyed,
      onOk: handleSubmit,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Tabs,
        {
          selectedKey: selectedTab == null ? void 0 : selectedTab.toString(),
          onSelectionChange: (key) => handleTabChange(key),
          children: Object.entries(thirdPartyGroups).map(([thirdPartyIdStr]) => {
            const thirdPartyId = parseInt(thirdPartyIdStr, 10);
            const options = downloaderOptions[thirdPartyId];
            const mergedOptions = { ...options, ...tmpOptions[thirdPartyId] };
            const isDeveloping = isThirdPartyDeveloping(thirdPartyId);
            const thirdPartyName = ThirdPartyId[thirdPartyId] || `Third Party ${thirdPartyId}`;
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              Tab,
              {
                title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(ThirdPartyIcon, { thirdPartyId }),
                  t2(thirdPartyName),
                  isDeveloping && /* @__PURE__ */ jsxRuntimeExports.jsx(DevelopingChip, { size: "sm" })
                ] }),
                children: options && /* @__PURE__ */ jsxRuntimeExports.jsx(
                  DownloaderOptions,
                  {
                    namingDefinition: allNamingDefinitions[thirdPartyId],
                    options: mergedOptions,
                    thirdPartyId,
                    onChange: (patchOptions) => {
                      setTmpOptions({
                        ...tmpOptions,
                        [thirdPartyId]: {
                          ...tmpOptions[thirdPartyId],
                          ...patchOptions
                        }
                      });
                    }
                  }
                )
              },
              thirdPartyId
            );
          })
        }
      )
    }
  );
};
Chart$1.register(
  CategoryScale,
  LinearScale,
  BarElement,
  plugin_title,
  plugin_tooltip,
  plugin_legend
);
const RequestStatistics = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const requestStatistics = useThirdPartyRequestStatisticsStore(
    (state) => state.statistics
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    Button,
    {
      size: "sm",
      variant: "light",
      onPress: () => {
        const thirdPartyRequestCounts = (requestStatistics || []).reduce((s2, t22) => {
          Object.keys(t22.counts || {}).forEach((r2) => {
            var _a2;
            const resultTypeValue = parseInt(
              r2,
              10
            );
            s2.push({
              id: t22.id.toString(),
              name: ThirdPartyId[t22.id],
              result: resultTypeValue,
              // Use numeric value directly
              count: (_a2 = t22.counts) == null ? void 0 : _a2[r2]
            });
          });
          return s2;
        }, []);
        createPortal(Modal, {
          size: "xl",
          defaultVisible: true,
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(BizChartsChart, { data: thirdPartyRequestCounts }),
          footer: {
            actions: ["ok"]
          },
          title: t2("Requests overview")
        });
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineBarChart, { className: "text-base" }),
        t2("Requests overview"),
        requestStatistics == null ? void 0 : requestStatistics.map((rs) => {
          let successCount = 0;
          let failureCount = 0;
          Object.keys(rs.counts || {}).forEach((r2) => {
            const rt = parseInt(r2, 10);
            switch (rt) {
              case ThirdPartyRequestResultType.Succeed:
                successCount += rs.counts[r2];
                break;
              default:
                failureCount += rs.counts[r2];
                break;
            }
          });
          return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(ThirdPartyIcon, { size: "sm", thirdPartyId: rs.id }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Success"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                className: "p-0",
                color: "success",
                size: "sm",
                variant: "light",
                children: successCount
              }
            ) }),
            "/",
            /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Failure"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                className: "p-0",
                color: "danger",
                size: "sm",
                variant: "light",
                children: failureCount
              }
            ) })
          ] });
        })
      ] })
    }
  ) });
};
RequestStatistics.displayName = "RequestStatistics";
const BizChartsChart = ({
  data,
  height = 300
}) => {
  const { t: t2 } = useTranslation();
  const { isDarkMode } = useBakabaseContext();
  const getCssVariable = (variableName) => {
    if (typeof document === "undefined") {
      return "";
    }
    return getComputedStyle(document.documentElement).getPropertyValue(
      variableName
    );
  };
  const getRequestResultTypeColorMap = () => {
    const successColor = getCssVariable("--theme-color-success") || "#46bc15";
    const dangerColor = getCssVariable("--theme-text-error") || "#ff3000";
    const warningColor = getCssVariable("--theme-color-warning") || "#ff9300";
    const subtleColor2 = getCssVariable("--theme-text-subtle") || "#666";
    const bannedColor = "#993300";
    return {
      [ThirdPartyRequestResultType.Succeed]: successColor,
      [ThirdPartyRequestResultType.Failed]: dangerColor,
      [ThirdPartyRequestResultType.Banned]: bannedColor,
      [ThirdPartyRequestResultType.Canceled]: subtleColor2,
      [ThirdPartyRequestResultType.TimedOut]: warningColor
    };
  };
  if (!Array.isArray(data) || data.length === 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center py-4 text-gray-500", children: t2("No data") });
  }
  const groupedData = data.reduce(
    (acc, item) => {
      if (!acc[item.id]) {
        acc[item.id] = {};
      }
      acc[item.id][item.result] = item.count;
      return acc;
    },
    {}
  );
  const thirdParties = Object.keys(groupedData);
  const resultTypes = Object.values(ThirdPartyRequestResultType).filter(
    (value2) => typeof value2 === "number"
  );
  const colorMap = getRequestResultTypeColorMap();
  const chartData = {
    labels: thirdParties.map(
      (id2) => ThirdPartyId[id2]
    ),
    datasets: resultTypes.map((resultType) => ({
      label: t2(ThirdPartyRequestResultType[resultType]),
      data: thirdParties.map((id2) => groupedData[id2][resultType] || 0),
      backgroundColor: colorMap[resultType],
      borderColor: colorMap[resultType],
      borderWidth: 1
    }))
  };
  const textColor = getCssVariable("--theme-text") || (isDarkMode ? "#e6e6e6" : "#000");
  const subtleColor = getCssVariable("--theme-text-subtle") || (isDarkMode ? "#c0c0c0" : "#666");
  const borderColor = getCssVariable("--theme-border-color") || (isDarkMode ? "rgb(48, 54, 61)" : "#f0f0f0");
  const tooltipBg = isDarkMode ? "rgba(0,0,0,0.9)" : "rgba(0,0,0,0.8)";
  const options = {
    responsive: true,
    maintainAspectRatio: false,
    plugins: {
      legend: {
        position: "top",
        labels: {
          color: textColor
        }
      },
      tooltip: {
        backgroundColor: tooltipBg,
        titleColor: "#fff",
        bodyColor: "#fff",
        borderColor: "rgba(0, 0, 0, 0.2)",
        borderWidth: 1
      }
    },
    scales: {
      x: {
        stacked: true,
        grid: {
          display: false
        },
        ticks: {
          color: subtleColor
        }
      },
      y: {
        stacked: true,
        beginAtZero: true,
        grid: {
          color: borderColor
        },
        ticks: {
          color: subtleColor
        }
      }
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { height }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Bar, { data: chartData, options }) });
};
const DownloadTaskTypeIconMap = {
  [ThirdPartyId.Bilibili]: {
    [BilibiliDownloadTaskType.Favorites]: AiOutlineStar
  },
  [ThirdPartyId.ExHentai]: {
    [ExHentaiDownloadTaskType.List]: AiOutlineUnorderedList,
    [ExHentaiDownloadTaskType.Torrent]: FaMagnet,
    [ExHentaiDownloadTaskType.Watched]: AiOutlineStar,
    [ExHentaiDownloadTaskType.SingleWork]: FaImages
  },
  [ThirdPartyId.Pixiv]: {
    [PixivDownloadTaskType.Following]: AiOutlineStar,
    [PixivDownloadTaskType.Ranking]: FaRankingStar,
    [PixivDownloadTaskType.Search]: AiOutlineSearch
  }
};
var DownloadTaskFieldType = /* @__PURE__ */ ((DownloadTaskFieldType2) => {
  DownloadTaskFieldType2[DownloadTaskFieldType2["BilibiliFavorites"] = 1] = "BilibiliFavorites";
  DownloadTaskFieldType2[DownloadTaskFieldType2["PageRange"] = 2] = "PageRange";
  DownloadTaskFieldType2[DownloadTaskFieldType2["FfMpegRequired"] = 3] = "FfMpegRequired";
  DownloadTaskFieldType2[DownloadTaskFieldType2["LuxRequired"] = 4] = "LuxRequired";
  DownloadTaskFieldType2[DownloadTaskFieldType2["Key"] = 5] = "Key";
  DownloadTaskFieldType2[DownloadTaskFieldType2["Keys"] = 6] = "Keys";
  DownloadTaskFieldType2[DownloadTaskFieldType2["DownloadPath"] = 7] = "DownloadPath";
  DownloadTaskFieldType2[DownloadTaskFieldType2["CheckInterval"] = 8] = "CheckInterval";
  DownloadTaskFieldType2[DownloadTaskFieldType2["Checkpoint"] = 9] = "Checkpoint";
  DownloadTaskFieldType2[DownloadTaskFieldType2["AutoRetry"] = 10] = "AutoRetry";
  DownloadTaskFieldType2[DownloadTaskFieldType2["AllowDuplicate"] = 11] = "AllowDuplicate";
  return DownloadTaskFieldType2;
})(DownloadTaskFieldType || {});
const DownloadTaskFieldMap = {
  [ThirdPartyId.Bilibili]: {
    [BilibiliDownloadTaskType.Favorites]: [
      {
        type: 3
        /* FfMpegRequired */
      },
      {
        type: 4
        /* LuxRequired */
      },
      {
        type: 1
        /* BilibiliFavorites */
      },
      {
        type: 7
        /* DownloadPath */
      },
      {
        type: 8
        /* CheckInterval */
      },
      {
        type: 2
        /* PageRange */
      },
      {
        type: 9
        /* Checkpoint */
      },
      {
        type: 10
        /* AutoRetry */
      },
      {
        type: 11
        /* AllowDuplicate */
      }
    ]
  },
  [ThirdPartyId.ExHentai]: {
    [ExHentaiDownloadTaskType.List]: [
      {
        type: 6,
        placeholder: `https://exhentai.org/g/xxxxx/xxxxx/
https://exhentai.org/g/xxxxx/xxxxx/
...`,
        label: "Urls"
      },
      {
        type: 7
        /* DownloadPath */
      },
      {
        type: 8
        /* CheckInterval */
      },
      {
        type: 2
        /* PageRange */
      },
      {
        type: 9
        /* Checkpoint */
      },
      {
        type: 10
        /* AutoRetry */
      },
      {
        type: 11
        /* AllowDuplicate */
      }
    ],
    [ExHentaiDownloadTaskType.Torrent]: [
      {
        type: 6,
        placeholder: `https://exhentai.org/g/xxxxx/xxxxx/
https://exhentai.org/g/xxxxx/xxxxx/
...`,
        label: "Urls"
      },
      {
        type: 7
        /* DownloadPath */
      },
      {
        type: 9
        /* Checkpoint */
      },
      {
        type: 10
        /* AutoRetry */
      },
      {
        type: 11
        /* AllowDuplicate */
      }
    ],
    [ExHentaiDownloadTaskType.Watched]: [
      {
        type: 5,
        defaultValue: "https://exhentai.org/watched",
        label: "Watch url"
      },
      {
        type: 7
        /* DownloadPath */
      },
      {
        type: 8
        /* CheckInterval */
      },
      {
        type: 2
        /* PageRange */
      },
      {
        type: 9
        /* Checkpoint */
      },
      {
        type: 10
        /* AutoRetry */
      },
      {
        type: 11
        /* AllowDuplicate */
      }
    ],
    [ExHentaiDownloadTaskType.SingleWork]: [
      {
        type: 6,
        placeholder: `https://exhentai.org/g/xxxxx/xxxxx/`,
        label: "Url"
      },
      {
        type: 7
        /* DownloadPath */
      },
      {
        type: 8
        /* CheckInterval */
      },
      {
        type: 2
        /* PageRange */
      },
      {
        type: 9
        /* Checkpoint */
      },
      {
        type: 10
        /* AutoRetry */
      },
      {
        type: 11
        /* AllowDuplicate */
      }
    ]
  },
  [ThirdPartyId.Pixiv]: {
    [PixivDownloadTaskType.Following]: [
      {
        type: 6,
        label: "Urls",
        placeholder: `https://www.pixiv.net/bookmark_new_illust.php
https://www.pixiv.net/bookmark_new_illust_r18.php
https://www.pixiv.net/bookmark_new_illust_r18.php?p=3`
      },
      {
        type: 7
        /* DownloadPath */
      },
      {
        type: 8
        /* CheckInterval */
      },
      {
        type: 2
        /* PageRange */
      },
      {
        type: 9
        /* Checkpoint */
      },
      {
        type: 10
        /* AutoRetry */
      },
      {
        type: 11
        /* AllowDuplicate */
      }
    ],
    [PixivDownloadTaskType.Ranking]: [
      {
        type: 6,
        label: "Urls",
        placeholder: `https://www.pixiv.net/ranking.php
https://www.pixiv.net/ranking.php?mode=daily_r18`
      },
      {
        type: 7
        /* DownloadPath */
      },
      {
        type: 8
        /* CheckInterval */
      },
      {
        type: 9
        /* Checkpoint */
      },
      {
        type: 10
        /* AutoRetry */
      },
      {
        type: 11
        /* AllowDuplicate */
      }
    ],
    [PixivDownloadTaskType.Search]: [
      {
        type: 6,
        label: "Urls",
        placeholder: `https://www.pixiv.net/tags/azurlane
https://www.pixiv.net/tags/azurlane/top
https://www.pixiv.net/tags/azurlane/illustrations
https://www.pixiv.net/tags/azurlane/manga
https://www.pixiv.net/tags/azurlane/artworks?order=popular_male_d&mode=safe`
      },
      {
        type: 7
        /* DownloadPath */
      },
      {
        type: 8
        /* CheckInterval */
      },
      {
        type: 2
        /* PageRange */
      },
      {
        type: 9
        /* Checkpoint */
      },
      {
        type: 10
        /* AutoRetry */
      },
      {
        type: 11
        /* AllowDuplicate */
      }
    ]
  }
};
function LuxRequired() {
  const { t: t2 } = useTranslation();
  const dependentComponentContexts = useDependentComponentContextsStore(
    (state) => state.contexts
  );
  const luxState = dependentComponentContexts == null ? void 0 : dependentComponentContexts.find(
    (d2) => d2.id === DependentComponentIds.Lux
  );
  const isLuxMissing = (luxState == null ? void 0 : luxState.status) !== DependentComponentStatus.Installed;
  if (!isLuxMissing) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    alert_default,
    {
      color: "danger",
      title: t2(
        "This function is not working because Lux is not found, check it in system configurations"
      )
    }
  );
}
function FfMpegRequired() {
  const { t: t2 } = useTranslation();
  const dependentComponentContexts = useDependentComponentContextsStore(
    (state) => state.contexts
  );
  const ffmpegState = dependentComponentContexts == null ? void 0 : dependentComponentContexts.find(
    (d2) => d2.id === DependentComponentIds.FFMpeg
  );
  const isFfmpegMissing = (ffmpegState == null ? void 0 : ffmpegState.status) !== DependentComponentStatus.Installed;
  if (!isFfmpegMissing) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    alert_default,
    {
      color: "danger",
      title: t2(
        "This function is not working because FFmpeg is not found, check it in system configurations"
      )
    }
  );
}
const PageRange = ({ start: start2, end: end2, onChange }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
            "Set a page range if you don't want to download them all."
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("The minimal page number is 1.") })
        ] }),
        label: t2("Start page"),
        min: 1,
        size: "sm",
        step: 1,
        value: start2,
        onValueChange: (v2) => {
          onChange == null ? void 0 : onChange(v2, end2);
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        description: t2(
          "Set a page range if you don't want to download them all."
        ),
        label: t2("End page"),
        min: end2 ?? 1,
        size: "sm",
        step: 1,
        value: end2,
        onValueChange: (v2) => {
          onChange == null ? void 0 : onChange(start2, v2);
        }
      }
    )
  ] }) });
};
const BilibiliFavoritesSelector = ({ isDisabled, value: value2, onChange }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [loadingFavorites, setLoadingFavorites] = reactExports.useState(false);
  const [favorites, setFavorites] = reactExports.useState([]);
  reactExports.useEffect(() => {
    loadFavorites();
  }, []);
  const loadFavorites = async () => {
    setLoadingFavorites(true);
    try {
      const r2 = await BApi$1.bilibili.getBiliBiliFavorites();
      if (!r2.code) {
        setFavorites(r2.data || []);
      }
    } finally {
      setLoadingFavorites(false);
    }
  };
  const renderFavorites = () => {
    if (loadingFavorites) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" });
    }
    if (favorites.length === 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        t2(
          "Unable to retrieve Bilibili favorites. Please ensure your cookie is correctly set and that you have at least one favorite created."
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          button_default$1,
          {
            color: "primary",
            size: "sm",
            variant: "light",
            onPress: () => {
              createPortal(ConfigurationsModal, {
                onSubmitted: async () => {
                  await loadFavorites();
                }
              });
            },
            children: t2("Setup now")
          }
        )
      ] });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      radio_group_default,
      {
        isDisabled,
        label: t2("Select favorites"),
        orientation: "horizontal",
        size: "sm",
        value: value2 == null ? void 0 : value2.toString(),
        onValueChange: (value22) => {
          onChange == null ? void 0 : onChange(parseInt(value22, 10));
        },
        children: favorites.map((f2) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(radio_default, { value: f2.id.toString(), children: [
            f2.title,
            "(",
            f2.mediaCount,
            ")"
          ] }, f2.id);
        })
      }
    );
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(chip_default, { radius: "sm", children: t2("Select favorites") }),
    renderFavorites()
  ] });
};
const DownloadPathSelector = ({ downloadPath, onChange }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", children: t2("Download path") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        color: "primary",
        size: "sm",
        variant: "light",
        onPress: () => {
          createPortal(FileSystemSelectorModal, {
            onSelected: (e2) => {
              onChange == null ? void 0 : onChange(e2.path);
            },
            targetType: "folder",
            startPath: downloadPath,
            defaultSelectedPath: downloadPath
          });
        },
        children: downloadPath ?? t2("Select download path")
      }
    ) })
  ] });
};
const DownloadPathSelectorField = ({ downloadPath, onChange }) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(DownloadPathSelector, { downloadPath, onChange });
};
DownloadPathSelectorField.displayName = "DownloadPathSelectorField";
const IntervalField = ({ interval, onChange }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    number_input_default,
    {
      description: t2(
        "The interval (in seconds) after download completion or failure before restarting the task. Generally used for downloading content that updates periodically."
      ),
      label: t2("Check interval(s)"),
      value: interval,
      onValueChange: (value2) => onChange(value2)
    }
  );
};
IntervalField.displayName = "IntervalField";
const CheckpointField = ({ checkpoint, onChange }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    textarea_default,
    {
      description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "You can set the previous downloading checkpoint manually to make the downloader start the downloading task from it."
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "In most cases, you should let this field set by downloader automatically."
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "Each downloader has its own checkpoint format, and invalid checkpoint data will be ignored. You can find samples on our online document."
        ) })
      ] }),
      label: t2("Checkpoint"),
      size: "sm",
      value: checkpoint,
      onValueChange: onChange
    }
  );
};
CheckpointField.displayName = "CheckpointField";
const AutoRetryField = ({ autoRetry, onChange }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    checkbox_group_default,
    {
      description: t2(
        "Retry automatically when the downloading task failed."
      ),
      label: t2("Auto retry"),
      orientation: "horizontal",
      size: "sm",
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(checkbox_default, { defaultSelected: true, isSelected: autoRetry, onValueChange: onChange, children: t2("Yes") })
    }
  );
};
AutoRetryField.displayName = "AutoRetryField";
const AllowDuplicateField = ({ isDuplicateAllowed, onChange }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    checkbox_group_default,
    {
      description: t2(
        "In general, it's not necessary to create identical tasks."
      ),
      label: t2("Allow duplicate submission"),
      orientation: "horizontal",
      size: "sm",
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(checkbox_default, { isSelected: isDuplicateAllowed, onValueChange: onChange, children: t2("Yes") })
    }
  );
};
AllowDuplicateField.displayName = "AllowDuplicateField";
const DownloadTaskDetailModal = ({ onDestroyed, id: id2 }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const isAdding = !(id2 && id2 > 0);
  const [form2, setForm] = reactExports.useState({ autoRetry: true });
  const [taskDefinitions, setTaskDefinitions] = reactExports.useState([]);
  const [downloaderOptions, setDownloaderOptions] = reactExports.useState(
    null
  );
  const init2 = async () => {
    if (!isAdding) {
      const task = (await BApi$1.downloadTask.getDownloadTask(id2)).data;
      const form22 = {
        ...task,
        keys: [task.key],
        names: task.name === void 0 ? [] : [task.name]
      };
      setForm(form22);
    }
    const taskDefinitionsResponse = await BApi$1.downloadTask.getAllDownloaderDefinitions();
    setTaskDefinitions(taskDefinitionsResponse.data || []);
  };
  reactExports.useEffect(() => {
    init2();
  }, []);
  reactExports.useEffect(() => {
    const loadDownloaderOptions = async () => {
      if (form2.thirdPartyId && form2.type) {
        try {
          const optionsRes = await BApi$1.downloadTask.getDownloaderOptions(
            form2.thirdPartyId,
            { taskType: form2.type }
          );
          const options = optionsRes.data;
          setDownloaderOptions(options || null);
          if ((options == null ? void 0 : options.defaultPath) && !form2.downloadPath) {
            setForm((prev2) => ({
              ...prev2,
              downloadPath: options.defaultPath
            }));
          }
        } catch (error2) {
          console.error("Failed to load downloader options:", error2);
          setDownloaderOptions(null);
        }
      } else {
        setDownloaderOptions(null);
      }
    };
    loadDownloaderOptions();
  }, [form2.thirdPartyId, form2.type]);
  const availableThirdParties = React$5.useMemo(() => {
    const uniqueThirdParties = /* @__PURE__ */ new Map();
    taskDefinitions.forEach((def) => {
      if (!uniqueThirdParties.has(def.thirdPartyId)) {
        const thirdPartyName = ThirdPartyId[def.thirdPartyId] || def.name;
        uniqueThirdParties.set(def.thirdPartyId, thirdPartyName);
      }
    });
    return Array.from(uniqueThirdParties.entries()).map(([id22, name2]) => ({
      id: id22,
      name: name2
    })).sort((a2, b2) => a2.id - b2.id);
  }, [taskDefinitions]);
  const availableTaskTypes = React$5.useMemo(() => {
    if (!form2.thirdPartyId)
      return [];
    return taskDefinitions.filter((def) => def.thirdPartyId === form2.thirdPartyId).map((def) => ({
      value: def.taskType,
      label: def.name,
      description: def.description
    }));
  }, [taskDefinitions, form2.thirdPartyId]);
  const validateForm = (form22) => {
    if (form22.thirdPartyId && form22.downloadPath && form22.keys && form22.keys.length > 0 && form22.type) {
      return true;
    }
    return false;
  };
  const renderFields = () => {
    var _a2;
    if (form2.thirdPartyId && form2.type) {
      const fields = ((_a2 = DownloadTaskFieldMap[form2.thirdPartyId]) == null ? void 0 : _a2[form2.type]) ?? [];
      return fields.map((f2) => {
        var _a3, _b2, _c2;
        switch (f2.type) {
          case DownloadTaskFieldType.Key:
            if (!form2.keys || !form2.keys.length) {
              if (f2.defaultValue) {
                form2.keys = [f2.defaultValue];
              }
            }
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                defaultValue: f2.defaultValue,
                label: f2.label && t2(f2.label),
                placeholder: f2.placeholder,
                size: "sm",
                value: (_a3 = form2.keys) == null ? void 0 : _a3[0],
                onValueChange: (v2) => {
                  setForm({
                    ...form2,
                    keys: [v2]
                  });
                }
              }
            );
          case DownloadTaskFieldType.Keys:
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              textarea_default,
              {
                label: f2.label && t2(f2.label),
                placeholder: f2.placeholder,
                size: "sm",
                value: (_b2 = form2.keys) == null ? void 0 : _b2.join("\n"),
                onValueChange: (v2) => {
                  setForm({
                    ...form2,
                    keys: v2.split("\n").map((k2) => k2.trim()).filter((k2) => k2)
                  });
                }
              }
            );
          case DownloadTaskFieldType.BilibiliFavorites:
            const key = (_c2 = form2.keys) == null ? void 0 : _c2[0];
            const numberKey = key ? parseInt(key, 10) : void 0;
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              BilibiliFavoritesSelector,
              {
                isDisabled: !isAdding,
                value: numberKey,
                onChange: (v2) => setForm({
                  ...form2,
                  keys: [v2.toString()]
                })
              }
            );
          case DownloadTaskFieldType.PageRange:
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              PageRange,
              {
                end: form2.endPage,
                start: form2.startPage,
                onChange: (start2, end2) => setForm({
                  ...form2,
                  startPage: start2,
                  endPage: end2
                })
              }
            );
          case DownloadTaskFieldType.FfMpegRequired:
            return /* @__PURE__ */ jsxRuntimeExports.jsx(FfMpegRequired, {});
          case DownloadTaskFieldType.LuxRequired:
            return /* @__PURE__ */ jsxRuntimeExports.jsx(LuxRequired, {});
          case DownloadTaskFieldType.DownloadPath:
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              DownloadPathSelectorField,
              {
                downloadPath: form2.downloadPath,
                onChange: (downloadPath) => {
                  setForm({
                    ...form2,
                    downloadPath
                  });
                }
              }
            );
          case DownloadTaskFieldType.CheckInterval:
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              IntervalField,
              {
                interval: form2.interval,
                onChange: (interval) => {
                  setForm({
                    ...form2,
                    interval
                  });
                }
              }
            );
          case DownloadTaskFieldType.Checkpoint:
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              CheckpointField,
              {
                checkpoint: form2.checkpoint,
                onChange: (checkpoint) => {
                  setForm({
                    ...form2,
                    checkpoint
                  });
                }
              }
            );
          case DownloadTaskFieldType.AutoRetry:
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              AutoRetryField,
              {
                autoRetry: form2.autoRetry,
                onChange: (autoRetry) => {
                  setForm({
                    ...form2,
                    autoRetry
                  });
                }
              }
            );
          case DownloadTaskFieldType.AllowDuplicate:
            return isAdding ? /* @__PURE__ */ jsxRuntimeExports.jsx(
              AllowDuplicateField,
              {
                isDuplicateAllowed: form2.isDuplicateAllowed,
                onChange: (isDuplicateAllowed) => {
                  setForm({
                    ...form2,
                    isDuplicateAllowed
                  });
                }
              }
            ) : null;
        }
      });
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          isDisabled: !validateForm(form2)
        }
      },
      size: "xl",
      title: isAdding ? t2("Creating download task") : t2("Download task"),
      onDestroyed,
      onOk: async () => {
        const validForm = form2;
        console.log(form2, validForm);
        if (isAdding) {
          const r2 = await BApi$1.downloadTask.addDownloadTask(validForm);
          if (r2.code) {
            throw new Error(r2.message);
          }
        } else {
          const r2 = await BApi$1.downloadTask.putDownloadTask(id2, validForm);
          if (r2.code) {
            throw new Error(r2.message);
          }
        }
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          "div",
          {
            className: "grid gap-2 items-center",
            style: { gridTemplateColumns: "auto 1fr" },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Site") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(button_group_default, { size: "sm", children: availableThirdParties.map((thirdParty) => {
                const isSelected = form2.thirdPartyId === thirdParty.id;
                const isDeveloping = isThirdPartyDeveloping(thirdParty.id);
                return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                  Button,
                  {
                    color: isSelected ? "primary" : void 0,
                    isDisabled: !isAdding,
                    onPress: () => {
                      if (form2.thirdPartyId !== thirdParty.id) {
                        setForm({
                          thirdPartyId: thirdParty.id,
                          type: void 0
                          // Reset task type when changing third party
                        });
                      }
                    },
                    children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(ThirdPartyIcon, { thirdPartyId: thirdParty.id }),
                      t2(thirdParty.name),
                      isDeveloping && /* @__PURE__ */ jsxRuntimeExports.jsx(DevelopingChip, { size: "sm" })
                    ]
                  }
                );
              }) }) }),
              form2.thirdPartyId && (availableTaskTypes.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Task type") }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(button_group_default, { size: "sm", children: availableTaskTypes.map((taskType) => {
                  var _a2;
                  const isSelected = form2.type === taskType.value;
                  const Icon2 = (_a2 = DownloadTaskTypeIconMap[form2.thirdPartyId]) == null ? void 0 : _a2[taskType.value];
                  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                    Button,
                    {
                      color: isSelected ? "primary" : void 0,
                      isDisabled: !isAdding,
                      title: taskType.description,
                      onPress: () => {
                        if (!isSelected) {
                          setForm({
                            ...form2,
                            type: taskType.value
                          });
                        }
                      },
                      children: [
                        Icon2 && /* @__PURE__ */ jsxRuntimeExports.jsx(Icon2, { className: "text-base" }),
                        t2(taskType.label)
                      ]
                    },
                    taskType.value
                  );
                }) }) })
              ] }) : t2("Not available"))
            ]
          }
        ),
        form2.thirdPartyId && form2.type && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2", children: renderFields() })
      ]
    }
  ) });
};
const DownloaderPage = () => {
  const { t: t2 } = useTranslation();
  const forceUpdate = useUpdate();
  const [form2, setForm] = reactExports.useState({});
  const [downloaderDefinitions, setDownloaderDefinitions] = reactExports.useState([]);
  const tasks = useDownloadTasksStore((state) => state.tasks);
  const sortedThirdPartyIds = reactExports.useMemo(() => {
    const uniqueThirdParties = /* @__PURE__ */ new Map();
    downloaderDefinitions.forEach((def) => {
      if (!uniqueThirdParties.has(def.thirdPartyId)) {
        const thirdPartyName = ThirdPartyId[def.thirdPartyId] || def.name;
        uniqueThirdParties.set(def.thirdPartyId, thirdPartyName);
      }
    });
    return Array.from(uniqueThirdParties.entries()).map(([value2, label]) => ({ value: value2, label })).sort((a2, b2) => a2.value - b2.value);
  }, [downloaderDefinitions]);
  const [selectedTaskIds, setSelectedTaskIds] = reactExports.useState([]);
  const selectedTaskIdsRef = reactExports.useRef(selectedTaskIds);
  const selectionModeRef = reactExports.useRef(
    0
    /* Default */
  );
  const tasksRef = reactExports.useRef(tasks);
  const [menuProps, toggleMenu] = useMenuState();
  const { createPortal } = useBakabaseContext();
  const [taskListHeight, setTaskListHeight] = reactExports.useState(0);
  useTraceUpdate(
    {
      form: form2,
      tasks,
      selectedTaskIds,
      menuProps
    },
    "DownloaderPage"
  );
  log$3("Rendering");
  const startTasksManually = async (ids2, actionOnConflict = DownloadTaskActionOnConflict.NotSet) => {
    const rsp = await BApi$1.downloadTask.startDownloadTasks(
      {
        ids: ids2,
        actionOnConflict
      },
      {
        showErrorToast: (r2) => (r2.code >= 404 || r2.code < 200) && r2.code != ResponseCode.Conflict
      }
    );
    if (rsp.code == ResponseCode.Conflict) {
      createPortal(Modal, {
        defaultVisible: true,
        size: "lg",
        title: t2("Found some conflicted tasks"),
        children: rsp.message,
        footer: {
          actions: ["ok", "cancel"],
          okProps: {
            children: t2("Download selected tasks firstly")
          },
          cancelProps: {
            children: t2("Add selected tasks to the queue")
          }
        },
        onOk: async () => {
          return await BApi$1.downloadTask.startDownloadTasks({
            ids: ids2,
            actionOnConflict: DownloadTaskActionOnConflict.StopOthers
          });
        },
        onClose: async () => await BApi$1.downloadTask.startDownloadTasks({
          ids: ids2,
          actionOnConflict: DownloadTaskActionOnConflict.Ignore
        })
      });
    }
  };
  useUpdateEffect(() => {
    selectedTaskIdsRef.current = selectedTaskIds;
  }, [selectedTaskIds]);
  const contextMenuAnchorPointRef = reactExports.useRef({
    x: 0,
    y: 0
  });
  const renderContextMenu = reactExports.useCallback(() => {
    if (selectedTaskIdsRef.current.length == 0) {
      return;
    }
    const moreThanOne = selectedTaskIdsRef.current.length > 1;
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      ControlledMenu,
      {
        ...menuProps,
        anchorPoint: contextMenuAnchorPointRef.current,
        className: "downloader-page-context-menu",
        onClose: () => {
          toggleMenu(false);
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            MenuItem,
            {
              className: "flex items-center gap-2",
              onClick: () => {
                startTasksManually(selectedTaskIdsRef.current);
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(MdPlayCircle, {}),
                moreThanOne && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                  t2("Bulk"),
                  " "
                ] }),
                t2("Start")
              ]
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            MenuItem,
            {
              className: "flex items-center gap-2",
              onClick: () => BApi$1.downloadTask.stopDownloadTasks(selectedTaskIdsRef.current),
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(MdAccessTime, {}),
                moreThanOne && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                  t2("Bulk"),
                  " "
                ] }),
                t2("Stop")
              ]
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            MenuItem,
            {
              className: "flex items-center gap-2 danger",
              onClick: () => {
                createPortal(Modal, {
                  defaultVisible: true,
                  title: t2("Deleting {{count}} download tasks", {
                    count: selectedTaskIdsRef.current.length
                  }),
                  onOk: async () => {
                    await BApi$1.downloadTask.deleteDownloadTasks({
                      ids: selectedTaskIdsRef.current
                    });
                  }
                });
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(MdDelete, {}),
                moreThanOne && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                  t2("Bulk"),
                  " "
                ] }),
                t2("Delete")
              ]
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            MenuItem,
            {
              className: "flex items-center gap-2",
              onClick: () => {
                const ids2 = selectedTaskIdsRef.current;
                createPortal(Modal, {
                  defaultVisible: true,
                  title: t2(
                    ids2.length > 1 ? "Clear checkpoints for {{count}} tasks" : "Clear checkpoint",
                    { count: ids2.length }
                  ),
                  onOk: async () => {
                    await BApi$1.request({
                      path: "/download-task/checkpoint",
                      method: "DELETE",
                      body: ids2,
                      type: "application/json",
                      format: "json"
                    });
                  }
                });
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineWarning, {}),
                moreThanOne && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                  t2("Bulk"),
                  " "
                ] }),
                t2("Clear checkpoints")
              ]
            }
          )
        ]
      }
    );
  }, [menuProps]);
  reactExports.useEffect(() => {
    tasksRef.current = tasks;
  }, [tasks]);
  reactExports.useEffect(() => {
    const loadDownloaderDefinitions = async () => {
      try {
        const response = await BApi$1.downloadTask.getAllDownloaderDefinitions();
        setDownloaderDefinitions(response.data || []);
      } catch (error2) {
        console.error("Failed to load downloader definitions:", error2);
      }
    };
    loadDownloaderDefinitions();
  }, []);
  console.log(selectedTaskIdsRef.current, SelectionMode[selectionModeRef.current]);
  const onTaskClick = (taskId, e2) => {
    const nextMode = e2 ? e2.shiftKey ? 2 : e2.ctrlKey || e2.metaKey ? 1 : 0 : 0;
    selectionModeRef.current = nextMode;
    console.log(SelectionMode[selectionModeRef.current]);
    switch (selectionModeRef.current) {
      case 0:
        if (selectedTaskIdsRef.current.includes(taskId) && selectedTaskIdsRef.current.length == 1) {
          setSelectedTaskIds([]);
        } else {
          setSelectedTaskIds([taskId]);
        }
        break;
      case 1:
        if (selectedTaskIdsRef.current.includes(taskId)) {
          setSelectedTaskIds(selectedTaskIdsRef.current.filter((id2) => id2 != taskId));
        } else {
          setSelectedTaskIds([...selectedTaskIdsRef.current, taskId]);
        }
        break;
      case 2:
        if (selectedTaskIdsRef.current.length == 0) {
          setSelectedTaskIds([taskId]);
        } else {
          const lastSelectedTaskId = selectedTaskIdsRef.current[selectedTaskIds.length - 1];
          const lastSelectedTaskIndex = filteredTasks.findIndex((t22) => t22.id == lastSelectedTaskId);
          const currentTaskIndex = filteredTasks.findIndex((t22) => t22.id == taskId);
          const start2 = Math.min(lastSelectedTaskIndex, currentTaskIndex);
          const end2 = Math.max(lastSelectedTaskIndex, currentTaskIndex);
          setSelectedTaskIds(filteredTasks.slice(start2, end2 + 1).map((t22) => t22.id));
        }
        break;
    }
  };
  const taskFilters = [];
  if (form2.thirdPartyIds && form2.thirdPartyIds.length > 0) {
    taskFilters.push((t22) => form2.thirdPartyIds.includes(t22.thirdPartyId));
  }
  if (form2.statuses && form2.statuses.length > 0) {
    taskFilters.push((t22) => form2.statuses.includes(t22.status));
  }
  if (form2.keyword != void 0 && form2.keyword.length > 0) {
    const lowerCaseKeyword = form2.keyword.toLowerCase();
    taskFilters.push(
      (t22) => {
        var _a2;
        return ((_a2 = t22.name) == null ? void 0 : _a2.toLowerCase().includes(lowerCaseKeyword)) || t22.key.toLowerCase().includes(lowerCaseKeyword);
      }
    );
  }
  const filteredTasks = tasks.filter((x2) => taskFilters.every((f2) => f2(x2)));
  console.log(form2, filteredTasks);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col gap-1", children: [
    renderContextMenu(),
    /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        className: "grid gap-x-4 gap-y-1 items-center",
        style: { gridTemplateColumns: "auto 1fr" },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Source") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(button_group_default, { size: "sm", children: sortedThirdPartyIds.map((s2) => {
            var _a2;
            const count = tasks.filter((t22) => t22.thirdPartyId == s2.value).length;
            const isDeveloping = isThirdPartyDeveloping(s2.value);
            const isSelected = (_a2 = form2.thirdPartyIds) == null ? void 0 : _a2.some((a2) => a2 == s2.value);
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                variant: isSelected ? "solid" : "flat",
                onPress: () => {
                  let thirdPartyIds = form2.thirdPartyIds || [];
                  if (isSelected) {
                    thirdPartyIds = thirdPartyIds.filter((a2) => a2 != s2.value);
                  } else {
                    thirdPartyIds.push(s2.value);
                  }
                  setForm({
                    ...form2,
                    thirdPartyIds
                  });
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(ThirdPartyIcon, { thirdPartyId: s2.value }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: s2.label }),
                  isDeveloping && /* @__PURE__ */ jsxRuntimeExports.jsx(DevelopingChip, { showTooltip: false, size: "sm" }),
                  count > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "flat", children: count })
                ] })
              },
              s2.value
            );
          }) }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Status") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(button_group_default, { size: "sm", children: downloadTaskStatuses.map((s2) => {
            var _a2;
            const count = tasks.filter((t22) => t22.status == s2.value).length;
            const chipColor = DownloadTaskStatusIceLabelStatusMap[s2.value];
            const isSelected = (_a2 = form2.statuses) == null ? void 0 : _a2.some((a2) => a2 == s2.value);
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                variant: isSelected ? "solid" : "flat",
                onPress: () => {
                  let statuses = form2.statuses || [];
                  if (isSelected) {
                    statuses = statuses.filter((a2) => a2 != s2.value);
                  } else {
                    statuses.push(s2.value);
                  }
                  setForm({
                    ...form2,
                    statuses
                  });
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { color: isSelected ? "default" : chipColor, size: "sm", variant: "light", children: [
                  t2(s2.label),
                  count > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
                    " (",
                    count,
                    ")"
                  ] })
                ] }) })
              },
              s2.value
            );
          }) }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Keyword") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              className: "w-[320px]",
              fullWidth: false,
              size: "sm",
              startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSearch, { className: "text-base" }),
              onValueChange: (keyword) => setForm({
                ...form2,
                keyword
              })
            }
          ) })
        ]
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            size: "small",
            onPress: () => {
              createPortal(DownloadTaskDetailModal, {});
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-base" }),
              t2("Create task")
            ] })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "success",
            size: "small",
            variant: "flat",
            onPress: () => {
              startTasksManually([], DownloadTaskActionOnConflict.Ignore);
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlayCircle, { className: "text-base" }),
              t2("Start all")
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "warning",
            size: "small",
            variant: "flat",
            onPress: () => {
              BApi$1.downloadTask.stopDownloadTasks([]);
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineStop, { className: "text-base" }),
              t2("Stop all")
            ]
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { size: "sm", variant: "flat", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-base" }),
            t2("Cleanup")
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            dropdown_menu_default,
            {
              onAction: (key) => {
                switch (key) {
                  case "delete_completed": {
                    const ids2 = tasks.filter((t22) => t22.status == DownloadTaskStatus.Complete).map((t22) => t22.id);
                    if (ids2.length === 0)
                      return;
                    createPortal(Modal, {
                      defaultVisible: true,
                      title: t2("Deleting {{count}} download tasks", { count: ids2.length }),
                      onOk: async () => {
                        await BApi$1.downloadTask.deleteDownloadTasks({ ids: ids2 });
                      }
                    });
                    break;
                  }
                  case "delete_failed": {
                    const ids2 = tasks.filter((t22) => t22.status == DownloadTaskStatus.Failed).map((t22) => t22.id);
                    if (ids2.length === 0)
                      return;
                    createPortal(Modal, {
                      defaultVisible: true,
                      title: t2("Deleting {{count}} download tasks", { count: ids2.length }),
                      onOk: async () => {
                        await BApi$1.downloadTask.deleteDownloadTasks({ ids: ids2 });
                      }
                    });
                    break;
                  }
                }
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  menu_item_base_default,
                  {
                    startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-base" }),
                    children: t2("Delete all completed tasks")
                  },
                  "delete_completed"
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  menu_item_base_default,
                  {
                    color: "danger",
                    startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-base" }),
                    children: t2("Delete all failed tasks")
                  },
                  "delete_failed"
                )
              ]
            }
          )
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(RequestStatistics, {}),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            size: "sm",
            variant: "flat",
            onPress: () => {
              BApi$1.gui.openUrlInDefaultBrowser({
                url: `${envConfig.apiEndpoint}/download-task/xlsx`
              });
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineExport, { className: "text-base" }),
              t2("Export all tasks")
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "secondary",
            size: "small",
            variant: "flat",
            onPress: () => {
              createPortal(ConfigurationsModal, {});
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSetting, { className: "text-base" }),
              t2("Configurations")
            ]
          }
        )
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        ref: (r2) => {
          if (r2 && taskListHeight == 0) {
            setTaskListHeight(r2.clientHeight);
          }
        },
        className: "grow overflow-hidden",
        children: taskListHeight > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
          listbox_default,
          {
            isVirtualized: true,
            className: "p-0",
            emptyContent: t2("No tasks found"),
            label: "Select from 1000 items",
            variant: "flat",
            virtualization: {
              maxListboxHeight: taskListHeight,
              itemHeight: 75
            },
            children: filteredTasks.map((task) => {
              var _a2, _b2;
              const hasErrorMessage = task.status == DownloadTaskStatus.Failed && task.message;
              const selected = selectedTaskIds.indexOf(task.id) > -1;
              const Icon2 = (_a2 = DownloadTaskTypeIconMap[task.thirdPartyId]) == null ? void 0 : _a2[task.type];
              log$3("rendering task", task);
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                listbox_item_base_default,
                {
                  className: `${selected ? "bg-primary-50 dark:bg-primary-900/20" : ""}`,
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                    "div",
                    {
                      onContextMenu: (e2) => {
                        console.log(`Opening context menu from ${task.id}:${task.name}`);
                        e2.preventDefault();
                        if (!selectedTaskIdsRef.current.includes(task.id)) {
                          setSelectedTaskIds([task.id]);
                        }
                        contextMenuAnchorPointRef.current = {
                          x: e2.clientX,
                          y: e2.clientY
                        };
                        toggleMenu(true);
                        forceUpdate();
                      },
                      className: `flex flex-col gap-1`,
                      onClick: (e2) => onTaskClick(task.id, e2),
                      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx(ThirdPartyIcon, { thirdPartyId: task.thirdPartyId }),
                            Icon2 && /* @__PURE__ */ jsxRuntimeExports.jsx(Icon2, { className: "text-base" }),
                            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-lg", children: task.name ?? task.key })
                          ] }),
                          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "opacity-60", children: task.name && task.key }),
                            task.nextStartDt && /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { color: "default", size: "sm", children: [
                              t2("Next start time"),
                              ":",
                              hooks(task.nextStartDt).format("YYYY-MM-DD HH:mm:ss")
                            ] })
                          ] })
                        ] }),
                        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mr-8 flex items-center gap-2", children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsxs(
                              Chip,
                              {
                                color: DownloadTaskStatusIceLabelStatusMap[task.status],
                                variant: "light",
                                children: [
                                  t2(DownloadTaskStatus[task.status]),
                                  task.current
                                ]
                              }
                            ),
                            task.status == DownloadTaskStatus.Failed && /* @__PURE__ */ jsxRuntimeExports.jsxs(
                              Button,
                              {
                                isIconOnly: true,
                                color: "danger",
                                variant: "light",
                                onPress: () => {
                                  if (hasErrorMessage) {
                                    createPortal(Modal, {
                                      defaultVisible: true,
                                      size: "xl",
                                      title: t2("Error"),
                                      children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: task.message })
                                    });
                                  }
                                },
                                children: [
                                  /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineWarning, { className: "text-base" }),
                                  task.failureTimes
                                ]
                              }
                            ),
                            /* @__PURE__ */ jsxRuntimeExports.jsx(
                              circular_progress_default,
                              {
                                disableAnimation: true,
                                showValueLabel: true,
                                color: DownloadTaskStatusProgressBarColorMap[task.status],
                                size: "lg",
                                value: task.progress
                              }
                            )
                          ] }),
                          (_b2 = task.availableActions) == null ? void 0 : _b2.map((a2) => {
                            switch (a2) {
                              case DownloadTaskAction.StartManually:
                              case DownloadTaskAction.Restart:
                                return /* @__PURE__ */ jsxRuntimeExports.jsx(
                                  Button,
                                  {
                                    isIconOnly: true,
                                    size: "sm",
                                    variant: "light",
                                    onPress: () => {
                                      startTasksManually([task.id]);
                                    },
                                    children: a2 == DownloadTaskAction.Restart ? /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineRedo, { className: "text-lg" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlayCircle, { className: "text-lg" })
                                  },
                                  `start-${task.id}-${a2}`
                                );
                              case DownloadTaskAction.Disable:
                                return /* @__PURE__ */ jsxRuntimeExports.jsx(
                                  Button,
                                  {
                                    isIconOnly: true,
                                    size: "sm",
                                    variant: "light",
                                    onPress: () => {
                                      BApi$1.downloadTask.stopDownloadTasks([task.id]);
                                    },
                                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineStop, { className: "text-lg" })
                                  },
                                  `stop-${task.id}-${a2}`
                                );
                            }
                            return;
                          }),
                          /* @__PURE__ */ jsxRuntimeExports.jsx(
                            Button,
                            {
                              isIconOnly: true,
                              size: "sm",
                              variant: "light",
                              onPress: () => {
                                createPortal(DownloadTaskDetailModal, {
                                  id: task.id
                                });
                              },
                              children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-lg" })
                            }
                          ),
                          /* @__PURE__ */ jsxRuntimeExports.jsx(
                            Button,
                            {
                              isIconOnly: true,
                              size: "sm",
                              variant: "light",
                              onPress: () => {
                                BApi$1.tool.openFileOrDirectory({
                                  path: task.downloadPath
                                });
                              },
                              children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolderOpen, { className: "text-lg" })
                            }
                          ),
                          /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEllipsis, { className: "text-lg" }) }) }),
                            /* @__PURE__ */ jsxRuntimeExports.jsx(
                              dropdown_menu_default,
                              {
                                onAction: (key) => {
                                  switch (key) {
                                    case "delete":
                                      createPortal(Modal, {
                                        defaultVisible: true,
                                        title: t2("Are you sure to delete it?"),
                                        onOk: () => BApi$1.downloadTask.deleteDownloadTasks({
                                          ids: [task.id]
                                        })
                                      });
                                      break;
                                  }
                                },
                                children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                                  menu_item_base_default,
                                  {
                                    color: "danger",
                                    startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-lg" }),
                                    children: t2("Delete")
                                  },
                                  "delete"
                                )
                              }
                            )
                          ] })
                        ] })
                      ] })
                    },
                    task.id
                  )
                },
                task.id
              );
            })
          }
        )
      }
    ),
    "ß"
  ] });
};
DownloaderPage.displayName = "DownloaderPage";
const DownloadTaskStatusIceLabelStatusMap = {
  [DownloadTaskStatus.Idle]: "default",
  [DownloadTaskStatus.InQueue]: "default",
  [DownloadTaskStatus.Downloading]: "primary",
  [DownloadTaskStatus.Failed]: "danger",
  [DownloadTaskStatus.Complete]: "success",
  [DownloadTaskStatus.Starting]: "warning",
  [DownloadTaskStatus.Stopping]: "warning",
  [DownloadTaskStatus.Disabled]: "default"
};
const DownloadTaskStatusProgressBarColorMap = {
  [DownloadTaskStatus.Idle]: "default",
  [DownloadTaskStatus.InQueue]: "default",
  [DownloadTaskStatus.Downloading]: "primary",
  [DownloadTaskStatus.Failed]: "danger",
  [DownloadTaskStatus.Complete]: "success",
  [DownloadTaskStatus.Starting]: "warning",
  [DownloadTaskStatus.Stopping]: "warning",
  [DownloadTaskStatus.Disabled]: "default"
};
var SelectionMode = /* @__PURE__ */ ((SelectionMode2) => {
  SelectionMode2[SelectionMode2["Default"] = 0] = "Default";
  SelectionMode2[SelectionMode2["Ctrl"] = 1] = "Ctrl";
  SelectionMode2[SelectionMode2["Shift"] = 2] = "Shift";
  return SelectionMode2;
})(SelectionMode || {});
const log$3 = buildLogger("DownloadPage");
class Value {
  constructor() {
    __publicField(this, "delay");
    __publicField(this, "enabled", false);
    __publicField(this, "targets", []);
  }
}
const FileMoverPage = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const fsOptionsStore = useFileSystemOptionsStore();
  const [preferredTarget, setPreferredTarget] = reactExports.useState();
  const [preferredSource, setPreferredSource] = reactExports.useState();
  const value2 = fsOptionsStore.data.fileMover ?? new Value();
  const [quickEditModeData, setQuickEditModeData] = reactExports.useState();
  const progresses = useFileMovingProgressesStore((state) => state.progresses);
  reactExports.useEffect(() => {
  }, []);
  const save = (patches = {}, cb2) => {
    const options = {
      ...value2 || {},
      ...patches || {}
    };
    fsOptionsStore.patch({
      // @ts-ignore
      fileMover: options
    }).then(() => {
      toast.success(t2("Saved"));
      cb2 && cb2();
    });
  };
  const addTarget = (targetPath, cb2 = () => {
  }) => {
    if (!targets.some((t22) => t22.path == targetPath)) {
      targets.push({
        path: targetPath,
        sources: [],
        overwrite: false
      });
      save(
        {
          targets
        },
        () => {
          setPreferredTarget(targetPath);
          cb2();
        }
      );
    }
  };
  const updateTarget = (targetPath, newTargetPath, cb2 = () => {
  }) => {
    const targetIndex = targets.findIndex((a2) => a2.path == targetPath);
    const target = targets[targetIndex];
    target.path = newTargetPath;
    targets.splice(targetIndex, 1, target);
    save(
      {
        targets
      },
      () => {
        setPreferredTarget(targetPath);
        cb2();
      }
    );
  };
  const addSource = (targetPath, sourcePath) => {
    const target = targets.find((a2) => a2.path == targetPath);
    console.log("Adding source:", { targetPath, sourcePath, target });
    if (!target.sources) {
      target.sources = [];
    }
    if (target.sources.indexOf(sourcePath) == -1) {
      target.sources.push(sourcePath);
      console.log("Source added, new sources:", target.sources);
      save(
        {
          targets
        },
        () => {
          setPreferredSource(sourcePath);
        }
      );
    } else {
      console.log("Source already exists");
      setPreferredTarget(targetPath);
    }
  };
  const updateSource = (targetPath, sourcePath, newSourcePath) => {
    const target = targets.find((a2) => a2.path == targetPath);
    if (!target || !target.sources)
      return;
    const idx = target.sources.indexOf(sourcePath);
    if (idx > -1) {
      if (target.sources.indexOf(newSourcePath) == -1) {
        target.sources[idx] = newSourcePath;
        save({
          targets
        });
      }
    } else {
      setPreferredSource(sourcePath);
    }
  };
  const { enabled = false, targets = [] } = value2;
  const ds = (targets ?? []).reduce((s2, t22) => {
    const sources = (t22.sources || []).slice();
    const newArr = sources.map((x2, i2) => ({
      target: t22.path,
      rowSpan: i2 == 0 ? sources.length : void 0,
      source: x2,
      overwrite: t22.overwrite
    }));
    if (sources.length == 0) {
      newArr.push({
        target: t22.path,
        rowSpan: void 0,
        source: "",
        overwrite: false
      });
    }
    newArr.sort((a2, b2) => {
      return (a2.source == preferredSource ? -1 : 0) - (b2.source == preferredSource ? -1 : 0);
    });
    if (t22.path == preferredTarget) {
      return newArr.concat(s2);
    } else {
      return s2.concat(newArr);
    }
  }, []) || [];
  ds.splice(0, 0, {
    target: "",
    rowSpan: 1,
    source: "",
    overwrite: false
  });
  const renderCommonOperations = (path) => {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        isIconOnly: true,
        size: "sm",
        variant: "light",
        onPress: () => {
          BApi$1.tool.openFileOrDirectory({
            path
          });
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$G, { className: "text-base" })
      }
    ) });
  };
  const setOverwrite = (targetPath, overwrite) => {
    const targetIndex = targets.findIndex((a2) => a2.path == targetPath);
    const target = targets[targetIndex];
    target.overwrite = overwrite;
    targets.splice(targetIndex, 1, target);
    save({
      targets
    });
  };
  const renderQuickEditMode = () => {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isCompact: true, removeWrapper: true, className: "quick-edit-mode-table", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Target") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { align: "center", width: 90, children: t2("Moving direction") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Source") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: (quickEditModeData == null ? void 0 : quickEditModeData.map((row, i2) => {
        var _a2;
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: i2 === quickEditModeData.length - 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              size: "sm",
              onPress: () => {
                quickEditModeData == null ? void 0 : quickEditModeData.splice(i2, 0, {});
                setQuickEditModeData([...quickEditModeData]);
              },
              children: t2("Add")
            }
          ) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "target", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                placeholder: t2("Target path"),
                value: row.path,
                onValueChange: (v2) => {
                  quickEditModeData[i2].path = v2;
                  setQuickEditModeData([...quickEditModeData]);
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                color: "danger",
                size: "sm",
                variant: "light",
                onPress: () => {
                  quickEditModeData.splice(i2, 1);
                  setQuickEditModeData([...quickEditModeData]);
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" })
              }
            )
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { align: "center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatedArrow, { direction: "left" }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: i2 === quickEditModeData.length - 1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
            textarea_default,
            {
              maxRows: 100,
              minRows: 2,
              placeholder: t2("One path per line"),
              size: "sm",
              style: { width: "100%" },
              value: (_a2 = row.sources) == null ? void 0 : _a2.join("\n"),
              onValueChange: (v2) => {
                quickEditModeData[i2].sources = v2.split("\n");
                setQuickEditModeData([...quickEditModeData]);
              }
            }
          ) })
        ] }, i2);
      })) || [] })
    ] });
  };
  const renderNormalEditMode = () => {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isCompact: true, removeWrapper: true, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Target") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { align: "center", width: 90, children: t2("Moving direction") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Source") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: ds.map((record, i2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { rowSpan: record.rowSpan, children: (() => {
          const target = record.target;
          return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "target", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "left", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", size: "sm", variant: "light", children: target || t2("Add target path") }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_menu_default, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  menu_item_base_default,
                  {
                    startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(MdFolder, { className: "text-base" }),
                    onPress: () => {
                      createPortal(FileSystemSelectorModal, {
                        targetType: "folder",
                        onSelected: (e2) => {
                          if (!target) {
                            addTarget(e2.path);
                          } else {
                            updateTarget(target, e2.path);
                          }
                        },
                        defaultSelectedPath: target ?? null
                      });
                    },
                    children: t2("Select from file system")
                  },
                  "select-from-file-system"
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  menu_item_base_default,
                  {
                    startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineProduct, { className: "text-base" }),
                    onPress: () => {
                      createPortal(MediaLibraryPathSelectorV2, {
                        onSelect: (id2, path, isLegacyMediaLibrary) => {
                          if (!target) {
                            addTarget(path);
                          } else {
                            updateTarget(target, path);
                          }
                        }
                      });
                    },
                    children: t2("Select from media library")
                  },
                  "select-from-media-library"
                )
              ] })
            ] }) }),
            target && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Overwrite files in target path"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                checkbox_default,
                {
                  isSelected: record.overwrite,
                  size: "sm",
                  onValueChange: (v2) => setOverwrite(target, v2),
                  children: t2("Overwrite")
                }
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                FileSystemSelectorButton,
                {
                  isIconOnly: true,
                  fileSystemSelectorProps: {
                    onSelected: (e2) => {
                      addSource(target, e2.path);
                    }
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$m, { className: "text-base" })
                }
              ),
              renderCommonOperations(target),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  color: "danger",
                  size: "sm",
                  variant: "light",
                  onPress: () => {
                    createPortal(Modal, {
                      defaultVisible: true,
                      title: t2("Sure to remove?"),
                      footer: {
                        actions: ["cancel", "ok"]
                      },
                      onOk: () => new Promise((resolve2, reject) => {
                        save(
                          {
                            targets: targets.filter((a2) => a2.path != target)
                          },
                          () => {
                            resolve2(void 0);
                          }
                        );
                      })
                    });
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" })
                }
              )
            ] })
          ] });
        })() }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { align: "center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatedArrow, { direction: "left" }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: i2 > 0 && (() => {
          const s2 = record.source;
          const progress2 = progresses[s2];
          return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "source", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "left", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                FileSystemSelectorButton,
                {
                  fileSystemSelectorProps: {
                    targetType: "folder",
                    onSelected: (e2) => {
                      if (!s2) {
                        addSource(record.target, e2.path);
                      } else {
                        updateSource(record.target, s2, e2.path);
                      }
                    },
                    defaultSelectedPath: record.source
                  }
                }
              ),
              progress2 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "status", children: [
                progress2.error && /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    isIconOnly: true,
                    color: "danger",
                    size: "sm",
                    variant: "light",
                    onPress: () => {
                      createPortal(Modal, {
                        defaultVisible: true,
                        title: t2("Error"),
                        size: "lg",
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: progress2.error }),
                        footer: {
                          actions: ["ok"]
                        }
                      });
                    },
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdWarning, { className: "text-base" })
                  }
                ),
                progress2.moving && /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { type: "loading" }),
                progress2.percentage > 0 && progress2.percentage < 100 && `${progress2.percentage}%`,
                progress2.percentage == 100 && /* @__PURE__ */ jsxRuntimeExports.jsx(
                  MdFolder,
                  {
                    style: {
                      color: "var(--theme-color-success)"
                    }
                  }
                )
              ] })
            ] }),
            s2 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              renderCommonOperations(s2),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  color: "danger",
                  size: "sm",
                  variant: "light",
                  onPress: () => {
                    createPortal(Modal, {
                      defaultVisible: true,
                      title: t2("Sure to remove?"),
                      footer: {
                        actions: ["cancel", "ok"]
                      },
                      onOk: () => new Promise((resolve2, reject) => {
                        var _a2;
                        const { target: targetPath } = record;
                        const target = targets.find((t22) => t22.path == targetPath);
                        if (target) {
                          target.sources = (_a2 = target.sources) == null ? void 0 : _a2.filter((a2) => a2 != s2);
                        }
                        save(
                          {
                            targets
                          },
                          () => {
                            resolve2(void 0);
                          }
                        );
                      })
                    });
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" })
                }
              )
            ] })
          ] });
        })() })
      ] }, i2)) })
    ] });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "file-mover", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "opt", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "left", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "enable", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label", children: t2(enabled ? "Enabled" : "Disabled") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            switch_default,
            {
              isSelected: enabled,
              size: "sm",
              onValueChange: (c2) => {
                save({
                  enabled: c2
                });
              }
            }
          )
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          TimeInput,
          {
            description: t2(
              "Files or directories will be moved after the delayed time from the time they are created here. The delay is working for the first layer entries only."
            ),
            label: t2("Delay (minutes)"),
            value: (value2 == null ? void 0 : value2.delay) ? dayjs.duration(hooks.duration(value2.delay).asMilliseconds()) : void 0,
            onChange: (c2) => {
              save({
                delay: (c2 == null ? void 0 : c2.format) && typeof c2.format === "function" ? c2.format("HH:mm:ss") : c2 ?? "00:05:00"
              });
            }
          }
        ) })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "right", children: [
        quickEditModeData && /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            size: "sm",
            onPress: () => {
              const newTargets = quickEditModeData == null ? void 0 : quickEditModeData.filter((d2) => !!d2.path);
              for (const nt of newTargets) {
                if (nt.sources) {
                  nt.sources = nt.sources.filter((s2) => !!s2);
                }
              }
              save(
                {
                  targets: newTargets
                },
                () => {
                  setQuickEditModeData(void 0);
                }
              );
            },
            children: t2("Save")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            size: "sm",
            onPress: () => {
              if (quickEditModeData) {
                setQuickEditModeData(void 0);
              } else {
                const newData = JSON.parse(JSON.stringify(targets));
                newData.push({});
                setQuickEditModeData(newData);
              }
            },
            children: quickEditModeData ? t2("Back to normal edit mode") : t2("Quick edit mode")
          }
        )
      ] })
    ] }),
    quickEditModeData ? renderQuickEditMode() : renderNormalEditMode()
  ] });
};
FileMoverPage.displayName = "FileMoverPage";
const FileNameModifierPage = () => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(FileNameModifier, { initialFilePaths: [] }) });
};
const ThirdPartyIntegrationPage = () => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    accordion_default,
    {
      defaultSelectedKeys: "all",
      selectionMode: "multiple",
      variant: "splitted",
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(accordion_item_base_default, { title: "SoulPlus", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Tampermonkey script") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs(
              Button,
              {
                color: "primary",
                variant: "light",
                onPress: () => {
                  BApi$1.tampermonkey.installTampermonkeyScript({
                    script: TampermonkeyScript.SoulPlus
                  });
                },
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(GrInstallOption, { className: "text-base" }),
                  t2("One-click installation")
                ]
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            alert_default,
            {
              color: "default",
              variant: "flat",
              title: t2("This script modifies some interactive behaviors of the target website. You can manually enable or disable the script in Tampermonkey."),
              description: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                "1. ",
                t2("Left-clicking on covers or post titles will trigger the creation of a post parsing task on Bakabase. You can still use the middle button to open posts.")
              ] }) })
            }
          )
        ] }) }, "SoulPlus"),
        /* @__PURE__ */ jsxRuntimeExports.jsx(accordion_item_base_default, { title: "ExHentai", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Tampermonkey script") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs(
              Button,
              {
                color: "primary",
                variant: "light",
                onPress: () => {
                  BApi$1.tampermonkey.installTampermonkeyScript({
                    script: TampermonkeyScript.ExHentai
                  });
                },
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(GrInstallOption, { className: "text-base" }),
                  t2("One-click installation")
                ]
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            alert_default,
            {
              color: "default",
              variant: "flat",
              title: t2("This script modifies some interactive behaviors of the target website. You can manually enable or disable the script in Tampermonkey."),
              description: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                "1. ",
                t2("Left-clicking on covers will trigger the creation of a torrent download task on Bakabase. You can still use the middle button to open posts.")
              ] }) })
            }
          )
        ] }) }, "ExHentai")
      ]
    }
  );
};
ThirdPartyIntegrationPage.displayName = "ThirdPartyIntegrationPage";
const ConfigurationModal = (props) => {
  const { t: t2 } = useTranslation();
  const soulPlusOptions = useSoulPlusOptionsStore((state) => state.data);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel"]
      },
      size: "xl",
      onDestroyed: props.onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tabs, { isVertical: true, "aria-label": "Options", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tab, { title: t2("SoulPlus"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          EditableValue,
          {
            Editor: textarea_default,
            Viewer: textarea_default,
            description: t2(
              "Cookie is used to access SoulPlus posts."
            ),
            label: t2("Cookie"),
            value: soulPlusOptions.cookie,
            onSubmit: async (v2) => {
              await BApi$1.options.patchSoulPlusOptions({
                cookie: v2
              });
            }
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          EditableValue,
          {
            Editor: number_input_default,
            Viewer: number_input_default,
            description: t2(
              "Items priced below this value will be bought automatically."
            ),
            editorProps: {
              min: 0,
              formatOptions: { useGrouping: false },
              hideStepper: true
            },
            label: t2("Auto buy threshold"),
            value: soulPlusOptions.autoBuyThreshold,
            viewerProps: {
              formatOptions: { useGrouping: false },
              hideStepper: true
            },
            onSubmit: async (v2) => {
              await BApi$1.options.patchSoulPlusOptions({
                autoBuyThreshold: v2
              });
            }
          }
        )
      ] }) }, "soulplus") })
    }
  );
};
ConfigurationModal.displayName = "ConfigurationModal";
const ThirdPartyMap = {
  [PostParserSource.SoulPlus]: ThirdPartyId.SoulPlus
};
const PostParserPage = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const thirdPartyOptions = useThirdPartyOptionsStore((state) => state.data);
  const tasks = usePostParserTasksStore((state) => state.tasks);
  reactExports.useEffect(() => {
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between items-center", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            onPress: () => {
              let linksTextMap = {};
              createPortal(Modal, {
                defaultVisible: true,
                size: "xl",
                title: t2("Add tasks"),
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                  postParserSources.map((s2) => {
                    return /* @__PURE__ */ jsxRuntimeExports.jsx(
                      textarea_default,
                      {
                        onValueChange: (v2) => {
                          linksTextMap[s2.value] = v2;
                        },
                        label: t2("Post links in {{source}}", { source: s2.label }),
                        minRows: 10,
                        placeholder: `https://xxxxxxx
https://xxxxxxx
...`
                      }
                    );
                  }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(FeatureStatusTip, { status: "developing", name: t2("Support for other sites") })
                ] }),
                onOk: async () => {
                  const linksMap = _$2.mapValues(linksTextMap, (value2) => value2.split("\n").map((x2) => x2.trim()).filter((x2) => x2));
                  await BApi$1.postParser.addPostParserTasks(linksMap);
                }
              });
            },
            size: "sm",
            color: "primary",
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-base" }),
              t2("Add tasks")
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            size: "sm",
            onPress: () => {
              createPortal(ConfigurationModal, {});
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSetting, { className: "text-base" }),
              t2("Configuration")
            ]
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          checkbox_default,
          {
            isSelected: thirdPartyOptions.automaticallyParsingPosts,
            onValueChange: async (v2) => {
              const r2 = await BApi$1.options.patchThirdPartyOptions({ automaticallyParsingPosts: v2 });
              if (v2 && !r2.code) {
                await BApi$1.postParser.startAllPostParserTasks();
              }
            },
            size: "sm",
            color: "secondary",
            children: t2("Automatically parsing")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "success",
            size: "sm",
            variant: "light",
            onPress: () => {
              createPortal(Modal, {
                defaultVisible: true,
                size: "xl",
                title: t2("Instructions for use"),
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    alert_default,
                    {
                      description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                          "This feature internally uses curl. If your system-level curl version is lower than 8.14, please configure the correct curl path in the system settings."
                        ) }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                          "The request interval configuration is temporarily unavailable. The built-in default interval is 3 seconds."
                        ) })
                      ] }),
                      title: t2("curl")
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    alert_default,
                    {
                      description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                          "This feature internally uses Ollama. You need to install and run Ollama first, and install at least one model. Then configure the Ollama API address in the system settings."
                        ) }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                          "This feature will prioritize the largest model in the Ollama model list."
                        ) }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                          "Currently, deepseek-r1:14b and 32b have been tested and can be used safely."
                        ) })
                      ] }),
                      title: t2("ollama")
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    alert_default,
                    {
                      color: "success",
                      description: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                        'Some sites can integrate quick actions through the browser (such as one-click task creation). You can check the "Third-Party Integrations" section.'
                      ) }) }),
                      title: t2("browser integrations"),
                      variant: "flat"
                    }
                  )
                ] }),
                footer: {
                  actions: ["cancel"]
                }
              });
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineQuestionCircle, { className: "text-base" }),
              t2("Instructions for use")
            ]
          }
        )
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isStriped: true, removeWrapper: true, className: "break-all", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("#") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Target") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Items") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("ParsedAt") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Operations") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: tasks.map((task) => {
        var _a2;
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: task.id }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: task.title ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                ThirdPartyIcon,
                {
                  thirdPartyId: ThirdPartyMap[task.source]
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: task.title })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "primary",
                size: "sm",
                variant: "light",
                onPress: (e2) => {
                  BApi$1.gui.openUrlInDefaultBrowser({
                    url: task.link
                  });
                },
                children: task.link
              }
            ) })
          ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              ThirdPartyIcon,
              {
                thirdPartyId: ThirdPartyMap[task.source]
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "primary",
                size: "sm",
                variant: "light",
                onPress: (e2) => {
                  BApi$1.gui.openUrlInDefaultBrowser({
                    url: task.link
                  });
                },
                children: task.link
              }
            ) })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: (_a2 = task.items) == null ? void 0 : _a2.map((item, idx) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsxs(React$5.Fragment, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
                item.link && /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    color: "primary",
                    size: "sm",
                    variant: "light",
                    onPress: (e2) => {
                      BApi$1.gui.openUrlInDefaultBrowser({
                        url: item.link
                      });
                    },
                    children: item.link
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                  item.accessCode && /* @__PURE__ */ jsxRuntimeExports.jsx(
                    snippet_default,
                    {
                      size: "sm",
                      symbol: t2("Access code"),
                      children: item.accessCode
                    }
                  ),
                  item.decompressionPassword && /* @__PURE__ */ jsxRuntimeExports.jsx(
                    snippet_default,
                    {
                      size: "sm",
                      symbol: t2("Decompression password")
                    }
                  )
                ] })
              ] }),
              idx < task.items.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {})
            ] }, idx);
          }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: task.parsedAt ? task.parsedAt : task.error ? /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "danger",
              size: "sm",
              variant: "light",
              onPress: () => {
                createPortal(Modal, {
                  defaultVisible: true,
                  size: "xl",
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: task.error }),
                  footer: {
                    actions: ["cancel"]
                  }
                });
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineWarning, { className: "text-base" })
            }
          ) : null }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "danger",
              size: "sm",
              variant: "light",
              onPress: async () => {
                await BApi$1.postParser.deletePostParserTask(task.id);
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-base" })
            }
          ) }) })
        ] });
      }) })
    ] }) })
  ] });
};
PostParserPage.displayName = "PostParserPage";
const Test = reactExports.lazy(() => __vitePreload(() => import("./index-y1bl1xYD.js"), true ? __vite__mapDeps([6,3,7]) : void 0));
const routesMenuConfig = [
  {
    name: "Dashboard",
    path: "/",
    component: DashboardPage,
    icon: AiOutlineDashboard,
    layout: "basic",
    menu: false
    // 首页不在菜单中
  },
  // {
  //   name: "Resource",
  //   path: "/resource",
  //   component: ResourcePage,
  //   icon: AiOutlinePicture,
  //   layout: "basic",
  //   menu: true,
  // },
  {
    name: "Resource",
    path: "/resource2",
    component: ResourcePage2,
    icon: AiOutlinePicture,
    layout: "basic",
    menu: true
  },
  {
    name: "Media library",
    path: "/media-library",
    component: MediaLibraryPage,
    icon: AiOutlineProduct,
    layout: "basic",
    menu: true
  },
  {
    name: "Media library template",
    path: "/media-library-template",
    component: MediaLibraryTemplatePage,
    icon: AiOutlineAppstoreAdd,
    layout: "basic",
    menu: true
  },
  {
    name: "Data",
    icon: AiOutlineDatabase,
    menu: true,
    children: [
      {
        name: "Synchronization options",
        path: "/synchronization-options",
        component: SynchronizationOptionsPage,
        icon: AiOutlineSync,
        layout: "basic",
        menu: true
      },
      {
        name: "Custom property",
        path: "/customproperty",
        component: CustomPropertyPage,
        icon: AiOutlineRadarChart,
        layout: "basic",
        menu: true
      },
      {
        name: "Extension group",
        path: "/extension-group",
        component: ExtensionGroupPage,
        icon: AiOutlineUngroup,
        layout: "basic",
        menu: true
      },
      {
        name: "Cache",
        path: "/cache",
        component: CachePage,
        icon: AiOutlineHdd,
        layout: "basic",
        menu: true
      },
      {
        name: "Alias",
        path: "/alias",
        component: AliasPage,
        icon: AiOutlineBranches,
        layout: "basic",
        menu: true
      },
      {
        name: "Special text",
        path: "/text",
        component: TextPage,
        icon: AiOutlineFieldString,
        layout: "basic",
        menu: true
      },
      {
        name: "Play history",
        path: "/play-history",
        component: PlayHistoryPage,
        icon: AiOutlineHistory,
        layout: "basic",
        menu: true
      },
      {
        name: "Bulk modification",
        path: "/bulk-modification2",
        component: BulkModification2Page,
        icon: AiOutlineForm,
        layout: "basic",
        menu: true,
        isBeta: true
      },
      {
        name: "Custom component",
        path: "/customcomponent",
        isDeprecated: true,
        component: CustomComponentPage,
        icon: AiOutlineControl,
        layout: "basic",
        menu: true
      },
      {
        name: "Media library",
        path: "/category",
        isDeprecated: true,
        component: CategoryPage,
        icon: AiOutlineProduct,
        layout: "basic",
        menu: true
      }
    ]
  },
  {
    name: "Tools",
    icon: AiOutlineTool,
    menu: true,
    children: [
      {
        name: "File Processor",
        path: "/file-processor",
        component: FileProcessorPage,
        icon: AiOutlineCode,
        layout: "basic",
        menu: true
      },
      {
        name: "Downloader",
        path: "/downloader",
        component: DownloaderPage,
        icon: AiOutlineDownload,
        layout: "basic",
        menu: true
      },
      {
        name: "File Mover",
        path: "/file-mover",
        component: FileMoverPage,
        icon: AiOutlineSwap,
        layout: "basic",
        menu: true
      },
      {
        name: "File name modifier",
        path: "/file-name-modifier",
        component: FileNameModifierPage,
        icon: AiOutlineEdit,
        layout: "basic",
        isBeta: true,
        menu: true
      },
      {
        name: "Migration",
        path: "/migration",
        // component: Migration,
        icon: AiOutlineExperiment,
        layout: "basic",
        menu: false
        // 不在菜单中
      }
    ]
  },
  {
    name: "Experimental",
    icon: AiOutlineExperiment,
    menu: true,
    children: [
      {
        name: "Third party integration",
        path: "/third-party-integration",
        component: ThirdPartyIntegrationPage,
        icon: TbToolsKitchen,
        layout: "basic",
        menu: true
      },
      {
        name: "Post parser",
        path: "/post-parser",
        component: PostParserPage,
        icon: MdOutlineArticle,
        layout: "basic",
        menu: true
      }
    ]
  },
  {
    name: "System",
    icon: AiOutlineSetting,
    menu: true,
    children: [
      {
        name: "Configuration",
        path: "/configuration",
        component: ConfigurationPage,
        icon: AiOutlineAppstore,
        layout: "basic",
        menu: true
      },
      {
        name: "Third party",
        path: "/third-party-configuration",
        component: ThirdPartyConfigurationPage,
        icon: TbToolsKitchen,
        layout: "basic",
        menu: true
      },
      {
        name: "Background Task",
        path: "/background-task",
        component: BackgroundTaskPage,
        icon: AiOutlineInteraction,
        layout: "basic",
        menu: true
      },
      {
        name: "Log",
        path: "/log",
        component: LogPage,
        icon: AiOutlineFileText,
        layout: "basic",
        menu: true
      }
    ]
  },
  {
    name: "Test",
    path: "/test",
    component: Test,
    icon: AiOutlineBug,
    layout: "basic",
    menu: false
  }
];
const insideWorld = "_insideWorld_wsqb0_1";
const main = "_main_wsqb0_7";
const styles$1 = {
  insideWorld,
  main
};
function extractMenu(config2) {
  return config2.filter((r2) => r2.menu !== false).map((r2) => {
    const item = {
      name: r2.name,
      path: r2.path,
      icon: r2.icon,
      isBeta: r2.isBeta,
      isDeprecated: r2.isDeprecated
    };
    if (r2.children)
      item.children = extractMenu(r2.children);
    return item;
  });
}
const asideMenuConfig = extractMenu(routesMenuConfig);
const Index = ({ collapsed: collapsed2 }) => {
  const { t: t2 } = useTranslation();
  const navigate = useNavigate();
  const { pathname } = useLocation();
  const onClick = (e2) => {
    navigate(e2.key);
  };
  function getItem(label, key, icon, children, type4) {
    return {
      key,
      icon,
      children,
      label,
      type: type4
    };
  }
  function convertItem(item) {
    var _a2;
    const Icon2 = item.icon ?? AiOutlineQuestionCircle;
    return getItem(
      collapsed2 ? t2(item.name) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-0.5", children: [
        t2(item.name),
        item.isBeta && /* @__PURE__ */ jsxRuntimeExports.jsx(BetaChip, {}),
        item.isDeprecated && /* @__PURE__ */ jsxRuntimeExports.jsx(DeprecatedChip, {})
      ] }),
      item.path,
      /* @__PURE__ */ jsxRuntimeExports.jsx(Icon2, { className: "!text-lg" }),
      (_a2 = item.children) == null ? void 0 : _a2.map(convertItem)
    );
  }
  const items = asideMenuConfig.map(convertItem);
  const defaultOpenKeysRef = reactExports.useRef(
    asideMenuConfig.filter((m2) => {
      var _a2;
      return (_a2 = m2.children) == null ? void 0 : _a2.some((c2) => pathname.includes(c2.path));
    }).map((m2) => m2.path)
  );
  const defaultSelectedKeysRef = reactExports.useRef([
    (() => {
      for (const m2 of asideMenuConfig) {
        if (m2.path === pathname) {
          return pathname;
        }
        for (const c2 of m2.children || []) {
          if (pathname.includes(c2.path)) {
            return c2.path;
          }
        }
      }
      return "";
    })()
  ]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Menu,
    {
      defaultOpenKeys: defaultOpenKeysRef.current,
      defaultSelectedKeys: defaultSelectedKeysRef.current,
      inlineCollapsed: collapsed2,
      inlineIndent: 12,
      mode: "inline",
      selectedKeys: [(() => {
        for (const m2 of asideMenuConfig) {
          if (m2.path === pathname) {
            return pathname;
          }
          for (const c2 of m2.children || []) {
            if (pathname.includes(c2.path)) {
              return c2.path;
            }
          }
        }
        return "";
      })()],
      style: {
        background: "none",
        border: "none",
        width: "100%"
      },
      onClick,
      forceSubMenuRender: true,
      items
    }
  );
};
const nav = "_nav_rpbvo_1";
const collapsed = "_collapsed_rpbvo_11";
const opts = "_opts_rpbvo_14";
const top = "_top_rpbvo_17";
const menu = "_menu_rpbvo_30";
const styles = {
  nav,
  collapsed,
  opts,
  top,
  menu
};
const OptIconStyle = { fontSize: 20 };
const Navigation = () => {
  const { t: t2 } = useTranslation();
  const { pathname } = useLocation();
  const appOptions = useAppOptionsStore((state) => state.data);
  const uiOptionsStore = useUiOptionsStore();
  const isDarkMode = appOptions.uiTheme == UiTheme.Dark;
  const isEnglish = appOptions.language == "en";
  const [loading, setLoading] = reactExports.useState(false);
  const prevPathRef = reactExports.useRef(pathname);
  const isCollapsed = uiOptionsStore.data.isMenuCollapsed;
  reactExports.useEffect(() => {
    if (pathname != prevPathRef.current) {
      setLoading(false);
      prevPathRef.current = pathname;
    }
  }, [pathname]);
  console.log("PageNav", pathname);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${styles.nav} ${isCollapsed ? `${styles.collapsed}` : ""}`, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.top, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Link$2, { to: "/", children: isCollapsed ? "B" : "Bakabase" }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.menu, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Index, { collapsed: isCollapsed }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "horizontal" }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.opts, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "default",
          variant: "light",
          onPress: () => {
            setLoading(true);
            BApi$1.options.patchAppOptions({
              uiTheme: isDarkMode ? UiTheme.Light : UiTheme.Dark
            }).then(() => {
              location.reload();
            });
          },
          children: isDarkMode ? /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$8, { style: OptIconStyle }) : /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$s, { style: OptIconStyle })
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "default",
          variant: "light",
          onPress: () => {
            setLoading(true);
            BApi$1.options.patchAppOptions({
              language: isEnglish ? "cn" : "en"
            }).then(() => {
              location.reload();
            });
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$4, { style: OptIconStyle })
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "default",
          variant: "light",
          onPress: () => {
            uiOptionsStore.patch({
              isMenuCollapsed: !isCollapsed
            });
          },
          children: isCollapsed ? /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$v, { style: OptIconStyle }) : /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$w, { style: OptIconStyle })
        }
      )
    ] })
  ] });
};
const AssistantStatus = {
  Idle: 0,
  Working: 1,
  AllDone: 2,
  Failed: 3
};
const ActionsFilter = {
  [
    1
    /* Start */
  ]: (task) => task.isPersistent && (task.status == BTaskStatus.Cancelled || task.status == BTaskStatus.Error || task.status == BTaskStatus.Completed || task.status == BTaskStatus.NotStarted),
  [
    2
    /* Pause */
  ]: (task) => task.status == BTaskStatus.Running,
  [
    3
    /* Resume */
  ]: (task) => task.status == BTaskStatus.Paused,
  [
    4
    /* Stop */
  ]: (task) => task.status == BTaskStatus.Running,
  [
    5
    /* Clean */
  ]: (task) => !task.isPersistent && (task.status == BTaskStatus.Completed || task.status == BTaskStatus.Error || task.status == BTaskStatus.Cancelled),
  [
    6
    /* Config */
  ]: (task) => task.isPersistent
};
const log$2 = buildLogger("FloatingAssistant");
const FloatingAssistant = () => {
  const [allDoneCircleDrawn, setAllDoneCircleDrawn] = reactExports.useState("");
  const [status, setStatus] = reactExports.useState(AssistantStatus.Working);
  const statusRef = reactExports.useRef(status);
  const [cleaningTaskId, setCleaningTaskId] = reactExports.useState();
  const [tasksVisible, setTasksVisible] = reactExports.useState(false);
  const [loadingTasks, setLoadingTasks] = reactExports.useState(/* @__PURE__ */ new Map());
  const { createPortal } = useBakabaseContext();
  const { t: t2 } = useTranslation();
  const portalRef = reactExports.useRef(null);
  const navigate = useNavigate();
  const bTasks = useBTasksStore((state) => state.tasks);
  const [nowTick, setNowTick] = reactExports.useState(Date.now());
  const simTimingRef = reactExports.useRef(/* @__PURE__ */ new Map());
  reactExports.useEffect(() => {
    const now2 = Date.now();
    const map2 = simTimingRef.current;
    const existingIds = new Set(map2.keys());
    bTasks.forEach((task) => {
      const rawElapsedMs = task.elapsed ? hooks.duration(task.elapsed).asMilliseconds() : void 0;
      const rawRemainingMs = task.estimateRemainingTime ? hooks.duration(task.estimateRemainingTime).asMilliseconds() : void 0;
      const rec = map2.get(task.id);
      if (!rec) {
        map2.set(task.id, {
          baseElapsedMs: rawElapsedMs,
          baseRemainingMs: rawRemainingMs,
          lastSeenAt: now2,
          lastStatus: task.status,
          lastRawElapsedMs: rawElapsedMs,
          lastRawRemainingMs: rawRemainingMs
        });
      } else {
        const incomingChanged = rec.lastRawElapsedMs !== rawElapsedMs || rec.lastRawRemainingMs !== rawRemainingMs;
        if (incomingChanged) {
          rec.baseElapsedMs = rawElapsedMs;
          rec.baseRemainingMs = rawRemainingMs;
          rec.lastSeenAt = now2;
          rec.lastRawElapsedMs = rawElapsedMs;
          rec.lastRawRemainingMs = rawRemainingMs;
          rec.lastStatus = task.status;
        } else if (task.status !== rec.lastStatus) {
          const delta = Math.max(0, now2 - rec.lastSeenAt);
          if (rec.lastStatus === BTaskStatus.Running) {
            rec.baseElapsedMs = (rec.baseElapsedMs ?? 0) + delta;
            if (rec.baseRemainingMs != null) {
              rec.baseRemainingMs = Math.max(0, rec.baseRemainingMs - delta);
            }
          }
          rec.lastSeenAt = now2;
          rec.lastStatus = task.status;
        }
      }
      existingIds.delete(task.id);
    });
    existingIds.forEach((id2) => map2.delete(id2));
  }, [bTasks]);
  const computeDisplayElapsedMs = (task) => {
    const rec = simTimingRef.current.get(task.id);
    const baseMs = rec == null ? void 0 : rec.baseElapsedMs;
    if (baseMs == null)
      return void 0;
    if (task.status === BTaskStatus.Running) {
      return baseMs + Math.max(0, Date.now() - ((rec == null ? void 0 : rec.lastSeenAt) ?? Date.now()));
    }
    return baseMs;
  };
  const computeDisplayRemainingMs = (task) => {
    const rec = simTimingRef.current.get(task.id);
    const baseMs = rec == null ? void 0 : rec.baseRemainingMs;
    if (baseMs == null)
      return void 0;
    if (task.status === BTaskStatus.Running) {
      const ms = baseMs - Math.max(0, Date.now() - ((rec == null ? void 0 : rec.lastSeenAt) ?? Date.now()));
      return Math.max(0, ms);
    }
    return baseMs;
  };
  const columns = reactExports.useRef(
    [
      {
        key: "name",
        label: "Task list"
      },
      {
        key: "status",
        label: "Status"
      },
      {
        key: "process",
        label: "Process"
      },
      {
        key: "progress",
        label: "Progress"
      },
      {
        key: "startedAt",
        label: "Started at"
      },
      {
        key: "elapsed",
        label: "Elapsed"
      },
      {
        key: "estimateRemainingTime",
        label: "Estimate remaining time"
      },
      {
        key: "nextTimeStartAt",
        label: "Next time start at"
      },
      {
        key: "operations",
        label: "Operations"
      }
    ].map((x2) => ({
      ...x2,
      label: t2(x2.label)
    }))
  );
  reactExports.useEffect(() => {
    statusRef.current = status;
  }, [status]);
  reactExports.useEffect(() => {
    log$2("Initializing...");
    const queryTask = setInterval(() => {
      const tempTasks = useBTasksStore.getState().tasks;
      let newStatus = AssistantStatus.AllDone;
      if (tempTasks.length > 0) {
        const ongoingTasks = tempTasks.filter(
          (a2) => a2.status == BTaskStatus.Running
        );
        if (ongoingTasks.length > 0) {
          newStatus = AssistantStatus.Working;
        } else {
          const failedTasks = tempTasks.filter(
            (a2) => a2.status == BTaskStatus.Error
          );
          if (failedTasks.length > 0) {
            newStatus = AssistantStatus.Failed;
          } else {
            const doneTasks = tempTasks.filter(
              (a2) => a2.status == BTaskStatus.Completed
            );
            if (doneTasks.length > 0) {
              newStatus = AssistantStatus.AllDone;
            }
          }
        }
      }
      if (newStatus != statusRef.current) {
        setStatus(newStatus);
        if (newStatus == AssistantStatus.AllDone) {
          setTimeout(() => {
            setAllDoneCircleDrawn("drawn");
          }, 300);
        }
      }
      setNowTick(Date.now());
    }, 1e3);
    return () => {
      log$2("Destroying...");
      clearInterval(queryTask);
    };
  }, []);
  const renderTaskStatus = (task) => {
    switch (task.status) {
      case BTaskStatus.NotStarted:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "warning", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1f, { className: "text-base" }) });
      case BTaskStatus.Cancelled:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "warning", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1j, { className: "text-base" }) });
      case BTaskStatus.Paused:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "warning", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$q, { className: "text-base" }) });
      case BTaskStatus.Error:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "danger",
            size: "sm",
            variant: "light",
            onPress: () => {
              if (task.error) {
                createPortal(Modal, {
                  defaultVisible: true,
                  size: "xl",
                  classNames: {
                    wrapper: "floating-assistant-modal"
                  },
                  title: t2("Error"),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: task.error }),
                  footer: {
                    actions: ["cancel"]
                  }
                });
              }
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, { className: "text-base" })
          }
        );
      case BTaskStatus.Running:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1i, { className: "text-base" }) });
      case BTaskStatus.Completed:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$10, { className: "text-base" }) });
    }
  };
  const renderTaskOpts = (task) => {
    const opts2 = [];
    Object.keys(ActionsFilter).forEach((key) => {
      const filter3 = ActionsFilter[key];
      if (filter3 && filter3(task)) {
        const action = parseInt(key, 10);
        switch (action) {
          case 1:
            opts2.push(
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  color: "secondary",
                  size: "sm",
                  variant: "light",
                  isLoading: loadingTasks.get(task.id) === 1,
                  onPress: async () => {
                    setLoadingTasks(new Map(loadingTasks.set(
                      task.id,
                      1
                      /* Start */
                    )));
                    try {
                      await BApi$1.backgroundTask.startBackgroundTask(task.id);
                    } finally {
                      setLoadingTasks((prev2) => {
                        const next2 = new Map(prev2);
                        next2.delete(task.id);
                        return next2;
                      });
                    }
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$11, { className: "text-base" })
                },
                `start-${task.id}`
              )
            );
            break;
          case 2:
            opts2.push(
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  color: "warning",
                  size: "sm",
                  variant: "light",
                  isLoading: loadingTasks.get(task.id) === 2,
                  onPress: async () => {
                    setLoadingTasks(new Map(loadingTasks.set(
                      task.id,
                      2
                      /* Pause */
                    )));
                    try {
                      await BApi$1.backgroundTask.pauseBackgroundTask(task.id);
                    } finally {
                      setLoadingTasks((prev2) => {
                        const next2 = new Map(prev2);
                        next2.delete(task.id);
                        return next2;
                      });
                    }
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$p, { className: "text-base" })
                },
                `pause-${task.id}`
              )
            );
            break;
          case 3:
            opts2.push(
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  color: "secondary",
                  size: "sm",
                  variant: "light",
                  isLoading: loadingTasks.get(task.id) === 3,
                  onPress: async () => {
                    setLoadingTasks(new Map(loadingTasks.set(
                      task.id,
                      3
                      /* Resume */
                    )));
                    try {
                      await BApi$1.backgroundTask.resumeBackgroundTask(task.id);
                    } finally {
                      setLoadingTasks((prev2) => {
                        const next2 = new Map(prev2);
                        next2.delete(task.id);
                        return next2;
                      });
                    }
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$11, { className: "text-base" })
                },
                `resume-${task.id}`
              )
            );
            break;
          case 4:
            opts2.push(
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  color: "danger",
                  size: "sm",
                  variant: "light",
                  isLoading: loadingTasks.get(task.id) === 4,
                  onPress: () => {
                    createPortal(Modal, {
                      defaultVisible: true,
                      title: t2("Stopping task: {{taskName}}", {
                        taskName: task.name
                      }),
                      children: task.messageOnInterruption ?? t2("Are you sure to stop this task?"),
                      onOk: async () => {
                        setLoadingTasks(new Map(loadingTasks.set(
                          task.id,
                          4
                          /* Stop */
                        )));
                        try {
                          await BApi$1.backgroundTask.stopBackgroundTask(task.id);
                        } finally {
                          setLoadingTasks((prev2) => {
                            const next2 = new Map(prev2);
                            next2.delete(task.id);
                            return next2;
                          });
                        }
                      },
                      classNames: {
                        wrapper: "floating-assistant-modal"
                      }
                    });
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$9, { className: "text-base" })
                },
                `stop-${task.id}`
              )
            );
            break;
          case 5:
            opts2.push(
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  size: "sm",
                  variant: "light",
                  onPress: () => {
                    setCleaningTaskId(task.id);
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$$, { className: "text-base" })
                },
                `clean-${task.id}`
              )
            );
            break;
          case 6:
            opts2.push(
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  size: "sm",
                  variant: "light",
                  onPress: () => {
                    createPortal(Modal, {
                      defaultVisible: true,
                      title: t2("About to leave current page"),
                      children: t2("Sure?"),
                      onOk: async () => {
                        navigate("/background-task");
                      },
                      classNames: {
                        wrapper: "floating-assistant-modal"
                      }
                    });
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$e, { className: "text-base" })
                },
                `config-${task.id}`
              )
            );
            break;
        }
      }
    });
    return opts2;
  };
  const renderTasks = () => {
    if ((bTasks == null ? void 0 : bTasks.length) > 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        table_default,
        {
          isCompact: true,
          isStriped: true,
          removeWrapper: true,
          "aria-label": "Example table with dynamic content",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_header_default, { columns: columns.current, children: (column2) => /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2(column2.label) }, column2.key) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: bTasks.map((task) => {
              return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                table_row_default,
                {
                  className: `transition-opacity ${task.id == cleaningTaskId ? "opacity-0" : ""}`,
                  onTransitionEnd: (evt) => {
                    if (evt.propertyName == "opacity" && task.id == cleaningTaskId) {
                      BApi$1.backgroundTask.cleanBackgroundTask(task.id);
                    }
                  },
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                      task.name,
                      task.isPersistent && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { color: "secondary", content: t2("Persistent scheduled task"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$i, { className: "text-base opacity-40" }) }),
                      task.description && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { color: "secondary", content: task.description, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                        RefIcon$1e,
                        {
                          className: "text-base opacity-60"
                        }
                      ) })
                    ] }) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: renderTaskStatus(task) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: task.process && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", variant: "light", children: task.process }) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        progress_default,
                        {
                          color: "primary",
                          size: "sm",
                          value: task.percentage
                        }
                      ),
                      /* @__PURE__ */ jsxRuntimeExports.jsxs(
                        "div",
                        {
                          className: "absolute top-0 left-0 flex items-center justify-center w-full h-full",
                          children: [
                            task.percentage,
                            "%"
                          ]
                        }
                      )
                    ] }) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: task.startedAt && dayjs(task.startedAt).format("HH:mm:ss") }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: (() => {
                      const ms = computeDisplayElapsedMs(task);
                      return ms != null ? dayjs.duration(ms).format("HH:mm:ss") : void 0;
                    })() }) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: (() => {
                      const ms = computeDisplayRemainingMs(task);
                      return ms != null ? dayjs.duration(ms).format("HH:mm:ss") : void 0;
                    })() }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: task.nextTimeStartAt && dayjs(task.nextTimeStartAt).format("HH:mm:ss") }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: renderTaskOpts(task) }) })
                  ]
                },
                task.id
              );
            }) })
          ]
        }
      );
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-[80px] flex items-center justify-center", children: t2("No background task") });
  };
  const clearableTasks = bTasks.filter(
    (t22) => !t22.isPersistent && (t22.status == BTaskStatus.Completed || t22.status == BTaskStatus.Error || t22.status == BTaskStatus.Cancelled)
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    PopoverComponent,
    {
      trigger: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        "div",
        {
          ref: portalRef,
          className: `portal ${Object.keys(AssistantStatus)[status]} floating-assistant ${tasksVisible ? "" : "hide"}`,
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "loader", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {}) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "tick", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
              "svg",
              {
                version: "1.1",
                viewBox: "0 0 37 37",
                x: "0px",
                y: "0px",
                enableBackground: "new 0 0 37 37",
                className: allDoneCircleDrawn,
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    "path",
                    {
                      className: "circ path",
                      d: "M30.5,6.5L30.5,6.5c6.6,6.6,6.6,17.4,0,24l0,0c-6.6,6.6-17.4,6.6-24,0l0,0c-6.6-6.6-6.6-17.4,0-24l0,0C13.1-0.2,23.9-0.2,30.5,6.5z",
                      fill: "none",
                      stroke: "#08c29e",
                      strokeLinejoin: "round",
                      strokeMiterlimit: 10,
                      strokeWidth: 3
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    "polyline",
                    {
                      className: "tick path",
                      fill: "none",
                      points: "11.6,20 15.9,24.2 26.4,13.8",
                      stroke: "#08c29e",
                      strokeLinejoin: "round",
                      strokeMiterlimit: 10,
                      strokeWidth: 3
                    }
                  )
                ]
              }
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              "div",
              {
                className: "failed flex items-center justify-center w-[48px] h-[48px] ",
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$_, { className: "text-5xl" })
              }
            )
          ]
        }
      ),
      onOpenChange: (visible) => {
        setTasksVisible(visible);
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 p-2 min-w-[300px]", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 max-h-[600px] mt-2 overflow-auto", children: renderTasks() }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "horizontal" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: clearableTasks.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            size: "sm",
            variant: "ghost",
            onPress: () => BApi$1.backgroundTask.cleanInactiveBackgroundTasks(),
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$$, { className: "text-base" }),
              t2("Clear inactive tasks")
            ]
          }
        ) })
      ] })
    }
  ) });
};
FloatingAssistant.displayName = "FloatingAssistant";
const ErrorModal = ({ error: error2, errorInfo }) => {
  const { t: t2 } = useTranslation();
  const navigate = useNavigate();
  const [appInfo, setAppInfo] = reactExports.useState();
  reactExports.useEffect(() => {
    BApi$1.app.getAppInfo().then((rsp) => {
      if (!rsp.code) {
        setAppInfo({
          logPath: rsp.data.logPath
        });
      }
    });
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel"]
      },
      size: "xl",
      title: t2(
        "We have encountered some problems. You could try the following steps:"
      ),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        accordion_default,
        {
          isCompact: true,
          defaultSelectedKeys: ["1", "2", "3", "4"],
          selectionMode: "multiple",
          children: [
            error2 && /* @__PURE__ */ jsxRuntimeExports.jsx(
              accordion_item_base_default,
              {
                title: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold text-red-600", children: t2("Error Details") }),
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold text-sm mb-1", children: t2("Error Message:") }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      snippet_default,
                      {
                        hideSymbol: true,
                        className: "bg-red-50 border border-red-200",
                        radius: "none",
                        size: "sm",
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          "span",
                          {
                            className: "text-red-700 break-all whitespace-break-spaces",
                            children: error2.message || t2("Unknown error")
                          }
                        )
                      }
                    )
                  ] }),
                  error2.stack && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold text-sm mb-1", children: t2("Stack Trace:") }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      snippet_default,
                      {
                        hideSymbol: true,
                        className: "bg-gray-50 border border-gray-200",
                        radius: "none",
                        size: "sm",
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          "pre",
                          {
                            className: "text-xs text-gray-700 whitespace-pre-wrap break-all font-mono",
                            children: error2.stack
                          }
                        )
                      }
                    )
                  ] }),
                  (errorInfo == null ? void 0 : errorInfo.componentStack) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold text-sm mb-1", children: t2("Component Stack:") }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      snippet_default,
                      {
                        hideSymbol: true,
                        className: "bg-blue-50 border border-blue-200",
                        radius: "none",
                        size: "sm",
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          "pre",
                          {
                            className: "text-xs text-blue-700 whitespace-pre-wrap break-all font-mono",
                            children: errorInfo.componentStack
                          }
                        )
                      }
                    )
                  ] })
                ] })
              },
              "error-details"
            ) || null,
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              accordion_item_base_default,
              {
                title: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold", children: t2("Simply retry") }),
                children: t2("Press 'F5' to reload the page.")
              },
              "1"
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              accordion_item_base_default,
              {
                title: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold", children: t2("Restart the app") }),
                children: t2("Shutdown and restart the app completely.")
              },
              "2"
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              accordion_item_base_default,
              {
                title: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold", children: t2("Contact support") }),
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1 mb-2", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                    t2("You can find the latest log file at"),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(spacer_default, { y: 1 }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      snippet_default,
                      {
                        hideSymbol: true,
                        className: "cursor-pointer",
                        size: "sm",
                        style: { color: "var(--bakaui-primary)" },
                        onClick: () => {
                          if (appInfo == null ? void 0 : appInfo.logPath) {
                            BApi$1.tool.openFileOrDirectory({ path: appInfo.logPath });
                          }
                        },
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "break-all whitespace-break-spaces", children: appInfo == null ? void 0 : appInfo.logPath })
                      }
                    ),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(spacer_default, { y: 1 })
                  ] }),
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold", children: t2("If you have no programming experience,") }),
                    " ",
                    t2(
                      "please provide the latest log file to the support team."
                    )
                  ] }),
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold", children: t2("Otherwise,") }),
                    " ",
                    t2(
                      "you can locate and collect the error messages in the log file, and provide they to the support team. (open an issue on github, or send to developer directly)"
                    )
                  ] }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
                    Trans,
                    {
                      i18nKey: "ErrorHandlingModal.FindContactInConfigurationPage",
                      children: [
                        "You can find the concat at the bottom of",
                        /* @__PURE__ */ jsxRuntimeExports.jsx(
                          link_default,
                          {
                            className: "cursor-pointer",
                            size: "sm",
                            onClick: () => {
                              navigate("/configuration");
                            },
                            children: t2("Configuration page")
                          }
                        )
                      ]
                    }
                  ) })
                ] })
              },
              "3"
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              accordion_item_base_default,
              {
                title: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold", children: t2("Try other features") }),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  link_default,
                  {
                    className: "cursor-pointer",
                    size: "sm",
                    onClick: () => {
                      navigate("/");
                    },
                    children: t2("Return to homepage")
                  }
                )
              },
              "4"
            )
          ]
        }
      )
    }
  );
};
class ErrorBoundary extends React$5.Component {
  constructor(props) {
    super(props);
    this.state = {
      error: null,
      errorInfo: null
    };
  }
  static getDerivedStateFromError(error2) {
    return { error: error2 };
  }
  componentDidCatch(error2, errorInfo) {
    var _a2, _b2;
    console.error("Error caught by ErrorBoundary:", error2, errorInfo);
    this.setState({ errorInfo });
    (_b2 = (_a2 = this.props).onError) == null ? void 0 : _b2.call(_a2, error2, errorInfo);
  }
  render() {
    const { error: error2, errorInfo } = this.state;
    const { children, fallback: fallback2 } = this.props;
    if (error2) {
      if (fallback2) {
        return fallback2(error2, errorInfo || void 0);
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorModal, { error: error2, errorInfo: errorInfo || void 0 });
    }
    return children;
  }
}
const log$1 = buildLogger("BasicLayout");
function BasicLayout({
  children
}) {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const navigate = useNavigate();
  reactExports.useEffect(() => {
    log$1("Initializing...");
    BApi$1.app.checkAppInitialized().then((a2) => {
      switch (a2.data) {
        case InitializationContentType.NotAcceptTerms:
          navigate("/welcome");
          break;
        case InitializationContentType.NeedRestart:
          createPortal(Modal, {
            title: t2("Please restart app and try this later"),
            footer: false
          });
          break;
      }
    });
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(TourProvider, { steps: [], children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$1.insideWorld, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(FloatingAssistant, {}),
    /* @__PURE__ */ jsxRuntimeExports.jsx(Navigation, {}),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${styles$1.main} pt-1 pb-1 pr-1`, children })
  ] }) }) });
}
function BlankLayout({
  children
}) {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children });
}
const log2 = buildLogger("App");
function getLayout(layout2, children) {
  switch (layout2) {
    case "blank":
      return /* @__PURE__ */ jsxRuntimeExports.jsx(BlankLayout, { children });
    case "basic":
    default:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(BasicLayout, { children });
  }
}
function isLazyComponent(component) {
  return component.$$typeof === Symbol.for("react.lazy");
}
function flattenRoutes(config2) {
  const result = [];
  for (const r2 of config2) {
    if (r2.children) {
      result.push(...flattenRoutes(r2.children));
    }
    if (r2.path && r2.component) {
      const componentElement = /* @__PURE__ */ jsxRuntimeExports.jsx(r2.component, {});
      result.push({
        path: r2.path,
        element: getLayout(
          r2.layout || "basic",
          isLazyComponent(r2.component) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
            reactExports.Suspense,
            {
              fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-32", children: "Loading..." }),
              children: componentElement
            }
          ) : componentElement
        )
      });
    }
  }
  return result;
}
function AppRouter() {
  const location2 = useLocation();
  reactExports.useEffect(() => {
    log2("Current route:", location2.pathname);
  }, [location2]);
  const routes = flattenRoutes(routesMenuConfig);
  routes.push({ path: "*", element: /* @__PURE__ */ jsxRuntimeExports.jsx(Navigate, { replace: true, to: "/" }) });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(BakabaseContextProvider, { children: useRoutes(routes) });
}
client.createRoot(document.getElementById("root")).render(
  // <React.StrictMode>
  /* @__PURE__ */ jsxRuntimeExports.jsx(HashRouter, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(AppRouter, {}) })
  // </React.StrictMode>,
);
export {
  Index as $,
  Tab as A,
  Button as B,
  CSS$1 as C,
  DndContext as D,
  src_default as E,
  FilterGroupsPanel as F,
  GroupCombinator as G,
  FileNameModifierModal as H,
  card_default as I,
  card_header_default as J,
  KeyboardSensor as K,
  card_body_default as L,
  MediaPreviewer as M,
  spacer_default as N,
  ErrorBoundary as O,
  PscPropertyType as P,
  List as Q,
  ResourceMatcherValueType as R,
  SegmentMatcherConfiguration as S,
  Tabs as T,
  ResourceTransferModal as U,
  FolderSelector as V,
  AfterFirstPlayOperationsModal as W,
  listbox_default as X,
  listbox_item_base_default as Y,
  SimpleLabel as Z,
  FileSystemSelectorButton as _,
  convertToPscValueFromPathConfigurationDto as a,
  getFinalKeyframe as a$,
  OrderSelector as a0,
  Editor$2 as a1,
  StandardValueType as a2,
  DeprecatedChip as a3,
  BetaChip as a4,
  PropertyMatcher as a5,
  PropertyType as a6,
  calcGeneratorDuration as a7,
  maxGeneratorDuration as a8,
  millisecondsToSeconds as a9,
  animateValue as aA,
  collectMotionValues as aB,
  hasReducedMotionListener as aC,
  initPrefersReducedMotion as aD,
  prefersReducedMotion as aE,
  animateVisualElement as aF,
  setTarget as aG,
  isEasingArray as aH,
  mixNumber$1 as aI,
  removeItem as aJ,
  fillOffset as aK,
  isGenerator as aL,
  VisualElement as aM,
  createBox as aN,
  isSVGElement$1 as aO,
  SVGVisualElement as aP,
  HTMLVisualElement as aQ,
  visualElementStore as aR,
  animateSingleValue as aS,
  animateTarget as aT,
  spring as aU,
  GroupPlaybackControls as aV,
  memo$1 as aW,
  invariant$2 as aX,
  supportsLinearEasing as aY,
  supportsWaapi as aZ,
  startWaapiAnimation as a_,
  secondsToMilliseconds as aa,
  attachTimeline as ab,
  noop$9 as ac,
  createMotionComponentFactory as ad,
  animations as ae,
  createDomVisualElement as af,
  layout as ag,
  drag as ah,
  gestureAnimations as ai,
  createDOMMotionComponentProxy as aj,
  frame as ak,
  cancelFrame as al,
  resolveElements as am,
  progress$1 as an,
  velocityPerSecond as ao,
  interpolate$2 as ap,
  defaultOffset as aq,
  clamp$1 as ar,
  frameData as as,
  supportsScrollTimeline as at,
  useConstant as au,
  motionValue as av,
  useIsomorphicLayoutEffect$4 as aw,
  warning$3 as ax,
  MotionConfigContext as ay,
  isMotionValue as az,
  useBakabaseContext as b,
  frameSteps as b$,
  browserNumberValueTypes as b0,
  getValueTransition as b1,
  addDomEvent as b2,
  motionComponentSymbol as b3,
  rootProjectionNode as b4,
  instantAnimationState as b5,
  useForceUpdate as b6,
  transformProps as b7,
  optimizedAppearDataId as b8,
  getOptimisedAppearId as b9,
  optimizedAppearDataAttribute as bA,
  LayoutGroupContext as bB,
  PresenceContext as bC,
  SwitchLayoutGroupContext as bD,
  FlatTree as bE,
  DeprecatedLayoutGroupContext as bF,
  delay$1 as bG,
  isDragActive as bH,
  MotionValue as bI,
  inertia as bJ,
  keyframes as bK,
  time as bL,
  mix as bM,
  pipe as bN,
  anticipate as bO,
  backIn as bP,
  backInOut as bQ,
  backOut as bR,
  circIn as bS,
  circInOut as bT,
  circOut as bU,
  cubicBezier as bV,
  easeIn as bW,
  easeInOut as bX,
  easeOut as bY,
  mirrorEasing as bZ,
  reverseEasing as b_,
  makeUseVisualState as ba,
  LayoutGroup as bb,
  MotionContext as bc,
  moveItem as bd,
  easingDefinitionToFunction as be,
  stepsOrder as bf,
  AnimatePresence as bg,
  LazyMotion as bh,
  MotionConfig as bi,
  m$3 as bj,
  domAnimation$8 as bk,
  domMax as bl,
  useWillChange as bm,
  resolveMotionValue as bn,
  AcceleratedAnimation as bo,
  useIsPresent as bp,
  usePresence as bq,
  createRendererMotionComponent as br,
  isValidMotionProp as bs,
  addScaleCorrector as bt,
  buildTransform as bu,
  MotionGlobalConfig as bv,
  color$2 as bw,
  complex as bx,
  px as by,
  findSpring as bz,
  commonjsGlobal as c,
  distance as c0,
  distance2D as c1,
  calcLength as c2,
  filterProps as c3,
  addPointerEvent as c4,
  addPointerInfo as c5,
  isBrowser$2 as c6,
  React$5 as c7,
  __vitePreload as c8,
  PathSegmentConfigurationPropsMatcherOptions as d,
  PathSegmentsConfiguration as e,
  SegmentMatcherConfigurationModesData as f,
  getDefaultExportFromCjs as g,
  convertToPathConfigurationDtoFromPscValue as h,
  useTour as i,
  jsxRuntimeExports as j,
  useSortable as k,
  useSensors as l,
  useSensor as m,
  PointerSensor as n,
  closestCenter as o,
  SortableContext$1 as p,
  arrayMove as q,
  reactExports as r,
  sortableKeyboardCoordinates as s,
  CategoryEnhancerOptionsDialog as t,
  useTranslation as u,
  verticalListSortingStrategy as v,
  BApi$1 as w,
  propertyTypes as x,
  ModalContent as y,
  PresetTemplateBuilder as z
};
